11c27f926c130284b022501596399205b8c8e4b23Michael Kinney/** @file
21c27f926c130284b022501596399205b8c8e4b23Michael KinneyDefinitions for CPU S3 data.
31c27f926c130284b022501596399205b8c8e4b23Michael Kinney
41c27f926c130284b022501596399205b8c8e4b23Michael KinneyCopyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
51c27f926c130284b022501596399205b8c8e4b23Michael KinneyThis program and the accompanying materials
61c27f926c130284b022501596399205b8c8e4b23Michael Kinneyare licensed and made available under the terms and conditions of the BSD License
71c27f926c130284b022501596399205b8c8e4b23Michael Kinneywhich accompanies this distribution.  The full text of the license may be found at
81c27f926c130284b022501596399205b8c8e4b23Michael Kinneyhttp://opensource.org/licenses/bsd-license.php
91c27f926c130284b022501596399205b8c8e4b23Michael Kinney
101c27f926c130284b022501596399205b8c8e4b23Michael KinneyTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
111c27f926c130284b022501596399205b8c8e4b23Michael KinneyWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
121c27f926c130284b022501596399205b8c8e4b23Michael Kinney
131c27f926c130284b022501596399205b8c8e4b23Michael Kinney**/
141c27f926c130284b022501596399205b8c8e4b23Michael Kinney
151c27f926c130284b022501596399205b8c8e4b23Michael Kinney#ifndef _ACPI_CPU_DATA_H_
161c27f926c130284b022501596399205b8c8e4b23Michael Kinney#define _ACPI_CPU_DATA_H_
171c27f926c130284b022501596399205b8c8e4b23Michael Kinney
181c27f926c130284b022501596399205b8c8e4b23Michael Kinney//
191c27f926c130284b022501596399205b8c8e4b23Michael Kinney// Register types in register table
201c27f926c130284b022501596399205b8c8e4b23Michael Kinney//
21af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinneytypedef enum {
221c27f926c130284b022501596399205b8c8e4b23Michael Kinney  Msr,
231c27f926c130284b022501596399205b8c8e4b23Michael Kinney  ControlRegister,
241c27f926c130284b022501596399205b8c8e4b23Michael Kinney  MemoryMapped,
251c27f926c130284b022501596399205b8c8e4b23Michael Kinney  CacheControl
261c27f926c130284b022501596399205b8c8e4b23Michael Kinney} REGISTER_TYPE;
271c27f926c130284b022501596399205b8c8e4b23Michael Kinney
281c27f926c130284b022501596399205b8c8e4b23Michael Kinney//
291c27f926c130284b022501596399205b8c8e4b23Michael Kinney// Element of register table entry
301c27f926c130284b022501596399205b8c8e4b23Michael Kinney//
311c27f926c130284b022501596399205b8c8e4b23Michael Kinneytypedef struct {
32af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  REGISTER_TYPE  RegisterType;
33af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT32         Index;
34af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT8          ValidBitStart;
35af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT8          ValidBitLength;
36af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT64         Value;
371c27f926c130284b022501596399205b8c8e4b23Michael Kinney} CPU_REGISTER_TABLE_ENTRY;
381c27f926c130284b022501596399205b8c8e4b23Michael Kinney
391c27f926c130284b022501596399205b8c8e4b23Michael Kinney//
401c27f926c130284b022501596399205b8c8e4b23Michael Kinney// Register table definition, including current table length,
411c27f926c130284b022501596399205b8c8e4b23Michael Kinney// allocated size of this table, and pointer to the list of table entries.
421c27f926c130284b022501596399205b8c8e4b23Michael Kinney//
431c27f926c130284b022501596399205b8c8e4b23Michael Kinneytypedef struct {
44af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
45af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The number of valid entries in the RegisterTableEntry buffer
46af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
47af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT32                    TableLength;
48af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT32                    NumberBeforeReset;
49af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
50af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The size, in bytes, of the RegisterTableEntry buffer
51af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
52af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT32                    AllocatedSize;
53af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
54af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The initial APIC ID of the CPU this register table applies to
55af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
56af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  UINT32                    InitialApicId;
57af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
58af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Buffer of CPU_REGISTER_TABLE_ENTRY structures.  This buffer must be
59af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // allocated below 4GB from memory of type EfiACPIMemoryNVS.
60af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
61af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  CPU_REGISTER_TABLE_ENTRY  *RegisterTableEntry;
621c27f926c130284b022501596399205b8c8e4b23Michael Kinney} CPU_REGISTER_TABLE;
631c27f926c130284b022501596399205b8c8e4b23Michael Kinney
64af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney//
65af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney// Data structure that is required for ACPI S3 resume.  This structure must be
66af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney// allocated below 4GB from memory of type EfiACPIMemoryNVS.  The PCD
67af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney// PcdCpuS3DataAddress must be set to the physical address where this structure
68af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney// is allocated
69af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney//
701c27f926c130284b022501596399205b8c8e4b23Michael Kinneytypedef struct {
71af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
72af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of 4KB buffer allocated below 1MB from memory of type
73af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // EfiReservedMemoryType.  The buffer is not required to be initialized, but
74af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // it is recommended that the buffer be zero-filled.  This buffer is used to
75af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // wake APs during an ACPI S3 resume.
76af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
771c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  StartupVector;
78af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
79af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of structure of type IA32_DESCRIPTOR.  This structure must
80af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // be allocated below 4GB from memory of type EfiACPIMemoryNVS.  The
81af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // IA32_DESCRIPTOR structure provides the base address and length of a GDT
82af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The buffer for GDT must also be allocated below 4GB from memory of type
83af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // EfiACPIMemoryNVS.  The GDT must be filled in with the GDT contents that are
84af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // used during an ACPI S3 resume.  This is typically the contents of the GDT
85af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // used by the boot processor when the platform is booted.
86af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
871c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  GdtrProfile;
88af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
89af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of structure of type IA32_DESCRIPTOR.  This structure must
90af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // be allocated below 4GB from memory of type EfiACPIMemoryNVS.  The
91af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // IA32_DESCRIPTOR structure provides the base address and length of an IDT.
92af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The buffer for IDT must also be allocated below 4GB from memory of type
93af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // EfiACPIMemoryNVS.  The IDT must be filled in with the IDT contents that are
94af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // used during an ACPI S3 resume.  This is typically the contents of the IDT
95af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // used by the boot processor when the platform is booted.
96af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
971c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  IdtrProfile;
98af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
99af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of a buffer that is used as stacks during ACPI S3 resume.
100af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The total size of this buffer, in bytes, is NumberOfCpus * StackSize.  This
101af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // structure must be allocated below 4GB from memory of type EfiACPIMemoryNVS.
102af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
1031c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  StackAddress;
104af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
105af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The size, in bytes, of the stack provided to each CPU during ACPI S3 resume.
106af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
1071c27f926c130284b022501596399205b8c8e4b23Michael Kinney  UINT32                StackSize;
108af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
109af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The number of CPUs.  If a platform does not support hot plug CPUs, then
110af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // this is the number of CPUs detected when the platform is booted, regardless
111af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // of being enabled or disabled.  If a platform does support hot plug CPUs,
112af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // then this is the maximum number of CPUs that the platform supports.
113af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
1141c27f926c130284b022501596399205b8c8e4b23Michael Kinney  UINT32                NumberOfCpus;
115af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
116af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of structure of type MTRR_SETTINGS that contains a copy
117af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // of the MTRR settings that are compatible with the MTRR settings used by
118af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // the boot processor when the platform was booted.  These MTRR settings are
119af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // used during an ACPI S3 resume.  This structure must be allocated below 4GB
120af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // from memory of type EfiACPIMemoryNVS.
121af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
1221c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  MtrrTable;
1231c27f926c130284b022501596399205b8c8e4b23Michael Kinney  //
124af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of an array of CPU_REGISTER_TABLE structures, with
125af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // NumberOfCpus entries.  This array must be allocated below 4GB from memory
126af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // of type EfiACPIMemoryNVS.  If a register table is not required, then the
127af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // TableLength and AllocatedSize fields of CPU_REGISTER_TABLE are set to 0.
128af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // If TableLength is > 0, then elements of RegisterTableEntry are used to
129af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // initialize the CPU that matches InitialApicId, during an ACPI S3 resume,
130af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // before SMBASE relocation is performed.
1311c27f926c130284b022501596399205b8c8e4b23Michael Kinney  //
1321c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  PreSmmInitRegisterTable;
1331c27f926c130284b022501596399205b8c8e4b23Michael Kinney  //
134af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of an array of CPU_REGISTER_TABLE structures, with
135af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // NumberOfCpus entries.  This array must be allocated below 4GB from memory
136af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // of type EfiACPIMemoryNVS.  If a register table is not required, then the
137af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // TableLength and AllocatedSize fields of CPU_REGISTER_TABLE are set to 0.
138af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // If TableLength is > 0, then elements of RegisterTableEntry are used to
139af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // initialize the CPU that matches InitialApicId, during an ACPI S3 resume,
140af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // after SMBASE relocation is performed.
1411c27f926c130284b022501596399205b8c8e4b23Michael Kinney  //
1421c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  RegisterTable;
143af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
144af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // Physical address of a buffer that contains the machine check handler that
145af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // is used during an ACPI S3 Resume.  This buffer must be allocated below 4GB
146af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // from memory of type EfiACPIMemoryNVS.  In order for this machine check
147af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // handler to be active on an AP during an ACPI S3 resume, the machine check
148af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // vector in the IDT provided by IdtrProfile must be initialized to transfer
149af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // control to this physical address.
150af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
1511c27f926c130284b022501596399205b8c8e4b23Michael Kinney  EFI_PHYSICAL_ADDRESS  ApMachineCheckHandlerBase;
152af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
153af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // The size, in bytes, of the machine check handler that is used during an
154af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // ACPI S3 Resume.  If this field is 0, then a machine check handler is not
155af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  // provided.
156af381fda9b63f548a1b9f71bac3d4721f1fd8db4Michael Kinney  //
1571c27f926c130284b022501596399205b8c8e4b23Michael Kinney  UINT32                ApMachineCheckHandlerSize;
1581c27f926c130284b022501596399205b8c8e4b23Michael Kinney} ACPI_CPU_DATA;
1591c27f926c130284b022501596399205b8c8e4b23Michael Kinney
1601c27f926c130284b022501596399205b8c8e4b23Michael Kinney#endif
161