OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [m68k/] [amiga/] [zorro.c] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1623 jcastillo
/*
2
 *    linux/arch/m68k/amiga/zorro.c
3
 *
4
 *    Copyright (C) 1995 Geert Uytterhoeven
5
 *
6
 *    This file is subject to the terms and conditions of the GNU General Public
7
 *    License.  See the file COPYING in the main directory of this archive
8
 *    for more details.
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
    *    Zorro Expansion Device Manufacturers and Products
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
    *    Macro's to make life easier
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
    *    Known Zorro Expansion Devices
67
    *
68
    *    Warning: Make sure the Manufacturer and Product names are not too
69
    *             long (max. 80 characters per board identification line)
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("A2000 68030 Turbo Board", GVP_A2000_030)
143
   PROD("GFORCE 040 with SCSI Controller", GFORCE_040_SCSI)
144
   PROD("IV-24 Graphics Board", GVPIV_24)
145
/*
146
   PROD("I/O Extender", GVPIO_EXT)
147
*/
148
END
149
 
150
BEGIN_GVP_PROD
151
   GVP_PROD("GFORCE 040", GFORCE_040)
152
   GVP_PROD("GFORCE 040 with SCSI controller", GFORCE_040_SCSI)
153
   GVP_PROD("A1291 SCSI controller", A1291_SCSI)
154
   GVP_PROD("COMBO 030 R4", COMBO_R4)
155
   GVP_PROD("COMBO 030 R4 with SCSI controller", COMBO_R4_SCSI)
156
   GVP_PROD("Phone Pak", PHONEPAK)
157
   GVP_PROD("IO-Extender", IOEXT)
158
   GVP_PROD("GFORCE 030", GFORCE_030)
159
   GVP_PROD("GFORCE 030 with SCSI controller", GFORCE_030_SCSI)
160
   GVP_PROD("A530", A530)
161
   GVP_PROD("A530 with SCSI", A530_SCSI)
162
   GVP_PROD("COMBO 030 R3", COMBO_R3)
163
   GVP_PROD("COMBO 030 R3 with SCSI controller", COMBO_R3_SCSI)
164
   GVP_PROD("SERIES-II SCSI controller", SERIESII)
165
END
166
 
167
BEGIN_PROD(PPI)
168
   PROD("Mercury Turbo Board", MERCURY)
169
   PROD("PP&S A3000 68040 Turbo Board", PPS_A3000_040)
170
   PROD("PP&S A2000 68040 Turbo Board", PPS_A2000_040)
171
   PROD("Zeus SCSI Controller", ZEUS)
172
   PROD("PP&S A500 68040 Turbo Board", PPS_A500_040)
173
END
174
 
175
BEGIN_PROD(BSC)
176
   PROD("ALF 3 SCSI Controller", ALF_3_SCSI)
177
END
178
 
179
BEGIN_PROD(C_LTD)
180
   PROD("Kronos SCSI Controller", KRONOS_SCSI)
181
END
182
 
183
BEGIN_PROD(JOCHHEIM)
184
   PROD("Jochheim RAM", JOCHHEIM_RAM)
185
END
186
 
187
BEGIN_PROD(CHECKPOINT)
188
   PROD("Serial Solution", SERIAL_SOLUTION)
189
END
190
 
191
BEGIN_PROD(GOLEM)
192
   PROD("Golem SCSI-II Controller", GOLEM_SCSI_II)
193
END
194
 
195
BEGIN_PROD(HARDITAL_SYNTHES)
196
   PROD("SCSI Controller", HARDITAL_SCSI)
197
END
198
 
199
BEGIN_PROD(HARDITAL2)
200
   PROD("TQM 68030+68882 Turbo Board", TQM)
201
END
202
 
203
BEGIN_PROD(BSC2)
204
   PROD("Oktagon 2008 SCSI Controller", OKTAGON_SCSI)
205
   PROD("Tandem", TANDEM)
206
   PROD("Oktagon 2008 RAM", OKTAGON_RAM)
207
   PROD("Alfa Data MultiFace I", MULTIFACE_I)
208
   PROD("Alfa Data MultiFace II", MULTIFACE_II)
209
   PROD("Alfa Data MultiFace III", MULTIFACE_III)
210
   PROD("ISDN Master", ISDN_MASTER)
211
END
212
 
213
BEGIN_PROD(ADV_SYS_SOFT)
214
   PROD("Nexus SCSI Controller", NEXUS_SCSI)
215
   PROD("Nexus RAM", NEXUS_RAM)
216
END
217
 
218
BEGIN_PROD(IVS)
219
   PROD("Trumpcard 500 SCSI Controller", TRUMPCARD_500)
220
   PROD("Trumpcard SCSI Controller", TRUMPCARD)
221
   PROD("Vector SCSI Controller", VECTOR)
222
END
223
 
224
BEGIN_PROD(XPERT_PRODEV)
225
   PROD("Merlin Graphics Board (RAM)", MERLIN_RAM)
226
   PROD("Merlin Graphics Board (REG)", MERLIN_REG)
227
END
228
 
229
BEGIN_PROD(HYDRA_SYSTEMS)
230
   PROD("Amiganet Board", AMIGANET)
231
END
232
 
233
BEGIN_PROD(DIG_MICRONICS)
234
   PROD("DMI Resolver Graphics Board", DMI_RESOLVER)
235
END
236
 
237
BEGIN_PROD(HELFRICH1)
238
   PROD("Rainbow3 Graphics Board", RAINBOW3)
239
END
240
 
241
BEGIN_PROD(SW_RESULT_ENTS)
242
   PROD("GG2+ Bus Converter", GG2PLUS)
243
END
244
 
245
BEGIN_PROD(VILLAGE_TRONIC)
246
   PROD("Ariadne Ethernet Card", ARIADNE)
247
   PROD("Picasso II Graphics Board (RAM)", PICASSO_II_RAM)
248
   PROD("Picasso II Graphics Board (REG)", PICASSO_II_REG)
249
END
250
 
251
BEGIN_PROD(UTILITIES_ULTD)
252
   PROD("Emplant Deluxe SCSI Controller", EMPLANT_DELUXE)
253
   PROD("Emplant Deluxe SCSI Controller", EMPLANT_DELUXE2)
254
END
255
 
256
BEGIN_PROD(MTEC)
257
   PROD("68030 Turbo Board", MTEC_68030)
258
   PROD("T1230/28 Turbo Board", MTEC_T1230)
259
END
260
 
261
BEGIN_PROD(GVP2)
262
   PROD("Spectrum Graphics Board (RAM)", SPECTRUM_RAM)
263
   PROD("Spectrum Graphics Board (REG)", SPECTRUM_REG)
264
END
265
 
266
BEGIN_PROD(HELFRICH2)
267
   PROD("Piccolo Graphics Board (RAM)", PICCOLO_RAM)
268
   PROD("Piccolo Graphics Board (REG)", PICCOLO_REG)
269
   PROD("PeggyPlus MPEG Decoder Board", PEGGY_PLUS)
270
   PROD("SD64 Graphics Board (RAM)", SD64_RAM)
271
   PROD("SD64 Graphics Board (REG)", SD64_REG)
272
END
273
 
274
BEGIN_PROD(MACROSYSTEMS)
275
   PROD("Warp Engine SCSI Controller", WARP_ENGINE)
276
END
277
 
278
BEGIN_PROD(HARMS_PROF)
279
   PROD("3500 Turbo board", 3500_TURBO)
280
END
281
 
282
BEGIN_PROD(VORTEX)
283
   PROD("Golden Gate 80386 Board", GOLDEN_GATE_386)
284
   PROD("Golden Gate RAM", GOLDEN_GATE_RAM)
285
   PROD("Golden Gate 80486 Board", GOLDEN_GATE_486)
286
END
287
 
288
BEGIN_PROD(DATAFLYER)
289
   PROD("4000SX SCSI Controller", DATAFLYER_4000SX)
290
END
291
 
292
BEGIN_PROD(PHASE5)
293
   PROD("FastLane RAM", FASTLANE_RAM)
294
   PROD("FastLane/Blizzard 1230-II SCSI Controller", FASTLANE_SCSI)
295
   PROD("CyberStorm Fast SCSI-II Controller", CYBERSTORM_SCSI)
296
   PROD("Blizzard 1230-III Turbo Board", BLIZZARD_1230_III)
297
   PROD("Blizzard 1230-IV Turbo Board", BLIZZARD_1230_IV)
298
   PROD("CyberVision64 Graphics Board", CYBERVISION)
299
END
300
 
301
BEGIN_PROD(APOLLO)
302
   PROD("AT-Apollo", AT_APOLLO)
303
   PROD("Turbo Board", APOLLO_TURBO)
304
END
305
 
306
BEGIN_PROD(UWE_GERLACH)
307
   PROD("RAM/ROM", UG_RAM_ROM)
308
END
309
 
310
BEGIN_PROD(MACROSYSTEMS2)
311
   PROD("Maestro", MAESTRO)
312
   PROD("VLab", VLAB)
313
   PROD("Maestro Pro", MAESTRO_PRO)
314
   PROD("Retina Z2 Graphics Board", RETINA_Z2)
315
   PROD("MultiEvolution", MULTI_EVOLUTION)
316
   PROD("Retina Z3 Graphics Board", RETINA_Z3)
317
   PROD("Falcon '040 Turbo Board", FALCON_040)
318
END
319
 
320
BEGIN_MANUF
321
   MANUF("Memphis", MEMPHIS)
322
   MANUF("Commodore", COMMODORE2)
323
   MANUF("Commodore", COMMODORE)
324
   MANUF("Cardco", CARDCO)
325
   MANUF("MicroBotics", MICROBOTICS)
326
   MANUF("ASDG", ASDG)
327
   MANUF("University of Lowell", UNIV_OF_LOWELL)
328
   MANUF("Ameristar", AMERISTAR)
329
   MANUF("Supra", SUPRA)
330
   MANUF("CSA", CSA)
331
   MANUF("Power Computing", POWER_COMPUTING)
332
   MANUF("Great Valley Products", GVP)
333
   MANUF("Progressive Peripherals", PPI)
334
   MANUF("BSC", BSC)
335
   MANUF("C Ltd.", C_LTD)
336
   MANUF("Jochheim", JOCHHEIM)
337
   MANUF("Checkpoint Technologies", CHECKPOINT)
338
   MANUF("Golem", GOLEM)
339
   MANUF("Hardital Synthesis", HARDITAL_SYNTHES)
340
   MANUF("Hardital Synthesis", HARDITAL2)
341
   MANUF("BSC", BSC2)
342
   MANUF("Advanced Systems & Software", ADV_SYS_SOFT)
343
   MANUF("IVS", IVS)
344
   MANUF("XPert/ProDev", XPERT_PRODEV)
345
   MANUF("Hydra Systems", HYDRA_SYSTEMS)
346
   MANUF("Digital Micronics", DIG_MICRONICS)
347
   MANUF("Helfrich", HELFRICH1)
348
   MANUF("Software Result Enterprises", SW_RESULT_ENTS)
349
   MANUF("Village Tronic", VILLAGE_TRONIC)
350
   MANUF("Utilities Unlimited", UTILITIES_ULTD)
351
   MANUF("MTEC", MTEC)
352
   MANUF("Great Valley Products", GVP2)
353
   MANUF("Helfrich", HELFRICH2)
354
   MANUF("MacroSystems", MACROSYSTEMS)
355
   MANUF("Harms Professional", HARMS_PROF)
356
   MANUF("Vortex", VORTEX)
357
   MANUF("DataFlyer", DATAFLYER)
358
   MANUF("Phase5", PHASE5)
359
   MANUF("Apollo", APOLLO)
360
   MANUF("Uwe Gerlach", UWE_GERLACH)
361
   MANUF("MacroSystems", MACROSYSTEMS2)
362
END
363
 
364
#define NUM_MANUF (sizeof(Manufacturers)/sizeof(struct Manufacturer))
365
#define NUM_GVP_PROD (sizeof(Ext_Prod_GVP)/sizeof(struct GVP_Product))
366
 
367
#endif /* CONFIG_ZORRO */
368
 
369
 
370
   /*
371
    *    Configured Expansion Devices
372
    */
373
 
374
static u_long BoardPartFlags[NUM_AUTO] = { 0, };
375
 
376
 
377
   /*
378
    *    Find the key for the next unconfigured expansion device of a specific
379
    *    type.
380
    *
381
    *    Part is a device specific number (0 <= part <= 31) to allow for the
382
    *    independent configuration of independent parts of an expansion board.
383
    *    Thanks to Jes Soerensen for this idea!
384
    *
385
    *    Index is used to specify the first board in the autocon list
386
    *    to be tested. It was inserted in order to solve the problem
387
    *    with the GVP boards that uses the same product code, but
388
    *    it should help if there are other companies uses the same
389
    *    method as GVP. Drivers for boards which are not using this
390
    *    method does not need to think of this - just set index = 0.
391
    *
392
    *    Example:
393
    *
394
    *       while ((key = zorro_find(MY_MANUF, MY_PROD, MY_PART, 0))) {
395
    *          cd = zorro_get_board(key);
396
    *          initialise_this_board;
397
    *          zorro_config_board(key, MY_PART);
398
    *       }
399
    */
400
 
401
int zorro_find(int manuf, int prod, int part, int index)
402
{
403
   int key;
404
   struct ConfigDev *cd;
405
 
406
   if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
407
      return(0);
408
 
409
   if ((part < 0) || (part > 31)) {
410
      printk("zorro_find: bad part %d\n", part);
411
      return(0);
412
   }
413
 
414
   for (key = index + 1; key <= boot_info.bi_amiga.num_autocon; key++) {
415
      cd = &boot_info.bi_amiga.autocon[key-1];
416
      if ((cd->cd_Rom.er_Manufacturer == manuf) &&
417
          (cd->cd_Rom.er_Product == prod) &&
418
          !(BoardPartFlags[key-1] & (1<<part)))
419
         break;
420
   }
421
   return(key <= boot_info.bi_amiga.num_autocon ? key : 0);
422
}
423
 
424
 
425
   /*
426
    *    Get the board for a specified key
427
    */
428
 
429
struct ConfigDev *zorro_get_board(int key)
430
{
431
   struct ConfigDev *cd = NULL;
432
 
433
   if ((key < 1) || (key > boot_info.bi_amiga.num_autocon))
434
      printk("zorro_get_board: bad key %d\n", key);
435
   else
436
      cd = &boot_info.bi_amiga.autocon[key-1];
437
 
438
   return(cd);
439
}
440
 
441
 
442
   /*
443
    *    Mark a part of a board as configured
444
    */
445
 
446
void zorro_config_board(int key, int part)
447
{
448
   if ((key < 1) || (key > boot_info.bi_amiga.num_autocon))
449
      printk("zorro_config_board: bad key %d\n", key);
450
   else if ((part < 0) || (part > 31))
451
      printk("zorro_config_board: bad part %d\n", part);
452
   else
453
      BoardPartFlags[key-1] |= 1<<part;
454
}
455
 
456
 
457
   /*
458
    *    Mark a part of a board as unconfigured
459
    *
460
    *    This function is mainly intended for the unloading of LKMs
461
    */
462
 
463
void zorro_unconfig_board(int key, int part)
464
{
465
   if ((key < 1) || (key > boot_info.bi_amiga.num_autocon))
466
      printk("zorro_unconfig_board: bad key %d\n", key);
467
   else if ((part < 0) || (part > 31))
468
      printk("zorro_unconfig_board: bad part %d\n", part);
469
   else
470
      BoardPartFlags[key-1] &= ~(1<<part);
471
}
472
 
473
 
474
#ifdef CONFIG_ZORRO
475
 
476
   /*
477
    *    Identify an AutoConfig Expansion Device
478
    *
479
    *    If the board was configured by a Linux/m68k driver, an asterisk will
480
    *    be printed before the board address (except for unknown and `Hacker
481
    *    Test' boards).
482
    */
483
 
484
static int identify(int devnum, char *buf)
485
{
486
   struct ConfigDev *cd;
487
   int manuf, prod;
488
   u_long addr, size;
489
   char *manufname, *prodname, *is_mem;
490
   char zorro, mag, configured;
491
   int identified = 0;
492
   int i, j, k, len = 0;
493
   enum GVP_ident epc;
494
 
495
   cd = &boot_info.bi_amiga.autocon[devnum];
496
   manuf = cd->cd_Rom.er_Manufacturer;
497
   prod = cd->cd_Rom.er_Product;
498
   addr = (u_long)cd->cd_BoardAddr;
499
   size = cd->cd_BoardSize;
500
   configured = BoardPartFlags[devnum] ? '*' : ' ';
501
   manufname = prodname = "<UNKNOWN>";
502
 
503
   for (i = 0; i < NUM_MANUF; i++)
504
      if (Manufacturers[i].ID == manuf) {
505
         manufname = Manufacturers[i].Name;
506
         for (j = 0; j < Manufacturers[i].NumProd; j++)
507
            if (Manufacturers[i].Products[j].ID == prod)
508
               if ((manuf != MANUF_GVP) || (prod != PROD_GVP)) {
509
                  prodname = Manufacturers[i].Products[j].Name;
510
                  identified = 1;
511
                  break;
512
               } else {
513
                  epc = *(enum GVP_ident *)ZTWO_VADDR(addr+0x8000) &
514
                        GVP_EPCMASK;
515
                  for (k = 0; k < NUM_GVP_PROD; k++)
516
                     if (Ext_Prod_GVP[k].ID == epc) {
517
                        prodname = Ext_Prod_GVP[k].Name;
518
                        identified = 1;
519
                        break;
520
                     }
521
               }
522
         break;
523
      }
524
 
525
   switch (cd->cd_Rom.er_Type & ERT_TYPEMASK) {
526
      case ERT_ZORROII:
527
         zorro = '2';
528
         break;
529
      case ERT_ZORROIII:
530
         zorro = '3';
531
         break;
532
      default:
533
         zorro = '?';
534
         break;
535
   }
536
   if (size & 0xfffff) {
537
      size >>= 10;
538
      mag = 'K';
539
   } else {
540
      size >>= 20;
541
      mag = 'M';
542
   }
543
   if (cd->cd_Rom.er_Type & ERTF_MEMLIST)
544
      is_mem = " MEM";
545
   else
546
      is_mem = "";
547
 
548
   if (identified)
549
      len = sprintf(buf, " %c0x%08lx: %s %s (Z%c, %ld%c%s)\n", configured, addr,
550
                    manufname, prodname, zorro, size, mag, is_mem);
551
   else if (manuf == MANUF_HACKER)
552
      len = sprintf(buf, "  0x%08lx: Hacker Test Board 0x%02x (Z%c, %ld%c%s)\n",
553
                    addr, prod, zorro, size, mag, is_mem);
554
   else {
555
      len = sprintf(buf, "  0x%08lx: [%04x:%02x] made by %s (Z%c, %ld%c%s)\n",
556
                    addr, manuf, prod, manufname, zorro, size, mag, is_mem);
557
      len += sprintf(buf+len, "  Please report this unknown device to "
558
                     "Geert.Uytterhoeven@cs.kuleuven.ac.be\n");
559
   }
560
   return(len);
561
}
562
 
563
 
564
   /*
565
    *    Identify all known AutoConfig Expansion Devices
566
    */
567
 
568
void zorro_identify(void)
569
{
570
   int i;
571
   char tmp[160];
572
 
573
   if (!AMIGAHW_PRESENT(ZORRO))
574
      return;
575
 
576
   printk("Probing AutoConfig expansion device(s):\n");
577
   for (i = 0; i < boot_info.bi_amiga.num_autocon; i++) {
578
      identify(i, tmp);
579
      printk(tmp);
580
   }
581
   if (!boot_info.bi_amiga.num_autocon)
582
      printk("No AutoConfig expansion devices present.\n");
583
}
584
 
585
 
586
   /*
587
    *    Get the list of all AutoConfig Expansion Devices
588
    */
589
 
590
int zorro_get_list(char *buffer)
591
{
592
   int i, j, len = 0;
593
   char tmp[160];
594
 
595
   if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) {
596
      len = sprintf(buffer, "AutoConfig expansion devices:\n");
597
      for (i = 0; i < boot_info.bi_amiga.num_autocon; i++) {
598
         j = identify(i, tmp);
599
         if (len+j >= 4075) {
600
            len += sprintf(buffer+len, "4K limit reached!\n");
601
            break;
602
         }
603
         strcpy(buffer+len, tmp);
604
         len += j;
605
      }
606
   }
607
   return(len);
608
}
609
 
610
#endif /* CONFIG_ZORRO */
611
 
612
 
613
   /*
614
    *    Bitmask indicating portions of available Zorro II RAM that are unused
615
    *    by the system. Every bit represents a 64K chunk, for a maximum of 8MB
616
    *    (128 chunks, physical 0x00200000-0x009fffff).
617
    *
618
    *    If you want to use (= allocate) portions of this RAM, you should clear
619
    *    the corresponding bits.
620
    *
621
    *    Possible uses:
622
    *       - z2ram device
623
    *       - SCSI DMA bounce buffers
624
    */
625
 
626
u_long zorro_unused_z2ram[4] = { 0, 0, 0, 0 };
627
 
628
 
629
static void mark_region(u_long addr, u_long size, int flag)
630
{
631
   u_long start, end, chunk;
632
 
633
   if (flag) {
634
      start = (addr+Z2RAM_CHUNKMASK) & ~Z2RAM_CHUNKMASK;
635
      end = (addr+size) & ~Z2RAM_CHUNKMASK;
636
   } else {
637
      start = addr & ~Z2RAM_CHUNKMASK;
638
      end = (addr+size+Z2RAM_CHUNKMASK) & ~Z2RAM_CHUNKMASK;
639
   }
640
   if (end <= Z2RAM_START || start >= Z2RAM_END)
641
      return;
642
   start = start < Z2RAM_START ? 0x00000000 : start-Z2RAM_START;
643
   end = end > Z2RAM_END ? Z2RAM_SIZE : end-Z2RAM_START;
644
   while (start < end) {
645
      chunk = start>>Z2RAM_CHUNKSHIFT;
646
      if (flag)
647
         set_bit( chunk, zorro_unused_z2ram );
648
      else
649
         clear_bit( chunk, zorro_unused_z2ram );
650
      start += Z2RAM_CHUNKSIZE;
651
   }
652
}
653
 
654
 
655
   /*
656
    *    Initialization
657
    */
658
 
659
void zorro_init(void)
660
{
661
   int i;
662
   struct ConfigDev *cd;
663
 
664
   if (!AMIGAHW_PRESENT(ZORRO))
665
      return;
666
 
667
   /* Mark all available Zorro II memory */
668
   for (i = 0; i < boot_info.bi_amiga.num_autocon; i++) {
669
      cd = &boot_info.bi_amiga.autocon[i];
670
      if (cd->cd_Rom.er_Type & ERTF_MEMLIST)
671
         mark_region((u_long)cd->cd_BoardAddr, cd->cd_BoardSize, 1);
672
   }
673
   /* Unmark all used Zorro II memory */
674
   for (i = 0; i < boot_info.num_memory; i++)
675
      mark_region(boot_info.memory[i].addr, boot_info.memory[i].size, 0);
676
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.