IoMmuDxe.c 976 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** @file
  2. IoMmuDxe driver installs EDKII_IOMMU_PROTOCOL to provide the support for DMA
  3. operations when SEV is enabled.
  4. Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include "CcIoMmu.h"
  8. EFI_STATUS
  9. EFIAPI
  10. IoMmuDxeEntryPoint (
  11. IN EFI_HANDLE ImageHandle,
  12. IN EFI_SYSTEM_TABLE *SystemTable
  13. )
  14. {
  15. EFI_STATUS Status;
  16. EFI_HANDLE Handle;
  17. //
  18. // When SEV or TDX is enabled, install IoMmu protocol otherwise install the
  19. // placeholder protocol so that other dependent module can run.
  20. //
  21. if (MemEncryptSevIsEnabled () || MemEncryptTdxIsEnabled ()) {
  22. Status = InstallIoMmuProtocol ();
  23. } else {
  24. Handle = NULL;
  25. Status = gBS->InstallMultipleProtocolInterfaces (
  26. &Handle,
  27. &gIoMmuAbsentProtocolGuid,
  28. NULL,
  29. NULL
  30. );
  31. }
  32. return Status;
  33. }