]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.h
Code Clean for Driver PlatformDriOverrideDxe and PlatOverMngr application. And Clean...
[mirror_edk2.git] / MdeModulePkg / Universal / PlatformDriverOverride / PlatOverMngr / PlatOverMngr.h
index d414e7c09dd5ffcf9cad9b6339c6606a90033133..a4ebeff8a4ee13e3f80aa2fb2a5503c40ba4a175 100644 (file)
@@ -1,4 +1,7 @@
 /** @file\r
+  \r
+  The defintions are required both by Source code and Vfr file.\r
+  The PLAT_OVER_MNGR_DATA structure, form guid and Ifr question ID are defined. \r
 \r
 Copyright (c) 2007 - 2008, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -9,84 +12,29 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  PlatOverMngr.h\r
-\r
-Abstract:\r
-\r
-  Function prototype for platform driver override manager driver\r
-\r
 **/\r
 \r
 #ifndef _PLAT_OVER_MNGR_H_\r
 #define _PLAT_OVER_MNGR_H_\r
 \r
-#include <PiDxe.h>\r
-\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/HiiDatabase.h>\r
-#include <Protocol/LoadedImage.h>\r
-#include <Protocol/FirmwareVolumeBlock.h>\r
-#include <Protocol/FirmwareVolume2.h>\r
-#include <Protocol/PciIo.h>\r
-#include <Protocol/BusSpecificDriverOverride.h>\r
-#include <Protocol/ComponentName2.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/DevicePathToText.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/UefiApplicationEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PlatDriOverLib.h>\r
-#include <Library/IfrSupportLib.h>\r
-#include <Library/ExtendedIfrSupportLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/ExtendedHiiLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/DevicePathLib.h>\r
-\r
-#define MIN_ALIGNMENT_SIZE  4\r
-#define ALIGN_SIZE(a)       ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
-\r
-\r
-#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')\r
-#define EFI_CALLBACK_INFO_FROM_THIS(a)  CR (a, EFI_CALLBACK_INFO, ConfigAccess, EFI_CALLBACK_INFO_SIGNATURE)\r
-#define MAX_CHOICE_NUM    0x100\r
-#define UPDATE_DATA_SIZE  0x1000\r
-\r
-\r
-extern UINT8  VfrBin[];\r
-\r
-extern UINT8  PlatOverMngrStrings[];\r
-\r
-//\r
-// Following definition is the same as in vfr file\r
-//\r
 #define PLAT_OVER_MNGR_GUID \\r
   { \\r
     0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \\r
   }\r
 \r
-typedef struct {\r
-  UINT8   DriSelection[100];\r
-  UINT8   DriOrder[100];\r
-  UINT8   PciDeviceFilter;\r
-} PLAT_OVER_MNGR_DATA;\r
+//\r
+// The max number of the supported driver list.\r
+// \r
+//\r
+#define MAX_CHOICE_NUM    0x0100\r
+#define UPDATE_DATA_SIZE  0x1000\r
 \r
-#define FORM_ID_DEVICE                 0x1234\r
+#define FORM_ID_DEVICE                 0x1100\r
 #define FORM_ID_DRIVER                 0x1200\r
 #define FORM_ID_ORDER                  0x1500\r
 \r
 #define KEY_VALUE_DEVICE_OFFSET        0x0100\r
-#define KEY_VALUE_DEVICE_MAX           0x04ff\r
-\r
-#define QUESTION_ID_OFFSET             0x0500\r
+#define KEY_VALUE_DEVICE_MAX           (KEY_VALUE_DEVICE_OFFSET + MAX_CHOICE_NUM)\r
 \r
 #define KEY_VALUE_DEVICE_REFRESH       0x1234\r
 #define KEY_VALUE_DEVICE_FILTER        0x1235\r
@@ -100,151 +48,25 @@ typedef struct {
 \r
 #define VARSTORE_ID_PLAT_OVER_MNGR     0x1000\r
 \r
+typedef struct {\r
+  UINT8   DriSelection[MAX_CHOICE_NUM];\r
+  UINT8   DriOrder[MAX_CHOICE_NUM];\r
+  UINT8   PciDeviceFilter;\r
+} PLAT_OVER_MNGR_DATA;\r
+\r
 //\r
-// Question Id start from 1, so define an offset for it\r
+// Field offset of structure PLAT_OVER_MNGR_DATA\r
 //\r
 #define VAR_OFFSET(Field)              ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))\r
-\r
 #define DRIVER_SELECTION_VAR_OFFSET     (VAR_OFFSET (DriSelection))\r
 #define DRIVER_ORDER_VAR_OFFSET         (VAR_OFFSET (DriOrder))\r
 \r
+//\r
+// Tool automatic generated Question Id start from 1\r
+// In order to avoid to conflict them, the Driver Selection and Order QuestionID offset is defined from 0x0500.\r
+//\r
+#define QUESTION_ID_OFFSET              0x0500\r
 #define DRIVER_SELECTION_QUESTION_ID    (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)\r
 #define DRIVER_ORDER_QUESTION_ID        (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)\r
 \r
-typedef struct {\r
-  UINTN                           Signature;\r
-\r
-  EFI_HANDLE                      DriverHandle;\r
-  EFI_HII_HANDLE                  RegisteredHandle;\r
-  PLAT_OVER_MNGR_DATA             FakeNvData;\r
-\r
-  EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
-\r
-  EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;\r
-} EFI_CALLBACK_INFO;\r
-\r
-typedef struct {\r
-  EFI_DRIVER_CONFIGURATION_PROTOCOL         *DriverConfiguration;\r
-  EFI_HANDLE                                DriverImageHandle;\r
-  EFI_HANDLE                                ControllerHandle;\r
-  EFI_HANDLE                                ChildControllerHandle;\r
-  //\r
-  // To avoid created string leak in Hii database, use this token to reuse every token created by the driver\r
-  //\r
-  EFI_STRING_ID                             DescriptionToken;\r
-} CFG_PROTOCOL_INVOKER_CHOICE;\r
-\r
-/**\r
-  This function allows a caller to extract the current configuration for one\r
-  or more named elements from the target driver.\r
-\r
-  @param  This         Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param  Request      A null-terminated Unicode string in <ConfigRequest> format.\r
-  @param  Progress     On return, points to a character in the Request string.\r
-                       Points to the string's null terminator if request was successful.\r
-                       Points to the most recent '&' before the first failing name/value\r
-                       pair (or the beginning of the string if the failure is in the\r
-                       first name/value pair) if the request was not successful.\r
-  @param  Results      A null-terminated Unicode string in <ConfigAltResp> format which\r
-                       has all values filled in for the names in the Request string.\r
-                       String to be allocated by the called function.\r
-\r
-  @retval EFI_SUCCESS            The Results is filled with the requested values.\r
-  @retval EFI_OUT_OF_RESOURCES   Not enough memory to store the results.\r
-  @retval EFI_INVALID_PARAMETER  Request is NULL, illegal syntax, or unknown name.\r
-  @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrExtractConfig (\r
- IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  CONST EFI_STRING                       Request,\r
-  OUT EFI_STRING                             *Progress,\r
-  OUT EFI_STRING                             *Results\r
-  );\r
-\r
-/**\r
-  This function processes the results of changes in configuration.\r
-\r
-  @param  This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param  Configuration   A null-terminated Unicode string in <ConfigRequest> format.\r
-  @param  Progress        A pointer to a string filled in with the offset of the most\r
-                          recent '&' before the first failing name/value pair (or the\r
-                          beginning of the string if the failure is in the first\r
-                          name/value pair) or the terminating NULL if all was successful.\r
-\r
-  @retval EFI_SUCCESS            The Results is processed successfully.\r
-  @retval EFI_INVALID_PARAMETER  Configuration is NULL.\r
-  @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrRouteConfig (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  CONST EFI_STRING                       Configuration,\r
-  OUT EFI_STRING                             *Progress\r
-  );\r
-\r
-/**\r
-  This is the function that is called to provide results data to the driver.  This data\r
-  consists of a unique key which is used to identify what data is either being passed back\r
-  or being asked for.\r
-\r
-  @param  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param  Action         A null-terminated Unicode string in <ConfigRequest> format.\r
-  @param  KeyValue       A unique Goto OpCode callback value which record user's selection.\r
-                         0x100 <= KeyValue <0x500 : user select a controller item in the first page;\r
-                         KeyValue == 0x1234       : user select 'Refresh' in first page, or user select 'Go to Previous Menu' in second page\r
-                         KeyValue == 0x1235       : user select 'Pci device filter' in first page\r
-                         KeyValue == 0x1500       : user select 'order ... priority' item in second page\r
-                         KeyValue == 0x1800       : user select 'commint changes' in third page\r
-                         KeyValue == 0x2000       : user select 'Go to Previous Menu' in third page\r
-  @param  Type           The type of value for the question.\r
-  @param  Value          A pointer to the data being sent to the original exporting driver.\r
-  @param  ActionRequest  On return, points to the action requested by the callback function.\r
-\r
-  @retval EFI_SUCCESS    Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrCallback (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  EFI_BROWSER_ACTION                     Action,\r
-  IN  EFI_QUESTION_ID                        KeyValue,\r
-  IN  UINT8                                  Type,\r
-  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
-  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
-  );\r
-\r
-/**\r
-  Get the image name\r
-\r
-  @param Image            Image to search.\r
-\r
-  @retval !NULL           Pointer into the image name if the image name is found,\r
-  @retval NULL            Pointer to NULL if the image name is not found.\r
-\r
-**/\r
-CHAR16 *\r
-GetImageName (\r
-  IN EFI_LOADED_IMAGE_PROTOCOL *Image\r
-  );\r
-\r
-/**\r
-  Get the description string by device path.\r
-\r
-  @param  DevPath     The input device path.\r
-\r
-  @retval !NULL       The description string retured.\r
-  @retval  NULL       The description string cannot be found.\r
-\r
-**/\r
-CHAR16 *\r
-DevicePathToStr (\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
-  );\r
-\r
 #endif\r