Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/libsaio/acpi.h

1#ifndef __LIBSAIO_ACPI_H
2#define __LIBSAIO_ACPI_H
3
4#define ACPI_RANGE_START (0x0E0000)
5#define ACPI_RANGE_END (0x0FFFFF)
6
7/*
8 * SIGNATURE_16, SIGNATURE_32, SIGNATURE_64 are extracted from the edk2 project (Base.h), and are under the following license:
9 *
10 * Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
11 * Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
12 * 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.
13 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 */
15
16#define SIGNATURE_16(A, B) ((A) | (B << 8))
17
18#define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
19
20#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
21(SIGNATURE_32 (A, B, C, D) | ((uint64_t) (SIGNATURE_32 (E, F, G, H)) << 32))
22
23#define ACPI_SIGNATURE_UINT64_LE SIGNATURE_64('R','S','D',' ','P','T','R',' ')
24
25#define Unspecified 0
26#define Desktop 1
27#define Mobile 2
28#define Workstation 3
29#define EnterpriseServer 4
30#define SOHOServer 5
31#define AppliancePC 6
32
33#define MaxSupportedPMProfile AppliancePC // max profile currently supported
34#define PMProfileError MaxSupportedPMProfile + 1
35
36/* Per ACPI 3.0a spec */
37
38// TODO Migrate
39struct acpi_2_rsdp {
40 char Signature[8];
41 uint8_t Checksum;
42 char OEMID[6];
43 uint8_t Revision;
44 uint32_t RsdtAddress;
45 uint32_t Length;
46 uint64_t XsdtAddress;
47 uint8_t ExtendedChecksum;
48 char Reserved[3];
49} __attribute__((packed));
50
51
52#define ACPI_HEADER_CORE\
53char Signature[4];\
54uint32_t Length;\
55uint8_t Revision;\
56uint8_t Checksum;\
57char OEMID[6];\
58char OEMTableId[8];\
59uint32_t OEMRevision;\
60uint32_t CreatorId;\
61uint32_t CreatorRevision;
62
63struct acpi_common_header {
64ACPI_HEADER_CORE
65} __attribute__((packed));
66
67// TODO Migrate
68struct acpi_2_rsdt {
69ACPI_HEADER_CORE
70} __attribute__((packed));
71
72// TODO Migrate
73struct acpi_2_xsdt {
74ACPI_HEADER_CORE
75} __attribute__((packed));
76
77// TODO Migrate
78struct acpi_2_gas {
79uint8_tAddress_Space_ID;
80uint8_tRegister_Bit_Width;
81uint8_tRegister_Bit_Offset;
82uint8_tAccess_Size;
83uint64_tAddress;
84} __attribute__((packed));
85
86// TODO Migrate
87struct acpi_2_ssdt {
88ACPI_HEADER_CORE
89} __attribute__((packed));
90
91// TODO Migrate
92struct acpi_2_dsdt {
93ACPI_HEADER_CORE
94} __attribute__((packed));
95
96// TODO Migrate
97struct acpi_2_fadt {
98ACPI_HEADER_CORE
99uint32_t FIRMWARE_CTRL;
100uint32_t DSDT;
101uint8_t Model;// JrCs
102uint8_t PM_Profile;// JrCs
103uint16_tSCI_Interrupt;
104uint32_tSMI_Command_Port;
105uint8_tACPI_Enable;
106uint8_tACPI_Disable;
107uint8_tS4BIOS_Command;
108uint8_tPState_Control;
109uint32_tPM1A_Event_Block_Address;
110uint32_tPM1B_Event_Block_Address;
111uint32_tPM1A_Control_Block_Address;
112uint32_tPM1B_Control_Block_Address;
113uint32_tPM2_Control_Block_Address;
114uint32_tPM_Timer_Block_Address;
115uint32_tGPE0_Block_Address;
116uint32_tGPE1_Block_Address;
117uint8_tPM1_Event_Block_Length;
118uint8_tPM1_Control_Block_Length;
119uint8_tPM2_Control_Block_Length;
120uint8_tPM_Timer_Block_Length;
121uint8_tGPE0_Block_Length;
122uint8_tGPE1_Block_Length;
123uint8_tGPE1_Base_Offset;
124uint8_tCST_Support;
125uint16_tC2_Latency;
126uint16_tC3_Latency;
127uint16_tCPU_Cache_Size;
128uint16_tCache_Flush_Stride;
129uint8_tDuty_Cycle_Offset;
130uint8_tDuty_Cycle_Width;
131uint8_tRTC_Day_Alarm_Index;
132uint8_tRTC_Month_Alarm_Index;
133uint8_tRTC_Century_Index;
134uint16_tBoot_Flags;
135uint8_tReserved0;
136/* Begin Asere */
137//Reset Fix
138uint32_tFlags;
139struct acpi_2_gasRESET_REG;
140uint8_tReset_Value;
141uint8_tReserved[3];
142
143uint64_tX_FIRMWARE_CTRL;
144uint64_tX_DSDT;
145
146#if UNUSED
147/* End Asere */
148/*We absolutely don't care about theese fields*/
149uint8_tnotimp2[96];
150#else
151struct acpi_2_gasX_PM1a_EVT_BLK;
152struct acpi_2_gasX_PM1b_EVT_BLK;
153struct acpi_2_gasX_PM1a_CNT_BLK;
154struct acpi_2_gasX_PM1b_CNT_BLK;
155struct acpi_2_gasX_PM2_CNT_BLK;
156struct acpi_2_gasX_PM_TMR_BLK;
157struct acpi_2_gasX_GPE0_BLK;
158struct acpi_2_gasX_GPE1_BLK;
159#endif
160
161} __attribute__((packed));
162
163struct acpi_2_facs {
164charSignature[4];
165uint32_t Length;
166uint32_thardware_signature;
167uint32_tfirmware_waking_vector;
168uint32_tglobal_lock;
169uint32_tflags;
170uint64_tx_firmware_waking_vector;
171uint8_tversion;
172uint8_tReserved[31];
173} __attribute__ ((packed));
174
175#endif /* !__LIBSAIO_ACPI_H */
176

Archive Download this file

Revision: 789