]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciOptionRomSupport.h
CommitLineData
9060e3ec 1/** @file\r
fcdfcdbf 2 PCI Rom supporting functions declaration for PCI Bus module.\r
9060e3ec 3\r
fcdfcdbf 4Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
9060e3ec 6\r
7**/\r
8\r
9#ifndef _EFI_PCI_OPTION_ROM_SUPPORT_H_\r
10#define _EFI_PCI_OPTION_ROM_SUPPORT_H_\r
11\r
12\r
13/**\r
14 Initialize a PCI LoadFile2 instance.\r
15\r
16 @param PciIoDevice PCI IO Device.\r
17\r
18**/\r
19VOID\r
20InitializePciLoadFile2 (\r
21 IN PCI_IO_DEVICE *PciIoDevice\r
22 );\r
23\r
24/**\r
25 Causes the driver to load a specified file.\r
26\r
27 @param This Indicates a pointer to the calling context.\r
28 @param FilePath The device specific path of the file to load.\r
29 @param BootPolicy Should always be FALSE.\r
30 @param BufferSize On input the size of Buffer in bytes. On output with a return\r
31 code of EFI_SUCCESS, the amount of data transferred to Buffer.\r
32 On output with a return code of EFI_BUFFER_TOO_SMALL,\r
33 the size of Buffer required to retrieve the requested file.\r
34 @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,\r
35 then no the size of the requested file is returned in BufferSize.\r
36\r
37 @retval EFI_SUCCESS The file was loaded.\r
38 @retval EFI_UNSUPPORTED BootPolicy is TRUE.\r
39 @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or\r
40 BufferSize is NULL.\r
41 @retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.\r
42 @retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.\r
43 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.\r
44 BufferSize has been updated with the size needed to complete the request.\r
45\r
46**/\r
47EFI_STATUS\r
48EFIAPI\r
49LoadFile2 (\r
50 IN EFI_LOAD_FILE2_PROTOCOL *This,\r
51 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
52 IN BOOLEAN BootPolicy,\r
53 IN OUT UINTN *BufferSize,\r
54 IN VOID *Buffer OPTIONAL\r
55 );\r
56\r
483d0d85
RN
57/**\r
58 Check if the RomImage contains EFI Images.\r
59\r
60 @param RomImage The ROM address of Image for check.\r
61 @param RomSize Size of ROM for check.\r
62\r
63 @retval TRUE ROM contain EFI Image.\r
64 @retval FALSE ROM not contain EFI Image.\r
65\r
66**/\r
67BOOLEAN\r
68ContainEfiImage (\r
69 IN VOID *RomImage,\r
70 IN UINT64 RomSize\r
71 );\r
72\r
9060e3ec 73/**\r
74 Get Pci device's oprom information.\r
75\r
76 @param PciIoDevice Input Pci device instance.\r
77 Output Pci device instance with updated OptionRom size.\r
78\r
79 @retval EFI_NOT_FOUND Pci device has not Option Rom.\r
80 @retval EFI_SUCCESS Pci device has Option Rom.\r
81\r
82**/\r
83EFI_STATUS\r
84GetOpRomInfo (\r
85 IN OUT PCI_IO_DEVICE *PciIoDevice\r
86 );\r
87\r
88/**\r
89 Load Option Rom image for specified PCI device.\r
90\r
91 @param PciDevice Pci device instance.\r
92 @param RomBase Base address of Option Rom.\r
93\r
94 @retval EFI_OUT_OF_RESOURCES No enough memory to hold image.\r
95 @retval EFI_SUCESS Successfully loaded Option Rom.\r
96\r
97**/\r
98EFI_STATUS\r
99LoadOpRomImage (\r
100 IN PCI_IO_DEVICE *PciDevice,\r
101 IN UINT64 RomBase\r
102 );\r
103\r
104/**\r
105 Enable/Disable Option Rom decode.\r
106\r
107 @param PciDevice Pci device instance.\r
108 @param RomBarIndex The BAR index of the standard PCI Configuration header to use as the\r
109 base address for resource range. The legal range for this field is 0..5.\r
110 @param RomBar Base address of Option Rom.\r
111 @param Enable Flag for enable/disable decode.\r
112\r
113**/\r
114VOID\r
115RomDecode (\r
116 IN PCI_IO_DEVICE *PciDevice,\r
117 IN UINT8 RomBarIndex,\r
118 IN UINT32 RomBar,\r
119 IN BOOLEAN Enable\r
120 );\r
121\r
122/**\r
123 Load and start the Option Rom image.\r
124\r
125 @param PciDevice Pci device instance.\r
126\r
127 @retval EFI_SUCCESS Successfully loaded and started PCI Option Rom image.\r
128 @retval EFI_NOT_FOUND Failed to process PCI Option Rom image.\r
129\r
130**/\r
131EFI_STATUS\r
132ProcessOpRomImage (\r
133 IN PCI_IO_DEVICE *PciDevice\r
134 );\r
135\r
136#endif\r