diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-04-20 14:37:08 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-04-20 14:37:08 +0100 |
commit | 3efdbef2f0dd956ce7d131ca4bdfd366f8cdc9d4 (patch) | |
tree | bfdf83d0e13bf7c9525b7a9572dd1a893dcef916 | |
parent | e4afaa2246fb373f0aa0620869bb2d4deaa39b5f (diff) | |
download | ipxe-3efdbef2f0dd956ce7d131ca4bdfd366f8cdc9d4.tar.gz |
[efi] Always map full length of coherent DMA buffer allocation
The EFI PCI API takes a page count as the input to AllocateBuffer()
but a byte count as the input to Map(). There is nothing in the UEFI
specification that requires us to map exactly the allocated length,
and no systems have yet been observed that will fail if the map length
does not exactly match the allocated length. However, it is plausible
that some implementations may fail if asked to map a length that does
not match the length of the corresponding allocation.
Avoid potential future problems by always mapping the full allocated
length.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/interface/efi/efi_pci.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/interface/efi/efi_pci.c b/src/interface/efi/efi_pci.c index 4adee0fd8..ef02c9c0e 100644 --- a/src/interface/efi/efi_pci.c +++ b/src/interface/efi/efi_pci.c @@ -523,7 +523,8 @@ static void * efipci_dma_alloc ( struct dma_device *dma, /* Map buffer */ if ( ( rc = efipci_dma_map ( dma, map, virt_to_phys ( addr ), - len, DMA_BI ) ) != 0 ) + ( pages * EFI_PAGE_SIZE ), + DMA_BI ) ) != 0 ) goto err_map; /* Increment allocation count (for debugging) */ |