diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2012-08-31 22:00:15 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-09-03 17:55:56 -0400 |
commit | aa783b6fd60b3844e199b1c2d2f4068f3caa1358 (patch) | |
tree | 393501d8ef825c12a18314981ca20f75120c79c3 /arch/arm/kernel | |
parent | 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d (diff) |
ARM: 7505/1: split out ATAGS parsing
Make ATAGS parsing into a source file of its own, namely atags_parse.c.
Also rename compat.c to atags_compat.c to make it clearer what it is
about. Same for atags.c which is now atags_proc.c. Gather all the atags
function declarations into a common atags.h.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/Makefile | 6 | ||||
-rw-r--r-- | arch/arm/kernel/atags.h | 3 | ||||
-rw-r--r-- | arch/arm/kernel/atags_compat.c (renamed from arch/arm/kernel/compat.c) | 4 | ||||
-rw-r--r-- | arch/arm/kernel/atags_parse.c | 238 | ||||
-rw-r--r-- | arch/arm/kernel/atags_proc.c (renamed from arch/arm/kernel/atags.c) | 0 | ||||
-rw-r--r-- | arch/arm/kernel/compat.h | 11 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 236 |
7 files changed, 247 insertions, 251 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 7ad2d5cf7008..086c9d3bc360 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -15,11 +15,11 @@ CFLAGS_REMOVE_return_address.o = -pg | |||
15 | 15 | ||
16 | # Object file lists. | 16 | # Object file lists. |
17 | 17 | ||
18 | obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ | 18 | obj-y := atags_parse.o elf.o entry-armv.o entry-common.o irq.o opcodes.o \ |
19 | process.o ptrace.o return_address.o sched_clock.o \ | 19 | process.o ptrace.o return_address.o sched_clock.o \ |
20 | setup.o signal.o stacktrace.o sys_arm.o time.o traps.o | 20 | setup.o signal.o stacktrace.o sys_arm.o time.o traps.o |
21 | 21 | ||
22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o | 22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o |
23 | 23 | ||
24 | obj-$(CONFIG_LEDS) += leds.o | 24 | obj-$(CONFIG_LEDS) += leds.o |
25 | obj-$(CONFIG_OC_ETM) += etm.o | 25 | obj-$(CONFIG_OC_ETM) += etm.o |
@@ -52,7 +52,7 @@ test-kprobes-objs += kprobes-test-thumb.o | |||
52 | else | 52 | else |
53 | test-kprobes-objs += kprobes-test-arm.o | 53 | test-kprobes-objs += kprobes-test-arm.o |
54 | endif | 54 | endif |
55 | obj-$(CONFIG_ATAGS_PROC) += atags.o | 55 | obj-$(CONFIG_ATAGS_PROC) += atags_proc.o |
56 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o | 56 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o |
57 | obj-$(CONFIG_ARM_THUMBEE) += thumbee.o | 57 | obj-$(CONFIG_ARM_THUMBEE) += thumbee.o |
58 | obj-$(CONFIG_KGDB) += kgdb.o | 58 | obj-$(CONFIG_KGDB) += kgdb.o |
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h index e5f028d214a1..a888fdd381b5 100644 --- a/arch/arm/kernel/atags.h +++ b/arch/arm/kernel/atags.h | |||
@@ -3,3 +3,6 @@ extern void save_atags(struct tag *tags); | |||
3 | #else | 3 | #else |
4 | static inline void save_atags(struct tag *tags) { } | 4 | static inline void save_atags(struct tag *tags) { } |
5 | #endif | 5 | #endif |
6 | |||
7 | void convert_to_tag_list(struct tag *tags); | ||
8 | struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr); | ||
diff --git a/arch/arm/kernel/compat.c b/arch/arm/kernel/atags_compat.c index 925652318b8b..5236ad38f417 100644 --- a/arch/arm/kernel/compat.c +++ b/arch/arm/kernel/atags_compat.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/kernel/compat.c | 2 | * linux/arch/arm/kernel/atags_compat.c |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Russell King | 4 | * Copyright (C) 2001 Russell King |
5 | * | 5 | * |
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
28 | 28 | ||
29 | #include "compat.h" | 29 | #include "atags.h" |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Usage: | 32 | * Usage: |
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c new file mode 100644 index 000000000000..14512e6931d8 --- /dev/null +++ b/arch/arm/kernel/atags_parse.c | |||
@@ -0,0 +1,238 @@ | |||
1 | /* | ||
2 | * Tag parsing. | ||
3 | * | ||
4 | * Copyright (C) 1995-2001 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This is the traditional way of passing data to the kernel at boot time. Rather | ||
13 | * than passing a fixed inflexible structure to the kernel, we pass a list | ||
14 | * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE | ||
15 | * tag for the list to be recognised (to distinguish the tagged list from | ||
16 | * a param_struct). The list is terminated with a zero-length tag (this tag | ||
17 | * is not parsed in any way). | ||
18 | */ | ||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/fs.h> | ||
23 | #include <linux/root_dev.h> | ||
24 | #include <linux/screen_info.h> | ||
25 | |||
26 | #include <asm/setup.h> | ||
27 | #include <asm/system_info.h> | ||
28 | #include <asm/page.h> | ||
29 | #include <asm/mach/arch.h> | ||
30 | |||
31 | #include "atags.h" | ||
32 | |||
33 | static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; | ||
34 | |||
35 | #ifndef MEM_SIZE | ||
36 | #define MEM_SIZE (16*1024*1024) | ||
37 | #endif | ||
38 | |||
39 | static struct { | ||
40 | struct tag_header hdr1; | ||
41 | struct tag_core core; | ||
42 | struct tag_header hdr2; | ||
43 | struct tag_mem32 mem; | ||
44 | struct tag_header hdr3; | ||
45 | } default_tags __initdata = { | ||
46 | { tag_size(tag_core), ATAG_CORE }, | ||
47 | { 1, PAGE_SIZE, 0xff }, | ||
48 | { tag_size(tag_mem32), ATAG_MEM }, | ||
49 | { MEM_SIZE }, | ||
50 | { 0, ATAG_NONE } | ||
51 | }; | ||
52 | |||
53 | static int __init parse_tag_core(const struct tag *tag) | ||
54 | { | ||
55 | if (tag->hdr.size > 2) { | ||
56 | if ((tag->u.core.flags & 1) == 0) | ||
57 | root_mountflags &= ~MS_RDONLY; | ||
58 | ROOT_DEV = old_decode_dev(tag->u.core.rootdev); | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | __tagtable(ATAG_CORE, parse_tag_core); | ||
64 | |||
65 | static int __init parse_tag_mem32(const struct tag *tag) | ||
66 | { | ||
67 | return arm_add_memory(tag->u.mem.start, tag->u.mem.size); | ||
68 | } | ||
69 | |||
70 | __tagtable(ATAG_MEM, parse_tag_mem32); | ||
71 | |||
72 | #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) | ||
73 | static int __init parse_tag_videotext(const struct tag *tag) | ||
74 | { | ||
75 | screen_info.orig_x = tag->u.videotext.x; | ||
76 | screen_info.orig_y = tag->u.videotext.y; | ||
77 | screen_info.orig_video_page = tag->u.videotext.video_page; | ||
78 | screen_info.orig_video_mode = tag->u.videotext.video_mode; | ||
79 | screen_info.orig_video_cols = tag->u.videotext.video_cols; | ||
80 | screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; | ||
81 | screen_info.orig_video_lines = tag->u.videotext.video_lines; | ||
82 | screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; | ||
83 | screen_info.orig_video_points = tag->u.videotext.video_points; | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | __tagtable(ATAG_VIDEOTEXT, parse_tag_videotext); | ||
88 | #endif | ||
89 | |||
90 | #ifdef CONFIG_BLK_DEV_RAM | ||
91 | static int __init parse_tag_ramdisk(const struct tag *tag) | ||
92 | { | ||
93 | extern int rd_size, rd_image_start, rd_prompt, rd_doload; | ||
94 | |||
95 | rd_image_start = tag->u.ramdisk.start; | ||
96 | rd_doload = (tag->u.ramdisk.flags & 1) == 0; | ||
97 | rd_prompt = (tag->u.ramdisk.flags & 2) == 0; | ||
98 | |||
99 | if (tag->u.ramdisk.size) | ||
100 | rd_size = tag->u.ramdisk.size; | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | __tagtable(ATAG_RAMDISK, parse_tag_ramdisk); | ||
106 | #endif | ||
107 | |||
108 | static int __init parse_tag_serialnr(const struct tag *tag) | ||
109 | { | ||
110 | system_serial_low = tag->u.serialnr.low; | ||
111 | system_serial_high = tag->u.serialnr.high; | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | __tagtable(ATAG_SERIAL, parse_tag_serialnr); | ||
116 | |||
117 | static int __init parse_tag_revision(const struct tag *tag) | ||
118 | { | ||
119 | system_rev = tag->u.revision.rev; | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | __tagtable(ATAG_REVISION, parse_tag_revision); | ||
124 | |||
125 | static int __init parse_tag_cmdline(const struct tag *tag) | ||
126 | { | ||
127 | #if defined(CONFIG_CMDLINE_EXTEND) | ||
128 | strlcat(default_command_line, " ", COMMAND_LINE_SIZE); | ||
129 | strlcat(default_command_line, tag->u.cmdline.cmdline, | ||
130 | COMMAND_LINE_SIZE); | ||
131 | #elif defined(CONFIG_CMDLINE_FORCE) | ||
132 | pr_warning("Ignoring tag cmdline (using the default kernel command line)\n"); | ||
133 | #else | ||
134 | strlcpy(default_command_line, tag->u.cmdline.cmdline, | ||
135 | COMMAND_LINE_SIZE); | ||
136 | #endif | ||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | __tagtable(ATAG_CMDLINE, parse_tag_cmdline); | ||
141 | |||
142 | /* | ||
143 | * Scan the tag table for this tag, and call its parse function. | ||
144 | * The tag table is built by the linker from all the __tagtable | ||
145 | * declarations. | ||
146 | */ | ||
147 | static int __init parse_tag(const struct tag *tag) | ||
148 | { | ||
149 | extern struct tagtable __tagtable_begin, __tagtable_end; | ||
150 | struct tagtable *t; | ||
151 | |||
152 | for (t = &__tagtable_begin; t < &__tagtable_end; t++) | ||
153 | if (tag->hdr.tag == t->tag) { | ||
154 | t->parse(tag); | ||
155 | break; | ||
156 | } | ||
157 | |||
158 | return t < &__tagtable_end; | ||
159 | } | ||
160 | |||
161 | /* | ||
162 | * Parse all tags in the list, checking both the global and architecture | ||
163 | * specific tag tables. | ||
164 | */ | ||
165 | static void __init parse_tags(const struct tag *t) | ||
166 | { | ||
167 | for (; t->hdr.size; t = tag_next(t)) | ||
168 | if (!parse_tag(t)) | ||
169 | printk(KERN_WARNING | ||
170 | "Ignoring unrecognised tag 0x%08x\n", | ||
171 | t->hdr.tag); | ||
172 | } | ||
173 | |||
174 | static void __init squash_mem_tags(struct tag *tag) | ||
175 | { | ||
176 | for (; tag->hdr.size; tag = tag_next(tag)) | ||
177 | if (tag->hdr.tag == ATAG_MEM) | ||
178 | tag->hdr.tag = ATAG_NONE; | ||
179 | } | ||
180 | |||
181 | struct machine_desc * __init setup_machine_tags(phys_addr_t __atags_pointer, | ||
182 | unsigned int machine_nr) | ||
183 | { | ||
184 | struct tag *tags = (struct tag *)&default_tags; | ||
185 | struct machine_desc *mdesc = NULL, *p; | ||
186 | char *from = default_command_line; | ||
187 | |||
188 | default_tags.mem.start = PHYS_OFFSET; | ||
189 | |||
190 | /* | ||
191 | * locate machine in the list of supported machines. | ||
192 | */ | ||
193 | for_each_machine_desc(p) | ||
194 | if (machine_nr == p->nr) { | ||
195 | printk("Machine: %s\n", p->name); | ||
196 | mdesc = p; | ||
197 | break; | ||
198 | } | ||
199 | |||
200 | if (!mdesc) { | ||
201 | early_print("\nError: unrecognized/unsupported machine ID" | ||
202 | " (r1 = 0x%08x).\n\n", machine_nr); | ||
203 | dump_machine_table(); /* does not return */ | ||
204 | } | ||
205 | |||
206 | if (__atags_pointer) | ||
207 | tags = phys_to_virt(__atags_pointer); | ||
208 | else if (mdesc->atag_offset) | ||
209 | tags = (void *)(PAGE_OFFSET + mdesc->atag_offset); | ||
210 | |||
211 | #if defined(CONFIG_DEPRECATED_PARAM_STRUCT) | ||
212 | /* | ||
213 | * If we have the old style parameters, convert them to | ||
214 | * a tag list. | ||
215 | */ | ||
216 | if (tags->hdr.tag != ATAG_CORE) | ||
217 | convert_to_tag_list(tags); | ||
218 | #endif | ||
219 | if (tags->hdr.tag != ATAG_CORE) { | ||
220 | early_print("Warning: Neither atags nor dtb found\n"); | ||
221 | tags = (struct tag *)&default_tags; | ||
222 | } | ||
223 | |||
224 | if (mdesc->fixup) | ||
225 | mdesc->fixup(tags, &from, &meminfo); | ||
226 | |||
227 | if (tags->hdr.tag == ATAG_CORE) { | ||
228 | if (meminfo.nr_banks != 0) | ||
229 | squash_mem_tags(tags); | ||
230 | save_atags(tags); | ||
231 | parse_tags(tags); | ||
232 | } | ||
233 | |||
234 | /* parse_early_param needs a boot_command_line */ | ||
235 | strlcpy(boot_command_line, from, COMMAND_LINE_SIZE); | ||
236 | |||
237 | return mdesc; | ||
238 | } | ||
diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags_proc.c index 42a1a1415fa6..42a1a1415fa6 100644 --- a/arch/arm/kernel/atags.c +++ b/arch/arm/kernel/atags_proc.c | |||
diff --git a/arch/arm/kernel/compat.h b/arch/arm/kernel/compat.h deleted file mode 100644 index 39264ab1b9c6..000000000000 --- a/arch/arm/kernel/compat.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/kernel/compat.h | ||
3 | * | ||
4 | * Copyright (C) 2001 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | extern void convert_to_tag_list(struct tag *tags); | ||
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index a81dcecc7343..0785472460a8 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -21,11 +21,9 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/kexec.h> | 22 | #include <linux/kexec.h> |
23 | #include <linux/of_fdt.h> | 23 | #include <linux/of_fdt.h> |
24 | #include <linux/root_dev.h> | ||
25 | #include <linux/cpu.h> | 24 | #include <linux/cpu.h> |
26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
27 | #include <linux/smp.h> | 26 | #include <linux/smp.h> |
28 | #include <linux/fs.h> | ||
29 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
30 | #include <linux/memblock.h> | 28 | #include <linux/memblock.h> |
31 | #include <linux/bug.h> | 29 | #include <linux/bug.h> |
@@ -56,15 +54,9 @@ | |||
56 | #include <asm/unwind.h> | 54 | #include <asm/unwind.h> |
57 | #include <asm/memblock.h> | 55 | #include <asm/memblock.h> |
58 | 56 | ||
59 | #if defined(CONFIG_DEPRECATED_PARAM_STRUCT) | ||
60 | #include "compat.h" | ||
61 | #endif | ||
62 | #include "atags.h" | 57 | #include "atags.h" |
63 | #include "tcm.h" | 58 | #include "tcm.h" |
64 | 59 | ||
65 | #ifndef MEM_SIZE | ||
66 | #define MEM_SIZE (16*1024*1024) | ||
67 | #endif | ||
68 | 60 | ||
69 | #if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE) | 61 | #if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE) |
70 | char fpe_type[8]; | 62 | char fpe_type[8]; |
@@ -145,7 +137,6 @@ static const char *machine_name; | |||
145 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; | 137 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; |
146 | struct machine_desc *machine_desc __initdata; | 138 | struct machine_desc *machine_desc __initdata; |
147 | 139 | ||
148 | static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; | ||
149 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; | 140 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; |
150 | #define ENDIANNESS ((char)endian_test.l) | 141 | #define ENDIANNESS ((char)endian_test.l) |
151 | 142 | ||
@@ -583,21 +574,6 @@ static int __init early_mem(char *p) | |||
583 | } | 574 | } |
584 | early_param("mem", early_mem); | 575 | early_param("mem", early_mem); |
585 | 576 | ||
586 | static void __init | ||
587 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) | ||
588 | { | ||
589 | #ifdef CONFIG_BLK_DEV_RAM | ||
590 | extern int rd_size, rd_image_start, rd_prompt, rd_doload; | ||
591 | |||
592 | rd_image_start = image_start; | ||
593 | rd_prompt = prompt; | ||
594 | rd_doload = doload; | ||
595 | |||
596 | if (rd_sz) | ||
597 | rd_size = rd_sz; | ||
598 | #endif | ||
599 | } | ||
600 | |||
601 | static void __init request_standard_resources(struct machine_desc *mdesc) | 577 | static void __init request_standard_resources(struct machine_desc *mdesc) |
602 | { | 578 | { |
603 | struct memblock_region *region; | 579 | struct memblock_region *region; |
@@ -643,35 +619,6 @@ static void __init request_standard_resources(struct machine_desc *mdesc) | |||
643 | request_resource(&ioport_resource, &lp2); | 619 | request_resource(&ioport_resource, &lp2); |
644 | } | 620 | } |
645 | 621 | ||
646 | /* | ||
647 | * Tag parsing. | ||
648 | * | ||
649 | * This is the new way of passing data to the kernel at boot time. Rather | ||
650 | * than passing a fixed inflexible structure to the kernel, we pass a list | ||
651 | * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE | ||
652 | * tag for the list to be recognised (to distinguish the tagged list from | ||
653 | * a param_struct). The list is terminated with a zero-length tag (this tag | ||
654 | * is not parsed in any way). | ||
655 | */ | ||
656 | static int __init parse_tag_core(const struct tag *tag) | ||
657 | { | ||
658 | if (tag->hdr.size > 2) { | ||
659 | if ((tag->u.core.flags & 1) == 0) | ||
660 | root_mountflags &= ~MS_RDONLY; | ||
661 | ROOT_DEV = old_decode_dev(tag->u.core.rootdev); | ||
662 | } | ||
663 | return 0; | ||
664 | } | ||
665 | |||
666 | __tagtable(ATAG_CORE, parse_tag_core); | ||
667 | |||
668 | static int __init parse_tag_mem32(const struct tag *tag) | ||
669 | { | ||
670 | return arm_add_memory(tag->u.mem.start, tag->u.mem.size); | ||
671 | } | ||
672 | |||
673 | __tagtable(ATAG_MEM, parse_tag_mem32); | ||
674 | |||
675 | #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) | 622 | #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) |
676 | struct screen_info screen_info = { | 623 | struct screen_info screen_info = { |
677 | .orig_video_lines = 30, | 624 | .orig_video_lines = 30, |
@@ -681,117 +628,8 @@ struct screen_info screen_info = { | |||
681 | .orig_video_isVGA = 1, | 628 | .orig_video_isVGA = 1, |
682 | .orig_video_points = 8 | 629 | .orig_video_points = 8 |
683 | }; | 630 | }; |
684 | |||
685 | static int __init parse_tag_videotext(const struct tag *tag) | ||
686 | { | ||
687 | screen_info.orig_x = tag->u.videotext.x; | ||
688 | screen_info.orig_y = tag->u.videotext.y; | ||
689 | screen_info.orig_video_page = tag->u.videotext.video_page; | ||
690 | screen_info.orig_video_mode = tag->u.videotext.video_mode; | ||
691 | screen_info.orig_video_cols = tag->u.videotext.video_cols; | ||
692 | screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; | ||
693 | screen_info.orig_video_lines = tag->u.videotext.video_lines; | ||
694 | screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; | ||
695 | screen_info.orig_video_points = tag->u.videotext.video_points; | ||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | __tagtable(ATAG_VIDEOTEXT, parse_tag_videotext); | ||
700 | #endif | 631 | #endif |
701 | 632 | ||
702 | static int __init parse_tag_ramdisk(const struct tag *tag) | ||
703 | { | ||
704 | setup_ramdisk((tag->u.ramdisk.flags & 1) == 0, | ||
705 | (tag->u.ramdisk.flags & 2) == 0, | ||
706 | tag->u.ramdisk.start, tag->u.ramdisk.size); | ||
707 | return 0; | ||
708 | } | ||
709 | |||
710 | __tagtable(ATAG_RAMDISK, parse_tag_ramdisk); | ||
711 | |||
712 | static int __init parse_tag_serialnr(const struct tag *tag) | ||
713 | { | ||
714 | system_serial_low = tag->u.serialnr.low; | ||
715 | system_serial_high = tag->u.serialnr.high; | ||
716 | return 0; | ||
717 | } | ||
718 | |||
719 | __tagtable(ATAG_SERIAL, parse_tag_serialnr); | ||
720 | |||
721 | static int __init parse_tag_revision(const struct tag *tag) | ||
722 | { | ||
723 | system_rev = tag->u.revision.rev; | ||
724 | return 0; | ||
725 | } | ||
726 | |||
727 | __tagtable(ATAG_REVISION, parse_tag_revision); | ||
728 | |||
729 | static int __init parse_tag_cmdline(const struct tag *tag) | ||
730 | { | ||
731 | #if defined(CONFIG_CMDLINE_EXTEND) | ||
732 | strlcat(default_command_line, " ", COMMAND_LINE_SIZE); | ||
733 | strlcat(default_command_line, tag->u.cmdline.cmdline, | ||
734 | COMMAND_LINE_SIZE); | ||
735 | #elif defined(CONFIG_CMDLINE_FORCE) | ||
736 | pr_warning("Ignoring tag cmdline (using the default kernel command line)\n"); | ||
737 | #else | ||
738 | strlcpy(default_command_line, tag->u.cmdline.cmdline, | ||
739 | COMMAND_LINE_SIZE); | ||
740 | #endif | ||
741 | return 0; | ||
742 | } | ||
743 | |||
744 | __tagtable(ATAG_CMDLINE, parse_tag_cmdline); | ||
745 | |||
746 | /* | ||
747 | * Scan the tag table for this tag, and call its parse function. | ||
748 | * The tag table is built by the linker from all the __tagtable | ||
749 | * declarations. | ||
750 | */ | ||
751 | static int __init parse_tag(const struct tag *tag) | ||
752 | { | ||
753 | extern struct tagtable __tagtable_begin, __tagtable_end; | ||
754 | struct tagtable *t; | ||
755 | |||
756 | for (t = &__tagtable_begin; t < &__tagtable_end; t++) | ||
757 | if (tag->hdr.tag == t->tag) { | ||
758 | t->parse(tag); | ||
759 | break; | ||
760 | } | ||
761 | |||
762 | return t < &__tagtable_end; | ||
763 | } | ||
764 | |||
765 | /* | ||
766 | * Parse all tags in the list, checking both the global and architecture | ||
767 | * specific tag tables. | ||
768 | */ | ||
769 | static void __init parse_tags(const struct tag *t) | ||
770 | { | ||
771 | for (; t->hdr.size; t = tag_next(t)) | ||
772 | if (!parse_tag(t)) | ||
773 | printk(KERN_WARNING | ||
774 | "Ignoring unrecognised tag 0x%08x\n", | ||
775 | t->hdr.tag); | ||
776 | } | ||
777 | |||
778 | /* | ||
779 | * This holds our defaults. | ||
780 | */ | ||
781 | static struct init_tags { | ||
782 | struct tag_header hdr1; | ||
783 | struct tag_core core; | ||
784 | struct tag_header hdr2; | ||
785 | struct tag_mem32 mem; | ||
786 | struct tag_header hdr3; | ||
787 | } init_tags __initdata = { | ||
788 | { tag_size(tag_core), ATAG_CORE }, | ||
789 | { 1, PAGE_SIZE, 0xff }, | ||
790 | { tag_size(tag_mem32), ATAG_MEM }, | ||
791 | { MEM_SIZE }, | ||
792 | { 0, ATAG_NONE } | ||
793 | }; | ||
794 | |||
795 | static int __init customize_machine(void) | 633 | static int __init customize_machine(void) |
796 | { | 634 | { |
797 | /* customizes platform devices, or adds new ones */ | 635 | /* customizes platform devices, or adds new ones */ |
@@ -858,78 +696,6 @@ static void __init reserve_crashkernel(void) | |||
858 | static inline void reserve_crashkernel(void) {} | 696 | static inline void reserve_crashkernel(void) {} |
859 | #endif /* CONFIG_KEXEC */ | 697 | #endif /* CONFIG_KEXEC */ |
860 | 698 | ||
861 | static void __init squash_mem_tags(struct tag *tag) | ||
862 | { | ||
863 | for (; tag->hdr.size; tag = tag_next(tag)) | ||
864 | if (tag->hdr.tag == ATAG_MEM) | ||
865 | tag->hdr.tag = ATAG_NONE; | ||
866 | } | ||
867 | |||
868 | static struct machine_desc * __init setup_machine_tags(unsigned int nr) | ||
869 | { | ||
870 | struct tag *tags = (struct tag *)&init_tags; | ||
871 | struct machine_desc *mdesc = NULL, *p; | ||
872 | char *from = default_command_line; | ||
873 | |||
874 | init_tags.mem.start = PHYS_OFFSET; | ||
875 | |||
876 | /* | ||
877 | * locate machine in the list of supported machines. | ||
878 | */ | ||
879 | for_each_machine_desc(p) | ||
880 | if (nr == p->nr) { | ||
881 | printk("Machine: %s\n", p->name); | ||
882 | mdesc = p; | ||
883 | break; | ||
884 | } | ||
885 | |||
886 | if (!mdesc) { | ||
887 | early_print("\nError: unrecognized/unsupported machine ID" | ||
888 | " (r1 = 0x%08x).\n\n", nr); | ||
889 | dump_machine_table(); /* does not return */ | ||
890 | } | ||
891 | |||
892 | if (__atags_pointer) | ||
893 | tags = phys_to_virt(__atags_pointer); | ||
894 | else if (mdesc->atag_offset) | ||
895 | tags = (void *)(PAGE_OFFSET + mdesc->atag_offset); | ||
896 | |||
897 | #if defined(CONFIG_DEPRECATED_PARAM_STRUCT) | ||
898 | /* | ||
899 | * If we have the old style parameters, convert them to | ||
900 | * a tag list. | ||
901 | */ | ||
902 | if (tags->hdr.tag != ATAG_CORE) | ||
903 | convert_to_tag_list(tags); | ||
904 | #endif | ||
905 | |||
906 | if (tags->hdr.tag != ATAG_CORE) { | ||
907 | #if defined(CONFIG_OF) | ||
908 | /* | ||
909 | * If CONFIG_OF is set, then assume this is a reasonably | ||
910 | * modern system that should pass boot parameters | ||
911 | */ | ||
912 | early_print("Warning: Neither atags nor dtb found\n"); | ||
913 | #endif | ||
914 | tags = (struct tag *)&init_tags; | ||
915 | } | ||
916 | |||
917 | if (mdesc->fixup) | ||
918 | mdesc->fixup(tags, &from, &meminfo); | ||
919 | |||
920 | if (tags->hdr.tag == ATAG_CORE) { | ||
921 | if (meminfo.nr_banks != 0) | ||
922 | squash_mem_tags(tags); | ||
923 | save_atags(tags); | ||
924 | parse_tags(tags); | ||
925 | } | ||
926 | |||
927 | /* parse_early_param needs a boot_command_line */ | ||
928 | strlcpy(boot_command_line, from, COMMAND_LINE_SIZE); | ||
929 | |||
930 | return mdesc; | ||
931 | } | ||
932 | |||
933 | static int __init meminfo_cmp(const void *_a, const void *_b) | 699 | static int __init meminfo_cmp(const void *_a, const void *_b) |
934 | { | 700 | { |
935 | const struct membank *a = _a, *b = _b; | 701 | const struct membank *a = _a, *b = _b; |
@@ -944,7 +710,7 @@ void __init setup_arch(char **cmdline_p) | |||
944 | setup_processor(); | 710 | setup_processor(); |
945 | mdesc = setup_machine_fdt(__atags_pointer); | 711 | mdesc = setup_machine_fdt(__atags_pointer); |
946 | if (!mdesc) | 712 | if (!mdesc) |
947 | mdesc = setup_machine_tags(machine_arch_type); | 713 | mdesc = setup_machine_tags(__atags_pointer, machine_arch_type); |
948 | machine_desc = mdesc; | 714 | machine_desc = mdesc; |
949 | machine_name = mdesc->name; | 715 | machine_name = mdesc->name; |
950 | 716 | ||