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