Start()service of the Driver Binding Protocol for a PCI driver also opens the PCI I/O Protocol with an attribute of
EFI_OPEN_PROTOCOL_BY_DRIVER. If the PCI driver is a bus or hybrid driver, the Device Path Protocol opens using the attribute
EFI_OPEN_PROTOCOL_BY_DRIVER. A device driver is not required to open the Device Path Protocol. In addition, all PCI drivers are required to call the
Attributes()service of the PCI I/O Protocol to enable the I/O, memory, and bus master bits in the Command register of the PCI configuration header. By default, the PCI bus driver is not required to enable the Command register of the PCI controllers. Instead, it is the responsibility of the
Start()service to enable these bits and that of the
Stop()service to restore these bits. In order for the
Stop()service to restore the attributes, a PCI Driver typically stores the original attributes in a
UINT64field of the private context data structure.
Attributes()service. If the PCI controller is a bus master and capable of generating 64-bit DMA addresses, the
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLEattribute must also be enabled. Unfortunately, there is no standard method for detecting if a PCI controller supports 32-bit or 64-bit DMA addresses. As a result, it is the PCI driver's responsibility to inform the PCI bus driver that the PCI controller is capable of producing 64-bit DMA addresses.
Start()service of the Driver Binding Protocol.
Start()services of a PCI driver for a PCI controller supporting 64-bit DMA transactions. The example opens the PCI I/O Protocol attribute of
EFI_OPEN_PROTOCOL_BY_DRIVER. It then retrieves the current set of PCI I/O Protocol attributes and saves them in the private context data structure field called
ABC_PRIVATE_DATA. It then determines what attribute the PCI I/O Protocol supports and enables the I/O decode, MMIO decode, and Bus Master, and Dual Address Cycle capabilities. If a PCI Controller does not support DAC, the only change is the removal of
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLEfrom the last call to the
Attributes()service of the PCI I/O Protocol.
Stop()services of a PCI driver. This example restores the PCI I/O Protocol attributes from a field of the private context data structure called
#definestatements compatible with the
Attributes()service. A PCI driver must use the
Attributes()service to enable the decodes on the PCI controller, accurately describe the PCI controller DMA capabilities, and request that specific I/O cycles are forwarded to the device. The call to
Attributes()fails if the request cannot be satisfied. If this failure occurs, the
Start()function must return an error.
Start()service must be restored in the
#definestatements not part of the UEFI Specification, but which are included in EDK II to simplify PCI driver implementations. These attributes cover the typical classes of hardware capabilities and provide a names for common combinations of attributes described in the PCI Bus Support chapter of the UEFI Specification.
#definestatements that to use with the
SetBarAttributes()services to adjust the attributes of a memory-mapped I/O region described by a Base Address Register (BAR) of a PCI controller. The support of these attributes is optional, but in general, a PCI driver uses these attributes to provide hints that may be used to improve the performance of a PCI driver. Improved performance is especially important for PCI drivers managing graphics controllers. Do note that any BAR attributes set in the
Start()service must be restored in the
#definestatements for these attributes. These attributes are read-only and the values are established by the PCI Bus Driver when a PCI Controller is discovered and the PCI I/O Protocol is produced. A PCI driver may retrieve the attributes of a PCI controller with the
Attributes()service of the PCI I/O Protocol, but a PCI Driver is not allowed to modify these attributes.