From: Laszlo Ersek <lersek@redhat.com>
To: Amit kumar <akamit91@hotmail.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: Accessing memory above 0xFFFFFFFF limit.
Date: Mon, 27 Nov 2017 16:34:13 +0100 [thread overview]
Message-ID: <90297716-77ec-0fff-5cbf-397009552803@redhat.com> (raw)
In-Reply-To: <DM5PR11MB1578C80B34A86C938C8D3FE4DC250@DM5PR11MB1578.namprd11.prod.outlook.com>
On 11/27/17 13:20, Amit kumar wrote:
>
> Hi.
> I am trying to allocate a mem buffer above 4Gb address but the allocation
> since i am unable to locate EdkiiIoMmuProtocol.
>
> Status = gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID **)&mIoMmuProtocol);
> Status = mIoMmuProtocol->AllocateBuffer (
> mIoMmuProtocol,
> MaxAllocateType,
> EfiBootServicesData,
> 1,
> HostAddress,
> EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE
> );
PciHostBridgeDxe can perfectly well allocate >4GB memory for DMA
purposes even in the absence of the IOMMU protocol. For that, your PCI
device driver has to advertize the PCI device as 64-bit capable. In your
Driver Binding Start() function, call PciIo->Attributes() with the
EfiPciIoAttributeOperationEnable operation, and set
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE. From the v2.7 UEFI spec (14.4
EFI PCI I/O Protocol):
If this bit is set, then the PCI controller 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 is not
capable of producing PCI Dual Address Cycles, so it is only able to
access a 32-bit address space.
PciHostBridgeDxe will ignore the bit if the root bridge that the device
belongs to is generally uncapable of 64-bit access. Please see
"DmaAbove4G" in the PciHostBridgeLib interface:
MdeModulePkg/Include/Library/PciHostBridgeLib.h
(You might notice that the PciHostBridgeDxe source code uses
EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE, but above I wrote
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE. The PciBusDxe driver maps the
latter to the former, in the PciIoAllocateBuffer() function.)
Laszlo
prev parent reply other threads:[~2017-11-27 15:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 12:20 Accessing memory above 0xFFFFFFFF limit Amit kumar
2017-11-27 15:34 ` Laszlo Ersek [this message]
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=90297716-77ec-0fff-5cbf-397009552803@redhat.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