]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/PciPlatform.h
Refine include file for PCI Platform Protocol, and update C source code accordingly.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / PciPlatform.h
1 /** @file
2 This file declares PlatfromOpRom protocols which provides the interface between
3 the PCI bus driver/PCI Host Bridge Resource Allocation driver and a platform-specific
4 driver to describe the unique features of a platform. This
5 protocol is optional.
6
7 Copyright (c) 2007 - 2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 @par Revision Reference:
17 This protocol is defined in PCI Platform Support Specification
18 Version 0.9
19
20 **/
21
22 #ifndef _PCI_PLATFORM_H_
23 #define _PCI_PLATFORM_H_
24
25 #include <PiDxe.h>
26 #include <Protocol/PciHostBridgeResourceAllocation.h>
27
28 //
29 // Protocol for GUID.
30 //
31
32 #define EFI_PCI_PLATFORM_PROTOCOL_GUID \
33 { 0x7d75280, 0x27d4, 0x4d69, {0x90, 0xd0, 0x56, 0x43, 0xe2, 0x38, 0xb3, 0x41} }
34
35 typedef struct _EFI_PCI_PLATFORM_PROTOCOL EFI_PCI_PLATFORM_PROTOCOL;
36
37 typedef UINT32 EFI_PCI_PLATFORM_POLICY;
38
39 //
40 // There are 4 legal combinations of following bit values:
41 // EFI_RESERVE_NONE_IO_ALIAS,
42 // EFI_RESERVE_ISA_IO_ALIAS | EFI_RESERVE_VGA_IO_ALIAS,
43 // EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_ALIAS,
44 // EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_NO_ALIAS
45 //
46 #define EFI_RESERVE_NONE_IO_ALIAS 0x0000
47 #define EFI_RESERVE_ISA_IO_ALIAS 0x0001
48 #define EFI_RESERVE_ISA_IO_NO_ALIAS 0x0002
49 #define EFI_RESERVE_VGA_IO_ALIAS 0x0004
50 #define EFI_RESERVE_VGA_IO_NO_ALIAS 0x0008
51
52 ///
53 /// EFI_PCI_CHIPSET_EXECUTION_PHASE is used to call a platform protocol and execute
54 /// platform-specific code.
55 ///
56 typedef enum {
57 ///
58 /// The phase that indicates the entry point to the PCI Bus Notify phase. This
59 /// platform hook is called before the PCI bus driver calls the
60 /// EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL driver.
61 ///
62 ChipsetEntry,
63 ///
64 /// The phase that indicates the exit point to the Chipset Notify phase before
65 /// returning to the PCI Bus Driver Notify phase. This platform hook is called after
66 /// the PCI bus driver calls the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
67 /// driver.
68 ///
69 ChipsetExit,
70 MaximumChipsetPhase
71 } EFI_PCI_CHIPSET_EXECUTION_PHASE;
72
73
74 /**
75 The notification from the PCI bus enumerator to the platform that it is
76 about to enter a certain phase during the enumeration process.
77
78 The PlatformNotify() function can be used to notify the platform driver so that
79 it can perform platform-specific actions. No specific actions are required.
80 Eight notification points are defined at this time. More synchronization points
81 may be added as required in the future. The PCI bus driver calls the platform driver
82 twice for every Phase-once before the PCI Host Bridge Resource Allocation Protocol
83 driver is notified, and once after the PCI Host Bridge Resource Allocation Protocol
84 driver has been notified.
85 This member function may not perform any error checking on the input parameters. It
86 also does not return any error codes. If this member function detects any error condition,
87 it needs to handle those errors on its own because there is no way to surface any
88 errors to the caller.
89
90 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
91 @param HostBridge The handle of the host bridge controller.
92 @param Phase The phase of the PCI bus enumeration.
93 @param ChipsetPhase Defines the execution phase of the PCI chipset driver.
94
95 @retval EFI_SUCCESS The function completed successfully.
96
97 **/
98 typedef
99 EFI_STATUS
100 (EFIAPI *EFI_PCI_PLATFORM_PHASE_NOTIFY)(
101 IN EFI_PCI_PLATFORM_PROTOCOL *This,
102 IN EFI_HANDLE HostBridge,
103 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
104 IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
105 );
106
107
108 /**
109 The notification from the PCI bus enumerator to the platform for each PCI
110 controller at several predefined points during PCI controller initialization.
111
112 The PlatformPrepController() function can be used to notify the platform driver so that
113 it can perform platform-specific actions. No specific actions are required.
114 Several notification points are defined at this time. More synchronization points may be
115 added as required in the future. The PCI bus driver calls the platform driver twice for
116 every PCI controller-once before the PCI Host Bridge Resource Allocation Protocol driver
117 is notified, and once after the PCI Host Bridge Resource Allocation Protocol driver has
118 been notified.
119 This member function may not perform any error checking on the input parameters. It also
120 does not return any error codes. If this member function detects any error condition, it
121 needs to handle those errors on its own because there is no way to surface any errors to
122 the caller.
123
124 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
125 @param HostBridge The associated PCI host bridge handle.
126 @param RootBridge The associated PCI root bridge handle.
127 @param PciAddress The address of the PCI device on the PCI bus.
128 @param Phase The phase of the PCI controller enumeration.
129 @param ChipsetPhase Defines the execution phase of the PCI chipset driver.
130
131 @retval EFI_SUCCESS The function completed successfully.
132
133 **/
134 typedef
135 EFI_STATUS
136 (EFIAPI *EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER)(
137 IN EFI_PCI_PLATFORM_PROTOCOL *This,
138 IN EFI_HANDLE HostBridge,
139 IN EFI_HANDLE RootBridge,
140 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
141 IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
142 IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
143 );
144
145
146 /**
147 Retrieves the platform policy regarding enumeration.
148
149 The GetPlatformPolicy() function retrieves the platform policy regarding PCI
150 enumeration. The PCI bus driver and the PCI Host Bridge Resource Allocation Protocol
151 driver can call this member function to retrieve the policy.
152
153 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
154 @param PciPolicy The platform policy with respect to VGA and ISA aliasing.
155
156 @retval EFI_SUCCESS The function completed successfully.
157 @retval EFI_INVALID_PARAMETER PciPolicy is NULL.
158
159 **/
160 typedef
161 EFI_STATUS
162 (EFIAPI *EFI_PCI_PLATFORM_GET_PLATFORM_POLICY)(
163 IN EFI_PCI_PLATFORM_PROTOCOL *This,
164 OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
165 );
166
167
168 /**
169 Gets the PCI device's option ROM from a platform-specific location.
170
171 The GetPciRom() function gets the PCI device's option ROM from a platform-specific location.
172 The option ROM will be loaded into memory. This member function is used to return an image
173 that is packaged as a PCI 2.2 option ROM. The image may contain both legacy and EFI option
174 ROMs. See the UEFI 2.0 Specification for details. This member function can be used to return
175 option ROM images for embedded controllers. Option ROMs for embedded controllers are typically
176 stored in platform-specific storage, and this member function can retrieve it from that storage
177 and return it to the PCI bus driver. The PCI bus driver will call this member function before
178 scanning the ROM that is attached to any controller, which allows a platform to specify a ROM
179 image that is different from the ROM image on a PCI card.
180
181 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
182 @param PciHandle The handle of the PCI device.
183 @param RomImage If the call succeeds, the pointer to the pointer to the option ROM image.
184 Otherwise, this field is undefined. The memory for RomImage is allocated
185 by EFI_PCI_PLATFORM_PROTOCOL.GetPciRom() using the EFI Boot Service AllocatePool().
186 It is the caller's responsibility to free the memory using the EFI Boot Service
187 FreePool(), when the caller is done with the option ROM.
188 @param RomSize If the call succeeds, a pointer to the size of the option ROM size. Otherwise,
189 this field is undefined.
190
191 @retval EFI_SUCCESS The option ROM was available for this device and loaded into memory.
192 @retval EFI_NOT_FOUND No option ROM was available for this device.
193 @retval EFI_OUT_OF_RESOURCES No memory was available to load the option ROM.
194 @retval EFI_DEVICE_ERROR An error occurred in getting the option ROM.
195
196 **/
197 typedef
198 EFI_STATUS
199 (EFIAPI *EFI_PCI_PLATFORM_GET_PCI_ROM)(
200 IN EFI_PCI_PLATFORM_PROTOCOL *This,
201 IN EFI_HANDLE PciHandle,
202 OUT VOID **RomImage,
203 OUT UINTN *RomSize
204 );
205
206 ///
207 /// This protocol provides the interface between the PCI bus driver/PCI Host
208 /// Bridge Resource Allocation driver and a platform-specific driver to describe
209 /// the unique features of a platform.
210 ///
211 struct _EFI_PCI_PLATFORM_PROTOCOL {
212 EFI_PCI_PLATFORM_PHASE_NOTIFY PlatformNotify;
213 EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER PlatformPrepController;
214 EFI_PCI_PLATFORM_GET_PLATFORM_POLICY GetPlatformPolicy;
215 EFI_PCI_PLATFORM_GET_PCI_ROM GetPciRom;
216 };
217
218 extern EFI_GUID gEfiPciPlatformProtocolGuid;
219
220 #endif