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