From c1589a2c24abbc026120e3b045f9045448f64b2d Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Mon, 1 Dec 2014 08:17:51 +0000 Subject: PerformancePkg: Update comments on TscTimerLib TscTimerLib is a sample implementation that depends on chipset ACPI timer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao Reviewed-by: Star Zeng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16457 6f19259b-4bc3-4df7-8a09-765794883524 --- PerformancePkg/Library/TscTimerLib/BaseTscTimerLib.inf | 6 +++++- PerformancePkg/Library/TscTimerLib/DxeTscTimerLib.inf | 6 +++++- PerformancePkg/Library/TscTimerLib/PeiTscTimerLib.inf | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/PerformancePkg/Library/TscTimerLib/BaseTscTimerLib.inf b/PerformancePkg/Library/TscTimerLib/BaseTscTimerLib.inf index 3d53b21db..daae8a258 100644 --- a/PerformancePkg/Library/TscTimerLib/BaseTscTimerLib.inf +++ b/PerformancePkg/Library/TscTimerLib/BaseTscTimerLib.inf @@ -4,6 +4,10 @@ # Note: There will be 1ms penalty to get TSC frequency every time # by waiting for 3579 clocks of the ACPI timer, or 1ms. # +# Note: This library is a sample implementation that depends on chipset ACPI timer. +# It may not work on new generation chipset. PcAtChipsetPkg AcpiTimerLib is +# the generic timer library that can replace this one. +# # A version of the Timer Library using the processor's TSC. # The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC. # The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states. @@ -11,7 +15,7 @@ # TSC reads are much more efficient and do not incur the overhead associated with a ring transition or # access to a platform resource. # -# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2014, 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 diff --git a/PerformancePkg/Library/TscTimerLib/DxeTscTimerLib.inf b/PerformancePkg/Library/TscTimerLib/DxeTscTimerLib.inf index 1de990401..e58aeac2e 100644 --- a/PerformancePkg/Library/TscTimerLib/DxeTscTimerLib.inf +++ b/PerformancePkg/Library/TscTimerLib/DxeTscTimerLib.inf @@ -1,6 +1,10 @@ ## @file # Dxe Timer Library which uses the Time Stamp Counter in the processor. # +# Note: This library is a sample implementation that depends on chipset ACPI timer. +# It may not work on new generation chipset. PcAtChipsetPkg AcpiTimerLib is +# the generic timer library that can replace this one. +# # A version of the Timer Library using the processor's TSC. # The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC. # The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states. @@ -8,7 +12,7 @@ # TSC reads are much more efficient and do not incur the overhead associated with a ring transition or # access to a platform resource. # -# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2014, 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 diff --git a/PerformancePkg/Library/TscTimerLib/PeiTscTimerLib.inf b/PerformancePkg/Library/TscTimerLib/PeiTscTimerLib.inf index c92127258..3f39d84e0 100644 --- a/PerformancePkg/Library/TscTimerLib/PeiTscTimerLib.inf +++ b/PerformancePkg/Library/TscTimerLib/PeiTscTimerLib.inf @@ -1,6 +1,10 @@ ## @file # Pei Timer Library which uses the Time Stamp Counter in the processor. # +# Note: This library is a sample implementation that depends on chipset ACPI timer. +# It may not work on new generation chipset. PcAtChipsetPkg AcpiTimerLib is +# the generic timer library that can replace this one. +# # A version of the Timer Library using the processor's TSC. # The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC. # The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states. @@ -8,7 +12,7 @@ # TSC reads are much more efficient and do not incur the overhead associated with a ring transition or # access to a platform resource. # -# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2014, 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 -- cgit v1.2.3 From edafa0bbe423d5d6129f4d18de176dfd73b6cfcf Mon Sep 17 00:00:00 2001 From: Yingke Liu Date: Mon, 1 Dec 2014 08:22:07 +0000 Subject: Enhance error handling for external tool. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yingke Liu Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16458 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/GenFds/GuidSection.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py index 0e5bb3b27..006cf0f21 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -159,6 +159,13 @@ class GuidSection(GuidSectionClassObject) : SecNum + \ '.tmp' TempFile = os.path.normpath(TempFile) + # + # Remove temp file if its time stamp is older than dummy file + # Just in case the external tool fails at this time but succeeded before + # Error should be reported if the external tool does not generate a new output based on new input + # + if os.path.exists(TempFile) and os.path.exists(DummyFile) and os.path.getmtime(TempFile) < os.path.getmtime(DummyFile): + os.remove(TempFile) FirstCall = False CmdOption = '-e' @@ -183,6 +190,12 @@ class GuidSection(GuidSectionClassObject) : FirstCall = False ReturnValue[0] = 0 GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption) + # + # There is external tool which does not follow standard rule which return nonzero if tool fails + # The output file has to be checked + # + if not os.path.exists(TempFile): + EdkLogger.error("GenFds", COMMAND_FAILURE, 'Fail to call %s, no output file was generated' % ExternalTool) FileHandleIn = open(DummyFile,'rb') FileHandleIn.seek(0,2) @@ -257,6 +270,7 @@ class GuidSection(GuidSectionClassObject) : ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary ToolPathTmp = None + ToolOption = None for ToolDef in ToolDefinition.items(): if self.NameGuid == ToolDef[1]: KeyList = ToolDef[0].split('_') -- cgit v1.2.3 From 2ba8cfb53aebee2de585033d0a0ac6586aa5d28b Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Tue, 5 Aug 2014 13:24:32 +0530 Subject: Create TexasInstrumentsPkg/BeagleBoneBlackPkg UEFI support for BeagleBoneBlack. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dec | 25 + .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 382 ++++++++++++ .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 336 ++++++++++ .../Drivers/InterruptDxe/HardwareInterrupt.c | 357 +++++++++++ .../Drivers/InterruptDxe/InterruptDxe.inf | 54 ++ .../BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c | 376 ++++++++++++ .../Drivers/TimerDxe/TimerDxe.inf | 56 ++ .../BeagleBoneBlackPkg/Include/Library/Am335x.h | 103 ++++ .../Include/Library/ArmPlatformLib.h | 166 +++++ .../Platform/ArmPlatformGlobalVariableLib.h | 38 ++ .../Include/Platform/ArmPlatformSecLib.h | 88 +++ .../Include/Platform/ArmPlatformSysConfigLib.h | 63 ++ .../Include/Platform/ArmTrustedMonitorLib.h | 24 + .../Include/Platform/LcdPlatformLib.h | 221 +++++++ .../Include/Platform/NorFlashPlatformLib.h | 37 ++ .../Library/Am335xLib/ArmPlatformHelper.S | 51 ++ .../Library/Am335xLib/ArmPlatformHelper.asm | 61 ++ .../Library/Am335xLib/ArmPlatformLibNull.c | 72 +++ .../Library/Am335xLib/ArmPlatformLibNull.inf | 49 ++ .../Library/Am335xLib/ArmPlatformLibNullMem.c | 82 +++ .../Library/Am335xLib/ArmPlatformLibNullSec.inf | 44 ++ .../Library/Am335xTimerLib/Am335xTimerLib.inf | 39 ++ .../Library/Am335xTimerLib/TimerLib.c | 110 ++++ .../AArch64/ArmTrustedMonitorLibNull.c | 24 + .../Arm/ArmTrustedMonitorLibNull.c | 38 ++ .../ArmTrustedMonitorLibNull/Arm/MonitorTable.S | 41 ++ .../ArmTrustedMonitorLibNull/Arm/MonitorTable.asm | 40 ++ .../ArmTrustedMonitorLibNull.inf | 40 ++ .../RealTimeClockLib/PL031RealTimeClockLib.c | 683 +++++++++++++++++++++ .../RealTimeClockLib/PL031RealTimeClockLib.inf | 46 ++ .../ResetSystemLib/BaseResetSystemLibNull.c | 79 +++ .../ResetSystemLib/BaseResetSystemLibNull.inf | 37 ++ .../Library/SerialPortLib/Am335xUart.h | 38 ++ .../Library/SerialPortLib/SerialPortLib.c | 230 +++++++ .../Library/SerialPortLib/SerialPortLib.inf | 42 ++ .../PrePeiCore/AArch64/ArchPrePeiCore.c | 52 ++ .../PrePeiCore/AArch64/Exception.S | 81 +++ .../BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S | 48 ++ .../PrePeiCore/AArch64/PrePeiCoreEntryPoint.S | 110 ++++ .../PrePeiCore/AArch64/SwitchStack.S | 43 ++ .../PrePeiCore/Arm/ArchPrePeiCore.c | 62 ++ .../BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S | 102 +++ .../PrePeiCore/Arm/Exception.asm | 91 +++ .../PrePeiCore/Arm/PrePeiCoreEntryPoint.S | 89 +++ .../PrePeiCore/Arm/PrePeiCoreEntryPoint.asm | 98 +++ .../PrePeiCore/Arm/SwitchStack.S | 43 ++ .../PrePeiCore/Arm/SwitchStack.asm | 38 ++ .../BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c | 151 +++++ .../BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c | 67 ++ .../BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c | 162 +++++ .../BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h | 83 +++ .../PrePeiCore/PrePeiCoreMPCore.inf | 82 +++ .../PrePeiCore/PrePeiCoreUniCore.inf | 77 +++ .../BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c | 33 + .../PrePi/AArch64/ModuleEntryPoint.S | 146 +++++ .../BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c | 29 + .../PrePi/Arm/ModuleEntryPoint.S | 155 +++++ .../PrePi/Arm/ModuleEntryPoint.asm | 158 +++++ .../BeagleBoneBlackPkg/PrePi/LzmaDecompress.h | 103 ++++ .../BeagleBoneBlackPkg/PrePi/MainMPCore.c | 99 +++ .../BeagleBoneBlackPkg/PrePi/MainUniCore.c | 44 ++ .../BeagleBoneBlackPkg/PrePi/PeiMPCore.inf | 115 ++++ .../BeagleBoneBlackPkg/PrePi/PeiUniCore.inf | 108 ++++ .../BeagleBoneBlackPkg/PrePi/PrePi.c | 259 ++++++++ .../BeagleBoneBlackPkg/PrePi/PrePi.h | 90 +++ TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c | 25 + .../BeagleBoneBlackPkg/Sec/Helper.S | 84 +++ .../BeagleBoneBlackPkg/Sec/Helper.asm | 79 +++ TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c | 125 ++++ TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf | 78 +++ .../BeagleBoneBlackPkg/Sec/SecEntryPoint.S | 44 ++ .../BeagleBoneBlackPkg/Sec/SecEntryPoint.asm | 126 ++++ .../BeagleBoneBlackPkg/Sec/SecInternal.h | 83 +++ 73 files changed, 7634 insertions(+) create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/Am335xUart.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec new file mode 100644 index 000000000..2da4d9a20 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec @@ -0,0 +1,25 @@ +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = BeagleBoneBlackPkg + PACKAGE_GUID = 6eba6648-d853-4eb3-9761-528b82d5ab04 + PACKAGE_VERSION = 0.1 + +################################################################################ +# +# Include Section - list of Include Paths that are provided by this package. +# Comments are used for Keywords and Module Types. +# +# Supported Module Types: +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION +# +################################################################################ + +[Includes] + Include # Root include for the package + +[Ppis] + +[Protocols] + +[Guids] + gBeagleBoneBlackTokenSpaceGuid = { 0x6834fe45, 0x4aee, 0x4fc6, { 0xbc, 0xb5, 0xff, 0x45, 0xb7, 0xa8, 0x71, 0xe2 } } \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc new file mode 100644 index 000000000..9325176c4 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -0,0 +1,382 @@ +# +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + PLATFORM_NAME = BeagleBoneBlack + PLATFORM_GUID = 613adb4b-ae3e-4797-9f29-719b833b82f4 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010016 + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES = ARM|AARCH64 + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf + +[LibraryClasses.common] + ArmPlatformLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf + +!if $(TARGET) == RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf +# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf +!endif + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + + # + # Assume everything is fixed at build + # + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + + # 1/123 faster than Stm or Vstm version + #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf + + # ARM Architectural Libraries + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf + CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf + DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + + SerialPortLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf + TimerLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf + EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf + RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf + + # Networking Requirements for ArmPlatformPkg/Bds + NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf + + # EBL Related Libraries + EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf + EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf + EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf + EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf + + # + # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window + # in the debugger will show load and unload commands for symbols. You can cut and paste this + # into the command window to load symbols. We should be able to use a script to do this, but + # the version of RVD I have does not support scripts accessing system memory. + # + #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf + #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf + + SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf + + # BDS Libraries + BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + +[LibraryClasses.ARM] + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf + ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Lib.inf + +[LibraryClasses.AARCH64] + ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf + ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf + +[LibraryClasses.common.SEC] + ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf + + ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf + DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf + + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + +[LibraryClasses.ARM] + # + # It is not possible to prevent the ARM compiler for generic intrinsic functions. + # This library provides the instrinsic functions generate by a given compiler. + # [LibraryClasses.ARM] and NULL mean link this library into all ARM images. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + +[BuildOptions] + XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7 + + GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a + + RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8 + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsFeatureFlag.common] + gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE + + # + # Control what commands are supported from the UI + # Turn these on and off to add features or save size + # + gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE + gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE + + gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE + + # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + +[PcdsFixedAtBuild.common] + gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM BeagleBoneBlack" + + gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BBB" + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + + # DEBUG_ASSERT_ENABLED 0x01 + # DEBUG_PRINT_ENABLED 0x02 + # DEBUG_CODE_ENABLED 0x04 + # CLEAR_MEMORY_ENABLED 0x08 + # ASSERT_BREAKPOINT_ENABLED 0x10 + # ASSERT_DEADLOOP_ENABLED 0x20 +!if $(TARGET) == RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f +!endif + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free's + # DEBUG_PAGE 0x00000020 // Alloc & Free's + # DEBUG_INFO 0x00000040 // Verbose + # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNI Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // UNDI Driver + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|"" + gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07 + gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragements for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + # + # DMTIMER0 + # + + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|3125 + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|32000 + + # + # ARM Pcds + # + gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000 + + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4030B800 + gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize|0x4 + + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 + gArmTokenSpaceGuid.PcdSystemMemorySize|0x40000000 + + # Size of the region used by UEFI in permanent memory (Reserved 16MB) + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x01000000 +################################################################################ +# +# Components Section - list of all EDK II Modules needed by this Platform +# +################################################################################ +[Components.common] + + # + # PEI Phase modules + # + TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf + + # + # DXE + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + + TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf + TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + # Simple TextIn/TextOut for UEFI Terminal + EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # + # Semi-hosting filesystem + # + ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + + # + # Application + # + EmbeddedPkg/Ebl/Ebl.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + ArmPlatformPkg/Bds/Bds.inf + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf new file mode 100644 index 000000000..244d474e7 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf @@ -0,0 +1,336 @@ +# +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +################################################################################ +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +################################################################################ + +[FD.BeagleBoneBlack_EFI] +BaseAddress = 0x80800000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash. +Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device +ErasePolarity = 1 + +# This one is tricky, it must be: BlockSize * NumBlocks = Size +BlockSize = 0x00001000 +NumBlocks = 0x0200 + +################################################################################ +# +# Following are lists of FD Region layout which correspond to the locations of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by +# the pipe "|" character, followed by the size of the region, also in hex with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType +# +################################################################################ + +#0x00000000|0x00050000 +#gArmTokenSpaceGuid.PcdSecureFvBaseAddress|gArmTokenSpaceGuid.PcdSecureFvSize +#FV = FVMAIN_COMPACT + +0x00000000|0x000F0000 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV = FVMAIN_COMPACT + +#0x00050000|0x000F0000 +#gArmTokenSpaceGuid.PcdDxeFvBaseAddress|gArmTokenSpaceGuid.PcdDxeFvSize +#FV = FVMAIN_COMPRESSED + + +################################################################################ +# +# FV Section +# +# [FV] section is used to define what components or modules are placed within a flash +# device file. This section also defines order the components and modules are positioned +# within the image. The [FV] section consists of define statements, set statements and +# module statements. +# +################################################################################ + +#[FV.FVMAIN_SEC] +#FvAlignment = 8 +#ERASE_POLARITY = 1 +#MEMORY_MAPPED = TRUE +#STICKY_WRITE = TRUE +#LOCK_CAP = TRUE +#LOCK_STATUS = TRUE +#WRITE_DISABLED_CAP = TRUE +#WRITE_ENABLED_CAP = TRUE +#WRITE_STATUS = TRUE +#WRITE_LOCK_CAP = TRUE +#WRITE_LOCK_STATUS = TRUE +#READ_DISABLED_CAP = TRUE +#READ_ENABLED_CAP = TRUE +#READ_STATUS = TRUE +#READ_LOCK_CAP = TRUE +#READ_LOCK_STATUS = TRUE + #INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf + #INF ArmPlatformPkg/PrePi/PeiUniCore.inf + + +[FV.FvMain] +BlockSize = 0x1000 +NumBlocks = 0xC0 # This FV gets compressed so make it just big enough +FvAlignment = 8 # FV alignment and FV attributes setting. +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + + INF MdeModulePkg/Core/Dxe/DxeMain.inf + + # + # PI DXE Drivers producing Architectural Protocols (EFI Services) + # + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + # Simple TextIn/TextOut for UEFI Terminal + INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # Semi-hosting filesystem (Required the Hardware Debugger to be connected) + # + INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatBinPkg/EnhancedFatDxe/Fat.inf + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + + # + # UEFI application (Shell Embedded Boot Loader) + # + INF EmbeddedPkg/Ebl/Ebl.inf + #INF ShellBinPkg/UefiShell/UefiShell.inf + + # + # Bds + # + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF ArmPlatformPkg/Bds/Bds.inf + +[FV.FVMAIN_COMPACT] +FvAlignment = 8 +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf +# INF MdeModulePkg/Core/Pei/PeiMain.inf +# INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf +# INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf +# INF ArmPkg/Drivers/CpuPei/CpuPei.inf +# INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf +# INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf +# INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf +# INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + + FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { + SECTION FV_IMAGE = FVMAIN + } + } + +#[FV.FVMAIN_COMPRESSED] +#FvAlignment = 8 +#ERASE_POLARITY = 1 +#MEMORY_MAPPED = TRUE +#STICKY_WRITE = TRUE +#LOCK_CAP = TRUE +#LOCK_STATUS = TRUE +#WRITE_DISABLED_CAP = TRUE +#WRITE_ENABLED_CAP = TRUE +#WRITE_STATUS = TRUE +#WRITE_LOCK_CAP = TRUE +#WRITE_LOCK_STATUS = TRUE +#READ_DISABLED_CAP = TRUE +#READ_ENABLED_CAP = TRUE +#READ_STATUS = TRUE +#READ_LOCK_CAP = TRUE +#READ_LOCK_STATUS = TRUE + + +# INF MdeModulePkg/Core/Pei/PeiMain.inf +# INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf +# INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf +# INF ArmPkg/Drivers/CpuPei/CpuPei.inf +# INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf +# INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf +# INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf +# INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + +# FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { +# SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { +# SECTION FV_IMAGE = FVMAIN +# } +# } + +################################################################################ +# +# Rules are use with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are the default +# rules for the different module type. User can add the customized rules to define the +# content of the FFS file. +# +################################################################################ + + +############################################################################ +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section # +############################################################################ +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER = $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING="$(MODULE_NAME)" Optional +# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) +# } +# } +# } +# +############################################################################ + +[Rule.Common.SEC] + FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED { + TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.SEC.BINARY] + FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED { + TE TE Align = 32 |.efi + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE = $(NAMED_GUID) { + TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING ="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM] + FILE PEIM = $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.TIANOCOMPRESSED] + FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE = $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } +[Rule.Common.DXE_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION = $(NAMED_GUID) { + UI STRING ="$(MODULE_NAME)" Optional + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c new file mode 100644 index 000000000..087c3c48d --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c @@ -0,0 +1,357 @@ +/** @file + Handle AM335X interrupt controller + + Copyright (c) 2008 - 2010, Apple Inc. 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +// +// Notifications +// +EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL; + + +HARDWARE_INTERRUPT_HANDLER gRegisteredInterruptHandlers[INT_NROF_VECTORS]; + +/** + Shutdown our hardware + + DXE Core will disable interrupts and turn off the timer and disable interrupts + after all the event handlers have run. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +ExitBootServicesEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // Disable all interrupts + MmioWrite32 (INTCPS_MIR(0), 0xFFFFFFFF); + MmioWrite32 (INTCPS_MIR(1), 0xFFFFFFFF); + MmioWrite32 (INTCPS_MIR(2), 0xFFFFFFFF); + MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); + + // Add code here to disable all FIQs as debugger may have turned one on +} + +/** + Register Handler for the specified interrupt source. + + @param This Instance pointer for this protocol + @param Source Hardware source of the interrupt + @param Handler Callback for interrupt. NULL to unregister + + @retval EFI_SUCCESS Source was updated to support Handler. + @retval EFI_DEVICE_ERROR Hardware could not be programmed. + +**/ +EFI_STATUS +EFIAPI +RegisterInterruptSource ( + IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, + IN HARDWARE_INTERRUPT_SOURCE Source, + IN HARDWARE_INTERRUPT_HANDLER Handler + ) +{ + if (Source > MAX_VECTOR) { + ASSERT(FALSE); + return EFI_UNSUPPORTED; + } + + if ((MmioRead32 (INTCPS_ILR(Source)) & INTCPS_ILR_FIQ) == INTCPS_ILR_FIQ) { + // This vector has been programmed as FIQ so we can't use it for IRQ + // EFI does not use FIQ, but the debugger can use it to check for + // ctrl-c. So this ASSERT means you have a conflict with the debug agent + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } + + if ((Handler == NULL) && (gRegisteredInterruptHandlers[Source] == NULL)) { + return EFI_INVALID_PARAMETER; + } + + if ((Handler != NULL) && (gRegisteredInterruptHandlers[Source] != NULL)) { + return EFI_ALREADY_STARTED; + } + + gRegisteredInterruptHandlers[Source] = Handler; + return This->EnableInterruptSource(This, Source); +} + + +/** + Enable interrupt source Source. + + @param This Instance pointer for this protocol + @param Source Hardware source of the interrupt + + @retval EFI_SUCCESS Source interrupt enabled. + @retval EFI_DEVICE_ERROR Hardware could not be programmed. + +**/ +EFI_STATUS +EFIAPI +EnableInterruptSource ( + IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, + IN HARDWARE_INTERRUPT_SOURCE Source + ) +{ + UINTN Bank; + UINTN Bit; + + if (Source > MAX_VECTOR) { + ASSERT(FALSE); + return EFI_UNSUPPORTED; + } + + Bank = Source / 32; + Bit = 1UL << (Source % 32); + + MmioWrite32 (INTCPS_MIR_CLEAR(Bank), Bit); + + return EFI_SUCCESS; +} + + +/** + Disable interrupt source Source. + + @param This Instance pointer for this protocol + @param Source Hardware source of the interrupt + + @retval EFI_SUCCESS Source interrupt disabled. + @retval EFI_DEVICE_ERROR Hardware could not be programmed. + +**/ +EFI_STATUS +EFIAPI +DisableInterruptSource ( + IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, + IN HARDWARE_INTERRUPT_SOURCE Source + ) +{ + UINTN Bank; + UINTN Bit; + + if (Source > MAX_VECTOR) { + ASSERT(FALSE); + return EFI_UNSUPPORTED; + } + + Bank = Source / 32; + Bit = 1UL << (Source % 32); + + MmioWrite32 (INTCPS_MIR_SET(Bank), Bit); + + return EFI_SUCCESS; +} + + + +/** + Return current state of interrupt source Source. + + @param This Instance pointer for this protocol + @param Source Hardware source of the interrupt + @param InterruptState TRUE: source enabled, FALSE: source disabled. + + @retval EFI_SUCCESS InterruptState is valid + @retval EFI_DEVICE_ERROR InterruptState is not valid + +**/ +EFI_STATUS +EFIAPI +GetInterruptSourceState ( + IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, + IN HARDWARE_INTERRUPT_SOURCE Source, + IN BOOLEAN *InterruptState + ) +{ + UINTN Bank; + UINTN Bit; + + if (InterruptState == NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Source > MAX_VECTOR) { + ASSERT(FALSE); + return EFI_UNSUPPORTED; + } + + Bank = Source / 32; + Bit = 1UL << (Source % 32); + + if ((MmioRead32(INTCPS_MIR(Bank)) & Bit) == Bit) { + *InterruptState = FALSE; + } else { + *InterruptState = TRUE; + } + + return EFI_SUCCESS; +} + +/** + Signal to the hardware that the End Of Intrrupt state + has been reached. + + @param This Instance pointer for this protocol + @param Source Hardware source of the interrupt + + @retval EFI_SUCCESS Source interrupt EOI'ed. + @retval EFI_DEVICE_ERROR Hardware could not be programmed. + +**/ +EFI_STATUS +EFIAPI +EndOfInterrupt ( + IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, + IN HARDWARE_INTERRUPT_SOURCE Source + ) +{ + MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); + ArmDataSyncronizationBarrier (); + return EFI_SUCCESS; +} + + +/** + EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs. + + @param InterruptType Defines the type of interrupt or exception that + occurred on the processor.This parameter is processor architecture specific. + @param SystemContext A pointer to the processor context when + the interrupt occurred on the processor. + + @return None + +**/ +VOID +EFIAPI +IrqInterruptHandler ( + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_SYSTEM_CONTEXT SystemContext + ) +{ + UINT32 Vector; + HARDWARE_INTERRUPT_HANDLER InterruptHandler; + + Vector = MmioRead32 (INTCPS_SIR_IRQ) & INTCPS_SIR_IRQ_MASK; + + // Needed to prevent infinite nesting when Time Driver lowers TPL + MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); + ArmDataSyncronizationBarrier (); + + InterruptHandler = gRegisteredInterruptHandlers[Vector]; + if (InterruptHandler != NULL) { + // Call the registered interrupt handler. + InterruptHandler (Vector, SystemContext); + } + + // Needed to clear after running the handler + MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); + ArmDataSyncronizationBarrier (); +} + +// +// Making this global saves a few bytes in image size +// +EFI_HANDLE gHardwareInterruptHandle = NULL; + +// +// The protocol instance produced by this driver +// +EFI_HARDWARE_INTERRUPT_PROTOCOL gHardwareInterruptProtocol = { + RegisterInterruptSource, + EnableInterruptSource, + DisableInterruptSource, + GetInterruptSourceState, + EndOfInterrupt +}; + +/** + Initialize the state information for the CPU Architectural Protocol + + @param ImageHandle of the loaded driver + @param SystemTable Pointer to the System Table + + @retval EFI_SUCCESS Protocol registered + @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure + @retval EFI_DEVICE_ERROR Hardware problems + +**/ +EFI_STATUS +InterruptDxeInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_CPU_ARCH_PROTOCOL *Cpu; + + // Make sure the Interrupt Controller Protocol is not already installed in the system. + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid); + + // Make sure all interrupts are disabled by default. + MmioWrite32 (INTCPS_MIR(0), 0xFFFFFFFF); + MmioWrite32 (INTCPS_MIR(1), 0xFFFFFFFF); + MmioWrite32 (INTCPS_MIR(2), 0xFFFFFFFF); + MmioOr32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); + + Status = gBS->InstallMultipleProtocolInterfaces(&gHardwareInterruptHandle, + &gHardwareInterruptProtocolGuid, &gHardwareInterruptProtocol, + NULL); + ASSERT_EFI_ERROR(Status); + + // + // Get the CPU protocol that this driver requires. + // + Status = gBS->LocateProtocol(&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu); + ASSERT_EFI_ERROR(Status); + + // + // Unregister the default exception handler. + // + Status = Cpu->RegisterInterruptHandler(Cpu, EXCEPT_ARM_IRQ, NULL); + ASSERT_EFI_ERROR(Status); + + // + // Register to receive interrupts + // + Status = Cpu->RegisterInterruptHandler(Cpu, EXCEPT_ARM_IRQ, IrqInterruptHandler); + ASSERT_EFI_ERROR(Status); + + // Register for an ExitBootServicesEvent + Status = gBS->CreateEvent(EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent); + ASSERT_EFI_ERROR(Status); + + return Status; +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf new file mode 100644 index 000000000..2ed74575d --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf @@ -0,0 +1,54 @@ +#/** @file +# +# Interrupt DXE driver +# +# Copyright (c) 2008 - 2010, Apple Inc. 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 = BeagleBoneBlackInterruptDxe + FILE_GUID = 23eed05d-1b93-4a1a-8e1b-931d69e37952 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = InterruptDxeInitialize + + +[Sources.common] + HardwareInterrupt.c + + +[Packages] + ArmPkg/ArmPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + BaseLib + UefiLib + UefiBootServicesTableLib + DebugLib + PrintLib + UefiDriverEntryPoint + IoLib + ArmLib + +[Protocols] + gHardwareInterruptProtocolGuid + gEfiCpuArchProtocolGuid + +[FixedPcd.common] + gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress + +[Depex] + gEfiCpuArchProtocolGuid diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c new file mode 100644 index 000000000..c9476b3ac --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c @@ -0,0 +1,376 @@ +/** @file + Template for Timer Architecture Protocol driver of the ARM flavor + + Copyright (c) 2008 - 2009, Apple Inc. 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +// The notification function to call on every timer interrupt. +volatile EFI_TIMER_NOTIFY mTimerNotifyFunction = (EFI_TIMER_NOTIFY)NULL; + + +// The current period of the timer interrupt +volatile UINT64 mTimerPeriod = 0; + +// Cached copy of the Hardware Interrupt protocol instance +EFI_HARDWARE_INTERRUPT_PROTOCOL *gInterrupt = NULL; + +// Cached registers +volatile UINT32 TISR; +volatile UINT32 TCLR; +volatile UINT32 TLDR; +volatile UINT32 TCRR; +volatile UINT32 TIER; + +// Cached interrupt vector +volatile UINTN gVector; + + +/** + + C Interrupt Handler calledin the interrupt context when Source interrupt is active. + + + @param Source Source of the interrupt. Hardware routing off a specific platform defines + what source means. + + @param SystemContext Pointer to system register context. Mostly used by debuggers and will + update the system context after the return from the interrupt if + modified. Don't change these values unless you know what you are doing + +**/ +VOID +EFIAPI +TimerInterruptHandler ( + IN HARDWARE_INTERRUPT_SOURCE Source, + IN EFI_SYSTEM_CONTEXT SystemContext + ) +{ + EFI_TPL OriginalTPL; + + + + // + // DXE core uses this callback for the EFI timer tick. The DXE core uses locks + // that raise to TPL_HIGH and then restore back to current level. Thus we need + // to make sure TPL level is set to TPL_HIGH while we are handling the timer tick. + // + OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL); + + if (mTimerNotifyFunction) { + mTimerNotifyFunction(mTimerPeriod); + } + + // Clear all timer interrupts + MmioWrite32 (TISR, TISR_CLEAR_ALL); + + // Poll interrupt status bits to ensure clearing + while ((MmioRead32 (TISR) & TISR_ALL_INTERRUPT_MASK) != TISR_NO_INTERRUPTS_PENDING); + + gBS->RestoreTPL (OriginalTPL); +} + +/** + This function registers the handler NotifyFunction so it is called every time + the timer interrupt fires. It also passes the amount of time since the last + handler call to the NotifyFunction. If NotifyFunction is NULL, then the + handler is unregistered. If the handler is registered, then EFI_SUCCESS is + returned. If the CPU does not support registering a timer interrupt handler, + then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler + when a handler is already registered, then EFI_ALREADY_STARTED is returned. + If an attempt is made to unregister a handler when a handler is not registered, + then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to + register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR + is returned. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param NotifyFunction The function to call when a timer interrupt fires. This + function executes at TPL_HIGH_LEVEL. The DXE Core will + register a handler for the timer interrupt, so it can know + how much time has passed. This information is used to + signal timer based events. NULL will unregister the handler. + @retval EFI_SUCCESS The timer handler was registered. + @retval EFI_UNSUPPORTED The platform does not support timer interrupts. + @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already + registered. + @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not + previously registered. + @retval EFI_DEVICE_ERROR The timer handler could not be registered. + +**/ +EFI_STATUS +EFIAPI +TimerDriverRegisterHandler ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN EFI_TIMER_NOTIFY NotifyFunction + ) +{ + if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) { + return EFI_INVALID_PARAMETER; + } + + if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) { + return EFI_ALREADY_STARTED; + } + + mTimerNotifyFunction = NotifyFunction; + + return EFI_SUCCESS; +} + +/** + + This function adjusts the period of timer interrupts to the value specified + by TimerPeriod. If the timer period is updated, then the selected timer + period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If + the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. + If an error occurs while attempting to update the timer period, then the + timer hardware will be put back in its state prior to this call, and + EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt + is disabled. This is not the same as disabling the CPU's interrupts. + Instead, it must either turn off the timer hardware, or it must adjust the + interrupt controller so that a CPU interrupt is not generated when the timer + interrupt fires. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If + the timer hardware is not programmable, then EFI_UNSUPPORTED is + returned. If the timer is programmable, then the timer period + will be rounded up to the nearest timer period that is supported + by the timer hardware. If TimerPeriod is set to 0, then the + timer interrupts will be disabled. + + + @retval EFI_SUCCESS The timer period was changed. + @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. + @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error. + +**/ +EFI_STATUS +EFIAPI +TimerDriverSetTimerPeriod ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod + ) +{ + EFI_STATUS Status; + UINT64 TimerCount; + INT32 LoadValue; + + if (TimerPeriod == 0) { + // Turn off GPTIMER3 + MmioWrite32 (TCLR, TCLR_ST_OFF); + + Status = gInterrupt->DisableInterruptSource(gInterrupt, gVector); + } else { + // Calculate required timer count + TimerCount = DivU64x32(TimerPeriod * 100, PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)); + + // Set GPTIMER3 Load register + LoadValue = (INT32) -TimerCount; + MmioWrite32 (TLDR, LoadValue); + MmioWrite32 (TCRR, LoadValue); + + // Enable Overflow interrupt + MmioWrite32 (TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE); + + // Turn on GPTIMER3, it will reload at overflow + MmioWrite32 (TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON); + + Status = gInterrupt->EnableInterruptSource(gInterrupt, gVector); + } + + // + // Save the new timer period + // + mTimerPeriod = TimerPeriod; + return Status; +} + + +/** + This function retrieves the period of timer interrupts in 100 ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is + returned, then the timer is currently disabled. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod A pointer to the timer period to retrieve in 100 ns units. If + 0 is returned, then the timer is currently disabled. + + + @retval EFI_SUCCESS The timer period was returned in TimerPeriod. + @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. + +**/ +EFI_STATUS +EFIAPI +TimerDriverGetTimerPeriod ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ) +{ + if (TimerPeriod == NULL) { + return EFI_INVALID_PARAMETER; + } + + *TimerPeriod = mTimerPeriod; + return EFI_SUCCESS; +} + +/** + This function generates a soft timer interrupt. If the platform does not support soft + timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned. + If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler() + service, then a soft timer interrupt will be generated. If the timer interrupt is + enabled when this service is called, then the registered handler will be invoked. The + registered handler should not be able to distinguish a hardware-generated timer + interrupt from a software-generated timer interrupt. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + + @retval EFI_SUCCESS The soft timer interrupt was generated. + @retval EFI_UNSUPPORTED The platform does not support the generation of soft timer interrupts. + +**/ +EFI_STATUS +EFIAPI +TimerDriverGenerateSoftInterrupt ( + IN EFI_TIMER_ARCH_PROTOCOL *This + ) +{ + return EFI_UNSUPPORTED; +} + + +/** + Interface stucture for the Timer Architectural Protocol. + + @par Protocol Description: + This protocol provides the services to initialize a periodic timer + interrupt, and to register a handler that is called each time the timer + interrupt fires. It may also provide a service to adjust the rate of the + periodic timer interrupt. When a timer interrupt occurs, the handler is + passed the amount of time that has passed since the previous timer + interrupt. + + @param RegisterHandler + Registers a handler that will be called each time the + timer interrupt fires. TimerPeriod defines the minimum + time between timer interrupts, so TimerPeriod will also + be the minimum time between calls to the registered + handler. + + @param SetTimerPeriod + Sets the period of the timer interrupt in 100 nS units. + This function is optional, and may return EFI_UNSUPPORTED. + If this function is supported, then the timer period will + be rounded up to the nearest supported timer period. + + + @param GetTimerPeriod + Retrieves the period of the timer interrupt in 100 nS units. + + @param GenerateSoftInterrupt + Generates a soft timer interrupt that simulates the firing of + the timer interrupt. This service can be used to invoke the registered handler if the timer interrupt has been masked for + a period of time. + +**/ +EFI_TIMER_ARCH_PROTOCOL gTimer = { + TimerDriverRegisterHandler, + TimerDriverSetTimerPeriod, + TimerDriverGetTimerPeriod, + TimerDriverGenerateSoftInterrupt +}; + +UINTN +InterruptVectorForTimer ( + IN UINTN Timer + ) +{ + if ((Timer < 1) || (Timer > 12)) { + ASSERT(FALSE); + return 0xFFFFFFFF; + } + + return 0x24 + Timer; +} + +/** + Initialize the state information for the Timer Architectural Protocol and + the Timer Debug support protocol that allows the debugger to break into a + running program. + + @param ImageHandle of the loaded driver + @param SystemTable Pointer to the System Table + + @retval EFI_SUCCESS Protocol registered + @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure + @retval EFI_DEVICE_ERROR Hardware problems + +**/ +EFI_STATUS +EFIAPI +TimerInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_HANDLE Handle = NULL; + EFI_STATUS Status; + //UINT32 TimerBaseAddress; + + // Find the interrupt controller protocol. ASSERT if not found. + Status = gBS->LocateProtocol (&gHardwareInterruptProtocolGuid, NULL, (VOID **)&gInterrupt); + ASSERT_EFI_ERROR (Status); + + // Set up the timer registers + //TimerBaseAddress = DMTIMER2_BASE; + + // Disable the timer + //Status = TimerDriverSetTimerPeriod (&gTimer, 0); + //ASSERT_EFI_ERROR (Status); + + // Install interrupt handler + gVector = InterruptVectorForTimer (2); // Using DMTIMER2 + Status = gInterrupt->RegisterInterruptSource (gInterrupt, gVector, TimerInterruptHandler); + ASSERT_EFI_ERROR (Status); + + // Install the Timer Architectural Protocol onto a new handle + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiTimerArchProtocolGuid, &gTimer, + NULL + ); + ASSERT_EFI_ERROR(Status); + + return Status; +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf new file mode 100644 index 000000000..9c01d4de1 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf @@ -0,0 +1,56 @@ +#/** @file +# +# Component description file for Timer module +# +# Copyright (c) 2009, Apple Inc. 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 = BeagleBoneBlackTimerDxe + FILE_GUID = 6ddbf08b-cfc9-43cc-9e81-0784ba312ca0 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = TimerInitialize + +[Sources.common] + Timer.c + +[Packages] + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + +[LibraryClasses] + BaseLib + UefiRuntimeServicesTableLib + UefiLib + UefiBootServicesTableLib + BaseMemoryLib + DebugLib + UefiDriverEntryPoint + IoLib + ArmPlatformLib + +[Guids] + +[Protocols] + gEfiTimerArchProtocolGuid + gHardwareInterruptProtocolGuid + +[Pcd.common] + gEmbeddedTokenSpaceGuid.PcdTimerPeriod + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds + +[Depex] + gHardwareInterruptProtocolGuid diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h new file mode 100644 index 000000000..d4f39de7a --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h @@ -0,0 +1,103 @@ +/** @file + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +/* Interrupt Controller */ +#define INTERRUPT_BASE (0x48200000) + +#define INT_NROF_VECTORS (96) +#define MAX_VECTOR (INT_NROF_VECTORS - 1) +#define INTCPS_SYSCONFIG (INTERRUPT_BASE + 0x0010) +#define INTCPS_SYSSTATUS (INTERRUPT_BASE + 0x0014) +#define INTCPS_SIR_IRQ (INTERRUPT_BASE + 0x0040) +#define INTCPS_SIR_IFQ (INTERRUPT_BASE + 0x0044) +#define INTCPS_CONTROL (INTERRUPT_BASE + 0x0048) +#define INTCPS_PROTECTION (INTERRUPT_BASE + 0x004C) +#define INTCPS_IDLE (INTERRUPT_BASE + 0x0050) +#define INTCPS_IRQ_PRIORITY (INTERRUPT_BASE + 0x0060) +#define INTCPS_FIQ_PRIORITY (INTERRUPT_BASE + 0x0064) +#define INTCPS_THRESHOLD (INTERRUPT_BASE + 0x0068) +#define INTCPS_ITR(n) (INTERRUPT_BASE + 0x0080 + (0x20 * (n))) +#define INTCPS_MIR(n) (INTERRUPT_BASE + 0x0084 + (0x20 * (n))) +#define INTCPS_MIR_CLEAR(n) (INTERRUPT_BASE + 0x0088 + (0x20 * (n))) +#define INTCPS_MIR_SET(n) (INTERRUPT_BASE + 0x008C + (0x20 * (n))) +#define INTCPS_ISR_SET(n) (INTERRUPT_BASE + 0x0090 + (0x20 * (n))) +#define INTCPS_ISR_CLEAR(n) (INTERRUPT_BASE + 0x0094 + (0x20 * (n))) +#define INTCPS_PENDING_IRQ(n) (INTERRUPT_BASE + 0x0098 + (0x20 * (n))) +#define INTCPS_PENDING_FIQ(n) (INTERRUPT_BASE + 0x009C + (0x20 * (n))) +#define INTCPS_ILR(m) (INTERRUPT_BASE + 0x0100 + (0x04 * (m))) + +#define INTCPS_ILR_FIQ BIT0 +#define INTCPS_SIR_IRQ_MASK (0x7F) +#define INTCPS_CONTROL_NEWIRQAGR BIT0 +#define INTCPS_CONTROL_NEWFIQAGR BIT1 + +/* Timer */ +#define DMTIMER0_BASE (0x44E05000) +#define DMTIMER1_1MS_BASE (0x44E31000) +#define DMTIMER2_BASE (0x48040000) +#define DMTIMER3_BASE (0x48042000) +#define DMTIMER4_BASE (0x48044000) +#define DMTIMER5_BASE (0x48046000) +#define DMTIMER6_BASE (0x48048000) +#define DMTIMER7_BASE (0x4804A000) + +#define WDTIMER2_BASE (0x44E35000) + +#define DMTIMER_TIOCP_CFG (0x0010) +//#define DMTIMER_TISTAT (0x0014) +//#define DMTIMER_TISR (0x0018) +//#define DMTIMER_TIER (0x001C) +//#define DMTIMER_TWER (0x0020) +#define DMTIMER_TCLR (0x0038) +#define DMTIMER_TCRR (0x003C) +#define DMTIMER_TLDR (0x0040) +#define DMTIMER_TTGR (0x0044) +#define DMTIMER_TWPS (0x0048) +#define DMTIMER_TMAR (0x004C) +#define DMTIMER_TCAR1 (0x0050) +#define DMTIMER_TSICR (0x0054) +#define DMTIMER_TCAR2 (0x0058) +/*#define DMTIMER_TPIR (0x0048) +#define DMTIMER_TNIR (0x004C) +#define DMTIMER_TCVR (0x0050) +#define DMTIMER_TOCR (0x0054) +#define DMTIMER_TOWR (0x0058) +*/ +//#define WSPR (0x048) + +#define TISR_TCAR_IT_FLAG_MASK BIT2 +#define TISR_OVF_IT_FLAG_MASK BIT1 +#define TISR_MAT_IT_FLAG_MASK BIT0 +#define TISR_ALL_INTERRUPT_MASK (TISR_TCAR_IT_FLAG_MASK | TISR_OVF_IT_FLAG_MASK | TISR_MAT_IT_FLAG_MASK) + +#define TISR_TCAR_IT_FLAG_NOT_PENDING (0UL << 2) +#define TISR_OVF_IT_FLAG_NOT_PENDING (0UL << 1) +#define TISR_MAT_IT_FLAG_NOT_PENDING (0UL << 0) +#define TISR_NO_INTERRUPTS_PENDING (TISR_TCAR_IT_FLAG_NOT_PENDING | TISR_OVF_IT_FLAG_NOT_PENDING | TISR_MAT_IT_FLAG_NOT_PENDING) + +#define TISR_TCAR_IT_FLAG_CLEAR BIT2 +#define TISR_OVF_IT_FLAG_CLEAR BIT1 +#define TISR_MAT_IT_FLAG_CLEAR BIT0 +#define TISR_CLEAR_ALL (TISR_TCAR_IT_FLAG_CLEAR | TISR_OVF_IT_FLAG_CLEAR | TISR_MAT_IT_FLAG_CLEAR) + +#define TCLR_AR_AUTORELOAD BIT1 +#define TCLR_AR_ONESHOT (0UL << 1) +#define TCLR_ST_ON BIT0 +#define TCLR_ST_OFF (0UL << 0) + +#define TIER_TCAR_IT_ENABLE (BIT2 +#define TIER_TCAR_IT_DISABLE (0UL << 2) +#define TIER_OVF_IT_ENABLE BIT1 +#define TIER_OVF_IT_DISABLE (0UL << 1) +#define TIER_MAT_IT_ENABLE BIT0 +#define TIER_MAT_IT_DISABLE (0UL << 0) + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h new file mode 100644 index 000000000..dabac3d32 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h @@ -0,0 +1,166 @@ +/** @file +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _ARMPLATFORMLIB_H_ +#define _ARMPLATFORMLIB_H_ + +// DDR attributes +#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK +#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED + +// SoC registers. L3 interconnects +#define SOC_REGISTERS_L3_PHYSICAL_BASE 0x00000000 +#define SOC_REGISTERS_L3_PHYSICAL_LENGTH 0x47FFFFFF +#define SOC_REGISTERS_L3_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE + +// SoC registers. L4 interconnects +#define SOC_REGISTERS_L4_PHYSICAL_BASE 0x48000000 +#define SOC_REGISTERS_L4_PHYSICAL_LENGTH 0x00FFFFFF +#define SOC_REGISTERS_L4_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE +// +// The package level header files this module uses +// +#include +// +// The protocols, PPI and GUID defintions for this module +// +#include +#include + +#include + +/** + This structure is used to describe a region of the EFI memory map + + Every EFI regions of the system memory described by their physical start address and their size + can have different attributes. Some regions can be tested and other untested. + +**/ +typedef struct { + EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; + EFI_PHYSICAL_ADDRESS PhysicalStart; + UINT64 NumberOfBytes; +} ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; + +/** + Return the core position from the value of its MpId register + + This function returns the core position from the position 0 in the processor. + This function might be called from assembler before any stack is set. + + @return Return the core position + +**/ +UINTN +ArmPlatformGetCorePosition ( + IN UINTN MpId + ); + +/** + Return a non-zero value if the callee is the primary core + + This function returns a non-zero value if the callee is the primary core. + The primary core is the core responsible to initialize the hardware and run UEFI. + This function might be called from assembler before any stack is set. + + @return Return a non-zero value if the callee is the primary core. + +**/ +UINTN +ArmPlatformIsPrimaryCore ( + IN UINTN MpId + ); + +/** + Return the MpId of the primary core + + This function returns the MpId of the primary core. + This function might be called from assembler before any stack is set. + + @return Return the MpId of the primary core + +**/ +UINTN +ArmPlatformGetPrimaryCoreMpId ( + VOID + ); + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + + @return Return the current Boot Mode of the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ); + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei + in the PEI phase. + +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ); + +/** + Initialize the system (or sometimes called permanent) memory + + This memory is generally represented by the DRAM. + +**/ +VOID +ArmPlatformInitializeSystemMemory ( + VOID + ); + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- + Virtual Memory mapping. This array must be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ); + +/** + Return the Platform specific PPIs + + This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed + to the PeiCore by PrePeiCore. + + @param[out] PpiListSize Size in Bytes of the Platform PPI List + @param[out] PpiList Platform PPI List + +**/ +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ); + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h new file mode 100644 index 000000000..b1a080c00 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h @@ -0,0 +1,38 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_ +#define __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_ + +VOID +ArmPlatformGetGlobalVariable ( + IN UINTN VariableOffset, + IN UINTN VariableSize, + OUT VOID* Variable + ); + +VOID +ArmPlatformSetGlobalVariable ( + IN UINTN VariableOffset, + IN UINTN VariableSize, + OUT VOID* Variable + ); + +VOID* +ArmPlatformGetGlobalVariableAddress ( + IN UINTN VariableOffset + ); + +#endif + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h new file mode 100644 index 000000000..ece806490 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h @@ -0,0 +1,88 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _ARMPLATFORMSECLIB_H_ +#define _ARMPLATFORMSECLIB_H_ + +#define ARM_SEC_BOOT_MASK ~0 +#define ARM_SEC_COLD_BOOT (1 << 0) +#define ARM_SEC_SECONDARY_COLD_BOOT (1 << 1) + +/** + Initialize the memory where the initial stacks will reside + + This memory can contain the initial stacks (Secure and Secure Monitor stacks). + In some platform, this region is already initialized and the implementation of this function can + do nothing. This memory can also represent the Secure RAM. + This function is called before the satck has been set up. Its implementation must ensure the stack + pointer is not used (probably required to use assembly language) + +**/ +VOID +ArmPlatformSecBootMemoryInit ( + VOID + ); + +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +VOID +ArmPlatformSecBootAction ( + VOID + ); + +/** + Initialize controllers that must setup at the early stage + + Some peripherals must be initialized in Secure World. + For example: Some L2 controller, interconnect, clock, DMC, etc + +**/ +RETURN_STATUS +ArmPlatformSecInitialize ( + IN UINTN MpId + ); + +/** + Call before jumping to Normal World + + This function allows the firmware platform to do extra actions before + jumping to the Normal World + +**/ +VOID +ArmPlatformSecExtraAction ( + IN UINTN MpId, + OUT UINTN* JumpAddress + ); + +/** + Initialize the Secure peripherals and memory regions + + If Trustzone is supported by your platform then this function makes the required initialization + of the secure peripherals and memory regions. + +**/ +VOID +ArmPlatformSecTrustzoneInit ( + IN UINTN MpId + ); + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h new file mode 100644 index 000000000..39a0cc7f7 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h @@ -0,0 +1,63 @@ +/** @file ArmPlatformSysConfigLib.h + + Copyright (c) 2011-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. + +**/ + +#ifndef __ARM_PLATFORM_SYS_CONFIG_H__ +#define __ARM_PLATFORM_SYS_CONFIG_H__ + +#include + +/* This header file makes it easier to access the System Configuration Registers + * in the ARM Versatile Express motherboard. + */ + +// +// Typedef +// +typedef UINT32 SYS_CONFIG_FUNCTION; + +// +// Functions +// +RETURN_STATUS +ArmPlatformSysConfigInitialize ( + VOID + ); + +RETURN_STATUS +ArmPlatformSysConfigGet ( + IN SYS_CONFIG_FUNCTION Function, + OUT UINT32* Value + ); + +RETURN_STATUS +ArmPlatformSysConfigGetValues ( + IN SYS_CONFIG_FUNCTION Function, + IN UINTN Size, + OUT UINT32* Values + ); + +RETURN_STATUS +ArmPlatformSysConfigSet ( + IN SYS_CONFIG_FUNCTION Function, + IN UINT32 Value + ); + +RETURN_STATUS +ArmPlatformSysConfigSetDevice ( + IN SYS_CONFIG_FUNCTION Function, + IN UINT32 Device, + IN UINT32 Value + ); + +#endif /* __SYS_CFG_REGISTERS_H__ */ diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h new file mode 100644 index 000000000..5368697c5 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h @@ -0,0 +1,24 @@ +/** @file +* Main file supporting the Monitor World on ARM PLatforms +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __ARM_TRUSTED_MONITOR_LIB_H_ +#define __ARM_TRUSTED_MONITOR_LIB_H_ + +VOID +ArmSecureMonitorWorldInitialize ( + VOID + ); + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h new file mode 100644 index 000000000..b9bdf471e --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h @@ -0,0 +1,221 @@ +/** @file + + Copyright (c) 2011, ARM Ltd. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + **/ + +#ifndef __LCDPLATFORMLIB_H +#define __LCDPLATFORMLIB_H + +#include + +#define LCD_VRAM_SIZE SIZE_8MB + +// +// Modes definitions +// +#define VGA 0 +#define SVGA 1 +#define XGA 2 +#define SXGA 3 +#define WSXGA 4 +#define UXGA 5 +#define HD 6 + +// +// VGA Mode: 640 x 480 +// +#define VGA_H_RES_PIXELS 640 +#define VGA_V_RES_PIXELS 480 +#define VGA_OSC_FREQUENCY 23750000 /* 0x016A6570 */ + +#define VGA_H_SYNC ( 80 - 1) +#define VGA_H_FRONT_PORCH ( 16 - 1) +#define VGA_H_BACK_PORCH ( 64 - 1) + +#define VGA_V_SYNC ( 4 - 1) +#define VGA_V_FRONT_PORCH ( 3 - 1) +#define VGA_V_BACK_PORCH ( 13 - 1) + +// +// SVGA Mode: 800 x 600 +// +#define SVGA_H_RES_PIXELS 800 +#define SVGA_V_RES_PIXELS 600 +#define SVGA_OSC_FREQUENCY 38250000 /* 0x0247A610 */ + +#define SVGA_H_SYNC ( 80 - 1) +#define SVGA_H_FRONT_PORCH ( 32 - 1) +#define SVGA_H_BACK_PORCH (112 - 1) + +#define SVGA_V_SYNC ( 4 - 1) +#define SVGA_V_FRONT_PORCH ( 3 - 1) +#define SVGA_V_BACK_PORCH ( 17 - 1) + +// +// XGA Mode: 1024 x 768 +// +#define XGA_H_RES_PIXELS 1024 +#define XGA_V_RES_PIXELS 768 +#define XGA_OSC_FREQUENCY 63500000 /* 0x03C8EEE0 */ + +#define XGA_H_SYNC (104 - 1) +#define XGA_H_FRONT_PORCH ( 48 - 1) +#define XGA_H_BACK_PORCH (152 - 1) + +#define XGA_V_SYNC ( 4 - 1) +#define XGA_V_FRONT_PORCH ( 3 - 1) +#define XGA_V_BACK_PORCH ( 23 - 1) + +// +// SXGA Mode: 1280 x 1024 +// +#define SXGA_H_RES_PIXELS 1280 +#define SXGA_V_RES_PIXELS 1024 +#define SXGA_OSC_FREQUENCY 109000000 /* 0x067F3540 */ + +#define SXGA_H_SYNC (136 - 1) +#define SXGA_H_FRONT_PORCH ( 80 - 1) +#define SXGA_H_BACK_PORCH (216 - 1) + +#define SXGA_V_SYNC ( 7 - 1) +#define SXGA_V_FRONT_PORCH ( 3 - 1) +#define SXGA_V_BACK_PORCH ( 29 - 1) + +// +// WSXGA+ Mode: 1680 x 1050 +// +#define WSXGA_H_RES_PIXELS 1680 +#define WSXGA_V_RES_PIXELS 1050 +#define WSXGA_OSC_FREQUENCY 147000000 /* 0x08C30AC0 */ + +#define WSXGA_H_SYNC (170 - 1) +#define WSXGA_H_FRONT_PORCH (104 - 1) +#define WSXGA_H_BACK_PORCH (274 - 1) + +#define WSXGA_V_SYNC ( 5 - 1) +#define WSXGA_V_FRONT_PORCH ( 4 - 1) +#define WSXGA_V_BACK_PORCH ( 41 - 1) + +// +// UXGA Mode: 1600 x 1200 +// +#define UXGA_H_RES_PIXELS 1600 +#define UXGA_V_RES_PIXELS 1200 +#define UXGA_OSC_FREQUENCY 161000000 /* 0x0998AA40 */ + +#define UXGA_H_SYNC (168 - 1) +#define UXGA_H_FRONT_PORCH (112 - 1) +#define UXGA_H_BACK_PORCH (280 - 1) + +#define UXGA_V_SYNC ( 4 - 1) +#define UXGA_V_FRONT_PORCH ( 3 - 1) +#define UXGA_V_BACK_PORCH ( 38 - 1) + +// +// HD Mode: 1920 x 1080 +// +#define HD_H_RES_PIXELS 1920 +#define HD_V_RES_PIXELS 1080 +#define HD_OSC_FREQUENCY 165000000 /* 0x09D5B340 */ + +#define HD_H_SYNC ( 79 - 1) +#define HD_H_FRONT_PORCH (128 - 1) +#define HD_H_BACK_PORCH (328 - 1) + +#define HD_V_SYNC ( 5 - 1) +#define HD_V_FRONT_PORCH ( 3 - 1) +#define HD_V_BACK_PORCH ( 32 - 1) + +// +// Colour Masks +// + +#define LCD_24BPP_RED_MASK 0x00FF0000 +#define LCD_24BPP_GREEN_MASK 0x0000FF00 +#define LCD_24BPP_BLUE_MASK 0x000000FF +#define LCD_24BPP_RESERVED_MASK 0xFF000000 + +#define LCD_16BPP_555_RED_MASK 0x00007C00 +#define LCD_16BPP_555_GREEN_MASK 0x000003E0 +#define LCD_16BPP_555_BLUE_MASK 0x0000001F +#define LCD_16BPP_555_RESERVED_MASK 0x00000000 + +#define LCD_16BPP_565_RED_MASK 0x0000F800 +#define LCD_16BPP_565_GREEN_MASK 0x000007E0 +#define LCD_16BPP_565_BLUE_MASK 0x0000001F +#define LCD_16BPP_565_RESERVED_MASK 0x00008000 + +#define LCD_12BPP_444_RED_MASK 0x00000F00 +#define LCD_12BPP_444_GREEN_MASK 0x000000F0 +#define LCD_12BPP_444_BLUE_MASK 0x0000000F +#define LCD_12BPP_444_RESERVED_MASK 0x0000F000 + + +// The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control Register +typedef enum { + LCD_BITS_PER_PIXEL_1 = 0, + LCD_BITS_PER_PIXEL_2, + LCD_BITS_PER_PIXEL_4, + LCD_BITS_PER_PIXEL_8, + LCD_BITS_PER_PIXEL_16_555, + LCD_BITS_PER_PIXEL_24, + LCD_BITS_PER_PIXEL_16_565, + LCD_BITS_PER_PIXEL_12_444 +} LCD_BPP; + + +EFI_STATUS +LcdPlatformInitializeDisplay ( + IN EFI_HANDLE Handle + ); + +EFI_STATUS +LcdPlatformGetVram ( + OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress, + OUT UINTN* VramSize + ); + +UINT32 +LcdPlatformGetMaxMode ( + VOID + ); + +EFI_STATUS +LcdPlatformSetMode ( + IN UINT32 ModeNumber + ); + +EFI_STATUS +LcdPlatformQueryMode ( + IN UINT32 ModeNumber, + OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info + ); + +EFI_STATUS +LcdPlatformGetTimings ( + IN UINT32 ModeNumber, + OUT UINT32* HRes, + OUT UINT32* HSync, + OUT UINT32* HBackPorch, + OUT UINT32* HFrontPorch, + OUT UINT32* VRes, + OUT UINT32* VSync, + OUT UINT32* VBackPorch, + OUT UINT32* VFrontPorch + ); + +EFI_STATUS +LcdPlatformGetBpp ( + IN UINT32 ModeNumber, + OUT LCD_BPP* Bpp + ); + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h new file mode 100644 index 000000000..e9e1c0607 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h @@ -0,0 +1,37 @@ +/** @file + + Copyright (c) 2011-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. + + **/ + +#ifndef _NORFLASHPLATFORMLIB_H_ +#define _NORFLASHPLATFORMLIB_H_ + +typedef struct { + UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA) + UINTN RegionBaseAddress; // Start address of one single region + UINTN Size; + UINTN BlockSize; + EFI_GUID Guid; +} NOR_FLASH_DESCRIPTION; + +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ); + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions, + OUT UINT32 *Count + ); + +#endif /* _NORFLASHPLATFORMLIB_H_ */ diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S new file mode 100644 index 000000000..c32ea77f2 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S @@ -0,0 +1,51 @@ +// +// Copyright (c) 2012-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include + +.text +.align 2 + +GCC_ASM_EXPORT(ArmPlatformPeiBootAction) +GCC_ASM_EXPORT(ArmPlatformGetCorePosition) +GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) +GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) + +ASM_PFX(ArmPlatformPeiBootAction): + bx lr + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +ASM_PFX(ArmPlatformGetCorePosition): + // single core, return 1 + mov r0, #1 + bx lr + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_PFX(ArmPlatformGetPrimaryCoreMpId): + // return MPIDR of calling CPU + b ArmReadMpidr + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_PFX(ArmPlatformIsPrimaryCore): + mov r0, #1 + bx lr diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm new file mode 100644 index 000000000..68b6515e5 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm @@ -0,0 +1,61 @@ +// +// Copyright (c) 2012-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include + + INCLUDE AsmMacroIoLib.inc + + EXPORT ArmPlatformPeiBootAction + EXPORT ArmPlatformGetCorePosition + EXPORT ArmPlatformGetPrimaryCoreMpId + EXPORT ArmPlatformIsPrimaryCore + + PRESERVE8 + AREA ArmPlatformNullHelper, CODE, READONLY + +ArmPlatformPeiBootAction FUNCTION + bx lr + ENDFUNC + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +ArmPlatformGetCorePosition FUNCTION + // single core, return 1 + mov r0, #1 + bx lr + ENDFUNC + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ArmPlatformGetPrimaryCoreMpId FUNCTION + // return MPIDR of the calling CPU + b ArmReadMpidr + ENDFUNC + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ArmPlatformIsPrimaryCore FUNCTION + // single core on BeagleBone Black SoC, return 1 + mov r0, #1 + bx lr + ENDFUNC + + END + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c new file mode 100644 index 000000000..da8907676 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c @@ -0,0 +1,72 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei + in the PEI phase. + +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + //TODO: Implement me + + return RETURN_SUCCESS; +} + +/** + Initialize the system (or sometimes called permanent) memory + + This memory is generally represented by the DRAM. + +**/ +VOID +ArmPlatformInitializeSystemMemory ( + VOID + ) +{ + //TODO: Implement me +} + +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + *PpiListSize = 0; + *PpiList = NULL; +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf new file mode 100644 index 000000000..cba41f5b6 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf @@ -0,0 +1,49 @@ +#/* @file +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010016 + BASE_NAME = BeagleBoneBlackPlatformLib + FILE_GUID = 97dea43b-2728-493a-99e6-d5786dd2004f + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = BeagleBoneBlackPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + MemoryAllocationLib + +[Sources.common] + ArmPlatformLibNull.c + ArmPlatformLibNullMem.c + +[Sources.Arm] + ArmPlatformHelper.S | GCC + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c new file mode 100644 index 000000000..bc213acc2 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c @@ -0,0 +1,82 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include +#include + +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 4 + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- + Virtual Memory mapping. This array must be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; + UINTN Index = 0; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + + ASSERT(VirtualMemoryMap != NULL); + + VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + + if (VirtualMemoryTable == NULL) { + return; + } + + if (FeaturePcdGet(PcdCacheEnable) == TRUE) { + CacheAttributes = DDR_ATTRIBUTES_CACHED; + } else { + CacheAttributes = DDR_ATTRIBUTES_UNCACHED; + } + + // ReMap (Either NOR Flash or DRAM) + VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdSystemMemorySize); + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // SOC Registers. L3 interconnects + VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE; + VirtualMemoryTable[Index].VirtualBase = SOC_REGISTERS_L3_PHYSICAL_BASE; + VirtualMemoryTable[Index].Length = SOC_REGISTERS_L3_PHYSICAL_LENGTH; + VirtualMemoryTable[Index].Attributes = SOC_REGISTERS_L3_ATTRIBUTES; + + // SOC Registers. L4 interconnects + VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE; + VirtualMemoryTable[Index].VirtualBase = SOC_REGISTERS_L4_PHYSICAL_BASE; + VirtualMemoryTable[Index].Length = SOC_REGISTERS_L4_PHYSICAL_LENGTH; + VirtualMemoryTable[Index].Attributes = SOC_REGISTERS_L4_ATTRIBUTES; + + // End of Table + VirtualMemoryTable[++Index].PhysicalBase = 0; + VirtualMemoryTable[Index].VirtualBase = 0; + VirtualMemoryTable[Index].Length = 0; + VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; + + ASSERT((Index + 1) == MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap = VirtualMemoryTable; +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf new file mode 100644 index 000000000..03ae72e0d --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf @@ -0,0 +1,44 @@ +#/* @file +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformLibNull + FILE_GUID = cb494bad-23ff-427e-8608-d7e138d3363b + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + +[Sources.common] + ArmPlatformLibNull.c + +[Sources.Arm] + ArmPlatformHelper.S | GCC + ArmPlatformHelper.asm | RVCT + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf new file mode 100644 index 000000000..a68a5d71f --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Timer library implementation for AM335x +# +# Copyright (c) 2007, 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 = BeagleBoneBlackTimerLib + FILE_GUID = 6e19de87-4c42-4636-aa21-704f689054a2 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = TimerLib + +[Sources.common] + TimerLib.c + +[Packages] + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + DebugLib + ArmPlatformLib + IoLib + +[Pcd] + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c new file mode 100644 index 000000000..fe5a579c3 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c @@ -0,0 +1,110 @@ +/** @file +* +* Copyright (c) 2011-2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include + +#include + +RETURN_STATUS +EFIAPI +TimerConstructor ( + VOID + ) +{ + return EFI_SUCCESS; +} + +UINTN +EFIAPI +MicroSecondDelay ( + IN UINTN MicroSeconds + ) +{ + UINT64 NanoSeconds; + + NanoSeconds = MultU64x32(MicroSeconds, 1000); + + while (NanoSeconds > (UINTN)-1) { + NanoSecondDelay((UINTN)-1); + NanoSeconds -= (UINTN)-1; + } + + NanoSecondDelay(NanoSeconds); + + return MicroSeconds; +} + +UINTN +EFIAPI +NanoSecondDelay ( + IN UINTN NanoSeconds + ) +{ + UINT32 Delay; + UINT32 StartTime; + UINT32 CurrentTime; + UINT32 ElapsedTime; + UINT32 TimerCountRegister; + + Delay = (NanoSeconds / PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)) + 1; + + TimerCountRegister = DMTIMER0_BASE + DMTIMER_TCRR; + + StartTime = MmioRead32 (TimerCountRegister); + + do + { + CurrentTime = MmioRead32 (TimerCountRegister); + ElapsedTime = CurrentTime - StartTime; + } while (ElapsedTime < Delay); + + NanoSeconds = ElapsedTime * PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds); + + return NanoSeconds; +} + +UINT64 +EFIAPI +GetPerformanceCounter ( + VOID + ) +{ + return (UINT64)MmioRead32 (DMTIMER0_BASE + DMTIMER_TCRR); +} + +UINT64 +EFIAPI +GetPerformanceCounterProperties ( + OUT UINT64 *StartValue, OPTIONAL + OUT UINT64 *EndValue OPTIONAL + ) +{ + if (StartValue != NULL) { + // Timer starts with the reload value + *StartValue = (UINT64)MmioRead32 (DMTIMER0_BASE + DMTIMER_TLDR); + } + + if (EndValue != NULL) { + // Timer counts up to 0xFFFFFFFF + *EndValue = 0xFFFFFFFF; + } + + return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz); +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c new file mode 100644 index 000000000..72c62d7f1 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c @@ -0,0 +1,24 @@ +/** @file +* Main file supporting the Monitor World on ARM PLatforms +* +* Copyright (c) 2012-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +VOID +ArmSecureMonitorWorldInitialize ( + VOID + ) +{ + // Do not touch the EL3 Exception Vector Table Register. + // The default default DebugAgentLib could have already set its own vector + // into EL3 to catch abort exceptions. +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c new file mode 100644 index 000000000..1f950d78f --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c @@ -0,0 +1,38 @@ +/** @file +* Main file supporting the Monitor World on ARM PLatforms +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include + +#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0) + +VOID +MonitorVectorTable ( + VOID + ); + +VOID +ArmSecureMonitorWorldInitialize ( + VOID + ) +{ + // Ensure the Monitor Table is 32bit aligned + ASSERT (((UINTN)&MonitorVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0); + + // Write the Monitor Mode Vector Table Address + ArmWriteMVBar ((UINTN) &MonitorVectorTable); +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S new file mode 100644 index 000000000..3e75bee50 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S @@ -0,0 +1,41 @@ +// +// Copyright (c) 2011, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include + +.text +.align 5 + +GCC_ASM_EXPORT(MonitorVectorTable) + +ASM_PFX(MonitorVectorTable): + +_MonitorResetEntry: + b _MonitorResetEntry +_MonitorUndefinedEntry: + b _MonitorUndefinedEntry +_MonitorSmcEntry: + b _MonitorSmcEntry +_MonitorPrefetchEntry: + b _MonitorPrefetchEntry +_MonitorDataAbortEntry: + b _MonitorDataAbortEntry +_MonitorReservedEntry: + b _MonitorReservedEntry +_MonitorIrqEntry: + b _MonitorIrqEntry +_MonitorFiqEntry: + b _MonitorFiqEntry + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm new file mode 100644 index 000000000..f4f515d05 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm @@ -0,0 +1,40 @@ +// +// Copyright (c) 2011, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include + + EXPORT MonitorVectorTable + + PRESERVE8 + AREA MonitoVectorTableArea, CODE, READONLY, CODEALIGN, ALIGN=5 + +MonitorVectorTable + +_MonitorResetEntry + b _MonitorResetEntry +_MonitorUndefinedEntry + b _MonitorUndefinedEntry +_MonitorSmcEntry + b _MonitorSmcEntry +_MonitorPrefetchEntry + b _MonitorPrefetchEntry +_MonitorDataAbortEntry + b _MonitorDataAbortEntry +_MonitorReservedEntry + b _MonitorReservedEntry +_MonitorIrqEntry + b _MonitorIrqEntry +_MonitorFiqEntry + b _MonitorFiqEntry + + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf new file mode 100644 index 000000000..da867e1fe --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf @@ -0,0 +1,40 @@ +#/* @file +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmTrustedMonitorLibNull + FILE_GUID = c4b50eb2-ed16-4283-a5b0-a7341c3f997b + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmTrustedMonitorLib + +[Sources.ARM] + Arm/ArmTrustedMonitorLibNull.c + Arm/MonitorTable.asm | RVCT + Arm/MonitorTable.S | GCC + +[Sources.AARCH64] + AArch64/ArmTrustedMonitorLibNull.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + BaseLib + DebugLib + PcdLib + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c new file mode 100644 index 000000000..9115e9c26 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c @@ -0,0 +1,683 @@ +/** @file + Implement EFI RealTimeClock runtime services via RTC Lib. + + Currently this driver does not support runtime virtual calling. + + Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+ Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +//#include + +STATIC CONST CHAR16 mTimeZoneVariableName[] = L"PL031RtcTimeZone"; +STATIC CONST CHAR16 mDaylightVariableName[] = L"PL031RtcDaylight"; +STATIC BOOLEAN mPL031Initialized = FALSE; +STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; +STATIC UINTN mPL031RtcBase; + +EFI_STATUS +IdentifyPL031 ( + VOID + ) +{ + EFI_STATUS Status; + + // Check if this is a PrimeCell Peripheral + if ( (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID0) != 0x0D) + || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID1) != 0xF0) + || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID2) != 0x05) + || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID3) != 0xB1)) { + Status = EFI_NOT_FOUND; + goto EXIT; + } + + // Check if this PrimeCell Peripheral is the PL031 Real Time Clock + if ( (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID0) != 0x31) + || (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID1) != 0x10) + || ((MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID2) & 0xF) != 0x04) + || (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID3) != 0x00)) { + Status = EFI_NOT_FOUND; + goto EXIT; + } + + Status = EFI_SUCCESS; + + EXIT: + return Status; +} + +EFI_STATUS +InitializePL031 ( + VOID + ) +{ + EFI_STATUS Status; + + // Prepare the hardware + Status = IdentifyPL031(); + if (EFI_ERROR (Status)) { + goto EXIT; + } + + // Ensure interrupts are masked. We do not want RTC interrupts in UEFI + if ((MmioRead32 (mPL031RtcBase + PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER) & PL031_SET_IRQ_MASK) != PL031_SET_IRQ_MASK) { + MmioOr32 (mPL031RtcBase + PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER, PL031_SET_IRQ_MASK); + } + + // Clear any existing interrupts + if ((MmioRead32 (mPL031RtcBase + PL031_RTC_RIS_RAW_IRQ_STATUS_REGISTER) & PL031_IRQ_TRIGGERED) == PL031_IRQ_TRIGGERED) { + MmioOr32 (mPL031RtcBase + PL031_RTC_ICR_IRQ_CLEAR_REGISTER, PL031_CLEAR_IRQ); + } + + // Start the clock counter + if ((MmioRead32 (mPL031RtcBase + PL031_RTC_CR_CONTROL_REGISTER) & PL031_RTC_ENABLED) != PL031_RTC_ENABLED) { + MmioOr32 (mPL031RtcBase + PL031_RTC_CR_CONTROL_REGISTER, PL031_RTC_ENABLED); + } + + mPL031Initialized = TRUE; + + EXIT: + return Status; +} + +/** + Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME + **/ +VOID +EpochToEfiTime ( + IN UINTN EpochSeconds, + OUT EFI_TIME *Time + ) +{ + UINTN a; + UINTN b; + UINTN c; + UINTN d; + UINTN g; + UINTN j; + UINTN m; + UINTN y; + UINTN da; + UINTN db; + UINTN dc; + UINTN dg; + UINTN hh; + UINTN mm; + UINTN ss; + UINTN J; + + J = (EpochSeconds / 86400) + 2440588; + j = J + 32044; + g = j / 146097; + dg = j % 146097; + c = (((dg / 36524) + 1) * 3) / 4; + dc = dg - (c * 36524); + b = dc / 1461; + db = dc % 1461; + a = (((db / 365) + 1) * 3) / 4; + da = db - (a * 365); + y = (g * 400) + (c * 100) + (b * 4) + a; + m = (((da * 5) + 308) / 153) - 2; + d = da - (((m + 4) * 153) / 5) + 122; + + Time->Year = y - 4800 + ((m + 2) / 12); + Time->Month = ((m + 2) % 12) + 1; + Time->Day = d + 1; + + ss = EpochSeconds % 60; + a = (EpochSeconds - ss) / 60; + mm = a % 60; + b = (a - mm) / 60; + hh = b % 24; + + Time->Hour = hh; + Time->Minute = mm; + Time->Second = ss; + Time->Nanosecond = 0; + +} + +/** + Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) + **/ +UINTN +EfiTimeToEpoch ( + IN EFI_TIME *Time + ) +{ + UINTN a; + UINTN y; + UINTN m; + UINTN JulianDate; // Absolute Julian Date representation of the supplied Time + UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY + UINTN EpochSeconds; + + a = (14 - Time->Month) / 12 ; + y = Time->Year + 4800 - a; + m = Time->Month + (12*a) - 3; + + JulianDate = Time->Day + ((153*m + 2)/5) + (365*y) + (y/4) - (y/100) + (y/400) - 32045; + + ASSERT (JulianDate >= EPOCH_JULIAN_DATE); + EpochDays = JulianDate - EPOCH_JULIAN_DATE; + + EpochSeconds = (EpochDays * SEC_PER_DAY) + ((UINTN)Time->Hour * SEC_PER_HOUR) + (Time->Minute * SEC_PER_MIN) + Time->Second; + + return EpochSeconds; +} + +BOOLEAN +IsLeapYear ( + IN EFI_TIME *Time + ) +{ + if (Time->Year % 4 == 0) { + if (Time->Year % 100 == 0) { + if (Time->Year % 400 == 0) { + return TRUE; + } else { + return FALSE; + } + } else { + return TRUE; + } + } else { + return FALSE; + } +} + +BOOLEAN +DayValid ( + IN EFI_TIME *Time + ) +{ + INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + + if (Time->Day < 1 || + Time->Day > DayOfMonth[Time->Month - 1] || + (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28)) + ) { + return FALSE; + } + + return TRUE; +} + +/** + Returns the current time and date information, and the time-keeping capabilities + of the hardware platform. + + @param Time A pointer to storage to receive a snapshot of the current time. + @param Capabilities An optional pointer to a buffer to receive the real time clock + device's capabilities. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER Time is NULL. + @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. + @retval EFI_SECURITY_VIOLATION The time could not be retrieved due to an authentication failure. + +**/ +EFI_STATUS +EFIAPI +LibGetTime ( + OUT EFI_TIME *Time, + OUT EFI_TIME_CAPABILITIES *Capabilities + ) +{ + EFI_STATUS Status = EFI_SUCCESS; + UINT32 EpochSeconds; + INT16 TimeZone; + UINT8 Daylight; + UINTN Size; + + // Initialize the hardware if not already done + if (!mPL031Initialized) { + Status = InitializePL031 (); + if (EFI_ERROR (Status)) { + goto EXIT; + } + } + + // Snapshot the time as early in the function call as possible + // On some platforms we may have access to a battery backed up hardware clock. + // If such RTC exists try to use it first. + Status = 1; + EpochSeconds = 15; + if (Status == EFI_UNSUPPORTED) { + // Battery backed up hardware RTC does not exist, revert to PL031 + EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER); + Status = EFI_SUCCESS; + } else if (EFI_ERROR (Status)) { + // Battery backed up hardware RTC exists but could not be read due to error. Abort. + goto EXIT; + } else { + // Battery backed up hardware RTC exists and we read the time correctly from it. + // Now sync the PL031 to the new time. + MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); + } + + // Ensure Time is a valid pointer + if (Time == NULL) { + Status = EFI_INVALID_PARAMETER; + goto EXIT; + } + + // Get the current time zone information from non-volatile storage + Size = sizeof (TimeZone); + Status = gRT->GetVariable ( + (CHAR16 *)mTimeZoneVariableName, + &gEfiCallerIdGuid, + NULL, + &Size, + (VOID *)&TimeZone + ); + + if (EFI_ERROR (Status)) { + ASSERT(Status != EFI_INVALID_PARAMETER); + ASSERT(Status != EFI_BUFFER_TOO_SMALL); + + if (Status != EFI_NOT_FOUND) + goto EXIT; + + // The time zone variable does not exist in non-volatile storage, so create it. + Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE; + // Store it + Status = gRT->SetVariable ( + (CHAR16 *)mTimeZoneVariableName, + &gEfiCallerIdGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + Size, + (VOID *)&(Time->TimeZone) + ); + if (EFI_ERROR (Status)) { + DEBUG (( + EFI_D_ERROR, + "LibGetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", + mTimeZoneVariableName, + Status + )); + goto EXIT; + } + } else { + // Got the time zone + Time->TimeZone = TimeZone; + + // Check TimeZone bounds: -1440 to 1440 or 2047 + if (((Time->TimeZone < -1440) || (Time->TimeZone > 1440)) + && (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE)) { + Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE; + } + + // Adjust for the correct time zone + if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { + EpochSeconds += Time->TimeZone * SEC_PER_MIN; + } + } + + // Get the current daylight information from non-volatile storage + Size = sizeof (Daylight); + Status = gRT->GetVariable ( + (CHAR16 *)mDaylightVariableName, + &gEfiCallerIdGuid, + NULL, + &Size, + (VOID *)&Daylight + ); + + if (EFI_ERROR (Status)) { + ASSERT(Status != EFI_INVALID_PARAMETER); + ASSERT(Status != EFI_BUFFER_TOO_SMALL); + + if (Status != EFI_NOT_FOUND) + goto EXIT; + + // The daylight variable does not exist in non-volatile storage, so create it. + Time->Daylight = 0; + // Store it + Status = gRT->SetVariable ( + (CHAR16 *)mDaylightVariableName, + &gEfiCallerIdGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + Size, + (VOID *)&(Time->Daylight) + ); + if (EFI_ERROR (Status)) { + DEBUG (( + EFI_D_ERROR, + "LibGetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", + mDaylightVariableName, + Status + )); + goto EXIT; + } + } else { + // Got the daylight information + Time->Daylight = Daylight; + + // Adjust for the correct period + if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { + // Convert to adjusted time, i.e. spring forwards one hour + EpochSeconds += SEC_PER_HOUR; + } + } + + // Convert from internal 32-bit time to UEFI time + EpochToEfiTime (EpochSeconds, Time); + + // Update the Capabilities info + if (Capabilities != NULL) { + // PL031 runs at frequency 1Hz + Capabilities->Resolution = PL031_COUNTS_PER_SECOND; + // Accuracy in ppm multiplied by 1,000,000, e.g. for 50ppm set 50,000,000 + Capabilities->Accuracy = (UINT32)PcdGet32 (PcdPL031RtcPpmAccuracy); + // FALSE: Setting the time does not clear the values below the resolution level + Capabilities->SetsToZero = FALSE; + } + + EXIT: + return Status; +} + + +/** + Sets the current local time and date information. + + @param Time A pointer to the current time. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. + +**/ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + EFI_STATUS Status; + UINTN EpochSeconds; + + // Check the input parameters are within the range specified by UEFI + if ((Time->Year < 1900) || + (Time->Year > 9999) || + (Time->Month < 1 ) || + (Time->Month > 12 ) || + (!DayValid (Time) ) || + (Time->Hour > 23 ) || + (Time->Minute > 59 ) || + (Time->Second > 59 ) || + (Time->Nanosecond > 999999999) || + (!((Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) || ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440)))) || + (Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT))) + ) { + Status = EFI_INVALID_PARAMETER; + goto EXIT; + } + + // Because the PL031 is a 32-bit counter counting seconds, + // the maximum time span is just over 136 years. + // Time is stored in Unix Epoch format, so it starts in 1970, + // Therefore it can not exceed the year 2106. + if ((Time->Year < 1970) || (Time->Year >= 2106)) { + Status = EFI_UNSUPPORTED; + goto EXIT; + } + + // Initialize the hardware if not already done + if (!mPL031Initialized) { + Status = InitializePL031 (); + if (EFI_ERROR (Status)) { + goto EXIT; + } + } + + EpochSeconds = EfiTimeToEpoch (Time); + + // Adjust for the correct time zone, i.e. convert to UTC time zone + if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { + EpochSeconds -= Time->TimeZone * SEC_PER_MIN; + } + + // TODO: Automatic Daylight activation + + // Adjust for the correct period + if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { + // Convert to un-adjusted time, i.e. fall back one hour + EpochSeconds -= SEC_PER_HOUR; + } + + // On some platforms we may have access to a battery backed up hardware clock. + // + // If such RTC exists then it must be updated first, before the PL031, + // to minimise any time drift. This is important because the battery backed-up + // RTC maintains the master time for the platform across reboots. + // + // If such RTC does not exist then the following function returns UNSUPPORTED. + Status = 0; + if ((EFI_ERROR (Status)) && (Status != EFI_UNSUPPORTED)){ + // Any status message except SUCCESS and UNSUPPORTED indicates a hardware failure. + goto EXIT; + } + + + // Set the PL031 + MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); + + // The accesses to Variable Services can be very slow, because we may be writing to Flash. + // Do this after having set the RTC. + + // Save the current time zone information into non-volatile storage + Status = gRT->SetVariable ( + (CHAR16 *)mTimeZoneVariableName, + &gEfiCallerIdGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (Time->TimeZone), + (VOID *)&(Time->TimeZone) + ); + if (EFI_ERROR (Status)) { + DEBUG (( + EFI_D_ERROR, + "LibSetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", + mTimeZoneVariableName, + Status + )); + goto EXIT; + } + + // Save the current daylight information into non-volatile storage + Status = gRT->SetVariable ( + (CHAR16 *)mDaylightVariableName, + &gEfiCallerIdGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof(Time->Daylight), + (VOID *)&(Time->Daylight) + ); + if (EFI_ERROR (Status)) { + DEBUG (( + EFI_D_ERROR, + "LibSetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", + mDaylightVariableName, + Status + )); + goto EXIT; + } + + EXIT: + return Status; +} + + +/** + Returns the current wakeup alarm clock setting. + + @param Enabled Indicates if the alarm is currently enabled or disabled. + @param Pending Indicates if the alarm signal is pending and requires acknowledgement. + @param Time The current alarm setting. + + @retval EFI_SUCCESS The alarm settings were returned. + @retval EFI_INVALID_PARAMETER Any parameter is NULL. + @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. + +**/ +EFI_STATUS +EFIAPI +LibGetWakeupTime ( + OUT BOOLEAN *Enabled, + OUT BOOLEAN *Pending, + OUT EFI_TIME *Time + ) +{ + // Not a required feature + return EFI_UNSUPPORTED; +} + + +/** + Sets the system wakeup alarm clock time. + + @param Enabled Enable or disable the wakeup alarm. + @param Time If Enable is TRUE, the time to set the wakeup alarm for. + + @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If + Enable is FALSE, then the wakeup alarm was disabled. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. + @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. + +**/ +EFI_STATUS +EFIAPI +LibSetWakeupTime ( + IN BOOLEAN Enabled, + OUT EFI_TIME *Time + ) +{ + // Not a required feature + return EFI_UNSUPPORTED; +} + +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers in + lib to virtual mode. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +LibRtcVirtualNotifyEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Only needed if you are going to support the OS calling RTC functions in virtual mode. + // You will need to call EfiConvertPointer (). To convert any stored physical addresses + // to virtual address. After the OS transitions to calling in virtual mode, all future + // runtime calls will be made in virtual mode. + // + EfiConvertPointer (0x0, (VOID**)&mPL031RtcBase); + return; +} + +/** + This is the declaration of an EFI image entry point. This can be the entry point to an application + written to this specification, an EFI boot service driver, or an EFI runtime driver. + + @param ImageHandle Handle that identifies the loaded image. + @param SystemTable System Table for this image. + + @retval EFI_SUCCESS The operation completed successfully. + +**/ +EFI_STATUS +EFIAPI +LibRtcInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + + // Initialize RTC Base Address + mPL031RtcBase = PcdGet32 (PcdPL031RtcBase); + + // Declare the controller as EFI_MEMORY_RUNTIME + Status = gDS->AddMemorySpace ( + EfiGcdMemoryTypeMemoryMappedIo, + mPL031RtcBase, SIZE_4KB, + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gDS->SetMemorySpaceAttributes (mPL031RtcBase, SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); + if (EFI_ERROR (Status)) { + return Status; + } + + // Setup the setters and getters + gRT->GetTime = LibGetTime; + gRT->SetTime = LibSetTime; + gRT->GetWakeupTime = LibGetWakeupTime; + gRT->SetWakeupTime = LibSetWakeupTime; + + // Install the protocol + Handle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiRealTimeClockArchProtocolGuid, NULL, + NULL + ); + ASSERT_EFI_ERROR (Status); + + // + // Register for the virtual address change event + // + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + LibRtcVirtualNotifyEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mRtcVirtualAddrChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf new file mode 100644 index 000000000..9cc6e8898 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf @@ -0,0 +1,46 @@ +#/** @file +# +# Copyright (c) 2006, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PL031RealTimeClockLib + FILE_GUID = 470DFB96-E205-4515-A75E-2E60F853E79D + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + PL031RealTimeClockLib.c + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + IoLib + UefiLib + DebugLib + PcdLib + #ArmPlatformSysConfigLib + DxeServicesTableLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gArmPlatformTokenSpaceGuid.PcdPL031RtcBase + gArmPlatformTokenSpaceGuid.PcdPL031RtcPpmAccuracy diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c new file mode 100644 index 000000000..d21a77401 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c @@ -0,0 +1,79 @@ +/** @file + Null Reset System Library instance that only generates ASSERT() conditions. + + Copyright (c) 2006 - 2009, 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 + +#include +#include + +/** + This function causes a system-wide reset (cold reset), in which + all circuitry within the system returns to its initial state. This type of reset + is asynchronous to system operation and operates without regard to + cycle boundaries. + + If this function returns, it means that the system does not support cold reset. +**/ +VOID +EFIAPI +ResetCold ( + VOID + ) +{ + ASSERT (FALSE); +} + +/** + This function causes a system-wide initialization (warm reset), in which all processors + are set to their initial state. Pending cycles are not corrupted. + + If this function returns, it means that the system does not support warm reset. +**/ +VOID +EFIAPI +ResetWarm ( + VOID + ) +{ + ASSERT (FALSE); +} + +/** + This function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + If this function returns, it means that the system does not support shut down reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ + ASSERT (FALSE); +} + +/** + This function causes the system to enter S3 and then wake up immediately. + + If this function returns, it means that the system does not support S3 feature. +**/ +VOID +EFIAPI +EnterS3WithImmediateWake ( + VOID + ) +{ + ASSERT (FALSE); +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf new file mode 100644 index 000000000..cdfbdc04c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf @@ -0,0 +1,37 @@ +## @file +# Null Reset System Library instance that only generates ASSERT() conditions. +# +# Copyright (c) 2007 - 2010, 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 = BaseResetSystemLibNull + FILE_GUID = 667A8B1C-9C97-4b2a-AE7E-568772FE45F3 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ResetSystemLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + BaseResetSystemLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DebugLib diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/Am335xUart.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/Am335xUart.h new file mode 100644 index 000000000..e20c023ab --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/Am335xUart.h @@ -0,0 +1,38 @@ +#ifndef __AM335XUART_H__ +#define __AM335XUART_H__ + +#define UART0_BASE (0x44E09000) + +#define UART_DLL_REG (0x0000) +#define UART_RBR_REG (0x0000) +#define UART_THR_REG (0x0000) +#define UART_DLH_REG (0x0004) +#define UART_FCR_REG (0x0008) +#define UART_LCR_REG (0x000C) +#define UART_MCR_REG (0x0010) +#define UART_LSR_REG (0x0014) +#define UART_MDR1_REG (0x0020) + +#define UART_FCR_TX_FIFO_CLEAR BIT2 +#define UART_FCR_RX_FIFO_CLEAR BIT1 +#define UART_FCR_FIFO_ENABLE BIT0 + +#define UART_LCR_DIV_EN_ENABLE BIT7 +#define UART_LCR_DIV_EN_DISABLE (0UL << 7) +#define UART_LCR_CHAR_LENGTH_8 (BIT1 | BIT0) + +#define UART_MCR_RTS_FORCE_ACTIVE BIT1 +#define UART_MCR_DTR_FORCE_ACTIVE BIT0 + +#define UART_LSR_TX_FIFO_E_MASK BIT5 +#define UART_LSR_TX_FIFO_E_NOT_EMPTY (0UL << 5) +#define UART_LSR_TX_FIFO_E_EMPTY BIT5 +#define UART_LSR_RX_FIFO_E_MASK BIT0 +#define UART_LSR_RX_FIFO_E_NOT_EMPTY BIT0 +#define UART_LSR_RX_FIFO_E_EMPTY (0UL << 0) + +// BIT2:BIT0 +#define UART_MDR1_MODE_SELECT_DISABLE (7UL) +#define UART_MDR1_MODE_SELECT_UART_16X (0UL) + +#endif // __AM335XUART_H__ diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c new file mode 100644 index 000000000..b5a4b513c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c @@ -0,0 +1,230 @@ +/** @file + 16550 UART Serial Port library functions + + Copyright (c) 2006 - 2012, 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 +#include +#include +#include +#include +#include "Am335xUart.h" +// +// 16550 UART register offsets and bitfields +// + +/** + Read an 8-bit 16550 register. If PcdSerialUseMmio is TRUE, then the value is read from + MMIO space. If PcdSerialUseMmio is FALSE, then the value is read from I/O space. The + parameter Offset is added to the base address of the 16550 registers that is specified + by PcdSerialRegisterBase. + + @param Offset The offset of the 16550 register to read. + + @return The value read from the 16550 register. + +**/ +UINT8 +SerialPortReadRegister ( + UINTN Offset + ) +{ +/* if (PcdGetBool (PcdSerialUseMmio)) { + return MmioRead8 ((UINTN)PcdGet64 (PcdSerialRegisterBase) + Offset); + } else { + return IoRead8 ((UINT16)PcdGet64 (PcdSerialRegisterBase) + Offset); + }*/ +return 0; +} + +/** + Write an 8-bit 16550 register. If PcdSerialUseMmio is TRUE, then the value is written to + MMIO space. If PcdSerialUseMmio is FALSE, then the value is written to I/O space. The + parameter Offset is added to the base address of the 16550 registers that is specified + by PcdSerialRegisterBase. + + @param Offset The offset of the 16550 register to write. + @param Value The value to write to the 16550 register specified by Offset. + + @return The value written to the 16550 register. + +**/ +UINT8 +SerialPortWriteRegister ( + UINTN Offset, + UINT8 Value + ) +{/* + if (PcdGetBool (PcdSerialUseMmio)) { + return MmioWrite8 ((UINTN)PcdGet64 (PcdSerialRegisterBase) + Offset, Value); + } else { + return IoWrite8 ((UINT16)PcdGet64 (PcdSerialRegisterBase) + Offset, Value); + }*/ + return 0; +} + +/** + Return whether the hardware flow control signal allows writing. + + @retval TRUE The serial port is writable. + @retval FALSE The serial port is not writable. +**/ +BOOLEAN +SerialPortWritable ( + VOID + ) +{/* + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { + if (PcdGetBool (PcdSerialDetectCable)) { + // + // Wait for both DSR and CTS to be set + // DSR is set if a cable is connected. + // CTS is set if it is ok to transmit data + // + // DSR CTS Description Action + // === === ======================================== ======== + // 0 0 No cable connected. Wait + // 0 1 No cable connected. Wait + // 1 0 Cable connected, but not clear to send. Wait + // 1 1 Cable connected, and clear to send. Transmit + // + return (BOOLEAN) ((SerialPortReadRegister (R_UART_MSR) & (B_UART_MSR_DSR | B_UART_MSR_CTS)) == (B_UART_MSR_DSR | B_UART_MSR_CTS)); + } else { + // + // Wait for both DSR and CTS to be set OR for DSR to be clear. + // DSR is set if a cable is connected. + // CTS is set if it is ok to transmit data + // + // DSR CTS Description Action + // === === ======================================== ======== + // 0 0 No cable connected. Transmit + // 0 1 No cable connected. Transmit + // 1 0 Cable connected, but not clear to send. Wait + // 1 1 Cable connected, and clar to send. Transmit + // + return (BOOLEAN) ((SerialPortReadRegister (R_UART_MSR) & (B_UART_MSR_DSR | B_UART_MSR_CTS)) != (B_UART_MSR_DSR)); + } + } +*/ + return TRUE; +} + +/** + Initialize the serial device hardware. + + If no initialization is required, then return RETURN_SUCCESS. + If the serial device was successfully initialized, then return RETURN_SUCCESS. + If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. + + @retval RETURN_SUCCESS The serial device was initialized. + @retval RETURN_DEVICE_ERROR The serial device could not be initialized. + +**/ +RETURN_STATUS +EFIAPI +SerialPortInitialize ( + VOID + ) +{ + return RETURN_SUCCESS; +} + +/** + Write data from buffer to serial device. + + Writes NumberOfBytes data bytes from Buffer to the serial device. + The number of bytes actually written to the serial device is returned. + If the return value is less than NumberOfBytes, then the write operation failed. + + If Buffer is NULL, then ASSERT(). + + If NumberOfBytes is zero, then return 0. + + @param Buffer Pointer to the data buffer to be written. + @param NumberOfBytes Number of bytes to written to the serial device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes written to the serial device. + If this value is less than NumberOfBytes, then the read operation failed. + +**/ +UINTN +EFIAPI +SerialPortWrite ( + IN UINT8 *Buffer, + IN UINTN NumberOfBytes +) +{ + UINT32 LSR = UART0_BASE + UART_LSR_REG; + UINT32 THR = UART0_BASE + UART_THR_REG; + + UINTN Count; + for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) { + // wait until ready + while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY); + MmioWrite8 (THR, *Buffer); + } + return NumberOfBytes; +} + +/** + Reads data from a serial device into a buffer. + + @param Buffer Pointer to the data buffer to store the data read from the serial device. + @param NumberOfBytes Number of bytes to read from the serial device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes read from the serial device. + If this value is less than NumberOfBytes, then the read operation failed. + +**/ +UINTN +EFIAPI +SerialPortRead ( + OUT UINT8 *Buffer, + IN UINTN NumberOfBytes +) +{ + UINT32 LSR = UART0_BASE + UART_LSR_REG; + UINT32 RBR = UART0_BASE + UART_RBR_REG; + UINTN Count; + + for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) { + while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY); + *Buffer = MmioRead8(RBR); + } + + return NumberOfBytes; +} + +/** + Polls a serial device to see if there is any data waiting to be read. + + Polls aserial device to see if there is any data waiting to be read. + If there is data waiting to be read from the serial device, then TRUE is returned. + If there is no data waiting to be read from the serial device, then FALSE is returned. + + @retval TRUE Data is waiting to be read from the serial device. + @retval FALSE There is no data waiting to be read from the serial device. + +**/ +BOOLEAN +EFIAPI +SerialPortPoll ( + VOID + ) +{ + // + // Read the serial port status + // + return TRUE; +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf new file mode 100644 index 000000000..26aebc3cc --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf @@ -0,0 +1,42 @@ +## @file +# SerialPortLib instance for 16550 UART +# +# Copyright (c) 2006 - 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 = SerialPortLib + FILE_GUID = 9E7C00CF-355A-4d4e-BF60-0428CFF95540 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SerialPortLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + PcdLib + IoLib + #PlatformHookLib + +[Sources] + SerialPortLib.c + +[Pcd] + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c new file mode 100644 index 000000000..e1842f2a0 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c @@ -0,0 +1,52 @@ +/** @file +* Main file supporting the transition to PEI Core in Normal World for Versatile Express +* +* Copyright (c) 2012-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include + +#include "PrePeiCore.h" + +VOID +PeiCommonExceptionEntry ( + IN UINT32 Entry, + IN UINTN LR + ) +{ + CHAR8 Buffer[100]; + UINTN CharCount; + + switch (Entry) { + case EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS: + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Synchronous Exception at 0x%X\n\r", LR); + break; + case EXCEPT_AARCH64_IRQ: + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r", LR); + break; + case EXCEPT_AARCH64_FIQ: + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r", LR); + break; + case EXCEPT_AARCH64_SERROR: + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SError/Abort Exception at 0x%X\n\r", LR); + break; + default: + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r", LR); + break; + } + + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + while(1); +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S new file mode 100644 index 000000000..cdc8d925b --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S @@ -0,0 +1,81 @@ +# +# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include +#include +#include + +.text +.align 11 + +GCC_ASM_EXPORT(PeiVectorTable) + +//============================================================ +//Default Exception Handlers +//============================================================ + +ASM_PFX(PeiVectorTable): + + +#define TO_HANDLER \ + EL1_OR_EL2(x1) \ +1: mrs x1, elr_el1 /* EL1 Exception Link Register */ ;\ + b 3f ;\ +2: mrs x1, elr_el2 /* EL2 Exception Link Register */ ;\ +3: bl ASM_PFX(PeiCommonExceptionEntry) ; + + +// +// Default Exception handlers: There is no plan to return from any of these exceptions. +// No context saving at all. +// + +.align 7 +_DefaultSyncExceptHandler_t: + mov x0, #EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS + TO_HANDLER + +.align 7 +_DefaultIrq_t: + mov x0, #EXCEPT_AARCH64_IRQ + TO_HANDLER + +.align 7 +_DefaultFiq_t: + mov x0, #EXCEPT_AARCH64_FIQ + TO_HANDLER + +.align 7 +_DefaultSError_t: + mov x0, #EXCEPT_AARCH64_SERROR + TO_HANDLER + +.align 7 +_DefaultSyncExceptHandler_h: + mov x0, #EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS + TO_HANDLER + +.align 7 +_DefaultIrq_h: + mov x0, #EXCEPT_AARCH64_IRQ + TO_HANDLER + +.align 7 +_DefaultFiq_h: + mov x0, #EXCEPT_AARCH64_FIQ + TO_HANDLER + +.align 7 +_DefaultSError_h: + mov x0, #EXCEPT_AARCH64_SERROR + TO_HANDLER diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S new file mode 100644 index 000000000..8e23b0389 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S @@ -0,0 +1,48 @@ +#======================================================================================== +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http:#opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#======================================================================================= + +#include +#include + +#start of the code section +.text +.align 3 + +GCC_ASM_EXPORT(SetupExceptionLevel1) +GCC_ASM_EXPORT(SetupExceptionLevel2) + +// Setup EL1 while in EL1 +ASM_PFX(SetupExceptionLevel1): + mov x5, x30 // Save LR + + mov x0, #CPACR_CP_FULL_ACCESS + bl ASM_PFX(ArmWriteCpacr) // Disable copro traps to EL1 + + ret x5 + +// Setup EL2 while in EL2 +ASM_PFX(SetupExceptionLevel2): + msr sctlr_el2, xzr + mrs x0, hcr_el2 // Read EL2 Hypervisor configuration Register + + // Send all interrupts to their respective Exception levels for EL2 + orr x0, x0, #(1 << 3) // Enable EL2 FIQ + orr x0, x0, #(1 << 4) // Enable EL2 IRQ + orr x0, x0, #(1 << 5) // Enable EL2 SError and Abort + msr hcr_el2, x0 // Write back our settings + + msr cptr_el2, xzr // Disable copro traps to EL2 + + ret + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S new file mode 100644 index 000000000..b84190cf3 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S @@ -0,0 +1,110 @@ +// +// Copyright (c) 2011-2014, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include + +.text +.align 3 + +GCC_ASM_IMPORT(CEntryPoint) +GCC_ASM_IMPORT(ArmPlatformGetCorePosition) +GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) +GCC_ASM_IMPORT(ArmReadMpidr) +GCC_ASM_IMPORT(ArmPlatformPeiBootAction) +GCC_ASM_EXPORT(_ModuleEntryPoint) + +StartupAddr: .8byte CEntryPoint + +ASM_PFX(_ModuleEntryPoint): + // Do early platform specific actions + bl ASM_PFX(ArmPlatformPeiBootAction) + +// NOTE: We could be booting from EL3, EL2 or EL1. Need to correctly detect +// and configure the system accordingly. EL2 is default if possible. +// If we started in EL3 we need to switch and run at EL2. +// If we are running at EL2 stay in EL2 +// If we are starting at EL1 stay in EL1. + +// If started at EL3 Sec is run and switches to EL2 before jumping to PEI. +// If started at EL1 or EL2 Sec jumps directly to PEI without making any +// changes. + +// Which EL are we running at? Every EL needs some level of setup... +// We should not run this code in EL3 + EL1_OR_EL2(x0) +1:bl ASM_PFX(SetupExceptionLevel1) + b ASM_PFX(MainEntryPoint) +2:bl ASM_PFX(SetupExceptionLevel2) + b ASM_PFX(MainEntryPoint) + +ASM_PFX(MainEntryPoint): + // Identify CPU ID + bl ASM_PFX(ArmReadMpidr) + // Keep a copy of the MpId register value + mov x5, x0 + + // Is it the Primary Core ? + bl ASM_PFX(ArmPlatformIsPrimaryCore) + + // Get the top of the primary stacks (and the base of the secondary stacks) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), x1) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) + add x1, x1, x2 + + // x0 is equal to 1 if I am the primary core + cmp x0, #1 + b.eq _SetupPrimaryCoreStack + +_SetupSecondaryCoreStack: + // x1 contains the base of the secondary stacks + + // Get the Core Position + mov x6, x1 // Save base of the secondary stacks + mov x0, x5 + bl ASM_PFX(ArmPlatformGetCorePosition) + // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack + add x0, x0, #1 + + // StackOffset = CorePos * StackSize + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x2) + mul x0, x0, x2 + // SP = StackBase + StackOffset + add sp, x6, x0 + +_PrepareArguments: + // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector + LoadConstantToReg (FixedPcdGet64(PcdFvBaseAddress), x2) + add x2, x2, #8 + ldr x1, [x2] + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped alias) + ldr x3, StartupAddr + + // Jump to PrePeiCore C code + // x0 = mp_id + // x1 = pei_core_address + mov x0, x5 + blr x3 + +_SetupPrimaryCoreStack: + // x1 contains the top of the primary stack + LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x2) + + // The reserved space for global variable must be 16-bytes aligned for pushing + // 128-bit variable on the stack + SetPrimaryStack (x1, x2, x3, x4) + b _PrepareArguments diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S new file mode 100644 index 000000000..8d8351051 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S @@ -0,0 +1,43 @@ +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+# Portions copyright (c) 2011 - 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 +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#------------------------------------------------------------------------------ + +.text +.align 3 + +GCC_ASM_EXPORT(SecSwitchStack) + + + +#/** +# This allows the caller to switch the stack and return +# +# @param StackDelta Signed amount by which to modify the stack pointer +# +# @return Nothing. Goes to the Entry Point passing in the new parameters +# +#**/ +#VOID +#EFIAPI +#SecSwitchStack ( +# VOID *StackDelta +# )# +# +ASM_PFX(SecSwitchStack): + mov x1, sp + add x1, x0, x1 + mov sp, x1 + ret + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c new file mode 100644 index 000000000..b0594ae2c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/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 +#include + +#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/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S new file mode 100644 index 000000000..abce21d0a --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S @@ -0,0 +1,102 @@ +// +// Copyright (c) 2011, ARM Limited. All rights reserved. +// +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include +#include +#include + +#start of the code section +.text +.align 5 + +# IMPORT +GCC_ASM_IMPORT(PeiCommonExceptionEntry) + +# EXPORT +GCC_ASM_EXPORT(PeiVectorTable) + +//============================================================ +//Default Exception Handlers +//============================================================ + + +ASM_PFX(PeiVectorTable): + b _DefaultResetHandler + b _DefaultUndefined + b _DefaultSWI + b _DefaultPrefetchAbort + b _DefaultDataAbort + b _DefaultReserved + b _DefaultIrq + b _DefaultFiq + +// +// Default Exception handlers: There is no plan to return from any of these exceptions. +// No context saving at all. +// +_DefaultResetHandler: + mov r1, lr + # Switch to SVC for common stack + cps #0x13 + mov r0, #0 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultUndefined: + sub r1, LR, #4 + # Switch to SVC for common stack + cps #0x13 + mov r0, #1 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultSWI: + sub r1, LR, #4 + # Switch to SVC for common stack + cps #0x13 + mov r0, #2 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultPrefetchAbort: + sub r1, LR, #4 + # Switch to SVC for common stack + cps #0x13 + mov r0, #3 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultDataAbort: + sub r1, LR, #8 + # Switch to SVC for common stack + cps #0x13 + mov r0, #4 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultReserved: + mov r1, lr + # Switch to SVC for common stack + cps #0x13 + mov r0, #5 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultIrq: + sub r1, LR, #4 + # Switch to SVC for common stack + cps #0x13 + mov r0, #6 + blx ASM_PFX(PeiCommonExceptionEntry) + +_DefaultFiq: + sub r1, LR, #4 + # Switch to SVC for common stack + cps #0x13 + mov r0, #7 + blx ASM_PFX(PeiCommonExceptionEntry) + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm new file mode 100644 index 000000000..55bd4af1d --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm @@ -0,0 +1,91 @@ +// +// Copyright (c) 2011, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include + + IMPORT PeiCommonExceptionEntry + EXPORT PeiVectorTable + + PRESERVE8 + AREA PrePeiCoreException, CODE, READONLY, CODEALIGN, ALIGN=5 + +//============================================================ +//Default Exception Handlers +//============================================================ + + +PeiVectorTable + b _DefaultResetHandler + b _DefaultUndefined + b _DefaultSWI + b _DefaultPrefetchAbort + b _DefaultDataAbort + b _DefaultReserved + b _DefaultIrq + b _DefaultFiq + +// +// Default Exception handlers: There is no plan to return from any of these exceptions. +// No context saving at all. +// +_DefaultResetHandler + mov r1, lr + cps #0x13 ; Switch to SVC for common stack + mov r0, #0 + blx PeiCommonExceptionEntry + +_DefaultUndefined + sub r1, LR, #4 + cps #0x13 ; Switch to SVC for common stack + mov r0, #1 + blx PeiCommonExceptionEntry + +_DefaultSWI + sub r1, LR, #4 + cps #0x13 ; Switch to SVC for common stack + mov r0, #2 + blx PeiCommonExceptionEntry + +_DefaultPrefetchAbort + sub r1, LR, #4 + cps #0x13 ; Switch to SVC for common stack + mov r0, #3 + blx PeiCommonExceptionEntry + +_DefaultDataAbort + sub r1, LR, #8 + cps #0x13 ; Switch to SVC for common stack + mov r0, #4 + blx PeiCommonExceptionEntry + +_DefaultReserved + mov r1, lr + cps #0x13 ; Switch to SVC for common stack + mov r0, #5 + blx PeiCommonExceptionEntry + +_DefaultIrq + sub r1, LR, #4 + cps #0x13 ; Switch to SVC for common stack + mov r0, #6 + blx PeiCommonExceptionEntry + +_DefaultFiq + sub r1, LR, #4 + cps #0x13 ; Switch to SVC for common stack + mov r0, #7 + blx PeiCommonExceptionEntry + + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S new file mode 100644 index 000000000..cad750d31 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S @@ -0,0 +1,89 @@ +// +// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include + +.text +.align 3 + +GCC_ASM_IMPORT(CEntryPoint) +GCC_ASM_IMPORT(ArmPlatformGetCorePosition) +GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) +GCC_ASM_IMPORT(ArmReadMpidr) +GCC_ASM_IMPORT(ArmPlatformPeiBootAction) +GCC_ASM_EXPORT(_ModuleEntryPoint) + +ASM_PFX(_ModuleEntryPoint): + // Do early platform specific actions + bl ASM_PFX(ArmPlatformPeiBootAction) + + // Identify CPU ID + bl ASM_PFX(ArmReadMpidr) + // Keep a copy of the MpId register value + mov r5, r0 + + // Is it the Primary Core ? + bl ASM_PFX(ArmPlatformIsPrimaryCore) + + // Get the top of the primary stacks (and the base of the secondary stacks) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + add r1, r1, r2 + + // r0 is equal to 1 if I am the primary core + cmp r0, #1 + beq _SetupPrimaryCoreStack + +_SetupSecondaryCoreStack: + // r1 contains the base of the secondary stacks + + // Get the Core Position + mov r6, r1 // Save base of the secondary stacks + mov r0, r5 + bl ASM_PFX(ArmPlatformGetCorePosition) + // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack + add r0, r0, #1 + + // StackOffset = CorePos * StackSize + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2) + mul r0, r0, r2 + // SP = StackBase + StackOffset + add sp, r6, r0 + +_PrepareArguments: + // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector + LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2) + add r2, r2, #4 + ldr r1, [r2] + + // Jump to PrePeiCore C code + // r0 = mp_id + // r1 = pei_core_address + mov r0, r5 + blx ASM_PFX (CEntryPoint) + +_SetupPrimaryCoreStack: + // r1 contains the top of the primary stack + LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2) + + // The reserved space for global variable must be 8-bytes aligned for pushing + // 64-bit variable on the stack + // Assuming Stack already setup by SPL + // SetPrimaryStack (r1, r2, r3) + b _PrepareArguments + +_NeverReturn: + b _NeverReturn diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm new file mode 100644 index 000000000..be1a76769 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm @@ -0,0 +1,98 @@ +// +// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include + + INCLUDE AsmMacroIoLib.inc + + IMPORT CEntryPoint + IMPORT ArmPlatformGetCorePosition + IMPORT ArmPlatformIsPrimaryCore + IMPORT ArmReadMpidr + IMPORT ArmPlatformPeiBootAction + EXPORT _ModuleEntryPoint + + PRESERVE8 + AREA PrePeiCoreEntryPoint, CODE, READONLY + +StartupAddr DCD CEntryPoint + +_ModuleEntryPoint + // Do early platform specific actions + bl ArmPlatformPeiBootAction + + // Identify CPU ID + bl ArmReadMpidr + // Keep a copy of the MpId register value + mov r5, r0 + + // Is it the Primary Core ? + bl ArmPlatformIsPrimaryCore + + // Get the top of the primary stacks (and the base of the secondary stacks) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + add r1, r1, r2 + + // r0 is equal to 1 if I am the primary core + cmp r0, #1 + beq _SetupPrimaryCoreStack + +_SetupSecondaryCoreStack + // r1 contains the base of the secondary stacks + + // Get the Core Position + mov r6, r1 // Save base of the secondary stacks + mov r0, r5 + bl ArmPlatformGetCorePosition + // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack + add r0, r0, #1 + + // StackOffset = CorePos * StackSize + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2) + mul r0, r0, r2 + // SP = StackBase + StackOffset + add sp, r6, r0 + +_PrepareArguments + // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector + LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2) + add r2, r2, #4 + ldr r1, [r2] + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped alias) + ldr r3, StartupAddr + + // Jump to PrePeiCore C code + // r0 = mp_id + // r1 = pei_core_address + mov r0, r5 + blx r3 + +_SetupPrimaryCoreStack + // r1 contains the top of the primary stack + LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2) + + // The reserved space for global variable must be 8-bytes aligned for pushing + // 64-bit variable on the stack + SetPrimaryStack (r1, r2, r3) + b _PrepareArguments + +_NeverReturn + b _NeverReturn + + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S new file mode 100644 index 000000000..2543f5841 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S @@ -0,0 +1,43 @@ +#------------------------------------------------------------------------------ +# +# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+# Portions copyright (c) 2008 - 2009, Apple Inc. 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(SecSwitchStack) + + + +#/** +# This allows the caller to switch the stack and return +# +# @param StackDelta Signed amount by which to modify the stack pointer +# +# @return Nothing. Goes to the Entry Point passing in the new parameters +# +#**/ +#VOID +#EFIAPI +#SecSwitchStack ( +# VOID *StackDelta +# )# +# +ASM_PFX(SecSwitchStack): + mov R1, R13 + add R1, R0, R1 + mov R13, R1 + bx LR + + + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm new file mode 100644 index 000000000..10da81d6a --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm @@ -0,0 +1,38 @@ +;------------------------------------------------------------------------------ +; +; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+; Portions copyright (c) 2008 - 2009, Apple Inc. 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 SecSwitchStack + + AREA Switch_Stack, CODE, READONLY + +;/** +; This allows the caller to switch the stack and return +; +; @param StackDelta Signed amount by which to modify the stack pointer +; +; @return Nothing. Goes to the Entry Point passing in the new parameters +; +;**/ +;VOID +;EFIAPI +;SecSwitchStack ( +; VOID *StackDelta +; ); +; +SecSwitchStack + MOV R1, SP + ADD R1, R0, R1 + MOV SP, R1 + BX LR + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c new file mode 100644 index 000000000..9bfc99062 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c @@ -0,0 +1,151 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include + +#include "PrePeiCore.h" + +/* + * This is the main function for secondary cores. They loop around until a non Null value is written to + * SYS_FLAGS register.The SYS_FLAGS register is platform specific. + * Note:The secondary cores, while executing secondary_main, assumes that: + * : SGI 0 is configured as Non-secure interrupt + * : Priority Mask is configured to allow SGI 0 + * : Interrupt Distributor and CPU interfaces are enabled + * + */ +VOID +EFIAPI +SecondaryMain ( + IN UINTN MpId + ) +{ + EFI_STATUS Status; + UINTN PpiListSize; + UINTN PpiListCount; + EFI_PEI_PPI_DESCRIPTOR *PpiList; + ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi; + UINTN Index; + UINTN ArmCoreCount; + ARM_CORE_INFO *ArmCoreInfoTable; + UINT32 ClusterId; + UINT32 CoreId; + VOID (*SecondaryStart)(VOID); + UINTN SecondaryEntryAddr; + + ClusterId = GET_CLUSTER_ID(MpId); + CoreId = GET_CORE_ID(MpId); + + // Get the gArmMpCoreInfoPpiGuid + PpiListSize = 0; + ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); + PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); + for (Index = 0; Index < PpiListCount; Index++, PpiList++) { + if (CompareGuid (PpiList->Guid, &gArmMpCoreInfoPpiGuid) == TRUE) { + break; + } + } + + // On MP Core Platform we must implement the ARM MP Core Info PPI + ASSERT (Index != PpiListCount); + + ArmMpCoreInfoPpi = PpiList->Ppi; + ArmCoreCount = 0; + Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable); + ASSERT_EFI_ERROR (Status); + + // Find the core in the ArmCoreTable + for (Index = 0; Index < ArmCoreCount; Index++) { + if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) { + break; + } + } + + // The ARM Core Info Table must define every core + ASSERT (Index != ArmCoreCount); + + // Clear Secondary cores MailBox + MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue); + + do { + ArmCallWFI (); + + // Read the Mailbox + SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress); + + // Acknowledge the interrupt and send End of Interrupt signal. + ArmGicAcknowledgeInterrupt (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase), NULL, NULL); + } while (SecondaryEntryAddr == 0); + + // Jump to secondary core entry point. + SecondaryStart = (VOID (*)())SecondaryEntryAddr; + SecondaryStart(); + + // The secondaries shouldn't reach here + ASSERT(FALSE); +} + +VOID +EFIAPI +PrimaryMain ( + IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint + ) +{ + EFI_SEC_PEI_HAND_OFF SecCoreData; + UINTN PpiListSize; + EFI_PEI_PPI_DESCRIPTOR *PpiList; + UINTN TemporaryRamBase; + UINTN TemporaryRamSize; + + CreatePpiList (&PpiListSize, &PpiList); + + // Enable the GIC Distributor + ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase)); + + // If ArmVe has not been built as Standalone then we need to wake up the secondary cores + if (FeaturePcdGet (PcdSendSgiToBringUpSecondaryCores)) { + // Sending SGI to all the Secondary CPU interfaces + ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); + } + + // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at + // the base of the primary core stack + PpiListSize = ALIGN_VALUE(PpiListSize, 0x4); + TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize; + TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize; + + // Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned + // to ensure the stack pointer is 4-byte aligned. + TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1)); + + // + // Bind this information into the SEC hand-off state + // Note: this must be in sync with the stuff in the asm file + // Note also: HOBs (pei temp ram) MUST be above stack + // + SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF); + SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress); + SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize); + SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack) + SecCoreData.TemporaryRamSize = TemporaryRamSize; + SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase; + SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2; + SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4); + SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase; + + // Jump to PEI core entry point + PeiCoreEntryPoint (&SecCoreData, PpiList); +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c new file mode 100644 index 000000000..b437ad651 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c @@ -0,0 +1,67 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "PrePeiCore.h" + +VOID +EFIAPI +SecondaryMain ( + IN UINTN MpId + ) +{ + ASSERT(FALSE); +} + +VOID +EFIAPI +PrimaryMain ( + IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint + ) +{ + EFI_SEC_PEI_HAND_OFF SecCoreData; + UINTN PpiListSize; + EFI_PEI_PPI_DESCRIPTOR *PpiList; + UINTN TemporaryRamBase; + UINTN TemporaryRamSize; + + CreatePpiList (&PpiListSize, &PpiList); + + // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at + // the base of the primary core stack + PpiListSize = ALIGN_VALUE(PpiListSize, 0x4); + TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize; + TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize; + + // Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned + // to ensure the stack pointer is 4-byte aligned. + TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1)); + + // + // Bind this information into the SEC hand-off state + // Note: this must be in sync with the stuff in the asm file + // Note also: HOBs (pei temp ram) MUST be above stack + // + SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF); + SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress); + SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize); + SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack) + SecCoreData.TemporaryRamSize = TemporaryRamSize; + SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase; + SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2; + SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4); + SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase; + + // Jump to PEI core entry point + (PeiCoreEntryPoint)(&SecCoreData, PpiList); +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c new file mode 100644 index 000000000..633ea457c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c @@ -0,0 +1,162 @@ +/** @file +* Main file supporting the transition to PEI Core in Normal World for Versatile Express +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include + +#include + +#include "PrePeiCore.h" + +EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi = { PrePeiCoreTemporaryRamSupport }; +ARM_GLOBAL_VARIABLE_PPI mGlobalVariablePpi = { PrePeiCoreGetGlobalVariableMemory }; + +EFI_PEI_PPI_DESCRIPTOR gCommonPpiTable[] = { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gEfiTemporaryRamSupportPpiGuid, + &mTemporaryRamSupportPpi + }, + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gArmGlobalVariablePpiGuid, + &mGlobalVariablePpi + } +}; + +VOID +CreatePpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + EFI_PEI_PPI_DESCRIPTOR *PlatformPpiList; + UINTN PlatformPpiListSize; + UINTN ListBase; + EFI_PEI_PPI_DESCRIPTOR *LastPpi; + + // Get the Platform PPIs + PlatformPpiListSize = 0; + ArmPlatformGetPlatformPpiList (&PlatformPpiListSize, &PlatformPpiList); + + // Copy the Common and Platform PPis in Temporrary Memory + ListBase = FixedPcdGet32 (PcdCPUCoresStackBase); + CopyMem ((VOID*)ListBase, gCommonPpiTable, sizeof(gCommonPpiTable)); + CopyMem ((VOID*)(ListBase + sizeof(gCommonPpiTable)), PlatformPpiList, PlatformPpiListSize); + + // Set the Terminate flag on the last PPI entry + LastPpi = (EFI_PEI_PPI_DESCRIPTOR*)ListBase + ((sizeof(gCommonPpiTable) + PlatformPpiListSize) / sizeof(EFI_PEI_PPI_DESCRIPTOR)) - 1; + LastPpi->Flags |= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; + + *PpiList = (EFI_PEI_PPI_DESCRIPTOR*)ListBase; + *PpiListSize = sizeof(gCommonPpiTable) + PlatformPpiListSize; +} + +VOID +CEntryPoint ( + IN UINTN MpId, + IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint + ) +{ + // Data Cache enabled on Primary core when MMU is enabled. + ArmDisableDataCache (); + // Invalidate Data cache + // ArmInvalidateDataCache (); + // Invalidate instruction cache + // ArmInvalidateInstructionCache (); + // Enable Instruction Caches on all cores. + ArmEnableInstructionCache (); + + // + // Note: Doesn't have to Enable CPU interface in non-secure world, + // as Non-secure interface is already enabled in Secure world. + // + + // Write VBAR - The Exception Vector table must be aligned to its requirement + //TODO: Fix baseTools to ensure the Exception Vector Table is correctly aligned in AArch64 + //ASSERT(((UINTN)PeiVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0); + // ArmWriteVBar ((UINTN)PeiVectorTable); + + //Note: The MMU will be enabled by MemoryPeim. Only the primary core will have the MMU on. + + // If not primary Jump to Secondary Main + if (ArmPlatformIsPrimaryCore (MpId)) { + // Initialize the Debug Agent for Source Level Debugging + InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); + SaveAndSetDebugTimerInterrupt (TRUE); + + // Initialize the platform specific controllers + ArmPlatformInitialize (MpId); + + // Goto primary Main. + PrimaryMain (PeiCoreEntryPoint); + } else { + SecondaryMain (MpId); + } + + // PEI Core should always load and never return + ASSERT (FALSE); +} + +EFI_STATUS +EFIAPI +PrePeiCoreTemporaryRamSupport ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, + IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, + IN UINTN CopySize + ) +{ + VOID *OldHeap; + VOID *NewHeap; + VOID *OldStack; + VOID *NewStack; + + OldHeap = (VOID*)(UINTN)TemporaryMemoryBase; + NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize >> 1)); + + OldStack = (VOID*)((UINTN)TemporaryMemoryBase + (CopySize >> 1)); + NewStack = (VOID*)(UINTN)PermanentMemoryBase; + + // + // Migrate the temporary memory stack to permanent memory stack. + // + CopyMem (NewStack, OldStack, CopySize >> 1); + + // + // Migrate the temporary memory heap to permanent memory heap. + // + CopyMem (NewHeap, OldHeap, CopySize >> 1); + + SecSwitchStack ((UINTN)NewStack - (UINTN)OldStack); + + return EFI_SUCCESS; +} + +EFI_STATUS +PrePeiCoreGetGlobalVariableMemory ( + OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase + ) +{ + ASSERT (GlobalVariableBase != NULL); + + *GlobalVariableBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + + (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - + (UINTN)PcdGet32 (PcdPeiGlobalVariableSize); + + return EFI_SUCCESS; +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h new file mode 100644 index 000000000..20684e2f9 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h @@ -0,0 +1,83 @@ +/** @file +* Main file supporting the transition to PEI Core in Normal World for Versatile Express +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __PREPEICORE_H_ +#define __PREPEICORE_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include + +VOID +CreatePpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ); + +EFI_STATUS +EFIAPI +PrePeiCoreTemporaryRamSupport ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, + IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, + IN UINTN CopySize + ); + +EFI_STATUS +PrePeiCoreGetGlobalVariableMemory ( + OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase + ); + +VOID +SecSwitchStack ( + INTN StackDelta + ); + +// Vector Table for Pei Phase +VOID PeiVectorTable (VOID); + +VOID +EFIAPI +PrimaryMain ( + IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint + ); + +/* + * This is the main function for secondary cores. They loop around until a non Null value is written to + * SYS_FLAGS register.The SYS_FLAGS register is platform specific. + * Note:The secondary cores, while executing secondary_main, assumes that: + * : SGI 0 is configured as Non-secure interrupt + * : Priority Mask is configured to allow SGI 0 + * : Interrupt Distributor and CPU interfaces are enabled + * + */ +VOID +EFIAPI +SecondaryMain ( + IN UINTN MpId + ); + +VOID +PeiCommonExceptionEntry ( + IN UINT32 Entry, + IN UINTN LR + ); + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf new file mode 100644 index 000000000..3b441d443 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf @@ -0,0 +1,82 @@ +#/** @file +# Pre PeiCore - Hand-off to PEI Core in Normal World +# +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformPrePeiCore + FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + +[Sources.common] + MainMPCore.c + PrePeiCore.c + +[Sources.ARM] + Arm/ArchPrePeiCore.c + Arm/PrePeiCoreEntryPoint.asm | RVCT + Arm/PrePeiCoreEntryPoint.S | GCC + Arm/SwitchStack.asm | RVCT + Arm/SwitchStack.S | GCC + Arm/Exception.asm | RVCT + Arm/Exception.S | GCC + +[Sources.AARCH64] + AArch64/ArchPrePeiCore.c + AArch64/PrePeiCoreEntryPoint.S + AArch64/SwitchStack.S + AArch64/Exception.S + AArch64/Helper.S + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + ArmPlatformLib + BaseLib + DebugLib + DebugAgentLib + IoLib + ArmGicLib + PrintLib + SerialPortLib + +[Ppis] + gEfiTemporaryRamSupportPpiGuid + gArmGlobalVariablePpiGuid + gArmMpCoreInfoPpiGuid + +[FeaturePcd] + gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + + gArmTokenSpaceGuid.PcdArmPrimaryCore + + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize + + gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize + + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicSgiIntId diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf new file mode 100644 index 000000000..f50d21fa6 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf @@ -0,0 +1,77 @@ +#/** @file +# Pre PeiCore - Hand-off to PEI Core in Normal World +# +# Copyright (c) 2011, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformPrePeiCore + FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + +[Sources.common] + PrePeiCore.c + MainUniCore.c + +[Sources.ARM] + Arm/ArchPrePeiCore.c + Arm/PrePeiCoreEntryPoint.asm | RVCT + Arm/PrePeiCoreEntryPoint.S | GCC + Arm/SwitchStack.asm | RVCT + Arm/SwitchStack.S | GCC + Arm/Exception.asm | RVCT + Arm/Exception.S | GCC + +[Sources.AARCH64] + AArch64/ArchPrePeiCore.c + AArch64/PrePeiCoreEntryPoint.S + AArch64/SwitchStack.S + AArch64/Exception.S + AArch64/Helper.S + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + ArmPlatformLib + BaseLib + DebugLib + DebugAgentLib + IoLib + PrintLib + SerialPortLib + +[Ppis] + gEfiTemporaryRamSupportPpiGuid + gArmGlobalVariablePpiGuid + +[FeaturePcd] + gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize + + gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize + + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c new file mode 100644 index 000000000..217986107 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c @@ -0,0 +1,33 @@ +/** @file +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "PrePi.h" + +#include + +VOID +ArchInitialize ( + VOID + ) +{ + // Enable Floating Point + if (FixedPcdGet32 (PcdVFPEnabled)) { + ArmEnableVFP (); + } + + if (ArmReadCurrentEL () == AARCH64_EL2) { + // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2 + ArmWriteHcr (ARM_HCR_TGE); + } +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S new file mode 100644 index 000000000..fcea9496c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -0,0 +1,146 @@ +// +// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include + +.text +.align 3 + +GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) +GCC_ASM_IMPORT(ArmReadMpidr) +GCC_ASM_IMPORT(ArmPlatformPeiBootAction) +GCC_ASM_IMPORT(ArmPlatformStackSet) +GCC_ASM_EXPORT(_ModuleEntryPoint) + +StartupAddr: .8byte ASM_PFX(CEntryPoint) + +ASM_PFX(_ModuleEntryPoint): + // Do early platform specific actions + bl ASM_PFX(ArmPlatformPeiBootAction) + + // Get ID of this CPU in Multicore system + bl ASM_PFX(ArmReadMpidr) + // Keep a copy of the MpId register value + mov x10, x0 + +_SetSVCMode: +// Check if we can install the stack at the top of the System Memory or if we need +// to install the stacks at the bottom of the Firmware Device (case the FD is located +// at the top of the DRAM) +_SetupStackPosition: + // Compute Top of System Memory + LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), x1) + LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), x2) + sub x2, x2, #1 + add x1, x1, x2 // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize + + // Calculate Top of the Firmware Device + LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2) + LoadConstantToReg (FixedPcdGet32(PcdFdSize), x3) + sub x3, x3, #1 + add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize + + // UEFI Memory Size (stacks are allocated in this region) + LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), x4) + + // + // Reserve the memory for the UEFI region (contain stacks on its top) + // + + // Calculate how much space there is between the top of the Firmware and the Top of the System Memory + subs x0, x1, x3 // x0 = SystemMemoryTop - FdTop + b.mi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM + cmp x0, x4 + b.ge _SetupStack + + // Case the top of stacks is the FdBaseAddress + mov x1, x2 + +_SetupStack: + // x1 contains the top of the stack (and the UEFI Memory) + + // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment + // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the + // top of the memory space) + adds x11, x1, #1 + b.cs _SetupOverflowStack + +_SetupAlignedStack: + mov x1, x11 + b _GetBaseUefiMemory + +_SetupOverflowStack: + // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE + // aligned (4KB) + LoadConstantToReg (EFI_PAGE_MASK, x11) + and x11, x11, x1 + sub x1, x1, x11 + +_GetBaseUefiMemory: + // Calculate the Base of the UEFI Memory + sub x11, x1, x4 + +_GetStackBase: + // r1 = The top of the Mpcore Stacks + // Stack for the primary core = PrimaryCoreStack + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) + sub x12, x1, x2 + + // Stack for the secondary core = Number of Cores - 1 + LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0) + sub x0, x0, #1 + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1) + mul x1, x1, x0 + sub x12, x12, x1 + + // x12 = The base of the MpCore Stacks (primary stack & secondary stacks) + mov x0, x12 + mov x1, x10 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x3) + bl ASM_PFX(ArmPlatformStackSet) + + // Is it the Primary Core ? + mov x0, x10 + bl ASM_PFX(ArmPlatformIsPrimaryCore) + cmp x0, #1 + bne _PrepareArguments + +_ReserveGlobalVariable: + LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x0) + // InitializePrimaryStack($GlobalVariableSize, $Tmp1, $Tmp2) + InitializePrimaryStack(x0, x1, x2) + +_PrepareArguments: + mov x0, x10 + mov x1, x11 + mov x2, x12 + mov x3, sp + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped alias) + ldr x4, StartupAddr + + // Jump to PrePiCore C code + // x0 = MpId + // x1 = UefiMemoryBase + // x2 = StacksBase + // x3 = GlobalVariableBase + blr x4 + +_NeverReturn: + b _NeverReturn diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c new file mode 100644 index 000000000..075eb89e1 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c @@ -0,0 +1,29 @@ +/** @file +* +* Copyright (c) 2011 - 2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "PrePi.h" + +VOID +ArchInitialize ( + VOID + ) +{ + // Enable program flow prediction, if supported. + ArmEnableBranchPrediction (); + + if (FixedPcdGet32 (PcdVFPEnabled)) { + ArmEnableVFP (); + } +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S new file mode 100644 index 000000000..a305a50e2 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S @@ -0,0 +1,155 @@ +// +// Copyright (c) 2011-2014, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include + +#include + +.text +.align 3 + +GCC_ASM_IMPORT(CEntryPoint) +GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) +GCC_ASM_IMPORT(ArmReadMpidr) +GCC_ASM_IMPORT(ArmPlatformPeiBootAction) +GCC_ASM_IMPORT(ArmPlatformStackSet) +GCC_ASM_EXPORT(_ModuleEntryPoint) + +StartupAddr: .word CEntryPoint + + +ASM_PFX(_ModuleEntryPoint): + // Do early platform specific actions + bl ASM_PFX(ArmPlatformPeiBootAction) + + // Get ID of this CPU in Multicore system + bl ASM_PFX(ArmReadMpidr) + // Keep a copy of the MpId register value + mov r8, r0 + +_SetSVCMode: + // Enter SVC mode, Disable FIQ and IRQ + mov r1, #(CPSR_MODE_SVC | CPSR_IRQ | CPSR_FIQ) + msr CPSR_c, r1 + +// Check if we can install the stack at the top of the System Memory or if we need +// to install the stacks at the bottom of the Firmware Device (case the FD is located +// at the top of the DRAM) +_SetupStackPosition: + // Compute Top of System Memory + LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), r1) + LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), r2) + sub r2, r2, #1 + add r1, r1, r2 // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize + + // Calculate Top of the Firmware Device + LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2) + LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3) + sub r3, r3, #1 + add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize + + // UEFI Memory Size (stacks are allocated in this region) + LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4) + + // + // Reserve the memory for the UEFI region (contain stacks on its top) + // + + // Calculate how much space there is between the top of the Firmware and the Top of the System Memory + subs r0, r1, r3 // r0 = SystemMemoryTop - FdTop + bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM + cmp r0, r4 + bge _SetupStack + + // Case the top of stacks is the FdBaseAddress + mov r1, r2 + +_SetupStack: + // r1 contains the top of the stack (and the UEFI Memory) + + // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment + // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the + // top of the memory space) + adds r9, r1, #1 + bcs _SetupOverflowStack + +_SetupAlignedStack: + mov r1, r9 + b _GetBaseUefiMemory + +_SetupOverflowStack: + // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE + // aligned (4KB) + LoadConstantToReg (EFI_PAGE_MASK, r9) + and r9, r9, r1 + sub r1, r1, r9 + +_GetBaseUefiMemory: + // Calculate the Base of the UEFI Memory + sub r9, r1, r4 + +_GetStackBase: + // r1 = The top of the Mpcore Stacks + // Stack for the primary core = PrimaryCoreStack + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + sub r10, r1, r2 + + // Stack for the secondary core = Number of Cores - 1 + LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0) + sub r0, r0, #1 + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1) + mul r1, r1, r0 + sub r10, r10, r1 + + // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) + mov r0, r10 + mov r1, r8 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3) + bl ASM_PFX(ArmPlatformStackSet) + + // Is it the Primary Core ? + mov r0, r8 + bl ASM_PFX(ArmPlatformIsPrimaryCore) + cmp r0, #1 + bne _PrepareArguments + +_ReserveGlobalVariable: + LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r0) + // InitializePrimaryStack($GlobalVariableSize, $Tmp1) + InitializePrimaryStack(r0, r1) + +_PrepareArguments: + mov r0, r8 + mov r1, r9 + mov r2, r10 + mov r3, sp + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped alias) + ldr r4, StartupAddr + + // Jump to PrePiCore C code + // r0 = MpId + // r1 = UefiMemoryBase + // r2 = StacksBase + // r3 = GlobalVariableBase + blx ASM_PFX (CEntryPoint) + +_NeverReturn: + b _NeverReturn + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm new file mode 100644 index 000000000..028a9a1b2 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm @@ -0,0 +1,158 @@ +// +// Copyright (c) 2011-2014, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include + +#include + + INCLUDE AsmMacroIoLib.inc + + IMPORT CEntryPoint + IMPORT ArmPlatformIsPrimaryCore + IMPORT ArmReadMpidr + IMPORT ArmPlatformPeiBootAction + IMPORT ArmPlatformStackSet + + EXPORT _ModuleEntryPoint + + PRESERVE8 + AREA PrePiCoreEntryPoint, CODE, READONLY + +StartupAddr DCD CEntryPoint + +_ModuleEntryPoint + // Do early platform specific actions + bl ArmPlatformPeiBootAction + + // Get ID of this CPU in Multicore system + bl ArmReadMpidr + // Keep a copy of the MpId register value + mov r8, r0 + +_SetSVCMode + // Enter SVC mode, Disable FIQ and IRQ + mov r1, #(CPSR_MODE_SVC :OR: CPSR_IRQ :OR: CPSR_FIQ) + msr CPSR_c, r1 + +// Check if we can install the stack at the top of the System Memory or if we need +// to install the stacks at the bottom of the Firmware Device (case the FD is located +// at the top of the DRAM) +_SetupStackPosition + // Compute Top of System Memory + LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), r1) + LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), r2) + sub r2, r2, #1 + add r1, r1, r2 // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize + + // Calculate Top of the Firmware Device + LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2) + LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3) + sub r3, r3, #1 + add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize + + // UEFI Memory Size (stacks are allocated in this region) + LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4) + + // + // Reserve the memory for the UEFI region (contain stacks on its top) + // + + // Calculate how much space there is between the top of the Firmware and the Top of the System Memory + subs r0, r1, r3 // r0 = SystemMemoryTop - FdTop + bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM + cmp r0, r4 + bge _SetupStack + + // Case the top of stacks is the FdBaseAddress + mov r1, r2 + +_SetupStack + // r1 contains the top of the stack (and the UEFI Memory) + + // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment + // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the + // top of the memory space) + adds r9, r1, #1 + bcs _SetupOverflowStack + +_SetupAlignedStack + mov r1, r9 + b _GetBaseUefiMemory + +_SetupOverflowStack + // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE + // aligned (4KB) + LoadConstantToReg (EFI_PAGE_MASK, r9) + and r9, r9, r1 + sub r1, r1, r9 + +_GetBaseUefiMemory + // Calculate the Base of the UEFI Memory + sub r9, r1, r4 + +_GetStackBase + // r1 = The top of the Mpcore Stacks + // Stack for the primary core = PrimaryCoreStack + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + sub r10, r1, r2 + + // Stack for the secondary core = Number of Cores - 1 + LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0) + sub r0, r0, #1 + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1) + mul r1, r1, r0 + sub r10, r10, r1 + + // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) + mov r0, r10 + mov r1, r8 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3) + bl ArmPlatformStackSet + + // Is it the Primary Core ? + mov r0, r8 + bl ArmPlatformIsPrimaryCore + cmp r0, #1 + bne _PrepareArguments + +_ReserveGlobalVariable + LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r0) + // InitializePrimaryStack($GlobalVariableSize, $Tmp1) + InitializePrimaryStack r0, r1 + +_PrepareArguments + mov r0, r8 + mov r1, r9 + mov r2, r10 + mov r3, sp + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped alias) + ldr r4, StartupAddr + + // Jump to PrePiCore C code + // r0 = MpId + // r1 = UefiMemoryBase + // r2 = StacksBase + // r3 = GlobalVariableBase + blx r4 + +_NeverReturn + b _NeverReturn + + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h new file mode 100644 index 000000000..e4483b682 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h @@ -0,0 +1,103 @@ +/** @file + LZMA Decompress Library header file + + Copyright (c) 2006 - 2010, 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 __LZMA_DECOMPRESS_H___ +#define __LZMA_DECOMPRESS_H___ + +/** + Examines a GUIDed section and returns the size of the decoded buffer and the + size of an scratch buffer required to actually decode the data in a GUIDed section. + + Examines a GUIDed section specified by InputSection. + If GUID for InputSection does not match the GUID that this handler supports, + then RETURN_UNSUPPORTED is returned. + If the required information can not be retrieved from InputSection, + then RETURN_INVALID_PARAMETER is returned. + If the GUID of InputSection does match the GUID that this handler supports, + then the size required to hold the decoded buffer is returned in OututBufferSize, + the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field + from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute. + + If InputSection is NULL, then ASSERT(). + If OutputBufferSize is NULL, then ASSERT(). + If ScratchBufferSize is NULL, then ASSERT(). + If SectionAttribute is NULL, then ASSERT(). + + + @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. + @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required + if the buffer specified by InputSection were decoded. + @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space + if the buffer specified by InputSection were decoded. + @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes + field of EFI_GUID_DEFINED_SECTION in the PI Specification. + + @retval RETURN_SUCCESS The information about InputSection was returned. + @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. + @retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection. + +**/ +RETURN_STATUS +EFIAPI +LzmaGuidedSectionGetInfo ( + IN CONST VOID *InputSection, + OUT UINT32 *OutputBufferSize, + OUT UINT32 *ScratchBufferSize, + OUT UINT16 *SectionAttribute + ); + +/** + Decompress a LZAM compressed GUIDed section into a caller allocated output buffer. + + Decodes the GUIDed section specified by InputSection. + If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned. + If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned. + If the GUID of InputSection does match the GUID that this handler supports, then InputSection + is decoded into the buffer specified by OutputBuffer and the authentication status of this + decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the + data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise, + the decoded data will be placed in caller allocated buffer specified by OutputBuffer. + + If InputSection is NULL, then ASSERT(). + If OutputBuffer is NULL, then ASSERT(). + If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). + If AuthenticationStatus is NULL, then ASSERT(). + + + @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. + @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. + @param[out] ScratchBuffer A caller allocated buffer that may be required by this function + as a scratch buffer to perform the decode operation. + @param[out] AuthenticationStatus + A pointer to the authentication status of the decoded output buffer. + See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI + section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must + never be set by this handler. + + @retval RETURN_SUCCESS The buffer specified by InputSection was decoded. + @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. + @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded. + +**/ +RETURN_STATUS +EFIAPI +LzmaGuidedSectionExtraction ( + IN CONST VOID *InputSection, + OUT VOID **OutputBuffer, + OUT VOID *ScratchBuffer, OPTIONAL + OUT UINT32 *AuthenticationStatus + ); + +#endif // __LZMADECOMPRESS_H__ + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c new file mode 100644 index 000000000..5868993d5 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c @@ -0,0 +1,99 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "PrePi.h" + +#include + +#include + +VOID +PrimaryMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, + IN UINT64 StartTimeStamp + ) +{ + // Enable the GIC Distributor + ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase)); + + // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader to resume their initialization + if (!FixedPcdGet32(PcdSendSgiToBringUpSecondaryCores)) { + // Sending SGI to all the Secondary CPU interfaces + ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); + } + + PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); + + // We must never return + ASSERT(FALSE); +} + +VOID +SecondaryMain ( + IN UINTN MpId + ) +{ + EFI_STATUS Status; + ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi; + UINTN Index; + UINTN ArmCoreCount; + ARM_CORE_INFO *ArmCoreInfoTable; + UINT32 ClusterId; + UINT32 CoreId; + VOID (*SecondaryStart)(VOID); + UINTN SecondaryEntryAddr; + + ClusterId = GET_CLUSTER_ID(MpId); + CoreId = GET_CORE_ID(MpId); + + // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid) + Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi); + ASSERT_EFI_ERROR (Status); + + ArmCoreCount = 0; + Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable); + ASSERT_EFI_ERROR (Status); + + // Find the core in the ArmCoreTable + for (Index = 0; Index < ArmCoreCount; Index++) { + if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) { + break; + } + } + + // The ARM Core Info Table must define every core + ASSERT (Index != ArmCoreCount); + + // Clear Secondary cores MailBox + MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue); + + do { + ArmCallWFI (); + + // Read the Mailbox + SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress); + + // Acknowledge the interrupt and send End of Interrupt signal. + ArmGicAcknowledgeInterrupt (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase), NULL, NULL); + } while (SecondaryEntryAddr == 0); + + // Jump to secondary core entry point. + SecondaryStart = (VOID (*)())SecondaryEntryAddr; + SecondaryStart(); + + // The secondaries shouldn't reach here + ASSERT(FALSE); +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c new file mode 100644 index 000000000..43588a50d --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c @@ -0,0 +1,44 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "PrePi.h" + +VOID +PrimaryMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, + IN UINT64 StartTimeStamp + ) +{ + DEBUG_CODE_BEGIN(); + // On MPCore system, PeiMpCore.inf should be used instead of PeiUniCore.inf + ASSERT(ArmIsMpCore() == 0); + DEBUG_CODE_END(); + + PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); + + // We must never return + ASSERT(FALSE); +} + +VOID +SecondaryMain ( + IN UINTN MpId + ) +{ + // We must never get into this function on UniCore system + ASSERT(FALSE); +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf new file mode 100755 index 000000000..38ba50c13 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf @@ -0,0 +1,115 @@ +#/** @file +# +# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformPrePiMPCore + FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8 + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + +[Sources] + PrePi.c + MainMPCore.c + +[Sources.ARM] + Arm/ArchPrePi.c + Arm/ModuleEntryPoint.S | GCC + Arm/ModuleEntryPoint.asm | RVCT + +[Sources.AArch64] + AArch64/ArchPrePi.c + AArch64/ModuleEntryPoint.S + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DebugAgentLib + ArmLib + ArmGicLib + IoLib + TimerLib + SerialPortLib + ExtractGuidedSectionLib + LzmaDecompressLib + PeCoffGetEntryPointLib + DebugAgentLib + PrePiLib + ArmPlatformLib + ArmPlatformStackLib + MemoryAllocationLib + HobLib + PrePiHobListPointerLib + PlatformPeiLib + MemoryInitPeiLib + +[Ppis] + gArmMpCoreInfoPpiGuid + +[Guids] + gArmGlobalVariableGuid + gArmMpCoreInfoGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + + gArmTokenSpaceGuid.PcdVFPEnabled + + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize + + gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize + + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicSgiIntId + + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmTokenSpaceGuid.PcdArmPrimaryCore + + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf new file mode 100755 index 000000000..ba394f6ce --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf @@ -0,0 +1,108 @@ +#/** @file +# +# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformPrePiUniCore + FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8 + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + +[Sources] + PrePi.c + MainUniCore.c + +[Sources.ARM] + Arm/ArchPrePi.c + Arm/ModuleEntryPoint.S | GCC + Arm/ModuleEntryPoint.asm | RVCT + +[Sources.AArch64] + AArch64/ArchPrePi.c + AArch64/ModuleEntryPoint.S + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DebugAgentLib + ArmLib + IoLib + TimerLib + SerialPortLib + ExtractGuidedSectionLib + LzmaDecompressLib + PeCoffGetEntryPointLib + DebugAgentLib + PrePiLib + ArmPlatformLib + ArmPlatformStackLib + MemoryAllocationLib + HobLib + PrePiHobListPointerLib + PlatformPeiLib + MemoryInitPeiLib + +[Ppis] + gArmMpCoreInfoPpiGuid + +[Guids] + gArmGlobalVariableGuid + gArmMpCoreInfoGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + + gArmTokenSpaceGuid.PcdVFPEnabled + + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize + + gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize + + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gArmPlatformTokenSpaceGuid.PcdCoreCount + + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c new file mode 100755 index 000000000..90d6c4246 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c @@ -0,0 +1,259 @@ +/** @file +* +* Copyright (c) 2011-2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "PrePi.h" +#include "LzmaDecompress.h" + +#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize))) || \ + ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) + +// Not used when PrePi in run in XIP mode +UINTN mGlobalVariableBase = 0; + +EFI_STATUS +EFIAPI +ExtractGuidedSectionLibConstructor ( + VOID + ); + +EFI_STATUS +EFIAPI +LzmaDecompressLibConstructor ( + VOID + ); + +VOID +EFIAPI +BuildGlobalVariableHob ( + IN EFI_PHYSICAL_ADDRESS GlobalVariableBase, + IN UINT32 GlobalVariableSize + ) +{ + ARM_HOB_GLOBAL_VARIABLE *Hob; + + Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE)); + ASSERT(Hob != NULL); + + CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid); + Hob->GlobalVariableBase = GlobalVariableBase; + Hob->GlobalVariableSize = GlobalVariableSize; +} + +EFI_STATUS +GetPlatformPpi ( + IN EFI_GUID *PpiGuid, + OUT VOID **Ppi + ) +{ + UINTN PpiListSize; + UINTN PpiListCount; + EFI_PEI_PPI_DESCRIPTOR *PpiList; + UINTN Index; + + PpiListSize = 0; + ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); + PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); + for (Index = 0; Index < PpiListCount; Index++, PpiList++) { + if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) { + *Ppi = PpiList->Ppi; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + +VOID +PrePiMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, + IN UINT64 StartTimeStamp + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE* HobList; + ARM_MP_CORE_INFO_PPI* ArmMpCoreInfoPpi; + UINTN ArmCoreCount; + ARM_CORE_INFO* ArmCoreInfoTable; + EFI_STATUS Status; + CHAR8 Buffer[100]; + UINTN CharCount; + UINTN StacksSize; + // If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP) + ASSERT (IS_XIP() || + ((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) && + ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet64 (PcdSystemMemorySize))))); + + // Initialize the architecture specific bits + ArchInitialize (); + + // Initialize the Serial Port + SerialPortInitialize (); + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r", + (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + // Initialize the Debug Agent for Source Level Debugging + InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); + SaveAndSetDebugTimerInterrupt (TRUE); + + // Declare the PI/UEFI memory region + HobList = HobConstructor ( + (VOID*)UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize), + (VOID*)UefiMemoryBase, + (VOID*)StacksBase // The top of the UEFI Memory is reserved for the stacks + ); + PrePeiSetHobList (HobList); + + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)); + + ASSERT_EFI_ERROR (Status); + + // Create the Stacks HOB (reserve the memory for all stacks) + if (ArmIsMpCore ()) { + StacksSize = FixedPcdGet32 (PcdCPUCorePrimaryStackSize) + + ((FixedPcdGet32 (PcdCoreCount) - 1) * FixedPcdGet32 (PcdCPUCoreSecondaryStackSize)); + } else { + StacksSize = FixedPcdGet32 (PcdCPUCorePrimaryStackSize); + } + + BuildStackHob (StacksBase, StacksSize); + + // Declare the Global Variable HOB + BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize)); + + //TODO: Call CpuPei as a library + BuildCpuHob (FixedPcdGet8 (PcdPrePiCpuMemorySize), FixedPcdGet8 (PcdPrePiCpuIoSize)); + + if (ArmIsMpCore ()) { + // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid + Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi); + + // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid) + ASSERT_EFI_ERROR (Status); + + // Build the MP Core Info Table + ArmCoreCount = 0; + Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable); + if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) { + // Build MPCore Info HOB + BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount); + } + } + + // Set the Boot Mode + SetBootMode (ArmPlatformGetBootMode ()); + // Initialize Platform HOBs (CpuHob and FvHob) + Status = PlatformPeim (); + ASSERT_EFI_ERROR (Status); + // Now, the HOB List has been initialized, we can register performance information + PERF_START (NULL, "PEI", NULL, StartTimeStamp); + + // SEC phase needs to run library constructors by hand. + ExtractGuidedSectionLibConstructor (); + + LzmaDecompressLibConstructor (); + + // Build HOBs to pass up our version of stuff the DXE Core needs to save space + BuildPeCoffLoaderHob (); + BuildExtractSectionHob ( + &gLzmaCustomDecompressGuid, + LzmaGuidedSectionGetInfo, + LzmaGuidedSectionExtraction + ); + + // Assume the FV that contains the SEC (our code) also contains a compressed FV. + Status = DecompressFirstFv (); + //ASSERT_EFI_ERROR (Status); + // Load the DXE Core and transfer control to it + + Status = LoadDxeCoreFromFv (NULL, 0); + ASSERT_EFI_ERROR (Status); +} + +VOID +CEntryPoint ( + IN UINTN MpId, + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase + ) +{ + UINT64 StartTimeStamp; + ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1)); + + // Initialize the platform specific controllers + ArmPlatformInitialize (MpId); + + if (ArmPlatformIsPrimaryCore (MpId) && PerformanceMeasurementEnabled ()) { + // Initialize the Timer Library to setup the Timer HW controller + TimerConstructor (); + // We cannot call yet the PerformanceLib because the HOB List has not been initialized + StartTimeStamp = GetPerformanceCounter (); + } else { + StartTimeStamp = 0; + } + + // Data Cache enabled on Primary core when MMU is enabled. + ArmDisableDataCache (); + // Invalidate Data cache + //ArmInvalidateDataCache (); + // Invalidate instruction cache + //ArmInvalidateInstructionCache (); + // Enable Instruction Caches on all cores. + ArmEnableInstructionCache (); + + // Define the Global Variable region when we are not running in XIP + if (!IS_XIP()) { + if (ArmPlatformIsPrimaryCore (MpId)) { + mGlobalVariableBase = GlobalVariableBase; + if (ArmIsMpCore()) { + // Signal the Global Variable Region is defined (event: ARM_CPU_EVENT_DEFAULT) + ArmCallSEV (); + } + } else { + // Wait the Primay core has defined the address of the Global Variable region (event: ARM_CPU_EVENT_DEFAULT) + ArmCallWFE (); + } + } + + // If not primary Jump to Secondary Main + if (ArmPlatformIsPrimaryCore (MpId)) { + // Goto primary Main. + PrimaryMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); + } else { + SecondaryMain (MpId); + } + + // DXE Core should always load and never return + ASSERT (FALSE); +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h new file mode 100644 index 000000000..e67795f44 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h @@ -0,0 +1,90 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _PREPI_H_ +#define _PREPI_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); + +RETURN_STATUS +EFIAPI +TimerConstructor ( + VOID + ); + +VOID +PrePiMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, + IN UINT64 StartTimeStamp + ); + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ); + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ); + +VOID +PrimaryMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, + IN UINT64 StartTimeStamp + ); + +VOID +SecondaryMain ( + IN UINTN MpId + ); + +// Either implemented by PrePiLib or by MemoryInitPei +VOID +BuildMemoryTypeInformationHob ( + VOID + ); + +EFI_STATUS +GetPlatformPpi ( + IN EFI_GUID *PpiGuid, + OUT VOID **Ppi + ); + +// Initialize the Architecture specific controllers +VOID +ArchInitialize ( + VOID + ); + +#endif /* _PREPI_H_ */ diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c new file mode 100644 index 000000000..85df0816e --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c @@ -0,0 +1,25 @@ +/** @file +* +* Copyright (c) 2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +VOID +EFIAPI +ArmSecArchTrustzoneInit ( + VOID + ) +{ + // Write to CP15 Non-secure Access Control Register + ArmWriteNsacr (PcdGet32 (PcdArmNsacr)); +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S new file mode 100644 index 000000000..ae4bc4454 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S @@ -0,0 +1,84 @@ +#======================================================================================== +# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#======================================================================================= + +#start of the code section +.text +.align 3 + +GCC_ASM_EXPORT(return_from_exception) +GCC_ASM_EXPORT(enter_monitor_mode) +GCC_ASM_EXPORT(copy_cpsr_into_spsr) +GCC_ASM_EXPORT(set_non_secure_mode) + +# r0: Monitor World EntryPoint +# r1: MpId +# r2: SecBootMode +# r3: Secure Monitor mode stack +ASM_PFX(enter_monitor_mode): + cmp r3, #0 @ If a Secure Monitor stack base has not been defined then use the Secure stack + moveq r3, sp + + mrs r4, cpsr @ Save current mode (SVC) in r4 + bic r5, r4, #0x1f @ Clear all mode bits + orr r5, r5, #0x16 @ Set bits for Monitor mode + msr cpsr_cxsf, r5 @ We are now in Monitor Mode + + mov sp, r3 @ Set the stack of the Monitor Mode + + mov lr, r0 @ Use the pass entrypoint as lr + + msr spsr_cxsf, r4 @ Use saved mode for the MOVS jump to the kernel + + mov r4, r0 @ Swap EntryPoint and MpId registers + mov r0, r1 + mov r1, r2 + mov r2, r3 + + bx r4 + +# We cannot use the instruction 'movs pc, lr' because the caller can be written either in ARM or Thumb2 assembler. +# When we will jump into this function, we will set the CPSR flag to ARM assembler. By copying directly 'lr' into +# 'pc'; we will not change the CPSR flag and it will crash. +# The way to fix this limitation is to do the movs into the ARM assmbler code and then do a 'bx'. +ASM_PFX(return_from_exception): + ldr lr, returned_exception + + #The following instruction breaks the code. + #movs pc, lr + mrs r2, cpsr + bic r2, r2, #0x1f + orr r2, r2, #0x13 + msr cpsr_c, r2 + +returned_exception: @ We are now in non-secure state + bx r0 + +# Save the current Program Status Register (PSR) into the Saved PSR +ASM_PFX(copy_cpsr_into_spsr): + mrs r0, cpsr + msr spsr_cxsf, r0 + bx lr + +# Set the Non Secure Mode +ASM_PFX(set_non_secure_mode): + push { r1 } + and r0, r0, #0x1f @ Keep only the mode bits + mrs r1, spsr @ Read the spsr + bic r1, r1, #0x1f @ Clear all mode bits + orr r1, r1, r0 + msr spsr_cxsf, r1 @ write back spsr (may have caused a mode switch) + isb + pop { r1 } + bx lr @ return (hopefully thumb-safe!) + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm new file mode 100644 index 000000000..b31cc31a9 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm @@ -0,0 +1,79 @@ +// +// Copyright (c) 2011-2012, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + + EXPORT return_from_exception + EXPORT enter_monitor_mode + EXPORT copy_cpsr_into_spsr + EXPORT set_non_secure_mode + + AREA Helper, CODE, READONLY + +// r0: Monitor World EntryPoint +// r1: MpId +// r2: SecBootMode +// r3: Secure Monitor mode stack +enter_monitor_mode FUNCTION + cmp r3, #0 // If a Secure Monitor stack base has not been defined then use the Secure stack + moveq r3, sp + + mrs r4, cpsr // Save current mode (SVC) in r4 + bic r5, r4, #0x1f // Clear all mode bits + orr r5, r5, #0x16 // Set bits for Monitor mode + msr cpsr_cxsf, r5 // We are now in Monitor Mode + + mov sp, r3 // Set the stack of the Monitor Mode + + mov lr, r0 // Use the pass entrypoint as lr + + msr spsr_cxsf, r4 // Use saved mode for the MOVS jump to the kernel + + mov r4, r0 // Swap EntryPoint and MpId registers + mov r0, r1 + mov r1, r2 + mov r2, r3 + + bx r4 + ENDFUNC + +// We cannot use the instruction 'movs pc, lr' because the caller can be written either in ARM or Thumb2 assembler. +// When we will jump into this function, we will set the CPSR flag to ARM assembler. By copying directly 'lr' into +// 'pc'; we will not change the CPSR flag and it will crash. +// The way to fix this limitation is to do the movs into the ARM assmbler code and then do a 'bx'. +return_from_exception + adr lr, returned_exception + movs pc, lr +returned_exception // We are now in non-secure state + bx r0 + +// Save the current Program Status Register (PSR) into the Saved PSR +copy_cpsr_into_spsr + mrs r0, cpsr + msr spsr_cxsf, r0 + bx lr + +// Set the Non Secure Mode +set_non_secure_mode + push { r1 } + and r0, r0, #0x1f // Keep only the mode bits + mrs r1, spsr // Read the spsr + bic r1, r1, #0x1f // Clear all mode bits + orr r1, r1, r0 + msr spsr_cxsf, r1 // write back spsr (may have caused a mode switch) + isb + pop { r1 } + bx lr // return (hopefully thumb-safe!) + +dead + B dead + + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c new file mode 100644 index 000000000..41ceb125f --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c @@ -0,0 +1,125 @@ +/** @file +* Main file supporting the SEC Phase on ARM Platforms +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include +#include +#include +#include + +#include "SecInternal.h" + +#define SerialPrint(txt) SerialPortWrite ((UINT8*)txt, AsciiStrLen(txt)+1); + +VOID +CEntryPoint ( + IN UINTN MpId, + IN UINTN SecBootMode + ) +{ + //CHAR8 Buffer[100]; + //UINTN CharCount; + UINTN JumpAddress; + + // CPU specific settings + ArmCpuSetup (MpId); + + // Enable Floating Point Coprocessor if supported by the platform + if (FixedPcdGet32 (PcdVFPEnabled)) { + ArmEnableVFP(); + } + + // With Trustzone support the transition from Sec to Normal world is done by return_from_exception(). + // If we want to keep this function call we need to ensure the SVC's SPSR point to the same Program + // Status Register as the the current one (CPSR). + copy_cpsr_into_spsr (); + + // Call the Platform specific function to execute additional actions if required + JumpAddress = FixedPcdGet32 (PcdFvBaseAddress); + + //ArmPlatformSecExtraAction (MpId, &JumpAddress); + NonTrustedWorldTransition (MpId, JumpAddress); + + ASSERT (0); // never return +} + +/* +VOID +TrustedWorldInitialization ( + IN UINTN MpId, + IN UINTN SecBootMode + ) +{ + //UINTN JumpAddress; + + //-------------------- Monitor Mode --------------------- + + // Set up Monitor World (Vector Table, etc) + ArmSecureMonitorWorldInitialize (); + + // Transfer the interrupt to Non-secure World + ArmGicSetupNonSecure (MpId, PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase)); + + // Initialize platform specific security policy + ArmPlatformSecTrustzoneInit (MpId); + + // Setup the Trustzone Chipsets + if (SecBootMode == ARM_SEC_COLD_BOOT) { + if (ArmPlatformIsPrimaryCore (MpId)) { + if (ArmIsMpCore()) { + // Signal the secondary core the Security settings is done (event: EVENT_SECURE_INIT) + ArmCallSEV (); + } + } else { + // The secondary cores need to wait until the Trustzone chipsets configuration is done + // before switching to Non Secure World + + // Wait for the Primary Core to finish the initialization of the Secure World (event: EVENT_SECURE_INIT) + ArmCallWFE (); + } + } + + // Call the Platform specific function to execute additional actions if required + //JumpAddress = PcdGet32 (PcdFvBaseAddress); + //ArmPlatformSecExtraAction (MpId, &JumpAddress); + + // Initialize architecture specific security policy + ArmSecArchTrustzoneInit (); + + // CP15 Secure Configuration Register + ArmWriteScr (PcdGet32 (PcdArmScr)); + + //NonTrustedWorldTransition (MpId, JumpAddress); +} +*/ +VOID +NonTrustedWorldTransition ( + IN UINTN MpId, + IN UINTN JumpAddress + ) +{ + // If PcdArmNonSecModeTransition is defined then set this specific mode to CPSR before the transition + // By not set, the mode for Non Secure World is SVC + if (PcdGet32 (PcdArmNonSecModeTransition) != 0) { + set_non_secure_mode ((ARM_PROCESSOR_MODE)PcdGet32 (PcdArmNonSecModeTransition)); + } + + return_from_exception (JumpAddress); + //-------------------- Non Secure Mode --------------------- + + // PEI Core should always load and never return + ASSERT (FALSE); +} \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf new file mode 100644 index 000000000..2b25ec53a --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf @@ -0,0 +1,78 @@ +#/** @file +# SEC - Reset vector code that jumps to C and starts the PEI phase +# +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x00010016 + BASE_NAME = ArmPlatformSec + FILE_GUID = c536bbfe-c813-4e48-9f90-01fe1ecf9d54 + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + +[Sources] + Sec.c + +[Sources.ARM] + Arch.c + Helper.S | GCC + SecEntryPoint.S | GCC + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmCpuLib + ArmLib + ArmPlatformLib + ArmPlatformSecLib + ArmTrustedMonitorLib + BaseLib + DebugLib + #DebugAgentLib + IoLib + ArmGicLib + PrintLib + SerialPortLib + PcdLib + +[FixedPcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + + gArmTokenSpaceGuid.PcdTrustzoneSupport + gArmTokenSpaceGuid.PcdVFPEnabled + + gArmTokenSpaceGuid.PcdArmScr + gArmTokenSpaceGuid.PcdArmNonSecModeTransition + + gArmTokenSpaceGuid.PcdSecureFvBaseAddress + gArmTokenSpaceGuid.PcdSecureFvSize + + gArmTokenSpaceGuid.PcdFvBaseAddress + + gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize + + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + + gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize + +[FixedPcd.ARM] + gArmTokenSpaceGuid.PcdArmNsacr diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S new file mode 100644 index 000000000..d447855b7 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S @@ -0,0 +1,44 @@ +// +// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include "SecInternal.h" + +.text +.align 3 + +GCC_ASM_IMPORT(CEntryPoint) +GCC_ASM_IMPORT(ArmReadMpidr) +GCC_ASM_EXPORT(_ModuleEntryPoint) + +//StartupAddr: .word ASM_PFX(CEntryPoint) + +ASM_PFX(_ModuleEntryPoint): + + // Doing a second stage boot from SPL + mov r10, #ARM_SEC_SECONDARY_COLD_BOOT + +_IdentifyCpu: + // Identify CPU ID + bl ASM_PFX(ArmReadMpidr) + // Keep a copy of the MpId register value + mov r9, r0 + +_CallCEntryPoint: + mov r0, r9 + mov r1, r10 + blx ASM_PFX(CEntryPoint) + +_NeverReturn: + b _NeverReturn \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm new file mode 100644 index 000000000..2f4e8cf63 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm @@ -0,0 +1,126 @@ +// +// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include "SecInternal.h" + + INCLUDE AsmMacroIoLib.inc + + IMPORT CEntryPoint + IMPORT ArmPlatformIsPrimaryCore + IMPORT ArmPlatformGetCorePosition + //IMPORT ArmPlatformSecBootAction + //IMPORT ArmPlatformSecBootMemoryInit + IMPORT ArmDisableInterrupts + IMPORT ArmDisableCachesAndMmu + IMPORT ArmReadMpidr + IMPORT ArmCallWFE + EXPORT _ModuleEntryPoint + + PRESERVE8 + AREA SecEntryPoint, CODE, READONLY + +StartupAddr DCD CEntryPoint + +_ModuleEntryPoint FUNCTION + // First ensure all interrupts are disabled + bl ArmDisableInterrupts + + // Ensure that the MMU and caches are off + bl ArmDisableCachesAndMmu + + // By default, we are doing a cold boot + mov r10, #ARM_SEC_COLD_BOOT + + // Jump to Platform Specific Boot Action function + //blx ArmPlatformSecBootAction + +_IdentifyCpu + // Identify CPU ID + bl ArmReadMpidr + // Keep a copy of the MpId register value + mov r9, r0 + + // Is it the Primary Core ? + bl ArmPlatformIsPrimaryCore + cmp r0, #1 + // Only the primary core initialize the memory (SMC) + beq _InitMem + +_WaitInitMem + // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized + // Otherwise we have to wait the Primary Core to finish the initialization + cmp r10, #ARM_SEC_COLD_BOOT + bne _SetupSecondaryCoreStack + + // Wait for the primary core to initialize the initial memory (event: BOOT_MEM_INIT) + bl ArmCallWFE + // Now the Init Mem is initialized, we setup the secondary core stacks + b _SetupSecondaryCoreStack + +_InitMem + // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized + cmp r10, #ARM_SEC_COLD_BOOT + bne _SetupPrimaryCoreStack + + // Initialize Init Boot Memory + //bl ArmPlatformSecBootMemoryInit + +_SetupPrimaryCoreStack + // Get the top of the primary stacks (and the base of the secondary stacks) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2) + add r1, r1, r2 + + LoadConstantToReg (FixedPcdGet32(PcdSecGlobalVariableSize), r2) + + // The reserved space for global variable must be 8-bytes aligned for pushing + // 64-bit variable on the stack + SetPrimaryStack (r1, r2, r3) + b _PrepareArguments + +_SetupSecondaryCoreStack + // Get the top of the primary stacks (and the base of the secondary stacks) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1) + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2) + add r6, r1, r2 + + // Get the Core Position + mov r0, r9 + bl ArmPlatformGetCorePosition + // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack + add r0, r0, #1 + + // StackOffset = CorePos * StackSize + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2) + mul r0, r0, r2 + // SP = StackBase + StackOffset + add sp, r6, r0 + +_PrepareArguments + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped alias) + ldr r3, StartupAddr + + // Jump to SEC C code + // r0 = mp_id + // r1 = Boot Mode + mov r0, r9 + mov r1, r10 + blx r3 + ENDFUNC + +_NeverReturn + b _NeverReturn + END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h new file mode 100644 index 000000000..111123725 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h @@ -0,0 +1,83 @@ +/** @file +* Main file supporting the SEC Phase on ARM PLatforms +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __SEC_H__ +#define __SEC_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0) + +VOID +TrustedWorldInitialization ( + IN UINTN MpId, + IN UINTN SecBootMode + ); + +VOID +NonTrustedWorldTransition ( + IN UINTN MpId, + IN UINTN JumpAddress + ); + +VOID +ArmSetupGicNonSecure ( + IN INTN GicDistributorBase, + IN INTN GicInterruptInterfaceBase +); + +VOID +enter_monitor_mode ( + IN UINTN MonitorEntryPoint, + IN UINTN MpId, + IN UINTN SecBootMode, + IN VOID* MonitorStackBase + ); + +VOID +return_from_exception ( + IN UINTN NonSecureBase + ); + +VOID +copy_cpsr_into_spsr ( + VOID + ); + +VOID +set_non_secure_mode ( + IN ARM_PROCESSOR_MODE Mode + ); + +VOID +SecCommonExceptionEntry ( + IN UINT32 Entry, + IN UINTN LR + ); + +VOID +EFIAPI +ArmSecArchTrustzoneInit ( + VOID + ); + +#endif -- cgit v1.2.3 From ef4b9d126fb5bd06b0c5b5a68a1c69193fdb5332 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Tue, 5 Aug 2014 23:26:56 +0530 Subject: BeagleBoneBlackPkg: Add BDS Implementation Dispatch BDS and bringup EBL shell. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 25 ++- .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 43 +++- TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf | 65 ++++++ .../BeagleBoneBlackPkg/Bds/BdsEntry.c | 242 +++++++++++++++++++++ .../BeagleBoneBlackPkg/Bds/BdsEntry.h | 66 ++++++ .../BeagleBoneBlackPkg/Bds/FirmwareVolume.c | 151 +++++++++++++ 6 files changed, 576 insertions(+), 16 deletions(-) create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 9325176c4..6c3c8ab9e 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -82,6 +82,7 @@ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf SerialPortLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf + SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf TimerLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf @@ -228,7 +229,7 @@ [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM BeagleBoneBlack" - gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BBB" + gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BeagleBoneBlack" gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 @@ -347,7 +348,13 @@ MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf - EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + #MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + EmbeddedPkg/SerialDxe/SerialDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf @@ -356,27 +363,29 @@ # Simple TextIn/TextOut for UEFI Terminal EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf + # # # Semi-hosting filesystem # - ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + #ArmPkg/Filesystem/SemihostFs/SemihostFs.inf # # FAT filesystem + GPT/MBR partitioning # - MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + #MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + #MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + #MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # # Application # EmbeddedPkg/Ebl/Ebl.inf - + #ShellBinPkg/UefiShell/UefiShell.inf # # Bds # MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf - ArmPlatformPkg/Bds/Bds.inf + TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf index 244d474e7..9edfed938 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf @@ -96,7 +96,7 @@ FV = FVMAIN_COMPACT [FV.FvMain] BlockSize = 0x1000 -NumBlocks = 0xC0 # This FV gets compressed so make it just big enough +NumBlocks = 0x200 # This FV gets compressed so make it just big enough FvAlignment = 8 # FV alignment and FV attributes setting. ERASE_POLARITY = 1 MEMORY_MAPPED = TRUE @@ -129,6 +129,13 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + #INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + INF EmbeddedPkg/SerialDxe/SerialDxe.inf + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf @@ -139,27 +146,32 @@ READ_LOCK_STATUS = TRUE # # Semi-hosting filesystem (Required the Hardware Debugger to be connected) # - INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + #INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + + # + # MMC/SD + # + INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf # # FAT filesystem + GPT/MBR partitioning # - INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - INF FatBinPkg/EnhancedFatDxe/Fat.inf - INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + #INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + #INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + #INF FatBinPkg/EnhancedFatDxe/Fat.inf + #INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # # UEFI application (Shell Embedded Boot Loader) # INF EmbeddedPkg/Ebl/Ebl.inf - #INF ShellBinPkg/UefiShell/UefiShell.inf + INF ShellBinPkg/UefiShell/UefiShell.inf # # Bds # INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf - INF ArmPlatformPkg/Bds/Bds.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf [FV.FVMAIN_COMPACT] FvAlignment = 8 @@ -334,3 +346,18 @@ READ_LOCK_STATUS = TRUE UI STRING ="$(MODULE_NAME)" Optional PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION = $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf new file mode 100644 index 000000000..093559c7c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf @@ -0,0 +1,65 @@ + +#/** @file +# +# Component description file for Bds module +# +# Copyright (c) 2009, Apple Inc. 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 = BeagleBoardBds + FILE_GUID = 934431fe-5745-402e-913d-17b4434eb0f3 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = BdsInitialize + +[Sources.common] + BdsEntry.c + FirmwareVolume.c + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + DevicePathLib + BaseLib + HobLib + UefiRuntimeServicesTableLib + ReportStatusCodeLib + PerformanceLib + DxeServicesTableLib + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + BaseMemoryLib + DebugLib + PrintLib + UefiDriverEntryPoint + +[Guids] + + +[Protocols] + gEfiBdsArchProtocolGuid + gEfiSimpleTextInProtocolGuid + gEfiSimpleTextOutProtocolGuid + gEfiSerialIoProtocolGuid + gEfiDevicePathProtocolGuid + gEfiSimpleFileSystemProtocolGuid + gEfiUsbIoProtocolGuid + gEfiFirmwareVolume2ProtocolGuid + +[Depex] + TRUE diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c new file mode 100644 index 000000000..f65c9eb8b --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c @@ -0,0 +1,242 @@ +/** @file + The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements + of the UEFI specification as it is designed to implement an embedded systmes + propriatary boot scheme. + + This template assume a DXE driver produces a SerialIo protocol not using the EFI + driver module and it will attempt to connect a console on top of this. + + Copyright (c) 2008 - 2009, Apple Inc. 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 "BdsEntry.h" + + +BOOLEAN gConsolePresent = FALSE; + +EFI_BDS_ARCH_PROTOCOL gBdsProtocol = { + BdsEntry, +}; + + + + +/** + This function uses policy data from the platform to determine what operating + system or system utility should be loaded and invoked. This function call + also optionally make the use of user input to determine the operating system + or system utility to be loaded and invoked. When the DXE Core has dispatched + all the drivers on the dispatch queue, this function is called. This + function will attempt to connect the boot devices required to load and invoke + the selected operating system or system utility. During this process, + additional firmware volumes may be discovered that may contain addition DXE + drivers that can be dispatched by the DXE Core. If a boot device cannot be + fully connected, this function calls the DXE Service Dispatch() to allow the + DXE drivers from any newly discovered firmware volumes to be dispatched. + Then the boot device connection can be attempted again. If the same boot + device connection operation fails twice in a row, then that boot device has + failed, and should be skipped. This function should never return. + + @param This The EFI_BDS_ARCH_PROTOCOL instance. + + @return None. + +**/ +VOID +EFIAPI +BdsEntry ( + IN EFI_BDS_ARCH_PROTOCOL *This + ) +{ + EFI_STATUS Status; + UINTN NoHandles; + EFI_HANDLE *Buffer; + EFI_HANDLE FvHandle; + EFI_HANDLE ImageHandle; + EFI_HANDLE UsbDeviceHandle; + EFI_GUID NameGuid; + UINTN Size; + UINTN HandleCount; + UINTN OldHandleCount; + EFI_HANDLE *HandleBuffer; + UINTN Index; + EFI_DEVICE_PATH_PROTOCOL *LoadImageDevicePath; + EFI_DEVICE_PATH_PROTOCOL *FileSystemDevicePath; + + PERF_END (NULL, "DXE", NULL, 0); + PERF_START (NULL, "BDS", NULL, 0); + + + // + // Now do the EFI stuff + // + Size = 0x100; + gST->FirmwareVendor = AllocateRuntimePool (Size); + ASSERT (gST->FirmwareVendor != NULL); + + UnicodeSPrint (gST->FirmwareVendor, Size, L"BeagleBoard EFI %a %a", __DATE__, __TIME__); + + // + // Now we need to setup the EFI System Table with information about the console devices. + // This code is normally in the console spliter driver on platforms that support multiple + // consoles at the same time + // + Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer); + if (!EFI_ERROR (Status)) { + // Use the first SimpleTextOut we find and update the EFI System Table + gST->ConsoleOutHandle = Buffer[0]; + gST->StandardErrorHandle = Buffer[0]; + Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextOutProtocolGuid, (VOID **)&gST->ConOut); + ASSERT_EFI_ERROR (Status); + + gST->StdErr = gST->ConOut; + + gST->ConOut->OutputString (gST->ConOut, L"BDS: Console Started!!!!\n\r"); + FreePool (Buffer); + + gConsolePresent = TRUE; + } + + + Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer); + if (!EFI_ERROR (Status)) { + // Use the first SimpleTextIn we find and update the EFI System Table + gST->ConsoleInHandle = Buffer[0]; + Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextInProtocolGuid, (VOID **)&gST->ConIn); + ASSERT_EFI_ERROR (Status); + + FreePool (Buffer); + } + + // + // We now have EFI Consoles up and running. Print () will work now. DEBUG () and ASSERT () worked + // prior to this point as they were configured to use a more primative output scheme. + // + + // + //Perform Connect + // + HandleCount = 0; + while (1) { + OldHandleCount = HandleCount; + Status = gBS->LocateHandleBuffer ( + AllHandles, + NULL, + NULL, + &HandleCount, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + break; + } + + if (HandleCount == OldHandleCount) { + break; + } + + for (Index = 0; Index < HandleCount; Index++) { + gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); + } + } + + EfiSignalEventReadyToBoot (); + + //Locate handles for SimpleFileSystem protocol + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiSimpleFileSystemProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer + ); + if (!EFI_ERROR(Status)) { + for (Index = 0; Index < HandleCount; Index++) { + //Get the device path + FileSystemDevicePath = DevicePathFromHandle(HandleBuffer[Index]); + if (FileSystemDevicePath == NULL) { + continue; + } + + //Check if UsbIo is on any handles in the device path. + Status = gBS->LocateDevicePath(&gEfiUsbIoProtocolGuid, &FileSystemDevicePath, &UsbDeviceHandle); + if (EFI_ERROR(Status)) { + continue; + } + + //Check if Usb stick has a magic EBL file. + LoadImageDevicePath = FileDevicePath(HandleBuffer[Index], L"Ebl.efi"); + Status = gBS->LoadImage (TRUE, gImageHandle, LoadImageDevicePath, NULL, 0, &ImageHandle); + if (EFI_ERROR(Status)) { + continue; + } + + //Boot to Shell on USB stick. + Status = gBS->StartImage (ImageHandle, NULL, NULL); + if (EFI_ERROR(Status)) { + continue; + } + } + } + + // + // Normal UEFI behavior is to process Globally Defined Variables as defined in Chapter 3 + // (Boot Manager) of the UEFI specification. For this embedded system we don't do this. + // + + // + // Search all the FVs for an application with a UI Section of Ebl. A .FDF file can be used + // to control the names of UI sections in an FV. + // + Status = FindApplicationMatchingUiSection (L"Ebl", &FvHandle, &NameGuid); + if (!EFI_ERROR (Status)) { + + //Boot to Shell. + Status = LoadPeCoffSectionFromFv (FvHandle, &NameGuid); + + if (EFI_ERROR(Status)) { + DEBUG((EFI_D_ERROR, "Boot from Shell failed. Status: %r\n", Status)); + } + } + + // + // EFI does not define the behaviour if all boot attemps fail and the last one returns. + // So we make a policy choice to reset the system since this BDS does not have a UI. + // + gRT->ResetSystem (EfiResetShutdown, Status, 0, NULL); + + return ; +} + + +EFI_STATUS +EFIAPI +BdsInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Install protocol interface + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &ImageHandle, + &gEfiBdsArchProtocolGuid, &gBdsProtocol, + NULL + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h new file mode 100644 index 000000000..149acbefc --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h @@ -0,0 +1,66 @@ +/** @file + + Copyright (c) 2008 - 2009, Apple Inc. 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 __BDS_ENTRY_H__ +#define __BDS_ENTRY_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +EFI_STATUS +LoadPeCoffSectionFromFv ( + IN EFI_HANDLE FvHandle, + IN EFI_GUID *NameGuid + ); + +EFI_STATUS +FindApplicationMatchingUiSection ( + IN CHAR16 *UiString, + OUT EFI_HANDLE *FvHandle, + OUT EFI_GUID *NameGuid + ); + +VOID +EFIAPI +BdsEntry ( + IN EFI_BDS_ARCH_PROTOCOL *This + ); + +#endif + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c new file mode 100644 index 000000000..8e505ec01 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c @@ -0,0 +1,151 @@ +/** @file + The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements + of the UEFI specification as it is designed to implement an embedded systmes + propriatary boot scheme. + + This template assume a DXE driver produces a SerialIo protocol not using the EFI + driver module and it will attempt to connect a console on top of this. + + + Copyright (c) 2009, Apple Inc. 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 "BdsEntry.h" + + +EFI_STATUS +FindApplicationMatchingUiSection ( + IN CHAR16 *UiString, + OUT EFI_HANDLE *FvHandle, + OUT EFI_GUID *NameGuid + ) +{ + EFI_STATUS Status; + EFI_STATUS NextStatus; + UINTN NoHandles; + EFI_HANDLE *Buffer; + UINTN Index; + EFI_FV_FILETYPE FileType; + EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; + VOID *Key; + EFI_FV_FILE_ATTRIBUTES Attributes; + UINTN Size; + UINTN UiStringLen; + CHAR16 *UiSection; + UINT32 Authentication; + + + UiStringLen = 0; + + if (UiString != NULL) { + DEBUG ((DEBUG_ERROR, "UiString %s\n", UiString)); + UiStringLen = StrLen (UiString); + } + + Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Buffer); + if (!EFI_ERROR (Status)) { + for (Index = 0; Index < NoHandles; Index++) { + Status = gBS->HandleProtocol (Buffer[Index], &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv); + if (!EFI_ERROR (Status)) { + Key = AllocatePool (Fv->KeySize); + ASSERT (Key != NULL); + ZeroMem (Key, Fv->KeySize); + + FileType = EFI_FV_FILETYPE_APPLICATION; + + do { + NextStatus = Fv->GetNextFile (Fv, Key, &FileType, NameGuid, &Attributes, &Size); + if (!EFI_ERROR (NextStatus)) { + if (UiString == NULL) { + // + // If UiString is NULL match first application we find. + // + *FvHandle = Buffer[Index]; + FreePool (Key); + return Status; + } + + UiSection = NULL; + Status = Fv->ReadSection ( + Fv, + NameGuid, + EFI_SECTION_USER_INTERFACE, + 0, + (VOID **)&UiSection, + &Size, + &Authentication + ); + if (!EFI_ERROR (Status)) { + if (StrnCmp (UiString, UiSection, UiStringLen) == 0) { + // + // We found a UiString match. + // + *FvHandle = Buffer[Index]; + FreePool (Key); + FreePool (UiSection); + return Status; + } + FreePool (UiSection); + } + } + } while (!EFI_ERROR (NextStatus)); + + FreePool (Key); + } + } + + FreePool (Buffer); + } + + return EFI_NOT_FOUND; +} + + +EFI_DEVICE_PATH * +FvFileDevicePath ( + IN EFI_HANDLE FvHandle, + IN EFI_GUID *NameGuid + ) +{ + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode; + + DevicePath = DevicePathFromHandle (FvHandle); + + EfiInitializeFwVolDevicepathNode (&NewNode, NameGuid); + + return AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&NewNode); +} + + + +EFI_STATUS +LoadPeCoffSectionFromFv ( + IN EFI_HANDLE FvHandle, + IN EFI_GUID *NameGuid + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_HANDLE ImageHandle; + + DevicePath = FvFileDevicePath (FvHandle, NameGuid); + + Status = gBS->LoadImage (TRUE, gImageHandle, DevicePath, NULL, 0, &ImageHandle); + if (!EFI_ERROR (Status)) { + PERF_END (NULL, "BDS", NULL, 0); + Status = gBS->StartImage (ImageHandle, NULL, NULL); + } + + return Status; +} + -- cgit v1.2.3 From 5a4376408d7fc87b63d412456506331173c1cffd Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Fri, 8 Aug 2014 23:14:34 +0530 Subject: BeagleBoneBlackPkg: Launch UEFI Shell Add UefiShell and dependencies, initialize DMTIMER to load the Shell. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 22 +++++++++++++++++----- .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 9 ++++++--- .../BeagleBoneBlackPkg/Bds/BdsEntry.c | 4 ++-- .../Library/Am335xTimerLib/TimerLib.c | 3 +++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 6c3c8ab9e..8d6ea78ac 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -114,6 +114,8 @@ # BDS Libraries BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + + [LibraryClasses.ARM] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf @@ -352,10 +354,21 @@ MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf - #MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } EmbeddedPkg/SerialDxe/SerialDxe.inf MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf { + + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + MdeModulePkg/Universal/PrintDxe/PrintDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf @@ -376,16 +389,15 @@ # #MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf #MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - #MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # # Application # EmbeddedPkg/Ebl/Ebl.inf - #ShellBinPkg/UefiShell/UefiShell.inf - # + # Bds # - MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf index 9edfed938..f284d68bd 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf @@ -132,7 +132,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf - #INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf INF EmbeddedPkg/SerialDxe/SerialDxe.inf INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf @@ -140,6 +140,9 @@ READ_LOCK_STATUS = TRUE INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf + # Simple TextIn/TextOut for UEFI Terminal INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf @@ -159,7 +162,7 @@ READ_LOCK_STATUS = TRUE #INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf #INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf #INF FatBinPkg/EnhancedFatDxe/Fat.inf - #INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # # UEFI application (Shell Embedded Boot Loader) @@ -170,7 +173,7 @@ READ_LOCK_STATUS = TRUE # # Bds # - INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf [FV.FVMAIN_COMPACT] diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c index f65c9eb8b..b16b976be 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c @@ -83,7 +83,7 @@ BdsEntry ( gST->FirmwareVendor = AllocateRuntimePool (Size); ASSERT (gST->FirmwareVendor != NULL); - UnicodeSPrint (gST->FirmwareVendor, Size, L"BeagleBoard EFI %a %a", __DATE__, __TIME__); + UnicodeSPrint (gST->FirmwareVendor, Size, L"BeagleBoneBlack EFI %a %a", __DATE__, __TIME__); // // Now we need to setup the EFI System Table with information about the console devices. @@ -196,7 +196,7 @@ BdsEntry ( // Search all the FVs for an application with a UI Section of Ebl. A .FDF file can be used // to control the names of UI sections in an FV. // - Status = FindApplicationMatchingUiSection (L"Ebl", &FvHandle, &NameGuid); + Status = FindApplicationMatchingUiSection (L"Shell", &FvHandle, &NameGuid); if (!EFI_ERROR (Status)) { //Boot to Shell. diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c index fe5a579c3..d90c27982 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/TimerLib.c @@ -28,6 +28,9 @@ TimerConstructor ( VOID ) { + UINT32 TimerControlRegister = DMTIMER0_BASE + DMTIMER_TCLR; + MmioOr32 (TimerControlRegister, 0x01); + return EFI_SUCCESS; } -- cgit v1.2.3 From f88bfa1e918f53c58a142b44a17158fa79419b1b Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 16:30:24 +0530 Subject: BeagleBoneBlackPkg: Add MMC Driver Add Memory Card support and enable FAT Drivers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 5 +- .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 12 +- .../Drivers/MmcHostDxe/MmcHostDxe.c | 681 +++++++++++++++++++++ .../Drivers/MmcHostDxe/MmcHostDxe.h | 44 ++ .../Drivers/MmcHostDxe/MmcHostDxe.inf | 50 ++ .../Include/Library/Am335xMMCHS.h | 214 +++++++ .../Library/RealTimeClockLib/RealTimeClockLib.c | 297 +++++++++ .../Library/RealTimeClockLib/RealTimeClockLib.inf | 38 ++ 8 files changed, 1336 insertions(+), 5 deletions(-) create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.h create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335xMMCHS.h create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c create mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 8d6ea78ac..374cafdc2 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -377,6 +377,7 @@ EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf + TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf # # @@ -387,8 +388,8 @@ # # FAT filesystem + GPT/MBR partitioning # - #MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - #MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf index f284d68bd..a2ae9e4e8 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf @@ -155,13 +155,19 @@ READ_LOCK_STATUS = TRUE # MMC/SD # INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf + + # + # Power IC + # + #INF Omap35xxPkg/TPS65950Dxe/TPS65950.inf # # FAT filesystem + GPT/MBR partitioning # - #INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - #INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - #INF FatBinPkg/EnhancedFatDxe/Fat.inf + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatBinPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c new file mode 100755 index 000000000..64a533b3c --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c @@ -0,0 +1,681 @@ +/** @file +* +* Copyright (c) 2008 - 2009, Apple Inc. All rights reserved. +* Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "MmcHostDxe.h" + +EMBEDDED_EXTERNAL_DEVICE *gTPS65950; +UINT8 mMaxDataTransferRate = 0; +UINT32 mRca = 0; +BOOLEAN mBitModeSet = FALSE; + + +typedef struct { + VENDOR_DEVICE_PATH Mmc; + EFI_DEVICE_PATH End; +} MMCHS_DEVICE_PATH; + +MMCHS_DEVICE_PATH gMMCDevicePath = { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { (UINT8)(sizeof(VENDOR_DEVICE_PATH)), (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8) }, + }, + { 0xb615f1f5, 0x5088, 0x43cd, { 0x80, 0x9c, 0xa1, 0x6e, 0x52, 0x48, 0x7d, 0x00 } } + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 } + } +}; + +BOOLEAN +IgnoreCommand ( + UINT32 Command + ) +{ + switch(Command) { + case MMC_CMD12: + return TRUE; + case MMC_CMD13: + return TRUE; + default: + return FALSE; + } +} + +UINT32 +TranslateCommand ( + UINT32 Command + ) +{ + UINT32 Translation; + + switch(Command) { + case MMC_CMD2: + Translation = CMD2; + break; + case MMC_CMD3: + Translation = CMD3; + break; + /*case MMC_CMD6: + Translation = CMD6; + break;*/ + case MMC_CMD7: + Translation = CMD7; + break; + case MMC_CMD8: + Translation = CMD8; + break; + case MMC_CMD9: + Translation = CMD9; + break; + /*case MMC_CMD12: + Translation = CMD12; + break; + case MMC_CMD13: + Translation = CMD13; + break;*/ + case MMC_CMD16: + Translation = CMD16; + break; + case MMC_CMD17: + Translation = 0x113A0014;//CMD17; + break; + case MMC_CMD24: + Translation = CMD24 | 4; + break; + case MMC_CMD55: + Translation = CMD55; + break; + case MMC_ACMD41: + Translation = ACMD41; + break; + default: + Translation = Command; + } + + return Translation; +} + +VOID +CalculateCardCLKD ( + UINTN *ClockFrequencySelect + ) +{ + UINTN TransferRateValue = 0; + UINTN TimeValue = 0 ; + UINTN Frequency = 0; + + DEBUG ((DEBUG_BLKIO, "CalculateCardCLKD()\n")); + + // For SD Cards we would need to send CMD6 to set + // speeds abouve 25MHz. High Speed mode 50 MHz and up + + // Calculate Transfer rate unit (Bits 2:0 of TRAN_SPEED) + switch (mMaxDataTransferRate & 0x7) { // 2 + case 0: + TransferRateValue = 100 * 1000; + break; + + case 1: + TransferRateValue = 1 * 1000 * 1000; + break; + + case 2: + TransferRateValue = 10 * 1000 * 1000; + break; + + case 3: + TransferRateValue = 100 * 1000 * 1000; + break; + + default: + DEBUG ((DEBUG_BLKIO, "Invalid parameter.\n")); + ASSERT(FALSE); + return; + } + + //Calculate Time value (Bits 6:3 of TRAN_SPEED) + switch ((mMaxDataTransferRate >> 3) & 0xF) { // 6 + case 1: + TimeValue = 10; + break; + + case 2: + TimeValue = 12; + break; + + case 3: + TimeValue = 13; + break; + + case 4: + TimeValue = 15; + break; + + case 5: + TimeValue = 20; + break; + + case 6: + TimeValue = 25; + break; + + case 7: + TimeValue = 30; + break; + + case 8: + TimeValue = 35; + break; + + case 9: + TimeValue = 40; + break; + + case 10: + TimeValue = 45; + break; + + case 11: + TimeValue = 50; + break; + + case 12: + TimeValue = 55; + break; + + case 13: + TimeValue = 60; + break; + + case 14: + TimeValue = 70; + break; + + case 15: + TimeValue = 80; + break; + + default: + DEBUG ((DEBUG_BLKIO, "Invalid parameter.\n")); + ASSERT(FALSE); + return; + } + + Frequency = TransferRateValue * TimeValue/10; + + // Calculate Clock divider value to program in MMCHS_SYSCTL[CLKD] field. + *ClockFrequencySelect = ((MMC_REFERENCE_CLK/Frequency) + 1); + + DEBUG ((DEBUG_BLKIO, "mMaxDataTransferRate: 0x%x, Frequency: %d KHz, ClockFrequencySelect: %x\n", mMaxDataTransferRate, Frequency/1000, *ClockFrequencySelect)); +} + +VOID +UpdateMMCHSClkFrequency ( + UINTN NewCLKD + ) +{ + DEBUG ((DEBUG_BLKIO, "UpdateMMCHSClkFrequency()\n")); + + // Set Clock enable to 0x0 to not provide the clock to the card + MmioAnd32 (MMCHS_SYSCTL, ~CEN); + + // Set new clock frequency. + MmioAndThenOr32 (MMCHS_SYSCTL, ~CLKD_MASK, NewCLKD << 6); + + // Poll till Internal Clock Stable + while ((MmioRead32 (MMCHS_SYSCTL) & ICS_MASK) != ICS); + + // Set Clock enable to 0x1 to provide the clock to the card + MmioOr32 (MMCHS_SYSCTL, CEN); +} + +EFI_STATUS +InitializeMMCHS ( + VOID + ) +{ + //UINT8 Data; + //EFI_STATUS Status; + + DEBUG ((DEBUG_BLKIO, "InitializeMMCHS()\n")); + DEBUG ((EFI_D_ERROR, "--InitializeMMCHS()--\n")); +/* + // Select Device group to belong to P1 device group in Power IC. + Data = DEV_GRP_P1; + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, VMMC1_DEV_GRP), 1, &Data); + ASSERT_EFI_ERROR(Status); + + // Configure voltage regulator for MMC1 in Power IC to output 3.0 voltage. + Data = VSEL_3_00V; + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, VMMC1_DEDICATED_REG), 1, &Data); + ASSERT_EFI_ERROR(Status); + + // After ramping up voltage, set VDDS stable bit to indicate that voltage level is stable. + MmioOr32 (CONTROL_PBIAS_LITE, (PBIASLITEVMODE0 | PBIASLITEPWRDNZ0 | PBIASSPEEDCTRL0 | PBIASLITEVMODE1 | PBIASLITEWRDNZ1)); + + // Enable WP GPIO + MmioAndThenOr32 (GPIO1_BASE + GPIO_OE, ~BIT23, BIT23); + + // Enable Card Detect + Data = CARD_DETECT_ENABLE; + gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID2, TPS65950_GPIO_CTRL), 1, &Data); +*/ + return EFI_SUCCESS; +} + +BOOLEAN +MMCIsCardPresent ( + IN EFI_MMC_HOST_PROTOCOL *This + ) +{ + //EFI_STATUS Status; + //UINT8 Data; +/* + // + // Card detect is a GPIO0 on the TPS65950 + // + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID2, GPIODATAIN1), 1, &Data); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return !(Data & CARD_DETECT_BIT); + */ + return TRUE; +} + +BOOLEAN +MMCIsReadOnly ( + IN EFI_MMC_HOST_PROTOCOL *This + ) +{ + /* Note: + * On our BeagleBoard the SD card WP pin is always read as TRUE. + * Probably something wrong with GPIO configuration. + * BeagleBoard-xM uses microSD cards so there is no write protect at all. + * Hence commenting out SD card WP pin read status. + */ + //return (MmioRead32 (GPIO1_BASE + GPIO_DATAIN) & BIT23) == BIT23; + return 0; + +} + +// TODO +EFI_GUID mPL180MciDevicePathGuid = EFI_CALLER_ID_GUID; + +EFI_STATUS +MMCBuildDevicePath ( + IN EFI_MMC_HOST_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL **DevicePath + ) +{ + EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode; + + NewDevicePathNode = CreateDeviceNode(HARDWARE_DEVICE_PATH,HW_VENDOR_DP,sizeof(VENDOR_DEVICE_PATH)); + CopyGuid(&((VENDOR_DEVICE_PATH*)NewDevicePathNode)->Guid,&mPL180MciDevicePathGuid); + *DevicePath = NewDevicePathNode; + return EFI_SUCCESS; +} + +EFI_STATUS +MMCSendCommand ( + IN EFI_MMC_HOST_PROTOCOL *This, + IN MMC_CMD MmcCmd, + IN UINT32 Argument + ) +{ + UINTN MmcStatus; + UINTN RetryCount = 0; + + if (IgnoreCommand(MmcCmd)) + return EFI_SUCCESS; + + MmcCmd = TranslateCommand(MmcCmd); + + DEBUG ((EFI_D_ERROR, "MMCSendCommand(%d)\n", MmcCmd)); + + // Check if command line is in use or not. Poll till command line is available. + while ((MmioRead32 (MMCHS_PSTATE) & DATI_MASK) == DATI_NOT_ALLOWED); + + // Provide the block size. + MmioWrite32 (MMCHS_BLK, BLEN_512BYTES); + + // Setting Data timeout counter value to max value. + MmioAndThenOr32 (MMCHS_SYSCTL, ~DTO_MASK, DTO_VAL); + + // Clear Status register. + MmioWrite32 (MMCHS_STAT, 0xFFFFFFFF); + + // Set command argument register + MmioWrite32 (MMCHS_ARG, Argument); + + //TODO: fix this + //Enable interrupt enable events to occur + //MmioWrite32 (MMCHS_IE, CmdInterruptEnableVal); + + // Send a command + MmioWrite32 (MMCHS_CMD, MmcCmd); + + // Check for the command status. + while (RetryCount < MAX_RETRY_COUNT) { + do { + MmcStatus = MmioRead32 (MMCHS_STAT); + } while (MmcStatus == 0); + + // Read status of command response + if ((MmcStatus & ERRI) != 0) { + + // Perform soft-reset for mmci_cmd line. + MmioOr32 (MMCHS_SYSCTL, SRC); + while ((MmioRead32 (MMCHS_SYSCTL) & SRC)); + + //DEBUG ((EFI_D_INFO, "MmcStatus: 0x%x\n", MmcStatus)); + return EFI_DEVICE_ERROR; + } + + // Check if command is completed. + if ((MmcStatus & CC) == CC) { + MmioWrite32 (MMCHS_STAT, CC); + break; + } + + RetryCount++; + } + + if (RetryCount == MAX_RETRY_COUNT) { + DEBUG ((DEBUG_BLKIO, "MMCSendCommand: Timeout\n")); + return EFI_TIMEOUT; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +MMCNotifyState ( + IN EFI_MMC_HOST_PROTOCOL *This, + IN MMC_STATE State + ) +{ + EFI_STATUS Status; + UINTN FreqSel; + + switch(State) { + case MmcInvalidState: + ASSERT(0); + break; + case MmcHwInitializationState: + mBitModeSet = FALSE; + + DEBUG ((DEBUG_BLKIO, "MMCHwInitializationState()\n")); + Status = InitializeMMCHS (); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_BLKIO, "Initialize MMC host controller fails. Status: %x\n", Status)); + return Status; + } + + // Software reset of the MMCHS host controller. + MmioWrite32 (MMCHS_SYSCONFIG, SOFTRESET); + gBS->Stall(1000); + while ((MmioRead32 (MMCHS_SYSSTATUS) & RESETDONE_MASK) != RESETDONE); + + // Soft reset for all. + MmioWrite32 (MMCHS_SYSCTL, SRA); + gBS->Stall(1000); + while ((MmioRead32 (MMCHS_SYSCTL) & SRA) != 0x0); + + //Voltage capabilities initialization. Activate VS18 and VS30. + MmioOr32 (MMCHS_CAPA, (VS30 | VS18)); + + // Wakeup configuration + MmioOr32 (MMCHS_SYSCONFIG, ENAWAKEUP); + MmioOr32 (MMCHS_HCTL, IWE); + + // MMCHS Controller default initialization + MmioOr32 (MMCHS_CON, (OD | DW8_1_4_BIT | CEATA_OFF)); + + MmioWrite32 (MMCHS_HCTL, (SDVS_3_0_V | DTW_1_BIT | SDBP_OFF)); + + // Enable internal clock + MmioOr32 (MMCHS_SYSCTL, ICE); + + // Set the clock frequency to 80KHz. + UpdateMMCHSClkFrequency (CLKD_80KHZ); + + // Enable SD bus power. + MmioOr32 (MMCHS_HCTL, (SDBP_ON)); + + // Poll till SD bus power bit is set. + while ((MmioRead32 (MMCHS_HCTL) & SDBP_MASK) != SDBP_ON); + + // Enable interrupts. + MmioWrite32 (MMCHS_IE, (BADA_EN | CERR_EN | DEB_EN | DCRC_EN | DTO_EN | CIE_EN | + CEB_EN | CCRC_EN | CTO_EN | BRR_EN | BWR_EN | TC_EN | CC_EN)); + + // Controller INIT procedure start. + MmioOr32 (MMCHS_CON, INIT); + MmioWrite32 (MMCHS_CMD, 0x00000000); + while (!(MmioRead32 (MMCHS_STAT) & CC)); + + // Wait for 1 ms + gBS->Stall (1000); + + // Set CC bit to 0x1 to clear the flag + MmioOr32 (MMCHS_STAT, CC); + + // Retry INIT procedure. + MmioWrite32 (MMCHS_CMD, 0x00000000); + while (!(MmioRead32 (MMCHS_STAT) & CC)); + + // End initialization sequence + MmioAnd32 (MMCHS_CON, ~INIT); + + MmioOr32 (MMCHS_HCTL, (SDVS_3_0_V | DTW_1_BIT | SDBP_ON)); + + // Change clock frequency to 400KHz to fit protocol + UpdateMMCHSClkFrequency(CLKD_400KHZ); + + MmioOr32 (MMCHS_CON, OD); + break; + case MmcIdleState: + break; + case MmcReadyState: + break; + case MmcIdentificationState: + break; + case MmcStandByState: + CalculateCardCLKD (&FreqSel); + UpdateMMCHSClkFrequency (FreqSel); + break; + case MmcTransferState: + if (!mBitModeSet) { + Status = MMCSendCommand (This, CMD55, mRca << 16); + if (!EFI_ERROR (Status)) { + // Set device into 4-bit data bus mode + Status = MMCSendCommand (This, ACMD6, 0x2); + if (!EFI_ERROR (Status)) { + // Set host controler into 4-bit mode + MmioOr32 (MMCHS_HCTL, DTW_4_BIT); + DEBUG ((DEBUG_BLKIO, "SD Memory Card set to 4-bit mode\n")); + mBitModeSet = TRUE; + } + } + } + break; + case MmcSendingDataState: + break; + case MmcReceiveDataState: + break; + case MmcProgrammingState: + break; + case MmcDisconnectState: + default: + ASSERT(0); + } + return EFI_SUCCESS; +} + +EFI_STATUS +MMCReceiveResponse ( + IN EFI_MMC_HOST_PROTOCOL *This, + IN MMC_RESPONSE_TYPE Type, + IN UINT32* Buffer + ) +{ + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Type == MMC_RESPONSE_TYPE_R2) { + Buffer[0] = MmioRead32 (MMCHS_RSP10); + Buffer[1] = MmioRead32 (MMCHS_RSP32); + Buffer[2] = MmioRead32 (MMCHS_RSP54); + Buffer[3] = MmioRead32 (MMCHS_RSP76); + } else { + Buffer[0] = MmioRead32 (MMCHS_RSP10); + } + + if (Type == MMC_RESPONSE_TYPE_CSD) { + mMaxDataTransferRate = Buffer[3] & 0xFF; + } else if (Type == MMC_RESPONSE_TYPE_RCA) { + mRca = Buffer[0] >> 16; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +MMCReadBlockData ( + IN EFI_MMC_HOST_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Length, + IN UINT32* Buffer + ) +{ + UINTN MmcStatus; + UINTN Count; + UINTN RetryCount = 0; + + DEBUG ((DEBUG_BLKIO, "MMCReadBlockData(LBA: 0x%x, Length: 0x%x, Buffer: 0x%x)\n", Lba, Length, Buffer)); + + // Check controller status to make sure there is no error. + while (RetryCount < MAX_RETRY_COUNT) { + do { + // Read Status. + MmcStatus = MmioRead32 (MMCHS_STAT); + } while(MmcStatus == 0); + + // Check if Buffer read ready (BRR) bit is set? + if (MmcStatus & BRR) { + + // Clear BRR bit + MmioOr32 (MMCHS_STAT, BRR); + + for (Count = 0; Count < Length / 4; Count++) { + *Buffer++ = MmioRead32(MMCHS_DATA); + } + break; + } + RetryCount++; + } + + if (RetryCount == MAX_RETRY_COUNT) { + return EFI_TIMEOUT; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +MMCWriteBlockData ( + IN EFI_MMC_HOST_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Length, + IN UINT32* Buffer + ) +{ + UINTN MmcStatus; + UINTN Count; + UINTN RetryCount = 0; + + // Check controller status to make sure there is no error. + while (RetryCount < MAX_RETRY_COUNT) { + do { + // Read Status. + MmcStatus = MmioRead32 (MMCHS_STAT); + } while(MmcStatus == 0); + + // Check if Buffer write ready (BWR) bit is set? + if (MmcStatus & BWR) { + + // Clear BWR bit + MmioOr32 (MMCHS_STAT, BWR); + + // Write block worth of data. + for (Count = 0; Count < Length / 4; Count++) { + MmioWrite32 (MMCHS_DATA, *Buffer++); + } + + break; + } + RetryCount++; + } + + if (RetryCount == MAX_RETRY_COUNT) { + return EFI_TIMEOUT; + } + + return EFI_SUCCESS; +} + +EFI_MMC_HOST_PROTOCOL gMMCHost = { + MMC_HOST_PROTOCOL_REVISION, + MMCIsCardPresent, + MMCIsReadOnly, + MMCBuildDevicePath, + MMCNotifyState, + MMCSendCommand, + MMCReceiveResponse, + MMCReadBlockData, + MMCWriteBlockData +}; + +EFI_STATUS +MMCInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle = NULL; + + DEBUG ((DEBUG_BLKIO, "MMCInitialize()\n")); + DEBUG ((EFI_D_ERROR, "-MMCInitialize()-\n")); + + //Status = gBS->LocateProtocol (&gEmbeddedExternalDeviceProtocolGuid, NULL, (VOID **)&gTPS65950); + //ASSERT_EFI_ERROR(Status); + + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiMmcHostProtocolGuid, &gMMCHost, + NULL + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.h new file mode 100755 index 000000000..0654c11de --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.h @@ -0,0 +1,44 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _MMC_HOST_DXE_H_ +#define _MMC_HOST_DXE_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include + +#include +#include +#include +#include + +#include +//#include + +#define MAX_RETRY_COUNT (100*5) + +extern EFI_BLOCK_IO_PROTOCOL gBlockIo; + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf new file mode 100755 index 000000000..272a2d74f --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf @@ -0,0 +1,50 @@ +# Copyright (c) 2011, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MMC + FILE_GUID = 100c2cfa-b586-4198-9b4c-1683d195b1da + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = MMCInitialize + + +[Sources.common] + MmcHostDxe.c + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + +[LibraryClasses] + PcdLib + UefiLib + UefiDriverEntryPoint + MemoryAllocationLib + IoLib + DmaLib + +[Guids] + +[Protocols] + gEfiBlockIoProtocolGuid + gEfiCpuArchProtocolGuid + gEfiDevicePathProtocolGuid + gEmbeddedExternalDeviceProtocolGuid + gEfiMmcHostProtocolGuid + +[Pcd] + +[depex] + TRUE diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335xMMCHS.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335xMMCHS.h new file mode 100644 index 000000000..62ebff922 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335xMMCHS.h @@ -0,0 +1,214 @@ +/** @file + + Copyright (c) 2008 - 2009, Apple Inc. 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 __AM335XSDIO_H__ +#define __AM335XSDIO_H__ + +//MMC/SD/SDIO1 register definitions. +#define MMCHS1BASE 0x48060100 +#define MMC_REFERENCE_CLK (48000000) // 48 MHz + +#define MMCHS_SYSCONFIG (MMCHS1BASE + 0x10) +#define SOFTRESET BIT1 +#define ENAWAKEUP BIT2 + +#define MMCHS_SYSSTATUS (MMCHS1BASE + 0x14) +#define RESETDONE_MASK BIT0 +#define RESETDONE BIT0 + +#define MMCHS_CSRE (MMCHS1BASE + 0x24) +#define MMCHS_SYSTEST (MMCHS1BASE + 0x28) + +#define MMCHS_CON (MMCHS1BASE + 0x2C) +#define OD BIT0 +#define NOINIT (0x0UL << 1) +#define INIT BIT1 +#define HR BIT2 +#define STR BIT3 +#define MODE BIT4 +#define DW8_1_4_BIT (0x0UL << 5) +#define DW8_8_BIT BIT5 +#define MIT BIT6 +#define CDP BIT7 +#define WPP BIT8 +#define CTPL BIT11 +#define CEATA_OFF (0x0UL << 12) +#define CEATA_ON BIT12 + +#define MMCHS_PWCNT (MMCHS1BASE + 0x30) + +#define MMCHS_BLK (MMCHS1BASE + 0x104) +#define BLEN_512BYTES (0x200UL << 0) + +#define MMCHS_ARG (MMCHS1BASE + 0x108) + +#define MMCHS_CMD (MMCHS1BASE + 0x10C) +#define DE_ENABLE BIT0 +#define BCE_ENABLE BIT1 +#define ACEN_ENABLE BIT2 +#define DDIR_READ BIT4 +#define DDIR_WRITE (0x0UL << 4) +#define MSBS_SGLEBLK (0x0UL << 5) +#define MSBS_MULTBLK BIT5 +#define RSP_TYPE_MASK (0x3UL << 16) +#define RSP_TYPE_136BITS BIT16 +#define RSP_TYPE_48BITS (0x2UL << 16) +#define CCCE_ENABLE BIT19 +#define CICE_ENABLE BIT20 +#define DP_ENABLE BIT21 +#define INDX(CMD_INDX) ((CMD_INDX & 0x3F) << 24) + +#define MMCHS_RSP10 (MMCHS1BASE + 0x110) +#define MMCHS_RSP32 (MMCHS1BASE + 0x114) +#define MMCHS_RSP54 (MMCHS1BASE + 0x118) +#define MMCHS_RSP76 (MMCHS1BASE + 0x11C) +#define MMCHS_DATA (MMCHS1BASE + 0x120) + +#define MMCHS_PSTATE (MMCHS1BASE + 0x124) +#define CMDI_MASK BIT0 +#define CMDI_ALLOWED (0x0UL << 0) +#define CMDI_NOT_ALLOWED BIT0 +#define DATI_MASK BIT1 +#define DATI_ALLOWED (0x0UL << 1) +#define DATI_NOT_ALLOWED BIT1 + +#define MMCHS_HCTL (MMCHS1BASE + 0x128) +#define DTW_1_BIT (0x0UL << 1) +#define DTW_4_BIT BIT1 +#define SDBP_MASK BIT8 +#define SDBP_OFF (0x0UL << 8) +#define SDBP_ON BIT8 +#define SDVS_1_8_V (0x5UL << 9) +#define SDVS_3_0_V (0x6UL << 9) +#define IWE BIT24 + +#define MMCHS_SYSCTL (MMCHS1BASE + 0x12C) +#define ICE BIT0 +#define ICS_MASK BIT1 +#define ICS BIT1 +#define CEN BIT2 +#define CLKD_MASK (0x3FFUL << 6) +#define CLKD_80KHZ (0x258UL) //(96*1000/80)/2 +#define CLKD_400KHZ (0xF0UL) +#define DTO_MASK (0xFUL << 16) +#define DTO_VAL (0xEUL << 16) +#define SRA BIT24 +#define SRC_MASK BIT25 +#define SRC BIT25 +#define SRD BIT26 + +#define MMCHS_STAT (MMCHS1BASE + 0x130) +#define CC BIT0 +#define TC BIT1 +#define BWR BIT4 +#define BRR BIT5 +#define ERRI BIT15 +#define CTO BIT16 +#define DTO BIT20 +#define DCRC BIT21 +#define DEB BIT22 + +#define MMCHS_IE (MMCHS1BASE + 0x134) +#define CC_EN BIT0 +#define TC_EN BIT1 +#define BWR_EN BIT4 +#define BRR_EN BIT5 +#define CTO_EN BIT16 +#define CCRC_EN BIT17 +#define CEB_EN BIT18 +#define CIE_EN BIT19 +#define DTO_EN BIT20 +#define DCRC_EN BIT21 +#define DEB_EN BIT22 +#define CERR_EN BIT28 +#define BADA_EN BIT29 + +#define MMCHS_ISE (MMCHS1BASE + 0x138) +#define CC_SIGEN BIT0 +#define TC_SIGEN BIT1 +#define BWR_SIGEN BIT4 +#define BRR_SIGEN BIT5 +#define CTO_SIGEN BIT16 +#define CCRC_SIGEN BIT17 +#define CEB_SIGEN BIT18 +#define CIE_SIGEN BIT19 +#define DTO_SIGEN BIT20 +#define DCRC_SIGEN BIT21 +#define DEB_SIGEN BIT22 +#define CERR_SIGEN BIT28 +#define BADA_SIGEN BIT29 + +#define MMCHS_AC12 (MMCHS1BASE + 0x13C) + +#define MMCHS_CAPA (MMCHS1BASE + 0x140) +#define VS30 BIT25 +#define VS18 BIT26 + +#define MMCHS_CUR_CAPA (MMCHS1BASE + 0x148) +#define MMCHS_REV (MMCHS1BASE + 0x1FC) + +#define CMD0 INDX(0) +#define CMD0_INT_EN (CC_EN | CEB_EN) + +#define CMD1 (INDX(1) | RSP_TYPE_48BITS) +#define CMD1_INT_EN (CC_EN | CEB_EN | CTO_EN) + +#define CMD2 (INDX(2) | CCCE_ENABLE | RSP_TYPE_136BITS) +#define CMD2_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define CMD3 (INDX(3) | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS) +#define CMD3_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define CMD5 (INDX(5) | RSP_TYPE_48BITS) +#define CMD5_INT_EN (CC_EN | CEB_EN | CTO_EN) + +#define CMD7 (INDX(7) | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS) +#define CMD7_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define CMD8 (INDX(8) | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS) +#define CMD8_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) +//Reserved(0)[12:31], Supply voltage(1)[11:8], check pattern(0xCE)[7:0] = 0x1CE +#define CMD8_ARG (0x0UL << 12 | BIT8 | 0xCEUL << 0) + +#define CMD9 (INDX(9) | CCCE_ENABLE | RSP_TYPE_136BITS) +#define CMD9_INT_EN (CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define CMD16 (INDX(16) | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS) +#define CMD16_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define CMD17 (INDX(17) | DP_ENABLE | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS | DDIR_READ) +#define CMD17_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | TC_EN | BRR_EN | CTO_EN | DTO_EN | DCRC_EN | DEB_EN | CEB_EN) + +#define CMD18 (INDX(18) | DP_ENABLE | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS | MSBS_MULTBLK | DDIR_READ | BCE_ENABLE | DE_ENABLE) +#define CMD18_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | TC_EN | BRR_EN | CTO_EN | DTO_EN | DCRC_EN | DEB_EN | CEB_EN) + +#define CMD23 (INDX(23) | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS) +#define CMD23_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define CMD24 (INDX(24) | DP_ENABLE | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS | DDIR_WRITE) +#define CMD24_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | TC_EN | BWR_EN | CTO_EN | DTO_EN | DCRC_EN | DEB_EN | CEB_EN) + +#define CMD25 (INDX(25) | DP_ENABLE | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS | MSBS_MULTBLK | DDIR_READ | BCE_ENABLE | DE_ENABLE) +#define CMD25_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | TC_EN | BRR_EN | CTO_EN | DTO_EN | DCRC_EN | DEB_EN | CEB_EN) + +#define CMD55 (INDX(55) | CICE_ENABLE | CCCE_ENABLE | RSP_TYPE_48BITS) +#define CMD55_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define ACMD41 (INDX(41) | RSP_TYPE_48BITS) +#define ACMD41_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#define ACMD6 (INDX(6) | RSP_TYPE_48BITS) +#define ACMD6_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN) + +#endif //__AM335XSDIO_H__ diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c new file mode 100755 index 000000000..3b29adef5 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c @@ -0,0 +1,297 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + + +EMBEDDED_EXTERNAL_DEVICE *gTPS65950; +INT16 TimeZone = EFI_UNSPECIFIED_TIMEZONE; + +/** + Returns the current time and date information, and the time-keeping capabilities + of the hardware platform. + + @param Time A pointer to storage to receive a snapshot of the current time. + @param Capabilities An optional pointer to a buffer to receive the real time clock + device's capabilities. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER Time is NULL. + @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. + +**/ +EFI_STATUS +EFIAPI +LibGetTime ( + OUT EFI_TIME *Time, + OUT EFI_TIME_CAPABILITIES *Capabilities + ) +{/* + EFI_STATUS Status; + UINT8 Data; + EFI_TPL OldTpl; + + if (Time == NULL) { + return EFI_INVALID_PARAMETER; + } + + OldTpl = gBS->RaiseTPL(TPL_NOTIFY); + + /* Get time and date * + ZeroMem(Time, sizeof(EFI_TIME)); + + // Latch values + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Data |= BIT6; + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + // Read registers + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, YEARS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Time->Year = 2000 + ((Data >> 4) & 0xF) * 10 + (Data & 0xF); + + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MONTHS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Time->Month = ((Data >> 4) & 0x1) * 10 + (Data & 0xF); + + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, DAYS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Time->Day = ((Data >> 4) & 0x3) * 10 + (Data & 0xF); + + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, HOURS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Time->Hour = ((Data >> 4) & 0x3) * 10 + (Data & 0xF); + + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MINUTES_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Time->Minute = ((Data >> 4) & 0x7) * 10 + (Data & 0xF); + + Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, SECONDS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + Time->Second = ((Data >> 4) & 0x7) * 10 + (Data & 0xF); + + Time->TimeZone = TimeZone; + // TODO: check what to use here + Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT; + + // Set capabilities + + // TODO: Set real capabilities + if (Capabilities != NULL) { + Capabilities->Resolution = 1; + Capabilities->Accuracy = 50000000; + Capabilities->SetsToZero = FALSE; + } + +EXIT: + gBS->RestoreTPL(OldTpl); +*/ + return EFI_SUCCESS; +} + +/** + Sets the current local time and date information. + + @param Time A pointer to the current time. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. + +**/ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + EFI_STATUS Status; + UINT8 Data; + UINT8 MonthDayCount[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + EFI_TPL OldTpl; + + // Input validation according both to UEFI spec and hardware constraints + // UEFI spec says valid year range is 1900-9999 but TPS only supports 2000-2099 + if ( (Time == NULL) + || (Time->Year < 2000 || Time->Year > 2099) + || (Time->Month < 1 || Time->Month > 12) + || (Time->Day < 1 || Time->Day > MonthDayCount[Time->Month]) + || (Time->Hour > 23) + || (Time->Minute > 59) + || (Time->Second > 59) + || (Time->Nanosecond > 999999999) + || ((Time->TimeZone < -1440 || Time->TimeZone > 1440) && Time->TimeZone != 2047) + ) { + return EFI_INVALID_PARAMETER; + } + + OldTpl = gBS->RaiseTPL(TPL_NOTIFY); + + Data = Time->Year - 2000; + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, YEARS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + Data = ((Time->Month / 10) << 4) | (Time->Month % 10); + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MONTHS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + Data = ((Time->Day / 10) << 4) | (Time->Day % 10); + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, DAYS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + Data = ((Time->Hour / 10) << 4) | (Time->Hour % 10); + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, HOURS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + Data = ((Time->Minute / 10) << 4) | (Time->Minute % 10); + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MINUTES_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + Data = ((Time->Second / 10) << 4) | (Time->Second % 10); + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, SECONDS_REG), 1, &Data); + if (Status != EFI_SUCCESS) goto EXIT; + + TimeZone = Time->TimeZone; + +EXIT: + gBS->RestoreTPL(OldTpl); + + return (Status == EFI_SUCCESS) ? Status : EFI_DEVICE_ERROR; +} + +/** + Returns the current wakeup alarm clock setting. + + @param Enabled Indicates if the alarm is currently enabled or disabled. + @param Pending Indicates if the alarm signal is pending and requires acknowledgement. + @param Time The current alarm setting. + + @retval EFI_SUCCESS The alarm settings were returned. + @retval EFI_INVALID_PARAMETER Any parameter is NULL. + @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. + +**/ +EFI_STATUS +EFIAPI +LibGetWakeupTime ( + OUT BOOLEAN *Enabled, + OUT BOOLEAN *Pending, + OUT EFI_TIME *Time + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Sets the system wakeup alarm clock time. + + @param Enabled Enable or disable the wakeup alarm. + @param Time If Enable is TRUE, the time to set the wakeup alarm for. + + @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If + Enable is FALSE, then the wakeup alarm was disabled. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. + @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. + +**/ +EFI_STATUS +EFIAPI +LibSetWakeupTime ( + IN BOOLEAN Enabled, + OUT EFI_TIME *Time + ) +{ + return EFI_UNSUPPORTED; +} + +/** + This is the declaration of an EFI image entry point. This can be the entry point to an application + written to this specification, an EFI boot service driver, or an EFI runtime driver. + + @param ImageHandle Handle that identifies the loaded image. + @param SystemTable System Table for this image. + + @retval EFI_SUCCESS The operation completed successfully. + +**/ +EFI_STATUS +EFIAPI +LibRtcInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + UINT8 Data; + EFI_TPL OldTpl; + + Status = gBS->LocateProtocol (&gEmbeddedExternalDeviceProtocolGuid, NULL, (VOID **)&gTPS65950); + ASSERT_EFI_ERROR(Status); + + OldTpl = gBS->RaiseTPL(TPL_NOTIFY); + Data = 1; + Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data); + ASSERT_EFI_ERROR(Status); + gBS->RestoreTPL(OldTpl); + + // Setup the setters and getters + gRT->GetTime = LibGetTime; + gRT->SetTime = LibSetTime; + gRT->GetWakeupTime = LibGetWakeupTime; + gRT->SetWakeupTime = LibSetWakeupTime; + + // Install the protocol + Handle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiRealTimeClockArchProtocolGuid, NULL, + NULL + ); + + return Status; +} + +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers in + lib to virtual mode. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +LibRtcVirtualNotifyEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + return; +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100755 index 000000000..e0aec5b4d --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,38 @@ +# Copyright (c) 2011, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = RealTimeClockLib + FILE_GUID = EC1713DB-7DB5-4c99-8FE2-6F52F95A1132 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + +[LibraryClasses] + IoLib + UefiLib + DebugLib + PcdLib + +[Protocols] + gEmbeddedExternalDeviceProtocolGuid + +[depex] + gEmbeddedExternalDeviceProtocolGuid -- cgit v1.2.3 From 0dc2225c0e7831ed1cd2ce02f5b48f1cf28c3708 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 21:57:12 +0530 Subject: BeagleBoneBlackPkg: Remove ArmTrustedMonitorLibNull, RealtimeClockLib Remove duplicates. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 6 - .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 83 +-- .../Drivers/MmcHostDxe/MmcHostDxe.c | 52 -- .../AArch64/ArmTrustedMonitorLibNull.c | 24 - .../Arm/ArmTrustedMonitorLibNull.c | 38 -- .../ArmTrustedMonitorLibNull/Arm/MonitorTable.S | 41 -- .../ArmTrustedMonitorLibNull/Arm/MonitorTable.asm | 40 -- .../ArmTrustedMonitorLibNull.inf | 40 -- .../RealTimeClockLib/PL031RealTimeClockLib.c | 683 --------------------- .../RealTimeClockLib/PL031RealTimeClockLib.inf | 46 -- .../Library/RealTimeClockLib/RealTimeClockLib.c | 297 --------- .../Library/RealTimeClockLib/RealTimeClockLib.inf | 38 -- .../ResetSystemLib/BaseResetSystemLibNull.c | 79 --- .../ResetSystemLib/BaseResetSystemLibNull.inf | 37 -- .../Library/SerialPortLib/SerialPortLib.c | 460 +++++++------- 15 files changed, 231 insertions(+), 1733 deletions(-) delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf delete mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c delete mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 374cafdc2..758254258 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -379,12 +379,6 @@ EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf - # - # - # Semi-hosting filesystem - # - #ArmPkg/Filesystem/SemihostFs/SemihostFs.inf - # # FAT filesystem + GPT/MBR partitioning # diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf index a2ae9e4e8..af8e4fdbb 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf @@ -49,19 +49,10 @@ NumBlocks = 0x0200 # ################################################################################ -#0x00000000|0x00050000 -#gArmTokenSpaceGuid.PcdSecureFvBaseAddress|gArmTokenSpaceGuid.PcdSecureFvSize -#FV = FVMAIN_COMPACT - 0x00000000|0x000F0000 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize FV = FVMAIN_COMPACT -#0x00050000|0x000F0000 -#gArmTokenSpaceGuid.PcdDxeFvBaseAddress|gArmTokenSpaceGuid.PcdDxeFvSize -#FV = FVMAIN_COMPRESSED - - ################################################################################ # # FV Section @@ -73,27 +64,6 @@ FV = FVMAIN_COMPACT # ################################################################################ -#[FV.FVMAIN_SEC] -#FvAlignment = 8 -#ERASE_POLARITY = 1 -#MEMORY_MAPPED = TRUE -#STICKY_WRITE = TRUE -#LOCK_CAP = TRUE -#LOCK_STATUS = TRUE -#WRITE_DISABLED_CAP = TRUE -#WRITE_ENABLED_CAP = TRUE -#WRITE_STATUS = TRUE -#WRITE_LOCK_CAP = TRUE -#WRITE_LOCK_STATUS = TRUE -#READ_DISABLED_CAP = TRUE -#READ_ENABLED_CAP = TRUE -#READ_STATUS = TRUE -#READ_LOCK_CAP = TRUE -#READ_LOCK_STATUS = TRUE - #INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf - #INF ArmPlatformPkg/PrePi/PeiUniCore.inf - - [FV.FvMain] BlockSize = 0x1000 NumBlocks = 0x200 # This FV gets compressed so make it just big enough @@ -146,21 +116,11 @@ READ_LOCK_STATUS = TRUE # Simple TextIn/TextOut for UEFI Terminal INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf - # - # Semi-hosting filesystem (Required the Hardware Debugger to be connected) - # - #INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf - # # MMC/SD # INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf - - # - # Power IC - # - #INF Omap35xxPkg/TPS65950Dxe/TPS65950.inf # # FAT filesystem + GPT/MBR partitioning @@ -200,15 +160,7 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf -# INF MdeModulePkg/Core/Pei/PeiMain.inf -# INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf -# INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf -# INF ArmPkg/Drivers/CpuPei/CpuPei.inf -# INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf -# INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf -# INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf -# INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { @@ -216,39 +168,6 @@ READ_LOCK_STATUS = TRUE } } -#[FV.FVMAIN_COMPRESSED] -#FvAlignment = 8 -#ERASE_POLARITY = 1 -#MEMORY_MAPPED = TRUE -#STICKY_WRITE = TRUE -#LOCK_CAP = TRUE -#LOCK_STATUS = TRUE -#WRITE_DISABLED_CAP = TRUE -#WRITE_ENABLED_CAP = TRUE -#WRITE_STATUS = TRUE -#WRITE_LOCK_CAP = TRUE -#WRITE_LOCK_STATUS = TRUE -#READ_DISABLED_CAP = TRUE -#READ_ENABLED_CAP = TRUE -#READ_STATUS = TRUE -#READ_LOCK_CAP = TRUE -#READ_LOCK_STATUS = TRUE - - -# INF MdeModulePkg/Core/Pei/PeiMain.inf -# INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf -# INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf -# INF ArmPkg/Drivers/CpuPei/CpuPei.inf -# INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf -# INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf -# INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf -# INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf - -# FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { -# SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { -# SECTION FV_IMAGE = FVMAIN -# } -# } ################################################################################ # diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c index 64a533b3c..cd07491ba 100755 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c @@ -15,7 +15,6 @@ #include "MmcHostDxe.h" -EMBEDDED_EXTERNAL_DEVICE *gTPS65950; UINT8 mMaxDataTransferRate = 0; UINT32 mRca = 0; BOOLEAN mBitModeSet = FALSE; @@ -250,32 +249,6 @@ InitializeMMCHS ( VOID ) { - //UINT8 Data; - //EFI_STATUS Status; - - DEBUG ((DEBUG_BLKIO, "InitializeMMCHS()\n")); - DEBUG ((EFI_D_ERROR, "--InitializeMMCHS()--\n")); -/* - // Select Device group to belong to P1 device group in Power IC. - Data = DEV_GRP_P1; - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, VMMC1_DEV_GRP), 1, &Data); - ASSERT_EFI_ERROR(Status); - - // Configure voltage regulator for MMC1 in Power IC to output 3.0 voltage. - Data = VSEL_3_00V; - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, VMMC1_DEDICATED_REG), 1, &Data); - ASSERT_EFI_ERROR(Status); - - // After ramping up voltage, set VDDS stable bit to indicate that voltage level is stable. - MmioOr32 (CONTROL_PBIAS_LITE, (PBIASLITEVMODE0 | PBIASLITEPWRDNZ0 | PBIASSPEEDCTRL0 | PBIASLITEVMODE1 | PBIASLITEWRDNZ1)); - - // Enable WP GPIO - MmioAndThenOr32 (GPIO1_BASE + GPIO_OE, ~BIT23, BIT23); - - // Enable Card Detect - Data = CARD_DETECT_ENABLE; - gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID2, TPS65950_GPIO_CTRL), 1, &Data); -*/ return EFI_SUCCESS; } @@ -284,19 +257,6 @@ MMCIsCardPresent ( IN EFI_MMC_HOST_PROTOCOL *This ) { - //EFI_STATUS Status; - //UINT8 Data; -/* - // - // Card detect is a GPIO0 on the TPS65950 - // - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID2, GPIODATAIN1), 1, &Data); - if (EFI_ERROR (Status)) { - return FALSE; - } - - return !(Data & CARD_DETECT_BIT); - */ return TRUE; } @@ -305,15 +265,7 @@ MMCIsReadOnly ( IN EFI_MMC_HOST_PROTOCOL *This ) { - /* Note: - * On our BeagleBoard the SD card WP pin is always read as TRUE. - * Probably something wrong with GPIO configuration. - * BeagleBoard-xM uses microSD cards so there is no write protect at all. - * Hence commenting out SD card WP pin read status. - */ - //return (MmioRead32 (GPIO1_BASE + GPIO_DATAIN) & BIT23) == BIT23; return 0; - } // TODO @@ -665,10 +617,6 @@ MMCInitialize ( EFI_HANDLE Handle = NULL; DEBUG ((DEBUG_BLKIO, "MMCInitialize()\n")); - DEBUG ((EFI_D_ERROR, "-MMCInitialize()-\n")); - - //Status = gBS->LocateProtocol (&gEmbeddedExternalDeviceProtocolGuid, NULL, (VOID **)&gTPS65950); - //ASSERT_EFI_ERROR(Status); Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c deleted file mode 100644 index 72c62d7f1..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/AArch64/ArmTrustedMonitorLibNull.c +++ /dev/null @@ -1,24 +0,0 @@ -/** @file -* Main file supporting the Monitor World on ARM PLatforms -* -* Copyright (c) 2012-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -VOID -ArmSecureMonitorWorldInitialize ( - VOID - ) -{ - // Do not touch the EL3 Exception Vector Table Register. - // The default default DebugAgentLib could have already set its own vector - // into EL3 to catch abort exceptions. -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c deleted file mode 100644 index 1f950d78f..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/ArmTrustedMonitorLibNull.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file -* Main file supporting the Monitor World on ARM PLatforms -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include -#include - -#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0) - -VOID -MonitorVectorTable ( - VOID - ); - -VOID -ArmSecureMonitorWorldInitialize ( - VOID - ) -{ - // Ensure the Monitor Table is 32bit aligned - ASSERT (((UINTN)&MonitorVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0); - - // Write the Monitor Mode Vector Table Address - ArmWriteMVBar ((UINTN) &MonitorVectorTable); -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S deleted file mode 100644 index 3e75bee50..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.S +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (c) 2011, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include - -.text -.align 5 - -GCC_ASM_EXPORT(MonitorVectorTable) - -ASM_PFX(MonitorVectorTable): - -_MonitorResetEntry: - b _MonitorResetEntry -_MonitorUndefinedEntry: - b _MonitorUndefinedEntry -_MonitorSmcEntry: - b _MonitorSmcEntry -_MonitorPrefetchEntry: - b _MonitorPrefetchEntry -_MonitorDataAbortEntry: - b _MonitorDataAbortEntry -_MonitorReservedEntry: - b _MonitorReservedEntry -_MonitorIrqEntry: - b _MonitorIrqEntry -_MonitorFiqEntry: - b _MonitorFiqEntry - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm deleted file mode 100644 index f4f515d05..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/Arm/MonitorTable.asm +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) 2011, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include - - EXPORT MonitorVectorTable - - PRESERVE8 - AREA MonitoVectorTableArea, CODE, READONLY, CODEALIGN, ALIGN=5 - -MonitorVectorTable - -_MonitorResetEntry - b _MonitorResetEntry -_MonitorUndefinedEntry - b _MonitorUndefinedEntry -_MonitorSmcEntry - b _MonitorSmcEntry -_MonitorPrefetchEntry - b _MonitorPrefetchEntry -_MonitorDataAbortEntry - b _MonitorDataAbortEntry -_MonitorReservedEntry - b _MonitorReservedEntry -_MonitorIrqEntry - b _MonitorIrqEntry -_MonitorFiqEntry - b _MonitorFiqEntry - - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf deleted file mode 100644 index da867e1fe..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf +++ /dev/null @@ -1,40 +0,0 @@ -#/* @file -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmTrustedMonitorLibNull - FILE_GUID = c4b50eb2-ed16-4283-a5b0-a7341c3f997b - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmTrustedMonitorLib - -[Sources.ARM] - Arm/ArmTrustedMonitorLibNull.c - Arm/MonitorTable.asm | RVCT - Arm/MonitorTable.S | GCC - -[Sources.AARCH64] - AArch64/ArmTrustedMonitorLibNull.c - -[Packages] - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - MdePkg/MdePkg.dec - -[LibraryClasses] - ArmLib - BaseLib - DebugLib - PcdLib - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c deleted file mode 100644 index 9115e9c26..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.c +++ /dev/null @@ -1,683 +0,0 @@ -/** @file - Implement EFI RealTimeClock runtime services via RTC Lib. - - Currently this driver does not support runtime virtual calling. - - Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -//#include - -STATIC CONST CHAR16 mTimeZoneVariableName[] = L"PL031RtcTimeZone"; -STATIC CONST CHAR16 mDaylightVariableName[] = L"PL031RtcDaylight"; -STATIC BOOLEAN mPL031Initialized = FALSE; -STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; -STATIC UINTN mPL031RtcBase; - -EFI_STATUS -IdentifyPL031 ( - VOID - ) -{ - EFI_STATUS Status; - - // Check if this is a PrimeCell Peripheral - if ( (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID0) != 0x0D) - || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID1) != 0xF0) - || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID2) != 0x05) - || (MmioRead8 (mPL031RtcBase + PL031_RTC_PCELL_ID3) != 0xB1)) { - Status = EFI_NOT_FOUND; - goto EXIT; - } - - // Check if this PrimeCell Peripheral is the PL031 Real Time Clock - if ( (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID0) != 0x31) - || (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID1) != 0x10) - || ((MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID2) & 0xF) != 0x04) - || (MmioRead8 (mPL031RtcBase + PL031_RTC_PERIPH_ID3) != 0x00)) { - Status = EFI_NOT_FOUND; - goto EXIT; - } - - Status = EFI_SUCCESS; - - EXIT: - return Status; -} - -EFI_STATUS -InitializePL031 ( - VOID - ) -{ - EFI_STATUS Status; - - // Prepare the hardware - Status = IdentifyPL031(); - if (EFI_ERROR (Status)) { - goto EXIT; - } - - // Ensure interrupts are masked. We do not want RTC interrupts in UEFI - if ((MmioRead32 (mPL031RtcBase + PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER) & PL031_SET_IRQ_MASK) != PL031_SET_IRQ_MASK) { - MmioOr32 (mPL031RtcBase + PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER, PL031_SET_IRQ_MASK); - } - - // Clear any existing interrupts - if ((MmioRead32 (mPL031RtcBase + PL031_RTC_RIS_RAW_IRQ_STATUS_REGISTER) & PL031_IRQ_TRIGGERED) == PL031_IRQ_TRIGGERED) { - MmioOr32 (mPL031RtcBase + PL031_RTC_ICR_IRQ_CLEAR_REGISTER, PL031_CLEAR_IRQ); - } - - // Start the clock counter - if ((MmioRead32 (mPL031RtcBase + PL031_RTC_CR_CONTROL_REGISTER) & PL031_RTC_ENABLED) != PL031_RTC_ENABLED) { - MmioOr32 (mPL031RtcBase + PL031_RTC_CR_CONTROL_REGISTER, PL031_RTC_ENABLED); - } - - mPL031Initialized = TRUE; - - EXIT: - return Status; -} - -/** - Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME - **/ -VOID -EpochToEfiTime ( - IN UINTN EpochSeconds, - OUT EFI_TIME *Time - ) -{ - UINTN a; - UINTN b; - UINTN c; - UINTN d; - UINTN g; - UINTN j; - UINTN m; - UINTN y; - UINTN da; - UINTN db; - UINTN dc; - UINTN dg; - UINTN hh; - UINTN mm; - UINTN ss; - UINTN J; - - J = (EpochSeconds / 86400) + 2440588; - j = J + 32044; - g = j / 146097; - dg = j % 146097; - c = (((dg / 36524) + 1) * 3) / 4; - dc = dg - (c * 36524); - b = dc / 1461; - db = dc % 1461; - a = (((db / 365) + 1) * 3) / 4; - da = db - (a * 365); - y = (g * 400) + (c * 100) + (b * 4) + a; - m = (((da * 5) + 308) / 153) - 2; - d = da - (((m + 4) * 153) / 5) + 122; - - Time->Year = y - 4800 + ((m + 2) / 12); - Time->Month = ((m + 2) % 12) + 1; - Time->Day = d + 1; - - ss = EpochSeconds % 60; - a = (EpochSeconds - ss) / 60; - mm = a % 60; - b = (a - mm) / 60; - hh = b % 24; - - Time->Hour = hh; - Time->Minute = mm; - Time->Second = ss; - Time->Nanosecond = 0; - -} - -/** - Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) - **/ -UINTN -EfiTimeToEpoch ( - IN EFI_TIME *Time - ) -{ - UINTN a; - UINTN y; - UINTN m; - UINTN JulianDate; // Absolute Julian Date representation of the supplied Time - UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY - UINTN EpochSeconds; - - a = (14 - Time->Month) / 12 ; - y = Time->Year + 4800 - a; - m = Time->Month + (12*a) - 3; - - JulianDate = Time->Day + ((153*m + 2)/5) + (365*y) + (y/4) - (y/100) + (y/400) - 32045; - - ASSERT (JulianDate >= EPOCH_JULIAN_DATE); - EpochDays = JulianDate - EPOCH_JULIAN_DATE; - - EpochSeconds = (EpochDays * SEC_PER_DAY) + ((UINTN)Time->Hour * SEC_PER_HOUR) + (Time->Minute * SEC_PER_MIN) + Time->Second; - - return EpochSeconds; -} - -BOOLEAN -IsLeapYear ( - IN EFI_TIME *Time - ) -{ - if (Time->Year % 4 == 0) { - if (Time->Year % 100 == 0) { - if (Time->Year % 400 == 0) { - return TRUE; - } else { - return FALSE; - } - } else { - return TRUE; - } - } else { - return FALSE; - } -} - -BOOLEAN -DayValid ( - IN EFI_TIME *Time - ) -{ - INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - - if (Time->Day < 1 || - Time->Day > DayOfMonth[Time->Month - 1] || - (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28)) - ) { - return FALSE; - } - - return TRUE; -} - -/** - Returns the current time and date information, and the time-keeping capabilities - of the hardware platform. - - @param Time A pointer to storage to receive a snapshot of the current time. - @param Capabilities An optional pointer to a buffer to receive the real time clock - device's capabilities. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_INVALID_PARAMETER Time is NULL. - @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. - @retval EFI_SECURITY_VIOLATION The time could not be retrieved due to an authentication failure. - -**/ -EFI_STATUS -EFIAPI -LibGetTime ( - OUT EFI_TIME *Time, - OUT EFI_TIME_CAPABILITIES *Capabilities - ) -{ - EFI_STATUS Status = EFI_SUCCESS; - UINT32 EpochSeconds; - INT16 TimeZone; - UINT8 Daylight; - UINTN Size; - - // Initialize the hardware if not already done - if (!mPL031Initialized) { - Status = InitializePL031 (); - if (EFI_ERROR (Status)) { - goto EXIT; - } - } - - // Snapshot the time as early in the function call as possible - // On some platforms we may have access to a battery backed up hardware clock. - // If such RTC exists try to use it first. - Status = 1; - EpochSeconds = 15; - if (Status == EFI_UNSUPPORTED) { - // Battery backed up hardware RTC does not exist, revert to PL031 - EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER); - Status = EFI_SUCCESS; - } else if (EFI_ERROR (Status)) { - // Battery backed up hardware RTC exists but could not be read due to error. Abort. - goto EXIT; - } else { - // Battery backed up hardware RTC exists and we read the time correctly from it. - // Now sync the PL031 to the new time. - MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); - } - - // Ensure Time is a valid pointer - if (Time == NULL) { - Status = EFI_INVALID_PARAMETER; - goto EXIT; - } - - // Get the current time zone information from non-volatile storage - Size = sizeof (TimeZone); - Status = gRT->GetVariable ( - (CHAR16 *)mTimeZoneVariableName, - &gEfiCallerIdGuid, - NULL, - &Size, - (VOID *)&TimeZone - ); - - if (EFI_ERROR (Status)) { - ASSERT(Status != EFI_INVALID_PARAMETER); - ASSERT(Status != EFI_BUFFER_TOO_SMALL); - - if (Status != EFI_NOT_FOUND) - goto EXIT; - - // The time zone variable does not exist in non-volatile storage, so create it. - Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE; - // Store it - Status = gRT->SetVariable ( - (CHAR16 *)mTimeZoneVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - Size, - (VOID *)&(Time->TimeZone) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibGetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", - mTimeZoneVariableName, - Status - )); - goto EXIT; - } - } else { - // Got the time zone - Time->TimeZone = TimeZone; - - // Check TimeZone bounds: -1440 to 1440 or 2047 - if (((Time->TimeZone < -1440) || (Time->TimeZone > 1440)) - && (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE)) { - Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE; - } - - // Adjust for the correct time zone - if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { - EpochSeconds += Time->TimeZone * SEC_PER_MIN; - } - } - - // Get the current daylight information from non-volatile storage - Size = sizeof (Daylight); - Status = gRT->GetVariable ( - (CHAR16 *)mDaylightVariableName, - &gEfiCallerIdGuid, - NULL, - &Size, - (VOID *)&Daylight - ); - - if (EFI_ERROR (Status)) { - ASSERT(Status != EFI_INVALID_PARAMETER); - ASSERT(Status != EFI_BUFFER_TOO_SMALL); - - if (Status != EFI_NOT_FOUND) - goto EXIT; - - // The daylight variable does not exist in non-volatile storage, so create it. - Time->Daylight = 0; - // Store it - Status = gRT->SetVariable ( - (CHAR16 *)mDaylightVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - Size, - (VOID *)&(Time->Daylight) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibGetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", - mDaylightVariableName, - Status - )); - goto EXIT; - } - } else { - // Got the daylight information - Time->Daylight = Daylight; - - // Adjust for the correct period - if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { - // Convert to adjusted time, i.e. spring forwards one hour - EpochSeconds += SEC_PER_HOUR; - } - } - - // Convert from internal 32-bit time to UEFI time - EpochToEfiTime (EpochSeconds, Time); - - // Update the Capabilities info - if (Capabilities != NULL) { - // PL031 runs at frequency 1Hz - Capabilities->Resolution = PL031_COUNTS_PER_SECOND; - // Accuracy in ppm multiplied by 1,000,000, e.g. for 50ppm set 50,000,000 - Capabilities->Accuracy = (UINT32)PcdGet32 (PcdPL031RtcPpmAccuracy); - // FALSE: Setting the time does not clear the values below the resolution level - Capabilities->SetsToZero = FALSE; - } - - EXIT: - return Status; -} - - -/** - Sets the current local time and date information. - - @param Time A pointer to the current time. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_INVALID_PARAMETER A time field is out of range. - @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. - -**/ -EFI_STATUS -EFIAPI -LibSetTime ( - IN EFI_TIME *Time - ) -{ - EFI_STATUS Status; - UINTN EpochSeconds; - - // Check the input parameters are within the range specified by UEFI - if ((Time->Year < 1900) || - (Time->Year > 9999) || - (Time->Month < 1 ) || - (Time->Month > 12 ) || - (!DayValid (Time) ) || - (Time->Hour > 23 ) || - (Time->Minute > 59 ) || - (Time->Second > 59 ) || - (Time->Nanosecond > 999999999) || - (!((Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) || ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440)))) || - (Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT))) - ) { - Status = EFI_INVALID_PARAMETER; - goto EXIT; - } - - // Because the PL031 is a 32-bit counter counting seconds, - // the maximum time span is just over 136 years. - // Time is stored in Unix Epoch format, so it starts in 1970, - // Therefore it can not exceed the year 2106. - if ((Time->Year < 1970) || (Time->Year >= 2106)) { - Status = EFI_UNSUPPORTED; - goto EXIT; - } - - // Initialize the hardware if not already done - if (!mPL031Initialized) { - Status = InitializePL031 (); - if (EFI_ERROR (Status)) { - goto EXIT; - } - } - - EpochSeconds = EfiTimeToEpoch (Time); - - // Adjust for the correct time zone, i.e. convert to UTC time zone - if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { - EpochSeconds -= Time->TimeZone * SEC_PER_MIN; - } - - // TODO: Automatic Daylight activation - - // Adjust for the correct period - if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { - // Convert to un-adjusted time, i.e. fall back one hour - EpochSeconds -= SEC_PER_HOUR; - } - - // On some platforms we may have access to a battery backed up hardware clock. - // - // If such RTC exists then it must be updated first, before the PL031, - // to minimise any time drift. This is important because the battery backed-up - // RTC maintains the master time for the platform across reboots. - // - // If such RTC does not exist then the following function returns UNSUPPORTED. - Status = 0; - if ((EFI_ERROR (Status)) && (Status != EFI_UNSUPPORTED)){ - // Any status message except SUCCESS and UNSUPPORTED indicates a hardware failure. - goto EXIT; - } - - - // Set the PL031 - MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); - - // The accesses to Variable Services can be very slow, because we may be writing to Flash. - // Do this after having set the RTC. - - // Save the current time zone information into non-volatile storage - Status = gRT->SetVariable ( - (CHAR16 *)mTimeZoneVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof (Time->TimeZone), - (VOID *)&(Time->TimeZone) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibSetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", - mTimeZoneVariableName, - Status - )); - goto EXIT; - } - - // Save the current daylight information into non-volatile storage - Status = gRT->SetVariable ( - (CHAR16 *)mDaylightVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof(Time->Daylight), - (VOID *)&(Time->Daylight) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibSetTime: Failed to save %s variable to non-volatile storage, Status = %r\n", - mDaylightVariableName, - Status - )); - goto EXIT; - } - - EXIT: - return Status; -} - - -/** - Returns the current wakeup alarm clock setting. - - @param Enabled Indicates if the alarm is currently enabled or disabled. - @param Pending Indicates if the alarm signal is pending and requires acknowledgement. - @param Time The current alarm setting. - - @retval EFI_SUCCESS The alarm settings were returned. - @retval EFI_INVALID_PARAMETER Any parameter is NULL. - @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. - -**/ -EFI_STATUS -EFIAPI -LibGetWakeupTime ( - OUT BOOLEAN *Enabled, - OUT BOOLEAN *Pending, - OUT EFI_TIME *Time - ) -{ - // Not a required feature - return EFI_UNSUPPORTED; -} - - -/** - Sets the system wakeup alarm clock time. - - @param Enabled Enable or disable the wakeup alarm. - @param Time If Enable is TRUE, the time to set the wakeup alarm for. - - @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If - Enable is FALSE, then the wakeup alarm was disabled. - @retval EFI_INVALID_PARAMETER A time field is out of range. - @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. - @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. - -**/ -EFI_STATUS -EFIAPI -LibSetWakeupTime ( - IN BOOLEAN Enabled, - OUT EFI_TIME *Time - ) -{ - // Not a required feature - return EFI_UNSUPPORTED; -} - -/** - Fixup internal data so that EFI can be call in virtual mode. - Call the passed in Child Notify event and convert any pointers in - lib to virtual mode. - - @param[in] Event The Event that is being processed - @param[in] Context Event Context -**/ -VOID -EFIAPI -LibRtcVirtualNotifyEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - // - // Only needed if you are going to support the OS calling RTC functions in virtual mode. - // You will need to call EfiConvertPointer (). To convert any stored physical addresses - // to virtual address. After the OS transitions to calling in virtual mode, all future - // runtime calls will be made in virtual mode. - // - EfiConvertPointer (0x0, (VOID**)&mPL031RtcBase); - return; -} - -/** - This is the declaration of an EFI image entry point. This can be the entry point to an application - written to this specification, an EFI boot service driver, or an EFI runtime driver. - - @param ImageHandle Handle that identifies the loaded image. - @param SystemTable System Table for this image. - - @retval EFI_SUCCESS The operation completed successfully. - -**/ -EFI_STATUS -EFIAPI -LibRtcInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - - // Initialize RTC Base Address - mPL031RtcBase = PcdGet32 (PcdPL031RtcBase); - - // Declare the controller as EFI_MEMORY_RUNTIME - Status = gDS->AddMemorySpace ( - EfiGcdMemoryTypeMemoryMappedIo, - mPL031RtcBase, SIZE_4KB, - EFI_MEMORY_UC | EFI_MEMORY_RUNTIME - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gDS->SetMemorySpaceAttributes (mPL031RtcBase, SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); - if (EFI_ERROR (Status)) { - return Status; - } - - // Setup the setters and getters - gRT->GetTime = LibGetTime; - gRT->SetTime = LibSetTime; - gRT->GetWakeupTime = LibGetWakeupTime; - gRT->SetWakeupTime = LibSetWakeupTime; - - // Install the protocol - Handle = NULL; - Status = gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - - // - // Register for the virtual address change event - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - LibRtcVirtualNotifyEvent, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mRtcVirtualAddrChangeEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf deleted file mode 100644 index 9cc6e8898..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/PL031RealTimeClockLib.inf +++ /dev/null @@ -1,46 +0,0 @@ -#/** @file -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PL031RealTimeClockLib - FILE_GUID = 470DFB96-E205-4515-A75E-2E60F853E79D - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = RealTimeClockLib - -[Sources.common] - PL031RealTimeClockLib.c - -[Packages] - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - IoLib - UefiLib - DebugLib - PcdLib - #ArmPlatformSysConfigLib - DxeServicesTableLib - UefiRuntimeLib - -[Guids] - gEfiEventVirtualAddressChangeGuid - -[Pcd] - gArmPlatformTokenSpaceGuid.PcdPL031RtcBase - gArmPlatformTokenSpaceGuid.PcdPL031RtcPpmAccuracy diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c deleted file mode 100755 index 3b29adef5..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.c +++ /dev/null @@ -1,297 +0,0 @@ -/** @file -* -* Copyright (c) 2011, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - - -EMBEDDED_EXTERNAL_DEVICE *gTPS65950; -INT16 TimeZone = EFI_UNSPECIFIED_TIMEZONE; - -/** - Returns the current time and date information, and the time-keeping capabilities - of the hardware platform. - - @param Time A pointer to storage to receive a snapshot of the current time. - @param Capabilities An optional pointer to a buffer to receive the real time clock - device's capabilities. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_INVALID_PARAMETER Time is NULL. - @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. - -**/ -EFI_STATUS -EFIAPI -LibGetTime ( - OUT EFI_TIME *Time, - OUT EFI_TIME_CAPABILITIES *Capabilities - ) -{/* - EFI_STATUS Status; - UINT8 Data; - EFI_TPL OldTpl; - - if (Time == NULL) { - return EFI_INVALID_PARAMETER; - } - - OldTpl = gBS->RaiseTPL(TPL_NOTIFY); - - /* Get time and date * - ZeroMem(Time, sizeof(EFI_TIME)); - - // Latch values - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Data |= BIT6; - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - // Read registers - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, YEARS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Time->Year = 2000 + ((Data >> 4) & 0xF) * 10 + (Data & 0xF); - - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MONTHS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Time->Month = ((Data >> 4) & 0x1) * 10 + (Data & 0xF); - - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, DAYS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Time->Day = ((Data >> 4) & 0x3) * 10 + (Data & 0xF); - - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, HOURS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Time->Hour = ((Data >> 4) & 0x3) * 10 + (Data & 0xF); - - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MINUTES_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Time->Minute = ((Data >> 4) & 0x7) * 10 + (Data & 0xF); - - Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, SECONDS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - Time->Second = ((Data >> 4) & 0x7) * 10 + (Data & 0xF); - - Time->TimeZone = TimeZone; - // TODO: check what to use here - Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT; - - // Set capabilities - - // TODO: Set real capabilities - if (Capabilities != NULL) { - Capabilities->Resolution = 1; - Capabilities->Accuracy = 50000000; - Capabilities->SetsToZero = FALSE; - } - -EXIT: - gBS->RestoreTPL(OldTpl); -*/ - return EFI_SUCCESS; -} - -/** - Sets the current local time and date information. - - @param Time A pointer to the current time. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_INVALID_PARAMETER A time field is out of range. - @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. - -**/ -EFI_STATUS -EFIAPI -LibSetTime ( - IN EFI_TIME *Time - ) -{ - EFI_STATUS Status; - UINT8 Data; - UINT8 MonthDayCount[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - EFI_TPL OldTpl; - - // Input validation according both to UEFI spec and hardware constraints - // UEFI spec says valid year range is 1900-9999 but TPS only supports 2000-2099 - if ( (Time == NULL) - || (Time->Year < 2000 || Time->Year > 2099) - || (Time->Month < 1 || Time->Month > 12) - || (Time->Day < 1 || Time->Day > MonthDayCount[Time->Month]) - || (Time->Hour > 23) - || (Time->Minute > 59) - || (Time->Second > 59) - || (Time->Nanosecond > 999999999) - || ((Time->TimeZone < -1440 || Time->TimeZone > 1440) && Time->TimeZone != 2047) - ) { - return EFI_INVALID_PARAMETER; - } - - OldTpl = gBS->RaiseTPL(TPL_NOTIFY); - - Data = Time->Year - 2000; - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, YEARS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - Data = ((Time->Month / 10) << 4) | (Time->Month % 10); - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MONTHS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - Data = ((Time->Day / 10) << 4) | (Time->Day % 10); - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, DAYS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - Data = ((Time->Hour / 10) << 4) | (Time->Hour % 10); - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, HOURS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - Data = ((Time->Minute / 10) << 4) | (Time->Minute % 10); - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MINUTES_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - Data = ((Time->Second / 10) << 4) | (Time->Second % 10); - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, SECONDS_REG), 1, &Data); - if (Status != EFI_SUCCESS) goto EXIT; - - TimeZone = Time->TimeZone; - -EXIT: - gBS->RestoreTPL(OldTpl); - - return (Status == EFI_SUCCESS) ? Status : EFI_DEVICE_ERROR; -} - -/** - Returns the current wakeup alarm clock setting. - - @param Enabled Indicates if the alarm is currently enabled or disabled. - @param Pending Indicates if the alarm signal is pending and requires acknowledgement. - @param Time The current alarm setting. - - @retval EFI_SUCCESS The alarm settings were returned. - @retval EFI_INVALID_PARAMETER Any parameter is NULL. - @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. - -**/ -EFI_STATUS -EFIAPI -LibGetWakeupTime ( - OUT BOOLEAN *Enabled, - OUT BOOLEAN *Pending, - OUT EFI_TIME *Time - ) -{ - return EFI_UNSUPPORTED; -} - -/** - Sets the system wakeup alarm clock time. - - @param Enabled Enable or disable the wakeup alarm. - @param Time If Enable is TRUE, the time to set the wakeup alarm for. - - @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If - Enable is FALSE, then the wakeup alarm was disabled. - @retval EFI_INVALID_PARAMETER A time field is out of range. - @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. - @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. - -**/ -EFI_STATUS -EFIAPI -LibSetWakeupTime ( - IN BOOLEAN Enabled, - OUT EFI_TIME *Time - ) -{ - return EFI_UNSUPPORTED; -} - -/** - This is the declaration of an EFI image entry point. This can be the entry point to an application - written to this specification, an EFI boot service driver, or an EFI runtime driver. - - @param ImageHandle Handle that identifies the loaded image. - @param SystemTable System Table for this image. - - @retval EFI_SUCCESS The operation completed successfully. - -**/ -EFI_STATUS -EFIAPI -LibRtcInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - UINT8 Data; - EFI_TPL OldTpl; - - Status = gBS->LocateProtocol (&gEmbeddedExternalDeviceProtocolGuid, NULL, (VOID **)&gTPS65950); - ASSERT_EFI_ERROR(Status); - - OldTpl = gBS->RaiseTPL(TPL_NOTIFY); - Data = 1; - Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data); - ASSERT_EFI_ERROR(Status); - gBS->RestoreTPL(OldTpl); - - // Setup the setters and getters - gRT->GetTime = LibGetTime; - gRT->SetTime = LibSetTime; - gRT->GetWakeupTime = LibGetWakeupTime; - gRT->SetWakeupTime = LibSetWakeupTime; - - // Install the protocol - Handle = NULL; - Status = gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, NULL, - NULL - ); - - return Status; -} - -/** - Fixup internal data so that EFI can be call in virtual mode. - Call the passed in Child Notify event and convert any pointers in - lib to virtual mode. - - @param[in] Event The Event that is being processed - @param[in] Context Event Context -**/ -VOID -EFIAPI -LibRtcVirtualNotifyEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - return; -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf deleted file mode 100755 index e0aec5b4d..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/RealTimeClockLib/RealTimeClockLib.inf +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2011, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = RealTimeClockLib - FILE_GUID = EC1713DB-7DB5-4c99-8FE2-6F52F95A1132 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = RealTimeClockLib - -[Sources.common] - RealTimeClockLib.c - -[Packages] - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec - -[LibraryClasses] - IoLib - UefiLib - DebugLib - PcdLib - -[Protocols] - gEmbeddedExternalDeviceProtocolGuid - -[depex] - gEmbeddedExternalDeviceProtocolGuid diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c deleted file mode 100644 index d21a77401..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.c +++ /dev/null @@ -1,79 +0,0 @@ -/** @file - Null Reset System Library instance that only generates ASSERT() conditions. - - Copyright (c) 2006 - 2009, 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 - -#include -#include - -/** - This function causes a system-wide reset (cold reset), in which - all circuitry within the system returns to its initial state. This type of reset - is asynchronous to system operation and operates without regard to - cycle boundaries. - - If this function returns, it means that the system does not support cold reset. -**/ -VOID -EFIAPI -ResetCold ( - VOID - ) -{ - ASSERT (FALSE); -} - -/** - This function causes a system-wide initialization (warm reset), in which all processors - are set to their initial state. Pending cycles are not corrupted. - - If this function returns, it means that the system does not support warm reset. -**/ -VOID -EFIAPI -ResetWarm ( - VOID - ) -{ - ASSERT (FALSE); -} - -/** - This function causes the system to enter a power state equivalent - to the ACPI G2/S5 or G3 states. - - If this function returns, it means that the system does not support shut down reset. -**/ -VOID -EFIAPI -ResetShutdown ( - VOID - ) -{ - ASSERT (FALSE); -} - -/** - This function causes the system to enter S3 and then wake up immediately. - - If this function returns, it means that the system does not support S3 feature. -**/ -VOID -EFIAPI -EnterS3WithImmediateWake ( - VOID - ) -{ - ASSERT (FALSE); -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf deleted file mode 100644 index cdfbdc04c..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/ResetSystemLib/BaseResetSystemLibNull.inf +++ /dev/null @@ -1,37 +0,0 @@ -## @file -# Null Reset System Library instance that only generates ASSERT() conditions. -# -# Copyright (c) 2007 - 2010, 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 = BaseResetSystemLibNull - FILE_GUID = 667A8B1C-9C97-4b2a-AE7E-568772FE45F3 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ResetSystemLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - BaseResetSystemLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - DebugLib diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c index b5a4b513c..bb606bc8a 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c @@ -1,230 +1,230 @@ -/** @file - 16550 UART Serial Port library functions - - Copyright (c) 2006 - 2012, 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 -#include -#include -#include -#include -#include "Am335xUart.h" -// -// 16550 UART register offsets and bitfields -// - -/** - Read an 8-bit 16550 register. If PcdSerialUseMmio is TRUE, then the value is read from - MMIO space. If PcdSerialUseMmio is FALSE, then the value is read from I/O space. The - parameter Offset is added to the base address of the 16550 registers that is specified - by PcdSerialRegisterBase. - - @param Offset The offset of the 16550 register to read. - - @return The value read from the 16550 register. - -**/ -UINT8 -SerialPortReadRegister ( - UINTN Offset - ) -{ -/* if (PcdGetBool (PcdSerialUseMmio)) { - return MmioRead8 ((UINTN)PcdGet64 (PcdSerialRegisterBase) + Offset); - } else { - return IoRead8 ((UINT16)PcdGet64 (PcdSerialRegisterBase) + Offset); - }*/ -return 0; -} - -/** - Write an 8-bit 16550 register. If PcdSerialUseMmio is TRUE, then the value is written to - MMIO space. If PcdSerialUseMmio is FALSE, then the value is written to I/O space. The - parameter Offset is added to the base address of the 16550 registers that is specified - by PcdSerialRegisterBase. - - @param Offset The offset of the 16550 register to write. - @param Value The value to write to the 16550 register specified by Offset. - - @return The value written to the 16550 register. - -**/ -UINT8 -SerialPortWriteRegister ( - UINTN Offset, - UINT8 Value - ) -{/* - if (PcdGetBool (PcdSerialUseMmio)) { - return MmioWrite8 ((UINTN)PcdGet64 (PcdSerialRegisterBase) + Offset, Value); - } else { - return IoWrite8 ((UINT16)PcdGet64 (PcdSerialRegisterBase) + Offset, Value); - }*/ - return 0; -} - -/** - Return whether the hardware flow control signal allows writing. - - @retval TRUE The serial port is writable. - @retval FALSE The serial port is not writable. -**/ -BOOLEAN -SerialPortWritable ( - VOID - ) -{/* - if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { - if (PcdGetBool (PcdSerialDetectCable)) { - // - // Wait for both DSR and CTS to be set - // DSR is set if a cable is connected. - // CTS is set if it is ok to transmit data - // - // DSR CTS Description Action - // === === ======================================== ======== - // 0 0 No cable connected. Wait - // 0 1 No cable connected. Wait - // 1 0 Cable connected, but not clear to send. Wait - // 1 1 Cable connected, and clear to send. Transmit - // - return (BOOLEAN) ((SerialPortReadRegister (R_UART_MSR) & (B_UART_MSR_DSR | B_UART_MSR_CTS)) == (B_UART_MSR_DSR | B_UART_MSR_CTS)); - } else { - // - // Wait for both DSR and CTS to be set OR for DSR to be clear. - // DSR is set if a cable is connected. - // CTS is set if it is ok to transmit data - // - // DSR CTS Description Action - // === === ======================================== ======== - // 0 0 No cable connected. Transmit - // 0 1 No cable connected. Transmit - // 1 0 Cable connected, but not clear to send. Wait - // 1 1 Cable connected, and clar to send. Transmit - // - return (BOOLEAN) ((SerialPortReadRegister (R_UART_MSR) & (B_UART_MSR_DSR | B_UART_MSR_CTS)) != (B_UART_MSR_DSR)); - } - } -*/ - return TRUE; -} - -/** - Initialize the serial device hardware. - - If no initialization is required, then return RETURN_SUCCESS. - If the serial device was successfully initialized, then return RETURN_SUCCESS. - If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. - - @retval RETURN_SUCCESS The serial device was initialized. - @retval RETURN_DEVICE_ERROR The serial device could not be initialized. - -**/ -RETURN_STATUS -EFIAPI -SerialPortInitialize ( - VOID - ) -{ - return RETURN_SUCCESS; -} - -/** - Write data from buffer to serial device. - - Writes NumberOfBytes data bytes from Buffer to the serial device. - The number of bytes actually written to the serial device is returned. - If the return value is less than NumberOfBytes, then the write operation failed. - - If Buffer is NULL, then ASSERT(). - - If NumberOfBytes is zero, then return 0. - - @param Buffer Pointer to the data buffer to be written. - @param NumberOfBytes Number of bytes to written to the serial device. - - @retval 0 NumberOfBytes is 0. - @retval >0 The number of bytes written to the serial device. - If this value is less than NumberOfBytes, then the read operation failed. - -**/ -UINTN -EFIAPI -SerialPortWrite ( - IN UINT8 *Buffer, - IN UINTN NumberOfBytes -) -{ - UINT32 LSR = UART0_BASE + UART_LSR_REG; - UINT32 THR = UART0_BASE + UART_THR_REG; - - UINTN Count; - for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) { - // wait until ready - while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY); - MmioWrite8 (THR, *Buffer); - } - return NumberOfBytes; -} - -/** - Reads data from a serial device into a buffer. - - @param Buffer Pointer to the data buffer to store the data read from the serial device. - @param NumberOfBytes Number of bytes to read from the serial device. - - @retval 0 NumberOfBytes is 0. - @retval >0 The number of bytes read from the serial device. - If this value is less than NumberOfBytes, then the read operation failed. - -**/ -UINTN -EFIAPI -SerialPortRead ( - OUT UINT8 *Buffer, - IN UINTN NumberOfBytes -) -{ - UINT32 LSR = UART0_BASE + UART_LSR_REG; - UINT32 RBR = UART0_BASE + UART_RBR_REG; - UINTN Count; - - for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) { - while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY); - *Buffer = MmioRead8(RBR); - } - - return NumberOfBytes; -} - -/** - Polls a serial device to see if there is any data waiting to be read. - - Polls aserial device to see if there is any data waiting to be read. - If there is data waiting to be read from the serial device, then TRUE is returned. - If there is no data waiting to be read from the serial device, then FALSE is returned. - - @retval TRUE Data is waiting to be read from the serial device. - @retval FALSE There is no data waiting to be read from the serial device. - -**/ -BOOLEAN -EFIAPI -SerialPortPoll ( - VOID - ) -{ - // - // Read the serial port status - // - return TRUE; -} +/** @file + 16550 UART Serial Port library functions + + Copyright (c) 2006 - 2012, 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 +#include +#include +#include +#include +#include "Am335xUart.h" +// +// 16550 UART register offsets and bitfields +// + +/** + Read an 8-bit 16550 register. If PcdSerialUseMmio is TRUE, then the value is read from + MMIO space. If PcdSerialUseMmio is FALSE, then the value is read from I/O space. The + parameter Offset is added to the base address of the 16550 registers that is specified + by PcdSerialRegisterBase. + + @param Offset The offset of the 16550 register to read. + + @return The value read from the 16550 register. + +**/ +UINT8 +SerialPortReadRegister ( + UINTN Offset + ) +{ +/* if (PcdGetBool (PcdSerialUseMmio)) { + return MmioRead8 ((UINTN)PcdGet64 (PcdSerialRegisterBase) + Offset); + } else { + return IoRead8 ((UINT16)PcdGet64 (PcdSerialRegisterBase) + Offset); + }*/ +return 0; +} + +/** + Write an 8-bit 16550 register. If PcdSerialUseMmio is TRUE, then the value is written to + MMIO space. If PcdSerialUseMmio is FALSE, then the value is written to I/O space. The + parameter Offset is added to the base address of the 16550 registers that is specified + by PcdSerialRegisterBase. + + @param Offset The offset of the 16550 register to write. + @param Value The value to write to the 16550 register specified by Offset. + + @return The value written to the 16550 register. + +**/ +UINT8 +SerialPortWriteRegister ( + UINTN Offset, + UINT8 Value + ) +{/* + if (PcdGetBool (PcdSerialUseMmio)) { + return MmioWrite8 ((UINTN)PcdGet64 (PcdSerialRegisterBase) + Offset, Value); + } else { + return IoWrite8 ((UINT16)PcdGet64 (PcdSerialRegisterBase) + Offset, Value); + }*/ + return 0; +} + +/** + Return whether the hardware flow control signal allows writing. + + @retval TRUE The serial port is writable. + @retval FALSE The serial port is not writable. +**/ +BOOLEAN +SerialPortWritable ( + VOID + ) +{/* + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { + if (PcdGetBool (PcdSerialDetectCable)) { + // + // Wait for both DSR and CTS to be set + // DSR is set if a cable is connected. + // CTS is set if it is ok to transmit data + // + // DSR CTS Description Action + // === === ======================================== ======== + // 0 0 No cable connected. Wait + // 0 1 No cable connected. Wait + // 1 0 Cable connected, but not clear to send. Wait + // 1 1 Cable connected, and clear to send. Transmit + // + return (BOOLEAN) ((SerialPortReadRegister (R_UART_MSR) & (B_UART_MSR_DSR | B_UART_MSR_CTS)) == (B_UART_MSR_DSR | B_UART_MSR_CTS)); + } else { + // + // Wait for both DSR and CTS to be set OR for DSR to be clear. + // DSR is set if a cable is connected. + // CTS is set if it is ok to transmit data + // + // DSR CTS Description Action + // === === ======================================== ======== + // 0 0 No cable connected. Transmit + // 0 1 No cable connected. Transmit + // 1 0 Cable connected, but not clear to send. Wait + // 1 1 Cable connected, and clar to send. Transmit + // + return (BOOLEAN) ((SerialPortReadRegister (R_UART_MSR) & (B_UART_MSR_DSR | B_UART_MSR_CTS)) != (B_UART_MSR_DSR)); + } + } +*/ + return TRUE; +} + +/** + Initialize the serial device hardware. + + If no initialization is required, then return RETURN_SUCCESS. + If the serial device was successfully initialized, then return RETURN_SUCCESS. + If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. + + @retval RETURN_SUCCESS The serial device was initialized. + @retval RETURN_DEVICE_ERROR The serial device could not be initialized. + +**/ +RETURN_STATUS +EFIAPI +SerialPortInitialize ( + VOID + ) +{ + return RETURN_SUCCESS; +} + +/** + Write data from buffer to serial device. + + Writes NumberOfBytes data bytes from Buffer to the serial device. + The number of bytes actually written to the serial device is returned. + If the return value is less than NumberOfBytes, then the write operation failed. + + If Buffer is NULL, then ASSERT(). + + If NumberOfBytes is zero, then return 0. + + @param Buffer Pointer to the data buffer to be written. + @param NumberOfBytes Number of bytes to written to the serial device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes written to the serial device. + If this value is less than NumberOfBytes, then the read operation failed. + +**/ +UINTN +EFIAPI +SerialPortWrite ( + IN UINT8 *Buffer, + IN UINTN NumberOfBytes +) +{ + UINT32 LSR = UART0_BASE + UART_LSR_REG; + UINT32 THR = UART0_BASE + UART_THR_REG; + + UINTN Count; + for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) { + // wait until ready + while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY); + MmioWrite8 (THR, *Buffer); + } + return NumberOfBytes; +} + +/** + Reads data from a serial device into a buffer. + + @param Buffer Pointer to the data buffer to store the data read from the serial device. + @param NumberOfBytes Number of bytes to read from the serial device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes read from the serial device. + If this value is less than NumberOfBytes, then the read operation failed. + +**/ +UINTN +EFIAPI +SerialPortRead ( + OUT UINT8 *Buffer, + IN UINTN NumberOfBytes +) +{ + UINT32 LSR = UART0_BASE + UART_LSR_REG; + UINT32 RBR = UART0_BASE + UART_RBR_REG; + UINTN Count; + + for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) { + while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY); + *Buffer = MmioRead8(RBR); + } + + return NumberOfBytes; +} + +/** + Polls a serial device to see if there is any data waiting to be read. + + Polls aserial device to see if there is any data waiting to be read. + If there is data waiting to be read from the serial device, then TRUE is returned. + If there is no data waiting to be read from the serial device, then FALSE is returned. + + @retval TRUE Data is waiting to be read from the serial device. + @retval FALSE There is no data waiting to be read from the serial device. + +**/ +BOOLEAN +EFIAPI +SerialPortPoll ( + VOID + ) +{ + // + // Read the serial port status + // + return TRUE; +} -- cgit v1.2.3 From f02bef4bdd5688e38728677946b6b81341158080 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 21:59:36 +0530 Subject: BeagleBoneBlackPkg: Depreciate PrePeiCore, Sec Booting from PrePi. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../PrePeiCore/AArch64/ArchPrePeiCore.c | 52 ------- .../PrePeiCore/AArch64/Exception.S | 81 ----------- .../BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S | 48 ------ .../PrePeiCore/AArch64/PrePeiCoreEntryPoint.S | 110 -------------- .../PrePeiCore/AArch64/SwitchStack.S | 43 ------ .../PrePeiCore/Arm/ArchPrePeiCore.c | 62 -------- .../BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S | 102 ------------- .../PrePeiCore/Arm/Exception.asm | 91 ------------ .../PrePeiCore/Arm/PrePeiCoreEntryPoint.S | 89 ----------- .../PrePeiCore/Arm/PrePeiCoreEntryPoint.asm | 98 ------------- .../PrePeiCore/Arm/SwitchStack.S | 43 ------ .../PrePeiCore/Arm/SwitchStack.asm | 38 ----- .../BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c | 151 ------------------- .../BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c | 67 --------- .../BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c | 162 --------------------- .../BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h | 83 ----------- .../PrePeiCore/PrePeiCoreMPCore.inf | 82 ----------- .../PrePeiCore/PrePeiCoreUniCore.inf | 77 ---------- TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c | 25 ---- .../BeagleBoneBlackPkg/Sec/Helper.S | 84 ----------- .../BeagleBoneBlackPkg/Sec/Helper.asm | 79 ---------- TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c | 125 ---------------- TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf | 78 ---------- .../BeagleBoneBlackPkg/Sec/SecEntryPoint.S | 44 ------ .../BeagleBoneBlackPkg/Sec/SecEntryPoint.asm | 126 ---------------- .../BeagleBoneBlackPkg/Sec/SecInternal.h | 83 ----------- 26 files changed, 2123 deletions(-) delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c deleted file mode 100644 index e1842f2a0..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/ArchPrePeiCore.c +++ /dev/null @@ -1,52 +0,0 @@ -/** @file -* Main file supporting the transition to PEI Core in Normal World for Versatile Express -* -* Copyright (c) 2012-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include - -#include "PrePeiCore.h" - -VOID -PeiCommonExceptionEntry ( - IN UINT32 Entry, - IN UINTN LR - ) -{ - CHAR8 Buffer[100]; - UINTN CharCount; - - switch (Entry) { - case EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS: - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Synchronous Exception at 0x%X\n\r", LR); - break; - case EXCEPT_AARCH64_IRQ: - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r", LR); - break; - case EXCEPT_AARCH64_FIQ: - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r", LR); - break; - case EXCEPT_AARCH64_SERROR: - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SError/Abort Exception at 0x%X\n\r", LR); - break; - default: - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r", LR); - break; - } - - SerialPortWrite ((UINT8 *) Buffer, CharCount); - - while(1); -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S deleted file mode 100644 index cdc8d925b..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Exception.S +++ /dev/null @@ -1,81 +0,0 @@ -# -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#include -#include - -.text -.align 11 - -GCC_ASM_EXPORT(PeiVectorTable) - -//============================================================ -//Default Exception Handlers -//============================================================ - -ASM_PFX(PeiVectorTable): - - -#define TO_HANDLER \ - EL1_OR_EL2(x1) \ -1: mrs x1, elr_el1 /* EL1 Exception Link Register */ ;\ - b 3f ;\ -2: mrs x1, elr_el2 /* EL2 Exception Link Register */ ;\ -3: bl ASM_PFX(PeiCommonExceptionEntry) ; - - -// -// Default Exception handlers: There is no plan to return from any of these exceptions. -// No context saving at all. -// - -.align 7 -_DefaultSyncExceptHandler_t: - mov x0, #EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS - TO_HANDLER - -.align 7 -_DefaultIrq_t: - mov x0, #EXCEPT_AARCH64_IRQ - TO_HANDLER - -.align 7 -_DefaultFiq_t: - mov x0, #EXCEPT_AARCH64_FIQ - TO_HANDLER - -.align 7 -_DefaultSError_t: - mov x0, #EXCEPT_AARCH64_SERROR - TO_HANDLER - -.align 7 -_DefaultSyncExceptHandler_h: - mov x0, #EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS - TO_HANDLER - -.align 7 -_DefaultIrq_h: - mov x0, #EXCEPT_AARCH64_IRQ - TO_HANDLER - -.align 7 -_DefaultFiq_h: - mov x0, #EXCEPT_AARCH64_FIQ - TO_HANDLER - -.align 7 -_DefaultSError_h: - mov x0, #EXCEPT_AARCH64_SERROR - TO_HANDLER diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S deleted file mode 100644 index 8e23b0389..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/Helper.S +++ /dev/null @@ -1,48 +0,0 @@ -#======================================================================================== -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http:#opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#======================================================================================= - -#include -#include - -#start of the code section -.text -.align 3 - -GCC_ASM_EXPORT(SetupExceptionLevel1) -GCC_ASM_EXPORT(SetupExceptionLevel2) - -// Setup EL1 while in EL1 -ASM_PFX(SetupExceptionLevel1): - mov x5, x30 // Save LR - - mov x0, #CPACR_CP_FULL_ACCESS - bl ASM_PFX(ArmWriteCpacr) // Disable copro traps to EL1 - - ret x5 - -// Setup EL2 while in EL2 -ASM_PFX(SetupExceptionLevel2): - msr sctlr_el2, xzr - mrs x0, hcr_el2 // Read EL2 Hypervisor configuration Register - - // Send all interrupts to their respective Exception levels for EL2 - orr x0, x0, #(1 << 3) // Enable EL2 FIQ - orr x0, x0, #(1 << 4) // Enable EL2 IRQ - orr x0, x0, #(1 << 5) // Enable EL2 SError and Abort - msr hcr_el2, x0 // Write back our settings - - msr cptr_el2, xzr // Disable copro traps to EL2 - - ret - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S deleted file mode 100644 index b84190cf3..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S +++ /dev/null @@ -1,110 +0,0 @@ -// -// Copyright (c) 2011-2014, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include - -.text -.align 3 - -GCC_ASM_IMPORT(CEntryPoint) -GCC_ASM_IMPORT(ArmPlatformGetCorePosition) -GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) -GCC_ASM_IMPORT(ArmReadMpidr) -GCC_ASM_IMPORT(ArmPlatformPeiBootAction) -GCC_ASM_EXPORT(_ModuleEntryPoint) - -StartupAddr: .8byte CEntryPoint - -ASM_PFX(_ModuleEntryPoint): - // Do early platform specific actions - bl ASM_PFX(ArmPlatformPeiBootAction) - -// NOTE: We could be booting from EL3, EL2 or EL1. Need to correctly detect -// and configure the system accordingly. EL2 is default if possible. -// If we started in EL3 we need to switch and run at EL2. -// If we are running at EL2 stay in EL2 -// If we are starting at EL1 stay in EL1. - -// If started at EL3 Sec is run and switches to EL2 before jumping to PEI. -// If started at EL1 or EL2 Sec jumps directly to PEI without making any -// changes. - -// Which EL are we running at? Every EL needs some level of setup... -// We should not run this code in EL3 - EL1_OR_EL2(x0) -1:bl ASM_PFX(SetupExceptionLevel1) - b ASM_PFX(MainEntryPoint) -2:bl ASM_PFX(SetupExceptionLevel2) - b ASM_PFX(MainEntryPoint) - -ASM_PFX(MainEntryPoint): - // Identify CPU ID - bl ASM_PFX(ArmReadMpidr) - // Keep a copy of the MpId register value - mov x5, x0 - - // Is it the Primary Core ? - bl ASM_PFX(ArmPlatformIsPrimaryCore) - - // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), x1) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) - add x1, x1, x2 - - // x0 is equal to 1 if I am the primary core - cmp x0, #1 - b.eq _SetupPrimaryCoreStack - -_SetupSecondaryCoreStack: - // x1 contains the base of the secondary stacks - - // Get the Core Position - mov x6, x1 // Save base of the secondary stacks - mov x0, x5 - bl ASM_PFX(ArmPlatformGetCorePosition) - // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack - add x0, x0, #1 - - // StackOffset = CorePos * StackSize - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x2) - mul x0, x0, x2 - // SP = StackBase + StackOffset - add sp, x6, x0 - -_PrepareArguments: - // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector - LoadConstantToReg (FixedPcdGet64(PcdFvBaseAddress), x2) - add x2, x2, #8 - ldr x1, [x2] - - // Move sec startup address into a data register - // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr x3, StartupAddr - - // Jump to PrePeiCore C code - // x0 = mp_id - // x1 = pei_core_address - mov x0, x5 - blr x3 - -_SetupPrimaryCoreStack: - // x1 contains the top of the primary stack - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x2) - - // The reserved space for global variable must be 16-bytes aligned for pushing - // 128-bit variable on the stack - SetPrimaryStack (x1, x2, x3, x4) - b _PrepareArguments diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S deleted file mode 100644 index 8d8351051..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/AArch64/SwitchStack.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 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 -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.align 3 - -GCC_ASM_EXPORT(SecSwitchStack) - - - -#/** -# This allows the caller to switch the stack and return -# -# @param StackDelta Signed amount by which to modify the stack pointer -# -# @return Nothing. Goes to the Entry Point passing in the new parameters -# -#**/ -#VOID -#EFIAPI -#SecSwitchStack ( -# VOID *StackDelta -# )# -# -ASM_PFX(SecSwitchStack): - mov x1, sp - add x1, x0, x1 - mov sp, x1 - ret - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c deleted file mode 100644 index b0594ae2c..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/ArchPrePeiCore.c +++ /dev/null @@ -1,62 +0,0 @@ -/** @file -* Main file supporting the transition to PEI Core in Normal World for Versatile Express -* -* Copyright (c) 2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include - -#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/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S deleted file mode 100644 index abce21d0a..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.S +++ /dev/null @@ -1,102 +0,0 @@ -// -// Copyright (c) 2011, ARM Limited. All rights reserved. -// -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#include -#include - -#start of the code section -.text -.align 5 - -# IMPORT -GCC_ASM_IMPORT(PeiCommonExceptionEntry) - -# EXPORT -GCC_ASM_EXPORT(PeiVectorTable) - -//============================================================ -//Default Exception Handlers -//============================================================ - - -ASM_PFX(PeiVectorTable): - b _DefaultResetHandler - b _DefaultUndefined - b _DefaultSWI - b _DefaultPrefetchAbort - b _DefaultDataAbort - b _DefaultReserved - b _DefaultIrq - b _DefaultFiq - -// -// Default Exception handlers: There is no plan to return from any of these exceptions. -// No context saving at all. -// -_DefaultResetHandler: - mov r1, lr - # Switch to SVC for common stack - cps #0x13 - mov r0, #0 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultUndefined: - sub r1, LR, #4 - # Switch to SVC for common stack - cps #0x13 - mov r0, #1 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultSWI: - sub r1, LR, #4 - # Switch to SVC for common stack - cps #0x13 - mov r0, #2 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultPrefetchAbort: - sub r1, LR, #4 - # Switch to SVC for common stack - cps #0x13 - mov r0, #3 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultDataAbort: - sub r1, LR, #8 - # Switch to SVC for common stack - cps #0x13 - mov r0, #4 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultReserved: - mov r1, lr - # Switch to SVC for common stack - cps #0x13 - mov r0, #5 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultIrq: - sub r1, LR, #4 - # Switch to SVC for common stack - cps #0x13 - mov r0, #6 - blx ASM_PFX(PeiCommonExceptionEntry) - -_DefaultFiq: - sub r1, LR, #4 - # Switch to SVC for common stack - cps #0x13 - mov r0, #7 - blx ASM_PFX(PeiCommonExceptionEntry) - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm deleted file mode 100644 index 55bd4af1d..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/Exception.asm +++ /dev/null @@ -1,91 +0,0 @@ -// -// Copyright (c) 2011, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include - - IMPORT PeiCommonExceptionEntry - EXPORT PeiVectorTable - - PRESERVE8 - AREA PrePeiCoreException, CODE, READONLY, CODEALIGN, ALIGN=5 - -//============================================================ -//Default Exception Handlers -//============================================================ - - -PeiVectorTable - b _DefaultResetHandler - b _DefaultUndefined - b _DefaultSWI - b _DefaultPrefetchAbort - b _DefaultDataAbort - b _DefaultReserved - b _DefaultIrq - b _DefaultFiq - -// -// Default Exception handlers: There is no plan to return from any of these exceptions. -// No context saving at all. -// -_DefaultResetHandler - mov r1, lr - cps #0x13 ; Switch to SVC for common stack - mov r0, #0 - blx PeiCommonExceptionEntry - -_DefaultUndefined - sub r1, LR, #4 - cps #0x13 ; Switch to SVC for common stack - mov r0, #1 - blx PeiCommonExceptionEntry - -_DefaultSWI - sub r1, LR, #4 - cps #0x13 ; Switch to SVC for common stack - mov r0, #2 - blx PeiCommonExceptionEntry - -_DefaultPrefetchAbort - sub r1, LR, #4 - cps #0x13 ; Switch to SVC for common stack - mov r0, #3 - blx PeiCommonExceptionEntry - -_DefaultDataAbort - sub r1, LR, #8 - cps #0x13 ; Switch to SVC for common stack - mov r0, #4 - blx PeiCommonExceptionEntry - -_DefaultReserved - mov r1, lr - cps #0x13 ; Switch to SVC for common stack - mov r0, #5 - blx PeiCommonExceptionEntry - -_DefaultIrq - sub r1, LR, #4 - cps #0x13 ; Switch to SVC for common stack - mov r0, #6 - blx PeiCommonExceptionEntry - -_DefaultFiq - sub r1, LR, #4 - cps #0x13 ; Switch to SVC for common stack - mov r0, #7 - blx PeiCommonExceptionEntry - - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S deleted file mode 100644 index cad750d31..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include - -.text -.align 3 - -GCC_ASM_IMPORT(CEntryPoint) -GCC_ASM_IMPORT(ArmPlatformGetCorePosition) -GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) -GCC_ASM_IMPORT(ArmReadMpidr) -GCC_ASM_IMPORT(ArmPlatformPeiBootAction) -GCC_ASM_EXPORT(_ModuleEntryPoint) - -ASM_PFX(_ModuleEntryPoint): - // Do early platform specific actions - bl ASM_PFX(ArmPlatformPeiBootAction) - - // Identify CPU ID - bl ASM_PFX(ArmReadMpidr) - // Keep a copy of the MpId register value - mov r5, r0 - - // Is it the Primary Core ? - bl ASM_PFX(ArmPlatformIsPrimaryCore) - - // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - add r1, r1, r2 - - // r0 is equal to 1 if I am the primary core - cmp r0, #1 - beq _SetupPrimaryCoreStack - -_SetupSecondaryCoreStack: - // r1 contains the base of the secondary stacks - - // Get the Core Position - mov r6, r1 // Save base of the secondary stacks - mov r0, r5 - bl ASM_PFX(ArmPlatformGetCorePosition) - // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack - add r0, r0, #1 - - // StackOffset = CorePos * StackSize - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2) - mul r0, r0, r2 - // SP = StackBase + StackOffset - add sp, r6, r0 - -_PrepareArguments: - // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector - LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2) - add r2, r2, #4 - ldr r1, [r2] - - // Jump to PrePeiCore C code - // r0 = mp_id - // r1 = pei_core_address - mov r0, r5 - blx ASM_PFX (CEntryPoint) - -_SetupPrimaryCoreStack: - // r1 contains the top of the primary stack - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2) - - // The reserved space for global variable must be 8-bytes aligned for pushing - // 64-bit variable on the stack - // Assuming Stack already setup by SPL - // SetPrimaryStack (r1, r2, r3) - b _PrepareArguments - -_NeverReturn: - b _NeverReturn diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm deleted file mode 100644 index be1a76769..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm +++ /dev/null @@ -1,98 +0,0 @@ -// -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include - - INCLUDE AsmMacroIoLib.inc - - IMPORT CEntryPoint - IMPORT ArmPlatformGetCorePosition - IMPORT ArmPlatformIsPrimaryCore - IMPORT ArmReadMpidr - IMPORT ArmPlatformPeiBootAction - EXPORT _ModuleEntryPoint - - PRESERVE8 - AREA PrePeiCoreEntryPoint, CODE, READONLY - -StartupAddr DCD CEntryPoint - -_ModuleEntryPoint - // Do early platform specific actions - bl ArmPlatformPeiBootAction - - // Identify CPU ID - bl ArmReadMpidr - // Keep a copy of the MpId register value - mov r5, r0 - - // Is it the Primary Core ? - bl ArmPlatformIsPrimaryCore - - // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - add r1, r1, r2 - - // r0 is equal to 1 if I am the primary core - cmp r0, #1 - beq _SetupPrimaryCoreStack - -_SetupSecondaryCoreStack - // r1 contains the base of the secondary stacks - - // Get the Core Position - mov r6, r1 // Save base of the secondary stacks - mov r0, r5 - bl ArmPlatformGetCorePosition - // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack - add r0, r0, #1 - - // StackOffset = CorePos * StackSize - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2) - mul r0, r0, r2 - // SP = StackBase + StackOffset - add sp, r6, r0 - -_PrepareArguments - // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector - LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2) - add r2, r2, #4 - ldr r1, [r2] - - // Move sec startup address into a data register - // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr r3, StartupAddr - - // Jump to PrePeiCore C code - // r0 = mp_id - // r1 = pei_core_address - mov r0, r5 - blx r3 - -_SetupPrimaryCoreStack - // r1 contains the top of the primary stack - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2) - - // The reserved space for global variable must be 8-bytes aligned for pushing - // 64-bit variable on the stack - SetPrimaryStack (r1, r2, r3) - b _PrepareArguments - -_NeverReturn - b _NeverReturn - - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S deleted file mode 100644 index 2543f5841..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. 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(SecSwitchStack) - - - -#/** -# This allows the caller to switch the stack and return -# -# @param StackDelta Signed amount by which to modify the stack pointer -# -# @return Nothing. Goes to the Entry Point passing in the new parameters -# -#**/ -#VOID -#EFIAPI -#SecSwitchStack ( -# VOID *StackDelta -# )# -# -ASM_PFX(SecSwitchStack): - mov R1, R13 - add R1, R0, R1 - mov R13, R1 - bx LR - - - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm deleted file mode 100644 index 10da81d6a..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/Arm/SwitchStack.asm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. 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 SecSwitchStack - - AREA Switch_Stack, CODE, READONLY - -;/** -; This allows the caller to switch the stack and return -; -; @param StackDelta Signed amount by which to modify the stack pointer -; -; @return Nothing. Goes to the Entry Point passing in the new parameters -; -;**/ -;VOID -;EFIAPI -;SecSwitchStack ( -; VOID *StackDelta -; ); -; -SecSwitchStack - MOV R1, SP - ADD R1, R0, R1 - MOV SP, R1 - BX LR - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c deleted file mode 100644 index 9bfc99062..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainMPCore.c +++ /dev/null @@ -1,151 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include - -#include - -#include "PrePeiCore.h" - -/* - * This is the main function for secondary cores. They loop around until a non Null value is written to - * SYS_FLAGS register.The SYS_FLAGS register is platform specific. - * Note:The secondary cores, while executing secondary_main, assumes that: - * : SGI 0 is configured as Non-secure interrupt - * : Priority Mask is configured to allow SGI 0 - * : Interrupt Distributor and CPU interfaces are enabled - * - */ -VOID -EFIAPI -SecondaryMain ( - IN UINTN MpId - ) -{ - EFI_STATUS Status; - UINTN PpiListSize; - UINTN PpiListCount; - EFI_PEI_PPI_DESCRIPTOR *PpiList; - ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi; - UINTN Index; - UINTN ArmCoreCount; - ARM_CORE_INFO *ArmCoreInfoTable; - UINT32 ClusterId; - UINT32 CoreId; - VOID (*SecondaryStart)(VOID); - UINTN SecondaryEntryAddr; - - ClusterId = GET_CLUSTER_ID(MpId); - CoreId = GET_CORE_ID(MpId); - - // Get the gArmMpCoreInfoPpiGuid - PpiListSize = 0; - ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); - PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); - for (Index = 0; Index < PpiListCount; Index++, PpiList++) { - if (CompareGuid (PpiList->Guid, &gArmMpCoreInfoPpiGuid) == TRUE) { - break; - } - } - - // On MP Core Platform we must implement the ARM MP Core Info PPI - ASSERT (Index != PpiListCount); - - ArmMpCoreInfoPpi = PpiList->Ppi; - ArmCoreCount = 0; - Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable); - ASSERT_EFI_ERROR (Status); - - // Find the core in the ArmCoreTable - for (Index = 0; Index < ArmCoreCount; Index++) { - if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) { - break; - } - } - - // The ARM Core Info Table must define every core - ASSERT (Index != ArmCoreCount); - - // Clear Secondary cores MailBox - MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue); - - do { - ArmCallWFI (); - - // Read the Mailbox - SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress); - - // Acknowledge the interrupt and send End of Interrupt signal. - ArmGicAcknowledgeInterrupt (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase), NULL, NULL); - } while (SecondaryEntryAddr == 0); - - // Jump to secondary core entry point. - SecondaryStart = (VOID (*)())SecondaryEntryAddr; - SecondaryStart(); - - // The secondaries shouldn't reach here - ASSERT(FALSE); -} - -VOID -EFIAPI -PrimaryMain ( - IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint - ) -{ - EFI_SEC_PEI_HAND_OFF SecCoreData; - UINTN PpiListSize; - EFI_PEI_PPI_DESCRIPTOR *PpiList; - UINTN TemporaryRamBase; - UINTN TemporaryRamSize; - - CreatePpiList (&PpiListSize, &PpiList); - - // Enable the GIC Distributor - ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase)); - - // If ArmVe has not been built as Standalone then we need to wake up the secondary cores - if (FeaturePcdGet (PcdSendSgiToBringUpSecondaryCores)) { - // Sending SGI to all the Secondary CPU interfaces - ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); - } - - // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at - // the base of the primary core stack - PpiListSize = ALIGN_VALUE(PpiListSize, 0x4); - TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize; - TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize; - - // Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned - // to ensure the stack pointer is 4-byte aligned. - TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1)); - - // - // Bind this information into the SEC hand-off state - // Note: this must be in sync with the stuff in the asm file - // Note also: HOBs (pei temp ram) MUST be above stack - // - SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF); - SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress); - SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize); - SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack) - SecCoreData.TemporaryRamSize = TemporaryRamSize; - SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase; - SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2; - SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4); - SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase; - - // Jump to PEI core entry point - PeiCoreEntryPoint (&SecCoreData, PpiList); -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c deleted file mode 100644 index b437ad651..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/MainUniCore.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include "PrePeiCore.h" - -VOID -EFIAPI -SecondaryMain ( - IN UINTN MpId - ) -{ - ASSERT(FALSE); -} - -VOID -EFIAPI -PrimaryMain ( - IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint - ) -{ - EFI_SEC_PEI_HAND_OFF SecCoreData; - UINTN PpiListSize; - EFI_PEI_PPI_DESCRIPTOR *PpiList; - UINTN TemporaryRamBase; - UINTN TemporaryRamSize; - - CreatePpiList (&PpiListSize, &PpiList); - - // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at - // the base of the primary core stack - PpiListSize = ALIGN_VALUE(PpiListSize, 0x4); - TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize; - TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize; - - // Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned - // to ensure the stack pointer is 4-byte aligned. - TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1)); - - // - // Bind this information into the SEC hand-off state - // Note: this must be in sync with the stuff in the asm file - // Note also: HOBs (pei temp ram) MUST be above stack - // - SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF); - SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress); - SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize); - SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack) - SecCoreData.TemporaryRamSize = TemporaryRamSize; - SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase; - SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2; - SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4); - SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase; - - // Jump to PEI core entry point - (PeiCoreEntryPoint)(&SecCoreData, PpiList); -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c deleted file mode 100644 index 633ea457c..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.c +++ /dev/null @@ -1,162 +0,0 @@ -/** @file -* Main file supporting the transition to PEI Core in Normal World for Versatile Express -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include -#include - -#include - -#include "PrePeiCore.h" - -EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi = { PrePeiCoreTemporaryRamSupport }; -ARM_GLOBAL_VARIABLE_PPI mGlobalVariablePpi = { PrePeiCoreGetGlobalVariableMemory }; - -EFI_PEI_PPI_DESCRIPTOR gCommonPpiTable[] = { - { - EFI_PEI_PPI_DESCRIPTOR_PPI, - &gEfiTemporaryRamSupportPpiGuid, - &mTemporaryRamSupportPpi - }, - { - EFI_PEI_PPI_DESCRIPTOR_PPI, - &gArmGlobalVariablePpiGuid, - &mGlobalVariablePpi - } -}; - -VOID -CreatePpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - EFI_PEI_PPI_DESCRIPTOR *PlatformPpiList; - UINTN PlatformPpiListSize; - UINTN ListBase; - EFI_PEI_PPI_DESCRIPTOR *LastPpi; - - // Get the Platform PPIs - PlatformPpiListSize = 0; - ArmPlatformGetPlatformPpiList (&PlatformPpiListSize, &PlatformPpiList); - - // Copy the Common and Platform PPis in Temporrary Memory - ListBase = FixedPcdGet32 (PcdCPUCoresStackBase); - CopyMem ((VOID*)ListBase, gCommonPpiTable, sizeof(gCommonPpiTable)); - CopyMem ((VOID*)(ListBase + sizeof(gCommonPpiTable)), PlatformPpiList, PlatformPpiListSize); - - // Set the Terminate flag on the last PPI entry - LastPpi = (EFI_PEI_PPI_DESCRIPTOR*)ListBase + ((sizeof(gCommonPpiTable) + PlatformPpiListSize) / sizeof(EFI_PEI_PPI_DESCRIPTOR)) - 1; - LastPpi->Flags |= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; - - *PpiList = (EFI_PEI_PPI_DESCRIPTOR*)ListBase; - *PpiListSize = sizeof(gCommonPpiTable) + PlatformPpiListSize; -} - -VOID -CEntryPoint ( - IN UINTN MpId, - IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint - ) -{ - // Data Cache enabled on Primary core when MMU is enabled. - ArmDisableDataCache (); - // Invalidate Data cache - // ArmInvalidateDataCache (); - // Invalidate instruction cache - // ArmInvalidateInstructionCache (); - // Enable Instruction Caches on all cores. - ArmEnableInstructionCache (); - - // - // Note: Doesn't have to Enable CPU interface in non-secure world, - // as Non-secure interface is already enabled in Secure world. - // - - // Write VBAR - The Exception Vector table must be aligned to its requirement - //TODO: Fix baseTools to ensure the Exception Vector Table is correctly aligned in AArch64 - //ASSERT(((UINTN)PeiVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0); - // ArmWriteVBar ((UINTN)PeiVectorTable); - - //Note: The MMU will be enabled by MemoryPeim. Only the primary core will have the MMU on. - - // If not primary Jump to Secondary Main - if (ArmPlatformIsPrimaryCore (MpId)) { - // Initialize the Debug Agent for Source Level Debugging - InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); - SaveAndSetDebugTimerInterrupt (TRUE); - - // Initialize the platform specific controllers - ArmPlatformInitialize (MpId); - - // Goto primary Main. - PrimaryMain (PeiCoreEntryPoint); - } else { - SecondaryMain (MpId); - } - - // PEI Core should always load and never return - ASSERT (FALSE); -} - -EFI_STATUS -EFIAPI -PrePeiCoreTemporaryRamSupport ( - IN CONST EFI_PEI_SERVICES **PeiServices, - IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, - IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, - IN UINTN CopySize - ) -{ - VOID *OldHeap; - VOID *NewHeap; - VOID *OldStack; - VOID *NewStack; - - OldHeap = (VOID*)(UINTN)TemporaryMemoryBase; - NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize >> 1)); - - OldStack = (VOID*)((UINTN)TemporaryMemoryBase + (CopySize >> 1)); - NewStack = (VOID*)(UINTN)PermanentMemoryBase; - - // - // Migrate the temporary memory stack to permanent memory stack. - // - CopyMem (NewStack, OldStack, CopySize >> 1); - - // - // Migrate the temporary memory heap to permanent memory heap. - // - CopyMem (NewHeap, OldHeap, CopySize >> 1); - - SecSwitchStack ((UINTN)NewStack - (UINTN)OldStack); - - return EFI_SUCCESS; -} - -EFI_STATUS -PrePeiCoreGetGlobalVariableMemory ( - OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase - ) -{ - ASSERT (GlobalVariableBase != NULL); - - *GlobalVariableBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + - (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - - (UINTN)PcdGet32 (PcdPeiGlobalVariableSize); - - return EFI_SUCCESS; -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h deleted file mode 100644 index 20684e2f9..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCore.h +++ /dev/null @@ -1,83 +0,0 @@ -/** @file -* Main file supporting the transition to PEI Core in Normal World for Versatile Express -* -* Copyright (c) 2011, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ -#ifndef __PREPEICORE_H_ -#define __PREPEICORE_H_ - -#include -#include -#include -#include -#include -#include - -#include -#include - -VOID -CreatePpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ); - -EFI_STATUS -EFIAPI -PrePeiCoreTemporaryRamSupport ( - IN CONST EFI_PEI_SERVICES **PeiServices, - IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, - IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, - IN UINTN CopySize - ); - -EFI_STATUS -PrePeiCoreGetGlobalVariableMemory ( - OUT EFI_PHYSICAL_ADDRESS *GlobalVariableBase - ); - -VOID -SecSwitchStack ( - INTN StackDelta - ); - -// Vector Table for Pei Phase -VOID PeiVectorTable (VOID); - -VOID -EFIAPI -PrimaryMain ( - IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint - ); - -/* - * This is the main function for secondary cores. They loop around until a non Null value is written to - * SYS_FLAGS register.The SYS_FLAGS register is platform specific. - * Note:The secondary cores, while executing secondary_main, assumes that: - * : SGI 0 is configured as Non-secure interrupt - * : Priority Mask is configured to allow SGI 0 - * : Interrupt Distributor and CPU interfaces are enabled - * - */ -VOID -EFIAPI -SecondaryMain ( - IN UINTN MpId - ); - -VOID -PeiCommonExceptionEntry ( - IN UINT32 Entry, - IN UINTN LR - ); - -#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf deleted file mode 100644 index 3b441d443..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreMPCore.inf +++ /dev/null @@ -1,82 +0,0 @@ -#/** @file -# Pre PeiCore - Hand-off to PEI Core in Normal World -# -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmPlatformPrePeiCore - FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - -[Sources.common] - MainMPCore.c - PrePeiCore.c - -[Sources.ARM] - Arm/ArchPrePeiCore.c - Arm/PrePeiCoreEntryPoint.asm | RVCT - Arm/PrePeiCoreEntryPoint.S | GCC - Arm/SwitchStack.asm | RVCT - Arm/SwitchStack.S | GCC - Arm/Exception.asm | RVCT - Arm/Exception.S | GCC - -[Sources.AARCH64] - AArch64/ArchPrePeiCore.c - AArch64/PrePeiCoreEntryPoint.S - AArch64/SwitchStack.S - AArch64/Exception.S - AArch64/Helper.S - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - ArmPlatformLib - BaseLib - DebugLib - DebugAgentLib - IoLib - ArmGicLib - PrintLib - SerialPortLib - -[Ppis] - gEfiTemporaryRamSupportPpiGuid - gArmGlobalVariablePpiGuid - gArmMpCoreInfoPpiGuid - -[FeaturePcd] - gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores - -[FixedPcd] - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdFvSize - - gArmTokenSpaceGuid.PcdArmPrimaryCore - - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase - gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize - - gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize - - gArmTokenSpaceGuid.PcdGicDistributorBase - gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase - gArmTokenSpaceGuid.PcdGicSgiIntId diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf deleted file mode 100644 index f50d21fa6..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePeiCore/PrePeiCoreUniCore.inf +++ /dev/null @@ -1,77 +0,0 @@ -#/** @file -# Pre PeiCore - Hand-off to PEI Core in Normal World -# -# Copyright (c) 2011, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmPlatformPrePeiCore - FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - -[Sources.common] - PrePeiCore.c - MainUniCore.c - -[Sources.ARM] - Arm/ArchPrePeiCore.c - Arm/PrePeiCoreEntryPoint.asm | RVCT - Arm/PrePeiCoreEntryPoint.S | GCC - Arm/SwitchStack.asm | RVCT - Arm/SwitchStack.S | GCC - Arm/Exception.asm | RVCT - Arm/Exception.S | GCC - -[Sources.AARCH64] - AArch64/ArchPrePeiCore.c - AArch64/PrePeiCoreEntryPoint.S - AArch64/SwitchStack.S - AArch64/Exception.S - AArch64/Helper.S - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - ArmPlatformLib - BaseLib - DebugLib - DebugAgentLib - IoLib - PrintLib - SerialPortLib - -[Ppis] - gEfiTemporaryRamSupportPpiGuid - gArmGlobalVariablePpiGuid - -[FeaturePcd] - gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores - -[FixedPcd] - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdFvSize - - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase - gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize - - gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize - - gArmTokenSpaceGuid.PcdGicDistributorBase - gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c deleted file mode 100644 index 85df0816e..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Arch.c +++ /dev/null @@ -1,25 +0,0 @@ -/** @file -* -* Copyright (c) 2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include - -VOID -EFIAPI -ArmSecArchTrustzoneInit ( - VOID - ) -{ - // Write to CP15 Non-secure Access Control Register - ArmWriteNsacr (PcdGet32 (PcdArmNsacr)); -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S deleted file mode 100644 index ae4bc4454..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.S +++ /dev/null @@ -1,84 +0,0 @@ -#======================================================================================== -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#======================================================================================= - -#start of the code section -.text -.align 3 - -GCC_ASM_EXPORT(return_from_exception) -GCC_ASM_EXPORT(enter_monitor_mode) -GCC_ASM_EXPORT(copy_cpsr_into_spsr) -GCC_ASM_EXPORT(set_non_secure_mode) - -# r0: Monitor World EntryPoint -# r1: MpId -# r2: SecBootMode -# r3: Secure Monitor mode stack -ASM_PFX(enter_monitor_mode): - cmp r3, #0 @ If a Secure Monitor stack base has not been defined then use the Secure stack - moveq r3, sp - - mrs r4, cpsr @ Save current mode (SVC) in r4 - bic r5, r4, #0x1f @ Clear all mode bits - orr r5, r5, #0x16 @ Set bits for Monitor mode - msr cpsr_cxsf, r5 @ We are now in Monitor Mode - - mov sp, r3 @ Set the stack of the Monitor Mode - - mov lr, r0 @ Use the pass entrypoint as lr - - msr spsr_cxsf, r4 @ Use saved mode for the MOVS jump to the kernel - - mov r4, r0 @ Swap EntryPoint and MpId registers - mov r0, r1 - mov r1, r2 - mov r2, r3 - - bx r4 - -# We cannot use the instruction 'movs pc, lr' because the caller can be written either in ARM or Thumb2 assembler. -# When we will jump into this function, we will set the CPSR flag to ARM assembler. By copying directly 'lr' into -# 'pc'; we will not change the CPSR flag and it will crash. -# The way to fix this limitation is to do the movs into the ARM assmbler code and then do a 'bx'. -ASM_PFX(return_from_exception): - ldr lr, returned_exception - - #The following instruction breaks the code. - #movs pc, lr - mrs r2, cpsr - bic r2, r2, #0x1f - orr r2, r2, #0x13 - msr cpsr_c, r2 - -returned_exception: @ We are now in non-secure state - bx r0 - -# Save the current Program Status Register (PSR) into the Saved PSR -ASM_PFX(copy_cpsr_into_spsr): - mrs r0, cpsr - msr spsr_cxsf, r0 - bx lr - -# Set the Non Secure Mode -ASM_PFX(set_non_secure_mode): - push { r1 } - and r0, r0, #0x1f @ Keep only the mode bits - mrs r1, spsr @ Read the spsr - bic r1, r1, #0x1f @ Clear all mode bits - orr r1, r1, r0 - msr spsr_cxsf, r1 @ write back spsr (may have caused a mode switch) - isb - pop { r1 } - bx lr @ return (hopefully thumb-safe!) - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm deleted file mode 100644 index b31cc31a9..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Helper.asm +++ /dev/null @@ -1,79 +0,0 @@ -// -// Copyright (c) 2011-2012, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - - EXPORT return_from_exception - EXPORT enter_monitor_mode - EXPORT copy_cpsr_into_spsr - EXPORT set_non_secure_mode - - AREA Helper, CODE, READONLY - -// r0: Monitor World EntryPoint -// r1: MpId -// r2: SecBootMode -// r3: Secure Monitor mode stack -enter_monitor_mode FUNCTION - cmp r3, #0 // If a Secure Monitor stack base has not been defined then use the Secure stack - moveq r3, sp - - mrs r4, cpsr // Save current mode (SVC) in r4 - bic r5, r4, #0x1f // Clear all mode bits - orr r5, r5, #0x16 // Set bits for Monitor mode - msr cpsr_cxsf, r5 // We are now in Monitor Mode - - mov sp, r3 // Set the stack of the Monitor Mode - - mov lr, r0 // Use the pass entrypoint as lr - - msr spsr_cxsf, r4 // Use saved mode for the MOVS jump to the kernel - - mov r4, r0 // Swap EntryPoint and MpId registers - mov r0, r1 - mov r1, r2 - mov r2, r3 - - bx r4 - ENDFUNC - -// We cannot use the instruction 'movs pc, lr' because the caller can be written either in ARM or Thumb2 assembler. -// When we will jump into this function, we will set the CPSR flag to ARM assembler. By copying directly 'lr' into -// 'pc'; we will not change the CPSR flag and it will crash. -// The way to fix this limitation is to do the movs into the ARM assmbler code and then do a 'bx'. -return_from_exception - adr lr, returned_exception - movs pc, lr -returned_exception // We are now in non-secure state - bx r0 - -// Save the current Program Status Register (PSR) into the Saved PSR -copy_cpsr_into_spsr - mrs r0, cpsr - msr spsr_cxsf, r0 - bx lr - -// Set the Non Secure Mode -set_non_secure_mode - push { r1 } - and r0, r0, #0x1f // Keep only the mode bits - mrs r1, spsr // Read the spsr - bic r1, r1, #0x1f // Clear all mode bits - orr r1, r1, r0 - msr spsr_cxsf, r1 // write back spsr (may have caused a mode switch) - isb - pop { r1 } - bx lr // return (hopefully thumb-safe!) - -dead - B dead - - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c deleted file mode 100644 index 41ceb125f..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.c +++ /dev/null @@ -1,125 +0,0 @@ -/** @file -* Main file supporting the SEC Phase on ARM Platforms -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include -#include -#include -#include -#include - -#include "SecInternal.h" - -#define SerialPrint(txt) SerialPortWrite ((UINT8*)txt, AsciiStrLen(txt)+1); - -VOID -CEntryPoint ( - IN UINTN MpId, - IN UINTN SecBootMode - ) -{ - //CHAR8 Buffer[100]; - //UINTN CharCount; - UINTN JumpAddress; - - // CPU specific settings - ArmCpuSetup (MpId); - - // Enable Floating Point Coprocessor if supported by the platform - if (FixedPcdGet32 (PcdVFPEnabled)) { - ArmEnableVFP(); - } - - // With Trustzone support the transition from Sec to Normal world is done by return_from_exception(). - // If we want to keep this function call we need to ensure the SVC's SPSR point to the same Program - // Status Register as the the current one (CPSR). - copy_cpsr_into_spsr (); - - // Call the Platform specific function to execute additional actions if required - JumpAddress = FixedPcdGet32 (PcdFvBaseAddress); - - //ArmPlatformSecExtraAction (MpId, &JumpAddress); - NonTrustedWorldTransition (MpId, JumpAddress); - - ASSERT (0); // never return -} - -/* -VOID -TrustedWorldInitialization ( - IN UINTN MpId, - IN UINTN SecBootMode - ) -{ - //UINTN JumpAddress; - - //-------------------- Monitor Mode --------------------- - - // Set up Monitor World (Vector Table, etc) - ArmSecureMonitorWorldInitialize (); - - // Transfer the interrupt to Non-secure World - ArmGicSetupNonSecure (MpId, PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase)); - - // Initialize platform specific security policy - ArmPlatformSecTrustzoneInit (MpId); - - // Setup the Trustzone Chipsets - if (SecBootMode == ARM_SEC_COLD_BOOT) { - if (ArmPlatformIsPrimaryCore (MpId)) { - if (ArmIsMpCore()) { - // Signal the secondary core the Security settings is done (event: EVENT_SECURE_INIT) - ArmCallSEV (); - } - } else { - // The secondary cores need to wait until the Trustzone chipsets configuration is done - // before switching to Non Secure World - - // Wait for the Primary Core to finish the initialization of the Secure World (event: EVENT_SECURE_INIT) - ArmCallWFE (); - } - } - - // Call the Platform specific function to execute additional actions if required - //JumpAddress = PcdGet32 (PcdFvBaseAddress); - //ArmPlatformSecExtraAction (MpId, &JumpAddress); - - // Initialize architecture specific security policy - ArmSecArchTrustzoneInit (); - - // CP15 Secure Configuration Register - ArmWriteScr (PcdGet32 (PcdArmScr)); - - //NonTrustedWorldTransition (MpId, JumpAddress); -} -*/ -VOID -NonTrustedWorldTransition ( - IN UINTN MpId, - IN UINTN JumpAddress - ) -{ - // If PcdArmNonSecModeTransition is defined then set this specific mode to CPSR before the transition - // By not set, the mode for Non Secure World is SVC - if (PcdGet32 (PcdArmNonSecModeTransition) != 0) { - set_non_secure_mode ((ARM_PROCESSOR_MODE)PcdGet32 (PcdArmNonSecModeTransition)); - } - - return_from_exception (JumpAddress); - //-------------------- Non Secure Mode --------------------- - - // PEI Core should always load and never return - ASSERT (FALSE); -} \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf deleted file mode 100644 index 2b25ec53a..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/Sec.inf +++ /dev/null @@ -1,78 +0,0 @@ -#/** @file -# SEC - Reset vector code that jumps to C and starts the PEI phase -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ - -[Defines] - INF_VERSION = 0x00010016 - BASE_NAME = ArmPlatformSec - FILE_GUID = c536bbfe-c813-4e48-9f90-01fe1ecf9d54 - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - -[Sources] - Sec.c - -[Sources.ARM] - Arch.c - Helper.S | GCC - SecEntryPoint.S | GCC - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmCpuLib - ArmLib - ArmPlatformLib - ArmPlatformSecLib - ArmTrustedMonitorLib - BaseLib - DebugLib - #DebugAgentLib - IoLib - ArmGicLib - PrintLib - SerialPortLib - PcdLib - -[FixedPcd.common] - gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString - - gArmTokenSpaceGuid.PcdTrustzoneSupport - gArmTokenSpaceGuid.PcdVFPEnabled - - gArmTokenSpaceGuid.PcdArmScr - gArmTokenSpaceGuid.PcdArmNonSecModeTransition - - gArmTokenSpaceGuid.PcdSecureFvBaseAddress - gArmTokenSpaceGuid.PcdSecureFvSize - - gArmTokenSpaceGuid.PcdFvBaseAddress - - gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize - - gArmTokenSpaceGuid.PcdGicDistributorBase - gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase - - gArmPlatformTokenSpaceGuid.PcdSecGlobalVariableSize - -[FixedPcd.ARM] - gArmTokenSpaceGuid.PcdArmNsacr diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S deleted file mode 100644 index d447855b7..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.S +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include "SecInternal.h" - -.text -.align 3 - -GCC_ASM_IMPORT(CEntryPoint) -GCC_ASM_IMPORT(ArmReadMpidr) -GCC_ASM_EXPORT(_ModuleEntryPoint) - -//StartupAddr: .word ASM_PFX(CEntryPoint) - -ASM_PFX(_ModuleEntryPoint): - - // Doing a second stage boot from SPL - mov r10, #ARM_SEC_SECONDARY_COLD_BOOT - -_IdentifyCpu: - // Identify CPU ID - bl ASM_PFX(ArmReadMpidr) - // Keep a copy of the MpId register value - mov r9, r0 - -_CallCEntryPoint: - mov r0, r9 - mov r1, r10 - blx ASM_PFX(CEntryPoint) - -_NeverReturn: - b _NeverReturn \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm deleted file mode 100644 index 2f4e8cf63..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecEntryPoint.asm +++ /dev/null @@ -1,126 +0,0 @@ -// -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include "SecInternal.h" - - INCLUDE AsmMacroIoLib.inc - - IMPORT CEntryPoint - IMPORT ArmPlatformIsPrimaryCore - IMPORT ArmPlatformGetCorePosition - //IMPORT ArmPlatformSecBootAction - //IMPORT ArmPlatformSecBootMemoryInit - IMPORT ArmDisableInterrupts - IMPORT ArmDisableCachesAndMmu - IMPORT ArmReadMpidr - IMPORT ArmCallWFE - EXPORT _ModuleEntryPoint - - PRESERVE8 - AREA SecEntryPoint, CODE, READONLY - -StartupAddr DCD CEntryPoint - -_ModuleEntryPoint FUNCTION - // First ensure all interrupts are disabled - bl ArmDisableInterrupts - - // Ensure that the MMU and caches are off - bl ArmDisableCachesAndMmu - - // By default, we are doing a cold boot - mov r10, #ARM_SEC_COLD_BOOT - - // Jump to Platform Specific Boot Action function - //blx ArmPlatformSecBootAction - -_IdentifyCpu - // Identify CPU ID - bl ArmReadMpidr - // Keep a copy of the MpId register value - mov r9, r0 - - // Is it the Primary Core ? - bl ArmPlatformIsPrimaryCore - cmp r0, #1 - // Only the primary core initialize the memory (SMC) - beq _InitMem - -_WaitInitMem - // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized - // Otherwise we have to wait the Primary Core to finish the initialization - cmp r10, #ARM_SEC_COLD_BOOT - bne _SetupSecondaryCoreStack - - // Wait for the primary core to initialize the initial memory (event: BOOT_MEM_INIT) - bl ArmCallWFE - // Now the Init Mem is initialized, we setup the secondary core stacks - b _SetupSecondaryCoreStack - -_InitMem - // If we are not doing a cold boot in this case we should assume the Initial Memory to be already initialized - cmp r10, #ARM_SEC_COLD_BOOT - bne _SetupPrimaryCoreStack - - // Initialize Init Boot Memory - //bl ArmPlatformSecBootMemoryInit - -_SetupPrimaryCoreStack - // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2) - add r1, r1, r2 - - LoadConstantToReg (FixedPcdGet32(PcdSecGlobalVariableSize), r2) - - // The reserved space for global variable must be 8-bytes aligned for pushing - // 64-bit variable on the stack - SetPrimaryStack (r1, r2, r3) - b _PrepareArguments - -_SetupSecondaryCoreStack - // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2) - add r6, r1, r2 - - // Get the Core Position - mov r0, r9 - bl ArmPlatformGetCorePosition - // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack - add r0, r0, #1 - - // StackOffset = CorePos * StackSize - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2) - mul r0, r0, r2 - // SP = StackBase + StackOffset - add sp, r6, r0 - -_PrepareArguments - // Move sec startup address into a data register - // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr r3, StartupAddr - - // Jump to SEC C code - // r0 = mp_id - // r1 = Boot Mode - mov r0, r9 - mov r1, r10 - blx r3 - ENDFUNC - -_NeverReturn - b _NeverReturn - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h deleted file mode 100644 index 111123725..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Sec/SecInternal.h +++ /dev/null @@ -1,83 +0,0 @@ -/** @file -* Main file supporting the SEC Phase on ARM PLatforms -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef __SEC_H__ -#define __SEC_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0) - -VOID -TrustedWorldInitialization ( - IN UINTN MpId, - IN UINTN SecBootMode - ); - -VOID -NonTrustedWorldTransition ( - IN UINTN MpId, - IN UINTN JumpAddress - ); - -VOID -ArmSetupGicNonSecure ( - IN INTN GicDistributorBase, - IN INTN GicInterruptInterfaceBase -); - -VOID -enter_monitor_mode ( - IN UINTN MonitorEntryPoint, - IN UINTN MpId, - IN UINTN SecBootMode, - IN VOID* MonitorStackBase - ); - -VOID -return_from_exception ( - IN UINTN NonSecureBase - ); - -VOID -copy_cpsr_into_spsr ( - VOID - ); - -VOID -set_non_secure_mode ( - IN ARM_PROCESSOR_MODE Mode - ); - -VOID -SecCommonExceptionEntry ( - IN UINT32 Entry, - IN UINTN LR - ); - -VOID -EFIAPI -ArmSecArchTrustzoneInit ( - VOID - ); - -#endif -- cgit v1.2.3 From 9ca16b08e846a0e1acfbc206604db9e42f92e6e2 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 22:15:44 +0530 Subject: BeagleBoneBlackPkg: Use ArmPlatformPkg/PrePi Depreciate local PrePi. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 2 +- .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 2 +- .../BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c | 33 --- .../PrePi/AArch64/ModuleEntryPoint.S | 146 ------------ .../BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c | 29 --- .../PrePi/Arm/ModuleEntryPoint.S | 155 ------------ .../PrePi/Arm/ModuleEntryPoint.asm | 158 ------------- .../BeagleBoneBlackPkg/PrePi/LzmaDecompress.h | 103 -------- .../BeagleBoneBlackPkg/PrePi/MainMPCore.c | 99 -------- .../BeagleBoneBlackPkg/PrePi/MainUniCore.c | 44 ---- .../BeagleBoneBlackPkg/PrePi/PeiMPCore.inf | 115 --------- .../BeagleBoneBlackPkg/PrePi/PeiUniCore.inf | 108 --------- .../BeagleBoneBlackPkg/PrePi/PrePi.c | 259 --------------------- .../BeagleBoneBlackPkg/PrePi/PrePi.h | 90 ------- 14 files changed, 2 insertions(+), 1341 deletions(-) delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c delete mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf delete mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf delete mode 100755 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 758254258..1edf38d38 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -327,7 +327,7 @@ # # PEI Phase modules # - TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf + ArmPlatformPkg/PrePi/PeiUniCore.inf # # DXE diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf index af8e4fdbb..3aa826eda 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf @@ -160,7 +160,7 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf + INF ArmPlatformPkg/PrePi/PeiUniCore.inf FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c deleted file mode 100644 index 217986107..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ArchPrePi.c +++ /dev/null @@ -1,33 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include "PrePi.h" - -#include - -VOID -ArchInitialize ( - VOID - ) -{ - // Enable Floating Point - if (FixedPcdGet32 (PcdVFPEnabled)) { - ArmEnableVFP (); - } - - if (ArmReadCurrentEL () == AARCH64_EL2) { - // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2 - ArmWriteHcr (ARM_HCR_TGE); - } -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S deleted file mode 100644 index fcea9496c..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/AArch64/ModuleEntryPoint.S +++ /dev/null @@ -1,146 +0,0 @@ -// -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include - -.text -.align 3 - -GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) -GCC_ASM_IMPORT(ArmReadMpidr) -GCC_ASM_IMPORT(ArmPlatformPeiBootAction) -GCC_ASM_IMPORT(ArmPlatformStackSet) -GCC_ASM_EXPORT(_ModuleEntryPoint) - -StartupAddr: .8byte ASM_PFX(CEntryPoint) - -ASM_PFX(_ModuleEntryPoint): - // Do early platform specific actions - bl ASM_PFX(ArmPlatformPeiBootAction) - - // Get ID of this CPU in Multicore system - bl ASM_PFX(ArmReadMpidr) - // Keep a copy of the MpId register value - mov x10, x0 - -_SetSVCMode: -// Check if we can install the stack at the top of the System Memory or if we need -// to install the stacks at the bottom of the Firmware Device (case the FD is located -// at the top of the DRAM) -_SetupStackPosition: - // Compute Top of System Memory - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), x1) - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), x2) - sub x2, x2, #1 - add x1, x1, x2 // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize - - // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2) - LoadConstantToReg (FixedPcdGet32(PcdFdSize), x3) - sub x3, x3, #1 - add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize - - // UEFI Memory Size (stacks are allocated in this region) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), x4) - - // - // Reserve the memory for the UEFI region (contain stacks on its top) - // - - // Calculate how much space there is between the top of the Firmware and the Top of the System Memory - subs x0, x1, x3 // x0 = SystemMemoryTop - FdTop - b.mi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM - cmp x0, x4 - b.ge _SetupStack - - // Case the top of stacks is the FdBaseAddress - mov x1, x2 - -_SetupStack: - // x1 contains the top of the stack (and the UEFI Memory) - - // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment - // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the - // top of the memory space) - adds x11, x1, #1 - b.cs _SetupOverflowStack - -_SetupAlignedStack: - mov x1, x11 - b _GetBaseUefiMemory - -_SetupOverflowStack: - // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE - // aligned (4KB) - LoadConstantToReg (EFI_PAGE_MASK, x11) - and x11, x11, x1 - sub x1, x1, x11 - -_GetBaseUefiMemory: - // Calculate the Base of the UEFI Memory - sub x11, x1, x4 - -_GetStackBase: - // r1 = The top of the Mpcore Stacks - // Stack for the primary core = PrimaryCoreStack - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) - sub x12, x1, x2 - - // Stack for the secondary core = Number of Cores - 1 - LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0) - sub x0, x0, #1 - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1) - mul x1, x1, x0 - sub x12, x12, x1 - - // x12 = The base of the MpCore Stacks (primary stack & secondary stacks) - mov x0, x12 - mov x1, x10 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x3) - bl ASM_PFX(ArmPlatformStackSet) - - // Is it the Primary Core ? - mov x0, x10 - bl ASM_PFX(ArmPlatformIsPrimaryCore) - cmp x0, #1 - bne _PrepareArguments - -_ReserveGlobalVariable: - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x0) - // InitializePrimaryStack($GlobalVariableSize, $Tmp1, $Tmp2) - InitializePrimaryStack(x0, x1, x2) - -_PrepareArguments: - mov x0, x10 - mov x1, x11 - mov x2, x12 - mov x3, sp - - // Move sec startup address into a data register - // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr x4, StartupAddr - - // Jump to PrePiCore C code - // x0 = MpId - // x1 = UefiMemoryBase - // x2 = StacksBase - // x3 = GlobalVariableBase - blr x4 - -_NeverReturn: - b _NeverReturn diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c deleted file mode 100644 index 075eb89e1..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ArchPrePi.c +++ /dev/null @@ -1,29 +0,0 @@ -/** @file -* -* Copyright (c) 2011 - 2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include "PrePi.h" - -VOID -ArchInitialize ( - VOID - ) -{ - // Enable program flow prediction, if supported. - ArmEnableBranchPrediction (); - - if (FixedPcdGet32 (PcdVFPEnabled)) { - ArmEnableVFP (); - } -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S deleted file mode 100644 index a305a50e2..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.S +++ /dev/null @@ -1,155 +0,0 @@ -// -// Copyright (c) 2011-2014, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include - -#include - -.text -.align 3 - -GCC_ASM_IMPORT(CEntryPoint) -GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) -GCC_ASM_IMPORT(ArmReadMpidr) -GCC_ASM_IMPORT(ArmPlatformPeiBootAction) -GCC_ASM_IMPORT(ArmPlatformStackSet) -GCC_ASM_EXPORT(_ModuleEntryPoint) - -StartupAddr: .word CEntryPoint - - -ASM_PFX(_ModuleEntryPoint): - // Do early platform specific actions - bl ASM_PFX(ArmPlatformPeiBootAction) - - // Get ID of this CPU in Multicore system - bl ASM_PFX(ArmReadMpidr) - // Keep a copy of the MpId register value - mov r8, r0 - -_SetSVCMode: - // Enter SVC mode, Disable FIQ and IRQ - mov r1, #(CPSR_MODE_SVC | CPSR_IRQ | CPSR_FIQ) - msr CPSR_c, r1 - -// Check if we can install the stack at the top of the System Memory or if we need -// to install the stacks at the bottom of the Firmware Device (case the FD is located -// at the top of the DRAM) -_SetupStackPosition: - // Compute Top of System Memory - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), r1) - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), r2) - sub r2, r2, #1 - add r1, r1, r2 // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize - - // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2) - LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3) - sub r3, r3, #1 - add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize - - // UEFI Memory Size (stacks are allocated in this region) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4) - - // - // Reserve the memory for the UEFI region (contain stacks on its top) - // - - // Calculate how much space there is between the top of the Firmware and the Top of the System Memory - subs r0, r1, r3 // r0 = SystemMemoryTop - FdTop - bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM - cmp r0, r4 - bge _SetupStack - - // Case the top of stacks is the FdBaseAddress - mov r1, r2 - -_SetupStack: - // r1 contains the top of the stack (and the UEFI Memory) - - // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment - // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the - // top of the memory space) - adds r9, r1, #1 - bcs _SetupOverflowStack - -_SetupAlignedStack: - mov r1, r9 - b _GetBaseUefiMemory - -_SetupOverflowStack: - // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE - // aligned (4KB) - LoadConstantToReg (EFI_PAGE_MASK, r9) - and r9, r9, r1 - sub r1, r1, r9 - -_GetBaseUefiMemory: - // Calculate the Base of the UEFI Memory - sub r9, r1, r4 - -_GetStackBase: - // r1 = The top of the Mpcore Stacks - // Stack for the primary core = PrimaryCoreStack - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - sub r10, r1, r2 - - // Stack for the secondary core = Number of Cores - 1 - LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0) - sub r0, r0, #1 - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1) - mul r1, r1, r0 - sub r10, r10, r1 - - // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) - mov r0, r10 - mov r1, r8 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3) - bl ASM_PFX(ArmPlatformStackSet) - - // Is it the Primary Core ? - mov r0, r8 - bl ASM_PFX(ArmPlatformIsPrimaryCore) - cmp r0, #1 - bne _PrepareArguments - -_ReserveGlobalVariable: - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r0) - // InitializePrimaryStack($GlobalVariableSize, $Tmp1) - InitializePrimaryStack(r0, r1) - -_PrepareArguments: - mov r0, r8 - mov r1, r9 - mov r2, r10 - mov r3, sp - - // Move sec startup address into a data register - // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr r4, StartupAddr - - // Jump to PrePiCore C code - // r0 = MpId - // r1 = UefiMemoryBase - // r2 = StacksBase - // r3 = GlobalVariableBase - blx ASM_PFX (CEntryPoint) - -_NeverReturn: - b _NeverReturn - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm deleted file mode 100644 index 028a9a1b2..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/Arm/ModuleEntryPoint.asm +++ /dev/null @@ -1,158 +0,0 @@ -// -// Copyright (c) 2011-2014, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include - -#include - - INCLUDE AsmMacroIoLib.inc - - IMPORT CEntryPoint - IMPORT ArmPlatformIsPrimaryCore - IMPORT ArmReadMpidr - IMPORT ArmPlatformPeiBootAction - IMPORT ArmPlatformStackSet - - EXPORT _ModuleEntryPoint - - PRESERVE8 - AREA PrePiCoreEntryPoint, CODE, READONLY - -StartupAddr DCD CEntryPoint - -_ModuleEntryPoint - // Do early platform specific actions - bl ArmPlatformPeiBootAction - - // Get ID of this CPU in Multicore system - bl ArmReadMpidr - // Keep a copy of the MpId register value - mov r8, r0 - -_SetSVCMode - // Enter SVC mode, Disable FIQ and IRQ - mov r1, #(CPSR_MODE_SVC :OR: CPSR_IRQ :OR: CPSR_FIQ) - msr CPSR_c, r1 - -// Check if we can install the stack at the top of the System Memory or if we need -// to install the stacks at the bottom of the Firmware Device (case the FD is located -// at the top of the DRAM) -_SetupStackPosition - // Compute Top of System Memory - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), r1) - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), r2) - sub r2, r2, #1 - add r1, r1, r2 // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize - - // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2) - LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3) - sub r3, r3, #1 - add r3, r3, r2 // r3 = FdTop = PcdFdBaseAddress + PcdFdSize - - // UEFI Memory Size (stacks are allocated in this region) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4) - - // - // Reserve the memory for the UEFI region (contain stacks on its top) - // - - // Calculate how much space there is between the top of the Firmware and the Top of the System Memory - subs r0, r1, r3 // r0 = SystemMemoryTop - FdTop - bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case when the PrePi is in XIP memory outside of the DRAM - cmp r0, r4 - bge _SetupStack - - // Case the top of stacks is the FdBaseAddress - mov r1, r2 - -_SetupStack - // r1 contains the top of the stack (and the UEFI Memory) - - // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment - // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the - // top of the memory space) - adds r9, r1, #1 - bcs _SetupOverflowStack - -_SetupAlignedStack - mov r1, r9 - b _GetBaseUefiMemory - -_SetupOverflowStack - // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE - // aligned (4KB) - LoadConstantToReg (EFI_PAGE_MASK, r9) - and r9, r9, r1 - sub r1, r1, r9 - -_GetBaseUefiMemory - // Calculate the Base of the UEFI Memory - sub r9, r1, r4 - -_GetStackBase - // r1 = The top of the Mpcore Stacks - // Stack for the primary core = PrimaryCoreStack - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - sub r10, r1, r2 - - // Stack for the secondary core = Number of Cores - 1 - LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0) - sub r0, r0, #1 - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1) - mul r1, r1, r0 - sub r10, r10, r1 - - // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) - mov r0, r10 - mov r1, r8 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3) - bl ArmPlatformStackSet - - // Is it the Primary Core ? - mov r0, r8 - bl ArmPlatformIsPrimaryCore - cmp r0, #1 - bne _PrepareArguments - -_ReserveGlobalVariable - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r0) - // InitializePrimaryStack($GlobalVariableSize, $Tmp1) - InitializePrimaryStack r0, r1 - -_PrepareArguments - mov r0, r8 - mov r1, r9 - mov r2, r10 - mov r3, sp - - // Move sec startup address into a data register - // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr r4, StartupAddr - - // Jump to PrePiCore C code - // r0 = MpId - // r1 = UefiMemoryBase - // r2 = StacksBase - // r3 = GlobalVariableBase - blx r4 - -_NeverReturn - b _NeverReturn - - END diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h deleted file mode 100644 index e4483b682..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/LzmaDecompress.h +++ /dev/null @@ -1,103 +0,0 @@ -/** @file - LZMA Decompress Library header file - - Copyright (c) 2006 - 2010, 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 __LZMA_DECOMPRESS_H___ -#define __LZMA_DECOMPRESS_H___ - -/** - Examines a GUIDed section and returns the size of the decoded buffer and the - size of an scratch buffer required to actually decode the data in a GUIDed section. - - Examines a GUIDed section specified by InputSection. - If GUID for InputSection does not match the GUID that this handler supports, - then RETURN_UNSUPPORTED is returned. - If the required information can not be retrieved from InputSection, - then RETURN_INVALID_PARAMETER is returned. - If the GUID of InputSection does match the GUID that this handler supports, - then the size required to hold the decoded buffer is returned in OututBufferSize, - the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field - from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute. - - If InputSection is NULL, then ASSERT(). - If OutputBufferSize is NULL, then ASSERT(). - If ScratchBufferSize is NULL, then ASSERT(). - If SectionAttribute is NULL, then ASSERT(). - - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required - if the buffer specified by InputSection were decoded. - @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space - if the buffer specified by InputSection were decoded. - @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes - field of EFI_GUID_DEFINED_SECTION in the PI Specification. - - @retval RETURN_SUCCESS The information about InputSection was returned. - @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection. - -**/ -RETURN_STATUS -EFIAPI -LzmaGuidedSectionGetInfo ( - IN CONST VOID *InputSection, - OUT UINT32 *OutputBufferSize, - OUT UINT32 *ScratchBufferSize, - OUT UINT16 *SectionAttribute - ); - -/** - Decompress a LZAM compressed GUIDed section into a caller allocated output buffer. - - Decodes the GUIDed section specified by InputSection. - If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned. - If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned. - If the GUID of InputSection does match the GUID that this handler supports, then InputSection - is decoded into the buffer specified by OutputBuffer and the authentication status of this - decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the - data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise, - the decoded data will be placed in caller allocated buffer specified by OutputBuffer. - - If InputSection is NULL, then ASSERT(). - If OutputBuffer is NULL, then ASSERT(). - If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). - If AuthenticationStatus is NULL, then ASSERT(). - - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. - @param[out] ScratchBuffer A caller allocated buffer that may be required by this function - as a scratch buffer to perform the decode operation. - @param[out] AuthenticationStatus - A pointer to the authentication status of the decoded output buffer. - See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI - section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must - never be set by this handler. - - @retval RETURN_SUCCESS The buffer specified by InputSection was decoded. - @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded. - -**/ -RETURN_STATUS -EFIAPI -LzmaGuidedSectionExtraction ( - IN CONST VOID *InputSection, - OUT VOID **OutputBuffer, - OUT VOID *ScratchBuffer, OPTIONAL - OUT UINT32 *AuthenticationStatus - ); - -#endif // __LZMADECOMPRESS_H__ - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c deleted file mode 100644 index 5868993d5..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainMPCore.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include "PrePi.h" - -#include - -#include - -VOID -PrimaryMain ( - IN UINTN UefiMemoryBase, - IN UINTN StacksBase, - IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp - ) -{ - // Enable the GIC Distributor - ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase)); - - // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader to resume their initialization - if (!FixedPcdGet32(PcdSendSgiToBringUpSecondaryCores)) { - // Sending SGI to all the Secondary CPU interfaces - ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); - } - - PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); - - // We must never return - ASSERT(FALSE); -} - -VOID -SecondaryMain ( - IN UINTN MpId - ) -{ - EFI_STATUS Status; - ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi; - UINTN Index; - UINTN ArmCoreCount; - ARM_CORE_INFO *ArmCoreInfoTable; - UINT32 ClusterId; - UINT32 CoreId; - VOID (*SecondaryStart)(VOID); - UINTN SecondaryEntryAddr; - - ClusterId = GET_CLUSTER_ID(MpId); - CoreId = GET_CORE_ID(MpId); - - // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid) - Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi); - ASSERT_EFI_ERROR (Status); - - ArmCoreCount = 0; - Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable); - ASSERT_EFI_ERROR (Status); - - // Find the core in the ArmCoreTable - for (Index = 0; Index < ArmCoreCount; Index++) { - if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) { - break; - } - } - - // The ARM Core Info Table must define every core - ASSERT (Index != ArmCoreCount); - - // Clear Secondary cores MailBox - MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue); - - do { - ArmCallWFI (); - - // Read the Mailbox - SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress); - - // Acknowledge the interrupt and send End of Interrupt signal. - ArmGicAcknowledgeInterrupt (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase), NULL, NULL); - } while (SecondaryEntryAddr == 0); - - // Jump to secondary core entry point. - SecondaryStart = (VOID (*)())SecondaryEntryAddr; - SecondaryStart(); - - // The secondaries shouldn't reach here - ASSERT(FALSE); -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c deleted file mode 100644 index 43588a50d..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/MainUniCore.c +++ /dev/null @@ -1,44 +0,0 @@ -/** @file -* -* Copyright (c) 2011, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include "PrePi.h" - -VOID -PrimaryMain ( - IN UINTN UefiMemoryBase, - IN UINTN StacksBase, - IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp - ) -{ - DEBUG_CODE_BEGIN(); - // On MPCore system, PeiMpCore.inf should be used instead of PeiUniCore.inf - ASSERT(ArmIsMpCore() == 0); - DEBUG_CODE_END(); - - PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); - - // We must never return - ASSERT(FALSE); -} - -VOID -SecondaryMain ( - IN UINTN MpId - ) -{ - // We must never get into this function on UniCore system - ASSERT(FALSE); -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf deleted file mode 100755 index 38ba50c13..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiMPCore.inf +++ /dev/null @@ -1,115 +0,0 @@ -#/** @file -# -# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmPlatformPrePiMPCore - FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8 - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - -[Sources] - PrePi.c - MainMPCore.c - -[Sources.ARM] - Arm/ArchPrePi.c - Arm/ModuleEntryPoint.S | GCC - Arm/ModuleEntryPoint.asm | RVCT - -[Sources.AArch64] - AArch64/ArchPrePi.c - AArch64/ModuleEntryPoint.S - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - DebugAgentLib - ArmLib - ArmGicLib - IoLib - TimerLib - SerialPortLib - ExtractGuidedSectionLib - LzmaDecompressLib - PeCoffGetEntryPointLib - DebugAgentLib - PrePiLib - ArmPlatformLib - ArmPlatformStackLib - MemoryAllocationLib - HobLib - PrePiHobListPointerLib - PlatformPeiLib - MemoryInitPeiLib - -[Ppis] - gArmMpCoreInfoPpiGuid - -[Guids] - gArmGlobalVariableGuid - gArmMpCoreInfoGuid - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob - gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores - -[FixedPcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString - - gArmTokenSpaceGuid.PcdVFPEnabled - - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFdSize - - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdFvSize - - gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize - - gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize - - gArmTokenSpaceGuid.PcdGicDistributorBase - gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase - gArmTokenSpaceGuid.PcdGicSgiIntId - - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize - - gArmPlatformTokenSpaceGuid.PcdCoreCount - gArmTokenSpaceGuid.PcdArmPrimaryCore - - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize - - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf deleted file mode 100755 index ba394f6ce..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PeiUniCore.inf +++ /dev/null @@ -1,108 +0,0 @@ -#/** @file -# -# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmPlatformPrePiUniCore - FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8 - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - -[Sources] - PrePi.c - MainUniCore.c - -[Sources.ARM] - Arm/ArchPrePi.c - Arm/ModuleEntryPoint.S | GCC - Arm/ModuleEntryPoint.asm | RVCT - -[Sources.AArch64] - AArch64/ArchPrePi.c - AArch64/ModuleEntryPoint.S - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - DebugAgentLib - ArmLib - IoLib - TimerLib - SerialPortLib - ExtractGuidedSectionLib - LzmaDecompressLib - PeCoffGetEntryPointLib - DebugAgentLib - PrePiLib - ArmPlatformLib - ArmPlatformStackLib - MemoryAllocationLib - HobLib - PrePiHobListPointerLib - PlatformPeiLib - MemoryInitPeiLib - -[Ppis] - gArmMpCoreInfoPpiGuid - -[Guids] - gArmGlobalVariableGuid - gArmMpCoreInfoGuid - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob - gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores - -[FixedPcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString - - gArmTokenSpaceGuid.PcdVFPEnabled - - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFdSize - - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdFvSize - - gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize - - gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize - - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize - - gArmPlatformTokenSpaceGuid.PcdCoreCount - - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize - - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c deleted file mode 100755 index 90d6c4246..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.c +++ /dev/null @@ -1,259 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2014, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "PrePi.h" -#include "LzmaDecompress.h" - -#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize))) || \ - ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) - -// Not used when PrePi in run in XIP mode -UINTN mGlobalVariableBase = 0; - -EFI_STATUS -EFIAPI -ExtractGuidedSectionLibConstructor ( - VOID - ); - -EFI_STATUS -EFIAPI -LzmaDecompressLibConstructor ( - VOID - ); - -VOID -EFIAPI -BuildGlobalVariableHob ( - IN EFI_PHYSICAL_ADDRESS GlobalVariableBase, - IN UINT32 GlobalVariableSize - ) -{ - ARM_HOB_GLOBAL_VARIABLE *Hob; - - Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE)); - ASSERT(Hob != NULL); - - CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid); - Hob->GlobalVariableBase = GlobalVariableBase; - Hob->GlobalVariableSize = GlobalVariableSize; -} - -EFI_STATUS -GetPlatformPpi ( - IN EFI_GUID *PpiGuid, - OUT VOID **Ppi - ) -{ - UINTN PpiListSize; - UINTN PpiListCount; - EFI_PEI_PPI_DESCRIPTOR *PpiList; - UINTN Index; - - PpiListSize = 0; - ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); - PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); - for (Index = 0; Index < PpiListCount; Index++, PpiList++) { - if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) { - *Ppi = PpiList->Ppi; - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -VOID -PrePiMain ( - IN UINTN UefiMemoryBase, - IN UINTN StacksBase, - IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE* HobList; - ARM_MP_CORE_INFO_PPI* ArmMpCoreInfoPpi; - UINTN ArmCoreCount; - ARM_CORE_INFO* ArmCoreInfoTable; - EFI_STATUS Status; - CHAR8 Buffer[100]; - UINTN CharCount; - UINTN StacksSize; - // If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP) - ASSERT (IS_XIP() || - ((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) && - ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet64 (PcdSystemMemorySize))))); - - // Initialize the architecture specific bits - ArchInitialize (); - - // Initialize the Serial Port - SerialPortInitialize (); - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r", - (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); - SerialPortWrite ((UINT8 *) Buffer, CharCount); - - // Initialize the Debug Agent for Source Level Debugging - InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); - SaveAndSetDebugTimerInterrupt (TRUE); - - // Declare the PI/UEFI memory region - HobList = HobConstructor ( - (VOID*)UefiMemoryBase, - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize), - (VOID*)UefiMemoryBase, - (VOID*)StacksBase // The top of the UEFI Memory is reserved for the stacks - ); - PrePeiSetHobList (HobList); - - // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) - Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)); - - ASSERT_EFI_ERROR (Status); - - // Create the Stacks HOB (reserve the memory for all stacks) - if (ArmIsMpCore ()) { - StacksSize = FixedPcdGet32 (PcdCPUCorePrimaryStackSize) + - ((FixedPcdGet32 (PcdCoreCount) - 1) * FixedPcdGet32 (PcdCPUCoreSecondaryStackSize)); - } else { - StacksSize = FixedPcdGet32 (PcdCPUCorePrimaryStackSize); - } - - BuildStackHob (StacksBase, StacksSize); - - // Declare the Global Variable HOB - BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize)); - - //TODO: Call CpuPei as a library - BuildCpuHob (FixedPcdGet8 (PcdPrePiCpuMemorySize), FixedPcdGet8 (PcdPrePiCpuIoSize)); - - if (ArmIsMpCore ()) { - // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid - Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi); - - // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid) - ASSERT_EFI_ERROR (Status); - - // Build the MP Core Info Table - ArmCoreCount = 0; - Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable); - if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) { - // Build MPCore Info HOB - BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount); - } - } - - // Set the Boot Mode - SetBootMode (ArmPlatformGetBootMode ()); - // Initialize Platform HOBs (CpuHob and FvHob) - Status = PlatformPeim (); - ASSERT_EFI_ERROR (Status); - // Now, the HOB List has been initialized, we can register performance information - PERF_START (NULL, "PEI", NULL, StartTimeStamp); - - // SEC phase needs to run library constructors by hand. - ExtractGuidedSectionLibConstructor (); - - LzmaDecompressLibConstructor (); - - // Build HOBs to pass up our version of stuff the DXE Core needs to save space - BuildPeCoffLoaderHob (); - BuildExtractSectionHob ( - &gLzmaCustomDecompressGuid, - LzmaGuidedSectionGetInfo, - LzmaGuidedSectionExtraction - ); - - // Assume the FV that contains the SEC (our code) also contains a compressed FV. - Status = DecompressFirstFv (); - //ASSERT_EFI_ERROR (Status); - // Load the DXE Core and transfer control to it - - Status = LoadDxeCoreFromFv (NULL, 0); - ASSERT_EFI_ERROR (Status); -} - -VOID -CEntryPoint ( - IN UINTN MpId, - IN UINTN UefiMemoryBase, - IN UINTN StacksBase, - IN UINTN GlobalVariableBase - ) -{ - UINT64 StartTimeStamp; - ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1)); - - // Initialize the platform specific controllers - ArmPlatformInitialize (MpId); - - if (ArmPlatformIsPrimaryCore (MpId) && PerformanceMeasurementEnabled ()) { - // Initialize the Timer Library to setup the Timer HW controller - TimerConstructor (); - // We cannot call yet the PerformanceLib because the HOB List has not been initialized - StartTimeStamp = GetPerformanceCounter (); - } else { - StartTimeStamp = 0; - } - - // Data Cache enabled on Primary core when MMU is enabled. - ArmDisableDataCache (); - // Invalidate Data cache - //ArmInvalidateDataCache (); - // Invalidate instruction cache - //ArmInvalidateInstructionCache (); - // Enable Instruction Caches on all cores. - ArmEnableInstructionCache (); - - // Define the Global Variable region when we are not running in XIP - if (!IS_XIP()) { - if (ArmPlatformIsPrimaryCore (MpId)) { - mGlobalVariableBase = GlobalVariableBase; - if (ArmIsMpCore()) { - // Signal the Global Variable Region is defined (event: ARM_CPU_EVENT_DEFAULT) - ArmCallSEV (); - } - } else { - // Wait the Primay core has defined the address of the Global Variable region (event: ARM_CPU_EVENT_DEFAULT) - ArmCallWFE (); - } - } - - // If not primary Jump to Secondary Main - if (ArmPlatformIsPrimaryCore (MpId)) { - // Goto primary Main. - PrimaryMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); - } else { - SecondaryMain (MpId); - } - - // DXE Core should always load and never return - ASSERT (FALSE); -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h deleted file mode 100644 index e67795f44..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/PrePi/PrePi.h +++ /dev/null @@ -1,90 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef _PREPI_H_ -#define _PREPI_H_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); - -RETURN_STATUS -EFIAPI -TimerConstructor ( - VOID - ); - -VOID -PrePiMain ( - IN UINTN UefiMemoryBase, - IN UINTN StacksBase, - IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp - ); - -EFI_STATUS -EFIAPI -MemoryPeim ( - IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, - IN UINT64 UefiMemorySize - ); - -EFI_STATUS -EFIAPI -PlatformPeim ( - VOID - ); - -VOID -PrimaryMain ( - IN UINTN UefiMemoryBase, - IN UINTN StacksBase, - IN UINTN GlobalVariableBase, - IN UINT64 StartTimeStamp - ); - -VOID -SecondaryMain ( - IN UINTN MpId - ); - -// Either implemented by PrePiLib or by MemoryInitPei -VOID -BuildMemoryTypeInformationHob ( - VOID - ); - -EFI_STATUS -GetPlatformPpi ( - IN EFI_GUID *PpiGuid, - OUT VOID **Ppi - ); - -// Initialize the Architecture specific controllers -VOID -ArchInitialize ( - VOID - ); - -#endif /* _PREPI_H_ */ -- cgit v1.2.3 From f76aa666e61eee80a2ca11d99a661596ba501f70 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 22:18:26 +0530 Subject: BeagleBoneBlackPkg: Remove Include/Platform Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../Platform/ArmPlatformGlobalVariableLib.h | 38 ---- .../Include/Platform/ArmPlatformSecLib.h | 88 -------- .../Include/Platform/ArmPlatformSysConfigLib.h | 63 ------ .../Include/Platform/ArmTrustedMonitorLib.h | 24 --- .../Include/Platform/LcdPlatformLib.h | 221 --------------------- .../Include/Platform/NorFlashPlatformLib.h | 37 ---- 6 files changed, 471 deletions(-) delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h deleted file mode 100644 index b1a080c00..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformGlobalVariableLib.h +++ /dev/null @@ -1,38 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_ -#define __ARM_PLATFORM_GLOBAL_VARIABLE_LIB_H_ - -VOID -ArmPlatformGetGlobalVariable ( - IN UINTN VariableOffset, - IN UINTN VariableSize, - OUT VOID* Variable - ); - -VOID -ArmPlatformSetGlobalVariable ( - IN UINTN VariableOffset, - IN UINTN VariableSize, - OUT VOID* Variable - ); - -VOID* -ArmPlatformGetGlobalVariableAddress ( - IN UINTN VariableOffset - ); - -#endif - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h deleted file mode 100644 index ece806490..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSecLib.h +++ /dev/null @@ -1,88 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef _ARMPLATFORMSECLIB_H_ -#define _ARMPLATFORMSECLIB_H_ - -#define ARM_SEC_BOOT_MASK ~0 -#define ARM_SEC_COLD_BOOT (1 << 0) -#define ARM_SEC_SECONDARY_COLD_BOOT (1 << 1) - -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -VOID -ArmPlatformSecBootMemoryInit ( - VOID - ); - -/** - Call at the beginning of the platform boot up - - This function allows the firmware platform to do extra actions at the early - stage of the platform power up. - - Note: This function must be implemented in assembler as there is no stack set up yet - -**/ -VOID -ArmPlatformSecBootAction ( - VOID - ); - -/** - Initialize controllers that must setup at the early stage - - Some peripherals must be initialized in Secure World. - For example: Some L2 controller, interconnect, clock, DMC, etc - -**/ -RETURN_STATUS -ArmPlatformSecInitialize ( - IN UINTN MpId - ); - -/** - Call before jumping to Normal World - - This function allows the firmware platform to do extra actions before - jumping to the Normal World - -**/ -VOID -ArmPlatformSecExtraAction ( - IN UINTN MpId, - OUT UINTN* JumpAddress - ); - -/** - Initialize the Secure peripherals and memory regions - - If Trustzone is supported by your platform then this function makes the required initialization - of the secure peripherals and memory regions. - -**/ -VOID -ArmPlatformSecTrustzoneInit ( - IN UINTN MpId - ); - -#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h deleted file mode 100644 index 39a0cc7f7..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmPlatformSysConfigLib.h +++ /dev/null @@ -1,63 +0,0 @@ -/** @file ArmPlatformSysConfigLib.h - - Copyright (c) 2011-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. - -**/ - -#ifndef __ARM_PLATFORM_SYS_CONFIG_H__ -#define __ARM_PLATFORM_SYS_CONFIG_H__ - -#include - -/* This header file makes it easier to access the System Configuration Registers - * in the ARM Versatile Express motherboard. - */ - -// -// Typedef -// -typedef UINT32 SYS_CONFIG_FUNCTION; - -// -// Functions -// -RETURN_STATUS -ArmPlatformSysConfigInitialize ( - VOID - ); - -RETURN_STATUS -ArmPlatformSysConfigGet ( - IN SYS_CONFIG_FUNCTION Function, - OUT UINT32* Value - ); - -RETURN_STATUS -ArmPlatformSysConfigGetValues ( - IN SYS_CONFIG_FUNCTION Function, - IN UINTN Size, - OUT UINT32* Values - ); - -RETURN_STATUS -ArmPlatformSysConfigSet ( - IN SYS_CONFIG_FUNCTION Function, - IN UINT32 Value - ); - -RETURN_STATUS -ArmPlatformSysConfigSetDevice ( - IN SYS_CONFIG_FUNCTION Function, - IN UINT32 Device, - IN UINT32 Value - ); - -#endif /* __SYS_CFG_REGISTERS_H__ */ diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h deleted file mode 100644 index 5368697c5..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/ArmTrustedMonitorLib.h +++ /dev/null @@ -1,24 +0,0 @@ -/** @file -* Main file supporting the Monitor World on ARM PLatforms -* -* Copyright (c) 2011, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef __ARM_TRUSTED_MONITOR_LIB_H_ -#define __ARM_TRUSTED_MONITOR_LIB_H_ - -VOID -ArmSecureMonitorWorldInitialize ( - VOID - ); - -#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h deleted file mode 100644 index b9bdf471e..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/LcdPlatformLib.h +++ /dev/null @@ -1,221 +0,0 @@ -/** @file - - Copyright (c) 2011, ARM Ltd. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ - -#ifndef __LCDPLATFORMLIB_H -#define __LCDPLATFORMLIB_H - -#include - -#define LCD_VRAM_SIZE SIZE_8MB - -// -// Modes definitions -// -#define VGA 0 -#define SVGA 1 -#define XGA 2 -#define SXGA 3 -#define WSXGA 4 -#define UXGA 5 -#define HD 6 - -// -// VGA Mode: 640 x 480 -// -#define VGA_H_RES_PIXELS 640 -#define VGA_V_RES_PIXELS 480 -#define VGA_OSC_FREQUENCY 23750000 /* 0x016A6570 */ - -#define VGA_H_SYNC ( 80 - 1) -#define VGA_H_FRONT_PORCH ( 16 - 1) -#define VGA_H_BACK_PORCH ( 64 - 1) - -#define VGA_V_SYNC ( 4 - 1) -#define VGA_V_FRONT_PORCH ( 3 - 1) -#define VGA_V_BACK_PORCH ( 13 - 1) - -// -// SVGA Mode: 800 x 600 -// -#define SVGA_H_RES_PIXELS 800 -#define SVGA_V_RES_PIXELS 600 -#define SVGA_OSC_FREQUENCY 38250000 /* 0x0247A610 */ - -#define SVGA_H_SYNC ( 80 - 1) -#define SVGA_H_FRONT_PORCH ( 32 - 1) -#define SVGA_H_BACK_PORCH (112 - 1) - -#define SVGA_V_SYNC ( 4 - 1) -#define SVGA_V_FRONT_PORCH ( 3 - 1) -#define SVGA_V_BACK_PORCH ( 17 - 1) - -// -// XGA Mode: 1024 x 768 -// -#define XGA_H_RES_PIXELS 1024 -#define XGA_V_RES_PIXELS 768 -#define XGA_OSC_FREQUENCY 63500000 /* 0x03C8EEE0 */ - -#define XGA_H_SYNC (104 - 1) -#define XGA_H_FRONT_PORCH ( 48 - 1) -#define XGA_H_BACK_PORCH (152 - 1) - -#define XGA_V_SYNC ( 4 - 1) -#define XGA_V_FRONT_PORCH ( 3 - 1) -#define XGA_V_BACK_PORCH ( 23 - 1) - -// -// SXGA Mode: 1280 x 1024 -// -#define SXGA_H_RES_PIXELS 1280 -#define SXGA_V_RES_PIXELS 1024 -#define SXGA_OSC_FREQUENCY 109000000 /* 0x067F3540 */ - -#define SXGA_H_SYNC (136 - 1) -#define SXGA_H_FRONT_PORCH ( 80 - 1) -#define SXGA_H_BACK_PORCH (216 - 1) - -#define SXGA_V_SYNC ( 7 - 1) -#define SXGA_V_FRONT_PORCH ( 3 - 1) -#define SXGA_V_BACK_PORCH ( 29 - 1) - -// -// WSXGA+ Mode: 1680 x 1050 -// -#define WSXGA_H_RES_PIXELS 1680 -#define WSXGA_V_RES_PIXELS 1050 -#define WSXGA_OSC_FREQUENCY 147000000 /* 0x08C30AC0 */ - -#define WSXGA_H_SYNC (170 - 1) -#define WSXGA_H_FRONT_PORCH (104 - 1) -#define WSXGA_H_BACK_PORCH (274 - 1) - -#define WSXGA_V_SYNC ( 5 - 1) -#define WSXGA_V_FRONT_PORCH ( 4 - 1) -#define WSXGA_V_BACK_PORCH ( 41 - 1) - -// -// UXGA Mode: 1600 x 1200 -// -#define UXGA_H_RES_PIXELS 1600 -#define UXGA_V_RES_PIXELS 1200 -#define UXGA_OSC_FREQUENCY 161000000 /* 0x0998AA40 */ - -#define UXGA_H_SYNC (168 - 1) -#define UXGA_H_FRONT_PORCH (112 - 1) -#define UXGA_H_BACK_PORCH (280 - 1) - -#define UXGA_V_SYNC ( 4 - 1) -#define UXGA_V_FRONT_PORCH ( 3 - 1) -#define UXGA_V_BACK_PORCH ( 38 - 1) - -// -// HD Mode: 1920 x 1080 -// -#define HD_H_RES_PIXELS 1920 -#define HD_V_RES_PIXELS 1080 -#define HD_OSC_FREQUENCY 165000000 /* 0x09D5B340 */ - -#define HD_H_SYNC ( 79 - 1) -#define HD_H_FRONT_PORCH (128 - 1) -#define HD_H_BACK_PORCH (328 - 1) - -#define HD_V_SYNC ( 5 - 1) -#define HD_V_FRONT_PORCH ( 3 - 1) -#define HD_V_BACK_PORCH ( 32 - 1) - -// -// Colour Masks -// - -#define LCD_24BPP_RED_MASK 0x00FF0000 -#define LCD_24BPP_GREEN_MASK 0x0000FF00 -#define LCD_24BPP_BLUE_MASK 0x000000FF -#define LCD_24BPP_RESERVED_MASK 0xFF000000 - -#define LCD_16BPP_555_RED_MASK 0x00007C00 -#define LCD_16BPP_555_GREEN_MASK 0x000003E0 -#define LCD_16BPP_555_BLUE_MASK 0x0000001F -#define LCD_16BPP_555_RESERVED_MASK 0x00000000 - -#define LCD_16BPP_565_RED_MASK 0x0000F800 -#define LCD_16BPP_565_GREEN_MASK 0x000007E0 -#define LCD_16BPP_565_BLUE_MASK 0x0000001F -#define LCD_16BPP_565_RESERVED_MASK 0x00008000 - -#define LCD_12BPP_444_RED_MASK 0x00000F00 -#define LCD_12BPP_444_GREEN_MASK 0x000000F0 -#define LCD_12BPP_444_BLUE_MASK 0x0000000F -#define LCD_12BPP_444_RESERVED_MASK 0x0000F000 - - -// The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control Register -typedef enum { - LCD_BITS_PER_PIXEL_1 = 0, - LCD_BITS_PER_PIXEL_2, - LCD_BITS_PER_PIXEL_4, - LCD_BITS_PER_PIXEL_8, - LCD_BITS_PER_PIXEL_16_555, - LCD_BITS_PER_PIXEL_24, - LCD_BITS_PER_PIXEL_16_565, - LCD_BITS_PER_PIXEL_12_444 -} LCD_BPP; - - -EFI_STATUS -LcdPlatformInitializeDisplay ( - IN EFI_HANDLE Handle - ); - -EFI_STATUS -LcdPlatformGetVram ( - OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress, - OUT UINTN* VramSize - ); - -UINT32 -LcdPlatformGetMaxMode ( - VOID - ); - -EFI_STATUS -LcdPlatformSetMode ( - IN UINT32 ModeNumber - ); - -EFI_STATUS -LcdPlatformQueryMode ( - IN UINT32 ModeNumber, - OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info - ); - -EFI_STATUS -LcdPlatformGetTimings ( - IN UINT32 ModeNumber, - OUT UINT32* HRes, - OUT UINT32* HSync, - OUT UINT32* HBackPorch, - OUT UINT32* HFrontPorch, - OUT UINT32* VRes, - OUT UINT32* VSync, - OUT UINT32* VBackPorch, - OUT UINT32* VFrontPorch - ); - -EFI_STATUS -LcdPlatformGetBpp ( - IN UINT32 ModeNumber, - OUT LCD_BPP* Bpp - ); - -#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h deleted file mode 100644 index e9e1c0607..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Platform/NorFlashPlatformLib.h +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - - Copyright (c) 2011-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. - - **/ - -#ifndef _NORFLASHPLATFORMLIB_H_ -#define _NORFLASHPLATFORMLIB_H_ - -typedef struct { - UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA) - UINTN RegionBaseAddress; // Start address of one single region - UINTN Size; - UINTN BlockSize; - EFI_GUID Guid; -} NOR_FLASH_DESCRIPTION; - -EFI_STATUS -NorFlashPlatformInitialization ( - VOID - ); - -EFI_STATUS -NorFlashPlatformGetDevices ( - OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions, - OUT UINT32 *Count - ); - -#endif /* _NORFLASHPLATFORMLIB_H_ */ -- cgit v1.2.3 From f6bd67f34705dbb0459a719c57923e4239ec86b8 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 22:52:17 +0530 Subject: BeagleBoneBlackPkg: Correct Timer Period Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 1edf38d38..00b8729d0 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -301,8 +301,8 @@ # DMTIMER0 # - gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|3125 - gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|32000 + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|4000 + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|25000 # # ARM Pcds -- cgit v1.2.3 From 9fdf58247a1e28fcb6863e7d5dd1f8bf1f339d1a Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Thu, 14 Aug 2014 23:11:06 +0530 Subject: BeagleBoneBlackPkg: Use Unique GUIDs Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 2 +- TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf | 2 +- .../Drivers/InterruptDxe/InterruptDxe.inf | 2 +- .../Drivers/MmcHostDxe/MmcHostDxe.inf | 2 +- .../Drivers/TimerDxe/TimerDxe.inf | 2 +- .../Library/Am335xLib/ArmPlatformLibNull.inf | 98 +++++++++++----------- .../Library/Am335xLib/ArmPlatformLibNullSec.inf | 88 +++++++++---------- .../Library/Am335xTimerLib/Am335xTimerLib.inf | 2 +- .../Library/SerialPortLib/SerialPortLib.inf | 84 +++++++++---------- 9 files changed, 141 insertions(+), 141 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc index 00b8729d0..12434c5df 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc @@ -21,7 +21,7 @@ PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010016 OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) - SUPPORTED_ARCHITECTURES = ARM|AARCH64 + SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf index 093559c7c..a1e26438b 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf @@ -18,7 +18,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = BeagleBoardBds - FILE_GUID = 934431fe-5745-402e-913d-17b4434eb0f3 + FILE_GUID = 3783e0e2-5880-4d83-953c-c1c3ebc62dd9 MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf index 2ed74575d..93b5fdb7b 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf @@ -16,7 +16,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = BeagleBoneBlackInterruptDxe - FILE_GUID = 23eed05d-1b93-4a1a-8e1b-931d69e37952 + FILE_GUID = 4b656e1b-62bc-445b-9d7a-5fbaf0359d65 MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf index 272a2d74f..9ef71ffd0 100755 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf @@ -12,7 +12,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = MMC - FILE_GUID = 100c2cfa-b586-4198-9b4c-1683d195b1da + FILE_GUID = ba16face-f583-475b-a0c6-77b234c62fd0 MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf index 9c01d4de1..a53c60d74 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf @@ -16,7 +16,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = BeagleBoneBlackTimerDxe - FILE_GUID = 6ddbf08b-cfc9-43cc-9e81-0784ba312ca0 + FILE_GUID = 9dc06c06-a5e0-4914-b7ea-71c8fdda6322 MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf index cba41f5b6..83fe96ef2 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf @@ -1,49 +1,49 @@ -#/* @file -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010016 - BASE_NAME = BeagleBoneBlackPlatformLib - FILE_GUID = 97dea43b-2728-493a-99e6-d5786dd2004f - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BeagleBoneBlackPlatformLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - EmbeddedPkg/EmbeddedPkg.dec - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - DebugLib - MemoryAllocationLib - -[Sources.common] - ArmPlatformLibNull.c - ArmPlatformLibNullMem.c - -[Sources.Arm] - ArmPlatformHelper.S | GCC - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdCacheEnable - -[FixedPcd] - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFdSize - - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize +#/* @file +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010016 + BASE_NAME = BeagleBoneBlackPlatformLib + FILE_GUID = 54b14ef4-10ef-4c4f-8b2f-f02672cdf758 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = BeagleBoneBlackPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + MemoryAllocationLib + +[Sources.common] + ArmPlatformLibNull.c + ArmPlatformLibNullMem.c + +[Sources.Arm] + ArmPlatformHelper.S | GCC + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf index 03ae72e0d..c9f31b1d7 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf @@ -1,44 +1,44 @@ -#/* @file -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmPlatformLibNull - FILE_GUID = cb494bad-23ff-427e-8608-d7e138d3363b - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - DebugLib - -[Sources.common] - ArmPlatformLibNull.c - -[Sources.Arm] - ArmPlatformHelper.S | GCC - ArmPlatformHelper.asm | RVCT - -[FixedPcd] - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore +#/* @file +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmPlatformLibNull + FILE_GUID = 9ce019cd-853b-4f28-a31f-96b31cdc09b3 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + +[Sources.common] + ArmPlatformLibNull.c + +[Sources.Arm] + ArmPlatformHelper.S | GCC + ArmPlatformHelper.asm | RVCT + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf index a68a5d71f..acc4116e9 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf @@ -16,7 +16,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = BeagleBoneBlackTimerLib - FILE_GUID = 6e19de87-4c42-4636-aa21-704f689054a2 + FILE_GUID = da70f01c-525a-42ca-9222-87250f4a4bf8 MODULE_TYPE = BASE VERSION_STRING = 1.0 LIBRARY_CLASS = TimerLib diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf index 26aebc3cc..314675389 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf @@ -1,42 +1,42 @@ -## @file -# SerialPortLib instance for 16550 UART -# -# Copyright (c) 2006 - 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 = SerialPortLib - FILE_GUID = 9E7C00CF-355A-4d4e-BF60-0428CFF95540 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = SerialPortLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - PcdLib - IoLib - #PlatformHookLib - -[Sources] - SerialPortLib.c - -[Pcd] - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl - #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl +## @file +# SerialPortLib instance for 16550 UART +# +# Copyright (c) 2006 - 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 = SerialPortLib + FILE_GUID = 4449c844-66ff-4359-ab6b-67714b4f84a0 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SerialPortLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + PcdLib + IoLib + #PlatformHookLib + +[Sources] + SerialPortLib.c + +[Pcd] + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl + #gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl -- cgit v1.2.3 From bc116c729ac0e1b45c745a3c4d1daa5c07f19683 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Fri, 15 Aug 2014 10:34:13 +0530 Subject: BeagleBoneBlackPkg: Rename ArmPlatform* to BeagleBoneBlack* Resolve dependencies. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/ArmPlatformPkg.dec | 25 -- .../BeagleBoneBlackPkg/ArmPlatformPkg.dsc | 398 --------------------- .../BeagleBoneBlackPkg/ArmPlatformPkg.fdf | 291 --------------- .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec | 25 ++ .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 398 +++++++++++++++++++++ .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf | 291 +++++++++++++++ .../Drivers/InterruptDxe/InterruptDxe.inf | 2 +- .../Drivers/MmcHostDxe/MmcHostDxe.inf | 2 +- .../BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c | 2 +- .../Drivers/TimerDxe/TimerDxe.inf | 2 +- .../Include/Library/ArmPlatformLib.h | 166 --------- .../Include/Library/BeagleBoneBlack.h | 166 +++++++++ .../Library/Am335xLib/Am335xHelper.S | 51 +++ .../Library/Am335xLib/Am335xLib.c | 72 ++++ .../Library/Am335xLib/Am335xLib.inf | 49 +++ .../Library/Am335xLib/Am335xLibMem.c | 82 +++++ .../Library/Am335xLib/ArmPlatformHelper.S | 51 --- .../Library/Am335xLib/ArmPlatformHelper.asm | 61 ---- .../Library/Am335xLib/ArmPlatformLibNull.c | 72 ---- .../Library/Am335xLib/ArmPlatformLibNull.inf | 49 --- .../Library/Am335xLib/ArmPlatformLibNullMem.c | 82 ----- .../Library/Am335xLib/ArmPlatformLibNullSec.inf | 44 --- .../Library/Am335xTimerLib/Am335xTimerLib.inf | 2 +- 23 files changed, 1139 insertions(+), 1244 deletions(-) delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/BeagleBoneBlack.h create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xHelper.S create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.c create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.inf create mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLibMem.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec deleted file mode 100644 index 2da4d9a20..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec +++ /dev/null @@ -1,25 +0,0 @@ -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = BeagleBoneBlackPkg - PACKAGE_GUID = 6eba6648-d853-4eb3-9761-528b82d5ab04 - PACKAGE_VERSION = 0.1 - -################################################################################ -# -# Include Section - list of Include Paths that are provided by this package. -# Comments are used for Keywords and Module Types. -# -# Supported Module Types: -# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION -# -################################################################################ - -[Includes] - Include # Root include for the package - -[Ppis] - -[Protocols] - -[Guids] - gBeagleBoneBlackTokenSpaceGuid = { 0x6834fe45, 0x4aee, 0x4fc6, { 0xbc, 0xb5, 0xff, 0x45, 0xb7, 0xa8, 0x71, 0xe2 } } \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc deleted file mode 100644 index 12434c5df..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dsc +++ /dev/null @@ -1,398 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -################################################################################ -# -# Defines Section - statements that will be processed to create a Makefile. -# -################################################################################ -[Defines] - PLATFORM_NAME = BeagleBoneBlack - PLATFORM_GUID = 613adb4b-ae3e-4797-9f29-719b833b82f4 - PLATFORM_VERSION = 0.1 - DSC_SPECIFICATION = 0x00010016 - OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) - SUPPORTED_ARCHITECTURES = ARM - BUILD_TARGETS = DEBUG|RELEASE - SKUID_IDENTIFIER = DEFAULT - FLASH_DEFINITION = TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf - -[LibraryClasses.common] - ArmPlatformLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf - -!if $(TARGET) == RELEASE - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf -!else - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf - UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf -# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf -!endif - DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf - PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf - PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf - CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf - - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf - UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf - - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - - # - # Assume everything is fixed at build - # - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - - # 1/123 faster than Stm or Vstm version - #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf - - # ARM Architectural Libraries - CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf - DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf - CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf - ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf - DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf - ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf - ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf - ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf - - SerialPortLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf - SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf - TimerLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf - EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf - RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf - - # Networking Requirements for ArmPlatformPkg/Bds - NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf - - # EBL Related Libraries - EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf - EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf - EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf - EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf - - # - # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window - # in the debugger will show load and unload commands for symbols. You can cut and paste this - # into the command window to load symbols. We should be able to use a script to do this, but - # the version of RVD I have does not support scripts accessing system memory. - # - #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf - PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf - #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf - - DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf - DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf - - SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf - - # BDS Libraries - BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf - FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf - - - -[LibraryClasses.ARM] - ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf - ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Lib.inf - -[LibraryClasses.AARCH64] - ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf - ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf - -[LibraryClasses.common.SEC] - ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf - - ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf - DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf - DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf - - PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf - ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf - LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf - MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf - HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf - PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf - PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf - PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf - MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf - ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf - -[LibraryClasses.common.DXE_CORE] - HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf - MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf - DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf - ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf - ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf - -[LibraryClasses.common.DXE_DRIVER] - ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf - PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf - -[LibraryClasses.common.UEFI_APPLICATION] - UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf - PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - -[LibraryClasses.common.UEFI_DRIVER] - ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf - UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf - ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf - PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - -[LibraryClasses.common.DXE_RUNTIME_DRIVER] - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf - CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf - -[LibraryClasses.ARM] - # - # It is not possible to prevent the ARM compiler for generic intrinsic functions. - # This library provides the instrinsic functions generate by a given compiler. - # [LibraryClasses.ARM] and NULL mean link this library into all ARM images. - # - NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf - -[BuildOptions] - XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7 - - GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a - - RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8 - -################################################################################ -# -# Pcd Section - list of all EDK II PCD Entries defined by this Platform -# -################################################################################ - -[PcdsFeatureFlag.common] - gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE - gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE - - # - # Control what commands are supported from the UI - # Turn these on and off to add features or save size - # - gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE - gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE - gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE - gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE - gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE - gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE - gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE - - gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE - - # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress - gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE - - gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE - - gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE - -[PcdsFixedAtBuild.common] - gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM BeagleBoneBlack" - - gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BeagleBoneBlack" - gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 - gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 - gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 - gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF - gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 - gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 - gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 - - # DEBUG_ASSERT_ENABLED 0x01 - # DEBUG_PRINT_ENABLED 0x02 - # DEBUG_CODE_ENABLED 0x04 - # CLEAR_MEMORY_ENABLED 0x08 - # ASSERT_BREAKPOINT_ENABLED 0x10 - # ASSERT_DEADLOOP_ENABLED 0x20 -!if $(TARGET) == RELEASE - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 -!else - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f -!endif - - # DEBUG_INIT 0x00000001 // Initialization - # DEBUG_WARN 0x00000002 // Warnings - # DEBUG_LOAD 0x00000004 // Load events - # DEBUG_FS 0x00000008 // EFI File system - # DEBUG_POOL 0x00000010 // Alloc & Free's - # DEBUG_PAGE 0x00000020 // Alloc & Free's - # DEBUG_INFO 0x00000040 // Verbose - # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers - # DEBUG_VARIABLE 0x00000100 // Variable - # DEBUG_BM 0x00000400 // Boot Manager - # DEBUG_BLKIO 0x00001000 // BlkIo Driver - # DEBUG_NET 0x00004000 // SNI Driver - # DEBUG_UNDI 0x00010000 // UNDI Driver - # DEBUG_LOADFILE 0x00020000 // UNDI Driver - # DEBUG_EVENT 0x00080000 // Event messages - # DEBUG_ERROR 0x80000000 // Error - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F - - gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 - - gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|"" - gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07 - gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000 - - # - # Optional feature to help prevent EFI memory map fragments - # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob - # Values are in EFI Pages (4K). DXE Core will make sure that - # at least this much of each type of memory can be allocated - # from a single memory range. This way you only end up with - # maximum of two fragements for each type in the memory map - # (the memory used, and the free memory that was prereserved - # but not used). - # - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 - - # - # DMTIMER0 - # - - gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|4000 - gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|25000 - - # - # ARM Pcds - # - gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000 - - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4030B800 - gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize|0x4 - - gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 - gArmTokenSpaceGuid.PcdSystemMemorySize|0x40000000 - - # Size of the region used by UEFI in permanent memory (Reserved 16MB) - gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x01000000 -################################################################################ -# -# Components Section - list of all EDK II Modules needed by this Platform -# -################################################################################ -[Components.common] - - # - # PEI Phase modules - # - ArmPlatformPkg/PrePi/PeiUniCore.inf - - # - # DXE - # - MdeModulePkg/Core/Dxe/DxeMain.inf { - - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf - } - - # - # Architectural Protocols - # - ArmPkg/Drivers/CpuDxe/CpuDxe.inf - - TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf - TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf - MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf - MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf - MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf - MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf - EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf - - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf - MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - } - EmbeddedPkg/SerialDxe/SerialDxe.inf - MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf - - MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf { - - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - } - - MdeModulePkg/Universal/PrintDxe/PrintDxe.inf - - EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf - EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf - EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf - - # Simple TextIn/TextOut for UEFI Terminal - EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf - - EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf - TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf - - # - # FAT filesystem + GPT/MBR partitioning - # - MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf - - # - # Application - # - EmbeddedPkg/Ebl/Ebl.inf - - # Bds - # - MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf deleted file mode 100644 index 3aa826eda..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.fdf +++ /dev/null @@ -1,291 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -################################################################################ -# -# FD Section -# The [FD] Section is made up of the definition statements and a -# description of what goes into the Flash Device Image. Each FD section -# defines one flash "device" image. A flash device image may be one of -# the following: Removable media bootable image (like a boot floppy -# image,) an Option ROM image (that would be "flashed" into an add-in -# card,) a System "Flash" image (that would be burned into a system's -# flash) or an Update ("Capsule") image that will be used to update and -# existing system flash. -# -################################################################################ - -[FD.BeagleBoneBlack_EFI] -BaseAddress = 0x80800000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash. -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device -ErasePolarity = 1 - -# This one is tricky, it must be: BlockSize * NumBlocks = Size -BlockSize = 0x00001000 -NumBlocks = 0x0200 - -################################################################################ -# -# Following are lists of FD Region layout which correspond to the locations of different -# images within the flash device. -# -# Regions must be defined in ascending order and may not overlap. -# -# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by -# the pipe "|" character, followed by the size of the region, also in hex with the leading -# "0x" characters. Like: -# Offset|Size -# PcdOffsetCName|PcdSizeCName -# RegionType -# -################################################################################ - -0x00000000|0x000F0000 -gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize -FV = FVMAIN_COMPACT - -################################################################################ -# -# FV Section -# -# [FV] section is used to define what components or modules are placed within a flash -# device file. This section also defines order the components and modules are positioned -# within the image. The [FV] section consists of define statements, set statements and -# module statements. -# -################################################################################ - -[FV.FvMain] -BlockSize = 0x1000 -NumBlocks = 0x200 # This FV gets compressed so make it just big enough -FvAlignment = 8 # FV alignment and FV attributes setting. -ERASE_POLARITY = 1 -MEMORY_MAPPED = TRUE -STICKY_WRITE = TRUE -LOCK_CAP = TRUE -LOCK_STATUS = TRUE -WRITE_DISABLED_CAP = TRUE -WRITE_ENABLED_CAP = TRUE -WRITE_STATUS = TRUE -WRITE_LOCK_CAP = TRUE -WRITE_LOCK_STATUS = TRUE -READ_DISABLED_CAP = TRUE -READ_ENABLED_CAP = TRUE -READ_STATUS = TRUE -READ_LOCK_CAP = TRUE -READ_LOCK_STATUS = TRUE - - INF MdeModulePkg/Core/Dxe/DxeMain.inf - - # - # PI DXE Drivers producing Architectural Protocols (EFI Services) - # - INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf - - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf - INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf - INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf - INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf - INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf - INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf - - INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf - INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf - INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf - INF EmbeddedPkg/SerialDxe/SerialDxe.inf - INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf - - INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf - INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf - INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf - - INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf - INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf - - # Simple TextIn/TextOut for UEFI Terminal - INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf - - # - # MMC/SD - # - INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf - - # - # FAT filesystem + GPT/MBR partitioning - # - INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - INF FatBinPkg/EnhancedFatDxe/Fat.inf - INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf - - # - # UEFI application (Shell Embedded Boot Loader) - # - INF EmbeddedPkg/Ebl/Ebl.inf - INF ShellBinPkg/UefiShell/UefiShell.inf - - # - # Bds - # - INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf - -[FV.FVMAIN_COMPACT] -FvAlignment = 8 -ERASE_POLARITY = 1 -MEMORY_MAPPED = TRUE -STICKY_WRITE = TRUE -LOCK_CAP = TRUE -LOCK_STATUS = TRUE -WRITE_DISABLED_CAP = TRUE -WRITE_ENABLED_CAP = TRUE -WRITE_STATUS = TRUE -WRITE_LOCK_CAP = TRUE -WRITE_LOCK_STATUS = TRUE -READ_DISABLED_CAP = TRUE -READ_ENABLED_CAP = TRUE -READ_STATUS = TRUE -READ_LOCK_CAP = TRUE -READ_LOCK_STATUS = TRUE - - INF ArmPlatformPkg/PrePi/PeiUniCore.inf - - FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { - SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { - SECTION FV_IMAGE = FVMAIN - } - } - - -################################################################################ -# -# Rules are use with the [FV] section's module INF type to define -# how an FFS file is created for a given INF file. The following Rule are the default -# rules for the different module type. User can add the customized rules to define the -# content of the FFS file. -# -################################################################################ - - -############################################################################ -# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section # -############################################################################ -# -#[Rule.Common.DXE_DRIVER] -# FILE DRIVER = $(NAMED_GUID) { -# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex -# COMPRESS PI_STD { -# GUIDED { -# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi -# UI STRING="$(MODULE_NAME)" Optional -# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) -# } -# } -# } -# -############################################################################ - -[Rule.Common.SEC] - FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED { - TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi - } - -[Rule.Common.SEC.BINARY] - FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED { - TE TE Align = 32 |.efi - } - -[Rule.Common.PEI_CORE] - FILE PEI_CORE = $(NAMED_GUID) { - TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING ="$(MODULE_NAME)" Optional - } - -[Rule.Common.PEIM] - FILE PEIM = $(NAMED_GUID) { - PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex - TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING="$(MODULE_NAME)" Optional - } - -[Rule.Common.PEIM.TIANOCOMPRESSED] - FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 { - PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex - GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE { - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING="$(MODULE_NAME)" Optional - } - } - -[Rule.Common.DXE_CORE] - FILE DXE_CORE = $(NAMED_GUID) { - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING="$(MODULE_NAME)" Optional - } - -[Rule.Common.UEFI_DRIVER] - FILE DRIVER = $(NAMED_GUID) { - DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING="$(MODULE_NAME)" Optional - } - -[Rule.Common.UEFI_DRIVER.BINARY] - FILE DRIVER = $(NAMED_GUID) { - DXE_DEPEX DXE_DEPEX Optional |.depex - PE32 PE32 |.efi - UI STRING="$(MODULE_NAME)" Optional - } - -[Rule.Common.DXE_DRIVER] - FILE DRIVER = $(NAMED_GUID) { - DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING="$(MODULE_NAME)" Optional - } -[Rule.Common.DXE_DRIVER.BINARY] - FILE DRIVER = $(NAMED_GUID) { - DXE_DEPEX DXE_DEPEX Optional |.depex - PE32 PE32 |.efi - UI STRING="$(MODULE_NAME)" Optional - } - -[Rule.Common.DXE_RUNTIME_DRIVER] - FILE DRIVER = $(NAMED_GUID) { - DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi - UI STRING="$(MODULE_NAME)" Optional - } - -[Rule.Common.UEFI_APPLICATION] - FILE APPLICATION = $(NAMED_GUID) { - UI STRING ="$(MODULE_NAME)" Optional - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi - } - -[Rule.Common.UEFI_DRIVER.BINARY] - FILE DRIVER = $(NAMED_GUID) { - DXE_DEPEX DXE_DEPEX Optional |.depex - PE32 PE32 |.efi - UI STRING="$(MODULE_NAME)" Optional - VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) - } - -[Rule.Common.UEFI_APPLICATION.BINARY] - FILE APPLICATION = $(NAMED_GUID) { - PE32 PE32 |.efi - UI STRING="$(MODULE_NAME)" Optional - VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) - } diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec new file mode 100644 index 000000000..2da4d9a20 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec @@ -0,0 +1,25 @@ +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = BeagleBoneBlackPkg + PACKAGE_GUID = 6eba6648-d853-4eb3-9761-528b82d5ab04 + PACKAGE_VERSION = 0.1 + +################################################################################ +# +# Include Section - list of Include Paths that are provided by this package. +# Comments are used for Keywords and Module Types. +# +# Supported Module Types: +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION +# +################################################################################ + +[Includes] + Include # Root include for the package + +[Ppis] + +[Protocols] + +[Guids] + gBeagleBoneBlackTokenSpaceGuid = { 0x6834fe45, 0x4aee, 0x4fc6, { 0xbc, 0xb5, 0xff, 0x45, 0xb7, 0xa8, 0x71, 0xe2 } } \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc new file mode 100644 index 000000000..5f0c78a63 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -0,0 +1,398 @@ +# +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + PLATFORM_NAME = BeagleBoneBlack + PLATFORM_GUID = 613adb4b-ae3e-4797-9f29-719b833b82f4 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010016 + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES = ARM + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf + +[LibraryClasses.common] + ArmPlatformLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.inf + +!if $(TARGET) == RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf +# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf +!endif + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + + # + # Assume everything is fixed at build + # + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + + # 1/123 faster than Stm or Vstm version + #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf + + # ARM Architectural Libraries + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf + CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf + DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + + SerialPortLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.inf + SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf + TimerLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf + EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf + RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf + + # Networking Requirements for ArmPlatformPkg/Bds + NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf + + # EBL Related Libraries + EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf + EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf + EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf + EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf + + # + # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window + # in the debugger will show load and unload commands for symbols. You can cut and paste this + # into the command window to load symbols. We should be able to use a script to do this, but + # the version of RVD I have does not support scripts accessing system memory. + # + #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf + #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf + + SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf + + # BDS Libraries + BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + + + +[LibraryClasses.ARM] + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf + ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA9Lib/ArmCortexA9Lib.inf + +[LibraryClasses.AARCH64] + ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf + ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf + +[LibraryClasses.common.SEC] + ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf + + ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf + DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf + + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + +[LibraryClasses.ARM] + # + # It is not possible to prevent the ARM compiler for generic intrinsic functions. + # This library provides the instrinsic functions generate by a given compiler. + # [LibraryClasses.ARM] and NULL mean link this library into all ARM images. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + +[BuildOptions] + XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7 + + GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a + + RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8 + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsFeatureFlag.common] + gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE + + # + # Control what commands are supported from the UI + # Turn these on and off to add features or save size + # + gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE + gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE + + gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE + + # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + +[PcdsFixedAtBuild.common] + gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM BeagleBoneBlack" + + gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BeagleBoneBlack" + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + + # DEBUG_ASSERT_ENABLED 0x01 + # DEBUG_PRINT_ENABLED 0x02 + # DEBUG_CODE_ENABLED 0x04 + # CLEAR_MEMORY_ENABLED 0x08 + # ASSERT_BREAKPOINT_ENABLED 0x10 + # ASSERT_DEADLOOP_ENABLED 0x20 +!if $(TARGET) == RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f +!endif + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free's + # DEBUG_PAGE 0x00000020 // Alloc & Free's + # DEBUG_INFO 0x00000040 // Verbose + # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNI Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // UNDI Driver + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|"" + gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07 + gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragements for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + # + # DMTIMER0 + # + + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|4000 + gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|25000 + + # + # ARM Pcds + # + gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000 + + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4030B800 + gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize|0x4 + + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 + gArmTokenSpaceGuid.PcdSystemMemorySize|0x40000000 + + # Size of the region used by UEFI in permanent memory (Reserved 16MB) + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x01000000 +################################################################################ +# +# Components Section - list of all EDK II Modules needed by this Platform +# +################################################################################ +[Components.common] + + # + # PEI Phase modules + # + ArmPlatformPkg/PrePi/PeiUniCore.inf + + # + # DXE + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + + TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf + TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } + EmbeddedPkg/SerialDxe/SerialDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf { + + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + MdeModulePkg/Universal/PrintDxe/PrintDxe.inf + + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + # Simple TextIn/TextOut for UEFI Terminal + EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf + TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + + # + # Application + # + EmbeddedPkg/Ebl/Ebl.inf + + # Bds + # + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf new file mode 100644 index 000000000..3aa826eda --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf @@ -0,0 +1,291 @@ +# +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +################################################################################ +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +################################################################################ + +[FD.BeagleBoneBlack_EFI] +BaseAddress = 0x80800000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash. +Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device +ErasePolarity = 1 + +# This one is tricky, it must be: BlockSize * NumBlocks = Size +BlockSize = 0x00001000 +NumBlocks = 0x0200 + +################################################################################ +# +# Following are lists of FD Region layout which correspond to the locations of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by +# the pipe "|" character, followed by the size of the region, also in hex with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType +# +################################################################################ + +0x00000000|0x000F0000 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV = FVMAIN_COMPACT + +################################################################################ +# +# FV Section +# +# [FV] section is used to define what components or modules are placed within a flash +# device file. This section also defines order the components and modules are positioned +# within the image. The [FV] section consists of define statements, set statements and +# module statements. +# +################################################################################ + +[FV.FvMain] +BlockSize = 0x1000 +NumBlocks = 0x200 # This FV gets compressed so make it just big enough +FvAlignment = 8 # FV alignment and FV attributes setting. +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + + INF MdeModulePkg/Core/Dxe/DxeMain.inf + + # + # PI DXE Drivers producing Architectural Protocols (EFI Services) + # + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + INF EmbeddedPkg/SerialDxe/SerialDxe.inf + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf + + # Simple TextIn/TextOut for UEFI Terminal + INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # MMC/SD + # + INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatBinPkg/EnhancedFatDxe/Fat.inf + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + + # + # UEFI application (Shell Embedded Boot Loader) + # + INF EmbeddedPkg/Ebl/Ebl.inf + INF ShellBinPkg/UefiShell/UefiShell.inf + + # + # Bds + # + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf + +[FV.FVMAIN_COMPACT] +FvAlignment = 8 +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + + INF ArmPlatformPkg/PrePi/PeiUniCore.inf + + FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { + SECTION FV_IMAGE = FVMAIN + } + } + + +################################################################################ +# +# Rules are use with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are the default +# rules for the different module type. User can add the customized rules to define the +# content of the FFS file. +# +################################################################################ + + +############################################################################ +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section # +############################################################################ +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER = $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING="$(MODULE_NAME)" Optional +# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) +# } +# } +# } +# +############################################################################ + +[Rule.Common.SEC] + FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED { + TE TE Align = 32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.SEC.BINARY] + FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED { + TE TE Align = 32 |.efi + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE = $(NAMED_GUID) { + TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING ="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM] + FILE PEIM = $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.TIANOCOMPRESSED] + FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE = $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } +[Rule.Common.DXE_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION = $(NAMED_GUID) { + UI STRING ="$(MODULE_NAME)" Optional + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION = $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf index 93b5fdb7b..353a92239 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/InterruptDxe.inf @@ -29,7 +29,7 @@ [Packages] ArmPkg/ArmPkg.dec - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec MdePkg/MdePkg.dec EmbeddedPkg/EmbeddedPkg.dec diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf index 9ef71ffd0..fdaf61f67 100755 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.inf @@ -25,7 +25,7 @@ [Packages] MdePkg/MdePkg.dec EmbeddedPkg/EmbeddedPkg.dec - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec [LibraryClasses] PcdLib diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c index c9476b3ac..38d0c5a83 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf index a53c60d74..ba41c46cb 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf @@ -26,7 +26,7 @@ Timer.c [Packages] - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec MdePkg/MdePkg.dec EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h deleted file mode 100644 index dabac3d32..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/ArmPlatformLib.h +++ /dev/null @@ -1,166 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef _ARMPLATFORMLIB_H_ -#define _ARMPLATFORMLIB_H_ - -// DDR attributes -#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK -#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED - -// SoC registers. L3 interconnects -#define SOC_REGISTERS_L3_PHYSICAL_BASE 0x00000000 -#define SOC_REGISTERS_L3_PHYSICAL_LENGTH 0x47FFFFFF -#define SOC_REGISTERS_L3_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE - -// SoC registers. L4 interconnects -#define SOC_REGISTERS_L4_PHYSICAL_BASE 0x48000000 -#define SOC_REGISTERS_L4_PHYSICAL_LENGTH 0x00FFFFFF -#define SOC_REGISTERS_L4_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE -// -// The package level header files this module uses -// -#include -// -// The protocols, PPI and GUID defintions for this module -// -#include -#include - -#include - -/** - This structure is used to describe a region of the EFI memory map - - Every EFI regions of the system memory described by their physical start address and their size - can have different attributes. Some regions can be tested and other untested. - -**/ -typedef struct { - EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; - EFI_PHYSICAL_ADDRESS PhysicalStart; - UINT64 NumberOfBytes; -} ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; - -/** - Return the core position from the value of its MpId register - - This function returns the core position from the position 0 in the processor. - This function might be called from assembler before any stack is set. - - @return Return the core position - -**/ -UINTN -ArmPlatformGetCorePosition ( - IN UINTN MpId - ); - -/** - Return a non-zero value if the callee is the primary core - - This function returns a non-zero value if the callee is the primary core. - The primary core is the core responsible to initialize the hardware and run UEFI. - This function might be called from assembler before any stack is set. - - @return Return a non-zero value if the callee is the primary core. - -**/ -UINTN -ArmPlatformIsPrimaryCore ( - IN UINTN MpId - ); - -/** - Return the MpId of the primary core - - This function returns the MpId of the primary core. - This function might be called from assembler before any stack is set. - - @return Return the MpId of the primary core - -**/ -UINTN -ArmPlatformGetPrimaryCoreMpId ( - VOID - ); - -/** - Return the current Boot Mode - - This function returns the boot reason on the platform - - @return Return the current Boot Mode of the platform - -**/ -EFI_BOOT_MODE -ArmPlatformGetBootMode ( - VOID - ); - -/** - Initialize controllers that must setup in the normal world - - This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei - in the PEI phase. - -**/ -RETURN_STATUS -ArmPlatformInitialize ( - IN UINTN MpId - ); - -/** - Initialize the system (or sometimes called permanent) memory - - This memory is generally represented by the DRAM. - -**/ -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ); - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. - - @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- - Virtual Memory mapping. This array must be ended by a zero-filled - entry - -**/ -VOID -ArmPlatformGetVirtualMemoryMap ( - OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap - ); - -/** - Return the Platform specific PPIs - - This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed - to the PeiCore by PrePeiCore. - - @param[out] PpiListSize Size in Bytes of the Platform PPI List - @param[out] PpiList Platform PPI List - -**/ -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ); - -#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/BeagleBoneBlack.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/BeagleBoneBlack.h new file mode 100644 index 000000000..dabac3d32 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/BeagleBoneBlack.h @@ -0,0 +1,166 @@ +/** @file +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _ARMPLATFORMLIB_H_ +#define _ARMPLATFORMLIB_H_ + +// DDR attributes +#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK +#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED + +// SoC registers. L3 interconnects +#define SOC_REGISTERS_L3_PHYSICAL_BASE 0x00000000 +#define SOC_REGISTERS_L3_PHYSICAL_LENGTH 0x47FFFFFF +#define SOC_REGISTERS_L3_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE + +// SoC registers. L4 interconnects +#define SOC_REGISTERS_L4_PHYSICAL_BASE 0x48000000 +#define SOC_REGISTERS_L4_PHYSICAL_LENGTH 0x00FFFFFF +#define SOC_REGISTERS_L4_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE +// +// The package level header files this module uses +// +#include +// +// The protocols, PPI and GUID defintions for this module +// +#include +#include + +#include + +/** + This structure is used to describe a region of the EFI memory map + + Every EFI regions of the system memory described by their physical start address and their size + can have different attributes. Some regions can be tested and other untested. + +**/ +typedef struct { + EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; + EFI_PHYSICAL_ADDRESS PhysicalStart; + UINT64 NumberOfBytes; +} ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; + +/** + Return the core position from the value of its MpId register + + This function returns the core position from the position 0 in the processor. + This function might be called from assembler before any stack is set. + + @return Return the core position + +**/ +UINTN +ArmPlatformGetCorePosition ( + IN UINTN MpId + ); + +/** + Return a non-zero value if the callee is the primary core + + This function returns a non-zero value if the callee is the primary core. + The primary core is the core responsible to initialize the hardware and run UEFI. + This function might be called from assembler before any stack is set. + + @return Return a non-zero value if the callee is the primary core. + +**/ +UINTN +ArmPlatformIsPrimaryCore ( + IN UINTN MpId + ); + +/** + Return the MpId of the primary core + + This function returns the MpId of the primary core. + This function might be called from assembler before any stack is set. + + @return Return the MpId of the primary core + +**/ +UINTN +ArmPlatformGetPrimaryCoreMpId ( + VOID + ); + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + + @return Return the current Boot Mode of the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ); + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei + in the PEI phase. + +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ); + +/** + Initialize the system (or sometimes called permanent) memory + + This memory is generally represented by the DRAM. + +**/ +VOID +ArmPlatformInitializeSystemMemory ( + VOID + ); + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- + Virtual Memory mapping. This array must be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ); + +/** + Return the Platform specific PPIs + + This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed + to the PeiCore by PrePeiCore. + + @param[out] PpiListSize Size in Bytes of the Platform PPI List + @param[out] PpiList Platform PPI List + +**/ +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ); + +#endif diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xHelper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xHelper.S new file mode 100644 index 000000000..c32ea77f2 --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xHelper.S @@ -0,0 +1,51 @@ +// +// Copyright (c) 2012-2013, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include + +.text +.align 2 + +GCC_ASM_EXPORT(ArmPlatformPeiBootAction) +GCC_ASM_EXPORT(ArmPlatformGetCorePosition) +GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) +GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) + +ASM_PFX(ArmPlatformPeiBootAction): + bx lr + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +ASM_PFX(ArmPlatformGetCorePosition): + // single core, return 1 + mov r0, #1 + bx lr + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_PFX(ArmPlatformGetPrimaryCoreMpId): + // return MPIDR of calling CPU + b ArmReadMpidr + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_PFX(ArmPlatformIsPrimaryCore): + mov r0, #1 + bx lr diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.c new file mode 100644 index 000000000..3cd3a2eca --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.c @@ -0,0 +1,72 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei + in the PEI phase. + +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + //TODO: Implement me + + return RETURN_SUCCESS; +} + +/** + Initialize the system (or sometimes called permanent) memory + + This memory is generally represented by the DRAM. + +**/ +VOID +ArmPlatformInitializeSystemMemory ( + VOID + ) +{ + //TODO: Implement me +} + +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + *PpiListSize = 0; + *PpiList = NULL; +} + diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.inf new file mode 100644 index 000000000..66b316e5b --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.inf @@ -0,0 +1,49 @@ +#/* @file +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x00010016 + BASE_NAME = Am335xLib + FILE_GUID = 54b14ef4-10ef-4c4f-8b2f-f02672cdf758 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = Am335xLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + MemoryAllocationLib + +[Sources.common] + Am335xLib.c + Am335xLibMem.c + +[Sources.Arm] + Am335xHelper.S | GCC + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLibMem.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLibMem.c new file mode 100644 index 000000000..82285a78e --- /dev/null +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLibMem.c @@ -0,0 +1,82 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include +#include + +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 4 + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- + Virtual Memory mapping. This array must be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; + UINTN Index = 0; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + + ASSERT(VirtualMemoryMap != NULL); + + VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + + if (VirtualMemoryTable == NULL) { + return; + } + + if (FeaturePcdGet(PcdCacheEnable) == TRUE) { + CacheAttributes = DDR_ATTRIBUTES_CACHED; + } else { + CacheAttributes = DDR_ATTRIBUTES_UNCACHED; + } + + // ReMap (Either NOR Flash or DRAM) + VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdSystemMemorySize); + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // SOC Registers. L3 interconnects + VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE; + VirtualMemoryTable[Index].VirtualBase = SOC_REGISTERS_L3_PHYSICAL_BASE; + VirtualMemoryTable[Index].Length = SOC_REGISTERS_L3_PHYSICAL_LENGTH; + VirtualMemoryTable[Index].Attributes = SOC_REGISTERS_L3_ATTRIBUTES; + + // SOC Registers. L4 interconnects + VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE; + VirtualMemoryTable[Index].VirtualBase = SOC_REGISTERS_L4_PHYSICAL_BASE; + VirtualMemoryTable[Index].Length = SOC_REGISTERS_L4_PHYSICAL_LENGTH; + VirtualMemoryTable[Index].Attributes = SOC_REGISTERS_L4_ATTRIBUTES; + + // End of Table + VirtualMemoryTable[++Index].PhysicalBase = 0; + VirtualMemoryTable[Index].VirtualBase = 0; + VirtualMemoryTable[Index].Length = 0; + VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; + + ASSERT((Index + 1) == MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap = VirtualMemoryTable; +} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S deleted file mode 100644 index c32ea77f2..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.S +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) 2012-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include - -.text -.align 2 - -GCC_ASM_EXPORT(ArmPlatformPeiBootAction) -GCC_ASM_EXPORT(ArmPlatformGetCorePosition) -GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) -GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) - -ASM_PFX(ArmPlatformPeiBootAction): - bx lr - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -ASM_PFX(ArmPlatformGetCorePosition): - // single core, return 1 - mov r0, #1 - bx lr - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_PFX(ArmPlatformGetPrimaryCoreMpId): - // return MPIDR of calling CPU - b ArmReadMpidr - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_PFX(ArmPlatformIsPrimaryCore): - mov r0, #1 - bx lr diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm deleted file mode 100644 index 68b6515e5..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformHelper.asm +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) 2012-2013, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include - - INCLUDE AsmMacroIoLib.inc - - EXPORT ArmPlatformPeiBootAction - EXPORT ArmPlatformGetCorePosition - EXPORT ArmPlatformGetPrimaryCoreMpId - EXPORT ArmPlatformIsPrimaryCore - - PRESERVE8 - AREA ArmPlatformNullHelper, CODE, READONLY - -ArmPlatformPeiBootAction FUNCTION - bx lr - ENDFUNC - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -ArmPlatformGetCorePosition FUNCTION - // single core, return 1 - mov r0, #1 - bx lr - ENDFUNC - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ArmPlatformGetPrimaryCoreMpId FUNCTION - // return MPIDR of the calling CPU - b ArmReadMpidr - ENDFUNC - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ArmPlatformIsPrimaryCore FUNCTION - // single core on BeagleBone Black SoC, return 1 - mov r0, #1 - bx lr - ENDFUNC - - END - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c deleted file mode 100644 index da8907676..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.c +++ /dev/null @@ -1,72 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2012, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include - -/** - Return the current Boot Mode - - This function returns the boot reason on the platform - -**/ -EFI_BOOT_MODE -ArmPlatformGetBootMode ( - VOID - ) -{ - return BOOT_WITH_FULL_CONFIGURATION; -} - -/** - Initialize controllers that must setup in the normal world - - This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei - in the PEI phase. - -**/ -RETURN_STATUS -ArmPlatformInitialize ( - IN UINTN MpId - ) -{ - //TODO: Implement me - - return RETURN_SUCCESS; -} - -/** - Initialize the system (or sometimes called permanent) memory - - This memory is generally represented by the DRAM. - -**/ -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ) -{ - //TODO: Implement me -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize = 0; - *PpiList = NULL; -} - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf deleted file mode 100644 index 83fe96ef2..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNull.inf +++ /dev/null @@ -1,49 +0,0 @@ -#/* @file -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010016 - BASE_NAME = BeagleBoneBlackPlatformLib - FILE_GUID = 54b14ef4-10ef-4c4f-8b2f-f02672cdf758 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BeagleBoneBlackPlatformLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - EmbeddedPkg/EmbeddedPkg.dec - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - DebugLib - MemoryAllocationLib - -[Sources.common] - ArmPlatformLibNull.c - ArmPlatformLibNullMem.c - -[Sources.Arm] - ArmPlatformHelper.S | GCC - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdCacheEnable - -[FixedPcd] - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFdSize - - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c deleted file mode 100644 index bc213acc2..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullMem.c +++ /dev/null @@ -1,82 +0,0 @@ -/** @file -* -* Copyright (c) 2011, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include -#include -#include - -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 4 - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. - - @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- - Virtual Memory mapping. This array must be ended by a zero-filled - entry - -**/ -VOID -ArmPlatformGetVirtualMemoryMap ( - IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap - ) -{ - ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; - UINTN Index = 0; - ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; - - ASSERT(VirtualMemoryMap != NULL); - - VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); - - if (VirtualMemoryTable == NULL) { - return; - } - - if (FeaturePcdGet(PcdCacheEnable) == TRUE) { - CacheAttributes = DDR_ATTRIBUTES_CACHED; - } else { - CacheAttributes = DDR_ATTRIBUTES_UNCACHED; - } - - // ReMap (Either NOR Flash or DRAM) - VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdSystemMemoryBase); - VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdSystemMemoryBase); - VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[Index].Attributes = CacheAttributes; - - // SOC Registers. L3 interconnects - VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE; - VirtualMemoryTable[Index].VirtualBase = SOC_REGISTERS_L3_PHYSICAL_BASE; - VirtualMemoryTable[Index].Length = SOC_REGISTERS_L3_PHYSICAL_LENGTH; - VirtualMemoryTable[Index].Attributes = SOC_REGISTERS_L3_ATTRIBUTES; - - // SOC Registers. L4 interconnects - VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE; - VirtualMemoryTable[Index].VirtualBase = SOC_REGISTERS_L4_PHYSICAL_BASE; - VirtualMemoryTable[Index].Length = SOC_REGISTERS_L4_PHYSICAL_LENGTH; - VirtualMemoryTable[Index].Attributes = SOC_REGISTERS_L4_ATTRIBUTES; - - // End of Table - VirtualMemoryTable[++Index].PhysicalBase = 0; - VirtualMemoryTable[Index].VirtualBase = 0; - VirtualMemoryTable[Index].Length = 0; - VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; - - ASSERT((Index + 1) == MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); - - *VirtualMemoryMap = VirtualMemoryTable; -} diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf deleted file mode 100644 index c9f31b1d7..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/ArmPlatformLibNullSec.inf +++ /dev/null @@ -1,44 +0,0 @@ -#/* @file -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmPlatformLibNull - FILE_GUID = 9ce019cd-853b-4f28-a31f-96b31cdc09b3 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - DebugLib - -[Sources.common] - ArmPlatformLibNull.c - -[Sources.Arm] - ArmPlatformHelper.S | GCC - ArmPlatformHelper.asm | RVCT - -[FixedPcd] - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf index acc4116e9..7a115ba0c 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xTimerLib/Am335xTimerLib.inf @@ -25,7 +25,7 @@ TimerLib.c [Packages] - TexasInstrumentsPkg/BeagleBoneBlackPkg/ArmPlatformPkg.dec + TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec MdePkg/MdePkg.dec EmbeddedPkg/EmbeddedPkg.dec -- cgit v1.2.3 From 7925167aacc7b5c7018652ca41899cada2dbe651 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Fri, 15 Aug 2014 11:09:19 +0530 Subject: BeagleBoneBlackPkg: Add Adaptation Notice Cite adapted drivers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c | 3 ++- TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c | 3 ++- TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c index 087c3c48d..37e003422 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/InterruptDxe/HardwareInterrupt.c @@ -1,5 +1,6 @@ /** @file - Handle AM335X interrupt controller + Handle AM335X interrupt controller. + Adapted from Omap35xxPkg/InterruptDxe. Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c index cd07491ba..86aba6f06 100755 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/MmcHostDxe/MmcHostDxe.c @@ -1,7 +1,8 @@ /** @file -* * Copyright (c) 2008 - 2009, Apple Inc. All rights reserved. * Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. +* +* Adapted from Omap35xxPkg/MmcHostDxe. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c index 38d0c5a83..1a24e2df6 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c @@ -1,5 +1,5 @@ /** @file - Template for Timer Architecture Protocol driver of the ARM flavor + Adapted from Omap35xxPkg/TimerDxe Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-- cgit v1.2.3 From 11441d9893f8f68f6b602f075686b3b365232bae Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 25 Sep 2014 19:49:45 +0100 Subject: Add stack protector library for BeagleBone Black Resolves build issues with gcc48. Signed-off-by: Leif Lindholm --- TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index 5f0c78a63..3a59beb68 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -188,6 +188,9 @@ # NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + # Add support for GCC stack protector + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + [BuildOptions] XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7 -- cgit v1.2.3 From e911b95881902cc8a4a391fc197cf6d66a44d4dc Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Wed, 22 Oct 2014 21:22:03 +0530 Subject: BeagleBoneBlackPkg: Fix Line Endings in DSC Use Windows-style CRLF line endings in BeagleBoneBlack.dsc. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index 3a59beb68..f36b3277e 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -188,9 +188,9 @@ # NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf - # Add support for GCC stack protector - NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf - + # Add support for GCC stack protector + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + [BuildOptions] XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7 -- cgit v1.2.3 From 00f7807510a5ea4e166aa51f05425e25b9101c65 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Wed, 22 Oct 2014 21:34:46 +0530 Subject: BeagleBoneBlackPkg: Fix RELEASE Target Show only EFI_D_ERROR messages in RELEASE target. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index f36b3277e..0bab25469 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -29,14 +29,9 @@ [LibraryClasses.common] ArmPlatformLib|TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/Am335xLib/Am335xLib.inf -!if $(TARGET) == RELEASE - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf -!else DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf # UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf -!endif DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -250,11 +245,7 @@ # CLEAR_MEMORY_ENABLED 0x08 # ASSERT_BREAKPOINT_ENABLED 0x10 # ASSERT_DEADLOOP_ENABLED 0x20 -!if $(TARGET) == RELEASE - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 -!else gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f -!endif # DEBUG_INIT 0x00000001 // Initialization # DEBUG_WARN 0x00000002 // Warnings @@ -272,7 +263,11 @@ # DEBUG_LOADFILE 0x00020000 // UNDI Driver # DEBUG_EVENT 0x00080000 // Event messages # DEBUG_ERROR 0x80000000 // Error - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F + !if $(TARGET) == RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000 + !else + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000047 + !endif gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 -- cgit v1.2.3 From 354a875cdea1ea6f981cd8ef36643cc5f242b9d8 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Wed, 22 Oct 2014 21:36:50 +0530 Subject: BeagleBoneBlackPkg: Remove Ebl From Fd Remove Ebl and dependencies since using ShellPkg. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 11 ----------- TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf | 1 - 2 files changed, 12 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index 0bab25469..4d9270ece 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -85,12 +85,6 @@ # Networking Requirements for ArmPlatformPkg/Bds NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf - # EBL Related Libraries - EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf - EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf - EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf - EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf - # # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window # in the debugger will show load and unload commands for symbols. You can cut and paste this @@ -384,11 +378,6 @@ MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf - # - # Application - # - EmbeddedPkg/Ebl/Ebl.inf - # Bds # MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf index 3aa826eda..d8d18652e 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf @@ -133,7 +133,6 @@ READ_LOCK_STATUS = TRUE # # UEFI application (Shell Embedded Boot Loader) # - INF EmbeddedPkg/Ebl/Ebl.inf INF ShellBinPkg/UefiShell/UefiShell.inf # -- cgit v1.2.3 From 88d3e29e84916c3f09943823a2427ce4fbc91487 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Tue, 28 Oct 2014 23:03:56 +0530 Subject: BeagleBoneBlackPkg: Use IntelFrameworkModulePkg BDS Add IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf and dependencies. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 34 +++++++++++++--------- .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf | 10 +++++-- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index 4d9270ece..5fe7aa09b 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -58,9 +58,9 @@ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf # - # Assume everything is fixed at build + # Allow dynamic PCDs # - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf # 1/123 faster than Stm or Vstm version #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf @@ -104,6 +104,10 @@ BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf + PlatformBdsLib|ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf [LibraryClasses.ARM] @@ -116,6 +120,7 @@ [LibraryClasses.common.SEC] ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf @@ -301,11 +306,17 @@ # gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000 + # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut) + gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()" + gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()" + gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut|3 + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4030B800 gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize|0x4 gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 gArmTokenSpaceGuid.PcdSystemMemorySize|0x40000000 + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE # Size of the region used by UEFI in permanent memory (Reserved 16MB) gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x01000000 @@ -326,9 +337,9 @@ # MdeModulePkg/Core/Dxe/DxeMain.inf { - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf } + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # Architectural Protocols @@ -346,18 +357,12 @@ MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - } + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf EmbeddedPkg/SerialDxe/SerialDxe.inf MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf - MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf { - - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - } + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf MdeModulePkg/Universal/PrintDxe/PrintDxe.inf @@ -380,6 +385,7 @@ # Bds # - MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf index d8d18652e..5de0a7051 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf @@ -84,7 +84,11 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -109,6 +113,7 @@ READ_LOCK_STATUS = TRUE INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf @@ -138,8 +143,9 @@ READ_LOCK_STATUS = TRUE # # Bds # - INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - INF TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf + INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf [FV.FVMAIN_COMPACT] FvAlignment = 8 -- cgit v1.2.3 From b03d92133a5c18c62007f283179b293beb579207 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Fri, 31 Oct 2014 15:44:05 +0530 Subject: BeagleBoneBlackPkg: Add SerialPortPoll to SerialPortLib Enable SerialPortPoll to check if serial buffer contains data. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c index bb606bc8a..473dd92e3 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Library/SerialPortLib/SerialPortLib.c @@ -223,8 +223,11 @@ SerialPortPoll ( VOID ) { - // - // Read the serial port status - // - return TRUE; + UINT32 LSR = UART0_BASE + UART_LSR_REG; + + if ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_NOT_EMPTY) { + return TRUE; + } else { + return FALSE; + } } -- cgit v1.2.3 From 28c8c2eed884345ca76bff72390043a965e97a13 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Mon, 1 Dec 2014 21:29:09 +0530 Subject: BeagleBoneBlackPkg: Fix TimerDxe Implementation Rewrite TimerDxe as per SoC specifications to provide timer tick functionality to DxeCore. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec | 3 + .../BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 2 + .../BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c | 101 ++++++++++----------- .../Drivers/TimerDxe/TimerDxe.inf | 2 +- .../BeagleBoneBlackPkg/Include/Library/Am335x.h | 15 +-- 5 files changed, 56 insertions(+), 67 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec index 2da4d9a20..d6e68197c 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dec @@ -21,5 +21,8 @@ [Protocols] +[PcdsFixedAtBuild.common] + gBeagleBoneBlackTokenSpaceGuid.PcdTimerInterruptNumber|0|UINT32|0x00000001 + [Guids] gBeagleBoneBlackTokenSpaceGuid = { 0x6834fe45, 0x4aee, 0x4fc6, { 0xbc, 0xb5, 0xff, 0x45, 0xb7, 0xa8, 0x71, 0xe2 } } \ No newline at end of file diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index 5fe7aa09b..20f3f6a9b 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -300,6 +300,8 @@ gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|4000 gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|25000 + gEmbeddedTokenSpaceGuid.PcdTimerPeriod|100000 + gBeagleBoneBlackTokenSpaceGuid.PcdTimerInterruptNumber|66 # # ARM Pcds diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c index 1a24e2df6..5eb3fd6da 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/Timer.c @@ -41,13 +41,6 @@ volatile UINT64 mTimerPeriod = 0; // Cached copy of the Hardware Interrupt protocol instance EFI_HARDWARE_INTERRUPT_PROTOCOL *gInterrupt = NULL; -// Cached registers -volatile UINT32 TISR; -volatile UINT32 TCLR; -volatile UINT32 TLDR; -volatile UINT32 TCRR; -volatile UINT32 TIER; - // Cached interrupt vector volatile UINTN gVector; @@ -88,10 +81,10 @@ TimerInterruptHandler ( } // Clear all timer interrupts - MmioWrite32 (TISR, TISR_CLEAR_ALL); + MmioWrite32 (DMTIMER0_BASE + DMTIMER_TISR, TISR_CLEAR_ALL); // Poll interrupt status bits to ensure clearing - while ((MmioRead32 (TISR) & TISR_ALL_INTERRUPT_MASK) != TISR_NO_INTERRUPTS_PENDING); + while ((MmioRead32 (DMTIMER0_BASE + DMTIMER_TISR) & TISR_ALL_INTERRUPT_MASK) != TISR_NO_INTERRUPTS_PENDING); gBS->RestoreTPL (OriginalTPL); } @@ -180,30 +173,40 @@ TimerDriverSetTimerPeriod ( ) { EFI_STATUS Status; - UINT64 TimerCount; - INT32 LoadValue; - + UINT64 TimerTicks; + + // disable the timer + MmioAnd32 (DMTIMER0_BASE + DMTIMER_TCLR, TCLR_ST_OFF); + if (TimerPeriod == 0) { - // Turn off GPTIMER3 - MmioWrite32 (TCLR, TCLR_ST_OFF); - - Status = gInterrupt->DisableInterruptSource(gInterrupt, gVector); - } else { - // Calculate required timer count - TimerCount = DivU64x32(TimerPeriod * 100, PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)); - - // Set GPTIMER3 Load register - LoadValue = (INT32) -TimerCount; - MmioWrite32 (TLDR, LoadValue); - MmioWrite32 (TCRR, LoadValue); - - // Enable Overflow interrupt - MmioWrite32 (TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE); - - // Turn on GPTIMER3, it will reload at overflow - MmioWrite32 (TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON); - - Status = gInterrupt->EnableInterruptSource(gInterrupt, gVector); + // Leave timer disabled from above, and... + + // Disable timer 0/1 interrupt for a TimerPeriod of 0 + Status = gInterrupt->DisableInterruptSource (gInterrupt, gVector); + } else { + // Convert TimerPeriod to TimerTicks + TimerTicks = MultU64x32 (TimerPeriod, 32); + TimerTicks = DivU64x32 (TimerTicks, 10000); + + // if it's larger than 32-bits, pin to highest value + if (TimerTicks > 0xffffffff) { + TimerTicks = 0xffffffff; + } + + TimerTicks = (INT32) -TimerTicks; + + // write count to timer + MmioWrite32 (DMTIMER0_BASE + DMTIMER_TLDR, TimerTicks); + MmioWrite32 (DMTIMER0_BASE + DMTIMER_TCRR, TimerTicks); + + // enable overflow interrupt + MmioWrite32(DMTIMER0_BASE + DMTIMER_IRQENABLE_SET, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE); + + // enable the timer to autoreload + MmioWrite32 (DMTIMER0_BASE + DMTIMER_TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON); + + // enable timer 0/1 interrupts + Status = gInterrupt->EnableInterruptSource (gInterrupt, gVector); } // @@ -310,19 +313,6 @@ EFI_TIMER_ARCH_PROTOCOL gTimer = { TimerDriverGenerateSoftInterrupt }; -UINTN -InterruptVectorForTimer ( - IN UINTN Timer - ) -{ - if ((Timer < 1) || (Timer > 12)) { - ASSERT(FALSE); - return 0xFFFFFFFF; - } - - return 0x24 + Timer; -} - /** Initialize the state information for the Timer Architectural Protocol and the Timer Debug support protocol that allows the debugger to break into a @@ -343,26 +333,27 @@ TimerInitialize ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_HANDLE Handle = NULL; - EFI_STATUS Status; - //UINT32 TimerBaseAddress; + EFI_HANDLE Handle = NULL; + EFI_STATUS Status; - // Find the interrupt controller protocol. ASSERT if not found. Status = gBS->LocateProtocol (&gHardwareInterruptProtocolGuid, NULL, (VOID **)&gInterrupt); ASSERT_EFI_ERROR (Status); - // Set up the timer registers - //TimerBaseAddress = DMTIMER2_BASE; - // Disable the timer - //Status = TimerDriverSetTimerPeriod (&gTimer, 0); - //ASSERT_EFI_ERROR (Status); + Status = TimerDriverSetTimerPeriod (&gTimer, 0); + ASSERT_EFI_ERROR (Status); + + // Get timer interrupt number + gVector = FixedPcdGet32 (PcdTimerInterruptNumber); // Install interrupt handler - gVector = InterruptVectorForTimer (2); // Using DMTIMER2 Status = gInterrupt->RegisterInterruptSource (gInterrupt, gVector, TimerInterruptHandler); ASSERT_EFI_ERROR (Status); + // Set up default timer + Status = TimerDriverSetTimerPeriod (&gTimer, FixedPcdGet32(PcdTimerPeriod)); + ASSERT_EFI_ERROR (Status); + // Install the Timer Architectural Protocol onto a new handle Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf index ba41c46cb..1a5f525e5 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Drivers/TimerDxe/TimerDxe.inf @@ -50,7 +50,7 @@ [Pcd.common] gEmbeddedTokenSpaceGuid.PcdTimerPeriod - gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds + gBeagleBoneBlackTokenSpaceGuid.PcdTimerInterruptNumber [Depex] gHardwareInterruptProtocolGuid diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h index d4f39de7a..837b1c1dd 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Include/Library/Am335x.h @@ -53,10 +53,10 @@ #define WDTIMER2_BASE (0x44E35000) #define DMTIMER_TIOCP_CFG (0x0010) -//#define DMTIMER_TISTAT (0x0014) -//#define DMTIMER_TISR (0x0018) -//#define DMTIMER_TIER (0x001C) -//#define DMTIMER_TWER (0x0020) +#define DMTIMER_IRQENABLE_SET (0x002C) +#define DMTIMER_TISR (0x0028) // IRQSTATUS +#define DMTIMER_TIER (0x001C) +#define DMTIMER_TWER (0x0020) #define DMTIMER_TCLR (0x0038) #define DMTIMER_TCRR (0x003C) #define DMTIMER_TLDR (0x0040) @@ -66,13 +66,6 @@ #define DMTIMER_TCAR1 (0x0050) #define DMTIMER_TSICR (0x0054) #define DMTIMER_TCAR2 (0x0058) -/*#define DMTIMER_TPIR (0x0048) -#define DMTIMER_TNIR (0x004C) -#define DMTIMER_TCVR (0x0050) -#define DMTIMER_TOCR (0x0054) -#define DMTIMER_TOWR (0x0058) -*/ -//#define WSPR (0x048) #define TISR_TCAR_IT_FLAG_MASK BIT2 #define TISR_OVF_IT_FLAG_MASK BIT1 -- cgit v1.2.3 From b8eb9a6f351e1369ca21e3f83f22b327274af56d Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Mon, 1 Dec 2014 21:37:27 +0530 Subject: BeagleBoneBlackPkg: Use UTF-8 Terminal Use UTF-8 terminal to support all characters. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc index 20f3f6a9b..eba51abec 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.dsc @@ -309,8 +309,8 @@ gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000000000000 # Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut) - gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()" - gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()" + gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenUtf8()" + gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenUtf8()" gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut|3 gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4030B800 -- cgit v1.2.3 From 1e3d9427a27b2bed6427c2b005f946988427bf0c Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Tue, 2 Dec 2014 21:20:15 +0530 Subject: BeagleBoneBlackPkg: Increase FVMAIN Size Increase FVMAIN Size to 0x400000 to accomodate Intel BDS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf index 5de0a7051..32e291326 100644 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf +++ b/TexasInstrumentsPkg/BeagleBoneBlackPkg/BeagleBoneBlackPkg.fdf @@ -66,7 +66,7 @@ FV = FVMAIN_COMPACT [FV.FvMain] BlockSize = 0x1000 -NumBlocks = 0x200 # This FV gets compressed so make it just big enough +NumBlocks = 0x400 # This FV gets compressed so make it just big enough FvAlignment = 8 # FV alignment and FV attributes setting. ERASE_POLARITY = 1 MEMORY_MAPPED = TRUE -- cgit v1.2.3 From e3fcd2b485c5fadecc4d37d62a87565b32bc57a4 Mon Sep 17 00:00:00 2001 From: Varad Gautam Date: Tue, 2 Dec 2014 21:40:59 +0530 Subject: BeagleBoneBlackPkg: Drop BeagleBoneBlack BDS Moved to Intel BDS. Remove local BDS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Varad Gautam --- TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf | 65 ------ .../BeagleBoneBlackPkg/Bds/BdsEntry.c | 242 --------------------- .../BeagleBoneBlackPkg/Bds/BdsEntry.h | 66 ------ .../BeagleBoneBlackPkg/Bds/FirmwareVolume.c | 151 ------------- 4 files changed, 524 deletions(-) delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h delete mode 100644 TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf deleted file mode 100644 index a1e26438b..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/Bds.inf +++ /dev/null @@ -1,65 +0,0 @@ - -#/** @file -# -# Component description file for Bds module -# -# Copyright (c) 2009, Apple Inc. 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 = BeagleBoardBds - FILE_GUID = 3783e0e2-5880-4d83-953c-c1c3ebc62dd9 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - - ENTRY_POINT = BdsInitialize - -[Sources.common] - BdsEntry.c - FirmwareVolume.c - -[Packages] - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - -[LibraryClasses] - DevicePathLib - BaseLib - HobLib - UefiRuntimeServicesTableLib - ReportStatusCodeLib - PerformanceLib - DxeServicesTableLib - MemoryAllocationLib - UefiLib - UefiBootServicesTableLib - BaseMemoryLib - DebugLib - PrintLib - UefiDriverEntryPoint - -[Guids] - - -[Protocols] - gEfiBdsArchProtocolGuid - gEfiSimpleTextInProtocolGuid - gEfiSimpleTextOutProtocolGuid - gEfiSerialIoProtocolGuid - gEfiDevicePathProtocolGuid - gEfiSimpleFileSystemProtocolGuid - gEfiUsbIoProtocolGuid - gEfiFirmwareVolume2ProtocolGuid - -[Depex] - TRUE diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c deleted file mode 100644 index b16b976be..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.c +++ /dev/null @@ -1,242 +0,0 @@ -/** @file - The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements - of the UEFI specification as it is designed to implement an embedded systmes - propriatary boot scheme. - - This template assume a DXE driver produces a SerialIo protocol not using the EFI - driver module and it will attempt to connect a console on top of this. - - Copyright (c) 2008 - 2009, Apple Inc. 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 "BdsEntry.h" - - -BOOLEAN gConsolePresent = FALSE; - -EFI_BDS_ARCH_PROTOCOL gBdsProtocol = { - BdsEntry, -}; - - - - -/** - This function uses policy data from the platform to determine what operating - system or system utility should be loaded and invoked. This function call - also optionally make the use of user input to determine the operating system - or system utility to be loaded and invoked. When the DXE Core has dispatched - all the drivers on the dispatch queue, this function is called. This - function will attempt to connect the boot devices required to load and invoke - the selected operating system or system utility. During this process, - additional firmware volumes may be discovered that may contain addition DXE - drivers that can be dispatched by the DXE Core. If a boot device cannot be - fully connected, this function calls the DXE Service Dispatch() to allow the - DXE drivers from any newly discovered firmware volumes to be dispatched. - Then the boot device connection can be attempted again. If the same boot - device connection operation fails twice in a row, then that boot device has - failed, and should be skipped. This function should never return. - - @param This The EFI_BDS_ARCH_PROTOCOL instance. - - @return None. - -**/ -VOID -EFIAPI -BdsEntry ( - IN EFI_BDS_ARCH_PROTOCOL *This - ) -{ - EFI_STATUS Status; - UINTN NoHandles; - EFI_HANDLE *Buffer; - EFI_HANDLE FvHandle; - EFI_HANDLE ImageHandle; - EFI_HANDLE UsbDeviceHandle; - EFI_GUID NameGuid; - UINTN Size; - UINTN HandleCount; - UINTN OldHandleCount; - EFI_HANDLE *HandleBuffer; - UINTN Index; - EFI_DEVICE_PATH_PROTOCOL *LoadImageDevicePath; - EFI_DEVICE_PATH_PROTOCOL *FileSystemDevicePath; - - PERF_END (NULL, "DXE", NULL, 0); - PERF_START (NULL, "BDS", NULL, 0); - - - // - // Now do the EFI stuff - // - Size = 0x100; - gST->FirmwareVendor = AllocateRuntimePool (Size); - ASSERT (gST->FirmwareVendor != NULL); - - UnicodeSPrint (gST->FirmwareVendor, Size, L"BeagleBoneBlack EFI %a %a", __DATE__, __TIME__); - - // - // Now we need to setup the EFI System Table with information about the console devices. - // This code is normally in the console spliter driver on platforms that support multiple - // consoles at the same time - // - Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer); - if (!EFI_ERROR (Status)) { - // Use the first SimpleTextOut we find and update the EFI System Table - gST->ConsoleOutHandle = Buffer[0]; - gST->StandardErrorHandle = Buffer[0]; - Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextOutProtocolGuid, (VOID **)&gST->ConOut); - ASSERT_EFI_ERROR (Status); - - gST->StdErr = gST->ConOut; - - gST->ConOut->OutputString (gST->ConOut, L"BDS: Console Started!!!!\n\r"); - FreePool (Buffer); - - gConsolePresent = TRUE; - } - - - Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer); - if (!EFI_ERROR (Status)) { - // Use the first SimpleTextIn we find and update the EFI System Table - gST->ConsoleInHandle = Buffer[0]; - Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextInProtocolGuid, (VOID **)&gST->ConIn); - ASSERT_EFI_ERROR (Status); - - FreePool (Buffer); - } - - // - // We now have EFI Consoles up and running. Print () will work now. DEBUG () and ASSERT () worked - // prior to this point as they were configured to use a more primative output scheme. - // - - // - //Perform Connect - // - HandleCount = 0; - while (1) { - OldHandleCount = HandleCount; - Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - break; - } - - if (HandleCount == OldHandleCount) { - break; - } - - for (Index = 0; Index < HandleCount; Index++) { - gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); - } - } - - EfiSignalEventReadyToBoot (); - - //Locate handles for SimpleFileSystem protocol - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiSimpleFileSystemProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (!EFI_ERROR(Status)) { - for (Index = 0; Index < HandleCount; Index++) { - //Get the device path - FileSystemDevicePath = DevicePathFromHandle(HandleBuffer[Index]); - if (FileSystemDevicePath == NULL) { - continue; - } - - //Check if UsbIo is on any handles in the device path. - Status = gBS->LocateDevicePath(&gEfiUsbIoProtocolGuid, &FileSystemDevicePath, &UsbDeviceHandle); - if (EFI_ERROR(Status)) { - continue; - } - - //Check if Usb stick has a magic EBL file. - LoadImageDevicePath = FileDevicePath(HandleBuffer[Index], L"Ebl.efi"); - Status = gBS->LoadImage (TRUE, gImageHandle, LoadImageDevicePath, NULL, 0, &ImageHandle); - if (EFI_ERROR(Status)) { - continue; - } - - //Boot to Shell on USB stick. - Status = gBS->StartImage (ImageHandle, NULL, NULL); - if (EFI_ERROR(Status)) { - continue; - } - } - } - - // - // Normal UEFI behavior is to process Globally Defined Variables as defined in Chapter 3 - // (Boot Manager) of the UEFI specification. For this embedded system we don't do this. - // - - // - // Search all the FVs for an application with a UI Section of Ebl. A .FDF file can be used - // to control the names of UI sections in an FV. - // - Status = FindApplicationMatchingUiSection (L"Shell", &FvHandle, &NameGuid); - if (!EFI_ERROR (Status)) { - - //Boot to Shell. - Status = LoadPeCoffSectionFromFv (FvHandle, &NameGuid); - - if (EFI_ERROR(Status)) { - DEBUG((EFI_D_ERROR, "Boot from Shell failed. Status: %r\n", Status)); - } - } - - // - // EFI does not define the behaviour if all boot attemps fail and the last one returns. - // So we make a policy choice to reset the system since this BDS does not have a UI. - // - gRT->ResetSystem (EfiResetShutdown, Status, 0, NULL); - - return ; -} - - -EFI_STATUS -EFIAPI -BdsInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Install protocol interface - // - Status = gBS->InstallMultipleProtocolInterfaces ( - &ImageHandle, - &gEfiBdsArchProtocolGuid, &gBdsProtocol, - NULL - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h deleted file mode 100644 index 149acbefc..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/BdsEntry.h +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. 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 __BDS_ENTRY_H__ -#define __BDS_ENTRY_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -EFI_STATUS -LoadPeCoffSectionFromFv ( - IN EFI_HANDLE FvHandle, - IN EFI_GUID *NameGuid - ); - -EFI_STATUS -FindApplicationMatchingUiSection ( - IN CHAR16 *UiString, - OUT EFI_HANDLE *FvHandle, - OUT EFI_GUID *NameGuid - ); - -VOID -EFIAPI -BdsEntry ( - IN EFI_BDS_ARCH_PROTOCOL *This - ); - -#endif - diff --git a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c b/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c deleted file mode 100644 index 8e505ec01..000000000 --- a/TexasInstrumentsPkg/BeagleBoneBlackPkg/Bds/FirmwareVolume.c +++ /dev/null @@ -1,151 +0,0 @@ -/** @file - The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements - of the UEFI specification as it is designed to implement an embedded systmes - propriatary boot scheme. - - This template assume a DXE driver produces a SerialIo protocol not using the EFI - driver module and it will attempt to connect a console on top of this. - - - Copyright (c) 2009, Apple Inc. 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 "BdsEntry.h" - - -EFI_STATUS -FindApplicationMatchingUiSection ( - IN CHAR16 *UiString, - OUT EFI_HANDLE *FvHandle, - OUT EFI_GUID *NameGuid - ) -{ - EFI_STATUS Status; - EFI_STATUS NextStatus; - UINTN NoHandles; - EFI_HANDLE *Buffer; - UINTN Index; - EFI_FV_FILETYPE FileType; - EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; - VOID *Key; - EFI_FV_FILE_ATTRIBUTES Attributes; - UINTN Size; - UINTN UiStringLen; - CHAR16 *UiSection; - UINT32 Authentication; - - - UiStringLen = 0; - - if (UiString != NULL) { - DEBUG ((DEBUG_ERROR, "UiString %s\n", UiString)); - UiStringLen = StrLen (UiString); - } - - Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Buffer); - if (!EFI_ERROR (Status)) { - for (Index = 0; Index < NoHandles; Index++) { - Status = gBS->HandleProtocol (Buffer[Index], &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv); - if (!EFI_ERROR (Status)) { - Key = AllocatePool (Fv->KeySize); - ASSERT (Key != NULL); - ZeroMem (Key, Fv->KeySize); - - FileType = EFI_FV_FILETYPE_APPLICATION; - - do { - NextStatus = Fv->GetNextFile (Fv, Key, &FileType, NameGuid, &Attributes, &Size); - if (!EFI_ERROR (NextStatus)) { - if (UiString == NULL) { - // - // If UiString is NULL match first application we find. - // - *FvHandle = Buffer[Index]; - FreePool (Key); - return Status; - } - - UiSection = NULL; - Status = Fv->ReadSection ( - Fv, - NameGuid, - EFI_SECTION_USER_INTERFACE, - 0, - (VOID **)&UiSection, - &Size, - &Authentication - ); - if (!EFI_ERROR (Status)) { - if (StrnCmp (UiString, UiSection, UiStringLen) == 0) { - // - // We found a UiString match. - // - *FvHandle = Buffer[Index]; - FreePool (Key); - FreePool (UiSection); - return Status; - } - FreePool (UiSection); - } - } - } while (!EFI_ERROR (NextStatus)); - - FreePool (Key); - } - } - - FreePool (Buffer); - } - - return EFI_NOT_FOUND; -} - - -EFI_DEVICE_PATH * -FvFileDevicePath ( - IN EFI_HANDLE FvHandle, - IN EFI_GUID *NameGuid - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode; - - DevicePath = DevicePathFromHandle (FvHandle); - - EfiInitializeFwVolDevicepathNode (&NewNode, NameGuid); - - return AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&NewNode); -} - - - -EFI_STATUS -LoadPeCoffSectionFromFv ( - IN EFI_HANDLE FvHandle, - IN EFI_GUID *NameGuid - ) -{ - EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_HANDLE ImageHandle; - - DevicePath = FvFileDevicePath (FvHandle, NameGuid); - - Status = gBS->LoadImage (TRUE, gImageHandle, DevicePath, NULL, 0, &ImageHandle); - if (!EFI_ERROR (Status)) { - PERF_END (NULL, "BDS", NULL, 0); - Status = gBS->StartImage (ImageHandle, NULL, NULL); - } - - return Status; -} - -- cgit v1.2.3