/* Allocates pages that are suitable for an OperationBusMasterCommonBuffer or OperationBusMasterCommonBuffer64 mapping. */
EFI_STATUS Usb3AllocateDmaBuffer(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINTN Pages, OUT VOID **Address)
/* Allocates pages that are suitable for an OperationBusMasterCommonBuffer or OperationBusMasterCommonBuffer64 mapping. */
EFI_STATUS Usb3AllocateDmaBuffer(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINTN Pages, OUT VOID **Address)
{
  EFI_STATUS  Status;
  *Address = NULL;
  Status   = PciIo->AllocateBuffer (
                      PciIo,
                      AllocateAnyPages,
                      EfiRuntimeServicesData,
                      Pages,
                      Address,
                      0
                      );
  if (!EFI_ERROR (Status)) {
    Usb3MapOneDmaBuffer (
      PciIo,
      (EFI_PHYSICAL_ADDRESS)(UINTN)*Address,
      EFI_PAGES_TO_SIZE (Pages)
      );
  }
  return Status;
}