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