Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/ACPIPatcher/acpi_patcher.h

  • Property svn:executable set to *
1/*
2 * Copyright 2008 mackerintel
3 */
4
5/*
6 * Copyright (c) 2010 cparm <armelcadetpetit@gmail.com>. All rights reserved.
7 *
8 */
9
10#ifndef __LIBSAIO_ACPI_PATCHER_H
11#define __LIBSAIO_ACPI_PATCHER_H
12
13#include "libsaio.h"
14#include "efi.h"
15
16#define kDSDT"DSDT"/* acpi_patcher.c */
17#define kRestartFix"RestartFix" /* acpi_patcher.c */
18#define kGeneratePStates"GeneratePStates"/* acpi_patcher.c */
19#define kGenerateCStates"GenerateCStates"/* acpi_patcher.c */
20#define kMaxRatio"MaxBusRatio"/* acpi_patcher.c */
21#define kMinRatio"MinBusRatio"/* acpi_patcher.c */
22#definekQSSDT"quickSSDTsearch"/* acpi_patcher.c */
23#definekSpeedstep"EnableSpeedStep"/* acpi_patcher.c */
24#define kEnableC4State"EnableC4State"/* acpi_patcher.c */
25
26#define kFACS"FACS"/* acpi_patcher.c */
27#define kSSDT"SSDT"/* acpi_patcher.c */
28#define kHPET"HPET"/* acpi_patcher.c */
29#define kSBST"SBST"/* acpi_patcher.c */
30#define kECDT"ECDT"/* acpi_patcher.c */
31#define kASFT"ASFT"/* acpi_patcher.c */
32#define kDMAR"DMAR"/* acpi_patcher.c */
33#define kFADT"FADT"/* acpi_patcher.c */
34#define kAPIC"APIC"/* acpi_patcher.c */
35#define kMCFG"MCFG"/* acpi_patcher.c */
36#define kOEMDSDT"oemDSDT"/* acpi_patcher.c */
37#define kOEMSSDT"oemSSDT"/* acpi_patcher.c */
38#define kOEMHPET"oemHPET"/* acpi_patcher.c */
39#define kOEMSBST"oemSBST"/* acpi_patcher.c */
40#define kOEMECDT"oemECDT"/* acpi_patcher.c */
41#define kOEMASFT"oemASFT"/* acpi_patcher.c */
42#define kOEMDMAR"oemDMAR"/* acpi_patcher.c */
43#define kOEMFADT"oemFADT"/* acpi_patcher.c */
44#define kOEMAPIC"oemAPIC"/* acpi_patcher.c */
45#define kOEMMCFG"oemMCFG"/* acpi_patcher.c */
46
47#define kUpdateACPI"UpdateACPI" /* acpi_patcher.c */
48
49#define kDisableASPM"DisableASPM"/* acpi_patcher.c */
50#define kDisableMSI"DisableMSI"/* acpi_patcher.c */
51
52#if UNUSED
53#define kGenerateFACS"GenerateFACS"/* acpi_patcher.c */
54#define kOEMFACS"oemFACS"/* acpi_patcher.c */
55#endif
56
57extern EFI_STATUS setupAcpi();
58
59struct p_state
60{
61union
62{
63uint16_t Control;
64struct
65{
66uint8_t VID;// Voltage ID
67uint8_t FID;// Frequency ID
68};
69};
70
71uint8_tCID;// Compare ID
72uint32_tFrequency;
73};
74
75/*
76 * SIGNATURE_16, SIGNATURE_32, SIGNATURE_64 are extracted from the edk2 project (Base.h), and are under the following license:
77 *
78 * Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
79 * Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
80 * This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.
81 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
82 */
83
84#define SIGNATURE_16(A, B) ((A) | (B << 8))
85
86#define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
87
88#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
89(SIGNATURE_32 (A, B, C, D) | ((uint64_t) (SIGNATURE_32 (E, F, G, H)) << 32))
90
91#define ACPI_SIGNATURE_UINT64_LE SIGNATURE_64('R','S','D',' ','P','T','R',' ')
92
93
94/* Per ACPI 3.0a spec */
95
96// TODO Migrate
97struct acpi_2_rsdp {
98 char Signature[8];
99 uint8_t Checksum;
100 char OEMID[6];
101 uint8_t Revision;
102 uint32_t RsdtAddress;
103 uint32_t Length;
104 uint64_t XsdtAddress;
105 uint8_t ExtendedChecksum;
106 char Reserved[3];
107} __attribute__((packed));
108
109
110#define ACPI_HEADER_CORE\
111char Signature[4];\
112uint32_t Length;\
113uint8_t Revision;\
114uint8_t Checksum;\
115char OEMID[6];\
116char OEMTableId[8];\
117uint32_t OEMRevision;\
118uint32_t CreatorId;\
119uint32_t CreatorRevision;
120
121struct acpi_common_header {
122ACPI_HEADER_CORE
123} __attribute__((packed));
124
125// TODO Migrate
126struct acpi_2_rsdt {
127ACPI_HEADER_CORE
128} __attribute__((packed));
129
130// TODO Migrate
131struct acpi_2_xsdt {
132ACPI_HEADER_CORE
133} __attribute__((packed));
134
135// TODO Migrate
136struct acpi_2_gas {
137uint8_tAddress_Space_ID;
138uint8_tRegister_Bit_Width;
139uint8_tRegister_Bit_Offset;
140uint8_tAccess_Size;
141uint64_tAddress;
142} __attribute__((packed));
143
144// TODO Migrate
145struct acpi_2_ssdt {
146ACPI_HEADER_CORE
147} __attribute__((packed));
148
149// TODO Migrate
150struct acpi_2_dsdt {
151ACPI_HEADER_CORE
152} __attribute__((packed));
153
154// TODO Migrate
155struct acpi_2_fadt {
156ACPI_HEADER_CORE
157uint32_t FIRMWARE_CTRL;
158uint32_t DSDT;
159uint8_t Model;// JrCs
160uint8_t PM_Profile;// JrCs
161uint16_tSCI_Interrupt;
162uint32_tSMI_Command_Port;
163uint8_tACPI_Enable;
164uint8_tACPI_Disable;
165uint8_tS4BIOS_Command;
166uint8_tPState_Control;
167uint32_tPM1A_Event_Block_Address;
168uint32_tPM1B_Event_Block_Address;
169uint32_tPM1A_Control_Block_Address;
170uint32_tPM1B_Control_Block_Address;
171uint32_tPM2_Control_Block_Address;
172uint32_tPM_Timer_Block_Address;
173uint32_tGPE0_Block_Address;
174uint32_tGPE1_Block_Address;
175uint8_tPM1_Event_Block_Length;
176uint8_tPM1_Control_Block_Length;
177uint8_tPM2_Control_Block_Length;
178uint8_tPM_Timer_Block_Length;
179uint8_tGPE0_Block_Length;
180uint8_tGPE1_Block_Length;
181uint8_tGPE1_Base_Offset;
182uint8_tCST_Support;
183uint16_tC2_Latency;
184uint16_tC3_Latency;
185uint16_tCPU_Cache_Size;
186uint16_tCache_Flush_Stride;
187uint8_tDuty_Cycle_Offset;
188uint8_tDuty_Cycle_Width;
189uint8_tRTC_Day_Alarm_Index;
190uint8_tRTC_Month_Alarm_Index;
191uint8_tRTC_Century_Index;
192uint16_tBoot_Flags;
193uint8_tReserved0;
194 /* Begin Asere */
195//Reset Fix
196uint32_tFlags;
197struct acpi_2_gasRESET_REG;
198uint8_tReset_Value;
199uint8_tReserved[3];
200
201uint64_tX_FIRMWARE_CTRL;
202uint64_tX_DSDT;
203
204#if UNUSED
205/* End Asere */
206/*We absolutely don't care about theese fields*/
207uint8_tnotimp2[96];
208#else
209struct acpi_2_gasX_PM1a_EVT_BLK;
210struct acpi_2_gasX_PM1b_EVT_BLK;
211struct acpi_2_gasX_PM1a_CNT_BLK;
212struct acpi_2_gasX_PM1b_CNT_BLK;
213struct acpi_2_gasX_PM2_CNT_BLK;
214struct acpi_2_gasX_PM_TMR_BLK;
215struct acpi_2_gasX_GPE0_BLK;
216struct acpi_2_gasX_GPE1_BLK;
217#endif
218
219} __attribute__((packed));
220
221struct acpi_2_facs {
222charSignature[4];
223uint32_t Length;
224uint32_thardware_signature;
225uint32_tfirmware_waking_vector;
226uint32_tglobal_lock;
227uint32_tflags;
228uint64_tx_firmware_waking_vector;
229uint8_tversion;
230uint8_tReserved[3];
231uint32_tospm_flags;
232uint8_tReserved1[24];
233} __attribute__ ((packed));
234
235#endif /* !__LIBSAIO_ACPI_PATCHER_H */
236

Archive Download this file

Revision: 1126