summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorRonald Cron <ronald.cron@arm.com>2014-07-29 14:19:02 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-29 14:19:02 +0000
commit22a50a13e555102e1751c2f6665eb67855b43473 (patch)
tree99f553973497d3a6663804a194dcadddb4533158 /ArmPlatformPkg
parent66982010ed7350017f9f6f89b73137d4f92021df (diff)
ArmPlatformPkg/Bds: Corrected boot type detection
Corrected the detection of file system and memory map boot option types. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15717 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/Bds/BootOptionSupport.c80
1 files changed, 71 insertions, 9 deletions
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c
index 3eab0da83..d54361af0 100644
--- a/ArmPlatformPkg/Bds/BootOptionSupport.c
+++ b/ArmPlatformPkg/Bds/BootOptionSupport.c
@@ -458,16 +458,47 @@ BdsLoadOptionFileSystemUpdateDevicePath (
return EFI_SUCCESS;
}
+/**
+ Check if a boot option path is a file system boot option path or not.
+
+ The device specified by the beginning of the path has to support the Simple File
+ System protocol. Furthermore, the remaining part of the path has to be composed of
+ a single node of type MEDIA_DEVICE_PATH and sub-type MEDIA_FILEPATH_DP.
+
+ @param[in] DevicePath Complete device path of a boot option.
+
+ @retval FALSE The boot option path has not been identified as that of a
+ file system boot option.
+ @retval TRUE The boot option path is a file system boot option.
+**/
BOOLEAN
BdsLoadOptionFileSystemIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
+ IN EFI_DEVICE_PATH *DevicePath
)
{
- EFI_DEVICE_PATH* DevicePathNode;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_DEVICE_PATH *RemainingDevicePath;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileProtocol;
- DevicePathNode = GetLastDevicePathNode (DevicePath);
+ Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiSimpleFileSystemProtocolGuid,
+ (VOID **)(&FileProtocol)
+ );
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
- return IS_DEVICE_PATH_NODE(DevicePathNode,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP);
+ if (!IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP))
+ return FALSE;
+
+ return TRUE;
}
STATIC
@@ -643,16 +674,47 @@ BdsLoadOptionMemMapUpdateDevicePath (
return Status;
}
+/**
+ Check if a boot option path is a memory map boot option path or not.
+
+ The device specified by the beginning of the path has to support the BlockIo
+ protocol. Furthermore, the remaining part of the path has to be composed of
+ a single node of type HARDWARE_DEVICE_PATH and sub-type HW_MEMMAP_DP.
+
+ @param[in] DevicePath Complete device path of a boot option.
+
+ @retval FALSE The boot option path has not been identified as that of a
+ memory map boot option.
+ @retval TRUE The boot option path is a a memory map boot option.
+**/
BOOLEAN
BdsLoadOptionMemMapIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
+ IN EFI_DEVICE_PATH *DevicePath
)
{
- EFI_DEVICE_PATH* DevicePathNode;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_DEVICE_PATH *RemainingDevicePath;
+ EFI_BLOCK_IO_PROTOCOL *BlockIoProtocol;
+
+ Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
- DevicePathNode = GetLastDevicePathNode (DevicePath);
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiBlockIoProtocolGuid,
+ (VOID **)(&BlockIoProtocol)
+ );
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
- return IS_DEVICE_PATH_NODE(DevicePathNode,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP);
+ if (!IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP))
+ return FALSE;
+
+ return TRUE;
}
EFI_STATUS
@@ -748,7 +810,7 @@ BdsLoadOptionPxeUpdateDevicePath (
BOOLEAN
BdsLoadOptionPxeIsSupported (
- IN EFI_DEVICE_PATH *DevicePath
+ IN EFI_DEVICE_PATH *DevicePath
)
{
EFI_STATUS Status;