1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: autoconf.c 1.13 91/01/21$ 13 * 14 * @(#)autoconf.c 7.5 (Berkeley) 05/07/91 15 */ 16 17 #include "samachdep.h" 18 #include "sys/param.h" 19 20 #include "../dev/device.h" 21 #include "../dev/grfvar.h" 22 23 struct hp_hw sc_table[MAXCTLRS]; 24 25 extern int internalhpib; 26 27 #if 0 28 #include "rominfo.h" 29 printrominfo() 30 { 31 struct rominfo *rp = (struct rominfo *)ROMADDR; 32 printf("boottype %x, name %s, lowram %x, sysflag %x\n", 33 rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff); 34 printf("rambase %x, ndrives %x, sysflag2 %x, msus %x\n", 35 rp->rambase, rp->ndrives, rp->sysflag2&0xff, rp->msus); 36 } 37 #endif 38 39 configure() 40 { 41 find_devs(); 42 cninit(); 43 #if 0 44 printrominfo(); 45 #endif 46 hpibinit(); 47 scsiinit(); 48 } 49 50 sctoaddr(sc) 51 int sc; 52 { 53 if (sc == -1) 54 return(GRFIADDR); 55 if (sc == 7 && internalhpib) 56 return(internalhpib); 57 if (sc < 32) 58 return(DIOBASE + sc * DIOCSIZE); 59 if (sc >= 132) 60 return(DIOIIBASE + (sc - 132) * DIOIICSIZE); 61 return(sc); 62 } 63 64 /* 65 * Probe all DIO select codes (0 - 32), the internal display address, 66 * and DIO-II select codes (132 - 256). 67 * 68 * Note that we only care about displays, SCSIs and HP-IBs. 69 */ 70 find_devs() 71 { 72 short sc, sctop; 73 u_char *id_reg; 74 register caddr_t addr; 75 register struct hp_hw *hw; 76 extern int machineid; 77 78 hw = sc_table; 79 sctop = machineid == HP_320 ? 32 : 256; 80 for (sc = -1; sc < sctop; sc++) { 81 if (sc >= 32 && sc < 132) 82 continue; 83 addr = (caddr_t) sctoaddr(sc); 84 if (badaddr(addr)) 85 continue; 86 87 id_reg = (u_char *) addr; 88 hw->hw_pa = addr; 89 if (sc >= 132) 90 hw->hw_size = (id_reg[0x101] + 1) * 0x100000; 91 else 92 hw->hw_size = DIOCSIZE; 93 hw->hw_kva = addr; 94 hw->hw_id = id_reg[1]; 95 hw->hw_sc = sc; 96 97 /* 98 * Not all internal HP-IBs respond rationally to id requests 99 * so we just go by the "internal HPIB" indicator in SYSFLAG. 100 */ 101 if (sc == 7 && internalhpib) { 102 hw->hw_type = C_HPIB; 103 hw++; 104 continue; 105 } 106 107 switch (hw->hw_id) { 108 case 5: /* 98642A */ 109 case 5+128: /* 98642A remote */ 110 hw->hw_type = D_COMMDCM; 111 break; 112 case 8: /* 98625B */ 113 case 128: /* 98624A */ 114 hw->hw_type = C_HPIB; 115 break; 116 case 57: /* Displays */ 117 hw->hw_type = D_BITMAP; 118 hw->hw_secid = id_reg[0x15]; 119 switch (hw->hw_secid) { 120 case 4: /* renaissance */ 121 case 8: /* davinci */ 122 sc++; /* occupy 2 select codes */ 123 break; 124 } 125 break; 126 case 9: 127 hw->hw_type = D_KEYBOARD; 128 break; 129 case 7: 130 case 7+32: 131 case 7+64: 132 case 7+96: 133 hw->hw_type = C_SCSI; 134 break; 135 default: /* who cares */ 136 hw->hw_type = D_MISC; 137 break; 138 } 139 hw++; 140 } 141 } 142