Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / i2o / dptivar.h
blob00387365d9564b2fa73289e8309034f905567120
1 /* $NetBSD: dptivar.h,v 1.6 2007/03/04 06:01:47 christos Exp $ */
3 /*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Copyright (c) 1996-2000 Distributed Processing Technology Corporation
34 * Copyright (c) 2000 Adaptec Corporation
35 * All rights reserved.
37 * TERMS AND CONDITIONS OF USE
39 * Redistribution and use in source form, with or without modification, are
40 * permitted provided that redistributions of source code must retain the
41 * above copyright notice, this list of conditions and the following disclaimer.
43 * This software is provided `as is' by Adaptec and any express or implied
44 * warranties, including, but not limited to, the implied warranties of
45 * merchantability and fitness for a particular purpose, are disclaimed. In no
46 * event shall Adaptec be liable for any direct, indirect, incidental, special,
47 * exemplary or consequential damages (including, but not limited to,
48 * procurement of substitute goods or services; loss of use, data, or profits;
49 * or business interruptions) however caused and on any theory of liability,
50 * whether in contract, strict liability, or tort (including negligence or
51 * otherwise) arising in any way out of the use of this driver software, even
52 * if advised of the possibility of such damage.
55 #ifndef _I2O_DPTIVAR_H_
56 #define _I2O_DPTIVAR_H_
58 #define DPTI_MAX_SEGS 17
61 * Runtime state.
63 struct dpti_softc {
64 struct device sc_dv;
65 int sc_blinkled;
66 int sc_nactive;
69 struct dpti_ptbuf {
70 void * db_ptr;
71 struct proc *db_proc;
72 int db_size;
73 int db_out;
74 int db_nfrag;
75 struct iovec db_frags[DPTI_MAX_SEGS];
79 * Constants used by the `signature'.
82 /* I2O */
83 #define DPTI_VERSION 1
84 #define DPTI_REVISION 0
85 #define DPTI_SUBREVISION 0
87 #define DPTI_YEAR 1
88 #define DPTI_MONTH 9
89 #define DPTI_DAY 12
91 /* EATA */
92 #define DPT_VERSION 1
93 #define DPT_REVISION 0
94 #define DPT_SUBREVISION 0
96 #define DPT_YEAR 1
97 #define DPT_MONTH 9
98 #define DPT_DAY 12
101 * ioctls. We define only the lower 16 bits, since the DPT utilities don't
102 * seem to obey the ioctl encoding conventions of each platform - the high
103 * 16 bits are relatively meaningless.
105 #define DPT_EATAUSRCMD 0x4441
106 #define DPT_DEBUG 0x4442
107 #define DPT_SIGNATURE 0x4443
108 #define DPT_NUMCTRLS 0x4444
109 #define DPT_CTRLINFO 0x4445
110 #define DPT_STATINFO 0x4446
111 #define DPT_CLRSTAT 0x4447
112 #define DPT_SYSINFO 0x4448
113 #define DPT_TIMEOUT 0x4449
114 #define DPT_CONFIG 0x444a
115 #define DPT_BLINKLED 0x444b
116 #define DPT_I2OUSRCMD 0x444c
117 #define DPT_I2ORESCANCMD 0x444d
118 #define DPT_I2ORESETCMD 0x444e
119 #define DPT_TARGET_BUSY 0x444f
122 * Controller and system info structures.
124 struct dpt_ctlrinfo {
125 u_int16_t length;
126 u_int16_t drvrHBAnum;
127 u_int32_t baseAddr;
128 u_int16_t blinkState;
129 u_int8_t pciBusNum;
130 u_int8_t pciDeviceNum;
131 u_int16_t hbaFlags;
132 u_int16_t Interrupt;
133 u_int32_t reserved1;
134 u_int32_t reserved2;
135 u_int32_t reserved3;
137 #define FLG_OSD_PCI_VALID 0x0001
138 #define FLG_OSD_DMA 0x0002
139 #define FLG_OSD_I2O 0x0004
141 struct dpt_eata_ctlrinfo {
142 u_int8_t state;
143 u_int8_t id;
144 int vect;
145 int base;
146 int njobs;
147 int qdepth;
148 int wakebase;
149 u_long sgsize;
150 u_int heads;
151 u_int sectors;
152 u_int8_t do_drive32;
153 u_int8_t busquiet;
154 u_int8_t idpal[4];
155 u_int8_t primary;
156 u_int8_t eataVersion;
157 u_long cpLength;
158 u_long spLength;
159 u_int8_t drqNum;
160 u_int8_t flag1;
161 u_int8_t flag2;
164 struct dpt_targetbusy {
165 u_long channel;
166 u_long id;
167 u_long lun;
168 u_long isbusy;
171 #if (!defined(dsDescription_size))
172 # define dsDescription_size 46
173 #endif
175 struct dpt_sig {
176 char dsSignature[6]; /* ALWAYS "dPtSiG" */
177 u_int8_t dsSigVersion; /* sig version (currently 1) */
178 u_int8_t dsProcessorFamily; /* what type of processor */
179 u_int8_t dsProcessor; /* precise processor */
180 u_int8_t dsFiletype; /* type of file */
181 u_int8_t dsFiletypeFlags; /* flags to specify type, etc. */
182 u_int8_t dsOEM; /* OEM file was created for */
183 u_int32_t dsOS; /* which Operating systems */
184 u_int16_t dsCapabilities; /* RAID levels, etc. */
185 u_int16_t dsDeviceSupp; /* SCSI device types supported */
186 u_int16_t dsAdapterSupp; /* DPT HBA families supported */
187 u_int16_t dsApplication; /* applications file is for */
188 u_int8_t dsRequirements; /* Other driver dependencies */
189 u_int8_t dsVersion; /* 1 */
190 u_int8_t dsRevision; /* 'J' */
191 u_int8_t dsSubRevision; /* '9' ' ' if N/A */
192 u_int8_t dsMonth; /* creation month */
193 u_int8_t dsDay; /* creation day */
194 u_int8_t dsYear; /* creation year since 1980 (1993=13) */
195 char dsDescription[dsDescription_size];
198 struct dpt_dparam {
199 u_int16_t cylinders; /* Upto 1024 */
200 u_int8_t heads; /* Upto 255 */
201 u_int8_t sectors; /* Upto 63 */
204 struct dpt_sysinfo {
205 u_int8_t drive0CMOS; /* CMOS Drive 0 Type */
206 u_int8_t drive1CMOS; /* CMOS Drive 1 Type */
207 u_int8_t numDrives; /* 0040:0075 contents */
208 u_int8_t processorFamily; /* Same as DPTSIG's defs */
209 u_int8_t processorType; /* Same as DPTSIG's defs */
210 u_int8_t smartROMMajorVersion;
211 u_int8_t smartROMMinorVersion; /* SmartROM version */
212 u_int8_t smartROMRevision;
213 u_int16_t flags; /* See bit definitions above */
214 u_int16_t conventionalMemSize; /* in KB */
215 u_int32_t extendedMemSize; /* in KB */
216 u_int32_t osType; /* Same as DPTSIG's defs */
217 u_int8_t osMajorVersion;
218 u_int8_t osMinorVersion; /* The OS version */
219 u_int8_t osRevision;
220 u_int8_t osSubRevision;
221 u_int8_t busType; /* See defininitions above */
222 u_int8_t pad[3]; /* For alignment */
223 struct dpt_dparam drives[16]; /* SmartROM Logical Drives */
227 * Defs pertaining to dpt_sysinfo.
230 #define SI_CMOS_Valid 0x0001
231 #define SI_NumDrivesValid 0x0002
232 #define SI_ProcessorValid 0x0004
233 #define SI_MemorySizeValid 0x0008
234 #define SI_DriveParamsValid 0x0010
235 #define SI_SmartROMverValid 0x0020
236 #define SI_OSversionValid 0x0040
237 #define SI_OSspecificValid 0x0080
238 #define SI_BusTypeValid 0x0100
239 #define SI_ALL_VALID 0x0FFF
240 #define SI_NO_SmartROM 0x8000
242 #define SI_ISA_BUS 0x00
243 #define SI_MCA_BUS 0x01
244 #define SI_EISA_BUS 0x02
245 #define SI_PCI_BUS 0x04
249 * Defs pertaining to dpt_sig.
252 /* Current Signature Version - u_int8_t dsSigVersion; */
253 /* ------------------------------------------------------------------ */
254 #define SIG_VERSION 1
256 /* Processor Family - u_int8_t dsProcessorFamily; DISTINCT VALUES */
257 /* ------------------------------------------------------------------ */
258 /* What type of processor the file is meant to run on. */
259 /* This will let us know whether to read u_int16_ts as high/low or low/high. */
260 #define PROC_INTEL 0x00 /* Intel 80x86 */
261 #define PROC_MOTOROLA 0x01 /* Motorola 68K */
262 #define PROC_MIPS4000 0x02 /* MIPS RISC 4000 */
263 #define PROC_MIPS 0x02 /* MIPS RISC */
264 #define PROC_ALPHA 0x03 /* DEC Alpha */
265 #define PROC_POWERPC 0x04 /* IBM Power PC */
266 #define PROC_i960 0x05 /* Intel i960 */
267 #define PROC_ULTRASPARC 0x06 /* SPARC processor */
269 /* Specific Minimim Processor - u_int8_t dsProcessor; FLAG BITS */
270 /* ------------------------------------------------------------------ */
271 /* Different bit definitions dependent on processor_family */
273 /* PROC_INTEL: */
274 #define PROC_8086 0x01 /* Intel 8086 */
275 #define PROC_286 0x02 /* Intel 80286 */
276 #define PROC_386 0x04 /* Intel 80386 */
277 #define PROC_486 0x08 /* Intel 80486 */
278 #define PROC_PENTIUM 0x10 /* Intel 586 aka P5 aka Pentium */
279 #define PROC_SEXIUM 0x20 /* Intel 686 aka P6 aka Pentium Pro or MMX */
281 /* PROC_i960: */
282 #define PROC_960RX 0x01 /* Intel 80960RP/RD */
283 #define PROC_960HX 0x02 /* Intel 80960HA/HD/HT */
284 #define PROC_960RN 0x03 /* Intel 80960RN/RM */
285 #define PROC_960RS 0x04 /* Intel 80960RS */
287 /* PROC_MOTOROLA: */
288 #define PROC_68000 0x01 /* Motorola 68000 */
289 #define PROC_68010 0x02 /* Motorola 68010 */
290 #define PROC_68020 0x04 /* Motorola 68020 */
291 #define PROC_68030 0x08 /* Motorola 68030 */
292 #define PROC_68040 0x10 /* Motorola 68040 */
294 /* PROC_POWERPC */
295 #define PROC_PPC601 0x01 /* PowerPC 601 */
296 #define PROC_PPC603 0x02 /* PowerPC 603 */
297 #define PROC_PPC604 0x04 /* PowerPC 604 */
299 /* PROC_MIPS */
300 #define PROC_R4000 0x01 /* MIPS R4000 */
301 #define PROC_RM7000 0x02 /* MIPS RM7000 */
303 /* Filetype - u_int8_t dsFiletype; DISTINCT VALUES */
304 /* ------------------------------------------------------------------ */
305 #define FT_EXECUTABLE 0 /* Executable Program */
306 #define FT_SCRIPT 1 /* Script/Batch File??? */
307 #define FT_HBADRVR 2 /* HBA Driver */
308 #define FT_OTHERDRVR 3 /* Other Driver */
309 #define FT_IFS 4 /* Installable Filesystem Driver */
310 #define FT_ENGINE 5 /* DPT Engine */
311 #define FT_COMPDRVR 6 /* Compressed Driver Disk */
312 #define FT_LANGUAGE 7 /* Foreign Language file */
313 #define FT_FIRMWARE 8 /* Downloadable or actual Firmware */
314 #define FT_COMMMODL 9 /* Communications Module */
315 #define FT_INT13 10 /* INT 13 style HBA Driver */
316 #define FT_HELPFILE 11 /* Help file */
317 #define FT_LOGGER 12 /* Event Logger */
318 #define FT_INSTALL 13 /* An Install Program */
319 #define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */
320 #define FT_RESOURCE 15 /* Storage Manager Resource File */
321 #define FT_MODEM_DB 16 /* Storage Manager Modem Database */
323 /* Filetype flags - u_int8_t dsFiletypeFlags; FLAG BITS */
324 /* ------------------------------------------------------------------ */
325 #define FTF_DLL 0x01 /* Dynamic Link Library */
326 #define FTF_NLM 0x02 /* Netware Loadable Module */
327 #define FTF_OVERLAYS 0x04 /* Uses overlays */
328 #define FTF_DEBUG 0x08 /* Debug version */
329 #define FTF_TSR 0x10 /* TSR */
330 #define FTF_SYS 0x20 /* DOS Loadable driver */
331 #define FTF_PROTECTED 0x40 /* Runs in protected mode */
332 #define FTF_APP_SPEC 0x80 /* Application Specific */
333 #define FTF_ROM (FTF_SYS|FTF_TSR) /* Special Case */
335 /* OEM - u_int8_t dsOEM; DISTINCT VALUES */
336 /* ------------------------------------------------------------------ */
337 #define OEM_DPT 0 /* DPT */
338 #define OEM_ATT 1 /* ATT */
339 #define OEM_NEC 2 /* NEC */
340 #define OEM_ALPHA 3 /* Alphatronix */
341 #define OEM_AST 4 /* AST */
342 #define OEM_OLIVETTI 5 /* Olivetti */
343 #define OEM_SNI 6 /* Siemens/Nixdorf */
344 #define OEM_SUN 7 /* SUN Microsystems */
345 #define OEM_ADAPTEC 8 /* Adaptec */
347 /* Operating System - u_int32_t dsOS; FLAG BITS */
348 /* ------------------------------------------------------------------ */
349 #define OS_DOS 0x00000001 /* PC/MS-DOS */
350 #define OS_WINDOWS 0x00000002 /* Microsoft Windows 3.x */
351 #define OS_WINDOWS_NT 0x00000004 /* Microsoft Windows NT */
352 #define OS_OS2M 0x00000008 /* OS/2 1.2.x,MS 1.3.0,IBM 1.3.x - Monolithic */
353 #define OS_OS2L 0x00000010 /* Microsoft OS/2 1.301 - LADDR */
354 #define OS_OS22x 0x00000020 /* IBM OS/2 2.x */
355 #define OS_NW286 0x00000040 /* Novell NetWare 286 */
356 #define OS_NW386 0x00000080 /* Novell NetWare 386 */
357 #define OS_GEN_UNIX 0x00000100 /* Generic Unix */
358 #define OS_SCO_UNIX 0x00000200 /* SCO Unix */
359 #define OS_ATT_UNIX 0x00000400 /* ATT Unix */
360 #define OS_UNIXWARE 0x00000800 /* USL Unix */
361 #define OS_INT_UNIX 0x00001000 /* Interactive Unix */
362 #define OS_SOLARIS 0x00002000 /* SunSoft Solaris */
363 #define OS_QNX 0x00004000 /* QNX for Tom Moch */
364 #define OS_NEXTSTEP 0x00008000 /* NeXTSTEP/OPENSTEP/MACH */
365 #define OS_BANYAN 0x00010000 /* Banyan Vines */
366 #define OS_OLIVETTI_UNIX 0x00020000/* Olivetti Unix */
367 #define OS_MAC_OS 0x00040000 /* Mac OS */
368 #define OS_WINDOWS_95 0x00080000 /* Microsoft Windows '95 */
369 #define OS_NW4x 0x00100000 /* Novell Netware 4.x */
370 #define OS_BSDI_UNIX 0x00200000 /* BSDi Unix BSD/OS 2.0 and up */
371 #define OS_AIX_UNIX 0x00400000 /* AIX Unix */
372 #define OS_FREE_BSD 0x00800000 /* FreeBSD Unix */
373 #define OS_LINUX 0x01000000 /* Linux */
374 #define OS_DGUX_UNIX 0x02000000 /* Data General Unix */
375 #define OS_SINIX_N 0x04000000 /* SNI SINIX-N */
376 #define OS_PLAN9 0x08000000 /* ATT Plan 9 */
377 #define OS_TSX 0x10000000 /* SNH TSX-32 */
378 #define OS_WINDOWS_98 0x20000000 /* Microsoft Windows '98 */
380 #define OS_OTHER 0x80000000 /* Other */
382 /* Capabilities - u_int16_t dsCapabilities; FLAG BITS */
383 /* ------------------------------------------------------------------ */
384 #define CAP_RAID0 0x0001 /* RAID-0 */
385 #define CAP_RAID1 0x0002 /* RAID-1 */
386 #define CAP_RAID3 0x0004 /* RAID-3 */
387 #define CAP_RAID5 0x0008 /* RAID-5 */
388 #define CAP_SPAN 0x0010 /* Spanning */
389 #define CAP_PASS 0x0020 /* Provides passthrough */
390 #define CAP_OVERLAP 0x0040 /* Passthrough supports overlapped commands */
391 #define CAP_ASPI 0x0080 /* Supports ASPI Command Requests */
392 #define CAP_ABOVE16MB 0x0100 /* ISA Driver supports greater than 16MB */
393 #define CAP_EXTEND 0x8000 /* Extended info appears after description */
394 #ifdef SNI_MIPS
395 #define CAP_CACHEMODE 0x1000 /* dpt_force_cache is set in driver */
396 #endif
398 /* Devices Supported - u_int16_t dsDeviceSupp; FLAG BITS */
399 /* ------------------------------------------------------------------ */
400 #define DEV_DASD 0x0001 /* DASD (hard drives) */
401 #define DEV_TAPE 0x0002 /* Tape drives */
402 #define DEV_PRINTER 0x0004 /* Printers */
403 #define DEV_PROC 0x0008 /* Processors */
404 #define DEV_WORM 0x0010 /* WORM drives */
405 #define DEV_CDROM 0x0020 /* CD-ROM drives */
406 #define DEV_SCANNER 0x0040 /* Scanners */
407 #define DEV_OPTICAL 0x0080 /* Optical Drives */
408 #define DEV_JUKEBOX 0x0100 /* Jukebox */
409 #define DEV_COMM 0x0200 /* Communications Devices */
410 #define DEV_OTHER 0x0400 /* Other Devices */
411 #define DEV_ALL 0xFFFF /* All SCSI Devices */
413 /* Adapters Families Supported - u_int16_t dsAdapterSupp; FLAG BITS */
414 /* ------------------------------------------------------------------ */
415 #define ADF_2001 0x0001 /* PM2001 */
416 #define ADF_2012A 0x0002 /* PM2012A */
417 #define ADF_PLUS_ISA 0x0004 /* PM2011,PM2021 */
418 #define ADF_PLUS_EISA 0x0008 /* PM2012B,PM2022 */
419 #define ADF_SC3_ISA 0x0010 /* PM2021 */
420 #define ADF_SC3_EISA 0x0020 /* PM2022,PM2122, etc */
421 #define ADF_SC3_PCI 0x0040 /* SmartCache III PCI */
422 #define ADF_SC4_ISA 0x0080 /* SmartCache IV ISA */
423 #define ADF_SC4_EISA 0x0100 /* SmartCache IV EISA */
424 #define ADF_SC4_PCI 0x0200 /* SmartCache IV PCI */
425 #define ADF_SC5_PCI 0x0400 /* Fifth Generation I2O products */
427 * Combinations of products
429 #define ADF_ALL_2000 (ADF_2001|ADF_2012A)
430 #define ADF_ALL_PLUS (ADF_PLUS_ISA|ADF_PLUS_EISA)
431 #define ADF_ALL_SC3 (ADF_SC3_ISA|ADF_SC3_EISA|ADF_SC3_PCI)
432 #define ADF_ALL_SC4 (ADF_SC4_ISA|ADF_SC4_EISA|ADF_SC4_PCI)
433 #define ADF_ALL_SC5 (ADF_SC5_PCI)
434 /* All EATA Cacheing Products */
435 #define ADF_ALL_CACHE (ADF_ALL_PLUS|ADF_ALL_SC3|ADF_ALL_SC4)
436 /* All EATA Bus Mastering Products */
437 #define ADF_ALL_MASTER (ADF_2012A|ADF_ALL_CACHE)
438 /* All EATA Adapter Products */
439 #define ADF_ALL_EATA (ADF_2001|ADF_ALL_MASTER)
440 #define ADF_ALL ADF_ALL_EATA
442 /* Application - u_int16_t dsApplication; FLAG BITS */
443 /* ------------------------------------------------------------------ */
444 #define APP_DPTMGR 0x0001 /* DPT Storage Manager */
445 #define APP_ENGINE 0x0002 /* DPT Engine */
446 #define APP_SYTOS 0x0004 /* Sytron Sytos Plus */
447 #define APP_CHEYENNE 0x0008 /* Cheyenne ARCServe + ARCSolo */
448 #define APP_MSCDEX 0x0010 /* Microsoft CD-ROM extensions */
449 #define APP_NOVABACK 0x0020 /* NovaStor Novaback */
450 #define APP_AIM 0x0040 /* Archive Information Manager */
452 /* Requirements - u_int8_t dsRequirements; FLAG BITS */
453 /* ------------------------------------------------------------------ */
454 #define REQ_SMARTROM 0x01 /* Requires SmartROM to be present */
455 #define REQ_DPTDDL 0x02 /* Requires DPTDDL.SYS to be loaded */
456 #define REQ_HBA_DRIVER 0x04 /* Requires an HBA driver to be loaded */
457 #define REQ_ASPI_TRAN 0x08 /* Requires an ASPI Transport Modules */
458 #define REQ_ENGINE 0x10 /* Requires a DPT Engine to be loaded */
459 #define REQ_COMM_ENG 0x20 /* Requires a DPT Communications Engine */
461 /* ------------------------------------------------------------------ */
462 /* Requirements - u_int16_t dsFirmware; FLAG BITS */
463 /* ------------------------------------------------------------------ */
464 #define dsFirmware dsApplication
465 #define FW_DNLDSIZE0 0x0000 /* 0..2 DownLoader Size - NONE */
466 #define FW_DNLDSIZE16 0x0001 /* 0..2 DownLoader Size 16K */
467 #define FW_DNLDSIZE32 0x0002 /* 0..2 DownLoader Size 32K */
468 #define FW_DNLDSIZE64 0x0004 /* 0..2 DownLoader Size 64K */
470 #define FW_LOAD_BTM 0x2000 /* 13 Load Offset (1=Btm, 0=Top) */
471 #define FW_LOAD_TOP 0x0000 /* 13 Load Offset (1=Btm, 0=Top) */
472 #define FW_SIG_VERSION1 0x0000 /* 15..14 Version Bits 0=Ver1 */
474 #endif /* !_I2O_DPTIVAR_H_ */