Skip to content

Commit

Permalink
RaspberryPiPkg: remove the hardcoded boot options
Browse files Browse the repository at this point in the history
Once the firmware had no NVRAM support, this was the
only way of ensuring that firmware could be useful
(i.e. prefer external media to just booting the shell).
It never worked too well, because on the Pi 3B+ the USB
hierarchy is different (there's an extra hub).

Now that we have NVRAM, we can dispense with this.
ConnectAll still won't enumerate all the devices in time,
because USB scanning is async because of a lock inversion.

Basically, first time you boot you *will* have to set the
boot order. Then you're fine.

One less edk2Patch, too.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
  • Loading branch information
andreiw committed Jan 14, 2019
1 parent 82bb52a commit b526dd7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 244 deletions.
106 changes: 0 additions & 106 deletions Library/PlatformBootManagerLib/PlatformBm.c
Expand Up @@ -60,91 +60,6 @@ typedef struct {
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
} PLATFORM_SD_DEV;

#define DW_USB_DXE_FILE_GUID { \
0x4bf1704c, 0x03f4, 0x46d5, \
{ 0xbc, 0xa6, 0x82, 0xfa, 0x58, 0x0b, 0xad, 0xfd } \
}

#define ARASAN_MMC_DXE_FILE_GUID { \
0x100c2cfa, 0xb586, 0x4198, \
{ 0x9b, 0x4c, 0x16, 0x83, 0xd1, 0x95, 0xb1, 0xda } \
}

#define SDHOST_MMC_DXE_FILE_GUID { \
0x58abd787, 0xf64d, 0x4ca2, \
{ 0xa0, 0x34, 0xb9, 0xac, 0x2d, 0x5a, 0xd0, 0xcf } \
}

STATIC PLATFORM_SD_DEV mArasan = {
//
// VENDOR_DEVICE_PATH ArasanMMCHostDxe
//
{
{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
ARASAN_MMC_DXE_FILE_GUID
},

//
// EFI_DEVICE_PATH_PROTOCOL End
//
{
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
}
};

STATIC PLATFORM_SD_DEV mSDHost = {
//
// VENDOR_DEVICE_PATH SdHostDxe
//
{
{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
SDHOST_MMC_DXE_FILE_GUID
},

//
// EFI_DEVICE_PATH_PROTOCOL End
//
{
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
}
};

STATIC PLATFORM_USB_DEV mUsbHubPort = {
//
// VENDOR_DEVICE_PATH DwUsbHostDxe
//
{
{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
DW_USB_DXE_FILE_GUID
},

//
// USB_DEVICE_PATH Hub
//
{
{ MESSAGING_DEVICE_PATH, MSG_USB_DP, DP_NODE_LEN (USB_DEVICE_PATH) },
0, 0
},

//
// USB_DEVICE_PATH Dev
//
{
{ MESSAGING_DEVICE_PATH, MSG_USB_DP, DP_NODE_LEN (USB_DEVICE_PATH) },
1, 0
},

//
// EFI_DEVICE_PATH_PROTOCOL End
//
{
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
}
};

#define SERIAL_DXE_FILE_GUID { \
0xD3987D4B, 0x971A, 0x435F, \
{ 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72, 0x41 } \
Expand Down Expand Up @@ -656,7 +571,6 @@ PlatformBootManagerAfterConsole (
VOID
)
{
UINTN Index;
ESRT_MANAGEMENT_PROTOCOL *EsrtManagement;
EFI_STATUS Status;
EFI_HANDLE SerialHandle;
Expand Down Expand Up @@ -694,26 +608,6 @@ PlatformBootManagerAfterConsole (
DEBUG((DEBUG_INFO, "ProcessCapsules returned %r\n", Status));
}

for (Index = 1; Index < 5; Index++) {
UINT16 Desc[11];
/*
* Add boot options to allow booting from
* a mass storage device plugged into any
* of the RPi USB ports.
*/
mUsbHubPort.Dev.ParentPortNumber = Index;
UnicodeSPrint(Desc, sizeof (Desc), L"USB Port %u", Index);
PlatformRegisterBootOption ((VOID *) &mUsbHubPort,
Desc, LOAD_OPTION_ACTIVE);
}

PlatformRegisterBootOption ((VOID *) &mSDHost,
L"uSD on SD Host",
LOAD_OPTION_ACTIVE);
PlatformRegisterBootOption ((VOID *) &mArasan,
L"uSD on Arasan MMC Host",
LOAD_OPTION_ACTIVE);

PlatformRegisterOptionsAndKeys ();
}

Expand Down
@@ -1,7 +1,7 @@
From 9cad0d7d02794cfc7f8dcd78c32ebf66370621ca Mon Sep 17 00:00:00 2001
From 12637ab24ca4a728f83c60a69a8c55ed996ba6ee 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 2/5] BaseTools/tools_def: support ASLC files on AArch64
Subject: [PATCH 1/4] BaseTools/tools_def: support ASLC files on AArch64

These weren't being built correctly.

Expand All @@ -11,7 +11,7 @@ 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 e0e68fd..57f21c3 100755
index e0e68fd7fb..57f21c39b2 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4152,10 +4152,10 @@ DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
Expand All @@ -29,5 +29,5 @@ index e0e68fd..57f21c3 100755
DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
--
2.5.3
2.17.1

This file was deleted.

@@ -1,7 +1,7 @@
From 64028b985ca2834cbdb7d48c9d0c4f104ef1596a Mon Sep 17 00:00:00 2001
From 892d1ec7bb1dc6b7af1a700c86834c4fa7e6fcc8 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 3/5] BdsDxe: allow PlatformBootManagerWaitCallback to handle
Subject: [PATCH 2/4] BdsDxe: allow PlatformBootManagerWaitCallback to handle
remaining timeout == 0

- Properly finish drawing 100% bar.
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 8946d79..c61323d 100644
index 8946d79ab2..c61323d9cc 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -347,6 +347,8 @@ BdsWait (
Expand All @@ -26,5 +26,5 @@ index 8946d79..c61323d 100644
}

--
2.5.3
2.17.1

@@ -1,7 +1,7 @@
From d4ee1d4aa0a2bda6ec26512fcf5c612ada03a26c Mon Sep 17 00:00:00 2001
From 367d54664c0572c64f42209c5652a50977e72c5e Mon Sep 17 00:00:00 2001
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Date: Mon, 14 May 2018 01:10:50 -0400
Subject: [PATCH 4/5] BootGraphicsResourceTableDxe: properly handle SetBootLogo
Subject: [PATCH 3/4] BootGraphicsResourceTableDxe: properly handle SetBootLogo
with NULL buffer

SetBootLogo would not free the previous logo memory, which in turn
Expand All @@ -19,11 +19,11 @@ This new behavior means a few things:

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
---
.../BootGraphicsResourceTableDxe.c | 54 +++++++++-------------
.../BootGraphicsResourceTableDxe.c | 54 ++++++++-----------
1 file changed, 22 insertions(+), 32 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
index cfd4be0..e672281 100644
index cfd4be0ebf..e672281ec5 100644
--- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
+++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
@@ -145,14 +145,12 @@ EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {
Expand Down Expand Up @@ -64,10 +64,11 @@ index cfd4be0..e672281 100644
return EFI_SUCCESS;
}

@@ -311,19 +320,6 @@ SetBootLogo2 (
@@ -310,19 +319,6 @@ SetBootLogo2 (
return EFI_UNSUPPORTED;
}

//
- //
- // Update state
- //
- mAcpiBgrtBufferChanged = TRUE;
Expand All @@ -80,10 +81,9 @@ index cfd4be0..e672281 100644
- mLogoBltBuffer = NULL;
- }
-
- //
//
// Allocate new logo buffer
//
mLogoBltBuffer = AllocateCopyPool (BufferSize, BltBuffer);
@@ -335,7 +331,6 @@ SetBootLogo2 (
mLogoDestY = DestinationY;
mLogoWidth = Width;
Expand Down Expand Up @@ -144,5 +144,5 @@ index cfd4be0..e672281 100644
}

--
2.5.3
2.17.1

@@ -1,19 +1,19 @@
From daaa69596ed5ec0a775b604bd3ad9b7a3a1351b0 Mon Sep 17 00:00:00 2001
From 4a30f86718e571643d9f3c5eff7a59064f2070fd Mon Sep 17 00:00:00 2001
From: Andrei Warkentin <andrey.warkentin@gmail.com>
Date: Fri, 18 May 2018 22:54:14 -0400
Subject: [PATCH 5/5] Ax88772b: not a runtime driver
Subject: [PATCH 4/4] Ax88772b: not a runtime driver

No need to tie up precious memory.

Also fix the depex and library deps.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
---
.../Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf | 17 ++---------------
.../Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
index 87f453d..c0277e6 100644
index 87f453d8bd..c0277e6624 100644
--- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf
@@ -18,7 +18,7 @@
Expand Down Expand Up @@ -60,5 +60,5 @@ index 87f453d..c0277e6 100644
+ TRUE
\ No newline at end of file
--
2.5.3
2.17.1

0 comments on commit b526dd7

Please sign in to comment.