File: /usr/include/linux/acpi.h

1     /*
2      *  acpi.h - ACPI driver interface
3      *
4      *  Copyright (C) 1999 Andrew Henroid
5      *
6      *  This program is free software; you can redistribute it and/or modify
7      *  it under the terms of the GNU General Public License as published by
8      *  the Free Software Foundation; either version 2 of the License, or
9      *  (at your option) any later version.
10      *
11      *  This program is distributed in the hope that it will be useful,
12      *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13      *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14      *  GNU General Public License for more details.
15      *
16      *  You should have received a copy of the GNU General Public License
17      *  along with this program; if not, write to the Free Software
18      *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19      */
20     
21     #ifndef _LINUX_ACPI_H
22     #define _LINUX_ACPI_H
23     
24     #include <linux/types.h>
25     #include <linux/ioctl.h>
26     #ifdef __KERNEL__
27     #include <linux/sched.h>
28     #include <linux/wait.h>
29     #endif /* __KERNEL__ */
30     
31     typedef int acpi_sstate_t;
32     
33     /*
34      * Device states
35      */
36     enum
37     {
38     	ACPI_D0, /* fully-on */
39     	ACPI_D1, /* partial-on */
40     	ACPI_D2, /* partial-on */
41     	ACPI_D3, /* fully-off */
42     };
43     
44     typedef int acpi_dstate_t;
45     
46     /* RSDP location */
47     #define ACPI_BIOS_ROM_BASE (0x0e0000)
48     #define ACPI_BIOS_ROM_END  (0x100000)
49     
50     /* Table signatures */
51     #define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */
52     #define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */
53     #define ACPI_RSDT_SIG  0x54445352 /* 'RSDT' */
54     #define ACPI_FADT_SIG  0x50434146 /* 'FACP' */
55     #define ACPI_DSDT_SIG  0x54445344 /* 'DSDT' */
56     #define ACPI_FACS_SIG  0x53434146 /* 'FACS' */
57     
58     #define ACPI_SIG_LEN		4
59     #define ACPI_FADT_SIGNATURE	"FACP"
60     
61     /* PM1_STS/EN flags */
62     #define ACPI_TMR    0x0001
63     #define ACPI_BM	    0x0010
64     #define ACPI_GBL    0x0020
65     #define ACPI_PWRBTN 0x0100
66     #define ACPI_SLPBTN 0x0200
67     #define ACPI_RTC    0x0400
68     #define ACPI_WAK    0x8000
69     
70     /* PM1_CNT flags */
71     #define ACPI_SCI_EN   0x0001
72     #define ACPI_BM_RLD   0x0002
73     #define ACPI_GBL_RLS  0x0004
74     #define ACPI_SLP_TYP0 0x0400
75     #define ACPI_SLP_TYP1 0x0800
76     #define ACPI_SLP_TYP2 0x1000
77     #define ACPI_SLP_EN   0x2000
78     
79     #define ACPI_SLP_TYP_MASK  0x1c00
80     #define ACPI_SLP_TYP_SHIFT 10
81     
82     /* PM_TMR masks */
83     #define ACPI_TMR_VAL_EXT 0x00000100
84     #define ACPI_TMR_MASK	 0x00ffffff
85     #define ACPI_TMR_HZ	 3579545 /* 3.58 MHz */
86     #define ACPI_TMR_KHZ	 (ACPI_TMR_HZ / 1000)
87     
88     #define ACPI_MICROSEC_TO_TMR_TICKS(val) \
89       (((val) * (ACPI_TMR_KHZ)) / 1000)
90     
91     /* PM2_CNT flags */
92     #define ACPI_ARB_DIS 0x01
93     
94     /* FADT flags */
95     #define ACPI_WBINVD	  0x00000001
96     #define ACPI_WBINVD_FLUSH 0x00000002
97     #define ACPI_PROC_C1	  0x00000004
98     #define ACPI_P_LVL2_UP	  0x00000008
99     #define ACPI_PWR_BUTTON	  0x00000010
100     #define ACPI_SLP_BUTTON	  0x00000020
101     #define ACPI_FIX_RTC	  0x00000040
102     #define ACPI_RTC_64	  0x00000080
103     #define ACPI_TMR_VAL_EXT  0x00000100
104     #define ACPI_DCK_CAP	  0x00000200
105     
106     /* FADT BOOT_ARCH flags */
107     #define FADT_BOOT_ARCH_LEGACY_DEVICES	0x0001
108     #define FADT_BOOT_ARCH_KBD_CONTROLLER	0x0002
109     
110     /* FACS flags */
111     #define ACPI_S4BIOS	  0x00000001
112     
113     /* processor block offsets */
114     #define ACPI_P_CNT	  0x00000000
115     #define ACPI_P_LVL2	  0x00000004
116     #define ACPI_P_LVL3	  0x00000005
117     
118     /* C-state latencies (microseconds) */
119     #define ACPI_MAX_P_LVL2_LAT 100
120     #define ACPI_MAX_P_LVL3_LAT 1000
121     #define ACPI_INFINITE_LAT   (~0UL)
122     
123     /*
124      * Sysctl declarations
125      */
126     
127     enum
128     {
129     	CTL_ACPI = 10
130     };
131     
132     enum
133     {
134     	ACPI_FADT = 1,
135     	ACPI_DSDT,
136     	ACPI_PM1_ENABLE,
137     	ACPI_GPE_ENABLE,
138     	ACPI_GPE_LEVEL,
139     	ACPI_EVENT,
140     	ACPI_P_BLK,
141     	ACPI_ENTER_LVL2_LAT,
142     	ACPI_ENTER_LVL3_LAT,
143     	ACPI_P_LVL2_LAT,
144     	ACPI_P_LVL3_LAT,
145     	ACPI_C1_TIME,
146     	ACPI_C2_TIME,
147     	ACPI_C3_TIME,
148     	ACPI_C1_COUNT,
149     	ACPI_C2_COUNT,
150     	ACPI_C3_COUNT,
151     	ACPI_S0_SLP_TYP,
152     	ACPI_S1_SLP_TYP,
153     	ACPI_S5_SLP_TYP,
154     	ACPI_SLEEP,
155     	ACPI_FACS,
156     	ACPI_XSDT,
157     	ACPI_PMTIMER,
158     	ACPI_BATTERY,
159     };
160     
161     #define ACPI_SLP_TYP_DISABLED	(~0UL)
162     
163     #endif /* _LINUX_ACPI_H */
164