X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPkg%2FLibrary%2FArmLib%2FAArch64%2FArmLibSupport.S;h=b7173e00b039f9c5b59262f8f75dbaa3d9b9dca0;hp=1ef2f61f5979013a63247eafb19b0e87f0d6d894;hb=95d04ebca8be8f71a23e85a2f4822ba90a2e32cc;hpb=82379bf6603274e81604d5a6f6bb14bdde616286 diff --git a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S index 1ef2f61f59..b7173e00b0 100644 --- a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S +++ b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S @@ -196,4 +196,21 @@ ASM_FUNC(ArmWriteSctlr) 3:msr sctlr_el3, x0 4:ret +ASM_FUNC(ArmGetPhysicalAddressBits) + mrs x0, id_aa64mmfr0_el1 + adr x1, .LPARanges + and x0, x0, #0xf + ldrb w0, [x1, x0] + ret + +// +// Bits 0..3 of the AA64MFR0_EL1 system register encode the size of the +// physical address space support on this CPU: +// 0 == 32 bits, 1 == 36 bits, etc etc +// 7 and up are reserved +// +.LPARanges: + .byte 32, 36, 40, 42, 44, 48, 52, 0 + .byte 0, 0, 0, 0, 0, 0, 0, 0 + ASM_FUNCTION_REMOVE_IF_UNREFERENCED