]> git.proxmox.com Git - mirror_edk2.git/blob - IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h
720f5d42c35f2073e24dcc9ed41ac625b912d9d5
[mirror_edk2.git] / IntelSiliconPkg / Feature / VTd / IntelVTdPmrPei / IntelVTdPmrPei.h
1 /** @file
2 The definition for DMA access Library.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __DMA_ACCESS_LIB_H__
16 #define __DMA_ACCESS_LIB_H__
17
18 typedef struct {
19 UINT8 HostAddressWidth;
20 UINTN VTdEngineCount;
21 UINT64 VTdEngineAddress[1];
22 } VTD_INFO;
23
24 /**
25 Set DMA protected region.
26
27 @param EngineMask The mask of the VTd engine to be accessed.
28 @param LowMemoryBase The protected low memory region base.
29 @param LowMemoryLength The protected low memory region length.
30 @param HighMemoryBase The protected high memory region base.
31 @param HighMemoryLength The protected high memory region length.
32
33 @retval EFI_SUCCESS The DMA protection is set.
34 @retval EFI_UNSUPPORTED The DMA protection is not set.
35 **/
36 EFI_STATUS
37 SetDmaProtectedRange (
38 IN UINT64 EngineMask,
39 IN UINT32 LowMemoryBase,
40 IN UINT32 LowMemoryLength,
41 IN UINT64 HighMemoryBase,
42 IN UINT64 HighMemoryLength
43 );
44
45 /**
46 Diable DMA protection.
47
48 @param EngineMask The mask of the VTd engine to be accessed.
49
50 @retval DMA protection is disabled.
51 **/
52 EFI_STATUS
53 DisableDmaProtection (
54 IN UINT64 EngineMask
55 );
56
57 /**
58 Get protected low memory alignment.
59
60 @param EngineMask The mask of the VTd engine to be accessed.
61
62 @return protected low memory alignment.
63 **/
64 UINT32
65 GetLowMemoryAlignment (
66 IN UINT64 EngineMask
67 );
68
69 /**
70 Get protected high memory alignment.
71
72 @param EngineMask The mask of the VTd engine to be accessed.
73
74 @return protected high memory alignment.
75 **/
76 UINT64
77 GetHighMemoryAlignment (
78 IN UINT64 EngineMask
79 );
80
81 #endif
82