]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/PciPlatform.h
24c345b1522141ab25aff4f9406b11f9727d04a1
[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, 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 #define EFI_RESERVE_NONE_IO_ALIAS 0x0000
41 #define EFI_RESERVE_ISA_IO_ALIAS 0x0001
42 #define EFI_RESERVE_ISA_IO_NO_ALIAS 0x0002
43 #define EFI_RESERVE_VGA_IO_ALIAS 0x0004
44 #define EFI_RESERVE_VGA_IO_NO_ALIAS 0x0008
45
46
47 typedef enum {
48 ChipsetEntry,
49 ChipsetExit,
50 MaximumChipsetPhase
51 } EFI_PCI_CHIPSET_EXECUTION_PHASE;
52
53
54 /**
55 The PlatformNotify() function can be used to notify the platform driver so that
56 it can perform platform-specific actions. No specific actions are required.
57 Eight notification points are defined at this time. More synchronization points
58 may be added as required in the future. The PCI bus driver calls the platform driver
59 twice for every Phase-once before the PCI Host Bridge Resource Allocation Protocol
60 driver is notified, and once after the PCI Host Bridge Resource Allocation Protocol
61 driver has been notified.
62 This member function may not perform any error checking on the input parameters. It
63 also does not return any error codes. If this member function detects any error condition,
64 it needs to handle those errors on its own because there is no way to surface any
65 errors to the caller.
66
67 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
68 @param HostBridge The handle of the host bridge controller.
69 @param Phase The phase of the PCI bus enumeration.
70 @param ChipsetPhase Defines the execution phase of the PCI chipset driver.
71
72 @retval EFI_SUCCESS The function completed successfully.
73
74 **/
75 typedef
76 EFI_STATUS
77 (EFIAPI *EFI_PCI_PLATFORM_PHASE_NOTIFY)(
78 IN EFI_PCI_PLATFORM_PROTOCOL *This,
79 IN EFI_HANDLE HostBridge,
80 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
81 IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
82 )
83 ;
84
85
86 /**
87 The PlatformPrepController() function can be used to notify the platform driver so that
88 it can perform platform-specific actions. No specific actions are required.
89 Several notification points are defined at this time. More synchronization points may be
90 added as required in the future. The PCI bus driver calls the platform driver twice for
91 every PCI controller-once before the PCI Host Bridge Resource Allocation Protocol driver
92 is notified, and once after the PCI Host Bridge Resource Allocation Protocol driver has
93 been notified.
94 This member function may not perform any error checking on the input parameters. It also
95 does not return any error codes. If this member function detects any error condition, it
96 needs to handle those errors on its own because there is no way to surface any errors to
97 the caller.
98
99 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
100 @param HostBridge The associated PCI host bridge handle.
101 @param RootBridge The associated PCI root bridge handle.
102 @param PciAddress The address of the PCI device on the PCI bus.
103 @param Phase The phase of the PCI controller enumeration.
104 @param ChipsetPhase Defines the execution phase of the PCI chipset driver.
105
106 @retval EFI_SUCCESS The function completed successfully.
107
108 **/
109 typedef
110 EFI_STATUS
111 (EFIAPI *EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER)(
112 IN EFI_PCI_PLATFORM_PROTOCOL *This,
113 IN EFI_HANDLE HostBridge,
114 IN EFI_HANDLE RootBridge,
115 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
116 IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
117 IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
118 )
119 ;
120
121
122 /**
123 The GetPlatformPolicy() function retrieves the platform policy regarding PCI
124 enumeration. The PCI bus driver and the PCI Host Bridge Resource Allocation Protocol
125 driver can call this member function to retrieve the policy.
126
127 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
128 @param PciPolicy The platform policy with respect to VGA and ISA aliasing.
129
130 @retval EFI_SUCCESS The function completed successfully.
131 @retval EFI_INVALID_PARAMETER PciPolicy is NULL.
132
133 **/
134 typedef
135 EFI_STATUS
136 (EFIAPI *EFI_PCI_PLATFORM_GET_PLATFORM_POLICY)(
137 IN EFI_PCI_PLATFORM_PROTOCOL *This,
138 OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
139 )
140 ;
141
142
143 /**
144 The GetPciRom() function gets the PCI device's option ROM from a platform-specific location.
145 The option ROM will be loaded into memory. This member function is used to return an image
146 that is packaged as a PCI 2.2 option ROM. The image may contain both legacy and EFI option
147 ROMs. See the UEFI 2.0 Specification for details. This member function can be used to return
148 option ROM images for embedded controllers. Option ROMs for embedded controllers are typically
149 stored in platform-specific storage, and this member function can retrieve it from that storage
150 and return it to the PCI bus driver. The PCI bus driver will call this member function before
151 scanning the ROM that is attached to any controller, which allows a platform to specify a ROM
152 image that is different from the ROM image on a PCI card.
153
154 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
155 @param PciHandle The handle of the PCI device.
156 @param RomImage If the call succeeds, the pointer to the pointer to the option ROM image.
157 Otherwise, this field is undefined. The memory for RomImage is allocated
158 by EFI_PCI_PLATFORM_PROTOCOL.GetPciRom() using the EFI Boot Service AllocatePool().
159 It is the caller's responsibility to free the memory using the EFI Boot Service
160 FreePool(), when the caller is done with the option ROM.
161 @param RomSize If the call succeeds, a pointer to the size of the option ROM size. Otherwise,
162 this field is undefined.
163
164 @retval EFI_SUCCESS The option ROM was available for this device and loaded into memory.
165 @retval EFI_NOT_FOUND No option ROM was available for this device.
166 @retval EFI_OUT_OF_RESOURCES No memory was available to load the option ROM.
167 @retval EFI_DEVICE_ERROR An error occurred in getting the option ROM.
168
169 **/
170 typedef
171 EFI_STATUS
172 (EFIAPI *EFI_PCI_PLATFORM_GET_PCI_ROM)(
173 IN EFI_PCI_PLATFORM_PROTOCOL *This,
174 IN EFI_HANDLE PciHandle,
175 OUT VOID **RomImage,
176 OUT UINTN *RomSize
177 )
178 ;
179
180 /**
181 @par Protocol Description:
182 This protocol provides the interface between the PCI bus driver/PCI Host
183 Bridge Resource Allocation driver and a platform-specific driver to describe
184 the unique features of a platform.
185
186 @param PlatformNotify
187 The notification from the PCI bus enumerator to the platform that it is
188 about to enter a certain phase during the enumeration process.
189
190 @param PlatformPrepController
191 The notification from the PCI bus enumerator to the platform for each PCI
192 controller at several predefined points during PCI controller initialization.
193
194 @param GetPlatformPolicy
195 Retrieves the platform policy regarding enumeration.
196
197 @param GetPciRom
198 Gets the PCI device's option ROM from a platform-specific location.
199
200 **/
201 struct _EFI_PCI_PLATFORM_PROTOCOL {
202 EFI_PCI_PLATFORM_PHASE_NOTIFY PhaseNotify;
203 EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER PlatformPrepController;
204 EFI_PCI_PLATFORM_GET_PLATFORM_POLICY GetPlatformPolicy;
205 EFI_PCI_PLATFORM_GET_PCI_ROM GetPciRom;
206 };
207
208 extern EFI_GUID gEfiPciPlatformProtocolGuid;
209
210 #endif