···3333 depends on DEBUG_KERNEL3434 bool "Debug BOOTMEM initialization"35353636+config DEBUG_PAGEALLOC3737+ bool "Page alloc debugging"3838+ depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND3939+ help4040+ Unmap pages from the kernel linear mapping after free_pages().4141+ This results in a large slowdown, but helps to find certain types4242+ of memory corruptions.4343+3644config MCOUNT3745 bool3846 depends on STACK_DEBUG
···3030 .text3131 .align 3232323333- .globl sparc64_vpte_patchme13434- .globl sparc64_vpte_patchme23535-/*3636- * On a second level vpte miss, check whether the original fault is to the OBP 3737- * range (note that this is only possible for instruction miss, data misses to3838- * obp range do not use vpte). If so, go back directly to the faulting address.3939- * This is because we want to read the tpc, otherwise we have no way of knowing4040- * the 8k aligned faulting address if we are using >8k kernel pagesize. This4141- * also ensures no vpte range addresses are dropped into tlb while obp is4242- * executing (see inherit_locked_prom_mappings() rant).4343- */4444-sparc64_vpte_nucleus:4545- /* Note that kvmap below has verified that the address is4646- * in the range MODULES_VADDR --> VMALLOC_END already. So4747- * here we need only check if it is an OBP address or not.4848- */4949- sethi %hi(LOW_OBP_ADDRESS), %g55050- cmp %g4, %g55151- blu,pn %xcc, sparc64_vpte_patchme15252- mov 0x1, %g55353- sllx %g5, 32, %g55454- cmp %g4, %g55555- blu,pn %xcc, obp_iaddr_patch5656- nop5757-5858- /* These two instructions are patched by paginig_init(). */5959-sparc64_vpte_patchme1:6060- sethi %hi(0), %g56161-sparc64_vpte_patchme2:6262- or %g5, %lo(0), %g56363-6464- /* With kernel PGD in %g5, branch back into dtlb_backend. */6565- ba,pt %xcc, sparc64_kpte_continue6666- andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */6767-6868-vpte_noent:6969- /* Restore previous TAG_ACCESS, %g5 is zero, and we will7070- * skip over the trap instruction so that the top level7171- * TLB miss handler will thing this %g5 value is just an7272- * invalid PTE, thus branching to full fault processing.7373- */7474- mov TLB_SFSR, %g17575- stxa %g4, [%g1 + %g1] ASI_DMMU7676- done7777-7878- .globl obp_iaddr_patch7979-obp_iaddr_patch:8080- /* These two instructions patched by inherit_prom_mappings(). */8181- sethi %hi(0), %g58282- or %g5, %lo(0), %g58383-8484- /* Behave as if we are at TL0. */8585- wrpr %g0, 1, %tl8686- rdpr %tpc, %g4 /* Find original faulting iaddr */8787- srlx %g4, 13, %g4 /* Throw out context bits */8888- sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */8989-9090- /* Restore previous TAG_ACCESS. */9191- mov TLB_SFSR, %g19292- stxa %g4, [%g1 + %g1] ASI_IMMU9393-9494- /* Get PMD offset. */9595- srlx %g4, 23, %g69696- and %g6, 0x7ff, %g69797- sllx %g6, 2, %g69898-9999- /* Load PMD, is it valid? */100100- lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5101101- brz,pn %g5, longpath102102- sllx %g5, 11, %g5103103-104104- /* Get PTE offset. */105105- srlx %g4, 13, %g6106106- and %g6, 0x3ff, %g6107107- sllx %g6, 3, %g6108108-109109- /* Load PTE. */110110- ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5111111- brgez,pn %g5, longpath112112- nop113113-114114- /* TLB load and return from trap. */115115- stxa %g5, [%g0] ASI_ITLB_DATA_IN116116- retry117117-118118- .globl obp_daddr_patch119119-obp_daddr_patch:120120- /* These two instructions patched by inherit_prom_mappings(). */121121- sethi %hi(0), %g5122122- or %g5, %lo(0), %g5123123-124124- /* Get PMD offset. */125125- srlx %g4, 23, %g6126126- and %g6, 0x7ff, %g6127127- sllx %g6, 2, %g6128128-129129- /* Load PMD, is it valid? */130130- lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5131131- brz,pn %g5, longpath132132- sllx %g5, 11, %g5133133-134134- /* Get PTE offset. */135135- srlx %g4, 13, %g6136136- and %g6, 0x3ff, %g6137137- sllx %g6, 3, %g6138138-139139- /* Load PTE. */140140- ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5141141- brgez,pn %g5, longpath142142- nop143143-144144- /* TLB load and return from trap. */145145- stxa %g5, [%g0] ASI_DTLB_DATA_IN146146- retry147147-148148-/*149149- * On a first level data miss, check whether this is to the OBP range (note150150- * that such accesses can be made by prom, as well as by kernel using151151- * prom_getproperty on "address"), and if so, do not use vpte access ...152152- * rather, use information saved during inherit_prom_mappings() using 8k153153- * pagesize.154154- */155155- .align 32156156-kvmap:157157- sethi %hi(MODULES_VADDR), %g5158158- cmp %g4, %g5159159- blu,pn %xcc, longpath160160- mov (VMALLOC_END >> 24), %g5161161- sllx %g5, 24, %g5162162- cmp %g4, %g5163163- bgeu,pn %xcc, longpath164164- nop165165-166166-kvmap_check_obp:167167- sethi %hi(LOW_OBP_ADDRESS), %g5168168- cmp %g4, %g5169169- blu,pn %xcc, kvmap_vmalloc_addr170170- mov 0x1, %g5171171- sllx %g5, 32, %g5172172- cmp %g4, %g5173173- blu,pn %xcc, obp_daddr_patch174174- nop175175-176176-kvmap_vmalloc_addr:177177- /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */178178- ldxa [%g3 + %g6] ASI_N, %g5179179- brgez,pn %g5, longpath180180- nop181181-182182- /* PTE is valid, load into TLB and return from trap. */183183- stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB184184- retry185185-18633 /* This is trivial with the new code... */18734 .globl do_fpdis18835do_fpdis:···372525 *373526 * DATA 0: [low 32-bits] Address of function to call, jmp to this374527 * [high 32-bits] MMU Context Argument 0, place in %g5375375- * DATA 1: Address Argument 1, place in %g6528528+ * DATA 1: Address Argument 1, place in %g1376529 * DATA 2: Address Argument 2, place in %g7377530 *378531 * With this method we can do most of the cross-call tlb/cache379532 * flushing very quickly.380533 *381381- * Current CPU's IRQ worklist table is locked into %g1,382382- * don't touch.534534+ * Current CPU's IRQ worklist table is locked into %g6, don't touch.383535 */384536 .text385537 .align 32···8521006 nop85310078541008do_cheetah_plus_data_parity:855855- ba,pt %xcc, etrap10091009+ rdpr %pil, %g210101010+ wrpr %g0, 15, %pil10111011+ ba,pt %xcc, etrap_irq8561012 rd %pc, %g78571013 mov 0x0, %o08581014 call cheetah_plus_parity_error8591015 add %sp, PTREGS_OFF, %o1860860- ba,pt %xcc, rtrap861861- clr %l610161016+ ba,a,pt %xcc, rtrap_irq86210178631018cheetah_plus_dcpe_trap_vector_tl1:8641019 membar #Sync···8831036 nop88410378851038do_cheetah_plus_insn_parity:886886- ba,pt %xcc, etrap10391039+ rdpr %pil, %g210401040+ wrpr %g0, 15, %pil10411041+ ba,pt %xcc, etrap_irq8871042 rd %pc, %g78881043 mov 0x1, %o08891044 call cheetah_plus_parity_error8901045 add %sp, PTREGS_OFF, %o1891891- ba,pt %xcc, rtrap892892- clr %l610461046+ ba,a,pt %xcc, rtrap_irq89310478941048cheetah_plus_icpe_trap_vector_tl1:8951049 membar #Sync···9231075 nop9241076 wrpr %g1, %tl ! Restore original trap level9251077do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */10781078+ sethi %hi(dcache_parity_tl1_occurred), %g210791079+ lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g110801080+ add %g1, 1, %g110811081+ stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)]9261082 /* Reset D-cache parity */9271083 sethi %hi(1 << 16), %g1 ! D-cache size9281084 mov (1 << 5), %g2 ! D-cache line size···9731121 nop9741122 wrpr %g1, %tl ! Restore original trap level9751123do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */11241124+ sethi %hi(icache_parity_tl1_occurred), %g211251125+ lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g111261126+ add %g1, 1, %g111271127+ stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)]9761128 /* Flush I-cache */9771129 sethi %hi(1 << 15), %g1 ! I-cache size9781130 mov (1 << 5), %g2 ! I-cache line size
+161-397
arch/sparc64/kernel/head.S
···8080 .xword 08181 .word _end82828383- /* We must be careful, 32-bit OpenBOOT will get confused if it8484- * tries to save away a register window to a 64-bit kernel8585- * stack address. Flush all windows, disable interrupts,8686- * remap if necessary, jump onto kernel trap table, then kernel8787- * stack, or else we die.8888- *8989- * PROM entry point is on %o49090- */8383+ /* PROM cif handler code address is in %o4. */9184sparc64_boot:8585+1: rd %pc, %g78686+ set 1b, %g18787+ cmp %g1, %g78888+ be,pn %xcc, sparc64_boot_after_remap8989+ mov %o4, %l79090+9191+ /* We need to remap the kernel. Use position independant9292+ * code to remap us to KERNBASE.9393+ *9494+ * SILO can invoke us with 32-bit address masking enabled,9595+ * so make sure that's clear.9696+ */9797+ rdpr %pstate, %g19898+ andn %g1, PSTATE_AM, %g19999+ wrpr %g1, 0x0, %pstate100100+ ba,a,pt %xcc, 1f101101+102102+ .globl prom_finddev_name, prom_chosen_path103103+ .globl prom_getprop_name, prom_mmu_name104104+ .globl prom_callmethod_name, prom_translate_name105105+ .globl prom_map_name, prom_unmap_name, prom_mmu_ihandle_cache106106+ .globl prom_boot_mapped_pc, prom_boot_mapping_mode107107+ .globl prom_boot_mapping_phys_high, prom_boot_mapping_phys_low108108+prom_finddev_name:109109+ .asciz "finddevice"110110+prom_chosen_path:111111+ .asciz "/chosen"112112+prom_getprop_name:113113+ .asciz "getprop"114114+prom_mmu_name:115115+ .asciz "mmu"116116+prom_callmethod_name:117117+ .asciz "call-method"118118+prom_translate_name:119119+ .asciz "translate"120120+prom_map_name:121121+ .asciz "map"122122+prom_unmap_name:123123+ .asciz "unmap"124124+ .align 4125125+prom_mmu_ihandle_cache:126126+ .word 0127127+prom_boot_mapped_pc:128128+ .word 0129129+prom_boot_mapping_mode:130130+ .word 0131131+ .align 8132132+prom_boot_mapping_phys_high:133133+ .xword 0134134+prom_boot_mapping_phys_low:135135+ .xword 0136136+1:137137+ rd %pc, %l0138138+ mov (1b - prom_finddev_name), %l1139139+ mov (1b - prom_chosen_path), %l2140140+ mov (1b - prom_boot_mapped_pc), %l3141141+ sub %l0, %l1, %l1142142+ sub %l0, %l2, %l2143143+ sub %l0, %l3, %l3144144+ stw %l0, [%l3]145145+ sub %sp, (192 + 128), %sp146146+147147+ /* chosen_node = prom_finddevice("/chosen") */148148+ stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "finddevice"149149+ mov 1, %l3150150+ stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 1151151+ stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1152152+ stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1, "/chosen"153153+ stx %g0, [%sp + 2047 + 128 + 0x20] ! ret1154154+ call %l7155155+ add %sp, (2047 + 128), %o0 ! argument array156156+157157+ ldx [%sp + 2047 + 128 + 0x20], %l4 ! chosen device node158158+159159+ mov (1b - prom_getprop_name), %l1160160+ mov (1b - prom_mmu_name), %l2161161+ mov (1b - prom_mmu_ihandle_cache), %l5162162+ sub %l0, %l1, %l1163163+ sub %l0, %l2, %l2164164+ sub %l0, %l5, %l5165165+166166+ /* prom_mmu_ihandle_cache = prom_getint(chosen_node, "mmu") */167167+ stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "getprop"168168+ mov 4, %l3169169+ stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 4170170+ mov 1, %l3171171+ stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1172172+ stx %l4, [%sp + 2047 + 128 + 0x18] ! arg1, chosen_node173173+ stx %l2, [%sp + 2047 + 128 + 0x20] ! arg2, "mmu"174174+ stx %l5, [%sp + 2047 + 128 + 0x28] ! arg3, &prom_mmu_ihandle_cache175175+ mov 4, %l3176176+ stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4, sizeof(arg3)177177+ stx %g0, [%sp + 2047 + 128 + 0x38] ! ret1178178+ call %l7179179+ add %sp, (2047 + 128), %o0 ! argument array180180+181181+ mov (1b - prom_callmethod_name), %l1182182+ mov (1b - prom_translate_name), %l2183183+ sub %l0, %l1, %l1184184+ sub %l0, %l2, %l2185185+ lduw [%l5], %l5 ! prom_mmu_ihandle_cache186186+187187+ stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "call-method"188188+ mov 3, %l3189189+ stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 3190190+ mov 5, %l3191191+ stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 5192192+ stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1: "translate"193193+ stx %l5, [%sp + 2047 + 128 + 0x20] ! arg2: prom_mmu_ihandle_cache194194+ srlx %l0, 22, %l3195195+ sllx %l3, 22, %l3196196+ stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: vaddr, our PC197197+ stx %g0, [%sp + 2047 + 128 + 0x30] ! res1198198+ stx %g0, [%sp + 2047 + 128 + 0x38] ! res2199199+ stx %g0, [%sp + 2047 + 128 + 0x40] ! res3200200+ stx %g0, [%sp + 2047 + 128 + 0x48] ! res4201201+ stx %g0, [%sp + 2047 + 128 + 0x50] ! res5202202+ call %l7203203+ add %sp, (2047 + 128), %o0 ! argument array204204+205205+ ldx [%sp + 2047 + 128 + 0x40], %l1 ! translation mode206206+ mov (1b - prom_boot_mapping_mode), %l4207207+ sub %l0, %l4, %l4208208+ stw %l1, [%l4]209209+ mov (1b - prom_boot_mapping_phys_high), %l4210210+ sub %l0, %l4, %l4211211+ ldx [%sp + 2047 + 128 + 0x48], %l2 ! physaddr high212212+ stx %l2, [%l4 + 0x0]213213+ ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low214214+ stx %l3, [%l4 + 0x8]215215+216216+ /* Leave service as-is, "call-method" */217217+ mov 7, %l3218218+ stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 7219219+ mov 1, %l3220220+ stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1221221+ mov (1b - prom_map_name), %l3222222+ sub %l0, %l3, %l3223223+ stx %l3, [%sp + 2047 + 128 + 0x18] ! arg1: "map"224224+ /* Leave arg2 as-is, prom_mmu_ihandle_cache */225225+ mov -1, %l3226226+ stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: mode (-1 default)227227+ sethi %hi(8 * 1024 * 1024), %l3228228+ stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4: size (8MB)229229+ sethi %hi(KERNBASE), %l3230230+ stx %l3, [%sp + 2047 + 128 + 0x38] ! arg5: vaddr (KERNBASE)231231+ stx %g0, [%sp + 2047 + 128 + 0x40] ! arg6: empty232232+ mov (1b - prom_boot_mapping_phys_low), %l3233233+ sub %l0, %l3, %l3234234+ ldx [%l3], %l3235235+ stx %l3, [%sp + 2047 + 128 + 0x48] ! arg7: phys addr236236+ call %l7237237+ add %sp, (2047 + 128), %o0 ! argument array238238+239239+ add %sp, (192 + 128), %sp240240+241241+sparc64_boot_after_remap:92242 BRANCH_IF_CHEETAH_BASE(g1,g7,cheetah_boot)93243 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,cheetah_plus_boot)94244 ba,pt %xcc, spitfire_boot···275125 stxa %g0, [%g3] ASI_IMMU276126 membar #Sync277127278278- wrpr %g0, (PSTATE_PRIV|PSTATE_PEF|PSTATE_IE), %pstate279279- wr %g0, 0, %fprs280280-281281- /* Just like for Spitfire, we probe itlb-2 for a mapping which282282- * matches our current %pc. We take the physical address in283283- * that mapping and use it to make our own.284284- */285285-286286- /* %g5 holds the tlb data */287287- sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5288288- sllx %g5, 32, %g5289289- or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5290290-291291- /* Put PADDR tlb data mask into %g3. */292292- sethi %uhi(_PAGE_PADDR), %g3293293- or %g3, %ulo(_PAGE_PADDR), %g3294294- sllx %g3, 32, %g3295295- sethi %hi(_PAGE_PADDR), %g7296296- or %g7, %lo(_PAGE_PADDR), %g7297297- or %g3, %g7, %g3298298-299299- set 2 << 16, %l0 /* TLB entry walker. */300300- set 0x1fff, %l2 /* Page mask. */301301- rd %pc, %l3302302- andn %l3, %l2, %g2 /* vaddr comparator */303303-304304-1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1305305- membar #Sync306306- andn %g1, %l2, %g1307307- cmp %g1, %g2308308- be,pn %xcc, cheetah_got_tlbentry309309- nop310310- and %l0, (127 << 3), %g1311311- cmp %g1, (127 << 3)312312- blu,pt %xcc, 1b313313- add %l0, (1 << 3), %l0314314-315315- /* Search the small TLB. OBP never maps us like that but316316- * newer SILO can.317317- */318318- clr %l0319319-320320-1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1321321- membar #Sync322322- andn %g1, %l2, %g1323323- cmp %g1, %g2324324- be,pn %xcc, cheetah_got_tlbentry325325- nop326326- cmp %l0, (15 << 3)327327- blu,pt %xcc, 1b328328- add %l0, (1 << 3), %l0329329-330330- /* BUG() if we get here... */331331- ta 0x5332332-333333-cheetah_got_tlbentry:334334- ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g0335335- ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1336336- membar #Sync337337- and %g1, %g3, %g1338338- set 0x5fff, %l0339339- andn %g1, %l0, %g1340340- or %g5, %g1, %g5341341-342342- /* Clear out any KERNBASE area entries. */343343- set 2 << 16, %l0344344- sethi %hi(KERNBASE), %g3345345- sethi %hi(KERNBASE<<1), %g7346346- mov TLB_TAG_ACCESS, %l7347347-348348- /* First, check ITLB */349349-1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1350350- membar #Sync351351- andn %g1, %l2, %g1352352- cmp %g1, %g3353353- blu,pn %xcc, 2f354354- cmp %g1, %g7355355- bgeu,pn %xcc, 2f356356- nop357357- stxa %g0, [%l7] ASI_IMMU358358- membar #Sync359359- stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS360360- membar #Sync361361-362362-2: and %l0, (127 << 3), %g1363363- cmp %g1, (127 << 3)364364- blu,pt %xcc, 1b365365- add %l0, (1 << 3), %l0366366-367367- /* Next, check DTLB */368368- set 2 << 16, %l0369369-1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1370370- membar #Sync371371- andn %g1, %l2, %g1372372- cmp %g1, %g3373373- blu,pn %xcc, 2f374374- cmp %g1, %g7375375- bgeu,pn %xcc, 2f376376- nop377377- stxa %g0, [%l7] ASI_DMMU378378- membar #Sync379379- stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS380380- membar #Sync381381-382382-2: and %l0, (511 << 3), %g1383383- cmp %g1, (511 << 3)384384- blu,pt %xcc, 1b385385- add %l0, (1 << 3), %l0386386-387387- /* On Cheetah+, have to check second DTLB. */388388- BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,l0,2f)389389- ba,pt %xcc, 9f390390- nop391391-392392-2: set 3 << 16, %l0393393-1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1394394- membar #Sync395395- andn %g1, %l2, %g1396396- cmp %g1, %g3397397- blu,pn %xcc, 2f398398- cmp %g1, %g7399399- bgeu,pn %xcc, 2f400400- nop401401- stxa %g0, [%l7] ASI_DMMU402402- membar #Sync403403- stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS404404- membar #Sync405405-406406-2: and %l0, (511 << 3), %g1407407- cmp %g1, (511 << 3)408408- blu,pt %xcc, 1b409409- add %l0, (1 << 3), %l0410410-411411-9:412412-413413- /* Now lock the TTE we created into ITLB-0 and DTLB-0,414414- * entry 15 (and maybe 14 too).415415- */416416- sethi %hi(KERNBASE), %g3417417- set (0 << 16) | (15 << 3), %g7418418- stxa %g3, [%l7] ASI_DMMU419419- membar #Sync420420- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS421421- membar #Sync422422- stxa %g3, [%l7] ASI_IMMU423423- membar #Sync424424- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS425425- membar #Sync426426- flush %g3427427- membar #Sync428428- sethi %hi(_end), %g3 /* Check for bigkernel case */429429- or %g3, %lo(_end), %g3430430- srl %g3, 23, %g3 /* Check if _end > 8M */431431- brz,pt %g3, 1f432432- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */433433- sethi %hi(0x400000), %g3434434- or %g3, %lo(0x400000), %g3435435- add %g5, %g3, %g5 /* New tte data */436436- andn %g5, (_PAGE_G), %g5437437- sethi %hi(KERNBASE+0x400000), %g3438438- or %g3, %lo(KERNBASE+0x400000), %g3439439- set (0 << 16) | (14 << 3), %g7440440- stxa %g3, [%l7] ASI_DMMU441441- membar #Sync442442- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS443443- membar #Sync444444- stxa %g3, [%l7] ASI_IMMU445445- membar #Sync446446- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS447447- membar #Sync448448- flush %g3449449- membar #Sync450450- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */451451- ba,pt %xcc, 1f452452- nop453453-454454-1: set sun4u_init, %g2455455- jmpl %g2 + %g0, %g0456456- nop128128+ ba,a,pt %xcc, jump_to_sun4u_init457129458130spitfire_boot:459131 /* Typically PROM has already enabled both MMU's and both on-chip···285313 stxa %g1, [%g0] ASI_LSU_CONTROL286314 membar #Sync287315316316+jump_to_sun4u_init:288317 /*289318 * Make sure we are in privileged mode, have address masking,290319 * using the ordinary globals and have enabled floating···297324 wrpr %g0, (PSTATE_PRIV|PSTATE_PEF|PSTATE_IE), %pstate298325 wr %g0, 0, %fprs299326300300-spitfire_create_mappings:301301- /* %g5 holds the tlb data */302302- sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5303303- sllx %g5, 32, %g5304304- or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5305305-306306- /* Base of physical memory cannot reliably be assumed to be307307- * at 0x0! Figure out where it happens to be. -DaveM308308- */309309-310310- /* Put PADDR tlb data mask into %g3. */311311- sethi %uhi(_PAGE_PADDR_SF), %g3312312- or %g3, %ulo(_PAGE_PADDR_SF), %g3313313- sllx %g3, 32, %g3314314- sethi %hi(_PAGE_PADDR_SF), %g7315315- or %g7, %lo(_PAGE_PADDR_SF), %g7316316- or %g3, %g7, %g3317317-318318- /* Walk through entire ITLB, looking for entry which maps319319- * our %pc currently, stick PADDR from there into %g5 tlb data.320320- */321321- clr %l0 /* TLB entry walker. */322322- set 0x1fff, %l2 /* Page mask. */323323- rd %pc, %l3324324- andn %l3, %l2, %g2 /* vaddr comparator */325325-1:326326- /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */327327- ldxa [%l0] ASI_ITLB_TAG_READ, %g1328328- nop329329- nop330330- nop331331- andn %g1, %l2, %g1 /* Get vaddr */332332- cmp %g1, %g2333333- be,a,pn %xcc, spitfire_got_tlbentry334334- ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1335335- cmp %l0, (63 << 3)336336- blu,pt %xcc, 1b337337- add %l0, (1 << 3), %l0338338-339339- /* BUG() if we get here... */340340- ta 0x5341341-342342-spitfire_got_tlbentry:343343- /* Nops here again, perhaps Cheetah/Blackbird are better behaved... */344344- nop345345- nop346346- nop347347- and %g1, %g3, %g1 /* Mask to just get paddr bits. */348348- set 0x5fff, %l3 /* Mask offset to get phys base. */349349- andn %g1, %l3, %g1350350-351351- /* NOTE: We hold on to %g1 paddr base as we need it below to lock352352- * NOTE: the PROM cif code into the TLB.353353- */354354-355355- or %g5, %g1, %g5 /* Or it into TAG being built. */356356-357357- clr %l0 /* TLB entry walker. */358358- sethi %hi(KERNBASE), %g3 /* 4M lower limit */359359- sethi %hi(KERNBASE<<1), %g7 /* 8M upper limit */360360- mov TLB_TAG_ACCESS, %l7361361-1:362362- /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */363363- ldxa [%l0] ASI_ITLB_TAG_READ, %g1364364- nop365365- nop366366- nop367367- andn %g1, %l2, %g1 /* Get vaddr */368368- cmp %g1, %g3369369- blu,pn %xcc, 2f370370- cmp %g1, %g7371371- bgeu,pn %xcc, 2f372372- nop373373- stxa %g0, [%l7] ASI_IMMU374374- stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS375375- membar #Sync376376-2:377377- cmp %l0, (63 << 3)378378- blu,pt %xcc, 1b379379- add %l0, (1 << 3), %l0380380-381381- nop; nop; nop382382-383383- clr %l0 /* TLB entry walker. */384384-1:385385- /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */386386- ldxa [%l0] ASI_DTLB_TAG_READ, %g1387387- nop388388- nop389389- nop390390- andn %g1, %l2, %g1 /* Get vaddr */391391- cmp %g1, %g3392392- blu,pn %xcc, 2f393393- cmp %g1, %g7394394- bgeu,pn %xcc, 2f395395- nop396396- stxa %g0, [%l7] ASI_DMMU397397- stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS398398- membar #Sync399399-2:400400- cmp %l0, (63 << 3)401401- blu,pt %xcc, 1b402402- add %l0, (1 << 3), %l0403403-404404- nop; nop; nop405405-406406-407407- /* PROM never puts any TLB entries into the MMU with the lock bit408408- * set. So we gladly use tlb entry 63 for KERNBASE. And maybe 62 too.409409- */410410-411411- sethi %hi(KERNBASE), %g3412412- mov (63 << 3), %g7413413- stxa %g3, [%l7] ASI_DMMU /* KERNBASE into TLB TAG */414414- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS /* TTE into TLB DATA */415415- membar #Sync416416- stxa %g3, [%l7] ASI_IMMU /* KERNBASE into TLB TAG */417417- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS /* TTE into TLB DATA */418418- membar #Sync419419- flush %g3420420- membar #Sync421421- sethi %hi(_end), %g3 /* Check for bigkernel case */422422- or %g3, %lo(_end), %g3423423- srl %g3, 23, %g3 /* Check if _end > 8M */424424- brz,pt %g3, 2f425425- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */426426- sethi %hi(0x400000), %g3427427- or %g3, %lo(0x400000), %g3428428- add %g5, %g3, %g5 /* New tte data */429429- andn %g5, (_PAGE_G), %g5430430- sethi %hi(KERNBASE+0x400000), %g3431431- or %g3, %lo(KERNBASE+0x400000), %g3432432- mov (62 << 3), %g7433433- stxa %g3, [%l7] ASI_DMMU434434- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS435435- membar #Sync436436- stxa %g3, [%l7] ASI_IMMU437437- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS438438- membar #Sync439439- flush %g3440440- membar #Sync441441- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */442442-2: ba,pt %xcc, 1f443443- nop444444-1:445327 set sun4u_init, %g2446328 jmpl %g2 + %g0, %g0447329 nop···311483 stxa %g0, [%g7] ASI_DMMU312484 membar #Sync313485314314- /* We are now safely (we hope) in Nucleus context (0), rewrite315315- * the KERNBASE TTE's so they no longer have the global bit set.316316- * Don't forget to setup TAG_ACCESS first 8-)317317- */318318- mov TLB_TAG_ACCESS, %g2319319- stxa %g3, [%g2] ASI_IMMU320320- stxa %g3, [%g2] ASI_DMMU321321- membar #Sync322322-323486 BRANCH_IF_ANY_CHEETAH(g1,g7,cheetah_tlb_fixup)324487325488 ba,pt %xcc, spitfire_tlb_fixup326489 nop327490328491cheetah_tlb_fixup:329329- set (0 << 16) | (15 << 3), %g7330330- ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g0331331- ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1332332- andn %g1, (_PAGE_G), %g1333333- stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS334334- membar #Sync335335-336336- ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g0337337- ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1338338- andn %g1, (_PAGE_G), %g1339339- stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS340340- membar #Sync341341-342342- /* Kill instruction prefetch queues. */343343- flush %g3344344- membar #Sync345345-346492 mov 2, %g2 /* Set TLB type to cheetah+. */347493 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,1f)348494···353551 nop354552355553spitfire_tlb_fixup:356356- mov (63 << 3), %g7357357- ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1358358- andn %g1, (_PAGE_G), %g1359359- stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS360360- membar #Sync361361-362362- ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1363363- andn %g1, (_PAGE_G), %g1364364- stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS365365- membar #Sync366366-367367- /* Kill instruction prefetch queues. */368368- flush %g3369369- membar #Sync370370-371554 /* Set TLB type to spitfire. */372555 mov 0, %g2373556 sethi %hi(tlb_type), %g1···364577 ldx [%g6 + TI_TASK], %g4365578 mov %sp, %l6366579 mov %o4, %l7367367-368368-#if 0 /* We don't do it like this anymore, but for historical hack value369369- * I leave this snippet here to show how crazy we can be sometimes. 8-)370370- */371371-372372- /* Setup "Linux Current Register", thanks Sun 8-) */373373- wr %g0, 0x1, %pcr374374-375375- /* Blackbird errata workaround. See commentary in376376- * smp.c:smp_percpu_timer_interrupt() for more377377- * information.378378- */379379- ba,pt %xcc, 99f380380- nop381381- .align 64382382-99: wr %g6, %g0, %pic383383- rd %pic, %g0384384-#endif385580386581 wr %g0, ASI_P, %asi387582 mov 1, %g1···525756526757#include "ttable.S"527758#include "systbls.S"528528-529529- .align 1024530530- .globl swapper_pg_dir531531-swapper_pg_dir:532532- .word 0533533-759759+#include "ktlb.S"534760#include "etrap.S"535761#include "rtrap.S"536762#include "winfixup.S"
+198
arch/sparc64/kernel/ktlb.S
···11+/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling.22+ *33+ * Copyright (C) 1995, 1997, 2005 David S. Miller <davem@davemloft.net>44+ * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de)55+ * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)66+ * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)77+*/88+99+#include <linux/config.h>1010+#include <asm/head.h>1111+#include <asm/asi.h>1212+#include <asm/page.h>1313+#include <asm/pgtable.h>1414+1515+ .text1616+ .align 321717+1818+/*1919+ * On a second level vpte miss, check whether the original fault is to the OBP 2020+ * range (note that this is only possible for instruction miss, data misses to2121+ * obp range do not use vpte). If so, go back directly to the faulting address.2222+ * This is because we want to read the tpc, otherwise we have no way of knowing2323+ * the 8k aligned faulting address if we are using >8k kernel pagesize. This2424+ * also ensures no vpte range addresses are dropped into tlb while obp is2525+ * executing (see inherit_locked_prom_mappings() rant).2626+ */2727+sparc64_vpte_nucleus:2828+ /* Note that kvmap below has verified that the address is2929+ * in the range MODULES_VADDR --> VMALLOC_END already. So3030+ * here we need only check if it is an OBP address or not.3131+ */3232+ sethi %hi(LOW_OBP_ADDRESS), %g53333+ cmp %g4, %g53434+ blu,pn %xcc, kern_vpte3535+ mov 0x1, %g53636+ sllx %g5, 32, %g53737+ cmp %g4, %g53838+ blu,pn %xcc, vpte_insn_obp3939+ nop4040+4141+ /* These two instructions are patched by paginig_init(). */4242+kern_vpte:4343+ sethi %hi(swapper_pgd_zero), %g54444+ lduw [%g5 + %lo(swapper_pgd_zero)], %g54545+4646+ /* With kernel PGD in %g5, branch back into dtlb_backend. */4747+ ba,pt %xcc, sparc64_kpte_continue4848+ andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */4949+5050+vpte_noent:5151+ /* Restore previous TAG_ACCESS, %g5 is zero, and we will5252+ * skip over the trap instruction so that the top level5353+ * TLB miss handler will thing this %g5 value is just an5454+ * invalid PTE, thus branching to full fault processing.5555+ */5656+ mov TLB_SFSR, %g15757+ stxa %g4, [%g1 + %g1] ASI_DMMU5858+ done5959+6060+vpte_insn_obp:6161+ sethi %hi(prom_pmd_phys), %g56262+ ldx [%g5 + %lo(prom_pmd_phys)], %g56363+6464+ /* Behave as if we are at TL0. */6565+ wrpr %g0, 1, %tl6666+ rdpr %tpc, %g4 /* Find original faulting iaddr */6767+ srlx %g4, 13, %g4 /* Throw out context bits */6868+ sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */6969+7070+ /* Restore previous TAG_ACCESS. */7171+ mov TLB_SFSR, %g17272+ stxa %g4, [%g1 + %g1] ASI_IMMU7373+7474+ /* Get PMD offset. */7575+ srlx %g4, 23, %g67676+ and %g6, 0x7ff, %g67777+ sllx %g6, 2, %g67878+7979+ /* Load PMD, is it valid? */8080+ lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g58181+ brz,pn %g5, longpath8282+ sllx %g5, 11, %g58383+8484+ /* Get PTE offset. */8585+ srlx %g4, 13, %g68686+ and %g6, 0x3ff, %g68787+ sllx %g6, 3, %g68888+8989+ /* Load PTE. */9090+ ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g59191+ brgez,pn %g5, longpath9292+ nop9393+9494+ /* TLB load and return from trap. */9595+ stxa %g5, [%g0] ASI_ITLB_DATA_IN9696+ retry9797+9898+kvmap_do_obp:9999+ sethi %hi(prom_pmd_phys), %g5100100+ ldx [%g5 + %lo(prom_pmd_phys)], %g5101101+102102+ /* Get PMD offset. */103103+ srlx %g4, 23, %g6104104+ and %g6, 0x7ff, %g6105105+ sllx %g6, 2, %g6106106+107107+ /* Load PMD, is it valid? */108108+ lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5109109+ brz,pn %g5, longpath110110+ sllx %g5, 11, %g5111111+112112+ /* Get PTE offset. */113113+ srlx %g4, 13, %g6114114+ and %g6, 0x3ff, %g6115115+ sllx %g6, 3, %g6116116+117117+ /* Load PTE. */118118+ ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5119119+ brgez,pn %g5, longpath120120+ nop121121+122122+ /* TLB load and return from trap. */123123+ stxa %g5, [%g0] ASI_DTLB_DATA_IN124124+ retry125125+126126+/*127127+ * On a first level data miss, check whether this is to the OBP range (note128128+ * that such accesses can be made by prom, as well as by kernel using129129+ * prom_getproperty on "address"), and if so, do not use vpte access ...130130+ * rather, use information saved during inherit_prom_mappings() using 8k131131+ * pagesize.132132+ */133133+ .align 32134134+kvmap:135135+ brgez,pn %g4, kvmap_nonlinear136136+ nop137137+138138+#ifdef CONFIG_DEBUG_PAGEALLOC139139+ .globl kvmap_linear_patch140140+kvmap_linear_patch:141141+#endif142142+ ba,pt %xcc, kvmap_load143143+ xor %g2, %g4, %g5144144+145145+#ifdef CONFIG_DEBUG_PAGEALLOC146146+ sethi %hi(swapper_pg_dir), %g5147147+ or %g5, %lo(swapper_pg_dir), %g5148148+ sllx %g4, 64 - (PGDIR_SHIFT + PGDIR_BITS), %g6149149+ srlx %g6, 64 - PAGE_SHIFT, %g6150150+ andn %g6, 0x3, %g6151151+ lduw [%g5 + %g6], %g5152152+ brz,pn %g5, longpath153153+ sllx %g4, 64 - (PMD_SHIFT + PMD_BITS), %g6154154+ srlx %g6, 64 - PAGE_SHIFT, %g6155155+ sllx %g5, 11, %g5156156+ andn %g6, 0x3, %g6157157+ lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5158158+ brz,pn %g5, longpath159159+ sllx %g4, 64 - PMD_SHIFT, %g6160160+ srlx %g6, 64 - PAGE_SHIFT, %g6161161+ sllx %g5, 11, %g5162162+ andn %g6, 0x7, %g6163163+ ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5164164+ brz,pn %g5, longpath165165+ nop166166+ ba,a,pt %xcc, kvmap_load167167+#endif168168+169169+kvmap_nonlinear:170170+ sethi %hi(MODULES_VADDR), %g5171171+ cmp %g4, %g5172172+ blu,pn %xcc, longpath173173+ mov (VMALLOC_END >> 24), %g5174174+ sllx %g5, 24, %g5175175+ cmp %g4, %g5176176+ bgeu,pn %xcc, longpath177177+ nop178178+179179+kvmap_check_obp:180180+ sethi %hi(LOW_OBP_ADDRESS), %g5181181+ cmp %g4, %g5182182+ blu,pn %xcc, kvmap_vmalloc_addr183183+ mov 0x1, %g5184184+ sllx %g5, 32, %g5185185+ cmp %g4, %g5186186+ blu,pn %xcc, kvmap_do_obp187187+ nop188188+189189+kvmap_vmalloc_addr:190190+ /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */191191+ ldxa [%g3 + %g6] ASI_N, %g5192192+ brgez,pn %g5, longpath193193+ nop194194+195195+kvmap_load:196196+ /* PTE is valid, load into TLB and return from trap. */197197+ stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB198198+ retry
···1717#include <asm/system.h>18181919/* Reset and reboot the machine with the command 'bcommand'. */2020-void prom_reboot(char *bcommand)2020+void prom_reboot(const char *bcommand)2121{2222 p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) |2323 P1275_INOUT(1, 0), bcommand);2424}25252626/* Forth evaluate the expression contained in 'fstring'. */2727-void prom_feval(char *fstring)2727+void prom_feval(const char *fstring)2828{2929 if (!fstring || fstring[0] == 0)3030 return;···148148 p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba);149149}150150151151-int mmu_ihandle_cache = 0;152152-153151int prom_get_mmu_ihandle(void)154152{155153 int node, ret;156154157157- if (mmu_ihandle_cache != 0)158158- return mmu_ihandle_cache;155155+ if (prom_mmu_ihandle_cache != 0)156156+ return prom_mmu_ihandle_cache;159157160160- node = prom_finddevice("/chosen");161161- ret = prom_getint(node, "mmu");158158+ node = prom_finddevice(prom_chosen_path);159159+ ret = prom_getint(node, prom_mmu_name);162160 if (ret == -1 || ret == 0)163163- mmu_ihandle_cache = -1;161161+ prom_mmu_ihandle_cache = -1;164162 else165165- mmu_ihandle_cache = ret;163163+ prom_mmu_ihandle_cache = ret;166164167165 return ret;168166}···188190 unsigned long tte_data,189191 unsigned long vaddr)190192{191191- return p1275_cmd("call-method",193193+ return p1275_cmd(prom_callmethod_name,192194 (P1275_ARG(0, P1275_ARG_IN_STRING) |193195 P1275_ARG(2, P1275_ARG_IN_64B) |194196 P1275_ARG(3, P1275_ARG_IN_64B) |···205207 unsigned long tte_data,206208 unsigned long vaddr)207209{208208- return p1275_cmd("call-method",210210+ return p1275_cmd(prom_callmethod_name,209211 (P1275_ARG(0, P1275_ARG_IN_STRING) |210212 P1275_ARG(2, P1275_ARG_IN_64B) |211213 P1275_ARG(3, P1275_ARG_IN_64B) |···221223int prom_map(int mode, unsigned long size,222224 unsigned long vaddr, unsigned long paddr)223225{224224- int ret = p1275_cmd("call-method",226226+ int ret = p1275_cmd(prom_callmethod_name,225227 (P1275_ARG(0, P1275_ARG_IN_STRING) |226228 P1275_ARG(3, P1275_ARG_IN_64B) |227229 P1275_ARG(4, P1275_ARG_IN_64B) |228230 P1275_ARG(6, P1275_ARG_IN_64B) |229231 P1275_INOUT(7, 1)),230230- "map",232232+ prom_map_name,231233 prom_get_mmu_ihandle(),232234 mode,233235 size,···242244243245void prom_unmap(unsigned long size, unsigned long vaddr)244246{245245- p1275_cmd("call-method",247247+ p1275_cmd(prom_callmethod_name,246248 (P1275_ARG(0, P1275_ARG_IN_STRING) |247249 P1275_ARG(2, P1275_ARG_IN_64B) |248250 P1275_ARG(3, P1275_ARG_IN_64B) |249251 P1275_INOUT(4, 0)),250250- "unmap",252252+ prom_unmap_name,251253 prom_get_mmu_ihandle(),252254 size,253255 vaddr);···256258/* Set aside physical memory which is not touched or modified257259 * across soft resets.258260 */259259-unsigned long prom_retain(char *name,261261+unsigned long prom_retain(const char *name,260262 unsigned long pa_low, unsigned long pa_high,261263 long size, long align)262264{···288290 unsigned long phys_addr,289291 char *buf, int buflen)290292{291291- return p1275_cmd("call-method",293293+ return p1275_cmd(prom_callmethod_name,292294 (P1275_ARG(0, P1275_ARG_IN_STRING) |293295 P1275_ARG(3, P1275_ARG_OUT_BUF) |294296 P1275_ARG(6, P1275_ARG_IN_64B) |
+1-1
arch/sparc64/prom/p1275.c
···4646 */4747DEFINE_SPINLOCK(prom_entry_lock);48484949-long p1275_cmd (char *service, long fmt, ...)4949+long p1275_cmd(const char *service, long fmt, ...)5050{5151 char *p, *q;5252 unsigned long flags;
+1-1
arch/sparc64/prom/printf.c
···3434}35353636void3737-prom_printf(char *fmt, ...)3737+prom_printf(const char *fmt, ...)3838{3939 va_list args;4040 int i;
+26-24
arch/sparc64/prom/tree.c
···6969 * Return -1 on error.7070 */7171__inline__ int7272-prom_getproplen(int node, char *prop)7272+prom_getproplen(int node, const char *prop)7373{7474 if((!node) || (!prop)) return -1;7575 return p1275_cmd ("getproplen", ···8383 * was successful the length will be returned, else -1 is returned.8484 */8585__inline__ int8686-prom_getproperty(int node, char *prop, char *buffer, int bufsize)8686+prom_getproperty(int node, const char *prop, char *buffer, int bufsize)8787{8888 int plen;89899090 plen = prom_getproplen(node, prop);9191- if((plen > bufsize) || (plen == 0) || (plen == -1))9191+ if ((plen > bufsize) || (plen == 0) || (plen == -1)) {9292 return -1;9393- else {9393+ } else {9494 /* Ok, things seem all right. */9595- return p1275_cmd ("getprop", 9696- P1275_ARG(1,P1275_ARG_IN_STRING)|9797- P1275_ARG(2,P1275_ARG_OUT_BUF)|9898- P1275_INOUT(4, 1), 9999- node, prop, buffer, P1275_SIZE(plen));9595+ return p1275_cmd(prom_getprop_name, 9696+ P1275_ARG(1,P1275_ARG_IN_STRING)|9797+ P1275_ARG(2,P1275_ARG_OUT_BUF)|9898+ P1275_INOUT(4, 1), 9999+ node, prop, buffer, P1275_SIZE(plen));100100 }101101}102102···104104 * on failure.105105 */106106__inline__ int107107-prom_getint(int node, char *prop)107107+prom_getint(int node, const char *prop)108108{109109 int intprop;110110···119119 */120120121121int122122-prom_getintdefault(int node, char *property, int deflt)122122+prom_getintdefault(int node, const char *property, int deflt)123123{124124 int retval;125125···131131132132/* Acquire a boolean property, 1=TRUE 0=FALSE. */133133int134134-prom_getbool(int node, char *prop)134134+prom_getbool(int node, const char *prop)135135{136136 int retval;137137···145145 * buffer.146146 */147147void148148-prom_getstring(int node, char *prop, char *user_buf, int ubuf_size)148148+prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)149149{150150 int len;151151···160160 * YES = 1 NO = 0161161 */162162int163163-prom_nodematch(int node, char *name)163163+prom_nodematch(int node, const char *name)164164{165165 char namebuf[128];166166 prom_getproperty(node, "name", namebuf, sizeof(namebuf));···172172 * 'nodename'. Return node if successful, zero if not.173173 */174174int175175-prom_searchsiblings(int node_start, char *nodename)175175+prom_searchsiblings(int node_start, const char *nodename)176176{177177178178 int thisnode, error;···294294 * property types for this node.295295 */296296__inline__ char *297297-prom_nextprop(int node, char *oprop, char *buffer)297297+prom_nextprop(int node, const char *oprop, char *buffer)298298{299299 char buf[32];300300···314314}315315316316int317317-prom_finddevice(char *name)317317+prom_finddevice(const char *name)318318{319319- if(!name) return 0;320320- return p1275_cmd ("finddevice", P1275_ARG(0,P1275_ARG_IN_STRING)|321321- P1275_INOUT(1, 1), 322322- name);319319+ if (!name)320320+ return 0;321321+ return p1275_cmd(prom_finddev_name,322322+ P1275_ARG(0,P1275_ARG_IN_STRING)|323323+ P1275_INOUT(1, 1), 324324+ name);323325}324326325325-int prom_node_has_property(int node, char *prop)327327+int prom_node_has_property(int node, const char *prop)326328{327329 char buf [32];328330···341339 * of 'size' bytes. Return the number of bytes the prom accepted.342340 */343341int344344-prom_setprop(int node, char *pname, char *value, int size)342342+prom_setprop(int node, const char *pname, char *value, int size)345343{346344 if(size == 0) return 0;347345 if((pname == 0) || (value == 0)) return 0;···366364 * FIXME: Should work for v0 as well367365 */368366int369369-prom_pathtoinode(char *path)367367+prom_pathtoinode(const char *path)370368{371369 int node, inst;372370
+5
include/asm-sparc64/cacheflush.h
···6666#define flush_cache_vmap(start, end) do { } while (0)6767#define flush_cache_vunmap(start, end) do { } while (0)68686969+#ifdef CONFIG_DEBUG_PAGEALLOC7070+/* internal debugging function */7171+void kernel_map_pages(struct page *page, int numpages, int enable);7272+#endif7373+6974#endif /* !__ASSEMBLY__ */70757176#endif /* _SPARC64_CACHEFLUSH_H */
+10
include/asm-sparc64/cpudata.h
···2222 unsigned int __pad1;2323 unsigned long *pte_cache[2];2424 unsigned long *pgd_cache;2525+2626+ /* Dcache line 3, rarely used */2727+ unsigned int dcache_size;2828+ unsigned int dcache_line_size;2929+ unsigned int icache_size;3030+ unsigned int icache_line_size;3131+ unsigned int ecache_size;3232+ unsigned int ecache_line_size;3333+ unsigned int __pad2;3434+ unsigned int __pad3;2535} cpuinfo_sparc;26362737DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
+33-19
include/asm-sparc64/oplib.h
···3838 */3939extern int prom_chosen_node;40404141+/* Helper values and strings in arch/sparc64/kernel/head.S */4242+extern const char prom_finddev_name[];4343+extern const char prom_chosen_path[];4444+extern const char prom_getprop_name[];4545+extern const char prom_mmu_name[];4646+extern const char prom_callmethod_name[];4747+extern const char prom_translate_name[];4848+extern const char prom_map_name[];4949+extern const char prom_unmap_name[];5050+extern int prom_mmu_ihandle_cache;5151+extern unsigned int prom_boot_mapped_pc;5252+extern unsigned int prom_boot_mapping_mode;5353+extern unsigned long prom_boot_mapping_phys_high, prom_boot_mapping_phys_low;5454+4155struct linux_mlist_p1275 {4256 struct linux_mlist_p1275 *theres_more;4357 unsigned long start_adr;···8268 * of the string is different on V0 vs. V2->higher proms. The caller must8369 * know what he/she is doing! Returns the device descriptor, an int.8470 */8585-extern int prom_devopen(char *device_string);7171+extern int prom_devopen(const char *device_string);86728773/* Close a previously opened device described by the passed integer8874 * descriptor.···11298/* Miscellaneous routines, don't really fit in any category per se. */11399114100/* Reboot the machine with the command line passed. */115115-extern void prom_reboot(char *boot_command);101101+extern void prom_reboot(const char *boot_command);116102117103/* Evaluate the forth string passed. */118118-extern void prom_feval(char *forth_string);104104+extern void prom_feval(const char *forth_string);119105120106/* Enter the prom, with possibility of continuation with the 'go'121107 * command in newer proms.···168154extern void prom_putchar(char character);169155170156/* Prom's internal routines, don't use in kernel/boot code. */171171-extern void prom_printf(char *fmt, ...);157157+extern void prom_printf(const char *fmt, ...);172158extern void prom_write(const char *buf, unsigned int len);173159174160/* Query for input device type */···229215 char *buf, int buflen);230216231217/* Retain physical memory to the caller across soft resets. */232232-extern unsigned long prom_retain(char *name,218218+extern unsigned long prom_retain(const char *name,233219 unsigned long pa_low, unsigned long pa_high,234220 long size, long align);235221···283269/* Get the length, at the passed node, of the given property type.284270 * Returns -1 on error (ie. no such property at this node).285271 */286286-extern int prom_getproplen(int thisnode, char *property);272272+extern int prom_getproplen(int thisnode, const char *property);287273288274/* Fetch the requested property using the given buffer. Returns289275 * the number of bytes the prom put into your buffer or -1 on error.290276 */291291-extern int prom_getproperty(int thisnode, char *property,277277+extern int prom_getproperty(int thisnode, const char *property,292278 char *prop_buffer, int propbuf_size);293279294280/* Acquire an integer property. */295295-extern int prom_getint(int node, char *property);281281+extern int prom_getint(int node, const char *property);296282297283/* Acquire an integer property, with a default value. */298298-extern int prom_getintdefault(int node, char *property, int defval);284284+extern int prom_getintdefault(int node, const char *property, int defval);299285300286/* Acquire a boolean property, 0=FALSE 1=TRUE. */301301-extern int prom_getbool(int node, char *prop);287287+extern int prom_getbool(int node, const char *prop);302288303289/* Acquire a string property, null string on error. */304304-extern void prom_getstring(int node, char *prop, char *buf, int bufsize);290290+extern void prom_getstring(int node, const char *prop, char *buf, int bufsize);305291306292/* Does the passed node have the given "name"? YES=1 NO=0 */307307-extern int prom_nodematch(int thisnode, char *name);293293+extern int prom_nodematch(int thisnode, const char *name);308294309295/* Puts in buffer a prom name in the form name@x,y or name (x for which_io 310296 * and y for first regs phys address···314300/* Search all siblings starting at the passed node for "name" matching315301 * the given string. Returns the node on success, zero on failure.316302 */317317-extern int prom_searchsiblings(int node_start, char *name);303303+extern int prom_searchsiblings(int node_start, const char *name);318304319305/* Return the first property type, as a string, for the given node.320306 * Returns a null string on error. Buffer should be at least 32B long.···324310/* Returns the next property after the passed property for the given325311 * node. Returns null string on failure. Buffer should be at least 32B long.326312 */327327-extern char *prom_nextprop(int node, char *prev_property, char *buffer);313313+extern char *prom_nextprop(int node, const char *prev_property, char *buffer);328314329315/* Returns 1 if the specified node has given property. */330330-extern int prom_node_has_property(int node, char *property);316316+extern int prom_node_has_property(int node, const char *property);331317332318/* Returns phandle of the path specified */333333-extern int prom_finddevice(char *name);319319+extern int prom_finddevice(const char *name);334320335321/* Set the indicated property at the given node with the passed value.336322 * Returns the number of bytes of your value that the prom took.337323 */338338-extern int prom_setprop(int node, char *prop_name, char *prop_value,324324+extern int prom_setprop(int node, const char *prop_name, char *prop_value,339325 int value_size);340326341341-extern int prom_pathtoinode(char *path);327327+extern int prom_pathtoinode(const char *path);342328extern int prom_inst2pkg(int);343329344330/* CPU probing helpers. */···348334/* Client interface level routines. */349335extern void prom_set_trap_table(unsigned long tba);350336351351-extern long p1275_cmd (char *, long, ...);337337+extern long p1275_cmd(const char *, long, ...);352338353339354340#if 0
+4-3
include/asm-sparc64/pgtable.h
···6060 * table can map6161 */6262#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))6363-#define PMD_SIZE (1UL << PMD_SHIFT)6363+#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT)6464#define PMD_MASK (~(PMD_SIZE-1))6565#define PMD_BITS (PAGE_SHIFT - 2)66666767/* PGDIR_SHIFT determines what a third-level page table entry can map */6868#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)6969-#define PGDIR_SIZE (1UL << PGDIR_SHIFT)6969+#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT)7070#define PGDIR_MASK (~(PGDIR_SIZE-1))7171#define PGDIR_BITS (PAGE_SHIFT - 2)7272···336336#define pte_clear(mm,addr,ptep) \337337 set_pte_at((mm), (addr), (ptep), __pte(0UL))338338339339-extern pgd_t swapper_pg_dir[1];339339+extern pgd_t swapper_pg_dir[2048];340340+extern pmd_t swapper_low_pmd_dir[2048];340341341342/* These do nothing with the way I have things setup. */342343#define mmu_lockarea(vaddr, len) (vaddr)