4/29/2020
Godson 3A1000 Processor User Manual
132
#define BONITO_PCILO_BASE
0x10000000
#define BONITO_PCILO_BASE_VA
0xd0000000
#define BONITO_PCIIO_BASE
0x18000000
#define BONITO_PCIIO_BASE_VA
0xb8000000
It means that the 256M PCI space (0x10000000 ~ 0x20000000) is divided into two parts:
0x10000000 ~ 0x17ffffff is mem space, 0x18000000 ~ 0x20000000 is IO space. And mem space
The virtual address 0xd0000000 to the physical address 0x10000000 is converted by manually filling the TLB. in
In 3A-690e, if the memory is 2G, the PCI address of the video memory is actually 0x10000000, and the corresponding memory address is
0xf8000000, if the memory is 1G, the PCI address of the video memory is actually 0x10000000, and the corresponding memory address is
0x78000000, this is also achieved through TLB mapping. The code for TLB mapping is as follows:
151
Page 164
Godson 3A1000 Processor User Manual Part 2
li t0, 15
li t3, 0xf0000000 # entry_hi, the starting address of the virtual address to be mapped
li a0, 0x3f000000
bleu msize, a0, 1f // judge whether the memory is 1G or 2G, if it is 1G, jump to 1 to execute
nop
li t4, 0x0000f000 // 2G situation, turn 0xf0000000 to 0xf0000000
b 2f
// jump to 2 to execute
nop
1:
li t4, 0x00007000 // 1G, turn 0xf0000000 to 0x70000000
2:
.set mips64
dsll t4, t4, 10
.set mips3
ori t4, t4, 0x1f
li t5, (0x1000000 >> 6)
# 16M stride, a page is 16M
li t6, 0x2000000
# VPN2 32M stride
.set mips64
1:
dmtc0 t3, COP_0_TLB_HI
// Fill in the TLB entry
daddu t3, t3, t6
dmtc0 t4, COP_0_TLB_LO0
daddu t4, t4, t5
dmtc0 t4, COP_0_TLB_LO1
daddu t4, t4, t5
.set mips3
addiu t1, t0, 16
mtc0 t1, COP_0_TLB_INDEX
# 16MB page