]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.h
IntelFrameworkModulePkg: Add AcpiS3SaveDxe driver
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Acpi / AcpiS3SaveDxe / AcpiS3Save.h
CommitLineData
13d4af68 1/** @file\r
2 This is an implementation of the ACPI S3 Save protocol. This is defined in \r
3 S3 boot path specification 0.9.\r
4\r
5Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions\r
9of the BSD License which accompanies this distribution. The\r
10full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _ACPI_S3_SAVE_H_\r
19#define _ACPI_S3_SAVE_H_\r
20\r
21#pragma pack(push, 1)\r
22\r
23typedef union {\r
24 struct {\r
25 UINT32 LimitLow : 16;\r
26 UINT32 BaseLow : 16;\r
27 UINT32 BaseMid : 8;\r
28 UINT32 Type : 4;\r
29 UINT32 System : 1;\r
30 UINT32 Dpl : 2;\r
31 UINT32 Present : 1;\r
32 UINT32 LimitHigh : 4;\r
33 UINT32 Software : 1;\r
34 UINT32 Reserved : 1;\r
35 UINT32 DefaultSize : 1;\r
36 UINT32 Granularity : 1;\r
37 UINT32 BaseHigh : 8;\r
38 } Bits;\r
39 UINT64 Uint64;\r
40} IA32_GDT;\r
41\r
42typedef struct {\r
43 IA32_IDT_GATE_DESCRIPTOR Ia32IdtEntry;\r
44 UINT32 Offset32To63;\r
45 UINT32 Reserved;\r
46} X64_IDT_GATE_DESCRIPTOR;\r
47\r
48//\r
49// Page-Map Level-4 Offset (PML4) and\r
50// Page-Directory-Pointer Offset (PDPE) entries 4K & 2MB\r
51//\r
52\r
53typedef union {\r
54 struct {\r
55 UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory\r
56 UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write\r
57 UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User\r
58 UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching\r
59 UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached\r
60 UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)\r
61 UINT64 Reserved:1; // Reserved\r
62 UINT64 MustBeZero:2; // Must Be Zero\r
63 UINT64 Available:3; // Available for use by system software\r
64 UINT64 PageTableBaseAddress:40; // Page Table Base Address\r
65 UINT64 AvabilableHigh:11; // Available for use by system software\r
66 UINT64 Nx:1; // No Execute bit\r
67 } Bits;\r
68 UINT64 Uint64;\r
69} PAGE_MAP_AND_DIRECTORY_POINTER;\r
70\r
71//\r
72// Page Table Entry 2MB\r
73//\r
74typedef union {\r
75 struct {\r
76 UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory\r
77 UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write\r
78 UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User\r
79 UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching\r
80 UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached\r
81 UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)\r
82 UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page\r
83 UINT64 MustBe1:1; // Must be 1 \r
84 UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write\r
85 UINT64 Available:3; // Available for use by system software\r
86 UINT64 PAT:1; //\r
87 UINT64 MustBeZero:8; // Must be zero;\r
88 UINT64 PageTableBaseAddress:31; // Page Table Base Address\r
89 UINT64 AvabilableHigh:11; // Available for use by system software\r
90 UINT64 Nx:1; // 0 = Execute Code, 1 = No Code Execution\r
91 } Bits;\r
92 UINT64 Uint64;\r
93} PAGE_TABLE_ENTRY;\r
94\r
95#pragma pack()\r
96\r
97/**\r
98 Gets the buffer of legacy memory below 1 MB \r
99 This function is to get the buffer in legacy memory below 1MB that is required during S3 resume.\r
100\r
101 @param This A pointer to the EFI_ACPI_S3_SAVE_PROTOCOL instance.\r
102 @param Size The returned size of legacy memory below 1 MB.\r
103\r
104 @retval EFI_SUCCESS Size is successfully returned.\r
105 @retval EFI_INVALID_PARAMETER The pointer Size is NULL.\r
106\r
107**/\r
108EFI_STATUS\r
109EFIAPI\r
110LegacyGetS3MemorySize (\r
111 IN EFI_ACPI_S3_SAVE_PROTOCOL * This,\r
112 OUT UINTN * Size\r
113 );\r
114\r
115/**\r
116 Prepares all information that is needed in the S3 resume boot path.\r
117 \r
118 Allocate the resources or prepare informations and save in ACPI variable set for S3 resume boot path \r
119 \r
120 @param This A pointer to the EFI_ACPI_S3_SAVE_PROTOCOL instance.\r
121 @param LegacyMemoryAddress The base address of legacy memory.\r
122\r
123 @retval EFI_NOT_FOUND Some necessary information cannot be found.\r
124 @retval EFI_SUCCESS All information was saved successfully.\r
125 @retval EFI_OUT_OF_RESOURCES Resources were insufficient to save all the information.\r
126 @retval EFI_INVALID_PARAMETER The memory range is not located below 1 MB.\r
127\r
128**/\r
129EFI_STATUS\r
130EFIAPI\r
131S3Ready (\r
132 IN EFI_ACPI_S3_SAVE_PROTOCOL *This,\r
133 IN VOID *LegacyMemoryAddress \r
134 );\r
135#endif\r