summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Bds/BootOption.c
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-28 11:55:11 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-28 11:55:11 +0000
commitc60ea9a873b8fe0c4b9409b28d1608f7f80c9c22 (patch)
tree93661d5a8e9bc8a446153eb8b9d8ba9e48288341 /ArmPlatformPkg/Bds/BootOption.c
parentaa95e2f79c2d8a60c30e1aa69c7cd7077779e039 (diff)
downloadedk2-platforms-c60ea9a873b8fe0c4b9409b28d1608f7f80c9c22.tar.xz
ArmPlatformPkg/Bds: Use unaligned read to access OptionalData in EFI_LOAD_OPTION
EFI_LOAD_OPTION is a packed structure. Accessing to the non aligned double word requires to use ReadUnaligned32() function. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11916 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Bds/BootOption.c')
-rw-r--r--ArmPlatformPkg/Bds/BootOption.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c
index d3c7445fae..dba0d0f639 100644
--- a/ArmPlatformPkg/Bds/BootOption.c
+++ b/ArmPlatformPkg/Bds/BootOption.c
@@ -21,20 +21,22 @@ BootOptionStart (
IN BDS_LOAD_OPTION *BootOption
)
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH* FdtDevicePath;
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH* FdtDevicePath;
+ EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
+ UINT32 LoaderType;
Status = EFI_UNSUPPORTED;
+ LoaderType = ReadUnaligned32 (&BootOption->OptionalData->LoaderType);
- if (BootOption->OptionalData->LoaderType == BDS_LOADER_EFI_APPLICATION) {
+ 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 (BootOption->OptionalData->LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {
+ } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {
Status = BdsBootLinux (BootOption->FilePathList, BootOption->OptionalData->Arguments, NULL);
- } else if (BootOption->OptionalData->LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {
+ } 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);
@@ -178,12 +180,12 @@ BootOptionAllocateBootIndex (
STATIC
EFI_STATUS
BootOptionSetFields (
- IN BDS_LOAD_OPTION *BootOption,
- IN UINT32 Attributes,
- IN CHAR16* BootDescription,
- IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN BDS_LOADER_TYPE BootType,
- IN CHAR8* BootArguments
+ IN BDS_LOAD_OPTION* BootOption,
+ IN UINT32 Attributes,
+ IN CHAR16* BootDescription,
+ IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
+ IN BDS_LOADER_TYPE BootType,
+ IN CHAR8* BootArguments
)
{
EFI_LOAD_OPTION EfiLoadOption;
@@ -273,17 +275,17 @@ BootOptionSetFields (
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 CHAR8* BootArguments,
- OUT BDS_LOAD_OPTION **BdsLoadOption
+ IN BDS_LOADER_TYPE BootType,
+ IN CHAR8* BootArguments,
+ OUT BDS_LOAD_OPTION **BdsLoadOption
)
{
- EFI_STATUS Status;
- BDS_LOAD_OPTION *BootOption;
- CHAR16 BootVariableName[9];
+ EFI_STATUS Status;
+ BDS_LOAD_OPTION *BootOption;
+ CHAR16 BootVariableName[9];
UINT16 *BootOrder;
UINTN BootOrderSize;