]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/MmAccess.h
MdePkg: Replace BSD License with BSD+Patent License
[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
9344f092 15 SPDX-License-Identifier: BSD-2-Clause-Patent\r
07c6a47e
ED
16\r
17**/\r
18\r
19#ifndef _MM_ACCESS_H_\r
20#define _MM_ACCESS_H_\r
21\r
22#define EFI_MM_ACCESS_PROTOCOL_GUID \\r
23 { \\r
24 0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \\r
25 }\r
26\r
27\r
28typedef struct _EFI_MM_ACCESS_PROTOCOL EFI_MM_ACCESS_PROTOCOL;\r
29\r
30/**\r
31 Opens the MMRAM area to be accessible by a boot-service driver.\r
32\r
33 This function "opens" MMRAM so that it is visible while not inside of MM. The function should\r
34 return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM. The function\r
35 should return EFI_DEVICE_ERROR if the MMRAM configuration is locked.\r
36\r
37 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
38\r
39 @retval EFI_SUCCESS The operation was successful.\r
40 @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM.\r
41 @retval EFI_DEVICE_ERROR MMRAM cannot be opened, perhaps because it is locked.\r
42**/\r
43typedef\r
44EFI_STATUS\r
45(EFIAPI *EFI_MM_OPEN)(\r
46 IN EFI_MM_ACCESS_PROTOCOL *This\r
47 );\r
48\r
49/**\r
50 Inhibits access to the MMRAM.\r
51\r
52 This function "closes" MMRAM so that it is not visible while outside of MM. The function should\r
53 return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM.\r
54\r
55 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
56\r
57 @retval EFI_SUCCESS The operation was successful.\r
58 @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM.\r
59 @retval EFI_DEVICE_ERROR MMRAM cannot be closed.\r
60**/\r
61typedef\r
62EFI_STATUS\r
63(EFIAPI *EFI_MM_CLOSE)(\r
64 IN EFI_MM_ACCESS_PROTOCOL *This\r
65 );\r
66\r
67/**\r
68 Inhibits access to the MMRAM.\r
69\r
70 This function prohibits access to the MMRAM region. This function is usually implemented such\r
71 that it is a write-once operation.\r
72\r
73 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
74\r
75 @retval EFI_SUCCESS The device was successfully locked.\r
76 @retval EFI_UNSUPPORTED The system does not support locking of MMRAM.\r
77**/\r
78typedef\r
79EFI_STATUS\r
80(EFIAPI *EFI_MM_LOCK)(\r
81 IN EFI_MM_ACCESS_PROTOCOL *This\r
82 );\r
83\r
84/**\r
85 Queries the memory controller for the possible regions that will support MMRAM.\r
86\r
87 @param[in] This The EFI_MM_ACCESS_PROTOCOL instance.\r
88 @param[in,out] MmramMapSize A pointer to the size, in bytes, of the MmramMemoryMap buffer.\r
89 @param[in,out] MmramMap A pointer to the buffer in which firmware places the current memory map.\r
90\r
91 @retval EFI_SUCCESS The chipset supported the given resource.\r
92 @retval EFI_BUFFER_TOO_SMALL The MmramMap parameter was too small. The current buffer size\r
93 needed to hold the memory map is returned in MmramMapSize.\r
94**/\r
95typedef\r
96EFI_STATUS\r
97(EFIAPI *EFI_MM_CAPABILITIES)(\r
98 IN CONST EFI_MM_ACCESS_PROTOCOL *This,\r
99 IN OUT UINTN *MmramMapSize,\r
100 IN OUT EFI_MMRAM_DESCRIPTOR *MmramMap\r
101 );\r
102\r
103///\r
104/// EFI MM Access Protocol is used to control the visibility of the MMRAM on the platform.\r
105/// It abstracts the location and characteristics of MMRAM. The platform should report all\r
106/// MMRAM via EFI_MM_ACCESS_PROTOCOL. The expectation is that the north bridge or memory\r
107/// controller would publish this protocol.\r
108///\r
109struct _EFI_MM_ACCESS_PROTOCOL {\r
110 EFI_MM_OPEN Open;\r
111 EFI_MM_CLOSE Close;\r
112 EFI_MM_LOCK Lock;\r
113 EFI_MM_CAPABILITIES GetCapabilities;\r
114 ///\r
115 /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is locked.\r
116 ///\r
117 BOOLEAN LockState;\r
118 ///\r
119 /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is open.\r
120 ///\r
121 BOOLEAN OpenState;\r
122};\r
123\r
124extern EFI_GUID gEfiMmAccessProtocolGuid;\r
125\r
126#endif\r
127\r