Commit b206fc4c authored by David S. Miller's avatar David S. Miller

[SPARC64]: Do not allocate prom translations using bootmem.

Use __initdata instead.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1ac4f5eb
...@@ -310,6 +310,7 @@ struct linux_prom_translation { ...@@ -310,6 +310,7 @@ struct linux_prom_translation {
unsigned long size; unsigned long size;
unsigned long data; unsigned long data;
}; };
static struct linux_prom_translation prom_trans[512] __initdata;
extern unsigned long prom_boot_page; extern unsigned long prom_boot_page;
extern void prom_remap(unsigned long physpage, unsigned long virtpage, int mmu_ihandle); extern void prom_remap(unsigned long physpage, unsigned long virtpage, int mmu_ihandle);
...@@ -363,7 +364,6 @@ unsigned long prom_virt_to_phys(unsigned long promva, int *error) ...@@ -363,7 +364,6 @@ unsigned long prom_virt_to_phys(unsigned long promva, int *error)
static void inherit_prom_mappings(void) static void inherit_prom_mappings(void)
{ {
struct linux_prom_translation *trans;
unsigned long phys_page, tte_vaddr, tte_data; unsigned long phys_page, tte_vaddr, tte_data;
void (*remap_func)(unsigned long, unsigned long, int); void (*remap_func)(unsigned long, unsigned long, int);
pmd_t *pmdp; pmd_t *pmdp;
...@@ -373,30 +373,27 @@ static void inherit_prom_mappings(void) ...@@ -373,30 +373,27 @@ static void inherit_prom_mappings(void)
node = prom_finddevice("/virtual-memory"); node = prom_finddevice("/virtual-memory");
n = prom_getproplen(node, "translations"); n = prom_getproplen(node, "translations");
if (n == 0 || n == -1) { if (n == 0 || n == -1) {
prom_printf("Couldn't get translation property\n"); prom_printf("prom_mappings: Couldn't get size.\n");
prom_halt(); prom_halt();
} }
n += 5 * sizeof(struct linux_prom_translation); n += 24 * sizeof(struct linux_prom_translation);
for (tsz = 1; tsz < n; tsz <<= 1) if (n > sizeof(prom_trans)) {
/* empty */; prom_printf("prom_mappings: prom_trans too small, "
trans = __alloc_bootmem(tsz, SMP_CACHE_BYTES, bootmap_base); "need %Zd bytes\n", n);
if (trans == NULL) {
prom_printf("inherit_prom_mappings: Cannot alloc translations.\n");
prom_halt(); prom_halt();
} }
memset(trans, 0, tsz); tsz = n;
if ((n = prom_getproperty(node, "translations",
if ((n = prom_getproperty(node, "translations", (char *)trans, tsz)) == -1) { (char *)&prom_trans[0], tsz)) == -1) {
prom_printf("Couldn't get translation property\n"); prom_printf("prom_mappings: Couldn't get property.\n");
prom_halt(); prom_halt();
} }
n = n / sizeof(*trans); n = n / sizeof(struct linux_prom_translation);
/* /* The obp translations are saved based on 8k pagesize, since obp
* The obp translations are saved based on 8k pagesize, since obp can * can use a mixture of pagesizes. Misses to the 0xf0000000 ->
* use a mixture of pagesizes. Misses to the 0xf0000000 - 0x100000000, * 0x100000000, ie obp range, are handled in entry.S and do not
* ie obp range, are handled in entry.S and do not use the vpte scheme * use the vpte scheme (see rant: inherit_locked_prom_mappings).
* (see rant in inherit_locked_prom_mappings()).
*/ */
#define OBP_PMD_SIZE 2048 #define OBP_PMD_SIZE 2048
prompmd = __alloc_bootmem(OBP_PMD_SIZE, OBP_PMD_SIZE, bootmap_base); prompmd = __alloc_bootmem(OBP_PMD_SIZE, OBP_PMD_SIZE, bootmap_base);
...@@ -406,9 +403,9 @@ static void inherit_prom_mappings(void) ...@@ -406,9 +403,9 @@ static void inherit_prom_mappings(void)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
unsigned long vaddr; unsigned long vaddr;
if (trans[i].virt >= LOW_OBP_ADDRESS && trans[i].virt < HI_OBP_ADDRESS) { if (prom_trans[i].virt >= LOW_OBP_ADDRESS && prom_trans[i].virt < HI_OBP_ADDRESS) {
for (vaddr = trans[i].virt; for (vaddr = prom_trans[i].virt;
((vaddr < trans[i].virt + trans[i].size) && ((vaddr < prom_trans[i].virt + prom_trans[i].size) &&
(vaddr < HI_OBP_ADDRESS)); (vaddr < HI_OBP_ADDRESS));
vaddr += BASE_PAGE_SIZE) { vaddr += BASE_PAGE_SIZE) {
unsigned long val; unsigned long val;
...@@ -426,7 +423,7 @@ static void inherit_prom_mappings(void) ...@@ -426,7 +423,7 @@ static void inherit_prom_mappings(void)
ptep = (pte_t *)__pmd_page(*pmdp) + ptep = (pte_t *)__pmd_page(*pmdp) +
((vaddr >> 13) & 0x3ff); ((vaddr >> 13) & 0x3ff);
val = trans[i].data; val = prom_trans[i].data;
/* Clear diag TTE bits. */ /* Clear diag TTE bits. */
if (tlb_type == spitfire) if (tlb_type == spitfire)
...@@ -434,7 +431,7 @@ static void inherit_prom_mappings(void) ...@@ -434,7 +431,7 @@ static void inherit_prom_mappings(void)
set_pte_at(&init_mm, vaddr, set_pte_at(&init_mm, vaddr,
ptep, __pte(val | _PAGE_MODIFIED)); ptep, __pte(val | _PAGE_MODIFIED));
trans[i].data += BASE_PAGE_SIZE; prom_trans[i].data += BASE_PAGE_SIZE;
} }
} }
} }
...@@ -571,15 +568,16 @@ static void inherit_prom_mappings(void) ...@@ -571,15 +568,16 @@ static void inherit_prom_mappings(void)
} }
/* Re-read translations property. */ /* Re-read translations property. */
if ((n = prom_getproperty(node, "translations", (char *)trans, tsz)) == -1) { if ((n = prom_getproperty(node, "translations",
prom_printf("Couldn't get translation property\n"); (char *)&prom_trans[0], tsz)) == -1) {
prom_printf("prom_mappings: Can't reread prom_trans.\n");
prom_halt(); prom_halt();
} }
n = n / sizeof(*trans); n = n / sizeof(struct linux_prom_translation);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
unsigned long vaddr = trans[i].virt; unsigned long vaddr = prom_trans[i].virt;
unsigned long size = trans[i].size; unsigned long size = prom_trans[i].size;
if (vaddr < 0xf0000000UL) { if (vaddr < 0xf0000000UL) {
unsigned long avoid_start = (unsigned long) KERNBASE; unsigned long avoid_start = (unsigned long) KERNBASE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment