]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/MmAccess.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / MmAccess.h
CommitLineData
07c6a47e
ED
1/** @file\r
2 EFI MM Access Protocol as defined in the PI 1.5 specification.\r
3\r
4 This protocol is used to control the visibility of the MMRAM on the platform.\r
5 It abstracts the location and characteristics of MMRAM. The expectation is\r
6 that the north bridge or memory controller would publish this protocol.\r
7\r
8 The principal functionality found in the memory controller includes the following:\r
9 - Exposing the MMRAM to all non-MM agents, or the "open" state\r
10 - Shrouding the MMRAM to all but the MM agents, or the "closed" state\r
11 - Preserving the system integrity, or "locking" the MMRAM, such that the settings cannot be\r
12 perturbed by either boot service or runtime agents\r
13\r
14 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
15 This program and the accompanying materials\r
16 are licensed and made available under the terms and conditions of the BSD License\r
17 which accompanies this distribution. The full text of the license may be found at\r
18 http://opensource.org/licenses/bsd-license.php\r
19\r
20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
22\r
23**/\r
24\r
25#ifndef _MM_ACCESS_H_\r
26#define _MM_ACCESS_H_\r
27\r
28#define EFI_MM_ACCESS_PROTOCOL_GUID \\r
29 { \\r
30 0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \\r
31 }\r
32\r
33\r
34typedef struct _EFI_MM_ACCESS_PROTOCOL EFI_MM_ACCESS_PROTOCOL;\r
35\r
36/**\r
37 Opens the MMRAM area to be accessible by a boot-service driver.\r
38\r
39 This function "opens" MMRAM so that it is visible while not inside of MM. The function should\r
40 return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM. The function\r
41 should return EFI_DEVICE_ERROR if the MMRAM configuration is locked.\r
42\r
43 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
44\r
45 @retval EFI_SUCCESS The operation was successful.\r
46 @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM.\r
47 @retval EFI_DEVICE_ERROR MMRAM cannot be opened, perhaps because it is locked.\r
48**/\r
49typedef\r
50EFI_STATUS\r
51(EFIAPI *EFI_MM_OPEN)(\r
52 IN EFI_MM_ACCESS_PROTOCOL *This\r
53 );\r
54\r
55/**\r
56 Inhibits access to the MMRAM.\r
57\r
58 This function "closes" MMRAM so that it is not visible while outside of MM. The function should\r
59 return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM.\r
60\r
61 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
62\r
63 @retval EFI_SUCCESS The operation was successful.\r
64 @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM.\r
65 @retval EFI_DEVICE_ERROR MMRAM cannot be closed.\r
66**/\r
67typedef\r
68EFI_STATUS\r
69(EFIAPI *EFI_MM_CLOSE)(\r
70 IN EFI_MM_ACCESS_PROTOCOL *This\r
71 );\r
72\r
73/**\r
74 Inhibits access to the MMRAM.\r
75\r
76 This function prohibits access to the MMRAM region. This function is usually implemented such\r
77 that it is a write-once operation.\r
78\r
79 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
80\r
81 @retval EFI_SUCCESS The device was successfully locked.\r
82 @retval EFI_UNSUPPORTED The system does not support locking of MMRAM.\r
83**/\r
84typedef\r
85EFI_STATUS\r
86(EFIAPI *EFI_MM_LOCK)(\r
87 IN EFI_MM_ACCESS_PROTOCOL *This\r
88 );\r
89\r
90/**\r
91 Queries the memory controller for the possible regions that will support MMRAM.\r
92\r
93 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
94 @param[in,out] MmramMapSize A pointer to the size, in bytes, of the MmramMemoryMap buffer.\r
95 @param[in,out] MmramMap A pointer to the buffer in which firmware places the current memory map.\r
96\r
97 @retval EFI_SUCCESS The chipset supported the given resource.\r
98 @retval EFI_BUFFER_TOO_SMALL The MmramMap parameter was too small. The current buffer size\r
99 needed to hold the memory map is returned in MmramMapSize.\r
100**/\r
101typedef\r
102EFI_STATUS\r
103(EFIAPI *EFI_MM_CAPABILITIES)(\r
104 IN CONST EFI_MM_ACCESS_PROTOCOL *This,\r
105 IN OUT UINTN *MmramMapSize,\r
106 IN OUT EFI_MMRAM_DESCRIPTOR *MmramMap\r
107 );\r
108\r
109///\r
110/// EFI MM Access Protocol is used to control the visibility of the MMRAM on the platform.\r
111/// It abstracts the location and characteristics of MMRAM. The platform should report all\r
112/// MMRAM via EFI_MM_ACCESS_PROTOCOL. The expectation is that the north bridge or memory\r
113/// controller would publish this protocol.\r
114///\r
115struct _EFI_MM_ACCESS_PROTOCOL {\r
116 EFI_MM_OPEN Open;\r
117 EFI_MM_CLOSE Close;\r
118 EFI_MM_LOCK Lock;\r
119 EFI_MM_CAPABILITIES GetCapabilities;\r
120 ///\r
121 /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is locked.\r
122 ///\r
123 BOOLEAN LockState;\r
124 ///\r
125 /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is open.\r
126 ///\r
127 BOOLEAN OpenState;\r
128};\r
129\r
130extern EFI_GUID gEfiMmAccessProtocolGuid;\r
131\r
132#endif\r
133\r