2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
24 * Author: Godfrey van der Linden, Apple Computer, Inc
27 * error codes for Mach and Unix kernels
30 #include <TargetConditionals.h>
31 #include <IOKit/IOReturn.h>
32 #if !TARGET_OS_EMBEDDED
33 #include <IOKit/usb/USB.h>
34 #include <IOKit/firewire/IOFireWireLib.h>
37 static const struct error_sparse_map err_codes_iokit_common_map[] = {
38 err_code_map_entry(kIOReturnInvalid, kIOReturnInvalid ),
39 err_code_map_entry(kIOReturnError, kIOReturnNotFound),
42 static const char * const err_codes_iokit_common[] = {
43 "(iokit/common) invalid - should never be seen", // 0x001
45 "(iokit/common) general error", // 0x2bc
46 "(iokit/common) can't allocate memory", // 0x2bd
47 "(iokit/common) resource shortage", // 0x2be
48 "(iokit/common) error during IPC", // 0x2bf
49 "(iokit/common) no such device", // 0x2c0
50 "(iokit/common) privilege violation", // 0x2c1
51 "(iokit/common) invalid argument", // 0x2c2
52 "(iokit/common) device read locked", // 0x2c3
53 "(iokit/common) device write locked", // 0x2c4
54 "(iokit/common) exclusive access and device already open", // 0x2c5
55 "(iokit/common) sent/received messages had different msg_id", // 0x2c6
56 "(iokit/common) unsupported function", // 0x2c7
57 "(iokit/common) misc. VM failure", // 0x2c8
58 "(iokit/common) internal error", // 0x2c9
59 "(iokit/common) General I/O error", // 0x2ca
60 "(iokit/common) ???", // 0x2cb
61 "(iokit/common) can't acquire lock", // 0x2cc
62 "(iokit/common) device not open", // 0x2cd
63 "(iokit/common) read not supported", // 0x2ce
64 "(iokit/common) write not supported", // 0x2cf
65 "(iokit/common) alignment error", // 0x2d0
66 "(iokit/common) Media Error", // 0x2d1
67 "(iokit/common) device(s) still open", // 0x2d2
68 "(iokit/common) rld failure", // 0x2d3
69 "(iokit/common) DMA failure", // 0x2d4
70 "(iokit/common) Device Busy", // 0x2d5
71 "(iokit/common) I/O Timeout", // 0x2d6
72 "(iokit/common) device offline", // 0x2d7
73 "(iokit/common) not ready", // 0x2d8
74 "(iokit/common) device not attached", // 0x2d9
75 "(iokit/common) no DMA channels left", // 0x2da
76 "(iokit/common) no space for data", // 0x2db
77 "(iokit/common) ???", // 0x2dc
78 "(iokit/common) port already exists", // 0x2dd
79 "(iokit/common) can't wire down physical memory", // 0x2de
80 "(iokit/common) no interrupt attached", // 0x2df
81 "(iokit/common) no DMA frames enqueued", // 0x2e0
82 "(iokit/common) oversized msg received on interrupt port", // 0x2e1
83 "(iokit/common) not permitted", // 0x2e2
84 "(iokit/common) no power to device", // 0x2e3
85 "(iokit/common) media not present", // 0x2e4
86 "(iokit/common) media not formatted", // 0x2e5
87 "(iokit/common) no such mode", // 0x2e6
88 "(iokit/common) data underrun", // 0x2e7
89 "(iokit/common) data overrun", // 0x2e8
90 "(iokit/common) the device is not working properly!", // 0x2e9
91 "(iokit/common) a completion routine is required", // 0x2ea
92 "(iokit/common) operation aborted", // 0x2eb
93 "(iokit/common) bus bandwidth would be exceeded", // 0x2ec
94 "(iokit/common) device not responding", // 0x2ed
95 "(iokit/common) isochronous I/O request for distant past!", // 0x2ee
96 "(iokit/common) isochronous I/O request for distant future", // 0x2ef
97 "(iokit/common) data was not found", // 0x2f0
100 #if !TARGET_OS_EMBEDDED
101 static const struct error_sparse_map err_codes_iokit_usb_map[] = {
102 err_code_map_entry(kIOUSBCRCErr, kIOUSBDataToggleErr),
103 err_code_map_entry(kIOUSBPIDCheckErr, kIOUSBWrongPIDErr),
104 err_code_map_entry(kIOUSBReserved1Err, kIOUSBLinkErr),
105 err_code_map_entry(kIOUSBDeviceNotHighSpeed, kIOUSBTransactionTimeout),
106 err_code_map_entry(kIOUSBConfigNotFound, kIOUSBEndpointNotFound),
107 err_code_map_entry(kIOUSBNotEnoughPowerErr, kIOUSBUnknownPipeErr),
110 // error codes with in 0xe0004000
111 static const char * const err_codes_iokit_usb[] = {
112 "(iokit/usb) USB Controller Error: bad CRC received", // 0x001
113 "(iokit/usb) USB Controller Error: bitstuffing", // 0x002
114 "(iokit/usb) USB Controller Error: Bad data toggle", // 0x003
116 "(iokit/usb) USB Controller Error: PID CRC error", // 0x006
117 "(iokit/usb) USB Controller Error: Bad or wrong PID", // 0x007
119 "(iokit/usb) Reserved", // 0x00a
120 "(iokit/usb) Reserved", // 0x00b
121 "(iokit/usb) USB Controller: Buffer Overrun", // 0x00c
122 "(iokit/usb) USB Controller: Buffer Underrun ", // 0x00d
123 "(iokit/usb) Transaction was not sent on the bus", // 0x00e
124 "(iokit/usb) Transaction was not sent on the bus", // 0x00f
125 "(iokit/usb) USB Controller: Link Error", // 0x010
127 "(iokit/usb) device is not high speed, ehci driver returns error", // 0x049
128 "(iokit/usb) synchronous usb request on the workloop thread", // 0x04a
129 "(iokit/usb) high speed hub error during split transaction", // 0x04b
130 "(iokit/usb) user land isoch call with unprepared frame-list", // 0x04c
131 "(iokit/usb) user land isoch call with unprepared data buffer", // 0x04d
132 "(iokit/usb) interface ref not recognized", // 0x050
133 "(iokit/usb) pipe has stalled, error needs to be cleared", // 0x04f
134 "(iokit/usb) transaction has been returned to the caller", // 0x050
135 "(iokit/usb) transaction timed out", // 0x051
137 "(iokit/usb) configuration not found", // 0x056
138 "(iokit/usb) endpoint not found", // 0x057
140 "(iokit/usb) not enough power for selected configuration", // 0x05d
141 "(iokit/usb) not enough pipes in interface", // 0x05e
142 "(iokit/usb) no async port", // 0x05f
143 "(iokit/usb) too many pipes", // 0x060
144 "(iokit/usb) pipe ref not recognized", // 0x061
147 static const struct error_sparse_map err_codes_iokit_fw_map[] = {
148 err_code_map_entry(kIOConfigNoEntry, kIOFireWireBusReset),
149 err_code_map_entry(kIOFireWireBogusDCLProgram, kIOFireWireCompleting),
150 err_code_map_entry(kIOFWMessageServiceIsRequestingClose, kIOFWMessageTopologyChanged),
153 // error codes with in 0xe0008000
154 static const char * const err_codes_iokit_fw[] = {
155 "(iokit/firewire) can't find requested entry in config ROM", // 001
156 "(iokit/firewire) command pending (internal)", // 002
157 "(iokit/firewire) DCL callback is final callback (internal)", // 003
158 "(iokit/firewire) device rom changed, ref is no longer valid", // 004
159 "(iokit/firewire) kIOFireWireAlreadyRegistered", // 005
160 "(iokit/firewire) kIOFireWireMultipleTalkers", // 006
161 "(iokit/firewire) kIOFireWireChannelActive", // 007
162 "(iokit/firewire) kIOFireWireNoListenerOrTalker", // 008
163 "(iokit/firewire) kIOFireWireNoChannels", // 009
164 "(iokit/firewire) requested isoch channel is in use", // 00A
165 "(iokit/firewire) kIOFireWireSeparateBus", // 00B
166 "(iokit/firewire) kIOFireWireBadSelfIDs", // 00C
167 "(iokit/firewire) kIOFireWireLowCableVoltage", // 00D
168 "(iokit/firewire) kIOFireWireInsufficientPower", // 00E
169 "(iokit/firewire) all transaction labels are in use", // 00f
170 "(iokit/firewire) rcode 0, resp_complete", // 010
171 "(iokit/firewire) rcode 1, reserved", // 011
172 "(iokit/firewire) rcode 2, reserved", // 012
173 "(iokit/firewire) rcode 3, reserved", // 013
174 "(iokit/firewire) rcode 4, resp_conflict_error", // 014
175 "(iokit/firewire) rcode 5, resp_data_error", // 015
176 "(iokit/firewire) rcode 6, resp_type_error", // 016
177 "(iokit/firewire) rcode 7, resp_address_error", // 017
178 "(iokit/firewire) rcode 8, reserved", // 018
179 "(iokit/firewire) rcode 9, reserved", // 019
180 "(iokit/firewire) rcode 10, reserved", // 01a
181 "(iokit/firewire) rcode 11, reserved", // 01b
182 "(iokit/firewire) rcode 12, reserved", // 01c
183 "(iokit/firewire) rcode 13, reserved", // 01d
184 "(iokit/firewire) rcode 14, reserved", // 01e
185 "(iokit/firewire) rcode 15, reserved", // 01f
186 "(iokit/firewire) bus reset occurred, generation does not match", // 020
188 "(iokit/firewire) DCL program contains an illegal DCL", // 101
189 "(iokit/firewire) kIOFireWireTalkingAndListening", // 102
190 "(iokit/firewire) system sleep, DCL program stopped", // 103
191 "(iokit/firewire) command is actively completing (internal)", // 104
193 "(iokit/firewire) device offline, please close device object", // 7d0
194 "(iokit/firewire) more power may be available", // 7d1
195 "(iokit/firewire) IOFireWire plane in registry updated", // 7d2
198 // error codes with in 0xe0020000
199 static const char * const err_codes_iokit_bluetooth[] = {
200 "(iokit/bluetooth) unknown error", // 000
201 "(iokit/bluetooth) interrupted operation, hardware reset", // 001
202 "(iokit/bluetooth) connection to device already exists", // 002
203 "(iokit/bluetooth) no HCI controller", // 003
204 "(iokit/bluetooth) changing power states is unsupported", // 004
206 #endif /* !TARGET_OS_EMBEDDED */
208 static const struct error_sparse_map err_iokit_sub_map[] = {
209 err_sub_map_entry(sub_iokit_common, sub_iokit_pmu),
210 err_sub_map_entry(sub_iokit_vendor_specific, sub_iokit_reserved)
213 #define err_iokit_null_sub { "(iokit/?", 0 }
214 static const struct error_subsystem err_iokit_sub[] =
217 "(iokit/common)", // 0xe0000000
218 errlib_count(err_codes_iokit_common),
219 err_codes_iokit_common,
220 err_codes_iokit_common_map,
221 errlib_count(err_codes_iokit_common_map),
223 #if !TARGET_OS_EMBEDDED
225 "(iokit/usb)", // 0xe0004000
226 errlib_count(err_codes_iokit_usb),
228 err_codes_iokit_usb_map,
229 errlib_count(err_codes_iokit_usb_map),
232 "(iokit/firewire)", // 0xe0008000
233 errlib_count(err_codes_iokit_fw),
235 err_codes_iokit_fw_map,
236 errlib_count(err_codes_iokit_fw_map),
238 #endif /* !TARGET_OS_EMBEDDED */
239 /* 3 */ err_iokit_null_sub, // 0xe000c000
240 /* 4 */ { "(iokit/blkstorage)", 0 }, // 0xe0010000
241 /* 5 */ { "(iokit/graphics)", 0 }, // 0xe0014000
242 /* 6 */ err_iokit_null_sub, // 0xe0018000
243 /* 7 */ err_iokit_null_sub, // 0xe001c000
244 #if !TARGET_OS_EMBEDDED
246 "(iokit/bluetooth)", // 0xe0020000
247 errlib_count(err_codes_iokit_bluetooth),
248 err_codes_iokit_bluetooth,
251 #endif /* !TARGET_OS_EMBEDDED */
252 /* 9 */ { "(iokit/pmu)", 0 }, // 0xe0024000
253 /* -2 */ { "(iokit/vendor)", 0 }, // 0xe0028000
254 /* -1 */ { "(iokit/reserved)", 0 }, // 0xe002c000
258 /* vim: set ft=c ts=8 sw=4: */