public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* use of EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE
@ 2016-08-27 16:37 Ard Biesheuvel
  2016-08-28 10:40 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2016-08-27 16:37 UTC (permalink / raw)
  To: edk2-devel-01, afish@apple.com, Kinney, Michael D, Gao, Liming
  Cc: Leif Lindholm, Alan Ott, Daniil Egranov

The UEFI spec describes the EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE
attribute as follows:

"""
EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE
This bit may only be used in the Attributes parameter to
AllocateBuffer(). If this bit is set, then the PCI controller
that is requesting a buffer through AllocateBuffer() is
capable of producing PCI Dual Address Cycles, so it is able to
access a 64-bit address space. If this bit is not set, then the PCI
controller that is requesting a buffer through
AllocateBuffer() is not capable of producing PCI Dual
Address Cycles, so it is only able to access a 32-bit address space.
"""

However, both the UEFI driver writer's guide, and the de facto use in
Tianocore violate this, i.e., it use the pattern

"""
//
// Enable Command register and Dual Address Cycle
//
Status = PciIo->Attributes (
    PciIo,
    EfiPciIoAttributeOperationEnable,
    (PciSupports & EFI_PCI_DEVICE_ENABLE) |
    EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE,
    NULL
    );
"""

to enable it in the PCI I/O layer, and the Map/Unmap implementations
will switch to 64-bit flavors of the map operation, by the likes of

"""
  if ((PciIoDevice->Attributes &
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) != 0) {
    Operation = (EFI_PCI_IO_PROTOCOL_OPERATION) (Operation +
EfiPciOperationBusMasterRead64);
  }
"""

So what should we be doing in new code that needs to support 64-bit DMA?

-- 
Ard.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-28 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-27 16:37 use of EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE Ard Biesheuvel
2016-08-28 10:40 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox