1 /* $NetBSD: tcasic.c,v 1.18 1997/06/06 23:55:36 thorpej Exp $ */ 2 3 /* 4 * Copyright (c) 1994, 1995, 1996 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@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 #include <machine/options.h> /* Config options headers */ 31 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 32 33 __KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.18 1997/06/06 23:55:36 thorpej Exp $"); 34 35 #include <sys/param.h> 36 #include <sys/systm.h> 37 #include <sys/device.h> 38 39 #include <machine/autoconf.h> 40 #include <machine/rpb.h> 41 42 #include <dev/tc/tcvar.h> 43 #include <alpha/tc/tc_conf.h> 44 45 /* Definition of the driver for autoconfig. */ 46 int tcasicmatch(struct device *, struct cfdata *, void *); 47 void tcasicattach(struct device *, struct device *, void *); 48 49 struct cfattach tcasic_ca = { 50 sizeof (struct device), tcasicmatch, tcasicattach, 51 }; 52 53 struct cfdriver tcasic_cd = { 54 NULL, "tcasic", DV_DULL, 55 }; 56 57 int tcasicprint __P((void *, const char *)); 58 59 extern int cputype; 60 61 /* There can be only one. */ 62 int tcasicfound; 63 64 int 65 tcasicmatch(parent, cfdata, aux) 66 struct device *parent; 67 struct cfdata *cfdata; 68 void *aux; 69 { 70 struct confargs *ca = aux; 71 72 /* Make sure that we're looking for a TurboChannel ASIC. */ 73 if (strcmp(ca->ca_name, tcasic_cd.cd_name)) 74 return (0); 75 76 /* Make sure that the system supports a TurboChannel ASIC. */ 77 if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300)) 78 return (0); 79 80 if (tcasicfound) 81 return (0); 82 83 return (1); 84 } 85 86 void 87 tcasicattach(parent, self, aux) 88 struct device *parent; 89 struct device *self; 90 void *aux; 91 { 92 struct tcbus_attach_args tba; 93 void (*intr_setup) __P((void)); 94 void (*iointr) __P((void *, unsigned long)); 95 96 printf("\n"); 97 tcasicfound = 1; 98 99 switch (cputype) { 100 #ifdef DEC_3000_500 101 case ST_DEC_3000_500: 102 103 intr_setup = tc_3000_500_intr_setup; 104 iointr = tc_3000_500_iointr; 105 106 tc_dma_get_tag_func = tc_dma_get_tag_3000_500; 107 108 tba.tba_busname = "tc"; 109 tba.tba_speed = TC_SPEED_25_MHZ; 110 tba.tba_nslots = tc_3000_500_nslots; 111 tba.tba_slots = tc_3000_500_slots; 112 if (hwrpb->rpb_variation & SV_GRAPHICS) { 113 tba.tba_nbuiltins = tc_3000_500_graphics_nbuiltins; 114 tba.tba_builtins = tc_3000_500_graphics_builtins; 115 } else { 116 tba.tba_nbuiltins = tc_3000_500_nographics_nbuiltins; 117 tba.tba_builtins = tc_3000_500_nographics_builtins; 118 } 119 tba.tba_intr_establish = tc_3000_500_intr_establish; 120 tba.tba_intr_disestablish = tc_3000_500_intr_disestablish; 121 122 /* Do 3000/500-specific DMA setup now. */ 123 tc_dma_init_3000_500(tc_3000_500_nslots); 124 break; 125 #endif /* DEC_3000_500 */ 126 127 #ifdef DEC_3000_300 128 case ST_DEC_3000_300: 129 130 intr_setup = tc_3000_300_intr_setup; 131 iointr = tc_3000_300_iointr; 132 133 tc_dma_get_tag_func = tc_dma_get_tag_3000_300; 134 135 tba.tba_busname = "tc"; 136 tba.tba_speed = TC_SPEED_12_5_MHZ; 137 tba.tba_nslots = tc_3000_300_nslots; 138 tba.tba_slots = tc_3000_300_slots; 139 tba.tba_nbuiltins = tc_3000_300_nbuiltins; 140 tba.tba_builtins = tc_3000_300_builtins; 141 tba.tba_intr_establish = tc_3000_300_intr_establish; 142 tba.tba_intr_disestablish = tc_3000_300_intr_disestablish; 143 break; 144 #endif /* DEC_3000_300 */ 145 146 default: 147 panic("tcasicattach: bad cputype"); 148 } 149 150 tba.tba_memt = tc_bus_mem_init(NULL); 151 152 tc_dma_init(); 153 154 (*intr_setup)(); 155 set_iointr(iointr); 156 157 config_found(self, &tba, tcasicprint); 158 } 159 160 int 161 tcasicprint(aux, pnp) 162 void *aux; 163 const char *pnp; 164 { 165 166 /* only TCs can attach to tcasics; easy. */ 167 if (pnp) 168 printf("tc at %s", pnp); 169 return (UNCONF); 170 } 171