]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Functions and types shared by the SMM accessor PEI and DXE modules.\r | |
4 | \r | |
5 | Copyright (C) 2015, Red Hat, Inc.\r | |
6 | \r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | \r | |
11 | #include <Pi/PiMultiPhase.h>\r | |
12 | \r | |
13 | //\r | |
14 | // We'll have two SMRAM ranges.\r | |
15 | //\r | |
16 | // The first is a tiny one that hosts an SMM_S3_RESUME_STATE object, to be\r | |
17 | // filled in by the CPU SMM driver during normal boot, for the PEI instance of\r | |
18 | // the LockBox library (which will rely on the object during S3 resume).\r | |
19 | //\r | |
20 | // The other SMRAM range is the main one, for the SMM core and the SMM drivers.\r | |
21 | //\r | |
22 | typedef enum {\r | |
23 | DescIdxSmmS3ResumeState = 0,\r | |
24 | DescIdxMain = 1,\r | |
25 | DescIdxCount = 2\r | |
26 | } DESCRIPTOR_INDEX;\r | |
27 | \r | |
28 | //\r | |
29 | // The value of PcdQ35TsegMbytes is saved into this variable at module startup.\r | |
30 | //\r | |
31 | extern UINT16 mQ35TsegMbytes;\r | |
32 | \r | |
33 | /**\r | |
34 | Save PcdQ35TsegMbytes into mQ35TsegMbytes.\r | |
35 | **/\r | |
36 | VOID\r | |
37 | InitQ35TsegMbytes (\r | |
38 | VOID\r | |
39 | );\r | |
40 | \r | |
41 | /**\r | |
42 | Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and\r | |
43 | OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,\r | |
44 | from the D_LCK and T_EN bits.\r | |
45 | \r | |
46 | PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on\r | |
47 | the LockState and OpenState fields being up-to-date on entry, and they need\r | |
48 | to restore the same invariant on exit, if they touch the bits in question.\r | |
49 | \r | |
50 | @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is\r | |
51 | locked.\r | |
52 | @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE\r | |
53 | iff SMRAM is open.\r | |
54 | **/\r | |
55 | VOID\r | |
56 | GetStates (\r | |
57 | OUT BOOLEAN *LockState,\r | |
58 | OUT BOOLEAN *OpenState\r | |
59 | );\r | |
60 | \r | |
61 | //\r | |
62 | // The functions below follow the PEI_SMM_ACCESS_PPI and\r | |
63 | // EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This\r | |
64 | // pointers are removed (TSEG doesn't depend on them), and so is the\r | |
65 | // DescriptorIndex parameter (TSEG doesn't support range-wise locking).\r | |
66 | //\r | |
67 | // The LockState and OpenState members that are common to both\r | |
68 | // PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in\r | |
69 | // isolation from the rest of the (non-shared) members.\r | |
70 | //\r | |
71 | \r | |
72 | EFI_STATUS\r | |
73 | SmramAccessOpen (\r | |
74 | OUT BOOLEAN *LockState,\r | |
75 | OUT BOOLEAN *OpenState\r | |
76 | );\r | |
77 | \r | |
78 | EFI_STATUS\r | |
79 | SmramAccessClose (\r | |
80 | OUT BOOLEAN *LockState,\r | |
81 | OUT BOOLEAN *OpenState\r | |
82 | );\r | |
83 | \r | |
84 | EFI_STATUS\r | |
85 | SmramAccessLock (\r | |
86 | OUT BOOLEAN *LockState,\r | |
87 | IN OUT BOOLEAN *OpenState\r | |
88 | );\r | |
89 | \r | |
90 | EFI_STATUS\r | |
91 | SmramAccessGetCapabilities (\r | |
92 | IN BOOLEAN LockState,\r | |
93 | IN BOOLEAN OpenState,\r | |
94 | IN OUT UINTN *SmramMapSize,\r | |
95 | IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap\r | |
96 | );\r |