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