FreeBSD/Linux Kernel Cross Reference
sys/scsi/compat_30.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: compat_30.h,v $
29 * Revision 2.6 91/10/09 16:16:40 af
30 * Revision 2.5.1.1 91/08/29 18:10:28 af
31 * The 2.5 raw-I/O support code has moved, and became MI.
32 *
33 * Revision 2.5.1.1 91/08/29 18:10:28 af
34 * The 2.5 raw-I/O support code has moved, and became MI.
35 *
36 * Revision 2.5 91/08/24 12:27:32 af
37 * Corrected defines.
38 * [91/08/02 03:50:58 af]
39 *
40 * Revision 2.4 91/06/19 11:56:38 rvb
41 * File moved here from mips/PMAX since it is now "MI" code, also
42 * used by Vax3100 and soon -- the omron luna88k.
43 * [91/06/04 rvb]
44 *
45 * Revision 2.3 91/05/14 17:20:23 mrt
46 * Correcting copyright
47 *
48 * Revision 2.2 91/05/13 06:03:39 af
49 * Created.
50 * [91/05/12 16:02:24 af]
51 *
52 */
53 /*
54 * File: compat_30.h
55 * Author: Alessandro Forin, Carnegie Mellon University
56 * Date: 4/91
57 *
58 * Compatibility defs to retrofit Mach 3.0 drivers
59 * into Mach 2.6.
60 */
61
62 #ifndef _SCSI_COMPAT_30_
63 #define _SCSI_COMPAT_30_
64
65 #include <kern/assert.h>
66
67 #ifdef MACH_KERNEL
68 /*
69 * Mach 3.0 compiles with these definitions
70 */
71
72 #include <device/param.h>
73 #include <device/io_req.h>
74 #include <device/device_types.h>
75 #include <device/disk_status.h>
76
77 /*
78 * Scratch temporary in io_req structure (for error handling)
79 */
80 #define io_temporary io_error
81
82 #else /*MACH_KERNEL*/
83 /*
84 * Mach 2.x compiles with these definitions
85 */
86
87 /* ??? */
88 typedef int dev_mode_t;
89 typedef int *dev_status_t; /* Variable-length array of integers */
90 /* ??? */
91
92 /* Buffer structures */
93
94 typedef int io_return_t;
95
96 #include <sys/param.h>
97 #include <sys/buf.h>
98
99 #define io_req buf
100 typedef struct buf *io_req_t;
101
102 #define io_req_alloc(ior,size) ior = geteblk(size)
103 #define io_req_free(ior) brelse(ior)
104
105 /*
106 * Redefine fields for drivers using new names
107 */
108 #define io_op b_flags
109 #define io_count b_bcount
110 #define io_error b_error
111 #define io_unit b_dev
112 #define io_recnum b_blkno
113 #define io_residual b_resid
114 #define io_data b_un.b_addr
115 #define io_done b_iodone
116
117 /*
118 * Redefine fields for driver request list heads, using new names.
119 */
120 #define io_next av_forw
121 #define io_prev av_back
122 /*#define io_next b_actf*/
123 /*#define io_prev b_actl*/
124 #define io_link b_forw
125 #define io_rlink b_back
126 /*#define io_count b_active*/
127 /*#define io_residual b_errcnt*/
128 #define io_alloc_size b_bufsize
129
130 /*
131 * Scratch temporary in io_req structure (for error handling)
132 */
133 #define io_temporary b_pfcent
134
135 /*
136 * Redefine flags
137 */
138 #define IO_WRITE B_WRITE
139 #define IO_READ B_READ
140 #define IO_OPEN B_OPEN
141 #define IO_DONE B_DONE
142 #define IO_ERROR B_ERROR
143 #define IO_BUSY B_BUSY
144 #define IO_WANTED B_WANTED
145 #define IO_BAD B_BAD
146 #define IO_CALL B_CALL
147 #define IO_INTERNAL B_MD1
148
149 #define IO_SPARE_START B_MD1
150
151 #include <sys/disklabel.h>
152
153 /* Error codes */
154
155 #include <sys/errno.h>
156
157 #define D_SUCCESS ESUCCESS
158 #define D_IO_ERROR EIO
159 #define D_NO_SUCH_DEVICE ENXIO
160 #define D_INVALID_SIZE EINVAL
161 #define D_ALREADY_OPEN EBUSY
162 #define D_INVALID_OPERATION EINVAL
163 #define D_NO_MEMORY ENOMEM
164 #define D_WOULD_BLOCK EWOULDBLOCK
165 #define D_DEVICE_DOWN EIO
166 #define D_READ_ONLY EROFS
167
168 /*
169 * Debugging support
170 */
171 #define db_printf kdbprintf
172 #define db_printsym(s,m) kdbpsymoff(s,1,"")
173
174 /*
175 * Miscellaneous utils
176 */
177
178 #define check_memory(addr,dow) ((dow) ? wbadaddr(addr,4) : badaddr(addr,4))
179
180 #include <sys/kernel.h> /* for hz */
181 #include <scsi/adapters/scsi_user_dma.h>
182
183 #ifdef DECSTATION
184 #include <mach/mips/vm_param.h> /* for page size */
185 #define ULTRIX_COMPAT 1 /* support for rzdisk disk formatter */
186 #endif /*DECSTATION*/
187
188 #endif /*MACH_KERNEL*/
189
190 #endif /*_SCSI_COMPAT_30_*/
Cache object: 947d09cd25d5b098b9cfc7bf6628f3bd
|