public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel-01 <edk2-devel@lists.01.org>,
	"afish@apple.com" <afish@apple.com>,
	 "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>,
	Alan Ott <alan@softiron.co.uk>,
	 Daniil Egranov <daniil.egranov@linaro.org>
Subject: use of EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE
Date: Sat, 27 Aug 2016 17:37:45 +0100	[thread overview]
Message-ID: <CAKv+Gu-6-saHkQ4nhVh6EVecNAMg5S3VpKPwvm3Y9SAUFkEKSQ@mail.gmail.com> (raw)

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.


             reply	other threads:[~2016-08-27 16:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27 16:37 Ard Biesheuvel [this message]
2016-08-28 10:40 ` use of EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKv+Gu-6-saHkQ4nhVh6EVecNAMg5S3VpKPwvm3Y9SAUFkEKSQ@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox