]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
Refine comments.
[mirror_edk2.git] / IntelFrameworkModulePkg / Include / Library / GenericBdsLib.h
index f7224f60c88a07e28a965cdf6344ee0d6091d8f3..db302c986a7f002e555508d18f26a47c791734c0 100644 (file)
@@ -1,7 +1,10 @@
 /** @file\r
-  Generic BDS library definition, include the data structure and function.\r
+  Generic BDS library defines general interfaces for BDS driver including:\r
+    1) BDS boot policy interface;\r
+    2) BDS boot device connect interface;\r
+    3) BDS Misc interfaces for mainting boot variable, ouput string.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -138,9 +141,41 @@ BdsLibBootViaBootOption (
 \r
 \r
 /**\r
-  This function will enumerate all possible boot device in the system,\r
-  it will only excute once of every boot.\r
-\r
+  For EFI boot option, BDS separate them as six types:\r
+  1. Network - The boot option points to the SimpleNetworkProtocol device. \r
+               Bds will try to automatically create this type boot option when enumerate.\r
+  2. Shell   - The boot option points to internal flash shell. \r
+               Bds will try to automatically create this type boot option when enumerate.\r
+  3. Removable BlockIo      - The boot option only points to the removable media\r
+                              device, like USB flash disk, DVD, Floppy etc.\r
+                              These device should contain a *removable* blockIo\r
+                              protocol in their device handle.\r
+                              Bds will try to automatically create this type boot option \r
+                              when enumerate.\r
+  4. Fixed BlockIo          - The boot option only points to a Fixed blockIo device, \r
+                              like HardDisk.\r
+                              These device should contain a *fixed* blockIo\r
+                              protocol in their device handle.\r
+                              BDS will skip fixed blockIo devices, and NOT\r
+                              automatically create boot option for them. But BDS \r
+                              will help to delete those fixed blockIo boot option, \r
+                              whose description rule conflict with other auto-created\r
+                              boot options.\r
+  5. Non-BlockIo Simplefile - The boot option points to a device whose handle \r
+                              has SimpleFileSystem Protocol, but has no blockio\r
+                              protocol. These devices do not offer blockIo\r
+                              protocol, but BDS still can get the \r
+                              \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem\r
+                              Protocol.\r
+  6. File    - The boot option points to a file. These boot options are usually \r
+               created by user manually or OS loader. BDS will not delete or modify\r
+               these boot options.        \r
+    \r
+  This function will enumerate all possible boot device in the system, and\r
+  automatically create boot options for Network, Shell, Removable BlockIo, \r
+  and Non-BlockIo Simplefile devices.\r
+  It will only excute once of every boot.\r
+  \r
   @param  BdsBootOptionList      The header of the link list which indexed all\r
                                  current boot options\r
 \r
@@ -380,12 +415,14 @@ BdsLibConnectDevicePath (
   );\r
 \r
 /**\r
-  This function will connect all current system handles recursively. The\r
-  connection will finish until every handle's child handle created if it have.\r
+  This function will connect all current system handles recursively. \r
+  \r
+  gBS->ConnectController() service is invoked for each handle exist in system handler buffer.\r
+  If the handle is bus type handler, all childrens also will be connected recursively\r
+  by gBS->ConnectController().\r
 \r
-  @retval EFI_SUCCESS           All handles and it's child handle have been\r
-                                connected\r
-  @retval EFI_STATUS            Return the status of gBS->LocateHandleBuffer().\r
+  @retval EFI_SUCCESS           All handles and it's child handle have been connected\r
+  @retval EFI_STATUS            Error status returned by of gBS->LocateHandleBuffer().\r
 \r
 **/\r
 EFI_STATUS\r
@@ -394,13 +431,15 @@ BdsLibConnectAllEfi (
   VOID\r
   );\r
 \r
-\r
 /**\r
-  This function will disconnect all current system handles. The disconnection\r
-  will finish until every handle have been disconnected.\r
+  This function will disconnect all current system handles. \r
+  \r
+  gBS->DisconnectController() is invoked for each handle exists in system handle buffer.\r
+  If handle is a bus type handle, all childrens also are disconnected recursively by\r
+  gBS->DisconnectController().\r
 \r
   @retval EFI_SUCCESS           All handles have been disconnected\r
-  @retval EFI_STATUS            Return the status of gBS->LocateHandleBuffer().\r
+  @retval EFI_STATUS            Error status returned by of gBS->LocateHandleBuffer().\r
 \r
 **/\r
 EFI_STATUS\r
@@ -548,9 +587,9 @@ DevicePathToStr (
 // Internal definitions\r
 //\r
 typedef struct {\r
-  CHAR16  *str;\r
-  UINTN   len;\r
-  UINTN   maxlen;\r
+  CHAR16  *Str;\r
+  UINTN   Len;\r
+  UINTN   Maxlen;\r
 } POOL_PRINT;\r
 \r
 typedef struct {\r
@@ -576,7 +615,7 @@ typedef struct {
   UINT16                    LoginOption;\r
   UINT64                    Lun;\r
   UINT16                    TargetPortalGroupTag;\r
-  CHAR16                    iSCSITargetName[1];\r
+  CHAR16                    TargetName[1];\r
 } ISCSI_DEVICE_PATH_WITH_NAME;\r
 \r
 \r
@@ -768,6 +807,26 @@ SetupResetReminder (
   VOID\r
   );\r
 \r
+\r
+//\r
+// Define the boot option default description \r
+// NOTE: This is not defined in UEFI spec.\r
+//\r
+#define DESCRIPTION_FLOPPY        L"EFI Floppy"\r
+#define DESCRIPTION_FLOPPY_NUM    L"EFI Floppy %d"\r
+#define DESCRIPTION_DVD           L"EFI DVD/CDROM"\r
+#define DESCRIPTION_DVD_NUM       L"EFI DVD/CDROM %d"\r
+#define DESCRIPTION_USB           L"EFI USB Device"\r
+#define DESCRIPTION_USB_NUM       L"EFI USB Device %d"\r
+#define DESCRIPTION_SCSI          L"EFI SCSI Device"\r
+#define DESCRIPTION_SCSI_NUM      L"EFI SCSI Device %d"\r
+#define DESCRIPTION_MISC          L"EFI Misc Device"\r
+#define DESCRIPTION_MISC_NUM      L"EFI Misc Device %d"\r
+#define DESCRIPTION_NETWORK       L"EFI Network"\r
+#define DESCRIPTION_NETWORK_NUM   L"EFI Network %d"       \r
+#define DESCRIPTION_NON_BLOCK     L"EFI Non-Block Boot Device"\r
+#define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d"\r
+\r
 //\r
 // Define the boot type which to classify the boot option type\r
 // Different boot option type could have different boot behavior\r
@@ -785,6 +844,7 @@ SetupResetReminder (
 #define  BDS_EFI_MESSAGE_ATAPI_BOOT       0x0301 // Type 03; Sub-Type 01\r
 #define  BDS_EFI_MESSAGE_SCSI_BOOT        0x0302 // Type 03; Sub-Type 02\r
 #define  BDS_EFI_MESSAGE_USB_DEVICE_BOOT  0x0305 // Type 03; Sub-Type 05\r
+#define  BDS_EFI_MESSAGE_SATA_BOOT        0x0318 // Type 03; Sub-Type 18\r
 #define  BDS_EFI_MESSAGE_MISC_BOOT        0x03FF\r
 //\r
 // Media boot type\r
@@ -881,7 +941,30 @@ BdsLibIsValidEFIBootOptDevicePath (
   IN EFI_DEVICE_PATH_PROTOCOL     *DevPath,\r
   IN BOOLEAN                      CheckMedia\r
   );\r
-  \r
+\r
+/**\r
+  Check whether the Device path in a boot option point to a valid bootable device,\r
+  And if CheckMedia is true, check the device is ready to boot now.\r
+  If Description is not NULL and the device path point to a fixed BlockIo\r
+  device, check the description whether conflict with other auto-created\r
+  boot options.\r
+\r
+  @param  DevPath     the Device path in a boot option\r
+  @param  CheckMedia  if true, check the device is ready to boot now.\r
+  @param  Description the description in a boot option\r
+\r
+  @retval TRUE        the Device path  is valid\r
+  @retval FALSE       the Device path  is invalid .\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+BdsLibIsValidEFIBootOptDevicePathExt (\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *DevPath,\r
+  IN BOOLEAN                      CheckMedia,\r
+  IN CHAR16                       *Description\r
+  );\r
+\r
 /**\r
   For a bootable Device path, return its boot type.\r
 \r
@@ -998,7 +1081,7 @@ DevPathVendor (
   The caller must free the resulting buffer.\r
 \r
   @param  Str      Tracks the allocated pool, size in use, and amount of pool allocated.\r
-  @param  fmt      The format string\r
+  @param  Fmt      The format string\r
   @param  ...      The data will be printed.\r
 \r
   @return Allocated buffer with the formatted string printed in it.\r
@@ -1010,7 +1093,7 @@ CHAR16 *
 EFIAPI\r
 CatPrint (\r
   IN OUT POOL_PRINT   *Str,\r
-  IN CHAR16           *fmt,\r
+  IN CHAR16           *Fmt,\r
   ...\r
   );\r
 \r