Port PlatformDriOverrideDxe into R9.
[mirror_edk2.git] / MdeModulePkg / Library / DxePlatDriOverLib / PlatDriOver.h
1 /** @file
2
3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 PlatDriOver.h
15
16 Abstract:
17
18
19 **/
20
21 #ifndef _PLAT_DRI_OVER_H_
22 #define _PLAT_DRI_OVER_H_
23
24 #include <PiDxe.h>
25
26 #include <Protocol/FirmwareVolume2.h>
27 #include <Protocol/LoadedImage.h>
28 #include <Protocol/PlatformDriverOverride.h>
29 #include <Protocol/DevicePath.h>
30 #include <Protocol/DriverBinding.h>
31 #include <Protocol/BusSpecificDriverOverride.h>
32
33 #include <Library/BaseLib.h>
34 #include <Library/DebugLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/PrintLib.h>
37 #include <Library/UefiRuntimeServicesTableLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/UefiLib.h>
40 #include <Library/DevicePathLib.h>
41 #include <Library/MemoryAllocationLib.h>
42 #include <Library/DxeServicesTableLib.h>
43 #include <Library/PlatDriOverLib.h>
44
45 #include <Guid/OverrideVariable.h>
46
47
48 #define PLATFORM_OVERRIDE_ITEM_SIGNATURE EFI_SIGNATURE_32('p','d','o','i')
49 typedef struct _PLATFORM_OVERRIDE_ITEM{
50 UINTN Signature;
51 LIST_ENTRY Link;
52 UINT32 DriverInfoNum;
53 EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath;
54 LIST_ENTRY DriverInfoList; //DRIVER_IMAGE_INFO List
55 EFI_HANDLE LastReturnedImageHandle;
56 } PLATFORM_OVERRIDE_ITEM;
57
58 #define DRIVER_IMAGE_INFO_SIGNATURE EFI_SIGNATURE_32('p','d','i','i')
59 typedef struct _DRIVER_IMAGE_INFO{
60 UINTN Signature;
61 LIST_ENTRY Link;
62 EFI_HANDLE ImageHandle;
63 EFI_DEVICE_PATH_PROTOCOL *DriverImagePath;
64 BOOLEAN UnLoadable;
65 BOOLEAN UnStartable;
66 } DRIVER_IMAGE_INFO;
67
68 #define DEVICE_PATH_STACK_ITEM_SIGNATURE EFI_SIGNATURE_32('d','p','s','i')
69 typedef struct _DEVICE_PATH_STACK_ITEM{
70 UINTN Signature;
71 LIST_ENTRY Link;
72 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
73 } DEVICE_PATH_STACK_ITEM;
74
75 EFI_STATUS
76 EFIAPI
77 PushDevPathStack (
78 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
79 );
80
81 EFI_STATUS
82 EFIAPI
83 PopDevPathStack (
84 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
85 );
86
87 BOOLEAN
88 EFIAPI
89 CheckExistInStack (
90 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
91 );
92
93 EFI_STATUS
94 EFIAPI
95 UpdateFvFileDevicePath (
96 IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
97 IN EFI_GUID *FileGuid,
98 IN EFI_HANDLE CallerImageHandle
99 );
100
101 VOID *
102 GetVariableAndSize (
103 IN CHAR16 *Name,
104 IN EFI_GUID *VendorGuid,
105 OUT UINTN *VariableSize
106 );
107
108 EFI_STATUS
109 ConnectDevicePath (
110 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
111 );
112
113 EFI_STATUS
114 BdsConnectDeviceByPciClassType (
115 UINT8 ClassType,
116 UINT8 SubClassCode,
117 UINT8 PI,
118 BOOLEAN Recursive
119 );
120
121 #endif