summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2013-03-22 18:41:37 +0000
committerRyan Harkin <ryan.harkin@linaro.org>2013-03-22 18:41:37 +0000
commit575fcba5c1b7eed91c0d1baf0b79facec53dfdb4 (patch)
tree6d597c008a12084fb5c1bc0d133da437be5fa6ab
parentd9875a6d13d3ac0a4d040567d393d4dc180dac87 (diff)
parent7efac5deccaefd2015f6d46f15baeafb569781b3 (diff)
Merge branch 'armlt-tracking' of git://git.linaro.org/arm/uefi/uefi-nextlinaro-uefi-2013.03
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
-rw-r--r--AppPkg/Applications/Sockets/DataSink/DataSink.c40
-rw-r--r--AppPkg/Applications/Sockets/DataSource/DataSource.c21
-rw-r--r--ArmPkg/Application/LinuxLoader/LinuxConfig.c22
-rw-r--r--ArmPkg/ArmPkg.dec3
-rw-r--r--ArmPkg/ArmPkg.dsc4
-rw-r--r--ArmPkg/Drivers/CpuDxe/ArmV6/Exception.c (renamed from ArmPkg/Drivers/CpuDxe/Exception.c)0
-rw-r--r--ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c (renamed from ArmPkg/Drivers/CpuDxe/Mmu.c)0
-rw-r--r--ArmPkg/Drivers/CpuDxe/CpuDxe.inf4
-rw-r--r--ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c27
-rw-r--r--ArmPkg/Include/IndustryStandard/ArmSmc.h52
-rw-r--r--ArmPkg/Include/IndustryStandard/ArmTrustZoneSmc.h159
-rw-r--r--ArmPkg/Include/Library/ArmLib.h12
-rw-r--r--ArmPkg/Include/Library/ArmSmcLib.h (renamed from ArmPlatformPkg/Include/Library/ArmSmcLib.h)0
-rw-r--r--ArmPkg/Include/Library/BdsLib.h25
-rw-r--r--ArmPkg/Include/Library/SemihostLib.h21
-rw-r--r--ArmPkg/Library/ArmLib/Arm11/Arm11Lib.inf4
-rw-r--r--ArmPkg/Library/ArmLib/Arm11/Arm11LibPrePi.inf4
-rw-r--r--ArmPkg/Library/ArmLib/Arm11/Arm11LibSec.inf4
-rw-r--r--ArmPkg/Library/ArmLib/Arm9/Arm9ArmLib.inf4
-rw-r--r--ArmPkg/Library/ArmLib/Arm9/Arm9ArmLibPrePi.inf4
-rw-r--r--ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf4
-rw-r--r--ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf4
-rw-r--r--ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf4
-rw-r--r--ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.S (renamed from ArmPkg/Library/ArmLib/Common/ArmLibSupport.S)13
-rw-r--r--ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.asm (renamed from ArmPkg/Library/ArmLib/Common/ArmLibSupport.asm)12
-rw-r--r--ArmPkg/Library/ArmLib/Null/NullArmLib.inf6
-rw-r--r--ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.S (renamed from ArmPlatformPkg/Library/ArmSmcLib/ArmSmc.S)9
-rw-r--r--ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm (renamed from ArmPlatformPkg/Library/ArmSmcLib/ArmSmc.asm)9
-rw-r--r--ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf (renamed from ArmPlatformPkg/Library/ArmSmcLib/ArmSmcLib.inf)10
-rw-r--r--ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.S33
-rw-r--r--ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm34
-rw-r--r--ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf31
-rw-r--r--ArmPkg/Library/BdsLib/Arm/BdsLinuxAtag.c (renamed from ArmPkg/Library/BdsLib/BdsLinuxAtag.c)0
-rw-r--r--ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c (renamed from ArmPkg/Library/BdsLib/BdsLinuxLoader.c)71
-rw-r--r--ArmPkg/Library/BdsLib/BdsFilePath.c191
-rw-r--r--ArmPkg/Library/BdsLib/BdsHelper.c35
-rw-r--r--ArmPkg/Library/BdsLib/BdsLib.inf14
-rw-r--r--ArmPkg/Library/BdsLib/BdsLinuxFdt.c206
-rw-r--r--ArmPkg/Library/BdsLib/BdsLinuxLoader.h2
-rw-r--r--ArmPkg/Library/BdsLib/BdsLoadOption.c10
-rw-r--r--ArmPkg/Library/DebugAgentSymbolsBaseLib/Arm/DebugAgentException.S (renamed from ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentException.S)0
-rw-r--r--ArmPkg/Library/DebugAgentSymbolsBaseLib/Arm/DebugAgentException.asm (renamed from ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentException.asm)0
-rw-r--r--ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.c12
-rw-r--r--ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf8
-rwxr-xr-xArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c35
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c (renamed from ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c)6
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerBase.c6
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf5
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf4
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c9
-rw-r--r--ArmPkg/Library/SemihostLib/SemihostLib.c (renamed from ArmPkg/Library/SemihostLib/Arm/SemihostLib.c)25
-rw-r--r--ArmPkg/Library/SemihostLib/SemihostLib.inf13
-rw-r--r--ArmPkg/Library/SemihostLib/SemihostPrivate.h (renamed from ArmPkg/Library/SemihostLib/Arm/SemihostPrivate.h)0
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc1
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg.dec5
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg.dsc1
-rw-r--r--ArmPlatformPkg/ArmPlatformPkg.fdf6
-rw-r--r--ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc2
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc6
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc2
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h9
-rw-r--r--ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c6
-rw-r--r--ArmPlatformPkg/Bds/Bds.c80
-rw-r--r--ArmPlatformPkg/Bds/Bds.inf2
-rw-r--r--ArmPlatformPkg/Bds/BdsInternal.h23
-rw-r--r--ArmPlatformPkg/Bds/BootMenu.c345
-rw-r--r--ArmPlatformPkg/Bds/BootOption.c69
-rw-r--r--ArmPlatformPkg/Bds/BootOptionSupport.c60
-rw-r--r--ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h2
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c2
-rw-r--r--ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h5
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm1
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S (renamed from ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.S)0
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm (renamed from ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.asm)0
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf4
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S (renamed from ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.S)0
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm (renamed from ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.asm)0
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf6
-rw-r--r--ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c3
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c (renamed from ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c)0
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c20
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf4
-rw-r--r--ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.c103
-rw-r--r--ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf43
-rw-r--r--ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c79
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c62
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/Exception.S (renamed from ArmPlatformPkg/PrePeiCore/Exception.S)0
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/Exception.asm (renamed from ArmPlatformPkg/PrePeiCore/Exception.asm)0
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S (renamed from ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S)0
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm (renamed from ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm)0
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S (renamed from ArmPlatformPkg/PrePeiCore/SwitchStack.S)0
-rw-r--r--ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm (renamed from ArmPlatformPkg/PrePeiCore/SwitchStack.asm)0
-rw-r--r--ArmPlatformPkg/PrePeiCore/MainMPCore.c4
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCore.c55
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCore.h6
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf21
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf17
-rw-r--r--[-rwxr-xr-x]ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S (renamed from ArmPlatformPkg/PrePi/ModuleEntryPoint.S)0
-rw-r--r--ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm (renamed from ArmPlatformPkg/PrePi/ModuleEntryPoint.asm)0
-rwxr-xr-xArmPlatformPkg/PrePi/PeiMPCore.inf8
-rwxr-xr-xArmPlatformPkg/PrePi/PeiUniCore.inf8
-rw-r--r--ArmPlatformPkg/Sec/Arm/Helper.S (renamed from ArmPlatformPkg/Sec/Helper.S)0
-rw-r--r--ArmPlatformPkg/Sec/Arm/Helper.asm (renamed from ArmPlatformPkg/Sec/Helper.asm)0
-rw-r--r--ArmPlatformPkg/Sec/Arm/SecEntryPoint.S (renamed from ArmPlatformPkg/Sec/SecEntryPoint.S)0
-rw-r--r--ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm (renamed from ArmPlatformPkg/Sec/SecEntryPoint.asm)0
-rw-r--r--ArmPlatformPkg/Sec/Sec.c10
-rw-r--r--ArmPlatformPkg/Sec/Sec.inf12
-rw-r--r--BaseTools/Contributions.txt188
-rw-r--r--BaseTools/License.txt25
-rw-r--r--BaseTools/Source/C/GenBootSector/GenBootSector.c38
-rw-r--r--BaseTools/Source/C/GenCrc32/GenCrc32.c35
-rw-r--r--BaseTools/Source/C/GenPage/GenPage.c41
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp22
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrSyntax.g4
-rw-r--r--BeagleBoardPkg/BeagleBoardPkg.dsc4
-rw-r--r--EmbeddedPkg/EmbeddedPkg.dsc2
-rw-r--r--EmbeddedPkg/GdbStub/Arm/Processor.c76
-rw-r--r--EmbeddedPkg/GdbStub/GdbStub.c48
-rw-r--r--EmbeddedPkg/GdbStub/GdbStubInternal.h2
-rw-r--r--EmbeddedPkg/GdbStub/Ia32/Processor.c24
-rw-r--r--EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.c79
-rw-r--r--EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf36
-rw-r--r--EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c60
-rw-r--r--EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf8
-rw-r--r--EmbeddedPkg/MetronomeDxe/Metronome.c100
-rw-r--r--EmbeddedPkg/SerialDxe/SerialDxe.inf1
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c267
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c4
-rw-r--r--IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec8
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c7
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c21
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c11
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c157
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.unibin9794 -> 9944 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c20
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c1
-rw-r--r--MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c3
-rw-r--r--MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c48
-rw-r--r--MdeModulePkg/Core/Pei/Image/Image.c52
-rw-r--r--MdeModulePkg/Core/PiSmmCore/Dispatcher.c31
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c4
-rw-r--r--MdeModulePkg/Core/PiSmmCore/Smi.c20
-rw-r--r--MdeModulePkg/Include/Library/HiiLib.h45
-rw-r--r--MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.c4
-rw-r--r--MdeModulePkg/Library/UefiHiiLib/HiiLib.c76
-rw-r--r--MdeModulePkg/MdeModulePkg.dec7
-rw-r--r--MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c10
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c38
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c29
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c66
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/Snp.c21
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c6
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Service.c28
-rw-r--r--MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c11
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf1
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c3
-rw-r--r--MdePkg/Include/Library/BaseLib.h20
-rw-r--r--MdePkg/Library/BaseLib/BaseLibInternals.h2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm4
-rw-r--r--MdePkg/Library/BaseLib/LinkedList.c24
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Io.c15
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c4
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c29
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c10
-rw-r--r--Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c55
-rw-r--r--Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf4
-rw-r--r--Omap44xxPkg/Include/Omap4430/Omap4430.h9
-rw-r--r--Omap44xxPkg/Include/Omap4430/Omap4430Gpio.h23
-rw-r--r--Omap44xxPkg/Include/Omap4430/Omap4430PadConfiguration.h583
-rw-r--r--Omap44xxPkg/Include/Omap4430/Omap4430Prcm.h207
-rw-r--r--Omap44xxPkg/Include/Omap4430/Omap4430Usb.h21
-rw-r--r--Omap44xxPkg/Library/SerialPortLib/SerialPortLib.c61
-rw-r--r--Omap44xxPkg/Library/SerialPortLib/SerialPortLib.inf2
-rw-r--r--Omap44xxPkg/PciEmulation/PciEmulation.c51
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c878
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h1023
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf72
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/ComponentName.c181
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c672
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/SimpleNetwork.c1574
-rw-r--r--OvmfPkg/AcpiPlatformDxe/Qemu.c58
-rw-r--r--OvmfPkg/AcpiTables/Dsdt.asl46
-rw-r--r--OvmfPkg/AcpiTables/Facp.aslc46
-rw-r--r--OvmfPkg/AcpiTables/Platform.h34
-rw-r--r--OvmfPkg/Include/IndustryStandard/LinuxBzimage.h6
-rw-r--r--OvmfPkg/Include/Library/QemuFwCfgLib.h21
-rw-r--r--OvmfPkg/Library/LoadLinuxLib/Linux.c5
-rw-r--r--OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S8
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.S22
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.asm26
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c51
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.S19
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.asm22
-rw-r--r--OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c8
-rw-r--r--OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf2
-rw-r--r--OvmfPkg/OvmfPkgIa32.fdf6
-rw-r--r--OvmfPkg/OvmfPkgIa32X64.fdf6
-rw-r--r--OvmfPkg/OvmfPkgX64.fdf6
-rw-r--r--PandaBoardPkg/ConfigurationHeader.dat56
-rwxr-xr-xPandaBoardPkg/Include/PandaBoard.h17
-rwxr-xr-xPandaBoardPkg/Library/PandaBoardLib/Clock.c278
-rwxr-xr-xPandaBoardPkg/Library/PandaBoardLib/PadConfiguration.c583
-rw-r--r--PandaBoardPkg/Library/PandaBoardLib/PandaBoard.c50
-rw-r--r--PandaBoardPkg/Library/PandaBoardLib/PandaBoardHelper.S88
-rw-r--r--PandaBoardPkg/Library/ResetSystemLib/ResetSystemLib.c4
-rw-r--r--PandaBoardPkg/PandaBoardPkg.dsc15
-rw-r--r--PandaBoardPkg/PandaBoardPkg.fdf8
-rw-r--r--PandaBoardPkg/patches/0001-Add-call-to-early-prepi-init-in-ModuleEntryPoint.patch35
-rw-r--r--PandaBoardPkg/readme.txt221
-rwxr-xr-xSamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc6
-rw-r--r--SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.c54
-rw-r--r--SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.inf2
-rw-r--r--SamsungPlatformPkgOrigen/OrigenBoardPkg/OrigenBoardPkg-Exynos.dsc2
-rw-r--r--SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c247
-rw-r--r--SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h5
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c7
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c35
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h29
-rw-r--r--ShellPkg/Include/Library/ShellLib.h50
-rw-r--r--ShellPkg/Library/UefiDpLib/Dp.c319
-rw-r--r--ShellPkg/Library/UefiDpLib/Dp.h98
-rw-r--r--ShellPkg/Library/UefiDpLib/DpInternal.h340
-rw-r--r--ShellPkg/Library/UefiDpLib/DpProfile.c101
-rw-r--r--ShellPkg/Library/UefiDpLib/DpTrace.c828
-rw-r--r--ShellPkg/Library/UefiDpLib/DpUtilities.c400
-rw-r--r--ShellPkg/Library/UefiDpLib/Literals.c23
-rw-r--r--ShellPkg/Library/UefiDpLib/Literals.h26
-rw-r--r--ShellPkg/Library/UefiDpLib/Readme.txt2
-rw-r--r--ShellPkg/Library/UefiDpLib/UefiDpLib.c101
-rw-r--r--ShellPkg/Library/UefiDpLib/UefiDpLib.h60
-rw-r--r--ShellPkg/Library/UefiDpLib/UefiDpLib.inf75
-rw-r--r--ShellPkg/Library/UefiDpLib/UefiDpLib.unibin0 -> 17140 bytes
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c12
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c170
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.unibin111322 -> 111572 bytes
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c61
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.unibin42418 -> 42896 bytes
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c107
-rw-r--r--ShellPkg/ShellPkg.dsc16
-rw-r--r--SourceLevelDebugPkg/SourceLevelDebugPkg.dsc2
-rw-r--r--StdLib/BsdSocketLib/socket.c2
-rw-r--r--StdLib/EfiSocketLib/Socket.h10
-rw-r--r--StdLib/EfiSocketLib/Udp4.c2
-rw-r--r--StdLib/ISSUES.txt10
-rw-r--r--StdLib/LibC/Locale/_wcstod.h116
-rw-r--r--StdLib/LibC/Locale/multibyte_Utf8.c4
-rw-r--r--StdLib/LibC/gdtoa/gdtoaimp.h3
-rw-r--r--UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm4
248 files changed, 11627 insertions, 3088 deletions
diff --git a/AppPkg/Applications/Sockets/DataSink/DataSink.c b/AppPkg/Applications/Sockets/DataSink/DataSink.c
index f2c3b3b72..14b2fd1ae 100644
--- a/AppPkg/Applications/Sockets/DataSink/DataSink.c
+++ b/AppPkg/Applications/Sockets/DataSink/DataSink.c
@@ -340,7 +340,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port ),
+ ntohs ( pPortIpAddress4->sin_port ),
errno ));
}
else {
@@ -362,7 +362,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port ),
+ ntohs ( pPortIpAddress6->sin6_port ),
errno ));
}
@@ -380,7 +380,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port )));
+ ntohs ( pPortIpAddress4->sin_port )));
}
else {
DEBUG (( DEBUG_INFO,
@@ -402,7 +402,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port )));
+ ntohs ( pPortIpAddress6->sin6_port )));
}
}
else {
@@ -414,7 +414,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port ),
+ ntohs ( pPortIpAddress4->sin_port ),
errno ));
}
else {
@@ -437,7 +437,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port ),
+ ntohs ( pPortIpAddress6->sin6_port ),
errno ));
}
}
@@ -484,7 +484,7 @@ SocketPoll (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port ));
+ ntohs ( pRemoteAddress4->sin_port ));
}
else {
Print ( L"Rejecting connection to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
@@ -504,7 +504,7 @@ SocketPoll (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port ));
+ ntohs ( pRemoteAddress6->sin6_port ));
}
//
@@ -522,7 +522,7 @@ SocketPoll (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port )));
+ ntohs ( pRemoteAddress4->sin_port )));
}
else {
DEBUG (( DEBUG_INFO,
@@ -544,7 +544,7 @@ SocketPoll (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port )));
+ ntohs ( pRemoteAddress6->sin6_port )));
}
}
else {
@@ -570,7 +570,7 @@ SocketPoll (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port ));
+ ntohs ( pRemoteAddress4->sin_port ));
}
else {
Print ( L"Connected to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
@@ -590,7 +590,7 @@ SocketPoll (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port ));
+ ntohs ( pRemoteAddress6->sin6_port ));
}
//
@@ -625,7 +625,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port )));
+ ntohs ( pPortIpAddress4->sin_port )));
}
else {
DEBUG (( DEBUG_INFO,
@@ -648,7 +648,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port )));
+ ntohs ( pPortIpAddress6->sin6_port )));
}
//
@@ -677,7 +677,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port ),
+ ntohs ( pPortIpAddress4->sin_port ),
errno ));
}
else {
@@ -699,7 +699,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port ),
+ ntohs ( pPortIpAddress6->sin6_port ),
errno ));
}
CloseStatus = close ( PollFd[ Index ].fd );
@@ -713,7 +713,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port )));
+ ntohs ( pPortIpAddress4->sin_port )));
}
else {
DEBUG (( DEBUG_INFO,
@@ -735,7 +735,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port )));
+ ntohs ( pPortIpAddress6->sin6_port )));
}
}
else {
@@ -747,7 +747,7 @@ SocketPoll (
( pPortIpAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pPortIpAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pPortIpAddress4->sin_port ),
+ ntohs ( pPortIpAddress4->sin_port ),
errno ));
}
else {
@@ -770,7 +770,7 @@ SocketPoll (
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pPortIpAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pPortIpAddress6->sin6_port ),
+ ntohs ( pPortIpAddress6->sin6_port ),
errno ));
}
}
diff --git a/AppPkg/Applications/Sockets/DataSource/DataSource.c b/AppPkg/Applications/Sockets/DataSource/DataSource.c
index cf4caa2b4..0dcd882ed 100644
--- a/AppPkg/Applications/Sockets/DataSource/DataSource.c
+++ b/AppPkg/Applications/Sockets/DataSource/DataSource.c
@@ -386,7 +386,7 @@ SocketConnect (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port ));
+ ntohs ( pRemoteAddress4->sin_port ));
}
else {
Print ( L"Connecting to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
@@ -406,7 +406,7 @@ SocketConnect (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port ));
+ ntohs ( pRemoteAddress6->sin6_port ));
}
//
@@ -441,7 +441,7 @@ SocketConnect (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port ));
+ ntohs ( pRemoteAddress4->sin_port ));
}
else {
Print ( L"Connected to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
@@ -461,8 +461,9 @@ SocketConnect (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port ));
+ ntohs ( pRemoteAddress6->sin6_port ));
}
+Print ( L"ConnectStatus: %d, Status: %r\r\n", ConnectStatus, Status );
}
else {
//
@@ -478,6 +479,7 @@ SocketConnect (
//
// Return the operation status
//
+Print ( L"SocketConnect returning Status: %r\r\n", Status );
return Status;
}
@@ -571,6 +573,7 @@ SocketSend (
DEBUG (( DEBUG_INFO,
"ERROR: send failed, errno: %d\r\n",
errno ));
+Print ( L"ERROR: send failed, errno: %d\r\n", errno );
//
// Try again
@@ -636,6 +639,7 @@ SocketOpen (
// Wait for the remote network application to start
//
Status = SocketConnect ( );
+Print ( L"Status: %r\r\n", Status );
if ( EFI_NOT_STARTED == Status ) {
Status = SocketClose ( );
continue;
@@ -659,6 +663,7 @@ SocketOpen (
//
// Return the operation status
//
+Print ( L"Returning Status: %r\r\n", Status );
return Status;
}
@@ -720,7 +725,7 @@ Tcp4Close (
pIpAddress[1],
pIpAddress[2],
pIpAddress[3],
- htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
+ ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
}
}
}
@@ -922,7 +927,7 @@ Tcp4Locate (
pIpAddress[1],
pIpAddress[2],
pIpAddress[3],
- htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
+ ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
bTcp4Connecting = FALSE;
}
@@ -1229,7 +1234,7 @@ Tcp4Open (
Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[1] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 8 );
Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[2] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 16 );
Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[3] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 24 );
- Tcp4ConfigData.AccessPoint.RemotePort = ((struct sockaddr_in *)&RemoteHostAddress)->sin_port;
+ Tcp4ConfigData.AccessPoint.RemotePort = ntohs (((struct sockaddr_in *)&RemoteHostAddress)->sin_port);
Tcp4ConfigData.AccessPoint.UseDefaultAddress = TRUE;
Tcp4ConfigData.AccessPoint.SubnetMask.Addr[0] = 0;
Tcp4ConfigData.AccessPoint.SubnetMask.Addr[1] = 0;
@@ -1288,7 +1293,7 @@ Tcp4Open (
pIpAddress[1],
pIpAddress[2],
pIpAddress[3],
- htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
+ ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
} while ( 0 );
if ( EFI_ERROR ( Status )) {
diff --git a/ArmPkg/Application/LinuxLoader/LinuxConfig.c b/ArmPkg/Application/LinuxLoader/LinuxConfig.c
index 273fecd2d..c88dc65e9 100644
--- a/ArmPkg/Application/LinuxLoader/LinuxConfig.c
+++ b/ArmPkg/Application/LinuxLoader/LinuxConfig.c
@@ -1,14 +1,14 @@
/** @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
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
@@ -189,7 +189,7 @@ LinuxLoaderConfig (
Print (L"[%d] Update Linux Boot Entry\n",LINUX_LOADER_UPDATE);
Print (L"Option: ");
- Status = GetHIInputInteger (&Choice);
+ Status = GetHIInputInteger ((UINTN*)&Choice);
if (Status == EFI_INVALID_PARAMETER) {
Print (L"\n");
return Status;
@@ -204,7 +204,7 @@ LinuxLoaderConfig (
Choice = LINUX_LOADER_NEW;
// Scan the OptionalData of every entry for the correct signature
- Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
if (!EFI_ERROR(Status)) {
BootOrderCount = BootOrderSize / sizeof(UINT16);
@@ -268,7 +268,7 @@ LinuxLoaderConfig (
do {
Print (L"Update Boot Entry: ");
- Status = GetHIInputInteger (&Choice);
+ Status = GetHIInputInteger ((UINTN*)&Choice);
if (Status == EFI_INVALID_PARAMETER) {
Print (L"\n");
return Status;
diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index 7a4aa7993..86a3dba7c 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -65,6 +65,9 @@
# it has been configured by the CPU DXE
gArmTokenSpaceGuid.PcdDebuggerExceptionSupport|FALSE|BOOLEAN|0x00000032
+ # Define if the Power State Coordination Interface (PSCI) is supported by the Platform Trusted Firmware
+ gArmTokenSpaceGuid.PcdArmPsciSupport|FALSE|BOOLEAN|0x00000033
+
[PcdsFixedAtBuild.common]
gArmTokenSpaceGuid.PcdTrustzoneSupport|FALSE|BOOLEAN|0x00000006
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index da55d6051..1b8cff110 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -63,6 +63,7 @@
ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
@@ -125,6 +126,9 @@
ArmPkg/Drivers/PL390Gic/PL390GicSecLib.inf
ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+ ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+ ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf
+
ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
ArmPkg/Application/LinuxLoader/LinuxAtagLoader.inf
diff --git a/ArmPkg/Drivers/CpuDxe/Exception.c b/ArmPkg/Drivers/CpuDxe/ArmV6/Exception.c
index 55a713219..55a713219 100644
--- a/ArmPkg/Drivers/CpuDxe/Exception.c
+++ b/ArmPkg/Drivers/CpuDxe/ArmV6/Exception.c
diff --git a/ArmPkg/Drivers/CpuDxe/Mmu.c b/ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c
index dcc7b682c..dcc7b682c 100644
--- a/ArmPkg/Drivers/CpuDxe/Mmu.c
+++ b/ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
index b471e4ac2..16afd0452 100644
--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
@@ -40,8 +40,8 @@
#
[Sources.ARM]
- Mmu.c
- Exception.c
+ ArmV6/Mmu.c
+ ArmV6/Exception.c
ArmV6/ExceptionSupport.asm | RVCT
ArmV6/ExceptionSupport.S | GCC
diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
index 5c70e51ce..b04e866a9 100644
--- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
+++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
@@ -2,7 +2,8 @@
Support a Semi Host file system over a debuggers JTAG
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
@@ -73,7 +74,7 @@ typedef struct {
EFI_FILE File;
CHAR8 *FileName;
UINT32 Position;
- UINT32 SemihostHandle;
+ UINTN SemihostHandle;
BOOLEAN IsRoot;
} SEMIHOST_FCB;
@@ -152,10 +153,8 @@ FileOpen (
{
SEMIHOST_FCB *FileFcb = NULL;
EFI_STATUS Status = EFI_SUCCESS;
- UINT32 SemihostHandle;
+ UINTN SemihostHandle;
CHAR8 *AsciiFileName;
- CHAR8 *AsciiPtr;
- UINTN Length;
UINT32 SemihostMode;
BOOLEAN IsRoot;
@@ -163,19 +162,12 @@ FileOpen (
return EFI_INVALID_PARAMETER;
}
- // Semihost interface requires ASCII filesnames
- Length = StrSize (FileName);
-
- AsciiFileName = AllocatePool (Length);
+ // Semihost interface requires ASCII filenames
+ AsciiFileName = AllocatePool ((StrLen (FileName) + 1) * sizeof (CHAR8));
if (AsciiFileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
-
- AsciiPtr = AsciiFileName;
-
- while (Length--) {
- *AsciiPtr++ = *FileName++ & 0xFF;
- }
+ UnicodeStrToAsciiStr (FileName, AsciiFileName);
if ((AsciiStrCmp (AsciiFileName, "\\") == 0) ||
(AsciiStrCmp (AsciiFileName, "/") == 0) ||
@@ -299,6 +291,7 @@ FileRead (
Fcb = SEMIHOST_FCB_FROM_THIS(File);
if (Fcb->IsRoot == TRUE) {
+ // By design, the Semihosting feature does not allow to list files on the host machine.
Status = EFI_UNSUPPORTED;
} else {
Status = SemihostFileRead (Fcb->SemihostHandle, BufferSize, Buffer);
@@ -360,7 +353,7 @@ FileSetPosition (
)
{
SEMIHOST_FCB *Fcb = NULL;
- UINT32 Length;
+ UINTN Length;
EFI_STATUS Status;
Fcb = SEMIHOST_FCB_FROM_THIS(File);
@@ -395,7 +388,7 @@ GetFileInfo (
UINTN NameSize = 0;
UINTN ResultSize;
UINTN Index;
- UINT32 Length;
+ UINTN Length;
EFI_STATUS Status;
if (Fcb->IsRoot == TRUE) {
diff --git a/ArmPkg/Include/IndustryStandard/ArmSmc.h b/ArmPkg/Include/IndustryStandard/ArmSmc.h
new file mode 100644
index 000000000..f6d062c71
--- /dev/null
+++ b/ArmPkg/Include/IndustryStandard/ArmSmc.h
@@ -0,0 +1,52 @@
+/** @file
+*
+* 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.
+*
+**/
+
+#ifndef __ARM_SMC_H__
+#define __ARM_SMC_H__
+
+#include <IndustryStandard/ArmTrustZoneSmc.h>
+
+#define ARM_SMC_ID_PRESENCE ARM_TRUSTZONE_ARM_FAST_SMC_ID_PRESENCE
+#define ARM_SMC_ID_UID ARM_TRUSTZONE_ARM_FAST_SMC_ID_UID
+#define ARM_SMC_ID_REVISION ARM_TRUSTZONE_ARM_FAST_SMC_ID_REVISION
+#define ARM_SMC_ARM_CPU_SUSPEND 0x80100001
+#define ARM_SMC_ARM_CPU_OFF 0x80100002
+#define ARM_SMC_ARM_CPU_ON 0x80100003
+#define ARM_SMC_ARM_MIGRATE 0x80100004
+
+#define ARM_SMC_ARM_CPU_SUSPEND_STANDBY_STATE (0 << 16)
+#define ARM_SMC_ARM_CPU_SUSPEND_POWER_DOWN_STATE (1 << 16)
+
+#define ARM_SMC_ARM_CPU_SUSPEND_CURRENT_CPU (0 << 24)
+#define ARM_SMC_ARM_CPU_SUSPEND_CLUSTER_AFFINITY_1 (1 << 24)
+#define ARM_SMC_ARM_CPU_SUSPEND_CLUSTER_AFFINITY_2 (2 << 24)
+#define ARM_SMC_ARM_CPU_SUSPEND_CLUSTER_AFFINITY_3 (3 << 24)
+
+#define ARM_SMC_ARM_CPU_OFF_MASK_STATE (1 << 16)
+#define ARM_SMC_ARM_CPU_OFF_STANDBY_STATE (0 << 16)
+#define ARM_SMC_ARM_CPU_OFF_POWER_DOWN_STATE (1 << 16)
+
+#define ARM_SMC_ARM_CPU_OFF_CURRENT_CPU (0 << 24)
+#define ARM_SMC_ARM_CPU_OFF_CLUSTER_AFFINITY_1 (1 << 24)
+#define ARM_SMC_ARM_CPU_OFF_CLUSTER_AFFINITY_2 (2 << 24)
+#define ARM_SMC_ARM_CPU_OFF_CLUSTER_AFFINITY_3 (3 << 24)
+
+
+#define ARM_SMC_ARM_RETURN_SUCCESS (UINTN)(0)
+#define ARM_SMC_ARM_RETURN_NOT_IMPLEMENTED (UINTN)(-1)
+#define ARM_SMC_ARM_RETURN_INVALID_PARAMETER (UINTN)(-2)
+#define ARM_SMC_ARM_RETURN_DENIED (UINTN)(-3)
+#define ARM_SMC_ARM_RETURN_CORE_NOT_AVAILABLE (UINTN)(-3)
+
+#endif
diff --git a/ArmPkg/Include/IndustryStandard/ArmTrustZoneSmc.h b/ArmPkg/Include/IndustryStandard/ArmTrustZoneSmc.h
new file mode 100644
index 000000000..62f8f61a7
--- /dev/null
+++ b/ArmPkg/Include/IndustryStandard/ArmTrustZoneSmc.h
@@ -0,0 +1,159 @@
+/** @file
+*
+* 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.
+*
+**/
+
+#ifndef __ARM_TRUSTZONE_SMC_H__
+#define __ARM_TRUSTZONE_SMC_H__
+
+#define ARM_TRUSTZONE_UID_4LETTERID 0x1
+#define ARM_TRUSTZONE_UID_MD5 0x2
+
+#define IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,Region) (((UINTN)(Rx) >= (UINTN)ARM_TRUSTZONE_##Region##_SMC_ID_START) && ((UINTN)(Rx) <= (UINTN)ARM_TRUSTZONE_##Region##_SMC_ID_END))
+
+#define IS_ARM_TRUSTZONE_DEPRECIATED_SMC(Rx) ((UINTN)(Rx) <= (UINTN)ARM_TRUSTZONE_DEPRECIATED_SMC_ID_END)
+#define IS_ARM_TRUSTZONE_TRUSTED_OS_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,TRUSTED_OS)
+#define IS_ARM_TRUSTZONE_ARM_FAST_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,ARM_FAST)
+#define IS_ARM_TRUSTZONE_SIP_FAST_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,SIP_FAST)
+#define IS_ARM_TRUSTZONE_ODM_FAST_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,ODM_FAST)
+#define IS_ARM_TRUSTZONE_OEM_FAST_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,OEM_FAST)
+#define IS_ARM_TRUSTZONE_TRUSTED_USER_FAST_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,TRUSTED_USER_FAST)
+#define IS_ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC(Rx,TRUSTED_OS_FAST)
+
+#define IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_PRESENCE(Rx,Region) ((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_PRESENCE)
+#define IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID(Rx,Region) (((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_UID) || \
+ ((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_UID+1) || \
+ ((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_UID+2) || \
+ ((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_UID+3) || \
+ ((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_UID+4))
+#define IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION(Rx,Region) (((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_REVISION) || \
+ ((Rx) == ARM_TRUSTZONE_##Region##_SMC_ID_REVISION+1))
+#define IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC(Rx,Region) (((Rx) >= ARM_TRUSTZONE_##Region##_SMC_ID_RPC_START) && \
+ ((Rx) <= ARM_TRUSTZONE_##Region##_SMC_ID_RPC_END))
+
+#define ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID_INDEX(Rx,Region) ((Rx) - ARM_TRUSTZONE_##Region##_SMC_ID_UID)
+#define ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION_INDEX(Rx,Region) ((Rx) - ARM_TRUSTZONE_##Region##_SMC_ID_REVISION)
+#define ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,Region) ((Rx) - ARM_TRUSTZONE_##Region##_SMC_ID_RPC_START)
+
+#define ARM_TRUSTZONE_TRUSTED_OS_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,TRUSTED_OS)
+
+#define IS_ARM_TRUSTZONE_ARM_FAST_SMC_ID_PRESENCE(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_PRESENCE(Rx,ARM_FAST)
+#define IS_ARM_TRUSTZONE_ARM_FAST_SMC_ID_UID(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID(Rx,ARM_FAST)
+#define IS_ARM_TRUSTZONE_ARM_FAST_SMC_ID_REVISION(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION(Rx,ARM_FAST)
+#define IS_ARM_TRUSTZONE_ARM_FAST_SMC_ID_RPC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC(Rx,ARM_FAST)
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_UID_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID_INDEX(Rx,ARM_FAST)
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_REVISION_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION_INDEX(Rx,ARM_FAST)
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,ARM_FAST)
+
+#define IS_ARM_TRUSTZONE_ODM_FAST_SMC_ID_PRESENCE(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_PRESENCE(Rx,ODM_FAST)
+#define IS_ARM_TRUSTZONE_ODM_FAST_SMC_ID_UID(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID(Rx,ODM_FAST)
+#define IS_ARM_TRUSTZONE_ODM_FAST_SMC_ID_REVISION(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION(Rx,ODM_FAST)
+#define IS_ARM_TRUSTZONE_ODM_FAST_SMC_ID_RPC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC(Rx,ODM_FAST)
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_UID_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID_INDEX(Rx,ODM_FAST)
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_REVISION_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION_INDEX(Rx,ODM_FAST)
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,ODM_FAST)
+
+#define IS_ARM_TRUSTZONE_OEM_FAST_SMC_ID_PRESENCE(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_PRESENCE(Rx,OEM_FAST)
+#define IS_ARM_TRUSTZONE_OEM_FAST_SMC_ID_UID(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID(Rx,OEM_FAST)
+#define IS_ARM_TRUSTZONE_OEM_FAST_SMC_ID_REVISION(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION(Rx,OEM_FAST)
+#define IS_ARM_TRUSTZONE_OEM_FAST_SMC_ID_RPC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC(Rx,OEM_FAST)
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_UID_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID_INDEX(Rx,OEM_FAST)
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_REVISION_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION_INDEX(Rx,OEM_FAST)
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,OEM_FAST)
+
+#define IS_ARM_TRUSTZONE_SIP_FAST_SMC_ID_PRESENCE(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_PRESENCE(Rx,SIP_FAST)
+#define IS_ARM_TRUSTZONE_SIP_FAST_SMC_ID_UID(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID(Rx,SIP_FAST)
+#define IS_ARM_TRUSTZONE_SIP_FAST_SMC_ID_REVISION(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION(Rx,SIP_FAST)
+#define IS_ARM_TRUSTZONE_SIP_FAST_SMC_ID_RPC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC(Rx,SIP_FAST)
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_UID_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID_INDEX(Rx,SIP_FAST)
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_REVISION_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION_INDEX(Rx,SIP_FAST)
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,SIP_FAST)
+
+#define ARM_TRUSTZONE_TRUSTED_USER_FAST_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,TRUSTED_USER_FAST)
+
+#define IS_ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_PRESENCE(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_PRESENCE(Rx,TRUSTED_OS_FAST)
+#define IS_ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_UID(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID(Rx,TRUSTED_OS_FAST)
+#define IS_ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_REVISION(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION(Rx,TRUSTED_OS_FAST)
+#define IS_ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_RPC(Rx) IS_ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC(Rx,TRUSTED_OS_FAST)
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_UID_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_UID_INDEX(Rx,TRUSTED_OS_FAST)
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_REVISION_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_REVISION_INDEX(Rx,TRUSTED_OS_FAST)
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_RPC_INDEX(Rx) ARM_TRUSTZONE_SUPPORTED_SMC_ID_RPC_INDEX(Rx,TRUSTED_OS_FAST)
+
+
+#define ARM_TRUSTZONE_DEPRECIATED_SMC_ID_START 0x00000000
+#define ARM_TRUSTZONE_DEPRECIATED_SMC_ID_END 0x01FFFFFF
+
+
+#define ARM_TRUSTZONE_TRUSTED_OS_SMC_ID_START 0x02000000
+#define ARM_TRUSTZONE_TRUSTED_OS_SMC_ID_END 0x1FFFFFFF
+
+#define ARM_TRUSTZONE_TRUSTED_OS_SMC_ID_RPC_START 0x02000000
+#define ARM_TRUSTZONE_TRUSTED_OS_SMC_ID_RPC_END 0x1FFFFFFF
+
+
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_START 0x80000000
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_END 0x80FFFFFF
+
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_RPC_START 0x80000000
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_RPC_END 0x80FFFEFF
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_PRESENCE 0x80FFFF00
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_UID 0x80FFFF10
+#define ARM_TRUSTZONE_ARM_FAST_SMC_ID_REVISION 0x80FFFF20
+
+
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_START 0x81000000
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_END 0x81FFFFFF
+
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_RPC_START 0x81000000
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_RPC_END 0x81FFFEFF
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_PRESENCE 0x81FFFF00
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_UID 0x81FFFF10
+#define ARM_TRUSTZONE_SIP_FAST_SMC_ID_REVISION 0x81FFFF20
+
+
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_START 0x82000000
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_END 0x82FFFFFF
+
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_RPC_START 0x82000000
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_RPC_END 0x82FFFEFF
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_PRESENCE 0x82FFFF00
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_UID 0x82FFFF10
+#define ARM_TRUSTZONE_ODM_FAST_SMC_ID_REVISION 0x82FFFF20
+
+
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_START 0x83000000
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_END 0x83FFFFFF
+
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_RPC_START 0x83000000
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_RPC_END 0x83FFFEFF
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_PRESENCE 0x83FFFF00
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_UID 0x83FFFF10
+#define ARM_TRUSTZONE_OEM_FAST_SMC_ID_REVISION 0x83FFFF20
+
+
+#define ARM_TRUSTZONE_TRUSTED_USER_FAST_SMC_ID_START 0xF0000000
+#define ARM_TRUSTZONE_TRUSTED_USER_FAST_SMC_ID_END 0xF1FFFFFF
+
+#define ARM_TRUSTZONE_TRUSTED_USER_FAST_SMC_ID_RPC_START 0xF0000000
+#define ARM_TRUSTZONE_TRUSTED_USER_FAST_SMC_ID_RPC_END 0xF1FFFEFF
+
+
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_START 0xF2000000
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_END 0xFFFFFFFF
+
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_RPC_START 0xF2000000
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_RPC_END 0xFFFFFEFF
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_PRESENCE 0xF2FFFF00
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_UID 0xF2FFFF10
+#define ARM_TRUSTZONE_TRUSTED_OS_FAST_SMC_ID_REVISION 0xF2FFFF20
+
+#endif
diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
index 4550ea6ba..b12be1424 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -570,4 +570,16 @@ ArmReadSctlr (
VOID
);
+UINTN
+EFIAPI
+ArmReadHVBar (
+ VOID
+ );
+
+VOID
+EFIAPI
+ArmWriteHVBar (
+ IN UINTN HypModeVectorBase
+ );
+
#endif // __ARM_LIB__
diff --git a/ArmPlatformPkg/Include/Library/ArmSmcLib.h b/ArmPkg/Include/Library/ArmSmcLib.h
index ff946f2de..ff946f2de 100644
--- a/ArmPlatformPkg/Include/Library/ArmSmcLib.h
+++ b/ArmPkg/Include/Library/ArmSmcLib.h
diff --git a/ArmPkg/Include/Library/BdsLib.h b/ArmPkg/Include/Library/BdsLib.h
index c8e02c934..d16748da4 100644
--- a/ArmPkg/Include/Library/BdsLib.h
+++ b/ArmPkg/Include/Library/BdsLib.h
@@ -1,14 +1,14 @@
/** @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
+* Copyright (c) 2013, ARM Limited. All rights reserved.
*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
@@ -67,8 +67,17 @@ BdsConnectAllDrivers (
);
EFI_STATUS
+GetGlobalEnvironmentVariable (
+ IN CONST CHAR16* VariableName,
+ IN VOID* DefaultValue,
+ IN OUT UINTN* Size,
+ OUT VOID** Value
+ );
+
+EFI_STATUS
GetEnvironmentVariable (
IN CONST CHAR16* VariableName,
+ IN EFI_GUID* VendorGuid,
IN VOID* DefaultValue,
IN OUT UINTN* Size,
OUT VOID** Value
diff --git a/ArmPkg/Include/Library/SemihostLib.h b/ArmPkg/Include/Library/SemihostLib.h
index 2ced7f107..625655177 100644
--- a/ArmPkg/Include/Library/SemihostLib.h
+++ b/ArmPkg/Include/Library/SemihostLib.h
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+ Portions 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
@@ -38,38 +39,38 @@ RETURN_STATUS
SemihostFileOpen (
IN CHAR8 *FileName,
IN UINT32 Mode,
- OUT UINT32 *FileHandle
+ OUT UINTN *FileHandle
);
RETURN_STATUS
SemihostFileSeek (
- IN UINT32 FileHandle,
- IN UINT32 Offset
+ IN UINTN FileHandle,
+ IN UINTN Offset
);
RETURN_STATUS
SemihostFileRead (
- IN UINT32 FileHandle,
- IN OUT UINT32 *Length,
+ IN UINTN FileHandle,
+ IN OUT UINTN *Length,
OUT VOID *Buffer
);
RETURN_STATUS
SemihostFileWrite (
- IN UINT32 FileHandle,
- IN OUT UINT32 *Length,
+ IN UINTN FileHandle,
+ IN OUT UINTN *Length,
IN VOID *Buffer
);
RETURN_STATUS
SemihostFileClose (
- IN UINT32 FileHandle
+ IN UINTN FileHandle
);
RETURN_STATUS
SemihostFileLength (
- IN UINT32 FileHandle,
- OUT UINT32 *Length
+ IN UINTN FileHandle,
+ OUT UINTN *Length
);
RETURN_STATUS
diff --git a/ArmPkg/Library/ArmLib/Arm11/Arm11Lib.inf b/ArmPkg/Library/ArmLib/Arm11/Arm11Lib.inf
index b28a4578b..5f24ffaf3 100644
--- a/ArmPkg/Library/ArmLib/Arm11/Arm11Lib.inf
+++ b/ArmPkg/Library/ArmLib/Arm11/Arm11Lib.inf
@@ -22,8 +22,8 @@
LIBRARY_CLASS = ArmLib
[Sources.common]
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
Arm11Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/Arm11/Arm11LibPrePi.inf b/ArmPkg/Library/ArmLib/Arm11/Arm11LibPrePi.inf
index cd36d8b3c..7239aceaf 100644
--- a/ArmPkg/Library/ArmLib/Arm11/Arm11LibPrePi.inf
+++ b/ArmPkg/Library/ArmLib/Arm11/Arm11LibPrePi.inf
@@ -22,8 +22,8 @@
LIBRARY_CLASS = ArmLib
[Sources.common]
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
Arm11Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/Arm11/Arm11LibSec.inf b/ArmPkg/Library/ArmLib/Arm11/Arm11LibSec.inf
index 4c3566e3c..e693c46dc 100644
--- a/ArmPkg/Library/ArmLib/Arm11/Arm11LibSec.inf
+++ b/ArmPkg/Library/ArmLib/Arm11/Arm11LibSec.inf
@@ -22,8 +22,8 @@
LIBRARY_CLASS = ArmLib
[Sources.common]
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
Arm11Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLib.inf b/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLib.inf
index 4eebf769d..e962ca40a 100644
--- a/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLib.inf
+++ b/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLib.inf
@@ -22,8 +22,8 @@
LIBRARY_CLASS = ArmLib
[Sources.common]
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
Arm9Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLibPrePi.inf b/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLibPrePi.inf
index e1900c5a1..4c5700193 100644
--- a/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLibPrePi.inf
+++ b/ArmPkg/Library/ArmLib/Arm9/Arm9ArmLibPrePi.inf
@@ -22,8 +22,8 @@
LIBRARY_CLASS = ArmLib
[Sources.common]
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
Arm9Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
index 2bc01a994..ec2a0bae8 100644
--- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
+++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
@@ -25,8 +25,8 @@
ArmLibSupportV7.S | GCC
ArmLibSupportV7.asm | RVCT
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
ArmV7Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf b/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf
index 5fdb04497..be5b8e493 100644
--- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf
+++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf
@@ -25,8 +25,8 @@
ArmLibSupportV7.S | GCC
ArmLibSupportV7.asm | RVCT
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
ArmV7Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf b/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf
index 9e6f17ec3..c1f97bb12 100644
--- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf
+++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf
@@ -23,8 +23,8 @@
ArmLibSupportV7.S | GCC
ArmLibSupportV7.asm | RVCT
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
ArmV7Support.S | GCC
diff --git a/ArmPkg/Library/ArmLib/Common/ArmLibSupport.S b/ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.S
index b19185412..71aee4307 100644
--- a/ArmPkg/Library/ArmLib/Common/ArmLibSupport.S
+++ b/ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.S
@@ -1,7 +1,7 @@
#------------------------------------------------------------------------------
#
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+# 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
@@ -44,6 +44,8 @@ GCC_ASM_EXPORT(ArmReadScr)
GCC_ASM_EXPORT(ArmWriteScr)
GCC_ASM_EXPORT(ArmReadMVBar)
GCC_ASM_EXPORT(ArmWriteMVBar)
+GCC_ASM_EXPORT(ArmReadHVBar)
+GCC_ASM_EXPORT(ArmWriteHVBar)
GCC_ASM_EXPORT(ArmCallWFE)
GCC_ASM_EXPORT(ArmCallSEV)
GCC_ASM_EXPORT(ArmReadSctlr)
@@ -161,6 +163,15 @@ ASM_PFX(ArmWriteScr):
mcr p15, 0, r0, c1, c1, 0
bx lr
+ASM_PFX(ArmReadHVBar):
+ mrc p15, 4, r0, c12, c0, 0
+ bx lr
+
+ASM_PFX(ArmWriteHVBar):
+ mcr p15, 4, r0, c12, c0, 0
+ bx lr
+
+
ASM_PFX(ArmReadMVBar):
mrc p15, 0, r0, c12, c0, 1
bx lr
diff --git a/ArmPkg/Library/ArmLib/Common/ArmLibSupport.asm b/ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.asm
index fd0f332bd..1636010e0 100644
--- a/ArmPkg/Library/ArmLib/Common/ArmLibSupport.asm
+++ b/ArmPkg/Library/ArmLib/Common/Arm/ArmLibSupport.asm
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-// Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+// 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
@@ -44,6 +44,8 @@
EXPORT ArmWriteScr
EXPORT ArmReadMVBar
EXPORT ArmWriteMVBar
+ EXPORT ArmReadHVBar
+ EXPORT ArmWriteHVBar
EXPORT ArmCallWFE
EXPORT ArmCallSEV
EXPORT ArmReadSctlr
@@ -161,6 +163,14 @@ ArmWriteScr
mcr p15, 0, r0, c1, c1, 0
bx lr
+ArmReadHVBar
+ mrc p15, 4, r0, c12, c0, 0
+ bx lr
+
+ArmWriteHVBar
+ mcr p15, 4, r0, c12, c0, 0
+ bx lr
+
ArmReadMVBar
mrc p15, 0, r0, c12, c0, 1
bx lr
diff --git a/ArmPkg/Library/ArmLib/Null/NullArmLib.inf b/ArmPkg/Library/ArmLib/Null/NullArmLib.inf
index 33296204a..d43719810 100644
--- a/ArmPkg/Library/ArmLib/Null/NullArmLib.inf
+++ b/ArmPkg/Library/ArmLib/Null/NullArmLib.inf
@@ -22,13 +22,15 @@
LIBRARY_CLASS = ArmLib
[Sources.common]
- ../Common/ArmLibSupport.S | GCC
- ../Common/ArmLibSupport.asm | RVCT
../Common/ArmLib.c
NullArmLib.c
NullArmCacheInformation.c
+[Sources.ARM]
+ ../Common/Arm/ArmLibSupport.S | GCC
+ ../Common/Arm/ArmLibSupport.asm | RVCT
+
[Packages]
ArmPkg/ArmPkg.dec
MdePkg/MdePkg.dec
diff --git a/ArmPlatformPkg/Library/ArmSmcLib/ArmSmc.S b/ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.S
index 13f51a91b..c9c0740fe 100644
--- a/ArmPlatformPkg/Library/ArmSmcLib/ArmSmc.S
+++ b/ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.S
@@ -27,9 +27,8 @@ ASM_PFX(ArmCallSmc):
smc #0
str r0,[r1]
pop {r1}
- blx lr
+ bx lr
-// Arg1 in R1
ASM_PFX(ArmCallSmcArg1):
push {r2-r3}
mov r2, r0
@@ -40,7 +39,7 @@ ASM_PFX(ArmCallSmcArg1):
str r0,[r2]
str r1,[r3]
pop {r2-r3}
- blx lr
+ bx lr
ASM_PFX(ArmCallSmcArg2):
push {r3-r5}
@@ -55,7 +54,7 @@ ASM_PFX(ArmCallSmcArg2):
str r1,[r4]
str r2,[r5]
pop {r3-r5}
- blx lr
+ bx lr
ASM_PFX(ArmCallSmcArg3):
push {r4-r7}
@@ -73,4 +72,4 @@ ASM_PFX(ArmCallSmcArg3):
str r2,[r6]
str r3,[r7]
pop {r4-r7}
- blx lr
+ bx lr
diff --git a/ArmPlatformPkg/Library/ArmSmcLib/ArmSmc.asm b/ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm
index 0efb1770c..f46bd7ecd 100644
--- a/ArmPlatformPkg/Library/ArmSmcLib/ArmSmc.asm
+++ b/ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm
@@ -25,9 +25,8 @@ ArmCallSmc
smc #0
str r0,[r1]
pop {r1}
- blx lr
+ bx lr
-// Arg1 in R1
ArmCallSmcArg1
push {r2-r3}
mov r2, r0
@@ -38,7 +37,7 @@ ArmCallSmcArg1
str r0,[r2]
str r1,[r3]
pop {r2-r3}
- blx lr
+ bx lr
ArmCallSmcArg2
push {r3-r5}
@@ -53,7 +52,7 @@ ArmCallSmcArg2
str r1,[r4]
str r2,[r5]
pop {r3-r5}
- blx lr
+ bx lr
ArmCallSmcArg3
push {r4-r7}
@@ -71,6 +70,6 @@ ArmCallSmcArg3
str r2,[r6]
str r3,[r7]
pop {r4-r7}
- blx lr
+ bx lr
END
diff --git a/ArmPlatformPkg/Library/ArmSmcLib/ArmSmcLib.inf b/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
index 5df254844..a3e12d26d 100644
--- a/ArmPlatformPkg/Library/ArmSmcLib/ArmSmcLib.inf
+++ b/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
@@ -1,6 +1,6 @@
#/** @file
#
-# Copyright (c) 2012, ARM Ltd. All rights reserved.<BR>
+# Copyright (c) 2012-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
@@ -19,10 +19,10 @@
VERSION_STRING = 1.0
LIBRARY_CLASS = ArmSmcLib
-[Sources.common]
- ArmSmc.asm | RVCT
- ArmSmc.S | GCC
+[Sources.ARM]
+ Arm/ArmSmc.asm | RVCT
+ Arm/ArmSmc.S | GCC
[Packages]
MdePkg/MdePkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
+ ArmPkg/ArmPkg.dec
diff --git a/ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.S b/ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.S
new file mode 100644
index 000000000..4896dd0c9
--- /dev/null
+++ b/ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.S
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+//
+
+.text
+.align 3
+
+GCC_ASM_EXPORT(ArmCallSmc)
+GCC_ASM_EXPORT(ArmCallSmcArg1)
+GCC_ASM_EXPORT(ArmCallSmcArg2)
+GCC_ASM_EXPORT(ArmCallSmcArg3)
+
+ASM_PFX(ArmCallSmc):
+ bx lr
+
+// Arg1 in R1
+ASM_PFX(ArmCallSmcArg1):
+ bx lr
+
+ASM_PFX(ArmCallSmcArg2):
+ bx lr
+
+ASM_PFX(ArmCallSmcArg3):
+ bx lr
diff --git a/ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm b/ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm
new file mode 100644
index 000000000..24c20752e
--- /dev/null
+++ b/ArmPkg/Library/ArmSmcLibNull/Arm/ArmSmcNull.asm
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+//
+
+ EXPORT ArmCallSmc
+ EXPORT ArmCallSmcArg1
+ EXPORT ArmCallSmcArg2
+ EXPORT ArmCallSmcArg3
+
+ AREA ArmSmc, CODE, READONLY
+
+ArmCallSmc
+ bx lr
+
+// Arg1 in R1
+ArmCallSmcArg1
+ bx lr
+
+ArmCallSmcArg2
+ bx lr
+
+ArmCallSmcArg3
+ bx lr
+
+ END
diff --git a/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf b/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf
new file mode 100644
index 000000000..fed6e95dd
--- /dev/null
+++ b/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf
@@ -0,0 +1,31 @@
+#/** @file
+#
+# ArmSmcLib when no SMC support is desired (might be the case for CPU without the
+# Trustzone support / ARM Security Extension)
+#
+# Copyright (c) 2012-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 = ArmSmcLibNull
+ FILE_GUID = 140e8004-16e1-4de1-a352-c6ef51110ecf
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmSmcLib
+
+[Sources.ARM]
+ Arm/ArmSmcNull.asm | RVCT
+ Arm/ArmSmcNull.S | GCC
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ArmPkg/ArmPkg.dec
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxAtag.c b/ArmPkg/Library/BdsLib/Arm/BdsLinuxAtag.c
index 8946b1423..8946b1423 100644
--- a/ArmPkg/Library/BdsLib/BdsLinuxAtag.c
+++ b/ArmPkg/Library/BdsLib/Arm/BdsLinuxAtag.c
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c b/ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c
index bf3e850a5..d0eb075c6 100644
--- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c
+++ b/ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c
@@ -146,11 +146,13 @@ BdsBootLinuxAtag (
{
EFI_STATUS Status;
UINT32 LinuxImageSize;
+ UINT32 InitrdImageBaseSize = 0;
UINT32 InitrdImageSize = 0;
UINT32 AtagSize;
EFI_PHYSICAL_ADDRESS AtagBase;
EFI_PHYSICAL_ADDRESS LinuxImage;
- EFI_PHYSICAL_ADDRESS InitrdImage;
+ EFI_PHYSICAL_ADDRESS InitrdImageBase = 0;
+ EFI_PHYSICAL_ADDRESS InitrdImage = 0;
PERF_START (NULL, "BDS", NULL, 0);
@@ -164,21 +166,24 @@ BdsBootLinuxAtag (
if (InitrdDevicePath) {
// Load the initrd near to the Linux kernel
- InitrdImage = LINUX_KERNEL_MAX_OFFSET;
- Status = BdsLoadImage (InitrdDevicePath, AllocateMaxAddress, &InitrdImage, &InitrdImageSize);
+ InitrdImageBase = LINUX_KERNEL_MAX_OFFSET;
+ Status = BdsLoadImage (InitrdDevicePath, AllocateMaxAddress, &InitrdImageBase, &InitrdImageBaseSize);
if (Status == EFI_OUT_OF_RESOURCES) {
- Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize);
+ Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImageBase, &InitrdImageBaseSize);
}
if (EFI_ERROR(Status)) {
Print (L"ERROR: Did not find initrd image.\n");
- return Status;
+ goto EXIT_FREE_LINUX;
}
// Check if the initrd is a uInitrd
- if (*(UINT32*)((UINTN)InitrdImage) == LINUX_UIMAGE_SIGNATURE) {
+ if (*(UINT32*)((UINTN)InitrdImageBase) == LINUX_UIMAGE_SIGNATURE) {
// Skip the 64-byte image header
- InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImage + 64);
- InitrdImageSize -= 64;
+ InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImageBase + 64);
+ InitrdImageSize = InitrdImageBaseSize - 64;
+ } else {
+ InitrdImage = InitrdImageBase;
+ InitrdImageSize = InitrdImageBaseSize;
}
}
@@ -190,10 +195,20 @@ BdsBootLinuxAtag (
Status = PrepareAtagList (CommandLineArguments, InitrdImage, InitrdImageSize, &AtagBase, &AtagSize);
if (EFI_ERROR(Status)) {
Print(L"ERROR: Can not prepare ATAG list. Status=0x%X\n", Status);
- return Status;
+ goto EXIT_FREE_INITRD;
}
return StartLinux (LinuxImage, LinuxImageSize, AtagBase, AtagSize, PcdGet32(PcdArmMachineType));
+
+EXIT_FREE_INITRD:
+ if (InitrdDevicePath) {
+ gBS->FreePages (InitrdImageBase, EFI_SIZE_TO_PAGES (InitrdImageBaseSize));
+ }
+
+EXIT_FREE_LINUX:
+ gBS->FreePages (LinuxImage, EFI_SIZE_TO_PAGES (LinuxImageSize));
+
+ return Status;
}
/**
@@ -218,11 +233,13 @@ BdsBootLinuxFdt (
{
EFI_STATUS Status;
UINT32 LinuxImageSize;
+ UINT32 InitrdImageBaseSize = 0;
UINT32 InitrdImageSize = 0;
UINT32 FdtBlobSize;
EFI_PHYSICAL_ADDRESS FdtBlobBase;
EFI_PHYSICAL_ADDRESS LinuxImage;
- EFI_PHYSICAL_ADDRESS InitrdImage;
+ EFI_PHYSICAL_ADDRESS InitrdImageBase = 0;
+ EFI_PHYSICAL_ADDRESS InitrdImage = 0;
PERF_START (NULL, "BDS", NULL, 0);
@@ -235,21 +252,24 @@ BdsBootLinuxFdt (
}
if (InitrdDevicePath) {
- InitrdImage = LINUX_KERNEL_MAX_OFFSET;
- Status = BdsLoadImage (InitrdDevicePath, AllocateMaxAddress, &InitrdImage, &InitrdImageSize);
+ InitrdImageBase = LINUX_KERNEL_MAX_OFFSET;
+ Status = BdsLoadImage (InitrdDevicePath, AllocateMaxAddress, &InitrdImageBase, &InitrdImageBaseSize);
if (Status == EFI_OUT_OF_RESOURCES) {
- Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize);
+ Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImageBase, &InitrdImageBaseSize);
}
if (EFI_ERROR(Status)) {
Print (L"ERROR: Did not find initrd image.\n");
- return Status;
+ goto EXIT_FREE_LINUX;
}
// Check if the initrd is a uInitrd
- if (*(UINT32*)((UINTN)InitrdImage) == LINUX_UIMAGE_SIGNATURE) {
+ if (*(UINT32*)((UINTN)InitrdImageBase) == LINUX_UIMAGE_SIGNATURE) {
// Skip the 64-byte image header
- InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImage + 64);
- InitrdImageSize -= 64;
+ InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImageBase + 64);
+ InitrdImageSize = InitrdImageBaseSize - 64;
+ } else {
+ InitrdImage = InitrdImageBase;
+ InitrdImageSize = InitrdImageBaseSize;
}
}
@@ -258,7 +278,7 @@ BdsBootLinuxFdt (
Status = BdsLoadImage (FdtDevicePath, AllocateAnyPages, &FdtBlobBase, &FdtBlobSize);
if (EFI_ERROR(Status)) {
Print (L"ERROR: Did not find Device Tree blob.\n");
- return Status;
+ goto EXIT_FREE_INITRD;
}
// Update the Fdt with the Initrd information. The FDT will increase in size.
@@ -266,9 +286,22 @@ BdsBootLinuxFdt (
Status = PrepareFdt (CommandLineArguments, InitrdImage, InitrdImageSize, &FdtBlobBase, &FdtBlobSize);
if (EFI_ERROR(Status)) {
Print(L"ERROR: Can not load kernel with FDT. Status=%r\n", Status);
- return Status;
+ goto EXIT_FREE_FDT;
}
return StartLinux (LinuxImage, LinuxImageSize, FdtBlobBase, FdtBlobSize, ARM_FDT_MACHINE_TYPE);
+
+EXIT_FREE_FDT:
+ gBS->FreePages (FdtBlobBase, EFI_SIZE_TO_PAGES (FdtBlobSize));
+
+EXIT_FREE_INITRD:
+ if (InitrdDevicePath) {
+ gBS->FreePages (InitrdImageBase, EFI_SIZE_TO_PAGES (InitrdImageBaseSize));
+ }
+
+EXIT_FREE_LINUX:
+ gBS->FreePages (LinuxImage, EFI_SIZE_TO_PAGES (LinuxImageSize));
+
+ return Status;
}
diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c
index 2c9324379..25f92725f 100644
--- a/ArmPkg/Library/BdsLib/BdsFilePath.c
+++ b/ArmPkg/Library/BdsLib/BdsFilePath.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* 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
@@ -17,6 +17,7 @@
#include <Protocol/UsbIo.h>
#include <Protocol/DiskIo.h>
#include <Protocol/LoadedImage.h>
+#include <Protocol/SimpleNetwork.h>
#define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype)))
@@ -77,14 +78,14 @@ BdsGetDeviceUsb (
// Get all the UsbIo handles
UsbIoHandleCount = 0;
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiUsbIoProtocolGuid, NULL, &UsbIoHandleCount, &UsbIoBuffer);
- if (EFI_ERROR(Status) || (UsbIoHandleCount == 0)) {
+ if (EFI_ERROR (Status) || (UsbIoHandleCount == 0)) {
return Status;
}
// Check if one of the handles matches the USB description
for (Index = 0; Index < UsbIoHandleCount; Index++) {
Status = gBS->HandleProtocol (UsbIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **) &UsbIoDevicePath);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
TmpDevicePath = UsbIoDevicePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
// Check if the Device Path node is a USB Removable device Path node
@@ -94,11 +95,11 @@ BdsGetDeviceUsb (
WwidDevicePath2 = (USB_WWID_DEVICE_PATH*)TmpDevicePath;
if ((WwidDevicePath1->VendorId == WwidDevicePath2->VendorId) &&
(WwidDevicePath1->ProductId == WwidDevicePath2->ProductId) &&
- (CompareMem (WwidDevicePath1+1, WwidDevicePath2+1, DevicePathNodeLength(WwidDevicePath1)-sizeof(USB_WWID_DEVICE_PATH)) == 0))
+ (CompareMem (WwidDevicePath1+1, WwidDevicePath2+1, DevicePathNodeLength(WwidDevicePath1)-sizeof (USB_WWID_DEVICE_PATH)) == 0))
{
*DeviceHandle = UsbIoBuffer[Index];
// Add the additional original Device Path Nodes (eg: FilePath Device Path Node) to the new Device Path
- *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode(RemovableDevicePath));
+ *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode (RemovableDevicePath));
return EFI_SUCCESS;
}
} else {
@@ -112,7 +113,7 @@ BdsGetDeviceUsb (
{
*DeviceHandle = UsbIoBuffer[Index];
// Add the additional original Device Path Nodes (eg: FilePath Device Path Node) to the new Device Path
- *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode(RemovableDevicePath));
+ *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode (RemovableDevicePath));
return EFI_SUCCESS;
}
}
@@ -131,7 +132,7 @@ BdsIsRemovableHd (
IN EFI_DEVICE_PATH* DevicePath
)
{
- return IS_DEVICE_PATH_NODE(DevicePath, MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP);
+ return IS_DEVICE_PATH_NODE (DevicePath, MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP);
}
EFI_STATUS
@@ -153,14 +154,14 @@ BdsGetDeviceHd (
// Get all the DiskIo handles
PartitionHandleCount = 0;
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiDiskIoProtocolGuid, NULL, &PartitionHandleCount, &PartitionBuffer);
- if (EFI_ERROR(Status) || (PartitionHandleCount == 0)) {
+ if (EFI_ERROR (Status) || (PartitionHandleCount == 0)) {
return Status;
}
// Check if one of the handles matches the Hard Disk Description
for (Index = 0; Index < PartitionHandleCount; Index++) {
Status = gBS->HandleProtocol (PartitionBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **) &PartitionDevicePath);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
TmpDevicePath = PartitionDevicePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
// Check if the Device Path node is a HD Removable device Path node
@@ -168,12 +169,12 @@ BdsGetDeviceHd (
HardDriveDevicePath1 = (HARDDRIVE_DEVICE_PATH*)RemovableDevicePath;
HardDriveDevicePath2 = (HARDDRIVE_DEVICE_PATH*)TmpDevicePath;
if ((HardDriveDevicePath1->SignatureType == HardDriveDevicePath2->SignatureType) &&
- (CompareGuid ((EFI_GUID *)HardDriveDevicePath1->Signature,(EFI_GUID *)HardDriveDevicePath2->Signature) == TRUE) &&
+ (CompareGuid ((EFI_GUID *)HardDriveDevicePath1->Signature, (EFI_GUID *)HardDriveDevicePath2->Signature) == TRUE) &&
(HardDriveDevicePath1->PartitionNumber == HardDriveDevicePath2->PartitionNumber))
{
*DeviceHandle = PartitionBuffer[Index];
// Add the additional original Device Path Nodes (eg: FilePath Device Path Node) to the new Device Path
- *NewDevicePath = AppendDevicePath (PartitionDevicePath, NextDevicePathNode(RemovableDevicePath));
+ *NewDevicePath = AppendDevicePath (PartitionDevicePath, NextDevicePathNode (RemovableDevicePath));
return EFI_SUCCESS;
}
}
@@ -191,7 +192,7 @@ BdsIsRemovableCdrom (
IN EFI_DEVICE_PATH* DevicePath
)
{
- return IS_DEVICE_PATH_NODE(DevicePath, MEDIA_DEVICE_PATH, MEDIA_CDROM_DP);
+ return IS_DEVICE_PATH_NODE (DevicePath, MEDIA_DEVICE_PATH, MEDIA_CDROM_DP);
}
EFI_STATUS
@@ -239,8 +240,8 @@ IsRemovableDevice (
TmpDevicePath = DevicePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
- for (Index = 0; Index < sizeof(RemovableDeviceSupport) / sizeof(BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
- if (RemovableDeviceSupport[Index].IsRemovable(TmpDevicePath)) {
+ for (Index = 0; Index < sizeof (RemovableDeviceSupport) / sizeof (BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
+ if (RemovableDeviceSupport[Index].IsRemovable (TmpDevicePath)) {
return TRUE;
}
}
@@ -271,9 +272,9 @@ TryRemovableDevice (
TmpDevicePath = DevicePath;
while (!IsDevicePathEnd (TmpDevicePath) && !RemovableFound) {
- for (Index = 0; Index < sizeof(RemovableDeviceSupport) / sizeof(BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
+ for (Index = 0; Index < sizeof (RemovableDeviceSupport) / sizeof (BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
RemovableDevice = &RemovableDeviceSupport[Index];
- if (RemovableDevice->IsRemovable(TmpDevicePath)) {
+ if (RemovableDevice->IsRemovable (TmpDevicePath)) {
RemovableDevicePath = TmpDevicePath;
RemovableFound = TRUE;
break;
@@ -338,7 +339,7 @@ BdsConnectDevicePath (
}
/*// We need to check if RemainingDevicePath does not point on the last node. Otherwise, calling
- // NextDevicePathNode() will return an undetermined Device Path Node
+ // NextDevicePathNode () will return an undetermined Device Path Node
if (!IsDevicePathEnd (RemainingDevicePath)) {
RemainingDevicePath = NextDevicePathNode (RemainingDevicePath);
}*/
@@ -348,7 +349,7 @@ BdsConnectDevicePath (
// Now, we have got the whole Device Path connected, call again ConnectController to ensure all the supported Driver
// Binding Protocol are connected (such as DiskIo and SimpleFileSystem)
Remaining = DevicePath;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid,&Remaining,Handle);
+ Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &Remaining, Handle);
if (!EFI_ERROR (Status)) {
Status = gBS->ConnectController (*Handle, NULL, Remaining, FALSE);
if (EFI_ERROR (Status)) {
@@ -393,9 +394,9 @@ BdsFileSystemSupport (
EFI_STATUS Status;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FsProtocol;
- Status = gBS->HandleProtocol (Handle,&gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
+ Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
- return (!EFI_ERROR(Status) && IS_DEVICE_PATH_NODE(RemainingDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP));
+ return (!EFI_ERROR (Status) && IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP));
}
EFI_STATUS
@@ -416,32 +417,32 @@ BdsFileSystemLoadImage (
EFI_FILE_PROTOCOL *File;
UINTN Size;
- ASSERT (IS_DEVICE_PATH_NODE(RemainingDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP));
+ ASSERT (IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP));
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)RemainingDevicePath;
- Status = gBS->HandleProtocol(Handle,&gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
- if (EFI_ERROR(Status)) {
+ Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
+ if (EFI_ERROR (Status)) {
return Status;
}
// Try to Open the volume and get root directory
Status = FsProtocol->OpenVolume (FsProtocol, &Fs);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
File = NULL;
- Status = Fs->Open(Fs, &File, FilePathDevicePath->PathName, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
+ Status = Fs->Open (Fs, &File, FilePathDevicePath->PathName, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
return Status;
}
Size = 0;
- File->GetInfo(File, &gEfiFileInfoGuid, &Size, NULL);
+ File->GetInfo (File, &gEfiFileInfoGuid, &Size, NULL);
FileInfo = AllocatePool (Size);
- Status = File->GetInfo(File, &gEfiFileInfoGuid, &Size, FileInfo);
- if (EFI_ERROR(Status)) {
+ Status = File->GetInfo (File, &gEfiFileInfoGuid, &Size, FileInfo);
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -450,14 +451,14 @@ BdsFileSystemLoadImage (
if (ImageSize) {
*ImageSize = Size;
}
- FreePool(FileInfo);
+ FreePool (FileInfo);
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(Size), Image);
// Try to allocate in any pages if failed to allocate memory at the defined location
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(Size), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = File->Read (File, &Size, (VOID*)(UINTN)(*Image));
}
@@ -471,8 +472,8 @@ BdsMemoryMapSupport (
IN EFI_DEVICE_PATH *RemainingDevicePath
)
{
- return IS_DEVICE_PATH_NODE(DevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP) ||
- IS_DEVICE_PATH_NODE(RemainingDevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP);
+ return IS_DEVICE_PATH_NODE (DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP) ||
+ IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP);
}
EFI_STATUS
@@ -489,10 +490,10 @@ BdsMemoryMapLoadImage (
MEMMAP_DEVICE_PATH* MemMapPathDevicePath;
UINTN Size;
- if (IS_DEVICE_PATH_NODE(RemainingDevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP)) {
+ if (IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP)) {
MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)RemainingDevicePath;
} else {
- ASSERT (IS_DEVICE_PATH_NODE(DevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP));
+ ASSERT (IS_DEVICE_PATH_NODE (DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP));
MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)DevicePath;
}
@@ -506,7 +507,7 @@ BdsMemoryMapLoadImage (
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(Size), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
CopyMem ((VOID*)(UINTN)(*Image), (CONST VOID*)(UINTN)MemMapPathDevicePath->StartingAddress, Size);
if (ImageSize != NULL) {
@@ -524,7 +525,7 @@ BdsFirmwareVolumeSupport (
IN EFI_DEVICE_PATH *RemainingDevicePath
)
{
- return IS_DEVICE_PATH_NODE(RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP);
+ return IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP);
}
EFI_STATUS
@@ -546,10 +547,10 @@ BdsFirmwareVolumeLoadImage (
UINT32 AuthenticationStatus;
VOID* ImageBuffer;
- ASSERT (IS_DEVICE_PATH_NODE(RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP));
+ ASSERT (IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP));
- Status = gBS->HandleProtocol(Handle,&gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
- if (EFI_ERROR(Status)) {
+ Status = gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -576,7 +577,7 @@ BdsFirmwareVolumeLoadImage (
// In case the buffer has some address requirements, we must copy the buffer to a buffer following the requirements
if (Type != AllocateAnyPages) {
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize),Image);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
FreePool (ImageBuffer);
}
@@ -588,7 +589,7 @@ BdsFirmwareVolumeLoadImage (
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
FreePool (ImageBuffer);
}
@@ -604,13 +605,13 @@ BdsFirmwareVolumeLoadImage (
&Attrib,
&AuthenticationStatus
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
// Try to allocate in any pages if failed to allocate memory at the defined location
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = FwVol->ReadFile (
FwVol,
FvNameGuid,
@@ -636,7 +637,7 @@ BdsPxeSupport (
EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL* PxeBcProtocol;
- if (!IsDevicePathEnd(RemainingDevicePath)) {
+ if (!IsDevicePathEnd (RemainingDevicePath)) {
return FALSE;
}
@@ -661,6 +662,7 @@ BdsPxeLoadImage (
EFI_STATUS Status;
EFI_LOAD_FILE_PROTOCOL *LoadFileProtocol;
UINTN BufferSize;
+ EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
// Get Load File Protocol attached to the PXE protocol
Status = gBS->HandleProtocol (Handle, &gEfiLoadFileProtocolGuid, (VOID **)&LoadFileProtocol);
@@ -671,16 +673,25 @@ BdsPxeLoadImage (
Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(BufferSize), Image);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, (VOID*)(UINTN)(*Image));
- if (!EFI_ERROR(Status) && (ImageSize != NULL)) {
+ if (!EFI_ERROR (Status) && (ImageSize != NULL)) {
*ImageSize = BufferSize;
}
}
+ if (Status == EFI_ALREADY_STARTED) {
+ Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
+ if (!EFI_ERROR(Status)) {
+ // If PXE is already started, we stop it
+ Pxe->Stop (Pxe);
+ // And we try again
+ return BdsPxeLoadImage (DevicePath, Handle, RemainingDevicePath, Type, Image, ImageSize);
+ }
+ }
return Status;
}
@@ -696,18 +707,18 @@ BdsTftpSupport (
EFI_PXE_BASE_CODE_PROTOCOL *PxeBcProtocol;
// Validate the Remaining Device Path
- if (IsDevicePathEnd(RemainingDevicePath)) {
+ 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)) {
+ 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)) {
+ if (IsDevicePathEnd (NextDevicePath)) {
return FALSE;
}
- if (!IS_DEVICE_PATH_NODE(NextDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP)) {
+ if (!IS_DEVICE_PATH_NODE (NextDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP)) {
return FALSE;
}
@@ -737,34 +748,63 @@ BdsTftpLoadImage (
IPv4_DEVICE_PATH* IPv4DevicePathNode;
FILEPATH_DEVICE_PATH* FilePathDevicePath;
EFI_IP_ADDRESS LocalIp;
+ CHAR8* AsciiPathName;
+ EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- ASSERT(IS_DEVICE_PATH_NODE(RemainingDevicePath,MESSAGING_DEVICE_PATH,MSG_IPv4_DP));
+ ASSERT(IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv4_DP));
IPv4DevicePathNode = (IPv4_DEVICE_PATH*)RemainingDevicePath;
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)(IPv4DevicePathNode + 1);
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
Status = Pxe->Start (Pxe, FALSE);
- if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
+ if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
return Status;
}
- if (!IPv4DevicePathNode->StaticIpAddress) {
- Status = Pxe->Dhcp(Pxe, TRUE);
- } else {
- CopyMem (&LocalIp.v4, &IPv4DevicePathNode->LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));
- Status = Pxe->SetStationIp (Pxe, &LocalIp, NULL);
- }
+ do {
+ if (!IPv4DevicePathNode->StaticIpAddress) {
+ Status = Pxe->Dhcp (Pxe, TRUE);
+ } else {
+ CopyMem (&LocalIp.v4, &IPv4DevicePathNode->LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));
+ Status = Pxe->SetStationIp (Pxe, &LocalIp, NULL);
+ }
+
+ // If an IP Address has already been set and a different static IP address is requested then restart
+ // the Network service.
+ if (Status == EFI_ALREADY_STARTED) {
+ Status = gBS->LocateProtocol (&gEfiSimpleNetworkProtocolGuid, NULL, (VOID **)&Snp);
+ if (!EFI_ERROR (Status) && IPv4DevicePathNode->StaticIpAddress &&
+ (CompareMem (&Snp->Mode->CurrentAddress, &IPv4DevicePathNode->LocalIpAddress, sizeof(EFI_MAC_ADDRESS)) != 0))
+ {
+ Pxe->Stop (Pxe);
+ Status = Pxe->Start (Pxe, FALSE);
+ if (EFI_ERROR(Status)) {
+ break;
+ }
+ // After restarting the PXE protocol, we want to try again with our new IP Address
+ Status = EFI_ALREADY_STARTED;
+ }
+ }
+ } while (Status == EFI_ALREADY_STARTED);
+
if (EFI_ERROR(Status)) {
return Status;
}
CopyMem (&ServerIp.v4, &IPv4DevicePathNode->RemoteIpAddress, sizeof (EFI_IPv4_ADDRESS));
+ // Convert the Unicode PathName to Ascii
+ AsciiPathName = AllocatePool ((StrLen (FilePathDevicePath->PathName) + 1) * sizeof (CHAR8));
+ if (AsciiPathName == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ UnicodeStrToAsciiStr (FilePathDevicePath->PathName, AsciiPathName);
+
Status = Pxe->Mtftp (
Pxe,
EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
@@ -773,18 +813,22 @@ BdsTftpLoadImage (
&TftpBufferSize,
NULL,
&ServerIp,
- (UINT8 *)FilePathDevicePath->PathName,
+ (UINT8*)AsciiPathName,
NULL,
- TRUE
+ FALSE
);
if (EFI_ERROR(Status)) {
- return Status;
+ if (Status == EFI_TFTP_ERROR) {
+ DEBUG((EFI_D_ERROR, "TFTP Error: Fail to get the size of the file\n"));
+ }
+ goto EXIT;
}
// Allocate a buffer to hold the whole file.
- TftpBuffer = AllocatePool(TftpBufferSize);
+ TftpBuffer = AllocatePool (TftpBufferSize);
if (TftpBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
+ goto EXIT;
}
Status = Pxe->Mtftp (
@@ -795,16 +839,19 @@ BdsTftpLoadImage (
&TftpBufferSize,
NULL,
&ServerIp,
- (UINT8 *)FilePathDevicePath->PathName,
+ (UINT8*)AsciiPathName,
NULL,
FALSE
);
- if (EFI_ERROR(Status)) {
- FreePool(TftpBuffer);
+ if (EFI_ERROR (Status)) {
+ FreePool (TftpBuffer);
} else if (ImageSize != NULL) {
+ *Image = (UINTN)TftpBuffer;
*ImageSize = (UINTN)TftpBufferSize;
}
+EXIT:
+ FreePool (AsciiPathName);
return Status;
}
@@ -874,20 +921,20 @@ BdsStartEfiApplication (
// Find the nearest supported file loader
Status = BdsLoadImage (DevicePath, AllocateAnyPages, &BinaryBuffer, &BinarySize);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
// Load the image from the Buffer with Boot Services function
Status = gBS->LoadImage (TRUE, ParentImageHandle, DevicePath, (VOID*)(UINTN)BinaryBuffer, BinarySize, &ImageHandle);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
// Passed LoadOptions to the EFI Application
if (LoadOptionsSize != 0) {
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
diff --git a/ArmPkg/Library/BdsLib/BdsHelper.c b/ArmPkg/Library/BdsLib/BdsHelper.c
index 5016bedcd..fb2ac9b80 100644
--- a/ArmPkg/Library/BdsLib/BdsHelper.c
+++ b/ArmPkg/Library/BdsLib/BdsHelper.c
@@ -1,14 +1,14 @@
/** @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
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
@@ -294,8 +294,21 @@ PrintPerformance (
}
EFI_STATUS
+GetGlobalEnvironmentVariable (
+ IN CONST CHAR16* VariableName,
+ IN VOID* DefaultValue,
+ IN OUT UINTN* Size,
+ OUT VOID** Value
+ )
+{
+ return GetEnvironmentVariable (VariableName, &gEfiGlobalVariableGuid,
+ DefaultValue, Size, Value);
+}
+
+EFI_STATUS
GetEnvironmentVariable (
IN CONST CHAR16* VariableName,
+ IN EFI_GUID* VendorGuid,
IN VOID* DefaultValue,
IN OUT UINTN* Size,
OUT VOID** Value
@@ -307,13 +320,13 @@ GetEnvironmentVariable (
// Try to get the variable size.
*Value = NULL;
VariableSize = 0;
- Status = gRT->GetVariable ((CHAR16 *) VariableName, &gEfiGlobalVariableGuid, NULL, &VariableSize, *Value);
+ Status = gRT->GetVariable ((CHAR16 *) VariableName, VendorGuid, NULL, &VariableSize, *Value);
if (Status == EFI_NOT_FOUND) {
if ((DefaultValue != NULL) && (Size != NULL) && (*Size != 0)) {
// If the environment variable does not exist yet then set it with the default value
Status = gRT->SetVariable (
(CHAR16*)VariableName,
- &gEfiGlobalVariableGuid,
+ VendorGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
*Size,
DefaultValue
@@ -329,7 +342,7 @@ GetEnvironmentVariable (
return EFI_OUT_OF_RESOURCES;
}
- Status = gRT->GetVariable ((CHAR16 *)VariableName, &gEfiGlobalVariableGuid, NULL, &VariableSize, *Value);
+ Status = gRT->GetVariable ((CHAR16 *)VariableName, VendorGuid, NULL, &VariableSize, *Value);
if (EFI_ERROR (Status)) {
FreePool(*Value);
return EFI_INVALID_PARAMETER;
diff --git a/ArmPkg/Library/BdsLib/BdsLib.inf b/ArmPkg/Library/BdsLib/BdsLib.inf
index 541bce88b..ccca39ab9 100644
--- a/ArmPkg/Library/BdsLib/BdsLib.inf
+++ b/ArmPkg/Library/BdsLib/BdsLib.inf
@@ -25,18 +25,21 @@
BdsAppLoader.c
BdsHelper.c
BdsLoadOption.c
-
- BdsLinuxLoader.c
- BdsLinuxAtag.c
BdsLinuxFdt.c
+[Sources.ARM]
+ Arm/BdsLinuxLoader.c
+ Arm/BdsLinuxAtag.c
+
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
ArmPkg/ArmPkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
[LibraryClasses]
ArmLib
+ ArmSmcLib
BaseLib
DebugLib
DevicePathLib
@@ -49,6 +52,7 @@
[Guids]
gEfiFileInfoGuid
gArmMpCoreInfoGuid
+ gArmGlobalVariableGuid
[Protocols]
gEfiBdsArchProtocolGuid
@@ -61,8 +65,10 @@
gEfiDiskIoProtocolGuid
gEfiUsbIoProtocolGuid
gEfiLoadedImageProtocolGuid
+ gEfiSimpleNetworkProtocolGuid
-[FeaturePcd]
+[FeaturePcd]
+ gArmTokenSpaceGuid.PcdArmPsciSupport
[FixedPcd]
gArmTokenSpaceGuid.PcdSystemMemoryBase
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxFdt.c b/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
index fa06287b1..b5dd23713 100644
--- a/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
+++ b/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
@@ -1,20 +1,23 @@
/** @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
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* 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/ArmSmcLib.h>
#include <Library/PcdLib.h>
#include <libfdt.h>
+#include <IndustryStandard/ArmSmc.h>
+
#include "BdsInternal.h"
#include "BdsLinuxLoader.h"
@@ -104,6 +107,23 @@ DebugDumpFdt (
UINTN shift;
UINT32 version;
+ {
+ // Can 'memreserve' be printed by below code?
+ INTN num = fdt_num_mem_rsv(FdtBlob);
+ INTN i, err;
+ UINT64 addr = 0,size = 0;
+
+ for (i = 0; i < num; i++) {
+ err = fdt_get_mem_rsv(FdtBlob, i, &addr, &size);
+ if (err) {
+ DEBUG((EFI_D_ERROR, "Error (%d) : Cannot get memreserve section (%d)\n", err, i));
+ }
+ else {
+ Print(L"/memreserve/ \t0x%lx \t0x%lx;\n",addr,size);
+ }
+ }
+ }
+
depth = 0;
shift = 4;
@@ -159,6 +179,25 @@ DebugDumpFdt (
}
}
+STATIC
+BOOLEAN
+IsLinuxReservedRegion (
+ IN EFI_MEMORY_TYPE MemoryType
+ )
+{
+ switch(MemoryType) {
+ case EfiRuntimeServicesCode:
+ case EfiRuntimeServicesData:
+ case EfiUnusableMemory:
+ case EfiACPIReclaimMemory:
+ case EfiACPIMemoryNVS:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+
typedef struct {
UINTN Base;
UINTN Size;
@@ -170,7 +209,7 @@ PrepareFdt (
IN EFI_PHYSICAL_ADDRESS InitrdImage,
IN UINTN InitrdImageSize,
IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase,
- IN OUT UINT32 *FdtBlobSize
+ IN OUT UINTN *FdtBlobSize
)
{
EFI_STATUS Status;
@@ -182,6 +221,7 @@ PrepareFdt (
INTN cpu_node;
INTN lenp;
CONST VOID* BootArg;
+ CONST VOID* Method;
EFI_PHYSICAL_ADDRESS InitrdImageStart;
EFI_PHYSICAL_ADDRESS InitrdImageEnd;
FdtRegion Region;
@@ -195,17 +235,65 @@ PrepareFdt (
UINT32 ClusterId;
UINT32 CoreId;
UINT64 CpuReleaseAddr;
+ UINTN MemoryMapSize;
+ EFI_MEMORY_DESCRIPTOR *MemoryMap;
+ UINTN MapKey;
+ UINTN DescriptorSize;
+ UINT32 DescriptorVersion;
+ UINTN Pages;
+ BOOLEAN PsciSmcSupported;
+ UINTN Rx;
+ UINTN OriginalFdtSize;
+ //
+ // Ensure the Power State Coordination Interface (PSCI) SMCs are there if supported
+ //
+ PsciSmcSupported = FALSE;
+ if (FeaturePcdGet (PcdArmPsciSupport) == TRUE) {
+ // Check the SMC response to the Presence SMC
+ Rx = ARM_SMC_ID_PRESENCE;
+ ArmCallSmc (&Rx);
+ if (Rx == 1) {
+ // Check the SMC UID
+ Rx = ARM_SMC_ID_UID;
+ ArmCallSmc (&Rx);
+ if (Rx == ARM_TRUSTZONE_UID_4LETTERID) {
+ Rx = ARM_SMC_ID_UID + 1;
+ ArmCallSmc (&Rx);
+ //TODO: Replace ARM magic number
+ if (Rx == 0x40524d48) {
+ PsciSmcSupported = TRUE;
+ }
+ }
+ if (PsciSmcSupported == FALSE) {
+ DEBUG((EFI_D_ERROR,"Warning: The Power State Coordination Interface (PSCI) is not supported"
+ "by your platform Trusted Firmware.\n"));
+ }
+ }
+ }
+
+ //
+ // Sanity checks on the original FDT blob.
+ //
err = fdt_check_header ((VOID*)(UINTN)(*FdtBlobBase));
if (err != 0) {
Print (L"ERROR: Device Tree header not valid (err:%d)\n", err);
return EFI_INVALID_PARAMETER;
}
+ // The original FDT blob might have been loaded partially.
+ // Check that it is not the case.
+ OriginalFdtSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(*FdtBlobBase));
+ if (OriginalFdtSize > *FdtBlobSize) {
+ Print (L"ERROR: Incomplete FDT. Only %d/%d bytes have been loaded.\n",
+ *FdtBlobSize, OriginalFdtSize);
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Allocate memory for the new FDT
//
- NewFdtBlobSize = fdt_totalsize((VOID*)(UINTN)(*FdtBlobBase)) + FDT_ADDITIONAL_ENTRIES_SIZE;
+ NewFdtBlobSize = OriginalFdtSize + FDT_ADDITIONAL_ENTRIES_SIZE;
// Try below a watermark address
Status = EFI_NOT_FOUND;
@@ -222,7 +310,7 @@ PrepareFdt (
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, EFI_SIZE_TO_PAGES(NewFdtBlobSize), &NewFdtBlobBase);
if (EFI_ERROR(Status)) {
ASSERT_EFI_ERROR(Status);
- goto FAIL_NEW_FDT;
+ goto FAIL_ALLOCATE_NEW_FDT;
} else {
DEBUG ((EFI_D_WARN, "WARNING: Loaded FDT at random address 0x%lX.\nWARNING: There is a risk of accidental overwriting by other code/data.\n", NewFdtBlobBase));
}
@@ -259,7 +347,9 @@ PrepareFdt (
}
DEBUG_CODE_END();
+ //
// Set Linux CmdLine
+ //
if ((CommandLineArguments != NULL) && (AsciiStrLen (CommandLineArguments) > 0)) {
err = fdt_setprop(fdt, node, "bootargs", CommandLineArguments, AsciiStrSize(CommandLineArguments));
if (err) {
@@ -267,7 +357,9 @@ PrepareFdt (
}
}
+ //
// Set Linux Initrd
+ //
if (InitrdImageSize != 0) {
InitrdImageStart = cpu_to_fdt64 (InitrdImage);
err = fdt_setprop(fdt, node, "linux,initrd-start", &InitrdImageStart, sizeof(EFI_PHYSICAL_ADDRESS));
@@ -281,7 +373,9 @@ PrepareFdt (
}
}
+ //
// Set Physical memory setup if does not exist
+ //
node = fdt_subnode_offset(fdt, 0, "memory");
if (node < 0) {
// The 'memory' node does not exist, create it
@@ -289,10 +383,10 @@ PrepareFdt (
if (node >= 0) {
fdt_setprop_string(fdt, node, "name", "memory");
fdt_setprop_string(fdt, node, "device_type", "memory");
-
+
GetSystemMemoryResources (&ResourceList);
Resource = (BDS_SYSTEM_MEMORY_RESOURCE*)ResourceList.ForwardLink;
-
+
if (sizeof(UINTN) == sizeof(UINT32)) {
Region.Base = cpu_to_fdt32((UINTN)Resource->PhysicalStart);
Region.Size = cpu_to_fdt32((UINTN)Resource->ResourceLength);
@@ -308,7 +402,39 @@ PrepareFdt (
}
}
+ //
+ // Add the memory regions reserved by the UEFI Firmware
+ //
+
+ // Retrieve the UEFI Memory Map
+ MemoryMap = NULL;
+ MemoryMapSize = 0;
+ Status = gBS->GetMemoryMap (&MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1;
+ MemoryMap = AllocatePages (Pages);
+ Status = gBS->GetMemoryMap (&MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion);
+ }
+
+ // Go through the list and add the reserved region to the Device Tree
+ if (!EFI_ERROR(Status)) {
+ for (Index = 0; Index < (MemoryMapSize / sizeof(EFI_MEMORY_DESCRIPTOR)); Index++) {
+ if (IsLinuxReservedRegion ((EFI_MEMORY_TYPE)MemoryMap[Index].Type)) {
+ DEBUG((DEBUG_VERBOSE, "Reserved region of type %d [0x%X, 0x%X]\n",
+ MemoryMap[Index].Type,
+ (UINTN)MemoryMap[Index].PhysicalStart,
+ (UINTN)(MemoryMap[Index].PhysicalStart + MemoryMap[Index].NumberOfPages * EFI_PAGE_SIZE)));
+ err = fdt_add_mem_rsv(fdt, MemoryMap[Index].PhysicalStart, MemoryMap[Index].NumberOfPages * EFI_PAGE_SIZE);
+ if (err != 0) {
+ Print(L"Warning: Fail to add 'memreserve' (err:%d)\n", err);
+ }
+ }
+ }
+ }
+
+ //
// Setup Arm Mpcore Info if it is a multi-core or multi-cluster platforms
+ //
for (Index=0; Index < gST->NumberOfTableEntries; Index++) {
// Check for correct GUID type
if (CompareGuid (&gArmMpCoreInfoGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {
@@ -338,28 +464,68 @@ PrepareFdt (
fdt_setprop(fdt, cpu_node, "reg", &Index, sizeof(Index));
}
- fdt_setprop_string(fdt, cpu_node, "enable-method", "spin-table");
- CpuReleaseAddr = cpu_to_fdt64(ArmCoreInfoTable[Index].MailboxSetAddress);
- fdt_setprop(fdt, cpu_node, "cpu-release-addr", &CpuReleaseAddr, sizeof(CpuReleaseAddr));
-
- // If it is not the primary core than the cpu should be disabled
- if (((ArmCoreInfoTable[Index].ClusterId != ClusterId) || (ArmCoreInfoTable[Index].CoreId != CoreId))) {
- fdt_setprop_string(fdt, cpu_node, "status", "disabled");
+ // If Power State Coordination Interface (PSCI) is not supported then it is expected the secondary
+ // cores are spinning waiting for the Operating System to release them
+ if (PsciSmcSupported == FALSE) {
+ // We as the bootloader are responsible for either creating or updating
+ // these entries. Do not trust the entries in the DT. We only know about
+ // 'spin-table' type. Do not try to update other types if defined.
+ Method = fdt_getprop(fdt, cpu_node, "enable-method", &lenp);
+ if ( (Method == NULL) || (!AsciiStrCmp((CHAR8 *)Method, "spin-table")) ) {
+ fdt_setprop_string(fdt, cpu_node, "enable-method", "spin-table");
+ CpuReleaseAddr = cpu_to_fdt64(ArmCoreInfoTable[Index].MailboxSetAddress);
+ fdt_setprop(fdt, cpu_node, "cpu-release-addr", &CpuReleaseAddr, sizeof(CpuReleaseAddr));
+
+ // If it is not the primary core than the cpu should be disabled
+ if (((ArmCoreInfoTable[Index].ClusterId != ClusterId) || (ArmCoreInfoTable[Index].CoreId != CoreId))) {
+ fdt_setprop_string(fdt, cpu_node, "status", "disabled");
+ }
+ } else {
+ Print(L"Warning: Unsupported enable-method type for CPU[%d] : %a\n", Index, (CHAR8 *)Method);
+ }
}
}
break;
}
}
+ // If the Power State Coordination Interface is supported then we signal it in the Device Tree
+ if (PsciSmcSupported == TRUE) {
+ // Before to create it we check if the node is not already defined in the Device Tree
+ node = fdt_subnode_offset(fdt, 0, "psci");
+ if (node < 0) {
+ // The 'psci' node does not exist, create it
+ node = fdt_add_subnode(fdt, 0, "psci");
+ if (node < 0) {
+ DEBUG((EFI_D_ERROR,"Error on creating 'psci' node\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto FAIL_NEW_FDT;
+ } else {
+ fdt_setprop_string(fdt, node, "compatible", "arm,psci");
+ fdt_setprop_string(fdt, node, "method", "smc");
+ fdt_setprop_cell(fdt, node, "cpu_suspend", ARM_SMC_ARM_CPU_SUSPEND);
+ fdt_setprop_cell(fdt, node, "cpu_off", ARM_SMC_ARM_CPU_OFF);
+ fdt_setprop_cell(fdt, node, "cpu_on", ARM_SMC_ARM_CPU_ON);
+ fdt_setprop_cell(fdt, node, "cpu_migrate", ARM_SMC_ARM_MIGRATE);
+ }
+ }
+ }
+
DEBUG_CODE_BEGIN();
//DebugDumpFdt (fdt);
DEBUG_CODE_END();
+ // If we succeeded to generate the new Device Tree then free the old Device Tree
+ gBS->FreePages (*FdtBlobBase, EFI_SIZE_TO_PAGES (*FdtBlobSize));
+
*FdtBlobBase = NewFdtBlobBase;
*FdtBlobSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(NewFdtBlobBase));
return EFI_SUCCESS;
FAIL_NEW_FDT:
+ gBS->FreePages (NewFdtBlobBase, EFI_SIZE_TO_PAGES (NewFdtBlobSize));
+
+FAIL_ALLOCATE_NEW_FDT:
*FdtBlobSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(*FdtBlobBase));
// Return success even if we failed to update the FDT blob. The original one is still valid.
return EFI_SUCCESS;
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.h b/ArmPkg/Library/BdsLib/BdsLinuxLoader.h
index a3ecddc4f..09b212f36 100644
--- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.h
+++ b/ArmPkg/Library/BdsLib/BdsLinuxLoader.h
@@ -150,7 +150,7 @@ PrepareFdt (
IN EFI_PHYSICAL_ADDRESS InitrdImage,
IN UINTN InitrdImageSize,
IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase,
- IN OUT UINT32 *FdtBlobSize
+ IN OUT UINTN *FdtBlobSize
);
#endif
diff --git a/ArmPkg/Library/BdsLib/BdsLoadOption.c b/ArmPkg/Library/BdsLib/BdsLoadOption.c
index 3f4566ffa..be5ed4198 100644
--- a/ArmPkg/Library/BdsLib/BdsLoadOption.c
+++ b/ArmPkg/Library/BdsLib/BdsLoadOption.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* 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
@@ -76,7 +76,7 @@ BootOptionFromLoadOptionVariable (
EFI_LOAD_OPTION EfiLoadOption;
UINTN EfiLoadOptionSize;
- Status = GetEnvironmentVariable (BootVariableName, NULL, &EfiLoadOptionSize, (VOID**)&EfiLoadOption);
+ Status = GetGlobalEnvironmentVariable (BootVariableName, NULL, &EfiLoadOptionSize, (VOID**)&EfiLoadOption);
if (!EFI_ERROR(Status)) {
*BdsLoadOption = NULL;
Status = BootOptionParseLoadOption (EfiLoadOption, EfiLoadOptionSize, BdsLoadOption);
@@ -203,7 +203,7 @@ BootOptionToLoadOptionVariable (
// When it is a new entry we must add the entry to the BootOrder
if (OldLoadOption == NULL) {
// Add the new Boot Index to the list
- Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ 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
@@ -225,7 +225,7 @@ BootOptionToLoadOptionVariable (
);
DEBUG((EFI_D_ERROR,"Create %s\n",BootVariableName));
- // Free memory allocated by GetEnvironmentVariable
+ // Free memory allocated by GetGlobalEnvironmentVariable
if (!EFI_ERROR(Status)) {
FreePool (BootOrder);
}
@@ -249,7 +249,7 @@ BootOptionAllocateBootIndex (
BOOLEAN Found;
// Get the Boot Option Order from the environment variable
- Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
if (!EFI_ERROR(Status)) {
for (BootIndex = 0; BootIndex <= 0xFFFF; BootIndex++) {
Found = FALSE;
diff --git a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentException.S b/ArmPkg/Library/DebugAgentSymbolsBaseLib/Arm/DebugAgentException.S
index d92acfeac..d92acfeac 100644
--- a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentException.S
+++ b/ArmPkg/Library/DebugAgentSymbolsBaseLib/Arm/DebugAgentException.S
diff --git a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentException.asm b/ArmPkg/Library/DebugAgentSymbolsBaseLib/Arm/DebugAgentException.asm
index f281c0603..f281c0603 100644
--- a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentException.asm
+++ b/ArmPkg/Library/DebugAgentSymbolsBaseLib/Arm/DebugAgentException.asm
diff --git a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.c b/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.c
index c27d8e7dd..25a904e3f 100644
--- a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.c
+++ b/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.c
@@ -221,7 +221,7 @@ GetImageContext (
ImageContext->ImageRead = PeCoffLoaderImageReadFromMemory;
Status = PeCoffLoaderGetImageInfo (ImageContext);
- if (!EFI_ERROR(Status) && ((VOID*)ImageContext->DebugDirectoryEntryRva != NULL)) {
+ if (!EFI_ERROR(Status) && ((VOID*)(UINTN)ImageContext->DebugDirectoryEntryRva != NULL)) {
ImageAddress = ImageContext->ImageAddress;
if (ImageContext->IsTeImage) {
ImageAddress += sizeof (EFI_TE_IMAGE_HEADER) - ((EFI_TE_IMAGE_HEADER*)EfiImage)->StrippedSize;
@@ -285,8 +285,8 @@ InitializeDebugAgent (
// Now we've got UART, make the check:
// - The Vector table must be 32-byte aligned
- ASSERT(((UINT32)DebugAgentVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0);
- ArmWriteVBar ((UINT32)DebugAgentVectorTable);
+ ASSERT(((UINTN)DebugAgentVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0);
+ ArmWriteVBar ((UINTN)DebugAgentVectorTable);
// We use InitFlag to know if DebugAgent has been intialized from
// Sec (DEBUG_AGENT_INIT_PREMEM_SEC) or PrePi (DEBUG_AGENT_INIT_POSTMEM_SEC)
@@ -295,7 +295,7 @@ InitializeDebugAgent (
//
// Get the Sec or PrePeiCore module (defined as SEC type module)
//
- Status = GetFfsFile ((EFI_FIRMWARE_VOLUME_HEADER*)PcdGet32(PcdSecureFvBaseAddress), EFI_FV_FILETYPE_SECURITY_CORE, &FfsHeader);
+ Status = GetFfsFile ((EFI_FIRMWARE_VOLUME_HEADER*)(UINTN)PcdGet32(PcdSecureFvBaseAddress), EFI_FV_FILETYPE_SECURITY_CORE, &FfsHeader);
if (!EFI_ERROR(Status)) {
Status = GetImageContext (FfsHeader,&ImageContext);
if (!EFI_ERROR(Status)) {
@@ -306,7 +306,7 @@ InitializeDebugAgent (
//
// Get the PrePi or PrePeiCore module (defined as SEC type module)
//
- Status = GetFfsFile ((EFI_FIRMWARE_VOLUME_HEADER*)PcdGet32(PcdFvBaseAddress), EFI_FV_FILETYPE_SECURITY_CORE, &FfsHeader);
+ Status = GetFfsFile ((EFI_FIRMWARE_VOLUME_HEADER*)(UINTN)PcdGet32(PcdFvBaseAddress), EFI_FV_FILETYPE_SECURITY_CORE, &FfsHeader);
if (!EFI_ERROR(Status)) {
Status = GetImageContext (FfsHeader,&ImageContext);
if (!EFI_ERROR(Status)) {
@@ -317,7 +317,7 @@ InitializeDebugAgent (
//
// Get the PeiCore module (defined as PEI_CORE type module)
//
- Status = GetFfsFile ((EFI_FIRMWARE_VOLUME_HEADER*)PcdGet32(PcdFvBaseAddress), EFI_FV_FILETYPE_PEI_CORE, &FfsHeader);
+ Status = GetFfsFile ((EFI_FIRMWARE_VOLUME_HEADER*)(UINTN)PcdGet32(PcdFvBaseAddress), EFI_FV_FILETYPE_PEI_CORE, &FfsHeader);
if (!EFI_ERROR(Status)) {
Status = GetImageContext (FfsHeader,&ImageContext);
if (!EFI_ERROR(Status)) {
diff --git a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf b/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
index 1cf0b3352..f6a0ec293 100644
--- a/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
+++ b/ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
@@ -21,9 +21,11 @@
[Sources.common]
DebugAgentSymbolsBaseLib.c
- DebugAgentException.asm | RVCT
- DebugAgentException.S | GCC
-
+
+[Sources.ARM]
+ Arm/DebugAgentException.asm | RVCT
+ Arm/DebugAgentException.S | GCC
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
index 0cf03561d..6d0bb988e 100755
--- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
+++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
@@ -83,22 +83,24 @@ PeCoffLoaderRelocateImageExtraAction (
CHAR8 Temp[512];
#endif
- if (ImageContext->PdbPointer)
+ if (ImageContext->PdbPointer) {
#ifdef __CC_ARM
#if (__ARMCC_VERSION < 500000)
- // Print out the command for the RVD debugger to load symbols for this image
- DEBUG ((EFI_D_ERROR, "load /a /ni /np %a &0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
+ // Print out the command for the RVD debugger to load symbols for this image
+ DEBUG ((EFI_D_ERROR, "load /a /ni /np %a &0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
#else
- // Print out the command for the DS-5 to load symbols for this image
- DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
+ // Print out the command for the DS-5 to load symbols for this image
+ DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
#endif
#elif __GNUC__
- // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required
- DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
+ // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required
+ DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
#else
- do {} while (0);
- DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint)));
+ DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint)));
#endif
+ } else {
+ DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint)));
+ }
}
@@ -123,16 +125,17 @@ PeCoffLoaderUnloadImageExtraAction (
CHAR8 Temp[512];
#endif
- if (ImageContext->PdbPointer)
+ if (ImageContext->PdbPointer) {
#ifdef __CC_ARM
- {
- // Print out the command for the RVD debugger to load symbols for this image
+ // Print out the command for the RVD debugger to load symbols for this image
DEBUG ((EFI_D_ERROR, "unload symbols_only %a\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp))));
- }
#elif __GNUC__
- // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required
- DEBUG ((EFI_D_ERROR, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
+ // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required
+ DEBUG ((EFI_D_ERROR, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));
#else
- DEBUG ((EFI_D_ERROR, "Unloading %a\n", ImageContext->PdbPointer));
+ DEBUG ((EFI_D_ERROR, "Unloading %a\n", ImageContext->PdbPointer));
#endif
+ } else {
+ DEBUG ((EFI_D_ERROR, "Unloading driver at 0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress));
+ }
}
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
index bb29b95da..74e2a7602 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
@@ -36,9 +36,9 @@ typedef struct {
CHAR8 *
GetImageName (
- IN UINT32 FaultAddress,
- OUT UINT32 *ImageBase,
- OUT UINT32 *PeCoffSizeOfHeaders
+ IN UINTN FaultAddress,
+ OUT UINTN *ImageBase,
+ OUT UINTN *PeCoffSizeOfHeaders
);
/**
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerBase.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerBase.c
index e68617e1e..4a54298b1 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerBase.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerBase.c
@@ -26,9 +26,9 @@
**/
CHAR8 *
GetImageName (
- IN UINT32 FaultAddress,
- OUT UINT32 *ImageBase,
- OUT UINT32 *PeCoffSizeOfHeaders
+ IN UINTN FaultAddress,
+ OUT UINTN *ImageBase,
+ OUT UINTN *PeCoffSizeOfHeaders
)
{
return NULL;
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
index 120e2de21..61dabf484 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
@@ -21,11 +21,12 @@
LIBRARY_CLASS = DefaultExceptionHandlerLib
CONSTRUCTOR = DefaultExceptionHandlerConstructor
-
[Sources.common]
- DefaultExceptionHandler.c
DefaultExceptionHandlerUefi.c
+[Sources.ARM]
+ Arm/DefaultExceptionHandler.c
+
[Packages]
MdePkg/MdePkg.dec
ArmPkg/ArmPkg.dec
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
index f51d3a0ef..39b2775fc 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
@@ -21,9 +21,11 @@
LIBRARY_CLASS = DefaultExceptionHandlerLib
[Sources.common]
- DefaultExceptionHandler.c
DefaultExceptionHandlerBase.c
+[Sources.ARM]
+ Arm/DefaultExceptionHandler.c
+
[Packages]
MdePkg/MdePkg.dec
ArmPkg/ArmPkg.dec
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
index 8543ade99..b2d630cb3 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
@@ -62,9 +62,9 @@ DefaultExceptionHandlerConstructor (
**/
CHAR8 *
GetImageName (
- IN UINT32 FaultAddress,
- OUT UINT32 *ImageBase,
- OUT UINT32 *PeCoffSizeOfHeaders
+ IN UINTN FaultAddress,
+ OUT UINTN *ImageBase,
+ OUT UINTN *PeCoffSizeOfHeaders
)
{
EFI_DEBUG_IMAGE_INFO *DebugTable;
@@ -83,7 +83,7 @@ GetImageName (
(DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
if ((Address >= (CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&
(Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
- *ImageBase = (UINT32)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
+ *ImageBase = (UINTN)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
*PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)*ImageBase);
return PeCoffLoaderGetPdbPointer (DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase);
}
@@ -93,3 +93,4 @@ GetImageName (
return NULL;
}
+
diff --git a/ArmPkg/Library/SemihostLib/Arm/SemihostLib.c b/ArmPkg/Library/SemihostLib/SemihostLib.c
index 01b6dc334..87c0379d6 100644
--- a/ArmPkg/Library/SemihostLib/Arm/SemihostLib.c
+++ b/ArmPkg/Library/SemihostLib/SemihostLib.c
@@ -30,7 +30,7 @@ RETURN_STATUS
SemihostFileOpen (
IN CHAR8 *FileName,
IN UINT32 Mode,
- OUT UINT32 *FileHandle
+ OUT UINTN *FileHandle
)
{
SEMIHOST_FILE_OPEN_BLOCK OpenBlock;
@@ -40,6 +40,11 @@ SemihostFileOpen (
return RETURN_INVALID_PARAMETER;
}
+ // Remove any leading separator (e.g.: '\'). EFI Shell adds one.
+ if (*FileName == '\\') {
+ FileName++;
+ }
+
OpenBlock.FileName = FileName;
OpenBlock.Mode = Mode;
OpenBlock.NameLength = AsciiStrLen(FileName);
@@ -56,8 +61,8 @@ SemihostFileOpen (
RETURN_STATUS
SemihostFileSeek (
- IN UINT32 FileHandle,
- IN UINT32 Offset
+ IN UINTN FileHandle,
+ IN UINTN Offset
)
{
SEMIHOST_FILE_SEEK_BLOCK SeekBlock;
@@ -77,8 +82,8 @@ SemihostFileSeek (
RETURN_STATUS
SemihostFileRead (
- IN UINT32 FileHandle,
- IN OUT UINT32 *Length,
+ IN UINTN FileHandle,
+ IN OUT UINTN *Length,
OUT VOID *Buffer
)
{
@@ -105,8 +110,8 @@ SemihostFileRead (
RETURN_STATUS
SemihostFileWrite (
- IN UINT32 FileHandle,
- IN OUT UINT32 *Length,
+ IN UINTN FileHandle,
+ IN OUT UINTN *Length,
IN VOID *Buffer
)
{
@@ -127,7 +132,7 @@ SemihostFileWrite (
RETURN_STATUS
SemihostFileClose (
- IN UINT32 FileHandle
+ IN UINTN FileHandle
)
{
INT32 Result = Semihost_SYS_CLOSE(&FileHandle);
@@ -141,8 +146,8 @@ SemihostFileClose (
RETURN_STATUS
SemihostFileLength (
- IN UINT32 FileHandle,
- OUT UINT32 *Length
+ IN UINTN FileHandle,
+ OUT UINTN *Length
)
{
INT32 Result;
diff --git a/ArmPkg/Library/SemihostLib/SemihostLib.inf b/ArmPkg/Library/SemihostLib/SemihostLib.inf
index 5ec7fef3a..a0a687178 100644
--- a/ArmPkg/Library/SemihostLib/SemihostLib.inf
+++ b/ArmPkg/Library/SemihostLib/SemihostLib.inf
@@ -27,10 +27,11 @@
#
# VALID_ARCHITECTURES = ARM
#
+[Sources.common]
+ SemihostLib.c
+
[Sources.ARM]
Arm/GccSemihost.S | GCC
- Arm/SemihostLib.c
-
[Packages]
MdePkg/MdePkg.dec
@@ -38,10 +39,4 @@
[LibraryClasses]
BaseLib
-
-[Protocols]
-
-[Guids]
-
-[Pcd]
- \ No newline at end of file
+
diff --git a/ArmPkg/Library/SemihostLib/Arm/SemihostPrivate.h b/ArmPkg/Library/SemihostLib/SemihostPrivate.h
index 02836ca28..02836ca28 100644
--- a/ArmPkg/Library/SemihostLib/Arm/SemihostPrivate.h
+++ b/ArmPkg/Library/SemihostLib/SemihostPrivate.h
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
index 6de48414b..126fb3648 100644
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
@@ -81,6 +81,7 @@
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
ArmGicLib|ArmPkg/Drivers/PL390Gic/PL390GicLib.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
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index 024023df2..e672ce2e9 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -135,8 +135,9 @@
# - 2 = a Linux kernel with FDT support
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0|UINT32|0x00000010
gArmPlatformTokenSpaceGuid.PcdFdtDevicePath|L""|VOID*|0x00000011
- gArmPlatformTokenSpaceGuid.PcdDefaultFdtLocalDevicePath|L""|VOID*|0x0000002E
-
+
+ gArmPlatformTokenSpaceGuid.PcdDefaultFdtLocalDevicePath|L""|VOID*|0x0000002E
+
## Timeout value for displaying progressing bar in before boot OS.
# According to UEFI 2.0 spec, the default TimeOut should be 0xffff.
gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut|0xffff|UINT16|0x0000001A
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index 82159fcb2..495896c88 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -80,6 +80,7 @@
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
ArmGicLib|ArmPkg/Drivers/PL390Gic/PL390GicLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg.fdf b/ArmPlatformPkg/ArmPlatformPkg.fdf
index 887c1c10d..41f6256ee 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.fdf
+++ b/ArmPlatformPkg/ArmPlatformPkg.fdf
@@ -26,9 +26,9 @@
[FD.Sec_ArmPlatform_EFI]
BaseAddress = 0xEC000000|gArmTokenSpaceGuid.PcdSecureFdBaseAddress #The base address of the Secure FLASH Device.
-Size = 0x00012000|gArmTokenSpaceGuid.PcdSecureFdSize #The size in bytes of the Secure FLASH Device
+Size = 0x00015000|gArmTokenSpaceGuid.PcdSecureFdSize #The size in bytes of the Secure FLASH Device
ErasePolarity = 1
-BlockSize = 0x00001200
+BlockSize = 0x00001500
NumBlocks = 0x10
################################################################################
@@ -47,7 +47,7 @@ NumBlocks = 0x10
#
################################################################################
-0x00000000|0x00012000
+0x00000000|0x00015000
gArmTokenSpaceGuid.PcdSecureFvBaseAddress|gArmTokenSpaceGuid.PcdSecureFvSize
FV = FVMAIN_SEC
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
index 385d296db..bc4807f3f 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
@@ -61,11 +61,13 @@
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
ArmGicLib|ArmPkg/Drivers/PL390Gic/PL390GicLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
# RealView Emulation Board Specific Libraries
EfiResetSystemLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+ SerialPortExtLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf
TimerLib|ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
# ARM PL011 UART Driver
PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 1997743c9..4b0666f3d 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -51,7 +51,7 @@
LcdPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
- ArmSmcLib|ArmPlatformPkg/Library/ArmSmcLib/ArmSmcLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
[BuildOptions]
!ifdef $(ARM_BIGLITTLE_TC2)
@@ -127,8 +127,8 @@
# A7_0 = 0x100, GicCoreId = 2
# A7_1 = 0x101, GicCoreId = 3
# A7_2 = 0x102, GicCoreId = 4
- gArmTokenSpaceGuid.PcdArmPrimaryCore|0
- gArmTokenSpaceGuid.PcdGicPrimaryCoreId|0
+ gArmTokenSpaceGuid.PcdArmPrimaryCore|0x100
+ gArmTokenSpaceGuid.PcdGicPrimaryCoreId|0x100
!endif
#
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
index 8672993bd..47dc0ff76 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
@@ -62,6 +62,7 @@
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
ArmGicLib|ArmPkg/Drivers/PL390Gic/PL390GicLib.inf
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
# Versatile Express Specific Libraries
ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
@@ -76,6 +77,7 @@
# ARM PL011 UART Driver
PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+ SerialPortExtLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf
# ARM SP804 Dual Timer Driver
TimerLib|ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h b/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h
index 365f06002..b52f89a5c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h
+++ b/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/CTA15-A7/ArmPlatform.h
@@ -97,10 +97,11 @@
#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_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)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
index c650a6e3a..87f41c7ae 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
+++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7.c
@@ -121,7 +121,11 @@ ArmPlatformGetBootMode (
VOID
)
{
- return BOOT_WITH_FULL_CONFIGURATION;
+ 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;
+ }
}
/**
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
index 129c7b1d9..d1a17f1a7 100644
--- a/ArmPlatformPkg/Bds/Bds.c
+++ b/ArmPlatformPkg/Bds/Bds.c
@@ -1,14 +1,14 @@
/** @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
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
@@ -39,7 +39,7 @@ GetConsoleDevicePathFromVariable (
CHAR16* NextDevicePathStr;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
- Status = GetEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);
+ 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')) {
@@ -124,7 +124,7 @@ InitializeConsolePipe (
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);
@@ -223,10 +223,10 @@ DefineDefaultBootEntries (
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
ARM_BDS_LOADER_TYPE BootType;
EFI_DEVICE_PATH* InitrdPath;
- EFI_DEVICE_PATH* FdtLocalPath;
+ EFI_DEVICE_PATH* FdtLocalPath;
UINTN CmdLineSize;
UINTN InitrdSize;
- UINTN FdtLocalSize;
+ UINTN FdtLocalSize;
//
// If Boot Order does not exist then create a default entry
@@ -264,26 +264,26 @@ DefineDefaultBootEntries (
if (BootDevicePath != NULL) {
BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
CmdLineSize = AsciiStrSize ((CHAR8*)PcdGetPtr(PcdDefaultBootArgument));
InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
InitrdSize = GetDevicePathSize (InitrdPath);
- if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- FdtLocalPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultFdtLocalDevicePath));
- FdtLocalSize = GetDevicePathSize (FdtLocalPath);
- } else {
- FdtLocalPath = NULL;
- FdtLocalSize = 0;
- }
-
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
+ if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ FdtLocalPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultFdtLocalDevicePath));
+ FdtLocalSize = GetDevicePathSize (FdtLocalPath);
+ } else {
+ FdtLocalPath = NULL;
+ FdtLocalSize = 0;
+ }
+
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
+ BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize);
CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
- CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
+ CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
} else {
BootArguments = NULL;
}
@@ -324,7 +324,7 @@ StartDefaultBootOnTimeout (
Size = sizeof(UINT16);
Timeout = (UINT16)PcdGet16 (PcdPlatformBootTimeOut);
TimeoutPtr = &Timeout;
- GetEnvironmentVariable (L"Timeout", &Timeout, &Size, (VOID**)&TimeoutPtr);
+ GetGlobalEnvironmentVariable (L"Timeout", &Timeout, &Size, (VOID**)&TimeoutPtr);
if (Timeout != 0xFFFF) {
if (Timeout > 0) {
@@ -355,7 +355,7 @@ StartDefaultBootOnTimeout (
// 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)
- GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ 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]);
@@ -373,19 +373,19 @@ StartDefaultBootOnTimeout (
}
/**
- 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
+ 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.
@@ -419,7 +419,7 @@ BdsEntry (
// If BootNext environment variable is defined then we just load it !
BootNextSize = sizeof(UINT16);
- Status = GetEnvironmentVariable (L"BootNext", NULL, &BootNextSize, (VOID**)&BootNext);
+ Status = GetGlobalEnvironmentVariable (L"BootNext", NULL, &BootNextSize, (VOID**)&BootNext);
if (!EFI_ERROR(Status)) {
ASSERT(BootNextSize == sizeof(UINT16));
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index a032d5e47..8b3f1d2e3 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -68,7 +68,7 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument
gArmPlatformTokenSpaceGuid.PcdDefaultBootType
gArmPlatformTokenSpaceGuid.PcdFdtDevicePath
- gArmPlatformTokenSpaceGuid.PcdDefaultFdtLocalDevicePath
+ gArmPlatformTokenSpaceGuid.PcdDefaultFdtLocalDevicePath
gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
index 9bc8229d7..aab37d0e0 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* 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
@@ -48,19 +48,20 @@
typedef enum {
BDS_LOADER_EFI_APPLICATION = 0,
BDS_LOADER_KERNEL_LINUX_ATAG,
- BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT,
- BDS_LOADER_KERNEL_LINUX_LOCAL_FDT,
+ BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT,
+ BDS_LOADER_KERNEL_LINUX_LOCAL_FDT,
} ARM_BDS_LOADER_TYPE;
typedef struct {
UINT16 CmdLineSize;
UINT16 InitrdSize;
- UINT16 FdtLocalSize;
-
+
+ UINT16 FdtLocalSize;
+
// These following fields have variable length and are packed:
//CHAR8 *CmdLine;
//EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;
- //EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathList;
+ //EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathList;
} ARM_BDS_LINUX_ARGUMENTS;
typedef union {
@@ -103,7 +104,7 @@ 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 **DevicePathNode, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
+ EFI_STATUS (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
} BDS_LOAD_OPTION_SUPPORT;
@@ -111,14 +112,6 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption
EFI_STATUS
-GetEnvironmentVariable (
- IN CONST CHAR16* VariableName,
- IN VOID* DefaultValue,
- IN OUT UINTN* Size,
- OUT VOID** Value
- );
-
-EFI_STATUS
BootDeviceListSupportedInit (
IN OUT LIST_ENTRY *SupportedDeviceList
);
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index 215be6ba4..4b35e90b6 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -125,15 +125,15 @@ BootMenuAddBootOption (
ARM_BDS_LOADER_TYPE BootType;
BDS_LOAD_OPTION_ENTRY *BdsLoadOptionEntry;
EFI_DEVICE_PATH *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPathNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
+ EFI_DEVICE_PATH_PROTOCOL *InitrdPathNodes;
EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
- EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathNode;
- EFI_DEVICE_PATH_PROTOCOL *FdtLocalPath;
+ EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathNode;
+ EFI_DEVICE_PATH_PROTOCOL *FdtLocalPath;
UINTN CmdLineSize;
BOOLEAN InitrdSupport;
UINTN InitrdSize;
- UINTN FdtLocalSize;
+ UINTN FdtLocalSize;
Attributes = 0;
SupportedBootDevice = NULL;
@@ -146,15 +146,19 @@ BootMenuAddBootOption (
}
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNode, &BootType, &Attributes);
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes, &BootType, &Attributes);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
- // Append the Device Path node to the select device path
- DevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNode);
+ // 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;
+ }
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
Print(L"Add an initrd: ");
Status = GetHIInputBoolean (&InitrdSupport);
if (EFI_ERROR(Status)) {
@@ -164,15 +168,19 @@ BootMenuAddBootOption (
if (InitrdSupport) {
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNode, NULL, NULL);
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL, NULL);
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
Status = EFI_ABORTED;
goto EXIT;
}
- if (InitrdPathNode != NULL) {
- // Append the Device Path node to the select device path
- InitrdPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ if (InitrdPathNodes != NULL) {
+ // Append the Device Path to the selected device path
+ InitrdPath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
+ if (InitrdPath == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto EXIT;
+ }
} else {
InitrdPath = NULL;
}
@@ -187,36 +195,36 @@ BootMenuAddBootOption (
goto FREE_DEVICE_PATH;
}
- if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- // Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL);
- if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (FdtLocalPathNode != NULL) {
- // Append the Device Path node to the select device path
- FdtLocalPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode);
- } else {
- FdtLocalPath = NULL;
- }
- } else {
- FdtLocalPath = NULL;
- }
-
+ if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ // Create the specific device path node
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL);
+ if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (FdtLocalPathNode != NULL) {
+ // Append the Device Path node to the select device path
+ FdtLocalPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode);
+ } else {
+ FdtLocalPath = NULL;
+ }
+ } else {
+ FdtLocalPath = NULL;
+ }
+
CmdLineSize = AsciiStrSize (CmdLine);
InitrdSize = GetDevicePathSize (InitrdPath);
- FdtLocalSize = GetDevicePathSize (FdtLocalPath);
+ FdtLocalSize = GetDevicePathSize (FdtLocalPath);
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
+ BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize);
CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
} else {
BootArguments = NULL;
}
@@ -238,7 +246,6 @@ BootMenuAddBootOption (
FREE_DEVICE_PATH:
FreePool (DevicePath);
-
EXIT:
if (Status == EFI_ABORTED) {
Print(L"\n");
@@ -291,7 +298,7 @@ BootMenuSelectBootOption (
Print(L"\t- %s\n",DevicePathTxt);
OptionalData = BdsLoadOption->OptionalData;
LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
- if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1);
}
@@ -305,7 +312,7 @@ BootMenuSelectBootOption (
if (BootOptionCount == 0) {
if (StrCmp (InputStatement, DELETE_BOOT_ENTRY) == 0) {
Print (L"Nothing to remove!\n");
- }else if (StrCmp (InputStatement, UPDATE_BOOT_ENTRY) == 0) {
+ } else if (StrCmp (InputStatement, UPDATE_BOOT_ENTRY) == 0) {
Print (L"Couldn't find valid boot entries\n");
} else{
Print (L"No supported Boot Entry.\n");
@@ -383,19 +390,19 @@ BootMenuUpdateBootOption (
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
EFI_DEVICE_PATH *DevicePath;
EFI_DEVICE_PATH *TempInitrdPath;
- EFI_DEVICE_PATH *TempFdtLocalPath;
+ EFI_DEVICE_PATH *TempFdtLocalPath;
ARM_BDS_LOADER_TYPE BootType;
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
- EFI_DEVICE_PATH *InitrdPathNode;
+ EFI_DEVICE_PATH *InitrdPathNodes;
EFI_DEVICE_PATH *InitrdPath;
UINTN InitrdSize;
- EFI_DEVICE_PATH *FdtLocalPathNode;
- EFI_DEVICE_PATH *FdtLocalPath;
- UINTN FdtLocalSize;
+ EFI_DEVICE_PATH *FdtLocalPathNode;
+ EFI_DEVICE_PATH *FdtLocalPath;
+ UINTN FdtLocalSize;
UINTN CmdLineSize;
BOOLEAN InitrdSupport;
- BOOLEAN FdtLocalSupport;
+ BOOLEAN FdtLocalSupport;
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, TRUE, &BootOptionEntry);
if (EFI_ERROR(Status)) {
@@ -419,63 +426,63 @@ BootMenuUpdateBootOption (
OptionalData = BootOption->OptionalData;
BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
LinuxArguments = &OptionalData->Arguments.LinuxArguments;
CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
- FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
-
- if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- if (FdtLocalSize > 0) {
- Print(L"Keep the local FDT: ");
- } else {
- Print(L"Add a local FDT: ");
- }
- Status = GetHIInputBoolean (&FdtLocalSupport);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- if (FdtLocalSupport && BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- if (FdtLocalSize > 0) {
- // Case we update the FDT local device path
- Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize), L"local FDT", &FdtLocalPath, NULL, NULL);
- if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string
- Status = EFI_ABORTED;
- goto EXIT;
- }
- FdtLocalSize = GetDevicePathSize (FdtLocalPath);
- } else {
- // Case we create the FdtLocal device path
-
- Status = DeviceSupport->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL);
- if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (FdtLocalPathNode != NULL) {
- // Duplicate Linux kernel Device Path
- TempFdtLocalPath = DuplicateDevicePath (BootOption->FilePathList);
- // Replace Linux kernel Node by EndNode
- SetDevicePathEndNode (GetLastDevicePathNode (TempFdtLocalPath));
- // Append the Device Path node to the select device path
- FdtLocalPath = AppendDevicePathNode (TempFdtLocalPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode);
- FreePool (TempFdtLocalPath);
- FdtLocalSize = GetDevicePathSize (FdtLocalPath);
- } else {
- FdtLocalPath = NULL;
- }
- }
- } else {
- FdtLocalSize = 0;
- }
- } else {
- FdtLocalSupport = FALSE;
- }
-
+ FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
+
+ if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ if (FdtLocalSize > 0) {
+ Print(L"Keep the local FDT: ");
+ } else {
+ Print(L"Add a local FDT: ");
+ }
+ Status = GetHIInputBoolean (&FdtLocalSupport);
+ if (EFI_ERROR(Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+ if (FdtLocalSupport && BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ if (FdtLocalSize > 0) {
+ // Case we update the FDT local device path
+ Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize), L"local FDT", &FdtLocalPath, NULL, NULL);
+ if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+ FdtLocalSize = GetDevicePathSize (FdtLocalPath);
+ } else {
+ // Case we create the FdtLocal device path
+
+ Status = DeviceSupport->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL);
+ if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (FdtLocalPathNode != NULL) {
+ // Duplicate Linux kernel Device Path
+ TempFdtLocalPath = DuplicateDevicePath (BootOption->FilePathList);
+ // Replace Linux kernel Node by EndNode
+ SetDevicePathEndNode (GetLastDevicePathNode (TempFdtLocalPath));
+ // Append the Device Path node to the select device path
+ FdtLocalPath = AppendDevicePathNode (TempFdtLocalPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode);
+ FreePool (TempFdtLocalPath);
+ FdtLocalSize = GetDevicePathSize (FdtLocalPath);
+ } else {
+ FdtLocalPath = NULL;
+ }
+ }
+ } else {
+ FdtLocalSize = 0;
+ }
+ } else {
+ FdtLocalSupport = FALSE;
+ }
+
if (InitrdSize > 0) {
Print(L"Keep the initrd: ");
} else {
@@ -499,20 +506,24 @@ BootMenuUpdateBootOption (
} else {
// Case we create the initrd device path
- Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNode, NULL, NULL);
+ Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL, NULL);
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
Status = EFI_ABORTED;
goto EXIT;
}
- if (InitrdPathNode != NULL) {
+ if (InitrdPathNodes != NULL) {
// Duplicate Linux kernel Device Path
TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
// Replace Linux kernel Node by EndNode
SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
- // Append the Device Path node to the select device path
- InitrdPath = AppendDevicePathNode (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ // Append the Device Path to the selected device path
+ InitrdPath = AppendDevicePath (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
FreePool (TempInitrdPath);
+ if (InitrdPath == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto EXIT;
+ }
InitrdSize = GetDevicePathSize (InitrdPath);
} else {
InitrdPath = NULL;
@@ -586,13 +597,13 @@ BootMenuUpdateBootOption (
CmdLineSize = AsciiStrSize (CmdLine);
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
+ BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
} else {
BootArguments = NULL;
}
@@ -626,7 +637,7 @@ UpdateFdtPath (
EFI_STATUS Status;
UINTN FdtDevicePathSize;
BDS_SUPPORTED_DEVICE *SupportedBootDevice;
- EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNodes;
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath;
Status = SelectBootDevice (&SupportedBootDevice);
@@ -636,15 +647,15 @@ UpdateFdtPath (
}
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNode, NULL, NULL);
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNodes, NULL, NULL);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
- if (FdtDevicePathNode != NULL) {
+ if (FdtDevicePathNodes != NULL) {
// Append the Device Path node to the select device path
- FdtDevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNode);
+ FdtDevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNodes);
FdtDevicePathSize = GetDevicePathSize (FdtDevicePath);
Status = gRT->SetVariable (
(CHAR16*)L"Fdt",
@@ -783,65 +794,69 @@ BootMenuMain (
Print(L"[%d] %s\n", OptionCount, BootOption->Description);
- CHAR16* DevicePathTxt;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
- UINTN CmdLineSize;
- UINTN InitrdSize;
- ARM_BDS_LOADER_TYPE LoaderType;
-
- 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 it is a supported BootEntry then print its details
- if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
- OptionalData = BootOption->OptionalData;
- LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
- if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {
- CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
- GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);
- Print(L"\t- Initrd: %s\n", DevicePathTxt);
+ //DEBUG_CODE_BEGIN();
+ CHAR16* DevicePathTxt;
+ EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
+ ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
+ UINTN CmdLineSize;
+ UINTN InitrdSize;
+ ARM_BDS_LOADER_TYPE LoaderType;
+
+ 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 it is a supported BootEntry then print its details
+ if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
+ OptionalData = BootOption->OptionalData;
+ LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
+ if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {
+ CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
+ DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
+ GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);
+ Print(L"\t- Initrd: %s\n", DevicePathTxt);
+ }
+ Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));
+ }
+
+ switch (LoaderType) {
+ case BDS_LOADER_EFI_APPLICATION:
+ Print(L"\t- LoaderType: EFI Application\n");
+ break;
+
+ case BDS_LOADER_KERNEL_LINUX_ATAG:
+ Print(L"\t- LoaderType: Linux kernel with ATAG support\n");
+ break;
+
+ case BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT:
+ Print(L"\t- LoaderType: Linux kernel with global FDT support\n");
+ break;
+ case BDS_LOADER_KERNEL_LINUX_LOCAL_FDT:
+ if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.FdtLocalSize) > 0) {
+ CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
+ InitrdSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize);
+ DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
+ GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize + InitrdSize)), TRUE, TRUE);
+ Print(L"\t- FDT: %s\n", DevicePathTxt);
+ } else {
+ Print(L"\t- FDT: error, local FDT not specified, using global FDT\n");
+ }
+ Print(L"\t- LoaderType: Linux kernel with Local FDT\n");
+ break;
+ default:
+ Print(L"\t- LoaderType: Not recognized (%d)\n", LoaderType);
+ break;
}
- Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));
}
-
- switch (LoaderType) {
- case BDS_LOADER_EFI_APPLICATION:
- Print(L"\t- LoaderType: EFI Application\n");
- break;
- case BDS_LOADER_KERNEL_LINUX_ATAG:
- Print(L"\t- LoaderType: Linux kernel with ATAG data\n");
- break;
- case BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT:
- Print(L"\t- LoaderType: Linux kernel with global FDT\n");
- break;
- case BDS_LOADER_KERNEL_LINUX_LOCAL_FDT:
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.FdtLocalSize) > 0) {
- CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
- InitrdSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
- GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize + InitrdSize)), TRUE, TRUE);
- Print(L"\t- FDT: %s\n", DevicePathTxt);
- } else {
- Print(L"\t- FDT: error, local FDT not specified, using global FDT\n");
- }
- Print(L"\t- LoaderType: Linux kernel with Local FDT\n");
- break;
- default:
- Print(L"unknown\n");
- break;
- }
- }
- FreePool(DevicePathTxt);
+ FreePool(DevicePathTxt);
+ //DEBUG_CODE_END();
OptionCount++;
}
@@ -862,7 +877,7 @@ BootMenuMain (
// Get the FDT device path
FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
- Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
+ Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
// Convert FdtDevicePath to text
if (EFI_ERROR(Status)) {
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c
index 78a42306d..0ecccd312 100644
--- a/ArmPlatformPkg/Bds/BootOption.c
+++ b/ArmPlatformPkg/Bds/BootOption.c
@@ -12,6 +12,7 @@
*
**/
+#include <Guid/ArmGlobalVariableHob.h>
#include "BdsInternal.h"
extern EFI_HANDLE mImageHandle;
@@ -32,7 +33,7 @@ BootOptionStart (
UINTN CmdLineSize;
UINTN InitrdSize;
EFI_DEVICE_PATH* Initrd;
- UINTN FdtLocalSize;
+ UINTN FdtLocalSize;
UINT16 LoadOptionIndexSize;
if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
@@ -59,7 +60,7 @@ BootOptionStart (
Status = BdsBootLinuxAtag (BootOption->FilePathList,
Initrd, // Initrd
(CHAR8*)(LinuxArguments + 1)); // CmdLine
- } else if ((LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ } else if ((LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
LinuxArguments = &(OptionalData->Arguments.LinuxArguments);
CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
@@ -70,26 +71,26 @@ BootOptionStart (
Initrd = NULL;
}
- if (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
-
- if (FdtLocalSize > 0) {
- FdtDevicePath = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize));
- } else {
- FdtDevicePath = NULL;
- }
- } else {
- // Get the default FDT device path
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
- DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
-
- // Get the FDT device path
- FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
- Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
- ASSERT_EFI_ERROR(Status);
- }
+ if (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
+ if (FdtLocalSize > 0) {
+ FdtDevicePath = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize));
+ } else {
+ FdtDevicePath = NULL;
+ }
+ } else {
+ // Get the default FDT device path
+ Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
+ ASSERT_EFI_ERROR(Status);
+ DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
+
+ // Get the FDT device path
+ FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
+ Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid,
+ DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
+ ASSERT_EFI_ERROR(Status);
+ }
Status = BdsBootLinuxFdt (BootOption->FilePathList,
Initrd, // Initrd
(CHAR8*)(LinuxArguments + 1),
@@ -131,7 +132,7 @@ BootOptionList (
InitializeListHead (BootOptionList);
// Get the Boot Option Order from the environment variable
- Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
if (EFI_ERROR(Status)) {
return Status;
}
@@ -168,7 +169,7 @@ BootOptionSetFields (
UINT16 FilePathListLength;
UINT8* EfiLoadOptionPtr;
UINT8* InitrdPathListPtr;
- UINT8* FdtLocalPathListPtr;
+ UINT8* FdtLocalPathListPtr;
UINTN OptionalDataSize;
ARM_BDS_LINUX_ARGUMENTS* DestLinuxArguments;
ARM_BDS_LINUX_ARGUMENTS* SrcLinuxArguments;
@@ -180,8 +181,8 @@ BootOptionSetFields (
BootDescriptionSize = StrSize (BootDescription);
BootOptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
- BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize + BootArguments->LinuxArguments.FdtLocalSize;
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize + BootArguments->LinuxArguments.FdtLocalSize;
}
// Compute the size of the FilePath list
@@ -223,13 +224,13 @@ BootOptionSetFields (
OptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
SrcLinuxArguments = &(BootArguments->LinuxArguments);
DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);
WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);
- WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->FdtLocalSize), SrcLinuxArguments->FdtLocalSize);
+ WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->FdtLocalSize), SrcLinuxArguments->FdtLocalSize);
OptionalDataSize += sizeof (ARM_BDS_LINUX_ARGUMENTS);
if (SrcLinuxArguments->CmdLineSize > 0) {
@@ -241,11 +242,11 @@ BootOptionSetFields (
InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);
CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
}
-
- if (SrcLinuxArguments->FdtLocalSize > 0) {
- FdtLocalPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize);
- CopyMem (FdtLocalPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize), SrcLinuxArguments->FdtLocalSize);
- }
+
+ if (SrcLinuxArguments->FdtLocalSize > 0) {
+ FdtLocalPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize);
+ CopyMem (FdtLocalPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize), SrcLinuxArguments->FdtLocalSize);
+ }
}
BootOption->OptionalDataSize = OptionalDataSize;
@@ -304,7 +305,7 @@ BootOptionCreate (
);
// Add the new Boot Index to the list
- Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ 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
@@ -376,7 +377,7 @@ BootOptionDelete (
EFI_STATUS Status;
// Remove the entry from the BootOrder environment variable
- Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
+ Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
if (!EFI_ERROR(Status)) {
BootOrderCount = BootOrderSize / sizeof(UINT16);
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c
index bf7a1c7d5..cf69175d8 100644
--- a/ArmPlatformPkg/Bds/BootOptionSupport.c
+++ b/ArmPlatformPkg/Bds/BootOptionSupport.c
@@ -25,7 +25,7 @@
#include <Guid/FileSystemInfo.h>
#define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype)))
-#define LOCAL_FDT_RESPONSE_LEN 2 // 1 character, plus carriage return
+#define LOCAL_FDT_RESPONSE_LEN 2 // 1 character, plus carriage return
EFI_STATUS
BdsLoadOptionFileSystemList (
@@ -35,7 +35,7 @@ BdsLoadOptionFileSystemList (
EFI_STATUS
BdsLoadOptionFileSystemCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -62,7 +62,7 @@ BdsLoadOptionMemMapList (
EFI_STATUS
BdsLoadOptionMemMapCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -89,7 +89,7 @@ BdsLoadOptionPxeList (
EFI_STATUS
BdsLoadOptionPxeCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -116,7 +116,7 @@ BdsLoadOptionTftpList (
EFI_STATUS
BdsLoadOptionTftpCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -234,7 +234,7 @@ BootDeviceGetType (
EFI_STATUS Status;
BOOLEAN IsEfiApp;
BOOLEAN IsBootLoader;
- CHAR16 FDTType[ LOCAL_FDT_RESPONSE_LEN ];
+ CHAR16 FDTType[ LOCAL_FDT_RESPONSE_LEN ];
if (FileName == NULL) {
Print(L"Is an EFI Application? ");
@@ -259,20 +259,20 @@ BootDeviceGetType (
}
*BootType = BDS_LOADER_EFI_APPLICATION;
} else {
- Print(L"Boot Type: [a] ATAGS, [g] Global FDT or [l] Local FDT? [a/g/l] ");
- Status = GetHIInputStr (FDTType, LOCAL_FDT_RESPONSE_LEN );
+ Print(L"Boot Type: [a] ATAGS, [g] Global FDT or [l] Local FDT? [a/g/l] ");
+ Status = GetHIInputStr (FDTType, LOCAL_FDT_RESPONSE_LEN );
if (EFI_ERROR(Status)) {
return EFI_ABORTED;
}
- if (StrCmp(FDTType, L"g") == 0) {
- *BootType = BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT;
- } else if (StrCmp(FDTType, L"l") == 0) {
- *BootType = BDS_LOADER_KERNEL_LINUX_LOCAL_FDT;
- } else if (StrCmp(FDTType, L"a") == 0) {
+ if (StrCmp(FDTType, L"g") == 0) {
+ *BootType = BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT;
+ } else if (StrCmp(FDTType, L"l") == 0) {
+ *BootType = BDS_LOADER_KERNEL_LINUX_LOCAL_FDT;
+ } else if (StrCmp(FDTType, L"a") == 0) {
*BootType = BDS_LOADER_KERNEL_LINUX_ATAG;
- } else {
- return EFI_ABORTED;
- }
+ } else {
+ return EFI_ABORTED;
+ }
}
return EFI_SUCCESS;
@@ -337,7 +337,7 @@ BdsLoadOptionFileSystemList (
EFI_STATUS
BdsLoadOptionFileSystemCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
@@ -355,16 +355,17 @@ BdsLoadOptionFileSystemCreateDevicePath (
BootFilePathSize = StrSize (BootFilePath);
if (BootFilePathSize == 2) {
- *DevicePathNode = NULL;
+ *DevicePathNodes = NULL;
return EFI_NOT_FOUND;
}
// Create the FilePath Device Path node
- FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
+ 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));
if (BootType != NULL || Attributes != NULL) {
Status = BootDeviceGetType (FilePathDevicePath->PathName, BootType, Attributes);
@@ -373,7 +374,7 @@ BdsLoadOptionFileSystemCreateDevicePath (
if (EFI_ERROR(Status)) {
FreePool (FilePathDevicePath);
} else {
- *DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL*)FilePathDevicePath;
+ *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)FilePathDevicePath;
}
return Status;
@@ -538,7 +539,7 @@ BdsLoadOptionMemMapList (
EFI_STATUS
BdsLoadOptionMemMapCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
@@ -579,7 +580,7 @@ BdsLoadOptionMemMapCreateDevicePath (
if (EFI_ERROR(Status)) {
FreePool (MemMapDevicePath);
} else {
- *DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL*)MemMapDevicePath;
+ *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)MemMapDevicePath;
}
return Status;
@@ -696,13 +697,13 @@ BdsLoadOptionPxeList (
EFI_STATUS
BdsLoadOptionPxeCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
- *DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
- SetDevicePathEndNode (*DevicePathNode);
+ *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
+ SetDevicePathEndNode (*DevicePathNodes);
*BootType = BDS_LOADER_EFI_APPLICATION;
return EFI_SUCCESS;
}
@@ -798,7 +799,7 @@ BdsLoadOptionTftpList (
EFI_STATUS
BdsLoadOptionTftpCreateDevicePath (
IN CHAR16* FileName,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
@@ -844,7 +845,7 @@ BdsLoadOptionTftpCreateDevicePath (
}
// 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);
+ 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;
@@ -864,6 +865,9 @@ BdsLoadOptionTftpCreateDevicePath (
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));
+
if (BootType != NULL || Attributes != NULL) {
Status = BootDeviceGetType (NULL, BootType, Attributes);
}
@@ -871,7 +875,7 @@ BdsLoadOptionTftpCreateDevicePath (
if (EFI_ERROR(Status)) {
FreePool (IPv4DevicePathNode);
} else {
- *DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL*)IPv4DevicePathNode;
+ *DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)IPv4DevicePathNode;
}
return Status;
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
index 1e66a428e..dfbf2ed67 100644
--- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
+++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
@@ -34,7 +34,7 @@ typedef struct {
} LCD_GRAPHICS_DEVICE_PATH;
typedef struct {
- UINTN Signature;
+ UINT32 Signature;
EFI_HANDLE Handle;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo;
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE Mode;
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
index d1506c721..a9c589b74 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
@@ -596,7 +596,7 @@ NorFlashWriteSingleBlock (
if ((WordAddress & BOUNDARY_OF_32_WORDS) == 0x00) {
// First, break the entire block into buffer-sized chunks.
- BuffersInBlock = (UINTN)BlockSizeInWords / P30_MAX_BUFFER_SIZE_IN_BYTES;
+ BuffersInBlock = (UINTN)(BlockSizeInWords * 4) / P30_MAX_BUFFER_SIZE_IN_BYTES;
// Then feed each buffer chunk to the NOR Flash
for(BufferIndex=0;
diff --git a/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h b/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h
index f61036840..c175cee6d 100644
--- a/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h
+++ b/ArmPlatformPkg/Include/Guid/ArmGlobalVariableHob.h
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
+* 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
@@ -15,6 +15,9 @@
#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} };
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm
index 25ffbcf9c..620562136 100644
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm
+++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm
@@ -11,6 +11,7 @@
//
//
+#include <AsmMacroIoLib.h>
#include <Library/ArmLib.h>
INCLUDE AsmMacroIoLib.inc
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.S b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S
index a00fac4f8..a00fac4f8 100644
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.S
+++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.S
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.asm b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm
index ead086874..ead086874 100644
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.asm
+++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/Arm/ArmPlatformLibNullBoot.asm
diff --git a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
index ba55ed519..f39954757 100644
--- a/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
+++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
@@ -33,8 +33,8 @@
ArmPlatformLibNullSec.c
[Sources.ARM]
- ArmPlatformLibNullBoot.asm | RVCT
- ArmPlatformLibNullBoot.S | GCC
+ Arm/ArmPlatformLibNullBoot.asm | RVCT
+ Arm/ArmPlatformLibNullBoot.S | GCC
[FixedPcd]
gArmTokenSpaceGuid.PcdFvBaseAddress
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.S b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S
index 94660c97f..94660c97f 100644
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.S
+++ b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.asm b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm
index db9202392..db9202392 100644
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.asm
+++ b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf b/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
index a41dae2b4..e48a65801 100644
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+++ b/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
@@ -26,9 +26,9 @@
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
-[Sources.common]
- ArmPlatformStackLib.asm | RVCT
- ArmPlatformStackLib.S | GCC
+[Sources.ARM]
+ Arm/ArmPlatformStackLib.asm | RVCT
+ Arm/ArmPlatformStackLib.S | GCC
[FixedPcd]
gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c
index e82584e6d..1f950d78f 100644
--- a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c
+++ b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c
@@ -30,8 +30,9 @@ ArmSecureMonitorWorldInitialize (
)
{
// Ensure the Monitor Table is 32bit aligned
- ASSERT (IS_ALIGNED(MonitorVectorTable, BIT5));
+ ASSERT (((UINTN)&MonitorVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0);
// Write the Monitor Mode Vector Table Address
ArmWriteMVBar ((UINTN) &MonitorVectorTable);
}
+
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c b/ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c
index 138216e9b..138216e9b 100644
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c
+++ b/ArmPlatformPkg/Library/EblCmdLib/Arm/EblCmdMmu.c
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
index 5da71cff2..dcd7c4100 100644
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
+++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdFdt.c
@@ -1,14 +1,14 @@
/** @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
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
-* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
@@ -26,7 +26,7 @@
#include <Protocol/DevicePathFromText.h>
-#include <Guid/GlobalVariable.h>
+#include <Guid/ArmGlobalVariableHob.h>
#include <libfdt.h>
@@ -187,7 +187,7 @@ EblDumpFdt (
// If no FDT file is passed to the argument then get the one from the platform
if (Argc < 2) {
- Status = GetEnvironmentVariable (L"Fdt",NULL,NULL,(VOID**)&FdtDevicePath);
+ Status = GetEnvironmentVariable (L"Fdt", &gArmGlobalVariableGuid, NULL, NULL, (VOID**)&FdtDevicePath);
if (Status == EFI_NOT_FOUND) {
// No set yet, get the Default Device Path
Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
index 9ddc9e82d..33508c26e 100644
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
+++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
@@ -29,9 +29,11 @@
[Sources.common]
EblCmdLib.c
- EblCmdMmu.c
EblCmdFdt.c
+[Sources.ARM]
+ Arm/EblCmdMmu.c
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.c
new file mode 100644
index 000000000..9bfe42e60
--- /dev/null
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.c
@@ -0,0 +1,103 @@
+/** @file
+ Serial I/O Port library functions with no library constructor/destructor
+
+ Copyright (c) 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/PcdLib.h>
+#include <Library/SerialPortExtLib.h>
+
+#include <Drivers/PL011Uart.h>
+
+/**
+ 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 UINT64 BaudRate,
+ IN UINT32 ReceiveFifoDepth,
+ IN UINT32 Timeout,
+ IN EFI_PARITY_TYPE Parity,
+ IN UINT8 DataBits,
+ IN EFI_STOP_BITS_TYPE StopBits
+ )
+{
+ return PL011UartInitializePort (
+ (UINTN)PcdGet64 (PcdSerialRegisterBase),
+ BaudRate,
+ ReceiveFifoDepth,
+ Parity,
+ DataBits,
+ StopBits);
+}
+
+/**
+ Set the serial device control bits.
+
+ @param Control Control bits which are to be set on the serial device.
+
+ @retval EFI_SUCCESS The new control bits were set on the serial device.
+ @retval EFI_UNSUPPORTED The serial device does not support this operation.
+ @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
+
+**/
+RETURN_STATUS
+EFIAPI
+SerialPortSetControl (
+ IN UINT32 Control
+ )
+{
+ return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
+}
+
+/**
+ Get the serial device control bits.
+
+ @param Control Control signals read from the serial device.
+
+ @retval EFI_SUCCESS The control bits were read from the serial device.
+ @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
+
+**/
+RETURN_STATUS
+EFIAPI
+SerialPortGetControl (
+ OUT UINT32 *Control
+ )
+{
+ return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
+}
+
diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf
new file mode 100644
index 000000000..89c8c9c11
--- /dev/null
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf
@@ -0,0 +1,43 @@
+#/** @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 = PL011SerialPortExtLib
+ FILE_GUID = 2be281f1-c506-4558-bd98-d6930e6de9d6
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = SerialPortExtLib
+
+[Sources.common]
+ PL011SerialPortExtLib.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/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
index 20e888271..09033dbd7 100644
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
@@ -103,82 +103,3 @@ SerialPortPoll (
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 computer 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 UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-{
- return PL011UartInitializePort (
- (UINTN)PcdGet64 (PcdSerialRegisterBase),
- BaudRate,
- ReceiveFifoDepth,
- Parity,
- DataBits,
- StopBits);
-}
-
-/**
- Set the serial device control bits.
-
- @param Control Control bits which are to be set on the serial device.
-
- @retval EFI_SUCCESS The new control bits were set on the serial device.
- @retval EFI_UNSUPPORTED The serial device does not support this operation.
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return PL011UartSetControl((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
-}
-
-/**
- Get the serial device control bits.
-
- @param Control Control signals read from the serial device.
-
- @retval EFI_SUCCESS The control bits were read from the serial device.
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- return PL011UartGetControl((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
-}
diff --git a/ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c b/ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c
new file mode 100644
index 000000000..b0594ae2c
--- /dev/null
+++ b/ArmPlatformPkg/PrePeiCore/Arm/ArchPrePeiCore.c
@@ -0,0 +1,62 @@
+/** @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/Exception.S b/ArmPlatformPkg/PrePeiCore/Arm/Exception.S
index abce21d0a..abce21d0a 100644
--- a/ArmPlatformPkg/PrePeiCore/Exception.S
+++ b/ArmPlatformPkg/PrePeiCore/Arm/Exception.S
diff --git a/ArmPlatformPkg/PrePeiCore/Exception.asm b/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm
index 55bd4af1d..55bd4af1d 100644
--- a/ArmPlatformPkg/PrePeiCore/Exception.asm
+++ b/ArmPlatformPkg/PrePeiCore/Arm/Exception.asm
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
index f902a251c..f902a251c 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S
+++ b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
index a3dd1fb2c..a3dd1fb2c 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm
+++ b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
diff --git a/ArmPlatformPkg/PrePeiCore/SwitchStack.S b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
index 2543f5841..2543f5841 100644
--- a/ArmPlatformPkg/PrePeiCore/SwitchStack.S
+++ b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.S
diff --git a/ArmPlatformPkg/PrePeiCore/SwitchStack.asm b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm
index 10da81d6a..10da81d6a 100644
--- a/ArmPlatformPkg/PrePeiCore/SwitchStack.asm
+++ b/ArmPlatformPkg/PrePeiCore/Arm/SwitchStack.asm
diff --git a/ArmPlatformPkg/PrePeiCore/MainMPCore.c b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
index aeea8f5bd..afe36a753 100644
--- a/ArmPlatformPkg/PrePeiCore/MainMPCore.c
+++ b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
@@ -121,7 +121,7 @@ PrimaryMain (
CreatePpiList (&PpiListSize, &PpiList);
// Enable the GIC Distributor
- ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));
+ ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase));
// If ArmVe has not been built as Standalone then we need to wake up the secondary cores
if (FeaturePcdGet (PcdSendSgiToBringUpSecondaryCores)) {
@@ -155,5 +155,5 @@ PrimaryMain (
SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
// Jump to PEI core entry point
- (PeiCoreEntryPoint)(&SecCoreData, PpiList);
+ PeiCoreEntryPoint (&SecCoreData, PpiList);
}
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
index f1300e0e8..fdd8697ed 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
@@ -1,7 +1,7 @@
/** @file
* Main file supporting the transition to PEI Core in Normal World for Versatile Express
*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
+* 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
@@ -15,9 +15,7 @@
#include <Library/BaseLib.h>
#include <Library/DebugAgentLib.h>
-#include <Library/PrintLib.h>
#include <Library/ArmLib.h>
-#include <Library/SerialPortLib.h>
#include <Ppi/ArmGlobalVariable.h>
@@ -74,10 +72,10 @@ CEntryPoint (
)
{
//Clean Data cache
- ArmCleanInvalidateDataCache();
+ ArmCleanInvalidateDataCache ();
//Invalidate instruction cache
- ArmInvalidateInstructionCache();
+ ArmInvalidateInstructionCache ();
// Enable Instruction & Data caches
ArmEnableDataCache ();
@@ -88,9 +86,9 @@ CEntryPoint (
// as Non-secure interface is already enabled in Secure world.
//
- // Write VBAR - The Vector table must be 32-byte aligned
- ASSERT(((UINT32)PeiVectorTable & ((1 << 5)-1)) == 0);
- ArmWriteVBar((UINT32)PeiVectorTable);
+ // Write VBAR - The Exception Vector table must be aligned to its requirement
+ 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.
@@ -162,44 +160,3 @@ PrePeiCoreGetGlobalVariableMemory (
return EFI_SUCCESS;
}
-VOID
-PeiCommonExceptionEntry (
- IN UINT32 Entry,
- IN UINT32 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/PrePeiCore.h b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
index 9f7c9c333..20684e2f9 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
@@ -74,4 +74,10 @@ 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
index efdc4b754..91f9b3a78 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
@@ -20,16 +20,19 @@
MODULE_TYPE = SEC
VERSION_STRING = 1.0
-[Sources.ARM]
- PrePeiCoreEntryPoint.asm | RVCT
- PrePeiCoreEntryPoint.S | GCC
- PrePeiCore.c
+[Sources.common]
MainMPCore.c
- SwitchStack.asm | RVCT
- SwitchStack.S | GCC
- Exception.asm | RVCT
- Exception.S | GCC
-
+ 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
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
index 90582d892..bf590dbac 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
@@ -20,15 +20,18 @@
MODULE_TYPE = SEC
VERSION_STRING = 1.0
-[Sources.ARM]
- PrePeiCoreEntryPoint.asm | RVCT
- PrePeiCoreEntryPoint.S | GCC
+[Sources.common]
PrePeiCore.c
MainUniCore.c
- SwitchStack.asm | RVCT
- SwitchStack.S | GCC
- Exception.asm | RVCT
- Exception.S | GCC
+
+[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
[Packages]
MdePkg/MdePkg.dec
diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
index c0c20a920..c0c20a920 100755..100644
--- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S
+++ b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
index 5efdb532a..5efdb532a 100644
--- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm
+++ b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiMPCore.inf
index f4cec0d60..3a3614192 100755
--- a/ArmPlatformPkg/PrePi/PeiMPCore.inf
+++ b/ArmPlatformPkg/PrePi/PeiMPCore.inf
@@ -19,11 +19,13 @@
MODULE_TYPE = SEC
VERSION_STRING = 1.0
-[Sources.ARM]
+[Sources]
PrePi.c
- ModuleEntryPoint.S | GCC
- ModuleEntryPoint.asm | RVCT
MainMPCore.c
+
+[Sources.ARM]
+ Arm/ModuleEntryPoint.S | GCC
+ Arm/ModuleEntryPoint.asm | RVCT
[Packages]
MdePkg/MdePkg.dec
diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/PeiUniCore.inf
index 34a068632..823a95607 100755
--- a/ArmPlatformPkg/PrePi/PeiUniCore.inf
+++ b/ArmPlatformPkg/PrePi/PeiUniCore.inf
@@ -19,11 +19,13 @@
MODULE_TYPE = SEC
VERSION_STRING = 1.0
-[Sources.ARM]
+[Sources]
PrePi.c
- ModuleEntryPoint.S | GCC
- ModuleEntryPoint.asm | RVCT
MainUniCore.c
+
+[Sources.ARM]
+ Arm/ModuleEntryPoint.S | GCC
+ Arm/ModuleEntryPoint.asm | RVCT
[Packages]
MdePkg/MdePkg.dec
diff --git a/ArmPlatformPkg/Sec/Helper.S b/ArmPlatformPkg/Sec/Arm/Helper.S
index 4eede5fab..4eede5fab 100644
--- a/ArmPlatformPkg/Sec/Helper.S
+++ b/ArmPlatformPkg/Sec/Arm/Helper.S
diff --git a/ArmPlatformPkg/Sec/Helper.asm b/ArmPlatformPkg/Sec/Arm/Helper.asm
index b31cc31a9..b31cc31a9 100644
--- a/ArmPlatformPkg/Sec/Helper.asm
+++ b/ArmPlatformPkg/Sec/Arm/Helper.asm
diff --git a/ArmPlatformPkg/Sec/SecEntryPoint.S b/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
index 92035a1ff..92035a1ff 100644
--- a/ArmPlatformPkg/Sec/SecEntryPoint.S
+++ b/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
diff --git a/ArmPlatformPkg/Sec/SecEntryPoint.asm b/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm
index 42d2b0268..42d2b0268 100644
--- a/ArmPlatformPkg/Sec/SecEntryPoint.asm
+++ b/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm
diff --git a/ArmPlatformPkg/Sec/Sec.c b/ArmPlatformPkg/Sec/Sec.c
index be165442b..52fa53a64 100644
--- a/ArmPlatformPkg/Sec/Sec.c
+++ b/ArmPlatformPkg/Sec/Sec.c
@@ -35,20 +35,20 @@ CEntryPoint (
UINTN JumpAddress;
// Invalidate the data cache. Doesn't have to do the Data cache clean.
- ArmInvalidateDataCache();
+ ArmInvalidateDataCache ();
// Invalidate Instruction Cache
- ArmInvalidateInstructionCache();
+ ArmInvalidateInstructionCache ();
// Invalidate I & D TLBs
- ArmInvalidateInstructionAndDataTlb();
+ ArmInvalidateInstructionAndDataTlb ();
// CPU specific settings
ArmCpuSetup (MpId);
// Enable Floating Point Coprocessor if supported by the platform
if (FixedPcdGet32 (PcdVFPEnabled)) {
- ArmEnableVFP();
+ ArmEnableVFP ();
}
// Initialize peripherals that must be done at the early stage
@@ -95,7 +95,7 @@ CEntryPoint (
// Test if Trustzone is supported on this platform
if (FixedPcdGetBool (PcdTrustzoneSupport)) {
- if (ArmIsMpCore()) {
+ if (ArmIsMpCore ()) {
// Setup SMP in Non Secure world
ArmCpuSetupSmpNonSecure (GET_CORE_ID(MpId));
}
diff --git a/ArmPlatformPkg/Sec/Sec.inf b/ArmPlatformPkg/Sec/Sec.inf
index 55ad00744..3cf9f339e 100644
--- a/ArmPlatformPkg/Sec/Sec.inf
+++ b/ArmPlatformPkg/Sec/Sec.inf
@@ -20,12 +20,14 @@
MODULE_TYPE = SEC
VERSION_STRING = 1.0
-[Sources.ARM]
- Helper.asm | RVCT
- Helper.S | GCC
+[Sources]
Sec.c
- SecEntryPoint.S | GCC
- SecEntryPoint.asm | RVCT
+
+[Sources.ARM]
+ Arm/Helper.asm | RVCT
+ Arm/Helper.S | GCC
+ Arm/SecEntryPoint.S | GCC
+ Arm/SecEntryPoint.asm | RVCT
[Packages]
MdePkg/MdePkg.dec
diff --git a/BaseTools/Contributions.txt b/BaseTools/Contributions.txt
new file mode 100644
index 000000000..667ca1035
--- /dev/null
+++ b/BaseTools/Contributions.txt
@@ -0,0 +1,188 @@
+
+======================
+= 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.
+
+=======================================
+= Change Description / Commit Message =
+=======================================
+
+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 =
+
+=== Definitions for sample change description ===
+
+* "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.
+
+=== Start of sample change description / commit message ===
+CodeModule: Brief-single-line-summary
+
+Full-commit-message
+
+Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Contributor Name <contributor@email.server>
+=== End of sample change description / commit message ===
+
+========================================
+= 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/BaseTools/License.txt b/BaseTools/License.txt
new file mode 100644
index 000000000..160be01d2
--- /dev/null
+++ b/BaseTools/License.txt
@@ -0,0 +1,25 @@
+Copyright (c) 2013, Intel Corporation. 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/BaseTools/Source/C/GenBootSector/GenBootSector.c b/BaseTools/Source/C/GenBootSector/GenBootSector.c
index 169d81e03..f102ee139 100644
--- a/BaseTools/Source/C/GenBootSector/GenBootSector.c
+++ b/BaseTools/Source/C/GenBootSector/GenBootSector.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -542,8 +542,7 @@ Returns:
--*/
{
- printf ("%s v%d.%d %s -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved.\n");
+ printf ("%s Version %d.%d Build%s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
@@ -551,18 +550,27 @@ PrintUsage (
void
)
{
- Version();
- printf ("\nUsage: \n\
- GenBootSector\n\
- [-l, --list list disks]\n\
- [-i, --input Filename]\n\
- [-o, --output Filename]\n\
- [-m, --mbr process the MBR also]\n\
- [-v, --verbose]\n\
- [--version]\n\
- [-q, --quiet disable all messages except fatal errors]\n\
- [-d, --debug[#]\n\
- [-h, --help]\n");
+ printf ("Usage: GenBootSector [options] --cfg-file CFG_FILE\n\n\
+Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.\n\n\
+ Utility to retrieve and update the boot sector or MBR.\n\n\
+optional arguments:\n\
+ -h, --help Show this help message and exit\n\
+ --version Show program's version number and exit\n\
+ -d [DEBUG], --debug [DEBUG]\n\
+ Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
+ - 9 (max)\n\
+ -v, --verbose Print informational statements\n\
+ -q, --quiet Returns the exit code, error messages will be\n\
+ displayed\n\
+ -s, --silent Returns only the exit code; informational and error\n\
+ messages are not displayed\n\
+ -l, --list List disk drives\n\
+ -i INPUT_FILENAME, --input INPUT_FILENAME\n\
+ Input file name\n\
+ -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
+ Output file name\n\
+ -m, --mbr Also process the MBR\n\
+ --sfo Reserved for future use\n");
}
diff --git a/BaseTools/Source/C/GenCrc32/GenCrc32.c b/BaseTools/Source/C/GenCrc32/GenCrc32.c
index 681fe4f1e..8ece9a841 100644
--- a/BaseTools/Source/C/GenCrc32/GenCrc32.c
+++ b/BaseTools/Source/C/GenCrc32/GenCrc32.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, 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
@@ -55,7 +55,7 @@ Returns:
--*/
{
- fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+ fprintf (stdout, "%s Version %d.%d Build %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
@@ -81,26 +81,32 @@ Returns:
//
// Summary usage
//
- fprintf (stdout, "\nUsage: %s -e|-d [options] <input_file>\n\n", UTILITY_NAME);
+ fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
- fprintf (stdout, "Options:\n");
- fprintf (stdout, " -o FileName, --output FileName\n\
- File will be created to store the ouput content.\n");
- fprintf (stdout, " -e, --encode Calculate CRC32 value for the input file.\n");
- fprintf (stdout, " -d, --decode Verify CRC32 value for the input file.\n");
- fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
- fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
- fprintf (stdout, " --debug level Enable debug messages, at input debug level.\n");
- fprintf (stdout, " --version Show program's version number and exit.\n");
- fprintf (stdout, " -h, --help Show this help message and exit.\n");
+ fprintf (stdout, "optional arguments:\n");
+ fprintf (stdout, " -h, --help Show this help message and exit\n");
+ fprintf (stdout, " --version Show program's version number and exit\n");
+ fprintf (stdout, " --debug [DEBUG] Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
+ - 9 (max)\n");
+ fprintf (stdout, " -v, --verbose Print informational statements\n");
+ fprintf (stdout, " -q, --quiet Returns the exit code, error messages will be\n\
+ displayed\n");
+ fprintf (stdout, " -s, --silent Returns only the exit code; informational and error\n\
+ messages are not displayed\n");
+ fprintf (stdout, " -e, --encode Calculate CRC32 value for the input file\n");
+ fprintf (stdout, " -d, --decode Verify CRC32 value for the input file\n");
+ fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
+ Output file name\n");
+ fprintf (stdout, " --sfo Reserved for future use\n");
+
}
int
@@ -164,7 +170,6 @@ Returns:
argv ++;
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
- Version ();
Usage ();
return STATUS_SUCCESS;
}
diff --git a/BaseTools/Source/C/GenPage/GenPage.c b/BaseTools/Source/C/GenPage/GenPage.c
index 6c24a2f9e..78047ba9b 100644
--- a/BaseTools/Source/C/GenPage/GenPage.c
+++ b/BaseTools/Source/C/GenPage/GenPage.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -91,8 +91,7 @@ Returns:
--*/
{
- printf ("%s v%d.%d %s -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 2008 - 2011 Intel Corporation. All rights reserved.\n");
+ printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
@@ -100,25 +99,29 @@ Usage (
void
)
{
- Version();
- printf ("\nUsage: \n\
- GenPage\n\
- -o, --output Filename\n\
- The file that contains both non-page table part and\n\
- page table\n\
- [-b, --baseaddr baseaddress]\n\
+ printf ("Usage: GenPage.exe [options] EfiLoaderImageName \n\n\
+Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.\n\n\
+ Utility to generate the EfiLoader image containing a page table.\n\n\
+optional arguments:\n\
+ -h, --help Show this help message and exit\n\
+ --version Show program's version number and exit\n\
+ -d [DEBUG], --debug [DEBUG]\n\
+ Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
+ - 9 (max)\n\
+ -v, --verbose Print informational statements\n\
+ -q, --quiet Returns the exit code, error messages will be\n\
+ displayed\n\
+ -s, --silent Returns only the exit code; informational and error\n\
+ messages are not displayed\n\
+ -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
+ Output file contain both the non-page table part and\n\
+ the page table\n\
+ -b BASE_ADDRESS, --baseaddr BASE_ADDRESS\n\
The page table location\n\
- [-f, --offset offset]\n\
+ -f OFFSET, --offset OFFSET\n\
The position that the page table will appear in the\n\
output file\n\
- [-v, --verbose] Turn on verbose output with informational messages\n\
- printed\n\
- [--version] Print version and copyright of this program and exit\n\
- [-q, --quiet] Disable all messages except unrecoverable errors\n\
- [-d, --debug[#]] Enable debug messages, at level #\n\
- [-h, --help] Print copyright, version and usage of this program\n\
- and exit\n\
- EfiLoaderImageName\n");
+ --sfo Reserved for future use\n");
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
index 8985ddefc..7cadf0f42 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -803,6 +803,7 @@ CFormPkg::DeclarePendingQuestion (
CHAR8 FName[MAX_NAME_LEN];
CHAR8 *SName;
CHAR8 *NewStr;
+ UINT32 ShrinkSize;
EFI_VFR_RETURN_CODE ReturnCode;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
@@ -823,7 +824,7 @@ CFormPkg::DeclarePendingQuestion (
if (pNode->mFlag == PENDING) {
CIfrNumeric CNObj;
EFI_VARSTORE_INFO Info;
- EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
CNObj.SetLineNo (LineNo);
CNObj.SetPrompt (0x0);
@@ -913,19 +914,24 @@ CFormPkg::DeclarePendingQuestion (
switch (Info.mVarType) {
case EFI_IFR_TYPE_NUM_SIZE_64:
CNObj.SetMinMaxStepData ((UINT64) 0, (UINT64) -1 , (UINT64) 0);
+ ShrinkSize = 0;
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
CNObj.SetMinMaxStepData ((UINT32) 0, (UINT32) -1 , (UINT32) 0);
+ ShrinkSize = 12;
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
CNObj.SetMinMaxStepData ((UINT16) 0, (UINT16) -1 , (UINT16) 0);
+ ShrinkSize = 18;
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
CNObj.SetMinMaxStepData ((UINT8) 0, (UINT8) -1 , (UINT8) 0);
+ ShrinkSize = 21;
break;
default:
break;
}
+ CNObj.ShrinkBinSize (ShrinkSize);
//
// For undefined Efi VarStore type question
@@ -935,7 +941,7 @@ CFormPkg::DeclarePendingQuestion (
CIfrVarEqName CVNObj (QId, Info.mInfo.mVarName);
CVNObj.SetLineNo (LineNo);
}
-
+
//
// End for Numeric
//
@@ -1236,6 +1242,18 @@ CIfrRecordInfoDB::GetRecordInfoFromOffset (
return pNode;
}
+/*
+ Add just the op code position.
+
+ From
+
+ | form end opcode + end of if opcode for form ... + Dynamic opcode + form set end opcode |
+
+ To
+
+ | Dynamic opcode + form end opcode + end of if opcode for form ... + form set end opcode |
+
+*/
BOOLEAN
CIfrRecordInfoDB::IfrAdjustDynamicOpcodeInRecords (
VOID
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index e6e69bca0..65f0421cc 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -604,6 +604,10 @@ vfrFormSetDefinition :
CRT_END_OP (E);
+ //
+ // Adjust the pending question position.
+ // Move the position from current to before the end of the last form in the form set.
+ //
if (gNeedAdjustOpcode) {
gCFormPkg.AdjustDynamicInsertOpcode (
mLastFormEndAddr,
diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc
index e7b739e07..1223944be 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -35,6 +35,7 @@
ArmPlatformLib|BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA8Lib/ArmCortexA8Lib.inf
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
@@ -82,6 +83,7 @@
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
SerialPortLib|Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf
+ SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
RealTimeClockLib|Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf
@@ -430,8 +432,6 @@
#
Omap35xxPkg/PciEmulation/PciEmulation.inf
- #NOTE: Open source EHCI stack doesn't work on Beagleboard.
- #NOTE: UsbBus and UsbMassStorage don't work using iPhone SDK tool chain.
MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf {
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x800fffff
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index e1a4c225e..64b220c3c 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -3,6 +3,7 @@
#
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 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
@@ -69,6 +70,7 @@
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
SerialPortLib|EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf
+ SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
GdbSerialLib|EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.inf
diff --git a/EmbeddedPkg/GdbStub/Arm/Processor.c b/EmbeddedPkg/GdbStub/Arm/Processor.c
index 2d33d9729..38abb69d7 100644
--- a/EmbeddedPkg/GdbStub/Arm/Processor.c
+++ b/EmbeddedPkg/GdbStub/Arm/Processor.c
@@ -94,7 +94,7 @@ MaxEfiException (
VOID
)
{
- return sizeof (gExceptionType)/sizeof (EFI_EXCEPTION_TYPE_ENTRY);
+ return sizeof (gExceptionType) / sizeof (EFI_EXCEPTION_TYPE_ENTRY);
}
@@ -108,7 +108,7 @@ MaxRegisterCount (
VOID
)
{
- return sizeof (gRegisterOffsets)/sizeof (UINTN);
+ return sizeof (gRegisterOffsets) / sizeof (UINTN);
}
@@ -140,7 +140,7 @@ CheckIsa (
@retval the pointer to the RegNumber-th pointer
**/
UINTN *
-FindPointerToRegister(
+FindPointerToRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN UINTN RegNumber
)
@@ -170,20 +170,20 @@ BasicReadRegister (
CHAR8 Char;
if (gRegisterOffsets[RegNumber] > 0xF00) {
- AsciiSPrint(OutBufPtr, 9, "00000000");
+ AsciiSPrint (OutBufPtr, 9, "00000000");
OutBufPtr += 8;
return OutBufPtr;
}
RegSize = 0;
while (RegSize < 32) {
- Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
+ Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
if ((Char >= 'A') && (Char <= 'F')) {
Char = Char - 'A' + 'a';
}
*OutBufPtr++ = Char;
- Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
+ Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
if ((Char >= 'A') && (Char <= 'F')) {
Char = Char - 'A' + 'a';
}
@@ -212,7 +212,7 @@ ReadNthRegister (
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
- if (RegNumber >= MaxRegisterCount()) {
+ if (RegNumber >= MaxRegisterCount ()) {
SendError (GDB_EINVALIDREGNUM);
return;
}
@@ -221,7 +221,7 @@ ReadNthRegister (
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
*OutBufPtr = '\0'; // the end of the buffer
- SendPacket(OutBuffer);
+ SendPacket (OutBuffer);
}
@@ -238,18 +238,18 @@ ReadGeneralRegisters (
UINTN Index;
CHAR8 *OutBuffer;
CHAR8 *OutBufPtr;
- UINTN RegisterCount = MaxRegisterCount();
+ UINTN RegisterCount = MaxRegisterCount ();
// It is not safe to allocate pool here....
- OutBuffer = AllocatePool((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
+ OutBuffer = AllocatePool ((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
OutBufPtr = OutBuffer;
for (Index = 0; Index < RegisterCount; Index++) {
OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);
}
*OutBufPtr = '\0';
- SendPacket(OutBuffer);
- FreePool(OutBuffer);
+ SendPacket (OutBuffer);
+ FreePool (OutBuffer);
}
@@ -278,7 +278,7 @@ CHAR8
NewValue = 0;
RegSize = 0;
while (RegSize < 32) {
- TempValue = HexCharToInt(*InBufPtr++);
+ TempValue = HexCharToInt (*InBufPtr++);
if ((INTN)TempValue < 0) {
SendError (GDB_EBADMEMDATA);
@@ -286,7 +286,7 @@ CHAR8
}
NewValue += (TempValue << (RegSize+4));
- TempValue = HexCharToInt(*InBufPtr++);
+ TempValue = HexCharToInt (*InBufPtr++);
if ((INTN)TempValue < 0) {
SendError (GDB_EBADMEMDATA);
@@ -296,7 +296,7 @@ CHAR8
NewValue += (TempValue << RegSize);
RegSize = RegSize + 8;
}
- *(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
+ *(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
return InBufPtr;
}
@@ -327,7 +327,7 @@ WriteNthRegister (
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
// check if this is a valid Register Number
- if (RegNumber >= MaxRegisterCount()) {
+ if (RegNumber >= MaxRegisterCount ()) {
SendError (GDB_EINVALIDREGNUM);
return;
}
@@ -353,11 +353,11 @@ WriteGeneralRegisters (
UINTN i;
CHAR8 *InBufPtr; /// pointer to the input buffer
UINTN MinLength;
- UINTN RegisterCount = MaxRegisterCount();
+ UINTN RegisterCount = MaxRegisterCount ();
MinLength = (RegisterCount * 8) + 1; // 'G' plus the registers in ASCII format
- if (AsciiStrLen(InBuffer) < MinLength) {
+ if (AsciiStrLen (InBuffer) < MinLength) {
//Bad message. Message is not the right length
SendError (GDB_EBADBUFSIZE);
return;
@@ -367,7 +367,7 @@ WriteGeneralRegisters (
// Read the new values for the registers from the input buffer to an array, NewValueArray.
// The values in the array are in the gdb ordering
- for(i = 0; i < RegisterCount; i++) {
+ for (i = 0; i < RegisterCount; i++) {
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
@@ -421,7 +421,7 @@ AddSingleStep (
mSingleStepActive = FALSE;
}
- InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);
+ InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
//DEBUG((EFI_D_ERROR, "AddSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, mSingleStepData, *(UINT32 *)mSingleStepPC));
}
@@ -446,7 +446,7 @@ RemoveSingleStep (
//DEBUG((EFI_D_ERROR, "RemoveSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, *(UINT32 *)mSingleStepPC, mSingleStepData));
*(UINT32 *)mSingleStepPC = mSingleStepData;
}
- InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);
+ InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
mSingleStepActive = FALSE;
}
@@ -466,7 +466,7 @@ ContinueAtAddress (
)
{
if (PacketData[1] != '\0') {
- SystemContext.SystemContextArm->PC = AsciiStrHexToUintn(&PacketData[1]);
+ SystemContext.SystemContextArm->PC = AsciiStrHexToUintn (&PacketData[1]);
}
}
@@ -484,7 +484,7 @@ SingleStep (
IN CHAR8 *PacketData
)
{
- SendNotSupported();
+ SendNotSupported ();
}
UINTN
@@ -521,15 +521,15 @@ SearchBreakpointList (
LIST_ENTRY *Current;
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
- Current = GetFirstNode(&BreakpointList);
- while (!IsNull(&BreakpointList, Current)) {
+ Current = GetFirstNode (&BreakpointList);
+ while (!IsNull (&BreakpointList, Current)) {
Breakpoint = ARM_SOFTWARE_BREAKPOINT_FROM_LINK(Current);
if (Address == Breakpoint->Address) {
return Breakpoint;
}
- Current = GetNextNode(&BreakpointList, Current);
+ Current = GetNextNode (&BreakpointList, Current);
}
return NULL;
@@ -542,25 +542,25 @@ SetBreakpoint (
{
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
- Breakpoint = SearchBreakpointList(Address);
+ Breakpoint = SearchBreakpointList (Address);
if (Breakpoint != NULL) {
return;
}
// create and fill breakpoint structure
- Breakpoint = AllocatePool(sizeof(ARM_SOFTWARE_BREAKPOINT));
+ Breakpoint = AllocatePool (sizeof(ARM_SOFTWARE_BREAKPOINT));
Breakpoint->Signature = ARM_SOFTWARE_BREAKPOINT_SIGNATURE;
Breakpoint->Address = Address;
Breakpoint->Instruction = *(UINT32 *)Address;
// Add it to the list
- InsertTailList(&BreakpointList, &Breakpoint->Link);
+ InsertTailList (&BreakpointList, &Breakpoint->Link);
// Insert the software breakpoint
*(UINT32 *)Address = GDB_ARM_BKPT;
- InvalidateInstructionCacheRange((VOID *)Address, 4);
+ InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "SetBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, Breakpoint->Instruction, *(UINT32 *)Address));
}
@@ -572,22 +572,22 @@ ClearBreakpoint (
{
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
- Breakpoint = SearchBreakpointList(Address);
+ Breakpoint = SearchBreakpointList (Address);
if (Breakpoint == NULL) {
return;
}
// Add it to the list
- RemoveEntryList(&Breakpoint->Link);
+ RemoveEntryList (&Breakpoint->Link);
// Restore the original instruction
*(UINT32 *)Address = Breakpoint->Instruction;
- InvalidateInstructionCacheRange((VOID *)Address, 4);
+ InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "ClearBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, GDB_ARM_BKPT, *(UINT32 *)Address));
- FreePool(Breakpoint);
+ FreePool (Breakpoint);
}
VOID
@@ -602,7 +602,7 @@ InsertBreakPoint (
UINTN Length;
UINTN ErrorCode;
- ErrorCode = ParseBreakpointPacket(PacketData, &Type, &Address, &Length);
+ ErrorCode = ParseBreakpointPacket (PacketData, &Type, &Address, &Length);
if (ErrorCode > 0) {
SendError ((UINT8)ErrorCode);
return;
@@ -618,7 +618,7 @@ InsertBreakPoint (
return;
}
- SetBreakpoint(Address);
+ SetBreakpoint (Address);
SendSuccess ();
}
@@ -651,7 +651,7 @@ RemoveBreakPoint (
return;
}
- ClearBreakpoint(Address);
+ ClearBreakpoint (Address);
SendSuccess ();
}
@@ -662,7 +662,7 @@ InitializeProcessor (
)
{
// Initialize breakpoint list
- InitializeListHead(&BreakpointList);
+ InitializeListHead (&BreakpointList);
}
BOOLEAN
diff --git a/EmbeddedPkg/GdbStub/GdbStub.c b/EmbeddedPkg/GdbStub/GdbStub.c
index 8a13cc8a1..9136c14b2 100644
--- a/EmbeddedPkg/GdbStub/GdbStub.c
+++ b/EmbeddedPkg/GdbStub/GdbStub.c
@@ -75,7 +75,6 @@ GdbStubEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
-
{
EFI_STATUS Status;
EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;
@@ -84,8 +83,7 @@ GdbStubEntry (
UINTN Index;
UINTN Processor;
BOOLEAN IsaSupported;
-
-
+
Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&gDebugImageTableHeader);
if (EFI_ERROR (Status)) {
gDebugImageTableHeader = NULL;
@@ -136,10 +134,9 @@ GdbStubEntry (
DEBUG ((EFI_D_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex));
// Call processor-specific init routine
- InitializeProcessor();
+ InitializeProcessor ();
for (Processor = 0; Processor <= gMaxProcessorIndex; Processor++) {
-
for (Index = 0; Index < MaxEfiException (); Index++) {
Status = DebugSupport->RegisterExceptionCallback (DebugSupport, Processor, GdbExceptionHandler, gExceptionType[Index].Exception);
ASSERT_EFI_ERROR (Status);
@@ -165,7 +162,7 @@ GdbStubEntry (
ASSERT_EFI_ERROR (Status);
//
- // Register for protocol notifactions on this event
+ // Register for protocol notifications on this event
//
Status = gBS->RegisterProtocolNotify (
&gEfiLoadedImageProtocolGuid,
@@ -182,8 +179,6 @@ GdbStubEntry (
return EFI_SUCCESS;
}
-
-
/**
Transfer length bytes of input buffer, starting at Address, to memory.
@@ -485,12 +480,11 @@ EFIAPI
SendNotSupported (
VOID
)
-{
+{
SendPacket ("");
}
-
/**
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
@@ -596,11 +590,11 @@ ConvertEFItoGDBtype (
IN EFI_EXCEPTION_TYPE EFIExceptionType
)
{
- UINTN i;
+ UINTN Index;
- for (i=0; i < MaxEfiException() ; i++) {
- if (gExceptionType[i].Exception == EFIExceptionType) {
- return gExceptionType[i].SignalNo;
+ for (Index = 0; Index < MaxEfiException () ; Index++) {
+ if (gExceptionType[Index].Exception == EFIExceptionType) {
+ return gExceptionType[Index].SignalNo;
}
}
return GDB_SIGTRAP; // this is a GDB trap
@@ -635,14 +629,14 @@ ReadFromMemory (
InBufPtr++; // this skips ',' in the buffer
/* Error checking */
- if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
+ if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print((CHAR16 *)L"Address is too long\n");
SendError (GDB_EBADMEMADDRBUFSIZE);
return;
}
// 2 = 'm' + ','
- if (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
+ if (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
Print((CHAR16 *)L"Length is too long\n");
SendError (GDB_EBADMEMLENGTH);
return;
@@ -699,14 +693,14 @@ WriteToMemory (
/* Error checking */
//Check if Address is not too long.
- if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
+ if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print ((CHAR16 *)L"Address too long..\n");
SendError (GDB_EBADMEMADDRBUFSIZE);
return;
}
//Check if message length is not too long
- if (AsciiStrLen(LengthBuffer) >= MAX_LENGTH_SIZE) {
+ if (AsciiStrLen (LengthBuffer) >= MAX_LENGTH_SIZE) {
Print ((CHAR16 *)L"Length too long..\n");
SendError (GDB_EBADMEMLENGBUFSIZE);
return;
@@ -714,7 +708,7 @@ WriteToMemory (
// Check if Message is not too long/short.
// 3 = 'M' + ',' + ':'
- MessageLength = (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - AsciiStrLen(LengthBuffer) - 3);
+ MessageLength = (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - AsciiStrLen (LengthBuffer) - 3);
if (MessageLength != (2*Length)) {
//Message too long/short. New data is not the right size.
SendError (GDB_EBADMEMDATASIZE);
@@ -770,7 +764,7 @@ ParseBreakpointPacket (
*AddressBufferPtr = '\0';
//Check if Address is not too long.
- if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
+ if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print ((CHAR16 *)L"Address too long..\n");
return 40; //EMSGSIZE: Message size too long.
}
@@ -801,7 +795,7 @@ gXferObjectReadResponse (
CHAR8 Char;
UINTN Count;
- // responce starts with 'm' or 'l' if it is the end
+ // Response starts with 'm' or 'l' if it is the end
OutBufPtr = gOutBuffer;
*OutBufPtr++ = Type;
Count = 1;
@@ -989,12 +983,11 @@ PeCoffLoaderGetDebuggerInfo (
}
-
/**
Process "qXfer:object:read:annex:offset,length" request.
Returns an XML document that contains loaded libraries. In our case it is
- infomration in the EFI Debug Inmage Table converted into an XML document.
+ information in the EFI Debug Image Table converted into an XML document.
GDB will call with an arbitrary length (it can't know the real length and
will reply with chunks of XML that are easy for us to deal with. Gdb will
@@ -1006,12 +999,12 @@ PeCoffLoaderGetDebuggerInfo (
<library name="/a/l/f/f.dll"><segment address="0x30000000"/></library>
</library-list>
- Since we can not allocate memory in interupt context this module has
+ Since we can not allocate memory in interrupt context this module has
assumptions about how it will get called:
1) Length will generally be max remote packet size (big enough)
2) First Offset of an XML document read needs to be 0
3) This code will return back small chunks of the XML document on every read.
- Each subseqent call will ask for the next availble part of the document.
+ Each subsequent call will ask for the next available part of the document.
Note: The only variable size element in the XML is:
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
@@ -1039,6 +1032,7 @@ QxferLibrary (
// Force a retry from the beginning
gPacketqXferLibraryOffset = 0;
+
return;
}
@@ -1117,7 +1111,7 @@ GdbExceptionHandler (
CHAR8 *Ptr;
- if (ValidateException(ExceptionType, SystemContext) == FALSE) {
+ if (ValidateException (ExceptionType, SystemContext) == FALSE) {
return;
}
@@ -1254,7 +1248,7 @@ GdbPeriodicCallBack (
if (gCtrlCBreakFlag) {
//
// Update the context to force a single step trap when we exit the GDB
- // stub. This will trasfer control to GdbExceptionHandler () and let
+ // stub. This will transfer control to GdbExceptionHandler () and let
// us break into the program. We don't want to break into the GDB stub.
//
AddSingleStep (SystemContext);
diff --git a/EmbeddedPkg/GdbStub/GdbStubInternal.h b/EmbeddedPkg/GdbStub/GdbStubInternal.h
index 5f15420f0..e84ca3a0a 100644
--- a/EmbeddedPkg/GdbStub/GdbStubInternal.h
+++ b/EmbeddedPkg/GdbStub/GdbStubInternal.h
@@ -63,7 +63,7 @@ extern CONST CHAR8 mHexToStr[];
#define GDB_SIGTRAP 5 // Trace Trap (Breakpoint and SingleStep)
#define GDB_SIGEMT 7 // Emulator Trap
#define GDB_SIGFPE 8 // Floating point exception
-#define GDB_SIGSEGV 11 // Setgment violation, page fault
+#define GDB_SIGSEGV 11 // Segment violation, page fault
//
diff --git a/EmbeddedPkg/GdbStub/Ia32/Processor.c b/EmbeddedPkg/GdbStub/Ia32/Processor.c
index a6aceaef9..e327b3e6d 100644
--- a/EmbeddedPkg/GdbStub/Ia32/Processor.c
+++ b/EmbeddedPkg/GdbStub/Ia32/Processor.c
@@ -147,7 +147,7 @@ CheckIsa (
@retval the pointer to the RegNumber-th pointer
**/
UINTN *
-FindPointerToRegister(
+FindPointerToRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN UINTN RegNumber
)
@@ -177,8 +177,8 @@ BasicReadRegister (
RegSize = 0;
while (RegSize < REG_SIZE) {
- *OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
- *OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
+ *OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
+ *OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
RegSize = RegSize + 8;
}
return OutBufPtr;
@@ -210,7 +210,7 @@ ReadNthRegister (
}
OutBufPtr = OutBuffer;
- OutBufPtr = BasicReadRegister(SystemContext, RegNumber, OutBufPtr);
+ OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
*OutBufPtr = '\0'; // the end of the buffer
SendPacket(OutBuffer);
@@ -233,8 +233,8 @@ ReadGeneralRegisters (
CHAR8 *OutBufPtr; // pointer to the output buffer
OutBufPtr = OutBuffer;
- for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
- OutBufPtr = BasicReadRegister(SystemContext, i, OutBufPtr);
+ for (i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
+ OutBufPtr = BasicReadRegister (SystemContext, i, OutBufPtr);
}
*OutBufPtr = '\0'; // the end of the buffer
@@ -282,7 +282,7 @@ BasicWriteRegister (
NewValue += (TempValue << RegSize);
RegSize = RegSize + 8;
}
- *(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
+ *(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
return InBufPtr;
}
@@ -353,8 +353,8 @@ WriteGeneralRegisters (
// Read the new values for the registers from the input buffer to an array, NewValueArray.
// The values in the array are in the gdb ordering
- for(i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
- InBufPtr = BasicWriteRegister(SystemContext, i, InBufPtr);
+ for (i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
+ InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
SendSuccess();
@@ -867,7 +867,7 @@ InsertBreakPoint (
if (Status == EFI_UNSUPPORTED) {
Print ((CHAR16 *)L"Not supported\n");
- SendNotSupported();
+ SendNotSupported ();
return;
}
@@ -946,7 +946,7 @@ RemoveBreakPoint (
if (Status == EFI_UNSUPPORTED) {
Print ((CHAR16 *)L"Not supported.\n");
- SendNotSupported();
+ SendNotSupported ();
return;
}
@@ -956,7 +956,7 @@ RemoveBreakPoint (
}
//Remove breakpoint
- Status = DisableDebugRegister(SystemContext, Register);
+ Status = DisableDebugRegister (SystemContext, Register);
if (EFI_ERROR(Status)) {
Print ((CHAR16 *)L"Invalid argument.\n");
SendError (GDB_EINVALIDARG);
diff --git a/EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.c b/EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.c
new file mode 100644
index 000000000..5a007c25f
--- /dev/null
+++ b/EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.c
@@ -0,0 +1,79 @@
+/** @file
+ Extended Serial I/O Port library functions
+
+ 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 <Base.h>
+
+#include <Library/SerialPortLib.h>
+#include <Library/SerialPortExtLib.h>
+
+/**
+ Set the serial device control bits.
+
+ @return Always return RETURN_UNSUPPORTED.
+
+**/
+RETURN_STATUS
+EFIAPI
+SerialPortSetControl (
+ IN UINT32 Control
+ )
+{
+ return RETURN_UNSUPPORTED;
+}
+
+/**
+ Get the serial device control bits.
+
+ @param Control Control signals read from the serial device.
+
+ @retval EFI_SUCCESS The control bits were read from the serial device.
+ @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
+
+**/
+RETURN_STATUS
+EFIAPI
+SerialPortGetControl (
+ OUT UINT32 *Control
+ )
+{
+ if (SerialPortPoll ()) {
+ // If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
+ *Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
+ } else {
+ *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Set the serial device attributes.
+
+ @return Always return RETURN_UNSUPPORTED.
+
+**/
+RETURN_STATUS
+EFIAPI
+SerialPortSetAttributes (
+ IN UINT64 BaudRate,
+ IN UINT32 ReceiveFifoDepth,
+ IN UINT32 Timeout,
+ IN EFI_PARITY_TYPE Parity,
+ IN UINT8 DataBits,
+ IN EFI_STOP_BITS_TYPE StopBits
+ )
+{
+ return RETURN_UNSUPPORTED;
+}
+
diff --git a/EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf b/EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
new file mode 100644
index 000000000..2e95405af
--- /dev/null
+++ b/EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
@@ -0,0 +1,36 @@
+#/** @file
+# Template for Extended Serial Port Library for UEFI drivers
+#
+# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 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 = TemplateSerialPortExtLib
+ FILE_GUID = 231fe752-40ac-40b0-8d23-4e341309b964
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = SerialPortExtLib
+
+
+#
+# VALID_ARCHITECTURES = ARM IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ TemplateSerialPortExtLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+
diff --git a/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c b/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c
index 0110189ab..5d9bb073c 100644
--- a/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c
+++ b/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c
@@ -18,7 +18,6 @@
#include <Library/SerialPortLib.h>
-#include <Library/SerialPortExtLib.h>
/**
@@ -37,65 +36,6 @@ SerialPortInitialize (
}
/**
- Set the serial device control bits.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-/**
- Get the serial device control bits.
-
- @param Control Control signals read from the serial device.
-
- @retval EFI_SUCCESS The control bits were read from the serial device.
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- if (SerialPortPoll ()) {
- // If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
- *Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
- } else {
- *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
- }
- return EFI_SUCCESS;
-}
-
-/**
- Set the serial device attributes.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-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 RETURN_UNSUPPORTED;
-}
-
-/**
Write data to serial device.
@param Buffer Point of data buffer which need to be written.
diff --git a/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf b/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf
index 1bc1fc0ee..f1ece1962 100644
--- a/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf
+++ b/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf
@@ -1,8 +1,8 @@
#/** @file
-# Memory Status Code Library for UEFI drivers
+# Template for Serial Port Library for UEFI drivers
#
-# Lib to provide memory journal status code reporting Routines
# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 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
@@ -18,13 +18,13 @@
INF_VERSION = 0x00010005
BASE_NAME = TemplateSerialPortLib
FILE_GUID = A9133571-AD4B-4457-94A8-A9CC2CE7574F
- MODULE_TYPE = PEIM
+ MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = SerialPortLib
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = ARM IA32 X64 IPF EBC
#
[Sources.common]
diff --git a/EmbeddedPkg/MetronomeDxe/Metronome.c b/EmbeddedPkg/MetronomeDxe/Metronome.c
index 8388c4d19..b43bf9558 100644
--- a/EmbeddedPkg/MetronomeDxe/Metronome.c
+++ b/EmbeddedPkg/MetronomeDxe/Metronome.c
@@ -1,8 +1,8 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2012, ARM Ltd. All rights reserved.
-
+ Copyright (c) 2013, 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
@@ -25,66 +25,33 @@
#include <Protocol/Metronome.h>
-
-
-/**
- The WaitForTick() function waits for the number of ticks specified by
- TickNumber from a known time source in the platform. If TickNumber of
- ticks are detected, then EFI_SUCCESS is returned. The actual time passed
- between entry of this function and the first tick is between 0 and
- TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod
- time has elapsed, wait for two ticks. This function waits for a hardware
- event to determine when a tick occurs. It is possible for interrupt
- processing, or exception processing to interrupt the execution of the
- WaitForTick() function. Depending on the hardware source for the ticks, it
- is possible for a tick to be missed. This function cannot guarantee that
- ticks will not be missed. If a timeout occurs waiting for the specified
- number of ticks, then EFI_TIMEOUT is returned.
-
- @param This The EFI_METRONOME_ARCH_PROTOCOL instance.
- @param TickNumber Number of ticks to wait.
-
- @retval EFI_SUCCESS The wait for the number of ticks specified by TickNumber
- succeeded.
- @retval EFI_TIMEOUT A timeout occurred waiting for the specified number of ticks.
-
-**/
EFI_STATUS
EFIAPI
WaitForTick (
IN EFI_METRONOME_ARCH_PROTOCOL *This,
IN UINT32 TickNumber
- )
-{
- //
- // Fill me in
- //
- MicroSecondDelay (10 * TickNumber);
- return EFI_UNSUPPORTED;
-}
-
-
+ );
/**
Interface structure for the Metronome Architectural Protocol.
@par Protocol Description:
This protocol provides access to a known time source in the platform to the
- core. The core uses this known time source to produce core services that
- require calibrated delays.
+ core. The core uses this known time source to produce core services that
+ require calibrated delays.
@param WaitForTick
- Waits for a specified number of ticks from a known time source
- in the platform. The actual time passed between entry of this
- function and the first tick is between 0 and TickPeriod 100 nS
- units. If you want to guarantee that at least TickPeriod time
+ Waits for a specified number of ticks from a known time source
+ in the platform. The actual time passed between entry of this
+ function and the first tick is between 0 and TickPeriod 100 nS
+ units. If you want to guarantee that at least TickPeriod time
has elapsed, wait for two ticks.
@param TickPeriod
- The period of platform's known time source in 100 nS units.
- This value on any platform must be at least 10 uS, and must not
- exceed 200 uS. The value in this field is a constant that must
- not be modified after the Metronome architectural protocol is
+ The period of platform's known time source in 100 nS units.
+ This value on any platform must be at least 10 uS, and must not
+ exceed 200 uS. The value in this field is a constant that must
+ not be modified after the Metronome architectural protocol is
installed. All consumers must treat this as a read-only field.
**/
@@ -94,6 +61,45 @@ EFI_METRONOME_ARCH_PROTOCOL gMetronome = {
};
+/**
+ The WaitForTick() function waits for the number of ticks specified by
+ TickNumber from a known time source in the platform. If TickNumber of
+ ticks are detected, then EFI_SUCCESS is returned. The actual time passed
+ between entry of this function and the first tick is between 0 and
+ TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod
+ time has elapsed, wait for two ticks. This function waits for a hardware
+ event to determine when a tick occurs. It is possible for interrupt
+ processing, or exception processing to interrupt the execution of the
+ WaitForTick() function. Depending on the hardware source for the ticks, it
+ is possible for a tick to be missed. This function cannot guarantee that
+ ticks will not be missed. If a timeout occurs waiting for the specified
+ number of ticks, then EFI_TIMEOUT is returned.
+
+ @param This The EFI_METRONOME_ARCH_PROTOCOL instance.
+ @param TickNumber Number of ticks to wait.
+
+ @retval EFI_SUCCESS The wait for the number of ticks specified by TickNumber
+ succeeded.
+ @retval EFI_TIMEOUT A timeout occurred waiting for the specified number of ticks.
+
+**/
+EFI_STATUS
+EFIAPI
+WaitForTick (
+ IN EFI_METRONOME_ARCH_PROTOCOL *This,
+ IN UINT32 TickNumber
+ )
+{
+ //
+ // Compute how long to stall the CPU.
+ // gMetronome.TickPeriod is in 100 ns units so it needs to be divided by 10
+ // to get it in microseconds units.
+ //
+ MicroSecondDelay (TickNumber * gMetronome.TickPeriod / 10);
+ return EFI_SUCCESS;
+}
+
+
EFI_HANDLE gMetronomeHandle = NULL;
@@ -116,7 +122,7 @@ MetronomeInitialize (
)
{
EFI_STATUS Status;
-
+
//
// Do any hardware init required to make WaitForTick () to work here.
//
diff --git a/EmbeddedPkg/SerialDxe/SerialDxe.inf b/EmbeddedPkg/SerialDxe/SerialDxe.inf
index 37e8e0e00..ed7f37735 100644
--- a/EmbeddedPkg/SerialDxe/SerialDxe.inf
+++ b/EmbeddedPkg/SerialDxe/SerialDxe.inf
@@ -39,6 +39,7 @@
DebugLib
UefiDriverEntryPoint
SerialPortLib
+ SerialPortExtLib
[Protocols]
gEfiSerialIoProtocolGuid
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
index 839f3a003..9a0320b2b 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* 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
@@ -40,36 +40,36 @@ PrintOCR (
IN UINT32 Ocr
)
{
- UINTN minv;
- UINTN maxv;
- UINTN volts;
- UINTN loop;
+ UINTN MinV;
+ UINTN MaxV;
+ UINTN Volts;
+ UINTN Loop;
- minv = 36; // 3.6
- maxv = 20; // 2.0
- volts = 20; // 2.0
+ MinV = 36; // 3.6
+ MaxV = 20; // 2.0
+ Volts = 20; // 2.0
// The MMC register bits [23:8] indicate the working range of the card
- for (loop = 8; loop < 24; loop++) {
- if (Ocr & (1 << loop)) {
- if (minv > volts) minv = volts;
- if (maxv < volts) maxv = volts + 1;
+ for (Loop = 8; Loop < 24; Loop++) {
+ if (Ocr & (1 << Loop)) {
+ if (MinV > Volts) MinV = Volts;
+ if (MaxV < Volts) MaxV = Volts + 1;
}
- volts = volts + 1;
+ Volts = Volts + 1;
}
- DEBUG((EFI_D_ERROR, "- PrintOCR Ocr (0x%X)\n",Ocr));
- DEBUG((EFI_D_ERROR, "\t- Card operating voltage: %d.%d to %d.%d\n", minv/10, minv % 10, maxv/10, maxv % 10));
+ DEBUG ((EFI_D_ERROR, "- PrintOCR Ocr (0x%X)\n",Ocr));
+ DEBUG ((EFI_D_ERROR, "\t- Card operating voltage: %d.%d to %d.%d\n", MinV/10, MinV % 10, MaxV/10, MaxV % 10));
if (((Ocr >> 29) & 3) == 0) {
- DEBUG((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));
+ DEBUG ((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));
} else {
- DEBUG((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n",((Ocr >> 29) & 3)));
+ DEBUG ((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n", ((Ocr >> 29) & 3)));
}
if (Ocr & MMC_OCR_POWERUP) {
- DEBUG((EFI_D_ERROR, "\t- PowerUp\n"));
+ DEBUG ((EFI_D_ERROR, "\t- PowerUp\n"));
} else {
- DEBUG((EFI_D_ERROR, "\t- Voltage Not Supported\n"));
+ DEBUG ((EFI_D_ERROR, "\t- Voltage Not Supported\n"));
}
}
@@ -77,17 +77,19 @@ VOID PrintCID (
IN UINT32* Cid
)
{
- DEBUG((EFI_D_ERROR, "- PrintCID\n"));
- DEBUG((EFI_D_ERROR, "\t- Manufacturing date: %d/%d\n",(Cid[0] >> 8) & 0xF,(Cid[0] >> 12) & 0xFF));
- DEBUG((EFI_D_ERROR, "\t- Product serial number: 0x%X%X\n",Cid[1] & 0xFFFFFF,(Cid[0] >> 24) & 0xFF));
- DEBUG((EFI_D_ERROR, "\t- Product revision: %d\n",Cid[1] >> 24));
- //DEBUG((EFI_D_ERROR, "\t- Product name: %s\n",(char*)(Cid + 2)));
- DEBUG((EFI_D_ERROR, "\t- OEM ID: %c%c\n",(Cid[3] >> 8) & 0xFF,(Cid[3] >> 16) & 0xFF));
+ DEBUG ((EFI_D_ERROR, "- PrintCID\n"));
+ DEBUG ((EFI_D_ERROR, "\t- Manufacturing date: %d/%d\n", (Cid[0] >> 8) & 0xF, (Cid[0] >> 12) & 0xFF));
+ DEBUG ((EFI_D_ERROR, "\t- Product serial number: 0x%X%X\n", Cid[1] & 0xFFFFFF, (Cid[0] >> 24) & 0xFF));
+ DEBUG ((EFI_D_ERROR, "\t- Product revision: %d\n", Cid[1] >> 24));
+ //DEBUG ((EFI_D_ERROR, "\t- Product name: %s\n", (char*)(Cid + 2)));
+ DEBUG ((EFI_D_ERROR, "\t- OEM ID: %c%c\n", (Cid[3] >> 8) & 0xFF, (Cid[3] >> 16) & 0xFF));
}
#if !defined(MDEPKG_NDEBUG)
-CONST CHAR8* mStrUnit[] = { "100kbit/s","1Mbit/s","10Mbit/s","100MBit/s","Unkbown","Unkbown","Unkbown","Unkbown" };
-CONST CHAR8* mStrValue[] = { "1.0","1.2","1.3","1.5","2.0","2.5","3.0","3.5","4.0","4.5","5.0","Unknown","Unknown","Unknown","Unknown" };
+CONST CHAR8* mStrUnit[] = { "100kbit/s", "1Mbit/s", "10Mbit/s", "100MBit/s",
+ "Unknown", "Unknown", "Unknown", "Unknown" };
+CONST CHAR8* mStrValue[] = { "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0",
+ "Unknown", "Unknown", "Unknown", "Unknown" };
#endif
VOID
@@ -98,26 +100,26 @@ PrintCSD (
UINTN Value;
if (((Csd[2] >> 30) & 0x3) == 0) {
- DEBUG((EFI_D_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n"));
+ DEBUG ((EFI_D_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n"));
} else if (((Csd[2] >> 30) & 0x3) == 1) {
- DEBUG((EFI_D_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));
+ DEBUG ((EFI_D_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));
} else {
- DEBUG((EFI_D_ERROR, "- PrintCSD Version Higher than v3.3\n"));
+ DEBUG ((EFI_D_ERROR, "- PrintCSD Version Higher than v3.3\n"));
}
- DEBUG((EFI_D_ERROR, "\t- Supported card command class: 0x%X\n",MMC_CSD_GET_CCC(Csd)));
- DEBUG((EFI_D_ERROR, "\t- Speed: %a %a\n",mStrValue[(MMC_CSD_GET_TRANSPEED(Csd) >> 3) & 0xF],mStrUnit[MMC_CSD_GET_TRANSPEED(Csd) & 7]));
- DEBUG((EFI_D_ERROR, "\t- Maximum Read Data Block: %d\n",2 << (MMC_CSD_GET_READBLLEN(Csd)-1)));
- DEBUG((EFI_D_ERROR, "\t- Maximum Write Data Block: %d\n",2 << (MMC_CSD_GET_WRITEBLLEN(Csd)-1)));
+ DEBUG ((EFI_D_ERROR, "\t- Supported card command class: 0x%X\n", MMC_CSD_GET_CCC(Csd)));
+ DEBUG ((EFI_D_ERROR, "\t- Speed: %a %a\n",mStrValue[(MMC_CSD_GET_TRANSPEED(Csd) >> 3) & 0xF],mStrUnit[MMC_CSD_GET_TRANSPEED(Csd) & 7]));
+ DEBUG ((EFI_D_ERROR, "\t- Maximum Read Data Block: %d\n",2 << (MMC_CSD_GET_READBLLEN(Csd)-1)));
+ DEBUG ((EFI_D_ERROR, "\t- Maximum Write Data Block: %d\n",2 << (MMC_CSD_GET_WRITEBLLEN(Csd)-1)));
if (!MMC_CSD_GET_FILEFORMATGRP(Csd)) {
- Value = MMC_CSD_GET_FILEFORMAT(Csd);
- if (Value == 0) DEBUG((EFI_D_ERROR, "\t- Format(0): Hard disk-like file system with partition table\n"));
- else if (Value == 1) DEBUG((EFI_D_ERROR, "\t- Format(1): DOS FAT (floppy-like) with boot sector only (no partition table)\n"));
- else if (Value == 2) DEBUG((EFI_D_ERROR, "\t- Format(2): Universal File Format\n"));
- else DEBUG((EFI_D_ERROR, "\t- Format(3): Others/Unknown\n"));
+ Value = MMC_CSD_GET_FILEFORMAT (Csd);
+ if (Value == 0) DEBUG ((EFI_D_ERROR, "\t- Format (0): Hard disk-like file system with partition table\n"));
+ else if (Value == 1) DEBUG ((EFI_D_ERROR, "\t- Format (1): DOS FAT (floppy-like) with boot sector only (no partition table)\n"));
+ else if (Value == 2) DEBUG ((EFI_D_ERROR, "\t- Format (2): Universal File Format\n"));
+ else DEBUG ((EFI_D_ERROR, "\t- Format (3): Others/Unknown\n"));
} else {
- DEBUG((EFI_D_ERROR, "\t- Format: Reserved\n"));
+ DEBUG ((EFI_D_ERROR, "\t- Format: Reserved\n"));
}
}
@@ -126,9 +128,9 @@ PrintRCA (
IN UINT32 Rca
)
{
- DEBUG((EFI_D_ERROR, "- PrintRCA: 0x%X\n",Rca));
- DEBUG((EFI_D_ERROR, "\t- Status: 0x%X\n",Rca & 0xFFFF));
- DEBUG((EFI_D_ERROR, "\t- RCA: 0x%X\n",(Rca >> 16) & 0xFFFF));
+ DEBUG ((EFI_D_ERROR, "- PrintRCA: 0x%X\n", Rca));
+ DEBUG ((EFI_D_ERROR, "\t- Status: 0x%X\n", Rca & 0xFFFF));
+ DEBUG ((EFI_D_ERROR, "\t- RCA: 0x%X\n", (Rca >> 16) & 0xFFFF));
}
VOID
@@ -136,19 +138,21 @@ PrintResponseR1 (
IN UINT32 Response
)
{
- DEBUG((EFI_D_INFO, "Response: 0x%X\n",Response));
- if (Response & MMC_R0_READY_FOR_DATA) DEBUG((EFI_D_INFO, "\t- READY_FOR_DATA\n"));
-
- if (((Response >> 9) & 0xF) == 0) DEBUG((EFI_D_INFO, "\t- State: Idle\n"));
- else if (((Response >> 9) & 0xF) == 1) DEBUG((EFI_D_INFO, "\t- State: Ready\n"));
- else if (((Response >> 9) & 0xF) == 2) DEBUG((EFI_D_INFO, "\t- State: Ident\n"));
- else if (((Response >> 9) & 0xF) == 3) DEBUG((EFI_D_INFO, "\t- State: StandBy\n"));
- else if (((Response >> 9) & 0xF) == 4) DEBUG((EFI_D_INFO, "\t- State: Tran\n"));
- else if (((Response >> 9) & 0xF) == 5) DEBUG((EFI_D_INFO, "\t- State: Data\n"));
- else if (((Response >> 9) & 0xF) == 6) DEBUG((EFI_D_INFO, "\t- State: Rcv\n"));
- else if (((Response >> 9) & 0xF) == 7) DEBUG((EFI_D_INFO, "\t- State: Prg\n"));
- else if (((Response >> 9) & 0xF) == 8) DEBUG((EFI_D_INFO, "\t- State: Dis\n"));
- else DEBUG((EFI_D_INFO, "\t- State: Reserved\n"));
+ DEBUG ((EFI_D_INFO, "Response: 0x%X\n", Response));
+ if (Response & MMC_R0_READY_FOR_DATA) {
+ DEBUG ((EFI_D_INFO, "\t- READY_FOR_DATA\n"));
+ }
+
+ if (((Response >> 9) & 0xF) == 0) DEBUG ((EFI_D_INFO, "\t- State: Idle\n"));
+ else if (((Response >> 9) & 0xF) == 1) DEBUG ((EFI_D_INFO, "\t- State: Ready\n"));
+ else if (((Response >> 9) & 0xF) == 2) DEBUG ((EFI_D_INFO, "\t- State: Ident\n"));
+ else if (((Response >> 9) & 0xF) == 3) DEBUG ((EFI_D_INFO, "\t- State: StandBy\n"));
+ else if (((Response >> 9) & 0xF) == 4) DEBUG ((EFI_D_INFO, "\t- State: Tran\n"));
+ else if (((Response >> 9) & 0xF) == 5) DEBUG ((EFI_D_INFO, "\t- State: Data\n"));
+ else if (((Response >> 9) & 0xF) == 6) DEBUG ((EFI_D_INFO, "\t- State: Rcv\n"));
+ else if (((Response >> 9) & 0xF) == 7) DEBUG ((EFI_D_INFO, "\t- State: Prg\n"));
+ else if (((Response >> 9) & 0xF) == 8) DEBUG ((EFI_D_INFO, "\t- State: Dis\n"));
+ else DEBUG ((EFI_D_INFO, "\t- State: Reserved\n"));
}
EFI_STATUS
@@ -173,14 +177,14 @@ MmcGetCardStatus(
//Get the Status of the card.
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));
return Status;
}
//Read Response
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
- PrintResponseR1(Response[0]);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
+ PrintResponseR1 (Response[0]);
}
return Status;
@@ -211,21 +215,21 @@ MmcIdentificationMode (
if (MmcHostInstance->State == MmcHwInitializationState) {
// Initialize the MMC Host HW
Status = MmcNotifyState (MmcHostInstance, MmcHwInitializationState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState\n"));
return Status;
}
}
Status = MmcHost->SendCommand (MmcHost, MMC_CMD0, 0);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcIdleState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState\n"));
return Status;
}
@@ -238,7 +242,7 @@ MmcIdentificationMode (
#endif
if (Status == EFI_SUCCESS) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported.\n"));
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported.\n"));
return EFI_UNSUPPORTED;
}
@@ -248,8 +252,8 @@ MmcIdentificationMode (
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "Card is SD2.0 => Supports high capacity\n"));
IsHCS = TRUE;
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R7,Response);
- PrintResponseR1(Response[0]);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R7, Response);
+ PrintResponseR1 (Response[0]);
//check if it is valid response
if(Response[0] != CmdArg){
DEBUG ((EFI_D_ERROR, "The Card is not usable\n"));
@@ -278,8 +282,8 @@ MmcIdentificationMode (
CmdArg |= BIT30;
}
Status = MmcHost->SendCommand (MmcHost, MMC_ACMD41, CmdArg);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, Response);
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
} else {
@@ -287,15 +291,15 @@ MmcIdentificationMode (
MmcHostInstance->CardInfo.CardType = MMC_CARD;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, 0x800000);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, Response);
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
if (!MmcHostInstance->CardInfo.OCRData.PowerUp) {
- MicroSecondDelay(1);
+ MicroSecondDelay (1);
Timeout--;
} else {
if ((MmcHostInstance->CardInfo.CardType == SD_CARD_2) && (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1)) {
@@ -305,35 +309,35 @@ MmcIdentificationMode (
break; // The MMC/SD card is ready. Continue the Identification Mode
}
} else {
- MicroSecondDelay(1);
+ MicroSecondDelay (1);
Timeout--;
}
}
if (Timeout == 0) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));
return EFI_NO_MEDIA;
} else {
- PrintOCR(Response[0]);
+ PrintOCR (Response[0]);
}
Status = MmcNotifyState (MmcHostInstance, MmcReadyState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));
return Status;
}
Status = MmcHost->SendCommand (MmcHost, MMC_CMD2, 0);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));
return Status;
}
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CID,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CID, Response);
PrintCID(Response);
Status = MmcNotifyState (MmcHostInstance, MmcIdentificationState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));
return Status;
}
@@ -344,13 +348,13 @@ MmcIdentificationMode (
//
CmdArg = 1;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD3, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
return Status;
}
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_RCA,Response);
- PrintRCA(Response[0]);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_RCA, Response);
+ PrintRCA (Response[0]);
// For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card
if (MmcHostInstance->CardInfo.CardType != MMC_CARD) {
@@ -360,8 +364,8 @@ MmcIdentificationMode (
}
Status = MmcNotifyState (MmcHostInstance, MmcStandByState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));
return Status;
}
@@ -385,27 +389,27 @@ EFI_STATUS InitializeMmcDevice (
//Send a command to get Card specific data
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD9, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));
return Status;
}
//Read Response
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CSD,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CSD, Response);
PrintCSD(Response);
if (MmcHostInstance->CardInfo.CardType == SD_CARD_2_HIGH) {
- CardSize = HC_MMC_CSD_GET_DEVICESIZE(Response);
+ CardSize = HC_MMC_CSD_GET_DEVICESIZE (Response);
NumBlocks = ((CardSize + 1) * 1024);
BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);
} else {
- CardSize = MMC_CSD_GET_DEVICESIZE(Response);
- NumBlocks = (CardSize + 1) * (1 << (MMC_CSD_GET_DEVICESIZEMULT(Response) + 2));
+ CardSize = MMC_CSD_GET_DEVICESIZE (Response);
+ NumBlocks = (CardSize + 1) * (1 << (MMC_CSD_GET_DEVICESIZEMULT (Response) + 2));
BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);
}
//For >=2G card, BlockSize may be 1K, but the transfer size is 512 bytes.
if (BlockSize > 512) {
- NumBlocks = MultU64x32(NumBlocks, BlockSize/512);
+ NumBlocks = MultU64x32 (NumBlocks, BlockSize/512);
BlockSize = 512;
}
@@ -417,21 +421,21 @@ EFI_STATUS InitializeMmcDevice (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD7, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));
return Status;
}
// Set Block Length
Status = MmcHost->SendCommand (MmcHost, MMC_CMD16, MmcHostInstance->BlockIo.Media->BlockSize);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n",MmcHostInstance->BlockIo.Media->BlockSize, Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n", MmcHostInstance->BlockIo.Media->BlockSize, Status));
return Status;
}
@@ -452,7 +456,7 @@ MmcReset (
{
MMC_HOST_INSTANCE *MmcHostInstance;
- MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(This);
+ MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This);
if (MmcHostInstance->MmcHost == NULL) {
// Nothing to do
@@ -512,10 +516,10 @@ MmcIoBlocks (
UINTN BytesRemainingToBeTransfered;
UINTN BlockCount = 1;
- MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(This);
- ASSERT(MmcHostInstance != 0);
+ MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This);
+ ASSERT (MmcHostInstance != 0);
MmcHost = MmcHostInstance->MmcHost;
- ASSERT(MmcHost);
+ ASSERT (MmcHost);
if ((MmcHost == 0)|| (Buffer == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -552,16 +556,16 @@ MmcIoBlocks (
Response[0] = 0;
Timeout = 20;
while( (!(Response[0] & MMC_R0_READY_FOR_DATA))
- && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN)
+ && (MMC_R0_CURRENTSTATE (Response) != MMC_R0_STATE_TRAN)
&& Timeout--) {
Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
}
}
if (0 == Timeout) {
- DEBUG((EFI_D_ERROR, "The Card is busy\n"));
+ DEBUG ((EFI_D_ERROR, "The Card is busy\n"));
return EFI_NOT_READY;
}
@@ -588,46 +592,46 @@ MmcIoBlocks (
#endif
}
Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIoBlocks(MMC_CMD%d): Error %r\n",Cmd, Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIoBlocks(MMC_CMD%d): Error %r\n", Cmd, Status));
return Status;
}
if (Transfer == MMC_IOBLOCKS_READ) {
#ifndef USE_STREAM
// Read one block of Data
- Status = MmcHost->ReadBlockData (MmcHost, Lba,This->Media->BlockSize,Buffer);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_BLKIO, "MmcIoBlocks(): Error Read Block Data and Status = %r\n", Status));
+ Status = MmcHost->ReadBlockData (MmcHost, Lba, This->Media->BlockSize, Buffer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_BLKIO, "MmcIoBlocks(): Error Read Block Data and Status = %r\n", Status));
return Status;
}
#else
//TODO: Read a stream
- ASSERT(0);
+ ASSERT (0);
#endif
Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIoBlocks() : Error MmcProgrammingState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIoBlocks() : Error MmcProgrammingState\n"));
return Status;
}
} else {
#ifndef USE_STREAM
// Write one block of Data
- Status = MmcHost->WriteBlockData (MmcHost, Lba,This->Media->BlockSize,Buffer);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_BLKIO, "MmcIoBlocks(): Error Write Block Data and Status = %r\n", Status));
+ Status = MmcHost->WriteBlockData (MmcHost, Lba, This->Media->BlockSize, Buffer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_BLKIO, "MmcIoBlocks(): Error Write Block Data and Status = %r\n", Status));
return Status;
}
#else
//TODO: Write a stream
- ASSERT(0);
+ ASSERT (0);
#endif
}
// Command 12 - Stop transmission (ends read)
Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b, Response);
}
// Command 13 - Read status and wait for programming to complete (return to tran)
@@ -635,21 +639,21 @@ MmcIoBlocks (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Response[0] = 0;
while( (!(Response[0] & MMC_R0_READY_FOR_DATA))
- && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN)
+ && (MMC_R0_CURRENTSTATE (Response) != MMC_R0_STATE_TRAN)
&& Timeout--) {
Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
if ((Response[0] & MMC_R0_READY_FOR_DATA)) {
break; // Prevents delay once finished
}
}
- NanoSecondDelay(100);
+ NanoSecondDelay (100);
}
Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
return Status;
}
@@ -695,4 +699,3 @@ MmcFlushBlocks (
{
return EFI_SUCCESS;
}
-
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c
index 597ada261..ab2ec8071 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c
@@ -3,7 +3,7 @@
Child device(Disk, CDROM, etc) enumeration and child handler installation, and
driver stop.
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -719,6 +719,7 @@ IDEBusDriverBindingStart (
//
for (IdeDevice = BeginningIdeDevice; IdeDevice <= EndIdeDevice; IdeDevice++) {
+ ASSERT (IdeChannel * 2 + IdeDevice < MAX_IDE_DEVICE);
if (IdeBusDriverPrivateData->DeviceProcessed[IdeChannel * 2 + IdeDevice]) {
continue;
}
@@ -738,6 +739,7 @@ IDEBusDriverBindingStart (
continue;
}
+ ASSERT (IdeChannel < IdeMaxChannel && IdeDevice < IdeMaxDevice);
IdeBlkIoDevicePtr = IdeBlkIoDevice[IdeChannel][IdeDevice];
//
diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
index 025ebfb3e..9484b5d2c 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
@@ -2,7 +2,7 @@
# Intel Framework Module Package contains the definitions and module implementation
# which follows Intel EFI Framework Specification.
#
-# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2013, 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
@@ -147,14 +147,16 @@
## The PCD is used to mark whether the machine is in first boot cycle.
# TRUE means the machine is in first boot cycle. After completing the first boot,
# the PCD's value will be updated to FALSE.
+ # This PCD should be set as HII type PCD by platform integrator.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootState|TRUE|BOOLEAN|0x0001002f
## Timeout value for displaying progressing bar in before boot OS.
# According to UEFI 2.0 spec, the default TimeOut should be 0xffff.
+ # This PCD should be set as HII type PCD by platform integrator mapped to variable L"TimeOut" and gEfiGlobalVariableGuid.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0xffff|UINT16|0x40000001
## Error level for hardware recorder. If value 0, platform does not support feature of hardware error record.
- # This PCD should be set as HII type PCD by platform integrator mapped to variable L"HwErrRecSupport"
+ # This PCD should be set as HII type PCD by platform integrator mapped to variable L"HwErrRecSupport" and gEfiGlobalVariableGuid.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|0|UINT16|0x40000002
[PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
@@ -236,4 +238,4 @@
## This PCD specifies whether to use the optimized timing for best PS2 detection performance.
# Note this PCD could be set to TRUE for best boot performance and set to FALSE for best device compatibility.
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x3000000b \ No newline at end of file
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x3000000b
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index fe6d436a5..02ad3a2bb 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -1,7 +1,7 @@
/** @file
BDS Lib functions which contain all the code to connect console device
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -808,7 +808,10 @@ ConvertBmpToGopBlt (
ColorMapNum = 0;
break;
}
- if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) != sizeof (BMP_COLOR_MAP) * ColorMapNum) {
+ //
+ // BMP file may has padding data between the bmp header section and the bmp data section.
+ //
+ if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) < sizeof (BMP_COLOR_MAP) * ColorMapNum) {
return EFI_INVALID_PARAMETER;
}
}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
index f9b83a449..6eaec886f 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -457,6 +457,8 @@ BdsEntry (
LIST_ENTRY BootOptionList;
UINTN BootNextSize;
CHAR16 *FirmwareVendor;
+ EFI_STATUS Status;
+ UINT16 BootTimeOut;
//
// Insert the performance probe
@@ -511,6 +513,25 @@ BdsEntry (
InitializeHwErrRecSupport();
//
+ // Initialize L"Timeout" EFI global variable.
+ //
+ BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
+ if (BootTimeOut != 0xFFFF) {
+ //
+ // If time out value equal 0xFFFF, no need set to 0xFFFF to variable area because UEFI specification
+ // define same behavior between no value or 0xFFFF value for L"Timeout".
+ //
+ Status = gRT->SetVariable (
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &BootTimeOut
+ );
+ ASSERT_EFI_ERROR(Status);
+ }
+
+ //
// bugbug: platform specific code
// Initialize the platform specific string and language
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
index d1705a0b9..44d9b71c4 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
@@ -1,7 +1,7 @@
/** @file
The functions for Boot Maintainence Main menu.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -672,7 +672,14 @@ ApplyChangeHandler (
break;
case FORM_TIME_OUT_ID:
- PcdSet16 (PcdPlatformBootTimeOut, CurrentFakeNVMap->BootTimeOut);
+ Status = gRT->SetVariable (
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &(CurrentFakeNVMap->BootTimeOut)
+ );
+ ASSERT_EFI_ERROR(Status);
Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;
break;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index 3dad6bd65..da0e17b38 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -1,7 +1,7 @@
/** @file
FrontPage routines to handle the callbacks and browser calls
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -21,6 +21,7 @@ BOOLEAN mModeInitialized = FALSE;
BOOLEAN gConnectAllHappened = FALSE;
UINTN gCallbackKey;
+CHAR8 *mLanguageString;
//
// Boot video resolution and text mode.
@@ -178,13 +179,10 @@ FrontPageCallback (
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
- CHAR8 *LanguageString;
CHAR8 *LangCode;
CHAR8 *Lang;
UINTN Index;
EFI_STATUS Status;
- CHAR8 *PlatformSupportedLanguages;
- CHAR8 *BestLanguage;
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
//
@@ -210,18 +208,13 @@ FrontPageCallback (
case FRONT_PAGE_KEY_LANGUAGE:
//
- // Collect the languages from what our current Language support is based on our VFR
- //
- LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle);
- ASSERT (LanguageString != NULL);
- //
// Allocate working buffer for RFC 4646 language in supported LanguageString.
//
- Lang = AllocatePool (AsciiStrSize (LanguageString));
- ASSERT (Lang != NULL);
+ Lang = AllocatePool (AsciiStrSize (mLanguageString));
+ ASSERT (Lang != NULL);
Index = 0;
- LangCode = LanguageString;
+ LangCode = mLanguageString;
while (*LangCode != 0) {
GetNextLanguage (&LangCode, Lang);
@@ -232,43 +225,22 @@ FrontPageCallback (
Index++;
}
- GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&PlatformSupportedLanguages, NULL);
- if (PlatformSupportedLanguages == NULL) {
- PlatformSupportedLanguages = AllocateCopyPool (
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
- );
- ASSERT (PlatformSupportedLanguages != NULL);
- }
-
- //
- // Select the best language in platform supported Language.
- //
- BestLanguage = GetBestLanguage (
- PlatformSupportedLanguages,
- FALSE,
- Lang,
- NULL
- );
- if (BestLanguage != NULL) {
+ if (Index == Value->u8) {
Status = gRT->SetVariable (
L"PlatformLang",
&gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (BestLanguage),
+ AsciiStrSize (Lang),
Lang
);
ASSERT_EFI_ERROR(Status);
- FreePool (BestLanguage);
} else {
ASSERT (FALSE);
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- FreePool (PlatformSupportedLanguages);
FreePool (Lang);
- FreePool (LanguageString);
break;
default:
@@ -328,11 +300,9 @@ InitializeFrontPage (
)
{
EFI_STATUS Status;
- CHAR8 *LanguageString;
CHAR8 *LangCode;
CHAR8 *Lang;
CHAR8 *CurrentLang;
- CHAR8 *BestLanguage;
UINTN OptionCount;
CHAR16 *StringBuffer;
EFI_HII_HANDLE HiiHandle;
@@ -341,7 +311,11 @@ InitializeFrontPage (
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
- BOOLEAN FirstFlag;
+ EFI_HII_STRING_PROTOCOL *HiiString;
+ UINTN StringSize;
+
+ Lang = NULL;
+ StringBuffer = NULL;
if (InitializeHiiData) {
//
@@ -422,62 +396,82 @@ InitializeFrontPage (
// Collect the languages from what our current Language support is based on our VFR
//
HiiHandle = gFrontPagePrivate.HiiHandle;
- LanguageString = HiiGetSupportedLanguages (HiiHandle);
- ASSERT (LanguageString != NULL);
- //
- // Allocate working buffer for RFC 4646 language in supported LanguageString.
- //
- Lang = AllocatePool (AsciiStrSize (LanguageString));
- ASSERT (Lang != NULL);
-
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
- //
- // Select the best language in LanguageString as the default one.
- //
- BestLanguage = GetBestLanguage (
- LanguageString,
- FALSE,
- (CurrentLang != NULL) ? CurrentLang : "",
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang),
- LanguageString,
- NULL
- );
- //
- // BestLanguage must be selected as it is the first language in LanguageString by default
- //
- ASSERT (BestLanguage != NULL);
- OptionCount = 0;
- LangCode = LanguageString;
- FirstFlag = FALSE;
+ CurrentLang = GetEfiGlobalVariable (L"PlatformLang");
if (gFrontPagePrivate.LanguageToken == NULL) {
+ //
+ // Get Support language list from variable.
+ //
+ mLanguageString = GetEfiGlobalVariable (L"PlatformLangCodes");
+ if (mLanguageString == NULL) {
+ mLanguageString = AllocateCopyPool (
+ AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
+ (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
+ );
+ ASSERT (mLanguageString != NULL);
+ }
+
+ //
+ // Count the language list number.
+ //
+ LangCode = mLanguageString;
+ Lang = AllocatePool (AsciiStrSize (mLanguageString));
+ ASSERT (Lang != NULL);
+ OptionCount = 0;
while (*LangCode != 0) {
GetNextLanguage (&LangCode, Lang);
OptionCount ++;
}
- gFrontPagePrivate.LanguageToken = AllocatePool (OptionCount * sizeof (EFI_STRING_ID));
+
+ //
+ // Allocate extra 1 as the end tag.
+ //
+ gFrontPagePrivate.LanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
ASSERT (gFrontPagePrivate.LanguageToken != NULL);
- FirstFlag = TRUE;
- }
- OptionCount = 0;
- LangCode = LanguageString;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
+ Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
+ ASSERT_EFI_ERROR (Status);
- if (FirstFlag) {
- StringBuffer = HiiGetString (HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, Lang);
- ASSERT (StringBuffer != NULL);
+ LangCode = mLanguageString;
+ OptionCount = 0;
+ while (*LangCode != 0) {
+ GetNextLanguage (&LangCode, Lang);
- //
- // Save the string Id for each language
- //
+ StringSize = 0;
+ Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ StringBuffer = AllocateZeroPool (StringSize);
+ ASSERT (StringBuffer != NULL);
+ Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (EFI_ERROR (Status)) {
+ StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
+ ASSERT (StringBuffer != NULL);
+ AsciiStrToUnicodeStr (Lang, StringBuffer);
+ }
+
+ ASSERT (StringBuffer != NULL);
gFrontPagePrivate.LanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
FreePool (StringBuffer);
+
+ OptionCount++;
}
+ }
- if (AsciiStrCmp (Lang, BestLanguage) == 0) {
+ ASSERT (gFrontPagePrivate.LanguageToken != NULL);
+ LangCode = mLanguageString;
+ OptionCount = 0;
+ if (Lang == NULL) {
+ Lang = AllocatePool (AsciiStrSize (mLanguageString));
+ ASSERT (Lang != NULL);
+ }
+ while (*LangCode != 0) {
+ GetNextLanguage (&LangCode, Lang);
+
+ if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
gFrontPagePrivate.LanguageToken[OptionCount],
@@ -501,9 +495,7 @@ InitializeFrontPage (
if (CurrentLang != NULL) {
FreePool (CurrentLang);
}
- FreePool (BestLanguage);
FreePool (Lang);
- FreePool (LanguageString);
HiiCreateOneOfOpCode (
StartOpCodeHandle,
@@ -1229,6 +1221,9 @@ PlatformBdsEnterFrontPage (
} while ((Status == EFI_SUCCESS) && (gCallbackKey != FRONT_PAGE_KEY_CONTINUE));
+ if (mLanguageString != NULL) {
+ FreePool (mLanguageString);
+ }
//
//Will leave browser, check any reset required change is applied? if yes, reset system
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni
index 20339e43b..7af87da90 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c b/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
index ee1763b32..ddb2f9398 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
@@ -2,7 +2,7 @@
Set the level of support for Hardware Error Record Persistence that is
implemented by the platform.
-Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, 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
@@ -26,17 +26,23 @@ InitializeHwErrRecSupport (
VOID
)
{
- UINT16 HardwareErrorRecordLevel;
+ EFI_STATUS Status;
+ UINT16 HardwareErrorRecordLevel;
HardwareErrorRecordLevel = PcdGet16 (PcdHardwareErrorRecordLevel);
if (HardwareErrorRecordLevel != 0) {
//
- // Set original value again to make sure this value is stored into variable
- // area but not PCD database.
- // if level value equal 0, no need set to 0 to variable area because UEFI specification
- // define same behavior between no value or 0 value for L"HwErrRecSupport"
+ // If level value equal 0, no need set to 0 to variable area because UEFI specification
+ // define same behavior between no value or 0 value for L"HwErrRecSupport".
//
- PcdSet16 (PcdHardwareErrorRecordLevel, HardwareErrorRecordLevel);
+ Status = gRT->SetVariable (
+ L"HwErrRecSupport",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &HardwareErrorRecordLevel
+ );
+ ASSERT_EFI_ERROR(Status);
}
}
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index 76e35ff03..bd1e68046 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -794,7 +794,6 @@ RejectPciDevice (
if (Temp == PciDevice) {
InitializePciDevice (Temp);
RemoveEntryList (CurrentLink);
- FreePciDevice (Temp);
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 873cf2519..742cdc193 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -2,7 +2,7 @@
Usb Bus Driver Binding and Bus IO Protocol.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -964,6 +964,7 @@ UsbBusBuildProtocol (
// The EFI_USB2_HC_PROTOCOL is produced for XHCI support.
// Then its max supported devices are 256. Otherwise it's 128.
//
+ ASSERT (UsbBus->Usb2Hc != NULL);
if (UsbBus->Usb2Hc->MajorRevision == 0x3) {
UsbBus->MaxDevices = 256;
}
diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index 45a236a7b..75d6267f6 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -26,7 +26,7 @@
Depex - Dependency Expresion.
SOR - Schedule On Request - Don't schedule if this bit is set.
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -984,6 +984,7 @@ CoreProcessFvImageFile (
UINTN BufferSize;
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
UINT32 FvAlignment;
+ EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;
//
// Read the first (and only the first) firmware volume section
@@ -1004,6 +1005,32 @@ CoreProcessFvImageFile (
&AuthenticationStatus
);
if (!EFI_ERROR (Status)) {
+ //
+ // Evaluate the authentication status of the Firmware Volume through
+ // Security Architectural Protocol
+ //
+ if (gSecurity != NULL) {
+ FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
+ Status = gSecurity->FileAuthenticationState (
+ gSecurity,
+ AuthenticationStatus,
+ FvFileDevicePath
+ );
+ if (FvFileDevicePath != NULL) {
+ FreePool (FvFileDevicePath);
+ }
+
+ if (Status != EFI_SUCCESS) {
+ //
+ // Security check failed. The firmware volume should not be used for any purpose.
+ //
+ if (Buffer != NULL) {
+ FreePool (Buffer);
+ }
+ return Status;
+ }
+ }
+
//
// FvImage should be at its required alignment.
//
@@ -1087,7 +1114,6 @@ CoreFwVolEventProtocolNotify (
{
EFI_STATUS Status;
EFI_STATUS GetNextFileStatus;
- EFI_STATUS SecurityStatus;
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
EFI_HANDLE FvHandle;
@@ -1160,24 +1186,6 @@ CoreFwVolEventProtocolNotify (
}
//
- // Evaluate the authentication status of the Firmware Volume through
- // Security Architectural Protocol
- //
- if (gSecurity != NULL) {
- SecurityStatus = gSecurity->FileAuthenticationState (
- gSecurity,
- 0,
- FvDevicePath
- );
- if (SecurityStatus != EFI_SUCCESS) {
- //
- // Security check failed. The firmware volume should not be used for any purpose.
- //
- continue;
- }
- }
-
- //
// Discover Drivers in FV and add them to the Discovered Driver List.
// Process EFI_FV_FILETYPE_DRIVER type and then EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
// EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core
diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c
index 045d8331d..85e5e3fcf 100644
--- a/MdeModulePkg/Core/Pei/Image/Image.c
+++ b/MdeModulePkg/Core/Pei/Image/Image.c
@@ -1,7 +1,7 @@
/** @file
Pei Core Load Image Support
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -348,7 +348,7 @@ LoadAndRelocatePeCoffImage (
EFI_STATUS Status;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
PEI_CORE_INSTANCE *Private;
- UINT64 AlignImageSize;
+ UINT64 AlignImageSize;
Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
@@ -378,19 +378,19 @@ LoadAndRelocatePeCoffImage (
// Allocate Memory for the image when memory is ready, boot mode is not S3, and image is relocatable.
//
if ((!ImageContext.RelocationsStripped) && (Private->PeiMemoryInstalled) && (Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) {
- //
- // Allocate more buffer to avoid buffer overflow.
- //
- if (ImageContext.IsTeImage) {
- AlignImageSize = ImageContext.ImageSize + ((EFI_TE_IMAGE_HEADER *) Pe32Data)->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
- } else {
- AlignImageSize = ImageContext.ImageSize;
- }
-
- if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
- AlignImageSize += ImageContext.SectionAlignment;
- }
-
+ //
+ // Allocate more buffer to avoid buffer overflow.
+ //
+ if (ImageContext.IsTeImage) {
+ AlignImageSize = ImageContext.ImageSize + ((EFI_TE_IMAGE_HEADER *) Pe32Data)->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+ } else {
+ AlignImageSize = ImageContext.ImageSize;
+ }
+
+ if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
+ AlignImageSize += ImageContext.SectionAlignment;
+ }
+
if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0) {
Status = GetPeCoffImageFixLoadingAssignedAddress(&ImageContext, Private);
if (EFI_ERROR (Status)){
@@ -398,10 +398,10 @@ LoadAndRelocatePeCoffImage (
//
// The PEIM is not assiged valid address, try to allocate page to load it.
//
- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize));
+ ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize));
}
} else {
- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize));
+ ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize));
}
ASSERT (ImageContext.ImageAddress != 0);
if (ImageContext.ImageAddress == 0) {
@@ -409,15 +409,15 @@ LoadAndRelocatePeCoffImage (
}
//
- // If necessary, adjust the Image Address to make sure it is section alignment.
- //
- if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
- ImageContext.ImageAddress =
- (ImageContext.ImageAddress + ImageContext.SectionAlignment - 1) &
- ~((UINTN)ImageContext.SectionAlignment - 1);
- }
- //
- // Fix alignment requirement when Load IPF TeImage into memory.
+ // Adjust the Image Address to make sure it is section alignment.
+ //
+ if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
+ ImageContext.ImageAddress =
+ (ImageContext.ImageAddress + ImageContext.SectionAlignment - 1) &
+ ~((UINTN)ImageContext.SectionAlignment - 1);
+ }
+ //
+ // Fix alignment requirement when Load IPF TeImage into memory.
// Skip the reserved space for the stripped PeHeader when load TeImage into memory.
//
if (ImageContext.IsTeImage) {
diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
index 8a9d99b15..b2e3d6a1e 100644
--- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
+++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
@@ -27,7 +27,7 @@
Depex - Dependency Expresion.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -671,6 +671,9 @@ SmmLoadImage (
// used the UEFI Boot Services AllocatePool() function
//
Status = gBS->FreePool(Buffer);
+ if (!EFI_ERROR (Status) && EFI_ERROR (SecurityStatus)) {
+ Status = SecurityStatus;
+ }
return Status;
}
@@ -1197,7 +1200,6 @@ SmmDriverDispatchHandler (
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
EFI_STATUS GetNextFileStatus;
- EFI_STATUS SecurityStatus;
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
EFI_HANDLE FvHandle;
@@ -1259,31 +1261,6 @@ SmmDriverDispatchHandler (
}
//
- // If the Security Architectural Protocol has not been located yet, then attempt to locate it
- //
- if (mSecurity == NULL) {
- gBS->LocateProtocol (&gEfiSecurityArchProtocolGuid, NULL, (VOID**)&mSecurity);
- }
-
- //
- // Evaluate the authentication status of the Firmware Volume through
- // Security Architectural Protocol
- //
- if (mSecurity != NULL) {
- SecurityStatus = mSecurity->FileAuthenticationState (
- mSecurity,
- 0,
- FvDevicePath
- );
- if (SecurityStatus != EFI_SUCCESS) {
- //
- // Security check failed. The firmware volume should not be used for any purpose.
- //
- continue;
- }
- }
-
- //
// Discover Drivers in FV and add them to the Discovered Driver List.
// Process EFI_FV_FILETYPE_SMM type and then EFI_FV_FILETYPE_COMBINED_SMM_DXE
//
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 468647042..86adb1349 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -1,7 +1,7 @@
/** @file
SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -267,7 +267,7 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
// the associated event is immediately signalled, so the notification function will be executed and the
// SMM End Of Dxe Protocol will be found if it is already in the handle database.
//
- { FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplGuidedEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },
+ { FALSE, FALSE, &gEfiEndOfDxeEventGroupGuid, SmmIplGuidedEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },
//
// Declare event notification on the DXE Dispatch Event Group. This event is signaled by the DXE Core
// each time the DXE Core dispatcher has completed its work. When this event is signalled, the SMM Core
diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c b/MdeModulePkg/Core/PiSmmCore/Smi.c
index 1111959c3..816d0f519 100644
--- a/MdeModulePkg/Core/PiSmmCore/Smi.c
+++ b/MdeModulePkg/Core/PiSmmCore/Smi.c
@@ -1,7 +1,7 @@
/** @file
SMI management.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -128,11 +128,11 @@ SmiManage (
LIST_ENTRY *Head;
SMI_ENTRY *SmiEntry;
SMI_HANDLER *SmiHandler;
- BOOLEAN InterruptQuiesced;
+ BOOLEAN SuccessReturn;
EFI_STATUS Status;
Status = EFI_NOT_FOUND;
- InterruptQuiesced = FALSE;
+ SuccessReturn = FALSE;
if (HandlerType == NULL) {
//
// Root SMI handler
@@ -167,8 +167,8 @@ SmiManage (
switch (Status) {
case EFI_INTERRUPT_PENDING:
//
- // If a handler returns EFI_INTERRUPT_PENDING then no additional handlers
- // will be processed and EFI_INTERRUPT_PENDING will be returned.
+ // If a handler returns EFI_INTERRUPT_PENDING and HandlerType is not NULL then
+ // no additional handlers will be processed and EFI_INTERRUPT_PENDING will be returned.
//
if (HandlerType != NULL) {
return EFI_INTERRUPT_PENDING;
@@ -177,12 +177,14 @@ SmiManage (
case EFI_SUCCESS:
//
- // If a handler returns EFI_SUCCESS then no additional handlers will be processed.
- // then the function will return EFI_SUCCESS.
+ // If at least one of the handlers returns EFI_SUCCESS then the function will return
+ // EFI_SUCCESS. If a handler returns EFI_SUCCESS and HandlerType is not NULL then no
+ // additional handlers will be processed.
//
if (HandlerType != NULL) {
return EFI_SUCCESS;
}
+ SuccessReturn = TRUE;
break;
case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
@@ -190,7 +192,7 @@ SmiManage (
// If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED
// then the function will return EFI_SUCCESS.
//
- InterruptQuiesced = TRUE;
+ SuccessReturn = TRUE;
break;
case EFI_WARN_INTERRUPT_SOURCE_PENDING:
@@ -209,7 +211,7 @@ SmiManage (
}
}
- if (InterruptQuiesced) {
+ if (SuccessReturn) {
Status = EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h
index 7860ccbfc..1bdcbfe56 100644
--- a/MdeModulePkg/Include/Library/HiiLib.h
+++ b/MdeModulePkg/Include/Library/HiiLib.h
@@ -1,7 +1,7 @@
/** @file
Public include file for the HII Library
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, 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 that accompanies this distribution.
The full text of the license may be found at
@@ -680,6 +680,49 @@ HiiCreateGotoOpCode (
);
/**
+ Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode.
+
+ When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created.
+ When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created.
+ When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created.
+ When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created.
+
+ If OpCodeHandle is NULL, then ASSERT().
+ If any reserved bits are set in QuestionFlags, then ASSERT().
+
+ @param[in] OpCodeHandle The handle to the buffer of opcodes.
+ @param[in] RefFormId The Destination Form ID.
+ @param[in] Prompt The string ID for Prompt.
+ @param[in] Help The string ID for Help.
+ @param[in] QuestionFlags The flags in Question Header
+ @param[in] QuestionId Question ID.
+ @param[in] RefQuestionId The question on the form to which this link is referring.
+ If its value is zero, then the link refers to the top of the form.
+ @param[in] RefFormSetId The form set to which this link is referring. If its value is NULL, and RefDevicePath is
+ zero, then the link is to the current form set.
+ @param[in] RefDevicePath The string identifier that specifies the string containing the text representation of
+ the device path to which the form set containing the form specified by FormId.
+ If its value is zero, then the link refers to the current page.
+
+ @retval NULL There is not enough space left in Buffer to add the opcode.
+ @retval Other A pointer to the created opcode.
+
+**/
+UINT8 *
+EFIAPI
+HiiCreateGotoExOpCode (
+ IN VOID *OpCodeHandle,
+ IN EFI_FORM_ID RefFormId,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_QUESTION_ID RefQuestionId,
+ IN EFI_GUID *RefFormSetId, OPTIONAL
+ IN EFI_STRING_ID RefDevicePath
+ );
+
+/**
Create EFI_IFR_CHECKBOX_OP opcode.
If OpCodeHandle is NULL, then ASSERT().
diff --git a/MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.c b/MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.c
index 9af05a440..6a50937ad 100644
--- a/MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.c
+++ b/MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.c
@@ -1,7 +1,7 @@
/** @file
Provides generic security measurement functions for DXE module.
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, 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
@@ -102,7 +102,7 @@ CheckAuthenticationOperation (
//
// Make sure new auth operation can be recognized.
//
- ASSERT ((CheckAuthOperation & ~(EFI_AUTH_IMAGE_OPERATION_MASK | EFI_AUTH_OPERATION_IMAGE_REQUIRED)) == 0);
+ ASSERT ((CheckAuthOperation & ~(EFI_AUTH_IMAGE_OPERATION_MASK | EFI_AUTH_OPERATION_AUTHENTICATION_STATE | EFI_AUTH_OPERATION_IMAGE_REQUIRED)) == 0);
//
// When current operation includes measure image operation,
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
index 0e7ddee35..9590f8f14 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
@@ -2859,6 +2859,82 @@ HiiCreateGotoOpCode (
}
/**
+ Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode.
+
+ When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created.
+ When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created.
+ When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created.
+ When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created.
+
+ If OpCodeHandle is NULL, then ASSERT().
+ If any reserved bits are set in QuestionFlags, then ASSERT().
+
+ @param[in] OpCodeHandle The handle to the buffer of opcodes.
+ @param[in] RefFormId The Destination Form ID.
+ @param[in] Prompt The string ID for Prompt.
+ @param[in] Help The string ID for Help.
+ @param[in] QuestionFlags The flags in Question Header
+ @param[in] QuestionId Question ID.
+ @param[in] RefQuestionId The question on the form to which this link is referring.
+ If its value is zero, then the link refers to the top of the form.
+ @param[in] RefFormSetId The form set to which this link is referring. If its value is NULL, and RefDevicePath is
+ zero, then the link is to the current form set.
+ @param[in] RefDevicePath The string identifier that specifies the string containing the text representation of
+ the device path to which the form set containing the form specified by FormId.
+ If its value is zero, then the link refers to the current page.
+
+ @retval NULL There is not enough space left in Buffer to add the opcode.
+ @retval Other A pointer to the created opcode.
+
+**/
+UINT8 *
+EFIAPI
+HiiCreateGotoExOpCode (
+ IN VOID *OpCodeHandle,
+ IN EFI_FORM_ID RefFormId,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_QUESTION_ID RefQuestionId,
+ IN EFI_GUID *RefFormSetId, OPTIONAL
+ IN EFI_STRING_ID RefDevicePath
+ )
+{
+ EFI_IFR_REF4 OpCode;
+ UINTN OpCodeSize;
+
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED))) == 0);
+
+ ZeroMem (&OpCode, sizeof (OpCode));
+ OpCode.Question.Header.Prompt = Prompt;
+ OpCode.Question.Header.Help = Help;
+ OpCode.Question.QuestionId = QuestionId;
+ OpCode.Question.Flags = QuestionFlags;
+ OpCode.FormId = RefFormId;
+ OpCode.QuestionId = RefQuestionId;
+ OpCode.DevicePath = RefDevicePath;
+ if (RefFormSetId != NULL) {
+ CopyMem (&OpCode.FormSetId, RefFormSetId, sizeof (OpCode.FormSetId));
+ }
+
+ //
+ // Cacluate OpCodeSize based on the input Ref value.
+ // Try to use the small OpCode to save size.
+ //
+ OpCodeSize = sizeof (EFI_IFR_REF);
+ if (RefDevicePath != 0) {
+ OpCodeSize = sizeof (EFI_IFR_REF4);
+ } else if (RefFormSetId != NULL) {
+ OpCodeSize = sizeof (EFI_IFR_REF3);
+ } else if (RefQuestionId != 0) {
+ OpCodeSize = sizeof (EFI_IFR_REF2);
+ }
+
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_REF_OP, OpCodeSize);
+}
+
+/**
Create EFI_IFR_CHECKBOX_OP opcode.
If OpCodeHandle is NULL, then ASSERT().
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 710e3e6a0..ba80b809d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -4,7 +4,7 @@
# It also provides the defintions(including PPIs/PROTOCOLs/GUIDs and library classes)
# and libraries instances, which are used for those modules.
#
-# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2013, 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 that accompanies this distribution.
# The full text of the license may be found at
@@ -453,6 +453,11 @@
# If FALSE, TEXT statement will be set to GrayOut only when GrayOut condition is TRUE.
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement|FALSE|BOOLEAN|0x0001004f
+ ## This PCD specifies whether unselectable menu should be gray out in HII Form Browser.
+ # If TRUE, the unselectable menu will be set to GrayOut.
+ # If FALSE, the menu will be show as normal menu entry even if it is not selectable.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu|FALSE|BOOLEAN|0x00010070
+
## If TRUE, recovery from IDE disk will be supported.
gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryOnIdeDisk|TRUE|BOOLEAN|0x00010060
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
index ab65e7e16..795123d10 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
@@ -2,7 +2,7 @@
Console Platform DXE Driver, install Console Device Guids and update Console
Environment Variables.
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -792,7 +792,9 @@ IsGopSibling (
EFI_DEVICE_PATH_PROTOCOL *NodeRight;
for (NodeLeft = Left; !IsDevicePathEndType (NodeLeft); NodeLeft = NextDevicePathNode (NodeLeft)) {
- if (DevicePathType (NodeLeft) == ACPI_DEVICE_PATH && DevicePathSubType (NodeLeft) == ACPI_ADR_DP) {
+ if ((DevicePathType (NodeLeft) == ACPI_DEVICE_PATH && DevicePathSubType (NodeLeft) == ACPI_ADR_DP) ||
+ (DevicePathType (NodeLeft) == HARDWARE_DEVICE_PATH && DevicePathSubType (NodeLeft) == HW_CONTROLLER_DP &&
+ DevicePathType (NextDevicePathNode (NodeLeft)) == ACPI_DEVICE_PATH && DevicePathSubType (NextDevicePathNode (NodeLeft)) == ACPI_ADR_DP)) {
break;
}
}
@@ -802,7 +804,9 @@ IsGopSibling (
}
for (NodeRight = Right; !IsDevicePathEndType (NodeRight); NodeRight = NextDevicePathNode (NodeRight)) {
- if (DevicePathType (NodeRight) == ACPI_DEVICE_PATH && DevicePathSubType (NodeRight) == ACPI_ADR_DP) {
+ if ((DevicePathType (NodeRight) == ACPI_DEVICE_PATH && DevicePathSubType (NodeRight) == ACPI_ADR_DP) ||
+ (DevicePathType (NodeRight) == HARDWARE_DEVICE_PATH && DevicePathSubType (NodeRight) == HW_CONTROLLER_DP &&
+ DevicePathType (NextDevicePathNode (NodeRight)) == ACPI_DEVICE_PATH && DevicePathSubType (NextDevicePathNode (NodeRight)) == ACPI_ADR_DP)) {
break;
}
}
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
index 224244164..671163633 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
@@ -1,7 +1,7 @@
/** @file
Implement IP4 pesudo interface.
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, 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
@@ -740,24 +740,11 @@ Ip4FreeInterface (
//
Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, IpInstance);
- if (--Interface->RefCnt > 0) {
- return EFI_SUCCESS;
- }
-
//
- // Destroy the interface if this is the last IP instance that
- // has the address. Remove all the system transmitted packets
- // from this interface, cancel the receive request if there is
- // one, and destroy the ARP requests.
+ // Destroy the ARP instance if this is the last IP instance that
+ // has the address.
//
- Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, NULL);
- Ip4CancelReceive (Interface);
-
- ASSERT (IsListEmpty (&Interface->IpInstances));
- ASSERT (IsListEmpty (&Interface->ArpQues));
- ASSERT (IsListEmpty (&Interface->SentFrames));
-
- if (Interface->Arp != NULL) {
+ if (Interface->Arp != NULL && IsListEmpty (&Interface->IpInstances)) {
gBS->CloseProtocol (
Interface->ArpHandle,
&gEfiArpProtocolGuid,
@@ -771,8 +758,25 @@ Ip4FreeInterface (
&gEfiArpServiceBindingProtocolGuid,
Interface->ArpHandle
);
+ Interface->Arp = NULL;
+ }
+
+ if (--Interface->RefCnt > 0) {
+ return EFI_SUCCESS;
}
+ //
+ // Destroy the interface if it is not referenced by any IP instance (for common Interface)
+ // or the IP service (for the DefaultInterface). Remove all the system transmitted packets
+ // from this interface, cancel the receive request if there is one.
+ //
+ Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, NULL);
+ Ip4CancelReceive (Interface);
+
+ ASSERT (IsListEmpty (&Interface->IpInstances));
+ ASSERT (IsListEmpty (&Interface->ArpQues));
+ ASSERT (IsListEmpty (&Interface->SentFrames));
+
RemoveEntryList (&Interface->Link);
FreePool (Interface);
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 74bf7f76e..29f07ce4a 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, 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
@@ -562,6 +562,9 @@ Ip4AutoConfigCallBackDpc (
IP4_ADDR SubnetMask;
IP4_ADDR SubnetAddress;
IP4_ADDR GatewayAddress;
+ IP4_PROTOCOL *Ip4Instance;
+ EFI_ARP_PROTOCOL *Arp;
+ LIST_ENTRY *Entry;
IpSb = (IP4_SERVICE *) Context;
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
@@ -650,11 +653,33 @@ Ip4AutoConfigCallBackDpc (
StationAddress = EFI_NTOHL (Data->StationAddress);
SubnetMask = EFI_NTOHL (Data->SubnetMask);
Status = Ip4SetAddress (IpIf, StationAddress, SubnetMask);
-
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
+ if (IpIf->Arp != NULL) {
+ //
+ // A non-NULL IpIf->Arp here means a new ARP child is created when setting default address,
+ // but some IP children may have referenced the default interface before it is configured,
+ // these IP instances also consume this ARP protocol so they need to open it BY_CHILD_CONTROLLER.
+ //
+ Arp = NULL;
+ NET_LIST_FOR_EACH (Entry, &IpIf->IpInstances) {
+ Ip4Instance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, AddrLink, IP4_PROTOCOL_SIGNATURE);
+ Status = gBS->OpenProtocol (
+ IpIf->ArpHandle,
+ &gEfiArpProtocolGuid,
+ (VOID **) &Arp,
+ gIp4DriverBinding.DriverBindingHandle,
+ Ip4Instance->Handle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+ }
+ }
+
Ip4AddRoute (
IpSb->DefaultRouteTable,
StationAddress,
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
index 7ff17b663..370eaa6a9 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
@@ -1,7 +1,7 @@
/** @file
Transmit the IP4 packet.
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, 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
@@ -286,46 +286,40 @@ Ip4Output (
if (EFI_ERROR(Status)) {
return Status;
}
+
+ Dest = Head->Dst;
+ if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {
+ //
+ // Set the gateway to local broadcast if the Dest is
+ // the broadcast address for the connected network or
+ // it is local broadcast.
+ //
+ GateWay = IP4_ALLONE_ADDRESS;
- //
- // Route the packet unless overrided, that is, GateWay isn't zero.
- //
- if (GateWay == IP4_ALLZERO_ADDRESS) {
- Dest = Head->Dst;
-
- if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {
- //
- // Set the gateway to local broadcast if the Dest is
- // the broadcast address for the connected network or
- // it is local broadcast.
- //
- GateWay = IP4_ALLONE_ADDRESS;
-
- } else if (IP4_IS_MULTICAST (Dest)) {
- //
- // Set the gateway to the destination if it is an multicast
- // address. The IP4_INTERFACE won't consult ARP to send local
- // broadcast and multicast.
- //
- GateWay = Head->Dst;
+ } else if (IP4_IS_MULTICAST (Dest)) {
+ //
+ // Set the gateway to the destination if it is an multicast
+ // address. The IP4_INTERFACE won't consult ARP to send local
+ // broadcast and multicast.
+ //
+ GateWay = Head->Dst;
+ } else if (GateWay == IP4_ALLZERO_ADDRESS) {
+ //
+ // Route the packet unless overrided, that is, GateWay isn't zero.
+ //
+ if (IpInstance == NULL) {
+ CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);
} else {
- //
- // Consult the route table to route the packet
- //
- if (IpInstance == NULL) {
- CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);
- } else {
- CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);
- }
-
- if (CacheEntry == NULL) {
- return EFI_NOT_FOUND;
- }
+ CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);
+ }
- GateWay = CacheEntry->NextHop;
- Ip4FreeRouteCacheEntry (CacheEntry);
+ if (CacheEntry == NULL) {
+ return EFI_NOT_FOUND;
}
+
+ GateWay = CacheEntry->NextHop;
+ Ip4FreeRouteCacheEntry (CacheEntry);
}
//
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
index f1fea0cff..177d0a913 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
@@ -1,7 +1,7 @@
/** @file
Implementation of driver entry point and driver binding protocol.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -258,7 +258,7 @@ Done:
device to start.
@retval EFI_SUCCESS This driver is added to ControllerHandle
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
+ @retval EFI_DEVICE_ERROR This driver could not be started due to a device error
@retval other This driver does not support this device
**/
@@ -698,11 +698,11 @@ SimpleNetworkDriverStart (
return Status;
}
- Status = mPciIo->FreeBuffer (
- mPciIo,
- SNP_MEM_PAGES (4096),
- Snp->Cpb
- );
+ mPciIo->FreeBuffer (
+ mPciIo,
+ SNP_MEM_PAGES (4096),
+ Snp->Cpb
+ );
Error_DeleteSNP:
@@ -726,6 +726,13 @@ NiiError:
Controller
);
+ //
+ // If we got here that means we are in error state.
+ //
+ if (!EFI_ERROR (Status)) {
+ Status = EFI_DEVICE_ERROR;
+ }
+
return Status;
}
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 511e06487..7bdffc55d 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
/** @file
Interface routines for PxeBc.
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, 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
@@ -652,9 +652,6 @@ EfiPxeBcDhcp (
// finished, set the various Mode members.
//
Status = PxeBcCheckSelectedOffer (Private);
- if (!EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
ON_EXIT:
if (EFI_ERROR (Status)) {
@@ -840,6 +837,7 @@ EfiPxeBcDiscover (
// If info isn't offered,
// use the cached DhcpAck and ProxyOffer packets.
//
+ ZeroMem (&DefaultInfo, sizeof (EFI_PXE_BASE_CODE_DISCOVER_INFO));
if (*Layer != EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL) {
if (!Mode->PxeDiscoverValid || !Mode->PxeReplyReceived || (!Mode->PxeBisReplyReceived && UseBis)) {
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c
index 53780dca9..6eaadd6cc 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
@@ -1,7 +1,7 @@
/** @file
Help functions used by PCD DXE driver.
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -150,6 +150,11 @@ GetWorker (
//
GetPtrTypeSize (TmpTokenNumber, &GetSize);
}
+ //
+ // If the operation is successful, we copy the data
+ // to the default value buffer in the PCD Database.
+ // So that we can free the Data allocated in GetHiiVariable.
+ //
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
FreePool (Data);
}
@@ -166,19 +171,14 @@ GetWorker (
//
GetPtrTypeSize (TmpTokenNumber, &GetSize);
}
+ //
+ // If the operation is successful, we copy the data
+ // to the default value buffer in the PCD Database.
+ // So that we can free the Data allocated in GetHiiVariable.
+ //
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
FreePool (Data);
}
- //
- // If the operation is successful, we copy the data
- // to the default value buffer in the PCD Database.
- // So that we can free the Data allocated in GetHiiVariable.
- //
- //
- // If the operation is not successful,
- // Return 1) either the default value specified by Platform Integrator
- // 2) Or the value Set by a PCD set operation.
- //
RetPtr = (VOID *) VaraiableDefaultBuffer;
}
break;
@@ -535,6 +535,12 @@ GetHiiVariable (
ASSERT (Status == EFI_SUCCESS);
*VariableData = Buffer;
*VariableSize = Size;
+ } else {
+ //
+ // Use Default Data only when variable is not found.
+ // For other error status, correct data can't be got, and trig ASSERT().
+ //
+ ASSERT (Status == EFI_NOT_FOUND);
}
return Status;
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
index f2ed384c9..22e6c7f4e 100644
--- a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
+++ b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
@@ -1,7 +1,7 @@
/** @file
This driver produces Security2 and Security architectural protocol based on SecurityManagementLib.
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -69,13 +69,20 @@ SecurityStubAuthenticateState (
IN CONST EFI_DEVICE_PATH_PROTOCOL *File
)
{
- return ExecuteSecurity2Handlers (EFI_AUTH_OPERATION_AUTHENTICATION_STATE,
+ EFI_STATUS Status;
+
+ Status = ExecuteSecurity2Handlers (EFI_AUTH_OPERATION_AUTHENTICATION_STATE,
AuthenticationStatus,
File,
NULL,
0,
FALSE
);
+ if (Status == EFI_SUCCESS) {
+ Status = ExecuteSecurityHandlers (AuthenticationStatus, File);
+ }
+
+ return Status;
}
/**
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
index 2a4cda41e..7e740bc09 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
@@ -80,6 +80,7 @@
[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu ## CONSUMES
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor ## CONSUMES
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index 8ff90e144..e9f9f70ed 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -778,6 +778,9 @@ UiAddMenuOption (
if ((Statement->ValueExpression != NULL) ||
((Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY) != 0)) {
MenuOption->ReadOnly = TRUE;
+ if (FeaturePcdGet (PcdBrowerGrayOutReadOnlyMenu)) {
+ MenuOption->GrayOut = TRUE;
+ }
}
InsertTailList (&gMenuOption, &MenuOption->Link);
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 992c5387f..db0759639 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -1291,7 +1291,7 @@ InitializeListHead (
If Entry is NULL, then ASSERT().
If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -1321,7 +1321,7 @@ InsertHeadList (
If Entry is NULL, then ASSERT().
If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -1350,7 +1350,7 @@ InsertTailList (
If List is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
@@ -1378,8 +1378,8 @@ GetFirstNode (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ If PcdMaximumLinkedListLength is not zero, and List contains more than
+ PcdMaximumLinkedListLength nodes, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
@param List A pointer to the head node of a doubly linked list.
@@ -1407,8 +1407,8 @@ GetNextNode (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ If PcdMaximumLinkedListLength is not zero, and List contains more than
+ PcdMaximumLinkedListLength nodes, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
@param List A pointer to the head node of a doubly linked list.
@@ -1434,7 +1434,7 @@ GetPreviousNode (
If ListHead is NULL, then ASSERT().
If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
@@ -1464,7 +1464,7 @@ IsListEmpty (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(),
then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal
@@ -1496,7 +1496,7 @@ IsNull (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h
index a60310ab6..fe416a0c3 100644
--- a/MdePkg/Library/BaseLib/BaseLibInternals.h
+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
@@ -349,7 +349,7 @@ InternalSwitchStack (
If List->ForwardLink is NULL, then ASSERT().
If List->backLink is NULL, then ASSERT().
If Node is NULL, then ASSERT();
- If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm
index 4e54d0c36..504b397f1 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm
+++ b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2013, 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
@@ -56,7 +56,7 @@ AsmCpuidEx PROC USES ebx
jecxz @F
mov [ecx], edx
@@:
- mov edx, [ebp + 28]
+ mov ecx, [ebp + 28]
jecxz @F
pop [ecx]
@@:
diff --git a/MdePkg/Library/BaseLib/LinkedList.c b/MdePkg/Library/BaseLib/LinkedList.c
index 03e8477c7..f26ef49b3 100644
--- a/MdePkg/Library/BaseLib/LinkedList.c
+++ b/MdePkg/Library/BaseLib/LinkedList.c
@@ -26,8 +26,8 @@
If Node is NULL, then ASSERT().
If PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE and Node
is in not a member of List, then return FALSE
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ If PcdMaximumLinkedListLength is not zero, and List contains more than
+ PcdMaximumLinkedListLength nodes, then ASSERT().
@param List A pointer to a node in a linked list.
@param Node A pointer to a node in a linked list.
@@ -153,7 +153,7 @@ InitializeListHead (
If Entry is NULL, then ASSERT().
If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -194,7 +194,7 @@ InsertHeadList (
If Entry is NULL, then ASSERT().
If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -234,7 +234,7 @@ InsertTailList (
If List is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
@@ -269,8 +269,8 @@ GetFirstNode (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ If PcdMaximumLinkedListLength is not zero, and List contains more than
+ PcdMaximumLinkedListLength nodes, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
@param List A pointer to the head node of a doubly-linked list.
@@ -305,8 +305,8 @@ GetNextNode (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ If PcdMaximumLinkedListLength is not zero, and List contains more than
+ PcdMaximumLinkedListLength nodes, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
@param List A pointer to the head node of a doubly-linked list.
@@ -339,7 +339,7 @@ GetPreviousNode (
If ListHead is NULL, then ASSERT().
If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
@@ -376,7 +376,7 @@ IsListEmpty (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(),
then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List and Node is not
@@ -415,7 +415,7 @@ IsNull (
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes
in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
index 962d9387c..1da31dcc5 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
@@ -1,7 +1,7 @@
/** @file
Dhcp6 internal functions implementation.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -2981,7 +2981,9 @@ Dhcp6OnTimerTick (
// Select the advertisement received before.
//
Status = Dhcp6SelectAdvertiseMsg (Instance, Instance->AdSelect);
- if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ goto ON_CLOSE;
+ } else if (EFI_ERROR (Status)) {
TxCb->RetryCnt++;
}
return;
@@ -2997,6 +2999,7 @@ Dhcp6OnTimerTick (
// Check whether overflow the max retry count limit for this packet
//
if (TxCb->RetryCtl.Mrc != 0 && TxCb->RetryCtl.Mrc < TxCb->RetryCnt) {
+ Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3004,6 +3007,7 @@ Dhcp6OnTimerTick (
// Check whether overflow the max retry duration for this packet
//
if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd <= TxCb->RetryLos) {
+ Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3093,9 +3097,10 @@ Dhcp6OnTimerTick (
ON_CLOSE:
- if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
+ if (TxCb->TxPacket != NULL &&
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew ||
- TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm
+ TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)
) {
//
// The failure of renew/Confirm will still switch to the bound state.
@@ -3120,6 +3125,6 @@ Dhcp6OnTimerTick (
//
// The failure of the others will terminate current state machine if timeout.
//
- Dhcp6CleanupSession (Instance, EFI_NO_RESPONSE);
+ Dhcp6CleanupSession (Instance, Status);
}
}
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
index e814d5a84..540adee31 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
@@ -1,7 +1,7 @@
/** @file
Boot functions implementation for UefiPxeBc Driver.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -278,7 +278,7 @@ PxeBcSelectBootMenu (
PXEBC_BOOT_MENU_ENTRY *MenuArray[PXEBC_MENU_MAX_NUM];
Finish = FALSE;
- Select = 1;
+ Select = 0;
Index = 0;
*Type = 0;
Mode = Private->PxeBc.Mode;
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 183dc0ced..07f2b6cfc 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
/** @file
This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
- Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2013, 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
@@ -428,10 +428,6 @@ EfiPxeBcDhcp (
// Start S.A.R.R. process to get a IPv6 address and other boot information.
//
Status = PxeBcDhcp6Sarr (Private, Private->Dhcp6);
-
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
} else {
//
@@ -443,13 +439,11 @@ EfiPxeBcDhcp (
// Start D.O.R.A. process to get a IPv4 address and other boot information.
//
Status = PxeBcDhcp4Dora (Private, Private->Dhcp4);
-
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
}
-
-ON_EXIT:
+
+ //
+ // Reconfigure the UDP instance with the default configuration.
+ //
if (Mode->UsingIpv6) {
Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else {
@@ -572,6 +566,7 @@ EfiPxeBcDiscover (
//
// There are 3 methods to get the information for discover.
//
+ ZeroMem (&DefaultInfo, sizeof (EFI_PXE_BASE_CODE_DISCOVER_INFO));
if (*Layer != EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL) {
//
// 1. Take the previous setting as the discover info.
@@ -690,9 +685,7 @@ EfiPxeBcDiscover (
}
}
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- } else {
+ if (!EFI_ERROR (Status)) {
//
// Parse the cached PXE reply packet, and store it into mode data if valid.
//
@@ -964,11 +957,9 @@ EfiPxeBcMtftp (
Mode->IcmpErrorReceived = TRUE;
}
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
-ON_EXIT:
+ //
+ // Reconfigure the UDP instance with the default configuration.
+ //
if (Mode->UsingIpv6) {
Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else {
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index f918d6a29..e6fb01ca7 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,7 +1,7 @@
/** @file
Support functions implementation for UefiPxeBc Driver.
- Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2013, 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
@@ -59,10 +59,6 @@ PxeBcFlushStaionIp (
}
Status = Private->Ip6->Receive (Private->Ip6, &Private->Icmp6Token);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
} else {
ASSERT (SubnetMask != NULL);
CopyMem (&Private->Udp4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
@@ -82,10 +78,6 @@ PxeBcFlushStaionIp (
}
Status = Private->Ip4->Receive (Private->Ip4, &Private->IcmpToken);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
}
ON_EXIT:
diff --git a/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c b/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c
index 9a70593db..2f93140e4 100644
--- a/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c
+++ b/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c
@@ -17,7 +17,6 @@
#include <Base.h>
#include <Library/DebugLib.h>
#include <Library/SerialPortLib.h>
-#include <Library/SerialPortExtLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
#include <Library/OmapLib.h>
@@ -123,57 +122,3 @@ SerialPortPoll (
}
}
-/**
- Set the serial device control bits.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return RETURN_SUCCESS;
-}
-
-/**
- Get the serial device control bits.
-
- @param Control Control signals read from the serial device.
-
- @retval EFI_SUCCESS The control bits were read from the serial device.
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- return RETURN_SUCCESS;
-}
-
-
-/**
- Set the serial device attributes.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetAttributes (
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-{
- return RETURN_SUCCESS;
-}
-
diff --git a/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf b/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf
index a7d4fadce..340f4a6a4 100644
--- a/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf
+++ b/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf
@@ -17,13 +17,13 @@
INF_VERSION = 0x00010005
BASE_NAME = BeagleBoardSerialPortLib
FILE_GUID = 97546cbd-c0ff-4c48-ab0b-e4f58862acd3
- MODULE_TYPE = PEIM
+ MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = SerialPortLib
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = ARM IA32 X64 IPF EBC
#
[Sources.common]
diff --git a/Omap44xxPkg/Include/Omap4430/Omap4430.h b/Omap44xxPkg/Include/Omap4430/Omap4430.h
index c127398cb..f59eec4dc 100644
--- a/Omap44xxPkg/Include/Omap4430/Omap4430.h
+++ b/Omap44xxPkg/Include/Omap4430/Omap4430.h
@@ -27,14 +27,5 @@
#include "Omap4430Gpmc.h"
#include "Omap4430Dma.h"
-
-//CONTROL_PBIAS_LITE
-#define CONTROL_PBIAS_LITE 0x4a100600
-#define PBIASVMODE3V BIT21
-#define PBIASLITEPWRDNZ BIT22
-#define PBIASVMODEERR BIT23
-#define PBIASHIZ BIT25
-#define PBIASPWRDNZ BIT26
-
#endif // __OMAP4430_H__
diff --git a/Omap44xxPkg/Include/Omap4430/Omap4430Gpio.h b/Omap44xxPkg/Include/Omap4430/Omap4430Gpio.h
index 035ea2253..dcaa74cce 100644
--- a/Omap44xxPkg/Include/Omap4430/Omap4430Gpio.h
+++ b/Omap44xxPkg/Include/Omap4430/Omap4430Gpio.h
@@ -15,13 +15,14 @@
#ifndef __OMAP4430GPIO_H__
#define __OMAP4430GPIO_H__
-#define GPIO1_BASE (0x48310000)
-#define GPIO2_BASE (0x49050000)
-#define GPIO3_BASE (0x49052000)
-#define GPIO4_BASE (0x49054000)
-#define GPIO5_BASE (0x49056000)
-#define GPIO6_BASE (0x49058000)
-
+#define GPIO1_BASE (0x4A310000)
+#define GPIO2_BASE (0x48055000)
+#define GPIO3_BASE (0x48057000)
+#define GPIO4_BASE (0x48059000)
+#define GPIO5_BASE (0x4805B000)
+#define GPIO6_BASE (0x4805D000)
+
+// TODO: review below defines, offsets changed from omap3 to omap4
#define GPIO_SYSCONFIG (0x0010)
#define GPIO_SYSSTATUS (0x0014)
#define GPIO_IRQSTATUS1 (0x0018)
@@ -30,8 +31,8 @@
#define GPIO_IRQSTATUS2 (0x0028)
#define GPIO_IRQENABLE2 (0x002C)
#define GPIO_CTRL (0x0030)
-#define GPIO_OE (0x0034)
-#define GPIO_DATAIN (0x0038)
+#define GPIO_OE (0x0134)
+#define GPIO_DATAIN (0x0138)
#define GPIO_DATAOUT (0x003C)
#define GPIO_LEVELDETECT0 (0x0040)
#define GPIO_LEVELDETECT1 (0x0044)
@@ -45,8 +46,8 @@
#define GPIO_SETIRQENABLE2 (0x0074)
#define GPIO_CLEARWKUENA (0x0080)
#define GPIO_SETWKUENA (0x0084)
-#define GPIO_CLEARDATAOUT (0x0090)
-#define GPIO_SETDATAOUT (0x0094)
+#define GPIO_CLEARDATAOUT (0x0190)
+#define GPIO_SETDATAOUT (0x0194)
#define GPIO_SYSCONFIG_IDLEMODE_MASK (3UL << 3)
#define GPIO_SYSCONFIG_IDLEMODE_FORCE (0UL << 3)
diff --git a/Omap44xxPkg/Include/Omap4430/Omap4430PadConfiguration.h b/Omap44xxPkg/Include/Omap4430/Omap4430PadConfiguration.h
index 8e6473cfa..449e99662 100644
--- a/Omap44xxPkg/Include/Omap4430/Omap4430PadConfiguration.h
+++ b/Omap44xxPkg/Include/Omap4430/Omap4430PadConfiguration.h
@@ -15,289 +15,320 @@
#ifndef __OMAP4430_PAD_CONFIGURATION_H__
#define __OMAP4430_PAD_CONFIGURATION_H__
-#define SYSTEM_CONTROL_MODULE_BASE 0x48002000
+#define OMAP4430_CONTROL_MODULE_CORE_BASE 0x4A100000
+#define OMAP4430_CONTROL_MODULE_WKUP_BASE 0x4A31E000
-//Pin definition
-#define SDRC_D0 (SYSTEM_CONTROL_MODULE_BASE + 0x030)
-#define SDRC_D1 (SYSTEM_CONTROL_MODULE_BASE + 0x032)
-#define SDRC_D2 (SYSTEM_CONTROL_MODULE_BASE + 0x034)
-#define SDRC_D3 (SYSTEM_CONTROL_MODULE_BASE + 0x036)
-#define SDRC_D4 (SYSTEM_CONTROL_MODULE_BASE + 0x038)
-#define SDRC_D5 (SYSTEM_CONTROL_MODULE_BASE + 0x03A)
-#define SDRC_D6 (SYSTEM_CONTROL_MODULE_BASE + 0x03C)
-#define SDRC_D7 (SYSTEM_CONTROL_MODULE_BASE + 0x03E)
-#define SDRC_D8 (SYSTEM_CONTROL_MODULE_BASE + 0x040)
-#define SDRC_D9 (SYSTEM_CONTROL_MODULE_BASE + 0x042)
-#define SDRC_D10 (SYSTEM_CONTROL_MODULE_BASE + 0x044)
-#define SDRC_D11 (SYSTEM_CONTROL_MODULE_BASE + 0x046)
-#define SDRC_D12 (SYSTEM_CONTROL_MODULE_BASE + 0x048)
-#define SDRC_D13 (SYSTEM_CONTROL_MODULE_BASE + 0x04A)
-#define SDRC_D14 (SYSTEM_CONTROL_MODULE_BASE + 0x04C)
-#define SDRC_D15 (SYSTEM_CONTROL_MODULE_BASE + 0x04E)
-#define SDRC_D16 (SYSTEM_CONTROL_MODULE_BASE + 0x050)
-#define SDRC_D17 (SYSTEM_CONTROL_MODULE_BASE + 0x052)
-#define SDRC_D18 (SYSTEM_CONTROL_MODULE_BASE + 0x054)
-#define SDRC_D19 (SYSTEM_CONTROL_MODULE_BASE + 0x056)
-#define SDRC_D20 (SYSTEM_CONTROL_MODULE_BASE + 0x058)
-#define SDRC_D21 (SYSTEM_CONTROL_MODULE_BASE + 0x05A)
-#define SDRC_D22 (SYSTEM_CONTROL_MODULE_BASE + 0x05C)
-#define SDRC_D23 (SYSTEM_CONTROL_MODULE_BASE + 0x05E)
-#define SDRC_D24 (SYSTEM_CONTROL_MODULE_BASE + 0x060)
-#define SDRC_D25 (SYSTEM_CONTROL_MODULE_BASE + 0x062)
-#define SDRC_D26 (SYSTEM_CONTROL_MODULE_BASE + 0x064)
-#define SDRC_D27 (SYSTEM_CONTROL_MODULE_BASE + 0x066)
-#define SDRC_D28 (SYSTEM_CONTROL_MODULE_BASE + 0x068)
-#define SDRC_D29 (SYSTEM_CONTROL_MODULE_BASE + 0x06A)
-#define SDRC_D30 (SYSTEM_CONTROL_MODULE_BASE + 0x06C)
-#define SDRC_D31 (SYSTEM_CONTROL_MODULE_BASE + 0x06E)
-#define SDRC_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x070)
-#define SDRC_DQS0 (SYSTEM_CONTROL_MODULE_BASE + 0x072)
-#define SDRC_CKE0 (SYSTEM_CONTROL_MODULE_BASE + 0x262)
-#define SDRC_CKE1 (SYSTEM_CONTROL_MODULE_BASE + 0x264)
-#define SDRC_DQS1 (SYSTEM_CONTROL_MODULE_BASE + 0x074)
-#define SDRC_DQS2 (SYSTEM_CONTROL_MODULE_BASE + 0x076)
-#define SDRC_DQS3 (SYSTEM_CONTROL_MODULE_BASE + 0x078)
-#define GPMC_A1 (SYSTEM_CONTROL_MODULE_BASE + 0x07A)
-#define GPMC_A2 (SYSTEM_CONTROL_MODULE_BASE + 0x07C)
-#define GPMC_A3 (SYSTEM_CONTROL_MODULE_BASE + 0x07E)
-#define GPMC_A4 (SYSTEM_CONTROL_MODULE_BASE + 0x080)
-#define GPMC_A5 (SYSTEM_CONTROL_MODULE_BASE + 0x082)
-#define GPMC_A6 (SYSTEM_CONTROL_MODULE_BASE + 0x084)
-#define GPMC_A7 (SYSTEM_CONTROL_MODULE_BASE + 0x086)
-#define GPMC_A8 (SYSTEM_CONTROL_MODULE_BASE + 0x088)
-#define GPMC_A9 (SYSTEM_CONTROL_MODULE_BASE + 0x08A)
-#define GPMC_A10 (SYSTEM_CONTROL_MODULE_BASE + 0x08C)
-#define GPMC_D0 (SYSTEM_CONTROL_MODULE_BASE + 0x08E)
-#define GPMC_D1 (SYSTEM_CONTROL_MODULE_BASE + 0x090)
-#define GPMC_D2 (SYSTEM_CONTROL_MODULE_BASE + 0x092)
-#define GPMC_D3 (SYSTEM_CONTROL_MODULE_BASE + 0x094)
-#define GPMC_D4 (SYSTEM_CONTROL_MODULE_BASE + 0x096)
-#define GPMC_D5 (SYSTEM_CONTROL_MODULE_BASE + 0x098)
-#define GPMC_D6 (SYSTEM_CONTROL_MODULE_BASE + 0x09A)
-#define GPMC_D7 (SYSTEM_CONTROL_MODULE_BASE + 0x09C)
-#define GPMC_D8 (SYSTEM_CONTROL_MODULE_BASE + 0x09E)
-#define GPMC_D9 (SYSTEM_CONTROL_MODULE_BASE + 0x0A0)
-#define GPMC_D10 (SYSTEM_CONTROL_MODULE_BASE + 0x0A2)
-#define GPMC_D11 (SYSTEM_CONTROL_MODULE_BASE + 0x0A4)
-#define GPMC_D12 (SYSTEM_CONTROL_MODULE_BASE + 0x0A6)
-#define GPMC_D13 (SYSTEM_CONTROL_MODULE_BASE + 0x0A8)
-#define GPMC_D14 (SYSTEM_CONTROL_MODULE_BASE + 0x0AA)
-#define GPMC_D15 (SYSTEM_CONTROL_MODULE_BASE + 0x0AC)
-#define GPMC_NCS0 (SYSTEM_CONTROL_MODULE_BASE + 0x0AE)
-#define GPMC_NCS1 (SYSTEM_CONTROL_MODULE_BASE + 0x0B0)
-#define GPMC_NCS2 (SYSTEM_CONTROL_MODULE_BASE + 0x0B2)
-#define GPMC_NCS3 (SYSTEM_CONTROL_MODULE_BASE + 0x0B4)
-#define GPMC_NCS4 (SYSTEM_CONTROL_MODULE_BASE + 0x0B6)
-#define GPMC_NCS5 (SYSTEM_CONTROL_MODULE_BASE + 0x0B8)
-#define GPMC_NCS6 (SYSTEM_CONTROL_MODULE_BASE + 0x0BA)
-#define GPMC_NCS7 (SYSTEM_CONTROL_MODULE_BASE + 0x0BC)
-#define GPMC_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x0BE)
-#define GPMC_NADV_ALE (SYSTEM_CONTROL_MODULE_BASE + 0x0C0)
-#define GPMC_NOE (SYSTEM_CONTROL_MODULE_BASE + 0x0C2)
-#define GPMC_NWE (SYSTEM_CONTROL_MODULE_BASE + 0x0C4)
-#define GPMC_NBE0_CLE (SYSTEM_CONTROL_MODULE_BASE + 0x0C6)
-#define GPMC_NBE1 (SYSTEM_CONTROL_MODULE_BASE + 0x0C8)
-#define GPMC_NWP (SYSTEM_CONTROL_MODULE_BASE + 0x0CA)
-#define GPMC_WAIT0 (SYSTEM_CONTROL_MODULE_BASE + 0x0CC)
-#define GPMC_WAIT1 (SYSTEM_CONTROL_MODULE_BASE + 0x0CE)
-#define GPMC_WAIT2 (SYSTEM_CONTROL_MODULE_BASE + 0x0D0)
-#define GPMC_WAIT3 (SYSTEM_CONTROL_MODULE_BASE + 0x0D2)
-#define DSS_PCLK (SYSTEM_CONTROL_MODULE_BASE + 0x0D4)
-#define DSS_HSYNC (SYSTEM_CONTROL_MODULE_BASE + 0x0D6)
-#define DSS_PSYNC (SYSTEM_CONTROL_MODULE_BASE + 0x0D8)
-#define DSS_ACBIAS (SYSTEM_CONTROL_MODULE_BASE + 0x0DA)
-#define DSS_DATA0 (SYSTEM_CONTROL_MODULE_BASE + 0x0DC)
-#define DSS_DATA1 (SYSTEM_CONTROL_MODULE_BASE + 0x0DE)
-#define DSS_DATA2 (SYSTEM_CONTROL_MODULE_BASE + 0x0E0)
-#define DSS_DATA3 (SYSTEM_CONTROL_MODULE_BASE + 0x0E2)
-#define DSS_DATA4 (SYSTEM_CONTROL_MODULE_BASE + 0x0E4)
-#define DSS_DATA5 (SYSTEM_CONTROL_MODULE_BASE + 0x0E6)
-#define DSS_DATA6 (SYSTEM_CONTROL_MODULE_BASE + 0x0E8)
-#define DSS_DATA7 (SYSTEM_CONTROL_MODULE_BASE + 0x0EA)
-#define DSS_DATA8 (SYSTEM_CONTROL_MODULE_BASE + 0x0EC)
-#define DSS_DATA9 (SYSTEM_CONTROL_MODULE_BASE + 0x0EE)
-#define DSS_DATA10 (SYSTEM_CONTROL_MODULE_BASE + 0x0F0)
-#define DSS_DATA11 (SYSTEM_CONTROL_MODULE_BASE + 0x0F2)
-#define DSS_DATA12 (SYSTEM_CONTROL_MODULE_BASE + 0x0F4)
-#define DSS_DATA13 (SYSTEM_CONTROL_MODULE_BASE + 0x0F6)
-#define DSS_DATA14 (SYSTEM_CONTROL_MODULE_BASE + 0x0F8)
-#define DSS_DATA15 (SYSTEM_CONTROL_MODULE_BASE + 0x0FA)
-#define DSS_DATA16 (SYSTEM_CONTROL_MODULE_BASE + 0x0FC)
-#define DSS_DATA17 (SYSTEM_CONTROL_MODULE_BASE + 0x0FE)
-#define DSS_DATA18 (SYSTEM_CONTROL_MODULE_BASE + 0x100)
-#define DSS_DATA19 (SYSTEM_CONTROL_MODULE_BASE + 0x102)
-#define DSS_DATA20 (SYSTEM_CONTROL_MODULE_BASE + 0x104)
-#define DSS_DATA21 (SYSTEM_CONTROL_MODULE_BASE + 0x106)
-#define DSS_DATA22 (SYSTEM_CONTROL_MODULE_BASE + 0x108)
-#define DSS_DATA23 (SYSTEM_CONTROL_MODULE_BASE + 0x10A)
-#define CAM_HS (SYSTEM_CONTROL_MODULE_BASE + 0x10C)
-#define CAM_VS (SYSTEM_CONTROL_MODULE_BASE + 0x10E)
-#define CAM_XCLKA (SYSTEM_CONTROL_MODULE_BASE + 0x110)
-#define CAM_PCLK (SYSTEM_CONTROL_MODULE_BASE + 0x112)
-#define CAM_FLD (SYSTEM_CONTROL_MODULE_BASE + 0x114)
-#define CAM_D0 (SYSTEM_CONTROL_MODULE_BASE + 0x116)
-#define CAM_D1 (SYSTEM_CONTROL_MODULE_BASE + 0x118)
-#define CAM_D2 (SYSTEM_CONTROL_MODULE_BASE + 0x11A)
-#define CAM_D3 (SYSTEM_CONTROL_MODULE_BASE + 0x11C)
-#define CAM_D4 (SYSTEM_CONTROL_MODULE_BASE + 0x11E)
-#define CAM_D5 (SYSTEM_CONTROL_MODULE_BASE + 0x120)
-#define CAM_D6 (SYSTEM_CONTROL_MODULE_BASE + 0x122)
-#define CAM_D7 (SYSTEM_CONTROL_MODULE_BASE + 0x124)
-#define CAM_D8 (SYSTEM_CONTROL_MODULE_BASE + 0x126)
-#define CAM_D9 (SYSTEM_CONTROL_MODULE_BASE + 0x128)
-#define CAM_D10 (SYSTEM_CONTROL_MODULE_BASE + 0x12A)
-#define CAM_D11 (SYSTEM_CONTROL_MODULE_BASE + 0x12C)
-#define CAM_XCLKB (SYSTEM_CONTROL_MODULE_BASE + 0x12E)
-#define CAM_WEN (SYSTEM_CONTROL_MODULE_BASE + 0x130)
-#define CAM_STROBE (SYSTEM_CONTROL_MODULE_BASE + 0x132)
-#define CSI2_DX0 (SYSTEM_CONTROL_MODULE_BASE + 0x134)
-#define CSI2_DY0 (SYSTEM_CONTROL_MODULE_BASE + 0x136)
-#define CSI2_DX1 (SYSTEM_CONTROL_MODULE_BASE + 0x138)
-#define CSI2_DY1 (SYSTEM_CONTROL_MODULE_BASE + 0x13A)
-#define MCBSP2_FSX (SYSTEM_CONTROL_MODULE_BASE + 0x13C)
-#define MCBSP2_CLKX (SYSTEM_CONTROL_MODULE_BASE + 0x13E)
-#define MCBSP2_DR (SYSTEM_CONTROL_MODULE_BASE + 0x140)
-#define MCBSP2_DX (SYSTEM_CONTROL_MODULE_BASE + 0x142)
-#define MMC1_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x144)
-#define MMC1_CMD (SYSTEM_CONTROL_MODULE_BASE + 0x146)
-#define MMC1_DAT0 (SYSTEM_CONTROL_MODULE_BASE + 0x148)
-#define MMC1_DAT1 (SYSTEM_CONTROL_MODULE_BASE + 0x14A)
-#define MMC1_DAT2 (SYSTEM_CONTROL_MODULE_BASE + 0x14C)
-#define MMC1_DAT3 (SYSTEM_CONTROL_MODULE_BASE + 0x14E)
-#define MMC1_DAT4 (SYSTEM_CONTROL_MODULE_BASE + 0x150)
-#define MMC1_DAT5 (SYSTEM_CONTROL_MODULE_BASE + 0x152)
-#define MMC1_DAT6 (SYSTEM_CONTROL_MODULE_BASE + 0x154)
-#define MMC1_DAT7 (SYSTEM_CONTROL_MODULE_BASE + 0x156)
-#define MMC2_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x158)
-#define MMC2_CMD (SYSTEM_CONTROL_MODULE_BASE + 0x15A)
-#define MMC2_DAT0 (SYSTEM_CONTROL_MODULE_BASE + 0x15C)
-#define MMC2_DAT1 (SYSTEM_CONTROL_MODULE_BASE + 0x15E)
-#define MMC2_DAT2 (SYSTEM_CONTROL_MODULE_BASE + 0x160)
-#define MMC2_DAT3 (SYSTEM_CONTROL_MODULE_BASE + 0x162)
-#define MMC2_DAT4 (SYSTEM_CONTROL_MODULE_BASE + 0x164)
-#define MMC2_DAT5 (SYSTEM_CONTROL_MODULE_BASE + 0x166)
-#define MMC2_DAT6 (SYSTEM_CONTROL_MODULE_BASE + 0x168)
-#define MMC2_DAT7 (SYSTEM_CONTROL_MODULE_BASE + 0x16A)
-#define MCBSP3_DX (SYSTEM_CONTROL_MODULE_BASE + 0x16C)
-#define MCBSP3_DR (SYSTEM_CONTROL_MODULE_BASE + 0x16E)
-#define MCBSP3_CLKX (SYSTEM_CONTROL_MODULE_BASE + 0x170)
-#define MCBSP3_FSX (SYSTEM_CONTROL_MODULE_BASE + 0x172)
-#define UART2_CTS (SYSTEM_CONTROL_MODULE_BASE + 0x174)
-#define UART2_RTS (SYSTEM_CONTROL_MODULE_BASE + 0x176)
-#define UART2_TX (SYSTEM_CONTROL_MODULE_BASE + 0x178)
-#define UART2_RX (SYSTEM_CONTROL_MODULE_BASE + 0x17A)
-#define UART1_TX (SYSTEM_CONTROL_MODULE_BASE + 0x17C)
-#define UART1_RTS (SYSTEM_CONTROL_MODULE_BASE + 0x17E)
-#define UART1_CTS (SYSTEM_CONTROL_MODULE_BASE + 0x180)
-#define UART1_RX (SYSTEM_CONTROL_MODULE_BASE + 0x182)
-#define MCBSP4_CLKX (SYSTEM_CONTROL_MODULE_BASE + 0x184)
-#define MCBSP4_DR (SYSTEM_CONTROL_MODULE_BASE + 0x186)
-#define MCBSP4_DX (SYSTEM_CONTROL_MODULE_BASE + 0x188)
-#define MCBSP4_FSX (SYSTEM_CONTROL_MODULE_BASE + 0x18A)
-#define MCBSP1_CLKR (SYSTEM_CONTROL_MODULE_BASE + 0x18C)
-#define MCBSP1_FSR (SYSTEM_CONTROL_MODULE_BASE + 0x18E)
-#define MCBSP1_DX (SYSTEM_CONTROL_MODULE_BASE + 0x190)
-#define MCBSP1_DR (SYSTEM_CONTROL_MODULE_BASE + 0x192)
-#define MCBSP1_CLKS (SYSTEM_CONTROL_MODULE_BASE + 0x194)
-#define MCBSP1_FSX (SYSTEM_CONTROL_MODULE_BASE + 0x196)
-#define MCBSP1_CLKX (SYSTEM_CONTROL_MODULE_BASE + 0x198)
-#define UART3_CTS_RCTX (SYSTEM_CONTROL_MODULE_BASE + 0x19A)
-#define UART3_RTS_SD (SYSTEM_CONTROL_MODULE_BASE + 0x19C)
-#define UART3_RX_IRRX (SYSTEM_CONTROL_MODULE_BASE + 0x19E)
-#define UART3_TX_IRTX (SYSTEM_CONTROL_MODULE_BASE + 0x1A0)
-#define HSUSB0_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x1A2)
-#define HSUSB0_STP (SYSTEM_CONTROL_MODULE_BASE + 0x1A4)
-#define HSUSB0_DIR (SYSTEM_CONTROL_MODULE_BASE + 0x1A6)
-#define HSUSB0_NXT (SYSTEM_CONTROL_MODULE_BASE + 0x1A8)
-#define HSUSB0_DATA0 (SYSTEM_CONTROL_MODULE_BASE + 0x1AA)
-#define HSUSB0_DATA1 (SYSTEM_CONTROL_MODULE_BASE + 0x1AC)
-#define HSUSB0_DATA2 (SYSTEM_CONTROL_MODULE_BASE + 0x1AE)
-#define HSUSB0_DATA3 (SYSTEM_CONTROL_MODULE_BASE + 0x1B0)
-#define HSUSB0_DATA4 (SYSTEM_CONTROL_MODULE_BASE + 0x1B2)
-#define HSUSB0_DATA5 (SYSTEM_CONTROL_MODULE_BASE + 0x1B4)
-#define HSUSB0_DATA6 (SYSTEM_CONTROL_MODULE_BASE + 0x1B6)
-#define HSUSB0_DATA7 (SYSTEM_CONTROL_MODULE_BASE + 0x1B8)
-#define I2C1_SCL (SYSTEM_CONTROL_MODULE_BASE + 0x1BA)
-#define I2C1_SDA (SYSTEM_CONTROL_MODULE_BASE + 0x1BC)
-#define I2C2_SCL (SYSTEM_CONTROL_MODULE_BASE + 0x1BE)
-#define I2C2_SDA (SYSTEM_CONTROL_MODULE_BASE + 0x1C0)
-#define I2C3_SCL (SYSTEM_CONTROL_MODULE_BASE + 0x1C2)
-#define I2C3_SDA (SYSTEM_CONTROL_MODULE_BASE + 0x1C4)
-#define HDQ_SIO (SYSTEM_CONTROL_MODULE_BASE + 0x1C6)
-#define MCSPI1_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x1C8)
-#define MCSPI1_SIMO (SYSTEM_CONTROL_MODULE_BASE + 0x1CA)
-#define MCSPI1_SOMI (SYSTEM_CONTROL_MODULE_BASE + 0x1CC)
-#define MCSPI1_CS0 (SYSTEM_CONTROL_MODULE_BASE + 0x1CE)
-#define MCSPI1_CS1 (SYSTEM_CONTROL_MODULE_BASE + 0x1D0)
-#define MCSPI1_CS2 (SYSTEM_CONTROL_MODULE_BASE + 0x1D2)
-#define MCSPI1_CS3 (SYSTEM_CONTROL_MODULE_BASE + 0x1D4)
-#define MCSPI2_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x1D6)
-#define MCSPI2_SIMO (SYSTEM_CONTROL_MODULE_BASE + 0x1D8)
-#define MCSPI2_SOMI (SYSTEM_CONTROL_MODULE_BASE + 0x1DA)
-#define MCSPI2_CS0 (SYSTEM_CONTROL_MODULE_BASE + 0x1DC)
-#define MCSPI2_CS1 (SYSTEM_CONTROL_MODULE_BASE + 0x1DE)
-#define SYS_NIRQ (SYSTEM_CONTROL_MODULE_BASE + 0x1E0)
-#define SYS_CLKOUT2 (SYSTEM_CONTROL_MODULE_BASE + 0x1E2)
-#define ETK_CLK (SYSTEM_CONTROL_MODULE_BASE + 0x5D8)
-#define ETK_CTL (SYSTEM_CONTROL_MODULE_BASE + 0x5DA)
-#define ETK_D0 (SYSTEM_CONTROL_MODULE_BASE + 0x5DC)
-#define ETK_D1 (SYSTEM_CONTROL_MODULE_BASE + 0x5DE)
-#define ETK_D2 (SYSTEM_CONTROL_MODULE_BASE + 0x5E0)
-#define ETK_D3 (SYSTEM_CONTROL_MODULE_BASE + 0x5E2)
-#define ETK_D4 (SYSTEM_CONTROL_MODULE_BASE + 0x5E4)
-#define ETK_D5 (SYSTEM_CONTROL_MODULE_BASE + 0x5E6)
-#define ETK_D6 (SYSTEM_CONTROL_MODULE_BASE + 0x5E8)
-#define ETK_D7 (SYSTEM_CONTROL_MODULE_BASE + 0x5EA)
-#define ETK_D8 (SYSTEM_CONTROL_MODULE_BASE + 0x5EC)
-#define ETK_D9 (SYSTEM_CONTROL_MODULE_BASE + 0x5EE)
-#define ETK_D10 (SYSTEM_CONTROL_MODULE_BASE + 0x5F0)
-#define ETK_D11 (SYSTEM_CONTROL_MODULE_BASE + 0x5F2)
-#define ETK_D12 (SYSTEM_CONTROL_MODULE_BASE + 0x5F4)
-#define ETK_D13 (SYSTEM_CONTROL_MODULE_BASE + 0x5F6)
-#define ETK_D14 (SYSTEM_CONTROL_MODULE_BASE + 0x5F8)
-#define ETK_D15 (SYSTEM_CONTROL_MODULE_BASE + 0x5FA)
-#define SYS_BOOT0 (SYSTEM_CONTROL_MODULE_BASE + 0xA0A)
-#define SYS_BOOT1 (SYSTEM_CONTROL_MODULE_BASE + 0xA0C)
-#define SYS_BOOT3 (SYSTEM_CONTROL_MODULE_BASE + 0xA10)
-#define SYS_BOOT4 (SYSTEM_CONTROL_MODULE_BASE + 0xA12)
-#define SYS_BOOT5 (SYSTEM_CONTROL_MODULE_BASE + 0xA14)
-#define SYS_BOOT6 (SYSTEM_CONTROL_MODULE_BASE + 0xA16)
+#define CONTROL_WKUP_PAD1_FREF_CLK4_REQ 0x4A31E05A
-//Mux modes
-#define MUXMODE0 (0x0UL)
-#define MUXMODE1 (0x1UL)
-#define MUXMODE2 (0x2UL)
-#define MUXMODE3 (0x3UL)
-#define MUXMODE4 (0x4UL)
-#define MUXMODE5 (0x5UL)
-#define MUXMODE6 (0x6UL)
-#define MUXMODE7 (0x7UL)
+#ifdef CONFIG_OFF_PADCONF
+#define OFF_PD (1 << 12)
+#define OFF_PU (3 << 12)
+#define OFF_OUT_PTD (0 << 10)
+#define OFF_OUT_PTU (2 << 10)
+#define OFF_IN (1 << 10)
+#define OFF_OUT (0 << 10)
+#define OFF_EN (1 << 9)
+#else
+#define OFF_PD (0 << 12)
+#define OFF_PU (0 << 12)
+#define OFF_OUT_PTD (0 << 10)
+#define OFF_OUT_PTU (0 << 10)
+#define OFF_IN (0 << 10)
+#define OFF_OUT (0 << 10)
+#define OFF_EN (0 << 9)
+#endif
-//Pad configuration register.
-#define PAD_CONFIG_MASK (0xFFFFUL)
-#define MUXMODE_OFFSET 0
-#define MUXMODE_MASK (0x7UL << MUXMODE_OFFSET)
-#define PULL_CONFIG_OFFSET 3
-#define PULL_CONFIG_MASK (0x3UL << PULL_CONFIG_OFFSET)
-#define INPUTENABLE_OFFSET 8
-#define INPUTENABLE_MASK (0x1UL << INPUTENABLE_OFFSET)
-#define OFFMODE_VALUE_OFFSET 9
-#define OFFMODE_VALUE_MASK (0x1FUL << OFFMODE_VALUE_OFFSET)
-#define WAKEUP_OFFSET 14
-#define WAKEUP_MASK (0x2UL << WAKEUP_OFFSET)
+#define IEN (1 << 8)
+#define IDIS (0 << 8)
+#define PTU (3 << 3)
+#define PTD (1 << 3)
+#define EN (1 << 3)
+#define DIS (0 << 3)
-#define PULL_DOWN_SELECTED ((0x0UL << 1) | BIT0)
-#define PULL_UP_SELECTED (BIT1 | BIT0)
-#define PULL_DISABLED (0x0UL << 0)
+#define M0 0
+#define M1 1
+#define M2 2
+#define M3 3
+#define M4 4
+#define M5 5
+#define M6 6
+#define M7 7
-#define OUTPUT (0x0UL) //Pin is configured in output only mode.
-#define INPUT (0x1UL) //Pin is configured in bi-directional mode.
+#define SAFE_MODE M7
+
+#ifdef CONFIG_OFF_PADCONF
+#define OFF_IN_PD (OFF_PD | OFF_IN | OFF_EN)
+#define OFF_IN_PU (OFF_PU | OFF_IN | OFF_EN)
+#define OFF_OUT_PD (OFF_OUT_PTD | OFF_OUT | OFF_EN)
+#define OFF_OUT_PU (OFF_OUT_PTU | OFF_OUT | OFF_EN)
+#else
+#define OFF_IN_PD 0
+#define OFF_IN_PU 0
+#define OFF_OUT_PD 0
+#define OFF_OUT_PU 0
+#endif
+
+#define CORE_REVISION 0x0000
+#define CORE_HWINFO 0x0004
+#define CORE_SYSCONFIG 0x0010
+#define GPMC_AD0 0x0040
+#define GPMC_AD1 0x0042
+#define GPMC_AD2 0x0044
+#define GPMC_AD3 0x0046
+#define GPMC_AD4 0x0048
+#define GPMC_AD5 0x004A
+#define GPMC_AD6 0x004C
+#define GPMC_AD7 0x004E
+#define GPMC_AD8 0x0050
+#define GPMC_AD9 0x0052
+#define GPMC_AD10 0x0054
+#define GPMC_AD11 0x0056
+#define GPMC_AD12 0x0058
+#define GPMC_AD13 0x005A
+#define GPMC_AD14 0x005C
+#define GPMC_AD15 0x005E
+#define GPMC_A16 0x0060
+#define GPMC_A17 0x0062
+#define GPMC_A18 0x0064
+#define GPMC_A19 0x0066
+#define GPMC_A20 0x0068
+#define GPMC_A21 0x006A
+#define GPMC_A22 0x006C
+#define GPMC_A23 0x006E
+#define GPMC_A24 0x0070
+#define GPMC_A25 0x0072
+#define GPMC_NCS0 0x0074
+#define GPMC_NCS1 0x0076
+#define GPMC_NCS2 0x0078
+#define GPMC_NCS3 0x007A
+#define GPMC_NWP 0x007C
+#define GPMC_CLK 0x007E
+#define GPMC_NADV_ALE 0x0080
+#define GPMC_NOE 0x0082
+#define GPMC_NWE 0x0084
+#define GPMC_NBE0_CLE 0x0086
+#define GPMC_NBE1 0x0088
+#define GPMC_WAIT0 0x008A
+#define GPMC_WAIT1 0x008C
+#define C2C_DATA11 0x008E
+#define C2C_DATA12 0x0090
+#define C2C_DATA13 0x0092
+#define C2C_DATA14 0x0094
+#define C2C_DATA15 0x0096
+#define HDMI_HPD 0x0098
+#define HDMI_CEC 0x009A
+#define HDMI_DDC_SCL 0x009C
+#define HDMI_DDC_SDA 0x009E
+#define CSI21_DX0 0x00A0
+#define CSI21_DY0 0x00A2
+#define CSI21_DX1 0x00A4
+#define CSI21_DY1 0x00A6
+#define CSI21_DX2 0x00A8
+#define CSI21_DY2 0x00AA
+#define CSI21_DX3 0x00AC
+#define CSI21_DY3 0x00AE
+#define CSI21_DX4 0x00B0
+#define CSI21_DY4 0x00B2
+#define CSI22_DX0 0x00B4
+#define CSI22_DY0 0x00B6
+#define CSI22_DX1 0x00B8
+#define CSI22_DY1 0x00BA
+#define CAM_SHUTTER 0x00BC
+#define CAM_STROBE 0x00BE
+#define CAM_GLOBALRESET 0x00C0
+#define USBB1_ULPITLL_CLK 0x00C2
+#define USBB1_ULPITLL_STP 0x00C4
+#define USBB1_ULPITLL_DIR 0x00C6
+#define USBB1_ULPITLL_NXT 0x00C8
+#define USBB1_ULPITLL_DAT0 0x00CA
+#define USBB1_ULPITLL_DAT1 0x00CC
+#define USBB1_ULPITLL_DAT2 0x00CE
+#define USBB1_ULPITLL_DAT3 0x00D0
+#define USBB1_ULPITLL_DAT4 0x00D2
+#define USBB1_ULPITLL_DAT5 0x00D4
+#define USBB1_ULPITLL_DAT6 0x00D6
+#define USBB1_ULPITLL_DAT7 0x00D8
+#define USBB1_HSIC_DATA 0x00DA
+#define USBB1_HSIC_STROBE 0x00DC
+#define USBC1_ICUSB_DP 0x00DE
+#define USBC1_ICUSB_DM 0x00E0
+#define SDMMC1_CLK 0x00E2
+#define SDMMC1_CMD 0x00E4
+#define SDMMC1_DAT0 0x00E6
+#define SDMMC1_DAT1 0x00E8
+#define SDMMC1_DAT2 0x00EA
+#define SDMMC1_DAT3 0x00EC
+#define SDMMC1_DAT4 0x00EE
+#define SDMMC1_DAT5 0x00F0
+#define SDMMC1_DAT6 0x00F2
+#define SDMMC1_DAT7 0x00F4
+#define ABE_MCBSP2_CLKX 0x00F6
+#define ABE_MCBSP2_DR 0x00F8
+#define ABE_MCBSP2_DX 0x00FA
+#define ABE_MCBSP2_FSX 0x00FC
+#define ABE_MCBSP1_CLKX 0x00FE
+#define ABE_MCBSP1_DR 0x0100
+#define ABE_MCBSP1_DX 0x0102
+#define ABE_MCBSP1_FSX 0x0104
+#define ABE_PDM_UL_DATA 0x0106
+#define ABE_PDM_DL_DATA 0x0108
+#define ABE_PDM_FRAME 0x010A
+#define ABE_PDM_LB_CLK 0x010C
+#define ABE_CLKS 0x010E
+#define ABE_DMIC_CLK1 0x0110
+#define ABE_DMIC_DIN1 0x0112
+#define ABE_DMIC_DIN2 0x0114
+#define ABE_DMIC_DIN3 0x0116
+#define UART2_CTS 0x0118
+#define UART2_RTS 0x011A
+#define UART2_RX 0x011C
+#define UART2_TX 0x011E
+#define HDQ_SIO 0x0120
+#define I2C1_SCL 0x0122
+#define I2C1_SDA 0x0124
+#define I2C2_SCL 0x0126
+#define I2C2_SDA 0x0128
+#define I2C3_SCL 0x012A
+#define I2C3_SDA 0x012C
+#define I2C4_SCL 0x012E
+#define I2C4_SDA 0x0130
+#define MCSPI1_CLK 0x0132
+#define MCSPI1_SOMI 0x0134
+#define MCSPI1_SIMO 0x0136
+#define MCSPI1_CS0 0x0138
+#define MCSPI1_CS1 0x013A
+#define MCSPI1_CS2 0x013C
+#define MCSPI1_CS3 0x013E
+#define UART3_CTS_RCTX 0x0140
+#define UART3_RTS_SD 0x0142
+#define UART3_RX_IRRX 0x0144
+#define UART3_TX_IRTX 0x0146
+#define SDMMC5_CLK 0x0148
+#define SDMMC5_CMD 0x014A
+#define SDMMC5_DAT0 0x014C
+#define SDMMC5_DAT1 0x014E
+#define SDMMC5_DAT2 0x0150
+#define SDMMC5_DAT3 0x0152
+#define MCSPI4_CLK 0x0154
+#define MCSPI4_SIMO 0x0156
+#define MCSPI4_SOMI 0x0158
+#define MCSPI4_CS0 0x015A
+#define UART4_RX 0x015C
+#define UART4_TX 0x015E
+#define USBB2_ULPITLL_CLK 0x0160
+#define USBB2_ULPITLL_STP 0x0162
+#define USBB2_ULPITLL_DIR 0x0164
+#define USBB2_ULPITLL_NXT 0x0166
+#define USBB2_ULPITLL_DAT0 0x0168
+#define USBB2_ULPITLL_DAT1 0x016A
+#define USBB2_ULPITLL_DAT2 0x016C
+#define USBB2_ULPITLL_DAT3 0x016E
+#define USBB2_ULPITLL_DAT4 0x0170
+#define USBB2_ULPITLL_DAT5 0x0172
+#define USBB2_ULPITLL_DAT6 0x0174
+#define USBB2_ULPITLL_DAT7 0x0176
+#define USBB2_HSIC_DATA 0x0178
+#define USBB2_HSIC_STROBE 0x017A
+#define UNIPRO_TX0 0x017C
+#define UNIPRO_TY0 0x017E
+#define UNIPRO_TX1 0x0180
+#define UNIPRO_TY1 0x0182
+#define UNIPRO_TX2 0x0184
+#define UNIPRO_TY2 0x0186
+#define UNIPRO_RX0 0x0188
+#define UNIPRO_RY0 0x018A
+#define UNIPRO_RX1 0x018C
+#define UNIPRO_RY1 0x018E
+#define UNIPRO_RX2 0x0190
+#define UNIPRO_RY2 0x0192
+#define USBA0_OTG_CE 0x0194
+#define USBA0_OTG_DP 0x0196
+#define USBA0_OTG_DM 0x0198
+#define FREF_CLK1_OUT 0x019A
+#define FREF_CLK2_OUT 0x019C
+#define SYS_NIRQ1 0x019E
+#define SYS_NIRQ2 0x01A0
+#define SYS_BOOT0 0x01A2
+#define SYS_BOOT1 0x01A4
+#define SYS_BOOT2 0x01A6
+#define SYS_BOOT3 0x01A8
+#define SYS_BOOT4 0x01AA
+#define SYS_BOOT5 0x01AC
+#define DPM_EMU0 0x01AE
+#define DPM_EMU1 0x01B0
+#define DPM_EMU2 0x01B2
+#define DPM_EMU3 0x01B4
+#define DPM_EMU4 0x01B6
+#define DPM_EMU5 0x01B8
+#define DPM_EMU6 0x01BA
+#define DPM_EMU7 0x01BC
+#define DPM_EMU8 0x01BE
+#define DPM_EMU9 0x01C0
+#define DPM_EMU10 0x01C2
+#define DPM_EMU11 0x01C4
+#define DPM_EMU12 0x01C6
+#define DPM_EMU13 0x01C8
+#define DPM_EMU14 0x01CA
+#define DPM_EMU15 0x01CC
+#define DPM_EMU16 0x01CE
+#define DPM_EMU17 0x01D0
+#define DPM_EMU18 0x01D2
+#define DPM_EMU19 0x01D4
+#define WAKEUPEVENT_0 0x01D8
+#define WAKEUPEVENT_1 0x01DC
+#define WAKEUPEVENT_2 0x01E0
+#define WAKEUPEVENT_3 0x01E4
+#define WAKEUPEVENT_4 0x01E8
+#define WAKEUPEVENT_5 0x01EC
+#define WAKEUPEVENT_6 0x01F0
+
+#define WKUP_REVISION 0x0000
+#define WKUP_HWINFO 0x0004
+#define WKUP_SYSCONFIG 0x0010
+#define PAD0_SIM_IO 0x0040
+#define PAD1_SIM_CLK 0x0042
+#define PAD0_SIM_RESET 0x0044
+#define PAD1_SIM_CD 0x0046
+#define PAD0_SIM_PWRCTRL 0x0048
+#define PAD1_SR_SCL 0x004A
+#define PAD0_SR_SDA 0x004C
+#define PAD1_FREF_XTAL_IN 0x004E
+#define PAD0_FREF_SLICER_IN 0x0050
+#define PAD1_FREF_CLK_IOREQ 0x0052
+#define PAD0_FREF_CLK0_OUT 0x0054
+#define PAD1_FREF_CLK3_REQ 0x0056
+#define PAD0_FREF_CLK3_OUT 0x0058
+#define PAD1_FREF_CLK4_REQ 0x005A
+#define PAD0_FREF_CLK4_OUT 0x005C
+#define PAD1_SYS_32K 0x005E
+#define PAD0_SYS_NRESPWRON 0x0060
+#define PAD1_SYS_NRESWARM 0x0062
+#define PAD0_SYS_PWR_REQ 0x0064
+#define PAD1_SYS_PWRON_RESET 0x0066
+#define PAD0_SYS_BOOT6 0x0068
+#define PAD1_SYS_BOOT7 0x006A
+#define PAD0_JTAG_NTRST 0x006C
+#define PAD1_JTAG_TCK 0x006D
+#define PAD0_JTAG_RTCK 0x0070
+#define PAD1_JTAG_TMS_TMSC 0x0072
+#define PAD0_JTAG_TDI 0x0074
+#define PAD1_JTAG_TDO 0x0076
+#define PADCONF_WAKEUPEVENT_0 0x007C
+#define CONTROL_SMART1NOPMIO_PADCONF_0 0x05A0
+#define CONTROL_SMART1NOPMIO_PADCONF_1 0x05A4
+#define PADCONF_MODE 0x05A8
+#define CONTROL_XTAL_OSCILLATOR 0x05AC
+#define CONTROL_CONTROL_I2C_2 0x0604
+#define CONTROL_CONTROL_JTAG 0x0608
+#define CONTROL_CONTROL_SYS 0x060C
+#define CONTROL_SPARE_RW 0x0614
+#define CONTROL_SPARE_R 0x0618
+#define CONTROL_SPARE_R_C0 0x061C
typedef struct {
- UINTN Pin;
- UINTN MuxMode;
- UINTN PullConfig;
- UINTN InputEnable;
+ UINT16 Off;
+ UINT16 Val;
+
} PAD_CONFIGURATION;
#endif //__OMAP4430_PAD_CONFIGURATION_H__
diff --git a/Omap44xxPkg/Include/Omap4430/Omap4430Prcm.h b/Omap44xxPkg/Include/Omap4430/Omap4430Prcm.h
index 1f4760581..40b6e1f36 100644
--- a/Omap44xxPkg/Include/Omap4430/Omap4430Prcm.h
+++ b/Omap44xxPkg/Include/Omap4430/Omap4430Prcm.h
@@ -15,151 +15,134 @@
#ifndef __OMAP4430PRCM_H__
#define __OMAP4430PRCM_H__
-#define CM_FCLKEN1_CORE (0x48004A00)
-#define CM_FCLKEN3_CORE (0x48004A08)
-#define CM_ICLKEN1_CORE (0x48004A10)
-#define CM_ICLKEN3_CORE (0x48004A18)
-#define CM_CLKEN2_PLL (0x48004D04)
-#define CM_CLKSEL4_PLL (0x48004D4C)
-#define CM_CLKSEL5_PLL (0x48004D50)
-#define CM_FCLKEN_USBHOST (0x48005400)
-#define CM_ICLKEN_USBHOST (0x48005410)
-#define CM_CLKSTST_USBHOST (0x4800544c)
+// CONTROL_CORE
-//Wakeup clock defintion
-#define CM_FCLKEN_WKUP (0x48004C00)
-#define CM_ICLKEN_WKUP (0x48004C10)
+#define CONTROL_CORE_U_BASE (0x4A002000)
+#define CONTROL_CORE_ID_CODE (CONTROL_CORE_U_BASE+0x204)
+#define CONTROL_CORE_LDOSRAM_IVA_VOLTAGE_CTRL (CONTROL_CORE_U_BASE+0x320)
+#define CONTROL_CORE_LDOSRAM_MPU_VOLTAGE_CTRL (CONTROL_CORE_U_BASE+0x324)
+#define CONTROL_CORE_LDOSRAM_CORE_VOLTAGE_CTRL (CONTROL_CORE_U_BASE+0x328)
-//Peripheral clock definition
-#define CM_FCLKEN_PER (0x48005000)
-#define CM_ICLKEN_PER (0x48005010)
-#define CM_CLKSEL_PER (0x48005040)
+#define CONTROL_CORE_LDOSRAM_VOLTAGE_CTRL_VAL (0x0401040F)
-//Reset management definition
-#define PRM_RSTCTRL (0x48307250)
-#define PRM_RSTST (0x48307258)
+#define CONTROL_PBIAS_LITE (0x4a100600)
+#define PBIASVMODE3V (BIT21)
+#define PBIASLITEPWRDNZ (BIT22)
+#define PBIASVMODEERR (BIT23)
+#define PBIASHIZ (BIT25)
+#define PBIASPWRDNZ (BIT26)
-//CORE clock
-#define CM_FCLKEN1_CORE_EN_I2C1_MASK BIT15
-#define CM_FCLKEN1_CORE_EN_I2C1_DISABLE (0UL << 15)
-#define CM_FCLKEN1_CORE_EN_I2C1_ENABLE BIT15
+// PRM
-#define CM_ICLKEN1_CORE_EN_I2C1_MASK BIT15
-#define CM_ICLKEN1_CORE_EN_I2C1_DISABLE (0UL << 15)
-#define CM_ICLKEN1_CORE_EN_I2C1_ENABLE BIT15
+#define PRM_U_BASE (0x4A307B00)
-#define CM_FCLKEN1_CORE_EN_MMC1_MASK BIT24
-#define CM_FCLKEN1_CORE_EN_MMC1_DISABLE (0UL << 24)
-#define CM_FCLKEN1_CORE_EN_MMC1_ENABLE BIT24
+#define PRM_RSTCTRL (PRM_U_BASE+0x0)
+#define PRM_RSTST (PRM_U_BASE+0x4)
-#define CM_FCLKEN3_CORE_EN_USBTLL_MASK BIT2
-#define CM_FCLKEN3_CORE_EN_USBTLL_DISABLE (0UL << 2)
-#define CM_FCLKEN3_CORE_EN_USBTLL_ENABLE BIT2
+#define PRM_RSTST_GLOBAL_COLD_RST_MASK (0x1)
-#define CM_ICLKEN1_CORE_EN_MMC1_MASK BIT24
-#define CM_ICLKEN1_CORE_EN_MMC1_DISABLE (0UL << 24)
-#define CM_ICLKEN1_CORE_EN_MMC1_ENABLE BIT24
+#define PRM_RSTCTRL_RST_GLOBAL_COLD_SW_VAL (0x2)
-#define CM_ICLKEN3_CORE_EN_USBTLL_MASK BIT2
-#define CM_ICLKEN3_CORE_EN_USBTLL_DISABLE (0UL << 2)
-#define CM_ICLKEN3_CORE_EN_USBTLL_ENABLE BIT2
+#define PRM_VC_VAL_BYPASS (PRM_U_BASE+0xA0)
+#define PRM_VC_VAL_BYPASS_REGADDR_POS (8)
+#define PRM_VC_VAL_BYPASS_DATA_POS (16)
-#define CM_CLKEN_FREQSEL_075_100 (0x03UL << 4)
-#define CM_CLKEN_ENABLE (7UL << 0)
+#define PRM_VC_CFG_I2C_MODE (PRM_U_BASE+0xA8)
+#define PRM_VC_CFG_I2C_CLK (PRM_U_BASE+0xAC)
-#define CM_CLKSEL_PLL_MULT(x) (((x) & 0x07FF) << 8)
-#define CM_CLKSEL_PLL_DIV(x) ((((x) - 1) & 0x7F) << 0)
-
-#define CM_CLKSEL_DIV_120M(x) (((x) & 0x1F) << 0)
+#define VC_CFG_I2C_MODE_VAL (0x0)
+#define VC_CFG_I2C_CLK_VAL (0x167FFB)
-#define CM_FCLKEN_USBHOST_EN_USBHOST2_MASK BIT1
-#define CM_FCLKEN_USBHOST_EN_USBHOST2_DISABLE (0UL << 1)
-#define CM_FCLKEN_USBHOST_EN_USBHOST2_ENABLE BIT1
+#define PMIC_SMPS_ID0_SLAVE_ADDR (0x12)
+#define PMIC_VCORE3_CFG_FORCE_REGADDR (0x61)
+#define PMIC_VCORE1_CFG_FORCE_REGADDR (0x55)
+#define PMIC_VCORE2_CFG_FORCE_REGADDR (0x5B)
+#define PMIC_VCORE3_CFG_FORCE_VSEL (0x28)
+#define PMIC_VCORE1_CFG_FORCE_VSEL_VDD_MPU_4430 (0x32)
+#define PMIC_VCORE1_CFG_FORCE_VSEL_VDD_CORE_4460 (0x28)
+#define PMIC_VCORE2_CFG_FORCE_VSEL (0x28)
-#define CM_FCLKEN_USBHOST_EN_USBHOST1_MASK BIT0
-#define CM_FCLKEN_USBHOST_EN_USBHOST1_DISABLE (0UL << 0)
-#define CM_FCLKEN_USBHOST_EN_USBHOST1_ENABLE BIT0
+#define TPS62361_SLAVE_ADDR (0x60)
+#define TPS62361_SET1_REG_ADDR (0x01)
+#define TPS62361_SET1_REG_VAL (0x46)
-#define CM_ICLKEN_USBHOST_EN_USBHOST_MASK BIT0
-#define CM_ICLKEN_USBHOST_EN_USBHOST_DISABLE (0UL << 0)
-#define CM_ICLKEN_USBHOST_EN_USBHOST_ENABLE BIT0
+// CKGEN_CM1
-//Wakeup functional clock
-#define CM_FCLKEN_WKUP_EN_GPIO1_DISABLE (0UL << 3)
-#define CM_FCLKEN_WKUP_EN_GPIO1_ENABLE BIT3
+#define CKGEN_CM1_U_BASE (0x4A004100)
-#define CM_FCLKEN_WKUP_EN_WDT2_DISABLE (0UL << 5)
-#define CM_FCLKEN_WKUP_EN_WDT2_ENABLE BIT5
+#define CKGEN_CM1_CM_DIV_M3_DPLL_CORE (CKGEN_CM1_U_BASE+0x34)
+#define CKGEN_CM1_CM_DIV_M4_DPLL_CORE (CKGEN_CM1_U_BASE+0x38)
+#define CKGEN_CM1_CM_DIV_M5_DPLL_CORE (CKGEN_CM1_U_BASE+0x3C)
+#define CKGEN_CM1_CM_DIV_M6_DPLL_CORE (CKGEN_CM1_U_BASE+0x40)
+#define CKGEN_CM1_CM_DIV_M7_DPLL_CORE (CKGEN_CM1_U_BASE+0x44)
-//Wakeup interface clock
-#define CM_ICLKEN_WKUP_EN_GPIO1_DISABLE (0UL << 3)
-#define CM_ICLKEN_WKUP_EN_GPIO1_ENABLE BIT3
+#define CKGEN_CM1_CM_DIV_M2_DPLL_MPU (CKGEN_CM1_U_BASE+0x70)
-#define CM_ICLKEN_WKUP_EN_WDT2_DISABLE (0UL << 5)
-#define CM_ICLKEN_WKUP_EN_WDT2_ENABLE BIT5
+#define CKGEN_CM1_CM_CLKMODE_DPLL_IVA (CKGEN_CM1_U_BASE+0xA0)
+#define CKGEN_CM1_CM_CLKSEL_DPLL_IVA (CKGEN_CM1_U_BASE+0xAC)
+#define CKGEN_CM1_CM_DIV_M4_DPLL_IVA (CKGEN_CM1_U_BASE+0xB8)
+#define CKGEN_CM1_CM_DIV_M5_DPLL_IVA (CKGEN_CM1_U_BASE+0xBC)
+#define CKGEN_CM1_CM_BYPCLK_DPLL_IVA (CKGEN_CM1_U_BASE+0xDC)
-//Peripheral functional clock
-#define CM_FCLKEN_PER_EN_GPT3_DISABLE (0UL << 4)
-#define CM_FCLKEN_PER_EN_GPT3_ENABLE BIT4
+#define CKGEN_CM1_CM_CLKSEL_DPLL_IVA_CLKSEL_VAL (0x19c10)
+#define CKGEN_CM1_CM_CLKSEL_DPLL_IVA_M4_VAL (4)
+#define CKGEN_CM1_CM_CLKSEL_DPLL_IVA_M5_VAL (7)
+#define CKGEN_CM1_CM_CLKSEL_DPLL_IVA_BYCLK_VAL (1)
+#define CKGEN_CM1_CM_CLKSEL_DPLL_IVA_CLKMODE_VAL (7)
-#define CM_FCLKEN_PER_EN_GPT4_DISABLE (0UL << 5)
-#define CM_FCLKEN_PER_EN_GPT4_ENABLE BIT5
+#define CKGEN_CM1_CM_CLKMODE_DPLL_ABE (CKGEN_CM1_U_BASE+0xE0)
+#define CKGEN_CM1_CM_CLKSEL_DPLL_ABE (CKGEN_CM1_U_BASE+0xEC)
+#define CKGEN_CM1_CM_DIV_M2_DPLL_ABE (CKGEN_CM1_U_BASE+0xF0)
+#define CKGEN_CM1_CM_DIV_M3_DPLL_ABE (CKGEN_CM1_U_BASE+0xF4)
-#define CM_FCLKEN_PER_EN_UART3_DISABLE (0UL << 11)
-#define CM_FCLKEN_PER_EN_UART3_ENABLE BIT11
+#define CKGEN_CM1_CM_CLKSEL_DPLL_ABE_VAL (0x82ee00)
+#define CKGEN_CM1_CM_DIV_M2_DPLL_ABE_VAL (1)
+#define CKGEN_CM1_CM_DIV_M3_DPLL_ABE_VAL (1)
+#define CKGEN_CM1_CM_CLKMODE_DPLL_ABE_VAL (0xf27)
-#define CM_FCLKEN_PER_EN_GPIO2_DISABLE (0UL << 13)
-#define CM_FCLKEN_PER_EN_GPIO2_ENABLE BIT13
+#define CKGEN_CM1_CM_SHADOW_FREQ_CONFIG1 (CKGEN_CM1_U_BASE+0x160)
+#define CM_SHADOW_FREQ_CONFIG1_DPLL_CORE_M2_DIV_OPP100 (1<<11)
+#define CM_SHADOW_FREQ_CONFIG1_DPLL_CORE_DPLL_EN_LOCK (7<<8)
+#define CM_SHADOW_FREQ_CONFIG1_DLL_RESET_RST (1<<3)
+#define CM_SHADOW_FREQ_CONFIG1_FREQ_UPDATE_START (1<<0)
-#define CM_FCLKEN_PER_EN_GPIO3_DISABLE (0UL << 14)
-#define CM_FCLKEN_PER_EN_GPIO3_ENABLE BIT14
+#define CM_DIV_M2_DPLL_MPU_OPP100_VAL (1)
+#define CM_DIV_M3_DPLL_CORE_OPP100_VAL (5)
+#define CM_DIV_M4_DPLL_CORE_OPP100_VAL (8)
+#define CM_DIV_M5_DPLL_CORE_OPP100_VAL (4)
+#define CM_DIV_M6_DPLL_CORE_OPP100_VAL (6)
+#define CM_DIV_M7_DPLL_CORE_OPP100_VAL (5)
-#define CM_FCLKEN_PER_EN_GPIO4_DISABLE (0UL << 15)
-#define CM_FCLKEN_PER_EN_GPIO4_ENABLE BIT15
+// CKGEN_CM2
-#define CM_FCLKEN_PER_EN_GPIO5_DISABLE (0UL << 16)
-#define CM_FCLKEN_PER_EN_GPIO5_ENABLE BIT16
+#define CKGEN_CM2_U_BASE (0x4A008100)
-#define CM_FCLKEN_PER_EN_GPIO6_DISABLE (0UL << 17)
-#define CM_FCLKEN_PER_EN_GPIO6_ENABLE BIT17
+#define CKGEN_CM2_CM_CLKMODE_DPLL_USB (CKGEN_CM2_U_BASE+0x80)
+#define CKGEN_CM2_CM_CLKSEL_DPLL_USB (CKGEN_CM2_U_BASE+0x8C)
+#define CKGEN_CM2_CM_DIV_M2_DPLL_USB (CKGEN_CM2_U_BASE+0x90)
-//Peripheral interface clock
-#define CM_ICLKEN_PER_EN_GPT3_DISABLE (0UL << 4)
-#define CM_ICLKEN_PER_EN_GPT3_ENABLE BIT4
+#define CKGEN_CM2_CM_CLKSEL_DPLL_USB_VAL (0x25817)
+#define CKGEN_CM2_CM_DIV_M2_DPLL_USB_VAL (0x282)
+#define CKGEN_CM2_CM_CLKMODE_DPLL_USB_VAL (0x7)
-#define CM_ICLKEN_PER_EN_GPT4_DISABLE (0UL << 5)
-#define CM_ICLKEN_PER_EN_GPT4_ENABLE BIT5
+// RESTORE_CM1
-#define CM_ICLKEN_PER_EN_UART3_DISABLE (0UL << 11)
-#define CM_ICLKEN_PER_EN_UART3_ENABLE BIT11
+#define RESTORE_CM1_U_BASE (0x4A004E00)
-#define CM_ICLKEN_PER_EN_GPIO2_DISABLE (0UL << 13)
-#define CM_ICLKEN_PER_EN_GPIO2_ENABLE BIT13
+#define RESTORE_CM1_CM_DIV_M2_DPLL_CORE_RESTORE (RESTORE_CM1_U_BASE+0x4)
+#define RESTORE_CM1_CM_DIV_M3_DPLL_CORE_RESTORE (RESTORE_CM1_U_BASE+0x8)
+#define RESTORE_CM1_CM_DIV_M5_DPLL_CORE_RESTORE (RESTORE_CM1_U_BASE+0x10)
+#define RESTORE_CM1_CM_DIV_M6_DPLL_CORE_RESTORE (RESTORE_CM1_U_BASE+0x14)
+#define RESTORE_CM1_CM_DIV_M7_DPLL_CORE_RESTORE (RESTORE_CM1_U_BASE+0x18)
+#define RESTORE_CM1_CM_CLKSEL_DPLL_CORE_RESTORE (RESTORE_CM1_U_BASE+0x1C)
+#define RESTORE_CM1_CM_SHADOW_FREQ_CONFIG1_RESTORE (RESTORE_CM1_U_BASE+0x30)
-#define CM_ICLKEN_PER_EN_GPIO3_DISABLE (0UL << 14)
-#define CM_ICLKEN_PER_EN_GPIO3_ENABLE BIT14
+// SCRM
-#define CM_ICLKEN_PER_EN_GPIO4_DISABLE (0UL << 15)
-#define CM_ICLKEN_PER_EN_GPIO4_ENABLE BIT15
+#define SCRM_U_BASE (0x4A30A000)
-#define CM_ICLKEN_PER_EN_GPIO5_DISABLE (0UL << 16)
-#define CM_ICLKEN_PER_EN_GPIO5_ENABLE BIT16
-
-#define CM_ICLKEN_PER_EN_GPIO6_DISABLE (0UL << 17)
-#define CM_ICLKEN_PER_EN_GPIO6_ENABLE BIT17
-
-//Timer source clock selection
-#define CM_CLKSEL_PER_CLKSEL_GPT3_32K (0UL << 1)
-#define CM_CLKSEL_PER_CLKSEL_GPT3_SYS BIT1
-
-#define CM_CLKSEL_PER_CLKSEL_GPT4_32K (0UL << 2)
-#define CM_CLKSEL_PER_CLKSEL_GPT4_SYS BIT2
-
-//Reset management (Global and Cold reset)
-#define RST_GS BIT1
-#define RST_DPLL3 BIT2
-#define GLOBAL_SW_RST BIT1
-#define GLOBAL_COLD_RST (0x0UL << 0)
+#define SCRM_AUXCLK3 (SCRM_U_BASE+0x31C)
+#define SCRM_AUXCLK3_VAL (0x00010100)
#endif // __OMAP4430PRCM_H__
diff --git a/Omap44xxPkg/Include/Omap4430/Omap4430Usb.h b/Omap44xxPkg/Include/Omap4430/Omap4430Usb.h
index c70f63f33..22fe47c83 100644
--- a/Omap44xxPkg/Include/Omap4430/Omap4430Usb.h
+++ b/Omap44xxPkg/Include/Omap4430/Omap4430Usb.h
@@ -15,22 +15,18 @@
#ifndef __OMAP4430USB_H__
#define __OMAP4430USB_H__
-#define USB_BASE (0x48060000)
+#define USB_BASE (0x4A060000)
#define UHH_SYSCONFIG (USB_BASE + 0x4010)
#define UHH_HOSTCONFIG (USB_BASE + 0x4040)
#define UHH_SYSSTATUS (USB_BASE + 0x4014)
-#define USB_EHCI_HCCAPBASE (USB_BASE + 0x4800)
+#define USB_EHCI_HCCAPBASE (USB_BASE + 0x4C00)
-#define UHH_SYSCONFIG_MIDLEMODE_NO_STANDBY BIT12
-#define UHH_SYSCONFIG_CLOCKACTIVITY_ON BIT8
-#define UHH_SYSCONFIG_SIDLEMODE_NO_STANDBY BIT3
-#define UHH_SYSCONFIG_ENAWAKEUP_ENABLE BIT2
-#define UHH_SYSCONFIG_SOFTRESET BIT1
-#define UHH_SYSCONFIG_AUTOIDLE_ALWAYS_RUN (0UL << 0)
+#define UHH_SYSCONFIG_STANDBYMODE_NO_STANDBY BIT4
+#define UHH_SYSCONFIG_IDLEMODE_NO_IDLE BIT2
+#define UHH_SYSCONFIG_SOFTRESET BIT0
-#define UHH_HOSTCONFIG_P3_CONNECT_STATUS_DISCONNECT (0UL << 10)
#define UHH_HOSTCONFIG_P2_CONNECT_STATUS_DISCONNECT (0UL << 9)
#define UHH_HOSTCONFIG_P1_CONNECT_STATUS_DISCONNECT (0UL << 8)
#define UHH_HOSTCONFIG_ENA_INCR_ALIGN_DISABLE (0UL << 5)
@@ -38,11 +34,8 @@
#define UHH_HOSTCONFIG_ENA_INCR8_ENABLE BIT3
#define UHH_HOSTCONFIG_ENA_INCR4_ENABLE BIT2
#define UHH_HOSTCONFIG_AUTOPPD_ON_OVERCUR_EN_ON (0UL << 1)
-#define UHH_HOSTCONFIG_P1_ULPI_BYPASS_ULPI_MODE (0UL << 0)
+#define UHH_HOSTCONFIG_P1_ULPI_BYPASS_ULPI_MODE (0UL << 16)
-#define UHH_SYSSTATUS_RESETDONE (BIT0 | BIT1 | BIT2)
+#define UHH_SYSSTATUS_RESETDONE (BIT1 | BIT2)
#endif // __OMAP4430USB_H__
-
-
-
diff --git a/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.c b/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.c
index 1a37e0f16..9162c6c84 100644
--- a/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.c
+++ b/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.c
@@ -153,64 +153,3 @@ SerialPortPoll (
}
}
-/**
- Set the serial device control bits.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return RETURN_SUCCESS;
-}
-
-/**
- Get the serial device control bits.
-
- @param Control Control signals read from the serial device.
-
- @retval EFI_SUCCESS The control bits were read from the serial device.
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- if (SerialPortPoll ()) {
- // If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
- *Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
- } else {
- *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
- }
-
- return RETURN_SUCCESS;
-}
-
-
-/**
- Set the serial device attributes.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetAttributes (
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-{
- return RETURN_SUCCESS;
-}
-
diff --git a/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.inf b/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.inf
index 676eb116b..07db0f837 100644
--- a/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.inf
+++ b/Omap44xxPkg/Library/SerialPortLib/SerialPortLib.inf
@@ -17,7 +17,7 @@
INF_VERSION = 0x00010005
BASE_NAME = PandaBoardSerialPortLib
FILE_GUID = 97546cbd-c0ff-4c48-ab0b-e4f58862acd3
- MODULE_TYPE = PEIM
+ MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = SerialPortLib
diff --git a/Omap44xxPkg/PciEmulation/PciEmulation.c b/Omap44xxPkg/PciEmulation/PciEmulation.c
index dc9109f91..2a2fcd58e 100644
--- a/Omap44xxPkg/PciEmulation/PciEmulation.c
+++ b/Omap44xxPkg/PciEmulation/PciEmulation.c
@@ -57,17 +57,10 @@ ConfigureUSBHost (
VOID
)
{
- EFI_STATUS Status;
- UINT8 Data = 0;
-
// Take USB host out of force-standby mode
- MmioWrite32 (UHH_SYSCONFIG, UHH_SYSCONFIG_MIDLEMODE_NO_STANDBY
- | UHH_SYSCONFIG_CLOCKACTIVITY_ON
- | UHH_SYSCONFIG_SIDLEMODE_NO_STANDBY
- | UHH_SYSCONFIG_ENAWAKEUP_ENABLE
- | UHH_SYSCONFIG_AUTOIDLE_ALWAYS_RUN);
- MmioWrite32 (UHH_HOSTCONFIG, UHH_HOSTCONFIG_P3_CONNECT_STATUS_DISCONNECT
- | UHH_HOSTCONFIG_P2_CONNECT_STATUS_DISCONNECT
+ MmioWrite32 (UHH_SYSCONFIG, UHH_SYSCONFIG_STANDBYMODE_NO_STANDBY
+ | UHH_SYSCONFIG_IDLEMODE_NO_IDLE);
+ MmioWrite32 (UHH_HOSTCONFIG, UHH_HOSTCONFIG_P2_CONNECT_STATUS_DISCONNECT
| UHH_HOSTCONFIG_P1_CONNECT_STATUS_DISCONNECT
| UHH_HOSTCONFIG_ENA_INCR_ALIGN_DISABLE
| UHH_HOSTCONFIG_ENA_INCR16_ENABLE
@@ -76,36 +69,18 @@ ConfigureUSBHost (
| UHH_HOSTCONFIG_AUTOPPD_ON_OVERCUR_EN_ON
| UHH_HOSTCONFIG_P1_ULPI_BYPASS_ULPI_MODE);
- // USB reset (GPIO 147 - Port 5 pin 19) output high
- MmioAnd32 (GPIO5_BASE + GPIO_OE, ~BIT19);
- MmioWrite32 (GPIO5_BASE + GPIO_SETDATAOUT, BIT19);
-
- // Get the Power IC protocol
- Status = gBS->LocateProtocol (&gEmbeddedExternalDeviceProtocolGuid, NULL, (VOID **)&gTWL6030);
- ASSERT_EFI_ERROR (Status);
-
- // Power the USB PHY
- Data = VAUX_DEV_GRP_P1;
- Status = gTWL6030->Write (gTWL6030, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, VAUX2_DEV_GRP), 1, &Data);
- ASSERT_EFI_ERROR(Status);
-
- Data = VAUX_DEDICATED_18V;
- Status = gTWL6030->Write (gTWL6030, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, VAUX2_DEDICATED), 1, &Data);
- ASSERT_EFI_ERROR (Status);
+ // fref auxclk3 feeds USB3320 ULPI/DPDM converter with 19.2 MHz square clock
+ MmioWrite32 (SCRM_AUXCLK3, SCRM_AUXCLK3_VAL);
- // Enable power to the USB hub
- Status = gTWL6030->Read (gTWL6030, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID3, LEDEN), 1, &Data);
- ASSERT_EFI_ERROR (Status);
+ // USB3320 and LAN9514 reset (HUB_NRESET: GPIO 62 - Port 2 pin 30 output high)
+ MmioAnd32 (GPIO2_BASE + GPIO_OE, ~BIT30);
+ MmioOr32 (GPIO2_BASE + GPIO_SETDATAOUT, BIT30);
- // LEDAON controls the power to the USB host, PWM is disabled
- Data &= ~LEDAPWM;
- Data |= LEDAON;
-
- Status = gTWL6030->Write (gTWL6030, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID3, LEDEN), 1, &Data);
- ASSERT_EFI_ERROR (Status);
+ // Enable power to USB hub (HUB_NPD: GPIO1 - Port 1 pin 1 output high)
+ MmioAnd32 (GPIO1_BASE + GPIO_OE, ~BIT1);
+ MmioOr32 (GPIO1_BASE + GPIO_SETDATAOUT, BIT1);
}
-
EFI_STATUS
PciIoPollMem (
IN EFI_PCI_IO_PROTOCOL *This,
@@ -456,10 +431,6 @@ PciEmulationEntryPoint (
UINT8 PhysicalPorts;
UINTN Count;
- // TODO
- // Currently this driver makes boot up crashing on Panda
- return EFI_SUCCESS;
-
//Configure USB host for OMAP4430.
ConfigureUSBHost();
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c
new file mode 100644
index 000000000..45ba3e52f
--- /dev/null
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c
@@ -0,0 +1,878 @@
+/** @file
+ Implement the interface to the AX88772 Ethernet controller.
+
+ This module implements the interface to the ASIX AX88772
+ USB to Ethernet MAC with integrated 10/100 PHY. Note that this implementation
+ only supports the integrated PHY since no other test cases were available.
+
+ Copyright (c) 2011, 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.
+
+**/
+
+#include "Ax88772.h"
+
+
+/**
+ Compute the CRC
+
+ @param [in] pMacAddress Address of a six byte buffer to containing the MAC address.
+
+ @returns The CRC-32 value associated with this MAC address
+
+**/
+UINT32
+Ax88772Crc (
+ IN UINT8 * pMacAddress
+ )
+{
+ UINT32 BitNumber;
+ INT32 Carry;
+ INT32 Crc;
+ UINT32 Data;
+ UINT8 * pEnd;
+
+ //
+ // Walk the MAC address
+ //
+ Crc = -1;
+ pEnd = &pMacAddress[ PXE_HWADDR_LEN_ETHER ];
+ while ( pEnd > pMacAddress ) {
+ Data = *pMacAddress++;
+ //
+ // CRC32: x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
+ //
+ // 1 0000 0100 1100 0001 0001 1101 1011 0111
+ //
+ for ( BitNumber = 0; 8 > BitNumber; BitNumber++ ) {
+ Carry = (( Crc >> 31 ) & 1 ) ^ ( Data & 1 );
+ Crc <<= 1;
+ if ( 0 != Carry ) {
+ Crc ^= 0x04c11db7;
+ }
+ Data >>= 1;
+ }
+ }
+ //
+ // Return the CRC value
+ //
+ return (UINT32) Crc;
+}
+
+
+/**
+ Get the MAC address
+
+ This routine calls ::Ax88772UsbCommand to request the MAC
+ address from the network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [out] pMacAddress Address of a six byte buffer to receive the MAC address.
+
+ @retval EFI_SUCCESS The MAC address is available.
+ @retval other The MAC address is not valid.
+
+**/
+EFI_STATUS
+Ax88772MacAddressGet (
+ IN NIC_DEVICE * pNicDevice,
+ OUT UINT8 * pMacAddress
+ )
+{
+ USB_DEVICE_REQUEST SetupMsg;
+ EFI_STATUS Status;
+
+ //
+ // Set the register address.
+ //
+ SetupMsg.RequestType = USB_ENDPOINT_DIR_IN
+ | USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_MAC_ADDRESS_READ;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = PXE_HWADDR_LEN_ETHER;
+
+ //
+ // Read the PHY register
+ //
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ pMacAddress );
+ return Status;
+}
+
+
+/**
+ Set the MAC address
+
+ This routine calls ::Ax88772UsbCommand to set the MAC address
+ in the network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] pMacAddress Address of a six byte buffer to containing the new MAC address.
+
+ @retval EFI_SUCCESS The MAC address was set.
+ @retval other The MAC address was not set.
+
+**/
+EFI_STATUS
+Ax88772MacAddressSet (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 * pMacAddress
+ )
+{
+ USB_DEVICE_REQUEST SetupMsg;
+ EFI_STATUS Status;
+
+ //
+ // Set the register address.
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_MAC_ADDRESS_WRITE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = PXE_HWADDR_LEN_ETHER;
+
+ //
+ // Read the PHY register
+ //
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ pMacAddress );
+ return Status;
+}
+
+/**
+ Clear the multicast hash table
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+
+**/
+VOID
+Ax88772MulticastClear (
+ IN NIC_DEVICE * pNicDevice
+ )
+{
+ int i = 0;
+ //
+ // Clear the multicast hash table
+ //
+ for ( i = 0 ; i < 8 ; i ++ )
+ pNicDevice->MulticastHash[0] = 0;
+}
+
+/**
+ Enable a multicast address in the multicast hash table
+
+ This routine calls ::Ax88772Crc to compute the hash bit for
+ this MAC address.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] pMacAddress Address of a six byte buffer to containing the MAC address.
+
+**/
+VOID
+Ax88772MulticastSet (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 * pMacAddress
+ )
+{
+ UINT32 Crc;
+
+ //
+ // Compute the CRC on the destination address
+ //
+ Crc = Ax88772Crc ( pMacAddress ) >> 26;
+
+ //
+ // Set the bit corresponding to the destination address
+ //
+ pNicDevice->MulticastHash [ Crc >> 3 ] |= ( 1<< (Crc& 7));
+}
+
+/**
+ Start the link negotiation
+
+ This routine calls ::Ax88772PhyWrite to start the PHY's link
+ negotiation.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+
+ @retval EFI_SUCCESS The link negotiation was started.
+ @retval other Failed to start the link negotiation.
+
+**/
+EFI_STATUS
+Ax88772NegotiateLinkStart (
+ IN NIC_DEVICE * pNicDevice
+ )
+{
+ UINT16 Control;
+ EFI_STATUS Status;
+ int i;
+ //
+ // Set the supported capabilities.
+ //
+ Status = Ax88772PhyWrite ( pNicDevice,
+ PHY_ANAR,
+ AN_CSMA_CD
+ | AN_TX_FDX | AN_TX_HDX
+ | AN_10_FDX | AN_10_HDX );
+ if ( !EFI_ERROR ( Status )) {
+ //
+ // Set the link speed and duplex
+ //
+ Control = BMCR_AUTONEGOTIATION_ENABLE
+ | BMCR_RESTART_AUTONEGOTIATION;
+ if ( pNicDevice->b100Mbps ) {
+ Control |= BMCR_100MBPS;
+ }
+ if ( pNicDevice->bFullDuplex ) {
+ Control |= BMCR_FULL_DUPLEX;
+ }
+ Status = Ax88772PhyWrite ( pNicDevice, PHY_BMCR, Control );
+ }
+
+ if (!EFI_ERROR(Status)) {
+ i = 0;
+ do {
+
+ if (pNicDevice->bComplete && pNicDevice->bLinkUp) {
+ pNicDevice->SimpleNetwork.Mode->MediaPresent
+ = pNicDevice->bLinkUp & pNicDevice->bComplete;
+ break;
+ }
+ else {
+ gBS->Stall(AUTONEG_DELAY);
+ Status = Ax88772NegotiateLinkComplete ( pNicDevice,
+ &pNicDevice->PollCount,
+ &pNicDevice->bComplete,
+ &pNicDevice->bLinkUp,
+ &pNicDevice->b100Mbps,
+ &pNicDevice->bFullDuplex );
+ i++;
+ }
+ }while(!pNicDevice->bLinkUp && i < AUTONEG_POLLCNT);
+ }
+ return Status;
+}
+
+
+/**
+ Complete the negotiation of the PHY link
+
+ This routine calls ::Ax88772PhyRead to determine if the
+ link negotiation is complete.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in, out] pPollCount Address of number of times this routine was polled
+ @param [out] pbComplete Address of boolean to receive complate status.
+ @param [out] pbLinkUp Address of boolean to receive link status, TRUE=up.
+ @param [out] pbHiSpeed Address of boolean to receive link speed, TRUE=100Mbps.
+ @param [out] pbFullDuplex Address of boolean to receive link duplex, TRUE=full.
+
+ @retval EFI_SUCCESS The MAC address is available.
+ @retval other The MAC address is not valid.
+
+**/
+EFI_STATUS
+Ax88772NegotiateLinkComplete (
+ IN NIC_DEVICE * pNicDevice,
+ IN OUT UINTN * pPollCount,
+ OUT BOOLEAN * pbComplete,
+ OUT BOOLEAN * pbLinkUp,
+ OUT BOOLEAN * pbHiSpeed,
+ OUT BOOLEAN * pbFullDuplex
+ )
+{
+ UINT16 Mask;
+ UINT16 PhyData;
+ EFI_STATUS Status;
+
+ //
+ // Determine if the link is up.
+ //
+ *pbComplete = FALSE;
+
+ //
+ // Get the link status
+ //
+ Status = Ax88772PhyRead ( pNicDevice,
+ PHY_BMSR,
+ &PhyData );
+
+ if ( !EFI_ERROR ( Status )) {
+ *pbLinkUp = (BOOLEAN)( 0 != ( PhyData & BMSR_LINKST ));
+ if ( 0 == *pbLinkUp ) {
+ DEBUG (( EFI_D_INFO, "Link Down\n" ));
+ }
+ else {
+ *pbComplete = (BOOLEAN)( 0 != ( PhyData & 0x20 ));
+ if ( 0 == *pbComplete ) {
+ DEBUG (( EFI_D_INFO, "Autoneg is not yet Complete\n" ));
+ }
+ else {
+ Status = Ax88772PhyRead ( pNicDevice,
+ PHY_ANLPAR,
+ &PhyData );
+ if ( !EFI_ERROR ( Status )) {
+ //
+ // Autonegotiation is complete
+ // Determine the link speed.
+ //
+ *pbHiSpeed = (BOOLEAN)( 0 != ( PhyData & ( AN_TX_FDX | AN_TX_HDX )));
+
+ //
+ // Determine the link duplex.
+ //
+ Mask = ( *pbHiSpeed ) ? AN_TX_FDX : AN_10_FDX;
+ *pbFullDuplex = (BOOLEAN)( 0 != ( PhyData & Mask ));
+ }
+ }
+ }
+ }
+ else {
+ DEBUG (( EFI_D_ERROR, "Failed to read BMCR\n" ));
+ }
+ return Status;
+}
+
+
+/**
+ Read a register from the PHY
+
+ This routine calls ::Ax88772UsbCommand to read a PHY register.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] RegisterAddress Number of the register to read.
+ @param [in, out] pPhyData Address of a buffer to receive the PHY register value
+
+ @retval EFI_SUCCESS The PHY data is available.
+ @retval other The PHY data is not valid.
+
+**/
+EFI_STATUS
+Ax88772PhyRead (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 RegisterAddress,
+ IN OUT UINT16 * pPhyData
+ )
+{
+ USB_DEVICE_REQUEST SetupMsg;
+ EFI_STATUS Status;
+
+ //
+ // Request access to the PHY
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_ACCESS_SOFTWARE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+ if ( !EFI_ERROR ( Status )) {
+ //
+ // Read the PHY register address.
+ //
+ SetupMsg.RequestType = USB_ENDPOINT_DIR_IN
+ | USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_REG_READ;
+ SetupMsg.Value = pNicDevice->PhyId;
+ SetupMsg.Index = RegisterAddress;
+ SetupMsg.Length = sizeof ( *pPhyData );
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ pPhyData );
+ if ( !EFI_ERROR ( Status )) {
+
+ //
+ // Release the PHY to the hardware
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_ACCESS_HARDWARE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+ }
+ }
+ return Status;
+}
+
+
+/**
+ Write to a PHY register
+
+ This routine calls ::Ax88772UsbCommand to write a PHY register.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] RegisterAddress Number of the register to read.
+ @param [in] PhyData Address of a buffer to receive the PHY register value
+
+ @retval EFI_SUCCESS The PHY data was written.
+ @retval other Failed to wwrite the PHY register.
+
+**/
+EFI_STATUS
+Ax88772PhyWrite (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 RegisterAddress,
+ IN UINT16 PhyData
+ )
+{
+ USB_DEVICE_REQUEST SetupMsg;
+ EFI_STATUS Status;
+
+ //
+ // Request access to the PHY
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_ACCESS_SOFTWARE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+ if ( !EFI_ERROR ( Status )) {
+ //
+ // Write the PHY register
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_REG_WRITE;
+ SetupMsg.Value = pNicDevice->PhyId;
+ SetupMsg.Index = RegisterAddress;
+ SetupMsg.Length = sizeof ( PhyData );
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ &PhyData );
+ if ( !EFI_ERROR ( Status )) {
+
+ //
+ // Release the PHY to the hardware
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_ACCESS_HARDWARE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+ }
+ }
+
+ return Status;
+}
+
+
+/**
+ Reset the AX88772
+
+ This routine uses ::Ax88772UsbCommand to reset the network
+ adapter. This routine also uses ::Ax88772PhyWrite to reset
+ the PHY.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+
+ @retval EFI_SUCCESS The MAC address is available.
+ @retval other The MAC address is not valid.
+
+**/
+EFI_STATUS
+Ax88772Reset (
+ IN NIC_DEVICE * pNicDevice
+ )
+{
+ USB_DEVICE_REQUEST SetupMsg;
+ EFI_STATUS Status;
+
+ EFI_USB_IO_PROTOCOL *pUsbIo;
+ EFI_USB_DEVICE_DESCRIPTOR Device;
+
+ pUsbIo = pNicDevice->pUsbIo;
+ Status = pUsbIo->UsbGetDeviceDescriptor ( pUsbIo, &Device );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_ACCESS_HARDWARE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_SELECT;
+ SetupMsg.Value = SPHY_PSEL;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RESET;
+ SetupMsg.Value = SRR_IPRL ;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RESET;
+ SetupMsg.Value = SRR_IPPD | SRR_IPRL ;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ gBS->Stall ( 200000 );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RESET;
+ SetupMsg.Value = SRR_IPRL ;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ gBS->Stall ( 200000 );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RESET;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_PHY_SELECT;
+ SetupMsg.Value = SPHY_PSEL;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RESET;
+ SetupMsg.Value = SRR_IPRL | SRR_BZ | SRR_BZTYPE;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RX_CONTROL_WRITE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+
+ if (EFI_ERROR(Status)) goto err;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RXQTC;
+ SetupMsg.Value = 0x8000;
+ SetupMsg.Index = 0x8001;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+err:
+ return Status;
+}
+
+/**
+ Enable or disable the receiver
+
+ This routine calls ::Ax88772UsbCommand to update the
+ receiver state. This routine also calls ::Ax88772MacAddressSet
+ to establish the MAC address for the network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] RxFilter Simple network RX filter mask value
+
+ @retval EFI_SUCCESS The MAC address was set.
+ @retval other The MAC address was not set.
+
+**/
+EFI_STATUS
+Ax88772RxControl (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT32 RxFilter
+ )
+{
+ UINT16 MediumStatus;
+ UINT16 RxControl;
+ USB_DEVICE_REQUEST SetupMsg;
+ EFI_STATUS Status;
+ EFI_USB_IO_PROTOCOL *pUsbIo;
+ EFI_USB_DEVICE_DESCRIPTOR Device;
+
+ pUsbIo = pNicDevice->pUsbIo;
+ Status = pUsbIo->UsbGetDeviceDescriptor ( pUsbIo, &Device );
+
+ if (EFI_ERROR(Status)) {
+ DEBUG (( EFI_D_ERROR, "Failed to get device descriptor\n" ));
+ return Status;
+ }
+
+ //
+ // Enable the receiver if something is to be received
+ //
+
+ if ( 0 != RxFilter ) {
+ //
+ // Enable the receiver
+ //
+ SetupMsg.RequestType = USB_ENDPOINT_DIR_IN
+ | USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_MEDIUM_STATUS_READ;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = sizeof ( MediumStatus );
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ &MediumStatus );
+ if ( !EFI_ERROR ( Status )) {
+ if ( 0 == ( MediumStatus & MS_RE )) {
+ MediumStatus |= MS_RE | MS_ONE;
+
+ if ( pNicDevice->bFullDuplex )
+ MediumStatus |= MS_TFC | MS_RFC | MS_FD;
+ else
+ MediumStatus &= ~(MS_TFC | MS_RFC | MS_FD);
+
+ if ( pNicDevice->b100Mbps )
+ MediumStatus |= MS_PS;
+ else
+ MediumStatus &= ~MS_PS;
+
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_MEDIUM_STATUS_WRITE;
+ SetupMsg.Value = MediumStatus;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+ if ( EFI_ERROR ( Status )) {
+ DEBUG (( EFI_D_ERROR, "Failed to enable receiver, Status: %r\r\n",
+ Status ));
+ }
+ }
+ }
+ else {
+ DEBUG (( EFI_D_ERROR, "Failed to read receiver status, Status: %r\r\n",
+ Status ));
+ }
+ }
+
+ RxControl = RXC_SO | RXC_RH1M;
+ //
+ // Enable multicast if requested
+ //
+ if ( 0 != ( RxFilter & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST )) {
+ RxControl |= RXC_AM;
+ //
+ // Update the multicast hash table
+ //
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_MULTICAST_HASH_WRITE;
+ SetupMsg.Value = 0;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = sizeof ( pNicDevice ->MulticastHash );
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ &pNicDevice->MulticastHash );
+ }
+ //
+ // Enable all multicast if requested
+ //
+ if ( 0 != ( RxFilter & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST )) {
+ RxControl |= RXC_AMALL;
+ }
+
+ //
+ // Enable broadcast if requested
+ //
+ if ( 0 != ( RxFilter & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST )) {
+ RxControl |= RXC_AB;
+ }
+
+ //
+ // Enable promiscuous mode if requested
+ //
+ if ( 0 != ( RxFilter & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS )) {
+ RxControl |= RXC_PRO;
+ }
+
+ //
+ // Update the receiver control
+ //
+ if (pNicDevice->CurRxControl != RxControl) {
+ SetupMsg.RequestType = USB_REQ_TYPE_VENDOR
+ | USB_TARGET_DEVICE;
+ SetupMsg.Request = CMD_RX_CONTROL_WRITE;
+ SetupMsg.Value = RxControl;
+ SetupMsg.Index = 0;
+ SetupMsg.Length = 0;
+ Status = Ax88772UsbCommand ( pNicDevice,
+ &SetupMsg,
+ NULL );
+ if ( !EFI_ERROR ( Status )) {
+ pNicDevice->CurRxControl = RxControl;
+
+ }
+ else {
+ DEBUG (( EFI_D_ERROR, "ERROR - Failed to set receiver control, Status: %r\r\n",
+ Status ));
+ }
+ }
+ return Status;
+}
+
+
+/**
+ Read an SROM location
+
+ This routine calls ::Ax88772UsbCommand to read data from the
+ SROM.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] Address SROM address
+ @param [out] pData Buffer to receive the data
+
+ @retval EFI_SUCCESS The read was successful
+ @retval other The read failed
+
+**/
+EFI_STATUS
+Ax88772SromRead (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT32 Address,
+ OUT UINT16 * pData
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Send a command to the USB device.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] pRequest Pointer to the request structure
+ @param [in, out] pBuffer Data buffer address
+
+ @retval EFI_SUCCESS The USB transfer was successful
+ @retval other The USB transfer failed
+
+**/
+EFI_STATUS
+Ax88772UsbCommand (
+ IN NIC_DEVICE * pNicDevice,
+ IN USB_DEVICE_REQUEST * pRequest,
+ IN OUT VOID * pBuffer
+ )
+{
+ UINT32 CmdStatus;
+ EFI_USB_DATA_DIRECTION Direction;
+ EFI_USB_IO_PROTOCOL * pUsbIo;
+ EFI_STATUS Status;
+
+ //
+ // Determine the transfer direction
+ //
+ Direction = EfiUsbNoData;
+ if ( 0 != pRequest->Length ) {
+ Direction = ( 0 != ( pRequest->RequestType & USB_ENDPOINT_DIR_IN ))
+ ? EfiUsbDataIn : EfiUsbDataOut;
+ }
+
+ //
+ // Issue the command
+ //
+ pUsbIo = pNicDevice->pUsbIo;
+ Status = pUsbIo->UsbControlTransfer ( pUsbIo,
+ pRequest,
+ Direction,
+ USB_BUS_TIMEOUT,
+ pBuffer,
+ pRequest->Length,
+ &CmdStatus );
+ //
+ // Determine the operation status
+ //
+ if ( !EFI_ERROR ( Status )) {
+ Status = CmdStatus;
+ }
+ else {
+ //
+ // Only use status values associated with the Simple Network protocol
+ //
+ if ( EFI_TIMEOUT == Status ) {
+ Status = EFI_DEVICE_ERROR;
+ }
+ }
+ return Status;
+}
+
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h
new file mode 100644
index 000000000..5382e44c1
--- /dev/null
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h
@@ -0,0 +1,1023 @@
+/** @file
+ Definitions for ASIX AX88772 Ethernet adapter.
+
+ Copyright (c) 2011, 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.
+
+**/
+
+#ifndef _AX88772_H_
+#define _AX88772_H_
+
+#include <Uefi.h>
+
+#include <Guid/EventGroup.h>
+#include <Guid/NicIp4ConfigNvData.h>
+
+#include <IndustryStandard/Pci.h>
+
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiRuntimeLib.h>
+
+#include <Protocol/DevicePath.h>
+#include <Protocol/LoadedImage.h>
+#include <Protocol/NetworkInterfaceIdentifier.h>
+#include <Protocol/SimpleNetwork.h>
+#include <Protocol/UsbIo.h>
+
+#define MAX_QUEUE_SIZE 50
+#define MAX_BULKIN_SIZE 16384
+#define HW_HDR_LENGTH 8
+
+
+#define MAX_LINKIDLE_THRESHOLD 20000
+
+
+
+//------------------------------------------------------------------------------
+// Macros
+//------------------------------------------------------------------------------
+
+#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
+#define DBG_ENTER() DEBUG (( 0xffffffff, "Entering " __FUNCTION__ "\n" )) ///< Display routine entry
+#define DBG_EXIT() DEBUG (( 0xffffffff, "Exiting " __FUNCTION__ "\n" )) ///< Display routine exit
+#define DBG_EXIT_DEC(Status) DEBUG (( 0xffffffff, "Exiting " __FUNCTION__ ", Status: %d\n", Status )) ///< Display routine exit with decimal value
+#define DBG_EXIT_HEX(Status) DEBUG (( 0xffffffff, "Exiting " __FUNCTION__ ", Status: 0x%08x\n", Status )) ///< Display routine exit with hex value
+#define DBG_EXIT_STATUS(Status) DEBUG (( 0xffffffff, "Exiting " __FUNCTION__ ", Status: %r\n", Status )) ///< Display routine exit with status value
+#define DBG_EXIT_TF(Status) DEBUG (( 0xffffffff, "Exiting " __FUNCTION__ ", returning %s\n", (FALSE == Status) ? L"FALSE" : L"TRUE" )) ///< Display routine with TRUE/FALSE value
+#else // _MSC_VER
+#define DBG_ENTER() ///< Display routine entry
+#define DBG_EXIT() ///< Display routine exit
+#define DBG_EXIT_DEC(Status) ///< Display routine exit with decimal value
+#define DBG_EXIT_HEX(Status) ///< Display routine exit with hex value
+#define DBG_EXIT_STATUS(Status) ///< Display routine exit with status value
+#define DBG_EXIT_TF(Status) ///< Display routine with TRUE/FALSE value
+#endif // _MSC_VER
+
+#define USB_IS_IN_ENDPOINT(EndPointAddr) (((EndPointAddr) & BIT7) != 0) ///< Return TRUE/FALSE for IN direction
+#define USB_IS_OUT_ENDPOINT(EndPointAddr) (((EndPointAddr) & BIT7) == 0) ///< Return TRUE/FALSE for OUT direction
+#define USB_IS_BULK_ENDPOINT(Attribute) (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_BULK) ///< Return TRUE/FALSE for BULK type
+#define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) ///< Return TRUE/FALSE for INTERRUPT type
+
+
+#define PRINT(_L_STR) (gST->ConOut->OutputString(gST->ConOut,(_L_STR)))
+//------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------
+
+#define DEBUG_RX_BROADCAST 0x40000000 ///< Display RX broadcast messages
+#define DEBUG_RX_MULTICAST 0x20000000 ///< Display RX multicast messages
+#define DEBUG_RX_UNICAST 0x10000000 ///< Display RX unicast messages
+#define DEBUG_MAC_ADDRESS 0x08000000 ///< Display the MAC address
+#define DEBUG_LINK 0x04000000 ///< Display the link status
+#define DEBUG_TX 0x02000000 ///< Display the TX messages
+#define DEBUG_PHY 0x01000000 ///< Display the PHY register values
+#define DEBUG_SROM 0x00800000 ///< Display the SROM contents
+#define DEBUG_TIMER 0x00400000 ///< Display the timer routine entry/exit
+#define DEBUG_TPL 0x00200000 ///< Display the timer routine entry/exit
+
+#define AX88772_MAX_PKT_SIZE 2048 ///< Maximum packet size
+
+#define ETHERNET_HEADER_SIZE sizeof ( ETHERNET_HEADER ) ///< Size in bytes of the Ethernet header
+#define MIN_ETHERNET_PKT_SIZE 60 ///< Minimum packet size including Ethernet header
+#define MAX_ETHERNET_PKT_SIZE 1500 ///< Ethernet spec 3.1.1: Minimum packet size
+
+#define USB_NETWORK_CLASS 0x09 ///< USB Network class code
+#define USB_BUS_TIMEOUT 1000 ///< USB timeout in milliseconds
+
+#define TIMER_MSEC 20 ///< Polling interval for the NIC
+//#define TPL_AX88772 TPL_CALLBACK ///< TPL for routine synchronization
+
+#define HC_DEBUG 0
+#define BULKIN_TIMEOUT 20
+#define AUTONEG_DELAY 500000
+#define AUTONEG_POLLCNT 20
+
+/**
+ Verify new TPL value
+
+ This macro which is enabled when debug is enabled verifies that
+ the new TPL value is >= the current TPL value.
+**/
+#ifdef VERIFY_TPL
+#undef VERIFY_TPL
+#endif // VERIFY_TPL
+
+#if !defined(MDEPKG_NDEBUG)
+
+#define VERIFY_TPL(tpl) \
+{ \
+ EFI_TPL PreviousTpl; \
+ \
+ PreviousTpl = gBS->RaiseTPL ( TPL_HIGH_LEVEL ); \
+ gBS->RestoreTPL ( PreviousTpl ); \
+ if ( PreviousTpl > tpl ) { \
+ DEBUG (( DEBUG_ERROR, "Current TPL: %d, New TPL: %d\r\n", PreviousTpl, tpl )); \
+ ASSERT ( PreviousTpl <= tpl ); \
+ } \
+}
+
+#else // MDEPKG_NDEBUG
+
+#define VERIFY_TPL(tpl)
+
+#endif // MDEPKG_NDEBUG
+
+//------------------------------------------------------------------------------
+// Hardware Definition
+//------------------------------------------------------------------------------
+
+#define FreeQueueSize 10
+
+#define DEV_SIGNATURE SIGNATURE_32 ('A','X','8','8') ///< Signature of data structures in memory
+
+#define VENDOR_ID 0x0B95 ///< Vendor ID for Asix
+#define PRODUCT_ID 0x772B ///< Product ID for the AX88772 USB 10/100 Ethernet controller
+
+#define RESET_MSEC 1000 ///< Reset duration
+#define PHY_RESET_MSEC 500 ///< PHY reset duration
+
+//
+// RX Control register
+//
+
+#define RXC_PRO 0x0001 ///< Receive all packets
+#define RXC_AMALL 0x0002 ///< Receive all multicast packets
+#define RXC_SEP 0x0004 ///< Save error packets
+#define RXC_AB 0x0008 ///< Receive broadcast packets
+#define RXC_AM 0x0010 ///< Use multicast destination address hash table
+#define RXC_AP 0x0020 ///< Accept physical address from Multicast Filter
+#define RXC_SO 0x0080 ///< Start operation
+#define RXC_MFB 0x0300 ///< Maximum frame burst
+#define RXC_MFB_2048 0 ///< Maximum frame size: 2048 bytes
+#define RXC_MFB_4096 0x0100 ///< Maximum frame size: 4096 bytes
+#define RXC_MFB_8192 0x0200 ///< Maximum frame size: 8192 bytes
+#define RXC_MFB_16384 0x0300 ///< Maximum frame size: 16384 bytes
+
+/*Freddy*/
+#define RXC_RH1M 0x0100 ///< Rx header 1
+#define RXC_RH2M 0x0200 ///< Rx header 2
+#define RXC_RH3M 0x0400 ///< Rx header 3
+/*Freddy*/
+
+//
+// Medium Status register
+//
+
+#define MS_FD 0x0002 ///< Full duplex
+#define MS_ONE 0x0004 ///< Must be one
+#define MS_RFC 0x0010 ///< RX flow control enable
+#define MS_TFC 0x0020 ///< TX flow control enable
+#define MS_PF 0x0080 ///< Pause frame enable
+#define MS_RE 0x0100 ///< Receive enable
+#define MS_PS 0x0200 ///< Port speed 1=100, 0=10 Mbps
+#define MS_SBP 0x0800 ///< Stop back pressure
+#define MS_SM 0x1000 ///< Super MAC support
+
+//
+// Software PHY Select register
+//
+
+#define SPHY_PSEL (1 << 0) ///< Select internal PHY
+#define SPHY_SSMII (1 << 2)
+#define SPHY_SSEN (1 << 4)
+#define SPHY_ASEL 0x02 ///< 1=Auto select, 0=Manual select
+
+//
+// Software Reset register
+//
+
+#define SRR_RR 0x01 ///< Clear receive frame length error
+#define SRR_RT 0x02 ///< Clear transmit frame length error
+#define SRR_BZTYPE 0x04 ///< External PHY reset pin tri-state enable
+#define SRR_PRL 0x08 ///< External PHY reset pin level
+#define SRR_BZ 0x10 ///< Force Bulk to return zero length packet
+#define SRR_IPRL 0x20 ///< Internal PHY reset control
+#define SRR_IPPD 0x40 ///< Internal PHY power down
+
+//
+// PHY ID values
+//
+
+#define PHY_ID_INTERNAL 0x0010 ///< Internal PHY
+
+//
+// USB Commands
+//
+
+#define CMD_PHY_ACCESS_SOFTWARE 0x06 ///< Software in control of PHY
+#define CMD_PHY_REG_READ 0x07 ///< Read PHY register, Value: PHY, Index: Register, Data: Register value
+#define CMD_PHY_REG_WRITE 0x08 ///< Write PHY register, Value: PHY, Index: Register, Data: New 16-bit value
+#define CMD_PHY_ACCESS_HARDWARE 0x0a ///< Hardware in control of PHY
+#define CMD_SROM_READ 0x0b ///< Read SROM register: Value: Address, Data: Value
+#define CMD_RX_CONTROL_WRITE 0x10 ///< Set the RX control register, Value: New value
+#define CMD_GAPS_WRITE 0x12 ///< Write the gaps register, Value: New value
+#define CMD_MAC_ADDRESS_READ 0x13 ///< Read the MAC address, Data: 6 byte MAC address
+#define CMD_MAC_ADDRESS_WRITE 0x14 ///< Set the MAC address, Data: New 6 byte MAC address
+#define CMD_MULTICAST_HASH_WRITE 0x16 ///< Write the multicast hash table, Data: New 8 byte value
+#define CMD_MULTICAST_HASH_READ 0x16 ///< Read the multicast hash table
+#define CMD_MEDIUM_STATUS_READ 0x1a ///< Read medium status register, Data: Register value
+#define CMD_MEDIUM_STATUS_WRITE 0x1b ///< Write medium status register, Value: New value
+#define CMD_WRITE_GPIOS 0x1f
+#define CMD_RESET 0x20 ///< Reset register, Value: New value
+#define CMD_PHY_SELECT 0x22 ///< PHY select register, Value: New value
+
+/*Freddy*/
+#define CMD_RXQTC 0x2a ///< RX Queue Cascade Threshold Control Register
+/*Freddy*/
+
+//------------------------------
+// USB Endpoints
+//------------------------------
+
+#define CONTROL_ENDPOINT 0 ///< Control endpoint
+#define INTERRUPT_ENDPOINT 1 ///< Interrupt endpoint
+#define BULK_IN_ENDPOINT 2 ///< Receive endpoint
+#define BULK_OUT_ENDPOINT 3 ///< Transmit endpoint
+
+//------------------------------
+// PHY Registers
+//------------------------------
+
+#define PHY_BMCR 0 ///< Control register
+#define PHY_BMSR 1 ///< Status register
+#define PHY_ANAR 4 ///< Autonegotiation advertisement register
+#define PHY_ANLPAR 5 ///< Autonegotiation link parter ability register
+#define PHY_ANER 6 ///< Autonegotiation expansion register
+
+// BMCR - Register 0
+
+#define BMCR_RESET 0x8000 ///< 1 = Reset the PHY, bit clears after reset
+#define BMCR_LOOPBACK 0x4000 ///< 1 = Loopback enabled
+#define BMCR_100MBPS 0x2000 ///< 100 Mbits/Sec
+#define BMCR_10MBPS 0 ///< 10 Mbits/Sec
+#define BMCR_AUTONEGOTIATION_ENABLE 0x1000 ///< 1 = Enable autonegotiation
+#define BMCR_POWER_DOWN 0x0800 ///< 1 = Power down
+#define BMCR_ISOLATE 0x0400 ///< 0 = Isolate PHY
+#define BMCR_RESTART_AUTONEGOTIATION 0x0200 ///< 1 = Restart autonegotiation
+#define BMCR_FULL_DUPLEX 0x0100 ///< Full duplex operation
+#define BMCR_HALF_DUPLEX 0 ///< Half duplex operation
+#define BMCR_COLLISION_TEST 0x0080 ///< 1 = Collision test enabled
+
+// BSMR - Register 1
+
+#define BMSR_100BASET4 0x8000 ///< 1 = 100BASE-T4 mode
+#define BMSR_100BASETX_FDX 0x4000 ///< 1 = 100BASE-TX full duplex
+#define BMSR_100BASETX_HDX 0x2000 ///< 1 = 100BASE-TX half duplex
+#define BMSR_10BASET_FDX 0x1000 ///< 1 = 10BASE-T full duplex
+#define BMSR_10BASET_HDX 0x0800 ///< 1 = 10BASE-T half duplex
+#define BMSR_MF 0x0040 ///< 1 = PHY accepts frames with preamble suppressed
+#define BMSR_AUTONEG_CMPLT 0x0020 ///< 1 = Autonegotiation complete
+#define BMSR_RF 0x0010 ///< 1 = Remote fault
+#define BMSR_AUTONEG 0x0008 ///< 1 = Able to perform autonegotiation
+#define BMSR_LINKST 0x0004 ///< 1 = Link up
+#define BMSR_JABBER_DETECT 0x0002 ///< 1 = jabber condition detected
+#define BMSR_EXTENDED_CAPABILITY 0x0001 ///< 1 = Extended register capable
+
+// ANAR and ANLPAR Registers 4, 5
+
+#define AN_NP 0x8000 ///< 1 = Next page available
+#define AN_ACK 0x4000 ///< 1 = Link partner acknowledged
+#define AN_RF 0x2000 ///< 1 = Remote fault indicated by link partner
+#define AN_FCS 0x0400 ///< 1 = Flow control ability
+#define AN_T4 0x0200 ///< 1 = 100BASE-T4 support
+#define AN_TX_FDX 0x0100 ///< 1 = 100BASE-TX Full duplex
+#define AN_TX_HDX 0x0080 ///< 1 = 100BASE-TX support
+#define AN_10_FDX 0x0040 ///< 1 = 10BASE-T Full duplex
+#define AN_10_HDX 0x0020 ///< 1 = 10BASE-T support
+#define AN_CSMA_CD 0x0001 ///< 1 = IEEE 802.3 CSMA/CD support
+
+
+
+//------------------------------------------------------------------------------
+// Data Types
+//------------------------------------------------------------------------------
+
+/**
+ Ethernet header layout
+
+ IEEE 802.3-2002 Part 3 specification, section 3.1.1.
+**/
+#pragma pack(1)
+typedef struct {
+ UINT8 dest_addr[PXE_HWADDR_LEN_ETHER]; ///< Destination LAN address
+ UINT8 src_addr[PXE_HWADDR_LEN_ETHER]; ///< Source LAN address
+ UINT16 type; ///< Protocol or length
+} ETHERNET_HEADER;
+#pragma pack()
+
+/**
+ Receive and Transmit packet structure
+**/
+#pragma pack(1)
+typedef struct _RX_TX_PACKET {
+ struct _RX_TX_PACKET * pNext; ///< Next receive packet
+ UINT16 Length; ///< Packet length
+ UINT16 LengthBar; ///< Complement of the length
+ UINT8 Data[ AX88772_MAX_PKT_SIZE ]; ///< Received packet data
+} RX_TX_PACKET;
+#pragma pack()
+
+
+#pragma pack(1)
+typedef struct _RX_PKT {
+ struct _RX_PKT *pNext;
+ BOOLEAN f_Used;
+ UINT16 Length;
+ UINT8 Data [AX88772_MAX_PKT_SIZE] ;
+} RX_PKT;
+#pragma pack()
+
+/**
+ AX88772 control structure
+
+ The driver uses this structure to manage the Asix AX88772 10/100
+ Ethernet controller.
+**/
+typedef struct {
+ UINTN Signature; ///< Structure identification
+
+ //
+ // USB data
+ //
+ EFI_HANDLE Controller; ///< Controller handle
+ EFI_USB_IO_PROTOCOL * pUsbIo; ///< USB driver interface
+
+ //
+ // Simple network protocol data
+ //
+ EFI_SIMPLE_NETWORK_PROTOCOL SimpleNetwork; ///< Driver's network stack interface
+ EFI_SIMPLE_NETWORK_PROTOCOL SimpleNetwork_Backup;
+ EFI_SIMPLE_NETWORK_MODE SimpleNetworkData; ///< Data for simple network
+
+ //
+ // Ethernet controller data
+ //
+ BOOLEAN bInitialized; ///< Controller initialized
+ VOID * pTxBuffer; ///< Last transmit buffer
+ UINT16 PhyId; ///< PHY ID
+
+ //
+ // Link state
+ //
+ BOOLEAN b100Mbps; ///< Current link speed, FALSE = 10 Mbps
+ BOOLEAN bComplete; ///< Current state of auto-negotiation
+ BOOLEAN bFullDuplex; ///< Current duplex
+ BOOLEAN bLinkUp; ///< Current link state
+ UINTN LinkIdleCnt;
+ UINTN PollCount; ///< Number of times the autonegotiation status was polled
+ UINT16 CurRxControl;
+ //
+ // Receive buffer list
+ //
+ RX_TX_PACKET * pRxTest;
+ RX_TX_PACKET * pTxTest;
+
+ INT8 MulticastHash[8];
+ EFI_MAC_ADDRESS MAC;
+ BOOLEAN bHavePkt;
+
+ EFI_DEVICE_PATH_PROTOCOL *MyDevPath;
+
+ EFI_DRIVER_BINDING_PROTOCOL * DrvBind;
+
+ RX_PKT * QueueHead;
+ RX_PKT * pNextFill;
+ RX_PKT * pFirstFill;
+ UINTN PktCntInQueue;
+ UINT8 * pBulkInBuff;
+
+} NIC_DEVICE;
+
+#define DEV_FROM_SIMPLE_NETWORK(a) CR (a, NIC_DEVICE, SimpleNetwork, DEV_SIGNATURE) ///< Locate NIC_DEVICE from Simple Network Protocol
+
+//------------------------------------------------------------------------------
+// Simple Network Protocol
+//------------------------------------------------------------------------------
+
+/**
+ Reset the network adapter.
+
+ Resets a network adapter and reinitializes it with the parameters that
+ were provided in the previous call to Initialize (). The transmit and
+ receive queues are cleared. Receive filters, the station address, the
+ statistics, and the multicast-IP-to-HW MAC addresses are not reset by
+ this call.
+
+ This routine calls ::Ax88772Reset to perform the adapter specific
+ reset operation. This routine also starts the link negotiation
+ by calling ::Ax88772NegotiateLinkStart.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bExtendedVerification Indicates that the driver may perform a more
+ exhaustive verification operation of the device
+ during reset.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Reset (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bExtendedVerification
+ );
+
+/**
+ Initialize the simple network protocol.
+
+ This routine calls ::Ax88772MacAddressGet to obtain the
+ MAC address.
+
+ @param [in] pNicDevice NIC_DEVICE_INSTANCE pointer
+
+ @retval EFI_SUCCESS Setup was successful
+
+**/
+EFI_STATUS
+SN_Setup (
+ IN NIC_DEVICE * pNicDevice
+ );
+
+/**
+ This routine starts the network interface.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_ALREADY_STARTED The network interface was already started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Start (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ );
+
+/**
+ Set the MAC address.
+
+ This function modifies or resets the current station address of a
+ network interface. If Reset is TRUE, then the current station address
+ is set ot the network interface's permanent address. If Reset if FALSE
+ then the current station address is changed to the address specified by
+ pNew.
+
+ This routine calls ::Ax88772MacAddressSet to update the MAC address
+ in the network adapter.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bReset Flag used to reset the station address to the
+ network interface's permanent address.
+ @param [in] pNew New station address to be used for the network
+ interface.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_StationAddress (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bReset,
+ IN EFI_MAC_ADDRESS * pNew
+ );
+
+/**
+ This function resets or collects the statistics on a network interface.
+ If the size of the statistics table specified by StatisticsSize is not
+ big enough for all of the statistics that are collected by the network
+ interface, then a partial buffer of statistics is returned in
+ StatisticsTable.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bReset Set to TRUE to reset the statistics for the network interface.
+ @param [in, out] pStatisticsSize On input the size, in bytes, of StatisticsTable. On output
+ the size, in bytes, of the resulting table of statistics.
+ @param [out] pStatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
+ conains the statistics.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_BUFFER_TOO_SMALL The pStatisticsTable is NULL or the buffer is too small.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Statistics (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bReset,
+ IN OUT UINTN * pStatisticsSize,
+ OUT EFI_NETWORK_STATISTICS * pStatisticsTable
+ );
+
+/**
+ This function stops a network interface. This call is only valid
+ if the network interface is in the started state.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Stop (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ );
+
+/**
+ This function releases the memory buffers assigned in the Initialize() call.
+ Pending transmits and receives are lost, and interrupts are cleared and disabled.
+ After this call, only Initialize() and Stop() calls may be used.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Shutdown (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ );
+
+/**
+ Send a packet over the network.
+
+ This function places the packet specified by Header and Buffer on
+ the transmit queue. This function performs a non-blocking transmit
+ operation. When the transmit is complete, the buffer is returned
+ via the GetStatus() call.
+
+ This routine calls ::Ax88772Rx to empty the network adapter of
+ receive packets. The routine then passes the transmit packet
+ to the network adapter.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] HeaderSize The size, in bytes, of the media header to be filled in by
+ the Transmit() function. If HeaderSize is non-zero, then
+ it must be equal to SimpleNetwork->Mode->MediaHeaderSize
+ and DestAddr and Protocol parameters must not be NULL.
+ @param [in] BufferSize The size, in bytes, of the entire packet (media header and
+ data) to be transmitted through the network interface.
+ @param [in] pBuffer A pointer to the packet (media header followed by data) to
+ to be transmitted. This parameter can not be NULL. If
+ HeaderSize is zero, then the media header is Buffer must
+ already be filled in by the caller. If HeaderSize is nonzero,
+ then the media header will be filled in by the Transmit()
+ function.
+ @param [in] pSrcAddr The source HW MAC address. If HeaderSize is zero, then
+ this parameter is ignored. If HeaderSize is nonzero and
+ SrcAddr is NULL, then SimpleNetwork->Mode->CurrentAddress
+ is used for the source HW MAC address.
+ @param [in] pDestAddr The destination HW MAC address. If HeaderSize is zero, then
+ this parameter is ignored.
+ @param [in] pProtocol The type of header to build. If HeaderSize is zero, then
+ this parameter is ignored.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
+ @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Transmit (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN UINTN HeaderSize,
+ IN UINTN BufferSize,
+ IN VOID * pBuffer,
+ IN EFI_MAC_ADDRESS * pSrcAddr,
+ IN EFI_MAC_ADDRESS * pDestAddr,
+ IN UINT16 * pProtocol
+ );
+
+//------------------------------------------------------------------------------
+// Support Routines
+//------------------------------------------------------------------------------
+
+/**
+ Get the MAC address
+
+ This routine calls ::Ax88772UsbCommand to request the MAC
+ address from the network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [out] pMacAddress Address of a six byte buffer to receive the MAC address.
+
+ @retval EFI_SUCCESS The MAC address is available.
+ @retval other The MAC address is not valid.
+
+**/
+EFI_STATUS
+Ax88772MacAddressGet (
+ IN NIC_DEVICE * pNicDevice,
+ OUT UINT8 * pMacAddress
+ );
+
+/**
+ Set the MAC address
+
+ This routine calls ::Ax88772UsbCommand to set the MAC address
+ in the network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] pMacAddress Address of a six byte buffer to containing the new MAC address.
+
+ @retval EFI_SUCCESS The MAC address was set.
+ @retval other The MAC address was not set.
+
+**/
+EFI_STATUS
+Ax88772MacAddressSet (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 * pMacAddress
+ );
+
+/**
+ Clear the multicast hash table
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+
+**/
+VOID
+Ax88772MulticastClear (
+ IN NIC_DEVICE * pNicDevice
+ );
+
+/**
+ Enable a multicast address in the multicast hash table
+
+ This routine calls ::Ax88772Crc to compute the hash bit for
+ this MAC address.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] pMacAddress Address of a six byte buffer to containing the MAC address.
+
+**/
+VOID
+Ax88772MulticastSet (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 * pMacAddress
+ );
+
+/**
+ Start the link negotiation
+
+ This routine calls ::Ax88772PhyWrite to start the PHY's link
+ negotiation.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+
+ @retval EFI_SUCCESS The link negotiation was started.
+ @retval other Failed to start the link negotiation.
+
+**/
+EFI_STATUS
+Ax88772NegotiateLinkStart (
+ IN NIC_DEVICE * pNicDevice
+ );
+
+/**
+ Complete the negotiation of the PHY link
+
+ This routine calls ::Ax88772PhyRead to determine if the
+ link negotiation is complete.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in, out] pPollCount Address of number of times this routine was polled
+ @param [out] pbComplete Address of boolean to receive complate status.
+ @param [out] pbLinkUp Address of boolean to receive link status, TRUE=up.
+ @param [out] pbHiSpeed Address of boolean to receive link speed, TRUE=100Mbps.
+ @param [out] pbFullDuplex Address of boolean to receive link duplex, TRUE=full.
+
+ @retval EFI_SUCCESS The MAC address is available.
+ @retval other The MAC address is not valid.
+
+**/
+EFI_STATUS
+Ax88772NegotiateLinkComplete (
+ IN NIC_DEVICE * pNicDevice,
+ IN OUT UINTN * pPollCount,
+ OUT BOOLEAN * pbComplete,
+ OUT BOOLEAN * pbLinkUp,
+ OUT BOOLEAN * pbHiSpeed,
+ OUT BOOLEAN * pbFullDuplex
+ );
+
+/**
+ Read a register from the PHY
+
+ This routine calls ::Ax88772UsbCommand to read a PHY register.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] RegisterAddress Number of the register to read.
+ @param [in, out] pPhyData Address of a buffer to receive the PHY register value
+
+ @retval EFI_SUCCESS The PHY data is available.
+ @retval other The PHY data is not valid.
+
+**/
+EFI_STATUS
+Ax88772PhyRead (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 RegisterAddress,
+ IN OUT UINT16 * pPhyData
+ );
+
+/**
+ Write to a PHY register
+
+ This routine calls ::Ax88772UsbCommand to write a PHY register.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] RegisterAddress Number of the register to read.
+ @param [in] PhyData Address of a buffer to receive the PHY register value
+
+ @retval EFI_SUCCESS The PHY data was written.
+ @retval other Failed to wwrite the PHY register.
+
+**/
+EFI_STATUS
+Ax88772PhyWrite (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT8 RegisterAddress,
+ IN UINT16 PhyData
+ );
+
+/**
+ Reset the AX88772
+
+ This routine uses ::Ax88772UsbCommand to reset the network
+ adapter. This routine also uses ::Ax88772PhyWrite to reset
+ the PHY.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+
+ @retval EFI_SUCCESS The MAC address is available.
+ @retval other The MAC address is not valid.
+
+**/
+EFI_STATUS
+Ax88772Reset (
+ IN NIC_DEVICE * pNicDevice
+ );
+
+VOID
+Ax88772ChkLink (
+ IN NIC_DEVICE * pNicDevice,
+ IN BOOLEAN bUpdateLink
+ );
+
+/**
+ Receive a frame from the network.
+
+ This routine polls the USB receive interface for a packet. If a packet
+ is available, this routine adds the receive packet to the list of
+ pending receive packets.
+
+ This routine calls ::Ax88772NegotiateLinkComplete to verify
+ that the link is up. This routine also calls ::SN_Reset to
+ reset the network adapter when necessary. Finally this
+ routine attempts to receive one or more packets from the
+ network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] bUpdateLink TRUE = Update link status
+
+**/
+VOID
+Ax88772Rx (
+ IN NIC_DEVICE * pNicDevice,
+ IN BOOLEAN bUpdateLink
+ );
+
+/**
+ Enable or disable the receiver
+
+ This routine calls ::Ax88772UsbCommand to update the
+ receiver state. This routine also calls ::Ax88772MacAddressSet
+ to establish the MAC address for the network adapter.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] RxFilter Simple network RX filter mask value
+
+ @retval EFI_SUCCESS The MAC address was set.
+ @retval other The MAC address was not set.
+
+**/
+EFI_STATUS
+Ax88772RxControl (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT32 RxFilter
+ );
+
+/**
+ Read an SROM location
+
+ This routine calls ::Ax88772UsbCommand to read data from the
+ SROM.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] Address SROM address
+ @param [out] pData Buffer to receive the data
+
+ @retval EFI_SUCCESS The read was successful
+ @retval other The read failed
+
+**/
+EFI_STATUS
+Ax88772SromRead (
+ IN NIC_DEVICE * pNicDevice,
+ IN UINT32 Address,
+ OUT UINT16 * pData
+ );
+
+/**
+ Send a command to the USB device.
+
+ @param [in] pNicDevice Pointer to the NIC_DEVICE structure
+ @param [in] pRequest Pointer to the request structure
+ @param [in, out] pBuffer Data buffer address
+
+ @retval EFI_SUCCESS The USB transfer was successful
+ @retval other The USB transfer failed
+
+**/
+EFI_STATUS
+Ax88772UsbCommand (
+ IN NIC_DEVICE * pNicDevice,
+ IN USB_DEVICE_REQUEST * pRequest,
+ IN OUT VOID * pBuffer
+ );
+
+//------------------------------------------------------------------------------
+// EFI Component Name Protocol Support
+//------------------------------------------------------------------------------
+
+extern EFI_COMPONENT_NAME_PROTOCOL gComponentName; ///< Component name protocol declaration
+extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2; ///< Component name 2 protocol declaration
+
+/**
+ Retrieves a Unicode string that is the user readable name of the driver.
+
+ This function retrieves the user readable name of a driver in the form of a
+ Unicode string. If the driver specified by This has a user readable name in
+ the language specified by Language, then a pointer to the driver name is
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+ by This does not support the language specified by Language,
+ then EFI_UNSUPPORTED is returned.
+
+ @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param [in] pLanguage A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified
+ in RFC 3066 or ISO 639-2 language code format.
+ @param [out] ppDriverName A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ driver specified by This in the language
+ specified by Language.
+
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by
+ This and the language specified by Language was
+ returned in DriverName.
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+GetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL * pThis,
+ IN CHAR8 * pLanguage,
+ OUT CHAR16 ** ppDriverName
+ );
+
+
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by a driver.
+
+ This function retrieves the user readable name of the controller specified by
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the
+ driver specified by This has a user readable name in the language specified by
+ Language, then a pointer to the controller name is returned in ControllerName,
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently
+ managing the controller specified by ControllerHandle and ChildHandle,
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.
+
+ @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param [in] ControllerHandle The handle of a controller that the driver
+ specified by This is managing. This handle
+ specifies the controller whose name is to be
+ returned.
+ @param [in] ChildHandle The handle of the child controller to retrieve
+ the name of. This is an optional parameter that
+ may be NULL. It will be NULL for device
+ drivers. It will also be NULL for a bus drivers
+ that wish to retrieve the name of the bus
+ controller. It will not be NULL for a bus
+ driver that wishes to retrieve the name of a
+ child controller.
+ @param [in] pLanguage A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified in
+ RFC 3066 or ISO 639-2 language code format.
+ @param [out] ppControllerName A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ controller specified by ControllerHandle and
+ ChildHandle in the language specified by
+ Language from the point of view of the driver
+ specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in
+ the language specified by Language for the
+ driver specified by This was returned in
+ DriverName.
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
+ EFI_HANDLE.
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle.
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+GetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL * pThis,
+ IN EFI_HANDLE ControllerHandle,
+ IN OPTIONAL EFI_HANDLE ChildHandle,
+ IN CHAR8 * pLanguage,
+ OUT CHAR16 ** ppControllerName
+ );
+
+VOID
+FillPkt2Queue (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN UINTN BufLength);
+
+//------------------------------------------------------------------------------
+
+#endif // _AX88772_H_
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
new file mode 100644
index 000000000..b1cf56217
--- /dev/null
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
@@ -0,0 +1,72 @@
+#/** @file
+# Component description file for ASIX AX88772 USB/Ethernet driver.
+#
+# This module provides support for the ASIX AX88772 USB/Ethernet adapter.
+# Copyright (c) 2011, 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 = Ax88772b
+ FILE_GUID = 95C8D770-E1A4-4422-B263-E32F14FD8186
+ MODULE_TYPE = DXE_RUNTIME_DRIVER
+ VERSION_STRING = 1.0
+
+ ENTRY_POINT = EntryPoint
+
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ Ax88772.h
+ Ax88772.c
+ ComponentName.c
+ DriverBinding.c
+ SimpleNetwork.c
+
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ UefiLib
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ UefiRuntimeLib
+ UefiDriverEntryPoint
+
+[Protocols]
+ gEfiDevicePathProtocolGuid
+ gEfiSimpleNetworkProtocolGuid
+ gEfiUsbIoProtocolGuid ## TO_START
+
+[Guids]
+ gEfiEventExitBootServicesGuid ## PRODUCES ## Event
+ gEfiEventVirtualAddressChangeGuid ## PRODUCES ## Event
+ gEfiNicIp4ConfigVariableGuid
+
+[Depex]
+ gEfiBdsArchProtocolGuid AND
+ gEfiCpuArchProtocolGuid AND
+ gEfiMetronomeArchProtocolGuid AND
+ gEfiMonotonicCounterArchProtocolGuid AND
+ gEfiRealTimeClockArchProtocolGuid AND
+ gEfiResetArchProtocolGuid AND
+ gEfiRuntimeArchProtocolGuid AND
+ gEfiSecurityArchProtocolGuid AND
+ gEfiTimerArchProtocolGuid AND
+ gEfiVariableWriteArchProtocolGuid AND
+ gEfiVariableArchProtocolGuid AND
+ gEfiWatchdogTimerArchProtocolGuid
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/ComponentName.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/ComponentName.c
new file mode 100644
index 000000000..e78d76bc5
--- /dev/null
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/ComponentName.c
@@ -0,0 +1,181 @@
+/** @file
+ UEFI Component Name(2) protocol implementation.
+
+ Copyright (c) 2011, 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.
+
+**/
+
+#include "Ax88772.h"
+
+/**
+ EFI Component Name Protocol declaration
+**/
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
+ GetDriverName,
+ GetControllerName,
+ "eng"
+};
+
+/**
+ EFI Component Name 2 Protocol declaration
+**/
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GetControllerName,
+ "en"
+};
+
+
+/**
+ Driver name table declaration
+**/
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE
+mDriverNameTable[] = {
+ {"eng;en", L"ASIX AX88772B Ethernet Driver 1.0"},
+ {NULL, NULL}
+};
+
+/**
+ Retrieves a Unicode string that is the user readable name of the driver.
+
+ This function retrieves the user readable name of a driver in the form of a
+ Unicode string. If the driver specified by This has a user readable name in
+ the language specified by Language, then a pointer to the driver name is
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+ by This does not support the language specified by Language,
+ then EFI_UNSUPPORTED is returned.
+
+ @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param [in] pLanguage A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified
+ in RFC 3066 or ISO 639-2 language code format.
+ @param [out] ppDriverName A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ driver specified by This in the language
+ specified by Language.
+
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by
+ This and the language specified by Language was
+ returned in DriverName.
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+GetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL * pThis,
+ IN CHAR8 * pLanguage,
+ OUT CHAR16 ** ppDriverName
+ )
+{
+ EFI_STATUS Status;
+
+ Status = LookupUnicodeString2 (
+ pLanguage,
+ pThis->SupportedLanguages,
+ mDriverNameTable,
+ ppDriverName,
+ (BOOLEAN)(pThis == &gComponentName)
+ );
+
+ return Status;
+}
+
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by a driver.
+
+ This function retrieves the user readable name of the controller specified by
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the
+ driver specified by This has a user readable name in the language specified by
+ Language, then a pointer to the controller name is returned in ControllerName,
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently
+ managing the controller specified by ControllerHandle and ChildHandle,
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.
+
+ @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param [in] ControllerHandle The handle of a controller that the driver
+ specified by This is managing. This handle
+ specifies the controller whose name is to be
+ returned.
+ @param [in] ChildHandle The handle of the child controller to retrieve
+ the name of. This is an optional parameter that
+ may be NULL. It will be NULL for device
+ drivers. It will also be NULL for a bus drivers
+ that wish to retrieve the name of the bus
+ controller. It will not be NULL for a bus
+ driver that wishes to retrieve the name of a
+ child controller.
+ @param [in] pLanguage A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified in
+ RFC 3066 or ISO 639-2 language code format.
+ @param [out] ppControllerName A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ controller specified by ControllerHandle and
+ ChildHandle in the language specified by
+ Language from the point of view of the driver
+ specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in
+ the language specified by Language for the
+ driver specified by This was returned in
+ DriverName.
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
+ EFI_HANDLE.
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle.
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+GetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL * pThis,
+ IN EFI_HANDLE ControllerHandle,
+ IN OPTIONAL EFI_HANDLE ChildHandle,
+ IN CHAR8 * pLanguage,
+ OUT CHAR16 ** ppControllerName
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Set the controller name
+ //
+ *ppControllerName = L"ASIX AX88772B USB Fast Ethernet Controller";
+ Status = EFI_SUCCESS;
+
+ //
+ // Return the operation status
+ //
+
+ return Status;
+}
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
new file mode 100644
index 000000000..076b63963
--- /dev/null
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
@@ -0,0 +1,672 @@
+/** @file
+ Implement the driver binding protocol for Asix AX88772 Ethernet driver.
+
+ Copyright (c) 2011, 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.
+
+**/
+
+#include "Ax88772.h"
+
+/**
+ Verify the controller type
+
+ @param [in] pThis Protocol instance pointer.
+ @param [in] Controller Handle of device to test.
+ @param [in] pRemainingDevicePath Not used.
+
+ @retval EFI_SUCCESS This driver supports this device.
+ @retval other This driver does not support this device.
+
+**/
+EFI_STATUS
+EFIAPI
+DriverSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL * pThis,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL * pRemainingDevicePath
+ )
+{
+ EFI_USB_DEVICE_DESCRIPTOR Device;
+ EFI_USB_IO_PROTOCOL * pUsbIo;
+ EFI_STATUS Status;
+ //
+ // Connect to the USB stack
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ (VOID **) &pUsbIo,
+ pThis->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (!EFI_ERROR ( Status )) {
+
+ //
+ // Get the interface descriptor to check the USB class and find a transport
+ // protocol handler.
+ //
+ Status = pUsbIo->UsbGetDeviceDescriptor ( pUsbIo, &Device );
+ if (EFI_ERROR ( Status )) {
+ Status = EFI_UNSUPPORTED;
+ }
+ else {
+ //
+ // Validate the adapter
+ //
+ if ( VENDOR_ID == Device.IdVendor ) {
+
+ if (PRODUCT_ID == Device.IdProduct) {
+ DEBUG ((EFI_D_INFO, "Found the AX88772B\r\n"));
+ }
+ else {
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+ else {
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+
+ //
+ // Done with the USB stack
+ //
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ }
+ return Status;
+}
+
+
+/**
+ Start this driver on Controller by opening UsbIo and DevicePath protocols.
+ Initialize PXE structures, create a copy of the Controller Device Path with the
+ NIC's MAC address appended to it, install the NetworkInterfaceIdentifier protocol
+ on the newly created Device Path.
+
+ @param [in] pThis Protocol instance pointer.
+ @param [in] Controller Handle of device to work with.
+ @param [in] pRemainingDevicePath Not used, always produce all possible children.
+
+ @retval EFI_SUCCESS This driver is added to Controller.
+ @retval other This driver does not support this device.
+
+**/
+EFI_STATUS
+EFIAPI
+DriverStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL * pThis,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL * pRemainingDevicePath
+ )
+{
+
+ EFI_STATUS Status;
+ NIC_DEVICE *pNicDevice;
+ UINTN LengthInBytes;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath = NULL;
+ MAC_ADDR_DEVICE_PATH MacDeviceNode;
+
+ //
+ // Allocate the device structure
+ //
+ LengthInBytes = sizeof ( *pNicDevice );
+ Status = gBS->AllocatePool (
+ EfiRuntimeServicesData,
+ LengthInBytes,
+ (VOID **) &pNicDevice
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "gBS->AllocatePool:pNicDevice ERROR Status = %r\n", Status));
+ goto EXIT;
+ }
+
+ //
+ // Set the structure signature
+ //
+ ZeroMem ( pNicDevice, LengthInBytes );
+ pNicDevice->Signature = DEV_SIGNATURE;
+
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ (VOID **) &pNicDevice->pUsbIo,
+ pThis->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "gBS->OpenProtocol:EFI_USB_IO_PROTOCOL ERROR Status = %r\n", Status));
+ gBS->FreePool ( pNicDevice );
+ goto EXIT;
+ }
+
+ //
+ // Initialize the simple network protocol
+ //
+ Status = SN_Setup ( pNicDevice );
+
+ if (EFI_ERROR(Status)){
+ DEBUG ((EFI_D_ERROR, "SN_Setup ERROR Status = %r\n", Status));
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->FreePool ( pNicDevice );
+ goto EXIT;
+ }
+
+ //
+ // Set Device Path
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath,
+ pThis->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "gBS->OpenProtocol:EFI_DEVICE_PATH_PROTOCOL error. Status = %r\n",
+ Status));
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->FreePool ( pNicDevice );
+ goto EXIT;
+ }
+
+ ZeroMem (&MacDeviceNode, sizeof (MAC_ADDR_DEVICE_PATH));
+ MacDeviceNode.Header.Type = MESSAGING_DEVICE_PATH;
+ MacDeviceNode.Header.SubType = MSG_MAC_ADDR_DP;
+
+ SetDevicePathNodeLength (&MacDeviceNode.Header, sizeof (MAC_ADDR_DEVICE_PATH));
+
+ CopyMem (&MacDeviceNode.MacAddress,
+ &pNicDevice->SimpleNetworkData.CurrentAddress,
+ PXE_HWADDR_LEN_ETHER);
+
+ MacDeviceNode.IfType = pNicDevice->SimpleNetworkData.IfType;
+
+ pNicDevice->MyDevPath = AppendDevicePathNode (
+ ParentDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) &MacDeviceNode
+ );
+
+ pNicDevice->Controller = NULL;
+
+ //
+ // Install both the simple network and device path protocols.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &pNicDevice->Controller,
+ &gEfiCallerIdGuid,
+ pNicDevice,
+ &gEfiSimpleNetworkProtocolGuid,
+ &pNicDevice->SimpleNetwork,
+ &gEfiDevicePathProtocolGuid,
+ pNicDevice->MyDevPath,
+ NULL
+ );
+
+ if (EFI_ERROR(Status)){
+ DEBUG ((EFI_D_ERROR, "gBS->InstallMultipleProtocolInterfaces error. Status = %r\n",
+ Status));
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller);
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->FreePool ( pNicDevice );
+ goto EXIT;
+ }
+
+ //
+ // Open For Child Device
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ (VOID **) &pNicDevice->pUsbIo,
+ pThis->DriverBindingHandle,
+ pNicDevice->Controller,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+
+ if (EFI_ERROR(Status)){
+ gBS->UninstallMultipleProtocolInterfaces (
+ &pNicDevice->Controller,
+ &gEfiCallerIdGuid,
+ pNicDevice,
+ &gEfiSimpleNetworkProtocolGuid,
+ &pNicDevice->SimpleNetwork,
+ &gEfiDevicePathProtocolGuid,
+ pNicDevice->MyDevPath,
+ NULL
+ );
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller);
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->FreePool ( pNicDevice );
+ }
+
+EXIT:
+ return Status;
+
+}
+
+/**
+ Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and
+ closing the DevicePath and PciIo protocols on Controller.
+
+ @param [in] pThis Protocol instance pointer.
+ @param [in] Controller Handle of device to stop driver on.
+ @param [in] NumberOfChildren How many children need to be stopped.
+ @param [in] pChildHandleBuffer Not used.
+
+ @retval EFI_SUCCESS This driver is removed Controller.
+ @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
+ @retval other This driver was not removed from this device.
+
+**/
+EFI_STATUS
+EFIAPI
+DriverStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL * pThis,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE * ChildHandleBuffer
+ )
+{
+ BOOLEAN AllChildrenStopped;
+ UINTN Index;
+ EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNetwork;
+ EFI_STATUS Status = EFI_SUCCESS;
+ NIC_DEVICE *pNicDevice;
+
+ //
+ // Complete all outstanding transactions to Controller.
+ // Don't allow any new transaction to Controller to be started.
+ //
+ if (NumberOfChildren == 0) {
+
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiSimpleNetworkProtocolGuid,
+ (VOID **) &SimpleNetwork,
+ pThis->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR(Status)) {
+ //
+ // This is a 2nd type handle(multi-lun root), it needs to close devicepath
+ // and usbio protocol.
+ //
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ return EFI_SUCCESS;
+ }
+
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( SimpleNetwork );
+
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ Controller,
+ &gEfiCallerIdGuid,
+ pNicDevice,
+ &gEfiSimpleNetworkProtocolGuid,
+ &pNicDevice->SimpleNetwork,
+ &gEfiDevicePathProtocolGuid,
+ pNicDevice->MyDevPath,
+ NULL
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // Close the bus driver
+ //
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+
+ if (EFI_ERROR(Status)){
+ DEBUG ((EFI_D_ERROR, "driver stop: gBS->CloseProtocol:EfiDevicePathProtocol error. Status %r\n", Status));
+ }
+
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+
+ if (EFI_ERROR(Status)){
+ DEBUG ((EFI_D_ERROR, "driver stop: gBS->CloseProtocol:EfiUsbIoProtocol error. Status %r\n", Status));
+ }
+ return EFI_SUCCESS;
+ }
+ AllChildrenStopped = TRUE;
+
+ for (Index = 0; Index < NumberOfChildren; Index++) {
+
+ Status = gBS->OpenProtocol (
+ ChildHandleBuffer[Index],
+ &gEfiSimpleNetworkProtocolGuid,
+ (VOID **) &SimpleNetwork,
+ pThis->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR (Status)) {
+ AllChildrenStopped = FALSE;
+ DEBUG ((EFI_D_ERROR, "Fail to stop No.%d multi-lun child handle when opening SimpleNetwork\n", (UINT32)Index));
+ continue;
+ }
+
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( SimpleNetwork );
+
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ ChildHandleBuffer[Index]
+ );
+
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ ChildHandleBuffer[Index],
+ &gEfiCallerIdGuid,
+ pNicDevice,
+ &gEfiSimpleNetworkProtocolGuid,
+ &pNicDevice->SimpleNetwork,
+ &gEfiDevicePathProtocolGuid,
+ pNicDevice->MyDevPath,
+ NULL
+ );
+
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ (VOID **) &pNicDevice->pUsbIo,
+ pThis->DriverBindingHandle,
+ ChildHandleBuffer[Index],
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ }
+ else {
+ int i;
+ RX_PKT * pCurr = pNicDevice->QueueHead;
+ RX_PKT * pFree;
+
+ for ( i = 0 ; i < MAX_QUEUE_SIZE ; i++) {
+ if ( NULL != pCurr ) {
+ pFree = pCurr;
+ pCurr = pCurr->pNext;
+ gBS->FreePool (pFree);
+ }
+ }
+
+ if ( NULL != pNicDevice->pRxTest)
+ gBS->FreePool (pNicDevice->pRxTest);
+
+ if ( NULL != pNicDevice->pTxTest)
+ gBS->FreePool (pNicDevice->pTxTest);
+
+ if ( NULL != pNicDevice->MyDevPath)
+ gBS->FreePool (pNicDevice->MyDevPath);
+
+ if ( NULL != pNicDevice)
+ gBS->FreePool (pNicDevice);
+ }
+ }
+
+ if (!AllChildrenStopped) {
+ return EFI_DEVICE_ERROR;
+ }
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Driver binding protocol declaration
+**/
+EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
+ DriverSupported,
+ DriverStart,
+ DriverStop,
+ 0xa,
+ NULL,
+ NULL
+};
+
+
+/**
+ Ax88772 driver unload routine.
+
+ @param [in] ImageHandle Handle for the image.
+
+ @retval EFI_SUCCESS Image may be unloaded
+
+**/
+EFI_STATUS
+EFIAPI
+DriverUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ UINTN BufferSize;
+ UINTN Index;
+ UINTN Max;
+ EFI_HANDLE * pHandle;
+ EFI_STATUS Status;
+
+ //
+ // Determine which devices are using this driver
+ //
+ BufferSize = 0;
+ pHandle = NULL;
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiCallerIdGuid,
+ NULL,
+ &BufferSize,
+ NULL );
+ if ( EFI_BUFFER_TOO_SMALL == Status ) {
+ for ( ; ; ) {
+ //
+ // One or more block IO devices are present
+ //
+ Status = gBS->AllocatePool (
+ EfiRuntimeServicesData,
+ BufferSize,
+ (VOID **) &pHandle
+ );
+ if ( EFI_ERROR ( Status )) {
+ DEBUG ((EFI_D_ERROR, "Insufficient memory, failed handle buffer allocation\r\n"));
+ break;
+ }
+
+ //
+ // Locate the block IO devices
+ //
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiCallerIdGuid,
+ NULL,
+ &BufferSize,
+ pHandle );
+ if ( EFI_ERROR ( Status )) {
+ //
+ // Error getting handles
+ //
+ break;
+ }
+
+ //
+ // Remove any use of the driver
+ //
+ Max = BufferSize / sizeof ( pHandle[ 0 ]);
+ for ( Index = 0; Max > Index; Index++ ) {
+ Status = DriverStop ( &gDriverBinding,
+ pHandle[ Index ],
+ 0,
+ NULL );
+ if ( EFI_ERROR ( Status )) {
+ DEBUG ((EFI_D_ERROR, "WARNING - Failed to shutdown the driver on handle %08x\r\n", pHandle[ Index ]));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ else {
+ if ( EFI_NOT_FOUND == Status ) {
+ //
+ // No devices were found
+ //
+ Status = EFI_SUCCESS;
+ }
+ }
+
+ //
+ // Free the handle array
+ //
+ if ( NULL != pHandle ) {
+ gBS->FreePool ( pHandle );
+ }
+
+ //
+ // Remove the protocols installed by the EntryPoint routine.
+ //
+ if ( !EFI_ERROR ( Status )) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ ImageHandle,
+ &gEfiDriverBindingProtocolGuid,
+ &gDriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ &gComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ &gComponentName2,
+ NULL
+ );
+
+ DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,
+ "Removed: gEfiComponentName2ProtocolGuid from 0x%08x\r\n",
+ ImageHandle ));
+ DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,
+ "Removed: gEfiComponentNameProtocolGuid from 0x%08x\r\n",
+ ImageHandle ));
+ DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,
+ "Removed: gEfiDriverBindingProtocolGuid from 0x%08x\r\n",
+ ImageHandle ));
+
+ }
+
+ return Status;
+}
+
+
+/**
+Ax88772 driver entry point.
+
+@param [in] ImageHandle Handle for the image.
+@param [in] pSystemTable Address of the system table.
+
+@retval EFI_SUCCESS Image successfully loaded.
+
+**/
+EFI_STATUS
+EFIAPI
+EntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * pSystemTable
+ )
+{
+ EFI_LOADED_IMAGE_PROTOCOL * pLoadedImage;
+ EFI_STATUS Status;
+
+ //
+ // Enable unload support
+ //
+ Status = gBS->HandleProtocol (
+ gImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&pLoadedImage
+ );
+ if (!EFI_ERROR (Status)) {
+ pLoadedImage->Unload = DriverUnload;
+ }
+
+ //
+ // Add the driver to the list of drivers
+ //
+ Status = EfiLibInstallDriverBindingComponentName2 (
+ ImageHandle,
+ pSystemTable,
+ &gDriverBinding,
+ ImageHandle,
+ &gComponentName,
+ &gComponentName2
+ );
+ if ( !EFI_ERROR ( Status )) {
+
+ AsciiPrint ("Installed: gEfiDriverBindingProtocolGuid on 0x%08x\r\n",
+ ImageHandle );
+ AsciiPrint("Installed: gEfiComponentNameProtocolGuid on 0x%08x\r\n",
+ ImageHandle );
+ AsciiPrint("Installed: gEfiComponentName2ProtocolGuid on 0x%08x\r\n",
+ ImageHandle );
+
+ }
+ return Status;
+}
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/SimpleNetwork.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/SimpleNetwork.c
new file mode 100644
index 000000000..be7516183
--- /dev/null
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/SimpleNetwork.c
@@ -0,0 +1,1574 @@
+/** @file
+ Provides the Simple Network functions.
+
+ Copyright (c) 2011, 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.
+
+**/
+
+#include "Ax88772.h"
+
+/**
+ This function updates the filtering on the receiver.
+
+ This support routine calls ::Ax88772MacAddressSet to update
+ the MAC address. This routine then rebuilds the multicast
+ hash by calling ::Ax88772MulticastClear and ::Ax88772MulticastSet.
+ Finally this routine enables the receiver by calling
+ ::Ax88772RxControl.
+
+ @param [in] pSimpleNetwork Simple network mode pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+ReceiveFilterUpdate (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ NIC_DEVICE * pNicDevice;
+ EFI_STATUS Status;
+ UINT32 Index;
+
+ //
+ // Set the MAC address
+ //
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ pMode = pSimpleNetwork->Mode;
+
+ //
+ // Clear the multicast hash table
+ //
+ Ax88772MulticastClear ( pNicDevice );
+
+ //
+ // Load the multicast hash table
+ //
+ if ( 0 != ( pMode->ReceiveFilterSetting & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST )) {
+ for ( Index = 0; Index < pMode->MCastFilterCount; Index++ ) {
+ //
+ // Enable the next multicast address
+ //
+ Ax88772MulticastSet ( pNicDevice,
+ &pMode->MCastFilter[ Index ].Addr[0]);
+ }
+ }
+
+ Status = Ax88772RxControl ( pNicDevice, pMode->ReceiveFilterSetting );
+
+ return Status;
+}
+
+
+/**
+ This function updates the SNP driver status.
+
+ This function gets the current interrupt and recycled transmit
+ buffer status from the network interface. The interrupt status
+ and the media status are returned as a bit mask in InterruptStatus.
+ If InterruptStatus is NULL, the interrupt status will not be read.
+ Upon successful return of the media status, the MediaPresent field
+ of EFI_SIMPLE_NETWORK_MODE will be updated to reflect any change
+ of media status. If TxBuf is not NULL, a recycled transmit buffer
+ address will be retrived. If a recycled transmit buffer address
+ is returned in TxBuf, then the buffer has been successfully
+ transmitted, and the status for that buffer is cleared.
+
+ This function calls ::Ax88772Rx to update the media status and
+ queue any receive packets.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] pInterruptStatus A pointer to the bit mask of the current active interrupts.
+ If this is NULL, the interrupt status will not be read from
+ the device. If this is not NULL, the interrupt status will
+ be read from teh device. When the interrupt status is read,
+ it will also be cleared. Clearing the transmit interrupt
+ does not empty the recycled transmit buffer array.
+ @param [out] ppTxBuf Recycled transmit buffer address. The network interface will
+ not transmit if its internal recycled transmit buffer array is
+ full. Reading the transmit buffer does not clear the transmit
+ interrupt. If this is NULL, then the transmit buffer status
+ will not be read. If there are not transmit buffers to recycle
+ and TxBuf is not NULL, *TxBuf will be set to NULL.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_GetStatus (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ OUT UINT32 * pInterruptStatus,
+ OUT VOID ** ppTxBuf
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ NIC_DEVICE * pNicDevice;
+ EFI_STATUS Status;
+ BOOLEAN bFullDuplex;
+ BOOLEAN bLinkUp;
+ BOOLEAN bSpeed100;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ //
+ // Return the transmit buffer
+ //
+
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ if (( NULL != ppTxBuf ) && ( NULL != pNicDevice->pTxBuffer )) {
+ *ppTxBuf = pNicDevice->pTxBuffer;
+ pNicDevice->pTxBuffer = NULL;
+ }
+
+ //
+ // Determine if interface is running
+ //
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkInitialized == pMode->State ) {
+
+ if ( pNicDevice->LinkIdleCnt > MAX_LINKIDLE_THRESHOLD) {
+
+ bLinkUp = pNicDevice->bLinkUp;
+ bSpeed100 = pNicDevice->b100Mbps;
+ bFullDuplex = pNicDevice->bFullDuplex;
+ Status = Ax88772NegotiateLinkComplete ( pNicDevice,
+ &pNicDevice->PollCount,
+ &pNicDevice->bComplete,
+ &pNicDevice->bLinkUp,
+ &pNicDevice->b100Mbps,
+ &pNicDevice->bFullDuplex );
+
+ //
+ // Determine if the autonegotiation is complete
+ //
+ if ( pNicDevice->bComplete ) {
+ if ( pNicDevice->bLinkUp ) {
+ if (( bSpeed100 && ( !pNicDevice->b100Mbps ))
+ || (( !bSpeed100 ) && pNicDevice->b100Mbps )
+ || ( bFullDuplex && ( !pNicDevice->bFullDuplex ))
+ || (( !bFullDuplex ) && pNicDevice->bFullDuplex )) {
+ pNicDevice->PollCount = 0;
+ DEBUG (( EFI_D_INFO , "Reset to establish proper link setup: %d Mbps, %a duplex\r\n",
+ pNicDevice->b100Mbps ? 100 : 10, pNicDevice->bFullDuplex ? "Full" : "Half"));
+ Status = SN_Reset ( &pNicDevice->SimpleNetwork, FALSE );
+ }
+ if (( !bLinkUp ) && pNicDevice->bLinkUp ) {
+ //
+ // Display the autonegotiation status
+ //
+ DEBUG (( EFI_D_INFO , "Link: Up, %d Mbps, %a duplex\r\n",
+ pNicDevice->b100Mbps ? 100 : 10, pNicDevice->bFullDuplex ? "Full" : "Half"));
+
+ }
+ pNicDevice->LinkIdleCnt = 0;
+ }
+ }
+ //
+ // Update the link status
+ //
+ if ( bLinkUp && ( !pNicDevice->bLinkUp )) {
+ DEBUG (( EFI_D_INFO , "Link: Down\r\n"));
+ }
+ }
+
+ pMode->MediaPresent = pNicDevice->bLinkUp;
+ //
+ // Return the interrupt status
+ //
+ if ( NULL != pInterruptStatus ) {
+ *pInterruptStatus = 0;
+ }
+ Status = EFI_SUCCESS;
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+ gBS->RestoreTPL(TplPrevious) ;
+
+ return Status;
+}
+
+
+/**
+ Resets the network adapter and allocates the transmit and receive buffers
+ required by the network interface; optionally, also requests allocation of
+ additional transmit and receive buffers. This routine must be called before
+ any other routine in the Simple Network protocol is called.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] ExtraRxBufferSize Size in bytes to add to the receive buffer allocation
+ @param [in] ExtraTxBufferSize Size in bytes to add to the transmit buffer allocation
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_OUT_OF_RESORUCES There was not enough memory for the transmit and receive buffers
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Initialize (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN UINTN ExtraRxBufferSize,
+ IN UINTN ExtraTxBufferSize
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ EFI_STATUS Status;
+ UINT32 TmpState;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL (TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ //
+ // Determine if the interface is already started
+ //
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkStarted == pMode->State ) {
+ if (( 0 == ExtraRxBufferSize ) && ( 0 == ExtraTxBufferSize )) {
+ //
+ // Start the adapter
+ //
+ TmpState = pMode->State;
+ pMode->State = EfiSimpleNetworkInitialized;
+ Status = SN_Reset ( pSimpleNetwork, FALSE );
+ if ( EFI_ERROR ( Status )) {
+ //
+ // Update the network state
+ //
+ pMode->State = TmpState;
+ DEBUG (( EFI_D_ERROR , "SN_reset failed\n"));
+ }
+ }
+ else {
+ DEBUG (( EFI_D_ERROR , "Increase ExtraRxBufferSize = %d ExtraTxBufferSize=%d\n",
+ ExtraRxBufferSize, ExtraTxBufferSize));
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+ gBS->RestoreTPL (TplPrevious);
+
+ return Status;
+}
+
+
+/**
+ This function converts a multicast IP address to a multicast HW MAC address
+ for all packet transactions.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bIPv6 Set to TRUE if the multicast IP address is IPv6 [RFC2460].
+ Set to FALSE if the multicast IP address is IPv4 [RFC 791].
+ @param [in] pIP The multicast IP address that is to be converted to a
+ multicast HW MAC address.
+ @param [in] pMAC The multicast HW MAC address that is to be generated from IP.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_MCastIPtoMAC (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bIPv6,
+ IN EFI_IP_ADDRESS * pIP,
+ IN EFI_MAC_ADDRESS * pMAC
+ )
+{
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Get pointer to SNP driver instance for *this.
+ //
+ if (pSimpleNetwork == NULL) {
+ gBS->RestoreTPL(TplPrevious);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (pIP == NULL || pMAC == NULL) {
+ gBS->RestoreTPL(TplPrevious);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (bIPv6){
+ Status = EFI_UNSUPPORTED;
+ }
+ else {
+ //
+ // check if the ip given is a mcast IP
+ //
+ if ((pIP->v4.Addr[0] & 0xF0) != 0xE0) {
+ gBS->RestoreTPL(TplPrevious);
+ return EFI_INVALID_PARAMETER;
+ }
+ else {
+ pMAC->Addr[0] = 0x01;
+ pMAC->Addr[1] = 0x00;
+ pMAC->Addr[2] = 0x5e;
+ pMAC->Addr[3] = (UINT8) (pIP->v4.Addr[1] & 0x7f);
+ pMAC->Addr[4] = (UINT8) pIP->v4.Addr[2];
+ pMAC->Addr[5] = (UINT8) pIP->v4.Addr[3];
+ Status = EFI_SUCCESS;
+ gBS->RestoreTPL(TplPrevious);
+ }
+ }
+ return Status;
+}
+
+
+/**
+ This function performs read and write operations on the NVRAM device
+ attached to a network interface.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] ReadWrite TRUE for read operations, FALSE for write operations.
+ @param [in] Offset Byte offset in the NVRAM device at which to start the
+ read or write operation. This must be a multiple of
+ NvRamAccessSize and less than NvRamSize.
+ @param [in] BufferSize The number of bytes to read or write from the NVRAM device.
+ This must also be a multiple of NvramAccessSize.
+ @param [in, out] pBuffer A pointer to the data buffer.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_NvData (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN ReadWrite,
+ IN UINTN Offset,
+ IN UINTN BufferSize,
+ IN OUT VOID * pBuffer
+ )
+{
+ EFI_STATUS Status;
+ //
+ // This is not currently supported
+ //
+ Status = EFI_UNSUPPORTED;
+ return Status;
+}
+
+VOID
+FillPkt2Queue (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN UINTN BufLength)
+{
+
+ UINT16 * pLength;
+ UINT16 * pLengthBar;
+ UINT8* pData;
+ UINT32 offset;
+ NIC_DEVICE * pNicDevice;
+
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork);
+ for ( offset = 0; offset < BufLength; ){
+ pLength = (UINT16*) (pNicDevice->pBulkInBuff + offset);
+ pLengthBar = (UINT16*) (pNicDevice->pBulkInBuff + offset +2);
+
+ *pLength &= 0x7ff;
+ *pLengthBar &= 0x7ff;
+ *pLengthBar |= 0xf800;
+
+ if ((*pLength ^ *pLengthBar ) != 0xFFFF) {
+ DEBUG (( EFI_D_ERROR , "Pkt length error. BufLength = %d\n", BufLength));
+ return;
+ }
+
+ if (TRUE == pNicDevice->pNextFill->f_Used) {
+ return;
+ }
+ else {
+ pData = pNicDevice->pBulkInBuff + offset + 4;
+ pNicDevice->pNextFill->f_Used = TRUE;
+ pNicDevice->pNextFill->Length = *pLength;
+ CopyMem (&pNicDevice->pNextFill->Data[0], pData, *pLength);
+
+ pNicDevice->pNextFill = pNicDevice->pNextFill->pNext;
+ offset += ((*pLength + HW_HDR_LENGTH - 1) &~3) + 1;
+ pNicDevice->PktCntInQueue++;
+ }
+
+ }
+}
+
+EFI_STATUS
+EFIAPI
+SN_Receive (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ OUT UINTN * pHeaderSize,
+ OUT UINTN * pBufferSize,
+ OUT VOID * pBuffer,
+ OUT EFI_MAC_ADDRESS * pSrcAddr,
+ OUT EFI_MAC_ADDRESS * pDestAddr,
+ OUT UINT16 * pProtocol
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ NIC_DEVICE * pNicDevice;
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+ UINT16 Type;
+ EFI_USB_IO_PROTOCOL *pUsbIo;
+ UINTN LengthInBytes;
+ UINT32 TransferStatus;
+ RX_PKT * pFirstFill;
+ TplPrevious = gBS->RaiseTPL (TPL_CALLBACK);
+
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ //
+ // The interface must be running
+ //
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkInitialized == pMode->State ) {
+ //
+ // Update the link status
+ //
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ pNicDevice->LinkIdleCnt++;
+ pMode->MediaPresent = pNicDevice->bLinkUp;
+
+ if ( pMode->MediaPresent && pNicDevice->bComplete) {
+
+
+ if (pNicDevice->PktCntInQueue != 0 ) {
+ DEBUG (( EFI_D_INFO, "pNicDevice->PktCntInQueue = %d\n",
+ pNicDevice->PktCntInQueue));
+ }
+
+ LengthInBytes = MAX_BULKIN_SIZE;
+ if (pNicDevice->PktCntInQueue == 0 ){
+ //
+ // Attempt to do bulk in
+ //
+ SetMem (&pNicDevice->pBulkInBuff[0], 4, 0);
+ pUsbIo = pNicDevice->pUsbIo;
+ Status = pUsbIo->UsbBulkTransfer ( pUsbIo,
+ USB_ENDPOINT_DIR_IN | BULK_IN_ENDPOINT,
+ &pNicDevice->pBulkInBuff[0],
+ &LengthInBytes,
+ BULKIN_TIMEOUT,
+ &TransferStatus );
+
+ if (LengthInBytes != 0 && !EFI_ERROR(Status) && !EFI_ERROR(TransferStatus) ){
+ FillPkt2Queue(pSimpleNetwork, LengthInBytes);
+ }
+ }
+
+ pFirstFill = pNicDevice->pFirstFill;
+
+ if (TRUE == pFirstFill->f_Used) {
+ ETHERNET_HEADER * pHeader;
+ pNicDevice->LinkIdleCnt = 0;
+ CopyMem (pBuffer, &pFirstFill->Data[0], pFirstFill->Length);
+ pHeader = (ETHERNET_HEADER *) &pFirstFill->Data[0];
+
+ DEBUG (( EFI_D_INFO, "RX: %02x-%02x-%02x-%02x-%02x-%02x "
+ "%02x-%02x-%02x-%02x-%02x-%02x %02x-%02x %d bytes\r\n",
+ pFirstFill->Data[0],
+ pFirstFill->Data[1],
+ pFirstFill->Data[2],
+ pFirstFill->Data[3],
+ pFirstFill->Data[4],
+ pFirstFill->Data[5],
+ pFirstFill->Data[6],
+ pFirstFill->Data[7],
+ pFirstFill->Data[8],
+ pFirstFill->Data[9],
+ pFirstFill->Data[10],
+ pFirstFill->Data[11],
+ pFirstFill->Data[12],
+ pFirstFill->Data[13],
+ pFirstFill->Length));
+
+ if ( NULL != pHeaderSize ) {
+ *pHeaderSize = sizeof ( *pHeader );
+ }
+ if ( NULL != pDestAddr ) {
+ CopyMem ( pDestAddr, &pHeader->dest_addr, PXE_HWADDR_LEN_ETHER );
+ }
+ if ( NULL != pSrcAddr ) {
+ CopyMem ( pSrcAddr, &pHeader->src_addr, PXE_HWADDR_LEN_ETHER );
+ }
+ if ( NULL != pProtocol ) {
+ Type = pHeader->type;
+ Type = (UINT16)(( Type >> 8 ) | ( Type << 8 ));
+ *pProtocol = Type;
+ }
+ Status = EFI_SUCCESS;
+ if (*pBufferSize < pFirstFill->Length) {
+ DEBUG (( EFI_D_ERROR, "RX: Buffer was too small"));
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+ *pBufferSize = pFirstFill->Length;
+ pFirstFill->f_Used = FALSE;
+ pNicDevice->pFirstFill = pFirstFill->pNext;
+ pNicDevice->PktCntInQueue--;
+ }
+ else {
+ pNicDevice->LinkIdleCnt++;
+ Status = EFI_NOT_READY;
+ }
+ }
+ else {
+ //
+ // Link no up
+ //
+ pNicDevice->LinkIdleCnt++;
+ Status = EFI_NOT_READY;
+ }
+
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+ gBS->RestoreTPL (TplPrevious);
+ return Status;
+}
+
+/**
+ This function is used to enable and disable the hardware and software receive
+ filters for the underlying network device.
+
+ The receive filter change is broken down into three steps:
+
+ 1. The filter mask bits that are set (ON) in the Enable parameter
+ are added to the current receive filter settings.
+
+ 2. The filter mask bits that are set (ON) in the Disable parameter
+ are subtracted from the updated receive filter settins.
+
+ 3. If the resulting filter settigns is not supported by the hardware
+ a more liberal setting is selected.
+
+ If the same bits are set in the Enable and Disable parameters, then the bits
+ in the Disable parameter takes precedence.
+
+ If the ResetMCastFilter parameter is TRUE, then the multicast address list
+ filter is disabled (irregardless of what other multicast bits are set in
+ the enable and Disable parameters). The SNP->Mode->MCastFilterCount field
+ is set to zero. The SNP->Mode->MCastFilter contents are undefined.
+
+ After enableing or disabling receive filter settings, software should
+ verify the new settings by checking the SNP->Mode->ReceeiveFilterSettings,
+ SNP->Mode->MCastFilterCount and SNP->Mode->MCastFilter fields.
+
+ Note: Some network drivers and/or devices will automatically promote
+ receive filter settings if the requested setting can not be honored.
+ For example, if a request for four multicast addresses is made and
+ the underlying hardware only supports two multicast addresses the
+ driver might set the promiscuous or promiscuous multicast receive filters
+ instead. The receiving software is responsible for discarding any extra
+ packets that get through the hardware receive filters.
+
+ If ResetMCastFilter is TRUE, then the multicast receive filter list
+ on the network interface will be reset to the default multicast receive
+ filter list. If ResetMCastFilter is FALSE, and this network interface
+ allows the multicast receive filter list to be modified, then the
+ MCastFilterCnt and MCastFilter are used to update the current multicast
+ receive filter list. The modified receive filter list settings can be
+ found in the MCastFilter field of EFI_SIMPLE_NETWORK_MODE.
+
+ This routine calls ::ReceiveFilterUpdate to update the receive
+ state in the network adapter.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] Enable A bit mask of receive filters to enable on the network interface.
+ @param [in] Disable A bit mask of receive filters to disable on the network interface.
+ For backward compatibility with EFI 1.1 platforms, the
+ EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit must be set
+ when the ResetMCastFilter parameter is TRUE.
+ @param [in] bResetMCastFilter Set to TRUE to reset the contents of the multicast receive
+ filters on the network interface to their default values.
+ @param [in] MCastFilterCnt Number of multicast HW MAC address in the new MCastFilter list.
+ This value must be less than or equal to the MaxMCastFilterCnt
+ field of EFI_SIMPLE_NETWORK_MODE. This field is optional if
+ ResetMCastFilter is TRUE.
+ @param [in] pMCastFilter A pointer to a list of new multicast receive filter HW MAC
+ addresses. This list will replace any existing multicast
+ HW MAC address list. This field is optional if ResetMCastFilter
+ is TRUE.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_ReceiveFilters (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN UINT32 Enable,
+ IN UINT32 Disable,
+/*
+#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
+#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
+#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
+#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
+#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
+*/
+ IN BOOLEAN bResetMCastFilter,
+ IN UINTN MCastFilterCnt,
+ IN EFI_MAC_ADDRESS * pMCastFilter
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ EFI_STATUS Status = EFI_SUCCESS;
+ EFI_TPL TplPrevious;
+ NIC_DEVICE * pNicDevice;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ pMode = pSimpleNetwork->Mode;
+
+ if (pSimpleNetwork == NULL) {
+ gBS->RestoreTPL(TplPrevious);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (pMode->State) {
+ case EfiSimpleNetworkInitialized:
+ break;
+ case EfiSimpleNetworkStopped:
+ Status = EFI_NOT_STARTED;
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+ default:
+ Status = EFI_DEVICE_ERROR;
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+ }
+
+ //
+ // check if we are asked to enable or disable something that the UNDI
+ // does not even support!
+ //
+ if (((Enable &~pMode->ReceiveFilterMask) != 0) ||
+ ((Disable &~pMode->ReceiveFilterMask) != 0)) {
+ Status = EFI_INVALID_PARAMETER;
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+ }
+
+ if (bResetMCastFilter) {
+ Disable |= (EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST & pMode->ReceiveFilterMask);
+ pMode->MCastFilterCount = 0;
+ if ( (0 == (pMode->ReceiveFilterSetting & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST))
+ && Enable == 0 && Disable == 2) {
+ gBS->RestoreTPL(TplPrevious);
+ return EFI_SUCCESS;
+ }
+ }
+ else {
+ if (MCastFilterCnt != 0) {
+ UINTN i;
+ EFI_MAC_ADDRESS * pMulticastAddress;
+ pMulticastAddress = pMCastFilter;
+
+ if ((MCastFilterCnt > pMode->MaxMCastFilterCount) ||
+ (pMCastFilter == NULL)) {
+ Status = EFI_INVALID_PARAMETER;
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+ }
+
+ for ( i = 0 ; i < MCastFilterCnt ; i++ ) {
+ UINT8 tmp;
+ tmp = pMulticastAddress->Addr[0];
+ if ( (tmp & 0x01) != 0x01 ) {
+ gBS->RestoreTPL(TplPrevious);
+ return EFI_INVALID_PARAMETER;
+ }
+ pMulticastAddress++;
+ }
+
+ pMode->MCastFilterCount = (UINT32)MCastFilterCnt;
+ CopyMem (&pMode->MCastFilter[0],
+ pMCastFilter,
+ MCastFilterCnt * sizeof ( EFI_MAC_ADDRESS));
+ }
+ }
+
+ if (Enable == 0 && Disable == 0 && !bResetMCastFilter && MCastFilterCnt == 0) {
+ Status = EFI_SUCCESS;
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+ }
+
+ if ((Enable & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0 && MCastFilterCnt == 0) {
+ Status = EFI_INVALID_PARAMETER;
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+ }
+
+ pMode->ReceiveFilterSetting |= Enable;
+ pMode->ReceiveFilterSetting &= ~Disable;
+ Status = ReceiveFilterUpdate (pSimpleNetwork);
+
+ if (EFI_DEVICE_ERROR == Status || EFI_INVALID_PARAMETER == Status)
+ Status = EFI_SUCCESS;
+
+ gBS->RestoreTPL(TplPrevious);
+ return Status;
+}
+
+/**
+ Reset the network adapter.
+
+ Resets a network adapter and reinitializes it with the parameters that
+ were provided in the previous call to Initialize (). The transmit and
+ receive queues are cleared. Receive filters, the station address, the
+ statistics, and the multicast-IP-to-HW MAC addresses are not reset by
+ this call.
+
+ This routine calls ::Ax88772Reset to perform the adapter specific
+ reset operation. This routine also starts the link negotiation
+ by calling ::Ax88772NegotiateLinkStart.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bExtendedVerification Indicates that the driver may perform a more
+ exhaustive verification operation of the device
+ during reset.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Reset (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bExtendedVerification
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ NIC_DEVICE * pNicDevice;
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkInitialized == pMode->State ) {
+ //
+ // Update the device state
+ //
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ pNicDevice->bComplete = FALSE;
+ pNicDevice->bLinkUp = FALSE;
+ pNicDevice->bHavePkt = FALSE;
+ pMode = pSimpleNetwork->Mode;
+ pMode->MediaPresent = FALSE;
+
+ //
+ // Reset the device
+ //
+ Status = Ax88772Reset ( pNicDevice );
+ if ( !EFI_ERROR ( Status )) {
+ //
+ // Update the receive filters in the adapter
+ //
+ Status = ReceiveFilterUpdate ( pSimpleNetwork );
+
+ //
+ // Try to get a connection to the network
+ //
+ if ( !EFI_ERROR ( Status )) {
+ //
+ // Start the autonegotiation
+ //
+ Status = Ax88772NegotiateLinkStart ( pNicDevice );
+ }
+ }
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+ gBS->RestoreTPL ( TplPrevious );
+ return Status;
+}
+
+/**
+ Initialize the simple network protocol.
+
+ This routine calls ::Ax88772MacAddressGet to obtain the
+ MAC address.
+
+ @param [in] pNicDevice NIC_DEVICE_INSTANCE pointer
+
+ @retval EFI_SUCCESS Setup was successful
+
+**/
+EFI_STATUS
+SN_Setup (
+ IN NIC_DEVICE * pNicDevice
+ )
+{
+
+
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork;
+ EFI_STATUS Status;
+ RX_PKT * pCurr = NULL;
+ RX_PKT * pPrev = NULL;
+
+ pSimpleNetwork = &pNicDevice->SimpleNetwork;
+ pSimpleNetwork->Revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;
+ pSimpleNetwork->Start = (EFI_SIMPLE_NETWORK_START)SN_Start;
+ pSimpleNetwork->Stop = (EFI_SIMPLE_NETWORK_STOP)SN_Stop;
+ pSimpleNetwork->Initialize = (EFI_SIMPLE_NETWORK_INITIALIZE)SN_Initialize;
+ pSimpleNetwork->Reset = (EFI_SIMPLE_NETWORK_RESET)SN_Reset;
+ pSimpleNetwork->Shutdown = (EFI_SIMPLE_NETWORK_SHUTDOWN)SN_Shutdown;
+ pSimpleNetwork->ReceiveFilters = (EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)SN_ReceiveFilters;
+ pSimpleNetwork->StationAddress = (EFI_SIMPLE_NETWORK_STATION_ADDRESS)SN_StationAddress;
+ pSimpleNetwork->Statistics = (EFI_SIMPLE_NETWORK_STATISTICS)SN_Statistics;
+ pSimpleNetwork->MCastIpToMac = (EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)SN_MCastIPtoMAC;
+ pSimpleNetwork->NvData = (EFI_SIMPLE_NETWORK_NVDATA)SN_NvData;
+ pSimpleNetwork->GetStatus = (EFI_SIMPLE_NETWORK_GET_STATUS)SN_GetStatus;
+ pSimpleNetwork->Transmit = (EFI_SIMPLE_NETWORK_TRANSMIT)SN_Transmit;
+ pSimpleNetwork->Receive = (EFI_SIMPLE_NETWORK_RECEIVE)SN_Receive;
+ pSimpleNetwork->WaitForPacket = NULL;
+ pMode = &pNicDevice->SimpleNetworkData;
+ pSimpleNetwork->Mode = pMode;
+ pMode->State = EfiSimpleNetworkStopped;
+ pMode->HwAddressSize = PXE_HWADDR_LEN_ETHER;
+ pMode->MediaHeaderSize = sizeof ( ETHERNET_HEADER );
+ pMode->MaxPacketSize = MAX_ETHERNET_PKT_SIZE;
+ pMode->NvRamSize = 0;
+ pMode->NvRamAccessSize = 0;
+ pMode->ReceiveFilterMask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS
+ | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
+ pMode->ReceiveFilterSetting = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;
+ pMode->MaxMCastFilterCount = MAX_MCAST_FILTER_CNT;
+ pMode->MCastFilterCount = 0;
+ SetMem ( &pMode->BroadcastAddress,
+ PXE_HWADDR_LEN_ETHER,
+ 0xff );
+ pMode->IfType = EfiNetworkInterfaceUndi;
+ pMode->MacAddressChangeable = TRUE;
+ pMode->MultipleTxSupported = FALSE;
+ pMode->MediaPresentSupported = TRUE;
+ pMode->MediaPresent = FALSE;
+ pNicDevice->LinkIdleCnt = 0;
+ //
+ // Read the MAC address
+ //
+ pNicDevice->PhyId = PHY_ID_INTERNAL;
+ pNicDevice->b100Mbps = TRUE;
+ pNicDevice->bFullDuplex = TRUE;
+
+ Status = Ax88772MacAddressGet (
+ pNicDevice,
+ &pMode->PermanentAddress.Addr[0]);
+
+ if ( !EFI_ERROR ( Status )) {
+ int i;
+ //
+ // Use the hardware address as the current address
+ //
+
+ CopyMem ( &pMode->CurrentAddress,
+ &pMode->PermanentAddress,
+ PXE_HWADDR_LEN_ETHER );
+
+ CopyMem ( &pNicDevice->MAC,
+ &pMode->PermanentAddress,
+ PXE_HWADDR_LEN_ETHER );
+
+ pNicDevice->PktCntInQueue = 0;
+
+ for ( i = 0 ; i < MAX_QUEUE_SIZE ; i++) {
+ Status = gBS->AllocatePool ( EfiRuntimeServicesData,
+ sizeof (RX_PKT),
+ (VOID **) &pCurr);
+ if ( EFI_ERROR(Status)) {
+ DEBUG (( EFI_D_ERROR, "Memory are not enough\n"));
+ return Status;
+ }
+ pCurr->f_Used = FALSE;
+
+ if ( i ) {
+ pPrev->pNext = pCurr;
+ }
+ else {
+ pNicDevice->QueueHead = pCurr;
+ }
+
+ if (MAX_QUEUE_SIZE - 1 == i) {
+ pCurr->pNext = pNicDevice->QueueHead;
+ }
+
+ pPrev = pCurr;
+ }
+
+ pNicDevice->pNextFill = pNicDevice->QueueHead;
+ pNicDevice->pFirstFill = pNicDevice->QueueHead;
+
+ Status = gBS->AllocatePool (EfiRuntimeServicesData,
+ MAX_BULKIN_SIZE,
+ (VOID **) &pNicDevice->pBulkInBuff);
+
+ if (EFI_ERROR(Status)) {
+ DEBUG (( EFI_D_ERROR, "gBS->AllocatePool for pBulkInBuff error. Status = %r\n",
+ Status));
+ return Status;
+ }
+ }
+ else {
+ DEBUG (( EFI_D_ERROR, "Ax88772MacAddressGet error. Status = %r\n", Status));
+ return Status;
+ }
+
+ Status = gBS->AllocatePool ( EfiRuntimeServicesData,
+ sizeof ( RX_TX_PACKET ),
+ (VOID **) &pNicDevice->pRxTest );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG (( EFI_D_ERROR, "gBS->AllocatePool:pNicDevice->pRxTest error. Status = %r\n",
+ Status));
+ return Status;
+ }
+
+ Status = gBS->AllocatePool ( EfiRuntimeServicesData,
+ sizeof ( RX_TX_PACKET ),
+ (VOID **) &pNicDevice->pTxTest );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG (( EFI_D_ERROR, "gBS->AllocatePool:pNicDevice->pTxTest error. Status = %r\n",
+ Status));
+ gBS->FreePool (pNicDevice->pRxTest);
+ }
+
+ return Status;
+}
+
+
+/**
+ This routine starts the network interface.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_ALREADY_STARTED The network interface was already started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Start (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ )
+{
+ NIC_DEVICE * pNicDevice;
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+ int i = 0;
+ RX_PKT * pCurr = NULL;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ Status = EFI_INVALID_PARAMETER;
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkStopped == pMode->State ) {
+ //
+ // Initialize the mode structuref
+ // NVRAM access is not supported
+ //
+ ZeroMem ( pMode, sizeof ( *pMode ));
+
+ pMode->State = EfiSimpleNetworkStarted;
+ pMode->HwAddressSize = PXE_HWADDR_LEN_ETHER;
+ pMode->MediaHeaderSize = sizeof ( ETHERNET_HEADER );
+ pMode->MaxPacketSize = MAX_ETHERNET_PKT_SIZE;
+ pMode->ReceiveFilterMask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
+ | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS
+ | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
+ pMode->ReceiveFilterSetting = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;
+ pMode->MaxMCastFilterCount = MAX_MCAST_FILTER_CNT;
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ Status = Ax88772MacAddressGet ( pNicDevice, &pMode->PermanentAddress.Addr[0]);
+ CopyMem ( &pMode->CurrentAddress,
+ &pMode->PermanentAddress,
+ sizeof ( pMode->CurrentAddress ));
+ SetMem(&pMode->BroadcastAddress, PXE_HWADDR_LEN_ETHER, 0xff);
+ pMode->IfType = EfiNetworkInterfaceUndi;
+ pMode->MacAddressChangeable = TRUE;
+ pMode->MultipleTxSupported = FALSE;
+ pMode->MediaPresentSupported = TRUE;
+ pMode->MediaPresent = FALSE;
+ pNicDevice->PktCntInQueue = 0;
+ pNicDevice->pNextFill = pNicDevice->QueueHead;
+ pNicDevice->pFirstFill = pNicDevice->QueueHead;
+ pCurr = pNicDevice->QueueHead;
+
+ for ( i = 0 ; i < MAX_QUEUE_SIZE ; i++) {
+ pCurr->f_Used = FALSE;
+ pCurr = pCurr->pNext;
+ }
+
+ }
+ else {
+ Status = EFI_ALREADY_STARTED;
+ }
+ }
+ gBS->RestoreTPL ( TplPrevious );
+ return Status;
+}
+
+
+/**
+ Set the MAC address.
+
+ This function modifies or resets the current station address of a
+ network interface. If Reset is TRUE, then the current station address
+ is set ot the network interface's permanent address. If Reset if FALSE
+ then the current station address is changed to the address specified by
+ pNew.
+
+ This routine calls ::Ax88772MacAddressSet to update the MAC address
+ in the network adapter.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bReset Flag used to reset the station address to the
+ network interface's permanent address.
+ @param [in] pNew New station address to be used for the network
+ interface.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_StationAddress (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bReset,
+ IN EFI_MAC_ADDRESS * pNew
+ )
+{
+ NIC_DEVICE * pNicDevice;
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork )
+ && ( NULL != pSimpleNetwork->Mode )
+ && (( !bReset ) || ( bReset && ( NULL != pNew )))) {
+ //
+ // Verify that the adapter is already started
+ //
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkStarted == pMode->State ) {
+ //
+ // Determine the adapter MAC address
+ //
+ if ( bReset ) {
+ //
+ // Use the permanent address
+ //
+ CopyMem ( &pMode->CurrentAddress,
+ &pMode->PermanentAddress,
+ sizeof ( pMode->CurrentAddress ));
+ }
+ else {
+ //
+ // Use the specified address
+ //
+ CopyMem ( &pMode->CurrentAddress,
+ pNew,
+ sizeof ( pMode->CurrentAddress ));
+ }
+
+ //
+ // Update the address on the adapter
+ //
+ Status = Ax88772MacAddressSet ( pNicDevice, &pMode->CurrentAddress.Addr[0]);
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+ gBS->RestoreTPL ( TplPrevious );
+ return Status;
+}
+
+
+/**
+ This function resets or collects the statistics on a network interface.
+ If the size of the statistics table specified by StatisticsSize is not
+ big enough for all of the statistics that are collected by the network
+ interface, then a partial buffer of statistics is returned in
+ StatisticsTable.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] bReset Set to TRUE to reset the statistics for the network interface.
+ @param [in, out] pStatisticsSize On input the size, in bytes, of StatisticsTable. On output
+ the size, in bytes, of the resulting table of statistics.
+ @param [out] pStatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
+ conains the statistics.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_BUFFER_TOO_SMALL The pStatisticsTable is NULL or the buffer is too small.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+ typedef struct {
+ UINT64 RxTotalFrames;
+ UINT64 RxGoodFrames;
+ UINT64 RxUndersizeFrames;
+ UINT64 RxOversizeFrames;
+ UINT64 RxDroppedFrames;
+ UINT64 RxUnicastFrames;
+ UINT64 RxBroadcastFrames;
+ UINT64 RxMulticastFrames;
+ UINT64 RxCrcErrorFrames;
+ UINT64 RxTotalBytes;
+ UINT64 TxTotalFrames;
+ UINT64 TxGoodFrames;
+ UINT64 TxUndersizeFrames;
+ UINT64 TxOversizeFrames;
+ UINT64 TxDroppedFrames;
+ UINT64 TxUnicastFrames;
+ UINT64 TxBroadcastFrames;
+ UINT64 TxMulticastFrames;
+ UINT64 TxCrcErrorFrames;
+ UINT64 TxTotalBytes;
+ UINT64 Collisions;
+ UINT64 UnsupportedProtocol;
+ } EFI_NETWORK_STATISTICS;
+**/
+EFI_STATUS
+EFIAPI
+SN_Statistics (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN BOOLEAN bReset,
+ IN OUT UINTN * pStatisticsSize,
+ OUT EFI_NETWORK_STATISTICS * pStatisticsTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_UNSUPPORTED;
+
+ return Status;
+}
+
+
+/**
+ This function stops a network interface. This call is only valid
+ if the network interface is in the started state.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Stop (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ //
+ // Determine if the interface is started
+ //
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkStarted == pMode->State ) {
+ pMode->State = EfiSimpleNetworkStopped;
+ Status = EFI_SUCCESS;
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ gBS->RestoreTPL ( TplPrevious );
+ return Status;
+}
+
+
+/**
+ This function releases the memory buffers assigned in the Initialize() call.
+ Pending transmits and receives are lost, and interrupts are cleared and disabled.
+ After this call, only Initialize() and Stop() calls may be used.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Shutdown (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork
+ )
+{
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ UINT32 RxFilter;
+ EFI_STATUS Status;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+ //
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ //
+ // Determine if the interface is already started
+ //
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkInitialized == pMode->State ) {
+ //
+ // Stop the adapter
+ //
+ RxFilter = pMode->ReceiveFilterSetting;
+ pMode->ReceiveFilterSetting = 0;
+ Status = SN_Reset ( pSimpleNetwork, FALSE );
+ pMode->ReceiveFilterSetting = RxFilter;
+ if ( !EFI_ERROR ( Status )) {
+
+ //
+ // Update the network state
+ //
+ pMode->State = EfiSimpleNetworkStarted;
+ }
+ else if ( EFI_DEVICE_ERROR == Status ) {
+ pMode->State = EfiSimpleNetworkStopped;
+ }
+ }
+ else {
+ Status = EFI_NOT_STARTED;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+ gBS->RestoreTPL ( TplPrevious );
+ return Status;
+}
+
+
+/**
+ Send a packet over the network.
+
+ This function places the packet specified by Header and Buffer on
+ the transmit queue. This function performs a non-blocking transmit
+ operation. When the transmit is complete, the buffer is returned
+ via the GetStatus() call.
+
+ This routine calls ::Ax88772Rx to empty the network adapter of
+ receive packets. The routine then passes the transmit packet
+ to the network adapter.
+
+ @param [in] pSimpleNetwork Protocol instance pointer
+ @param [in] HeaderSize The size, in bytes, of the media header to be filled in by
+ the Transmit() function. If HeaderSize is non-zero, then
+ it must be equal to SimpleNetwork->Mode->MediaHeaderSize
+ and DestAddr and Protocol parameters must not be NULL.
+ @param [in] BufferSize The size, in bytes, of the entire packet (media header and
+ data) to be transmitted through the network interface.
+ @param [in] pBuffer A pointer to the packet (media header followed by data) to
+ to be transmitted. This parameter can not be NULL. If
+ HeaderSize is zero, then the media header is Buffer must
+ already be filled in by the caller. If HeaderSize is nonzero,
+ then the media header will be filled in by the Transmit()
+ function.
+ @param [in] pSrcAddr The source HW MAC address. If HeaderSize is zero, then
+ this parameter is ignored. If HeaderSize is nonzero and
+ SrcAddr is NULL, then SimpleNetwork->Mode->CurrentAddress
+ is used for the source HW MAC address.
+ @param [in] pDestAddr The destination HW MAC address. If HeaderSize is zero, then
+ this parameter is ignored.
+ @param [in] pProtocol The type of header to build. If HeaderSize is zero, then
+ this parameter is ignored.
+
+ @retval EFI_SUCCESS This operation was successful.
+ @retval EFI_NOT_STARTED The network interface was not started.
+ @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
+ @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
+ @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
+
+**/
+EFI_STATUS
+EFIAPI
+SN_Transmit (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * pSimpleNetwork,
+ IN UINTN HeaderSize,
+ IN UINTN BufferSize,
+ IN VOID * pBuffer,
+ IN EFI_MAC_ADDRESS * pSrcAddr,
+ IN EFI_MAC_ADDRESS * pDestAddr,
+ IN UINT16 * pProtocol
+ )
+{
+ ETHERNET_HEADER * pHeader;
+ EFI_SIMPLE_NETWORK_MODE * pMode;
+ NIC_DEVICE * pNicDevice;
+ EFI_USB_IO_PROTOCOL * pUsbIo;
+ EFI_STATUS Status;
+ UINTN TransferLength;
+ UINT32 TransferStatus;
+ UINT16 Type;
+ EFI_TPL TplPrevious;
+
+ TplPrevious = gBS->RaiseTPL(TPL_CALLBACK);
+
+ // Verify the parameters
+ //
+ if (( NULL != pSimpleNetwork ) && ( NULL != pSimpleNetwork->Mode )) {
+ //
+ // The interface must be running
+ //
+ pMode = pSimpleNetwork->Mode;
+ if ( EfiSimpleNetworkInitialized == pMode->State ) {
+ //
+ // Update the link status
+ //
+ pNicDevice = DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork );
+ pMode->MediaPresent = pNicDevice->bLinkUp;
+
+ //
+ // Release the synchronization with Ax88772Timer
+ //
+ if ( pMode->MediaPresent && pNicDevice->bComplete) {
+ //
+ // Copy the packet into the USB buffer
+ //
+
+ CopyMem ( &pNicDevice->pTxTest->Data[0], pBuffer, BufferSize );
+ pNicDevice->pTxTest->Length = (UINT16) BufferSize;
+
+ //
+ // Transmit the packet
+ //
+ pHeader = (ETHERNET_HEADER *) &pNicDevice->pTxTest->Data[0];
+ if ( 0 != HeaderSize ) {
+ if ( NULL != pDestAddr ) {
+ CopyMem ( &pHeader->dest_addr, pDestAddr, PXE_HWADDR_LEN_ETHER );
+ }
+ if ( NULL != pSrcAddr ) {
+ CopyMem ( &pHeader->src_addr, pSrcAddr, PXE_HWADDR_LEN_ETHER );
+ }
+ else {
+ CopyMem ( &pHeader->src_addr, &pMode->CurrentAddress.Addr[0], PXE_HWADDR_LEN_ETHER );
+ }
+ if ( NULL != pProtocol ) {
+ Type = *pProtocol;
+ }
+ else {
+ Type = pNicDevice->pTxTest->Length;
+ }
+ Type = (UINT16)(( Type >> 8 ) | ( Type << 8 ));
+ pHeader->type = Type;
+ }
+ if ( pNicDevice->pTxTest->Length < MIN_ETHERNET_PKT_SIZE ) {
+ pNicDevice->pTxTest->Length = MIN_ETHERNET_PKT_SIZE;
+ ZeroMem ( &pNicDevice->pTxTest->Data[ BufferSize ],
+ pNicDevice->pTxTest->Length - BufferSize );
+ }
+
+ DEBUG ((EFI_D_INFO, "TX: %02x-%02x-%02x-%02x-%02x-%02x %02x-%02x-%02x-%02x-%02x-%02x"
+ " %02x-%02x %d bytes\r\n",
+ pNicDevice->pTxTest->Data[0],
+ pNicDevice->pTxTest->Data[1],
+ pNicDevice->pTxTest->Data[2],
+ pNicDevice->pTxTest->Data[3],
+ pNicDevice->pTxTest->Data[4],
+ pNicDevice->pTxTest->Data[5],
+ pNicDevice->pTxTest->Data[6],
+ pNicDevice->pTxTest->Data[7],
+ pNicDevice->pTxTest->Data[8],
+ pNicDevice->pTxTest->Data[9],
+ pNicDevice->pTxTest->Data[10],
+ pNicDevice->pTxTest->Data[11],
+ pNicDevice->pTxTest->Data[12],
+ pNicDevice->pTxTest->Data[13],
+ pNicDevice->pTxTest->Length ));
+
+ pNicDevice->pTxTest->LengthBar = ~(pNicDevice->pTxTest->Length);
+ TransferLength = sizeof ( pNicDevice->pTxTest->Length )
+ + sizeof ( pNicDevice->pTxTest->LengthBar )
+ + pNicDevice->pTxTest->Length;
+
+ if (TransferLength % 512 == 0 || TransferLength % 1024 == 0)
+ TransferLength +=4;
+
+ //
+ // Work around USB bus driver bug where a timeout set by receive
+ // succeeds but the timeout expires immediately after, causing the
+ // transmit operation to timeout.
+ //
+ pUsbIo = pNicDevice->pUsbIo;
+ Status = pUsbIo->UsbBulkTransfer ( pUsbIo,
+ BULK_OUT_ENDPOINT,
+ &pNicDevice->pTxTest->Length,
+ &TransferLength,
+ 0xfffffffe,
+ &TransferStatus );
+ if ( !EFI_ERROR ( Status )) {
+ Status = TransferStatus;
+ }
+
+ if ( !EFI_ERROR ( Status )) {
+ pNicDevice->pTxBuffer = pBuffer;
+ }
+ else {
+ if ((TransferLength != (UINTN)( pNicDevice->pTxTest->Length + 4 )) &&
+ (TransferLength != (UINTN)(( pNicDevice->pTxTest->Length + 4 ) + 4))) {
+ DEBUG ((EFI_D_INFO, "TransferLength didn't match Packet Length\n"));
+ }
+ //
+ // Reset the controller to fix the error
+ //
+ if ( EFI_DEVICE_ERROR == Status ) {
+ SN_Reset ( pSimpleNetwork, FALSE );
+ }
+ Status = EFI_NOT_READY;
+ }
+ }
+ else {
+ //
+ // No packets available.
+ //
+ Status = EFI_NOT_READY;
+ }
+
+ }
+ else {
+ Status = EFI_NOT_STARTED ;
+ }
+ }
+ else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ gBS->RestoreTPL (TplPrevious);
+
+ return Status;
+}
diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c
index 35d667fe3..8a6ecf75b 100644
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ b/OvmfPkg/AcpiPlatformDxe/Qemu.c
@@ -200,16 +200,20 @@ typedef struct {
} FIRMWARE_DATA;
typedef struct {
- UINT8 NameOp;
- UINT8 RootChar;
- UINT8 NameChar[4];
- UINT8 PackageOp;
- UINT8 PkgLength;
- UINT8 NumElements;
- UINT8 DWordPrefix;
- UINT8 Pm1aCntSlpTyp;
- UINT8 Pm1bCntSlpTyp;
- UINT8 Reserved[2];
+ UINT8 BytePrefix;
+ UINT8 ByteValue;
+} AML_BYTE;
+
+typedef struct {
+ UINT8 NameOp;
+ UINT8 RootChar;
+ UINT8 NameChar[4];
+ UINT8 PackageOp;
+ UINT8 PkgLength;
+ UINT8 NumElements;
+ AML_BYTE Pm1aCntSlpTyp;
+ AML_BYTE Pm1bCntSlpTyp;
+ AML_BYTE Reserved[2];
} SYSTEM_STATE_PACKAGE;
#pragma pack()
@@ -326,12 +330,14 @@ GetSuspendStates (
'\\', // RootChar
{ '_', 'S', 'x', '_' }, // NameChar[4]
0x12, // PackageOp
- 0x07, // PkgLength
- 0x01, // NumElements
- 0x0c, // DWordPrefix
- 0x00, // Pm1aCntSlpTyp
- 0x00, // Pm1bCntSlpTyp -- we don't support it
- { 0x00, 0x00 } // Reserved
+ 0x0A, // PkgLength
+ 0x04, // NumElements
+ { 0x0A, 0x00 }, // Pm1aCntSlpTyp
+ { 0x0A, 0x00 }, // Pm1bCntSlpTyp -- we don't support it
+ { // Reserved[2]
+ { 0x0A, 0x00 },
+ { 0x0A, 0x00 }
+ }
};
RETURN_STATUS Status;
FIRMWARE_CONFIG_ITEM FwCfgItem;
@@ -343,13 +349,13 @@ GetSuspendStates (
//
*SuspendToRamSize = sizeof Template;
CopyMem (SuspendToRam, &Template, sizeof Template);
- SuspendToRam->NameChar[2] = '3'; // S3
- SuspendToRam->Pm1aCntSlpTyp = 1; // PIIX4: STR
+ SuspendToRam->NameChar[2] = '3'; // S3
+ SuspendToRam->Pm1aCntSlpTyp.ByteValue = 1; // PIIX4: STR
*SuspendToDiskSize = sizeof Template;
CopyMem (SuspendToDisk, &Template, sizeof Template);
- SuspendToDisk->NameChar[2] = '4'; // S4
- SuspendToDisk->Pm1aCntSlpTyp = 2; // PIIX4: POSCL
+ SuspendToDisk->NameChar[2] = '4'; // S4
+ SuspendToDisk->Pm1aCntSlpTyp.ByteValue = 2; // PIIX4: POSCL
//
// check for overrides
@@ -368,16 +374,20 @@ GetSuspendStates (
// value to be written to the PM control register's SUS_TYP bits.
//
if (SystemStates[3] & BIT7) {
- SuspendToRam->Pm1aCntSlpTyp = SystemStates[3] & (BIT2 | BIT1 | BIT0);
- DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n", SuspendToRam->Pm1aCntSlpTyp));
+ SuspendToRam->Pm1aCntSlpTyp.ByteValue =
+ SystemStates[3] & (BIT2 | BIT1 | BIT0);
+ DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n",
+ SuspendToRam->Pm1aCntSlpTyp.ByteValue));
} else {
*SuspendToRamSize = 0;
DEBUG ((DEBUG_INFO, "ACPI S3 disabled\n"));
}
if (SystemStates[4] & BIT7) {
- SuspendToDisk->Pm1aCntSlpTyp = SystemStates[4] & (BIT2 | BIT1 | BIT0);
- DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n", SuspendToDisk->Pm1aCntSlpTyp));
+ SuspendToDisk->Pm1aCntSlpTyp.ByteValue =
+ SystemStates[4] & (BIT2 | BIT1 | BIT0);
+ DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n",
+ SuspendToDisk->Pm1aCntSlpTyp.ByteValue));
} else {
*SuspendToDiskSize = 0;
DEBUG ((DEBUG_INFO, "ACPI S4 disabled\n"));
diff --git a/OvmfPkg/AcpiTables/Dsdt.asl b/OvmfPkg/AcpiTables/Dsdt.asl
index 12a4f142a..519a31250 100644
--- a/OvmfPkg/AcpiTables/Dsdt.asl
+++ b/OvmfPkg/AcpiTables/Dsdt.asl
@@ -203,10 +203,28 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF ", 4) {
Package () {0x0000FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
Package () {0x0000FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
- Package () {0x0001FFFF, 0x00, 0x00, 0x09},
//
- // list of IRQs occupied thus far: 9
+ // Bus 0, Device 1, Pin 0 (INTA) is special; it corresponds to the
+ // internally generated SCI (System Control Interrupt), which is
+ // always routed to GSI 9. By setting the third (= Source) field to
+ // zero, we could use the fourth (= Source Index) field to hardwire
+ // the pin to GSI 9 directly.
+ //
+ // That way however, in accordance with the ACPI spec's description
+ // of SCI, the interrupt would be treated as "active low,
+ // shareable, level", and that doesn't match qemu.
//
+ // In QemuInstallAcpiMadtTable() [OvmfPkg/AcpiPlatformDxe/Qemu.c]
+ // we install an Interrupt Override Structure for the identity
+ // mapped IRQ#9 / GSI 9 (the corresponding bit being set in
+ // Pcd8259LegacyModeEdgeLevel), which describes the correct
+ // polarity (active high). As a consequence, some OS'en (eg. Linux)
+ // override the default (active low) polarity originating from the
+ // _PRT; others (eg. FreeBSD) don't. Therefore we need a separate
+ // link device just to specify a polarity that matches the MADT.
+ //
+ Package () {0x0001FFFF, 0x00, \_SB.PCI0.LPC.LNKS, 0x00},
+
Package () {0x0001FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
Package () {0x0001FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
Package () {0x0001FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
@@ -292,6 +310,30 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF ", 4) {
Name (_ADR, 0x00010000)
//
+ // The SCI cannot be rerouted or disabled with PIRQRC[A:D]; we only
+ // need this link device in order to specify the polarity.
+ //
+ Device (LNKS) {
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 0)
+
+ Name (_STA, 0xB) // 0x1: device present
+ // 0x2: enabled and decoding resources
+ // 0x8: functioning properly
+
+ Method (_SRS, 1, NotSerialized) { /* no-op */ }
+ Method (_DIS, 0, NotSerialized) { /* no-op */ }
+
+ Name (_PRS, ResourceTemplate () {
+ Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 9 }
+ //
+ // list of IRQs occupied thus far: 9
+ //
+ })
+ Method (_CRS, 0, NotSerialized) { Return (_PRS) }
+ }
+
+ //
// PCI Interrupt Routing Configuration Registers, PIRQRC[A:D]
//
OperationRegion (PRR0, PCI_Config, 0x60, 0x04)
diff --git a/OvmfPkg/AcpiTables/Facp.aslc b/OvmfPkg/AcpiTables/Facp.aslc
index b48af760e..df35285c9 100644
--- a/OvmfPkg/AcpiTables/Facp.aslc
+++ b/OvmfPkg/AcpiTables/Facp.aslc
@@ -1,6 +1,7 @@
/** @file
FACP Table
+ Copyright (c) 2013, Red Hat, Inc.
Copyright (c) 2008 - 2012, 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
@@ -14,11 +15,11 @@
#include "Platform.h"
-EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
+EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
{
- EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- sizeof (EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE),
- EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ sizeof (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE),
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
0, // to make sum of entire table == 0
{EFI_ACPI_OEM_ID}, // OEMID is a 6 bytes long field
EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long)
@@ -28,8 +29,8 @@ EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
},
0, // Physical addesss of FACS
0, // Physical address of DSDT
- INT_MODEL, // System Interrupt Model
- RESERVED, // reserved
+ RESERVED, // System Interrupt Model in ACPI 1.0, eliminated in 2.0
+ EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED, // Preferred PM profile
SCI_INT_VECTOR, // System vector of SCI interrupt
SMI_CMD_IO_PORT, // Port address of SMI command port
ACPI_ENABLE, // value to write to port smi_cmd to enable ACPI
@@ -37,20 +38,20 @@ EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
S4BIOS_REQ, // Value to write to SMI CMD port to enter the S4BIOS state
0, // PState control
PM1a_EVT_BLK, // Port address of Power Mgt 1a Event Reg Blk
- PM1b_EVT_BLK, // Port address of Power Mgt 1b Event Reg Blk
+ 0, // Power Mgt 1b Event Reg Blk unsupported
PM1a_CNT_BLK, // Port address of Power Mgt 1a Ctrl Reg Blk
- PM1b_CNT_BLK, // Port address of Power Mgt 1b Ctrl Reg Blk
- PM2_CNT_BLK, // Port address of Power Mgt 2 Ctrl Reg Blk
+ 0, // Power Mgt 1b Ctrl Reg Blk unsupported
+ 0, // Power Mgt 2 Ctrl Reg Blk unsupported
PM_TMR_BLK, // Port address of Power Mgt Timer Ctrl Reg Blk
GPE0_BLK, // Port addr of General Purpose Event 0 Reg Blk
- GPE1_BLK, // Port addr of General Purpose Event 1 Reg Blk
+ 0, // General Purpose Event 1 Reg Blk unsupported
PM1_EVT_LEN, // Byte Length of ports at pm1X_evt_blk
PM1_CNT_LEN, // Byte Length of ports at pm1X_cnt_blk
- PM2_CNT_LEN, // Byte Length of ports at pm2_cnt_blk
+ 0, // Power Mgt 2 Ctrl Reg Blk unsupported
PM_TM_LEN, // Byte Length of ports at pm_tm_blk
GPE0_BLK_LEN, // Byte Length of ports at gpe0_blk
- GPE1_BLK_LEN, // Byte Length of ports at gpe1_blk
- GPE1_BASE, // offset in gpe model where gpe1 events start
+ 0, // General Purpose Event 1 Reg Blk unsupported
+ 0, // General Purpose Event 1 Reg Blk unsupported
0, // _CST support
P_LVL2_LAT, // worst case HW latency to enter/exit C2 state
P_LVL3_LAT, // worst case HW latency to enter/exit C3 state
@@ -61,10 +62,23 @@ EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
DAY_ALRM, // index to day-of-month alarm in RTC CMOS RAM
MON_ALRM, // index to month-of-year alarm in RTC CMOS RAM
CENTURY, // index to century in RTC CMOS RAM
- 0x00, // Boot architecture flag
- 0x00, // Boot architecture flag
+ 0x0000, // Boot architecture flag (16-bit)
RESERVED, // reserved
- FLAG
+ FLAG, // Fixed feature flags
+ GAS2_IO(RESET_REG, 1), // Extended address of the Reset Register
+ RESET_VALUE, // Value for the Reset Register to reset the system
+ { RESERVED }, // reserved[3]
+ 0, // 64-bit physical addesss of FACS, set at installation
+ 0, // 64-bit physical addesss of DSDT, set at installation
+
+ GAS2_IO(PM1a_EVT_BLK, PM1_EVT_LEN), // Ext. addr. of PM 1a Event Reg Blk
+ { 0 }, // PM 1b Event Reg Blk unsupported
+ GAS2_IO(PM1a_CNT_BLK, PM1_CNT_LEN), // Ext. addr. of PM 1a Ctrl Reg Blk
+ { 0 }, // PM 1b Ctrl Reg Blk unsupported
+ { 0 }, // PM 2 Ctrl Reg Blk unsupported
+ GAS2_IO(PM_TMR_BLK, PM_TM_LEN), // Ext. addr. of PM Timer Ctrl Reg Blk
+ GAS2_IO(GPE0_BLK, GPE0_BLK_LEN), // Ext. addr. of GPE 0 Reg Blk
+ { 0 } // GPE 1 Reg Blk unsupported
};
diff --git a/OvmfPkg/AcpiTables/Platform.h b/OvmfPkg/AcpiTables/Platform.h
index e8fae3c83..d96b84723 100644
--- a/OvmfPkg/AcpiTables/Platform.h
+++ b/OvmfPkg/AcpiTables/Platform.h
@@ -1,6 +1,7 @@
/** @file
Platform specific defines for constructing ACPI tables
+ Copyright (c) 2012, 2013, Red Hat, Inc.
Copyright (c) 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
@@ -23,31 +24,23 @@
//
#define EFI_ACPI_OEM_ID 'O','V','M','F',' ',' ' // OEMID 6 bytes long
#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('O','V','M','F','E','D','K','2') // OEM table id 8 bytes long
-#define EFI_ACPI_OEM_REVISION 0x20120804
+#define EFI_ACPI_OEM_REVISION 0x20130221
#define EFI_ACPI_CREATOR_ID SIGNATURE_32('O','V','M','F')
-#define EFI_ACPI_CREATOR_REVISION 0x00000098
+#define EFI_ACPI_CREATOR_REVISION 0x00000099
-#define INT_MODEL 0x01
#define SCI_INT_VECTOR 0x0009
#define SMI_CMD_IO_PORT 0xB2
#define ACPI_ENABLE 0xF1
#define ACPI_DISABLE 0xF0
#define S4BIOS_REQ 0x00
#define PM1a_EVT_BLK 0x0000b000
-#define PM1b_EVT_BLK 0x00000000
#define PM1a_CNT_BLK 0x0000b004
-#define PM1b_CNT_BLK 0x00000000
-#define PM2_CNT_BLK 0x00000000
#define PM_TMR_BLK 0x0000b008
#define GPE0_BLK 0x0000afe0
-#define GPE1_BLK 0x00000000
#define PM1_EVT_LEN 0x04
#define PM1_CNT_LEN 0x02
-#define PM2_CNT_LEN 0x00
#define PM_TM_LEN 0x04
#define GPE0_BLK_LEN 0x04
-#define GPE1_BLK_LEN 0x00
-#define GPE1_BASE 0x00
#define RESERVED 0x00
#define P_LVL2_LAT 0x0065
#define P_LVL3_LAT 0x03E9
@@ -58,7 +51,24 @@
#define DAY_ALRM 0x00
#define MON_ALRM 0x00
#define CENTURY 0x00
-#define FLAG EFI_ACPI_1_0_WBINVD | EFI_ACPI_1_0_PROC_C1 | EFI_ACPI_1_0_SLP_BUTTON | EFI_ACPI_1_0_RTC_S4
+#define FLAG (EFI_ACPI_2_0_WBINVD | \
+ EFI_ACPI_2_0_PROC_C1 | \
+ EFI_ACPI_2_0_SLP_BUTTON | \
+ EFI_ACPI_2_0_RTC_S4 | \
+ EFI_ACPI_2_0_RESET_REG_SUP)
+#define RESET_REG 0xCF9
+#define RESET_VALUE (BIT2 | BIT1) // PIIX3 Reset CPU + System Reset
-#endif
+//
+// Byte-aligned IO port register block initializer for
+// EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE
+//
+#define GAS2_IO(Base, Size) { \
+ EFI_ACPI_2_0_SYSTEM_IO, /* AddressSpaceId */ \
+ (Size) * 8, /* RegisterBitWidth */ \
+ 0, /* RegisterBitOffset */ \
+ 0, /* Reserved */ \
+ (Base) /* Address */ \
+ }
+#endif
diff --git a/OvmfPkg/Include/IndustryStandard/LinuxBzimage.h b/OvmfPkg/Include/IndustryStandard/LinuxBzimage.h
index d16b112fa..b83b7916a 100644
--- a/OvmfPkg/Include/IndustryStandard/LinuxBzimage.h
+++ b/OvmfPkg/Include/IndustryStandard/LinuxBzimage.h
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2011 - 2013, 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
@@ -15,7 +15,6 @@
#define __LINUX_BZIMAGE_H__
#define BOOTSIG 0x1FE
-#define SETUP_VERSION 0x206
#define SETUP_HDR 0x53726448 /* 0x53726448 == "HdrS" */
#define E820_RAM 1
@@ -55,7 +54,8 @@ struct setup_header {
UINT32 ramdisk_max; /* Highest legal initrd address */
UINT32 kernel_alignment; /* Physical addr alignment required for kernel */
UINT8 relocatable_kernel; /* Whether kernel is relocatable or not */
- UINT8 _pad2[3];
+ UINT8 min_alignment;
+ UINT16 xloadflags;
UINT32 cmdline_size;
UINT32 hardware_subarch;
UINT64 hardware_subarch_data;
diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
index 3776d79ea..9d023777c 100644
--- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
+++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
@@ -1,7 +1,7 @@
/** @file
QEMU/KVM Firmware Configuration access
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2011 - 2013, 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
@@ -103,6 +103,25 @@ QemuFwCfgReadBytes (
/**
+ Writes firmware configuration bytes from a buffer
+
+ If called multiple times, then the data written will
+ continue at the offset of the firmware configuration
+ item where the previous write ended.
+
+ @param[in] Size - Size in bytes to write
+ @param[in] Buffer - Buffer to read data from
+
+**/
+VOID
+EFIAPI
+QemuFwCfgWriteBytes (
+ IN UINTN Size,
+ IN VOID *Buffer
+ );
+
+
+/**
Reads a UINT8 firmware configuration value
@return Value of Firmware Configuration item read
diff --git a/OvmfPkg/Library/LoadLinuxLib/Linux.c b/OvmfPkg/Library/LoadLinuxLib/Linux.c
index 862698a39..c714225e5 100644
--- a/OvmfPkg/Library/LoadLinuxLib/Linux.c
+++ b/OvmfPkg/Library/LoadLinuxLib/Linux.c
@@ -642,13 +642,14 @@ LoadLinux (
InitLinuxDescriptorTables ();
Bp->hdr.code32_start = (UINT32)(UINTN) Kernel;
- if (Bp->hdr.version >= 0x20b && Bp->hdr.handover_offset &&
- (Bp->hdr.load_flags & (sizeof(long) >> 1))) {
+ if (Bp->hdr.version >= 0x20c && Bp->hdr.handover_offset &&
+ (Bp->hdr.load_flags & (sizeof (UINTN) == 4 ? BIT2 : BIT3))) {
DEBUG ((EFI_D_INFO, "Jumping to kernel EFI handover point at ofs %x\n", Bp->hdr.handover_offset));
DisableInterrupts ();
JumpToUefiKernel ((VOID*) gImageHandle, (VOID*) gST, KernelSetup, Kernel);
}
+
//
// Old kernels without EFI handover protocol
//
diff --git a/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S b/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S
index 06d0a1f55..056e3c013 100644
--- a/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S
+++ b/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S
@@ -72,10 +72,10 @@ ASM_PFX(JumpToKernel):
# VOID
# EFIAPI
# JumpToUefiKernel (
-# EFI_HANDLE ImageHandle,
-# EFI_SYSTEM_TABLE *SystemTable,
-# VOID *KernelBootParams,
-# VOID *KernelStart
+# EFI_HANDLE ImageHandle, // rcx
+# EFI_SYSTEM_TABLE *SystemTable, // rdx
+# VOID *KernelBootParams, // r8
+# VOID *KernelStart // r9
# );
#------------------------------------------------------------------------------
ASM_PFX(JumpToUefiKernel):
diff --git a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.S b/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.S
index a32b2c60c..c2735d2c6 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.S
+++ b/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.S
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
#
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2013, 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
@@ -30,3 +30,23 @@ rep insb
popl %edi
ret
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# IoWriteFifo8 (
+# IN UINTN Port,
+# IN UINTN Size,
+# IN VOID *Buffer
+# );
+#------------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(IoWriteFifo8)
+ASM_PFX(IoWriteFifo8):
+ movw 4(%esp), %dx
+ movl 8(%esp), %ecx
+ pushl %esi
+ movl 16(%esp), %esi
+rep outsb
+ popl %esi
+ ret
+
diff --git a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.asm b/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.asm
index e46af81e8..f7d65c49a 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.asm
+++ b/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2013, 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
@@ -29,12 +29,34 @@ IoReadFifo8 PROC
mov dx, [esp + 4]
mov ecx, [esp + 8]
push edi
- mov edx, [esp + 16]
+ mov edi, [esp + 16]
rep insb
pop edi
ret
IoReadFifo8 ENDP
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; IoWriteFifo8 (
+; IN UINTN Port,
+; IN UINTN Size,
+; IN VOID *Buffer
+; );
+;------------------------------------------------------------------------------
+IoWriteFifo8 PROC
+
+ mov dx, [esp + 4]
+ mov ecx, [esp + 8]
+ push esi
+ mov esi, [esp + 16]
+rep outsb
+ pop esi
+ ret
+
+IoWriteFifo8 ENDP
+
END
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 8caab42e8..7e5ea00bf 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2011 - 2013, 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
@@ -50,6 +50,32 @@ IoReadFifo8 (
OUT VOID *Buffer
);
+/**
+ Writes an 8-bit I/O port fifo from a block of memory.
+
+ Writes the 8-bit I/O fifo port specified by Port.
+
+ The port is written Count times, and the data are obtained
+ from the provided Buffer.
+
+ This function must guarantee that all I/O read and write operations are
+ serialized.
+
+ If 8-bit I/O port operations are not supported, then ASSERT().
+
+ @param Port The I/O port to read.
+ @param Count The number of times to read I/O port.
+ @param Buffer The buffer to store the read data into.
+
+**/
+VOID
+EFIAPI
+IoWriteFifo8 (
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
+ );
+
/**
Returns a boolean indicating if the firmware configuration interface
@@ -132,6 +158,29 @@ QemuFwCfgReadBytes (
}
}
+/**
+ Write firmware configuration bytes from a buffer
+
+ If called multiple times, then the data written will
+ continue at the offset of the firmware configuration
+ item where the previous write ended.
+
+ @param[in] Size - Size in bytes to write
+ @param[in] Buffer - Buffer to read data from
+
+**/
+VOID
+EFIAPI
+QemuFwCfgWriteBytes (
+ IN UINTN Size,
+ IN VOID *Buffer
+ )
+{
+ if (mQemuFwCfgSupported) {
+ IoWriteFifo8 (0x511, Size, Buffer);
+ }
+}
+
/**
Reads a UINT8 firmware configuration value
diff --git a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.S b/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.S
index b1125ed7d..69167b708 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.S
+++ b/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.S
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
#
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2013, 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
@@ -28,3 +28,20 @@ rep insb
mov %r8, %rdi # restore rdi
ret
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# IoWriteFifo8 (
+# IN UINTN Port, // rcx
+# IN UINTN Size, // rdx
+# IN VOID *Buffer // r8
+# );
+#------------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(IoWriteFifo8)
+ASM_PFX(IoWriteFifo8):
+ xchg %rcx, %rdx
+ xchg %r8, %rsi # rdi: buffer address; r8: save rsi
+rep outsb
+ mov %r8, %rsi # restore rsi
+ ret
+
diff --git a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.asm b/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.asm
index c60ad2c5d..47ac158f8 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.asm
+++ b/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2013, 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
@@ -32,5 +32,25 @@ rep insb
IoReadFifo8 ENDP
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; IoWriteFifo8 (
+; IN UINTN Port, // rcx
+; IN UINTN Size, // rdx
+; IN VOID *Buffer // r8
+; );
+;------------------------------------------------------------------------------
+IoWriteFifo8 PROC
+
+ xchg rcx, rdx
+ xchg rsi, r8 ; rdi: buffer address; r8: save rdi
+rep outsb
+ mov rsi, r8 ; restore rdi
+ ret
+
+IoWriteFifo8 ENDP
+
END
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 52406add2..d075fbef0 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -17,6 +17,7 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
+#include <Library/TimerLib.h>
VOID
AcpiPmControl (
@@ -45,7 +46,11 @@ ResetCold (
VOID
)
{
- IoWrite8 (0x64, 0xfe);
+ IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST
+ MicroSecondDelay (50);
+
+ IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller
+ CpuDeadLoop ();
}
/**
@@ -62,6 +67,7 @@ ResetWarm (
)
{
IoWrite8 (0x64, 0xfe);
+ CpuDeadLoop ();
}
/**
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index 0694b4dd3..c4d8ce54b 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -35,4 +35,4 @@
[LibraryClasses]
DebugLib
IoLib
-
+ TimerLib
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 36c975665..8861980b9 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -46,12 +46,12 @@ FV = SECFV
[FD.MEMFD]
BaseAddress = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
-Size = 0x600000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
+Size = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
ErasePolarity = 1
BlockSize = 0x10000
-NumBlocks = 0x60
+NumBlocks = 0x80
-0x0|0x600000
+0x0|0x800000
FV = MAINFV
################################################################################
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index a762dc9f2..93a36b7cc 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -46,12 +46,12 @@ FV = SECFV
[FD.MEMFD]
BaseAddress = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
-Size = 0x600000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
+Size = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
ErasePolarity = 1
BlockSize = 0x10000
-NumBlocks = 0x60
+NumBlocks = 0x80
-0x0|0x600000
+0x0|0x800000
FV = MAINFV
################################################################################
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index fcdac0316..d023cb19b 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -46,12 +46,12 @@ FV = SECFV
[FD.MEMFD]
BaseAddress = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
-Size = 0x600000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
+Size = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
ErasePolarity = 1
BlockSize = 0x10000
-NumBlocks = 0x60
+NumBlocks = 0x80
-0x0|0x600000
+0x0|0x800000
FV = MAINFV
################################################################################
diff --git a/PandaBoardPkg/ConfigurationHeader.dat b/PandaBoardPkg/ConfigurationHeader.dat
index 4cb888251..ec7dbcd30 100644
--- a/PandaBoardPkg/ConfigurationHeader.dat
+++ b/PandaBoardPkg/ConfigurationHeader.dat
@@ -9,10 +9,10 @@ Flags=0x00000BBD
CM_CLKSEL_CORE=0x00000110
CM_DLL_CTRL=0x00000000
CM_AUTOIDLE_DPLL_MPU=0x00000000
-CM_CLKSEL_DPLL_MPU=0x0002EE2F
+CM_CLKSEL_DPLL_MPU=0x00007D05
CM_DIV_M2_DPLL_MPU=0x00000002
CM_AUTOIDLE_DPLL_CORE=0x00000000
-CM_CLKSEL_DPLL_CORE=0x0003E82F
+CM_CLKSEL_DPLL_CORE=0x00007D05
CM_DIV_M2_DPLL_CORE=0x00000002
CM_DIV_M3_DPLL_CORE=0x00000008
CM_DIV_M4_DPLL_CORE=0x00000008
@@ -20,7 +20,7 @@ CM_DIV_M5_DPLL_CORE=0x00000008
CM_DIV_M6_DPLL_CORE=0x00000008
CM_DIV_M7_DPLL_CORE=0x00000010
CM_AUTOIDLE_DPLL_PER=0x00000000
-CM_CLKSEL_DPLL_PER=0x0002581D
+CM_CLKSEL_DPLL_PER=0x00001400
CM_DIV_M2_DPLL_PER=0x00000008
CM_DIV_M3_DPLL_PER=0x00000008
CM_DIV_M4_DPLL_PER=0x0000000C
@@ -29,36 +29,36 @@ CM_DIV_M6_DPLL_PER=0x00000008
CM_DIV_M7_DPLL_PER=0x0000000A
CM_AUTOIDLE_DPLL_USB=0x00000000
CM_CLKSEL_DPLL_USB=0x00000000
-CM_DIV_M2_DPLL_USB=0x00000002
+CM_DIV_M2_DPLL_USB=0x00000000
CHRAM
SectionKey=0xC0C0C0C2
Valid=0x00000001
Version=0x00000000
Reserved=0x00000000
-SdramConfigEMIF1=0x98810EB1
-SdramRefreshEMIF1=0x0000030C
-SdramTim1EMIF1=0x12CD1624
-SdramTim2EMIF1=0x3058161B
-SdramTim3EMIF1=0x00D20540
-PwrMgtCtrlEMIF1=0x00000000
-DdrPhyCtrl1EMIF1=0x901FF417
-DdrPhyCtrl2EMIF1=0x00000000
-ModeReg1EMIF1=0x00000023
-ModeReg2EMIF1=0x00000001
-ModeReg3EMIF1=0x00000002
+SdramConfigEMIF1=0x80001ab9
+SdramRefreshEMIF1=0x00000618
+SdramTim1EMIF1=0x10eb0662
+SdramTim2EMIF1=0x20370dd2
+SdramTim3EMIF1=0x00b1c33f
+PwrMgtCtrlEMIF1=0x000000ff
+DdrPhyCtrl1EMIF1=0x049ff418
+DdrPhyCtrl2EMIF1=0x00000004
+ModeReg1EMIF1=0x000000c3
+ModeReg2EMIF1=0x00000004
+ModeReg3EMIF1=0x00000001
Reserved=0x00000000
-SdramConfigEMIF2=0x98810EB1
-SdramRefreshEMIF2=0x0000030C
-SdramTim1EMIF2=0x12CD1624
-SdramTim2EMIF2=0x3058161B
-SdramTim3EMIF2=0x00D20540
-PwrMgtCtrlEMIF2=0x00000000
-DdrPhyCtrl1EMIF2=0x901FF417
-DdrPhyCtrl2EMIF2=0x00000000
-ModeReg1EMIF2=0x00000023
-ModeReg2EMIF2=0x00000001
-ModeReg3EMIF2=0x00000002
+SdramConfigEMIF2=0x80001ab9
+SdramRefreshEMIF2=0x00000618
+SdramTim1EMIF2=0x10eb0662
+SdramTim2EMIF2=0x20370dd2
+SdramTim3EMIF2=0x00b1c33f
+PwrMgtCtrlEMIF2=0x000000ff
+DdrPhyCtrl1EMIF2=0x049ff418
+DdrPhyCtrl2EMIF2=0x00000004
+ModeReg1EMIF2=0x000000c3
+ModeReg2EMIF2=0x00000004
+ModeReg3EMIF2=0x00000001
Reserved=0x00000000
-DMMLisaMap0=0x80500300
-Flags=0x00000105
+DMMLisaMap0=0x80640300
+Flags=0x0000010f
diff --git a/PandaBoardPkg/Include/PandaBoard.h b/PandaBoardPkg/Include/PandaBoard.h
index 75e420f46..3f806e8e2 100755
--- a/PandaBoardPkg/Include/PandaBoard.h
+++ b/PandaBoardPkg/Include/PandaBoard.h
@@ -172,16 +172,11 @@
#define ARM_EB_EFI_MEMORY_REGION_SZ 0x1000000
#endif
-// TODO: review Panda board revisions
+#endif
+
typedef enum {
- REVISION_XM,
- REVISION_UNKNOWN0,
- REVISION_UNKNOWN1,
- REVISION_UNKNOWN2,
- REVISION_UNKNOWN3,
- REVISION_C4,
- REVISION_C123,
- REVISION_AB,
-} PANDABOARD_REVISION;
+ PANDABOARD_REVISION_UNKNOWN=0,
+ PANDABOARD_REVISION_PANDA,
+ PANDABOARD_REVISION_PANDAES
-#endif
+} PANDABOARD_REVISION;
diff --git a/PandaBoardPkg/Library/PandaBoardLib/Clock.c b/PandaBoardPkg/Library/PandaBoardLib/Clock.c
index cf73d79bf..6e3ffbf47 100755
--- a/PandaBoardPkg/Library/PandaBoardLib/Clock.c
+++ b/PandaBoardPkg/Library/PandaBoardLib/Clock.c
@@ -15,55 +15,243 @@
#include <Library/IoLib.h>
#include <Library/DebugLib.h>
+#include <PandaBoard.h>
#include <Omap4430/Omap4430.h>
VOID
-ClockInit (
+VolConSetup (
+ IN UINTN PmcSlaveAddr,
+ IN UINTN SmpsAddr,
+ IN UINTN Data
+ )
+{
+ // Setup VolCon command
+ MmioWrite32 (PRM_VC_VAL_BYPASS,
+ ((Data<<PRM_VC_VAL_BYPASS_DATA_POS)|
+ (SmpsAddr<<PRM_VC_VAL_BYPASS_REGADDR_POS)|
+ (PmcSlaveAddr)) );
+
+ // Validate command
+ MmioOr32 (PRM_VC_VAL_BYPASS, BIT24);
+
+ // Wait for command completion
+ while( MmioRead32(PRM_VC_VAL_BYPASS) & BIT24 );
+}
+
+VOID
+VolConInit (
VOID
)
{
- //DPLL1 - DPLL4 are configured part of Configuration header which OMAP4 ROM parses.
-
- // Enable PLL5 and set to 120 MHz as a reference clock.
- MmioWrite32 (CM_CLKSEL4_PLL, CM_CLKSEL_PLL_MULT(120) | CM_CLKSEL_PLL_DIV(13));
- MmioWrite32 (CM_CLKSEL5_PLL, CM_CLKSEL_DIV_120M(1));
- MmioWrite32 (CM_CLKEN2_PLL, CM_CLKEN_FREQSEL_075_100 | CM_CLKEN_ENABLE);
-
- // Turn on functional & interface clocks to the USBHOST power domain
- MmioOr32(CM_FCLKEN_USBHOST, CM_FCLKEN_USBHOST_EN_USBHOST2_ENABLE
- | CM_FCLKEN_USBHOST_EN_USBHOST1_ENABLE);
- MmioOr32(CM_ICLKEN_USBHOST, CM_ICLKEN_USBHOST_EN_USBHOST_ENABLE);
-
- // Turn on functional & interface clocks to the USBTLL block.
- MmioOr32(CM_FCLKEN3_CORE, CM_FCLKEN3_CORE_EN_USBTLL_ENABLE);
- MmioOr32(CM_ICLKEN3_CORE, CM_ICLKEN3_CORE_EN_USBTLL_ENABLE);
-
- // Turn on functional & interface clocks to MMC1 and I2C1 modules.
- MmioOr32(CM_FCLKEN1_CORE, CM_FCLKEN1_CORE_EN_MMC1_ENABLE
- | CM_FCLKEN1_CORE_EN_I2C1_ENABLE);
- MmioOr32(CM_ICLKEN1_CORE, CM_ICLKEN1_CORE_EN_MMC1_ENABLE
- | CM_ICLKEN1_CORE_EN_I2C1_ENABLE);
-
- // Turn on functional & interface clocks to various Peripherals.
- MmioOr32(CM_FCLKEN_PER, CM_FCLKEN_PER_EN_UART3_ENABLE
- | CM_FCLKEN_PER_EN_GPT4_ENABLE
- | CM_FCLKEN_PER_EN_GPIO2_ENABLE
- | CM_FCLKEN_PER_EN_GPIO3_ENABLE
- | CM_FCLKEN_PER_EN_GPIO4_ENABLE
- | CM_FCLKEN_PER_EN_GPIO5_ENABLE
- | CM_FCLKEN_PER_EN_GPIO6_ENABLE);
- MmioOr32(CM_ICLKEN_PER, CM_ICLKEN_PER_EN_UART3_ENABLE
- | CM_ICLKEN_PER_EN_GPT3_ENABLE
- | CM_ICLKEN_PER_EN_GPT4_ENABLE
- | CM_ICLKEN_PER_EN_GPIO2_ENABLE
- | CM_ICLKEN_PER_EN_GPIO3_ENABLE
- | CM_ICLKEN_PER_EN_GPIO4_ENABLE
- | CM_ICLKEN_PER_EN_GPIO5_ENABLE
- | CM_ICLKEN_PER_EN_GPIO6_ENABLE);
-
- // Turn on functional & inteface clocks to various wakeup modules.
- MmioOr32(CM_FCLKEN_WKUP, CM_FCLKEN_WKUP_EN_GPIO1_ENABLE
- | CM_FCLKEN_WKUP_EN_WDT2_ENABLE);
- MmioOr32(CM_ICLKEN_WKUP, CM_ICLKEN_WKUP_EN_GPIO1_ENABLE
- | CM_ICLKEN_WKUP_EN_WDT2_ENABLE);
+ // Sram Ldo Voltage Control Override (MPU, CORE, IVA)
+ MmioWrite32 (CONTROL_CORE_LDOSRAM_IVA_VOLTAGE_CTRL,
+ CONTROL_CORE_LDOSRAM_VOLTAGE_CTRL_VAL);
+ MmioWrite32 (CONTROL_CORE_LDOSRAM_MPU_VOLTAGE_CTRL,
+ CONTROL_CORE_LDOSRAM_VOLTAGE_CTRL_VAL);
+ MmioWrite32 (CONTROL_CORE_LDOSRAM_CORE_VOLTAGE_CTRL,
+ CONTROL_CORE_LDOSRAM_VOLTAGE_CTRL_VAL);
+
+ // Voltage controller setup
+ MmioWrite32 (PRM_VC_CFG_I2C_MODE, VC_CFG_I2C_MODE_VAL);
+ MmioWrite32 (PRM_VC_CFG_I2C_CLK, VC_CFG_I2C_CLK_VAL);
+}
+
+VOID
+ClockModuleEnable (
+ IN UINTN Addr,
+ IN UINTN Mode
+ )
+{
+ MmioOr32 (Addr, Mode);
+ while( (MmioRead32(Addr) & (BIT16|BIT17)) != 0 );
+}
+
+VOID
+ClockInit (
+ PANDABOARD_REVISION BoardRevision
+ )
+{
+ // Init Voltage Controller
+ VolConInit ();
+
+ // Setup CORE, MPU, IVA voltages for OPP100 operation
+
+ ClockModuleEnable (0x4A307838, 0x1); //cm_wkup_gpio1_clkctrl: AUTO
+
+ if( BoardRevision == PANDABOARD_REVISION_PANDAES ) {
+ // TPS62361 => VDD_MPU
+ // TWL6030 VCORE2 => VDD_IVA
+ // TWL6030 VCORE1 => VDD_CORE
+
+ // Setup CORE voltage
+ VolConSetup(PMIC_SMPS_ID0_SLAVE_ADDR,
+ PMIC_VCORE1_CFG_FORCE_REGADDR,
+ PMIC_VCORE1_CFG_FORCE_VSEL_VDD_CORE_4460);
+
+ // Clear TPS VSEL0
+ MmioAnd32 (GPIO1_BASE + GPIO_OE, ~BIT7);
+ MmioOr32 (GPIO1_BASE + GPIO_CLEARDATAOUT, BIT7);
+
+ // Setup MPU voltage
+ VolConSetup(TPS62361_SLAVE_ADDR,
+ TPS62361_SET1_REG_ADDR,
+ TPS62361_SET1_REG_VAL);
+
+ // Set TPS VSEL0
+ MmioOr32 (GPIO1_BASE + GPIO_SETDATAOUT, BIT7);
+ }
+ else {
+ // TWL6030 VCORE1 => VDD_MPU
+ // TWL6030 VCORE2 => VDD_IVA
+ // TWL6030 VCORE3 => VDD_CORE
+
+ // Setup CORE voltage
+ VolConSetup(PMIC_SMPS_ID0_SLAVE_ADDR,
+ PMIC_VCORE3_CFG_FORCE_REGADDR,
+ PMIC_VCORE3_CFG_FORCE_VSEL);
+
+ // Setup MPU voltage
+ VolConSetup(PMIC_SMPS_ID0_SLAVE_ADDR,
+ PMIC_VCORE1_CFG_FORCE_REGADDR,
+ PMIC_VCORE1_CFG_FORCE_VSEL_VDD_MPU_4430);
+ }
+
+ // Setup IVA voltage
+ VolConSetup(PMIC_SMPS_ID0_SLAVE_ADDR,
+ PMIC_VCORE2_CFG_FORCE_REGADDR,
+ PMIC_VCORE2_CFG_FORCE_VSEL);
+
+ // Accelerate MPU frequency
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_MPU_OPP100_VAL);
+
+ // Accelerate CORE clocks
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_CORE_OPP100_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M4_DPLL_CORE, CM_DIV_M4_DPLL_CORE_OPP100_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M5_DPLL_CORE, CM_DIV_M5_DPLL_CORE_OPP100_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_CORE_OPP100_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M7_DPLL_CORE, CM_DIV_M7_DPLL_CORE_OPP100_VAL);
+
+ // Start core frequency update
+ MmioWrite32 ( CKGEN_CM1_CM_SHADOW_FREQ_CONFIG1,
+ (CM_SHADOW_FREQ_CONFIG1_DPLL_CORE_M2_DIV_OPP100|
+ CM_SHADOW_FREQ_CONFIG1_DPLL_CORE_DPLL_EN_LOCK|
+ CM_SHADOW_FREQ_CONFIG1_DLL_RESET_RST|
+ CM_SHADOW_FREQ_CONFIG1_FREQ_UPDATE_START));
+
+ // Wait for core frequency update completion
+ while( (MmioRead32(CKGEN_CM1_CM_SHADOW_FREQ_CONFIG1) & (BIT0)) != 0 );
+
+ // Setup and lock IVA DPLL
+ MmioWrite32 (CKGEN_CM1_CM_CLKSEL_DPLL_IVA,
+ CKGEN_CM1_CM_CLKSEL_DPLL_IVA_CLKSEL_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M4_DPLL_IVA,
+ CKGEN_CM1_CM_CLKSEL_DPLL_IVA_M4_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M5_DPLL_IVA,
+ CKGEN_CM1_CM_CLKSEL_DPLL_IVA_M5_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_BYPCLK_DPLL_IVA,
+ CKGEN_CM1_CM_CLKSEL_DPLL_IVA_BYCLK_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_CLKMODE_DPLL_IVA,
+ CKGEN_CM1_CM_CLKSEL_DPLL_IVA_CLKMODE_VAL);
+
+ // Setup and lock ABE DPLL
+ MmioWrite32 (CKGEN_CM1_CM_CLKSEL_DPLL_ABE,
+ CKGEN_CM1_CM_CLKSEL_DPLL_ABE_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M2_DPLL_ABE,
+ CKGEN_CM1_CM_DIV_M2_DPLL_ABE_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_DIV_M3_DPLL_ABE,
+ CKGEN_CM1_CM_DIV_M3_DPLL_ABE_VAL);
+ MmioWrite32 (CKGEN_CM1_CM_CLKMODE_DPLL_ABE,
+ CKGEN_CM1_CM_CLKMODE_DPLL_ABE_VAL);
+
+ // Setup and lock USB DPLL
+ MmioWrite32 (CKGEN_CM2_CM_CLKSEL_DPLL_USB,
+ CKGEN_CM2_CM_CLKSEL_DPLL_USB_VAL);
+ MmioWrite32 (CKGEN_CM2_CM_DIV_M2_DPLL_USB,
+ CKGEN_CM2_CM_DIV_M2_DPLL_USB_VAL);
+ MmioWrite32 (CKGEN_CM2_CM_CLKMODE_DPLL_USB,
+ CKGEN_CM2_CM_CLKMODE_DPLL_USB_VAL);
+
+ MmioOr32 (0x4A009020, 0x100); //ISS_CLKCTRL_OPTFCLKEN
+ MmioOr32 (0x4A009120, 0xF00); //DSS_CLKCTRL_OPTFCLKEN
+
+ MmioWrite32 (0x4A008900, 0x2); //cm_mpu_m3_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A008F00, 0x2); //cm_ivahd_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A004400, 0x2); //cm_dsp_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A009100, 0x2); //cm_dss_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A009200, 0x2); //cm_sgx_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A004500, 0x2); //cm1_abe_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A008C00, 0x2); //cm_c2c_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A009000, 0x2); //cm_cam_clkstctrl: SW_WKUP
+ MmioWrite32 (0x4A008A00, 0x2); //cm_sdma_clkstctrl: SW_WKUP
+
+ MmioWrite32 (0x4A008E20, 0x1); //cm_l3instr_l3_3_clkctrl: AUTO
+ MmioWrite32 (0x4A008E28, 0x1); //cm_l3instr_l3_instr_clkctrl: AUTO
+ MmioWrite32 (0x4A008E40, 0x1); //cm_l3instr_intrconn_wp1_clkctrl: AUTO
+ MmioWrite32 (0x4A009338, 0x1); //cm_l3init_hsi_clkctrl: AUTO
+
+ ClockModuleEnable (0x4A004528, 0x2); //cm1_abe_aess_clkctrl: ENABLE
+
+ // TODO: pdm needs clock enabled externally to make it functional
+ MmioWrite32 (0x4A004530, 0x2); //cm1_abe_pdm_clkctrl: ENABLE
+
+ ClockModuleEnable (0x4A004538, 0x2); //cm1_abe_dmic_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004540, 0x2); //cm1_abe_mcasp_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004548, 0x2); //cm1_abe_mcbsp1_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004550, 0x2); //cm1_abe_mcbsp2_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004558, 0x2); //cm1_abe_mcbsp3_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004560, 0x2); //cm1_abe_slimbus_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004568, 0x2); //cm1_abe_timer5_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004570, 0x2); //cm1_abe_timer6_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004578, 0x2); //cm1_abe_timer7_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004580, 0x2); //cm1_abe_timer8_clkctrl: ENABLE
+ ClockModuleEnable (0x4A004588, 0x2); //cm1_abe_wdt3_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009450, 0x2); //cm_l4per_gptimer9_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009428, 0x2); //cm_l4per_gptimer10_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009430, 0x2); //cm_l4per_gptimer11_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009440, 0x2); //cm_l4per_gptimer3_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009448, 0x2); //cm_l4per_gptimer4_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009488, 0x2); //cm_l4per_hdq1w_clkctrl: ENABLE
+ ClockModuleEnable (0x4A0094E0, 0x2); //cm_l4per_mcbsp4_clkctrl: ENABLE
+ ClockModuleEnable (0x4A0094F8, 0x2); //cm_l4per_mcspi2_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009500, 0x2); //cm_l4per_mcspi3_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009508, 0x2); //cm_l4per_mcspi4_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009520, 0x2); //cm_l4per_mmcsd3_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009528, 0x2); //cm_l4per_mmcsd4_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009560, 0x2); //cm_l4per_mmcsd5_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009540, 0x2); //cm_l4per_uart1_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009548, 0x2); //cm_l4per_uart2_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009558, 0x2); //cm_l4per_uart4_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009438, 0x2); //gptimer2: ENABLE
+ ClockModuleEnable (0x4A009460, 0x1); //gpio2: AUTO
+ ClockModuleEnable (0x4A009468, 0x1); //gpio3: AUTO
+ ClockModuleEnable (0x4A009470, 0x101); //gpio4: AUTO+FCLK
+ ClockModuleEnable (0x4A009478, 0x1); //gpio5: AUTO
+ ClockModuleEnable (0x4A009480, 0x1); //gpio6: AUTO
+ ClockModuleEnable (0x4A0094A8, 0x2); //i2c2: ENABLE
+ ClockModuleEnable (0x4A0094B0, 0x2); //i2c3: ENABLE
+ ClockModuleEnable (0x4A0094B8, 0x2); //i2c4: ENABLE
+ ClockModuleEnable (0x4A0094F0, 0x2); //mcspi1: ENABLE
+ ClockModuleEnable (0x4A307878, 0x2); //cm_wkup_keyboard_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009020, 0x2); //cm_cam_iss_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009028, 0x2); //cm_cam_fdif_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009120, 0x2); //cm_dss_dss_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009220, 0x2); //cm_sgx_sgx_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009328, 0x1040002); //mmchs1: ENABLE
+ ClockModuleEnable (0x4A009330, 0x1040002); //mmchs2: ENABLE
+ ClockModuleEnable (0x4A009358, 0xFF02); //cm_l3init_hsusbhost_clkctrl: ENABLE
+ ClockModuleEnable (0x4A009368, 0x1); //usbtll: AUTO
+
+ MmioWrite32 (0x4A008900, 0x3); //cm_mpu_m3_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A008F00, 0x3); //cm_ivahd_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A004400, 0x3); //cm_dsp_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A009100, 0x3); //cm_dss_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A009200, 0x3); //cm_sgx_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A004500, 0x3); //cm1_abe_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A008C00, 0x3); //cm_c2c_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A008A00, 0x3); //cm_sdma_clkstctrl: HW_AUTO
+ MmioWrite32 (0x4A009400, 0x3); //l4per: HW_AUTO
+ MmioWrite32 (0x4A009300, 0x3); //l3init: HW_AUTO
+ MmioWrite32 (0x4A008B00, 0x3); //memif: HW_AUTO
+ MmioWrite32 (0x4A008D00, 0x3); //l4cfg: HW_AUTO
+ MmioWrite32 (0x4A009000, 0x0); //cm_cam_clkstctrl: NO_SLEEP
}
diff --git a/PandaBoardPkg/Library/PandaBoardLib/PadConfiguration.c b/PandaBoardPkg/Library/PandaBoardLib/PadConfiguration.c
index c22b8065e..41dae5b4e 100755
--- a/PandaBoardPkg/Library/PandaBoardLib/PadConfiguration.c
+++ b/PandaBoardPkg/Library/PandaBoardLib/PadConfiguration.c
@@ -18,305 +18,326 @@
#include <Omap4430/Omap4430.h>
#include <PandaBoard.h>
-#define NUM_PINS_SHARED 232
-#define NUM_PINS_ABC 6
-#define NUM_PINS_XM 12
+PAD_CONFIGURATION PadConfigurationTableSharedCore[] = {
+ {GPMC_AD0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat0 */
+ {GPMC_AD1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat1 */
+ {GPMC_AD2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat2 */
+ {GPMC_AD3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat3 */
+ {GPMC_AD4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat4 */
+ {GPMC_AD5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat5 */
+ {GPMC_AD6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat6 */
+ {GPMC_AD7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_dat7 */
+ {GPMC_NOE, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M1)}, /* sdmmc2_clk */
+ {GPMC_NWE, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* sdmmc2_cmd */
+ {SDMMC1_CLK, (PTU | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc1_clk */
+ {SDMMC1_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_cmd */
+ {SDMMC1_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat0 */
+ {SDMMC1_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat1 */
+ {SDMMC1_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat2 */
+ {SDMMC1_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat3 */
+ {SDMMC1_DAT4, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat4 */
+ {SDMMC1_DAT5, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat5 */
+ {SDMMC1_DAT6, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat6 */
+ {SDMMC1_DAT7, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc1_dat7 */
+ {I2C1_SCL, (PTU | IEN | M0)}, /* i2c1_scl */
+ {I2C1_SDA, (PTU | IEN | M0)}, /* i2c1_sda */
+ {I2C2_SCL, (PTU | IEN | M0)}, /* i2c2_scl */
+ {I2C2_SDA, (PTU | IEN | M0)}, /* i2c2_sda */
+ {I2C3_SCL, (PTU | IEN | M0)}, /* i2c3_scl */
+ {I2C3_SDA, (PTU | IEN | M0)}, /* i2c3_sda */
+ {I2C4_SCL, (PTU | IEN | M0)}, /* i2c4_scl */
+ {I2C4_SDA, (PTU | IEN | M0)}, /* i2c4_sda */
+ {UART3_CTS_RCTX, (PTU | IEN | M0)}, /* uart3_tx */
+ {UART3_RTS_SD, (M0)}, /* uart3_rts_sd */
+ {UART3_RX_IRRX, (IEN | M0)}, /* uart3_rx */
+ {UART3_TX_IRTX, (M0)}, /* uart3_tx */
+ {USBB1_ULPITLL_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4)},/* usbb1_ulpiphy_clk */
+ {USBB1_ULPITLL_STP, (OFF_EN | OFF_OUT_PTD | M4)}, /* usbb1_ulpiphy_stp */
+ {USBB1_ULPITLL_DIR, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dir */
+ {USBB1_ULPITLL_NXT, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_nxt */
+ {USBB1_ULPITLL_DAT0, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat0 */
+ {USBB1_ULPITLL_DAT1, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat1 */
+ {USBB1_ULPITLL_DAT2, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat2 */
+ {USBB1_ULPITLL_DAT3, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat3 */
+ {USBB1_ULPITLL_DAT4, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat4 */
+ {USBB1_ULPITLL_DAT5, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat5 */
+ {USBB1_ULPITLL_DAT6, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat6 */
+ {USBB1_ULPITLL_DAT7, (IEN | OFF_EN | OFF_PD | OFF_IN | M4)}, /* usbb1_ulpiphy_dat7 */
+ {USBB1_HSIC_DATA, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_data */
+ {USBB1_HSIC_STROBE, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usbb1_hsic_strobe */
+ {USBC1_ICUSB_DP, (IEN | M0)}, /* usbc1_icusb_dp */
+ {USBC1_ICUSB_DM, (IEN | M0)}, /* usbc1_icusb_dm */
+ {UNIPRO_TY2, (PTU | IEN | M3)}, /* gpio_1 */
+ {GPMC_WAIT1, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_62 */
+ {FREF_CLK2_OUT, (PTU | IEN | M3)}, /* gpio_182: BOARD_ID0 */
+ {GPMC_AD8, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* gpio_32 */
+ {GPMC_AD9, (PTU | IEN | M3)}, /* gpio_33 */
+ {GPMC_AD10, (PTU | IEN | M3)}, /* gpio_34 */
+ {GPMC_AD11, (PTU | IEN | M3)}, /* gpio_35 */
+ {GPMC_AD12, (PTU | IEN | M3)}, /* gpio_36 */
+ {GPMC_AD13, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_37 */
+ {GPMC_AD14, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_38 */
+ {GPMC_AD15, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_39 */
+ {GPMC_A16, (M3)}, /* gpio_40 */
+ {GPMC_A17, (PTD | M3)}, /* gpio_41 */
+ {GPMC_A18, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row6 */
+ {GPMC_A19, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row7 */
+ {GPMC_A20, (IEN | M3)}, /* gpio_44 */
+ {GPMC_A21, (M3)}, /* gpio_45 */
+ {GPMC_A22, (M3)}, /* gpio_46 */
+ {GPMC_A23, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col7 */
+ {GPMC_A24, (PTD | M3)}, /* gpio_48: BOARD_ID1 (Panda ES only) */
+ {GPMC_A25, (PTD | M3)}, /* gpio_49 */
+ {GPMC_NCS0, (M3)}, /* gpio_50 */
+ {GPMC_NCS1, (IEN | M3)}, /* gpio_51 */
+ {GPMC_NCS2, (IEN | M3)}, /* gpio_52 */
+ {GPMC_NCS3, (IEN | M3)}, /* gpio_53 */
+ {GPMC_NWP, (M3)}, /* gpio_54 */
+ {GPMC_CLK, (PTD | M3)}, /* gpio_55 */
+ {GPMC_NADV_ALE, (M3)}, /* gpio_56 */
+ {GPMC_NBE0_CLE, (M3)}, /* gpio_59 */
+ {GPMC_NBE1, (PTD | M3)}, /* gpio_60 */
+ {GPMC_WAIT0, (PTU | IEN | M3)}, /* gpio_61 */
+ {C2C_DATA11, (PTD | M3)}, /* gpio_100 */
+ {C2C_DATA12, (PTU | IEN | M3)}, /* gpio_101: BOARD_ID1 (Panda only) */
+ {C2C_DATA13, (PTD | M3)}, /* gpio_102 */
+ {C2C_DATA14, (M1)}, /* dsi2_te0 */
+ {C2C_DATA15, (PTD | M3)}, /* gpio_104 */
+ {HDMI_HPD, (M0)}, /* hdmi_hpd */
+ {HDMI_CEC, (M0)}, /* hdmi_cec */
+ {HDMI_DDC_SCL, (PTU | M0)}, /* hdmi_ddc_scl */
+ {HDMI_DDC_SDA, (PTU | IEN | M0)}, /* hdmi_ddc_sda */
+ {CSI21_DX0, (IEN | M0)}, /* csi21_dx0 */
+ {CSI21_DY0, (IEN | M0)}, /* csi21_dy0 */
+ {CSI21_DX1, (IEN | M0)}, /* csi21_dx1 */
+ {CSI21_DY1, (IEN | M0)}, /* csi21_dy1 */
+ {CSI21_DX2, (IEN | M0)}, /* csi21_dx2 */
+ {CSI21_DY2, (IEN | M0)}, /* csi21_dy2 */
+ {CSI21_DX3, (PTD | M7)}, /* csi21_dx3 */
+ {CSI21_DY3, (PTD | M7)}, /* csi21_dy3 */
+ {CSI21_DX4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dx4 */
+ {CSI21_DY4, (PTD | OFF_EN | OFF_PD | OFF_IN | M7)}, /* csi21_dy4 */
+ {CSI22_DX0, (IEN | M0)}, /* csi22_dx0 */
+ {CSI22_DY0, (IEN | M0)}, /* csi22_dy0 */
+ {CSI22_DX1, (IEN | M0)}, /* csi22_dx1 */
+ {CSI22_DY1, (IEN | M0)}, /* csi22_dy1 */
+ {CAM_SHUTTER, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_shutter */
+ {CAM_STROBE, (OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* cam_strobe */
+ {CAM_GLOBALRESET, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3)}, /* gpio_83 */
+ {ABE_MCBSP2_DR, (IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dr */
+ {ABE_MCBSP2_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp2_dx */
+ {ABE_MCBSP2_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_fsx */
+ {ABE_MCBSP1_CLKX, (IEN | M0)}, /* abe_mcbsp1_clkx */
+ {ABE_MCBSP1_DR, (IEN | M0)}, /* abe_mcbsp1_dr */
+ {ABE_MCBSP1_DX, (OFF_EN | OFF_OUT_PTD | M0)}, /* abe_mcbsp1_dx */
+ {ABE_MCBSP1_FSX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp1_fsx */
+ {ABE_PDM_UL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_ul_data */
+ {ABE_PDM_DL_DATA, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_dl_data */
+ {ABE_PDM_FRAME, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_frame */
+ {ABE_PDM_LB_CLK, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_pdm_lb_clk */
+ {ABE_CLKS, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_clks */
+ {ABE_DMIC_CLK1, (M0)}, /* abe_dmic_clk1 */
+ {ABE_DMIC_DIN1, (IEN | M0)}, /* abe_dmic_din1 */
+ {ABE_DMIC_DIN2, (PTU | IEN | M3)}, /* gpio_121 */
+ {ABE_DMIC_DIN3, (IEN | M0)}, /* abe_dmic_din3 */
+ {UART2_CTS, (PTU | IEN | M7)}, /* uart2_cts */
+ {UART2_RTS, (M7)}, /* uart2_rts */
+ {UART2_RX, (PTU | IEN | M7)}, /* uart2_rx */
+ {UART2_TX, (M7)}, /* uart2_tx */
+ {HDQ_SIO, (M3)}, /* gpio_127 */
+ {MCSPI1_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_clk */
+ {MCSPI1_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_somi */
+ {MCSPI1_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_simo */
+ {MCSPI1_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi1_cs0 */
+ {MCSPI1_CS1, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M3)}, /* mcspi1_cs1 */
+ {MCSPI1_CS2, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_139 */
+ {MCSPI1_CS3, (PTU | IEN | M3)}, /* gpio_140 */
+ {SDMMC5_CLK, (PTU | IEN | OFF_EN | OFF_OUT_PTD | M0)}, /* sdmmc5_clk */
+ {SDMMC5_CMD, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_cmd */
+ {SDMMC5_DAT0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat0 */
+ {SDMMC5_DAT1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat1 */
+ {SDMMC5_DAT2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat2 */
+ {SDMMC5_DAT3, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* sdmmc5_dat3 */
+ {MCSPI4_CLK, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_clk */
+ {MCSPI4_SIMO, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_simo */
+ {MCSPI4_SOMI, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_somi */
+ {MCSPI4_CS0, (PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* mcspi4_cs0 */
+ {UART4_RX, (IEN | M0)}, /* uart4_rx */
+ {UART4_TX, (M0)}, /* uart4_tx */
+ {USBB2_ULPITLL_CLK, (IEN | M3)}, /* gpio_157 */
+ {USBB2_ULPITLL_STP, (IEN | M5)}, /* dispc2_data23 */
+ {USBB2_ULPITLL_DIR, (IEN | M5)}, /* dispc2_data22 */
+ {USBB2_ULPITLL_NXT, (IEN | M5)}, /* dispc2_data21 */
+ {USBB2_ULPITLL_DAT0, (IEN | M5)}, /* dispc2_data20 */
+ {USBB2_ULPITLL_DAT1, (IEN | M5)}, /* dispc2_data19 */
+ {USBB2_ULPITLL_DAT2, (IEN | M5)}, /* dispc2_data18 */
+ {USBB2_ULPITLL_DAT3, (IEN | M5)}, /* dispc2_data15 */
+ {USBB2_ULPITLL_DAT4, (IEN | M5)}, /* dispc2_data14 */
+ {USBB2_ULPITLL_DAT5, (IEN | M5)}, /* dispc2_data13 */
+ {USBB2_ULPITLL_DAT6, (IEN | M5)}, /* dispc2_data12 */
+ {USBB2_ULPITLL_DAT7, (IEN | M5)}, /* dispc2_data11 */
+ {USBB2_HSIC_DATA, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_169 */
+ {USBB2_HSIC_STROBE, (PTD | OFF_EN | OFF_OUT_PTU | M3)}, /* gpio_170 */
+ {UNIPRO_TX0, (PTD | IEN | M3)}, /* gpio_171 */
+ {UNIPRO_TY0, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col1 */
+ {UNIPRO_TX1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col2 */
+ {UNIPRO_TY1, (OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_col3: BOARD_ID2 (gpio_171) */
+ {UNIPRO_TX2, (PTU | IEN | M3)}, /* gpio_0 */
+ {UNIPRO_RX0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row0 */
+ {UNIPRO_RY0, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3 | DIS)}, /* kpd_row1: BOARD_ID4 (gpio_2) */
+ {UNIPRO_RX1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3 | DIS)}, /* kpd_row2: BOARD_ID3 (gpio_3) */
+ {UNIPRO_RY1, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row3 */
+ {UNIPRO_RX2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row4 */
+ {UNIPRO_RY2, (PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1)}, /* kpd_row5 */
+ {USBA0_OTG_CE, (PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0)}, /* usba0_otg_ce */
+ {USBA0_OTG_DP, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dp */
+ {USBA0_OTG_DM, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* usba0_otg_dm */
+ {FREF_CLK1_OUT, (M0)}, /* fref_clk1_out */
+ {SYS_NIRQ1, (PTU | IEN | M0)}, /* sys_nirq1 */
+ {SYS_NIRQ2, (PTU | IEN | M0)}, /* sys_nirq2 */
+ {SYS_BOOT0, (PTU | IEN | M3)}, /* gpio_184 */
+ {SYS_BOOT1, (M3)}, /* gpio_185 */
+ {SYS_BOOT2, (PTD | IEN | M3)}, /* gpio_186 */
+ {SYS_BOOT3, (M3)}, /* gpio_187 */
+ {SYS_BOOT4, (M3)}, /* gpio_188 */
+ {SYS_BOOT5, (PTD | IEN | M3)}, /* gpio_189 */
+ {DPM_EMU0, (IEN | M0)}, /* dpm_emu0 */
+ {DPM_EMU1, (IEN | M0)}, /* dpm_emu1 */
+ {DPM_EMU2, (IEN | M0)}, /* dpm_emu2 */
+ {DPM_EMU3, (IEN | M5)}, /* dispc2_data10 */
+ {DPM_EMU4, (IEN | M5)}, /* dispc2_data9 */
+ {DPM_EMU5, (IEN | M5)}, /* dispc2_data16 */
+ {DPM_EMU6, (IEN | M5)}, /* dispc2_data17 */
+ {DPM_EMU7, (IEN | M5)}, /* dispc2_hsync */
+ {DPM_EMU8, (IEN | M5)}, /* dispc2_pclk */
+ {DPM_EMU9, (IEN | M5)}, /* dispc2_vsync */
+ {DPM_EMU10, (IEN | M5)}, /* dispc2_de */
+ {DPM_EMU11, (IEN | M5)}, /* dispc2_data8 */
+ {DPM_EMU12, (IEN | M5)}, /* dispc2_data7 */
+ {DPM_EMU13, (IEN | M5)}, /* dispc2_data6 */
+ {DPM_EMU14, (IEN | M5)}, /* dispc2_data5 */
+ {DPM_EMU15, (IEN | M5)}, /* dispc2_data4 */
+ {DPM_EMU16, (M3)}, /* gpio_27 */
+ {DPM_EMU17, (IEN | M5)}, /* dispc2_data2 */
+ {DPM_EMU18, (IEN | M5)}, /* dispc2_data1 */
+ {DPM_EMU19, (IEN | M5)}, /* dispc2_data0 */
+};
+
+PAD_CONFIGURATION PadConfigurationTableSharedWkup[] = {
+ {PAD1_SR_SCL, (PTU | IEN | M0)}, /* sr_scl */
+ {PAD0_SR_SDA, (PTU | IEN | M0)}, /* sr_sda */
+ {PAD1_SYS_32K, (IEN | M0)}, /* sys_32k */
+ {PAD0_FREF_CLK3_OUT, (M0)}, /* fref_clk3_out */
+ {PAD0_SIM_IO, (IEN | M0)}, /* sim_io */
+ {PAD1_SIM_CLK, (M0)}, /* sim_clk */
+ {PAD0_SIM_RESET, (M0)}, /* sim_reset */
+ {PAD1_SIM_CD, (PTU | IEN | M0)}, /* sim_cd */
+ {PAD0_SIM_PWRCTRL, (M0)}, /* sim_pwrctrl */
+ {PAD1_FREF_XTAL_IN, (M0)}, /* # */
+ {PAD0_FREF_SLICER_IN, (M0)}, /* fref_slicer_in */
+ {PAD1_FREF_CLK_IOREQ, (M0)}, /* fref_clk_ioreq */
+ {PAD0_FREF_CLK0_OUT, (M2)}, /* sys_drm_msecure */
+ {PAD1_FREF_CLK3_REQ, M7}, /* safe mode */
+ {PAD0_FREF_CLK4_OUT, (PTU | M3)}, /* led status_2 */
+ {PAD0_SYS_NRESPWRON, (M0)}, /* sys_nrespwron */
+ {PAD1_SYS_NRESWARM, (M0)}, /* sys_nreswarm */
+ {PAD0_SYS_PWR_REQ, (PTU | M0)}, /* sys_pwr_req */
+ {PAD1_SYS_PWRON_RESET, (M3)}, /* gpio_wk29 */
+ {PAD0_SYS_BOOT6, (IEN | M3)}, /* gpio_wk9 */
+ {PAD1_SYS_BOOT7, (IEN | M3)}, /* gpio_wk10 */
+};
-PAD_CONFIGURATION PadConfigurationTableShared[] = {
- //Pin, MuxMode, PullConfig, InputEnable
- { SDRC_D0, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D1, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D2, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D3, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D4, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D5, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D6, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D7, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D8, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D9, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D10, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D11, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D12, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D13, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D14, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D15, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D16, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D17, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D18, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D19, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D20, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D21, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D22, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D23, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D24, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D25, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D26, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D27, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D28, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D29, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D30, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_D31, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_CLK, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_DQS0, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_CKE0, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { SDRC_CKE1, MUXMODE7, PULL_DISABLED, INPUT },
- { SDRC_DQS1, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_DQS2, MUXMODE0, PULL_DISABLED, INPUT },
- { SDRC_DQS3, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_A1, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A2, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A3, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A4, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A5, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A6, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A7, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A8, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A9, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_A10, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_D0, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D1, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D2, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D3, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D4, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D5, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D6, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D7, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D8, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D9, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D10, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D11, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D12, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D13, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D14, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_D15, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_NCS0, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_NCS1, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { GPMC_NCS2, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { GPMC_NCS3, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { GPMC_NCS4, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { GPMC_NCS5, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_NCS6, MUXMODE1, PULL_DISABLED, INPUT },
- { GPMC_NCS7, MUXMODE1, PULL_UP_SELECTED, INPUT },
- { GPMC_CLK, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_NADV_ALE, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_NOE, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_NWE, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_NBE0_CLE, MUXMODE0, PULL_DISABLED, OUTPUT },
- { GPMC_NBE1, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_NWP, MUXMODE0, PULL_DISABLED, INPUT },
- { GPMC_WAIT0, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { GPMC_WAIT1, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { GPMC_WAIT2, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { GPMC_WAIT3, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { DSS_PCLK, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_HSYNC, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_PSYNC, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_ACBIAS, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA0, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA1, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA2, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA3, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA4, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA5, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA6, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA7, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA8, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA9, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA10, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA11, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA12, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA13, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA14, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA15, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA16, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA17, MUXMODE0, PULL_DISABLED, OUTPUT },
- { CAM_HS, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { CAM_VS, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { CAM_XCLKA, MUXMODE0, PULL_DISABLED, OUTPUT },
- { CAM_PCLK, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { CAM_FLD, MUXMODE4, PULL_DISABLED, OUTPUT },
- { CAM_D0, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D1, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D2, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D3, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D4, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D5, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D6, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D7, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D8, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D9, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D10, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_D11, MUXMODE0, PULL_DISABLED, INPUT },
- { CAM_XCLKB, MUXMODE0, PULL_DISABLED, OUTPUT },
- { CAM_WEN, MUXMODE4, PULL_DISABLED, INPUT },
- { CAM_STROBE, MUXMODE0, PULL_DISABLED, OUTPUT },
- { CSI2_DX0, MUXMODE0, PULL_DISABLED, INPUT },
- { CSI2_DY0, MUXMODE0, PULL_DISABLED, INPUT },
- { CSI2_DX1, MUXMODE0, PULL_DISABLED, INPUT },
- { CSI2_DY1, MUXMODE0, PULL_DISABLED, INPUT },
- { MCBSP2_FSX, MUXMODE0, PULL_DISABLED, INPUT },
- { MCBSP2_CLKX, MUXMODE0, PULL_DISABLED, INPUT },
- { MCBSP2_DR, MUXMODE0, PULL_DISABLED, INPUT },
- { MCBSP2_DX, MUXMODE0, PULL_DISABLED, OUTPUT },
- { MMC1_CLK, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { MMC1_CMD, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT0, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT1, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT2, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT3, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT4, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT5, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT6, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC1_DAT7, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MMC2_CLK, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_CMD, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT0, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT1, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT2, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT3, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT4, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT5, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT6, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MMC2_DAT7, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MCBSP3_DX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP3_DR, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP3_CLKX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP3_FSX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { UART2_CTS, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { UART2_RTS, MUXMODE0, PULL_DISABLED, OUTPUT },
- { UART2_TX, MUXMODE0, PULL_DISABLED, OUTPUT },
- { UART2_RX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { UART1_TX, MUXMODE0, PULL_DISABLED, OUTPUT },
- { UART1_RTS, MUXMODE4, PULL_DISABLED, OUTPUT },
- { UART1_CTS, MUXMODE4, PULL_DISABLED, OUTPUT },
- { UART1_RX, MUXMODE0, PULL_DISABLED, INPUT },
- { MCBSP4_CLKX, MUXMODE1, PULL_DISABLED, INPUT },
- { MCBSP4_DR, MUXMODE1, PULL_DISABLED, INPUT },
- { MCBSP4_DX, MUXMODE1, PULL_DISABLED, INPUT },
- { MCBSP4_FSX, MUXMODE1, PULL_DISABLED, INPUT },
- { MCBSP1_CLKR, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP1_FSR, MUXMODE4, PULL_UP_SELECTED, OUTPUT },
- { MCBSP1_DX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP1_DR, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP1_CLKS, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MCBSP1_FSX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCBSP1_CLKX, MUXMODE4, PULL_DISABLED, OUTPUT },
- { UART3_CTS_RCTX,MUXMODE0, PULL_UP_SELECTED, INPUT },
- { UART3_RTS_SD, MUXMODE0, PULL_DISABLED, OUTPUT },
- { UART3_RX_IRRX, MUXMODE0, PULL_DISABLED, INPUT },
- { UART3_TX_IRTX, MUXMODE0, PULL_DISABLED, OUTPUT },
- { HSUSB0_CLK, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_STP, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { HSUSB0_DIR, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_NXT, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA0, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA1, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA2, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA3, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA4, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA5, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA6, MUXMODE0, PULL_DISABLED, INPUT },
- { HSUSB0_DATA7, MUXMODE0, PULL_DISABLED, INPUT },
- { I2C1_SCL, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { I2C1_SDA, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { I2C2_SCL, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { I2C2_SDA, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { I2C3_SCL, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { I2C3_SDA, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { HDQ_SIO, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCSPI1_CLK, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MCSPI1_SIMO, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { MCSPI1_SOMI, MUXMODE0, PULL_DISABLED, INPUT },
- { MCSPI1_CS0, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { MCSPI1_CS1, MUXMODE0, PULL_UP_SELECTED, OUTPUT },
- { MCSPI1_CS2, MUXMODE4, PULL_DISABLED, OUTPUT },
- { MCSPI1_CS3, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { MCSPI2_CLK, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { MCSPI2_SIMO, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { MCSPI2_SOMI, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { MCSPI2_CS0, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { MCSPI2_CS1, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { SYS_NIRQ, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { SYS_CLKOUT2, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { ETK_CLK, MUXMODE3, PULL_UP_SELECTED, OUTPUT },
- { ETK_CTL, MUXMODE3, PULL_UP_SELECTED, OUTPUT },
- { ETK_D0, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D1, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D2, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D3, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D4, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D5, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D6, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D7, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D8, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D9, MUXMODE4, PULL_UP_SELECTED, INPUT },
- { ETK_D10, MUXMODE3, PULL_UP_SELECTED, OUTPUT },
- { ETK_D11, MUXMODE3, PULL_UP_SELECTED, OUTPUT },
- { ETK_D12, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D13, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D14, MUXMODE3, PULL_UP_SELECTED, INPUT },
- { ETK_D15, MUXMODE3, PULL_UP_SELECTED, INPUT }
+PAD_CONFIGURATION PadConfigurationTable4430Core[] = {
+ {ABE_MCBSP2_CLKX, (IEN | OFF_EN | OFF_PD | OFF_IN | M0)}, /* abe_mcbsp2_clkx */
};
-PAD_CONFIGURATION PadConfigurationTableAbc[] = {
- { DSS_DATA18, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA19, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA20, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA21, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA22, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA23, MUXMODE0, PULL_DISABLED, OUTPUT }
+PAD_CONFIGURATION PadConfigurationTable4430Wkup[] = {
+ {PAD1_FREF_CLK4_REQ, (PTU | M3)}, /* led status_1 */
};
-PAD_CONFIGURATION PadConfigurationTableXm[] = {
- { DSS_DATA18, MUXMODE3, PULL_DISABLED, OUTPUT },
- { DSS_DATA19, MUXMODE3, PULL_DISABLED, OUTPUT },
- { DSS_DATA20, MUXMODE3, PULL_DISABLED, OUTPUT },
- { DSS_DATA21, MUXMODE3, PULL_DISABLED, OUTPUT },
- { DSS_DATA22, MUXMODE3, PULL_DISABLED, OUTPUT },
- { DSS_DATA23, MUXMODE3, PULL_DISABLED, OUTPUT },
- { SYS_BOOT0, MUXMODE3, PULL_DISABLED, OUTPUT },
- { SYS_BOOT1, MUXMODE3, PULL_DISABLED, OUTPUT },
- { SYS_BOOT3, MUXMODE3, PULL_DISABLED, OUTPUT },
- { SYS_BOOT4, MUXMODE3, PULL_DISABLED, OUTPUT },
- { SYS_BOOT5, MUXMODE3, PULL_DISABLED, OUTPUT },
- { SYS_BOOT6, MUXMODE3, PULL_DISABLED, OUTPUT }
+PAD_CONFIGURATION PadConfigurationTable4460Core[] = {
+ {ABE_MCBSP2_CLKX, (PTU | OFF_EN | OFF_OUT_PTU | M3)}, /* led status_1 */
+};
+
+PAD_CONFIGURATION PadConfigurationTable4460Wkup[] = {
+ {PAD1_FREF_CLK4_REQ, (M3)}, /* gpio_wk7 for TPS: Mode 3 */
};
VOID
PadConfiguration (
- PANDABOARD_REVISION Revision
+ PANDABOARD_REVISION BoardRevision
)
{
UINTN Index;
- UINT16 PadConfiguration;
- PAD_CONFIGURATION *BoardConfiguration;
UINTN NumPinsToConfigure;
- for (Index = 0; Index < NUM_PINS_SHARED; Index++) {
- // Set up Pad configuration for particular pin.
- PadConfiguration = (PadConfigurationTableShared[Index].MuxMode << MUXMODE_OFFSET);
- PadConfiguration |= (PadConfigurationTableShared[Index].PullConfig << PULL_CONFIG_OFFSET);
- PadConfiguration |= (PadConfigurationTableShared[Index].InputEnable << INPUTENABLE_OFFSET);
-
+ // Calculate number of pins for core domain
+ NumPinsToConfigure = sizeof(PadConfigurationTableSharedCore) / sizeof(PAD_CONFIGURATION);
+
+ for (Index = 0; Index < NumPinsToConfigure; Index++) {
// Configure the pin with specific Pad configuration.
- MmioWrite16(PadConfigurationTableShared[Index].Pin, PadConfiguration);
+ MmioWrite16((OMAP4430_CONTROL_MODULE_CORE_BASE+PadConfigurationTableSharedCore[Index].Off),
+ PadConfigurationTableSharedCore[Index].Val);
}
- if (Revision == REVISION_XM) {
- BoardConfiguration = PadConfigurationTableXm;
- NumPinsToConfigure = NUM_PINS_XM;
- } else {
- BoardConfiguration = PadConfigurationTableAbc;
- NumPinsToConfigure = NUM_PINS_ABC;
+ // Calculate number of pins for wkup domain
+ NumPinsToConfigure = sizeof(PadConfigurationTableSharedWkup) / sizeof(PAD_CONFIGURATION);
+
+ for (Index = 0; Index < NumPinsToConfigure; Index++) {
+ // Configure the pin with specific Pad configuration.
+ MmioWrite16((OMAP4430_CONTROL_MODULE_WKUP_BASE+PadConfigurationTableSharedWkup[Index].Off),
+ PadConfigurationTableSharedWkup[Index].Val);
+ }
+
+ // If PandaBoard-ES
+ if( BoardRevision == PANDABOARD_REVISION_PANDAES ) {
+ // Calculate number of pins for core domain
+ NumPinsToConfigure = sizeof(PadConfigurationTable4460Core) / sizeof(PAD_CONFIGURATION);
+
+ for (Index = 0; Index < NumPinsToConfigure; Index++) {
+ // Configure the pin with specific Pad configuration.
+ MmioWrite16((OMAP4430_CONTROL_MODULE_CORE_BASE+PadConfigurationTable4460Core[Index].Off),
+ PadConfigurationTable4460Core[Index].Val);
+ }
+
+ // Calculate number of pins for wkup domain
+ NumPinsToConfigure = sizeof(PadConfigurationTable4460Wkup) / sizeof(PAD_CONFIGURATION);
+
+ for (Index = 0; Index < NumPinsToConfigure; Index++) {
+ // Configure the pin with specific Pad configuration.
+ MmioWrite16((OMAP4430_CONTROL_MODULE_WKUP_BASE+PadConfigurationTable4460Wkup[Index].Off),
+ PadConfigurationTable4460Wkup[Index].Val);
+ }
+ }
+ else {
+ // Calculate number of pins for core domain
+ NumPinsToConfigure = sizeof(PadConfigurationTable4430Core) / sizeof(PAD_CONFIGURATION);
+
+ for (Index = 0; Index < NumPinsToConfigure; Index++) {
+ // Configure the pin with specific Pad configuration.
+ MmioWrite16((OMAP4430_CONTROL_MODULE_CORE_BASE+PadConfigurationTable4430Core[Index].Off),
+ PadConfigurationTable4430Core[Index].Val);
+ }
+
+ // Calculate number of pins for wkup domain
+ NumPinsToConfigure = sizeof(PadConfigurationTable4430Wkup) / sizeof(PAD_CONFIGURATION);
+
+ for (Index = 0; Index < NumPinsToConfigure; Index++) {
+ // Configure the pin with specific Pad configuration.
+ MmioWrite16((OMAP4430_CONTROL_MODULE_WKUP_BASE+PadConfigurationTable4430Wkup[Index].Off),
+ PadConfigurationTable4430Wkup[Index].Val);
+ }
}
- for (Index = 0; Index < NumPinsToConfigure; Index++) {
- //Set up Pad configuration for particular pin.
- PadConfiguration = (BoardConfiguration[Index].MuxMode << MUXMODE_OFFSET);
- PadConfiguration |= (BoardConfiguration[Index].PullConfig << PULL_CONFIG_OFFSET);
- PadConfiguration |= (BoardConfiguration[Index].InputEnable << INPUTENABLE_OFFSET);
+ // EMIF pads
+ MmioWrite32 (0x4A100638, 0x7c7c7c7c);
+ MmioWrite32 (0x4A10063C, 0x7c7c7c7c);
+ MmioWrite32 (0x4A100640, 0x7C787C00);
+ MmioWrite32 (0x4A100644, 0xA0888C0F);
+
+ MmioWrite32 (0x4A100648, 0x7C7C7C7C);
+ MmioWrite32 (0x4A10064C, 0x7C7C7C7C);
+ MmioWrite32 (0x4A100650, 0x7C787C00);
+ MmioWrite32 (0x4A100654, 0xA0888C0F);
- //Configure the pin with specific Pad configuration.
- MmioWrite16(BoardConfiguration[Index].Pin, PadConfiguration);
- }
}
diff --git a/PandaBoardPkg/Library/PandaBoardLib/PandaBoard.c b/PandaBoardPkg/Library/PandaBoardLib/PandaBoard.c
index c04fc6af6..cec10b1a3 100644
--- a/PandaBoardPkg/Library/PandaBoardLib/PandaBoard.c
+++ b/PandaBoardPkg/Library/PandaBoardLib/PandaBoard.c
@@ -47,12 +47,12 @@ ARM_CORE_INFO mVersatileExpressMpCoreInfoPandaBoard[] = {
VOID
PadConfiguration (
- PANDABOARD_REVISION Revision
+ PANDABOARD_REVISION BoardRevision
);
VOID
ClockInit (
- VOID
+ PANDABOARD_REVISION BoardRevision
);
/**
@@ -61,26 +61,22 @@ ClockInit (
@return Board revision
**/
PANDABOARD_REVISION
-PandaBoardGetRevision (
+PandaBoardGetBoardRevision (
VOID
)
{
-#if 0
- UINT32 OldPinDir;
UINT32 Revision;
- // Read GPIO 171, 172, 173
- OldPinDir = MmioRead32 (GPIO6_BASE + GPIO_OE);
- MmioWrite32(GPIO6_BASE + GPIO_OE, (OldPinDir | BIT11 | BIT12 | BIT13));
- Revision = MmioRead32 (GPIO6_BASE + GPIO_DATAIN);
-
- // Restore I/O settings
- MmioWrite32 (GPIO6_BASE + GPIO_OE, OldPinDir);
-
- return (PANDABOARD_REVISION)((Revision >> 11) & 0x7);
-#endif
+ // If Chip Id code matches 4460 processor
+ if( ((MmioRead32(CONTROL_CORE_ID_CODE)>>16)&0xFFF) == 0xb94 ) {
+ Revision = PANDABOARD_REVISION_PANDAES;
+ }
+ else {
+ // Assume 4430
+ Revision = PANDABOARD_REVISION_PANDA;
+ }
- return 0;
+ return Revision;
}
/**
@@ -113,10 +109,7 @@ ArmPlatformGetBootMode (
}
/**
- 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
+ Early board setup
**/
RETURN_STATUS
@@ -124,30 +117,21 @@ ArmPlatformInitialize (
IN UINTN MpId
)
{
-#if 0
PANDABOARD_REVISION Revision;
- Revision = PandaBoardGetRevision();
+ // Get chip version
+ Revision = PandaBoardGetBoardRevision();
// Set up Pin muxing.
PadConfiguration (Revision);
// Set up system clocking
- ClockInit ();
-
- // Turn off the functional clock for Timer 3
- MmioAnd32 (CM_FCLKEN_PER, 0xFFFFFFFF ^ CM_ICLKEN_PER_EN_GPT3_ENABLE );
- ArmDataSyncronizationBarrier ();
-
- // Clear IRQs
- MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);
- ArmDataSyncronizationBarrier ();
-#endif
+ ClockInit (Revision);
// Make sure GPMC region region 0 is disabled
// Not doing so makes gpmc_init hang early in kernel init
MmioAnd32 (GPMC_CONFIG7_0, ~CSVALID);
-
+
return RETURN_SUCCESS;
}
diff --git a/PandaBoardPkg/Library/PandaBoardLib/PandaBoardHelper.S b/PandaBoardPkg/Library/PandaBoardLib/PandaBoardHelper.S
index 26624b80f..6405d167c 100644
--- a/PandaBoardPkg/Library/PandaBoardLib/PandaBoardHelper.S
+++ b/PandaBoardPkg/Library/PandaBoardLib/PandaBoardHelper.S
@@ -20,41 +20,77 @@
.text
.align 3
-GCC_ASM_EXPORT(ArmPlatformIsBootMemoryInitialized)
-GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory)
+GCC_ASM_EXPORT(ArmPlatformPrePiBootAction)
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
/**
- Called at the early stage of the Boot phase to know if the memory has already been initialized
-
- Running the code from the reset vector does not mean we start from cold boot. In some case, we
- can go through this code with the memory already initialized.
- Because this function is called at the early stage, the implementation must not use the stack.
- Its implementation must probably done in assembly to ensure this requirement.
-
- @return Return a non zero value if initialized
+ ArmPlatformPrePiBootAction
**/
-ASM_PFX(ArmPlatformIsBootMemoryInitialized):
- // The system memory is initialized by the PandaBoard firmware
- mov r0, #1
- bx lr
+ASM_PFX(ArmPlatformPrePiBootAction):
+ //relocate the relocator
+ sub r12,r12
+ orr r12,r12,#0x80000000
+ mov r3,r12 // relocator target address (0x80000000)
+ ldr r0, =relocator_start // relocator code start addr
+ ldr r1, =relocator_end // relocator end addr
+ sub r1,r1,r0 // compute relocator code size
+ lsr r1,r1,#0x2 // size in words
+reloc_loop_reloc: // copy relocator
+ ldm r0!,{r2}
+ stm r3!,{r2}
+ subs r1,r1,#0x1
+ bne reloc_loop_reloc
-
-/**
- Initialize the memory where the initial stacks will reside
+ // get chip id code
+ ldr r2,=0x4a002206 // control module id code address
+ ldrh r2,[r2] // get higher order 16b
+ lsl r2,r2,#0x14
+ ldr r1,=0xb9400000 // compare with 4460 id
+ cmp r1,r2 // Z bit set if 4460
- 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)
+ // update dmm conf
+ mov r0,#0x4e
+ lsl r0,r0,#0x18 // load DMM LISA base address
+ ldr r2,=0x482af000 // load MA LISA base address
+ ldr r1,[r0,#0x40] // get DMM LISA section 0
+ str r1,[r0,#0x4c] // update DMM LISA section 3
+ streq r1,[r2,#0x4c] // update MA LISA section 3 (when Z=1: 4460 only)
+ ldr r1,=0xff020100 // prepare LISA section 0
+ str r1,[r0,#0x40] // update DMM LISA section 0
+ streq r1,[r2,#0x40] // update MA LISA section 0 (when Z set: 4460 only)
+ bx r12 // jump to relocator
-**/
-ASM_PFX(ArmPlatformInitializeBootMemory):
- // We must need to go into this function
- bx lr
+relocator_start:
+ // update emif conf.
+ sub r2,r0,#0x1000000
+ sub r1,r2,#0x1000000
+ mov r0,#0x10
+ str r0,[r1,#0xc]
+ str r0,[r2,#0xc]
+ ldr r0,[r1,#0x8]
+ orr r0,r0,#0x8
+ str r0,[r1,#0x8]
+ str r0,[r2,#0x8]
+ // copy
+ add r1,r12,#0x8000
+ add r0,r1,#0x8000
+ mov r10,#0x1
+ lsl r11,r10,#0x5
+reloc_loop_1M:
+ lsl r10,r10,#0xA
+reloc_loop_4K:
+ ldm r0!,{r2-r9}
+ stm r1!,{r2-r9}
+ subs r10,r10,#1
+ bne reloc_loop_4K
+ add r0,r0,#0x8000
+ subs r11,r11,#1
+ add r10,r10,#0x1
+ bne reloc_loop_1M
+ bx lr
+relocator_end:
//UINTN
//ArmPlatformGetCorePosition (
diff --git a/PandaBoardPkg/Library/ResetSystemLib/ResetSystemLib.c b/PandaBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
index 79a51e137..fa0877a5e 100644
--- a/PandaBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/PandaBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -132,8 +132,8 @@ LibResetSystem (
case EfiResetShutdown:
default:
//Perform cold reset of the system.
- MmioOr32 (PRM_RSTCTRL, RST_DPLL3);
- while ((MmioRead32(PRM_RSTST) & GLOBAL_COLD_RST) != 0x1);
+ MmioOr32 (PRM_RSTCTRL, PRM_RSTCTRL_RST_GLOBAL_COLD_SW_VAL);
+ while ((MmioRead32(PRM_RSTST) & PRM_RSTST_GLOBAL_COLD_RST_MASK) != 0x1);
break;
}
diff --git a/PandaBoardPkg/PandaBoardPkg.dsc b/PandaBoardPkg/PandaBoardPkg.dsc
index c99775912..9381e0e02 100644
--- a/PandaBoardPkg/PandaBoardPkg.dsc
+++ b/PandaBoardPkg/PandaBoardPkg.dsc
@@ -35,6 +35,7 @@
ArmPlatformLib|PandaBoardPkg/Library/PandaBoardLib/PandaBoardLib.inf
ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Lib.inf
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
@@ -85,6 +86,7 @@
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
SerialPortLib|Omap44xxPkg/Library/SerialPortLib/SerialPortLib.inf
+ SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
RealTimeClockLib|Omap44xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf
@@ -366,10 +368,13 @@
gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SD"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0xB663049F,0x3F,0x13986)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/uImage"
+ gArmPlatformTokenSpaceGuid.PcdFdtDevicePath|L"VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/board.dtb"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L"VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/uInitrd"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyO2,115200n8 root=/dev/mmcblk0p2 rootwait ro fixrtc nocompcache vram=48M omapfb.vram=0:24M"
+
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2
gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut|3
- gArmPlatformTokenSpaceGuid.PcdFdtDevicePath|L"VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0xB663049F,0x3F,0x13986)/omap4-panda.dtb"
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(E68088EF-D1A4-4336-C1DB-4D3A204730A6)"
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()"
@@ -377,9 +382,9 @@
#
# ARM OS Loader
#
- # PandaBoard machine type required for ARM Linux:
+ # PandaBoard machine type required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2791
-
+
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
@@ -442,8 +447,6 @@
#
Omap44xxPkg/PciEmulation/PciEmulation.inf
- #NOTE: Open source EHCI stack doesn't work on Pandaboard.
- #NOTE: UsbBus and UsbMassStorage don't work using iPhone SDK tool chain.
MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf {
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x800fffff
diff --git a/PandaBoardPkg/PandaBoardPkg.fdf b/PandaBoardPkg/PandaBoardPkg.fdf
index 04486dfd7..42482592e 100644
--- a/PandaBoardPkg/PandaBoardPkg.fdf
+++ b/PandaBoardPkg/PandaBoardPkg.fdf
@@ -150,10 +150,10 @@ READ_LOCK_STATUS = TRUE
# USB Support (not supported currently)
#
- #INF Omap44xxPkg/PciEmulation/PciEmulation.inf
- #INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
- #INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
- #INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+ INF Omap44xxPkg/PciEmulation/PciEmulation.inf
+ INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
+ INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+ INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
#
# UEFI application (Shell Embedded Boot Loader)
diff --git a/PandaBoardPkg/patches/0001-Add-call-to-early-prepi-init-in-ModuleEntryPoint.patch b/PandaBoardPkg/patches/0001-Add-call-to-early-prepi-init-in-ModuleEntryPoint.patch
new file mode 100644
index 000000000..15b4d7f9a
--- /dev/null
+++ b/PandaBoardPkg/patches/0001-Add-call-to-early-prepi-init-in-ModuleEntryPoint.patch
@@ -0,0 +1,35 @@
+From 9a22e1fed42e2ece74ae06546bc300bd0202e1ad Mon Sep 17 00:00:00 2001
+From: Olivier Deprez <o-deprez@ti.com>
+Date: Fri, 1 Mar 2013 16:03:11 +0100
+Subject: [PATCH] Add call to early prepi init in ModuleEntryPoint
+
+omap4 requires an early call to an inner asm function to work
+around a rom mask issue tied to dram initialization.
+---
+ ArmPlatformPkg/PrePi/ModuleEntryPoint.S | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/ModuleEntryPoint.S
+index c0c20a9..66f0701 100755
+--- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S
++++ b/ArmPlatformPkg/PrePi/ModuleEntryPoint.S
+@@ -24,12 +24,16 @@
+ GCC_ASM_IMPORT(CEntryPoint)
+ GCC_ASM_IMPORT(ArmReadMpidr)
+ GCC_ASM_IMPORT(ArmPlatformStackSet)
++GCC_ASM_IMPORT(ArmPlatformPrePiBootAction)
+ GCC_ASM_EXPORT(_ModuleEntryPoint)
+
+ StartupAddr: .word CEntryPoint
+
+
+ ASM_PFX(_ModuleEntryPoint):
++ // Perform early PrePi init
++ bl ASM_PFX(ArmPlatformPrePiBootAction)
++
+ // Get ID of this CPU in Multicore system
+ bl ASM_PFX(ArmReadMpidr)
+ LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCoreMask), r1)
+--
+1.7.9.5
+
diff --git a/PandaBoardPkg/readme.txt b/PandaBoardPkg/readme.txt
index 32b163754..fee17d8fb 100644
--- a/PandaBoardPkg/readme.txt
+++ b/PandaBoardPkg/readme.txt
@@ -1,83 +1,59 @@
-
-Overview
-=========
+A. Overview
+===========
The Panda packages are hosted on http://gitorious.org/omap-romcode/omap-edk2
This repository contains the latest developments concerning UEFI on PandaBoard.
Contact: o-deprez@ti.com
Patches from omap-edk2 tree are regularly merged on need basis to
-http://git.linaro.org/gitweb?p=arm/uefi/uefi-next.git by ARM LT team.
-
-History
-========
-
-11/09/2012 PANDA_EDK2_110912
- Rebased to uefi-next commit-id 99af201b87a6048c26f372e3f75a46d291b2f683
- Fix build.sh removing tmp.bin temporary file
- Fix SerialPollGetControl with returning correct Control parm
- Comment out Semihostfs from PandaBoardPkg.fdf
-
-08/09/2012 PANDA_EDK2_080912
- Rebased to linaro-uefi-2012.04 label
- Boots linux "OMAP Ubuntu Core" kernel
-
-06/25/2012 PANDA_EDK2_062512
- First drop able to boot EBL
+http://git.linaro.org/gitweb?p=arm/uefi/uefi-next.git by Linaro maintainer.
-Environment setup
-==================
+B. Environment setup
+====================
- 1. General setup
- ----------------
-
-bash
-mkdir panda_uefi; cd panda_uefi
-export PANDA_UEFI=`pwd`
-
- 2. Toolchain
+ 1. Toolchain
------------
-For a list of possible toolchains visit:
-*http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPkg/Toolchain
-
-PandaBoardPkg was built using gcc version 4.5.1 (Sourcery G++ Lite 2010.09-51).
-If you want to use the same compiler, use below commands (copy/paste from above webpage):
+PandaBoardPkg was built/tested using gcc version 4.6 on an Ubuntu Precise machine.
-wget http://www.codesourcery.com/sgpp/lite/arm/portal/package7813/public/arm-none-eabi/arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
-tar xjf arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
-rm !$
-
-$ Add arm gcc compiler to path
-export PATH=$PANDA_UEFI/arm-2010.09/bin:$PATH
+For a list of possible toolchains visit:
+http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPkg/Toolchain
- 3. Install necessary package
+ 2. Install necessary package
----------------------------
-# Install uuid-dev package if not present already
-sudo apt-get install uuid-dev
+Install uuid-dev package if not present already:
-Note: the build was done an Ubuntu 10.04 machine.
+sudo apt-get install uuid-dev
-Building
-=========
+C. Building
+===========
Build information is found on uefi-next summary page:
http://git.linaro.org/gitweb?p=arm/uefi/uefi-next.git;a=summary
-cd PandaBoardPkg
-./build.sh RELEASE
+After cloning the Linaro EDK2 tree and before compiling the PandaBoardPkg,
+you must apply following patch to ArmPlatformPkg:
+
+ git apply PandaBoardPkg/patches/0001-Add-call-to-early-prepi-init-in-ModuleEntryPoint.patch
+
+Compilation is done with following command:
+
+ cd PandaBoardPkg
+ ./build.sh -b RELEASE
+
+Note: the Debug version is compiled by invoking build.sh without parameters or:
-Note: you can build the debug version by invoking the build.sh command without parameters.
+ ./build.sh -b DEBUG
-Running EDK2 on Panda
-======================
+D. Running EDK2 on Panda
+========================
- 1. UEFI EBL shell
- -----------------
+ 1. UEFI Shell
+ -------------
-If you just intend to see how UEFI boots up and make a try with EBL, you
-can just do a raw copy of the firmware image to an SD card (e.g. /dev/sdc):
+If you just intend to see how UEFI boots up and make a try with the shell, you
+can do a raw copy of the firmware image to an SD card (e.g. /dev/sdc):
dd if=edk2/Build/PandaBoard/RELEASE_ARMGCC/FV/MLO of=/dev/sdc
@@ -86,66 +62,53 @@ Open your favorite serial terminal e.g.
Plug serial and power cables.
-After few seconds, you should see following boot menu:
+After few seconds, the following boot menu shall pop up:
- The default boot selection will start in 1 seconds
- ERROR: Did not find Linux kernel.
[1] Linux from SD
- [2] EBL
- [3] Boot Manager
-Start:
-
-[Type 2 for starting EBL.]
-
-More info on EBL:
-*http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK_Boot_Loader_(EBL)_WiKi
+ - VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x00000000,0x3F,0
+ x19FC0)/uImage
+ - Initrd: VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x0000000
+ 0,0x3F,0x19FC0)/uInitrd
+ - Arguments: console=ttyO2,115200n8 root=/dev/mmcblk0p2 earlyprintk root
+ wait ro fixrtc nocompcache vram=48M omapfb.vram=0:24M
+ - LoaderType: Linux kernel with global FDT
+ -----------------------
+ Global FDT Config
+ - VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x00000000,0x3F,0
+ x19FC0)/board.dtb
+ -----------------------
+ [a] Boot Manager
+ [b] Shell
+ Start:
+
+From there, type 'b' for starting the shell.
2. Starting a Linux kernel
--------------------------
-As a matter of testing linux boot, you can clone "OMAP Ubuntu Core" kernel, instructions located here:
-*http://omappedia.org/wiki/OMAP_Ubuntu_Core
-
-1. Copy/pasted the relevant commands for cloning and building omap linux kernel:
-
- bash
- export PATH=<path to your toolchain>:$PATH
- export ARCH=arm
- export CROSS_COMPILE=arm-none-linux-gnueabi-
-
- git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- cd linux; git checkout -b v3.3-rc1 v3.3-rc1
- make omap2plus_defconfig
- make zImage
-
-2. InPandaBoardPkg.dsc, update the boot device path with the one matching your SD card:
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(100C2CFA-B586-4198-9B4C-1683D195B1DA)/HD(1,MBR,0x00000000,0x3F,0x2348A)/zImage"
-
-Note: this device path changes any time your swap/change SD card. If ever you need to boot up same build or another SD card, you need to re-build with updated device path.
+Check following page: http://releases.linaro.org/13.01/ubuntu/panda
-3. Re-build PandaBoardPkg
+The easiest way is to get a full boot+filesystem image:
+wget http://releases.linaro.org/13.01/ubuntu/boards/panda/panda-quantal_developer_20130128-58.img.gz
-4. Format the SD card with a FAT32 and an ext3 partiton
+Unzip and dd to an sd card as described on Linaro's website.
-More information on how to format an SD card here:
-*http://www.omappedia.com/wiki/SD_Configuration
+Note: on OMAP, usage of earlyprintk statement on kernel command line looks incompatible with device tree.
+Indeed early print routines use legacy machine type id to identify which uart module to use.
+In case of device tree based boot the machine type passed to kernel entry by Bds is 0xFFFFFFFF,
+which is unknown to earlyprintk routines and result in a hang.
-5. Drop following files in FAT32 partition:
- edk2/Build/PandaBoard/RELEASE_ARMGCC/FV/MLO
- linux/arch/arm/boot/zImage generated at step 1
-
-6. Insert SD card and boot up Panda board.
- You should see the boot menu and kernel starting after 3 seconds.
-
-Boards tested
-==================
+E. Boards tested
+================
PandaBoard Rev EA2 - EBL and linux boot (PANDA_EDK2_080912)
-PandaBoard Rev A3 - EBL and linux boot (PANDA_EDK2_080912)
-PandaBoard ES Rev B1 - EBL (PANDA_EDK2_062512)
+PandaBoard Rev A3 - Shell and linux boot (PANDA_EDK2_030113)
+PandaBoard ES Rev B1 - Shell (PANDA_EDK2_030113)
+
+Note: Panda ES did not fully boot up linaro 13.01 image thru UEFI (stuck at L2 cache init).
-chtool
-=======
+F. chtool
+=========
The PandaBoardPkg/Tools directory contains a tool called chtool for creating
a Configuration Header block for use with the ROM Code boot sequence (in this port
@@ -155,8 +118,42 @@ This tool is tracked in the following tree: git://gitorious.org/omap-romcode/cht
The version of chtool present in PandaBoardPkg is v0.4.
-Resources
-=========
+G. History
+==========
+
+03/01/2013 PANDA_EDK2_030113
+ Added patch early PrePi init patch to ArmPlatformPkg
+ Board revision
+ Cleaned up Pad conf
+ Cleaned up setup clocks acceleration
+ Enable 1GB support
+ Add usb host support
+ Use null sd card's uuid
+
+01/28/2013 PANDA_EDK2_012813
+ Created an edk2 top dir, moved packages in this dir
+
+11/21/2012 PANDA_EDK2_112112
+ Add TWL6030 PMIC support
+ Update GPMC base address
+ Remove unused drivers (Flash, MMCHSDxe, InterruptDxe, SemihostFs)
+ Change PcdCoreCount to 2
+ Change default boot type to Fdt
+ Update linux machine type to PandaBoard
+
+11/09/2012 PANDA_EDK2_110912
+ Fix build.sh removing tmp.bin temporary file
+ Fix SerialPollGetControl with returning correct Control parm
+ Comment out Semihostfs from PandaBoardPkg.fdf
+
+08/09/2012 PANDA_EDK2_080912
+ Boots linux "OMAP Ubuntu Core" kernel
+
+06/25/2012 PANDA_EDK2_062512
+ First drop able to boot EBL
+
+H. Resources
+============
Panda Board - TI OMAP4
*http://pandaboard.org
@@ -167,14 +164,16 @@ Beagle Board - TI OMAP3
ArmPlatformPkg - Generic package for ARM platforms
*http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPlatformPkg
-To do/next steps
-======================
--Enable >512MiB external SDRAM
--Add PMIC management e.g. for SD card detection
+I. To do/next steps
+===================
+
+-Enable Network
-Enable display/gui
--Clean PandaBoardLib for: detection of PandaBoard revision, pad conf, clocks speed up (if necessary)
-Add a CHMMCSD item in ROM's Configuration Header to accelerate image copy from SD to external RAM
+-DONE 03/01/2013 Enable USB host capability
+-DONE 03/01/2013 Enable >512MiB external SDRAM
+-DONE 03/01/2013 Clean PandaBoardLib for: detection of PandaBoard revision, pad conf, clocks speed up (if necessary)
+-DONE 11/21/2012 Add PMIC management e.g. for SD card detection
-DONE 08/09/2012 Boot up linux kernel
-DONE 08/09/2012 Switch to linaro-uefi-2012.04 tag
-
diff --git a/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc b/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc
index a545e8077..941c6e55c 100755
--- a/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc
+++ b/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc
@@ -46,6 +46,7 @@
# ARM PL390 General Interrupt Driver in Secure and Non-secure
ArmGicSecLib|SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSecLib.inf
ArmGicLib|SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf
[LibraryClasses.common.SEC]
ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf
@@ -68,6 +69,11 @@
################################################################################
[PcdsFeatureFlag.common]
+ gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE
+ gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
+ gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|FALSE
+ gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
+
!ifdef $(EDK2_SKIP_PEICORE)
gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec|TRUE
gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|TRUE
diff --git a/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.c b/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.c
index 328956fb0..548330e61 100644
--- a/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.c
+++ b/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.c
@@ -148,57 +148,3 @@ SerialPortPoll (
return ((MmioRead32 (UARTConsoleBase + UTRSTAT_OFFSET) & UART_RX_EMPTY_FLAG_MASK) != 0);
}
-/**
- Set the serial device control bits.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return RETURN_SUCCESS;
-}
-
-/**
- Get the serial device control bits.
-
- @param Control Control signals read from the serial device.
-
- @retval EFI_SUCCESS The control bits were read from the serial device.
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- return RETURN_SUCCESS;
-}
-
-
-/**
- Set the serial device attributes.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetAttributes (
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-{
- return RETURN_SUCCESS;
-}
-
diff --git a/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.inf b/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.inf
index e9a520d8a..73349aa70 100644
--- a/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.inf
+++ b/SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.inf
@@ -17,7 +17,7 @@
INF_VERSION = 0x00010005
BASE_NAME = SerialPortLib
FILE_GUID = 8ecefc8f-a2c4-4091-b80f-20f7aeb0567f
- MODULE_TYPE = PEIM
+ MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = SerialPortLib
diff --git a/SamsungPlatformPkgOrigen/OrigenBoardPkg/OrigenBoardPkg-Exynos.dsc b/SamsungPlatformPkgOrigen/OrigenBoardPkg/OrigenBoardPkg-Exynos.dsc
index a6a96aa53..be9587295 100644
--- a/SamsungPlatformPkgOrigen/OrigenBoardPkg/OrigenBoardPkg-Exynos.dsc
+++ b/SamsungPlatformPkgOrigen/OrigenBoardPkg/OrigenBoardPkg-Exynos.dsc
@@ -48,6 +48,7 @@
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf
#
# Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
@@ -84,6 +85,7 @@
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
SerialPortLib|SamsungPlatformPkgOrigen/ExynosPkg/Library/SerialPortLib/SerialPortLib.inf
+ SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
TimerLib|SamsungPlatformPkgOrigen/ExynosPkg/Library/TimerLib/TimerLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
index 3b4fc57cb..5bc29cf14 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
@@ -12,7 +12,7 @@
DxeImageVerificationHandler(), HashPeImageByType(), HashPeImage() function will accept
untrusted PE/COFF image and validate its data structure within this image buffer before use.
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, 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
@@ -837,7 +837,7 @@ IsSignatureFoundInDatabase (
//
CertList = (EFI_SIGNATURE_LIST *) Data;
while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {
- CertCount = (CertList->SignatureListSize - CertList->SignatureHeaderSize) / CertList->SignatureSize;
+ CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
if ((CertList->SignatureSize == sizeof(EFI_SIGNATURE_DATA) - 1 + SignatureSize) && (CompareGuid(&CertList->SignatureType, CertType))) {
for (Index = 0; Index < CertCount; Index++) {
@@ -967,43 +967,6 @@ Done:
}
/**
- Verify certificate in WIN_CERT_TYPE_PKCS_SIGNED_DATA format.
-
- @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed image.
- @param[in] AuthDataSize Size of the Authenticode Signature in bytes.
-
- @retval EFI_SUCCESS Image pass verification.
- @retval EFI_SECURITY_VIOLATION Image fail verification.
-
-**/
-EFI_STATUS
-VerifyCertPkcsSignedData (
- IN UINT8 *AuthData,
- IN UINTN AuthDataSize
- )
-{
- //
- // 1: Find certificate from DBX forbidden database for revoked certificate.
- //
- if (IsPkcsSignedDataVerifiedBySignatureList (AuthData, AuthDataSize, EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid)) {
- //
- // DBX is forbidden database, if Authenticode verification pass with
- // one of the certificate in DBX, this image should be rejected.
- //
- return EFI_SECURITY_VIOLATION;
- }
-
- //
- // 2: Find certificate from DB database and try to verify authenticode struct.
- //
- if (IsPkcsSignedDataVerifiedBySignatureList (AuthData, AuthDataSize, EFI_IMAGE_SECURITY_DATABASE, &gEfiImageSecurityDatabaseGuid)) {
- return EFI_SUCCESS;
- } else {
- return EFI_SECURITY_VIOLATION;
- }
-}
-
-/**
Provide verification service for signed images, which include both signature validation
and platform policy control. For signature types, both UEFI WIN_CERTIFICATE_UEFI_GUID and
MSFT Authenticode type signatures are supported.
@@ -1011,25 +974,14 @@ VerifyCertPkcsSignedData (
In this implementation, only verify external executables when in USER MODE.
Executables from FV is bypass, so pass in AuthenticationStatus is ignored.
- The image verification process is:
+ The image verification policy is:
If the image is signed,
- If the image's certificate verifies against a certificate (root or intermediate) in the allowed
- database (DB) and not in the forbidden database (DBX), the certificate verification is passed.
- If the image's hash digest is in DBX,
- deny execution.
- If not,
- run it.
- If the Image's certificate verification failed.
- If the Image's Hash is in DB and not in DBX,
- run it.
- Otherwise,
- deny execution.
+ At least one valid signature or at least one hash value of the image must match a record
+ in the security database "db", and no valid signature nor any hash value of the image may
+ be reflected in the security database "dbx".
Otherwise, the image is not signed,
- Is the Image's Hash in DBX?
- If yes, deny execution.
- If not, is the Image's Hash in DB?
- If yes, run it.
- If not, deny execution.
+ The SHA256 hash value of the image must match a record in the security database "db", and
+ not be reflected in the security data base "dbx".
Caution: This function may receive untrusted input.
PE/COFF image is external input, so this function will validate its data structure
@@ -1084,12 +1036,12 @@ DxeImageVerificationHandler (
UINT8 *SecureBoot;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
UINT32 NumberOfRvaAndSizes;
- UINT32 CertSize;
WIN_CERTIFICATE_EFI_PKCS *PkcsCertData;
WIN_CERTIFICATE_UEFI_GUID *WinCertUefiGuid;
UINT8 *AuthData;
UINTN AuthDataSize;
EFI_IMAGE_DATA_DIRECTORY *SecDataDir;
+ UINT32 OffSet;
SignatureList = NULL;
SignatureListSize = 0;
@@ -1098,6 +1050,8 @@ DxeImageVerificationHandler (
PkcsCertData = NULL;
Action = EFI_IMAGE_EXECUTION_AUTH_UNTESTED;
Status = EFI_ACCESS_DENIED;
+ VerifyStatus = EFI_ACCESS_DENIED;
+
//
// Check the image type and get policy setting.
//
@@ -1230,9 +1184,13 @@ DxeImageVerificationHandler (
}
}
- if ((SecDataDir == NULL) || ((SecDataDir != NULL) && (SecDataDir->Size == 0))) {
+ //
+ // Start Image Validation.
+ //
+ if (SecDataDir == NULL || SecDataDir->Size == 0) {
//
- // This image is not signed.
+ // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db",
+ // and not be reflected in the security data base "dbx".
//
if (!HashPeImage (HASHALG_SHA256)) {
goto Done;
@@ -1259,109 +1217,118 @@ DxeImageVerificationHandler (
}
//
- // Verify signature of executables.
+ // Verify the signature of the image, multiple signatures are allowed as per PE/COFF Section 4.7
+ // "Attribute Certificate Table".
+ // The first certificate starts at offset (SecDataDir->VirtualAddress) from the start of the file.
//
- WinCertificate = (WIN_CERTIFICATE *) (mImageBase + SecDataDir->VirtualAddress);
-
- CertSize = sizeof (WIN_CERTIFICATE);
-
- if ((SecDataDir->Size <= CertSize) || (SecDataDir->Size < WinCertificate->dwLength)) {
- goto Done;
- }
-
- //
- // Verify the image's Authenticode signature, only DER-encoded PKCS#7 signed data is supported.
- //
- if (WinCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
+ for (OffSet = SecDataDir->VirtualAddress;
+ OffSet < (SecDataDir->VirtualAddress + SecDataDir->Size);
+ OffSet += WinCertificate->dwLength, OffSet += ALIGN_SIZE (OffSet)) {
+ WinCertificate = (WIN_CERTIFICATE *) (mImageBase + OffSet);
+ if ((SecDataDir->VirtualAddress + SecDataDir->Size - OffSet) <= sizeof (WIN_CERTIFICATE) ||
+ (SecDataDir->VirtualAddress + SecDataDir->Size - OffSet) < WinCertificate->dwLength) {
+ break;
+ }
+
//
- // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is described in the
- // Authenticode specification.
+ // Verify the image's Authenticode signature, only DER-encoded PKCS#7 signed data is supported.
//
- PkcsCertData = (WIN_CERTIFICATE_EFI_PKCS *) WinCertificate;
- if (PkcsCertData->Hdr.dwLength <= sizeof (PkcsCertData->Hdr)) {
- goto Done;
+ if (WinCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
+ //
+ // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is described in the
+ // Authenticode specification.
+ //
+ PkcsCertData = (WIN_CERTIFICATE_EFI_PKCS *) WinCertificate;
+ if (PkcsCertData->Hdr.dwLength <= sizeof (PkcsCertData->Hdr)) {
+ break;
+ }
+ AuthData = PkcsCertData->CertData;
+ AuthDataSize = PkcsCertData->Hdr.dwLength - sizeof(PkcsCertData->Hdr);
+ } else if (WinCertificate->wCertificateType == WIN_CERT_TYPE_EFI_GUID) {
+ //
+ // The certificate is formatted as WIN_CERTIFICATE_UEFI_GUID which is described in UEFI Spec.
+ //
+ WinCertUefiGuid = (WIN_CERTIFICATE_UEFI_GUID *) WinCertificate;
+ if (WinCertUefiGuid->Hdr.dwLength <= OFFSET_OF(WIN_CERTIFICATE_UEFI_GUID, CertData)) {
+ break;
+ }
+ if (!CompareGuid (&WinCertUefiGuid->CertType, &gEfiCertPkcs7Guid)) {
+ continue;
+ }
+ AuthData = WinCertUefiGuid->CertData;
+ AuthDataSize = WinCertUefiGuid->Hdr.dwLength - OFFSET_OF(WIN_CERTIFICATE_UEFI_GUID, CertData);
+ } else {
+ if (WinCertificate->dwLength < sizeof (WIN_CERTIFICATE)) {
+ break;
+ }
+ continue;
}
- AuthData = PkcsCertData->CertData;
- AuthDataSize = PkcsCertData->Hdr.dwLength - sizeof(PkcsCertData->Hdr);
-
+
Status = HashPeImageByType (AuthData, AuthDataSize);
if (EFI_ERROR (Status)) {
- goto Done;
+ continue;
}
-
- VerifyStatus = VerifyCertPkcsSignedData (AuthData, AuthDataSize);
- } else if (WinCertificate->wCertificateType == WIN_CERT_TYPE_EFI_GUID) {
+
//
- // The certificate is formatted as WIN_CERTIFICATE_UEFI_GUID which is described in UEFI Spec.
+ // Check the digital signature against the revoked certificate in forbidden database (dbx).
//
- WinCertUefiGuid = (WIN_CERTIFICATE_UEFI_GUID *) WinCertificate;
- if (!CompareGuid(&WinCertUefiGuid->CertType, &gEfiCertPkcs7Guid) ||
- (WinCertUefiGuid->Hdr.dwLength <= OFFSET_OF(WIN_CERTIFICATE_UEFI_GUID, CertData))) {
- goto Done;
- }
- AuthData = WinCertUefiGuid->CertData;
- AuthDataSize = WinCertUefiGuid->Hdr.dwLength - OFFSET_OF(WIN_CERTIFICATE_UEFI_GUID, CertData);
-
- Status = HashPeImageByType (AuthData, AuthDataSize);
- if (EFI_ERROR (Status)) {
- goto Done;
+ if (IsPkcsSignedDataVerifiedBySignatureList (AuthData, AuthDataSize, EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid)) {
+ Action = EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED;
+ VerifyStatus = EFI_ACCESS_DENIED;
+ break;
}
- VerifyStatus = VerifyCertPkcsSignedData (AuthData, AuthDataSize);
- } else {
- goto Done;
- }
- if (!EFI_ERROR (VerifyStatus)) {
//
- // Verification is passed.
- // Continue to check the image digest in signature database.
+ // Check the digital signature against the valid certificate in allowed database (db).
//
- if (IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE1, mImageDigest, &mCertType, mImageDigestSize)) {
- //
- // Executable signature verification passes, but is found in forbidden signature database.
- //
- Action = EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND;
- Status = EFI_ACCESS_DENIED;
- } else {
- //
- // For image verification against enrolled X.509 certificate(root or intermediate),
- // no need to check image's hash in the allowed database.
- //
- return EFI_SUCCESS;
+ if (EFI_ERROR (VerifyStatus)) {
+ if (IsPkcsSignedDataVerifiedBySignatureList (AuthData, AuthDataSize, EFI_IMAGE_SECURITY_DATABASE, &gEfiImageSecurityDatabaseGuid)) {
+ VerifyStatus = EFI_SUCCESS;
+ }
}
- } else {
+
//
- // Verification failure.
+ // Check the image's hash value.
//
- if (!IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE1, mImageDigest, &mCertType, mImageDigestSize) &&
- IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE, mImageDigest, &mCertType, mImageDigestSize)) {
- //
- // Verification fail, Image Hash is not in forbidden database (DBX),
- // and Image Hash is in allowed database (DB).
- //
- Status = EFI_SUCCESS;
- } else {
- Action = EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED;
- Status = EFI_ACCESS_DENIED;
+ if (IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE1, mImageDigest, &mCertType, mImageDigestSize)) {
+ Action = EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND;
+ VerifyStatus = EFI_ACCESS_DENIED;
+ break;
+ } else if (EFI_ERROR (VerifyStatus)) {
+ if (IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE, mImageDigest, &mCertType, mImageDigestSize)) {
+ VerifyStatus = EFI_SUCCESS;
+ }
}
}
- if (EFI_ERROR (Status)) {
+ if (OffSet != (SecDataDir->VirtualAddress + SecDataDir->Size)) {
//
- // Get image hash value as executable's signature.
+ // The Size in Certificate Table or the attribute certicate table is corrupted.
//
- SignatureListSize = sizeof (EFI_SIGNATURE_LIST) + sizeof (EFI_SIGNATURE_DATA) - 1 + mImageDigestSize;
- SignatureList = (EFI_SIGNATURE_LIST *) AllocateZeroPool (SignatureListSize);
- if (SignatureList == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
+ VerifyStatus = EFI_ACCESS_DENIED;
+ }
+
+ if (!EFI_ERROR (VerifyStatus)) {
+ return EFI_SUCCESS;
+ } else {
+ Status = EFI_ACCESS_DENIED;
+ if (Action == EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED || Action == EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND) {
+ //
+ // Get image hash value as executable's signature.
+ //
+ SignatureListSize = sizeof (EFI_SIGNATURE_LIST) + sizeof (EFI_SIGNATURE_DATA) - 1 + mImageDigestSize;
+ SignatureList = (EFI_SIGNATURE_LIST *) AllocateZeroPool (SignatureListSize);
+ if (SignatureList == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ SignatureList->SignatureHeaderSize = 0;
+ SignatureList->SignatureListSize = (UINT32) SignatureListSize;
+ SignatureList->SignatureSize = (UINT32) mImageDigestSize;
+ CopyMem (&SignatureList->SignatureType, &mCertType, sizeof (EFI_GUID));
+ Signature = (EFI_SIGNATURE_DATA *) ((UINT8 *) SignatureList + sizeof (EFI_SIGNATURE_LIST));
+ CopyMem (Signature->SignatureData, mImageDigest, mImageDigestSize);
}
- SignatureList->SignatureHeaderSize = 0;
- SignatureList->SignatureListSize = (UINT32) SignatureListSize;
- SignatureList->SignatureSize = (UINT32) mImageDigestSize;
- CopyMem (&SignatureList->SignatureType, &mCertType, sizeof (EFI_GUID));
- Signature = (EFI_SIGNATURE_DATA *) ((UINT8 *) SignatureList + sizeof (EFI_SIGNATURE_LIST));
- CopyMem (Signature->SignatureData, mImageDigest, mImageDigestSize);
}
Done:
diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
index 55371e90b..9aef601ce 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
@@ -2,7 +2,7 @@
The internal header file includes the common header files, defines
internal structure and functions used by ImageVerificationLib.
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, 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
@@ -43,6 +43,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define MAX_NOTIFY_STRING_LEN 64
#define TWO_BYTE_ENCODE 0x82
+#define ALIGNMENT_SIZE 8
+#define ALIGN_SIZE(a) (((a) % ALIGNMENT_SIZE) ? ALIGNMENT_SIZE - ((a) % ALIGNMENT_SIZE) : 0)
+
//
// Image type definitions
//
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
index 8552d31b2..6f8808a75 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
@@ -445,6 +445,10 @@ AddPubKeyInStore (
FALSE
);
ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return 0;
+ }
+
//
// Check whether the public key entry does exist.
//
@@ -492,6 +496,9 @@ AddPubKeyInStore (
FALSE
);
ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return 0;
+ }
DataSize = DataSizeOfVariable (Variable.CurrPtr);
Data = GetVariableDataPtr (Variable.CurrPtr);
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
index ce4f6e813..10915e45b 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
@@ -651,27 +651,28 @@ PubKeyStoreFilter (
If ReclaimPubKeyStore is TRUE, reclaim invalid key in public key database and update the PubKeyIndex
for all the count-based authenticate variable in NV storage.
- @param[in] VariableBase Base address of variable store.
- @param[out] LastVariableOffset Offset of last variable.
- @param[in] IsVolatile The variable store is volatile or not;
- if it is non-volatile, need FTW.
- @param[in, out] UpdatingPtrTrack Pointer to updating variable pointer track structure.
- @param[in] ReclaimPubKeyStore Reclaim for public key database or not.
- @param[in] ReclaimAnyway If TRUE, do reclaim anyway.
+ @param[in] VariableBase Base address of variable store.
+ @param[out] LastVariableOffset Offset of last variable.
+ @param[in] IsVolatile The variable store is volatile or not;
+ if it is non-volatile, need FTW.
+ @param[in, out] UpdatingPtrTrack Pointer to updating variable pointer track structure.
+ @param[in] ReclaimPubKeyStore Reclaim for public key database or not.
+ @param[in] ReclaimAnyway If TRUE, do reclaim anyway.
- @return EFI_OUT_OF_RESOURCES No enough memory resources.
@return EFI_SUCCESS Reclaim operation has finished successfully.
+ @return EFI_OUT_OF_RESOURCES No enough memory resources.
+ @return EFI_DEVICE_ERROR The public key database doesn't exist.
@return Others Unexpect error happened during reclaim operation.
**/
EFI_STATUS
Reclaim (
- IN EFI_PHYSICAL_ADDRESS VariableBase,
- OUT UINTN *LastVariableOffset,
- IN BOOLEAN IsVolatile,
- IN OUT VARIABLE_POINTER_TRACK *UpdatingPtrTrack,
- IN BOOLEAN ReclaimPubKeyStore,
- IN BOOLEAN ReclaimAnyway
+ IN EFI_PHYSICAL_ADDRESS VariableBase,
+ OUT UINTN *LastVariableOffset,
+ IN BOOLEAN IsVolatile,
+ IN OUT VARIABLE_POINTER_TRACK *UpdatingPtrTrack,
+ IN BOOLEAN ReclaimPubKeyStore,
+ IN BOOLEAN ReclaimAnyway
)
{
VARIABLE_HEADER *Variable;
@@ -809,6 +810,12 @@ Reclaim (
// Reinstall the new public key database.
//
ASSERT (PubKeyHeader != NULL);
+ if (PubKeyHeader == NULL) {
+ FreePool (ValidBuffer);
+ FreePool (NewPubKeyIndex);
+ FreePool (NewPubKeyStore);
+ return EFI_DEVICE_ERROR;
+ }
CopyMem (CurrPtr, (UINT8*) PubKeyHeader, sizeof (VARIABLE_HEADER));
Variable = (VARIABLE_HEADER*) CurrPtr;
Variable->DataSize = NewPubKeySize;
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
index 8e292f36b..450158364 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
@@ -381,27 +381,28 @@ VariableCommonInitialize (
If ReclaimPubKeyStore is TRUE, reclaim invalid key in public key database and update the PubKeyIndex
for all the count-based authenticate variable in NV storage.
- @param[in] VariableBase Base address of variable store.
- @param[out] LastVariableOffset Offset of last variable.
- @param[in] IsVolatile The variable store is volatile or not;
- if it is non-volatile, need FTW.
- @param[in, out] UpdatingPtrTrack Pointer to updating variable pointer track structure.
- @param[in] ReclaimPubKeyStore Reclaim for public key database or not.
- @param[in] ReclaimAnyway If TRUE, do reclaim anyway.
+ @param[in] VariableBase Base address of variable store.
+ @param[out] LastVariableOffset Offset of last variable.
+ @param[in] IsVolatile The variable store is volatile or not;
+ if it is non-volatile, need FTW.
+ @param[in, out] UpdatingPtrTrack Pointer to updating variable pointer track structure.
+ @param[in] ReclaimPubKeyStore Reclaim for public key database or not.
+ @param[in] ReclaimAnyway If TRUE, do reclaim anyway.
- @return EFI_OUT_OF_RESOURCES No enough memory resources.
@return EFI_SUCCESS Reclaim operation has finished successfully.
+ @return EFI_OUT_OF_RESOURCES No enough memory resources.
+ @return EFI_DEVICE_ERROR The public key database doesn't exist.
@return Others Unexpect error happened during reclaim operation.
**/
EFI_STATUS
Reclaim (
- IN EFI_PHYSICAL_ADDRESS VariableBase,
- OUT UINTN *LastVariableOffset,
- IN BOOLEAN IsVolatile,
- IN OUT VARIABLE_POINTER_TRACK *UpdatingPtrTrack,
- IN BOOLEAN ReclaimPubKeyStore,
- IN BOOLEAN ReclaimAnyway
+ IN EFI_PHYSICAL_ADDRESS VariableBase,
+ OUT UINTN *LastVariableOffset,
+ IN BOOLEAN IsVolatile,
+ IN OUT VARIABLE_POINTER_TRACK *UpdatingPtrTrack,
+ IN BOOLEAN ReclaimPubKeyStore,
+ IN BOOLEAN ReclaimAnyway
);
/**
diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h
index 7d2416d38..eefa030ad 100644
--- a/ShellPkg/Include/Library/ShellLib.h
+++ b/ShellPkg/Include/Library/ShellLib.h
@@ -1,7 +1,7 @@
/** @file
Provides interface to shell functionality for shell commands and applications.
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -1328,4 +1328,52 @@ ShellFileHandleReadLine(
IN OUT BOOLEAN *Ascii
);
+/**
+ Function to delete a file by name
+
+ @param[in] FileName Pointer to file name to delete.
+
+ @retval EFI_SUCCESS the file was deleted sucessfully
+ @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not
+ deleted
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
+ @retval EFI_NOT_FOUND The specified file could not be found on the
+ device or the file system could not be found
+ on the device.
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ medium is no longer supported.
+ @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
+ file.
+ @retval other The file failed to open
+**/
+EFI_STATUS
+EFIAPI
+ShellDeleteFileByName(
+ IN CONST CHAR16 *FileName
+ );
+
+/**
+ Function to print help file / man page content in the spec from the UEFI Shell protocol GetHelpText function.
+
+ @param[in] CommandToGetHelpOn Pointer to a string containing the command name of help file to be printed.
+ @param[in] SectionToGetHelpOn Pointer to the section specifier(s).
+ @param[in] PrintCommandText If TRUE, prints the command followed by the help content, otherwise prints
+ the help content only.
+ @retval EFI_DEVICE_ERROR The help data format was incorrect.
+ @retval EFI_NOT_FOUND The help data could not be found.
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+EFIAPI
+ShellPrintHelp (
+ IN CONST CHAR16 *CommandToGetHelpOn,
+ IN CONST CHAR16 *SectionToGetHelpOn,
+ IN BOOLEAN PrintCommandText
+ );
+
#endif // __SHELL_LIB__
diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c
new file mode 100644
index 000000000..4fe9083b0
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/Dp.c
@@ -0,0 +1,319 @@
+/** @file
+ Shell command for Displaying Performance Metrics.
+
+ The Dp command reads performance data and presents it in several
+ different formats depending upon the needs of the user. Both
+ Trace and Measured Profiling information is processed and presented.
+
+ Dp uses the "PerformanceLib" to read the measurement records.
+ The "TimerLib" provides information about the timer, such as frequency,
+ beginning, and ending counter values.
+ Measurement records contain identifying information (Handle, Token, Module)
+ and start and end time values.
+ Dp uses this information to group records in different ways. It also uses
+ timer information to calculate elapsed time for each measurement.
+
+ Copyright (c) 2009 - 2013, 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.
+**/
+
+#include "UefiDpLib.h"
+#include <Guid/GlobalVariable.h>
+#include <Library/PrintLib.h>
+#include <Library/HandleParsingLib.h>
+#include <Library/DevicePathLib.h>
+
+#include <Library/ShellLib.h>
+#include <Library/BaseLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TimerLib.h>
+#include <Library/UefiLib.h>
+
+#include <Guid/Performance.h>
+
+#include <PerformanceTokens.h>
+#include "Dp.h"
+#include "Literals.h"
+#include "DpInternal.h"
+
+//
+/// Module-Global Variables
+///@{
+CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
+CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
+UINT64 mInterestThreshold;
+BOOLEAN mShowId = FALSE;
+
+PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO.
+
+/// Timer Specific Information.
+TIMER_INFO TimerInfo;
+
+/// Items for which to gather cumulative statistics.
+PERF_CUM_DATA CumData[] = {
+ PERF_INIT_CUM_DATA (LOAD_IMAGE_TOK),
+ PERF_INIT_CUM_DATA (START_IMAGE_TOK),
+ PERF_INIT_CUM_DATA (DRIVERBINDING_START_TOK),
+ PERF_INIT_CUM_DATA (DRIVERBINDING_SUPPORT_TOK)
+};
+
+/// Number of items for which we are gathering cumulative statistics.
+UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA);
+
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ {L"-v", TypeFlag}, // -v Verbose Mode
+ {L"-A", TypeFlag}, // -A All, Cooked
+ {L"-R", TypeFlag}, // -R RAW All
+ {L"-s", TypeFlag}, // -s Summary
+#if PROFILING_IMPLEMENTED
+ {L"-P", TypeFlag}, // -P Dump Profile Data
+ {L"-T", TypeFlag}, // -T Dump Trace Data
+#endif // PROFILING_IMPLEMENTED
+ {L"-x", TypeFlag}, // -x eXclude Cumulative Items
+ {L"-i", TypeFlag}, // -i Display Identifier
+ {L"-n", TypeValue}, // -n # Number of records to display for A and R
+ {L"-t", TypeValue}, // -t # Threshold of interest
+ {NULL, TypeMax}
+ };
+
+///@}
+
+/**
+ Display the trailing Verbose information.
+**/
+VOID
+DumpStatistics( void )
+{
+ EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), gDpHiiHandle, SummaryData.NumTrace);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), gDpHiiHandle, SummaryData.NumIncomplete);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), gDpHiiHandle, SummaryData.NumSummary);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), gDpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), gDpHiiHandle, SummaryData.NumPEIMs);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), gDpHiiHandle, SummaryData.NumGlobal);
+#if PROFILING_IMPLEMENTED
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPROFILE), gDpHiiHandle, SummaryData.NumProfile);
+#endif // PROFILING_IMPLEMENTED
+ SHELL_FREE_NON_NULL (StringPtr);
+ SHELL_FREE_NON_NULL (StringPtrUnknown);
+}
+
+/**
+ Dump performance data.
+
+ @param[in] ImageHandle The image handle.
+ @param[in] SystemTable The system table.
+
+ @retval EFI_SUCCESS Command completed successfully.
+ @retval EFI_INVALID_PARAMETER Command usage error.
+ @retval value Unknown error.
+
+**/
+SHELL_STATUS
+EFIAPI
+ShellCommandRunDp (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ LIST_ENTRY *ParamPackage;
+ CONST CHAR16 *CmdLineArg;
+ EFI_STATUS Status;
+
+ UINT64 Freq;
+ UINT64 Ticker;
+ UINTN Number2Display;
+
+ EFI_STRING StringPtr;
+ BOOLEAN SummaryMode;
+ BOOLEAN VerboseMode;
+ BOOLEAN AllMode;
+ BOOLEAN RawMode;
+ BOOLEAN TraceMode;
+ BOOLEAN ProfileMode;
+ BOOLEAN ExcludeMode;
+
+ StringPtr = NULL;
+ SummaryMode = FALSE;
+ VerboseMode = FALSE;
+ AllMode = FALSE;
+ RawMode = FALSE;
+ TraceMode = FALSE;
+ ProfileMode = FALSE;
+ ExcludeMode = FALSE;
+
+ // Get DP's entry time as soon as possible.
+ // This is used as the Shell-Phase end time.
+ //
+ Ticker = GetPerformanceCounter ();
+
+ //
+ // initialize the shell lib (we must be in non-auto-init...)
+ //
+ Status = ShellInitialize();
+ ASSERT_EFI_ERROR(Status);
+
+ Status = CommandInit();
+ ASSERT_EFI_ERROR(Status);
+
+ //
+ // Process Command Line arguments
+ //
+ Status = ShellCommandLineParse (ParamList, &ParamPackage, NULL, TRUE);
+ if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), gDpHiiHandle);
+ return SHELL_INVALID_PARAMETER;
+ }
+
+ //
+ // Boolean options
+ //
+ VerboseMode = ShellCommandLineGetFlag (ParamPackage, L"-v");
+ SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, L"-S") || ShellCommandLineGetFlag (ParamPackage, L"-s"));
+ AllMode = ShellCommandLineGetFlag (ParamPackage, L"-A");
+ RawMode = ShellCommandLineGetFlag (ParamPackage, L"-R");
+#if PROFILING_IMPLEMENTED
+ TraceMode = ShellCommandLineGetFlag (ParamPackage, L"-T");
+ ProfileMode = ShellCommandLineGetFlag (ParamPackage, L"-P");
+#endif // PROFILING_IMPLEMENTED
+ ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x");
+ mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i");
+
+ // Options with Values
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n");
+ if (CmdLineArg == NULL) {
+ Number2Display = DEFAULT_DISPLAYCOUNT;
+ } else {
+ Number2Display = StrDecimalToUintn(CmdLineArg);
+ if (Number2Display == 0) {
+ Number2Display = MAXIMUM_DISPLAYCOUNT;
+ }
+ }
+
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-t");
+ if (CmdLineArg == NULL) {
+ mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us
+ } else {
+ mInterestThreshold = StrDecimalToUint64(CmdLineArg);
+ }
+
+ // Handle Flag combinations and default behaviors
+ // If both TraceMode and ProfileMode are FALSE, set them both to TRUE
+ if ((! TraceMode) && (! ProfileMode)) {
+ TraceMode = TRUE;
+#if PROFILING_IMPLEMENTED
+ ProfileMode = TRUE;
+#endif // PROFILING_IMPLEMENTED
+ }
+
+ //
+ // Timer specific processing
+ //
+ // Get the Performance counter characteristics:
+ // Freq = Frequency in Hz
+ // StartCount = Value loaded into the counter when it starts counting
+ // EndCount = Value counter counts to before it needs to be reset
+ //
+ Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount, &TimerInfo.EndCount);
+
+ // Convert the Frequency from Hz to KHz
+ TimerInfo.Frequency = (UINT32)DivU64x32 (Freq, 1000);
+
+ // Determine in which direction the performance counter counts.
+ TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount);
+
+ //
+ // Print header
+ //
+ // print DP's build version
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_BUILD_REVISION), gDpHiiHandle, DP_MAJOR_VERSION, DP_MINOR_VERSION);
+
+ // print performance timer characteristics
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), gDpHiiHandle, TimerInfo.Frequency);
+
+ if (VerboseMode && !RawMode) {
+ StringPtr = HiiGetString (gDpHiiHandle,
+ (EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)), NULL);
+ ASSERT (StringPtr != NULL);
+ // Print Timer count range and direction
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TIMER_PROPERTIES), gDpHiiHandle,
+ StringPtr,
+ TimerInfo.StartCount,
+ TimerInfo.EndCount
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_VERBOSE_THRESHOLD), gDpHiiHandle, mInterestThreshold);
+ }
+
+/****************************************************************************
+**** Print Sections based on command line options
+****
+**** Option modes have the following priority:
+**** v Verbose -- Valid in combination with any other options
+**** t Threshold -- Modifies All, Raw, and Cooked output
+**** Default is 0 for All and Raw mode
+**** Default is DEFAULT_THRESHOLD for "Cooked" mode
+**** n Number2Display Used by All and Raw mode. Otherwise ignored.
+**** A All -- R and S options are ignored
+**** R Raw -- S option is ignored
+**** s Summary -- Modifies "Cooked" output only
+**** Cooked (Default)
+****
+**** The All, Raw, and Cooked modes are modified by the Trace and Profile
+**** options.
+**** !T && !P := (0) Default, Both are displayed
+**** T && !P := (1) Only Trace records are displayed
+**** !T && P := (2) Only Profile records are displayed
+**** T && P := (3) Same as Default, both are displayed
+****************************************************************************/
+ GatherStatistics();
+ if (AllMode) {
+ if (TraceMode) {
+ DumpAllTrace( Number2Display, ExcludeMode);
+ }
+ if (ProfileMode) {
+ DumpAllProfile( Number2Display, ExcludeMode);
+ }
+ } else if (RawMode) {
+ if (TraceMode) {
+ DumpRawTrace( Number2Display, ExcludeMode);
+ }
+ if (ProfileMode) {
+ DumpRawProfile( Number2Display, ExcludeMode);
+ }
+ } else {
+ //------------- Begin Cooked Mode Processing
+ if (TraceMode) {
+ ProcessPhases ( Ticker );
+ if ( ! SummaryMode) {
+ Status = ProcessHandles ( ExcludeMode);
+ if ( ! EFI_ERROR( Status)) {
+ ProcessPeims ();
+ ProcessGlobal ();
+ ProcessCumulative ();
+ }
+ }
+ }
+ if (ProfileMode) {
+ DumpAllProfile( Number2Display, ExcludeMode);
+ }
+ } //------------- End of Cooked Mode Processing
+ if ( VerboseMode || SummaryMode) {
+ DumpStatistics();
+ }
+
+ SHELL_FREE_NON_NULL (StringPtr);
+
+ return SHELL_SUCCESS;
+}
diff --git a/ShellPkg/Library/UefiDpLib/Dp.h b/ShellPkg/Library/UefiDpLib/Dp.h
new file mode 100644
index 000000000..72e2c3ba1
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/Dp.h
@@ -0,0 +1,98 @@
+/** @file
+ Common declarations for the Dp Performance Reporting Utility.
+
+ Copyright (c) 2009 - 2013, 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.
+**/
+
+#ifndef _EFI_APP_DP_H_
+#define _EFI_APP_DP_H_
+
+#include <Library/ShellLib.h>
+#include <ShellBase.h>
+
+#define DP_MAJOR_VERSION 2
+#define DP_MINOR_VERSION 4
+
+/**
+ * The value assigned to DP_DEBUG controls which debug output
+ * is generated. Set it to ZERO to disable.
+**/
+#define DP_DEBUG 0
+
+/**
+ * Set to 1 once Profiling has been implemented in order to enable
+ * profiling related options and report output.
+**/
+#define PROFILING_IMPLEMENTED 0
+
+#define DEFAULT_THRESHOLD 1000 ///< One millisecond.
+#define DEFAULT_DISPLAYCOUNT 50
+#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
+
+#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
+
+/// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
+#define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )
+
+/// Structure for storing Timer specific information.
+typedef struct {
+ UINT64 StartCount; ///< Value timer is initialized with.
+ UINT64 EndCount; ///< Value timer has just before it wraps.
+ UINT32 Frequency; ///< Timer count frequency in KHz.
+ BOOLEAN CountUp; ///< TRUE if the counter counts up.
+} TIMER_INFO;
+
+/** Initialize one PERF_CUM_DATA structure instance for token t.
+ *
+ * This parameterized macro takes a single argument, t, which is expected
+ * to resolve to a pointer to an ASCII string literal. This parameter may
+ * take any one of the following forms:
+ * - PERF_INIT_CUM_DATA("Token") A string literal
+ * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
+ * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
+**/
+#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
+
+typedef struct {
+ UINT64 Duration; ///< Cumulative duration for this item.
+ UINT64 MinDur; ///< Smallest duration encountered.
+ UINT64 MaxDur; ///< Largest duration encountered.
+ CHAR8 *Name; ///< ASCII name of this item.
+ UINT32 Count; ///< Total number of measurements accumulated.
+} PERF_CUM_DATA;
+
+typedef struct {
+ UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.
+ UINT32 NumProfile; ///< Number of recorded PROFILE performance measurements.
+ UINT32 NumIncomplete; ///< Number of measurements with no END value.
+ UINT32 NumSummary; ///< Number of summary section measurements.
+ UINT32 NumHandles; ///< Number of measurements with handles.
+ UINT32 NumPEIMs; ///< Number of measurements of PEIMs.
+ UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.
+} PERF_SUMMARY_DATA;
+
+typedef struct {
+ CONST VOID *Handle;
+ CONST CHAR8 *Token; ///< Measured token string name.
+ CONST CHAR8 *Module; ///< Module string name.
+ UINT64 StartTimeStamp; ///< Start time point.
+ UINT64 EndTimeStamp; ///< End time point.
+ UINT32 Identifier; ///< Identifier.
+} MEASUREMENT_RECORD;
+
+typedef struct {
+ CHAR8 *Name; ///< Measured token string name.
+ UINT64 CumulativeTime; ///< Accumulated Elapsed Time.
+ UINT64 MinTime; ///< Minimum Elapsed Time.
+ UINT64 MaxTime; ///< Maximum Elapsed Time.
+ UINT32 Count; ///< Number of measurements accumulated.
+} PROFILE_RECORD;
+
+#endif // _EFI_APP_DP_H_
diff --git a/ShellPkg/Library/UefiDpLib/DpInternal.h b/ShellPkg/Library/UefiDpLib/DpInternal.h
new file mode 100644
index 000000000..c7d9a592f
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/DpInternal.h
@@ -0,0 +1,340 @@
+/** @file
+ Declarations of objects defined internally to the Dp Application.
+
+ Declarations of data and functions which are private to the Dp application.
+ This file should never be referenced by anything other than components of the
+ Dp application. In addition to global data, function declarations for
+ DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
+
+ Copyright (c) 2009 - 2013, 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.
+**/
+#ifndef _DP_INTELNAL_H_
+#define _DP_INTELNAL_H_
+
+#define DP_GAUGE_STRING_LENGTH 36
+
+//
+/// Module-Global Variables
+///@{
+extern EFI_HII_HANDLE gDpHiiHandle;
+extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
+extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
+extern UINT64 mInterestThreshold;
+extern BOOLEAN mShowId;
+
+extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO.
+
+/// Timer Specific Information.
+extern TIMER_INFO TimerInfo;
+
+/// Items for which to gather cumulative statistics.
+extern PERF_CUM_DATA CumData[];
+
+/// Number of items for which we are gathering cumulative statistics.
+extern UINT32 const NumCum;
+
+///@}
+
+/**
+ Calculate an event's duration in timer ticks.
+
+ Given the count direction and the event's start and end timer values,
+ calculate the duration of the event in timer ticks. Information for
+ the current measurement is pointed to by the parameter.
+
+ If the measurement's start time is 1, it indicates that the developer
+ is indicating that the measurement began at the release of reset.
+ The start time is adjusted to the timer's starting count before performing
+ the elapsed time calculation.
+
+ The calculated duration, in ticks, is the absolute difference between
+ the measurement's ending and starting counts.
+
+ @param Measurement Pointer to a MEASUREMENT_RECORD structure containing
+ data for the current measurement.
+
+ @return The 64-bit duration of the event.
+**/
+UINT64
+GetDuration (
+ IN OUT MEASUREMENT_RECORD *Measurement
+ );
+
+/**
+ Determine whether the Measurement record is for an EFI Phase.
+
+ The Token and Module members of the measurement record are checked.
+ Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.
+
+ @param[in] Measurement A pointer to the Measurement record to test.
+
+ @retval TRUE The measurement record is for an EFI Phase.
+ @retval FALSE The measurement record is NOT for an EFI Phase.
+**/
+BOOLEAN
+IsPhase(
+ IN MEASUREMENT_RECORD *Measurement
+ );
+
+/**
+ Get the file name portion of the Pdb File Name.
+
+ The portion of the Pdb File Name between the last backslash and
+ either a following period or the end of the string is converted
+ to Unicode and copied into UnicodeBuffer. The name is truncated,
+ if necessary, to ensure that UnicodeBuffer is not overrun.
+
+ @param[in] PdbFileName Pdb file name.
+ @param[out] UnicodeBuffer The resultant Unicode File Name.
+
+**/
+VOID
+GetShortPdbFileName (
+ IN CHAR8 *PdbFileName,
+ OUT CHAR16 *UnicodeBuffer
+ );
+
+/**
+ Get a human readable name for an image handle.
+ The following methods will be tried orderly:
+ 1. Image PDB
+ 2. ComponentName2 protocol
+ 3. FFS UI section
+ 4. Image GUID
+ 5. Image DevicePath
+ 6. Unknown Driver Name
+
+ @param[in] Handle
+
+ @post The resulting Unicode name string is stored in the
+ mGaugeString global array.
+
+**/
+VOID
+GetNameFromHandle (
+ IN EFI_HANDLE Handle
+ );
+
+/**
+ Calculate the Duration in microseconds.
+
+ Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
+ multiplying the result by 1000, in order to maintain precision. Since Duration is
+ a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
+
+ The time is calculated as (Duration * 1000) / Timer_Frequency.
+
+ @param[in] Duration The event duration in timer ticks.
+
+ @return A 64-bit value which is the Elapsed time in microseconds.
+**/
+UINT64
+DurationInMicroSeconds (
+ IN UINT64 Duration
+ );
+
+/**
+ Get index of Measurement Record's match in the CumData array.
+
+ If the Measurement's Token value matches a Token in one of the CumData
+ records, the index of the matching record is returned. The returned
+ index is a signed value so that negative values can indicate that
+ the Measurement didn't match any entry in the CumData array.
+
+ @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
+
+ @retval <0 Token is not in the CumData array.
+ @retval >=0 Return value is the index into CumData where Token is found.
+**/
+INTN
+GetCumulativeItem(
+ IN MEASUREMENT_RECORD *Measurement
+ );
+
+/**
+ Collect verbose statistics about the logged performance measurements.
+
+ General Summary information for all Trace measurements is gathered and
+ stored within the SummaryData structure. This information is both
+ used internally by subsequent reporting functions, and displayed
+ at the end of verbose reports.
+
+ @pre The SummaryData and CumData structures must be initialized
+ prior to calling this function.
+
+ @post The SummaryData and CumData structures contain statistics for the
+ current performance logs.
+**/
+VOID
+GatherStatistics(
+ VOID
+ );
+
+/**
+ Gather and print ALL Trace Records.
+
+ Displays all "interesting" Trace measurements in order.<BR>
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+ The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
+ They must not be in use by a calling function.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpAllTrace(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ );
+
+/**
+ Gather and print Raw Trace Records.
+
+ All Trace measurements with a duration greater than or equal to
+ mInterestThreshold are printed without interpretation.
+
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpRawTrace(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ );
+
+/**
+ Gather and print Major Phase metrics.
+
+ @param[in] Ticker The timer value for the END of Shell phase
+
+**/
+VOID
+ProcessPhases(
+ IN UINT64 Ticker
+ );
+
+
+/**
+ Gather and print Handle data.
+
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+ @return Status from a call to gBS->LocateHandle().
+**/
+EFI_STATUS
+ProcessHandles(
+ IN BOOLEAN ExcludeFlag
+ );
+
+
+/**
+ Gather and print PEIM data.
+
+ Only prints complete PEIM records
+
+**/
+VOID
+ProcessPeims(
+ VOID
+ );
+
+/**
+ Gather and print global data.
+
+ Strips out incomplete or "Execution Phase" records
+ Only prints records where Handle is NULL
+ Increment TIndex for every record, even skipped ones, so that we have an
+ indication of every measurement record taken.
+
+**/
+VOID
+ProcessGlobal(
+ VOID
+ );
+
+/**
+ Gather and print cumulative data.
+
+ Traverse the measurement records and:<BR>
+ For each record with a Token listed in the CumData array:<BR>
+ - Update the instance count and the total, minimum, and maximum durations.
+ Finally, print the gathered cumulative statistics.
+
+**/
+VOID
+ProcessCumulative(
+ VOID
+ );
+
+/**
+ Gather and print ALL Profiling Records.
+
+ Displays all "interesting" Profile measurements in order.
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+ The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
+ They must not be in use by a calling function.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpAllProfile(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ );
+
+/**
+ Gather and print Raw Profile Records.
+
+ All Profile measurements with a duration greater than or equal to
+ mInterestThreshold are printed without interpretation.
+
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpRawProfile(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ );
+
+#endif
diff --git a/ShellPkg/Library/UefiDpLib/DpProfile.c b/ShellPkg/Library/UefiDpLib/DpProfile.c
new file mode 100644
index 000000000..64583988c
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/DpProfile.c
@@ -0,0 +1,101 @@
+/** @file
+ Measured Profiling reporting for the Dp utility.
+
+ Copyright (c) 2009 - 2013, 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.
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/TimerLib.h>
+#include <Library/PeCoffGetEntryPointLib.h>
+#include <Library/PerformanceLib.h>
+#include <Library/PrintLib.h>
+#include <Library/HiiLib.h>
+#include <Library/PcdLib.h>
+
+#include <Guid/Performance.h>
+
+#include "Dp.h"
+#include "Literals.h"
+#include "DpInternal.h"
+
+/**
+ Gather and print ALL Profiling Records.
+
+ Displays all "interesting" Profile measurements in order.
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+ The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
+ They must not be in use by a calling function.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpAllProfile(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ )
+{
+ EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+}
+
+/**
+ Gather and print Raw Profile Records.
+
+ All Profile measurements with a duration greater than or equal to
+ mInterestThreshold are printed without interpretation.
+
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpRawProfile(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ )
+{
+ EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+}
diff --git a/ShellPkg/Library/UefiDpLib/DpTrace.c b/ShellPkg/Library/UefiDpLib/DpTrace.c
new file mode 100644
index 000000000..de1d45aa8
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/DpTrace.c
@@ -0,0 +1,828 @@
+/** @file
+ Trace reporting for the Dp utility.
+
+ Copyright (c) 2009 - 2013, 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.
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/TimerLib.h>
+#include <Library/PeCoffGetEntryPointLib.h>
+#include <Library/PerformanceLib.h>
+#include <Library/PrintLib.h>
+#include <Library/HiiLib.h>
+#include <Library/PcdLib.h>
+
+#include <Guid/Performance.h>
+
+#include "Dp.h"
+#include "Literals.h"
+#include "DpInternal.h"
+
+/**
+ Collect verbose statistics about the logged performance measurements.
+
+ General Summary information for all Trace measurements is gathered and
+ stored within the SummaryData structure. This information is both
+ used internally by subsequent reporting functions, and displayed
+ at the end of verbose reports.
+
+ @pre The SummaryData and CumData structures must be initialized
+ prior to calling this function.
+
+ @post The SummaryData and CumData structures contain statistics for the
+ current performance logs.
+**/
+VOID
+GatherStatistics(
+ VOID
+)
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 Duration;
+ UINTN LogEntryKey;
+ INTN TIndex;
+
+ LogEntryKey = 0;
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ {
+ ++SummaryData.NumTrace; // Count the number of TRACE Measurement records
+ if (Measurement.EndTimeStamp == 0) {
+ ++SummaryData.NumIncomplete; // Count the incomplete records
+ continue;
+ }
+
+ if (Measurement.Handle != NULL) {
+ ++SummaryData.NumHandles; // Count the number of measurements with non-NULL handles
+ }
+
+ if (IsPhase( &Measurement)) {
+ ++SummaryData.NumSummary; // Count the number of major phases
+ }
+ else { // !IsPhase(...
+ if(Measurement.Handle == NULL) {
+ ++SummaryData.NumGlobal;
+ }
+ }
+
+ if (AsciiStrnCmp (Measurement.Token, ALit_PEIM, PERF_TOKEN_LENGTH) == 0) {
+ ++SummaryData.NumPEIMs; // Count PEIM measurements
+ }
+
+ Duration = GetDuration (&Measurement);
+ TIndex = GetCumulativeItem (&Measurement);
+ if (TIndex >= 0) {
+ CumData[TIndex].Duration += Duration;
+ CumData[TIndex].Count++;
+ if ( Duration < CumData[TIndex].MinDur ) {
+ CumData[TIndex].MinDur = Duration;
+ }
+ if ( Duration > CumData[TIndex].MaxDur ) {
+ CumData[TIndex].MaxDur = Duration;
+ }
+ }
+ }
+}
+
+/**
+ Gather and print ALL Trace Records.
+
+ Displays all "interesting" Trace measurements in order.<BR>
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+ The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
+ They must not be in use by a calling function.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpAllTrace(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ )
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ CHAR16 *IncFlag;
+ UINTN LogEntryKey;
+ UINTN Count;
+ UINTN Index;
+ UINTN TIndex;
+
+ EFI_HANDLE *HandleBuffer;
+ UINTN Size;
+ EFI_HANDLE TempHandle;
+ EFI_STATUS Status;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ IncFlag = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (IncFlag == NULL) ? StringPtrUnknown : IncFlag);
+ FreePool (StringPtrUnknown);
+
+ // Get Handle information
+ //
+ Size = 0;
+ HandleBuffer = &TempHandle;
+ Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, &TempHandle);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ HandleBuffer = AllocatePool (Size);
+ ASSERT (HandleBuffer != NULL);
+ if (HandleBuffer == NULL) {
+ return;
+ }
+ Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleBuffer);
+ }
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), gDpHiiHandle, Status);
+ }
+ else {
+ // We have successfully populated the HandleBuffer
+ // Display ALL Measurement Records
+ // Up to Limit lines displayed
+ // Display only records with Elapsed times >= mInterestThreshold
+ // Display driver names in Module field for records with Handles.
+ //
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR2), gDpHiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_DASHES2), gDpHiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR), gDpHiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandle);
+ }
+
+ LogEntryKey = 0;
+ Count = 0;
+ Index = 0;
+ while ( WITHIN_LIMIT(Count, Limit) &&
+ ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ )
+ {
+ ++Index; // Count every record. First record is 1.
+ ElapsedTime = 0;
+ SHELL_FREE_NON_NULL (IncFlag);
+ if (Measurement.EndTimeStamp != 0) {
+ Duration = GetDuration (&Measurement);
+ ElapsedTime = DurationInMicroSeconds ( Duration );
+ IncFlag = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
+ }
+ else {
+ IncFlag = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records
+ }
+ if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) ||
+ ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
+ ) { // Ignore "uninteresting" or excluded records
+ continue;
+ }
+ ++Count; // Count the number of records printed
+
+ // If Handle is non-zero, see if we can determine a name for the driver
+ AsciiStrToUnicodeStr (Measurement.Module, mGaugeString); // Use Module by default
+ AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);
+ if (Measurement.Handle != NULL) {
+ // See if the Handle is in the HandleBuffer
+ for (TIndex = 0; TIndex < (Size / sizeof(HandleBuffer[0])); TIndex++) {
+ if (Measurement.Handle == HandleBuffer[TIndex]) {
+ GetNameFromHandle (HandleBuffer[TIndex]);
+ break;
+ }
+ }
+ }
+
+ if (AsciiStrnCmp (Measurement.Token, ALit_PEIM, PERF_TOKEN_LENGTH) == 0) {
+ UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", Measurement.Handle);
+ }
+
+ // Ensure that the argument strings are not too long.
+ mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
+ mUnicodeToken[13] = 0;
+
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), gDpHiiHandle,
+ Index, // 1 based, Which measurement record is being printed
+ IncFlag,
+ Measurement.Handle,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), gDpHiiHandle,
+ Index, // 1 based, Which measurement record is being printed
+ IncFlag,
+ Measurement.Handle,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime
+ );
+ }
+ }
+ }
+ if (HandleBuffer != &TempHandle) {
+ FreePool (HandleBuffer);
+ }
+ SHELL_FREE_NON_NULL (IncFlag);
+}
+
+/**
+ Gather and print Raw Trace Records.
+
+ All Trace measurements with a duration greater than or equal to
+ mInterestThreshold are printed without interpretation.
+
+ The number of records displayed is controlled by:
+ - records with a duration less than mInterestThreshold microseconds are not displayed.
+ - No more than Limit records are displayed. A Limit of zero will not limit the output.
+ - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
+ displayed.
+
+ @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
+
+ @param[in] Limit The number of records to print. Zero is ALL.
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+**/
+VOID
+DumpRawTrace(
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
+ )
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ UINTN LogEntryKey;
+ UINTN Count;
+ UINTN Index;
+
+ EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR2), gDpHiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES2), gDpHiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR), gDpHiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES), gDpHiiHandle);
+ }
+
+ LogEntryKey = 0;
+ Count = 0;
+ Index = 0;
+ while ( WITHIN_LIMIT(Count, Limit) &&
+ ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ )
+ {
+ ++Index; // Count every record. First record is 1.
+ ElapsedTime = 0;
+ if (Measurement.EndTimeStamp != 0) {
+ Duration = GetDuration (&Measurement);
+ ElapsedTime = DurationInMicroSeconds ( Duration );
+ }
+ if ((ElapsedTime < mInterestThreshold) ||
+ ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
+ ) { // Ignore "uninteresting" or Excluded records
+ continue;
+ }
+ ++Count; // Count the number of records printed
+
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), gDpHiiHandle,
+ Index, // 1 based, Which measurement record is being printed
+ Measurement.Handle,
+ Measurement.StartTimeStamp,
+ Measurement.EndTimeStamp,
+ Measurement.Token,
+ Measurement.Module,
+ Measurement.Identifier
+ );
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), gDpHiiHandle,
+ Index, // 1 based, Which measurement record is being printed
+ Measurement.Handle,
+ Measurement.StartTimeStamp,
+ Measurement.EndTimeStamp,
+ Measurement.Token,
+ Measurement.Module
+ );
+ }
+ }
+}
+
+/**
+ Gather and print Major Phase metrics.
+
+ @param[in] Ticker The timer value for the END of Shell phase
+
+**/
+VOID
+ProcessPhases(
+ IN UINT64 Ticker
+ )
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 BdsTimeoutValue;
+ UINT64 SecTime;
+ UINT64 PeiTime;
+ UINT64 DxeTime;
+ UINT64 BdsTime;
+ UINT64 ShellTime;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ UINT64 Total;
+ EFI_STRING StringPtr;
+ UINTN LogEntryKey;
+ EFI_STRING StringPtrUnknown;
+
+ BdsTimeoutValue = 0;
+ SecTime = 0;
+ PeiTime = 0;
+ DxeTime = 0;
+ BdsTime = 0;
+ ShellTime = 0;
+ //
+ // Get Execution Phase Statistics
+ //
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+
+ LogEntryKey = 0;
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ {
+ if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
+ Measurement.EndTimeStamp = Ticker;
+ }
+ if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
+ continue;
+ }
+ Duration = GetDuration (&Measurement);
+ if ( Measurement.Handle != NULL
+ && (AsciiStrnCmp (Measurement.Token, ALit_BdsTO, PERF_TOKEN_LENGTH) == 0)
+ )
+ {
+ BdsTimeoutValue = Duration;
+ } else if (AsciiStrnCmp (Measurement.Token, ALit_SEC, PERF_TOKEN_LENGTH) == 0) {
+ SecTime = Duration;
+ } else if (AsciiStrnCmp (Measurement.Token, ALit_PEI, PERF_TOKEN_LENGTH) == 0) {
+ PeiTime = Duration;
+ } else if (AsciiStrnCmp (Measurement.Token, ALit_DXE, PERF_TOKEN_LENGTH) == 0) {
+ DxeTime = Duration;
+ } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0) {
+ BdsTime = Duration;
+ } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
+ ShellTime = Duration;
+ }
+ }
+
+ Total = 0;
+
+ // print SEC phase duration time
+ //
+ if (SecTime > 0) {
+ ElapsedTime = DurationInMicroSeconds ( SecTime ); // Calculate elapsed time in microseconds
+ Total += DivU64x32 (ElapsedTime, 1000); // Accumulate time in milliseconds
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), gDpHiiHandle, ElapsedTime);
+ }
+
+ // print PEI phase duration time
+ //
+ if (PeiTime > 0) {
+ ElapsedTime = DivU64x32 (
+ PeiTime,
+ (UINT32)TimerInfo.Frequency
+ );
+ Total += ElapsedTime;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_PEI, ElapsedTime);
+ }
+
+ // print DXE phase duration time
+ //
+ if (DxeTime > 0) {
+ ElapsedTime = DivU64x32 (
+ DxeTime,
+ (UINT32)TimerInfo.Frequency
+ );
+ Total += ElapsedTime;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_DXE, ElapsedTime);
+ }
+
+ // print BDS phase duration time
+ //
+ if (BdsTime > 0) {
+ ElapsedTime = DivU64x32 (
+ BdsTime,
+ (UINT32)TimerInfo.Frequency
+ );
+ Total += ElapsedTime;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_BDS, ElapsedTime);
+ }
+
+ if (BdsTimeoutValue > 0) {
+ ElapsedTime = DivU64x32 (
+ BdsTimeoutValue,
+ (UINT32)TimerInfo.Frequency
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_BDSTO), gDpHiiHandle, ALit_BdsTO, ElapsedTime);
+ }
+
+ // print SHELL phase duration time
+ //
+ if (ShellTime > 0) {
+ ElapsedTime = DivU64x32 (
+ ShellTime,
+ (UINT32)TimerInfo.Frequency
+ );
+ Total += ElapsedTime;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_SHELL, ElapsedTime);
+ }
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), gDpHiiHandle, Total);
+}
+
+/**
+ Gather and print Handle data.
+
+ @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
+
+ @return Status from a call to gBS->LocateHandle().
+**/
+EFI_STATUS
+ProcessHandles(
+ IN BOOLEAN ExcludeFlag
+ )
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ EFI_HANDLE *HandleBuffer;
+ EFI_STRING StringPtr;
+ UINTN Index;
+ UINTN LogEntryKey;
+ UINTN Count;
+ UINTN Size;
+ EFI_HANDLE TempHandle;
+ EFI_STATUS Status;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+
+ Size = 0;
+ HandleBuffer = &TempHandle;
+ Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, &TempHandle);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ HandleBuffer = AllocatePool (Size);
+ ASSERT (HandleBuffer != NULL);
+ if (HandleBuffer == NULL) {
+ return Status;
+ }
+ Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleBuffer);
+ }
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), gDpHiiHandle, Status);
+ }
+ else {
+#if DP_DEBUG == 2
+ Print (L"There are %,d Handles defined.\n", (Size / sizeof(HandleBuffer[0])));
+#endif
+
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION2), gDpHiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION), gDpHiiHandle);
+ }
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandle);
+
+ LogEntryKey = 0;
+ Count = 0;
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ {
+ Count++;
+ Duration = GetDuration (&Measurement);
+ ElapsedTime = DurationInMicroSeconds ( Duration );
+ if ((ElapsedTime < mInterestThreshold) ||
+ (Measurement.EndTimeStamp == 0) ||
+ (Measurement.Handle == NULL) ||
+ ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
+ ) { // Ignore "uninteresting" or excluded records
+ continue;
+ }
+ mGaugeString[0] = 0; // Empty driver name by default
+ AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);
+ // See if the Handle is in the HandleBuffer
+ for (Index = 0; Index < (Size / sizeof(HandleBuffer[0])); Index++) {
+ if (Measurement.Handle == HandleBuffer[Index]) {
+ GetNameFromHandle (HandleBuffer[Index]); // Name is put into mGaugeString
+ break;
+ }
+ }
+ // Ensure that the argument strings are not too long.
+ mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
+ mUnicodeToken[11] = 0;
+ if (mGaugeString[0] != 0) {
+ // Display the record if it has a valid handle.
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS2), gDpHiiHandle,
+ Count, // 1 based, Which measurement record is being printed
+ Index + 1, // 1 based, Which handle is being printed
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS), gDpHiiHandle,
+ Count, // 1 based, Which measurement record is being printed
+ Index + 1, // 1 based, Which handle is being printed
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime
+ );
+ }
+ }
+ }
+ }
+ if (HandleBuffer != &TempHandle) {
+ FreePool (HandleBuffer);
+ }
+ return Status;
+}
+
+/**
+ Gather and print PEIM data.
+
+ Only prints complete PEIM records
+
+**/
+VOID
+ProcessPeims(
+ VOID
+)
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 Duration;
+ UINT64 ElapsedTime;
+ EFI_STRING StringPtr;
+ UINTN LogEntryKey;
+ UINTN TIndex;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION2), gDpHiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), gDpHiiHandle);
+ }
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandle);
+ TIndex = 0;
+ LogEntryKey = 0;
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ {
+ TIndex++;
+ if ((Measurement.EndTimeStamp == 0) ||
+ (AsciiStrnCmp (Measurement.Token, ALit_PEIM, PERF_TOKEN_LENGTH) != 0)
+ ) {
+ continue;
+ }
+
+ Duration = GetDuration (&Measurement);
+ ElapsedTime = DurationInMicroSeconds ( Duration ); // Calculate elapsed time in microseconds
+ if (ElapsedTime >= mInterestThreshold) {
+ // PEIM FILE Handle is the start address of its FFS file that contains its file guid.
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), gDpHiiHandle,
+ TIndex, // 1 based, Which measurement record is being printed
+ Measurement.Handle, // base address
+ Measurement.Handle, // file guid
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), gDpHiiHandle,
+ TIndex, // 1 based, Which measurement record is being printed
+ Measurement.Handle, // base address
+ Measurement.Handle, // file guid
+ ElapsedTime
+ );
+ }
+ }
+ }
+}
+
+/**
+ Gather and print global data.
+
+ Strips out incomplete or "Execution Phase" records
+ Only prints records where Handle is NULL
+ Increment TIndex for every record, even skipped ones, so that we have an
+ indication of every measurement record taken.
+
+**/
+VOID
+ProcessGlobal(
+ VOID
+)
+{
+ MEASUREMENT_RECORD Measurement;
+ UINT64 Duration;
+ UINT64 ElapsedTime;
+ EFI_STRING StringPtr;
+ UINTN LogEntryKey;
+ UINTN Index; // Index, or number, of the measurement record being processed
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION2), gDpHiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), gDpHiiHandle);
+ }
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandle);
+
+ Index = 1;
+ LogEntryKey = 0;
+
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
+ {
+ AsciiStrToUnicodeStr (Measurement.Module, mGaugeString);
+ AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);
+ mGaugeString[25] = 0;
+ mUnicodeToken[31] = 0;
+ if ( ! ( IsPhase( &Measurement) ||
+ (Measurement.Handle != NULL) ||
+ (Measurement.EndTimeStamp == 0)
+ ))
+ {
+ Duration = GetDuration (&Measurement);
+ ElapsedTime = DurationInMicroSeconds ( Duration );
+ if (ElapsedTime >= mInterestThreshold) {
+ if (mShowId) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS2), gDpHiiHandle,
+ Index,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS), gDpHiiHandle,
+ Index,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime
+ );
+ }
+ }
+ }
+ Index++;
+ }
+}
+
+/**
+ Gather and print cumulative data.
+
+ Traverse the measurement records and:<BR>
+ For each record with a Token listed in the CumData array:<BR>
+ - Update the instance count and the total, minimum, and maximum durations.
+ Finally, print the gathered cumulative statistics.
+
+**/
+VOID
+ProcessCumulative(
+ VOID
+)
+{
+ UINT64 AvgDur; // the computed average duration
+ UINT64 Dur;
+ UINT64 MinDur;
+ UINT64 MaxDur;
+ EFI_STRING StringPtr;
+ UINTN TIndex;
+ EFI_STRING StringPtrUnknown;
+
+ StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_SECT_1), gDpHiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_SECT_2), gDpHiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandle);
+
+ for ( TIndex = 0; TIndex < NumCum; ++TIndex) {
+ if (CumData[TIndex].Count != 0) {
+ AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);
+ AvgDur = DurationInMicroSeconds(AvgDur);
+ Dur = DurationInMicroSeconds(CumData[TIndex].Duration);
+ MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur);
+ MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), gDpHiiHandle,
+ CumData[TIndex].Name,
+ CumData[TIndex].Count,
+ Dur,
+ AvgDur,
+ MinDur,
+ MaxDur
+ );
+ }
+ }
+}
diff --git a/ShellPkg/Library/UefiDpLib/DpUtilities.c b/ShellPkg/Library/UefiDpLib/DpUtilities.c
new file mode 100644
index 000000000..89c9919e0
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/DpUtilities.c
@@ -0,0 +1,400 @@
+/** @file
+ Utility functions used by the Dp application.
+
+ Copyright (c) 2009 - 2013, 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.
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/TimerLib.h>
+#include <Library/PeCoffGetEntryPointLib.h>
+#include <Library/PrintLib.h>
+#include <Library/HiiLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+#include <Library/DevicePathLib.h>
+
+#include <Pi/PiFirmwareFile.h>
+#include <Library/DxeServicesLib.h>
+
+#include <Protocol/LoadedImage.h>
+#include <Protocol/DriverBinding.h>
+#include <Protocol/ComponentName2.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/DevicePathToText.h>
+
+#include <Guid/Performance.h>
+
+#include "Dp.h"
+#include "Literals.h"
+#include "DpInternal.h"
+
+/**
+ Calculate an event's duration in timer ticks.
+
+ Given the count direction and the event's start and end timer values,
+ calculate the duration of the event in timer ticks. Information for
+ the current measurement is pointed to by the parameter.
+
+ If the measurement's start time is 1, it indicates that the developer
+ is indicating that the measurement began at the release of reset.
+ The start time is adjusted to the timer's starting count before performing
+ the elapsed time calculation.
+
+ The calculated duration, in ticks, is the absolute difference between
+ the measurement's ending and starting counts.
+
+ @param Measurement Pointer to a MEASUREMENT_RECORD structure containing
+ data for the current measurement.
+
+ @return The 64-bit duration of the event.
+**/
+UINT64
+GetDuration (
+ IN OUT MEASUREMENT_RECORD *Measurement
+ )
+{
+ UINT64 Duration;
+ BOOLEAN Error;
+
+ // PERF_START macros are called with a value of 1 to indicate
+ // the beginning of time. So, adjust the start ticker value
+ // to the real beginning of time.
+ // Assumes no wraparound. Even then, there is a very low probability
+ // of having a valid StartTicker value of 1.
+ if (Measurement->StartTimeStamp == 1) {
+ Measurement->StartTimeStamp = TimerInfo.StartCount;
+ }
+ if (TimerInfo.CountUp) {
+ Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;
+ Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);
+ }
+ else {
+ Duration = Measurement->StartTimeStamp - Measurement->EndTimeStamp;
+ Error = (BOOLEAN)(Duration > Measurement->StartTimeStamp);
+ }
+
+ if (Error) {
+ DEBUG ((EFI_D_ERROR, ALit_TimerLibError));
+ Duration = 0;
+ }
+ return Duration;
+}
+
+/**
+ Determine whether the Measurement record is for an EFI Phase.
+
+ The Token and Module members of the measurement record are checked.
+ Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.
+
+ @param[in] Measurement A pointer to the Measurement record to test.
+
+ @retval TRUE The measurement record is for an EFI Phase.
+ @retval FALSE The measurement record is NOT for an EFI Phase.
+**/
+BOOLEAN
+IsPhase(
+ IN MEASUREMENT_RECORD *Measurement
+ )
+{
+ BOOLEAN RetVal;
+
+ RetVal = (BOOLEAN)( ( *Measurement->Module == '\0') &&
+ ((AsciiStrnCmp (Measurement->Token, ALit_SEC, PERF_TOKEN_LENGTH) == 0) ||
+ (AsciiStrnCmp (Measurement->Token, ALit_PEI, PERF_TOKEN_LENGTH) == 0) ||
+ (AsciiStrnCmp (Measurement->Token, ALit_DXE, PERF_TOKEN_LENGTH) == 0) ||
+ (AsciiStrnCmp (Measurement->Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0))
+ );
+ return RetVal;
+}
+
+/**
+ Get the file name portion of the Pdb File Name.
+
+ The portion of the Pdb File Name between the last backslash and
+ either a following period or the end of the string is converted
+ to Unicode and copied into UnicodeBuffer. The name is truncated,
+ if necessary, to ensure that UnicodeBuffer is not overrun.
+
+ @param[in] PdbFileName Pdb file name.
+ @param[out] UnicodeBuffer The resultant Unicode File Name.
+
+**/
+VOID
+GetShortPdbFileName (
+ IN CHAR8 *PdbFileName,
+ OUT CHAR16 *UnicodeBuffer
+ )
+{
+ UINTN IndexA; // Current work location within an ASCII string.
+ UINTN IndexU; // Current work location within a Unicode string.
+ UINTN StartIndex;
+ UINTN EndIndex;
+
+ ZeroMem (UnicodeBuffer, DXE_PERFORMANCE_STRING_LENGTH * sizeof (CHAR16));
+
+ if (PdbFileName == NULL) {
+ StrCpy (UnicodeBuffer, L" ");
+ } else {
+ StartIndex = 0;
+ for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
+ ;
+ for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {
+ if (PdbFileName[IndexA] == '\\') {
+ StartIndex = IndexA + 1;
+ }
+
+ if (PdbFileName[IndexA] == '.') {
+ EndIndex = IndexA;
+ }
+ }
+
+ IndexU = 0;
+ for (IndexA = StartIndex; IndexA < EndIndex; IndexA++) {
+ UnicodeBuffer[IndexU] = (CHAR16) PdbFileName[IndexA];
+ IndexU++;
+ if (IndexU >= DXE_PERFORMANCE_STRING_LENGTH) {
+ UnicodeBuffer[DXE_PERFORMANCE_STRING_LENGTH] = 0;
+ break;
+ }
+ }
+ }
+}
+
+/**
+ Get a human readable name for an image handle.
+ The following methods will be tried orderly:
+ 1. Image PDB
+ 2. ComponentName2 protocol
+ 3. FFS UI section
+ 4. Image GUID
+ 5. Image DevicePath
+ 6. Unknown Driver Name
+
+ @param[in] Handle
+
+ @post The resulting Unicode name string is stored in the
+ mGaugeString global array.
+
+**/
+VOID
+GetNameFromHandle (
+ IN EFI_HANDLE Handle
+ )
+{
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *Image;
+ CHAR8 *PdbFileName;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ EFI_STRING StringPtr;
+ EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_GUID *NameGuid;
+ CHAR16 *NameString;
+ UINTN StringSize;
+ CHAR8 *PlatformLanguage;
+ EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
+ EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText;
+
+ //
+ // Method 1: Get the name string from image PDB
+ //
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **) &Image
+ );
+
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ Handle,
+ &gEfiDriverBindingProtocolGuid,
+ (VOID **) &DriverBinding,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->HandleProtocol (
+ DriverBinding->ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **) &Image
+ );
+ }
+ }
+
+ if (!EFI_ERROR (Status)) {
+ PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase);
+
+ if (PdbFileName != NULL) {
+ GetShortPdbFileName (PdbFileName, mGaugeString);
+ return;
+ }
+ }
+
+ //
+ // Method 2: Get the name string from ComponentName2 protocol
+ //
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **) &ComponentName2
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Get the current platform language setting
+ //
+ GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);
+ Status = ComponentName2->GetDriverName (
+ ComponentName2,
+ PlatformLanguage != NULL ? PlatformLanguage : "en-US",
+ &StringPtr
+ );
+ if (!EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (PlatformLanguage);
+ StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);
+ mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
+ return;
+ }
+ }
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiLoadedImageDevicePathProtocolGuid,
+ (VOID **) &LoadedImageDevicePath
+ );
+ if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) {
+ DevicePath = LoadedImageDevicePath;
+
+ //
+ // Try to get image GUID from LoadedImageDevicePath protocol
+ //
+ NameGuid = NULL;
+ while (!IsDevicePathEndType (DevicePath)) {
+ NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
+ if (NameGuid != NULL) {
+ break;
+ }
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ if (NameGuid != NULL) {
+ //
+ // Try to get the image's FFS UI section by image GUID
+ //
+ NameString = NULL;
+ StringSize = 0;
+ Status = GetSectionFromAnyFv (
+ NameGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **) &NameString,
+ &StringSize
+ );
+
+ if (!EFI_ERROR (Status)) {
+ //
+ // Method 3. Get the name string from FFS UI section
+ //
+ StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
+ mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
+ FreePool (NameString);
+ } else {
+ //
+ // Method 4: Get the name string from image GUID
+ //
+ UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
+ }
+ return;
+ } else {
+ //
+ // Method 5: Get the name string from image DevicePath
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiDevicePathToTextProtocolGuid,
+ NULL,
+ (VOID **) &DevicePathToText
+ );
+ if (!EFI_ERROR (Status)) {
+ NameString = DevicePathToText->ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);
+ if (NameString != NULL) {
+ StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
+ mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
+ FreePool (NameString);
+ return;
+ }
+ }
+ }
+ }
+
+ //
+ // Method 6: Unknown Driver Name
+ //
+ StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);
+ ASSERT (StringPtr != NULL);
+ StrCpy (mGaugeString, StringPtr);
+ FreePool (StringPtr);
+}
+
+/**
+ Calculate the Duration in microseconds.
+
+ Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
+ multiplying the result by 1000, in order to maintain precision. Since Duration is
+ a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
+
+ The time is calculated as (Duration * 1000) / Timer_Frequency.
+
+ @param[in] Duration The event duration in timer ticks.
+
+ @return A 64-bit value which is the Elapsed time in microseconds.
+**/
+UINT64
+DurationInMicroSeconds (
+ IN UINT64 Duration
+ )
+{
+ UINT64 Temp;
+
+ Temp = MultU64x32 (Duration, 1000);
+ return DivU64x32 (Temp, TimerInfo.Frequency);
+}
+
+/**
+ Get index of Measurement Record's match in the CumData array.
+
+ If the Measurement's Token value matches a Token in one of the CumData
+ records, the index of the matching record is returned. The returned
+ index is a signed value so that negative values can indicate that
+ the Measurement didn't match any entry in the CumData array.
+
+ @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
+
+ @retval <0 Token is not in the CumData array.
+ @retval >=0 Return value is the index into CumData where Token is found.
+**/
+INTN
+GetCumulativeItem(
+ IN MEASUREMENT_RECORD *Measurement
+ )
+{
+ INTN Index;
+
+ for( Index = 0; Index < (INTN)NumCum; ++Index) {
+ if (AsciiStrnCmp (Measurement->Token, CumData[Index].Name, PERF_TOKEN_LENGTH) == 0) {
+ return Index; // Exit, we found a match
+ }
+ }
+ // If the for loop exits, Token was not found.
+ return -1; // Indicate failure
+}
diff --git a/ShellPkg/Library/UefiDpLib/Literals.c b/ShellPkg/Library/UefiDpLib/Literals.c
new file mode 100644
index 000000000..68de0fbc9
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/Literals.c
@@ -0,0 +1,23 @@
+/** @file
+ Definitions of ASCII string literals used by DP.
+
+ Copyright (c) 2009 - 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 <PerformanceTokens.h>
+
+// ASCII String literals which probably don't need translation
+CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
+CHAR8 const ALit_SEC[] = SEC_TOK;
+CHAR8 const ALit_DXE[] = DXE_TOK;
+CHAR8 const ALit_SHELL[] = SHELL_TOK;
+CHAR8 const ALit_PEI[] = PEI_TOK;
+CHAR8 const ALit_BDS[] = BDS_TOK;
+CHAR8 const ALit_BdsTO[] = "BdsTimeOut";
+CHAR8 const ALit_PEIM[] = "PEIM";
diff --git a/ShellPkg/Library/UefiDpLib/Literals.h b/ShellPkg/Library/UefiDpLib/Literals.h
new file mode 100644
index 000000000..8aec09c02
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/Literals.h
@@ -0,0 +1,26 @@
+/** @file
+ Declarations of ASCII string literals used by DP.
+
+ Copyright (c) 2009 - 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 _LITERALS_H_
+#define _LITERALS_H_
+
+// ASCII String literals which probably don't need translation
+extern CHAR8 const ALit_TimerLibError[];
+extern CHAR8 const ALit_SEC[];
+extern CHAR8 const ALit_DXE[];
+extern CHAR8 const ALit_SHELL[];
+extern CHAR8 const ALit_PEI[];
+extern CHAR8 const ALit_BDS[];
+extern CHAR8 const ALit_BdsTO[];
+extern CHAR8 const ALit_PEIM[];
+
+#endif // _LITERALS_H_
diff --git a/ShellPkg/Library/UefiDpLib/Readme.txt b/ShellPkg/Library/UefiDpLib/Readme.txt
new file mode 100644
index 000000000..849efa436
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/Readme.txt
@@ -0,0 +1,2 @@
+from PerformancePkg\Dp_App
+SVN 13406
diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.c b/ShellPkg/Library/UefiDpLib/UefiDpLib.c
new file mode 100644
index 000000000..f3ecfeac7
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/UefiDpLib.c
@@ -0,0 +1,101 @@
+/** @file
+ Main file for NULL named library for install1 shell command functions.
+
+ Copyright (c) 2010 - 2013, 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.
+
+**/
+
+#include "UefiDpLib.h"
+
+STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
+EFI_HANDLE gDpHiiHandle = NULL;
+
+#define DP_HII_GUID \
+ { \
+ 0xeb832fd9, 0x9089, 0x4898, { 0x83, 0xc9, 0x41, 0x61, 0x8f, 0x5c, 0x48, 0xb9 } \
+ }
+
+EFI_GUID gDpHiiGuid = DP_HII_GUID;
+
+/**
+ Function to get the filename with help context if HII will not be used.
+
+ @return The filename with help text in it.
+**/
+CONST CHAR16*
+EFIAPI
+UefiDpLibGetManFileName (
+ VOID
+ )
+{
+ return (mFileName);
+}
+
+/**
+ Constructor for the Shell Level 1 Commands library.
+
+ Install the handlers for level 1 UEFI Shell 2.0 commands.
+
+ @param ImageHandle the image handle of the process
+ @param SystemTable the EFI System Table pointer
+
+ @retval EFI_SUCCESS the shell command handlers were installed sucessfully
+ @retval EFI_UNSUPPORTED the shell level required was not found.
+**/
+EFI_STATUS
+EFIAPI
+UefiDpLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // check our bit of the profiles mask
+ //
+ if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {
+ return (EFI_SUCCESS);
+ }
+
+ //
+ // 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.
+ //
+ gDpHiiHandle = HiiAddPackages (&gDpHiiGuid, gImageHandle, UefiDpLibStrings, NULL);
+ if (gDpHiiHandle == NULL) {
+ return (EFI_DEVICE_ERROR);
+ }
+
+ //
+ // install our shell command handlers that are always installed
+ //
+ ShellCommandRegisterCommandName(L"dp", ShellCommandRunDp , UefiDpLibGetManFileName, 0, L"", FALSE, gDpHiiHandle, STRING_TOKEN(STR_GET_HELP_DP));
+
+ return (EFI_SUCCESS);
+}
+
+/**
+ Destructor for the library. free any resources.
+
+ @param ImageHandle The image handle of the process.
+ @param SystemTable The EFI System Table pointer.
+**/
+EFI_STATUS
+EFIAPI
+UefiDpLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ if (gDpHiiHandle != NULL) {
+ HiiRemovePackages(gDpHiiHandle);
+ }
+ return (EFI_SUCCESS);
+}
diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.h b/ShellPkg/Library/UefiDpLib/UefiDpLib.h
new file mode 100644
index 000000000..2cec99148
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/UefiDpLib.h
@@ -0,0 +1,60 @@
+/** @file
+ Main file for NULL named library for dp command functions.
+
+ Copyright (c) 2010 - 2013, 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 _UEFI_DP_LIB_H_
+#define _UEFI_DP_LIB_H_
+
+#include <Uefi.h>
+#include <ShellBase.h>
+
+extern EFI_GUID gDpHiiGuid;
+
+#include <Protocol/EfiShell.h>
+#include <Protocol/EfiShellParameters.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/LoadedImage.h>
+#include <Protocol/UnicodeCollation.h>
+#include <Protocol/DevicePathToText.h>
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/ShellCommandLib.h>
+#include <Library/ShellLib.h>
+#include <Library/SortLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/HiiLib.h>
+#include <Library/FileHandleLib.h>
+
+extern EFI_HANDLE gDpHiiHandle;
+
+/**
+ Function for 'dp' command.
+
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).
+**/
+SHELL_STATUS
+EFIAPI
+ShellCommandRunDp (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+#endif
+
diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.inf b/ShellPkg/Library/UefiDpLib/UefiDpLib.inf
new file mode 100644
index 000000000..43de57dcf
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/UefiDpLib.inf
@@ -0,0 +1,75 @@
+## @file
+# Display Performance Application, Module information file.
+#
+# Copyright (c) 2009 - 2013, 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 = 0x00010006
+ BASE_NAME = UefiDpLib
+ FILE_GUID = 9DF262F7-CF81-4294-B5A5-B2E3CAFE5618
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER
+ CONSTRUCTOR = UefiDpLibConstructor
+ DESTRUCTOR = UefiDpLibDestructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ UefiDpLib.c
+ UefiDpLib.h
+ UefiDpLib.uni
+ Dp.c
+ Dp.h
+ Literals.h
+ Literals.c
+ DpInternal.h
+ DpUtilities.c
+ DpTrace.c
+ DpProfile.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ShellPkg/ShellPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ PerformancePkg/PerformancePkg.dec
+
+[LibraryClasses]
+ TimerLib
+ PerformanceLib
+ DxeServicesLib
+ MemoryAllocationLib
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ ShellCommandLib
+ ShellLib
+ UefiLib
+ UefiRuntimeServicesTableLib
+ UefiBootServicesTableLib
+ SortLib
+ PrintLib
+
+[Protocols]
+ gEfiLoadedImageProtocolGuid # ALWAYS_CONSUMED
+ gEfiDriverBindingProtocolGuid # SOMETIMES_CONSUMED
+ gEfiComponentName2ProtocolGuid # SOMETIMES_CONSUMED
+ gEfiLoadedImageDevicePathProtocolGuid # SOMETIMES_CONSUMED
+ gEfiDevicePathToTextProtocolGuid # SOMETIMES_CONSUMED
+
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize
+ gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED
diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.uni b/ShellPkg/Library/UefiDpLib/UefiDpLib.uni
new file mode 100644
index 000000000..fa29f9be4
--- /dev/null
+++ b/ShellPkg/Library/UefiDpLib/UefiDpLib.uni
Binary files differ
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
index 74beb093c..c0d3c920f 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
@@ -1,7 +1,7 @@
/** @file
Main file for attrib shell level 2 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -149,6 +149,9 @@ ShellCommandRunCd (
}
}
} else if (StrStr(Param1Copy, L":") == NULL) {
+ //
+ // change directory without a drive identifier
+ //
if (ShellGetCurrentDir(NULL) == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle);
ShellStatus = SHELL_NOT_FOUND;
@@ -189,7 +192,7 @@ ShellCommandRunCd (
}
} else {
//
- // change directory on other drive letter
+ // change directory with a drive letter
//
Drive = AllocateZeroPool(StrSize(Param1Copy));
if (Drive == NULL) {
@@ -199,7 +202,10 @@ ShellCommandRunCd (
Drive = StrCpy(Drive, Param1Copy);
Path = StrStr(Drive, L":");
ASSERT(Path != NULL);
- if (*(Path+1) == CHAR_NULL) {
+ if (EFI_ERROR(ShellIsDirectory(Param1Copy))) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, Param1Copy);
+ ShellStatus = SHELL_NOT_FOUND;
+ } else if (*(Path+1) == CHAR_NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle);
ShellStatus = SHELL_NOT_FOUND;
} else {
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
index 00b51b411..eb2b2cc5f 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
@@ -1,7 +1,7 @@
/** @file
Main file for cp shell level 2 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -13,6 +13,8 @@
**/
#include "UefiShellLevel2CommandsLib.h"
+#include <Guid/FileSystemInfo.h>
+#include <Guid/FileSystemVolumeLabelInfo.h>
/**
Function to take a list of files to copy and a destination location and do
@@ -62,24 +64,29 @@ CopySingleFile(
IN BOOLEAN SilentMode
)
{
- VOID *Response;
- UINTN ReadSize;
- SHELL_FILE_HANDLE SourceHandle;
- SHELL_FILE_HANDLE DestHandle;
- EFI_STATUS Status;
- VOID *Buffer;
- CHAR16 *TempName;
- UINTN Size;
- EFI_SHELL_FILE_INFO *List;
- SHELL_STATUS ShellStatus;
-
+ VOID *Response;
+ UINTN ReadSize;
+ SHELL_FILE_HANDLE SourceHandle;
+ SHELL_FILE_HANDLE DestHandle;
+ EFI_STATUS Status;
+ VOID *Buffer;
+ CHAR16 *TempName;
+ UINTN Size;
+ EFI_SHELL_FILE_INFO *List;
+ SHELL_STATUS ShellStatus;
+ UINT64 SourceFileSize;
+ UINT64 DestFileSize;
+ EFI_FILE_PROTOCOL *DestVolumeFP;
+ EFI_FILE_SYSTEM_INFO *DestVolumeInfo;
+ UINTN DestVolumeInfoSize;
ASSERT(Resp != NULL);
- SourceHandle = NULL;
- DestHandle = NULL;
- Response = *Resp;
- List = NULL;
+ SourceHandle = NULL;
+ DestHandle = NULL;
+ Response = *Resp;
+ List = NULL;
+ DestVolumeInfo = NULL;
ReadSize = PcdGet16(PcdShellFileOperationSize);
// Why bother copying a file to itself
@@ -143,43 +150,95 @@ CopySingleFile(
// Now copy all the files under the directory...
//
TempName = NULL;
- Size = 0;
+ Size = 0;
StrnCatGrow(&TempName, &Size, Source, 0);
StrnCatGrow(&TempName, &Size, L"\\*", 0);
- ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List);
- TempName = NULL;
- StrnCatGrow(&TempName, &Size, Dest, 0);
- StrnCatGrow(&TempName, &Size, L"\\", 0);
- ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp);
- ShellCloseFileMetaArg(&List);
- FreePool(TempName);
- Size = 0;
- } else {
- //
- // open file with create enabled
- //
- Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
- if (EFI_ERROR(Status)) {
- return (SHELL_ACCESS_DENIED);
+ if (TempName != NULL) {
+ ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List);
+ *TempName = CHAR_NULL;
+ StrnCatGrow(&TempName, &Size, Dest, 0);
+ StrnCatGrow(&TempName, &Size, L"\\", 0);
+ ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp);
+ ShellCloseFileMetaArg(&List);
+ SHELL_FREE_NON_NULL(TempName);
+ Size = 0;
}
+ } else {
+ //
+ // open file with create enabled
+ //
+ Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
+ if (EFI_ERROR(Status)) {
+ return (SHELL_ACCESS_DENIED);
+ }
- //
- // open source file
- //
- Status = ShellOpenFileByName(Source, &SourceHandle, EFI_FILE_MODE_READ, 0);
- ASSERT_EFI_ERROR(Status);
-
- //
- // copy data between files
- //
- Buffer = AllocateZeroPool(ReadSize);
- ASSERT(Buffer != NULL);
- while (ReadSize == PcdGet16(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {
- Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);
+ //
+ // open source file
+ //
+ Status = ShellOpenFileByName(Source, &SourceHandle, EFI_FILE_MODE_READ, 0);
ASSERT_EFI_ERROR(Status);
- Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);
+
+ //
+ //get file size of source file and freespace available on destination volume
+ //
+ ShellGetFileSize(SourceHandle, &SourceFileSize);
+ ShellGetFileSize(DestHandle, &DestFileSize);
+
+ //
+ //if the destination file already exists then it will be replaced, meaning the sourcefile effectively needs less storage space
+ //
+ if(DestFileSize < SourceFileSize){
+ SourceFileSize -= DestFileSize;
+ } else {
+ SourceFileSize = 0;
+ }
+
+ //
+ //get the system volume info to check the free space
+ //
+ DestVolumeFP = ConvertShellHandleToEfiFileProtocol(DestHandle);
+ DestVolumeInfo = NULL;
+ DestVolumeInfoSize = 0;
+ Status = DestVolumeFP->GetInfo(
+ DestVolumeFP,
+ &gEfiFileSystemInfoGuid,
+ &DestVolumeInfoSize,
+ DestVolumeInfo
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ DestVolumeInfo = AllocateZeroPool(DestVolumeInfoSize);
+ Status = DestVolumeFP->GetInfo(
+ DestVolumeFP,
+ &gEfiFileSystemInfoGuid,
+ &DestVolumeInfoSize,
+ DestVolumeInfo
+ );
+ }
+
+ //
+ //check if enough space available on destination drive to complete copy
+ //
+ if (DestVolumeInfo->FreeSpace < SourceFileSize) {
+ //
+ //not enough space on destination directory to copy file
+ //
+ SHELL_FREE_NON_NULL(DestVolumeInfo);
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_FAIL), gShellLevel2HiiHandle);
+ return(SHELL_VOLUME_FULL);
+ } else {
+ //
+ // copy data between files
+ //
+ Buffer = AllocateZeroPool(ReadSize);
+ ASSERT(Buffer != NULL);
+ while (ReadSize == PcdGet16(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {
+ Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);
+ Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);
+ }
+ }
+ SHELL_FREE_NON_NULL(DestVolumeInfo);
}
- }
//
// close files
@@ -272,7 +331,7 @@ ValidateAndCopyFiles(
for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
; !IsNull(&FileList->Link, &Node->Link)
; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
- ){
+ ){
//
// skip the directory traversing stuff...
//
@@ -324,7 +383,7 @@ ValidateAndCopyFiles(
for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
; !IsNull(&FileList->Link, &Node->Link)
; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
- ){
+ ){
if (ShellGetExecutionBreakFlag()) {
break;
}
@@ -340,7 +399,7 @@ ValidateAndCopyFiles(
if (FileList->Link.ForwardLink == FileList->Link.BackLink // 1 item
&& EFI_ERROR(ShellIsDirectory(DestDir)) // not an existing directory
- ) {
+ ) {
if (StrStr(DestDir, L":") == NULL) {
//
// simple copy of a single file
@@ -364,9 +423,9 @@ ValidateAndCopyFiles(
// Check for leading slash
//
if (DestDir[0] == L'\\') {
- //
- // Copy to the root of CWD
- //
+ //
+ // Copy to the root of CWD
+ //
StrCpy(DestPath, Cwd);
while (PathRemoveLastItem(DestPath));
StrCat(DestPath, DestDir+1);
@@ -409,7 +468,7 @@ ValidateAndCopyFiles(
if ( !EFI_ERROR(ShellIsDirectory(Node->FullName))
&& !EFI_ERROR(ShellIsDirectory(DestPath))
&& StrniCmp(Node->FullName, DestPath, StrLen(DestPath)) == NULL
- ){
+ ){
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_PARENT), gShellLevel2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
break;
@@ -422,7 +481,7 @@ ValidateAndCopyFiles(
if ((TempLocation = StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName))) == 0
&& (DestPath[StrLen(Node->FullName)] == CHAR_NULL || DestPath[StrLen(Node->FullName)] == L'\\')
- ) {
+ ) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
break;
@@ -452,6 +511,7 @@ ValidateAndCopyFiles(
}
return (ShellStatus);
+
}
/**
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
index c2020ca7f..08372d5ba 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
Binary files differ
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
index 7e9d039f1..c4acc0b49 100644
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
+++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
@@ -1,7 +1,7 @@
/** @file
Main file for Help shell level 3 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2009 - 2013, 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
@@ -48,9 +48,9 @@ ShellCommandRunHelp (
CHAR16 *SectionToGetHelpOn;
CHAR16 *HiiString;
BOOLEAN Found;
- BOOLEAN HelpPage;
+ BOOLEAN PrintCommandText;
- HelpPage = FALSE;
+ PrintCommandText = TRUE;
ProblemParam = NULL;
ShellStatus = SHELL_SUCCESS;
OutText = NULL;
@@ -111,7 +111,7 @@ ShellCommandRunHelp (
ASSERT(SectionToGetHelpOn == NULL);
StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0);
} else {
- HelpPage = TRUE;
+ PrintCommandText = FALSE;
ASSERT(SectionToGetHelpOn == NULL);
//
// Get the section name for the given command name
@@ -156,26 +156,13 @@ ShellCommandRunHelp (
//
// We have a command to look for help on.
//
- Status = gEfiShellProtocol->GetHelpText(Node->CommandString, SectionToGetHelpOn, &OutText);
- if (EFI_ERROR(Status) || OutText == NULL) {
- if (Status == EFI_DEVICE_ERROR) {
+ Status = ShellPrintHelp(Node->CommandString, SectionToGetHelpOn, PrintCommandText);
+ if (Status == EFI_DEVICE_ERROR) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, Node->CommandString);
- } else {
+ } else if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, Node->CommandString);
- }
- ShellStatus = SHELL_NOT_FOUND;
} else {
- if (HelpPage) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_PAGE_COMMAND), gShellLevel3HiiHandle, OutText);
- } else {
- while (OutText[StrLen(OutText)-1] == L'\r' || OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') {
- OutText[StrLen(OutText)-1] = CHAR_NULL;
- }
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_COMMAND), gShellLevel3HiiHandle, Node->CommandString, OutText);
- }
- FreePool(OutText);
- OutText = NULL;
- Found = TRUE;
+ Found = TRUE;
}
}
}
@@ -183,30 +170,18 @@ ShellCommandRunHelp (
// Search the .man file for Shell applications (Shell external commands).
//
if (!Found) {
- Status = gEfiShellProtocol->GetHelpText (CommandToGetHelpOn, SectionToGetHelpOn, &OutText);
- if (EFI_ERROR(Status) || OutText == NULL) {
+ Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn, FALSE);
if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
+ } else if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
} else {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
- }
- ShellStatus = SHELL_NOT_FOUND;
- } else {
- while (OutText[StrLen (OutText) - 1] == L'\r' || OutText[StrLen (OutText) - 1] == L'\n' || OutText[StrLen (OutText) - 1] == L' ') {
- OutText[StrLen (OutText)-1] = CHAR_NULL;
- }
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_COMMAND), gShellLevel3HiiHandle, CommandToGetHelpOn, OutText);
- if (OutText != NULL) {
- FreePool (OutText);
- OutText = NULL;
+ Found = TRUE;
}
- Found = TRUE;
- }
}
}
- if (!Found && ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
+ if (!Found) {
ShellStatus = SHELL_NOT_FOUND;
}
@@ -216,6 +191,14 @@ ShellCommandRunHelp (
ShellCommandLineFreeVarList (Package);
}
}
+
+ if (CommandToGetHelpOn != NULL && StrCmp(CommandToGetHelpOn, L"*") == 0){
+ //
+ // If '*' then the command entered was 'Help' without qualifiers, This footer
+ // provides additional info on help switches
+ //
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle);
+ }
if (CommandToGetHelpOn != NULL) {
FreePool(CommandToGetHelpOn);
}
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
index bf5714c9a..55b280609 100644
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
Binary files differ
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 103ddfbd5..6b985ed64 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -1,7 +1,7 @@
/** @file
Provides interface to shell functionality for shell commands and applications.
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -4059,3 +4059,108 @@ ShellFileHandleReadLine(
return (Status);
}
+
+/**
+ Function to print help file / man page content in the spec from the UEFI Shell protocol GetHelpText function.
+
+ @param[in] CommandToGetHelpOn Pointer to a string containing the command name of help file to be printed.
+ @param[in] SectionToGetHelpOn Pointer to the section specifier(s).
+ @param[in] PrintCommandText If TRUE, prints the command followed by the help content, otherwise prints
+ the help content only.
+ @retval EFI_DEVICE_ERROR The help data format was incorrect.
+ @retval EFI_NOT_FOUND The help data could not be found.
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+EFIAPI
+ShellPrintHelp (
+ IN CONST CHAR16 *CommandToGetHelpOn,
+ IN CONST CHAR16 *SectionToGetHelpOn,
+ IN BOOLEAN PrintCommandText
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 *OutText;
+
+ OutText = NULL;
+
+ //
+ // Get the string to print based
+ //
+ Status = gEfiShellProtocol->GetHelpText (CommandToGetHelpOn, SectionToGetHelpOn, &OutText);
+
+ //
+ // make sure we got a valid string
+ //
+ if (EFI_ERROR(Status)){
+ return Status;
+ }
+ if (OutText == NULL || StrLen(OutText) == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // Chop off trailing stuff we dont need
+ //
+ while (OutText[StrLen(OutText)-1] == L'\r' || OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') {
+ OutText[StrLen(OutText)-1] = CHAR_NULL;
+ }
+
+ //
+ // Print this out to the console
+ //
+ if (PrintCommandText) {
+ ShellPrintEx(-1, -1, L"%H%-14s%N- %s\r\n", CommandToGetHelpOn, OutText);
+ } else {
+ ShellPrintEx(-1, -1, L"%N%s\r\n", OutText);
+ }
+
+ SHELL_FREE_NON_NULL(OutText);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to delete a file by name
+
+ @param[in] FileName Pointer to file name to delete.
+
+ @retval EFI_SUCCESS the file was deleted sucessfully
+ @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not
+ deleted
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
+ @retval EFI_NOT_FOUND The specified file could not be found on the
+ device or the file system could not be found
+ on the device.
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ medium is no longer supported.
+ @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
+ file.
+ @retval other The file failed to open
+**/
+EFI_STATUS
+EFIAPI
+ShellDeleteFileByName(
+ IN CONST CHAR16 *FileName
+ )
+{
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE FileHandle;
+
+ Status = ShellFileExists(FileName);
+
+ if (Status == EFI_SUCCESS){
+ Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0x0);
+ if (Status == EFI_SUCCESS){
+ Status = ShellDeleteFile(&FileHandle);
+ }
+ }
+
+ return(Status);
+
+}
diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index 6b641155f..f22986bf4 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -1,7 +1,7 @@
## @file
# Shell Package
#
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2013, 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
@@ -64,7 +64,7 @@
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|16000
!ifdef $(NO_SHELL_PROFILES)
gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask|0x00
-!endif
+!endif #$(NO_SHELL_PROFILES)
[Components]
ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
@@ -73,6 +73,13 @@
ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+ ShellPkg/Library/UefiDpLib/UefiDpLib.inf {
+ <LibraryClasses>
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ }
+
ShellPkg/Application/Shell/Shell.inf {
<LibraryClasses>
NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
@@ -83,6 +90,9 @@
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
-!endif
+!ifdef $(INCLUDE_DP)
+ NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
+!endif #$(INCLUDE_DP)
+!endif #$(NO_SHELL_PROFILES)
}
diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index 3d9c36428..f4fc2d718 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -43,7 +43,7 @@
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
TimerLib|UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/SecPeiDxeTimerLibUefiCpu.inf
- ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
+ ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseResetSystemLibNull.inf
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
diff --git a/StdLib/BsdSocketLib/socket.c b/StdLib/BsdSocketLib/socket.c
index 4f49777b5..6b00f41f4 100644
--- a/StdLib/BsdSocketLib/socket.c
+++ b/StdLib/BsdSocketLib/socket.c
@@ -146,7 +146,7 @@ BslSocketProtocolToFd (
pDescriptor->f_flag = 0;
pDescriptor->f_iflags = DTYPE_SOCKET;
pDescriptor->MyFD = (UINT16)FileDescriptor;
- pDescriptor->Oflags = 0;
+ pDescriptor->Oflags = O_RDWR;
pDescriptor->Omode = S_ACC_READ | S_ACC_WRITE;
pDescriptor->RefCount = 1;
FILE_SET_MATURE ( pDescriptor );
diff --git a/StdLib/EfiSocketLib/Socket.h b/StdLib/EfiSocketLib/Socket.h
index 43a7084f9..b38bec6bd 100644
--- a/StdLib/EfiSocketLib/Socket.h
+++ b/StdLib/EfiSocketLib/Socket.h
@@ -33,9 +33,9 @@
#define DEBUG_OPTION 0x00080000 ///< Display option messages
#define MAX_PENDING_CONNECTIONS 1 ///< Maximum connection FIFO depth
-#define MAX_RX_DATA 65536 ///< Maximum receive data size
+#define MAX_RX_DATA 0x01000000 ///< Maximum receive data size
#define MAX_TX_DATA ( MAX_RX_DATA * 2 ) ///< Maximum buffered transmit data in bytes
-#define RX_PACKET_DATA 16384 ///< Maximum number of bytes in a RX packet
+#define RX_PACKET_DATA 0x00100000 ///< Maximum number of bytes in a RX packet
#define MAX_UDP_RETRANSMIT 16 ///< UDP retransmit attempts to handle address not mapped
#define ESL_STRUCTURE_ALIGNMENT_BYTES 15 ///< Number of bytes for structure alignment
@@ -362,7 +362,7 @@ typedef struct {
**/
typedef
EFI_STATUS
-(* PFN_NET_CONFIGURE) (
+(EFIAPI * PFN_NET_CONFIGURE) (
IN VOID * pProtocol,
IN VOID * pConfigData
);
@@ -378,7 +378,7 @@ EFI_STATUS
**/
typedef
EFI_STATUS
-(* PFN_NET_IO_START) (
+(EFIAPI * PFN_NET_IO_START) (
IN VOID * pProtocol,
IN VOID * pToken
);
@@ -394,7 +394,7 @@ EFI_STATUS
**/
typedef
EFI_STATUS
-(* PFN_NET_POLL) (
+(EFIAPI * PFN_NET_POLL) (
IN VOID * pProtocol
);
diff --git a/StdLib/EfiSocketLib/Udp4.c b/StdLib/EfiSocketLib/Udp4.c
index 414e3fe32..11b7db761 100644
--- a/StdLib/EfiSocketLib/Udp4.c
+++ b/StdLib/EfiSocketLib/Udp4.c
@@ -266,7 +266,7 @@ EslUdp4PortAllocate (
pConfig->AcceptBroadcast = FALSE;
pConfig->AcceptPromiscuous = FALSE;
pConfig->AllowDuplicatePort = TRUE;
- pConfig->DoNotFragment = TRUE;
+ pConfig->DoNotFragment = FALSE;
Status = EFI_SUCCESS;
//
diff --git a/StdLib/ISSUES.txt b/StdLib/ISSUES.txt
index f2b695e47..25317f7a6 100644
--- a/StdLib/ISSUES.txt
+++ b/StdLib/ISSUES.txt
@@ -14,16 +14,17 @@ StdLib Issues
=============
Category TOOLs Reported Status
------------------------ -------- -------------- -----------
-1: Compilation Error vs2010 2012 Understood
+1: Compilation Error vs2010 2012 Fixed 3/2013
stdlib\libc\gdtoa\strtod.c(825) : warning C4789: destination of memory copy is too small
+ runtime crashes when using floating-point formats with printf
2: Compilation Error ALL 2012 Fixed 1/2012
StdLib/LibC/Uefi/SysCalls.c: In function 'utimes': error: 'va_start' used in function with fixed args
-3: Usage Clarification 2012 Understood/Document
+3: Usage Clarification 2012 Document
Clarify that the current StdLib may not be used for developing drivers.
-4: Execution/Compile errors 2012 Understood
+4: Execution/Compile errors 2012 Fixed 1/2013
Mismatch in use of EFIAPI between declaration and definition of some functions.
5: Error message Quality during execution 2012 Verified
@@ -48,6 +49,9 @@ StdLib Issues
If the Shell does not have a current volume or directory, file operations
may hang or fail.
+11: printf("-%ls-", L"test") will only print "--" 2013 Fixed 3/2013
+
+
PosixLib
=============
Category TOOLs Reported Status
diff --git a/StdLib/LibC/Locale/_wcstod.h b/StdLib/LibC/Locale/_wcstod.h
index 1e7c47f2c..4b0a83372 100644
--- a/StdLib/LibC/Locale/_wcstod.h
+++ b/StdLib/LibC/Locale/_wcstod.h
@@ -34,9 +34,9 @@
* function template for wcstof, wcstod, wcstold.
*
* parameters:
- * _FUNCNAME : function name
- * _RETURN_TYPE : return type
- * _STRTOD_FUNC : real conversion function
+ * _FUNCNAME : function name
+ * _RETURN_TYPE : return type
+ * _STRTOD_FUNC : real conversion function
*/
#ifndef __WCSTOD_H_
#define __WCSTOD_H_
@@ -54,73 +54,73 @@
_RETURN_TYPE
_FUNCNAME(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
{
- const wchar_t *src, *start;
- _RETURN_TYPE val;
- char *buf, *end;
- size_t bufsiz, len;
+ const wchar_t *src, *start;
+ _RETURN_TYPE val;
+ char *buf, *end;
+ size_t bufsiz, len;
- _DIAGASSERT(nptr != NULL);
- /* endptr may be null */
+ _DIAGASSERT(nptr != NULL);
+ /* endptr may be null */
- src = nptr;
- while (iswspace((wint_t)*src) != 0)
- ++src;
- if (*src == L'\0')
- goto no_convert;
+ src = nptr;
+ while (iswspace((wint_t)*src) != 0)
+ ++src;
+ if (*src == L'\0')
+ goto no_convert;
- /*
- * Convert the supplied numeric wide char. string to multibyte.
- *
- * We could attempt to find the end of the numeric portion of the
- * wide char. string to avoid converting unneeded characters but
- * choose not to bother; optimising the uncommon case where
- * the input string contains a lot of text after the number
- * duplicates a lot of strto{f,d,ld}()'s functionality and
- * slows down the most common cases.
- */
- start = src;
- len = wcstombs(NULL, src, 0);
- if (len == (size_t)-1)
- /* errno = EILSEQ */
- goto no_convert;
+ /*
+ * Convert the supplied numeric wide char. string to multibyte.
+ *
+ * We could attempt to find the end of the numeric portion of the
+ * wide char. string to avoid converting unneeded characters but
+ * choose not to bother; optimising the uncommon case where
+ * the input string contains a lot of text after the number
+ * duplicates a lot of strto{f,d,ld}()'s functionality and
+ * slows down the most common cases.
+ */
+ start = src;
+ len = wcstombs(NULL, src, 0);
+ if (len == (size_t)-1)
+ /* errno = EILSEQ */
+ goto no_convert;
- _DIAGASSERT(len > 0);
+ _DIAGASSERT(len > 0);
- bufsiz = len;
- buf = (void *)malloc(bufsiz + 1);
- if (buf == NULL)
- /* errno = ENOMEM */
- goto no_convert;
+ bufsiz = len;
+ buf = (void *)malloc(bufsiz + 1);
+ if (buf == NULL)
+ /* errno = ENOMEM */
+ goto no_convert;
- len = wcstombs(buf, src, bufsiz + 1);
+ len = wcstombs(buf, src, bufsiz + 1);
- _DIAGASSERT(len == bufsiz);
- _DIAGASSERT(buf[len] == '\0');
+ _DIAGASSERT(len == bufsiz);
+ _DIAGASSERT(buf[len] == '\0');
- /* Let strto{f,d,ld}() do most of the work for us. */
- val = _STRTOD_FUNC(buf, &end);
- if (buf == end) {
- free(buf);
- goto no_convert;
- }
+ /* Let strto{f,d,ld}() do most of the work for us. */
+ val = _STRTOD_FUNC(buf, &end);
+ if (buf == end) {
+ free(buf);
+ goto no_convert;
+ }
- /*
- * We only know where the number ended in the _multibyte_
- * representation of the string. If the caller wants to know
- * where it ended, count multibyte characters to find the
- * corresponding position in the wide char string.
- */
- if (endptr != NULL)
- /* XXX Assume each wide char is one byte. */
- *endptr = __UNCONST(start + (size_t)(end - buf));
+ /*
+ * We only know where the number ended in the _multibyte_
+ * representation of the string. If the caller wants to know
+ * where it ended, count multibyte characters to find the
+ * corresponding position in the wide char string.
+ */
+ if (endptr != NULL)
+ /* XXX Assume each wide char is one byte. */
+ *endptr = __UNCONST(start + (size_t)(end - buf));
- free(buf);
+ free(buf);
- return val;
+ return val;
no_convert:
- if (endptr != NULL)
- *endptr = __UNCONST(nptr);
- return 0;
+ if (endptr != NULL)
+ *endptr = __UNCONST(nptr);
+ return 0.0;
}
#endif /*__WCSTOD_H_*/
diff --git a/StdLib/LibC/Locale/multibyte_Utf8.c b/StdLib/LibC/Locale/multibyte_Utf8.c
index 36e2cb379..ec9b01265 100644
--- a/StdLib/LibC/Locale/multibyte_Utf8.c
+++ b/StdLib/LibC/Locale/multibyte_Utf8.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <wchar.h>
#include <sys/types.h>
+#include <limits.h>
typedef int ch_UCS4;
@@ -913,6 +914,9 @@ wcsrtombs(
return (0);
if (Dest == NULL) {
+ if(MaxBytes <= 0) {
+ MaxBytes = ASCII_STRING_MAX;
+ }
NumStored = EstimateWtoM(*Src, MaxBytes, NULL);
}
else {
diff --git a/StdLib/LibC/gdtoa/gdtoaimp.h b/StdLib/LibC/gdtoa/gdtoaimp.h
index 635a17754..3ba2cf8fb 100644
--- a/StdLib/LibC/gdtoa/gdtoaimp.h
+++ b/StdLib/LibC/gdtoa/gdtoaimp.h
@@ -283,8 +283,7 @@ extern "C" {
Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined.
#endif
-typedef union { double d; ULong L[2]; } U;
-//typedef union { double d; UINT32 L[2]; } U;
+typedef union { double d; UINT32 L[2]; } U;
#ifdef YES_ALIAS
#define dval(x) x
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm
index 1fa7cb870..2cc78db37 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm
@@ -1,5 +1,5 @@
;------------------------------------------------------------------------------ ;
-; Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2012 - 2013, 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
@@ -23,7 +23,7 @@
;
; CommonExceptionHandler()
;
-CommonExceptionHandler PROTO C
+externdef CommonExceptionHandler:near
EXTRN mErrorCodeFlag:DWORD ; Error code flags for exceptions