|
|
1.1 root 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 [email protected]
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: * File: compat_30.h
28: * Author: Alessandro Forin, Carnegie Mellon University
29: * Date: 4/91
30: *
31: * Compatibility defs to retrofit Mach 3.0 drivers
32: * into Mach 2.6.
33: */
34:
35: #ifndef _SCSI_COMPAT_30_
36: #define _SCSI_COMPAT_30_
37:
38: #include <kern/assert.h>
39:
40: #ifdef MACH_KERNEL
41: /*
42: * Mach 3.0 compiles with these definitions
43: */
44:
45: #include <device/param.h>
46: #include <device/io_req.h>
47: #include <device/device_types.h>
48: #include <device/disk_status.h>
49:
50: /*
51: * Scratch temporary in io_req structure (for error handling)
52: */
53: #define io_temporary io_error
54:
55: #else /*MACH_KERNEL*/
56: /*
57: * Mach 2.x compiles with these definitions
58: */
59:
60: /* ??? */
61: typedef int dev_mode_t;
62: typedef int *dev_status_t; /* Variable-length array of integers */
63: /* ??? */
64:
65: /* Buffer structures */
66:
67: typedef int io_return_t;
68:
69: #include <sys/param.h>
70: #include <sys/buf.h>
71:
72: #define io_req buf
73: typedef struct buf *io_req_t;
74:
75: #define io_req_alloc(ior,size) ior = geteblk(size)
76: #define io_req_free(ior) brelse(ior)
77:
78: /*
79: * Redefine fields for drivers using new names
80: */
81: #define io_op b_flags
82: #define io_count b_bcount
83: #define io_error b_error
84: #define io_unit b_dev
85: #define io_recnum b_blkno
86: #define io_residual b_resid
87: #define io_data b_un.b_addr
88: #define io_done b_iodone
89:
90: /*
91: * Redefine fields for driver request list heads, using new names.
92: */
93: #define io_next av_forw
94: #define io_prev av_back
95: /*#define io_next b_actf*/
96: /*#define io_prev b_actl*/
97: #define io_link b_forw
98: #define io_rlink b_back
99: /*#define io_count b_active*/
100: /*#define io_residual b_errcnt*/
101: #define io_alloc_size b_bufsize
102:
103: /*
104: * Scratch temporary in io_req structure (for error handling)
105: */
106: #define io_temporary b_pfcent
107:
108: /*
109: * Redefine flags
110: */
111: #define IO_WRITE B_WRITE
112: #define IO_READ B_READ
113: #define IO_OPEN B_OPEN
114: #define IO_DONE B_DONE
115: #define IO_ERROR B_ERROR
116: #define IO_BUSY B_BUSY
117: #define IO_WANTED B_WANTED
118: #define IO_BAD B_BAD
119: #define IO_CALL B_CALL
120: #define IO_INTERNAL B_MD1
121:
122: #define IO_SPARE_START B_MD1
123:
124: #include <sys/disklabel.h>
125:
126: /* Error codes */
127:
128: #include <sys/errno.h>
129:
130: #define D_SUCCESS ESUCCESS
131: #define D_IO_ERROR EIO
132: #define D_NO_SUCH_DEVICE ENXIO
133: #define D_INVALID_SIZE EINVAL
134: #define D_ALREADY_OPEN EBUSY
135: #define D_INVALID_OPERATION EINVAL
136: #define D_NO_MEMORY ENOMEM
137: #define D_WOULD_BLOCK EWOULDBLOCK
138: #define D_DEVICE_DOWN EIO
139: #define D_READ_ONLY EROFS
140:
141: /*
142: * Debugging support
143: */
144: #define db_printf kdbprintf
145: #define db_printsym(s,m) kdbpsymoff(s,1,"")
146:
147: /*
148: * Miscellaneous utils
149: */
150:
151: #define check_memory(addr,dow) ((dow) ? wbadaddr(addr,4) : badaddr(addr,4))
152:
153: #include <sys/kernel.h> /* for hz */
154: #include <scsi/adapters/scsi_user_dma.h>
155:
156: #ifdef DECSTATION
157: #include <mach/mips/vm_param.h> /* for page size */
158: #define ULTRIX_COMPAT 1 /* support for rzdisk disk formatter */
159: #endif /*DECSTATION*/
160:
161: #endif /*MACH_KERNEL*/
162:
163: #endif /*_SCSI_COMPAT_30_*/
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.