]>
Commit | Line | Data |
---|---|---|
f9d129e6 BS |
1 | /** @file\r |
2 | \r | |
3 | IoMmuDxe driver installs EDKII_IOMMU_PROTOCOL to provide the support for DMA\r | |
4 | operations when SEV is enabled.\r | |
5 | \r | |
6 | Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r | |
7 | \r | |
812568fb LE |
8 | This program and the accompanying materials are licensed and made available\r |
9 | under the terms and conditions of the BSD License which accompanies this\r | |
10 | distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
f9d129e6 BS |
12 | \r |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #include <PiDxe.h>\r | |
19 | \r | |
20 | #include <Library/BaseLib.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/BaseMemoryLib.h>\r | |
23 | #include <Library/MemoryAllocationLib.h>\r | |
24 | #include <Library/UefiBootServicesTableLib.h>\r | |
25 | #include <Library/MemEncryptSevLib.h>\r | |
26 | \r | |
27 | #include "AmdSevIoMmu.h"\r | |
28 | \r | |
29 | EFI_STATUS\r | |
30 | EFIAPI\r | |
31 | IoMmuDxeEntryPoint (\r | |
32 | IN EFI_HANDLE ImageHandle,\r | |
33 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
34 | )\r | |
35 | {\r | |
5e365a97 LE |
36 | EFI_STATUS Status;\r |
37 | EFI_HANDLE Handle;\r | |
38 | \r | |
f9d129e6 BS |
39 | //\r |
40 | // When SEV is enabled, install IoMmu protocol otherwise install the\r | |
41 | // placeholder protocol so that other dependent module can run.\r | |
42 | //\r | |
43 | if (MemEncryptSevIsEnabled ()) {\r | |
db125079 | 44 | Status = AmdSevInstallIoMmuProtocol ();\r |
f9d129e6 | 45 | } else {\r |
5e365a97 LE |
46 | Handle = NULL;\r |
47 | \r | |
f9d129e6 BS |
48 | Status = gBS->InstallMultipleProtocolInterfaces (\r |
49 | &Handle,\r | |
50 | &gIoMmuAbsentProtocolGuid,\r | |
51 | NULL, NULL);\r | |
52 | }\r | |
53 | \r | |
54 | return Status;\r | |
55 | }\r |