2 Header file for SMM Access Driver.
4 This file includes package header files, library classes and protocol, PPI & GUID definitions.
6 Copyright (c) 2013-2019 Intel Corporation.
8 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef _SMM_ACCESS_DRIVER_H
12 #define _SMM_ACCESS_DRIVER_H
15 #include <IndustryStandard/Pci.h>
17 #include <Library/HobLib.h>
18 #include <Library/BaseLib.h>
19 #include <Library/UefiLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/DxeServicesTableLib.h>
25 #include <Library/PcdLib.h>
28 // Driver Consumed Protocol Prototypes
30 #include <Protocol/PciRootBridgeIo.h>
33 // Driver Consumed GUID Prototypes
35 #include <Guid/SmramMemoryReserve.h>
38 // Driver produced protocol
40 #include <Protocol/SmmAccess2.h>
42 #include <Library/QNCSmmLib.h>
43 #include <QNCAccess.h>
45 #define MAX_CPU_SOCKET 1
46 #define MAX_SMRAM_RANGES 4
49 // Private data structure
51 #define SMM_ACCESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('i', 's', 'm', 'a')
56 EFI_SMM_ACCESS2_PROTOCOL SmmAccess
;
57 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
;
59 EFI_SMRAM_DESCRIPTOR SmramDesc
[MAX_SMRAM_RANGES
];
62 UINT8 SocketPopulated
[MAX_CPU_SOCKET
];
63 UINT64 SMMRegionState
;
64 UINT8 ActualNLIioBusNumber
;
65 } SMM_ACCESS_PRIVATE_DATA
;
68 #define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
71 SMM_ACCESS_PRIVATE_DATA, \
73 SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
79 // Driver model protocol interface
83 SmmAccessDriverEntryPoint (
84 IN EFI_HANDLE ImageHandle
,
85 IN EFI_SYSTEM_TABLE
*SystemTable
91 This is the standard EFI driver point that detects
92 whether there is an proper chipset in the system
93 and if so, installs an SMM Access Protocol.
97 ImageHandle - Handle for the image of this driver.
98 SystemTable - Pointer to the EFI System Table.
102 EFI_SUCCESS - Protocol successfully started and installed.
103 EFI_UNSUPPORTED - Protocol can't be started.
111 IN EFI_SMM_ACCESS2_PROTOCOL
*This
117 This routine accepts a request to "open" a region of SMRAM. The
118 region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
119 The use of "open" means that the memory is visible from all boot-service
124 This - Pointer to the SMM Access Interface.
125 DescriptorIndex - Region of SMRAM to Open.
129 EFI_SUCCESS - The region was successfully opened.
130 EFI_DEVICE_ERROR - The region could not be opened because locked by
132 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
140 IN EFI_SMM_ACCESS2_PROTOCOL
*This
146 This routine accepts a request to "close" a region of SMRAM. This is valid for
147 compatible SMRAM region.
151 This - Pointer to the SMM Access Interface.
152 DescriptorIndex - Region of SMRAM to Close.
156 EFI_SUCCESS - The region was successfully closed.
157 EFI_DEVICE_ERROR - The region could not be closed because locked by
159 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
167 IN EFI_SMM_ACCESS2_PROTOCOL
*This
173 This routine accepts a request to "lock" SMRAM. The
174 region could be legacy AB or TSEG near top of physical memory.
175 The use of "lock" means that the memory can no longer be opened
180 This - Pointer to the SMM Access Interface.
181 DescriptorIndex - Region of SMRAM to Lock.
185 EFI_SUCCESS - The region was successfully locked.
186 EFI_DEVICE_ERROR - The region could not be locked because at least
187 one range is still open.
188 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
196 IN CONST EFI_SMM_ACCESS2_PROTOCOL
*This
,
197 IN OUT UINTN
*SmramMapSize
,
198 IN OUT EFI_SMRAM_DESCRIPTOR
*SmramMap
204 This routine services a user request to discover the SMRAM
205 capabilities of this platform. This will report the possible
206 ranges that are possible for SMRAM access, based upon the
207 memory controller capabilities.
211 This - Pointer to the SMRAM Access Interface.
212 SmramMapSize - Pointer to the variable containing size of the
213 buffer to contain the description information.
214 SmramMap - Buffer containing the data describing the Smram
219 EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
220 EFI_SUCCESS - The user provided a sufficiently-sized buffer.
225 SyncRegionState2SmramDesc(