]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __SMM_MEMORYATTRIBUTE_H__
11 #define __SMM_MEMORYATTRIBUTE_H__
12
13 // {69B792EA-39CE-402D-A2A6-F721DE351DFE}
14 #define EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL_GUID \
15 { \
16 0x69b792ea, 0x39ce, 0x402d, { 0xa2, 0xa6, 0xf7, 0x21, 0xde, 0x35, 0x1d, 0xfe } \
17 }
18
19 typedef struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL;
20
21 /**
22 This function set given attributes of the memory region specified by
23 BaseAddress and Length.
24
25 @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
26 @param BaseAddress The physical address that is the start address of
27 a memory region.
28 @param Length The size in bytes of the memory region.
29 @param Attributes The bit mask of attributes to set for the memory
30 region.
31
32 @retval EFI_SUCCESS The attributes were set for the memory region.
33 @retval EFI_INVALID_PARAMETER Length is zero.
34 Attributes specified an illegal combination of
35 attributes that cannot be set together.
36 @retval EFI_UNSUPPORTED The processor does not support one or more
37 bytes of the memory resource range specified
38 by BaseAddress and Length.
39 The bit mask of attributes is not supported for
40 the memory resource range specified by
41 BaseAddress and Length.
42
43 **/
44 typedef
45 EFI_STATUS
46 (EFIAPI *EDKII_SMM_SET_MEMORY_ATTRIBUTES)(
47 IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
48 IN EFI_PHYSICAL_ADDRESS BaseAddress,
49 IN UINT64 Length,
50 IN UINT64 Attributes
51 );
52
53 /**
54 This function clears given attributes of the memory region specified by
55 BaseAddress and Length.
56
57 @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
58 @param BaseAddress The physical address that is the start address of
59 a memory region.
60 @param Length The size in bytes of the memory region.
61 @param Attributes The bit mask of attributes to clear for the memory
62 region.
63
64 @retval EFI_SUCCESS The attributes were cleared for the memory region.
65 @retval EFI_INVALID_PARAMETER Length is zero.
66 Attributes specified an illegal combination of
67 attributes that cannot be cleared together.
68 @retval EFI_UNSUPPORTED The processor does not support one or more
69 bytes of the memory resource range specified
70 by BaseAddress and Length.
71 The bit mask of attributes is not supported for
72 the memory resource range specified by
73 BaseAddress and Length.
74
75 **/
76 typedef
77 EFI_STATUS
78 (EFIAPI *EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES)(
79 IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
80 IN EFI_PHYSICAL_ADDRESS BaseAddress,
81 IN UINT64 Length,
82 IN UINT64 Attributes
83 );
84
85 /**
86 This function retrieves the attributes of the memory region specified by
87 BaseAddress and Length. If different attributes are got from different part
88 of the memory region, EFI_NO_MAPPING will be returned.
89
90 @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
91 @param BaseAddress The physical address that is the start address of
92 a memory region.
93 @param Length The size in bytes of the memory region.
94 @param Attributes Pointer to attributes returned.
95
96 @retval EFI_SUCCESS The attributes got for the memory region.
97 @retval EFI_INVALID_PARAMETER Length is zero.
98 Attributes is NULL.
99 @retval EFI_NO_MAPPING Attributes are not consistent cross the memory
100 region.
101 @retval EFI_UNSUPPORTED The processor does not support one or more
102 bytes of the memory resource range specified
103 by BaseAddress and Length.
104
105 **/
106 typedef
107 EFI_STATUS
108 (EFIAPI *EDKII_SMM_GET_MEMORY_ATTRIBUTES)(
109 IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
110 IN EFI_PHYSICAL_ADDRESS BaseAddress,
111 IN UINT64 Length,
112 OUT UINT64 *Attributes
113 );
114
115 ///
116 /// SMM Memory Attribute Protocol provides services to retrieve or update
117 /// attribute of memory in the EFI SMM environment.
118 ///
119 struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL {
120 EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes;
121 EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes;
122 EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes;
123 };
124
125 extern EFI_GUID gEdkiiSmmMemoryAttributeProtocolGuid;
126
127 #endif