Skip to content

Commit

Permalink
RPi3: rebase to latest edk2
Browse files Browse the repository at this point in the history
This is the last known-good SHA to build against, now.

commit 989f7a2cf0e27123fda5ca538b15832e115e0f4e
Author: cinnamon shia <cinnamon.shia@hpe.com>
Date:   Fri May 11 23:21:12 2018 +0800

Only tested with WoA (I know, I know...). Linux and FreeBSD
are still TBD.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
  • Loading branch information
andreiw committed May 14, 2018
1 parent a5bc94f commit e6f7bab
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 94 deletions.
85 changes: 63 additions & 22 deletions Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.c
Expand Up @@ -267,57 +267,98 @@ STATIC EFI_HARDWARE_INTERRUPT_PROTOCOL gHardwareInterruptProtocol = {
EndOfInterrupt
};

/**
Initialize the state information for the CPU Architectural Protocol
@param ImageHandle of the loaded driver
@param SystemTable Pointer to the System Table
STATIC VOID *mCpuArchProtocolNotifyEventRegistration;

@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
STATIC
VOID
EFIAPI
CpuArchEventProtocolNotify (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_CPU_ARCH_PROTOCOL *Cpu;
EFI_STATUS Status;

// Make sure the Interrupt Controller Protocol is not already installed in the system.
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid);

//
// Get the CPU protocol that this driver requires.
//
Status = gBS->LocateProtocol(&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);
ASSERT_EFI_ERROR(Status);
if (EFI_ERROR (Status)) {
return;
}

//
// Unregister the default exception handler.
//
Status = Cpu->RegisterInterruptHandler(Cpu, ARM_ARCH_EXCEPTION_IRQ, NULL);
ASSERT_EFI_ERROR(Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",
__FUNCTION__, Status));
ASSERT (FALSE);
return;
}

//
// Register to receive interrupts
//
Status = Cpu->RegisterInterruptHandler(Cpu, ARM_ARCH_EXCEPTION_IRQ,
IrqInterruptHandler);
ASSERT_EFI_ERROR(Status);
IrqInterruptHandler);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",
__FUNCTION__, Status));
ASSERT (FALSE);
return;
}
}


/**
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_EVENT CpuArchEvent;

// Make sure the Interrupt Controller Protocol is not already installed in the system.
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid);

Status = gBS->InstallMultipleProtocolInterfaces(
&ImageHandle,
&gHardwareInterruptProtocolGuid, &gHardwareInterruptProtocol,
&gHardwareInterruptProtocolGuid,
&gHardwareInterruptProtocol,
NULL);
ASSERT_EFI_ERROR(Status);

//
// Install the interrupt handler as soon as the CPU arch protocol appears.
//
CpuArchEvent = EfiCreateProtocolNotifyEvent (
&gEfiCpuArchProtocolGuid,
TPL_CALLBACK,
CpuArchEventProtocolNotify,
NULL,
&mCpuArchProtocolNotifyEventRegistration
);
ASSERT (CpuArchEvent != NULL);

// Register for an ExitBootServicesEvent
Status = gBS->CreateEvent(EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY,
ExitBootServicesEvent, NULL, &mExitBootServicesEvent);

ASSERT_EFI_ERROR(Status);

return Status;
Expand Down
6 changes: 3 additions & 3 deletions Drivers/Bcm2836InterruptDxe/Bcm2836InterruptDxe.inf
Expand Up @@ -38,11 +38,11 @@
UefiDriverEntryPoint

[Protocols]
gHardwareInterruptProtocolGuid
gEfiCpuArchProtocolGuid
gHardwareInterruptProtocolGuid ## PRODUCES
gEfiCpuArchProtocolGuid ## CONSUMES ## NOTIFY

[FixedPcd]
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress

[Depex]
gEfiCpuArchProtocolGuid
TRUE
7 changes: 2 additions & 5 deletions RaspberryPiPkg.dsc
Expand Up @@ -60,6 +60,8 @@ DEFINE ATF_BUILD_DIR = RaspberryPiPkg/Binary/atf/debug
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf

BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
Expand Down Expand Up @@ -333,12 +335,8 @@ DEFINE ATF_BUILD_DIR = RaspberryPiPkg/Binary/atf/debug
[LibraryClasses.common]
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf

ArmPlatformLib|RaspberryPiPkg/Library/RaspberryPiPlatformLib/RaspberryPiPlatformLib.inf
ArmPlatformSysConfigLib|ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf

TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf

CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
Expand Down Expand Up @@ -609,7 +607,6 @@ DEFINE ATF_BUILD_DIR = RaspberryPiPkg/Binary/atf/debug
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
Expand Down
@@ -1,4 +1,4 @@
From 32da1192a72fd3d909fffbce5e4ab69a3def0539 Mon Sep 17 00:00:00 2001
From ba25cc055dad6af61312895a28e2c29c672ea9e1 Mon Sep 17 00:00:00 2001
From: Andrey Warkentin <andrey.warkentin@gmail.com>
Date: Thu, 14 Dec 2017 23:41:53 -0500
Subject: [PATCH 1/5] MmcDxe: fix invalid HC_MMC_CSD_GET_DEVICESIZE computation
Expand Down
@@ -1,4 +1,4 @@
From 7c52e9a64102a7d3abf320bf18def9929dfe3247 Mon Sep 17 00:00:00 2001
From 31ec7002f98fc5cd7fa9ab5a4352820cf10f61ed Mon Sep 17 00:00:00 2001
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Date: Thu, 22 Feb 2018 18:28:32 -0500
Subject: [PATCH 2/5] UefiBootManagerLib: don't add duplicates in
Expand All @@ -17,10 +17,10 @@ Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
3 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
index 97ac1f2..6b9bd52 100644
index 1d862a4..3a06eeb 100644
--- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h
+++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
@@ -227,7 +227,7 @@ EfiBootManagerSortLoadOptionVariable (
@@ -237,7 +237,7 @@ EfiBootManagerSortLoadOptionVariable (
/**
Return the index of the load option in the load option array.

Expand All @@ -29,7 +29,7 @@ index 97ac1f2..6b9bd52 100644
OptionType, Attributes, Description, FilePath and OptionalData are equal.

@param Key Pointer to the load option to be found.
@@ -245,6 +245,27 @@ EfiBootManagerFindLoadOption (
@@ -255,6 +255,27 @@ EfiBootManagerFindLoadOption (
IN UINTN Count
);

Expand Down Expand Up @@ -58,10 +58,10 @@ index 97ac1f2..6b9bd52 100644
// Boot Manager hot key library functions.
//
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index d684482..ee32318 100644
index b842d58..347f31f 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2234,10 +2234,11 @@ EfiBootManagerRefreshAllBootOption (
@@ -2265,10 +2265,11 @@ EfiBootManagerRefreshAllBootOption (
}

//
Expand All @@ -76,10 +76,10 @@ index d684482..ee32318 100644
//
// Try best to add the boot options so continue upon failure.
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 32918ca..0d91db8 100644
index f88f8e0..2ccf1d4 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -510,7 +510,7 @@ EfiBootManagerInitializeLoadOption (
@@ -514,7 +514,7 @@ EfiBootManagerInitializeLoadOption (
/**
Return the index of the load option in the load option array.

Expand All @@ -88,7 +88,7 @@ index 32918ca..0d91db8 100644
OptionType, Attributes, Description, FilePath and OptionalData are equal.

@param Key Pointer to the load option to be found.
@@ -545,6 +545,40 @@ EfiBootManagerFindLoadOption (
@@ -549,6 +549,40 @@ EfiBootManagerFindLoadOption (
}

/**
Expand Down
@@ -1,4 +1,4 @@
From 374ef3b404a90211a8c5d5c02021adae34b87475 Mon Sep 17 00:00:00 2001
From 02e4c45a2daff426dfcbb777962ac894875466fb Mon Sep 17 00:00:00 2001
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Date: Sun, 1 Apr 2018 02:58:31 -0400
Subject: [PATCH 3/5] BaseTools/tools_def: support ASLC files on AArch64
Expand All @@ -11,10 +11,10 @@ Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 4d2a3b7..8ebb36d 100755
index 03d7000..9f9df69 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4356,10 +4356,10 @@ DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
@@ -4545,10 +4545,10 @@ DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
Expand Down
@@ -1,4 +1,4 @@
From 5a7a0b4cb5098dc2deb13221ca4b1b09f9ac382a Mon Sep 17 00:00:00 2001
From 3375bea3c89c86f6fbdbaf182f2a676efe777c9a Mon Sep 17 00:00:00 2001
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Date: Sat, 21 Apr 2018 22:57:53 -0400
Subject: [PATCH 4/5] BdsDxe: allow PlatformBootManagerWaitCallback to handle
Expand All @@ -13,7 +13,7 @@ Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index dccc490..26461ae 100644
index 3191a98..d17fe43 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -347,6 +347,8 @@ BdsWait (
Expand Down

0 comments on commit e6f7bab

Please sign in to comment.