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