summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/ps3/mm.c
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2015-01-13 02:00:20 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2015-01-22 07:31:21 +0100
commitd4b18bd675b850fbf395304433952130034bdd89 (patch)
tree2a6fbda17f555033b85f228d85c1fa9c38a89fd0 /arch/powerpc/platforms/ps3/mm.c
parentpowerpc/ps3: Add empty repository highmem routines (diff)
downloadlinux-d4b18bd675b850fbf395304433952130034bdd89.tar.xz
linux-d4b18bd675b850fbf395304433952130034bdd89.zip
powerpc/ps3: Add ps3_mm_set_repository_highmem
Add the new routine ps3_mm_set_repository_highmem() that saves highmem info to the LV1 hypervisor registry so that the info will be available to second stage OS's loaded by petitboot/kexec. FreeBSD and some Linux derivatives use this feature. Also, move the existing ps3_mm_get_repository_highmem() routine up in the source file. This implementation of ps3_mm_set_repository_highmem() assumes the repository will have a single highmem region entry (at index 0). Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/ps3/mm.c')
-rw-r--r--arch/powerpc/platforms/ps3/mm.c68
1 files changed, 38 insertions, 30 deletions
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 0c9f643d9e2a..04c1b938d762 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -223,6 +223,44 @@ void ps3_mm_vas_destroy(void)
}
}
+static int ps3_mm_get_repository_highmem(struct mem_region *r)
+{
+ int result;
+
+ /* Assume a single highmem region. */
+
+ result = ps3_repository_read_highmem_info(0, &r->base, &r->size);
+
+ if (result)
+ goto zero_region;
+
+ if (!r->base || !r->size) {
+ result = -1;
+ goto zero_region;
+ }
+
+ r->offset = r->base - map.rm.size;
+
+ DBG("%s:%d: Found high region in repository: %llxh %llxh\n",
+ __func__, __LINE__, r->base, r->size);
+
+ return 0;
+
+zero_region:
+ DBG("%s:%d: No high region in repository.\n", __func__, __LINE__);
+
+ r->size = r->base = r->offset = 0;
+ return result;
+}
+
+static int ps3_mm_set_repository_highmem(const struct mem_region *r)
+{
+ /* Assume a single highmem region. */
+
+ return r ? ps3_repository_write_highmem_info(0, r->base, r->size) :
+ ps3_repository_write_highmem_info(0, 0, 0);
+}
+
/**
* ps3_mm_region_create - create a memory region in the vas
* @r: pointer to a struct mem_region to accept initialized values
@@ -293,36 +331,6 @@ static void ps3_mm_region_destroy(struct mem_region *r)
}
}
-static int ps3_mm_get_repository_highmem(struct mem_region *r)
-{
- int result;
-
- /* Assume a single highmem region. */
-
- result = ps3_repository_read_highmem_info(0, &r->base, &r->size);
-
- if (result)
- goto zero_region;
-
- if (!r->base || !r->size) {
- result = -1;
- goto zero_region;
- }
-
- r->offset = r->base - map.rm.size;
-
- DBG("%s:%d: Found high region in repository: %llxh %llxh\n",
- __func__, __LINE__, r->base, r->size);
-
- return 0;
-
-zero_region:
- DBG("%s:%d: No high region in repository.\n", __func__, __LINE__);
-
- r->size = r->base = r->offset = 0;
- return result;
-}
-
/*============================================================================*/
/* dma routines */
/*============================================================================*/