54 if (EFI_ERROR (Status)) {
55 return EFI_OUT_OF_RESOURCES;
61 Attribute = EDKII_IOMMU_ACCESS_READ;
65 Attribute = EDKII_IOMMU_ACCESS_WRITE;
69 Attribute = EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE;
73 return EFI_INVALID_PARAMETER;
76 Status = IoMmu->SetAttribute (
81 if (EFI_ERROR (Status)) {
82 IoMmu->Unmap (IoMmu, Mapping);
109 IoMmu->SetAttribute (IoMmu, Mapping, 0);
110 IoMmu->Unmap (IoMmu, Mapping);
137 OUT VOID **HostAddress,
151 Status = IoMmu->AllocateBuffer (
158 if (EFI_ERROR (Status)) {
159 return EFI_OUT_OF_RESOURCES;
163 Status = IoMmu->Map (
171 if (EFI_ERROR (Status)) {
172 IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
174 return EFI_OUT_OF_RESOURCES;
177 Status = IoMmu->SetAttribute (
180 EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE
182 if (EFI_ERROR (Status)) {
183 IoMmu->Unmap (IoMmu, *Mapping);
184 IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
195 if (EFI_ERROR (Status)) {
196 return EFI_OUT_OF_RESOURCES;
199 *HostAddress = (VOID *)(
UINTN)HostPhyAddress;
200 *DeviceAddress = HostPhyAddress;
220 IN VOID *HostAddress,
225 IoMmu->SetAttribute (IoMmu, Mapping, 0);
226 IoMmu->Unmap (IoMmu, Mapping);
227 IoMmu->FreeBuffer (IoMmu, Pages, HostAddress);
EFI_STATUS IoMmuUnmap(IN VOID *Mapping)
EFI_STATUS IoMmuAllocateBuffer(IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS IoMmuMap(IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS IoMmuFreeBuffer(IN UINTN Pages, IN VOID *HostAddress, IN VOID *Mapping)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI PeiServicesAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
VOID IoMmuInit(OUT EDKII_IOMMU_PPI **IoMmu)
EFI_GUID gEdkiiIoMmuPpiGuid
@ EdkiiIoMmuOperationBusMasterWrite
@ EdkiiIoMmuOperationBusMasterWrite64
@ EdkiiIoMmuOperationBusMasterCommonBuffer
@ EdkiiIoMmuOperationBusMasterRead64
@ EdkiiIoMmuOperationBusMasterRead
@ EdkiiIoMmuOperationBusMasterCommonBuffer64
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_PAGES_TO_SIZE(Pages)