Annotation of sys/arch/alpha/alpha/dec_3000_300.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: dec_3000_300.c,v 1.12 2006/11/28 16:56:50 dlg Exp $ */
2: /* $NetBSD: dec_3000_300.c,v 1.30 2000/05/22 20:13:32 thorpej Exp $ */
3:
4: /*
5: * Copyright (c) 1995, 1996 Carnegie-Mellon University.
6: * All rights reserved.
7: *
8: * Author: Chris G. Demetriou
9: *
10: * Permission to use, copy, modify and distribute this software and
11: * its documentation is hereby granted, provided that both the copyright
12: * notice and this permission notice appear in all copies of the
13: * software, derivative works or modified versions, and any portions
14: * thereof, and that both notices appear in supporting documentation.
15: *
16: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19: *
20: * Carnegie Mellon requests users of this software to return to
21: *
22: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23: * School of Computer Science
24: * Carnegie Mellon University
25: * Pittsburgh PA 15213-3890
26: *
27: * any improvements or extensions that they make and grant Carnegie the
28: * rights to redistribute these changes.
29: */
30:
31: /*
32: * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
33: */
34:
35:
36: #include <sys/param.h>
37: #include <sys/systm.h>
38: #include <sys/device.h>
39: #include <sys/termios.h>
40: #include <sys/conf.h>
41:
42: #include <machine/rpb.h>
43: #include <machine/autoconf.h>
44: #include <machine/cpuconf.h>
45:
46: #include <dev/tc/tcvar.h>
47: #include <dev/tc/tcdsvar.h>
48: #include <alpha/tc/tc_3000_300.h>
49: #ifndef NEW_SCC_DRIVER
50: #include <alpha/tc/sccvar.h>
51: #endif
52:
53: #if 0
54: #include <machine/z8530var.h>
55: #include <dev/dec/zskbdvar.h>
56: #endif
57:
58: #include <scsi/scsi_all.h>
59: #include <scsi/scsiconf.h>
60:
61: #include "wsdisplay.h"
62:
63: void dec_3000_300_init(void);
64: static void dec_3000_300_cons_init(void);
65: static void dec_3000_300_device_register(struct device *, void *);
66:
67: const struct alpha_variation_table dec_3000_300_variations[] = {
68: { SV_ST_PELICAN, "DEC 3000/300 (\"Pelican\")" },
69: { SV_ST_PELICA, "DEC 3000/300L (\"Pelica\")" },
70: { SV_ST_PELICANPLUS, "DEC 3000/300X (\"Pelican+\")" },
71: { SV_ST_PELICAPLUS, "DEC 3000/300LX (\"Pelica+\")" },
72: { 0, NULL },
73: };
74:
75: void
76: dec_3000_300_init()
77: {
78: u_int64_t variation;
79:
80: platform.family = "DEC 3000/300 (\"Pelican\")";
81:
82: if ((platform.model = alpha_dsr_sysname()) == NULL) {
83: variation = hwrpb->rpb_variation & SV_ST_MASK;
84: if ((platform.model = alpha_variation_name(variation,
85: dec_3000_300_variations)) == NULL)
86: platform.model = alpha_unknown_sysname();
87: }
88:
89: platform.iobus = "tcasic";
90: platform.cons_init = dec_3000_300_cons_init;
91: platform.device_register = dec_3000_300_device_register;
92: }
93:
94: static void
95: dec_3000_300_cons_init()
96: {
97: struct ctb *ctb;
98:
99: ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
100:
101: #ifndef NEW_SCC_DRIVER
102: switch (ctb->ctb_term_type) {
103: case CTB_GRAPHICS:
104: #if 0
105: alpha_donot_kludge_scc = 1;
106: #endif
107: return;
108: case CTB_PRINTERPORT:
109: return;
110: default:
111: goto badconsole;
112: }
113: #else
114: switch (ctb->ctb_term_type) {
115: case CTB_GRAPHICS:
116: #if NWSDISPLAY > 0
117: /* display console ... */
118: if (zs_ioasic_lk201_cnattach(0x1a0000000, 0x00180000, 0) == 0 &&
119: tc_3000_300_fb_cnattach(
120: CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot)) == 0) {
121: break;
122: }
123: #endif
124: printf("consinit: Unable to init console on keyboard and ");
125: printf("TURBOchannel slot 0x%lx.\n", ctb->ctb_turboslot);
126: printf("Using serial console.\n");
127: /* FALLTHROUGH */
128:
129: case CTB_PRINTERPORT:
130: /* serial console ... */
131: /*
132: * XXX This could stand some cleanup...
133: */
134: {
135: /*
136: * Delay to allow PROM putchars to complete.
137: * FIFO depth * character time.
138: * character time = (1000000 / (defaultrate / 10))
139: */
140: DELAY(160000000 / 9600); /* XXX */
141:
142: /*
143: * Console is channel B of the first SCC.
144: * XXX Should use ctb_line_off to get the
145: * XXX line parameters.
146: */
147: if (zs_ioasic_cnattach(0x1a0000000, 0x00100000, 1,
148: 9600, (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
149: panic("can't init serial console");
150: break;
151: }
152:
153: default:
154: goto badconsole;
155: }
156: #endif
157: return;
158: badconsole:
159: printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
160: printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
161:
162: panic("consinit: unknown console type %lu",
163: ctb->ctb_term_type);
164: }
165:
166: static void
167: dec_3000_300_device_register(dev, aux)
168: struct device *dev;
169: void *aux;
170: {
171: static int found, initted, scsiboot, netboot;
172: static struct device *scsidev;
173: static struct device *tcdsdev;
174: struct bootdev_data *b = bootdev_data;
175: struct device *parent = dev->dv_parent;
176: struct cfdata *cf = dev->dv_cfdata;
177: struct cfdriver *cd = cf->cf_driver;
178:
179: if (found)
180: return;
181:
182: if (!initted) {
183: scsiboot = (strcmp(b->protocol, "SCSI") == 0);
184: netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
185: (strcmp(b->protocol, "MOP") == 0);
186: #if 0
187: printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
188: #endif
189: initted = 1;
190: }
191:
192: /*
193: * for scsi boot, we look for "tcds", make sure it has the
194: * right slot number, then find the "asc" on this tcds that
195: * as the right channel. then we find the actual scsi
196: * device we came from. note: no SCSI LUN support (yet).
197: */
198: if (scsiboot && (strcmp(cd->cd_name, "tcds") == 0)) {
199: struct tc_attach_args *tcargs = aux;
200:
201: if (b->slot != tcargs->ta_slot)
202: return;
203:
204: tcdsdev = dev;
205: #if 0
206: printf("\ntcdsdev = %s\n", dev->dv_xname);
207: #endif
208: }
209: if (scsiboot && tcdsdev &&
210: (strcmp(cd->cd_name, "asc") == 0)) {
211: struct tcdsdev_attach_args *ta = aux;
212:
213: if (parent != (struct device *)tcdsdev)
214: return;
215:
216: if (ta->tcdsda_chip != b->channel)
217: return;
218:
219: scsidev = dev;
220: #if 0
221: printf("\nscsidev = %s\n", dev->dv_xname);
222: #endif
223: }
224:
225: if (scsiboot && scsidev &&
226: (strcmp(cd->cd_name, "sd") == 0 ||
227: strcmp(cd->cd_name, "st") == 0 ||
228: strcmp(cd->cd_name, "cd") == 0)) {
229: struct scsi_attach_args *sa = aux;
230:
231: if (parent->dv_parent != scsidev)
232: return;
233:
234: if (b->unit / 100 != sa->sa_sc_link->target)
235: return;
236:
237: /* XXX LUN! */
238:
239: switch (b->boot_dev_type) {
240: case 0:
241: if (strcmp(cd->cd_name, "sd") &&
242: strcmp(cd->cd_name, "cd"))
243: return;
244: break;
245: case 1:
246: if (strcmp(cd->cd_name, "st"))
247: return;
248: break;
249: default:
250: return;
251: }
252:
253: /* we've found it! */
254: booted_device = dev;
255: #if 0
256: printf("\nbooted_device = %s\n", booted_device->dv_xname);
257: #endif
258: found = 1;
259: }
260:
261: if (netboot) {
262: if (b->slot == 5 && strcmp(cd->cd_name, "le") == 0 &&
263: strcmp(parent->dv_cfdata->cf_driver->cd_name, "ioasic")
264: == 0) {
265: /*
266: * no need to check ioasic_attach_args, since only
267: * one le on ioasic.
268: */
269:
270: booted_device = dev;
271: #if 0
272: printf("\nbooted_device = %s\n", booted_device->dv_xname);
273: #endif
274: found = 1;
275: return;
276: }
277:
278: /*
279: * XXX GENERIC SUPPORT FOR TC NETWORK BOARDS
280: */
281: }
282: }
CVSweb