diff options
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/traps.c | 33 | ||||
-rw-r--r-- | arch/sparc64/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/sparc64/mm/init.c | 23 |
3 files changed, 28 insertions, 30 deletions
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 1aa15990f5af..eeb1e835c423 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -757,26 +757,12 @@ void __init cheetah_ecache_flush_init(void) | |||
757 | ecache_flush_size = (2 * largest_size); | 757 | ecache_flush_size = (2 * largest_size); |
758 | ecache_flush_linesize = smallest_linesize; | 758 | ecache_flush_linesize = smallest_linesize; |
759 | 759 | ||
760 | /* Discover a physically contiguous chunk of physical | 760 | ecache_flush_physbase = find_ecache_flush_span(ecache_flush_size); |
761 | * memory in 'sp_banks' of size ecache_flush_size calculated | ||
762 | * above. Store the physical base of this area at | ||
763 | * ecache_flush_physbase. | ||
764 | */ | ||
765 | for (node = 0; ; node++) { | ||
766 | if (sp_banks[node].num_bytes == 0) | ||
767 | break; | ||
768 | if (sp_banks[node].num_bytes >= ecache_flush_size) { | ||
769 | ecache_flush_physbase = sp_banks[node].base_addr; | ||
770 | break; | ||
771 | } | ||
772 | } | ||
773 | 761 | ||
774 | /* Note: Zero would be a valid value of ecache_flush_physbase so | 762 | if (ecache_flush_physbase == ~0UL) { |
775 | * don't use that as the success test. :-) | ||
776 | */ | ||
777 | if (sp_banks[node].num_bytes == 0) { | ||
778 | prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " | 763 | prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " |
779 | "contiguous physical memory.\n", ecache_flush_size); | 764 | "contiguous physical memory.\n", |
765 | ecache_flush_size); | ||
780 | prom_halt(); | 766 | prom_halt(); |
781 | } | 767 | } |
782 | 768 | ||
@@ -1345,16 +1331,9 @@ static int cheetah_fix_ce(unsigned long physaddr) | |||
1345 | /* Return non-zero if PADDR is a valid physical memory address. */ | 1331 | /* Return non-zero if PADDR is a valid physical memory address. */ |
1346 | static int cheetah_check_main_memory(unsigned long paddr) | 1332 | static int cheetah_check_main_memory(unsigned long paddr) |
1347 | { | 1333 | { |
1348 | int i; | 1334 | unsigned long vaddr = PAGE_OFFSET + paddr; |
1349 | 1335 | ||
1350 | for (i = 0; ; i++) { | 1336 | return kern_addr_valid(vaddr); |
1351 | if (sp_banks[i].num_bytes == 0) | ||
1352 | break; | ||
1353 | if (paddr >= sp_banks[i].base_addr && | ||
1354 | paddr < (sp_banks[i].base_addr + sp_banks[i].num_bytes)) | ||
1355 | return 1; | ||
1356 | } | ||
1357 | return 0; | ||
1358 | } | 1337 | } |
1359 | 1338 | ||
1360 | void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar) | 1339 | void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar) |
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 80793d61f311..31fbc67719a1 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #define ELEMENTS(arr) (sizeof (arr)/sizeof (arr[0])) | 33 | #define ELEMENTS(arr) (sizeof (arr)/sizeof (arr[0])) |
34 | 34 | ||
35 | extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; | ||
36 | |||
37 | /* | 35 | /* |
38 | * To debug kernel to catch accesses to certain virtual/physical addresses. | 36 | * To debug kernel to catch accesses to certain virtual/physical addresses. |
39 | * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints. | 37 | * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints. |
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 63a7b9bafaff..48851a2e4fe1 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -41,7 +41,14 @@ | |||
41 | 41 | ||
42 | extern void device_scan(void); | 42 | extern void device_scan(void); |
43 | 43 | ||
44 | struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; | 44 | struct sparc_phys_banks { |
45 | unsigned long base_addr; | ||
46 | unsigned long num_bytes; | ||
47 | }; | ||
48 | |||
49 | #define SPARC_PHYS_BANKS 32 | ||
50 | |||
51 | static struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; | ||
45 | 52 | ||
46 | unsigned long *sparc64_valid_addr_bitmap __read_mostly; | 53 | unsigned long *sparc64_valid_addr_bitmap __read_mostly; |
47 | 54 | ||
@@ -1425,6 +1432,20 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
1425 | } | 1432 | } |
1426 | #endif | 1433 | #endif |
1427 | 1434 | ||
1435 | unsigned long __init find_ecache_flush_span(unsigned long size) | ||
1436 | { | ||
1437 | unsigned long i; | ||
1438 | |||
1439 | for (i = 0; ; i++) { | ||
1440 | if (sp_banks[i].num_bytes == 0) | ||
1441 | break; | ||
1442 | if (sp_banks[i].num_bytes >= size) | ||
1443 | return sp_banks[i].base_addr; | ||
1444 | } | ||
1445 | |||
1446 | return ~0UL; | ||
1447 | } | ||
1448 | |||
1428 | static void __init prom_probe_memory(void) | 1449 | static void __init prom_probe_memory(void) |
1429 | { | 1450 | { |
1430 | struct linux_mlist_p1275 *mlist; | 1451 | struct linux_mlist_p1275 *mlist; |