]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/IncompatiblePciDeviceSupport.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / IncompatiblePciDeviceSupport.h
1 /** @file
2 This file declares Incompatible PCI Device Support Protocol
3
4 Allows the PCI bus driver to support resource allocation for some PCI devices
5 that do not comply with the PCI Specification.
6
7 @par Note:
8 This protocol is optional. Only those platforms that implement this protocol
9 will have the capability to support incompatible PCI devices. The absence of
10 this protocol can cause the PCI bus driver to configure these incompatible
11 PCI devices incorrectly. As a result, these devices may not work properly.
12
13 The EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL is used by the PCI bus driver
14 to support resource allocation for some PCI devices that do not comply with the
15 PCI Specification. This protocol can find some incompatible PCI devices and
16 report their special resource requirements to the PCI bus driver. The generic
17 PCI bus driver does not have prior knowledge of any incompatible PCI devices.
18 It interfaces with the EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL to find out
19 if a device is incompatible and to obtain the special configuration requirements
20 for a specific incompatible PCI device.
21
22 This protocol is optional, and only one instance of this protocol can be present
23 in the system. If a platform supports this protocol, this protocol is produced
24 by a Driver Execution Environment (DXE) driver and must be made available before
25 the Boot Device Selection (BDS) phase. The PCI bus driver will look for the
26 presence of this protocol before it begins PCI enumeration. If this protocol
27 exists in a platform, it indicates that the platform has the capability to support
28 those incompatible PCI devices. However, final support for incompatible PCI
29 devices still depends on the implementation of the PCI bus driver. The PCI bus
30 driver may fully, partially, or not even support these incompatible devices.
31
32 During PCI bus enumeration, the PCI bus driver will probe the PCI Base Address
33 Registers (BARs) for each PCI device regardless of whether the PCI device is
34 incompatible or not to determine the resource requirements so that the PCI bus
35 driver can invoke the proper PCI resources for them. Generally, this resource
36 information includes the following:
37 - Resource type
38 - Resource length
39 - Alignment
40
41 However, some incompatible PCI devices may have special requirements. As a result,
42 the length or the alignment that is derived through BAR probing may not be exactly
43 the same as the actual resource requirement of the device. For example, there
44 are some devices that request I/O resources at a length of 0x100 from their I/O
45 BAR, but these incompatible devices will never work correctly if an odd I/O base
46 address, such as 0x100, 0x300, or 0x500, is assigned to the BAR. Instead, these
47 devices request an even base address, such as 0x200 or 0x400. The Incompatible
48 PCI Device Support Protocol can then be used to obtain these special resource
49 requirements for these incompatible PCI devices. In this way, the PCI bus driver
50 will take special consideration for these devices during PCI resource allocation
51 to ensure that they can work correctly.
52
53 This protocol may support the following incompatible PCI BAR types:
54 - I/O or memory length that is different from what the BAR reports
55 - I/O or memory alignment that is different from what the BAR reports
56 - Fixed I/O or memory base address
57
58 See the Conventional PCI Specification 3.0 for the details of how a PCI BAR
59 reports the resource length and the alignment that it requires.
60
61 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
62 SPDX-License-Identifier: BSD-2-Clause-Patent
63
64 @par Revision Reference:
65 This Protocol is defined in UEFI Platform Initialization Specification 1.2
66 Volume 5: Standards
67
68 **/
69
70 #ifndef _INCOMPATIBLE_PCI_DEVICE_SUPPORT_H_
71 #define _INCOMPATIBLE_PCI_DEVICE_SUPPORT_H_
72
73 ///
74 /// Global ID for EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL
75 ///
76 #define EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL_GUID \
77 { \
78 0xeb23f55a, 0x7863, 0x4ac2, {0x8d, 0x3d, 0x95, 0x65, 0x35, 0xde, 0x03, 0x75} \
79 }
80
81 ///
82 /// Forward declaration for EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL
83 ///
84 typedef struct _EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL;
85
86 /**
87 Returns a list of ACPI resource descriptors that detail the special resource
88 configuration requirements for an incompatible PCI device.
89
90 This function returns a list of ACPI resource descriptors that detail the
91 special resource configuration requirements for an incompatible PCI device.
92
93 Prior to bus enumeration, the PCI bus driver will look for the presence
94 of the EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL. Only one instance of this
95 protocol can be present in the system. For each PCI device that the PCI bus
96 driver discovers, the PCI bus driver calls this function with the device's vendor
97 ID, device ID, revision ID, subsystem vendor ID, and subsystem device ID. If the
98 VendorId, DeviceId, RevisionId, SubsystemVendorId, or SubsystemDeviceId value is
99 set to (UINTN)-1, that field will be ignored. The ID values that are not (UINTN)-1
100 will be used to identify the current device.
101
102 This function will only return EFI_SUCCESS. However, if the device is an
103 incompatible PCI device, a list of ACPI resource descriptors will be returned
104 in Configuration. Otherwise, NULL will be returned in Configuration instead.
105 The PCI bus driver does not need to allocate memory for Configuration. However,
106 it is the PCI bus driver's responsibility to free it. The PCI bus driver then
107 can configure this device with the information that is derived from this list
108 of resource nodes, rather than the result of BAR probing.
109
110 Only the following two resource descriptor types from the ACPI Specification
111 may be used to describe the incompatible PCI device resource requirements:
112 - QWORD Address Space Descriptor (ACPI 2.0, section 6.4.3.5.1; also ACPI 3.0)
113 - End Tag (ACPI 2.0, section 6.4.2.8; also ACPI 3.0)
114
115 The QWORD Address Space Descriptor can describe memory, I/O, and bus number
116 ranges for dynamic or fixed resources. The configuration of a PCI root bridge
117 is described with one or more QWORD Address Space Descriptors, followed by an
118 End Tag. See the ACPI Specification for details on the field values.
119
120 @param[in] This Pointer to the EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL
121 instance.
122 @param[in] VendorId A unique ID to identify the manufacturer of
123 the PCI device. See the Conventional PCI
124 Specification 3.0 for details.
125 @param[in] DeviceId A unique ID to identify the particular PCI
126 device. See the Conventional PCI Specification
127 3.0 for details.
128 @param[in] RevisionId A PCI device-specific revision identifier.
129 See the Conventional PCI Specification 3.0
130 for details.
131 @param[in] SubsystemVendorId Specifies the subsystem vendor ID. See the
132 Conventional PCI Specification 3.0 for details.
133 @param[in] SubsystemDeviceId Specifies the subsystem device ID. See the
134 Conventional PCI Specification 3.0 for details.
135 @param[out] Configuration A list of ACPI resource descriptors that detail
136 the configuration requirement.
137
138 @retval EFI_SUCCESS The function always returns EFI_SUCCESS.
139
140 **/
141 typedef
142 EFI_STATUS
143 (EFIAPI *EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_CHECK_DEVICE)(
144 IN EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *This,
145 IN UINTN VendorId,
146 IN UINTN DeviceId,
147 IN UINTN RevisionId,
148 IN UINTN SubsystemVendorId,
149 IN UINTN SubsystemDeviceId,
150 OUT VOID **Configuration
151 );
152
153 ///
154 /// Interface structure for the Incompatible PCI Device Support Protocol
155 ///
156 struct _EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL {
157 ///
158 /// Returns a list of ACPI resource descriptors that detail any special
159 /// resource configuration requirements if the specified device is a recognized
160 /// incompatible PCI device.
161 ///
162 EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_CHECK_DEVICE CheckDevice;
163 };
164
165 extern EFI_GUID gEfiIncompatiblePciDeviceSupportProtocolGuid;
166
167 #endif