···33 depends on DEBUG_KERNEL34 bool "Debug BOOTMEM initialization"350000000036config MCOUNT37 bool38 depends on STACK_DEBUG
···33 depends on DEBUG_KERNEL34 bool "Debug BOOTMEM initialization"3536+config DEBUG_PAGEALLOC37+ bool "Page alloc debugging"38+ depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND39+ help40+ Unmap pages from the kernel linear mapping after free_pages().41+ This results in a large slowdown, but helps to find certain types42+ of memory corruptions.43+44config MCOUNT45 bool46 depends on STACK_DEBUG
···30 .text31 .align 323233- .globl sparc64_vpte_patchme134- .globl sparc64_vpte_patchme235-/*36- * On a second level vpte miss, check whether the original fault is to the OBP 37- * range (note that this is only possible for instruction miss, data misses to38- * obp range do not use vpte). If so, go back directly to the faulting address.39- * This is because we want to read the tpc, otherwise we have no way of knowing40- * the 8k aligned faulting address if we are using >8k kernel pagesize. This41- * also ensures no vpte range addresses are dropped into tlb while obp is42- * executing (see inherit_locked_prom_mappings() rant).43- */44-sparc64_vpte_nucleus:45- /* Note that kvmap below has verified that the address is46- * in the range MODULES_VADDR --> VMALLOC_END already. So47- * here we need only check if it is an OBP address or not.48- */49- sethi %hi(LOW_OBP_ADDRESS), %g550- cmp %g4, %g551- blu,pn %xcc, sparc64_vpte_patchme152- mov 0x1, %g553- sllx %g5, 32, %g554- cmp %g4, %g555- blu,pn %xcc, obp_iaddr_patch56- nop57-58- /* These two instructions are patched by paginig_init(). */59-sparc64_vpte_patchme1:60- sethi %hi(0), %g561-sparc64_vpte_patchme2:62- or %g5, %lo(0), %g563-64- /* With kernel PGD in %g5, branch back into dtlb_backend. */65- ba,pt %xcc, sparc64_kpte_continue66- andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */67-68-vpte_noent:69- /* Restore previous TAG_ACCESS, %g5 is zero, and we will70- * skip over the trap instruction so that the top level71- * TLB miss handler will thing this %g5 value is just an72- * invalid PTE, thus branching to full fault processing.73- */74- mov TLB_SFSR, %g175- stxa %g4, [%g1 + %g1] ASI_DMMU76- done77-78- .globl obp_iaddr_patch79-obp_iaddr_patch:80- /* These two instructions patched by inherit_prom_mappings(). */81- sethi %hi(0), %g582- or %g5, %lo(0), %g583-84- /* Behave as if we are at TL0. */85- wrpr %g0, 1, %tl86- rdpr %tpc, %g4 /* Find original faulting iaddr */87- srlx %g4, 13, %g4 /* Throw out context bits */88- sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */89-90- /* Restore previous TAG_ACCESS. */91- mov TLB_SFSR, %g192- stxa %g4, [%g1 + %g1] ASI_IMMU93-94- /* Get PMD offset. */95- srlx %g4, 23, %g696- and %g6, 0x7ff, %g697- sllx %g6, 2, %g698-99- /* Load PMD, is it valid? */100- lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5101- brz,pn %g5, longpath102- sllx %g5, 11, %g5103-104- /* Get PTE offset. */105- srlx %g4, 13, %g6106- and %g6, 0x3ff, %g6107- sllx %g6, 3, %g6108-109- /* Load PTE. */110- ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5111- brgez,pn %g5, longpath112- nop113-114- /* TLB load and return from trap. */115- stxa %g5, [%g0] ASI_ITLB_DATA_IN116- retry117-118- .globl obp_daddr_patch119-obp_daddr_patch:120- /* These two instructions patched by inherit_prom_mappings(). */121- sethi %hi(0), %g5122- or %g5, %lo(0), %g5123-124- /* Get PMD offset. */125- srlx %g4, 23, %g6126- and %g6, 0x7ff, %g6127- sllx %g6, 2, %g6128-129- /* Load PMD, is it valid? */130- lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5131- brz,pn %g5, longpath132- sllx %g5, 11, %g5133-134- /* Get PTE offset. */135- srlx %g4, 13, %g6136- and %g6, 0x3ff, %g6137- sllx %g6, 3, %g6138-139- /* Load PTE. */140- ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5141- brgez,pn %g5, longpath142- nop143-144- /* TLB load and return from trap. */145- stxa %g5, [%g0] ASI_DTLB_DATA_IN146- retry147-148-/*149- * On a first level data miss, check whether this is to the OBP range (note150- * that such accesses can be made by prom, as well as by kernel using151- * prom_getproperty on "address"), and if so, do not use vpte access ...152- * rather, use information saved during inherit_prom_mappings() using 8k153- * pagesize.154- */155- .align 32156-kvmap:157- sethi %hi(MODULES_VADDR), %g5158- cmp %g4, %g5159- blu,pn %xcc, longpath160- mov (VMALLOC_END >> 24), %g5161- sllx %g5, 24, %g5162- cmp %g4, %g5163- bgeu,pn %xcc, longpath164- nop165-166-kvmap_check_obp:167- sethi %hi(LOW_OBP_ADDRESS), %g5168- cmp %g4, %g5169- blu,pn %xcc, kvmap_vmalloc_addr170- mov 0x1, %g5171- sllx %g5, 32, %g5172- cmp %g4, %g5173- blu,pn %xcc, obp_daddr_patch174- nop175-176-kvmap_vmalloc_addr:177- /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */178- ldxa [%g3 + %g6] ASI_N, %g5179- brgez,pn %g5, longpath180- nop181-182- /* PTE is valid, load into TLB and return from trap. */183- stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB184- retry185-186 /* This is trivial with the new code... */187 .globl do_fpdis188do_fpdis:···372 *373 * DATA 0: [low 32-bits] Address of function to call, jmp to this374 * [high 32-bits] MMU Context Argument 0, place in %g5375- * DATA 1: Address Argument 1, place in %g6376 * DATA 2: Address Argument 2, place in %g7377 *378 * With this method we can do most of the cross-call tlb/cache379 * flushing very quickly.380 *381- * Current CPU's IRQ worklist table is locked into %g1,382- * don't touch.383 */384 .text385 .align 32···852 nop853854do_cheetah_plus_data_parity:855- ba,pt %xcc, etrap00856 rd %pc, %g7857 mov 0x0, %o0858 call cheetah_plus_parity_error859 add %sp, PTREGS_OFF, %o1860- ba,pt %xcc, rtrap861- clr %l6862863cheetah_plus_dcpe_trap_vector_tl1:864 membar #Sync···883 nop884885do_cheetah_plus_insn_parity:886- ba,pt %xcc, etrap00887 rd %pc, %g7888 mov 0x1, %o0889 call cheetah_plus_parity_error890 add %sp, PTREGS_OFF, %o1891- ba,pt %xcc, rtrap892- clr %l6893894cheetah_plus_icpe_trap_vector_tl1:895 membar #Sync···923 nop924 wrpr %g1, %tl ! Restore original trap level925do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */0000926 /* Reset D-cache parity */927 sethi %hi(1 << 16), %g1 ! D-cache size928 mov (1 << 5), %g2 ! D-cache line size···973 nop974 wrpr %g1, %tl ! Restore original trap level975do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */0000976 /* Flush I-cache */977 sethi %hi(1 << 15), %g1 ! I-cache size978 mov (1 << 5), %g2 ! I-cache line size
···30 .text31 .align 323200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033 /* This is trivial with the new code... */34 .globl do_fpdis35do_fpdis:···525 *526 * DATA 0: [low 32-bits] Address of function to call, jmp to this527 * [high 32-bits] MMU Context Argument 0, place in %g5528+ * DATA 1: Address Argument 1, place in %g1529 * DATA 2: Address Argument 2, place in %g7530 *531 * With this method we can do most of the cross-call tlb/cache532 * flushing very quickly.533 *534+ * Current CPU's IRQ worklist table is locked into %g6, don't touch.0535 */536 .text537 .align 32···1006 nop10071008do_cheetah_plus_data_parity:1009+ rdpr %pil, %g21010+ wrpr %g0, 15, %pil1011+ ba,pt %xcc, etrap_irq1012 rd %pc, %g71013 mov 0x0, %o01014 call cheetah_plus_parity_error1015 add %sp, PTREGS_OFF, %o11016+ ba,a,pt %xcc, rtrap_irq010171018cheetah_plus_dcpe_trap_vector_tl1:1019 membar #Sync···1036 nop10371038do_cheetah_plus_insn_parity:1039+ rdpr %pil, %g21040+ wrpr %g0, 15, %pil1041+ ba,pt %xcc, etrap_irq1042 rd %pc, %g71043 mov 0x1, %o01044 call cheetah_plus_parity_error1045 add %sp, PTREGS_OFF, %o11046+ ba,a,pt %xcc, rtrap_irq010471048cheetah_plus_icpe_trap_vector_tl1:1049 membar #Sync···1075 nop1076 wrpr %g1, %tl ! Restore original trap level1077do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */1078+ sethi %hi(dcache_parity_tl1_occurred), %g21079+ lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g11080+ add %g1, 1, %g11081+ stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)]1082 /* Reset D-cache parity */1083 sethi %hi(1 << 16), %g1 ! D-cache size1084 mov (1 << 5), %g2 ! D-cache line size···1121 nop1122 wrpr %g1, %tl ! Restore original trap level1123do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */1124+ sethi %hi(icache_parity_tl1_occurred), %g21125+ lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g11126+ add %g1, 1, %g11127+ stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)]1128 /* Flush I-cache */1129 sethi %hi(1 << 15), %g1 ! I-cache size1130 mov (1 << 5), %g2 ! I-cache line size
+161-397
arch/sparc64/kernel/head.S
···80 .xword 081 .word _end8283- /* We must be careful, 32-bit OpenBOOT will get confused if it84- * tries to save away a register window to a 64-bit kernel85- * stack address. Flush all windows, disable interrupts,86- * remap if necessary, jump onto kernel trap table, then kernel87- * stack, or else we die.88- *89- * PROM entry point is on %o490- */91sparc64_boot:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000092 BRANCH_IF_CHEETAH_BASE(g1,g7,cheetah_boot)93 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,cheetah_plus_boot)94 ba,pt %xcc, spitfire_boot···275 stxa %g0, [%g3] ASI_IMMU276 membar #Sync277278- wrpr %g0, (PSTATE_PRIV|PSTATE_PEF|PSTATE_IE), %pstate279- wr %g0, 0, %fprs280-281- /* Just like for Spitfire, we probe itlb-2 for a mapping which282- * matches our current %pc. We take the physical address in283- * that mapping and use it to make our own.284- */285-286- /* %g5 holds the tlb data */287- sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5288- sllx %g5, 32, %g5289- or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5290-291- /* Put PADDR tlb data mask into %g3. */292- sethi %uhi(_PAGE_PADDR), %g3293- or %g3, %ulo(_PAGE_PADDR), %g3294- sllx %g3, 32, %g3295- sethi %hi(_PAGE_PADDR), %g7296- or %g7, %lo(_PAGE_PADDR), %g7297- or %g3, %g7, %g3298-299- set 2 << 16, %l0 /* TLB entry walker. */300- set 0x1fff, %l2 /* Page mask. */301- rd %pc, %l3302- andn %l3, %l2, %g2 /* vaddr comparator */303-304-1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1305- membar #Sync306- andn %g1, %l2, %g1307- cmp %g1, %g2308- be,pn %xcc, cheetah_got_tlbentry309- nop310- and %l0, (127 << 3), %g1311- cmp %g1, (127 << 3)312- blu,pt %xcc, 1b313- add %l0, (1 << 3), %l0314-315- /* Search the small TLB. OBP never maps us like that but316- * newer SILO can.317- */318- clr %l0319-320-1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1321- membar #Sync322- andn %g1, %l2, %g1323- cmp %g1, %g2324- be,pn %xcc, cheetah_got_tlbentry325- nop326- cmp %l0, (15 << 3)327- blu,pt %xcc, 1b328- add %l0, (1 << 3), %l0329-330- /* BUG() if we get here... */331- ta 0x5332-333-cheetah_got_tlbentry:334- ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g0335- ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1336- membar #Sync337- and %g1, %g3, %g1338- set 0x5fff, %l0339- andn %g1, %l0, %g1340- or %g5, %g1, %g5341-342- /* Clear out any KERNBASE area entries. */343- set 2 << 16, %l0344- sethi %hi(KERNBASE), %g3345- sethi %hi(KERNBASE<<1), %g7346- mov TLB_TAG_ACCESS, %l7347-348- /* First, check ITLB */349-1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1350- membar #Sync351- andn %g1, %l2, %g1352- cmp %g1, %g3353- blu,pn %xcc, 2f354- cmp %g1, %g7355- bgeu,pn %xcc, 2f356- nop357- stxa %g0, [%l7] ASI_IMMU358- membar #Sync359- stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS360- membar #Sync361-362-2: and %l0, (127 << 3), %g1363- cmp %g1, (127 << 3)364- blu,pt %xcc, 1b365- add %l0, (1 << 3), %l0366-367- /* Next, check DTLB */368- set 2 << 16, %l0369-1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1370- membar #Sync371- andn %g1, %l2, %g1372- cmp %g1, %g3373- blu,pn %xcc, 2f374- cmp %g1, %g7375- bgeu,pn %xcc, 2f376- nop377- stxa %g0, [%l7] ASI_DMMU378- membar #Sync379- stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS380- membar #Sync381-382-2: and %l0, (511 << 3), %g1383- cmp %g1, (511 << 3)384- blu,pt %xcc, 1b385- add %l0, (1 << 3), %l0386-387- /* On Cheetah+, have to check second DTLB. */388- BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,l0,2f)389- ba,pt %xcc, 9f390- nop391-392-2: set 3 << 16, %l0393-1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1394- membar #Sync395- andn %g1, %l2, %g1396- cmp %g1, %g3397- blu,pn %xcc, 2f398- cmp %g1, %g7399- bgeu,pn %xcc, 2f400- nop401- stxa %g0, [%l7] ASI_DMMU402- membar #Sync403- stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS404- membar #Sync405-406-2: and %l0, (511 << 3), %g1407- cmp %g1, (511 << 3)408- blu,pt %xcc, 1b409- add %l0, (1 << 3), %l0410-411-9:412-413- /* Now lock the TTE we created into ITLB-0 and DTLB-0,414- * entry 15 (and maybe 14 too).415- */416- sethi %hi(KERNBASE), %g3417- set (0 << 16) | (15 << 3), %g7418- stxa %g3, [%l7] ASI_DMMU419- membar #Sync420- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS421- membar #Sync422- stxa %g3, [%l7] ASI_IMMU423- membar #Sync424- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS425- membar #Sync426- flush %g3427- membar #Sync428- sethi %hi(_end), %g3 /* Check for bigkernel case */429- or %g3, %lo(_end), %g3430- srl %g3, 23, %g3 /* Check if _end > 8M */431- brz,pt %g3, 1f432- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */433- sethi %hi(0x400000), %g3434- or %g3, %lo(0x400000), %g3435- add %g5, %g3, %g5 /* New tte data */436- andn %g5, (_PAGE_G), %g5437- sethi %hi(KERNBASE+0x400000), %g3438- or %g3, %lo(KERNBASE+0x400000), %g3439- set (0 << 16) | (14 << 3), %g7440- stxa %g3, [%l7] ASI_DMMU441- membar #Sync442- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS443- membar #Sync444- stxa %g3, [%l7] ASI_IMMU445- membar #Sync446- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS447- membar #Sync448- flush %g3449- membar #Sync450- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */451- ba,pt %xcc, 1f452- nop453-454-1: set sun4u_init, %g2455- jmpl %g2 + %g0, %g0456- nop457458spitfire_boot:459 /* Typically PROM has already enabled both MMU's and both on-chip···285 stxa %g1, [%g0] ASI_LSU_CONTROL286 membar #Sync2870288 /*289 * Make sure we are in privileged mode, have address masking,290 * using the ordinary globals and have enabled floating···297 wrpr %g0, (PSTATE_PRIV|PSTATE_PEF|PSTATE_IE), %pstate298 wr %g0, 0, %fprs299300-spitfire_create_mappings:301- /* %g5 holds the tlb data */302- sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5303- sllx %g5, 32, %g5304- or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5305-306- /* Base of physical memory cannot reliably be assumed to be307- * at 0x0! Figure out where it happens to be. -DaveM308- */309-310- /* Put PADDR tlb data mask into %g3. */311- sethi %uhi(_PAGE_PADDR_SF), %g3312- or %g3, %ulo(_PAGE_PADDR_SF), %g3313- sllx %g3, 32, %g3314- sethi %hi(_PAGE_PADDR_SF), %g7315- or %g7, %lo(_PAGE_PADDR_SF), %g7316- or %g3, %g7, %g3317-318- /* Walk through entire ITLB, looking for entry which maps319- * our %pc currently, stick PADDR from there into %g5 tlb data.320- */321- clr %l0 /* TLB entry walker. */322- set 0x1fff, %l2 /* Page mask. */323- rd %pc, %l3324- andn %l3, %l2, %g2 /* vaddr comparator */325-1:326- /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */327- ldxa [%l0] ASI_ITLB_TAG_READ, %g1328- nop329- nop330- nop331- andn %g1, %l2, %g1 /* Get vaddr */332- cmp %g1, %g2333- be,a,pn %xcc, spitfire_got_tlbentry334- ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1335- cmp %l0, (63 << 3)336- blu,pt %xcc, 1b337- add %l0, (1 << 3), %l0338-339- /* BUG() if we get here... */340- ta 0x5341-342-spitfire_got_tlbentry:343- /* Nops here again, perhaps Cheetah/Blackbird are better behaved... */344- nop345- nop346- nop347- and %g1, %g3, %g1 /* Mask to just get paddr bits. */348- set 0x5fff, %l3 /* Mask offset to get phys base. */349- andn %g1, %l3, %g1350-351- /* NOTE: We hold on to %g1 paddr base as we need it below to lock352- * NOTE: the PROM cif code into the TLB.353- */354-355- or %g5, %g1, %g5 /* Or it into TAG being built. */356-357- clr %l0 /* TLB entry walker. */358- sethi %hi(KERNBASE), %g3 /* 4M lower limit */359- sethi %hi(KERNBASE<<1), %g7 /* 8M upper limit */360- mov TLB_TAG_ACCESS, %l7361-1:362- /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */363- ldxa [%l0] ASI_ITLB_TAG_READ, %g1364- nop365- nop366- nop367- andn %g1, %l2, %g1 /* Get vaddr */368- cmp %g1, %g3369- blu,pn %xcc, 2f370- cmp %g1, %g7371- bgeu,pn %xcc, 2f372- nop373- stxa %g0, [%l7] ASI_IMMU374- stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS375- membar #Sync376-2:377- cmp %l0, (63 << 3)378- blu,pt %xcc, 1b379- add %l0, (1 << 3), %l0380-381- nop; nop; nop382-383- clr %l0 /* TLB entry walker. */384-1:385- /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */386- ldxa [%l0] ASI_DTLB_TAG_READ, %g1387- nop388- nop389- nop390- andn %g1, %l2, %g1 /* Get vaddr */391- cmp %g1, %g3392- blu,pn %xcc, 2f393- cmp %g1, %g7394- bgeu,pn %xcc, 2f395- nop396- stxa %g0, [%l7] ASI_DMMU397- stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS398- membar #Sync399-2:400- cmp %l0, (63 << 3)401- blu,pt %xcc, 1b402- add %l0, (1 << 3), %l0403-404- nop; nop; nop405-406-407- /* PROM never puts any TLB entries into the MMU with the lock bit408- * set. So we gladly use tlb entry 63 for KERNBASE. And maybe 62 too.409- */410-411- sethi %hi(KERNBASE), %g3412- mov (63 << 3), %g7413- stxa %g3, [%l7] ASI_DMMU /* KERNBASE into TLB TAG */414- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS /* TTE into TLB DATA */415- membar #Sync416- stxa %g3, [%l7] ASI_IMMU /* KERNBASE into TLB TAG */417- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS /* TTE into TLB DATA */418- membar #Sync419- flush %g3420- membar #Sync421- sethi %hi(_end), %g3 /* Check for bigkernel case */422- or %g3, %lo(_end), %g3423- srl %g3, 23, %g3 /* Check if _end > 8M */424- brz,pt %g3, 2f425- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */426- sethi %hi(0x400000), %g3427- or %g3, %lo(0x400000), %g3428- add %g5, %g3, %g5 /* New tte data */429- andn %g5, (_PAGE_G), %g5430- sethi %hi(KERNBASE+0x400000), %g3431- or %g3, %lo(KERNBASE+0x400000), %g3432- mov (62 << 3), %g7433- stxa %g3, [%l7] ASI_DMMU434- stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS435- membar #Sync436- stxa %g3, [%l7] ASI_IMMU437- stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS438- membar #Sync439- flush %g3440- membar #Sync441- sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */442-2: ba,pt %xcc, 1f443- nop444-1:445 set sun4u_init, %g2446 jmpl %g2 + %g0, %g0447 nop···311 stxa %g0, [%g7] ASI_DMMU312 membar #Sync313314- /* We are now safely (we hope) in Nucleus context (0), rewrite315- * the KERNBASE TTE's so they no longer have the global bit set.316- * Don't forget to setup TAG_ACCESS first 8-)317- */318- mov TLB_TAG_ACCESS, %g2319- stxa %g3, [%g2] ASI_IMMU320- stxa %g3, [%g2] ASI_DMMU321- membar #Sync322-323 BRANCH_IF_ANY_CHEETAH(g1,g7,cheetah_tlb_fixup)324325 ba,pt %xcc, spitfire_tlb_fixup326 nop327328cheetah_tlb_fixup:329- set (0 << 16) | (15 << 3), %g7330- ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g0331- ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1332- andn %g1, (_PAGE_G), %g1333- stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS334- membar #Sync335-336- ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g0337- ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1338- andn %g1, (_PAGE_G), %g1339- stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS340- membar #Sync341-342- /* Kill instruction prefetch queues. */343- flush %g3344- membar #Sync345-346 mov 2, %g2 /* Set TLB type to cheetah+. */347 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,1f)348···353 nop354355spitfire_tlb_fixup:356- mov (63 << 3), %g7357- ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1358- andn %g1, (_PAGE_G), %g1359- stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS360- membar #Sync361-362- ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1363- andn %g1, (_PAGE_G), %g1364- stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS365- membar #Sync366-367- /* Kill instruction prefetch queues. */368- flush %g3369- membar #Sync370-371 /* Set TLB type to spitfire. */372 mov 0, %g2373 sethi %hi(tlb_type), %g1···364 ldx [%g6 + TI_TASK], %g4365 mov %sp, %l6366 mov %o4, %l7367-368-#if 0 /* We don't do it like this anymore, but for historical hack value369- * I leave this snippet here to show how crazy we can be sometimes. 8-)370- */371-372- /* Setup "Linux Current Register", thanks Sun 8-) */373- wr %g0, 0x1, %pcr374-375- /* Blackbird errata workaround. See commentary in376- * smp.c:smp_percpu_timer_interrupt() for more377- * information.378- */379- ba,pt %xcc, 99f380- nop381- .align 64382-99: wr %g6, %g0, %pic383- rd %pic, %g0384-#endif385386 wr %g0, ASI_P, %asi387 mov 1, %g1···525526#include "ttable.S"527#include "systbls.S"528-529- .align 1024530- .globl swapper_pg_dir531-swapper_pg_dir:532- .word 0533-534#include "etrap.S"535#include "rtrap.S"536#include "winfixup.S"
···1+/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling.2+ *3+ * Copyright (C) 1995, 1997, 2005 David S. Miller <davem@davemloft.net>4+ * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de)5+ * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)6+ * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)7+*/8+9+#include <linux/config.h>10+#include <asm/head.h>11+#include <asm/asi.h>12+#include <asm/page.h>13+#include <asm/pgtable.h>14+15+ .text16+ .align 3217+18+/*19+ * On a second level vpte miss, check whether the original fault is to the OBP 20+ * range (note that this is only possible for instruction miss, data misses to21+ * obp range do not use vpte). If so, go back directly to the faulting address.22+ * This is because we want to read the tpc, otherwise we have no way of knowing23+ * the 8k aligned faulting address if we are using >8k kernel pagesize. This24+ * also ensures no vpte range addresses are dropped into tlb while obp is25+ * executing (see inherit_locked_prom_mappings() rant).26+ */27+sparc64_vpte_nucleus:28+ /* Note that kvmap below has verified that the address is29+ * in the range MODULES_VADDR --> VMALLOC_END already. So30+ * here we need only check if it is an OBP address or not.31+ */32+ sethi %hi(LOW_OBP_ADDRESS), %g533+ cmp %g4, %g534+ blu,pn %xcc, kern_vpte35+ mov 0x1, %g536+ sllx %g5, 32, %g537+ cmp %g4, %g538+ blu,pn %xcc, vpte_insn_obp39+ nop40+41+ /* These two instructions are patched by paginig_init(). */42+kern_vpte:43+ sethi %hi(swapper_pgd_zero), %g544+ lduw [%g5 + %lo(swapper_pgd_zero)], %g545+46+ /* With kernel PGD in %g5, branch back into dtlb_backend. */47+ ba,pt %xcc, sparc64_kpte_continue48+ andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */49+50+vpte_noent:51+ /* Restore previous TAG_ACCESS, %g5 is zero, and we will52+ * skip over the trap instruction so that the top level53+ * TLB miss handler will thing this %g5 value is just an54+ * invalid PTE, thus branching to full fault processing.55+ */56+ mov TLB_SFSR, %g157+ stxa %g4, [%g1 + %g1] ASI_DMMU58+ done59+60+vpte_insn_obp:61+ sethi %hi(prom_pmd_phys), %g562+ ldx [%g5 + %lo(prom_pmd_phys)], %g563+64+ /* Behave as if we are at TL0. */65+ wrpr %g0, 1, %tl66+ rdpr %tpc, %g4 /* Find original faulting iaddr */67+ srlx %g4, 13, %g4 /* Throw out context bits */68+ sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */69+70+ /* Restore previous TAG_ACCESS. */71+ mov TLB_SFSR, %g172+ stxa %g4, [%g1 + %g1] ASI_IMMU73+74+ /* Get PMD offset. */75+ srlx %g4, 23, %g676+ and %g6, 0x7ff, %g677+ sllx %g6, 2, %g678+79+ /* Load PMD, is it valid? */80+ lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g581+ brz,pn %g5, longpath82+ sllx %g5, 11, %g583+84+ /* Get PTE offset. */85+ srlx %g4, 13, %g686+ and %g6, 0x3ff, %g687+ sllx %g6, 3, %g688+89+ /* Load PTE. */90+ ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g591+ brgez,pn %g5, longpath92+ nop93+94+ /* TLB load and return from trap. */95+ stxa %g5, [%g0] ASI_ITLB_DATA_IN96+ retry97+98+kvmap_do_obp:99+ sethi %hi(prom_pmd_phys), %g5100+ ldx [%g5 + %lo(prom_pmd_phys)], %g5101+102+ /* Get PMD offset. */103+ srlx %g4, 23, %g6104+ and %g6, 0x7ff, %g6105+ sllx %g6, 2, %g6106+107+ /* Load PMD, is it valid? */108+ lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5109+ brz,pn %g5, longpath110+ sllx %g5, 11, %g5111+112+ /* Get PTE offset. */113+ srlx %g4, 13, %g6114+ and %g6, 0x3ff, %g6115+ sllx %g6, 3, %g6116+117+ /* Load PTE. */118+ ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5119+ brgez,pn %g5, longpath120+ nop121+122+ /* TLB load and return from trap. */123+ stxa %g5, [%g0] ASI_DTLB_DATA_IN124+ retry125+126+/*127+ * On a first level data miss, check whether this is to the OBP range (note128+ * that such accesses can be made by prom, as well as by kernel using129+ * prom_getproperty on "address"), and if so, do not use vpte access ...130+ * rather, use information saved during inherit_prom_mappings() using 8k131+ * pagesize.132+ */133+ .align 32134+kvmap:135+ brgez,pn %g4, kvmap_nonlinear136+ nop137+138+#ifdef CONFIG_DEBUG_PAGEALLOC139+ .globl kvmap_linear_patch140+kvmap_linear_patch:141+#endif142+ ba,pt %xcc, kvmap_load143+ xor %g2, %g4, %g5144+145+#ifdef CONFIG_DEBUG_PAGEALLOC146+ sethi %hi(swapper_pg_dir), %g5147+ or %g5, %lo(swapper_pg_dir), %g5148+ sllx %g4, 64 - (PGDIR_SHIFT + PGDIR_BITS), %g6149+ srlx %g6, 64 - PAGE_SHIFT, %g6150+ andn %g6, 0x3, %g6151+ lduw [%g5 + %g6], %g5152+ brz,pn %g5, longpath153+ sllx %g4, 64 - (PMD_SHIFT + PMD_BITS), %g6154+ srlx %g6, 64 - PAGE_SHIFT, %g6155+ sllx %g5, 11, %g5156+ andn %g6, 0x3, %g6157+ lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5158+ brz,pn %g5, longpath159+ sllx %g4, 64 - PMD_SHIFT, %g6160+ srlx %g6, 64 - PAGE_SHIFT, %g6161+ sllx %g5, 11, %g5162+ andn %g6, 0x7, %g6163+ ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5164+ brz,pn %g5, longpath165+ nop166+ ba,a,pt %xcc, kvmap_load167+#endif168+169+kvmap_nonlinear:170+ sethi %hi(MODULES_VADDR), %g5171+ cmp %g4, %g5172+ blu,pn %xcc, longpath173+ mov (VMALLOC_END >> 24), %g5174+ sllx %g5, 24, %g5175+ cmp %g4, %g5176+ bgeu,pn %xcc, longpath177+ nop178+179+kvmap_check_obp:180+ sethi %hi(LOW_OBP_ADDRESS), %g5181+ cmp %g4, %g5182+ blu,pn %xcc, kvmap_vmalloc_addr183+ mov 0x1, %g5184+ sllx %g5, 32, %g5185+ cmp %g4, %g5186+ blu,pn %xcc, kvmap_do_obp187+ nop188+189+kvmap_vmalloc_addr:190+ /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */191+ ldxa [%g3 + %g6] ASI_N, %g5192+ brgez,pn %g5, longpath193+ nop194+195+kvmap_load:196+ /* PTE is valid, load into TLB and return from trap. */197+ stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB198+ retry
···17#include <asm/system.h>1819/* Reset and reboot the machine with the command 'bcommand'. */20-void prom_reboot(char *bcommand)21{22 p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) |23 P1275_INOUT(1, 0), bcommand);24}2526/* Forth evaluate the expression contained in 'fstring'. */27-void prom_feval(char *fstring)28{29 if (!fstring || fstring[0] == 0)30 return;···148 p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba);149}150151-int mmu_ihandle_cache = 0;152-153int prom_get_mmu_ihandle(void)154{155 int node, ret;156157- if (mmu_ihandle_cache != 0)158- return mmu_ihandle_cache;159160- node = prom_finddevice("/chosen");161- ret = prom_getint(node, "mmu");162 if (ret == -1 || ret == 0)163- mmu_ihandle_cache = -1;164 else165- mmu_ihandle_cache = ret;166167 return ret;168}···188 unsigned long tte_data,189 unsigned long vaddr)190{191- return p1275_cmd("call-method",192 (P1275_ARG(0, P1275_ARG_IN_STRING) |193 P1275_ARG(2, P1275_ARG_IN_64B) |194 P1275_ARG(3, P1275_ARG_IN_64B) |···205 unsigned long tte_data,206 unsigned long vaddr)207{208- return p1275_cmd("call-method",209 (P1275_ARG(0, P1275_ARG_IN_STRING) |210 P1275_ARG(2, P1275_ARG_IN_64B) |211 P1275_ARG(3, P1275_ARG_IN_64B) |···221int prom_map(int mode, unsigned long size,222 unsigned long vaddr, unsigned long paddr)223{224- int ret = p1275_cmd("call-method",225 (P1275_ARG(0, P1275_ARG_IN_STRING) |226 P1275_ARG(3, P1275_ARG_IN_64B) |227 P1275_ARG(4, P1275_ARG_IN_64B) |228 P1275_ARG(6, P1275_ARG_IN_64B) |229 P1275_INOUT(7, 1)),230- "map",231 prom_get_mmu_ihandle(),232 mode,233 size,···242243void prom_unmap(unsigned long size, unsigned long vaddr)244{245- p1275_cmd("call-method",246 (P1275_ARG(0, P1275_ARG_IN_STRING) |247 P1275_ARG(2, P1275_ARG_IN_64B) |248 P1275_ARG(3, P1275_ARG_IN_64B) |249 P1275_INOUT(4, 0)),250- "unmap",251 prom_get_mmu_ihandle(),252 size,253 vaddr);···256/* Set aside physical memory which is not touched or modified257 * across soft resets.258 */259-unsigned long prom_retain(char *name,260 unsigned long pa_low, unsigned long pa_high,261 long size, long align)262{···288 unsigned long phys_addr,289 char *buf, int buflen)290{291- return p1275_cmd("call-method",292 (P1275_ARG(0, P1275_ARG_IN_STRING) |293 P1275_ARG(3, P1275_ARG_OUT_BUF) |294 P1275_ARG(6, P1275_ARG_IN_64B) |
···17#include <asm/system.h>1819/* Reset and reboot the machine with the command 'bcommand'. */20+void prom_reboot(const char *bcommand)21{22 p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) |23 P1275_INOUT(1, 0), bcommand);24}2526/* Forth evaluate the expression contained in 'fstring'. */27+void prom_feval(const char *fstring)28{29 if (!fstring || fstring[0] == 0)30 return;···148 p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba);149}15000151int prom_get_mmu_ihandle(void)152{153 int node, ret;154155+ if (prom_mmu_ihandle_cache != 0)156+ return prom_mmu_ihandle_cache;157158+ node = prom_finddevice(prom_chosen_path);159+ ret = prom_getint(node, prom_mmu_name);160 if (ret == -1 || ret == 0)161+ prom_mmu_ihandle_cache = -1;162 else163+ prom_mmu_ihandle_cache = ret;164165 return ret;166}···190 unsigned long tte_data,191 unsigned long vaddr)192{193+ return p1275_cmd(prom_callmethod_name,194 (P1275_ARG(0, P1275_ARG_IN_STRING) |195 P1275_ARG(2, P1275_ARG_IN_64B) |196 P1275_ARG(3, P1275_ARG_IN_64B) |···207 unsigned long tte_data,208 unsigned long vaddr)209{210+ return p1275_cmd(prom_callmethod_name,211 (P1275_ARG(0, P1275_ARG_IN_STRING) |212 P1275_ARG(2, P1275_ARG_IN_64B) |213 P1275_ARG(3, P1275_ARG_IN_64B) |···223int prom_map(int mode, unsigned long size,224 unsigned long vaddr, unsigned long paddr)225{226+ int ret = p1275_cmd(prom_callmethod_name,227 (P1275_ARG(0, P1275_ARG_IN_STRING) |228 P1275_ARG(3, P1275_ARG_IN_64B) |229 P1275_ARG(4, P1275_ARG_IN_64B) |230 P1275_ARG(6, P1275_ARG_IN_64B) |231 P1275_INOUT(7, 1)),232+ prom_map_name,233 prom_get_mmu_ihandle(),234 mode,235 size,···244245void prom_unmap(unsigned long size, unsigned long vaddr)246{247+ p1275_cmd(prom_callmethod_name,248 (P1275_ARG(0, P1275_ARG_IN_STRING) |249 P1275_ARG(2, P1275_ARG_IN_64B) |250 P1275_ARG(3, P1275_ARG_IN_64B) |251 P1275_INOUT(4, 0)),252+ prom_unmap_name,253 prom_get_mmu_ihandle(),254 size,255 vaddr);···258/* Set aside physical memory which is not touched or modified259 * across soft resets.260 */261+unsigned long prom_retain(const char *name,262 unsigned long pa_low, unsigned long pa_high,263 long size, long align)264{···290 unsigned long phys_addr,291 char *buf, int buflen)292{293+ return p1275_cmd(prom_callmethod_name,294 (P1275_ARG(0, P1275_ARG_IN_STRING) |295 P1275_ARG(3, P1275_ARG_OUT_BUF) |296 P1275_ARG(6, P1275_ARG_IN_64B) |
+1-1
arch/sparc64/prom/p1275.c
···46 */47DEFINE_SPINLOCK(prom_entry_lock);4849-long p1275_cmd (char *service, long fmt, ...)50{51 char *p, *q;52 unsigned long flags;
···46 */47DEFINE_SPINLOCK(prom_entry_lock);4849+long p1275_cmd(const char *service, long fmt, ...)50{51 char *p, *q;52 unsigned long flags;
+1-1
arch/sparc64/prom/printf.c
···34}3536void37-prom_printf(char *fmt, ...)38{39 va_list args;40 int i;
···34}3536void37+prom_printf(const char *fmt, ...)38{39 va_list args;40 int i;
+26-24
arch/sparc64/prom/tree.c
···69 * Return -1 on error.70 */71__inline__ int72-prom_getproplen(int node, char *prop)73{74 if((!node) || (!prop)) return -1;75 return p1275_cmd ("getproplen", ···83 * was successful the length will be returned, else -1 is returned.84 */85__inline__ int86-prom_getproperty(int node, char *prop, char *buffer, int bufsize)87{88 int plen;8990 plen = prom_getproplen(node, prop);91- if((plen > bufsize) || (plen == 0) || (plen == -1))92 return -1;93- else {94 /* Ok, things seem all right. */95- return p1275_cmd ("getprop", 96- P1275_ARG(1,P1275_ARG_IN_STRING)|97- P1275_ARG(2,P1275_ARG_OUT_BUF)|98- P1275_INOUT(4, 1), 99- node, prop, buffer, P1275_SIZE(plen));100 }101}102···104 * on failure.105 */106__inline__ int107-prom_getint(int node, char *prop)108{109 int intprop;110···119 */120121int122-prom_getintdefault(int node, char *property, int deflt)123{124 int retval;125···131132/* Acquire a boolean property, 1=TRUE 0=FALSE. */133int134-prom_getbool(int node, char *prop)135{136 int retval;137···145 * buffer.146 */147void148-prom_getstring(int node, char *prop, char *user_buf, int ubuf_size)149{150 int len;151···160 * YES = 1 NO = 0161 */162int163-prom_nodematch(int node, char *name)164{165 char namebuf[128];166 prom_getproperty(node, "name", namebuf, sizeof(namebuf));···172 * 'nodename'. Return node if successful, zero if not.173 */174int175-prom_searchsiblings(int node_start, char *nodename)176{177178 int thisnode, error;···294 * property types for this node.295 */296__inline__ char *297-prom_nextprop(int node, char *oprop, char *buffer)298{299 char buf[32];300···314}315316int317-prom_finddevice(char *name)318{319- if(!name) return 0;320- return p1275_cmd ("finddevice", P1275_ARG(0,P1275_ARG_IN_STRING)|321- P1275_INOUT(1, 1), 322- name);00323}324325-int prom_node_has_property(int node, char *prop)326{327 char buf [32];328···341 * of 'size' bytes. Return the number of bytes the prom accepted.342 */343int344-prom_setprop(int node, char *pname, char *value, int size)345{346 if(size == 0) return 0;347 if((pname == 0) || (value == 0)) return 0;···366 * FIXME: Should work for v0 as well367 */368int369-prom_pathtoinode(char *path)370{371 int node, inst;372
···69 * Return -1 on error.70 */71__inline__ int72+prom_getproplen(int node, const char *prop)73{74 if((!node) || (!prop)) return -1;75 return p1275_cmd ("getproplen", ···83 * was successful the length will be returned, else -1 is returned.84 */85__inline__ int86+prom_getproperty(int node, const char *prop, char *buffer, int bufsize)87{88 int plen;8990 plen = prom_getproplen(node, prop);91+ if ((plen > bufsize) || (plen == 0) || (plen == -1)) {92 return -1;93+ } else {94 /* Ok, things seem all right. */95+ return p1275_cmd(prom_getprop_name, 96+ P1275_ARG(1,P1275_ARG_IN_STRING)|97+ P1275_ARG(2,P1275_ARG_OUT_BUF)|98+ P1275_INOUT(4, 1), 99+ node, prop, buffer, P1275_SIZE(plen));100 }101}102···104 * on failure.105 */106__inline__ int107+prom_getint(int node, const char *prop)108{109 int intprop;110···119 */120121int122+prom_getintdefault(int node, const char *property, int deflt)123{124 int retval;125···131132/* Acquire a boolean property, 1=TRUE 0=FALSE. */133int134+prom_getbool(int node, const char *prop)135{136 int retval;137···145 * buffer.146 */147void148+prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)149{150 int len;151···160 * YES = 1 NO = 0161 */162int163+prom_nodematch(int node, const char *name)164{165 char namebuf[128];166 prom_getproperty(node, "name", namebuf, sizeof(namebuf));···172 * 'nodename'. Return node if successful, zero if not.173 */174int175+prom_searchsiblings(int node_start, const char *nodename)176{177178 int thisnode, error;···294 * property types for this node.295 */296__inline__ char *297+prom_nextprop(int node, const char *oprop, char *buffer)298{299 char buf[32];300···314}315316int317+prom_finddevice(const char *name)318{319+ if (!name)320+ return 0;321+ return p1275_cmd(prom_finddev_name,322+ P1275_ARG(0,P1275_ARG_IN_STRING)|323+ P1275_INOUT(1, 1), 324+ name);325}326327+int prom_node_has_property(int node, const char *prop)328{329 char buf [32];330···339 * of 'size' bytes. Return the number of bytes the prom accepted.340 */341int342+prom_setprop(int node, const char *pname, char *value, int size)343{344 if(size == 0) return 0;345 if((pname == 0) || (value == 0)) return 0;···364 * FIXME: Should work for v0 as well365 */366int367+prom_pathtoinode(const char *path)368{369 int node, inst;370
+5
include/asm-sparc64/cacheflush.h
···66#define flush_cache_vmap(start, end) do { } while (0)67#define flush_cache_vunmap(start, end) do { } while (0)680000069#endif /* !__ASSEMBLY__ */7071#endif /* _SPARC64_CACHEFLUSH_H */
···66#define flush_cache_vmap(start, end) do { } while (0)67#define flush_cache_vunmap(start, end) do { } while (0)6869+#ifdef CONFIG_DEBUG_PAGEALLOC70+/* internal debugging function */71+void kernel_map_pages(struct page *page, int numpages, int enable);72+#endif73+74#endif /* !__ASSEMBLY__ */7576#endif /* _SPARC64_CACHEFLUSH_H */
+10
include/asm-sparc64/cpudata.h
···22 unsigned int __pad1;23 unsigned long *pte_cache[2];24 unsigned long *pgd_cache;000000000025} cpuinfo_sparc;2627DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
···22 unsigned int __pad1;23 unsigned long *pte_cache[2];24 unsigned long *pgd_cache;25+26+ /* Dcache line 3, rarely used */27+ unsigned int dcache_size;28+ unsigned int dcache_line_size;29+ unsigned int icache_size;30+ unsigned int icache_line_size;31+ unsigned int ecache_size;32+ unsigned int ecache_line_size;33+ unsigned int __pad2;34+ unsigned int __pad3;35} cpuinfo_sparc;3637DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
+33-19
include/asm-sparc64/oplib.h
···38 */39extern int prom_chosen_node;400000000000000041struct linux_mlist_p1275 {42 struct linux_mlist_p1275 *theres_more;43 unsigned long start_adr;···82 * of the string is different on V0 vs. V2->higher proms. The caller must83 * know what he/she is doing! Returns the device descriptor, an int.84 */85-extern int prom_devopen(char *device_string);8687/* Close a previously opened device described by the passed integer88 * descriptor.···112/* Miscellaneous routines, don't really fit in any category per se. */113114/* Reboot the machine with the command line passed. */115-extern void prom_reboot(char *boot_command);116117/* Evaluate the forth string passed. */118-extern void prom_feval(char *forth_string);119120/* Enter the prom, with possibility of continuation with the 'go'121 * command in newer proms.···168extern void prom_putchar(char character);169170/* Prom's internal routines, don't use in kernel/boot code. */171-extern void prom_printf(char *fmt, ...);172extern void prom_write(const char *buf, unsigned int len);173174/* Query for input device type */···229 char *buf, int buflen);230231/* Retain physical memory to the caller across soft resets. */232-extern unsigned long prom_retain(char *name,233 unsigned long pa_low, unsigned long pa_high,234 long size, long align);235···283/* Get the length, at the passed node, of the given property type.284 * Returns -1 on error (ie. no such property at this node).285 */286-extern int prom_getproplen(int thisnode, char *property);287288/* Fetch the requested property using the given buffer. Returns289 * the number of bytes the prom put into your buffer or -1 on error.290 */291-extern int prom_getproperty(int thisnode, char *property,292 char *prop_buffer, int propbuf_size);293294/* Acquire an integer property. */295-extern int prom_getint(int node, char *property);296297/* Acquire an integer property, with a default value. */298-extern int prom_getintdefault(int node, char *property, int defval);299300/* Acquire a boolean property, 0=FALSE 1=TRUE. */301-extern int prom_getbool(int node, char *prop);302303/* Acquire a string property, null string on error. */304-extern void prom_getstring(int node, char *prop, char *buf, int bufsize);305306/* Does the passed node have the given "name"? YES=1 NO=0 */307-extern int prom_nodematch(int thisnode, char *name);308309/* Puts in buffer a prom name in the form name@x,y or name (x for which_io 310 * and y for first regs phys address···314/* Search all siblings starting at the passed node for "name" matching315 * the given string. Returns the node on success, zero on failure.316 */317-extern int prom_searchsiblings(int node_start, char *name);318319/* Return the first property type, as a string, for the given node.320 * Returns a null string on error. Buffer should be at least 32B long.···324/* Returns the next property after the passed property for the given325 * node. Returns null string on failure. Buffer should be at least 32B long.326 */327-extern char *prom_nextprop(int node, char *prev_property, char *buffer);328329/* Returns 1 if the specified node has given property. */330-extern int prom_node_has_property(int node, char *property);331332/* Returns phandle of the path specified */333-extern int prom_finddevice(char *name);334335/* Set the indicated property at the given node with the passed value.336 * Returns the number of bytes of your value that the prom took.337 */338-extern int prom_setprop(int node, char *prop_name, char *prop_value,339 int value_size);340341-extern int prom_pathtoinode(char *path);342extern int prom_inst2pkg(int);343344/* CPU probing helpers. */···348/* Client interface level routines. */349extern void prom_set_trap_table(unsigned long tba);350351-extern long p1275_cmd (char *, long, ...);352353354#if 0
···38 */39extern int prom_chosen_node;4041+/* Helper values and strings in arch/sparc64/kernel/head.S */42+extern const char prom_finddev_name[];43+extern const char prom_chosen_path[];44+extern const char prom_getprop_name[];45+extern const char prom_mmu_name[];46+extern const char prom_callmethod_name[];47+extern const char prom_translate_name[];48+extern const char prom_map_name[];49+extern const char prom_unmap_name[];50+extern int prom_mmu_ihandle_cache;51+extern unsigned int prom_boot_mapped_pc;52+extern unsigned int prom_boot_mapping_mode;53+extern unsigned long prom_boot_mapping_phys_high, prom_boot_mapping_phys_low;54+55struct linux_mlist_p1275 {56 struct linux_mlist_p1275 *theres_more;57 unsigned long start_adr;···68 * of the string is different on V0 vs. V2->higher proms. The caller must69 * know what he/she is doing! Returns the device descriptor, an int.70 */71+extern int prom_devopen(const char *device_string);7273/* Close a previously opened device described by the passed integer74 * descriptor.···98/* Miscellaneous routines, don't really fit in any category per se. */99100/* Reboot the machine with the command line passed. */101+extern void prom_reboot(const char *boot_command);102103/* Evaluate the forth string passed. */104+extern void prom_feval(const char *forth_string);105106/* Enter the prom, with possibility of continuation with the 'go'107 * command in newer proms.···154extern void prom_putchar(char character);155156/* Prom's internal routines, don't use in kernel/boot code. */157+extern void prom_printf(const char *fmt, ...);158extern void prom_write(const char *buf, unsigned int len);159160/* Query for input device type */···215 char *buf, int buflen);216217/* Retain physical memory to the caller across soft resets. */218+extern unsigned long prom_retain(const char *name,219 unsigned long pa_low, unsigned long pa_high,220 long size, long align);221···269/* Get the length, at the passed node, of the given property type.270 * Returns -1 on error (ie. no such property at this node).271 */272+extern int prom_getproplen(int thisnode, const char *property);273274/* Fetch the requested property using the given buffer. Returns275 * the number of bytes the prom put into your buffer or -1 on error.276 */277+extern int prom_getproperty(int thisnode, const char *property,278 char *prop_buffer, int propbuf_size);279280/* Acquire an integer property. */281+extern int prom_getint(int node, const char *property);282283/* Acquire an integer property, with a default value. */284+extern int prom_getintdefault(int node, const char *property, int defval);285286/* Acquire a boolean property, 0=FALSE 1=TRUE. */287+extern int prom_getbool(int node, const char *prop);288289/* Acquire a string property, null string on error. */290+extern void prom_getstring(int node, const char *prop, char *buf, int bufsize);291292/* Does the passed node have the given "name"? YES=1 NO=0 */293+extern int prom_nodematch(int thisnode, const char *name);294295/* Puts in buffer a prom name in the form name@x,y or name (x for which_io 296 * and y for first regs phys address···300/* Search all siblings starting at the passed node for "name" matching301 * the given string. Returns the node on success, zero on failure.302 */303+extern int prom_searchsiblings(int node_start, const char *name);304305/* Return the first property type, as a string, for the given node.306 * Returns a null string on error. Buffer should be at least 32B long.···310/* Returns the next property after the passed property for the given311 * node. Returns null string on failure. Buffer should be at least 32B long.312 */313+extern char *prom_nextprop(int node, const char *prev_property, char *buffer);314315/* Returns 1 if the specified node has given property. */316+extern int prom_node_has_property(int node, const char *property);317318/* Returns phandle of the path specified */319+extern int prom_finddevice(const char *name);320321/* Set the indicated property at the given node with the passed value.322 * Returns the number of bytes of your value that the prom took.323 */324+extern int prom_setprop(int node, const char *prop_name, char *prop_value,325 int value_size);326327+extern int prom_pathtoinode(const char *path);328extern int prom_inst2pkg(int);329330/* CPU probing helpers. */···334/* Client interface level routines. */335extern void prom_set_trap_table(unsigned long tba);336337+extern long p1275_cmd(const char *, long, ...);338339340#if 0
+4-3
include/asm-sparc64/pgtable.h
···60 * table can map61 */62#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))63-#define PMD_SIZE (1UL << PMD_SHIFT)64#define PMD_MASK (~(PMD_SIZE-1))65#define PMD_BITS (PAGE_SHIFT - 2)6667/* PGDIR_SHIFT determines what a third-level page table entry can map */68#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)69-#define PGDIR_SIZE (1UL << PGDIR_SHIFT)70#define PGDIR_MASK (~(PGDIR_SIZE-1))71#define PGDIR_BITS (PAGE_SHIFT - 2)72···336#define pte_clear(mm,addr,ptep) \337 set_pte_at((mm), (addr), (ptep), __pte(0UL))338339-extern pgd_t swapper_pg_dir[1];0340341/* These do nothing with the way I have things setup. */342#define mmu_lockarea(vaddr, len) (vaddr)
···60 * table can map61 */62#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))63+#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT)64#define PMD_MASK (~(PMD_SIZE-1))65#define PMD_BITS (PAGE_SHIFT - 2)6667/* PGDIR_SHIFT determines what a third-level page table entry can map */68#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)69+#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT)70#define PGDIR_MASK (~(PGDIR_SIZE-1))71#define PGDIR_BITS (PAGE_SHIFT - 2)72···336#define pte_clear(mm,addr,ptep) \337 set_pte_at((mm), (addr), (ptep), __pte(0UL))338339+extern pgd_t swapper_pg_dir[2048];340+extern pmd_t swapper_low_pmd_dir[2048];341342/* These do nothing with the way I have things setup. */343#define mmu_lockarea(vaddr, len) (vaddr)