-/** @file
-
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PlatDriOver.h
-
-Abstract:
-
-
-**/
-
-#ifndef _PLAT_DRI_OVER_H_
-#define _PLAT_DRI_OVER_H_
-
-#include <PiDxe.h>
-
+/** @file\r
+ Internal include file for Platform Driver Override Library implementation.\r
+ \r
+ Copyright (c) 2007 - 2008, Intel Corporation\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
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ 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
+**/\r
+\r
+#ifndef _PLAT_DRI_OVER_H_\r
+#define _PLAT_DRI_OVER_H_\r
+\r
+#include <PiDxe.h>\r
+\r
#include <Protocol/FirmwareVolume2.h>\r
#include <Protocol/LoadedImage.h>\r
-#include <Protocol/PlatformDriverOverride.h>\r
#include <Protocol/DevicePath.h>\r
-#include <Protocol/DriverBinding.h>\r
#include <Protocol/BusSpecificDriverOverride.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/UefiLib.h>\r
#include <Library/DevicePathLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DxeServicesTableLib.h>
-#include <Library/PlatDriOverLib.h>\r
-
-#include <Guid/OverrideVariable.h>
-
-
-#define PLATFORM_OVERRIDE_ITEM_SIGNATURE EFI_SIGNATURE_32('p','d','o','i')
- typedef struct _PLATFORM_OVERRIDE_ITEM{
- UINTN Signature;
- LIST_ENTRY Link;
- UINT32 DriverInfoNum;
- EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath;
- LIST_ENTRY DriverInfoList; //DRIVER_IMAGE_INFO List
- EFI_HANDLE LastReturnedImageHandle;
-} PLATFORM_OVERRIDE_ITEM;
-
-#define DRIVER_IMAGE_INFO_SIGNATURE EFI_SIGNATURE_32('p','d','i','i')
-typedef struct _DRIVER_IMAGE_INFO{
- UINTN Signature;
- LIST_ENTRY Link;
- EFI_HANDLE ImageHandle;
- EFI_DEVICE_PATH_PROTOCOL *DriverImagePath;
- BOOLEAN UnLoadable;
- BOOLEAN UnStartable;
-} DRIVER_IMAGE_INFO;
-
-#define DEVICE_PATH_STACK_ITEM_SIGNATURE EFI_SIGNATURE_32('d','p','s','i')
-typedef struct _DEVICE_PATH_STACK_ITEM{
- UINTN Signature;
- LIST_ENTRY Link;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} DEVICE_PATH_STACK_ITEM;
-
-EFI_STATUS
-EFIAPI
-PushDevPathStack (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PopDevPathStack (
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-BOOLEAN
-EFIAPI
-CheckExistInStack (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UpdateFvFileDevicePath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
- IN EFI_GUID *FileGuid,
- IN EFI_HANDLE CallerImageHandle
- );
-
-VOID *
-GetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VariableSize
- );
-
-EFI_STATUS
-ConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
- );
-
-EFI_STATUS
-BdsConnectDeviceByPciClassType (
- UINT8 ClassType,
- UINT8 SubClassCode,
- UINT8 PI,
- BOOLEAN Recursive
- );
-
-#endif
+#include <Library/DxeServicesTableLib.h>\r
+#include <Library/PlatformDriverOverrideLib.h>\r
+\r
+#include <Guid/OverrideVariable.h>\r
+#include <VariableFormat.h>\r
+\r
+\r
+#define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')\r
+ typedef struct _PLATFORM_OVERRIDE_ITEM {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+ UINT32 DriverInfoNum;\r
+ EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath;\r
+ ///\r
+ /// List of DRIVER_IMAGE_INFO\r
+ ///\r
+ LIST_ENTRY DriverInfoList;\r
+ EFI_HANDLE LastReturnedImageHandle;\r
+} PLATFORM_OVERRIDE_ITEM;\r
+\r
+#define DRIVER_IMAGE_INFO_SIGNATURE SIGNATURE_32('p','d','i','i')\r
+typedef struct _DRIVER_IMAGE_INFO {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+ EFI_HANDLE ImageHandle;\r
+ EFI_DEVICE_PATH_PROTOCOL *DriverImagePath;\r
+ BOOLEAN UnLoadable;\r
+ BOOLEAN UnStartable;\r
+} DRIVER_IMAGE_INFO;\r
+\r
+#define DEVICE_PATH_STACK_ITEM_SIGNATURE SIGNATURE_32('d','p','s','i')\r
+typedef struct _DEVICE_PATH_STACK_ITEM{\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+} DEVICE_PATH_STACK_ITEM;\r
+\r
+/**\r
+ Push a controller device path into a globle device path list.\r
+\r
+ @param DevicePath The controller device path to push into stack\r
+\r
+ @retval EFI_SUCCESS Device path successfully pushed into the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PushDevPathStack (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
+ );\r
+\r
+/**\r
+ Pop a controller device path from a globle device path list\r
+\r
+ @param DevicePath The controller device path popped from stack\r
+\r
+ @retval EFI_SUCCESS Controller device path successfully popped.\r
+ @retval EFI_NOT_FOUND Stack is empty.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PopDevPathStack (\r
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
+ );\r
+\r
+/**\r
+ Check whether a controller device path is in a globle device path list\r
+\r
+ @param DevicePath The controller device path to check\r
+\r
+ @retval TRUE DevicePath exists in the stack.\r
+ @retval FALSE DevicePath does not exist in the stack.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CheckExistInStack (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
+ );\r
+\r
+/**\r
+ Update the FV file device path if it is not valid.\r
+\r
+ According to a file GUID, check a Fv file device path is valid. If it is invalid,\r
+ try to return the valid device path.\r
+ FV address maybe changes for memory layout adjust from time to time, use this funciton\r
+ could promise the Fv file device path is right.\r
+\r
+ @param DevicePath On input, the FV file device path to check\r
+ On output, the updated valid FV file device path\r
+ @param FileGuid The FV file GUID\r
+ @param CallerImageHandle Image handle of the caller\r
+\r
+ @retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid\r
+ parameter\r
+ @retval EFI_UNSUPPORTED the input DevicePath does not contain FV file\r
+ GUID at all\r
+ @retval EFI_ALREADY_STARTED the input DevicePath has pointed to FV file, it\r
+ is valid\r
+ @retval EFI_SUCCESS Successfully updated the invalid DevicePath,\r
+ and return the updated device path in DevicePath\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UpdateFvFileDevicePath (\r
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
+ IN EFI_GUID *FileGuid,\r
+ IN EFI_HANDLE CallerImageHandle\r
+ );\r
+\r
+/**\r
+ Gets the data and size of a variable.\r
+\r
+ Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r
+ buffer, and the size of the buffer. If failure return NULL.\r
+\r
+ @param Name String part of EFI variable name\r
+ @param VendorGuid GUID part of EFI variable name\r
+ @param VariableSize Returns the size of the EFI variable that was\r
+ read\r
+\r
+ @return Dynamically allocated memory that contains a copy of the EFI variable.\r
+ Caller is responsible freeing the buffer.\r
+ @retval NULL Variable was not read\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetVariableAndSize (\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *VendorGuid,\r
+ OUT UINTN *VariableSize\r
+ );\r
+\r
+/**\r
+ Connect to the handle to a device on the device path.\r
+\r
+ This function will create all handles associate with every device\r
+ path node. If the handle associate with one device path node can not\r
+ be created success, then still give one chance to do the dispatch,\r
+ which load the missing drivers if possible.\r
+\r
+ @param DevicePathToConnect The device path which will be connected, it can\r
+ be a multi-instance device path\r
+\r
+ @retval EFI_SUCCESS All handles associate with every device path\r
+ node have been created\r
+ @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles\r
+ @retval EFI_NOT_FOUND Create the handle associate with one device\r
+ path node failed\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ConnectDevicePath (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r
+ );\r
+\r
+#endif\r