[PATCH] m68k: kill mach_floppy_setup, convert to proper __setup() in drivers
[linux-2.6.git] / arch / ppc / amiga / bootinfo.c
1 /*
2  *  arch/ppc/amiga/bootinfo.c
3  *
4  *  Extracted from arch/m68k/kernel/setup.c.
5  *  Should be properly generalized and put somewhere else.
6  *                              Jesper
7  */
8
9 #include <linux/types.h>
10 #include <linux/kernel.h>
11 #include <linux/string.h>
12 #include <linux/init.h>
13
14 #include <asm/setup.h>
15 #include <asm/bootinfo.h>
16
17 extern char cmd_line[CL_SIZE];
18
19 extern int num_memory;
20 extern int m68k_realnum_memory;
21 extern struct mem_info memory[NUM_MEMINFO];
22 extern struct mem_info m68k_memory[NUM_MEMINFO];
23 extern struct mem_info ramdisk;
24
25 extern int amiga_parse_bootinfo(const struct bi_record *);
26 extern int atari_parse_bootinfo(const struct bi_record *);
27 extern int mac_parse_bootinfo(const struct bi_record *);
28
29 void __init parse_bootinfo(const struct bi_record *record)
30 {
31     while (record->tag != BI_LAST) {
32         int unknown = 0;
33         const u_long *data = record->data;
34         switch (record->tag) {
35             case BI_MACHTYPE:
36             case BI_CPUTYPE:
37             case BI_FPUTYPE:
38             case BI_MMUTYPE:
39                 /* Already set up by head.S */
40                 break;
41
42             case BI_MEMCHUNK:
43                 if (num_memory < NUM_MEMINFO) {
44                     memory[num_memory].addr = data[0];
45                     memory[num_memory].size = data[1];
46                     num_memory++;
47
48                     /* FIXME: duplicate for m68k drivers. */
49                     m68k_memory[m68k_realnum_memory].addr = data[0];
50                     m68k_memory[m68k_realnum_memory].size = data[1];
51                     m68k_realnum_memory++;
52                 } else
53                     printk("parse_bootinfo: too many memory chunks\n");
54                 break;
55
56             case BI_RAMDISK:
57                 ramdisk.addr = data[0];
58                 ramdisk.size = data[1];
59                 break;
60
61             case BI_COMMAND_LINE:
62                 strlcpy(cmd_line, (const char *)data, sizeof(cmd_line));
63                 break;
64
65             default:
66                 if (MACH_IS_AMIGA)
67                     unknown = amiga_parse_bootinfo(record);
68                 else if (MACH_IS_ATARI)
69                     unknown = atari_parse_bootinfo(record);
70                 else if (MACH_IS_MAC)
71                     unknown = mac_parse_bootinfo(record);
72                 else
73                     unknown = 1;
74         }
75         if (unknown)
76             printk("parse_bootinfo: unknown tag 0x%04x ignored\n",
77                    record->tag);
78         record = (struct bi_record *)((u_long)record+record->size);
79     }
80 }