This source file includes following definitions.
- amiga_parse_bootinfo
- amiga_identify
- amiga_random_get_entropy
- config_amiga
- ciab_timer_handler
- amiga_sched_init
- amiga_read_clk
- amiga_reset
- amiga_mem_console_write
- amiga_savekmsg_setup
- amiga_serial_putc
- amiga_serial_console_write
- amiga_serial_puts
- amiga_serial_console_wait_key
- amiga_serial_gets
- amiga_debug_setup
- amiga_heartbeat
- amiga_get_model
- amiga_get_hardware_list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/mm.h>
18 #include <linux/seq_file.h>
19 #include <linux/tty.h>
20 #include <linux/clocksource.h>
21 #include <linux/console.h>
22 #include <linux/rtc.h>
23 #include <linux/init.h>
24 #include <linux/vt_kern.h>
25 #include <linux/delay.h>
26 #include <linux/interrupt.h>
27 #include <linux/zorro.h>
28 #include <linux/module.h>
29 #include <linux/keyboard.h>
30
31 #include <asm/bootinfo.h>
32 #include <asm/bootinfo-amiga.h>
33 #include <asm/byteorder.h>
34 #include <asm/setup.h>
35 #include <asm/pgtable.h>
36 #include <asm/amigahw.h>
37 #include <asm/amigaints.h>
38 #include <asm/irq.h>
39 #include <asm/machdep.h>
40 #include <asm/io.h>
41
42 static unsigned long amiga_model;
43
44 unsigned long amiga_eclock;
45 EXPORT_SYMBOL(amiga_eclock);
46
47 unsigned long amiga_colorclock;
48 EXPORT_SYMBOL(amiga_colorclock);
49
50 unsigned long amiga_chipset;
51 EXPORT_SYMBOL(amiga_chipset);
52
53 unsigned char amiga_vblank;
54 EXPORT_SYMBOL(amiga_vblank);
55
56 static unsigned char amiga_psfreq;
57
58 struct amiga_hw_present amiga_hw_present;
59 EXPORT_SYMBOL(amiga_hw_present);
60
61 static char s_a500[] __initdata = "A500";
62 static char s_a500p[] __initdata = "A500+";
63 static char s_a600[] __initdata = "A600";
64 static char s_a1000[] __initdata = "A1000";
65 static char s_a1200[] __initdata = "A1200";
66 static char s_a2000[] __initdata = "A2000";
67 static char s_a2500[] __initdata = "A2500";
68 static char s_a3000[] __initdata = "A3000";
69 static char s_a3000t[] __initdata = "A3000T";
70 static char s_a3000p[] __initdata = "A3000+";
71 static char s_a4000[] __initdata = "A4000";
72 static char s_a4000t[] __initdata = "A4000T";
73 static char s_cdtv[] __initdata = "CDTV";
74 static char s_cd32[] __initdata = "CD32";
75 static char s_draco[] __initdata = "Draco";
76 static char *amiga_models[] __initdata = {
77 [AMI_500-AMI_500] = s_a500,
78 [AMI_500PLUS-AMI_500] = s_a500p,
79 [AMI_600-AMI_500] = s_a600,
80 [AMI_1000-AMI_500] = s_a1000,
81 [AMI_1200-AMI_500] = s_a1200,
82 [AMI_2000-AMI_500] = s_a2000,
83 [AMI_2500-AMI_500] = s_a2500,
84 [AMI_3000-AMI_500] = s_a3000,
85 [AMI_3000T-AMI_500] = s_a3000t,
86 [AMI_3000PLUS-AMI_500] = s_a3000p,
87 [AMI_4000-AMI_500] = s_a4000,
88 [AMI_4000T-AMI_500] = s_a4000t,
89 [AMI_CDTV-AMI_500] = s_cdtv,
90 [AMI_CD32-AMI_500] = s_cd32,
91 [AMI_DRACO-AMI_500] = s_draco,
92 };
93
94 static char amiga_model_name[13] = "Amiga ";
95
96 static void amiga_sched_init(irq_handler_t handler);
97 static void amiga_get_model(char *model);
98 static void amiga_get_hardware_list(struct seq_file *m);
99 extern void amiga_mksound(unsigned int count, unsigned int ticks);
100 static void amiga_reset(void);
101 extern void amiga_init_sound(void);
102 static void amiga_mem_console_write(struct console *co, const char *b,
103 unsigned int count);
104 #ifdef CONFIG_HEARTBEAT
105 static void amiga_heartbeat(int on);
106 #endif
107
108 static struct console amiga_console_driver = {
109 .name = "debug",
110 .flags = CON_PRINTBUFFER,
111 .index = -1,
112 };
113
114
115
116
117
118
119 static struct {
120 struct resource _ciab, _ciaa, _custom, _kickstart;
121 } mb_resources = {
122 ._ciab = {
123 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
124 },
125 ._ciaa = {
126 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
127 },
128 ._custom = {
129 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
130 },
131 ._kickstart = {
132 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
133 }
134 };
135
136 static struct resource ram_resource[NUM_MEMINFO];
137
138
139
140
141
142
143 int __init amiga_parse_bootinfo(const struct bi_record *record)
144 {
145 int unknown = 0;
146 const void *data = record->data;
147
148 switch (be16_to_cpu(record->tag)) {
149 case BI_AMIGA_MODEL:
150 amiga_model = be32_to_cpup(data);
151 break;
152
153 case BI_AMIGA_ECLOCK:
154 amiga_eclock = be32_to_cpup(data);
155 break;
156
157 case BI_AMIGA_CHIPSET:
158 amiga_chipset = be32_to_cpup(data);
159 break;
160
161 case BI_AMIGA_CHIP_SIZE:
162 amiga_chip_size = be32_to_cpup(data);
163 break;
164
165 case BI_AMIGA_VBLANK:
166 amiga_vblank = *(const __u8 *)data;
167 break;
168
169 case BI_AMIGA_PSFREQ:
170 amiga_psfreq = *(const __u8 *)data;
171 break;
172
173 case BI_AMIGA_AUTOCON:
174 #ifdef CONFIG_ZORRO
175 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
176 const struct ConfigDev *cd = data;
177 struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++];
178 dev->rom = cd->cd_Rom;
179 dev->slotaddr = be16_to_cpu(cd->cd_SlotAddr);
180 dev->slotsize = be16_to_cpu(cd->cd_SlotSize);
181 dev->boardaddr = be32_to_cpu(cd->cd_BoardAddr);
182 dev->boardsize = be32_to_cpu(cd->cd_BoardSize);
183 } else
184 pr_warn("amiga_parse_bootinfo: too many AutoConfig devices\n");
185 #endif
186 break;
187
188 case BI_AMIGA_SERPER:
189
190 break;
191
192 default:
193 unknown = 1;
194 }
195 return unknown;
196 }
197
198
199
200
201
202 static void __init amiga_identify(void)
203 {
204
205 if (amiga_eclock == 0)
206 amiga_eclock = 709379;
207
208 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
209
210 pr_info("Amiga hardware found: ");
211 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
212 pr_cont("[%s] ", amiga_models[amiga_model-AMI_500]);
213 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
214 }
215
216 switch (amiga_model) {
217 case AMI_UNKNOWN:
218 goto Generic;
219
220 case AMI_600:
221 case AMI_1200:
222 AMIGAHW_SET(A1200_IDE);
223 AMIGAHW_SET(PCMCIA);
224 case AMI_500:
225 case AMI_500PLUS:
226 case AMI_1000:
227 case AMI_2000:
228 case AMI_2500:
229 AMIGAHW_SET(A2000_CLK);
230 goto Generic;
231
232 case AMI_3000:
233 case AMI_3000T:
234 AMIGAHW_SET(AMBER_FF);
235 AMIGAHW_SET(MAGIC_REKICK);
236
237 case AMI_3000PLUS:
238 AMIGAHW_SET(A3000_SCSI);
239 AMIGAHW_SET(A3000_CLK);
240 AMIGAHW_SET(ZORRO3);
241 goto Generic;
242
243 case AMI_4000T:
244 AMIGAHW_SET(A4000_SCSI);
245
246 case AMI_4000:
247 AMIGAHW_SET(A4000_IDE);
248 AMIGAHW_SET(A3000_CLK);
249 AMIGAHW_SET(ZORRO3);
250 goto Generic;
251
252 case AMI_CDTV:
253 case AMI_CD32:
254 AMIGAHW_SET(CD_ROM);
255 AMIGAHW_SET(A2000_CLK);
256 goto Generic;
257
258 Generic:
259 AMIGAHW_SET(AMI_VIDEO);
260 AMIGAHW_SET(AMI_BLITTER);
261 AMIGAHW_SET(AMI_AUDIO);
262 AMIGAHW_SET(AMI_FLOPPY);
263 AMIGAHW_SET(AMI_KEYBOARD);
264 AMIGAHW_SET(AMI_MOUSE);
265 AMIGAHW_SET(AMI_SERIAL);
266 AMIGAHW_SET(AMI_PARALLEL);
267 AMIGAHW_SET(CHIP_RAM);
268 AMIGAHW_SET(PAULA);
269
270 switch (amiga_chipset) {
271 case CS_OCS:
272 case CS_ECS:
273 case CS_AGA:
274 switch (amiga_custom.deniseid & 0xf) {
275 case 0x0c:
276 AMIGAHW_SET(DENISE_HR);
277 break;
278 case 0x08:
279 AMIGAHW_SET(LISA);
280 break;
281 }
282 break;
283 default:
284 AMIGAHW_SET(DENISE);
285 break;
286 }
287 switch ((amiga_custom.vposr>>8) & 0x7f) {
288 case 0x00:
289 AMIGAHW_SET(AGNUS_PAL);
290 break;
291 case 0x10:
292 AMIGAHW_SET(AGNUS_NTSC);
293 break;
294 case 0x20:
295 case 0x21:
296 AMIGAHW_SET(AGNUS_HR_PAL);
297 break;
298 case 0x30:
299 case 0x31:
300 AMIGAHW_SET(AGNUS_HR_NTSC);
301 break;
302 case 0x22:
303 case 0x23:
304 AMIGAHW_SET(ALICE_PAL);
305 break;
306 case 0x32:
307 case 0x33:
308 AMIGAHW_SET(ALICE_NTSC);
309 break;
310 }
311 AMIGAHW_SET(ZORRO);
312 break;
313
314 case AMI_DRACO:
315 panic("No support for Draco yet");
316
317 default:
318 panic("Unknown Amiga Model");
319 }
320
321 #define AMIGAHW_ANNOUNCE(name, str) \
322 if (AMIGAHW_PRESENT(name)) \
323 pr_cont(str)
324
325 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
326 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
327 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
328 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
329 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
330 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
331 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
332 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
333 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
334 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
335 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
336 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
337 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
338 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
339 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
340 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
341 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
342 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
343 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
344 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
345 AMIGAHW_ANNOUNCE(LISA, "LISA ");
346 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
347 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
348 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
349 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
350 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
351 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
352 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
353 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
354 if (AMIGAHW_PRESENT(ZORRO))
355 pr_cont("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
356 pr_cont("\n");
357
358 #undef AMIGAHW_ANNOUNCE
359 }
360
361
362 static unsigned long amiga_random_get_entropy(void)
363 {
364
365 return *(unsigned long *)&amiga_custom.vposr;
366 }
367
368
369
370
371
372
373 void __init config_amiga(void)
374 {
375 int i;
376
377 amiga_identify();
378
379
380 iomem_resource.name = "Memory";
381 for (i = 0; i < 4; i++)
382 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
383
384 mach_sched_init = amiga_sched_init;
385 mach_init_IRQ = amiga_init_IRQ;
386 mach_get_model = amiga_get_model;
387 mach_get_hardware_list = amiga_get_hardware_list;
388
389
390
391
392
393
394 mach_max_dma_address = 0xffffffff;
395
396 mach_reset = amiga_reset;
397 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
398 mach_beep = amiga_mksound;
399 #endif
400
401 #ifdef CONFIG_HEARTBEAT
402 mach_heartbeat = amiga_heartbeat;
403 #endif
404
405 mach_random_get_entropy = amiga_random_get_entropy;
406
407
408 amiga_colorclock = 5*amiga_eclock;
409
410
411 amiga_custom.dmacon = DMAF_ALL;
412
413 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
414
415
416 if (AMIGAHW_PRESENT(ZORRO3)) {
417 int i, j;
418 u32 disabled_z2mem = 0;
419
420 for (i = 0; i < m68k_num_memory; i++) {
421 if (m68k_memory[i].addr < 16*1024*1024) {
422 if (i == 0) {
423
424 pr_warn("Warning: kernel runs in Zorro II memory\n");
425 continue;
426 }
427 disabled_z2mem += m68k_memory[i].size;
428 m68k_num_memory--;
429 for (j = i; j < m68k_num_memory; j++)
430 m68k_memory[j] = m68k_memory[j+1];
431 i--;
432 }
433 }
434 if (disabled_z2mem)
435 pr_info("%dK of Zorro II memory will not be used as system memory\n",
436 disabled_z2mem>>10);
437 }
438
439
440 for (i = 0; i < m68k_num_memory; i++) {
441 ram_resource[i].name =
442 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
443 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
444 "16-bit Slow RAM";
445 ram_resource[i].start = m68k_memory[i].addr;
446 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
447 request_resource(&iomem_resource, &ram_resource[i]);
448 }
449
450
451 amiga_chip_init();
452
453
454 if (AMIGAHW_PRESENT(AMI_AUDIO))
455 amiga_init_sound();
456
457
458
459
460
461 if (AMIGAHW_PRESENT(MAGIC_REKICK))
462 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
463 }
464
465 static u64 amiga_read_clk(struct clocksource *cs);
466
467 static struct clocksource amiga_clk = {
468 .name = "ciab",
469 .rating = 250,
470 .read = amiga_read_clk,
471 .mask = CLOCKSOURCE_MASK(32),
472 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
473 };
474
475 static unsigned short jiffy_ticks;
476 static u32 clk_total, clk_offset;
477
478 static irqreturn_t ciab_timer_handler(int irq, void *dev_id)
479 {
480 irq_handler_t timer_routine = dev_id;
481
482 clk_total += jiffy_ticks;
483 clk_offset = 0;
484 timer_routine(0, NULL);
485
486 return IRQ_HANDLED;
487 }
488
489 static void __init amiga_sched_init(irq_handler_t timer_routine)
490 {
491 static struct resource sched_res = {
492 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
493 };
494 jiffy_ticks = DIV_ROUND_CLOSEST(amiga_eclock, HZ);
495
496 if (request_resource(&mb_resources._ciab, &sched_res))
497 pr_warn("Cannot allocate ciab.ta{lo,hi}\n");
498 ciab.cra &= 0xC0;
499 ciab.talo = jiffy_ticks % 256;
500 ciab.tahi = jiffy_ticks / 256;
501
502
503
504
505
506
507 if (request_irq(IRQ_AMIGA_CIAB_TA, ciab_timer_handler, IRQF_TIMER,
508 "timer", timer_routine))
509 pr_err("Couldn't register timer interrupt\n");
510
511 ciab.cra |= 0x11;
512
513 clocksource_register_hz(&amiga_clk, amiga_eclock);
514 }
515
516 static u64 amiga_read_clk(struct clocksource *cs)
517 {
518 unsigned short hi, lo, hi2;
519 unsigned long flags;
520 u32 ticks;
521
522 local_irq_save(flags);
523
524
525 hi = ciab.tahi;
526 lo = ciab.talo;
527 hi2 = ciab.tahi;
528
529 if (hi != hi2) {
530 lo = ciab.talo;
531 hi = hi2;
532 }
533
534 ticks = hi << 8 | lo;
535
536 if (ticks > jiffy_ticks / 2)
537
538 if (cia_set_irq(&ciab_base, 0) & CIA_ICR_TA)
539 clk_offset = jiffy_ticks;
540
541 ticks = jiffy_ticks - ticks;
542 ticks += clk_offset + clk_total;
543
544 local_irq_restore(flags);
545
546 return ticks;
547 }
548
549 static void amiga_reset(void) __noreturn;
550
551 static void amiga_reset(void)
552 {
553 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
554 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
555
556 local_irq_disable();
557 if (CPU_IS_040_OR_060)
558
559
560
561 asm volatile ("\n"
562 " move.l %0,%%d0\n"
563 " and.l #0xff000000,%%d0\n"
564 " or.w #0xe020,%%d0\n"
565 " .chip 68040\n"
566 " movec %%d0,%%itt0\n"
567 " movec %%d0,%%dtt0\n"
568 " .chip 68k\n"
569 " jmp %0@\n"
570 :
571 : "a" (jmp_addr040)
572 : "d0");
573 else
574
575
576
577 asm volatile ("\n"
578 " pmove %%tc,%@\n"
579 " bclr #7,%@\n"
580 " pmove %@,%%tc\n"
581 " jmp %0@\n"
582 :
583 : "a" (jmp_addr));
584 jmp_addr_label040:
585
586 asm volatile ("\n"
587 " moveq #0,%%d0\n"
588 " .chip 68040\n"
589 " movec %%d0,%%tc\n"
590 " .chip 68k\n"
591 :
592 :
593 : "d0");
594
595 jmp_addr_label:
596
597
598
599 asm volatile ("\n"
600 " move.w #0x2700,%sr\n"
601 " lea 0x01000000,%a0\n"
602 " sub.l %a0@(-0x14),%a0\n"
603 " move.l %a0@(4),%a0\n"
604 " subq.l #2,%a0\n"
605 " jra 1f\n"
606
607 " " __ALIGN_STR "\n"
608 "1:\n"
609 " reset\n"
610 " jmp %a0@");
611
612 for (;;)
613 ;
614 }
615
616
617
618
619
620
621 #define SAVEKMSG_MAXMEM 128*1024
622
623 #define SAVEKMSG_MAGIC1 0x53415645
624 #define SAVEKMSG_MAGIC2 0x4B4D5347
625
626 struct savekmsg {
627 unsigned long magic1;
628 unsigned long magic2;
629 unsigned long magicptr;
630 unsigned long size;
631 char data[0];
632 };
633
634 static struct savekmsg *savekmsg;
635
636 static void amiga_mem_console_write(struct console *co, const char *s,
637 unsigned int count)
638 {
639 if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
640 memcpy(savekmsg->data + savekmsg->size, s, count);
641 savekmsg->size += count;
642 }
643 }
644
645 static int __init amiga_savekmsg_setup(char *arg)
646 {
647 bool registered;
648
649 if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
650 return 0;
651
652 if (amiga_chip_size < SAVEKMSG_MAXMEM) {
653 pr_err("Not enough chipram for debugging\n");
654 return -ENOMEM;
655 }
656
657
658 amiga_chip_size -= SAVEKMSG_MAXMEM;
659 savekmsg = ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
660 savekmsg->magic1 = SAVEKMSG_MAGIC1;
661 savekmsg->magic2 = SAVEKMSG_MAGIC2;
662 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
663 savekmsg->size = 0;
664
665 registered = !!amiga_console_driver.write;
666 amiga_console_driver.write = amiga_mem_console_write;
667 if (!registered)
668 register_console(&amiga_console_driver);
669 return 0;
670 }
671
672 early_param("debug", amiga_savekmsg_setup);
673
674 static void amiga_serial_putc(char c)
675 {
676 amiga_custom.serdat = (unsigned char)c | 0x100;
677 while (!(amiga_custom.serdatr & 0x2000))
678 ;
679 }
680
681 static void amiga_serial_console_write(struct console *co, const char *s,
682 unsigned int count)
683 {
684 while (count--) {
685 if (*s == '\n')
686 amiga_serial_putc('\r');
687 amiga_serial_putc(*s++);
688 }
689 }
690
691 #if 0
692 void amiga_serial_puts(const char *s)
693 {
694 amiga_serial_console_write(NULL, s, strlen(s));
695 }
696
697 int amiga_serial_console_wait_key(struct console *co)
698 {
699 int ch;
700
701 while (!(amiga_custom.intreqr & IF_RBF))
702 barrier();
703 ch = amiga_custom.serdatr & 0xff;
704
705 amiga_custom.intreq = IF_RBF;
706 return ch;
707 }
708
709 void amiga_serial_gets(struct console *co, char *s, int len)
710 {
711 int ch, cnt = 0;
712
713 while (1) {
714 ch = amiga_serial_console_wait_key(co);
715
716
717 if (ch == 8 || ch == 127) {
718 if (cnt == 0) {
719 amiga_serial_putc('\007');
720 continue;
721 }
722 cnt--;
723 amiga_serial_puts("\010 \010");
724 continue;
725 }
726
727
728 if (ch == 10 || ch == 13)
729 break;
730
731
732 if (cnt >= len + 1) {
733 amiga_serial_putc(7);
734 cnt--;
735 continue;
736 }
737
738
739 s[cnt++] = ch;
740 amiga_serial_putc(ch);
741 }
742
743 amiga_serial_puts("\r\n");
744 s[cnt] = 0;
745 }
746 #endif
747
748 static int __init amiga_debug_setup(char *arg)
749 {
750 bool registered;
751
752 if (!MACH_IS_AMIGA || strcmp(arg, "ser"))
753 return 0;
754
755
756 registered = !!amiga_console_driver.write;
757 amiga_console_driver.write = amiga_serial_console_write;
758 if (!registered)
759 register_console(&amiga_console_driver);
760 return 0;
761 }
762
763 early_param("debug", amiga_debug_setup);
764
765 #ifdef CONFIG_HEARTBEAT
766 static void amiga_heartbeat(int on)
767 {
768 if (on)
769 ciaa.pra &= ~2;
770 else
771 ciaa.pra |= 2;
772 }
773 #endif
774
775
776
777
778
779 static void amiga_get_model(char *model)
780 {
781 strcpy(model, amiga_model_name);
782 }
783
784
785 static void amiga_get_hardware_list(struct seq_file *m)
786 {
787 if (AMIGAHW_PRESENT(CHIP_RAM))
788 seq_printf(m, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
789 seq_printf(m, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
790 amiga_psfreq, amiga_eclock);
791 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
792 char *type;
793 switch (amiga_chipset) {
794 case CS_OCS:
795 type = "OCS";
796 break;
797 case CS_ECS:
798 type = "ECS";
799 break;
800 case CS_AGA:
801 type = "AGA";
802 break;
803 default:
804 type = "Old or Unknown";
805 break;
806 }
807 seq_printf(m, "Graphics:\t%s\n", type);
808 }
809
810 #define AMIGAHW_ANNOUNCE(name, str) \
811 if (AMIGAHW_PRESENT(name)) \
812 seq_printf (m, "\t%s\n", str)
813
814 seq_puts(m, "Detected hardware:\n");
815 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
816 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
817 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
818 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
819 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
820 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
821 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
822 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
823 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
824 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
825 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
826 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
827 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
828 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
829 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
830 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
831 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
832 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
833 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
834 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
835 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
836 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
837 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
838 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
839 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
840 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
841 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
842 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
843 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
844 #ifdef CONFIG_ZORRO
845 if (AMIGAHW_PRESENT(ZORRO))
846 seq_printf(m, "\tZorro II%s AutoConfig: %d Expansion "
847 "Device%s\n",
848 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
849 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
850 #endif
851
852 #undef AMIGAHW_ANNOUNCE
853 }
854
855
856
857
858
859 #ifdef CONFIG_HW_CONSOLE
860 EXPORT_SYMBOL_GPL(key_maps);
861 #endif