Home | History | Annotate | Line # | Download | only in tc
      1 /* $NetBSD: tcvar.h,v 1.28 2021/05/07 16:55:58 thorpej Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1995 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 (at) 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 #ifndef __DEV_TC_TCVAR_H__
     31 #define __DEV_TC_TCVAR_H__
     32 
     33 /*
     34  * Definitions for TURBOchannel autoconfiguration.
     35  */
     36 
     37 #include <sys/bus.h>
     38 #include <sys/device.h>
     39 #include <dev/tc/tcreg.h>
     40 
     41 /*
     42  * Machine-dependent definitions.
     43  */
     44 #include <machine/tc_machdep.h>
     45 
     46 /*
     47  * In the long run, the following block will go completely away.
     48  * For now, the MI TC code still uses the old TC_IPL_ names
     49  * and not the new IPL_ names.
     50  */
     51 #if 1
     52 /*
     53  * Map the new definitions to the old.
     54  */
     55 #include <sys/intr.h>
     56 
     57 #define tc_intrlevel_t	int
     58 
     59 #define	TC_IPL_NONE	IPL_NONE
     60 #define	TC_IPL_BIO	IPL_BIO
     61 #define	TC_IPL_NET	IPL_NET
     62 #define	TC_IPL_TTY	IPL_TTY
     63 #define	TC_IPL_CLOCK	IPL_CLOCK
     64 #endif /* 1 */
     65 
     66 struct tc_softc {
     67 	device_t sc_dev;
     68 
     69 	int	sc_speed;
     70 	int	sc_nslots;
     71 	const struct tc_slotdesc *sc_slots;
     72 	uint32_t sc_slots_used;
     73 
     74 	const struct evcnt *(*sc_intr_evcnt)(device_t, void *);
     75 	void	(*sc_intr_establish)(device_t, void *,
     76 			int, int (*)(void *), void *);
     77 	void	(*sc_intr_disestablish)(device_t, void *);
     78 	bus_dma_tag_t (*sc_get_dma_tag)(int);
     79 };
     80 
     81 /*
     82  * Arguments used to attach TURBOchannel busses.
     83  */
     84 struct tcbus_attach_args {
     85 	const char		*tba_busname;	/* XXX should be common */
     86 	bus_space_tag_t tba_memt;
     87 
     88 	/* Bus information */
     89 	u_int		tba_speed;		/* see TC_SPEED_* below */
     90 	u_int		tba_nslots;
     91 	const struct tc_slotdesc *tba_slots;
     92 	u_int		tba_nbuiltins;
     93 	const struct tc_builtin *tba_builtins;
     94 
     95 
     96 	/* TC bus resource management; XXX will move elsewhere eventually. */
     97 	const struct evcnt *(*tba_intr_evcnt)(device_t, void *);
     98 	void	(*tba_intr_establish)(device_t, void *,
     99 			int, int (*)(void *), void *);
    100 	void	(*tba_intr_disestablish)(device_t, void *);
    101 	bus_dma_tag_t (*tba_get_dma_tag)(int);
    102 };
    103 
    104 /*
    105  * Arguments used to attach TURBOchannel devices.
    106  */
    107 struct tc_attach_args {
    108 	bus_space_tag_t ta_memt;
    109 	bus_dma_tag_t	ta_dmat;
    110 
    111 	char		ta_modname[TC_ROM_LLEN+1];
    112 	u_int		ta_slot;
    113 	tc_offset_t	ta_offset;
    114 	tc_addr_t	ta_addr;
    115 	void		*ta_cookie;
    116 	u_int		ta_busspeed;		/* see TC_SPEED_* below */
    117 };
    118 
    119 /*
    120  * Description of TURBOchannel slots, provided by machine-dependent
    121  * code to the TURBOchannel bus driver.
    122  */
    123 struct tc_slotdesc {
    124 	tc_addr_t	tcs_addr;
    125 	void		*tcs_cookie;
    126 };
    127 
    128 /*
    129  * Description of built-in TURBOchannel devices, provided by
    130  * machine-dependent code to the TURBOchannel bus driver.
    131  */
    132 struct tc_builtin {
    133 	const char	*tcb_modname;
    134 	u_int		tcb_slot;
    135 	tc_offset_t	tcb_offset;
    136 	void		*tcb_cookie;
    137 };
    138 
    139 /*
    140  * Interrupt establishment functions.
    141  */
    142 int	tc_checkslot(tc_addr_t, char *, struct tc_rommap **);
    143 void	tcattach(device_t, device_t, void *);
    144 const struct evcnt *tc_intr_evcnt(device_t, void *);
    145 void	tc_intr_establish(device_t, void *, int, int (*)(void *),
    146 	    void *);
    147 void	tc_intr_disestablish(device_t, void *);
    148 
    149 /*
    150  * Miscellaneous definitions.
    151  */
    152 #define	TC_SPEED_12_5_MHZ	0		/* 12.5MHz TC bus */
    153 #define	TC_SPEED_25_MHZ		1		/* 25MHz TC bus */
    154 
    155 #endif /* __DEV_TC_TCVAR_H__ */
    156