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 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _SMM_ACCESS_DRIVER_H
18 #define _SMM_ACCESS_DRIVER_H
21 #include <IndustryStandard/Pci.h>
23 #include <Library/HobLib.h>
24 #include <Library/BaseLib.h>
25 #include <Library/UefiLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/PcdLib.h>
33 // Driver Consumed Protocol Prototypes
35 #include <Protocol/PciRootBridgeIo.h>
38 // Driver Consumed GUID Prototypes
40 #include <Guid/SmramMemoryReserve.h>
43 // Driver produced protocol
45 #include <Protocol/SmmAccess2.h>
47 #include <Library/QNCSmmLib.h>
48 #include <QNCAccess.h>
50 #define MAX_CPU_SOCKET 1
51 #define MAX_SMRAM_RANGES 4
54 // Private data structure
56 #define SMM_ACCESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('i', 's', 'm', 'a')
61 EFI_SMM_ACCESS2_PROTOCOL SmmAccess
;
62 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
;
64 EFI_SMRAM_DESCRIPTOR SmramDesc
[MAX_SMRAM_RANGES
];
67 UINT8 SocketPopulated
[MAX_CPU_SOCKET
];
68 UINT64 SMMRegionState
;
69 UINT8 ActualNLIioBusNumber
;
70 } SMM_ACCESS_PRIVATE_DATA
;
73 #define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
76 SMM_ACCESS_PRIVATE_DATA, \
78 SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
84 // Driver model protocol interface
88 SmmAccessDriverEntryPoint (
89 IN EFI_HANDLE ImageHandle
,
90 IN EFI_SYSTEM_TABLE
*SystemTable
96 This is the standard EFI driver point that detects
97 whether there is an proper chipset in the system
98 and if so, installs an SMM Access Protocol.
102 ImageHandle - Handle for the image of this driver.
103 SystemTable - Pointer to the EFI System Table.
107 EFI_SUCCESS - Protocol successfully started and installed.
108 EFI_UNSUPPORTED - Protocol can't be started.
116 IN EFI_SMM_ACCESS2_PROTOCOL
*This
122 This routine accepts a request to "open" a region of SMRAM. The
123 region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
124 The use of "open" means that the memory is visible from all boot-service
129 This - Pointer to the SMM Access Interface.
130 DescriptorIndex - Region of SMRAM to Open.
134 EFI_SUCCESS - The region was successfully opened.
135 EFI_DEVICE_ERROR - The region could not be opened because locked by
137 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
145 IN EFI_SMM_ACCESS2_PROTOCOL
*This
151 This routine accepts a request to "close" a region of SMRAM. This is valid for
152 compatible SMRAM region.
156 This - Pointer to the SMM Access Interface.
157 DescriptorIndex - Region of SMRAM to Close.
161 EFI_SUCCESS - The region was successfully closed.
162 EFI_DEVICE_ERROR - The region could not be closed because locked by
164 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
172 IN EFI_SMM_ACCESS2_PROTOCOL
*This
178 This routine accepts a request to "lock" SMRAM. The
179 region could be legacy AB or TSEG near top of physical memory.
180 The use of "lock" means that the memory can no longer be opened
185 This - Pointer to the SMM Access Interface.
186 DescriptorIndex - Region of SMRAM to Lock.
190 EFI_SUCCESS - The region was successfully locked.
191 EFI_DEVICE_ERROR - The region could not be locked because at least
192 one range is still open.
193 EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
201 IN CONST EFI_SMM_ACCESS2_PROTOCOL
*This
,
202 IN OUT UINTN
*SmramMapSize
,
203 IN OUT EFI_SMRAM_DESCRIPTOR
*SmramMap
209 This routine services a user request to discover the SMRAM
210 capabilities of this platform. This will report the possible
211 ranges that are possible for SMRAM access, based upon the
212 memory controller capabilities.
216 This - Pointer to the SMRAM Access Interface.
217 SmramMapSize - Pointer to the variable containing size of the
218 buffer to contain the description information.
219 SmramMap - Buffer containing the data describing the Smram
224 EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
225 EFI_SUCCESS - The user provided a sufficiently-sized buffer.
230 SyncRegionState2SmramDesc(