]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Include/Library/BdsLib.h
ArmPkg: Move IS_DEVICE_PATH_NODE for sharing
[mirror_edk2.git] / ArmPkg / Include / Library / BdsLib.h
index d16748da46f32818517a34585c3f150b524880c0..4528c2e8739b2abb586643b09665af76dab7a733 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2013, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2013-2015, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
 #ifndef __BDS_ENTRY_H__\r
 #define __BDS_ENTRY_H__\r
 \r
-typedef UINT8* EFI_LOAD_OPTION;\r
+#define IS_DEVICE_PATH_NODE(node,type,subtype)    \\r
+        (((node)->Type == (type)) && ((node)->SubType == (subtype)))\r
 \r
 /**\r
   This is defined by the UEFI specs, don't change it\r
 **/\r
 typedef struct {\r
   UINT16                      LoadOptionIndex;\r
-  EFI_LOAD_OPTION             LoadOption;\r
+  EFI_LOAD_OPTION             *LoadOption;\r
   UINTN                       LoadOptionSize;\r
 \r
   UINT32                      Attributes;\r
@@ -66,6 +67,23 @@ BdsConnectAllDrivers (
   VOID\r
   );\r
 \r
+/**\r
+  Return the value of a global variable defined by its VariableName.\r
+  The variable must be defined with the VendorGuid gEfiGlobalVariableGuid.\r
+\r
+  @param  VariableName          A Null-terminated string that is the name of the vendor's\r
+                                variable.\r
+  @param  DefaultValue          Value returned by the function if the variable does not exist\r
+  @param  DataSize              On input, the size in bytes of the return Data buffer.\r
+                                On output the size of data returned in Data.\r
+  @param  Value                 Value read from the UEFI Variable or copy of the default value\r
+                                if the UEFI Variable does not exist\r
+\r
+  @retval EFI_SUCCESS           All drivers have been connected\r
+  @retval EFI_NOT_FOUND         No handles match the search.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not resource pool memory to store the matching results.\r
+\r
+**/\r
 EFI_STATUS\r
 GetGlobalEnvironmentVariable (\r
   IN     CONST CHAR16*   VariableName,\r
@@ -74,6 +92,23 @@ GetGlobalEnvironmentVariable (
   OUT    VOID**          Value\r
   );\r
 \r
+/**\r
+  Return the value of the variable defined by its VariableName and VendorGuid\r
+\r
+  @param  VariableName          A Null-terminated string that is the name of the vendor's\r
+                                variable.\r
+  @param  VendorGuid            A unique identifier for the vendor.\r
+  @param  DefaultValue          Value returned by the function if the variable does not exist\r
+  @param  DataSize              On input, the size in bytes of the return Data buffer.\r
+                                On output the size of data returned in Data.\r
+  @param  Value                 Value read from the UEFI Variable or copy of the default value\r
+                                if the UEFI Variable does not exist\r
+\r
+  @retval EFI_SUCCESS           All drivers have been connected\r
+  @retval EFI_NOT_FOUND         No handles match the search.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not resource pool memory to store the matching results.\r
+\r
+**/\r
 EFI_STATUS\r
 GetEnvironmentVariable (\r
   IN     CONST CHAR16*   VariableName,\r
@@ -106,10 +141,10 @@ BootOptionAllocateBootIndex (
   );\r
 \r
 /**\r
-  Start a Linux kernel from a Device Path\r
+  Start an EFI Application from a Device Path\r
 \r
-  @param  LinuxKernel           Device Path to the Linux Kernel\r
-  @param  Parameters            Linux kernel arguments\r
+  @param  ParentImageHandle     Handle of the calling image\r
+  @param  DevicePath            Location of the EFI Application\r
 \r
   @retval EFI_SUCCESS           All drivers have been connected\r
   @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found\r
@@ -117,75 +152,61 @@ BootOptionAllocateBootIndex (
 \r
 **/\r
 EFI_STATUS\r
-BdsBootLinuxAtag (\r
-  IN  EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,\r
-  IN  CONST CHAR8*              Arguments\r
+BdsStartEfiApplication (\r
+  IN EFI_HANDLE                  ParentImageHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,\r
+  IN UINTN                       LoadOptionsSize,\r
+  IN VOID*                       LoadOptions\r
   );\r
 \r
-/**\r
-  Start a Linux kernel from a Device Path\r
-\r
-  @param  LinuxKernel           Device Path to the Linux Kernel\r
-  @param  Parameters            Linux kernel arguments\r
-  @param  Fdt                   Device Path to the Flat Device Tree\r
-\r
-  @retval EFI_SUCCESS           All drivers have been connected\r
-  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found\r
-  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.\r
+EFI_STATUS\r
+BdsLoadImage (\r
+  IN     EFI_DEVICE_PATH       *DevicePath,\r
+  IN     EFI_ALLOCATE_TYPE     Type,\r
+  IN OUT EFI_PHYSICAL_ADDRESS* Image,\r
+  OUT    UINTN                 *FileSize\r
+  );\r
 \r
-**/\r
+/**\r
+ * Call BS.ExitBootServices with the appropriate Memory Map information\r
+ */\r
 EFI_STATUS\r
-BdsBootLinuxFdt (\r
-  IN  EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,\r
-  IN  CONST CHAR8*              Arguments,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath\r
+ShutdownUefiBootServices (\r
+  VOID\r
   );\r
 \r
 /**\r
-  Start an EFI Application from a Device Path\r
+  Locate an EFI application in a the Firmware Volumes by its name\r
 \r
-  @param  ParentImageHandle     Handle of the calling image\r
-  @param  DevicePath            Location of the EFI Application\r
+  @param  EfiAppGuid            Guid of the EFI Application into the Firmware Volume\r
+  @param  DevicePath            EFI Device Path of the EFI application\r
 \r
-  @retval EFI_SUCCESS           All drivers have been connected\r
-  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found\r
-  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.\r
+  @return EFI_SUCCESS           The function completed successfully.\r
+  @return EFI_NOT_FOUND         The protocol could not be located.\r
+  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the protocol.\r
 \r
 **/\r
 EFI_STATUS\r
-BdsStartEfiApplication (\r
-  IN EFI_HANDLE                  ParentImageHandle,\r
-  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,\r
-  IN UINTN                       LoadOptionsSize,\r
-  IN VOID*                       LoadOptions\r
+LocateEfiApplicationInFvByName (\r
+  IN  CONST CHAR16*             EfiAppName,\r
+  OUT EFI_DEVICE_PATH           **DevicePath\r
   );\r
 \r
 /**\r
-  Start an EFI Application from any Firmware Volume\r
+  Locate an EFI application in a the Firmware Volumes by its GUID\r
 \r
-  @param  EfiApp                EFI Application Name\r
+  @param  EfiAppGuid            Guid of the EFI Application into the Firmware Volume\r
+  @param  DevicePath            EFI Device Path of the EFI application\r
 \r
-  @retval EFI_SUCCESS           All drivers have been connected\r
-  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found\r
-  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.\r
+  @return EFI_SUCCESS           The function completed successfully.\r
+  @return EFI_NOT_FOUND         The protocol could not be located.\r
+  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the protocol.\r
 \r
 **/\r
 EFI_STATUS\r
-BdsLoadApplication (\r
-  IN EFI_HANDLE                  ParentImageHandle,\r
-  IN CHAR16*                     EfiApp,\r
-  IN UINTN                       LoadOptionsSize,\r
-  IN VOID*                       LoadOptions\r
-  );\r
-\r
-EFI_STATUS\r
-BdsLoadImage (\r
-  IN     EFI_DEVICE_PATH       *DevicePath,\r
-  IN     EFI_ALLOCATE_TYPE     Type,\r
-  IN OUT EFI_PHYSICAL_ADDRESS* Image,\r
-  OUT    UINTN                 *FileSize\r
+LocateEfiApplicationInFvByGuid (\r
+  IN  CONST EFI_GUID            *EfiAppGuid,\r
+  OUT EFI_DEVICE_PATH           **DevicePath\r
   );\r
 \r
 #endif\r