xref: /openbsd/sys/dev/tc/tcdsvar.h (revision 274d7c50)
1 /* $OpenBSD: tcdsvar.h,v 1.4 2008/08/09 16:42:30 miod Exp $ */
2 /* $NetBSD: tcdsvar.h,v 1.2 2001/08/22 05:00:27 nisimura Exp $ */
3 
4 /*
5  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
6  * All rights reserved.
7  *
8  * Author: Chris G. Demetriou
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 struct tcds_slotconfig {
32 	/*
33 	 * Bookkeeping information
34 	 */
35 	int	sc_slot;
36 
37 	bus_space_tag_t sc_bst;			/* to frob TCDS regs */
38 	bus_space_handle_t sc_bsh;
39 
40 	int	(*sc_intrhand)(void *);		/* intr. handler */
41 	void	*sc_intrarg;			/* intr. handler arg. */
42 	struct evcount sc_count;		/* intr. count */
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(struct device *, int,
80 	    int (*)(void *), void *, const char *);
81 void	tcds_intr_disestablish(struct device *, int);
82 void	tcds_dma_enable(struct tcds_slotconfig *, int);
83 void	tcds_scsi_enable(struct tcds_slotconfig *, int);
84 int	tcds_scsi_iserr(struct tcds_slotconfig *);
85 int	tcds_scsi_isintr(struct tcds_slotconfig *, int);
86 void	tcds_scsi_reset(struct tcds_slotconfig *);
87