1 /* $NetBSD: tcasic.c,v 1.41 2009/03/14 14:45:54 dsl Exp $ */
4 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
7 * Author: Chris G. Demetriou
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.
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.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 #include "opt_dec_3000_300.h"
31 #include "opt_dec_3000_500.h"
33 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
35 __KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.41 2009/03/14 14:45:54 dsl Exp $");
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/device.h>
41 #include <machine/autoconf.h>
42 #include <machine/rpb.h>
43 #include <machine/alpha.h>
45 #include <dev/tc/tcvar.h>
46 #include <alpha/tc/tc_conf.h>
48 /* Definition of the driver for autoconfig. */
49 int tcasicmatch(struct device
*, struct cfdata
*, void *);
50 void tcasicattach(struct device
*, struct device
*, void *);
52 CFATTACH_DECL(tcasic
, sizeof (struct device
),
53 tcasicmatch
, tcasicattach
, NULL
, NULL
);
55 extern struct cfdriver tcasic_cd
;
57 int tcasicprint(void *, const char *);
59 /* There can be only one. */
63 tcasicmatch(struct device
*parent
, struct cfdata
*cfdata
, void *aux
)
65 struct mainbus_attach_args
*ma
= aux
;
67 /* Make sure that we're looking for a TurboChannel ASIC. */
68 if (strcmp(ma
->ma_name
, tcasic_cd
.cd_name
))
71 /* Make sure that the system supports a TurboChannel ASIC. */
72 if ((cputype
!= ST_DEC_3000_500
) && (cputype
!= ST_DEC_3000_300
))
82 tcasicattach(struct device
*parent
, struct device
*self
, void *aux
)
84 struct tcbus_attach_args tba
;
85 void (*intr_setup
)(void);
86 void (*iointr
)(void *, unsigned long);
95 intr_setup
= tc_3000_500_intr_setup
;
96 iointr
= tc_3000_500_iointr
;
98 tba
.tba_speed
= TC_SPEED_25_MHZ
;
99 tba
.tba_nslots
= tc_3000_500_nslots
;
100 tba
.tba_slots
= tc_3000_500_slots
;
101 if (hwrpb
->rpb_variation
& SV_GRAPHICS
) {
102 tba
.tba_nbuiltins
= tc_3000_500_graphics_nbuiltins
;
103 tba
.tba_builtins
= tc_3000_500_graphics_builtins
;
105 tba
.tba_nbuiltins
= tc_3000_500_nographics_nbuiltins
;
106 tba
.tba_builtins
= tc_3000_500_nographics_builtins
;
108 tba
.tba_intr_evcnt
= tc_3000_500_intr_evcnt
;
109 tba
.tba_intr_establish
= tc_3000_500_intr_establish
;
110 tba
.tba_intr_disestablish
= tc_3000_500_intr_disestablish
;
111 tba
.tba_get_dma_tag
= tc_dma_get_tag_3000_500
;
113 /* Do 3000/500-specific DMA setup now. */
114 tc_dma_init_3000_500(tc_3000_500_nslots
);
116 #endif /* DEC_3000_500 */
119 case ST_DEC_3000_300
:
121 intr_setup
= tc_3000_300_intr_setup
;
122 iointr
= tc_3000_300_iointr
;
124 tba
.tba_speed
= TC_SPEED_12_5_MHZ
;
125 tba
.tba_nslots
= tc_3000_300_nslots
;
126 tba
.tba_slots
= tc_3000_300_slots
;
127 tba
.tba_nbuiltins
= tc_3000_300_nbuiltins
;
128 tba
.tba_builtins
= tc_3000_300_builtins
;
129 tba
.tba_intr_evcnt
= tc_3000_300_intr_evcnt
;
130 tba
.tba_intr_establish
= tc_3000_300_intr_establish
;
131 tba
.tba_intr_disestablish
= tc_3000_300_intr_disestablish
;
132 tba
.tba_get_dma_tag
= tc_dma_get_tag_3000_300
;
134 #endif /* DEC_3000_300 */
137 panic("tcasicattach: bad cputype");
140 tba
.tba_busname
= "tc";
141 tba
.tba_memt
= tc_bus_mem_init(NULL
);
147 /* They all come in at 0x800. */
148 scb_set(0x800, iointr
, NULL
, IPL_VM
);
150 config_found(self
, &tba
, tcasicprint
);
154 tcasicprint(void *aux
, const char *pnp
)
157 /* only TCs can attach to tcasics; easy. */
159 aprint_normal("tc at %s", pnp
);
163 #include "wsdisplay.h"
175 extern void sfb_cnattach(tc_addr_t
);
176 extern void sfbp_cnattach(tc_addr_t
);
177 extern void cfb_cnattach(tc_addr_t
);
178 extern void mfb_cnattach(tc_addr_t
);
179 extern void tfb_cnattach(tc_addr_t
);
180 extern void px_cnattach(tc_addr_t
);
181 extern void pxg_cnattach(tc_addr_t
);
182 extern int tc_checkslot(tc_addr_t
, char *);
185 const char *cb_tcname
;
186 void (*cb_cnattach
)(tc_addr_t
);
187 } static const cnboards
[] = {
189 { "PMAGB-BA", sfb_cnattach
},
192 { "PMAGD ", sfbp_cnattach
},
195 { "PMAG-BA ", cfb_cnattach
},
198 { "PMAG-AA ", mfb_cnattach
},
201 { "PMAG-JA ", tfb_cnattach
},
204 { "PMAG-CA ", px_cnattach
},
207 { "PMAG-DA ", pxg_cnattach
},
208 { "PMAG-FA ", pxg_cnattach
},
209 { "PMAG-FB ", pxg_cnattach
},
210 { "PMAGB-FA", pxg_cnattach
},
211 { "PMAGB-FB", pxg_cnattach
},
217 * Attempt to attach the appropriate display driver to the
221 tc_fb_cnattach(tc_addr_t tcaddr
)
223 char tcname
[TC_ROM_LLEN
];
226 if (tc_badaddr(tcaddr
) || (tc_checkslot(tcaddr
, tcname
) == 0))
229 for (i
= 0; i
< sizeof(cnboards
) / sizeof(cnboards
[0]); i
++)
230 if (strncmp(tcname
, cnboards
[i
].cb_tcname
, TC_ROM_LLEN
) == 0)
233 if (i
== sizeof(cnboards
) / sizeof(cnboards
[0]))
236 (cnboards
[i
].cb_cnattach
)(tcaddr
);
239 #endif /* if NWSDISPLAY > 0 */