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