This source file includes following definitions.
- zorro_find
- zorro_get_board
- zorro_config_board
- zorro_unconfig_board
- identify
- zorro_identify
- zorro_get_list
- mark_region
- zorro_init
1
2
3
4
5
6
7
8
9
10
11
12 #include <linux/config.h>
13 #include <linux/types.h>
14 #include <linux/kernel.h>
15 #include <linux/string.h>
16 #include <asm/bitops.h>
17 #include <asm/amigahw.h>
18 #include <asm/bootinfo.h>
19 #include <asm/zorro.h>
20
21
22 #ifdef CONFIG_ZORRO
23
24
25
26
27
28 struct Manufacturer {
29 char *Name;
30 u_short ID;
31 u_short NumProd;
32 struct Product *Products;
33 };
34
35 struct Product {
36 char *Name;
37 u_char ID;
38 };
39
40 struct GVP_Product {
41 char *Name;
42 enum GVP_ident ID;
43 };
44
45
46
47
48
49
50 #define BEGIN_PROD(id) static struct Product Prod_##id[] = {
51 #define PROD(name, id) \
52 { name, PROD_##id },
53
54 #define BEGIN_GVP_PROD static struct GVP_Product Ext_Prod_GVP[] = {
55 #define GVP_PROD(name, id) \
56 { name, GVP_##id },
57
58 #define BEGIN_MANUF static struct Manufacturer Manufacturers[] = {
59 #define MANUF(name, id) \
60 { name, MANUF_##id, sizeof(Prod_##id)/sizeof(struct Product), Prod_##id },
61
62 #define END };
63
64
65
66
67
68
69
70
71
72 BEGIN_PROD(MEMPHIS)
73 PROD("Stormbringer", STORMBRINGER)
74 END
75
76 BEGIN_PROD(COMMODORE2)
77 PROD("A2088 Bridgeboard", A2088)
78 PROD("A2386-SX Bridgeboard", A2386SX)
79 END
80
81 BEGIN_PROD(COMMODORE)
82 PROD("A2090/A2090A HD Controller", A2090A)
83 PROD("A590 SCSI Controller", A590)
84 PROD("A2091 SCSI Controller", A2091)
85 PROD("A2090B 2090 Autoboot Card", A2090B)
86 PROD("A2060 Arcnet Card", ARCNET)
87 PROD("A2052/58.RAM | 590/2091.RAM", CBMRAM)
88 PROD("A560 Memory Module", A560RAM)
89 PROD("A2232 Serial Prototype", A2232PROTO)
90 PROD("A2232 Serial Production", A2232)
91 PROD("A2620 68020/RAM Card", A2620)
92 PROD("A2630 68030/RAM Card", A2630)
93 PROD("A4091 SCSI Controller", A4091)
94 PROD("Romulator Card", ROMULATOR)
95 PROD("A3000 Test Fixture", A3000TESTFIX)
96 PROD("A2065 Ethernet Card", A2065)
97 END
98
99 BEGIN_PROD(CARDCO)
100 PROD("Cardco A2410 Hires Graphics card", CC_A2410)
101 END
102
103 BEGIN_PROD(MICROBOTICS)
104 PROD("VXL-30 Turbo Board", VXL_30)
105 END
106
107 BEGIN_PROD(ASDG)
108 PROD("Lan Rover Ethernet", LAN_ROVER)
109 PROD("Dual Serial Card", ASDG_DUAL_SERIAL)
110 END
111
112 BEGIN_PROD(UNIV_OF_LOWELL)
113 PROD("A2410 Hires Graphics Card", A2410)
114 END
115
116 BEGIN_PROD(AMERISTAR)
117 PROD("A2065 Ethernet Card", AMERISTAR2065)
118 PROD("A560 Arcnet Card", A560)
119 PROD("A4066 Ethernet Card", A4066)
120 END
121
122 BEGIN_PROD(SUPRA)
123 PROD("Wordsync SCSI Controller", WORDSYNC)
124 PROD("Wordsync II SCSI Controller", WORDSYNC_II)
125 PROD("2400 Modem", SUPRA_2400MODEM)
126 END
127
128 BEGIN_PROD(CSA)
129 PROD("Magnum 40 SCSI Controller", MAGNUM)
130 PROD("12 Gauge SCSI Controller", 12GAUGE)
131 END
132
133 BEGIN_PROD(POWER_COMPUTING)
134 PROD("Viper II Turbo Board (DKB 1240)", DKB_1240)
135 END
136
137 BEGIN_PROD(GVP)
138 PROD("Generic GVP product", GVP)
139 PROD("Series II SCSI Controller", GVPIISCSI)
140 PROD("Series II SCSI Controller", GVPIISCSI_2)
141 PROD("Series II RAM", GVPIIRAM)
142 PROD("GFORCE 040 with SCSI Controller", GFORCE_040_SCSI)
143 PROD("IV-24 Graphics Board", GVPIV_24)
144
145
146
147 END
148
149 BEGIN_GVP_PROD
150 GVP_PROD("GFORCE 040", GFORCE_040)
151 GVP_PROD("GFORCE 040 with SCSI controller", GFORCE_040_SCSI)
152 GVP_PROD("A1291 SCSI controller", A1291_SCSI)
153 GVP_PROD("COMBO 030 R4", COMBO_R4)
154 GVP_PROD("COMBO 030 R4 with SCSI controller", COMBO_R4_SCSI)
155 GVP_PROD("Phone Pak", PHONEPAK)
156 GVP_PROD("IO-Extender", IOEXT)
157 GVP_PROD("GFORCE 030", GFORCE_030)
158 GVP_PROD("GFORCE 030 with SCSI controller", GFORCE_030_SCSI)
159 GVP_PROD("A530", A530)
160 GVP_PROD("A530 with SCSI", A530_SCSI)
161 GVP_PROD("COMBO 030 R3", COMBO_R3)
162 GVP_PROD("COMBO 030 R3 with SCSI controller", COMBO_R3_SCSI)
163 GVP_PROD("SERIES-II SCSI controller", SERIESII)
164 END
165
166 BEGIN_PROD(PPI)
167 PROD("Mercury Turbo Board", MERCURY)
168 PROD("PP&S A3000 68040 Turbo Board", PPS_A3000_040)
169 PROD("PP&S A2000 68040 Turbo Board", PPS_A2000_040)
170 PROD("Zeus SCSI Controller", ZEUS)
171 PROD("PP&S A500 68040 Turbo Board", PPS_A500_040)
172 END
173
174 BEGIN_PROD(BSC)
175 PROD("ALF 3 SCSI Controller", ALF_3_SCSI)
176 END
177
178 BEGIN_PROD(C_LTD)
179 PROD("Kronos SCSI Controller", KRONOS_SCSI)
180 END
181
182 BEGIN_PROD(JOCHHEIM)
183 PROD("Jochheim RAM", JOCHHEIM_RAM)
184 END
185
186 BEGIN_PROD(CHECKPOINT)
187 PROD("Serial Solution", SERIAL_SOLUTION)
188 END
189
190 BEGIN_PROD(GOLEM)
191 PROD("Golem SCSI-II Controller", GOLEM_SCSI_II)
192 END
193
194 BEGIN_PROD(HARDITAL_SYNTHES)
195 PROD("SCSI Controller", HARDITAL_SCSI)
196 END
197
198 BEGIN_PROD(BSC2)
199 PROD("Oktagon 2008 SCSI Controller", OKTAGON_SCSI)
200 PROD("Tandem", TANDEM)
201 PROD("Oktagon 2008 RAM", OKTAGON_RAM)
202 PROD("Alfa Data MultiFace I", MULTIFACE_I)
203 PROD("Alfa Data MultiFace II", MULTIFACE_II)
204 PROD("Alfa Data MultiFace III", MULTIFACE_III)
205 PROD("ISDN Master", ISDN_MASTER)
206 END
207
208 BEGIN_PROD(ADV_SYS_SOFT)
209 PROD("Nexus SCSI Controller", NEXUS_SCSI)
210 PROD("Nexus RAM", NEXUS_RAM)
211 END
212
213 BEGIN_PROD(IVS)
214 PROD("Trumpcard 500 SCSI Controller", TRUMPCARD_500)
215 PROD("Trumpcard SCSI Controller", TRUMPCARD)
216 PROD("Vector SCSI Controller", VECTOR)
217 END
218
219 BEGIN_PROD(XPERT_PRODEV)
220 PROD("Merlin Graphics Board (RAM)", MERLIN_RAM)
221 PROD("Merlin Graphics Board (REG)", MERLIN_REG)
222 END
223
224 BEGIN_PROD(HYDRA_SYSTEMS)
225 PROD("Amiganet Board", AMIGANET)
226 END
227
228 BEGIN_PROD(DIG_MICRONICS)
229 PROD("DMI Resolver Graphics Board", DMI_RESOLVER)
230 END
231
232 BEGIN_PROD(HELFRICH1)
233 PROD("Rainbow3 Graphics Board", RAINBOW3)
234 END
235
236 BEGIN_PROD(SW_RESULT_ENTS)
237 PROD("GG2+ Bus Converter", GG2PLUS)
238 END
239
240 BEGIN_PROD(VILLAGE_TRONIC)
241 PROD("Ariadne Ethernet Card", ARIADNE)
242 PROD("Picasso II Graphics Board (RAM)", PICASSO_II_RAM)
243 PROD("Picasso II Graphics Board (REG)", PICASSO_II_REG)
244 END
245
246 BEGIN_PROD(UTILITIES_ULTD)
247 PROD("Emplant Deluxe SCSI Controller", EMPLANT_DELUXE)
248 PROD("Emplant Deluxe SCSI Controller", EMPLANT_DELUXE2)
249 END
250
251 BEGIN_PROD(MTEC)
252 PROD("68030 Turbo Board", MTEC_68030)
253 PROD("T1230/28 Turbo Board", MTEC_T1230)
254 END
255
256 BEGIN_PROD(GVP2)
257 PROD("Spectrum Graphics Board (RAM)", SPECTRUM_RAM)
258 PROD("Spectrum Graphics Board (REG)", SPECTRUM_REG)
259 END
260
261 BEGIN_PROD(HELFRICH2)
262 PROD("Piccolo Graphics Board (RAM)", PICCOLO_RAM)
263 PROD("Piccolo Graphics Board (REG)", PICCOLO_REG)
264 PROD("PeggyPlus MPEG Decoder Board", PEGGY_PLUS)
265 PROD("SD64 Graphics Board (RAM)", SD64_RAM)
266 PROD("SD64 Graphics Board (REG)", SD64_REG)
267 END
268
269 BEGIN_PROD(MACROSYSTEMS)
270 PROD("Warp Engine SCSI Controller", WARP_ENGINE)
271 END
272
273 BEGIN_PROD(HARMS_PROF)
274 PROD("3500 Turbo board", 3500_TURBO)
275 END
276
277 BEGIN_PROD(VORTEX)
278 PROD("Golden Gate 80386 Board", GOLDEN_GATE_386)
279 PROD("Golden Gate RAM", GOLDEN_GATE_RAM)
280 PROD("Golden Gate 80486 Board", GOLDEN_GATE_486)
281 END
282
283 BEGIN_PROD(DATAFLYER)
284 PROD("4000SX SCSI Controller", DATAFLYER_4000SX)
285 END
286
287 BEGIN_PROD(PHASE5)
288 PROD("FastLane RAM", FASTLANE_RAM)
289 PROD("FastLane/Blizzard 1230-II SCSI Controller", FASTLANE_SCSI)
290 PROD("Blizzard 1230-III Turbo Board", BLIZZARD_1230_III)
291 PROD("Blizzard 1230-IV Turbo Board", BLIZZARD_1230_IV)
292 PROD("CyberVision64 Graphics Board", CYBERVISION)
293 END
294
295 BEGIN_PROD(APOLLO)
296 PROD("AT-Apollo", AT_APOLLO)
297 PROD("Turbo Board", APOLLO_TURBO)
298 END
299
300 BEGIN_PROD(UWE_GERLACH)
301 PROD("RAM/ROM", UG_RAM_ROM)
302 END
303
304 BEGIN_PROD(MACROSYSTEMS2)
305 PROD("Maestro", MAESTRO)
306 PROD("VLab", VLAB)
307 PROD("Maestro Pro", MAESTRO_PRO)
308 PROD("Retina Z2 Graphics Board", RETINA_Z2)
309 PROD("MultiEvolution", MULTI_EVOLUTION)
310 PROD("Retina Z3 Graphics Board", RETINA_Z3)
311 END
312
313 BEGIN_MANUF
314 MANUF("Memphis", MEMPHIS)
315 MANUF("Commodore", COMMODORE2)
316 MANUF("Commodore", COMMODORE)
317 MANUF("Cardco", CARDCO)
318 MANUF("MicroBotics", MICROBOTICS)
319 MANUF("ASDG", ASDG)
320 MANUF("University of Lowell", UNIV_OF_LOWELL)
321 MANUF("Ameristar", AMERISTAR)
322 MANUF("Supra", SUPRA)
323 MANUF("CSA", CSA)
324 MANUF("Power Computing", POWER_COMPUTING)
325 MANUF("Great Valley Products", GVP)
326 MANUF("Progressive Peripherals", PPI)
327 MANUF("BSC", BSC)
328 MANUF("C Ltd.", C_LTD)
329 MANUF("Jochheim", JOCHHEIM)
330 MANUF("Checkpoint Technologies", CHECKPOINT)
331 MANUF("Golem", GOLEM)
332 MANUF("Hardital Synthesis", HARDITAL_SYNTHES)
333 MANUF("BSC", BSC2)
334 MANUF("Advanced Systems & Software", ADV_SYS_SOFT)
335 MANUF("IVS", IVS)
336 MANUF("XPert/ProDev", XPERT_PRODEV)
337 MANUF("Hydra Systems", HYDRA_SYSTEMS)
338 MANUF("Digital Micronics", DIG_MICRONICS)
339 MANUF("Helfrich", HELFRICH1)
340 MANUF("Software Result Enterprises", SW_RESULT_ENTS)
341 MANUF("Village Tronic", VILLAGE_TRONIC)
342 MANUF("Utilities Unlimited", UTILITIES_ULTD)
343 MANUF("MTEC", MTEC)
344 MANUF("Great Valley Products", GVP2)
345 MANUF("Helfrich", HELFRICH2)
346 MANUF("MacroSystems", MACROSYSTEMS)
347 MANUF("Harms Professional", HARMS_PROF)
348 MANUF("Vortex", VORTEX)
349 MANUF("DataFlyer", DATAFLYER)
350 MANUF("Phase5", PHASE5)
351 MANUF("Apollo", APOLLO)
352 MANUF("Uwe Gerlach", UWE_GERLACH)
353 MANUF("MacroSystems", MACROSYSTEMS2)
354 END
355
356 #define NUM_MANUF (sizeof(Manufacturers)/sizeof(struct Manufacturer))
357 #define NUM_GVP_PROD (sizeof(Ext_Prod_GVP)/sizeof(struct GVP_Product))
358
359 #endif
360
361
362
363
364
365
366 static u_long BoardPartFlags[NUM_AUTO] = { 0, };
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393 int zorro_find(int manuf, int prod, int part, int index)
394 {
395 int key;
396 struct ConfigDev *cd;
397
398 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
399 return(0);
400
401 if ((part < 0) || (part > 31)) {
402 printk("zorro_find: bad part %d\n", part);
403 return(0);
404 }
405
406 for (key = index + 1; key <= boot_info.bi_amiga.num_autocon; key++) {
407 cd = &boot_info.bi_amiga.autocon[key-1];
408 if ((cd->cd_Rom.er_Manufacturer == manuf) &&
409 (cd->cd_Rom.er_Product == prod) &&
410 !(BoardPartFlags[key-1] & (1<<part)))
411 break;
412 }
413 return(key <= boot_info.bi_amiga.num_autocon ? key : 0);
414 }
415
416
417
418
419
420
421 struct ConfigDev *zorro_get_board(int key)
422 {
423 struct ConfigDev *cd = NULL;
424
425 if ((key < 1) || (key > boot_info.bi_amiga.num_autocon))
426 printk("zorro_get_board: bad key %d\n", key);
427 else
428 cd = &boot_info.bi_amiga.autocon[key-1];
429
430 return(cd);
431 }
432
433
434
435
436
437
438 void zorro_config_board(int key, int part)
439 {
440 if ((key < 1) || (key > boot_info.bi_amiga.num_autocon))
441 printk("zorro_config_board: bad key %d\n", key);
442 else if ((part < 0) || (part > 31))
443 printk("zorro_config_board: bad part %d\n", part);
444 else
445 BoardPartFlags[key-1] |= 1<<part;
446 }
447
448
449
450
451
452
453
454
455 void zorro_unconfig_board(int key, int part)
456 {
457 if ((key < 1) || (key > boot_info.bi_amiga.num_autocon))
458 printk("zorro_unconfig_board: bad key %d\n", key);
459 else if ((part < 0) || (part > 31))
460 printk("zorro_unconfig_board: bad part %d\n", part);
461 else
462 BoardPartFlags[key-1] &= ~(1<<part);
463 }
464
465
466 #ifdef CONFIG_ZORRO
467
468
469
470
471
472
473
474
475
476 static int identify(int devnum, char *buf)
477 {
478 struct ConfigDev *cd;
479 int manuf, prod;
480 u_long addr, size;
481 char *manufname, *prodname, *is_mem;
482 char zorro, mag, configured;
483 int identified = 0;
484 int i, j, k, len = 0;
485 enum GVP_ident epc;
486
487 cd = &boot_info.bi_amiga.autocon[devnum];
488 manuf = cd->cd_Rom.er_Manufacturer;
489 prod = cd->cd_Rom.er_Product;
490 addr = (u_long)cd->cd_BoardAddr;
491 size = cd->cd_BoardSize;
492 configured = BoardPartFlags[devnum] ? '*' : ' ';
493 manufname = prodname = "<UNKNOWN>";
494
495 for (i = 0; i < NUM_MANUF; i++)
496 if (Manufacturers[i].ID == manuf) {
497 manufname = Manufacturers[i].Name;
498 for (j = 0; j < Manufacturers[i].NumProd; j++)
499 if (Manufacturers[i].Products[j].ID == prod)
500 if ((manuf != MANUF_GVP) || (prod != PROD_GVP)) {
501 prodname = Manufacturers[i].Products[j].Name;
502 identified = 1;
503 break;
504 } else {
505 epc = *(enum GVP_ident *)ZTWO_VADDR(addr+0x8000) &
506 GVP_EPCMASK;
507 for (k = 0; k < NUM_GVP_PROD; k++)
508 if (Ext_Prod_GVP[k].ID == epc) {
509 prodname = Ext_Prod_GVP[k].Name;
510 identified = 1;
511 break;
512 }
513 }
514 break;
515 }
516
517 switch (cd->cd_Rom.er_Type & ERT_TYPEMASK) {
518 case ERT_ZORROII:
519 zorro = '2';
520 break;
521 case ERT_ZORROIII:
522 zorro = '3';
523 break;
524 default:
525 zorro = '?';
526 break;
527 }
528 if (size & 0xfffff) {
529 size >>= 10;
530 mag = 'K';
531 } else {
532 size >>= 20;
533 mag = 'M';
534 }
535 if (cd->cd_Rom.er_Type & ERTF_MEMLIST)
536 is_mem = " MEM";
537 else
538 is_mem = "";
539
540 if (identified)
541 len = sprintf(buf, " %c0x%08lx: %s %s (Z%c, %ld%c%s)\n", configured, addr,
542 manufname, prodname, zorro, size, mag, is_mem);
543 else if (manuf == MANUF_HACKER)
544 len = sprintf(buf, " 0x%08lx: Hacker Test Board 0x%02x (Z%c, %ld%c%s)\n",
545 addr, prod, zorro, size, mag, is_mem);
546 else {
547 len = sprintf(buf, " 0x%08lx: [%04x:%02x] made by %s (Z%c, %ld%c%s)\n",
548 addr, manuf, prod, manufname, zorro, size, mag, is_mem);
549 len += sprintf(buf+len, " Please report this unknown device to "
550 "Geert.Uytterhoeven@cs.kuleuven.ac.be\n");
551 }
552 return(len);
553 }
554
555
556
557
558
559
560 void zorro_identify(void)
561 {
562 int i;
563 char tmp[160];
564
565 if (!AMIGAHW_PRESENT(ZORRO))
566 return;
567
568 printk("Probing AutoConfig expansion device(s):\n");
569 for (i = 0; i < boot_info.bi_amiga.num_autocon; i++) {
570 identify(i, tmp);
571 printk(tmp);
572 }
573 if (!boot_info.bi_amiga.num_autocon)
574 printk("No AutoConfig expansion devices present.\n");
575 }
576
577
578
579
580
581
582 int zorro_get_list(char *buffer)
583 {
584 int i, j, len = 0;
585 char tmp[160];
586
587 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) {
588 len = sprintf(buffer, "AutoConfig expansion devices:\n");
589 for (i = 0; i < boot_info.bi_amiga.num_autocon; i++) {
590 j = identify(i, tmp);
591 if (len+j >= 4075) {
592 len += sprintf(buffer+len, "4K limit reached!\n");
593 break;
594 }
595 strcpy(buffer+len, tmp);
596 len += j;
597 }
598 }
599 return(len);
600 }
601
602 #endif
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618 u_long zorro_unused_z2ram[4] = { 0, 0, 0, 0 };
619
620
621 static void mark_region(u_long addr, u_long size, int flag)
622 {
623 u_long start, end, chunk;
624
625 if (flag) {
626 start = (addr+Z2RAM_CHUNKMASK) & ~Z2RAM_CHUNKMASK;
627 end = (addr+size) & ~Z2RAM_CHUNKMASK;
628 } else {
629 start = addr & ~Z2RAM_CHUNKMASK;
630 end = (addr+size+Z2RAM_CHUNKMASK) & ~Z2RAM_CHUNKMASK;
631 }
632 if (end <= Z2RAM_START || start >= Z2RAM_END)
633 return;
634 start = start < Z2RAM_START ? 0x00000000 : start-Z2RAM_START;
635 end = end > Z2RAM_END ? Z2RAM_SIZE : end-Z2RAM_START;
636 while (start < end) {
637 chunk = start>>Z2RAM_CHUNKSHIFT;
638 if (flag)
639 set_bit( chunk, zorro_unused_z2ram );
640 else
641 clear_bit( chunk, zorro_unused_z2ram );
642 start += Z2RAM_CHUNKSIZE;
643 }
644 }
645
646
647
648
649
650
651 void zorro_init(void)
652 {
653 int i;
654 struct ConfigDev *cd;
655
656 if (!AMIGAHW_PRESENT(ZORRO))
657 return;
658
659
660 for (i = 0; i < boot_info.bi_amiga.num_autocon; i++) {
661 cd = &boot_info.bi_amiga.autocon[i];
662 if (cd->cd_Rom.er_Type & ERTF_MEMLIST)
663 mark_region((u_long)cd->cd_BoardAddr, cd->cd_BoardSize, 1);
664 }
665
666 for (i = 0; i < boot_info.num_memory; i++)
667 mark_region(boot_info.memory[i].addr, boot_info.memory[i].size, 0);
668 }