📄 rominit.s
字号:
addi r5, r5, LO ((0xff000000 & M8260_OR_AM_MSK) | \ M8260_OR_SDRAM_ROWST_9 \ | M8260_OR_SDRAM_NUMR_11 | M8260_OR_SDRAM_PM_NORM) lis r6, HIADJ (M8260_OR2 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_OR2 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* load BR2 */ lis r5, HIADJ (LOCAL_MEM_LOCAL_ADRS | M8260_BR_PS_64 | \ M8260_BR_MS_SDRAM_60X | M8260_BR_V) addi r5, r5, LO (LOCAL_MEM_LOCAL_ADRS | M8260_BR_PS_64 | \ M8260_BR_MS_SDRAM_60X | M8260_BR_V) lis r6, HIADJ (M8260_BR2 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_BR2 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* * program the PSDMR as explained below: * PBI is set to zero, since page-based interleaving is not * supported on early silicon revisions * Refresh services are off for now * OP selects the "Precharge all banks" command * SDAM = b001 * BSMA selects A15-A17 as bank select lines * A9 is selected as control pin for SDA10 on SDRAM * 7-clock refresh recovery time * precharge-to-activate interval is 3-clock time * activate-to-read/write interval is 2-clock time * Burst lenght is 4 * last data out to precharge is 1 clock * write recovery time is 1 clock * no external address multiplexing * normal timing for the control lines * CAS latency is 2 */ addis r5,0,0x296E ori r5,r5,0xB452 lis r6, HIADJ (M8260_PSDMR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_PSDMR (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) addis r0,0,0 /* do a single write to an arbitrary location */ addi r5,0,0x00FF /* Load 0x000000FF into r5 */ stb r5,0(r0) /* Write 0xFF to address 0 - bits [24-31] */ /* issue a "CBR Refresh" command to SDRAM */ addis r5,0,0x096E ori r5,r5,0xB452 stw r5, 0 (r6) /* Loop 8 times, writing 0xFF to address 0 */ addi r7,0,0x0008 mtspr 9,r7 /* Load spr CTR with 8 */ addi r8,0,0x00FF /* Load 0x000000FF into r8 */ SdramWrLoop: stb r8,0(r0) /* Write 0xFF to address 0 */ bc 16,0,SdramWrLoop /* Decrement CTR, and possibly branch */ /* issue a "Mode Register Write" command to SDRAM */ addis r5,0,0x196E ori r5,r5,0xB452 stw r5, 0 (r6) /* do a single write to an arbitrary location */ addi r8,0,0x00FF /* Load 0x000000FF into r8 */ stb r8,0(r0) /* Write 0xFF to address 0 - bits [24-31] */ /* enable refresh services and put SDRAM into normal operation */ /* this was changed for PILOT but will work for the ENG as well */ addis r5,0,0x416E ori r5,r5,0xB452 stw r5, 0 (r6) lis r4, HIADJ (0x04710000) addi r4, r4, LO (0x04710000)#ifdef INCLUDE_LOC_SDRAM addi r5,0,0x0010 /* load 0x10 or 16 */ stb r5,0x01a4(r4) /* store byte - bits[24-31] */ addis r8,0,0x0400 /* R3 holds the value temporarily */ ori r8,r8,0x1861 addis r5,0,0xFFC0 /* R5 holds the value temporarily */ ori r5,r5,0x1480 stw r5,0x0124(r4) stw r8,0x0120 (r4) addis r8,0,0x2886 ori r8,r8,0xA522 stw r8,0x0194 (r4) addis r2,0,0x0400 addi r8,0,0xFFFF stb r8,0(r2) /* Write 0xFF to address 0x04000000 */ addis r8,0,0x0886 ori r8,r8,0xA522 stw r8,0x0194 (r4) addis r6,0,0 ori r6,r6,8 mtspr 9,r6 /* Load CTR with 8. */ addi r8,0,0xFFFF /* Load 0xFs into r8 */ locSdramWrLoop: stb r8,0(r2) /* Write 0 to address 0x04000000 */ bc 16,0,locSdramWrLoop /* Decrement CTR, then branch if the decremented CTR */ /* is not equal to 0 */ addis r8,0,0x1886 ori r8,r8,0xA522 stw r8,0x0194 (r4) addi r8,0,0xFFFF stb r8,0(r2) /* Write 0xFF to address 0x04000000 */ addis r8,0,0x4086 ori r8,r8,0xA522 stw r8,0x0194 (r4) #endif /* INCLUDE_LOC_SDRAM */ /* Zero-out registers: SPRGs */ addis r0,0,0 isync /* synchronize */ mtspr 272,r0 mtspr 273,r0 mtspr 274,r0 mtspr 275,r0 isync /* synchronize */ /* zero-out the Segment registers */ mtsr 0,r0 isync mtsr 1,r0 isync mtsr 2,r0 isync mtsr 3,r0 isync mtsr 4,r0 isync mtsr 5,r0 isync mtsr 6,r0 isync mtsr 7,r0 isync mtsr 8,r0 isync mtsr 9,r0 isync mtsr 10,r0 isync mtsr 11,r0 isync mtsr 12,r0 isync mtsr 13,r0 isync mtsr 14,r0 isync mtsr 15,r0 isync /* invalidate DBATs: clear VP and VS bits */ mtspr 536,r0 /* Data bat register 0 upper */ isync mtspr 538,r0 /* Data bat register 1 upper */ isync mtspr 540,r0 /* Data bat register 2 upper */ isync mtspr 542,r0 /* Data bat register 3 upper */ isync /* invalidate IBATs: clear VP and VS bits */ mtspr 528,r0 /* Instruction bat register 0 upper */ isync mtspr 530,r0 /* Instruction bat register 1 upper */ isync mtspr 532,r0 /* Instruction bat register 2 upper */ isync mtspr 534,r0 /* Instruction bat register 3 upper */ isync /* invalidate TLBs: loop on all TLB entries using r7 as an index */ addi r0,0,0x0020 mtspr 9,r0 /* Load CTR with 32 */ addi r7,0,0 /* Use r7 as the tlb index */ tlb_write_loop: tlbie r7 /* invalidate the tlb entry */ sync addi r7,r7,0x1000 /* increment the index */ bc 16,0,tlb_write_loop /* Decrement CTR, then branch if the */ /* decremented CTR is not equal to 0 */ /* Turn off data and instruction cache control bits */ mfspr r7, HID0 isync sync /* synchronize */ andi. r7,r7,0x3FFF /* Clear DCE and ICE bits */ mtspr HID0,r7 isync sync /* synchronize */ /* Get the board revision number but do nothing for now */ lis r6, HIADJ (BCSR2) /* load r6 with the BCSR2 address */ lwz r5, LO(BCSR2)(r6) /* load r5 with the BCSR2 value */ lis r6, HI(BCSR2_BREVN_MASK) and r5, r5, r6 /* extract board revision number */ /* initialize the stack pointer */ lis sp, HIADJ(STACK_ADRS) addi sp, sp, LO(STACK_ADRS) /* go to C entry point */ addi sp, sp, -FRAMEBASESZ /* get frame stack */ /* * calculate C entry point: routine - entry point + ROM base * routine = romStart * entry point = romInit = R7 * ROM base = ROM_TEXT_ADRS = R8 * C entry point: romStart - R7 + R8 */ lis r7, HIADJ(romInit) addi r7, r7, LO(romInit) lis r8, HIADJ(ROM_TEXT_ADRS) addi r8, r8, LO(ROM_TEXT_ADRS) lis r6, HIADJ(romStart) addi r6, r6, LO(romStart) /* load R6 with C entry point */ sub r6, r6, r7 /* routine - entry point */ add r6, r6, r8 /* + ROM base */ mtspr LR, r6 /* save destination address*/ /* into LR register */ blr /* jump to the C entry point */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -