]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991 | |
24 | * All Rights Reserved | |
25 | * | |
26 | * Permission to use, copy, modify, and distribute this software and | |
27 | * its documentation for any purpose and without fee is hereby granted, | |
28 | * provided that the above copyright notice appears in all copies and | |
29 | * that both the copyright notice and this permission notice appear in | |
30 | * supporting documentation. | |
31 | * | |
32 | * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE | |
33 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
34 | * FOR A PARTICULAR PURPOSE. | |
35 | * | |
36 | * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR | |
37 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
38 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, | |
39 | * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | |
40 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
41 | * | |
42 | */ | |
43 | /* | |
44 | * Copyright 1996 1995 by Apple Computer, Inc. 1997 1996 1995 1994 1993 1992 1991 | |
45 | * All Rights Reserved | |
46 | * | |
47 | * Permission to use, copy, modify, and distribute this software and | |
48 | * its documentation for any purpose and without fee is hereby granted, | |
49 | * provided that the above copyright notice appears in all copies and | |
50 | * that both the copyright notice and this permission notice appear in | |
51 | * supporting documentation. | |
52 | * | |
53 | * APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE | |
54 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
55 | * FOR A PARTICULAR PURPOSE. | |
56 | * | |
57 | * IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR | |
58 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
59 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, | |
60 | * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | |
61 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
62 | */ | |
63 | /* | |
64 | * MKLINUX-1.0DR2 | |
65 | */ | |
66 | ||
67 | /* | |
68 | * 18 June 1998 sdouglas | |
69 | * Start IOKit version. | |
70 | */ | |
71 | ||
72 | struct cuda_packet { | |
73 | int a_hcount; | |
74 | unsigned char a_header[8]; | |
75 | int a_bcount; /* on entry size, on exit, actual */ | |
76 | unsigned char * a_buffer; /* ool data */ | |
77 | }; | |
78 | ||
79 | typedef struct cuda_packet cuda_packet_t; | |
80 | ||
81 | #ifdef __cplusplus | |
82 | class IOSyncer; | |
83 | ||
84 | struct cuda_request { | |
85 | cuda_packet_t a_cmd; /* Command packet */ | |
86 | cuda_packet_t a_reply; /* Reply packet */ | |
87 | volatile struct cuda_request* a_next; | |
88 | IOSyncer * sync; | |
89 | bool needWake; | |
90 | }; | |
91 | ||
92 | typedef struct cuda_request cuda_request_t; | |
93 | ||
94 | #else | |
95 | ||
96 | struct cuda_request { | |
97 | cuda_packet_t a_cmd; /* Command packet */ | |
98 | cuda_packet_t a_reply; /* Reply packet */ | |
99 | volatile struct cuda_request* a_next; | |
100 | void * sync; | |
101 | }; | |
102 | ||
103 | typedef struct cuda_request cuda_request_t; | |
104 | ||
105 | #endif | |
106 | ||
107 | ||
108 | /* | |
109 | * ADB Packet Types | |
110 | */ | |
111 | ||
112 | #define ADB_PACKET_ADB 0 | |
113 | #define ADB_PACKET_PSEUDO 1 | |
114 | #define ADB_PACKET_ERROR 2 | |
115 | #define ADB_PACKET_TIMER 3 | |
116 | #define ADB_PACKET_POWER 4 | |
117 | #define ADB_PACKET_MACIIC 5 | |
118 | ||
119 | /* | |
120 | * ADB Device Commands | |
121 | */ | |
122 | ||
123 | #define ADB_ADBCMD_RESET_BUS 0x00 | |
124 | #define ADB_ADBCMD_FLUSH_ADB 0x01 | |
125 | #define ADB_ADBCMD_WRITE_ADB 0x08 | |
126 | #define ADB_ADBCMD_READ_ADB 0x0c | |
127 | ||
128 | /* | |
129 | * ADB Pseudo Commands | |
130 | */ | |
131 | ||
132 | #define ADB_PSEUDOCMD_WARM_START 0x00 | |
133 | #define ADB_PSEUDOCMD_START_STOP_AUTO_POLL 0x01 | |
134 | #define ADB_PSEUDOCMD_GET_6805_ADDRESS 0x02 | |
135 | #define ADB_PSEUDOCMD_GET_REAL_TIME 0x03 | |
136 | #define ADB_PSEUDOCMD_GET_PRAM 0x07 | |
137 | #define ADB_PSEUDOCMD_SET_6805_ADDRESS 0x08 | |
138 | #define ADB_PSEUDOCMD_SET_REAL_TIME 0x09 | |
139 | #define ADB_PSEUDOCMD_POWER_DOWN 0x0a | |
140 | #define ADB_PSEUDOCMD_SET_POWER_UPTIME 0x0b | |
141 | #define ADB_PSEUDOCMD_SET_PRAM 0x0c | |
142 | #define ADB_PSEUDOCMD_MONO_STABLE_RESET 0x0d | |
143 | #define ADB_PSEUDOCMD_SEND_DFAC 0x0e | |
144 | #define ADB_PSEUDOCMD_BATTERY_SWAP_SENSE 0x10 | |
145 | #define ADB_PSEUDOCMD_RESTART_SYSTEM 0x11 | |
146 | #define ADB_PSEUDOCMD_SET_IPL_LEVEL 0x12 | |
147 | #define ADB_PSEUDOCMD_FILE_SERVER_FLAG 0x13 | |
148 | #define ADB_PSEUDOCMD_SET_AUTO_RATE 0x14 | |
149 | #define ADB_PSEUDOCMD_GET_AUTO_RATE 0x16 | |
150 | #define ADB_PSEUDOCMD_SET_DEVICE_LIST 0x19 | |
151 | #define ADB_PSEUDOCMD_GET_DEVICE_LIST 0x1a | |
152 | #define ADB_PSEUDOCMD_SET_ONE_SECOND_MODE 0x1b | |
153 | #define ADB_PSEUDOCMD_SET_POWER_MESSAGES 0x21 | |
154 | #define ADB_PSEUDOCMD_GET_SET_IIC 0x22 | |
155 | #define ADB_PSEUDOCMD_ENABLE_DISABLE_WAKEUP 0x23 | |
156 | #define ADB_PSEUDOCMD_TIMER_TICKLE 0x24 | |
157 | #define ADB_PSEUDOCMD_COMBINED_FORMAT_IIC 0X25 | |
158 | ||
159 | /* | |
160 | * Following values to be used with ADB_PSEUDOCMD_SET_POWER_MESSAGES | |
161 | */ | |
162 | enum { | |
163 | kADB_powermsg_disable = 0, | |
164 | kADB_powermsg_enable, | |
165 | kADB_powermsg_suspend, | |
166 | kADB_powermsg_continue, | |
167 | kADB_powermsg_debugger, | |
168 | kADB_powermsg_timed_ADB, | |
169 | kADB_powermsg_timed_power, | |
170 | kADB_powermsg_invalid | |
171 | }; | |
172 | ||
173 | //These constants are used to parse Cuda power message response | |
174 | // packets, to see which selector transitioned | |
175 | enum { | |
176 | kADB_powermsg_flag_rotary = 0x20, | |
177 | kADB_powermsg_flag_chassis = 0x02, | |
178 | kADB_powermsg_flag_keyboardpwr = 0x04, | |
179 | kADB_powermsg_cmd_chassis_off = 0x00, | |
180 | kADB_powermsg_cmd_keyboardoff = 0x04, | |
181 | kADB_powermsg_cmd_keyboardtimed = 0x00, | |
182 | kADB_powermsg_cmd_rotary_lock = 0x01, | |
183 | kADB_powermsg_cmd_rotary_unlock = 0x02 | |
184 | }; | |
185 | ||
186 | ||
187 | /* | |
188 | * Macros to help build commands up | |
189 | */ | |
190 | ||
191 | #define ADB_BUILD_CMD1(c, p1) {(c)->a_cmd.a_header[0] = p1; (c)->a_cmd.a_hcount = 1; } | |
192 | #define ADB_BUILD_CMD2(c, p1, p2) {(c)->a_cmd.a_header[0] = p1; (c)->a_cmd.a_header[1] = p2; (c)->a_cmd.a_hcount = 2; } | |
193 | #define ADB_BUILD_CMD3(c, p1, p2, p3) {(c)->a_cmd.a_header[0] = p1; (c)->a_cmd.a_header[1] = p2; (c)->a_cmd.a_header[2] = p3; (c)->a_cmd.a_hcount = 3; } | |
194 | ||
195 | #define ADB_BUILD_CMD4(c, p1, p2, p3, p4) {(c)->a_cmd.a_header[0] = p1; (c)->a_cmd.a_header[1] = p2; \ | |
196 | (c)->a_cmd.a_header[2] = p3; (c)->a_cmd.a_header[3] = p4; (c)->a_cmd.a_hcount = 4; } | |
197 | #if 0 | |
198 | #define ADB_BUILD_CMD2_BUFFER(c, p1, p2, len, buf) {(c)->a_cmd.a_header[0] = p1; (c)->a_cmd.a_header[1] = p2; (c)->a_cmd.a_hcount = 2;\ | |
199 | (c)->a_cmd.a_bcount = len;\ | |
200 | memcpy(&(c)->a_cmd.a_buffer, buf, len); } | |
201 | ||
202 | #endif | |
203 | ||
204 | #define adb_init_request(a) { bzero((char *) a, sizeof(*a)); } | |
205 | ||
206 | ||
207 |