···757757 ecache_flush_size = (2 * largest_size);758758 ecache_flush_linesize = smallest_linesize;759759760760- /* Discover a physically contiguous chunk of physical761761- * memory in 'sp_banks' of size ecache_flush_size calculated762762- * above. Store the physical base of this area at763763- * ecache_flush_physbase.764764- */765765- for (node = 0; ; node++) {766766- if (sp_banks[node].num_bytes == 0)767767- break;768768- if (sp_banks[node].num_bytes >= ecache_flush_size) {769769- ecache_flush_physbase = sp_banks[node].base_addr;770770- break;771771- }772772- }760760+ ecache_flush_physbase = find_ecache_flush_span(ecache_flush_size);773761774774- /* Note: Zero would be a valid value of ecache_flush_physbase so775775- * don't use that as the success test. :-)776776- */777777- if (sp_banks[node].num_bytes == 0) {762762+ if (ecache_flush_physbase == ~0UL) {778763 prom_printf("cheetah_ecache_flush_init: Cannot find %d byte "779779- "contiguous physical memory.\n", ecache_flush_size);764764+ "contiguous physical memory.\n",765765+ ecache_flush_size);780766 prom_halt();781767 }782768···13311345/* Return non-zero if PADDR is a valid physical memory address. */13321346static int cheetah_check_main_memory(unsigned long paddr)13331347{13341334- int i;13481348+ unsigned long vaddr = PAGE_OFFSET + paddr;1335134913361336- for (i = 0; ; i++) {13371337- if (sp_banks[i].num_bytes == 0)13381338- break;13391339- if (paddr >= sp_banks[i].base_addr &&13401340- paddr < (sp_banks[i].base_addr + sp_banks[i].num_bytes))13411341- return 1;13421342- }13431343- return 0;13501350+ return kern_addr_valid(vaddr);13441351}1345135213461353void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar)
-2
arch/sparc64/mm/fault.c
···32323333#define ELEMENTS(arr) (sizeof (arr)/sizeof (arr[0]))34343535-extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];3636-3735/*3836 * To debug kernel to catch accesses to certain virtual/physical addresses.3937 * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints.
+22-1
arch/sparc64/mm/init.c
···41414242extern void device_scan(void);43434444-struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];4444+struct sparc_phys_banks {4545+ unsigned long base_addr;4646+ unsigned long num_bytes;4747+};4848+4949+#define SPARC_PHYS_BANKS 325050+5151+static struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];45524653unsigned long *sparc64_valid_addr_bitmap __read_mostly;4754···14311424 PAGE_OFFSET + phys_end);14321425}14331426#endif14271427+14281428+unsigned long __init find_ecache_flush_span(unsigned long size)14291429+{14301430+ unsigned long i;14311431+14321432+ for (i = 0; ; i++) {14331433+ if (sp_banks[i].num_bytes == 0)14341434+ break;14351435+ if (sp_banks[i].num_bytes >= size)14361436+ return sp_banks[i].base_addr;14371437+ }14381438+14391439+ return ~0UL;14401440+}1434144114351442static void __init prom_probe_memory(void)14361443{
-17
include/asm-sparc64/page.h
···140140#define virt_to_phys __pa141141#define phys_to_virt __va142142143143-/* The following structure is used to hold the physical144144- * memory configuration of the machine. This is filled in145145- * probe_memory() and is later used by mem_init() to set up146146- * mem_map[]. We statically allocate SPARC_PHYS_BANKS of147147- * these structs, this is arbitrary. The entry after the148148- * last valid one has num_bytes==0.149149- */150150-151151-struct sparc_phys_banks {152152- unsigned long base_addr;153153- unsigned long num_bytes;154154-};155155-156156-#define SPARC_PHYS_BANKS 32157157-158158-extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];159159-160143#endif /* !(__ASSEMBLY__) */161144162145#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
+1
include/asm-sparc64/pgtable.h
···342342extern pmd_t swapper_low_pmd_dir[2048];343343344344extern void paging_init(void);345345+extern unsigned long find_ecache_flush_span(unsigned long size);345346346347/* These do nothing with the way I have things setup. */347348#define mmu_lockarea(vaddr, len) (vaddr)