• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 //
3 /*++
4 
5 Copyright (c)  2009  - 2014, Intel Corporation. All rights reserved
6 
7   This program and the accompanying materials are licensed and made available under
8   the terms and conditions of the BSD License that accompanies this distribution.
9   The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php.
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 
16 
17 Module Name:
18 
19   SmmAccess.h
20 
21 Abstract:
22 
23   SmmAccess PPI
24 
25   This code abstracts the PEI core to provide SmmAccess services.
26 
27 --*/
28 
29 #ifndef _PEI_SMM_ACCESS_PPI_H_
30 #define _PEI_SMM_ACCESS_PPI_H_
31 
32 #ifdef ECP_FLAG
33 #include "Guid/SmramMemoryReserve/SmramMemoryReserve.h"
34 #else
35 #include "Guid/SmramMemoryReserve.h"
36 #endif
37 
38 #define PEI_SMM_ACCESS_PPI_GUID \
39   { \
40     0x268f33a9, 0xcccd, 0x48be, 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 \
41   }
42 
43 typedef struct _PEI_SMM_ACCESS_PPI PEI_SMM_ACCESS_PPI;
44 
45 typedef
46 EFI_STATUS
47 (EFIAPI *PEI_SMM_OPEN) (
48   IN EFI_PEI_SERVICES                **PeiServices,
49   IN PEI_SMM_ACCESS_PPI              *This,
50   IN UINTN                           DescriptorIndex
51   )
52 /*++
53 
54   Routine Description:
55     This routine accepts a request to "open" a region of SMRAM.  The
56     region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
57     The use of "open" means that the memory is visible from all PEIM
58     and SMM agents.
59 
60   Arguments:
61     PeiServices           - General purpose services available to every PEIM.
62     This                  - Pointer to the SMM Access Interface.
63     DescriptorIndex       - Region of SMRAM to Open.
64 
65   Returns:
66     EFI_SUCCESS           - The region was successfully opened.
67     EFI_DEVICE_ERROR      - The region could not be opened because locked by
68                             chipset.
69     EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
70 --*/
71 ;
72 
73 typedef
74 EFI_STATUS
75 (EFIAPI *PEI_SMM_CLOSE) (
76   IN EFI_PEI_SERVICES                **PeiServices,
77   IN PEI_SMM_ACCESS_PPI              *This,
78   IN UINTN                           DescriptorIndex
79   )
80 /*++
81 
82   Routine Description:
83     This routine accepts a request to "close" a region of SMRAM.  The
84     region could be legacy AB or TSEG near top of physical memory.
85     The use of "close" means that the memory is only visible from SMM agents,
86     not from PEIM.
87 
88   Arguments:
89     PeiServices           - General purpose services available to every PEIM.
90     This                  - Pointer to the SMM Access Interface.
91     DescriptorIndex       - Region of SMRAM to Close.
92 
93   Returns:
94     EFI_SUCCESS           - The region was successfully closed.
95     EFI_DEVICE_ERROR      - The region could not be closed because locked by
96                               chipset.
97     EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
98 
99 --*/
100 ;
101 
102 typedef
103 EFI_STATUS
104 (EFIAPI *PEI_SMM_LOCK) (
105   IN EFI_PEI_SERVICES                **PeiServices,
106   IN PEI_SMM_ACCESS_PPI              *This,
107   IN UINTN                           DescriptorIndex
108   )
109 /*++
110 
111   Routine Description:
112     This routine accepts a request to "lock" SMRAM.  The
113     region could be legacy AB or TSEG near top of physical memory.
114     The use of "lock" means that the memory can no longer be opened
115     to PEIM.
116 
117   Arguments:
118     PeiServices           - General purpose services available to every PEIM.
119     This                  - Pointer to the SMM Access Interface.
120     DescriptorIndex       - Region of SMRAM to Lock.
121 
122   Returns:
123     EFI_SUCCESS           - The region was successfully locked.
124     EFI_DEVICE_ERROR      - The region could not be locked because at least
125                             one range is still open.
126     EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
127 
128 --*/
129 ;
130 
131 typedef
132 EFI_STATUS
133 (EFIAPI *PEI_SMM_CAPABILITIES) (
134   IN EFI_PEI_SERVICES                **PeiServices,
135   IN PEI_SMM_ACCESS_PPI              *This,
136   IN OUT UINTN                       *SmramMapSize,
137   IN OUT EFI_SMRAM_DESCRIPTOR        *SmramMap
138   )
139 /*++
140 
141   Routine Description:
142     This routine services a user request to discover the SMRAM
143     capabilities of this platform.  This will report the possible
144     ranges that are possible for SMRAM access, based upon the
145     memory controller capabilities.
146 
147   Arguments:
148     PeiServices           - General purpose services available to every PEIM.
149     This                  - Pointer to the SMRAM Access Interface.
150     SmramMapSize          - Pointer to the variable containing size of the
151                               buffer to contain the description information.
152     SmramMap              - Buffer containing the data describing the Smram
153                               region descriptors.
154   Returns:
155     EFI_BUFFER_TOO_SMALL  - The user did not provide a sufficient buffer.
156     EFI_SUCCESS           - The user provided a sufficiently-sized buffer.
157 --*/
158 ;
159 
160 struct _PEI_SMM_ACCESS_PPI {
161   PEI_SMM_OPEN          Open;
162   PEI_SMM_CLOSE         Close;
163   PEI_SMM_LOCK          Lock;
164   PEI_SMM_CAPABILITIES  GetCapabilities;
165   BOOLEAN               LockState;
166   BOOLEAN               OpenState;
167 };
168 
169 extern EFI_GUID gPeiSmmAccessPpiGuid;
170 
171 #endif
172