Annotation of sys/arch/mac68k/dev/sbcvar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: sbcvar.h,v 1.8 2006/12/13 21:12:56 miod Exp $ */
! 2: /* $NetBSD: sbcvar.h,v 1.1 1997/03/01 20:19:00 scottr Exp $ */
! 3:
! 4: /*
! 5: * Copyright (C) 1996 Scott Reynolds. 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 by Scott Reynolds for
! 18: * the NetBSD Project.
! 19: * 4. The name of the author may not be used to endorse or promote products
! 20: * derived from this software without specific prior written permission
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 23: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 24: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 25: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 26: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 27: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 28: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 29: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 30: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 31: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 32: */
! 33:
! 34: /*
! 35: * Transfers smaller than this are done using PIO
! 36: * (on assumption they're not worth PDMA overhead)
! 37: */
! 38: #define MIN_DMA_LEN 128
! 39:
! 40: /*
! 41: * Transfers larger than 8192 bytes need to be split up
! 42: * due to the size of the PDMA space.
! 43: */
! 44: #define MAX_DMA_LEN 0x2000
! 45:
! 46: #ifdef SBC_DEBUG
! 47: # define SBC_DB_INTR 0x01
! 48: # define SBC_DB_DMA 0x02
! 49: # define SBC_DB_REG 0x04
! 50: # define SBC_DB_BREAK 0x08
! 51: # ifndef DDB
! 52: # define Debugger() printf("Debug: sbc.c:%d\n", __LINE__)
! 53: # endif
! 54: # define SBC_BREAK \
! 55: do { if (sbc_debug & SBC_DB_BREAK) Debugger(); } while (0)
! 56: #else
! 57: # define SBC_BREAK
! 58: #endif
! 59:
! 60: /*
! 61: * This structure is used to keep track of PDMA requests.
! 62: */
! 63: struct sbc_pdma_handle {
! 64: int dh_flags; /* flags */
! 65: #define SBC_DH_BUSY 0x01 /* This handle is in use */
! 66: #define SBC_DH_OUT 0x02 /* PDMA data out (write) */
! 67: #define SBC_DH_DONE 0x04 /* PDMA transfer is complete */
! 68: u_char *dh_addr; /* data buffer */
! 69: int dh_len; /* length of data buffer */
! 70: };
! 71:
! 72: /*
! 73: * The first structure member has to be the ncr5380_softc
! 74: * so we can just cast to go back and forth between them.
! 75: */
! 76: struct sbc_softc {
! 77: struct ncr5380_softc ncr_sc;
! 78: struct via2hand sc_ih_drq, sc_ih_irq;
! 79: volatile struct sbc_regs *sc_regs;
! 80: volatile vaddr_t sc_drq_addr;
! 81: volatile vaddr_t sc_nodrq_addr;
! 82: void (*sc_clrintr)(struct ncr5380_softc *);
! 83: int sc_options; /* options for this instance. */
! 84: struct sbc_pdma_handle sc_pdma[SCI_OPENINGS];
! 85: };
! 86:
! 87: /*
! 88: * Options. By default, SCSI interrupts and reselect are disabled.
! 89: * You may enable either of these features with the `flags' directive
! 90: * in your kernel's configuration file.
! 91: *
! 92: * Alternatively, you can patch your kernel with DDB or some other
! 93: * mechanism. The sc_options member of the softc is OR'd with
! 94: * the value in sbc_options.
! 95: *
! 96: * The options code is based on the sparc 'si' driver's version of
! 97: * the same.
! 98: */
! 99: #define SBC_PDMA 0x01 /* Use PDMA for polled transfers */
! 100: #define SBC_INTR 0x02 /* Allow SCSI IRQ/DRQ interrupts */
! 101: #define SBC_RESELECT 0x04 /* Allow disconnect/reselect */
! 102: #define SBC_OPTIONS_MASK (SBC_RESELECT|SBC_INTR|SBC_PDMA)
! 103: #define SBC_OPTIONS_BITS "\10\3RESELECT\2INTR\1PDMA"
! 104:
! 105: extern int sbc_debug;
! 106: extern int sbc_link_flags;
! 107: extern int sbc_options;
! 108: extern struct scsi_adapter sbc_ops;
! 109: extern struct scsi_device sbc_dev;
! 110:
! 111: int sbc_pdma_in(struct ncr5380_softc *, int, int, u_char *);
! 112: int sbc_pdma_out(struct ncr5380_softc *, int, int, u_char *);
! 113: int sbc_irq_intr(void *);
! 114: int sbc_drq_intr(void *);
! 115: void sbc_dma_alloc(struct ncr5380_softc *);
! 116: void sbc_dma_free(struct ncr5380_softc *);
! 117: void sbc_dma_poll(struct ncr5380_softc *);
! 118: void sbc_dma_setup(struct ncr5380_softc *);
! 119: void sbc_dma_start(struct ncr5380_softc *);
! 120: void sbc_dma_stop(struct ncr5380_softc *);
! 121: #ifdef SBC_DEBUG
! 122: void decode_5380_intr(struct ncr5380_softc *);
! 123: #endif
CVSweb