0700eb51d6e145c817331c147f80c4e50c72f86a
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / SmmMemoryAttribute.h
1 /** @file
2 SMM Memory Attribute Protocol provides retrieval and update service
3 for memory attributes in EFI SMM environment.
4
5 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __SMM_MEMORYATTRIBUTE_H__
17 #define __SMM_MEMORYATTRIBUTE_H__
18
19 //{69B792EA-39CE-402D-A2A6-F721DE351DFE}
20 #define EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL_GUID \
21 { \
22 0x69b792ea, 0x39ce, 0x402d, { 0xa2, 0xa6, 0xf7, 0x21, 0xde, 0x35, 0x1d, 0xfe } \
23 }
24
25 typedef struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL;
26
27 /**
28 This function set given attributes of the memory region specified by
29 BaseAddress and Length.
30
31 @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
32 @param BaseAddress The physical address that is the start address of
33 a memory region.
34 @param Length The size in bytes of the memory region.
35 @param Attributes The bit mask of attributes to set for the memory
36 region.
37
38 @retval EFI_SUCCESS The attributes were set for the memory region.
39 @retval EFI_INVALID_PARAMETER Length is zero.
40 Attributes specified an illegal combination of
41 attributes that cannot be set together.
42 @retval EFI_UNSUPPORTED The processor does not support one or more
43 bytes of the memory resource range specified
44 by BaseAddress and Length.
45 The bit mask of attributes is not support for
46 the memory resource range specified by
47 BaseAddress and Length.
48
49 **/
50 typedef
51 EFI_STATUS
52 (EFIAPI *EDKII_SMM_SET_MEMORY_ATTRIBUTES)(
53 IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
54 IN EFI_PHYSICAL_ADDRESS BaseAddress,
55 IN UINT64 Length,
56 IN UINT64 Attributes
57 );
58
59 /**
60 This function clears given attributes of the memory region specified by
61 BaseAddress and Length.
62
63 @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
64 @param BaseAddress The physical address that is the start address of
65 a memory region.
66 @param Length The size in bytes of the memory region.
67 @param Attributes The bit mask of attributes to set for the memory
68 region.
69
70 @retval EFI_SUCCESS The attributes were set for the memory region.
71 @retval EFI_INVALID_PARAMETER Length is zero.
72 Attributes specified an illegal combination of
73 attributes that cannot be set together.
74 @retval EFI_UNSUPPORTED The processor does not support one or more
75 bytes of the memory resource range specified
76 by BaseAddress and Length.
77 The bit mask of attributes is not support for
78 the memory resource range specified by
79 BaseAddress and Length.
80
81 **/
82 typedef
83 EFI_STATUS
84 (EFIAPI *EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES)(
85 IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
86 IN EFI_PHYSICAL_ADDRESS BaseAddress,
87 IN UINT64 Length,
88 IN UINT64 Attributes
89 );
90
91 /**
92 This function retrieve the attributes of the memory region specified by
93 BaseAddress and Length. If different attributes are got from different part
94 of the memory region, EFI_NO_MAPPING will be returned.
95
96 @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
97 @param BaseAddress The physical address that is the start address of
98 a memory region.
99 @param Length The size in bytes of the memory region.
100 @param Attributes Pointer to attributes returned.
101
102 @retval EFI_SUCCESS The attributes got for the memory region.
103 @retval EFI_INVALID_PARAMETER Length is zero.
104 Attributes is NULL.
105 @retval EFI_NO_MAPPING Attributes are not consistent cross the memory
106 region.
107 @retval EFI_UNSUPPORTED The processor does not support one or more
108 bytes of the memory resource range specified
109 by BaseAddress and Length.
110 The bit mask of attributes is not support for
111 the memory resource range specified by
112 BaseAddress and Length.
113
114 **/
115 typedef
116 EFI_STATUS
117 (EFIAPI *EDKII_SMM_GET_MEMORY_ATTRIBUTES)(
118 IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
119 IN EFI_PHYSICAL_ADDRESS BaseAddress,
120 IN UINT64 Length,
121 OUT UINT64 *Attributes
122 );
123
124 ///
125 /// SMM Memory Attribute Protocol provides services to retrieve or update
126 /// attribute of memory in the EFI SMM environment.
127 ///
128 struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL {
129 EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes;
130 EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes;
131 EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes;
132 };
133
134 extern EFI_GUID gEdkiiSmmMemoryAttributeProtocolGuid;
135
136 #endif