Home | History | Annotate | Line # | Download | only in tc
tcasic.c revision 1.12
      1  1.12       cgd /*	$NetBSD: tcasic.c,v 1.12 1996/10/23 04:12:38 cgd Exp $	*/
      2   1.1       cgd 
      3   1.1       cgd /*
      4   1.4       cgd  * Copyright (c) 1994, 1995, 1996 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 #include <sys/param.h>
     31   1.6       cgd #include <sys/systm.h>
     32   1.1       cgd #include <sys/device.h>
     33   1.1       cgd 
     34   1.1       cgd #include <machine/autoconf.h>
     35   1.1       cgd #include <machine/rpb.h>
     36   1.1       cgd 
     37   1.1       cgd #include <dev/tc/tcvar.h>
     38   1.1       cgd #include <alpha/tc/tc_conf.h>
     39   1.1       cgd 
     40   1.1       cgd /* Definition of the driver for autoconfig. */
     41   1.1       cgd int	tcasicmatch(struct device *, void *, void *);
     42   1.1       cgd void	tcasicattach(struct device *, struct device *, void *);
     43   1.2   thorpej 
     44   1.2   thorpej struct cfattach tcasic_ca = {
     45   1.3       cgd 	sizeof (struct device), tcasicmatch, tcasicattach,
     46   1.2   thorpej };
     47   1.2   thorpej 
     48   1.2   thorpej struct cfdriver tcasic_cd = {
     49   1.3       cgd 	NULL, "tcasic", DV_DULL,
     50   1.2   thorpej };
     51   1.1       cgd 
     52   1.8       cgd int	tcasicprint __P((void *, const char *));
     53   1.1       cgd 
     54   1.1       cgd extern int cputype;
     55   1.1       cgd 
     56   1.1       cgd /* There can be only one. */
     57   1.1       cgd int	tcasicfound;
     58   1.1       cgd 
     59   1.1       cgd int
     60   1.1       cgd tcasicmatch(parent, cfdata, aux)
     61   1.1       cgd 	struct device *parent;
     62   1.1       cgd 	void *cfdata;
     63   1.1       cgd 	void *aux;
     64   1.1       cgd {
     65   1.1       cgd 	struct confargs *ca = aux;
     66   1.1       cgd 
     67   1.1       cgd         /* Make sure that we're looking for a TurboChannel ASIC. */
     68   1.2   thorpej         if (strcmp(ca->ca_name, tcasic_cd.cd_name))
     69   1.1       cgd                 return (0);
     70   1.1       cgd 
     71   1.1       cgd         /* Make sure that the system supports a TurboChannel ASIC. */
     72   1.1       cgd 	if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300))
     73   1.1       cgd 		return (0);
     74   1.1       cgd 
     75   1.1       cgd 	if (tcasicfound)
     76   1.1       cgd 		return (0);
     77   1.1       cgd 
     78   1.1       cgd 	return (1);
     79   1.1       cgd }
     80   1.1       cgd 
     81   1.1       cgd void
     82   1.1       cgd tcasicattach(parent, self, aux)
     83   1.1       cgd 	struct device *parent;
     84   1.1       cgd 	struct device *self;
     85   1.1       cgd 	void *aux;
     86   1.1       cgd {
     87   1.3       cgd 	struct tcbus_attach_args tba;
     88   1.1       cgd 	void (*intr_setup) __P((void));
     89   1.7       cgd 	void (*iointr) __P((void *, unsigned long));
     90   1.1       cgd 
     91  1.10  christos 	printf("\n");
     92   1.1       cgd 	tcasicfound = 1;
     93   1.1       cgd 
     94   1.1       cgd 	switch (cputype) {
     95   1.1       cgd #ifdef DEC_3000_500
     96   1.1       cgd 	case ST_DEC_3000_500:
     97   1.1       cgd 
     98   1.1       cgd 		intr_setup = tc_3000_500_intr_setup;
     99   1.1       cgd 		iointr = tc_3000_500_iointr;
    100   1.1       cgd 
    101   1.3       cgd 		tba.tba_busname = "tc";
    102   1.3       cgd 		tba.tba_speed = TC_SPEED_25_MHZ;
    103   1.3       cgd 		tba.tba_nslots = tc_3000_500_nslots;
    104   1.3       cgd 		tba.tba_slots = tc_3000_500_slots;
    105   1.3       cgd 		tba.tba_nbuiltins = tc_3000_500_nbuiltins;
    106   1.3       cgd 		tba.tba_builtins = tc_3000_500_builtins;
    107   1.3       cgd 		tba.tba_intr_establish = tc_3000_500_intr_establish;
    108   1.3       cgd 		tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
    109   1.1       cgd 		break;
    110   1.1       cgd #endif /* DEC_3000_500 */
    111   1.1       cgd 
    112   1.1       cgd #ifdef DEC_3000_300
    113   1.1       cgd 	case ST_DEC_3000_300:
    114   1.1       cgd 
    115   1.1       cgd 		intr_setup = tc_3000_300_intr_setup;
    116   1.1       cgd 		iointr = tc_3000_300_iointr;
    117   1.1       cgd 
    118   1.3       cgd 		tba.tba_busname = "tc";
    119   1.3       cgd 		tba.tba_speed = TC_SPEED_12_5_MHZ;
    120   1.3       cgd 		tba.tba_nslots = tc_3000_300_nslots;
    121   1.3       cgd 		tba.tba_slots = tc_3000_300_slots;
    122   1.3       cgd 		tba.tba_nbuiltins = tc_3000_300_nbuiltins;
    123   1.3       cgd 		tba.tba_builtins = tc_3000_300_builtins;
    124   1.3       cgd 		tba.tba_intr_establish = tc_3000_300_intr_establish;
    125   1.3       cgd 		tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
    126   1.1       cgd 		break;
    127   1.1       cgd #endif /* DEC_3000_300 */
    128   1.1       cgd 
    129   1.1       cgd 	default:
    130   1.1       cgd 		panic("tcasicattach: bad cputype");
    131   1.1       cgd 	}
    132   1.5       cgd 
    133  1.11       cgd 	tba.tba_memt = tc_bus_mem_init(NULL);
    134  1.12       cgd 
    135  1.12       cgd 	/* XXX XXX BEGIN XXX XXX */
    136  1.12       cgd 	{							/* XXX */
    137  1.12       cgd 		extern vm_offset_t alpha_XXX_dmamap_or;		/* XXX */
    138  1.12       cgd 		alpha_XXX_dmamap_or = 0;			/* XXX */
    139  1.12       cgd 	}							/* XXX */
    140  1.12       cgd 	/* XXX XXX END XXX XXX */
    141   1.1       cgd 
    142   1.1       cgd 	(*intr_setup)();
    143   1.1       cgd 	set_iointr(iointr);
    144   1.1       cgd 
    145   1.3       cgd 	config_found(self, &tba, tcasicprint);
    146   1.1       cgd }
    147   1.1       cgd 
    148   1.1       cgd int
    149   1.1       cgd tcasicprint(aux, pnp)
    150   1.1       cgd 	void *aux;
    151   1.8       cgd 	const char *pnp;
    152   1.1       cgd {
    153   1.1       cgd 
    154   1.1       cgd 	/* only TCs can attach to tcasics; easy. */
    155   1.1       cgd 	if (pnp)
    156  1.10  christos 		printf("tc at %s", pnp);
    157   1.1       cgd 	return (UNCONF);
    158   1.1       cgd }
    159