summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-22 18:10:17 +0800
committerGuo Mang <mang.guo@intel.com>2016-12-26 19:14:55 +0800
commit7809daf1046ca96896130038402054a8ace671e7 (patch)
tree426ea4f568c618e0b0ddec0d11e6ad6fe5ff33ae /ArmPlatformPkg
parent496195960952f27f4d3e74761fbb692bd2333fc2 (diff)
downloadedk2-platforms-7809daf1046ca96896130038402054a8ace671e7.tar.xz
ArmPlatformPkg: Remove unused Package
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiSsdtRootPci.asl176
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf52
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/Dsdt.asl184
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc62
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc99
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc103
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc130
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec49
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc294
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf365
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/AcpiTables.c78
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c562
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf95
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h46
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.c596
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.h284
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciRootBridgeIo.c299
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.c199
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.h324
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf76
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeResourceAllocation.c642
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciRootBridge.c745
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c167
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.h111
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h94
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S75
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S105
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJuno.c163
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf64
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoMem.c174
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c68
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJunoLib.inf32
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Makefile87
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc385
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf263
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg.dec218
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg.dsc452
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg.fdf320
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc296
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf323
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc309
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf381
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc301
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf365
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc440
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c113
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c84
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c217
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf80
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c79
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf40
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressCommon.c48
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h99
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c449
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf54
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec81
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h154
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA9x4/ArmPlatform.h121
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM/ArmPlatform.h80
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h140
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf50
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c197
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S89
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm97
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Mem.c182
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLib.inf54
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf51
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c200
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S63
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm70
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Mem.c119
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S81
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S116
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm124
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLib.inf54
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLibSec.inf50
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf59
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf56
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c198
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundation.c159
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundationMem.c115
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c158
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf55
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S123
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm127
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c176
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/GicV3.S70
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMBoot.S64
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMFoundationBoot.S75
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.S24
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.asm27
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S50
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm54
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressFoundationSecLib.inf42
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf49
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMFoundationSec.c71
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c100
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c273
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf35
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c283
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf37
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c289
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf44
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c84
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf32
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c374
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf43
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c88
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf35
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/LICENSE.TXT28
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/Makefile96
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/boot.S183
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/model.lds.S77
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.html88
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.txt92
-rw-r--r--ArmPlatformPkg/Bds/Bds.c561
-rw-r--r--ArmPlatformPkg/Bds/Bds.inf91
-rw-r--r--ArmPlatformPkg/Bds/BdsHelper.c465
-rw-r--r--ArmPlatformPkg/Bds/BdsInternal.h277
-rw-r--r--ArmPlatformPkg/Bds/BootLinux.c124
-rw-r--r--ArmPlatformPkg/Bds/BootMenu.c1103
-rw-r--r--ArmPlatformPkg/Bds/BootOption.c317
-rw-r--r--ArmPlatformPkg/Bds/BootOptionSupport.c1195
-rw-r--r--ArmPlatformPkg/Contributions.txt218
-rwxr-xr-xArmPlatformPkg/Documentation/ARM-EDK2-Overview.pngbin54500 -> 0 bytes
-rwxr-xr-xArmPlatformPkg/Documentation/ArmPlatformLib-2nd-Stage.pngbin56506 -> 0 bytes
-rwxr-xr-xArmPlatformPkg/Documentation/ArmPlatformLib-Full-Boot.pngbin79676 -> 0 bytes
-rw-r--r--ArmPlatformPkg/Documentation/ArmPlatformPkg.txt74
-rw-r--r--ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c106
-rw-r--r--ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf33
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c125
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf63
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c882
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c393
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h128
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c126
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf59
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf77
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c19
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c129
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c1288
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h369
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf73
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c787
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c19
-rw-r--r--ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c403
-rw-r--r--ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf42
-rw-r--r--ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c344
-rw-r--r--ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf50
-rw-r--r--ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c553
-rw-r--r--ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.h168
-rwxr-xr-xArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf52
-rw-r--r--ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c108
-rwxr-xr-xArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf27
-rw-r--r--ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c126
-rwxr-xr-xArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf31
-rw-r--r--ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c227
-rwxr-xr-xArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.inf29
-rwxr-xr-xArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S60
-rwxr-xr-xArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm62
-rwxr-xr-xArmPlatformPkg/Drivers/PL35xSmc/PL35xSmc.inf29
-rw-r--r--ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c395
-rw-r--r--ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf59
-rw-r--r--ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c387
-rw-r--r--ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf52
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf61
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsApi.h388
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c768
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsEntryPoint.c528
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h57
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c222
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h101
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c792
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsReadWrite.c259
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsUnsupported.c37
-rw-r--r--ArmPlatformPkg/Include/Drivers/ArmTrustzone.h88
-rw-r--r--ArmPlatformPkg/Include/Drivers/HdLcd.h89
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL011Uart.h231
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL031RealTimeClock.h56
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL061Gpio.h54
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL111Lcd.h149
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL301Axi.h21
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL310L2Cache.h79
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL341Dmc.h336
-rw-r--r--ArmPlatformPkg/Include/Drivers/PL35xSmc.h75
-rw-r--r--ArmPlatformPkg/Include/Drivers/SP804Timer.h57
-rw-r--r--ArmPlatformPkg/Include/Drivers/SP805Watchdog.h48
-rw-r--r--ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h51
-rw-r--r--ArmPlatformPkg/Include/Guid/BootMonFsFileInfo.h47
-rw-r--r--ArmPlatformPkg/Include/Library/ArmPlatformGlobalVariableLib.h38
-rw-r--r--ArmPlatformPkg/Include/Library/ArmPlatformLib.h182
-rw-r--r--ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h88
-rw-r--r--ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h63
-rw-r--r--ArmPlatformPkg/Include/Library/ArmShellCmdLib.h57
-rw-r--r--ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h24
-rw-r--r--ArmPlatformPkg/Include/Library/LcdPlatformLib.h221
-rw-r--r--ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h37
-rw-r--r--ArmPlatformPkg/Include/Ppi/ArmGlobalVariable.h55
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.c76
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf44
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.c84
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf40
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c107
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf44
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.c81
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf39
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S65
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S63
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm72
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c164
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf48
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullMem.c34
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf47
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/AArch64/ArmPlatformLibNullBoot.S61
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S47
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm49
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c74
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf44
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/AArch64/ArmPlatformStackLib.S129
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S121
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm127
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf40
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c85
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf28
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c95
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.h85
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf55
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.unibin6472 -> 0 bytes
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.c154
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.h66
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.c340
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h64
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c339
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf32.h258
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf64.h260
-rw-r--r--ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf_common.h1059
-rw-r--r--ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c24
-rw-r--r--ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c38
-rw-r--r--ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S41
-rw-r--r--ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm40
-rw-r--r--ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf40
-rwxr-xr-xArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.c121
-rwxr-xr-xArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf54
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/AArch64/EblCmdMmu.c33
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c370
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c206
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c473
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf64
-rw-r--r--ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0Cache.c30
-rwxr-xr-xArmPlatformPkg/Library/L2X0CacheLibNull/L2X0CacheLibNull.inf27
-rw-r--r--ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c226
-rw-r--r--ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf43
-rw-r--r--ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c684
-rw-r--r--ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf46
-rw-r--r--ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c91
-rw-r--r--ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf44
-rw-r--r--ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c376
-rw-r--r--ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h35
-rw-r--r--ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf65
-rwxr-xr-xArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c60
-rwxr-xr-xArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf35
-rw-r--r--ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c256
-rw-r--r--ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf44
-rwxr-xr-xArmPlatformPkg/License.txt25
-rwxr-xr-xArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c198
-rwxr-xr-xArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf66
-rwxr-xr-xArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c154
-rwxr-xr-xArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf75
-rwxr-xr-xArmPlatformPkg/PlatformPei/PlatformPeiLib.c30
-rwxr-xr-xArmPlatformPkg/PlatformPei/PlatformPeiLib.inf53
-rwxr-xr-xArmPlatformPkg/PlatformPei/PlatformPeim.c138
-rwxr-xr-xArmPlatformPkg/PlatformPei/PlatformPeim.inf69
-rw-r--r--ArmPlatformPkg/PrePeiCore/AArch64/ArchPrePeiCore.c52
-rw-r--r--ArmPlatformPkg/PrePeiCore/AArch64/Exception.S81
-rw-r--r--ArmPlatformPkg/PrePeiCore/AArch64/Helper.S48
-rw-r--r--ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S110
-rw-r--r--ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S43
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c62
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/Exception.S102
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/Exception.asm91
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S94
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm98
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S43
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm38
-rw-r--r--ArmPlatformPkg/PrePeiCore/MainMPCore.c158
-rw-r--r--ArmPlatformPkg/PrePeiCore/MainUniCore.c67
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCore.c163
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCore.h83
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf80
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf74
-rw-r--r--ArmPlatformPkg/PrePi/AArch64/ArchPrePi.c33
-rw-r--r--ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S159
-rw-r--r--ArmPlatformPkg/PrePi/Arm/ArchPrePi.c29
-rw-r--r--ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S168
-rw-r--r--ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm171
-rw-r--r--ArmPlatformPkg/PrePi/LzmaDecompress.h103
-rw-r--r--ArmPlatformPkg/PrePi/MainMPCore.c106
-rw-r--r--ArmPlatformPkg/PrePi/MainUniCore.c44
-rwxr-xr-xArmPlatformPkg/PrePi/PeiMPCore.inf116
-rwxr-xr-xArmPlatformPkg/PrePi/PeiUniCore.inf112
-rwxr-xr-xArmPlatformPkg/PrePi/PrePi.c260
-rw-r--r--ArmPlatformPkg/PrePi/PrePi.h92
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/build_report.py54
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py102
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/edk2_debugger.py231
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/firmware_volume.py355
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/profile.py334
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/system_table.py177
-rw-r--r--ArmPlatformPkg/Scripts/Makefile87
-rw-r--r--ArmPlatformPkg/Sec/AArch64/Arch.c25
-rw-r--r--ArmPlatformPkg/Sec/AArch64/Helper.S93
-rw-r--r--ArmPlatformPkg/Sec/AArch64/SecEntryPoint.S143
-rw-r--r--ArmPlatformPkg/Sec/Arm/Arch.c25
-rw-r--r--ArmPlatformPkg/Sec/Arm/Helper.S84
-rw-r--r--ArmPlatformPkg/Sec/Arm/Helper.asm79
-rw-r--r--ArmPlatformPkg/Sec/Arm/SecEntryPoint.S122
-rw-r--r--ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm126
-rw-r--r--ArmPlatformPkg/Sec/Sec.c200
-rw-r--r--ArmPlatformPkg/Sec/Sec.inf87
-rw-r--r--ArmPlatformPkg/Sec/SecInternal.h83
320 files changed, 0 insertions, 50035 deletions
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiSsdtRootPci.asl b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiSsdtRootPci.asl
deleted file mode 100644
index c6d5a9a7de..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiSsdtRootPci.asl
+++ /dev/null
@@ -1,176 +0,0 @@
-/** @file
- Differentiated System Description Table Fields (SSDT)
-
- Copyright (c) 2014-2015, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmPlatform.h"
-
-/*
- See Reference [1] 6.2.12
- "There are two ways that _PRT can be used. ...
- In the second model, the PCI interrupts are hardwired to specific interrupt
- inputs on the interrupt controller and are not configurable. In this case,
- the Source field in _PRT does not reference a device, but instead contains
- the value zero, and the Source Index field contains the global system
- interrupt to which the PCI interrupt is hardwired."
-*/
-#define PRT_ENTRY(Address, Pin, Interrupt) \
- Package (4) { \
- Address, /* uses the same format as _ADR */ \
- Pin, /* The PCI pin number of the device (0-INTA, 1-INTB, 2-INTC, 3-INTD). */ \
- Zero, /* allocated from the global interrupt pool. */ \
- Interrupt /* global system interrupt number */ \
- }
-
-/*
- See Reference [1] 6.1.1
- "High word–Device #, Low word–Function #. (for example, device 3, function 2 is
- 0x00030002). To refer to all the functions on a device #, use a function number of FFFF)."
-*/
-#define ROOT_PRT_ENTRY(Pin, Interrupt) PRT_ENTRY(0x0000FFFF, Pin, Interrupt)
- // Device 0 for Bridge.
-
-
-DefinitionBlock("SsdtPci.aml", "SSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_OEM_REVISION) {
- Scope(_SB) {
- //
- // PCI Root Complex
- //
- Device(PCI0)
- {
- Name(_HID, EISAID("PNP0A08")) // PCI Express Root Bridge
- Name(_CID, EISAID("PNP0A03")) // Compatible PCI Root Bridge
- Name(_SEG, Zero) // PCI Segment Group number
- Name(_BBN, Zero) // PCI Base Bus Number
-
- // Root Complex 0
- Device (RP0) {
- Name(_ADR, 0xF0000000) // Dev 0, Func 0
- }
-
- // PCI Routing Table
- Name(_PRT, Package() {
- ROOT_PRT_ENTRY(0, 136), // INTA
- ROOT_PRT_ENTRY(1, 137), // INTB
- ROOT_PRT_ENTRY(2, 138), // INTC
- ROOT_PRT_ENTRY(3, 139), // INTD
- })
- // Root complex resources
- Method (_CRS, 0, Serialized) {
- Name (RBUF, ResourceTemplate () {
- WordBusNumber ( // Bus numbers assigned to this root
- ResourceProducer,
- MinFixed, MaxFixed, PosDecode,
- 0, // AddressGranularity
- 0, // AddressMinimum - Minimum Bus Number
- 255, // AddressMaximum - Maximum Bus Number
- 0, // AddressTranslation - Set to 0
- 256 // RangeLength - Number of Busses
- )
-
- DWordMemory ( // 32-bit BAR Windows
- ResourceProducer, PosDecode,
- MinFixed, MaxFixed,
- Cacheable, ReadWrite,
- 0x00000000, // Granularity
- 0x50000000, // Min Base Address
- 0x57FFFFFF, // Max Base Address
- 0x00000000, // Translate
- 0x08000000 // Length
- )
-
- QWordMemory ( // 64-bit BAR Windows
- ResourceProducer, PosDecode,
- MinFixed, MaxFixed,
- Cacheable, ReadWrite,
- 0x00000000, // Granularity
- 0x4000000000, // Min Base Address
- 0x40FFFFFFFF, // Max Base Address
- 0x00000000, // Translate
- 0x100000000 // Length
- )
- }) // Name(RBUF)
-
- Return (RBUF)
- } // Method(_CRS)
-
- //
- // OS Control Handoff
- //
- Name(SUPP, Zero) // PCI _OSC Support Field value
- Name(CTRL, Zero) // PCI _OSC Control Field value
-
- /*
- See [1] 6.2.10, [2] 4.5
- */
- Method(_OSC,4) {
- // Check for proper UUID
- If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
- // Create DWord-adressable fields from the Capabilities Buffer
- CreateDWordField(Arg3,0,CDW1)
- CreateDWordField(Arg3,4,CDW2)
- CreateDWordField(Arg3,8,CDW3)
-
- // Save Capabilities DWord2 & 3
- Store(CDW2,SUPP)
- Store(CDW3,CTRL)
-
- // Only allow native hot plug control if OS supports:
- // * ASPM
- // * Clock PM
- // * MSI/MSI-X
- If(LNotEqual(And(SUPP, 0x16), 0x16)) {
- And(CTRL,0x1E,CTRL) // Mask bit 0 (and undefined bits)
- }
-
- // Always allow native PME, AER (no dependencies)
-
- // Never allow SHPC (no SHPC controller in this system)
- And(CTRL,0x1D,CTRL)
-
-#if 0
- If(LNot(And(CDW1,1))) { // Query flag clear?
- // Disable GPEs for features granted native control.
- If(And(CTRL,0x01)) { // Hot plug control granted?
- Store(0,HPCE) // clear the hot plug SCI enable bit
- Store(1,HPCS) // clear the hot plug SCI status bit
- }
- If(And(CTRL,0x04)) { // PME control granted?
- Store(0,PMCE) // clear the PME SCI enable bit
- Store(1,PMCS) // clear the PME SCI status bit
- }
- If(And(CTRL,0x10)) { // OS restoring PCIe cap structure?
- // Set status to not restore PCIe cap structure
- // upon resume from S3
- Store(1,S3CR)
- }
- }
-#endif
-
- If(LNotEqual(Arg1,One)) { // Unknown revision
- Or(CDW1,0x08,CDW1)
- }
-
- If(LNotEqual(CDW3,CTRL)) { // Capabilities bits were masked
- Or(CDW1,0x10,CDW1)
- }
- // Update DWORD3 in the buffer
- Store(CTRL,CDW3)
- Return(Arg3)
- } Else {
- Or(CDW1,4,CDW1) // Unrecognized UUID
- Return(Arg3)
- }
- } // End _OSC
- } // PCI0
- }
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf
deleted file mode 100644
index 92a1c25354..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-## @file
-#
-# ACPI table data and ASL sources required to boot the platform.
-#
-# Copyright (c) 2014-2015, ARM Ltd. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = JunoAcpiTables
- FILE_GUID = a1dd808e-1e95-4399-abc0-653c82e8530c
- MODULE_TYPE = USER_DEFINED
- VERSION_STRING = 1.0
-
-[Sources]
- Dsdt.asl
- Facs.aslc
- Fadt.aslc
- Gtdt.aslc
- Madt.aslc
- AcpiSsdtRootPci.asl # Juno R1 specific
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdCoreCount
- gArmTokenSpaceGuid.PcdGicDistributorBase
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
-
- gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
- gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
- gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
- gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
-
- gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
- gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Dsdt.asl b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Dsdt.asl
deleted file mode 100644
index 7a56f001a6..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Dsdt.asl
+++ /dev/null
@@ -1,184 +0,0 @@
-/** @file
- Differentiated System Description Table Fields (DSDT)
-
- Copyright (c) 2014-2015, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmPlatform.h"
-
-DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_OEM_REVISION) {
- Scope(_SB) {
- //
- // A57x2-A53x4 Processor declaration
- //
- Device(CPU0) { // A53-0: Cluster 1, Cpu 0
- Name(_HID, "ACPI0007")
- Name(_UID, 0)
- }
- Device(CPU1) { // A53-1: Cluster 1, Cpu 1
- Name(_HID, "ACPI0007")
- Name(_UID, 1)
- }
- Device(CPU2) { // A53-2: Cluster 1, Cpu 2
- Name(_HID, "ACPI0007")
- Name(_UID, 2)
- }
- Device(CPU3) { // A53-3: Cluster 1, Cpu 3
- Name(_HID, "ACPI0007")
- Name(_UID, 3)
- }
- Device(CPU4) { // A57-0: Cluster 0, Cpu 0
- Name(_HID, "ACPI0007")
- Name(_UID, 4)
- }
- Device(CPU5) { // A57-1: Cluster 0, Cpu 1
- Name(_HID, "ACPI0007")
- Name(_UID, 5)
- }
-
- //
- // Keyboard and Mouse
- //
- Device(KMI0) {
- Name(_HID, "ARMH0501")
- Name(_CID, "PL050_KBD")
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1C060008, 0x4)
- Memory32Fixed(ReadWrite, 0x1C060000, 0x4)
- Memory32Fixed(ReadOnly, 0x1C060004, 0x4)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 197 }
- })
- }
-
- //
- // LAN9118 Ethernet
- //
- Device(ETH0) {
- Name(_HID, "ARMH9118")
- Name(_UID, Zero)
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1A000000, 0x1000)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 192 }
- })
- }
-
- // UART PL011
- Device(COM0) {
- Name(_HID, "ARMH0011")
- Name(_CID, "PL011")
- Name(_UID, Zero)
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x7FF80000, 0x1000)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 115 }
- })
- }
-
- //
- // USB Host Controller
- //
- Device(USB0){
- Name(_HID, "ARMH0D20")
- Name(_CID, "PNP0D20")
- Name(_UID, 2)
-
- Method(_CRS, 0x0, Serialized){
- Name(RBUF, ResourceTemplate(){
- Memory32Fixed(ReadWrite, 0x7FFC0000, 0x000000B0)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) {149} // INT ID=149 GIC IRQ ID=117 for Juno SoC USB EHCI Controller
- })
- Return(RBUF)
- }
-
- //
- // Root Hub
- //
- Device(RHUB){
- Name(_ADR, 0x00000000) // Address of Root Hub should be 0 as per ACPI 5.0 spec
-
- //
- // Ports connected to Root Hub
- //
- Device(HUB1){
- Name(_ADR, 0x00000001)
- Name(_UPC, Package(){
- 0x00, // Port is NOT connectable
- 0xFF, // Don't care
- 0x00000000, // Reserved 0 must be zero
- 0x00000000 // Reserved 1 must be zero
- })
-
- Device(PRT1){
- Name(_ADR, 0x00000001)
- Name(_UPC, Package(){
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name(_PLD, Package(){
- Buffer(0x10){
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- } // USB0_RHUB_HUB1_PRT1
- Device(PRT2){
- Name(_ADR, 0x00000002)
- Name(_UPC, Package(){
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name(_PLD, Package(){
- Buffer(0x10){
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- } // USB0_RHUB_HUB1_PRT2
-
- Device(PRT3){
- Name(_ADR, 0x00000003)
- Name(_UPC, Package(){
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name(_PLD, Package(){
- Buffer(0x10){
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- } // USB0_RHUB_HUB1_PRT3
-
- Device(PRT4){
- Name(_ADR, 0x00000004)
- Name(_UPC, Package(){
- 0xFF, // Port is connectable
- 0x00, // Port connector is A
- 0x00000000,
- 0x00000000
- })
- Name(_PLD, Package(){
- Buffer(0x10){
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
- })
- } // USB0_RHUB_HUB1_PRT4
- } // USB0_RHUB_HUB1
- } // USB0_RHUB
- } // USB0
- } // Scope(_SB)
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc
deleted file mode 100644
index 137ead77c1..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Facs.aslc
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
-* Firmware ACPI Control Structure (FACS)
-*
-* Copyright (c) 2012 - 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <IndustryStandard/Acpi.h>
-
-EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs = {
- EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, // UINT32 Signature
- sizeof (EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE), // UINT32 Length
- 0xA152, // UINT32 HardwareSignature
- 0, // UINT32 FirmwareWakingVector
- 0, // UINT32 GlobalLock
- 0, // UINT32 Flags
- 0, // UINT64 XFirmwareWakingVector
- EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION, // UINT8 Version;
- { EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved0[0]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved0[1]
- EFI_ACPI_RESERVED_BYTE }, // UINT8 Reserved0[2]
- 0, // UINT32 OspmFlags "Platform firmware must
- // initialize this field to zero."
- { EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[0]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[1]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[2]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[3]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[4]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[5]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[6]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[7]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[8]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[9]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[10]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[11]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[12]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[13]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[14]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[15]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[16]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[17]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[18]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[19]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[20]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[21]
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved1[22]
- EFI_ACPI_RESERVED_BYTE }, // UINT8 Reserved1[23]
-};
-
-//
-// Reference the table being generated to prevent the optimizer from removing the
-// data structure from the executable
-//
-VOID* CONST ReferenceAcpiTable = &Facs;
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc
deleted file mode 100644
index eafdecb8af..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Fadt.aslc
+++ /dev/null
@@ -1,99 +0,0 @@
-/** @file
-* Fixed ACPI Description Table (FADT)
-*
-* Copyright (c) 2012 - 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "ArmPlatform.h"
-#include <Library/AcpiLib.h>
-#include <IndustryStandard/Acpi.h>
-
-#ifdef ARM_JUNO_ACPI_5_0
-EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = {
- ARM_ACPI_HEADER (
- EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE,
- EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
- ),
-#else
-EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE Fadt = {
- ARM_ACPI_HEADER (
- EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE,
- EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
- ),
-#endif
- 0, // UINT32 FirmwareCtrl
- 0, // UINT32 Dsdt
- EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved0
- EFI_ACPI_5_0_PM_PROFILE_UNSPECIFIED, // UINT8 PreferredPmProfile
- 0, // UINT16 SciInt
- 0, // UINT32 SmiCmd
- 0, // UINT8 AcpiEnable
- 0, // UINT8 AcpiDisable
- 0, // UINT8 S4BiosReq
- 0, // UINT8 PstateCnt
- 0, // UINT32 Pm1aEvtBlk
- 0, // UINT32 Pm1bEvtBlk
- 0, // UINT32 Pm1aCntBlk
- 0, // UINT32 Pm1bCntBlk
- 0, // UINT32 Pm2CntBlk
- 0, // UINT32 PmTmrBlk
- 0, // UINT32 Gpe0Blk
- 0, // UINT32 Gpe1Blk
- 0, // UINT8 Pm1EvtLen
- 0, // UINT8 Pm1CntLen
- 0, // UINT8 Pm2CntLen
- 0, // UINT8 PmTmrLen
- 0, // UINT8 Gpe0BlkLen
- 0, // UINT8 Gpe1BlkLen
- 0, // UINT8 Gpe1Base
- 0, // UINT8 CstCnt
- 0, // UINT16 PLvl2Lat
- 0, // UINT16 PLvl3Lat
- 0, // UINT16 FlushSize
- 0, // UINT16 FlushStride
- 0, // UINT8 DutyOffset
- 0, // UINT8 DutyWidth
- 0, // UINT8 DayAlrm
- 0, // UINT8 MonAlrm
- 0, // UINT8 Century
- 0, // UINT16 IaPcBootArch
- 0, // UINT8 Reserved1
- EFI_ACPI_5_0_HW_REDUCED_ACPI | EFI_ACPI_5_0_LOW_POWER_S0_IDLE_CAPABLE, // UINT32 Flags
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE ResetReg
- 0, // UINT8 ResetValue
-#if ARM_JUNO_ACPI_5_0
- {EFI_ACPI_RESERVED_BYTE,EFI_ACPI_RESERVED_BYTE,EFI_ACPI_RESERVED_BYTE}, // UINT8 Reserved2[3]
-#else
- EFI_ACPI_5_1_ARM_PSCI_COMPLIANT, // UINT16 ArmBootArchFlags
- EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION, // UINT8 MinorRevision
-#endif
- 0, // UINT64 XFirmwareCtrl
- 0, // UINT64 XDsdt
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
- NULL_GAS, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE SleepControlReg
- NULL_GAS // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
-};
-
-//
-// Reference the table being generated to prevent the optimizer from removing the
-// data structure from the executable
-//
-VOID* CONST ReferenceAcpiTable = &Fadt;
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc
deleted file mode 100644
index 50057c2641..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Gtdt.aslc
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
-* Generic Timer Description Table (GTDT)
-*
-* Copyright (c) 2012 - 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "ArmPlatform.h"
-#include <Library/AcpiLib.h>
-#include <Library/PcdLib.h>
-#include <IndustryStandard/Acpi.h>
-
-#define GTDT_GLOBAL_FLAGS_MAPPED EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_MEMORY_MAPPED_BLOCK_PRESENT
-#define GTDT_GLOBAL_FLAGS_NOT_MAPPED 0
-#define GTDT_GLOBAL_FLAGS_EDGE EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_INTERRUPT_MODE
-#define GTDT_GLOBAL_FLAGS_LEVEL 0
-
-// Note: We could have a build flag that switches between memory mapped/non-memory mapped timer
-#ifdef SYSTEM_TIMER_BASE_ADDRESS
- #define GTDT_GLOBAL_FLAGS (GTDT_GLOBAL_FLAGS_MAPPED | GTDT_GLOBAL_FLAGS_LEVEL)
-#else
- #define GTDT_GLOBAL_FLAGS (GTDT_GLOBAL_FLAGS_NOT_MAPPED | GTDT_GLOBAL_FLAGS_LEVEL)
- #define SYSTEM_TIMER_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF
-#endif
-
-#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE
-#define GTDT_TIMER_LEVEL_TRIGGERED 0
-#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
-#define GTDT_TIMER_ACTIVE_HIGH 0
-
-#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)
-
-#ifdef ARM_JUNO_ACPI_5_0
- EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt = {
- ARM_ACPI_HEADER(
- EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
- EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE,
- EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
- ),
- SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress
- GTDT_GLOBAL_FLAGS, // UINT32 GlobalFlags
- FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags
- FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags
- FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags
- FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV
- GTDT_GTIMER_FLAGS // UINT32 NonSecurePL2TimerFlags
- };
-#else
- #pragma pack (1)
-
- typedef struct {
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
- EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Watchdogs[JUNO_WATCHDOG_COUNT];
- } EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLES;
-
- #pragma pack ()
-
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = {
- {
- ARM_ACPI_HEADER(
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE,
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
- ),
- SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress
- 0, // UINT32 Reserved
- FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags
- FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags
- FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags
- FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV
- GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags
- 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress
- JUNO_WATCHDOG_COUNT, // UINT32 PlatformTimerCount
- sizeof (EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE) // UINT32 PlatfromTimerOffset
- },
- {
- EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
- FixedPcdGet32 (PcdGenericWatchdogRefreshBase), FixedPcdGet32 (PcdGenericWatchdogControlBase), 93, 0),
- EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
- FixedPcdGet32 (PcdGenericWatchdogRefreshBase), FixedPcdGet32 (PcdGenericWatchdogControlBase), 94, EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_SECURE_TIMER)
- }
- };
-#endif
-
-//
-// Reference the table being generated to prevent the optimizer from removing the
-// data structure from the executable
-//
-VOID* CONST ReferenceAcpiTable = &Gtdt;
diff --git a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc b/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc
deleted file mode 100644
index 406bd94f56..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc
+++ /dev/null
@@ -1,130 +0,0 @@
-/** @file
-* Multiple APIC Description Table (MADT)
-*
-* Copyright (c) 2012 - 2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "ArmPlatform.h"
-#include <Library/AcpiLib.h>
-#include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-#include <IndustryStandard/Acpi.h>
-
-//
-// Multiple APIC Description Table
-//
-#ifdef ARM_JUNO_ACPI_5_0
- #pragma pack (1)
-
- typedef struct {
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
- EFI_ACPI_5_0_GIC_STRUCTURE GicInterfaces[FixedPcdGet32 (PcdCoreCount)];
- EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
- } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
-
- #pragma pack ()
-
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
- {
- ARM_ACPI_HEADER (
- EFI_ACPI_1_0_APIC_SIGNATURE,
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE,
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
- ),
- //
- // MADT specific fields
- //
- 0, // LocalApicAddress
- 0, // Flags
- },
- {
- // Format: EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase)
- // Note: The GIC Structure of the primary CPU must be the first entry (see note in 5.2.12.14 GIC Structure of
- // ACPI v5.0).
- // On Juno we can change the primary CPU changing the SCC register. It is not currently supported in the
- // Trusted Firmware. When supported, we will need to code to dynamically change the ordering.
- // For now we leave CPU2 (A53-0) at the first position.
- // The cores from a same cluster are kept together. It is not an ACPI requirement but in case the OSPM uses
- // the ACPI ARM Parking protocol, it might want to wake up the cores in the order of this table.
- EFI_ACPI_5_0_GIC_STRUCTURE_INIT(2, 0, EFI_ACPI_5_0_GIC_ENABLED, 50, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-0
- EFI_ACPI_5_0_GIC_STRUCTURE_INIT(3, 1, EFI_ACPI_5_0_GIC_ENABLED, 54, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-1
- EFI_ACPI_5_0_GIC_STRUCTURE_INIT(4, 2, EFI_ACPI_5_0_GIC_ENABLED, 58, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-2
- EFI_ACPI_5_0_GIC_STRUCTURE_INIT(5, 3, EFI_ACPI_5_0_GIC_ENABLED, 62, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-3
- EFI_ACPI_5_0_GIC_STRUCTURE_INIT(0, 4, EFI_ACPI_5_0_GIC_ENABLED, 34, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A57-0
- EFI_ACPI_5_0_GIC_STRUCTURE_INIT(1, 5, EFI_ACPI_5_0_GIC_ENABLED, 38, FixedPcdGet32 (PcdGicInterruptInterfaceBase)) // A57-1
- },
- EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet32 (PcdGicDistributorBase), 0)
- };
-#else
- #pragma pack (1)
-
- typedef struct {
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
- EFI_ACPI_5_1_GIC_STRUCTURE GicInterfaces[FixedPcdGet32 (PcdCoreCount)];
- EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
- EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE MsiFrame;
- } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
-
- #pragma pack ()
-
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
- {
- ARM_ACPI_HEADER (
- EFI_ACPI_1_0_APIC_SIGNATURE,
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE,
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
- ),
- //
- // MADT specific fields
- //
- 0, // LocalApicAddress
- 0, // Flags
- },
- {
- // Format: EFI_ACPI_5_1_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Flags, PmuIrq, GicBase, GicVBase, GicHBase,
- // GsivId, GicRBase, Mpidr)
- // Note: The GIC Structure of the primary CPU must be the first entry (see note in 5.2.12.14 GICC Structure of
- // ACPI v5.1).
- // On Juno we can change the primary CPU changing the SCC register. It is not currently supported in the
- // Trusted Firmware. When supported, we will need to code to dynamically change the ordering.
- // For now we leave CPU2 (A53-0) at the first position.
- // The cores from a same cluster are kept together. It is not an ACPI requirement but in case the OSPM uses
- // the ACPI ARM Parking protocol, it might want to wake up the cores in the order of this table.
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-0
- 2, 0, GET_MPID(1, 0), EFI_ACPI_5_0_GIC_ENABLED, 50, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
- 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-1
- 3, 1, GET_MPID(1, 1), EFI_ACPI_5_0_GIC_ENABLED, 54, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
- 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-2
- 4, 2, GET_MPID(1, 2), EFI_ACPI_5_0_GIC_ENABLED, 58, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
- 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-3
- 5, 3, GET_MPID(1, 3), EFI_ACPI_5_0_GIC_ENABLED, 62, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
- 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A57-0
- 0, 4, GET_MPID(0, 0), EFI_ACPI_5_0_GIC_ENABLED, 34, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
- 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
- EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A57-1
- 1, 5, GET_MPID(0, 1), EFI_ACPI_5_0_GIC_ENABLED, 38, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
- 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
- },
- EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet32 (PcdGicDistributorBase), 0),
- EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(0, ARM_JUNO_GIV2M_MSI_BASE, 0, 0, 0)
- };
-#endif
-
-//
-// Reference the table being generated to prevent the optimizer from removing the
-// data structure from the executable
-//
-VOID* CONST ReferenceAcpiTable = &Madt;
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
deleted file mode 100644
index 040a906ac1..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-[Defines]
- DEC_SPECIFICATION = 0x00010005
- PACKAGE_NAME = ArmJunoPkg
- PACKAGE_GUID = a1147a20-3144-4f8d-8295-b48311c8e4a4
- PACKAGE_VERSION = 0.1
-
-################################################################################
-#
-# Include Section - list of Include Paths that are provided by this package.
-# Comments are used for Keywords and Module Types.
-#
-# Supported Module Types:
-# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
-#
-################################################################################
-[Includes.common]
- Include # Root include for the package
-
-[Guids.common]
- gArmJunoTokenSpaceGuid = { 0xa1147a20, 0x3144, 0x4f8d, { 0x82, 0x95, 0xb4, 0x83, 0x11, 0xc8, 0xe4, 0xa4 } }
-
-[PcdsFeatureFlag.common]
- gArmJunoTokenSpaceGuid.PcdPciMaxPayloadFixup|FALSE|BOOLEAN|0x00000013
-
-[PcdsFixedAtBuild.common]
- gArmJunoTokenSpaceGuid.PcdPcieControlBaseAddress|0x7FF20000|UINT64|0x0000000B
- gArmJunoTokenSpaceGuid.PcdPcieRootPortBaseAddress|0x7FF30000|UINT64|0x0000000C
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress|0x40000000|UINT64|0x00000011
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceSize|0x10000000|UINT64|0x00000012
-
- gArmJunoTokenSpaceGuid.PcdSynopsysUsbOhciBaseAddress|0x7FFB0000|UINT32|0x00000004
- gArmJunoTokenSpaceGuid.PcdSynopsysUsbEhciBaseAddress|0x7FFC0000|UINT32|0x00000005
-
- # Juno Device Trees are loaded from NOR Flash
- gArmJunoTokenSpaceGuid.PcdJunoR0FdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/juno.dtb"|VOID*|0x00000006
- gArmJunoTokenSpaceGuid.PcdJunoR1A57x2FdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/r1a57.dtb"|VOID*|0x00000007
- gArmJunoTokenSpaceGuid.PcdJunoR1A57x2A53x4FdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/r1a57a53.dtb"|VOID*|0x00000008
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
deleted file mode 100644
index ba838c7063..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
+++ /dev/null
@@ -1,294 +0,0 @@
-#
-# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = ArmJuno
- PLATFORM_GUID = ca0722fd-7d3d-45ea-948c-d62b2199807d
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/ArmJuno
- SUPPORTED_ARCHITECTURES = AARCH64|ARM
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
-
-# On RTSM, most peripherals are VExpress Motherboard peripherals
-!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
-
-[LibraryClasses.common]
- ArmPlatformLib|ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
-
- ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
- NorFlashPlatformLib|ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJunoLib.inf
- EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
-
- TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
-
- # USB Requirements
- UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
-
-[LibraryClasses.ARM]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
-
-[LibraryClasses.AARCH64]
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
-
-[LibraryClasses.common.SEC]
- PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
- ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
- LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
- HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
- PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
- PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
-
-[LibraryClasses.common.SEC, LibraryClasses.common.PEIM]
- MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
-
-[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER]
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-
-[BuildOptions]
- *_*_*_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmJunoPkg/Include
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec|TRUE
-
- ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
- # It could be set FALSE to save size.
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
-
- gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Juno"
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmJuno"
-
- #
- # NV Storage PCDs. Use base of 0x08000000 for NOR0
- #
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0BFC0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0BFD0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0BFE0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
-
- # System Memory (2GB - 16MB of Trusted DRAM at the top of the 32bit address space)
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000
- gArmTokenSpaceGuid.PcdSystemMemorySize|0x7F000000
-
- # Juno Dual-Cluster profile
- gArmPlatformTokenSpaceGuid.PcdCoreCount|6
- gArmPlatformTokenSpaceGuid.PcdClusterCount|2
-
- gArmTokenSpaceGuid.PcdVFPEnabled|1
-
- #
- # ARM PrimeCell
- #
-
- ## PL011 - Serial Terminal
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x7FF80000
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
- gArmPlatformTokenSpaceGuid.PL011UartInteger|4
- gArmPlatformTokenSpaceGuid.PL011UartFractional|0
-
- ## PL031 RealTimeClock
- gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
-
- # LAN9118 Ethernet Driver
- gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x18000000
- gEmbeddedTokenSpaceGuid.PcdLan9118DefaultMacAddress|0x1215161822242628
-
- #
- # ARM General Interrupt Controller
- #
- gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C010000
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C02F000
-
- #
- # PLDA PCI Root Complex
- #
- gArmPlatformTokenSpaceGuid.PcdPciBusMax|255
- gArmPlatformTokenSpaceGuid.PcdPciIoBase|0x5f800000
- gArmPlatformTokenSpaceGuid.PcdPciIoSize|0x00800000
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Base|0x50000000
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x08000000
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Base|0x4000000000
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Size|0x100000000
-
- # List of Device Paths that support BootMonFs
- gArmPlatformTokenSpaceGuid.PcdBootMonFsSupportedDevicePaths|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)"
-
- #
- # ARM OS Loader
- #
- # Support the Linux EFI stub by default
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"EFI Linux from NOR Flash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug"
-
- # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()"
-
- #
- # ARM Architectural Timer Frequency
- #
- gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|50000000
- gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000
-
-[PcdsPatchableInModule]
- # Console Resolution (Full HD)
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1920
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|1080
-
-[PcdsDynamicDefault.common]
- #
- # The size of a dynamic PCD of the (VOID*) type can not be increased at run
- # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128
- # character "empty" string, to allow to be able to set FDT text device paths
- # up to 128 characters long.
- #
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" "
-
- # Not all Juno platforms support PCI. This dynamic PCD disables or enable
- # PCI support.
- gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
-
-################################################################################
-#
-# Components Section - list of all EDK II Modules needed by this Platform
-#
-################################################################################
-[Components.common]
- #
- # PEI Phase modules
- #
- ArmPlatformPkg/PrePi/PeiMPCore.inf {
- <LibraryClasses>
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
- }
-
- #
- # DXE
- #
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- }
-
- #
- # Architectural Protocols
- #
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
- }
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-
- #
- # ACPI Support
- #
- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
- ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf
-
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
-
- #
- # Semi-hosting filesystem
- #
- ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- # Required by PCI
- UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-
- #
- # PCI Support
- #
- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
- ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf
-
- #
- # SATA Controller
- #
- MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
- EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf
-
- #
- # Networking stack
- #
- EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
-
- #
- # Usb Support
- #
- MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
- MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
- MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
-
- #
- # Juno platform driver
- #
- ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
-
- #
- # Bds
- #
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- ArmPlatformPkg/Bds/Bds.inf
-
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
deleted file mode 100644
index 51b1180e7a..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
+++ /dev/null
@@ -1,365 +0,0 @@
-#
-# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-
-[FD.BL33_AP_UEFI]
-BaseAddress = 0xE0000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
-Size = 0x000F0000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
-ErasePolarity = 1
-
-# This one is tricky, it must be: BlockSize * NumBlocks = Size
-BlockSize = 0x00001000
-NumBlocks = 0xF0
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-
-0x00000000|0x000F0000
-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
-FV = FVMAIN_COMPACT
-
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-
-[FV.FvMain]
-BlockSize = 0x40
-NumBlocks = 0 # This FV gets compressed so make it just big enough
-FvAlignment = 8 # FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092
-
- APRIORI DXE {
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- }
-
- INF MdeModulePkg/Core/Dxe/DxeMain.inf
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-
- #
- # PI DXE Drivers producing Architectural Protocols (EFI Services)
- #
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-
- #
- # ACPI Support
- #
- INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
- INF RuleOverride=ACPITABLE ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf
-
- INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- #
- # Multiple Console IO support
- #
- INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
-
- # NOR Flash driver
- INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
-
- # Versatile Express FileSystem
- INF ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- INF FatBinPkg/EnhancedFatDxe/Fat.inf
- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- # Required by PCI
- INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-
- # FV FileSystem
- INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
-
- #
- # Usb Support
- #
- INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
- INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
- INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
- INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
- INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
-
- #
- # PCI Support
- #
- INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
- INF ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf
-
- #
- # SATA Controller
- #
- INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
- INF EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf
-
- #
- # Networking stack
- #
- INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
- INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
- INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
- INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
- INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
- INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
- INF EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
-
- #
- # UEFI applications
- #
- INF ShellBinPkg/UefiShell/UefiShell.inf
- INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
-
- #
- # Juno platform driver
- #
- INF ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
-
- #
- # Bds
- #
- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- INF ArmPlatformPkg/Bds/Bds.inf
-
- #
- # FDT installation
- #
- # The UEFI driver is at the end of the list of the driver to be dispatched
- # after the device drivers (eg: Ethernet) to ensure we have support for them.
- INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
-
-[FV.FVMAIN_COMPACT]
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/PrePi/PeiMPCore.inf
-
- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FVMAIN
- }
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-#
-# These SEC rules are used for ArmPlatformPkg/PrePi module.
-# ArmPlatformPkg/PrePi is declared as a SEC module to make GenFv patch the
-# UEFI Firmware to jump to ArmPlatformPkg/PrePi entrypoint
-#
-[Rule.ARM.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.AARCH64.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED {
- TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-# A shim specific rule is required to ensure the alignment is 4K.
-# Otherwise BaseTools pick up the AArch32 alignment (ie: 32)
-[Rule.ARM.SEC.SHIM]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 4K $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) FIXED {
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) FIXED {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
- FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- UI STRING ="$(MODULE_NAME)" Optional
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
- FILE APPLICATION = $(NAMED_GUID) {
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.USER_DEFINED.ACPITABLE]
- FILE FREEFORM = $(NAMED_GUID) {
- RAW ACPI |.acpi
- RAW ASL |.aml
- }
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/AcpiTables.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/AcpiTables.c
deleted file mode 100644
index bf08346434..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/AcpiTables.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
-
- This file contains support for ACPI Tables that are generated at boot time.
-
- Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmPlatform.h"
-#include "ArmJunoDxeInternal.h"
-
-#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
-
-/*
- * Memory Mapped Configuration Space Access Table (MCFG)
- */
-typedef struct {
- EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER Header;
- EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE Entry;
-} MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ACCESS_TABLE;
-
-MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ACCESS_TABLE mAcpiMcfgTable = {
- {
- ARM_ACPI_HEADER (
- EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
- MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ACCESS_TABLE,
- EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION
- ),
- 0, // Reserved
- }, {
- FixedPcdGet32 (PcdPciConfigurationSpaceBaseAddress),
- 0, // PciSegmentGroupNumber
- FixedPcdGet32 (PcdPciBusMin),
- FixedPcdGet32 (PcdPciBusMax),
- 0 // Reserved;
- }
-};
-
-/**
- * Callback called when ACPI Protocol is installed
- */
-VOID
-AcpiPciNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
- UINTN AcpiTableKey;
-
- //
- // Ensure the ACPI protocol is installed
- //
- Status = gBS->LocateProtocol (
- &gEfiAcpiTableProtocolGuid,
- NULL,
- (VOID**)&AcpiTableProtocol
- );
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // Install MCFG Table
- //
- AcpiTableKey = 0;
- Status = AcpiTableProtocol->InstallAcpiTable (AcpiTableProtocol, &mAcpiMcfgTable, sizeof (mAcpiMcfgTable), &AcpiTableKey);
- ASSERT_EFI_ERROR (Status);
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c
deleted file mode 100644
index 756c2751e1..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c
+++ /dev/null
@@ -1,562 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "ArmJunoDxeInternal.h"
-#include <ArmPlatform.h>
-
-#include <Protocol/DevicePathFromText.h>
-#include <Protocol/PciRootBridgeIo.h>
-
-#include <Guid/EventGroup.h>
-#include <Guid/GlobalVariable.h>
-
-#include <Library/ArmShellCmdLib.h>
-#include <Library/AcpiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/IoLib.h>
-#include <Library/PrintLib.h>
-
-//
-// Size in number of characters of the Linux boot argument
-// passing the MAC address to be used by the PCI GigaByte
-// Ethernet device : " sky2.mac_address=0x11,0x22,0x33,0x44,0x55,0x66"
-//
-#define SKY2_MAC_ADDRESS_BOOTARG_LEN 47
-
-//
-// Hardware platform identifiers
-//
-typedef enum {
- UNKNOWN,
- JUNO_R0,
- JUNO_R1
-} JUNO_REVISION;
-
-//
-// Function prototypes
-//
-STATIC EFI_STATUS SetJunoR1DefaultBootEntries (
- VOID
- );
-
-// This GUID must match the FILE_GUID in ArmPlatformPkg/ArmJunoPkg/AcpiTables/AcpiTables.inf
-STATIC CONST EFI_GUID mJunoAcpiTableFile = { 0xa1dd808e, 0x1e95, 0x4399, { 0xab, 0xc0, 0x65, 0x3c, 0x82, 0xe8, 0x53, 0x0c } };
-
-typedef struct {
- ACPI_HID_DEVICE_PATH AcpiDevicePath;
- PCI_DEVICE_PATH PciDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
-
-STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mPciRootComplexDevicePath = {
- {
- { ACPI_DEVICE_PATH,
- ACPI_DP,
- { (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
- (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) }
- },
- EISA_PNP_ID (0x0A03),
- 0
- },
- {
- { HARDWARE_DEVICE_PATH,
- HW_PCI_DP,
- { (UINT8) (sizeof (PCI_DEVICE_PATH)),
- (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) }
- },
- 0,
- 0
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { END_DEVICE_PATH_LENGTH, 0 }
- }
-};
-
-EFI_EVENT mAcpiRegistration = NULL;
-
-/**
- * Build and Set UEFI Variable Boot####
- *
- * @param BootVariableName Name of the UEFI Variable
- * @param Attributes 'Attributes' for the Boot#### variable as per UEFI spec
- * @param BootDescription Description of the Boot#### variable
- * @param DevicePath EFI Device Path of the EFI Application to boot
- * @param OptionalData Parameters to pass to the EFI application
- * @param OptionalDataSize Size of the parameters to pass to the EFI application
- *
- * @return EFI_OUT_OF_RESOURCES A memory allocation failed
- * @return Return value of RT.SetVariable
- */
-STATIC
-EFI_STATUS
-BootOptionCreate (
- IN CHAR16 BootVariableName[9],
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN UINT8* OptionalData,
- IN UINTN OptionalDataSize
- )
-{
- UINTN VariableSize;
- UINT8 *Variable;
- UINT8 *VariablePtr;
- UINTN FilePathListLength;
- UINTN BootDescriptionSize;
-
- FilePathListLength = GetDevicePathSize (DevicePath);
- BootDescriptionSize = StrSize (BootDescription);
-
- // Each Boot#### variable is built as follow:
- // UINT32 Attributes
- // UINT16 FilePathListLength
- // CHAR16* Description
- // EFI_DEVICE_PATH_PROTOCOL FilePathList[]
- // UINT8 OptionalData[]
- VariableSize = sizeof (UINT32) + sizeof (UINT16) +
- BootDescriptionSize + FilePathListLength + OptionalDataSize;
- Variable = AllocateZeroPool (VariableSize);
- if (Variable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- // 'Attributes' field
- *(UINT32*)Variable = Attributes;
- // 'FilePathListLength' field
- VariablePtr = Variable + sizeof (UINT32);
- *(UINT16*)VariablePtr = FilePathListLength;
- // 'Description' field
- VariablePtr += sizeof (UINT16);
- CopyMem (VariablePtr, BootDescription, BootDescriptionSize);
- // 'FilePathList' field
- VariablePtr += BootDescriptionSize;
- CopyMem (VariablePtr, DevicePath, FilePathListLength);
- // 'OptionalData' field
- VariablePtr += FilePathListLength;
- CopyMem (VariablePtr, OptionalData, OptionalDataSize);
-
- return gRT->SetVariable (
- BootVariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableSize, Variable
- );
-}
-
-/**
- Notification function of the event defined as belonging to the
- EFI_END_OF_DXE_EVENT_GROUP_GUID event group that was created in
- the entry point of the driver.
-
- This function is called when an event belonging to the
- EFI_END_OF_DXE_EVENT_GROUP_GUID event group is signalled. Such an
- event is signalled once at the end of the dispatching of all
- drivers (end of the so called DXE phase).
-
- @param[in] Event Event declared in the entry point of the driver whose
- notification function is being invoked.
- @param[in] Context NULL
-**/
-STATIC
-VOID
-OnEndOfDxe (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_DEVICE_PATH_PROTOCOL* PciRootComplexDevicePath;
- EFI_HANDLE Handle;
- EFI_STATUS Status;
-
- //
- // PCI Root Complex initialization
- // At the end of the DXE phase, we should get all the driver dispatched.
- // Force the PCI Root Complex to be initialized. It allows the OS to skip
- // this step.
- //
- PciRootComplexDevicePath = (EFI_DEVICE_PATH_PROTOCOL*) &mPciRootComplexDevicePath;
- Status = gBS->LocateDevicePath (&gEfiPciRootBridgeIoProtocolGuid,
- &PciRootComplexDevicePath,
- &Handle);
-
- Status = gBS->ConnectController (Handle, NULL, PciRootComplexDevicePath, FALSE);
- ASSERT_EFI_ERROR (Status);
-}
-
-STATIC
-BOOLEAN
-AcpiTableJunoR0Check (
- IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader
- )
-{
- return TRUE;
-}
-
-STATIC
-BOOLEAN
-AcpiTableJunoR1Check (
- IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader
- )
-{
- return TRUE;
-}
-
-EFI_STATUS
-EFIAPI
-ArmJunoEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS HypBase;
- CHAR16 *TextDevicePath;
- UINTN TextDevicePathSize;
- VOID *Buffer;
- UINT32 Midr;
- UINT32 CpuType;
- UINT32 CpuRev;
- JUNO_REVISION JunoRevision;
- EFI_EVENT EndOfDxeEvent;
-
- JunoRevision = UNKNOWN;
- Status = PciEmulationEntryPoint ();
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // If a hypervisor has been declared then we need to make sure its region is protected at runtime
- //
- // Note: This code is only a workaround for our dummy hypervisor (ArmPkg/Extra/AArch64ToAArch32Shim/)
- // that does not set up (yet) the stage 2 translation table to hide its own memory to EL1.
- //
- if (FixedPcdGet32 (PcdHypFvSize) != 0) {
- // Ensure the hypervisor region is strictly contained into a EFI_PAGE_SIZE-aligned region.
- // The memory must be a multiple of EFI_PAGE_SIZE to ensure we do not reserve more memory than the hypervisor itself.
- // A UEFI Runtime region size granularity cannot be smaller than EFI_PAGE_SIZE. If the hypervisor size is not rounded
- // to this size then there is a risk some non-runtime memory could be visible to the OS view.
- if (((FixedPcdGet32 (PcdHypFvSize) & EFI_PAGE_MASK) == 0) && ((FixedPcdGet32 (PcdHypFvBaseAddress) & EFI_PAGE_MASK) == 0)) {
- // The memory needs to be declared because the DXE core marked it as reserved and removed it from the memory space
- // as it contains the Firmware.
- Status = gDS->AddMemorySpace (
- EfiGcdMemoryTypeSystemMemory,
- FixedPcdGet32 (PcdHypFvBaseAddress), FixedPcdGet32 (PcdHypFvSize),
- EFI_MEMORY_WB | EFI_MEMORY_RUNTIME
- );
- if (!EFI_ERROR (Status)) {
- // We allocate the memory to ensure it is marked as runtime memory
- HypBase = FixedPcdGet32 (PcdHypFvBaseAddress);
- Status = gBS->AllocatePages (AllocateAddress, EfiRuntimeServicesCode,
- EFI_SIZE_TO_PAGES (FixedPcdGet32 (PcdHypFvSize)), &HypBase);
- }
- } else {
- // The hypervisor must be contained into a EFI_PAGE_SIZE-aligned region and its size must also be aligned
- // on a EFI_PAGE_SIZE boundary (ie: 4KB).
- Status = EFI_UNSUPPORTED;
- ASSERT_EFI_ERROR (Status);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Create an event belonging to the "gEfiEndOfDxeEventGroupGuid" group.
- // The "OnEndOfDxe()" function is declared as the call back function.
- // It will be called at the end of the DXE phase when an event of the
- // same group is signalled to inform about the end of the DXE phase.
- // Install the INSTALL_FDT_PROTOCOL protocol.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- OnEndOfDxe,
- NULL,
- &gEfiEndOfDxeEventGroupGuid,
- &EndOfDxeEvent
- );
-
- // Install dynamic Shell command to run baremetal binaries.
- Status = ShellDynCmdRunAxfInstall (ImageHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "ArmJunoDxe: Failed to install ShellDynCmdRunAxf\n"));
- }
-
- //
- // We detect whether we are running on a Juno r0 or Juno r1 board at
- // runtime by checking the value of the MIDR register.
- //
-
- Midr = ArmReadMidr ();
- CpuType = (Midr >> ARM_CPU_TYPE_SHIFT) & ARM_CPU_TYPE_MASK;
- CpuRev = Midr & ARM_CPU_REV_MASK;
-
- switch (CpuType) {
- case ARM_CPU_TYPE_A53:
- if (CpuRev == ARM_CPU_REV (0, 0)) {
- JunoRevision = JUNO_R0;
- } else if (CpuRev == ARM_CPU_REV (0, 3)) {
- JunoRevision = JUNO_R1;
- }
- break;
-
- case ARM_CPU_TYPE_A57:
- if (CpuRev == ARM_CPU_REV (0, 0)) {
- JunoRevision = JUNO_R0;
- } else if (CpuRev == ARM_CPU_REV (1, 1)) {
- JunoRevision = JUNO_R1;
- }
- }
-
- //
- // Try to install the ACPI Tables
- //
- if (JunoRevision == JUNO_R0) {
- Status = LocateAndInstallAcpiFromFvConditional (&mJunoAcpiTableFile, AcpiTableJunoR0Check);
- } else if (JunoRevision == JUNO_R1) {
- Status = LocateAndInstallAcpiFromFvConditional (&mJunoAcpiTableFile, AcpiTableJunoR1Check);
- }
- ASSERT_EFI_ERROR (Status);
-
-
- //
- // Set the R1 two boot options if not already done.
- //
- if (JunoRevision == JUNO_R1) {
- Status = SetJunoR1DefaultBootEntries ();
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Enable PCI enumeration
- PcdSetBool (PcdPciDisableBusEnumeration, FALSE);
-
- // Declare the related ACPI Tables
- EfiCreateProtocolNotifyEvent (
- &gEfiAcpiTableProtocolGuid,
- TPL_CALLBACK,
- AcpiPciNotificationEvent,
- NULL,
- &mAcpiRegistration
- );
- }
-
- //
- // Set up the device path to the FDT.
- //
- switch (JunoRevision) {
- case JUNO_R0:
- TextDevicePath = (CHAR16*)FixedPcdGetPtr (PcdJunoR0FdtDevicePath);
- break;
-
- case JUNO_R1:
- TextDevicePath = (CHAR16*)FixedPcdGetPtr (PcdJunoR1A57x2FdtDevicePath);
- break;
-
- default:
- TextDevicePath = NULL;
- }
-
- if (TextDevicePath != NULL) {
- TextDevicePathSize = StrSize (TextDevicePath);
- Buffer = PcdSetPtr (PcdFdtDevicePaths, &TextDevicePathSize, TextDevicePath);
- Status = (Buffer != NULL) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;
- } else {
- Status = EFI_NOT_FOUND;
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG (
- (EFI_D_ERROR,
- "ArmJunoDxe: Setting of FDT device path in PcdFdtDevicePaths failed - %r\n", Status)
- );
- return Status;
- }
-
- return Status;
-}
-
-/**
- * If no boot entry is currently defined, define the two default boot entries
- * for Juno R1.
- *
- * @return EFI_SUCCESS Some boot entries were already defined or
- * the default boot entries were set successfully.
- * @return EFI_OUT_OF_RESOURCES A memory allocation failed.
- * @return EFI_DEVICE_ERROR An UEFI variable could not be saved due to a hardware failure.
- * @return EFI_WRITE_PROTECTED An UEFI variable is read-only.
- * @return EFI_SECURITY_VIOLATION An UEFI variable could not be written.
- */
-STATIC
-EFI_STATUS
-SetJunoR1DefaultBootEntries (
- VOID
- )
-{
- EFI_STATUS Status;
- CONST CHAR16* ExtraBootArgument = L" dtb=r1a57a53.dtb";
- UINTN Size;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
- EFI_DEVICE_PATH* BootDevicePath;
- UINT32 SysPciGbeL;
- UINT32 SysPciGbeH;
- CHAR16* DefaultBootArgument;
- CHAR16* DefaultBootArgument1;
- UINTN DefaultBootArgument1Size;
- CHAR16* DefaultBootArgument2;
- UINTN DefaultBootArgument2Size;
- UINT16 BootOrder[2];
-
- BootDevicePath = NULL;
- DefaultBootArgument1 = NULL;
- DefaultBootArgument2 = NULL;
-
- //
- // Because the driver has a dependency on gEfiVariable(Write)ArchProtocolGuid
- // (see [Depex] section of the INF file), we know we can safely access the
- // UEFI Variable at that stage.
- //
- Size = 0;
- Status = gRT->GetVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &Size, NULL);
- if (Status != EFI_NOT_FOUND) {
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (
- &gEfiDevicePathFromTextProtocolGuid,
- NULL,
- (VOID **)&EfiDevicePathFromTextProtocol
- );
- if (EFI_ERROR (Status)) {
- //
- // You must provide an implementation of DevicePathFromTextProtocol
- // in your firmware (eg: DevicePathDxe)
- //
- DEBUG ((EFI_D_ERROR, "Error: Require DevicePathFromTextProtocol\n"));
- return Status;
- }
- //
- // We use the same default kernel.
- //
- BootDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (
- (CHAR16*)PcdGetPtr (PcdDefaultBootDevicePath)
- );
- if (BootDevicePath == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- DefaultBootArgument = (CHAR16*)PcdGetPtr (PcdDefaultBootArgument);
- DefaultBootArgument1Size = StrSize (DefaultBootArgument) +
- (SKY2_MAC_ADDRESS_BOOTARG_LEN * sizeof (CHAR16));
- DefaultBootArgument2Size = DefaultBootArgument1Size + StrSize (ExtraBootArgument);
-
- Status = EFI_OUT_OF_RESOURCES;
- DefaultBootArgument1 = AllocatePool (DefaultBootArgument1Size);
- if (DefaultBootArgument1 == NULL) {
- goto Error;
- }
- DefaultBootArgument2 = AllocatePool (DefaultBootArgument2Size);
- if (DefaultBootArgument2 == NULL) {
- goto Error;
- }
-
- SysPciGbeL = MmioRead32 (ARM_JUNO_SYS_PCIGBE_L);
- SysPciGbeH = MmioRead32 (ARM_JUNO_SYS_PCIGBE_H);
-
- UnicodeSPrint (
- DefaultBootArgument1,
- DefaultBootArgument1Size,
- L"%s sky2.mac_address=0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x",
- DefaultBootArgument,
- (SysPciGbeH >> 8 ) & 0xFF, (SysPciGbeH ) & 0xFF,
- (SysPciGbeL >> 24) & 0xFF, (SysPciGbeL >> 16) & 0xFF,
- (SysPciGbeL >> 8 ) & 0xFF, (SysPciGbeL ) & 0xFF
- );
-
- CopyMem (DefaultBootArgument2, DefaultBootArgument1, DefaultBootArgument1Size);
- CopyMem (
- (UINT8*)DefaultBootArgument2 + DefaultBootArgument1Size - sizeof (CHAR16),
- ExtraBootArgument,
- StrSize (ExtraBootArgument)
- );
-
- //
- // Create Boot0001 environment variable
- //
- Status = BootOptionCreate (
- L"Boot0001", LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
- L"Linux with A57x2", BootDevicePath,
- (UINT8*)DefaultBootArgument1, DefaultBootArgument1Size
- );
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- goto Error;
- }
-
- //
- // Create Boot0002 environment variable
- //
- Status = BootOptionCreate (
- L"Boot0002", LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
- L"Linux with A57x2_A53x4", BootDevicePath,
- (UINT8*)DefaultBootArgument2, DefaultBootArgument2Size
- );
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- goto Error;
- }
-
- //
- // Add the new Boot Index to the list
- //
- BootOrder[0] = 1; // Boot0001
- BootOrder[1] = 2; // Boot0002
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (BootOrder),
- BootOrder
- );
-
-Error:
- if (BootDevicePath != NULL) {
- FreePool (BootDevicePath);
- }
- if (DefaultBootArgument1 != NULL) {
- FreePool (DefaultBootArgument1);
- }
- if (DefaultBootArgument2 != NULL) {
- FreePool (DefaultBootArgument2);
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG ((
- EFI_D_ERROR,
- "ArmJunoDxe - The setting of the default boot entries failed - %r\n",
- Status
- ));
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
deleted file mode 100644
index 6157f9807f..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmJunoDxe
- FILE_GUID = 1484ebe8-2681-45f1-a2e5-12ecad893b62
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = ArmJunoEntryPoint
-
-[Sources.common]
- AcpiTables.c
- ArmJunoDxe.c
- PciEmulation.c
- PciRootBridgeIo.c
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- AcpiLib
- ArmLib
- ArmShellCmdRunAxfLib
- BaseMemoryLib
- BdsLib
- DebugLib
- DmaLib
- DxeServicesTableLib
- IoLib
- PcdLib
- PrintLib
- SerialPortLib
- UefiBootServicesTableLib
- UefiRuntimeServicesTableLib
- UefiLib
- UefiDriverEntryPoint
-
-[Guids]
- gArmGlobalVariableGuid
- gEfiEndOfDxeEventGroupGuid
- gEfiFileInfoGuid
-
-[Protocols]
- gEfiBlockIoProtocolGuid
- gEfiDevicePathFromTextProtocolGuid
- gEfiPciIoProtocolGuid
- gEfiPciRootBridgeIoProtocolGuid
- gEfiSimpleFileSystemProtocolGuid
- gEfiAcpiTableProtocolGuid
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdHypFvBaseAddress
- gArmTokenSpaceGuid.PcdHypFvSize
-
- gArmJunoTokenSpaceGuid.PcdSynopsysUsbEhciBaseAddress
- gArmJunoTokenSpaceGuid.PcdSynopsysUsbOhciBaseAddress
-
- gArmJunoTokenSpaceGuid.PcdJunoR0FdtDevicePath
- gArmJunoTokenSpaceGuid.PcdJunoR1A57x2FdtDevicePath
- gArmJunoTokenSpaceGuid.PcdJunoR1A57x2A53x4FdtDevicePath
-
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument
-
- # PCI Root complex specific PCDs
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress
- gArmPlatformTokenSpaceGuid.PcdPciBusMin
- gArmPlatformTokenSpaceGuid.PcdPciBusMax
-
-[Pcd]
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths
- gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
-
-[Depex]
- # We depend on these protocols to create the default boot entries
- gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h
deleted file mode 100644
index 662c41377f..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_JUNO_DXE_INTERNAL_H__
-#define __ARM_JUNO_DXE_INTERNAL_H__
-
-#include <Uefi.h>
-
-#include <Library/BaseLib.h>
-#include <Library/ArmLib.h>
-#include <Library/AcpiLib.h>
-#include <Library/DebugLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include <Protocol/AcpiTable.h>
-
-#include <IndustryStandard/Acpi.h>
-
-EFI_STATUS
-PciEmulationEntryPoint (
- VOID
- );
-
-/**
- * Callback called when ACPI Protocol is installed
- */
-VOID
-AcpiPciNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-#endif // __ARM_JUNO_DXE_INTERNAL_H__
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.c
deleted file mode 100644
index 2ddebf606e..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.c
+++ /dev/null
@@ -1,596 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2013 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "PciEmulation.h"
-
-#define HOST_CONTROLLER_OPERATION_REG_SIZE 0x44
-
-typedef struct {
- ACPI_HID_DEVICE_PATH AcpiDevicePath;
- PCI_DEVICE_PATH PciDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} EFI_PCI_IO_DEVICE_PATH;
-
-typedef struct {
- UINT32 Signature;
- EFI_PCI_IO_DEVICE_PATH DevicePath;
- EFI_PCI_IO_PROTOCOL PciIoProtocol;
- PCI_TYPE00 *ConfigSpace;
- PCI_ROOT_BRIDGE RootBridge;
- UINTN Segment;
-} EFI_PCI_IO_PRIVATE_DATA;
-
-#define EFI_PCI_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32('p', 'c', 'i', 'o')
-#define EFI_PCI_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, EFI_PCI_IO_PRIVATE_DATA, PciIoProtocol, EFI_PCI_IO_PRIVATE_DATA_SIGNATURE)
-
-EFI_PCI_IO_DEVICE_PATH PciIoDevicePathTemplate =
-{
- {
- { ACPI_DEVICE_PATH, ACPI_DP, { sizeof (ACPI_HID_DEVICE_PATH), 0 } },
- EISA_PNP_ID(0x0A03), // HID
- 0 // UID
- },
- {
- { HARDWARE_DEVICE_PATH, HW_PCI_DP, { sizeof (PCI_DEVICE_PATH), 0 } },
- 0,
- 0
- },
- { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0} }
-};
-
-STATIC
-VOID
-ConfigureUSBHost (
- VOID
- )
-{
-}
-
-
-EFI_STATUS
-PciIoPollMem (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-PciIoPollIo (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-PciIoMemRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);
-
- return PciRootBridgeIoMemRead (&Private->RootBridge.Io,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Private->ConfigSpace->Device.Bar[BarIndex] + Offset, //Fix me ConfigSpace
- Count,
- Buffer
- );
-}
-
-EFI_STATUS
-PciIoMemWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);
-
- return PciRootBridgeIoMemWrite (&Private->RootBridge.Io,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Private->ConfigSpace->Device.Bar[BarIndex] + Offset, //Fix me ConfigSpace
- Count,
- Buffer
- );
-}
-
-EFI_STATUS
-PciIoIoRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-PciIoIoWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-/**
- Enable a PCI driver to read PCI controller registers in PCI configuration space.
-
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param[in] Width Signifies the width of the memory operations.
- @param[in] Offset The offset within the PCI configuration space for
- the PCI controller.
- @param[in] Count The number of PCI configuration operations to
- perform. Bytes moved is Width size * Count,
- starting at Offset.
-
- @param[in out] Buffer The destination buffer to store the results.
-
- @retval EFI_SUCCESS The data was read from the PCI controller.
- @retval EFI_INVALID_PARAMETER "Width" is invalid.
- @retval EFI_INVALID_PARAMETER "Buffer" is NULL.
-
-**/
-EFI_STATUS
-PciIoPciRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);
- EFI_STATUS Status;
-
- if ((Width < 0) || (Width >= EfiPciIoWidthMaximum) || (Buffer == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciRootBridgeIoMemRW (
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH)Width,
- Count,
- TRUE,
- (PTR)(UINTN)Buffer,
- TRUE,
- (PTR)(UINTN)(((UINT8 *)Private->ConfigSpace) + Offset) //Fix me ConfigSpace
- );
-
- return Status;
-}
-
-/**
- Enable a PCI driver to write PCI controller registers in PCI configuration space.
-
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param[in] Width Signifies the width of the memory operations.
- @param[in] Offset The offset within the PCI configuration space for
- the PCI controller.
- @param[in] Count The number of PCI configuration operations to
- perform. Bytes moved is Width size * Count,
- starting at Offset.
-
- @param[in out] Buffer The source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from the PCI controller.
- @retval EFI_INVALID_PARAMETER "Width" is invalid.
- @retval EFI_INVALID_PARAMETER "Buffer" is NULL.
-
-**/
-EFI_STATUS
-PciIoPciWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if ((Width < 0) || (Width >= EfiPciIoWidthMaximum) || (Buffer == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- return PciRootBridgeIoMemRW ((EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Count,
- TRUE,
- (PTR)(UINTN)(((UINT8 *)Private->ConfigSpace) + Offset), //Fix me ConfigSpace
- TRUE,
- (PTR)(UINTN)Buffer
- );
-}
-
-EFI_STATUS
-PciIoCopyMem (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 DestBarIndex,
- IN UINT64 DestOffset,
- IN UINT8 SrcBarIndex,
- IN UINT64 SrcOffset,
- IN UINTN Count
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-PciIoMap (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- )
-{
- DMA_MAP_OPERATION DmaOperation;
-
- if (Operation == EfiPciIoOperationBusMasterRead) {
- DmaOperation = MapOperationBusMasterRead;
- } else if (Operation == EfiPciIoOperationBusMasterWrite) {
- DmaOperation = MapOperationBusMasterWrite;
- } else if (Operation == EfiPciIoOperationBusMasterCommonBuffer) {
- DmaOperation = MapOperationBusMasterCommonBuffer;
- } else {
- return EFI_INVALID_PARAMETER;
- }
- return DmaMap (DmaOperation, HostAddress, NumberOfBytes, DeviceAddress, Mapping);
-}
-
-EFI_STATUS
-PciIoUnmap (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN VOID *Mapping
- )
-{
- return DmaUnmap (Mapping);
-}
-
-/**
- Allocate pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
- mapping.
-
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param[in] Type This parameter is not used and must be ignored.
- @param[in] MemoryType The type of memory to allocate, EfiBootServicesData or
- EfiRuntimeServicesData.
- @param[in] Pages The number of pages to allocate.
- @param[out] HostAddress A pointer to store the base system memory address of
- the allocated range.
- @param[in] Attributes The requested bit mask of attributes for the allocated
- range. Only the attributes,
- EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE and
- EFI_PCI_ATTRIBUTE_MEMORY_CACHED may be used with this
- function. If any other bits are set, then EFI_UNSUPPORTED
- is returned. This function ignores this bit mask.
-
- @retval EFI_SUCCESS The requested memory pages were allocated.
- @retval EFI_INVALID_PARAMETER HostAddress is NULL.
- @retval EFI_INVALID_PARAMETER MemoryType is invalid.
- @retval EFI_UNSUPPORTED Attributes is unsupported.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
-
-**/
-EFI_STATUS
-PciIoAllocateBuffer (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress,
- IN UINT64 Attributes
- )
-{
- if (Attributes &
- (~(EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE |
- EFI_PCI_ATTRIBUTE_MEMORY_CACHED ))) {
- return EFI_UNSUPPORTED;
- }
-
- return DmaAllocateBuffer (MemoryType, Pages, HostAddress);
-}
-
-
-EFI_STATUS
-PciIoFreeBuffer (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- )
-{
- return DmaFreeBuffer (Pages, HostAddress);
-}
-
-
-EFI_STATUS
-PciIoFlush (
- IN EFI_PCI_IO_PROTOCOL *This
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- Retrieves this PCI controller's current PCI bus number, device number, and function number.
-
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param[out] SegmentNumber The PCI controller's current PCI segment number.
- @param[out] BusNumber The PCI controller's current PCI bus number.
- @param[out] DeviceNumber The PCI controller's current PCI device number.
- @param[out] FunctionNumber The PCI controller’s current PCI function number.
-
- @retval EFI_SUCCESS The PCI controller location was returned.
- @retval EFI_INVALID_PARAMETER At least one out of the four output parameters is
- a NULL pointer.
-**/
-EFI_STATUS
-PciIoGetLocation (
- IN EFI_PCI_IO_PROTOCOL *This,
- OUT UINTN *SegmentNumber,
- OUT UINTN *BusNumber,
- OUT UINTN *DeviceNumber,
- OUT UINTN *FunctionNumber
- )
-{
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if ((SegmentNumber == NULL) || (BusNumber == NULL) ||
- (DeviceNumber == NULL) || (FunctionNumber == NULL) ) {
- return EFI_INVALID_PARAMETER;
- }
-
- *SegmentNumber = Private->Segment;
- *BusNumber = 0xff;
- *DeviceNumber = 0;
- *FunctionNumber = 0;
-
- return EFI_SUCCESS;
-}
-
-/**
- Performs an operation on the attributes that this PCI controller supports.
-
- The operations include getting the set of supported attributes, retrieving
- the current attributes, setting the current attributes, enabling attributes,
- and disabling attributes.
-
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param[in] Operation The operation to perform on the attributes for this
- PCI controller.
- @param[in] Attributes The mask of attributes that are used for Set,
- Enable and Disable operations.
- @param[out] Result A pointer to the result mask of attributes that are
- returned for the Get and Supported operations. This
- is an optional parameter that may be NULL for the
- Set, Enable, and Disable operations.
-
- @retval EFI_SUCCESS The operation on the PCI controller's
- attributes was completed. If the operation
- was Get or Supported, then the attribute mask
- is returned in Result.
- @retval EFI_INVALID_PARAMETER Operation is greater than or equal to
- EfiPciIoAttributeOperationMaximum.
- @retval EFI_INVALID_PARAMETER Operation is Get and Result is NULL.
- @retval EFI_INVALID_PARAMETER Operation is Supported and Result is NULL.
-
-**/
-EFI_STATUS
-PciIoAttributes (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes,
- OUT UINT64 *Result OPTIONAL
- )
-{
- switch (Operation) {
- case EfiPciIoAttributeOperationGet:
- case EfiPciIoAttributeOperationSupported:
- if (Result == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // We are not a real PCI device so just say things we kind of do
- //
- *Result = EFI_PCI_DEVICE_ENABLE;
- break;
-
- case EfiPciIoAttributeOperationSet:
- case EfiPciIoAttributeOperationEnable:
- case EfiPciIoAttributeOperationDisable:
- if (Attributes & (~EFI_PCI_DEVICE_ENABLE)) {
- return EFI_UNSUPPORTED;
- }
- // Since we are not a real PCI device no enable/set or disable operations exist.
- return EFI_SUCCESS;
-
- default:
- return EFI_INVALID_PARAMETER;
- };
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciIoGetBarAttributes (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINT8 BarIndex,
- OUT UINT64 *Supports, OPTIONAL
- OUT VOID **Resources OPTIONAL
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-PciIoSetBarAttributes (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINT64 Attributes,
- IN UINT8 BarIndex,
- IN OUT UINT64 *Offset,
- IN OUT UINT64 *Length
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-EFI_PCI_IO_PROTOCOL PciIoTemplate =
-{
- PciIoPollMem,
- PciIoPollIo,
- { PciIoMemRead, PciIoMemWrite },
- { PciIoIoRead, PciIoIoWrite },
- { PciIoPciRead, PciIoPciWrite },
- PciIoCopyMem,
- PciIoMap,
- PciIoUnmap,
- PciIoAllocateBuffer,
- PciIoFreeBuffer,
- PciIoFlush,
- PciIoGetLocation,
- PciIoAttributes,
- PciIoGetBarAttributes,
- PciIoSetBarAttributes,
- 0,
- 0
-};
-
-EFI_STATUS
-PciInstallDevice (
- IN UINTN DeviceId,
- IN PHYSICAL_ADDRESS MemoryStart,
- IN UINT64 MemorySize,
- IN UINTN ClassCode1,
- IN UINTN ClassCode2,
- IN UINTN ClassCode3
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_PCI_IO_PRIVATE_DATA *Private;
-
- // Configure USB host
- ConfigureUSBHost ();
-
- // Create a private structure
- Private = AllocatePool (sizeof (EFI_PCI_IO_PRIVATE_DATA));
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- return Status;
- }
-
- Private->Signature = EFI_PCI_IO_PRIVATE_DATA_SIGNATURE; // Fill in signature
- Private->RootBridge.Signature = PCI_ROOT_BRIDGE_SIGNATURE; // Fake Root Bridge structure needs a signature too
- Private->RootBridge.MemoryStart = MemoryStart; // Get the USB capability register base
- Private->Segment = 0; // Default to segment zero
-
- // Calculate the total size of the USB controller (OHCI + EHCI).
- Private->RootBridge.MemorySize = MemorySize; //CapabilityLength + (HOST_CONTROLLER_OPERATION_REG_SIZE + ((4 * PhysicalPorts) - 1));
-
- // Create fake PCI config space: OHCI + EHCI
- Private->ConfigSpace = AllocateZeroPool (sizeof (PCI_TYPE00));
- if (Private->ConfigSpace == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- FreePool (Private);
- return Status;
- }
-
- //
- // Configure PCI config space: OHCI + EHCI
- //
- Private->ConfigSpace->Hdr.VendorId = 0xFFFF; // Invalid vendor Id as it is not an actual device.
- Private->ConfigSpace->Hdr.DeviceId = 0x0000; // Not relevant as the vendor id is not valid.
- Private->ConfigSpace->Hdr.ClassCode[0] = ClassCode1;
- Private->ConfigSpace->Hdr.ClassCode[1] = ClassCode2;
- Private->ConfigSpace->Hdr.ClassCode[2] = ClassCode3;
- Private->ConfigSpace->Device.Bar[0] = MemoryStart;
-
- Handle = NULL;
-
- // Unique device path.
- CopyMem (&Private->DevicePath, &PciIoDevicePathTemplate, sizeof (PciIoDevicePathTemplate));
- Private->DevicePath.AcpiDevicePath.UID = 1; // Use '1' to differentiate from PLDA root complex
- Private->DevicePath.PciDevicePath.Device = DeviceId;
-
- // Copy protocol structure
- CopyMem (&Private->PciIoProtocol, &PciIoTemplate, sizeof (PciIoTemplate));
-
- Status = gBS->InstallMultipleProtocolInterfaces (&Handle,
- &gEfiPciIoProtocolGuid, &Private->PciIoProtocol,
- &gEfiDevicePathProtocolGuid, &Private->DevicePath,
- NULL);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "PciEmulationEntryPoint InstallMultipleProtocolInterfaces () failed.\n"));
- }
-
- return Status;
-}
-
-EFI_STATUS
-PciEmulationEntryPoint (
- VOID
- )
-{
- EFI_STATUS Status;
-
- Status = PciInstallDevice (0, FixedPcdGet32 (PcdSynopsysUsbOhciBaseAddress), SIZE_64KB, PCI_IF_OHCI, PCI_CLASS_SERIAL_USB, PCI_CLASS_SERIAL);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "PciEmulation: failed to install OHCI device.\n"));
- }
-
- Status = PciInstallDevice (1, FixedPcdGet32 (PcdSynopsysUsbEhciBaseAddress), SIZE_64KB, PCI_IF_EHCI, PCI_CLASS_SERIAL_USB, PCI_CLASS_SERIAL);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "PciEmulation: failed to install EHCI device.\n"));
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.h b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.h
deleted file mode 100644
index de2855d01d..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciEmulation.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2013 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _PCI_ROOT_BRIDGE_H_
-#define _PCI_ROOT_BRIDGE_H_
-
-#include <PiDxe.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PciLib.h>
-#include <Library/UefiLib.h>
-#include <Library/DmaLib.h>
-
-#include <Protocol/EmbeddedExternalDevice.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/PciIo.h>
-#include <Protocol/PciRootBridgeIo.h>
-#include <Protocol/PciHostBridgeResourceAllocation.h>
-
-#include <IndustryStandard/Pci23.h>
-
-#include "ArmJunoDxeInternal.h"
-
-#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL
-#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL
-#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
-
-
-typedef struct {
- ACPI_HID_DEVICE_PATH AcpiDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
-
-
-#define ACPI_CONFIG_IO 0
-#define ACPI_CONFIG_MMIO 1
-#define ACPI_CONFIG_BUS 2
-
-typedef struct {
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR Desc[3];
- EFI_ACPI_END_TAG_DESCRIPTOR EndDesc;
-} ACPI_CONFIG_INFO;
-
-
-#define PCI_ROOT_BRIDGE_SIGNATURE SIGNATURE_32 ('P', 'c', 'i', 'F')
-
-typedef struct {
- UINT32 Signature;
- EFI_HANDLE Handle;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;
- EFI_PCI_ROOT_BRIDGE_DEVICE_PATH DevicePath;
-
- UINT8 StartBus;
- UINT8 EndBus;
- UINT16 Type;
- UINT32 MemoryStart;
- UINT32 MemorySize;
- UINTN IoOffset;
- UINT32 IoStart;
- UINT32 IoSize;
- UINT64 PciAttributes;
-
- ACPI_CONFIG_INFO *Config;
-
-} PCI_ROOT_BRIDGE;
-
-
-#define INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(a) CR (a, PCI_ROOT_BRIDGE, Io, PCI_ROOT_BRIDGE_SIGNATURE)
-
-
-typedef union {
- UINT8 volatile *Buffer;
- UINT8 volatile *Ui8;
- UINT16 volatile *Ui16;
- UINT32 volatile *Ui32;
- UINT64 volatile *Ui64;
- UINTN volatile Ui;
-} PTR;
-
-
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoPollMem (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoPollIo (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoMemRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoMemWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoIoRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoIoWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoCopyMem (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 DestAddress,
- IN UINT64 SrcAddress,
- IN UINTN Count
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoPciRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoPciWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoMap (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoUnmap (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN VOID *Mapping
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoAllocateBuffer (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress,
- IN UINT64 Attributes
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoFreeBuffer (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN UINTN Pages,
- OUT VOID *HostAddress
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoFlush (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoGetAttributes (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- OUT UINT64 *Supported,
- OUT UINT64 *Attributes
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoSetAttributes (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN UINT64 Attributes,
- IN OUT UINT64 *ResourceBase,
- IN OUT UINT64 *ResourceLength
- );
-
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoConfiguration (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- OUT VOID **Resources
- );
-
-//
-// Private Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoMemRW (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN BOOLEAN InStrideFlag,
- IN PTR In,
- IN BOOLEAN OutStrideFlag,
- OUT PTR Out
- );
-
-BOOLEAN
-PciIoMemAddressValid (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINT64 Address
- );
-
-EFI_STATUS
-EmulatePciIoForEhci (
- INTN MvPciIfMaxIf
- );
-
-#endif
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciRootBridgeIo.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciRootBridgeIo.c
deleted file mode 100644
index f1eaceff28..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/PciRootBridgeIo.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "PciEmulation.h"
-
-BOOLEAN
-PciRootBridgeMemAddressValid (
- IN PCI_ROOT_BRIDGE *Private,
- IN UINT64 Address
- )
-{
- if ((Address >= Private->MemoryStart) && (Address < (Private->MemoryStart + Private->MemorySize))) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-EFI_STATUS
-PciRootBridgeIoMemRW (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN BOOLEAN InStrideFlag,
- IN PTR In,
- IN BOOLEAN OutStrideFlag,
- OUT PTR Out
- )
-{
- UINTN Stride;
- UINTN InStride;
- UINTN OutStride;
-
- Width = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) (Width & 0x03);
- Stride = (UINTN)1 << Width;
- InStride = InStrideFlag ? Stride : 0;
- OutStride = OutStrideFlag ? Stride : 0;
-
- //
- // Loop for each iteration and move the data
- //
- switch (Width) {
- case EfiPciWidthUint8:
- for (;Count > 0; Count--, In.Buffer += InStride, Out.Buffer += OutStride) {
- *In.Ui8 = *Out.Ui8;
- }
- break;
- case EfiPciWidthUint16:
- for (;Count > 0; Count--, In.Buffer += InStride, Out.Buffer += OutStride) {
- *In.Ui16 = *Out.Ui16;
- }
- break;
- case EfiPciWidthUint32:
- for (;Count > 0; Count--, In.Buffer += InStride, Out.Buffer += OutStride) {
- *In.Ui32 = *Out.Ui32;
- }
- break;
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRootBridgeIoPciRW (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN BOOLEAN Write,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
-
- @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @param Address The base address of the memory operations.
- @param Count The number of memory operations to perform.
- @param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoMemRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- PCI_ROOT_BRIDGE *Private;
- UINTN AlignMask;
- PTR In;
- PTR Out;
-
- if ( Buffer == NULL ) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
-
- if (!PciRootBridgeMemAddressValid (Private, Address)) {
- return EFI_INVALID_PARAMETER;
- }
-
- AlignMask = (1 << (Width & 0x03)) - 1;
- if (Address & AlignMask) {
- return EFI_INVALID_PARAMETER;
- }
-
- In.Buffer = Buffer;
- Out.Buffer = (VOID *)(UINTN) Address;
-
- switch (Width) {
- case EfiPciWidthUint8:
- case EfiPciWidthUint16:
- case EfiPciWidthUint32:
- case EfiPciWidthUint64:
- return PciRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out);
-
- case EfiPciWidthFifoUint8:
- case EfiPciWidthFifoUint16:
- case EfiPciWidthFifoUint32:
- case EfiPciWidthFifoUint64:
- return PciRootBridgeIoMemRW (Width, Count, TRUE, In, FALSE, Out);
-
- case EfiPciWidthFillUint8:
- case EfiPciWidthFillUint16:
- case EfiPciWidthFillUint32:
- case EfiPciWidthFillUint64:
- return PciRootBridgeIoMemRW (Width, Count, FALSE, In, TRUE, Out);
-
- default:
- break;
- }
-
- return EFI_INVALID_PARAMETER;
-}
-
-/**
- Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
-
- @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @param Address The base address of the memory operations.
- @param Count The number of memory operations to perform.
- @param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoMemWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- PCI_ROOT_BRIDGE *Private;
- UINTN AlignMask;
- PTR In;
- PTR Out;
-
- if ( Buffer == NULL ) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
-
- if (!PciRootBridgeMemAddressValid (Private, Address)) {
- return EFI_INVALID_PARAMETER;
- }
-
- AlignMask = (1 << (Width & 0x03)) - 1;
- if (Address & AlignMask) {
- return EFI_INVALID_PARAMETER;
- }
-
- In.Buffer = (VOID *)(UINTN) Address;
- Out.Buffer = Buffer;
-
- switch (Width) {
- case EfiPciWidthUint8:
- case EfiPciWidthUint16:
- case EfiPciWidthUint32:
- case EfiPciWidthUint64:
- return PciRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out);
-
- case EfiPciWidthFifoUint8:
- case EfiPciWidthFifoUint16:
- case EfiPciWidthFifoUint32:
- case EfiPciWidthFifoUint64:
- return PciRootBridgeIoMemRW (Width, Count, FALSE, In, TRUE, Out);
-
- case EfiPciWidthFillUint8:
- case EfiPciWidthFillUint16:
- case EfiPciWidthFillUint32:
- case EfiPciWidthFillUint64:
- return PciRootBridgeIoMemRW (Width, Count, TRUE, In, FALSE, Out);
-
- default:
- break;
- }
-
- return EFI_INVALID_PARAMETER;
-}
-
-/**
- Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
-
- @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @param Address The base address of the memory operations.
- @param Count The number of memory operations to perform.
- @param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoPciRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return PciRootBridgeIoPciRW (This, FALSE, Width, Address, Count, Buffer);
-}
-
-/**
- Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
-
- @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @param Address The base address of the memory operations.
- @param Count The number of memory operations to perform.
- @param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-PciRootBridgeIoPciWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return PciRootBridgeIoPciRW (This, TRUE, Width, Address, Count, Buffer);
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.c
deleted file mode 100644
index e1a6b749e4..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/** @file
-* Pci Host Bridge support for the Xpress-RICH3 PCIe Root Complex
-*
-* Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PciHostBridge.h"
-
-#include <Guid/EventGroup.h>
-
-/**
- * PCI Root Bridge Description
- */
-typedef struct {
- UINT32 AcpiUid;
- UINT64 MemAllocAttributes;
-} PCI_ROOT_BRIDGE_DESC;
-
-PCI_ROOT_BRIDGE_DESC PciRbDescriptions = {
- 0, // AcpiUid
- PCI_MEMORY_ALLOCATION_ATTRIBUTES // MemAllocAttributes
-};
-
-/**
- * Template for PCI Host Bridge Instance
- **/
-STATIC CONST PCI_HOST_BRIDGE_INSTANCE
-gPciHostBridgeInstanceTemplate = {
- PCI_HOST_BRIDGE_SIGNATURE, //Signature
- NULL, // Handle
- NULL, // ImageHandle
- NULL, // RootBridge
- TRUE, // CanRestarted
- NULL, // CpuIo
- NULL, // Metronome
- { // ResAlloc
- PciHbRaNotifyPhase, // ResAlloc.NotifyPhase
- PciHbRaGetNextRootBridge, // ResAlloc.GetNextRootBridge
- PciHbRaGetAllocAttributes, // ResAlloc.GetAllocAttributes
- PciHbRaStartBusEnumeration, // ResAlloc.StartBusEnumeration
- PciHbRaSetBusNumbers, // ResAlloc.SetBusNumbers
- PciHbRaSubmitResources, // ResAlloc.SubmitResources
- PciHbRaGetProposedResources, // ResAlloc.GetProposedResources
- PciHbRaPreprocessController // ResAlloc.PreprocessController
- }
-};
-PCI_HOST_BRIDGE_INSTANCE* gpPciHostBridgeInstance;
-
-EFI_STATUS
-HostBridgeConstructor (
- IN OUT PCI_HOST_BRIDGE_INSTANCE** Instance,
- IN EFI_HANDLE ImageHandle
- )
-{
- EFI_STATUS Status;
- PCI_HOST_BRIDGE_INSTANCE* HostBridge;
-
- PCI_TRACE ("HostBridgeConstructor()");
-
- if (Instance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HostBridge = AllocateCopyPool (sizeof (PCI_HOST_BRIDGE_INSTANCE), &gPciHostBridgeInstanceTemplate);
- if (HostBridge == NULL) {
- PCI_TRACE ("HostBridgeConstructor(): FAIL to allocate resources");
- return EFI_OUT_OF_RESOURCES;
- }
-
- // It will also create a device handle for the PCI Host Bridge (as HostBridge->Handle == NULL)
- Status = gBS->InstallMultipleProtocolInterfaces (
- &HostBridge->Handle,
- &gEfiPciHostBridgeResourceAllocationProtocolGuid, &HostBridge->ResAlloc,
- NULL
- );
- if (EFI_ERROR (Status)) {
- PCI_TRACE ("HostBridgeConstructor(): FAIL to install resource allocator");
- FreePool (HostBridge);
- return EFI_DEVICE_ERROR;
- } else {
- PCI_TRACE ("HostBridgeConstructor(): SUCCEED to install resource allocator");
- }
-
- Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **)(&(HostBridge->CpuIo)));
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->LocateProtocol (&gEfiMetronomeArchProtocolGuid, NULL, (VOID **)(&(HostBridge->Metronome)));
- ASSERT_EFI_ERROR (Status);
-
- HostBridge->ImageHandle = ImageHandle;
-
- *Instance = HostBridge;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-HostBridgeDestructor (
- IN PCI_HOST_BRIDGE_INSTANCE* HostBridge
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- HostBridge->Handle,
- &gEfiPciHostBridgeResourceAllocationProtocolGuid, &HostBridge->ResAlloc,
- NULL
- );
-
- if (HostBridge->RootBridge) {
- PciRbDestructor (HostBridge->RootBridge);
- }
-
- FreePool (HostBridge);
-
- return Status;
-}
-
-/**
- Entry point of this driver
-
- @param ImageHandle Handle of driver image
- @param SystemTable Point to EFI_SYSTEM_TABLE
-
- @retval EFI_OUT_OF_RESOURCES Can not allocate memory resource
- @retval EFI_DEVICE_ERROR Can not install the protocol instance
- @retval EFI_SUCCESS Success to initialize the Pci host bridge.
-**/
-EFI_STATUS
-EFIAPI
-PciHostBridgeEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- PCI_TRACE ("PciHostBridgeEntryPoint()");
-
- // Creation of the PCI Host Bridge Instance
- Status = HostBridgeConstructor (&gpPciHostBridgeInstance, ImageHandle);
- if (EFI_ERROR (Status)) {
- PCI_TRACE ("PciHostBridgeEntryPoint(): ERROR: Fail to construct PCI Host Bridge.");
- return Status;
- }
-
- // Creation of the PCIe Root Bridge
- Status = PciRbConstructor (gpPciHostBridgeInstance, PciRbDescriptions.AcpiUid, PciRbDescriptions.MemAllocAttributes);
- if (EFI_ERROR (Status)) {
- PCI_TRACE ("PciHostBridgeEntryPoint(): ERROR: Fail to construct PCI Root Bridge.");
- return Status;
- }
- ASSERT (gpPciHostBridgeInstance->RootBridge->Signature == PCI_ROOT_BRIDGE_SIGNATURE);
-
- // PCI 32bit Memory Space
- Status = gDS->AddMemorySpace (
- EfiGcdMemoryTypeMemoryMappedIo,
- PCI_MEM32_BASE,
- PCI_MEM32_SIZE,
- 0
- );
-
- // PCI 64bit Memory Space
- Status = gDS->AddMemorySpace (
- EfiGcdMemoryTypeMemoryMappedIo,
- PCI_MEM64_BASE,
- PCI_MEM64_SIZE,
- 0
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciHostBridgeUnload (
- IN EFI_HANDLE ImageHandle
- )
-{
- EFI_STATUS Status;
-
- // Free Reserved memory space in GCD
- gDS->RemoveMemorySpace (PCI_MEM32_BASE, PCI_MEM32_SIZE);
- gDS->RemoveMemorySpace (PCI_MEM64_BASE, PCI_MEM64_SIZE);
-
- // Free the allocated memory
- Status = HostBridgeDestructor (gpPciHostBridgeInstance);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.h b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.h
deleted file mode 100644
index e53f4fa3a8..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridge.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/** @file
-* Header containing the structure specific to the Xpress-RICH3 PCIe Root Complex
-*
-* Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __PCIHOSTBRIDGE_H
-#define __PCIHOSTBRIDGE_H
-
-#include <PiDxe.h>
-
-#include "XPressRich3.h"
-
-#include <IndustryStandard/Pci.h>
-#include <IndustryStandard/Acpi.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/PciHostBridgeResourceAllocation.h>
-#include <Protocol/PciRootBridgeIo.h>
-#include <Protocol/PciIo.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/CpuIo2.h>
-#include <Protocol/Metronome.h>
-
-#define PCI_TRACE(txt) DEBUG((EFI_D_VERBOSE, "ARM_PCI: " txt "\n"))
-
-#define PCIE_ROOTPORT_WRITE32(Add, Val) { UINT32 Value = (UINT32)(Val); CpuIo->Mem.Write (CpuIo,EfiCpuIoWidthUint32,(UINT64)(PcdGet64 (PcdPcieRootPortBaseAddress)+(Add)),1,&Value); }
-#define PCIE_ROOTPORT_READ32(Add, Val) { CpuIo->Mem.Read (CpuIo,EfiCpuIoWidthUint32,(UINT64)(PcdGet64 (PcdPcieRootPortBaseAddress)+(Add)),1,&Val); }
-
-#define PCIE_CONTROL_WRITE32(Add, Val) { UINT32 Value = (UINT32)(Val); CpuIo->Mem.Write (CpuIo,EfiCpuIoWidthUint32,(UINT64)(PcdGet64 (PcdPcieControlBaseAddress)+(Add)),1,&Value); }
-#define PCIE_CONTROL_READ32(Add, Val) { CpuIo->Mem.Read (CpuIo,EfiCpuIoWidthUint32,(UINT64)(PcdGet64 (PcdPcieControlBaseAddress)+(Add)),1,&Val); }
-
-/**
- * PCI Root Bridge Device Path (ACPI Device Node + End Node)
- */
-typedef struct {
- ACPI_HID_DEVICE_PATH Acpi;
- EFI_DEVICE_PATH_PROTOCOL End;
-} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
-
-typedef enum {
- ResTypeIo = 0,
- ResTypeMem32,
- ResTypePMem32,
- ResTypeMem64,
- ResTypePMem64,
- ResTypeMax
-} PCI_RESOURCE_TYPE;
-
-#define ACPI_SPECFLAG_PREFETCHABLE 0x06
-#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL
-#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL
-
-typedef struct {
- UINT64 Base;
- UINT64 Length;
- UINT64 Alignment;
-} PCI_RESOURCE_ALLOC;
-
-typedef struct _PCI_HOST_BRIDGE_INSTANCE PCI_HOST_BRIDGE_INSTANCE;
-
-/**
- * PCI Root Bridge Instance structure
- **/
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
- PCI_HOST_BRIDGE_INSTANCE *HostBridge;
- //
- // Set Type of memory allocation (could be EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM
- // and EFI_PCI_HOST_BRIDGE_MEM64_DECODE).
- //
- UINT64 MemAllocAttributes;
- PCI_RESOURCE_ALLOC ResAlloc[ResTypeMax];
- UINTN BusStart;
- UINTN BusLength;
- UINT64 Supports;
- UINT64 Attributes;
- EFI_PCI_ROOT_BRIDGE_DEVICE_PATH DevicePath;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;
-} PCI_ROOT_BRIDGE_INSTANCE;
-
-/**
- * PCI Host Bridge Instance structure
- **/
-struct _PCI_HOST_BRIDGE_INSTANCE {
- UINTN Signature;
- EFI_HANDLE Handle;
- EFI_HANDLE ImageHandle;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridge;
- //
- // The enumeration cannot be restarted after the process goes into the non initial
- // enumeration phase.
- //
- BOOLEAN CanRestarted;
- EFI_CPU_IO2_PROTOCOL *CpuIo;
- EFI_METRONOME_ARCH_PROTOCOL *Metronome;
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL ResAlloc;
-};
-
-#define PCI_HOST_BRIDGE_SIGNATURE SIGNATURE_32 ('e', 'h', 's', 't')
-#define PCI_ROOT_BRIDGE_SIGNATURE SIGNATURE_32 ('e', '2', 'p', 'b')
-#define INSTANCE_FROM_RESOURCE_ALLOCATION_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)
-#define INSTANCE_FROM_ROOT_BRIDGE_IO_THIS(a) CR (a, PCI_ROOT_BRIDGE_INSTANCE, Io, PCI_ROOT_BRIDGE_SIGNATURE)
-
-/**
- * PCI Host Bridge Resource Allocator Functions
- **/
-EFI_STATUS PciHbRaNotifyPhase (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
- );
-
-EFI_STATUS PciHbRaGetNextRootBridge (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN OUT EFI_HANDLE *RootBridgeHandle
- );
-
-EFI_STATUS PciHbRaGetAllocAttributes (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- OUT UINT64 *Attributes
- );
-
-EFI_STATUS PciHbRaStartBusEnumeration (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- OUT VOID **Configuration
- );
-
-EFI_STATUS PciHbRaSetBusNumbers (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- IN VOID *Configuration
- );
-
-EFI_STATUS PciHbRaSubmitResources (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- IN VOID *Configuration
- );
-
-EFI_STATUS PciHbRaGetProposedResources (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- OUT VOID **Configuration
- );
-
-EFI_STATUS PciHbRaPreprocessController (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
- IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
- );
-
-
-/**
- * PCI Root Bridge
- **/
-EFI_STATUS PciRbPollMem (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- );
-
-EFI_STATUS PciRbPollIo (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- );
-
-EFI_STATUS PciRbMemRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS PciRbMemWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS PciRbIoRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS PciRbIoWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS PciRbPciRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS PciRbPciWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS PciRbCopyMem (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 DestAddress,
- IN UINT64 SrcAddress,
- IN UINTN Count
- );
-
-EFI_STATUS PciRbMap (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-EFI_STATUS PciRbUnMap (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN VOID *Mapping
- );
-
-EFI_STATUS PciRbAllocateBuffer (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN OUT VOID **HostAddress,
- IN UINT64 Attributes
- );
-
-EFI_STATUS PciRbFreeBuffer (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- );
-
-EFI_STATUS PciRbFlush (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
- );
-
-EFI_STATUS PciRbSetAttributes (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN UINT64 Attributes,
- IN OUT UINT64 *ResourceBase,
- IN OUT UINT64 *ResourceLength
- );
-
-EFI_STATUS PciRbGetAttributes (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- OUT UINT64 *Supports,
- OUT UINT64 *Attributes
- );
-
-EFI_STATUS PciRbConfiguration (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- OUT VOID **Resources
- );
-
-/**
- * PCI Root Bridge Functions
- **/
-EFI_STATUS
-PciRbConstructor (
- IN PCI_HOST_BRIDGE_INSTANCE *HostBridge,
- IN UINT32 PciAcpiUid,
- IN UINT64 MemAllocAttributes
- );
-
-EFI_STATUS
-PciRbDestructor (
- IN PCI_ROOT_BRIDGE_INSTANCE* RootBridge
- );
-
-EFI_STATUS
-HWPciRbInit (
- IN EFI_CPU_IO2_PROTOCOL *CpuIo
- );
-
-#endif
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf
deleted file mode 100644
index 9f526910c4..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf
+++ /dev/null
@@ -1,76 +0,0 @@
-#/** @file
-# INF file for the Xpress-RICH3 PCIe Root Complex
-#
-# Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PciHostBridge
- FILE_GUID = C62F4B20-681E-11DF-8F0D-0002A5D5C51B
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PciHostBridgeEntryPoint
- UNLOAD_IMAGE = PciHostBridgeUnload
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPkg/ArmPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- MemoryAllocationLib
- DxeServicesTableLib
- CacheMaintenanceLib
- DmaLib
-
-[Sources]
- PciHostBridge.c
- PciHostBridgeResourceAllocation.c
- PciRootBridge.c
- XPressRich3.c
-
-[Protocols]
- gEfiPciHostBridgeResourceAllocationProtocolGuid # Produced
- gEfiPciRootBridgeIoProtocolGuid # Produced
- gEfiDevicePathProtocolGuid # Produced
- gEfiCpuIo2ProtocolGuid # Consumed
- gEfiMetronomeArchProtocolGuid # Consumed
-
-[FeaturePcd]
- gArmJunoTokenSpaceGuid.PcdPciMaxPayloadFixup
-
-[Pcd.common]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmPlatformTokenSpaceGuid.PcdPciBusMin
- gArmPlatformTokenSpaceGuid.PcdPciBusMax
- gArmPlatformTokenSpaceGuid.PcdPciIoBase
- gArmPlatformTokenSpaceGuid.PcdPciIoSize
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Base
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Size
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Base
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Size
-
- gArmJunoTokenSpaceGuid.PcdPcieControlBaseAddress
- gArmJunoTokenSpaceGuid.PcdPcieRootPortBaseAddress
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceSize
-
-[Depex]
- gEfiCpuIo2ProtocolGuid AND gEfiMetronomeArchProtocolGuid
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeResourceAllocation.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeResourceAllocation.c
deleted file mode 100644
index de60db7184..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeResourceAllocation.c
+++ /dev/null
@@ -1,642 +0,0 @@
-/** @file
-* Implementation of the Pci Host Bridge Resource Allocation for the Xpress-RICH3 PCIe Root Complex
-*
-* Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PciHostBridge.h"
-
-EFI_STATUS
-PciHbRaNotifyPhase (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
- )
-{
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 AddrLen;
- UINTN BitsOfAlignment;
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
-
- PCI_TRACE ("PciHbRaNotifyPhase()");
-
- // Check RootBridge Signature
- ASSERT (HostBridgeInstance->RootBridge->Signature == PCI_ROOT_BRIDGE_SIGNATURE);
-
- // The enumeration cannot be restarted after the process has been further than the first phase
- if (Phase == EfiPciHostBridgeBeginEnumeration) {
- if (!HostBridgeInstance->CanRestarted) {
- return EFI_NOT_READY;
- }
- } else {
- HostBridgeInstance->CanRestarted = FALSE;
- }
-
- switch (Phase) {
- case EfiPciHostBridgeBeginEnumeration:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeBeginEnumeration)");
- // Resets the host bridge PCI apertures and internal data structures
- Status = HWPciRbInit (HostBridgeInstance->CpuIo);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- break;
-
- case EfiPciHostBridgeBeginBusAllocation:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeBeginBusAllocation)");
- // The bus allocation phase is about to begin
- break;
-
- case EfiPciHostBridgeEndBusAllocation:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeEndBusAllocation)");
- // The bus allocation and bus programming phase is complete. All the PCI-to-PCI bridges have been given and written back
- // a bus number range into their configuration
- break;
-
- case EfiPciHostBridgeBeginResourceAllocation:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeBeginResourceAllocation)");
- // The resource allocation phase is about to begin.
- break;
-
- case EfiPciHostBridgeAllocateResources:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeAllocateResources)");
- // Allocates resources per previously submitted requests for all the PCI root bridges. The resources have been submitted to
- // PciHbRaSubmitResources() before.
-
- RootBridgeInstance = HostBridgeInstance->RootBridge;
- if (RootBridgeInstance->ResAlloc[ResTypeIo].Length != 0) {
- BitsOfAlignment = HighBitSet64 (RootBridgeInstance->ResAlloc[ResTypeIo].Alignment) + 1; // Get the number of '1' in Alignment
- AddrLen = RootBridgeInstance->ResAlloc[ResTypeIo].Length;
-
- Status = gDS->AllocateIoSpace (
- EfiGcdAllocateAnySearchBottomUp,
- EfiGcdIoTypeIo,
- BitsOfAlignment,
- AddrLen,
- &BaseAddress,
- HostBridgeInstance->ImageHandle,
- NULL
- );
- // If error then ResAlloc[n].Base ==0
- if (!EFI_ERROR (Status)) {
- RootBridgeInstance->ResAlloc[ResTypeIo].Base = (UINTN)BaseAddress;
- }
- }
-
- if (RootBridgeInstance->ResAlloc[ResTypeMem32].Length != 0) {
- BitsOfAlignment = HighBitSet64 (RootBridgeInstance->ResAlloc[ResTypeMem32].Alignment) + 1; // Get the number of '1' in Alignment
- AddrLen = RootBridgeInstance->ResAlloc[ResTypeMem32].Length;
-
- // Top of the 32bit PCI Memory space
- BaseAddress = FixedPcdGet64 (PcdPciMmio32Base) + FixedPcdGet64 (PcdPciMmio32Size);
-
- Status = gDS->AllocateMemorySpace (
- EfiGcdAllocateMaxAddressSearchTopDown,
- EfiGcdMemoryTypeMemoryMappedIo,
- BitsOfAlignment,
- AddrLen,
- &BaseAddress,
- HostBridgeInstance->ImageHandle,
- NULL
- );
-
- // Ensure the allocation is in the 32bit PCI memory space
- if (!EFI_ERROR (Status) && (BaseAddress >= FixedPcdGet64 (PcdPciMmio32Base))) {
- RootBridgeInstance->ResAlloc[ResTypeMem32].Base = (UINTN)BaseAddress;
- }
- }
- if (RootBridgeInstance->ResAlloc[ResTypePMem32].Length != 0) {
- BitsOfAlignment = HighBitSet64 (RootBridgeInstance->ResAlloc[ResTypePMem32].Alignment) + 1; // Get the number of '1' in Alignment
- AddrLen = RootBridgeInstance->ResAlloc[ResTypePMem32].Length;
-
- // Top of the 32bit PCI Memory space
- BaseAddress = FixedPcdGet64 (PcdPciMmio32Base) + FixedPcdGet64 (PcdPciMmio32Size);
-
- Status = gDS->AllocateMemorySpace (
- EfiGcdAllocateMaxAddressSearchTopDown,
- EfiGcdMemoryTypeMemoryMappedIo,
- BitsOfAlignment,
- AddrLen,
- &BaseAddress,
- HostBridgeInstance->ImageHandle,
- NULL
- );
-
- // Ensure the allocation is in the 32bit PCI memory space
- if (!EFI_ERROR (Status) && (BaseAddress >= FixedPcdGet64 (PcdPciMmio32Base))) {
- RootBridgeInstance->ResAlloc[ResTypePMem32].Base = (UINTN)BaseAddress;
- }
- }
- if (RootBridgeInstance->ResAlloc[ResTypeMem64].Length != 0) {
- BitsOfAlignment = HighBitSet64 (RootBridgeInstance->ResAlloc[ResTypeMem64].Alignment) + 1; // Get the number of '1' in Alignment
- AddrLen = RootBridgeInstance->ResAlloc[ResTypeMem64].Length;
-
- // Top of the 64bit PCI Memory space
- BaseAddress = FixedPcdGet64 (PcdPciMmio64Base) + FixedPcdGet64 (PcdPciMmio64Size);
-
- Status = gDS->AllocateMemorySpace (
- EfiGcdAllocateMaxAddressSearchTopDown,
- EfiGcdMemoryTypeMemoryMappedIo,
- BitsOfAlignment,
- AddrLen,
- &BaseAddress,
- HostBridgeInstance->ImageHandle,
- NULL
- );
-
- // Ensure the allocation is in the 64bit PCI memory space
- if (!EFI_ERROR (Status) && (BaseAddress >= FixedPcdGet64 (PcdPciMmio64Base))) {
- RootBridgeInstance->ResAlloc[ResTypeMem64].Base = (UINTN)BaseAddress;
- }
- }
- if (RootBridgeInstance->ResAlloc[ResTypePMem64].Length != 0) {
- BitsOfAlignment = HighBitSet64 (RootBridgeInstance->ResAlloc[ResTypePMem64].Alignment) + 1; //Get the number of '1' in Alignment
- AddrLen = RootBridgeInstance->ResAlloc[ResTypePMem64].Length;
-
- // Top of the 64bit PCI Memory space
- BaseAddress = FixedPcdGet64 (PcdPciMmio64Base) + FixedPcdGet64 (PcdPciMmio64Size);
-
- Status = gDS->AllocateMemorySpace (
- EfiGcdAllocateMaxAddressSearchTopDown,
- EfiGcdMemoryTypeMemoryMappedIo,
- BitsOfAlignment,
- AddrLen,
- &BaseAddress,
- HostBridgeInstance->ImageHandle,
- NULL
- );
-
- // Ensure the allocation is in the 64bit PCI memory space
- if (!EFI_ERROR (Status) && (BaseAddress >= FixedPcdGet64 (PcdPciMmio64Base))) {
- RootBridgeInstance->ResAlloc[ResTypePMem64].Base = (UINTN)BaseAddress;
- }
- }
-
- break;
-
- case EfiPciHostBridgeSetResources:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeSetResources)");
- // Programs the host bridge hardware to decode previously allocated resources (proposed resources)
- // for all the PCI root bridges. The PCI bus driver will now program the resources
- break;
-
- case EfiPciHostBridgeFreeResources:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeFreeResources)");
- // Deallocates resources that were previously allocated for all the PCI root bridges and resets the
- // I/O and memory apertures to their initial state.*/
- break;
-
- case EfiPciHostBridgeEndResourceAllocation:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeEndResourceAllocation)");
- break;
-
- case EfiPciHostBridgeEndEnumeration:
- PCI_TRACE ("PciHbRaNotifyPhase(EfiPciHostBridgeEndEnumeration)");
- break;
-
- default:
- DEBUG ((EFI_D_INFO, "PciHbRaNotifyPhase(Phase:%d)\n", Phase));
- ASSERT (0);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- * PciHbRaGetNextRootBridge() returns the next root bridge attached to the 'This' PCI Host Bridge.
- * As we have only got one PCI Root Bridge in this PCI interface, we return either this root bridge
- * if it the first time we call this function (*RootBridgeHandle == NULL) or we return EFI_NOT_FOUND
- **/
-EFI_STATUS
-PciHbRaGetNextRootBridge (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN OUT EFI_HANDLE *RootBridgeHandle
- )
-{
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
-
- PCI_TRACE ("PciHbRaGetNextRootBridge()");
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
- ASSERT (HostBridgeInstance->RootBridge != NULL);
-
- //Check RootBridge Signature
- ASSERT (HostBridgeInstance->RootBridge->Signature == PCI_ROOT_BRIDGE_SIGNATURE);
-
- if (*RootBridgeHandle == NULL) {
- *RootBridgeHandle = HostBridgeInstance->RootBridge->Handle;
- return EFI_SUCCESS;
- } else if (*RootBridgeHandle == HostBridgeInstance->RootBridge->Handle) {
- return EFI_NOT_FOUND;
- } else {
- return EFI_INVALID_PARAMETER;
- }
-}
-
-/** PciHbRaGetAllocAttributes() returns the resource allocation attributes supported by this PCI Root Bridge.
- * A PCI Root bridge could support these types :
- * - EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM : does not support separate windows for nonprefetchable and prefetchable memory.
- * - EFI_PCI_HOST_BRIDGE_MEM64_DECODE : supports 64-bit memory windows
- **/
-EFI_STATUS
-PciHbRaGetAllocAttributes (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- OUT UINT64 *Attributes
- )
-{
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
-
- PCI_TRACE ("PciHbRaGetAllocAttributes()");
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
-
- // Check if the RootBridgeHandle is the one managed by this PCI Host Bridge
- ASSERT (HostBridgeInstance->RootBridge != NULL);
- if (HostBridgeInstance->RootBridge->Handle != RootBridgeHandle) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Attributes = HostBridgeInstance->RootBridge->MemAllocAttributes;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciHbRaStartBusEnumeration (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- OUT VOID **Configuration
- )
-{
- VOID *Buffer;
- UINT8 *Ptr;
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
-
- // Fill an ACPI descriptor table with the Bus Number Range. This information will be used by the PCI Bus driver
- // to set bus numbers to PCI-to-PCI bridge.
- PCI_TRACE ("PciHbRaStartBusEnumeration()");
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
-
- Buffer = AllocateZeroPool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = (UINT8 *)Buffer;
-
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; // QWORD Address space Descriptor
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->Len = 0x2B; // Length of this descriptor in bytes not including the first two fields
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->ResType = ACPI_ADDRESS_SPACE_TYPE_BUS; // Resource Type Bus Number Range
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->GenFlag = 0;
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->SpecificFlag = 0;
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrSpaceGranularity = 0;
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrRangeMin = HostBridgeInstance->RootBridge->BusStart; // Bus Start
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrRangeMax = 0; // Bus Max
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrTranslationOffset = 0;
- ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrLen = FixedPcdGet32 (PcdPciBusMax) - FixedPcdGet32 (PcdPciBusMin) + 1;
-
- Ptr = Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- ((EFI_ACPI_END_TAG_DESCRIPTOR *)Ptr)->Desc = ACPI_END_TAG_DESCRIPTOR;
- ((EFI_ACPI_END_TAG_DESCRIPTOR *)Ptr)->Checksum = 0x0;
-
- *Configuration = Buffer;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciHbRaSetBusNumbers (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- IN VOID *Configuration
- )
-{
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
- UINT8 *Ptr;
- UINTN BusStart;
- UINTN BusEnd;
- UINTN BusLen;
-
- PCI_TRACE ("PciHbRaSetBusNumbers()");
-
- Ptr = Configuration;
- if (*Ptr != ACPI_ADDRESS_SPACE_DESCRIPTOR) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Check if the passed ACPI descriptor table define a Bus Number Range
- if (((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->ResType != ACPI_ADDRESS_SPACE_TYPE_BUS) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Check if the Configuration only passed one ACPI Descriptor (+ End Descriptor)
- if (*((UINT8*)(Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR))) != ACPI_END_TAG_DESCRIPTOR) {
- return EFI_INVALID_PARAMETER;
- }
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
- ASSERT (HostBridgeInstance->RootBridge != NULL);
- if (HostBridgeInstance->RootBridge->Handle != RootBridgeHandle) {
- return EFI_INVALID_PARAMETER;
- }
-
- BusStart = (UINTN)((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrRangeMin;
- BusLen = (UINTN)((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr)->AddrLen;
- BusEnd = BusStart + BusLen - 1;
-
- ASSERT (BusStart <= BusEnd); // We should at least have PCI_BUS_ROOT and PCI_SWITCH_BUS
- ASSERT ((BusStart >= HostBridgeInstance->RootBridge->BusStart) && (BusLen <= HostBridgeInstance->RootBridge->BusLength));
-
- HostBridgeInstance->RootBridge->BusStart = BusStart;
- HostBridgeInstance->RootBridge->BusLength = BusLen;
-
- return EFI_SUCCESS;
-}
-
-/**
- * This function is used to submit all the I/O and memory resources that are required by the specified
- * PCI root bridge.
- **/
-EFI_STATUS
-PciHbRaSubmitResources (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- IN VOID *Configuration
- )
-{
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- UINT8 *Ptr;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;
- PCI_RESOURCE_TYPE ResType;
-
- PCI_TRACE ("PciHbRaSubmitResources()");
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
-
- if (Configuration == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Check if the ACPI Descriptor tables is conformed
- Ptr = (UINT8 *)Configuration;
- while (*Ptr == ACPI_ADDRESS_SPACE_DESCRIPTOR) { // QWORD Address Space descriptor
- Ptr += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) ;
- }
- if (*Ptr != ACPI_END_TAG_DESCRIPTOR) { // End tag
- return EFI_INVALID_PARAMETER;
- }
-
- // Check the RootBridgeHandle
- RootBridgeInstance = HostBridgeInstance->RootBridge;
- ASSERT (RootBridgeInstance != NULL);
- if (RootBridgeHandle != HostBridgeInstance->RootBridge->Handle) {
- return EFI_INVALID_PARAMETER;
- }
-
- Ptr = (UINT8 *)Configuration;
- while ( *Ptr == ACPI_ADDRESS_SPACE_DESCRIPTOR) { // While the entry is an ACPI Descriptor Table
- Desc = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr;
-
- // Check if the description is valid
- if (Desc->AddrLen > 0xffffffff) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((Desc->AddrRangeMax >= 0xffffffff) || (Desc->AddrRangeMax != (GetPowerOfTwo64 (Desc->AddrRangeMax + 1) - 1))) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (Desc->ResType) {
- case ACPI_ADDRESS_SPACE_TYPE_MEM:
- // Check invalid Address Space Granularity
- if ((Desc->AddrSpaceGranularity != 32) && (Desc->AddrSpaceGranularity != 64)) {
- return EFI_INVALID_PARAMETER;
- }
-
- // check the memory resource request is supported by PCI root bridge
- if (RootBridgeInstance->MemAllocAttributes == EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM && Desc->SpecificFlag == 0x06) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Desc->AddrSpaceGranularity == 32) {
- if (Desc->SpecificFlag == ACPI_SPECFLAG_PREFETCHABLE) {
- ResType = ResTypePMem32;
- } else {
- ResType = ResTypeMem32;
- }
- } else {
- if (Desc->SpecificFlag == ACPI_SPECFLAG_PREFETCHABLE) {
- ResType = ResTypePMem64;
- } else {
- ResType = ResTypeMem64;
- }
- }
- RootBridgeInstance->ResAlloc[ResType].Length = Desc->AddrLen;
- RootBridgeInstance->ResAlloc[ResType].Alignment = Desc->AddrRangeMax;
- RootBridgeInstance->ResAlloc[ResType].Base = Desc->AddrRangeMin;
- break;
- case ACPI_ADDRESS_SPACE_TYPE_IO:
- RootBridgeInstance->ResAlloc[ResTypeIo].Length = Desc->AddrLen;
- RootBridgeInstance->ResAlloc[ResTypeIo].Alignment = Desc->AddrRangeMax;
- RootBridgeInstance->ResAlloc[ResTypeIo].Base = 0;
- break;
- default:
- ASSERT (0); // Could be the case Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS
- break;
- }
- Ptr += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- }
-
- return EFI_SUCCESS;
-}
-
-/** Returns the proposed resource settings for the specified PCI root bridge. The resources have been submitted by
- * PciHbRaSubmitResources() before
- **/
-EFI_STATUS
-PciHbRaGetProposedResources (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- OUT VOID **Configuration
- )
-{
- PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- UINT32 i;
- UINT32 ResAllocCount;
- VOID *Buffer;
- UINT8 *Ptr;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;
-
- PCI_TRACE ("PciHbRaGetProposedResources()");
-
- HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
-
- // Check the RootBridgeHandle
- RootBridgeInstance = HostBridgeInstance->RootBridge;
- ASSERT (RootBridgeInstance != NULL);
- if (RootBridgeHandle != HostBridgeInstance->RootBridge->Handle) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Count the number of Resource Allocated for this Root Bridge
- ResAllocCount = 0;
- for (i = 0; i < ResTypeMax; i++) {
- if (RootBridgeInstance->ResAlloc[i].Length != 0) ResAllocCount++;
- }
-
- if (ResAllocCount == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = AllocateZeroPool (ResAllocCount * sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = Buffer;
- for (i = 0; i < ResTypeMax; i++) {
- if (RootBridgeInstance->ResAlloc[i].Length != 0) { // Base != 0 if the resource has been allocated
- Desc = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Ptr;
-
- Desc->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Desc->Len = 0x2B;
- Desc->GenFlag = 0;
- Desc->AddrRangeMax = 0;
-
- switch (i) {
- case ResTypeIo:
- Desc->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;
- Desc->SpecificFlag = 0;
- Desc->AddrSpaceGranularity = 0;
- break;
- case ResTypeMem32:
- Desc->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- Desc->SpecificFlag = 0;
- Desc->AddrSpaceGranularity = 32;
- break;
- case ResTypePMem32:
- Desc->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- Desc->SpecificFlag = ACPI_SPECFLAG_PREFETCHABLE;
- Desc->AddrSpaceGranularity = 32;
- break;
- case ResTypeMem64:
- Desc->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- Desc->SpecificFlag = 0;
- Desc->AddrSpaceGranularity = 64;
- break;
- case ResTypePMem64:
- Desc->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- Desc->SpecificFlag = ACPI_SPECFLAG_PREFETCHABLE;
- Desc->AddrSpaceGranularity = 64;
- break;
- }
- Desc->AddrRangeMin = RootBridgeInstance->ResAlloc[i].Base;
- Desc->AddrTranslationOffset = (RootBridgeInstance->ResAlloc[i].Base != 0) ? EFI_RESOURCE_SATISFIED : EFI_RESOURCE_LESS;
- Desc->AddrLen = RootBridgeInstance->ResAlloc[i].Length;
- Ptr += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- }
- }
-
- ((EFI_ACPI_END_TAG_DESCRIPTOR *)Ptr)->Desc = ACPI_END_TAG_DESCRIPTOR;
- ((EFI_ACPI_END_TAG_DESCRIPTOR *)Ptr)->Checksum = 0x0;
-
- *Configuration = Buffer;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciHbRaPreprocessController (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
- IN EFI_HANDLE RootBridgeHandle,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
- IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
- )
-{
- PCI_HOST_BRIDGE_INSTANCE* HostBridge;
- PCI_ROOT_BRIDGE_INSTANCE* RootBridge;
- UINT32 CapabilityPtr;
- UINT32 CapabilityEntry;
- UINT16 CapabilityID;
- UINT32 DeviceCapability;
-
- PCI_TRACE ("PciHbRaPreprocessController()");
-
- if (FeaturePcdGet (PcdPciMaxPayloadFixup)) {
- // Do Max payload fixup for every devices
- if (Phase == EfiPciBeforeResourceCollection) {
- // Get RootBridge Instance from Host Bridge Instance
- HostBridge = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
- RootBridge = HostBridge->RootBridge;
-
- // Get the first PCI Capability
- CapabilityPtr = PCI_CAPBILITY_POINTER_OFFSET;
- RootBridge->Io.Pci.Read (
- &RootBridge->Io,
- EfiPciWidthUint8,
- EFI_PCI_ADDRESS (PciAddress.Bus, PciAddress.Device, PciAddress.Function, CapabilityPtr),
- 1,
- &CapabilityPtr
- );
- CapabilityPtr &= 0x1FF;
-
- // Get Pci Express Capability
- while (CapabilityPtr != 0) {
- RootBridge->Io.Pci.Read (
- &RootBridge->Io,
- EfiPciWidthUint16,
- EFI_PCI_ADDRESS (PciAddress.Bus, PciAddress.Device, PciAddress.Function, CapabilityPtr),
- 1,
- &CapabilityEntry
- );
-
- CapabilityID = (UINT8)CapabilityEntry;
-
- // Is PCIe capability ?
- if (CapabilityID == EFI_PCI_CAPABILITY_ID_PCIEXP) {
- // Get PCIe Device Capabilities
- RootBridge->Io.Pci.Read (
- &RootBridge->Io,
- EfiPciWidthUint32,
- EFI_PCI_ADDRESS (PciAddress.Bus, PciAddress.Device, PciAddress.Function, CapabilityPtr + 0x8),
- 1,
- &DeviceCapability
- );
-
- // Force the Max Payload to 128 Bytes (128 Bytes Max Payload Size = 0)
- DeviceCapability &= ~ ((UINT32)(0x7 << 5 ));
- // Max Read Request Size to 128 Bytes (128 Bytes Max Read Request Size = 0)
- DeviceCapability &= ~ ((UINT32)(0x7 << 12));
- // Enable all error reporting
- DeviceCapability |= 0xF;
-
- RootBridge->Io.Pci.Write (
- &RootBridge->Io,
- EfiPciWidthUint32,
- EFI_PCI_ADDRESS (PciAddress.Bus, PciAddress.Device, PciAddress.Function, CapabilityPtr + 0x8),
- 1,
- &DeviceCapability
- );
-
- return EFI_SUCCESS;
- }
- CapabilityPtr = (CapabilityEntry >> 8) & 0xFF;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciRootBridge.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciRootBridge.c
deleted file mode 100644
index 10a4575c16..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciRootBridge.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/** @file
-* Implementation of the PCI Root Bridge Protocol for XPress-RICH3 PCIe Root Complex
-*
-* Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PciHostBridge.h"
-
-#include <Library/DevicePathLib.h>
-#include <Library/DmaLib.h>
-
-#define CPUIO_FROM_ROOT_BRIDGE_INSTANCE(Instance) (Instance->HostBridge->CpuIo)
-#define METRONOME_FROM_ROOT_BRIDGE_INSTANCE(Instance) (Instance->HostBridge->Metronome)
-
-/**
- * PCI Root Bridge Instance Templates
- */
-STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH gDevicePathTemplate = {
- {
- { ACPI_DEVICE_PATH,
- ACPI_DP,
- { (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
- (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) }
- },
- EISA_PNP_ID (0x0A03),
- 0
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { END_DEVICE_PATH_LENGTH, 0 }
- }
-};
-
-STATIC CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL gIoTemplate = {
- 0,
- PciRbPollMem,
- PciRbPollIo,
- {
- PciRbMemRead,
- PciRbMemWrite
- },
- {
- PciRbIoRead,
- PciRbIoWrite
- },
- {
- PciRbPciRead,
- PciRbPciWrite
- },
- PciRbCopyMem,
- PciRbMap,
- PciRbUnMap,
- PciRbAllocateBuffer,
- PciRbFreeBuffer,
- PciRbFlush,
- PciRbGetAttributes,
- PciRbSetAttributes,
- PciRbConfiguration,
- 0
- };
-
-typedef struct {
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR SpaceDesp[ResTypeMax+1];
- EFI_ACPI_END_TAG_DESCRIPTOR EndDesp;
-} RESOURCE_CONFIGURATION;
-
-
-RESOURCE_CONFIGURATION Configuration = {
- {{ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_IO , 0, 0, 0, 0, 0, 0, 0},
- {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 32, 0, 0, 0, 0},
- {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 32, 0, 0, 0, 0},
- {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 0, 64, 0, 0, 0, 0},
- {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_MEM, 0, 6, 64, 0, 0, 0, 0},
- {ACPI_ADDRESS_SPACE_DESCRIPTOR, 0x2B, ACPI_ADDRESS_SPACE_TYPE_BUS, 0, 0, 0, 0, 255, 0, 255}},
- {ACPI_END_TAG_DESCRIPTOR, 0}
-};
-
-
-EFI_STATUS
-PciRbPollMem (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-{
- EFI_STATUS Status;
- UINT64 NumberOfTicks;
- UINT32 Remainder;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_METRONOME_ARCH_PROTOCOL *Metronome;
-
- PCI_TRACE ("PciRbPollMem()");
-
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
- Metronome = METRONOME_FROM_ROOT_BRIDGE_INSTANCE (RootBridgeInstance);
-
- if (Result == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width > EfiPciWidthUint64) {
- return EFI_INVALID_PARAMETER;
- }
-
- // No matter what, always do a single poll.
- Status = This->Mem.Read (This, Width, Address, 1, Result);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if ((*Result & Mask) == Value) {
- return EFI_SUCCESS;
- }
-
- if (Delay == 0) {
- return EFI_SUCCESS;
- }
-
- NumberOfTicks = DivU64x32Remainder (Delay, (UINT32) Metronome->TickPeriod, &Remainder);
- if (Remainder != 0) {
- NumberOfTicks += 1;
- }
- NumberOfTicks += 1;
-
- while (NumberOfTicks) {
- Metronome->WaitForTick (Metronome, 1);
-
- Status = This->Mem.Read (This, Width, Address, 1, Result);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((*Result & Mask) == Value) {
- return EFI_SUCCESS;
- }
-
- NumberOfTicks -= 1;
- }
-
- return EFI_TIMEOUT;
-}
-
-EFI_STATUS
-PciRbPollIo (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-{
- EFI_STATUS Status;
- UINT64 NumberOfTicks;
- UINT32 Remainder;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_METRONOME_ARCH_PROTOCOL *Metronome;
-
- PCI_TRACE ("PciRbPollIo()");
-
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
- Metronome = METRONOME_FROM_ROOT_BRIDGE_INSTANCE (RootBridgeInstance);
-
- if (Result == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width > EfiPciWidthUint64) {
- return EFI_INVALID_PARAMETER;
- }
-
- // No matter what, always do a single poll.
- Status = This->Io.Read (This, Width, Address, 1, Result);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if ((*Result & Mask) == Value) {
- return EFI_SUCCESS;
- }
-
- if (Delay == 0) {
- return EFI_SUCCESS;
- }
-
- NumberOfTicks = DivU64x32Remainder (Delay, (UINT32) Metronome->TickPeriod, &Remainder);
- if (Remainder != 0) {
- NumberOfTicks += 1;
- }
- NumberOfTicks += 1;
-
- while (NumberOfTicks) {
- Metronome->WaitForTick (Metronome, 1);
-
- Status = This->Io.Read (This, Width, Address, 1, Result);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((*Result & Mask) == Value) {
- return EFI_SUCCESS;
- }
-
- NumberOfTicks -= 1;
- }
-
- return EFI_TIMEOUT;
-}
-
-EFI_STATUS
-PciRbMemRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_CPU_IO2_PROTOCOL *CpuIo;
-
- PCI_TRACE ("PciRbMemRead()");
-
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
- CpuIo = CPUIO_FROM_ROOT_BRIDGE_INSTANCE (RootBridgeInstance);
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width >= EfiPciWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (((Address < PCI_MEM32_BASE) || (Address > (PCI_MEM32_BASE + PCI_MEM32_SIZE))) &&
- ((Address < PCI_MEM64_BASE) || (Address > (PCI_MEM64_BASE + PCI_MEM64_SIZE)))) {
- return EFI_INVALID_PARAMETER;
- }
-
- return CpuIo->Mem.Read (CpuIo, (EFI_CPU_IO_PROTOCOL_WIDTH)Width, Address, Count, Buffer);
-}
-
-EFI_STATUS
-PciRbMemWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_CPU_IO2_PROTOCOL *CpuIo;
-
- PCI_TRACE ("PciRbMemWrite()");
-
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
- CpuIo = CPUIO_FROM_ROOT_BRIDGE_INSTANCE (RootBridgeInstance);
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width >= EfiPciWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (((Address < PCI_MEM32_BASE) || (Address > (PCI_MEM32_BASE + PCI_MEM32_SIZE))) &&
- ((Address < PCI_MEM64_BASE) || (Address > (PCI_MEM64_BASE + PCI_MEM64_SIZE)))) {
- return EFI_INVALID_PARAMETER;
- }
-
- return CpuIo->Mem.Write (CpuIo, (EFI_CPU_IO_PROTOCOL_WIDTH)Width, Address, Count, Buffer);
-}
-
-EFI_STATUS
-PciRbIoRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- PCI_TRACE ("PciRbIoRead()");
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width >= EfiPciWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- // IO currently unsupported
- return EFI_INVALID_PARAMETER;
-}
-
-EFI_STATUS
-PciRbIoWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- PCI_TRACE ("PciRbIoWrite()");
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width >= EfiPciWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- // IO currently unsupported
- return EFI_INVALID_PARAMETER;
-}
-
-EFI_STATUS
-PciRbPciRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 EfiAddress,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- UINT32 Offset;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_CPU_IO2_PROTOCOL *CpuIo;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *EfiPciAddress;
- UINT64 Address;
-
- EfiPciAddress = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *)&EfiAddress;
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
- CpuIo = CPUIO_FROM_ROOT_BRIDGE_INSTANCE (RootBridgeInstance);
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width >= EfiPciWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiPciAddress->ExtendedRegister) {
- Offset = EfiPciAddress->ExtendedRegister;
- } else {
- Offset = EfiPciAddress->Register;
- }
-
- // The UEFI PCI enumerator scans for devices at all possible addresses,
- // and ignores some PCI rules - this results in some hardware being
- // detected multiple times. We work around this by faking absent
- // devices
- if ((EfiPciAddress->Bus == 0) && ((EfiPciAddress->Device != 0) || (EfiPciAddress->Function != 0))) {
- *((UINT32 *)Buffer) = 0xffffffff;
- return EFI_SUCCESS;
- }
- if ((EfiPciAddress->Bus == 1) && ((EfiPciAddress->Device != 0) || (EfiPciAddress->Function != 0))) {
- *((UINT32 *)Buffer) = 0xffffffff;
- return EFI_SUCCESS;
- }
-
- // Work around incorrect class ID in the root bridge
- if ((EfiPciAddress->Bus == 0) && (EfiPciAddress->Device == 0) && (EfiPciAddress->Function == 0) && (Offset == 8)) {
- *((UINT32 *)Buffer) = 0x06040001;
- return EFI_SUCCESS;
- }
-
- Address = PCI_ECAM_BASE + ((EfiPciAddress->Bus << 20) |
- (EfiPciAddress->Device << 15) |
- (EfiPciAddress->Function << 12) | Offset);
-
- if ((Address < PCI_ECAM_BASE) || (Address > PCI_ECAM_BASE + PCI_ECAM_SIZE)) {
- return EFI_INVALID_PARAMETER;
- }
-
- return CpuIo->Mem.Read (CpuIo, (EFI_CPU_IO_PROTOCOL_WIDTH)Width, Address, Count, Buffer);
-}
-
-EFI_STATUS
-PciRbPciWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 EfiAddress,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- UINT32 Offset;
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
- EFI_CPU_IO2_PROTOCOL *CpuIo;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *EfiPciAddress;
- UINT64 Address;
-
- EfiPciAddress = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *)&EfiAddress;
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
- CpuIo = CPUIO_FROM_ROOT_BRIDGE_INSTANCE (RootBridgeInstance);
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width >= EfiPciWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiPciAddress->ExtendedRegister)
- Offset = EfiPciAddress->ExtendedRegister;
- else
- Offset = EfiPciAddress->Register;
-
- Address = PCI_ECAM_BASE + ((EfiPciAddress->Bus << 20) |
- (EfiPciAddress->Device << 15) |
- (EfiPciAddress->Function << 12) | Offset);
-
- if (Address < PCI_ECAM_BASE || Address > PCI_ECAM_BASE + PCI_ECAM_SIZE) {
- return EFI_INVALID_PARAMETER;
- }
-
- return CpuIo->Mem.Write (CpuIo, (EFI_CPU_IO_PROTOCOL_WIDTH)Width, Address, Count, Buffer);
-}
-
-EFI_STATUS
-PciRbCopyMem (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 DestAddress,
- IN UINT64 SrcAddress,
- IN UINTN Count
- )
-{
- EFI_STATUS Status;
- BOOLEAN Direction;
- UINTN Stride;
- UINTN Index;
- UINT64 Result;
-
- PCI_TRACE ("PciRbCopyMem()");
-
- if (Width > EfiPciWidthUint64) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (DestAddress == SrcAddress) {
- return EFI_SUCCESS;
- }
-
- Stride = (UINTN)(1 << Width);
-
- Direction = TRUE;
- if ((DestAddress > SrcAddress) && (DestAddress < (SrcAddress + Count * Stride))) {
- Direction = FALSE;
- SrcAddress = SrcAddress + (Count-1) * Stride;
- DestAddress = DestAddress + (Count-1) * Stride;
- }
-
- for (Index = 0; Index < Count; Index++) {
- Status = PciRbMemRead (
- This,
- Width,
- SrcAddress,
- 1,
- &Result
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = PciRbMemWrite (
- This,
- Width,
- DestAddress,
- 1,
- &Result
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if (Direction) {
- SrcAddress += Stride;
- DestAddress += Stride;
- } else {
- SrcAddress -= Stride;
- DestAddress -= Stride;
- }
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRbMap (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- )
-{
- DMA_MAP_OPERATION DmaOperation;
-
- PCI_TRACE ("PciRbMap()");
-
- if (Operation == EfiPciOperationBusMasterRead) {
- DmaOperation = MapOperationBusMasterRead;
- } else if (Operation == EfiPciOperationBusMasterWrite) {
- DmaOperation = MapOperationBusMasterWrite;
- } else if (Operation == EfiPciOperationBusMasterCommonBuffer) {
- DmaOperation = MapOperationBusMasterCommonBuffer;
- } else {
- return EFI_INVALID_PARAMETER;
- }
- return DmaMap (DmaOperation, HostAddress, NumberOfBytes, DeviceAddress, Mapping);
-}
-
-EFI_STATUS
-PciRbUnMap (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN VOID *Mapping
- )
-{
- PCI_TRACE ("PciRbUnMap()");
- return DmaUnmap (Mapping);
-}
-
-EFI_STATUS
-PciRbAllocateBuffer (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN OUT VOID **HostAddress,
- IN UINT64 Attributes
- )
-{
- PCI_TRACE ("PciRbAllocateBuffer()");
-
- if (Attributes & EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER) {
- return EFI_UNSUPPORTED;
- }
-
- return DmaAllocateBuffer (MemoryType, Pages, HostAddress);
-}
-
-EFI_STATUS
-PciRbFreeBuffer (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- )
-{
- PCI_TRACE ("PciRbFreeBuffer()");
- return DmaFreeBuffer (Pages, HostAddress);
-}
-
-EFI_STATUS
-PciRbFlush (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
- )
-{
- PCI_TRACE ("PciRbFlush()");
-
- //TODO: Not supported yet
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRbSetAttributes (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- IN UINT64 Attributes,
- IN OUT UINT64 *ResourceBase,
- IN OUT UINT64 *ResourceLength
- )
-{
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
-
- PCI_TRACE ("PciRbSetAttributes()");
-
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
-
- if (Attributes) {
- if ((Attributes & (~(RootBridgeInstance->Supports))) != 0) {
- return EFI_UNSUPPORTED;
- }
- }
-
- //TODO: Cannot allowed to change attributes
- if (Attributes & ~RootBridgeInstance->Attributes) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRbGetAttributes (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- OUT UINT64 *Supported,
- OUT UINT64 *Attributes
- )
-{
- PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
-
- PCI_TRACE ("PciRbGetAttributes()");
-
- RootBridgeInstance = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
-
- if (Attributes == NULL && Supported == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Set the return value for Supported and Attributes
- if (Supported) {
- *Supported = RootBridgeInstance->Supports;
- }
-
- if (Attributes) {
- *Attributes = RootBridgeInstance->Attributes;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRbConfiguration (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
- OUT VOID **Resources
- )
-{
- PCI_ROOT_BRIDGE_INSTANCE *RootBridge;
- UINTN Index;
-
- PCI_TRACE ("PciRbConfiguration()");
-
- RootBridge = INSTANCE_FROM_ROOT_BRIDGE_IO_THIS (This);
-
- for (Index = 0; Index < ResTypeMax; Index++) {
- //if (ResAlloc[Index].Length != 0) => Resource allocated
- if (RootBridge->ResAlloc[Index].Length != 0) {
- Configuration.SpaceDesp[Index].AddrRangeMin = RootBridge->ResAlloc[Index].Base;
- Configuration.SpaceDesp[Index].AddrRangeMax = RootBridge->ResAlloc[Index].Base + RootBridge->ResAlloc[Index].Length - 1;
- Configuration.SpaceDesp[Index].AddrLen = RootBridge->ResAlloc[Index].Length;
- }
- }
-
- // Set up Configuration for the bus
- Configuration.SpaceDesp[Index].AddrRangeMin = RootBridge->BusStart;
- Configuration.SpaceDesp[Index].AddrLen = RootBridge->BusLength;
-
- *Resources = &Configuration;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRbConstructor (
- IN PCI_HOST_BRIDGE_INSTANCE *HostBridge,
- IN UINT32 PciAcpiUid,
- IN UINT64 MemAllocAttributes
- )
-{
- PCI_ROOT_BRIDGE_INSTANCE* RootBridge;
- EFI_STATUS Status;
-
- PCI_TRACE ("PciRbConstructor()");
-
- // Allocate Memory for the Instance from a Template
- RootBridge = AllocateZeroPool (sizeof (PCI_ROOT_BRIDGE_INSTANCE));
- if (RootBridge == NULL) {
- PCI_TRACE ("PciRbConstructor(): ERROR: Out of Resources");
- return EFI_OUT_OF_RESOURCES;
- }
- RootBridge->Signature = PCI_ROOT_BRIDGE_SIGNATURE;
- CopyMem (&(RootBridge->DevicePath), &gDevicePathTemplate, sizeof (EFI_PCI_ROOT_BRIDGE_DEVICE_PATH));
- CopyMem (&(RootBridge->Io), &gIoTemplate, sizeof (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL));
-
- // Set Parent Handle
- RootBridge->Io.ParentHandle = HostBridge->Handle;
-
- // Attach the Root Bridge to the PCI Host Bridge Instance
- RootBridge->HostBridge = HostBridge;
-
- // Set Device Path for this Root Bridge
- RootBridge->DevicePath.Acpi.UID = PciAcpiUid;
-
- RootBridge->BusStart = FixedPcdGet32 (PcdPciBusMin);
- RootBridge->BusLength = FixedPcdGet32 (PcdPciBusMax) - FixedPcdGet32 (PcdPciBusMin) + 1;
-
- // PCI Attributes
- RootBridge->Supports = 0;
- RootBridge->Attributes = 0;
-
- // Install Protocol Instances. It will also generate a device handle for the PCI Root Bridge
- Status = gBS->InstallMultipleProtocolInterfaces (
- &RootBridge->Handle,
- &gEfiDevicePathProtocolGuid, &RootBridge->DevicePath,
- &gEfiPciRootBridgeIoProtocolGuid, &RootBridge->Io,
- NULL
- );
- ASSERT (RootBridge->Signature == PCI_ROOT_BRIDGE_SIGNATURE);
- if (EFI_ERROR (Status)) {
- PCI_TRACE ("PciRbConstructor(): ERROR: Fail to install Protocol Interfaces");
- FreePool (RootBridge);
- return EFI_DEVICE_ERROR;
- }
-
- HostBridge->RootBridge = RootBridge;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRbDestructor (
- IN PCI_ROOT_BRIDGE_INSTANCE* RootBridge
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- RootBridge->Handle,
- &gEfiDevicePathProtocolGuid, &RootBridge->DevicePath,
- &gEfiPciRootBridgeIoProtocolGuid, &RootBridge->Io,
- NULL
- );
-
- FreePool (RootBridge);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
deleted file mode 100644
index 06de6d5d9a..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file
-* Initialize the XPress-RICH3 PCIe Root complex
-*
-* Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PciHostBridge.h"
-
-#include <Protocol/Cpu.h>
-
-#include "ArmPlatform.h"
-
-EFI_CPU_ARCH_PROTOCOL *mCpu;
-
-#define PCI_BRIDGE_REVISION_ID 1
-#define CLASS_CODE_REGISTER(Class, SubClass, ProgIf) ((Class << 16) | (SubClass << 8) | ProgIf)
-#define PLDA_BRIDGE_CCR CLASS_CODE_REGISTER(PCI_CLASS_BRIDGE, \
- PCI_CLASS_BRIDGE_P2P, \
- PCI_IF_BRIDGE_P2P)
-
-STATIC
-VOID
-SetTranslationAddressEntry (
- IN EFI_CPU_IO2_PROTOCOL *CpuIo,
- IN UINTN Entry,
- IN UINT64 SourceAddress,
- IN UINT64 TranslatedAddress,
- IN UINT64 TranslationSize,
- IN UINT64 TranslationParameter
- )
-{
- UINTN Log2Size = HighBitSet64 (TranslationSize);
-
- // Ensure the size is a power of two. Restriction form the AXI Translation logic
- // Othwerwise we increase the translation size
- if (TranslationSize != (1ULL << Log2Size)) {
- DEBUG ((EFI_D_WARN, "PCI: The size 0x%lX of the region 0x%lx has been increased to "
- "be a power of two for the AXI translation table.\n",
- TranslationSize, SourceAddress));
- Log2Size++;
- }
-
- PCIE_ROOTPORT_WRITE32 (Entry + PCI_ATR_SRC_ADDR_LOW_SIZE,
- (UINT32)SourceAddress | ((Log2Size - 1) << 1) | 0x1);
- PCIE_ROOTPORT_WRITE32 (Entry + PCI_ATR_SRC_ADDR_HI, SourceAddress >> 32);
-
- PCIE_ROOTPORT_WRITE32 (Entry + PCI_ATR_TRSL_ADDR_LOW, (UINT32)TranslatedAddress);
- PCIE_ROOTPORT_WRITE32 (Entry + PCI_ATR_TRSL_ADDR_HI, TranslatedAddress >> 32);
-
- PCIE_ROOTPORT_WRITE32 (Entry + PCI_ATR_TRSL_PARAM, TranslationParameter);
-}
-
-EFI_STATUS
-HWPciRbInit (
- IN EFI_CPU_IO2_PROTOCOL *CpuIo
- )
-{
- UINT32 Value;
- UINT32 Index;
- UINTN TranslationTable;
-
- PCI_TRACE ("VExpressPciRbInit()");
-
- PCI_TRACE ("PCIe Setting up Address Translation");
-
- PCIE_ROOTPORT_WRITE32 (PCIE_BAR_WIN, PCIE_BAR_WIN_SUPPORT_IO | PCIE_BAR_WIN_SUPPORT_MEM | PCIE_BAR_WIN_SUPPORT_MEM64);
-
- // Setup the PCI Configuration Registers
- // Offset 0a: SubClass 04 PCI-PCI Bridge
- // Offset 0b: BaseClass 06 Bridge Device
- // The Class Code register is a 24 bit and can be configured by setting up the PCIE_PCI_IDS
- // Refer [1] Chapter 13
- PCIE_ROOTPORT_WRITE32 (PCIE_PCI_IDS + PCIE_PCI_IDS_CLASSCODE_OFFSET, ((PLDA_BRIDGE_CCR << 8) | PCI_BRIDGE_REVISION_ID));
-
- //
- // PCIE Window 0 -> AXI4 Slave 0 Address Translations
- //
- TranslationTable = VEXPRESS_ATR_PCIE_WIN0;
-
- // MSI Support
- SetTranslationAddressEntry (CpuIo, TranslationTable, ARM_JUNO_GIV2M_MSI_BASE, ARM_JUNO_GIV2M_MSI_BASE,
- ARM_JUNO_GIV2M_MSI_SZ, PCI_ATR_TRSLID_AXIDEVICE);
- TranslationTable += PCI_ATR_ENTRY_SIZE;
-
- // System Memory Support
- SetTranslationAddressEntry (CpuIo, TranslationTable, PcdGet64 (PcdSystemMemoryBase), PcdGet64 (PcdSystemMemoryBase),
- PcdGet64 (PcdSystemMemorySize), PCI_ATR_TRSLID_AXIMEMORY);
- TranslationTable += PCI_ATR_ENTRY_SIZE;
- SetTranslationAddressEntry (CpuIo, TranslationTable, ARM_JUNO_EXTRA_SYSTEM_MEMORY_BASE, ARM_JUNO_EXTRA_SYSTEM_MEMORY_BASE,
- ARM_JUNO_EXTRA_SYSTEM_MEMORY_SZ, PCI_ATR_TRSLID_AXIMEMORY);
-
- //
- // PCIE Window 0 -> AXI4 Slave 0 Address Translations
- //
- TranslationTable = VEXPRESS_ATR_AXI4_SLV1;
-
- // PCI ECAM Support
- SetTranslationAddressEntry (CpuIo, TranslationTable, PCI_ECAM_BASE, PCI_ECAM_BASE, PCI_ECAM_SIZE, PCI_ATR_TRSLID_PCIE_CONF);
- TranslationTable += PCI_ATR_ENTRY_SIZE;
-
- // PCI IO Support
- SetTranslationAddressEntry (CpuIo, TranslationTable, PCI_IO_BASE, PCI_IO_BASE, PCI_IO_SIZE, PCI_ATR_TRSLID_PCIE_IO);
- TranslationTable += PCI_ATR_ENTRY_SIZE;
-
- // PCI MEM32 Support
- SetTranslationAddressEntry (CpuIo, TranslationTable, PCI_MEM32_BASE, PCI_MEM32_BASE, PCI_MEM32_SIZE, PCI_ATR_TRSLID_PCIE_MEMORY);
- TranslationTable += PCI_ATR_ENTRY_SIZE;
-
- // PCI MEM64 Support
- SetTranslationAddressEntry (CpuIo, TranslationTable, PCI_MEM64_BASE, PCI_MEM64_BASE, PCI_MEM64_SIZE, PCI_ATR_TRSLID_PCIE_MEMORY);
-
- // Add credits
- PCIE_ROOTPORT_WRITE32 (PCIE_VC_CRED, 0x00f0b818);
- PCIE_ROOTPORT_WRITE32 (PCIE_VC_CRED + 4, 0x1);
-
- // Allow ECRC
- PCIE_ROOTPORT_WRITE32 (PCIE_PEX_SPC2, 0x6006);
-
- // Reset controller
- PCIE_CONTROL_WRITE32 (PCIE_CONTROL_RST_CTL, PCIE_CONTROL_RST_CTL_RCPHY_REL);
-
- // Wait for reset
- for (Index = 0; Index < 1000; Index++) {
- gBS->Stall (1000);
- PCIE_CONTROL_READ32 (PCIE_CONTROL_RST_STS, Value);
- if ((Value & PCIE_CONTROL_RST_STS_RCPHYPLL_OUT) == PCIE_CONTROL_RST_STS_RCPHYPLL_OUT) {
- break;
- }
- }
-
- // Check for reset
- if (!(Value & PCIE_CONTROL_RST_STS_RCPHYPLL_OUT)) {
- DEBUG ((EFI_D_ERROR, "PCIe failed to come out of reset: %x.\n", Value));
- return EFI_NOT_READY;
- }
-
- gBS->Stall (1000);
- PCI_TRACE ("Checking link Status...");
-
- // Wait for Link Up
- for (Index = 0; Index < 1000; Index++) {
- gBS->Stall (1000);
- PCIE_ROOTPORT_READ32 (VEXPRESS_BASIC_STATUS, Value);
- if (Value & LINK_UP) {
- break;
- }
- }
-
- // Check for link up
- if (!(Value & LINK_UP)) {
- DEBUG ((EFI_D_ERROR, "PCIe link not up: %x.\n", Value));
- return EFI_NOT_READY;
- }
-
- PCIE_ROOTPORT_WRITE32 (PCIE_IMASK_LOCAL, PCIE_INT_MSI | PCIE_INT_INTx);
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.h b/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.h
deleted file mode 100644
index a0c11a7056..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/XPressRich3.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/** @file
-* Header containing the Xpress-RICH3 PCIe Root Complex specific values
-*
-* Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __XPRESS_RICH3_H__
-#define __XPRESS_RICH3_H__
-
-#include <Protocol/CpuIo2.h>
-#include <Library/PcdLib.h>
-
-#define PCI_ECAM_BASE FixedPcdGet64 (PcdPciConfigurationSpaceBaseAddress)
-#define PCI_ECAM_SIZE FixedPcdGet64 (PcdPciConfigurationSpaceSize)
-#define PCI_IO_BASE FixedPcdGet64 (PcdPciIoBase)
-#define PCI_IO_SIZE FixedPcdGet64 (PcdPciIoSize)
-#define PCI_MEM32_BASE FixedPcdGet64 (PcdPciMmio32Base)
-#define PCI_MEM32_SIZE FixedPcdGet64 (PcdPciMmio32Size)
-#define PCI_MEM64_BASE FixedPcdGet64 (PcdPciMmio64Base)
-#define PCI_MEM64_SIZE FixedPcdGet64 (PcdPciMmio64Size)
-
-/*
- * Bridge Internal Registers
- */
-
-// PCIe Available Credit Settings
-#define PCIE_VC_CRED 0x090
-// PCIe PCI Standard Configuration Identification Settings registers
-#define PCIE_PCI_IDS 0x098
-#define PCIE_PCI_IDS_CLASSCODE_OFFSET 0x4
-// PCIe Specific 2 Capabilities Settings
-#define PCIE_PEX_SPC2 0x0d8
-// PCIe Windows Settings register
-#define PCIE_BAR_WIN 0x0FC
-// Local Processor Interrupt Mask
-#define PCIE_IMASK_LOCAL 0x180
-
-#define PCIE_BAR_WIN_SUPPORT_IO BIT0
-#define PCIE_BAR_WIN_SUPPORT_IO32 BIT1
-#define PCIE_BAR_WIN_SUPPORT_MEM BIT2
-#define PCIE_BAR_WIN_SUPPORT_MEM64 BIT3
-
-#define PCIE_INT_MSI BIT28
-#define PCIE_INT_A BIT24
-#define PCIE_INT_B BIT25
-#define PCIE_INT_C BIT26
-#define PCIE_INT_D BIT27
-#define PCIE_INT_INTx (PCIE_INT_A | PCIE_INT_B |\
- PCIE_INT_C | PCIE_INT_D)
-
-/*
- * PCIe Control Registers
- */
-#define PCIE_CONTROL_RST_CTL 0x1004
-#define PCIE_CONTROL_RST_STS 0x1008
-
-/*
- * PCI Express Address Translation registers
- * All are offsets from PcdPcieControlBaseAddress
- */
-#define VEXPRESS_ATR_PCIE_WIN0 0x600
-#define VEXPRESS_ATR_AXI4_SLV0 0x800
-#define VEXPRESS_ATR_AXI4_SLV1 0x820
-
-#define PCI_ATR_ENTRY_SIZE 0x20
-#define PCI_ATR_SRC_ADDR_LOW_SIZE 0
-#define PCI_ATR_SRC_ADDR_HI 0x4
-#define PCI_ATR_TRSL_ADDR_LOW 0x8
-#define PCI_ATR_TRSL_ADDR_HI 0xc
-#define PCI_ATR_TRSL_PARAM 0x10
-
-#define PCI_ATR_TRSLID_AXIDEVICE 0x420004
-#define PCI_ATR_TRSLID_AXIMEMORY 0x4e0004
-#define PCI_ATR_TRSLID_PCIE_CONF 0x000001
-#define PCI_ATR_TRSLID_PCIE_IO 0x020000
-#define PCI_ATR_TRSLID_PCIE_MEMORY 0x000000
-
-#define PCIE_CONTROL_RST_CTL_RC_REL (1 << 1)
-#define PCIE_CONTROL_RST_CTL_PHY_REL (1 << 0)
-#define PCIE_CONTROL_RST_CTL_RCPHY_REL (PCIE_CONTROL_RST_CTL_RC_REL | PCIE_CONTROL_RST_CTL_PHY_REL)
-
-#define PCIE_CONTROL_RST_STS_RC_ST (1 << 2)
-#define PCIE_CONTROL_RST_STS_PHY_ST (1 << 1)
-#define PCIE_CONTROL_RST_STS_PLL_ST (1 << 0)
-#define PCIE_CONTROL_RST_STS_RCPHYPLL_OUT (PCIE_CONTROL_RST_STS_RC_ST | PCIE_CONTROL_RST_STS_PHY_ST | PCIE_CONTROL_RST_STS_PLL_ST)
-
-#define VEXPRESS_BASIC_STATUS 0x18
-#define LINK_UP 0xff
-
-/*
- * Initialize Versatile Express PCIe Host Bridge
- */
-EFI_STATUS
-VExpressPciRbInit (
- IN EFI_CPU_IO2_PROTOCOL *CpuIo
- );
-
-// Does not support neither EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM
-// nor EFI_PCI_HOST_BRIDGE_MEM64_DECODE
-#define PCI_MEMORY_ALLOCATION_ATTRIBUTES 0
-
-#endif
diff --git a/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h b/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h
deleted file mode 100644
index 9928c5ae7a..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_JUNO_H__
-#define __ARM_JUNO_H__
-
-#include <VExpressMotherBoard.h>
-
-/***********************************************************************************
-// Platform Memory Map
-************************************************************************************/
-
-// Motherboard Peripheral and On-chip peripheral
-#define ARM_VE_BOARD_PERIPH_BASE 0x1C010000
-
-// NOR Flash 0
-#define ARM_VE_SMB_NOR0_BASE 0x08000000
-#define ARM_VE_SMB_NOR0_SZ SIZE_64MB
-
-// Off-Chip peripherals (USB, Ethernet, VRAM)
-#define ARM_VE_SMB_PERIPH_BASE 0x18000000
-#define ARM_VE_SMB_PERIPH_SZ (SIZE_64MB + SIZE_2MB)
-
-// On-Chip non-secure ROM
-#define ARM_JUNO_NON_SECURE_ROM_BASE 0x1F000000
-#define ARM_JUNO_NON_SECURE_ROM_SZ SIZE_16MB
-
-// On-Chip Peripherals
-#define ARM_JUNO_PERIPHERALS_BASE 0x20000000
-#define ARM_JUNO_PERIPHERALS_SZ 0x0E000000
-
-#define ARM_JUNO_GIV2M_MSI_BASE 0x2c1c0000
-#define ARM_JUNO_GIV2M_MSI_SZ SIZE_256KB
-
-// On-Chip non-secure SRAM
-#define ARM_JUNO_NON_SECURE_SRAM_BASE 0x2E000000
-#define ARM_JUNO_NON_SECURE_SRAM_SZ SIZE_16MB
-
-// SOC peripherals (HDLCD, UART, I2C, I2S, USB, SMC-PL354, etc)
-#define ARM_JUNO_SOC_PERIPHERALS_BASE 0x7FF50000
-#define ARM_JUNO_SOC_PERIPHERALS_SZ (SIZE_64KB * 9)
-
-// 6GB of DRAM from the 64bit address space
-#define ARM_JUNO_EXTRA_SYSTEM_MEMORY_BASE 0x0880000000
-#define ARM_JUNO_EXTRA_SYSTEM_MEMORY_SZ (SIZE_2GB + SIZE_4GB)
-
-//
-// ACPI table information used to initialize tables.
-//
-#define EFI_ACPI_ARM_OEM_ID 'A','R','M','L','T','D' // OEMID 6 bytes long
-#define EFI_ACPI_ARM_OEM_TABLE_ID SIGNATURE_64('A','R','M','-','J','U','N','O') // OEM table id 8 bytes long
-#define EFI_ACPI_ARM_OEM_REVISION 0x20140727
-#define EFI_ACPI_ARM_CREATOR_ID SIGNATURE_32('A','R','M',' ')
-#define EFI_ACPI_ARM_CREATOR_REVISION 0x00000099
-
-// A macro to initialise the common header part of EFI ACPI tables as defined by
-// EFI_ACPI_DESCRIPTION_HEADER structure.
-#define ARM_ACPI_HEADER(Signature, Type, Revision) { \
- Signature, /* UINT32 Signature */ \
- sizeof (Type), /* UINT32 Length */ \
- Revision, /* UINT8 Revision */ \
- 0, /* UINT8 Checksum */ \
- { EFI_ACPI_ARM_OEM_ID }, /* UINT8 OemId[6] */ \
- EFI_ACPI_ARM_OEM_TABLE_ID, /* UINT64 OemTableId */ \
- EFI_ACPI_ARM_OEM_REVISION, /* UINT32 OemRevision */ \
- EFI_ACPI_ARM_CREATOR_ID, /* UINT32 CreatorId */ \
- EFI_ACPI_ARM_CREATOR_REVISION /* UINT32 CreatorRevision */ \
- }
-
-#define JUNO_WATCHDOG_COUNT 2
-
-// Define if the exported ACPI Tables are based on ACPI 5.0 spec or latest
-//#define ARM_JUNO_ACPI_5_0
-
-//
-// Address of the system registers that contain the MAC address
-// assigned to the PCI Gigabyte Ethernet device.
-//
-
-#define ARM_JUNO_SYS_PCIGBE_L (ARM_VE_BOARD_PERIPH_BASE + 0x74)
-#define ARM_JUNO_SYS_PCIGBE_H (ARM_VE_BOARD_PERIPH_BASE + 0x78)
-
-#endif
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
deleted file mode 100644
index 73b249ca5f..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <AsmMacroIoLibV8.h>
-#include <Library/ArmLib.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-
-PrimaryCoreMpid: .word 0x0
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-// With this function: CorePos = (ClusterId * 2) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
- and x1, x0, #ARM_CORE_MASK
- and x0, x0, #ARM_CLUSTER_MASK
- add x0, x1, x0, LSR #7
- ret
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- ldr x0, =PrimaryCoreMpid
- ldrh w0, [x0]
- ret
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
- ldrh w1, [x1]
- and x0, x0, x1
-
- ldr x1, =PrimaryCoreMpid
- ldrh w1, [x1]
-
- cmp w0, w1
- mov x0, #1
- mov x1, #0
- csel x0, x0, x1, eq
- ret
-
-ASM_PFX(ArmPlatformPeiBootAction):
- // The trusted firmware passes the primary CPU MPID through x0 register.
- // Save it in a variable.
- ldr x1, =PrimaryCoreMpid
- str w0, [x1]
- ret
-
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
deleted file mode 100644
index 2efb5451b8..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
+++ /dev/null
@@ -1,105 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <AsmMacroIoLibV8.h>
-#include <Library/ArmLib.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-
-PrimaryCoreMpid: .word 0x0
-
-//
-// Return the core position from the value of its MpId register
-//
-// This function returns the core position from the position 0 in the processor.
-// This function might be called from assembler before any stack is set.
-//
-// @return Return the core position
-//
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-// With this function: CorePos = (ClusterId * 2) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
-
-//
-// Return the MpId of the primary core
-//
-// This function returns the MpId of the primary core.
-// This function might be called from assembler before any stack is set.
-//
-// @return Return the MpId of the primary core
-//
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- ldr r0, =PrimaryCoreMpid
- ldr r0, [r0]
- bx lr
-
-//
-// Return a non-zero value if the callee is the primary core
-//
-// This function returns a non-zero value if the callee is the primary core.
-// The primary core is the core responsible to initialize the hardware and run UEFI.
-// This function might be called from assembler before any stack is set.
-//
-// @return Return a non-zero value if the callee is the primary core.
-//
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
-
- ldr r1, =PrimaryCoreMpid
- ldr r1, [r1]
-
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
-
-//
-// First platform specific function to be called in the PEI phase
-//
-// This function is actually the first function called by the PrePi
-// or PrePeiCore modules. It allows to retrieve arguments passed to
-// the UEFI firmware through the CPU registers.
-//
-ASM_PFX(ArmPlatformPeiBootAction):
- // The trusted firmware passes the primary CPU MPID through r0 register.
- // Save it in a variable.
- ldr r1, =PrimaryCoreMpid
- str r0, [r1]
- bx lr
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJuno.c b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJuno.c
deleted file mode 100644
index 3be26d3ed0..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJuno.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-#include <ArmPlatform.h>
-
-ARM_CORE_INFO mJunoInfoTable[] = {
- {
- // Cluster 0, Core 0
- 0x0, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 1
- 0x0, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 0
- 0x1, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 1
- 0x1, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 2
- 0x1, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 3
- 0x1, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- }
-};
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
- @return Return the current Boot Mode of the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- )
-{
- return BOOT_WITH_FULL_CONFIGURATION;
-}
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- )
-{
- return RETURN_SUCCESS;
-}
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- )
-{
-}
-
-EFI_STATUS
-PrePeiCoreGetMpCoreInfo (
- OUT UINTN *CoreCount,
- OUT ARM_CORE_INFO **ArmCoreTable
- )
-{
- // Only support one cluster
- *CoreCount = sizeof(mJunoInfoTable) / sizeof(ARM_CORE_INFO);
- *ArmCoreTable = mJunoInfoTable;
- return EFI_SUCCESS;
-}
-
-// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
-EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
-ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
-
-EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &mArmMpCoreInfoPpiGuid,
- &mMpCoreInfoPpi
- }
-};
-
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- *PpiListSize = sizeof(gPlatformPpiTable);
- *PpiList = gPlatformPpiTable;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf
deleted file mode 100644
index 092b606b24..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoLib.inf
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmJunoLib
- FILE_GUID = 87c525cd-e1a2-469e-994c-c28cd0c7bd0d
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- HobLib
- MemoryAllocationLib
- SerialPortLib
-
-[Sources.common]
- ArmJuno.c
- ArmJunoMem.c
-
-[Sources.AARCH64]
- AArch64/ArmJunoHelper.S
-
-[Sources.ARM]
- Arm/ArmJunoHelper.S | GCC
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
- gArmTokenSpaceGuid.PcdFvBaseAddress
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
-
- gArmJunoTokenSpaceGuid.PcdPcieControlBaseAddress
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress
- gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceSize
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Base
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Size
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Base
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Size
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoMem.c b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoMem.c
deleted file mode 100644
index 41731c1ebd..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJunoMem.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <ArmPlatform.h>
-
-// The total number of descriptors, including the final "end-of-table" descriptor.
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 16
-
-// DDR attributes
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- )
-{
- ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
- UINTN Index = 0;
- ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
- EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
-
- ASSERT (VirtualMemoryMap != NULL);
-
- //
- // Declared the additional 6GB of memory
- //
- ResourceAttributes =
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED;
-
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes,
- ARM_JUNO_EXTRA_SYSTEM_MEMORY_BASE,
- ARM_JUNO_EXTRA_SYSTEM_MEMORY_SZ);
-
- VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
- if (VirtualMemoryTable == NULL) {
- return;
- }
-
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
- CacheAttributes = DDR_ATTRIBUTES_CACHED;
- } else {
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;
- }
-
- // SMB CS0 - NOR0 Flash
- VirtualMemoryTable[Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].Length = SIZE_256KB * 255;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- // Environment Variables region
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE + (SIZE_256KB * 255);
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE + (SIZE_256KB * 255);
- VirtualMemoryTable[Index].Length = SIZE_64KB * 4;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS2 & CS3 - Off-chip (motherboard) peripherals
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // Juno OnChip non-secure ROM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_NON_SECURE_ROM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_NON_SECURE_ROM_BASE;
- VirtualMemoryTable[Index].Length = ARM_JUNO_NON_SECURE_ROM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // Juno OnChip peripherals
- VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_PERIPHERALS_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_PERIPHERALS_BASE;
- VirtualMemoryTable[Index].Length = ARM_JUNO_PERIPHERALS_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // Juno OnChip non-secure SRAM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_NON_SECURE_SRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_NON_SECURE_SRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_JUNO_NON_SECURE_SRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // PCI Root Complex
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPcieControlBaseAddress);
- VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPcieControlBaseAddress);
- VirtualMemoryTable[Index].Length = SIZE_128KB;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- //
- // PCI Configuration Space
- //
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPciConfigurationSpaceBaseAddress);
- VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPciConfigurationSpaceBaseAddress);
- VirtualMemoryTable[Index].Length = PcdGet64 (PcdPciConfigurationSpaceSize);
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- //
- // PCI Memory Space
- //
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet32 (PcdPciMmio32Base);
- VirtualMemoryTable[Index].VirtualBase = PcdGet32 (PcdPciMmio32Base);
- VirtualMemoryTable[Index].Length = PcdGet32 (PcdPciMmio32Size);
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- //
- // 64-bit PCI Memory Space
- //
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPciMmio64Base);
- VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPciMmio64Base);
- VirtualMemoryTable[Index].Length = PcdGet64 (PcdPciMmio64Size);
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // Juno SOC peripherals
- VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_SOC_PERIPHERALS_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_SOC_PERIPHERALS_BASE;
- VirtualMemoryTable[Index].Length = ARM_JUNO_SOC_PERIPHERALS_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // DDR - 2GB
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
- VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdSystemMemoryBase);
- VirtualMemoryTable[Index].Length = PcdGet64 (PcdSystemMemorySize);
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // DDR - 6GB
- VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_EXTRA_SYSTEM_MEMORY_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_EXTRA_SYSTEM_MEMORY_BASE;
- VirtualMemoryTable[Index].Length = ARM_JUNO_EXTRA_SYSTEM_MEMORY_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // End of Table
- VirtualMemoryTable[++Index].PhysicalBase = 0;
- VirtualMemoryTable[Index].VirtualBase = 0;
- VirtualMemoryTable[Index].Length = 0;
- VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
-
- ASSERT((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
-
- *VirtualMemoryMap = VirtualMemoryTable;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c b/ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c
deleted file mode 100644
index b31b9635b7..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#include <PiDxe.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/NorFlashPlatformLib.h>
-#include <ArmPlatform.h>
-
-NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
- {
- ARM_VE_SMB_NOR0_BASE,
- ARM_VE_SMB_NOR0_BASE,
- SIZE_256KB * 255,
- SIZE_256KB,
- {0xE7223039, 0x5836, 0x41E1, { 0xB5, 0x42, 0xD7, 0xEC, 0x73, 0x6C, 0x5E, 0x59} }
- },
- {
- ARM_VE_SMB_NOR0_BASE,
- ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,
- SIZE_64KB * 4,
- SIZE_64KB,
- {0x02118005, 0x9DA7, 0x443A, { 0x92, 0xD5, 0x78, 0x1F, 0x02, 0x2A, 0xED, 0xBB } }
- },
-};
-
-EFI_STATUS
-NorFlashPlatformInitialization (
- VOID
- )
-{
- // Everything seems ok so far, so now we need to disable the platform-specific
- // flash write protection for Versatile Express
- if ((MmioRead32 (ARM_VE_SYS_FLASH) & 0x1) == 0) {
- // Writing to NOR FLASH is disabled, so enable it
- MmioWrite32 (ARM_VE_SYS_FLASH, 1);
- DEBUG((DEBUG_BLKIO, "NorFlashPlatformInitialization: informational - Had to enable HSYS_FLASH flag.\n" ));
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-NorFlashPlatformGetDevices (
- OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
- OUT UINT32 *Count
- )
-{
- if ((NorFlashDevices == NULL) || (Count == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *NorFlashDevices = mNorFlashDevices;
- *Count = sizeof (mNorFlashDevices) / sizeof (NOR_FLASH_DESCRIPTION);
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJunoLib.inf b/ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJunoLib.inf
deleted file mode 100644
index 6b13635088..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJunoLib.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = NorFlashJunoLib
- FILE_GUID = 3eb6cbc4-ce95-11e2-b1bd-00241d0c1ba8
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = NorFlashPlatformLib
-
-[Sources.common]
- NorFlashJuno.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- IoLib
diff --git a/ArmPlatformPkg/ArmJunoPkg/Makefile b/ArmPlatformPkg/ArmJunoPkg/Makefile
deleted file mode 100644
index d8d1f8465a..0000000000
--- a/ArmPlatformPkg/ArmJunoPkg/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-# Define the following variable to specify an alternative toolchain to the one located in your PATH:
-# - RVCT_TOOLS_PATH: for RVCT and RVCTLINUX toolchains
-
-EDK2_TOOLCHAIN ?= GCC49
-GCC49_AARCH64_PREFIX ?= aarch64-none-elf-
-EDK2_ARCH ?= AARCH64
-EDK2_BUILD ?= DEBUG
-EDK2_DSC = ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
-DEST_BIN_ROOT ?=
-
-ifeq ($(EDK2_DSC),"")
- $(error The Makefile macro 'EDK2_DSC' must be defined with an EDK2 DSC file.)
-endif
-
-ifeq ("$(OS)","Windows_NT")
-export WORKSPACE?=$(PWD)
-export EDK_TOOLS_PATH ?= $(WORKSPACE)\BaseTools
-else
-export WORKSPACE?=$(PWD)
-endif
-
-# Define the destination of the Firmware Image Package (FIP) if not defined
-ifndef JUNO_FIP
- ifdef DEST_BIN_ROOT
- JUNO_FIP=$(DEST_BIN_ROOT)/fip.bin
- else
- JUNO_FIP=fip.bin
- endif
-endif
-
-SHELL := /bin/bash
-SILENT ?= @
-ECHO ?= echo
-MAKE ?= make -i -k
-RM ?= rm -f
-CP ?= cp
-
-.PHONY: all clean
-
-EDK2_CONF = Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt
-
-all: $(EDK2_CONF)
-ifeq ("$(OS)","Windows_NT")
- build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
-else
- . ./edksetup.sh; GCC49_AARCH64_PREFIX=$(GCC49_AARCH64_PREFIX) build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
-endif
-ifeq ("$(OS)","Windows_NT")
- $(SILENT)$(ECHO) "Warning: The UEFI Firmware must be added to the Firmware Image Package (FIP)."
-else
- $(SILENT)which fip_create ; \
- if [ $$? -ne 0 ]; then \
- $(ECHO) "Warning: 'fip_create' tool is not in the PATH. The UEFI binary will not be added in the Firmware Image Package (FIP)."; \
- else \
- fip_create --bl33 $(WORKSPACE)/Build/ArmJuno/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/FV/BL33_AP_UEFI.fd --dump $(JUNO_FIP); \
- fi
-endif
-
-$(EDK2_CONF):
-ifeq ("$(OS)","Windows_NT")
- copy $(EDK_TOOLS_PATH)\Conf\build_rule.template Conf\build_rule.txt
- copy $(EDK_TOOLS_PATH)\Conf\FrameworkDatabase.template Conf\FrameworkDatabase.txt
- copy $(EDK_TOOLS_PATH)\Conf\target.template Conf\target.txt
- copy $(EDK_TOOLS_PATH)\Conf\tools_def.template Conf\tools_def.txt
-else
- . ./edksetup.sh; $(MAKE) -C BaseTools
-endif
-
-clean:
-ifeq ("$(OS)","Windows_NT")
- build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall
-else
- . ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall; \
- rm -Rf $(EDK2_CONF) Conf/.cache
-endif
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
deleted file mode 100644
index dc21286e2b..0000000000
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
+++ /dev/null
@@ -1,385 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = ArmPlatform
- PLATFORM_GUID = 4fe82b83-9315-4ff3-8cc0-ab77ca93cb7f
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
- SUPPORTED_ARCHITECTURES = ARM|AARCH64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
-
-[LibraryClasses.common]
- ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
-
-!if $(TARGET) == RELEASE
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-!else
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
-!endif
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
-
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
-
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
-
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
-
- #
- # Assume everything is fixed at build
- #
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
- # 1/123 faster than Stm or Vstm version
- #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
-
- # ARM Architectural Libraries
- CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
- CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
- ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
- DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
- ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
- ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
-
- SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
- RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
-
- # Networking Requirements for ArmPlatformPkg/Bds
- NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-
- # These libraries are used by the dynamic EFI Shell commands
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-
- # EBL Related Libraries
- EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
- EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
- EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
- EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
-
- #
- # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
- # in the debugger will show load and unload commands for symbols. You can cut and paste this
- # into the command window to load symbols. We should be able to use a script to do this, but
- # the version of RVD I have does not support scripts accessing system memory.
- #
- #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
- PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
- #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
- DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
-
- SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
-
- # BDS Libraries
- BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
-
-[LibraryClasses.ARM]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
- ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Lib.inf
-
-[LibraryClasses.AARCH64]
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
- ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
-
-[LibraryClasses.common.SEC]
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
-
- ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf
- DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
-
- PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
- ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
- LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
- HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
- PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
- PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
- ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
-
-[LibraryClasses.common.SEC, LibraryClasses.common.PEIM]
- MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
-
-[LibraryClasses.common.DXE_CORE]
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
-
-[LibraryClasses.common.DXE_DRIVER]
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-
-[LibraryClasses.common.UEFI_DRIVER]
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-
-[LibraryClasses.common.DXE_RUNTIME_DRIVER]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
-
-[LibraryClasses.ARM, LibraryClasses.AARCH64]
- #
- # It is not possible to prevent the ARM compiler for generic intrinsic functions.
- # This library provides the instrinsic functions generate by a given compiler.
- # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
- #
- NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
-
- # Add support for GCC stack protector
- NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
-
-[BuildOptions]
- XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7
-
- GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a
-
- RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
- gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
-
- #
- # Control what commands are supported from the UI
- # Turn these on and off to add features or save size
- #
- gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE
-
- gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
-
- # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
- gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
-
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
-
- gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Platform"
-
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmPlatform"
- gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
- gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
- gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
- gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
-
- # DEBUG_ASSERT_ENABLED 0x01
- # DEBUG_PRINT_ENABLED 0x02
- # DEBUG_CODE_ENABLED 0x04
- # CLEAR_MEMORY_ENABLED 0x08
- # ASSERT_BREAKPOINT_ENABLED 0x10
- # ASSERT_DEADLOOP_ENABLED 0x20
-!if $(TARGET) == RELEASE
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
-!else
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
-!endif
-
- # DEBUG_INIT 0x00000001 // Initialization
- # DEBUG_WARN 0x00000002 // Warnings
- # DEBUG_LOAD 0x00000004 // Load events
- # DEBUG_FS 0x00000008 // EFI File system
- # DEBUG_POOL 0x00000010 // Alloc & Free's
- # DEBUG_PAGE 0x00000020 // Alloc & Free's
- # DEBUG_INFO 0x00000040 // Verbose
- # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers
- # DEBUG_VARIABLE 0x00000100 // Variable
- # DEBUG_BM 0x00000400 // Boot Manager
- # DEBUG_BLKIO 0x00001000 // BlkIo Driver
- # DEBUG_NET 0x00004000 // SNI Driver
- # DEBUG_UNDI 0x00010000 // UNDI Driver
- # DEBUG_LOADFILE 0x00020000 // UNDI Driver
- # DEBUG_EVENT 0x00080000 // Event messages
- # DEBUG_ERROR 0x80000000 // Error
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
-
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
-
- gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
- gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
- gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
-
- #
- # Optional feature to help prevent EFI memory map fragments
- # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
- # Values are in EFI Pages (4K). DXE Core will make sure that
- # at least this much of each type of memory can be allocated
- # from a single memory range. This way you only end up with
- # maximum of two fragements for each type in the memory map
- # (the memory used, and the free memory that was prereserved
- # but not used).
- #
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
-
- # We want to use the Shell Libraries but don't want it to initialise
- # automatically. We initialise the libraries when the command is called by the
- # Shell.
- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
- #
- # ARM Pcds
- #
- gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000
-
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0
- gArmTokenSpaceGuid.PcdSystemMemorySize|0
-
-################################################################################
-#
-# Components Section - list of all EDK II Modules needed by this Platform
-#
-################################################################################
-[Components.common]
-
- #
- # PEI Phase modules
- #
- ArmPlatformPkg/PrePi/PeiUniCore.inf
-
- #
- # DXE
- #
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- }
-
- #
- # Architectural Protocols
- #
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
- EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
-
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- # Simple TextIn/TextOut for UEFI Terminal
- EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
-
- #
- #
- # Semi-hosting filesystem
- #
- ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # Application
- #
- EmbeddedPkg/Ebl/Ebl.inf
-
- #
- # Bds
- #
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- ArmPlatformPkg/Bds/Bds.inf
-
- # Legacy Linux Loader
- ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
deleted file mode 100644
index 9c35ebb2f4..0000000000
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
+++ /dev/null
@@ -1,263 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-
-[FD.ArmPlatform_EFI]
-BaseAddress = 0xEC200000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
-Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
-ErasePolarity = 1
-
-# This one is tricky, it must be: BlockSize * NumBlocks = Size
-BlockSize = 0x00001000
-NumBlocks = 0x200
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-
-0x00000000|0x00200000
-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
-FV = FVMAIN_COMPACT
-
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-
-[FV.FvMain]
-BlockSize = 0x40
-NumBlocks = 0 # This FV gets compressed so make it just big enough
-FvAlignment = 8 # FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
-
- INF MdeModulePkg/Core/Dxe/DxeMain.inf
-
- #
- # PI DXE Drivers producing Architectural Protocols (EFI Services)
- #
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
- INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
- INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- # Simple TextIn/TextOut for UEFI Terminal
- INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
-
- #
- # Semi-hosting filesystem (Required the Hardware Debugger to be connected)
- #
- INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- INF FatBinPkg/EnhancedFatDxe/Fat.inf
- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # UEFI application (Shell Embedded Boot Loader)
- #
- INF EmbeddedPkg/Ebl/Ebl.inf
-
- #
- # Bds
- #
- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- INF ArmPlatformPkg/Bds/Bds.inf
-
- # Legacy Linux Loader
- INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
-
-[FV.FVMAIN_COMPACT]
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/PrePi/PeiUniCore.inf
-
- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FVMAIN
- }
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.ARM.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-# The AArch64 Vector Table requires a 2K alignment that is not supported by the FDF specification.
-# It is the reason 4K is used instead of 2K for the module alignment.
-[Rule.AARCH64.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 4K $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) {
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
- FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- UI STRING ="$(MODULE_NAME)" Optional
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
deleted file mode 100644
index 45aeaeee75..0000000000
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ /dev/null
@@ -1,218 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- DEC_SPECIFICATION = 0x00010005
- PACKAGE_NAME = ArmPlatformPkg
- PACKAGE_GUID = 3308e0a0-1d94-11e0-915c-0002a5d5c51b
- PACKAGE_VERSION = 0.1
-
-################################################################################
-#
-# Include Section - list of Include Paths that are provided by this package.
-# Comments are used for Keywords and Module Types.
-#
-# Supported Module Types:
-# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
-#
-################################################################################
-[Includes.common]
- Include # Root include for the package
-
-[Guids.common]
- gArmPlatformTokenSpaceGuid = { 0x9c0aaed4, 0x74c5, 0x4043, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xce, 0x76 } }
- #
- # Following Guid must match FILE_GUID in MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- #
- gVariableRuntimeDxeFileGuid = { 0xcbd2e4d5, 0x7068, 0x4ff5, { 0xb4, 0x62, 0x98, 0x22, 0xb4, 0xad, 0x8d, 0x60 } }
-
- ## Include/Guid/ArmGlobalVariableHob.h
- gArmGlobalVariableGuid = { 0xc3253c90, 0xa24f, 0x4599, { 0xa6, 0x64, 0x1f, 0x88, 0x13, 0x77, 0x8f, 0xc9} }
-
- gArmBootMonFsFileInfoGuid = { 0x41e26b9c, 0xada6, 0x45b3, { 0x80, 0x8e, 0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } }
-
-[Ppis]
- ## Include/Ppi/ArmGlobalVariable.h
- gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }
-
-[PcdsFeatureFlag.common]
- # Set this PCD to TRUE to map NORFlash at 0x0. FALSE means the DRAM is mapped at 0x0.
- gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping|FALSE|BOOLEAN|0x00000012
-
- gArmPlatformTokenSpaceGuid.PcdStandalone|TRUE|BOOLEAN|0x00000001
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec|FALSE|BOOLEAN|0x00000002
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|FALSE|BOOLEAN|0x00000004
-
- gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked|FALSE|BOOLEAN|0x0000003C
-
- # Disable the GOP controller on ExitBootServices(). By default the value is FALSE,
- # we assume the OS will handle the FrameBuffer from the UEFI GOP information.
- gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices|FALSE|BOOLEAN|0x0000003D
-
- # Enable Legacy Linux support in the BDS
- gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport|TRUE|BOOLEAN|0x0000002E
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdCoreCount|1|UINT32|0x00000039
- gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038
-
- # Stack for CPU Cores in Secure Mode
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0|UINT32|0x00000005
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize|0x10000|UINT32|0x00000036
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize|0x1000|UINT32|0x00000006
-
- # Stack for CPU Cores in Non Secure Mode
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0|UINT64|0x00000009
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x10000|UINT32|0x00000037
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize|0x1000|UINT32|0x0000000A
-
- # Size of the region used by UEFI in permanent memory (Reserved 128MB by default)
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x08000000|UINT32|0x00000015
-
- # Size to reserve in the primary core stack for PEI Global Variables
- # = sizeof(UINTN) /* PcdPeiServicePtr or HobListPtr */
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize|0x4|UINT32|0x00000016
- # PeiServicePtr and HobListPtr shares the same location in the PEI Global Variable list
- # PeiServicePtr is only valid with PEI Core and HobListPtr only when the PEI Core is skipped.
- gArmPlatformTokenSpaceGuid.PcdPeiServicePtrGlobalOffset|0x0|UINT32|0x00000017
- gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset|0x0|UINT32|0x00000018
-
- # Size to reserve in the primary core stack for SEC Global Variables
- gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize|0x0|UINT32|0x00000031
-
- # Boot Monitor FileSystem
- gArmPlatformTokenSpaceGuid.PcdBootMonFsSupportedDevicePaths|L""|VOID*|0x0000003A
-
- #
- # ARM Primecells
- #
-
- ## SP804 DualTimer
- gArmPlatformTokenSpaceGuid.PcdSP804TimerFrequencyInMHz|1|UINT32|0x0000001D
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPeriodicInterruptNum|0|UINT32|0x0000001E
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPeriodicBase|0|UINT32|0x0000002A
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPerformanceBase|0|UINT32|0x0000002B
- gArmPlatformTokenSpaceGuid.PcdSP804TimerMetronomeBase|0|UINT32|0x0000002C
-
- ## SP805 Watchdog
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogBase|0x0|UINT32|0x00000023
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogClockFrequencyInHz|32000|UINT32|0x00000021
-
- ## PL011 UART
- gArmPlatformTokenSpaceGuid.PL011UartClkInHz|24000000|UINT32|0x0000001F
- gArmPlatformTokenSpaceGuid.PL011UartInteger|0|UINT32|0x00000020
- gArmPlatformTokenSpaceGuid.PL011UartFractional|0|UINT32|0x0000002D
-
- ## PL061 GPIO
- gArmPlatformTokenSpaceGuid.PcdPL061GpioBase|0x0|UINT32|0x00000025
-
- ## PL111 Lcd & HdLcd
- gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x0|UINT32|0x00000026
- gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x0|UINT32|0x00000027
-
- ## PL180 MCI
- gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x00000000|UINT32|0x00000028
- gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x00000000|UINT32|0x00000029
-
- #
- # BDS - Boot Manager
- #
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Platform"|VOID*|0x00000019
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Default Boot Device"|VOID*|0x0000000C
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L""|VOID*|0x0000000D
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L""|VOID*|0x000000F
-
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L""|VOID*|0x0000001B
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L""|VOID*|0x0000001C
-
-[PcdsFixedAtBuild.common,PcdsDynamic.common]
- ## PL031 RealTimeClock
- gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0|UINT32|0x00000024
- gArmPlatformTokenSpaceGuid.PcdPL031RtcPpmAccuracy|300000000|UINT32|0x00000022
-
- #
- # Inclusive range of allowed PCI buses.
- #
- gArmPlatformTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x0000003E
- gArmPlatformTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x0000003F
-
- #
- # Bases, sizes and translation offsets of IO and MMIO spaces, respectively.
- # Note that "IO" is just another MMIO range that simulates IO space; there
- # are no special instructions to access it.
- #
- # The base addresses PcdPciIoBase, PcdPciMmio32Base and PcdPciMmio64Base are
- # specific to their containing address spaces. In order to get the physical
- # address for the CPU, for a given access, the respective translation value
- # has to be added.
- #
- # The translations always have to be initialized like this, using UINT64:
- #
- # UINT64 IoCpuBase; // mapping target in 64-bit cpu-physical space
- # UINT64 Mmio32CpuBase; // mapping target in 64-bit cpu-physical space
- # UINT64 Mmio64CpuBase; // mapping target in 64-bit cpu-physical space
- #
- # PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
- # PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
- # PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
- #
- # because (a) the target address space (ie. the cpu-physical space) is
- # 64-bit, and (b) the translation values are meant as offsets for *modular*
- # arithmetic.
- #
- # Accordingly, the translation itself needs to be implemented as:
- #
- # UINT64 UntranslatedIoAddress; // input parameter
- # UINT32 UntranslatedMmio32Address; // input parameter
- # UINT64 UntranslatedMmio64Address; // input parameter
- #
- # UINT64 TranslatedIoAddress; // output parameter
- # UINT64 TranslatedMmio32Address; // output parameter
- # UINT64 TranslatedMmio64Address; // output parameter
- #
- # TranslatedIoAddress = UntranslatedIoAddress +
- # PcdPciIoTranslation;
- # TranslatedMmio32Address = (UINT64)UntranslatedMmio32Address +
- # PcdPciMmio32Translation;
- # TranslatedMmio64Address = UntranslatedMmio64Address +
- # PcdPciMmio64Translation;
- #
- # The modular arithmetic performed in UINT64 ensures that the translation
- # works correctly regardless of the relation between IoCpuBase and
- # PcdPciIoBase, Mmio32CpuBase and PcdPciMmio32Base, and Mmio64CpuBase and
- # PcdPciMmio64Base.
- #
- gArmPlatformTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x00000040
- gArmPlatformTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x00000041
- gArmPlatformTokenSpaceGuid.PcdPciIoTranslation|0x0|UINT64|0x00000042
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT32|0x00000043
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT32|0x00000044
- gArmPlatformTokenSpaceGuid.PcdPciMmio32Translation|0x0|UINT64|0x00000045
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x00000046
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x00000047
- gArmPlatformTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x00000048
-
-[PcdsFixedAtBuild.ARM]
- # Stack for CPU Cores in Secure Monitor Mode
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0|UINT32|0x00000007
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize|0x1000|UINT32|0x00000008
-
-[PcdsFixedAtBuild.AARCH64]
- # The Secure World is only running in EL3. Only one set of stacks is needed for AArch64.
- # The Secure stacks are described by PcdCPUCoresSecStackBase, PcdCPUCoreSecPrimaryStackSize
- # and PcdCPUCoreSecSecondaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0|UINT32|0x00000007
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize|0x0|UINT32|0x00000008
-
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
deleted file mode 100644
index 5b857e57af..0000000000
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ /dev/null
@@ -1,452 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = ArmPlatform
- PLATFORM_GUID = 4fe82b83-9315-4ff3-8cc0-ab77ca93cb7f
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
- SUPPORTED_ARCHITECTURES = ARM|AARCH64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = ArmPlatformPkg/ArmPlatformPkg.fdf
-
-[LibraryClasses.common]
- ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
-
-!if $(TARGET) == RELEASE
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-!else
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
-!endif
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
-
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
-
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
-
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
-
- #
- # Assume everything is fixed at build
- #
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
- # 1/123 faster than Stm or Vstm version
- #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
-
- # ARM Architectural Libraries
- CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
- CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
- ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
- DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
- ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
-
- SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
- RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
-
- # Networking Requirements for ArmPlatformPkg/Bds
- NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-
- # These libraries are used by the dynamic EFI Shell commands
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-
- # EBL Related Libraries
- EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
- EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
- EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
- EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
-
- #
- # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
- # in the debugger will show load and unload commands for symbols. You can cut and paste this
- # into the command window to load symbols. We should be able to use a script to do this, but
- # the version of RVD I have does not support scripts accessing system memory.
- #
- #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
- PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
- #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
- DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
-
- SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
-
- # BDS Libraries
- BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
-
-[LibraryClasses.ARM]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
- ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Lib.inf
-
-[LibraryClasses.AARCH64]
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
- ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
- ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
-
-[LibraryClasses.common.SEC]
- ArmPlatformSecLib|ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
- ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf
- ArmTrustedMonitorLib|ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf
-
- ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf
-
- DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
-
- ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
-
-[LibraryClasses.common.SEC, LibraryClasses.common.PEIM]
- MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
-
-[LibraryClasses.ARM.SEC]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf
-
-[LibraryClasses.AARCH64.SEC]
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf
-
-[LibraryClasses.common.PEI_CORE]
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
-
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- PeiServicesTablePointerLib|ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
-
-[LibraryClasses.common.PEIM]
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
-
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- PeiServicesTablePointerLib|ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
- PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
-
-[LibraryClasses.common.DXE_CORE]
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
-
-[LibraryClasses.common.DXE_DRIVER]
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-
-[LibraryClasses.common.UEFI_DRIVER]
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-
-[LibraryClasses.common.DXE_RUNTIME_DRIVER]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
-
-[LibraryClasses.ARM, LibraryClasses.AARCH64]
- #
- # It is not possible to prevent the ARM compiler for generic intrinsic functions.
- # This library provides the instrinsic functions generate by a given compiler.
- # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
- #
- NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
-
- # Add support for GCC stack protector
- NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
-
-[BuildOptions]
- XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7
-
- GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a
-
- RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
- gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
-
- #
- # Control what commands are supported from the UI
- # Turn these on and off to add features or save size
- #
- gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE
-
- gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
-
- # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
- gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
-
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
-
- gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Platform"
-
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmPlatform"
- gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
- gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
- gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
- gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
-
- # DEBUG_ASSERT_ENABLED 0x01
- # DEBUG_PRINT_ENABLED 0x02
- # DEBUG_CODE_ENABLED 0x04
- # CLEAR_MEMORY_ENABLED 0x08
- # ASSERT_BREAKPOINT_ENABLED 0x10
- # ASSERT_DEADLOOP_ENABLED 0x20
-!if $(TARGET) == RELEASE
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
-!else
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
-!endif
-
- # DEBUG_INIT 0x00000001 // Initialization
- # DEBUG_WARN 0x00000002 // Warnings
- # DEBUG_LOAD 0x00000004 // Load events
- # DEBUG_FS 0x00000008 // EFI File system
- # DEBUG_POOL 0x00000010 // Alloc & Free's
- # DEBUG_PAGE 0x00000020 // Alloc & Free's
- # DEBUG_INFO 0x00000040 // Verbose
- # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers
- # DEBUG_VARIABLE 0x00000100 // Variable
- # DEBUG_BM 0x00000400 // Boot Manager
- # DEBUG_BLKIO 0x00001000 // BlkIo Driver
- # DEBUG_NET 0x00004000 // SNI Driver
- # DEBUG_UNDI 0x00010000 // UNDI Driver
- # DEBUG_LOADFILE 0x00020000 // UNDI Driver
- # DEBUG_EVENT 0x00080000 // Event messages
- # DEBUG_ERROR 0x80000000 // Error
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
-
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
-
- gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
- gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
- gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
-
- #
- # Optional feature to help prevent EFI memory map fragments
- # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
- # Values are in EFI Pages (4K). DXE Core will make sure that
- # at least this much of each type of memory can be allocated
- # from a single memory range. This way you only end up with
- # maximum of two fragements for each type in the memory map
- # (the memory used, and the free memory that was prereserved
- # but not used).
- #
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
-
- # We want to use the Shell Libraries but don't want it to initialise
- # automatically. We initialise the libraries when the command is called by the
- # Shell.
- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
- #
- # ARM Pcds
- #
- gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000
-
- # Stacks for MPCores in Secure World
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0
- # Stacks for MPCores in Monitor Mode
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0
- # Stacks for MPCores in Normal World
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0
-
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0
- gArmTokenSpaceGuid.PcdSystemMemorySize|0
-
-################################################################################
-#
-# Components Section - list of all EDK II Modules needed by this Platform
-#
-################################################################################
-[Components.common]
-
- #
- # SEC
- #
- ArmPlatformPkg/Sec/Sec.inf {
- <LibraryClasses>
- # Use the implementation which set the Secure bits
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf
- }
-
- #
- # PEI Phase modules
- #
- ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf {
- <LibraryClasses>
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- }
- MdeModulePkg/Core/Pei/PeiMain.inf
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
- ArmPlatformPkg/PlatformPei/PlatformPeim.inf
- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
- ArmPkg/Drivers/CpuPei/CpuPei.inf
- IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- Nt32Pkg/BootModePei/BootModePei.inf
- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- }
-
- #
- # DXE
- #
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- }
-
- #
- # Architectural Protocols
- #
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
- EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
-
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- # Simple TextIn/TextOut for UEFI Terminal
- EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
-
- #
- # Semi-hosting filesystem
- #
- ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # Application
- #
- EmbeddedPkg/Ebl/Ebl.inf
-
- #
- # Bds
- #
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- ArmPlatformPkg/Bds/Bds.inf
-
- # Legacy Linux Loader
- ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg.fdf b/ArmPlatformPkg/ArmPlatformPkg.fdf
deleted file mode 100644
index 0dd98498f1..0000000000
--- a/ArmPlatformPkg/ArmPlatformPkg.fdf
+++ /dev/null
@@ -1,320 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-
-[FD.Sec_ArmPlatform_EFI]
-BaseAddress = 0xEC000000|gArmTokenSpaceGuid.PcdSecureFdBaseAddress #The base address of the Secure FLASH Device.
-Size = 0x00020000|gArmTokenSpaceGuid.PcdSecureFdSize #The size in bytes of the Secure FLASH Device
-ErasePolarity = 1
-BlockSize = 0x00002000
-NumBlocks = 0x10
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-
-0x00000000|0x00020000
-gArmTokenSpaceGuid.PcdSecureFvBaseAddress|gArmTokenSpaceGuid.PcdSecureFvSize
-FV = FVMAIN_SEC
-
-
-[FD.ArmPlatform_EFI]
-BaseAddress = 0xEC200000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
-Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
-ErasePolarity = 1
-
-# This one is tricky, it must be: BlockSize * NumBlocks = Size
-BlockSize = 0x00001000
-NumBlocks = 0x200
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-
-0x00000000|0x00200000
-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
-FV = FVMAIN_COMPACT
-
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-
-[FV.FVMAIN_SEC]
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/Sec/Sec.inf
-
-
-[FV.FvMain]
-BlockSize = 0x40
-NumBlocks = 0 # This FV gets compressed so make it just big enough
-FvAlignment = 8 # FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 8fa66cd0-f773-4f26-8f9f-5e54d0804c68
-
- INF MdeModulePkg/Core/Dxe/DxeMain.inf
-
- #
- # PI DXE Drivers producing Architectural Protocols (EFI Services)
- #
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
- INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
- INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- # Simple TextIn/TextOut for UEFI Terminal
- INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
-
- #
- # Semi-hosting filesystem (Required the Hardware Debugger to be connected)
- #
- INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- INF FatBinPkg/EnhancedFatDxe/Fat.inf
- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # UEFI application (Shell Embedded Boot Loader)
- #
- INF EmbeddedPkg/Ebl/Ebl.inf
-
- #
- # Bds
- #
- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- INF ArmPlatformPkg/Bds/Bds.inf
-
- # Legacy Linux Loader
- INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
-
-[FV.FVMAIN_COMPACT]
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
- INF MdeModulePkg/Core/Pei/PeiMain.inf
- INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
- INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
- INF ArmPkg/Drivers/CpuPei/CpuPei.inf
- INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FVMAIN
- }
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.ARM.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-# The AArch64 Vector Table requires a 2K alignment that is not supported by the FDF specification.
-# It is the reason 4K is used instead of 2K for the module alignment.
-[Rule.AARCH64.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 4K $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) {
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
- FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- UI STRING ="$(MODULE_NAME)" Optional
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
deleted file mode 100644
index 5503bbc300..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ /dev/null
@@ -1,296 +0,0 @@
-#
-# Copyright (c) 2012-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = ArmVExpressPkg-CTA15-A7
- PLATFORM_GUID = 0b511920-978d-4b34-acc0-3d9f8e6f9d81
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/ArmVExpress-CTA15-A7
- SUPPORTED_ARCHITECTURES = ARM
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
-
- DEFINE EDK2_SKIP_PEICORE = 1
- DEFINE ARM_BIGLITTLE_TC2 = 1 # We build for the TC2 hardware by default
-
-!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
-
-[LibraryClasses.common]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf
-
- ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
- NorFlashPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
-
- #DebugAgentTimerLib|ArmPlatformPkg/ArmVExpressPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf
-
- # ARM General Interrupt Driver in Secure and Non-secure
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
-
- LcdPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf
-
- TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
-
-[BuildOptions]
-!ifdef ARM_BIGLITTLE_TC2
- *_*_ARM_ARCHCC_FLAGS = -DARM_BIGLITTLE_TC2=1
- *_*_ARM_PP_FLAGS = -DARM_BIGLITTLE_TC2=1
-!endif
-
- RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7
-
- GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7
-
- XCODE:*_*_ARM_PLATFORM_FLAGS = -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec|TRUE
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|TRUE
-
- ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
- # It could be set FALSE to save size.
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express"
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-CTA15-A7"
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount|5
-
- #
- # NV Storage PCDs. Use base of 0x0C000000 for NOR1
- #
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
-
- gArmTokenSpaceGuid.PcdVFPEnabled|1
-
- # Stacks for MPCores in Secure World
- # SRAM (CS1) is only available between 0x14000000 and 0x14001000 on the model
- # ZBT SRAM is available between 0x2E000000 and 0x2E010000 on the model
-!ifdef ARM_BIGLITTLE_TC2
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0x17000000
-!else
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0x2E000000
-!endif
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize|0x8000
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize|0x1000
- # Share Monitor stacks with Secure World
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize|0
-
- # System Memory (1GB) - An additional 1GB will be added if UEFI is running on a 2GB Test Chip
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000
- gArmTokenSpaceGuid.PcdSystemMemorySize|0x40000000
-
-!ifdef ARM_BIGLITTLE_TC2
- # TC2 Dual-Cluster profile
- gArmPlatformTokenSpaceGuid.PcdClusterCount|2
-
- # Core Ids and Gic values
- # A15_0 = 0x000, GicCoreId = 0
- # A15_1 = 0x001, GicCoreId = 1
- # A7_0 = 0x100, GicCoreId = 2
- # A7_1 = 0x101, GicCoreId = 3
- # A7_2 = 0x102, GicCoreId = 4
- gArmTokenSpaceGuid.PcdArmPrimaryCore|0x100
-!endif
-
- #
- # SEC Phase Global Variables :
- # - 0x00-0x04: Debugger Exception Handler Pointer address
- # - 0x04-0x08: Normal Exception Handler Pointer
- # - 0x0C-0x10: MpSafe Serial Console SpinLock
- # - 0x10-0x20: KfScb 8 Bakery Locks of 2Bytes each
- # - 0x20-0x30: CCI 8 Bakery Locks of 2Bytes each
- # - 0x30-0x48: ARM SMC Events (8 cores * 3 max_event * sizeof(UINT8))
- gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize|0x48
-
- #
- # ARM PrimeCell
- #
-
- ## SP805 Watchdog - Motherboard Watchdog
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogBase|0x1C0F0000
-
- ## PL011 - Serial Terminal
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1C090000
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
-
- ## PL031 RealTimeClock
- gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
-
-!ifdef ARM_BIGLITTLE_TC2
- ## PL111 Lcd & HdLcd
- gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x1C1F0000
- gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x2B000000
- gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId|5
-!endif
-
- #
- # PL180 MMC/SD card controller
- #
- gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x1C010048
- gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x1C050000
-
-
- #
- # ARM General Interrupt Controller
- #
- gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C001000
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C002000
-
- # ISP1761 USB OTG Controller
- gEmbeddedTokenSpaceGuid.PcdIsp1761BaseAddress|0x1B000000
-
- # Ethernet (SMSC LAN9118)
- gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x1A000000
-
- #
- # Define the device path to the FDT for the platform
- #
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/ca15a7"
-
- #
- # ARM OS Loader
- #
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(73DCB643-3862-4904-9076-A94AF1890243)/LinuxLoader.efi"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/kernel -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""
-
- # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
- # PL111 - CLCD
- #gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
- # HDLCD
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi()"
-
- #
- # ARM Architectural Timer Frequency
- #
-!ifdef ARM_BIGLITTLE_TC2
- gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|24000000
-!else
- gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|10000000
-!endif
-
-################################################################################
-#
-# Components Section - list of all EDK II Modules needed by this Platform
-#
-################################################################################
-[Components.common]
- #
- # PEI Phase modules
- #
- ArmPlatformPkg/PrePi/PeiMPCore.inf {
- <LibraryClasses>
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
- }
-
- #
- # DXE
- #
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- }
-
- #
- # Architectural Protocols
- #
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
- }
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- #ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
- ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
-
- #
- # Platform
- #
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf
-
- #
- # Filesystems
- #
-!ifndef ARM_BIGLITTLE_TC2
- ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-!endif
-
- #
- # Multimedia Card Interface
- #
- EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
- ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
-
- # SMSC LAN 9118
- EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-
- #
- # Bds
- #
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- ArmPlatformPkg/Bds/Bds.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
deleted file mode 100644
index 5f4f5aaf49..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
+++ /dev/null
@@ -1,323 +0,0 @@
-#
-# Copyright (c) 2012-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-
-[FD.ARM_VEXPRESS_CTA15A7_EFI]
-BaseAddress = 0xB0000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in remapped DRAM.
-Size = 0x000C8000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
-ErasePolarity = 1
-BlockSize = 0x00001000
-NumBlocks = 0xC8
-
-0x00000000|0x000C8000
-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
-FV = FVMAIN_COMPACT
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-[FV.FvMain]
-BlockSize = 0x40
-NumBlocks = 0 # This FV gets compressed so make it just big enough
-FvAlignment = 8 # FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 73dcb643-3862-4904-9076-a94af1890243
-
- INF MdeModulePkg/Core/Dxe/DxeMain.inf
-
- #
- # PI DXE Drivers producing Architectural Protocols (EFI Services)
- #
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- #
- # Multiple Console IO support
- #
- INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- #INF ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
- INF ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
- INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
-
- #
- # Platform
- #
- INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf
-
- #
- # Multimedia Card Interface
- #
- INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
- INF ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
-
- #
- # Filesystems
- #
-!ifndef $(ARM_BIGLITTLE_TC2)
- INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-!endif
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- INF FatBinPkg/EnhancedFatDxe/Fat.inf
- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- # Versatile Express FileSystem
- INF ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
-
- #
- # USB support
- #
- INF EmbeddedPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.inf
-
- #
- # Android Fastboot
- #
- INF EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
- INF EmbeddedPkg/Drivers/AndroidFastbootTransportUsbDxe/FastbootTransportUsbDxe.inf
- INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf
-
- # ACPI Support
- INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-
- #
- # Networking stack
- #
- INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
- INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
- INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
- INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
- INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
- INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
- INF EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
-
- #
- # UEFI application
- #
- INF ShellBinPkg/UefiShell/UefiShell.inf
-
- #
- # Bds
- #
- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- INF ArmPlatformPkg/Bds/Bds.inf
-
- # Legacy Linux Loader
- INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
-
- # FV Filesystem
- INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
-
- #
- # FDT installation
- #
- # The UEFI driver is at the end of the list of the driver to be dispatched
- # after the device drivers (eg: Ethernet) to ensure we have support for them.
- INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
-
- # Example to add a Device Tree to the Firmware Volume
- #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA15x2A7x3) {
- # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/vexpress-v2p-ca15_a7.dtb
- #}
-
-[FV.FVMAIN_COMPACT]
-FvBaseAddress = 0xB0000000
-FvForceRebase = TRUE
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/PrePi/PeiMPCore.inf
-
- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FVMAIN
- }
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.Common.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) {
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
- FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- UI STRING ="$(MODULE_NAME)" Optional
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
- FILE APPLICATION = $(NAMED_GUID) {
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
deleted file mode 100644
index 5751167549..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ /dev/null
@@ -1,309 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = ArmVExpress-FVP-AArch64
- PLATFORM_GUID = 0de70077-9b3b-43bf-ba38-0ea37d77141b
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/ArmVExpress-FVP-AArch64
- SUPPORTED_ARCHITECTURES = AARCH64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
-
-!ifndef ARM_FVP_RUN_NORFLASH
- DEFINE EDK2_SKIP_PEICORE=1
-!endif
-
-
-!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
-
-[LibraryClasses.common]
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
- ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
-
- ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
- NorFlashPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
- LcdPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf
-
- TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
-
- # Virtio Support
- VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
- VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
-
-[LibraryClasses.common.SEC]
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf
- ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
-
-[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER]
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-
-[BuildOptions]
- GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM
-
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
-
- ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
- # It could be set FALSE to save size.
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
-
- # Force the UEFI GIC driver to use GICv2 legacy mode. To use
- # GICv3 without GICv2 legacy in UEFI, the ARM Trusted Firmware needs
- # to configure the Non-Secure interrupts in the GIC Redistributors
- # which is not supported at the moment.
- gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Fixed Virtual Platform"
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ARM-FVP"
-
- # Up to 8 cores on Base models. This works fine if model happens to have less.
- gArmPlatformTokenSpaceGuid.PcdCoreCount|8
- gArmPlatformTokenSpaceGuid.PcdClusterCount|2
-
- #
- # NV Storage PCDs. Use base of 0x0C000000 for NOR1
- #
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
-
- gArmTokenSpaceGuid.PcdVFPEnabled|1
-
- # FVP models can have 2 clusters with 4 cpus each
- # Stacks for MPCores in Secure World
- # Trusted SRAM (DRAM on Foundation model)
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0x04000000
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize|0x1000
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize|0x800
-
- # Stacks for MPCores in Normal World
- # Non-Trusted SRAM
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x2E000000
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize|0x1000
-
- # System Memory (2GB - 16MB of Trusted DRAM at the top of the 32bit address space)
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000
- gArmTokenSpaceGuid.PcdSystemMemorySize|0x7F000000
-
- # Size of the region used by UEFI in permanent memory (Reserved 64MB)
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
-
- #
- # ARM Pcds
- #
- gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000
-
- ## Trustzone enable (to make the transition from EL3 to NS EL2 in ArmPlatformPkg/Sec)
- gArmTokenSpaceGuid.PcdTrustzoneSupport|TRUE
-
- #
- # ARM PrimeCell
- #
-
- ## SP805 Watchdog - Motherboard Watchdog at 24MHz
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogBase|0x1C0F0000
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogClockFrequencyInHz|24000000
-
- ## PL011 - Serial Terminal
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c090000
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
-
- ## PL031 RealTimeClock
- gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
-
- ## PL111 Versatile Express Motherboard controller
- gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x1C1F0000
-
- ## PL180 MMC/SD card controller
- gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x1C010048
- gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x1C050000
-
- #
- # ARM General Interrupt Controller
- #
-!ifdef ARM_FVP_LEGACY_GICV2_LOCATION
- gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C001000
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C002000
-!else
- gArmTokenSpaceGuid.PcdGicDistributorBase|0x2f000000
- gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x2f100000
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C000000
-!endif
-
- #
- # ARM OS Loader
- #
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/LinuxLoader.efi"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -f VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz -c \"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9\""
-
- # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi()"
-
- #
- # ARM Architectural Timer Frequency
- #
- # Set tick frequency value to 100Mhz
- gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000
-
-[PcdsDynamicDefault.common]
- #
- # The size of a dynamic PCD of the (VOID*) type can not be increased at run
- # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128
- # character "empty" string, to allow to be able to set FDT text device paths
- # up to 128 characters long.
- #
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" "
-
-################################################################################
-#
-# Components Section - list of all EDK II Modules needed by this Platform
-#
-################################################################################
-[Components.common]
-
- #
- # SEC
- #
- ArmPlatformPkg/Sec/Sec.inf {
- <LibraryClasses>
- # Use the implementation which set the Secure bits
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf
- }
-
- #
- # PEI Phase modules
- #
-!ifdef EDK2_SKIP_PEICORE
- # UEFI is placed in RAM by bootloader
- ArmPlatformPkg/PrePi/PeiMPCore.inf {
- <LibraryClasses>
- ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
- }
-!else
- # UEFI lives in FLASH and copies itself to RAM
- ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf {
- <LibraryClasses>
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- }
- MdeModulePkg/Core/Pei/PeiMain.inf
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
- ArmPlatformPkg/PlatformPei/PlatformPeim.inf
- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
- ArmPkg/Drivers/CpuPei/CpuPei.inf
- IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- Nt32Pkg/BootModePei/BootModePei.inf
- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- }
-!endif
-
- #
- # DXE
- #
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- }
-
- #
- # Architectural Protocols
- #
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
- }
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
- ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
-
- #
- # Semi-hosting filesystem
- #
- ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # Multimedia Card Interface
- #
- EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
- ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
-
- #
- # Platform Driver
- #
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
- OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # Bds
- #
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- ArmPlatformPkg/Bds/Bds.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
deleted file mode 100644
index d527da0738..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
+++ /dev/null
@@ -1,381 +0,0 @@
-#
-# Copyright (c) 2011 - 2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-
-[FD.FVP_AARCH64_EFI_SEC]
-BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in SecureROM.
-Size = 0x04000000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the device (64MiB).
-ErasePolarity = 1
-
-# This one is tricky, it must be: BlockSize * NumBlocks = Size
-BlockSize = 0x00001000
-NumBlocks = 0x4000
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-
-0x00000000|0x00080000
-gArmTokenSpaceGuid.PcdSecureFvBaseAddress|gArmTokenSpaceGuid.PcdSecureFvSize
-FV = FVMAIN_SEC
-
-[FD.FVP_AARCH64_EFI]
-!ifdef ARM_FVP_RUN_NORFLASH
-BaseAddress = 0x08000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in Flash0.
-!else
-BaseAddress = 0x88000000|gArmTokenSpaceGuid.PcdFdBaseAddress # UEFI in DRAM + 128MB.
-!endif
-Size = 0x04000000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the device (64MiB).
-ErasePolarity = 1
-
-# This one is tricky, it must be: BlockSize * NumBlocks = Size
-BlockSize = 0x00001000
-NumBlocks = 0x4000
-
-0x00000000|0x00280000
-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
-FV = FVMAIN_COMPACT
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-
-[FV.FVMAIN_SEC]
-FvBaseAddress = 0x0 # Secure ROM
-FvForceRebase = TRUE
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/Sec/Sec.inf
-
-
-[FV.FvMain]
-BlockSize = 0x40
-NumBlocks = 0 # This FV gets compressed so make it just big enough
-FvAlignment = 16 # FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 87940482-fc81-41c3-87e6-399cf85ac8a0
-
- APRIORI DXE {
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- }
-
- INF MdeModulePkg/Core/Dxe/DxeMain.inf
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-
- #
- # PI DXE Drivers producing Architectural Protocols (EFI Services)
- #
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- #
- # Multiple Console IO support
- #
- INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- INF ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
- INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
-
- #
- # Semi-hosting filesystem
- #
- INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- INF FatBinPkg/EnhancedFatDxe/Fat.inf
- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # Multimedia Card Interface
- #
- INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
- INF ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
-
- #
- # Platform Driver
- #
- INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
- INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
-
- #
- # UEFI application (Shell Embedded Boot Loader)
- #
- INF ShellBinPkg/UefiShell/UefiShell.inf
-
- #
- # Bds
- #
- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- INF ArmPlatformPkg/Bds/Bds.inf
-
- # Legacy Linux Loader
- INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
-
- # FV Filesystem
- INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
-
- #
- # FDT installation
- #
- # The UEFI driver is at the end of the list of the driver to be dispatched
- # after the device drivers (eg: Ethernet) to ensure we have support for them.
- INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
-
-!ifdef $(DTB_DIR)
- #
- # Embed flattened device tree (FDT) images for all known
- # variants of this platform
- #
- FILE RAW = PCD (gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2) {
- $(DTB_DIR)/fvp-base-gicv2-psci.dtb
- }
- FILE RAW = PCD (gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2Legacy) {
- $(DTB_DIR)/fvp-base-gicv2legacy-psci.dtb
- }
- FILE RAW = PCD (gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV3) {
- $(DTB_DIR)/fvp-base-gicv3-psci.dtb
- }
- FILE RAW = PCD (gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2) {
- $(DTB_DIR)/fvp-foundation-gicv2-psci.dtb
- }
- FILE RAW = PCD (gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2Legacy) {
- $(DTB_DIR)/fvp-foundation-gicv2legacy-psci.dtb
- }
- FILE RAW = PCD (gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV3) {
- $(DTB_DIR)/fvp-foundation-gicv3-psci.dtb
- }
-!endif
-
-[FV.FVMAIN_COMPACT]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
-!if $(EDK2_SKIP_PEICORE) == 1
- INF ArmPlatformPkg/PrePi/PeiMPCore.inf
-!else
- INF ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
- INF MdeModulePkg/Core/Pei/PeiMain.inf
- INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
- INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
- INF ArmPkg/Drivers/CpuPei/CpuPei.inf
- INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-!endif
-
- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FVMAIN
- }
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.Common.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED {
- TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) FIXED {
- TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) FIXED {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
- FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- UI STRING ="$(MODULE_NAME)" Optional
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
- FILE APPLICATION = $(NAMED_GUID) {
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
deleted file mode 100644
index a8e326902e..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ /dev/null
@@ -1,301 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = ArmVExpressPkg-RTSM-A15_MPCore
- PLATFORM_GUID = 3a91a0f8-3af4-409d-a71d-a199dc134357
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A15_MPCore
- SUPPORTED_ARCHITECTURES = ARM
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
-
-!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
-
-[LibraryClasses.common]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
- ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
-
- ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
- NorFlashPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
- LcdPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf
-
- #DebugAgentTimerLib|ArmPlatformPkg/ArmVExpressPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf
-
- TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
-
- # Virtio Support
- VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
- VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
-
-[LibraryClasses.common.SEC]
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf
- ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
-
-[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER]
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-
-[BuildOptions]
- RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM
-
- GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM
-
- XCODE:*_*_ARM_PLATFORM_FLAGS = -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
-!ifdef EDK2_SKIP_PEICORE
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec|TRUE
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|TRUE
-!endif
-
- ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
- # It could be set FALSE to save size.
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express"
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-RTSM"
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount|2
-
- #
- # NV Storage PCDs. Use base of 0x0C000000 for NOR1
- #
-!if $(EDK2_ARMVE_SUPPORT_QEMU) == 1
- # QEMU only models a single flash block size, so use larger blocks
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FF00000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00040000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FF40000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00040000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FF80000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00040000
-!else
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
-!endif
-
- gArmTokenSpaceGuid.PcdVFPEnabled|1
-
- # Stacks for MPCores in Secure World
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0x2E009000
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize|0x1000
-
- # Stacks for MPCores in Monitor Mode
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0x2E008000
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize|0x100
-
- # Stacks for MPCores in Normal World
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x2E000000
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
-
- # System Memory (1GB)
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000
- gArmTokenSpaceGuid.PcdSystemMemorySize|0x40000000
-
- # Size of the region used by UEFI in permanent memory (Reserved 64MB)
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
-
- #
- # ARM Pcds
- #
- gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000
-
- #
- # ARM PrimeCell
- #
-
- ## SP805 Watchdog - Motherboard Watchdog
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogBase|0x1C0F0000
-
- ## PL011 - Serial Terminal
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c090000
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
-
- ## PL031 RealTimeClock
- gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
-
- ## PL111 Versatile Express Motherboard controller
- gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x1C1F0000
-
- ## PL180 MMC/SD card controller
- gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x1C010048
- gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x1C050000
-
- #
- # ARM General Interrupt Controller
- #
- gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C001000
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C002000
-
- #
- # ARM OS Loader
- #
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(12C68BE9-0996-49D3-8C5B-4957379027EE)/LinuxLoader.efi"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""
-
- # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi()"
-
- #
- # ARM Architectural Timer Frequency
- #
- gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000
-
-[PcdsDynamicDefault.common]
- #
- # The size of a dynamic PCD of the (VOID*) type can not be increased at run
- # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128
- # character "empty" string, to allow to be able to set FDT text device paths
- # up to 128 characters long.
- #
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" "
-
-################################################################################
-#
-# Components Section - list of all EDK II Modules needed by this Platform
-#
-################################################################################
-[Components.common]
-
- #
- # SEC
- #
- ArmPlatformPkg/Sec/Sec.inf {
- <LibraryClasses>
- # Use the implementation which set the Secure bits
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf
- }
-
- #
- # PEI Phase modules
- #
-!ifdef EDK2_SKIP_PEICORE
- ArmPlatformPkg/PrePi/PeiMPCore.inf {
- <LibraryClasses>
- ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
- ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
- }
-!else
- ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf {
- <LibraryClasses>
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- }
- MdeModulePkg/Core/Pei/PeiMain.inf
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
- ArmPlatformPkg/PlatformPei/PlatformPeim.inf
- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
- ArmPkg/Drivers/CpuPei/CpuPei.inf
- IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- Nt32Pkg/BootModePei/BootModePei.inf
- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- }
-!endif
-
- #
- # DXE
- #
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- }
-
- #
- # Architectural Protocols
- #
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
- }
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
- ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
-
- #
- # Semi-hosting filesystem
- #
- ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # Multimedia Card Interface
- #
- EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
- ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
-
- #
- # Platform Driver
- #
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
- OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- #
- # Bds
- #
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- ArmPlatformPkg/Bds/Bds.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
deleted file mode 100644
index ee50af2115..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
+++ /dev/null
@@ -1,365 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-
-[FD.RTSM_VE_Cortex-A15_MPCore_EFI]
-BaseAddress = 0x08000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
-Size = 0x00300000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
-ErasePolarity = 1
-
-# This one is tricky, it must be: BlockSize * NumBlocks = Size
-BlockSize = 0x00001000
-NumBlocks = 0x300
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-
-0x00000000|0x00080000
-gArmTokenSpaceGuid.PcdSecureFvBaseAddress|gArmTokenSpaceGuid.PcdSecureFvSize
-FV = FVMAIN_SEC
-
-0x00080000|0x00280000
-gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
-FV = FVMAIN_COMPACT
-
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-
-[FV.FVMAIN_SEC]
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
- INF ArmPlatformPkg/Sec/Sec.inf
-
-
-[FV.FvMain]
-BlockSize = 0x40
-NumBlocks = 0 # This FV gets compressed so make it just big enough
-FvAlignment = 8 # FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 12c68be9-0996-49d3-8c5b-4957379027ee
-
- APRIORI DXE {
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- }
-
- INF MdeModulePkg/Core/Dxe/DxeMain.inf
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-
- #
- # PI DXE Drivers producing Architectural Protocols (EFI Services)
- #
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
- INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
- INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
- INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
-
- INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-
- #
- # Networking stack
- #
- INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
- INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
- INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
- INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
- INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
- INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
- INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-
- #
- # Multiple Console IO support
- #
- INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
-
- INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
- INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
- INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
- INF ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
- INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
-
- #
- # Semi-hosting filesystem
- #
- INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
-
- #
- # FAT filesystem + GPT/MBR partitioning
- #
- INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- INF FatBinPkg/EnhancedFatDxe/Fat.inf
- INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-
- # Versatile Express FileSystem
- INF ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
-
- #
- # Multimedia Card Interface
- #
- INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
- INF ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
-
- #
- # Platform Driver
- #
- INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
- INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
-
- #
- # UEFI application (Shell Embedded Boot Loader)
- #
- INF ShellBinPkg/UefiShell/UefiShell.inf
-
- #
- # Bds
- #
- INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- INF ArmPlatformPkg/Bds/Bds.inf
-
- # FV Filesystem
- INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
-
- #
- # FDT installation
- #
- # The UEFI driver is at the end of the list of the driver to be dispatched
- # after the device drivers (eg: Ethernet) to ensure we have support for them.
- INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
-
- # Example to add a Device Tree to the Firmware Volume
- #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x4) {
- # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x4.dtb
- #}
-
- # Legacy Linux Loader
- INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
-
-[FV.FVMAIN_COMPACT]
-FvAlignment = 8
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
-!if $(EDK2_SKIP_PEICORE) == 1
- INF ArmPlatformPkg/PrePi/PeiMPCore.inf
-!else
- INF ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
- INF MdeModulePkg/Core/Pei/PeiMain.inf
- INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
- INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
- INF ArmPkg/Drivers/CpuPei/CpuPei.inf
- INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-!endif
-
- FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
- SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FVMAIN
- }
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.Common.SEC]
- FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
- TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) {
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
- FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- UI STRING ="$(MODULE_NAME)" Optional
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
- FILE APPLICATION = $(NAMED_GUID) {
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
deleted file mode 100644
index 05cf0badf7..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
+++ /dev/null
@@ -1,440 +0,0 @@
-#
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-# Copyright (c) 2015, Intel Corporation. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-[BuildOptions.AARCH64.EDKII.DXE_RUNTIME_DRIVER]
- GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
-
-[LibraryClasses.common]
-!if $(TARGET) == RELEASE
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-!else
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
-!endif
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
-
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
-
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
-
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
-
- #
- # Assume everything is fixed at build
- #
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
- # 1/123 faster than Stm or Vstm version
- #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
-
- # Networking Requirements
- NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
- DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
- UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
- IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-
- # ARM Architectural Libraries
- CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
- CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
- ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
- DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
- ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
- ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
- ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
-
- # Versatile Express Specific Libraries
- PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
- ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
- NorFlashPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
- EfiResetSystemLib|ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf
- # ARM PL111 Lcd Driver
- LcdPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf
- # ARM PL031 RTC Driver
- RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
- # ARM PL354 SMC Driver
- PL35xSmcLib|ArmPlatformPkg/Drivers/PL35xSmc/PL35xSmc.inf
- # ARM PL011 UART Driver
- PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
- SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
- # ARM SP804 Dual Timer Driver
- TimerLib|ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
-
- # EBL Related Libraries
- EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
- EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
- EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
- EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
-
- #
- # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
- # in the debugger will show load and unload commands for symbols. You can cut and paste this
- # into the command window to load symbols. We should be able to use a script to do this, but
- # the version of RVD I have does not support scripts accessing system memory.
- #
- #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
- PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
- #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
- DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
-
- SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
-
- # BDS Libraries
- BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
-
- AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
-
- # RunAxf support via Dynamic Shell Command protocol
- # It uses the Shell libraries.
- ArmShellCmdRunAxfLib|ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-
- TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
- AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
- VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
-
-[LibraryClasses.common.SEC]
- ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf
-
- DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
-
-!ifdef $(EDK2_SKIP_PEICORE)
- PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
- ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
- LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
- HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
- PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
-!endif
-
- # Trustzone Support
- ArmTrustedMonitorLib|ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf
-
- ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
-
-[LibraryClasses.common.PEI_CORE]
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
-
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- PeiServicesTablePointerLib|ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
-
-[LibraryClasses.common.PEIM]
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
-
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
- PeiServicesTablePointerLib|ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
-
-[LibraryClasses.common.SEC, LibraryClasses.common.PEIM]
- MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
-
-[LibraryClasses.common.DXE_CORE]
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
-
-[LibraryClasses.common.DXE_DRIVER]
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-
-[LibraryClasses.common.UEFI_DRIVER]
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-
-[LibraryClasses.common.DXE_RUNTIME_DRIVER]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
- ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf
-
-[LibraryClasses.AARCH64.DXE_RUNTIME_DRIVER]
- #
- # PSCI support in EL3 may not be available if we are not running under a PSCI
- # compliant secure firmware, but since the default VExpress EfiResetSystemLib
- # cannot be supported at runtime (due to the fact that the syscfg MMIO registers
- # cannot be runtime remapped), it is our best bet to get ResetSystem functionality
- # on these platforms.
- #
- EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
-
-[LibraryClasses.ARM, LibraryClasses.AARCH64]
- #
- # It is not possible to prevent the ARM compiler for generic intrinsic functions.
- # This library provides the instrinsic functions generate by a given compiler.
- # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
- #
- NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
-
- # Add support for GCC stack protector
- NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
-
-
-[BuildOptions]
- RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
-
- GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsFeatureFlag.common]
- gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
-
- #
- # Control what commands are supported from the UI
- # Turn these on and off to add features or save size
- #
- gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE
- gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE
-
- gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
-
- # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
- gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
-
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
-
- gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
-
-[PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express"
-!ifdef $(FIRMWARE_VER)
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
-!endif
-
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"VExpress"
- gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
- gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
- gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
- gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
- gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
-
- # DEBUG_ASSERT_ENABLED 0x01
- # DEBUG_PRINT_ENABLED 0x02
- # DEBUG_CODE_ENABLED 0x04
- # CLEAR_MEMORY_ENABLED 0x08
- # ASSERT_BREAKPOINT_ENABLED 0x10
- # ASSERT_DEADLOOP_ENABLED 0x20
-!if $(TARGET) == RELEASE
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
-!else
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
-!endif
-
- # DEBUG_INIT 0x00000001 // Initialization
- # DEBUG_WARN 0x00000002 // Warnings
- # DEBUG_LOAD 0x00000004 // Load events
- # DEBUG_FS 0x00000008 // EFI File system
- # DEBUG_POOL 0x00000010 // Alloc & Free's
- # DEBUG_PAGE 0x00000020 // Alloc & Free's
- # DEBUG_INFO 0x00000040 // Verbose
- # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers
- # DEBUG_VARIABLE 0x00000100 // Variable
- # DEBUG_BM 0x00000400 // Boot Manager
- # DEBUG_BLKIO 0x00001000 // BlkIo Driver
- # DEBUG_NET 0x00004000 // SNI Driver
- # DEBUG_UNDI 0x00010000 // UNDI Driver
- # DEBUG_LOADFILE 0x00020000 // UNDI Driver
- # DEBUG_EVENT 0x00080000 // Event messages
- # DEBUG_GCD 0x00100000 // Global Coherency Database changes
- # DEBUG_CACHE 0x00200000 // Memory range cachability changes
- # DEBUG_ERROR 0x80000000 // Error
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
-
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
-
- gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
- gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
- gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
-
- #
- # Optional feature to help prevent EFI memory map fragments
- # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
- # Values are in EFI Pages (4K). DXE Core will make sure that
- # at least this much of each type of memory can be allocated
- # from a single memory range. This way you only end up with
- # maximum of two fragements for each type in the memory map
- # (the memory used, and the free memory that was prereserved
- # but not used).
- #
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|65
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
-
- # Device path of block device on which Android Fastboot should flash
- # partitions. We just use the SD card on VExpress.
- gArmVExpressTokenSpaceGuid.PcdAndroidFastbootNvmDevicePath|L"VenHw(09831032-6FA3-4484-AF4F-0A000A8D3A82)"
-
- #
- # ARM Pcds
- #
- gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000
-
- #
- # ARM PrimeCell
- #
-
- #
- # FileSystem
- #
-
- # List of Device Paths that support BootMonFs
- gArmPlatformTokenSpaceGuid.PcdBootMonFsSupportedDevicePaths|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59);VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)"
-
- #
- # ARM OS Loader
- #
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
-
- # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi()"
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
-
- # RunAxf support via Dynamic Shell Command protocol
- # We want to use the Shell Libraries but don't want it to initialise
- # automatically. We initialise the libraries when the command is called by the
- # Shell.
- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
-
-[Components.common]
- MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-
- # Versatile Express FileSystem
- ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
-
- #
- # Networking stack
- #
- MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
- MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
- MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
- MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
- MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-
- # ISP1761 USB OTG Controller
- EmbeddedPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.inf
-
- #
- # Android Fastboot
- #
- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
- EmbeddedPkg/Drivers/AndroidFastbootTransportUsbDxe/FastbootTransportUsbDxe.inf
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf
-
- # FV Filesystem
- MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
-
- #
- # FDT installation
- #
- EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
-
- # Legacy Linux Loader
- ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c
deleted file mode 100644
index c368957dcd..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/** @file
-
- Copyright (c) 2014-2015, ARM Ltd. All rights reserved.
-
- This program and the accompanying materials are licensed and made available
- under the terms and conditions of the BSD License which accompanies this
- distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmVExpressInternal.h"
-#include <Library/ArmGicLib.h>
-
-//
-// Description of the AARCH64 model platforms :
-// Platform ids are defined in ArmVExpressInternal.h for
-// all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,
-// model or hardware platforms).
-//
-CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {
- { ARM_FVP_VEXPRESS_AEMv8x4, FixedPcdGetPtr (PcdFdtFvpVExpressAEMv8x4), L"rtsm_ve-aemv8a.dtb" },
- { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4GicV2), L"fvp-base-gicv2-psci.dtb" },
- { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4GicV2Legacy), L"fvp-base-gicv2legacy-psci.dtb" },
- { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4GicV3), L"fvp-base-gicv3-psci.dtb" },
- { ARM_FVP_FOUNDATION_GICV2, FixedPcdGetPtr (PcdFdtFvpFoundationGicV2), L"fvp-foundation-gicv2-psci.dtb" },
- { ARM_FVP_FOUNDATION_GICV2_LEGACY, FixedPcdGetPtr (PcdFdtFvpFoundationGicV2Legacy), L"fvp-foundation-gicv2legacy-psci.dtb" },
- { ARM_FVP_FOUNDATION_GICV3, FixedPcdGetPtr (PcdFdtFvpFoundationGicV3), L"fvp-foundation-gicv3-psci.dtb" },
- { ARM_FVP_VEXPRESS_UNKNOWN }
-};
-
-/**
- Get information about the VExpress platform the firmware is running on.
-
- @param[out] Platform Address where the pointer to the platform information
- (type ARM_VEXPRESS_PLATFORM*) should be stored.
- The returned pointer does not point to an allocated
- memory area.
-
- @retval EFI_SUCCESS The platform information was returned.
- @retval EFI_NOT_FOUND The platform was not recognised.
-
-**/
-EFI_STATUS
-ArmVExpressGetPlatform (
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform
- )
-{
- EFI_STATUS Status;
- UINT32 SysId;
- UINT32 FvpSysId;
- UINT32 VariantSysId;
- ARM_GIC_ARCH_REVISION GicRevision;
-
- ASSERT (Platform != NULL);
-
- Status = EFI_NOT_FOUND;
-
- SysId = MmioRead32 (ARM_VE_SYS_ID_REG);
- if (SysId != ARM_RTSM_SYS_ID) {
- // Remove the GIC variant to identify if we are running on the FVP Base or
- // Foundation models
- FvpSysId = SysId & (ARM_FVP_SYS_ID_HBI_MASK |
- ARM_FVP_SYS_ID_PLAT_MASK );
- // Extract the variant from the SysId
- VariantSysId = SysId & ARM_FVP_SYS_ID_VARIANT_MASK;
-
- if (FvpSysId == ARM_FVP_BASE_BOARD_SYS_ID) {
- if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {
- // FVP Base Model with legacy GIC memory map
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, Platform);
- } else {
- GicRevision = ArmGicGetSupportedArchRevision ();
-
- if (GicRevision == ARM_GIC_ARCH_REVISION_2) {
- // FVP Base Model with GICv2 support
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, Platform);
- } else {
- // FVP Base Model with GICv3 support
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, Platform);
- }
- }
- } else if (FvpSysId == ARM_FVP_FOUNDATION_BOARD_SYS_ID) {
- if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {
- // FVP Foundation Model with legacy GIC memory map
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2_LEGACY, Platform);
- } else {
- GicRevision = ArmGicGetSupportedArchRevision ();
-
- if (GicRevision == ARM_GIC_ARCH_REVISION_2) {
- // FVP Foundation Model with GICv2
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2, Platform);
- } else {
- // FVP Foundation Model with GICv3
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV3, Platform);
- }
- }
- }
- } else {
- // FVP Versatile Express AEMv8
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform);
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Unsupported AArch64 RTSM (SysId:0x%X).\n", SysId));
- ASSERT_EFI_ERROR (Status);
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c
deleted file mode 100644
index 2057c6e215..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-
- Copyright (c) 2014, ARM Ltd. All rights reserved.
-
- This program and the accompanying materials are licensed and made available
- under the terms and conditions of the BSD License which accompanies this
- distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmVExpressInternal.h"
-#include <Library/ArmPlatformLib.h> // To get Core Count
-
-//
-// Description of the four ARM model platforms :
-// Platform ids are defined in ArmVExpressInternal.h for
-// all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,
-// model or hardware platforms).
-//
-CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {
- { ARM_FVP_VEXPRESS_A9x4, FixedPcdGetPtr (PcdFdtVExpressFvpA9x4), L"rtsm_ve-cortex_a9x4.dtb" },
- { ARM_FVP_VEXPRESS_A15x1, FixedPcdGetPtr (PcdFdtVExpressFvpA15x1), L"rtsm_ve-cortex_a15x1.dtb" },
- { ARM_FVP_VEXPRESS_A15x2, FixedPcdGetPtr (PcdFdtVExpressFvpA15x2), L"rtsm_ve-cortex_a15x2.dtb" },
- { ARM_FVP_VEXPRESS_A15x4, FixedPcdGetPtr (PcdFdtVExpressFvpA15x4), L"rtsm_ve-cortex_a15x4.dtb" },
- { ARM_FVP_VEXPRESS_UNKNOWN, }
-};
-
-/**
- Get information about the VExpress platform the firmware is running on.
-
- @param[out] Platform Address where the pointer to the platform information
- (type ARM_VEXPRESS_PLATFORM*) should be stored.
- The returned pointer does not point to an allocated
- memory area.
-
- @retval EFI_SUCCESS The platform information was returned.
- @retval EFI_NOT_FOUND The platform was not recognised.
-
-**/
-EFI_STATUS
-ArmVExpressGetPlatform (
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform
- )
-{
- UINT32 SysId;
- UINTN CpuType;
- EFI_STATUS Status;
- UINTN CoreCount;
-
- ASSERT (Platform != NULL);
-
- CpuType = 0;
- Status = EFI_NOT_FOUND;
- *Platform = NULL;
-
- SysId = MmioRead32 (ARM_VE_SYS_ID_REG);
- if (SysId == ARM_RTSM_SYS_ID) {
- // Get the Cortex-A version
- CpuType = (ArmReadMidr () >> 4) & ARM_CPU_TYPE_MASK;
- if (CpuType == ARM_CPU_TYPE_A9) {
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A9x4, Platform);
- } else if (CpuType == ARM_CPU_TYPE_A15) {
- CoreCount = ArmGetCpuCountPerCluster ();
- if (CoreCount == 1) {
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A15x1, Platform);
- } else if (CoreCount == 2) {
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A15x2, Platform);
- } else if (CoreCount == 4) {
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A15x4, Platform);
- }
- }
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Unsupported platform (SysId:0x%X, CpuType:0x%X)\n", SysId, CpuType));
- ASSERT_EFI_ERROR (Status);
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c
deleted file mode 100644
index 8c42814a04..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/** @file
-
- Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmVExpressInternal.h"
-
-#include <PiDxe.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/VirtioMmioDeviceLib.h>
-#include <Library/ArmShellCmdLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DevicePathLib.h>
-
-#include <Protocol/FirmwareVolume2.h>
-
-#define ARM_FVP_BASE_VIRTIO_BLOCK_BASE 0x1c130000
-
-#pragma pack(1)
-typedef struct {
- VENDOR_DEVICE_PATH Vendor;
- EFI_DEVICE_PATH_PROTOCOL End;
-} VIRTIO_BLK_DEVICE_PATH;
-#pragma pack()
-
-VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
-{
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8)( sizeof(VENDOR_DEVICE_PATH) ),
- (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- EFI_CALLER_ID_GUID,
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- sizeof (EFI_DEVICE_PATH_PROTOCOL),
- 0
- }
- }
-};
-
-STATIC
-EFI_STATUS
-InternalFindFdtByGuid (
- IN OUT EFI_DEVICE_PATH **FdtDevicePath,
- IN CONST EFI_GUID *FdtGuid
- )
-{
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileDevicePath;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;
- EFI_GUID NameGuid;
- UINTN Size;
- VOID *Key;
- EFI_FV_FILETYPE FileType;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- EFI_DEVICE_PATH *FvDevicePath;
- EFI_STATUS Status;
-
- if (FdtGuid == NULL) {
- return EFI_NOT_FOUND;
- }
-
- EfiInitializeFwVolDevicepathNode (&FileDevicePath, FdtGuid);
-
- HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolume2ProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiFirmwareVolume2ProtocolGuid,
- (VOID **) &FvProtocol
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Allocate Key
- Key = AllocatePool (FvProtocol->KeySize);
- ASSERT (Key != NULL);
- ZeroMem (Key, FvProtocol->KeySize);
-
- do {
- FileType = EFI_FV_FILETYPE_RAW;
- Status = FvProtocol->GetNextFile (FvProtocol, Key, &FileType, &NameGuid, &Attributes, &Size);
- if (Status == EFI_NOT_FOUND) {
- break;
- }
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Check whether this file is the one we are looking for. If so,
- // create a device path for it and return it to the caller.
- //
- if (CompareGuid (&NameGuid, FdtGuid)) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
- if (!EFI_ERROR (Status)) {
- *FdtDevicePath = AppendDevicePathNode (FvDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);
- }
- goto Done;
- }
- } while (TRUE);
- FreePool (Key);
- }
-
- if (Index == HandleCount) {
- Status = EFI_NOT_FOUND;
- }
- return Status;
-
-Done:
- FreePool (Key);
- return Status;
-}
-
-/**
- * Generic UEFI Entrypoint for 'ArmFvpDxe' driver
- * See UEFI specification for the details of the parameters
- */
-EFI_STATUS
-EFIAPI
-ArmFvpInitialise (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- CONST ARM_VEXPRESS_PLATFORM* Platform;
- EFI_STATUS Status;
- CHAR16 *TextDevicePath;
- UINTN TextDevicePathSize;
- VOID *Buffer;
- EFI_DEVICE_PATH *FdtDevicePath;
-
- Status = gBS->InstallProtocolInterface (&ImageHandle,
- &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
- &mVirtioBlockDevicePath);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = ArmVExpressGetPlatform (&Platform);
- if (!EFI_ERROR (Status)) {
- FdtDevicePath = NULL;
- Status = InternalFindFdtByGuid (&FdtDevicePath, Platform->FdtGuid);
- if (!EFI_ERROR (Status)) {
- TextDevicePath = ConvertDevicePathToText (FdtDevicePath, FALSE, FALSE);
- if (TextDevicePath != NULL) {
- TextDevicePathSize = StrSize (TextDevicePath);
- }
- FreePool (FdtDevicePath);
- } else {
- TextDevicePathSize = StrSize ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)) - sizeof (CHAR16);
- TextDevicePathSize += StrSize (Platform->FdtName);
-
- TextDevicePath = AllocatePool (TextDevicePathSize);
- if (TextDevicePath != NULL) {
- StrCpy (TextDevicePath, ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)));
- StrCat (TextDevicePath, Platform->FdtName);
- }
- }
- if (TextDevicePath != NULL) {
- Buffer = PcdSetPtr (PcdFdtDevicePaths, &TextDevicePathSize, TextDevicePath);
- if (Buffer == NULL) {
- DEBUG ((
- EFI_D_ERROR,
- "ArmFvpDxe: Setting of FDT device path in PcdFdtDevicePaths failed - %r\n", EFI_BUFFER_TOO_SMALL
- ));
- }
- FreePool (TextDevicePath);
- }
- }
-
- // Declare the Virtio BlockIo device
- Status = VirtioMmioInstallDevice (ARM_FVP_BASE_VIRTIO_BLOCK_BASE, ImageHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "ArmFvpDxe: Failed to install Virtio block device\n"));
- }
-
- // Install dynamic Shell command to run baremetal binaries.
- Status = ShellDynCmdRunAxfInstall (ImageHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "ArmFvpDxe: Failed to install ShellDynCmdRunAxf\n"));
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
deleted file mode 100644
index 327c5101dd..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf
+++ /dev/null
@@ -1,80 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = ArmFvpDxe
- FILE_GUID = 405b2307-6839-4d52-aeb9-bece64252800
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = ArmFvpInitialise
-
-[Sources.common]
- ArmFvpDxe.c
- ArmVExpressCommon.c
-
-[Sources.ARM]
- Arm/ArmFvpDxeArm.c
-
-[Sources.AARCH64]
- AArch64/ArmFvpDxeAArch64.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- OvmfPkg/OvmfPkg.dec
-
-[LibraryClasses]
- PcdLib
- ArmShellCmdRunAxfLib
- ArmLib
- ArmPlatformLib
- BaseMemoryLib
- DxeServicesTableLib
- MemoryAllocationLib
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- VirtioMmioDeviceLib
- DevicePathLib
-
-[LibraryClasses.AARCH64]
- ArmGicLib
-
-[Protocols]
- gEfiFirmwareVolume2ProtocolGuid
- gEfiDevicePathProtocolGuid
-
-[FixedPcd]
- gArmVExpressTokenSpaceGuid.PcdFvpFdtDevicePathsBase
-
-[FixedPcd.ARM]
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA9x4
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x1
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x2
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x4
-
-[FixedPcd.AARCH64]
- gArmVExpressTokenSpaceGuid.PcdFdtFvpVExpressAEMv8x4
- gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2
- gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2Legacy
- gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV3
- gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2
- gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2Legacy
- gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV3
-
-[Pcd]
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c
deleted file mode 100644
index 351c73312d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/** @file
-
- Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmVExpressInternal.h"
-#include <Library/ArmShellCmdLib.h>
-
-CONST EFI_GUID ArmHwA9x4Guid = { 0x2fd21cf6, 0xe6e8, 0x4ff2, { 0xa9, 0xca, 0x3b, 0x9f, 0x00, 0xe9, 0x28, 0x89 } };
-CONST EFI_GUID ArmHwA15x2A7x3Guid = { 0xd5e606eb, 0x83df, 0x4e90, { 0x81, 0xe8, 0xc3, 0xdb, 0x2f, 0x77, 0x17, 0x9a } };
-CONST EFI_GUID ArmHwA15Guid = { 0x6b8947c2, 0x4287, 0x4d91, { 0x8f, 0xe0, 0xa3, 0x81, 0xea, 0x5b, 0x56, 0x8f } };
-CONST EFI_GUID ArmHwA5Guid = { 0xa2cc7663, 0x4d7c, 0x448a, { 0xaa, 0xb5, 0x4c, 0x03, 0x4b, 0x6f, 0xda, 0xb7 } };
-CONST EFI_GUID NullGuid = { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } };
-
-//
-// Description of the four hardware platforms :
-// just the platform id for the time being.
-// Platform ids are defined in ArmVExpressInternal.h for
-// all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,
-// model or hardware platforms).
-//
-//Note: File extensions are stripped with the VExpress NOR Flash FileSystem
-CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {
- { ARM_HW_A9x4, &ArmHwA9x4Guid, L"ca9" },
- { ARM_HW_A15x2_A7x3, &ArmHwA15x2A7x3Guid, L"ca15a7" },
- { ARM_HW_A15, &ArmHwA15Guid, L"ca15a7" },
- { ARM_HW_A5, &ArmHwA5Guid, L"ca5s" },
- { ARM_FVP_VEXPRESS_UNKNOWN, &NullGuid, NULL }
-};
-
-/**
- Get information about the VExpress platform the firmware is running on.
-
- @param[out] Platform Address where the pointer to the platform information
- (type ARM_VEXPRESS_PLATFORM*) should be stored.
- The returned pointer does not point to an allocated
- memory area. Not used here.
-
- @retval EFI_NOT_FOUND The platform was not recognised.
-
-**/
-EFI_STATUS
-ArmVExpressGetPlatform (
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform
- )
-{
- return EFI_NOT_FOUND;
-}
-
-/**
- * Generic UEFI Entrypoint for 'ArmHwDxe' driver
- * See UEFI specification for the details of the parameters
- */
-EFI_STATUS
-EFIAPI
-ArmHwInitialise (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- // Install dynamic Shell command to run baremetal binaries.
- Status = ShellDynCmdRunAxfInstall (ImageHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "ArmHwDxe: Failed to install ShellDynCmdRunAxf\n"));
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf
deleted file mode 100644
index 1a007627ad..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = ArmHwDxe
- FILE_GUID = fe61bb5f-1b67-4c24-b346-73db42e873e5
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = ArmHwInitialise
-
-[Sources.common]
- ArmHwDxe.c
- ArmVExpressCommon.c
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- ArmShellCmdRunAxfLib
- DxeServicesTableLib
- MemoryAllocationLib
- UefiDriverEntryPoint
-
-[Protocols]
- gEfiDevicePathProtocolGuid
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressCommon.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressCommon.c
deleted file mode 100644
index e1cac7fb37..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressCommon.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
-
- Copyright (c) 2014, ARM Ltd. All rights reserved.
-
- This program and the accompanying materials are licensed and made available
- under the terms and conditions of the BSD License which accompanies this
- distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ArmVExpressInternal.h"
-
-/**
- Get information about the VExpress platform the firmware is running on given its Id.
-
- @param[in] PlatformId Id of the VExpress platform.
- @param[out] Platform Address where the pointer to the platform information
- (type ARM_VEXPRESS_PLATFORM*) should be stored.
- The returned pointer does not point to an allocated
- memory area.
-
- @retval EFI_SUCCESS The platform information was returned.
- @retval EFI_NOT_FOUND The platform was not recognised.
-
-**/
-EFI_STATUS
-ArmVExpressGetPlatformFromId (
- IN CONST ARM_VEXPRESS_PLATFORM_ID PlatformId,
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform
- )
-{
- UINTN Index;
-
- ASSERT (Platform != NULL);
-
- for (Index = 0; ArmVExpressPlatforms[Index].Id != ARM_FVP_VEXPRESS_UNKNOWN; Index++) {
- if (ArmVExpressPlatforms[Index].Id == PlatformId) {
- *Platform = &ArmVExpressPlatforms[Index];
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h
deleted file mode 100644
index e123eea2d2..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/** @file
-
- Copyright (c) 2014-2015, ARM Ltd. All rights reserved.
-
- This program and the accompanying materials are licensed and made available
- under the terms and conditions of the BSD License which accompanies this
- distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __ARM_VEXPRESS_INTERNAL_H__
-#define __ARM_VEXPRESS_INTERNAL_H__
-
-#include <Uefi.h>
-
-#include <Library/ArmLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include <VExpressMotherBoard.h>
-
-// This 'enum' is needed as variations based on existing platform exist
-typedef enum {
- ARM_FVP_VEXPRESS_UNKNOWN = 0,
- ARM_FVP_VEXPRESS_A9x4,
- ARM_FVP_VEXPRESS_A15x1,
- ARM_FVP_VEXPRESS_A15x2,
- ARM_FVP_VEXPRESS_A15x4,
- ARM_FVP_VEXPRESS_A15x1_A7x1,
- ARM_FVP_VEXPRESS_A15x4_A7x4,
- ARM_FVP_VEXPRESS_AEMv8x4,
- ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2,
- ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY,
- ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3,
- ARM_FVP_FOUNDATION_GICV2,
- ARM_FVP_FOUNDATION_GICV2_LEGACY,
- ARM_FVP_FOUNDATION_GICV3,
- ARM_HW_A9x4,
- ARM_HW_A15x2_A7x3,
- ARM_HW_A15,
- ARM_HW_A5
-} ARM_VEXPRESS_PLATFORM_ID;
-
-typedef struct {
- ARM_VEXPRESS_PLATFORM_ID Id;
-
- // Flattened Device Tree (FDT) File
- CONST EFI_GUID *FdtGuid; /// Name of the FDT when present into the FV
- CONST CHAR16 *FdtName; /// Name of the FDT when present into a File System
-} ARM_VEXPRESS_PLATFORM;
-
-// Array that contains the list of the VExpress based platform supported by this DXE driver
-extern CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[];
-
-/**
- Get information about the VExpress platform the firmware is running on given its Id.
-
- @param[in] PlatformId Id of the VExpress platform.
- @param[out] Platform Address where the pointer to the platform information
- (type ARM_VEXPRESS_PLATFORM*) should be stored.
- The returned pointer does not point to an allocated
- memory area.
-
- @retval EFI_SUCCESS The platform information was returned.
- @retval EFI_NOT_FOUND The platform was not recognised.
-
-**/
-EFI_STATUS
-ArmVExpressGetPlatformFromId (
- IN CONST ARM_VEXPRESS_PLATFORM_ID PlatformId,
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform
- );
-
-/**
-
- Get information about the VExpress platform the firmware is running on.
-
- @param[out] Platform Address where the pointer to the platform information
- (type ARM_VEXPRESS_PLATFORM*) should be stored.
- The returned pointer does not point to an allocated
- memory area.
-
- @retval EFI_SUCCESS The platform information was returned.
- @retval EFI_NOT_FOUND The platform was not recognised.
-
-**/
-EFI_STATUS
-ArmVExpressGetPlatform (
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform
- );
-
-#endif // __ARM_VEXPRESS_INTERNAL_H__
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c
deleted file mode 100644
index 4d0811cc5e..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/** @file
-
- Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-/*
- Implementation of the Android Fastboot Platform protocol, to be used by the
- Fastboot UEFI application, for ARM Versatile Express platforms.
-*/
-
-#include <Protocol/AndroidFastbootPlatform.h>
-#include <Protocol/BlockIo.h>
-#include <Protocol/DiskIo.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#define FLASH_DEVICE_PATH_SIZE(DevPath) ( GetDevicePathSize (DevPath) - \
- sizeof (EFI_DEVICE_PATH_PROTOCOL))
-
-#define PARTITION_NAME_MAX_LENGTH 72/2
-
-#define IS_ALPHA(Char) (((Char) <= L'z' && (Char) >= L'a') || \
- ((Char) <= L'Z' && (Char) >= L'Z'))
-
-typedef struct _FASTBOOT_PARTITION_LIST {
- LIST_ENTRY Link;
- CHAR16 PartitionName[PARTITION_NAME_MAX_LENGTH];
- EFI_HANDLE PartitionHandle;
-} FASTBOOT_PARTITION_LIST;
-
-STATIC LIST_ENTRY mPartitionListHead;
-
-/*
- Helper to free the partition list
-*/
-STATIC
-VOID
-FreePartitionList (
- VOID
- )
-{
- FASTBOOT_PARTITION_LIST *Entry;
- FASTBOOT_PARTITION_LIST *NextEntry;
-
- Entry = (FASTBOOT_PARTITION_LIST *) GetFirstNode (&mPartitionListHead);
- while (!IsNull (&mPartitionListHead, &Entry->Link)) {
- NextEntry = (FASTBOOT_PARTITION_LIST *) GetNextNode (&mPartitionListHead, &Entry->Link);
-
- RemoveEntryList (&Entry->Link);
- FreePool (Entry);
-
- Entry = NextEntry;
- }
-}
-/*
- Read the PartitionName fields from the GPT partition entries, putting them
- into an allocated array that should later be freed.
-*/
-STATIC
-EFI_STATUS
-ReadPartitionEntries (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- OUT EFI_PARTITION_ENTRY **PartitionEntries
- )
-{
- UINTN EntrySize;
- UINTN NumEntries;
- UINTN BufferSize;
- UINT32 MediaId;
- EFI_PARTITION_TABLE_HEADER *GptHeader;
- EFI_STATUS Status;
-
- MediaId = BlockIo->Media->MediaId;
-
- //
- // Read size of Partition entry and number of entries from GPT header
- //
-
- GptHeader = AllocatePool (BlockIo->Media->BlockSize);
- if (GptHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = BlockIo->ReadBlocks (BlockIo, MediaId, 1, BlockIo->Media->BlockSize, (VOID *) GptHeader);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Check there is a GPT on the media
- if (GptHeader->Header.Signature != EFI_PTAB_HEADER_ID ||
- GptHeader->MyLBA != 1) {
- DEBUG ((EFI_D_ERROR,
- "Fastboot platform: No GPT on flash. "
- "Fastboot on Versatile Express does not support MBR.\n"
- ));
- return EFI_DEVICE_ERROR;
- }
-
- EntrySize = GptHeader->SizeOfPartitionEntry;
- NumEntries = GptHeader->NumberOfPartitionEntries;
-
- FreePool (GptHeader);
-
- ASSERT (EntrySize != 0);
- ASSERT (NumEntries != 0);
-
- BufferSize = ALIGN_VALUE (EntrySize * NumEntries, BlockIo->Media->BlockSize);
- *PartitionEntries = AllocatePool (BufferSize);
- if (PartitionEntries == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = BlockIo->ReadBlocks (BlockIo, MediaId, 2, BufferSize, (VOID *) *PartitionEntries);
- if (EFI_ERROR (Status)) {
- FreePool (PartitionEntries);
- return Status;
- }
-
- return Status;
-}
-
-
-/*
- Initialise: Open the Android NVM device and find the partitions on it. Save them in
- a list along with the "PartitionName" fields for their GPT entries.
- We will use these partition names as the key in
- ArmFastbootPlatformFlashPartition.
-*/
-EFI_STATUS
-ArmFastbootPlatformInit (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *FlashDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FlashDevicePathDup;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *NextNode;
- HARDDRIVE_DEVICE_PATH *PartitionNode;
- UINTN NumHandles;
- EFI_HANDLE *AllHandles;
- UINTN LoopIndex;
- EFI_HANDLE FlashHandle;
- EFI_BLOCK_IO_PROTOCOL *FlashBlockIo;
- EFI_PARTITION_ENTRY *PartitionEntries;
- FASTBOOT_PARTITION_LIST *Entry;
-
- InitializeListHead (&mPartitionListHead);
-
- //
- // Get EFI_HANDLES for all the partitions on the block devices pointed to by
- // PcdFastbootFlashDevicePath, also saving their GPT partition labels.
- // There's no way to find all of a device's children, so we get every handle
- // in the system supporting EFI_BLOCK_IO_PROTOCOL and then filter out ones
- // that don't represent partitions on the flash device.
- //
-
- FlashDevicePath = ConvertTextToDevicePath ((CHAR16*)FixedPcdGetPtr (PcdAndroidFastbootNvmDevicePath));
-
- //
- // Open the Disk IO protocol on the flash device - this will be used to read
- // partition names out of the GPT entries
- //
- // Create another device path pointer because LocateDevicePath will modify it.
- FlashDevicePathDup = FlashDevicePath;
- Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &FlashDevicePathDup, &FlashHandle);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Warning: Couldn't locate Android NVM device (status: %r)\n", Status));
- // Failing to locate partitions should not prevent to do other Android FastBoot actions
- return EFI_SUCCESS;
- }
-
- Status = gBS->OpenProtocol (
- FlashHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &FlashBlockIo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Fastboot platform: Couldn't open Android NVM device (status: %r)\n", Status));
- return EFI_DEVICE_ERROR;
- }
-
- // Read the GPT partition entry array into memory so we can get the partition names
- Status = ReadPartitionEntries (FlashBlockIo, &PartitionEntries);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Warning: Failed to read partitions from Android NVM device (status: %r)\n", Status));
- // Failing to locate partitions should not prevent to do other Android FastBoot actions
- return EFI_SUCCESS;
- }
-
- // Get every Block IO protocol instance installed in the system
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiBlockIoProtocolGuid,
- NULL,
- &NumHandles,
- &AllHandles
- );
- ASSERT_EFI_ERROR (Status);
-
- // Filter out handles that aren't children of the flash device
- for (LoopIndex = 0; LoopIndex < NumHandles; LoopIndex++) {
- // Get the device path for the handle
- Status = gBS->OpenProtocol (
- AllHandles[LoopIndex],
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- ASSERT_EFI_ERROR (Status);
-
- // Check if it is a sub-device of the flash device
- if (!CompareMem (DevicePath, FlashDevicePath, FLASH_DEVICE_PATH_SIZE (FlashDevicePath))) {
- // Device path starts with path of flash device. Check it isn't the flash
- // device itself.
- NextNode = NextDevicePathNode (DevicePath);
- if (IsDevicePathEndType (NextNode)) {
- continue;
- }
-
- // Assert that this device path node represents a partition.
- ASSERT (NextNode->Type == MEDIA_DEVICE_PATH &&
- NextNode->SubType == MEDIA_HARDDRIVE_DP);
-
- PartitionNode = (HARDDRIVE_DEVICE_PATH *) NextNode;
-
- // Assert that the partition type is GPT. ReadPartitionEntries checks for
- // presence of a GPT, so we should never find MBR partitions.
- // ("MBRType" is a misnomer - this field is actually called "Partition
- // Format")
- ASSERT (PartitionNode->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER);
-
- // The firmware may install a handle for "partition 0", representing the
- // whole device. Ignore it.
- if (PartitionNode->PartitionNumber == 0) {
- continue;
- }
-
- //
- // Add the partition handle to the list
- //
-
- // Create entry
- Entry = AllocatePool (sizeof (FASTBOOT_PARTITION_LIST));
- if (Entry == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- FreePartitionList ();
- goto Exit;
- }
-
- // Copy handle and partition name
- Entry->PartitionHandle = AllHandles[LoopIndex];
- StrnCpy (
- Entry->PartitionName,
- PartitionEntries[PartitionNode->PartitionNumber - 1].PartitionName, // Partition numbers start from 1.
- PARTITION_NAME_MAX_LENGTH
- );
- InsertTailList (&mPartitionListHead, &Entry->Link);
-
- // Print a debug message if the partition label is empty or looks like
- // garbage.
- if (!IS_ALPHA (Entry->PartitionName[0])) {
- DEBUG ((EFI_D_ERROR,
- "Warning: Partition %d doesn't seem to have a GPT partition label. "
- "You won't be able to flash it with Fastboot.\n",
- PartitionNode->PartitionNumber
- ));
- }
- }
- }
-
-Exit:
- FreePool (PartitionEntries);
- FreePool (FlashDevicePath);
- FreePool (AllHandles);
- return Status;
-
-}
-
-VOID
-ArmFastbootPlatformUnInit (
- VOID
- )
-{
- FreePartitionList ();
-}
-
-EFI_STATUS
-ArmFastbootPlatformFlashPartition (
- IN CHAR8 *PartitionName,
- IN UINTN Size,
- IN VOID *Image
- )
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- UINT32 MediaId;
- UINTN PartitionSize;
- FASTBOOT_PARTITION_LIST *Entry;
- CHAR16 PartitionNameUnicode[60];
- BOOLEAN PartitionFound;
-
- AsciiStrToUnicodeStr (PartitionName, PartitionNameUnicode);
-
- PartitionFound = FALSE;
- Entry = (FASTBOOT_PARTITION_LIST *) GetFirstNode (&(mPartitionListHead));
- while (!IsNull (&mPartitionListHead, &Entry->Link)) {
- // Search the partition list for the partition named by PartitionName
- if (StrCmp (Entry->PartitionName, PartitionNameUnicode) == 0) {
- PartitionFound = TRUE;
- break;
- }
-
- Entry = (FASTBOOT_PARTITION_LIST *) GetNextNode (&mPartitionListHead, &(Entry)->Link);
- }
- if (!PartitionFound) {
- return EFI_NOT_FOUND;
- }
-
- Status = gBS->OpenProtocol (
- Entry->PartitionHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Fastboot platform: couldn't open Block IO for flash: %r\n", Status));
- return EFI_NOT_FOUND;
- }
-
- // Check image will fit on device
- PartitionSize = (BlockIo->Media->LastBlock + 1) * BlockIo->Media->BlockSize;
- if (PartitionSize < Size) {
- DEBUG ((EFI_D_ERROR, "Partition not big enough.\n"));
- DEBUG ((EFI_D_ERROR, "Partition Size:\t%d\nImage Size:\t%d\n", PartitionSize, Size));
-
- return EFI_VOLUME_FULL;
- }
-
- MediaId = BlockIo->Media->MediaId;
-
- Status = gBS->OpenProtocol (
- Entry->PartitionHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = DiskIo->WriteDisk (DiskIo, MediaId, 0, Size, Image);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BlockIo->FlushBlocks(BlockIo);
-
- return Status;
-}
-
-EFI_STATUS
-ArmFastbootPlatformErasePartition (
- IN CHAR8 *Partition
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ArmFastbootPlatformGetVar (
- IN CHAR8 *Name,
- OUT CHAR8 *Value
- )
-{
- if (AsciiStrCmp (Name, "product")) {
- AsciiStrCpy (Value, FixedPcdGetPtr (PcdFirmwareVendor));
- } else {
- *Value = '\0';
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ArmFastbootPlatformOemCommand (
- IN CHAR8 *Command
- )
-{
- CHAR16 CommandUnicode[65];
-
- AsciiStrToUnicodeStr (Command, CommandUnicode);
-
- if (AsciiStrCmp (Command, "Demonstrate") == 0) {
- DEBUG ((EFI_D_ERROR, "ARM OEM Fastboot command 'Demonstrate' received.\n"));
- return EFI_SUCCESS;
- } else {
- DEBUG ((EFI_D_ERROR,
- "VExpress: Unrecognised Fastboot OEM command: %s\n",
- CommandUnicode
- ));
- return EFI_NOT_FOUND;
- }
-}
-
-FASTBOOT_PLATFORM_PROTOCOL mPlatformProtocol = {
- ArmFastbootPlatformInit,
- ArmFastbootPlatformUnInit,
- ArmFastbootPlatformFlashPartition,
- ArmFastbootPlatformErasePartition,
- ArmFastbootPlatformGetVar,
- ArmFastbootPlatformOemCommand
-};
-
-EFI_STATUS
-EFIAPI
-ArmAndroidFastbootPlatformEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return gBS->InstallProtocolInterface (
- &ImageHandle,
- &gAndroidFastbootPlatformProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPlatformProtocol
- );
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf
deleted file mode 100644
index 468f5a4799..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBootDxe.inf
+++ /dev/null
@@ -1,54 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmVExpressFastBootDxe
- FILE_GUID = 4004e454-89a0-11e3-89aa-97ef9d942abc
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = ArmAndroidFastbootPlatformEntryPoint
-
-[Sources.common]
- ArmVExpressFastBoot.c
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- DebugLib
- DevicePathLib
- MemoryAllocationLib
- PcdLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
-
-[Protocols]
- gAndroidFastbootPlatformProtocolGuid
- gEfiBlockIoProtocolGuid
- gEfiDiskIoProtocolGuid
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPkg/ArmPkg.dec
-
-[Guids]
- gArmGlobalVariableGuid
-
-[Pcd]
- gArmVExpressTokenSpaceGuid.PcdAndroidFastbootNvmDevicePath
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
deleted file mode 100644
index d375ed3b97..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
+++ /dev/null
@@ -1,81 +0,0 @@
-#/** @file
-# Arm Versatile Express package.
-#
-# Copyright (c) 2012-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials are licensed and made available
-# under the terms and conditions of the BSD License which accompanies this
-# distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- DEC_SPECIFICATION = 0x00010005
- PACKAGE_NAME = ArmVExpressPkg
- PACKAGE_GUID = 9c0aaed4-74c5-4043-b417-a3223814ce76
- PACKAGE_VERSION = 0.1
-
-################################################################################
-#
-# Include Section - list of Include Paths that are provided by this package.
-# Comments are used for Keywords and Module Types.
-#
-# Supported Module Types:
-# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
-#
-################################################################################
-[Includes.common]
- Include # Root include for the package
-
-[Guids.common]
- gArmVExpressTokenSpaceGuid = { 0x9c0aaed4, 0x74c5, 0x4043, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xce, 0x76 } }
-
-[PcdsFeatureFlag.common]
-
-[PcdsFixedAtBuild.common]
- #
- # MaxMode must be one number higher than the actual max mode,
- # i.e. for actual maximum mode 2, set the value to 3.
- #
- # For a list of mode numbers look in LcdArmVExpress.c
- #
- gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode|3|UINT32|0x00000001
- gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId|1|UINT32|0x00000002
- gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId|0|UINT32|0x00000003
-
- #
- # Device path of block device on which Fastboot will flash partitions
- #
- gArmVExpressTokenSpaceGuid.PcdAndroidFastbootNvmDevicePath|""|VOID*|0x00000004
-
- # FVP platforms : install FDT from SemiHosting
- gArmVExpressTokenSpaceGuid.PcdFvpFdtDevicePathsBase|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/"|VOID*|0x00000005
- # HW platforms : install FDT from NOR Flash
- gArmVExpressTokenSpaceGuid.PcdHwFdtDevicePathsBase|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/"|VOID*|0x00000006
-
- #
- # ARM Versatile Express FDT Guids
- #
- # FVP platforms
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA9x4|{ 0x12, 0x7b, 0xdf, 0xa1, 0x60, 0x11, 0xcf, 0x16, 0xb8, 0xc6, 0x98, 0xde, 0xdf, 0xe2, 0xce, 0xae }|VOID*|0x00000007
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x1|{ 0xe5, 0x1b, 0xc0, 0x96, 0xeb, 0xd7, 0x1a, 0x42, 0xc8, 0xe8, 0x6a, 0xfd, 0x5a, 0x86, 0x1d, 0x84 }|VOID*|0x00000008
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x2|{ 0x84, 0x43, 0x70, 0x4d, 0x19, 0xf1, 0x29, 0xe3, 0xef, 0xcd, 0xa5, 0x9b, 0x3d, 0x0a, 0x5a, 0x5f }|VOID*|0x00000009
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x4|{ 0x72, 0x3b, 0x28, 0x27, 0x90, 0x2f, 0xca, 0x4d, 0x9a, 0xb5, 0x98, 0x48, 0xfb, 0xc2, 0xd4, 0xed }|VOID*|0x0000000A
- # HW platforms
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA9x4|{ 0xf6, 0x1c, 0xd2, 0x2f, 0xe8, 0xe6, 0xf2, 0x4f, 0xa9, 0xca, 0x3b, 0x9f, 0x00, 0xe9, 0x28, 0x89 }|VOID*|0x0000000B
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA15x2A7x3|{ 0xeb, 0x06, e6, 0xd5, 0xdf, 0x83, 0x90, 0x4e, 0x81, 0xe8, 0xc3, 0xdb, 0x2f, 0x77, 0x17, 0x9a }|VOID*|0x0000000C
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA15|{ 0xc2, 0x47, 0x89, 0x6b, 0x87, 0x42, 0x91, 0x4d, 0x8f, 0xe0, 0xa3, 0x81, 0xea, 0x5b, 0x56, 0x8f }|VOID*|0x0000000D
- gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA5|{ 0x63, 0x76, 0xcc, 0xa2, 0x7c, 0x4d, 0x8a, 0x44, 0xaa, 0xb5, 0x4c, 0x03, 0x4b, 0x6f, 0xda, 0xb7 }|VOID*|0x0000000E
-
- # AArch64 FVP platforms
- gArmVExpressTokenSpaceGuid.PcdFdtFvpVExpressAEMv8x4|{ 0xa8, 0x95, 0x5f, 0xf6, 0x32, 0x7b, 0xf3, 0x16, 0x12, 0x32, 0x45, 0x50, 0xbd, 0x54, 0xca, 0xe5 }|VOID*|0x00000010
- gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2|{ 0x66, 0xcf, 0x57, 0xa4, 0xac, 0x7e, 0x7f, 0x3d, 0x21, 0x88, 0x3a, 0x58, 0x3c, 0x27, 0xd7, 0xe8 }|VOID*|0x00000011
- gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2Legacy|{ 0x8b, 0xcb, 0xe0, 0x14, 0xd1, 0x46, 0x79, 0xae, 0x7f, 0x20, 0xcf, 0x84, 0x22, 0xc7, 0x94, 0x4a }|VOID*|0x00000012
- gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV3|{ 0x4d, 0x03, 0xb8, 0x77, 0x63, 0x25, 0x0a, 0x7f, 0xe9, 0x72, 0xfa, 0x68, 0x74, 0xc7, 0x5e, 0xb5 }|VOID*|0x00000013
- gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2|{ 0x36, 0x4f, 0x61, 0x92, 0x86, 0xb1, 0xa2, 0x16, 0x32, 0x65, 0x35, 0x3f, 0x01, 0xf3, 0x3b, 0x64 }|VOID*|0x00000014
- gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2Legacy|{ 0xf6, 0xcb, 0x9d, 0x86, 0x38, 0x74, 0x8a, 0xb0, 0xfe, 0x40, 0x08, 0x0f, 0x3f, 0xb3, 0x50, 0x7c }|VOID*|0x00000015
- gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV3|{ 0x51, 0xd0, 0x75, 0x6b, 0x9d, 0x35, 0x1b, 0x1b, 0xa6, 0xc6, 0xab, 0xa0, 0x90, 0xf9, 0xf0, 0x0a }|VOID*|0x00000016
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h b/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h
deleted file mode 100644
index b52f89a5cb..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/** @file
-* Header defining Versatile Express constants (Base addresses, sizes, flags)
-*
-* Copyright (c) 2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_VEXPRESS_CTA15A7_H__
-#define __ARM_VEXPRESS_CTA15A7_H__
-
-#include <VExpressMotherBoard.h>
-
-/***********************************************************************************
-// Platform Memory Map
-************************************************************************************/
-
-// Motherboard Peripheral and On-chip peripheral
-#define ARM_VE_BOARD_PERIPH_BASE 0x1C010000
-
-#ifdef ARM_BIGLITTLE_TC2
-
-// Secure NOR Flash
-#define ARM_VE_SEC_NOR0_BASE 0x00000000
-#define ARM_VE_SEC_NOR0_SZ SIZE_64MB
-
-// Secure RAM
-#define ARM_VE_SEC_RAM0_BASE 0x04000000
-#define ARM_VE_SEC_RAM0_SZ SIZE_64MB
-
-#endif
-
-// NOR Flash 0
-#define ARM_VE_SMB_NOR0_BASE 0x08000000
-#define ARM_VE_SMB_NOR0_SZ SIZE_64MB
-// NOR Flash 1
-#define ARM_VE_SMB_NOR1_BASE 0x0C000000
-#define ARM_VE_SMB_NOR1_SZ SIZE_64MB
-
-// SRAM
-#define ARM_VE_SMB_SRAM_BASE 0x14000000
-#define ARM_VE_SMB_SRAM_SZ SIZE_32MB
-
-// USB, Ethernet, VRAM
-#ifdef ARM_BIGLITTLE_TC2
-#define ARM_VE_SMB_PERIPH_BASE 0x18000000
-#define ARM_VE_SMB_PERIPH_SZ (SIZE_64MB + SIZE_32MB + SIZE_16MB)
-#else
-#define ARM_VE_SMB_PERIPH_BASE 0x1C000000
-#define ARM_VE_SMB_PERIPH_SZ (SIZE_64MB + SIZE_16MB)
-#endif
-#define PL111_CLCD_VRAM_MOTHERBOARD_BASE ARM_VE_SMB_PERIPH_BASE
-
-// On-Chip non-secure ROM
-#ifdef ARM_BIGLITTLE_TC2
-#define ARM_VE_TC2_NON_SECURE_ROM_BASE 0x1F000000
-#define ARM_VE_TC2_NON_SECURE_ROM_SZ SIZE_16MB
-#endif
-
-// On-Chip Peripherals
-#define ARM_VE_ONCHIP_PERIPH_BASE 0x20000000
-#define ARM_VE_ONCHIP_PERIPH_SZ 0x10000000
-
-// On-Chip non-secure SRAM
-#ifdef ARM_BIGLITTLE_TC2
-#define ARM_VE_TC2_NON_SECURE_SRAM_BASE 0x2E000000
-#define ARM_VE_TC2_NON_SECURE_SRAM_SZ SIZE_64KB
-#endif
-
-// Allocate a section for the VRAM (Video RAM)
-// If 0 then allow random memory allocation
-#define LCD_VRAM_CORE_TILE_BASE 0
-
-// Define SEC phase sync point
-#define ARM_SEC_EVENT_BOOT_IMAGE_TABLE_IS_AVAILABLE (ARM_SEC_EVENT_MAX + 1)
-
-/***********************************************************************************
- Core Tile memory-mapped Peripherals
-************************************************************************************/
-
-// PL354 Static Memory Controller Base
-#ifdef ARM_BIGLITTLE_TC2
-#define ARM_VE_SMC_CTRL_BASE 0x7FFD0000
-#else
-#define ARM_VE_SMC_CTRL_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE1000)
-#endif
-
-#define ARM_CTA15A7_SCC_BASE 0x7FFF0000
-#define ARM_CTA15A7_SCC_CFGREG48 (ARM_CTA15A7_SCC_BASE + 0x700)
-
-#define ARM_CTA15A7_SCC_SYSINFO ARM_CTA15A7_SCC_CFGREG48
-
-#define ARM_CTA15A7_SCC_SYSINFO_CLUSTER_A7_NUM_CPU(val) (((val) >> 20) & 0xF)
-#define ARM_CTA15A7_SCC_SYSINFO_CLUSTER_A15_NUM_CPU(val) (((val) >> 16) & 0xF)
-#define ARM_CTA15A7_SCC_SYSINFO_ACTIVE_CLUSTER_A15 (1 << 0)
-#define ARM_CTA15A7_SCC_SYSINFO_ACTIVE_CLUSTER_A7 (1 << 1)
-#define ARM_CTA15A7_SCC_SYSINFO_UEFI_RESTORE_DEFAULT_NORFLASH (1 << 4)
-
-#define ARM_CTA15A7_SPC_BASE 0x7FFF0B00
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK (ARM_CTA15A7_SPC_BASE + 0x24)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT (ARM_CTA15A7_SPC_BASE + 0x3C)
-#define ARM_CTA15A7_SPC_A15_BX_ADDR0 (ARM_CTA15A7_SPC_BASE + 0x68)
-#define ARM_CTA15A7_SPC_A15_BX_ADDR1 (ARM_CTA15A7_SPC_BASE + 0x6C)
-#define ARM_CTA15A7_SPC_A15_BX_ADDR2 (ARM_CTA15A7_SPC_BASE + 0x70)
-#define ARM_CTA15A7_SPC_A15_BX_ADDR3 (ARM_CTA15A7_SPC_BASE + 0x74)
-#define ARM_CTA15A7_SPC_A7_BX_ADDR0 (ARM_CTA15A7_SPC_BASE + 0x78)
-#define ARM_CTA15A7_SPC_A7_BX_ADDR1 (ARM_CTA15A7_SPC_BASE + 0x7C)
-#define ARM_CTA15A7_SPC_A7_BX_ADDR2 (ARM_CTA15A7_SPC_BASE + 0x80)
-#define ARM_CTA15A7_SPC_A7_BX_ADDR3 (ARM_CTA15A7_SPC_BASE + 0x84)
-
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_IRQ_A15_MASK_0 (1 << 0)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_IRQ_A15_MASK_1 (1 << 1)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_FIQ_A15_MASK_0 (1 << 2)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_FIQ_A15_MASK_1 (1 << 3)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_IRQ_A7_MASK_0 (1 << 4)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_IRQ_A7_MASK_1 (1 << 5)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_IRQ_A7_MASK_2 (1 << 6)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_FIQ_A7_MASK_0 (1 << 7)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_FIQ_A7_MASK_1 (1 << 8)
-#define ARM_CTA15A7_SPC_WAKE_INT_MASK_FIQ_A7_MASK_2 (1 << 9)
-
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A15_0 (1 << 0)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A15_1 (1 << 1)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A15_L2 (1 << 2)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A7_0 (1 << 3)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A7_1 (1 << 4)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A7_2 (1 << 5)
-#define ARM_CTA15A7_SPC_STANDBYWFI_STAT_A7_L2 (1 << 6)
-
-
-/***********************************************************************************
-// Memory-mapped peripherals
-************************************************************************************/
-
-/*// SP810 Controller
-#undef SP810_CTRL_BASE
-#define SP810_CTRL_BASE 0x1C020000
-
-// PL111 Colour LCD Controller
-#define PL111_CLCD_SITE ARM_VE_MOTHERBOARD_SITE
-#define PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID 1
-#define PL111_CLCD_CORE_TILE_VIDEO_MODE_OSC_ID 1
-
-// VRAM offset for the PL111 Colour LCD Controller on the motherboard
-#define VRAM_MOTHERBOARD_BASE (ARM_VE_SMB_PERIPH_BASE + 0x00000)*/
-
-#endif
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA9x4/ArmPlatform.h b/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA9x4/ArmPlatform.h
deleted file mode 100644
index b692b168cb..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA9x4/ArmPlatform.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/** @file
-* Header defining Versatile Express constants (Base addresses, sizes, flags)
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_VEXPRESS_H__
-#define __ARM_VEXPRESS_H__
-
-#include <Base.h>
-#include <VExpressMotherBoard.h>
-
-/***********************************************************************************
-// Platform Memory Map
-************************************************************************************/
-
-// Can be NOR0, NOR1, DRAM
-#define ARM_VE_REMAP_BASE 0x00000000
-#define ARM_VE_REMAP_SZ SIZE_64MB
-
-// Motherboard Peripheral and On-chip peripheral
-#define ARM_VE_SMB_MB_ON_CHIP_PERIPH_BASE 0x10000000
-#define ARM_VE_SMB_MB_ON_CHIP_PERIPH_SZ SIZE_256MB
-#define ARM_VE_BOARD_PERIPH_BASE 0x10000000
-#define ARM_VE_CHIP_PERIPH_BASE 0x10020000
-
-// SMC
-#define ARM_VE_SMC_BASE 0x40000000
-#define ARM_VE_SMC_SZ 0x1C000000
-
-// NOR Flash 1
-#define ARM_VE_SMB_NOR0_BASE 0x40000000
-#define ARM_VE_SMB_NOR0_SZ SIZE_64MB
-// NOR Flash 2
-#define ARM_VE_SMB_NOR1_BASE 0x44000000
-#define ARM_VE_SMB_NOR1_SZ SIZE_64MB
-// SRAM
-#define ARM_VE_SMB_SRAM_BASE 0x48000000
-#define ARM_VE_SMB_SRAM_SZ SIZE_32MB
-// USB, Ethernet, VRAM
-#define ARM_VE_SMB_PERIPH_BASE 0x4C000000
-#define PL111_CLCD_VRAM_MOTHERBOARD_BASE ARM_VE_SMB_PERIPH_BASE
-#define ARM_VE_SMB_PERIPH_SZ SIZE_64MB
-
-// DRAM
-#define ARM_VE_DRAM_BASE PcdGet64 (PcdSystemMemoryBase)
-#define ARM_VE_DRAM_SZ PcdGet64 (PcdSystemMemorySize)
-// Inside the DRAM we allocate a section for the VRAM (Video RAM)
-#define LCD_VRAM_CORE_TILE_BASE 0x64000000
-
-// External AXI between daughterboards (Logic Tile)
-#define ARM_VE_EXT_AXI_BASE 0xE0000000
-#define ARM_VE_EXT_AXI_SZ 0x20000000 /* 512 MB */
-
-
-/***********************************************************************************
- Core Tile memory-mapped Peripherals
-************************************************************************************/
-
-// PL111 Colour LCD Controller - core tile
-#define PL111_CLCD_CORE_TILE_BASE (ARM_VE_BOARD_PERIPH_BASE + 0x20000)
-#define PL111_CLCD_SITE ARM_VE_DAUGHTERBOARD_1_SITE
-
-// PL341 Dynamic Memory Controller Base
-#define ARM_VE_DMC_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE0000)
-
-// PL354 Static Memory Controller Base
-#define ARM_VE_SMC_CTRL_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE1000)
-
-// System Configuration Controller register Base addresses
-#define ARM_VE_SYS_CFG_CTRL_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE2000)
-#define ARM_VE_SCC_BASE ARM_VE_SYS_CFG_CTRL_BASE
-#define ARM_VE_SYS_CFGRW0_REG (ARM_VE_BOARD_PERIPH_BASE + 0xE2000)
-#define ARM_VE_SYS_CFGRW1_REG (ARM_VE_BOARD_PERIPH_BASE + 0xE2004)
-#define ARM_VE_SYS_CFGRW2_REG (ARM_VE_BOARD_PERIPH_BASE + 0xE2008)
-
-// SP805 Watchdog on Cortex A9 core tile
-#define SP805_WDOG_CORE_TILE_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE5000)
-
-// BP147 TZPC Base Address
-#define ARM_VE_TZPC_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE6000)
-
-// PL301 Fast AXI Base Address
-#define ARM_VE_FAXI_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xE9000)
-
-// TZASC Trust Zone Address Space Controller Base Address
-#define ARM_VE_TZASC_BASE (ARM_VE_BOARD_PERIPH_BASE + 0xEC000)
-
-// PL310 L2x0 Cache Controller Base Address
-//#define ARM_VE_L2x0_CTLR_BASE 0x1E00A000
-
-/***********************************************************************************
- Peripherals' misc settings
-************************************************************************************/
-
-#define ARM_VE_CFGRW1_TZASC_EN_BIT_MASK 0x2000
-#define ARM_VE_CFGRW1_REMAP_NOR0 0
-#define ARM_VE_CFGRW1_REMAP_NOR1 (1 << 28)
-#define ARM_VE_CFGRW1_REMAP_EXT_AXI (1 << 29)
-#define ARM_VE_CFGRW1_REMAP_DRAM (1 << 30)
-
-// TZASC - Other settings
-#define ARM_VE_DECPROT_BIT_TZPC (1 << 6)
-#define ARM_VE_DECPROT_BIT_DMC_TZASC (1 << 11)
-#define ARM_VE_DECPROT_BIT_NMC_TZASC (1 << 12)
-#define ARM_VE_DECPROT_BIT_SMC_TZASC (1 << 13)
-#define ARM_VE_DECPROT_BIT_EXT_MAST_TZ (1)
-#define ARM_VE_DECPROT_BIT_DMC_TZASC_LOCK (1 << 3)
-#define ARM_VE_DECPROT_BIT_NMC_TZASC_LOCK (1 << 4)
-#define ARM_VE_DECPROT_BIT_SMC_TZASC_LOCK (1 << 5)
-
-#endif
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM/ArmPlatform.h b/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM/ArmPlatform.h
deleted file mode 100644
index 06414e6e72..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM/ArmPlatform.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
-* Header defining Versatile Express constants (Base addresses, sizes, flags)
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_VEXPRESS_H__
-#define __ARM_VEXPRESS_H__
-
-#include <VExpressMotherBoard.h>
-
-/***********************************************************************************
-// Platform Memory Map
-************************************************************************************/
-
-// Can be NOR0, NOR1, DRAM
-#define ARM_VE_REMAP_BASE 0x00000000
-#define ARM_VE_REMAP_SZ SIZE_64MB
-
-// Motherboard Peripheral and On-chip peripheral
-#define ARM_VE_BOARD_PERIPH_BASE 0x1C010000
-
-// NOR Flash 1
-// There is typo in the reference manual for the Base address of NOR Flash 1
-#define ARM_VE_SMB_NOR0_BASE 0x08000000
-#define ARM_VE_SMB_NOR0_SZ SIZE_64MB
-// NOR Flash 2
-#define ARM_VE_SMB_NOR1_BASE 0x0C000000
-#define ARM_VE_SMB_NOR1_SZ SIZE_64MB
-// SRAM
-#define ARM_VE_SMB_SRAM_BASE 0x2E000000
-#define ARM_VE_SMB_SRAM_SZ SIZE_64KB
-// USB, Ethernet, VRAM
-#define ARM_VE_SMB_PERIPH_BASE 0x18000000
-#define PL111_CLCD_VRAM_MOTHERBOARD_BASE ARM_VE_SMB_PERIPH_BASE
-#define ARM_VE_SMB_PERIPH_SZ SIZE_64MB
-
-// DRAM
-#define ARM_VE_DRAM_BASE PcdGet64 (PcdSystemMemoryBase)
-#define ARM_VE_DRAM_SZ PcdGet64 (PcdSystemMemorySize)
-
-// This can be any value since we only support motherboard PL111
-#define LCD_VRAM_CORE_TILE_BASE 0x00000000
-
-// On-chip peripherals (Snoop Control Unit etc...)
-#define ARM_VE_ON_CHIP_PERIPH_BASE 0x2C000000
-// Note: The TRM says not all the peripherals are implemented
-#define ARM_VE_ON_CHIP_PERIPH_SZ SIZE_256MB
-
-
-// External AXI between daughterboards (Logic Tile)
-#define ARM_VE_EXT_AXI_BASE 0x2E010000 // Not modelled
-#define ARM_VE_EXT_AXI_SZ 0x20000000 /* 512 MB */
-
-/***********************************************************************************
-// Memory-mapped peripherals
-************************************************************************************/
-
-// SP810 Controller
-#undef SP810_CTRL_BASE
-#define SP810_CTRL_BASE 0x1C020000
-
-// PL111 Colour LCD Controller
-#define PL111_CLCD_SITE ARM_VE_MOTHERBOARD_SITE
-#define PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID 1
-#define PL111_CLCD_CORE_TILE_VIDEO_MODE_OSC_ID 1
-
-// VRAM offset for the PL111 Colour LCD Controller on the motherboard
-#define VRAM_MOTHERBOARD_BASE (ARM_VE_SMB_PERIPH_BASE + 0x00000)
-
-#endif
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h b/ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h
deleted file mode 100644
index 38691c3582..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Include/VExpressMotherBoard.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/** @file
-* Header defining Versatile Express constants (Base addresses, sizes, flags)
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __VEXPRESSMOTHERBOARD_H_
-#define __VEXPRESSMOTHERBOARD_H_
-
-#include <ArmPlatform.h>
-
-/***********************************************************************************
-// Motherboard memory-mapped peripherals
-************************************************************************************/
-
-// Define MotherBoard SYS flags offsets (from ARM_VE_BOARD_PERIPH_BASE)
-#define ARM_VE_SYS_ID_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00000)
-#define ARM_VE_SYS_SW_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00004)
-#define ARM_VE_SYS_LED_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00008)
-#define ARM_VE_SYS_FLAGS_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00030)
-#define ARM_VE_SYS_FLAGS_SET_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00030)
-#define ARM_VE_SYS_FLAGS_CLR_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00034)
-#define ARM_VE_SYS_FLAGS_NV_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00038)
-#define ARM_VE_SYS_FLAGS_NV_SET_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00038)
-#define ARM_VE_SYS_FLAGS_NV_CLR_REG (ARM_VE_BOARD_PERIPH_BASE + 0x0003C)
-#define ARM_VE_SYS_FLASH (ARM_VE_BOARD_PERIPH_BASE + 0x0004C)
-#define ARM_VE_SYS_CFGSWR_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00058)
-#define ARM_VE_SYS_MISC (ARM_VE_BOARD_PERIPH_BASE + 0x00060)
-#define ARM_VE_SYS_PROCID0_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00084)
-#define ARM_VE_SYS_PROCID1_REG (ARM_VE_BOARD_PERIPH_BASE + 0x00088)
-#define ARM_VE_SYS_CFGDATA_REG (ARM_VE_BOARD_PERIPH_BASE + 0x000A0)
-#define ARM_VE_SYS_CFGCTRL_REG (ARM_VE_BOARD_PERIPH_BASE + 0x000A4)
-#define ARM_VE_SYS_CFGSTAT_REG (ARM_VE_BOARD_PERIPH_BASE + 0x000A8)
-
-// SP810 Controller
-#ifndef SP810_CTRL_BASE
-#define SP810_CTRL_BASE (ARM_VE_BOARD_PERIPH_BASE + 0x01000)
-#endif
-
-// PL111 Colour LCD Controller - motherboard
-#define PL111_CLCD_MOTHERBOARD_BASE (ARM_VE_BOARD_PERIPH_BASE + 0x1F000)
-#define PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID 1
-
-// VRAM offset for the PL111 Colour LCD Controller on the motherboard
-#define VRAM_MOTHERBOARD_BASE (ARM_VE_SMB_PERIPH_BASE + 0x00000)
-
-#define ARM_VE_SYS_PROC_ID_HBI 0xFFF
-#define ARM_VE_SYS_PROC_ID_MASK (UINT32)(0xFFU << 24)
-#define ARM_VE_SYS_PROC_ID_UNSUPPORTED (UINT32)(0xFFU << 24)
-#define ARM_VE_SYS_PROC_ID_CORTEX_A9 (UINT32)(0x0CU << 24)
-#define ARM_VE_SYS_PROC_ID_CORTEX_A5 (UINT32)(0x12U << 24)
-#define ARM_VE_SYS_PROC_ID_CORTEX_A15 (UINT32)(0x14U << 24)
-#define ARM_VE_SYS_PROC_ID_CORTEX_A7 (UINT32)(0x18U << 24)
-#define ARM_VE_SYS_PROC_ID_CORTEX_A12 (UINT32)(0x1CU << 24)
-
-// Boot Master Select:
-// 0 = Site 1 boot master
-// 1 = Site 2 boot master
-#define ARM_VE_SYS_MISC_MASTERSITE (1 << 14)
-//
-// Sites where the peripheral is fitted
-//
-#define ARM_VE_UNSUPPORTED ~0
-#define ARM_VE_MOTHERBOARD_SITE 0
-#define ARM_VE_DAUGHTERBOARD_1_SITE 1
-#define ARM_VE_DAUGHTERBOARD_2_SITE 2
-
-#define VIRTUAL_SYS_CFG(site,func) (((site) << 24) | (func))
-
-//
-// System Configuration Control Functions
-//
-#define SYS_CFG_OSC 1
-#define SYS_CFG_VOLT 2
-#define SYS_CFG_AMP 3
-#define SYS_CFG_TEMP 4
-#define SYS_CFG_RESET 5
-#define SYS_CFG_SCC 6
-#define SYS_CFG_MUXFPGA 7
-#define SYS_CFG_SHUTDOWN 8
-#define SYS_CFG_REBOOT 9
-#define SYS_CFG_DVIMODE 11
-#define SYS_CFG_POWER 12
-// Oscillator for Site 1
-#define SYS_CFG_OSC_SITE1 VIRTUAL_SYS_CFG(ARM_VE_DAUGHTERBOARD_1_SITE,SYS_CFG_OSC)
-// Oscillator for Site 2
-#define SYS_CFG_OSC_SITE2 VIRTUAL_SYS_CFG(ARM_VE_DAUGHTERBOARD_2_SITE,SYS_CFG_OSC)
-// Can not access the battery backed-up hardware clock on the Versatile Express motherboard
-#define SYS_CFG_RTC VIRTUAL_SYS_CFG(ARM_VE_UNSUPPORTED,1)
-
-//
-// System ID
-//
-// All RTSM VE models have the same System ID : 0x225F500
-//
-// FVP models have a different System ID.
-// Default Base model System ID : 0x00201100
-// [31:28] Rev - Board revision: 0x0 = Rev A
-// [27:16] HBI - HBI board number in BCD: 0x020 = v8 Base Platform
-// [15:12] Variant - Build variant of board: 0x1 = Variant B. (GIC 64k map)
-// [11:8] Plat - Platform type: 0x1 = Model
-// [7:0] FPGA - FPGA build, BCD coded: 0x00
-//
-//HBI = 010 = Foundation Model
-//HBI = 020 = Base Platform
-//
-// And specifically, the GIC register banks start at the following
-// addresses:
-// Variant = 0 Variant = 1
-//GICD 0x2c001000 0x2f000000
-//GICC 0x2c002000 0x2c000000
-//GICH 0x2c004000 0x2c010000
-//GICV 0x2c006000 0x2c020000
-
-#define ARM_FVP_BASE_BOARD_SYS_ID (0x00200100)
-#define ARM_FVP_FOUNDATION_BOARD_SYS_ID (0x00100100)
-
-#define ARM_FVP_SYS_ID_REV_MASK (UINT32)(0xFUL << 28)
-#define ARM_FVP_SYS_ID_HBI_MASK (UINT32)(0xFFFUL << 16)
-#define ARM_FVP_SYS_ID_VARIANT_MASK (UINT32)(0xFUL << 12)
-#define ARM_FVP_SYS_ID_PLAT_MASK (UINT32)(0xFUL << 8 )
-#define ARM_FVP_SYS_ID_FPGA_MASK (UINT32)(0xFFUL << 0 )
-#define ARM_FVP_GIC_VE_MMAP 0x0
-#define ARM_FVP_GIC_BASE_MMAP (UINT32)(1 << 12)
-
-// The default SYS_IDs. These can be changed when starting the model.
-#define ARM_RTSM_SYS_ID (0x225F500)
-#define ARM_FVP_BASE_SYS_ID (ARM_FVP_BASE_BOARD_SYS_ID | ARM_FVP_GIC_BASE_MMAP)
-#define ARM_FVP_FOUNDATION_SYS_ID (ARM_FVP_FOUNDATION_BOARD_SYS_ID | ARM_FVP_GIC_BASE_MMAP)
-
-#endif /* VEXPRESSMOTHERBOARD_H_ */
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf
deleted file mode 100644
index 10ae6c7f60..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/ArmVExpressLib.inf
+++ /dev/null
@@ -1,50 +0,0 @@
-#/* @file
-#
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = CTA15A7ArmVExpressLib
- FILE_GUID = b98a6cb7-d472-4128-ad62-a7347f85ce13
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- MemoryAllocationLib
- SerialPortLib
-
-[Sources.common]
- CTA15-A7.c
- CTA15-A7Mem.c
- CTA15-A7Helper.asm | RVCT
- CTA15-A7Helper.S | GCC
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdCoreCount
-
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
- gArmTokenSpaceGuid.PcdFvBaseAddress
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
deleted file mode 100644
index 8b3287b8ef..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-#include <ArmPlatform.h>
-
-ARM_CORE_INFO mVersatileExpressCTA15A7InfoTable[] = {
- {
- // Cluster 0, Core 0
- 0x0, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR0,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR0,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR0,
- (UINT64)0
- },
- {
- // Cluster 0, Core 1
- 0x0, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR1,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR1,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR1,
- (UINT64)0
- },
-#ifndef ARM_BIGLITTLE_TC2
- {
- // Cluster 0, Core 2
- 0x0, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR2,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR2,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR2,
- (UINT64)0
- },
- {
- // Cluster 0, Core 3
- 0x0, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR3,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR3,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR3,
- (UINT64)0
- },
-#endif
- {
- // Cluster 1, Core 0
- 0x1, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR0,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR0,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR0,
- (UINT64)0
- },
- {
- // Cluster 1, Core 1
- 0x1, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR1,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR1,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR1,
- (UINT64)0
- },
- {
- // Cluster 1, Core 2
- 0x1, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR2,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR2,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR2,
- (UINT64)0
- }
-#ifndef ARM_BIGLITTLE_TC2
- ,{
- // Cluster 1, Core 3
- 0x1, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR3,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR3,
- (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR3,
- (UINT64)0
- }
-#endif
-};
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
- @return Return the current Boot Mode of the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- )
-{
- if (MmioRead32(ARM_CTA15A7_SCC_SYSINFO) & ARM_CTA15A7_SCC_SYSINFO_UEFI_RESTORE_DEFAULT_NORFLASH) {
- return BOOT_WITH_DEFAULT_SETTINGS;
- } else {
- return BOOT_WITH_FULL_CONFIGURATION;
- }
-}
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- )
-{
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- // Nothing to do here
-
- return RETURN_SUCCESS;
-}
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- )
-{
-}
-
-EFI_STATUS
-PrePeiCoreGetMpCoreInfo (
- OUT UINTN *CoreCount,
- OUT ARM_CORE_INFO **ArmCoreTable
- )
-{
- // Only support one cluster
- *CoreCount = sizeof(mVersatileExpressCTA15A7InfoTable) / sizeof(ARM_CORE_INFO);
- *ArmCoreTable = mVersatileExpressCTA15A7InfoTable;
- return EFI_SUCCESS;
-}
-
-// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
-EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
-ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
-
-EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &mArmMpCoreInfoPpiGuid,
- &mMpCoreInfoPpi
- }
-};
-
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- *PpiListSize = sizeof(gPlatformPpiTable);
- *PpiList = gPlatformPpiTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S
deleted file mode 100644
index 20bfe52610..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Library/ArmLib.h>
-
-#include <ArmPlatform.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-
-ASM_PFX(ArmPlatformPeiBootAction):
- bx lr
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformGetCorePosition):
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
- // with cpu_id[0:3] and cluster_id[4:7]
- LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r1)
- ldr r1, [r1]
- lsr r1, #24
-
- // Shift the SCC value to get the cluster ID at the offset #8
- lsl r2, r1, #4
- and r2, r2, #0xF00
-
- // Keep only the cpu ID from the original SCC
- and r1, r1, #0x0F
- // Add the Cluster ID to the Cpu ID
- orr r1, r1, r2
-
- // Keep the Cluster ID and Core ID from the MPID
- LoadConstantToReg (ARM_CLUSTER_MASK | ARM_CORE_MASK, r2)
- and r0, r0, r2
-
- // Compare mpid and boot cpu from ARM_SCC_CFGREG48
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
- // with cpu_id[0:3] and cluster_id[4:7]
- LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)
- ldr r0, [r0]
- lsr r0, #24
-
- // Shift the SCC value to get the cluster ID at the offset #8
- lsl r1, r0, #4
- and r1, r1, #0xF00
-
- // Keep only the cpu ID from the original SCC
- and r0, r0, #0x0F
- // Add the Cluster ID to the Cpu ID
- orr r0, r0, r1
- bx lr
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm
deleted file mode 100644
index f377cf2e72..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Library/ArmLib.h>
-
-#include <ArmPlatform.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformPeiBootAction
- EXPORT ArmPlatformGetCorePosition
- EXPORT ArmPlatformIsPrimaryCore
- EXPORT ArmPlatformGetPrimaryCoreMpId
-
- PRESERVE8
- AREA CTA15A7Helper, CODE, READONLY
-
-ArmPlatformPeiBootAction FUNCTION
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ArmPlatformGetCorePosition FUNCTION
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ArmPlatformIsPrimaryCore FUNCTION
- // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
- // with cpu_id[0:3] and cluster_id[4:7]
- LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r1)
- ldr r1, [r1]
- lsr r1, #24
-
- // Shift the SCC value to get the cluster ID at the offset #8
- lsl r2, r1, #4
- and r2, r2, #0xF00
-
- // Keep only the cpu ID from the original SCC
- and r1, r1, #0x0F
- // Add the Cluster ID to the Cpu ID
- orr r1, r1, r2
-
- // Keep the Cluster ID and Core ID from the MPID
- LoadConstantToReg (ARM_CLUSTER_MASK :OR: ARM_CORE_MASK, r2)
- and r0, r0, r2
-
- // Compare mpid and boot cpu from ARM_SCC_CFGREG48
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ArmPlatformGetPrimaryCoreMpId FUNCTION
- // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
- // with cpu_id[0:3] and cluster_id[4:7]
- LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)
- ldr r0, [r0]
- lsr r0, #24
-
- // Shift the SCC value to get the cluster ID at the offset #8
- lsl r1, r0, #4
- and r1, r1, #0xF00
-
- // Keep only the cpu ID from the original SCC
- and r0, r0, #0x0F
- // Add the Cluster ID to the Cpu ID
- orr r0, r0, r1
- bx lr
- ENDFUNC
-
- END
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Mem.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Mem.c
deleted file mode 100644
index 4403cbacb8..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Mem.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-
-#include <ArmPlatform.h>
-
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 14
-
-// DDR attributes
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- )
-{
- ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
- UINTN Index = 0;
- ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
-
- ASSERT (VirtualMemoryMap != NULL);
-
- VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
- if (VirtualMemoryTable == NULL) {
- return;
- }
-
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
- CacheAttributes = DDR_ATTRIBUTES_CACHED;
- } else {
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;
- }
-
-#ifdef ARM_BIGLITTLE_TC2
- // Secure NOR0 Flash
- VirtualMemoryTable[Index].PhysicalBase = ARM_VE_SEC_NOR0_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SEC_NOR0_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SEC_NOR0_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- // Secure RAM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SEC_RAM0_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SEC_RAM0_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SEC_RAM0_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-#endif
-
- // SMB CS0 - NOR0 Flash
- VirtualMemoryTable[Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].Length = SIZE_256KB * 255;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- // Environment Variables region
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE + (SIZE_256KB * 255);
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE + (SIZE_256KB * 255);
- VirtualMemoryTable[Index].Length = SIZE_64KB * 4;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS1 or CS4 - NOR1 Flash
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR1_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR1_BASE;
- VirtualMemoryTable[Index].Length = SIZE_256KB * 255;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
- // Environment Variables region
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR1_BASE + (SIZE_256KB * 255);
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR1_BASE + (SIZE_256KB * 255);
- VirtualMemoryTable[Index].Length = SIZE_64KB * 4;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS3 or CS1 - PSRAM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_SRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_SRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_SRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // Motherboard peripherals
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
-#ifdef ARM_BIGLITTLE_TC2
- // Non-secure ROM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_TC2_NON_SECURE_ROM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_TC2_NON_SECURE_ROM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_TC2_NON_SECURE_ROM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-#endif
-
- // OnChip peripherals
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_ONCHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_ONCHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_ONCHIP_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SCC Region
- VirtualMemoryTable[++Index].PhysicalBase = ARM_CTA15A7_SCC_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_CTA15A7_SCC_BASE;
- VirtualMemoryTable[Index].Length = SIZE_64KB;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
-#ifdef ARM_BIGLITTLE_TC2
- // TC2 OnChip non-secure SRAM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_TC2_NON_SECURE_SRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_TC2_NON_SECURE_SRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_TC2_NON_SECURE_SRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-#endif
-
-#ifndef ARM_BIGLITTLE_TC2
- // Workaround for SRAM bug in RTSM
- if (PcdGet64 (PcdSystemMemoryBase) != 0x80000000) {
- VirtualMemoryTable[++Index].PhysicalBase = 0x80000000;
- VirtualMemoryTable[Index].VirtualBase = 0x80000000;
- VirtualMemoryTable[Index].Length = PcdGet64 (PcdSystemMemoryBase) - 0x80000000;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
- }
-#endif
-
- // DDR
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
- VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdSystemMemoryBase);
- VirtualMemoryTable[Index].Length = PcdGet64 (PcdSystemMemorySize);
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // Detect if it is a 1GB or 2GB Test Chip
- // [16:19]: 0=1GB TC2, 1=2GB TC2
- if (MmioRead32(ARM_VE_SYS_PROCID0_REG) & (0xF << 16)) {
- DEBUG((EFI_D_ERROR,"Info: 2GB Test Chip 2 detected.\n"));
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED,
- PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize),
- SIZE_1GB
- );
-
- // Map the additional 1GB into the MMU
- VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize);
- VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize);
- VirtualMemoryTable[Index].Length = SIZE_1GB;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
- }
-
- // End of Table
- VirtualMemoryTable[++Index].PhysicalBase = 0;
- VirtualMemoryTable[Index].VirtualBase = 0;
- VirtualMemoryTable[Index].Length = 0;
- VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
-
- ASSERT((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
-
- *VirtualMemoryMap = VirtualMemoryTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLib.inf
deleted file mode 100644
index d3c84de16d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLib.inf
+++ /dev/null
@@ -1,54 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = CTA9x4ArmVExpressLib
- FILE_GUID = b16c63a0-f417-11df-b3af-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- ArmTrustZoneLib
- MemoryAllocationLib
- PL341DmcLib
- PL301AxiLib
-
-[Sources.common]
- CTA9x4Helper.asm | RVCT
- CTA9x4Helper.S | GCC
- CTA9x4.c
- CTA9x4Mem.c
- CTA9x4Helper.S | GCC
- CTA9x4Helper.asm | RVCT
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
- gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf
deleted file mode 100644
index 20fc0b7d11..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf
+++ /dev/null
@@ -1,51 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = CTA9x4ArmVExpressLibSec
- FILE_GUID = 8d25ef2c-2015-416e-b8aa-2369fecd4bda
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- ArmTrustZoneLib
- PL341DmcLib
- PL301AxiLib
- SerialPortLib
-
-[Sources.common]
- CTA9x4.c
- CTA9x4Helper.S | GCC
- CTA9x4Helper.asm | RVCT
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
- gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c
deleted file mode 100644
index 0af13893f7..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Drivers/PL341Dmc.h>
-#include <Drivers/PL301Axi.h>
-#include <Drivers/SP804Timer.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-#include <ArmPlatform.h>
-
-ARM_CORE_INFO mVersatileExpressMpCoreInfoCTA9x4[] = {
- {
- // Cluster 0, Core 0
- 0x0, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 1
- 0x0, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 2
- 0x0, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 3
- 0x0, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- }
-};
-
-// DDR2 timings
-PL341_DMC_CONFIG DDRTimings = {
- .MaxChip = 1,
- .IsUserCfg = TRUE,
- .User0Cfg = 0x7C924924,
- .User2Cfg = (TC_UIOLHXC_VALUE << TC_UIOLHNC_SHIFT) | (TC_UIOLHXC_VALUE << TC_UIOLHPC_SHIFT) | (0x1 << TC_UIOHOCT_SHIFT) | (0x1 << TC_UIOHSTOP_SHIFT),
- .HasQos = TRUE,
- .RefreshPeriod = 0x3D0,
- .CasLatency = 0x8,
- .WriteLatency = 0x3,
- .t_mrd = 0x2,
- .t_ras = 0xA,
- .t_rc = 0xE,
- .t_rcd = 0x104,
- .t_rfc = 0x2f32,
- .t_rp = 0x14,
- .t_rrd = 0x2,
- .t_wr = 0x4,
- .t_wtr = 0x2,
- .t_xp = 0x2,
- .t_xsr = 0xC8,
- .t_esr = 0x14,
- .MemoryCfg = DMC_MEMORY_CONFIG_ACTIVE_CHIP_1 | DMC_MEMORY_CONFIG_BURST_4 |
- DMC_MEMORY_CONFIG_ROW_ADDRESS_15 | DMC_MEMORY_CONFIG_COLUMN_ADDRESS_10,
- .MemoryCfg2 = DMC_MEMORY_CFG2_DQM_INIT | DMC_MEMORY_CFG2_CKE_INIT |
- DMC_MEMORY_CFG2_BANK_BITS_3 | DMC_MEMORY_CFG2_MEM_WIDTH_32,
- .MemoryCfg3 = 0x00000001,
- .ChipCfg0 = 0x00010000,
- .t_faw = 0x00000A0D,
- .ModeReg = DDR2_MR_BURST_LENGTH_4 | DDR2_MR_CAS_LATENCY_4 | DDR2_MR_WR_CYCLES_4,
- .ExtModeReg = DDR_EMR_RTT_50R | (DDR_EMR_ODS_VAL << DDR_EMR_ODS_MASK),
-};
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
- @return Return the current Boot Mode of the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- )
-{
- if (MmioRead32(ARM_VE_SYS_FLAGS_NV_REG) == 0) {
- return BOOT_WITH_FULL_CONFIGURATION;
- } else {
- return BOOT_ON_S2_RESUME;
- }
-}
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- )
-{
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- // Configure periodic timer (TIMER0) for 1MHz operation
- MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER0_TIMCLK);
- // Configure 1MHz clock
- MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER1_TIMCLK);
- // configure SP810 to use 1MHz clock and disable
- MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER2_EN, SP810_SYS_CTRL_TIMER2_TIMCLK);
- // Configure SP810 to use 1MHz clock and disable
- MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER3_EN, SP810_SYS_CTRL_TIMER3_TIMCLK);
-
- return RETURN_SUCCESS;
-}
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- )
-{
- PL341DmcInit (ARM_VE_DMC_BASE, &DDRTimings);
- PL301AxiInit (ARM_VE_FAXI_BASE);
-}
-
-EFI_STATUS
-PrePeiCoreGetMpCoreInfo (
- OUT UINTN *CoreCount,
- OUT ARM_CORE_INFO **ArmCoreTable
- )
-{
- *CoreCount = sizeof(mVersatileExpressMpCoreInfoCTA9x4) / sizeof(ARM_CORE_INFO);
- *ArmCoreTable = mVersatileExpressMpCoreInfoCTA9x4;
-
- return EFI_SUCCESS;
-}
-
-// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
-EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
-ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
-
-EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &mArmMpCoreInfoPpiGuid,
- &mMpCoreInfoPpi
- }
-};
-
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- *PpiListSize = sizeof(gPlatformPpiTable);
- *PpiList = gPlatformPpiTable;
-}
-
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
deleted file mode 100644
index c4aee741a6..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-#include <AsmMacroIoLib.h>
-#include <Library/ArmLib.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
- bx lr
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1)
- ldr r1, [r1]
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformGetCorePosition):
- and r0, r0, #ARM_CORE_MASK
- bx lr
-
-ASM_PFX(ArmPlatformPeiBootAction):
- bx lr
-
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
deleted file mode 100644
index aa48ed730e..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright (c) 2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Library/ArmLib.h>
-
-#include <AutoGen.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformPeiBootAction
- EXPORT ArmPlatformIsPrimaryCore
- EXPORT ArmPlatformGetPrimaryCoreMpId
- EXPORT ArmPlatformGetCorePosition
-
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
-
- AREA CTA9x4Helper, CODE, READONLY
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ArmPlatformGetPrimaryCoreMpId FUNCTION
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ArmPlatformIsPrimaryCore FUNCTION
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1)
- ldr r1, [r1]
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ArmPlatformGetCorePosition FUNCTION
- and r0, r0, #ARM_CORE_MASK
- bx lr
- ENDFUNC
-
-ArmPlatformPeiBootAction FUNCTION
- bx lr
- ENDFUNC
-
- END
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Mem.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Mem.c
deleted file mode 100644
index 7ea6e74173..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Mem.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <ArmPlatform.h>
-
-// Number of Virtual Memory Map Descriptors without a Logic Tile
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 6
-
-// DDR attributes
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- )
-{
- ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
- UINTN Index = 0;
- ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
-
- ASSERT(VirtualMemoryMap != NULL);
-
- VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
- if (VirtualMemoryTable == NULL) {
- return;
- }
-
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
- CacheAttributes = DDR_ATTRIBUTES_CACHED;
- } else {
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;
- }
-
- if (FeaturePcdGet(PcdNorFlashRemapping) == FALSE) {
- // ReMap (Either NOR Flash or DRAM)
- VirtualMemoryTable[Index].PhysicalBase = ARM_VE_REMAP_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_REMAP_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_REMAP_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
- }
-
- // DDR
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_DRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_DRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_DRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // SMC CS7
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_MB_ON_CHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_MB_ON_CHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_MB_ON_CHIP_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS0-CS1 - NOR Flash 1 & 2
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_NOR0_SZ + ARM_VE_SMB_NOR1_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS2 - SRAM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_SRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_SRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_SRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // SMB CS3-CS6 - Motherboard Peripherals
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // If a Logic Tile is connected to The ARM Versatile Express Motherboard
- if (MmioRead32(ARM_VE_SYS_PROCID1_REG) != 0) {
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_EXT_AXI_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_EXT_AXI_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_EXT_AXI_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- ASSERT((Index + 1) == (MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS + 1));
- } else {
- ASSERT((Index + 1) == MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
- }
-
- // End of Table
- VirtualMemoryTable[++Index].PhysicalBase = 0;
- VirtualMemoryTable[Index].VirtualBase = 0;
- VirtualMemoryTable[Index].Length = 0;
- VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
-
- *VirtualMemoryMap = VirtualMemoryTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S
deleted file mode 100644
index 50ff713917..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
-
-ASM_PFX(ArmPlatformPeiBootAction):
- ret
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
- ldrh w0, [x0]
- ret
-
-# IN None
-# OUT x0 = number of cores present in the system
-ASM_PFX(ArmGetCpuCountPerCluster):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x0)
- ldrh w0, [x0]
- ret
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
- ldrh w1, [x1]
- and x0, x0, x1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x1)
- ldrh w1, [x1]
- cmp w0, w1
- b.ne 1f
- mov x0, #1
- ret
-1:
- mov x0, #0
- ret
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-// With this function: CorePos = (ClusterId * 4) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
- and x1, x0, #ARM_CORE_MASK
- and x0, x0, #ARM_CLUSTER_MASK
- add x0, x1, x0, LSR #6
- ret
-
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
deleted file mode 100644
index e739050b0d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-#include "AsmMacroIoLib.inc"
-
-#include <Chipset/ArmCortexA9.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-ASM_PFX(ArmPlatformPeiBootAction):
- bx lr
-
-# IN None
-# OUT r0 = SCU Base Address
-ASM_PFX(ArmGetScuBaseAddress):
- # Read Configuration Base Address Register. ArmCBar cannot be called to get
- # the Configuration BAR as a stack is not necessary setup. The SCU is at the
- # offset 0x0000 from the Private Memory Region.
- mrc p15, 4, r0, c15, c0, 0
- bx lr
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
- bx lr
-
-# IN None
-# OUT r0 = number of cores present in the system
-ASM_PFX(ArmGetCpuCountPerCluster):
- stmfd SP!, {r1-r2}
-
- # Read CP15 MIDR
- mrc p15, 0, r1, c0, c0, 0
-
- # Check if the CPU is A15
- mov r1, r1, LSR #4
- LoadConstantToReg (ARM_CPU_TYPE_MASK, r0)
- and r1, r1, r0
-
- LoadConstantToReg (ARM_CPU_TYPE_A15, r0)
- cmp r1, r0
- beq _Read_cp15_reg
-
-_CPU_is_not_A15:
- mov r2, lr @ Save link register
- bl ArmGetScuBaseAddress @ Read SCU Base Address
- mov lr, r2 @ Restore link register val
- ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get CPU count
- b _Return
-
-_Read_cp15_reg:
- mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to get CPU count
- lsr r0, #24
-
-_Return:
- and r0, r0, #3
- # Add '1' to the number of CPU on the Cluster
- add r0, r0, #1
- ldmfd SP!, {r1-r2}
- bx lr
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1)
- ldr r1, [r1]
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformGetCorePosition):
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
-
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
deleted file mode 100644
index f4ad51d36e..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-
-#include <Chipset/ArmCortexA9.h>
-
-#include <AutoGen.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformPeiBootAction
- EXPORT ArmGetCpuCountPerCluster
- EXPORT ArmPlatformIsPrimaryCore
- EXPORT ArmPlatformGetPrimaryCoreMpId
- EXPORT ArmPlatformGetCorePosition
-
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
-
- AREA RTSMHelper, CODE, READONLY
-
-ArmPlatformPeiBootAction FUNCTION
- bx lr
- ENDFUNC
-
-// IN None
-// OUT r0 = SCU Base Address
-ArmGetScuBaseAddress FUNCTION
- // Read Configuration Base Address Register. ArmCBar cannot be called to get
- // the Configuration BAR as a stack is not necessary setup. The SCU is at the
- // offset 0x0000 from the Private Memory Region.
- mrc p15, 4, r0, c15, c0, 0
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ArmPlatformGetPrimaryCoreMpId FUNCTION
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
- bx lr
- ENDFUNC
-
-// IN None
-// OUT r0 = number of cores present in the system
-ArmGetCpuCountPerCluster FUNCTION
- stmfd SP!, {r1-r2}
-
- // Read CP15 MIDR
- mrc p15, 0, r1, c0, c0, 0
-
- // Check if the CPU is A15
- mov r1, r1, LSR #4
- mov r0, #ARM_CPU_TYPE_MASK
- and r1, r1, r0
-
- mov r0, #ARM_CPU_TYPE_A15
- cmp r1, r0
- beq _Read_cp15_reg
-
-_CPU_is_not_A15
- mov r2, lr ; Save link register
- bl ArmGetScuBaseAddress ; Read SCU Base Address
- mov lr, r2 ; Restore link register val
- ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count
- b _Return
-
-_Read_cp15_reg
- mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count
- lsr r0, #24
-
-
-_Return
- and r0, r0, #3
- // Add '1' to the number of CPU on the Cluster
- add r0, r0, #1
- ldmfd SP!, {r1-r2}
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ArmPlatformIsPrimaryCore FUNCTION
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1)
- ldr r1, [r1]
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ArmPlatformGetCorePosition FUNCTION
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
- ENDFUNC
-
- END
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLib.inf
deleted file mode 100644
index 0fe8a32230..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLib.inf
+++ /dev/null
@@ -1,54 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RTSMArmVExpressFoundationLib
- FILE_GUID = ce5d91ae-0893-11e2-b6bb-1c6f650265cc
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- MemoryAllocationLib
- SerialPortLib
- PrintLib
- HobLib
-
-[Sources.common]
- RTSMFoundation.c
- RTSMFoundationMem.c
-
-[Sources.AARCH64]
- AArch64/RTSMHelper.S
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLibSec.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLibSec.inf
deleted file mode 100644
index 70245b0f4a..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLibSec.inf
+++ /dev/null
@@ -1,50 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RTSMArmVExpressFoundationLibSec
- FILE_GUID = bc6e6418-0894-11e2-9dc3-1c6f650265cc
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- SerialPortLib
-
-[Sources.common]
- RTSMFoundation.c
-
-[Sources.AARCH64]
- AArch64/RTSMHelper.S
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
deleted file mode 100644
index 5ee51a3817..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RTSMArmVExpressLib
- FILE_GUID = b98a6cb7-d472-4128-ad62-a7347f85ce13
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- MemoryAllocationLib
- SerialPortLib
- HobLib
-
-[Sources.common]
- RTSM.c
- RTSMMem.c
-
-[Sources.ARM]
- Arm/RTSMHelper.asm | RVCT
- Arm/RTSMHelper.S | GCC
-
-[Sources.AARCH64]
- AArch64/RTSMHelper.S
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
- gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
- gArmTokenSpaceGuid.PcdFvBaseAddress
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
deleted file mode 100644
index a535ffd792..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf
+++ /dev/null
@@ -1,56 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RTSMArmVExpressLibSec
- FILE_GUID = a79eed97-4b98-4974-9690-37b32d6a5b56
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- SerialPortLib
-
-[Sources.common]
- RTSM.c
-
-[Sources.ARM]
- Arm/RTSMHelper.asm | RVCT
- Arm/RTSMHelper.S | GCC
-
-[Sources.AARCH64]
- AArch64/RTSMHelper.S
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdCacheEnable
- gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
- gArmTokenSpaceGuid.PcdFvBaseAddress
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
deleted file mode 100644
index 6ec512bfb7..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-#include <ArmPlatform.h>
-
-ARM_CORE_INFO mVersatileExpressMpCoreInfoTable[] = {
- {
- // Cluster 0, Core 0
- 0x0, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 1
- 0x0, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 2
- 0x0, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 3
- 0x0, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 0
- 0x1, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 1
- 0x1, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 2
- 0x1, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 1, Core 3
- 0x1, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
- (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
- (UINT64)0xFFFFFFFF
- }
-};
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
- @return Return the current Boot Mode of the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- )
-{
- return BOOT_WITH_FULL_CONFIGURATION;
-}
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- )
-{
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- // Disable memory remapping and return to normal mapping
- MmioOr32 (SP810_CTRL_BASE, BIT8);
-
- return RETURN_SUCCESS;
-}
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- )
-{
- // Nothing to do here
-}
-
-EFI_STATUS
-PrePeiCoreGetMpCoreInfo (
- OUT UINTN *CoreCount,
- OUT ARM_CORE_INFO **ArmCoreTable
- )
-{
- UINT32 ProcType;
-
- ProcType = MmioRead32 (ARM_VE_SYS_PROCID0_REG) & ARM_VE_SYS_PROC_ID_MASK;
- if ((ProcType == ARM_VE_SYS_PROC_ID_CORTEX_A9) || (ProcType == ARM_VE_SYS_PROC_ID_CORTEX_A15)) {
- // Only support one cluster on all but ARMv8 FVP platform. FVP still uses CortexA9 ID.
- *CoreCount = ArmGetCpuCountPerCluster ();
- *ArmCoreTable = mVersatileExpressMpCoreInfoTable;
- return EFI_SUCCESS;
- } else {
- return EFI_UNSUPPORTED;
- }
-}
-
-// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
-EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
-ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
-
-EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &mArmMpCoreInfoPpiGuid,
- &mMpCoreInfoPpi
- }
-};
-
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- *PpiListSize = sizeof(gPlatformPpiTable);
- *PpiList = gPlatformPpiTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundation.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundation.c
deleted file mode 100644
index 33bef8366d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundation.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-#include <ArmPlatform.h>
-
-ARM_CORE_INFO mVersatileExpressMpCoreInfoTable[] = {
- {
- // Cluster 0, Core 0
- 0x0, 0x0,
-
- // NOTE:
- // The foundation model does not have the VE_SYS_REGS like all the other VE
- // platforms. We pick a spot in RAM that *should* be safe in the simple case
- // of no UEFI apps interfering (Only the Linux loader getting used). By the
- // time we come to load Linux we should have all the cores in a safe place.
- // The image expects to be loaded at 0xa0000000. We also place the mailboxes
- // here as it does not matter if we corrupt the image at this time.
- // NOTE also see: "ArmVExpressSecLibRTSM/AArch64/RTSMFoundationBoot.S"
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (UINT64)0x0
-
- },
- {
- // Cluster 0, Core 1
- 0x0, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (UINT64)0x0
-
- },
- {
- // Cluster 0, Core 2
- 0x0, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (UINT64)0x0
- },
- {
- // Cluster 0, Core 3
- 0x0, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (EFI_PHYSICAL_ADDRESS)0xa0000000,
- (UINT64)0x0
- }
-};
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
- @return Return the current Boot Mode of the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- )
-{
- return BOOT_WITH_FULL_CONFIGURATION;
-}
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- )
-{
- /* The Foundation model has no SP810 to initialise. */
-
- return RETURN_SUCCESS;
-}
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- )
-{
- // Nothing to do here
-}
-
-EFI_STATUS
-PrePeiCoreGetMpCoreInfo (
- OUT UINTN *CoreCount,
- OUT ARM_CORE_INFO **ArmCoreTable
- )
-{
- // Foundation model has no VE_SYS_REGS
- // Only support one cluster
- *CoreCount = ArmGetCpuCountPerCluster ();
- *ArmCoreTable = mVersatileExpressMpCoreInfoTable;
-
- return EFI_SUCCESS;
-}
-
-// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the context of PrePeiCore
-EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
-ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
-
-EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &mArmMpCoreInfoPpiGuid,
- &mMpCoreInfoPpi
- }
-};
-
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- *PpiListSize = sizeof(gPlatformPpiTable);
- *PpiList = gPlatformPpiTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundationMem.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundationMem.c
deleted file mode 100644
index 863767c84d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundationMem.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <ArmPlatform.h>
-
-// Number of Virtual Memory Map Descriptors
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5
-
-// DDR attributes
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- )
-{
- ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
- EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
- UINTN Index = 0;
- ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
- EFI_VIRTUAL_ADDRESS SparseMemoryBase;
- UINT64 SparseMemorySize;
-
- ASSERT(VirtualMemoryMap != NULL);
-
- ResourceAttributes =
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED;
-
- // Declared the additional DRAM from 2GB to 8GB
- SparseMemoryBase = 0x0880000000;
- SparseMemorySize = SIZE_2GB + SIZE_4GB;
-
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes,
- SparseMemoryBase,
- SparseMemorySize);
-
- VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
- if (VirtualMemoryTable == NULL) {
- return;
- }
-
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
- CacheAttributes = DDR_ATTRIBUTES_CACHED;
- } else {
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;
- }
-
- // DDR
- VirtualMemoryTable[Index].PhysicalBase = ARM_VE_DRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_DRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_DRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // CPU peripherals. TRM. Manual says not all of them are implemented.
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_ON_CHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_ON_CHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_ON_CHIP_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // Peripheral CS2 and CS3
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = 2 * ARM_VE_SMB_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // Map sparse memory region if present
- VirtualMemoryTable[++Index].PhysicalBase = SparseMemoryBase;
- VirtualMemoryTable[Index].VirtualBase = SparseMemoryBase;
- VirtualMemoryTable[Index].Length = SparseMemorySize;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // End of Table
- VirtualMemoryTable[++Index].PhysicalBase = 0;
- VirtualMemoryTable[Index].VirtualBase = 0;
- VirtualMemoryTable[Index].Length = 0;
- VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
-
- *VirtualMemoryMap = VirtualMemoryTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c
deleted file mode 100644
index 6c5e494d50..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <ArmPlatform.h>
-
-// Number of Virtual Memory Map Descriptors
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 6
-
-// DDR attributes
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- )
-{
- ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
- EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
- UINTN Index = 0;
- ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
- UINT32 SysId;
- BOOLEAN HasSparseMemory;
- EFI_VIRTUAL_ADDRESS SparseMemoryBase;
- UINT64 SparseMemorySize;
-
- ASSERT (VirtualMemoryMap != NULL);
-
- // The FVP model has Sparse memory
- SysId = MmioRead32 (ARM_VE_SYS_ID_REG);
- if (SysId != ARM_RTSM_SYS_ID) {
- HasSparseMemory = TRUE;
-
- ResourceAttributes =
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED;
-
- // Declared the additional DRAM from 2GB to 4GB
- SparseMemoryBase = 0x0880000000;
- SparseMemorySize = SIZE_2GB;
-
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes,
- SparseMemoryBase,
- SparseMemorySize);
- } else {
- HasSparseMemory = FALSE;
- SparseMemoryBase = 0x0;
- SparseMemorySize = 0x0;
- }
-
- VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
- if (VirtualMemoryTable == NULL) {
- return;
- }
-
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
- CacheAttributes = DDR_ATTRIBUTES_CACHED;
- } else {
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;
- }
-
- // ReMap (Either NOR Flash or DRAM)
- VirtualMemoryTable[Index].PhysicalBase = ARM_VE_REMAP_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_REMAP_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_REMAP_SZ;
-
- if (FeaturePcdGet(PcdNorFlashRemapping) == FALSE) {
- // Map the NOR Flash as Secure Memory
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
- VirtualMemoryTable[Index].Attributes = DDR_ATTRIBUTES_CACHED;
- } else {
- VirtualMemoryTable[Index].Attributes = DDR_ATTRIBUTES_UNCACHED;
- }
- } else {
- // DRAM mapping
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
- }
-
- // DDR
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_DRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_DRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_DRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // CPU peripherals. TRM. Manual says not all of them are implemented.
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_ON_CHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_ON_CHIP_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_ON_CHIP_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS0-CS1 - NOR Flash 1 & 2
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_NOR0_SZ + ARM_VE_SMB_NOR1_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // SMB CS2 - SRAM
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_SRAM_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_SRAM_BASE;
- VirtualMemoryTable[Index].Length = ARM_VE_SMB_SRAM_SZ;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
-
- // Peripheral CS2 and CS3
- VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_PERIPH_BASE;
- VirtualMemoryTable[Index].Length = 2 * ARM_VE_SMB_PERIPH_SZ;
- VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
-
- // Map sparse memory region if present
- if (HasSparseMemory) {
- VirtualMemoryTable[++Index].PhysicalBase = SparseMemoryBase;
- VirtualMemoryTable[Index].VirtualBase = SparseMemoryBase;
- VirtualMemoryTable[Index].Length = SparseMemorySize;
- VirtualMemoryTable[Index].Attributes = CacheAttributes;
- }
-
- // End of Table
- VirtualMemoryTable[++Index].PhysicalBase = 0;
- VirtualMemoryTable[Index].VirtualBase = 0;
- VirtualMemoryTable[Index].Length = 0;
- VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
-
- *VirtualMemoryMap = VirtualMemoryTable;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf
deleted file mode 100644
index 5705b8bd3f..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = CTA9x4ArmVExpressLib
- FILE_GUID = aac05341-56df-4a77-b20f-f5daa456bd90
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSecLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- ArmTrustZoneLib
- ArmPlatformLib
- ArmPlatformSysConfigLib
- ArmPlatformSecExtraActionLib
- IoLib
- L2X0CacheLib
- PL301AxiLib
- PL341DmcLib
- PL35xSmcLib
- SerialPortLib
-
-[Sources.common]
- CTA9x4Sec.c
- CTA9x4Boot.asm | RVCT
- CTA9x4Boot.S | GCC
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdStandalone
- gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdTrustzoneSupport
-
- gArmTokenSpaceGuid.PcdL2x0ControllerBase
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S
deleted file mode 100644
index c14c986ccf..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <Drivers/PL35xSmc.h>
-#include <ArmPlatform.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformSecBootAction)
-GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)
-GCC_ASM_IMPORT(PL35xSmcInitialize)
-
-//
-// For each Chip Select: ChipSelect / SetCycle / SetOpMode
-//
-VersatileExpressSmcConfiguration:
- // NOR Flash 0
- .word PL350_SMC_DIRECT_CMD_ADDR_CS(0)
- .word PL350_SMC_SET_CYCLE_NAND_T_RC(0xA) | PL350_SMC_SET_CYCLE_NAND_T_WC(0x3) | PL350_SMC_SET_CYCLE_NAND_T_REA(0x1) | PL350_SMC_SET_CYCLE_NAND_T_WP(0x7) | PL350_SMC_SET_CYCLE_NAND_T_AR(0x1)
- .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT | PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT | PL350_SMC_SET_OPMODE_SET_ADV
-
- // NOR Flash 1
- .word PL350_SMC_DIRECT_CMD_ADDR_CS(4)
- .word PL350_SMC_SET_CYCLE_NAND_T_RC(0xA) | PL350_SMC_SET_CYCLE_NAND_T_WC(0x3) | PL350_SMC_SET_CYCLE_NAND_T_REA(0x1) | PL350_SMC_SET_CYCLE_NAND_T_WP(0x7) | PL350_SMC_SET_CYCLE_NAND_T_AR(0x1)
- .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT | PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT | PL350_SMC_SET_OPMODE_SET_ADV
-
- // SRAM
- .word PL350_SMC_DIRECT_CMD_ADDR_CS(2)
- .word PL350_SMC_SET_CYCLE_SRAM_T_RC(0x8) | PL350_SMC_SET_CYCLE_SRAM_T_WC(0x5) | PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x1) | PL350_SMC_SET_CYCLE_SRAM_T_WP(0x6) | PL350_SMC_SET_CYCLE_SRAM_T_PC(0x1) | PL350_SMC_SET_CYCLE_SRAM_T_TR(0x1)
- .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_ADV
-
- // Usb/Eth/VRAM
- .word PL350_SMC_DIRECT_CMD_ADDR_CS(3)
- .word PL350_SMC_SET_CYCLE_SRAM_T_RC(0xA) | PL350_SMC_SET_CYCLE_SRAM_T_WC(0xA) | PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x2) | PL350_SMC_SET_CYCLE_SRAM_T_WP(0x2) | PL350_SMC_SET_CYCLE_SRAM_T_PC(0x3) | PL350_SMC_SET_CYCLE_SRAM_T_TR(0x6)
- .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_SYNC | PL350_SMC_SET_OPMODE_SET_WR_SYNC
-
- // Memory Mapped Peripherals
- .word PL350_SMC_DIRECT_CMD_ADDR_CS(7)
- .word PL350_SMC_SET_CYCLE_SRAM_T_RC(0x6) | PL350_SMC_SET_CYCLE_SRAM_T_WC(0x5) | PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x1) | PL350_SMC_SET_CYCLE_SRAM_T_WP(0x2) | PL350_SMC_SET_CYCLE_SRAM_T_PC(0x1) | PL350_SMC_SET_CYCLE_SRAM_T_TR(0x1)
- .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_SYNC | PL350_SMC_SET_OPMODE_SET_WR_SYNC
-
- // VRAM
- .word PL350_SMC_DIRECT_CMD_ADDR_CS(1)
- .word 0x00049249
- .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_SYNC | PL350_SMC_SET_OPMODE_SET_WR_SYNC
-VersatileExpressSmcConfigurationEnd:
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ASM_PFX(ArmPlatformSecBootAction):
- bx lr
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ASM_PFX(ArmPlatformSecBootMemoryInit):
- mov r5, lr
-
- //
- // Initialize PL354 SMC
- //
- LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1)
- LoadConstantToReg (VersatileExpressSmcConfiguration, r2)
- LoadConstantToReg (VersatileExpressSmcConfigurationEnd, r3)
- blx ASM_PFX(PL35xSmcInitialize)
-
- //
- // Page mode setup for VRAM
- //
- LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2)
-
- // Read current state
- ldr r0, [r2, #0]
- ldr r0, [r2, #0]
- ldr r0, = 0x00000000
- str r0, [r2, #0]
- ldr r0, [r2, #0]
-
- // Enable page mode
- ldr r0, [r2, #0]
- ldr r0, [r2, #0]
- ldr r0, = 0x00000000
- str r0, [r2, #0]
- LoadConstantToReg (0x00900090, r0)
- str r0, [r2, #0]
-
- // Confirm page mode enabled
- ldr r0, [r2, #0]
- ldr r0, [r2, #0]
- ldr r0, = 0x00000000
- str r0, [r2, #0]
- ldr r0, [r2, #0]
-
- bx r5
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm
deleted file mode 100644
index 16fab1605b..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <Drivers/PL35xSmc.h>
-#include <ArmPlatform.h>
-#include <AutoGen.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformSecBootAction
- EXPORT ArmPlatformSecBootMemoryInit
- IMPORT PL35xSmcInitialize
-
- PRESERVE8
- AREA CTA9x4BootMode, CODE, READONLY
-
-//
-// For each Chip Select: ChipSelect / SetCycle / SetOpMode
-//
-VersatileExpressSmcConfiguration
- // NOR Flash 0
- DCD PL350_SMC_DIRECT_CMD_ADDR_CS(0)
- DCD PL350_SMC_SET_CYCLE_NAND_T_RC(0xA) :OR: PL350_SMC_SET_CYCLE_NAND_T_WC(0x3) :OR: PL350_SMC_SET_CYCLE_NAND_T_REA(0x1) :OR: PL350_SMC_SET_CYCLE_NAND_T_WP(0x7) :OR: PL350_SMC_SET_CYCLE_NAND_T_AR(0x1)
- DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_ADV
-
- // NOR Flash 1
- DCD PL350_SMC_DIRECT_CMD_ADDR_CS(4)
- DCD PL350_SMC_SET_CYCLE_NAND_T_RC(0xA) :OR: PL350_SMC_SET_CYCLE_NAND_T_WC(0x3) :OR: PL350_SMC_SET_CYCLE_NAND_T_REA(0x1) :OR: PL350_SMC_SET_CYCLE_NAND_T_WP(0x7) :OR: PL350_SMC_SET_CYCLE_NAND_T_AR(0x1)
- DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_ADV
-
- // SRAM
- DCD PL350_SMC_DIRECT_CMD_ADDR_CS(2)
- DCD PL350_SMC_SET_CYCLE_SRAM_T_RC(0x8) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WC(0x5) :OR: PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WP(0x6) :OR: PL350_SMC_SET_CYCLE_SRAM_T_PC(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_TR(0x1)
- DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_ADV
-
- // Usb/Eth/VRAM
- DCD PL350_SMC_DIRECT_CMD_ADDR_CS(3)
- DCD PL350_SMC_SET_CYCLE_SRAM_T_RC(0xA) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WC(0xA) :OR: PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x2) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WP(0x2) :OR: PL350_SMC_SET_CYCLE_SRAM_T_PC(0x3) :OR: PL350_SMC_SET_CYCLE_SRAM_T_TR(0x6)
- DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC
-
- // Memory Mapped Peripherals
- DCD PL350_SMC_DIRECT_CMD_ADDR_CS(7)
- DCD PL350_SMC_SET_CYCLE_SRAM_T_RC(0x6) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WC(0x5) :OR: PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WP(0x2) :OR: PL350_SMC_SET_CYCLE_SRAM_T_PC(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_TR(0x1)
- DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC
-
- // VRAM
- DCD PL350_SMC_DIRECT_CMD_ADDR_CS(1)
- DCD 0x00049249
- DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC
-VersatileExpressSmcConfigurationEnd
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ArmPlatformSecBootAction
- bx lr
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ArmPlatformSecBootMemoryInit
- mov r5, lr
-
- //
- // Initialize PL354 SMC
- //
- LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1)
- ldr r2, =VersatileExpressSmcConfiguration
- ldr r3, =VersatileExpressSmcConfigurationEnd
- blx PL35xSmcInitialize
-
- //
- // Page mode setup for VRAM
- //
- LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2)
-
- // Read current state
- ldr r0, [r2, #0]
- ldr r0, [r2, #0]
- ldr r0, = 0x00000000
- str r0, [r2, #0]
- ldr r0, [r2, #0]
-
- // Enable page mode
- ldr r0, [r2, #0]
- ldr r0, [r2, #0]
- ldr r0, = 0x00000000
- str r0, [r2, #0]
- ldr r0, = 0x00900090
- str r0, [r2, #0]
-
- // Confirm page mode enabled
- ldr r0, [r2, #0]
- ldr r0, [r2, #0]
- ldr r0, = 0x00000000
- str r0, [r2, #0]
- ldr r0, [r2, #0]
-
- bx r5
-
- END
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c
deleted file mode 100644
index 6fa0774f59..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/ArmPlatformSysConfigLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/SerialPortLib.h>
-
-#include <Drivers/ArmTrustzone.h>
-#include <Drivers/PL310L2Cache.h>
-
-#include <ArmPlatform.h>
-
-#define SerialPrint(txt) SerialPortWrite ((UINT8*)(txt), AsciiStrLen(txt)+1)
-
-/**
- Initialize the Secure peripherals and memory regions
-
- If Trustzone is supported by your platform then this function makes the required initialization
- of the secure peripherals and memory regions.
-
-**/
-VOID
-ArmPlatformSecTrustzoneInit (
- IN UINTN MpId
- )
-{
- // Nothing to do
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return;
- }
-
- //
- // Setup TZ Protection Controller
- //
-
- if (MmioRead32(ARM_VE_SYS_CFGRW1_REG) & ARM_VE_CFGRW1_TZASC_EN_BIT_MASK) {
- ASSERT (PcdGetBool (PcdTrustzoneSupport) == TRUE);
- } else {
- ASSERT (PcdGetBool (PcdTrustzoneSupport) == FALSE);
- }
-
- // Set Non Secure access for all devices
- TZPCSetDecProtBits(ARM_VE_TZPC_BASE, TZPC_DECPROT_0, 0xFFFFFFFF);
- TZPCSetDecProtBits(ARM_VE_TZPC_BASE, TZPC_DECPROT_1, 0xFFFFFFFF);
- TZPCSetDecProtBits(ARM_VE_TZPC_BASE, TZPC_DECPROT_2, 0xFFFFFFFF);
-
- // Remove Non secure access to secure devices
- TZPCClearDecProtBits(ARM_VE_TZPC_BASE, TZPC_DECPROT_0,
- ARM_VE_DECPROT_BIT_TZPC | ARM_VE_DECPROT_BIT_DMC_TZASC | ARM_VE_DECPROT_BIT_NMC_TZASC | ARM_VE_DECPROT_BIT_SMC_TZASC);
-
- TZPCClearDecProtBits(ARM_VE_TZPC_BASE, TZPC_DECPROT_2,
- ARM_VE_DECPROT_BIT_EXT_MAST_TZ | ARM_VE_DECPROT_BIT_DMC_TZASC_LOCK | ARM_VE_DECPROT_BIT_NMC_TZASC_LOCK | ARM_VE_DECPROT_BIT_SMC_TZASC_LOCK);
-
- //
- // Setup TZ Address Space Controller for the SMC. Create 5 Non Secure regions (NOR0, NOR1, SRAM, SMC Peripheral regions)
- //
-
- // NOR Flash 0 non secure (BootMon)
- TZASCSetRegion(ARM_VE_TZASC_BASE,1,TZASC_REGION_ENABLED,
- ARM_VE_SMB_NOR0_BASE,0,
- TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
-
- // NOR Flash 1. The first half of the NOR Flash1 must be secure for the secure firmware (sec_uefi.bin)
- if (PcdGetBool (PcdTrustzoneSupport) == TRUE) {
- //Note: Your OS Kernel must be aware of the secure regions before to enable this region
- TZASCSetRegion(ARM_VE_TZASC_BASE,2,TZASC_REGION_ENABLED,
- ARM_VE_SMB_NOR1_BASE + SIZE_32MB,0,
- TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW);
- } else {
- TZASCSetRegion(ARM_VE_TZASC_BASE,2,TZASC_REGION_ENABLED,
- ARM_VE_SMB_NOR1_BASE,0,
- TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
- }
-
- // Base of SRAM. Only half of SRAM in Non Secure world
- // First half non secure (16MB) + Second Half secure (16MB) = 32MB of SRAM
- if (PcdGetBool (PcdTrustzoneSupport) == TRUE) {
- //Note: Your OS Kernel must be aware of the secure regions before to enable this region
- TZASCSetRegion(ARM_VE_TZASC_BASE,3,TZASC_REGION_ENABLED,
- ARM_VE_SMB_SRAM_BASE,0,
- TZASC_REGION_SIZE_16MB, TZASC_REGION_SECURITY_NSRW);
- } else {
- TZASCSetRegion(ARM_VE_TZASC_BASE,3,TZASC_REGION_ENABLED,
- ARM_VE_SMB_SRAM_BASE,0,
- TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW);
- }
-
- // Memory Mapped Peripherals. All in non secure world
- TZASCSetRegion(ARM_VE_TZASC_BASE,4,TZASC_REGION_ENABLED,
- ARM_VE_SMB_PERIPH_BASE,0,
- TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
-
- // MotherBoard Peripherals and On-chip peripherals.
- TZASCSetRegion(ARM_VE_TZASC_BASE,5,TZASC_REGION_ENABLED,
- ARM_VE_SMB_MB_ON_CHIP_PERIPH_BASE,0,
- TZASC_REGION_SIZE_256MB, TZASC_REGION_SECURITY_NSRW);
-}
-
-/**
- Initialize controllers that must setup at the early stage
-
- Some peripherals must be initialized in Secure World.
- For example, some L2x0 requires to be initialized in Secure World
-
-**/
-RETURN_STATUS
-ArmPlatformSecInitialize (
- IN UINTN MpId
- )
-{
- UINT32 Value;
-
- // If the DRAM is remapped at 0x0 then we need to wake up the secondary cores from wfe
- // (waiting for the memory to be initialized) as the instruction is still in the remapped
- // flash region at 0x0 to jump in the C-code which lives in the NOR1 at 0x44000000 before
- // the region 0x0 is remapped as DRAM.
- if (!FeaturePcdGet (PcdNorFlashRemapping)) {
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- // Replaced ArmCallWFE () in ArmPlatformPkg/Sec/SecEntryPoint.(S|asm)
- ArmCallWFE ();
- } else {
- // Wake up the secondary core from ArmCallWFE () in ArmPlatformPkg/Sec/SecEntryPoint.(S|asm)
- ArmCallSEV ();
- }
- }
-
- // If it is not the primary core then there is nothing to do
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- // The L2x0 controller must be intialize in Secure World
- L2x0CacheInit(PcdGet32(PcdL2x0ControllerBase),
- PL310_TAG_LATENCIES(L2x0_LATENCY_8_CYCLES,L2x0_LATENCY_8_CYCLES,L2x0_LATENCY_8_CYCLES),
- PL310_DATA_LATENCIES(L2x0_LATENCY_8_CYCLES,L2x0_LATENCY_8_CYCLES,L2x0_LATENCY_8_CYCLES),
- 0,~0, // Use default setting for the Auxiliary Control Register
- FALSE);
-
- // Initialize the System Configuration
- ArmPlatformSysConfigInitialize ();
-
- // If we skip the PEI Core we could want to initialize the DRAM in the SEC phase.
- // If we are in standalone, we need the initialization to copy the UEFI firmware into DRAM
- if ((FeaturePcdGet (PcdSystemMemoryInitializeInSec)) || (FeaturePcdGet (PcdStandalone) == FALSE)) {
- // If it is not a standalone build ensure the PcdSystemMemoryInitializeInSec has been set
- ASSERT(FeaturePcdGet (PcdSystemMemoryInitializeInSec) == TRUE);
-
- // Initialize system memory (DRAM)
- ArmPlatformInitializeSystemMemory ();
- }
-
- // Memory Map remapping
- if (FeaturePcdGet (PcdNorFlashRemapping)) {
- SerialPrint ("Secure ROM at 0x0\n\r");
- } else {
- Value = MmioRead32 (ARM_VE_SYS_CFGRW1_REG); //Scc - CFGRW1
- // Remap the DRAM to 0x0
- MmioWrite32 (ARM_VE_SYS_CFGRW1_REG, (Value & 0x0FFFFFFF) | ARM_VE_CFGRW1_REMAP_DRAM);
- }
-
- return RETURN_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/GicV3.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/GicV3.S
deleted file mode 100644
index 035e095493..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/GicV3.S
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright (c) 2013-2014, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Chipset/AArch64.h>
-
-#ifndef __clang__
-// Register definitions used by GCC for GICv3 access.
-// These are defined by ARMCC, so keep them in the GCC specific code for now.
-#define ICC_SRE_EL2 S3_4_C12_C9_5
-#define ICC_SRE_EL3 S3_6_C12_C12_5
-#define ICC_CTLR_EL1 S3_0_C12_C12_4
-#define ICC_CTLR_EL3 S3_6_C12_C12_4
-#define ICC_PMR_EL1 S3_0_C4_C6_0
-#endif
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(InitializeGicV3)
-
-/* Initialize GICv3 to expose it as a GICv2 as UEFI does not support GICv3 yet */
-ASM_PFX(InitializeGicV3):
- // We have a GICv3. UEFI still uses the GICv2 mode. We must do enough setup
- // to allow Linux to use GICv3 if it chooses.
-
- // In order to setup NS side we need to enable it first.
- mrs x0, scr_el3
- orr x0, x0, #1
- msr scr_el3, x0
-
- // Enable SRE at EL3 and ICC_SRE_EL2 access
- mov x0, #((1 << 3) | (1 << 0)) // Enable | SRE
- mrs x1, ICC_SRE_EL3
- orr x1, x1, x0
- msr ICC_SRE_EL3, x1
- isb
-
- // Enable SRE at EL2 and ICC_SRE_EL1 access..
- mrs x1, ICC_SRE_EL2
- orr x1, x1, x0
- msr ICC_SRE_EL2, x1
- isb
-
- // Configure CPU interface
- msr ICC_CTLR_EL3, xzr
- isb
- msr ICC_CTLR_EL1, xzr
- isb
-
- // The MemoryMap view and Register view may not be consistent, So Set PMR again.
- mov w1, #1 << 7 // allow NS access to GICC_PMR
- msr ICC_PMR_EL1, x1
- isb
-
- // Remove the SCR.NS bit
- mrs x0, scr_el3
- and x0, x0, #~SCR_NS
- msr scr_el3, x0
- ret
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMBoot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMBoot.S
deleted file mode 100644
index 6c73cdad31..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMBoot.S
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <AutoGen.h>
-#include <ArmPlatform.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformSecBootAction)
-GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)
-GCC_ASM_EXPORT(ArmSecMpCoreSecondariesWrite)
-GCC_ASM_EXPORT(ArmSecMpCoreSecondariesRead)
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ASM_PFX(ArmPlatformSecBootAction):
- ret
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ASM_PFX(ArmPlatformSecBootMemoryInit):
- // The SMC does not need to be initialized for RTSM
- ret
-
-/* Write the flag register used to start Secondary cores */
-ASM_PFX(ArmSecMpCoreSecondariesWrite):
- // Write to the CPU Mailbox
- ret
-
-/* Read the flag register used to start Secondary cores */
-ASM_PFX(ArmSecMpCoreSecondariesRead):
- // Return the value from the CPU Mailbox
- mov x0, #0
- ret
-
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMFoundationBoot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMFoundationBoot.S
deleted file mode 100644
index a07ed97f5f..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/AArch64/RTSMFoundationBoot.S
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <AutoGen.h>
-#include <ArmPlatform.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformSecBootAction)
-GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)
-GCC_ASM_EXPORT(ArmSecMpCoreSecondariesWrite)
-GCC_ASM_EXPORT(ArmSecMpCoreSecondariesRead)
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ASM_PFX(ArmPlatformSecBootAction):
- ret
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the stack has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ASM_PFX(ArmPlatformSecBootMemoryInit):
- // The SMC does not need to be initialized for RTSM
- ret
-
-
-// NOTE:
-// The foundation model does not have the VE_SYS_REGS like all the other VE
-// platforms. We pick a spot in RAM that *should* be safe in the simple case
-// of no UEFI apps interfering (Only the Linux loader getting used). By the
-// time we come to load Linux we should have all the cores in a safe place.
-// The image expects to be loaded at 0xa0000000. We also place the mailboxes
-// here as it does not matter if we corrupt the image at this time.
-// NOTE also see: "ArmVExpressLibRTSM/RTSMFoundation.c"
-
-/* Write the flag register used to start Secondary cores */
-ASM_PFX(ArmSecMpCoreSecondariesWrite):
- ldr x1, =0xa0000000
- str w0, [x1]
- ret
-
-
-/* Read the flag register used to start Secondary cores */
-ASM_PFX(ArmSecMpCoreSecondariesRead):
- ldr x1, =0xa0000000
- ldr w0, [x1]
- ret
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.S
deleted file mode 100644
index 4a82cdbd48..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.S
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) 2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(InitializeGicV3)
-
-/* Initialize GICv3 to expose it as a GICv2 as UEFI does not support GICv3 yet */
-ASM_PFX(InitializeGicV3):
- // GICv3 Initialization not Supported yet
- bx lr
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.asm
deleted file mode 100644
index 4578c1c31d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/GicV3.asm
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT InitializeGicV3
-
- PRESERVE8
- AREA GicV3, CODE, READONLY
-
-/* Initialize GICv3 to expose it as a GICv2 as UEFI does not support GICv3 yet */
-InitializeGicV3 FUNCTION
- // GICv3 Initialization not Supported yet
- bx lr
- ENDFUNC
-
- END
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S
deleted file mode 100644
index 371adcb8f9..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <AutoGen.h>
-#include <ArmPlatform.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformSecBootAction)
-GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ASM_PFX(ArmPlatformSecBootAction):
- bx lr
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ASM_PFX(ArmPlatformSecBootMemoryInit):
- // The SMC does not need to be initialized for RTSM
- bx lr
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm
deleted file mode 100644
index 2d0b94679f..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// Copyright (c) 2011, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/ArmPlatformLib.h>
-#include <AutoGen.h>
-#include <ArmPlatform.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformSecBootAction
- EXPORT ArmPlatformSecBootMemoryInit
-
- PRESERVE8
- AREA RTSMVExpressBootMode, CODE, READONLY
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ArmPlatformSecBootAction
- bx lr
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ArmPlatformSecBootMemoryInit
- // The SMC does not need to be initialized for RTSM
- bx lr
-
- END
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressFoundationSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressFoundationSecLib.inf
deleted file mode 100644
index 2e05bece1d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressFoundationSecLib.inf
+++ /dev/null
@@ -1,42 +0,0 @@
-#/* @file
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RTSMArmVExpressFoundationSecLib
- FILE_GUID = 9de85c42-0894-11e2-8ed6-1c6f650265cc
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSecLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- SerialPortLib
-
-[Sources.common]
- RTSMFoundationSec.c
-
-[Sources.AARCH64]
- AArch64/RTSMFoundationBoot.S
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFvBaseAddress
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf
deleted file mode 100644
index ee7d3253cd..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf
+++ /dev/null
@@ -1,49 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RTSMArmVExpressSecLib
- FILE_GUID = 1fdaabb0-ab7d-480c-91ff-428dc1546f3a
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSecLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- ArmLib
- SerialPortLib
-
-[Sources.common]
- RTSMSec.c
-
-[Sources.ARM]
- Arm/RTSMBoot.asm | RVCT
- Arm/RTSMBoot.S | GCC
- Arm/GicV3.asm | RVCT
- Arm/GicV3.S | GCC
-
-[Sources.AARCH64]
- AArch64/RTSMBoot.S
- AArch64/GicV3.S
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMFoundationSec.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMFoundationSec.c
deleted file mode 100644
index bae6d0b1df..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMFoundationSec.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Drivers/PL310L2Cache.h>
-#include <Drivers/SP804Timer.h>
-
-#include <ArmPlatform.h>
-
-/**
- Initialize the Secure peripherals and memory regions
-
- If Trustzone is supported by your platform then this function makes the required initialization
- of the secure peripherals and memory regions.
-
-**/
-VOID
-ArmPlatformSecTrustzoneInit (
- IN UINTN MpId
- )
-{
- // No TZPC or TZASC on RTSM to initialize
-}
-
-/**
- Initialize controllers that must setup at the early stage
-
- Some peripherals must be initialized in Secure World.
- For example, some L2x0 requires to be initialized in Secure World
-
-**/
-RETURN_STATUS
-ArmPlatformSecInitialize (
- IN UINTN MpId
- )
-{
- /* The Foundation model has no SP810 to initialise. */
-
- return RETURN_SUCCESS;
-}
-
-/**
- Call before jumping to Normal World
-
- This function allows the firmware platform to do extra actions before
- jumping to the Normal World
-
-**/
-VOID
-ArmPlatformSecExtraAction (
- IN UINTN MpId,
- OUT UINTN* JumpAddress
- )
-{
- *JumpAddress = PcdGet64 (PcdFvBaseAddress);
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c
deleted file mode 100644
index 9023715ab0..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/ArmGicLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#include <Drivers/PL310L2Cache.h>
-#include <Drivers/SP804Timer.h>
-
-#include <ArmPlatform.h>
-
-// Initialize GICv3 to expose it as a GICv2 as UEFI does not support GICv3 yet
-VOID
-InitializeGicV3 (
- VOID
- );
-
-/**
- Initialize the Secure peripherals and memory regions
-
- If Trustzone is supported by your platform then this function makes the required initialization
- of the secure peripherals and memory regions.
-
-**/
-VOID
-ArmPlatformSecTrustzoneInit (
- IN UINTN MpId
- )
-{
- // No TZPC or TZASC on RTSM to initialize
-}
-
-/**
- Initialize controllers that must setup at the early stage
-
- Some peripherals must be initialized in Secure World.
- For example, some L2x0 requires to be initialized in Secure World
-
-**/
-RETURN_STATUS
-ArmPlatformSecInitialize (
- IN UINTN MpId
- )
-{
- UINT32 Identification;
-
- // If it is not the primary core then there is nothing to do
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- // Configure periodic timer (TIMER0) for 1MHz operation
- MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER0_TIMCLK);
- // Configure 1MHz clock
- MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER1_TIMCLK);
- // Configure SP810 to use 1MHz clock and disable
- MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER2_EN, SP810_SYS_CTRL_TIMER2_TIMCLK);
- // Configure SP810 to use 1MHz clock and disable
- MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER3_EN, SP810_SYS_CTRL_TIMER3_TIMCLK);
-
- // Read the GIC Identification Register
- Identification = ArmGicGetInterfaceIdentification (PcdGet32 (PcdGicInterruptInterfaceBase));
-
- // Check if we are GICv3
- if (ARM_GIC_ICCIIDR_GET_ARCH_VERSION(Identification) >= 0x3) {
- InitializeGicV3 ();
- }
-
- return RETURN_SUCCESS;
-}
-
-/**
- Call before jumping to Normal World
-
- This function allows the firmware platform to do extra actions before
- jumping to the Normal World
-
-**/
-VOID
-ArmPlatformSecExtraAction (
- IN UINTN MpId,
- OUT UINTN* JumpAddress
- )
-{
- *JumpAddress = PcdGet64 (PcdFvBaseAddress);
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
deleted file mode 100644
index 6dfbacd117..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/** @file ArmVExpressSysConfig.c
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-
-#include <Library/ArmPlatformSysConfigLib.h>
-#include <ArmPlatform.h>
-
-//
-// SYS_CFGCTRL Bits
-//
-#define SYS_CFGCTRL_START BIT31
-#define SYS_CFGCTRL_READ (0 << 30)
-#define SYS_CFGCTRL_WRITE (1 << 30)
-#define SYS_CFGCTRL_FUNCTION(fun) (((fun ) & 0x3F) << 20)
-#define SYS_CFGCTRL_SITE(site) (((site) & 0x3) << 16)
-#define SYS_CFGCTRL_POSITION(pos) (((pos ) & 0xF) << 12)
-#define SYS_CFGCTRL_DEVICE(dev) ((dev ) & 0xFFF)
-
-//
-// SYS_CFGSTAT Bits
-//
-#define SYS_CFGSTAT_ERROR BIT1
-#define SYS_CFGSTAT_COMPLETE BIT0
-
-/****************************************************************************
- *
- * This file makes it easier to access the System Configuration Registers
- * in the ARM Versatile Express motherboard.
- *
- ****************************************************************************/
-
-RETURN_STATUS
-ArmPlatformSysConfigInitialize (
- VOID
- )
-{
- return RETURN_SUCCESS;
-}
-
-/***************************************
- * GENERAL FUNCTION: AccessSysCfgRegister
- * Interacts with
- * SYS_CFGSTAT
- * SYS_CFGDATA
- * SYS_CFGCTRL
- * for setting and for reading out values
- ***************************************/
-
-RETURN_STATUS
-AccessSysCfgRegister (
- IN UINT32 ReadWrite,
- IN UINT32 Function,
- IN UINT32 Site,
- IN UINT32 Position,
- IN UINT32 Device,
- IN OUT UINT32* Data
- )
-{
- UINT32 SysCfgCtrl;
-
- // Clear the COMPLETE bit
- MmioAnd32(ARM_VE_SYS_CFGSTAT_REG, ~SYS_CFGSTAT_COMPLETE);
-
- // If writing, then set the data value
- if(ReadWrite == SYS_CFGCTRL_WRITE) {
- MmioWrite32(ARM_VE_SYS_CFGDATA_REG, *Data);
- }
-
- // Set the control value
- SysCfgCtrl = SYS_CFGCTRL_START | ReadWrite | SYS_CFGCTRL_FUNCTION(Function) | SYS_CFGCTRL_SITE(Site) |
- SYS_CFGCTRL_POSITION(Position) | SYS_CFGCTRL_DEVICE(Device);
- MmioWrite32(ARM_VE_SYS_CFGCTRL_REG, SysCfgCtrl);
-
- // Wait until the COMPLETE bit is set
- while ((MmioRead32(ARM_VE_SYS_CFGSTAT_REG) & SYS_CFGSTAT_COMPLETE) == 0);
-
- // Check for errors
- if(MmioRead32(ARM_VE_SYS_CFGSTAT_REG) & SYS_CFGSTAT_ERROR) {
- return RETURN_DEVICE_ERROR;
- }
-
- // If reading then get the data value
- if(ReadWrite == SYS_CFGCTRL_READ) {
- *Data = MmioRead32(ARM_VE_SYS_CFGDATA_REG);
- }
-
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGet (
- IN SYS_CONFIG_FUNCTION Function,
- OUT UINT32* Value
- )
-{
- UINT32 Site;
- UINT32 Position;
- UINT32 Device;
-
- Position = 0;
- Device = 0;
-
- // Intercept some functions
- switch(Function) {
-
- case SYS_CFG_OSC_SITE1:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_1_SITE;
- break;
-
- case SYS_CFG_OSC_SITE2:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_2_SITE;
- break;
-
- case SYS_CFG_MUXFPGA:
- Site = *Value;
- break;
-
- case SYS_CFG_OSC:
- case SYS_CFG_VOLT:
- case SYS_CFG_AMP:
- case SYS_CFG_TEMP:
- case SYS_CFG_RESET:
- case SYS_CFG_SCC:
- case SYS_CFG_DVIMODE:
- case SYS_CFG_POWER:
- Site = ARM_VE_MOTHERBOARD_SITE;
- break;
-
- case SYS_CFG_SHUTDOWN:
- case SYS_CFG_REBOOT:
- case SYS_CFG_RTC:
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return AccessSysCfgRegister (SYS_CFGCTRL_READ, Function, Site, Position, Device, Value);
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGetValues (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINTN Size,
- OUT UINT32* Values
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSet (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Value
- )
-{
- UINT32 Site;
- UINT32 Position;
- UINT32 Device;
-
- Position = 0;
- Device = 0;
-
- // Intercept some functions
- switch(Function) {
-
- case SYS_CFG_OSC_SITE1:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_1_SITE;
- break;
-
- case SYS_CFG_OSC_SITE2:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_2_SITE;
- break;
-
- case SYS_CFG_MUXFPGA:
- Site = Value;
- break;
-
- case SYS_CFG_RESET:
- case SYS_CFG_SCC:
- case SYS_CFG_SHUTDOWN:
- case SYS_CFG_REBOOT:
- case SYS_CFG_DVIMODE:
- case SYS_CFG_POWER:
- Site = ARM_VE_MOTHERBOARD_SITE;
- break;
-
- case SYS_CFG_OSC:
- case SYS_CFG_VOLT:
- case SYS_CFG_AMP:
- case SYS_CFG_TEMP:
- case SYS_CFG_RTC:
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return AccessSysCfgRegister (SYS_CFGCTRL_WRITE, Function, Site, Position, Device, &Value);
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSetDevice (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Device,
- IN UINT32 Value
- )
-{
- UINT32 Site;
- UINT32 Position;
-
- Position = 0;
-
- // Intercept some functions
- switch(Function) {
- case SYS_CFG_SCC:
-#ifdef ARM_VE_SCC_BASE
- MmioWrite32 ((ARM_VE_SCC_BASE + (Device * 4)),Value);
- return RETURN_SUCCESS;
-#else
- // There is no System Configuration Controller on the Model
- return RETURN_UNSUPPORTED;
-#endif
-
- case SYS_CFG_OSC_SITE1:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_1_SITE;
- break;
-
- case SYS_CFG_OSC_SITE2:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_2_SITE;
- break;
-
- case SYS_CFG_MUXFPGA:
- Site = Value;
- break;
-
- case SYS_CFG_RTC:
- return RETURN_UNSUPPORTED;
- //break;
-
- case SYS_CFG_OSC:
- case SYS_CFG_VOLT:
- case SYS_CFG_AMP:
- case SYS_CFG_TEMP:
- case SYS_CFG_RESET:
- case SYS_CFG_SHUTDOWN:
- case SYS_CFG_REBOOT:
- case SYS_CFG_DVIMODE:
- case SYS_CFG_POWER:
- Site = ARM_VE_MOTHERBOARD_SITE;
- break;
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return AccessSysCfgRegister (SYS_CFGCTRL_WRITE, Function, Site, Position, Device, &Value);
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
deleted file mode 100644
index b89455a421..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-#/** @file
-#
-# Component description file for ArmVExpressSysConfigLib module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmVExpressSysConfigLib
- FILE_GUID = a05b5cc0-82d2-11e0-82cb-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSysConfigLib|SEC DXE_DRIVER
-
-[Sources.common]
- ArmVExpressSysConfig.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- IoLib
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c
deleted file mode 100644
index 1f915e3b02..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/** @file ArmVExpressSysConfig.c
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-
-#include <Library/ArmPlatformSysConfigLib.h>
-#include <ArmPlatform.h>
-
-#include <Uefi.h>
-#include <Library/UefiRuntimeLib.h>
-
-//
-// SYS_CFGCTRL Bits
-//
-#define SYS_CFGCTRL_START BIT31
-#define SYS_CFGCTRL_READ (0 << 30)
-#define SYS_CFGCTRL_WRITE (1 << 30)
-#define SYS_CFGCTRL_FUNCTION(fun) (((fun ) & 0x3F) << 20)
-#define SYS_CFGCTRL_SITE(site) (((site) & 0x3) << 16)
-#define SYS_CFGCTRL_POSITION(pos) (((pos ) & 0xF) << 12)
-#define SYS_CFGCTRL_DEVICE(dev) ((dev ) & 0xFFF)
-
-//
-// SYS_CFGSTAT Bits
-//
-#define SYS_CFGSTAT_ERROR BIT1
-#define SYS_CFGSTAT_COMPLETE BIT0
-
-/****************************************************************************
- *
- * This file makes it easier to access the System Configuration Registers
- * in the ARM Versatile Express motherboard.
- *
- ****************************************************************************/
-
-RETURN_STATUS
-ArmPlatformSysConfigInitialize (
- VOID
- )
-{
- return RETURN_SUCCESS;
-}
-
-/***************************************
- * GENERAL FUNCTION: AccessSysCfgRegister
- * Interacts with
- * SYS_CFGSTAT
- * SYS_CFGDATA
- * SYS_CFGCTRL
- * for setting and for reading out values
- ***************************************/
-
-RETURN_STATUS
-AccessSysCfgRegister (
- IN UINT32 ReadWrite,
- IN UINT32 Function,
- IN UINT32 Site,
- IN UINT32 Position,
- IN UINT32 Device,
- IN OUT UINT32* Data
- )
-{
- UINT32 SysCfgCtrl;
-
- if (EfiAtRuntime ()) {
- return RETURN_UNSUPPORTED;
- }
-
- // Clear the COMPLETE bit
- MmioAnd32(ARM_VE_SYS_CFGSTAT_REG, ~SYS_CFGSTAT_COMPLETE);
-
- // If writing, then set the data value
- if(ReadWrite == SYS_CFGCTRL_WRITE) {
- MmioWrite32(ARM_VE_SYS_CFGDATA_REG, *Data);
- }
-
- // Set the control value
- SysCfgCtrl = SYS_CFGCTRL_START | ReadWrite | SYS_CFGCTRL_FUNCTION(Function) | SYS_CFGCTRL_SITE(Site) |
- SYS_CFGCTRL_POSITION(Position) | SYS_CFGCTRL_DEVICE(Device);
- MmioWrite32(ARM_VE_SYS_CFGCTRL_REG, SysCfgCtrl);
-
- // Wait until the COMPLETE bit is set
- while ((MmioRead32(ARM_VE_SYS_CFGSTAT_REG) & SYS_CFGSTAT_COMPLETE) == 0);
-
- // Check for errors
- if(MmioRead32(ARM_VE_SYS_CFGSTAT_REG) & SYS_CFGSTAT_ERROR) {
- return RETURN_DEVICE_ERROR;
- }
-
- // If reading then get the data value
- if(ReadWrite == SYS_CFGCTRL_READ) {
- *Data = MmioRead32(ARM_VE_SYS_CFGDATA_REG);
- }
-
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGet (
- IN SYS_CONFIG_FUNCTION Function,
- OUT UINT32* Value
- )
-{
- UINT32 Site;
- UINT32 Position;
- UINT32 Device;
-
- Position = 0;
- Device = 0;
-
- // Intercept some functions
- switch(Function) {
-
- case SYS_CFG_OSC_SITE1:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_1_SITE;
- break;
-
- case SYS_CFG_OSC_SITE2:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_2_SITE;
- break;
-
- case SYS_CFG_MUXFPGA:
- Site = *Value;
- break;
-
- case SYS_CFG_OSC:
- case SYS_CFG_VOLT:
- case SYS_CFG_AMP:
- case SYS_CFG_TEMP:
- case SYS_CFG_RESET:
- case SYS_CFG_SCC:
- case SYS_CFG_DVIMODE:
- case SYS_CFG_POWER:
- Site = ARM_VE_MOTHERBOARD_SITE;
- break;
-
- case SYS_CFG_SHUTDOWN:
- case SYS_CFG_REBOOT:
- case SYS_CFG_RTC:
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return AccessSysCfgRegister (SYS_CFGCTRL_READ, Function, Site, Position, Device, Value);
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGetValues (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINTN Size,
- OUT UINT32* Values
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSet (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Value
- )
-{
- UINT32 Site;
- UINT32 Position;
- UINT32 Device;
-
- Position = 0;
- Device = 0;
-
- // Intercept some functions
- switch(Function) {
-
- case SYS_CFG_OSC_SITE1:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_1_SITE;
- break;
-
- case SYS_CFG_OSC_SITE2:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_2_SITE;
- break;
-
- case SYS_CFG_MUXFPGA:
- Site = Value;
- break;
-
- case SYS_CFG_RESET:
- case SYS_CFG_SCC:
- case SYS_CFG_SHUTDOWN:
- case SYS_CFG_REBOOT:
- case SYS_CFG_DVIMODE:
- case SYS_CFG_POWER:
- Site = ARM_VE_MOTHERBOARD_SITE;
- break;
-
- case SYS_CFG_OSC:
- case SYS_CFG_VOLT:
- case SYS_CFG_AMP:
- case SYS_CFG_TEMP:
- case SYS_CFG_RTC:
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return AccessSysCfgRegister (SYS_CFGCTRL_WRITE, Function, Site, Position, Device, &Value);
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSetDevice (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Device,
- IN UINT32 Value
- )
-{
- UINT32 Site;
- UINT32 Position;
-
- Position = 0;
-
- // Intercept some functions
- switch(Function) {
- case SYS_CFG_SCC:
-#ifdef ARM_VE_SCC_BASE
- if (EfiAtRuntime ()) {
- return RETURN_UNSUPPORTED;
- }
- MmioWrite32 ((ARM_VE_SCC_BASE + (Device * 4)),Value);
- return RETURN_SUCCESS;
-#else
- // There is no System Configuration Controller on the Model
- return RETURN_UNSUPPORTED;
-#endif
-
- case SYS_CFG_OSC_SITE1:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_1_SITE;
- break;
-
- case SYS_CFG_OSC_SITE2:
- Function = SYS_CFG_OSC;
- Site = ARM_VE_DAUGHTERBOARD_2_SITE;
- break;
-
- case SYS_CFG_MUXFPGA:
- Site = Value;
- break;
-
- case SYS_CFG_RTC:
- return RETURN_UNSUPPORTED;
- //break;
-
- case SYS_CFG_OSC:
- case SYS_CFG_VOLT:
- case SYS_CFG_AMP:
- case SYS_CFG_TEMP:
- case SYS_CFG_RESET:
- case SYS_CFG_SHUTDOWN:
- case SYS_CFG_REBOOT:
- case SYS_CFG_DVIMODE:
- case SYS_CFG_POWER:
- Site = ARM_VE_MOTHERBOARD_SITE;
- break;
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return AccessSysCfgRegister (SYS_CFGCTRL_WRITE, Function, Site, Position, Device, &Value);
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf
deleted file mode 100644
index 988250d930..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-#/** @file
-#
-# Component description file for ArmVExpressSysConfigRuntimeLib module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-# Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmVExpressSysConfigRuntimeLib
- FILE_GUID = 6275b819-615c-4a36-814a-c1f330b4e5d9
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSysConfigLib|DXE_RUNTIME_DRIVER
-
-[Sources.common]
- ArmVExpressSysConfigRuntimeLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- IoLib
- UefiRuntimeLib
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c
deleted file mode 100644
index a57846715e..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
-
- Copyright (c) 2012, ARM Ltd. All rights reserved.
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-
-#include <Library/ArmPlatformSysConfigLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/LcdPlatformLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/Cpu.h>
-#include <Protocol/EdidDiscovered.h>
-#include <Protocol/EdidActive.h>
-
-#include <ArmPlatform.h>
-
-typedef struct {
- UINT32 Mode;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- LCD_BPP Bpp;
- UINT32 OscFreq;
-
- // These are used by HDLCD
- UINT32 HSync;
- UINT32 HBackPorch;
- UINT32 HFrontPorch;
- UINT32 VSync;
- UINT32 VBackPorch;
- UINT32 VFrontPorch;
-} LCD_RESOLUTION;
-
-
-LCD_RESOLUTION mResolutions[] = {
- { // Mode 0 : VGA : 640 x 480 x 24 bpp
- VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, VGA_OSC_FREQUENCY,
- VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH,
- VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH
- },
- { // Mode 1 : SVGA : 800 x 600 x 24 bpp
- SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, SVGA_OSC_FREQUENCY,
- SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH,
- SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH
- },
- { // Mode 2 : XGA : 1024 x 768 x 24 bpp
- XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, XGA_OSC_FREQUENCY,
- XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH,
- XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH
- },
- { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp
- SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (SXGA_OSC_FREQUENCY/2),
- SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH,
- SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH
- },
- { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp
- UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (UXGA_OSC_FREQUENCY/2),
- UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH,
- UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH
- },
- { // Mode 5 : HD : 1920 x 1080 x 24 bpp
- HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (HD_OSC_FREQUENCY/2),
- HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH,
- HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH
- }
-};
-
-EFI_EDID_DISCOVERED_PROTOCOL mEdidDiscovered = {
- 0,
- NULL
-};
-
-EFI_EDID_ACTIVE_PROTOCOL mEdidActive = {
- 0,
- NULL
-};
-
-EFI_STATUS
-LcdPlatformInitializeDisplay (
- IN EFI_HANDLE Handle
- )
-{
- EFI_STATUS Status;
-
- // Set the FPGA multiplexer to select the video output from the motherboard or the daughterboard
- Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, ARM_VE_DAUGHTERBOARD_1_SITE);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- // Install the EDID Protocols
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiEdidDiscoveredProtocolGuid, &mEdidDiscovered,
- &gEfiEdidActiveProtocolGuid, &mEdidActive,
- NULL
- );
-
- return Status;
-}
-
-EFI_STATUS
-LcdPlatformGetVram (
- OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress,
- OUT UINTN* VramSize
- )
-{
- EFI_STATUS Status;
- EFI_CPU_ARCH_PROTOCOL *Cpu;
- EFI_ALLOCATE_TYPE AllocationType;
-
- // Set the vram size
- *VramSize = LCD_VRAM_SIZE;
-
- *VramBaseAddress = (EFI_PHYSICAL_ADDRESS)LCD_VRAM_CORE_TILE_BASE;
-
- // Allocate the VRAM from the DRAM so that nobody else uses it.
- if (*VramBaseAddress == 0) {
- AllocationType = AllocateAnyPages;
- } else {
- AllocationType = AllocateAddress;
- }
- Status = gBS->AllocatePages (AllocationType, EfiBootServicesData, EFI_SIZE_TO_PAGES(((UINTN)LCD_VRAM_SIZE)), VramBaseAddress);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- // Ensure the Cpu architectural protocol is already installed
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);
- ASSERT_EFI_ERROR(Status);
-
- // Mark the VRAM as un-cacheable. The VRAM is inside the DRAM, which is cacheable.
- Status = Cpu->SetMemoryAttributes (Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC);
- ASSERT_EFI_ERROR(Status);
- if (EFI_ERROR(Status)) {
- gBS->FreePool (VramBaseAddress);
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-UINT32
-LcdPlatformGetMaxMode (
- VOID
- )
-{
- //
- // The following line will report correctly the total number of graphics modes
- // that could be supported by the graphics driver:
- //
- return (sizeof(mResolutions) / sizeof(LCD_RESOLUTION));
-}
-
-EFI_STATUS
-LcdPlatformSetMode (
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status;
-
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Set the video mode oscillator
- do {
- Status = ArmPlatformSysConfigSetDevice (SYS_CFG_OSC_SITE1, PcdGet32(PcdHdLcdVideoModeOscId), mResolutions[ModeNumber].OscFreq);
- } while (Status == EFI_TIMEOUT);
- if (EFI_ERROR(Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- // Set the DVI into the new mode
- do {
- Status = ArmPlatformSysConfigSet (SYS_CFG_DVIMODE, mResolutions[ModeNumber].Mode);
- } while (Status == EFI_TIMEOUT);
- if (EFI_ERROR(Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- // Set the multiplexer
- Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, ARM_VE_DAUGHTERBOARD_1_SITE);
- if (EFI_ERROR(Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- return Status;
-}
-
-EFI_STATUS
-LcdPlatformQueryMode (
- IN UINT32 ModeNumber,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info
- )
-{
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- Info->Version = 0;
- Info->HorizontalResolution = mResolutions[ModeNumber].HorizontalResolution;
- Info->VerticalResolution = mResolutions[ModeNumber].VerticalResolution;
- Info->PixelsPerScanLine = mResolutions[ModeNumber].HorizontalResolution;
-
- switch (mResolutions[ModeNumber].Bpp) {
- case LCD_BITS_PER_PIXEL_24:
- Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor;
- Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK;
- Info->PixelInformation.GreenMask = LCD_24BPP_GREEN_MASK;
- Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK;
- Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK;
- break;
-
- case LCD_BITS_PER_PIXEL_16_555:
- case LCD_BITS_PER_PIXEL_16_565:
- case LCD_BITS_PER_PIXEL_12_444:
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // These are not supported
- ASSERT(FALSE);
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LcdPlatformGetTimings (
- IN UINT32 ModeNumber,
- OUT UINT32* HRes,
- OUT UINT32* HSync,
- OUT UINT32* HBackPorch,
- OUT UINT32* HFrontPorch,
- OUT UINT32* VRes,
- OUT UINT32* VSync,
- OUT UINT32* VBackPorch,
- OUT UINT32* VFrontPorch
- )
-{
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- *HRes = mResolutions[ModeNumber].HorizontalResolution;
- *HSync = mResolutions[ModeNumber].HSync;
- *HBackPorch = mResolutions[ModeNumber].HBackPorch;
- *HFrontPorch = mResolutions[ModeNumber].HFrontPorch;
- *VRes = mResolutions[ModeNumber].VerticalResolution;
- *VSync = mResolutions[ModeNumber].VSync;
- *VBackPorch = mResolutions[ModeNumber].VBackPorch;
- *VFrontPorch = mResolutions[ModeNumber].VFrontPorch;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LcdPlatformGetBpp (
- IN UINT32 ModeNumber,
- OUT LCD_BPP * Bpp
- )
-{
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Bpp = mResolutions[ModeNumber].Bpp;
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf
deleted file mode 100644
index 7807247379..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-#/** @file
-#
-# Component description file for HdLcdArmLib module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = HdLcdArmVExpress
- FILE_GUID = 535a720e-06c0-4bb9-b563-452216abbed4
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = LcdPlatformLib
-
-[Sources.common]
-
-HdLcdArmVExpress.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
-
-[LibraryClasses]
- BaseLib
- ArmPlatformSysConfigLib
-
-[Protocols]
- gEfiEdidDiscoveredProtocolGuid # Produced
- gEfiEdidActiveProtocolGuid # Produced
-
-[Pcd]
- gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode
- gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
deleted file mode 100644
index a136bff4a1..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#include <PiDxe.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/NorFlashPlatformLib.h>
-#include <ArmPlatform.h>
-
-#define NOR_FLASH_DEVICE_COUNT 4
-
-NOR_FLASH_DESCRIPTION mNorFlashDevices[NOR_FLASH_DEVICE_COUNT] = {
- { // BootMon
- ARM_VE_SMB_NOR0_BASE,
- ARM_VE_SMB_NOR0_BASE,
- SIZE_256KB * 255,
- SIZE_256KB,
- { 0xE7223039, 0x5836, 0x41E1, { 0xB5, 0x42, 0xD7, 0xEC, 0x73, 0x6C, 0x5E, 0x59 } }
- },
- { // BootMon non-volatile storage
- ARM_VE_SMB_NOR0_BASE,
- ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,
- SIZE_64KB * 4,
- SIZE_64KB,
- { 0x02118005, 0x9DA7, 0x443A, { 0x92, 0xD5, 0x78, 0x1F, 0x02, 0x2A, 0xED, 0xBB } }
- },
- { // UEFI
- ARM_VE_SMB_NOR1_BASE,
- ARM_VE_SMB_NOR1_BASE,
- SIZE_256KB * 255,
- SIZE_256KB,
- { 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 0x4A } }
- },
- { // UEFI Variable Services non-volatile storage
- ARM_VE_SMB_NOR1_BASE,
- ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255,
- SIZE_64KB * 3, //FIXME: Set 3 blocks because I did not succeed to copy 4 blocks into the ARM Versatile Express NOR Flash in the last NOR Flash. It should be 4 blocks
- SIZE_64KB,
- { 0xCC2CBF29, 0x1498, 0x4CDD, { 0x81, 0x71, 0xF8, 0xB6, 0xB4, 0x1D, 0x09, 0x09 } }
- }
-};
-
-EFI_STATUS
-NorFlashPlatformInitialization (
- VOID
- )
-{
- // Everything seems ok so far, so now we need to disable the platform-specific
- // flash write protection for Versatile Express
- if ((MmioRead32 (ARM_VE_SYS_FLASH) & 0x1) == 0) {
- // Writing to NOR FLASH is disabled, so enable it
- MmioWrite32 (ARM_VE_SYS_FLASH,1);
- DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: informational - Had to enable HSYS_FLASH flag.\n" ));
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-NorFlashPlatformGetDevices (
- OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
- OUT UINT32 *Count
- )
-{
- if ((NorFlashDevices == NULL) || (Count == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *NorFlashDevices = mNorFlashDevices;
- *Count = NOR_FLASH_DEVICE_COUNT;
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
deleted file mode 100644
index 0798cc30d8..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = NorFlashArmVExpressLib
- FILE_GUID = c0f5dfa0-7599-11e0-9665-0002a5d5c51b
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = NorFlashPlatformLib
-
-[Sources.common]
- NorFlashArmVExpress.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- IoLib
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c
deleted file mode 100644
index 2000c9bdf4..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-
-#include <Library/ArmPlatformSysConfigLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/LcdPlatformLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/Cpu.h>
-#include <Protocol/EdidDiscovered.h>
-#include <Protocol/EdidActive.h>
-
-#include <ArmPlatform.h>
-
-typedef struct {
- UINT32 Mode;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- LCD_BPP Bpp;
- UINT32 OscFreq;
-
- UINT32 HSync;
- UINT32 HBackPorch;
- UINT32 HFrontPorch;
- UINT32 VSync;
- UINT32 VBackPorch;
- UINT32 VFrontPorch;
-} LCD_RESOLUTION;
-
-
-LCD_RESOLUTION mResolutions[] = {
- { // Mode 0 : VGA : 640 x 480 x 24 bpp
- VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, VGA_OSC_FREQUENCY,
- VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH,
- VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH
- },
- { // Mode 1 : SVGA : 800 x 600 x 24 bpp
- SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, SVGA_OSC_FREQUENCY,
- SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH,
- SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH
- },
- { // Mode 2 : XGA : 1024 x 768 x 24 bpp
- XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, XGA_OSC_FREQUENCY,
- XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH,
- XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH
- },
- { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp
- SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (SXGA_OSC_FREQUENCY/2),
- SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH,
- SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH
- },
- { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp
- UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (UXGA_OSC_FREQUENCY/2),
- UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH,
- UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH
- },
- { // Mode 5 : HD : 1920 x 1080 x 24 bpp
- HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (HD_OSC_FREQUENCY/2),
- HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH,
- HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH
- },
- { // Mode 6 : VGA : 640 x 480 x 16 bpp (565 Mode)
- VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_565, VGA_OSC_FREQUENCY,
- VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH,
- VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH
- },
- { // Mode 7 : SVGA : 800 x 600 x 16 bpp (565 Mode)
- SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_565, SVGA_OSC_FREQUENCY,
- SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH,
- SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH
- },
- { // Mode 8 : XGA : 1024 x 768 x 16 bpp (565 Mode)
- XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_565, XGA_OSC_FREQUENCY,
- XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH,
- XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH
- },
- { // Mode 9 : VGA : 640 x 480 x 15 bpp
- VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, VGA_OSC_FREQUENCY,
- VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH,
- VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH
- },
- { // Mode 10 : SVGA : 800 x 600 x 15 bpp
- SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, SVGA_OSC_FREQUENCY,
- SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH,
- SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH
- },
- { // Mode 11 : XGA : 1024 x 768 x 15 bpp
- XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, XGA_OSC_FREQUENCY,
- XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH,
- XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH
- },
- { // Mode 12 : XGA : 1024 x 768 x 15 bpp - All the timing info is derived from Linux Kernel Driver Settings
- XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, 63500000,
- XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH,
- XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH
- },
- { // Mode 13 : VGA : 640 x 480 x 12 bpp (444 Mode)
- VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_12_444, VGA_OSC_FREQUENCY,
- VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH,
- VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH
- },
- { // Mode 14 : SVGA : 800 x 600 x 12 bpp (444 Mode)
- SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_12_444, SVGA_OSC_FREQUENCY,
- SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH,
- SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH
- },
- { // Mode 15 : XGA : 1024 x 768 x 12 bpp (444 Mode)
- XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_12_444, XGA_OSC_FREQUENCY,
- XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH,
- XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH
- }
-};
-
-EFI_EDID_DISCOVERED_PROTOCOL mEdidDiscovered = {
- 0,
- NULL
-};
-
-EFI_EDID_ACTIVE_PROTOCOL mEdidActive = {
- 0,
- NULL
-};
-
-
-EFI_STATUS
-LcdPlatformInitializeDisplay (
- IN EFI_HANDLE Handle
- )
-{
- EFI_STATUS Status;
-
- // Set the FPGA multiplexer to select the video output from the motherboard or the daughterboard
- Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, PL111_CLCD_SITE);
- if (!EFI_ERROR(Status)) {
- // Install the EDID Protocols
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Handle,
- &gEfiEdidDiscoveredProtocolGuid, &mEdidDiscovered,
- &gEfiEdidActiveProtocolGuid, &mEdidActive,
- NULL
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-LcdPlatformGetVram (
- OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress,
- OUT UINTN* VramSize
- )
-{
- EFI_STATUS Status;
- EFI_CPU_ARCH_PROTOCOL *Cpu;
-
- Status = EFI_SUCCESS;
-
- // Is it on the motherboard or on the daughterboard?
- switch(PL111_CLCD_SITE) {
-
- case ARM_VE_MOTHERBOARD_SITE:
- *VramBaseAddress = (EFI_PHYSICAL_ADDRESS) PL111_CLCD_VRAM_MOTHERBOARD_BASE;
- *VramSize = LCD_VRAM_SIZE;
- break;
-
- case ARM_VE_DAUGHTERBOARD_1_SITE:
- *VramBaseAddress = (EFI_PHYSICAL_ADDRESS) LCD_VRAM_CORE_TILE_BASE;
- *VramSize = LCD_VRAM_SIZE;
-
- // Allocate the VRAM from the DRAM so that nobody else uses it.
- Status = gBS->AllocatePages( AllocateAddress, EfiBootServicesData, EFI_SIZE_TO_PAGES(((UINTN)LCD_VRAM_SIZE)), VramBaseAddress);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- // Ensure the Cpu architectural protocol is already installed
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);
- ASSERT_EFI_ERROR(Status);
-
- // Mark the VRAM as un-cachable. The VRAM is inside the DRAM, which is cachable.
- Status = Cpu->SetMemoryAttributes(Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC);
- ASSERT_EFI_ERROR(Status);
- if (EFI_ERROR(Status)) {
- gBS->FreePool(VramBaseAddress);
- return Status;
- }
- break;
-
- default:
- // Unsupported site
- Status = EFI_UNSUPPORTED;
- break;
- }
-
- return Status;
-}
-
-UINT32
-LcdPlatformGetMaxMode (
- VOID
- )
-{
- // The following line will report correctly the total number of graphics modes
- // supported by the PL111CLCD.
- //return (sizeof(mResolutions) / sizeof(CLCD_RESOLUTION)) - 1;
-
- // However, on some platforms it is desirable to ignore some graphics modes.
- // This could be because the specific implementation of PL111 has certain limitations.
-
- // Set the maximum mode allowed
- return (PcdGet32(PcdPL111LcdMaxMode));
-}
-
-EFI_STATUS
-LcdPlatformSetMode (
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status;
- UINT32 LcdSite;
- UINT32 OscillatorId;
- SYS_CONFIG_FUNCTION Function;
- UINT32 SysId;
-
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- LcdSite = PL111_CLCD_SITE;
-
- switch(LcdSite) {
- case ARM_VE_MOTHERBOARD_SITE:
- Function = SYS_CFG_OSC;
- OscillatorId = PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID;
- break;
- case ARM_VE_DAUGHTERBOARD_1_SITE:
- Function = SYS_CFG_OSC_SITE1;
- OscillatorId = (UINT32)PcdGet32(PcdPL111LcdVideoModeOscId);
- break;
- default:
- return EFI_UNSUPPORTED;
- }
-
- // Set the video mode oscillator
- Status = ArmPlatformSysConfigSetDevice (Function, OscillatorId, mResolutions[ModeNumber].OscFreq);
- if (EFI_ERROR(Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- // The FVP foundation model does not have an LCD.
- // On the FVP models the GIC variant in encoded in bits [15:12].
- // Note: The DVI Mode is not modelled by RTSM or FVP models.
- SysId = MmioRead32 (ARM_VE_SYS_ID_REG);
- if (SysId != ARM_RTSM_SYS_ID) {
- // Take out the FVP GIC variant to reduce the permutations.
- SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK;
- if (SysId != ARM_FVP_BASE_BOARD_SYS_ID) {
- // Set the DVI into the new mode
- Status = ArmPlatformSysConfigSet (SYS_CFG_DVIMODE, mResolutions[ModeNumber].Mode);
- if (EFI_ERROR(Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
- }
- }
-
- // Set the multiplexer
- Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, LcdSite);
- if (EFI_ERROR(Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- return Status;
-}
-
-EFI_STATUS
-LcdPlatformQueryMode (
- IN UINT32 ModeNumber,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info
- )
-{
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- Info->Version = 0;
- Info->HorizontalResolution = mResolutions[ModeNumber].HorizontalResolution;
- Info->VerticalResolution = mResolutions[ModeNumber].VerticalResolution;
- Info->PixelsPerScanLine = mResolutions[ModeNumber].HorizontalResolution;
-
- switch (mResolutions[ModeNumber].Bpp) {
- case LCD_BITS_PER_PIXEL_24:
- Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor;
- Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK;
- Info->PixelInformation.GreenMask = LCD_24BPP_GREEN_MASK;
- Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK;
- Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK;
- break;
-
- case LCD_BITS_PER_PIXEL_16_555:
- case LCD_BITS_PER_PIXEL_16_565:
- case LCD_BITS_PER_PIXEL_12_444:
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // These are not supported
- ASSERT(FALSE);
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LcdPlatformGetTimings (
- IN UINT32 ModeNumber,
- OUT UINT32* HRes,
- OUT UINT32* HSync,
- OUT UINT32* HBackPorch,
- OUT UINT32* HFrontPorch,
- OUT UINT32* VRes,
- OUT UINT32* VSync,
- OUT UINT32* VBackPorch,
- OUT UINT32* VFrontPorch
- )
-{
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- *HRes = mResolutions[ModeNumber].HorizontalResolution;
- *HSync = mResolutions[ModeNumber].HSync;
- *HBackPorch = mResolutions[ModeNumber].HBackPorch;
- *HFrontPorch = mResolutions[ModeNumber].HFrontPorch;
- *VRes = mResolutions[ModeNumber].VerticalResolution;
- *VSync = mResolutions[ModeNumber].VSync;
- *VBackPorch = mResolutions[ModeNumber].VBackPorch;
- *VFrontPorch = mResolutions[ModeNumber].VFrontPorch;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LcdPlatformGetBpp (
- IN UINT32 ModeNumber,
- OUT LCD_BPP * Bpp
- )
-{
- if (ModeNumber >= LcdPlatformGetMaxMode ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Bpp = mResolutions[ModeNumber].Bpp;
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf
deleted file mode 100644
index d1978e7110..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf
+++ /dev/null
@@ -1,43 +0,0 @@
-#/** @file
-#
-# Component description file for ArmVeGraphicsDxe module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL111LcdArmVExpressLib
- FILE_GUID = b7f06f20-496f-11e0-a8e8-0002a5d5c51b
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = LcdPlatformLib
-
-[Sources.common]
- PL111LcdArmVExpress.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- ArmPlatformSysConfigLib
-
-[Protocols]
- gEfiEdidDiscoveredProtocolGuid # Produced
- gEfiEdidActiveProtocolGuid # Produced
-
-[Pcd]
- gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode
- gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c
deleted file mode 100644
index bafb6f8093..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- Template library implementation to support ResetSystem Runtime call.
-
- Fill in the templates with what ever makes you system reset.
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/EfiResetSystemLib.h>
-#include <Library/ArmPlatformSysConfigLib.h>
-
-#include <ArmPlatform.h>
-
-/**
- Resets the entire platform.
-
- @param ResetType The type of reset to perform.
- @param ResetStatus The status code for the reset.
- @param DataSize The size, in bytes, of WatchdogData.
- @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
- EfiResetShutdown the data buffer starts with a Null-terminated
- Unicode string, optionally followed by additional binary data.
-
-**/
-EFI_STATUS
-EFIAPI
-LibResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN CHAR16 *ResetData OPTIONAL
- )
-{
- switch (ResetType) {
- case EfiResetPlatformSpecific:
- // Map the platform specific reset as reboot
- case EfiResetWarm:
- // Map a warm reset into a cold reset
- case EfiResetCold:
- // Send the REBOOT function to the platform microcontroller
- ArmPlatformSysConfigSet (SYS_CFG_REBOOT, 0);
-
- // We should never be here
- while(1);
- case EfiResetShutdown:
- // Send the SHUTDOWN function to the platform microcontroller
- ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0);
-
- // We should never be here
- while(1);
- }
-
- ASSERT(FALSE);
- return EFI_UNSUPPORTED;
-}
-
-/**
- Initialize any infrastructure required for LibResetSystem () to function.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-LibInitializeResetSystem (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf
deleted file mode 100644
index 8c17ea8cdb..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-#/** @file
-# Reset System lib to make it easy to port new platforms
-#
-# Copyright (c) 2008, Apple Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmVeResetSystemLib
- FILE_GUID = 36885202-0854-4373-bfd2-95d229b44d44
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = EfiResetSystemLib
-
-[Sources.common]
- ResetSystemLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- DebugLib
- BaseLib
- ArmPlatformSysConfigLib
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/LICENSE.TXT b/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/LICENSE.TXT
deleted file mode 100644
index e33cd4cdcf..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/LICENSE.TXT
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2011-2013 ARM Limited
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of ARM nor the names of its contributors may be
- used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/Makefile b/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/Makefile
deleted file mode 100644
index 2ac8368b12..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Makefile - build a UEFI boot image for booting from different exception levels.
-#
-# Copyright (C) 2011-2013 ARM Limited.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of ARM nor the names of its contributors may be
-# used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# This license can also be found in the LICENSE.TXT file.
-
-
-# VE
-PHYS_OFFSET := 0x80000000
-UART_BASE := 0x1c090000
-GIC_DIST_BASE := 0x2c001000
-GIC_CPU_BASE := 0x2c002000
-CNTFRQ := 0x01800000 # 24Mhz
-
-BOOTLOADER := boot.S
-LD_SCRIPT := model.lds.S
-IMAGE_1 := uefi-bootstrap-el1.axf
-IMAGE_2 := uefi-bootstrap-el2.axf
-IMAGE_3 := uefi-bootstrap-el3.axf
-IMAGE_3F := uefi-bootstrap-el3-foundation.axf
-
-
-CROSS_COMPILE ?= aarch64-none-elf-
-CC := $(CROSS_COMPILE)gcc
-LD := $(CROSS_COMPILE)ld
-
-all: $(IMAGE_1) $(IMAGE_2) $(IMAGE_3) $(IMAGE_3F)
-
-clean:
- rm -f *.axf *.o *.lds
-
-$(IMAGE_1): boot1.o model1.lds
- $(LD) -o $@ --script=model1.lds
-
-$(IMAGE_2): boot2.o model2.lds
- $(LD) -o $@ --script=model2.lds
-
-$(IMAGE_3): boot3.o model3.lds
- $(LD) -o $@ --script=model3.lds
-
-$(IMAGE_3F): boot3f.o model3f.lds
- $(LD) -o $@ --script=model3f.lds
-
-boot1.o: $(BOOTLOADER) Makefile
- $(CC) $(CPPFLAGS) -DUART_BASE=$(UART_BASE) -DCNTFRQ=$(CNTFRQ) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -DSTART_EL2=1 -DSTART_EL1=1 -c -o $@ $(BOOTLOADER)
-
-boot2.o: $(BOOTLOADER) Makefile
- $(CC) $(CPPFLAGS) -DUART_BASE=$(UART_BASE) -DCNTFRQ=$(CNTFRQ) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -DSTART_EL2=1 -c -o $@ $(BOOTLOADER)
-
-boot3.o: $(BOOTLOADER) Makefile
- $(CC) $(CPPFLAGS) -DUART_BASE=$(UART_BASE) -DCNTFRQ=$(CNTFRQ) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER)
-
-boot3f.o: $(BOOTLOADER) Makefile
- $(CC) $(CPPFLAGS) -DUART_BASE=$(UART_BASE) -DCNTFRQ=$(CNTFRQ) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -DFOUNDATION_MODEL=1 -c -o $@ $(BOOTLOADER)
-
-model1.lds: $(LD_SCRIPT) Makefile boot1.o
- $(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DBOOT1 -E -P -C -o $@ $<
-
-model2.lds: $(LD_SCRIPT) Makefile boot2.o
- $(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DBOOT2 -E -P -C -o $@ $<
-
-model3.lds: $(LD_SCRIPT) Makefile boot3.o
- $(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DBOOT3 -E -P -C -o $@ $<
-
-model3f.lds: $(LD_SCRIPT) Makefile boot3f.o
- $(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DBOOT3F -E -P -C -o $@ $<
-
-.PHONY: all clean
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/boot.S b/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/boot.S
deleted file mode 100644
index a4b0055c78..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/boot.S
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * boot.S - simple register setup code for junping to a second stage bootloader
- *
- * Copyright (C) 2011-2013 ARM Limited.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of ARM nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This license can also be found in the LICENSE.TXT file.
- */
-
- .text
-
- .globl _start
-
-.set LED_ADDR, 0x1c010008
-
-_start:
- /*
- * EL3 initialisation
- */
-
- // Set LED to show progress.
- ldr x1, =LED_ADDR
- mov w0, #0x1
- str w0, [x1]
- dsb sy
-
-#if defined START_EL2
-
- mrs x0, CurrentEL
- cmp x0, #0xc // EL3?
- b.ne start_ns // skip EL3 initialisation
-
- mov x0, #0x30 // RES1
- orr x0, x0, #(1 << 0) // Non-secure bit
- orr x0, x0, #(1 << 8) // HVC enable
- orr x0, x0, #(1 << 10) // 64-bit EL2
- msr scr_el3, x0
-
- msr cptr_el3, xzr // Disable copro. traps to EL3
-
- ldr x0, =CNTFRQ
- msr cntfrq_el0, x0
-
- /*
- * Check for the primary CPU to avoid a race on the distributor
- * registers.
- */
- mrs x0, mpidr_el1
- tst x0, #15
- b.ne 1f // secondary CPU
-
- ldr x1, =GIC_DIST_BASE // GICD_CTLR
- mov w0, #3 // EnableGrp0 | EnableGrp1
- str w0, [x1]
-
-1: ldr x1, =GIC_DIST_BASE + 0x80 // GICD_IGROUPR
- mov w0, #~0 // Grp1 interrupts
- str w0, [x1], #4
- b.ne 2f // Only local interrupts for secondary CPUs
- str w0, [x1], #4
- str w0, [x1], #4
-
-2: ldr x1, =GIC_CPU_BASE // GICC_CTLR
- ldr w0, [x1]
- orr w0, w0, #3 // EnableGrp0 | EnableGrp1
- str w0, [x1]
-
- mov w0, #1 << 7 // allow NS access to GICC_PMR
- str w0, [x1, #4] // GICC_PMR
-
- msr sctlr_el2, xzr
-
-#if defined START_EL1
-
- /* Now setup our EL1. Controlled by EL2 config on Model */
- mrs x0, hcr_el2 // Read EL2 Hypervisor configuration Register
- orr x0, x0, #(1 << 31) // Set EL1 to be 64bit
-
- // Send all interrupts to their respective Exception levels for EL2
- bic x0, x0, #(1 << 3) // Disable virtual FIQ
- bic x0, x0, #(1 << 4) // Disable virtual IRQ
- bic x0, x0, #(1 << 5) // Disable virtual SError and Abort
- msr hcr_el2, x0 // Write back our settings
-
- /*
- * Enable architected timer access
- */
- mrs x0, cnthctl_el2
- orr x0, x0, #3 // Enable EL1 access to timers
- msr cnthctl_el2, x0
-
- mrs x0, cntkctl_el1
- orr x0, x0, #3 // EL0 access to counters
- msr cntkctl_el1, x0
-
- /* Set ID regs */
- mrs x0, midr_el1
- mrs x1, mpidr_el1
- msr vpidr_el2, x0
- msr vmpidr_el2, x1
-
- /* Coprocessor traps. */
- mov x0, #0x33ff
- msr cptr_el2, x0 // Disable copro. traps to EL2
-
- msr hstr_el2, xzr // Disable CP15 traps to EL2
-
-#endif // START_EL1
-
- /* Configure UART. Primary CPU only */
- mrs x4, mpidr_el1
- tst x4, #15
- b.ne 1f
-
- /*
- * UART initialisation (38400 8N1)
- */
- ldr x4, =UART_BASE // UART base
- mov w5, #0x10 // ibrd
- str w5, [x4, #0x24]
- mov w5, #0xc300
- orr w5, w5, #0x0001 // cr
- str w5, [x4, #0x30]
-
- /*
- * Prepare the switch to the EL2_SP2 mode from EL3
- */
-1: ldr x0, =start_ns // Return after mode switch
-#if defined START_EL1
- mov x1, #0x3c5 // EL1_SP1 | D | A | I | F
-#else
- mov x1, #0x3c9 // EL2_SP2 | D | A | I | F
-#endif
-
- msr elr_el3, x0
- msr spsr_el3, x1
- eret
-
-#endif // START_EL2
-
-
-start_ns:
-
-/*
- * We do not have NOR flash on the Foundation model. So run UEFI from RAM.
- * On the full model we use the NOR FLASH to store UEFI, so start there.
- */
-#if defined FOUNDATION_MODEL
- mov x0, #0xa0000000
-#else
- mov x0, #0x0
-#endif
- br x0
-
- .ltorg
-
- .org 0x200
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/model.lds.S b/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/model.lds.S
deleted file mode 100644
index d963aec550..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/model.lds.S
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * model.lds.S - simple linker script for stand-alone Linux booting
- *
- * Copyright (C) 2011, 2012 ARM Limited.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of ARM nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This license can also be found in the LICENSE.TXT file.
- */
-
-OUTPUT_FORMAT("elf64-littleaarch64")
-OUTPUT_ARCH(aarch64)
-TARGET(binary)
-
-#ifdef BOOT1
-INPUT(./boot1.o)
-#endif
-
-#ifdef BOOT2
-INPUT(./boot2.o)
-#endif
-
-#ifdef BOOT3
-INPUT(./boot3.o)
-#endif
-
-#ifdef BOOT3F
-INPUT(./boot3f.o)
-#endif
-
-SECTIONS
-{
- . = PHYS_OFFSET;
-#ifdef BOOT1
- .text : { boot1.o }
-#endif
-
-#ifdef BOOT2
- .text : { boot2.o }
-#endif
-
-#ifdef BOOT3
- .text : { boot3.o }
-#endif
-
-#ifdef BOOT3F
- .text : { boot3f.o }
-#endif
-
- .data : { *(.data) }
- .bss : { *(.bss) }
-}
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.html b/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.html
deleted file mode 100644
index 5627285265..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<h1>AArch64 UEFI bootstraps</h1>
-
-<p>Copyright (c) 2011-2013 ARM Limited. All rights reserved.
-See the <code>LICENSE.TXT</code> file for more information.</p>
-
-<p>Contents:</p>
-
-<ul>
-<li>Introduction</li>
-<li>Build</li>
-<li>Use on ARMv8 RTSM and FVP models</li>
-<li>Use on ARMv8 Foundation model</li>
-</ul>
-
-<h2>Introduction</h2>
-
-<p>A bootstrap can be used to change the model state, like the Exception
-Level (EL), before executing the UEFI binary.</p>
-
-<p>For the ARMv8 RTSM and FVP models this can be used to show/test the UEFI binary
-starting at different exception levels. The ARMv8 models start at EL3 by
-default.</p>
-
-<p>In the case of the Foundation model a bootstrap is required to jump to the
-UEFI binary as loaded in RAM. This is required as the Foundation model cannot
-load and execute UEFI binaries directly. The Foundation model can only load and
-execute ELF binaries.</p>
-
-<h2>Build</h2>
-
-<p>Build the bootstraps using a AArch64 GCC cross-compiler. By default the
-<code>Makefile</code> is configured to assume a GCC bare-metal toolchain:</p>
-
-<pre><code>PATH=$PATH:&lt;path/to/baremetal-tools/bin/&gt; make clean
-PATH=$PATH:&lt;path/to/baremetal-tools/bin/&gt; make
-</code></pre>
-
-<p>To build the bootstraps with a Linux GCC toolchain use the following
-commands:</p>
-
-<pre><code>PATH=$PATH:&lt;path/to/aarch64-linux-gnu-tools/bin/&gt; make clean
-PATH=$PATH:&lt;path/to/aarch64-linux-gnu-tools/bin/&gt; CROSS_COMPILE=&lt;gcc-prefix&gt; make
-</code></pre>
-
-<p>The <code>gcc-prefix</code> depends on the specific toolchain distribution used. It can be
-"aarch64-linux-gnu-" for example.</p>
-
-<p>This will result in four <code>axf</code> files:</p>
-
-<ul>
-<li><p>uefi-bootstrap-el3 : The bootstrap jumps to the UEFI code in FLASH without
- changing anything.</p></li>
-<li><p>uefi-bootstrap-el2 : Setup EL3 and switch the model to EL2 before jumping to the
- UEFI code in FLASH.</p></li>
-<li><p>uefi-bootstrap-el1 : Setup EL3 and prepare to run at non-secure EL1. Switch to
- non-secure EL1 and run the UEFI code in FLASH.</p></li>
-<li><p>uefi-bootstrap-el3-foundation : The bootstrap jumps to the UEFI code in RAM
- without changing anything. Only to be used with the
- Foundation model. The Foundation model does not have
- non-secure memory at address <code>0x0</code> and thus the UEFI image
- should be pre-loaded into non-secure RAM at address
- <code>0xA0000000</code>.</p></li>
-</ul>
-
-<h2>Use on ARMv8 RTSM and FVP models</h2>
-
-<p>Add the '-a' option to the model start script and point to the required
-bootstrap:</p>
-
-<pre><code>&lt; ... model start script as described in top-level readme file ... &gt;
- -a &lt;path/to/bootstrap-binary-file&gt;
-</code></pre>
-
-<p>NOTE: The Foundation model bootstrap should not be used with these models.</p>
-
-<h2>Use on ARMv8 Foundation model</h2>
-
-<p>The Foundation model takes an option for an ELF file to be loaded as well as an
-option to load a binary data blob into RAM. This can be used to run UEFI in the
-following manner:</p>
-
-<pre><code>&lt;PATH_TO_INSTALLED_FOUNDATION_MODEL&gt;/Foundation_v8 --cores=2 --visualization
- --image=uefi-bootstrap-el3-foundation.axf --nsdata=RTSM_VE_FOUNDATIONV8_EFI.fd@0xA0000000
-</code></pre>
-
-<p>NOTE: The RTSM version of the bootstraps and UEFI image will not work as
- expected on the Foundation model. Foundation model specific versions
- should be used.</p>
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.txt b/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.txt
deleted file mode 100644
index 24a1bbee3d..0000000000
--- a/ArmPlatformPkg/ArmVExpressPkg/Scripts/uefi-aarch64-bootstrap/readme.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-AArch64 UEFI bootstraps
-=======================
-
-Copyright (c) 2011-2013 ARM Limited. All rights reserved.
-See the `LICENSE.TXT` file for more information.
-
-Contents:
-
-* Introduction
-* Build
-* Use on ARMv8 RTSM and FVP models
-* Use on ARMv8 Foundation model
-
-
-Introduction
-------------
-
-A bootstrap can be used to change the model state, like the Exception
-Level (EL), before executing the UEFI binary.
-
-For the ARMv8 RTSM and FVP models this can be used to show/test the UEFI binary
-starting at different exception levels. The ARMv8 models start at EL3 by
-default.
-
-In the case of the Foundation model a bootstrap is required to jump to the
-UEFI binary as loaded in RAM. This is required as the Foundation model cannot
-load and execute UEFI binaries directly. The Foundation model can only load and
-execute ELF binaries.
-
-
-Build
------
-
-Build the bootstraps using a AArch64 GCC cross-compiler. By default the
-`Makefile` is configured to assume a GCC bare-metal toolchain:
-
- PATH=$PATH:<path/to/baremetal-tools/bin/> make clean
- PATH=$PATH:<path/to/baremetal-tools/bin/> make
-
-To build the bootstraps with a Linux GCC toolchain use the following
-commands:
-
- PATH=$PATH:<path/to/aarch64-linux-gnu-tools/bin/> make clean
- PATH=$PATH:<path/to/aarch64-linux-gnu-tools/bin/> CROSS_COMPILE=<gcc-prefix> make
-
-The `gcc-prefix` depends on the specific toolchain distribution used. It can be
-"aarch64-linux-gnu-" for example.
-
-This will result in four `axf` files:
-
-* uefi-bootstrap-el3 : The bootstrap jumps to the UEFI code in FLASH without
- changing anything.
-
-* uefi-bootstrap-el2 : Setup EL3 and switch the model to EL2 before jumping to the
- UEFI code in FLASH.
-
-* uefi-bootstrap-el1 : Setup EL3 and prepare to run at non-secure EL1. Switch to
- non-secure EL1 and run the UEFI code in FLASH.
-
-* uefi-bootstrap-el3-foundation : The bootstrap jumps to the UEFI code in RAM
- without changing anything. Only to be used with the
- Foundation model. The Foundation model does not have
- non-secure memory at address `0x0` and thus the UEFI image
- should be pre-loaded into non-secure RAM at address
- `0xA0000000`.
-
-
-Use on ARMv8 RTSM and FVP models
---------------------------------
-
-Add the '-a' option to the model start script and point to the required
-bootstrap:
-
- < ... model start script as described in top-level readme file ... >
- -a <path/to/bootstrap-binary-file>
-
-NOTE: The Foundation model bootstrap should not be used with these models.
-
-
-Use on ARMv8 Foundation model
------------------------------
-
-The Foundation model takes an option for an ELF file to be loaded as well as an
-option to load a binary data blob into RAM. This can be used to run UEFI in the
-following manner:
-
- <PATH_TO_INSTALLED_FOUNDATION_MODEL>/Foundation_v8 --cores=2 --visualization
- --image=uefi-bootstrap-el3-foundation.axf --nsdata=RTSM_VE_FOUNDATIONV8_EFI.fd@0xA0000000
-
-NOTE: The RTSM version of the bootstraps and UEFI image will not work as
- expected on the Foundation model. Foundation model specific versions
- should be used.
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
deleted file mode 100644
index 3ee866c9f2..0000000000
--- a/ArmPlatformPkg/Bds/Bds.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BdsInternal.h"
-
-#include <Library/PcdLib.h>
-#include <Library/PerformanceLib.h>
-
-#include <Protocol/Bds.h>
-
-#include <Guid/EventGroup.h>
-
-#define EFI_SET_TIMER_TO_SECOND 10000000
-
-STATIC
-EFI_STATUS
-GetConsoleDevicePathFromVariable (
- IN CHAR16* ConsoleVarName,
- IN CHAR16* DefaultConsolePaths,
- OUT EFI_DEVICE_PATH** DevicePaths
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathInstances;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathInstance;
- CHAR16* DevicePathStr;
- CHAR16* NextDevicePathStr;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
-
- Status = GetGlobalEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);
- if (EFI_ERROR(Status)) {
- // In case no default console device path has been defined we assume a driver handles the console (eg: SimpleTextInOutSerial)
- if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {
- *DevicePaths = NULL;
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
-
- DevicePathInstances = NULL;
-
- // Extract the Device Path instances from the multi-device path string
- while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != L'\0')) {
- NextDevicePathStr = StrStr (DefaultConsolePaths, L";");
- if (NextDevicePathStr == NULL) {
- DevicePathStr = DefaultConsolePaths;
- DefaultConsolePaths = NULL;
- } else {
- DevicePathStr = (CHAR16*)AllocateCopyPool ((NextDevicePathStr - DefaultConsolePaths + 1) * sizeof(CHAR16), DefaultConsolePaths);
- *(DevicePathStr + (NextDevicePathStr - DefaultConsolePaths)) = L'\0';
- DefaultConsolePaths = NextDevicePathStr;
- if (DefaultConsolePaths[0] == L';') {
- DefaultConsolePaths++;
- }
- }
-
- DevicePathInstance = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (DevicePathStr);
- ASSERT(DevicePathInstance != NULL);
- DevicePathInstances = AppendDevicePathInstance (DevicePathInstances, DevicePathInstance);
-
- if (NextDevicePathStr != NULL) {
- FreePool (DevicePathStr);
- }
- FreePool (DevicePathInstance);
- }
-
- // Set the environment variable with this device path multi-instances
- Size = GetDevicePathSize (DevicePathInstances);
- if (Size > 0) {
- gRT->SetVariable (
- ConsoleVarName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- Size,
- DevicePathInstances
- );
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
- }
-
- if (!EFI_ERROR(Status)) {
- *DevicePaths = DevicePathInstances;
- }
- return Status;
-}
-
-STATIC
-EFI_STATUS
-InitializeConsolePipe (
- IN EFI_DEVICE_PATH *ConsoleDevicePaths,
- IN EFI_GUID *Protocol,
- OUT EFI_HANDLE *Handle,
- OUT VOID* *Interface
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN NoHandles;
- EFI_HANDLE *Buffer;
- EFI_DEVICE_PATH_PROTOCOL* DevicePath;
-
- // Connect all the Device Path Consoles
- while (ConsoleDevicePaths != NULL) {
- DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);
-
- Status = BdsConnectDevicePath (DevicePath, Handle, NULL);
- DEBUG_CODE_BEGIN();
- if (EFI_ERROR(Status)) {
- // We convert back to the text representation of the device Path
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- CHAR16* DevicePathTxt;
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- if (!EFI_ERROR(Status)) {
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE);
-
- DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status));
-
- FreePool (DevicePathTxt);
- }
- }
- DEBUG_CODE_END();
-
- // If the console splitter driver is not supported by the platform then use the first Device Path
- // instance for the console interface.
- if (!EFI_ERROR(Status) && (*Interface == NULL)) {
- Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
- }
- }
-
- // No Device Path has been defined for this console interface. We take the first protocol implementation
- if (*Interface == NULL) {
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
- if (EFI_ERROR (Status)) {
- BdsConnectAllDrivers();
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
- }
-
- if (!EFI_ERROR(Status)) {
- *Handle = Buffer[0];
- Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
- ASSERT_EFI_ERROR(Status);
- FreePool (Buffer);
- }
- } else {
- Status = EFI_SUCCESS;
- }
-
- return Status;
-}
-
-EFI_STATUS
-InitializeConsole (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH* ConOutDevicePaths;
- EFI_DEVICE_PATH* ConInDevicePaths;
- EFI_DEVICE_PATH* ConErrDevicePaths;
-
- // By getting the Console Device Paths from the environment variables before initializing the console pipe, we
- // create the 3 environment variables (ConIn, ConOut, ConErr) that allows to initialize all the console interface
- // of newly installed console drivers
- Status = GetConsoleDevicePathFromVariable (L"ConOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConOutDevicePaths);
- ASSERT_EFI_ERROR (Status);
- Status = GetConsoleDevicePathFromVariable (L"ConIn", (CHAR16*)PcdGetPtr(PcdDefaultConInPaths), &ConInDevicePaths);
- ASSERT_EFI_ERROR (Status);
- Status = GetConsoleDevicePathFromVariable (L"ErrOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConErrDevicePaths);
- ASSERT_EFI_ERROR (Status);
-
- // Initialize the Consoles
- Status = InitializeConsolePipe (ConOutDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **)&gST->ConOut);
- ASSERT_EFI_ERROR (Status);
- Status = InitializeConsolePipe (ConInDevicePaths, &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **)&gST->ConIn);
- ASSERT_EFI_ERROR (Status);
- Status = InitializeConsolePipe (ConErrDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **)&gST->StdErr);
- if (EFI_ERROR(Status)) {
- // In case of error, we reuse the console output for the error output
- gST->StandardErrorHandle = gST->ConsoleOutHandle;
- gST->StdErr = gST->ConOut;
- }
-
- // Free Memory allocated for reading the UEFI Variables
- if (ConOutDevicePaths) {
- FreePool (ConOutDevicePaths);
- }
- if (ConInDevicePaths) {
- FreePool (ConInDevicePaths);
- }
- if (ConErrDevicePaths) {
- FreePool (ConErrDevicePaths);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DefineDefaultBootEntries (
- VOID
- )
-{
- BDS_LOAD_OPTION* BdsLoadOption;
- UINTN Size;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
- EFI_DEVICE_PATH* BootDevicePath;
- UINTN CmdLineSize;
- UINTN CmdLineAsciiSize;
- CHAR16* DefaultBootArgument;
- CHAR8* AsciiDefaultBootArgument;
-
- //
- // If Boot Order does not exist then create a default entry
- //
- Size = 0;
- Status = gRT->GetVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &Size, NULL);
- if (Status == EFI_NOT_FOUND) {
- if ((PcdGetPtr(PcdDefaultBootDevicePath) == NULL) || (StrLen ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath)) == 0)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- if (EFI_ERROR(Status)) {
- // You must provide an implementation of DevicePathFromTextProtocol in your firmware (eg: DevicePathDxe)
- DEBUG((EFI_D_ERROR,"Error: Bds requires DevicePathFromTextProtocol\n"));
- return Status;
- }
- BootDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath));
-
- DEBUG_CODE_BEGIN();
- // We convert back to the text representation of the device Path to see if the initial text is correct
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- CHAR16* DevicePathTxt;
-
- Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- ASSERT_EFI_ERROR(Status);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (BootDevicePath, TRUE, TRUE);
-
- if (StrCmp ((CHAR16*)PcdGetPtr (PcdDefaultBootDevicePath), DevicePathTxt) != 0) {
- DEBUG ((EFI_D_ERROR, "Device Path given: '%s' Device Path expected: '%s'\n",
- (CHAR16*)PcdGetPtr (PcdDefaultBootDevicePath), DevicePathTxt));
- ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
- }
-
- FreePool (DevicePathTxt);
- DEBUG_CODE_END();
-
- // Create the entry is the Default values are correct
- if (BootDevicePath != NULL) {
- // We do not support NULL pointer
- ASSERT (PcdGetPtr (PcdDefaultBootArgument) != NULL);
-
- //
- // Logic to handle ASCII or Unicode default parameters
- //
- if (*(CHAR8*)PcdGetPtr (PcdDefaultBootArgument) == '\0') {
- CmdLineSize = 0;
- CmdLineAsciiSize = 0;
- DefaultBootArgument = NULL;
- AsciiDefaultBootArgument = NULL;
- } else if (IsUnicodeString ((CHAR16*)PcdGetPtr (PcdDefaultBootArgument))) {
- // The command line is a Unicode string
- DefaultBootArgument = (CHAR16*)PcdGetPtr (PcdDefaultBootArgument);
- CmdLineSize = StrSize (DefaultBootArgument);
-
- // Initialize ASCII variables
- CmdLineAsciiSize = CmdLineSize / 2;
- AsciiDefaultBootArgument = AllocatePool (CmdLineAsciiSize);
- if (AsciiDefaultBootArgument == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- UnicodeStrToAsciiStr ((CHAR16*)PcdGetPtr (PcdDefaultBootArgument), AsciiDefaultBootArgument);
- } else {
- // The command line is a ASCII string
- AsciiDefaultBootArgument = (CHAR8*)PcdGetPtr (PcdDefaultBootArgument);
- CmdLineAsciiSize = AsciiStrSize (AsciiDefaultBootArgument);
-
- // Initialize ASCII variables
- CmdLineSize = CmdLineAsciiSize * 2;
- DefaultBootArgument = AllocatePool (CmdLineSize);
- if (DefaultBootArgument == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- AsciiStrToUnicodeStr (AsciiDefaultBootArgument, DefaultBootArgument);
- }
-
- BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
- (CHAR16*)PcdGetPtr (PcdDefaultBootDescription),
- BootDevicePath,
- (UINT8 *)DefaultBootArgument, // OptionalData
- CmdLineSize, // OptionalDataSize
- &BdsLoadOption
- );
- FreePool (BdsLoadOption);
-
- if (DefaultBootArgument == (CHAR16*)PcdGetPtr (PcdDefaultBootArgument)) {
- FreePool (AsciiDefaultBootArgument);
- } else if (DefaultBootArgument != NULL) {
- FreePool (DefaultBootArgument);
- }
- } else {
- Status = EFI_UNSUPPORTED;
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-StartDefaultBootOnTimeout (
- VOID
- )
-{
- UINTN Size;
- UINT16 Timeout;
- UINT16 *TimeoutPtr;
- EFI_EVENT WaitList[2];
- UINTN WaitIndex;
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- UINTN Index;
- CHAR16 BootVariableName[9];
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
-
- Size = sizeof(UINT16);
- Timeout = (UINT16)PcdGet16 (PcdPlatformBootTimeOut);
- Status = GetGlobalEnvironmentVariable (L"Timeout", &Timeout, &Size, (VOID**)&TimeoutPtr);
- if (!EFI_ERROR (Status)) {
- Timeout = *TimeoutPtr;
- FreePool (TimeoutPtr);
- }
-
- if (Timeout != 0xFFFF) {
- if (Timeout > 0) {
- // Create the waiting events (keystroke and 1sec timer)
- gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &WaitList[0]);
- gBS->SetTimer (WaitList[0], TimerPeriodic, EFI_SET_TIMER_TO_SECOND);
- WaitList[1] = gST->ConIn->WaitForKey;
-
- // Start the timer
- WaitIndex = 0;
- Print(L"The default boot selection will start in ");
- while ((Timeout > 0) && (WaitIndex == 0)) {
- Print(L"%3d seconds",Timeout);
- gBS->WaitForEvent (2, WaitList, &WaitIndex);
- if (WaitIndex == 0) {
- Print(L"\b\b\b\b\b\b\b\b\b\b\b");
- Timeout--;
- }
- }
- // Discard key in the buffer
- do {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- } while(!EFI_ERROR(Status));
- gBS->CloseEvent (WaitList[0]);
- Print(L"\n\r");
- }
-
- // In case of Timeout we start the default boot selection
- if (Timeout == 0) {
- // Get the Boot Option Order from the environment variable (a default value should have been created)
- GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
-
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BootOrder[Index]);
- Status = BdsStartBootOption (BootVariableName);
- if(!EFI_ERROR(Status)){
- // Boot option returned successfully, hence don't need to start next boot option
- break;
- }
- // In case of success, we should not return from this call.
- }
- FreePool (BootOrder);
- }
- }
- return EFI_SUCCESS;
-}
-
-/**
- An empty function to pass error checking of CreateEventEx ().
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context,
- which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-EmptyCallbackFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- return;
-}
-
-/**
- This function uses policy data from the platform to determine what operating
- system or system utility should be loaded and invoked. This function call
- also optionally make the use of user input to determine the operating system
- or system utility to be loaded and invoked. When the DXE Core has dispatched
- all the drivers on the dispatch queue, this function is called. This
- function will attempt to connect the boot devices required to load and invoke
- the selected operating system or system utility. During this process,
- additional firmware volumes may be discovered that may contain addition DXE
- drivers that can be dispatched by the DXE Core. If a boot device cannot be
- fully connected, this function calls the DXE Service Dispatch() to allow the
- DXE drivers from any newly discovered firmware volumes to be dispatched.
- Then the boot device connection can be attempted again. If the same boot
- device connection operation fails twice in a row, then that boot device has
- failed, and should be skipped. This function should never return.
-
- @param This The EFI_BDS_ARCH_PROTOCOL instance.
-
- @return None.
-
-**/
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- )
-{
- UINTN Size;
- EFI_STATUS Status;
- UINT16 *BootNext;
- UINTN BootNextSize;
- CHAR16 BootVariableName[9];
- EFI_EVENT EndOfDxeEvent;
-
- //
- // Signal EndOfDxe PI Event
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- EmptyCallbackFunction,
- NULL,
- &gEfiEndOfDxeEventGroupGuid,
- &EndOfDxeEvent
- );
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (EndOfDxeEvent);
- }
-
- PERF_END (NULL, "DXE", NULL, 0);
-
- //
- // Declare the Firmware Vendor
- //
- if (FixedPcdGetPtr(PcdFirmwareVendor) != NULL) {
- Size = 0x100;
- gST->FirmwareVendor = AllocateRuntimePool (Size);
- ASSERT (gST->FirmwareVendor != NULL);
- UnicodeSPrint (gST->FirmwareVendor, Size, L"%a EFI %a %a", PcdGetPtr(PcdFirmwareVendor), __DATE__, __TIME__);
- }
-
- //
- // Fixup Table CRC after we updated Firmware Vendor
- //
- gST->Hdr.CRC32 = 0;
- Status = gBS->CalculateCrc32 ((VOID*)gST, gST->Hdr.HeaderSize, &gST->Hdr.CRC32);
- ASSERT_EFI_ERROR (Status);
-
- // If BootNext environment variable is defined then we just load it !
- BootNextSize = sizeof(UINT16);
- Status = GetGlobalEnvironmentVariable (L"BootNext", NULL, &BootNextSize, (VOID**)&BootNext);
- if (!EFI_ERROR(Status)) {
- ASSERT(BootNextSize == sizeof(UINT16));
-
- // Generate the requested Boot Entry variable name
- UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", *BootNext);
-
- // Set BootCurrent variable
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- BootNextSize, BootNext);
-
- FreePool (BootNext);
-
- // Start the requested Boot Entry
- Status = BdsStartBootOption (BootVariableName);
- if (Status != EFI_NOT_FOUND) {
- // BootNext has not been succeeded launched
- if (EFI_ERROR(Status)) {
- Print(L"Fail to start BootNext.\n");
- }
-
- // Delete the BootNext environment variable
- gRT->SetVariable (L"BootNext", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0, NULL);
- }
-
- // Clear BootCurrent variable
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0, NULL);
- }
-
- // If Boot Order does not exist then create a default entry
- DefineDefaultBootEntries ();
-
- // Now we need to setup the EFI System Table with information about the console devices.
- InitializeConsole ();
-
- //
- // Update the CRC32 in the EFI System Table header
- //
- gST->Hdr.CRC32 = 0;
- Status = gBS->CalculateCrc32 ((VOID*)gST, gST->Hdr.HeaderSize, &gST->Hdr.CRC32);
- ASSERT_EFI_ERROR (Status);
-
- // Timer before initiating the default boot selection
- StartDefaultBootOnTimeout ();
-
- // Start the Boot Menu
- Status = BootMenuMain ();
- ASSERT_EFI_ERROR (Status);
-
-}
-
-EFI_BDS_ARCH_PROTOCOL gBdsProtocol = {
- BdsEntry,
-};
-
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ImageHandle,
- &gEfiBdsArchProtocolGuid, &gBdsProtocol,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
deleted file mode 100644
index 06e8d914fd..0000000000
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ /dev/null
@@ -1,91 +0,0 @@
-#/** @file
-#
-# Component description file for Bds module
-#
-# Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformBds
- FILE_GUID = 5a50aa81-c3ae-4608-a0e3-41a2e69baf94
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = BdsInitialize
-
-[Sources]
- Bds.c
- BdsHelper.c
- BootLinux.c
- BootMenu.c
- BootOption.c
- BootOptionSupport.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[Guids]
- gFdtTableGuid
-
-[LibraryClasses]
- BdsLib
- UefiBootServicesTableLib
- DxeServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- PerformanceLib
- PrintLib
- BaseLib
- FdtLib
- NetLib
-
-[Guids]
- gEfiEndOfDxeEventGroupGuid
- gEfiFileSystemInfoGuid
- gArmGlobalVariableGuid
- gFdtVariableGuid
-
-[Protocols]
- gEfiBdsArchProtocolGuid
- gEfiBlockIoProtocolGuid
- gEfiSimpleTextInProtocolGuid
- gEfiPxeBaseCodeProtocolGuid
- gEfiSimpleNetworkProtocolGuid
- gEfiDevicePathToTextProtocolGuid
- gEfiFirmwareVolumeBlockProtocolGuid
- gEfiFirmwareVolumeBlock2ProtocolGuid
- gEfiDhcp4ServiceBindingProtocolGuid
- gEfiMtftp4ServiceBindingProtocolGuid
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths
-
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
-
-[Depex]
- TRUE
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c
deleted file mode 100644
index 732292cdb9..0000000000
--- a/ArmPlatformPkg/Bds/BdsHelper.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/NetLib.h>
-#include "BdsInternal.h"
-
-EFI_STATUS
-EditHIInputStr (
- IN OUT CHAR16 *CmdLine,
- IN UINTN MaxCmdLine
- )
-{
- UINTN CmdLineIndex;
- UINTN WaitIndex;
- CHAR8 Char;
- EFI_INPUT_KEY Key;
- EFI_STATUS Status;
-
- // The command line must be at least one character long
- ASSERT (MaxCmdLine > 0);
-
- // Ensure the last character of the buffer is the NULL character
- CmdLine[MaxCmdLine - 1] = '\0';
-
- Print (CmdLine);
-
- // To prevent a buffer overflow, we only allow to enter (MaxCmdLine-1) characters
- for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine; ) {
- Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
- ASSERT_EFI_ERROR (Status);
-
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- ASSERT_EFI_ERROR (Status);
-
- // Unicode character is valid when Scancode is NUll
- if (Key.ScanCode == SCAN_NULL) {
- // Scan code is NUll, hence read Unicode character
- Char = (CHAR8)Key.UnicodeChar;
- } else {
- Char = CHAR_NULL;
- }
-
- if ((Char == CHAR_LINEFEED) || (Char == CHAR_CARRIAGE_RETURN) || (Char == 0x7f)) {
- CmdLine[CmdLineIndex] = '\0';
- Print (L"\r\n");
-
- return EFI_SUCCESS;
- } else if ((Key.UnicodeChar == L'\b') || (Key.ScanCode == SCAN_LEFT) || (Key.ScanCode == SCAN_DELETE)){
- if (CmdLineIndex != 0) {
- CmdLineIndex--;
- Print (L"\b \b");
- }
- } else if ((Key.ScanCode == SCAN_ESC) || (Char == 0x1B) || (Char == 0x0)) {
- return EFI_INVALID_PARAMETER;
- } else if (CmdLineIndex < (MaxCmdLine-1)) {
- CmdLine[CmdLineIndex++] = Key.UnicodeChar;
- Print (L"%c", Key.UnicodeChar);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetHIInputStr (
- IN OUT CHAR16 *CmdLine,
- IN UINTN MaxCmdLine
- )
-{
- EFI_STATUS Status;
-
- // For a new input just passed an empty string
- CmdLine[0] = L'\0';
-
- Status = EditHIInputStr (CmdLine, MaxCmdLine);
-
- return Status;
-}
-
-EFI_STATUS
-EditHIInputAscii (
- IN OUT CHAR8 *CmdLine,
- IN UINTN MaxCmdLine
- )
-{
- CHAR16* Str;
- EFI_STATUS Status;
-
- Str = (CHAR16*)AllocatePool (MaxCmdLine * sizeof(CHAR16));
- AsciiStrToUnicodeStr (CmdLine, Str);
-
- Status = EditHIInputStr (Str, MaxCmdLine);
- if (!EFI_ERROR(Status)) {
- UnicodeStrToAsciiStr (Str, CmdLine);
- }
- FreePool (Str);
-
- return Status;
-}
-
-EFI_STATUS
-GetHIInputAscii (
- IN OUT CHAR8 *CmdLine,
- IN UINTN MaxCmdLine
- )
-{
- // For a new input just passed an empty string
- CmdLine[0] = '\0';
-
- return EditHIInputAscii (CmdLine,MaxCmdLine);
-}
-
-EFI_STATUS
-GetHIInputInteger (
- OUT UINTN *Integer
- )
-{
- CHAR16 CmdLine[255];
- EFI_STATUS Status;
-
- CmdLine[0] = '\0';
- Status = EditHIInputStr (CmdLine, 255);
- if (!EFI_ERROR(Status)) {
- *Integer = StrDecimalToUintn (CmdLine);
- }
-
- return Status;
-}
-
-/**
- Get an IPv4 address
-
- The function asks the user for an IPv4 address. If the input
- string defines a valid IPv4 address, the four bytes of the
- corresponding IPv4 address are extracted from the string and returned by
- the function. As long as the user does not define a valid IP
- address, he is asked for one. He can always escape by
- pressing ESC.
-
- @param[out] EFI_IP_ADDRESS OutIpAddr Returned IPv4 address. Valid if
- and only if the returned value
- is equal to EFI_SUCCESS
-
- @retval EFI_SUCCESS Input completed
- @retval EFI_ABORTED Editing aborted by the user
- @retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to
- lack of resource
-**/
-EFI_STATUS
-GetHIInputIP (
- OUT EFI_IP_ADDRESS *OutIpAddr
- )
-{
- EFI_STATUS Status;
- CHAR16 CmdLine[48];
-
- while (TRUE) {
- CmdLine[0] = '\0';
- Status = EditHIInputStr (CmdLine, 48);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- Status = NetLibStrToIp4 (CmdLine, &OutIpAddr->v4);
- if (Status == EFI_INVALID_PARAMETER) {
- Print (L"Invalid address\n");
- } else {
- return Status;
- }
- }
-}
-
-/**
- Edit an IPv4 address
-
- The function displays as a string following the "%d.%d.%d.%d" format the
- IPv4 address that is passed in and asks the user to modify it. If the
- resulting string defines a valid IPv4 address, the four bytes of the
- corresponding IPv4 address are extracted from the string and returned by
- the function. As long as the user does not define a valid IP
- address, he is asked for one. He can always escape by
- pressing ESC.
-
- @param[in ] EFI_IP_ADDRESS InIpAddr Input IPv4 address
- @param[out] EFI_IP_ADDRESS OutIpAddr Returned IPv4 address. Valid if
- and only if the returned value
- is equal to EFI_SUCCESS
-
- @retval EFI_SUCCESS Update completed
- @retval EFI_ABORTED Editing aborted by the user
- @retval EFI_INVALID_PARAMETER The string returned by the user is
- mal-formated
- @retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to
- lack of resource
-**/
-EFI_STATUS
-EditHIInputIP (
- IN EFI_IP_ADDRESS *InIpAddr,
- OUT EFI_IP_ADDRESS *OutIpAddr
- )
-{
- EFI_STATUS Status;
- CHAR16 CmdLine[48];
-
- while (TRUE) {
- UnicodeSPrint (
- CmdLine, 48, L"%d.%d.%d.%d",
- InIpAddr->v4.Addr[0], InIpAddr->v4.Addr[1],
- InIpAddr->v4.Addr[2], InIpAddr->v4.Addr[3]
- );
-
- Status = EditHIInputStr (CmdLine, 48);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- Status = NetLibStrToIp4 (CmdLine, &OutIpAddr->v4);
- if (Status == EFI_INVALID_PARAMETER) {
- Print (L"Invalid address\n");
- } else {
- return Status;
- }
- }
-}
-
-EFI_STATUS
-GetHIInputBoolean (
- OUT BOOLEAN *Value
- )
-{
- CHAR16 CmdBoolean[2];
- EFI_STATUS Status;
-
- while(1) {
- Print (L"[y/n] ");
- Status = GetHIInputStr (CmdBoolean, 2);
- if (EFI_ERROR(Status)) {
- return Status;
- } else if ((CmdBoolean[0] == L'y') || (CmdBoolean[0] == L'Y')) {
- if (Value) *Value = TRUE;
- return EFI_SUCCESS;
- } else if ((CmdBoolean[0] == L'n') || (CmdBoolean[0] == L'N')) {
- if (Value) *Value = FALSE;
- return EFI_SUCCESS;
- }
- }
-}
-
-// Return the last non end-type Device Path Node from a Device Path
-EFI_DEVICE_PATH*
-GetLastDevicePathNode (
- IN EFI_DEVICE_PATH* DevicePath
- )
-{
- EFI_DEVICE_PATH* PrevDevicePathNode;
-
- PrevDevicePathNode = DevicePath;
- while (!IsDevicePathEndType (DevicePath)) {
- PrevDevicePathNode = DevicePath;
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- return PrevDevicePathNode;
-}
-
-EFI_STATUS
-GenerateDeviceDescriptionName (
- IN EFI_HANDLE Handle,
- IN OUT CHAR16* Description
- )
-{
- EFI_STATUS Status;
- EFI_COMPONENT_NAME_PROTOCOL* ComponentName2Protocol;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
- CHAR16* DriverName;
- CHAR16* DevicePathTxt;
- EFI_DEVICE_PATH* DevicePathNode;
-
- ComponentName2Protocol = NULL;
- Status = gBS->HandleProtocol (Handle, &gEfiComponentName2ProtocolGuid, (VOID **)&ComponentName2Protocol);
- if (!EFI_ERROR(Status)) {
- //TODO: Fixme. we must find the best langague
- Status = ComponentName2Protocol->GetDriverName (ComponentName2Protocol,"en",&DriverName);
- if (!EFI_ERROR(Status)) {
- StrnCpy (Description, DriverName, BOOT_DEVICE_DESCRIPTION_MAX);
- }
- }
-
- if (EFI_ERROR(Status)) {
- // Use the lastest non null entry of the Device path as a description
- Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- // Convert the last non end-type Device Path Node in text for the description
- DevicePathNode = GetLastDevicePathNode (DevicePathProtocol);
- Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- ASSERT_EFI_ERROR(Status);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePathNode, TRUE, TRUE);
- StrnCpy (Description, DevicePathTxt, BOOT_DEVICE_DESCRIPTION_MAX);
- FreePool (DevicePathTxt);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsStartBootOption (
- IN CHAR16* BootOption
- )
-{
- EFI_STATUS Status;
- BDS_LOAD_OPTION *BdsLoadOption;
-
- Status = BootOptionFromLoadOptionVariable (BootOption, &BdsLoadOption);
- if (!EFI_ERROR(Status)) {
- Status = BootOptionStart (BdsLoadOption);
- FreePool (BdsLoadOption);
-
- if (!EFI_ERROR(Status)) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_NOT_STARTED;
- }
- } else {
- Status = EFI_NOT_FOUND;
- }
- return Status;
-}
-
-UINTN
-GetUnalignedDevicePathSize (
- IN EFI_DEVICE_PATH* DevicePath
- )
-{
- UINTN Size;
- EFI_DEVICE_PATH* AlignedDevicePath;
-
- if ((UINTN)DevicePath & 0x1) {
- AlignedDevicePath = DuplicateDevicePath (DevicePath);
- Size = GetDevicePathSize (AlignedDevicePath);
- FreePool (AlignedDevicePath);
- } else {
- Size = GetDevicePathSize (DevicePath);
- }
- return Size;
-}
-
-EFI_DEVICE_PATH*
-GetAlignedDevicePath (
- IN EFI_DEVICE_PATH* DevicePath
- )
-{
- if ((UINTN)DevicePath & 0x1) {
- return DuplicateDevicePath (DevicePath);
- } else {
- return DevicePath;
- }
-}
-
-BOOLEAN
-IsUnicodeString (
- IN VOID* String
- )
-{
- // We do not support NULL pointer
- ASSERT (String != NULL);
-
- if (*(CHAR16*)String < 0x100) {
- //Note: We could get issue if the string is an empty Ascii string...
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-/*
- * Try to detect if the given string is an ASCII or Unicode string
- *
- * There are actually few limitation to this function but it is mainly to give
- * a user friendly output.
- *
- * Some limitations:
- * - it only supports unicode string that use ASCII character (< 0x100)
- * - single character ASCII strings are interpreted as Unicode string
- * - string cannot be longer than BOOT_DEVICE_OPTION_MAX characters and
- * thus (BOOT_DEVICE_OPTION_MAX*2) bytes for an Unicode string and
- * BOOT_DEVICE_OPTION_MAX bytes for an ASCII string.
- *
- * @param String Buffer that might contain a Unicode or Ascii string
- * @param IsUnicode If not NULL this boolean value returns if the string is an
- * ASCII or Unicode string.
- */
-BOOLEAN
-IsPrintableString (
- IN VOID* String,
- OUT BOOLEAN *IsUnicode
- )
-{
- BOOLEAN UnicodeDetected;
- BOOLEAN IsPrintable;
- UINTN Index;
- CHAR16 Character;
-
- // We do not support NULL pointer
- ASSERT (String != NULL);
-
- // Test empty string
- if (*(CHAR16*)String == L'\0') {
- if (IsUnicode) {
- *IsUnicode = TRUE;
- }
- return TRUE;
- } else if (*(CHAR16*)String == '\0') {
- if (IsUnicode) {
- *IsUnicode = FALSE;
- }
- return TRUE;
- }
-
- // Limitation: if the string is an ASCII single character string. This comparison
- // will assume it is a Unicode string.
- if (*(CHAR16*)String < 0x100) {
- UnicodeDetected = TRUE;
- } else {
- UnicodeDetected = FALSE;
- }
-
- IsPrintable = FALSE;
- for (Index = 0; Index < BOOT_DEVICE_OPTION_MAX; Index++) {
- if (UnicodeDetected) {
- Character = ((CHAR16*)String)[Index];
- } else {
- Character = ((CHAR8*)String)[Index];
- }
-
- if (Character == '\0') {
- // End of the string
- IsPrintable = TRUE;
- break;
- } else if ((Character < 0x20) || (Character > 0x7f)) {
- // We only support the range of printable ASCII character
- IsPrintable = FALSE;
- break;
- }
- }
-
- if (IsPrintable && IsUnicode) {
- *IsUnicode = UnicodeDetected;
- }
-
- return IsPrintable;
-}
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
deleted file mode 100644
index ddf5308e8b..0000000000
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef _BDSINTERNAL_H_
-#define _BDSINTERNAL_H_
-
-#include <PiDxe.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/BdsLib.h>
-#include <Library/DebugLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/UefiLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PcdLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-
-#include <Protocol/DevicePathFromText.h>
-#include <Protocol/DevicePathToText.h>
-
-#include <Guid/GlobalVariable.h>
-#include <Guid/Fdt.h>
-
-#define BOOT_DEVICE_DESCRIPTION_MAX 100
-#define BOOT_DEVICE_FILEPATH_MAX 100
-#define BOOT_DEVICE_OPTION_MAX 300
-#define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000"))
-
-#define UPDATE_BOOT_ENTRY L"Update entry: "
-#define DELETE_BOOT_ENTRY L"Delete entry: "
-#define MOVE_BOOT_ENTRY L"Move entry: "
-
-typedef struct {
- LIST_ENTRY Link;
- BDS_LOAD_OPTION* BdsLoadOption;
-} BDS_LOAD_OPTION_ENTRY;
-
-typedef enum {
- BDS_DEVICE_FILESYSTEM = 0,
- BDS_DEVICE_MEMMAP,
- BDS_DEVICE_PXE,
- BDS_DEVICE_TFTP,
- BDS_DEVICE_MAX
-} BDS_SUPPORTED_DEVICE_TYPE;
-
-typedef struct {
- LIST_ENTRY Link;
- CHAR16 Description[BOOT_DEVICE_DESCRIPTION_MAX];
- EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
- struct _BDS_LOAD_OPTION_SUPPORT* Support;
-} BDS_SUPPORTED_DEVICE;
-
-#define SUPPORTED_BOOT_DEVICE_FROM_LINK(a) BASE_CR(a, BDS_SUPPORTED_DEVICE, Link)
-
-typedef struct _BDS_LOAD_OPTION_SUPPORT {
- BDS_SUPPORTED_DEVICE_TYPE Type;
- EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);
- BOOLEAN (*IsSupported)(IN EFI_DEVICE_PATH *DevicePath);
- EFI_STATUS (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes);
- EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath);
-
- /// Define if the boot menu should request if the file is a EFI binary or a Linux kernel
- /// Example: PXE boot always deliver a UEFI application.
- BOOLEAN RequestBootType;
-} BDS_LOAD_OPTION_SUPPORT;
-
-#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)
-#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption
-
-// GUID of the EFI Linux Loader
-extern CONST EFI_GUID mLinuxLoaderAppGuid;
-
-// Device path of the EFI Linux Loader in the Firmware Volume
-extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath;
-
-EFI_STATUS
-BootDeviceListSupportedInit (
- IN OUT LIST_ENTRY *SupportedDeviceList
- );
-
-EFI_STATUS
-BootDeviceListSupportedFree (
- IN LIST_ENTRY *SupportedDeviceList,
- IN BDS_SUPPORTED_DEVICE *Except
- );
-
-EFI_STATUS
-BootDeviceGetDeviceSupport (
- IN EFI_DEVICE_PATH *DevicePath,
- OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport
- );
-
-EFI_STATUS
-GetHIInputStr (
- IN OUT CHAR16 *CmdLine,
- IN UINTN MaxCmdLine
- );
-
-EFI_STATUS
-EditHIInputStr (
- IN OUT CHAR16 *CmdLine,
- IN UINTN MaxCmdLine
- );
-
-EFI_STATUS
-GetHIInputAscii (
- IN OUT CHAR8 *CmdLine,
- IN UINTN MaxCmdLine
- );
-
-EFI_STATUS
-EditHIInputAscii (
- IN OUT CHAR8 *CmdLine,
- IN UINTN MaxCmdLine
- );
-
-EFI_STATUS
-GetHIInputInteger (
- IN OUT UINTN *Integer
- );
-
-EFI_STATUS
-GetHIInputIP (
- OUT EFI_IP_ADDRESS *Ip
- );
-
-EFI_STATUS
-EditHIInputIP (
- IN EFI_IP_ADDRESS *InIpAddr,
- OUT EFI_IP_ADDRESS *OutIpAddr
- );
-
-EFI_STATUS
-GetHIInputBoolean (
- OUT BOOLEAN *Value
- );
-
-EFI_DEVICE_PATH*
-GetLastDevicePathNode (
- IN EFI_DEVICE_PATH* DevicePath
- );
-
-EFI_STATUS
-BdsStartBootOption (
- IN CHAR16* BootOption
- );
-
-UINTN
-GetUnalignedDevicePathSize (
- IN EFI_DEVICE_PATH* DevicePath
- );
-
-EFI_DEVICE_PATH*
-GetAlignedDevicePath (
- IN EFI_DEVICE_PATH* DevicePath
- );
-
-EFI_STATUS
-GenerateDeviceDescriptionName (
- IN EFI_HANDLE Handle,
- IN OUT CHAR16* Description
- );
-
-EFI_STATUS
-BootOptionList (
- IN OUT LIST_ENTRY *BootOptionList
- );
-
-EFI_STATUS
-BootOptionParseLoadOption (
- IN EFI_LOAD_OPTION EfiLoadOption,
- IN UINTN EfiLoadOptionSize,
- OUT BDS_LOAD_OPTION **BdsLoadOption
- );
-
-EFI_STATUS
-BootOptionStart (
- IN BDS_LOAD_OPTION *BootOption
- );
-
-EFI_STATUS
-BootOptionCreate (
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN UINT8* OptionalData,
- IN UINTN OptionalDataSize,
- OUT BDS_LOAD_OPTION** BdsLoadOption
- );
-
-EFI_STATUS
-BootOptionUpdate (
- IN BDS_LOAD_OPTION* BdsLoadOption,
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN UINT8* OptionalData,
- IN UINTN OptionalDataSize
- );
-
-EFI_STATUS
-BootOptionDelete (
- IN BDS_LOAD_OPTION *BootOption
- );
-
-EFI_STATUS
-BootMenuMain (
- VOID
- );
-
-BOOLEAN
-IsUnicodeString (
- IN VOID* String
- );
-
-/*
- * Try to detect if the given string is an ASCII or Unicode string
- *
- * There are actually few limitation to this function but it is mainly to give
- * a user friendly output.
- *
- * Some limitations:
- * - it only supports unicode string that use ASCII character (< 0x100)
- * - single character ASCII strings are interpreted as Unicode string
- * - string cannot be longer than 2 x BOOT_DEVICE_OPTION_MAX (600 bytes)
- *
- * @param String Buffer that might contain a Unicode or Ascii string
- * @param IsUnicode If not NULL this boolean value returns if the string is an
- * ASCII or Unicode string.
- */
-BOOLEAN
-IsPrintableString (
- IN VOID* String,
- OUT BOOLEAN *IsUnicode
- );
-
-/**
- An empty function to pass error checking of CreateEventEx ().
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context,
- which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-EmptyCallbackFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-/**
- * This function check if the DevicePath defines an EFI binary
- *
- * This function is used when the BDS support Linux loader to
- * detect if the binary is an EFI application or potentially a
- * Linux kernel.
- */
-EFI_STATUS
-IsEfiBinary (
- IN EFI_DEVICE_PATH* DevicePath,
- OUT BOOLEAN *EfiBinary
- );
-
-#endif /* _BDSINTERNAL_H_ */
diff --git a/ArmPlatformPkg/Bds/BootLinux.c b/ArmPlatformPkg/Bds/BootLinux.c
deleted file mode 100644
index 0445e894e1..0000000000
--- a/ArmPlatformPkg/Bds/BootLinux.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011 - 2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BdsInternal.h"
-
-// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
-CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
-
-// Device path of the EFI Linux Loader in the Firmware Volume
-EFI_DEVICE_PATH* mLinuxLoaderDevicePath = NULL;
-
-STATIC
-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- )
-{
- return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
- (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
-}
-
-/**
- * This function check if the DevicePath defines an EFI binary
- *
- * This function is used when the BDS support Linux loader to
- * detect if the binary is an EFI application or potentially a
- * Linux kernel.
- */
-EFI_STATUS
-IsEfiBinary (
- IN EFI_DEVICE_PATH* DevicePath,
- OUT BOOLEAN *EfiBinary
- )
-{
- EFI_STATUS Status;
- CHAR16* FileName;
- EFI_DEVICE_PATH* PrevDevicePathNode;
- EFI_DEVICE_PATH* DevicePathNode;
- EFI_PHYSICAL_ADDRESS Image;
- UINTN FileSize;
- EFI_IMAGE_DOS_HEADER* DosHeader;
- UINTN PeCoffHeaderOffset;
- EFI_IMAGE_NT_HEADERS32* NtHeader;
-
- ASSERT (EfiBinary != NULL);
-
- //
- // Check if the last node of the device path is a FilePath node
- //
- PrevDevicePathNode = NULL;
- DevicePathNode = DevicePath;
- while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
- PrevDevicePathNode = DevicePathNode;
- DevicePathNode = NextDevicePathNode (DevicePathNode);
- }
-
- if ((PrevDevicePathNode != NULL) &&
- (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
- (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
- {
- FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
- } else {
- FileName = NULL;
- }
-
- if (FileName == NULL) {
- Print (L"Is an EFI Application? ");
- Status = GetHIInputBoolean (EfiBinary);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- } else if (HasFilePathEfiExtension (FileName)) {
- *EfiBinary = TRUE;
- } else {
- // Check if the file exist
- Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
- if (!EFI_ERROR (Status)) {
-
- DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
- if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present,
- // so read the PE header after the DOS image header.
- //
- PeCoffHeaderOffset = DosHeader->e_lfanew;
- } else {
- PeCoffHeaderOffset = 0;
- }
-
- //
- // Check PE/COFF image.
- //
- NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);
- if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
- *EfiBinary = FALSE;
- } else {
- *EfiBinary = TRUE;
- }
-
- // Free memory
- gBS->FreePages (Image, EFI_SIZE_TO_PAGES (FileSize));
- } else {
- // If we did not manage to open it then ask for the type
- Print (L"Is an EFI Application? ");
- Status = GetHIInputBoolean (EfiBinary);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
deleted file mode 100644
index 8caa3ce5ce..0000000000
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ /dev/null
@@ -1,1103 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011 - 2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BdsInternal.h"
-
-#include <Guid/ArmGlobalVariableHob.h>
-
-#include <libfdt.h>
-
-/**
- Worker function that displays the list of boot options that is passed in.
-
- The function loops over the entries of the list of boot options that is passed
- in. For each entry, the boot option description is displayed on a single line
- along with the position of the option in the list. In debug mode, the UEFI
- device path and the arguments of the boot option are displayed as well in
- subsequent lines.
-
- @param[in] BootOptionsList List of the boot options
-
-**/
-STATIC
-VOID
-DisplayBootOptions (
- IN LIST_ENTRY* BootOptionsList
- )
-{
- EFI_STATUS Status;
- UINTN BootOptionCount;
- LIST_ENTRY *Entry;
- BDS_LOAD_OPTION *BdsLoadOption;
- BOOLEAN IsUnicode;
-
- BootOptionCount = 0 ;
- for (Entry = GetFirstNode (BootOptionsList);
- !IsNull (BootOptionsList, Entry);
- Entry = GetNextNode (BootOptionsList, Entry)
- ) {
-
- BdsLoadOption = LOAD_OPTION_FROM_LINK (Entry);
- Print (L"[%d] %s\n", ++BootOptionCount, BdsLoadOption->Description);
-
- DEBUG_CODE_BEGIN ();
- CHAR16* DevicePathTxt;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
-
- Status = gBS->LocateProtocol (
- &gEfiDevicePathToTextProtocolGuid,
- NULL,
- (VOID **)&DevicePathToTextProtocol
- );
- ASSERT_EFI_ERROR (Status);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
- BdsLoadOption->FilePathList,
- TRUE,
- TRUE
- );
- Print (L"\t- %s\n", DevicePathTxt);
-
- if (IsPrintableString (BdsLoadOption->OptionalData, &IsUnicode)) {
- if (IsUnicode) {
- Print (L"\t- Arguments: %s\n", BdsLoadOption->OptionalData);
- } else {
- AsciiPrint ("\t- Arguments: %a\n", BdsLoadOption->OptionalData);
- }
- }
-
- FreePool (DevicePathTxt);
- DEBUG_CODE_END ();
- }
-}
-
-/**
- Worker function that asks for a boot option to be selected and returns a
- pointer to the structure describing the selected boot option.
-
- @param[in] BootOptionsList List of the boot options
-
- @retval EFI_SUCCESS Selection succeeded
- @retval !EFI_SUCCESS Input error or input cancelled
-
-**/
-STATIC
-EFI_STATUS
-SelectBootOption (
- IN LIST_ENTRY* BootOptionsList,
- IN CONST CHAR16* InputStatement,
- OUT BDS_LOAD_OPTION_ENTRY** BdsLoadOptionEntry
- )
-{
- EFI_STATUS Status;
- UINTN BootOptionCount;
- UINT16 *BootOrder;
- LIST_ENTRY* Entry;
- UINTN BootOptionSelected;
- UINTN Index;
-
- // Get the number of boot options
- Status = GetGlobalEnvironmentVariable (
- L"BootOrder", NULL, &BootOptionCount, (VOID**)&BootOrder
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
- FreePool (BootOrder);
- BootOptionCount /= sizeof (UINT16);
-
- // Check if a valid boot option(s) is found
- if (BootOptionCount == 0) {
- if (StrCmp (InputStatement, DELETE_BOOT_ENTRY) == 0) {
- Print (L"Nothing to remove!\n");
- } else if (StrCmp (InputStatement, UPDATE_BOOT_ENTRY) == 0) {
- Print (L"Nothing to update!\n");
- } else if (StrCmp (InputStatement, MOVE_BOOT_ENTRY) == 0) {
- Print (L"Nothing to move!\n");
- } else {
- Print (L"No supported Boot Entry.\n");
- }
- return EFI_NOT_FOUND;
- }
-
- // Get the index of the boot device to delete
- BootOptionSelected = 0;
- while (BootOptionSelected == 0) {
- Print (InputStatement);
- Status = GetHIInputInteger (&BootOptionSelected);
- if (EFI_ERROR (Status)) {
- Print (L"\n");
- goto ErrorExit;
- } else if ((BootOptionSelected == 0) || (BootOptionSelected > BootOptionCount)) {
- Print (L"Invalid input (max %d)\n", BootOptionCount);
- BootOptionSelected = 0;
- }
- }
-
- // Get the structure of the Boot device to delete
- Index = 1;
- for (Entry = GetFirstNode (BootOptionsList);
- !IsNull (BootOptionsList, Entry);
- Entry = GetNextNode (BootOptionsList,Entry)
- )
- {
- if (Index == BootOptionSelected) {
- *BdsLoadOptionEntry = LOAD_OPTION_ENTRY_FROM_LINK (Entry);
- break;
- }
- Index++;
- }
-
-ErrorExit:
- return Status;
-}
-
-STATIC
-EFI_STATUS
-SelectBootDevice (
- OUT BDS_SUPPORTED_DEVICE** SupportedBootDevice
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY SupportedDeviceList;
- UINTN SupportedDeviceCount;
- LIST_ENTRY* Entry;
- UINTN SupportedDeviceSelected;
- UINTN Index;
-
- //
- // List the Boot Devices supported
- //
-
- // Start all the drivers first
- BdsConnectAllDrivers ();
-
- // List the supported devices
- Status = BootDeviceListSupportedInit (&SupportedDeviceList);
- ASSERT_EFI_ERROR(Status);
-
- SupportedDeviceCount = 0;
- for (Entry = GetFirstNode (&SupportedDeviceList);
- !IsNull (&SupportedDeviceList,Entry);
- Entry = GetNextNode (&SupportedDeviceList,Entry)
- )
- {
- *SupportedBootDevice = SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry);
- Print(L"[%d] %s\n",SupportedDeviceCount+1,(*SupportedBootDevice)->Description);
-
- DEBUG_CODE_BEGIN();
- CHAR16* DevicePathTxt;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
-
- Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- ASSERT_EFI_ERROR(Status);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ((*SupportedBootDevice)->DevicePathProtocol,TRUE,TRUE);
-
- Print(L"\t- %s\n",DevicePathTxt);
-
- FreePool(DevicePathTxt);
- DEBUG_CODE_END();
-
- SupportedDeviceCount++;
- }
-
- if (SupportedDeviceCount == 0) {
- Print(L"There is no supported device.\n");
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- //
- // Select the Boot Device
- //
- SupportedDeviceSelected = 0;
- while (SupportedDeviceSelected == 0) {
- Print(L"Select the Boot Device: ");
- Status = GetHIInputInteger (&SupportedDeviceSelected);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- } else if ((SupportedDeviceSelected == 0) || (SupportedDeviceSelected > SupportedDeviceCount)) {
- Print(L"Invalid input (max %d)\n",SupportedDeviceCount);
- SupportedDeviceSelected = 0;
- }
- }
-
- //
- // Get the Device Path for the selected boot device
- //
- Index = 1;
- for (Entry = GetFirstNode (&SupportedDeviceList);
- !IsNull (&SupportedDeviceList,Entry);
- Entry = GetNextNode (&SupportedDeviceList,Entry)
- )
- {
- if (Index == SupportedDeviceSelected) {
- *SupportedBootDevice = SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry);
- break;
- }
- Index++;
- }
-
-EXIT:
- BootDeviceListSupportedFree (&SupportedDeviceList, *SupportedBootDevice);
- return Status;
-}
-
-EFI_STATUS
-BootMenuAddBootOption (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- BDS_SUPPORTED_DEVICE* SupportedBootDevice;
- CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- CHAR16 CmdLine[BOOT_DEVICE_OPTION_MAX];
- UINT32 Attributes;
- BDS_LOAD_OPTION_ENTRY *BdsLoadOptionEntry;
- EFI_DEVICE_PATH *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
- UINT8* OptionalData;
- UINTN OptionalDataSize;
- BOOLEAN EfiBinary;
- CHAR16 *LinuxDevicePath;
-
- Attributes = 0;
- SupportedBootDevice = NULL;
-
- // List the Boot Devices supported
- Status = SelectBootDevice (&SupportedBootDevice);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- // Create the specific device path node
- if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
- } else {
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application", &DevicePathNodes);
- }
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- // Append the Device Path to the selected device path
- DevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNodes);
- if (DevicePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
-
- // Is it an EFI application?
- if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
- Status = IsEfiBinary (DevicePath, &EfiBinary);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (EfiBinary == FALSE) {
- Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
- Print (L"Supported command line formats by the embedded Linux Loader:\n");
- Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
- Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
- Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
-
- // Copy the Linux path into the command line
- LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
- CopyMem (CmdLine, LinuxDevicePath, MAX (sizeof (CmdLine), StrSize (LinuxDevicePath)));
- FreePool (LinuxDevicePath);
-
- // Free the generated Device Path
- FreePool (DevicePath);
- // and use the embedded Linux Loader as the EFI application
- DevicePath = mLinuxLoaderDevicePath;
- } else {
- CmdLine[0] = L'\0';
- }
- } else {
- CmdLine[0] = L'\0';
- }
-
- Print (L"Arguments to pass to the EFI Application: ");
- Status = EditHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- OptionalData = (UINT8*)CmdLine;
- OptionalDataSize = StrSize (CmdLine);
-
- Print(L"Description for this new Entry: ");
- Status = GetHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- // Create new entry
- BdsLoadOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool (sizeof(BDS_LOAD_OPTION_ENTRY));
- Status = BootOptionCreate (Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);
- if (!EFI_ERROR(Status)) {
- InsertTailList (BootOptionsList, &BdsLoadOptionEntry->Link);
- }
-
-FREE_DEVICE_PATH:
- FreePool (DevicePath);
-
-EXIT:
- if (Status == EFI_ABORTED) {
- Print(L"\n");
- }
- FreePool(SupportedBootDevice);
- return Status;
-}
-
-EFI_STATUS
-BootMenuRemoveBootOption (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- BDS_LOAD_OPTION_ENTRY* BootOptionEntry;
-
- DisplayBootOptions (BootOptionsList);
- Status = SelectBootOption (BootOptionsList, DELETE_BOOT_ENTRY, &BootOptionEntry);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // If the Boot Option was attached to a list remove it
- if (!IsListEmpty (&BootOptionEntry->Link)) {
- // Remove the entry from the list
- RemoveEntryList (&BootOptionEntry->Link);
- }
-
- // Delete the BDS Load option structures
- BootOptionDelete (BootOptionEntry->BdsLoadOption);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BootMenuUpdateBootOption (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- BDS_LOAD_OPTION_ENTRY *BootOptionEntry;
- BDS_LOAD_OPTION *BootOption;
- BDS_LOAD_OPTION_SUPPORT* DeviceSupport;
- CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
- CHAR16 UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];
- CHAR16 *LinuxDevicePath;
- EFI_DEVICE_PATH *DevicePath;
- UINT8* OptionalData;
- UINTN OptionalDataSize;
- BOOLEAN IsPrintable;
- BOOLEAN IsUnicode;
- BOOLEAN EfiBinary;
-
- DisplayBootOptions (BootOptionsList);
- Status = SelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, &BootOptionEntry);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- BootOption = BootOptionEntry->BdsLoadOption;
-
- // Get the device support for this Boot Option
- Status = BootDeviceGetDeviceSupport (BootOption->FilePathList, &DeviceSupport);
- if (EFI_ERROR(Status)) {
- Print(L"Not possible to retrieve the supported device for the update\n");
- return EFI_UNSUPPORTED;
- }
-
- EfiBinary = TRUE;
- if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- // Is it an EFI application?
- Status = IsEfiBinary (DevicePath, &EfiBinary);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (EfiBinary == FALSE) {
- Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
- Print (L"Supported command line formats by the embedded Linux Loader:\n");
- Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
- Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
- Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
-
- // Copy the Linux path into the command line
- LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
- CopyMem (UnicodeCmdLine, LinuxDevicePath, MAX (sizeof (UnicodeCmdLine), StrSize (LinuxDevicePath)));
- FreePool (LinuxDevicePath);
-
- // Free the generated Device Path
- FreePool (DevicePath);
- // and use the embedded Linux Loader as the EFI application
- DevicePath = mLinuxLoaderDevicePath;
-
- // The command line is a unicode printable string
- IsPrintable = TRUE;
- IsUnicode = TRUE;
- }
- } else {
- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application", &DevicePath);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- }
-
- Print (L"Arguments to pass to the EFI Application: ");
-
- // When the command line has not been initialized by the embedded Linux loader earlier
- if (EfiBinary) {
- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than "BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by "BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
- }
- }
- } else {
- UnicodeCmdLine[0] = L'\0';
- IsPrintable = TRUE;
- IsUnicode = TRUE;
- }
- }
-
- // We do not request arguments for OptionalData that cannot be printed
- if (IsPrintable) {
- if (IsUnicode) {
- Status = EditHIInputStr (UnicodeCmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- OptionalData = (UINT8*)UnicodeCmdLine;
- OptionalDataSize = StrSize (UnicodeCmdLine);
- } else {
- Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- OptionalData = (UINT8*)CmdLine;
- OptionalDataSize = AsciiStrSize (CmdLine);
- }
- } else {
- // We keep the former OptionalData
- OptionalData = BootOption->OptionalData;
- OptionalDataSize = BootOption->OptionalDataSize;
- }
-
- Print(L"Description for this new Entry: ");
- StrnCpy (BootDescription, BootOption->Description, BOOT_DEVICE_DESCRIPTION_MAX);
- Status = EditHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- // Update the entry
- Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);
-
-FREE_DEVICE_PATH:
- FreePool (DevicePath);
-
-EXIT:
- if (Status == EFI_ABORTED) {
- Print(L"\n");
- }
- return Status;
-}
-
-/**
- Reorder boot options
-
- Ask for the boot option to move and then move it when up or down arrows
- are pressed. This function is called when the user selects the "Reorder Boot
- Device Entries" entry in the boot manager menu.
- The order of the boot options in BootOptionList and in the UEFI BootOrder
- global variable are kept coherent until the user confirm his reordering (ie:
- he does not exit by pressing escape).
-
- @param[in] BootOptionsList List of the boot devices constructed in
- BootMenuMain()
-
- @retval EFI_SUCCESS No error encountered.
- @retval !EFI_SUCCESS An error has occured either in the selection of the
- boot option to move or while interacting with the user.
-
-**/
-STATIC
-EFI_STATUS
-BootMenuReorderBootOptions (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- BDS_LOAD_OPTION_ENTRY *BootOptionEntry;
- LIST_ENTRY *SelectedEntry;
- LIST_ENTRY *PrevEntry;
- BOOLEAN Move;
- BOOLEAN Save;
- BOOLEAN Cancel;
- UINTN WaitIndex;
- EFI_INPUT_KEY Key;
- LIST_ENTRY *SecondEntry;
- UINTN BootOrderSize;
- UINT16 *BootOrder;
- LIST_ENTRY *Entry;
- UINTN Index;
-
- DisplayBootOptions (BootOptionsList);
-
- // Ask to select the boot option to move
- while (TRUE) {
- Status = SelectBootOption (BootOptionsList, MOVE_BOOT_ENTRY, &BootOptionEntry);
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- SelectedEntry = &BootOptionEntry->Link;
- SecondEntry = NULL;
- // Note down the previous entry in the list to be able to cancel changes
- PrevEntry = GetPreviousNode (BootOptionsList, SelectedEntry);
-
- // Start of interaction
- while (TRUE) {
- Print (
- L"* Use up/down arrows to move the entry '%s'",
- BootOptionEntry->BdsLoadOption->Description
- );
-
- // Wait for a move, save or cancel request
- Move = FALSE;
- Save = FALSE;
- Cancel = FALSE;
- do {
- Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
- if (!EFI_ERROR (Status)) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- }
- if (EFI_ERROR (Status)) {
- Print (L"\n");
- goto ErrorExit;
- }
-
- switch (Key.ScanCode) {
- case SCAN_NULL:
- Save = (Key.UnicodeChar == CHAR_LINEFEED) ||
- (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) ||
- (Key.UnicodeChar == 0x7f);
- break;
-
- case SCAN_UP:
- SecondEntry = GetPreviousNode (BootOptionsList, SelectedEntry);
- Move = SecondEntry != BootOptionsList;
- break;
-
- case SCAN_DOWN:
- SecondEntry = GetNextNode (BootOptionsList, SelectedEntry);
- Move = SecondEntry != BootOptionsList;
- break;
-
- case SCAN_ESC:
- Cancel = TRUE;
- break;
- }
- } while ((!Move) && (!Save) && (!Cancel));
-
- if (Move) {
- if ((SelectedEntry != NULL) && (SecondEntry != NULL)) {
- SwapListEntries (SelectedEntry, SecondEntry);
- }
- } else {
- if (Save) {
- Status = GetGlobalEnvironmentVariable (
- L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder
- );
- BootOrderSize /= sizeof (UINT16);
-
- if (!EFI_ERROR (Status)) {
- // The order of the boot options in the 'BootOptionsList' is the
- // new order that has been just defined by the user. Save this new
- // order in "BootOrder" UEFI global variable.
- Entry = GetFirstNode (BootOptionsList);
- for (Index = 0; Index < BootOrderSize; Index++) {
- BootOrder[Index] = (LOAD_OPTION_FROM_LINK (Entry))->LoadOptionIndex;
- Entry = GetNextNode (BootOptionsList, Entry);
- }
- Status = gRT->SetVariable (
- (CHAR16*)L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- BootOrderSize * sizeof (UINT16),
- BootOrder
- );
- FreePool (BootOrder);
- }
-
- if (EFI_ERROR (Status)) {
- Print (L"\nAn error occurred, move not completed!\n");
- Cancel = TRUE;
- }
- }
-
- if (Cancel) {
- //
- // Restore initial position of the selected boot option
- //
- RemoveEntryList (SelectedEntry);
- InsertHeadList (PrevEntry, SelectedEntry);
- }
- }
-
- Print (L"\n");
- DisplayBootOptions (BootOptionsList);
- // Saved or cancelled, back to the choice of boot option to move
- if (!Move) {
- break;
- }
- }
- }
-
-ErrorExit:
- return Status ;
-}
-
-EFI_STATUS
-UpdateFdtPath (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- BDS_SUPPORTED_DEVICE *SupportedBootDevice;
- EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNodes;
- EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath;
- CHAR16 *FdtTextDevicePath;
- EFI_PHYSICAL_ADDRESS FdtBlobBase;
- UINTN FdtBlobSize;
- UINTN NumPages;
- EFI_PHYSICAL_ADDRESS FdtConfigurationTableBase;
-
- SupportedBootDevice = NULL;
-
- Status = SelectBootDevice (&SupportedBootDevice);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- // Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNodes);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (FdtDevicePathNodes != NULL) {
- Status = EFI_OUT_OF_RESOURCES;
-
- FdtDevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNodes);
- FreePool (FdtDevicePathNodes);
- if (FdtDevicePath == NULL) {
- goto EXIT;
- }
-
- FdtTextDevicePath = ConvertDevicePathToText (FdtDevicePath, TRUE, TRUE);
- if (FdtTextDevicePath == NULL) {
- goto EXIT;
- }
-
- Status = gRT->SetVariable (
- (CHAR16*)L"Fdt",
- &gFdtVariableGuid,
- EFI_VARIABLE_RUNTIME_ACCESS |
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- StrSize (FdtTextDevicePath),
- FdtTextDevicePath
- );
- ASSERT_EFI_ERROR (Status);
- FreePool (FdtTextDevicePath);
- } else {
- Status = gRT->SetVariable (
- (CHAR16*)L"Fdt",
- &gFdtVariableGuid,
- EFI_VARIABLE_RUNTIME_ACCESS |
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- 0,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- //
- // Try to load FDT from the new EFI Device Path
- //
-
- //
- // Load the FDT given its device path.
- // This operation may fail if the device path is not supported.
- //
- FdtBlobBase = 0;
- NumPages = 0;
- Status = BdsLoadImage (FdtDevicePath, AllocateAnyPages, &FdtBlobBase, &FdtBlobSize);
- FreePool (FdtDevicePath);
-
- if (EFI_ERROR (Status)) {
- goto EXIT_LOAD_FDT;
- }
-
- // Check the FDT header is valid. We only make this check in DEBUG mode in
- // case the FDT header change on production device and this ASSERT() becomes
- // not valid.
- ASSERT (fdt_check_header ((VOID*)(UINTN)FdtBlobBase) == 0);
-
- //
- // Ensure the Size of the Device Tree is smaller than the size of the read file
- //
- ASSERT ((UINTN)fdt_totalsize ((VOID*)(UINTN)FdtBlobBase) <= FdtBlobSize);
-
- //
- // Store the FDT as Runtime Service Data to prevent the Kernel from
- // overwritting its data.
- //
- NumPages = EFI_SIZE_TO_PAGES (FdtBlobSize);
- Status = gBS->AllocatePages (
- AllocateAnyPages, EfiRuntimeServicesData,
- NumPages, &FdtConfigurationTableBase
- );
- if (EFI_ERROR (Status)) {
- goto EXIT_LOAD_FDT;
- }
- gBS->CopyMem (
- (VOID*)(UINTN)FdtConfigurationTableBase,
- (VOID*)(UINTN)FdtBlobBase,
- FdtBlobSize
- );
-
- //
- // Install the FDT into the Configuration Table
- //
- Status = gBS->InstallConfigurationTable (
- &gFdtTableGuid,
- (VOID*)(UINTN)FdtConfigurationTableBase
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePages (FdtConfigurationTableBase, NumPages);
- }
-
-EXIT_LOAD_FDT:
- if (EFI_ERROR (Status)) {
- Print (L"\nWarning: Did not manage to install the new device tree. Try to restart the platform.\n");
- }
-
- if (FdtBlobBase != 0) {
- gBS->FreePages (FdtBlobBase, NumPages);
- }
-
-EXIT:
- if (Status == EFI_ABORTED) {
- Print (L"\n");
- }
-
- if (SupportedBootDevice != NULL) {
- FreePool (SupportedBootDevice);
- }
-
- return Status;
-}
-
-/**
- Set boot timeout
-
- Ask for the boot timeout in seconds and if the input succeeds assign the
- input value to the UEFI global variable "Timeout". This function is called
- when the user selects the "Set Boot Timeout" of the boot manager menu.
-
- @param[in] BootOptionsList List of the boot devices, not used here
-
- @retval EFI_SUCCESS Boot timeout in second retrieved from the standard
- input and assigned to the UEFI "Timeout" global
- variable
- @retval !EFI_SUCCESS Either the input or the setting of the UEFI global
- variable "Timeout" has failed.
-**/
-EFI_STATUS
-STATIC
-BootMenuSetBootTimeout (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- UINTN Input;
- UINT16 Timeout;
-
- Print (L"Timeout duration (in seconds): ");
- Status = GetHIInputInteger (&Input);
- if (EFI_ERROR (Status)) {
- Print (L"\n");
- goto ErrorExit;
- }
-
- Timeout = Input;
- Status = gRT->SetVariable (
- (CHAR16*)L"Timeout",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (UINT16),
- &Timeout
- );
- ASSERT_EFI_ERROR (Status);
-
-ErrorExit:
- return Status;
-}
-
-struct BOOT_MANAGER_ENTRY {
- CONST CHAR16* Description;
- EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList);
-} BootManagerEntries[] = {
- { L"Add Boot Device Entry", BootMenuAddBootOption },
- { L"Update Boot Device Entry", BootMenuUpdateBootOption },
- { L"Remove Boot Device Entry", BootMenuRemoveBootOption },
- { L"Reorder Boot Device Entries", BootMenuReorderBootOptions },
- { L"Update FDT path", UpdateFdtPath },
- { L"Set Boot Timeout", BootMenuSetBootTimeout },
-};
-
-EFI_STATUS
-BootMenuManager (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- UINTN Index;
- UINTN OptionSelected;
- UINTN BootManagerEntryCount;
- EFI_STATUS Status;
-
- BootManagerEntryCount = sizeof(BootManagerEntries) / sizeof(struct BOOT_MANAGER_ENTRY);
-
- while (TRUE) {
- // Display Boot Manager menu
- for (Index = 0; Index < BootManagerEntryCount; Index++) {
- Print(L"[%d] %s\n",Index+1,BootManagerEntries[Index]);
- }
- Print(L"[%d] Return to main menu\n",Index+1);
-
- // Select which entry to call
- Print(L"Choice: ");
- Status = GetHIInputInteger (&OptionSelected);
- if (EFI_ERROR(Status) || (OptionSelected == (BootManagerEntryCount+1))) {
- if (EFI_ERROR(Status)) {
- Print(L"\n");
- }
- return EFI_SUCCESS;
- } else if ((OptionSelected > 0) && (OptionSelected <= BootManagerEntryCount)) {
- BootManagerEntries[OptionSelected-1].Callback (BootOptionsList);
- }
- }
- // Should never go here
-}
-
-EFI_STATUS
-BootShell (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH* EfiShellDevicePath;
-
- // Find the EFI Shell
- Status = LocateEfiApplicationInFvByName (L"Shell", &EfiShellDevicePath);
- if (Status == EFI_NOT_FOUND) {
- Print (L"Error: EFI Application not found.\n");
- return Status;
- } else if (EFI_ERROR (Status)) {
- Print (L"Error: Status Code: 0x%X\n", (UINT32)Status);
- return Status;
- } else {
- // Need to connect every drivers to ensure no dependencies are missing for the application
- Status = BdsConnectAllDrivers ();
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "FAIL to connect all drivers\n"));
- return Status;
- }
-
- return BdsStartEfiApplication (gImageHandle, EfiShellDevicePath, 0, NULL);
- }
-}
-
-struct BOOT_MAIN_ENTRY {
- CONST CHAR16* Description;
- EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList);
-} BootMainEntries[] = {
- { L"Shell", BootShell },
- { L"Boot Manager", BootMenuManager },
-};
-
-EFI_STATUS
-BootMenuMain (
- VOID
- )
-{
- LIST_ENTRY BootOptionsList;
- UINTN OptionCount;
- UINTN BootOptionCount;
- EFI_STATUS Status;
- LIST_ENTRY* Entry;
- BDS_LOAD_OPTION* BootOption;
- UINTN BootOptionSelected;
- UINTN Index;
- UINTN BootMainEntryCount;
- BOOLEAN IsUnicode;
-
- BootOption = NULL;
- BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);
-
- if (FeaturePcdGet (PcdBdsLinuxSupport)) {
- // Check Linux Loader is present
- Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &mLinuxLoaderDevicePath);
- ASSERT_EFI_ERROR (Status);
- }
-
- while (TRUE) {
- // Get Boot#### list
- BootOptionList (&BootOptionsList);
-
- OptionCount = 1;
-
- // Display the Boot options
- for (Entry = GetFirstNode (&BootOptionsList);
- !IsNull (&BootOptionsList,Entry);
- Entry = GetNextNode (&BootOptionsList,Entry)
- )
- {
- BootOption = LOAD_OPTION_FROM_LINK(Entry);
-
- Print(L"[%d] %s\n", OptionCount, BootOption->Description);
-
- DEBUG_CODE_BEGIN();
- CHAR16* DevicePathTxt;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
-
- Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- if (EFI_ERROR(Status)) {
- // You must provide an implementation of DevicePathToTextProtocol in your firmware (eg: DevicePathDxe)
- DEBUG((EFI_D_ERROR,"Error: Bds requires DevicePathToTextProtocol\n"));
- return Status;
- }
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (BootOption->FilePathList, TRUE, TRUE);
-
- Print(L"\t- %s\n",DevicePathTxt);
-
- if (BootOption->OptionalData != NULL) {
- if (IsPrintableString (BootOption->OptionalData, &IsUnicode)) {
- if (IsUnicode) {
- Print (L"\t- Arguments: %s\n", BootOption->OptionalData);
- } else {
- AsciiPrint ("\t- Arguments: %a\n", BootOption->OptionalData);
- }
- }
- }
- FreePool(DevicePathTxt);
- DEBUG_CODE_END();
-
- OptionCount++;
- }
- BootOptionCount = OptionCount-1;
-
- // Display the hardcoded Boot entries
- for (Index = 0; Index < BootMainEntryCount; Index++) {
- Print(L"[%d] %s\n",OptionCount,BootMainEntries[Index]);
- OptionCount++;
- }
-
- // Request the boot entry from the user
- BootOptionSelected = 0;
- while (BootOptionSelected == 0) {
- Print(L"Start: ");
- Status = GetHIInputInteger (&BootOptionSelected);
- if (EFI_ERROR(Status) || (BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) {
- Print(L"Invalid input (max %d)\n",(OptionCount-1));
- BootOptionSelected = 0;
- }
- }
-
- // Start the selected entry
- if (BootOptionSelected > BootOptionCount) {
- // Start the hardcoded entry
- Status = BootMainEntries[BootOptionSelected - BootOptionCount - 1].Callback (&BootOptionsList);
- } else {
- // Find the selected entry from the Boot#### list
- Index = 1;
- for (Entry = GetFirstNode (&BootOptionsList);
- !IsNull (&BootOptionsList,Entry);
- Entry = GetNextNode (&BootOptionsList,Entry)
- )
- {
- if (Index == BootOptionSelected) {
- BootOption = LOAD_OPTION_FROM_LINK(Entry);
- break;
- }
- Index++;
- }
-
- Status = BootOptionStart (BootOption);
- }
- }
- // Should never go here
-}
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c
deleted file mode 100644
index bdd02b4ecd..0000000000
--- a/ArmPlatformPkg/Bds/BootOption.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Guid/ArmGlobalVariableHob.h>
-#include "BdsInternal.h"
-
-EFI_STATUS
-BootOptionStart (
- IN BDS_LOAD_OPTION *BootOption
- )
-{
- EFI_STATUS Status;
- UINT16 LoadOptionIndexSize;
-
- // Connect all the drivers if the EFI Application is not a EFI OS Loader
- if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
- BdsConnectAllDrivers ();
- }
-
- // Set BootCurrent variable
- LoadOptionIndexSize = sizeof (UINT16);
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- LoadOptionIndexSize, &(BootOption->LoadOptionIndex));
-
- Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);
-
- // Clear BootCurrent variable
- LoadOptionIndexSize = sizeof (UINT16);
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0, NULL);
-
- return Status;
-}
-
-EFI_STATUS
-BootOptionList (
- IN OUT LIST_ENTRY *BootOptionList
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- UINT16* BootOrder;
- UINTN BootOrderSize;
- BDS_LOAD_OPTION* BdsLoadOption;
- BDS_LOAD_OPTION_ENTRY* BdsLoadOptionEntry;
-
- InitializeListHead (BootOptionList);
-
- // Get the Boot Option Order from the environment variable
- Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
- Status = BootOptionFromLoadOptionIndex (BootOrder[Index], &BdsLoadOption);
- if (!EFI_ERROR(Status)) {
- BdsLoadOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool(sizeof(BDS_LOAD_OPTION_ENTRY));
- BdsLoadOptionEntry->BdsLoadOption = BdsLoadOption;
- InsertTailList (BootOptionList,&BdsLoadOptionEntry->Link);
- }
- }
-
- FreePool (BootOrder);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-BootOptionSetFields (
- IN BDS_LOAD_OPTION* BootOption,
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN UINT8* OptionalData,
- IN UINTN OptionalDataSize
- )
-{
- EFI_LOAD_OPTION *EfiLoadOption;
- UINTN EfiLoadOptionSize;
- UINTN BootDescriptionSize;
- UINT16 FilePathListLength;
- UINT8* EfiLoadOptionPtr;
-
- // If we are overwriting an existent Boot Option then we have to free previously allocated memory
- if (BootOption->LoadOption) {
- FreePool (BootOption->LoadOption);
- }
-
- BootDescriptionSize = StrSize (BootDescription);
-
- // Compute the size of the FilePath list
- FilePathListLength = GetUnalignedDevicePathSize (DevicePath);
-
- // Allocate the memory for the EFI Load Option
- EfiLoadOptionSize = sizeof(UINT32) + sizeof(UINT16) + BootDescriptionSize + FilePathListLength + OptionalDataSize;
- EfiLoadOption = (EFI_LOAD_OPTION *)AllocatePool(EfiLoadOptionSize);
- EfiLoadOptionPtr = (UINT8 *)EfiLoadOption;
-
- //
- // Populate the EFI Load Option and BDS Boot Option structures
- //
-
- // Attributes fields
- BootOption->Attributes = Attributes;
- *(UINT32*)EfiLoadOptionPtr = Attributes;
- EfiLoadOptionPtr += sizeof(UINT32);
-
- // FilePath List fields
- BootOption->FilePathListLength = FilePathListLength;
- *(UINT16*)EfiLoadOptionPtr = FilePathListLength;
- EfiLoadOptionPtr += sizeof(UINT16);
-
- // Boot description fields
- BootOption->Description = (CHAR16*)EfiLoadOptionPtr;
- CopyMem (EfiLoadOptionPtr, BootDescription, BootDescriptionSize);
- EfiLoadOptionPtr += BootDescriptionSize;
-
- // File path fields
- BootOption->FilePathList = (EFI_DEVICE_PATH_PROTOCOL*)EfiLoadOptionPtr;
- CopyMem (EfiLoadOptionPtr, DevicePath, FilePathListLength);
- EfiLoadOptionPtr += FilePathListLength;
-
- // Optional Data fields, Do unaligned writes
- BootOption->OptionalData = EfiLoadOptionPtr;
-
- if (OptionalData != NULL) {
- CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
- }
-
- BootOption->OptionalDataSize = OptionalDataSize;
-
- // If this function is called at the creation of the Boot Device entry (not at the update) the
- // BootOption->LoadOptionSize must be zero then we get a new BootIndex for this entry
- if (BootOption->LoadOptionSize == 0) {
- BootOption->LoadOptionIndex = BootOptionAllocateBootIndex ();
- }
-
- // Fill the EFI Load option fields
- BootOption->LoadOption = EfiLoadOption;
- BootOption->LoadOptionSize = EfiLoadOptionSize;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BootOptionCreate (
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN UINT8* OptionalData,
- IN UINTN OptionalDataSize,
- OUT BDS_LOAD_OPTION** BdsLoadOption
- )
-{
- EFI_STATUS Status;
- BDS_LOAD_OPTION_ENTRY* BootOptionEntry;
- BDS_LOAD_OPTION* BootOption;
- CHAR16 BootVariableName[9];
- UINT16* BootOrder;
- UINTN BootOrderSize;
-
- //
- // Allocate and fill the memory for the BDS Load Option structure
- //
- BootOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool (sizeof (BDS_LOAD_OPTION_ENTRY));
- InitializeListHead (&BootOptionEntry->Link);
- BootOptionEntry->BdsLoadOption = (BDS_LOAD_OPTION*)AllocateZeroPool (sizeof(BDS_LOAD_OPTION));
-
- BootOption = BootOptionEntry->BdsLoadOption;
- BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);
-
- //
- // Set the related environment variables
- //
-
- // Create Boot#### environment variable
- UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BootOption->LoadOptionIndex);
- Status = gRT->SetVariable (
- BootVariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- BootOption->LoadOptionSize,
- BootOption->LoadOption
- );
-
- // Add the new Boot Index to the list
- Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
- if (!EFI_ERROR(Status)) {
- BootOrder = ReallocatePool (BootOrderSize, BootOrderSize + sizeof(UINT16), BootOrder);
- // Add the new index at the end
- BootOrder[BootOrderSize / sizeof(UINT16)] = BootOption->LoadOptionIndex;
- BootOrderSize += sizeof(UINT16);
- } else {
- // BootOrder does not exist. Create it
- BootOrderSize = sizeof(UINT16);
- BootOrder = &(BootOption->LoadOptionIndex);
- }
-
- // Update (or Create) the BootOrder environment variable
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- BootOrderSize,
- BootOrder
- );
-
- // We only free it if the UEFI Variable 'BootOrder' was already existing
- if (BootOrderSize > sizeof(UINT16)) {
- FreePool (BootOrder);
- }
-
- *BdsLoadOption = BootOption;
- return Status;
-}
-
-EFI_STATUS
-BootOptionUpdate (
- IN BDS_LOAD_OPTION* BdsLoadOption,
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN UINT8* OptionalData,
- IN UINTN OptionalDataSize
- )
-{
- EFI_STATUS Status;
- CHAR16 BootVariableName[9];
-
- // Update the BDS Load Option structure
- BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);
-
- // Update the related environment variables
- UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BdsLoadOption->LoadOptionIndex);
-
- Status = gRT->SetVariable (
- BootVariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- BdsLoadOption->LoadOptionSize,
- BdsLoadOption->LoadOption
- );
-
- return Status;
-}
-
-EFI_STATUS
-BootOptionDelete (
- IN BDS_LOAD_OPTION *BootOption
- )
-{
- UINTN Index;
- UINTN BootOrderSize;
- UINT16* BootOrder;
- UINTN BootOrderCount;
- CHAR16 BootVariableName[9];
- EFI_STATUS Status;
-
- // Remove the entry from the BootOrder environment variable
- Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
- if (!EFI_ERROR(Status)) {
- BootOrderCount = BootOrderSize / sizeof(UINT16);
-
- // Find the index of the removed entry
- for (Index = 0; Index < BootOrderCount; Index++) {
- if (BootOrder[Index] == BootOption->LoadOptionIndex) {
- // If it the last entry we do not need to rearrange the BootOrder list
- if (Index + 1 != BootOrderCount) {
- CopyMem (
- &BootOrder[Index],
- &BootOrder[Index + 1],
- (BootOrderCount - (Index + 1)) * sizeof(UINT16)
- );
- }
- break;
- }
- }
-
- // Update the BootOrder environment variable
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- BootOrderSize - sizeof(UINT16),
- BootOrder
- );
- }
-
- // Delete Boot#### environment variable
- UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BootOption->LoadOptionIndex);
- Status = gRT->SetVariable (
- BootVariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0,
- NULL
- );
-
- FreePool (BootOrder);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c
deleted file mode 100644
index 27faf003c6..0000000000
--- a/ArmPlatformPkg/Bds/BootOptionSupport.c
+++ /dev/null
@@ -1,1195 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BdsInternal.h"
-
-#include <Library/NetLib.h>
-
-#include <Protocol/BlockIo.h>
-#include <Protocol/DevicePathToText.h>
-#include <Protocol/FirmwareVolumeBlock.h>
-#include <Protocol/PxeBaseCode.h>
-#include <Protocol/SimpleFileSystem.h>
-#include <Protocol/SimpleNetwork.h>
-#include <Protocol/Dhcp4.h>
-#include <Protocol/Mtftp4.h>
-
-#include <Guid/FileSystemInfo.h>
-
-#define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype)))
-
-EFI_STATUS
-BdsLoadOptionFileSystemList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- );
-
-EFI_STATUS
-BdsLoadOptionFileSystemCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- );
-
-EFI_STATUS
-BdsLoadOptionFileSystemUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- );
-
-BOOLEAN
-BdsLoadOptionFileSystemIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- );
-
-EFI_STATUS
-BdsLoadOptionMemMapList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- );
-
-EFI_STATUS
-BdsLoadOptionMemMapCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- );
-
-EFI_STATUS
-BdsLoadOptionMemMapUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- );
-
-BOOLEAN
-BdsLoadOptionMemMapIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- );
-
-EFI_STATUS
-BdsLoadOptionPxeList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- );
-
-EFI_STATUS
-BdsLoadOptionPxeCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- );
-
-EFI_STATUS
-BdsLoadOptionPxeUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- );
-
-BOOLEAN
-BdsLoadOptionPxeIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- );
-
-EFI_STATUS
-BdsLoadOptionTftpList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- );
-
-EFI_STATUS
-BdsLoadOptionTftpCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- );
-
-EFI_STATUS
-BdsLoadOptionTftpUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- );
-
-BOOLEAN
-BdsLoadOptionTftpIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- );
-
-BDS_LOAD_OPTION_SUPPORT BdsLoadOptionSupportList[] = {
- {
- BDS_DEVICE_FILESYSTEM,
- BdsLoadOptionFileSystemList,
- BdsLoadOptionFileSystemIsSupported,
- BdsLoadOptionFileSystemCreateDevicePath,
- BdsLoadOptionFileSystemUpdateDevicePath,
- TRUE
- },
- {
- BDS_DEVICE_MEMMAP,
- BdsLoadOptionMemMapList,
- BdsLoadOptionMemMapIsSupported,
- BdsLoadOptionMemMapCreateDevicePath,
- BdsLoadOptionMemMapUpdateDevicePath,
- TRUE
- },
- {
- BDS_DEVICE_PXE,
- BdsLoadOptionPxeList,
- BdsLoadOptionPxeIsSupported,
- BdsLoadOptionPxeCreateDevicePath,
- BdsLoadOptionPxeUpdateDevicePath,
- FALSE
- },
- {
- BDS_DEVICE_TFTP,
- BdsLoadOptionTftpList,
- BdsLoadOptionTftpIsSupported,
- BdsLoadOptionTftpCreateDevicePath,
- BdsLoadOptionTftpUpdateDevicePath,
- TRUE
- }
-};
-
-EFI_STATUS
-BootDeviceListSupportedInit (
- IN OUT LIST_ENTRY *SupportedDeviceList
- )
-{
- UINTN Index;
-
- // Initialize list of supported devices
- InitializeListHead (SupportedDeviceList);
-
- for (Index = 0; Index < BDS_DEVICE_MAX; Index++) {
- BdsLoadOptionSupportList[Index].ListDevices (SupportedDeviceList);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BootDeviceListSupportedFree (
- IN LIST_ENTRY *SupportedDeviceList,
- IN BDS_SUPPORTED_DEVICE *Except
- )
-{
- LIST_ENTRY *Entry;
- BDS_SUPPORTED_DEVICE* SupportedDevice;
-
- Entry = GetFirstNode (SupportedDeviceList);
- while (Entry != SupportedDeviceList) {
- SupportedDevice = SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry);
- Entry = RemoveEntryList (Entry);
- if (SupportedDevice != Except) {
- FreePool (SupportedDevice);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BootDeviceGetDeviceSupport (
- IN EFI_DEVICE_PATH *DevicePath,
- OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport
- )
-{
- UINTN Index;
-
- // Find which supported device is the most appropriate
- for (Index = 0; Index < BDS_DEVICE_MAX; Index++) {
- if (BdsLoadOptionSupportList[Index].IsSupported (DevicePath)) {
- *DeviceSupport = &BdsLoadOptionSupportList[Index];
- return EFI_SUCCESS;
- }
- }
-
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-BdsLoadOptionFileSystemList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- )
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- BDS_SUPPORTED_DEVICE *SupportedDevice;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* FileProtocol;
- EFI_FILE_HANDLE Fs;
- UINTN Size;
- EFI_FILE_SYSTEM_INFO* FsInfo;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
-
- // List all the Simple File System Protocols
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleFileSystemProtocolGuid, NULL, &HandleCount, &HandleBuffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
- if (!EFI_ERROR(Status)) {
- // Allocate BDS Supported Device structure
- SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool (sizeof(BDS_SUPPORTED_DEVICE));
-
- FileProtocol = NULL;
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FileProtocol);
- ASSERT_EFI_ERROR(Status);
-
- FileProtocol->OpenVolume (FileProtocol, &Fs);
-
- // Generate a Description from the file system
- Size = 0;
- FsInfo = NULL;
- Status = Fs->GetInfo (Fs, &gEfiFileSystemInfoGuid, &Size, FsInfo);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- FsInfo = AllocatePool (Size);
- Status = Fs->GetInfo (Fs, &gEfiFileSystemInfoGuid, &Size, FsInfo);
- }
- UnicodeSPrint (SupportedDevice->Description,BOOT_DEVICE_DESCRIPTION_MAX,L"%s (%d MB)",FsInfo->VolumeLabel,(UINT32)(FsInfo->VolumeSize / (1024 * 1024)));
- FreePool(FsInfo);
- Fs->Close (Fs);
-
- SupportedDevice->DevicePathProtocol = DevicePathProtocol;
- SupportedDevice->Support = &BdsLoadOptionSupportList[BDS_DEVICE_FILESYSTEM];
-
- InsertTailList (BdsLoadOptionList,&SupportedDevice->Link);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsLoadOptionFileSystemCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- )
-{
- EFI_STATUS Status;
- FILEPATH_DEVICE_PATH* FilePathDevicePath;
- CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
- UINTN BootFilePathSize;
-
- Print(L"File path of the %s: ", FileName);
- Status = GetHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
-
- BootFilePathSize = StrSize (BootFilePath);
- if (BootFilePathSize == 2) {
- *DevicePathNodes = NULL;
- return EFI_NOT_FOUND;
- }
-
- // Create the FilePath Device Path node
- FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize + END_DEVICE_PATH_LENGTH);
- FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
- FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
- SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
- CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
- SetDevicePathEndNode ((VOID*)((UINTN)FilePathDevicePath + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize));
- *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)FilePathDevicePath;
-
- return Status;
-}
-
-EFI_STATUS
-BdsLoadOptionFileSystemUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- )
-{
- EFI_STATUS Status;
- CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
- UINTN BootFilePathSize;
- FILEPATH_DEVICE_PATH* EndingDevicePath;
- FILEPATH_DEVICE_PATH* FilePathDevicePath;
- EFI_DEVICE_PATH* DevicePath;
-
- DevicePath = DuplicateDevicePath (OldDevicePath);
-
- EndingDevicePath = (FILEPATH_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);
-
- Print(L"File path of the %s: ", FileName);
- StrnCpy (BootFilePath, EndingDevicePath->PathName, BOOT_DEVICE_FILEPATH_MAX);
- Status = EditHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- BootFilePathSize = StrSize(BootFilePath);
- if (BootFilePathSize == 2) {
- *NewDevicePath = NULL;
- return EFI_NOT_FOUND;
- }
-
- // Create the FilePath Device Path node
- FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
- FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
- FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
- SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
- CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
-
- // Generate the new Device Path by replacing the last node by the updated node
- SetDevicePathEndNode (EndingDevicePath);
- *NewDevicePath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)FilePathDevicePath);
- FreePool(DevicePath);
-
- return EFI_SUCCESS;
-}
-
-/**
- Check if a boot option path is a file system boot option path or not.
-
- The device specified by the beginning of the path has to support the Simple File
- System protocol. Furthermore, the remaining part of the path has to be composed of
- a single node of type MEDIA_DEVICE_PATH and sub-type MEDIA_FILEPATH_DP.
-
- @param[in] DevicePath Complete device path of a boot option.
-
- @retval FALSE The boot option path has not been identified as that of a
- file system boot option.
- @retval TRUE The boot option path is a file system boot option.
-**/
-BOOLEAN
-BdsLoadOptionFileSystemIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH *RemainingDevicePath;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileProtocol;
-
- Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID **)(&FileProtocol)
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (!IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP))
- return FALSE;
-
- return TRUE;
-}
-
-STATIC
-BOOLEAN
-IsParentDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath
- )
-{
- UINTN ParentSize;
- UINTN ChildSize;
-
- ParentSize = GetDevicePathSize (ParentDevicePath);
- ChildSize = GetDevicePathSize (ChildDevicePath);
-
- if (ParentSize > ChildSize) {
- return FALSE;
- }
-
- if (CompareMem (ParentDevicePath, ChildDevicePath, ParentSize - END_DEVICE_PATH_LENGTH) != 0) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-EFI_STATUS
-BdsLoadOptionMemMapList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- )
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN DevicePathHandleCount;
- EFI_HANDLE *DevicePathHandleBuffer;
- BOOLEAN IsParent;
- UINTN Index;
- UINTN Index2;
- BDS_SUPPORTED_DEVICE *SupportedDevice;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
- EFI_DEVICE_PATH* DevicePath;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileProtocol;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol;
-
- // List all the BlockIo Protocols
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &HandleCount, &HandleBuffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- // We only select handles WITH a Device Path AND not part of Media (to
- // avoid duplication with HardDisk, CDROM, etc). Skip handles used by
- // Simple Filesystem or used for Variable Storage.
-
-
- Status = gBS->HandleProtocol (HandleBuffer[Index],
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID *)&FileProtocol);
- if (!EFI_ERROR(Status)) {
- // SimpleFilesystem supported on this handle, skip
- continue;
- }
-
- Status = gBS->HandleProtocol (HandleBuffer[Index],
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID *)&FvbProtocol);
- if (!EFI_ERROR(Status)) {
- // Firmware Volme Block / Variable storage supported on this handle, skip
- continue;
- }
-
- Status = gBS->HandleProtocol (HandleBuffer[Index],
- &gEfiFirmwareVolumeBlock2ProtocolGuid,
- (VOID *)&FvbProtocol);
- if (!EFI_ERROR(Status)) {
- // Firmware Volme Block / Variable storage supported on this handle, skip
- continue;
- }
-
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
- if (!EFI_ERROR(Status)) {
- // BlockIo is not part of Media Device Path
- DevicePath = DevicePathProtocol;
- while (!IsDevicePathEndType (DevicePath) && (DevicePathType (DevicePath) != MEDIA_DEVICE_PATH)) {
- DevicePath = NextDevicePathNode (DevicePath);
- }
- if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) {
- continue;
- }
-
- // Open all the handle supporting the DevicePath protocol and verify this handle has not got any child
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiDevicePathProtocolGuid, NULL, &DevicePathHandleCount, &DevicePathHandleBuffer);
- ASSERT_EFI_ERROR (Status);
- IsParent = FALSE;
- for (Index2 = 0; (Index2 < DevicePathHandleCount) && !IsParent; Index2++) {
- if (HandleBuffer[Index] != DevicePathHandleBuffer[Index2]) {
- gBS->HandleProtocol (DevicePathHandleBuffer[Index2], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath);
- if (IsParentDevicePath (DevicePathProtocol, DevicePath)) {
- IsParent = TRUE;
- }
- }
- }
- if (IsParent) {
- continue;
- }
-
- // Allocate BDS Supported Device structure
- SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool(sizeof(BDS_SUPPORTED_DEVICE));
-
- Status = GenerateDeviceDescriptionName (HandleBuffer[Index], SupportedDevice->Description);
- ASSERT_EFI_ERROR (Status);
-
- SupportedDevice->DevicePathProtocol = DevicePathProtocol;
- SupportedDevice->Support = &BdsLoadOptionSupportList[BDS_DEVICE_MEMMAP];
-
- InsertTailList (BdsLoadOptionList,&SupportedDevice->Link);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsLoadOptionMemMapCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- )
-{
- EFI_STATUS Status;
- MEMMAP_DEVICE_PATH *MemMapDevicePath;
- CHAR16 StrStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
- CHAR16 StrEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
-
- Print(L"Starting Address of the %s: ", FileName);
- Status = GetHIInputStr (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
-
- Print(L"Ending Address of the %s: ", FileName);
- Status = GetHIInputStr (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
-
- // Create the MemMap Device Path Node
- MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool (sizeof(MEMMAP_DEVICE_PATH) + END_DEVICE_PATH_LENGTH);
- MemMapDevicePath->Header.Type = HARDWARE_DEVICE_PATH;
- MemMapDevicePath->Header.SubType = HW_MEMMAP_DP;
- SetDevicePathNodeLength (MemMapDevicePath, sizeof(MEMMAP_DEVICE_PATH));
- MemMapDevicePath->MemoryType = EfiBootServicesData;
- MemMapDevicePath->StartingAddress = StrHexToUint64 (StrStartingAddress);
- MemMapDevicePath->EndingAddress = StrHexToUint64 (StrEndingAddress);
-
- // Set a Device Path End Node after the Memory Map Device Path Node
- SetDevicePathEndNode (MemMapDevicePath + 1);
- *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)MemMapDevicePath;
-
- return Status;
-}
-
-EFI_STATUS
-BdsLoadOptionMemMapUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- )
-{
- EFI_STATUS Status;
- CHAR16 StrStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
- CHAR16 StrEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
- MEMMAP_DEVICE_PATH* EndingDevicePath;
- EFI_DEVICE_PATH* DevicePath;
-
- DevicePath = DuplicateDevicePath (OldDevicePath);
- EndingDevicePath = (MEMMAP_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);
-
- Print(L"Starting Address of the %s: ", FileName);
- UnicodeSPrint (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX, L"0x%X", (UINTN)EndingDevicePath->StartingAddress);
- Status = EditHIInputStr (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
-
- Print(L"Ending Address of the %s: ", FileName);
- UnicodeSPrint (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX, L"0x%X", (UINTN)EndingDevicePath->EndingAddress);
- Status = EditHIInputStr (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
-
- EndingDevicePath->StartingAddress = StrHexToUint64 (StrStartingAddress);
- EndingDevicePath->EndingAddress = StrHexToUint64 (StrEndingAddress);
-
- if (EFI_ERROR(Status)) {
- FreePool(DevicePath);
- } else {
- *NewDevicePath = DevicePath;
- }
-
- return Status;
-}
-
-/**
- Check if a boot option path is a memory map boot option path or not.
-
- The device specified by the beginning of the path has to support the BlockIo
- protocol. Furthermore, the remaining part of the path has to be composed of
- a single node of type HARDWARE_DEVICE_PATH and sub-type HW_MEMMAP_DP.
-
- @param[in] DevicePath Complete device path of a boot option.
-
- @retval FALSE The boot option path has not been identified as that of a
- memory map boot option.
- @retval TRUE The boot option path is a a memory map boot option.
-**/
-BOOLEAN
-BdsLoadOptionMemMapIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH *RemainingDevicePath;
- EFI_BLOCK_IO_PROTOCOL *BlockIoProtocol;
-
- Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiBlockIoProtocolGuid,
- (VOID **)(&BlockIoProtocol)
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (!IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP))
- return FALSE;
-
- return TRUE;
-}
-
-EFI_STATUS
-BdsLoadOptionPxeList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- )
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- BDS_SUPPORTED_DEVICE *SupportedDevice;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
- EFI_SIMPLE_NETWORK_PROTOCOL* SimpleNet;
- CHAR16 DeviceDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- EFI_MAC_ADDRESS *Mac;
-
- // List all the PXE Protocols
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPxeBaseCodeProtocolGuid, NULL, &HandleCount, &HandleBuffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- // We only select the handle WITH a Device Path AND the PXE Protocol
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
- if (!EFI_ERROR(Status)) {
- // Allocate BDS Supported Device structure
- SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool(sizeof(BDS_SUPPORTED_DEVICE));
-
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimpleNetworkProtocolGuid, (VOID **)&SimpleNet);
- if (!EFI_ERROR(Status)) {
- Mac = &SimpleNet->Mode->CurrentAddress;
- UnicodeSPrint (DeviceDescription,BOOT_DEVICE_DESCRIPTION_MAX,L"MAC Address: %02x:%02x:%02x:%02x:%02x:%02x", Mac->Addr[0], Mac->Addr[1], Mac->Addr[2], Mac->Addr[3], Mac->Addr[4], Mac->Addr[5]);
- } else {
- Status = GenerateDeviceDescriptionName (HandleBuffer[Index], DeviceDescription);
- ASSERT_EFI_ERROR (Status);
- }
- UnicodeSPrint (SupportedDevice->Description,BOOT_DEVICE_DESCRIPTION_MAX,L"PXE on %s",DeviceDescription);
-
- SupportedDevice->DevicePathProtocol = DevicePathProtocol;
- SupportedDevice->Support = &BdsLoadOptionSupportList[BDS_DEVICE_PXE];
-
- InsertTailList (BdsLoadOptionList,&SupportedDevice->Link);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsLoadOptionPxeCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- )
-{
- *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
- SetDevicePathEndNode (*DevicePathNodes);
-
- return EFI_SUCCESS;
-}
-
-/**
- Update the parameters of a Pxe boot option
-
- @param[in] OldDevicePath Current complete device path of the Pxe boot option.
- This has to be a valid complete Pxe boot option path.
- @param[in] FileName Description of the file the path is asked for
- @param[out] NewDevicePath Pointer to the new complete device path.
-
- @retval EFI_SUCCESS Update completed
- @retval EFI_OUT_OF_RESOURCES Fail to perform the update due to lack of resource
-**/
-EFI_STATUS
-BdsLoadOptionPxeUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- )
-{
- //
- // Make a copy of the complete device path that is made of :
- // the device path of the device supporting the Pxe base code protocol
- // followed by an end node.
- //
- *NewDevicePath = DuplicateDevicePath (OldDevicePath);
- if (*NewDevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- } else {
- return EFI_SUCCESS;
- }
-}
-
-BOOLEAN
-BdsLoadOptionPxeIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
- EFI_PXE_BASE_CODE_PROTOCOL *PxeBcProtocol;
-
- Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
- if (EFI_ERROR(Status)) {
- return FALSE;
- }
-
- if (!IsDevicePathEnd(RemainingDevicePath)) {
- return FALSE;
- }
-
- Status = gBS->HandleProtocol (Handle, &gEfiPxeBaseCodeProtocolGuid, (VOID **)&PxeBcProtocol);
- if (EFI_ERROR (Status)) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-/**
- Add to the list of boot devices the devices allowing a TFTP boot
-
- @param[in] BdsLoadOptionList List of devices to boot from
-
- @retval EFI_SUCCESS Update completed
- @retval EFI_OUT_OF_RESOURCES Fail to perform the update due to lack of resource
-**/
-EFI_STATUS
-BdsLoadOptionTftpList (
- IN OUT LIST_ENTRY* BdsLoadOptionList
- )
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- EFI_HANDLE Handle;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathProtocol;
- VOID *Interface;
- EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNetworkProtocol;
- BDS_SUPPORTED_DEVICE *SupportedDevice;
- EFI_MAC_ADDRESS *Mac;
-
- //
- // List all the handles on which the Simple Network Protocol is installed.
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleNetworkProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Handle = HandleBuffer[Index];
- //
- // We select the handles that support :
- // . the Device Path Protocol
- // . the MTFTP4 Protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID **)&DevicePathProtocol
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiMtftp4ServiceBindingProtocolGuid,
- &Interface
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **)&SimpleNetworkProtocol
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- // Allocate BDS Supported Device structure
- SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool (sizeof (BDS_SUPPORTED_DEVICE));
- if (SupportedDevice == NULL) {
- continue;
- }
-
- Mac = &SimpleNetworkProtocol->Mode->CurrentAddress;
- UnicodeSPrint (
- SupportedDevice->Description,
- BOOT_DEVICE_DESCRIPTION_MAX,
- L"TFTP on MAC Address: %02x:%02x:%02x:%02x:%02x:%02x",
- Mac->Addr[0], Mac->Addr[1], Mac->Addr[2], Mac->Addr[3], Mac->Addr[4], Mac->Addr[5]
- );
-
- SupportedDevice->DevicePathProtocol = DevicePathProtocol;
- SupportedDevice->Support = &BdsLoadOptionSupportList[BDS_DEVICE_TFTP];
-
- InsertTailList (BdsLoadOptionList, &SupportedDevice->Link);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsLoadOptionTftpCreateDevicePath (
- IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes
- )
-{
- EFI_STATUS Status;
- BOOLEAN IsDHCP;
- EFI_IP_ADDRESS LocalIp;
- EFI_IP_ADDRESS SubnetMask;
- EFI_IP_ADDRESS GatewayIp;
- EFI_IP_ADDRESS RemoteIp;
- IPv4_DEVICE_PATH *IPv4DevicePathNode;
- FILEPATH_DEVICE_PATH *FilePathDevicePath;
- CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
- UINTN BootFilePathSize;
-
- Print (L"Get the IP address from DHCP: ");
- Status = GetHIInputBoolean (&IsDHCP);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- if (!IsDHCP) {
- Print (L"Local static IP address: ");
- Status = GetHIInputIP (&LocalIp);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- Print (L"Get the network mask: ");
- Status = GetHIInputIP (&SubnetMask);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- Print (L"Get the gateway IP address: ");
- Status = GetHIInputIP (&GatewayIp);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- }
-
- Print (L"Get the TFTP server IP address: ");
- Status = GetHIInputIP (&RemoteIp);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- Print (L"File path of the %s : ", FileName);
- Status = GetHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- BootFilePathSize = StrSize(BootFilePath);
- if (BootFilePathSize == 2) {
- return EFI_NOT_FOUND;
- }
-
- // Allocate the memory for the IPv4 + File Path Device Path Nodes
- IPv4DevicePathNode = (IPv4_DEVICE_PATH*)AllocatePool(sizeof(IPv4_DEVICE_PATH) + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize + END_DEVICE_PATH_LENGTH);
-
- // Create the IPv4 Device Path
- IPv4DevicePathNode->Header.Type = MESSAGING_DEVICE_PATH;
- IPv4DevicePathNode->Header.SubType = MSG_IPv4_DP;
- SetDevicePathNodeLength (&IPv4DevicePathNode->Header, sizeof(IPv4_DEVICE_PATH));
-
- if (!IsDHCP) {
- CopyMem (&IPv4DevicePathNode->LocalIpAddress, &LocalIp.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&IPv4DevicePathNode->SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&IPv4DevicePathNode->GatewayIpAddress, &GatewayIp.v4, sizeof (EFI_IPv4_ADDRESS));
- }
-
- CopyMem (&IPv4DevicePathNode->RemoteIpAddress, &RemoteIp.v4, sizeof (EFI_IPv4_ADDRESS));
- IPv4DevicePathNode->LocalPort = 0;
- IPv4DevicePathNode->RemotePort = 0;
- IPv4DevicePathNode->Protocol = EFI_IP_PROTO_TCP;
- IPv4DevicePathNode->StaticIpAddress = (IsDHCP != TRUE);
-
- // Create the FilePath Device Path node
- FilePathDevicePath = (FILEPATH_DEVICE_PATH*)(IPv4DevicePathNode + 1);
- FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
- FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
- SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
- CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
-
- // Set the End Device Path Node
- SetDevicePathEndNode ((VOID*)((UINTN)FilePathDevicePath + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize));
- *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)IPv4DevicePathNode;
-
- return Status;
-}
-
-/**
- Update the parameters of a TFTP boot option
-
- The function asks sequentially to update the IPv4 parameters as well as the boot file path,
- providing the previously set value if any.
-
- @param[in] OldDevicePath Current complete device path of the Tftp boot option.
- This has to be a valid complete Tftp boot option path.
- By complete, we mean that it is not only the Tftp
- specific end part built by the
- "BdsLoadOptionTftpCreateDevicePath()" function.
- This path is handled as read only.
- @param[in] FileName Description of the file the path is asked for
- @param[out] NewDevicePath Pointer to the new complete device path.
-
- @retval EFI_SUCCESS Update completed
- @retval EFI_ABORTED Update aborted by the user
- @retval EFI_OUT_OF_RESOURCES Fail to perform the update due to lack of resource
-**/
-EFI_STATUS
-BdsLoadOptionTftpUpdateDevicePath (
- IN EFI_DEVICE_PATH *OldDevicePath,
- IN CHAR16 *FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH *DevicePath;
- EFI_DEVICE_PATH *DevicePathNode;
- UINT8 *Ipv4NodePtr;
- IPv4_DEVICE_PATH Ipv4Node;
- BOOLEAN IsDHCP;
- EFI_IP_ADDRESS OldIp;
- EFI_IP_ADDRESS OldSubnetMask;
- EFI_IP_ADDRESS OldGatewayIp;
- EFI_IP_ADDRESS LocalIp;
- EFI_IP_ADDRESS SubnetMask;
- EFI_IP_ADDRESS GatewayIp;
- EFI_IP_ADDRESS RemoteIp;
- UINT8 *FileNodePtr;
- CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
- UINTN PathSize;
- UINTN BootFilePathSize;
- FILEPATH_DEVICE_PATH *NewFilePathNode;
-
- Ipv4NodePtr = NULL;
-
- //
- // Make a copy of the complete device path that is made of :
- // the device path of the device that support the Simple Network protocol
- // followed by an IPv4 node (type IPv4_DEVICE_PATH),
- // followed by a file path node (type FILEPATH_DEVICE_PATH) and ended up
- // by an end node. The IPv6 case is not handled yet.
- //
-
- DevicePath = DuplicateDevicePath (OldDevicePath);
- if (DevicePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- //
- // Because of the check done by "BdsLoadOptionTftpIsSupported()" prior to the
- // call to this function, we know that the device path ends with an IPv4 node
- // followed by a file path node and finally an end node. To get the address of
- // the last IPv4 node, we loop over the whole device path, noting down the
- // address of each encountered IPv4 node.
- //
-
- for (DevicePathNode = DevicePath;
- !IsDevicePathEnd (DevicePathNode);
- DevicePathNode = NextDevicePathNode (DevicePathNode))
- {
- if (IS_DEVICE_PATH_NODE (DevicePathNode, MESSAGING_DEVICE_PATH, MSG_IPv4_DP)) {
- Ipv4NodePtr = (UINT8*)DevicePathNode;
- }
- }
-
- // Copy for alignment of the IPv4 node data
- CopyMem (&Ipv4Node, Ipv4NodePtr, sizeof (IPv4_DEVICE_PATH));
-
- Print (L"Get the IP address from DHCP: ");
- Status = GetHIInputBoolean (&IsDHCP);
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- if (!IsDHCP) {
- Print (L"Local static IP address: ");
- if (Ipv4Node.StaticIpAddress) {
- CopyMem (&OldIp.v4, &Ipv4Node.LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));
- Status = EditHIInputIP (&OldIp, &LocalIp);
- } else {
- Status = GetHIInputIP (&LocalIp);
- }
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- Print (L"Get the network mask: ");
- if (Ipv4Node.StaticIpAddress) {
- CopyMem (&OldSubnetMask.v4, &Ipv4Node.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
- Status = EditHIInputIP (&OldSubnetMask, &SubnetMask);
- } else {
- Status = GetHIInputIP (&SubnetMask);
- }
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- Print (L"Get the gateway IP address: ");
- if (Ipv4Node.StaticIpAddress) {
- CopyMem (&OldGatewayIp.v4, &Ipv4Node.GatewayIpAddress, sizeof (EFI_IPv4_ADDRESS));
- Status = EditHIInputIP (&OldGatewayIp, &GatewayIp);
- } else {
- Status = GetHIInputIP (&GatewayIp);
- }
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
- }
-
- Print (L"TFTP server IP address: ");
- // Copy remote IPv4 address into IPv4 or IPv6 union
- CopyMem (&OldIp.v4, &Ipv4Node.RemoteIpAddress, sizeof (EFI_IPv4_ADDRESS));
-
- Status = EditHIInputIP (&OldIp, &RemoteIp);
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- // Get the path of the boot file and its size in number of bytes
- FileNodePtr = Ipv4NodePtr + sizeof (IPv4_DEVICE_PATH);
- BootFilePathSize = DevicePathNodeLength (FileNodePtr) - SIZE_OF_FILEPATH_DEVICE_PATH;
-
- //
- // Ask for update of the boot file path
- //
- do {
- // Copy for 2-byte alignment of the Unicode string
- CopyMem (
- BootFilePath, FileNodePtr + SIZE_OF_FILEPATH_DEVICE_PATH,
- MIN (BootFilePathSize, BOOT_DEVICE_FILEPATH_MAX)
- );
- BootFilePath[BOOT_DEVICE_FILEPATH_MAX - 1] = L'\0';
-
- Print (L"File path of the %s: ", FileName);
- Status = EditHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
- PathSize = StrSize (BootFilePath);
- if (PathSize > 2) {
- break;
- }
- // Empty string, give the user another try
- Print (L"Empty string - Invalid path\n");
- } while (PathSize <= 2) ;
-
- //
- // Update the IPv4 node. IPv6 case not handled yet.
- //
- if (IsDHCP) {
- Ipv4Node.StaticIpAddress = FALSE;
- ZeroMem (&Ipv4Node.LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));
- ZeroMem (&Ipv4Node.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
- ZeroMem (&Ipv4Node.GatewayIpAddress, sizeof (EFI_IPv4_ADDRESS));
- } else {
- Ipv4Node.StaticIpAddress = TRUE;
- CopyMem (&Ipv4Node.LocalIpAddress, &LocalIp.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&Ipv4Node.SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&Ipv4Node.GatewayIpAddress, &GatewayIp.v4, sizeof (EFI_IPv4_ADDRESS));
- }
-
- CopyMem (&Ipv4Node.RemoteIpAddress, &RemoteIp.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (Ipv4NodePtr, &Ipv4Node, sizeof (IPv4_DEVICE_PATH));
-
- //
- // Create the new file path node
- //
- NewFilePathNode = (FILEPATH_DEVICE_PATH*)AllocatePool (
- SIZE_OF_FILEPATH_DEVICE_PATH +
- PathSize
- );
- NewFilePathNode->Header.Type = MEDIA_DEVICE_PATH;
- NewFilePathNode->Header.SubType = MEDIA_FILEPATH_DP;
- SetDevicePathNodeLength (
- NewFilePathNode,
- SIZE_OF_FILEPATH_DEVICE_PATH + PathSize
- );
- CopyMem (NewFilePathNode->PathName, BootFilePath, PathSize);
-
- //
- // Generate the new Device Path by replacing the file path node at address
- // "FileNodePtr" by the new one "NewFilePathNode" and return its address.
- //
- SetDevicePathEndNode (FileNodePtr);
- *NewDevicePath = AppendDevicePathNode (
- DevicePath,
- (CONST EFI_DEVICE_PATH_PROTOCOL*)NewFilePathNode
- );
-
-ErrorExit:
- if (DevicePath != NULL) {
- FreePool (DevicePath) ;
- }
-
- return Status;
-}
-
-BOOLEAN
-BdsLoadOptionTftpIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH *RemainingDevicePath;
- EFI_DEVICE_PATH *NextDevicePath;
- EFI_PXE_BASE_CODE_PROTOCOL *PxeBcProtocol;
-
- Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
- if (EFI_ERROR(Status)) {
- return FALSE;
- }
-
- // Validate the Remaining Device Path
- if (IsDevicePathEnd(RemainingDevicePath)) {
- return FALSE;
- }
- if (!IS_DEVICE_PATH_NODE(RemainingDevicePath,MESSAGING_DEVICE_PATH,MSG_IPv4_DP) &&
- !IS_DEVICE_PATH_NODE(RemainingDevicePath,MESSAGING_DEVICE_PATH,MSG_IPv6_DP)) {
- return FALSE;
- }
- NextDevicePath = NextDevicePathNode (RemainingDevicePath);
- if (IsDevicePathEnd(NextDevicePath)) {
- return FALSE;
- }
- if (!IS_DEVICE_PATH_NODE(NextDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP)) {
- return FALSE;
- }
-
- Status = gBS->HandleProtocol (Handle, &gEfiPxeBaseCodeProtocolGuid, (VOID **)&PxeBcProtocol);
- if (EFI_ERROR (Status)) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
diff --git a/ArmPlatformPkg/Contributions.txt b/ArmPlatformPkg/Contributions.txt
deleted file mode 100644
index f87cbd73c6..0000000000
--- a/ArmPlatformPkg/Contributions.txt
+++ /dev/null
@@ -1,218 +0,0 @@
-
-======================
-= Code Contributions =
-======================
-
-To make a contribution to a TianoCore project, follow these steps.
-1. Create a change description in the format specified below to
- use in the source control commit log.
-2. Your commit message must include your "Signed-off-by" signature,
- and "Contributed-under" message.
-3. Your "Contributed-under" message explicitly states that the
- contribution is made under the terms of the specified
- contribution agreement. Your "Contributed-under" message
- must include the name of contribution agreement and version.
- For example: Contributed-under: TianoCore Contribution Agreement 1.0
- The "TianoCore Contribution Agreement" is included below in
- this document.
-4. Submit your code to the TianoCore project using the process
- that the project documents on its web page. If the process is
- not documented, then submit the code on development email list
- for the project.
-5. It is preferred that contributions are submitted using the same
- copyright license as the base project. When that is not possible,
- then contributions using the following licenses can be accepted:
- * BSD (2-clause): http://opensource.org/licenses/BSD-2-Clause
- * BSD (3-clause): http://opensource.org/licenses/BSD-3-Clause
- * MIT: http://opensource.org/licenses/MIT
- * Python-2.0: http://opensource.org/licenses/Python-2.0
- * Zlib: http://opensource.org/licenses/Zlib
-
- Contributions of code put into the public domain can also be
- accepted.
-
- Contributions using other licenses might be accepted, but further
- review will be required.
-
-=====================================================
-= Change Description / Commit Message / Patch Email =
-=====================================================
-
-Your change description should use the standard format for a
-commit message, and must include your "Signed-off-by" signature
-and the "Contributed-under" message.
-
-== Sample Change Description / Commit Message =
-
-=== Start of sample patch email message ===
-
-From: Contributor Name <contributor@example.com>
-Subject: [PATCH] CodeModule: Brief-single-line-summary
-
-Full-commit-message
-
-Contributed-under: TianoCore Contribution Agreement 1.0
-Signed-off-by: Contributor Name <contributor@example.com>
----
-
-An extra message for the patch email which will not be considered part
-of the commit message can be added here.
-
-Patch content inline or attached
-
-=== End of sample patch email message ===
-
-=== Notes for sample patch email ===
-
-* The first line of commit message is taken from the email's subject
- line following [PATCH]. The remaining portion of the commit message
- is the email's content until the '---' line.
-* git format-patch is one way to create this format
-
-=== Definitions for sample patch email ===
-
-* "CodeModule" is a short idenfier for the affected code. For
- example MdePkg, or MdeModulePkg UsbBusDxe.
-* "Brief-single-line-summary" is a short summary of the change.
-* The entire first line should be less than ~70 characters.
-* "Full-commit-message" a verbose multiple line comment describing
- the change. Each line should be less than ~70 characters.
-* "Contributed-under" explicitely states that the contribution is
- made under the terms of the contribtion agreement. This
- agreement is included below in this document.
-* "Signed-off-by" is the contributor's signature identifying them
- by their real/legal name and their email address.
-
-========================================
-= TianoCore Contribution Agreement 1.0 =
-========================================
-
-INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
-INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
-PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
-TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
-REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
-CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
-AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
-USE THE CONTENT.
-
-Unless otherwise indicated, all Content made available on the TianoCore
-site is provided to you under the terms and conditions of the BSD
-License ("BSD"). A copy of the BSD License is available at
-http://opensource.org/licenses/bsd-license.php
-or when applicable, in the associated License.txt file.
-
-Certain other content may be made available under other licenses as
-indicated in or with such Content. (For example, in a License.txt file.)
-
-You accept and agree to the following terms and conditions for Your
-present and future Contributions submitted to TianoCore site. Except
-for the license granted to Intel hereunder, You reserve all right,
-title, and interest in and to Your Contributions.
-
-== SECTION 1: Definitions ==
-* "You" or "Contributor" shall mean the copyright owner or legal
- entity authorized by the copyright owner that is making a
- Contribution hereunder. All other entities that control, are
- controlled by, or are under common control with that entity are
- considered to be a single Contributor. For the purposes of this
- definition, "control" means (i) the power, direct or indirect, to
- cause the direction or management of such entity, whether by
- contract or otherwise, or (ii) ownership of fifty percent (50%)
- or more of the outstanding shares, or (iii) beneficial ownership
- of such entity.
-* "Contribution" shall mean any original work of authorship,
- including any modifications or additions to an existing work,
- that is intentionally submitted by You to the TinaoCore site for
- inclusion in, or documentation of, any of the Content. For the
- purposes of this definition, "submitted" means any form of
- electronic, verbal, or written communication sent to the
- TianoCore site or its representatives, including but not limited
- to communication on electronic mailing lists, source code
- control systems, and issue tracking systems that are managed by,
- or on behalf of, the TianoCore site for the purpose of
- discussing and improving the Content, but excluding
- communication that is conspicuously marked or otherwise
- designated in writing by You as "Not a Contribution."
-
-== SECTION 2: License for Contributions ==
-* Contributor hereby agrees that redistribution and use of the
- Contribution in source and binary forms, with or without
- modification, are permitted provided that the following
- conditions are met:
-** Redistributions of source code must retain the Contributor's
- copyright notice, this list of conditions and the following
- disclaimer.
-** Redistributions in binary form must reproduce the Contributor's
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-* Disclaimer. None of the names of Contributor, Intel, or the names
- of their respective contributors may be used to endorse or
- promote products derived from this software without specific
- prior written permission.
-* Contributor grants a license (with the right to sublicense) under
- claims of Contributor's patents that Contributor can license that
- are infringed by the Contribution (as delivered by Contributor) to
- make, use, distribute, sell, offer for sale, and import the
- Contribution and derivative works thereof solely to the minimum
- extent necessary for licensee to exercise the granted copyright
- license; this patent license applies solely to those portions of
- the Contribution that are unmodified. No hardware per se is
- licensed.
-* EXCEPT AS EXPRESSLY SET FORTH IN SECTION 3 BELOW, THE
- CONTRIBUTION IS PROVIDED BY THE CONTRIBUTOR "AS IS" AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
- CONTRIBUTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
-== SECTION 3: Representations ==
-* You represent that You are legally entitled to grant the above
- license. If your employer(s) has rights to intellectual property
- that You create that includes Your Contributions, You represent
- that You have received permission to make Contributions on behalf
- of that employer, that Your employer has waived such rights for
- Your Contributions.
-* You represent that each of Your Contributions is Your original
- creation (see Section 4 for submissions on behalf of others).
- You represent that Your Contribution submissions include complete
- details of any third-party license or other restriction
- (including, but not limited to, related patents and trademarks)
- of which You are personally aware and which are associated with
- any part of Your Contributions.
-
-== SECTION 4: Third Party Contributions ==
-* Should You wish to submit work that is not Your original creation,
- You may submit it to TianoCore site separately from any
- Contribution, identifying the complete details of its source
- and of any license or other restriction (including, but not
- limited to, related patents, trademarks, and license agreements)
- of which You are personally aware, and conspicuously marking the
- work as "Submitted on behalf of a third-party: [named here]".
-
-== SECTION 5: Miscellaneous ==
-* Applicable Laws. Any claims arising under or relating to this
- Agreement shall be governed by the internal substantive laws of
- the State of Delaware or federal courts located in Delaware,
- without regard to principles of conflict of laws.
-* Language. This Agreement is in the English language only, which
- language shall be controlling in all respects, and all versions
- of this Agreement in any other language shall be for accommodation
- only and shall not be binding. All communications and notices made
- or given pursuant to this Agreement, and all documentation and
- support to be provided, unless otherwise noted, shall be in the
- English language.
-
diff --git a/ArmPlatformPkg/Documentation/ARM-EDK2-Overview.png b/ArmPlatformPkg/Documentation/ARM-EDK2-Overview.png
deleted file mode 100755
index 37cb39475b..0000000000
--- a/ArmPlatformPkg/Documentation/ARM-EDK2-Overview.png
+++ /dev/null
Binary files differ
diff --git a/ArmPlatformPkg/Documentation/ArmPlatformLib-2nd-Stage.png b/ArmPlatformPkg/Documentation/ArmPlatformLib-2nd-Stage.png
deleted file mode 100755
index fbb952c19f..0000000000
--- a/ArmPlatformPkg/Documentation/ArmPlatformLib-2nd-Stage.png
+++ /dev/null
Binary files differ
diff --git a/ArmPlatformPkg/Documentation/ArmPlatformLib-Full-Boot.png b/ArmPlatformPkg/Documentation/ArmPlatformLib-Full-Boot.png
deleted file mode 100755
index d9098aab90..0000000000
--- a/ArmPlatformPkg/Documentation/ArmPlatformLib-Full-Boot.png
+++ /dev/null
Binary files differ
diff --git a/ArmPlatformPkg/Documentation/ArmPlatformPkg.txt b/ArmPlatformPkg/Documentation/ArmPlatformPkg.txt
deleted file mode 100644
index 7a400cc2fb..0000000000
--- a/ArmPlatformPkg/Documentation/ArmPlatformPkg.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Porting UEFI to a ARM platform :
---------------------------------
-1. Create the new platform directory under ArmPlatformPkg
-
-2. Create its DSC and FDF files into this new directory. These files can be copied from ArmVExpress-CTA9x4.dsc and ArmVExpress-CTA9x4.fdf; and adapted following the requirement of your platform.
-
-3. Set up the PCDs required by ArmPlatformPkg in your FDF or DSC files
-
-4. Implement 'ArmPlatformLib' for your platform following the interface defined by ArmPlatformPkg\Include\Library\ArmPlatformLib.h.
-
-
-PCDs Description :
--------------------
-
-# Firmware Device / Volume
-gArmTokenSpaceGuid.PcdSecureFdBaseAddress : Base address of your Secure Firmware Device
-gArmTokenSpaceGuid.PcdSecureFdSize : Size in byte of your Secure Firmware Device.
-gArmTokenSpaceGuid.PcdFdBaseAddress : Base Address of your Non-Secure/Normal World Firmware Device.
-gArmTokenSpaceGuid.PcdFdSize : Size in bytes of your Non-Secure/Normal World Firmware Device
-
-# Stacks
-gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase : Base of Secure Stack for Secure World
-gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize : Size of the stack for the Primary Core in Secure World
-gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize : Size of the stack for the Secondary Cores in Secure World
-gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase : Base of Stack for Monitor World
-gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize : Size of the stack for each cores
-gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase : Base of SEC Stack for Normal World
-gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize : Size of the stack for the Primary Core
-gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize : Size of the stack for the Secondary Core
-
-# CPU / Architectural controllers
-gArmTokenSpaceGuid.PcdGicDistributorBase : Base address of the Distributor of your General Interrupt Controller
-gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase : Base address of the Interface of your General Interrupt Controller
-
-# Memory Regions
-gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize : Size of the region reserve for PI & UEFI
-gArmTokenSpaceGuid.PcdSystemMemoryBase : Base Address of the System Memory (DRAM)
-gArmTokenSpaceGuid.PcdSystemMemorySize : Size of the System Memory (DRAM)
-
-# Features
-gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec : TRUE if System Memory initialized by the SEC phase
-gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores : TRUE if the PrePi or PrePeiCore modules have to send an SGI to resume the excution of the secondary cores
-
-# Boot Manager
-gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription : Description of the Default Boot Entry
-gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath : DevicePath of the Default Boot Entry
-gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument : Argument for the Default Boot Entry
-gArmPlatformTokenSpaceGuid.PcdDefaultBootType : Define the binary type of the Default Boot Entry (0=EFI application, 1=Linux kernel with ATAG support, 2=Linux Kernel with FDT support)
-gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut : Timeout before booting on the Device Boot entry (by default the auto boot is skipped)
-gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths : List of Device Path use for the Console Input
-gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths : List of Device Path use for the Console Output
-
-
-FAQ :
------
-# When to use PrePi or PrePeiCore ?
-- PrePi: when the memory has already been initialized by the first stage boot loader
- Boot sequence: PlatformFirmware/PrePi/Dxe/Bds
- Example: Beagle Board
-
-- PrePeiCore: when the firmware is started from XIP memory and in Secure world. The PeiCore shadows the firmware itself in System Memory (DRAM)
- Boot sequence: Sec/PrePiCore/PeiCore/Dxe/Bds
- Example: ARM Versatile Express
-
-See:
-- ArmPlatformPkg/Documentation/ARM-EDK2-Overview.png
-- ArmPlatformPkg/Documentation/ArmPlatformLib-Full-Boot.png
-- ArmPlatformPkg/Documentation/ArmPlatformLib-2nd-Stage.png
-
-# What is the PcdStandalone
-gArmPlatformTokenSpaceGuid.PcdStandalone=FALSE is used on ARM Development Platforms during the development stage.
-To avoid to reflash the NOR Flash after each build, the SEC (in NOR Flash) intializes thd DRAM and wait until the Normal World firmware is copied into the DRAM.
-Copying the firmware in DRAM is much faster than reflashing the NOR Flash. It is also more convenient to debug the firmware form DRAM than NOR Flash (eg: use of software breakpoint)
-
diff --git a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c b/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c
deleted file mode 100644
index 070c0dcb5d..0000000000
--- a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/IoLib.h>
-
-#include <Drivers/ArmTrustzone.h>
-
-#define TZPC_DECPROT0_STATUS_REG 0x800
-#define TZPC_DECPROT0_SET_REG 0x804
-#define TZPC_DECPROT0_CLEAR_REG 0x808
-
-#define TZASC_CONFIGURATION_REG 0x000
-#define TZASC_REGIONS_REG 0x100
-#define TZASC_REGION0_LOW_ADDRESS_REG 0x100
-#define TZASC_REGION0_HIGH_ADDRESS_REG 0x104
-#define TZASC_REGION0_ATTRIBUTES 0x108
-
-/**
- FIXME: Need documentation
-**/
-EFI_STATUS
-TZPCSetDecProtBits (
- IN UINTN TzpcBase,
- IN UINTN TzpcId,
- IN UINTN Bits
- )
-{
- if (TzpcId > TZPC_DECPROT_MAX) {
- return EFI_INVALID_PARAMETER;
- }
-
- MmioWrite32 ((UINTN)TzpcBase + TZPC_DECPROT0_SET_REG + (TzpcId * 0x0C), Bits);
-
- return EFI_SUCCESS;
-}
-
-/**
- FIXME: Need documentation
-**/
-EFI_STATUS
-TZPCClearDecProtBits (
- IN UINTN TzpcBase,
- IN UINTN TzpcId,
- IN UINTN Bits
- )
-{
- if (TzpcId> TZPC_DECPROT_MAX) {
- return EFI_INVALID_PARAMETER;
- }
-
- MmioWrite32 ((UINTN)TzpcBase + TZPC_DECPROT0_CLEAR_REG + (TzpcId * 0x0C), Bits);
-
- return EFI_SUCCESS;
-}
-
-/**
- FIXME: Need documentation
-**/
-UINT32
-TZASCGetNumRegions (
- IN UINTN TzascBase
- )
-{
- return (MmioRead32 ((UINTN)TzascBase + TZASC_CONFIGURATION_REG) & 0xF);
-}
-
-/**
- FIXME: Need documentation
-**/
-EFI_STATUS
-TZASCSetRegion (
- IN INTN TzascBase,
- IN UINTN RegionId,
- IN UINTN Enabled,
- IN UINTN LowAddress,
- IN UINTN HighAddress,
- IN UINTN Size,
- IN UINTN Security
- )
-{
- UINT32* Region;
-
- if (RegionId > TZASCGetNumRegions(TzascBase)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Region = (UINT32*)((UINTN)TzascBase + TZASC_REGIONS_REG + (RegionId * 0x10));
-
- MmioWrite32((UINTN)(Region), LowAddress&0xFFFF8000);
- MmioWrite32((UINTN)(Region+1), HighAddress);
- MmioWrite32((UINTN)(Region+2), ((Security & 0xF) <<28) | ((Size & 0x3F) << 1) | (Enabled & 0x1));
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf b/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf
deleted file mode 100644
index 6f90589a5b..0000000000
--- a/ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf
+++ /dev/null
@@ -1,33 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmTrustZoneLib
- FILE_GUID = 5962d040-8b8a-11df-9a71-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmTrustZoneLib
-
-
-[Sources.common]
- ArmTrustZone.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- IoLib
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c
deleted file mode 100644
index 9186912dfc..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/** @file Lcd.c
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/LcdPlatformLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-
-#include <Drivers/HdLcd.h>
-
-#include "LcdGraphicsOutputDxe.h"
-
-/**********************************************************************
- *
- * This file contains all the bits of the Lcd that are
- * platform independent.
- *
- **********************************************************************/
-
-EFI_STATUS
-LcdInitialize (
- IN EFI_PHYSICAL_ADDRESS VramBaseAddress
- )
-{
- // Disable the controller
- MmioWrite32(HDLCD_REG_COMMAND, HDLCD_DISABLE);
-
- // Disable all interrupts
- MmioWrite32(HDLCD_REG_INT_MASK, 0);
-
- // Define start of the VRAM. This never changes for any graphics mode
- MmioWrite32(HDLCD_REG_FB_BASE, (UINT32) VramBaseAddress);
-
- // Setup various registers that never change
- MmioWrite32(HDLCD_REG_BUS_OPTIONS, (4 << 8) | HDLCD_BURST_8);
- MmioWrite32(HDLCD_REG_POLARITIES, HDLCD_PXCLK_LOW | HDLCD_DATA_HIGH | HDLCD_DATEN_HIGH | HDLCD_HSYNC_LOW | HDLCD_VSYNC_HIGH);
- MmioWrite32(HDLCD_REG_PIXEL_FORMAT, HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL);
- MmioWrite32(HDLCD_REG_RED_SELECT, (0 << 16 | 8 << 8 | 0));
- MmioWrite32(HDLCD_REG_GREEN_SELECT, (0 << 16 | 8 << 8 | 8));
- MmioWrite32(HDLCD_REG_BLUE_SELECT, (0 << 16 | 8 << 8 | 16));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LcdSetMode (
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status;
- UINT32 HRes;
- UINT32 HSync;
- UINT32 HBackPorch;
- UINT32 HFrontPorch;
- UINT32 VRes;
- UINT32 VSync;
- UINT32 VBackPorch;
- UINT32 VFrontPorch;
- UINT32 BytesPerPixel;
- LCD_BPP LcdBpp;
-
-
- // Set the video mode timings and other relevant information
- Status = LcdPlatformGetTimings (ModeNumber,
- &HRes,&HSync,&HBackPorch,&HFrontPorch,
- &VRes,&VSync,&VBackPorch,&VFrontPorch);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR( Status )) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = LcdPlatformGetBpp (ModeNumber,&LcdBpp);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR( Status )) {
- return EFI_DEVICE_ERROR;
- }
-
- BytesPerPixel = GetBytesPerPixel(LcdBpp);
-
- // Disable the controller
- MmioWrite32(HDLCD_REG_COMMAND, HDLCD_DISABLE);
-
- // Update the frame buffer information with the new settings
- MmioWrite32(HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);
- MmioWrite32(HDLCD_REG_FB_LINE_PITCH, HRes * BytesPerPixel);
- MmioWrite32(HDLCD_REG_FB_LINE_COUNT, VRes - 1);
-
- // Set the vertical timing information
- MmioWrite32(HDLCD_REG_V_SYNC, VSync);
- MmioWrite32(HDLCD_REG_V_BACK_PORCH, VBackPorch);
- MmioWrite32(HDLCD_REG_V_DATA, VRes - 1);
- MmioWrite32(HDLCD_REG_V_FRONT_PORCH, VFrontPorch);
-
- // Set the horizontal timing information
- MmioWrite32(HDLCD_REG_H_SYNC, HSync);
- MmioWrite32(HDLCD_REG_H_BACK_PORCH, HBackPorch);
- MmioWrite32(HDLCD_REG_H_DATA, HRes - 1);
- MmioWrite32(HDLCD_REG_H_FRONT_PORCH, HFrontPorch);
-
- // Enable the controller
- MmioWrite32(HDLCD_REG_COMMAND, HDLCD_ENABLE);
-
- return EFI_SUCCESS;
-}
-
-VOID
-LcdShutdown (
- VOID
- )
-{
- // Disable the controller
- MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);
-}
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
deleted file mode 100644
index 462d1fa402..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf
+++ /dev/null
@@ -1,63 +0,0 @@
-#/** @file
-#
-# Component description file for HDLCD module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = HdLcdGraphicsDxe
- FILE_GUID = ce660500-824d-11e0-ac72-0002a5d5c51b
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = LcdGraphicsOutputDxeInitialize
-
-[Sources.common]
- LcdGraphicsOutputDxe.c
- LcdGraphicsOutputBlt.c
- HdLcd.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- UefiLib
- BaseLib
- DebugLib
- TimerLib
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- IoLib
- BaseMemoryLib
- LcdPlatformLib
-
-[Protocols]
- gEfiDevicePathProtocolGuid
- gEfiGraphicsOutputProtocolGuid # Produced
- gEfiEdidDiscoveredProtocolGuid # Produced
- gEfiEdidActiveProtocolGuid # Produced
- gEfiEdidOverrideProtocolGuid # Produced
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices
-
-[Depex]
- gEfiCpuArchProtocolGuid
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c
deleted file mode 100644
index 77f93cbb67..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#include <PiDxe.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Guid/GlobalVariable.h>
-
-#include "LcdGraphicsOutputDxe.h"
-
-extern BOOLEAN mDisplayInitialized;
-
-//
-// Function Definitions
-//
-
-STATIC
-EFI_STATUS
-VideoCopyNoHorizontalOverlap (
- IN UINTN BitsPerPixel,
- IN volatile VOID *FrameBufferBase,
- IN UINT32 HorizontalResolution,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height
-)
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINTN SourceLine;
- UINTN DestinationLine;
- UINTN WidthInBytes;
- UINTN LineCount;
- INTN Step;
- VOID *SourceAddr;
- VOID *DestinationAddr;
-
- if( DestinationY <= SourceY ) {
- // scrolling up (or horizontally but without overlap)
- SourceLine = SourceY;
- DestinationLine = DestinationY;
- Step = 1;
- } else {
- // scrolling down
- SourceLine = SourceY + Height;
- DestinationLine = DestinationY + Height;
- Step = -1;
- }
-
- switch (BitsPerPixel) {
-
- case LCD_BITS_PER_PIXEL_24:
-
- WidthInBytes = Width * 4;
-
- for( LineCount = 0; LineCount < Height; LineCount++ ) {
- // Update the start addresses of source & destination using 32bit pointer arithmetic
- SourceAddr = (VOID *)((UINT32 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX );
- DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);
-
- // Copy the entire line Y from video ram to the temp buffer
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);
-
- // Update the line numbers
- SourceLine += Step;
- DestinationLine += Step;
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_555:
- case LCD_BITS_PER_PIXEL_16_565:
- case LCD_BITS_PER_PIXEL_12_444:
-
- WidthInBytes = Width * 2;
-
- for( LineCount = 0; LineCount < Height; LineCount++ ) {
- // Update the start addresses of source & destination using 16bit pointer arithmetic
- SourceAddr = (VOID *)((UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX );
- DestinationAddr = (VOID *)((UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);
-
- // Copy the entire line Y from video ram to the temp buffer
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);
-
- // Update the line numbers
- SourceLine += Step;
- DestinationLine += Step;
- }
- break;
-
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // Can't handle this case
- DEBUG((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- // break;
-
- }
-
- EXIT:
- return Status;
-}
-
-STATIC
-EFI_STATUS
-VideoCopyHorizontalOverlap (
- IN UINTN BitsPerPixel,
- IN volatile VOID *FrameBufferBase,
- UINT32 HorizontalResolution,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height
-)
-{
- EFI_STATUS Status = EFI_SUCCESS;
-
- UINT32 *PixelBuffer32bit;
- UINT32 *SourcePixel32bit;
- UINT32 *DestinationPixel32bit;
-
- UINT16 *PixelBuffer16bit;
- UINT16 *SourcePixel16bit;
- UINT16 *DestinationPixel16bit;
-
- UINT32 SourcePixelY;
- UINT32 DestinationPixelY;
- UINTN SizeIn32Bits;
- UINTN SizeIn16Bits;
-
- switch (BitsPerPixel) {
-
- case LCD_BITS_PER_PIXEL_24:
- // Allocate a temporary buffer
-
- PixelBuffer32bit = (UINT32 *) AllocatePool((Height * Width) * sizeof(UINT32));
-
- if (PixelBuffer32bit == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
-
- SizeIn32Bits = Width * 4;
-
- // Copy from the video ram (source region) to a temp buffer
- for (SourcePixelY = SourceY, DestinationPixel32bit = PixelBuffer32bit;
- SourcePixelY < SourceY + Height;
- SourcePixelY++, DestinationPixel32bit += Width)
- {
- // Update the start address of line Y (source)
- SourcePixel32bit = (UINT32 *)FrameBufferBase + SourcePixelY * HorizontalResolution + SourceX;
-
- // Copy the entire line Y from video ram to the temp buffer
- CopyMem( (VOID *)DestinationPixel32bit, (CONST VOID *)SourcePixel32bit, SizeIn32Bits);
- }
-
- // Copy from the temp buffer to the video ram (destination region)
- for (DestinationPixelY = DestinationY, SourcePixel32bit = PixelBuffer32bit;
- DestinationPixelY < DestinationY + Height;
- DestinationPixelY++, SourcePixel32bit += Width)
- {
- // Update the start address of line Y (target)
- DestinationPixel32bit = (UINT32 *)FrameBufferBase + DestinationPixelY * HorizontalResolution + DestinationX;
-
- // Copy the entire line Y from the temp buffer to video ram
- CopyMem( (VOID *)DestinationPixel32bit, (CONST VOID *)SourcePixel32bit, SizeIn32Bits);
- }
-
- // Free up the allocated memory
- FreePool((VOID *) PixelBuffer32bit);
-
- break;
-
-
- case LCD_BITS_PER_PIXEL_16_555:
- case LCD_BITS_PER_PIXEL_16_565:
- case LCD_BITS_PER_PIXEL_12_444:
- // Allocate a temporary buffer
- PixelBuffer16bit = (UINT16 *) AllocatePool((Height * Width) * sizeof(UINT16));
-
- if (PixelBuffer16bit == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
-
- // Access each pixel inside the source area of the Video Memory and copy it to the temp buffer
-
- SizeIn16Bits = Width * 2;
-
- for (SourcePixelY = SourceY, DestinationPixel16bit = PixelBuffer16bit;
- SourcePixelY < SourceY + Height;
- SourcePixelY++, DestinationPixel16bit += Width)
- {
- // Calculate the source address:
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourcePixelY * HorizontalResolution + SourceX;
-
- // Copy the entire line Y from Video to the temp buffer
- CopyMem( (VOID *)DestinationPixel16bit, (CONST VOID *)SourcePixel16bit, SizeIn16Bits);
- }
-
- // Copy from the temp buffer into the destination area of the Video Memory
-
- for (DestinationPixelY = DestinationY, SourcePixel16bit = PixelBuffer16bit;
- DestinationPixelY < DestinationY + Height;
- DestinationPixelY++, SourcePixel16bit += Width)
- {
- // Calculate the target address:
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + (DestinationPixelY * HorizontalResolution + DestinationX);
-
- // Copy the entire line Y from the temp buffer to Video
- CopyMem( (VOID *)DestinationPixel16bit, (CONST VOID *)SourcePixel16bit, SizeIn16Bits);
- }
-
- // Free the allocated memory
- FreePool((VOID *) PixelBuffer16bit);
-
- break;
-
-
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // Can't handle this case
- DEBUG((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- // break;
-
- }
-
-EXIT:
- return Status;
-}
-
-STATIC
-EFI_STATUS
-BltVideoFill (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel, OPTIONAL
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer
- )
-{
- EFI_PIXEL_BITMASK* PixelInformation;
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- LCD_BPP BitsPerPixel;
- VOID *FrameBufferBase;
- VOID *DestinationAddr;
- UINT16 *DestinationPixel16bit;
- UINT16 Pixel16bit;
- UINT32 DestinationPixelX;
- UINT32 DestinationLine;
- UINTN WidthInBytes;
-
- Status = EFI_SUCCESS;
- PixelInformation = &This->Mode->Info->PixelInformation;
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));
- HorizontalResolution = This->Mode->Info->HorizontalResolution;
-
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
-
- switch (BitsPerPixel) {
- case LCD_BITS_PER_PIXEL_24:
- WidthInBytes = Width * 4;
-
- // Copy the SourcePixel into every pixel inside the target rectangle
- for (DestinationLine = DestinationY;
- DestinationLine < DestinationY + Height;
- DestinationLine++)
- {
- // Calculate the target address using 32bit pointer arithmetic:
- DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);
-
- // Fill the entire line
- SetMem32 (DestinationAddr, WidthInBytes, *((UINT32 *)EfiSourcePixel));
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_555:
- // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel
- Pixel16bit = (UINT16) (
- ( (EfiSourcePixel->Red << 7) & PixelInformation->RedMask )
- | ( (EfiSourcePixel->Green << 2) & PixelInformation->GreenMask )
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )
-// | ( 0 & PixelInformation->ReservedMask )
- );
-
- // Copy the SourcePixel into every pixel inside the target rectangle
- for (DestinationLine = DestinationY;
- DestinationLine < DestinationY + Height;
- DestinationLine++)
- {
- for (DestinationPixelX = DestinationX;
- DestinationPixelX < DestinationX + Width;
- DestinationPixelX++)
- {
- // Calculate the target address:
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;
-
- // Copy the pixel into the new target
- *DestinationPixel16bit = Pixel16bit;
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_565:
- // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel
- Pixel16bit = (UINT16) (
- ( (EfiSourcePixel->Red << 8) & PixelInformation->RedMask )
- | ( (EfiSourcePixel->Green << 3) & PixelInformation->GreenMask )
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )
- );
-
- // Copy the SourcePixel into every pixel inside the target rectangle
- for (DestinationLine = DestinationY;
- DestinationLine < DestinationY + Height;
- DestinationLine++)
- {
- for (DestinationPixelX = DestinationX;
- DestinationPixelX < DestinationX + Width;
- DestinationPixelX++)
- {
- // Calculate the target address:
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;
-
- // Copy the pixel into the new target
- *DestinationPixel16bit = Pixel16bit;
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_12_444:
- // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel
- Pixel16bit = (UINT16) (
- ( (EfiSourcePixel->Red >> 4) & PixelInformation->RedMask )
- | ( (EfiSourcePixel->Green ) & PixelInformation->GreenMask )
- | ( (EfiSourcePixel->Blue << 4) & PixelInformation->BlueMask )
- );
-
- // Copy the SourcePixel into every pixel inside the target rectangle
- for (DestinationLine = DestinationY;
- DestinationLine < DestinationY + Height;
- DestinationLine++)
- {
- for (DestinationPixelX = DestinationX;
- DestinationPixelX < DestinationX + Width;
- DestinationPixelX++)
- {
- // Calculate the target address:
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;
-
- // Copy the pixel into the new target
- *DestinationPixel16bit = Pixel16bit;
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // Can't handle this case
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoFill: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
- Status = EFI_INVALID_PARAMETER;
- break;
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-BltVideoToBltBuffer (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer
- )
-{
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- LCD_BPP BitsPerPixel;
- EFI_PIXEL_BITMASK *PixelInformation;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiDestinationPixel;
- VOID *FrameBufferBase;
- VOID *SourceAddr;
- VOID *DestinationAddr;
- UINT16 *SourcePixel16bit;
- UINT16 Pixel16bit;
- UINT32 SourcePixelX;
- UINT32 SourceLine;
- UINT32 DestinationPixelX;
- UINT32 DestinationLine;
- UINT32 BltBufferHorizontalResolution;
- UINTN WidthInBytes;
-
- Status = EFI_SUCCESS;
- PixelInformation = &This->Mode->Info->PixelInformation;
- HorizontalResolution = This->Mode->Info->HorizontalResolution;
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));
-
- if(( Delta != 0 ) && ( Delta != Width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
- // Delta is not zero and it is different from the width.
- // Divide it by the size of a pixel to find out the buffer's horizontal resolution.
- BltBufferHorizontalResolution = (UINT32) (Delta / sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- } else {
- BltBufferHorizontalResolution = Width;
- }
-
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
-
- switch (BitsPerPixel) {
- case LCD_BITS_PER_PIXEL_24:
- WidthInBytes = Width * 4;
-
- // Access each line inside the Video Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++)
- {
- // Calculate the source and target addresses using 32bit pointer arithmetic:
- SourceAddr = (VOID *)((UINT32 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX );
- DestinationAddr = (VOID *)((UINT32 *)BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationX);
-
- // Copy the entire line
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_555:
- // Access each pixel inside the Video Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++)
- {
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;
- SourcePixelX < SourceX + Width;
- SourcePixelX++, DestinationPixelX++)
- {
- // Calculate the source and target addresses:
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;
- EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;
-
- // Snapshot the pixel from the video buffer once, to speed up the operation.
- // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.
- Pixel16bit = *SourcePixel16bit;
-
- // Copy the pixel into the new target
- EfiDestinationPixel->Red = (UINT8) ( (Pixel16bit & PixelInformation->RedMask ) >> 7 );
- EfiDestinationPixel->Green = (UINT8) ( (Pixel16bit & PixelInformation->GreenMask ) >> 2);
- EfiDestinationPixel->Blue = (UINT8) ( (Pixel16bit & PixelInformation->BlueMask ) << 3 );
- // EfiDestinationPixel->Reserved = (UINT8) 0;
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_565:
- // Access each pixel inside the Video Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++)
- {
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;
- SourcePixelX < SourceX + Width;
- SourcePixelX++, DestinationPixelX++)
- {
- // Calculate the source and target addresses:
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;
- EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;
-
- // Snapshot the pixel from the video buffer once, to speed up the operation.
- // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.
- Pixel16bit = *SourcePixel16bit;
-
- // Copy the pixel into the new target
- // There is no info for the Reserved byte, so we set it to zero
- EfiDestinationPixel->Red = (UINT8) ( (Pixel16bit & PixelInformation->RedMask ) >> 8 );
- EfiDestinationPixel->Green = (UINT8) ( (Pixel16bit & PixelInformation->GreenMask ) >> 3);
- EfiDestinationPixel->Blue = (UINT8) ( (Pixel16bit & PixelInformation->BlueMask ) << 3 );
- // EfiDestinationPixel->Reserved = (UINT8) 0;
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_12_444:
- // Access each pixel inside the Video Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++)
- {
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;
- SourcePixelX < SourceX + Width;
- SourcePixelX++, DestinationPixelX++)
- {
- // Calculate the source and target addresses:
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;
- EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;
-
- // Snapshot the pixel from the video buffer once, to speed up the operation.
- // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.
- Pixel16bit = *SourcePixel16bit;
-
- // Copy the pixel into the new target
- EfiDestinationPixel->Red = (UINT8) ( (Pixel16bit & PixelInformation->RedMask ) >> 4 );
- EfiDestinationPixel->Green = (UINT8) ( (Pixel16bit & PixelInformation->GreenMask ) );
- EfiDestinationPixel->Blue = (UINT8) ( (Pixel16bit & PixelInformation->BlueMask ) << 4 );
- // EfiDestinationPixel->Reserved = (UINT8) 0;
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // Can't handle this case
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoToBltBuffer: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
- Status = EFI_INVALID_PARAMETER;
- break;
- }
- return Status;
-}
-
-STATIC
-EFI_STATUS
-BltBufferToVideo (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer
- )
-{
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- LCD_BPP BitsPerPixel;
- EFI_PIXEL_BITMASK *PixelInformation;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel;
- VOID *FrameBufferBase;
- VOID *SourceAddr;
- VOID *DestinationAddr;
- UINT16 *DestinationPixel16bit;
- UINT32 SourcePixelX;
- UINT32 SourceLine;
- UINT32 DestinationPixelX;
- UINT32 DestinationLine;
- UINT32 BltBufferHorizontalResolution;
- UINTN WidthInBytes;
-
- Status = EFI_SUCCESS;
- PixelInformation = &This->Mode->Info->PixelInformation;
- HorizontalResolution = This->Mode->Info->HorizontalResolution;
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));
-
- if(( Delta != 0 ) && ( Delta != Width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
- // Delta is not zero and it is different from the width.
- // Divide it by the size of a pixel to find out the buffer's horizontal resolution.
- BltBufferHorizontalResolution = (UINT32) (Delta / sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- } else {
- BltBufferHorizontalResolution = Width;
- }
-
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
-
- switch (BitsPerPixel) {
- case LCD_BITS_PER_PIXEL_24:
- WidthInBytes = Width * 4;
-
- // Access each pixel inside the BltBuffer Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++)
- {
- // Calculate the source and target addresses using 32bit pointer arithmetic:
- SourceAddr = (VOID *)((UINT32 *)BltBuffer + SourceLine * BltBufferHorizontalResolution + SourceX );
- DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);
-
- // Copy the entire row Y
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_555:
- // Access each pixel inside the BltBuffer Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++) {
-
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;
- SourcePixelX < SourceX + Width;
- SourcePixelX++, DestinationPixelX++)
- {
- // Calculate the source and target addresses:
- EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;
-
- // Copy the pixel into the new target
- // Only the most significant bits will be copied across:
- // To convert from 8 bits to 5 bits per pixel we throw away the 3 least significant bits
- *DestinationPixel16bit = (UINT16) (
- ( (EfiSourcePixel->Red << 7) & PixelInformation->RedMask )
- | ( (EfiSourcePixel->Green << 2) & PixelInformation->GreenMask )
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )
- // | ( 0 & PixelInformation->ReservedMask )
- );
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_16_565:
- // Access each pixel inside the BltBuffer Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++) {
-
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;
- SourcePixelX < SourceX + Width;
- SourcePixelX++, DestinationPixelX++)
- {
- // Calculate the source and target addresses:
- EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;
-
- // Copy the pixel into the new target
- // Only the most significant bits will be copied across:
- // To convert from 8 bits to 5 or 6 bits per pixel we throw away the 3 or 2 least significant bits
- // There is no room for the Reserved byte so we ignore that completely
- *DestinationPixel16bit = (UINT16) (
- ( (EfiSourcePixel->Red << 8) & PixelInformation->RedMask )
- | ( (EfiSourcePixel->Green << 3) & PixelInformation->GreenMask )
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )
- );
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_12_444:
- // Access each pixel inside the BltBuffer Memory
- for (SourceLine = SourceY, DestinationLine = DestinationY;
- SourceLine < SourceY + Height;
- SourceLine++, DestinationLine++) {
-
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;
- SourcePixelX < SourceX + Width;
- SourcePixelX++, DestinationPixelX++)
- {
- // Calculate the source and target addresses:
- EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;
-
- // Copy the pixel into the new target
- // Only the most significant bits will be copied across:
- // To convert from 8 bits to 5 bits per pixel we throw away the 3 least significant bits
- *DestinationPixel16bit = (UINT16) (
- ( (EfiSourcePixel->Red << 4) & PixelInformation->RedMask )
- | ( (EfiSourcePixel->Green ) & PixelInformation->GreenMask )
- | ( (EfiSourcePixel->Blue >> 4) & PixelInformation->BlueMask )
- // | ( 0 & PixelInformation->ReservedMask )
- );
- }
- }
- break;
-
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- default:
- // Can't handle this case
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltBufferToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
- Status = EFI_INVALID_PARAMETER;
- break;
- }
- return Status;
-}
-
-STATIC
-EFI_STATUS
-BltVideoToVideo (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer
- )
-{
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- LCD_BPP BitsPerPixel;
- VOID *FrameBufferBase;
-
- HorizontalResolution = This->Mode->Info->HorizontalResolution;
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));
-
- //
- // BltVideo to BltVideo:
- //
- // Source is the Video Memory,
- // Destination is the Video Memory
-
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));
-
- // The UEFI spec currently states:
- // "There is no limitation on the overlapping of the source and destination rectangles"
- // Therefore, we must be careful to avoid overwriting the source data
- if( SourceY == DestinationY ) {
- // Copying within the same height, e.g. horizontal shift
- if( SourceX == DestinationX ) {
- // Nothing to do
- Status = EFI_SUCCESS;
- } else if( ((SourceX>DestinationX)?(SourceX - DestinationX):(DestinationX - SourceX)) < Width ) {
- // There is overlap
- Status = VideoCopyHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height );
- } else {
- // No overlap
- Status = VideoCopyNoHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height );
- }
- } else {
- // Copying from different heights
- Status = VideoCopyNoHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height );
- }
-
- return Status;
-}
-
-/***************************************
- * GraphicsOutput Protocol function, mapping to
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.Blt
- *
- * PRESUMES: 1 pixel = 4 bytes (32bits)
- * ***************************************/
-EFI_STATUS
-EFIAPI
-LcdGraphicsBlt (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer
- )
-{
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- LCD_INSTANCE* Instance;
-
- Instance = LCD_INSTANCE_FROM_GOP_THIS(This);
-
- // Setup the hardware if not already done
- if (!mDisplayInitialized) {
- Status = InitializeDisplay (Instance);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
-
- HorizontalResolution = This->Mode->Info->HorizontalResolution;
- VerticalResolution = This->Mode->Info->VerticalResolution;
-
- DEBUG((DEBUG_INFO, "LcdGraphicsBlt (BltOperation:%d,DestX:%d,DestY:%d,Width:%d,Height:%d) res(%d,%d)\n",
- BltOperation,DestinationX,DestinationY,Width,Height,HorizontalResolution,VerticalResolution));
-
- // Check we have reasonable parameters
- if (Width == 0 || Height == 0) {
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: ERROR - Invalid dimension: Zero size area.\n" ));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- if ((BltOperation == EfiBltVideoFill) || (BltOperation == EfiBltBufferToVideo) || (BltOperation == EfiBltVideoToBltBuffer)) {
- ASSERT( BltBuffer != NULL);
- }
-
- /*if ((DestinationX >= HorizontalResolution) || (DestinationY >= VerticalResolution)) {
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: ERROR - Invalid destination.\n" ));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }*/
-
- // If we are reading data out of the video buffer, check that the source area is within the display limits
- if ((BltOperation == EfiBltVideoToBltBuffer) || (BltOperation == EfiBltVideoToVideo)) {
- if ((SourceY + Height > VerticalResolution) || (SourceX + Width > HorizontalResolution)) {
- DEBUG((DEBUG_INFO, "LcdGraphicsBlt: ERROR - Invalid source resolution.\n" ));
- DEBUG((DEBUG_INFO, " - SourceY=%d + Height=%d > VerticalResolution=%d.\n", SourceY, Height, VerticalResolution ));
- DEBUG((DEBUG_INFO, " - SourceX=%d + Width=%d > HorizontalResolution=%d.\n", SourceX, Width, HorizontalResolution ));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- }
-
- // If we are writing data into the video buffer, that the destination area is within the display limits
- if ((BltOperation == EfiBltVideoFill) || (BltOperation == EfiBltBufferToVideo) || (BltOperation == EfiBltVideoToVideo)) {
- if ((DestinationY + Height > VerticalResolution) || (DestinationX + Width > HorizontalResolution)) {
- DEBUG((DEBUG_INFO, "LcdGraphicsBlt: ERROR - Invalid destination resolution.\n" ));
- DEBUG((DEBUG_INFO, " - DestinationY=%d + Height=%d > VerticalResolution=%d.\n", DestinationY, Height, VerticalResolution ));
- DEBUG((DEBUG_INFO, " - DestinationX=%d + Width=%d > HorizontalResolution=%d.\n", DestinationX, Width, HorizontalResolution ));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- }
-
- //
- // Perform the Block Transfer Operation
- //
-
- switch (BltOperation) {
- case EfiBltVideoFill:
- Status = BltVideoFill (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);
- break;
-
- case EfiBltVideoToBltBuffer:
- Status = BltVideoToBltBuffer (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);
- break;
-
- case EfiBltBufferToVideo:
- Status = BltBufferToVideo (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);
- break;
-
- case EfiBltVideoToVideo:
- Status = BltVideoToVideo (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);
- break;
-
- case EfiGraphicsOutputBltOperationMax:
- default:
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: Invalid Operation\n"));
- Status = EFI_INVALID_PARAMETER;
- break;
- }
-
-EXIT:
- return Status;
-}
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
deleted file mode 100644
index b721061fc1..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#include <PiDxe.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Guid/GlobalVariable.h>
-
-#include "LcdGraphicsOutputDxe.h"
-
-/**********************************************************************
- *
- * This file implements the Graphics Output protocol on ArmVersatileExpress
- * using the Lcd controller
- *
- **********************************************************************/
-
-//
-// Global variables
-//
-
-BOOLEAN mDisplayInitialized = FALSE;
-
-LCD_INSTANCE mLcdTemplate = {
- LCD_INSTANCE_SIGNATURE,
- NULL, // Handle
- { // ModeInfo
- 0, // Version
- 0, // HorizontalResolution
- 0, // VerticalResolution
- PixelBltOnly, // PixelFormat
- { 0 }, // PixelInformation
- 0, // PixelsPerScanLine
- },
- {
- 0, // MaxMode;
- 0, // Mode;
- NULL, // Info;
- 0, // SizeOfInfo;
- 0, // FrameBufferBase;
- 0 // FrameBufferSize;
- },
- { // Gop
- LcdGraphicsQueryMode, // QueryMode
- LcdGraphicsSetMode, // SetMode
- LcdGraphicsBlt, // Blt
- NULL // *Mode
- },
- { // DevicePath
- {
- {
- HARDWARE_DEVICE_PATH, HW_VENDOR_DP,
- { (UINT8) (sizeof(VENDOR_DEVICE_PATH)), (UINT8) ((sizeof(VENDOR_DEVICE_PATH)) >> 8) },
- },
- // Hardware Device Path for Lcd
- EFI_CALLER_ID_GUID // Use the driver's GUID
- },
-
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { sizeof(EFI_DEVICE_PATH_PROTOCOL), 0 }
- }
- },
- (EFI_EVENT) NULL // ExitBootServicesEvent
-};
-
-EFI_STATUS
-LcdInstanceContructor (
- OUT LCD_INSTANCE** NewInstance
- )
-{
- LCD_INSTANCE* Instance;
-
- Instance = AllocateCopyPool (sizeof(LCD_INSTANCE), &mLcdTemplate);
- if (Instance == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Instance->Gop.Mode = &Instance->Mode;
- Instance->Gop.Mode->MaxMode = LcdPlatformGetMaxMode ();
- Instance->Mode.Info = &Instance->ModeInfo;
-
- *NewInstance = Instance;
- return EFI_SUCCESS;
-}
-
-//
-// Function Definitions
-//
-
-EFI_STATUS
-InitializeDisplay (
- IN LCD_INSTANCE* Instance
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- EFI_PHYSICAL_ADDRESS VramBaseAddress;
- UINTN VramSize;
-
- Status = LcdPlatformGetVram (&VramBaseAddress, &VramSize);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- // Setup the LCD
- Status = LcdInitialize (VramBaseAddress);
- if (EFI_ERROR(Status)) {
- goto EXIT_ERROR_LCD_SHUTDOWN;
- }
-
- Status = LcdPlatformInitializeDisplay (Instance->Handle);
- if (EFI_ERROR(Status)) {
- goto EXIT_ERROR_LCD_SHUTDOWN;
- }
-
- // Setup all the relevant mode information
- Instance->Gop.Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- Instance->Gop.Mode->FrameBufferBase = VramBaseAddress;
-
- // Set the flag before changing the mode, to avoid infinite loops
- mDisplayInitialized = TRUE;
-
- // All is ok, so don't deal with any errors
- goto EXIT;
-
-EXIT_ERROR_LCD_SHUTDOWN:
- DEBUG((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the display. Exit Status=%r\n", Status));
- LcdShutdown ();
-
-EXIT:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-LcdGraphicsOutputDxeInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- LCD_INSTANCE* Instance;
-
- Status = LcdIdentify ();
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
-
- Status = LcdInstanceContructor (&Instance);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
-
- // Install the Graphics Output Protocol and the Device Path
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Instance->Handle,
- &gEfiGraphicsOutputProtocolGuid, &Instance->Gop,
- &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
- NULL
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the protocol. Exit Status=%r\n", Status));
- goto EXIT;
- }
-
- // Register for an ExitBootServicesEvent
- // When ExitBootServices starts, this function here will make sure that the graphics driver will shut down properly,
- // i.e. it will free up all allocated memory and perform any necessary hardware re-configuration.
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- LcdGraphicsExitBootServicesEvent, NULL,
- &Instance->ExitBootServicesEvent
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the ExitBootServicesEvent handler. Exit Status=%r\n", Status));
- goto EXIT_ERROR_UNINSTALL_PROTOCOL;
- }
-
- // To get here, everything must be fine, so just exit
- goto EXIT;
-
-EXIT_ERROR_UNINSTALL_PROTOCOL:
- /* The following function could return an error message,
- * however, to get here something must have gone wrong already,
- * so preserve the original error, i.e. don't change
- * the Status variable, even it fails to uninstall the protocol.
- */
- gBS->UninstallMultipleProtocolInterfaces (
- Instance->Handle,
- &gEfiGraphicsOutputProtocolGuid, &Instance->Gop, // Uninstall Graphics Output protocol
- &gEfiDevicePathProtocolGuid, &Instance->DevicePath, // Uninstall device path
- NULL
- );
-
-EXIT:
- return Status;
-
-}
-
-/***************************************
- * This function should be called
- * on Event: ExitBootServices
- * to free up memory, stop the driver
- * and uninstall the protocols
- ***************************************/
-VOID
-LcdGraphicsExitBootServicesEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- // By default, this PCD is FALSE. But if a platform starts a predefined OS that
- // does not use a framebuffer then we might want to disable the display controller
- // to avoid to display corrupted information on the screen.
- if (FeaturePcdGet (PcdGopDisableOnExitBootServices)) {
- // Turn-off the Display controller
- LcdShutdown ();
- }
-}
-
-/***************************************
- * GraphicsOutput Protocol function, mapping to
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode
- ***************************************/
-EFI_STATUS
-EFIAPI
-LcdGraphicsQueryMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber,
- OUT UINTN *SizeOfInfo,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- LCD_INSTANCE *Instance;
-
- Instance = LCD_INSTANCE_FROM_GOP_THIS(This);
-
- // Setup the hardware if not already done
- if( !mDisplayInitialized ) {
- Status = InitializeDisplay(Instance);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
-
- // Error checking
- if ( (This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode) ) {
- DEBUG((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode number %d : Invalid Parameter.\n", ModeNumber ));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
- if (*Info == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
-
- *SizeOfInfo = sizeof( EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
-
- Status = LcdPlatformQueryMode (ModeNumber,*Info);
- if (EFI_ERROR(Status)) {
- FreePool(*Info);
- }
-
-EXIT:
- return Status;
-}
-
-/***************************************
- * GraphicsOutput Protocol function, mapping to
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode
- ***************************************/
-EFI_STATUS
-EFIAPI
-LcdGraphicsSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL FillColour;
- LCD_INSTANCE* Instance;
- LCD_BPP Bpp;
-
- Instance = LCD_INSTANCE_FROM_GOP_THIS (This);
-
- // Setup the hardware if not already done
- if(!mDisplayInitialized) {
- Status = InitializeDisplay (Instance);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
-
- // Check if this mode is supported
- if( ModeNumber >= This->Mode->MaxMode ) {
- DEBUG((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported mode number %d .\n", ModeNumber ));
- Status = EFI_UNSUPPORTED;
- goto EXIT;
- }
-
- // Set the oscillator frequency to support the new mode
- Status = LcdPlatformSetMode (ModeNumber);
- if (EFI_ERROR(Status)) {
- Status = EFI_DEVICE_ERROR;
- goto EXIT;
- }
-
- // Update the UEFI mode information
- This->Mode->Mode = ModeNumber;
- LcdPlatformQueryMode (ModeNumber,&Instance->ModeInfo);
- Status = LcdPlatformGetBpp(ModeNumber, &Bpp);
- if (EFI_ERROR(Status)) {
- DEBUG ((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Couldn't get bytes per pixel, status: %r\n", Status));
- goto EXIT;
- }
- This->Mode->FrameBufferSize = Instance->ModeInfo.VerticalResolution
- * Instance->ModeInfo.PixelsPerScanLine
- * GetBytesPerPixel(Bpp);
-
- // Set the hardware to the new mode
- Status = LcdSetMode (ModeNumber);
- if (EFI_ERROR(Status)) {
- Status = EFI_DEVICE_ERROR;
- goto EXIT;
- }
-
- // The UEFI spec requires that we now clear the visible portions of the output display to black.
-
- // Set the fill colour to black
- SetMem (&FillColour, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
- // Fill the entire visible area with the same colour.
- Status = This->Blt (
- This,
- &FillColour,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- This->Mode->Info->HorizontalResolution,
- This->Mode->Info->VerticalResolution,
- 0);
-
-EXIT:
- return Status;
-}
-
-UINTN
-GetBytesPerPixel (
- IN LCD_BPP Bpp
- )
-{
- switch(Bpp) {
- case LCD_BITS_PER_PIXEL_24:
- return 4;
-
- case LCD_BITS_PER_PIXEL_16_565:
- case LCD_BITS_PER_PIXEL_16_555:
- case LCD_BITS_PER_PIXEL_12_444:
- return 2;
-
- case LCD_BITS_PER_PIXEL_8:
- case LCD_BITS_PER_PIXEL_4:
- case LCD_BITS_PER_PIXEL_2:
- case LCD_BITS_PER_PIXEL_1:
- return 1;
-
- default:
- return 0;
- }
-}
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
deleted file mode 100644
index 8856b79901..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/** @file
-
- Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __ARM_VE_GRAPHICS_DXE_H__
-#define __ARM_VE_GRAPHICS_DXE_H__
-
-
-#include <Base.h>
-
-#include <Library/DebugLib.h>
-#include <Library/LcdPlatformLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiLib.h>
-
-#include <Protocol/DevicePath.h>
-
-
-//
-// Device structures
-//
-typedef struct {
- VENDOR_DEVICE_PATH Guid;
- EFI_DEVICE_PATH_PROTOCOL End;
-} LCD_GRAPHICS_DEVICE_PATH;
-
-typedef struct {
- UINT32 Signature;
- EFI_HANDLE Handle;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo;
- EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE Mode;
- EFI_GRAPHICS_OUTPUT_PROTOCOL Gop;
- LCD_GRAPHICS_DEVICE_PATH DevicePath;
- EFI_EVENT ExitBootServicesEvent;
-} LCD_INSTANCE;
-
-#define LCD_INSTANCE_SIGNATURE SIGNATURE_32('l', 'c', 'd', '0')
-
-#define LCD_INSTANCE_FROM_GOP_THIS(a) CR (a, LCD_INSTANCE, Gop, LCD_INSTANCE_SIGNATURE)
-
-//
-// Function Prototypes
-//
-
-VOID
-LcdGraphicsExitBootServicesEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
-);
-
-EFI_STATUS
-EFIAPI
-LcdGraphicsQueryMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber,
- OUT UINTN *SizeOfInfo,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
-);
-
-EFI_STATUS
-EFIAPI
-LcdGraphicsSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber
-);
-
-EFI_STATUS
-EFIAPI
-LcdGraphicsBlt (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
-);
-
-UINTN
-GetBytesPerPixel (
- IN LCD_BPP Bpp
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsOutputDxeInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
-);
-
-EFI_STATUS
-InitializeDisplay (
- IN LCD_INSTANCE* Instance
-);
-
-EFI_STATUS
-LcdIdentify (
- VOID
-);
-
-EFI_STATUS
-LcdInitialize (
- EFI_PHYSICAL_ADDRESS VramBaseAddress
-);
-
-EFI_STATUS
-LcdSetMode (
- IN UINT32 ModeNumber
-);
-
-VOID
-LcdShutdown (
- VOID
-);
-
-#endif /* __ARM_VE_GRAPHICS_DXE_H__ */
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
deleted file mode 100644
index b5e113b844..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/** @file PL111Lcd.c
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Drivers/PL111Lcd.h>
-
-#include "LcdGraphicsOutputDxe.h"
-
-/**********************************************************************
- *
- * This file contains all the bits of the PL111 that are
- * platform independent.
- *
- **********************************************************************/
-
-EFI_STATUS
-LcdIdentify (
- VOID
- )
-{
- DEBUG ((EFI_D_WARN, "Probing ID registers at 0x%lx for a PL111\n",
- PL111_REG_CLCD_PERIPH_ID_0));
-
- // Check if this is a PL111
- if (MmioRead8 (PL111_REG_CLCD_PERIPH_ID_0) == PL111_CLCD_PERIPH_ID_0 &&
- MmioRead8 (PL111_REG_CLCD_PERIPH_ID_1) == PL111_CLCD_PERIPH_ID_1 &&
- (MmioRead8 (PL111_REG_CLCD_PERIPH_ID_2) & 0xf) == PL111_CLCD_PERIPH_ID_2 &&
- MmioRead8 (PL111_REG_CLCD_PERIPH_ID_3) == PL111_CLCD_PERIPH_ID_3 &&
- MmioRead8 (PL111_REG_CLCD_P_CELL_ID_0) == PL111_CLCD_P_CELL_ID_0 &&
- MmioRead8 (PL111_REG_CLCD_P_CELL_ID_1) == PL111_CLCD_P_CELL_ID_1 &&
- MmioRead8 (PL111_REG_CLCD_P_CELL_ID_2) == PL111_CLCD_P_CELL_ID_2 &&
- MmioRead8 (PL111_REG_CLCD_P_CELL_ID_3) == PL111_CLCD_P_CELL_ID_3) {
- return EFI_SUCCESS;
- }
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-LcdInitialize (
- IN EFI_PHYSICAL_ADDRESS VramBaseAddress
- )
-{
- // Define start of the VRAM. This never changes for any graphics mode
- MmioWrite32(PL111_REG_LCD_UP_BASE, (UINT32) VramBaseAddress);
- MmioWrite32(PL111_REG_LCD_LP_BASE, 0); // We are not using a double buffer
-
- // Disable all interrupts from the PL111
- MmioWrite32(PL111_REG_LCD_IMSC, 0);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LcdSetMode (
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status;
- UINT32 HRes;
- UINT32 HSync;
- UINT32 HBackPorch;
- UINT32 HFrontPorch;
- UINT32 VRes;
- UINT32 VSync;
- UINT32 VBackPorch;
- UINT32 VFrontPorch;
- UINT32 LcdControl;
- LCD_BPP LcdBpp;
-
- // Set the video mode timings and other relevant information
- Status = LcdPlatformGetTimings (ModeNumber,
- &HRes,&HSync,&HBackPorch,&HFrontPorch,
- &VRes,&VSync,&VBackPorch,&VFrontPorch);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR( Status )) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = LcdPlatformGetBpp (ModeNumber,&LcdBpp);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR( Status )) {
- return EFI_DEVICE_ERROR;
- }
-
- // Disable the CLCD_LcdEn bit
- LcdControl = MmioRead32( PL111_REG_LCD_CONTROL);
- MmioWrite32(PL111_REG_LCD_CONTROL, LcdControl & ~1);
-
- // Set Timings
- MmioWrite32 (PL111_REG_LCD_TIMING_0, HOR_AXIS_PANEL(HBackPorch, HFrontPorch, HSync, HRes));
- MmioWrite32 (PL111_REG_LCD_TIMING_1, VER_AXIS_PANEL(VBackPorch, VFrontPorch, VSync, VRes));
- MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY(HRes));
- MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);
-
- // PL111_REG_LCD_CONTROL
- LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP(LcdBpp) | PL111_CTRL_LCD_TFT | PL111_CTRL_BGR;
- MmioWrite32(PL111_REG_LCD_CONTROL, LcdControl);
-
- // Turn on power to the LCD Panel
- LcdControl |= PL111_CTRL_LCD_PWR;
- MmioWrite32(PL111_REG_LCD_CONTROL, LcdControl);
-
- return EFI_SUCCESS;
-}
-
-VOID
-LcdShutdown (
- VOID
- )
-{
- // Disable the controller
- MmioAnd32 (PL111_REG_LCD_CONTROL, ~PL111_CTRL_LCD_EN);
-}
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
deleted file mode 100644
index 003cc2ffa9..0000000000
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-#/** @file
-#
-# Component description file for PL111LcdGraphicsOutputDxe module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL111LcdGraphicsDxe
- FILE_GUID = 407B4008-BF5B-11DF-9547-CF16E0D72085
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = LcdGraphicsOutputDxeInitialize
-
-[Sources.common]
- LcdGraphicsOutputDxe.c
- LcdGraphicsOutputBlt.c
- PL111Lcd.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- UefiLib
- BaseLib
- DebugLib
- TimerLib
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- IoLib
- BaseMemoryLib
- LcdPlatformLib
-
-[Protocols]
- gEfiDevicePathProtocolGuid
- gEfiGraphicsOutputProtocolGuid
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdPL111LcdBase
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices
-
-[Depex]
- gEfiCpuArchProtocolGuid
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf
deleted file mode 100644
index 6c5e6aef0d..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-#
-# Component description file for NorFlashAuthenticatedDxe module
-#
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-# Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
-# Copyright (c) 2015, Intel Corporation. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = NorFlashAuthenticatedDxe
- FILE_GUID = 10B86CEA-F2FE-456A-B1C7-4F506CA46005
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = NorFlashInitialise
-
-[Sources.common]
- NorFlashDxe.c
- NorFlashFvbDxe.c
- NorFlashBlockIoDxe.c
- NorFlashAuthenticatedVariableDep.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- SecurityPkg/SecurityPkg.dec
-
-[LibraryClasses]
- IoLib
- BaseLib
- DebugLib
- HobLib
- NorFlashPlatformLib
- UefiLib
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- UefiRuntimeLib
- DxeServicesTableLib
-
-[Guids]
- gEfiSystemNvDataFvGuid
- gEfiAuthenticatedVariableGuid
- gEfiEventVirtualAddressChangeGuid
-
-[Protocols]
- gEfiBlockIoProtocolGuid
- gEfiDevicePathProtocolGuid
- gEfiFirmwareVolumeBlockProtocolGuid
- gEfiDiskIoProtocolGuid
-
-[Pcd.common]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
-
- gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
-
-[Depex]
- #
- # NorFlashAuthenticatedDxe must be loaded before VariableRuntimeDxe
- # in case empty flash needs populating with default values
- #
- BEFORE gVariableRuntimeDxeFileGuid
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c
deleted file mode 100644
index 2ea8ead85d..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/** @file NorFlashAuthenticatedVariableDep.c
-
- Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-
-#include <Include/Guid/AuthenticatedVariableFormat.h>
-
-CONST EFI_GUID* CONST mNorFlashVariableGuid = &gEfiAuthenticatedVariableGuid;
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
deleted file mode 100644
index 279b77c75e..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/** @file NorFlashBlockIoDxe.c
-
- Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include "NorFlashDxe.h"
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.Reset
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_BLKIO_THIS(This);
-
- DEBUG ((DEBUG_BLKIO, "NorFlashBlockIoReset(MediaId=0x%x)\n", This->Media->MediaId));
-
- return NorFlashReset (Instance);
-}
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.ReadBlocks
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- OUT VOID *Buffer
- )
-{
- NOR_FLASH_INSTANCE *Instance;
- EFI_STATUS Status;
- EFI_BLOCK_IO_MEDIA *Media;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Instance = INSTANCE_FROM_BLKIO_THIS(This);
- Media = This->Media;
-
- DEBUG ((DEBUG_BLKIO, "NorFlashBlockIoReadBlocks(MediaId=0x%x, Lba=%ld, BufferSize=0x%x bytes (%d kB), BufferPtr @ 0x%08x)\n", MediaId, Lba, BufferSizeInBytes, Buffer));
-
- if (!Media) {
- Status = EFI_INVALID_PARAMETER;
- } else if (!Media->MediaPresent) {
- Status = EFI_NO_MEDIA;
- } else if (Media->MediaId != MediaId) {
- Status = EFI_MEDIA_CHANGED;
- } else if ((Media->IoAlign > 2) && (((UINTN)Buffer & (Media->IoAlign - 1)) != 0)) {
- Status = EFI_INVALID_PARAMETER;
- } else {
- Status = NorFlashReadBlocks (Instance, Lba, BufferSizeInBytes, Buffer);
- }
-
- return Status;
-}
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.WriteBlocks
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- IN VOID *Buffer
- )
-{
- NOR_FLASH_INSTANCE *Instance;
- EFI_STATUS Status;
-
- Instance = INSTANCE_FROM_BLKIO_THIS(This);
-
- DEBUG ((DEBUG_BLKIO, "NorFlashBlockIoWriteBlocks(MediaId=0x%x, Lba=%ld, BufferSize=0x%x bytes (%d kB), BufferPtr @ 0x%08x)\n", MediaId, Lba, BufferSizeInBytes, Buffer));
-
- if( !This->Media->MediaPresent ) {
- Status = EFI_NO_MEDIA;
- } else if( This->Media->MediaId != MediaId ) {
- Status = EFI_MEDIA_CHANGED;
- } else if( This->Media->ReadOnly ) {
- Status = EFI_WRITE_PROTECTED;
- } else {
- Status = NorFlashWriteBlocks (Instance,Lba,BufferSizeInBytes,Buffer);
- }
-
- return Status;
-}
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.FlushBlocks
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-{
- // No Flush required for the NOR Flash driver
- // because cache operations are not permitted.
-
- DEBUG ((DEBUG_BLKIO, "NorFlashBlockIoFlushBlocks: Function NOT IMPLEMENTED (not required).\n"));
-
- // Nothing to do so just return without error
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
deleted file mode 100644
index 3abbe5cb32..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
+++ /dev/null
@@ -1,1288 +0,0 @@
-/** @file NorFlashDxe.c
-
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/PcdLib.h>
-
-#include "NorFlashDxe.h"
-
-STATIC EFI_EVENT mNorFlashVirtualAddrChangeEvent;
-
-//
-// Global variable declarations
-//
-NOR_FLASH_INSTANCE **mNorFlashInstances;
-UINT32 mNorFlashDeviceCount;
-
-NOR_FLASH_INSTANCE mNorFlashInstanceTemplate = {
- NOR_FLASH_SIGNATURE, // Signature
- NULL, // Handle ... NEED TO BE FILLED
-
- FALSE, // Initialized
- NULL, // Initialize
-
- 0, // DeviceBaseAddress ... NEED TO BE FILLED
- 0, // RegionBaseAddress ... NEED TO BE FILLED
- 0, // Size ... NEED TO BE FILLED
- 0, // StartLba
-
- {
- EFI_BLOCK_IO_PROTOCOL_REVISION2, // Revision
- NULL, // Media ... NEED TO BE FILLED
- NorFlashBlockIoReset, // Reset;
- NorFlashBlockIoReadBlocks, // ReadBlocks
- NorFlashBlockIoWriteBlocks, // WriteBlocks
- NorFlashBlockIoFlushBlocks // FlushBlocks
- }, // BlockIoProtocol
-
- {
- 0, // MediaId ... NEED TO BE FILLED
- FALSE, // RemovableMedia
- TRUE, // MediaPresent
- FALSE, // LogicalPartition
- FALSE, // ReadOnly
- FALSE, // WriteCaching;
- 0, // BlockSize ... NEED TO BE FILLED
- 4, // IoAlign
- 0, // LastBlock ... NEED TO BE FILLED
- 0, // LowestAlignedLba
- 1, // LogicalBlocksPerPhysicalBlock
- }, //Media;
-
- {
- EFI_DISK_IO_PROTOCOL_REVISION, // Revision
- NorFlashDiskIoReadDisk, // ReadDisk
- NorFlashDiskIoWriteDisk // WriteDisk
- },
-
- FALSE, // SupportFvb ... NEED TO BE FILLED
- {
- FvbGetAttributes, // GetAttributes
- FvbSetAttributes, // SetAttributes
- FvbGetPhysicalAddress, // GetPhysicalAddress
- FvbGetBlockSize, // GetBlockSize
- FvbRead, // Read
- FvbWrite, // Write
- FvbEraseBlocks, // EraseBlocks
- NULL, //ParentHandle
- }, // FvbProtoccol;
- NULL, // ShadowBuffer
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- { (UINT8)sizeof(VENDOR_DEVICE_PATH), (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8) }
- },
- { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
- }
- } // DevicePath
-};
-
-EFI_STATUS
-NorFlashCreateInstance (
- IN UINTN NorFlashDeviceBase,
- IN UINTN NorFlashRegionBase,
- IN UINTN NorFlashSize,
- IN UINT32 MediaId,
- IN UINT32 BlockSize,
- IN BOOLEAN SupportFvb,
- IN CONST GUID *NorFlashGuid,
- OUT NOR_FLASH_INSTANCE** NorFlashInstance
- )
-{
- EFI_STATUS Status;
- NOR_FLASH_INSTANCE* Instance;
-
- ASSERT(NorFlashInstance != NULL);
-
- Instance = AllocateRuntimeCopyPool (sizeof(NOR_FLASH_INSTANCE),&mNorFlashInstanceTemplate);
- if (Instance == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Instance->DeviceBaseAddress = NorFlashDeviceBase;
- Instance->RegionBaseAddress = NorFlashRegionBase;
- Instance->Size = NorFlashSize;
-
- Instance->BlockIoProtocol.Media = &Instance->Media;
- Instance->Media.MediaId = MediaId;
- Instance->Media.BlockSize = BlockSize;
- Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1;
-
- CopyGuid (&Instance->DevicePath.Vendor.Guid, NorFlashGuid);
-
- Instance->ShadowBuffer = AllocateRuntimePool (BlockSize);;
- if (Instance->ShadowBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (SupportFvb) {
- Instance->SupportFvb = TRUE;
- Instance->Initialize = NorFlashFvbInitialize;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Instance->Handle,
- &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
- &gEfiBlockIoProtocolGuid, &Instance->BlockIoProtocol,
- &gEfiFirmwareVolumeBlockProtocolGuid, &Instance->FvbProtocol,
- NULL
- );
- if (EFI_ERROR(Status)) {
- FreePool (Instance);
- return Status;
- }
- } else {
- Instance->Initialized = TRUE;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Instance->Handle,
- &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
- &gEfiBlockIoProtocolGuid, &Instance->BlockIoProtocol,
- &gEfiDiskIoProtocolGuid, &Instance->DiskIoProtocol,
- NULL
- );
- if (EFI_ERROR(Status)) {
- FreePool (Instance);
- return Status;
- }
- }
-
- *NorFlashInstance = Instance;
- return Status;
-}
-
-UINT32
-NorFlashReadStatusRegister (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN SR_Address
- )
-{
- // Prepare to read the status register
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_STATUS_REGISTER);
- return MmioRead32 (Instance->DeviceBaseAddress);
-}
-
-STATIC
-BOOLEAN
-NorFlashBlockIsLocked (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN BlockAddress
- )
-{
- UINT32 LockStatus;
-
- // Send command for reading device id
- SEND_NOR_COMMAND (BlockAddress, 2, P30_CMD_READ_DEVICE_ID);
-
- // Read block lock status
- LockStatus = MmioRead32 (CREATE_NOR_ADDRESS(BlockAddress, 2));
-
- // Decode block lock status
- LockStatus = FOLD_32BIT_INTO_16BIT(LockStatus);
-
- if ((LockStatus & 0x2) != 0) {
- DEBUG((EFI_D_ERROR, "NorFlashBlockIsLocked: WARNING: Block LOCKED DOWN\n"));
- }
-
- return ((LockStatus & 0x1) != 0);
-}
-
-STATIC
-EFI_STATUS
-NorFlashUnlockSingleBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN BlockAddress
- )
-{
- UINT32 LockStatus;
-
- // Raise the Task Priority Level to TPL_NOTIFY to serialise all its operations
- // and to protect shared data structures.
-
- if (FeaturePcdGet (PcdNorFlashCheckBlockLocked) == TRUE) {
- do {
- // Request a lock setup
- SEND_NOR_COMMAND (BlockAddress, 0, P30_CMD_LOCK_BLOCK_SETUP);
-
- // Request an unlock
- SEND_NOR_COMMAND (BlockAddress, 0, P30_CMD_UNLOCK_BLOCK);
-
- // Send command for reading device id
- SEND_NOR_COMMAND (BlockAddress, 2, P30_CMD_READ_DEVICE_ID);
-
- // Read block lock status
- LockStatus = MmioRead32 (CREATE_NOR_ADDRESS(BlockAddress, 2));
-
- // Decode block lock status
- LockStatus = FOLD_32BIT_INTO_16BIT(LockStatus);
- } while ((LockStatus & 0x1) == 1);
- } else {
- // Request a lock setup
- SEND_NOR_COMMAND (BlockAddress, 0, P30_CMD_LOCK_BLOCK_SETUP);
-
- // Request an unlock
- SEND_NOR_COMMAND (BlockAddress, 0, P30_CMD_UNLOCK_BLOCK);
-
- // Wait until the status register gives us the all clear
- do {
- LockStatus = NorFlashReadStatusRegister (Instance, BlockAddress);
- } while ((LockStatus & P30_SR_BIT_WRITE) != P30_SR_BIT_WRITE);
- }
-
- // Put device back into Read Array mode
- SEND_NOR_COMMAND (BlockAddress, 0, P30_CMD_READ_ARRAY);
-
- DEBUG((DEBUG_BLKIO, "UnlockSingleBlock: BlockAddress=0x%08x\n", BlockAddress));
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-NorFlashUnlockSingleBlockIfNecessary (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN BlockAddress
- )
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (NorFlashBlockIsLocked (Instance, BlockAddress) == TRUE) {
- Status = NorFlashUnlockSingleBlock (Instance, BlockAddress);
- }
-
- return Status;
-}
-
-
-/**
- * The following function presumes that the block has already been unlocked.
- **/
-STATIC
-EFI_STATUS
-NorFlashEraseSingleBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN BlockAddress
- )
-{
- EFI_STATUS Status;
- UINT32 StatusRegister;
-
- Status = EFI_SUCCESS;
-
- // Request a block erase and then confirm it
- SEND_NOR_COMMAND(BlockAddress, 0, P30_CMD_BLOCK_ERASE_SETUP);
- SEND_NOR_COMMAND(BlockAddress, 0, P30_CMD_BLOCK_ERASE_CONFIRM);
-
- // Wait until the status register gives us the all clear
- do {
- StatusRegister = NorFlashReadStatusRegister (Instance, BlockAddress);
- } while ((StatusRegister & P30_SR_BIT_WRITE) != P30_SR_BIT_WRITE);
-
- if (StatusRegister & P30_SR_BIT_VPP) {
- DEBUG((EFI_D_ERROR,"EraseSingleBlock(BlockAddress=0x%08x: VPP Range Error\n", BlockAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if ((StatusRegister & (P30_SR_BIT_ERASE | P30_SR_BIT_PROGRAM)) == (P30_SR_BIT_ERASE | P30_SR_BIT_PROGRAM)) {
- DEBUG((EFI_D_ERROR,"EraseSingleBlock(BlockAddress=0x%08x: Command Sequence Error\n", BlockAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (StatusRegister & P30_SR_BIT_ERASE) {
- DEBUG((EFI_D_ERROR,"EraseSingleBlock(BlockAddress=0x%08x: Block Erase Error StatusRegister:0x%X\n", BlockAddress, StatusRegister));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (StatusRegister & P30_SR_BIT_BLOCK_LOCKED) {
- // The debug level message has been reduced because a device lock might happen. In this case we just retry it ...
- DEBUG((EFI_D_INFO,"EraseSingleBlock(BlockAddress=0x%08x: Block Locked Error\n", BlockAddress));
- Status = EFI_WRITE_PROTECTED;
- }
-
- if (EFI_ERROR(Status)) {
- // Clear the Status Register
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_CLEAR_STATUS_REGISTER);
- }
-
- // Put device back into Read Array mode
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_ARRAY);
-
- return Status;
-}
-
-/**
- * This function unlock and erase an entire NOR Flash block.
- **/
-EFI_STATUS
-NorFlashUnlockAndEraseSingleBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN BlockAddress
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_TPL OriginalTPL;
-
- if (!EfiAtRuntime ()) {
- // Raise TPL to TPL_HIGH to stop anyone from interrupting us.
- OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- } else {
- // This initialization is only to prevent the compiler to complain about the
- // use of uninitialized variables
- OriginalTPL = TPL_HIGH_LEVEL;
- }
-
- Index = 0;
- // The block erase might fail a first time (SW bug ?). Retry it ...
- do {
- // Unlock the block if we have to
- Status = NorFlashUnlockSingleBlockIfNecessary (Instance, BlockAddress);
- if (EFI_ERROR (Status)) {
- break;
- }
- Status = NorFlashEraseSingleBlock (Instance, BlockAddress);
- Index++;
- } while ((Index < NOR_FLASH_ERASE_RETRY) && (Status == EFI_WRITE_PROTECTED));
-
- if (Index == NOR_FLASH_ERASE_RETRY) {
- DEBUG((EFI_D_ERROR,"EraseSingleBlock(BlockAddress=0x%08x: Block Locked Error (try to erase %d times)\n", BlockAddress,Index));
- }
-
- if (!EfiAtRuntime ()) {
- // Interruptions can resume.
- gBS->RestoreTPL (OriginalTPL);
- }
-
- return Status;
-}
-
-
-STATIC
-EFI_STATUS
-NorFlashWriteSingleWord (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN WordAddress,
- IN UINT32 WriteData
- )
-{
- EFI_STATUS Status;
- UINT32 StatusRegister;
-
- Status = EFI_SUCCESS;
-
- // Request a write single word command
- SEND_NOR_COMMAND(WordAddress, 0, P30_CMD_WORD_PROGRAM_SETUP);
-
- // Store the word into NOR Flash;
- MmioWrite32 (WordAddress, WriteData);
-
- // Wait for the write to complete and then check for any errors; i.e. check the Status Register
- do {
- // Prepare to read the status register
- StatusRegister = NorFlashReadStatusRegister (Instance, WordAddress);
- // The chip is busy while the WRITE bit is not asserted
- } while ((StatusRegister & P30_SR_BIT_WRITE) != P30_SR_BIT_WRITE);
-
-
- // Perform a full status check:
- // Mask the relevant bits of Status Register.
- // Everything should be zero, if not, we have a problem
-
- if (StatusRegister & P30_SR_BIT_VPP) {
- DEBUG((EFI_D_ERROR,"NorFlashWriteSingleWord(WordAddress:0x%X): VPP Range Error\n",WordAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (StatusRegister & P30_SR_BIT_PROGRAM) {
- DEBUG((EFI_D_ERROR,"NorFlashWriteSingleWord(WordAddress:0x%X): Program Error\n",WordAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (StatusRegister & P30_SR_BIT_BLOCK_LOCKED) {
- DEBUG((EFI_D_ERROR,"NorFlashWriteSingleWord(WordAddress:0x%X): Device Protect Error\n",WordAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (!EFI_ERROR(Status)) {
- // Clear the Status Register
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_CLEAR_STATUS_REGISTER);
- }
-
- // Put device back into Read Array mode
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_ARRAY);
-
- return Status;
-}
-
-/*
- * Writes data to the NOR Flash using the Buffered Programming method.
- *
- * The maximum size of the on-chip buffer is 32-words, because of hardware restrictions.
- * Therefore this function will only handle buffers up to 32 words or 128 bytes.
- * To deal with larger buffers, call this function again.
- *
- * This function presumes that both the TargetAddress and the TargetAddress+BufferSize
- * exist entirely within the NOR Flash. Therefore these conditions will not be checked here.
- *
- * In buffered programming, if the target address not at the beginning of a 32-bit word boundary,
- * then programming time is doubled and power consumption is increased.
- * Therefore, it is a requirement to align buffer writes to 32-bit word boundaries.
- * i.e. the last 4 bits of the target start address must be zero: 0x......00
- */
-EFI_STATUS
-NorFlashWriteBuffer (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN TargetAddress,
- IN UINTN BufferSizeInBytes,
- IN UINT32 *Buffer
- )
-{
- EFI_STATUS Status;
- UINTN BufferSizeInWords;
- UINTN Count;
- volatile UINT32 *Data;
- UINTN WaitForBuffer;
- BOOLEAN BufferAvailable;
- UINT32 StatusRegister;
-
- WaitForBuffer = MAX_BUFFERED_PROG_ITERATIONS;
- BufferAvailable = FALSE;
-
- // Check that the target address does not cross a 32-word boundary.
- if ((TargetAddress & BOUNDARY_OF_32_WORDS) != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Check there are some data to program
- if (BufferSizeInBytes == 0) {
- return EFI_BUFFER_TOO_SMALL;
- }
-
- // Check that the buffer size does not exceed the maximum hardware buffer size on chip.
- if (BufferSizeInBytes > P30_MAX_BUFFER_SIZE_IN_BYTES) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // Check that the buffer size is a multiple of 32-bit words
- if ((BufferSizeInBytes % 4) != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // Pre-programming conditions checked, now start the algorithm.
-
- // Prepare the data destination address
- Data = (UINT32 *)TargetAddress;
-
- // Check the availability of the buffer
- do {
- // Issue the Buffered Program Setup command
- SEND_NOR_COMMAND(TargetAddress, 0, P30_CMD_BUFFERED_PROGRAM_SETUP);
-
- // Read back the status register bit#7 from the same address
- if (((*Data) & P30_SR_BIT_WRITE) == P30_SR_BIT_WRITE) {
- BufferAvailable = TRUE;
- }
-
- // Update the loop counter
- WaitForBuffer--;
-
- } while ((WaitForBuffer > 0) && (BufferAvailable == FALSE));
-
- // The buffer was not available for writing
- if (WaitForBuffer == 0) {
- Status = EFI_DEVICE_ERROR;
- goto EXIT;
- }
-
- // From now on we work in 32-bit words
- BufferSizeInWords = BufferSizeInBytes / (UINTN)4;
-
- // Write the word count, which is (buffer_size_in_words - 1),
- // because word count 0 means one word.
- SEND_NOR_COMMAND(TargetAddress, 0, (BufferSizeInWords - 1));
-
- // Write the data to the NOR Flash, advancing each address by 4 bytes
- for(Count=0; Count < BufferSizeInWords; Count++, Data++, Buffer++) {
- MmioWrite32 ((UINTN)Data, *Buffer);
- }
-
- // Issue the Buffered Program Confirm command, to start the programming operation
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_BUFFERED_PROGRAM_CONFIRM);
-
- // Wait for the write to complete and then check for any errors; i.e. check the Status Register
- do {
- StatusRegister = NorFlashReadStatusRegister (Instance, TargetAddress);
- // The chip is busy while the WRITE bit is not asserted
- } while ((StatusRegister & P30_SR_BIT_WRITE) != P30_SR_BIT_WRITE);
-
-
- // Perform a full status check:
- // Mask the relevant bits of Status Register.
- // Everything should be zero, if not, we have a problem
-
- Status = EFI_SUCCESS;
-
- if (StatusRegister & P30_SR_BIT_VPP) {
- DEBUG((EFI_D_ERROR,"NorFlashWriteBuffer(TargetAddress:0x%X): VPP Range Error\n", TargetAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (StatusRegister & P30_SR_BIT_PROGRAM) {
- DEBUG((EFI_D_ERROR,"NorFlashWriteBuffer(TargetAddress:0x%X): Program Error\n", TargetAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (StatusRegister & P30_SR_BIT_BLOCK_LOCKED) {
- DEBUG((EFI_D_ERROR,"NorFlashWriteBuffer(TargetAddress:0x%X): Device Protect Error\n",TargetAddress));
- Status = EFI_DEVICE_ERROR;
- }
-
- if (!EFI_ERROR(Status)) {
- // Clear the Status Register
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_CLEAR_STATUS_REGISTER);
- }
-
-EXIT:
- // Put device back into Read Array mode
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_ARRAY);
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-NorFlashWriteFullBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINT32 *DataBuffer,
- IN UINT32 BlockSizeInWords
- )
-{
- EFI_STATUS Status;
- UINTN WordAddress;
- UINT32 WordIndex;
- UINTN BufferIndex;
- UINTN BlockAddress;
- UINTN BuffersInBlock;
- UINTN RemainingWords;
- EFI_TPL OriginalTPL;
- UINTN Cnt;
-
- Status = EFI_SUCCESS;
-
- // Get the physical address of the block
- BlockAddress = GET_NOR_BLOCK_ADDRESS (Instance->RegionBaseAddress, Lba, BlockSizeInWords * 4);
-
- // Start writing from the first address at the start of the block
- WordAddress = BlockAddress;
-
- if (!EfiAtRuntime ()) {
- // Raise TPL to TPL_HIGH to stop anyone from interrupting us.
- OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- } else {
- // This initialization is only to prevent the compiler to complain about the
- // use of uninitialized variables
- OriginalTPL = TPL_HIGH_LEVEL;
- }
-
- Status = NorFlashUnlockAndEraseSingleBlock (Instance, BlockAddress);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "WriteSingleBlock: ERROR - Failed to Unlock and Erase the single block at 0x%X\n", BlockAddress));
- goto EXIT;
- }
-
- // To speed up the programming operation, NOR Flash is programmed using the Buffered Programming method.
-
- // Check that the address starts at a 32-word boundary, i.e. last 7 bits must be zero
- if ((WordAddress & BOUNDARY_OF_32_WORDS) == 0x00) {
-
- // First, break the entire block into buffer-sized chunks.
- BuffersInBlock = (UINTN)(BlockSizeInWords * 4) / P30_MAX_BUFFER_SIZE_IN_BYTES;
-
- // Then feed each buffer chunk to the NOR Flash
- // If a buffer does not contain any data, don't write it.
- for(BufferIndex=0;
- BufferIndex < BuffersInBlock;
- BufferIndex++, WordAddress += P30_MAX_BUFFER_SIZE_IN_BYTES, DataBuffer += P30_MAX_BUFFER_SIZE_IN_WORDS
- ) {
- // Check the buffer to see if it contains any data (not set all 1s).
- for (Cnt = 0; Cnt < P30_MAX_BUFFER_SIZE_IN_WORDS; Cnt++) {
- if (~DataBuffer[Cnt] != 0 ) {
- // Some data found, write the buffer.
- Status = NorFlashWriteBuffer (Instance, WordAddress, P30_MAX_BUFFER_SIZE_IN_BYTES,
- DataBuffer);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- break;
- }
- }
- }
-
- // Finally, finish off any remaining words that are less than the maximum size of the buffer
- RemainingWords = BlockSizeInWords % P30_MAX_BUFFER_SIZE_IN_WORDS;
-
- if(RemainingWords != 0) {
- Status = NorFlashWriteBuffer (Instance, WordAddress, (RemainingWords * 4), DataBuffer);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
-
- } else {
- // For now, use the single word programming algorithm
- // It is unlikely that the NOR Flash will exist in an address which falls within a 32 word boundary range,
- // i.e. which ends in the range 0x......01 - 0x......7F.
- for(WordIndex=0; WordIndex<BlockSizeInWords; WordIndex++, DataBuffer++, WordAddress = WordAddress + 4) {
- Status = NorFlashWriteSingleWord (Instance, WordAddress, *DataBuffer);
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
- }
-
-EXIT:
- if (!EfiAtRuntime ()) {
- // Interruptions can resume.
- gBS->RestoreTPL (OriginalTPL);
- }
-
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "NOR FLASH Programming [WriteSingleBlock] failed at address 0x%08x. Exit Status = \"%r\".\n", WordAddress, Status));
- }
- return Status;
-}
-
-
-EFI_STATUS
-NorFlashWriteBlocks (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- IN VOID *Buffer
- )
-{
- UINT32 *pWriteBuffer;
- EFI_STATUS Status = EFI_SUCCESS;
- EFI_LBA CurrentBlock;
- UINT32 BlockSizeInWords;
- UINT32 NumBlocks;
- UINT32 BlockCount;
-
- // The buffer must be valid
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if(Instance->Media.ReadOnly == TRUE) {
- return EFI_WRITE_PROTECTED;
- }
-
- // We must have some bytes to read
- DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: BufferSizeInBytes=0x%x\n", BufferSizeInBytes));
- if(BufferSizeInBytes == 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // The size of the buffer must be a multiple of the block size
- DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: BlockSize in bytes =0x%x\n", Instance->Media.BlockSize));
- if ((BufferSizeInBytes % Instance->Media.BlockSize) != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // All blocks must be within the device
- NumBlocks = ((UINT32)BufferSizeInBytes) / Instance->Media.BlockSize ;
-
- DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: NumBlocks=%d, LastBlock=%ld, Lba=%ld.\n", NumBlocks, Instance->Media.LastBlock, Lba));
-
- if ((Lba + NumBlocks) > (Instance->Media.LastBlock + 1)) {
- DEBUG((EFI_D_ERROR, "NorFlashWriteBlocks: ERROR - Write will exceed last block.\n"));
- return EFI_INVALID_PARAMETER;
- }
-
- BlockSizeInWords = Instance->Media.BlockSize / 4;
-
- // Because the target *Buffer is a pointer to VOID, we must put all the data into a pointer
- // to a proper data type, so use *ReadBuffer
- pWriteBuffer = (UINT32 *)Buffer;
-
- CurrentBlock = Lba;
- for (BlockCount=0; BlockCount < NumBlocks; BlockCount++, CurrentBlock++, pWriteBuffer = pWriteBuffer + BlockSizeInWords) {
-
- DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: Writing block #%d\n", (UINTN)CurrentBlock));
-
- Status = NorFlashWriteFullBlock (Instance, CurrentBlock, pWriteBuffer, BlockSizeInWords);
-
- if (EFI_ERROR(Status)) {
- break;
- }
- }
-
- DEBUG((DEBUG_BLKIO, "NorFlashWriteBlocks: Exit Status = \"%r\".\n", Status));
- return Status;
-}
-
-EFI_STATUS
-NorFlashReadBlocks (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- OUT VOID *Buffer
- )
-{
- UINT32 NumBlocks;
- UINTN StartAddress;
-
- DEBUG((DEBUG_BLKIO, "NorFlashReadBlocks: BufferSize=0x%xB BlockSize=0x%xB LastBlock=%ld, Lba=%ld.\n",
- BufferSizeInBytes, Instance->Media.BlockSize, Instance->Media.LastBlock, Lba));
-
- // The buffer must be valid
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Return if we have not any byte to read
- if (BufferSizeInBytes == 0) {
- return EFI_SUCCESS;
- }
-
- // The size of the buffer must be a multiple of the block size
- if ((BufferSizeInBytes % Instance->Media.BlockSize) != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // All blocks must be within the device
- NumBlocks = ((UINT32)BufferSizeInBytes) / Instance->Media.BlockSize ;
-
- if ((Lba + NumBlocks) > (Instance->Media.LastBlock + 1)) {
- DEBUG((EFI_D_ERROR, "NorFlashReadBlocks: ERROR - Read will exceed last block\n"));
- return EFI_INVALID_PARAMETER;
- }
-
- // Get the address to start reading from
- StartAddress = GET_NOR_BLOCK_ADDRESS (Instance->RegionBaseAddress,
- Lba,
- Instance->Media.BlockSize
- );
-
- // Put the device into Read Array mode
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_ARRAY);
-
- // Readout the data
- CopyMem(Buffer, (UINTN *)StartAddress, BufferSizeInBytes);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-NorFlashRead (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINTN BufferSizeInBytes,
- OUT VOID *Buffer
- )
-{
- UINTN StartAddress;
-
- // The buffer must be valid
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Return if we have not any byte to read
- if (BufferSizeInBytes == 0) {
- return EFI_SUCCESS;
- }
-
- if (((Lba * Instance->Media.BlockSize) + Offset + BufferSizeInBytes) > Instance->Size) {
- DEBUG ((EFI_D_ERROR, "NorFlashRead: ERROR - Read will exceed device size.\n"));
- return EFI_INVALID_PARAMETER;
- }
-
- // Get the address to start reading from
- StartAddress = GET_NOR_BLOCK_ADDRESS (Instance->RegionBaseAddress,
- Lba,
- Instance->Media.BlockSize
- );
-
- // Put the device into Read Array mode
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_ARRAY);
-
- // Readout the data
- CopyMem (Buffer, (UINTN *)(StartAddress + Offset), BufferSizeInBytes);
-
- return EFI_SUCCESS;
-}
-
-/*
- Write a full or portion of a block. It must not span block boundaries; that is,
- Offset + *NumBytes <= Instance->Media.BlockSize.
-*/
-EFI_STATUS
-NorFlashWriteSingleBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- EFI_STATUS TempStatus;
- UINT32 Tmp;
- UINT32 TmpBuf;
- UINT32 WordToWrite;
- UINT32 Mask;
- BOOLEAN DoErase;
- UINTN BytesToWrite;
- UINTN CurOffset;
- UINTN WordAddr;
- UINTN BlockSize;
- UINTN BlockAddress;
- UINTN PrevBlockAddress;
-
- PrevBlockAddress = 0;
-
- if (!Instance->Initialized && Instance->Initialize) {
- Instance->Initialize(Instance);
- }
-
- DEBUG ((DEBUG_BLKIO, "NorFlashWriteSingleBlock(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Lba, Offset, *NumBytes, Buffer));
-
- // Detect WriteDisabled state
- if (Instance->Media.ReadOnly == TRUE) {
- DEBUG ((EFI_D_ERROR, "NorFlashWriteSingleBlock: ERROR - Can not write: Device is in WriteDisabled state.\n"));
- // It is in WriteDisabled state, return an error right away
- return EFI_ACCESS_DENIED;
- }
-
- // Cache the block size to avoid de-referencing pointers all the time
- BlockSize = Instance->Media.BlockSize;
-
- // The write must not span block boundaries.
- // We need to check each variable individually because adding two large values together overflows.
- if ( ( Offset >= BlockSize ) ||
- ( *NumBytes > BlockSize ) ||
- ( (Offset + *NumBytes) > BlockSize ) ) {
- DEBUG ((EFI_D_ERROR, "NorFlashWriteSingleBlock: ERROR - EFI_BAD_BUFFER_SIZE: (Offset=0x%x + NumBytes=0x%x) > BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // We must have some bytes to write
- if (*NumBytes == 0) {
- DEBUG ((EFI_D_ERROR, "NorFlashWriteSingleBlock: ERROR - EFI_BAD_BUFFER_SIZE: (Offset=0x%x + NumBytes=0x%x) > BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // Pick 128bytes as a good start for word operations as opposed to erasing the
- // block and writing the data regardless if an erase is really needed.
- // It looks like most individual NV variable writes are smaller than 128bytes.
- if (*NumBytes <= 128) {
- // Check to see if we need to erase before programming the data into NOR.
- // If the destination bits are only changing from 1s to 0s we can just write.
- // After a block is erased all bits in the block is set to 1.
- // If any byte requires us to erase we just give up and rewrite all of it.
- DoErase = FALSE;
- BytesToWrite = *NumBytes;
- CurOffset = Offset;
-
- while (BytesToWrite > 0) {
- // Read full word from NOR, splice as required. A word is the smallest
- // unit we can write.
- TempStatus = NorFlashRead (Instance, Lba, CurOffset & ~(0x3), sizeof(Tmp), &Tmp);
- if (EFI_ERROR (TempStatus)) {
- return EFI_DEVICE_ERROR;
- }
-
- // Physical address of word in NOR to write.
- WordAddr = (CurOffset & ~(0x3)) + GET_NOR_BLOCK_ADDRESS (Instance->RegionBaseAddress,
- Lba, BlockSize);
- // The word of data that is to be written.
- TmpBuf = *((UINT32*)(Buffer + (*NumBytes - BytesToWrite)));
-
- // First do word aligned chunks.
- if ((CurOffset & 0x3) == 0) {
- if (BytesToWrite >= 4) {
- // Is the destination still in 'erased' state?
- if (~Tmp != 0) {
- // Check to see if we are only changing bits to zero.
- if ((Tmp ^ TmpBuf) & TmpBuf) {
- DoErase = TRUE;
- break;
- }
- }
- // Write this word to NOR
- WordToWrite = TmpBuf;
- CurOffset += sizeof(TmpBuf);
- BytesToWrite -= sizeof(TmpBuf);
- } else {
- // BytesToWrite < 4. Do small writes and left-overs
- Mask = ~((~0) << (BytesToWrite * 8));
- // Mask out the bytes we want.
- TmpBuf &= Mask;
- // Is the destination still in 'erased' state?
- if ((Tmp & Mask) != Mask) {
- // Check to see if we are only changing bits to zero.
- if ((Tmp ^ TmpBuf) & TmpBuf) {
- DoErase = TRUE;
- break;
- }
- }
- // Merge old and new data. Write merged word to NOR
- WordToWrite = (Tmp & ~Mask) | TmpBuf;
- CurOffset += BytesToWrite;
- BytesToWrite = 0;
- }
- } else {
- // Do multiple words, but starting unaligned.
- if (BytesToWrite > (4 - (CurOffset & 0x3))) {
- Mask = ((~0) << ((CurOffset & 0x3) * 8));
- // Mask out the bytes we want.
- TmpBuf &= Mask;
- // Is the destination still in 'erased' state?
- if ((Tmp & Mask) != Mask) {
- // Check to see if we are only changing bits to zero.
- if ((Tmp ^ TmpBuf) & TmpBuf) {
- DoErase = TRUE;
- break;
- }
- }
- // Merge old and new data. Write merged word to NOR
- WordToWrite = (Tmp & ~Mask) | TmpBuf;
- BytesToWrite -= (4 - (CurOffset & 0x3));
- CurOffset += (4 - (CurOffset & 0x3));
- } else {
- // Unaligned and fits in one word.
- Mask = (~((~0) << (BytesToWrite * 8))) << ((CurOffset & 0x3) * 8);
- // Mask out the bytes we want.
- TmpBuf = (TmpBuf << ((CurOffset & 0x3) * 8)) & Mask;
- // Is the destination still in 'erased' state?
- if ((Tmp & Mask) != Mask) {
- // Check to see if we are only changing bits to zero.
- if ((Tmp ^ TmpBuf) & TmpBuf) {
- DoErase = TRUE;
- break;
- }
- }
- // Merge old and new data. Write merged word to NOR
- WordToWrite = (Tmp & ~Mask) | TmpBuf;
- CurOffset += BytesToWrite;
- BytesToWrite = 0;
- }
- }
-
- //
- // Write the word to NOR.
- //
-
- BlockAddress = GET_NOR_BLOCK_ADDRESS (Instance->RegionBaseAddress, Lba, BlockSize);
- if (BlockAddress != PrevBlockAddress) {
- TempStatus = NorFlashUnlockSingleBlockIfNecessary (Instance, BlockAddress);
- if (EFI_ERROR (TempStatus)) {
- return EFI_DEVICE_ERROR;
- }
- PrevBlockAddress = BlockAddress;
- }
- TempStatus = NorFlashWriteSingleWord (Instance, WordAddr, WordToWrite);
- if (EFI_ERROR (TempStatus)) {
- return EFI_DEVICE_ERROR;
- }
- }
- // Exit if we got here and could write all the data. Otherwise do the
- // Erase-Write cycle.
- if (!DoErase) {
- return EFI_SUCCESS;
- }
- }
-
- // Check we did get some memory. Buffer is BlockSize.
- if (Instance->ShadowBuffer == NULL) {
- DEBUG ((EFI_D_ERROR, "FvbWrite: ERROR - Buffer not ready\n"));
- return EFI_DEVICE_ERROR;
- }
-
- // Read NOR Flash data into shadow buffer
- TempStatus = NorFlashReadBlocks (Instance, Lba, BlockSize, Instance->ShadowBuffer);
- if (EFI_ERROR (TempStatus)) {
- // Return one of the pre-approved error statuses
- return EFI_DEVICE_ERROR;
- }
-
- // Put the data at the appropriate location inside the buffer area
- CopyMem ((VOID*)((UINTN)Instance->ShadowBuffer + Offset), Buffer, *NumBytes);
-
- // Write the modified buffer back to the NorFlash
- TempStatus = NorFlashWriteBlocks (Instance, Lba, BlockSize, Instance->ShadowBuffer);
- if (EFI_ERROR (TempStatus)) {
- // Return one of the pre-approved error statuses
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-/*
- Although DiskIoDxe will automatically install the DiskIO protocol whenever
- we install the BlockIO protocol, its implementation is sub-optimal as it reads
- and writes entire blocks using the BlockIO protocol. In fact we can access
- NOR flash with a finer granularity than that, so we can improve performance
- by directly producing the DiskIO protocol.
-*/
-
-/**
- Read BufferSize bytes from Offset into Buffer.
-
- @param This Protocol instance pointer.
- @param MediaId Id of the media, changes every time the media is replaced.
- @param Offset The starting byte offset to read from
- @param BufferSize Size of Buffer
- @param Buffer Buffer containing read data
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
- @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not
- valid for the device.
-
-**/
-EFI_STATUS
-EFIAPI
-NorFlashDiskIoReadDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 DiskOffset,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- NOR_FLASH_INSTANCE *Instance;
- UINT32 BlockSize;
- UINT32 BlockOffset;
- EFI_LBA Lba;
-
- Instance = INSTANCE_FROM_DISKIO_THIS(This);
-
- if (MediaId != Instance->Media.MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- BlockSize = Instance->Media.BlockSize;
- Lba = (EFI_LBA) DivU64x32Remainder (DiskOffset, BlockSize, &BlockOffset);
-
- return NorFlashRead (Instance, Lba, BlockOffset, BufferSize, Buffer);
-}
-
-/**
- Writes a specified number of bytes to a device.
-
- @param This Indicates a pointer to the calling context.
- @param MediaId ID of the medium to be written.
- @param Offset The starting byte offset on the logical block I/O device to write.
- @param BufferSize The size in bytes of Buffer. The number of bytes to write to the device.
- @param Buffer A pointer to the buffer containing the data to be written.
-
- @retval EFI_SUCCESS The data was written correctly to the device.
- @retval EFI_WRITE_PROTECTED The device can not be written to.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
- @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not
- valid for the device.
-
-**/
-EFI_STATUS
-EFIAPI
-NorFlashDiskIoWriteDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 DiskOffset,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- NOR_FLASH_INSTANCE *Instance;
- UINT32 BlockSize;
- UINT32 BlockOffset;
- EFI_LBA Lba;
- UINTN RemainingBytes;
- UINTN WriteSize;
- EFI_STATUS Status;
-
- Instance = INSTANCE_FROM_DISKIO_THIS(This);
-
- if (MediaId != Instance->Media.MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- BlockSize = Instance->Media.BlockSize;
- Lba = (EFI_LBA) DivU64x32Remainder (DiskOffset, BlockSize, &BlockOffset);
-
- RemainingBytes = BufferSize;
-
- // Write either all the remaining bytes, or the number of bytes that bring
- // us up to a block boundary, whichever is less.
- // (DiskOffset | (BlockSize - 1)) + 1) rounds DiskOffset up to the next
- // block boundary (even if it is already on one).
- WriteSize = MIN (RemainingBytes, ((DiskOffset | (BlockSize - 1)) + 1) - DiskOffset);
-
- do {
- if (WriteSize == BlockSize) {
- // Write a full block
- Status = NorFlashWriteFullBlock (Instance, Lba, Buffer, BlockSize / sizeof (UINT32));
- } else {
- // Write a partial block
- Status = NorFlashWriteSingleBlock (Instance, Lba, BlockOffset, &WriteSize, Buffer);
- }
- if (EFI_ERROR (Status)) {
- return Status;
- }
- // Now continue writing either all the remaining bytes or single blocks.
- RemainingBytes -= WriteSize;
- Buffer = (UINT8 *) Buffer + WriteSize;
- Lba++;
- BlockOffset = 0;
- WriteSize = MIN (RemainingBytes, BlockSize);
- } while (RemainingBytes);
-
- return Status;
-}
-
-EFI_STATUS
-NorFlashReset (
- IN NOR_FLASH_INSTANCE *Instance
- )
-{
- // As there is no specific RESET to perform, ensure that the devices is in the default Read Array mode
- SEND_NOR_COMMAND (Instance->DeviceBaseAddress, 0, P30_CMD_READ_ARRAY);
- return EFI_SUCCESS;
-}
-
-/**
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-VOID
-EFIAPI
-NorFlashVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < mNorFlashDeviceCount; Index++) {
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->DeviceBaseAddress);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->RegionBaseAddress);
-
- // Convert BlockIo protocol
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->BlockIoProtocol.FlushBlocks);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->BlockIoProtocol.ReadBlocks);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->BlockIoProtocol.Reset);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->BlockIoProtocol.WriteBlocks);
-
- // Convert Fvb
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.EraseBlocks);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.GetAttributes);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.GetBlockSize);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.GetPhysicalAddress);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.Read);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.SetAttributes);
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->FvbProtocol.Write);
-
- if (mNorFlashInstances[Index]->ShadowBuffer != NULL) {
- EfiConvertPointer (0x0, (VOID**)&mNorFlashInstances[Index]->ShadowBuffer);
- }
- }
-
- return;
-}
-
-EFI_STATUS
-EFIAPI
-NorFlashInitialise (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- UINT32 Index;
- NOR_FLASH_DESCRIPTION* NorFlashDevices;
- BOOLEAN ContainVariableStorage;
-
- Status = NorFlashPlatformInitialization ();
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR,"NorFlashInitialise: Fail to initialize Nor Flash devices\n"));
- return Status;
- }
-
- Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR,"NorFlashInitialise: Fail to get Nor Flash devices\n"));
- return Status;
- }
-
- mNorFlashInstances = AllocateRuntimePool (sizeof(NOR_FLASH_INSTANCE*) * mNorFlashDeviceCount);
-
- for (Index = 0; Index < mNorFlashDeviceCount; Index++) {
- // Check if this NOR Flash device contain the variable storage region
- ContainVariableStorage =
- (NorFlashDevices[Index].RegionBaseAddress <= PcdGet32 (PcdFlashNvStorageVariableBase)) &&
- (PcdGet32 (PcdFlashNvStorageVariableBase) + PcdGet32 (PcdFlashNvStorageVariableSize) <= NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
-
- Status = NorFlashCreateInstance (
- NorFlashDevices[Index].DeviceBaseAddress,
- NorFlashDevices[Index].RegionBaseAddress,
- NorFlashDevices[Index].Size,
- Index,
- NorFlashDevices[Index].BlockSize,
- ContainVariableStorage,
- &NorFlashDevices[Index].Guid,
- &mNorFlashInstances[Index]
- );
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR,"NorFlashInitialise: Fail to create instance for NorFlash[%d]\n",Index));
- }
- }
-
- //
- // Register for the virtual address change event
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- NorFlashVirtualNotifyEvent,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &mNorFlashVirtualAddrChangeEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h
deleted file mode 100644
index d0b5c5b12f..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h
+++ /dev/null
@@ -1,369 +0,0 @@
-/** @file NorFlashDxe.h
-
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __NOR_FLASH_DXE_H__
-#define __NOR_FLASH_DXE_H__
-
-
-#include <Base.h>
-#include <PiDxe.h>
-
-#include <Guid/EventGroup.h>
-
-#include <Protocol/BlockIo.h>
-#include <Protocol/DiskIo.h>
-#include <Protocol/FirmwareVolumeBlock.h>
-
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/NorFlashPlatformLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiRuntimeLib.h>
-
-#define NOR_FLASH_ERASE_RETRY 10
-
-// Device access macros
-// These are necessary because we use 2 x 16bit parts to make up 32bit data
-
-#define HIGH_16_BITS 0xFFFF0000
-#define LOW_16_BITS 0x0000FFFF
-#define LOW_8_BITS 0x000000FF
-
-#define FOLD_32BIT_INTO_16BIT(value) ( ( value >> 16 ) | ( value & LOW_16_BITS ) )
-
-#define GET_LOW_BYTE(value) ( value & LOW_8_BITS )
-#define GET_HIGH_BYTE(value) ( GET_LOW_BYTE( value >> 16 ) )
-
-// Each command must be sent simultaneously to both chips,
-// i.e. at the lower 16 bits AND at the higher 16 bits
-#define CREATE_NOR_ADDRESS(BaseAddr,OffsetAddr) ((BaseAddr) + ((OffsetAddr) << 2))
-#define CREATE_DUAL_CMD(Cmd) ( ( Cmd << 16) | ( Cmd & LOW_16_BITS) )
-#define SEND_NOR_COMMAND(BaseAddr,Offset,Cmd) MmioWrite32 (CREATE_NOR_ADDRESS(BaseAddr,Offset), CREATE_DUAL_CMD(Cmd))
-#define GET_NOR_BLOCK_ADDRESS(BaseAddr,Lba,LbaSize)( BaseAddr + (UINTN)((Lba) * LbaSize) )
-
-// Status Register Bits
-#define P30_SR_BIT_WRITE (BIT7 << 16 | BIT7)
-#define P30_SR_BIT_ERASE_SUSPEND (BIT6 << 16 | BIT6)
-#define P30_SR_BIT_ERASE (BIT5 << 16 | BIT5)
-#define P30_SR_BIT_PROGRAM (BIT4 << 16 | BIT4)
-#define P30_SR_BIT_VPP (BIT3 << 16 | BIT3)
-#define P30_SR_BIT_PROGRAM_SUSPEND (BIT2 << 16 | BIT2)
-#define P30_SR_BIT_BLOCK_LOCKED (BIT1 << 16 | BIT1)
-#define P30_SR_BIT_BEFP (BIT0 << 16 | BIT0)
-
-// Device Commands for Intel StrataFlash(R) Embedded Memory (P30) Family
-
-// On chip buffer size for buffered programming operations
-// There are 2 chips, each chip can buffer up to 32 (16-bit)words, and each word is 2 bytes.
-// Therefore the total size of the buffer is 2 x 32 x 2 = 128 bytes
-#define P30_MAX_BUFFER_SIZE_IN_BYTES ((UINTN)128)
-#define P30_MAX_BUFFER_SIZE_IN_WORDS (P30_MAX_BUFFER_SIZE_IN_BYTES/((UINTN)4))
-#define MAX_BUFFERED_PROG_ITERATIONS 10000000
-#define BOUNDARY_OF_32_WORDS 0x7F
-
-// CFI Addresses
-#define P30_CFI_ADDR_QUERY_UNIQUE_QRY 0x10
-#define P30_CFI_ADDR_VENDOR_ID 0x13
-
-// CFI Data
-#define CFI_QRY 0x00595251
-
-// READ Commands
-#define P30_CMD_READ_DEVICE_ID 0x0090
-#define P30_CMD_READ_STATUS_REGISTER 0x0070
-#define P30_CMD_CLEAR_STATUS_REGISTER 0x0050
-#define P30_CMD_READ_ARRAY 0x00FF
-#define P30_CMD_READ_CFI_QUERY 0x0098
-
-// WRITE Commands
-#define P30_CMD_WORD_PROGRAM_SETUP 0x0040
-#define P30_CMD_ALTERNATE_WORD_PROGRAM_SETUP 0x0010
-#define P30_CMD_BUFFERED_PROGRAM_SETUP 0x00E8
-#define P30_CMD_BUFFERED_PROGRAM_CONFIRM 0x00D0
-#define P30_CMD_BEFP_SETUP 0x0080
-#define P30_CMD_BEFP_CONFIRM 0x00D0
-
-// ERASE Commands
-#define P30_CMD_BLOCK_ERASE_SETUP 0x0020
-#define P30_CMD_BLOCK_ERASE_CONFIRM 0x00D0
-
-// SUSPEND Commands
-#define P30_CMD_PROGRAM_OR_ERASE_SUSPEND 0x00B0
-#define P30_CMD_SUSPEND_RESUME 0x00D0
-
-// BLOCK LOCKING / UNLOCKING Commands
-#define P30_CMD_LOCK_BLOCK_SETUP 0x0060
-#define P30_CMD_LOCK_BLOCK 0x0001
-#define P30_CMD_UNLOCK_BLOCK 0x00D0
-#define P30_CMD_LOCK_DOWN_BLOCK 0x002F
-
-// PROTECTION Commands
-#define P30_CMD_PROGRAM_PROTECTION_REGISTER_SETUP 0x00C0
-
-// CONFIGURATION Commands
-#define P30_CMD_READ_CONFIGURATION_REGISTER_SETUP 0x0060
-#define P30_CMD_READ_CONFIGURATION_REGISTER 0x0003
-
-#define NOR_FLASH_SIGNATURE SIGNATURE_32('n', 'o', 'r', '0')
-#define INSTANCE_FROM_FVB_THIS(a) CR(a, NOR_FLASH_INSTANCE, FvbProtocol, NOR_FLASH_SIGNATURE)
-#define INSTANCE_FROM_BLKIO_THIS(a) CR(a, NOR_FLASH_INSTANCE, BlockIoProtocol, NOR_FLASH_SIGNATURE)
-#define INSTANCE_FROM_DISKIO_THIS(a) CR(a, NOR_FLASH_INSTANCE, DiskIoProtocol, NOR_FLASH_SIGNATURE)
-
-typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE;
-
-typedef EFI_STATUS (*NOR_FLASH_INITIALIZE) (NOR_FLASH_INSTANCE* Instance);
-
-typedef struct {
- VENDOR_DEVICE_PATH Vendor;
- EFI_DEVICE_PATH_PROTOCOL End;
-} NOR_FLASH_DEVICE_PATH;
-
-struct _NOR_FLASH_INSTANCE {
- UINT32 Signature;
- EFI_HANDLE Handle;
-
- BOOLEAN Initialized;
- NOR_FLASH_INITIALIZE Initialize;
-
- UINTN DeviceBaseAddress;
- UINTN RegionBaseAddress;
- UINTN Size;
- EFI_LBA StartLba;
-
- EFI_BLOCK_IO_PROTOCOL BlockIoProtocol;
- EFI_BLOCK_IO_MEDIA Media;
- EFI_DISK_IO_PROTOCOL DiskIoProtocol;
-
- BOOLEAN SupportFvb;
- EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL FvbProtocol;
- VOID* ShadowBuffer;
-
- NOR_FLASH_DEVICE_PATH DevicePath;
-};
-
-extern CONST EFI_GUID* CONST mNorFlashVariableGuid;
-
-EFI_STATUS
-NorFlashReadCfiData (
- IN UINTN DeviceBaseAddress,
- IN UINTN CFI_Offset,
- IN UINT32 NumberOfBytes,
- OUT UINT32 *Data
- );
-
-EFI_STATUS
-NorFlashWriteBuffer (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN TargetAddress,
- IN UINTN BufferSizeInBytes,
- IN UINT32 *Buffer
- );
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.Reset
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.ReadBlocks
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- OUT VOID *Buffer
-);
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.WriteBlocks
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- IN VOID *Buffer
-);
-
-//
-// BlockIO Protocol function EFI_BLOCK_IO_PROTOCOL.FlushBlocks
-//
-EFI_STATUS
-EFIAPI
-NorFlashBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
-);
-
-//
-// DiskIO Protocol function EFI_DISK_IO_PROTOCOL.ReadDisk
-//
-EFI_STATUS
-EFIAPI
-NorFlashDiskIoReadDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Offset,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- );
-
-//
-// DiskIO Protocol function EFI_DISK_IO_PROTOCOL.WriteDisk
-//
-EFI_STATUS
-EFIAPI
-NorFlashDiskIoWriteDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Offset,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-//
-// NorFlashFvbDxe.c
-//
-
-EFI_STATUS
-EFIAPI
-NorFlashFvbInitialize (
- IN NOR_FLASH_INSTANCE* Instance
- );
-
-EFI_STATUS
-EFIAPI
-FvbGetAttributes(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- );
-
-EFI_STATUS
-EFIAPI
-FvbSetAttributes(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- );
-
-EFI_STATUS
-EFIAPI
-FvbGetPhysicalAddress(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *Address
- );
-
-EFI_STATUS
-EFIAPI
-FvbGetBlockSize(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumberOfBlocks
- );
-
-EFI_STATUS
-EFIAPI
-FvbRead(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN OUT UINT8 *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-FvbWrite(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-FvbEraseBlocks(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- ...
- );
-
-//
-// NorFlashDxe.c
-//
-
-EFI_STATUS
-NorFlashUnlockAndEraseSingleBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN UINTN BlockAddress
- );
-
-EFI_STATUS
-NorFlashWriteSingleBlock (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- );
-
-EFI_STATUS
-NorFlashWriteBlocks (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- IN VOID *Buffer
- );
-
-EFI_STATUS
-NorFlashReadBlocks (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN BufferSizeInBytes,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-NorFlashRead (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINTN BufferSizeInBytes,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-NorFlashWrite (
- IN NOR_FLASH_INSTANCE *Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- );
-
-EFI_STATUS
-NorFlashReset (
- IN NOR_FLASH_INSTANCE *Instance
- );
-
-#endif /* __NOR_FLASH_DXE_H__ */
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
deleted file mode 100644
index 563d7573e7..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+++ /dev/null
@@ -1,73 +0,0 @@
-#/** @file
-#
-# Component description file for NorFlashDxe module
-#
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmVeNorFlashDxe
- FILE_GUID = 93E34C7E-B50E-11DF-9223-2443DFD72085
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = NorFlashInitialise
-
-[Sources.common]
- NorFlashDxe.c
- NorFlashFvbDxe.c
- NorFlashBlockIoDxe.c
- NorFlashVariableDep.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- BaseLib
- DebugLib
- HobLib
- NorFlashPlatformLib
- UefiLib
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- UefiRuntimeLib
- DxeServicesTableLib
-
-[Guids]
- gEfiSystemNvDataFvGuid
- gEfiVariableGuid
- gEfiEventVirtualAddressChangeGuid
-
-[Protocols]
- gEfiBlockIoProtocolGuid
- gEfiDevicePathProtocolGuid
- gEfiFirmwareVolumeBlockProtocolGuid
- gEfiDiskIoProtocolGuid
-
-[Pcd.common]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
-
- gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
-
-[Depex]
- #
- # NorFlashDxe must be loaded before VariableRuntimeDxe in case empty flash needs populating with default values
- #
- BEFORE gVariableRuntimeDxeFileGuid
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
deleted file mode 100644
index 3ed3bb945f..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*++ @file NorFlashFvbDxe.c
-
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- --*/
-
-#include <PiDxe.h>
-
-#include <Library/PcdLib.h>
-#include <Library/BaseLib.h>
-#include <Library/HobLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Guid/VariableFormat.h>
-#include <Guid/SystemNvDataGuid.h>
-
-#include "NorFlashDxe.h"
-
-STATIC EFI_EVENT mFvbVirtualAddrChangeEvent;
-STATIC UINTN mFlashNvStorageVariableBase;
-
-///
-/// The Firmware Volume Block Protocol is the low-level interface
-/// to a firmware volume. File-level access to a firmware volume
-/// should not be done using the Firmware Volume Block Protocol.
-/// Normal access to a firmware volume must use the Firmware
-/// Volume Protocol. Typically, only the file system driver that
-/// produces the Firmware Volume Protocol will bind to the
-/// Firmware Volume Block Protocol.
-///
-
-/**
- Initialises the FV Header and Variable Store Header
- to support variable operations.
-
- @param[in] Ptr - Location to initialise the headers
-
-**/
-EFI_STATUS
-InitializeFvAndVariableStoreHeaders (
- IN NOR_FLASH_INSTANCE *Instance
- )
-{
- EFI_STATUS Status;
- VOID* Headers;
- UINTN HeadersLength;
- EFI_FIRMWARE_VOLUME_HEADER *FirmwareVolumeHeader;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
-
- if (!Instance->Initialized && Instance->Initialize) {
- Instance->Initialize (Instance);
- }
-
- HeadersLength = sizeof(EFI_FIRMWARE_VOLUME_HEADER) + sizeof(EFI_FV_BLOCK_MAP_ENTRY) + sizeof(VARIABLE_STORE_HEADER);
- Headers = AllocateZeroPool(HeadersLength);
-
- // FirmwareVolumeHeader->FvLength is declared to have the Variable area AND the FTW working area AND the FTW Spare contiguous.
- ASSERT(PcdGet32(PcdFlashNvStorageVariableBase) + PcdGet32(PcdFlashNvStorageVariableSize) == PcdGet32(PcdFlashNvStorageFtwWorkingBase));
- ASSERT(PcdGet32(PcdFlashNvStorageFtwWorkingBase) + PcdGet32(PcdFlashNvStorageFtwWorkingSize) == PcdGet32(PcdFlashNvStorageFtwSpareBase));
-
- // Check if the size of the area is at least one block size
- ASSERT((PcdGet32(PcdFlashNvStorageVariableSize) > 0) && (PcdGet32(PcdFlashNvStorageVariableSize) / Instance->Media.BlockSize > 0));
- ASSERT((PcdGet32(PcdFlashNvStorageFtwWorkingSize) > 0) && (PcdGet32(PcdFlashNvStorageFtwWorkingSize) / Instance->Media.BlockSize > 0));
- ASSERT((PcdGet32(PcdFlashNvStorageFtwSpareSize) > 0) && (PcdGet32(PcdFlashNvStorageFtwSpareSize) / Instance->Media.BlockSize > 0));
-
- // Ensure the Variable area Base Addresses are aligned on a block size boundaries
- ASSERT(PcdGet32(PcdFlashNvStorageVariableBase) % Instance->Media.BlockSize == 0);
- ASSERT(PcdGet32(PcdFlashNvStorageFtwWorkingBase) % Instance->Media.BlockSize == 0);
- ASSERT(PcdGet32(PcdFlashNvStorageFtwSpareBase) % Instance->Media.BlockSize == 0);
-
- //
- // EFI_FIRMWARE_VOLUME_HEADER
- //
- FirmwareVolumeHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Headers;
- CopyGuid (&FirmwareVolumeHeader->FileSystemGuid, &gEfiSystemNvDataFvGuid);
- FirmwareVolumeHeader->FvLength =
- PcdGet32(PcdFlashNvStorageVariableSize) +
- PcdGet32(PcdFlashNvStorageFtwWorkingSize) +
- PcdGet32(PcdFlashNvStorageFtwSpareSize);
- FirmwareVolumeHeader->Signature = EFI_FVH_SIGNATURE;
- FirmwareVolumeHeader->Attributes = (EFI_FVB_ATTRIBUTES_2) (
- EFI_FVB2_READ_ENABLED_CAP | // Reads may be enabled
- EFI_FVB2_READ_STATUS | // Reads are currently enabled
- EFI_FVB2_STICKY_WRITE | // A block erase is required to flip bits into EFI_FVB2_ERASE_POLARITY
- EFI_FVB2_MEMORY_MAPPED | // It is memory mapped
- EFI_FVB2_ERASE_POLARITY | // After erasure all bits take this value (i.e. '1')
- EFI_FVB2_WRITE_STATUS | // Writes are currently enabled
- EFI_FVB2_WRITE_ENABLED_CAP // Writes may be enabled
- );
- FirmwareVolumeHeader->HeaderLength = sizeof(EFI_FIRMWARE_VOLUME_HEADER) + sizeof(EFI_FV_BLOCK_MAP_ENTRY);
- FirmwareVolumeHeader->Revision = EFI_FVH_REVISION;
- FirmwareVolumeHeader->BlockMap[0].NumBlocks = Instance->Media.LastBlock + 1;
- FirmwareVolumeHeader->BlockMap[0].Length = Instance->Media.BlockSize;
- FirmwareVolumeHeader->BlockMap[1].NumBlocks = 0;
- FirmwareVolumeHeader->BlockMap[1].Length = 0;
- FirmwareVolumeHeader->Checksum = CalculateCheckSum16 ((UINT16*)FirmwareVolumeHeader,FirmwareVolumeHeader->HeaderLength);
-
- //
- // VARIABLE_STORE_HEADER
- //
- VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)Headers + FirmwareVolumeHeader->HeaderLength);
- CopyGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid);
- VariableStoreHeader->Size = PcdGet32(PcdFlashNvStorageVariableSize) - FirmwareVolumeHeader->HeaderLength;
- VariableStoreHeader->Format = VARIABLE_STORE_FORMATTED;
- VariableStoreHeader->State = VARIABLE_STORE_HEALTHY;
-
- // Install the combined super-header in the NorFlash
- Status = FvbWrite (&Instance->FvbProtocol, 0, 0, &HeadersLength, Headers);
-
- FreePool (Headers);
- return Status;
-}
-
-/**
- Check the integrity of firmware volume header.
-
- @param[in] FwVolHeader - A pointer to a firmware volume header
-
- @retval EFI_SUCCESS - The firmware volume is consistent
- @retval EFI_NOT_FOUND - The firmware volume has been corrupted.
-
-**/
-EFI_STATUS
-ValidateFvHeader (
- IN NOR_FLASH_INSTANCE *Instance
- )
-{
- UINT16 Checksum;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
- UINTN VariableStoreLength;
- UINTN FvLength;
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Instance->RegionBaseAddress;
-
- FvLength = PcdGet32(PcdFlashNvStorageVariableSize) + PcdGet32(PcdFlashNvStorageFtwWorkingSize) +
- PcdGet32(PcdFlashNvStorageFtwSpareSize);
-
- //
- // Verify the header revision, header signature, length
- // Length of FvBlock cannot be 2**64-1
- // HeaderLength cannot be an odd number
- //
- if ( (FwVolHeader->Revision != EFI_FVH_REVISION)
- || (FwVolHeader->Signature != EFI_FVH_SIGNATURE)
- || (FwVolHeader->FvLength != FvLength)
- )
- {
- DEBUG ((EFI_D_ERROR, "ValidateFvHeader: No Firmware Volume header present\n"));
- return EFI_NOT_FOUND;
- }
-
- // Check the Firmware Volume Guid
- if( CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiSystemNvDataFvGuid) == FALSE ) {
- DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Firmware Volume Guid non-compatible\n"));
- return EFI_NOT_FOUND;
- }
-
- // Verify the header checksum
- Checksum = CalculateSum16((UINT16*)FwVolHeader, FwVolHeader->HeaderLength);
- if (Checksum != 0) {
- DEBUG ((EFI_D_ERROR, "ValidateFvHeader: FV checksum is invalid (Checksum:0x%X)\n",Checksum));
- return EFI_NOT_FOUND;
- }
-
- VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)FwVolHeader + FwVolHeader->HeaderLength);
-
- // Check the Variable Store Guid
- if (!CompareGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid)) {
- DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Variable Store Guid non-compatible\n"));
- return EFI_NOT_FOUND;
- }
-
- VariableStoreLength = PcdGet32 (PcdFlashNvStorageVariableSize) - FwVolHeader->HeaderLength;
- if (VariableStoreHeader->Size != VariableStoreLength) {
- DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Variable Store Length does not match\n"));
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- The GetAttributes() function retrieves the attributes and
- current settings of the block.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
-
- @param Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the attributes and
- current settings are returned.
- Type EFI_FVB_ATTRIBUTES_2 is defined in EFI_FIRMWARE_VOLUME_HEADER.
-
- @retval EFI_SUCCESS The firmware volume attributes were returned.
-
- **/
-EFI_STATUS
-EFIAPI
-FvbGetAttributes(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-{
- EFI_FVB_ATTRIBUTES_2 FlashFvbAttributes;
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_FVB_THIS(This);
-
- FlashFvbAttributes = (EFI_FVB_ATTRIBUTES_2) (
-
- EFI_FVB2_READ_ENABLED_CAP | // Reads may be enabled
- EFI_FVB2_READ_STATUS | // Reads are currently enabled
- EFI_FVB2_STICKY_WRITE | // A block erase is required to flip bits into EFI_FVB2_ERASE_POLARITY
- EFI_FVB2_MEMORY_MAPPED | // It is memory mapped
- EFI_FVB2_ERASE_POLARITY // After erasure all bits take this value (i.e. '1')
-
- );
-
- // Check if it is write protected
- if (Instance->Media.ReadOnly != TRUE) {
-
- FlashFvbAttributes = FlashFvbAttributes |
- EFI_FVB2_WRITE_STATUS | // Writes are currently enabled
- EFI_FVB2_WRITE_ENABLED_CAP; // Writes may be enabled
- }
-
- *Attributes = FlashFvbAttributes;
-
- DEBUG ((DEBUG_BLKIO, "FvbGetAttributes(0x%X)\n", *Attributes));
-
- return EFI_SUCCESS;
-}
-
-/**
- The SetAttributes() function sets configurable firmware volume attributes
- and returns the new settings of the firmware volume.
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
-
- @param Attributes On input, Attributes is a pointer to EFI_FVB_ATTRIBUTES_2
- that contains the desired firmware volume settings.
- On successful return, it contains the new settings of
- the firmware volume.
- Type EFI_FVB_ATTRIBUTES_2 is defined in EFI_FIRMWARE_VOLUME_HEADER.
-
- @retval EFI_SUCCESS The firmware volume attributes were returned.
-
- @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with the capabilities
- as declared in the firmware volume header.
-
- **/
-EFI_STATUS
-EFIAPI
-FvbSetAttributes(
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-{
- DEBUG ((DEBUG_BLKIO, "FvbSetAttributes(0x%X) is not supported\n",*Attributes));
- return EFI_UNSUPPORTED;
-}
-
-/**
- The GetPhysicalAddress() function retrieves the base address of
- a memory-mapped firmware volume. This function should be called
- only for memory-mapped firmware volumes.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
-
- @param Address Pointer to a caller-allocated
- EFI_PHYSICAL_ADDRESS that, on successful
- return from GetPhysicalAddress(), contains the
- base address of the firmware volume.
-
- @retval EFI_SUCCESS The firmware volume base address was returned.
-
- @retval EFI_NOT_SUPPORTED The firmware volume is not memory mapped.
-
- **/
-EFI_STATUS
-EFIAPI
-FvbGetPhysicalAddress (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *Address
- )
-{
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_FVB_THIS(This);
-
- DEBUG ((DEBUG_BLKIO, "FvbGetPhysicalAddress(BaseAddress=0x%08x)\n", Instance->RegionBaseAddress));
-
- ASSERT(Address != NULL);
-
- *Address = mFlashNvStorageVariableBase;
- return EFI_SUCCESS;
-}
-
-/**
- The GetBlockSize() function retrieves the size of the requested
- block. It also returns the number of additional blocks with
- the identical size. The GetBlockSize() function is used to
- retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER).
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
-
- @param Lba Indicates the block for which to return the size.
-
- @param BlockSize Pointer to a caller-allocated UINTN in which
- the size of the block is returned.
-
- @param NumberOfBlocks Pointer to a caller-allocated UINTN in
- which the number of consecutive blocks,
- starting with Lba, is returned. All
- blocks in this range have a size of
- BlockSize.
-
-
- @retval EFI_SUCCESS The firmware volume base address was returned.
-
- @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
-
- **/
-EFI_STATUS
-EFIAPI
-FvbGetBlockSize (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumberOfBlocks
- )
-{
- EFI_STATUS Status;
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_FVB_THIS(This);
-
- DEBUG ((DEBUG_BLKIO, "FvbGetBlockSize(Lba=%ld, BlockSize=0x%x, LastBlock=%ld)\n", Lba, Instance->Media.BlockSize, Instance->Media.LastBlock));
-
- if (Lba > Instance->Media.LastBlock) {
- DEBUG ((EFI_D_ERROR, "FvbGetBlockSize: ERROR - Parameter LBA %ld is beyond the last Lba (%ld).\n", Lba, Instance->Media.LastBlock));
- Status = EFI_INVALID_PARAMETER;
- } else {
- // This is easy because in this platform each NorFlash device has equal sized blocks.
- *BlockSize = (UINTN) Instance->Media.BlockSize;
- *NumberOfBlocks = (UINTN) (Instance->Media.LastBlock - Lba + 1);
-
- DEBUG ((DEBUG_BLKIO, "FvbGetBlockSize: *BlockSize=0x%x, *NumberOfBlocks=0x%x.\n", *BlockSize, *NumberOfBlocks));
-
- Status = EFI_SUCCESS;
- }
-
- return Status;
-}
-
-/**
- Reads the specified number of bytes into a buffer from the specified block.
-
- The Read() function reads the requested number of bytes from the
- requested block and stores them in the provided buffer.
- Implementations should be mindful that the firmware volume
- might be in the ReadDisabled state. If it is in this state,
- the Read() function must return the status code
- EFI_ACCESS_DENIED without modifying the contents of the
- buffer. The Read() function must also prevent spanning block
- boundaries. If a read is requested that would span a block
- boundary, the read must read up to the boundary but not
- beyond. The output parameter NumBytes must be set to correctly
- indicate the number of bytes actually read. The caller must be
- aware that a read may be partially completed.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
-
- @param Lba The starting logical block index from which to read.
-
- @param Offset Offset into the block at which to begin reading.
-
- @param NumBytes Pointer to a UINTN.
- At entry, *NumBytes contains the total size of the buffer.
- At exit, *NumBytes contains the total number of bytes read.
-
- @param Buffer Pointer to a caller-allocated buffer that will be used
- to hold the data that is read.
-
- @retval EFI_SUCCESS The firmware volume was read successfully, and contents are
- in Buffer.
-
- @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA boundary.
- On output, NumBytes contains the total number of bytes
- returned in Buffer.
-
- @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabled state.
-
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be read.
-
- **/
-EFI_STATUS
-EFIAPI
-FvbRead (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN OUT UINT8 *Buffer
- )
-{
- EFI_STATUS TempStatus;
- UINTN BlockSize;
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_FVB_THIS(This);
-
- DEBUG ((DEBUG_BLKIO, "FvbRead(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Instance->StartLba + Lba, Offset, *NumBytes, Buffer));
-
- if (!Instance->Initialized && Instance->Initialize) {
- Instance->Initialize(Instance);
- }
-
- TempStatus = EFI_SUCCESS;
-
- // Cache the block size to avoid de-referencing pointers all the time
- BlockSize = Instance->Media.BlockSize;
-
- DEBUG ((DEBUG_BLKIO, "FvbRead: Check if (Offset=0x%x + NumBytes=0x%x) <= BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
-
- // The read must not span block boundaries.
- // We need to check each variable individually because adding two large values together overflows.
- if ((Offset >= BlockSize) ||
- (*NumBytes > BlockSize) ||
- ((Offset + *NumBytes) > BlockSize)) {
- DEBUG ((EFI_D_ERROR, "FvbRead: ERROR - EFI_BAD_BUFFER_SIZE: (Offset=0x%x + NumBytes=0x%x) > BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // We must have some bytes to read
- if (*NumBytes == 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- // Decide if we are doing full block reads or not.
- if (*NumBytes % BlockSize != 0) {
- TempStatus = NorFlashRead (Instance, Instance->StartLba + Lba, Offset, *NumBytes, Buffer);
- if (EFI_ERROR (TempStatus)) {
- return EFI_DEVICE_ERROR;
- }
- } else {
- // Read NOR Flash data into shadow buffer
- TempStatus = NorFlashReadBlocks (Instance, Instance->StartLba + Lba, BlockSize, Buffer);
- if (EFI_ERROR (TempStatus)) {
- // Return one of the pre-approved error statuses
- return EFI_DEVICE_ERROR;
- }
- }
- return EFI_SUCCESS;
-}
-
-/**
- Writes the specified number of bytes from the input buffer to the block.
-
- The Write() function writes the specified number of bytes from
- the provided buffer to the specified block and offset. If the
- firmware volume is sticky write, the caller must ensure that
- all the bits of the specified range to write are in the
- EFI_FVB_ERASE_POLARITY state before calling the Write()
- function, or else the result will be unpredictable. This
- unpredictability arises because, for a sticky-write firmware
- volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY
- state but cannot flip it back again. Before calling the
- Write() function, it is recommended for the caller to first call
- the EraseBlocks() function to erase the specified block to
- write. A block erase cycle will transition bits from the
- (NOT)EFI_FVB_ERASE_POLARITY state back to the
- EFI_FVB_ERASE_POLARITY state. Implementations should be
- mindful that the firmware volume might be in the WriteDisabled
- state. If it is in this state, the Write() function must
- return the status code EFI_ACCESS_DENIED without modifying the
- contents of the firmware volume. The Write() function must
- also prevent spanning block boundaries. If a write is
- requested that spans a block boundary, the write must store up
- to the boundary but not beyond. The output parameter NumBytes
- must be set to correctly indicate the number of bytes actually
- written. The caller must be aware that a write may be
- partially completed. All writes, partial or otherwise, must be
- fully flushed to the hardware before the Write() service
- returns.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
-
- @param Lba The starting logical block index to write to.
-
- @param Offset Offset into the block at which to begin writing.
-
- @param NumBytes The pointer to a UINTN.
- At entry, *NumBytes contains the total size of the buffer.
- At exit, *NumBytes contains the total number of bytes actually written.
-
- @param Buffer The pointer to a caller-allocated buffer that contains the source for the write.
-
- @retval EFI_SUCCESS The firmware volume was written successfully.
-
- @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
- On output, NumBytes contains the total number of bytes
- actually written.
-
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
-
- @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not be written.
-
-
- **/
-EFI_STATUS
-EFIAPI
-FvbWrite (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_FVB_THIS (This);
-
- return NorFlashWriteSingleBlock (Instance, Instance->StartLba + Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Erases and initialises a firmware volume block.
-
- The EraseBlocks() function erases one or more blocks as denoted
- by the variable argument list. The entire parameter list of
- blocks must be verified before erasing any blocks. If a block is
- requested that does not exist within the associated firmware
- volume (it has a larger index than the last block of the
- firmware volume), the EraseBlocks() function must return the
- status code EFI_INVALID_PARAMETER without modifying the contents
- of the firmware volume. Implementations should be mindful that
- the firmware volume might be in the WriteDisabled state. If it
- is in this state, the EraseBlocks() function must return the
- status code EFI_ACCESS_DENIED without modifying the contents of
- the firmware volume. All calls to EraseBlocks() must be fully
- flushed to the hardware before the EraseBlocks() service
- returns.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
- instance.
-
- @param ... The variable argument list is a list of tuples.
- Each tuple describes a range of LBAs to erase
- and consists of the following:
- - An EFI_LBA that indicates the starting LBA
- - A UINTN that indicates the number of blocks to erase.
-
- The list is terminated with an EFI_LBA_LIST_TERMINATOR.
- For example, the following indicates that two ranges of blocks
- (5-7 and 10-11) are to be erased:
- EraseBlocks (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR);
-
- @retval EFI_SUCCESS The erase request successfully completed.
-
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
-
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be written.
- The firmware device may have been partially erased.
-
- @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable argument list do
- not exist in the firmware volume.
-
- **/
-EFI_STATUS
-EFIAPI
-FvbEraseBlocks (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
- ...
- )
-{
- EFI_STATUS Status;
- VA_LIST Args;
- UINTN BlockAddress; // Physical address of Lba to erase
- EFI_LBA StartingLba; // Lba from which we start erasing
- UINTN NumOfLba; // Number of Lba blocks to erase
- NOR_FLASH_INSTANCE *Instance;
-
- Instance = INSTANCE_FROM_FVB_THIS(This);
-
- DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks()\n"));
-
- Status = EFI_SUCCESS;
-
- // Detect WriteDisabled state
- if (Instance->Media.ReadOnly == TRUE) {
- // Firmware volume is in WriteDisabled state
- DEBUG ((EFI_D_ERROR, "FvbEraseBlocks: ERROR - Device is in WriteDisabled state.\n"));
- return EFI_ACCESS_DENIED;
- }
-
- // Before erasing, check the entire list of parameters to ensure all specified blocks are valid
-
- VA_START (Args, This);
- do {
- // Get the Lba from which we start erasing
- StartingLba = VA_ARG (Args, EFI_LBA);
-
- // Have we reached the end of the list?
- if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
- //Exit the while loop
- break;
- }
-
- // How many Lba blocks are we requested to erase?
- NumOfLba = VA_ARG (Args, UINT32);
-
- // All blocks must be within range
- DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks: Check if: ( StartingLba=%ld + NumOfLba=%d - 1 ) > LastBlock=%ld.\n", Instance->StartLba + StartingLba, NumOfLba, Instance->Media.LastBlock));
- if ((NumOfLba == 0) || ((Instance->StartLba + StartingLba + NumOfLba - 1) > Instance->Media.LastBlock)) {
- VA_END (Args);
- DEBUG ((EFI_D_ERROR, "FvbEraseBlocks: ERROR - Lba range goes past the last Lba.\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- } while (TRUE);
- VA_END (Args);
-
- //
- // To get here, all must be ok, so start erasing
- //
- VA_START (Args, This);
- do {
- // Get the Lba from which we start erasing
- StartingLba = VA_ARG (Args, EFI_LBA);
-
- // Have we reached the end of the list?
- if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
- // Exit the while loop
- break;
- }
-
- // How many Lba blocks are we requested to erase?
- NumOfLba = VA_ARG (Args, UINT32);
-
- // Go through each one and erase it
- while (NumOfLba > 0) {
-
- // Get the physical address of Lba to erase
- BlockAddress = GET_NOR_BLOCK_ADDRESS (
- Instance->RegionBaseAddress,
- Instance->StartLba + StartingLba,
- Instance->Media.BlockSize
- );
-
- // Erase it
- DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks: Erasing Lba=%ld @ 0x%08x.\n", Instance->StartLba + StartingLba, BlockAddress));
- Status = NorFlashUnlockAndEraseSingleBlock (Instance, BlockAddress);
- if (EFI_ERROR(Status)) {
- VA_END (Args);
- Status = EFI_DEVICE_ERROR;
- goto EXIT;
- }
-
- // Move to the next Lba
- StartingLba++;
- NumOfLba--;
- }
- } while (TRUE);
- VA_END (Args);
-
-EXIT:
- return Status;
-}
-
-/**
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-VOID
-EFIAPI
-FvbVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EfiConvertPointer (0x0, (VOID**)&mFlashNvStorageVariableBase);
- return;
-}
-
-EFI_STATUS
-EFIAPI
-NorFlashFvbInitialize (
- IN NOR_FLASH_INSTANCE* Instance
- )
-{
- EFI_STATUS Status;
- UINT32 FvbNumLba;
- EFI_BOOT_MODE BootMode;
- UINTN RuntimeMmioRegionSize;
-
- DEBUG((DEBUG_BLKIO,"NorFlashFvbInitialize\n"));
-
- Instance->Initialized = TRUE;
- mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);
-
- // Set the index of the first LBA for the FVB
- Instance->StartLba = (PcdGet32 (PcdFlashNvStorageVariableBase) - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
-
- BootMode = GetBootModeHob ();
- if (BootMode == BOOT_WITH_DEFAULT_SETTINGS) {
- Status = EFI_INVALID_PARAMETER;
- } else {
- // Determine if there is a valid header at the beginning of the NorFlash
- Status = ValidateFvHeader (Instance);
- }
-
- // Install the Default FVB header if required
- if (EFI_ERROR(Status)) {
- // There is no valid header, so time to install one.
- DEBUG((EFI_D_ERROR,"NorFlashFvbInitialize: ERROR - The FVB Header is not valid. Installing a correct one for this volume.\n"));
-
- // Erase all the NorFlash that is reserved for variable storage
- FvbNumLba = (PcdGet32(PcdFlashNvStorageVariableSize) + PcdGet32(PcdFlashNvStorageFtwWorkingSize) + PcdGet32(PcdFlashNvStorageFtwSpareSize)) / Instance->Media.BlockSize;
-
- Status = FvbEraseBlocks (&Instance->FvbProtocol, (EFI_LBA)0, FvbNumLba, EFI_LBA_LIST_TERMINATOR);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- // Install all appropriate headers
- Status = InitializeFvAndVariableStoreHeaders (Instance);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // Declare the Non-Volatile storage as EFI_MEMORY_RUNTIME
- //
-
- // Note: all the NOR Flash region needs to be reserved into the UEFI Runtime memory;
- // even if we only use the small block region at the top of the NOR Flash.
- // The reason is when the NOR Flash memory is set into program mode, the command
- // is written as the base of the flash region (ie: Instance->DeviceBaseAddress)
- RuntimeMmioRegionSize = (Instance->RegionBaseAddress - Instance->DeviceBaseAddress) + Instance->Size;
-
- Status = gDS->AddMemorySpace (
- EfiGcdMemoryTypeMemoryMappedIo,
- Instance->DeviceBaseAddress, RuntimeMmioRegionSize,
- EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gDS->SetMemorySpaceAttributes (
- Instance->DeviceBaseAddress, RuntimeMmioRegionSize,
- EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register for the virtual address change event
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- FvbVirtualNotifyEvent,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &mFvbVirtualAddrChangeEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c
deleted file mode 100644
index 4d52296ce1..0000000000
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/** @file NorFlashVariableDep.c
-
- Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-
-#include <Include/Guid/VariableFormat.h>
-
-CONST EFI_GUID* CONST mNorFlashVariableGuid = &gEfiVariableGuid;
diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
deleted file mode 100644
index 8b256de945..0000000000
--- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/** @file
- Serial I/O Port library functions with no library constructor/destructor
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-
-#include <Drivers/PL011Uart.h>
-
-//
-// EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE is the only
-// control bit that is not supported.
-//
-STATIC CONST UINT32 mInvalidControlBits = EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
-
-/*
-
- Initialise the serial port to the specified settings.
- All unspecified settings will be set to the default values.
-
- @return Always return EFI_SUCCESS or EFI_INVALID_PARAMETER.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartInitializePort (
- IN OUT UINTN UartBase,
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
- )
-{
- UINT32 LineControl;
- UINT32 Divisor;
-
- LineControl = 0;
-
- // The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept
- // 1 char buffer as the minimum fifo size. Because everything can be rounded down,
- // there is no maximum fifo size.
- if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= 32)) {
- LineControl |= PL011_UARTLCR_H_FEN;
- if (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) > PL011_VER_R1P4)
- *ReceiveFifoDepth = 32;
- else
- *ReceiveFifoDepth = 16;
- } else {
- ASSERT (*ReceiveFifoDepth < 32);
- // Nothing else to do. 1 byte fifo is default.
- *ReceiveFifoDepth = 1;
- }
-
- //
- // Parity
- //
- switch (*Parity) {
- case DefaultParity:
- *Parity = NoParity;
- case NoParity:
- // Nothing to do. Parity is disabled by default.
- break;
- case EvenParity:
- LineControl |= (PL011_UARTLCR_H_PEN | PL011_UARTLCR_H_EPS);
- break;
- case OddParity:
- LineControl |= PL011_UARTLCR_H_PEN;
- break;
- case MarkParity:
- LineControl |= (PL011_UARTLCR_H_PEN | PL011_UARTLCR_H_SPS | PL011_UARTLCR_H_EPS);
- break;
- case SpaceParity:
- LineControl |= (PL011_UARTLCR_H_PEN | PL011_UARTLCR_H_SPS);
- break;
- default:
- return RETURN_INVALID_PARAMETER;
- }
-
- //
- // Data Bits
- //
- switch (*DataBits) {
- case 0:
- *DataBits = 8;
- case 8:
- LineControl |= PL011_UARTLCR_H_WLEN_8;
- break;
- case 7:
- LineControl |= PL011_UARTLCR_H_WLEN_7;
- break;
- case 6:
- LineControl |= PL011_UARTLCR_H_WLEN_6;
- break;
- case 5:
- LineControl |= PL011_UARTLCR_H_WLEN_5;
- break;
- default:
- return RETURN_INVALID_PARAMETER;
- }
-
- //
- // Stop Bits
- //
- switch (*StopBits) {
- case DefaultStopBits:
- *StopBits = OneStopBit;
- case OneStopBit:
- // Nothing to do. One stop bit is enabled by default.
- break;
- case TwoStopBits:
- LineControl |= PL011_UARTLCR_H_STP2;
- break;
- case OneFiveStopBits:
- // Only 1 or 2 stops bits are supported
- default:
- return RETURN_INVALID_PARAMETER;
- }
-
- // Don't send the LineControl value to the PL011 yet,
- // wait until after the Baud Rate setting.
- // This ensures we do not mess up the UART settings halfway through
- // in the rare case when there is an error with the Baud Rate.
-
- //
- // Baud Rate
- //
-
- // If PL011 Integral value has been defined then always ignore the BAUD rate
- if (PcdGet32 (PL011UartInteger) != 0) {
- MmioWrite32 (UartBase + UARTIBRD, PcdGet32 (PL011UartInteger));
- MmioWrite32 (UartBase + UARTFBRD, PcdGet32 (PL011UartFractional));
- } else {
- // If BAUD rate is zero then replace it with the system default value
- if (*BaudRate == 0) {
- *BaudRate = PcdGet32 (PcdSerialBaudRate);
- ASSERT (*BaudRate != 0);
- }
-
- Divisor = (PcdGet32 (PL011UartClkInHz) * 4) / *BaudRate;
- MmioWrite32 (UartBase + UARTIBRD, Divisor >> 6);
- MmioWrite32 (UartBase + UARTFBRD, Divisor & 0x3F);
- }
-
- // No parity, 1 stop, no fifo, 8 data bits
- MmioWrite32 (UartBase + UARTLCR_H, LineControl);
-
- // Clear any pending errors
- MmioWrite32 (UartBase + UARTECR, 0);
-
- // Enable tx, rx, and uart overall
- MmioWrite32 (UartBase + UARTCR, PL011_UARTCR_RXE | PL011_UARTCR_TXE | PL011_UARTCR_UARTEN);
-
- return RETURN_SUCCESS;
-}
-
-/**
-
- Assert or deassert the control signals on a serial port.
- The following control signals are set according their bit settings :
- . Request to Send
- . Data Terminal Ready
-
- @param[in] UartBase UART registers base address
- @param[in] Control The following bits are taken into account :
- . EFI_SERIAL_REQUEST_TO_SEND : assert/deassert the
- "Request To Send" control signal if this bit is
- equal to one/zero.
- . EFI_SERIAL_DATA_TERMINAL_READY : assert/deassert
- the "Data Terminal Ready" control signal if this
- bit is equal to one/zero.
- . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : enable/disable
- the hardware loopback if this bit is equal to
- one/zero.
- . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : not supported.
- . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : enable/
- disable the hardware flow control based on CTS (Clear
- To Send) and RTS (Ready To Send) control signals.
-
- @retval RETURN_SUCCESS The new control bits were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartSetControl (
- IN UINTN UartBase,
- IN UINT32 Control
- )
-{
- UINT32 Bits;
-
- if (Control & (mInvalidControlBits)) {
- return RETURN_UNSUPPORTED;
- }
-
- Bits = MmioRead32 (UartBase + UARTCR);
-
- if (Control & EFI_SERIAL_REQUEST_TO_SEND) {
- Bits |= PL011_UARTCR_RTS;
- } else {
- Bits &= ~PL011_UARTCR_RTS;
- }
-
- if (Control & EFI_SERIAL_DATA_TERMINAL_READY) {
- Bits |= PL011_UARTCR_DTR;
- } else {
- Bits &= ~PL011_UARTCR_DTR;
- }
-
- if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) {
- Bits |= PL011_UARTCR_LBE;
- } else {
- Bits &= ~PL011_UARTCR_LBE;
- }
-
- if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) {
- Bits |= (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN);
- } else {
- Bits &= ~(PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN);
- }
-
- MmioWrite32 (UartBase + UARTCR, Bits);
-
- return RETURN_SUCCESS;
-}
-
-/**
-
- Retrieve the status of the control bits on a serial device.
-
- @param[in] UartBase UART registers base address
- @param[out] Control Status of the control bits on a serial device :
-
- . EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
- EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
- EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
- are all related to the DTE (Data Terminal Equipment) and
- DCE (Data Communication Equipment) modes of operation of
- the serial device.
- . EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
- buffer is empty, 0 otherwise.
- . EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
- buffer is empty, 0 otherwise.
- . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
- hardware loopback is enabled (the ouput feeds the receive
- buffer), 0 otherwise.
- . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
- loopback is accomplished by software, 0 otherwise.
- . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
- hardware flow control based on CTS (Clear To Send) and RTS
- (Ready To Send) control signals is enabled, 0 otherwise.
-
- @retval RETURN_SUCCESS The control bits were read from the serial device.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartGetControl (
- IN UINTN UartBase,
- OUT UINT32 *Control
- )
-{
- UINT32 FlagRegister;
- UINT32 ControlRegister;
-
-
- FlagRegister = MmioRead32 (UartBase + UARTFR);
- ControlRegister = MmioRead32 (UartBase + UARTCR);
-
- *Control = 0;
-
- if ((FlagRegister & PL011_UARTFR_CTS) == PL011_UARTFR_CTS) {
- *Control |= EFI_SERIAL_CLEAR_TO_SEND;
- }
-
- if ((FlagRegister & PL011_UARTFR_DSR) == PL011_UARTFR_DSR) {
- *Control |= EFI_SERIAL_DATA_SET_READY;
- }
-
- if ((FlagRegister & PL011_UARTFR_RI) == PL011_UARTFR_RI) {
- *Control |= EFI_SERIAL_RING_INDICATE;
- }
-
- if ((FlagRegister & PL011_UARTFR_DCD) == PL011_UARTFR_DCD) {
- *Control |= EFI_SERIAL_CARRIER_DETECT;
- }
-
- if ((ControlRegister & PL011_UARTCR_RTS) == PL011_UARTCR_RTS) {
- *Control |= EFI_SERIAL_REQUEST_TO_SEND;
- }
-
- if ((ControlRegister & PL011_UARTCR_DTR) == PL011_UARTCR_DTR) {
- *Control |= EFI_SERIAL_DATA_TERMINAL_READY;
- }
-
- if ((FlagRegister & PL011_UARTFR_RXFE) == PL011_UARTFR_RXFE) {
- *Control |= EFI_SERIAL_INPUT_BUFFER_EMPTY;
- }
-
- if ((FlagRegister & PL011_UARTFR_TXFE) == PL011_UARTFR_TXFE) {
- *Control |= EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
- }
-
- if ((ControlRegister & (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN))
- == (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN)) {
- *Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
- }
-
- if ((ControlRegister & PL011_UARTCR_LBE) == PL011_UARTCR_LBE) {
- *Control |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
- }
-
- return RETURN_SUCCESS;
-}
-
-/**
- Write data to serial device.
-
- @param Buffer Point of data buffer which need to be written.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes written to serial device.
-
-**/
-UINTN
-EFIAPI
-PL011UartWrite (
- IN UINTN UartBase,
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- UINT8* CONST Final = &Buffer[NumberOfBytes];
-
- while (Buffer < Final) {
- // Wait until UART able to accept another char
- while ((MmioRead32 (UartBase + UARTFR) & UART_TX_FULL_FLAG_MASK));
-
- MmioWrite8 (UartBase + UARTDR, *Buffer++);
- }
-
- return NumberOfBytes;
-}
-
-/**
- Read data from serial device and save the data in buffer.
-
- @param Buffer Point of data buffer which need to be written.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Actual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-PL011UartRead (
- IN UINTN UartBase,
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- UINTN Count;
-
- for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {
- while ((MmioRead32 (UartBase + UARTFR) & UART_RX_EMPTY_FLAG_MASK) != 0);
- *Buffer = MmioRead8 (UartBase + UARTDR);
- }
-
- return NumberOfBytes;
-}
-
-/**
- Check to see if any data is available to be read from the debug device.
-
- @retval EFI_SUCCESS At least one byte of data is available to be read
- @retval EFI_NOT_READY No data is available to be read
- @retval EFI_DEVICE_ERROR The serial device is not functioning properly
-
-**/
-BOOLEAN
-EFIAPI
-PL011UartPoll (
- IN UINTN UartBase
- )
-{
- return ((MmioRead32 (UartBase + UARTFR) & UART_RX_EMPTY_FLAG_MASK) == 0);
-}
diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
deleted file mode 100644
index 18df7c9fb9..0000000000
--- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
+++ /dev/null
@@ -1,42 +0,0 @@
-#/** @file
-#
-# Component description file for PL011Uart module
-#
-# Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL011Uart
- FILE_GUID = 4ec8b120-8307-11e0-bc91-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PL011UartLib
-
-[Sources.common]
- PL011Uart.c
-
-[LibraryClasses]
- DebugLib
- IoLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate
-
- gArmPlatformTokenSpaceGuid.PL011UartClkInHz
- gArmPlatformTokenSpaceGuid.PL011UartInteger
- gArmPlatformTokenSpaceGuid.PL011UartFractional
diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
deleted file mode 100644
index ff05662b88..0000000000
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-
-#include <PiDxe.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-
-#include <Protocol/EmbeddedGpio.h>
-#include <Drivers/PL061Gpio.h>
-
-BOOLEAN mPL061Initialized = FALSE;
-
-/**
- Function implementations
-**/
-
-EFI_STATUS
-PL061Identify (
- VOID
- )
-{
- // Check if this is a PrimeCell Peripheral
- if ( (MmioRead8 (PL061_GPIO_PCELL_ID0) != 0x0D)
- || (MmioRead8 (PL061_GPIO_PCELL_ID1) != 0xF0)
- || (MmioRead8 (PL061_GPIO_PCELL_ID2) != 0x05)
- || (MmioRead8 (PL061_GPIO_PCELL_ID3) != 0xB1)) {
- return EFI_NOT_FOUND;
- }
-
- // Check if this PrimeCell Peripheral is the PL061 GPIO
- if ( (MmioRead8 (PL061_GPIO_PERIPH_ID0) != 0x61)
- || (MmioRead8 (PL061_GPIO_PERIPH_ID1) != 0x10)
- || ((MmioRead8 (PL061_GPIO_PERIPH_ID2) & 0xF) != 0x04)
- || (MmioRead8 (PL061_GPIO_PERIPH_ID3) != 0x00)) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PL061Initialize (
- VOID
- )
-{
- EFI_STATUS Status;
-
- // Check if the PL061 GPIO module exists on board
- Status = PL061Identify();
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto EXIT;
- }
-
- // Do other hardware initialisation things here as required
-
- // Disable Interrupts
- //if (MmioRead8 (PL061_GPIO_IE_REG) != 0) {
- // // Ensure interrupts are disabled
- //}
-
- mPL061Initialized = TRUE;
-
- EXIT:
- return Status;
-}
-
-/**
-
-Routine Description:
-
- Gets the state of a GPIO pin
-
-Arguments:
-
- This - pointer to protocol
- Gpio - which pin to read
- Value - state of the pin
-
-Returns:
-
- EFI_SUCCESS - GPIO state returned in Value
- EFI_INVALID_PARAMETER - Value is NULL pointer or Gpio pin is out of range
-**/
-EFI_STATUS
-EFIAPI
-Get (
- IN EMBEDDED_GPIO *This,
- IN EMBEDDED_GPIO_PIN Gpio,
- OUT UINTN *Value
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
-
- if ( (Value == NULL)
- || (Gpio > LAST_GPIO_PIN))
- {
- return EFI_INVALID_PARAMETER;
- }
-
- // Initialize the hardware if not already done
- if (!mPL061Initialized) {
- Status = PL061Initialize();
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
-
- if (MmioRead8 (PL061_GPIO_DATA_REG) & GPIO_PIN_MASK_HIGH_8BIT(Gpio)) {
- *Value = 1;
- } else {
- *Value = 0;
- }
-
- EXIT:
- return Status;
-}
-
-/**
-
-Routine Description:
-
- Sets the state of a GPIO pin
-
-Arguments:
-
- This - pointer to protocol
- Gpio - which pin to modify
- Mode - mode to set
-
-Returns:
-
- EFI_SUCCESS - GPIO set as requested
- EFI_UNSUPPORTED - Mode is not supported
- EFI_INVALID_PARAMETER - Gpio pin is out of range
-**/
-EFI_STATUS
-EFIAPI
-Set (
- IN EMBEDDED_GPIO *This,
- IN EMBEDDED_GPIO_PIN Gpio,
- IN EMBEDDED_GPIO_MODE Mode
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
-
- // Check for errors
- if (Gpio > LAST_GPIO_PIN) {
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- // Initialize the hardware if not already done
- if (!mPL061Initialized) {
- Status = PL061Initialize();
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- }
-
- switch (Mode)
- {
- case GPIO_MODE_INPUT:
- // Set the corresponding direction bit to LOW for input
- MmioAnd8 (PL061_GPIO_DIR_REG, GPIO_PIN_MASK_LOW_8BIT(Gpio));
- break;
-
- case GPIO_MODE_OUTPUT_0:
- // Set the corresponding data bit to LOW for 0
- MmioAnd8 (PL061_GPIO_DATA_REG, GPIO_PIN_MASK_LOW_8BIT(Gpio));
- // Set the corresponding direction bit to HIGH for output
- MmioOr8 (PL061_GPIO_DIR_REG, GPIO_PIN_MASK_HIGH_8BIT(Gpio));
- break;
-
- case GPIO_MODE_OUTPUT_1:
- // Set the corresponding data bit to HIGH for 1
- MmioOr8 (PL061_GPIO_DATA_REG, GPIO_PIN_MASK_HIGH_8BIT(Gpio));
- // Set the corresponding direction bit to HIGH for output
- MmioOr8 (PL061_GPIO_DIR_REG, GPIO_PIN_MASK_HIGH_8BIT(Gpio));
- break;
-
- default:
- // Other modes are not supported
- return EFI_UNSUPPORTED;
- }
-
-EXIT:
- return Status;
-}
-
-/**
-
-Routine Description:
-
- Gets the mode (function) of a GPIO pin
-
-Arguments:
-
- This - pointer to protocol
- Gpio - which pin
- Mode - pointer to output mode value
-
-Returns:
-
- EFI_SUCCESS - mode value retrieved
- EFI_INVALID_PARAMETER - Mode is a null pointer or Gpio pin is out of range
-
-**/
-EFI_STATUS
-EFIAPI
-GetMode (
- IN EMBEDDED_GPIO *This,
- IN EMBEDDED_GPIO_PIN Gpio,
- OUT EMBEDDED_GPIO_MODE *Mode
- )
-{
- EFI_STATUS Status;
-
- // Check for errors
- if ( (Mode == NULL)
- || (Gpio > LAST_GPIO_PIN)) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Initialize the hardware if not already done
- if (!mPL061Initialized) {
- Status = PL061Initialize();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- // Check if it is input or output
- if (MmioRead8 (PL061_GPIO_DIR_REG) & GPIO_PIN_MASK_HIGH_8BIT(Gpio)) {
- // Pin set to output
- if (MmioRead8 (PL061_GPIO_DATA_REG) & GPIO_PIN_MASK_HIGH_8BIT(Gpio)) {
- *Mode = GPIO_MODE_OUTPUT_1;
- } else {
- *Mode = GPIO_MODE_OUTPUT_0;
- }
- } else {
- // Pin set to input
- *Mode = GPIO_MODE_INPUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
-
-Routine Description:
-
- Sets the pull-up / pull-down resistor of a GPIO pin
-
-Arguments:
-
- This - pointer to protocol
- Gpio - which pin
- Direction - pull-up, pull-down, or none
-
-Returns:
-
- EFI_UNSUPPORTED - Can not perform the requested operation
-
-**/
-EFI_STATUS
-EFIAPI
-SetPull (
- IN EMBEDDED_GPIO *This,
- IN EMBEDDED_GPIO_PIN Gpio,
- IN EMBEDDED_GPIO_PULL Direction
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- Protocol variable definition
- **/
-EMBEDDED_GPIO gGpio = {
- Get,
- Set,
- GetMode,
- SetPull
-};
-
-/**
- Initialize the state information for the Embedded Gpio protocol.
-
- @param ImageHandle of the loaded driver
- @param SystemTable Pointer to the System Table
-
- @retval EFI_SUCCESS Protocol registered
- @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
- @retval EFI_DEVICE_ERROR Hardware problems
-
-**/
-EFI_STATUS
-EFIAPI
-PL061InstallProtocol (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- //
- // Make sure the Gpio protocol has not been installed in the system yet.
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEmbeddedGpioProtocolGuid);
-
- // Install the Embedded GPIO Protocol onto a new handle
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Handle,
- &gEmbeddedGpioProtocolGuid, &gGpio,
- NULL
- );
- if (EFI_ERROR(Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
deleted file mode 100644
index 9d9e4cd678..0000000000
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL061GpioDxe
- FILE_GUID = 5c1997d7-8d45-4f21-af3c-2206b8ed8bec
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PL061InstallProtocol
-[Sources.common]
- PL061Gpio.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- DebugLib
- IoLib
- PcdLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiLib
- UefiRuntimeServicesTableLib
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdPL061GpioBase
-
-[Protocols]
- gEmbeddedGpioProtocolGuid
-
-[Depex]
- TRUE
diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c
deleted file mode 100644
index 688cd8a98c..0000000000
--- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/** @file
- This file implement the MMC Host Protocol for the ARM PrimeCell PL180.
-
- Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "PL180Mci.h"
-
-#include <Library/DevicePathLib.h>
-#include <Library/BaseMemoryLib.h>
-
-EFI_MMC_HOST_PROTOCOL *gpMmcHost;
-
-// Untested ...
-//#define USE_STREAM
-
-#define MMCI0_BLOCKLEN 512
-#define MMCI0_POW2_BLOCKLEN 9
-#define MMCI0_TIMEOUT 1000
-
-#define SYS_MCI_CARDIN BIT0
-#define SYS_MCI_WPROT BIT1
-
-BOOLEAN
-MciIsPowerOn (
- VOID
- )
-{
- return ((MmioRead32 (MCI_POWER_CONTROL_REG) & MCI_POWER_ON) == MCI_POWER_ON);
-}
-
-EFI_STATUS
-MciInitialize (
- VOID
- )
-{
- MCI_TRACE ("MciInitialize()");
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-MciIsCardPresent (
- IN EFI_MMC_HOST_PROTOCOL *This
- )
-{
- return (MmioRead32 (FixedPcdGet32 (PcdPL180SysMciRegAddress)) & SYS_MCI_CARDIN);
-}
-
-BOOLEAN
-MciIsReadOnly (
- IN EFI_MMC_HOST_PROTOCOL *This
- )
-{
- return (MmioRead32 (FixedPcdGet32 (PcdPL180SysMciRegAddress)) & SYS_MCI_WPROT);
-}
-
-#if 0
-//Note: This function has been commented out because it is not used yet.
-// This function could be used to remove the hardcoded BlockLen used
-// in MciPrepareDataPath
-
-// Convert block size to 2^n
-STATIC
-UINT32
-GetPow2BlockLen (
- IN UINT32 BlockLen
- )
-{
- UINTN Loop;
- UINTN Pow2BlockLen;
-
- Loop = 0x8000;
- Pow2BlockLen = 15;
- do {
- Loop = (Loop >> 1) & 0xFFFF;
- Pow2BlockLen--;
- } while (Pow2BlockLen && (!(Loop & BlockLen)));
-
- return Pow2BlockLen;
-}
-#endif
-
-VOID
-MciPrepareDataPath (
- IN UINTN TransferDirection
- )
-{
- // Set Data Length & Data Timer
- MmioWrite32 (MCI_DATA_TIMER_REG, 0xFFFFFFF);
- MmioWrite32 (MCI_DATA_LENGTH_REG, MMCI0_BLOCKLEN);
-
-#ifndef USE_STREAM
- //Note: we are using a hardcoded BlockLen (==512). If we decide to use a variable size, we could
- // compute the pow2 of BlockLen with the above function GetPow2BlockLen ()
- MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_DMA_ENABLE | TransferDirection | (MMCI0_POW2_BLOCKLEN << 4));
-#else
- MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_DMA_ENABLE | TransferDirection | MCI_DATACTL_STREAM_TRANS);
-#endif
-}
-
-EFI_STATUS
-MciSendCommand (
- IN EFI_MMC_HOST_PROTOCOL *This,
- IN MMC_CMD MmcCmd,
- IN UINT32 Argument
- )
-{
- UINT32 Status;
- UINT32 Cmd;
- UINTN RetVal;
- UINTN CmdCtrlReg;
- UINT32 DoneMask;
-
- RetVal = EFI_SUCCESS;
-
- if ((MmcCmd == MMC_CMD17) || (MmcCmd == MMC_CMD11)) {
- MciPrepareDataPath (MCI_DATACTL_CARD_TO_CONT);
- } else if ((MmcCmd == MMC_CMD24) || (MmcCmd == MMC_CMD20)) {
- MciPrepareDataPath (MCI_DATACTL_CONT_TO_CARD);
- }
-
- // Create Command for PL180
- Cmd = (MMC_GET_INDX (MmcCmd) & INDX_MASK) | MCI_CPSM_ENABLE;
- if (MmcCmd & MMC_CMD_WAIT_RESPONSE) {
- Cmd |= MCI_CPSM_WAIT_RESPONSE;
- }
-
- if (MmcCmd & MMC_CMD_LONG_RESPONSE) {
- Cmd |= MCI_CPSM_LONG_RESPONSE;
- }
-
- // Clear Status register static flags
- MmioWrite32 (MCI_CLEAR_STATUS_REG, MCI_CLR_ALL_STATUS);
-
- // Write to command argument register
- MmioWrite32 (MCI_ARGUMENT_REG, Argument);
-
- // Write to command register
- MmioWrite32 (MCI_COMMAND_REG, Cmd);
-
- DoneMask = (Cmd & MCI_CPSM_WAIT_RESPONSE)
- ? (MCI_STATUS_CMD_RESPEND | MCI_STATUS_CMD_ERROR)
- : (MCI_STATUS_CMD_SENT | MCI_STATUS_CMD_ERROR);
- do {
- Status = MmioRead32 (MCI_STATUS_REG);
- } while (! (Status & DoneMask));
-
- if ((Status & MCI_STATUS_CMD_ERROR)) {
- // Clear Status register error flags
- MmioWrite32 (MCI_CLEAR_STATUS_REG, MCI_STATUS_CMD_ERROR);
-
- if ((Status & MCI_STATUS_CMD_START_BIT_ERROR)) {
- DEBUG ((EFI_D_ERROR, "MciSendCommand(CmdIndex:%d) Start bit Error! Response:0x%X Status:0x%x\n", (Cmd & 0x3F), MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_NO_RESPONSE;
- } else if ((Status & MCI_STATUS_CMD_CMDTIMEOUT)) {
- //DEBUG ((EFI_D_ERROR, "MciSendCommand(CmdIndex:%d) TIMEOUT! Response:0x%X Status:0x%x\n", (Cmd & 0x3F), MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_TIMEOUT;
- } else if ((!(MmcCmd & MMC_CMD_NO_CRC_RESPONSE)) && (Status & MCI_STATUS_CMD_CMDCRCFAIL)) {
- // The CMD1 and response type R3 do not contain CRC. We should ignore the CRC failed Status.
- RetVal = EFI_CRC_ERROR;
- }
- }
-
- // Disable Command Path
- CmdCtrlReg = MmioRead32 (MCI_COMMAND_REG);
- MmioWrite32 (MCI_COMMAND_REG, (CmdCtrlReg & ~MCI_CPSM_ENABLE));
- return RetVal;
-}
-
-EFI_STATUS
-MciReceiveResponse (
- IN EFI_MMC_HOST_PROTOCOL *This,
- IN MMC_RESPONSE_TYPE Type,
- IN UINT32* Buffer
- )
-{
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ( (Type == MMC_RESPONSE_TYPE_R1)
- || (Type == MMC_RESPONSE_TYPE_R1b)
- || (Type == MMC_RESPONSE_TYPE_R3)
- || (Type == MMC_RESPONSE_TYPE_R6)
- || (Type == MMC_RESPONSE_TYPE_R7))
- {
- Buffer[0] = MmioRead32 (MCI_RESPONSE3_REG);
- } else if (Type == MMC_RESPONSE_TYPE_R2) {
- Buffer[0] = MmioRead32 (MCI_RESPONSE0_REG);
- Buffer[1] = MmioRead32 (MCI_RESPONSE1_REG);
- Buffer[2] = MmioRead32 (MCI_RESPONSE2_REG);
- Buffer[3] = MmioRead32 (MCI_RESPONSE3_REG);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-MciReadBlockData (
- IN EFI_MMC_HOST_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Length,
- IN UINT32* Buffer
- )
-{
- UINTN Loop;
- UINTN Finish;
- UINTN Status;
- EFI_STATUS RetVal;
- UINTN DataCtrlReg;
- EFI_TPL Tpl;
-
- RetVal = EFI_SUCCESS;
-
- // Read data from the RX FIFO
- Loop = 0;
- Finish = MMCI0_BLOCKLEN / 4;
-
- // Raise the TPL at the highest level to disable Interrupts.
- Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- do {
- // Read the Status flags
- Status = MmioRead32 (MCI_STATUS_REG);
-
- // Do eight reads if possible else a single read
- if (Status & MCI_STATUS_CMD_RXFIFOHALFFULL) {
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- } else if (Status & MCI_STATUS_CMD_RXDATAAVAILBL) {
- Buffer[Loop] = MmioRead32(MCI_FIFO_REG);
- Loop++;
- } else {
- //Check for error conditions and timeouts
- if (Status & MCI_STATUS_CMD_DATATIMEOUT) {
- DEBUG ((EFI_D_ERROR, "MciReadBlockData(): TIMEOUT! Response:0x%X Status:0x%x\n", MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_TIMEOUT;
- break;
- } else if (Status & MCI_STATUS_CMD_DATACRCFAIL) {
- DEBUG ((EFI_D_ERROR, "MciReadBlockData(): CRC Error! Response:0x%X Status:0x%x\n", MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_CRC_ERROR;
- break;
- } else if (Status & MCI_STATUS_CMD_START_BIT_ERROR) {
- DEBUG ((EFI_D_ERROR, "MciReadBlockData(): Start-bit Error! Response:0x%X Status:0x%x\n", MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_NO_RESPONSE;
- break;
- }
- }
- //clear RX over run flag
- if(Status & MCI_STATUS_CMD_RXOVERRUN) {
- MmioWrite32(MCI_CLEAR_STATUS_REG, MCI_STATUS_CMD_RXOVERRUN);
- }
- } while ((Loop < Finish));
-
- // Restore Tpl
- gBS->RestoreTPL (Tpl);
-
- // Clear Status flags
- MmioWrite32 (MCI_CLEAR_STATUS_REG, MCI_CLR_ALL_STATUS);
-
- //Disable Data path
- DataCtrlReg = MmioRead32 (MCI_DATA_CTL_REG);
- MmioWrite32 (MCI_DATA_CTL_REG, (DataCtrlReg & MCI_DATACTL_DISABLE_MASK));
-
- return RetVal;
-}
-
-EFI_STATUS
-MciWriteBlockData (
- IN EFI_MMC_HOST_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Length,
- IN UINT32* Buffer
- )
-{
- UINTN Loop;
- UINTN Finish;
- UINTN Timer;
- UINTN Status;
- EFI_STATUS RetVal;
- UINTN DataCtrlReg;
- EFI_TPL Tpl;
-
- RetVal = EFI_SUCCESS;
-
- // Write the data to the TX FIFO
- Loop = 0;
- Finish = MMCI0_BLOCKLEN / 4;
- Timer = MMCI0_TIMEOUT * 100;
-
- // Raise the TPL at the highest level to disable Interrupts.
- Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- do {
- // Read the Status flags
- Status = MmioRead32 (MCI_STATUS_REG);
-
- // Do eight writes if possible else a single write
- if (Status & MCI_STATUS_CMD_TXFIFOHALFEMPTY) {
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- } else if (!(Status & MCI_STATUS_CMD_TXFIFOFULL)) {
- MmioWrite32(MCI_FIFO_REG, Buffer[Loop]);
- Loop++;
- } else {
- // Check for error conditions and timeouts
- if (Status & MCI_STATUS_CMD_DATATIMEOUT) {
- DEBUG ((EFI_D_ERROR, "MciWriteBlockData(): TIMEOUT! Response:0x%X Status:0x%x\n", MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_TIMEOUT;
- goto Exit;
- } else if (Status & MCI_STATUS_CMD_DATACRCFAIL) {
- DEBUG ((EFI_D_ERROR, "MciWriteBlockData(): CRC Error! Response:0x%X Status:0x%x\n", MmioRead32 (MCI_RESPONSE0_REG), Status));
- RetVal = EFI_CRC_ERROR;
- goto Exit;
- } else if (Status & MCI_STATUS_CMD_TX_UNDERRUN) {
- DEBUG ((EFI_D_ERROR, "MciWriteBlockData(): TX buffer Underrun! Response:0x%X Status:0x%x, Number of bytes written 0x%x\n",MmioRead32(MCI_RESPONSE0_REG),Status, Loop));
- RetVal = EFI_BUFFER_TOO_SMALL;
- ASSERT(0);
- goto Exit;
- }
- }
- } while (Loop < Finish);
-
- // Restore Tpl
- gBS->RestoreTPL (Tpl);
-
- // Wait for FIFO to drain
- Timer = MMCI0_TIMEOUT * 60;
- Status = MmioRead32 (MCI_STATUS_REG);
-#ifndef USE_STREAM
- // Single block
- while (((Status & MCI_STATUS_TXDONE) != MCI_STATUS_TXDONE) && Timer) {
-#else
- // Stream
- while (((Status & MCI_STATUS_CMD_DATAEND) != MCI_STATUS_CMD_DATAEND) && Timer) {
-#endif
- NanoSecondDelay(10);
- Status = MmioRead32 (MCI_STATUS_REG);
- Timer--;
- }
-
- // Clear Status flags
- MmioWrite32 (MCI_CLEAR_STATUS_REG, MCI_CLR_ALL_STATUS);
-
- if (Timer == 0) {
- DEBUG ((EFI_D_ERROR, "MciWriteBlockData(): Data End timeout Number of words written 0x%x\n", Loop));
- RetVal = EFI_TIMEOUT;
- }
-
-Exit:
- // Disable Data path
- DataCtrlReg = MmioRead32 (MCI_DATA_CTL_REG);
- MmioWrite32 (MCI_DATA_CTL_REG, (DataCtrlReg & MCI_DATACTL_DISABLE_MASK));
- return RetVal;
-}
-
-EFI_STATUS
-MciNotifyState (
- IN EFI_MMC_HOST_PROTOCOL *This,
- IN MMC_STATE State
- )
-{
- UINT32 Data32;
-
- switch (State) {
- case MmcInvalidState:
- ASSERT (0);
- break;
- case MmcHwInitializationState:
- // If device already turn on then restart it
- Data32 = MmioRead32 (MCI_POWER_CONTROL_REG);
- if ((Data32 & 0x2) == MCI_POWER_UP) {
- MCI_TRACE ("MciNotifyState(MmcHwInitializationState): TurnOff MCI");
-
- // Turn off
- MmioWrite32 (MCI_CLOCK_CONTROL_REG, 0);
- MmioWrite32 (MCI_POWER_CONTROL_REG, 0);
- MicroSecondDelay (100);
- }
-
- MCI_TRACE ("MciNotifyState(MmcHwInitializationState): TurnOn MCI");
- // Setup clock
- // - 0x1D = 29 => should be the clock divider to be less than 400kHz at MCLK = 24Mhz
- MmioWrite32 (MCI_CLOCK_CONTROL_REG, 0x1D | MCI_CLOCK_ENABLE | MCI_CLOCK_POWERSAVE);
-
- // Set the voltage
- MmioWrite32 (MCI_POWER_CONTROL_REG, MCI_POWER_OPENDRAIN | (15<<2));
- MmioWrite32 (MCI_POWER_CONTROL_REG, MCI_POWER_ROD | MCI_POWER_OPENDRAIN | (15<<2) | MCI_POWER_UP);
- MicroSecondDelay (10);
- MmioWrite32 (MCI_POWER_CONTROL_REG, MCI_POWER_ROD | MCI_POWER_OPENDRAIN | (15<<2) | MCI_POWER_ON);
- MicroSecondDelay (100);
-
- // Set Data Length & Data Timer
- MmioWrite32 (MCI_DATA_TIMER_REG, 0xFFFFF);
- MmioWrite32 (MCI_DATA_LENGTH_REG, 8);
-
- ASSERT ((MmioRead32 (MCI_POWER_CONTROL_REG) & 0x3) == MCI_POWER_ON);
- break;
- case MmcIdleState:
- MCI_TRACE ("MciNotifyState(MmcIdleState)");
- break;
- case MmcReadyState:
- MCI_TRACE ("MciNotifyState(MmcReadyState)");
- break;
- case MmcIdentificationState:
- MCI_TRACE ("MciNotifyState (MmcIdentificationState)");
- break;
- case MmcStandByState:{
- volatile UINT32 PwrCtrlReg;
- MCI_TRACE ("MciNotifyState (MmcStandByState)");
-
- // Enable MCICMD push-pull drive
- PwrCtrlReg = MmioRead32 (MCI_POWER_CONTROL_REG);
- //Disable Open Drain output
- PwrCtrlReg &= ~ (MCI_POWER_OPENDRAIN);
- MmioWrite32 (MCI_POWER_CONTROL_REG, PwrCtrlReg);
-
- // Set MMCI0 clock to 4MHz (24MHz may be possible with cache enabled)
- //
- // Note: Increasing clock speed causes TX FIFO under-run errors.
- // So careful when optimising this driver for higher performance.
- //
- MmioWrite32(MCI_CLOCK_CONTROL_REG,0x02 | MCI_CLOCK_ENABLE | MCI_CLOCK_POWERSAVE);
- // Set MMCI0 clock to 24MHz (by bypassing the divider)
- //MmioWrite32(MCI_CLOCK_CONTROL_REG,MCI_CLOCK_BYPASS | MCI_CLOCK_ENABLE);
- break;
- }
- case MmcTransferState:
- //MCI_TRACE ("MciNotifyState(MmcTransferState)");
- break;
- case MmcSendingDataState:
- MCI_TRACE ("MciNotifyState(MmcSendingDataState)");
- break;
- case MmcReceiveDataState:
- MCI_TRACE ("MciNotifyState(MmcReceiveDataState)");
- break;
- case MmcProgrammingState:
- MCI_TRACE ("MciNotifyState(MmcProgrammingState)");
- break;
- case MmcDisconnectState:
- MCI_TRACE ("MciNotifyState(MmcDisconnectState)");
- break;
- default:
- ASSERT (0);
- }
- return EFI_SUCCESS;
-}
-
-EFI_GUID mPL180MciDevicePathGuid = EFI_CALLER_ID_GUID;
-
-EFI_STATUS
-MciBuildDevicePath (
- IN EFI_MMC_HOST_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL **DevicePath
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
-
- NewDevicePathNode = CreateDeviceNode (HARDWARE_DEVICE_PATH, HW_VENDOR_DP, sizeof (VENDOR_DEVICE_PATH));
- CopyGuid (& ((VENDOR_DEVICE_PATH*)NewDevicePathNode)->Guid, &mPL180MciDevicePathGuid);
-
- *DevicePath = NewDevicePathNode;
- return EFI_SUCCESS;
-}
-
-EFI_MMC_HOST_PROTOCOL gMciHost = {
- MMC_HOST_PROTOCOL_REVISION,
- MciIsCardPresent,
- MciIsReadOnly,
- MciBuildDevicePath,
- MciNotifyState,
- MciSendCommand,
- MciReceiveResponse,
- MciReadBlockData,
- MciWriteBlockData
-};
-
-EFI_STATUS
-PL180MciDxeInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- DEBUG ((EFI_D_WARN, "Probing ID registers at 0x%lx for a PL180\n",
- MCI_PERIPH_ID_REG0));
-
- // Check if this is a PL180
- if (MmioRead8 (MCI_PERIPH_ID_REG0) != MCI_PERIPH_ID0 ||
- MmioRead8 (MCI_PERIPH_ID_REG1) != MCI_PERIPH_ID1 ||
- MmioRead8 (MCI_PERIPH_ID_REG2) != MCI_PERIPH_ID2 ||
- MmioRead8 (MCI_PERIPH_ID_REG3) != MCI_PERIPH_ID3 ||
- MmioRead8 (MCI_PCELL_ID_REG0) != MCI_PCELL_ID0 ||
- MmioRead8 (MCI_PCELL_ID_REG1) != MCI_PCELL_ID1 ||
- MmioRead8 (MCI_PCELL_ID_REG2) != MCI_PCELL_ID2 ||
- MmioRead8 (MCI_PCELL_ID_REG3) != MCI_PCELL_ID3) {
-
- return EFI_NOT_FOUND;
- }
-
- Handle = NULL;
-
- MCI_TRACE ("PL180MciDxeInitialize()");
-
- //Publish Component Name, BlockIO protocol interfaces
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiMmcHostProtocolGuid, &gMciHost,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.h b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.h
deleted file mode 100644
index ce38a9e706..0000000000
--- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/** @file
- Header for the MMC Host Protocol implementation for the ARM PrimeCell PL180.
-
- Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __PL180_MCI_H
-#define __PL180_MCI_H
-
-#include <Uefi.h>
-
-#include <Protocol/MmcHost.h>
-
-#include <Library/UefiLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/IoLib.h>
-#include <Library/TimerLib.h>
-#include <Library/PcdLib.h>
-
-#define PL180_MCI_DXE_VERSION 0x10
-
-#define MCI_SYSCTL FixedPcdGet32 (PcdPL180MciBaseAddress)
-
-#define MCI_POWER_CONTROL_REG (MCI_SYSCTL + 0x000)
-#define MCI_CLOCK_CONTROL_REG (MCI_SYSCTL + 0x004)
-#define MCI_ARGUMENT_REG (MCI_SYSCTL + 0x008)
-#define MCI_COMMAND_REG (MCI_SYSCTL + 0x00C)
-#define MCI_RESPCMD_REG (MCI_SYSCTL + 0x010)
-#define MCI_RESPONSE3_REG (MCI_SYSCTL + 0x014)
-#define MCI_RESPONSE2_REG (MCI_SYSCTL + 0x018)
-#define MCI_RESPONSE1_REG (MCI_SYSCTL + 0x01C)
-#define MCI_RESPONSE0_REG (MCI_SYSCTL + 0x020)
-#define MCI_DATA_TIMER_REG (MCI_SYSCTL + 0x024)
-#define MCI_DATA_LENGTH_REG (MCI_SYSCTL + 0x028)
-#define MCI_DATA_CTL_REG (MCI_SYSCTL + 0x02C)
-#define MCI_DATA_COUNTER (MCI_SYSCTL + 0x030)
-#define MCI_STATUS_REG (MCI_SYSCTL + 0x034)
-#define MCI_CLEAR_STATUS_REG (MCI_SYSCTL + 0x038)
-#define MCI_INT0_MASK_REG (MCI_SYSCTL + 0x03C)
-#define MCI_INT1_MASK_REG (MCI_SYSCTL + 0x040)
-#define MCI_SELECT_REG (MCI_SYSCTL + 0x044)
-#define MCI_FIFOCOUNT_REG (MCI_SYSCTL + 0x048)
-#define MCI_FIFO_REG (MCI_SYSCTL + 0x080)
-#define MCI_PERIPH_ID_REG0 (MCI_SYSCTL + 0xFE0)
-#define MCI_PERIPH_ID_REG1 (MCI_SYSCTL + 0xFE4)
-#define MCI_PERIPH_ID_REG2 (MCI_SYSCTL + 0xFE8)
-#define MCI_PERIPH_ID_REG3 (MCI_SYSCTL + 0xFEC)
-#define MCI_PCELL_ID_REG0 (MCI_SYSCTL + 0xFF0)
-#define MCI_PCELL_ID_REG1 (MCI_SYSCTL + 0xFF4)
-#define MCI_PCELL_ID_REG2 (MCI_SYSCTL + 0xFF8)
-#define MCI_PCELL_ID_REG3 (MCI_SYSCTL + 0xFFC)
-
-#define MCI_PERIPH_ID0 0x80
-#define MCI_PERIPH_ID1 0x11
-#define MCI_PERIPH_ID2 0x04
-#define MCI_PERIPH_ID3 0x00
-#define MCI_PCELL_ID0 0x0D
-#define MCI_PCELL_ID1 0xF0
-#define MCI_PCELL_ID2 0x05
-#define MCI_PCELL_ID3 0xB1
-
-#define MCI_POWER_OFF 0
-#define MCI_POWER_UP BIT1
-#define MCI_POWER_ON (BIT1 | BIT0)
-#define MCI_POWER_OPENDRAIN BIT6
-#define MCI_POWER_ROD BIT7
-
-#define MCI_CLOCK_ENABLE BIT8
-#define MCI_CLOCK_POWERSAVE BIT9
-#define MCI_CLOCK_BYPASS BIT10
-#define MCI_CLOCK_WIDEBUS BIT11
-
-#define MCI_STATUS_CMD_CMDCRCFAIL BIT0
-#define MCI_STATUS_CMD_DATACRCFAIL BIT1
-#define MCI_STATUS_CMD_CMDTIMEOUT BIT2
-#define MCI_STATUS_CMD_DATATIMEOUT BIT3
-#define MCI_STATUS_CMD_TX_UNDERRUN BIT4
-#define MCI_STATUS_CMD_RXOVERRUN BIT5
-#define MCI_STATUS_CMD_RESPEND BIT6
-#define MCI_STATUS_CMD_SENT BIT7
-#define MCI_STATUS_CMD_DATAEND BIT8
-#define MCI_STATUS_CMD_START_BIT_ERROR BIT9
-#define MCI_STATUS_CMD_DATABLOCKEND BIT10
-#define MCI_STATUS_CMD_ACTIVE BIT11
-#define MCI_STATUS_CMD_TXACTIVE BIT12
-#define MCI_STATUS_CMD_RXACTIVE BIT13
-#define MCI_STATUS_CMD_TXFIFOHALFEMPTY BIT14
-#define MCI_STATUS_CMD_RXFIFOHALFFULL BIT15
-#define MCI_STATUS_CMD_TXFIFOFULL BIT16
-#define MCI_STATUS_CMD_RXFIFOFULL BIT17
-#define MCI_STATUS_CMD_TXFIFOEMPTY BIT18
-#define MCI_STATUS_CMD_RXFIFOEMPTY BIT19
-#define MCI_STATUS_CMD_TXDATAAVAILBL BIT20
-#define MCI_STATUS_CMD_RXDATAAVAILBL BIT21
-
-#define MCI_STATUS_TXDONE (MCI_STATUS_CMD_DATAEND | MCI_STATUS_CMD_DATABLOCKEND)
-#define MCI_STATUS_RXDONE (MCI_STATUS_CMD_DATAEND | MCI_STATUS_CMD_DATABLOCKEND)
-#define MCI_STATUS_READ_ERROR ( MCI_STATUS_CMD_DATACRCFAIL \
- | MCI_STATUS_CMD_DATATIMEOUT \
- | MCI_STATUS_CMD_RXOVERRUN \
- | MCI_STATUS_CMD_START_BIT_ERROR )
-#define MCI_STATUS_WRITE_ERROR ( MCI_STATUS_CMD_DATACRCFAIL \
- | MCI_STATUS_CMD_DATATIMEOUT \
- | MCI_STATUS_CMD_TX_UNDERRUN )
-#define MCI_STATUS_CMD_ERROR ( MCI_STATUS_CMD_CMDCRCFAIL \
- | MCI_STATUS_CMD_CMDTIMEOUT \
- | MCI_STATUS_CMD_START_BIT_ERROR )
-
-#define MCI_CLR_CMD_STATUS ( MCI_STATUS_CMD_RESPEND \
- | MCI_STATUS_CMD_SENT \
- | MCI_STATUS_CMD_ERROR )
-
-#define MCI_CLR_READ_STATUS ( MCI_STATUS_RXDONE \
- | MCI_STATUS_READ_ERROR )
-
-#define MCI_CLR_WRITE_STATUS ( MCI_STATUS_TXDONE \
- | MCI_STATUS_WRITE_ERROR )
-
-#define MCI_CLR_ALL_STATUS (BIT11 - 1)
-
-#define MCI_DATACTL_DISABLE_MASK 0xFE
-#define MCI_DATACTL_ENABLE BIT0
-#define MCI_DATACTL_CONT_TO_CARD 0
-#define MCI_DATACTL_CARD_TO_CONT BIT1
-#define MCI_DATACTL_BLOCK_TRANS 0
-#define MCI_DATACTL_STREAM_TRANS BIT2
-#define MCI_DATACTL_DMA_DISABLED 0
-#define MCI_DATACTL_DMA_ENABLE BIT3
-
-#define INDX_MASK 0x3F
-
-#define MCI_CPSM_WAIT_RESPONSE BIT6
-#define MCI_CPSM_LONG_RESPONSE BIT7
-#define MCI_CPSM_LONG_INTERRUPT BIT8
-#define MCI_CPSM_LONG_PENDING BIT9
-#define MCI_CPSM_ENABLE BIT10
-
-#define MCI_TRACE(txt) DEBUG ((EFI_D_BLKIO, "ARM_MCI: " txt "\n"))
-
-EFI_STATUS
-EFIAPI
-MciGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-MciGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
deleted file mode 100755
index 418fbac78a..0000000000
--- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-#/** @file
-# INF file for the MMC Host Protocol implementation for the ARM PrimeCell PL180.
-#
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL180MciDxe
- FILE_GUID = 09831032-6fa3-4484-af4f-0a000a8d3a82
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PL180MciDxeInitialize
-
-[Sources.common]
- PL180Mci.c
-
-[Packages]
- ArmPlatformPkg/ArmPlatformPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- BaseLib
- UefiLib
- UefiDriverEntryPoint
- BaseMemoryLib
- ArmLib
- IoLib
- TimerLib
-
-[Protocols]
- gEfiCpuArchProtocolGuid
- gEfiDevicePathProtocolGuid
- gEfiMmcHostProtocolGuid
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress
- gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress
-
-[Depex]
- TRUE
diff --git a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c b/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c
deleted file mode 100644
index 8600721c58..0000000000
--- a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-
-#define PL301_QOS_TIDEMARK_MI_0 0x400
-#define PL301_QOS_ACCESSCONTROL_MI_0 0x404
-
-#define PL301_QOS_TIDEMARK_MI_1 0x420
-#define PL301_QOS_ACCESSCONTROL_MI_1 0x424
-
-#define PL301_QOS_TIDEMARK_MI_2 0x440
-#define PL301_QOS_ACCESSCONTROL_MI_2 0x444
-
-#define PL301_AR_ARB_MI_0 0x408
-#define PL301_AW_ARB_MI_0 0x40C
-
-#define PL301_AR_ARB_MI_1 0x428
-#define PL301_AW_ARB_MI_1 0x42C
-
-#define PL301_AR_ARB_MI_2 0x448
-#define PL301_AW_ARB_MI_2 0x44C
-
-#define PL301_MI_1_OFFSET 0x20
-#define PL301_MI_2_OFFSET 0x40
-#define PL301_MI_3_OFFSET 0x60
-#define PL301_MI_4_OFFSET 0x80
-#define PL301_MI_5_OFFSET 0xa0
-
-#define V2P_CA9_FAXI_MI0_TIDEMARK_VAL 0x6
-#define V2P_CA9_FAXI_MI0_ACCESSCNTRL_VAL 0x1
-
-#define V2P_CA9_FAXI_MI1_TIDEMARK_VAL 0x6
-#define V2P_CA9_FAXI_MI1_ACCESSCNTRL_VAL 0x1
-
-#define V2P_CA9_FAXI_MI2_TIDEMARK_VAL 0x6
-#define V2P_CA9_FAXI_MI2_ACCESSCNTRL_VAL 0x1
-
-
-#define FAxiWriteReg(reg,val) MmioWrite32(FAxiBase + reg, val)
-#define FAxiReadReg(reg) MmioRead32(FAxiBase + reg)
-
-// IN FAxiBase
-// Initialize PL301 Dynamic Memory Controller
-VOID PL301AxiInit(UINTN FAxiBase) {
- // Configure Tidemark Register for Master Port 0 (MI 0)
- FAxiWriteReg(PL301_QOS_TIDEMARK_MI_0, V2P_CA9_FAXI_MI0_TIDEMARK_VAL);
-
- // Configure the Access Control Register (MI 0)
- FAxiWriteReg(PL301_QOS_ACCESSCONTROL_MI_0, V2P_CA9_FAXI_MI0_ACCESSCNTRL_VAL);
-
- // MP0
- // Set priority for Read
- FAxiWriteReg(PL301_AR_ARB_MI_0, 0x00000100);
- FAxiWriteReg(PL301_AR_ARB_MI_0, 0x01000200);
- FAxiWriteReg(PL301_AR_ARB_MI_0, 0x02000200);
- FAxiWriteReg(PL301_AR_ARB_MI_0, 0x03000200);
- FAxiWriteReg(PL301_AR_ARB_MI_0, 0x04000200);
-
- // Set priority for Write
- FAxiWriteReg(PL301_AW_ARB_MI_0, 0x00000100);
- FAxiWriteReg(PL301_AW_ARB_MI_0, 0x01000200);
- FAxiWriteReg(PL301_AW_ARB_MI_0, 0x02000200);
- FAxiWriteReg(PL301_AW_ARB_MI_0, 0x03000200);
- FAxiWriteReg(PL301_AW_ARB_MI_0, 0x04000200);
-
- // MP1
- // Set priority for Read
- FAxiWriteReg(PL301_AR_ARB_MI_1, 0x00000100);
- FAxiWriteReg(PL301_AR_ARB_MI_1, 0x01000200);
- FAxiWriteReg(PL301_AR_ARB_MI_1, 0x02000200);
- FAxiWriteReg(PL301_AR_ARB_MI_1, 0x03000200);
- FAxiWriteReg(PL301_AR_ARB_MI_1, 0x04000200);
-
- // Set priority for Write
- FAxiWriteReg(PL301_AW_ARB_MI_1, 0x00000100);
- FAxiWriteReg(PL301_AW_ARB_MI_1, 0x01000200);
- FAxiWriteReg(PL301_AW_ARB_MI_1, 0x02000200);
- FAxiWriteReg(PL301_AW_ARB_MI_1, 0x03000200);
- FAxiWriteReg(PL301_AW_ARB_MI_1, 0x04000200);
-
- // MP2
- // Set priority for Read
- FAxiWriteReg(PL301_AR_ARB_MI_2, 0x00000100);
- FAxiWriteReg(PL301_AR_ARB_MI_2, 0x01000100);
- FAxiWriteReg(PL301_AR_ARB_MI_2, 0x02000100);
- FAxiWriteReg(PL301_AR_ARB_MI_2, 0x03000100);
- FAxiWriteReg(PL301_AR_ARB_MI_2, 0x04000100);
-
- // Set priority for Write
- FAxiWriteReg(PL301_AW_ARB_MI_2, 0x00000100);
- FAxiWriteReg(PL301_AW_ARB_MI_2, 0x01000200);
- FAxiWriteReg(PL301_AW_ARB_MI_2, 0x02000200);
- FAxiWriteReg(PL301_AW_ARB_MI_2, 0x03000200);
- FAxiWriteReg(PL301_AW_ARB_MI_2, 0x04000200);
-}
diff --git a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf b/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf
deleted file mode 100755
index 108161fc16..0000000000
--- a/ArmPlatformPkg/Drivers/PL301Axi/PL301Axi.inf
+++ /dev/null
@@ -1,27 +0,0 @@
-#/* @file
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL301Axi
- FILE_GUID = 2ea84160-aba0-11df-9896-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PL301AxiLib
-
-[Sources]
- PL301Axi.c
-
-[Packages]
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
diff --git a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c b/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c
deleted file mode 100644
index 1a6ab33720..0000000000
--- a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2Cache.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-#include <Library/ArmLib.h>
-#include <Drivers/PL310L2Cache.h>
-#include <Library/PcdLib.h>
-
-#define L2x0WriteReg(reg,val) MmioWrite32(PcdGet32(PcdL2x0ControllerBase) + reg, val)
-#define L2x0ReadReg(reg) MmioRead32(PcdGet32(PcdL2x0ControllerBase) + reg)
-
-// Initialize PL320 L2 Cache Controller
-VOID
-L2x0CacheInit (
- IN UINTN L2x0Base,
- IN UINT32 L2x0TagLatencies,
- IN UINT32 L2x0DataLatencies,
- IN UINT32 L2x0AuxValue,
- IN UINT32 L2x0AuxMask,
- IN BOOLEAN CacheEnabled
- )
-{
- UINT32 Data;
- UINT32 Revision;
- UINT32 Aux;
- UINT32 PfCtl;
- UINT32 PwrCtl;
-
- // Check if L2x0 is present and is an ARM implementation
- Data = L2x0ReadReg(L2X0_CACHEID);
- if ((Data >> 24) != L2X0_CACHEID_IMPLEMENTER_ARM) {
- ASSERT(0);
- return;
- }
-
- // Check if L2x0 is PL310
- if (((Data >> 6) & 0xF) != L2X0_CACHEID_PARTNUM_PL310) {
- ASSERT(0);
- return;
- }
-
- // RTL release
- Revision = Data & 0x3F;
-
- // Check if L2x0 is already enabled then we disable it
- Data = L2x0ReadReg(L2X0_CTRL);
- if (Data & L2X0_CTRL_ENABLED) {
- L2x0WriteReg(L2X0_CTRL, L2X0_CTRL_DISABLED);
- }
-
- //
- // Set up global configurations
- //
-
- // Auxiliary register: Non-secure interrupt access Control + Event monitor bus enable + SBO
- Aux = L2X0_AUXCTRL_NSAC | L2X0_AUXCTRL_EM | L2X0_AUXCTRL_SBO;
- // Use AWCACHE attributes for WA
- Aux |= L2x0_AUXCTRL_AW_AWCACHE;
- // Use default Size
- Data = L2x0ReadReg(L2X0_AUXCTRL);
- Aux |= Data & L2X0_AUXCTRL_WAYSIZE_MASK;
- // Use default associativity
- Aux |= Data & L2X0_AUXCTRL_ASSOCIATIVITY;
- // Enabled I & D Prefetch
- Aux |= L2x0_AUXCTRL_IPREFETCH | L2x0_AUXCTRL_DPREFETCH;
-
- if (Revision >= 5) {
- // Prefetch Offset Register
- PfCtl = L2x0ReadReg(L2X0_PFCTRL);
- // - Prefetch increment set to 0
- // - Prefetch dropping off
- // - Double linefills off
- L2x0WriteReg(L2X0_PFCTRL, PfCtl);
-
- // Power Control Register - L2X0_PWRCTRL
- PwrCtl = L2x0ReadReg(L2X0_PWRCTRL);
- // - Standby when idle off
- // - Dynamic clock gating off
- // - Nc,NC-shared dropping off
- L2x0WriteReg(L2X0_PWRCTRL, PwrCtl);
- }
-
- if (Revision >= 2) {
- L2x0WriteReg(L230_TAG_LATENCY, L2x0TagLatencies);
- L2x0WriteReg(L230_DATA_LATENCY, L2x0DataLatencies);
- } else {
- // PL310 old style latency is not supported yet
- ASSERT(0);
- }
-
- // Set the platform specific values
- Aux = (Aux & L2x0AuxMask) | L2x0AuxValue;
-
- // Write Auxiliary value
- L2x0WriteReg(L2X0_AUXCTRL, Aux);
-
- //
- // Invalidate all entries in cache
- //
- L2x0WriteReg(L2X0_INVWAY, 0xffff);
- // Poll cache maintenance register until invalidate operation is complete
- while(L2x0ReadReg(L2X0_INVWAY) & 0xffff);
-
- // Write to the Lockdown D and Lockdown I Register 9 if required
- // - Not required
-
- // Clear any residual raw interrupts
- L2x0WriteReg(L2X0_INTCLEAR, 0x1FF);
-
- // Enable the cache
- if (CacheEnabled) {
- L2x0WriteReg(L2X0_CTRL, L2X0_CTRL_ENABLED);
- }
-}
diff --git a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf b/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf
deleted file mode 100755
index 78f952a1d0..0000000000
--- a/ArmPlatformPkg/Drivers/PL310L2Cache/PL310L2CacheSec.inf
+++ /dev/null
@@ -1,31 +0,0 @@
-#/* @file
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL310L2Cache
- FILE_GUID = 16ad4fe0-b5b1-11df-8cbf-0002a5d5c51b
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
- LIBRARY_CLASS = L2X0CacheLib
-
-[Sources]
- PL310L2Cache.c
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdL2x0ControllerBase
diff --git a/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c b/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c
deleted file mode 100644
index 08eba6ec69..0000000000
--- a/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Uefi.h>
-
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-
-#include <Drivers/PL341Dmc.h>
-
-// Macros for writing to DDR2 controller.
-#define DmcWriteReg(reg,val) MmioWrite32(DmcBase + reg, val)
-#define DmcReadReg(reg) MmioRead32(DmcBase + reg)
-
-// Macros for writing/reading to DDR2 PHY controller
-#define DmcPhyWriteReg(reg,val) MmioWrite32(DmcPhyBase + reg, val)
-#define DmcPhyReadReg(reg) MmioRead32(DmcPhyBase + reg)
-
-// Initialise PL341 Dynamic Memory Controller
-VOID
-PL341DmcInit (
- IN UINTN DmcBase,
- IN PL341_DMC_CONFIG* DmcConfig
- )
-{
- UINTN Index;
- UINT32 Chip;
-
- // Set config mode
- DmcWriteReg(DMC_COMMAND_REG, DMC_COMMAND_CONFIGURE);
-
- //
- // Setup the QoS AXI ID bits
- //
- if (DmcConfig->HasQos) {
- // CLCD AXIID = 000
- DmcWriteReg(DMC_ID_0_CFG_REG, DMC_ID_CFG_QOS_ENABLE | DMC_ID_CFG_QOS_MIN);
-
- // Default disable QoS
- DmcWriteReg(DMC_ID_1_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_2_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_3_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_4_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_5_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_6_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_7_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_8_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_9_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_10_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_11_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_12_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_13_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_14_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- DmcWriteReg(DMC_ID_15_CFG_REG, DMC_ID_CFG_QOS_DISABLE);
- }
-
- //
- // Initialise memory controlller
- //
- DmcWriteReg(DMC_REFRESH_PRD_REG, DmcConfig->RefreshPeriod);
- DmcWriteReg(DMC_CAS_LATENCY_REG, DmcConfig->CasLatency);
- DmcWriteReg(DMC_WRITE_LATENCY_REG, DmcConfig->WriteLatency);
- DmcWriteReg(DMC_T_MRD_REG, DmcConfig->t_mrd);
- DmcWriteReg(DMC_T_RAS_REG, DmcConfig->t_ras);
- DmcWriteReg(DMC_T_RC_REG, DmcConfig->t_rc);
- DmcWriteReg(DMC_T_RCD_REG, DmcConfig->t_rcd);
- DmcWriteReg(DMC_T_RFC_REG, DmcConfig->t_rfc);
- DmcWriteReg(DMC_T_RP_REG, DmcConfig->t_rp);
- DmcWriteReg(DMC_T_RRD_REG, DmcConfig->t_rrd);
- DmcWriteReg(DMC_T_WR_REG, DmcConfig->t_wr);
- DmcWriteReg(DMC_T_WTR_REG, DmcConfig->t_wtr);
- DmcWriteReg(DMC_T_XP_REG, DmcConfig->t_xp);
- DmcWriteReg(DMC_T_XSR_REG, DmcConfig->t_xsr);
- DmcWriteReg(DMC_T_ESR_REG, DmcConfig->t_esr);
- DmcWriteReg(DMC_T_FAW_REG, DmcConfig->t_faw);
- DmcWriteReg(DMC_T_WRLAT_DIFF, DmcConfig->t_wdata_en);
- DmcWriteReg(DMC_T_RDATA_EN, DmcConfig->t_data_en);
-
- //
- // Initialise PL341 Mem Config Registers
- //
-
- // Set PL341 Memory Config
- DmcWriteReg(DMC_MEMORY_CONFIG_REG, DmcConfig->MemoryCfg);
-
- // Set PL341 Memory Config 2
- DmcWriteReg(DMC_MEMORY_CFG2_REG, DmcConfig->MemoryCfg2);
-
- // Set PL341 Memory Config 3
- DmcWriteReg(DMC_MEMORY_CFG3_REG, DmcConfig->MemoryCfg3);
-
- // Set PL341 Chip Select <n>
- DmcWriteReg(DMC_CHIP_0_CFG_REG, DmcConfig->ChipCfg0);
- DmcWriteReg(DMC_CHIP_1_CFG_REG, DmcConfig->ChipCfg1);
- DmcWriteReg(DMC_CHIP_2_CFG_REG, DmcConfig->ChipCfg2);
- DmcWriteReg(DMC_CHIP_3_CFG_REG, DmcConfig->ChipCfg3);
-
- // Delay
- for (Index = 0; Index < 10; Index++) {
- DmcReadReg(DMC_STATUS_REG);
- }
-
- if (DmcConfig->IsUserCfg) {
- //
- // Set Test Chip PHY Registers via PL341 User Config Reg
- // Note that user_cfgX registers are Write Only
- //
- // DLL Freq set = 250MHz - 266MHz
- //
- DmcWriteReg(DMC_USER_0_CFG_REG, DmcConfig->User0Cfg);
-
- // user_config2
- // ------------
- // Set defaults before calibrating the DDR2 buffer impendence
- // - Disable ODT
- // - Default drive strengths
- DmcWriteReg(DMC_USER_2_CFG_REG, 0x40000198);
-
- //
- // Auto calibrate the DDR2 buffers impendence
- //
- while (!(DmcReadReg(DMC_USER_STATUS_REG) & 0x100));
-
- // Set the output driven strength
- DmcWriteReg(DMC_USER_2_CFG_REG, 0x40800000 | DmcConfig->User2Cfg);
-
- //
- // Set PL341 Feature Control Register
- //
- // Disable early BRESP - use to optimise CLCD performance
- DmcWriteReg(DMC_FEATURE_CRTL_REG, 0x00000001);
- }
-
- //
- // Config memories
- //
- for (Chip = 0; Chip < DmcConfig->MaxChip; Chip++) {
- // Send nop
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_NOP);
-
- // Pre-charge all
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_PRECHARGEALL);
-
- // Delay
- for (Index = 0; Index < 10; Index++) {
- DmcReadReg(DMC_STATUS_REG);
- }
-
- // Set (EMR2) extended mode register 2
- DmcWriteReg(DMC_DIRECT_CMD_REG,
- DMC_DIRECT_CMD_CHIP_ADDR(Chip) |
- DMC_DIRECT_CMD_BANKADDR(2) |
- DMC_DIRECT_CMD_MEMCMD_EXTMODEREG);
-
- // Set (EMR3) extended mode register 3
- DmcWriteReg(DMC_DIRECT_CMD_REG,
- DMC_DIRECT_CMD_CHIP_ADDR(Chip) |
- DMC_DIRECT_CMD_BANKADDR(3) |
- DMC_DIRECT_CMD_MEMCMD_EXTMODEREG);
-
- //
- // Set (EMR) Extended Mode Register
- //
- // Put into OCD default state
- DmcWriteReg(DMC_DIRECT_CMD_REG,DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_BANKADDR(1) | DMC_DIRECT_CMD_MEMCMD_EXTMODEREG);
-
- //
- // Set (MR) mode register - With DLL reset
- //
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_EXTMODEREG | DmcConfig->ModeReg | DDR2_MR_DLL_RESET);
-
- // Pre-charge all
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_PRECHARGEALL);
- // Auto-refresh
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_AUTOREFRESH);
- // Auto-refresh
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_AUTOREFRESH);
-
- //
- // Set (MR) mode register - Without DLL reset
- //
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | DMC_DIRECT_CMD_MEMCMD_EXTMODEREG | DmcConfig->ModeReg);
-
- // Delay
- for (Index = 0; Index < 10; Index++) {
- DmcReadReg(DMC_STATUS_REG);
- }
-
- //
- // Set (EMR) extended mode register - Enable OCD defaults
- //
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | (0x00090000) |
- (1 << DDR_MODESET_SHFT) | (DDR_EMR_OCD_DEFAULT << DDR_EMR_OCD_SHIFT) | DmcConfig->ExtModeReg);
-
- // Delay
- for (Index = 0; Index < 10; Index++) {
- DmcReadReg(DMC_STATUS_REG);
- }
-
- // Set (EMR) extended mode register - OCD Exit
- DmcWriteReg(DMC_DIRECT_CMD_REG, DMC_DIRECT_CMD_CHIP_ADDR(Chip) | (0x00090000) |
- (1 << DDR_MODESET_SHFT) | (DDR_EMR_OCD_NS << DDR_EMR_OCD_SHIFT) | DmcConfig->ExtModeReg);
-
- // Delay
- for (Index = 0; Index < 10; Index++) {
- DmcReadReg(DMC_STATUS_REG);
- }
- }
-
- // Move DDR2 Controller to Ready state by issueing GO command
- DmcWriteReg(DMC_COMMAND_REG, DMC_COMMAND_GO);
-
- // wait for ready
- while (!(DmcReadReg(DMC_STATUS_REG) & DMC_STATUS_READY));
-
-}
diff --git a/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.inf b/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.inf
deleted file mode 100755
index 0f3d862e14..0000000000
--- a/ArmPlatformPkg/Drivers/PL34xDmc/PL341Dmc.inf
+++ /dev/null
@@ -1,29 +0,0 @@
-#/* @file
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL341Dmc
- FILE_GUID = edf8da40-aad1-11df-a1f4-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PL341DmcLib
-
-[Sources]
- PL341Dmc.c
-
-[Packages]
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
-
-[FixedPcd]
diff --git a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S b/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S
deleted file mode 100755
index a26a4d4377..0000000000
--- a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-#include <AsmMacroIoLib.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-#include <Drivers/PL35xSmc.h>
-
-.text
-
-#Maintain 8 byte alignment
-.align 3
-
-GCC_ASM_EXPORT(PL35xSmcInitialize)
-GCC_ASM_EXPORT(PL35xSmcSetRefresh)
-
-// IN r1 Smc Base Address
-// IN r2 Smc Configuration Start Address
-// IN r3 Smc Configuration End Address
-// NOTE: This code is been called before any stack has been setup. It means some registers
-// could be overwritten (case of 'r0')
-ASM_PFX(PL35xSmcInitialize):
- // While (SmcConfigurationStart < SmcConfigurationEnd)
- cmp r2, r3
- blxge lr
-
- // Write to set_cycle register(holding register for NOR 1 cycle register or NAND cycle register)
- ldr r0, [r2, #0x4]
- str r0, [r1, #PL350_SMC_SET_CYCLES_OFFSET]
-
- // Write to set_opmode register(holding register for NOR 1 opomode register or NAND opmode register)
- ldr r0, [r2, #0x8]
- str r0, [r1, #PL350_SMC_SET_OPMODE_OFFSET]
-
- // Write to direct_cmd register so that the NOR 1 registers(set-cycles and opmode) are updated with holding registers
- ldr r0, =PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE
- ldr r4, [r2, #0x0]
- orr r0, r0, r4
- str r0, [r1, #PL350_SMC_DIRECT_CMD_OFFSET]
-
- add r2, #0xC
- b ASM_PFX(PL35xSmcInitialize)
-
-// IN r1 Smc Base Address
-// IN r2 Smc Refresh Period 0
-// IN r3 Smc Refresh Period 1
-ASM_PFX(PL35xSmcSetRefresh):
- str r2, [r1, #PL350_SMC_REFRESH_0_OFFSET]
- str r3, [r1, #PL350_SMC_REFRESH_1_OFFSET]
- blx lr
diff --git a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm b/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm
deleted file mode 100755
index 661b0688c8..0000000000
--- a/ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Library/PcdLib.h>
-#include <Drivers/PL35xSmc.h>
-#include <AutoGen.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT PL35xSmcInitialize
- EXPORT PL35xSmcSetRefresh
-
- PRESERVE8
- AREA ModuleInitializeSMC, CODE, READONLY
-
-// IN r1 Smc Base Address
-// IN r2 Smc Configuration Start Address
-// IN r3 Smc Configuration End Address
-// NOTE: This code is been called before any stack has been setup. It means some registers
-// could be overwritten (case of 'r0')
-PL35xSmcInitialize
- // While (SmcConfigurationStart < SmcConfigurationEnd)
- cmp r2, r3
- blxge lr
-
- // Write to set_cycle register(holding register for NOR 1 cycle register or NAND cycle register)
- ldr r0, [r2, #0x4]
- str r0, [r1, #PL350_SMC_SET_CYCLES_OFFSET]
-
- // Write to set_opmode register(holding register for NOR 1 opomode register or NAND opmode register)
- ldr r0, [r2, #0x8]
- str r0, [r1, #PL350_SMC_SET_OPMODE_OFFSET]
-
- // Write to direct_cmd register so that the NOR 1 registers(set-cycles and opmode) are updated with holding registers
- ldr r0, =PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE
- ldr r4, [r2, #0x0]
- orr r0, r0, r4
- str r0, [r1, #PL350_SMC_DIRECT_CMD_OFFSET]
-
- add r2, #0xC
- b PL35xSmcInitialize
-
-// IN r1 Smc Base Address
-// IN r2 Smc Refresh Period 0
-// IN r3 Smc Refresh Period 1
-PL35xSmcSetRefresh
- str r2, [r1, #PL350_SMC_REFRESH_0_OFFSET]
- str r3, [r1, #PL350_SMC_REFRESH_1_OFFSET]
- blx lr
-
- END
diff --git a/ArmPlatformPkg/Drivers/PL35xSmc/PL35xSmc.inf b/ArmPlatformPkg/Drivers/PL35xSmc/PL35xSmc.inf
deleted file mode 100755
index 2eee5ab505..0000000000
--- a/ArmPlatformPkg/Drivers/PL35xSmc/PL35xSmc.inf
+++ /dev/null
@@ -1,29 +0,0 @@
-#/* @file
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL35xSmc
- FILE_GUID = 10952220-aa32-11df-a438-0002a5d5c51b
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PL35xSmcLib
-
-[Sources.common]
- InitializeSMC.asm | RVCT
- InitializeSMC.S | GCC
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
diff --git a/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c b/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c
deleted file mode 100644
index 7ae25e9bb9..0000000000
--- a/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804Timer.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/** @file
- Template for Timer Architecture Protocol driver of the ARM flavor
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include <PiDxe.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-
-#include <Protocol/Timer.h>
-#include <Protocol/HardwareInterrupt.h>
-
-#include <Drivers/SP804Timer.h>
-
-#define SP804_TIMER_PERIODIC_BASE ((UINTN)PcdGet32 (PcdSP804TimerPeriodicBase))
-#define SP804_TIMER_METRONOME_BASE ((UINTN)PcdGet32 (PcdSP804TimerMetronomeBase))
-#define SP804_TIMER_PERFORMANCE_BASE ((UINTN)PcdGet32 (PcdSP804TimerPerformanceBase))
-
-// The notification function to call on every timer interrupt.
-EFI_TIMER_NOTIFY mTimerNotifyFunction = (EFI_TIMER_NOTIFY)NULL;
-EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL;
-
-// The current period of the timer interrupt
-UINT64 mTimerPeriod = 0;
-
-// Cached copy of the Hardware Interrupt protocol instance
-EFI_HARDWARE_INTERRUPT_PROTOCOL *gInterrupt = NULL;
-
-// Cached interrupt vector
-UINTN gVector;
-
-
-/**
-
- C Interrupt Handler called in the interrupt context when Source interrupt is active.
-
-
- @param Source Source of the interrupt. Hardware routing off a specific platform defines
- what source means.
-
- @param SystemContext Pointer to system register context. Mostly used by debuggers and will
- update the system context after the return from the interrupt if
- modified. Don't change these values unless you know what you are doing
-
-**/
-VOID
-EFIAPI
-TimerInterruptHandler (
- IN HARDWARE_INTERRUPT_SOURCE Source,
- IN EFI_SYSTEM_CONTEXT SystemContext
- )
-{
- EFI_TPL OriginalTPL;
-
- //
- // DXE core uses this callback for the EFI timer tick. The DXE core uses locks
- // that raise to TPL_HIGH and then restore back to current level. Thus we need
- // to make sure TPL level is set to TPL_HIGH while we are handling the timer tick.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- // If the interrupt is shared then we must check if this interrupt source is the one associated to this Timer
- if (MmioRead32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_MSK_INT_STS_REG) != 0) {
- // Clear the periodic interrupt
- MmioWrite32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_INT_CLR_REG, 0);
-
- // Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers
- gInterrupt->EndOfInterrupt (gInterrupt, Source);
-
- if (mTimerNotifyFunction) {
- mTimerNotifyFunction (mTimerPeriod);
- }
- }
-
- gBS->RestoreTPL (OriginalTPL);
-}
-
-/**
- This function registers the handler NotifyFunction so it is called every time
- the timer interrupt fires. It also passes the amount of time since the last
- handler call to the NotifyFunction. If NotifyFunction is NULL, then the
- handler is unregistered. If the handler is registered, then EFI_SUCCESS is
- returned. If the CPU does not support registering a timer interrupt handler,
- then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler
- when a handler is already registered, then EFI_ALREADY_STARTED is returned.
- If an attempt is made to unregister a handler when a handler is not registered,
- then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to
- register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR
- is returned.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
- @param NotifyFunction The function to call when a timer interrupt fires. This
- function executes at TPL_HIGH_LEVEL. The DXE Core will
- register a handler for the timer interrupt, so it can know
- how much time has passed. This information is used to
- signal timer based events. NULL will unregister the handler.
- @retval EFI_SUCCESS The timer handler was registered.
- @retval EFI_UNSUPPORTED The platform does not support timer interrupts.
- @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
- registered.
- @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
- previously registered.
- @retval EFI_DEVICE_ERROR The timer handler could not be registered.
-
-**/
-EFI_STATUS
-EFIAPI
-TimerDriverRegisterHandler (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN EFI_TIMER_NOTIFY NotifyFunction
- )
-{
- if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {
- return EFI_ALREADY_STARTED;
- }
-
- mTimerNotifyFunction = NotifyFunction;
-
- return EFI_SUCCESS;
-}
-
-/**
- Make sure all Dual Timers are disabled
-**/
-VOID
-EFIAPI
-ExitBootServicesEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- // Disable 'Periodic Operation' timer if enabled
- if (MmioRead32(SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) {
- MmioAnd32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG, 0);
- }
-
- // Disable 'Metronome/Delay' timer if enabled
- if (MmioRead32(SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) {
- MmioAnd32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG, 0);
- }
-
- // Disable 'Performance' timer if enabled
- if (MmioRead32(SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) {
- MmioAnd32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG, 0);
- }
-}
-
-/**
-
- This function adjusts the period of timer interrupts to the value specified
- by TimerPeriod. If the timer period is updated, then the selected timer
- period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If
- the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.
- If an error occurs while attempting to update the timer period, then the
- timer hardware will be put back in its state prior to this call, and
- EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt
- is disabled. This is not the same as disabling the CPU's interrupts.
- Instead, it must either turn off the timer hardware, or it must adjust the
- interrupt controller so that a CPU interrupt is not generated when the timer
- interrupt fires.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
- @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If
- the timer hardware is not programmable, then EFI_UNSUPPORTED is
- returned. If the timer is programmable, then the timer period
- will be rounded up to the nearest timer period that is supported
- by the timer hardware. If TimerPeriod is set to 0, then the
- timer interrupts will be disabled.
-
-
- @retval EFI_SUCCESS The timer period was changed.
- @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt.
- @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-TimerDriverSetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod
- )
-{
- EFI_STATUS Status;
- UINT64 TimerTicks;
-
- // always disable the timer
- MmioAnd32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG, ~SP804_TIMER_CTRL_ENABLE);
-
- if (TimerPeriod == 0) {
- // Leave timer disabled from above, and...
-
- // Disable timer 0/1 interrupt for a TimerPeriod of 0
- Status = gInterrupt->DisableInterruptSource (gInterrupt, gVector);
- } else {
- // Convert TimerPeriod into 1MHz clock counts (us units = 100ns units * 10)
- TimerTicks = DivU64x32 (TimerPeriod, 10);
- TimerTicks = MultU64x32 (TimerTicks, PcdGet32(PcdSP804TimerFrequencyInMHz));
-
- // if it's larger than 32-bits, pin to highest value
- if (TimerTicks > 0xffffffff) {
- TimerTicks = 0xffffffff;
- }
-
- // Program the SP804 timer with the new count value
- MmioWrite32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_LOAD_REG, TimerTicks);
-
- // enable the timer
- MmioOr32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_ENABLE);
-
- // enable timer 0/1 interrupts
- Status = gInterrupt->EnableInterruptSource (gInterrupt, gVector);
- }
-
- // Save the new timer period
- mTimerPeriod = TimerPeriod;
- return Status;
-}
-
-/**
- This function retrieves the period of timer interrupts in 100 ns units,
- returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod
- is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is
- returned, then the timer is currently disabled.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
- @param TimerPeriod A pointer to the timer period to retrieve in 100 ns units. If
- 0 is returned, then the timer is currently disabled.
-
-
- @retval EFI_SUCCESS The timer period was returned in TimerPeriod.
- @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-TimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
- )
-{
- if (TimerPeriod == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *TimerPeriod = mTimerPeriod;
- return EFI_SUCCESS;
-}
-
-/**
- This function generates a soft timer interrupt. If the platform does not support soft
- timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned.
- If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler()
- service, then a soft timer interrupt will be generated. If the timer interrupt is
- enabled when this service is called, then the registered handler will be invoked. The
- registered handler should not be able to distinguish a hardware-generated timer
- interrupt from a software-generated timer interrupt.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
-
- @retval EFI_SUCCESS The soft timer interrupt was generated.
- @retval EFI_UNSUPPORTED The platform does not support the generation of soft timer interrupts.
-
-**/
-EFI_STATUS
-EFIAPI
-TimerDriverGenerateSoftInterrupt (
- IN EFI_TIMER_ARCH_PROTOCOL *This
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- Interface structure for the Timer Architectural Protocol.
-
- @par Protocol Description:
- This protocol provides the services to initialize a periodic timer
- interrupt, and to register a handler that is called each time the timer
- interrupt fires. It may also provide a service to adjust the rate of the
- periodic timer interrupt. When a timer interrupt occurs, the handler is
- passed the amount of time that has passed since the previous timer
- interrupt.
-
- @param RegisterHandler
- Registers a handler that will be called each time the
- timer interrupt fires. TimerPeriod defines the minimum
- time between timer interrupts, so TimerPeriod will also
- be the minimum time between calls to the registered
- handler.
-
- @param SetTimerPeriod
- Sets the period of the timer interrupt in 100 nS units.
- This function is optional, and may return EFI_UNSUPPORTED.
- If this function is supported, then the timer period will
- be rounded up to the nearest supported timer period.
-
-
- @param GetTimerPeriod
- Retrieves the period of the timer interrupt in 100 nS units.
-
- @param GenerateSoftInterrupt
- Generates a soft timer interrupt that simulates the firing of
- the timer interrupt. This service can be used to invoke the registered handler if the timer interrupt has been masked for
- a period of time.
-
-**/
-EFI_TIMER_ARCH_PROTOCOL gTimer = {
- TimerDriverRegisterHandler,
- TimerDriverSetTimerPeriod,
- TimerDriverGetTimerPeriod,
- TimerDriverGenerateSoftInterrupt
-};
-
-
-/**
- Initialize the state information for the Timer Architectural Protocol and
- the Timer Debug support protocol that allows the debugger to break into a
- running program.
-
- @param ImageHandle of the loaded driver
- @param SystemTable Pointer to the System Table
-
- @retval EFI_SUCCESS Protocol registered
- @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
- @retval EFI_DEVICE_ERROR Hardware problems
-
-**/
-EFI_STATUS
-EFIAPI
-TimerInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_HANDLE Handle = NULL;
- EFI_STATUS Status;
-
- // Set the interrupt timer number
- gVector = PcdGet32(PcdSP804TimerPeriodicInterruptNum);
-
- // Find the interrupt controller protocol. ASSERT if not found.
- Status = gBS->LocateProtocol (&gHardwareInterruptProtocolGuid, NULL, (VOID **)&gInterrupt);
- ASSERT_EFI_ERROR (Status);
-
- // Disable the timer
- Status = TimerDriverSetTimerPeriod (&gTimer, 0);
- ASSERT_EFI_ERROR (Status);
-
- // Install interrupt handler
- Status = gInterrupt->RegisterInterruptSource (gInterrupt, gVector, TimerInterruptHandler);
- ASSERT_EFI_ERROR (Status);
-
- // configure timer 0 for periodic operation, 32 bits, no prescaler, and interrupt enabled
- MmioWrite32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_PERIODIC | SP804_TIMER_CTRL_32BIT | SP804_PRESCALE_DIV_1 | SP804_TIMER_CTRL_INT_ENABLE);
-
- // Set up default timer
- Status = TimerDriverSetTimerPeriod (&gTimer, FixedPcdGet32(PcdTimerPeriod)); // TIMER_DEFAULT_PERIOD
- ASSERT_EFI_ERROR (Status);
-
- // Install the Timer Architectural Protocol onto a new handle
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Handle,
- &gEfiTimerArchProtocolGuid, &gTimer,
- NULL
- );
- ASSERT_EFI_ERROR(Status);
-
- // Register for an ExitBootServicesEvent
- Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf b/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
deleted file mode 100644
index 386d9649ef..0000000000
--- a/ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-#/** @file
-#
-# Component description file for Timer module
-#
-# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmVeTimerDxe
- FILE_GUID = a73d663d-a491-4278-9a69-9521be3379f2
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = TimerInitialize
-
-[Sources.common]
- SP804Timer.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- UefiRuntimeServicesTableLib
- UefiLib
- UefiBootServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiDriverEntryPoint
- IoLib
-
-[Guids]
-
-[Protocols]
- gEfiTimerArchProtocolGuid
- gHardwareInterruptProtocolGuid
-
-[Pcd.common]
- gArmPlatformTokenSpaceGuid.PcdSP804TimerFrequencyInMHz
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPeriodicInterruptNum
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPeriodicBase
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPerformanceBase
- gArmPlatformTokenSpaceGuid.PcdSP804TimerMetronomeBase
- gEmbeddedTokenSpaceGuid.PcdTimerPeriod
-
-[Depex]
- gHardwareInterruptProtocolGuid
diff --git a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
deleted file mode 100644
index c78d2b9ff9..0000000000
--- a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-
-#include <PiDxe.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include <Protocol/WatchdogTimer.h>
-#include <Drivers/SP805Watchdog.h>
-
-EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL;
-
-/**
- Make sure the SP805 registers are unlocked for writing.
-
- Note: The SP805 Watchdog Timer supports locking of its registers,
- i.e. it inhibits all writes to avoid rogue software accidentally
- corrupting their contents.
-**/
-STATIC
-VOID
-SP805Unlock (
- VOID
- )
-{
- if( MmioRead32(SP805_WDOG_LOCK_REG) == SP805_WDOG_LOCK_IS_LOCKED ) {
- MmioWrite32(SP805_WDOG_LOCK_REG, SP805_WDOG_SPECIAL_UNLOCK_CODE);
- }
-}
-
-/**
- Make sure the SP805 registers are locked and can not be overwritten.
-
- Note: The SP805 Watchdog Timer supports locking of its registers,
- i.e. it inhibits all writes to avoid rogue software accidentally
- corrupting their contents.
-**/
-STATIC
-VOID
-SP805Lock (
- VOID
- )
-{
- if( MmioRead32(SP805_WDOG_LOCK_REG) == SP805_WDOG_LOCK_IS_UNLOCKED ) {
- // To lock it, just write in any number (except the special unlock code).
- MmioWrite32(SP805_WDOG_LOCK_REG, SP805_WDOG_LOCK_IS_LOCKED);
- }
-}
-
-/**
- Stop the SP805 watchdog timer from counting down by disabling interrupts.
-**/
-STATIC
-VOID
-SP805Stop (
- VOID
- )
-{
- // Disable interrupts
- if ( (MmioRead32(SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) != 0 ) {
- MmioAnd32(SP805_WDOG_CONTROL_REG, ~SP805_WDOG_CTRL_INTEN);
- }
-}
-
-/**
- Starts the SP805 counting down by enabling interrupts.
- The count down will start from the value stored in the Load register,
- not from the value where it was previously stopped.
-**/
-STATIC
-VOID
-SP805Start (
- VOID
- )
-{
- // Enable interrupts
- if ( (MmioRead32(SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) == 0 ) {
- MmioOr32(SP805_WDOG_CONTROL_REG, SP805_WDOG_CTRL_INTEN);
- }
-}
-
-/**
- On exiting boot services we must make sure the SP805 Watchdog Timer
- is stopped.
-**/
-VOID
-EFIAPI
-ExitBootServicesEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- SP805Unlock();
- SP805Stop();
- SP805Lock();
-}
-
-/**
- This function registers the handler NotifyFunction so it is called every time
- the watchdog timer expires. It also passes the amount of time since the last
- handler call to the NotifyFunction.
- If NotifyFunction is not NULL and a handler is not already registered,
- then the new handler is registered and EFI_SUCCESS is returned.
- If NotifyFunction is NULL, and a handler is already registered,
- then that handler is unregistered.
- If an attempt is made to register a handler when a handler is already registered,
- then EFI_ALREADY_STARTED is returned.
- If an attempt is made to unregister a handler when a handler is not registered,
- then EFI_INVALID_PARAMETER is returned.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
- @param NotifyFunction The function to call when a timer interrupt fires. This
- function executes at TPL_HIGH_LEVEL. The DXE Core will
- register a handler for the timer interrupt, so it can know
- how much time has passed. This information is used to
- signal timer based events. NULL will unregister the handler.
-
- @retval EFI_SUCCESS The watchdog timer handler was registered.
- @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
- registered.
- @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
- previously registered.
-
-**/
-EFI_STATUS
-EFIAPI
-SP805RegisterHandler (
- IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
- )
-{
- // ERROR: This function is not supported.
- // The hardware watchdog will reset the board
- return EFI_INVALID_PARAMETER;
-}
-
-/**
-
- This function adjusts the period of timer interrupts to the value specified
- by TimerPeriod. If the timer period is updated, then the selected timer
- period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If
- the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.
- If an error occurs while attempting to update the timer period, then the
- timer hardware will be put back in its state prior to this call, and
- EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt
- is disabled. This is not the same as disabling the CPU's interrupts.
- Instead, it must either turn off the timer hardware, or it must adjust the
- interrupt controller so that a CPU interrupt is not generated when the timer
- interrupt fires.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
- @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If
- the timer hardware is not programmable, then EFI_UNSUPPORTED is
- returned. If the timer is programmable, then the timer period
- will be rounded up to the nearest timer period that is supported
- by the timer hardware. If TimerPeriod is set to 0, then the
- timer interrupts will be disabled.
-
-
- @retval EFI_SUCCESS The timer period was changed.
- @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt.
- @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-SP805SetTimerPeriod (
- IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod // In 100ns units
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINT64 Ticks64bit;
-
- SP805Unlock();
-
- if( TimerPeriod == 0 ) {
- // This is a watchdog stop request
- SP805Stop();
- goto EXIT;
- } else {
- // Calculate the Watchdog ticks required for a delay of (TimerTicks * 100) nanoseconds
- // The SP805 will count down to ZERO once, generate an interrupt and
- // then it will again reload the initial value and start again.
- // On the second time when it reaches ZERO, it will actually reset the board.
- // Therefore, we need to load half the required delay.
- //
- // WatchdogTicks = ((TimerPeriod * 100 * SP805_CLOCK_FREQUENCY) / 1GHz) / 2 ;
- //
- // i.e.:
- //
- // WatchdogTicks = (TimerPeriod * SP805_CLOCK_FREQUENCY) / 20 MHz ;
-
- Ticks64bit = DivU64x32(MultU64x32(TimerPeriod, (UINTN)PcdGet32(PcdSP805WatchdogClockFrequencyInHz)), 20000000);
-
- // The registers in the SP805 are only 32 bits
- if(Ticks64bit > (UINT64)0xFFFFFFFF) {
- // We could load the watchdog with the maximum supported value but
- // if a smaller value was requested, this could have the watchdog
- // triggering before it was intended.
- // Better generate an error to let the caller know.
- Status = EFI_DEVICE_ERROR;
- goto EXIT;
- }
-
- // Update the watchdog with a 32-bit value.
- MmioWrite32(SP805_WDOG_LOAD_REG, (UINT32)Ticks64bit);
-
- // Start the watchdog
- SP805Start();
- }
-
- EXIT:
- // Ensure the watchdog is locked before exiting.
- SP805Lock();
- return Status;
-}
-
-/**
- This function retrieves the period of timer interrupts in 100 ns units,
- returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod
- is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is
- returned, then the timer is currently disabled.
-
- @param This The EFI_TIMER_ARCH_PROTOCOL instance.
- @param TimerPeriod A pointer to the timer period to retrieve in 100 ns units. If
- 0 is returned, then the timer is currently disabled.
-
-
- @retval EFI_SUCCESS The timer period was returned in TimerPeriod.
- @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-SP805GetTimerPeriod (
- IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINT64 ReturnValue;
-
- if (TimerPeriod == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Check if the watchdog is stopped
- if ( (MmioRead32(SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) == 0 ) {
- // It is stopped, so return zero.
- ReturnValue = 0;
- } else {
- // Convert the Watchdog ticks into TimerPeriod
- // Ensure 64bit arithmetic throughout because the Watchdog ticks may already
- // be at the maximum 32 bit value and we still need to multiply that by 600.
- ReturnValue = MultU64x32( MmioRead32(SP805_WDOG_LOAD_REG), 600 );
- }
-
- *TimerPeriod = ReturnValue;
-
- return Status;
-}
-
-/**
- Interface structure for the Watchdog Architectural Protocol.
-
- @par Protocol Description:
- This protocol provides a service to set the amount of time to wait
- before firing the watchdog timer, and it also provides a service to
- register a handler that is invoked when the watchdog timer fires.
-
- @par When the watchdog timer fires, control will be passed to a handler
- if one has been registered. If no handler has been registered,
- or the registered handler returns, then the system will be
- reset by calling the Runtime Service ResetSystem().
-
- @param RegisterHandler
- Registers a handler that will be called each time the
- watchdogtimer interrupt fires. TimerPeriod defines the minimum
- time between timer interrupts, so TimerPeriod will also
- be the minimum time between calls to the registered
- handler.
- NOTE: If the watchdog resets the system in hardware, then
- this function will not have any chance of executing.
-
- @param SetTimerPeriod
- Sets the period of the timer interrupt in 100 nS units.
- This function is optional, and may return EFI_UNSUPPORTED.
- If this function is supported, then the timer period will
- be rounded up to the nearest supported timer period.
-
- @param GetTimerPeriod
- Retrieves the period of the timer interrupt in 100 nS units.
-
-**/
-EFI_WATCHDOG_TIMER_ARCH_PROTOCOL gWatchdogTimer = {
- (EFI_WATCHDOG_TIMER_REGISTER_HANDLER) SP805RegisterHandler,
- (EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) SP805SetTimerPeriod,
- (EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) SP805GetTimerPeriod
-};
-
-/**
- Initialize the state information for the Watchdog Timer Architectural Protocol.
-
- @param ImageHandle of the loaded driver
- @param SystemTable Pointer to the System Table
-
- @retval EFI_SUCCESS Protocol registered
- @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
- @retval EFI_DEVICE_ERROR Hardware problems
-
-**/
-EFI_STATUS
-EFIAPI
-SP805Initialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- // Unlock access to the SP805 registers
- SP805Unlock ();
-
- // Stop the watchdog from triggering unexpectedly
- SP805Stop ();
-
- // Set the watchdog to reset the board when triggered
- if ((MmioRead32(SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_RESEN) == 0) {
- MmioOr32 (SP805_WDOG_CONTROL_REG, SP805_WDOG_CTRL_RESEN);
- }
-
- // Prohibit any rogue access to SP805 registers
- SP805Lock();
-
- //
- // Make sure the Watchdog Timer Architectural Protocol has not been installed in the system yet.
- // This will avoid conflicts with the universal watchdog
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid);
-
- // Register for an ExitBootServicesEvent
- Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);
- if (EFI_ERROR(Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
-
- // Install the Timer Architectural Protocol onto a new handle
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Handle,
- &gEfiWatchdogTimerArchProtocolGuid, &gWatchdogTimer,
- NULL
- );
- if (EFI_ERROR(Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
-
-EXIT:
- if(EFI_ERROR(Status)) {
- // The watchdog failed to initialize
- ASSERT(FALSE);
- }
- return Status;
-}
diff --git a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
deleted file mode 100644
index 37924f2e3c..0000000000
--- a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SP805WatchdogDxe
- FILE_GUID = ebd705fb-fa92-46a7-b32b-7f566d944614
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = SP805Initialize
-
-[Sources.common]
- SP805Watchdog.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- DebugLib
- IoLib
- PcdLib
- UefiLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiRuntimeServicesTableLib
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogBase
- gArmPlatformTokenSpaceGuid.PcdSP805WatchdogClockFrequencyInHz
-
-[Protocols]
- gEfiWatchdogTimerArchProtocolGuid
-
-[Depex]
- TRUE
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
deleted file mode 100644
index b42d205a2b..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
+++ /dev/null
@@ -1,61 +0,0 @@
-#/** @file
-# Support for ARM Boot Monitor File System
-#
-# Copyright (c) 2012-2015, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BootMonFs
- FILE_GUID = 7abbc454-f737-4322-931c-b1bb62a01d6f
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = BootMonFsEntryPoint
-
-[Sources]
- BootMonFsEntryPoint.c
- BootMonFsOpenClose.c
- BootMonFsDir.c
- BootMonFsImages.c
- BootMonFsReadWrite.c
- BootMonFsUnsupported.c
-
-[Packages]
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- BaseLib
- DevicePathLib
- MemoryAllocationLib
- PrintLib
- UefiDriverEntryPoint
- UefiLib
-
-[Guids]
- gArmBootMonFsFileInfoGuid
- gEfiFileSystemInfoGuid
- gEfiFileInfoGuid
- gEfiFileSystemVolumeLabelInfoIdGuid
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdBootMonFsSupportedDevicePaths
-
-[Protocols]
- gEfiDiskIoProtocolGuid
- gEfiBlockIoProtocolGuid
- gEfiSimpleFileSystemProtocolGuid
- gEfiDevicePathProtocolGuid
- gEfiDevicePathFromTextProtocolGuid
-
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsApi.h b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsApi.h
deleted file mode 100644
index d690520a0f..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsApi.h
+++ /dev/null
@@ -1,388 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __BOOTMON_FS_API_H
-#define __BOOTMON_FS_API_H
-
-#include <Protocol/SimpleFileSystem.h>
-
-EFI_STATUS
-BootMonFsInitialize (
- IN BOOTMON_FS_INSTANCE *Instance
- );
-
-UINT32
-BootMonFsChecksum (
- IN VOID *Data,
- IN UINT32 Size
- );
-
-EFI_STATUS
-BootMonFsComputeFooterChecksum (
- IN OUT HW_IMAGE_DESCRIPTION *Footer
- );
-
-EFIAPI
-EFI_STATUS
-OpenBootMonFsOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- );
-
-UINT32
-BootMonFsGetImageLength (
- IN BOOTMON_FS_FILE *File
- );
-
-UINTN
-BootMonFsGetPhysicalSize (
- IN BOOTMON_FS_FILE* File
- );
-
-EFI_STATUS
-BootMonFsCreateFile (
- IN BOOTMON_FS_INSTANCE *Instance,
- OUT BOOTMON_FS_FILE **File
- );
-
-EFIAPI
-EFI_STATUS
-BootMonFsGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-EFIAPI
-EFI_STATUS
-BootMonFsReadDirectory (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-EFIAPI
-EFI_STATUS
-BootMonFsFlushDirectory (
- IN EFI_FILE_PROTOCOL *This
- );
-
-/**
- Flush all modified data associated with a file to a device.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the
- file handle to flush.
-
- @retval EFI_SUCCESS The data was flushed.
- @retval EFI_ACCESS_DENIED The file was opened read-only.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_FULL The volume is full.
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to flush the data.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsFlushFile (
- IN EFI_FILE_PROTOCOL *This
- );
-
-/**
- Close a specified file handle.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
- handle to close.
-
- @retval EFI_SUCCESS The file was closed.
- @retval EFI_INVALID_PARAMETER The parameter "This" is NULL or is not an open
- file handle.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsCloseFile (
- IN EFI_FILE_PROTOCOL *This
- );
-
-/**
- Open a file on the boot monitor file system.
-
- The boot monitor file system does not allow for sub-directories. There is only
- one directory, the root one. On any attempt to create a directory, the function
- returns in error with the EFI_WRITE_PROTECTED error code.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
- the file handle to source location.
- @param[out] NewHandle A pointer to the location to return the opened
- handle for the new file.
- @param[in] FileName The Null-terminated string of the name of the file
- to be opened.
- @param[in] OpenMode The mode to open the file : Read or Read/Write or
- Read/Write/Create
- @param[in] Attributes Attributes of the file in case of a file creation
-
- @retval EFI_SUCCESS The file was open.
- @retval EFI_NOT_FOUND The specified file could not be found or the specified
- directory in which to create a file could not be found.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_WRITE_PROTECTED Attempt to create a directory. This is not possible
- with the Boot Monitor file system.
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsOpenFile (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- );
-
-/**
- Read data from an open file.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
- is the file handle to read data from.
- @param[in out] BufferSize On input, the size of the Buffer. On output, the
- amount of data returned in Buffer. In both cases,
- the size is measured in bytes.
- @param[out] Buffer The buffer into which the data is read.
-
- @retval EFI_SUCCESS The data was read.
- @retval EFI_DEVICE_ERROR On entry, the current file position is
- beyond the end of the file, or the device
- reported an error while performing the read
- operation.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsReadFile (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-EFIAPI
-EFI_STATUS
-BootMonFsSetDirPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- );
-
-EFIAPI
-EFI_STATUS
-BootMonFsGetPosition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- );
-
-/**
- Write data to an open file.
-
- The data is not written to the flash yet. It will be written when the file
- will be either read, closed or flushed.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
- is the file handle to write data to.
- @param[in out] BufferSize On input, the size of the Buffer. On output, the
- size of the data actually written. In both cases,
- the size is measured in bytes.
- @param[in] Buffer The buffer of data to write.
-
- @retval EFI_SUCCESS The data was written.
- @retval EFI_ACCESS_DENIED The file was opened read only.
- @retval EFI_OUT_OF_RESOURCES Unable to allocate the buffer to store the
- data to write.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsWriteFile (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- );
-
-EFIAPI
-EFI_STATUS
-BootMonFsDeleteFail (
- IN EFI_FILE_PROTOCOL *This
- );
-
-/**
- Close and delete a file from the boot monitor file system.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
- handle to delete.
-
- @retval EFI_SUCCESS The file was closed and deleted.
- @retval EFI_INVALID_PARAMETER The parameter "This" is NULL or is not an open
- file handle.
- @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsDelete (
- IN EFI_FILE_PROTOCOL *This
- );
-
-/**
- Set a file's current position.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
- the file handle to set the requested position on.
- @param[in] Position The byte position from the start of the file to set.
-
- @retval EFI_SUCCESS The position was set.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsSetPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- );
-
-/**
- Return a file's current position.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
- the file handle to get the current position on.
- @param[out] Position The address to return the file's current position value.
-
- @retval EFI_SUCCESS The position was returned.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsGetPosition(
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- );
-
-//
-// UNSUPPORTED OPERATIONS
-//
-
-EFIAPI
-EFI_STATUS
-BootMonFsGetPositionUnsupported (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- );
-
-/**
- Set information about a file or a volume.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
- is the file handle the information is for.
- @param[in] InformationType The type identifier for the information being set :
- EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or
- EFI_FILE_SYSTEM_VOLUME_LABEL_ID
- @param[in] BufferSize The size, in bytes, of Buffer.
- @param[in] Buffer A pointer to the data buffer to write. The type of the
- data inside the buffer is indicated by InformationType.
-
- @retval EFI_SUCCESS The information was set.
- @retval EFI_UNSUPPORTED The InformationType is not known.
- @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
- @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file
- to a file that is already present.
- @retval EFI_ACCESS_DENIED An attempt is being made to change the
- EFI_FILE_DIRECTORY Attribute.
- @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and
- the file was opened in read-only mode and an
- attempt is being made to modify a field other
- than Attribute.
- @retval EFI_WRITE_PROTECTED An attempt is being made to modify a read-only
- attribute.
- @retval EFI_BAD_BUFFER_SIZE The size of the buffer is lower than that indicated by
- the data inside the buffer.
- @retval EFI_OUT_OF_RESOURCES A allocation needed to process the request failed.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsSetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-//
-// Directory API
-//
-
-EFI_STATUS
-BootMonFsOpenDirectory (
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN BOOTMON_FS_INSTANCE *Volume
- );
-
-//
-// Internal API
-//
-
-/**
- Search for a file given its name coded in Ascii.
-
- When searching through the files of the volume, if a file is currently not
- open, its name was written on the media and is kept in RAM in the
- "HwDescription.Footer.Filename[]" field of the file's description.
-
- If a file is currently open, its name might not have been written on the
- media yet, and as the "HwDescription" is a mirror in RAM of what is on the
- media the "HwDescription.Footer.Filename[]" might be outdated. In that case,
- the up to date name of the file is stored in the "Info" field of the file's
- description.
-
- @param[in] Instance Pointer to the description of the volume in which
- the file has to be search for.
- @param[in] AsciiFileName Name of the file.
-
- @param[out] File Pointer to the description of the file if the
- file was found.
-
- @retval EFI_SUCCESS The file was found.
- @retval EFI_NOT_FOUND The file was not found.
-
-**/
-EFI_STATUS
-BootMonGetFileFromAsciiFileName (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN CHAR8* AsciiFileName,
- OUT BOOTMON_FS_FILE **File
- );
-
-EFI_STATUS
-BootMonGetFileFromPosition (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN UINTN Position,
- OUT BOOTMON_FS_FILE **File
- );
-
-#endif
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
deleted file mode 100644
index 450a707f18..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BootMonFsInternal.h"
-
-EFIAPI
-EFI_STATUS
-OpenBootMonFsOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- )
-{
- BOOTMON_FS_INSTANCE *Instance;
-
- Instance = BOOTMON_FS_FROM_FS_THIS (This);
- if (Instance == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- Instance->RootFile->Info->Attribute = EFI_FILE_READ_ONLY | EFI_FILE_DIRECTORY;
-
- *Root = &Instance->RootFile->File;
-
- return EFI_SUCCESS;
-}
-
-UINT32
-BootMonFsGetImageLength (
- IN BOOTMON_FS_FILE *File
- )
-{
- UINT32 Index;
- UINT32 FileSize;
- LIST_ENTRY *RegionToFlushLink;
- BOOTMON_FS_FILE_REGION *Region;
-
- FileSize = 0;
-
- // Look at all Flash areas to determine file size
- for (Index = 0; Index < HW_IMAGE_DESCRIPTION_REGION_MAX; Index++) {
- FileSize += File->HwDescription.Region[Index].Size;
- }
-
- // Add the regions that have not been flushed yet
- for (RegionToFlushLink = GetFirstNode (&File->RegionToFlushLink);
- !IsNull (&File->RegionToFlushLink, RegionToFlushLink);
- RegionToFlushLink = GetNextNode (&File->RegionToFlushLink, RegionToFlushLink)
- )
- {
- Region = (BOOTMON_FS_FILE_REGION*)RegionToFlushLink;
- if (Region->Offset + Region->Size > FileSize) {
- FileSize += Region->Offset + Region->Size;
- }
- }
-
- return FileSize;
-}
-
-UINTN
-BootMonFsGetPhysicalSize (
- IN BOOTMON_FS_FILE* File
- )
-{
- // Return 0 for files that haven't yet been flushed to media
- if (File->HwDescription.RegionCount == 0) {
- return 0;
- }
-
- return ((File->HwDescription.BlockEnd - File->HwDescription.BlockStart) + 1 )
- * File->Instance->Media->BlockSize;
-}
-
-EFIAPI
-EFI_STATUS
-BootMonFsSetDirPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-{
- BOOTMON_FS_FILE *File;
-
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // UEFI Spec section 12.5:
- // "The seek request for nonzero is not valid on open directories."
- if (Position != 0) {
- return EFI_UNSUPPORTED;
- }
- File->Position = Position;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BootMonFsOpenDirectory (
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN BOOTMON_FS_INSTANCE *Volume
- )
-{
- ASSERT(0);
-
- return EFI_UNSUPPORTED;
-}
-
-STATIC
-EFI_STATUS
-GetFileSystemVolumeLabelInfo (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- UINTN Size;
- EFI_FILE_SYSTEM_VOLUME_LABEL *Label;
- EFI_STATUS Status;
-
- Label = Buffer;
-
- // Value returned by StrSize includes null terminator.
- Size = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL
- + StrSize (Instance->FsInfo.VolumeLabel);
-
- if (*BufferSize >= Size) {
- CopyMem (&Label->VolumeLabel, &Instance->FsInfo.VolumeLabel, Size);
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_BUFFER_TOO_SMALL;
- }
- *BufferSize = Size;
- return Status;
-}
-
-// Helper function that calculates a rough "free space" by:
-// - Taking the media size
-// - Subtracting the sum of all file sizes
-// - Subtracting the block size times the number of files
-// (To account for the blocks containing the HW_IMAGE_INFO
-STATIC
-UINT64
-ComputeFreeSpace (
- IN BOOTMON_FS_INSTANCE *Instance
- )
-{
- LIST_ENTRY *FileLink;
- UINT64 FileSizeSum;
- UINT64 MediaSize;
- UINTN NumFiles;
- EFI_BLOCK_IO_MEDIA *Media;
- BOOTMON_FS_FILE *File;
-
- Media = Instance->BlockIo->Media;
- MediaSize = Media->BlockSize * (Media->LastBlock + 1);
-
- NumFiles = 0;
- FileSizeSum = 0;
- for (FileLink = GetFirstNode (&Instance->RootFile->Link);
- !IsNull (&Instance->RootFile->Link, FileLink);
- FileLink = GetNextNode (&Instance->RootFile->Link, FileLink)
- )
- {
- File = BOOTMON_FS_FILE_FROM_LINK_THIS (FileLink);
- FileSizeSum += BootMonFsGetImageLength (File);
-
- NumFiles++;
- }
-
- return MediaSize - (FileSizeSum + (Media->BlockSize + NumFiles));
-}
-
-STATIC
-EFI_STATUS
-GetFilesystemInfo (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
-
- if (*BufferSize >= Instance->FsInfo.Size) {
- Instance->FsInfo.FreeSpace = ComputeFreeSpace (Instance);
- CopyMem (Buffer, &Instance->FsInfo, Instance->FsInfo.Size);
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_BUFFER_TOO_SMALL;
- }
-
- *BufferSize = Instance->FsInfo.Size;
- return Status;
-}
-
-STATIC
-EFI_STATUS
-GetFileInfo (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN BOOTMON_FS_FILE *File,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_FILE_INFO *Info;
- UINTN ResultSize;
-
- ResultSize = SIZE_OF_EFI_FILE_INFO + StrSize (File->Info->FileName);
-
- if (*BufferSize < ResultSize) {
- *BufferSize = ResultSize;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- Info = Buffer;
-
- CopyMem (Info, File->Info, ResultSize);
- // Size of the information
- Info->Size = ResultSize;
-
- *BufferSize = ResultSize;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-GetBootMonFsFileInfo (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN BOOTMON_FS_FILE *File,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_FILE_INFO *Info;
- UINTN ResultSize;
- UINTN Index;
-
- if (File == Instance->RootFile) {
- Status = EFI_UNSUPPORTED;
- } else {
- ResultSize = SIZE_OF_BOOTMON_FS_FILE_INFO;
-
- if (*BufferSize < ResultSize) {
- *BufferSize = ResultSize;
- Status = EFI_BUFFER_TOO_SMALL;
- } else {
- Info = Buffer;
-
- // Zero out the structure
- ZeroMem (Info, ResultSize);
-
- // Fill in the structure
- Info->Size = ResultSize;
-
- Info->EntryPoint = File->HwDescription.EntryPoint;
- Info->RegionCount = File->HwDescription.RegionCount;
- for (Index = 0; Index < File->HwDescription.RegionCount; Index++) {
- Info->Region[Index].LoadAddress = File->HwDescription.Region[Index].LoadAddress;
- Info->Region[Index].Size = File->HwDescription.Region[Index].Size;
- Info->Region[Index].Offset = File->HwDescription.Region[Index].Offset;
- Info->Region[Index].Checksum = File->HwDescription.Region[Index].Checksum;
- }
- *BufferSize = ResultSize;
- Status = EFI_SUCCESS;
- }
- }
-
- return Status;
-}
-
-/**
- Set the name of a file.
-
- This is a helper function for SetFileInfo().
-
- @param[in] Instance A pointer to the description of the volume
- the file belongs to.
- @param[in] File A pointer to the description of the file.
- @param[in] FileName A pointer to the new name of the file.
-
- @retval EFI_SUCCESS The name was set.
- @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file
- to a file that is already present.
-
-**/
-STATIC
-EFI_STATUS
-SetFileName (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN BOOTMON_FS_FILE *File,
- IN CONST CHAR16 *FileName
- )
-{
- CHAR16 TruncFileName[MAX_NAME_LENGTH];
- CHAR8 AsciiFileName[MAX_NAME_LENGTH];
- BOOTMON_FS_FILE *SameFile;
-
- // If the file path start with a \ strip it. The EFI Shell may
- // insert a \ in front of the file name.
- if (FileName[0] == L'\\') {
- FileName++;
- }
-
- StrnCpy (TruncFileName, FileName, MAX_NAME_LENGTH - 1);
- TruncFileName[MAX_NAME_LENGTH - 1] = 0;
- UnicodeStrToAsciiStr (TruncFileName, AsciiFileName);
-
- if (BootMonGetFileFromAsciiFileName (
- File->Instance,
- AsciiFileName,
- &SameFile
- ) != EFI_NOT_FOUND) {
- // A file with that name already exists.
- return EFI_ACCESS_DENIED;
- } else {
- // OK, change the filename.
- AsciiStrToUnicodeStr (AsciiFileName, File->Info->FileName);
- return EFI_SUCCESS;
- }
-}
-
-/**
- Set the size of a file.
-
- This is a helper function for SetFileInfo().
-
- @param[in] Instance A pointer to the description of the volume
- the file belongs to.
- @param[in] File A pointer to the description of the file.
- @param[in] NewSize The requested new size for the file.
-
- @retval EFI_SUCCESS The size was set.
- @retval EFI_OUT_OF_RESOURCES An allocation needed to process the request failed.
-
-**/
-STATIC
-EFI_STATUS
-SetFileSize (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN BOOTMON_FS_FILE *BootMonFsFile,
- IN UINTN NewSize
- )
-{
- EFI_STATUS Status;
- UINT32 OldSize;
- LIST_ENTRY *RegionToFlushLink;
- LIST_ENTRY *NextRegionToFlushLink;
- BOOTMON_FS_FILE_REGION *Region;
- EFI_FILE_PROTOCOL *File;
- CHAR8 *Buffer;
- UINTN BufferSize;
- UINT64 StoredPosition;
-
- OldSize = BootMonFsFile->Info->FileSize;
-
- //
- // In case of file truncation, force the regions waiting for writing to
- // not overflow the new size of the file.
- //
- if (NewSize < OldSize) {
- for (RegionToFlushLink = GetFirstNode (&BootMonFsFile->RegionToFlushLink);
- !IsNull (&BootMonFsFile->RegionToFlushLink, RegionToFlushLink);
- )
- {
- NextRegionToFlushLink = GetNextNode (&BootMonFsFile->RegionToFlushLink, RegionToFlushLink);
- Region = (BOOTMON_FS_FILE_REGION*)RegionToFlushLink;
- if (Region->Offset > NewSize) {
- RemoveEntryList (RegionToFlushLink);
- FreePool (Region->Buffer);
- FreePool (Region);
- } else {
- Region->Size = MIN (Region->Size, NewSize - Region->Offset);
- }
- RegionToFlushLink = NextRegionToFlushLink;
- }
-
- } else if (NewSize > OldSize) {
- // Increasing a file's size is potentially complicated as it may require
- // moving the image description on media. The simplest way to do it is to
- // seek past the end of the file (which is valid in UEFI) and perform a
- // Write.
- File = &BootMonFsFile->File;
-
- // Save position
- Status = File->GetPosition (File, &StoredPosition);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- // Set position at the end of the file
- Status = File->SetPosition (File, OldSize);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BufferSize = NewSize - OldSize;
- Buffer = AllocateZeroPool (BufferSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = File->Write (File, &BufferSize, Buffer);
- FreePool (Buffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Restore saved position
- Status = File->SetPosition (File, StoredPosition);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- BootMonFsFile->Info->FileSize = NewSize;
-
- return EFI_SUCCESS;
-}
-
-/**
- Set information about a file.
-
- @param[in] Instance A pointer to the description of the volume
- the file belongs to.
- @param[in] File A pointer to the description of the file.
- @param[in] Info A pointer to the file information to write.
-
- @retval EFI_SUCCESS The information was set.
- @retval EFI_ACCESS_DENIED An attempt is being made to change the
- EFI_FILE_DIRECTORY Attribute.
- @retval EFI_ACCESS_DENIED The file was opened in read-only mode and an
- attempt is being made to modify a field other
- than Attribute.
- @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file
- to a file that is already present.
- @retval EFI_WRITE_PROTECTED An attempt is being made to modify a read-only
- attribute.
- @retval EFI_OUT_OF_RESOURCES An allocation needed to process the request
- failed.
-
-**/
-STATIC
-EFI_STATUS
-SetFileInfo (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN BOOTMON_FS_FILE *File,
- IN EFI_FILE_INFO *Info
- )
-{
- EFI_STATUS Status;
- BOOLEAN FileSizeIsDifferent;
- BOOLEAN FileNameIsDifferent;
- BOOLEAN TimeIsDifferent;
-
- //
- // A directory can not be changed to a file and a file can
- // not be changed to a directory.
- //
- if ((Info->Attribute & EFI_FILE_DIRECTORY) !=
- (File->Info->Attribute & EFI_FILE_DIRECTORY) ) {
- return EFI_ACCESS_DENIED;
- }
-
- FileSizeIsDifferent = (Info->FileSize != File->Info->FileSize);
- FileNameIsDifferent = (StrnCmp (
- Info->FileName,
- File->Info->FileName,
- MAX_NAME_LENGTH - 1
- ) != 0);
- //
- // Check if the CreateTime, LastAccess or ModificationTime
- // have been changed. The file system does not support file
- // timestamps thus the three times in "File->Info" are
- // always equal to zero. The following comparison actually
- // checks if all three times are still equal to 0 or not.
- //
- TimeIsDifferent = CompareMem (
- &Info->CreateTime,
- &File->Info->CreateTime,
- 3 * sizeof (EFI_TIME)
- ) != 0;
-
- //
- // For a file opened in read-only mode, only the Attribute field can be
- // modified. The root directory open mode is forced to read-only at opening
- // thus the following test protects the root directory to be somehow modified.
- //
- if (File->OpenMode == EFI_FILE_MODE_READ) {
- if (FileSizeIsDifferent || FileNameIsDifferent || TimeIsDifferent) {
- return EFI_ACCESS_DENIED;
- }
- }
-
- if (TimeIsDifferent) {
- return EFI_WRITE_PROTECTED;
- }
-
- if (FileSizeIsDifferent) {
- Status = SetFileSize (Instance, File, Info->FileSize);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Note down in RAM the Attribute field but we can not
- // ask to store it in flash for the time being.
- //
- File->Info->Attribute = Info->Attribute;
-
- if (FileNameIsDifferent) {
- Status = SetFileName (Instance, File, Info->FileName);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFIAPI
-EFI_STATUS
-BootMonFsGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_FILE *File;
- BOOTMON_FS_INSTANCE *Instance;
-
- if ((This == NULL) ||
- (InformationType == NULL) ||
- (BufferSize == NULL) ||
- ((Buffer == NULL) && (*BufferSize > 0)) ) {
- return EFI_INVALID_PARAMETER;
- }
-
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- Instance = File->Instance;
-
- // If the instance has not been initialized yet then do it ...
- if (!Instance->Initialized) {
- Status = BootMonFsInitialize (Instance);
- } else {
- Status = EFI_SUCCESS;
- }
-
- if (!EFI_ERROR (Status)) {
- if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)
- != 0) {
- Status = GetFileSystemVolumeLabelInfo (Instance, BufferSize, Buffer);
- } else if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid) != 0) {
- Status = GetFilesystemInfo (Instance, BufferSize, Buffer);
- } else if (CompareGuid (InformationType, &gEfiFileInfoGuid) != 0) {
- Status = GetFileInfo (Instance, File, BufferSize, Buffer);
- } else if (CompareGuid (InformationType, &gArmBootMonFsFileInfoGuid) != 0) {
- Status = GetBootMonFsFileInfo (Instance, File, BufferSize, Buffer);
- } else {
- Status = EFI_UNSUPPORTED;
- }
- }
-
- return Status;
-}
-
-/**
- Set information about a file or a volume.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
- is the file handle the information is for.
- @param[in] InformationType The type identifier for the information being set :
- EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or
- EFI_FILE_SYSTEM_VOLUME_LABEL_ID
- @param[in] BufferSize The size, in bytes, of Buffer.
- @param[in] Buffer A pointer to the data buffer to write. The type of the
- data inside the buffer is indicated by InformationType.
-
- @retval EFI_SUCCESS The information was set.
- @retval EFI_UNSUPPORTED The InformationType is not known.
- @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
- @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file
- to a file that is already present.
- @retval EFI_ACCESS_DENIED An attempt is being made to change the
- EFI_FILE_DIRECTORY Attribute.
- @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and
- the file was opened in read-only mode and an
- attempt is being made to modify a field other
- than Attribute.
- @retval EFI_WRITE_PROTECTED An attempt is being made to modify a read-only
- attribute.
- @retval EFI_BAD_BUFFER_SIZE The size of the buffer is lower than that indicated by
- the data inside the buffer.
- @retval EFI_OUT_OF_RESOURCES A allocation needed to process the request failed.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsSetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- BOOTMON_FS_FILE *File;
- EFI_FILE_INFO *Info;
- EFI_FILE_SYSTEM_INFO *SystemInfo;
-
- if ((This == NULL) ||
- (InformationType == NULL) ||
- (Buffer == NULL) ) {
- return EFI_INVALID_PARAMETER;
- }
-
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {
- Info = Buffer;
- if (Info->Size < (SIZE_OF_EFI_FILE_INFO + StrSize (Info->FileName))) {
- return EFI_INVALID_PARAMETER;
- }
- if (BufferSize < Info->Size) {
- return EFI_BAD_BUFFER_SIZE;
- }
- return (SetFileInfo (File->Instance, File, Info));
- }
-
- //
- // The only writable field in the other two information types
- // (i.e. EFI_FILE_SYSTEM_INFO and EFI_FILE_SYSTEM_VOLUME_LABEL) is the
- // filesystem volume label. This can be retrieved with GetInfo, but it is
- // hard-coded into this driver, not stored on media.
- //
-
- if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
- SystemInfo = Buffer;
- if (SystemInfo->Size <
- (SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (SystemInfo->VolumeLabel))) {
- return EFI_INVALID_PARAMETER;
- }
- if (BufferSize < SystemInfo->Size) {
- return EFI_BAD_BUFFER_SIZE;
- }
- return EFI_WRITE_PROTECTED;
- }
-
- if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- return EFI_WRITE_PROTECTED;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-EFIAPI
-EFI_STATUS
-BootMonFsReadDirectory (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- BOOTMON_FS_INSTANCE *Instance;
- BOOTMON_FS_FILE *RootFile;
- BOOTMON_FS_FILE *File;
- EFI_FILE_INFO *Info;
- UINTN NameSize;
- UINTN ResultSize;
- EFI_STATUS Status;
- UINTN Index;
-
- RootFile = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (RootFile == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Instance = RootFile->Instance;
- Status = BootMonGetFileFromPosition (Instance, RootFile->Position, &File);
- if (EFI_ERROR (Status)) {
- // No more file
- *BufferSize = 0;
- return EFI_SUCCESS;
- }
-
- NameSize = AsciiStrLen (File->HwDescription.Footer.Filename) + 1;
- ResultSize = SIZE_OF_EFI_FILE_INFO + (NameSize * sizeof (CHAR16));
- if (*BufferSize < ResultSize) {
- *BufferSize = ResultSize;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- // Zero out the structure
- Info = Buffer;
- ZeroMem (Info, ResultSize);
-
- // Fill in the structure
- Info->Size = ResultSize;
- Info->FileSize = BootMonFsGetImageLength (File);
- Info->PhysicalSize = BootMonFsGetPhysicalSize (File);
- for (Index = 0; Index < NameSize; Index++) {
- Info->FileName[Index] = File->HwDescription.Footer.Filename[Index];
- }
-
- *BufferSize = ResultSize;
- RootFile->Position++;
-
- return EFI_SUCCESS;
-}
-
-EFIAPI
-EFI_STATUS
-BootMonFsFlushDirectory (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- BOOTMON_FS_FILE *RootFile;
- LIST_ENTRY *ListFiles;
- LIST_ENTRY *Link;
- BOOTMON_FS_FILE *File;
-
- RootFile = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (RootFile == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ListFiles = &RootFile->Link;
-
- if (IsListEmpty (ListFiles)) {
- return EFI_SUCCESS;
- }
-
- //
- // Flush all the files that need to be flushed
- //
-
- // Go through all the list of files to flush them
- for (Link = GetFirstNode (ListFiles);
- !IsNull (ListFiles, Link);
- Link = GetNextNode (ListFiles, Link)
- )
- {
- File = BOOTMON_FS_FILE_FROM_LINK_THIS (Link);
- File->File.Flush (&File->File);
- }
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsEntryPoint.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsEntryPoint.c
deleted file mode 100644
index 3d71760fef..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsEntryPoint.c
+++ /dev/null
@@ -1,528 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PrintLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/DevicePathFromText.h>
-#include <Protocol/DriverBinding.h>
-
-#include "BootMonFsInternal.h"
-
-EFI_DEVICE_PATH* mBootMonFsSupportedDevicePaths;
-LIST_ENTRY mInstances;
-
-EFI_FILE_PROTOCOL mBootMonFsRootTemplate = {
- EFI_FILE_PROTOCOL_REVISION,
- BootMonFsOpenFile,
- BootMonFsCloseFile,
- BootMonFsDeleteFail,
- BootMonFsReadDirectory,
- BootMonFsWriteFile,
- BootMonFsGetPositionUnsupported, // UEFI Spec: GetPosition not valid on dirs
- BootMonFsSetDirPosition,
- BootMonFsGetInfo,
- BootMonFsSetInfo,
- BootMonFsFlushDirectory
-};
-
-EFI_FILE_PROTOCOL mBootMonFsFileTemplate = {
- EFI_FILE_PROTOCOL_REVISION,
- BootMonFsOpenFile,
- BootMonFsCloseFile,
- BootMonFsDelete,
- BootMonFsReadFile,
- BootMonFsWriteFile,
- BootMonFsGetPosition,
- BootMonFsSetPosition,
- BootMonFsGetInfo,
- BootMonFsSetInfo,
- BootMonFsFlushFile
-};
-
-/**
- Search for a file given its name coded in Ascii.
-
- When searching through the files of the volume, if a file is currently not
- open, its name was written on the media and is kept in RAM in the
- "HwDescription.Footer.Filename[]" field of the file's description.
-
- If a file is currently open, its name might not have been written on the
- media yet, and as the "HwDescription" is a mirror in RAM of what is on the
- media the "HwDescription.Footer.Filename[]" might be outdated. In that case,
- the up to date name of the file is stored in the "Info" field of the file's
- description.
-
- @param[in] Instance Pointer to the description of the volume in which
- the file has to be search for.
- @param[in] AsciiFileName Name of the file.
-
- @param[out] File Pointer to the description of the file if the
- file was found.
-
- @retval EFI_SUCCESS The file was found.
- @retval EFI_NOT_FOUND The file was not found.
-
-**/
-EFI_STATUS
-BootMonGetFileFromAsciiFileName (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN CHAR8* AsciiFileName,
- OUT BOOTMON_FS_FILE **File
- )
-{
- LIST_ENTRY *Entry;
- BOOTMON_FS_FILE *FileEntry;
- CHAR8 OpenFileAsciiFileName[MAX_NAME_LENGTH];
- CHAR8 *AsciiFileNameToCompare;
-
- // Go through all the files in the list and return the file handle
- for (Entry = GetFirstNode (&Instance->RootFile->Link);
- !IsNull (&Instance->RootFile->Link, Entry);
- Entry = GetNextNode (&Instance->RootFile->Link, Entry)
- )
- {
- FileEntry = BOOTMON_FS_FILE_FROM_LINK_THIS (Entry);
- if (FileEntry->Info != NULL) {
- UnicodeStrToAsciiStr (FileEntry->Info->FileName, OpenFileAsciiFileName);
- AsciiFileNameToCompare = OpenFileAsciiFileName;
- } else {
- AsciiFileNameToCompare = FileEntry->HwDescription.Footer.Filename;
- }
-
- if (AsciiStrCmp (AsciiFileNameToCompare, AsciiFileName) == 0) {
- *File = FileEntry;
- return EFI_SUCCESS;
- }
- }
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-BootMonGetFileFromPosition (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN UINTN Position,
- OUT BOOTMON_FS_FILE **File
- )
-{
- LIST_ENTRY *Entry;
- BOOTMON_FS_FILE *FileEntry;
-
- // Go through all the files in the list and return the file handle
- for (Entry = GetFirstNode (&Instance->RootFile->Link);
- !IsNull (&Instance->RootFile->Link, Entry) && (&Instance->RootFile->Link != Entry);
- Entry = GetNextNode (&Instance->RootFile->Link, Entry)
- )
- {
- if (Position == 0) {
- FileEntry = BOOTMON_FS_FILE_FROM_LINK_THIS (Entry);
- *File = FileEntry;
- return EFI_SUCCESS;
- }
- Position--;
- }
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-BootMonFsCreateFile (
- IN BOOTMON_FS_INSTANCE *Instance,
- OUT BOOTMON_FS_FILE **File
- )
-{
- BOOTMON_FS_FILE *NewFile;
-
- NewFile = (BOOTMON_FS_FILE*)AllocateZeroPool (sizeof (BOOTMON_FS_FILE));
- if (NewFile == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewFile->Signature = BOOTMON_FS_FILE_SIGNATURE;
- InitializeListHead (&NewFile->Link);
- InitializeListHead (&NewFile->RegionToFlushLink);
- NewFile->Instance = Instance;
-
- // If the created file is the root file then create a directory EFI_FILE_PROTOCOL
- if (Instance->RootFile == *File) {
- CopyMem (&NewFile->File, &mBootMonFsRootTemplate, sizeof (mBootMonFsRootTemplate));
- } else {
- CopyMem (&NewFile->File, &mBootMonFsFileTemplate, sizeof (mBootMonFsFileTemplate));
- }
- *File = NewFile;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-SupportedDevicePathsInit (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16* DevicePathListStr;
- CHAR16* DevicePathStr;
- CHAR16* NextDevicePathStr;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
-
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR (Status);
-
- // Initialize Variable
- DevicePathListStr = (CHAR16*)PcdGetPtr (PcdBootMonFsSupportedDevicePaths);
- mBootMonFsSupportedDevicePaths = NULL;
-
- // Extract the Device Path instances from the multi-device path string
- while ((DevicePathListStr != NULL) && (DevicePathListStr[0] != L'\0')) {
- NextDevicePathStr = StrStr (DevicePathListStr, L";");
- if (NextDevicePathStr == NULL) {
- DevicePathStr = DevicePathListStr;
- DevicePathListStr = NULL;
- } else {
- DevicePathStr = (CHAR16*)AllocateCopyPool ((NextDevicePathStr - DevicePathListStr + 1) * sizeof (CHAR16), DevicePathListStr);
- if (DevicePathStr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- *(DevicePathStr + (NextDevicePathStr - DevicePathListStr)) = L'\0';
- DevicePathListStr = NextDevicePathStr;
- if (DevicePathListStr[0] == L';') {
- DevicePathListStr++;
- }
- }
-
- Instance = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (DevicePathStr);
- ASSERT (Instance != NULL);
- mBootMonFsSupportedDevicePaths = AppendDevicePathInstance (mBootMonFsSupportedDevicePaths, Instance);
-
- if (NextDevicePathStr != NULL) {
- FreePool (DevicePathStr);
- }
- FreePool (Instance);
- }
-
- if (mBootMonFsSupportedDevicePaths == NULL) {
- return EFI_UNSUPPORTED;
- } else {
- return EFI_SUCCESS;
- }
-}
-
-EFI_STATUS
-EFIAPI
-BootMonFsDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL
- )
-{
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathProtocol;
- EFI_DEVICE_PATH_PROTOCOL *SupportedDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *SupportedDevicePaths;
- EFI_STATUS Status;
- UINTN Size1;
- UINTN Size2;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
- gImageHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- gImageHandle,
- ControllerHandle
- );
-
- // Check that BlockIo protocol instance exists
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- NULL,
- gImageHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Check if a DevicePath is attached to the handle
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **)&DevicePathProtocol,
- gImageHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Check if the Device Path is the one which contains the Boot Monitor File System
- Size1 = GetDevicePathSize (DevicePathProtocol);
-
- // Go through the list of Device Path Instances
- Status = EFI_UNSUPPORTED;
- SupportedDevicePaths = mBootMonFsSupportedDevicePaths;
- while (SupportedDevicePaths != NULL) {
- SupportedDevicePath = GetNextDevicePathInstance (&SupportedDevicePaths, &Size2);
-
- if ((Size1 == Size2) && (CompareMem (DevicePathProtocol, SupportedDevicePath, Size1) == 0)) {
- // The Device Path is supported
- Status = EFI_SUCCESS;
- break;
- }
- }
-
- gBS->CloseProtocol (ControllerHandle, &gEfiDevicePathProtocolGuid, gImageHandle, ControllerHandle);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-BootMonFsDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL
- )
-{
- BOOTMON_FS_INSTANCE *Instance;
- EFI_STATUS Status;
- UINTN VolumeNameSize;
- EFI_FILE_INFO *Info;
-
- Instance = AllocateZeroPool (sizeof (BOOTMON_FS_INSTANCE));
- if (Instance == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- // Initialize the BlockIo of the Instance
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **)&(Instance->BlockIo),
- gImageHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **)&(Instance->DiskIo),
- gImageHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Initialize the attributes of the Instance
- //
- Instance->Signature = BOOTMON_FS_SIGNATURE;
- Instance->ControllerHandle = ControllerHandle;
- Instance->Media = Instance->BlockIo->Media;
- Instance->Binding = DriverBinding;
-
- // Initialize the Simple File System Protocol
- Instance->Fs.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
- Instance->Fs.OpenVolume = OpenBootMonFsOpenVolume;
-
- // Volume name + L' ' + '2' digit number
- VolumeNameSize = StrSize (BOOTMON_FS_VOLUME_LABEL) + (3 * sizeof (CHAR16));
-
- // Initialize FileSystem Information
- Instance->FsInfo.Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + VolumeNameSize;
- Instance->FsInfo.BlockSize = Instance->Media->BlockSize;
- Instance->FsInfo.ReadOnly = FALSE;
- Instance->FsInfo.VolumeSize =
- Instance->Media->BlockSize * (Instance->Media->LastBlock - Instance->Media->LowestAlignedLba);
- CopyMem (Instance->FsInfo.VolumeLabel, BOOTMON_FS_VOLUME_LABEL, StrSize (BOOTMON_FS_VOLUME_LABEL));
-
- // Initialize the root file
- Status = BootMonFsCreateFile (Instance, &Instance->RootFile);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Info = AllocateZeroPool (sizeof (EFI_FILE_INFO));
- if (Info == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
- Instance->RootFile->Info = Info;
-
- // Initialize the DevicePath of the Instance
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **)&(Instance->DevicePath),
- gImageHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Install the Simple File System Protocol
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, &Instance->Fs,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- InsertTailList (&mInstances, &Instance->Link);
-
- return EFI_SUCCESS;
-
-Error:
-
- if (Instance->RootFile != NULL) {
- if (Instance->RootFile->Info != NULL) {
- FreePool (Instance->RootFile->Info);
- }
- FreePool (Instance->RootFile);
- }
- FreePool (Instance);
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-BootMonFsDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
- )
-{
- BOOTMON_FS_INSTANCE *Instance;
- LIST_ENTRY *Link;
- EFI_STATUS Status;
- BOOLEAN InstanceFound;
-
- // Find instance from ControllerHandle.
- Instance = NULL;
- InstanceFound = FALSE;
- // For each instance in mInstances:
- for (Link = GetFirstNode (&mInstances); !IsNull (&mInstances, Link); Link = GetNextNode (&mInstances, Link)) {
- Instance = BOOTMON_FS_FROM_LINK (Link);
-
- if (Instance->ControllerHandle == ControllerHandle) {
- InstanceFound = TRUE;
- break;
- }
- }
- ASSERT (InstanceFound == TRUE);
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- DriverBinding->ImageHandle,
- ControllerHandle);
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- DriverBinding->ImageHandle,
- ControllerHandle);
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- DriverBinding->ImageHandle,
- ControllerHandle);
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, &Instance->Fs,
- NULL);
-
- FreePool (Instance->RootFile->Info);
- FreePool (Instance->RootFile);
- FreePool (Instance);
-
- return Status;
-}
-
-//
-// Simple Network Protocol Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL mBootMonFsDriverBinding = {
- BootMonFsDriverSupported,
- BootMonFsDriverStart,
- BootMonFsDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-BootMonFsEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- InitializeListHead (&mInstances);
-
- // Initialize the list of Device Paths that could support BootMonFs
- Status = SupportedDevicePathsInit ();
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ImageHandle,
- &gEfiDriverBindingProtocolGuid, &mBootMonFsDriverBinding,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- } else {
- DEBUG((EFI_D_ERROR,"Warning: No Device Paths supporting BootMonFs have been defined in the PCD.\n"));
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h
deleted file mode 100644
index c1bef755ae..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __BOOTMON_FS_HW_H__
-#define __BOOTMON_FS_HW_H__
-
-#define MAX_NAME_LENGTH 32
-
-#define HW_IMAGE_FOOTER_SIGNATURE_1 0x464C5348
-#define HW_IMAGE_FOOTER_SIGNATURE_2 0x464F4F54
-
-#define HW_IMAGE_FOOTER_VERSION 1
-#define HW_IMAGE_FOOTER_OFFSET 92
-
-#define HW_IMAGE_FOOTER_VERSION2 2
-#define HW_IMAGE_FOOTER_OFFSET2 96
-
-typedef struct {
- CHAR8 Filename[MAX_NAME_LENGTH];
- UINT32 Offset;
- UINT32 Version;
- UINT32 FooterSignature1;
- UINT32 FooterSignature2;
-} HW_IMAGE_FOOTER;
-
-#define HW_IMAGE_DESCRIPTION_REGION_MAX 4
-
-// This structure is located at the end of a block when a file is present
-typedef struct {
- UINT32 EntryPoint;
- UINT32 Attributes;
- UINT32 RegionCount;
- struct {
- UINT32 LoadAddress;
- UINT32 Size;
- UINT32 Offset;
- UINT32 Checksum;
- } Region[HW_IMAGE_DESCRIPTION_REGION_MAX];
- UINT32 BlockStart;
- UINT32 BlockEnd;
- UINT32 FooterChecksum;
-
- HW_IMAGE_FOOTER Footer;
-} HW_IMAGE_DESCRIPTION;
-
-#endif
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c
deleted file mode 100644
index 346c360292..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/IoLib.h>
-#include <Library/NorFlashPlatformLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Protocol/SimpleFileSystem.h>
-
-#include "BootMonFsInternal.h"
-
-UINT32
-BootMonFsChecksum (
- IN VOID *Data,
- IN UINT32 Size
- )
-{
- UINT32 *Ptr;
- UINT32 Word;
- UINT32 Checksum;
-
- ASSERT (Size % 4 == 0);
-
- Checksum = 0;
- Ptr = (UINT32*)Data;
-
- while (Size > 0) {
- Word = *Ptr++;
- Size -= 4;
-
- if (Word > ~Checksum) {
- Checksum++;
- }
-
- Checksum += Word;
- }
-
- return ~Checksum;
-}
-
-EFI_STATUS
-BootMonFsComputeFooterChecksum (
- IN OUT HW_IMAGE_DESCRIPTION *Footer
- )
-{
- HW_IMAGE_DESCRIPTION *Description;
- UINT32 Index;
-
- Footer->Attributes = 1;
-
- Description = AllocateZeroPool (sizeof (HW_IMAGE_DESCRIPTION));
- if (Description == NULL) {
- DEBUG ((DEBUG_ERROR, "BootMonFsComputeFooterChecksum: Unable to allocate memory.\n"));
- return EFI_OUT_OF_RESOURCES;
- }
-
- // Copy over to temporary shim
- CopyMem (Description, Footer, sizeof (HW_IMAGE_DESCRIPTION));
-
- // BootMon doesn't checksum the previous checksum
- Description->FooterChecksum = 0;
-
- // Blank out regions which aren't being used.
- for (Index = Footer->RegionCount; Index < HW_IMAGE_DESCRIPTION_REGION_MAX; Index++) {
- Description->Region[Index].Checksum = 0;
- Description->Region[Index].LoadAddress = 0;
- Description->Region[Index].Offset = 0;
- Description->Region[Index].Size = 0;
- }
-
- // Compute the checksum
- Footer->FooterChecksum = BootMonFsChecksum (Description, sizeof (HW_IMAGE_DESCRIPTION));
-
- FreePool (Description);
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-BootMonFsIsImageValid (
- IN HW_IMAGE_DESCRIPTION *Desc,
- IN EFI_LBA Lba
- )
-{
- EFI_STATUS Status;
- HW_IMAGE_FOOTER *Footer;
- UINT32 Checksum;
-
- Footer = &Desc->Footer;
-
- // Check that the verification bytes are present
- if ((Footer->FooterSignature1 != HW_IMAGE_FOOTER_SIGNATURE_1) ||
- (Footer->FooterSignature2 != HW_IMAGE_FOOTER_SIGNATURE_2)) {
- return FALSE;
- }
-
- if (Footer->Version == HW_IMAGE_FOOTER_VERSION) {
- if (Footer->Offset != HW_IMAGE_FOOTER_OFFSET) {
- return FALSE;
- }
- } else if (Footer->Version == HW_IMAGE_FOOTER_VERSION2) {
- if (Footer->Offset != HW_IMAGE_FOOTER_OFFSET2) {
- return FALSE;
- }
- } else {
- return FALSE;
- }
-
- Checksum = Desc->FooterChecksum;
- Status = BootMonFsComputeFooterChecksum (Desc);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Warning: failed to compute checksum for image '%a'\n", Desc->Footer.Filename));
- }
-
- if (Desc->FooterChecksum != Checksum) {
- DEBUG ((DEBUG_ERROR, "Warning: image '%a' checksum mismatch.\n", Desc->Footer.Filename));
- }
-
- if ((Desc->BlockEnd != Lba) || (Desc->BlockStart > Desc->BlockEnd)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-STATIC
-EFI_STATUS
-BootMonFsDiscoverNextImage (
- IN BOOTMON_FS_INSTANCE *Instance,
- IN OUT EFI_LBA *LbaStart,
- IN OUT BOOTMON_FS_FILE *File
- )
-{
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_LBA CurrentLba;
- UINT64 DescOffset;
- EFI_STATUS Status;
-
- DiskIo = Instance->DiskIo;
-
- CurrentLba = *LbaStart;
-
- // Look for images in the rest of this block
- while (CurrentLba <= Instance->Media->LastBlock) {
- // Work out the byte offset into media of the image description in this block
- // If present, the image description is at the very end of the block.
- DescOffset = ((CurrentLba + 1) * Instance->Media->BlockSize) - sizeof (HW_IMAGE_DESCRIPTION);
-
- // Read the image description from media
- Status = DiskIo->ReadDisk (DiskIo,
- Instance->Media->MediaId,
- DescOffset,
- sizeof (HW_IMAGE_DESCRIPTION),
- &File->HwDescription
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // If we found a valid image description...
- if (BootMonFsIsImageValid (&File->HwDescription, (CurrentLba - Instance->Media->LowestAlignedLba))) {
- DEBUG ((EFI_D_ERROR, "Found image: %a in block %d.\n",
- &(File->HwDescription.Footer.Filename),
- (UINTN)(CurrentLba - Instance->Media->LowestAlignedLba)
- ));
- File->HwDescAddress = DescOffset;
-
- *LbaStart = CurrentLba + 1;
- return EFI_SUCCESS;
- } else {
- CurrentLba++;
- }
- }
-
- *LbaStart = CurrentLba;
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-BootMonFsInitialize (
- IN BOOTMON_FS_INSTANCE *Instance
- )
-{
- EFI_STATUS Status;
- EFI_LBA Lba;
- UINT32 ImageCount;
- BOOTMON_FS_FILE *NewFile;
-
- ImageCount = 0;
- Lba = 0;
-
- while (1) {
- Status = BootMonFsCreateFile (Instance, &NewFile);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = BootMonFsDiscoverNextImage (Instance, &Lba, NewFile);
- if (EFI_ERROR (Status)) {
- // Free NewFile allocated by BootMonFsCreateFile ()
- FreePool (NewFile);
- break;
- }
- InsertTailList (&Instance->RootFile->Link, &NewFile->Link);
- ImageCount++;
- }
-
- Instance->Initialized = TRUE;
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h
deleted file mode 100644
index c0c6599cb7..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __BOOTMONFS_INTERNAL_H__
-#define __BOOTMONFS_INTERNAL_H__
-
-#include <PiDxe.h>
-#include <Library/UefiLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Protocol/BlockIo.h>
-#include <Protocol/DiskIo.h>
-#include <Protocol/FirmwareVolumeBlock.h>
-#include <Protocol/SimpleFileSystem.h>
-
-#include <Guid/BootMonFsFileInfo.h>
-#include <Guid/FileInfo.h>
-#include <Guid/FileSystemInfo.h>
-#include <Guid/FileSystemVolumeLabelInfo.h>
-
-#include "BootMonFsHw.h"
-
-#define BOOTMON_FS_VOLUME_LABEL L"NOR Flash"
-
-typedef struct _BOOTMON_FS_INSTANCE BOOTMON_FS_INSTANCE;
-
-typedef struct {
- LIST_ENTRY Link;
- VOID* Buffer;
- UINTN Size;
- UINT64 Offset; // Offset from the start of the file
-} BOOTMON_FS_FILE_REGION;
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- BOOTMON_FS_INSTANCE *Instance;
-
- UINTN HwDescAddress;
- HW_IMAGE_DESCRIPTION HwDescription;
-
- EFI_FILE_PROTOCOL File;
-
- //
- // The following fields are relevant only if the file is open.
- //
-
- EFI_FILE_INFO *Info;
- UINT64 Position;
- // If the file needs to be flushed then this list contain the memory
- // buffer that creates this file
- LIST_ENTRY RegionToFlushLink;
- UINT64 OpenMode;
-} BOOTMON_FS_FILE;
-
-#define BOOTMON_FS_FILE_SIGNATURE SIGNATURE_32('b', 'o', 't', 'f')
-#define BOOTMON_FS_FILE_FROM_FILE_THIS(a) CR (a, BOOTMON_FS_FILE, File, BOOTMON_FS_FILE_SIGNATURE)
-#define BOOTMON_FS_FILE_FROM_LINK_THIS(a) CR (a, BOOTMON_FS_FILE, Link, BOOTMON_FS_FILE_SIGNATURE)
-
-struct _BOOTMON_FS_INSTANCE {
- UINT32 Signature;
- EFI_HANDLE ControllerHandle;
-
- LIST_ENTRY Link;
-
- EFI_DRIVER_BINDING_PROTOCOL *Binding;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL Fs;
-
- EFI_FILE_SYSTEM_INFO FsInfo;
- CHAR16 Label[20];
-
- BOOTMON_FS_FILE *RootFile; // All the other files are linked to this root
- BOOLEAN Initialized;
-};
-
-#define BOOTMON_FS_SIGNATURE SIGNATURE_32('b', 'o', 't', 'm')
-#define BOOTMON_FS_FROM_FS_THIS(a) CR (a, BOOTMON_FS_INSTANCE, Fs, BOOTMON_FS_SIGNATURE)
-#define BOOTMON_FS_FROM_LINK(a) CR (a, BOOTMON_FS_INSTANCE, Link, BOOTMON_FS_SIGNATURE)
-
-#include "BootMonFsApi.h"
-
-#endif
-
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c
deleted file mode 100644
index af2fe514f0..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BootMonFsInternal.h"
-
-// Clear a file's image description on storage media:
-// UEFI allows you to seek past the end of a file, a subsequent write will grow
-// the file. It does not specify how space between the former end of the file
-// and the beginning of the write should be filled. It's therefore possible that
-// BootMonFs metadata, that comes after the end of a file, could be left there
-// and wrongly detected by BootMonFsImageInBlock.
-STATIC
-EFI_STATUS
-InvalidateImageDescription (
- IN BOOTMON_FS_FILE *File
- )
-{
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- UINT32 MediaId;
- VOID *Buffer;
- EFI_STATUS Status;
-
- DiskIo = File->Instance->DiskIo;
- BlockIo = File->Instance->BlockIo;
- MediaId = BlockIo->Media->MediaId;
-
- Buffer = AllocateZeroPool (sizeof (HW_IMAGE_DESCRIPTION));
-
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = DiskIo->WriteDisk (DiskIo,
- MediaId,
- File->HwDescAddress,
- sizeof (HW_IMAGE_DESCRIPTION),
- Buffer
- );
-
- FreePool(Buffer);
-
- return Status;
-}
-
-/**
- Write the description of a file to storage media.
-
- This function uses DiskIo to write to the media, so call BlockIo->FlushBlocks()
- after calling it to ensure the data are written on the media.
-
- @param[in] File Description of the file whose description on the
- storage media has to be updated.
- @param[in] FileName Name of the file. Its length is assumed to be
- lower than MAX_NAME_LENGTH.
- @param[in] DataSize Number of data bytes of the file.
- @param[in] FileStart File's starting position on media. FileStart must
- be aligned to the media's block size.
-
- @retval EFI_WRITE_PROTECTED The device cannot be written to.
- @retval EFI_DEVICE_ERROR The device reported an error while performing
- the write operation.
-
-**/
-STATIC
-EFI_STATUS
-WriteFileDescription (
- IN BOOTMON_FS_FILE *File,
- IN CHAR8 *FileName,
- IN UINT32 DataSize,
- IN UINT64 FileStart
- )
-{
- EFI_STATUS Status;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- UINTN BlockSize;
- UINT32 FileSize;
- HW_IMAGE_DESCRIPTION *Description;
-
- DiskIo = File->Instance->DiskIo;
- BlockSize = File->Instance->BlockIo->Media->BlockSize;
- ASSERT (FileStart % BlockSize == 0);
-
- //
- // Construct the file description
- //
-
- FileSize = DataSize + sizeof (HW_IMAGE_DESCRIPTION);
- Description = &File->HwDescription;
- Description->Attributes = 1;
- Description->BlockStart = FileStart / BlockSize;
- Description->BlockEnd = Description->BlockStart + (FileSize / BlockSize);
- AsciiStrCpy (Description->Footer.Filename, FileName);
-
-#ifdef MDE_CPU_ARM
- Description->Footer.Offset = HW_IMAGE_FOOTER_OFFSET;
- Description->Footer.Version = HW_IMAGE_FOOTER_VERSION;
-#else
- Description->Footer.Offset = HW_IMAGE_FOOTER_OFFSET2;
- Description->Footer.Version = HW_IMAGE_FOOTER_VERSION2;
-#endif
- Description->Footer.FooterSignature1 = HW_IMAGE_FOOTER_SIGNATURE_1;
- Description->Footer.FooterSignature2 = HW_IMAGE_FOOTER_SIGNATURE_2;
- Description->RegionCount = 1;
- Description->Region[0].Checksum = 0;
- Description->Region[0].Offset = Description->BlockStart * BlockSize;
- Description->Region[0].Size = DataSize;
-
- Status = BootMonFsComputeFooterChecksum (Description);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- File->HwDescAddress = ((Description->BlockEnd + 1) * BlockSize) - sizeof (HW_IMAGE_DESCRIPTION);
-
- // Update the file description on the media
- Status = DiskIo->WriteDisk (
- DiskIo,
- File->Instance->Media->MediaId,
- File->HwDescAddress,
- sizeof (HW_IMAGE_DESCRIPTION),
- Description
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-// Find a space on media for a file that has not yet been flushed to disk.
-// Just returns the first space that's big enough.
-// This function could easily be adapted to:
-// - Find space for moving an existing file that has outgrown its space
-// (We do not currently move files, just return EFI_VOLUME_FULL)
-// - Find space for a fragment of a file that has outgrown its space
-// (We do not currently fragment files - it's not clear whether fragmentation
-// is actually part of BootMonFs as there is no spec)
-// - Be more clever about finding space (choosing the largest or smallest
-// suitable space)
-// Parameters:
-// File - the new (not yet flushed) file for which we need to find space.
-// FileStart - the position on media of the file (in bytes).
-STATIC
-EFI_STATUS
-BootMonFsFindSpaceForNewFile (
- IN BOOTMON_FS_FILE *File,
- IN UINT64 FileSize,
- OUT UINT64 *FileStart
- )
-{
- LIST_ENTRY *FileLink;
- BOOTMON_FS_FILE *RootFile;
- BOOTMON_FS_FILE *FileEntry;
- UINTN BlockSize;
- EFI_BLOCK_IO_MEDIA *Media;
-
- Media = File->Instance->BlockIo->Media;
- BlockSize = Media->BlockSize;
- RootFile = File->Instance->RootFile;
-
- // This function must only be called for file which has not been flushed into
- // Flash yet
- ASSERT (File->HwDescription.RegionCount == 0);
-
- *FileStart = 0;
- // Go through all the files in the list
- for (FileLink = GetFirstNode (&RootFile->Link);
- !IsNull (&RootFile->Link, FileLink);
- FileLink = GetNextNode (&RootFile->Link, FileLink)
- )
- {
- FileEntry = BOOTMON_FS_FILE_FROM_LINK_THIS (FileLink);
- // Skip files that aren't on disk yet
- if (FileEntry->HwDescription.RegionCount == 0) {
- continue;
- }
-
- // If the free space preceding the file is big enough to contain the new
- // file then use it!
- if (((FileEntry->HwDescription.BlockStart * BlockSize) - *FileStart)
- >= FileSize) {
- // The file list must be in disk-order
- RemoveEntryList (&File->Link);
- File->Link.BackLink = FileLink->BackLink;
- File->Link.ForwardLink = FileLink;
- FileLink->BackLink->ForwardLink = &File->Link;
- FileLink->BackLink = &File->Link;
-
- return EFI_SUCCESS;
- } else {
- *FileStart = (FileEntry->HwDescription.BlockEnd + 1) * BlockSize;
- }
- }
- // See if there's space after the last file
- if ((((Media->LastBlock + 1) * BlockSize) - *FileStart) >= FileSize) {
- return EFI_SUCCESS;
- } else {
- return EFI_VOLUME_FULL;
- }
-}
-
-// Free the resources in the file's Region list.
-STATIC
-VOID
-FreeFileRegions (
- IN BOOTMON_FS_FILE *File
- )
-{
- LIST_ENTRY *RegionToFlushLink;
- BOOTMON_FS_FILE_REGION *Region;
-
- RegionToFlushLink = GetFirstNode (&File->RegionToFlushLink);
- while (!IsNull (&File->RegionToFlushLink, RegionToFlushLink)) {
- // Repeatedly remove the first node from the list and free its resources.
- Region = (BOOTMON_FS_FILE_REGION *) RegionToFlushLink;
- RemoveEntryList (RegionToFlushLink);
- FreePool (Region->Buffer);
- FreePool (Region);
-
- RegionToFlushLink = GetFirstNode (&File->RegionToFlushLink);
- }
-}
-
-/**
- Flush all modified data associated with a file to a device.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the
- file handle to flush.
-
- @retval EFI_SUCCESS The data was flushed.
- @retval EFI_ACCESS_DENIED The file was opened read-only.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_FULL The volume is full.
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to flush the data.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsFlushFile (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_INSTANCE *Instance;
- EFI_FILE_INFO *Info;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- UINTN BlockSize;
- CHAR8 AsciiFileName[MAX_NAME_LENGTH];
- LIST_ENTRY *RegionToFlushLink;
- BOOTMON_FS_FILE *File;
- BOOTMON_FS_FILE *NextFile;
- BOOTMON_FS_FILE_REGION *Region;
- LIST_ENTRY *FileLink;
- UINTN CurrentPhysicalSize;
- UINT64 FileStart;
- UINT64 FileEnd;
- UINT64 RegionStart;
- UINT64 RegionEnd;
- UINT64 NewDataSize;
- UINT64 NewFileSize;
- UINT64 EndOfAppendSpace;
- BOOLEAN HasSpace;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (File->OpenMode == EFI_FILE_MODE_READ) {
- return EFI_ACCESS_DENIED;
- }
-
- Instance = File->Instance;
- Info = File->Info;
- BlockIo = Instance->BlockIo;
- Media = BlockIo->Media;
- DiskIo = Instance->DiskIo;
- BlockSize = Media->BlockSize;
-
- UnicodeStrToAsciiStr (Info->FileName, AsciiFileName);
-
- // If the file doesn't exist then find a space for it
- if (File->HwDescription.RegionCount == 0) {
- Status = BootMonFsFindSpaceForNewFile (
- File,
- Info->FileSize + sizeof (HW_IMAGE_DESCRIPTION),
- &FileStart
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
- FileStart = File->HwDescription.BlockStart * BlockSize;
- }
- // FileEnd is the current NOR address of the end of the file's data
- FileEnd = FileStart + File->HwDescription.Region[0].Size;
-
- for (RegionToFlushLink = GetFirstNode (&File->RegionToFlushLink);
- !IsNull (&File->RegionToFlushLink, RegionToFlushLink);
- RegionToFlushLink = GetNextNode (&File->RegionToFlushLink, RegionToFlushLink)
- )
- {
- Region = (BOOTMON_FS_FILE_REGION*)RegionToFlushLink;
- if (Region->Size == 0) {
- continue;
- }
-
- // RegionStart and RegionEnd are the the intended NOR address of the
- // start and end of the region
- RegionStart = FileStart + Region->Offset;
- RegionEnd = RegionStart + Region->Size;
-
- if (RegionEnd < FileEnd) {
- // Handle regions representing edits to existing portions of the file
- // Write the region data straight into the file
- Status = DiskIo->WriteDisk (DiskIo,
- Media->MediaId,
- RegionStart,
- Region->Size,
- Region->Buffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
- // Handle regions representing appends to the file
- //
- // Note: Since seeking past the end of the file with SetPosition() is
- // valid, it's possible there will be a gap between the current end of
- // the file and the beginning of the new region. Since the UEFI spec
- // says nothing about this case (except "a subsequent write would grow
- // the file"), we just leave garbage in the gap.
-
- // Check if there is space to append the new region
- HasSpace = FALSE;
- NewDataSize = RegionEnd - FileStart;
- NewFileSize = NewDataSize + sizeof (HW_IMAGE_DESCRIPTION);
- CurrentPhysicalSize = BootMonFsGetPhysicalSize (File);
- if (NewFileSize <= CurrentPhysicalSize) {
- HasSpace = TRUE;
- } else {
- // Get the File Description for the next file
- FileLink = GetNextNode (&Instance->RootFile->Link, &File->Link);
- if (!IsNull (&Instance->RootFile->Link, FileLink)) {
- NextFile = BOOTMON_FS_FILE_FROM_LINK_THIS (FileLink);
-
- // If there is space between the beginning of the current file and the
- // beginning of the next file then use it
- EndOfAppendSpace = NextFile->HwDescription.BlockStart * BlockSize;
- } else {
- // We are flushing the last file.
- EndOfAppendSpace = (Media->LastBlock + 1) * BlockSize;
- }
- if (EndOfAppendSpace - FileStart >= NewFileSize) {
- HasSpace = TRUE;
- }
- }
-
- if (HasSpace == TRUE) {
- // Invalidate the current image description of the file if any.
- if (File->HwDescAddress != 0) {
- Status = InvalidateImageDescription (File);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- // Write the new file data
- Status = DiskIo->WriteDisk (
- DiskIo,
- Media->MediaId,
- RegionStart,
- Region->Size,
- Region->Buffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = WriteFileDescription (File, AsciiFileName, NewDataSize, FileStart);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- } else {
- // There isn't a space for the file.
- // Options here are to move the file or fragment it. However as files
- // may represent boot images at fixed positions, these options will
- // break booting if the bootloader doesn't use BootMonFs to find the
- // image.
-
- return EFI_VOLUME_FULL;
- }
- }
- }
-
- FreeFileRegions (File);
- Info->PhysicalSize = BootMonFsGetPhysicalSize (File);
-
- if ((AsciiStrCmp (AsciiFileName, File->HwDescription.Footer.Filename) != 0) ||
- (Info->FileSize != File->HwDescription.Region[0].Size) ) {
- Status = WriteFileDescription (File, AsciiFileName, Info->FileSize, FileStart);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- // Flush DiskIo Buffers (see UEFI Spec 12.7 - DiskIo buffers are flushed by
- // calling FlushBlocks on the same device's BlockIo).
- BlockIo->FlushBlocks (BlockIo);
-
- return EFI_SUCCESS;
-}
-
-/**
- Close a specified file handle.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
- handle to close.
-
- @retval EFI_SUCCESS The file was closed.
- @retval EFI_INVALID_PARAMETER The parameter "This" is NULL or is not an open
- file handle.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsCloseFile (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- BOOTMON_FS_FILE *File;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // In the case of a file and not the root directory
- if (This != &File->Instance->RootFile->File) {
- This->Flush (This);
- FreePool (File->Info);
- File->Info = NULL;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Open a file on the boot monitor file system.
-
- The boot monitor file system does not allow for sub-directories. There is only
- one directory, the root one. On any attempt to create a directory, the function
- returns in error with the EFI_WRITE_PROTECTED error code.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
- the file handle to source location.
- @param[out] NewHandle A pointer to the location to return the opened
- handle for the new file.
- @param[in] FileName The Null-terminated string of the name of the file
- to be opened.
- @param[in] OpenMode The mode to open the file : Read or Read/Write or
- Read/Write/Create
- @param[in] Attributes Attributes of the file in case of a file creation
-
- @retval EFI_SUCCESS The file was open.
- @retval EFI_NOT_FOUND The specified file could not be found or the specified
- directory in which to create a file could not be found.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_WRITE_PROTECTED Attempt to create a directory. This is not possible
- with the Boot Monitor file system.
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsOpenFile (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_FILE *Directory;
- BOOTMON_FS_FILE *File;
- BOOTMON_FS_INSTANCE *Instance;
- CHAR8 *Buf;
- CHAR16 *Path;
- CHAR16 *Separator;
- CHAR8 *AsciiFileName;
- EFI_FILE_INFO *Info;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Directory = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (Directory->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((FileName == NULL) || (NewHandle == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // The only valid modes are read, read/write, and read/write/create
- //
- if ( (OpenMode != EFI_FILE_MODE_READ) &&
- (OpenMode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE)) &&
- (OpenMode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE)) ) {
- return EFI_INVALID_PARAMETER;
- }
-
- Instance = Directory->Instance;
-
- //
- // If the instance has not been initialized yet then do it ...
- //
- if (!Instance->Initialized) {
- Status = BootMonFsInitialize (Instance);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Copy the file path to be able to work on it. We do not want to
- // modify the input file name string "FileName".
- //
- Buf = AllocateCopyPool (StrSize (FileName), FileName);
- if (Buf == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- Path = (CHAR16*)Buf;
- AsciiFileName = NULL;
- Info = NULL;
-
- //
- // Handle single periods, double periods and convert forward slashes '/'
- // to backward '\' ones. Does not handle a '.' at the beginning of the
- // path for the time being.
- //
- if (PathCleanUpDirectories (Path) == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Error;
- }
-
- //
- // Detect if the first component of the path refers to a directory.
- // This is done to return the correct error code when trying to
- // access or create a directory other than the root directory.
- //
-
- //
- // Search for the '\\' sequence and if found return in error
- // with the EFI_INVALID_PARAMETER error code. ere in the path.
- //
- if (StrStr (Path, L"\\\\") != NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Error;
- }
- //
- // Get rid of the leading '\' if any.
- //
- Path += (Path[0] == L'\\');
-
- //
- // Look for a '\' in the file path. If one is found then
- // the first component of the path refers to a directory
- // that is not the root directory.
- //
- Separator = StrStr (Path, L"\\");
- if (Separator != NULL) {
- //
- // In the case '<dir name>\' and a creation, return
- // EFI_WRITE_PROTECTED if this is for a directory
- // creation, EFI_INVALID_PARAMETER otherwise.
- //
- if ((*(Separator + 1) == '\0') && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)) {
- if (Attributes & EFI_FILE_DIRECTORY) {
- Status = EFI_WRITE_PROTECTED;
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
- } else {
- //
- // Attempt to open a file or a directory that is not in the
- // root directory or to open without creation a directory
- // located in the root directory, returns EFI_NOT_FOUND.
- //
- Status = EFI_NOT_FOUND;
- }
- goto Error;
- }
-
- //
- // BootMonFs interface requires ASCII filenames
- //
- AsciiFileName = AllocatePool (StrLen (Path) + 1);
- if (AsciiFileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
- UnicodeStrToAsciiStr (Path, AsciiFileName);
- if (AsciiStrSize (AsciiFileName) > MAX_NAME_LENGTH) {
- AsciiFileName[MAX_NAME_LENGTH - 1] = '\0';
- }
-
- if ((AsciiFileName[0] == '\0') ||
- (AsciiFileName[0] == '.' ) ) {
- //
- // Opening the root directory
- //
-
- *NewHandle = &Instance->RootFile->File;
- Instance->RootFile->Position = 0;
- Status = EFI_SUCCESS;
- } else {
-
- if ((OpenMode & EFI_FILE_MODE_CREATE) &&
- (Attributes & EFI_FILE_DIRECTORY) ) {
- Status = EFI_WRITE_PROTECTED;
- goto Error;
- }
-
- //
- // Allocate a buffer to store the characteristics of the file while the
- // file is open. We allocate the maximum size to not have to reallocate
- // if the file name is changed.
- //
- Info = AllocateZeroPool (
- SIZE_OF_EFI_FILE_INFO + (sizeof (CHAR16) * MAX_NAME_LENGTH));
- if (Info == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
- //
- // Open or create a file in the root directory.
- //
-
- Status = BootMonGetFileFromAsciiFileName (Instance, AsciiFileName, &File);
- if (Status == EFI_NOT_FOUND) {
- if ((OpenMode & EFI_FILE_MODE_CREATE) == 0) {
- goto Error;
- }
-
- Status = BootMonFsCreateFile (Instance, &File);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
- InsertHeadList (&Instance->RootFile->Link, &File->Link);
- Info->Attribute = Attributes;
- } else {
- //
- // File already open, not supported yet.
- //
- if (File->Info != NULL) {
- Status = EFI_UNSUPPORTED;
- goto Error;
- }
- }
-
- Info->FileSize = BootMonFsGetImageLength (File);
- Info->PhysicalSize = BootMonFsGetPhysicalSize (File);
- AsciiStrToUnicodeStr (AsciiFileName, Info->FileName);
-
- File->Info = Info;
- Info = NULL;
- File->Position = 0;
- File->OpenMode = OpenMode;
-
- *NewHandle = &File->File;
- }
-
-Error:
-
- FreePool (Buf);
- if (AsciiFileName != NULL) {
- FreePool (AsciiFileName);
- }
- if (Info != NULL) {
- FreePool (Info);
- }
-
- return Status;
-}
-
-// Delete() for the root directory's EFI_FILE_PROTOCOL instance
-EFIAPI
-EFI_STATUS
-BootMonFsDeleteFail (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- This->Close(This);
- // You can't delete the root directory
- return EFI_WARN_DELETE_FAILURE;
-}
-
-/**
- Close and delete a file from the boot monitor file system.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
- handle to delete.
-
- @retval EFI_SUCCESS The file was closed and deleted.
- @retval EFI_INVALID_PARAMETER The parameter "This" is NULL or is not an open
- file handle.
- @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsDelete (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_FILE *File;
- LIST_ENTRY *RegionToFlushLink;
- BOOTMON_FS_FILE_REGION *Region;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!IsListEmpty (&File->RegionToFlushLink)) {
- // Free the entries from the Buffer List
- RegionToFlushLink = GetFirstNode (&File->RegionToFlushLink);
- do {
- Region = (BOOTMON_FS_FILE_REGION*)RegionToFlushLink;
-
- //
- // Get next element of the list before deleting the region description
- // that contain the LIST_ENTRY structure.
- //
- RegionToFlushLink = RemoveEntryList (RegionToFlushLink);
-
- // Free the buffers
- FreePool (Region->Buffer);
- FreePool (Region);
- } while (!IsListEmpty (&File->RegionToFlushLink));
- }
-
- // If (RegionCount is greater than 0) then the file already exists
- if (File->HwDescription.RegionCount > 0) {
- // Invalidate the last Block
- Status = InvalidateImageDescription (File);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return EFI_WARN_DELETE_FAILURE;
- }
- }
-
- // Remove the entry from the list
- RemoveEntryList (&File->Link);
- FreePool (File->Info);
- FreePool (File);
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsReadWrite.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsReadWrite.c
deleted file mode 100644
index f8124e95ac..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsReadWrite.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Protocol/SimpleFileSystem.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-
-#include "BootMonFsInternal.h"
-
-/**
- Read data from an open file.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
- is the file handle to read data from.
- @param[in out] BufferSize On input, the size of the Buffer. On output, the
- amount of data returned in Buffer. In both cases,
- the size is measured in bytes.
- @param[out] Buffer The buffer into which the data is read.
-
- @retval EFI_SUCCESS The data was read.
- @retval EFI_DEVICE_ERROR On entry, the current file position is
- beyond the end of the file, or the device
- reported an error while performing the read
- operation.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsReadFile (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- BOOTMON_FS_INSTANCE *Instance;
- BOOTMON_FS_FILE *File;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_BLOCK_IO_MEDIA *Media;
- UINT64 FileStart;
- EFI_STATUS Status;
- UINTN RemainingFileSize;
-
- if ((This == NULL) ||
- (BufferSize == NULL) ||
- (Buffer == NULL) ) {
- return EFI_INVALID_PARAMETER;
- }
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- // Ensure the file has been written in Flash before reading it.
- // This keeps the code simple and avoids having to manage a non-flushed file.
- BootMonFsFlushFile (This);
-
- Instance = File->Instance;
- DiskIo = Instance->DiskIo;
- Media = Instance->Media;
- FileStart = (Media->LowestAlignedLba + File->HwDescription.BlockStart) * Media->BlockSize;
-
- if (File->Position >= File->Info->FileSize) {
- // The entire file has been read or the position has been
- // set past the end of the file.
- *BufferSize = 0;
- if (File->Position > File->Info->FileSize) {
- return EFI_DEVICE_ERROR;
- } else {
- return EFI_SUCCESS;
- }
- }
-
- // This driver assumes that the entire file is in region 0.
- RemainingFileSize = File->Info->FileSize - File->Position;
-
- // If read would go past end of file, truncate the read
- if (*BufferSize > RemainingFileSize) {
- *BufferSize = RemainingFileSize;
- }
-
- Status = DiskIo->ReadDisk (
- DiskIo,
- Media->MediaId,
- FileStart + File->Position,
- *BufferSize,
- Buffer
- );
- if (EFI_ERROR (Status)) {
- *BufferSize = 0;
- }
-
- File->Position += *BufferSize;
-
- return Status;
-}
-
-/**
- Write data to an open file.
-
- The data is not written to the flash yet. It will be written when the file
- will be either read, closed or flushed.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
- is the file handle to write data to.
- @param[in out] BufferSize On input, the size of the Buffer. On output, the
- size of the data actually written. In both cases,
- the size is measured in bytes.
- @param[in] Buffer The buffer of data to write.
-
- @retval EFI_SUCCESS The data was written.
- @retval EFI_ACCESS_DENIED The file was opened read only.
- @retval EFI_OUT_OF_RESOURCES Unable to allocate the buffer to store the
- data to write.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsWriteFile (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-{
- BOOTMON_FS_FILE *File;
- BOOTMON_FS_FILE_REGION *Region;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (File->OpenMode == EFI_FILE_MODE_READ) {
- return EFI_ACCESS_DENIED;
- }
-
- // Allocate and initialize the memory region
- Region = (BOOTMON_FS_FILE_REGION*)AllocateZeroPool (sizeof (BOOTMON_FS_FILE_REGION));
- if (Region == NULL) {
- *BufferSize = 0;
- return EFI_OUT_OF_RESOURCES;
- }
-
- Region->Buffer = AllocateCopyPool (*BufferSize, Buffer);
- if (Region->Buffer == NULL) {
- *BufferSize = 0;
- FreePool (Region);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Region->Size = *BufferSize;
- Region->Offset = File->Position;
-
- InsertTailList (&File->RegionToFlushLink, &Region->Link);
-
- File->Position += *BufferSize;
-
- if (File->Position > File->Info->FileSize) {
- File->Info->FileSize = File->Position;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Set a file's current position.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
- the file handle to set the requested position on.
- @param[in] Position The byte position from the start of the file to set.
-
- @retval EFI_SUCCESS The position was set.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsSetPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-{
- BOOTMON_FS_FILE *File;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // UEFI Spec section 12.5:
- // "Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position to
- // be set to the end of the file."
- //
- if (Position == 0xFFFFFFFFFFFFFFFF) {
- Position = File->Info->FileSize;
- }
-
- File->Position = Position;
-
- return EFI_SUCCESS;
-}
-
-/**
- Return a file's current position.
-
- @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
- the file handle to get the current position on.
- @param[out] Position The address to return the file's current position value.
-
- @retval EFI_SUCCESS The position was returned.
- @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
-
-**/
-EFIAPI
-EFI_STATUS
-BootMonFsGetPosition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- )
-{
- BOOTMON_FS_FILE *File;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- File = BOOTMON_FS_FILE_FROM_FILE_THIS (This);
- if (File->Info == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Position == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Position = File->Position;
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsUnsupported.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsUnsupported.c
deleted file mode 100644
index 4ecc4ea008..0000000000
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsUnsupported.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
-*
-* Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "BootMonFsInternal.h"
-
-EFIAPI
-EFI_STATUS
-BootMonFsSetPositionUnsupported (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-{
- ASSERT(0);
- return EFI_UNSUPPORTED;
-}
-
-EFIAPI
-EFI_STATUS
-BootMonFsGetPositionUnsupported (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- )
-{
- ASSERT(0);
- return EFI_UNSUPPORTED;
-}
diff --git a/ArmPlatformPkg/Include/Drivers/ArmTrustzone.h b/ArmPlatformPkg/Include/Drivers/ArmTrustzone.h
deleted file mode 100644
index 78e98aad53..0000000000
--- a/ArmPlatformPkg/Include/Drivers/ArmTrustzone.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_TRUSTZONE_H__
-#define __ARM_TRUSTZONE_H__
-
-#include <Uefi.h>
-
-// Setup TZ Protection Controller
-#define TZPC_DECPROT_0 0
-#define TZPC_DECPROT_1 1
-#define TZPC_DECPROT_2 2
-#define TZPC_DECPROT_MAX 2
-
-/**
- FIXME: Need documentation
-**/
-EFI_STATUS
-TZPCSetDecProtBits (
- IN UINTN TzpcBase,
- IN UINTN TzpcId,
- IN UINTN Bits
- );
-
-/**
- FIXME: Need documentation
-**/
-EFI_STATUS
-TZPCClearDecProtBits (
- IN UINTN TzpcBase,
- IN UINTN TzpcId,
- IN UINTN Bits
- );
-
-// Setup TZ Address Space Controller
-#define TZASC_REGION_ENABLED 1
-#define TZASC_REGION_DISABLED 0
-#define TZASC_REGION_SIZE_32KB 0xE
-#define TZASC_REGION_SIZE_64KB 0xF
-#define TZASC_REGION_SIZE_128KB 0x10
-#define TZASC_REGION_SIZE_256KB 0x11
-#define TZASC_REGION_SIZE_512KB 0x12
-#define TZASC_REGION_SIZE_1MB 0x13
-#define TZASC_REGION_SIZE_2MB 0x14
-#define TZASC_REGION_SIZE_4MB 0x15
-#define TZASC_REGION_SIZE_8MB 0x16
-#define TZASC_REGION_SIZE_16MB 0x17
-#define TZASC_REGION_SIZE_32MB 0x18
-#define TZASC_REGION_SIZE_64MB 0x19
-#define TZASC_REGION_SIZE_128MB 0x1A
-#define TZASC_REGION_SIZE_256MB 0x1B
-#define TZASC_REGION_SIZE_512MB 0x1C
-#define TZASC_REGION_SIZE_1GB 0x1D
-#define TZASC_REGION_SIZE_2GB 0x1E
-#define TZASC_REGION_SIZE_4GB 0x1F
-#define TZASC_REGION_SECURITY_SR (1 << 3)
-#define TZASC_REGION_SECURITY_SW (1 << 2)
-#define TZASC_REGION_SECURITY_SRW (TZASC_REGION_SECURITY_SR|TZASC_REGION_SECURITY_SW)
-#define TZASC_REGION_SECURITY_NSR (1 << 1)
-#define TZASC_REGION_SECURITY_NSW 1
-#define TZASC_REGION_SECURITY_NSRW (TZASC_REGION_SECURITY_NSR|TZASC_REGION_SECURITY_NSW)
-
-/**
- FIXME: Need documentation
-**/
-EFI_STATUS
-TZASCSetRegion (
- IN INTN TzascBase,
- IN UINTN RegionId,
- IN UINTN Enabled,
- IN UINTN LowAddress,
- IN UINTN HighAddress,
- IN UINTN Size,
- IN UINTN Security
- );
-
-#endif
diff --git a/ArmPlatformPkg/Include/Drivers/HdLcd.h b/ArmPlatformPkg/Include/Drivers/HdLcd.h
deleted file mode 100644
index 6df97a9dfe..0000000000
--- a/ArmPlatformPkg/Include/Drivers/HdLcd.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file HDLcd.h
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#ifndef _HDLCD_H_
-#define _HDLCD_H_
-
-//
-// HDLCD Controller Register Offsets
-//
-
-#define HDLCD_REG_VERSION ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x000)
-#define HDLCD_REG_INT_RAWSTAT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x010)
-#define HDLCD_REG_INT_CLEAR ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x014)
-#define HDLCD_REG_INT_MASK ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x018)
-#define HDLCD_REG_INT_STATUS ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x01C)
-#define HDLCD_REG_FB_BASE ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x100)
-#define HDLCD_REG_FB_LINE_LENGTH ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x104)
-#define HDLCD_REG_FB_LINE_COUNT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x108)
-#define HDLCD_REG_FB_LINE_PITCH ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x10C)
-#define HDLCD_REG_BUS_OPTIONS ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x110)
-#define HDLCD_REG_V_SYNC ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x200)
-#define HDLCD_REG_V_BACK_PORCH ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x204)
-#define HDLCD_REG_V_DATA ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x208)
-#define HDLCD_REG_V_FRONT_PORCH ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x20C)
-#define HDLCD_REG_H_SYNC ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x210)
-#define HDLCD_REG_H_BACK_PORCH ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x214)
-#define HDLCD_REG_H_DATA ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x218)
-#define HDLCD_REG_H_FRONT_PORCH ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x21C)
-#define HDLCD_REG_POLARITIES ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x220)
-#define HDLCD_REG_COMMAND ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x230)
-#define HDLCD_REG_PIXEL_FORMAT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x240)
-#define HDLCD_REG_RED_SELECT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x244)
-#define HDLCD_REG_GREEN_SELECT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x248)
-#define HDLCD_REG_BLUE_SELECT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x24C)
-
-
-//
-// HDLCD Values of registers
-//
-
-// HDLCD Interrupt mask, clear and status register
-#define HDLCD_DMA_END BIT0 /* DMA has finished reading a frame */
-#define HDLCD_BUS_ERROR BIT1 /* DMA bus error */
-#define HDLCD_SYNC BIT2 /* Vertical sync */
-#define HDLCD_UNDERRUN BIT3 /* No Data available while DATAEN active */
-
-// CLCD_CONTROL Control register
-#define HDLCD_DISABLE 0
-#define HDLCD_ENABLE BIT0
-
-// Bus Options
-#define HDLCD_BURST_1 BIT0
-#define HDLCD_BURST_2 BIT1
-#define HDLCD_BURST_4 BIT2
-#define HDLCD_BURST_8 BIT3
-#define HDLCD_BURST_16 BIT4
-
-// Polarities - HIGH
-#define HDLCD_VSYNC_HIGH BIT0
-#define HDLCD_HSYNC_HIGH BIT1
-#define HDLCD_DATEN_HIGH BIT2
-#define HDLCD_DATA_HIGH BIT3
-#define HDLCD_PXCLK_HIGH BIT4
-// Polarities - LOW (for completion and for ease of understanding the hardware settings)
-#define HDLCD_VSYNC_LOW 0
-#define HDLCD_HSYNC_LOW 0
-#define HDLCD_DATEN_LOW 0
-#define HDLCD_DATA_LOW 0
-#define HDLCD_PXCLK_LOW 0
-
-// Pixel Format
-#define HDLCD_LITTLE_ENDIAN (0 << 31)
-#define HDLCD_BIG_ENDIAN (1 << 31)
-
-// Number of bytes per pixel
-#define HDLCD_4BYTES_PER_PIXEL ((4 - 1) << 3)
-
-#endif /* _HDLCD_H_ */
diff --git a/ArmPlatformPkg/Include/Drivers/PL011Uart.h b/ArmPlatformPkg/Include/Drivers/PL011Uart.h
deleted file mode 100644
index 2fe796f9e4..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL011Uart.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __PL011_UART_H__
-#define __PL011_UART_H__
-
-#include <Uefi.h>
-#include <Protocol/SerialIo.h>
-
-// PL011 Registers
-#define UARTDR 0x000
-#define UARTRSR 0x004
-#define UARTECR 0x004
-#define UARTFR 0x018
-#define UARTILPR 0x020
-#define UARTIBRD 0x024
-#define UARTFBRD 0x028
-#define UARTLCR_H 0x02C
-#define UARTCR 0x030
-#define UARTIFLS 0x034
-#define UARTIMSC 0x038
-#define UARTRIS 0x03C
-#define UARTMIS 0x040
-#define UARTICR 0x044
-#define UARTDMACR 0x048
-
-#define UARTPID0 0xFE0
-#define UARTPID1 0xFE4
-#define UARTPID2 0xFE8
-#define UARTPID3 0xFEC
-
-// Data status bits
-#define UART_DATA_ERROR_MASK 0x0F00
-
-// Status reg bits
-#define UART_STATUS_ERROR_MASK 0x0F
-
-// Flag reg bits
-#define PL011_UARTFR_RI (1 << 8) // Ring indicator
-#define PL011_UARTFR_TXFE (1 << 7) // Transmit FIFO empty
-#define PL011_UARTFR_RXFF (1 << 6) // Receive FIFO full
-#define PL011_UARTFR_TXFF (1 << 5) // Transmit FIFO full
-#define PL011_UARTFR_RXFE (1 << 4) // Receive FIFO empty
-#define PL011_UARTFR_BUSY (1 << 3) // UART busy
-#define PL011_UARTFR_DCD (1 << 2) // Data carrier detect
-#define PL011_UARTFR_DSR (1 << 1) // Data set ready
-#define PL011_UARTFR_CTS (1 << 0) // Clear to send
-
-// Flag reg bits - alternative names
-#define UART_TX_EMPTY_FLAG_MASK PL011_UARTFR_TXFE
-#define UART_RX_FULL_FLAG_MASK PL011_UARTFR_RXFF
-#define UART_TX_FULL_FLAG_MASK PL011_UARTFR_TXFF
-#define UART_RX_EMPTY_FLAG_MASK PL011_UARTFR_RXFE
-#define UART_BUSY_FLAG_MASK PL011_UARTFR_BUSY
-
-// Control reg bits
-#define PL011_UARTCR_CTSEN (1 << 15) // CTS hardware flow control enable
-#define PL011_UARTCR_RTSEN (1 << 14) // RTS hardware flow control enable
-#define PL011_UARTCR_RTS (1 << 11) // Request to send
-#define PL011_UARTCR_DTR (1 << 10) // Data transmit ready.
-#define PL011_UARTCR_RXE (1 << 9) // Receive enable
-#define PL011_UARTCR_TXE (1 << 8) // Transmit enable
-#define PL011_UARTCR_LBE (1 << 7) // Loopback enable
-#define PL011_UARTCR_UARTEN (1 << 0) // UART Enable
-
-// Line Control Register Bits
-#define PL011_UARTLCR_H_SPS (1 << 7) // Stick parity select
-#define PL011_UARTLCR_H_WLEN_8 (3 << 5)
-#define PL011_UARTLCR_H_WLEN_7 (2 << 5)
-#define PL011_UARTLCR_H_WLEN_6 (1 << 5)
-#define PL011_UARTLCR_H_WLEN_5 (0 << 5)
-#define PL011_UARTLCR_H_FEN (1 << 4) // FIFOs Enable
-#define PL011_UARTLCR_H_STP2 (1 << 3) // Two stop bits select
-#define PL011_UARTLCR_H_EPS (1 << 2) // Even parity select
-#define PL011_UARTLCR_H_PEN (1 << 1) // Parity Enable
-#define PL011_UARTLCR_H_BRK (1 << 0) // Send break
-
-#define PL011_UARTPID2_VER(X) (((X) >> 4) & 0xF)
-#define PL011_VER_R1P4 0x2
-
-/*
-
- Programmed hardware of Serial port.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartInitializePort (
- IN OUT UINTN UartBase,
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
- );
-
-/**
-
- Assert or deassert the control signals on a serial port.
- The following control signals are set according their bit settings :
- . Request to Send
- . Data Terminal Ready
-
- @param[in] UartBase UART registers base address
- @param[in] Control The following bits are taken into account :
- . EFI_SERIAL_REQUEST_TO_SEND : assert/deassert the
- "Request To Send" control signal if this bit is
- equal to one/zero.
- . EFI_SERIAL_DATA_TERMINAL_READY : assert/deassert
- the "Data Terminal Ready" control signal if this
- bit is equal to one/zero.
- . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : enable/disable
- the hardware loopback if this bit is equal to
- one/zero.
- . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : not supported.
- . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : enable/
- disable the hardware flow control based on CTS (Clear
- To Send) and RTS (Ready To Send) control signals.
-
- @retval RETURN_SUCCESS The new control bits were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartSetControl (
- IN UINTN UartBase,
- IN UINT32 Control
- );
-
-/**
-
- Retrieve the status of the control bits on a serial device.
-
- @param[in] UartBase UART registers base address
- @param[out] Control Status of the control bits on a serial device :
-
- . EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
- EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
- EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
- are all related to the DTE (Data Terminal Equipment) and
- DCE (Data Communication Equipment) modes of operation of
- the serial device.
- . EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
- buffer is empty, 0 otherwise.
- . EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
- buffer is empty, 0 otherwise.
- . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
- hardware loopback is enabled (the ouput feeds the receive
- buffer), 0 otherwise.
- . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
- loopback is accomplished by software, 0 otherwise.
- . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
- hardware flow control based on CTS (Clear To Send) and RTS
- (Ready To Send) control signals is enabled, 0 otherwise.
-
-
- @retval RETURN_SUCCESS The control bits were read from the serial device.
-
-**/
-RETURN_STATUS
-EFIAPI
-PL011UartGetControl (
- IN UINTN UartBase,
- OUT UINT32 *Control
- );
-
-/**
- Write data to serial device.
-
- @param Buffer Point of data buffer which need to be written.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes written to serial device.
-
-**/
-UINTN
-EFIAPI
-PL011UartWrite (
- IN UINTN UartBase,
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-/**
- Read data from serial device and save the data in buffer.
-
- @param Buffer Point of data buffer which need to be written.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Actual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-PL011UartRead (
- IN UINTN UartBase,
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-/**
- Check to see if any data is available to be read from the debug device.
-
- @retval EFI_SUCCESS At least one byte of data is available to be read
- @retval EFI_NOT_READY No data is available to be read
- @retval EFI_DEVICE_ERROR The serial device is not functioning properly
-
-**/
-BOOLEAN
-EFIAPI
-PL011UartPoll (
- IN UINTN UartBase
- );
-
-#endif
diff --git a/ArmPlatformPkg/Include/Drivers/PL031RealTimeClock.h b/ArmPlatformPkg/Include/Drivers/PL031RealTimeClock.h
deleted file mode 100644
index 76fbd0eb82..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL031RealTimeClock.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-
-#ifndef __PL031_REAL_TIME_CLOCK_H__
-#define __PL031_REAL_TIME_CLOCK_H__
-
-// PL031 Registers
-#define PL031_RTC_DR_DATA_REGISTER 0x000
-#define PL031_RTC_MR_MATCH_REGISTER 0x004
-#define PL031_RTC_LR_LOAD_REGISTER 0x008
-#define PL031_RTC_CR_CONTROL_REGISTER 0x00C
-#define PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER 0x010
-#define PL031_RTC_RIS_RAW_IRQ_STATUS_REGISTER 0x014
-#define PL031_RTC_MIS_MASKED_IRQ_STATUS_REGISTER 0x018
-#define PL031_RTC_ICR_IRQ_CLEAR_REGISTER 0x01C
-#define PL031_RTC_PERIPH_ID0 0xFE0
-#define PL031_RTC_PERIPH_ID1 0xFE4
-#define PL031_RTC_PERIPH_ID2 0xFE8
-#define PL031_RTC_PERIPH_ID3 0xFEC
-#define PL031_RTC_PCELL_ID0 0xFF0
-#define PL031_RTC_PCELL_ID1 0xFF4
-#define PL031_RTC_PCELL_ID2 0xFF8
-#define PL031_RTC_PCELL_ID3 0xFFC
-
-// PL031 Values
-#define PL031_RTC_ENABLED 0x00000001
-#define PL031_SET_IRQ_MASK 0x00000001
-#define PL031_IRQ_TRIGGERED 0x00000001
-#define PL031_CLEAR_IRQ 0x00000001
-
-#define PL031_COUNTS_PER_SECOND 1
-
-// Define EPOCH (1970-JANUARY-01) in the Julian Date representation
-#define EPOCH_JULIAN_DATE 2440588
-
-// Seconds per unit
-#define SEC_PER_MIN ((UINTN) 60)
-#define SEC_PER_HOUR ((UINTN) 3600)
-#define SEC_PER_DAY ((UINTN) 86400)
-
-#define SEC_PER_MONTH ((UINTN) 2,592,000)
-#define SEC_PER_YEAR ((UINTN) 31,536,000)
-
-#endif
diff --git a/ArmPlatformPkg/Include/Drivers/PL061Gpio.h b/ArmPlatformPkg/Include/Drivers/PL061Gpio.h
deleted file mode 100644
index 38458f4844..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL061Gpio.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-
-#ifndef __PL061_GPIO_H__
-#define __PL061_GPIO_H__
-
-#include <Protocol/EmbeddedGpio.h>
-
-// PL061 GPIO Registers
-#define PL061_GPIO_DATA_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x000)
-#define PL061_GPIO_DIR_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x400)
-#define PL061_GPIO_IS_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x404)
-#define PL061_GPIO_IBE_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x408)
-#define PL061_GPIO_IEV_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x40C)
-#define PL061_GPIO_IE_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x410)
-#define PL061_GPIO_RIS_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x414)
-#define PL061_GPIO_MIS_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x410)
-#define PL061_GPIO_IC_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x41C)
-#define PL061_GPIO_AFSEL_REG ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0x420)
-
-#define PL061_GPIO_PERIPH_ID0 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFE0)
-#define PL061_GPIO_PERIPH_ID1 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFE4)
-#define PL061_GPIO_PERIPH_ID2 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFE8)
-#define PL061_GPIO_PERIPH_ID3 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFEC)
-
-#define PL061_GPIO_PCELL_ID0 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFF0)
-#define PL061_GPIO_PCELL_ID1 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFF4)
-#define PL061_GPIO_PCELL_ID2 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFF8)
-#define PL061_GPIO_PCELL_ID3 ((UINT32)PcdGet32 (PcdPL061GpioBase) + 0xFFC)
-
-
-// GPIO pins are numbered 0..7
-#define LAST_GPIO_PIN 7
-
-// All bits low except one bit high, native bit length
-#define GPIO_PIN_MASK(Pin) (1UL << ((UINTN)(Pin)))
-// All bits low except one bit high, restricted to 8 bits (i.e. ensures zeros above 8bits)
-#define GPIO_PIN_MASK_HIGH_8BIT(Pin) (GPIO_PIN_MASK(Pin) && 0xFF)
-// All bits high except one bit low, restricted to 8 bits (i.e. ensures zeros above 8bits)
-#define GPIO_PIN_MASK_LOW_8BIT(Pin) ((~GPIO_PIN_MASK(Pin)) && 0xFF)
-
-#endif // __PL061_GPIO_H__
diff --git a/ArmPlatformPkg/Include/Drivers/PL111Lcd.h b/ArmPlatformPkg/Include/Drivers/PL111Lcd.h
deleted file mode 100644
index 18e28af805..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL111Lcd.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/** @file PL111Lcd.h
-
- Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#ifndef _PL111LCD_H__
-#define _PL111LCD_H__
-
-/**********************************************************************
- *
- * This header file contains all the bits of the PL111 that are
- * platform independent.
- *
- **********************************************************************/
-
-// Controller Register Offsets
-#define PL111_REG_LCD_TIMING_0 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x000)
-#define PL111_REG_LCD_TIMING_1 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x004)
-#define PL111_REG_LCD_TIMING_2 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x008)
-#define PL111_REG_LCD_TIMING_3 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x00C)
-#define PL111_REG_LCD_UP_BASE ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x010)
-#define PL111_REG_LCD_LP_BASE ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x014)
-#define PL111_REG_LCD_CONTROL ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x018)
-#define PL111_REG_LCD_IMSC ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x01C)
-#define PL111_REG_LCD_RIS ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x020)
-#define PL111_REG_LCD_MIS ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x024)
-#define PL111_REG_LCD_ICR ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x028)
-#define PL111_REG_LCD_UP_CURR ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x02C)
-#define PL111_REG_LCD_LP_CURR ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x030)
-#define PL111_REG_LCD_PALETTE ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0x200)
-
-// Identification Register Offsets
-#define PL111_REG_CLCD_PERIPH_ID_0 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFE0)
-#define PL111_REG_CLCD_PERIPH_ID_1 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFE4)
-#define PL111_REG_CLCD_PERIPH_ID_2 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFE8)
-#define PL111_REG_CLCD_PERIPH_ID_3 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFEC)
-#define PL111_REG_CLCD_P_CELL_ID_0 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFF0)
-#define PL111_REG_CLCD_P_CELL_ID_1 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFF4)
-#define PL111_REG_CLCD_P_CELL_ID_2 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFF8)
-#define PL111_REG_CLCD_P_CELL_ID_3 ((UINTN)PcdGet32 (PcdPL111LcdBase) + 0xFFC)
-
-#define PL111_CLCD_PERIPH_ID_0 0x11
-#define PL111_CLCD_PERIPH_ID_1 0x11
-#define PL111_CLCD_PERIPH_ID_2 0x04
-#define PL111_CLCD_PERIPH_ID_3 0x00
-#define PL111_CLCD_P_CELL_ID_0 0x0D
-#define PL111_CLCD_P_CELL_ID_1 0xF0
-#define PL111_CLCD_P_CELL_ID_2 0x05
-#define PL111_CLCD_P_CELL_ID_3 0xB1
-
-/**********************************************************************/
-
-// Register components (register bits)
-
-// This should make life easier to program specific settings in the different registers
-// by simplifying the setting up of the individual bits of each register
-// and then assembling the final register value.
-
-/**********************************************************************/
-
-// Register: PL111_REG_LCD_TIMING_0
-#define HOR_AXIS_PANEL(hbp,hfp,hsw,hor_res) (UINT32)(((UINT32)(hbp) << 24) | ((UINT32)(hfp) << 16) | ((UINT32)(hsw) << 8) | (((UINT32)((hor_res)/16)-1) << 2))
-
-// Register: PL111_REG_LCD_TIMING_1
-#define VER_AXIS_PANEL(vbp,vfp,vsw,ver_res) (UINT32)(((UINT32)(vbp) << 24) | ((UINT32)(vfp) << 16) | ((UINT32)(vsw) << 10) | ((ver_res)-1))
-
-// Register: PL111_REG_LCD_TIMING_2
-#define PL111_BIT_SHIFT_PCD_HI 27
-#define PL111_BIT_SHIFT_BCD 26
-#define PL111_BIT_SHIFT_CPL 16
-#define PL111_BIT_SHIFT_IOE 14
-#define PL111_BIT_SHIFT_IPC 13
-#define PL111_BIT_SHIFT_IHS 12
-#define PL111_BIT_SHIFT_IVS 11
-#define PL111_BIT_SHIFT_ACB 6
-#define PL111_BIT_SHIFT_CLKSEL 5
-#define PL111_BIT_SHIFT_PCD_LO 0
-
-#define PL111_BCD (1 << 26)
-#define PL111_IPC (1 << 13)
-#define PL111_IHS (1 << 12)
-#define PL111_IVS (1 << 11)
-
-#define CLK_SIG_POLARITY(hor_res) (UINT32)(PL111_BCD | PL111_IPC | PL111_IHS | PL111_IVS | (((hor_res)-1) << 16))
-
-// Register: PL111_REG_LCD_TIMING_3
-#define PL111_BIT_SHIFT_LEE 16
-#define PL111_BIT_SHIFT_LED 0
-
-#define PL111_CTRL_WATERMARK (1 << 16)
-#define PL111_CTRL_LCD_V_COMP (1 << 12)
-#define PL111_CTRL_LCD_PWR (1 << 11)
-#define PL111_CTRL_BEPO (1 << 10)
-#define PL111_CTRL_BEBO (1 << 9)
-#define PL111_CTRL_BGR (1 << 8)
-#define PL111_CTRL_LCD_DUAL (1 << 7)
-#define PL111_CTRL_LCD_MONO_8 (1 << 6)
-#define PL111_CTRL_LCD_TFT (1 << 5)
-#define PL111_CTRL_LCD_BW (1 << 4)
-#define PL111_CTRL_LCD_1BPP (0 << 1)
-#define PL111_CTRL_LCD_2BPP (1 << 1)
-#define PL111_CTRL_LCD_4BPP (2 << 1)
-#define PL111_CTRL_LCD_8BPP (3 << 1)
-#define PL111_CTRL_LCD_16BPP (4 << 1)
-#define PL111_CTRL_LCD_24BPP (5 << 1)
-#define PL111_CTRL_LCD_16BPP_565 (6 << 1)
-#define PL111_CTRL_LCD_12BPP_444 (7 << 1)
-#define PL111_CTRL_LCD_BPP(Bpp) ((Bpp) << 1)
-#define PL111_CTRL_LCD_EN 1
-
-/**********************************************************************/
-
-// Register: PL111_REG_LCD_TIMING_0
-#define PL111_LCD_TIMING_0_HBP(hbp) (((hbp) & 0xFF) << 24)
-#define PL111_LCD_TIMING_0_HFP(hfp) (((hfp) & 0xFF) << 16)
-#define PL111_LCD_TIMING_0_HSW(hsw) (((hsw) & 0xFF) << 8)
-#define PL111_LCD_TIMING_0_PPL(ppl) (((hsw) & 0x3F) << 2)
-
-// Register: PL111_REG_LCD_TIMING_1
-#define PL111_LCD_TIMING_1_VBP(vbp) (((vbp) & 0xFF) << 24)
-#define PL111_LCD_TIMING_1_VFP(vfp) (((vfp) & 0xFF) << 16)
-#define PL111_LCD_TIMING_1_VSW(vsw) (((vsw) & 0x3F) << 10)
-#define PL111_LCD_TIMING_1_LPP(lpp) ((lpp) & 0xFC)
-
-// Register: PL111_REG_LCD_TIMING_2
-#define PL111_BIT_MASK_PCD_HI 0xF8000000
-#define PL111_BIT_MASK_BCD 0x04000000
-#define PL111_BIT_MASK_CPL 0x03FF0000
-#define PL111_BIT_MASK_IOE 0x00004000
-#define PL111_BIT_MASK_IPC 0x00002000
-#define PL111_BIT_MASK_IHS 0x00001000
-#define PL111_BIT_MASK_IVS 0x00000800
-#define PL111_BIT_MASK_ACB 0x000007C0
-#define PL111_BIT_MASK_CLKSEL 0x00000020
-#define PL111_BIT_MASK_PCD_LO 0x0000001F
-
-// Register: PL111_REG_LCD_TIMING_3
-#define PL111_BIT_MASK_LEE 0x00010000
-#define PL111_BIT_MASK_LED 0x0000007F
-
-#endif /* _PL111LCD_H__ */
diff --git a/ArmPlatformPkg/Include/Drivers/PL301Axi.h b/ArmPlatformPkg/Include/Drivers/PL301Axi.h
deleted file mode 100644
index ae941839f0..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL301Axi.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef PL301AXI_H_
-#define PL301AXI_H_
-
-VOID PL301AxiInit(UINTN FAxiBase);
-
-
-#endif /* PL301AXI_H_ */
diff --git a/ArmPlatformPkg/Include/Drivers/PL310L2Cache.h b/ArmPlatformPkg/Include/Drivers/PL310L2Cache.h
deleted file mode 100644
index a610998062..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL310L2Cache.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef L2CACHELIB_H_
-#define L2CACHELIB_H_
-
-#define L2X0_CACHEID 0x000
-#define L2X0_CTRL 0x100
-#define L2X0_AUXCTRL 0x104
-#define L230_TAG_LATENCY 0x108
-#define L230_DATA_LATENCY 0x10C
-#define L2X0_INTCLEAR 0x220
-#define L2X0_CACHE_SYNC 0x730
-#define L2X0_INVWAY 0x77C
-#define L2X0_CLEAN_WAY 0x7BC
-#define L2X0_PFCTRL 0xF60
-#define L2X0_PWRCTRL 0xF80
-
-#define L2X0_CACHEID_IMPLEMENTER_ARM 0x41
-#define L2X0_CACHEID_PARTNUM_PL310 0x03
-
-#define L2X0_CTRL_ENABLED 0x1
-#define L2X0_CTRL_DISABLED 0x0
-
-#define L2X0_AUXCTRL_EXCLUSIVE (1 << 12)
-#define L2X0_AUXCTRL_ASSOCIATIVITY (1 << 16)
-#define L2X0_AUXCTRL_WAYSIZE_MASK (3 << 17)
-#define L2X0_AUXCTRL_WAYSIZE_16KB (1 << 17)
-#define L2X0_AUXCTRL_WAYSIZE_32KB (2 << 17)
-#define L2X0_AUXCTRL_WAYSIZE_64KB (3 << 17)
-#define L2X0_AUXCTRL_WAYSIZE_128KB (4 << 17)
-#define L2X0_AUXCTRL_WAYSIZE_256KB (5 << 17)
-#define L2X0_AUXCTRL_WAYSIZE_512KB (6 << 17)
-#define L2X0_AUXCTRL_EM (1 << 20)
-#define L2X0_AUXCTRL_SHARED_OVERRIDE (1 << 22)
-#define L2x0_AUXCTRL_AW_AWCACHE (0 << 23)
-#define L2x0_AUXCTRL_AW_NOALLOC (1 << 23)
-#define L2x0_AUXCTRL_AW_OVERRIDE (2 << 23)
-#define L2X0_AUXCTRL_SBO (1 << 25)
-#define L2X0_AUXCTRL_NSAC (1 << 27)
-#define L2x0_AUXCTRL_DPREFETCH (1 << 28)
-#define L2x0_AUXCTRL_IPREFETCH (1 << 29)
-#define L2x0_AUXCTRL_EARLY_BRESP (1 << 30)
-
-#define L2x0_LATENCY_1_CYCLE 0
-#define L2x0_LATENCY_2_CYCLES 1
-#define L2x0_LATENCY_3_CYCLES 2
-#define L2x0_LATENCY_4_CYCLES 3
-#define L2x0_LATENCY_5_CYCLES 4
-#define L2x0_LATENCY_6_CYCLES 5
-#define L2x0_LATENCY_7_CYCLES 6
-#define L2x0_LATENCY_8_CYCLES 7
-
-#define PL310_LATENCIES(Write,Read,Setup) (((Write) << 8) | ((Read) << 4) | (Setup))
-#define PL310_TAG_LATENCIES(Write,Read,Setup) PL310_LATENCIES(Write,Read,Setup)
-#define PL310_DATA_LATENCIES(Write,Read,Setup) PL310_LATENCIES(Write,Read,Setup)
-
-VOID
-L2x0CacheInit (
- IN UINTN L2x0Base,
- IN UINT32 L2x0TagLatencies,
- IN UINT32 L2x0DataLatencies,
- IN UINT32 L2x0AuxValue,
- IN UINT32 L2x0AuxMask,
- IN BOOLEAN CacheEnabled
- );
-
-#endif /* L2CACHELIB_H_ */
diff --git a/ArmPlatformPkg/Include/Drivers/PL341Dmc.h b/ArmPlatformPkg/Include/Drivers/PL341Dmc.h
deleted file mode 100644
index caba8f445b..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL341Dmc.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef _PL341DMC_H_
-#define _PL341DMC_H_
-
-
-typedef struct {
- UINTN HasQos; // has QoS registers
- UINTN MaxChip; // number of memory chips accessible
- BOOLEAN IsUserCfg;
- UINT32 User0Cfg;
- UINT32 User2Cfg;
- UINT32 RefreshPeriod;
- UINT32 CasLatency;
- UINT32 WriteLatency;
- UINT32 t_mrd;
- UINT32 t_ras;
- UINT32 t_rc;
- UINT32 t_rcd;
- UINT32 t_rfc;
- UINT32 t_rp;
- UINT32 t_rrd;
- UINT32 t_wr;
- UINT32 t_wtr;
- UINT32 t_xp;
- UINT32 t_xsr;
- UINT32 t_esr;
- UINT32 MemoryCfg;
- UINT32 MemoryCfg2;
- UINT32 MemoryCfg3;
- UINT32 ChipCfg0;
- UINT32 ChipCfg1;
- UINT32 ChipCfg2;
- UINT32 ChipCfg3;
- UINT32 t_faw;
- UINT32 t_data_en;
- UINT32 t_wdata_en;
- UINT32 ModeReg;
- UINT32 ExtModeReg;
-} PL341_DMC_CONFIG;
-
-/* Memory config bit fields */
-#define DMC_MEMORY_CONFIG_COLUMN_ADDRESS_9 0x1
-#define DMC_MEMORY_CONFIG_COLUMN_ADDRESS_10 0x2
-#define DMC_MEMORY_CONFIG_COLUMN_ADDRESS_11 0x3
-#define DMC_MEMORY_CONFIG_COLUMN_ADDRESS_12 0x4
-#define DMC_MEMORY_CONFIG_ROW_ADDRESS_11 (0x0 << 3)
-#define DMC_MEMORY_CONFIG_ROW_ADDRESS_12 (0x1 << 3)
-#define DMC_MEMORY_CONFIG_ROW_ADDRESS_13 (0x2 << 3)
-#define DMC_MEMORY_CONFIG_ROW_ADDRESS_14 (0x3 << 3)
-#define DMC_MEMORY_CONFIG_ROW_ADDRESS_15 (0x4 << 3)
-#define DMC_MEMORY_CONFIG_ROW_ADDRESS_16 (0x5 << 3)
-#define DMC_MEMORY_CONFIG_BURST_2 (0x1 << 15)
-#define DMC_MEMORY_CONFIG_BURST_4 (0x2 << 15)
-#define DMC_MEMORY_CONFIG_BURST_8 (0x3 << 15)
-#define DMC_MEMORY_CONFIG_BURST_16 (0x4 << 15)
-#define DMC_MEMORY_CONFIG_ACTIVE_CHIP_1 (0x0 << 21)
-#define DMC_MEMORY_CONFIG_ACTIVE_CHIP_2 (0x1 << 21)
-#define DMC_MEMORY_CONFIG_ACTIVE_CHIP_3 (0x2 << 21)
-#define DMC_MEMORY_CONFIG_ACTIVE_CHIP_4 (0x3 << 21)
-
-#define DMC_MEMORY_CFG2_CLK_ASYNC (0x0 << 0)
-#define DMC_MEMORY_CFG2_CLK_SYNC (0x1 << 0)
-#define DMC_MEMORY_CFG2_DQM_INIT (0x1 << 2)
-#define DMC_MEMORY_CFG2_CKE_INIT (0x1 << 3)
-#define DMC_MEMORY_CFG2_BANK_BITS_2 (0x0 << 4)
-#define DMC_MEMORY_CFG2_BANK_BITS_3 (0x3 << 4)
-#define DMC_MEMORY_CFG2_MEM_WIDTH_16 (0x0 << 6)
-#define DMC_MEMORY_CFG2_MEM_WIDTH_32 (0x1 << 6)
-#define DMC_MEMORY_CFG2_MEM_WIDTH_64 (0x2 << 6)
-#define DMC_MEMORY_CFG2_MEM_WIDTH_RESERVED (0x3 << 6)
-
-//
-// DMC Configuration Register Map
-//
-#define DMC_STATUS_REG 0x00
-#define DMC_COMMAND_REG 0x04
-#define DMC_DIRECT_CMD_REG 0x08
-#define DMC_MEMORY_CONFIG_REG 0x0C
-#define DMC_REFRESH_PRD_REG 0x10
-#define DMC_CAS_LATENCY_REG 0x14
-#define DMC_WRITE_LATENCY_REG 0x18
-#define DMC_T_MRD_REG 0x1C
-#define DMC_T_RAS_REG 0x20
-#define DMC_T_RC_REG 0x24
-#define DMC_T_RCD_REG 0x28
-#define DMC_T_RFC_REG 0x2C
-#define DMC_T_RP_REG 0x30
-#define DMC_T_RRD_REG 0x34
-#define DMC_T_WR_REG 0x38
-#define DMC_T_WTR_REG 0x3C
-#define DMC_T_XP_REG 0x40
-#define DMC_T_XSR_REG 0x44
-#define DMC_T_ESR_REG 0x48
-#define DMC_MEMORY_CFG2_REG 0x4C
-#define DMC_MEMORY_CFG3_REG 0x50
-#define DMC_T_FAW_REG 0x54
-#define DMC_T_RDATA_EN 0x5C /* DFI read data enable register */
-#define DMC_T_WRLAT_DIFF 0x60 /* DFI write data enable register */
-
-// Returns the state of the memory controller:
-#define DMC_STATUS_CONFIG 0x0
-#define DMC_STATUS_READY 0x1
-#define DMC_STATUS_PAUSED 0x2
-#define DMC_STATUS_LOWPOWER 0x3
-
-// Changes the state of the memory controller:
-#define DMC_COMMAND_GO 0x0
-#define DMC_COMMAND_SLEEP 0x1
-#define DMC_COMMAND_WAKEUP 0x2
-#define DMC_COMMAND_PAUSE 0x3
-#define DMC_COMMAND_CONFIGURE 0x4
-#define DMC_COMMAND_ACTIVEPAUSE 0x7
-
-// Determines the command required
-#define DMC_DIRECT_CMD_MEMCMD_PRECHARGEALL 0x0
-#define DMC_DIRECT_CMD_MEMCMD_AUTOREFRESH (0x1 << 18)
-#define DMC_DIRECT_CMD_MEMCMD_MODEREG (0x2 << 18)
-#define DMC_DIRECT_CMD_MEMCMD_EXTMODEREG (0x2 << 18)
-#define DMC_DIRECT_CMD_MEMCMD_NOP (0x3 << 18)
-#define DMC_DIRECT_CMD_MEMCMD_DPD (0x1 << 22)
-#define DMC_DIRECT_CMD_BANKADDR(n) ((n & 0x3) << 16)
-#define DMC_DIRECT_CMD_CHIP_ADDR(n) ((n & 0x3) << 20)
-
-
-//
-// AXI ID configuration register map
-//
-#define DMC_ID_0_CFG_REG 0x100
-#define DMC_ID_1_CFG_REG 0x104
-#define DMC_ID_2_CFG_REG 0x108
-#define DMC_ID_3_CFG_REG 0x10C
-#define DMC_ID_4_CFG_REG 0x110
-#define DMC_ID_5_CFG_REG 0x114
-#define DMC_ID_6_CFG_REG 0x118
-#define DMC_ID_7_CFG_REG 0x11C
-#define DMC_ID_8_CFG_REG 0x120
-#define DMC_ID_9_CFG_REG 0x124
-#define DMC_ID_10_CFG_REG 0x128
-#define DMC_ID_11_CFG_REG 0x12C
-#define DMC_ID_12_CFG_REG 0x130
-#define DMC_ID_13_CFG_REG 0x134
-#define DMC_ID_14_CFG_REG 0x138
-#define DMC_ID_15_CFG_REG 0x13C
-
-// Set the QoS
-#define DMC_ID_CFG_QOS_DISABLE 0
-#define DMC_ID_CFG_QOS_ENABLE 1
-#define DMC_ID_CFG_QOS_MIN 2
-
-
-//
-// Chip configuration register map
-//
-#define DMC_CHIP_0_CFG_REG 0x200
-#define DMC_CHIP_1_CFG_REG 0x204
-#define DMC_CHIP_2_CFG_REG 0x208
-#define DMC_CHIP_3_CFG_REG 0x20C
-
-//
-// User Defined Pins
-//
-#define DMC_USER_STATUS_REG 0x300
-#define DMC_USER_0_CFG_REG 0x304
-#define DMC_USER_1_CFG_REG 0x308
-#define DMC_FEATURE_CRTL_REG 0x30C
-#define DMC_USER_2_CFG_REG 0x310
-
-
-//
-// PHY Register Settings
-//
-#define PHY_PTM_DFI_CLK_RANGE 0xE00 // DDR2 PHY PTM register offset
-#define PHY_PTM_IOTERM 0xE04
-#define PHY_PTM_PLL_EN 0xe0c
-#define PHY_PTM_PLL_RANGE 0xe18
-#define PHY_PTM_FEEBACK_DIV 0xe1c
-#define PHY_PTM_RCLK_DIV 0xe20
-#define PHY_PTM_LOCK_STATUS 0xe28
-#define PHY_PTM_INIT_DONE 0xe34
-#define PHY_PTM_ADDCOM_IOSTR_OFF 0xec8
-#define PHY_PTM_SQU_TRAINING 0xee8
-#define PHY_PTM_SQU_STAT 0xeec
-
-// ==============================================================================
-// PIPD 40G DDR2/DDR3 PHY Register definitions
-//
-// Offsets from APB Base Address
-// ==============================================================================
-#define PHY_BYTE0_OFFSET 0x000
-#define PHY_BYTE1_OFFSET 0x200
-#define PHY_BYTE2_OFFSET 0x400
-#define PHY_BYTE3_OFFSET 0x600
-
-#define PHY_BYTE0_COARSE_SQADJ_INIT 0x064 ;// Coarse squelch adjust
-#define PHY_BYTE1_COARSE_SQADJ_INIT 0x264 ;// Coarse squelch adjust
-#define PHY_BYTE2_COARSE_SQADJ_INIT 0x464 ;// Coarse squelch adjust
-#define PHY_BYTE3_COARSE_SQADJ_INIT 0x664 ;// Coarse squelch adjust
-
-#define PHY_BYTE0_IOSTR_OFFSET 0x004
-#define PHY_BYTE1_IOSTR_OFFSET 0x204
-#define PHY_BYTE2_IOSTR_OFFSET 0x404
-#define PHY_BYTE3_IOSTR_OFFSET 0x604
-
-
-;//--------------------------------------------------------------------------
-
-// DFI Clock ranges:
-
-#define PHY_PTM_DFI_CLK_RANGE_200MHz 0x0
-#define PHY_PTM_DFI_CLK_RANGE_201_267MHz 0x1
-#define PHY_PTM_DFI_CLK_RANGE_268_333MHz 0x2
-#define PHY_PTM_DFI_CLK_RANGE_334_400MHz 0x3
-#define PHY_PTM_DFI_CLK_RANGE_401_533MHz 0x4
-#define PHY_PTM_DFI_CLK_RANGE_534_667MHz 0x5
-#define PHY_PTM_DFI_CLK_RANGE_668_800MHz 0x6
-
-
-
-#define PHY_PTM_DFI_CLK_RANGE_VAL PHY_PTM_DFI_CLK_RANGE_334_400MHz
-
-//--------------------------------------------------------------------------
-
-
-// PLL Range
-
-#define PHY_PTM_PLL_RANGE_200_400MHz 0x0 // b0 = frequency >= 200 MHz and < 400 MHz
-#define PHY_PTM_PLL_RANGE_400_800MHz 0x1 // b1 = frequency >= 400 MHz.
-#define PHY_PTM_FEEBACK_DIV_200_400MHz 0x0 // b0 = frequency >= 200 MHz and < 400 MHz
-#define PHY_PTM_FEEBACK_DIV_400_800MHz 0x1 // b1 = frequency >= 400 MHz.
-#define PHY_PTM_REFCLK_DIV_200_400MHz 0x0
-#define PHY_PTM_REFCLK_DIV_400_800MHz 0x1
-
-#define TC_UIOLHNC_MASK 0x000003C0
-#define TC_UIOLHNC_SHIFT 0x6
-#define TC_UIOLHPC_MASK 0x0000003F
-#define TC_UIOLHPC_SHIFT 0x2
-#define TC_UIOHOCT_MASK 0x2
-#define TC_UIOHOCT_SHIFT 0x1
-#define TC_UIOHSTOP_SHIFT 0x0
-#define TC_UIOLHXC_VALUE 0x4
-
-#define PHY_PTM_SQU_TRAINING_ENABLE 0x1
-#define PHY_PTM_SQU_TRAINING_DISABLE 0x0
-
-
-//--------------------------------------
-// JEDEC DDR2 Device Register definitions and settings
-//--------------------------------------
-#define DDR_MODESET_SHFT 14
-#define DDR_MODESET_MR 0x0 ;// Mode register
-#define DDR_MODESET_EMR 0x1 ;// Extended Mode register
-#define DDR_MODESET_EMR2 0x2
-#define DDR_MODESET_EMR3 0x3
-
-//
-// Extended Mode Register settings
-//
-#define DDR_EMR_OCD_MASK 0x0000380
-#define DDR_EMR_OCD_SHIFT 0x7
-#define DDR_EMR_RTT_MASK 0x00000044 // DDR2 Device RTT (ODT) settings
-#define DDR_EMR_RTT_SHIFT 0x2
-#define DDR_EMR_ODS_MASK 0x00000002 // DDR2 Output Drive Strength
-#define DDR_EMR_ODS_SHIFT 0x0001
-
-// Termination Values:
-#define DDR_EMR_RTT_50R 0x00000044 // DDR2 50 Ohm termination
-#define DDR_EMR_RTT_75R 0x00000004 // DDR2 75 Ohm termination
-#define DDR_EMR_RTT_150 0x00000040 // DDR2 150 Ohm termination
-
-// Output Drive Strength Values:
-#define DDR_EMR_ODS_FULL 0x0 // DDR2 Full Drive Strength
-#define DDR_EMR_ODS_HALF 0x1 // DDR2 Half Drive Strength
-
-// OCD values
-#define DDR_EMR_OCD_DEFAULT 0x7
-#define DDR_EMR_OCD_NS 0x0
-
-#define DDR_EMR_ODS_VAL DDR_EMR_ODS_FULL
-
-#define DDR_SDRAM_START_ADDR 0x10000000
-
-
-// ----------------------------------------
-// PHY IOTERM values
-// ----------------------------------------
-#define PHY_PTM_IOTERM_OFF 0x0
-#define PHY_PTM_IOTERM_150R 0x1
-#define PHY_PTM_IOTERM_75R 0x2
-#define PHY_PTM_IOTERM_50R 0x3
-
-#define PHY_BYTE_IOSTR_60OHM 0x0
-#define PHY_BYTE_IOSTR_40OHM 0x1
-#define PHY_BYTE_IOSTR_30OHM 0x2
-#define PHY_BYTE_IOSTR_30AOHM 0x3
-
-#define DDR2_MR_BURST_LENGTH_4 (2)
-#define DDR2_MR_BURST_LENGTH_8 (3)
-#define DDR2_MR_DLL_RESET (1 << 8)
-#define DDR2_MR_CAS_LATENCY_4 (4 << 4)
-#define DDR2_MR_CAS_LATENCY_5 (5 << 4)
-#define DDR2_MR_CAS_LATENCY_6 (6 << 4)
-#define DDR2_MR_WR_CYCLES_2 (1 << 9)
-#define DDR2_MR_WR_CYCLES_3 (2 << 9)
-#define DDR2_MR_WR_CYCLES_4 (3 << 9)
-#define DDR2_MR_WR_CYCLES_5 (4 << 9)
-#define DDR2_MR_WR_CYCLES_6 (5 << 9)
-
-
-VOID
-PL341DmcInit (
- IN UINTN DmcBase,
- IN PL341_DMC_CONFIG* DmcConfig
- );
-
-VOID PL341DmcPhyInit (
- IN UINTN DmcPhyBase
- );
-
-VOID PL341DmcTrainPHY (
- IN UINTN DmcPhyBase
- );
-
-#endif /* _PL341DMC_H_ */
diff --git a/ArmPlatformPkg/Include/Drivers/PL35xSmc.h b/ArmPlatformPkg/Include/Drivers/PL35xSmc.h
deleted file mode 100644
index 750f5088b6..0000000000
--- a/ArmPlatformPkg/Include/Drivers/PL35xSmc.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef PL35xSMC_H_
-#define PL35xSMC_H_
-
-#define PL350_SMC_DIRECT_CMD_OFFSET 0x10
-#define PL350_SMC_SET_CYCLES_OFFSET 0x14
-#define PL350_SMC_SET_OPMODE_OFFSET 0x18
-#define PL350_SMC_REFRESH_0_OFFSET 0x20
-#define PL350_SMC_REFRESH_1_OFFSET 0x24
-
-#define PL350_SMC_DIRECT_CMD_ADDR(addr) ((addr) & 0xFFFFF)
-#define PL350_SMC_DIRECT_CMD_ADDR_SET_CRE (1 << 20)
-#define PL350_SMC_DIRECT_CMD_ADDR_CMD_MODE_UPDATE (3 << 21)
-#define PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE (2 << 21)
-#define PL350_SMC_DIRECT_CMD_ADDR_CMD_MODE (1 << 21)
-#define PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE_AXI (0 << 21)
-#define PL350_SMC_DIRECT_CMD_ADDR_CS_INTERF(interf,chip) (((interf) << 25) | ((chip) << 23))
-#define PL350_SMC_DIRECT_CMD_ADDR_CS(ChipSelect) (((ChipSelect) & 0x7) << 23)
-
-#define PL350_SMC_SET_OPMODE_MEM_WIDTH_8 (0 << 0)
-#define PL350_SMC_SET_OPMODE_MEM_WIDTH_16 (1 << 0)
-#define PL350_SMC_SET_OPMODE_MEM_WIDTH_32 (2 << 0)
-#define PL350_SMC_SET_OPMODE_SET_RD_SYNC (1 << 2)
-#define PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_1 (0 << 3)
-#define PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_4 (1 << 3)
-#define PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_8 (2 << 3)
-#define PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_16 (3 << 3)
-#define PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_32 (4 << 3)
-#define PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT (5 << 3)
-#define PL350_SMC_SET_OPMODE_SET_WR_SYNC (1 << 6)
-#define PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_1 (0 << 7)
-#define PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_4 (1 << 7)
-#define PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_8 (2 << 7)
-#define PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_16 (3 << 7)
-#define PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_32 (4 << 7)
-#define PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT (5 << 7)
-#define PL350_SMC_SET_OPMODE_SET_BAA (1 << 10)
-#define PL350_SMC_SET_OPMODE_SET_ADV (1 << 11)
-#define PL350_SMC_SET_OPMODE_SET_BLS (1 << 12)
-#define PL350_SMC_SET_OPMODE_SET_BURST_ALIGN_ANY (0 << 13)
-#define PL350_SMC_SET_OPMODE_SET_BURST_ALIGN_32 (1 << 13)
-#define PL350_SMC_SET_OPMODE_SET_BURST_ALIGN_64 (2 << 13)
-#define PL350_SMC_SET_OPMODE_SET_BURST_ALIGN_128 (3 << 13)
-#define PL350_SMC_SET_OPMODE_SET_BURST_ALIGN_256 (4 << 13)
-
-#define PL350_SMC_SET_CYCLE_NAND_T_RC(t) (((t) & 0xF) << 0)
-#define PL350_SMC_SET_CYCLE_NAND_T_WC(t) (((t) & 0xF) << 4)
-#define PL350_SMC_SET_CYCLE_NAND_T_REA(t) (((t) & 0x7) << 8)
-#define PL350_SMC_SET_CYCLE_NAND_T_WP(t) (((t) & 0x7) << 11)
-#define PL350_SMC_SET_CYCLE_NAND_T_CLR(t) (((t) & 0x7) << 14)
-#define PL350_SMC_SET_CYCLE_NAND_T_AR(t) (((t) & 0x7) << 17)
-#define PL350_SMC_SET_CYCLE_NAND_T_RR(t) (((t) & 0x7) << 20)
-
-#define PL350_SMC_SET_CYCLE_SRAM_T_RC(t) (((t) & 0xF) << 0)
-#define PL350_SMC_SET_CYCLE_SRAM_T_WC(t) (((t) & 0xF) << 4)
-#define PL350_SMC_SET_CYCLE_SRAM_T_CEOE(t) (((t) & 0x7) << 8)
-#define PL350_SMC_SET_CYCLE_SRAM_T_WP(t) (((t) & 0x7) << 11)
-#define PL350_SMC_SET_CYCLE_SRAM_T_PC(t) (((t) & 0x7) << 14)
-#define PL350_SMC_SET_CYCLE_SRAM_T_TR(t) (((t) & 0x7) << 17)
-#define PL350_SMC_SET_CYCLE_SRAM_WE_TIME (1 << 20)
-
-#endif
diff --git a/ArmPlatformPkg/Include/Drivers/SP804Timer.h b/ArmPlatformPkg/Include/Drivers/SP804Timer.h
deleted file mode 100644
index 904b13c193..0000000000
--- a/ArmPlatformPkg/Include/Drivers/SP804Timer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-
-#ifndef _SP804_TIMER_H__
-#define _SP804_TIMER_H__
-
-// SP804 Timer constants
-// Note: The SP804 Timer module comprises two timers, Timer_0 and Timer_1
-// These timers are identical and all their registers have an offset of 0x20
-// i.e. SP804_TIMER_0_LOAD_REG = 0x00 and SP804_TIMER_1_LOAD_REG = 0x20
-// Therefore, define all registers only once and adjust the base addresses by 0x20
-#define SP804_TIMER_LOAD_REG 0x00
-#define SP804_TIMER_CURRENT_REG 0x04
-#define SP804_TIMER_CONTROL_REG 0x08
-#define SP804_TIMER_INT_CLR_REG 0x0C
-#define SP804_TIMER_RAW_INT_STS_REG 0x10
-#define SP804_TIMER_MSK_INT_STS_REG 0x14
-#define SP804_TIMER_BG_LOAD_REG 0x18
-
-// Timer control register bit definitions
-#define SP804_TIMER_CTRL_ONESHOT BIT0
-#define SP804_TIMER_CTRL_32BIT BIT1
-#define SP804_TIMER_CTRL_PRESCALE_MASK (BIT3|BIT2)
-#define SP804_PRESCALE_DIV_1 0
-#define SP804_PRESCALE_DIV_16 BIT2
-#define SP804_PRESCALE_DIV_256 BIT3
-#define SP804_TIMER_CTRL_INT_ENABLE BIT5
-#define SP804_TIMER_CTRL_PERIODIC BIT6
-#define SP804_TIMER_CTRL_ENABLE BIT7
-
-// Other SP804 Timer definitions
-#define SP804_MAX_TICKS 0xFFFFFFFF
-
-// SP810 System Controller constants
-#define SP810_SYS_CTRL_REG 0x00
-#define SP810_SYS_CTRL_TIMER0_TIMCLK BIT15 // 0=REFCLK, 1=TIMCLK
-#define SP810_SYS_CTRL_TIMER0_EN BIT16
-#define SP810_SYS_CTRL_TIMER1_TIMCLK BIT17 // 0=REFCLK, 1=TIMCLK
-#define SP810_SYS_CTRL_TIMER1_EN BIT18
-#define SP810_SYS_CTRL_TIMER2_TIMCLK BIT19 // 0=REFCLK, 1=TIMCLK
-#define SP810_SYS_CTRL_TIMER2_EN BIT20
-#define SP810_SYS_CTRL_TIMER3_TIMCLK BIT21 // 0=REFCLK, 1=TIMCLK
-#define SP810_SYS_CTRL_TIMER3_EN BIT22
-
-#endif
diff --git a/ArmPlatformPkg/Include/Drivers/SP805Watchdog.h b/ArmPlatformPkg/Include/Drivers/SP805Watchdog.h
deleted file mode 100644
index 4d5e145d8b..0000000000
--- a/ArmPlatformPkg/Include/Drivers/SP805Watchdog.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-
-#ifndef __SP805_WATCHDOG_H__
-#define __SP805_WATCHDOG_H__
-
-// SP805 Watchdog Registers
-#define SP805_WDOG_LOAD_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0x000)
-#define SP805_WDOG_CURRENT_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0x004)
-#define SP805_WDOG_CONTROL_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0x008)
-#define SP805_WDOG_INT_CLR_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0x00C)
-#define SP805_WDOG_RAW_INT_STS_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0x010)
-#define SP805_WDOG_MSK_INT_STS_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0x014)
-#define SP805_WDOG_LOCK_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xC00)
-
-#define SP805_WDOG_PERIPH_ID0 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFE0)
-#define SP805_WDOG_PERIPH_ID1 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFE4)
-#define SP805_WDOG_PERIPH_ID2 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFE8)
-#define SP805_WDOG_PERIPH_ID3 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFEC)
-
-#define SP805_WDOG_PCELL_ID0 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFF0)
-#define SP805_WDOG_PCELL_ID1 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFF4)
-#define SP805_WDOG_PCELL_ID2 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFF8)
-#define SP805_WDOG_PCELL_ID3 ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 0xFFC)
-
-// Timer control register bit definitions
-#define SP805_WDOG_CTRL_INTEN BIT0
-#define SP805_WDOG_CTRL_RESEN BIT1
-#define SP805_WDOG_RAW_INT_STS_WDOGRIS BIT0
-#define SP805_WDOG_MSK_INT_STS_WDOGMIS BIT0
-
-#define SP805_WDOG_LOCK_IS_UNLOCKED 0x00000000
-#define SP805_WDOG_LOCK_IS_LOCKED 0x00000001
-#define SP805_WDOG_SPECIAL_UNLOCK_CODE 0x1ACCE551
-
-#endif // __SP805_WATCHDOG_H__
diff --git a/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h b/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h
deleted file mode 100644
index 844090b4e8..0000000000
--- a/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_GLOBAL_VARIABLE_GUID_H__
-#define __ARM_GLOBAL_VARIABLE_GUID_H__
-
-#include <Pi/PiBootMode.h>
-#include <Pi/PiHob.h>
-
-#define ARM_HOB_GLOBAL_VARIABLE_GUID \
- { 0xc3253c90, 0xa24f, 0x4599, { 0xa6, 0x64, 0x1f, 0x88, 0x13, 0x77, 0x8f, 0xc9} };
-
-extern EFI_GUID gArmGlobalVariableGuid;
-
-///
-/// Describes all memory ranges used during the HOB producer
-/// phase that exist outside the HOB list. This HOB type
-/// describes how memory is used, not the physical attributes of memory.
-///
-typedef struct {
- ///
- /// The Guid HOB header. Header.HobType = EFI_HOB_TYPE_GUID_EXTENSION
- /// and Header.Name = gArmGlobalVariableGuid
- ///
- EFI_HOB_GUID_TYPE Header;
-
- ///
- /// The base address of memory allocated by this HOB. Type
- /// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
- /// specification.
- ///
- EFI_PHYSICAL_ADDRESS GlobalVariableBase;
-
- ///
- /// The length in bytes of memory allocated by this HOB.
- ///
- UINT32 GlobalVariableSize;
-} ARM_HOB_GLOBAL_VARIABLE;
-
-#endif
diff --git a/ArmPlatformPkg/Include/Guid/BootMonFsFileInfo.h b/ArmPlatformPkg/Include/Guid/BootMonFsFileInfo.h
deleted file mode 100644
index c4d805c14f..0000000000
--- a/ArmPlatformPkg/Include/Guid/BootMonFsFileInfo.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials are licensed and made available
-* under the terms and conditions of the BSD License which accompanies this
-* distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
-* WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __BOOTMON_FS_FILE_INFO_H__
-#define __BOOTMON_FS_FILE_INFO_H__
-
-#define BOOTMON_FS_FILE_INFO_ID \
- { \
- 0x41e26b9c, 0xada6, 0x45b3, {0x80, 0x8e, 0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } \
- }
-
-// From BootMonFS header file
-#define BOOTMONFS_IMAGE_DESCRIPTION_REGION_MAX 4
-
-typedef struct {
- // The size of the structure.
- UINT64 Size;
-
- // Subset of properties stored in the file meta-data.
- UINT32 EntryPoint;
- UINT32 RegionCount;
- struct {
- UINT32 LoadAddress;
- UINT32 Size;
- UINT32 Offset;
- UINT32 Checksum;
- } Region[BOOTMONFS_IMAGE_DESCRIPTION_REGION_MAX];
-
-} BOOTMON_FS_FILE_INFO;
-
-#define SIZE_OF_BOOTMON_FS_FILE_INFO \
- OFFSET_OF (BOOTMON_FS_FILE_INFO, Region[BOOTMONFS_IMAGE_DESCRIPTION_REGION_MAX - 1].Checksum)
-
-extern EFI_GUID gArmBootMonFsFileInfoGuid;
-
-#endif // __BOOTMON_FS_FILE_INFO_H__
diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformGlobalVariableLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformGlobalVariableLib.h
deleted file mode 100644
index b1a080c00a..0000000000
--- a/ArmPlatformPkg/Include/Library/ArmPlatformGlobalVariableLib.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_
-#define __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_
-
-VOID
-ArmPlatformGetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- );
-
-VOID
-ArmPlatformSetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- );
-
-VOID*
-ArmPlatformGetGlobalVariableAddress (
- IN UINTN VariableOffset
- );
-
-#endif
-
diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
deleted file mode 100644
index fe3bc4bb8e..0000000000
--- a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef _ARMPLATFORMLIB_H_
-#define _ARMPLATFORMLIB_H_
-
-//
-// The package level header files this module uses
-//
-#include <PiPei.h>
-//
-// The protocols, PPI and GUID defintions for this module
-//
-#include <Ppi/MasterBootMode.h>
-#include <Ppi/BootInRecoveryMode.h>
-
-#include <Library/ArmLib.h>
-
-/**
- This structure is used to describe a region of the EFI memory map
-
- Every EFI regions of the system memory described by their physical start address and their size
- can have different attributes. Some regions can be tested and other untested.
-
-**/
-typedef struct {
- EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
- EFI_PHYSICAL_ADDRESS PhysicalStart;
- UINT64 NumberOfBytes;
-} ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR;
-
-/**
- Return the core per cluster. The method may differ per core type
-
- This function might be called from assembler before any stack is set.
-
- @return Return the core count per cluster
-
-**/
-UINTN
-ArmGetCpuCountPerCluster (
- VOID
- );
-
-/**
- Return the core position from the value of its MpId register
-
- This function returns the core position from the position 0 in the processor.
- This function might be called from assembler before any stack is set.
-
- @return Return the core position
-
-**/
-UINTN
-ArmPlatformGetCorePosition (
- IN UINTN MpId
- );
-
-/**
- Return a non-zero value if the callee is the primary core
-
- This function returns a non-zero value if the callee is the primary core.
- The primary core is the core responsible to initialize the hardware and run UEFI.
- This function might be called from assembler before any stack is set.
-
- @return Return a non-zero value if the callee is the primary core.
-
-**/
-UINTN
-ArmPlatformIsPrimaryCore (
- IN UINTN MpId
- );
-
-/**
- Return the MpId of the primary core
-
- This function returns the MpId of the primary core.
- This function might be called from assembler before any stack is set.
-
- @return Return the MpId of the primary core
-
-**/
-UINTN
-ArmPlatformGetPrimaryCoreMpId (
- VOID
- );
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
- @return Return the current Boot Mode of the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- );
-
-/**
- First platform specific function to be called in the PEI phase
-
- This function is actually the first function called by the PrePi
- or PrePeiCore modules. It allows to retrieve arguments passed to
- the UEFI firmware through the CPU registers.
-
- This function might be written into assembler as no stack are set
- when the function is invoked.
-
-**/
-VOID
-ArmPlatformPeiBootAction (
- VOID
- );
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- );
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- );
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- );
-
-/**
- Return the Platform specific PPIs
-
- This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed
- to the PeiCore by PrePeiCore.
-
- @param[out] PpiListSize Size in Bytes of the Platform PPI List
- @param[out] PpiList Platform PPI List
-
-**/
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- );
-
-#endif
diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h
deleted file mode 100644
index cb3148e778..0000000000
--- a/ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef _ARMPLATFORMSECLIB_H_
-#define _ARMPLATFORMSECLIB_H_
-
-#define ARM_SEC_BOOT_MASK ~0
-#define ARM_SEC_COLD_BOOT (1 << 0)
-#define ARM_SEC_SECONDARY_COLD_BOOT (1 << 1)
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-VOID
-ArmPlatformSecBootMemoryInit (
- VOID
- );
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-VOID
-ArmPlatformSecBootAction (
- VOID
- );
-
-/**
- Initialize controllers that must setup at the early stage
-
- Some peripherals must be initialized in Secure World.
- For example: Some L2 controller, interconnect, clock, DMC, etc
-
-**/
-RETURN_STATUS
-ArmPlatformSecInitialize (
- IN UINTN MpId
- );
-
-/**
- Call before jumping to Normal World
-
- This function allows the firmware platform to do extra actions before
- jumping to the Normal World
-
-**/
-VOID
-ArmPlatformSecExtraAction (
- IN UINTN MpId,
- OUT UINTN* JumpAddress
- );
-
-/**
- Initialize the Secure peripherals and memory regions
-
- If Trustzone is supported by your platform then this function makes the required initialization
- of the secure peripherals and memory regions.
-
-**/
-VOID
-ArmPlatformSecTrustzoneInit (
- IN UINTN MpId
- );
-
-#endif
diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h
deleted file mode 100644
index 39a0cc7f73..0000000000
--- a/ArmPlatformPkg/Include/Library/ArmPlatformSysConfigLib.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/** @file ArmPlatformSysConfigLib.h
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __ARM_PLATFORM_SYS_CONFIG_H__
-#define __ARM_PLATFORM_SYS_CONFIG_H__
-
-#include <Base.h>
-
-/* This header file makes it easier to access the System Configuration Registers
- * in the ARM Versatile Express motherboard.
- */
-
-//
-// Typedef
-//
-typedef UINT32 SYS_CONFIG_FUNCTION;
-
-//
-// Functions
-//
-RETURN_STATUS
-ArmPlatformSysConfigInitialize (
- VOID
- );
-
-RETURN_STATUS
-ArmPlatformSysConfigGet (
- IN SYS_CONFIG_FUNCTION Function,
- OUT UINT32* Value
- );
-
-RETURN_STATUS
-ArmPlatformSysConfigGetValues (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINTN Size,
- OUT UINT32* Values
- );
-
-RETURN_STATUS
-ArmPlatformSysConfigSet (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Value
- );
-
-RETURN_STATUS
-ArmPlatformSysConfigSetDevice (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Device,
- IN UINT32 Value
- );
-
-#endif /* __SYS_CFG_REGISTERS_H__ */
diff --git a/ArmPlatformPkg/Include/Library/ArmShellCmdLib.h b/ArmPlatformPkg/Include/Library/ArmShellCmdLib.h
deleted file mode 100644
index eb31cd4053..0000000000
--- a/ArmPlatformPkg/Include/Library/ArmShellCmdLib.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
-*
-* Definitions for the Dynamic Shell command library
-*
-* Copyright (C) 2014, ARM Ltd
-*
-* This program and the accompanying materials are licensed and made available
-* under the terms and conditions of the BSD License which accompanies this
-* distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
-* WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef _ARM_SHELL_CMD_LIB_H_
-#define _ARM_SHELL_CMD_LIB_H_
-
-/**
-
- Initialize and Install EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL for RunAxf command.
-
- @param[in] ImageHandle Handle the protocol should be attached to.
-
- @retval EFI_SUCCESS The command has been installed successfully.
-
- @retval EFI_UNSUPPORTED Help for the command failed to initialise.
-
- @return Status code returned by InstallProtocolInterface
- Boot Service function.
-
-**/
-EFI_STATUS
-ShellDynCmdRunAxfInstall (
- IN EFI_HANDLE ImageHandle
- );
-
-/**
-
- Uninstall the RunAxf Command
-
- @param[in] ImageHandle Handle of the device where the protocol should have
- been installed.
-
- @retval EFI_SUCCESS The device has been un-initialized successfully.
-
- @return Status code returned by UninstallProtocolInterface
- Boot Service function.
-
-**/
-EFI_STATUS
-ShellDynCmdRunAxfUninstall (
- IN EFI_HANDLE ImageHandle
- );
-
-#endif // _ARM_SHELL_CMD_LIB_H_
diff --git a/ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h b/ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h
deleted file mode 100644
index 5368697c5c..0000000000
--- a/ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-* Main file supporting the Monitor World on ARM PLatforms
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_TRUSTED_MONITOR_LIB_H_
-#define __ARM_TRUSTED_MONITOR_LIB_H_
-
-VOID
-ArmSecureMonitorWorldInitialize (
- VOID
- );
-
-#endif
diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
deleted file mode 100644
index b9bdf471e2..0000000000
--- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/** @file
-
- Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#ifndef __LCDPLATFORMLIB_H
-#define __LCDPLATFORMLIB_H
-
-#include <Protocol/GraphicsOutput.h>
-
-#define LCD_VRAM_SIZE SIZE_8MB
-
-//
-// Modes definitions
-//
-#define VGA 0
-#define SVGA 1
-#define XGA 2
-#define SXGA 3
-#define WSXGA 4
-#define UXGA 5
-#define HD 6
-
-//
-// VGA Mode: 640 x 480
-//
-#define VGA_H_RES_PIXELS 640
-#define VGA_V_RES_PIXELS 480
-#define VGA_OSC_FREQUENCY 23750000 /* 0x016A6570 */
-
-#define VGA_H_SYNC ( 80 - 1)
-#define VGA_H_FRONT_PORCH ( 16 - 1)
-#define VGA_H_BACK_PORCH ( 64 - 1)
-
-#define VGA_V_SYNC ( 4 - 1)
-#define VGA_V_FRONT_PORCH ( 3 - 1)
-#define VGA_V_BACK_PORCH ( 13 - 1)
-
-//
-// SVGA Mode: 800 x 600
-//
-#define SVGA_H_RES_PIXELS 800
-#define SVGA_V_RES_PIXELS 600
-#define SVGA_OSC_FREQUENCY 38250000 /* 0x0247A610 */
-
-#define SVGA_H_SYNC ( 80 - 1)
-#define SVGA_H_FRONT_PORCH ( 32 - 1)
-#define SVGA_H_BACK_PORCH (112 - 1)
-
-#define SVGA_V_SYNC ( 4 - 1)
-#define SVGA_V_FRONT_PORCH ( 3 - 1)
-#define SVGA_V_BACK_PORCH ( 17 - 1)
-
-//
-// XGA Mode: 1024 x 768
-//
-#define XGA_H_RES_PIXELS 1024
-#define XGA_V_RES_PIXELS 768
-#define XGA_OSC_FREQUENCY 63500000 /* 0x03C8EEE0 */
-
-#define XGA_H_SYNC (104 - 1)
-#define XGA_H_FRONT_PORCH ( 48 - 1)
-#define XGA_H_BACK_PORCH (152 - 1)
-
-#define XGA_V_SYNC ( 4 - 1)
-#define XGA_V_FRONT_PORCH ( 3 - 1)
-#define XGA_V_BACK_PORCH ( 23 - 1)
-
-//
-// SXGA Mode: 1280 x 1024
-//
-#define SXGA_H_RES_PIXELS 1280
-#define SXGA_V_RES_PIXELS 1024
-#define SXGA_OSC_FREQUENCY 109000000 /* 0x067F3540 */
-
-#define SXGA_H_SYNC (136 - 1)
-#define SXGA_H_FRONT_PORCH ( 80 - 1)
-#define SXGA_H_BACK_PORCH (216 - 1)
-
-#define SXGA_V_SYNC ( 7 - 1)
-#define SXGA_V_FRONT_PORCH ( 3 - 1)
-#define SXGA_V_BACK_PORCH ( 29 - 1)
-
-//
-// WSXGA+ Mode: 1680 x 1050
-//
-#define WSXGA_H_RES_PIXELS 1680
-#define WSXGA_V_RES_PIXELS 1050
-#define WSXGA_OSC_FREQUENCY 147000000 /* 0x08C30AC0 */
-
-#define WSXGA_H_SYNC (170 - 1)
-#define WSXGA_H_FRONT_PORCH (104 - 1)
-#define WSXGA_H_BACK_PORCH (274 - 1)
-
-#define WSXGA_V_SYNC ( 5 - 1)
-#define WSXGA_V_FRONT_PORCH ( 4 - 1)
-#define WSXGA_V_BACK_PORCH ( 41 - 1)
-
-//
-// UXGA Mode: 1600 x 1200
-//
-#define UXGA_H_RES_PIXELS 1600
-#define UXGA_V_RES_PIXELS 1200
-#define UXGA_OSC_FREQUENCY 161000000 /* 0x0998AA40 */
-
-#define UXGA_H_SYNC (168 - 1)
-#define UXGA_H_FRONT_PORCH (112 - 1)
-#define UXGA_H_BACK_PORCH (280 - 1)
-
-#define UXGA_V_SYNC ( 4 - 1)
-#define UXGA_V_FRONT_PORCH ( 3 - 1)
-#define UXGA_V_BACK_PORCH ( 38 - 1)
-
-//
-// HD Mode: 1920 x 1080
-//
-#define HD_H_RES_PIXELS 1920
-#define HD_V_RES_PIXELS 1080
-#define HD_OSC_FREQUENCY 165000000 /* 0x09D5B340 */
-
-#define HD_H_SYNC ( 79 - 1)
-#define HD_H_FRONT_PORCH (128 - 1)
-#define HD_H_BACK_PORCH (328 - 1)
-
-#define HD_V_SYNC ( 5 - 1)
-#define HD_V_FRONT_PORCH ( 3 - 1)
-#define HD_V_BACK_PORCH ( 32 - 1)
-
-//
-// Colour Masks
-//
-
-#define LCD_24BPP_RED_MASK 0x00FF0000
-#define LCD_24BPP_GREEN_MASK 0x0000FF00
-#define LCD_24BPP_BLUE_MASK 0x000000FF
-#define LCD_24BPP_RESERVED_MASK 0xFF000000
-
-#define LCD_16BPP_555_RED_MASK 0x00007C00
-#define LCD_16BPP_555_GREEN_MASK 0x000003E0
-#define LCD_16BPP_555_BLUE_MASK 0x0000001F
-#define LCD_16BPP_555_RESERVED_MASK 0x00000000
-
-#define LCD_16BPP_565_RED_MASK 0x0000F800
-#define LCD_16BPP_565_GREEN_MASK 0x000007E0
-#define LCD_16BPP_565_BLUE_MASK 0x0000001F
-#define LCD_16BPP_565_RESERVED_MASK 0x00008000
-
-#define LCD_12BPP_444_RED_MASK 0x00000F00
-#define LCD_12BPP_444_GREEN_MASK 0x000000F0
-#define LCD_12BPP_444_BLUE_MASK 0x0000000F
-#define LCD_12BPP_444_RESERVED_MASK 0x0000F000
-
-
-// The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control Register
-typedef enum {
- LCD_BITS_PER_PIXEL_1 = 0,
- LCD_BITS_PER_PIXEL_2,
- LCD_BITS_PER_PIXEL_4,
- LCD_BITS_PER_PIXEL_8,
- LCD_BITS_PER_PIXEL_16_555,
- LCD_BITS_PER_PIXEL_24,
- LCD_BITS_PER_PIXEL_16_565,
- LCD_BITS_PER_PIXEL_12_444
-} LCD_BPP;
-
-
-EFI_STATUS
-LcdPlatformInitializeDisplay (
- IN EFI_HANDLE Handle
- );
-
-EFI_STATUS
-LcdPlatformGetVram (
- OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress,
- OUT UINTN* VramSize
- );
-
-UINT32
-LcdPlatformGetMaxMode (
- VOID
- );
-
-EFI_STATUS
-LcdPlatformSetMode (
- IN UINT32 ModeNumber
- );
-
-EFI_STATUS
-LcdPlatformQueryMode (
- IN UINT32 ModeNumber,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info
- );
-
-EFI_STATUS
-LcdPlatformGetTimings (
- IN UINT32 ModeNumber,
- OUT UINT32* HRes,
- OUT UINT32* HSync,
- OUT UINT32* HBackPorch,
- OUT UINT32* HFrontPorch,
- OUT UINT32* VRes,
- OUT UINT32* VSync,
- OUT UINT32* VBackPorch,
- OUT UINT32* VFrontPorch
- );
-
-EFI_STATUS
-LcdPlatformGetBpp (
- IN UINT32 ModeNumber,
- OUT LCD_BPP* Bpp
- );
-
-#endif
diff --git a/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h b/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h
deleted file mode 100644
index e9e1c06078..0000000000
--- a/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-#ifndef _NORFLASHPLATFORMLIB_H_
-#define _NORFLASHPLATFORMLIB_H_
-
-typedef struct {
- UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA)
- UINTN RegionBaseAddress; // Start address of one single region
- UINTN Size;
- UINTN BlockSize;
- EFI_GUID Guid;
-} NOR_FLASH_DESCRIPTION;
-
-EFI_STATUS
-NorFlashPlatformInitialization (
- VOID
- );
-
-EFI_STATUS
-NorFlashPlatformGetDevices (
- OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,
- OUT UINT32 *Count
- );
-
-#endif /* _NORFLASHPLATFORMLIB_H_ */
diff --git a/ArmPlatformPkg/Include/Ppi/ArmGlobalVariable.h b/ArmPlatformPkg/Include/Ppi/ArmGlobalVariable.h
deleted file mode 100644
index 8a29b83465..0000000000
--- a/ArmPlatformPkg/Include/Ppi/ArmGlobalVariable.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_GLOBAL_VARIABLE_H__
-#define __ARM_GLOBAL_VARIABLE_H__
-
-#define ARM_GLOBAL_VARIABLE_PPI_GUID \
- { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }
-
-
-/**
- This service of the EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
- permanent memory.
-
- @param PeiServices Pointer to the PEI Services Table.
- @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
- Temporary RAM contents.
- @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
- Temporary RAM contents.
- @param CopySize Amount of memory to migrate from temporary to permanent memory.
-
- @retval EFI_SUCCESS The data was successfully returned.
- @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
- TemporaryMemoryBase > PermanentMemoryBase.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI * ARM_GLOBAL_VARIABLE_GET_MEMORY) (
- OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase
-);
-
-///
-/// This service abstracts the ability to migrate contents of the platform early memory store.
-/// Note: The name EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI is different from the current PI 1.2 spec.
-/// This PPI was optional.
-///
-typedef struct {
- ARM_GLOBAL_VARIABLE_GET_MEMORY GetGlobalVariableMemory;
-} ARM_GLOBAL_VARIABLE_PPI;
-
-extern EFI_GUID gArmGlobalVariablePpiGuid;
-
-#endif
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.c b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.c
deleted file mode 100644
index 511d0f69de..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiDxe.h>
-#include <Library/ArmPlatformGlobalVariableLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PcdLib.h>
-
-#include <Guid/ArmGlobalVariableHob.h>
-
-UINTN mGlobalVariableBase = 0;
-
-RETURN_STATUS
-EFIAPI
-ArmPlatformGlobalVariableConstructor (
- VOID
- )
-{
- ARM_HOB_GLOBAL_VARIABLE *Hob;
-
- Hob = GetFirstGuidHob (&gArmGlobalVariableGuid);
- ASSERT (Hob != NULL);
-
- mGlobalVariableBase = Hob->GlobalVariableBase;
-
- return EFI_SUCCESS;
-}
-
-VOID
-ArmPlatformGetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- if (mGlobalVariableBase == 0) {
- ArmPlatformGlobalVariableConstructor ();
- }
-
- CopyMem (Variable, (VOID*)(mGlobalVariableBase + VariableOffset), VariableSize);
-}
-
-VOID
-ArmPlatformSetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- if (mGlobalVariableBase == 0) {
- ArmPlatformGlobalVariableConstructor ();
- }
-
- CopyMem ((VOID*)(mGlobalVariableBase + VariableOffset), Variable, VariableSize);
-}
-
-VOID*
-ArmPlatformGetGlobalVariableAddress (
- IN UINTN VariableOffset
- )
-{
- return (VOID*)(mGlobalVariableBase + VariableOffset);
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf
deleted file mode 100644
index e90d6a5811..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-#/** @file
-# Timer library implementation
-#
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeArmPlatformGlobalVariableLib
- FILE_GUID = 53fa3cc3-23b7-4ec2-9bfa-30257d7e1135
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformGlobalVariableLib
-
- CONSTRUCTOR = ArmPlatformGlobalVariableConstructor
-
-[Sources.common]
- DxeArmPlatformGlobalVariableLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- HobLib
-
-[Guids]
- gArmGlobalVariableGuid
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.c b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.c
deleted file mode 100644
index 2ffbdbedd8..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Uefi.h>
-#include <Library/ArmPlatformGlobalVariableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-
-// Declared by ArmPlatformPkg/PrePi Module
-extern UINTN mGlobalVariableBase;
-
-VOID
-ArmPlatformGetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
-
- GlobalVariableBase = PcdGet64 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize);
-
- if (VariableSize == 4) {
- *(UINT32*)Variable = ReadUnaligned32 ((CONST UINT32*)(GlobalVariableBase + VariableOffset));
- } else if (VariableSize == 8) {
- *(UINT64*)Variable = ReadUnaligned64 ((CONST UINT64*)(GlobalVariableBase + VariableOffset));
- } else {
- CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
- }
-}
-
-VOID
-ArmPlatformSetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
-
- GlobalVariableBase = PcdGet64 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize);
-
- if (VariableSize == 4) {
- WriteUnaligned32 ((UINT32*)(GlobalVariableBase + VariableOffset), *(UINT32*)Variable);
- } else if (VariableSize == 8) {
- WriteUnaligned64 ((UINT64*)(GlobalVariableBase + VariableOffset), *(UINT64*)Variable);
- } else {
- CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
- }
-}
-
-VOID*
-ArmPlatformGetGlobalVariableAddress (
- IN UINTN VariableOffset
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
-
- GlobalVariableBase = PcdGet64 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize);
-
- return (VOID*)(GlobalVariableBase + VariableOffset);
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
deleted file mode 100644
index 09995e1fa0..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-#/** @file
-# ArmPlatformGlobalVariableLib library implementation
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiArmPlatformGlobalVariableLib
- FILE_GUID = 3e03daf2-b7b4-45f7-80b2-12aba043391f
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformGlobalVariableLib
-
-[Sources.common]
- PeiArmPlatformGlobalVariableLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- PcdLib
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c
deleted file mode 100644
index db69ba047d..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Uefi.h>
-#include <Library/ArmPlatformGlobalVariableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-
-extern UINT64 mSystemMemoryEnd;
-
-#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(mSystemMemoryEnd)) || \
- ((PcdGet64 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet64 (PcdSystemMemoryBase)))
-
-// Declared by ArmPlatformPkg/PrePi Module
-extern UINTN mGlobalVariableBase;
-
-VOID
-ArmPlatformGetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
-
- if (IS_XIP()) {
- // In Case of XIP, we expect the Primary Stack at the top of the System Memory
- // The size must be 64bit aligned to allow 64bit variable to be aligned
- GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);
- } else {
- GlobalVariableBase = mGlobalVariableBase;
- }
-
- if (VariableSize == 4) {
- *(UINT32*)Variable = ReadUnaligned32 ((CONST UINT32*)(GlobalVariableBase + VariableOffset));
- } else if (VariableSize == 8) {
- *(UINT64*)Variable = ReadUnaligned64 ((CONST UINT64*)(GlobalVariableBase + VariableOffset));
- } else {
- CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
- }
-}
-
-VOID
-ArmPlatformSetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
-
- if (IS_XIP()) {
- // In Case of XIP, we expect the Primary Stack at the top of the System Memory
- // The size must be 64bit aligned to allow 64bit variable to be aligned
- GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);
- } else {
- GlobalVariableBase = mGlobalVariableBase;
- }
-
- if (VariableSize == 4) {
- WriteUnaligned32 ((UINT32*)(GlobalVariableBase + VariableOffset), *(UINT32*)Variable);
- } else if (VariableSize == 8) {
- WriteUnaligned64 ((UINT64*)(GlobalVariableBase + VariableOffset), *(UINT64*)Variable);
- } else {
- CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
- }
-}
-
-VOID*
-ArmPlatformGetGlobalVariableAddress (
- IN UINTN VariableOffset
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
-
- if (IS_XIP()) {
- // In Case of XIP, we expect the Primary Stack at the top of the System Memory
- // The size must be 64bit aligned to allow 64bit variable to be aligned
- GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);
- } else {
- GlobalVariableBase = mGlobalVariableBase;
- }
-
- return (VOID*)(GlobalVariableBase + VariableOffset);
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
deleted file mode 100644
index 1b5b8fcbee..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PrePiArmPlatformGlobalVariableLib
- FILE_GUID = 44d59470-e5e6-4811-af00-33bb573a804b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformGlobalVariableLib
-
-[Sources.common]
- PrePiArmPlatformGlobalVariableLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPkg/ArmPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- PcdLib
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
-[Pcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdFdBaseAddress
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.c b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.c
deleted file mode 100644
index aa8d8927c1..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Uefi.h>
-#include <Library/ArmPlatformGlobalVariableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-
-VOID
-ArmPlatformGetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdSecGlobalVariableSize));
-
- GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize);
-
- if (VariableSize == 4) {
- *(UINT32*)Variable = ReadUnaligned32 ((CONST UINT32*)(GlobalVariableBase + VariableOffset));
- } else if (VariableSize == 8) {
- *(UINT64*)Variable = ReadUnaligned64 ((CONST UINT64*)(GlobalVariableBase + VariableOffset));
- } else {
- CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
- }
-}
-
-VOID
-ArmPlatformSetGlobalVariable (
- IN UINTN VariableOffset,
- IN UINTN VariableSize,
- OUT VOID* Variable
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdSecGlobalVariableSize));
-
- GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize);
-
- if (VariableSize == 4) {
- WriteUnaligned32 ((UINT32*)(GlobalVariableBase + VariableOffset), *(UINT32*)Variable);
- } else if (VariableSize == 8) {
- WriteUnaligned64 ((UINT64*)(GlobalVariableBase + VariableOffset), *(UINT64*)Variable);
- } else {
- CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
- }
-}
-
-VOID*
-ArmPlatformGetGlobalVariableAddress (
- IN UINTN VariableOffset
- )
-{
- UINTN GlobalVariableBase;
-
- // Ensure the Global Variable Size have been initialized
- ASSERT (VariableOffset < PcdGet32 (PcdSecGlobalVariableSize));
-
- GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize);
-
- return (VOID*)(GlobalVariableBase + VariableOffset);
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf
deleted file mode 100644
index d64cbafb1e..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf
+++ /dev/null
@@ -1,39 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SecArmPlatformGlobalVariableLib
- FILE_GUID = e01f4944-df86-488b-b89b-79e7a53a3a5d
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformGlobalVariableLib
-
-[Sources.common]
- SecArmPlatformGlobalVariableLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- PcdLib
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize
-
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S b/ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S
deleted file mode 100644
index 8c099b469e..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Library/ArmLib.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-ASM_PFX(ArmPlatformPeiBootAction):
- ret
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-// With this function: CorePos = (ClusterId * 4) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
- and x1, x0, #ARM_CORE_MASK
- and x0, x0, #ARM_CLUSTER_MASK
- add x0, x1, x0, LSR #6
- ret
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
- ldrh w0, [x0]
- ret
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
- ldrh w1, [x1]
- and x0, x0, x1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x1)
- ldrh w1, [x1]
- cmp w0, w1
- mov x0, #1
- mov x1, #0
- csel x0, x0, x1, eq
- ret
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S
deleted file mode 100644
index e52ea5afa2..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Library/ArmLib.h>
-
-.text
-.align 2
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-ASM_PFX(ArmPlatformPeiBootAction):
- bx lr
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformGetCorePosition):
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
- bx lr
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1)
- ldr r1, [r1]
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm
deleted file mode 100644
index 95704c100a..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Library/ArmLib.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformPeiBootAction
- EXPORT ArmPlatformGetCorePosition
- EXPORT ArmPlatformGetPrimaryCoreMpId
- EXPORT ArmPlatformIsPrimaryCore
-
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
-
- PRESERVE8
- AREA ArmPlatformNullHelper, CODE, READONLY
-
-ArmPlatformPeiBootAction FUNCTION
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetCorePosition (
-// IN UINTN MpId
-// );
-ArmPlatformGetCorePosition FUNCTION
- and r1, r0, #ARM_CORE_MASK
- and r0, r0, #ARM_CLUSTER_MASK
- add r0, r1, r0, LSR #7
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformGetPrimaryCoreMpId (
-// VOID
-// );
-ArmPlatformGetPrimaryCoreMpId FUNCTION
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
- bx lr
- ENDFUNC
-
-//UINTN
-//ArmPlatformIsPrimaryCore (
-// IN UINTN MpId
-// );
-ArmPlatformIsPrimaryCore FUNCTION
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
- and r0, r0, r1
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r1)
- ldr r1, [r1]
- cmp r0, r1
- moveq r0, #1
- movne r0, #0
- bx lr
- ENDFUNC
-
- END
-
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c
deleted file mode 100644
index 0cc1e4a03c..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmLib.h>
-#include <Library/ArmPlatformLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-
-ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = {
- {
- // Cluster 0, Core 0
- 0x0, 0x0,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 1
- 0x0, 0x1,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 2
- 0x0, 0x2,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (UINT64)0xFFFFFFFF
- },
- {
- // Cluster 0, Core 3
- 0x0, 0x3,
-
- // MP Core MailBox Set/Get/Clear Addresses and Clear Value
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- (UINT64)0xFFFFFFFF
- }
-};
-
-// This function should be better located into TimerLib implementation
-RETURN_STATUS
-EFIAPI
-TimerConstructor (
- VOID
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- Return the current Boot Mode
-
- This function returns the boot reason on the platform
-
-**/
-EFI_BOOT_MODE
-ArmPlatformGetBootMode (
- VOID
- )
-{
- return BOOT_WITH_FULL_CONFIGURATION;
-}
-
-/**
- Initialize controllers that must setup in the normal world
-
- This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei
- in the PEI phase.
-
-**/
-RETURN_STATUS
-ArmPlatformInitialize (
- IN UINTN MpId
- )
-{
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- //TODO: Implement me
-
- return RETURN_SUCCESS;
-}
-
-/**
- Initialize the system (or sometimes called permanent) memory
-
- This memory is generally represented by the DRAM.
-
-**/
-VOID
-ArmPlatformInitializeSystemMemory (
- VOID
- )
-{
- //TODO: Implement me
-}
-
-EFI_STATUS
-PrePeiCoreGetMpCoreInfo (
- OUT UINTN *CoreCount,
- OUT ARM_CORE_INFO **ArmCoreTable
- )
-{
- if (ArmIsMpCore()) {
- *CoreCount = sizeof(mArmPlatformNullMpCoreInfoTable) / sizeof(ARM_CORE_INFO);
- *ArmCoreTable = mArmPlatformNullMpCoreInfoTable;
- return EFI_SUCCESS;
- } else {
- return EFI_UNSUPPORTED;
- }
-}
-
-// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
-EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
-ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
-
-EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &mArmMpCoreInfoPpiGuid,
- &mMpCoreInfoPpi
- }
-};
-
-VOID
-ArmPlatformGetPlatformPpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- if (ArmIsMpCore()) {
- *PpiListSize = sizeof(gPlatformPpiTable);
- *PpiList = gPlatformPpiTable;
- } else {
- *PpiListSize = 0;
- *PpiList = NULL;
- }
-}
-
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
deleted file mode 100644
index 4517ad5102..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformLibNull
- FILE_GUID = cb494bad-23ff-427e-8608-d7e138d3363b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- DebugLib
-
-[Sources.common]
- ArmPlatformLibNull.c
- ArmPlatformLibNullMem.c
-
-[Sources.Arm]
- Arm/ArmPlatformHelper.S | GCC
- Arm/ArmPlatformHelper.asm | RVCT
-
-[Sources.AArch64]
- AArch64/ArmPlatformHelper.S
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullMem.c b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullMem.c
deleted file mode 100644
index 45a64c622a..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullMem.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-
-/**
- Return the Virtual Memory Map of your platform
-
- This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
-
- @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
- Virtual Memory mapping. This array must be ended by a zero-filled
- entry
-
-**/
-VOID
-ArmPlatformGetVirtualMemoryMap (
- IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
- )
-{
- ASSERT(0);
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf
deleted file mode 100644
index 3cd5fd889e..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf
+++ /dev/null
@@ -1,47 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformLibNull
- FILE_GUID = cb494bad-23ff-427e-8608-d7e138d3363b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- DebugLib
-
-[Sources.common]
- ArmPlatformLibNull.c
-
-[Sources.Arm]
- Arm/ArmPlatformHelper.S | GCC
- Arm/ArmPlatformHelper.asm | RVCT
-
-[Sources.AArch64]
- AArch64/ArmPlatformHelper.S
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
- gArmTokenSpaceGuid.PcdArmPrimaryCore
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/AArch64/ArmPlatformLibNullBoot.S b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/AArch64/ArmPlatformLibNullBoot.S
deleted file mode 100644
index 0bfb947d1c..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/AArch64/ArmPlatformLibNullBoot.S
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <Base.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformSecBootAction)
-GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)
-GCC_ASM_EXPORT(ArmSecMpCoreSecondariesWrite)
-GCC_ASM_EXPORT(ArmSecMpCoreSecondariesRead)
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ASM_PFX(ArmPlatformSecBootAction):
- ret
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ASM_PFX(ArmPlatformSecBootMemoryInit):
- // The SMC does not need to be initialized for RTSM
- ret
-
-/* Write the flag register used to start Secondary cores */
-ASM_PFX(ArmSecMpCoreSecondariesWrite):
- // Write to the CPU Mailbox
- ret
-
-
-/* Read the flag register used to start Secondary cores */
-ASM_PFX(ArmSecMpCoreSecondariesRead):
- // Return the value from the CPU Mailbox
- mov x0, #0
- ret
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S
deleted file mode 100644
index a00fac4f81..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <Base.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformSecBootAction)
-GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ASM_PFX(ArmPlatformSecBootAction):
- bx lr
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ASM_PFX(ArmPlatformSecBootMemoryInit):
- // The SMC does not need to be initialized for RTSM
- bx lr
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm
deleted file mode 100644
index ead0868740..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <Base.h>
-#include <AutoGen.h>
-
- EXPORT ArmPlatformSecBootAction
- EXPORT ArmPlatformSecBootMemoryInit
-
- PRESERVE8
- AREA ArmPlatformSecLibBoot, CODE, READONLY
-
-/**
- Call at the beginning of the platform boot up
-
- This function allows the firmware platform to do extra actions at the early
- stage of the platform power up.
-
- Note: This function must be implemented in assembler as there is no stack set up yet
-
-**/
-ArmPlatformSecBootAction
- bx lr
-
-/**
- Initialize the memory where the initial stacks will reside
-
- This memory can contain the initial stacks (Secure and Secure Monitor stacks).
- In some platform, this region is already initialized and the implementation of this function can
- do nothing. This memory can also represent the Secure RAM.
- This function is called before the satck has been set up. Its implementation must ensure the stack
- pointer is not used (probably required to use assembly language)
-
-**/
-ArmPlatformSecBootMemoryInit
- // The SMC does not need to be initialized for RTSM
- bx lr
-
- END
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c
deleted file mode 100644
index 0e5529f75f..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-/**
- Initialize the Secure peripherals and memory regions
-
- If Trustzone is supported by your platform then this function makes the required initialization
- of the secure peripherals and memory regions.
-
-**/
-VOID
-ArmPlatformSecTrustzoneInit (
- IN UINTN MpId
- )
-{
- // Secondary cores might have to set the Secure SGIs into the GICD_IGROUPR0
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return;
- }
-
- ASSERT(FALSE);
-}
-
-/**
- Initialize controllers that must setup at the early stage
-
- Some peripherals must be initialized in Secure World.
- For example, some L2x0 requires to be initialized in Secure World
-
-**/
-RETURN_STATUS
-ArmPlatformSecInitialize (
- IN UINTN MpId
- )
-{
- // If it is not the primary core then there is nothing to do
- if (!ArmPlatformIsPrimaryCore (MpId)) {
- return RETURN_SUCCESS;
- }
-
- // Do nothing yet
- return RETURN_SUCCESS;
-}
-
-/**
- Call before jumping to Normal World
-
- This function allows the firmware platform to do extra actions before
- jumping to the Normal World
-
-**/
-VOID
-ArmPlatformSecExtraAction (
- IN UINTN MpId,
- OUT UINTN* JumpAddress
- )
-{
- *JumpAddress = PcdGet64 (PcdFvBaseAddress);
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
deleted file mode 100644
index 0e3f54a2a8..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformLibSecNull
- FILE_GUID = a2cf63c6-d44f-4cd0-8af6-722a0138c021
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSecLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- DebugLib
-
-[Sources.common]
- ArmPlatformLibNullSec.c
-
-[Sources.ARM]
- Arm/ArmPlatformLibNullBoot.asm | RVCT
- Arm/ArmPlatformLibNullBoot.S | GCC
-
-[Sources.AARCH64]
- AArch64/ArmPlatformLibNullBoot.S
-
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFvBaseAddress
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/AArch64/ArmPlatformStackLib.S b/ArmPlatformPkg/Library/ArmPlatformStackLib/AArch64/ArmPlatformStackLib.S
deleted file mode 100644
index 485017f620..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/AArch64/ArmPlatformStackLib.S
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// Copyright (c) 2012-2014, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformStackSet)
-GCC_ASM_EXPORT(ArmPlatformStackSetPrimary)
-GCC_ASM_EXPORT(ArmPlatformStackSetSecondary)
-
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformGetPrimaryCoreMpId)
-
-GCC_ASM_IMPORT(gPcd_FixedAtBuild_PcdCoreCount)
-
-//VOID
-//ArmPlatformStackSet (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ASM_PFX(ArmPlatformStackSet):
- // Save parameters
- mov x6, x3
- mov x5, x2
- mov x4, x1
- mov x3, x0
-
- // Save the Link register
- mov x7, x30
-
- // Identify Stack
- mov x0, x1
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
- cmp x0, #1
-
- // Restore parameters
- mov x0, x3
- mov x1, x4
- mov x2, x5
- mov x3, x6
-
- // Restore the Link register
- mov x30, x7
-
- // Should be ASM_PFX(ArmPlatformStackSetPrimary) but generate linker error 'unsupported ELF EM_AARCH64'
- b.eq ArmPlatformStackSetPrimaryL
- // Should be ASM_PFX(ArmPlatformStackSetSecondary) but generate linker error 'unsupported ELF EM_AARCH64'
- b.ne ArmPlatformStackSetSecondaryL
-
-//VOID
-//ArmPlatformStackSetPrimary (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ArmPlatformStackSetPrimaryL:
-ASM_PFX(ArmPlatformStackSetPrimary):
- // Save the Link register
- mov x4, x30
-
- // Add stack of primary stack to StackBase
- add x0, x0, x2
-
- // Compute SecondaryCoresCount * SecondaryCoreStackSize
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x1)
- ldr w1, [x1]
- sub x1, x1, #1
- mul x3, x3, x1
-
- // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))
- add sp, x0, x3
-
- br x4
-
-//VOID
-//ArmPlatformStackSetSecondary (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ArmPlatformStackSetSecondaryL:
-ASM_PFX(ArmPlatformStackSetSecondary):
- // Save the Link register
- mov x4, x30
- mov sp, x0
-
- // Get Core Position
- mov x0, x1
- bl ASM_PFX(ArmPlatformGetCorePosition)
- mov x5, x0
-
- // Get Primary Core Position
- bl ASM_PFX(ArmPlatformGetPrimaryCoreMpId)
- bl ASM_PFX(ArmPlatformGetCorePosition)
-
- // Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)
- cmp x5, x0
- b.ls 1f
- // Decrement the position if after the primary core
- sub x5, x5, #1
-1:
- add x5, x5, #1
-
- // Compute top of the secondary stack
- mul x3, x3, x5
-
- // Set stack
- add sp, sp, x3
-
- br x4
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S
deleted file mode 100644
index 96e925981f..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S
+++ /dev/null
@@ -1,121 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformStackSet)
-GCC_ASM_EXPORT(ArmPlatformStackSetPrimary)
-GCC_ASM_EXPORT(ArmPlatformStackSetSecondary)
-
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformGetPrimaryCoreMpId)
-
-GCC_ASM_IMPORT(gPcd_FixedAtBuild_PcdCoreCount)
-
-//VOID
-//ArmPlatformStackSet (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ASM_PFX(ArmPlatformStackSet):
- // Save parameters
- mov r6, r3
- mov r5, r2
- mov r4, r1
- mov r3, r0
-
- // Save the Link register
- mov r7, lr
-
- // Identify Stack
- mov r0, r1
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
- cmp r0, #1
-
- // Restore parameters
- mov r0, r3
- mov r1, r4
- mov r2, r5
- mov r3, r6
-
- // Restore the Link register
- mov lr, r7
-
- beq ASM_PFX(ArmPlatformStackSetPrimary)
- bne ASM_PFX(ArmPlatformStackSetSecondary)
-
-//VOID
-//ArmPlatformStackSetPrimary (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ASM_PFX(ArmPlatformStackSetPrimary):
- mov r4, lr
-
- // Add stack of primary stack to StackBase
- add r0, r0, r2
-
- // Compute SecondaryCoresCount * SecondaryCoreStackSize
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, r1)
- ldr r1, [r1]
- sub r1, #1
- mul r3, r3, r1
-
- // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))
- add sp, r0, r3
-
- bx r4
-
-//VOID
-//ArmPlatformStackSetSecondary (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ASM_PFX(ArmPlatformStackSetSecondary):
- mov r4, lr
- mov sp, r0
-
- // Get Core Position
- mov r0, r1
- bl ASM_PFX(ArmPlatformGetCorePosition)
- mov r5, r0
-
- // Get Primary Core Position
- bl ASM_PFX(ArmPlatformGetPrimaryCoreMpId)
- bl ASM_PFX(ArmPlatformGetCorePosition)
-
- // Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)
- cmp r5, r0
- subhi r5, r5, #1
- add r5, r5, #1
-
- // Compute top of the secondary stack
- mul r3, r3, r5
-
- // Set stack
- add sp, sp, r3
-
- bx r4
-
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm
deleted file mode 100644
index 99218cd10a..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <AutoGen.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- EXPORT ArmPlatformStackSet
- EXPORT ArmPlatformStackSetPrimary
- EXPORT ArmPlatformStackSetSecondary
-
- IMPORT ArmPlatformIsPrimaryCore
- IMPORT ArmPlatformGetCorePosition
- IMPORT ArmPlatformGetPrimaryCoreMpId
-
- IMPORT _gPcd_FixedAtBuild_PcdCoreCount
-
- PRESERVE8
- AREA ArmPlatformStackLib, CODE, READONLY
-
-//VOID
-//ArmPlatformStackSet (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ArmPlatformStackSet FUNCTION
- // Save parameters
- mov r6, r3
- mov r5, r2
- mov r4, r1
- mov r3, r0
-
- // Save the Link register
- mov r7, lr
-
- // Identify Stack
- mov r0, r1
- bl ArmPlatformIsPrimaryCore
- cmp r0, #1
-
- // Restore parameters
- mov r0, r3
- mov r1, r4
- mov r2, r5
- mov r3, r6
-
- // Restore the Link register
- mov lr, r7
-
- beq ArmPlatformStackSetPrimary
- bne ArmPlatformStackSetSecondary
- ENDFUNC
-
-//VOID
-//ArmPlatformStackSetPrimary (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ArmPlatformStackSetPrimary FUNCTION
- mov r4, lr
-
- // Add stack of primary stack to StackBase
- add r0, r0, r2
-
- // Compute SecondaryCoresCount * SecondaryCoreStackSize
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, r1)
- ldr r1, [r1]
- sub r1, #1
- mul r3, r3, r1
-
- // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))
- add sp, r0, r3
-
- bx r4
- ENDFUNC
-
-//VOID
-//ArmPlatformStackSetSecondary (
-// IN UINTN StackBase,
-// IN UINTN MpId,
-// IN UINTN PrimaryStackSize,
-// IN UINTN SecondaryStackSize
-// );
-ArmPlatformStackSetSecondary FUNCTION
- mov r4, lr
- mov sp, r0
-
- // Get Core Position
- mov r0, r1
- bl ArmPlatformGetCorePosition
- mov r5, r0
-
- // Get Primary Core Position
- bl ArmPlatformGetPrimaryCoreMpId
- bl ArmPlatformGetCorePosition
-
- // Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)
- cmp r5, r0
- subhi r5, r5, #1
- add r5, r5, #1
-
- // Compute top of the secondary stack
- mul r3, r3, r5
-
- // Set stack
- add sp, sp, r3
-
- bx r4
- ENDFUNC
-
- END
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf b/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
deleted file mode 100644
index 16a2917873..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-#/* @file
-#
-# Copyright (c) 2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformStackLib
- FILE_GUID = 5e2e44af-53c1-44c2-a801-9c149f3d6ba0
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformStackLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[Sources.ARM]
- Arm/ArmPlatformStackLib.asm | RVCT
- Arm/ArmPlatformStackLib.S | GCC
-
-[Sources.AARCH64]
- AArch64/ArmPlatformStackLib.S
-
-[LibraryClasses]
- ArmPlatformLib
-
-[FixedPcd]
- gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c b/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c
deleted file mode 100644
index a7199e65d8..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-
-#include <Library/ArmPlatformSysConfigLib.h>
-
-
-RETURN_STATUS
-ArmPlatformSysConfigInitialize (
- VOID
- )
-{
- return RETURN_SUCCESS;
-}
-
-/***************************************
- * GENERAL FUNCTION: AccessSysCfgRegister
- * Interacts with
- * SYS_CFGSTAT
- * SYS_CFGDATA
- * SYS_CFGCTRL
- * for setting and for reading out values
- ***************************************/
-RETURN_STATUS
-AccessSysCfgRegister (
- IN UINT32 ReadWrite,
- IN UINT32 Function,
- IN UINT32 Site,
- IN UINT32 Position,
- IN UINT32 Device,
- IN OUT UINT32* Data
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGet (
- IN SYS_CONFIG_FUNCTION Function,
- OUT UINT32* Value
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigGetValues (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINTN Size,
- OUT UINT32* Values
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSet (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Value
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-ArmPlatformSysConfigSetDevice (
- IN SYS_CONFIG_FUNCTION Function,
- IN UINT32 Device,
- IN UINT32 Value
- )
-{
- return RETURN_UNSUPPORTED;
-}
diff --git a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf b/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf
deleted file mode 100644
index f379d7228c..0000000000
--- a/ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf
+++ /dev/null
@@ -1,28 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformSysConfigLibNull
- FILE_GUID = b2a191a9-9bac-4c83-a2f3-d5f6e71efd03
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSysConfigLib
-
-[Sources.common]
- ArmPlatformSysConfigLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c
deleted file mode 100644
index 67bbb9e863..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-*
-* This program and the accompanying materials are licensed and made available
-* under the terms and conditions of the BSD License which accompanies this
-* distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Uefi.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/ArmShellCmdLib.h>
-
-#include "ArmShellCmdRunAxf.h"
-
-EFI_HANDLE gRunAxfHiiHandle = NULL;
-
-#define RUNAXF_HII_GUID \
- { \
- 0xf5a6413b, 0x78d5, 0x448e, { 0xa2, 0x15, 0x22, 0x82, 0x8e, 0xbc, 0x61, 0x61 } \
- }
-
-EFI_GUID gRunAxfHiiGuid = RUNAXF_HII_GUID;
-
-static EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolRunAxf = {
- L"runaxf", // *CommandName
- ShellDynCmdRunAxfHandler, // Handler
- ShellDynCmdRunAxfGetHelp // GetHelp
-};
-
-EFI_STATUS
-ShellDynCmdRunAxfInstall (
- IN EFI_HANDLE ImageHandle
- )
-{
- EFI_STATUS Status;
-
- // Register our shell command
- Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
- &gEfiShellDynamicCommandProtocolGuid,
- &mShellDynCmdProtocolRunAxf,
- NULL);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Load the manual page for our command
- //
- // 3rd parameter 'HII strings array' must be name of .uni strings file
- // followed by 'Strings', e.g. mycommands.uni must be specified as
- // 'mycommandsStrings' because the build Autogen process defines this as a
- // string array for the strings in your .uni file. Examine your Build folder
- // under your package's DEBUG folder and you will find it defined in a
- // xxxStrDefs.h file.
- //
- gRunAxfHiiHandle = HiiAddPackages (&gRunAxfHiiGuid, ImageHandle,
- ArmShellCmdRunAxfStrings, NULL);
- if (gRunAxfHiiHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-ShellDynCmdRunAxfUninstall (
- IN EFI_HANDLE ImageHandle
- )
-{
-
- EFI_STATUS Status;
-
- if (gRunAxfHiiHandle != NULL) {
- HiiRemovePackages (gRunAxfHiiHandle);
- }
-
- Status = gBS->UninstallMultipleProtocolInterfaces (ImageHandle,
- &gEfiShellDynamicCommandProtocolGuid,
- &mShellDynCmdProtocolRunAxf,
- NULL);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.h
deleted file mode 100644
index 8599961d37..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-*
-* This program and the accompanying materials are licensed and made available
-* under the terms and conditions of the BSD License which accompanies this
-* distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __ARM_SHELL_CMD_RUNAXF__
-#define __ARM_SHELL_CMD_RUNAXF__
-
-#include <ShellBase.h>
-
-#include <Protocol/EfiShell.h>
-#include <Protocol/EfiShellDynamicCommand.h>
-
-#include <Library/HiiLib.h>
-#include <Library/ShellLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-extern EFI_GUID gRunAxfHiiGuid;
-extern EFI_HANDLE gRunAxfHiiHandle;
-extern EFI_HANDLE gRunAxfImageHandle;
-
-// List of data segments to load to memory from AXF/ELF file.
-typedef struct {
- LIST_ENTRY Link; // This attribute must be the first entry of this
- // structure (to avoid pointer computation)
- UINTN MemOffset; // Where the data should go, Dest
- UINTN FileOffset; // Where the data is from, Src
- BOOLEAN Zeroes; // A section of Zeroes. Like .bss in ELF
- UINTN Length; // Number of bytes.
-} RUNAXF_LOAD_LIST;
-
-
-/**
- This is the shell command handler function pointer callback type. This
- function handles the command when it is invoked in the shell.
-
- @param[in] This The instance of the
- EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
- @param[in] SystemTable The pointer to the system table.
- @param[in] ShellParameters The parameters associated with the command.
- @param[in] Shell The instance of the shell protocol used in the
- context of processing this command.
-
- @return EFI_SUCCESS The operation was successful.
- @return other The operation failed.
-**/
-SHELL_STATUS
-EFIAPI
-ShellDynCmdRunAxfHandler (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
- IN EFI_SHELL_PROTOCOL *Shell
- );
-
-
-/**
- This is the command help handler function pointer callback type. This
- function is responsible for displaying help information for the associated
- command.
-
- @param[in] This The instance of the
- EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
- @param[in] Language The pointer to the language string to use.
-
- @return string Pool allocated help string, must be freed by
- caller.
-**/
-CHAR16*
-EFIAPI
-ShellDynCmdRunAxfGetHelp (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN CONST CHAR8 *Language
- );
-
-#endif //__ARM_SHELL_CMD_RUNAXF__
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf
deleted file mode 100644
index 9a34f66661..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-#
-# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials are licensed and made available
-# under the terms and conditions of the BSD License which accompanies this
-# distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = ArmShellCmdRunAxf
- FILE_GUID = 1f78349d-7fba-4686-8098-fa017eda35fb
- MODULE_TYPE = UEFI_APPLICATION
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmShellCmdRunAxfLib
-
-[Sources.common]
- ArmShellCmdRunAxf.c
- ArmShellCmdRunAxf.uni
- RunAxf.c
- BootMonFsLoader.h
- BootMonFsLoader.c
- ElfLoader.h
- ElfLoader.c
- # ELF definitions taken from BaseTools
- elf32.h
- elf64.h
- elf_common.h
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdeModulePkg/MdeModulePkg.dec
- MdePkg/MdePkg.dec
- ShellPkg/ShellPkg.dec
-
-[LibraryClasses]
- ArmLib
- BaseLib
- BdsLib
- DebugLib
- HiiLib
- ShellLib
-
-[Protocols]
- gEfiShellDynamicCommandProtocolGuid
-
-[Guids]
- gArmBootMonFsFileInfoGuid
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.uni b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.uni
deleted file mode 100644
index 33cc7345da..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.uni
+++ /dev/null
Binary files differ
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.c
deleted file mode 100644
index 0bce037dcb..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials are licensed and made available
-* under the terms and conditions of the BSD License which accompanies this
-* distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
-* WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-
-#include <Guid/BootMonFsFileInfo.h>
-#include <Protocol/SimpleFileSystem.h> // EFI_FILE_HANDLE
-
-#include "ArmShellCmdRunAxf.h"
-#include "BootMonFsLoader.h"
-
-/**
- Check that loading the file is supported.
-
- Not all information is checked, only the properties that matters to us in
- our simplified loader.
-
- BootMonFS file properties is not in a file header but in the file-system
- metadata, so we need to pass a handle to the file to allow access to the
- information.
-
- @param[in] FileHandle Handle of the file to check.
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the header is invalid.
- @retval EFI_UNSUPPORTED if the file type/platform is not supported.
-**/
-EFI_STATUS
-BootMonFsCheckFile (
- IN CONST EFI_FILE_HANDLE FileHandle
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_FILE_INFO Info;
- UINTN InfoSize;
- UINTN Index;
-
- ASSERT (FileHandle != NULL);
-
- // Try to load the file information as BootMonFS executable.
- InfoSize = sizeof (Info);
- // Get BootMon File info and see if it gives us what we need to load the file.
- Status = FileHandle->GetInfo (FileHandle, &gArmBootMonFsFileInfoGuid,
- &InfoSize, &Info);
-
- if (!EFI_ERROR (Status)) {
- // Check the values return to see if they look reasonable.
- // Do we have a good entrypoint and at least one good load region?
- // We assume here that we cannot load to address 0x0.
- if ((Info.Size == 0) || (Info.EntryPoint == 0) || (Info.RegionCount == 0) ||
- (Info.RegionCount > BOOTMONFS_IMAGE_DESCRIPTION_REGION_MAX)) {
- // The file does not seem to be of the right type.
- Status = EFI_UNSUPPORTED;
- } else {
- // Check load regions. We just check for valid numbers, we dont do the
- // checksums. Info.Offset can be zero if it loads from the start of the
- // file.
- for (Index = 0; Index < Info.RegionCount; Index++) {
- if ((Info.Region[Index].LoadAddress == 0) || (Info.Region[Index].Size == 0)) {
- Status = EFI_UNSUPPORTED;
- break;
- }
- }
- }
- }
-
- return Status;
-}
-
-/**
- Load a binary file from BootMonFS.
-
- @param[in] FileHandle Handle of the file to load.
-
- @param[in] FileData Address of the file data in memory.
-
- @param[out] EntryPoint Will be filled with the ELF entry point address.
-
- @param[out] ImageSize Will be filled with the file size in memory. This
- will effectively be equal to the sum of the load
- region sizes.
-
- This function assumes the file is valid and supported as checked with
- BootMonFsCheckFile().
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the file is invalid.
-**/
-EFI_STATUS
-BootMonFsLoadFile (
- IN CONST EFI_FILE_HANDLE FileHandle,
- IN CONST VOID *FileData,
- OUT VOID **EntryPoint,
- OUT LIST_ENTRY *LoadList
- )
-{
- EFI_STATUS Status;
- BOOTMON_FS_FILE_INFO Info;
- UINTN InfoSize;
- UINTN Index;
- UINTN ImageSize;
- RUNAXF_LOAD_LIST *LoadNode;
-
- ASSERT (FileHandle != NULL);
- ASSERT (FileData != NULL);
- ASSERT (EntryPoint != NULL);
- ASSERT (LoadList != NULL);
-
- ImageSize = 0;
-
- InfoSize = sizeof (Info);
- Status = FileHandle->GetInfo (FileHandle, &gArmBootMonFsFileInfoGuid,
- &InfoSize, &Info);
-
- if (!EFI_ERROR (Status)) {
- *EntryPoint = (VOID*)((UINTN)Info.EntryPoint);
- // Load all the regions to run-time memory
- for (Index = 0; Index < Info.RegionCount; Index++) {
- LoadNode = AllocateRuntimeZeroPool (sizeof (RUNAXF_LOAD_LIST));
- if (LoadNode == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- break;
- }
-
- LoadNode->MemOffset = (UINTN)Info.Region[Index].LoadAddress;
- LoadNode->FileOffset = (UINTN)FileData + Info.Region[Index].Offset;
- LoadNode->Length = (UINTN)Info.Region[Index].Size;
- InsertTailList (LoadList, &LoadNode->Link);
-
- ImageSize += LoadNode->Length;
- }
- }
-
- if ((!EFI_ERROR (Status)) && (ImageSize == 0)) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.h
deleted file mode 100644
index de3c0adcd1..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/BootMonFsLoader.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Ltd. All rights reserved.
-*
-* This program and the accompanying materials are licensed and made available
-* under the terms and conditions of the BSD License which accompanies this
-* distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
-* WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __BOOTMONFS_LOADER_H__
-#define __BOOTMONFS_LOADER_H__
-
-/**
- Check that loading the file is supported.
-
- Not all information is checked, only the properties that matters to us in
- our simplified loader.
-
- BootMonFS file properties is not in a file header but in the file-system
- metadata, so we need to pass a handle to the file to allow access to the
- information.
-
- @param[in] FileHandle Handle of the file to check.
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the header is invalid.
- @retval EFI_UNSUPPORTED if the file type/platform is not supported.
-**/
-EFI_STATUS
-BootMonFsCheckFile (
- IN CONST EFI_FILE_HANDLE FileHandle
- );
-
-/**
- Load a binary file from BootMonFS.
-
- @param[in] FileHandle Handle of the file to load.
-
- @param[in] FileData Address of the file data in memory.
-
- @param[out] EntryPoint Will be filled with the ELF entry point address.
-
- @param[out] ImageSize Will be filled with the file size in memory. This
- will effectively be equal to the sum of the load
- region sizes.
-
- This function assumes the file is valid and supported as checked with
- BootMonFsCheckFile().
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the file is invalid.
-**/
-EFI_STATUS
-BootMonFsLoadFile (
- IN CONST EFI_FILE_HANDLE FileHandle,
- IN CONST VOID *FileData,
- OUT VOID **EntryPoint,
- OUT LIST_ENTRY *LoadList
- );
-
-#endif // __BOOTMONFS_LOADER_H__
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.c
deleted file mode 100644
index 6bb0d22de2..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-
-#include "ArmShellCmdRunAxf.h"
-#include "ElfLoader.h"
-#include "elf_common.h"
-#include "elf32.h"
-#include "elf64.h"
-
-
-// Put the functions the #ifdef. We only use the appropriate one for the platform.
-// This prevents 'defined but not used' compiler warning.
-#ifdef MDE_CPU_ARM
-STATIC
-BOOLEAN
-IsArmElf (
- IN CONST VOID *Buf
- )
-{
- Elf32_Ehdr *Hdr = (Elf32_Ehdr*)Buf;
-
- if (Hdr->e_ident[EI_CLASS] != ELFCLASS32) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFWRONGCLASS_32), gRunAxfHiiHandle);
- return FALSE;
- }
-
- if (Hdr->e_machine != EM_ARM) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFWRONGMACH_32), gRunAxfHiiHandle);
- return FALSE;
- }
-
- // We don't currently check endianness of ELF data (hdr->e_ident[EI_DATA])
-
- return TRUE;
-}
-#elif defined(MDE_CPU_AARCH64)
-STATIC
-BOOLEAN
-IsAarch64Elf (
- IN CONST VOID *Buf
- )
-{
- Elf64_Ehdr *Hdr = (Elf64_Ehdr*)Buf;
-
- if (Hdr->e_ident[EI_CLASS] != ELFCLASS64) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFWRONGCLASS_64), gRunAxfHiiHandle);
- return FALSE;
- }
-
- if (Hdr->e_machine != EM_AARCH64) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFWRONGMACH_64), gRunAxfHiiHandle);
- return FALSE;
- }
-
- // We don't currently check endianness of ELF data (hdr->e_ident[EI_DATA])
-
- return TRUE;
-}
-#endif // MDE_CPU_ARM , MDE_CPU_AARCH64
-
-
-/**
- Support checking 32 and 64bit as the header could be valid, we might just
- not support loading it.
-**/
-STATIC
-EFI_STATUS
-ElfCheckHeader (
- IN CONST VOID *Buf
- )
-{
- Elf32_Ehdr *Hdr32 = (Elf32_Ehdr*)Buf;
-
- if (!IS_ELF (*Hdr32)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFMAGIC), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- if (Hdr32->e_type != ET_EXEC) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFNOTEXEC), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- if (Hdr32->e_ident[EI_CLASS] == ELFCLASS32) {
- if ((Hdr32->e_phoff == 0) || (Hdr32->e_phentsize == 0) || (Hdr32->e_phnum == 0)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFNOPROG), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- if (Hdr32->e_flags != 0) {
- DEBUG ((EFI_D_INFO, "Warning: Wrong processor-specific flags, expected 0.\n"));
- }
-
- DEBUG ((EFI_D_INFO, "Entry point addr: 0x%lx\n", Hdr32->e_entry));
- DEBUG ((EFI_D_INFO, "Start of program headers: 0x%lx\n", Hdr32->e_phoff));
- DEBUG ((EFI_D_INFO, "Size of 1 program header: %d\n", Hdr32->e_phentsize));
- DEBUG ((EFI_D_INFO, "Number of program headers: %d\n", Hdr32->e_phnum));
- } else if (Hdr32->e_ident[EI_CLASS] == ELFCLASS64) {
- Elf64_Ehdr *Hdr64 = (Elf64_Ehdr*)Buf;
-
- if ((Hdr64->e_phoff == 0) || (Hdr64->e_phentsize == 0) || (Hdr64->e_phnum == 0)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFNOPROG), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- if (Hdr64->e_flags != 0) {
- DEBUG ((EFI_D_INFO, "Warning: Wrong processor-specific flags, expected 0.\n"));
- }
-
- DEBUG ((EFI_D_INFO, "Entry point addr: 0x%lx\n", Hdr64->e_entry));
- DEBUG ((EFI_D_INFO, "Start of program headers: 0x%lx\n", Hdr64->e_phoff));
- DEBUG ((EFI_D_INFO, "Size of 1 program header: %d\n", Hdr64->e_phentsize));
- DEBUG ((EFI_D_INFO, "Number of program headers: %d\n", Hdr64->e_phnum));
- } else {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFWRONGCLASS), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Load an ELF segment into memory.
-
- This function assumes the ELF file is valid.
- This function is meant to be called for PT_LOAD type segments only.
-**/
-STATIC
-EFI_STATUS
-ElfLoadSegment (
- IN CONST VOID *ElfImage,
- IN CONST VOID *PHdr,
- IN LIST_ENTRY *LoadList
- )
-{
- VOID *FileSegment;
- VOID *MemSegment;
- UINTN ExtraZeroes;
- UINTN ExtraZeroesCount;
- RUNAXF_LOAD_LIST *LoadNode;
-
-#ifdef MDE_CPU_ARM
- Elf32_Phdr *ProgramHdr;
- ProgramHdr = (Elf32_Phdr *)PHdr;
-#elif defined(MDE_CPU_AARCH64)
- Elf64_Phdr *ProgramHdr;
- ProgramHdr = (Elf64_Phdr *)PHdr;
-#endif
-
- ASSERT (ElfImage != NULL);
- ASSERT (ProgramHdr != NULL);
-
- FileSegment = (VOID *)((UINTN)ElfImage + ProgramHdr->p_offset);
- MemSegment = (VOID *)ProgramHdr->p_vaddr;
-
- // If the segment's memory size p_memsz is larger than the file size p_filesz,
- // the "extra" bytes are defined to hold the value 0 and to follow the
- // segment's initialised area.
- // This is typically the case for the .bss segment.
- // The file size may not be larger than the memory size.
- if (ProgramHdr->p_filesz > ProgramHdr->p_memsz) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFBADFORMAT), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- // Load the segment in memory.
- if (ProgramHdr->p_filesz != 0) {
- DEBUG ((EFI_D_INFO, "Loading segment from 0x%lx to 0x%lx (size = %ld)\n",
- FileSegment, MemSegment, ProgramHdr->p_filesz));
-
- LoadNode = AllocateRuntimeZeroPool (sizeof (RUNAXF_LOAD_LIST));
- if (LoadNode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- LoadNode->MemOffset = (UINTN)MemSegment;
- LoadNode->FileOffset = (UINTN)FileSegment;
- LoadNode->Length = (UINTN)ProgramHdr->p_filesz;
- InsertTailList (LoadList, &LoadNode->Link);
- }
-
- ExtraZeroes = ((UINTN)MemSegment + ProgramHdr->p_filesz);
- ExtraZeroesCount = ProgramHdr->p_memsz - ProgramHdr->p_filesz;
- DEBUG ((EFI_D_INFO, "Completing segment with %d zero bytes.\n", ExtraZeroesCount));
- if (ExtraZeroesCount > 0) {
- // Extra Node to add the Zeroes.
- LoadNode = AllocateRuntimeZeroPool (sizeof (RUNAXF_LOAD_LIST));
- if (LoadNode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- LoadNode->MemOffset = (UINTN)ExtraZeroes;
- LoadNode->Zeroes = TRUE;
- LoadNode->Length = ExtraZeroesCount;
- InsertTailList (LoadList, &LoadNode->Link);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Check that the ELF File Header is valid and Machine type supported.
-
- Not all information is checked in the ELF header, only the stuff that
- matters to us in our simplified ELF loader.
-
- @param[in] ElfImage Address of the ELF file to check.
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the header is invalid.
- @retval EFI_UNSUPPORTED if the file type/platform is not supported.
-**/
-EFI_STATUS
-ElfCheckFile (
- IN CONST VOID *ElfImage
- )
-{
- EFI_STATUS Status;
-
- ASSERT (ElfImage != NULL);
-
- // Check that the ELF header is valid.
- Status = ElfCheckHeader (ElfImage);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFBADHEADER), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
-#ifdef MDE_CPU_ARM
- if (IsArmElf (ElfImage)) {
- return EFI_SUCCESS;
- }
-#elif defined(MDE_CPU_AARCH64)
- if (IsAarch64Elf (ElfImage)) {
- return EFI_SUCCESS;
- }
-#endif
-
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_BAD_ARCH), gRunAxfHiiHandle);
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- Load a ELF file.
-
- @param[in] ElfImage Address of the ELF file in memory.
-
- @param[out] EntryPoint Will be filled with the ELF entry point address.
-
- @param[out] ImageSize Will be filled with the ELF size in memory. This will
- effectively be equal to the sum of the segments sizes.
-
- This functon assumes the header is valid and supported as checked with
- ElfCheckFile().
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the ELF file is invalid.
-**/
-EFI_STATUS
-ElfLoadFile (
- IN CONST VOID *ElfImage,
- OUT VOID **EntryPoint,
- OUT LIST_ENTRY *LoadList
- )
-{
- EFI_STATUS Status;
- UINT8 *ProgramHdr;
- UINTN Index;
- UINTN ImageSize;
-
-#ifdef MDE_CPU_ARM
- Elf32_Ehdr *ElfHdr;
- Elf32_Phdr *ProgramHdrPtr;
-
- ElfHdr = (Elf32_Ehdr*)ElfImage;
-#elif defined(MDE_CPU_AARCH64)
- Elf64_Ehdr *ElfHdr;
- Elf64_Phdr *ProgramHdrPtr;
-
- ElfHdr = (Elf64_Ehdr*)ElfImage;
-#endif
-
- ASSERT (ElfImage != NULL);
- ASSERT (EntryPoint != NULL);
- ASSERT (LoadList != NULL);
-
- ProgramHdr = (UINT8*)ElfImage + ElfHdr->e_phoff;
- DEBUG ((EFI_D_INFO, "ELF program header entry : 0x%lx\n", ProgramHdr));
-
- ImageSize = 0;
-
- // Load every loadable ELF segment into memory.
- for (Index = 0; Index < ElfHdr->e_phnum; ++Index) {
-
-#ifdef MDE_CPU_ARM
- ProgramHdrPtr = (Elf32_Phdr*)ProgramHdr;
-#elif defined(MDE_CPU_AARCH64)
- ProgramHdrPtr = (Elf64_Phdr*)ProgramHdr;
-#endif
-
- // Only consider PT_LOAD type segments, ignore others.
- if (ProgramHdrPtr->p_type == PT_LOAD) {
- Status = ElfLoadSegment (ElfImage, (VOID *)ProgramHdrPtr, LoadList);
- if (EFI_ERROR (Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFFAILSEG), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
- ImageSize += ProgramHdrPtr->p_memsz;
- }
- ProgramHdr += ElfHdr->e_phentsize;
- }
-
- if (ImageSize == 0) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_ELFNOSEG), gRunAxfHiiHandle);
- return EFI_INVALID_PARAMETER;
- }
-
- // Return the entry point specified in the ELF header.
- *EntryPoint = (void*)ElfHdr->e_entry;
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h
deleted file mode 100644
index 7020a6c4e7..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
-*
-* Copyright (c) 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef ELF_LOADER_H
-#define ELF_LOADER_H
-
-/**
- Check that the ELF File Header is valid and Machine type supported.
-
- Not all information is checked in the ELF header, only the stuff that
- matters to us in our simplified ELF loader.
-
- @param[in] ElfImage Address of the ELF file to check.
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the header is invalid.
- @retval EFI_UNSUPPORTED if the file type/platform is not supported.
-**/
-EFI_STATUS
-ElfCheckFile (
- IN CONST VOID *ElfImage
- );
-
-
-/**
- Load a ELF file.
-
- @param[in] ElfImage Address of the ELF file in memory.
-
- @param[out] EntryPoint Will be filled with the ELF entry point address.
-
- @param[out] ImageSize Will be filled with the ELF size in memory. This will
- effectively be equal to the sum of the segments sizes.
-
- This function assumes the header is valid and supported as checked with
- ElfCheckFile().
-
- NOTE:
- - We don't currently take the segment permissions into account (indicated by
- the program headers). It can be used to allocate pages with the right
- read/write/exec permissions.
-
- @retval EFI_SUCCESS on success.
- @retval EFI_INVALID_PARAMETER if the ELF file is invalid.
-**/
-EFI_STATUS
-ElfLoadFile (
- IN CONST VOID *ElfImage,
- OUT VOID **EntryPoint,
- OUT LIST_ENTRY *LoadList
- );
-
-#endif // ELF_LOADER_H
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c
deleted file mode 100644
index 2abfb6cc10..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/** @file
-*
-* Shell command for launching AXF files.
-*
-* Copyright (c) 2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Guid/GlobalVariable.h>
-
-#include <Library/PrintLib.h>
-#include <Library/HandleParsingLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/BdsLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-
-#include <Library/ArmLib.h>
-
-#include "ArmShellCmdRunAxf.h"
-#include "ElfLoader.h"
-#include "BootMonFsLoader.h"
-
-// Provide arguments to AXF?
-typedef VOID (*ELF_ENTRYPOINT)(UINTN arg0, UINTN arg1,
- UINTN arg2, UINTN arg3);
-
-
-STATIC
-EFI_STATUS
-PreparePlatformHardware (
- VOID
- )
-{
- //Note: Interrupts will be disabled by the GIC driver when ExitBootServices() will be called.
-
- // Clean before Disable else the Stack gets corrupted with old data.
- ArmCleanDataCache ();
- ArmDisableDataCache ();
- // Invalidate all the entries that might have snuck in.
- ArmInvalidateDataCache ();
-
- // Disable and invalidate the instruction cache
- ArmDisableInstructionCache ();
- ArmInvalidateInstructionCache ();
-
- // Turn off MMU
- ArmDisableMmu();
-
- return EFI_SUCCESS;
-}
-
-// Process arguments to pass to AXF?
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {NULL, TypeMax}
-};
-
-
-/**
- This is the shell command handler function pointer callback type. This
- function handles the command when it is invoked in the shell.
-
- @param[in] This The instance of the
- EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
- @param[in] SystemTable The pointer to the system table.
- @param[in] ShellParameters The parameters associated with the command.
- @param[in] Shell The instance of the shell protocol used in the
- context of processing this command.
-
- @return EFI_SUCCESS The operation was successful.
- @return other The operation failed.
-**/
-SHELL_STATUS
-EFIAPI
-ShellDynCmdRunAxfHandler (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
- IN EFI_SHELL_PROTOCOL *Shell
- )
-{
- LIST_ENTRY *ParamPackage;
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- SHELL_FILE_HANDLE FileHandle;
- ELF_ENTRYPOINT StartElf;
- CONST CHAR16 *FileName;
- EFI_FILE_INFO *Info;
- UINTN FileSize;
- VOID *FileData;
- VOID *Entrypoint;
- LIST_ENTRY LoadList;
- LIST_ENTRY *Node;
- LIST_ENTRY *NextNode;
- RUNAXF_LOAD_LIST *LoadNode;
- CHAR16 *TmpFileName;
- CHAR16 *TmpChar16;
-
-
- ShellStatus = SHELL_SUCCESS;
- FileHandle = NULL;
- FileData = NULL;
- InitializeListHead (&LoadList);
-
- // Only install if they are not there yet? First time or every time?
- // These can change if the shell exits and start again.
- Status = gBS->InstallMultipleProtocolInterfaces (&gImageHandle,
- &gEfiShellProtocolGuid, Shell,
- &gEfiShellParametersProtocolGuid, ShellParameters,
- NULL);
-
- if (EFI_ERROR (Status)) {
- return SHELL_DEVICE_ERROR;
- }
-
- // Update the protocols for the application library
- Status = ShellInitialize ();
- ASSERT_EFI_ERROR (Status);
- // Add support to load AXF with optipnal args?
-
- //
- // Process Command Line arguments
- //
- Status = ShellCommandLineParse (ParamList, &ParamPackage, NULL, TRUE);
- if (EFI_ERROR (Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_INVALID_ARG), gRunAxfHiiHandle);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- //
- // Check for "-?"
- //
- if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
- (ShellCommandLineGetRawValue (ParamPackage, 1) == NULL)) {
- //
- // We didn't get a file to load
- //
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_INVALID_ARG), gRunAxfHiiHandle);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- // For the moment we assume we only ever get one file to load with no arguments.
- FileName = ShellCommandLineGetRawValue (ParamPackage, 1);
- Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR (Status)) {
- // BootMonFS supports file extensions, but they are stripped by default
- // when the NOR is programmed.
- // Remove the file extension and try to open again.
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_FILE_NOT_FOUND),
- gRunAxfHiiHandle, FileName);
- // Go through the filename and remove file extension. Preserve the
- // original name.
- TmpFileName = AllocateCopyPool (StrSize (FileName), (VOID *)FileName);
- if (TmpFileName != NULL) {
- TmpChar16 = StrStr (TmpFileName, L".");
- if (TmpChar16 != NULL) {
- *TmpChar16 = '\0';
- DEBUG((EFI_D_ERROR, "Trying to open file: %s\n", TmpFileName));
- Status = ShellOpenFileByName (TmpFileName, &FileHandle,
- EFI_FILE_MODE_READ, 0);
- }
- FreePool (TmpFileName);
- }
- // Do we now have an open file after trying again?
- if (EFI_ERROR (Status)) {
- ShellStatus = SHELL_INVALID_PARAMETER;
- FileHandle = NULL;
- }
- }
-
- if (FileHandle != NULL) {
- Info = ShellGetFileInfo (FileHandle);
- FileSize = (UINTN) Info->FileSize;
- FreePool (Info);
-
- //
- // Allocate buffer to read file. 'Runtime' so we can access it after
- // ExitBootServices().
- //
- FileData = AllocateRuntimeZeroPool (FileSize);
- if (FileData == NULL) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_NO_MEM), gRunAxfHiiHandle);
- ShellStatus = SHELL_OUT_OF_RESOURCES;
- } else {
- //
- // Read file into Buffer
- //
- Status = ShellReadFile (FileHandle, &FileSize, FileData);
- if (EFI_ERROR (Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_READ_FAIL), gRunAxfHiiHandle);
- SHELL_FREE_NON_NULL (FileData);
- FileData = NULL;
- ShellStatus = SHELL_DEVICE_ERROR;
- }
- }
- }
- }
-
- //
- // Free the command line package
- //
- ShellCommandLineFreeVarList (ParamPackage);
- }
-
- // We have a file in memory. Try to work out if we can use it.
- // It can either be in ELF format or BootMonFS format.
- if (FileData != NULL) {
- // Do some validation on the file before we try to load it. The file can
- // either be an proper ELF file or one processed by the FlashLoader.
- // Since the data might need to go to various locations in memory we cannot
- // load the data directly while UEFI is running. We use the file loaders to
- // populate a linked list of data and load addresses. This is processed and
- // data copied to where it needs to go after calling ExitBootServices. At
- // that stage we've reached the point of no return, so overwriting UEFI code
- // does not make a difference.
- Status = ElfCheckFile (FileData);
- if (!EFI_ERROR (Status)) {
- // Load program into memory
- Status = ElfLoadFile ((VOID*)FileData, &Entrypoint, &LoadList);
- } else {
- // Try to see if it is a BootMonFs executable
- Status = BootMonFsCheckFile ((EFI_FILE_HANDLE)FileHandle);
- if (!EFI_ERROR (Status)) {
- // Load program into memory
- Status = BootMonFsLoadFile ((EFI_FILE_HANDLE)FileHandle,
- (VOID*)FileData, &Entrypoint, &LoadList);
- } else {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RUNAXF_BAD_FILE),
- gRunAxfHiiHandle);
- SHELL_FREE_NON_NULL (FileData);
- ShellStatus = SHELL_UNSUPPORTED;
- }
- }
- }
-
- // Program load list created.
- // Shutdown UEFI, copy and jump to code.
- if (!IsListEmpty (&LoadList) && !EFI_ERROR (Status)) {
- // Exit boot services here. This means we cannot return and cannot assume to
- // have access to UEFI functions.
- Status = ShutdownUefiBootServices ();
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR,"Can not shutdown UEFI boot services. Status=0x%X\n",
- Status));
- } else {
- // Process linked list. Copy data to Memory.
- Node = GetFirstNode (&LoadList);
- while (!IsNull (&LoadList, Node)) {
- LoadNode = (RUNAXF_LOAD_LIST *)Node;
- // Do we have data to copy or do we need to set Zeroes (.bss)?
- if (LoadNode->Zeroes) {
- ZeroMem ((VOID*)LoadNode->MemOffset, LoadNode->Length);
- } else {
- CopyMem ((VOID *)LoadNode->MemOffset, (VOID *)LoadNode->FileOffset,
- LoadNode->Length);
- }
- Node = GetNextNode (&LoadList, Node);
- }
-
- //
- // Switch off interrupts, caches, mmu, etc
- //
- Status = PreparePlatformHardware ();
- ASSERT_EFI_ERROR (Status);
-
- StartElf = (ELF_ENTRYPOINT)Entrypoint;
- StartElf (0,0,0,0);
-
- // We should never get here.. But if we do, spin..
- ASSERT (FALSE);
- while (1);
- }
- }
-
- // Free file related information as we are returning to UEFI.
- Node = GetFirstNode (&LoadList);
- while (!IsNull (&LoadList, Node)) {
- NextNode = RemoveEntryList (Node);
- FreePool (Node);
- Node = NextNode;
- }
- SHELL_FREE_NON_NULL (FileData);
- if (FileHandle != NULL) {
- ShellCloseFile (&FileHandle);
- }
-
- // Uninstall protocols as we don't know if they will change.
- // If the shell exits and come in again these mappings may be different
- // and cause a crash.
- Status = gBS->UninstallMultipleProtocolInterfaces (gImageHandle,
- &gEfiShellProtocolGuid, Shell,
- &gEfiShellParametersProtocolGuid, ShellParameters,
- NULL);
-
- if (EFI_ERROR (Status) && ShellStatus == SHELL_SUCCESS) {
- ShellStatus = SHELL_DEVICE_ERROR;
- }
-
- return ShellStatus;
-}
-
-
-/**
- This is the command help handler function pointer callback type. This
- function is responsible for displaying help information for the associated
- command.
-
- @param[in] This The instance of the
- EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
- @param[in] Language The pointer to the language string to use.
-
- @return string Pool allocated help string, must be freed by
- caller.
-**/
-CHAR16*
-EFIAPI
-ShellDynCmdRunAxfGetHelp (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN CONST CHAR8 *Language
- )
-{
- CHAR16 *HelpText;
-
- ASSERT (gRunAxfHiiHandle != NULL);
-
- // This allocates memory. The caller is responsoible to free.
- HelpText = HiiGetString (gRunAxfHiiHandle, STRING_TOKEN (STR_GET_HELP_RUNAXF),
- Language);
-
- return HelpText;
-}
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf32.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf32.h
deleted file mode 100644
index 3951444a30..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf32.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/** @file
-Ported ELF include files from FreeBSD
-
-Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-/*-
- * Copyright (c) 1996-1998 John D. Polstra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $
- */
-
-#ifndef _SYS_ELF32_H_
-#define _SYS_ELF32_H_ 1
-
-
-/*
- * ELF definitions common to all 32-bit architectures.
- */
-
-typedef UINT32 Elf32_Addr;
-typedef UINT16 Elf32_Half;
-typedef UINT32 Elf32_Off;
-typedef INT32 Elf32_Sword;
-typedef UINT32 Elf32_Word;
-typedef UINT64 Elf32_Lword;
-
-typedef Elf32_Word Elf32_Hashelt;
-
-/* Non-standard class-dependent datatype used for abstraction. */
-typedef Elf32_Word Elf32_Size;
-typedef Elf32_Sword Elf32_Ssize;
-
-/*
- * ELF header.
- */
-
-typedef struct {
- unsigned char e_ident[EI_NIDENT]; /* File identification. */
- Elf32_Half e_type; /* File type. */
- Elf32_Half e_machine; /* Machine architecture. */
- Elf32_Word e_version; /* ELF format version. */
- Elf32_Addr e_entry; /* Entry point. */
- Elf32_Off e_phoff; /* Program header file offset. */
- Elf32_Off e_shoff; /* Section header file offset. */
- Elf32_Word e_flags; /* Architecture-specific flags. */
- Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
- Elf32_Half e_phentsize; /* Size of program header entry. */
- Elf32_Half e_phnum; /* Number of program header entries. */
- Elf32_Half e_shentsize; /* Size of section header entry. */
- Elf32_Half e_shnum; /* Number of section header entries. */
- Elf32_Half e_shstrndx; /* Section name strings section. */
-} Elf32_Ehdr;
-
-/*
- * Section header.
- */
-
-typedef struct {
- Elf32_Word sh_name; /* Section name (index into the
- section header string table). */
- Elf32_Word sh_type; /* Section type. */
- Elf32_Word sh_flags; /* Section flags. */
- Elf32_Addr sh_addr; /* Address in memory image. */
- Elf32_Off sh_offset; /* Offset in file. */
- Elf32_Word sh_size; /* Size in bytes. */
- Elf32_Word sh_link; /* Index of a related section. */
- Elf32_Word sh_info; /* Depends on section type. */
- Elf32_Word sh_addralign; /* Alignment in bytes. */
- Elf32_Word sh_entsize; /* Size of each entry in section. */
-} Elf32_Shdr;
-
-/*
- * Program header.
- */
-
-typedef struct {
- Elf32_Word p_type; /* Entry type. */
- Elf32_Off p_offset; /* File offset of contents. */
- Elf32_Addr p_vaddr; /* Virtual address in memory image. */
- Elf32_Addr p_paddr; /* Physical address (not used). */
- Elf32_Word p_filesz; /* Size of contents in file. */
- Elf32_Word p_memsz; /* Size of contents in memory. */
- Elf32_Word p_flags; /* Access permission flags. */
- Elf32_Word p_align; /* Alignment in memory and file. */
-} Elf32_Phdr;
-
-/*
- * Dynamic structure. The ".dynamic" section contains an array of them.
- */
-
-typedef struct {
- Elf32_Sword d_tag; /* Entry type. */
- union {
- Elf32_Word d_val; /* Integer value. */
- Elf32_Addr d_ptr; /* Address value. */
- } d_un;
-} Elf32_Dyn;
-
-/*
- * Relocation entries.
- */
-
-/* Relocations that don't need an addend field. */
-typedef struct {
- Elf32_Addr r_offset; /* Location to be relocated. */
- Elf32_Word r_info; /* Relocation type and symbol index. */
-} Elf32_Rel;
-
-/* Relocations that need an addend field. */
-typedef struct {
- Elf32_Addr r_offset; /* Location to be relocated. */
- Elf32_Word r_info; /* Relocation type and symbol index. */
- Elf32_Sword r_addend; /* Addend. */
-} Elf32_Rela;
-
-/* Macros for accessing the fields of r_info. */
-#define ELF32_R_SYM(info) ((info) >> 8)
-#define ELF32_R_TYPE(info) ((unsigned char)(info))
-
-/* Macro for constructing r_info from field values. */
-#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
-
-/*
- * Note entry header
- */
-typedef Elf_Note Elf32_Nhdr;
-
-/*
- * Move entry
- */
-typedef struct {
- Elf32_Lword m_value; /* symbol value */
- Elf32_Word m_info; /* size + index */
- Elf32_Word m_poffset; /* symbol offset */
- Elf32_Half m_repeat; /* repeat count */
- Elf32_Half m_stride; /* stride info */
-} Elf32_Move;
-
-/*
- * The macros compose and decompose values for Move.r_info
- *
- * sym = ELF32_M_SYM(M.m_info)
- * size = ELF32_M_SIZE(M.m_info)
- * M.m_info = ELF32_M_INFO(sym, size)
- */
-#define ELF32_M_SYM(info) ((info)>>8)
-#define ELF32_M_SIZE(info) ((unsigned char)(info))
-#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
-
-/*
- * Hardware/Software capabilities entry
- */
-typedef struct {
- Elf32_Word c_tag; /* how to interpret value */
- union {
- Elf32_Word c_val;
- Elf32_Addr c_ptr;
- } c_un;
-} Elf32_Cap;
-
-/*
- * Symbol table entries.
- */
-
-typedef struct {
- Elf32_Word st_name; /* String table index of name. */
- Elf32_Addr st_value; /* Symbol value. */
- Elf32_Word st_size; /* Size of associated object. */
- unsigned char st_info; /* Type and binding information. */
- unsigned char st_other; /* Reserved (not used). */
- Elf32_Half st_shndx; /* Section index of symbol. */
-} Elf32_Sym;
-
-/* Macros for accessing the fields of st_info. */
-#define ELF32_ST_BIND(info) ((info) >> 4)
-#define ELF32_ST_TYPE(info) ((info) & 0xf)
-
-/* Macro for constructing st_info from field values. */
-#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
-
-/* Macro for accessing the fields of st_other. */
-#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
-
-/* Structures used by Sun & GNU symbol versioning. */
-typedef struct
-{
- Elf32_Half vd_version;
- Elf32_Half vd_flags;
- Elf32_Half vd_ndx;
- Elf32_Half vd_cnt;
- Elf32_Word vd_hash;
- Elf32_Word vd_aux;
- Elf32_Word vd_next;
-} Elf32_Verdef;
-
-typedef struct
-{
- Elf32_Word vda_name;
- Elf32_Word vda_next;
-} Elf32_Verdaux;
-
-typedef struct
-{
- Elf32_Half vn_version;
- Elf32_Half vn_cnt;
- Elf32_Word vn_file;
- Elf32_Word vn_aux;
- Elf32_Word vn_next;
-} Elf32_Verneed;
-
-typedef struct
-{
- Elf32_Word vna_hash;
- Elf32_Half vna_flags;
- Elf32_Half vna_other;
- Elf32_Word vna_name;
- Elf32_Word vna_next;
-} Elf32_Vernaux;
-
-typedef Elf32_Half Elf32_Versym;
-
-typedef struct {
- Elf32_Half si_boundto; /* direct bindings - symbol bound to */
- Elf32_Half si_flags; /* per symbol flags */
-} Elf32_Syminfo;
-
-#endif /* !_SYS_ELF32_H_ */
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf64.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf64.h
deleted file mode 100644
index 1cfe0c9539..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf64.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/** @file
-Ported ELF include files from FreeBSD
-
-Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-/*-
- * Copyright (c) 1996-1998 John D. Polstra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $
- */
-
-#ifndef _SYS_ELF64_H_
-#define _SYS_ELF64_H_ 1
-
-
-/*
- * ELF definitions common to all 64-bit architectures.
- */
-
-typedef UINT64 Elf64_Addr;
-typedef UINT16 Elf64_Half;
-typedef UINT64 Elf64_Off;
-typedef INT32 Elf64_Sword;
-typedef INT64 Elf64_Sxword;
-typedef UINT32 Elf64_Word;
-typedef UINT64 Elf64_Lword;
-typedef UINT64 Elf64_Xword;
-
-/*
- * Types of dynamic symbol hash table bucket and chain elements.
- *
- * This is inconsistent among 64 bit architectures, so a machine dependent
- * typedef is required.
- */
-
-typedef Elf64_Word Elf64_Hashelt;
-
-/* Non-standard class-dependent datatype used for abstraction. */
-typedef Elf64_Xword Elf64_Size;
-typedef Elf64_Sxword Elf64_Ssize;
-
-/*
- * ELF header.
- */
-
-typedef struct {
- unsigned char e_ident[EI_NIDENT]; /* File identification. */
- Elf64_Half e_type; /* File type. */
- Elf64_Half e_machine; /* Machine architecture. */
- Elf64_Word e_version; /* ELF format version. */
- Elf64_Addr e_entry; /* Entry point. */
- Elf64_Off e_phoff; /* Program header file offset. */
- Elf64_Off e_shoff; /* Section header file offset. */
- Elf64_Word e_flags; /* Architecture-specific flags. */
- Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
- Elf64_Half e_phentsize; /* Size of program header entry. */
- Elf64_Half e_phnum; /* Number of program header entries. */
- Elf64_Half e_shentsize; /* Size of section header entry. */
- Elf64_Half e_shnum; /* Number of section header entries. */
- Elf64_Half e_shstrndx; /* Section name strings section. */
-} Elf64_Ehdr;
-
-/*
- * Section header.
- */
-
-typedef struct {
- Elf64_Word sh_name; /* Section name (index into the
- section header string table). */
- Elf64_Word sh_type; /* Section type. */
- Elf64_Xword sh_flags; /* Section flags. */
- Elf64_Addr sh_addr; /* Address in memory image. */
- Elf64_Off sh_offset; /* Offset in file. */
- Elf64_Xword sh_size; /* Size in bytes. */
- Elf64_Word sh_link; /* Index of a related section. */
- Elf64_Word sh_info; /* Depends on section type. */
- Elf64_Xword sh_addralign; /* Alignment in bytes. */
- Elf64_Xword sh_entsize; /* Size of each entry in section. */
-} Elf64_Shdr;
-
-/*
- * Program header.
- */
-
-typedef struct {
- Elf64_Word p_type; /* Entry type. */
- Elf64_Word p_flags; /* Access permission flags. */
- Elf64_Off p_offset; /* File offset of contents. */
- Elf64_Addr p_vaddr; /* Virtual address in memory image. */
- Elf64_Addr p_paddr; /* Physical address (not used). */
- Elf64_Xword p_filesz; /* Size of contents in file. */
- Elf64_Xword p_memsz; /* Size of contents in memory. */
- Elf64_Xword p_align; /* Alignment in memory and file. */
-} Elf64_Phdr;
-
-/*
- * Dynamic structure. The ".dynamic" section contains an array of them.
- */
-
-typedef struct {
- Elf64_Sxword d_tag; /* Entry type. */
- union {
- Elf64_Xword d_val; /* Integer value. */
- Elf64_Addr d_ptr; /* Address value. */
- } d_un;
-} Elf64_Dyn;
-
-/*
- * Relocation entries.
- */
-
-/* Relocations that don't need an addend field. */
-typedef struct {
- Elf64_Addr r_offset; /* Location to be relocated. */
- Elf64_Xword r_info; /* Relocation type and symbol index. */
-} Elf64_Rel;
-
-/* Relocations that need an addend field. */
-typedef struct {
- Elf64_Addr r_offset; /* Location to be relocated. */
- Elf64_Xword r_info; /* Relocation type and symbol index. */
- Elf64_Sxword r_addend; /* Addend. */
-} Elf64_Rela;
-
-/* Macros for accessing the fields of r_info. */
-#define ELF64_R_SYM(info) ((info) >> 32)
-#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
-
-/* Macro for constructing r_info from field values. */
-#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
-
-#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
-#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
-#define ELF64_R_TYPE_INFO(data, type) \
- (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
-
-/*
- * Note entry header
- */
-typedef Elf_Note Elf64_Nhdr;
-
-/*
- * Move entry
- */
-typedef struct {
- Elf64_Lword m_value; /* symbol value */
- Elf64_Xword m_info; /* size + index */
- Elf64_Xword m_poffset; /* symbol offset */
- Elf64_Half m_repeat; /* repeat count */
- Elf64_Half m_stride; /* stride info */
-} Elf64_Move;
-
-#define ELF64_M_SYM(info) ((info)>>8)
-#define ELF64_M_SIZE(info) ((unsigned char)(info))
-#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
-
-/*
- * Hardware/Software capabilities entry
- */
-typedef struct {
- Elf64_Xword c_tag; /* how to interpret value */
- union {
- Elf64_Xword c_val;
- Elf64_Addr c_ptr;
- } c_un;
-} Elf64_Cap;
-
-/*
- * Symbol table entries.
- */
-
-typedef struct {
- Elf64_Word st_name; /* String table index of name. */
- unsigned char st_info; /* Type and binding information. */
- unsigned char st_other; /* Reserved (not used). */
- Elf64_Half st_shndx; /* Section index of symbol. */
- Elf64_Addr st_value; /* Symbol value. */
- Elf64_Xword st_size; /* Size of associated object. */
-} Elf64_Sym;
-
-/* Macros for accessing the fields of st_info. */
-#define ELF64_ST_BIND(info) ((info) >> 4)
-#define ELF64_ST_TYPE(info) ((info) & 0xf)
-
-/* Macro for constructing st_info from field values. */
-#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
-
-/* Macro for accessing the fields of st_other. */
-#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
-
-/* Structures used by Sun & GNU-style symbol versioning. */
-typedef struct {
- Elf64_Half vd_version;
- Elf64_Half vd_flags;
- Elf64_Half vd_ndx;
- Elf64_Half vd_cnt;
- Elf64_Word vd_hash;
- Elf64_Word vd_aux;
- Elf64_Word vd_next;
-} Elf64_Verdef;
-
-typedef struct {
- Elf64_Word vda_name;
- Elf64_Word vda_next;
-} Elf64_Verdaux;
-
-typedef struct {
- Elf64_Half vn_version;
- Elf64_Half vn_cnt;
- Elf64_Word vn_file;
- Elf64_Word vn_aux;
- Elf64_Word vn_next;
-} Elf64_Verneed;
-
-typedef struct {
- Elf64_Word vna_hash;
- Elf64_Half vna_flags;
- Elf64_Half vna_other;
- Elf64_Word vna_name;
- Elf64_Word vna_next;
-} Elf64_Vernaux;
-
-typedef Elf64_Half Elf64_Versym;
-
-typedef struct {
- Elf64_Half si_boundto; /* direct bindings - symbol bound to */
- Elf64_Half si_flags; /* per symbol flags */
-} Elf64_Syminfo;
-
-#endif /* !_SYS_ELF64_H_ */
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf_common.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf_common.h
deleted file mode 100644
index ed3cedc1b0..0000000000
--- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/elf_common.h
+++ /dev/null
@@ -1,1059 +0,0 @@
-/** @file
-Ported ELF include files from FreeBSD
-
-Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-/*-
- * Copyright (c) 1998 John D. Polstra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.2 2007/12/03 21:30:36 marius Exp $
- */
-
-#ifndef _SYS_ELF_COMMON_H_
-#define _SYS_ELF_COMMON_H_ 1
-
-/*
- * ELF definitions that are independent of architecture or word size.
- */
-
-/*
- * Note header. The ".note" section contains an array of notes. Each
- * begins with this header, aligned to a word boundary. Immediately
- * following the note header is n_namesz bytes of name, padded to the
- * next word boundary. Then comes n_descsz bytes of descriptor, again
- * padded to a word boundary. The values of n_namesz and n_descsz do
- * not include the padding.
- */
-
-typedef struct {
- UINT32 n_namesz; /* Length of name. */
- UINT32 n_descsz; /* Length of descriptor. */
- UINT32 n_type; /* Type of this note. */
-} Elf_Note;
-
-/* Indexes into the e_ident array. Keep synced with
- http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
-#define EI_MAG0 0 /* Magic number, byte 0. */
-#define EI_MAG1 1 /* Magic number, byte 1. */
-#define EI_MAG2 2 /* Magic number, byte 2. */
-#define EI_MAG3 3 /* Magic number, byte 3. */
-#define EI_CLASS 4 /* Class of machine. */
-#define EI_DATA 5 /* Data format. */
-#define EI_VERSION 6 /* ELF format version. */
-#define EI_OSABI 7 /* Operating system / ABI identification */
-#define EI_ABIVERSION 8 /* ABI version */
-#define OLD_EI_BRAND 8 /* Start of architecture identification. */
-#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */
-#define EI_NIDENT 16 /* Size of e_ident array. */
-
-/* Values for the magic number bytes. */
-#define ELFMAG0 0x7f
-#define ELFMAG1 'E'
-#define ELFMAG2 'L'
-#define ELFMAG3 'F'
-#define ELFMAG "\177ELF" /* magic string */
-#define SELFMAG 4 /* magic string size */
-
-/* Values for e_ident[EI_VERSION] and e_version. */
-#define EV_NONE 0
-#define EV_CURRENT 1
-
-/* Values for e_ident[EI_CLASS]. */
-#define ELFCLASSNONE 0 /* Unknown class. */
-#define ELFCLASS32 1 /* 32-bit architecture. */
-#define ELFCLASS64 2 /* 64-bit architecture. */
-
-/* Values for e_ident[EI_DATA]. */
-#define ELFDATANONE 0 /* Unknown data format. */
-#define ELFDATA2LSB 1 /* 2's complement little-endian. */
-#define ELFDATA2MSB 2 /* 2's complement big-endian. */
-
-/* Values for e_ident[EI_OSABI]. */
-#define ELFOSABI_NONE 0 /* UNIX System V ABI */
-#define ELFOSABI_HPUX 1 /* HP-UX operating system */
-#define ELFOSABI_NETBSD 2 /* NetBSD */
-#define ELFOSABI_LINUX 3 /* GNU/Linux */
-#define ELFOSABI_HURD 4 /* GNU/Hurd */
-#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
-#define ELFOSABI_SOLARIS 6 /* Solaris */
-#define ELFOSABI_AIX 7 /* AIX */
-#define ELFOSABI_IRIX 8 /* IRIX */
-#define ELFOSABI_FREEBSD 9 /* FreeBSD */
-#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
-#define ELFOSABI_MODESTO 11 /* Novell Modesto */
-#define ELFOSABI_OPENBSD 12 /* OpenBSD */
-#define ELFOSABI_OPENVMS 13 /* Open VMS */
-#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
-#define ELFOSABI_ARM 97 /* ARM */
-#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
-
-#define ELFOSABI_SYSV ELFOSABI_NONE /* symbol used in old spec */
-#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */
-
-/* e_ident */
-#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
- (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
- (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
- (ehdr).e_ident[EI_MAG3] == ELFMAG3)
-
-/* Values for e_type. */
-#define ET_NONE 0 /* Unknown type. */
-#define ET_REL 1 /* Relocatable. */
-#define ET_EXEC 2 /* Executable. */
-#define ET_DYN 3 /* Shared object. */
-#define ET_CORE 4 /* Core file. */
-#define ET_LOOS 0xfe00 /* First operating system specific. */
-#define ET_HIOS 0xfeff /* Last operating system-specific. */
-#define ET_LOPROC 0xff00 /* First processor-specific. */
-#define ET_HIPROC 0xffff /* Last processor-specific. */
-
-/* Values for e_machine. */
-#define EM_NONE 0 /* Unknown machine. */
-#define EM_M32 1 /* AT&T WE32100. */
-#define EM_SPARC 2 /* Sun SPARC. */
-#define EM_386 3 /* Intel i386. */
-#define EM_68K 4 /* Motorola 68000. */
-#define EM_88K 5 /* Motorola 88000. */
-#define EM_860 7 /* Intel i860. */
-#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */
-#define EM_S370 9 /* IBM System/370. */
-#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian. */
-#define EM_PARISC 15 /* HP PA-RISC. */
-#define EM_VPP500 17 /* Fujitsu VPP500. */
-#define EM_SPARC32PLUS 18 /* SPARC v8plus. */
-#define EM_960 19 /* Intel 80960. */
-#define EM_PPC 20 /* PowerPC 32-bit. */
-#define EM_PPC64 21 /* PowerPC 64-bit. */
-#define EM_S390 22 /* IBM System/390. */
-#define EM_V800 36 /* NEC V800. */
-#define EM_FR20 37 /* Fujitsu FR20. */
-#define EM_RH32 38 /* TRW RH-32. */
-#define EM_RCE 39 /* Motorola RCE. */
-#define EM_ARM 40 /* ARM. */
-#define EM_SH 42 /* Hitachi SH. */
-#define EM_SPARCV9 43 /* SPARC v9 64-bit. */
-#define EM_TRICORE 44 /* Siemens TriCore embedded processor. */
-#define EM_ARC 45 /* Argonaut RISC Core. */
-#define EM_H8_300 46 /* Hitachi H8/300. */
-#define EM_H8_300H 47 /* Hitachi H8/300H. */
-#define EM_H8S 48 /* Hitachi H8S. */
-#define EM_H8_500 49 /* Hitachi H8/500. */
-#define EM_IA_64 50 /* Intel IA-64 Processor. */
-#define EM_MIPS_X 51 /* Stanford MIPS-X. */
-#define EM_COLDFIRE 52 /* Motorola ColdFire. */
-#define EM_68HC12 53 /* Motorola M68HC12. */
-#define EM_MMA 54 /* Fujitsu MMA. */
-#define EM_PCP 55 /* Siemens PCP. */
-#define EM_NCPU 56 /* Sony nCPU. */
-#define EM_NDR1 57 /* Denso NDR1 microprocessor. */
-#define EM_STARCORE 58 /* Motorola Star*Core processor. */
-#define EM_ME16 59 /* Toyota ME16 processor. */
-#define EM_ST100 60 /* STMicroelectronics ST100 processor. */
-#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */
-#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */
-#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */
-#define EM_AARCH64 183 /* ARM 64bit Architecture */
-
-/* Non-standard or deprecated. */
-#define EM_486 6 /* Intel i486. */
-#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
-#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */
-#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */
-
-/* Special section indexes. */
-#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */
-#define SHN_LORESERVE 0xff00 /* First of reserved range. */
-#define SHN_LOPROC 0xff00 /* First processor-specific. */
-#define SHN_HIPROC 0xff1f /* Last processor-specific. */
-#define SHN_LOOS 0xff20 /* First operating system-specific. */
-#define SHN_HIOS 0xff3f /* Last operating system-specific. */
-#define SHN_ABS 0xfff1 /* Absolute values. */
-#define SHN_COMMON 0xfff2 /* Common data. */
-#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */
-#define SHN_HIRESERVE 0xffff /* Last of reserved range. */
-
-/* sh_type */
-#define SHT_NULL 0 /* inactive */
-#define SHT_PROGBITS 1 /* program defined information */
-#define SHT_SYMTAB 2 /* symbol table section */
-#define SHT_STRTAB 3 /* string table section */
-#define SHT_RELA 4 /* relocation section with addends */
-#define SHT_HASH 5 /* symbol hash table section */
-#define SHT_DYNAMIC 6 /* dynamic section */
-#define SHT_NOTE 7 /* note section */
-#define SHT_NOBITS 8 /* no space section */
-#define SHT_REL 9 /* relocation section - no addends */
-#define SHT_SHLIB 10 /* reserved - purpose unknown */
-#define SHT_DYNSYM 11 /* dynamic symbol table section */
-#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */
-#define SHT_FINI_ARRAY 15 /* Termination function pointers. */
-#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */
-#define SHT_GROUP 17 /* Section group. */
-#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */
-#define SHT_LOOS 0x60000000 /* First of OS specific semantics */
-#define SHT_LOSUNW 0x6ffffff4
-#define SHT_SUNW_dof 0x6ffffff4
-#define SHT_SUNW_cap 0x6ffffff5
-#define SHT_SUNW_SIGNATURE 0x6ffffff6
-#define SHT_SUNW_ANNOTATE 0x6ffffff7
-#define SHT_SUNW_DEBUGSTR 0x6ffffff8
-#define SHT_SUNW_DEBUG 0x6ffffff9
-#define SHT_SUNW_move 0x6ffffffa
-#define SHT_SUNW_COMDAT 0x6ffffffb
-#define SHT_SUNW_syminfo 0x6ffffffc
-#define SHT_SUNW_verdef 0x6ffffffd
-#define SHT_GNU_verdef 0x6ffffffd /* Symbol versions provided */
-#define SHT_SUNW_verneed 0x6ffffffe
-#define SHT_GNU_verneed 0x6ffffffe /* Symbol versions required */
-#define SHT_SUNW_versym 0x6fffffff
-#define SHT_GNU_versym 0x6fffffff /* Symbol version table */
-#define SHT_HISUNW 0x6fffffff
-#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
-#define SHT_LOPROC 0x70000000 /* reserved range for processor */
-#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */
-#define SHT_HIPROC 0x7fffffff /* specific section header types */
-#define SHT_LOUSER 0x80000000 /* reserved range for application */
-#define SHT_HIUSER 0xffffffff /* specific indexes */
-
-/* Flags for sh_flags. */
-#define SHF_WRITE 0x1 /* Section contains writable data. */
-#define SHF_ALLOC 0x2 /* Section occupies memory. */
-#define SHF_EXECINSTR 0x4 /* Section contains instructions. */
-#define SHF_MERGE 0x10 /* Section may be merged. */
-#define SHF_STRINGS 0x20 /* Section contains strings. */
-#define SHF_INFO_LINK 0x40 /* sh_info holds section index. */
-#define SHF_LINK_ORDER 0x80 /* Special ordering requirements. */
-#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */
-#define SHF_GROUP 0x200 /* Member of section group. */
-#define SHF_TLS 0x400 /* Section contains TLS data. */
-#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */
-#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */
-
-/* Values for p_type. */
-#define PT_NULL 0 /* Unused entry. */
-#define PT_LOAD 1 /* Loadable segment. */
-#define PT_DYNAMIC 2 /* Dynamic linking information segment. */
-#define PT_INTERP 3 /* Pathname of interpreter. */
-#define PT_NOTE 4 /* Auxiliary information. */
-#define PT_SHLIB 5 /* Reserved (not used). */
-#define PT_PHDR 6 /* Location of program header itself. */
-#define PT_TLS 7 /* Thread local storage segment */
-#define PT_LOOS 0x60000000 /* First OS-specific. */
-#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */
-#define PT_GNU_EH_FRAME 0x6474e550
-#define PT_LOSUNW 0x6ffffffa
-#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
-#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */
-#define PT_SUNWDTRACE 0x6ffffffc /* private */
-#define PT_SUNWCAP 0x6ffffffd /* hard/soft capabilities segment */
-#define PT_HISUNW 0x6fffffff
-#define PT_HIOS 0x6fffffff /* Last OS-specific. */
-#define PT_LOPROC 0x70000000 /* First processor-specific type. */
-#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
-
-/* Values for p_flags. */
-#define PF_X 0x1 /* Executable. */
-#define PF_W 0x2 /* Writable. */
-#define PF_R 0x4 /* Readable. */
-#define PF_MASKOS 0x0ff00000 /* Operating system-specific. */
-#define PF_MASKPROC 0xf0000000 /* Processor-specific. */
-
-/* Extended program header index. */
-#define PN_XNUM 0xffff
-
-/* Values for d_tag. */
-#define DT_NULL 0 /* Terminating entry. */
-#define DT_NEEDED 1 /* String table offset of a needed shared
- library. */
-#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */
-#define DT_PLTGOT 3 /* Processor-dependent address. */
-#define DT_HASH 4 /* Address of symbol hash table. */
-#define DT_STRTAB 5 /* Address of string table. */
-#define DT_SYMTAB 6 /* Address of symbol table. */
-#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */
-#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */
-#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */
-#define DT_STRSZ 10 /* Size of string table. */
-#define DT_SYMENT 11 /* Size of each symbol table entry. */
-#define DT_INIT 12 /* Address of initialization function. */
-#define DT_FINI 13 /* Address of finalization function. */
-#define DT_SONAME 14 /* String table offset of shared object
- name. */
-#define DT_RPATH 15 /* String table offset of library path. [sup] */
-#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */
-#define DT_REL 17 /* Address of ElfNN_Rel relocations. */
-#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */
-#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */
-#define DT_PLTREL 20 /* Type of relocation used for PLT. */
-#define DT_DEBUG 21 /* Reserved (not used). */
-#define DT_TEXTREL 22 /* Indicates there may be relocations in
- non-writable segments. [sup] */
-#define DT_JMPREL 23 /* Address of PLT relocations. */
-#define DT_BIND_NOW 24 /* [sup] */
-#define DT_INIT_ARRAY 25 /* Address of the array of pointers to
- initialization functions */
-#define DT_FINI_ARRAY 26 /* Address of the array of pointers to
- termination functions */
-#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of
- initialization functions. */
-#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of
- terminationfunctions. */
-#define DT_RUNPATH 29 /* String table offset of a null-terminated
- library search path string. */
-#define DT_FLAGS 30 /* Object specific flag values. */
-#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING
- and less than DT_LOOS follow the rules for
- the interpretation of the d_un union
- as follows: even == 'd_ptr', even == 'd_val'
- or none */
-#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to
- pre-initialization functions. */
-#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of
- pre-initialization functions. */
-#define DT_MAXPOSTAGS 34 /* number of positive tags */
-#define DT_LOOS 0x6000000d /* First OS-specific */
-#define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */
-#define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */
-#define DT_SUNW_FILTER 0x6000000f /* symbol filter name */
-#define DT_SUNW_CAP 0x60000010 /* hardware/software */
-#define DT_HIOS 0x6ffff000 /* Last OS-specific */
-
-/*
- * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
- * Dyn.d_un.d_val field of the Elf*_Dyn structure.
- */
-#define DT_VALRNGLO 0x6ffffd00
-#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */
-#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */
-#define DT_MOVEENT 0x6ffffdfa /* move table entry size */
-#define DT_MOVESZ 0x6ffffdfb /* move table size */
-#define DT_FEATURE_1 0x6ffffdfc /* feature holder */
-#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */
- /* the following DT_* entry. */
- /* See DF_P1_* definitions */
-#define DT_SYMINSZ 0x6ffffdfe /* syminfo table size (in bytes) */
-#define DT_SYMINENT 0x6ffffdff /* syminfo entry size (in bytes) */
-#define DT_VALRNGHI 0x6ffffdff
-
-/*
- * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
- * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
- *
- * If any adjustment is made to the ELF object after it has been
- * built, these entries will need to be adjusted.
- */
-#define DT_ADDRRNGLO 0x6ffffe00
-#define DT_CONFIG 0x6ffffefa /* configuration information */
-#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */
-#define DT_AUDIT 0x6ffffefc /* object auditing */
-#define DT_PLTPAD 0x6ffffefd /* pltpadding (sparcv9) */
-#define DT_MOVETAB 0x6ffffefe /* move table */
-#define DT_SYMINFO 0x6ffffeff /* syminfo table */
-#define DT_ADDRRNGHI 0x6ffffeff
-
-#define DT_VERSYM 0x6ffffff0 /* Address of versym section. */
-#define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */
-#define DT_RELCOUNT 0x6ffffffa /* number of RELATIVE relocations */
-#define DT_FLAGS_1 0x6ffffffb /* state flags - see DF_1_* defs */
-#define DT_VERDEF 0x6ffffffc /* Address of verdef section. */
-#define DT_VERDEFNUM 0x6ffffffd /* Number of elems in verdef section */
-#define DT_VERNEED 0x6ffffffe /* Address of verneed section. */
-#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */
-
-#define DT_LOPROC 0x70000000 /* First processor-specific type. */
-#define DT_DEPRECATED_SPARC_REGISTER 0x7000001
-#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */
-#define DT_USED 0x7ffffffe /* ignored - same as needed */
-#define DT_FILTER 0x7fffffff /* shared library filter name */
-#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */
-
-/* Values for DT_FLAGS */
-#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may
- make reference to the $ORIGIN substitution
- string */
-#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */
-#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in
- non-writable segments. */
-#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should
- process all relocations for the object
- containing this entry before transferring
- control to the program. */
-#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or
- executable contains code using a static
- thread-local storage scheme. */
-
-/* Values for n_type. Used in core files. */
-#define NT_PRSTATUS 1 /* Process status. */
-#define NT_FPREGSET 2 /* Floating point registers. */
-#define NT_PRPSINFO 3 /* Process state info. */
-
-/* Symbol Binding - ELFNN_ST_BIND - st_info */
-#define STB_LOCAL 0 /* Local symbol */
-#define STB_GLOBAL 1 /* Global symbol */
-#define STB_WEAK 2 /* like global - lower precedence */
-#define STB_LOOS 10 /* Reserved range for operating system */
-#define STB_HIOS 12 /* specific semantics. */
-#define STB_LOPROC 13 /* reserved range for processor */
-#define STB_HIPROC 15 /* specific semantics. */
-
-/* Symbol type - ELFNN_ST_TYPE - st_info */
-#define STT_NOTYPE 0 /* Unspecified type. */
-#define STT_OBJECT 1 /* Data object. */
-#define STT_FUNC 2 /* Function. */
-#define STT_SECTION 3 /* Section. */
-#define STT_FILE 4 /* Source file. */
-#define STT_COMMON 5 /* Uninitialized common block. */
-#define STT_TLS 6 /* TLS object. */
-#define STT_NUM 7
-#define STT_LOOS 10 /* Reserved range for operating system */
-#define STT_HIOS 12 /* specific semantics. */
-#define STT_LOPROC 13 /* reserved range for processor */
-#define STT_HIPROC 15 /* specific semantics. */
-
-/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
-#define STV_DEFAULT 0x0 /* Default visibility (see binding). */
-#define STV_INTERNAL 0x1 /* Special meaning in relocatable objects. */
-#define STV_HIDDEN 0x2 /* Not visible. */
-#define STV_PROTECTED 0x3 /* Visible but not preemptible. */
-
-/* Special symbol table indexes. */
-#define STN_UNDEF 0 /* Undefined symbol index. */
-
-/* Symbol versioning flags. */
-#define VER_DEF_CURRENT 1
-#define VER_DEF_IDX(x) VER_NDX(x)
-
-#define VER_FLG_BASE 0x01
-#define VER_FLG_WEAK 0x02
-
-#define VER_NEED_CURRENT 1
-#define VER_NEED_WEAK (1u << 15)
-#define VER_NEED_HIDDEN VER_NDX_HIDDEN
-#define VER_NEED_IDX(x) VER_NDX(x)
-
-#define VER_NDX_LOCAL 0
-#define VER_NDX_GLOBAL 1
-#define VER_NDX_GIVEN 2
-
-#define VER_NDX_HIDDEN (1u << 15)
-#define VER_NDX(x) ((x) & ~(1u << 15))
-
-#define CA_SUNW_NULL 0
-#define CA_SUNW_HW_1 1 /* first hardware capabilities entry */
-#define CA_SUNW_SF_1 2 /* first software capabilities entry */
-
-/*
- * Syminfo flag values
- */
-#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association */
- /* to object containing defn. */
-#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */
-#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */
-#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be */
- /* lazily-loaded */
-#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to */
- /* object containing defn. */
-#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference */
- /* directly bind to this symbol */
-#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */
-#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */
-
-/*
- * Syminfo.si_boundto values.
- */
-#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */
-#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */
-#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */
-#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */
-#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */
-
-/*
- * Syminfo version values.
- */
-#define SYMINFO_NONE 0 /* Syminfo version */
-#define SYMINFO_CURRENT 1
-#define SYMINFO_NUM 2
-
-/*
- * Relocation types.
- *
- * All machine architectures are defined here to allow tools on one to
- * handle others.
- */
-
-#define R_386_NONE 0 /* No relocation. */
-#define R_386_32 1 /* Add symbol value. */
-#define R_386_PC32 2 /* Add PC-relative symbol value. */
-#define R_386_GOT32 3 /* Add PC-relative GOT offset. */
-#define R_386_PLT32 4 /* Add PC-relative PLT offset. */
-#define R_386_COPY 5 /* Copy data from shared object. */
-#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */
-#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */
-#define R_386_RELATIVE 8 /* Add load address of shared object. */
-#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */
-#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */
-#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */
-#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */
-#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */
-#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */
-#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */
-#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */
-#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */
-#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */
-#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */
-#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */
-#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */
-#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */
-#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */
-#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */
-#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */
-#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */
-#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */
-#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */
-#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
-#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
-
-/* Null relocation */
-#define R_AARCH64_NONE 256 /* No relocation */
-/* Static AArch64 relocations */
- /* Static data relocations */
-#define R_AARCH64_ABS64 257 /* S + A */
-#define R_AARCH64_ABS32 258 /* S + A */
-#define R_AARCH64_ABS16 259 /* S + A */
-#define R_AARCH64_PREL64 260 /* S + A - P */
-#define R_AARCH64_PREL32 261 /* S + A - P */
-#define R_AARCH64_PREL16 262 /* S + A - P */
- /* Group relocations to create a 16, 32, 48, or 64 bit unsigned data value or address inline */
-#define R_AARCH64_MOVW_UABS_G0 263 /* S + A */
-#define R_AARCH64_MOVW_UABS_G0_NC 264 /* S + A */
-#define R_AARCH64_MOVW_UABS_G1 265 /* S + A */
-#define R_AARCH64_MOVW_UABS_G1_NC 266 /* S + A */
-#define R_AARCH64_MOVW_UABS_G2 267 /* S + A */
-#define R_AARCH64_MOVW_UABS_G2_NC 268 /* S + A */
-#define R_AARCH64_MOVW_UABS_G3 269 /* S + A */
- /* Group relocations to create a 16, 32, 48, or 64 bit signed data or offset value inline */
-#define R_AARCH64_MOVW_SABS_G0 270 /* S + A */
-#define R_AARCH64_MOVW_SABS_G1 271 /* S + A */
-#define R_AARCH64_MOVW_SABS_G2 272 /* S + A */
- /* Relocations to generate 19, 21 and 33 bit PC-relative addresses */
-#define R_AARCH64_LD_PREL_LO19 273 /* S + A - P */
-#define R_AARCH64_ADR_PREL_LO21 274 /* S + A - P */
-#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page(S+A) - Page(P) */
-#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Page(S+A) - Page(P) */
-#define R_AARCH64_ADD_ABS_LO12_NC 277 /* S + A */
-#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* S + A */
-#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* S + A */
-#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* S + A */
-#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* S + A */
-#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* S + A */
- /* Relocations for control-flow instructions - all offsets are a multiple of 4 */
-#define R_AARCH64_TSTBR14 279 /* S+A-P */
-#define R_AARCH64_CONDBR19 280 /* S+A-P */
-#define R_AARCH64_JUMP26 282 /* S+A-P */
-#define R_AARCH64_CALL26 283 /* S+A-P */
- /* Group relocations to create a 16, 32, 48, or 64 bit PC-relative offset inline */
-#define R_AARCH64_MOVW_PREL_G0 287 /* S+A-P */
-#define R_AARCH64_MOVW_PREL_G0_NC 288 /* S+A-P */
-#define R_AARCH64_MOVW_PREL_G1 289 /* S+A-P */
-#define R_AARCH64_MOVW_PREL_G1_NC 290 /* S+A-P */
-#define R_AARCH64_MOVW_PREL_G2 291 /* S+A-P */
-#define R_AARCH64_MOVW_PREL_G2_NC 292 /* S+A-P */
-#define R_AARCH64_MOVW_PREL_G3 293 /* S+A-P */
- /* Group relocations to create a 16, 32, 48, or 64 bit GOT-relative offsets inline */
-#define R_AARCH64_MOVW_GOTOFF_G0 300 /* G(S)-GOT */
-#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* G(S)-GOT */
-#define R_AARCH64_MOVW_GOTOFF_G1 302 /* G(S)-GOT */
-#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* G(S)-GOT */
-#define R_AARCH64_MOVW_GOTOFF_G2 304 /* G(S)-GOT */
-#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* G(S)-GOT */
-#define R_AARCH64_MOVW_GOTOFF_G3 306 /* G(S)-GOT */
- /* GOT-relative data relocations */
-#define R_AARCH64_GOTREL64 307 /* S+A-GOT */
-#define R_AARCH64_GOTREL32 308 /* S+A-GOT */
- /* GOT-relative instruction relocations */
-#define R_AARCH64_GOT_LD_PREL19 309 /* G(S)-P */
-#define R_AARCH64_LD64_GOTOFF_LO15 310 /* G(S)-GOT */
-#define R_AARCH64_ADR_GOT_PAGE 311 /* Page(G(S))-Page(P) */
-#define R_AARCH64_LD64_GOT_LO12_NC 312 /* G(S) */
-#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* G(S)-Page(GOT) */
-/* Relocations for thread-local storage */
- /* General Dynamic TLS relocations */
-#define R_AARCH64_TLSGD_ADR_PREL21 512 /* G(TLSIDX(S+A)) - P */
-#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* Page(G(TLSIDX(S+A))) - Page(P) */
-#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* G(TLSIDX(S+A)) */
-#define R_AARCH64_TLSGD_MOVW_G1 515 /* G(TLSIDX(S+A)) - GOT */
-#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* G(TLSIDX(S+A)) - GOT */
- /* Local Dynamic TLS relocations */
-#define R_AARCH64_TLSLD_ADR_PREL21 517 /* G(LDM(S))) - P */
-#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Page(G(LDM(S)))-Page(P) */
-#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* G(LDM(S)) */
-#define R_AARCH64_TLSLD_MOVW_G1 520 /* G(LDM(S)) - GOT */
-#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* G(LDM(S)) - GOT */
-#define R_AARCH64_TLSLD_LD_PREL19 522 /* G(LDM(S)) - P */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTPREL(S+A) */
-#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* DTPREL(S+A) */
- /* Initial Exec TLS relocations */
-#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* G(TPREL(S+A)) - GOT */
-#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* G(TPREL(S+A)) - GOT */
-#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page(G(TPREL(S+A))) - Page(P) */
-#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* G(TPREL(S+A)) */
-#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* G(TPREL(S+A)) - P */
- /* Local Exec TLS relocations */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TPREL(S+A) */
-#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* TPREL(S+A) */
-/* Dynamic relocations */
- /* Dynamic relocations */
-#define R_AARCH64_COPY 1024
-#define R_AARCH64_GLOB_DAT 1025 /* S + A */
-#define R_AARCH64_JUMP_SLOT 1026 /* S + A */
-#define R_AARCH64_RELATIVE 1027 /* Delta(S) + A , Delta(P) + A */
-#define R_AARCH64_TLS_DTPREL64 1028 /* DTPREL(S+A) */
-#define R_AARCH64_TLS_DTPMOD64 1029 /* LDM(S) */
-#define R_AARCH64_TLS_TPREL64 1030 /* TPREL(S+A) */
-#define R_AARCH64_TLS_DTPREL32 1031 /* DTPREL(S+A) */
-#define R_AARCH64_TLS_DTPMOD32 1032 /* LDM(S) */
-#define R_AARCH64_TLS_TPREL32 1033 /* DTPREL(S+A) */
-
-#define R_ALPHA_NONE 0 /* No reloc */
-#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
-#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
-#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
-#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
-#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
-#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
-#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
-#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
-#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
-#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
-#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
-#define R_ALPHA_OP_PUSH 12 /* OP stack push */
-#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
-#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
-#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
-#define R_ALPHA_GPVALUE 16
-#define R_ALPHA_GPRELHIGH 17
-#define R_ALPHA_GPRELLOW 18
-#define R_ALPHA_IMMED_GP_16 19
-#define R_ALPHA_IMMED_GP_HI32 20
-#define R_ALPHA_IMMED_SCN_HI32 21
-#define R_ALPHA_IMMED_BR_HI32 22
-#define R_ALPHA_IMMED_LO32 23
-#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
-#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
-#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
-#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
-
-#define R_ARM_NONE 0 /* No relocation. */
-#define R_ARM_PC24 1
-#define R_ARM_ABS32 2
-#define R_ARM_REL32 3
-#define R_ARM_PC13 4
-#define R_ARM_ABS16 5
-#define R_ARM_ABS12 6
-#define R_ARM_THM_ABS5 7
-#define R_ARM_ABS8 8
-#define R_ARM_SBREL32 9
-#define R_ARM_THM_PC22 10
-#define R_ARM_THM_PC8 11
-#define R_ARM_AMP_VCALL9 12
-#define R_ARM_SWI24 13
-#define R_ARM_THM_SWI8 14
-#define R_ARM_XPC25 15
-#define R_ARM_THM_XPC22 16
-#define R_ARM_COPY 20 /* Copy data from shared object. */
-#define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */
-#define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */
-#define R_ARM_RELATIVE 23 /* Add load address of shared object. */
-#define R_ARM_GOTOFF 24 /* Add GOT-relative symbol address. */
-#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */
-#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */
-#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */
-#define R_ARM_CALL 28
-#define R_ARM_JMP24 29
-#define R_ARM_MOVW_ABS_NC 43
-#define R_ARM_MOVT_ABS 44
-#define R_ARM_THM_MOVW_ABS_NC 47
-#define R_ARM_THM_MOVT_ABS 48
-
-// Block of PC-relative relocations added to work around gcc putting
-// object relocations in static executables.
-#define R_ARM_THM_JUMP24 30
-#define R_ARM_PREL31 42
-#define R_ARM_MOVW_PREL_NC 45
-#define R_ARM_MOVT_PREL 46
-#define R_ARM_THM_MOVW_PREL_NC 49
-#define R_ARM_THM_MOVT_PREL 50
-#define R_ARM_THM_JMP6 52
-#define R_ARM_THM_ALU_PREL_11_0 53
-#define R_ARM_THM_PC12 54
-#define R_ARM_REL32_NOI 56
-#define R_ARM_ALU_PC_G0_NC 57
-#define R_ARM_ALU_PC_G0 58
-#define R_ARM_ALU_PC_G1_NC 59
-#define R_ARM_ALU_PC_G1 60
-#define R_ARM_ALU_PC_G2 61
-#define R_ARM_LDR_PC_G1 62
-#define R_ARM_LDR_PC_G2 63
-#define R_ARM_LDRS_PC_G0 64
-#define R_ARM_LDRS_PC_G1 65
-#define R_ARM_LDRS_PC_G2 66
-#define R_ARM_LDC_PC_G0 67
-#define R_ARM_LDC_PC_G1 68
-#define R_ARM_LDC_PC_G2 69
-#define R_ARM_GOT_PREL 96
-#define R_ARM_THM_JUMP11 102
-#define R_ARM_THM_JUMP8 103
-#define R_ARM_TLS_GD32 104
-#define R_ARM_TLS_LDM32 105
-#define R_ARM_TLS_IE32 107
-
-#define R_ARM_THM_JUMP19 51
-#define R_ARM_GNU_VTENTRY 100
-#define R_ARM_GNU_VTINHERIT 101
-#define R_ARM_RSBREL32 250
-#define R_ARM_THM_RPC22 251
-#define R_ARM_RREL32 252
-#define R_ARM_RABS32 253
-#define R_ARM_RPC24 254
-#define R_ARM_RBASE 255
-
-
-
-/* Name Value Field Calculation */
-#define R_IA_64_NONE 0 /* None */
-#define R_IA_64_IMM14 0x21 /* immediate14 S + A */
-#define R_IA_64_IMM22 0x22 /* immediate22 S + A */
-#define R_IA_64_IMM64 0x23 /* immediate64 S + A */
-#define R_IA_64_DIR32MSB 0x24 /* word32 MSB S + A */
-#define R_IA_64_DIR32LSB 0x25 /* word32 LSB S + A */
-#define R_IA_64_DIR64MSB 0x26 /* word64 MSB S + A */
-#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */
-#define R_IA_64_GPREL22 0x2a /* immediate22 @gprel(S + A) */
-#define R_IA_64_GPREL64I 0x2b /* immediate64 @gprel(S + A) */
-#define R_IA_64_GPREL32MSB 0x2c /* word32 MSB @gprel(S + A) */
-#define R_IA_64_GPREL32LSB 0x2d /* word32 LSB @gprel(S + A) */
-#define R_IA_64_GPREL64MSB 0x2e /* word64 MSB @gprel(S + A) */
-#define R_IA_64_GPREL64LSB 0x2f /* word64 LSB @gprel(S + A) */
-#define R_IA_64_LTOFF22 0x32 /* immediate22 @ltoff(S + A) */
-#define R_IA_64_LTOFF64I 0x33 /* immediate64 @ltoff(S + A) */
-#define R_IA_64_PLTOFF22 0x3a /* immediate22 @pltoff(S + A) */
-#define R_IA_64_PLTOFF64I 0x3b /* immediate64 @pltoff(S + A) */
-#define R_IA_64_PLTOFF64MSB 0x3e /* word64 MSB @pltoff(S + A) */
-#define R_IA_64_PLTOFF64LSB 0x3f /* word64 LSB @pltoff(S + A) */
-#define R_IA_64_FPTR64I 0x43 /* immediate64 @fptr(S + A) */
-#define R_IA_64_FPTR32MSB 0x44 /* word32 MSB @fptr(S + A) */
-#define R_IA_64_FPTR32LSB 0x45 /* word32 LSB @fptr(S + A) */
-#define R_IA_64_FPTR64MSB 0x46 /* word64 MSB @fptr(S + A) */
-#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */
-#define R_IA_64_PCREL60B 0x48 /* immediate60 form1 S + A - P */
-#define R_IA_64_PCREL21B 0x49 /* immediate21 form1 S + A - P */
-#define R_IA_64_PCREL21M 0x4a /* immediate21 form2 S + A - P */
-#define R_IA_64_PCREL21F 0x4b /* immediate21 form3 S + A - P */
-#define R_IA_64_PCREL32MSB 0x4c /* word32 MSB S + A - P */
-#define R_IA_64_PCREL32LSB 0x4d /* word32 LSB S + A - P */
-#define R_IA_64_PCREL64MSB 0x4e /* word64 MSB S + A - P */
-#define R_IA_64_PCREL64LSB 0x4f /* word64 LSB S + A - P */
-#define R_IA_64_LTOFF_FPTR22 0x52 /* immediate22 @ltoff(@fptr(S + A)) */
-#define R_IA_64_LTOFF_FPTR64I 0x53 /* immediate64 @ltoff(@fptr(S + A)) */
-#define R_IA_64_LTOFF_FPTR32MSB 0x54 /* word32 MSB @ltoff(@fptr(S + A)) */
-#define R_IA_64_LTOFF_FPTR32LSB 0x55 /* word32 LSB @ltoff(@fptr(S + A)) */
-#define R_IA_64_LTOFF_FPTR64MSB 0x56 /* word64 MSB @ltoff(@fptr(S + A)) */
-#define R_IA_64_LTOFF_FPTR64LSB 0x57 /* word64 LSB @ltoff(@fptr(S + A)) */
-#define R_IA_64_SEGREL32MSB 0x5c /* word32 MSB @segrel(S + A) */
-#define R_IA_64_SEGREL32LSB 0x5d /* word32 LSB @segrel(S + A) */
-#define R_IA_64_SEGREL64MSB 0x5e /* word64 MSB @segrel(S + A) */
-#define R_IA_64_SEGREL64LSB 0x5f /* word64 LSB @segrel(S + A) */
-#define R_IA_64_SECREL32MSB 0x64 /* word32 MSB @secrel(S + A) */
-#define R_IA_64_SECREL32LSB 0x65 /* word32 LSB @secrel(S + A) */
-#define R_IA_64_SECREL64MSB 0x66 /* word64 MSB @secrel(S + A) */
-#define R_IA_64_SECREL64LSB 0x67 /* word64 LSB @secrel(S + A) */
-#define R_IA_64_REL32MSB 0x6c /* word32 MSB BD + A */
-#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */
-#define R_IA_64_REL64MSB 0x6e /* word64 MSB BD + A */
-#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */
-#define R_IA_64_LTV32MSB 0x74 /* word32 MSB S + A */
-#define R_IA_64_LTV32LSB 0x75 /* word32 LSB S + A */
-#define R_IA_64_LTV64MSB 0x76 /* word64 MSB S + A */
-#define R_IA_64_LTV64LSB 0x77 /* word64 LSB S + A */
-#define R_IA_64_PCREL21BI 0x79 /* immediate21 form1 S + A - P */
-#define R_IA_64_PCREL22 0x7a /* immediate22 S + A - P */
-#define R_IA_64_PCREL64I 0x7b /* immediate64 S + A - P */
-#define R_IA_64_IPLTMSB 0x80 /* function descriptor MSB special */
-#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */
-#define R_IA_64_SUB 0x85 /* immediate64 A - S */
-#define R_IA_64_LTOFF22X 0x86 /* immediate22 special */
-#define R_IA_64_LDXMOV 0x87 /* immediate22 special */
-#define R_IA_64_TPREL14 0x91 /* imm14 @tprel(S + A) */
-#define R_IA_64_TPREL22 0x92 /* imm22 @tprel(S + A) */
-#define R_IA_64_TPREL64I 0x93 /* imm64 @tprel(S + A) */
-#define R_IA_64_TPREL64MSB 0x96 /* word64 MSB @tprel(S + A) */
-#define R_IA_64_TPREL64LSB 0x97 /* word64 LSB @tprel(S + A) */
-#define R_IA_64_LTOFF_TPREL22 0x9a /* imm22 @ltoff(@tprel(S+A)) */
-#define R_IA_64_DTPMOD64MSB 0xa6 /* word64 MSB @dtpmod(S + A) */
-#define R_IA_64_DTPMOD64LSB 0xa7 /* word64 LSB @dtpmod(S + A) */
-#define R_IA_64_LTOFF_DTPMOD22 0xaa /* imm22 @ltoff(@dtpmod(S+A)) */
-#define R_IA_64_DTPREL14 0xb1 /* imm14 @dtprel(S + A) */
-#define R_IA_64_DTPREL22 0xb2 /* imm22 @dtprel(S + A) */
-#define R_IA_64_DTPREL64I 0xb3 /* imm64 @dtprel(S + A) */
-#define R_IA_64_DTPREL32MSB 0xb4 /* word32 MSB @dtprel(S + A) */
-#define R_IA_64_DTPREL32LSB 0xb5 /* word32 LSB @dtprel(S + A) */
-#define R_IA_64_DTPREL64MSB 0xb6 /* word64 MSB @dtprel(S + A) */
-#define R_IA_64_DTPREL64LSB 0xb7 /* word64 LSB @dtprel(S + A) */
-#define R_IA_64_LTOFF_DTPREL22 0xba /* imm22 @ltoff(@dtprel(S+A)) */
-
-#define R_PPC_NONE 0 /* No relocation. */
-#define R_PPC_ADDR32 1
-#define R_PPC_ADDR24 2
-#define R_PPC_ADDR16 3
-#define R_PPC_ADDR16_LO 4
-#define R_PPC_ADDR16_HI 5
-#define R_PPC_ADDR16_HA 6
-#define R_PPC_ADDR14 7
-#define R_PPC_ADDR14_BRTAKEN 8
-#define R_PPC_ADDR14_BRNTAKEN 9
-#define R_PPC_REL24 10
-#define R_PPC_REL14 11
-#define R_PPC_REL14_BRTAKEN 12
-#define R_PPC_REL14_BRNTAKEN 13
-#define R_PPC_GOT16 14
-#define R_PPC_GOT16_LO 15
-#define R_PPC_GOT16_HI 16
-#define R_PPC_GOT16_HA 17
-#define R_PPC_PLTREL24 18
-#define R_PPC_COPY 19
-#define R_PPC_GLOB_DAT 20
-#define R_PPC_JMP_SLOT 21
-#define R_PPC_RELATIVE 22
-#define R_PPC_LOCAL24PC 23
-#define R_PPC_UADDR32 24
-#define R_PPC_UADDR16 25
-#define R_PPC_REL32 26
-#define R_PPC_PLT32 27
-#define R_PPC_PLTREL32 28
-#define R_PPC_PLT16_LO 29
-#define R_PPC_PLT16_HI 30
-#define R_PPC_PLT16_HA 31
-#define R_PPC_SDAREL16 32
-#define R_PPC_SECTOFF 33
-#define R_PPC_SECTOFF_LO 34
-#define R_PPC_SECTOFF_HI 35
-#define R_PPC_SECTOFF_HA 36
-
-/*
- * TLS relocations
- */
-#define R_PPC_TLS 67
-#define R_PPC_DTPMOD32 68
-#define R_PPC_TPREL16 69
-#define R_PPC_TPREL16_LO 70
-#define R_PPC_TPREL16_HI 71
-#define R_PPC_TPREL16_HA 72
-#define R_PPC_TPREL32 73
-#define R_PPC_DTPREL16 74
-#define R_PPC_DTPREL16_LO 75
-#define R_PPC_DTPREL16_HI 76
-#define R_PPC_DTPREL16_HA 77
-#define R_PPC_DTPREL32 78
-#define R_PPC_GOT_TLSGD16 79
-#define R_PPC_GOT_TLSGD16_LO 80
-#define R_PPC_GOT_TLSGD16_HI 81
-#define R_PPC_GOT_TLSGD16_HA 82
-#define R_PPC_GOT_TLSLD16 83
-#define R_PPC_GOT_TLSLD16_LO 84
-#define R_PPC_GOT_TLSLD16_HI 85
-#define R_PPC_GOT_TLSLD16_HA 86
-#define R_PPC_GOT_TPREL16 87
-#define R_PPC_GOT_TPREL16_LO 88
-#define R_PPC_GOT_TPREL16_HI 89
-#define R_PPC_GOT_TPREL16_HA 90
-
-/*
- * The remaining relocs are from the Embedded ELF ABI, and are not in the
- * SVR4 ELF ABI.
- */
-
-#define R_PPC_EMB_NADDR32 101
-#define R_PPC_EMB_NADDR16 102
-#define R_PPC_EMB_NADDR16_LO 103
-#define R_PPC_EMB_NADDR16_HI 104
-#define R_PPC_EMB_NADDR16_HA 105
-#define R_PPC_EMB_SDAI16 106
-#define R_PPC_EMB_SDA2I16 107
-#define R_PPC_EMB_SDA2REL 108
-#define R_PPC_EMB_SDA21 109
-#define R_PPC_EMB_MRKREF 110
-#define R_PPC_EMB_RELSEC16 111
-#define R_PPC_EMB_RELST_LO 112
-#define R_PPC_EMB_RELST_HI 113
-#define R_PPC_EMB_RELST_HA 114
-#define R_PPC_EMB_BIT_FLD 115
-#define R_PPC_EMB_RELSDA 116
-
-#define R_SPARC_NONE 0
-#define R_SPARC_8 1
-#define R_SPARC_16 2
-#define R_SPARC_32 3
-#define R_SPARC_DISP8 4
-#define R_SPARC_DISP16 5
-#define R_SPARC_DISP32 6
-#define R_SPARC_WDISP30 7
-#define R_SPARC_WDISP22 8
-#define R_SPARC_HI22 9
-#define R_SPARC_22 10
-#define R_SPARC_13 11
-#define R_SPARC_LO10 12
-#define R_SPARC_GOT10 13
-#define R_SPARC_GOT13 14
-#define R_SPARC_GOT22 15
-#define R_SPARC_PC10 16
-#define R_SPARC_PC22 17
-#define R_SPARC_WPLT30 18
-#define R_SPARC_COPY 19
-#define R_SPARC_GLOB_DAT 20
-#define R_SPARC_JMP_SLOT 21
-#define R_SPARC_RELATIVE 22
-#define R_SPARC_UA32 23
-#define R_SPARC_PLT32 24
-#define R_SPARC_HIPLT22 25
-#define R_SPARC_LOPLT10 26
-#define R_SPARC_PCPLT32 27
-#define R_SPARC_PCPLT22 28
-#define R_SPARC_PCPLT10 29
-#define R_SPARC_10 30
-#define R_SPARC_11 31
-#define R_SPARC_64 32
-#define R_SPARC_OLO10 33
-#define R_SPARC_HH22 34
-#define R_SPARC_HM10 35
-#define R_SPARC_LM22 36
-#define R_SPARC_PC_HH22 37
-#define R_SPARC_PC_HM10 38
-#define R_SPARC_PC_LM22 39
-#define R_SPARC_WDISP16 40
-#define R_SPARC_WDISP19 41
-#define R_SPARC_GLOB_JMP 42
-#define R_SPARC_7 43
-#define R_SPARC_5 44
-#define R_SPARC_6 45
-#define R_SPARC_DISP64 46
-#define R_SPARC_PLT64 47
-#define R_SPARC_HIX22 48
-#define R_SPARC_LOX10 49
-#define R_SPARC_H44 50
-#define R_SPARC_M44 51
-#define R_SPARC_L44 52
-#define R_SPARC_REGISTER 53
-#define R_SPARC_UA64 54
-#define R_SPARC_UA16 55
-#define R_SPARC_TLS_GD_HI22 56
-#define R_SPARC_TLS_GD_LO10 57
-#define R_SPARC_TLS_GD_ADD 58
-#define R_SPARC_TLS_GD_CALL 59
-#define R_SPARC_TLS_LDM_HI22 60
-#define R_SPARC_TLS_LDM_LO10 61
-#define R_SPARC_TLS_LDM_ADD 62
-#define R_SPARC_TLS_LDM_CALL 63
-#define R_SPARC_TLS_LDO_HIX22 64
-#define R_SPARC_TLS_LDO_LOX10 65
-#define R_SPARC_TLS_LDO_ADD 66
-#define R_SPARC_TLS_IE_HI22 67
-#define R_SPARC_TLS_IE_LO10 68
-#define R_SPARC_TLS_IE_LD 69
-#define R_SPARC_TLS_IE_LDX 70
-#define R_SPARC_TLS_IE_ADD 71
-#define R_SPARC_TLS_LE_HIX22 72
-#define R_SPARC_TLS_LE_LOX10 73
-#define R_SPARC_TLS_DTPMOD32 74
-#define R_SPARC_TLS_DTPMOD64 75
-#define R_SPARC_TLS_DTPOFF32 76
-#define R_SPARC_TLS_DTPOFF64 77
-#define R_SPARC_TLS_TPOFF32 78
-#define R_SPARC_TLS_TPOFF64 79
-
-#define R_X86_64_NONE 0 /* No relocation. */
-#define R_X86_64_64 1 /* Add 64 bit symbol value. */
-#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
-#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
-#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
-#define R_X86_64_COPY 5 /* Copy data from shared object. */
-#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
-#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
-#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
-#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
-#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
-#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
-#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
-#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
-#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
-#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
-#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
-#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
-#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
-#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
-#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
-#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
-#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
-#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
-
-
-#endif /* !_SYS_ELF_COMMON_H_ */
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c
deleted file mode 100644
index 72c62d7f10..0000000000
--- a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-* Main file supporting the Monitor World on ARM PLatforms
-*
-* Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-VOID
-ArmSecureMonitorWorldInitialize (
- VOID
- )
-{
- // Do not touch the EL3 Exception Vector Table Register.
- // The default default DebugAgentLib could have already set its own vector
- // into EL3 to catch abort exceptions.
-}
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c
deleted file mode 100644
index 1f950d78f1..0000000000
--- a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/** @file
-* Main file supporting the Monitor World on ARM PLatforms
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmLib.h>
-#include <Library/ArmTrustedMonitorLib.h>
-#include <Library/DebugLib.h>
-
-#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0)
-
-VOID
-MonitorVectorTable (
- VOID
- );
-
-VOID
-ArmSecureMonitorWorldInitialize (
- VOID
- )
-{
- // Ensure the Monitor Table is 32bit aligned
- ASSERT (((UINTN)&MonitorVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0);
-
- // Write the Monitor Mode Vector Table Address
- ArmWriteMVBar ((UINTN) &MonitorVectorTable);
-}
-
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S
deleted file mode 100644
index 3e75bee505..0000000000
--- a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright (c) 2011, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <AutoGen.h>
-#include <Library/PcdLib.h>
-
-.text
-.align 5
-
-GCC_ASM_EXPORT(MonitorVectorTable)
-
-ASM_PFX(MonitorVectorTable):
-
-_MonitorResetEntry:
- b _MonitorResetEntry
-_MonitorUndefinedEntry:
- b _MonitorUndefinedEntry
-_MonitorSmcEntry:
- b _MonitorSmcEntry
-_MonitorPrefetchEntry:
- b _MonitorPrefetchEntry
-_MonitorDataAbortEntry:
- b _MonitorDataAbortEntry
-_MonitorReservedEntry:
- b _MonitorReservedEntry
-_MonitorIrqEntry:
- b _MonitorIrqEntry
-_MonitorFiqEntry:
- b _MonitorFiqEntry
-
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm
deleted file mode 100644
index f4f515d05c..0000000000
--- a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright (c) 2011, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <Library/PcdLib.h>
-
- EXPORT MonitorVectorTable
-
- PRESERVE8
- AREA MonitoVectorTableArea, CODE, READONLY, CODEALIGN, ALIGN=5
-
-MonitorVectorTable
-
-_MonitorResetEntry
- b _MonitorResetEntry
-_MonitorUndefinedEntry
- b _MonitorUndefinedEntry
-_MonitorSmcEntry
- b _MonitorSmcEntry
-_MonitorPrefetchEntry
- b _MonitorPrefetchEntry
-_MonitorDataAbortEntry
- b _MonitorDataAbortEntry
-_MonitorReservedEntry
- b _MonitorReservedEntry
-_MonitorIrqEntry
- b _MonitorIrqEntry
-_MonitorFiqEntry
- b _MonitorFiqEntry
-
- END
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf
deleted file mode 100644
index 505d2ec0c0..0000000000
--- a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmTrustedMonitorLibNull
- FILE_GUID = c4b50eb2-ed16-4283-a5b0-a7341c3f997b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmTrustedMonitorLib
-
-[Sources.ARM]
- Arm/ArmTrustedMonitorLibNull.c
- Arm/MonitorTable.asm | RVCT
- Arm/MonitorTable.S | GCC
-
-[Sources.AARCH64]
- AArch64/ArmTrustedMonitorLibNull.c
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- ArmLib
- BaseLib
- DebugLib
- PcdLib
-
diff --git a/ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.c b/ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.c
deleted file mode 100755
index a452e38751..0000000000
--- a/ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-
-#include <Library/ArmLib.h>
-#include <Library/ArmGicLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/ArmPlatformSecLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/PrintLib.h>
-#include <Library/SerialPortLib.h>
-
-// When the firmware is built as not Standalone, the secondary cores need to wait the firmware
-// entirely written into DRAM. It is the firmware from DRAM which will wake up the secondary cores.
-VOID
-NonSecureWaitForFirmware (
- VOID
- )
-{
- VOID (*SecondaryStart)(VOID);
- UINTN AcknowledgeInterrupt;
- UINTN InterruptId;
-
- // The secondary cores will execute the firmware once wake from WFI.
- SecondaryStart = (VOID (*)())(UINTN)PcdGet64 (PcdFvBaseAddress);
-
- ArmCallWFI ();
-
- // Acknowledge the interrupt and send End of Interrupt signal.
- AcknowledgeInterrupt = ArmGicAcknowledgeInterrupt (PcdGet32 (PcdGicInterruptInterfaceBase), &InterruptId);
- // Check if it is a valid interrupt ID
- if (InterruptId < ArmGicGetMaxNumInterrupts (PcdGet32 (PcdGicDistributorBase))) {
- // Got a valid SGI number hence signal End of Interrupt
- ArmGicEndOfInterrupt (PcdGet32 (PcdGicInterruptInterfaceBase), AcknowledgeInterrupt);
- }
-
- // Jump to secondary core entry point.
- SecondaryStart ();
-
- // PEI Core should always load and never return
- ASSERT (FALSE);
-}
-
-/**
- Call before jumping to Normal World
-
- This function allows the firmware platform to do extra actions before
- jumping to the Normal World
-
-**/
-VOID
-ArmPlatformSecExtraAction (
- IN UINTN MpId,
- OUT UINTN* JumpAddress
- )
-{
- CHAR8 Buffer[100];
- UINTN CharCount;
- UINTN* StartAddress;
-
- if (FeaturePcdGet (PcdStandalone) == FALSE) {
-
- //
- // Warning: This code assumes the DRAM has already been initialized by ArmPlatformSecLib
- //
-
- if (ArmPlatformIsPrimaryCore (MpId)) {
- StartAddress = (UINTN*)(UINTN)PcdGet64 (PcdFvBaseAddress);
-
- // Patch the DRAM to make an infinite loop at the start address
- *StartAddress = 0xEAFFFFFE; // opcode for while(1)
-
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Waiting for firmware at 0x%08X ...\n\r",StartAddress);
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
-
- *JumpAddress = PcdGet64 (PcdFvBaseAddress);
- } else {
- // When the primary core is stopped by the hardware debugger to copy the firmware
- // into DRAM. The secondary cores are still running. As soon as the first bytes of
- // the firmware are written into DRAM, the secondary cores will start to execute the
- // code even if the firmware is not entirely written into the memory.
- // That's why the secondary cores need to be parked in WFI and wake up once the
- // firmware is ready.
-
- *JumpAddress = (UINTN)NonSecureWaitForFirmware;
- }
- } else if (FeaturePcdGet (PcdSystemMemoryInitializeInSec)) {
-
- //
- // Warning: This code assumes the DRAM has already been initialized by ArmPlatformSecLib
- //
-
- if (ArmPlatformIsPrimaryCore (MpId)) {
- // Signal the secondary cores they can jump to PEI phase
- ArmGicSendSgiTo (PcdGet32 (PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId));
-
- // To enter into Non Secure state, we need to make a return from exception
- *JumpAddress = PcdGet64 (PcdFvBaseAddress);
- } else {
- // We wait for the primary core to finish to initialize the System Memory. Otherwise the secondary
- // cores would make crash the system by setting their stacks in DRAM before the primary core has not
- // finished to initialize the system memory.
- *JumpAddress = (UINTN)NonSecureWaitForFirmware;
- }
- } else {
- *JumpAddress = PcdGet64 (PcdFvBaseAddress);
- }
-}
diff --git a/ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf b/ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf
deleted file mode 100755
index b058f367a5..0000000000
--- a/ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf
+++ /dev/null
@@ -1,54 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DebugSecExtraActionLib
- FILE_GUID = 8fff7a60-a6f8-11e0-990a-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = ArmPlatformSecExtraActionLib
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = ARM
-#
-
-[Sources.common]
- DebugSecExtraActionLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmPlatformLib
- DebugLib
- PcdLib
- ArmGicLib
- PrintLib
- SerialPortLib
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdStandalone
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFvBaseAddress
-
- gArmTokenSpaceGuid.PcdGicDistributorBase
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
- gArmTokenSpaceGuid.PcdGicSgiIntId
diff --git a/ArmPlatformPkg/Library/EblCmdLib/AArch64/EblCmdMmu.c b/ArmPlatformPkg/Library/EblCmdLib/AArch64/EblCmdMmu.c
deleted file mode 100644
index 169267576b..0000000000
--- a/ArmPlatformPkg/Library/EblCmdLib/AArch64/EblCmdMmu.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiDxe.h>
-#include <Library/UefiLib.h>
-#include <Library/ArmLib.h>
-#include <Chipset/AArch64.h>
-#include <Library/CacheMaintenanceLib.h>
-#include <Library/EblCmdLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-
-EFI_STATUS
-EblDumpMmu (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- AsciiPrint ("\nNot supported on this platform.\n");
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c b/ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c
deleted file mode 100644
index fe9d3eae14..0000000000
--- a/ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiDxe.h>
-#include <Library/UefiLib.h>
-#include <Library/ArmLib.h>
-#include <Chipset/ArmV7.h>
-#include <Library/CacheMaintenanceLib.h>
-#include <Library/EblCmdLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-
-#define GET_TT_ATTRIBUTES(TTEntry) ((TTEntry) & ~(TT_DESCRIPTOR_SECTION_BASE_ADDRESS_MASK))
-#define GET_TT_PAGE_ATTRIBUTES(TTEntry) ((TTEntry) & 0xFFF)
-#define GET_TT_LARGEPAGE_ATTRIBUTES(TTEntry) ((TTEntry) & 0xFFFF)
-
-// Section
-#define TT_DESCRIPTOR_SECTION_STRONGLY_ORDER (TT_DESCRIPTOR_SECTION_TYPE_SECTION | \
- TT_DESCRIPTOR_SECTION_NG_GLOBAL | \
- TT_DESCRIPTOR_SECTION_S_NOT_SHARED | \
- TT_DESCRIPTOR_SECTION_DOMAIN(0) | \
- TT_DESCRIPTOR_SECTION_AP_RW_RW | \
- TT_DESCRIPTOR_SECTION_CACHE_POLICY_STRONGLY_ORDERED)
-
-// Small Page
-#define TT_DESCRIPTOR_PAGE_STRONGLY_ORDER (TT_DESCRIPTOR_PAGE_TYPE_PAGE | \
- TT_DESCRIPTOR_PAGE_NG_GLOBAL | \
- TT_DESCRIPTOR_PAGE_S_NOT_SHARED | \
- TT_DESCRIPTOR_PAGE_AP_RW_RW | \
- TT_DESCRIPTOR_PAGE_CACHE_POLICY_STRONGLY_ORDERED)
-
-// Large Page
-#define TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK (TT_DESCRIPTOR_PAGE_TYPE_LARGEPAGE | \
- TT_DESCRIPTOR_PAGE_NG_GLOBAL | \
- TT_DESCRIPTOR_PAGE_S_NOT_SHARED | \
- TT_DESCRIPTOR_PAGE_AP_RW_RW | \
- TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_BACK_ALLOC)
-#define TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH (TT_DESCRIPTOR_PAGE_TYPE_LARGEPAGE | \
- TT_DESCRIPTOR_PAGE_NG_GLOBAL | \
- TT_DESCRIPTOR_PAGE_S_NOT_SHARED | \
- TT_DESCRIPTOR_PAGE_AP_RW_RW | \
- TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_THROUGH_NO_ALLOC)
-#define TT_DESCRIPTOR_LARGEPAGE_DEVICE (TT_DESCRIPTOR_PAGE_TYPE_LARGEPAGE | \
- TT_DESCRIPTOR_PAGE_NG_GLOBAL | \
- TT_DESCRIPTOR_PAGE_S_NOT_SHARED | \
- TT_DESCRIPTOR_PAGE_AP_RW_RW | \
- TT_DESCRIPTOR_SECTION_CACHE_POLICY_SHAREABLE_DEVICE)
-#define TT_DESCRIPTOR_LARGEPAGE_UNCACHED (TT_DESCRIPTOR_PAGE_TYPE_LARGEPAGE | \
- TT_DESCRIPTOR_PAGE_NG_GLOBAL | \
- TT_DESCRIPTOR_PAGE_S_NOT_SHARED | \
- TT_DESCRIPTOR_PAGE_AP_RW_RW | \
- TT_DESCRIPTOR_SECTION_CACHE_POLICY_NON_CACHEABLE)
-
-
-typedef enum { Level0, Level1,Level2 } MMU_LEVEL;
-
-typedef struct {
- MMU_LEVEL Level;
- UINT32 Value;
- UINT32 Index;
- UINT32* Table;
-} MMU_ENTRY;
-
-MMU_ENTRY
-MmuEntryCreate (
- IN MMU_LEVEL Level,
- IN UINT32* Table,
- IN UINT32 Index
- )
-{
- MMU_ENTRY Entry;
- Entry.Level = Level;
- Entry.Value = Table[Index];
- Entry.Table = Table;
- Entry.Index = Index;
- return Entry;
-}
-
-UINT32
-MmuEntryIsValidAddress (
- IN MMU_LEVEL Level,
- IN UINT32 Entry
- )
-{
- if (Level == Level0) {
- return 0;
- } else if (Level == Level1) {
- if ((Entry & 0x3) == 0) { // Ignored
- return 0;
- } else if ((Entry & 0x3) == 2) { // Section Type
- return 1;
- } else { // Page Type
- return 0;
- }
- } else if (Level == Level2){
- if ((Entry & 0x3) == 0) { // Ignored
- return 0;
- } else { // Page Type
- return 1;
- }
- } else {
- DEBUG((EFI_D_ERROR,"MmuEntryIsValidAddress: Level:%d Entry:0x%X\n",(UINT32)Level,(UINT32)Entry));
- ASSERT(0);
- return 0;
- }
-}
-
-UINT32
-MmuEntryGetAddress (
- IN MMU_ENTRY Entry
- )
-{
- if (Entry.Level == Level1) {
- if ((Entry.Value & 0x3) == 0) {
- return 0;
- } else if ((Entry.Value & 0x3) == 2) { // Section Type
- return Entry.Value & TT_DESCRIPTOR_SECTION_BASE_ADDRESS_MASK;
- } else if ((Entry.Value & 0x3) == 1) { // Level2 Table
- MMU_ENTRY Level2Entry = MmuEntryCreate (Level2,(UINT32*)(Entry.Value & 0xFFFFC000),0);
- return MmuEntryGetAddress (Level2Entry);
- } else { // Page Type
- return 0;
- }
- } else if (Entry.Level == Level2) {
- if ((Entry.Value & 0x3) == 0) { // Ignored
- return 0;
- } else if ((Entry.Value & 0x3) == 1) { // Large Page
- return Entry.Value & 0xFFFF0000;
- } else if ((Entry.Value & 0x2) == 2) { // Small Page
- return Entry.Value & 0xFFFFF000;
- } else {
- return 0;
- }
- } else {
- ASSERT(0);
- return 0;
- }
-}
-
-UINT32
-MmuEntryGetSize (
- IN MMU_ENTRY Entry
- )
-{
- if (Entry.Level == Level1) {
- if ((Entry.Value & 0x3) == 0) {
- return 0;
- } else if ((Entry.Value & 0x3) == 2) {
- if (Entry.Value & (1 << 18))
- return 16*SIZE_1MB;
- else
- return SIZE_1MB;
- } else if ((Entry.Value & 0x3) == 1) { // Level2 Table split 1MB section
- return SIZE_1MB;
- } else {
- DEBUG((EFI_D_ERROR, "MmuEntryGetSize: Value:0x%X",Entry.Value));
- ASSERT(0);
- return 0;
- }
- } else if (Entry.Level == Level2) {
- if ((Entry.Value & 0x3) == 0) { // Ignored
- return 0;
- } else if ((Entry.Value & 0x3) == 1) { // Large Page
- return SIZE_64KB;
- } else if ((Entry.Value & 0x2) == 2) { // Small Page
- return SIZE_4KB;
- } else {
- ASSERT(0);
- return 0;
- }
- } else {
- ASSERT(0);
- return 0;
- }
-}
-
-CONST CHAR8*
-MmuEntryGetAttributesName (
- IN MMU_ENTRY Entry
- )
-{
- UINT32 Value;
-
- if (Entry.Level == Level1) {
- Value = GET_TT_ATTRIBUTES(Entry.Value) | TT_DESCRIPTOR_SECTION_NS_MASK;
- if (Value == TT_DESCRIPTOR_SECTION_WRITE_BACK(0))
- return "TT_DESCRIPTOR_SECTION_WRITE_BACK";
- else if (Value == TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0))
- return "TT_DESCRIPTOR_SECTION_WRITE_THROUGH";
- else if (Value == TT_DESCRIPTOR_SECTION_DEVICE(0))
- return "TT_DESCRIPTOR_SECTION_DEVICE";
- else if (Value == TT_DESCRIPTOR_SECTION_UNCACHED(0))
- return "TT_DESCRIPTOR_SECTION_UNCACHED";
- else if (Value == TT_DESCRIPTOR_SECTION_STRONGLY_ORDER)
- return "TT_DESCRIPTOR_SECTION_STRONGLY_ORDERED";
- else {
- return "SectionUnknown";
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x2) == 2)) { //Small Page
- Value = GET_TT_PAGE_ATTRIBUTES(Entry.Value);
- if (Value == TT_DESCRIPTOR_PAGE_WRITE_BACK)
- return "TT_DESCRIPTOR_PAGE_WRITE_BACK";
- else if (Value == TT_DESCRIPTOR_PAGE_WRITE_THROUGH)
- return "TT_DESCRIPTOR_PAGE_WRITE_THROUGH";
- else if (Value == TT_DESCRIPTOR_PAGE_DEVICE)
- return "TT_DESCRIPTOR_PAGE_DEVICE";
- else if (Value == TT_DESCRIPTOR_PAGE_UNCACHED)
- return "TT_DESCRIPTOR_PAGE_UNCACHED";
- else if (Value == TT_DESCRIPTOR_PAGE_STRONGLY_ORDER)
- return "TT_DESCRIPTOR_PAGE_STRONGLY_ORDERED";
- else {
- return "PageUnknown";
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x3) == 1)) { //Large Page
- Value = GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value);
- if (Value == TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK)
- return "TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK";
- else if (Value == TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH)
- return "TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH";
- else if (Value == TT_DESCRIPTOR_LARGEPAGE_DEVICE)
- return "TT_DESCRIPTOR_LARGEPAGE_DEVICE";
- else if (Value == TT_DESCRIPTOR_LARGEPAGE_UNCACHED)
- return "TT_DESCRIPTOR_LARGEPAGE_UNCACHED";
- else {
- return "LargePageUnknown";
- }
- } else {
- ASSERT(0);
- return "";
- }
-}
-
-UINT32
-MmuEntryGetAttributes (
- IN MMU_ENTRY Entry
- )
-{
- if (Entry.Level == Level1) {
- if ((Entry.Value & 0x3) == 0) {
- return 0;
- } else if ((Entry.Value & 0x3) == 2) {
- return GET_TT_ATTRIBUTES(Entry.Value);
- } else {
- return 0;
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x2) == 2)) { //Small Page
- if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_BACK)
- return TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_THROUGH)
- return TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_DEVICE)
- return TT_DESCRIPTOR_SECTION_DEVICE(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_UNCACHED)
- return TT_DESCRIPTOR_SECTION_UNCACHED(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_STRONGLY_ORDER)
- return TT_DESCRIPTOR_SECTION_STRONGLY_ORDER;
- else {
- return 0;
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x3) == 1)) { //Large Page
- if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK)
- return TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH)
- return TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_DEVICE)
- return TT_DESCRIPTOR_SECTION_DEVICE(0);
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_UNCACHED)
- return TT_DESCRIPTOR_SECTION_UNCACHED(0);
- else {
- return 0;
- }
- } else {
- return 0;
- }
-}
-
-
-MMU_ENTRY
-DumpMmuLevel (
- IN MMU_LEVEL Level,
- IN UINT32* Table,
- IN MMU_ENTRY PreviousEntry
- )
-{
- UINT32 Index = 0, Count;
- MMU_ENTRY LastEntry, Entry;
-
- ASSERT((Level == Level1) || (Level == Level2));
-
- if (Level == Level1) Count = 4096;
- else Count = 256;
-
- // At Level1, we will get into this function because PreviousEntry is not valid
- if (!MmuEntryIsValidAddress((MMU_LEVEL)(Level-1),PreviousEntry.Value)) {
- // Find the first valid address
- for (; (Index < Count) && (!MmuEntryIsValidAddress(Level,Table[Index])); Index++);
-
- LastEntry = MmuEntryCreate(Level,Table,Index);
- Index++;
- } else {
- LastEntry = PreviousEntry;
- }
-
- for (; Index < Count; Index++) {
- Entry = MmuEntryCreate(Level,Table,Index);
- if ((Level == Level1) && ((Entry.Value & 0x3) == 1)) { // We have got a Level2 table redirection
- LastEntry = DumpMmuLevel(Level2,(UINT32*)(Entry.Value & 0xFFFFFC00),LastEntry);
- } else if (!MmuEntryIsValidAddress(Level,Table[Index])) {
- if (MmuEntryIsValidAddress(LastEntry.Level,LastEntry.Value)) {
- AsciiPrint("0x%08X-0x%08X\t%a\n",
- MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
- MmuEntryGetAttributesName(LastEntry));
- }
- LastEntry = Entry;
- } else {
- if (MmuEntryGetAttributes(LastEntry) != MmuEntryGetAttributes(Entry)) {
- if (MmuEntryIsValidAddress(Level,LastEntry.Value)) {
- AsciiPrint("0x%08X-0x%08X\t%a\n",
- MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
- MmuEntryGetAttributesName(LastEntry));
- }
- LastEntry = Entry;
- } else {
- ASSERT(LastEntry.Value != 0);
- }
- }
- PreviousEntry = Entry;
- }
-
- if ((Level == Level1) && (LastEntry.Index != Index) && MmuEntryIsValidAddress(Level,LastEntry.Value)) {
- AsciiPrint("0x%08X-0x%08X\t%a\n",
- MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
- MmuEntryGetAttributesName(LastEntry));
- }
-
- return LastEntry;
-}
-
-
-EFI_STATUS
-EblDumpMmu (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- UINT32 *TTEntry;
- MMU_ENTRY NoEntry;
-
- TTEntry = ArmGetTTBR0BaseAddress();
-
- AsciiPrint ("\nTranslation Table:0x%X\n",TTEntry);
- AsciiPrint ("Address Range\t\tAttributes\n");
- AsciiPrint ("____________________________________________________\n");
-
- NoEntry.Level = (MMU_LEVEL)200;
- DumpMmuLevel(Level1,TTEntry,NoEntry);
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
deleted file mode 100644
index 8aae7b2c4e..0000000000
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Base.h>
-#include <Uefi.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BdsLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/PrintLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiApplicationEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-
-#include <Protocol/DevicePathFromText.h>
-
-#include <Guid/ArmGlobalVariableHob.h>
-#include <Guid/Fdt.h>
-
-#include <libfdt.h>
-
-#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
-#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a))))
-#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4)))
-
-STATIC
-UINTN
-IsPrintableString (
- IN CONST VOID* data,
- IN UINTN len
- )
-{
- CONST CHAR8 *s = data;
- CONST CHAR8 *ss;
-
- // Zero length is not
- if (len == 0) {
- return 0;
- }
-
- // Must terminate with zero
- if (s[len - 1] != '\0') {
- return 0;
- }
-
- ss = s;
- while (*s/* && isprint(*s)*/) {
- s++;
- }
-
- // Not zero, or not done yet
- if (*s != '\0' || (s + 1 - ss) < len) {
- return 0;
- }
-
- return 1;
-}
-
-STATIC
-VOID
-PrintData (
- IN CONST CHAR8* data,
- IN UINTN len
- )
-{
- UINTN i;
- CONST CHAR8 *p = data;
-
- // No data, don't print
- if (len == 0)
- return;
-
- if (IsPrintableString (data, len)) {
- Print(L" = \"%a\"", (const char *)data);
- } else if ((len % 4) == 0) {
- Print(L" = <");
- for (i = 0; i < len; i += 4) {
- Print(L"0x%08x%a", fdt32_to_cpu(GET_CELL(p)),i < (len - 4) ? " " : "");
- }
- Print(L">");
- } else {
- Print(L" = [");
- for (i = 0; i < len; i++)
- Print(L"%02x%a", *p++, i < len - 1 ? " " : "");
- Print(L"]");
- }
-}
-
-VOID
-DumpFdt (
- IN VOID* FdtBlob
- )
-{
- struct fdt_header *bph;
- UINT32 off_dt;
- UINT32 off_str;
- CONST CHAR8* p_struct;
- CONST CHAR8* p_strings;
- CONST CHAR8* p;
- CONST CHAR8* s;
- CONST CHAR8* t;
- UINT32 tag;
- UINTN sz;
- UINTN depth;
- UINTN shift;
- UINT32 version;
-
- depth = 0;
- shift = 4;
-
- bph = FdtBlob;
- off_dt = fdt32_to_cpu(bph->off_dt_struct);
- off_str = fdt32_to_cpu(bph->off_dt_strings);
- p_struct = (CONST CHAR8*)FdtBlob + off_dt;
- p_strings = (CONST CHAR8*)FdtBlob + off_str;
- version = fdt32_to_cpu(bph->version);
-
- p = p_struct;
- while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
-
- if (tag == FDT_BEGIN_NODE) {
- s = p;
- p = PALIGN(p + strlen(s) + 1, 4);
-
- if (*s == '\0')
- s = "/";
-
- Print(L"%*s%a {\n", depth * shift, L" ", s);
-
- depth++;
- continue;
- }
-
- if (tag == FDT_END_NODE) {
- depth--;
-
- Print(L"%*s};\n", depth * shift, L" ");
- continue;
- }
-
- if (tag == FDT_NOP) {
- Print(L"%*s// [NOP]\n", depth * shift, L" ");
- continue;
- }
-
- if (tag != FDT_PROP) {
- Print(L"%*s ** Unknown tag 0x%08x\n", depth * shift, L" ", tag);
- break;
- }
- sz = fdt32_to_cpu(GET_CELL(p));
- s = p_strings + fdt32_to_cpu(GET_CELL(p));
- if (version < 16 && sz >= 8)
- p = PALIGN(p, 8);
- t = p;
-
- p = PALIGN(p + sz, 4);
-
- Print(L"%*s%a", depth * shift, L" ", s);
- PrintData(t, sz);
- Print(L";\n");
- }
-}
-
-EFI_STATUS
-EblDumpFdt (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- EFI_STATUS Status;
- VOID *FdtBlob;
- UINTN Ret;
-
- // If no FDT file is passed to the argument then get the one from the platform
- if (Argc < 2) {
- Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, &FdtBlob);
- if (EFI_ERROR (Status)) {
- Print (L"ERROR: Did not find the Fdt Blob.\n");
- return Status;
- }
- } else {
- return EFI_NOT_FOUND;
- }
-
- Ret = fdt_check_header (FdtBlob);
- if (Ret != 0) {
- Print (L"ERROR: Device Tree header not valid (err:%d)\n", Ret);
- return EFI_INVALID_PARAMETER;
- }
-
- DumpFdt (FdtBlob);
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c
deleted file mode 100644
index 4a5f2be394..0000000000
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiDxe.h>
-#include <Library/ArmLib.h>
-#include <Library/CacheMaintenanceLib.h>
-#include <Library/EblCmdLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiLib.h>
-#include <Library/PcdLib.h>
-#include <Library/EfiFileLib.h>
-#include <Library/ArmDisassemblerLib.h>
-#include <Library/PeCoffGetEntryPointLib.h>
-#include <Library/PerformanceLib.h>
-#include <Library/TimerLib.h>
-#include <Library/BdsLib.h>
-
-#include <Guid/DebugImageInfoTable.h>
-
-#include <Protocol/DebugSupport.h>
-#include <Protocol/LoadedImage.h>
-#include <Protocol/DevicePathToText.h>
-
-EFI_STATUS
-EblDumpMmu (
- IN UINTN Argc,
- IN CHAR8 **Argv
- );
-
-EFI_STATUS
-EblDumpFdt (
- IN UINTN Argc,
- IN CHAR8 **Argv
- );
-
-/**
- Simple arm disassembler via a library
-
- Argv[0] - symboltable
- Argv[1] - Optional qoted format string
- Argv[2] - Optional flag
-
- @param Argc Number of command arguments in Argv
- @param Argv Array of strings that represent the parsed command line.
- Argv[0] is the command name
-
- @return EFI_SUCCESS
-
-**/
-EFI_STATUS
-EblSymbolTable (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- EFI_STATUS Status;
- EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *DebugImageTableHeader = NULL;
- EFI_DEBUG_IMAGE_INFO *DebugTable;
- UINTN Entry;
- CHAR8 *Format;
- CHAR8 *Pdb;
- UINT32 PeCoffSizeOfHeaders;
- UINT32 ImageBase;
- BOOLEAN Elf;
-
- // Need to add lots of error checking on the passed in string
- // Default string is for RealView debugger
-#if (__ARMCC_VERSION < 500000)
- Format = (Argc > 1) ? Argv[1] : "load /a /ni /np %a &0x%x";
-#else
- Format = (Argc > 1) ? Argv[1] : "add-symbol-file %a 0x%x";
-#endif
- Elf = (Argc > 2) ? FALSE : TRUE;
-
- Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&DebugImageTableHeader);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- DebugTable = DebugImageTableHeader->EfiDebugImageInfoTable;
- if (DebugTable == NULL) {
- return EFI_SUCCESS;
- }
-
- for (Entry = 0; Entry < DebugImageTableHeader->TableSize; Entry++, DebugTable++) {
- if (DebugTable->NormalImage != NULL) {
- if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) && (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
- ImageBase = (UINTN)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
- PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)ImageBase);
- Pdb = PeCoffLoaderGetPdbPointer (DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase);
- if (Pdb != NULL) {
- if (Elf) {
- // ELF and Mach-O images don't include the header so the linked address does not include header
- ImageBase += PeCoffSizeOfHeaders;
- }
- AsciiPrint (Format, Pdb, ImageBase);
- AsciiPrint ("\n");
- } else {
- }
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Simple arm disassembler via a library
-
- Argv[0] - disasm
- Argv[1] - Address to start disassembling from
- ARgv[2] - Number of instructions to disassembly (optional)
-
- @param Argc Number of command arguments in Argv
- @param Argv Array of strings that represent the parsed command line.
- Argv[0] is the command name
-
- @return EFI_SUCCESS
-
-**/
-EFI_STATUS
-EblDisassembler (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- UINT8 *Ptr, *CurrentAddress;
- UINT32 Address;
- UINT32 Count;
- CHAR8 Buffer[80];
- UINT32 ItBlock;
-
- if (Argc < 2) {
- return EFI_INVALID_PARAMETER;
- }
-
- Address = AsciiStrHexToUintn (Argv[1]);
- Count = (Argc > 2) ? (UINT32)AsciiStrHexToUintn (Argv[2]) : 20;
-
- Ptr = (UINT8 *)(UINTN)Address;
- ItBlock = 0;
- do {
- CurrentAddress = Ptr;
- DisassembleInstruction (&Ptr, TRUE, TRUE, &ItBlock, Buffer, sizeof (Buffer));
- AsciiPrint ("0x%08x: %a\n", CurrentAddress, Buffer);
- } while (Count-- > 0);
-
-
- return EFI_SUCCESS;
-}
-
-
-CHAR8 *
-ImageHandleToPdbFileName (
- IN EFI_HANDLE Handle
- )
-{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- CHAR8 *Pdb;
- CHAR8 *StripLeading;
-
- Status = gBS->HandleProtocol (Handle, &gEfiLoadedImageProtocolGuid, (VOID **)&LoadedImage);
- if (EFI_ERROR (Status)) {
- return "";
- }
-
- Pdb = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);
- StripLeading = AsciiStrStr (Pdb, "\\ARM\\");
- if (StripLeading == NULL) {
- StripLeading = AsciiStrStr (Pdb, "/ARM/");
- if (StripLeading == NULL) {
- return Pdb;
- }
- }
- // Hopefully we hacked off the unneeded part
- return (StripLeading + 5);
-}
-
-
-STATIC CHAR8 *mTokenList[] = {
- /*"SEC",*/
- "PEI",
- "DXE",
- /*"BDS",*/
- NULL
-};
-
-/**
- Simple arm disassembler via a library
-
- Argv[0] - disasm
- Argv[1] - Address to start disassembling from
- ARgv[2] - Number of instructions to disassembly (optional)
-
- @param Argc Number of command arguments in Argv
- @param Argv Array of strings that represent the parsed command line.
- Argv[0] is the command name
-
- @return EFI_SUCCESS
-
-**/
-EFI_STATUS
-EblPerformance (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- UINTN Key;
- CONST VOID *Handle;
- CONST CHAR8 *Token, *Module;
- UINT64 Start, Stop, TimeStamp;
- UINT64 Delta, TicksPerSecond, Milliseconds, Microseconds;
- UINTN Index;
- BOOLEAN CountUp;
-
- TicksPerSecond = GetPerformanceCounterProperties (&Start, &Stop);
- if (Start < Stop) {
- CountUp = TRUE;
- } else {
- CountUp = FALSE;
- }
-
- Key = 0;
- do {
- Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);
- if (Key != 0) {
- if (AsciiStriCmp ("StartImage:", Token) == 0) {
- if (Stop == 0) {
- // The entry for EBL is still running so the stop time will be zero. Skip it
- AsciiPrint (" running %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));
- } else {
- Delta = CountUp?(Stop - Start):(Start - Stop);
- Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);
- AsciiPrint ("%10ld us %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));
- }
- }
- }
- } while (Key != 0);
-
- AsciiPrint ("\n");
-
- TimeStamp = 0;
- Key = 0;
- do {
- Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);
- if (Key != 0) {
- for (Index = 0; mTokenList[Index] != NULL; Index++) {
- if (AsciiStriCmp (mTokenList[Index], Token) == 0) {
- Delta = CountUp?(Stop - Start):(Start - Stop);
- TimeStamp += Delta;
- Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL);
- AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);
- break;
- }
- }
- }
- } while (Key != 0);
-
- AsciiPrint ("Total Time = %ld ms\n\n", DivU64x64Remainder (MultU64x32 (TimeStamp, 1000), TicksPerSecond, NULL));
-
- return EFI_SUCCESS;
-}
-
-#define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
-
-EFI_STATUS
-EblDumpGcd (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- EFI_STATUS Status;
- UINTN NumberOfDescriptors;
- UINTN i;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
- EFI_GCD_IO_SPACE_DESCRIPTOR *IoSpaceMap;
-
- Status = gDS->GetMemorySpaceMap(&NumberOfDescriptors,&MemorySpaceMap);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- AsciiPrint (" Address Range Image Device Attributes\n");
- AsciiPrint ("__________________________________________________________\n");
- for (i=0; i < NumberOfDescriptors; i++) {
- AsciiPrint ("MEM %016lx - %016lx",(UINT64)MemorySpaceMap[i].BaseAddress,MemorySpaceMap[i].BaseAddress+MemorySpaceMap[i].Length-1);
- AsciiPrint (" %08x %08x",MemorySpaceMap[i].ImageHandle,MemorySpaceMap[i].DeviceHandle);
-
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_RUNTIME)
- AsciiPrint (" RUNTIME");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_PORT_IO)
- AsciiPrint (" PORT_IO");
-
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_UC)
- AsciiPrint (" MEM_UC");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_WC)
- AsciiPrint (" MEM_WC");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_WT)
- AsciiPrint (" MEM_WT");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_WB)
- AsciiPrint (" MEM_WB");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_UCE)
- AsciiPrint (" MEM_UCE");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_WP)
- AsciiPrint (" MEM_WP");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_RP)
- AsciiPrint (" MEM_RP");
- if (MemorySpaceMap[i].Attributes & EFI_MEMORY_XP)
- AsciiPrint (" MEM_XP");
-
- switch (MemorySpaceMap[i].GcdMemoryType) {
- case EfiGcdMemoryTypeNonExistent:
- AsciiPrint (" TYPE_NONEXISTENT");
- break;
- case EfiGcdMemoryTypeReserved:
- AsciiPrint (" TYPE_RESERVED");
- break;
- case EfiGcdMemoryTypeSystemMemory:
- AsciiPrint (" TYPE_SYSMEM");
- break;
- case EfiGcdMemoryTypeMemoryMappedIo:
- AsciiPrint (" TYPE_MEMMAP");
- break;
- default:
- AsciiPrint (" TYPE_UNKNOWN");
- break;
- }
-
- AsciiPrint ("\n");
- }
-
- FreePool (MemorySpaceMap);
-
- Status = gDS->GetIoSpaceMap(&NumberOfDescriptors,&IoSpaceMap);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- for (i=0; i < NumberOfDescriptors; i++) {
- AsciiPrint ("IO %08lx - %08lx",IoSpaceMap[i].BaseAddress,IoSpaceMap[i].BaseAddress+IoSpaceMap[i].Length);
- AsciiPrint ("\t%08x %08x",IoSpaceMap[i].ImageHandle,IoSpaceMap[i].DeviceHandle);
-
- switch (IoSpaceMap[i].GcdIoType) {
- case EfiGcdIoTypeNonExistent:
- AsciiPrint (" TYPE_NONEXISTENT");
- break;
- case EfiGcdIoTypeReserved:
- AsciiPrint (" TYPE_RESERVED");
- break;
- case EfiGcdIoTypeIo:
- AsciiPrint (" TYPE_IO");
- break;
- default:
- AsciiPrint (" TYPE_UNKNOWN");
- break;
- }
-
- AsciiPrint ("\n");
- }
-
- FreePool (IoSpaceMap);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EblDevicePaths (
- IN UINTN Argc,
- IN CHAR8 **Argv
- )
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- CHAR16* String;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
-
- BdsConnectAllDrivers();
-
- Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- if (EFI_ERROR (Status)) {
- AsciiPrint ("Did not find the DevicePathToTextProtocol.\n");
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiDevicePathProtocolGuid, NULL, &HandleCount, &HandleBuffer);
- if (EFI_ERROR (Status)) {
- AsciiPrint ("No device path found\n");
- return EFI_SUCCESS;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
- String = DevicePathToTextProtocol->ConvertDevicePathToText(DevicePathProtocol,TRUE,TRUE);
- Print (L"[0x%X] %s\n",(UINTN)HandleBuffer[Index], String);
- }
-
- return EFI_SUCCESS;
-}
-
-GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =
-{
- {
- "disasm address [count]",
- " disassemble count instructions",
- NULL,
- EblDisassembler
- },
- {
- "performance",
- " Display boot performance info",
- NULL,
- EblPerformance
- },
- {
- "symboltable [\"format string\"] [PECOFF]",
- " show symbol table commands for debugger",
- NULL,
- EblSymbolTable
- },
- {
- "dumpgcd",
- " dump Global Coherency Domain",
- NULL,
- EblDumpGcd
- },
- {
- "dumpmmu",
- " dump MMU Table",
- NULL,
- EblDumpMmu
- },
- {
- "devicepaths",
- " list all the Device Paths",
- NULL,
- EblDevicePaths
- },
- {
- "dumpfdt",
- " dump the current fdt or the one defined in the arguments",
- NULL,
- EblDumpFdt
- }
-};
-
-
-VOID
-EblInitializeExternalCmd (
- VOID
- )
-{
- EblAddCommands (mLibCmdTemplate, sizeof (mLibCmdTemplate)/sizeof (EBL_COMMAND_TABLE));
- return;
-}
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
deleted file mode 100644
index c4b2ae1f64..0000000000
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
+++ /dev/null
@@ -1,64 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformEblCmdLib
- FILE_GUID = 6085e1ca-0d2d-4ba4-9872-c59b36ffd6ad
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = EblCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources.common]
- EblCmdLib.c
- EblCmdFdt.c
-
-[Sources.ARM]
- Arm/EblCmdMmu.c
-
-[Sources.AARCH64]
- AArch64/EblCmdMmu.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- BaseLib
- ArmLib
- DebugLib
- ArmDisassemblerLib
- PerformanceLib
- TimerLib
- BdsLib
- FdtLib
-
-[Protocols]
- gEfiDebugSupportProtocolGuid
- gEfiLoadedImageProtocolGuid
- gEfiDevicePathToTextProtocolGuid
-
-[Guids]
- gEfiDebugImageInfoTableGuid
- gFdtTableGuid
diff --git a/ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0Cache.c b/ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0Cache.c
deleted file mode 100644
index 3f7fd305c4..0000000000
--- a/ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0Cache.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Uefi.h>
-#include <Drivers/PL310L2Cache.h>
-
-// Initialize L2X0 Cache Controller
-VOID
-L2x0CacheInit (
- IN UINTN L2x0Base,
- IN UINT32 L2x0TagLatencies,
- IN UINT32 L2x0DataLatencies,
- IN UINT32 L2x0AuxValue,
- IN UINT32 L2x0AuxMask,
- IN BOOLEAN CacheEnabled
- )
-{
- //No implementation
-}
diff --git a/ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0CacheLibNull.inf b/ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0CacheLibNull.inf
deleted file mode 100755
index 1bced4d87f..0000000000
--- a/ArmPlatformPkg/Library/L2X0CacheLibNull/L2X0CacheLibNull.inf
+++ /dev/null
@@ -1,27 +0,0 @@
-#/* @file
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = L2X0CacheLibNull
- FILE_GUID = 9c76c900-1e8c-11e0-8766-0002a5d5c51b
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
- LIBRARY_CLASS = L2X0CacheLib
-
-[Sources]
- L2X0Cache.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
deleted file mode 100644
index 7497b5eb7f..0000000000
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/** @file
- Serial I/O Port library functions with no library constructor/destructor
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2012 - 2014, ARM Ltd. All rights reserved.<BR>
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/SerialPortLib.h>
-
-#include <Drivers/PL011Uart.h>
-
-
-/**
-
- Programmed hardware of Serial port.
-
- @return Always return RETURN_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- UINT64 BaudRate;
- UINT32 ReceiveFifoDepth;
- EFI_PARITY_TYPE Parity;
- UINT8 DataBits;
- EFI_STOP_BITS_TYPE StopBits;
-
- BaudRate = (UINTN)PcdGet64 (PcdUartDefaultBaudRate);
- ReceiveFifoDepth = 0; // Use the default value for Fifo depth
- Parity = (EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity);
- DataBits = PcdGet8 (PcdUartDefaultDataBits);
- StopBits = (EFI_STOP_BITS_TYPE) PcdGet8 (PcdUartDefaultStopBits);
-
- return PL011UartInitializePort (
- (UINTN)PcdGet64 (PcdSerialRegisterBase),
- &BaudRate, &ReceiveFifoDepth, &Parity, &DataBits, &StopBits);
-}
-
-/**
- Write data to serial device.
-
- @param Buffer Point of data buffer which need to be written.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes written to serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- return PL011UartWrite ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
-}
-
-/**
- Read data from serial device and save the data in buffer.
-
- @param Buffer Point of data buffer which need to be written.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Actual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
-}
-
-/**
- Check to see if any data is available to be read from the debug device.
-
- @retval EFI_SUCCESS At least one byte of data is available to be read
- @retval EFI_NOT_READY No data is available to be read
- @retval EFI_DEVICE_ERROR The serial device is not functioning properly
-
-**/
-BOOLEAN
-EFIAPI
-SerialPortPoll (
- VOID
- )
-{
- return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
-}
-/**
- Set new attributes to PL011.
-
- @param BaudRate The baud rate of the serial device. If the baud rate is not supported,
- the speed will be reduced down to the nearest supported one and the
- variable's value will be updated accordingly.
- @param ReceiveFifoDepth The number of characters the device will buffer on input. If the specified
- value is not supported, the variable's value will be reduced down to the
- nearest supported one.
- @param Timeout If applicable, the number of microseconds the device will wait
- before timing out a Read or a Write operation.
- @param Parity If applicable, this is the EFI_PARITY_TYPE that is computed or checked
- as each character is transmitted or received. If the device does not
- support parity, the value is the default parity value.
- @param DataBits The number of data bits in each character
- @param StopBits If applicable, the EFI_STOP_BITS_TYPE number of stop bits per character.
- If the device does not support stop bits, the value is the default stop
- bit value.
-
- @retval EFI_SUCCESS All attributes were set correctly on the serial device.
- @retval EFI_INVALID_PARAMETERS One or more of the attributes has an unsupported value.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetAttributes (
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT UINT32 *Timeout,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
- )
-{
- return PL011UartInitializePort (
- (UINTN)PcdGet64 (PcdSerialRegisterBase),
- BaudRate,
- ReceiveFifoDepth,
- Parity,
- DataBits,
- StopBits);
-}
-
-/**
-
- Assert or deassert the control signals on a serial port.
- The following control signals are set according their bit settings :
- . Request to Send
- . Data Terminal Ready
-
- @param[in] Control The following bits are taken into account :
- . EFI_SERIAL_REQUEST_TO_SEND : assert/deassert the
- "Request To Send" control signal if this bit is
- equal to one/zero.
- . EFI_SERIAL_DATA_TERMINAL_READY : assert/deassert
- the "Data Terminal Ready" control signal if this
- bit is equal to one/zero.
- . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : enable/disable
- the hardware loopback if this bit is equal to
- one/zero.
- . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : not supported.
- . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : enable/
- disable the hardware flow control based on CTS (Clear
- To Send) and RTS (Ready To Send) control signals.
-
- @retval RETURN_SUCCESS The new control bits were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
-}
-
-/**
-
- Retrieve the status of the control bits on a serial device.
-
- @param[out] Control Status of the control bits on a serial device :
-
- . EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
- EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
- EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
- are all related to the DTE (Data Terminal Equipment) and
- DCE (Data Communication Equipment) modes of operation of
- the serial device.
- . EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
- buffer is empty, 0 otherwise.
- . EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
- buffer is empty, 0 otherwise.
- . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
- hardware loopback is enabled (the output feeds the receive
- buffer), 0 otherwise.
- . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
- loopback is accomplished by software, 0 otherwise.
- . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
- hardware flow control based on CTS (Clear To Send) and RTS
- (Ready To Send) control signals is enabled, 0 otherwise.
-
- @retval RETURN_SUCCESS The control bits were read from the serial device.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
-}
diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
deleted file mode 100644
index 3a950d0788..0000000000
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+++ /dev/null
@@ -1,43 +0,0 @@
-#/** @file
-#
-# Component description file for PL011SerialPortLib module
-#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL011SerialPortLib
- FILE_GUID = 8ecefc8f-a2c4-4091-b80f-20f7aeb0567f
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SerialPortLib
-
-[Sources.common]
- PL011SerialPortLib.c
-
-[LibraryClasses]
- PL011UartLib
- PcdLib
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
deleted file mode 100644
index 52ba48992b..0000000000
--- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
+++ /dev/null
@@ -1,684 +0,0 @@
-/** @file
- Implement EFI RealTimeClock runtime services via RTC Lib.
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Uefi.h>
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/IoLib.h>
-#include <Library/RealTimeClockLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/ArmPlatformSysConfigLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiRuntimeLib.h>
-
-#include <Protocol/RealTimeClock.h>
-
-#include <Guid/GlobalVariable.h>
-#include <Guid/EventGroup.h>
-
-#include <Drivers/PL031RealTimeClock.h>
-
-#include <ArmPlatform.h>
-
-STATIC CONST CHAR16 mTimeZoneVariableName[] = L"PL031RtcTimeZone";
-STATIC CONST CHAR16 mDaylightVariableName[] = L"PL031RtcDaylight";
-STATIC BOOLEAN mPL031Initialized = FALSE;
-STATIC EFI_EVENT mRtcVirtualAddrChangeEvent;
-STATIC UINTN mPL031RtcBase;
-STATIC EFI_RUNTIME_SERVICES *mRT;
-
-EFI_STATUS
-IdentifyPL031 (
- VOID
- )
-{
- EFI_STATUS Status;
-
- // Check if this is a PrimeCell Peripheral
- if ( (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID0) != 0x0D)
- || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID1) != 0xF0)
- || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID2) != 0x05)
- || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID3) != 0xB1)) {
- Status = EFI_NOT_FOUND;
- goto EXIT;
- }
-
- // Check if this PrimeCell Peripheral is the PL031 Real Time Clock
- if ( (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID0) != 0x31)
- || (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID1) != 0x10)
- || ((MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID2) & 0xF) != 0x04)
- || (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID3) != 0x00)) {
- Status = EFI_NOT_FOUND;
- goto EXIT;
- }
-
- Status = EFI_SUCCESS;
-
- EXIT:
- return Status;
-}
-
-EFI_STATUS
-InitializePL031 (
- VOID
- )
-{
- EFI_STATUS Status;
-
- // Prepare the hardware
- Status = IdentifyPL031();
- if (EFI_ERROR (Status)) {
- goto EXIT;
- }
-
- // Ensure interrupts are masked. We do not want RTC interrupts in UEFI
- if ((MmioRead32 (mPL031RtcBase + PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER) & PL031_SET_IRQ_MASK) != PL031_SET_IRQ_MASK) {
- MmioOr32 (mPL031RtcBase + PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER, PL031_SET_IRQ_MASK);
- }
-
- // Clear any existing interrupts
- if ((MmioRead32 (mPL031RtcBase + PL031_RTC_RIS_RAW_IRQ_STATUS_REGISTER) & PL031_IRQ_TRIGGERED) == PL031_IRQ_TRIGGERED) {
- MmioOr32 (mPL031RtcBase + PL031_RTC_ICR_IRQ_CLEAR_REGISTER, PL031_CLEAR_IRQ);
- }
-
- // Start the clock counter
- if ((MmioRead32 (mPL031RtcBase + PL031_RTC_CR_CONTROL_REGISTER) & PL031_RTC_ENABLED) != PL031_RTC_ENABLED) {
- MmioOr32 (mPL031RtcBase + PL031_RTC_CR_CONTROL_REGISTER, PL031_RTC_ENABLED);
- }
-
- mPL031Initialized = TRUE;
-
- EXIT:
- return Status;
-}
-
-/**
- Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME
- **/
-VOID
-EpochToEfiTime (
- IN UINTN EpochSeconds,
- OUT EFI_TIME *Time
- )
-{
- UINTN a;
- UINTN b;
- UINTN c;
- UINTN d;
- UINTN g;
- UINTN j;
- UINTN m;
- UINTN y;
- UINTN da;
- UINTN db;
- UINTN dc;
- UINTN dg;
- UINTN hh;
- UINTN mm;
- UINTN ss;
- UINTN J;
-
- J = (EpochSeconds / 86400) + 2440588;
- j = J + 32044;
- g = j / 146097;
- dg = j % 146097;
- c = (((dg / 36524) + 1) * 3) / 4;
- dc = dg - (c * 36524);
- b = dc / 1461;
- db = dc % 1461;
- a = (((db / 365) + 1) * 3) / 4;
- da = db - (a * 365);
- y = (g * 400) + (c * 100) + (b * 4) + a;
- m = (((da * 5) + 308) / 153) - 2;
- d = da - (((m + 4) * 153) / 5) + 122;
-
- Time->Year = y - 4800 + ((m + 2) / 12);
- Time->Month = ((m + 2) % 12) + 1;
- Time->Day = d + 1;
-
- ss = EpochSeconds % 60;
- a = (EpochSeconds - ss) / 60;
- mm = a % 60;
- b = (a - mm) / 60;
- hh = b % 24;
-
- Time->Hour = hh;
- Time->Minute = mm;
- Time->Second = ss;
- Time->Nanosecond = 0;
-
-}
-
-/**
- Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC)
- **/
-UINTN
-EfiTimeToEpoch (
- IN EFI_TIME *Time
- )
-{
- UINTN a;
- UINTN y;
- UINTN m;
- UINTN JulianDate; // Absolute Julian Date representation of the supplied Time
- UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY
- UINTN EpochSeconds;
-
- a = (14 - Time->Month) / 12 ;
- y = Time->Year + 4800 - a;
- m = Time->Month + (12*a) - 3;
-
- JulianDate = Time->Day + ((153*m + 2)/5) + (365*y) + (y/4) - (y/100) + (y/400) - 32045;
-
- ASSERT (JulianDate >= EPOCH_JULIAN_DATE);
- EpochDays = JulianDate - EPOCH_JULIAN_DATE;
-
- EpochSeconds = (EpochDays * SEC_PER_DAY) + ((UINTN)Time->Hour * SEC_PER_HOUR) + (Time->Minute * SEC_PER_MIN) + Time->Second;
-
- return EpochSeconds;
-}
-
-BOOLEAN
-IsLeapYear (
- IN EFI_TIME *Time
- )
-{
- if (Time->Year % 4 == 0) {
- if (Time->Year % 100 == 0) {
- if (Time->Year % 400 == 0) {
- return TRUE;
- } else {
- return FALSE;
- }
- } else {
- return TRUE;
- }
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-DayValid (
- IN EFI_TIME *Time
- )
-{
- STATIC CONST INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
- if (Time->Day < 1 ||
- Time->Day > DayOfMonth[Time->Month - 1] ||
- (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
- ) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Returns the current time and date information, and the time-keeping capabilities
- of the hardware platform.
-
- @param Time A pointer to storage to receive a snapshot of the current time.
- @param Capabilities An optional pointer to a buffer to receive the real time clock
- device's capabilities.
-
- @retval EFI_SUCCESS The operation completed successfully.
- @retval EFI_INVALID_PARAMETER Time is NULL.
- @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
- @retval EFI_SECURITY_VIOLATION The time could not be retrieved due to an authentication failure.
-
-**/
-EFI_STATUS
-EFIAPI
-LibGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINT32 EpochSeconds;
- INT16 TimeZone;
- UINT8 Daylight;
- UINTN Size;
-
- // Initialize the hardware if not already done
- if (!mPL031Initialized) {
- Status = InitializePL031 ();
- if (EFI_ERROR (Status)) {
- goto EXIT;
- }
- }
-
- // Snapshot the time as early in the function call as possible
- // On some platforms we may have access to a battery backed up hardware clock.
- // If such RTC exists try to use it first.
- Status = ArmPlatformSysConfigGet (SYS_CFG_RTC, &EpochSeconds);
- if (Status == EFI_UNSUPPORTED) {
- // Battery backed up hardware RTC does not exist, revert to PL031
- EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER);
- Status = EFI_SUCCESS;
- } else if (EFI_ERROR (Status)) {
- // Battery backed up hardware RTC exists but could not be read due to error. Abort.
- goto EXIT;
- } else {
- // Battery backed up hardware RTC exists and we read the time correctly from it.
- // Now sync the PL031 to the new time.
- MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds);
- }
-
- // Ensure Time is a valid pointer
- if (Time == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- // Get the current time zone information from non-volatile storage
- Size = sizeof (TimeZone);
- Status = mRT->GetVariable (
- (CHAR16 *)mTimeZoneVariableName,
- &gEfiCallerIdGuid,
- NULL,
- &Size,
- (VOID *)&TimeZone
- );
-
- if (EFI_ERROR (Status)) {
- ASSERT(Status != EFI_INVALID_PARAMETER);
- ASSERT(Status != EFI_BUFFER_TOO_SMALL);
-
- if (Status != EFI_NOT_FOUND)
- goto EXIT;
-
- // The time zone variable does not exist in non-volatile storage, so create it.
- Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE;
- // Store it
- Status = mRT->SetVariable (
- (CHAR16 *)mTimeZoneVariableName,
- &gEfiCallerIdGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- Size,
- (VOID *)&(Time->TimeZone)
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- EFI_D_ERROR,
- "LibGetTime: Failed to save %s variable to non-volatile storage, Status = %r\n",
- mTimeZoneVariableName,
- Status
- ));
- goto EXIT;
- }
- } else {
- // Got the time zone
- Time->TimeZone = TimeZone;
-
- // Check TimeZone bounds: -1440 to 1440 or 2047
- if (((Time->TimeZone < -1440) || (Time->TimeZone > 1440))
- && (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE)) {
- Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE;
- }
-
- // Adjust for the correct time zone
- if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
- EpochSeconds += Time->TimeZone * SEC_PER_MIN;
- }
- }
-
- // Get the current daylight information from non-volatile storage
- Size = sizeof (Daylight);
- Status = mRT->GetVariable (
- (CHAR16 *)mDaylightVariableName,
- &gEfiCallerIdGuid,
- NULL,
- &Size,
- (VOID *)&Daylight
- );
-
- if (EFI_ERROR (Status)) {
- ASSERT(Status != EFI_INVALID_PARAMETER);
- ASSERT(Status != EFI_BUFFER_TOO_SMALL);
-
- if (Status != EFI_NOT_FOUND)
- goto EXIT;
-
- // The daylight variable does not exist in non-volatile storage, so create it.
- Time->Daylight = 0;
- // Store it
- Status = mRT->SetVariable (
- (CHAR16 *)mDaylightVariableName,
- &gEfiCallerIdGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- Size,
- (VOID *)&(Time->Daylight)
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- EFI_D_ERROR,
- "LibGetTime: Failed to save %s variable to non-volatile storage, Status = %r\n",
- mDaylightVariableName,
- Status
- ));
- goto EXIT;
- }
- } else {
- // Got the daylight information
- Time->Daylight = Daylight;
-
- // Adjust for the correct period
- if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) {
- // Convert to adjusted time, i.e. spring forwards one hour
- EpochSeconds += SEC_PER_HOUR;
- }
- }
-
- // Convert from internal 32-bit time to UEFI time
- EpochToEfiTime (EpochSeconds, Time);
-
- // Update the Capabilities info
- if (Capabilities != NULL) {
- // PL031 runs at frequency 1Hz
- Capabilities->Resolution = PL031_COUNTS_PER_SECOND;
- // Accuracy in ppm multiplied by 1,000,000, e.g. for 50ppm set 50,000,000
- Capabilities->Accuracy = (UINT32)PcdGet32 (PcdPL031RtcPpmAccuracy);
- // FALSE: Setting the time does not clear the values below the resolution level
- Capabilities->SetsToZero = FALSE;
- }
-
- EXIT:
- return Status;
-}
-
-
-/**
- Sets the current local time and date information.
-
- @param Time A pointer to the current time.
-
- @retval EFI_SUCCESS The operation completed successfully.
- @retval EFI_INVALID_PARAMETER A time field is out of range.
- @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
-
-**/
-EFI_STATUS
-EFIAPI
-LibSetTime (
- IN EFI_TIME *Time
- )
-{
- EFI_STATUS Status;
- UINTN EpochSeconds;
-
- // Check the input parameters are within the range specified by UEFI
- if ((Time->Year < 1900) ||
- (Time->Year > 9999) ||
- (Time->Month < 1 ) ||
- (Time->Month > 12 ) ||
- (!DayValid (Time) ) ||
- (Time->Hour > 23 ) ||
- (Time->Minute > 59 ) ||
- (Time->Second > 59 ) ||
- (Time->Nanosecond > 999999999) ||
- (!((Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) || ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440)))) ||
- (Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- // Because the PL031 is a 32-bit counter counting seconds,
- // the maximum time span is just over 136 years.
- // Time is stored in Unix Epoch format, so it starts in 1970,
- // Therefore it can not exceed the year 2106.
- if ((Time->Year < 1970) || (Time->Year >= 2106)) {
- Status = EFI_UNSUPPORTED;
- goto EXIT;
- }
-
- // Initialize the hardware if not already done
- if (!mPL031Initialized) {
- Status = InitializePL031 ();
- if (EFI_ERROR (Status)) {
- goto EXIT;
- }
- }
-
- EpochSeconds = EfiTimeToEpoch (Time);
-
- // Adjust for the correct time zone, i.e. convert to UTC time zone
- if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
- EpochSeconds -= Time->TimeZone * SEC_PER_MIN;
- }
-
- // TODO: Automatic Daylight activation
-
- // Adjust for the correct period
- if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) {
- // Convert to un-adjusted time, i.e. fall back one hour
- EpochSeconds -= SEC_PER_HOUR;
- }
-
- // On some platforms we may have access to a battery backed up hardware clock.
- //
- // If such RTC exists then it must be updated first, before the PL031,
- // to minimise any time drift. This is important because the battery backed-up
- // RTC maintains the master time for the platform across reboots.
- //
- // If such RTC does not exist then the following function returns UNSUPPORTED.
- Status = ArmPlatformSysConfigSet (SYS_CFG_RTC, EpochSeconds);
- if ((EFI_ERROR (Status)) && (Status != EFI_UNSUPPORTED)){
- // Any status message except SUCCESS and UNSUPPORTED indicates a hardware failure.
- goto EXIT;
- }
-
-
- // Set the PL031
- MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds);
-
- // The accesses to Variable Services can be very slow, because we may be writing to Flash.
- // Do this after having set the RTC.
-
- // Save the current time zone information into non-volatile storage
- Status = mRT->SetVariable (
- (CHAR16 *)mTimeZoneVariableName,
- &gEfiCallerIdGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (Time->TimeZone),
- (VOID *)&(Time->TimeZone)
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- EFI_D_ERROR,
- "LibSetTime: Failed to save %s variable to non-volatile storage, Status = %r\n",
- mTimeZoneVariableName,
- Status
- ));
- goto EXIT;
- }
-
- // Save the current daylight information into non-volatile storage
- Status = mRT->SetVariable (
- (CHAR16 *)mDaylightVariableName,
- &gEfiCallerIdGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(Time->Daylight),
- (VOID *)&(Time->Daylight)
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- EFI_D_ERROR,
- "LibSetTime: Failed to save %s variable to non-volatile storage, Status = %r\n",
- mDaylightVariableName,
- Status
- ));
- goto EXIT;
- }
-
- EXIT:
- return Status;
-}
-
-
-/**
- Returns the current wakeup alarm clock setting.
-
- @param Enabled Indicates if the alarm is currently enabled or disabled.
- @param Pending Indicates if the alarm signal is pending and requires acknowledgement.
- @param Time The current alarm setting.
-
- @retval EFI_SUCCESS The alarm settings were returned.
- @retval EFI_INVALID_PARAMETER Any parameter is NULL.
- @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
-
-**/
-EFI_STATUS
-EFIAPI
-LibGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-{
- // Not a required feature
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- Sets the system wakeup alarm clock time.
-
- @param Enabled Enable or disable the wakeup alarm.
- @param Time If Enable is TRUE, the time to set the wakeup alarm for.
-
- @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
- Enable is FALSE, then the wakeup alarm was disabled.
- @retval EFI_INVALID_PARAMETER A time field is out of range.
- @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
- @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
-
-**/
-EFI_STATUS
-EFIAPI
-LibSetWakeupTime (
- IN BOOLEAN Enabled,
- OUT EFI_TIME *Time
- )
-{
- // Not a required feature
- return EFI_UNSUPPORTED;
-}
-
-/**
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-VOID
-EFIAPI
-LibRtcVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- //
- // Only needed if you are going to support the OS calling RTC functions in virtual mode.
- // You will need to call EfiConvertPointer (). To convert any stored physical addresses
- // to virtual address. After the OS transitions to calling in virtual mode, all future
- // runtime calls will be made in virtual mode.
- //
- EfiConvertPointer (0x0, (VOID**)&mPL031RtcBase);
- EfiConvertPointer (0x0, (VOID**)&mRT);
- return;
-}
-
-/**
- This is the declaration of an EFI image entry point. This can be the entry point to an application
- written to this specification, an EFI boot service driver, or an EFI runtime driver.
-
- @param ImageHandle Handle that identifies the loaded image.
- @param SystemTable System Table for this image.
-
- @retval EFI_SUCCESS The operation completed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-LibRtcInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- // Initialize RTC Base Address
- mPL031RtcBase = PcdGet32 (PcdPL031RtcBase);
-
- // Declare the controller as EFI_MEMORY_RUNTIME
- Status = gDS->AddMemorySpace (
- EfiGcdMemoryTypeMemoryMappedIo,
- mPL031RtcBase, SIZE_4KB,
- EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gDS->SetMemorySpaceAttributes (mPL031RtcBase, SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Setup the setters and getters
- gRT->GetTime = LibGetTime;
- gRT->SetTime = LibSetTime;
- gRT->GetWakeupTime = LibGetWakeupTime;
- gRT->SetWakeupTime = LibSetWakeupTime;
-
- mRT = gRT;
-
- // Install the protocol
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiRealTimeClockArchProtocolGuid, NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register for the virtual address change event
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- LibRtcVirtualNotifyEvent,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &mRtcVirtualAddrChangeEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
deleted file mode 100644
index 3a98fc757e..0000000000
--- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
+++ /dev/null
@@ -1,46 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PL031RealTimeClockLib
- FILE_GUID = 470DFB96-E205-4515-A75E-2E60F853E79D
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = RealTimeClockLib
-
-[Sources.common]
- PL031RealTimeClockLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- IoLib
- UefiLib
- DebugLib
- PcdLib
- ArmPlatformSysConfigLib
- DxeServicesTableLib
- UefiRuntimeLib
-
-[Guids]
- gEfiEventVirtualAddressChangeGuid
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdPL031RtcBase
- gArmPlatformTokenSpaceGuid.PcdPL031RtcPpmAccuracy
diff --git a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c b/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
deleted file mode 100644
index 5c241fa59e..0000000000
--- a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/** @file
- PEI Services Table Pointer Library.
-
- This library is used for PEIM which does executed from flash device directly but
- executed in memory.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiPei.h>
-#include <Library/ArmPlatformGlobalVariableLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-/**
- Caches a pointer PEI Services Table.
-
- Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
- in a platform specific manner.
-
- If PeiServicesTablePointer is NULL, then ASSERT().
-
- @param PeiServicesTablePointer The address of PeiServices pointer.
-**/
-VOID
-EFIAPI
-SetPeiServicesTablePointer (
- IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
- )
-{
- ASSERT (PeiServicesTablePointer != NULL);
-
- ArmPlatformSetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);
-}
-
-/**
- Retrieves the cached value of the PEI Services Table pointer.
-
- Returns the cached value of the PEI Services Table pointer in a CPU specific manner
- as specified in the CPU binding section of the Platform Initialization Pre-EFI
- Initialization Core Interface Specification.
-
- If the cached PEI Services Table pointer is NULL, then ASSERT().
-
- @return The pointer to PeiServices.
-
-**/
-CONST EFI_PEI_SERVICES**
-EFIAPI
-GetPeiServicesTablePointer (
- VOID
- )
-{
- EFI_PEI_SERVICES **PeiServicesTablePointer;
-
- ArmPlatformGetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);
-
- return (CONST EFI_PEI_SERVICES**)PeiServicesTablePointer;
-}
-
-/**
- Perform CPU specific actions required to migrate the PEI Services Table
- pointer from temporary RAM to permanent RAM.
-
- For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
- a dedicated CPU register. This means that there is no memory storage
- associated with storing the PEI Services Table pointer, so no additional
- migration actions are required for Itanium or ARM CPUs.
-
-**/
-VOID
-EFIAPI
-MigratePeiServicesTablePointer (
- VOID
- )
-{
- return;
-}
diff --git a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf b/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
deleted file mode 100644
index 307cec8443..0000000000
--- a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file
-# Instance of PEI Services Table Pointer Library using global variable for the table pointer.
-#
-# PEI Services Table Pointer Library implementation that retrieves a pointer to the
-# PEI Services Table from a global variable. Not available to modules that execute from
-# read-only memory.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiServicesTablePointerLib
- FILE_GUID = 1c747f6b-0a58-49ae-8ea3-0327a4fa10e3
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM PEI_CORE SEC
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
-#
-
-[Sources]
- PeiServicesTablePointer.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmPlatformGlobalVariableLib
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdPeiServicePtrGlobalOffset
-
diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
deleted file mode 100644
index c82f27fb4e..0000000000
--- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/** @file
-
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
-Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "IntelBdsPlatform.h"
-
-///
-/// Predefined platform default time out value
-///
-UINT16 gPlatformBootTimeOutDefault;
-
-EFI_STATUS
-EFIAPI
-PlatformIntelBdsConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- gPlatformBootTimeOutDefault = (UINT16)PcdGet16 (PcdPlatformBootTimeOut);
- return EFI_SUCCESS;
-}
-
-//
-// BDS Platform Functions
-//
-/**
- Platform Bds init. Include the platform firmware vendor, revision
- and so crc check.
-
-**/
-VOID
-EFIAPI
-PlatformBdsInit (
- VOID
- )
-{
-}
-
-STATIC
-EFI_STATUS
-GetConsoleDevicePathFromVariable (
- IN CHAR16* ConsoleVarName,
- IN CHAR16* DefaultConsolePaths,
- OUT EFI_DEVICE_PATH** DevicePaths
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathInstances;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathInstance;
- CHAR16* DevicePathStr;
- CHAR16* NextDevicePathStr;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
-
- Status = GetGlobalEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);
- if (EFI_ERROR(Status)) {
- // In case no default console device path has been defined we assume a driver handles the console (eg: SimpleTextInOutSerial)
- if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {
- *DevicePaths = NULL;
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
-
- DevicePathInstances = NULL;
-
- // Extract the Device Path instances from the multi-device path string
- while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != L'\0')) {
- NextDevicePathStr = StrStr (DefaultConsolePaths, L";");
- if (NextDevicePathStr == NULL) {
- DevicePathStr = DefaultConsolePaths;
- DefaultConsolePaths = NULL;
- } else {
- DevicePathStr = (CHAR16*)AllocateCopyPool ((NextDevicePathStr - DefaultConsolePaths + 1) * sizeof(CHAR16), DefaultConsolePaths);
- *(DevicePathStr + (NextDevicePathStr - DefaultConsolePaths)) = L'\0';
- DefaultConsolePaths = NextDevicePathStr;
- if (DefaultConsolePaths[0] == L';') {
- DefaultConsolePaths++;
- }
- }
-
- DevicePathInstance = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (DevicePathStr);
- ASSERT(DevicePathInstance != NULL);
- DevicePathInstances = AppendDevicePathInstance (DevicePathInstances, DevicePathInstance);
-
- if (NextDevicePathStr != NULL) {
- FreePool (DevicePathStr);
- }
- FreePool (DevicePathInstance);
- }
-
- // Set the environment variable with this device path multi-instances
- Size = GetDevicePathSize (DevicePathInstances);
- if (Size > 0) {
- gRT->SetVariable (
- ConsoleVarName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- Size,
- DevicePathInstances
- );
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
- }
-
- if (!EFI_ERROR(Status)) {
- *DevicePaths = DevicePathInstances;
- }
- return Status;
-}
-
-STATIC
-EFI_STATUS
-InitializeConsolePipe (
- IN EFI_DEVICE_PATH *ConsoleDevicePaths,
- IN EFI_GUID *Protocol,
- OUT EFI_HANDLE *Handle,
- OUT VOID* *Interface
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN NoHandles;
- EFI_HANDLE *Buffer;
- EFI_DEVICE_PATH_PROTOCOL* DevicePath;
-
- // Connect all the Device Path Consoles
- while (ConsoleDevicePaths != NULL) {
- DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);
-
- Status = BdsConnectDevicePath (DevicePath, Handle, NULL);
- DEBUG_CODE_BEGIN();
- if (EFI_ERROR(Status)) {
- // We convert back to the text representation of the device Path
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- CHAR16* DevicePathTxt;
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- if (!EFI_ERROR(Status)) {
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE);
-
- DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status));
-
- FreePool (DevicePathTxt);
- }
- }
- DEBUG_CODE_END();
-
- // If the console splitter driver is not supported by the platform then use the first Device Path
- // instance for the console interface.
- if (!EFI_ERROR(Status) && (*Interface == NULL)) {
- Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
- }
- }
-
- // No Device Path has been defined for this console interface. We take the first protocol implementation
- if (*Interface == NULL) {
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
- if (EFI_ERROR (Status)) {
- BdsConnectAllDrivers ();
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
- }
-
- if (!EFI_ERROR(Status)) {
- *Handle = Buffer[0];
- Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
- ASSERT_EFI_ERROR (Status);
- FreePool (Buffer);
- }
- } else {
- Status = EFI_SUCCESS;
- }
-
- return Status;
-}
-
-/**
- Connect the predefined platform default console device. Always try to find
- and enable the vga device if have.
-
- @param PlatformConsole Predefined platform default console device array.
-
- @retval EFI_SUCCESS Success connect at least one ConIn and ConOut
- device, there must have one ConOut device is
- active vga device.
- @return Return the status of BdsLibConnectAllDefaultConsoles ()
-
-**/
-EFI_STATUS
-PlatformBdsConnectConsole (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH* ConOutDevicePaths;
- EFI_DEVICE_PATH* ConInDevicePaths;
- EFI_DEVICE_PATH* ConErrDevicePaths;
-
- // By getting the Console Device Paths from the environment variables before initializing the console pipe, we
- // create the 3 environment variables (ConIn, ConOut, ConErr) that allows to initialize all the console interface
- // of newly installed console drivers
- Status = GetConsoleDevicePathFromVariable (L"ConOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConOutDevicePaths);
- ASSERT_EFI_ERROR (Status);
- Status = GetConsoleDevicePathFromVariable (L"ConIn", (CHAR16*)PcdGetPtr(PcdDefaultConInPaths), &ConInDevicePaths);
- ASSERT_EFI_ERROR (Status);
- Status = GetConsoleDevicePathFromVariable (L"ErrOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConErrDevicePaths);
- ASSERT_EFI_ERROR (Status);
-
- // Initialize the Consoles
- Status = InitializeConsolePipe (ConOutDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **)&gST->ConOut);
- ASSERT_EFI_ERROR (Status);
- Status = InitializeConsolePipe (ConInDevicePaths, &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **)&gST->ConIn);
- ASSERT_EFI_ERROR (Status);
- Status = InitializeConsolePipe (ConErrDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **)&gST->StdErr);
- if (EFI_ERROR(Status)) {
- // In case of error, we reuse the console output for the error output
- gST->StandardErrorHandle = gST->ConsoleOutHandle;
- gST->StdErr = gST->ConOut;
- }
-
- return Status;
-}
-
-/**
- Connect with predefined platform connect sequence,
- the OEM/IBV can customize with their own connect sequence.
-**/
-VOID
-PlatformBdsConnectSequence (
- VOID
- )
-{
-}
-
-/**
- Load the predefined driver option, OEM/IBV can customize this
- to load their own drivers
-
- @param BdsDriverLists - The header of the driver option link list.
-
-**/
-VOID
-PlatformBdsGetDriverOption (
- IN OUT LIST_ENTRY *BdsDriverLists
- )
-{
-}
-
-/**
- Perform the platform diagnostic, such like test memory. OEM/IBV also
- can customize this function to support specific platform diagnostic.
-
- @param MemoryTestLevel The memory test intensive level
- @param QuietBoot Indicate if need to enable the quiet boot
- @param BaseMemoryTest A pointer to BdsMemoryTest()
-
-**/
-VOID
-PlatformBdsDiagnostics (
- IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
- IN BOOLEAN QuietBoot,
- IN BASEM_MEMORY_TEST BaseMemoryTest
- )
-{
-}
-
-/**
- The function will execute with as the platform policy, current policy
- is driven by boot mode. IBV/OEM can customize this code for their specific
- policy action.
-
- @param DriverOptionList The header of the driver option link list
- @param BootOptionList The header of the boot option link list
- @param ProcessCapsules A pointer to ProcessCapsules()
- @param BaseMemoryTest A pointer to BaseMemoryTest()
-
-**/
-VOID
-EFIAPI
-PlatformBdsPolicyBehavior (
- IN LIST_ENTRY *DriverOptionList,
- IN LIST_ENTRY *BootOptionList,
- IN PROCESS_CAPSULES ProcessCapsules,
- IN BASEM_MEMORY_TEST BaseMemoryTest
- )
-{
- EFI_STATUS Status;
-
- Status = PlatformBdsConnectConsole ();
- ASSERT_EFI_ERROR (Status);
-}
-
-/**
- Hook point after a boot attempt succeeds. We don't expect a boot option to
- return, so the UEFI 2.0 specification defines that you will default to an
- interactive mode and stop processing the BootOrder list in this case. This
- is also a platform implementation and can be customized by IBV/OEM.
-
- @param Option Pointer to Boot Option that succeeded to boot.
-
-**/
-VOID
-EFIAPI
-PlatformBdsBootSuccess (
- IN BDS_COMMON_OPTION *Option
- )
-{
-}
-
-/**
- Hook point after a boot attempt fails.
-
- @param Option Pointer to Boot Option that failed to boot.
- @param Status Status returned from failed boot.
- @param ExitData Exit data returned from failed boot.
- @param ExitDataSize Exit data size returned from failed boot.
-
-**/
-VOID
-EFIAPI
-PlatformBdsBootFail (
- IN BDS_COMMON_OPTION *Option,
- IN EFI_STATUS Status,
- IN CHAR16 *ExitData,
- IN UINTN ExitDataSize
- )
-{
-}
-
-/**
- This function locks platform flash that is not allowed to be updated during normal boot path.
- The flash layout is platform specific.
-**/
-VOID
-EFIAPI
-PlatformBdsLockNonUpdatableFlash (
- VOID
- )
-{
- return;
-}
-
-
-/**
- Lock the ConsoleIn device in system table. All key
- presses will be ignored until the Password is typed in. The only way to
- disable the password is to type it in to a ConIn device.
-
- @param Password Password used to lock ConIn device.
-
- @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
- @retval EFI_UNSUPPORTED Password not found
-
-**/
-EFI_STATUS
-EFIAPI
-LockKeyboards (
- IN CHAR16 *Password
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
deleted file mode 100644
index a244ac9132..0000000000
--- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/** @file
- Head file for BDS Platform specific code
-
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _INTEL_BDS_PLATFORM_H_
-#define _INTEL_BDS_PLATFORM_H_
-
-#include <Protocol/DevicePathFromText.h>
-#include <Protocol/DevicePathToText.h>
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/BdsLib.h>
-#include <Library/DebugLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseLib.h>
-#include <Library/PcdLib.h>
-#include <Library/GenericBdsLib.h>
-#include <Library/PlatformBdsLib.h>
-
-#include <Guid/GlobalVariable.h>
-
-#endif // _INTEL_BDS_PLATFORM_H
diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf b/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
deleted file mode 100644
index 07de4cae48..0000000000
--- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
+++ /dev/null
@@ -1,65 +0,0 @@
-## @file
-# Implementation for PlatformBdsLib library class interfaces.
-# using ARM Platform framework.
-#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
-# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PlatformIntelBdsLib
- FILE_GUID = 67780d14-60eb-4894-ab7c-eed6af427f9f
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PlatformBdsLib|DXE_DRIVER
- CONSTRUCTOR = PlatformIntelBdsConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = ARM AARCH64
-#
-
-[Sources]
- IntelBdsPlatform.c
- IntelBdsPlatform.h
-
-[Packages]
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- BdsLib
- DebugLib
- DevicePathLib
- MemoryAllocationLib
- UefiBootServicesTableLib
- PcdLib
- GenericBdsLib
-
-[Guids]
- gArmGlobalVariableGuid
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
- gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
-
-[Protocols]
- gEfiDevicePathFromTextProtocolGuid
- gEfiDevicePathToTextProtocolGuid
diff --git a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c b/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
deleted file mode 100755
index 8932e10049..0000000000
--- a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-#include <Library/ArmPlatformGlobalVariableLib.h>
-#include <Library/PrePiHobListPointerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-/**
- Returns the pointer to the HOB list.
-
- This function returns the pointer to first HOB in the list.
-
- @return The pointer to the HOB list.
-
-**/
-VOID *
-EFIAPI
-PrePeiGetHobList (
- VOID
- )
-{
- VOID* HobList;
-
- ArmPlatformGetGlobalVariable (PcdGet32 (PcdHobListPtrGlobalOffset), sizeof(VOID*), &HobList);
-
- return HobList;
-}
-
-
-
-/**
- Updates the pointer to the HOB list.
-
- @param HobList Hob list pointer to store
-
-**/
-EFI_STATUS
-EFIAPI
-PrePeiSetHobList (
- IN VOID *HobList
- )
-{
- ArmPlatformSetGlobalVariable (PcdGet32 (PcdHobListPtrGlobalOffset), sizeof(VOID*), &HobList);
-
- return EFI_SUCCESS;
-}
-
diff --git a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf b/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
deleted file mode 100755
index 16b201e8f6..0000000000
--- a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PrePiHobListPointerLib
- FILE_GUID = d751d880-5ee2-11e0-b93e-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PrePiHobListPointerLib
-
-[Sources]
- PrePiHobListPointer.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
-
-[LibraryClasses]
- ArmPlatformGlobalVariableLib
-
-[FixedPcd.common]
- gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset
diff --git a/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c b/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c
deleted file mode 100644
index 16798e9ba9..0000000000
--- a/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Base.h>
-
-#include <Library/BaseLib.h>
-#include <Library/TimerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Drivers/SP804Timer.h>
-
-#define SP804_TIMER_METRONOME_BASE ((UINTN)PcdGet32 (PcdSP804TimerMetronomeBase))
-#define SP804_TIMER_PERFORMANCE_BASE ((UINTN)PcdGet32 (PcdSP804TimerPerformanceBase))
-
-// Setup SP810's Timer2 for managing delay functions. And Timer3 for Performance counter
-// Note: ArmVE's Timer0 and Timer1 are used by TimerDxe.
-RETURN_STATUS
-EFIAPI
-TimerConstructor (
- VOID
- )
-{
- // Check if the Metronome Timer is already initialized
- if ((MmioRead32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) == 0) {
- // Configure the Metronome Timer for free running operation, 32 bits, no prescaler, and interrupt disabled
- MmioWrite32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_32BIT | SP804_PRESCALE_DIV_1);
-
- // Start the Metronome Timer ticking
- MmioOr32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_ENABLE);
- }
-
- // Check if the Performance Timer is already initialized
- if ((MmioRead32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) == 0) {
- // Configure the Performance timer for free running operation, 32 bits, no prescaler, interrupt disabled
- MmioWrite32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_32BIT | SP804_PRESCALE_DIV_1);
-
- // Start the Performance Timer ticking
- MmioOr32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_ENABLE);
- }
-
- return RETURN_SUCCESS;
-}
-
-/**
- Stalls the CPU for at least the given number of microseconds.
-
- Stalls the CPU for the number of microseconds specified by MicroSeconds.
- The hardware timer is 32 bits.
- The maximum possible delay is (0xFFFFFFFF / TimerFrequencyMHz), i.e. ([32bits] / FreqInMHz)
- For example:
- +----------------+------------+----------+----------+
- | TimerFrequency | MaxDelay | MaxDelay | MaxDelay |
- | (MHz) | (us) | (s) | (min) |
- +----------------+------------+----------+----------+
- | 1 | 0xFFFFFFFF | 4294 | 71.5 |
- | 5 | 0x33333333 | 859 | 14.3 |
- | 10 | 0x19999999 | 429 | 7.2 |
- | 50 | 0x051EB851 | 86 | 1.4 |
- +----------------+------------+----------+----------+
- If it becomes necessary to support higher delays, then consider using the
- real time clock.
-
- During this delay, the cpu is not yielded to any other process, with one exception:
- events that are triggered off a timer and which execute at a higher TPL than
- this function. These events may call MicroSecondDelay (or NanoSecondDelay) to
- fulfil their own needs.
- Therefore, this function must be re-entrant, as it may be interrupted and re-started.
-
- @param MicroSeconds The minimum number of microseconds to delay.
-
- @return The value of MicroSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-MicroSecondDelay (
- IN UINTN MicroSeconds
- )
-{
- UINT64 DelayTicks64; // Convert from microseconds to timer ticks, more bits to detect over-range conditions.
- UINTN DelayTicks; // Convert from microseconds to timer ticks, native size for general calculations.
- UINTN StartTicks; // Timer value snapshot at the start of the delay
- UINTN TargetTicks; // Timer value to signal the end of the delay
- UINTN CurrentTicks; // Current value of the 64-bit timer value at any given moment
-
- // If we snapshot the timer at the start of the delay function then we minimise unaccounted overheads.
- StartTicks = MmioRead32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CURRENT_REG);
-
- // We are operating at the limit of 32bits. For the range checking work in 64 bits to avoid overflows.
- DelayTicks64 = MultU64x32((UINT64)MicroSeconds, PcdGet32(PcdSP804TimerFrequencyInMHz));
-
- // We are limited to 32 bits.
- // If the specified delay is exactly equal to the max range of the timer,
- // then the start will be equal to the stop plus one timer overflow (wrap-around).
- // To avoid having to check for that, reduce the maximum acceptable range by 1 tick,
- // i.e. reject delays equal or greater than the max range of the timer.
- if (DelayTicks64 >= (UINT64)SP804_MAX_TICKS) {
- DEBUG((EFI_D_ERROR,"MicroSecondDelay: ERROR: MicroSeconds=%d exceed SP804 count range. Max MicroSeconds=%d\n",
- MicroSeconds,
- ((UINTN)SP804_MAX_TICKS/PcdGet32(PcdSP804TimerFrequencyInMHz))));
- }
- ASSERT(DelayTicks64 < (UINT64)SP804_MAX_TICKS);
-
- // From now on do calculations only in native bit size.
- DelayTicks = (UINTN)DelayTicks64;
-
- // Calculate the target value of the timer.
-
- //Note: SP804 timer is counting down
- if (StartTicks >= DelayTicks) {
- // In this case we do not expect a wrap-around of the timer to occur.
- // CurrentTicks must be less than StartTicks and higher than TargetTicks.
- // If this is not the case, then the delay has been reached and may even have been exceeded if this
- // function was suspended by a higher priority interrupt.
-
- TargetTicks = StartTicks - DelayTicks;
-
- do {
- CurrentTicks = MmioRead32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CURRENT_REG);
- } while ((CurrentTicks > TargetTicks) && (CurrentTicks <= StartTicks));
-
- } else {
- // In this case TargetTicks is larger than StartTicks.
- // This means we expect a wrap-around of the timer to occur and we must wait for it.
- // Before the wrap-around, CurrentTicks must be less than StartTicks and less than TargetTicks.
- // After the wrap-around, CurrentTicks must be larger than StartTicks and larger than TargetTicks.
- // If this is not the case, then the delay has been reached and may even have been exceeded if this
- // function was suspended by a higher priority interrupt.
-
- // The order of operations is essential to avoid arithmetic overflow problems
- TargetTicks = ((UINTN)SP804_MAX_TICKS - DelayTicks) + StartTicks;
-
- // First wait for the wrap-around to occur
- do {
- CurrentTicks = MmioRead32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CURRENT_REG);
- } while (CurrentTicks <= StartTicks);
-
- // Then wait for the target
- do {
- CurrentTicks = MmioRead32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CURRENT_REG);
- } while (CurrentTicks > TargetTicks);
- }
-
- return MicroSeconds;
-}
-
-/**
- Stalls the CPU for at least the given number of nanoseconds.
-
- Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
-
- When the timer frequency is 1MHz, each tick corresponds to 1 microsecond.
- Therefore, the nanosecond delay will be rounded up to the nearest 1 microsecond.
-
- @param NanoSeconds The minimum number of nanoseconds to delay.
-
- @return The value of NanoSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-NanoSecondDelay (
- IN UINTN NanoSeconds
- )
-{
- UINTN MicroSeconds;
-
- // Round up to 1us Tick Number
- MicroSeconds = NanoSeconds / 1000;
- MicroSeconds += ((NanoSeconds % 1000) == 0) ? 0 : 1;
-
- MicroSecondDelay (MicroSeconds);
-
- return NanoSeconds;
-}
-
-/**
- Retrieves the current value of a 64-bit free running performance counter.
-
- The counter can either count up by 1 or count down by 1. If the physical
- performance counter counts by a larger increment, then the counter values
- must be translated. The properties of the counter can be retrieved from
- GetPerformanceCounterProperties().
-
- @return The current value of the free running performance counter.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounter (
- VOID
- )
-{
- // Free running 64-bit/32-bit counter is needed here.
- // Don't think we need this to boot, just to do performance profile
- UINT64 Value;
- Value = MmioRead32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CURRENT_REG);
- return Value;
-}
-
-
-/**
- Retrieves the 64-bit frequency in Hz and the range of performance counter
- values.
-
- If StartValue is not NULL, then the value that the performance counter starts
- with immediately after is it rolls over is returned in StartValue. If
- EndValue is not NULL, then the value that the performance counter end with
- immediately before it rolls over is returned in EndValue. The 64-bit
- frequency of the performance counter in Hz is always returned. If StartValue
- is less than EndValue, then the performance counter counts up. If StartValue
- is greater than EndValue, then the performance counter counts down. For
- example, a 64-bit free running counter that counts up would have a StartValue
- of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
- that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
-
- @param StartValue The value the performance counter starts with when it
- rolls over.
- @param EndValue The value that the performance counter ends with before
- it rolls over.
-
- @return The frequency in Hz.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounterProperties (
- OUT UINT64 *StartValue, OPTIONAL
- OUT UINT64 *EndValue OPTIONAL
- )
-{
- if (StartValue != NULL) {
- // Timer starts with the reload value
- *StartValue = 0xFFFFFFFF;
- }
-
- if (EndValue != NULL) {
- // Timer counts down to 0x0
- *EndValue = (UINT64)0ULL;
- }
-
- return PcdGet64 (PcdEmbeddedPerformanceCounterFrequencyInHz);
-}
diff --git a/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf b/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
deleted file mode 100644
index fb5cc18926..0000000000
--- a/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-#/** @file
-# Timer library implementation
-#
-#
-# Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SP804TimerLib
- FILE_GUID = 09cefa99-0d07-487f-a651-fb44f094b1c7
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = TimerLib
-
- CONSTRUCTOR = TimerConstructor
-
-[Sources.common]
- SP804TimerLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
-
-[LibraryClasses]
- DebugLib
- IoLib
- BaseLib
-
-[Pcd]
- gArmPlatformTokenSpaceGuid.PcdSP804TimerFrequencyInMHz
- gArmPlatformTokenSpaceGuid.PcdSP804TimerPerformanceBase
- gArmPlatformTokenSpaceGuid.PcdSP804TimerMetronomeBase
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz
diff --git a/ArmPlatformPkg/License.txt b/ArmPlatformPkg/License.txt
deleted file mode 100755
index e827fe5e7f..0000000000
--- a/ArmPlatformPkg/License.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c
deleted file mode 100755
index f54ec3672a..0000000000
--- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-
-VOID
-BuildMemoryTypeInformationHob (
- VOID
- );
-
-STATIC
-VOID
-InitMmu (
- IN ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable
- )
-{
-
- VOID *TranslationTableBase;
- UINTN TranslationTableSize;
- RETURN_STATUS Status;
-
- //Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in
- // DRAM (even at the top of DRAM as it is the first permanent memory allocation)
- Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Error: Failed to enable MMU\n"));
- }
-}
-
-/*++
-
-Routine Description:
-
-
-
-Arguments:
-
- FileHandle - Handle of the file being invoked.
- PeiServices - Describes the list of possible PEI Services.
-
-Returns:
-
- Status - EFI_SUCCESS if the boot mode could be set
-
---*/
-EFI_STATUS
-EFIAPI
-MemoryPeim (
- IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,
- IN UINT64 UefiMemorySize
- )
-{
- ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable;
- EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
- UINT64 ResourceLength;
- EFI_PEI_HOB_POINTERS NextHob;
- EFI_PHYSICAL_ADDRESS FdTop;
- EFI_PHYSICAL_ADDRESS SystemMemoryTop;
- EFI_PHYSICAL_ADDRESS ResourceTop;
- BOOLEAN Found;
-
- // Get Virtual Memory Map from the Platform Library
- ArmPlatformGetVirtualMemoryMap (&MemoryTable);
-
- // Ensure PcdSystemMemorySize has been set
- ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
-
- //
- // Now, the permanent memory has been installed, we can call AllocatePages()
- //
- ResourceAttributes = (
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED
- );
-
- //
- // Check if the resource for the main system memory has been declared
- //
- Found = FALSE;
- NextHob.Raw = GetHobList ();
- while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) {
- if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&
- (PcdGet64 (PcdSystemMemoryBase) >= NextHob.ResourceDescriptor->PhysicalStart) &&
- (NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength <= PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize)))
- {
- Found = TRUE;
- break;
- }
- NextHob.Raw = GET_NEXT_HOB (NextHob);
- }
-
- if (!Found) {
- // Reserved the memory space occupied by the firmware volume
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes,
- PcdGet64 (PcdSystemMemoryBase),
- PcdGet64 (PcdSystemMemorySize)
- );
- }
-
- //
- // Reserved the memory space occupied by the firmware volume
- //
-
- SystemMemoryTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase) + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize);
- FdTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFdSize);
-
- // EDK2 does not have the concept of boot firmware copied into DRAM. To avoid the DXE
- // core to overwrite this area we must mark the region with the attribute non-present
- if ((PcdGet64 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) {
- Found = FALSE;
-
- // Search for System Memory Hob that contains the firmware
- NextHob.Raw = GetHobList ();
- while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) {
- if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&
- (PcdGet64 (PcdFdBaseAddress) >= NextHob.ResourceDescriptor->PhysicalStart) &&
- (FdTop <= NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength))
- {
- ResourceAttributes = NextHob.ResourceDescriptor->ResourceAttribute;
- ResourceLength = NextHob.ResourceDescriptor->ResourceLength;
- ResourceTop = NextHob.ResourceDescriptor->PhysicalStart + ResourceLength;
-
- if (PcdGet64 (PcdFdBaseAddress) == NextHob.ResourceDescriptor->PhysicalStart) {
- if (SystemMemoryTop == FdTop) {
- NextHob.ResourceDescriptor->ResourceAttribute = ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT;
- } else {
- // Create the System Memory HOB for the firmware with the non-present attribute
- BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT,
- PcdGet64 (PcdFdBaseAddress),
- PcdGet32 (PcdFdSize));
-
- // Top of the FD is system memory available for UEFI
- NextHob.ResourceDescriptor->PhysicalStart += PcdGet32(PcdFdSize);
- NextHob.ResourceDescriptor->ResourceLength -= PcdGet32(PcdFdSize);
- }
- } else {
- // Create the System Memory HOB for the firmware with the non-present attribute
- BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT,
- PcdGet64 (PcdFdBaseAddress),
- PcdGet32 (PcdFdSize));
-
- // Update the HOB
- NextHob.ResourceDescriptor->ResourceLength = PcdGet64 (PcdFdBaseAddress) - NextHob.ResourceDescriptor->PhysicalStart;
-
- // If there is some memory available on the top of the FD then create a HOB
- if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + ResourceLength) {
- // Create the System Memory HOB for the remaining region (top of the FD)
- BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,
- ResourceAttributes,
- FdTop,
- ResourceTop - FdTop);
- }
- }
- Found = TRUE;
- break;
- }
- NextHob.Raw = GET_NEXT_HOB (NextHob);
- }
-
- ASSERT(Found);
- }
-
- // Build Memory Allocation Hob
- InitMmu (MemoryTable);
-
- if (FeaturePcdGet (PcdPrePiProduceMemoryTypeInformationHob)) {
- // Optional feature that helps prevent EFI memory map fragmentation.
- BuildMemoryTypeInformationHob ();
- }
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
deleted file mode 100755
index 6d22b7c034..0000000000
--- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
+++ /dev/null
@@ -1,66 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmMemoryInitPeiLib
- FILE_GUID = 55ddb6e0-70b5-11e0-b33e-0002a5d5c51b
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = MemoryInitPeiLib|SEC PEIM
-
-[Sources]
- MemoryInitPeiLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- DebugLib
- HobLib
- ArmLib
- ArmPlatformLib
-
-[Guids]
- gEfiMemoryTypeInformationGuid
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
-
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData
-
-[Pcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
-[Depex]
- TRUE
diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
deleted file mode 100755
index 93ab16ca4a..0000000000
--- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-
-//
-// The protocols, PPI and GUID defintions for this module
-//
-#include <Ppi/MasterBootMode.h>
-#include <Ppi/BootInRecoveryMode.h>
-#include <Guid/MemoryTypeInformation.h>
-//
-// The Library classes this module consumes
-//
-#include <Library/ArmPlatformLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PcdLib.h>
-
-EFI_STATUS
-EFIAPI
-MemoryPeim (
- IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,
- IN UINT64 UefiMemorySize
- );
-
-// May want to put this into a library so you only need the PCD settings if you are using the feature?
-VOID
-BuildMemoryTypeInformationHob (
- VOID
- )
-{
- EFI_MEMORY_TYPE_INFORMATION Info[10];
-
- Info[0].Type = EfiACPIReclaimMemory;
- Info[0].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory);
- Info[1].Type = EfiACPIMemoryNVS;
- Info[1].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS);
- Info[2].Type = EfiReservedMemoryType;
- Info[2].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiReservedMemoryType);
- Info[3].Type = EfiRuntimeServicesData;
- Info[3].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesData);
- Info[4].Type = EfiRuntimeServicesCode;
- Info[4].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode);
- Info[5].Type = EfiBootServicesCode;
- Info[5].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesCode);
- Info[6].Type = EfiBootServicesData;
- Info[6].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesData);
- Info[7].Type = EfiLoaderCode;
- Info[7].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderCode);
- Info[8].Type = EfiLoaderData;
- Info[8].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderData);
-
- // Terminator for the list
- Info[9].Type = EfiMaxMemoryType;
- Info[9].NumberOfPages = 0;
-
- BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info));
-}
-
-/*++
-
-Routine Description:
-
-
-
-Arguments:
-
- FileHandle - Handle of the file being invoked.
- PeiServices - Describes the list of possible PEI Services.
-
-Returns:
-
- Status - EFI_SUCCESS if the boot mode could be set
-
---*/
-EFI_STATUS
-EFIAPI
-InitializeMemory (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
- UINTN SystemMemoryBase;
- UINTN SystemMemoryTop;
- UINTN FdBase;
- UINTN FdTop;
- UINTN UefiMemoryBase;
-
- DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Memory Init PEIM Loaded\n"));
-
- //
- // Initialize the System Memory (DRAM)
- //
- if (!FeaturePcdGet (PcdSystemMemoryInitializeInSec)) {
- // In case the DRAM has not been initialized by the secure firmware
- ArmPlatformInitializeSystemMemory ();
- }
-
- // Ensure PcdSystemMemorySize has been set
- ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
-
- SystemMemoryBase = (UINTN)PcdGet64 (PcdSystemMemoryBase);
- SystemMemoryTop = SystemMemoryBase + (UINTN)PcdGet64 (PcdSystemMemorySize);
- FdBase = (UINTN)PcdGet64 (PcdFdBaseAddress);
- FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize);
-
- //
- // Declare the UEFI memory to PEI
- //
-
- // In case the firmware has been shadowed in the System Memory
- if ((FdBase >= SystemMemoryBase) && (FdTop <= SystemMemoryTop)) {
- // Check if there is enough space between the top of the system memory and the top of the
- // firmware to place the UEFI memory (for PEI & DXE phases)
- if (SystemMemoryTop - FdTop >= FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)) {
- UefiMemoryBase = SystemMemoryTop - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);
- } else {
- // Check there is enough space for the UEFI memory
- ASSERT (SystemMemoryBase + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize) <= FdBase);
-
- UefiMemoryBase = FdBase - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);
- }
- } else {
- // Check the Firmware does not overlapped with the system memory
- ASSERT ((FdBase < SystemMemoryBase) || (FdBase >= SystemMemoryTop));
- ASSERT ((FdTop <= SystemMemoryBase) || (FdTop > SystemMemoryTop));
-
- UefiMemoryBase = SystemMemoryTop - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);
- }
-
- Status = PeiServicesInstallPeiMemory (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));
- ASSERT_EFI_ERROR (Status);
-
- // Initialize MMU and Memory HOBs (Resource Descriptor HOBs)
- Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
deleted file mode 100755
index 2c14a9c826..0000000000
--- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
+++ /dev/null
@@ -1,75 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = MemoryInit
- FILE_GUID = c61ef796-b50d-4f98-9f78-4f6f79d800d5
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeMemory
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM
-#
-
-[Sources]
- MemoryInitPeim.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- HobLib
- ArmLib
- ArmPlatformLib
- MemoryInitPeiLib
-
-[Guids]
- gEfiMemoryTypeInformationGuid
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
-
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData
-
-[Pcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
-
-[Depex]
- TRUE
diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeiLib.c b/ArmPlatformPkg/PlatformPei/PlatformPeiLib.c
deleted file mode 100755
index a27b168e2e..0000000000
--- a/ArmPlatformPkg/PlatformPei/PlatformPeiLib.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-
-#include <Library/ArmPlatformLib.h>
-#include <Library/HobLib.h>
-#include <Library/PcdLib.h>
-
-EFI_STATUS
-EFIAPI
-PlatformPeim (
- VOID
- )
-{
- BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize));
-
- return EFI_SUCCESS;
-}
diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf b/ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
deleted file mode 100755
index 314789d0a9..0000000000
--- a/ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformPeiLib
- FILE_GUID = 49d37060-70b5-11e0-aa2d-0002a5d5c51b
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PlatformPeiLib
-
-[Sources]
- PlatformPeiLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- DebugLib
- HobLib
- ArmPlatformLib
-
-[Ppis]
- gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
- gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdFvSize
-
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize
-
-[depex]
- TRUE
diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.c b/ArmPlatformPkg/PlatformPei/PlatformPeim.c
deleted file mode 100755
index 58ecb31ec2..0000000000
--- a/ArmPlatformPkg/PlatformPei/PlatformPeim.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-
-//
-// The protocols, PPI and GUID defintions for this module
-//
-#include <Ppi/ArmGlobalVariable.h>
-#include <Ppi/MasterBootMode.h>
-#include <Ppi/BootInRecoveryMode.h>
-#include <Ppi/GuidedSectionExtraction.h>
-//
-// The Library classes this module consumes
-//
-#include <Library/ArmPlatformLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PcdLib.h>
-
-#include <Guid/ArmGlobalVariableHob.h>
-
-EFI_STATUS
-EFIAPI
-InitializePlatformPeim (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- );
-
-EFI_STATUS
-EFIAPI
-PlatformPeim (
- VOID
- );
-
-//
-// Module globals
-//
-CONST EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiMasterBootModePpiGuid,
- NULL
-};
-
-CONST EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiBootInRecoveryModePpiGuid,
- NULL
-};
-
-VOID
-EFIAPI
-BuildGlobalVariableHob (
- IN EFI_PHYSICAL_ADDRESS GlobalVariableBase,
- IN UINT32 GlobalVariableSize
- )
-{
- EFI_STATUS Status;
- ARM_HOB_GLOBAL_VARIABLE *Hob;
-
- Status = PeiServicesCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE), (VOID**)&Hob);
- if (!EFI_ERROR(Status)) {
- CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid);
- Hob->GlobalVariableBase = GlobalVariableBase;
- Hob->GlobalVariableSize = GlobalVariableSize;
- }
-}
-
-/*++
-
-Routine Description:
-
-
-
-Arguments:
-
- FileHandle - Handle of the file being invoked.
- PeiServices - Describes the list of possible PEI Services.
-
-Returns:
-
- Status - EFI_SUCCESS if the boot mode could be set
-
---*/
-EFI_STATUS
-EFIAPI
-InitializePlatformPeim (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
- UINTN BootMode;
- ARM_GLOBAL_VARIABLE_PPI *ArmGlobalVariablePpi;
- EFI_PHYSICAL_ADDRESS GlobalVariableBase;
-
- DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Platform PEIM Loaded\n"));
-
- PlatformPeim ();
-
- Status = PeiServicesLocatePpi (&gArmGlobalVariablePpiGuid, 0, NULL, (VOID**)&ArmGlobalVariablePpi);
- if (!EFI_ERROR(Status)) {
- Status = ArmGlobalVariablePpi->GetGlobalVariableMemory (&GlobalVariableBase);
-
- if (!EFI_ERROR(Status)) {
- // Declare the Global Variable HOB
- BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));
- }
- }
-
- BootMode = ArmPlatformGetBootMode ();
- Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
- ASSERT_EFI_ERROR (Status);
-
- Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
- ASSERT_EFI_ERROR (Status);
-
- if (BootMode == BOOT_IN_RECOVERY_MODE) {
- Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
- ASSERT_EFI_ERROR (Status);
- }
-
- return Status;
-}
diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf
deleted file mode 100755
index 3822b09350..0000000000
--- a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf
+++ /dev/null
@@ -1,69 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PlatformPei
- FILE_GUID = 2ad0fc59-2314-4bf3-8633-13fa22a624a0
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializePlatformPeim
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM
-#
-
-[Sources]
- PlatformPeim.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- HobLib
- ArmPlatformLib
- PlatformPeiLib
-
-[Ppis]
- gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
- gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED
- gArmGlobalVariablePpiGuid
-
-[Guids]
- gArmGlobalVariableGuid
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdFvSize
-
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize
-
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
-[Depex]
- TRUE
-
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/ArchPrePeiCore.c b/ArmPlatformPkg/PrePeiCore/AArch64/ArchPrePeiCore.c
deleted file mode 100644
index e1842f2a02..0000000000
--- a/ArmPlatformPkg/PrePeiCore/AArch64/ArchPrePeiCore.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
-* Main file supporting the transition to PEI Core in Normal World for Versatile Express
-*
-* Copyright (c) 2012-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/PrintLib.h>
-#include <Library/SerialPortLib.h>
-
-#include "PrePeiCore.h"
-
-VOID
-PeiCommonExceptionEntry (
- IN UINT32 Entry,
- IN UINTN LR
- )
-{
- CHAR8 Buffer[100];
- UINTN CharCount;
-
- switch (Entry) {
- case EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Synchronous Exception at 0x%X\n\r", LR);
- break;
- case EXCEPT_AARCH64_IRQ:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r", LR);
- break;
- case EXCEPT_AARCH64_FIQ:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r", LR);
- break;
- case EXCEPT_AARCH64_SERROR:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SError/Abort Exception at 0x%X\n\r", LR);
- break;
- default:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r", LR);
- break;
- }
-
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
-
- while(1);
-}
-
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/Exception.S b/ArmPlatformPkg/PrePeiCore/AArch64/Exception.S
deleted file mode 100644
index cdc8d925bc..0000000000
--- a/ArmPlatformPkg/PrePeiCore/AArch64/Exception.S
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <AutoGen.h>
-
-.text
-.align 11
-
-GCC_ASM_EXPORT(PeiVectorTable)
-
-//============================================================
-//Default Exception Handlers
-//============================================================
-
-ASM_PFX(PeiVectorTable):
-
-
-#define TO_HANDLER \
- EL1_OR_EL2(x1) \
-1: mrs x1, elr_el1 /* EL1 Exception Link Register */ ;\
- b 3f ;\
-2: mrs x1, elr_el2 /* EL2 Exception Link Register */ ;\
-3: bl ASM_PFX(PeiCommonExceptionEntry) ;
-
-
-//
-// Default Exception handlers: There is no plan to return from any of these exceptions.
-// No context saving at all.
-//
-
-.align 7
-_DefaultSyncExceptHandler_t:
- mov x0, #EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS
- TO_HANDLER
-
-.align 7
-_DefaultIrq_t:
- mov x0, #EXCEPT_AARCH64_IRQ
- TO_HANDLER
-
-.align 7
-_DefaultFiq_t:
- mov x0, #EXCEPT_AARCH64_FIQ
- TO_HANDLER
-
-.align 7
-_DefaultSError_t:
- mov x0, #EXCEPT_AARCH64_SERROR
- TO_HANDLER
-
-.align 7
-_DefaultSyncExceptHandler_h:
- mov x0, #EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS
- TO_HANDLER
-
-.align 7
-_DefaultIrq_h:
- mov x0, #EXCEPT_AARCH64_IRQ
- TO_HANDLER
-
-.align 7
-_DefaultFiq_h:
- mov x0, #EXCEPT_AARCH64_FIQ
- TO_HANDLER
-
-.align 7
-_DefaultSError_h:
- mov x0, #EXCEPT_AARCH64_SERROR
- TO_HANDLER
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S b/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S
deleted file mode 100644
index 8e23b03896..0000000000
--- a/ArmPlatformPkg/PrePeiCore/AArch64/Helper.S
+++ /dev/null
@@ -1,48 +0,0 @@
-#========================================================================================
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http:#opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#=======================================================================================
-
-#include <AsmMacroIoLibV8.h>
-#include <Chipset/AArch64.h>
-
-#start of the code section
-.text
-.align 3
-
-GCC_ASM_EXPORT(SetupExceptionLevel1)
-GCC_ASM_EXPORT(SetupExceptionLevel2)
-
-// Setup EL1 while in EL1
-ASM_PFX(SetupExceptionLevel1):
- mov x5, x30 // Save LR
-
- mov x0, #CPACR_CP_FULL_ACCESS
- bl ASM_PFX(ArmWriteCpacr) // Disable copro traps to EL1
-
- ret x5
-
-// Setup EL2 while in EL2
-ASM_PFX(SetupExceptionLevel2):
- msr sctlr_el2, xzr
- mrs x0, hcr_el2 // Read EL2 Hypervisor configuration Register
-
- // Send all interrupts to their respective Exception levels for EL2
- orr x0, x0, #(1 << 3) // Enable EL2 FIQ
- orr x0, x0, #(1 << 4) // Enable EL2 IRQ
- orr x0, x0, #(1 << 5) // Enable EL2 SError and Abort
- msr hcr_el2, x0 // Write back our settings
-
- msr cptr_el2, xzr // Disable copro traps to EL2
-
- ret
-
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S
deleted file mode 100644
index b84190cf3f..0000000000
--- a/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-StartupAddr: .8byte CEntryPoint
-
-ASM_PFX(_ModuleEntryPoint):
- // Do early platform specific actions
- bl ASM_PFX(ArmPlatformPeiBootAction)
-
-// NOTE: We could be booting from EL3, EL2 or EL1. Need to correctly detect
-// and configure the system accordingly. EL2 is default if possible.
-// If we started in EL3 we need to switch and run at EL2.
-// If we are running at EL2 stay in EL2
-// If we are starting at EL1 stay in EL1.
-
-// If started at EL3 Sec is run and switches to EL2 before jumping to PEI.
-// If started at EL1 or EL2 Sec jumps directly to PEI without making any
-// changes.
-
-// Which EL are we running at? Every EL needs some level of setup...
-// We should not run this code in EL3
- EL1_OR_EL2(x0)
-1:bl ASM_PFX(SetupExceptionLevel1)
- b ASM_PFX(MainEntryPoint)
-2:bl ASM_PFX(SetupExceptionLevel2)
- b ASM_PFX(MainEntryPoint)
-
-ASM_PFX(MainEntryPoint):
- // Identify CPU ID
- bl ASM_PFX(ArmReadMpidr)
- // Keep a copy of the MpId register value
- mov x5, x0
-
- // Is it the Primary Core ?
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
-
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), x1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)
- add x1, x1, x2
-
- // x0 is equal to 1 if I am the primary core
- cmp x0, #1
- b.eq _SetupPrimaryCoreStack
-
-_SetupSecondaryCoreStack:
- // x1 contains the base of the secondary stacks
-
- // Get the Core Position
- mov x6, x1 // Save base of the secondary stacks
- mov x0, x5
- bl ASM_PFX(ArmPlatformGetCorePosition)
- // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
- add x0, x0, #1
-
- // StackOffset = CorePos * StackSize
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x2)
- mul x0, x0, x2
- // SP = StackBase + StackOffset
- add sp, x6, x0
-
-_PrepareArguments:
- // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
- LoadConstantToReg (FixedPcdGet64(PcdFvBaseAddress), x2)
- add x2, x2, #8
- ldr x1, [x2]
-
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr x3, StartupAddr
-
- // Jump to PrePeiCore C code
- // x0 = mp_id
- // x1 = pei_core_address
- mov x0, x5
- blr x3
-
-_SetupPrimaryCoreStack:
- // x1 contains the top of the primary stack
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x2)
-
- // The reserved space for global variable must be 16-bytes aligned for pushing
- // 128-bit variable on the stack
- SetPrimaryStack (x1, x2, x3, x4)
- b _PrepareArguments
diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S b/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S
deleted file mode 100644
index 8d83510517..0000000000
--- a/ArmPlatformPkg/PrePeiCore/AArch64/SwitchStack.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(SecSwitchStack)
-
-
-
-#/**
-# This allows the caller to switch the stack and return
-#
-# @param StackDelta Signed amount by which to modify the stack pointer
-#
-# @return Nothing. Goes to the Entry Point passing in the new parameters
-#
-#**/
-#VOID
-#EFIAPI
-#SecSwitchStack (
-# VOID *StackDelta
-# )#
-#
-ASM_PFX(SecSwitchStack):
- mov x1, sp
- add x1, x0, x1
- mov sp, x1
- ret
-
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c b/ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c
deleted file mode 100644
index 6a250391b4..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
-* Main file supporting the transition to PEI Core in Normal World for Versatile Express
-*
-* Copyright (c) 2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/PrintLib.h>
-#include <Library/SerialPortLib.h>
-
-#include "PrePeiCore.h"
-
-VOID
-PeiCommonExceptionEntry (
- IN UINT32 Entry,
- IN UINTN LR
- )
-{
- CHAR8 Buffer[100];
- UINTN CharCount;
-
- switch (Entry) {
- case 0:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reset Exception at 0x%X\n\r",LR);
- break;
- case 1:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Undefined Exception at 0x%X\n\r",LR);
- break;
- case 2:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SWI Exception at 0x%X\n\r",LR);
- break;
- case 3:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"PrefetchAbort Exception at 0x%X\n\r",LR);
- break;
- case 4:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"DataAbort Exception at 0x%X\n\r",LR);
- break;
- case 5:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reserved Exception at 0x%X\n\r",LR);
- break;
- case 6:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r",LR);
- break;
- case 7:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r",LR);
- break;
- default:
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r",LR);
- break;
- }
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
- while(1);
-}
-
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/Exception.S b/ArmPlatformPkg/PrePeiCore/Arm/Exception.S
deleted file mode 100644
index afd284a2c7..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/Exception.S
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// Copyright (c) 2011, ARM Limited. All rights reserved.
-//
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <AutoGen.h>
-
-#start of the code section
-.text
-.align 5
-
-# IMPORT
-GCC_ASM_IMPORT(PeiCommonExceptionEntry)
-
-# EXPORT
-GCC_ASM_EXPORT(PeiVectorTable)
-
-//============================================================
-//Default Exception Handlers
-//============================================================
-
-
-ASM_PFX(PeiVectorTable):
- b _DefaultResetHandler
- b _DefaultUndefined
- b _DefaultSWI
- b _DefaultPrefetchAbort
- b _DefaultDataAbort
- b _DefaultReserved
- b _DefaultIrq
- b _DefaultFiq
-
-//
-// Default Exception handlers: There is no plan to return from any of these exceptions.
-// No context saving at all.
-//
-_DefaultResetHandler:
- mov r1, lr
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #0
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultUndefined:
- sub r1, LR, #4
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #1
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultSWI:
- sub r1, LR, #4
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #2
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultPrefetchAbort:
- sub r1, LR, #4
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #3
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultDataAbort:
- sub r1, LR, #8
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #4
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultReserved:
- mov r1, lr
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #5
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultIrq:
- sub r1, LR, #4
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #6
- blx ASM_PFX(PeiCommonExceptionEntry)
-
-_DefaultFiq:
- sub r1, LR, #4
- # Switch to SVC for common stack
- cps #0x13
- mov r0, #7
- blx ASM_PFX(PeiCommonExceptionEntry)
-
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm b/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm
deleted file mode 100644
index de438f913a..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Copyright (c) 2011, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <AutoGen.h>
-
- IMPORT PeiCommonExceptionEntry
- EXPORT PeiVectorTable
-
- PRESERVE8
- AREA PrePeiCoreException, CODE, READONLY, CODEALIGN, ALIGN=5
-
-//============================================================
-//Default Exception Handlers
-//============================================================
-
-
-PeiVectorTable
- b _DefaultResetHandler
- b _DefaultUndefined
- b _DefaultSWI
- b _DefaultPrefetchAbort
- b _DefaultDataAbort
- b _DefaultReserved
- b _DefaultIrq
- b _DefaultFiq
-
-//
-// Default Exception handlers: There is no plan to return from any of these exceptions.
-// No context saving at all.
-//
-_DefaultResetHandler
- mov r1, lr
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #0
- blx PeiCommonExceptionEntry
-
-_DefaultUndefined
- sub r1, LR, #4
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #1
- blx PeiCommonExceptionEntry
-
-_DefaultSWI
- sub r1, LR, #4
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #2
- blx PeiCommonExceptionEntry
-
-_DefaultPrefetchAbort
- sub r1, LR, #4
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #3
- blx PeiCommonExceptionEntry
-
-_DefaultDataAbort
- sub r1, LR, #8
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #4
- blx PeiCommonExceptionEntry
-
-_DefaultReserved
- mov r1, lr
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #5
- blx PeiCommonExceptionEntry
-
-_DefaultIrq
- sub r1, LR, #4
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #6
- blx PeiCommonExceptionEntry
-
-_DefaultFiq
- sub r1, LR, #4
- cps #0x13 ; Switch to SVC for common stack
- mov r0, #7
- blx PeiCommonExceptionEntry
-
- END
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
deleted file mode 100644
index a6f19aff0f..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-StartupAddr: .word CEntryPoint
-
-ASM_PFX(_ModuleEntryPoint):
- // Do early platform specific actions
- bl ASM_PFX(ArmPlatformPeiBootAction)
-
- // Identify CPU ID
- bl ASM_PFX(ArmReadMpidr)
- // Keep a copy of the MpId register value
- mov r5, r0
-
- // Is it the Primary Core ?
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
-
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
- add r1, r1, r2
-
- // r0 is equal to 1 if I am the primary core
- cmp r0, #1
- beq _SetupPrimaryCoreStack
-
-_SetupSecondaryCoreStack:
- // r1 contains the base of the secondary stacks
-
- // Get the Core Position
- mov r6, r1 // Save base of the secondary stacks
- mov r0, r5
- bl ASM_PFX(ArmPlatformGetCorePosition)
- // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
- add r0, r0, #1
-
- // StackOffset = CorePos * StackSize
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)
- mul r0, r0, r2
- // SP = StackBase + StackOffset
- add sp, r6, r0
-
-_PrepareArguments:
- // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
- LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2)
- add r2, r2, #4
- ldr r1, [r2]
-
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr r3, StartupAddr
-
- // Jump to PrePeiCore C code
- // r0 = mp_id
- // r1 = pei_core_address
- mov r0, r5
- blx r3
-
-_SetupPrimaryCoreStack:
- // r1 contains the top of the primary stack
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2)
-
- // The reserved space for global variable must be 8-bytes aligned for pushing
- // 64-bit variable on the stack
- SetPrimaryStack (r1, r2, r3)
- b _PrepareArguments
-
-_NeverReturn:
- b _NeverReturn
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
deleted file mode 100644
index edf479ff43..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- IMPORT CEntryPoint
- IMPORT ArmPlatformGetCorePosition
- IMPORT ArmPlatformIsPrimaryCore
- IMPORT ArmReadMpidr
- IMPORT ArmPlatformPeiBootAction
- EXPORT _ModuleEntryPoint
-
- PRESERVE8
- AREA PrePeiCoreEntryPoint, CODE, READONLY
-
-StartupAddr DCD CEntryPoint
-
-_ModuleEntryPoint
- // Do early platform specific actions
- bl ArmPlatformPeiBootAction
-
- // Identify CPU ID
- bl ArmReadMpidr
- // Keep a copy of the MpId register value
- mov r5, r0
-
- // Is it the Primary Core ?
- bl ArmPlatformIsPrimaryCore
-
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
- add r1, r1, r2
-
- // r0 is equal to 1 if I am the primary core
- cmp r0, #1
- beq _SetupPrimaryCoreStack
-
-_SetupSecondaryCoreStack
- // r1 contains the base of the secondary stacks
-
- // Get the Core Position
- mov r6, r1 // Save base of the secondary stacks
- mov r0, r5
- bl ArmPlatformGetCorePosition
- // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
- add r0, r0, #1
-
- // StackOffset = CorePos * StackSize
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)
- mul r0, r0, r2
- // SP = StackBase + StackOffset
- add sp, r6, r0
-
-_PrepareArguments
- // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
- LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2)
- add r2, r2, #4
- ldr r1, [r2]
-
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr r3, StartupAddr
-
- // Jump to PrePeiCore C code
- // r0 = mp_id
- // r1 = pei_core_address
- mov r0, r5
- blx r3
-
-_SetupPrimaryCoreStack
- // r1 contains the top of the primary stack
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2)
-
- // The reserved space for global variable must be 8-bytes aligned for pushing
- // 64-bit variable on the stack
- SetPrimaryStack (r1, r2, r3)
- b _PrepareArguments
-
-_NeverReturn
- b _NeverReturn
-
- END
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
deleted file mode 100644
index 509dc205d9..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-.text
-.align 3
-
-GCC_ASM_EXPORT(SecSwitchStack)
-
-
-
-#/**
-# This allows the caller to switch the stack and return
-#
-# @param StackDelta Signed amount by which to modify the stack pointer
-#
-# @return Nothing. Goes to the Entry Point passing in the new parameters
-#
-#**/
-#VOID
-#EFIAPI
-#SecSwitchStack (
-# VOID *StackDelta
-# )#
-#
-ASM_PFX(SecSwitchStack):
- mov R1, R13
- add R1, R0, R1
- mov R13, R1
- bx LR
-
-
-
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm
deleted file mode 100644
index cb1308feab..0000000000
--- a/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-;------------------------------------------------------------------------------
-
- EXPORT SecSwitchStack
-
- AREA Switch_Stack, CODE, READONLY
-
-;/**
-; This allows the caller to switch the stack and return
-;
-; @param StackDelta Signed amount by which to modify the stack pointer
-;
-; @return Nothing. Goes to the Entry Point passing in the new parameters
-;
-;**/
-;VOID
-;EFIAPI
-;SecSwitchStack (
-; VOID *StackDelta
-; );
-;
-SecSwitchStack
- MOV R1, SP
- ADD R1, R0, R1
- MOV SP, R1
- BX LR
- END
diff --git a/ArmPlatformPkg/PrePeiCore/MainMPCore.c b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
deleted file mode 100644
index a86f739fd1..0000000000
--- a/ArmPlatformPkg/PrePeiCore/MainMPCore.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmGicLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-#include "PrePeiCore.h"
-
-/*
- * This is the main function for secondary cores. They loop around until a non Null value is written to
- * SYS_FLAGS register.The SYS_FLAGS register is platform specific.
- * Note:The secondary cores, while executing secondary_main, assumes that:
- * : SGI 0 is configured as Non-secure interrupt
- * : Priority Mask is configured to allow SGI 0
- * : Interrupt Distributor and CPU interfaces are enabled
- *
- */
-VOID
-EFIAPI
-SecondaryMain (
- IN UINTN MpId
- )
-{
- EFI_STATUS Status;
- UINTN PpiListSize;
- UINTN PpiListCount;
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
- ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
- UINTN Index;
- UINTN ArmCoreCount;
- ARM_CORE_INFO *ArmCoreInfoTable;
- UINT32 ClusterId;
- UINT32 CoreId;
- VOID (*SecondaryStart)(VOID);
- UINTN SecondaryEntryAddr;
- UINTN AcknowledgeInterrupt;
- UINTN InterruptId;
-
- ClusterId = GET_CLUSTER_ID(MpId);
- CoreId = GET_CORE_ID(MpId);
-
- // Get the gArmMpCoreInfoPpiGuid
- PpiListSize = 0;
- ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);
- PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);
- for (Index = 0; Index < PpiListCount; Index++, PpiList++) {
- if (CompareGuid (PpiList->Guid, &gArmMpCoreInfoPpiGuid) == TRUE) {
- break;
- }
- }
-
- // On MP Core Platform we must implement the ARM MP Core Info PPI
- ASSERT (Index != PpiListCount);
-
- ArmMpCoreInfoPpi = PpiList->Ppi;
- ArmCoreCount = 0;
- Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
- ASSERT_EFI_ERROR (Status);
-
- // Find the core in the ArmCoreTable
- for (Index = 0; Index < ArmCoreCount; Index++) {
- if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) {
- break;
- }
- }
-
- // The ARM Core Info Table must define every core
- ASSERT (Index != ArmCoreCount);
-
- // Clear Secondary cores MailBox
- MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue);
-
- do {
- ArmCallWFI ();
-
- // Read the Mailbox
- SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress);
-
- // Acknowledge the interrupt and send End of Interrupt signal.
- AcknowledgeInterrupt = ArmGicAcknowledgeInterrupt (PcdGet32 (PcdGicInterruptInterfaceBase), &InterruptId);
- // Check if it is a valid interrupt ID
- if (InterruptId < ArmGicGetMaxNumInterrupts (PcdGet32 (PcdGicDistributorBase))) {
- // Got a valid SGI number hence signal End of Interrupt
- ArmGicEndOfInterrupt (PcdGet32 (PcdGicInterruptInterfaceBase), AcknowledgeInterrupt);
- }
- } while (SecondaryEntryAddr == 0);
-
- // Jump to secondary core entry point.
- SecondaryStart = (VOID (*)())SecondaryEntryAddr;
- SecondaryStart();
-
- // The secondaries shouldn't reach here
- ASSERT(FALSE);
-}
-
-VOID
-EFIAPI
-PrimaryMain (
- IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
- )
-{
- EFI_SEC_PEI_HAND_OFF SecCoreData;
- UINTN PpiListSize;
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
- UINTN TemporaryRamBase;
- UINTN TemporaryRamSize;
-
- CreatePpiList (&PpiListSize, &PpiList);
-
- // Enable the GIC Distributor
- ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase));
-
- // If ArmVe has not been built as Standalone then we need to wake up the secondary cores
- if (FeaturePcdGet (PcdSendSgiToBringUpSecondaryCores)) {
- // Sending SGI to all the Secondary CPU interfaces
- ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId));
- }
-
- // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
- // the base of the primary core stack
- PpiListSize = ALIGN_VALUE(PpiListSize, 0x4);
- TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize;
- TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
-
- // Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned
- // to ensure the stack pointer is 4-byte aligned.
- TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1));
-
- //
- // Bind this information into the SEC hand-off state
- // Note: this must be in sync with the stuff in the asm file
- // Note also: HOBs (pei temp ram) MUST be above stack
- //
- SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
- SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet64 (PcdFvBaseAddress);
- SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
- SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)
- SecCoreData.TemporaryRamSize = TemporaryRamSize;
- SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
- SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
- SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4);
- SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
-
- // Jump to PEI core entry point
- PeiCoreEntryPoint (&SecCoreData, PpiList);
-}
diff --git a/ArmPlatformPkg/PrePeiCore/MainUniCore.c b/ArmPlatformPkg/PrePeiCore/MainUniCore.c
deleted file mode 100644
index 6317f178ca..0000000000
--- a/ArmPlatformPkg/PrePeiCore/MainUniCore.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PrePeiCore.h"
-
-VOID
-EFIAPI
-SecondaryMain (
- IN UINTN MpId
- )
-{
- ASSERT(FALSE);
-}
-
-VOID
-EFIAPI
-PrimaryMain (
- IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
- )
-{
- EFI_SEC_PEI_HAND_OFF SecCoreData;
- UINTN PpiListSize;
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
- UINTN TemporaryRamBase;
- UINTN TemporaryRamSize;
-
- CreatePpiList (&PpiListSize, &PpiList);
-
- // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
- // the base of the primary core stack
- PpiListSize = ALIGN_VALUE(PpiListSize, 0x4);
- TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize;
- TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
-
- // Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned
- // to ensure the stack pointer is 4-byte aligned.
- TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1));
-
- //
- // Bind this information into the SEC hand-off state
- // Note: this must be in sync with the stuff in the asm file
- // Note also: HOBs (pei temp ram) MUST be above stack
- //
- SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
- SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet64 (PcdFvBaseAddress);
- SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
- SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)
- SecCoreData.TemporaryRamSize = TemporaryRamSize;
- SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
- SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
- SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4);
- SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
-
- // Jump to PEI core entry point
- (PeiCoreEntryPoint)(&SecCoreData, PpiList);
-}
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
deleted file mode 100644
index 491d7a6f85..0000000000
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/** @file
-* Main file supporting the transition to PEI Core in Normal World for Versatile Express
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/DebugAgentLib.h>
-#include <Library/ArmLib.h>
-
-#include <Ppi/ArmGlobalVariable.h>
-
-#include "PrePeiCore.h"
-
-CONST EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi = { PrePeiCoreTemporaryRamSupport };
-CONST ARM_GLOBAL_VARIABLE_PPI mGlobalVariablePpi = { PrePeiCoreGetGlobalVariableMemory };
-
-CONST EFI_PEI_PPI_DESCRIPTOR gCommonPpiTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gEfiTemporaryRamSupportPpiGuid,
- (VOID *) &mTemporaryRamSupportPpi
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gArmGlobalVariablePpiGuid,
- (VOID *) &mGlobalVariablePpi
- }
-};
-
-VOID
-CreatePpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- )
-{
- EFI_PEI_PPI_DESCRIPTOR *PlatformPpiList;
- UINTN PlatformPpiListSize;
- UINTN ListBase;
- EFI_PEI_PPI_DESCRIPTOR *LastPpi;
-
- // Get the Platform PPIs
- PlatformPpiListSize = 0;
- ArmPlatformGetPlatformPpiList (&PlatformPpiListSize, &PlatformPpiList);
-
- // Copy the Common and Platform PPis in Temporrary Memory
- ListBase = PcdGet64 (PcdCPUCoresStackBase);
- CopyMem ((VOID*)ListBase, gCommonPpiTable, sizeof(gCommonPpiTable));
- CopyMem ((VOID*)(ListBase + sizeof(gCommonPpiTable)), PlatformPpiList, PlatformPpiListSize);
-
- // Set the Terminate flag on the last PPI entry
- LastPpi = (EFI_PEI_PPI_DESCRIPTOR*)ListBase + ((sizeof(gCommonPpiTable) + PlatformPpiListSize) / sizeof(EFI_PEI_PPI_DESCRIPTOR)) - 1;
- LastPpi->Flags |= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
-
- *PpiList = (EFI_PEI_PPI_DESCRIPTOR*)ListBase;
- *PpiListSize = sizeof(gCommonPpiTable) + PlatformPpiListSize;
-}
-
-VOID
-CEntryPoint (
- IN UINTN MpId,
- IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
- )
-{
- // Data Cache enabled on Primary core when MMU is enabled.
- ArmDisableDataCache ();
- // Invalidate Data cache
- ArmInvalidateDataCache ();
- // Invalidate instruction cache
- ArmInvalidateInstructionCache ();
- // Enable Instruction Caches on all cores.
- ArmEnableInstructionCache ();
-
- //
- // Note: Doesn't have to Enable CPU interface in non-secure world,
- // as Non-secure interface is already enabled in Secure world.
- //
-
- // Write VBAR - The Exception Vector table must be aligned to its requirement
- // Note: The AArch64 Vector table must be 2k-byte aligned - if this assertion fails ensure
- // 'Align=4K' is defined into your FDF for this module.
- ASSERT (((UINTN)PeiVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0);
- ArmWriteVBar ((UINTN)PeiVectorTable);
-
- //Note: The MMU will be enabled by MemoryPeim. Only the primary core will have the MMU on.
-
- // If not primary Jump to Secondary Main
- if (ArmPlatformIsPrimaryCore (MpId)) {
- // Initialize the Debug Agent for Source Level Debugging
- InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);
- SaveAndSetDebugTimerInterrupt (TRUE);
-
- // Initialize the platform specific controllers
- ArmPlatformInitialize (MpId);
-
- // Goto primary Main.
- PrimaryMain (PeiCoreEntryPoint);
- } else {
- SecondaryMain (MpId);
- }
-
- // PEI Core should always load and never return
- ASSERT (FALSE);
-}
-
-EFI_STATUS
-EFIAPI
-PrePeiCoreTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- )
-{
- VOID *OldHeap;
- VOID *NewHeap;
- VOID *OldStack;
- VOID *NewStack;
-
- OldHeap = (VOID*)(UINTN)TemporaryMemoryBase;
- NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize >> 1));
-
- OldStack = (VOID*)((UINTN)TemporaryMemoryBase + (CopySize >> 1));
- NewStack = (VOID*)(UINTN)PermanentMemoryBase;
-
- //
- // Migrate the temporary memory stack to permanent memory stack.
- //
- CopyMem (NewStack, OldStack, CopySize >> 1);
-
- //
- // Migrate the temporary memory heap to permanent memory heap.
- //
- CopyMem (NewHeap, OldHeap, CopySize >> 1);
-
- SecSwitchStack ((UINTN)NewStack - (UINTN)OldStack);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PrePeiCoreGetGlobalVariableMemory (
- OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase
- )
-{
- ASSERT (GlobalVariableBase != NULL);
-
- *GlobalVariableBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) +
- (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) -
- (UINTN)PcdGet32 (PcdPeiGlobalVariableSize);
-
- return EFI_SUCCESS;
-}
-
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
deleted file mode 100644
index 20684e2f90..0000000000
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/** @file
-* Main file supporting the transition to PEI Core in Normal World for Versatile Express
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-#ifndef __PREPEICORE_H_
-#define __PREPEICORE_H_
-
-#include <Library/ArmLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-
-#include <PiPei.h>
-#include <Ppi/TemporaryRamSupport.h>
-
-VOID
-CreatePpiList (
- OUT UINTN *PpiListSize,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
- );
-
-EFI_STATUS
-EFIAPI
-PrePeiCoreTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- );
-
-EFI_STATUS
-PrePeiCoreGetGlobalVariableMemory (
- OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase
- );
-
-VOID
-SecSwitchStack (
- INTN StackDelta
- );
-
-// Vector Table for Pei Phase
-VOID PeiVectorTable (VOID);
-
-VOID
-EFIAPI
-PrimaryMain (
- IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
- );
-
-/*
- * This is the main function for secondary cores. They loop around until a non Null value is written to
- * SYS_FLAGS register.The SYS_FLAGS register is platform specific.
- * Note:The secondary cores, while executing secondary_main, assumes that:
- * : SGI 0 is configured as Non-secure interrupt
- * : Priority Mask is configured to allow SGI 0
- * : Interrupt Distributor and CPU interfaces are enabled
- *
- */
-VOID
-EFIAPI
-SecondaryMain (
- IN UINTN MpId
- );
-
-VOID
-PeiCommonExceptionEntry (
- IN UINT32 Entry,
- IN UINTN LR
- );
-
-#endif
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
deleted file mode 100644
index 5ba0231a3e..0000000000
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
+++ /dev/null
@@ -1,80 +0,0 @@
-#/** @file
-# Pre PeiCore - Hand-off to PEI Core in Normal World
-#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformPrePeiCore
- FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-[Sources.common]
- MainMPCore.c
- PrePeiCore.c
-
-[Sources.ARM]
- Arm/ArchPrePeiCore.c
- Arm/PrePeiCoreEntryPoint.asm | RVCT
- Arm/PrePeiCoreEntryPoint.S | GCC
- Arm/SwitchStack.asm | RVCT
- Arm/SwitchStack.S | GCC
- Arm/Exception.asm | RVCT
- Arm/Exception.S | GCC
-
-[Sources.AARCH64]
- AArch64/ArchPrePeiCore.c
- AArch64/PrePeiCoreEntryPoint.S
- AArch64/SwitchStack.S
- AArch64/Exception.S
- AArch64/Helper.S
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- ArmPlatformLib
- BaseLib
- DebugLib
- DebugAgentLib
- IoLib
- ArmGicLib
- PrintLib
- SerialPortLib
-
-[Ppis]
- gEfiTemporaryRamSupportPpiGuid
- gArmGlobalVariablePpiGuid
- gArmMpCoreInfoPpiGuid
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdFvSize
-
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
-
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
- gArmTokenSpaceGuid.PcdGicDistributorBase
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
- gArmTokenSpaceGuid.PcdGicSgiIntId
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
deleted file mode 100644
index d677f150e9..0000000000
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+++ /dev/null
@@ -1,74 +0,0 @@
-#/** @file
-# Pre PeiCore - Hand-off to PEI Core in Normal World
-#
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformPrePeiCore
- FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-[Sources.common]
- PrePeiCore.c
- MainUniCore.c
-
-[Sources.ARM]
- Arm/ArchPrePeiCore.c
- Arm/PrePeiCoreEntryPoint.asm | RVCT
- Arm/PrePeiCoreEntryPoint.S | GCC
- Arm/SwitchStack.asm | RVCT
- Arm/SwitchStack.S | GCC
- Arm/Exception.asm | RVCT
- Arm/Exception.S | GCC
-
-[Sources.AARCH64]
- AArch64/ArchPrePeiCore.c
- AArch64/PrePeiCoreEntryPoint.S
- AArch64/SwitchStack.S
- AArch64/Exception.S
- AArch64/Helper.S
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmLib
- ArmPlatformLib
- BaseLib
- DebugLib
- DebugAgentLib
- IoLib
- PrintLib
- SerialPortLib
-
-[Ppis]
- gEfiTemporaryRamSupportPpiGuid
- gArmGlobalVariablePpiGuid
-
-[FeaturePcd]
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdFvSize
-
- gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
-
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
diff --git a/ArmPlatformPkg/PrePi/AArch64/ArchPrePi.c b/ArmPlatformPkg/PrePi/AArch64/ArchPrePi.c
deleted file mode 100644
index 217986107e..0000000000
--- a/ArmPlatformPkg/PrePi/AArch64/ArchPrePi.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PrePi.h"
-
-#include <Chipset/AArch64.h>
-
-VOID
-ArchInitialize (
- VOID
- )
-{
- // Enable Floating Point
- if (FixedPcdGet32 (PcdVFPEnabled)) {
- ArmEnableVFP ();
- }
-
- if (ArmReadCurrentEL () == AARCH64_EL2) {
- // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
- ArmWriteHcr (ARM_HCR_TGE);
- }
-}
diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
deleted file mode 100644
index 0d0e3e17c1..0000000000
--- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLibV8.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-.text
-.align 3
-
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
-GCC_ASM_IMPORT(ArmPlatformStackSet)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)
-
-StartupAddr: .8byte ASM_PFX(CEntryPoint)
-ASM_PFX(mSystemMemoryEnd): .8byte 0
-
-ASM_PFX(_ModuleEntryPoint):
- // Do early platform specific actions
- bl ASM_PFX(ArmPlatformPeiBootAction)
-
- // Get ID of this CPU in Multicore system
- bl ASM_PFX(ArmReadMpidr)
- // Keep a copy of the MpId register value
- mov x10, x0
-
-_SetSVCMode:
-// Check if we can install the stack at the top of the System Memory or if we need
-// to install the stacks at the bottom of the Firmware Device (case the FD is located
-// at the top of the DRAM)
-_SystemMemoryEndInit:
- ldr x1, mSystemMemoryEnd
-
- // Is mSystemMemoryEnd initialized?
- cmp x1, #0
- bne _SetupStackPosition
-
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), x1)
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), x2)
- sub x2, x2, #1
- add x1, x1, x2
- // Update the global variable
- adr x2, mSystemMemoryEnd
- str x1, [x2]
-
-_SetupStackPosition:
- // r1 = SystemMemoryTop
-
- // Calculate Top of the Firmware Device
- LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2)
- LoadConstantToReg (FixedPcdGet32(PcdFdSize), x3)
- sub x3, x3, #1
- add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize
-
- // UEFI Memory Size (stacks are allocated in this region)
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), x4)
-
- //
- // Reserve the memory for the UEFI region (contain stacks on its top)
- //
-
- // Calculate how much space there is between the top of the Firmware and the Top of the System Memory
- subs x0, x1, x3 // x0 = SystemMemoryTop - FdTop
- b.mi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM
- cmp x0, x4
- b.ge _SetupStack
-
- // Case the top of stacks is the FdBaseAddress
- mov x1, x2
-
-_SetupStack:
- // x1 contains the top of the stack (and the UEFI Memory)
-
- // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment
- // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the
- // top of the memory space)
- adds x11, x1, #1
- b.cs _SetupOverflowStack
-
-_SetupAlignedStack:
- mov x1, x11
- b _GetBaseUefiMemory
-
-_SetupOverflowStack:
- // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE
- // aligned (4KB)
- LoadConstantToReg (EFI_PAGE_MASK, x11)
- and x11, x11, x1
- sub x1, x1, x11
-
-_GetBaseUefiMemory:
- // Calculate the Base of the UEFI Memory
- sub x11, x1, x4
-
-_GetStackBase:
- // r1 = The top of the Mpcore Stacks
- // Stack for the primary core = PrimaryCoreStack
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)
- sub x12, x1, x2
-
- // Stack for the secondary core = Number of Cores - 1
- LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0)
- sub x0, x0, #1
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1)
- mul x1, x1, x0
- sub x12, x12, x1
-
- // x12 = The base of the MpCore Stacks (primary stack & secondary stacks)
- mov x0, x12
- mov x1, x10
- //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x3)
- bl ASM_PFX(ArmPlatformStackSet)
-
- // Is it the Primary Core ?
- mov x0, x10
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
- cmp x0, #1
- bne _PrepareArguments
-
-_ReserveGlobalVariable:
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x0)
- // InitializePrimaryStack($GlobalVariableSize, $Tmp1, $Tmp2)
- InitializePrimaryStack(x0, x1, x2)
-
-_PrepareArguments:
- mov x0, x10
- mov x1, x11
- mov x2, x12
- mov x3, sp
-
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr x4, StartupAddr
-
- // Jump to PrePiCore C code
- // x0 = MpId
- // x1 = UefiMemoryBase
- // x2 = StacksBase
- // x3 = GlobalVariableBase
- blr x4
-
-_NeverReturn:
- b _NeverReturn
diff --git a/ArmPlatformPkg/PrePi/Arm/ArchPrePi.c b/ArmPlatformPkg/PrePi/Arm/ArchPrePi.c
deleted file mode 100644
index 075eb89e1b..0000000000
--- a/ArmPlatformPkg/PrePi/Arm/ArchPrePi.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PrePi.h"
-
-VOID
-ArchInitialize (
- VOID
- )
-{
- // Enable program flow prediction, if supported.
- ArmEnableBranchPrediction ();
-
- if (FixedPcdGet32 (PcdVFPEnabled)) {
- ArmEnableVFP ();
- }
-}
-
diff --git a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
deleted file mode 100644
index f64934480f..0000000000
--- a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-#include <Chipset/ArmV7.h>
-
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
-GCC_ASM_IMPORT(ArmPlatformStackSet)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-GCC_ASM_EXPORT(mSystemMemoryEnd)
-
-StartupAddr: .word CEntryPoint
-mSystemMemoryEnd: .8byte 0
-
-
-ASM_PFX(_ModuleEntryPoint):
- // Do early platform specific actions
- bl ASM_PFX(ArmPlatformPeiBootAction)
-
- // Get ID of this CPU in Multicore system
- bl ASM_PFX(ArmReadMpidr)
- // Keep a copy of the MpId register value
- mov r8, r0
-
-_SetSVCMode:
- // Enter SVC mode, Disable FIQ and IRQ
- mov r1, #(CPSR_MODE_SVC | CPSR_IRQ | CPSR_FIQ)
- msr CPSR_c, r1
-
-// Check if we can install the stack at the top of the System Memory or if we need
-// to install the stacks at the bottom of the Firmware Device (case the FD is located
-// at the top of the DRAM)
-_SystemMemoryEndInit:
- ldr r1, mSystemMemoryEnd
-
- // Is mSystemMemoryEnd initialized?
- cmp r1, #0
- bne _SetupStackPosition
-
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), r2)
- sub r2, r2, #1
- add r1, r1, r2
- // Update the global variable
- adr r2, mSystemMemoryEnd
- str r1, [r2]
-
-_SetupStackPosition:
- // r1 = SystemMemoryTop
-
- // Calculate Top of the Firmware Device
- LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2)
- LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3)
- sub r3, r3, #1
- add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize
-
- // UEFI Memory Size (stacks are allocated in this region)
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4)
-
- //
- // Reserve the memory for the UEFI region (contain stacks on its top)
- //
-
- // Calculate how much space there is between the top of the Firmware and the Top of the System Memory
- subs r0, r1, r3 // r0 = SystemMemoryTop - FdTop
- bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM
- cmp r0, r4
- bge _SetupStack
-
- // Case the top of stacks is the FdBaseAddress
- mov r1, r2
-
-_SetupStack:
- // r1 contains the top of the stack (and the UEFI Memory)
-
- // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment
- // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the
- // top of the memory space)
- adds r9, r1, #1
- bcs _SetupOverflowStack
-
-_SetupAlignedStack:
- mov r1, r9
- b _GetBaseUefiMemory
-
-_SetupOverflowStack:
- // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE
- // aligned (4KB)
- LoadConstantToReg (EFI_PAGE_MASK, r9)
- and r9, r9, r1
- sub r1, r1, r9
-
-_GetBaseUefiMemory:
- // Calculate the Base of the UEFI Memory
- sub r9, r1, r4
-
-_GetStackBase:
- // r1 = The top of the Mpcore Stacks
- // Stack for the primary core = PrimaryCoreStack
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
- sub r10, r1, r2
-
- // Stack for the secondary core = Number of Cores - 1
- LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0)
- sub r0, r0, #1
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1)
- mul r1, r1, r0
- sub r10, r10, r1
-
- // r10 = The base of the MpCore Stacks (primary stack & secondary stacks)
- mov r0, r10
- mov r1, r8
- //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3)
- bl ASM_PFX(ArmPlatformStackSet)
-
- // Is it the Primary Core ?
- mov r0, r8
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
- cmp r0, #1
- bne _PrepareArguments
-
-_ReserveGlobalVariable:
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r0)
- // InitializePrimaryStack($GlobalVariableSize, $Tmp1)
- InitializePrimaryStack(r0, r1)
-
-_PrepareArguments:
- mov r0, r8
- mov r1, r9
- mov r2, r10
- mov r3, sp
-
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr r4, StartupAddr
-
- // Jump to PrePiCore C code
- // r0 = MpId
- // r1 = UefiMemoryBase
- // r2 = StacksBase
- // r3 = GlobalVariableBase
- blx r4
-
-_NeverReturn:
- b _NeverReturn
-
diff --git a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
deleted file mode 100644
index f73c56850d..0000000000
--- a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
+++ /dev/null
@@ -1,171 +0,0 @@
-//
-// Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AsmMacroIoLib.h>
-#include <Base.h>
-#include <Library/PcdLib.h>
-#include <AutoGen.h>
-
-#include <Chipset/ArmV7.h>
-
- INCLUDE AsmMacroIoLib.inc
-
- IMPORT CEntryPoint
- IMPORT ArmPlatformIsPrimaryCore
- IMPORT ArmReadMpidr
- IMPORT ArmPlatformPeiBootAction
- IMPORT ArmPlatformStackSet
-
- EXPORT _ModuleEntryPoint
- EXPORT mSystemMemoryEnd
-
- PRESERVE8
- AREA PrePiCoreEntryPoint, CODE, READONLY
-
-StartupAddr DCD CEntryPoint
-mSystemMemoryEnd DCQ 0
-
-_ModuleEntryPoint
- // Do early platform specific actions
- bl ArmPlatformPeiBootAction
-
- // Get ID of this CPU in Multicore system
- bl ArmReadMpidr
- // Keep a copy of the MpId register value
- mov r8, r0
-
-_SetSVCMode
- // Enter SVC mode, Disable FIQ and IRQ
- mov r1, #(CPSR_MODE_SVC :OR: CPSR_IRQ :OR: CPSR_FIQ)
- msr CPSR_c, r1
-
-// Check if we can install the stack at the top of the System Memory or if we need
-// to install the stacks at the bottom of the Firmware Device (case the FD is located
-// at the top of the DRAM)
-_SystemMemoryEndInit
- ldr r1, mSystemMemoryEnd
-
- // Is mSystemMemoryEnd initialized?
- cmp r1, #0
- bne _SetupStackPosition
-
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), r2)
- sub r2, r2, #1
- add r1, r1, r2
- // Update the global variable
- adr r2, mSystemMemoryEnd
- str r1, [r2]
-
-_SetupStackPosition
- // r1 = SystemMemoryTop
-
- // Calculate Top of the Firmware Device
- LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2)
- LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3)
- sub r3, r3, #1
- add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize
-
- // UEFI Memory Size (stacks are allocated in this region)
- LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4)
-
- //
- // Reserve the memory for the UEFI region (contain stacks on its top)
- //
-
- // Calculate how much space there is between the top of the Firmware and the Top of the System Memory
- subs r0, r1, r3 // r0 = SystemMemoryTop - FdTop
- bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM
- cmp r0, r4
- bge _SetupStack
-
- // Case the top of stacks is the FdBaseAddress
- mov r1, r2
-
-_SetupStack
- // r1 contains the top of the stack (and the UEFI Memory)
-
- // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment
- // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the
- // top of the memory space)
- adds r9, r1, #1
- bcs _SetupOverflowStack
-
-_SetupAlignedStack
- mov r1, r9
- b _GetBaseUefiMemory
-
-_SetupOverflowStack
- // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE
- // aligned (4KB)
- LoadConstantToReg (EFI_PAGE_MASK, r9)
- and r9, r9, r1
- sub r1, r1, r9
-
-_GetBaseUefiMemory
- // Calculate the Base of the UEFI Memory
- sub r9, r1, r4
-
-_GetStackBase
- // r1 = The top of the Mpcore Stacks
- // Stack for the primary core = PrimaryCoreStack
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
- sub r10, r1, r2
-
- // Stack for the secondary core = Number of Cores - 1
- LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0)
- sub r0, r0, #1
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1)
- mul r1, r1, r0
- sub r10, r10, r1
-
- // r10 = The base of the MpCore Stacks (primary stack & secondary stacks)
- mov r0, r10
- mov r1, r8
- //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3)
- bl ArmPlatformStackSet
-
- // Is it the Primary Core ?
- mov r0, r8
- bl ArmPlatformIsPrimaryCore
- cmp r0, #1
- bne _PrepareArguments
-
-_ReserveGlobalVariable
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r0)
- // InitializePrimaryStack($GlobalVariableSize, $Tmp1)
- InitializePrimaryStack r0, r1
-
-_PrepareArguments
- mov r0, r8
- mov r1, r9
- mov r2, r10
- mov r3, sp
-
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr r4, StartupAddr
-
- // Jump to PrePiCore C code
- // r0 = MpId
- // r1 = UefiMemoryBase
- // r2 = StacksBase
- // r3 = GlobalVariableBase
- blx r4
-
-_NeverReturn
- b _NeverReturn
-
- END
diff --git a/ArmPlatformPkg/PrePi/LzmaDecompress.h b/ArmPlatformPkg/PrePi/LzmaDecompress.h
deleted file mode 100644
index a79ff343d2..0000000000
--- a/ArmPlatformPkg/PrePi/LzmaDecompress.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- LZMA Decompress Library header file
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __LZMA_DECOMPRESS_H___
-#define __LZMA_DECOMPRESS_H___
-
-/**
- Examines a GUIDed section and returns the size of the decoded buffer and the
- size of an scratch buffer required to actually decode the data in a GUIDed section.
-
- Examines a GUIDed section specified by InputSection.
- If GUID for InputSection does not match the GUID that this handler supports,
- then RETURN_UNSUPPORTED is returned.
- If the required information can not be retrieved from InputSection,
- then RETURN_INVALID_PARAMETER is returned.
- If the GUID of InputSection does match the GUID that this handler supports,
- then the size required to hold the decoded buffer is returned in OututBufferSize,
- the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field
- from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.
-
- If InputSection is NULL, then ASSERT().
- If OutputBufferSize is NULL, then ASSERT().
- If ScratchBufferSize is NULL, then ASSERT().
- If SectionAttribute is NULL, then ASSERT().
-
-
- @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.
- @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required
- if the buffer specified by InputSection were decoded.
- @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space
- if the buffer specified by InputSection were decoded.
- @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes
- field of EFI_GUID_DEFINED_SECTION in the PI Specification.
-
- @retval RETURN_SUCCESS The information about InputSection was returned.
- @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.
- @retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection.
-
-**/
-RETURN_STATUS
-EFIAPI
-LzmaGuidedSectionGetInfo (
- IN CONST VOID *InputSection,
- OUT UINT32 *OutputBufferSize,
- OUT UINT32 *ScratchBufferSize,
- OUT UINT16 *SectionAttribute
- );
-
-/**
- Decompress a LZAM compressed GUIDed section into a caller allocated output buffer.
-
- Decodes the GUIDed section specified by InputSection.
- If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned.
- If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.
- If the GUID of InputSection does match the GUID that this handler supports, then InputSection
- is decoded into the buffer specified by OutputBuffer and the authentication status of this
- decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the
- data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise,
- the decoded data will be placed in caller allocated buffer specified by OutputBuffer.
-
- If InputSection is NULL, then ASSERT().
- If OutputBuffer is NULL, then ASSERT().
- If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().
- If AuthenticationStatus is NULL, then ASSERT().
-
-
- @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.
- @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation.
- @param[out] ScratchBuffer A caller allocated buffer that may be required by this function
- as a scratch buffer to perform the decode operation.
- @param[out] AuthenticationStatus
- A pointer to the authentication status of the decoded output buffer.
- See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
- section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must
- never be set by this handler.
-
- @retval RETURN_SUCCESS The buffer specified by InputSection was decoded.
- @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.
- @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.
-
-**/
-RETURN_STATUS
-EFIAPI
-LzmaGuidedSectionExtraction (
- IN CONST VOID *InputSection,
- OUT VOID **OutputBuffer,
- OUT VOID *ScratchBuffer, OPTIONAL
- OUT UINT32 *AuthenticationStatus
- );
-
-#endif // __LZMADECOMPRESS_H__
-
diff --git a/ArmPlatformPkg/PrePi/MainMPCore.c b/ArmPlatformPkg/PrePi/MainMPCore.c
deleted file mode 100644
index bf813730d3..0000000000
--- a/ArmPlatformPkg/PrePi/MainMPCore.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PrePi.h"
-
-#include <Library/ArmGicLib.h>
-
-#include <Ppi/ArmMpCoreInfo.h>
-
-VOID
-PrimaryMain (
- IN UINTN UefiMemoryBase,
- IN UINTN StacksBase,
- IN UINTN GlobalVariableBase,
- IN UINT64 StartTimeStamp
- )
-{
- // Enable the GIC Distributor
- ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));
-
- // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader to resume their initialization
- if (!FixedPcdGet32(PcdSendSgiToBringUpSecondaryCores)) {
- // Sending SGI to all the Secondary CPU interfaces
- ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId));
- }
-
- PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);
-
- // We must never return
- ASSERT(FALSE);
-}
-
-VOID
-SecondaryMain (
- IN UINTN MpId
- )
-{
- EFI_STATUS Status;
- ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
- UINTN Index;
- UINTN ArmCoreCount;
- ARM_CORE_INFO *ArmCoreInfoTable;
- UINT32 ClusterId;
- UINT32 CoreId;
- VOID (*SecondaryStart)(VOID);
- UINTN SecondaryEntryAddr;
- UINTN AcknowledgeInterrupt;
- UINTN InterruptId;
-
- ClusterId = GET_CLUSTER_ID(MpId);
- CoreId = GET_CORE_ID(MpId);
-
- // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)
- Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi);
- ASSERT_EFI_ERROR (Status);
-
- ArmCoreCount = 0;
- Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
- ASSERT_EFI_ERROR (Status);
-
- // Find the core in the ArmCoreTable
- for (Index = 0; Index < ArmCoreCount; Index++) {
- if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) {
- break;
- }
- }
-
- // The ARM Core Info Table must define every core
- ASSERT (Index != ArmCoreCount);
-
- // Clear Secondary cores MailBox
- MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue);
-
- do {
- ArmCallWFI ();
-
- // Read the Mailbox
- SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress);
-
- // Acknowledge the interrupt and send End of Interrupt signal.
- AcknowledgeInterrupt = ArmGicAcknowledgeInterrupt (PcdGet32 (PcdGicInterruptInterfaceBase), &InterruptId);
- // Check if it is a valid interrupt ID
- if (InterruptId < ArmGicGetMaxNumInterrupts (PcdGet32 (PcdGicDistributorBase))) {
- // Got a valid SGI number hence signal End of Interrupt
- ArmGicEndOfInterrupt (PcdGet32 (PcdGicInterruptInterfaceBase), AcknowledgeInterrupt);
- }
- } while (SecondaryEntryAddr == 0);
-
- // Jump to secondary core entry point.
- SecondaryStart = (VOID (*)())SecondaryEntryAddr;
- SecondaryStart();
-
- // The secondaries shouldn't reach here
- ASSERT(FALSE);
-}
diff --git a/ArmPlatformPkg/PrePi/MainUniCore.c b/ArmPlatformPkg/PrePi/MainUniCore.c
deleted file mode 100644
index 43588a50dd..0000000000
--- a/ArmPlatformPkg/PrePi/MainUniCore.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include "PrePi.h"
-
-VOID
-PrimaryMain (
- IN UINTN UefiMemoryBase,
- IN UINTN StacksBase,
- IN UINTN GlobalVariableBase,
- IN UINT64 StartTimeStamp
- )
-{
- DEBUG_CODE_BEGIN();
- // On MPCore system, PeiMpCore.inf should be used instead of PeiUniCore.inf
- ASSERT(ArmIsMpCore() == 0);
- DEBUG_CODE_END();
-
- PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);
-
- // We must never return
- ASSERT(FALSE);
-}
-
-VOID
-SecondaryMain (
- IN UINTN MpId
- )
-{
- // We must never get into this function on UniCore system
- ASSERT(FALSE);
-}
-
diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiMPCore.inf
deleted file mode 100755
index ac1f8d0391..0000000000
--- a/ArmPlatformPkg/PrePi/PeiMPCore.inf
+++ /dev/null
@@ -1,116 +0,0 @@
-#/** @file
-#
-# (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformPrePiMPCore
- FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-[Sources]
- PrePi.c
- MainMPCore.c
-
-[Sources.ARM]
- Arm/ArchPrePi.c
- Arm/ModuleEntryPoint.S | GCC
- Arm/ModuleEntryPoint.asm | RVCT
-
-[Sources.AArch64]
- AArch64/ArchPrePi.c
- AArch64/ModuleEntryPoint.S
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- DebugAgentLib
- ArmLib
- ArmGicLib
- IoLib
- TimerLib
- SerialPortLib
- ExtractGuidedSectionLib
- LzmaDecompressLib
- PeCoffGetEntryPointLib
- DebugAgentLib
- PrePiLib
- ArmPlatformLib
- ArmPlatformStackLib
- MemoryAllocationLib
- HobLib
- PrePiHobListPointerLib
- PlatformPeiLib
- MemoryInitPeiLib
-
-[Ppis]
- gArmMpCoreInfoPpiGuid
-
-[Guids]
- gArmGlobalVariableGuid
- gArmMpCoreInfoGuid
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdVFPEnabled
-
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdFvSize
-
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
-
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
- gArmTokenSpaceGuid.PcdGicDistributorBase
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
- gArmTokenSpaceGuid.PcdGicSgiIntId
-
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount
-
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize
-
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData
-
diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/PeiUniCore.inf
deleted file mode 100755
index c5663901c9..0000000000
--- a/ArmPlatformPkg/PrePi/PeiUniCore.inf
+++ /dev/null
@@ -1,112 +0,0 @@
-#/** @file
-#
-# (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformPrePiUniCore
- FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-[Sources]
- PrePi.c
- MainUniCore.c
-
-[Sources.ARM]
- Arm/ArchPrePi.c
- Arm/ModuleEntryPoint.S | GCC
- Arm/ModuleEntryPoint.asm | RVCT
-
-[Sources.AArch64]
- AArch64/ArchPrePi.c
- AArch64/ModuleEntryPoint.S
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- DebugAgentLib
- ArmLib
- IoLib
- TimerLib
- SerialPortLib
- ExtractGuidedSectionLib
- LzmaDecompressLib
- PeCoffGetEntryPointLib
- DebugAgentLib
- PrePiLib
- ArmPlatformLib
- ArmPlatformStackLib
- MemoryAllocationLib
- HobLib
- PrePiHobListPointerLib
- PlatformPeiLib
- MemoryInitPeiLib
-
-[Ppis]
- gArmMpCoreInfoPpiGuid
-
-[Guids]
- gArmGlobalVariableGuid
- gArmMpCoreInfoGuid
-
-[FeaturePcd]
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob
- gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdVFPEnabled
-
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
-
- gArmTokenSpaceGuid.PcdFvBaseAddress
- gArmTokenSpaceGuid.PcdFvSize
-
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
-
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
-
- gArmPlatformTokenSpaceGuid.PcdCoreCount
-
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize
-
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData
-
-[Pcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c
deleted file mode 100755
index 99afe6fa90..0000000000
--- a/ArmPlatformPkg/PrePi/PrePi.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <PiPei.h>
-
-#include <Library/DebugAgentLib.h>
-#include <Library/PrePiLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PeCoffGetEntryPointLib.h>
-#include <Library/PrePiHobListPointerLib.h>
-#include <Library/TimerLib.h>
-#include <Library/PerformanceLib.h>
-
-#include <Ppi/GuidedSectionExtraction.h>
-#include <Ppi/ArmMpCoreInfo.h>
-#include <Guid/LzmaDecompress.h>
-#include <Guid/ArmGlobalVariableHob.h>
-
-#include "PrePi.h"
-#include "LzmaDecompress.h"
-
-#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > mSystemMemoryEnd) || \
- ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase)))
-
-// Not used when PrePi in run in XIP mode
-UINTN mGlobalVariableBase = 0;
-
-EFI_STATUS
-EFIAPI
-ExtractGuidedSectionLibConstructor (
- VOID
- );
-
-EFI_STATUS
-EFIAPI
-LzmaDecompressLibConstructor (
- VOID
- );
-
-VOID
-EFIAPI
-BuildGlobalVariableHob (
- IN EFI_PHYSICAL_ADDRESS GlobalVariableBase,
- IN UINT32 GlobalVariableSize
- )
-{
- ARM_HOB_GLOBAL_VARIABLE *Hob;
-
- Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE));
- ASSERT(Hob != NULL);
-
- CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid);
- Hob->GlobalVariableBase = GlobalVariableBase;
- Hob->GlobalVariableSize = GlobalVariableSize;
-}
-
-EFI_STATUS
-GetPlatformPpi (
- IN EFI_GUID *PpiGuid,
- OUT VOID **Ppi
- )
-{
- UINTN PpiListSize;
- UINTN PpiListCount;
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
- UINTN Index;
-
- PpiListSize = 0;
- ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);
- PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);
- for (Index = 0; Index < PpiListCount; Index++, PpiList++) {
- if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) {
- *Ppi = PpiList->Ppi;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-VOID
-PrePiMain (
- IN UINTN UefiMemoryBase,
- IN UINTN StacksBase,
- IN UINTN GlobalVariableBase,
- IN UINT64 StartTimeStamp
- )
-{
- EFI_HOB_HANDOFF_INFO_TABLE* HobList;
- ARM_MP_CORE_INFO_PPI* ArmMpCoreInfoPpi;
- UINTN ArmCoreCount;
- ARM_CORE_INFO* ArmCoreInfoTable;
- EFI_STATUS Status;
- CHAR8 Buffer[100];
- UINTN CharCount;
- UINTN StacksSize;
-
- // If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP)
- ASSERT (IS_XIP() ||
- ((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) &&
- ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)mSystemMemoryEnd)));
-
- // Initialize the architecture specific bits
- ArchInitialize ();
-
- // Initialize the Serial Port
- SerialPortInitialize ();
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r",
- (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
-
- // Initialize the Debug Agent for Source Level Debugging
- InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);
- SaveAndSetDebugTimerInterrupt (TRUE);
-
- // Declare the PI/UEFI memory region
- HobList = HobConstructor (
- (VOID*)UefiMemoryBase,
- FixedPcdGet32 (PcdSystemMemoryUefiRegionSize),
- (VOID*)UefiMemoryBase,
- (VOID*)StacksBase // The top of the UEFI Memory is reserved for the stacks
- );
- PrePeiSetHobList (HobList);
-
- // Initialize MMU and Memory HOBs (Resource Descriptor HOBs)
- Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));
- ASSERT_EFI_ERROR (Status);
-
- // Create the Stacks HOB (reserve the memory for all stacks)
- if (ArmIsMpCore ()) {
- StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) +
- ((FixedPcdGet32 (PcdCoreCount) - 1) * FixedPcdGet32 (PcdCPUCoreSecondaryStackSize));
- } else {
- StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize);
- }
- BuildStackHob (StacksBase, StacksSize);
-
- // Declare the Global Variable HOB
- BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));
-
- //TODO: Call CpuPei as a library
- BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
-
- if (ArmIsMpCore ()) {
- // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid
- Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi);
-
- // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)
- ASSERT_EFI_ERROR (Status);
-
- // Build the MP Core Info Table
- ArmCoreCount = 0;
- Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
- if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) {
- // Build MPCore Info HOB
- BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);
- }
- }
-
- // Set the Boot Mode
- SetBootMode (ArmPlatformGetBootMode ());
-
- // Initialize Platform HOBs (CpuHob and FvHob)
- Status = PlatformPeim ();
- ASSERT_EFI_ERROR (Status);
-
- // Now, the HOB List has been initialized, we can register performance information
- PERF_START (NULL, "PEI", NULL, StartTimeStamp);
-
- // SEC phase needs to run library constructors by hand.
- ExtractGuidedSectionLibConstructor ();
- LzmaDecompressLibConstructor ();
-
- // Build HOBs to pass up our version of stuff the DXE Core needs to save space
- BuildPeCoffLoaderHob ();
- BuildExtractSectionHob (
- &gLzmaCustomDecompressGuid,
- LzmaGuidedSectionGetInfo,
- LzmaGuidedSectionExtraction
- );
-
- // Assume the FV that contains the SEC (our code) also contains a compressed FV.
- Status = DecompressFirstFv ();
- ASSERT_EFI_ERROR (Status);
-
- // Load the DXE Core and transfer control to it
- Status = LoadDxeCoreFromFv (NULL, 0);
- ASSERT_EFI_ERROR (Status);
-}
-
-VOID
-CEntryPoint (
- IN UINTN MpId,
- IN UINTN UefiMemoryBase,
- IN UINTN StacksBase,
- IN UINTN GlobalVariableBase
- )
-{
- UINT64 StartTimeStamp;
-
- ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1));
-
- // Initialize the platform specific controllers
- ArmPlatformInitialize (MpId);
-
- if (ArmPlatformIsPrimaryCore (MpId) && PerformanceMeasurementEnabled ()) {
- // Initialize the Timer Library to setup the Timer HW controller
- TimerConstructor ();
- // We cannot call yet the PerformanceLib because the HOB List has not been initialized
- StartTimeStamp = GetPerformanceCounter ();
- } else {
- StartTimeStamp = 0;
- }
-
- // Data Cache enabled on Primary core when MMU is enabled.
- ArmDisableDataCache ();
- // Invalidate Data cache
- ArmInvalidateDataCache ();
- // Invalidate instruction cache
- ArmInvalidateInstructionCache ();
- // Enable Instruction Caches on all cores.
- ArmEnableInstructionCache ();
-
- // Define the Global Variable region when we are not running in XIP
- if (!IS_XIP()) {
- if (ArmPlatformIsPrimaryCore (MpId)) {
- mGlobalVariableBase = GlobalVariableBase;
- if (ArmIsMpCore()) {
- // Signal the Global Variable Region is defined (event: ARM_CPU_EVENT_DEFAULT)
- ArmCallSEV ();
- }
- } else {
- // Wait the Primay core has defined the address of the Global Variable region (event: ARM_CPU_EVENT_DEFAULT)
- ArmCallWFE ();
- }
- }
-
- // If not primary Jump to Secondary Main
- if (ArmPlatformIsPrimaryCore (MpId)) {
- // Goto primary Main.
- PrimaryMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);
- } else {
- SecondaryMain (MpId);
- }
-
- // DXE Core should always load and never return
- ASSERT (FALSE);
-}
-
diff --git a/ArmPlatformPkg/PrePi/PrePi.h b/ArmPlatformPkg/PrePi/PrePi.h
deleted file mode 100644
index 6e90c2afc8..0000000000
--- a/ArmPlatformPkg/PrePi/PrePi.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef _PREPI_H_
-#define _PREPI_H_
-
-#include <PiPei.h>
-
-#include <Library/PcdLib.h>
-#include <Library/ArmLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/HobLib.h>
-#include <Library/SerialPortLib.h>
-#include <Library/ArmPlatformLib.h>
-
-#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1);
-
-extern UINT64 mSystemMemoryEnd;
-
-RETURN_STATUS
-EFIAPI
-TimerConstructor (
- VOID
- );
-
-VOID
-PrePiMain (
- IN UINTN UefiMemoryBase,
- IN UINTN StacksBase,
- IN UINTN GlobalVariableBase,
- IN UINT64 StartTimeStamp
- );
-
-EFI_STATUS
-EFIAPI
-MemoryPeim (
- IN EFI_PHYSICAL_ADDRESS UefiMemoryBase,
- IN UINT64 UefiMemorySize
- );
-
-EFI_STATUS
-EFIAPI
-PlatformPeim (
- VOID
- );
-
-VOID
-PrimaryMain (
- IN UINTN UefiMemoryBase,
- IN UINTN StacksBase,
- IN UINTN GlobalVariableBase,
- IN UINT64 StartTimeStamp
- );
-
-VOID
-SecondaryMain (
- IN UINTN MpId
- );
-
-// Either implemented by PrePiLib or by MemoryInitPei
-VOID
-BuildMemoryTypeInformationHob (
- VOID
- );
-
-EFI_STATUS
-GetPlatformPpi (
- IN EFI_GUID *PpiGuid,
- OUT VOID **Ppi
- );
-
-// Initialize the Architecture specific controllers
-VOID
-ArchInitialize (
- VOID
- );
-
-#endif /* _PREPI_H_ */
diff --git a/ArmPlatformPkg/Scripts/Ds5/build_report.py b/ArmPlatformPkg/Scripts/Ds5/build_report.py
deleted file mode 100644
index effaf1db48..0000000000
--- a/ArmPlatformPkg/Scripts/Ds5/build_report.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-import re
-
-class BuildReport:
- PCDs = {}
-
- def parse_platform_summary(self, file):
- pass
-
- def parse_pcd_report(self, report_file):
- pcd_reg = re.compile(" (\*P|\*F|\*M| ) (\w+)(\ +)\: (.*) \((\w+)\) = (.*)\n")
-
- for line in report_file.xreadlines():
- stripped_line = line.strip()
- if re.match("\<=+\>", stripped_line):
- return
- elif re.match("g.*Guid", stripped_line):
- guid = stripped_line
- self.PCDs[guid] = {}
- else:
- m = pcd_reg.match(line)
- if m:
- self.PCDs[guid][m.group(2)] = (m.group(6).strip(),m.group(5))
-
- def parse_firmware_device(self, file):
- pass
-
- def parse_module_summary(self, file):
- #print "Module Summary"
- pass
-
- CONST_SECTION_HEADERS = [('Platform Summary', parse_platform_summary),
- ('Platform Configuration Database Report',parse_pcd_report),
- ('Firmware Device (FD)',parse_firmware_device),
- ('Module Summary',parse_module_summary)]
-
- def __init__(self, filename = 'report.log'):
- report_file = open(filename, 'r')
- for line in report_file.xreadlines():
- for section_header in BuildReport.CONST_SECTION_HEADERS:
- if line.strip() == section_header[0]:
- section_header[1](self, report_file)
- #print self.PCDs
diff --git a/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py b/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py
deleted file mode 100644
index 280b6b4de0..0000000000
--- a/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-from arm_ds.debugger_v1 import Debugger
-from arm_ds.debugger_v1 import DebugException
-
-import re, sys, getopt
-
-import edk2_debugger
-
-# Reload external classes
-reload(edk2_debugger)
-
-def usage():
- print "-v,--verbose"
- print "-a,--all: Load all symbols"
- print "-l,--report=: Filename for the EDK2 report log"
- print "-m,--sysmem=(base,size): System Memory region"
- print "-f,--fv=(base,size): Firmware region"
- print "-r,--rom=(base,size): ROM region"
-
-verbose = False
-load_all = False
-report_file = None
-regions = []
-opts,args = getopt.getopt(sys.argv[1:], "hvar:vm:vr:vf:v", ["help","verbose","all","report=","sysmem=","rom=","fv="])
-if (opts is None) or (not opts):
- report_file = '../../../report.log'
-else:
- region_reg = re.compile("\((.*),(.*)\)")
- base_reg = re.compile("(.*)")
-
- for o,a in opts:
- region_type = None
- regex = None
- m = None
- if o in ("-h","--help"):
- usage()
- sys.exit()
- elif o in ("-v","--verbose"):
- verbose = True
- elif o in ("-a","--all"):
- load_all = True
- elif o in ("-l","--report"):
- report_file = a
- elif o in ("-m","--sysmem"):
- region_type = edk2_debugger.ArmPlatformDebugger.REGION_TYPE_SYSMEM
- regex = region_reg
- elif o in ("-f","--fv"):
- region_type = edk2_debugger.ArmPlatformDebugger.REGION_TYPE_FV
- regex = region_reg
- elif o in ("-r","--rom"):
- region_type = edk2_debugger.ArmPlatformDebugger.REGION_TYPE_ROM
- regex = region_reg
- else:
- assert False, "Unhandled option (%s)" % o
-
- if region_type:
- m = regex.match(a)
- if m:
- if regex.groups == 1:
- regions.append((region_type,int(m.group(1),0),0))
- else:
- regions.append((region_type,int(m.group(1),0),int(m.group(2),0)))
- else:
- if regex.groups == 1:
- raise Exception('cmd_load_symbols', "Expect a base address")
- else:
- raise Exception('cmd_load_symbols', "Expect a region format as (base,size)")
-
-# Debugger object for accessing the debugger
-debugger = Debugger()
-
-# Initialisation commands
-ec = debugger.getExecutionContext(0)
-ec.getExecutionService().stop()
-ec.getExecutionService().waitForStop()
-# in case the execution context reference is out of date
-ec = debugger.getExecutionContext(0)
-
-try:
- armplatform_debugger = edk2_debugger.ArmPlatformDebugger(ec, report_file, regions, verbose)
-
- if load_all:
- armplatform_debugger.load_all_symbols()
- else:
- armplatform_debugger.load_current_symbols()
-except IOError, (ErrorNumber, ErrorMessage):
- print "Error: %s" % ErrorMessage
-except Exception, (ErrorClass, ErrorMessage):
- print "Error(%s): %s" % (ErrorClass, ErrorMessage)
-except DebugException, de:
- print "DebugError: %s" % (de.getMessage())
diff --git a/ArmPlatformPkg/Scripts/Ds5/edk2_debugger.py b/ArmPlatformPkg/Scripts/Ds5/edk2_debugger.py
deleted file mode 100644
index cb420af898..0000000000
--- a/ArmPlatformPkg/Scripts/Ds5/edk2_debugger.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-import os
-
-import firmware_volume
-import build_report
-import system_table
-
-# Reload external classes
-reload(firmware_volume)
-reload(build_report)
-reload(system_table)
-
-def readMem32(executionContext, address):
- bytes = executionContext.getMemoryService().read(address, 4, 32)
- return struct.unpack('<I',bytes)[0]
-
-def dump_fv(ec, fv_base, fv_size):
- fv = firmware_volume.FirmwareVolume(ec,
- int(build.PCDs['gArmTokenSpaceGuid']['PcdFvBaseAddress'][0],16),
- int(build.PCDs['gArmTokenSpaceGuid']['PcdFvSize'][0],16))
-
- ffs = fv.get_next_ffs()
- while ffs != None:
- print "# %s" % ffs
-
- section = ffs.get_next_section()
- while section != None:
- print "\t%s" % section
- try:
- print "\t\t- %s" % section.get_debug_filepath()
- except Exception:
- pass
- section = ffs.get_next_section(section)
-
- ffs = fv.get_next_ffs(ffs)
-
-def dump_system_table(ec, mem_base, mem_size):
- st = system_table.SystemTable(ec, mem_base, mem_size)
-
- debug_info_table_base = st.get_configuration_table(system_table.DebugInfoTable.CONST_DEBUG_INFO_TABLE_GUID)
-
- debug_info_table = system_table.DebugInfoTable(ec, debug_info_table_base)
- debug_info_table.dump()
-
-def load_symbol_from_file(ec, filename, address, verbose = False):
- if verbose:
- print "Add symbols of %s at 0x%x" % (filename, address)
-
- try:
- ec.getImageService().addSymbols(filename, address)
- except:
- try:
- # We could get an exception if the symbols are already loaded
- ec.getImageService().unloadSymbols(filename)
- ec.getImageService().addSymbols(filename, address)
- except:
- print "Warning: not possible to load symbols from %s at 0x%x" % (filename, address)
-
-def is_aarch64(ec):
- success = True
- try:
- # Try to access a Aarch64 specific register
- ec.getRegisterService().getValue('X0')
- except:
- success = False
- return success
-
-class ArmPlatform:
- def __init__(self, sysmembase=None, sysmemsize=None, fvs={}):
- self.sysmembase = sysmembase
- self.sysmemsize = sysmemsize
- self.fvs = fvs
-
-class ArmPlatformDebugger:
- system_table = None
- firmware_volumes = {}
-
- REGION_TYPE_SYSMEM = 1
- REGION_TYPE_ROM = 2
- REGION_TYPE_FV = 3
-
- def __init__(self, ec, report_log, regions, verbose = False):
- self.ec = ec
- self.verbose = verbose
- fvs = []
- sysmem_base = None
- sysmem_size = None
-
- if report_log and os.path.isfile(report_log):
- try:
- self.build = build_report.BuildReport(report_log)
- except IOError:
- raise IOError(2, 'Report \'%s\' is not valid' % report_log)
-
- # Generate list of supported Firmware Volumes
- if self.build.PCDs['gArmTokenSpaceGuid'].has_key('PcdFvSize') and int(self.build.PCDs['gArmTokenSpaceGuid']['PcdFvSize'][0],16) != 0:
- fvs.append((int(self.build.PCDs['gArmTokenSpaceGuid']['PcdFvBaseAddress'][0],16),int(self.build.PCDs['gArmTokenSpaceGuid']['PcdFvSize'][0],16)))
- if self.build.PCDs['gArmTokenSpaceGuid'].has_key('PcdSecureFvSize') and int(self.build.PCDs['gArmTokenSpaceGuid']['PcdSecureFvSize'][0],16) != 0:
- fvs.append((int(self.build.PCDs['gArmTokenSpaceGuid']['PcdSecureFvBaseAddress'][0],16),int(self.build.PCDs['gArmTokenSpaceGuid']['PcdSecureFvSize'][0],16)))
- if self.build.PCDs['gArmTokenSpaceGuid'].has_key('PcdHypFvSize') and int(self.build.PCDs['gArmTokenSpaceGuid']['PcdHypFvSize'][0],16) != 0:
- fvs.append((int(self.build.PCDs['gArmTokenSpaceGuid']['PcdHypFvBaseAddress'][0],16),int(self.build.PCDs['gArmTokenSpaceGuid']['PcdHypFvSize'][0],16)))
-
- sysmem_base = int(self.build.PCDs['gArmTokenSpaceGuid']['PcdSystemMemoryBase'][0],16)
- sysmem_size = int(self.build.PCDs['gArmTokenSpaceGuid']['PcdSystemMemorySize'][0],16)
- else:
- for region in regions:
- if region[0] == ArmPlatformDebugger.REGION_TYPE_SYSMEM:
- sysmem_base = region[1]
- sysmem_size = region[2]
- elif region[0] == ArmPlatformDebugger.REGION_TYPE_FV:
- fvs.append((region[1],region[2]))
- elif region[0] == ArmPlatformDebugger.REGION_TYPE_ROM:
- for base in xrange(region[1], region[1] + region[2], 0x400000):
- signature = struct.unpack("cccc", self.ec.getMemoryService().read(base, 4, 32))
- if signature == FirmwareVolume.CONST_FV_SIGNATURE:
- fvs.append((base,0))
- else:
- print "Region type '%d' Not Supported" % region[0]
-
- self.platform = ArmPlatform(sysmem_base, sysmem_size, fvs)
-
- def in_sysmem(self, addr):
- return (self.platform.sysmembase is not None) and (self.platform.sysmembase <= addr) and (addr < self.platform.sysmembase + self.platform.sysmemsize)
-
- def in_fv(self, addr):
- return (self.get_fv_at(addr) != None)
-
- def get_fv_at(self, addr):
- for fv in self.platform.fvs:
- if (fv[0] <= addr) and (addr < fv[0] + fv[1]):
- return fv
- return None
-
- def load_current_symbols(self):
- pc = int(self.ec.getRegisterService().getValue('PC')) & 0xFFFFFFFF
- if self.in_fv(pc):
- debug_infos = []
-
- (fv_base, fv_size) = self.get_fv_at(pc)
-
- if self.firmware_volumes.has_key(fv_base) == False:
- self.firmware_volumes[fv_base] = firmware_volume.FirmwareVolume(self.ec, fv_base, fv_size)
-
- stack_frame = self.ec.getTopLevelStackFrame()
- info = self.firmware_volumes[fv_base].load_symbols_at(int(stack_frame.getRegisterService().getValue('PC')) & 0xFFFFFFFF, self.verbose)
- debug_infos.append(info)
- while stack_frame.next() is not None:
- stack_frame = stack_frame.next()
-
- # Stack frame attached to 'PC'
- pc = int(stack_frame.getRegisterService().getValue('PC')) & 0xFFFFFFFF
-
- # Check if the symbols for this stack frame have already been loaded
- found = False
- for debug_info in debug_infos:
- if (pc >= debug_info[0]) and (pc < debug_info[0] + debug_info[1]):
- found = True
- if found == False:
- info = self.firmware_volumes[fv_base].load_symbols_at(pc)
- debug_infos.append(info)
-
- #self.firmware_volumes[fv_base].load_symbols_at(pc)
- elif self.in_sysmem(pc):
- debug_infos = []
-
- if self.system_table is None:
- # Find the System Table
- self.system_table = system_table.SystemTable(self.ec, self.platform.sysmembase, self.platform.sysmemsize)
-
- # Find the Debug Info Table
- debug_info_table_base = self.system_table.get_configuration_table(system_table.DebugInfoTable.CONST_DEBUG_INFO_TABLE_GUID)
- self.debug_info_table = system_table.DebugInfoTable(self.ec, debug_info_table_base)
-
- stack_frame = self.ec.getTopLevelStackFrame()
- info = self.debug_info_table.load_symbols_at(int(stack_frame.getRegisterService().getValue('PC')) & 0xFFFFFFFF, self.verbose)
- debug_infos.append(info)
- while stack_frame.next() is not None:
- stack_frame = stack_frame.next()
-
- # Stack frame attached to 'PC'
- pc = int(stack_frame.getRegisterService().getValue('PC')) & 0xFFFFFFFF
-
- # Check if the symbols for this stack frame have already been loaded
- found = False
- for debug_info in debug_infos:
- if (pc >= debug_info[0]) and (pc < debug_info[0] + debug_info[1]):
- found = True
- if found == False:
- try:
- info = self.debug_info_table.load_symbols_at(pc)
- debug_infos.append(info)
- except:
- pass
-
- #self.debug_info_table.load_symbols_at(pc)
- else:
- raise Exception('ArmPlatformDebugger', "Not supported region")
-
- def load_all_symbols(self):
- # Load all the XIP symbols attached to the Firmware Volume
- for (fv_base, fv_size) in self.platform.fvs:
- if self.firmware_volumes.has_key(fv_base) == False:
- self.firmware_volumes[fv_base] = firmware_volume.FirmwareVolume(self.ec, fv_base, fv_size)
- self.firmware_volumes[fv_base].load_all_symbols(self.verbose)
-
- try:
- # Load all symbols of module loaded into System Memory
- if self.system_table is None:
- # Find the System Table
- self.system_table = system_table.SystemTable(self.ec, self.platform.sysmembase, self.platform.sysmemsize)
-
-
- # Find the Debug Info Table
- debug_info_table_base = self.system_table.get_configuration_table(system_table.DebugInfoTable.CONST_DEBUG_INFO_TABLE_GUID)
- self.debug_info_table = system_table.DebugInfoTable(self.ec, debug_info_table_base)
-
- self.debug_info_table.load_all_symbols(self.verbose)
- except:
- # Debugger exception could be excepted if DRAM has not been initialized or if we have not started to run from DRAM yet
- print "Note: no symbols have been found in System Memory (possible cause: the UEFI permanent memory has been installed yet)"
diff --git a/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py b/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py
deleted file mode 100644
index 8e3a8adc9b..0000000000
--- a/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py
+++ /dev/null
@@ -1,355 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-from arm_ds.debugger_v1 import DebugException
-
-import struct
-import string
-
-import edk2_debugger
-
-class EfiFileSection(object):
- EFI_SECTION_PE32 = 0x10
- EFI_SECTION_PIC = 0x11
- EFI_SECTION_TE = 0x12
-
- EFI_IMAGE_DEBUG_TYPE_CODEVIEW = 0x2
-
- SIZEOF_EFI_FFS_FILE_HEADER = 0x28
-
- def __init__(self, ec, base):
- self.base = base
- self.ec = ec
-
- def __str__(self):
- return "FileSection(type:0x%X, size:0x%x)" % (self.get_type(), self.get_size())
-
- def get_base(self):
- return self.base
-
- def get_type(self):
- return struct.unpack("B", self.ec.getMemoryService().read(self.base + 0x3, 1, 8))[0]
-
- def get_size(self):
- return (struct.unpack("<I", self.ec.getMemoryService().read(self.base, 4, 32))[0] & 0x00ffffff)
-
- def get_debug_filepath(self):
- type = self.get_type()
- if type == EfiFileSection.EFI_SECTION_TE:
- section = EfiSectionTE(self, ec, self.base + 0x4)
- elif type == EfiFileSection.EFI_SECTION_PE32:
- section = EfiSectionPE32(self, ec, self.base + 0x4)
- else:
- raise Exception("EfiFileSection", "No debug section")
- return section.get_debug_filepath()
-
-class EfiSectionTE:
- SIZEOF_EFI_TE_IMAGE_HEADER = 0x28
- EFI_TE_IMAGE_SIGNATURE = ('V','Z')
-
- def __init__(self, ec, base_te):
- self.ec = ec
- self.base_te = int(base_te)
- te_sig = struct.unpack("cc", self.ec.getMemoryService().read(self.base_te, 2, 32))
- if te_sig != EfiSectionTE.EFI_TE_IMAGE_SIGNATURE:
- raise Exception("EfiFileSectionTE","TE Signature incorrect")
-
- def get_debug_filepath(self):
- stripped_size = struct.unpack("<H", self.ec.getMemoryService().read(self.base_te + 0x6, 2, 32))[0]
- stripped_size -= EfiSectionTE.SIZEOF_EFI_TE_IMAGE_HEADER
-
- debug_dir_entry_rva = self.ec.getMemoryService().readMemory32(self.base_te + 0x20)
- if debug_dir_entry_rva == 0:
- raise Exception("EfiFileSectionTE","No debug directory for image")
- debug_dir_entry_rva -= stripped_size
-
- debug_type = self.ec.getMemoryService().readMemory32(self.base_te + debug_dir_entry_rva + 0xC)
- if (debug_type != 0xdf) and (debug_type != EfiFileSection.EFI_IMAGE_DEBUG_TYPE_CODEVIEW):
- raise Exception("EfiFileSectionTE","Debug type is not dwarf")
-
- debug_rva = self.ec.getMemoryService().readMemory32(self.base_te + debug_dir_entry_rva + 0x14)
- debug_rva -= stripped_size
-
- dwarf_sig = struct.unpack("cccc", self.ec.getMemoryService().read(self.base_te + debug_rva, 4, 32))
- if (dwarf_sig != 0x66727764) and (dwarf_sig != FirmwareFile.CONST_NB10_SIGNATURE):
- raise Exception("EfiFileSectionTE","Dwarf debug signature not found")
-
- if dwarf_sig == 0x66727764:
- filename = self.base_te + debug_rva + 0xc
- else:
- filename = self.base_te + debug_rva + 0x10
- filename = struct.unpack("200s", self.ec.getMemoryService().read(filename, 200, 32))[0]
- return filename[0:string.find(filename,'\0')]
-
- def get_debug_elfbase(self):
- stripped_size = struct.unpack("<H", self.ec.getMemoryService().read(self.base_te + 0x6, 2, 32))[0]
- stripped_size -= EfiSectionTE.SIZEOF_EFI_TE_IMAGE_HEADER
-
- base_of_code = self.ec.getMemoryService().readMemory32(self.base_te + 0xC)
-
- return self.base_te + base_of_code - stripped_size
-
-class EfiSectionPE32:
- def __init__(self, ec, base_pe32):
- self.ec = ec
- self.base_pe32 = base_pe32
-
- def get_debug_filepath(self):
- # Offset from dos hdr to PE file hdr
- file_header_offset = self.ec.getMemoryService().readMemory32(self.base_pe32 + 0x3C)
-
- # Offset to debug dir in PE hdrs
- debug_dir_entry_rva = self.ec.getMemoryService().readMemory32(self.base_pe32 + file_header_offset + 0xA8)
- if debug_dir_entry_rva == 0:
- raise Exception("EfiFileSectionPE32","No Debug Directory")
-
- debug_type = self.ec.getMemoryService().readMemory32(self.base_pe32 + debug_dir_entry_rva + 0xC)
- if (debug_type != 0xdf) and (debug_type != EfiFileSection.EFI_IMAGE_DEBUG_TYPE_CODEVIEW):
- raise Exception("EfiFileSectionPE32","Debug type is not dwarf")
-
-
- debug_rva = self.ec.getMemoryService().readMemory32(self.base_pe32 + debug_dir_entry_rva + 0x14)
-
- dwarf_sig = struct.unpack("cccc", self.ec.getMemoryService().read(str(self.base_pe32 + debug_rva), 4, 32))
- if (dwarf_sig != 0x66727764) and (dwarf_sig != FirmwareFile.CONST_NB10_SIGNATURE):
- raise Exception("EfiFileSectionPE32","Dwarf debug signature not found")
-
- if dwarf_sig == 0x66727764:
- filename = self.base_pe32 + debug_rva + 0xc
- else:
- filename = self.base_pe32 + debug_rva + 0x10
- filename = struct.unpack("200s", self.ec.getMemoryService().read(str(filename), 200, 32))[0]
- return filename[0:string.find(filename,'\0')]
-
- def get_debug_elfbase(self):
- # Offset from dos hdr to PE file hdr
- pe_file_header = self.base_pe32 + self.ec.getMemoryService().readMemory32(self.base_pe32 + 0x3C)
-
- base_of_code = self.base_pe32 + self.ec.getMemoryService().readMemory32(pe_file_header + 0x28)
- base_of_data = self.base_pe32 + self.ec.getMemoryService().readMemory32(pe_file_header + 0x2C)
-
- if (base_of_code < base_of_data) and (base_of_code != 0):
- return base_of_code
- else:
- return base_of_data
-
-class EfiSectionPE64:
- def __init__(self, ec, base_pe64):
- self.ec = ec
- self.base_pe64 = base_pe64
-
- def get_debug_filepath(self):
- # Offset from dos hdr to PE file hdr (EFI_IMAGE_NT_HEADERS64)
- #file_header_offset = self.ec.getMemoryService().readMemory32(self.base_pe64 + 0x3C)
- file_header_offset = 0x0
-
- # Offset to debug dir in PE hdrs
- debug_dir_entry_rva = self.ec.getMemoryService().readMemory32(self.base_pe64 + file_header_offset + 0x138)
- if debug_dir_entry_rva == 0:
- raise Exception("EfiFileSectionPE64","No Debug Directory")
-
- debug_type = self.ec.getMemoryService().readMemory32(self.base_pe64 + debug_dir_entry_rva + 0xC)
- if (debug_type != 0xdf) and (debug_type != EfiFileSection.EFI_IMAGE_DEBUG_TYPE_CODEVIEW):
- raise Exception("EfiFileSectionPE64","Debug type is not dwarf")
-
-
- debug_rva = self.ec.getMemoryService().readMemory32(self.base_pe64 + debug_dir_entry_rva + 0x14)
-
- dwarf_sig = struct.unpack("cccc", self.ec.getMemoryService().read(str(self.base_pe64 + debug_rva), 4, 32))
- if (dwarf_sig != 0x66727764) and (dwarf_sig != FirmwareFile.CONST_NB10_SIGNATURE):
- raise Exception("EfiFileSectionPE64","Dwarf debug signature not found")
-
- if dwarf_sig == 0x66727764:
- filename = self.base_pe64 + debug_rva + 0xc
- else:
- filename = self.base_pe64 + debug_rva + 0x10
- filename = struct.unpack("200s", self.ec.getMemoryService().read(str(filename), 200, 32))[0]
- return filename[0:string.find(filename,'\0')]
-
- def get_debug_elfbase(self):
- # Offset from dos hdr to PE file hdr
- pe_file_header = self.base_pe64 + self.ec.getMemoryService().readMemory32(self.base_pe64 + 0x3C)
-
- base_of_code = self.base_pe64 + self.ec.getMemoryService().readMemory32(pe_file_header + 0x28)
- base_of_data = self.base_pe64 + self.ec.getMemoryService().readMemory32(pe_file_header + 0x2C)
-
- if (base_of_code < base_of_data) and (base_of_code != 0):
- return base_of_code
- else:
- return base_of_data
-
-class FirmwareFile:
- EFI_FV_FILETYPE_RAW = 0x01
- EFI_FV_FILETYPE_FREEFORM = 0x02
- EFI_FV_FILETYPE_SECURITY_CORE = 0x03
- EFI_FV_FILETYPE_PEI_CORE = 0x04
- EFI_FV_FILETYPE_DXE_CORE = 0x05
- EFI_FV_FILETYPE_PEIM = 0x06
- EFI_FV_FILETYPE_DRIVER = 0x07
- EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER = 0x08
- EFI_FV_FILETYPE_APPLICATION = 0x09
- EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE = 0x0B
- EFI_FV_FILETYPE_FFS_MIN = 0xF0
-
- CONST_NB10_SIGNATURE = ('N','B','1','0')
-
- def __init__(self, fv, base, ec):
- self.fv = fv
- self.base = base
- self.ec = ec
-
- def __str__(self):
- return "FFS(state:0x%x, type:0x%X, size:0x%x)" % (self.get_state(), self.get_type(), self.get_size())
-
- def get_base(self):
- return self.base
-
- def get_size(self):
- size = (self.ec.getMemoryService().readMemory32(self.base + 0x14) & 0x00ffffff)
-
- # Occupied size is the size considering the alignment
- return size + ((0x8 - (size & 0x7)) & 0x7)
-
- def get_type(self):
- return self.ec.getMemoryService().readMemory8(self.base + 0x12)
-
- def get_state(self):
- state = self.ec.getMemoryService().readMemory8(self.base + 0x17)
-
- polarity = self.fv.get_polarity()
- if polarity:
- state = ~state
-
- highest_bit = 0x80;
- while (highest_bit != 0) and ((highest_bit & state) == 0):
- highest_bit >>= 1
-
- return highest_bit
-
- def get_next_section(self, section=None):
- if section == None:
- if self.get_type() != FirmwareFile.EFI_FV_FILETYPE_FFS_MIN:
- section_base = self.get_base() + 0x18;
- else:
- return None
- else:
- section_base = int(section.get_base() + section.get_size())
-
- # Align to next 4 byte boundary
- if (section_base & 0x3) != 0:
- section_base = section_base + 0x4 - (section_base & 0x3)
-
- if section_base < self.get_base() + self.get_size():
- return EfiFileSection(self.ec, section_base)
- else:
- return None
-
-class FirmwareVolume:
- CONST_FV_SIGNATURE = ('_','F','V','H')
- EFI_FVB2_ERASE_POLARITY = 0x800
-
- DebugInfos = []
-
- def __init__(self, ec, fv_base, fv_size):
- self.ec = ec
- self.fv_base = fv_base
- self.fv_size = fv_size
-
- try:
- signature = struct.unpack("cccc", self.ec.getMemoryService().read(fv_base + 0x28, 4, 32))
- except DebugException:
- raise Exception("FirmwareVolume", "Not possible to access the defined firmware volume at [0x%X,0x%X]. Could be the used build report does not correspond to your current debugging context." % (int(fv_base),int(fv_base+fv_size)))
- if signature != FirmwareVolume.CONST_FV_SIGNATURE:
- raise Exception("FirmwareVolume", "This is not a valid firmware volume")
-
- def get_size(self):
- return self.ec.getMemoryService().readMemory32(self.fv_base + 0x20)
-
- def get_attributes(self):
- return self.ec.getMemoryService().readMemory32(self.fv_base + 0x2C)
-
- def get_polarity(self):
- attributes = self.get_attributes()
- if attributes & FirmwareVolume.EFI_FVB2_ERASE_POLARITY:
- return 1
- else:
- return 0
-
- def get_next_ffs(self, ffs=None):
- if ffs == None:
- # Get the offset of the first FFS file from the FV header
- ffs_base = self.fv_base + self.ec.getMemoryService().readMemory16(self.fv_base + 0x30)
- else:
- # Goto the next FFS file
- ffs_base = int(ffs.get_base() + ffs.get_size())
-
- # Align to next 8 byte boundary
- if (ffs_base & 0x7) != 0:
- ffs_base = ffs_base + 0x8 - (ffs_base & 0x7)
-
- if ffs_base < self.fv_base + self.get_size():
- return FirmwareFile(self, ffs_base, self.ec)
- else:
- return None
-
- def get_debug_info(self):
- self.DebugInfos = []
-
- ffs = self.get_next_ffs()
- while ffs != None:
- section = ffs.get_next_section()
- while section != None:
- type = section.get_type()
- if (type == EfiFileSection.EFI_SECTION_TE) or (type == EfiFileSection.EFI_SECTION_PE32):
- self.DebugInfos.append((section.get_base(), section.get_size(), section.get_type()))
- section = ffs.get_next_section(section)
- ffs = self.get_next_ffs(ffs)
-
- def load_symbols_at(self, addr, verbose = False):
- if self.DebugInfos == []:
- self.get_debug_info()
-
- for debug_info in self.DebugInfos:
- if (addr >= debug_info[0]) and (addr < debug_info[0] + debug_info[1]):
- if debug_info[2] == EfiFileSection.EFI_SECTION_TE:
- section = EfiSectionTE(self.ec, debug_info[0] + 0x4)
- elif debug_info[2] == EfiFileSection.EFI_SECTION_PE32:
- section = EfiSectionPE32(self.ec, debug_info[0] + 0x4)
- else:
- raise Exception('FirmwareVolume','Section Type not supported')
-
- try:
- edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)
- except Exception, (ErrorClass, ErrorMessage):
- if verbose:
- print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)
-
- return debug_info
-
- def load_all_symbols(self, verbose = False):
- if self.DebugInfos == []:
- self.get_debug_info()
-
- for debug_info in self.DebugInfos:
- if debug_info[2] == EfiFileSection.EFI_SECTION_TE:
- section = EfiSectionTE(self.ec, debug_info[0] + 0x4)
- elif debug_info[2] == EfiFileSection.EFI_SECTION_PE32:
- section = EfiSectionPE32(self.ec, debug_info[0] + 0x4)
- else:
- continue
-
- try:
- edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)
- except Exception, (ErrorClass, ErrorMessage):
- if verbose:
- print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)
-
diff --git a/ArmPlatformPkg/Scripts/Ds5/profile.py b/ArmPlatformPkg/Scripts/Ds5/profile.py
deleted file mode 100644
index 2e55993c60..0000000000
--- a/ArmPlatformPkg/Scripts/Ds5/profile.py
+++ /dev/null
@@ -1,334 +0,0 @@
-#!/usr/bin/python
-
-#
-# Copyright (c) 2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-import getopt
-import operator
-import os
-import pickle
-import sys
-from sys import argv
-from cStringIO import StringIO
-
-modules = {}
-functions = {}
-functions_addr = {}
-
-def usage():
- print "-t,--trace: Location of the Trace file"
- print "-s,--symbols: Location of the symbols and modules"
-
-def get_address_from_string(address):
- return int(address.strip("S:").strip("N:").strip("EL2:").strip("EL1:"), 16)
-
-def get_module_from_addr(modules, addr):
- for key,value in modules.items():
- if (value['start'] <= addr) and (addr <= value['end']):
- return key
- return None
-
-def add_cycles_to_function(functions, func_name, addr, cycles):
- if func_name != "<Unknown>":
- # Check if we are still in the previous function
- if add_cycles_to_function.prev_func_name == func_name:
- add_cycles_to_function.prev_entry['cycles'] += cycles
- return (add_cycles_to_function.prev_func_name, add_cycles_to_function.prev_module_name)
-
- if func_name in functions.keys():
- for module_name, module_value in functions[func_name].iteritems():
- if (module_value['start'] <= addr) and (addr < module_value['end']):
- module_value['cycles'] += cycles
-
- add_cycles_to_function.prev_func_name = func_name
- add_cycles_to_function.prev_module_name = module_name
- add_cycles_to_function.prev_entry = module_value
- return (func_name, module_name)
- elif (module_value['end'] == 0):
- module_value['cycles'] += cycles
-
- add_cycles_to_function.prev_func_name = func_name
- add_cycles_to_function.prev_module_name = module_name
- add_cycles_to_function.prev_entry = module_value
- return (func_name, module_name)
-
- # Workaround to fix the 'info func' limitation that does not expose the 'static' function
- module_name = get_module_from_addr(modules, addr)
- functions[func_name] = {}
- functions[func_name][module_name] = {}
- functions[func_name][module_name]['start'] = 0
- functions[func_name][module_name]['end'] = 0
- functions[func_name][module_name]['cycles'] = cycles
- functions[func_name][module_name]['count'] = 0
-
- add_cycles_to_function.prev_func_name = func_name
- add_cycles_to_function.prev_module_name = module_name
- add_cycles_to_function.prev_entry = functions[func_name][module_name]
- return (func_name, module_name)
- else:
- # Check if we are still in the previous function
- if (add_cycles_to_function.prev_entry is not None) and (add_cycles_to_function.prev_entry['start'] <= addr) and (addr < add_cycles_to_function.prev_entry['end']):
- add_cycles_to_function.prev_entry['cycles'] += cycles
- return (add_cycles_to_function.prev_func_name, add_cycles_to_function.prev_module_name)
-
- # Generate the key for the given address
- key = addr & ~0x0FFF
-
- if key not in functions_addr.keys():
- if 'Unknown' not in functions.keys():
- functions['Unknown'] = {}
- if 'Unknown' not in functions['Unknown'].keys():
- functions['Unknown']['Unknown'] = {}
- functions['Unknown']['Unknown']['cycles'] = 0
- functions['Unknown']['Unknown']['count'] = 0
- functions['Unknown']['Unknown']['cycles'] += cycles
-
- add_cycles_to_function.prev_func_name = None
- return None
-
- for func_key, module in functions_addr[key].iteritems():
- for module_key, module_value in module.iteritems():
- if (module_value['start'] <= addr) and (addr < module_value['end']):
- module_value['cycles'] += cycles
-
- # In case o <Unknown> we prefer to fallback on the direct search
- add_cycles_to_function.prev_func_name = func_key
- add_cycles_to_function.prev_module_name = module_key
- add_cycles_to_function.prev_entry = module_value
- return (func_key, module_key)
-
- print "Warning: Function %s @ 0x%x not found" % (func_name, addr)
-
- add_cycles_to_function.prev_func_name = None
- return None
-
-# Static variables for the previous function
-add_cycles_to_function.prev_func_name = None
-add_cycles_to_function.prev_entry = None
-
-def trace_read():
- global trace_process
- line = trace.readline()
- trace_process += len(line)
- return line
-
-#
-# Parse arguments
-#
-trace_name = None
-symbols_file = None
-
-opts,args = getopt.getopt(sys.argv[1:], "ht:vs:v", ["help","trace=","symbols="])
-if (opts is None) or (not opts):
- usage()
- sys.exit()
-
-for o,a in opts:
- if o in ("-h","--help"):
- usage()
- sys.exit()
- elif o in ("-t","--trace"):
- trace_name = a
- elif o in ("-s","--symbols"):
- symbols_file = a
- else:
- assert False, "Unhandled option (%s)" % o
-
-#
-# We try first to see if we run the script from DS-5
-#
-try:
- from arm_ds.debugger_v1 import Debugger
- from arm_ds.debugger_v1 import DebugException
-
- # Debugger object for accessing the debugger
- debugger = Debugger()
-
- # Initialisation commands
- ec = debugger.getExecutionContext(0)
- ec.getExecutionService().stop()
- ec.getExecutionService().waitForStop()
- # in case the execution context reference is out of date
- ec = debugger.getExecutionContext(0)
-
- #
- # Get the module name and their memory range
- #
- info_file = ec.executeDSCommand("info file")
- info_file_str = StringIO(info_file)
-
- line = info_file_str.readline().strip('\n')
- while line != '':
- if ("Symbols from" in line):
- # Get the module name from the line 'Symbols from "/home/...."'
- module_name = line.split("\"")[1].split("/")[-1]
- modules[module_name] = {}
-
- # Look for the text section
- line = info_file_str.readline().strip('\n')
- while (line != '') and ("Symbols from" not in line):
- if ("ER_RO" in line):
- modules[module_name]['start'] = get_address_from_string(line.split()[0])
- modules[module_name]['end'] = get_address_from_string(line.split()[2])
- line = info_file_str.readline().strip('\n')
- break;
- if (".text" in line):
- modules[module_name]['start'] = get_address_from_string(line.split()[0])
- modules[module_name]['end'] = get_address_from_string(line.split()[2])
- line = info_file_str.readline().strip('\n')
- break;
- line = info_file_str.readline().strip('\n')
- line = info_file_str.readline().strip('\n')
-
- #
- # Get the function name and their memory range
- #
- info_func = ec.executeDSCommand("info func")
- info_func_str = StringIO(info_func)
-
- # Skip the first line 'Low-level symbols ...'
- line = info_func_str.readline().strip('\n')
- func_prev = None
- while line != '':
- # We ignore all the functions after 'Functions in'
- if ("Functions in " in line):
- line = info_func_str.readline().strip('\n')
- while line != '':
- line = info_func_str.readline().strip('\n')
- line = info_func_str.readline().strip('\n')
- continue
-
- if ("Low-level symbols" in line):
- # We need to fixup the last function of the module
- if func_prev is not None:
- func_prev['end'] = modules[module_name]['end']
- func_prev = None
-
- line = info_func_str.readline().strip('\n')
- continue
-
- func_name = line.split()[1]
- func_start = get_address_from_string(line.split()[0])
- module_name = get_module_from_addr(modules, func_start)
-
- if func_name not in functions.keys():
- functions[func_name] = {}
- functions[func_name][module_name] = {}
- functions[func_name][module_name]['start'] = func_start
- functions[func_name][module_name]['cycles'] = 0
- functions[func_name][module_name]['count'] = 0
-
- # Set the end address of the previous function
- if func_prev is not None:
- func_prev['end'] = func_start
- func_prev = functions[func_name][module_name]
-
- line = info_func_str.readline().strip('\n')
-
- # Fixup the last function
- func_prev['end'] = modules[module_name]['end']
-
- if symbols_file is not None:
- pickle.dump((modules, functions), open(symbols_file, "w"))
-except:
- if symbols_file is None:
- print "Error: Symbols file is required when run out of ARM DS-5"
- sys.exit()
-
- (modules, functions) = pickle.load(open(symbols_file, "r"))
-
-#
-# Build optimized table for the <Unknown> functions
-#
-functions_addr = {}
-for func_key, module in functions.iteritems():
- for module_key, module_value in module.iteritems():
- key = module_value['start'] & ~0x0FFF
- if key not in functions_addr.keys():
- functions_addr[key] = {}
- if func_key not in functions_addr[key].keys():
- functions_addr[key][func_key] = {}
- functions_addr[key][func_key][module_key] = module_value
-
-#
-# Process the trace file
-#
-if trace_name is None:
- sys.exit()
-
-trace = open(trace_name, "r")
-trace_size = os.path.getsize(trace_name)
-trace_process = 0
-
-# Get the column names from the first line
-columns = trace_read().split()
-column_addr = columns.index('Address')
-column_cycles = columns.index('Cycles')
-column_function = columns.index('Function')
-
-line = trace_read()
-i = 0
-prev_callee = None
-while line:
- try:
- func_name = line.split('\t')[column_function].strip()
- address = get_address_from_string(line.split('\t')[column_addr])
- cycles = int(line.split('\t')[column_cycles])
- callee = add_cycles_to_function(functions, func_name, address, cycles)
- if (prev_callee != None) and (prev_callee != callee):
- functions[prev_callee[0]][prev_callee[1]]['count'] += 1
- prev_callee = callee
- except ValueError:
- pass
- line = trace_read()
- if ((i % 1000000) == 0) and (i != 0):
- percent = (trace_process * 100.00) / trace_size
- print "Processing file ... (%.2f %%)" % (percent)
- i = i + 1
-
-# Fixup the last callee
-functions[prev_callee[0]][prev_callee[1]]['count'] += 1
-
-#
-# Process results
-#
-functions_cycles = {}
-all_functions_cycles = {}
-total_cycles = 0
-
-for func_key, module in functions.iteritems():
- for module_key, module_value in module.iteritems():
- key = "%s/%s" % (module_key, func_key)
- functions_cycles[key] = (module_value['cycles'], module_value['count'])
- total_cycles += module_value['cycles']
-
- if func_key not in all_functions_cycles.keys():
- all_functions_cycles[func_key] = (module_value['cycles'], module_value['count'])
- else:
- all_functions_cycles[func_key] = tuple(map(sum, zip(all_functions_cycles[func_key], (module_value['cycles'], module_value['count']))))
-
-sorted_functions_cycles = sorted(functions_cycles.iteritems(), key=operator.itemgetter(1), reverse = True)
-sorted_all_functions_cycles = sorted(all_functions_cycles.items(), key=operator.itemgetter(1), reverse = True)
-
-print
-print "----"
-for (key,value) in sorted_functions_cycles[:20]:
- if value[0] != 0:
- print "%s (cycles: %d - %d%%, count: %d)" % (key, value[0], (value[0] * 100) / total_cycles, value[1])
- else:
- break;
-print "----"
-for (key,value) in sorted_all_functions_cycles[:20]:
- if value[0] != 0:
- print "%s (cycles: %d - %d%%, count: %d)" % (key, value[0], (value[0] * 100) / total_cycles, value[1])
- else:
- break;
diff --git a/ArmPlatformPkg/Scripts/Ds5/system_table.py b/ArmPlatformPkg/Scripts/Ds5/system_table.py
deleted file mode 100644
index 0a14f80830..0000000000
--- a/ArmPlatformPkg/Scripts/Ds5/system_table.py
+++ /dev/null
@@ -1,177 +0,0 @@
-#
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-from arm_ds.debugger_v1 import DebugException
-
-import struct
-
-import edk2_debugger
-import firmware_volume
-
-class DebugInfoTable:
- CONST_DEBUG_INFO_TABLE_GUID = ( 0x49152E77L, 0x47641ADAL, 0xFE7AA2B7L, 0x8B5ED9FEL)
-
- DebugInfos = []
-
- def __init__(self, ec, debug_info_table_header_offset):
- self.ec = ec
- self.base = debug_info_table_header_offset
-
- def get_debug_info(self):
- # Get the information from EFI_DEBUG_IMAGE_INFO_TABLE_HEADER
- count = self.ec.getMemoryService().readMemory32(self.base + 0x4)
- if edk2_debugger.is_aarch64(self.ec):
- debug_info_table_base = self.ec.getMemoryService().readMemory64(self.base + 0x8)
- else:
- debug_info_table_base = self.ec.getMemoryService().readMemory32(self.base + 0x8)
-
- self.DebugInfos = []
-
- for i in range(0, count):
- # Get the address of the structure EFI_DEBUG_IMAGE_INFO
- if edk2_debugger.is_aarch64(self.ec):
- debug_info = self.ec.getMemoryService().readMemory64(debug_info_table_base + (i * 8))
- else:
- debug_info = self.ec.getMemoryService().readMemory32(debug_info_table_base + (i * 4))
-
- if debug_info:
- debug_info_type = self.ec.getMemoryService().readMemory32(debug_info)
- # Normal Debug Info Type
- if debug_info_type == 1:
- if edk2_debugger.is_aarch64(self.ec):
- # Get the base address of the structure EFI_LOADED_IMAGE_PROTOCOL
- loaded_image_protocol = self.ec.getMemoryService().readMemory64(debug_info + 0x8)
-
- image_base = self.ec.getMemoryService().readMemory64(loaded_image_protocol + 0x40)
- image_size = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x48)
- else:
- # Get the base address of the structure EFI_LOADED_IMAGE_PROTOCOL
- loaded_image_protocol = self.ec.getMemoryService().readMemory32(debug_info + 0x4)
-
- image_base = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x20)
- image_size = self.ec.getMemoryService().readMemory32(loaded_image_protocol + 0x28)
-
- self.DebugInfos.append((image_base,image_size))
-
- # Return (base, size)
- def load_symbols_at(self, addr, verbose = False):
- if self.DebugInfos == []:
- self.get_debug_info()
-
- found = False
- for debug_info in self.DebugInfos:
- if (addr >= debug_info[0]) and (addr < debug_info[0] + debug_info[1]):
- if edk2_debugger.is_aarch64(self.ec):
- section = firmware_volume.EfiSectionPE64(self.ec, debug_info[0])
- else:
- section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])
-
- try:
- edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)
- except Exception, (ErrorClass, ErrorMessage):
- if verbose:
- print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)
-
- found = True
- return debug_info
-
- if found == False:
- raise Exception('DebugInfoTable','No symbol found at 0x%x' % addr)
-
- def load_all_symbols(self, verbose = False):
- if self.DebugInfos == []:
- self.get_debug_info()
-
- for debug_info in self.DebugInfos:
- if edk2_debugger.is_aarch64(self.ec):
- section = firmware_volume.EfiSectionPE64(self.ec, debug_info[0])
- else:
- section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])
-
- try:
- edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)
- except Exception, (ErrorClass, ErrorMessage):
- if verbose:
- print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)
-
- def dump(self):
- self.get_debug_info()
- for debug_info in self.DebugInfos:
- base_pe32 = debug_info[0]
- if edk2_debugger.is_aarch64(self.ec):
- section = firmware_volume.EfiSectionPE64(self.ec, base_pe32)
- else:
- section = firmware_volume.EfiSectionPE32(self.ec, base_pe32)
- print section.get_debug_filepath()
-
-class SystemTable:
- CONST_ST_SIGNATURE = ('I','B','I',' ','S','Y','S','T')
-
- def __init__(self, ec, membase, memsize):
- self.membase = membase
- self.memsize = memsize
- self.ec = ec
-
- found = False
-
- # Start from the top of the memory
- offset = self.membase + self.memsize
- # Align to highest 4MB boundary
- offset = offset & ~0x3FFFFF
- # We should not have a System Table at the top of the System Memory
- offset = offset - 0x400000
-
- # Start at top and look on 4MB boundaries for system table ptr structure
- while offset > self.membase:
- try:
- signature = struct.unpack("cccccccc", self.ec.getMemoryService().read(str(offset), 8, 32))
- except DebugException:
- raise Exception('SystemTable','Fail to access System Memory. Ensure all the memory in the region [0x%x;0x%X] is accessible.' % (membase,membase+memsize))
- if signature == SystemTable.CONST_ST_SIGNATURE:
- found = True
- if edk2_debugger.is_aarch64(self.ec):
- self.system_table_base = self.ec.getMemoryService().readMemory64(offset + 0x8)
- else:
- self.system_table_base = self.ec.getMemoryService().readMemory32(offset + 0x8)
- break
- offset = offset - 0x400000
-
- if not found:
- raise Exception('SystemTable','System Table not found in System Memory [0x%x;0x%X]' % (membase,membase+memsize))
-
- def get_configuration_table(self, conf_table_guid):
- if edk2_debugger.is_aarch64(self.ec):
- # Number of configuration Table entry
- conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x68)
-
- # Get location of the Configuration Table entries
- conf_table_offset = self.ec.getMemoryService().readMemory64(self.system_table_base + 0x70)
- else:
- # Number of configuration Table entry
- conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x40)
-
- # Get location of the Configuration Table entries
- conf_table_offset = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x44)
-
- for i in range(0, conf_table_entry_count):
- if edk2_debugger.is_aarch64(self.ec):
- offset = conf_table_offset + (i * 0x18)
- else:
- offset = conf_table_offset + (i * 0x14)
- guid = struct.unpack("<IIII", self.ec.getMemoryService().read(str(offset), 16, 32))
- if guid == conf_table_guid:
- if edk2_debugger.is_aarch64(self.ec):
- return self.ec.getMemoryService().readMemory64(offset + 0x10)
- else:
- return self.ec.getMemoryService().readMemory32(offset + 0x10)
-
- raise Exception('SystemTable','Configuration Table not found')
diff --git a/ArmPlatformPkg/Scripts/Makefile b/ArmPlatformPkg/Scripts/Makefile
deleted file mode 100644
index b6da154a86..0000000000
--- a/ArmPlatformPkg/Scripts/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-#/* @file
-# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#*/
-
-# Define the following variable to specify an alternative toolchain to the one located in your PATH:
-# - RVCT_TOOLS_PATH: for RVCT and RVCTLINUX toolchains
-
-EDK2_TOOLCHAIN ?= RVCTLINUX
-EDK2_ARCH ?= ARM
-EDK2_BUILD ?= DEBUG
-
-ifeq ($(EDK2_DSC),"")
- $(error The Makfile macro 'EDK2_DSC' must be defined with an EDK2 DSC file.)
-endif
-ifeq ("$(EDK2_DSC)","ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc")
- BUILD_FIP=1
- BUILD_PATH=$(WORKSPACE)/Build/ArmVExpress-FVP-AArch64
- UEFI_BIN=FVP_AARCH64_EFI.fd
-endif
-
-ifeq ("$(OS)","Windows_NT")
-export WORKSPACE?=$(PWD)
-export EDK_TOOLS_PATH ?= $(WORKSPACE)\BaseTools
-endif
-
-SHELL := /bin/bash
-SILENT ?= @
-ECHO ?= echo
-MAKE ?= make -i -k
-RM ?= rm -f
-
-.PHONY: all clean
-
-EDK2_CONF = Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt
-
-#
-# FIP Support
-#
-ifeq ($(BUILD_FIP),"1")
- ifeq ($(FIP_BIN),"")
- $(info Define location of the FIP to automatically update the package after building UEFI.)
- endif
-endif
-
-all: $(EDK2_CONF)
-ifeq ("$(OS)","Windows_NT")
- build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
-else
- . ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
-endif
-ifeq ("$(BUILD_FIP)","1")
-ifneq ($(FIP_BIN),"")
- $(SILENT)which fip_create ; \
- if [ $$? -ne 0 ]; then \
- $(ECHO) "Warning: 'fip_create' tool is not in the PATH. The UEFI binary will not be added in the Firmware Image Package (FIP)."; \
- else \
- fip_create --bl33 $(BUILD_PATH)/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/FV/$(UEFI_BIN) --dump $(FIP_BIN); \
- fi
-endif
-endif
-
-$(EDK2_CONF):
-ifeq ("$(OS)","Windows_NT")
- copy $(EDK_TOOLS_PATH)\Conf\build_rule.template Conf\build_rule.txt
- copy $(EDK_TOOLS_PATH)\Conf\FrameworkDatabase.template Conf\FrameworkDatabase.txt
- copy $(EDK_TOOLS_PATH)\Conf\target.template Conf\target.txt
- copy $(EDK_TOOLS_PATH)\Conf\tools_def.template Conf\tools_def.txt
-else
- . ./edksetup.sh; $(MAKE) -C BaseTools
-endif
-
-clean:
-ifeq ("$(OS)","Windows_NT")
- build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall
-else
- . ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall; \
- rm -Rf $(EDK2_CONF) Conf/.cache
-endif
diff --git a/ArmPlatformPkg/Sec/AArch64/Arch.c b/ArmPlatformPkg/Sec/AArch64/Arch.c
deleted file mode 100644
index 6e7d58e5d4..0000000000
--- a/ArmPlatformPkg/Sec/AArch64/Arch.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Chipset/AArch64.h>
-
-VOID
-EFIAPI
-ArmSecArchTrustzoneInit (
- VOID
- )
-{
- // Do not trap any access to Floating Point and Advanced SIMD in EL3.
- ArmWriteCptr (0);
-}
diff --git a/ArmPlatformPkg/Sec/AArch64/Helper.S b/ArmPlatformPkg/Sec/AArch64/Helper.S
deleted file mode 100644
index 3b58e12292..0000000000
--- a/ArmPlatformPkg/Sec/AArch64/Helper.S
+++ /dev/null
@@ -1,93 +0,0 @@
-#========================================================================================
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http:#opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#=======================================================================================
-
-#include <AsmMacroIoLibV8.h>
-#include <Chipset/AArch64.h>
-
-#start of the code section
-.text
-.align 3
-
-GCC_ASM_EXPORT(SwitchToNSExceptionLevel1)
-GCC_ASM_EXPORT(enter_monitor_mode)
-GCC_ASM_EXPORT(return_from_exception)
-GCC_ASM_EXPORT(copy_cpsr_into_spsr)
-GCC_ASM_EXPORT(set_non_secure_mode)
-
-// Switch from EL3 to NS-EL1
-ASM_PFX(SwitchToNSExceptionLevel1):
- // Now setup our EL1. Controlled by EL2 config on Model
- mrs x0, hcr_el2 // Read EL2 Hypervisor configuration Register
- orr x0, x0, #(1 << 31) // Set EL1 to be 64bit
-
- // Send all interrupts to their respective Exception levels for EL2
- and x0, x0, #~(ARM_HCR_FMO | ARM_HCR_IMO | ARM_HCR_AMO) // Disable virtual FIQ, IRQ, SError and Abort
- msr hcr_el2, x0 // Write back our settings
-
- msr cptr_el2, xzr // Disable copro traps to EL2
-
- msr sctlr_el2, xzr
-
- // Enable architected timer access
- mrs x0, cnthctl_el2
- orr x0, x0, #3 // Enable EL1 access to timers
- msr cnthctl_el2, x0
-
- mrs x0, cntkctl_el1
- orr x0, x0, #3 // EL0 access to counters
- msr cntkctl_el1, x0
-
- // Set ID regs
- mrs x0, midr_el1
- mrs x1, mpidr_el1
- msr vpidr_el2, x0
- msr vmpidr_el2, x1
-
- ret
-
-
-// EL3 on AArch64 is Secure/monitor so this funtion is reduced vs ARMv7
-// we don't need a mode switch, just setup the Arguments and jump.
-// x0: Monitor World EntryPoint
-// x1: MpId
-// x2: SecBootMode
-// x3: Secure Monitor mode stack
-ASM_PFX(enter_monitor_mode):
- mov x4, x0 // Swap EntryPoint and MpId registers
- mov x0, x1
- mov x1, x2
- mov x2, x3
- br x4
-
-// Put the address in correct ELR_ELx and do a eret.
-// We may need to do some config before we change to another Mode.
-ASM_PFX(return_from_exception):
- msr elr_el3, x0
- eret
-
-// For AArch64 we need to construct the spsr we want from individual bits and pieces.
-ASM_PFX(copy_cpsr_into_spsr):
- mrs x0, CurrentEl // Get the current exception level we are running at.
- mrs x1, SPSel // Which Stack are we using
- orr x0, x0, x1
- mrs x1, daif // Which interrupts are enabled
- orr x0, x0, x1
- msr spsr_el3, x0 // Write to spsr
- ret
-
-// Get this from platform file.
-ASM_PFX(set_non_secure_mode):
- msr spsr_el3, x0
- ret
-
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git a/ArmPlatformPkg/Sec/AArch64/SecEntryPoint.S b/ArmPlatformPkg/Sec/AArch64/SecEntryPoint.S
deleted file mode 100644
index 3512ccd84d..0000000000
--- a/ArmPlatformPkg/Sec/AArch64/SecEntryPoint.S
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AutoGen.h>
-#include <AsmMacroIoLibV8.h>
-#include "SecInternal.h"
-
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformSecBootAction)
-GCC_ASM_IMPORT(ArmPlatformSecBootMemoryInit)
-GCC_ASM_IMPORT(ArmDisableInterrupts)
-GCC_ASM_IMPORT(ArmDisableCachesAndMmu)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmCallWFE)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-StartupAddr: .8byte ASM_PFX(CEntryPoint)
-
-ASM_PFX(_ModuleEntryPoint):
-
-// NOTE: We could be booting from EL3, EL2 or EL1. Need to correctly detect
-// and configure the system accordingly. EL2 is default if possible.
-// If we started in EL3 we need to switch and run at EL2.
-// If we are running at EL2 stay in EL2
-// If we are starting at EL1 stay in EL1.
-
-// Sec only runs in EL3. Othewise we jump to PEI without changing anything.
-// If Sec runs we change to EL2 before switching to PEI.
-
-// Which EL are we running at? Every EL needs some level of setup...
- EL1_OR_EL2_OR_EL3(x0)
-1:// If we are at EL1 or EL2 leave SEC for PEI.
-2:b ASM_PFX(JumpToPEI)
- // If we are at EL3 we need to configure it and switch to EL2
-3:b ASM_PFX(MainEntryPoint)
-
-ASM_PFX(MainEntryPoint):
- // First ensure all interrupts are disabled
- bl ASM_PFX(ArmDisableInterrupts)
-
- // Ensure that the MMU and caches are off
- bl ASM_PFX(ArmDisableCachesAndMmu)
-
- // By default, we are doing a cold boot
- mov x10, #ARM_SEC_COLD_BOOT
-
- // Jump to Platform Specific Boot Action function
- bl ASM_PFX(ArmPlatformSecBootAction)
-
-_IdentifyCpu:
- // Identify CPU ID
- bl ASM_PFX(ArmReadMpidr)
- // Keep a copy of the MpId register value
- mov x5, x0
-
- // Is it the Primary Core ?
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
- cmp x0, #1
- // Only the primary core initialize the memory (SMC)
- b.eq _InitMem
-
-_WaitInitMem:
- // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized
- // Otherwise we have to wait the Primary Core to finish the initialization
- cmp x10, #ARM_SEC_COLD_BOOT
- b.ne _SetupSecondaryCoreStack
-
- // Wait for the primary core to initialize the initial memory (event: BOOT_MEM_INIT)
- bl ASM_PFX(ArmCallWFE)
- // Now the Init Mem is initialized, we setup the secondary core stacks
- b _SetupSecondaryCoreStack
-
-_InitMem:
- // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized
- cmp x10, #ARM_SEC_COLD_BOOT
- b.ne _SetupPrimaryCoreStack
-
- // Initialize Init Boot Memory
- bl ASM_PFX(ArmPlatformSecBootMemoryInit)
-
-_SetupPrimaryCoreStack:
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), x1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), x2)
- add x1, x1, x2
-
- LoadConstantToReg (FixedPcdGet32(PcdSecGlobalVariableSize), x2)
-
- // The reserved space for global variable must be 8-bytes aligned for pushing
- // 64-bit variable on the stack
- SetPrimaryStack (x1, x2, x3, x4)
- b _PrepareArguments
-
-_SetupSecondaryCoreStack:
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), x1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), x2)
- add x6, x1, x2
-
- // Get the Core Position
- mov x0, x5
- bl ASM_PFX(ArmPlatformGetCorePosition)
- // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
- add x0, x0, #1
-
- // StackOffset = CorePos * StackSize
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), x2)
- mul x0, x0, x2
- // SP = StackBase + StackOffset
- add sp, x6, x0
-
-_PrepareArguments:
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr x3, StartupAddr
-
- // Jump to SEC C code
- // r0 = mp_id
- // r1 = Boot Mode
- mov x0, x5
- mov x1, x10
- blr x3
-
- ret
-
-ASM_PFX(JumpToPEI):
- LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), x0)
- blr x0
diff --git a/ArmPlatformPkg/Sec/Arm/Arch.c b/ArmPlatformPkg/Sec/Arm/Arch.c
deleted file mode 100644
index 85df0816ef..0000000000
--- a/ArmPlatformPkg/Sec/Arm/Arch.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-*
-* Copyright (c) 2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Chipset/ArmV7.h>
-
-VOID
-EFIAPI
-ArmSecArchTrustzoneInit (
- VOID
- )
-{
- // Write to CP15 Non-secure Access Control Register
- ArmWriteNsacr (PcdGet32 (PcdArmNsacr));
-}
diff --git a/ArmPlatformPkg/Sec/Arm/Helper.S b/ArmPlatformPkg/Sec/Arm/Helper.S
deleted file mode 100644
index ac40102218..0000000000
--- a/ArmPlatformPkg/Sec/Arm/Helper.S
+++ /dev/null
@@ -1,84 +0,0 @@
-#========================================================================================
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#=======================================================================================
-
-#start of the code section
-.text
-.align 3
-
-GCC_ASM_EXPORT(return_from_exception)
-GCC_ASM_EXPORT(enter_monitor_mode)
-GCC_ASM_EXPORT(copy_cpsr_into_spsr)
-GCC_ASM_EXPORT(set_non_secure_mode)
-
-# r0: Monitor World EntryPoint
-# r1: MpId
-# r2: SecBootMode
-# r3: Secure Monitor mode stack
-ASM_PFX(enter_monitor_mode):
- cmp r3, #0 @ If a Secure Monitor stack base has not been defined then use the Secure stack
- moveq r3, sp
-
- mrs r4, cpsr @ Save current mode (SVC) in r4
- bic r5, r4, #0x1f @ Clear all mode bits
- orr r5, r5, #0x16 @ Set bits for Monitor mode
- msr cpsr_cxsf, r5 @ We are now in Monitor Mode
-
- mov sp, r3 @ Set the stack of the Monitor Mode
-
- mov lr, r0 @ Use the pass entrypoint as lr
-
- msr spsr_cxsf, r4 @ Use saved mode for the MOVS jump to the kernel
-
- mov r4, r0 @ Swap EntryPoint and MpId registers
- mov r0, r1
- mov r1, r2
- mov r2, r3
-
- bx r4
-
-# We cannot use the instruction 'movs pc, lr' because the caller can be written either in ARM or Thumb2 assembler.
-# When we will jump into this function, we will set the CPSR flag to ARM assembler. By copying directly 'lr' into
-# 'pc'; we will not change the CPSR flag and it will crash.
-# The way to fix this limitation is to do the movs into the ARM assmbler code and then do a 'bx'.
-ASM_PFX(return_from_exception):
- ldr lr, returned_exception
-
- #The following instruction breaks the code.
- #movs pc, lr
- mrs r2, cpsr
- bic r2, r2, #0x1f
- orr r2, r2, #0x13
- msr cpsr_c, r2
-
-returned_exception: @ We are now in non-secure state
- bx r0
-
-# Save the current Program Status Register (PSR) into the Saved PSR
-ASM_PFX(copy_cpsr_into_spsr):
- mrs r0, cpsr
- msr spsr_cxsf, r0
- bx lr
-
-# Set the Non Secure Mode
-ASM_PFX(set_non_secure_mode):
- push { r1 }
- and r0, r0, #0x1f @ Keep only the mode bits
- mrs r1, spsr @ Read the spsr
- bic r1, r1, #0x1f @ Clear all mode bits
- orr r1, r1, r0
- msr spsr_cxsf, r1 @ write back spsr (may have caused a mode switch)
- isb
- pop { r1 }
- bx lr @ return (hopefully thumb-safe!)
-
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git a/ArmPlatformPkg/Sec/Arm/Helper.asm b/ArmPlatformPkg/Sec/Arm/Helper.asm
deleted file mode 100644
index 8aa7d7840d..0000000000
--- a/ArmPlatformPkg/Sec/Arm/Helper.asm
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
- EXPORT return_from_exception
- EXPORT enter_monitor_mode
- EXPORT copy_cpsr_into_spsr
- EXPORT set_non_secure_mode
-
- AREA Helper, CODE, READONLY
-
-// r0: Monitor World EntryPoint
-// r1: MpId
-// r2: SecBootMode
-// r3: Secure Monitor mode stack
-enter_monitor_mode FUNCTION
- cmp r3, #0 // If a Secure Monitor stack base has not been defined then use the Secure stack
- moveq r3, sp
-
- mrs r4, cpsr // Save current mode (SVC) in r4
- bic r5, r4, #0x1f // Clear all mode bits
- orr r5, r5, #0x16 // Set bits for Monitor mode
- msr cpsr_cxsf, r5 // We are now in Monitor Mode
-
- mov sp, r3 // Set the stack of the Monitor Mode
-
- mov lr, r0 // Use the pass entrypoint as lr
-
- msr spsr_cxsf, r4 // Use saved mode for the MOVS jump to the kernel
-
- mov r4, r0 // Swap EntryPoint and MpId registers
- mov r0, r1
- mov r1, r2
- mov r2, r3
-
- bx r4
- ENDFUNC
-
-// We cannot use the instruction 'movs pc, lr' because the caller can be written either in ARM or Thumb2 assembler.
-// When we will jump into this function, we will set the CPSR flag to ARM assembler. By copying directly 'lr' into
-// 'pc'; we will not change the CPSR flag and it will crash.
-// The way to fix this limitation is to do the movs into the ARM assmbler code and then do a 'bx'.
-return_from_exception
- adr lr, returned_exception
- movs pc, lr
-returned_exception // We are now in non-secure state
- bx r0
-
-// Save the current Program Status Register (PSR) into the Saved PSR
-copy_cpsr_into_spsr
- mrs r0, cpsr
- msr spsr_cxsf, r0
- bx lr
-
-// Set the Non Secure Mode
-set_non_secure_mode
- push { r1 }
- and r0, r0, #0x1f // Keep only the mode bits
- mrs r1, spsr // Read the spsr
- bic r1, r1, #0x1f // Clear all mode bits
- orr r1, r1, r0
- msr spsr_cxsf, r1 // write back spsr (may have caused a mode switch)
- isb
- pop { r1 }
- bx lr // return (hopefully thumb-safe!)
-
-dead
- B dead
-
- END
diff --git a/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S b/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
deleted file mode 100644
index 51b91b965d..0000000000
--- a/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AutoGen.h>
-#include <AsmMacroIoLib.h>
-#include "SecInternal.h"
-
-.text
-.align 3
-
-GCC_ASM_IMPORT(CEntryPoint)
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
-GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
-GCC_ASM_IMPORT(ArmPlatformSecBootAction)
-GCC_ASM_IMPORT(ArmPlatformSecBootMemoryInit)
-GCC_ASM_IMPORT(ArmDisableInterrupts)
-GCC_ASM_IMPORT(ArmDisableCachesAndMmu)
-GCC_ASM_IMPORT(ArmReadMpidr)
-GCC_ASM_IMPORT(ArmCallWFE)
-GCC_ASM_EXPORT(_ModuleEntryPoint)
-
-StartupAddr: .word ASM_PFX(CEntryPoint)
-
-ASM_PFX(_ModuleEntryPoint):
- // First ensure all interrupts are disabled
- bl ASM_PFX(ArmDisableInterrupts)
-
- // Ensure that the MMU and caches are off
- bl ASM_PFX(ArmDisableCachesAndMmu)
-
- // By default, we are doing a cold boot
- mov r10, #ARM_SEC_COLD_BOOT
-
- // Jump to Platform Specific Boot Action function
- blx ASM_PFX(ArmPlatformSecBootAction)
-
-_IdentifyCpu:
- // Identify CPU ID
- bl ASM_PFX(ArmReadMpidr)
- // Keep a copy of the MpId register value
- mov r9, r0
-
- // Is it the Primary Core ?
- bl ASM_PFX(ArmPlatformIsPrimaryCore)
- cmp r0, #1
- // Only the primary core initialize the memory (SMC)
- beq _InitMem
-
-_WaitInitMem:
- // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized
- // Otherwise we have to wait the Primary Core to finish the initialization
- cmp r10, #ARM_SEC_COLD_BOOT
- bne _SetupSecondaryCoreStack
-
- // Wait for the primary core to initialize the initial memory (event: BOOT_MEM_INIT)
- bl ASM_PFX(ArmCallWFE)
- // Now the Init Mem is initialized, we setup the secondary core stacks
- b _SetupSecondaryCoreStack
-
-_InitMem:
- // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized
- cmp r10, #ARM_SEC_COLD_BOOT
- bne _SetupPrimaryCoreStack
-
- // Initialize Init Boot Memory
- bl ASM_PFX(ArmPlatformSecBootMemoryInit)
-
-_SetupPrimaryCoreStack:
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)
- add r1, r1, r2
-
- LoadConstantToReg (FixedPcdGet32(PcdSecGlobalVariableSize), r2)
-
- // The reserved space for global variable must be 8-bytes aligned for pushing
- // 64-bit variable on the stack
- SetPrimaryStack (r1, r2, r3)
- b _PrepareArguments
-
-_SetupSecondaryCoreStack:
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)
- add r6, r1, r2
-
- // Get the Core Position
- mov r0, r9
- bl ASM_PFX(ArmPlatformGetCorePosition)
- // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
- add r0, r0, #1
-
- // StackOffset = CorePos * StackSize
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2)
- mul r0, r0, r2
- // SP = StackBase + StackOffset
- add sp, r6, r0
-
-_PrepareArguments:
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr r3, StartupAddr
-
- // Jump to SEC C code
- // r0 = mp_id
- // r1 = Boot Mode
- mov r0, r9
- mov r1, r10
- blx r3
-
-_NeverReturn:
- b _NeverReturn
diff --git a/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm b/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm
deleted file mode 100644
index b30fab2141..0000000000
--- a/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-//
-
-#include <AutoGen.h>
-#include <AsmMacroIoLib.h>
-#include "SecInternal.h"
-
- INCLUDE AsmMacroIoLib.inc
-
- IMPORT CEntryPoint
- IMPORT ArmPlatformIsPrimaryCore
- IMPORT ArmPlatformGetCorePosition
- IMPORT ArmPlatformSecBootAction
- IMPORT ArmPlatformSecBootMemoryInit
- IMPORT ArmDisableInterrupts
- IMPORT ArmDisableCachesAndMmu
- IMPORT ArmReadMpidr
- IMPORT ArmCallWFE
- EXPORT _ModuleEntryPoint
-
- PRESERVE8
- AREA SecEntryPoint, CODE, READONLY
-
-StartupAddr DCD CEntryPoint
-
-_ModuleEntryPoint FUNCTION
- // First ensure all interrupts are disabled
- bl ArmDisableInterrupts
-
- // Ensure that the MMU and caches are off
- bl ArmDisableCachesAndMmu
-
- // By default, we are doing a cold boot
- mov r10, #ARM_SEC_COLD_BOOT
-
- // Jump to Platform Specific Boot Action function
- blx ArmPlatformSecBootAction
-
-_IdentifyCpu
- // Identify CPU ID
- bl ArmReadMpidr
- // Keep a copy of the MpId register value
- mov r9, r0
-
- // Is it the Primary Core ?
- bl ArmPlatformIsPrimaryCore
- cmp r0, #1
- // Only the primary core initialize the memory (SMC)
- beq _InitMem
-
-_WaitInitMem
- // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized
- // Otherwise we have to wait the Primary Core to finish the initialization
- cmp r10, #ARM_SEC_COLD_BOOT
- bne _SetupSecondaryCoreStack
-
- // Wait for the primary core to initialize the initial memory (event: BOOT_MEM_INIT)
- bl ArmCallWFE
- // Now the Init Mem is initialized, we setup the secondary core stacks
- b _SetupSecondaryCoreStack
-
-_InitMem
- // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized
- cmp r10, #ARM_SEC_COLD_BOOT
- bne _SetupPrimaryCoreStack
-
- // Initialize Init Boot Memory
- bl ArmPlatformSecBootMemoryInit
-
-_SetupPrimaryCoreStack
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)
- add r1, r1, r2
-
- LoadConstantToReg (FixedPcdGet32(PcdSecGlobalVariableSize), r2)
-
- // The reserved space for global variable must be 8-bytes aligned for pushing
- // 64-bit variable on the stack
- SetPrimaryStack (r1, r2, r3)
- b _PrepareArguments
-
-_SetupSecondaryCoreStack
- // Get the top of the primary stacks (and the base of the secondary stacks)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)
- add r6, r1, r2
-
- // Get the Core Position
- mov r0, r9
- bl ArmPlatformGetCorePosition
- // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
- add r0, r0, #1
-
- // StackOffset = CorePos * StackSize
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2)
- mul r0, r0, r2
- // SP = StackBase + StackOffset
- add sp, r6, r0
-
-_PrepareArguments
- // Move sec startup address into a data register
- // Ensure we're jumping to FV version of the code (not boot remapped alias)
- ldr r3, StartupAddr
-
- // Jump to SEC C code
- // r0 = mp_id
- // r1 = Boot Mode
- mov r0, r9
- mov r1, r10
- blx r3
- ENDFUNC
-
-_NeverReturn
- b _NeverReturn
- END
diff --git a/ArmPlatformPkg/Sec/Sec.c b/ArmPlatformPkg/Sec/Sec.c
deleted file mode 100644
index 7127395e61..0000000000
--- a/ArmPlatformPkg/Sec/Sec.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/** @file
-* Main file supporting the SEC Phase on ARM Platforms
-*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#include <Library/ArmTrustedMonitorLib.h>
-#include <Library/DebugAgentLib.h>
-#include <Library/PrintLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/SerialPortLib.h>
-#include <Library/ArmGicLib.h>
-#include <Library/ArmPlatformLib.h>
-
-#include "SecInternal.h"
-
-#define SerialPrint(txt) SerialPortWrite ((UINT8*)txt, AsciiStrLen(txt)+1);
-
-VOID
-CEntryPoint (
- IN UINTN MpId,
- IN UINTN SecBootMode
- )
-{
- CHAR8 Buffer[100];
- UINTN CharCount;
- UINTN JumpAddress;
-
- // Invalidate the data cache. Doesn't have to do the Data cache clean.
- ArmInvalidateDataCache ();
-
- // Invalidate Instruction Cache
- ArmInvalidateInstructionCache ();
-
- // Invalidate I & D TLBs
- ArmInvalidateTlb ();
-
- // CPU specific settings
- ArmCpuSetup (MpId);
-
- // Enable Floating Point Coprocessor if supported by the platform
- if (FixedPcdGet32 (PcdVFPEnabled)) {
- ArmEnableVFP ();
- }
-
- // Initialize peripherals that must be done at the early stage
- // Example: Some L2 controller, interconnect, clock, DMC, etc
- ArmPlatformSecInitialize (MpId);
-
- // Primary CPU clears out the SCU tag RAMs, secondaries wait
- if (ArmPlatformIsPrimaryCore (MpId) && (SecBootMode == ARM_SEC_COLD_BOOT)) {
- if (ArmIsMpCore()) {
- // Signal for the initial memory is configured (event: BOOT_MEM_INIT)
- ArmCallSEV ();
- }
-
- // SEC phase needs to run library constructors by hand. This assumes we are linked against the SerialLib
- // In non SEC modules the init call is in autogenerated code.
- SerialPortInitialize ();
-
- // Start talking
- if (FixedPcdGetBool (PcdTrustzoneSupport)) {
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Secure firmware (version %s built at %a on %a)\n\r",
- (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);
- } else {
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Boot firmware (version %s built at %a on %a)\n\r",
- (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);
- }
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
-
- // Initialize the Debug Agent for Source Level Debugging
- InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, NULL, NULL);
- SaveAndSetDebugTimerInterrupt (TRUE);
-
- // Enable the GIC distributor and CPU Interface
- // - no other Interrupts are enabled, doesn't have to worry about the priority.
- // - all the cores are in secure state, use secure SGI's
- ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase));
- ArmGicEnableInterruptInterface (PcdGet32(PcdGicInterruptInterfaceBase));
- } else {
- // Enable the GIC CPU Interface
- ArmGicEnableInterruptInterface (PcdGet32(PcdGicInterruptInterfaceBase));
- }
-
- // Enable Full Access to CoProcessors
- ArmWriteCpacr (CPACR_CP_FULL_ACCESS);
-
- // Test if Trustzone is supported on this platform
- if (FixedPcdGetBool (PcdTrustzoneSupport)) {
- if (ArmIsMpCore ()) {
- // Setup SMP in Non Secure world
- ArmCpuSetupSmpNonSecure (GET_CORE_ID(MpId));
- }
-
- // Either we use the Secure Stacks for Secure Monitor (in this case (Base == 0) && (Size == 0))
- // Or we use separate Secure Monitor stacks (but (Base != 0) && (Size != 0))
- ASSERT (((PcdGet32(PcdCPUCoresSecMonStackBase) == 0) && (PcdGet32(PcdCPUCoreSecMonStackSize) == 0)) ||
- ((PcdGet32(PcdCPUCoresSecMonStackBase) != 0) && (PcdGet32(PcdCPUCoreSecMonStackSize) != 0)));
-
- // Enter Monitor Mode
- enter_monitor_mode (
- (UINTN)TrustedWorldInitialization, MpId, SecBootMode,
- (VOID*) (PcdGet32 (PcdCPUCoresSecMonStackBase) +
- (PcdGet32 (PcdCPUCoreSecMonStackSize) * (ArmPlatformGetCorePosition (MpId) + 1)))
- );
- } else {
- if (ArmPlatformIsPrimaryCore (MpId)) {
- SerialPrint ("Trust Zone Configuration is disabled\n\r");
- }
-
- // With Trustzone support the transition from Sec to Normal world is done by return_from_exception().
- // If we want to keep this function call we need to ensure the SVC's SPSR point to the same Program
- // Status Register as the the current one (CPSR).
- copy_cpsr_into_spsr ();
-
- // Call the Platform specific function to execute additional actions if required
- JumpAddress = PcdGet64 (PcdFvBaseAddress);
- ArmPlatformSecExtraAction (MpId, &JumpAddress);
-
- NonTrustedWorldTransition (MpId, JumpAddress);
- }
- ASSERT (0); // We must never return from the above function
-}
-
-VOID
-TrustedWorldInitialization (
- IN UINTN MpId,
- IN UINTN SecBootMode
- )
-{
- UINTN JumpAddress;
-
- //-------------------- Monitor Mode ---------------------
-
- // Set up Monitor World (Vector Table, etc)
- ArmSecureMonitorWorldInitialize ();
-
- // Transfer the interrupt to Non-secure World
- ArmGicSetupNonSecure (MpId, PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase));
-
- // Initialize platform specific security policy
- ArmPlatformSecTrustzoneInit (MpId);
-
- // Setup the Trustzone Chipsets
- if (SecBootMode == ARM_SEC_COLD_BOOT) {
- if (ArmPlatformIsPrimaryCore (MpId)) {
- if (ArmIsMpCore()) {
- // Signal the secondary core the Security settings is done (event: EVENT_SECURE_INIT)
- ArmCallSEV ();
- }
- } else {
- // The secondary cores need to wait until the Trustzone chipsets configuration is done
- // before switching to Non Secure World
-
- // Wait for the Primary Core to finish the initialization of the Secure World (event: EVENT_SECURE_INIT)
- ArmCallWFE ();
- }
- }
-
- // Call the Platform specific function to execute additional actions if required
- JumpAddress = PcdGet64 (PcdFvBaseAddress);
- ArmPlatformSecExtraAction (MpId, &JumpAddress);
-
- // Initialize architecture specific security policy
- ArmSecArchTrustzoneInit ();
-
- // CP15 Secure Configuration Register
- ArmWriteScr (PcdGet32 (PcdArmScr));
-
- NonTrustedWorldTransition (MpId, JumpAddress);
-}
-
-VOID
-NonTrustedWorldTransition (
- IN UINTN MpId,
- IN UINTN JumpAddress
- )
-{
- // If PcdArmNonSecModeTransition is defined then set this specific mode to CPSR before the transition
- // By not set, the mode for Non Secure World is SVC
- if (PcdGet32 (PcdArmNonSecModeTransition) != 0) {
- set_non_secure_mode ((ARM_PROCESSOR_MODE)PcdGet32 (PcdArmNonSecModeTransition));
- }
-
- return_from_exception (JumpAddress);
- //-------------------- Non Secure Mode ---------------------
-
- // PEI Core should always load and never return
- ASSERT (FALSE);
-}
-
diff --git a/ArmPlatformPkg/Sec/Sec.inf b/ArmPlatformPkg/Sec/Sec.inf
deleted file mode 100644
index 7c6e7ffba1..0000000000
--- a/ArmPlatformPkg/Sec/Sec.inf
+++ /dev/null
@@ -1,87 +0,0 @@
-#/** @file
-# SEC - Reset vector code that jumps to C and starts the PEI phase
-#
-# (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ArmPlatformSec
- FILE_GUID = c536bbfe-c813-4e48-9f90-01fe1ecf9d54
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-[Sources]
- Sec.c
-
-[Sources.ARM]
- Arm/Arch.c
- Arm/Helper.asm | RVCT
- Arm/Helper.S | GCC
- Arm/SecEntryPoint.S | GCC
- Arm/SecEntryPoint.asm | RVCT
-
-[Sources.AARCH64]
- AArch64/Arch.c
- AArch64/Helper.S
- AArch64/SecEntryPoint.S
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- ArmPkg/ArmPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
-
-[LibraryClasses]
- ArmCpuLib
- ArmLib
- ArmPlatformLib
- ArmPlatformSecLib
- ArmTrustedMonitorLib
- BaseLib
- DebugLib
- DebugAgentLib
- IoLib
- ArmGicLib
- PrintLib
- SerialPortLib
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
-
-[FixedPcd.common]
-
- gArmTokenSpaceGuid.PcdTrustzoneSupport
- gArmTokenSpaceGuid.PcdVFPEnabled
-
- gArmTokenSpaceGuid.PcdArmScr
- gArmTokenSpaceGuid.PcdArmNonSecModeTransition
-
- gArmTokenSpaceGuid.PcdSecureFvBaseAddress
- gArmTokenSpaceGuid.PcdSecureFvSize
-
- gArmTokenSpaceGuid.PcdFvBaseAddress
-
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize
- gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize
-
- gArmTokenSpaceGuid.PcdGicDistributorBase
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
-
- gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize
-
-[FixedPcd.ARM]
- gArmTokenSpaceGuid.PcdArmNsacr
diff --git a/ArmPlatformPkg/Sec/SecInternal.h b/ArmPlatformPkg/Sec/SecInternal.h
deleted file mode 100644
index 111123725b..0000000000
--- a/ArmPlatformPkg/Sec/SecInternal.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/** @file
-* Main file supporting the SEC Phase on ARM PLatforms
-*
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
-*
-* This program and the accompanying materials
-* are licensed and made available under the terms and conditions of the BSD License
-* which accompanies this distribution. The full text of the license may be found at
-* http://opensource.org/licenses/bsd-license.php
-*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-*
-**/
-
-#ifndef __SEC_H__
-#define __SEC_H__
-
-#include <Base.h>
-#include <Library/ArmLib.h>
-#include <Library/ArmCpuLib.h>
-#include <Library/ArmPlatformLib.h>
-#include <Library/ArmPlatformSecLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0)
-
-VOID
-TrustedWorldInitialization (
- IN UINTN MpId,
- IN UINTN SecBootMode
- );
-
-VOID
-NonTrustedWorldTransition (
- IN UINTN MpId,
- IN UINTN JumpAddress
- );
-
-VOID
-ArmSetupGicNonSecure (
- IN INTN GicDistributorBase,
- IN INTN GicInterruptInterfaceBase
-);
-
-VOID
-enter_monitor_mode (
- IN UINTN MonitorEntryPoint,
- IN UINTN MpId,
- IN UINTN SecBootMode,
- IN VOID* MonitorStackBase
- );
-
-VOID
-return_from_exception (
- IN UINTN NonSecureBase
- );
-
-VOID
-copy_cpsr_into_spsr (
- VOID
- );
-
-VOID
-set_non_secure_mode (
- IN ARM_PROCESSOR_MODE Mode
- );
-
-VOID
-SecCommonExceptionEntry (
- IN UINT32 Entry,
- IN UINTN LR
- );
-
-VOID
-EFIAPI
-ArmSecArchTrustzoneInit (
- VOID
- );
-
-#endif