+//\r
+//\r
+/*++\r
+\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved\r
+\r
+ This program and the accompanying materials are licensed and made available under\r
+ the terms and conditions of the BSD License that accompanies this distribution.\r
+ The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php.\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+\r
+\r
+Module Name:\r
+\r
+ SmmAccess.h\r
+\r
+Abstract:\r
+\r
+ SmmAccess PPI\r
+\r
+ This code abstracts the PEI core to provide SmmAccess services.\r
+\r
+--*/\r
+\r
+#ifndef _PEI_SMM_ACCESS_PPI_H_\r
+#define _PEI_SMM_ACCESS_PPI_H_\r
+\r
+#ifdef ECP_FLAG\r
+#include "Guid/SmramMemoryReserve/SmramMemoryReserve.h"\r
+#else\r
+#include "Guid/SmramMemoryReserve.h"\r
+#endif\r
+\r
+#define PEI_SMM_ACCESS_PPI_GUID \\r
+ { \\r
+ 0x268f33a9, 0xcccd, 0x48be, 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 \\r
+ }\r
+\r
+typedef struct _PEI_SMM_ACCESS_PPI PEI_SMM_ACCESS_PPI;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_SMM_OPEN) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN PEI_SMM_ACCESS_PPI *This,\r
+ IN UINTN DescriptorIndex\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ This routine accepts a request to "open" a region of SMRAM. The\r
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.\r
+ The use of "open" means that the memory is visible from all PEIM\r
+ and SMM agents.\r
+\r
+ Arguments:\r
+ PeiServices - General purpose services available to every PEIM.\r
+ This - Pointer to the SMM Access Interface.\r
+ DescriptorIndex - Region of SMRAM to Open.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The region was successfully opened.\r
+ EFI_DEVICE_ERROR - The region could not be opened because locked by\r
+ chipset.\r
+ EFI_INVALID_PARAMETER - The descriptor index was out of bounds.\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_SMM_CLOSE) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN PEI_SMM_ACCESS_PPI *This,\r
+ IN UINTN DescriptorIndex\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ This routine accepts a request to "close" a region of SMRAM. The\r
+ region could be legacy AB or TSEG near top of physical memory.\r
+ The use of "close" means that the memory is only visible from SMM agents,\r
+ not from PEIM.\r
+\r
+ Arguments:\r
+ PeiServices - General purpose services available to every PEIM.\r
+ This - Pointer to the SMM Access Interface.\r
+ DescriptorIndex - Region of SMRAM to Close.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The region was successfully closed.\r
+ EFI_DEVICE_ERROR - The region could not be closed because locked by\r
+ chipset.\r
+ EFI_INVALID_PARAMETER - The descriptor index was out of bounds.\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_SMM_LOCK) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN PEI_SMM_ACCESS_PPI *This,\r
+ IN UINTN DescriptorIndex\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ This routine accepts a request to "lock" SMRAM. The\r
+ region could be legacy AB or TSEG near top of physical memory.\r
+ The use of "lock" means that the memory can no longer be opened\r
+ to PEIM.\r
+\r
+ Arguments:\r
+ PeiServices - General purpose services available to every PEIM.\r
+ This - Pointer to the SMM Access Interface.\r
+ DescriptorIndex - Region of SMRAM to Lock.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The region was successfully locked.\r
+ EFI_DEVICE_ERROR - The region could not be locked because at least\r
+ one range is still open.\r
+ EFI_INVALID_PARAMETER - The descriptor index was out of bounds.\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_SMM_CAPABILITIES) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN PEI_SMM_ACCESS_PPI *This,\r
+ IN OUT UINTN *SmramMapSize,\r
+ IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ This routine services a user request to discover the SMRAM\r
+ capabilities of this platform. This will report the possible\r
+ ranges that are possible for SMRAM access, based upon the\r
+ memory controller capabilities.\r
+\r
+ Arguments:\r
+ PeiServices - General purpose services available to every PEIM.\r
+ This - Pointer to the SMRAM Access Interface.\r
+ SmramMapSize - Pointer to the variable containing size of the\r
+ buffer to contain the description information.\r
+ SmramMap - Buffer containing the data describing the Smram\r
+ region descriptors.\r
+ Returns:\r
+ EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.\r
+ EFI_SUCCESS - The user provided a sufficiently-sized buffer.\r
+--*/\r
+;\r
+\r
+struct _PEI_SMM_ACCESS_PPI {\r
+ PEI_SMM_OPEN Open;\r
+ PEI_SMM_CLOSE Close;\r
+ PEI_SMM_LOCK Lock;\r
+ PEI_SMM_CAPABILITIES GetCapabilities;\r
+ BOOLEAN LockState;\r
+ BOOLEAN OpenState;\r
+};\r
+\r
+extern EFI_GUID gPeiSmmAccessPpiGuid;\r
+\r
+#endif\r