AnsweredAssumed Answered

P2020 serial port can't print after TLB init

Question asked by yang jie on Mar 12, 2018

I have a question about P2020 when booting from SPI FLASH.I'm debugging the boot code in assembly language.I need to print debug information with the serial port.The serial port has printed debug information before TLB initialization,but it does not print debug information after TLB initialization.The TLB used TLB1 entry1,entry2 and entry3.The entry1 and entry2 used for DDR,entry3 used for CCSBAR.The code like follow:

 

UART_ASM_INIT

UART_ASM_PUTC(r8, r9, 'a')/*Can print with the serial port*/

 

/*
* TLB1 #1. Main SDRAM - Not Cached
* Attributes: UX/UW/UR/SX/SW/SR
*
*/
addis r4, 0, 0x1001 /* TLB1 entry#1 */
ori r4, r4, 0x0000
mtspr MAS0, r4
addis r5, 0, HI(0x80000000)
ori r5, r5, 0xa00/* TS = 0, TSIZE = 1 GByte */
mtspr MAS1, r5
addis r6, 0, HI(0x0) /* EPN */
ori r6, r6, 0x0000 /* WIMGE = 00000 
mtspr MAS2, r6
addis r7, 0, HI(0x0) /* RPN */
ori r7, r7, 0x003f /* Supervisor XWR*/
mtspr MAS3, r7
tlbwe
tlbsync

UART_ASM_PUTC(r8, r9, 'b')/*Can't  print with the serial port*/

 

/* TLB1 #2: DDR memory 0x40000000 -> 0x7FFFFFFF (1024MB) */

 

addis r4, 0, 0x1002 /* TLB1 entry#1 */
ori r4, r4, 0x0000
mtspr MAS0, r4
addis r5, 0, 0xc000 /* V = 1, IPROT = 1, TID = 0 */
ori r5, r5, 0xa00/* TS = 0, TSIZE = 1 GByte */
mtspr MAS1, r5
addis r6, 0, HI(0x40000000) /* EPN */
ori r6, r6, 0x0000 /* WIMGE = 00000 */
mtspr MAS2, r6
addis r7, 0, HI(0x40000000) /* RPN */
ori r7, r7, 0x003f /* Supervisor XWR*/
mtspr MAS3, r7
tlbwe
tlbsync

 

 

UART_ASM_PUTC(r8, r9, 'c')/*Can't  print with the serial port*/

/* TLB1 #3: CCSR space 0xEFE00000 -> 0xEFEFFFFF (1MB) */
#if 1
addis r4, 0, 0x1003 /* TLBSEL = TLB1(CAM) , ESEL = 3*/
ori r4, r4, 0x0000
mtspr MAS0, r4
addis r5, 0, 0xc000
ori r5, r5, 0x500/* TS = 0, TSIZE = 1 MByte page size*/
mtspr MAS1, r5
addis r6, 0, HI(0xefe00000) /* EPN = CCSBAR */
ori r6, r6, 0x0000 /* WIMGE = 01010 */
mtspr MAS2, r6
addis r7, 0, HI(0xefe00000) /* RPN = CCSBAR */
ori r7, r7, 0x003f /* Supervisor XWR*/
mtspr MAS3, r7
isync
msync
tlbwe
tlbsync

 

 

UART_ASM_PUTC(r8, r9, 'd')/*Can't  print with the serial port*/

Outcomes