Import changeset
[linux-flexiantxendom0-3.2.10.git] / drivers / acpi / ec.h
1 /*
2  *  Copyright (C) 2000 Andrew Grover
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #ifndef __EC_H__
21 #define __EC_H__
22
23 // TODO: Linux-specific
24 #include <linux/spinlock.h>
25 #include <asm/semaphore.h>
26
27 #include <actypes.h>
28 #include <acexcep.h>
29
30 /*****************************************************************************
31  *                             Types & Other Defines
32  *****************************************************************************/
33
34 #define EC_DEFAULT_TIMEOUT              1000            /* 1 second */
35 #define EC_GPE_UNKNOWN                  0xFFFFFFFF
36 #define EC_PORT_UNKNOWN                 0x00000000
37 #define EC_BURST_ENABLE_ACKNOWLEDGE     0x90
38
39 /* 
40  * EC_COMMAND:
41  * -----------
42  */
43 typedef UINT8                           EC_COMMAND;
44
45 #define EC_COMMAND_UNKNOWN              ((EC_COMMAND) 0x00)
46 #define EC_COMMAND_READ                 ((EC_COMMAND) 0x80)
47 #define EC_COMMAND_WRITE                ((EC_COMMAND) 0x81)
48 #define EC_COMMAND_QUERY                ((EC_COMMAND) 0x84)
49
50 /*
51  * EC_STATUS:
52  * ----------
53  * The encoding of the EC status register is illustrated below.
54  * Note that a set bit (1) indicates the property is TRUE
55  * (e.g. if bit 0 is set then the output buffer is full).
56  * +-+-+-+-+-+-+-+-+
57  * |7|6|5|4|3|2|1|0|    
58  * +-+-+-+-+-+-+-+-+
59  *  | | | | | | | |
60  *  | | | | | | | +- Output Buffer Full (OBF)?
61  *  | | | | | | +--- Input Buffer Full (IBF)?
62  *  | | | | | +----- <reserved>
63  *  | | | | +------- data Register is command Byte?
64  *  | | | +--------- Burst Mode Enabled?
65  *  | | +----------- SCI event?
66  *  | +------------- SMI event?
67  *  +--------------- <Reserved>
68  *
69  */
70 typedef UINT8                           EC_STATUS;
71
72 #define EC_FLAG_OUTPUT_BUFFER           ((EC_STATUS) 0x01)
73 #define EC_FLAG_INPUT_BUFFER            ((EC_STATUS) 0x02)
74 #define EC_FLAG_BURST_MODE              ((EC_STATUS) 0x10)
75 #define EC_FLAG_SCI                     ((EC_STATUS) 0x20)
76
77 /* 
78  * EC_EVENT:
79  * ---------
80  */
81 typedef UINT8                           EC_EVENT;
82
83 #define EC_EVENT_UNKNOWN                ((EC_EVENT) 0x00)
84 #define EC_EVENT_NONE                   ((EC_EVENT) 0x00)
85 #define EC_EVENT_OUTPUT_BUFFER_FULL             ((EC_EVENT) 0x01)
86 #define EC_EVENT_INPUT_BUFFER_EMPTY     ((EC_EVENT) 0x02)
87 #define EC_EVENT_SCI                    ((EC_EVENT) 0x03)
88
89 /*
90  * EC_REQUEST:
91  * -----------
92  */
93 typedef struct
94 {
95     EC_COMMAND              command;
96     UINT8                   address;
97     UINT8                   data;
98 } EC_REQUEST;
99
100 #endif  /* __EC_H__ */