Home | History | Annotate | Line # | Download | only in tc
tcvar.h revision 1.11
      1  1.11  thorpej /*	$NetBSD: tcvar.h,v 1.11 1998/01/19 02:51:40 thorpej Exp $	*/
      2   1.1      cgd 
      3   1.1      cgd /*
      4   1.1      cgd  * Copyright (c) 1995 Carnegie-Mellon University.
      5   1.1      cgd  * All rights reserved.
      6   1.1      cgd  *
      7   1.1      cgd  * Author: Chris G. Demetriou
      8   1.1      cgd  *
      9   1.1      cgd  * Permission to use, copy, modify and distribute this software and
     10   1.1      cgd  * its documentation is hereby granted, provided that both the copyright
     11   1.1      cgd  * notice and this permission notice appear in all copies of the
     12   1.1      cgd  * software, derivative works or modified versions, and any portions
     13   1.1      cgd  * thereof, and that both notices appear in supporting documentation.
     14   1.1      cgd  *
     15   1.1      cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16   1.1      cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17   1.1      cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18   1.1      cgd  *
     19   1.1      cgd  * Carnegie Mellon requests users of this software to return to
     20   1.1      cgd  *
     21   1.1      cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22   1.1      cgd  *  School of Computer Science
     23   1.1      cgd  *  Carnegie Mellon University
     24   1.1      cgd  *  Pittsburgh PA 15213-3890
     25   1.1      cgd  *
     26   1.1      cgd  * any improvements or extensions that they make and grant Carnegie the
     27   1.1      cgd  * rights to redistribute these changes.
     28   1.1      cgd  */
     29   1.1      cgd 
     30   1.1      cgd #ifndef __DEV_TC_TCVAR_H__
     31   1.1      cgd #define __DEV_TC_TCVAR_H__
     32   1.1      cgd 
     33   1.1      cgd /*
     34   1.5      cgd  * Definitions for TurboChannel autoconfiguration.
     35   1.1      cgd  */
     36   1.1      cgd 
     37   1.5      cgd #include <machine/bus.h>
     38   1.1      cgd #include <dev/tc/tcreg.h>
     39   1.5      cgd 
     40   1.5      cgd /*
     41   1.5      cgd  * Machine-dependent definitions.
     42   1.5      cgd  */
     43   1.5      cgd #if (alpha + pmax != 1)
     44   1.5      cgd ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE.
     45   1.5      cgd #endif
     46   1.5      cgd #if alpha
     47   1.5      cgd #include <alpha/tc/tc_machdep.h>
     48   1.5      cgd #endif
     49   1.5      cgd #if pmax
     50   1.1      cgd #include <machine/tc_machdep.h>
     51   1.5      cgd #endif
     52   1.1      cgd 
     53   1.1      cgd /*
     54   1.5      cgd  * In the long run, the following block will go completely away
     55   1.5      cgd  * (i.e. both parts of the #if, including the #include, etc.).
     56   1.5      cgd  * For now, the MI TC code still uses the old definitions provided
     57   1.5      cgd  * by the pmax port, and not the new definitions provided by the
     58   1.5      cgd  * alpha port.
     59   1.5      cgd  */
     60   1.6      cgd #ifdef __alpha__
     61   1.5      cgd /*
     62   1.5      cgd  * On the alpha, map the new definitions to the old.
     63   1.5      cgd  */
     64   1.5      cgd #include <machine/intr.h>
     65   1.5      cgd 
     66   1.5      cgd #define tc_intrlevel_t	int
     67   1.5      cgd 
     68   1.5      cgd #define	TC_IPL_NONE	IPL_NONE
     69   1.5      cgd #define	TC_IPL_BIO	IPL_BIO
     70   1.5      cgd #define	TC_IPL_NET	IPL_NET
     71   1.5      cgd #define	TC_IPL_TTY	IPL_TTY
     72   1.5      cgd #define	TC_IPL_CLOCK	IPL_CLOCK
     73   1.5      cgd 
     74   1.5      cgd #else
     75   1.5      cgd /*
     76   1.5      cgd  * On the pmax, we still need the old definitions.
     77   1.1      cgd  */
     78   1.1      cgd typedef enum {
     79   1.1      cgd 	TC_IPL_NONE,			/* block only this interrupt */
     80   1.1      cgd 	TC_IPL_BIO,			/* block disk interrupts */
     81   1.1      cgd 	TC_IPL_NET,			/* block network interrupts */
     82   1.1      cgd 	TC_IPL_TTY,			/* block terminal interrupts */
     83   1.1      cgd 	TC_IPL_CLOCK,			/* block clock interrupts */
     84   1.1      cgd } tc_intrlevel_t;
     85   1.5      cgd #endif
     86   1.1      cgd 
     87   1.1      cgd /*
     88   1.1      cgd  * Arguments used to attach TurboChannel busses.
     89   1.1      cgd  */
     90   1.2      cgd struct tcbus_attach_args {
     91   1.2      cgd 	char		*tba_busname;		/* XXX should be common */
     92   1.7      cgd 	bus_space_tag_t tba_memt;
     93   1.1      cgd 
     94   1.2      cgd 	/* Bus information */
     95   1.3      cgd 	u_int		tba_speed;		/* see TC_SPEED_* below */
     96   1.2      cgd 	u_int		tba_nslots;
     97   1.2      cgd 	struct tc_slotdesc *tba_slots;
     98   1.2      cgd 	u_int		tba_nbuiltins;
     99   1.2      cgd 	const struct tc_builtin *tba_builtins;
    100   1.2      cgd 
    101   1.1      cgd 
    102   1.2      cgd 	/* TC bus resource management; XXX will move elsewhere eventually. */
    103   1.2      cgd 	void	(*tba_intr_establish) __P((struct device *, void *,
    104   1.1      cgd 		    tc_intrlevel_t, int (*)(void *), void *));
    105   1.2      cgd 	void	(*tba_intr_disestablish) __P((struct device *, void *));
    106  1.11  thorpej #ifdef __alpha__
    107  1.11  thorpej 	bus_dma_tag_t (*tba_get_dma_tag) __P((int));
    108  1.11  thorpej #endif
    109   1.1      cgd };
    110   1.1      cgd 
    111   1.1      cgd /*
    112   1.1      cgd  * Arguments used to attach TurboChannel devices.
    113   1.1      cgd  */
    114   1.2      cgd struct tc_attach_args {
    115   1.7      cgd 	bus_space_tag_t ta_memt;
    116  1.11  thorpej #ifdef __alpha__
    117  1.11  thorpej 	bus_dma_tag_t	ta_dmat;
    118  1.11  thorpej #endif
    119   1.5      cgd 
    120   1.2      cgd 	char		ta_modname[TC_ROM_LLEN+1];
    121   1.2      cgd 	u_int		ta_slot;
    122   1.2      cgd 	tc_offset_t	ta_offset;
    123   1.2      cgd 	tc_addr_t	ta_addr;
    124   1.2      cgd 	void		*ta_cookie;
    125   1.3      cgd 	u_int		ta_busspeed;		/* see TC_SPEED_* below */
    126   1.1      cgd };
    127   1.1      cgd 
    128   1.1      cgd /*
    129   1.1      cgd  * Description of TurboChannel slots, provided by machine-dependent
    130   1.1      cgd  * code to the TurboChannel bus driver.
    131   1.1      cgd  */
    132   1.1      cgd struct tc_slotdesc {
    133   1.2      cgd 	tc_addr_t	tcs_addr;
    134   1.2      cgd 	void		*tcs_cookie;
    135   1.2      cgd 	int		tcs_used;
    136   1.1      cgd };
    137   1.1      cgd 
    138   1.1      cgd /*
    139   1.1      cgd  * Description of built-in TurboChannel devices, provided by
    140   1.1      cgd  * machine-dependent code to the TurboChannel bus driver.
    141   1.1      cgd  */
    142   1.1      cgd struct tc_builtin {
    143   1.2      cgd 	char		*tcb_modname;
    144   1.2      cgd 	u_int		tcb_slot;
    145   1.2      cgd 	tc_offset_t	tcb_offset;
    146   1.2      cgd 	void		*tcb_cookie;
    147   1.1      cgd };
    148   1.1      cgd 
    149   1.1      cgd /*
    150   1.1      cgd  * Interrupt establishment functions.
    151   1.1      cgd  */
    152   1.1      cgd void	tc_intr_establish __P((struct device *, void *, tc_intrlevel_t,
    153   1.1      cgd 	    int (*)(void *), void *));
    154   1.1      cgd void	tc_intr_disestablish __P((struct device *, void *));
    155   1.1      cgd 
    156   1.8      jtk #include "locators.h"
    157   1.1      cgd /*
    158   1.1      cgd  * Easy to remember names for TurboChannel device locators.
    159   1.1      cgd  */
    160   1.8      jtk #define	tccf_slot	cf_loc[TCCF_SLOT]		/* slot */
    161   1.8      jtk #define	tccf_offset	cf_loc[TCCF_OFFSET]		/* offset */
    162   1.1      cgd 
    163   1.8      jtk #define	TCCF_SLOT_UNKNOWN	TCCF_SLOT_DEFAULT
    164   1.8      jtk #define	TCCF_OFFSET_UNKNOWN	TCCF_OFFSET_DEFAULT
    165   1.3      cgd 
    166   1.3      cgd /*
    167   1.3      cgd  * Miscellaneous definitions.
    168   1.3      cgd  */
    169   1.3      cgd #define	TC_SPEED_12_5_MHZ	0		/* 12.5MHz TC bus */
    170   1.3      cgd #define	TC_SPEED_25_MHZ		1		/* 25MHz TC bus */
    171   1.1      cgd 
    172   1.1      cgd #endif /* __DEV_TC_TCVAR_H__ */
    173