|
|
1.1 root 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: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
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.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
20: * This product includes software developed by the University of
21: * California, Berkeley and its contributors.
22: * 4. Neither the name of the University nor the names of its contributors
23: * may be used to endorse or promote products derived from this software
24: * without specific prior written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: * SUCH DAMAGE.
37: *
38: * from: Utah $Hdr: autoconf.c 1.13 91/01/21$
39: *
1.1.1.2 ! root 40: * from: @(#)autoconf.c 7.5 (Berkeley) 5/7/91
! 41: * autoconf.c,v 1.2 1993/05/22 07:58:43 cgd Exp
1.1 root 42: */
43:
44: #include "samachdep.h"
45: #include "sys/param.h"
46:
47: #include "../dev/device.h"
48: #include "../dev/grfvar.h"
49:
50: struct hp_hw sc_table[MAXCTLRS];
51:
52: extern int internalhpib;
53:
54: #if 0
55: #include "rominfo.h"
56: printrominfo()
57: {
58: struct rominfo *rp = (struct rominfo *)ROMADDR;
59: printf("boottype %x, name %s, lowram %x, sysflag %x\n",
60: rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff);
61: printf("rambase %x, ndrives %x, sysflag2 %x, msus %x\n",
62: rp->rambase, rp->ndrives, rp->sysflag2&0xff, rp->msus);
63: }
64: #endif
65:
66: configure()
67: {
68: find_devs();
69: cninit();
70: #if 0
71: printrominfo();
72: #endif
73: hpibinit();
74: scsiinit();
75: }
76:
77: sctoaddr(sc)
78: int sc;
79: {
80: if (sc == -1)
81: return(GRFIADDR);
82: if (sc == 7 && internalhpib)
83: return(internalhpib);
84: if (sc < 32)
85: return(DIOBASE + sc * DIOCSIZE);
86: if (sc >= 132)
87: return(DIOIIBASE + (sc - 132) * DIOIICSIZE);
88: return(sc);
89: }
90:
91: /*
92: * Probe all DIO select codes (0 - 32), the internal display address,
93: * and DIO-II select codes (132 - 256).
94: *
95: * Note that we only care about displays, SCSIs and HP-IBs.
96: */
97: find_devs()
98: {
99: short sc, sctop;
100: u_char *id_reg;
101: register caddr_t addr;
102: register struct hp_hw *hw;
103: extern int machineid;
104:
105: hw = sc_table;
106: sctop = machineid == HP_320 ? 32 : 256;
107: for (sc = -1; sc < sctop; sc++) {
108: if (sc >= 32 && sc < 132)
109: continue;
110: addr = (caddr_t) sctoaddr(sc);
111: if (badaddr(addr))
112: continue;
113:
114: id_reg = (u_char *) addr;
115: hw->hw_pa = addr;
116: if (sc >= 132)
117: hw->hw_size = (id_reg[0x101] + 1) * 0x100000;
118: else
119: hw->hw_size = DIOCSIZE;
120: hw->hw_kva = addr;
121: hw->hw_id = id_reg[1];
122: hw->hw_sc = sc;
123:
124: /*
125: * Not all internal HP-IBs respond rationally to id requests
126: * so we just go by the "internal HPIB" indicator in SYSFLAG.
127: */
128: if (sc == 7 && internalhpib) {
129: hw->hw_type = C_HPIB;
130: hw++;
131: continue;
132: }
133:
134: switch (hw->hw_id) {
135: case 5: /* 98642A */
136: case 5+128: /* 98642A remote */
137: hw->hw_type = D_COMMDCM;
138: break;
139: case 8: /* 98625B */
140: case 128: /* 98624A */
141: hw->hw_type = C_HPIB;
142: break;
143: case 57: /* Displays */
144: hw->hw_type = D_BITMAP;
145: hw->hw_secid = id_reg[0x15];
146: switch (hw->hw_secid) {
147: case 4: /* renaissance */
148: case 8: /* davinci */
149: sc++; /* occupy 2 select codes */
150: break;
151: }
152: break;
153: case 9:
154: hw->hw_type = D_KEYBOARD;
155: break;
156: case 7:
157: case 7+32:
158: case 7+64:
159: case 7+96:
160: hw->hw_type = C_SCSI;
161: break;
162: default: /* who cares */
163: hw->hw_type = D_MISC;
164: break;
165: }
166: hw++;
167: }
168: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.