Commit 5bd42912 authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL
Browse files

Add MaxCamEntry32 & CPUFlag_HighRAM

MaxCamEntry32 is an internal variable which the kernel can use to
quickly determine whether a RAM page has a 32bit physical address or
something larger, by comparing with the physical page number (currently
entries in PhysRamTable are sorted such that all 32bit pages come first)

CPUFlag_HighRAM (aka OS_PlatformFeatures 0 bit 21) is a flag that
external code can use to detect whether any high RAM is present, and
thus whether 64bit physical address APIs should be preferred over 32bit
ones (once the new APIs are implemented!). Using APIs which only support
32bit physical addresses will result in functionality being limited.
parent df4efb68
......@@ -1335,6 +1335,11 @@ CPUFeatures # 2*4
CamMapCorruptDebugBlock # &40 ; somewhere to dump registers in case of emergency
MaxCamEntry32 # 4 ; maximum index into the cam map which has a
; 32bit physical address, for easy detection by
; page number (all RAM banks with 32bit
; addresses come first)
[ :DEF: ShowWS
! 0, "Free space after CamMap debug block = ":CC::STR:((JordanWS+256*4)-@)
......@@ -47,6 +47,7 @@ CPUFlag_AbortRestartBroken * 1:SHL:17 ; Aborts do not correctly follow
CPUFlag_XScale * 1:SHL:18 ; it's an XScale, so weird debug etc
CPUFlag_XScaleJTAGconnected * 1:SHL:19 ; JTAG has been connected
CPUFlag_HiProcVecs * 1:SHL:20 ; High processor vectors are in use
CPUFlag_HighRAM * 1:SHL:21 ; Some of the RAM has a physical address of 2^32 or higher. If set, software should prefer to use APIs which use 64bit physical addresses; older APIs which only support 32bit physical addresses will have limited functionality
CPUFlag_ExtraReasonCodesFixed * 1:SHL:31 ; Bug causing unknown reason codes to always raise an error has been fixed (bug affected 3.7X, 5.XX, and CallASWI)
; OS_PlatformFeatures 34 flags:
......@@ -1571,6 +1571,8 @@ ROMDecompAlign * 20
BL CountPageTablePages
BL Count32bitPages
B Continue_after_HALInit
......@@ -1680,6 +1682,34 @@ CountPageTablePages ROUT
STR a1, [a2, #LxPTUsed]
Count32bitPages ROUT
LDR a1, =ZeroPage
LDR a2, [a1, #MaxCamEntry]
[ LongDesc
; ~64bit RAM addresses supported, examine PhysRamTable to determine
; the last page number with a 32bit address
MOV a3, #-1
ADD a4, a1, #PhysRamTable
LDMIA a4!, {ip, lr}
CMP ip, #1:SHL:20 ; Address below 4G?
ADDLO a3, a3, lr, LSR #12 ; Count it up
CMPLO a3, a2 ; Don't overrun the table
STR a3, [a1, #MaxCamEntry32]
; Update ProcessorFlags
CMP a2, a3
LDRNE a2, [a1, #ProcessorFlags]
ORRNE a2, a2, #CPUFlag_HighRAM
STRNE a2, [a1, #ProcessorFlags]
; No 64bit support, so all pages must have 32bit addresses
STR a2, [a1, #MaxCamEntry32]
MOV pc, lr
; int PhysAddrToPageNo(uint64_t addr)
; Converts a physical address to the page number of the page containing it.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment