blob: dd0734e54bb813d0b4fa2e2ea54df83d4514cc82 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/m68k/amiga/config.c
3 *
4 * Copyright (C) 1993 Hamish Macdonald
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 * Miscellaneous Amiga stuff
13 */
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/tty.h>
19#include <linux/console.h>
20#include <linux/rtc.h>
21#include <linux/init.h>
22#include <linux/vt_kern.h>
23#include <linux/delay.h>
24#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <linux/zorro.h>
Adrian Bunk8b169fa2008-02-04 22:30:25 -080026#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28#include <asm/bootinfo.h>
29#include <asm/setup.h>
30#include <asm/system.h>
31#include <asm/pgtable.h>
32#include <asm/amigahw.h>
33#include <asm/amigaints.h>
34#include <asm/irq.h>
35#include <asm/rtc.h>
36#include <asm/machdep.h>
37#include <asm/io.h>
38
39unsigned long amiga_model;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080040EXPORT_SYMBOL(amiga_model);
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042unsigned long amiga_eclock;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080043EXPORT_SYMBOL(amiga_eclock);
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045unsigned long amiga_masterclock;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080046
Linus Torvalds1da177e2005-04-16 15:20:36 -070047unsigned long amiga_colorclock;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080048EXPORT_SYMBOL(amiga_colorclock);
49
Linus Torvalds1da177e2005-04-16 15:20:36 -070050unsigned long amiga_chipset;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080051EXPORT_SYMBOL(amiga_chipset);
52
Linus Torvalds1da177e2005-04-16 15:20:36 -070053unsigned char amiga_vblank;
Adrian Bunk8468afc2008-07-17 21:16:21 +020054EXPORT_SYMBOL(amiga_vblank);
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056unsigned char amiga_psfreq;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080057
Linus Torvalds1da177e2005-04-16 15:20:36 -070058struct amiga_hw_present amiga_hw_present;
Adrian Bunk8b169fa2008-02-04 22:30:25 -080059EXPORT_SYMBOL(amiga_hw_present);
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
61static char s_a500[] __initdata = "A500";
62static char s_a500p[] __initdata = "A500+";
63static char s_a600[] __initdata = "A600";
64static char s_a1000[] __initdata = "A1000";
65static char s_a1200[] __initdata = "A1200";
66static char s_a2000[] __initdata = "A2000";
67static char s_a2500[] __initdata = "A2500";
68static char s_a3000[] __initdata = "A3000";
69static char s_a3000t[] __initdata = "A3000T";
70static char s_a3000p[] __initdata = "A3000+";
71static char s_a4000[] __initdata = "A4000";
72static char s_a4000t[] __initdata = "A4000T";
73static char s_cdtv[] __initdata = "CDTV";
74static char s_cd32[] __initdata = "CD32";
75static char s_draco[] __initdata = "Draco";
76static char *amiga_models[] __initdata = {
Roman Zippel6ff58012007-05-01 22:32:43 +020077 [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,
Linus Torvalds1da177e2005-04-16 15:20:36 -070092};
93
94static char amiga_model_name[13] = "Amiga ";
95
David Howells40220c12006-10-09 12:19:47 +010096static void amiga_sched_init(irq_handler_t handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -070097/* amiga specific irq functions */
Roman Zippel6ff58012007-05-01 22:32:43 +020098extern void amiga_init_IRQ(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070099static void amiga_get_model(char *model);
100static int amiga_get_hardware_list(char *buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101/* amiga specific timer functions */
Roman Zippel6ff58012007-05-01 22:32:43 +0200102static unsigned long amiga_gettimeoffset(void);
103static int a3000_hwclk(int, struct rtc_time *);
104static int a2000_hwclk(int, struct rtc_time *);
105static int amiga_set_clock_mmss(unsigned long);
106static unsigned int amiga_get_ss(void);
107extern void amiga_mksound(unsigned int count, unsigned int ticks);
108static void amiga_reset(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109extern void amiga_init_sound(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110static void amiga_mem_console_write(struct console *co, const char *b,
111 unsigned int count);
112void amiga_serial_console_write(struct console *co, const char *s,
113 unsigned int count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114#ifdef CONFIG_HEARTBEAT
115static void amiga_heartbeat(int on);
116#endif
117
118static struct console amiga_console_driver = {
Roman Zippel6ff58012007-05-01 22:32:43 +0200119 .name = "debug",
120 .flags = CON_PRINTBUFFER,
121 .index = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122};
123
124
125 /*
126 * Motherboard Resources present in all Amiga models
127 */
128
129static struct {
Roman Zippel6ff58012007-05-01 22:32:43 +0200130 struct resource _ciab, _ciaa, _custom, _kickstart;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131} mb_resources = {
Roman Zippel6ff58012007-05-01 22:32:43 +0200132 ._ciab = {
133 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
134 },
135 ._ciaa = {
136 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
137 },
138 ._custom = {
139 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
140 },
141 ._kickstart = {
142 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
143 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144};
145
146static struct resource rtc_resource = {
Roman Zippel6ff58012007-05-01 22:32:43 +0200147 .start = 0x00dc0000, .end = 0x00dcffff
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148};
149
150static struct resource ram_resource[NUM_MEMINFO];
151
152
153 /*
154 * Parse an Amiga-specific record in the bootinfo
155 */
156
157int amiga_parse_bootinfo(const struct bi_record *record)
158{
Roman Zippel6ff58012007-05-01 22:32:43 +0200159 int unknown = 0;
160 const unsigned long *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Roman Zippel6ff58012007-05-01 22:32:43 +0200162 switch (record->tag) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 case BI_AMIGA_MODEL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200164 amiga_model = *data;
165 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
167 case BI_AMIGA_ECLOCK:
Roman Zippel6ff58012007-05-01 22:32:43 +0200168 amiga_eclock = *data;
169 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
171 case BI_AMIGA_CHIPSET:
Roman Zippel6ff58012007-05-01 22:32:43 +0200172 amiga_chipset = *data;
173 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175 case BI_AMIGA_CHIP_SIZE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200176 amiga_chip_size = *(const int *)data;
177 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
179 case BI_AMIGA_VBLANK:
Roman Zippel6ff58012007-05-01 22:32:43 +0200180 amiga_vblank = *(const unsigned char *)data;
181 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
183 case BI_AMIGA_PSFREQ:
Roman Zippel6ff58012007-05-01 22:32:43 +0200184 amiga_psfreq = *(const unsigned char *)data;
185 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
187 case BI_AMIGA_AUTOCON:
188#ifdef CONFIG_ZORRO
Roman Zippel6ff58012007-05-01 22:32:43 +0200189 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
190 const struct ConfigDev *cd = (struct ConfigDev *)data;
191 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
192 dev->rom = cd->cd_Rom;
193 dev->slotaddr = cd->cd_SlotAddr;
194 dev->slotsize = cd->cd_SlotSize;
195 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
196 dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
197 } else
198 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199#endif /* CONFIG_ZORRO */
Roman Zippel6ff58012007-05-01 22:32:43 +0200200 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201
202 case BI_AMIGA_SERPER:
Roman Zippel6ff58012007-05-01 22:32:43 +0200203 /* serial port period: ignored here */
204 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205
206 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200207 unknown = 1;
208 }
209 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210}
211
212 /*
213 * Identify builtin hardware
214 */
215
216static void __init amiga_identify(void)
217{
Roman Zippel6ff58012007-05-01 22:32:43 +0200218 /* Fill in some default values, if necessary */
219 if (amiga_eclock == 0)
220 amiga_eclock = 709379;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221
Roman Zippel6ff58012007-05-01 22:32:43 +0200222 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223
Roman Zippel6ff58012007-05-01 22:32:43 +0200224 printk("Amiga hardware found: ");
225 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
226 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
227 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
228 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229
Roman Zippel6ff58012007-05-01 22:32:43 +0200230 switch (amiga_model) {
231 case AMI_UNKNOWN:
232 goto Generic;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
Roman Zippel6ff58012007-05-01 22:32:43 +0200234 case AMI_600:
235 case AMI_1200:
236 AMIGAHW_SET(A1200_IDE);
237 AMIGAHW_SET(PCMCIA);
238 case AMI_500:
239 case AMI_500PLUS:
240 case AMI_1000:
241 case AMI_2000:
242 case AMI_2500:
243 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
244 goto Generic;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245
Roman Zippel6ff58012007-05-01 22:32:43 +0200246 case AMI_3000:
247 case AMI_3000T:
248 AMIGAHW_SET(AMBER_FF);
249 AMIGAHW_SET(MAGIC_REKICK);
250 /* fall through */
251 case AMI_3000PLUS:
252 AMIGAHW_SET(A3000_SCSI);
253 AMIGAHW_SET(A3000_CLK);
254 AMIGAHW_SET(ZORRO3);
255 goto Generic;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256
Roman Zippel6ff58012007-05-01 22:32:43 +0200257 case AMI_4000T:
258 AMIGAHW_SET(A4000_SCSI);
259 /* fall through */
260 case AMI_4000:
261 AMIGAHW_SET(A4000_IDE);
262 AMIGAHW_SET(A3000_CLK);
263 AMIGAHW_SET(ZORRO3);
264 goto Generic;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265
Roman Zippel6ff58012007-05-01 22:32:43 +0200266 case AMI_CDTV:
267 case AMI_CD32:
268 AMIGAHW_SET(CD_ROM);
269 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
270 goto Generic;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271
Roman Zippel6ff58012007-05-01 22:32:43 +0200272 Generic:
273 AMIGAHW_SET(AMI_VIDEO);
274 AMIGAHW_SET(AMI_BLITTER);
275 AMIGAHW_SET(AMI_AUDIO);
276 AMIGAHW_SET(AMI_FLOPPY);
277 AMIGAHW_SET(AMI_KEYBOARD);
278 AMIGAHW_SET(AMI_MOUSE);
279 AMIGAHW_SET(AMI_SERIAL);
280 AMIGAHW_SET(AMI_PARALLEL);
281 AMIGAHW_SET(CHIP_RAM);
282 AMIGAHW_SET(PAULA);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
Roman Zippel6ff58012007-05-01 22:32:43 +0200284 switch (amiga_chipset) {
285 case CS_OCS:
286 case CS_ECS:
287 case CS_AGA:
288 switch (amiga_custom.deniseid & 0xf) {
289 case 0x0c:
290 AMIGAHW_SET(DENISE_HR);
291 break;
292 case 0x08:
293 AMIGAHW_SET(LISA);
294 break;
295 }
296 break;
297 default:
298 AMIGAHW_SET(DENISE);
299 break;
300 }
301 switch ((amiga_custom.vposr>>8) & 0x7f) {
302 case 0x00:
303 AMIGAHW_SET(AGNUS_PAL);
304 break;
305 case 0x10:
306 AMIGAHW_SET(AGNUS_NTSC);
307 break;
308 case 0x20:
309 case 0x21:
310 AMIGAHW_SET(AGNUS_HR_PAL);
311 break;
312 case 0x30:
313 case 0x31:
314 AMIGAHW_SET(AGNUS_HR_NTSC);
315 break;
316 case 0x22:
317 case 0x23:
318 AMIGAHW_SET(ALICE_PAL);
319 break;
320 case 0x32:
321 case 0x33:
322 AMIGAHW_SET(ALICE_NTSC);
323 break;
324 }
325 AMIGAHW_SET(ZORRO);
326 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327
Roman Zippel6ff58012007-05-01 22:32:43 +0200328 case AMI_DRACO:
329 panic("No support for Draco yet");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330
Roman Zippel6ff58012007-05-01 22:32:43 +0200331 default:
332 panic("Unknown Amiga Model");
333 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
Roman Zippel6ff58012007-05-01 22:32:43 +0200335#define AMIGAHW_ANNOUNCE(name, str) \
336 if (AMIGAHW_PRESENT(name)) \
337 printk(str)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338
Roman Zippel6ff58012007-05-01 22:32:43 +0200339 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
340 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
341 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
342 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
343 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
344 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
345 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
346 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
347 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
348 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
349 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
350 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
351 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
352 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
353 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
354 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
355 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
356 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
357 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
358 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
359 AMIGAHW_ANNOUNCE(LISA, "LISA ");
360 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
361 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
362 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
363 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
364 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
365 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
366 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
367 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
368 if (AMIGAHW_PRESENT(ZORRO))
369 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
370 printk("\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371
372#undef AMIGAHW_ANNOUNCE
373}
374
375 /*
376 * Setup the Amiga configuration info
377 */
378
379void __init config_amiga(void)
380{
Roman Zippel6ff58012007-05-01 22:32:43 +0200381 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382
Roman Zippel6ff58012007-05-01 22:32:43 +0200383 amiga_identify();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384
Roman Zippel6ff58012007-05-01 22:32:43 +0200385 /* Yuk, we don't have PCI memory */
386 iomem_resource.name = "Memory";
387 for (i = 0; i < 4; i++)
388 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389
Roman Zippel6ff58012007-05-01 22:32:43 +0200390 mach_sched_init = amiga_sched_init;
391 mach_init_IRQ = amiga_init_IRQ;
392 mach_get_model = amiga_get_model;
393 mach_get_hardware_list = amiga_get_hardware_list;
394 mach_gettimeoffset = amiga_gettimeoffset;
395 if (AMIGAHW_PRESENT(A3000_CLK)) {
396 mach_hwclk = a3000_hwclk;
397 rtc_resource.name = "A3000 RTC";
398 request_resource(&iomem_resource, &rtc_resource);
399 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
400 mach_hwclk = a2000_hwclk;
401 rtc_resource.name = "A2000 RTC";
402 request_resource(&iomem_resource, &rtc_resource);
403 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404
Roman Zippel6ff58012007-05-01 22:32:43 +0200405 /*
406 * default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
407 * code will not be able to allocate any mem for transfers, unless we are
408 * dealing with a Z2 mem only system. /Jes
409 */
410 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411
Roman Zippel6ff58012007-05-01 22:32:43 +0200412 mach_set_clock_mmss = amiga_set_clock_mmss;
413 mach_get_ss = amiga_get_ss;
414 mach_reset = amiga_reset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200416 mach_beep = amiga_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417#endif
418
419#ifdef CONFIG_HEARTBEAT
Roman Zippel6ff58012007-05-01 22:32:43 +0200420 mach_heartbeat = amiga_heartbeat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421#endif
422
Roman Zippel6ff58012007-05-01 22:32:43 +0200423 /* Fill in the clock values (based on the 700 kHz E-Clock) */
424 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
425 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426
Roman Zippel6ff58012007-05-01 22:32:43 +0200427 /* clear all DMA bits */
428 amiga_custom.dmacon = DMAF_ALL;
429 /* ensure that the DMA master bit is set */
430 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431
Roman Zippel6ff58012007-05-01 22:32:43 +0200432 /* don't use Z2 RAM as system memory on Z3 capable machines */
433 if (AMIGAHW_PRESENT(ZORRO3)) {
434 int i, j;
435 u32 disabled_z2mem = 0;
436
437 for (i = 0; i < m68k_num_memory; i++) {
438 if (m68k_memory[i].addr < 16*1024*1024) {
439 if (i == 0) {
440 /* don't cut off the branch we're sitting on */
441 printk("Warning: kernel runs in Zorro II memory\n");
442 continue;
443 }
444 disabled_z2mem += m68k_memory[i].size;
445 m68k_num_memory--;
446 for (j = i; j < m68k_num_memory; j++)
447 m68k_memory[j] = m68k_memory[j+1];
448 i--;
449 }
450 }
451 if (disabled_z2mem)
452 printk("%dK of Zorro II memory will not be used as system memory\n",
453 disabled_z2mem>>10);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455
Roman Zippel6ff58012007-05-01 22:32:43 +0200456 /* request all RAM */
457 for (i = 0; i < m68k_num_memory; i++) {
458 ram_resource[i].name =
459 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
460 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
461 "16-bit Slow RAM";
462 ram_resource[i].start = m68k_memory[i].addr;
463 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
464 request_resource(&iomem_resource, &ram_resource[i]);
465 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466
Roman Zippel6ff58012007-05-01 22:32:43 +0200467 /* initialize chipram allocator */
468 amiga_chip_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469
Roman Zippel6ff58012007-05-01 22:32:43 +0200470 /* our beloved beeper */
471 if (AMIGAHW_PRESENT(AMI_AUDIO))
472 amiga_init_sound();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473
Roman Zippel6ff58012007-05-01 22:32:43 +0200474 /*
475 * if it is an A3000, set the magic bit that forces
476 * a hard rekick
477 */
478 if (AMIGAHW_PRESENT(MAGIC_REKICK))
479 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480}
481
482static unsigned short jiffy_ticks;
483
David Howells40220c12006-10-09 12:19:47 +0100484static void __init amiga_sched_init(irq_handler_t timer_routine)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485{
486 static struct resource sched_res = {
Roman Zippel6ff58012007-05-01 22:32:43 +0200487 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 };
489 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
490
491 if (request_resource(&mb_resources._ciab, &sched_res))
Roman Zippel6ff58012007-05-01 22:32:43 +0200492 printk("Cannot allocate ciab.ta{lo,hi}\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
494 ciab.talo = jiffy_ticks % 256;
495 ciab.tahi = jiffy_ticks / 256;
496
497 /* install interrupt service routine for CIAB Timer A
498 *
499 * Please don't change this to use ciaa, as it interferes with the
500 * SCSI code. We'll have to take a look at this later
501 */
502 request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL);
503 /* start timer */
504 ciab.cra |= 0x11;
505}
506
507#define TICK_SIZE 10000
508
509/* This is always executed with interrupts disabled. */
Roman Zippel6ff58012007-05-01 22:32:43 +0200510static unsigned long amiga_gettimeoffset(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511{
512 unsigned short hi, lo, hi2;
513 unsigned long ticks, offset = 0;
514
515 /* read CIA B timer A current value */
516 hi = ciab.tahi;
517 lo = ciab.talo;
518 hi2 = ciab.tahi;
519
520 if (hi != hi2) {
521 lo = ciab.talo;
522 hi = hi2;
523 }
524
525 ticks = hi << 8 | lo;
526
527 if (ticks > jiffy_ticks / 2)
528 /* check for pending interrupt */
529 if (cia_set_irq(&ciab_base, 0) & CIA_ICR_TA)
530 offset = 10000;
531
532 ticks = jiffy_ticks - ticks;
533 ticks = (10000 * ticks) / jiffy_ticks;
534
535 return ticks + offset;
536}
537
538static int a3000_hwclk(int op, struct rtc_time *t)
539{
540 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
541
542 if (!op) { /* read */
543 t->tm_sec = tod_3000.second1 * 10 + tod_3000.second2;
544 t->tm_min = tod_3000.minute1 * 10 + tod_3000.minute2;
545 t->tm_hour = tod_3000.hour1 * 10 + tod_3000.hour2;
546 t->tm_mday = tod_3000.day1 * 10 + tod_3000.day2;
547 t->tm_wday = tod_3000.weekday;
548 t->tm_mon = tod_3000.month1 * 10 + tod_3000.month2 - 1;
549 t->tm_year = tod_3000.year1 * 10 + tod_3000.year2;
550 if (t->tm_year <= 69)
551 t->tm_year += 100;
552 } else {
553 tod_3000.second1 = t->tm_sec / 10;
554 tod_3000.second2 = t->tm_sec % 10;
555 tod_3000.minute1 = t->tm_min / 10;
556 tod_3000.minute2 = t->tm_min % 10;
557 tod_3000.hour1 = t->tm_hour / 10;
558 tod_3000.hour2 = t->tm_hour % 10;
559 tod_3000.day1 = t->tm_mday / 10;
560 tod_3000.day2 = t->tm_mday % 10;
561 if (t->tm_wday != -1)
562 tod_3000.weekday = t->tm_wday;
563 tod_3000.month1 = (t->tm_mon + 1) / 10;
564 tod_3000.month2 = (t->tm_mon + 1) % 10;
565 if (t->tm_year >= 100)
566 t->tm_year -= 100;
567 tod_3000.year1 = t->tm_year / 10;
568 tod_3000.year2 = t->tm_year % 10;
569 }
570
571 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
572
573 return 0;
574}
575
576static int a2000_hwclk(int op, struct rtc_time *t)
577{
578 int cnt = 5;
579
580 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
581
Roman Zippel6ff58012007-05-01 22:32:43 +0200582 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
583 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
584 udelay(70);
585 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 }
587
588 if (!cnt)
Roman Zippel6ff58012007-05-01 22:32:43 +0200589 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n",
590 tod_2000.cntrl1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591
592 if (!op) { /* read */
593 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
594 t->tm_min = tod_2000.minute1 * 10 + tod_2000.minute2;
595 t->tm_hour = (tod_2000.hour1 & 3) * 10 + tod_2000.hour2;
596 t->tm_mday = tod_2000.day1 * 10 + tod_2000.day2;
597 t->tm_wday = tod_2000.weekday;
598 t->tm_mon = tod_2000.month1 * 10 + tod_2000.month2 - 1;
599 t->tm_year = tod_2000.year1 * 10 + tod_2000.year2;
600 if (t->tm_year <= 69)
601 t->tm_year += 100;
602
Roman Zippel6ff58012007-05-01 22:32:43 +0200603 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
605 t->tm_hour = 0;
606 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
607 t->tm_hour += 12;
608 }
609 } else {
610 tod_2000.second1 = t->tm_sec / 10;
611 tod_2000.second2 = t->tm_sec % 10;
612 tod_2000.minute1 = t->tm_min / 10;
613 tod_2000.minute2 = t->tm_min % 10;
614 if (tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)
615 tod_2000.hour1 = t->tm_hour / 10;
616 else if (t->tm_hour >= 12)
617 tod_2000.hour1 = TOD2000_HOUR1_PM +
618 (t->tm_hour - 12) / 10;
619 else
620 tod_2000.hour1 = t->tm_hour / 10;
621 tod_2000.hour2 = t->tm_hour % 10;
622 tod_2000.day1 = t->tm_mday / 10;
623 tod_2000.day2 = t->tm_mday % 10;
624 if (t->tm_wday != -1)
625 tod_2000.weekday = t->tm_wday;
626 tod_2000.month1 = (t->tm_mon + 1) / 10;
627 tod_2000.month2 = (t->tm_mon + 1) % 10;
628 if (t->tm_year >= 100)
629 t->tm_year -= 100;
630 tod_2000.year1 = t->tm_year / 10;
631 tod_2000.year2 = t->tm_year % 10;
632 }
633
634 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
635
636 return 0;
637}
638
Roman Zippel6ff58012007-05-01 22:32:43 +0200639static int amiga_set_clock_mmss(unsigned long nowtime)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640{
641 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
642
643 if (AMIGAHW_PRESENT(A3000_CLK)) {
644 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
645
646 tod_3000.second1 = real_seconds / 10;
647 tod_3000.second2 = real_seconds % 10;
648 tod_3000.minute1 = real_minutes / 10;
649 tod_3000.minute2 = real_minutes % 10;
650
651 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
652 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
653 int cnt = 5;
654
655 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
656
Roman Zippel6ff58012007-05-01 22:32:43 +0200657 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
659 udelay(70);
660 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
661 }
662
663 if (!cnt)
664 printk(KERN_INFO "set_clock_mmss: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
665
666 tod_2000.second1 = real_seconds / 10;
667 tod_2000.second2 = real_seconds % 10;
668 tod_2000.minute1 = real_minutes / 10;
669 tod_2000.minute2 = real_minutes % 10;
670
671 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
672 }
673
674 return 0;
675}
676
Roman Zippel6ff58012007-05-01 22:32:43 +0200677static unsigned int amiga_get_ss(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678{
679 unsigned int s;
680
681 if (AMIGAHW_PRESENT(A3000_CLK)) {
682 tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
683 s = tod_3000.second1 * 10 + tod_3000.second2;
684 tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
685 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
686 s = tod_2000.second1 * 10 + tod_2000.second2;
687 }
688 return s;
689}
690
Roman Zippel6ff58012007-05-01 22:32:43 +0200691static NORET_TYPE void amiga_reset(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 ATTRIB_NORET;
693
Roman Zippel6ff58012007-05-01 22:32:43 +0200694static void amiga_reset(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695{
Roman Zippel6ff58012007-05-01 22:32:43 +0200696 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
697 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698
Roman Zippel6ff58012007-05-01 22:32:43 +0200699 local_irq_disable();
700 if (CPU_IS_040_OR_060)
701 /* Setup transparent translation registers for mapping
702 * of 16 MB kernel segment before disabling translation
703 */
704 asm volatile ("\n"
705 " move.l %0,%%d0\n"
706 " and.l #0xff000000,%%d0\n"
707 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
708 " .chip 68040\n"
709 " movec %%d0,%%itt0\n"
710 " movec %%d0,%%dtt0\n"
711 " .chip 68k\n"
712 " jmp %0@\n"
713 : /* no outputs */
714 : "a" (jmp_addr040)
715 : "d0");
716 else
717 /* for 680[23]0, just disable translation and jump to the physical
718 * address of the label
719 */
720 asm volatile ("\n"
721 " pmove %%tc,%@\n"
722 " bclr #7,%@\n"
723 " pmove %@,%%tc\n"
724 " jmp %0@\n"
725 : /* no outputs */
726 : "a" (jmp_addr));
727jmp_addr_label040:
728 /* disable translation on '040 now */
729 asm volatile ("\n"
730 " moveq #0,%%d0\n"
731 " .chip 68040\n"
732 " movec %%d0,%%tc\n" /* disable MMU */
733 " .chip 68k\n"
734 : /* no outputs */
735 : /* no inputs */
736 : "d0");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737
Roman Zippel6ff58012007-05-01 22:32:43 +0200738 jmp_addr_label:
739 /* pickup reset address from AmigaOS ROM, reset devices and jump
740 * to reset address
741 */
742 asm volatile ("\n"
743 " move.w #0x2700,%sr\n"
744 " lea 0x01000000,%a0\n"
745 " sub.l %a0@(-0x14),%a0\n"
746 " move.l %a0@(4),%a0\n"
747 " subq.l #2,%a0\n"
748 " jra 1f\n"
749 /* align on a longword boundary */
750 " " __ALIGN_STR "\n"
751 "1:\n"
752 " reset\n"
753 " jmp %a0@");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754
Roman Zippel6ff58012007-05-01 22:32:43 +0200755 for (;;)
756 ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757}
758
759
760 /*
761 * Debugging
762 */
763
764#define SAVEKMSG_MAXMEM 128*1024
765
766#define SAVEKMSG_MAGIC1 0x53415645 /* 'SAVE' */
767#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
768
769struct savekmsg {
Roman Zippel6ff58012007-05-01 22:32:43 +0200770 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
771 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
772 unsigned long magicptr; /* address of magic1 */
773 unsigned long size;
774 char data[0];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775};
776
777static struct savekmsg *savekmsg;
778
779static void amiga_mem_console_write(struct console *co, const char *s,
780 unsigned int count)
781{
Roman Zippel6ff58012007-05-01 22:32:43 +0200782 if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
783 memcpy(savekmsg->data + savekmsg->size, s, count);
784 savekmsg->size += count;
785 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786}
787
Roman Zippeld6713b42007-05-01 22:32:45 +0200788static int __init amiga_savekmsg_setup(char *arg)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789{
Roman Zippel6ff58012007-05-01 22:32:43 +0200790 static struct resource debug_res = { .name = "Debug" };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791
Roman Zippeld6713b42007-05-01 22:32:45 +0200792 if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
793 goto done;
794
795 if (!AMIGAHW_PRESENT(CHIP_RAM)) {
796 printk("Warning: no chipram present for debugging\n");
797 goto done;
798 }
799
Roman Zippel6ff58012007-05-01 22:32:43 +0200800 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
801 savekmsg->magic1 = SAVEKMSG_MAGIC1;
802 savekmsg->magic2 = SAVEKMSG_MAGIC2;
803 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
804 savekmsg->size = 0;
Roman Zippeld6713b42007-05-01 22:32:45 +0200805
806 amiga_console_driver.write = amiga_mem_console_write;
807 register_console(&amiga_console_driver);
808
809done:
810 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811}
812
Roman Zippeld6713b42007-05-01 22:32:45 +0200813early_param("debug", amiga_savekmsg_setup);
814
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815static void amiga_serial_putc(char c)
816{
Roman Zippel6ff58012007-05-01 22:32:43 +0200817 amiga_custom.serdat = (unsigned char)c | 0x100;
818 while (!(amiga_custom.serdatr & 0x2000))
819 ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820}
821
822void amiga_serial_console_write(struct console *co, const char *s,
Roman Zippel6ff58012007-05-01 22:32:43 +0200823 unsigned int count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824{
Roman Zippel6ff58012007-05-01 22:32:43 +0200825 while (count--) {
826 if (*s == '\n')
827 amiga_serial_putc('\r');
828 amiga_serial_putc(*s++);
829 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830}
831
832#ifdef CONFIG_SERIAL_CONSOLE
833void amiga_serial_puts(const char *s)
834{
Roman Zippel6ff58012007-05-01 22:32:43 +0200835 amiga_serial_console_write(NULL, s, strlen(s));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836}
837
838int amiga_serial_console_wait_key(struct console *co)
839{
Roman Zippel6ff58012007-05-01 22:32:43 +0200840 int ch;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841
Roman Zippel6ff58012007-05-01 22:32:43 +0200842 while (!(amiga_custom.intreqr & IF_RBF))
843 barrier();
844 ch = amiga_custom.serdatr & 0xff;
845 /* clear the interrupt, so that another character can be read */
846 amiga_custom.intreq = IF_RBF;
847 return ch;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700848}
849
850void amiga_serial_gets(struct console *co, char *s, int len)
851{
Roman Zippel6ff58012007-05-01 22:32:43 +0200852 int ch, cnt = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700853
Roman Zippel6ff58012007-05-01 22:32:43 +0200854 while (1) {
855 ch = amiga_serial_console_wait_key(co);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856
Roman Zippel6ff58012007-05-01 22:32:43 +0200857 /* Check for backspace. */
858 if (ch == 8 || ch == 127) {
859 if (cnt == 0) {
860 amiga_serial_putc('\007');
861 continue;
862 }
863 cnt--;
864 amiga_serial_puts("\010 \010");
865 continue;
866 }
867
868 /* Check for enter. */
869 if (ch == 10 || ch == 13)
870 break;
871
872 /* See if line is too long. */
873 if (cnt >= len + 1) {
874 amiga_serial_putc(7);
875 cnt--;
876 continue;
877 }
878
879 /* Store and echo character. */
880 s[cnt++] = ch;
881 amiga_serial_putc(ch);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700882 }
Roman Zippel6ff58012007-05-01 22:32:43 +0200883 /* Print enter. */
884 amiga_serial_puts("\r\n");
885 s[cnt] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700886}
887#endif
888
Roman Zippeld6713b42007-05-01 22:32:45 +0200889static int __init amiga_debug_setup(char *arg)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890{
Roman Zippeld6713b42007-05-01 22:32:45 +0200891 if (MACH_IS_AMIGA && !strcmp(arg, "ser")) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892 /* no initialization required (?) */
893 amiga_console_driver.write = amiga_serial_console_write;
894 register_console(&amiga_console_driver);
895 }
Roman Zippeld6713b42007-05-01 22:32:45 +0200896 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897}
898
Roman Zippeld6713b42007-05-01 22:32:45 +0200899early_param("debug", amiga_debug_setup);
900
Linus Torvalds1da177e2005-04-16 15:20:36 -0700901#ifdef CONFIG_HEARTBEAT
902static void amiga_heartbeat(int on)
903{
Roman Zippel6ff58012007-05-01 22:32:43 +0200904 if (on)
905 ciaa.pra &= ~2;
906 else
907 ciaa.pra |= 2;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700908}
909#endif
910
911 /*
912 * Amiga specific parts of /proc
913 */
914
915static void amiga_get_model(char *model)
916{
Roman Zippel6ff58012007-05-01 22:32:43 +0200917 strcpy(model, amiga_model_name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700918}
919
920
921static int amiga_get_hardware_list(char *buffer)
922{
Roman Zippel6ff58012007-05-01 22:32:43 +0200923 int len = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700924
Roman Zippel6ff58012007-05-01 22:32:43 +0200925 if (AMIGAHW_PRESENT(CHIP_RAM))
926 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
927 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
928 amiga_psfreq, amiga_eclock);
929 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
930 char *type;
931 switch (amiga_chipset) {
932 case CS_OCS:
933 type = "OCS";
934 break;
935 case CS_ECS:
936 type = "ECS";
937 break;
938 case CS_AGA:
939 type = "AGA";
940 break;
941 default:
942 type = "Old or Unknown";
943 break;
944 }
945 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700946 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947
948#define AMIGAHW_ANNOUNCE(name, str) \
Roman Zippel6ff58012007-05-01 22:32:43 +0200949 if (AMIGAHW_PRESENT(name)) \
950 len += sprintf (buffer+len, "\t%s\n", str)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951
Roman Zippel6ff58012007-05-01 22:32:43 +0200952 len += sprintf (buffer + len, "Detected hardware:\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700953
Roman Zippel6ff58012007-05-01 22:32:43 +0200954 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
955 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
956 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
957 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
958 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
959 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
960 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
961 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
962 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
963 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
964 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
965 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
966 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
967 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
968 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
969 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
970 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
971 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
972 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
973 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
974 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
975 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
976 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
977 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
978 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
979 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
980 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
981 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
982 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700983#ifdef CONFIG_ZORRO
Roman Zippel6ff58012007-05-01 22:32:43 +0200984 if (AMIGAHW_PRESENT(ZORRO))
985 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
986 "Device%s\n",
987 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
988 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700989#endif /* CONFIG_ZORRO */
990
991#undef AMIGAHW_ANNOUNCE
992
Roman Zippel6ff58012007-05-01 22:32:43 +0200993 return len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700994}