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-2015 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/PcdLib.h>
27 // Driver Consumed Protocol Prototypes
29 #include <Protocol/PciRootBridgeIo.h>
32 // Driver Consumed GUID Prototypes
34 #include <Guid/SmramMemoryReserve.h>
37 // Driver produced protocol
39 #include <Protocol/SmmAccess2.h>
41 #include <Library/QNCSmmLib.h>
42 #include <QNCAccess.h>
44 #define MAX_CPU_SOCKET 1
45 #define MAX_SMRAM_RANGES 4
48 // Private data structure
50 #define SMM_ACCESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('i', 's', 'm', 'a')
55 EFI_SMM_ACCESS2_PROTOCOL SmmAccess
;
56 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
;
58 EFI_SMRAM_DESCRIPTOR SmramDesc
[MAX_SMRAM_RANGES
];
61 UINT8 SocketPopulated
[MAX_CPU_SOCKET
];
62 UINT64 SMMRegionState
;
63 UINT8 ActualNLIioBusNumber
;
64 } SMM_ACCESS_PRIVATE_DATA
;
67 #define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
70 SMM_ACCESS_PRIVATE_DATA, \
72 SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
78 // Driver model protocol interface
82 SmmAccessDriverEntryPoint (
83 IN EFI_HANDLE ImageHandle
,
84 IN EFI_SYSTEM_TABLE
*SystemTable
90 This is the standard EFI driver point that detects
91 whether there is an proper chipset in the system
92 and if so, installs an SMM Access Protocol.
96 ImageHandle - Handle for the image of this driver.
97 SystemTable - Pointer to the EFI System Table.
101 EFI_SUCCESS - Protocol successfully started and installed.
102 EFI_UNSUPPORTED - Protocol can't be started.
110 IN EFI_SMM_ACCESS2_PROTOCOL
*This
116 This routine accepts a request to "open" a region of SMRAM. The
117 region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
118 The use of "open" means that the memory is visible from all boot-service
123 This - Pointer to the SMM Access Interface.
124 DescriptorIndex - Region of SMRAM to Open.
128 EFI_SUCCESS - The region was successfully opened.
129 EFI_DEVICE_ERROR - The region could not be opened because locked by
131 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
139 IN EFI_SMM_ACCESS2_PROTOCOL
*This
145 This routine accepts a request to "close" a region of SMRAM. This is valid for
146 compatible SMRAM region.
150 This - Pointer to the SMM Access Interface.
151 DescriptorIndex - Region of SMRAM to Close.
155 EFI_SUCCESS - The region was successfully closed.
156 EFI_DEVICE_ERROR - The region could not be closed because locked by
158 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
166 IN EFI_SMM_ACCESS2_PROTOCOL
*This
172 This routine accepts a request to "lock" SMRAM. The
173 region could be legacy AB or TSEG near top of physical memory.
174 The use of "lock" means that the memory can no longer be opened
179 This - Pointer to the SMM Access Interface.
180 DescriptorIndex - Region of SMRAM to Lock.
184 EFI_SUCCESS - The region was successfully locked.
185 EFI_DEVICE_ERROR - The region could not be locked because at least
186 one range is still open.
187 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
195 IN CONST EFI_SMM_ACCESS2_PROTOCOL
*This
,
196 IN OUT UINTN
*SmramMapSize
,
197 IN OUT EFI_SMRAM_DESCRIPTOR
*SmramMap
203 This routine services a user request to discover the SMRAM
204 capabilities of this platform. This will report the possible
205 ranges that are possible for SMRAM access, based upon the
206 memory controller capabilities.
210 This - Pointer to the SMRAM Access Interface.
211 SmramMapSize - Pointer to the variable containing size of the
212 buffer to contain the description information.
213 SmramMap - Buffer containing the data describing the Smram
218 EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
219 EFI_SUCCESS - The user provided a sufficiently-sized buffer.
224 SyncRegionState2SmramDesc(