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