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