No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / vax / mba / mbavar.h
blobcd5f31e4e36d9d6a1a7c67a8948a46ea3e4aad1c
1 /* $NetBSD: mbavar.h,v 1.12 2008/03/11 05:34:02 matt Exp $ */
2 /*
3 * Copyright (c) 1994 Ludd, University of Lule}, Sweden
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed at Ludd, University of Lule}.
17 * 4. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/device.h>
33 #include <machine/scb.h>
35 #define MBCR_INIT 1
36 #define MBCR_IE (1<<2)
37 #define MBDS_DPR (1<<8)
38 #define MBSR_NED (1<<18)
39 #define MBDT_MOH (1<<13)
40 #define MBDT_TYPE 511
41 #define MBDT_TAP (1<<14)
43 #define CLOSED 0
44 #define WANTOPEN 1
45 #define RDLABEL 2
46 #define OPEN 3
47 #define OPENRAW 4
49 #define MAXMBADEV 8 /* Max units per MBA */
52 * Devices that have different device drivers.
54 enum mb_devices {
55 MB_UK, /* unknown */
56 MB_RP, /* RM/RP disk */
57 MB_TU, /* TM03 based tape, ex. TU45 or TU77 */
58 MB_MT /* TU78 tape */
62 * Current state of the adapter.
64 enum sc_state {
65 SC_AUTOCONF,
66 SC_ACTIVE,
67 SC_IDLE
71 * Return value after a finished data transfer, from device driver.
73 enum xfer_action {
74 XFER_RESTART,
75 XFER_FINISH
79 * Info passed do unit device driver during autoconfig.
81 struct mba_attach_args {
82 int ma_unit;
83 int ma_type;
84 const char *ma_name;
85 enum mb_devices ma_devtyp;
86 bus_space_tag_t ma_iot;
87 bus_space_handle_t ma_ioh;
91 * Common struct used to communicate between the mba device driver
92 * and the unit device driver.
94 struct mba_device {
95 STAILQ_ENTRY(mba_device) md_link; /* linked list of runnable devices */
96 void (*md_start)(struct mba_device *);
97 /* Start routine to be called by mbastart. */
98 int (*md_attn)(struct mba_device *);
99 /* Routine to be called after attn intr */
100 enum xfer_action (*md_finish)(struct mba_device *, int, int *);
101 /* Call after xfer finish */
102 void *md_softc; /* Backpointer to this units softc. */
103 struct mba_softc *md_mba;
104 struct bufq_state *md_q; /* queue of I/O requests */
107 struct mba_softc {
108 device_t sc_dev;
109 bus_space_tag_t sc_iot;
110 bus_space_handle_t sc_ioh;
111 STAILQ_HEAD(,mba_device) sc_xfers;
112 struct evcnt sc_intrcnt;
113 enum sc_state sc_state;
114 struct mba_device *sc_md[MAXMBADEV];
117 struct mbaunit {
118 int nr;
119 const char *name;
120 enum mb_devices devtyp;
123 /* Common prototypes */
124 void mbaqueue(struct mba_device *);