1 /* $NetBSD: tcdsvar.h,v 1.6 2009/05/12 14:47:04 cegger Exp $ */
2 
3 /*
4  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5  * All rights reserved.
6  *
7  * Author: Chris G. Demetriou
8  *
9  * Permission to use, copy, modify and distribute this software and
10  * its documentation is hereby granted, provided that both the copyright
11  * notice and this permission notice appear in all copies of the
12  * software, derivative works or modified versions, and any portions
13  * thereof, and that both notices appear in supporting documentation.
14  *
15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18  *
19  * Carnegie Mellon requests users of this software to return to
20  *
21  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22  *  School of Computer Science
23  *  Carnegie Mellon University
24  *  Pittsburgh PA 15213-3890
25  *
26  * any improvements or extensions that they make and grant Carnegie the
27  * rights to redistribute these changes.
28  */
29 
30 struct tcds_slotconfig {
31           /*
32            * Bookkeeping information
33            */
34           int       sc_slot;
35 
36           bus_space_tag_t sc_bst;                           /* to frob TCDS regs */
37           bus_space_handle_t sc_bsh;
38 
39           int       (*sc_intrhand)(void *);       /* intr. handler */
40           void      *sc_intrarg;                            /* intr. handler arg. */
41           struct evcnt sc_evcnt;                            /* intr. count */
42           char      sc_name[8];                             /* ev_name */
43 
44           /*
45            * Sets of bits in TCDS CIR and IMER that enable/check
46            * various things.
47            */
48           u_int32_t sc_resetbits;
49           u_int32_t sc_intrmaskbits;
50           u_int32_t sc_intrbits;
51           u_int32_t sc_dmabits;
52           u_int32_t sc_errorbits;
53 
54           /*
55            * Offsets to slot-specific DMA resources.
56            */
57           bus_size_t sc_sda;
58           bus_size_t sc_dic;
59           bus_size_t sc_dud0;
60           bus_size_t sc_dud1;
61 };
62 
63 struct tcdsdev_attach_args {
64           bus_space_tag_t tcdsda_bst;             /* bus space tag */
65           bus_space_handle_t tcdsda_bsh;                    /* bus space handle */
66           bus_dma_tag_t tcdsda_dmat;              /* bus dma tag */
67           struct tcds_slotconfig *tcdsda_sc;      /* slot configuration */
68           int       tcdsda_chip;                            /* chip number */
69           int       tcdsda_id;                              /* SCSI ID */
70           u_int     tcdsda_freq;                            /* chip frequency */
71           int       tcdsda_period;                          /* min. sync period */
72           int       tcdsda_variant;                         /* NCR chip variant */
73           int       tcdsda_fast;                            /* chip does Fast mode */
74 };
75 
76 /*
77  * TCDS functions.
78  */
79 void      tcds_intr_establish(device_t, int, int (*)(void *), void *);
80 void      tcds_intr_disestablish(device_t, int);
81 void      tcds_dma_enable(struct tcds_slotconfig *, int);
82 void      tcds_scsi_enable(struct tcds_slotconfig *, int);
83 int       tcds_scsi_iserr(struct tcds_slotconfig *);
84 int       tcds_scsi_isintr(struct tcds_slotconfig *, int);
85 void      tcds_scsi_reset(struct tcds_slotconfig *);
86