diff options
Diffstat (limited to 'ArmPlatformPkg/Bds')
-rw-r--r-- | ArmPlatformPkg/Bds/Bds.c | 28 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BdsHelper.c | 31 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BdsInternal.h | 68 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BootMenu.c | 170 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BootOption.c | 209 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BootOptionSupport.c | 98 |
6 files changed, 352 insertions, 252 deletions
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c index a1fa21a0f9..cdfea03228 100644 --- a/ArmPlatformPkg/Bds/Bds.c +++ b/ArmPlatformPkg/Bds/Bds.c @@ -203,8 +203,11 @@ DefineDefaultBootEntries ( EFI_STATUS Status; EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol; EFI_DEVICE_PATH* BootDevicePath; - BDS_LOADER_ARGUMENTS BootArguments; - BDS_LOADER_TYPE BootType; + ARM_BDS_LOADER_ARGUMENTS* BootArguments; + ARM_BDS_LOADER_TYPE BootType; + EFI_DEVICE_PATH* InitrdPath; + UINTN CmdLineSize; + UINTN InitrdSize; // // If Boot Order does not exist then create a default entry @@ -240,19 +243,28 @@ DefineDefaultBootEntries ( // Create the entry is the Default values are correct if (BootDevicePath != NULL) { - BootType = (BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType); + BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType); - if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) { - BootArguments.LinuxAtagArguments.CmdLine[0] = '\0'; - AsciiStrnCpy (BootArguments.LinuxAtagArguments.CmdLine,(CHAR8*)PcdGetPtr(PcdDefaultBootArgument),BOOT_DEVICE_OPTION_MAX); - BootArguments.LinuxAtagArguments.InitrdPathList = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath)); + if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) { + CmdLineSize = AsciiStrSize ((CHAR8*)PcdGetPtr(PcdDefaultBootArgument)); + InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath)); + InitrdSize = GetDevicePathSize (InitrdPath); + + BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize); + BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; + BootArguments->LinuxArguments.InitrdSize = InitrdSize; + + CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize); + CopyMem ((VOID*)(BootArguments + 1) + CmdLineSize, (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), InitrdSize); + } else { + BootArguments = NULL; } BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT, (CHAR16*)PcdGetPtr(PcdDefaultBootDescription), BootDevicePath, BootType, - &BootArguments, + BootArguments, &BdsLoadOption ); FreePool (BdsLoadOption); diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c index 0a6961183a..91b42341e6 100644 --- a/ArmPlatformPkg/Bds/BdsHelper.c +++ b/ArmPlatformPkg/Bds/BdsHelper.c @@ -343,3 +343,34 @@ BdsStartBootOption ( } return Status; } + +UINTN +GetUnalignedDevicePathSize ( + IN EFI_DEVICE_PATH* DevicePath + ) +{ + UINTN Size; + EFI_DEVICE_PATH* AlignedDevicePath; + + if ((UINTN)DevicePath & 0x1) { + AlignedDevicePath = DuplicateDevicePath (DevicePath); + Size = GetDevicePathSize (AlignedDevicePath); + FreePool (AlignedDevicePath); + } else { + Size = GetDevicePathSize (DevicePath); + } + return Size; +} + +EFI_DEVICE_PATH* +GetAlignedDevicePath ( + IN EFI_DEVICE_PATH* DevicePath + ) +{ + if ((UINTN)DevicePath & 0x1) { + return DuplicateDevicePath (DevicePath); + } else { + return DevicePath; + } +} + diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h index a788ef7be1..d4c438b010 100644 --- a/ArmPlatformPkg/Bds/BdsInternal.h +++ b/ArmPlatformPkg/Bds/BdsInternal.h @@ -38,26 +38,38 @@ #define BOOT_DEVICE_OPTION_MAX 300
#define BOOT_DEVICE_ADDRESS_MAX 20
+#define ARM_BDS_OPTIONAL_DATA_SIGNATURE SIGNATURE_32('a', 'b', 'o', 'd')
+
+#define IS_ARM_BDS_BOOTENTRY(ptr) (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) == ARM_BDS_OPTIONAL_DATA_SIGNATURE)
+
typedef enum {
BDS_LOADER_EFI_APPLICATION = 0,
BDS_LOADER_KERNEL_LINUX_ATAG,
BDS_LOADER_KERNEL_LINUX_FDT,
-} BDS_LOADER_TYPE;
+} ARM_BDS_LOADER_TYPE;
-typedef struct{
- UINT16 InitrdPathListLength;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;
- CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX + 1];
-} BDS_LINUX_ATAG_ARGUMENTS;
+typedef struct {
+ UINT16 CmdLineSize;
+ UINT16 InitrdSize;
+
+ // These following fields have variable length and are packed:
+ //CHAR8 *CmdLine;
+ //EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;
+} ARM_BDS_LINUX_ARGUMENTS;
typedef union {
- BDS_LINUX_ATAG_ARGUMENTS LinuxAtagArguments;
-} BDS_LOADER_ARGUMENTS;
+ ARM_BDS_LINUX_ARGUMENTS LinuxArguments;
+} ARM_BDS_LOADER_ARGUMENTS;
typedef struct {
- BDS_LOADER_TYPE LoaderType;
- BDS_LOADER_ARGUMENTS Arguments;
-} BDS_LOADER_OPTIONAL_DATA;
+ UINT32 Signature;
+ ARM_BDS_LOADER_TYPE LoaderType;
+} ARM_BDS_LOADER_OPTIONAL_DATA_HEADER;
+
+typedef struct {
+ ARM_BDS_LOADER_OPTIONAL_DATA_HEADER Header;
+ ARM_BDS_LOADER_ARGUMENTS Arguments;
+} ARM_BDS_LOADER_OPTIONAL_DATA;
typedef enum {
BDS_DEVICE_FILESYSTEM = 0,
@@ -97,8 +109,8 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT { BDS_SUPPORTED_DEVICE_TYPE Type;
EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);
BOOLEAN (*IsSupported)(IN BDS_LOAD_OPTION* BdsLoadOption);
- EFI_STATUS (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
- EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
+ EFI_STATUS (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
+ EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
} BDS_LOAD_OPTION_SUPPORT;
#define LOAD_OPTION_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION, Link)
@@ -182,6 +194,16 @@ BdsStartBootOption ( IN CHAR16* BootOption
);
+UINTN
+GetUnalignedDevicePathSize (
+ IN EFI_DEVICE_PATH* DevicePath
+ );
+
+EFI_DEVICE_PATH*
+GetAlignedDevicePath (
+ IN EFI_DEVICE_PATH* DevicePath
+ );
+
EFI_STATUS
GenerateDeviceDescriptionName (
IN EFI_HANDLE Handle,
@@ -207,22 +229,22 @@ BootOptionStart ( EFI_STATUS
BootOptionCreate (
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
+ IN UINT32 Attributes,
+ IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN BDS_LOADER_TYPE BootType,
- IN BDS_LOADER_ARGUMENTS *BootArguments,
- OUT BDS_LOAD_OPTION **BdsLoadOption
+ IN ARM_BDS_LOADER_TYPE BootType,
+ IN ARM_BDS_LOADER_ARGUMENTS* BootArguments,
+ OUT BDS_LOAD_OPTION** BdsLoadOption
);
EFI_STATUS
BootOptionUpdate (
- IN BDS_LOAD_OPTION *BdsLoadOption,
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
+ IN BDS_LOAD_OPTION* BdsLoadOption,
+ IN UINT32 Attributes,
+ IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN BDS_LOADER_TYPE BootType,
- IN BDS_LOADER_ARGUMENTS *BootArguments
+ IN ARM_BDS_LOADER_TYPE BootType,
+ IN ARM_BDS_LOADER_ARGUMENTS* BootArguments
);
EFI_STATUS
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 591e7e683b..8aa09596fd 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -113,22 +113,26 @@ BootMenuAddBootOption ( IN LIST_ENTRY *BootOptionsList
)
{
- EFI_STATUS Status;
- BDS_SUPPORTED_DEVICE* SupportedBootDevice;
- BDS_LOADER_ARGUMENTS BootArguments;
+ EFI_STATUS Status;
+ BDS_SUPPORTED_DEVICE* SupportedBootDevice;
+ ARM_BDS_LOADER_ARGUMENTS* BootArguments;
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- UINT32 Attributes;
- BDS_LOADER_TYPE BootType;
+ CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
+ UINT32 Attributes;
+ ARM_BDS_LOADER_TYPE BootType;
BDS_LOAD_OPTION *BdsLoadOption;
- EFI_DEVICE_PATH *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPathNode;
+ EFI_DEVICE_PATH *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *InitrdPathNode;
+ EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
+ UINTN CmdLineSize;
+ UINTN InitrdSize;
Attributes = 0;
SupportedBootDevice = NULL;
// List the Boot Devices supported
- Status = SelectBootDevice(&SupportedBootDevice);
+ Status = SelectBootDevice (&SupportedBootDevice);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto EXIT;
@@ -144,7 +148,7 @@ BootMenuAddBootOption ( // Append the Device Path node to the select device path
DevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNode);
- if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
// Create the specific device path node
Print(L"File path of the initrd: ");
Status = SupportedBootDevice->Support->CreateDevicePathNode (SupportedBootDevice, &InitrdPathNode, NULL, NULL);
@@ -155,18 +159,29 @@ BootMenuAddBootOption ( if (InitrdPathNode != NULL) {
// Append the Device Path node to the select device path
- BootArguments.LinuxAtagArguments.InitrdPathList = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ InitrdPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
} else {
- BootArguments.LinuxAtagArguments.InitrdPathList = NULL;
+ InitrdPath = NULL;
}
Print(L"Arguments to pass to the binary: ");
- Status = GetHIInputAscii (BootArguments.LinuxAtagArguments.CmdLine,BOOT_DEVICE_OPTION_MAX);
+ Status = GetHIInputAscii (CmdLine,BOOT_DEVICE_OPTION_MAX);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto FREE_DEVICE_PATH;
}
- BootArguments.LinuxAtagArguments.CmdLine[BOOT_DEVICE_OPTION_MAX]= '\0';
+
+ CmdLineSize = AsciiStrSize (CmdLine);
+ InitrdSize = GetDevicePathSize (InitrdPath);
+
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);
+
+ BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
+ BootArguments->LinuxArguments.InitrdSize = InitrdSize;
+ CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
+ } else {
+ BootArguments = NULL;
}
Print(L"Description for this new Entry: ");
@@ -222,14 +237,17 @@ BootMenuSelectBootOption ( DEBUG_CODE_BEGIN();
CHAR16* DevicePathTxt;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
+ ARM_BDS_LOADER_TYPE LoaderType;
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
ASSERT_EFI_ERROR(Status);
DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText(BootOption->FilePathList,TRUE,TRUE);
Print(L"\t- %s\n",DevicePathTxt);
- if ((BDS_LOADER_TYPE)ReadUnaligned32(&BootOption->OptionalData->LoaderType) == BDS_LOADER_KERNEL_LINUX_ATAG) {
- Print(L"\t- Arguments: %a\n",BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine);
+ OptionalData = BdsLoadOption->OptionalData;
+ LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
+ if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {
+ Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1);
}
FreePool(DevicePathTxt);
@@ -292,13 +310,19 @@ BootMenuUpdateBootOption ( IN LIST_ENTRY *BootOptionsList
)
{
- EFI_STATUS Status;
- BDS_LOAD_OPTION *BootOption;
- BDS_LOAD_OPTION_SUPPORT *DeviceSupport;
- BDS_LOADER_ARGUMENTS BootArguments;
+ EFI_STATUS Status;
+ BDS_LOAD_OPTION *BootOption;
+ BDS_LOAD_OPTION_SUPPORT* DeviceSupport;
+ ARM_BDS_LOADER_ARGUMENTS* BootArguments;
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- EFI_DEVICE_PATH* DevicePath;
- BDS_LOADER_TYPE BootType;
+ CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
+ EFI_DEVICE_PATH* DevicePath;
+ ARM_BDS_LOADER_TYPE BootType;
+ ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
+ ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
+ EFI_DEVICE_PATH* InitrdPathList;
+ UINTN InitrdSize;
+ UINTN CmdLineSize;
Status = BootMenuSelectBootOption (BootOptionsList,L"Update entry: ",&BootOption);
if (EFI_ERROR(Status)) {
@@ -319,41 +343,46 @@ BootMenuUpdateBootOption ( goto EXIT;
}
- BootType = (BDS_LOADER_TYPE)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->LoaderType));
+ OptionalData = BootOption->OptionalData;
+ BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));
// TODO: Allow adding an initrd to a boot entry without one
- if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {
- if (ReadUnaligned16(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathListLength) > 0
- && (EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)) != NULL) {
-
- Print(L"File path of the initrd: ");
- Status = DeviceSupport->UpdateDevicePathNode (
- (EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)),
- &BootArguments.LinuxAtagArguments.InitrdPathList,
- NULL,
- NULL);
- if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
- Status = EFI_ABORTED;
- goto EXIT;
- }
- } else {
- BootArguments.LinuxAtagArguments.InitrdPathList = NULL;
- BootArguments.LinuxAtagArguments.InitrdPathListLength = 0;
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
+ LinuxArguments = &OptionalData->Arguments.LinuxArguments;
+
+ CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
+ InitrdSize = GetUnalignedDevicePathSize ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize));
+
+ Print(L"File path of the initrd: ");
+ Status = DeviceSupport->UpdateDevicePathNode (
+ (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)(LinuxArguments + 1) + CmdLineSize), &InitrdPathList, NULL, NULL);
+ if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
+ Status = EFI_ABORTED;
+ goto EXIT;
}
- Print(L"Arguments to pass to the binary: ");
- if (ReadUnaligned32((CONST UINT32*)&BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine)) {
- AsciiStrnCpy(BootArguments.LinuxAtagArguments.CmdLine,
- BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine,
- BOOT_DEVICE_OPTION_MAX+1);
+ Print(L"Arguments to pass to the binary: ");
+ if (CmdLineSize > 0) {
+ AsciiStrnCpy(CmdLine, (CONST CHAR8*)(LinuxArguments + 1), CmdLineSize);
} else {
- BootArguments.LinuxAtagArguments.CmdLine[0] = '\0';
+ CmdLine[0] = '\0';
}
- Status = EditHIInputAscii (BootArguments.LinuxAtagArguments.CmdLine, BOOT_DEVICE_OPTION_MAX);
+ Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto FREE_DEVICE_PATH;
}
+
+ CmdLineSize = AsciiStrSize (CmdLine);
+ InitrdSize = GetDevicePathSize (InitrdPathList);
+
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);
+ BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
+ BootArguments->LinuxArguments.InitrdSize = InitrdSize;
+ CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
+ CopyMem ((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLine, InitrdPathList, InitrdSize);
+ } else {
+ BootArguments = NULL;
}
Print(L"Description for this new Entry: ");
@@ -364,7 +393,7 @@ BootMenuUpdateBootOption ( }
// Update the entry
- Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, &BootArguments);
+ Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, BootArguments);
FREE_DEVICE_PATH:
FreePool (DevicePath);
@@ -452,15 +481,15 @@ BootMenuMain ( VOID
)
{
- LIST_ENTRY BootOptionsList;
- UINTN OptionCount;
- UINTN BootOptionCount;
- EFI_STATUS Status;
- LIST_ENTRY *Entry;
- BDS_LOAD_OPTION *BootOption;
- UINTN BootOptionSelected;
- UINTN Index;
- UINTN BootMainEntryCount;
+ LIST_ENTRY BootOptionsList;
+ UINTN OptionCount;
+ UINTN BootOptionCount;
+ EFI_STATUS Status;
+ LIST_ENTRY* Entry;
+ BDS_LOAD_OPTION* BootOption;
+ UINTN BootOptionSelected;
+ UINTN Index;
+ UINTN BootMainEntryCount;
BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);
@@ -484,6 +513,9 @@ BootMenuMain ( DEBUG_CODE_BEGIN();
CHAR16* DevicePathTxt;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
+ ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
+ UINTN CmdLineSize;
+ ARM_BDS_LOADER_TYPE LoaderType;
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
if (EFI_ERROR(Status)) {
@@ -494,18 +526,22 @@ BootMenuMain ( DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText(BootOption->FilePathList,TRUE,TRUE);
Print(L"\t- %s\n",DevicePathTxt);
- if (ReadUnaligned32(&BootOption->OptionalData->LoaderType) == BDS_LOADER_KERNEL_LINUX_ATAG) {
- if (ReadUnaligned16(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathListLength) > 0
- && (EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)) != NULL) {
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)),TRUE,TRUE);
- Print(L"\t- Initrd: %s\n", DevicePathTxt);
+
+ // If it is a supported BootEntry then print its details
+ if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
+ OptionalData = BootOption->OptionalData;
+ LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
+ if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {
+ if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {
+ CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
+ DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
+ GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);
+ Print(L"\t- Initrd: %s\n", DevicePathTxt);
+ }
+ Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));
}
-
- Print(L"\t- Arguments: %a\n", BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine);
+ Print(L"\t- LoaderType: %d\n", LoaderType);
}
-
- Print(L"\t- LoaderType: %d\n", ReadUnaligned32 (&BootOption->OptionalData->LoaderType));
-
FreePool(DevicePathTxt);
DEBUG_CODE_END();
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c index f4ff182ef2..f6090d266d 100644 --- a/ArmPlatformPkg/Bds/BootOption.c +++ b/ArmPlatformPkg/Bds/BootOption.c @@ -25,33 +25,64 @@ BootOptionStart ( EFI_DEVICE_PATH* FdtDevicePath;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
UINT32 LoaderType;
+ ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
+ ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
+ EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath;
+ UINTN FdtDevicePathSize;
+ UINTN CmdLineSize;
+ UINTN InitrdSize;
+ EFI_DEVICE_PATH* Initrd;
+
+ Status = EFI_UNSUPPORTED;
+ OptionalData = BootOption->OptionalData;
+ LoaderType = ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
+
+ if (LoaderType == BDS_LOADER_EFI_APPLICATION) {
+ // Need to connect every drivers to ensure no dependencies are missing for the application
+ BdsConnectAllDrivers();
+
+ Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, 0, NULL);
+ } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {
+ LinuxArguments = &(OptionalData->Arguments.LinuxArguments);
+ CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
+ InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
+
+ if (InitrdSize > 0) {
+ Initrd = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize));
+ } else {
+ Initrd = NULL;
+ }
- Status = EFI_UNSUPPORTED;
- LoaderType = ReadUnaligned32 (&BootOption->OptionalData->LoaderType);
-
- if (LoaderType == BDS_LOADER_EFI_APPLICATION) {
- // Need to connect every drivers to ensure no dependencies are missing for the application
- BdsConnectAllDrivers();
-
- Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList);
- } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {
- Status = BdsBootLinux (BootOption->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL*)ReadUnaligned32((UINT32*)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)),
- BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine,
- NULL);
- } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {
- // Convert the FDT path into a Device Path
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
- FdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
-
- Status = BdsBootLinux (BootOption->FilePathList,
- NULL,
- NULL,
- FdtDevicePath);
-
- FreePool(FdtDevicePath);
- }
+ Status = BdsBootLinux (BootOption->FilePathList,
+ Initrd, // Initrd
+ (CHAR8*)(LinuxArguments + 1), // CmdLine
+ NULL);
+ } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {
+ LinuxArguments = &(OptionalData->Arguments.LinuxArguments);
+ CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
+ InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
+
+ if (InitrdSize > 0) {
+ Initrd = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize));
+ } else {
+ Initrd = NULL;
+ }
+
+ // Get the default FDT device path
+ Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
+ ASSERT_EFI_ERROR(Status);
+ DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
+
+ // Get the FDT device path
+ FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
+ Status = GetEnvironmentVariable ((CHAR16 *)L"FDT", DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
+ ASSERT_EFI_ERROR(Status);
+
+ Status = BdsBootLinux (BootOption->FilePathList,
+ Initrd, // Initrd
+ (CHAR8*)(LinuxArguments + 1),
+ FdtDevicePath);
return Status;
}
@@ -191,53 +222,34 @@ BootOptionSetFields ( IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN BDS_LOADER_TYPE BootType,
- IN BDS_LOADER_ARGUMENTS* BootArguments
+ IN ARM_BDS_LOADER_TYPE BootType,
+ IN ARM_BDS_LOADER_ARGUMENTS* BootArguments
)
{
- EFI_LOAD_OPTION EfiLoadOption;
- UINTN EfiLoadOptionSize;
- UINTN BootDescriptionSize;
- UINTN BootOptionalDataSize;
- UINT16 FilePathListLength;
- UINT16 InitrdPathListLength;
- EFI_DEVICE_PATH_PROTOCOL* DevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL* InitrdPathNode;
- UINTN NodeLength;
- UINT8* EfiLoadOptionPtr;
- UINT8 *InitrdPathListPtr;
+ EFI_LOAD_OPTION EfiLoadOption;
+ UINTN EfiLoadOptionSize;
+ UINTN BootDescriptionSize;
+ UINTN BootOptionalDataSize;
+ UINT16 FilePathListLength;
+ UINT8* EfiLoadOptionPtr;
+ UINT8* InitrdPathListPtr;
+ UINTN OptionalDataSize;
+ ARM_BDS_LINUX_ARGUMENTS* DestLinuxArguments;
+ ARM_BDS_LINUX_ARGUMENTS* SrcLinuxArguments;
// If we are overwriting an existent Boot Option then we have to free previously allocated memory
if (BootOption->LoadOption) {
FreePool(BootOption->LoadOption);
}
- BootDescriptionSize = StrSize(BootDescription);
- BootOptionalDataSize = sizeof(BDS_LOADER_TYPE) + (BootType == BDS_LOADER_KERNEL_LINUX_ATAG ?
- (sizeof(UINT16) + sizeof(EFI_DEVICE_PATH_PROTOCOL*) + BOOT_DEVICE_OPTION_MAX + 1)
- : 0);
+ BootDescriptionSize = StrSize (BootDescription);
+ BootOptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
+ BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize;
+ }
// Compute the size of the FilePath list
- FilePathListLength = 0;
- DevicePathNode = DevicePath;
- while (!IsDevicePathEndType (DevicePathNode)) {
- FilePathListLength += DevicePathNodeLength (DevicePathNode);
- DevicePathNode = NextDevicePathNode (DevicePathNode);
- }
- // Add the length of the DevicePath EndType
- FilePathListLength += DevicePathNodeLength (DevicePathNode);
-
- InitrdPathListLength = 0;
- if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG && BootArguments->LinuxAtagArguments.InitrdPathList != NULL) {
- // Compute the size of the InitrdPath list
- InitrdPathNode = BootArguments->LinuxAtagArguments.InitrdPathList;
- while (!IsDevicePathEndType (InitrdPathNode)) {
- InitrdPathListLength += DevicePathNodeLength (InitrdPathNode);
- InitrdPathNode = NextDevicePathNode (InitrdPathNode);
- }
- // Add the length of the DevicePath EndType
- InitrdPathListLength += DevicePathNodeLength (InitrdPathNode);
- }
+ FilePathListLength = GetUnalignedDevicePathSize (DevicePath);
// Allocate the memory for the EFI Load Option
EfiLoadOptionSize = sizeof(UINT32) + sizeof(UINT16) + BootDescriptionSize + FilePathListLength + BootOptionalDataSize;
@@ -265,53 +277,40 @@ BootOptionSetFields ( // File path fields
BootOption->FilePathList = (EFI_DEVICE_PATH_PROTOCOL*)EfiLoadOptionPtr;
- DevicePathNode = DevicePath;
- while (!IsDevicePathEndType (DevicePathNode)) {
- NodeLength = DevicePathNodeLength(DevicePathNode);
- CopyMem (EfiLoadOptionPtr, DevicePathNode, NodeLength);
- EfiLoadOptionPtr += NodeLength;
- DevicePathNode = NextDevicePathNode (DevicePathNode);
- }
-
- // Set the End Device Path Type
- SetDevicePathEndNode (EfiLoadOptionPtr);
- EfiLoadOptionPtr = (UINT8 *)EfiLoadOptionPtr + sizeof(EFI_DEVICE_PATH);
+ CopyMem (EfiLoadOptionPtr, DevicePath, FilePathListLength);
+ EfiLoadOptionPtr += FilePathListLength;
// Optional Data fields, Do unaligned writes
- WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, BootType);
+ BootOption->OptionalData = EfiLoadOptionPtr;
+ WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);
+ WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);
- BootOption->OptionalData = (BDS_LOADER_OPTIONAL_DATA *)EfiLoadOptionPtr;
+ OptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {
- CopyMem (&((BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxAtagArguments.CmdLine,
- BootArguments->LinuxAtagArguments.CmdLine,
- AsciiStrSize(BootArguments->LinuxAtagArguments.CmdLine));
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
+ SrcLinuxArguments = &(BootArguments->LinuxArguments);
+ DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
- WriteUnaligned32 ((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathListLength), InitrdPathListLength);
+ WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);
+ WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);
+ OptionalDataSize += sizeof (ARM_BDS_LINUX_ARGUMENTS);
- if ((EFI_DEVICE_PATH_PROTOCOL*)ReadUnaligned32((UINT32 *)&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList) != NULL
- && BootArguments->LinuxAtagArguments.InitrdPathList != NULL) {
- InitrdPathListPtr = AllocatePool(InitrdPathListLength);
- WriteUnaligned32 ((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList), (UINT32)InitrdPathListPtr);
- InitrdPathNode = BootArguments->LinuxAtagArguments.InitrdPathList;
-
- while (!IsDevicePathEndType (InitrdPathNode)) {
- NodeLength = DevicePathNodeLength(InitrdPathNode);
- CopyMem (InitrdPathListPtr, InitrdPathNode, NodeLength);
- InitrdPathListPtr += NodeLength;
- InitrdPathNode = NextDevicePathNode (InitrdPathNode);
- }
+ if (SrcLinuxArguments->CmdLineSize > 0) {
+ CopyMem ((VOID*)(DestLinuxArguments + 1), (VOID*)(SrcLinuxArguments + 1), SrcLinuxArguments->CmdLineSize);
+ OptionalDataSize += SrcLinuxArguments->CmdLineSize;
+ }
- // Set the End Device Path Type
- SetDevicePathEndNode (InitrdPathListPtr);
- } else {
- WriteUnaligned32 ((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList), (UINT32)NULL);
+ if (SrcLinuxArguments->InitrdSize > 0) {
+ InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);
+ CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
}
}
+ BootOption->OptionalDataSize = OptionalDataSize;
+
// If this function is called at the creation of the Boot Device entry (not at the update) the
// BootOption->LoadOptionSize must be zero then we get a new BootIndex for this entry
if (BootOption->LoadOptionSize == 0) {
- BootOption->LoadOptionIndex = BootOptionAllocateBootIndex();
+ BootOption->LoadOptionIndex = BootOptionAllocateBootIndex ();
}
// Fill the EFI Load option fields
@@ -326,8 +325,8 @@ BootOptionCreate ( IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN BDS_LOADER_TYPE BootType,
- IN BDS_LOADER_ARGUMENTS* BootArguments,
+ IN ARM_BDS_LOADER_TYPE BootType,
+ IN ARM_BDS_LOADER_ARGUMENTS* BootArguments,
OUT BDS_LOAD_OPTION **BdsLoadOption
)
{
@@ -387,12 +386,12 @@ BootOptionCreate ( EFI_STATUS
BootOptionUpdate (
- IN BDS_LOAD_OPTION *BdsLoadOption,
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
+ IN BDS_LOAD_OPTION* BdsLoadOption,
+ IN UINT32 Attributes,
+ IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN BDS_LOADER_TYPE BootType,
- IN BDS_LOADER_ARGUMENTS* BootArguments
+ IN ARM_BDS_LOADER_TYPE BootType,
+ IN ARM_BDS_LOADER_ARGUMENTS* BootArguments
)
{
EFI_STATUS Status;
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c index a7e83b828b..4c37c9de88 100644 --- a/ArmPlatformPkg/Bds/BootOptionSupport.c +++ b/ArmPlatformPkg/Bds/BootOptionSupport.c @@ -35,7 +35,7 @@ EFI_STATUS BdsLoadOptionFileSystemCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -43,7 +43,7 @@ EFI_STATUS BdsLoadOptionFileSystemUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -61,7 +61,7 @@ EFI_STATUS BdsLoadOptionMemMapCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -69,7 +69,7 @@ EFI_STATUS BdsLoadOptionMemMapUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -87,7 +87,7 @@ EFI_STATUS BdsLoadOptionPxeCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -95,7 +95,7 @@ EFI_STATUS BdsLoadOptionPxeUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -113,7 +113,7 @@ EFI_STATUS BdsLoadOptionTftpCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -121,7 +121,7 @@ EFI_STATUS BdsLoadOptionTftpUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
);
@@ -131,34 +131,34 @@ BdsLoadOptionTftpIsSupported ( );
BDS_LOAD_OPTION_SUPPORT BdsLoadOptionSupportList[] = {
- {
- BDS_DEVICE_FILESYSTEM,
- BdsLoadOptionFileSystemList,
- BdsLoadOptionFileSystemIsSupported,
- BdsLoadOptionFileSystemCreateDevicePath,
- BdsLoadOptionFileSystemUpdateDevicePath
- },
- {
- BDS_DEVICE_MEMMAP,
- BdsLoadOptionMemMapList,
- BdsLoadOptionMemMapIsSupported,
- BdsLoadOptionMemMapCreateDevicePath,
- BdsLoadOptionMemMapUpdateDevicePath
- },
- {
- BDS_DEVICE_PXE,
- BdsLoadOptionPxeList,
- BdsLoadOptionPxeIsSupported,
- BdsLoadOptionPxeCreateDevicePath,
- BdsLoadOptionPxeUpdateDevicePath
- },
- {
- BDS_DEVICE_TFTP,
- BdsLoadOptionTftpList,
- BdsLoadOptionTftpIsSupported,
- BdsLoadOptionTftpCreateDevicePath,
- BdsLoadOptionTftpUpdateDevicePath
- }
+ {
+ BDS_DEVICE_FILESYSTEM,
+ BdsLoadOptionFileSystemList,
+ BdsLoadOptionFileSystemIsSupported,
+ BdsLoadOptionFileSystemCreateDevicePath,
+ BdsLoadOptionFileSystemUpdateDevicePath
+ },
+ {
+ BDS_DEVICE_MEMMAP,
+ BdsLoadOptionMemMapList,
+ BdsLoadOptionMemMapIsSupported,
+ BdsLoadOptionMemMapCreateDevicePath,
+ BdsLoadOptionMemMapUpdateDevicePath
+ },
+ {
+ BDS_DEVICE_PXE,
+ BdsLoadOptionPxeList,
+ BdsLoadOptionPxeIsSupported,
+ BdsLoadOptionPxeCreateDevicePath,
+ BdsLoadOptionPxeUpdateDevicePath
+ },
+ {
+ BDS_DEVICE_TFTP,
+ BdsLoadOptionTftpList,
+ BdsLoadOptionTftpIsSupported,
+ BdsLoadOptionTftpCreateDevicePath,
+ BdsLoadOptionTftpUpdateDevicePath
+ }
};
EFI_STATUS
@@ -172,7 +172,7 @@ BootDeviceListSupportedInit ( InitializeListHead (SupportedDeviceList);
for (Index = 0; Index < BDS_DEVICE_MAX; Index++) {
- BdsLoadOptionSupportList[Index].ListDevices(SupportedDeviceList);
+ BdsLoadOptionSupportList[Index].ListDevices (SupportedDeviceList);
}
return EFI_SUCCESS;
@@ -192,7 +192,7 @@ BootDeviceListSupportedFree ( SupportedDevice = SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry);
Entry = RemoveEntryList (Entry);
if (SupportedDevice != Except) {
- FreePool(SupportedDevice);
+ FreePool (SupportedDevice);
}
}
@@ -222,7 +222,7 @@ STATIC EFI_STATUS
BootDeviceGetType (
IN CHAR16* FileName,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -295,7 +295,7 @@ BdsLoadOptionFileSystemList ( Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
if (!EFI_ERROR(Status)) {
// Allocate BDS Supported Device structure
- SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool(sizeof(BDS_SUPPORTED_DEVICE));
+ SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool (sizeof(BDS_SUPPORTED_DEVICE));
FileProtocol = NULL;
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FileProtocol);
@@ -329,7 +329,7 @@ EFI_STATUS BdsLoadOptionFileSystemCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -373,7 +373,7 @@ EFI_STATUS BdsLoadOptionFileSystemUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -527,7 +527,7 @@ EFI_STATUS BdsLoadOptionMemMapCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -549,7 +549,7 @@ BdsLoadOptionMemMapCreateDevicePath ( }
// Create the MemMap Device Path Node
- MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool(sizeof(MEMMAP_DEVICE_PATH));
+ MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool (sizeof(MEMMAP_DEVICE_PATH));
MemMapDevicePath->Header.Type = HARDWARE_DEVICE_PATH;
MemMapDevicePath->Header.SubType = HW_MEMMAP_DP;
MemMapDevicePath->MemoryType = EfiBootServicesData;
@@ -570,7 +570,7 @@ EFI_STATUS BdsLoadOptionMemMapUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -674,7 +674,7 @@ EFI_STATUS BdsLoadOptionPxeCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -688,7 +688,7 @@ EFI_STATUS BdsLoadOptionPxeUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -775,7 +775,7 @@ EFI_STATUS BdsLoadOptionTftpCreateDevicePath (
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
@@ -854,7 +854,7 @@ EFI_STATUS BdsLoadOptionTftpUpdateDevicePath (
IN EFI_DEVICE_PATH *OldDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,
- OUT BDS_LOADER_TYPE *BootType,
+ OUT ARM_BDS_LOADER_TYPE *BootType,
OUT UINT32 *Attributes
)
{
|