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