1 /* $NetBSD: dec_3000_500.c,v 1.49 2025/03/09 01:06:41 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 (at) 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 * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center 31 */ 32 33 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 34 35 __KERNEL_RCSID(0, "$NetBSD: dec_3000_500.c,v 1.49 2025/03/09 01:06:41 thorpej Exp $"); 36 37 #include <sys/param.h> 38 #include <sys/systm.h> 39 #include <sys/device.h> 40 #include <sys/termios.h> 41 #include <sys/conf.h> 42 #include <dev/cons.h> 43 44 #include <machine/rpb.h> 45 #include <machine/autoconf.h> 46 #include <machine/cpuconf.h> 47 48 #include <dev/tc/tcvar.h> 49 #include <dev/tc/tcdsvar.h> 50 #include <alpha/tc/tc_3000_500.h> 51 52 #include <machine/z8530var.h> 53 #include <dev/tc/zs_ioasicvar.h> 54 55 #include "wsdisplay.h" 56 57 void dec_3000_500_init(void); 58 static void dec_3000_500_cons_init(void); 59 static void dec_3000_500_device_register(device_t, void *); 60 61 static const char dec_3000_500_sp[] = "DEC 3000/400 (\"Sandpiper\")"; 62 static const char dec_3000_500_sf[] = "DEC 3000/500 (\"Flamingo\")"; 63 64 const struct alpha_variation_table dec_3000_500_variations[] = { 65 { SV_ST_SANDPIPER, dec_3000_500_sp }, 66 { SV_ST_FLAMINGO, dec_3000_500_sf }, 67 { SV_ST_HOTPINK, "DEC 3000/500X (\"Hot Pink\")" }, 68 { SV_ST_FLAMINGOPLUS, "DEC 3000/800 (\"Flamingo+\")" }, 69 { SV_ST_SANDPLUS, "DEC 3000/600 (\"Sandpiper+\")" }, 70 { SV_ST_SANDPIPER45, "DEC 3000/700 (\"Sandpiper45\")" }, 71 { SV_ST_FLAMINGO45, "DEC 3000/900 (\"Flamingo45\")" }, 72 { 0, NULL }, 73 }; 74 75 void 76 dec_3000_500_init(void) 77 { 78 uint64_t variation; 79 80 platform.family = "DEC 3000/500 (\"Flamingo\")"; 81 82 if ((platform.model = alpha_dsr_sysname()) == NULL) { 83 variation = hwrpb->rpb_variation & SV_ST_MASK; 84 if (variation == SV_ST_ULTRA) { 85 /* These are really the same. */ 86 variation = SV_ST_FLAMINGOPLUS; 87 } 88 if ((platform.model = alpha_variation_name(variation, 89 dec_3000_500_variations)) == NULL) { 90 /* 91 * This is how things used to be done. 92 */ 93 if (variation == SV_ST_RESERVED) { 94 if (hwrpb->rpb_variation & SV_GRAPHICS) 95 platform.model = dec_3000_500_sf; 96 else 97 platform.model = dec_3000_500_sp; 98 } else 99 platform.model = alpha_unknown_sysname(); 100 } 101 } 102 103 platform.iobus = "tcasic"; 104 platform.cons_init = dec_3000_500_cons_init; 105 platform.device_register = dec_3000_500_device_register; 106 } 107 108 static void 109 dec_3000_500_cons_init(void) 110 { 111 struct ctb *ctb; 112 113 ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off); 114 115 switch (ctb->ctb_term_type) { 116 case CTB_GRAPHICS: 117 #if NWSDISPLAY > 0 118 /* display console ... */ 119 if (zs_ioasic_lk201_cnattach(0x1e0000000, 0x00180000, 0) == 0 && 120 tc_3000_500_fb_cnattach( 121 CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot)) == 0) { 122 break; 123 } 124 #endif 125 printf("consinit: Unable to init console on keyboard and "); 126 printf("TURBOchannel slot 0x%lx.\n", ctb->ctb_turboslot); 127 printf("Using serial console.\n"); 128 /* FALLTHROUGH */ 129 130 case CTB_PRINTERPORT: 131 /* serial console ... */ 132 /* 133 * XXX This could stand some cleanup... 134 */ 135 { 136 /* 137 * Delay to allow PROM putchars to complete. 138 * FIFO depth * character time, 139 * character time = (1000000 / (defaultrate / 10)) 140 */ 141 DELAY(160000000 / 9600); /* XXX */ 142 143 /* 144 * Console is channel B of the second SCC. 145 * XXX Should use ctb_line_off to get the 146 * XXX line parameters--these are the defaults. 147 */ 148 zs_ioasic_cnattach(0x1e0000000, 0x00180000, 1); 149 break; 150 } 151 152 default: 153 printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); 154 printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); 155 panic("consinit: unknown console type %lu", 156 ctb->ctb_term_type); 157 /* NOTREACHED */ 158 } 159 } 160 161 static void 162 dec_3000_500_device_register(device_t dev, void *aux) 163 { 164 tc_find_bootdev(dev, aux); 165 } 166