summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/tc/tcdsvar.h
blob: 13d2b9c8378be9a186247e608f232527d2a29a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*	$OpenBSD: tcdsvar.h,v 1.5 1997/01/24 19:58:24 niklas Exp $	*/
/*	$NetBSD: tcdsvar.h,v 1.5 1996/11/13 21:13:38 cgd Exp $	*/

/*
 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
 * All rights reserved.
 *
 * Author: Chris G. Demetriou
 * 
 * Permission to use, copy, modify and distribute this software and
 * its documentation is hereby granted, provided that both the copyright
 * notice and this permission notice appear in all copies of the
 * software, derivative works or modified versions, and any portions
 * thereof, and that both notices appear in supporting documentation.
 * 
 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
 * 
 * Carnegie Mellon requests users of this software to return to
 *
 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
 *  School of Computer Science
 *  Carnegie Mellon University
 *  Pittsburgh PA 15213-3890
 *
 * any improvements or extensions that they make and grant Carnegie the
 * rights to redistribute these changes.
 */

struct tcds_slotconfig {
	/*
	 * Bookkeeping information
	 */
	int	sc_slot;
	struct tcds_softc *sc_tcds;		/* to frob TCDS regs */
	struct esp_softc *sc_esp;		/* to frob child's regs */
	int	(*sc_intrhand) __P((void *));	/* intr. handler */
	void	*sc_intrarg;			/* intr. handler arg. */

	/*
	 * Sets of bits in TCDS CIR and IMER that enable/check
	 * various things.
	 */
	u_int32_t sc_resetbits;
	u_int32_t sc_intrmaskbits;
	u_int32_t sc_intrbits;
	u_int32_t sc_dmabits;
	u_int32_t sc_errorbits;

	/*
	 * Pointers to slot-specific DMA resources.
	 */
	volatile u_int32_t *sc_sda;
	volatile u_int32_t *sc_dic;
	volatile u_int32_t *sc_dud0;
	volatile u_int32_t *sc_dud1;

	/*
	 * DMA bookkeeping information.
	 */
	int	sc_active;                      /* DMA active ? */
	int	sc_iswrite;			/* DMA into main memory? */
	size_t	sc_dmasize;
	caddr_t	*sc_dmaaddr;
	size_t	*sc_dmalen;
};

struct tcdsdev_attach_args {
	struct tc_attach_args tcdsda_ta;
	struct tcds_slotconfig *tcdsda_sc;
	u_int	tcdsda_id;
	u_int	tcdsda_freq;
};
#define	tcdsda_modname	tcdsda_ta.ta_modname
#define	tcdsda_slot	tcdsda_ta.ta_slot
#define	tcdsda_offset	tcdsda_ta.ta_offset
#define	tcdsda_addr	tcdsda_ta.ta_addr
#define	tcdsda_cookie	tcdsda_ta.ta_cookie

#define	TCDS_REG(base, off) \
    (volatile u_int32_t *)TC_DENSE_TO_SPARSE((base) + (off))

/*
 * TCDS functions.
 */
void	tcds_intr_establish __P((struct device *, void *, tc_intrlevel_t,
	    int (*)(void *), void *));
void	tcds_intr_disestablish __P((struct device *, void *));
void	tcds_dma_enable __P((struct tcds_slotconfig *, int));
void	tcds_scsi_enable __P((struct tcds_slotconfig *, int));
int	tcds_scsi_iserr __P((struct tcds_slotconfig *));
int	tcds_scsi_isintr __P((struct tcds_slotconfig *, int));
void	tcds_scsi_reset __P((struct tcds_slotconfig *));
int	tcds_scsi_iserr __P((struct tcds_slotconfig *));

/*
 * TCDS DMA functions (used the the 53c94 driver)
 */
int	tcds_dma_isintr	__P((struct tcds_slotconfig *));
void	tcds_dma_reset __P((struct tcds_slotconfig *));
int	tcds_dma_intr __P((struct tcds_slotconfig *));
int	tcds_dma_setup __P((struct tcds_slotconfig *, caddr_t *, size_t *,
	    int, size_t *));
void	tcds_dma_go __P((struct tcds_slotconfig *));
int	tcds_dma_isactive __P((struct tcds_slotconfig *));

/*
 * The TCDS (bus) cfdriver, so that subdevices can more
 * easily tell what bus they're on.
 */
extern struct cfdriver tcds_cd;