1 /* $NetBSD: tcbus.c,v 1.24 2009/03/14 21:04:14 dsl Exp $ */
4 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.24 2009/03/14 21:04:14 dsl Exp $");
36 * Which system models were configured?
38 #include "opt_dec_3max.h"
39 #include "opt_dec_3min.h"
40 #include "opt_dec_maxine.h"
41 #include "opt_dec_3maxplus.h"
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/device.h>
47 #include <machine/autoconf.h>
48 #include <machine/sysconf.h>
50 #define _PMAX_BUS_DMA_PRIVATE
51 #include <machine/bus.h>
53 #include <dev/tc/tcvar.h>
54 #include <pmax/pmax/pmaxtype.h>
56 static const struct evcnt
*tc_ds_intr_evcnt(struct device
*, void *);
57 static void tc_ds_intr_establish(struct device
*, void *,
58 int, int (*)(void *), void *);
59 static void tc_ds_intr_disestablish(struct device
*, void *);
60 static bus_dma_tag_t
tc_ds_get_dma_tag(int);
62 extern struct tcbus_attach_args kn02_tc_desc
[]; /* XXX */
63 extern struct tcbus_attach_args kmin_tc_desc
[]; /* XXX */
64 extern struct tcbus_attach_args xine_tc_desc
[]; /* XXX */
65 extern struct tcbus_attach_args kn03_tc_desc
[]; /* XXX */
67 static int tcbus_match(struct device
*, struct cfdata
*, void *);
68 static void tcbus_attach(struct device
*, struct device
*, void *);
70 CFATTACH_DECL(tcbus
, sizeof(struct tc_softc
),
71 tcbus_match
, tcbus_attach
, NULL
, NULL
);
73 static int tcbus_found
;
76 tcbus_match(struct device
*parent
, struct cfdata
*cfdata
, void *aux
)
78 struct mainbus_attach_args
*ma
= aux
;
80 if (tcbus_found
|| strcmp(ma
->ma_name
, "tcbus"))
87 tcbus_attach(struct device
*parent
, struct device
*self
, void *aux
)
89 struct tcbus_attach_args
*tba
;
96 tba
= &kn02_tc_desc
[0]; break;
100 tba
= &kmin_tc_desc
[0]; break;
104 tba
= &xine_tc_desc
[0]; break;
108 tba
= &kn03_tc_desc
[0]; break;
111 panic("tcbus_attach: no TURBOchannel configured for systype = %d", systype
);
114 tba
->tba_busname
= "tc";
116 tba
->tba_intr_evcnt
= tc_ds_intr_evcnt
;
117 tba
->tba_intr_establish
= tc_ds_intr_establish
;
118 tba
->tba_intr_disestablish
= tc_ds_intr_disestablish
;
119 tba
->tba_get_dma_tag
= tc_ds_get_dma_tag
;
121 tcattach(parent
, self
, tba
);
125 * Dispatch to model specific interrupt line evcnt fetch rontine
127 static const struct evcnt
*
128 tc_ds_intr_evcnt(struct device
*dev
, void *cookie
)
131 /* XXX for now, no evcnt parent reported */
136 * Dispatch to model specific interrupt establishing routine
139 tc_ds_intr_establish(struct device
*dev
, void *cookie
, int level
, int (*handler
)(void *), void *val
)
142 (*platform
.intr_establish
)(dev
, cookie
, level
, handler
, val
);
146 tc_ds_intr_disestablish(struct device
*dev
, void *arg
)
149 printf("cannot disestablish TC interrupts\n");
153 * Return the DMA tag for use by the specified TURBOchannel slot.
156 tc_ds_get_dma_tag(int slot
)
159 * All DECstations use the default DMA tag.
161 return (&pmax_default_bus_dma_tag
);
164 #include "wsdisplay.h"
169 /* #include "sfbp.h" */
177 #include <pmax/pmax/cons.h>
178 #include <machine/dec_prom.h>
180 int tc_checkslot(tc_addr_t
, char *);
183 const char *cb_tcname
;
184 void (*cb_cnattach
)(tc_addr_t
);
185 } static const cnboards
[] = {
187 { "PMAG-DV ", xcfb_cnattach
},
190 { "PMAGB-BA", sfb_cnattach
},
193 { "PMAGD ", sfbp_cnattach
},
196 { "PMAG-BA ", cfb_cnattach
},
199 { "PMAG-AA ", mfb_cnattach
},
202 { "PMAG-JA ", tfb_cnattach
},
205 { "PMAG-CA ", px_cnattach
},
208 { "PMAG-DA ", pxg_cnattach
},
209 { "PMAG-FA ", pxg_cnattach
},
210 { "PMAG-FB ", pxg_cnattach
},
211 { "PMAGB-FA", pxg_cnattach
},
212 { "PMAGB-FB", pxg_cnattach
},
217 tcfb_cnattach(int slotno
)
220 char tcname
[TC_ROM_LLEN
];
223 tcaddr
= (*callv
->_slot_address
)(slotno
);
224 if (tc_badaddr(tcaddr
) || tc_checkslot(tcaddr
, tcname
) == 0)
225 panic("TC console designated by PROM does not exist!?");
227 for (i
= 0; i
< sizeof(cnboards
) / sizeof(cnboards
[0]); i
++)
228 if (strncmp(tcname
, cnboards
[i
].cb_tcname
, TC_ROM_LLEN
) == 0)
231 if (i
== sizeof(cnboards
) / sizeof(cnboards
[0]))
234 (cnboards
[i
].cb_cnattach
)((tc_addr_t
)TC_PHYS_TO_UNCACHED(tcaddr
));
238 #endif /* NWSDISPLAY */