Commit | Line | Data |
---|---|---|
a8fd2d0d KM |
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 | * | |
2bb0988c | 12 | * from: Utah $Hdr: autoconf.c 1.13 91/01/21$ |
a8fd2d0d | 13 | * |
2bb0988c | 14 | * @(#)autoconf.c 7.5 (Berkeley) %G% |
a8fd2d0d KM |
15 | */ |
16 | ||
17 | #include "samachdep.h" | |
b28b3a13 | 18 | #include "sys/param.h" |
a8fd2d0d | 19 | |
b28b3a13 KB |
20 | #include "../dev/device.h" |
21 | #include "../dev/grfvar.h" | |
a8fd2d0d | 22 | |
2bb0988c | 23 | struct hp_hw sc_table[MAXCTLRS]; |
a8fd2d0d | 24 | |
18239460 KM |
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 | ||
a8fd2d0d KM |
39 | configure() |
40 | { | |
41 | find_devs(); | |
42 | cninit(); | |
18239460 KM |
43 | #if 0 |
44 | printrominfo(); | |
45 | #endif | |
a8fd2d0d KM |
46 | hpibinit(); |
47 | scsiinit(); | |
48 | } | |
49 | ||
50 | sctoaddr(sc) | |
51 | int sc; | |
52 | { | |
a8fd2d0d KM |
53 | if (sc == -1) |
54 | return(GRFIADDR); | |
18239460 | 55 | if (sc == 7 && internalhpib) |
a8fd2d0d KM |
56 | return(internalhpib); |
57 | if (sc < 32) | |
2bb0988c MH |
58 | return(DIOBASE + sc * DIOCSIZE); |
59 | if (sc >= 132) | |
60 | return(DIOIIBASE + (sc - 132) * DIOIICSIZE); | |
a8fd2d0d KM |
61 | return(sc); |
62 | } | |
63 | ||
64 | /* | |
2bb0988c MH |
65 | * Probe all DIO select codes (0 - 32), the internal display address, |
66 | * and DIO-II select codes (132 - 256). | |
f7035add | 67 | * |
a8fd2d0d KM |
68 | * Note that we only care about displays, SCSIs and HP-IBs. |
69 | */ | |
70 | find_devs() | |
71 | { | |
2bb0988c | 72 | short sc, sctop; |
a8fd2d0d | 73 | u_char *id_reg; |
2bb0988c | 74 | register caddr_t addr; |
a8fd2d0d | 75 | register struct hp_hw *hw; |
2bb0988c | 76 | extern int machineid; |
a8fd2d0d KM |
77 | |
78 | hw = sc_table; | |
2bb0988c MH |
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); | |
a8fd2d0d KM |
84 | if (badaddr(addr)) |
85 | continue; | |
86 | ||
87 | id_reg = (u_char *) addr; | |
2bb0988c MH |
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]; | |
a8fd2d0d KM |
95 | hw->hw_sc = sc; |
96 | ||
18239460 KM |
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) { | |
2bb0988c | 102 | hw->hw_type = C_HPIB; |
18239460 KM |
103 | hw++; |
104 | continue; | |
105 | } | |
106 | ||
a8fd2d0d | 107 | switch (hw->hw_id) { |
18239460 | 108 | case 5: /* 98642A */ |
2bb0988c MH |
109 | case 5+128: /* 98642A remote */ |
110 | hw->hw_type = D_COMMDCM; | |
18239460 | 111 | break; |
a8fd2d0d KM |
112 | case 8: /* 98625B */ |
113 | case 128: /* 98624A */ | |
2bb0988c | 114 | hw->hw_type = C_HPIB; |
a8fd2d0d KM |
115 | break; |
116 | case 57: /* Displays */ | |
2bb0988c MH |
117 | hw->hw_type = D_BITMAP; |
118 | hw->hw_secid = id_reg[0x15]; | |
119 | switch (hw->hw_secid) { | |
a8fd2d0d KM |
120 | case 4: /* renaissance */ |
121 | case 8: /* davinci */ | |
122 | sc++; /* occupy 2 select codes */ | |
123 | break; | |
124 | } | |
125 | break; | |
126 | case 9: | |
2bb0988c | 127 | hw->hw_type = D_KEYBOARD; |
a8fd2d0d KM |
128 | break; |
129 | case 7: | |
2bb0988c MH |
130 | case 7+32: |
131 | case 7+64: | |
132 | case 7+96: | |
133 | hw->hw_type = C_SCSI; | |
f7035add KM |
134 | break; |
135 | default: /* who cares */ | |
2bb0988c | 136 | hw->hw_type = D_MISC; |
f7035add KM |
137 | break; |
138 | } | |
139 | hw++; | |
140 | } | |
a8fd2d0d | 141 | } |