Annotation of sys/arch/alpha/tc/tcasic.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: tcasic.c,v 1.15 2006/06/15 20:08:29 brad Exp $ */
! 2: /* $NetBSD: tcasic.c,v 1.36 2001/08/23 01:16:52 nisimura Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1994, 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: #include <sys/param.h>
! 32: #include <sys/systm.h>
! 33: #include <sys/device.h>
! 34:
! 35: #include <machine/autoconf.h>
! 36: #include <machine/rpb.h>
! 37: #include <machine/cpu.h>
! 38:
! 39: #include <dev/tc/tcvar.h>
! 40: #include <alpha/tc/tc_conf.h>
! 41:
! 42: /* Definition of the driver for autoconfig. */
! 43: int tcasicmatch(struct device *, void *, void *);
! 44: void tcasicattach(struct device *, struct device *, void *);
! 45:
! 46: struct cfattach tcasic_ca = {
! 47: sizeof (struct device), tcasicmatch, tcasicattach,
! 48: };
! 49:
! 50: struct cfdriver tcasic_cd = {
! 51: NULL, "tcasic", DV_DULL,
! 52: };
! 53:
! 54:
! 55: int tcasicprint(void *, const char *);
! 56:
! 57: /* There can be only one. */
! 58: int tcasicfound;
! 59:
! 60: int
! 61: tcasicmatch(parent, cfdata, aux)
! 62: struct device *parent;
! 63: void *cfdata, *aux;
! 64: {
! 65: struct mainbus_attach_args *ma = aux;
! 66:
! 67: /* Make sure that we're looking for a TurboChannel ASIC. */
! 68: if (strcmp(ma->ma_name, tcasic_cd.cd_name))
! 69: return (0);
! 70:
! 71: if (tcasicfound)
! 72: return (0);
! 73:
! 74: return (1);
! 75: }
! 76:
! 77: void
! 78: tcasicattach(parent, self, aux)
! 79: struct device *parent;
! 80: struct device *self;
! 81: void *aux;
! 82: {
! 83: struct tcbus_attach_args tba;
! 84: void (*intr_setup)(void);
! 85: void (*iointr)(void *, unsigned long);
! 86:
! 87: printf("\n");
! 88: tcasicfound = 1;
! 89:
! 90: switch (cputype) {
! 91: #ifdef DEC_3000_500
! 92: case ST_DEC_3000_500:
! 93:
! 94: intr_setup = tc_3000_500_intr_setup;
! 95: iointr = tc_3000_500_iointr;
! 96:
! 97: tba.tba_speed = TC_SPEED_25_MHZ;
! 98: tba.tba_nslots = tc_3000_500_nslots;
! 99: tba.tba_slots = tc_3000_500_slots;
! 100: if (hwrpb->rpb_variation & SV_GRAPHICS) {
! 101: tba.tba_nbuiltins = tc_3000_500_graphics_nbuiltins;
! 102: tba.tba_builtins = tc_3000_500_graphics_builtins;
! 103: } else {
! 104: tba.tba_nbuiltins = tc_3000_500_nographics_nbuiltins;
! 105: tba.tba_builtins = tc_3000_500_nographics_builtins;
! 106: }
! 107: tba.tba_intr_establish = tc_3000_500_intr_establish;
! 108: tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
! 109: tba.tba_get_dma_tag = tc_dma_get_tag_3000_500;
! 110:
! 111: /* Do 3000/500-specific DMA setup now. */
! 112: tc_dma_init_3000_500(tc_3000_500_nslots);
! 113: break;
! 114: #endif /* DEC_3000_500 */
! 115:
! 116: #ifdef DEC_3000_300
! 117: case ST_DEC_3000_300:
! 118:
! 119: intr_setup = tc_3000_300_intr_setup;
! 120: iointr = tc_3000_300_iointr;
! 121:
! 122: tba.tba_speed = TC_SPEED_12_5_MHZ;
! 123: tba.tba_nslots = tc_3000_300_nslots;
! 124: tba.tba_slots = tc_3000_300_slots;
! 125: tba.tba_nbuiltins = tc_3000_300_nbuiltins;
! 126: tba.tba_builtins = tc_3000_300_builtins;
! 127: tba.tba_intr_establish = tc_3000_300_intr_establish;
! 128: tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
! 129: tba.tba_get_dma_tag = tc_dma_get_tag_3000_300;
! 130: break;
! 131: #endif /* DEC_3000_300 */
! 132:
! 133: default:
! 134: panic("tcasicattach: bad cputype");
! 135: }
! 136:
! 137: tba.tba_busname = "tc";
! 138: tba.tba_memt = tc_bus_mem_init(NULL);
! 139:
! 140: tc_dma_init();
! 141:
! 142: (*intr_setup)();
! 143:
! 144: /* They all come in at 0x800. */
! 145: scb_set(0x800, iointr, NULL);
! 146:
! 147: config_found(self, &tba, tcasicprint);
! 148: }
! 149:
! 150: int
! 151: tcasicprint(aux, pnp)
! 152: void *aux;
! 153: const char *pnp;
! 154: {
! 155:
! 156: /* only TCs can attach to tcasics; easy. */
! 157: if (pnp)
! 158: printf("tc at %s", pnp);
! 159: return (UNCONF);
! 160: }
! 161:
! 162: #ifdef notyet
! 163:
! 164: #include "wsdisplay.h"
! 165:
! 166: #if NWSDISPLAY > 0
! 167:
! 168: #include "sfb.h"
! 169: #include "sfbp.h"
! 170: #include "cfb.h"
! 171: #include "mfb.h"
! 172: #include "tfb.h"
! 173: #include "px.h"
! 174: #include "pxg.h"
! 175:
! 176: extern void sfb_cnattach(tc_addr_t);
! 177: extern void sfbp_cnattach(tc_addr_t);
! 178: extern void cfb_cnattach(tc_addr_t);
! 179: extern void mfb_cnattach(tc_addr_t);
! 180: extern void tfb_cnattach(tc_addr_t);
! 181: extern void px_cnattach(tc_addr_t);
! 182: extern void pxg_cnattach(tc_addr_t);
! 183: extern int tc_checkslot(tc_addr_t, char *);
! 184:
! 185: struct cnboards {
! 186: const char *cb_tcname;
! 187: void (*cb_cnattach)(tc_addr_t);
! 188: } static const cnboards[] = {
! 189: #if NSFB > 0
! 190: { "PMAGB-BA", sfb_cnattach },
! 191: #endif
! 192: #if NSFBP > 0
! 193: { "PMAGD ", sfbp_cnattach },
! 194: #endif
! 195: #if NCFB > 0
! 196: { "PMAG-BA ", cfb_cnattach },
! 197: #endif
! 198: #if NMFB > 0
! 199: { "PMAG-AA ", mfb_cnattach },
! 200: #endif
! 201: #if NTFB > 0
! 202: { "PMAG-JA ", tfb_cnattach },
! 203: #endif
! 204: #if NPX > 0
! 205: { "PMAG-CA ", px_cnattach },
! 206: #endif
! 207: #if NPXG > 0
! 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 },
! 213: #endif
! 214: };
! 215:
! 216: /*
! 217: * tc_fb_cnattach --
! 218: * Attempt to attach the appropriate display driver to the
! 219: * output console.
! 220: */
! 221: int
! 222: tc_fb_cnattach(tcaddr)
! 223: tc_addr_t tcaddr;
! 224: {
! 225: char tcname[TC_ROM_LLEN];
! 226: int i;
! 227:
! 228: if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0))
! 229: return (EINVAL);
! 230:
! 231: for (i = 0; i < sizeof(cnboards) / sizeof(cnboards[0]); i++)
! 232: if (strncmp(tcname, cnboards[i].cb_tcname, TC_ROM_LLEN) == 0)
! 233: break;
! 234:
! 235: if (i == sizeof(cnboards) / sizeof(cnboards[0]))
! 236: return (ENXIO);
! 237:
! 238: (cnboards[i].cb_cnattach)(tcaddr);
! 239: return (0);
! 240: }
! 241: #endif /* if NWSDISPLAY > 0 */
! 242:
! 243: #else
! 244:
! 245: int
! 246: tc_fb_cnattach(tcaddr)
! 247: tc_addr_t tcaddr;
! 248: {
! 249: return (ENXIO);
! 250: }
! 251: #endif
CVSweb