setup.c (616ad8c44281c0c6711a72b560e01ec335ff27e0) setup.c (0011036beeffeada15acd1936d67988de21ca65e)
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995 Linus Torvalds
7 * Copyright (C) 1995 Waldorf Electronics
8 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Ralf Baechle

--- 146 unchanged lines hidden (view full) ---

155 return 0;
156}
157early_param("rd_size", rd_size_early);
158
159/* it returns the next free pfn after initrd */
160static unsigned long __init init_initrd(void)
161{
162 unsigned long end;
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995 Linus Torvalds
7 * Copyright (C) 1995 Waldorf Electronics
8 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Ralf Baechle

--- 146 unchanged lines hidden (view full) ---

155 return 0;
156}
157early_param("rd_size", rd_size_early);
158
159/* it returns the next free pfn after initrd */
160static unsigned long __init init_initrd(void)
161{
162 unsigned long end;
163 u32 *initrd_header;
164
165 /*
166 * Board specific code or command line parser should have
167 * already set up initrd_start and initrd_end. In these cases
168 * perfom sanity checks and use them if all looks good.
169 */
163
164 /*
165 * Board specific code or command line parser should have
166 * already set up initrd_start and initrd_end. In these cases
167 * perfom sanity checks and use them if all looks good.
168 */
170 if (initrd_start && initrd_end > initrd_start)
171 goto sanitize;
169 if (!initrd_start || initrd_end <= initrd_start) {
170#ifdef CONFIG_PROBE_INITRD_HEADER
171 u32 *initrd_header;
172
172
173 /*
174 * See if initrd has been added to the kernel image by
175 * arch/mips/boot/addinitrd.c. In that case a header is
176 * prepended to initrd and is made up by 8 bytes. The fisrt
177 * word is a magic number and the second one is the size of
178 * initrd. Initrd start must be page aligned in any cases.
179 */
180 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181 if (initrd_header[0] != 0x494E5244)
173 /*
174 * See if initrd has been added to the kernel image by
175 * arch/mips/boot/addinitrd.c. In that case a header is
176 * prepended to initrd and is made up by 8 bytes. The first
177 * word is a magic number and the second one is the size of
178 * initrd. Initrd start must be page aligned in any cases.
179 */
180 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181 if (initrd_header[0] != 0x494E5244)
182 goto disable;
183 initrd_start = (unsigned long)(initrd_header + 2);
184 initrd_end = initrd_start + initrd_header[1];
185#else
182 goto disable;
186 goto disable;
183 initrd_start = (unsigned long)(initrd_header + 2);
184 initrd_end = initrd_start + initrd_header[1];
187#endif
188 }
185
189
186sanitize:
187 if (initrd_start & ~PAGE_MASK) {
188 pr_err("initrd start must be page aligned\n");
189 goto disable;
190 }
191 if (initrd_start < PAGE_OFFSET) {
192 pr_err("initrd start < PAGE_OFFSET\n");
193 goto disable;
194 }

--- 413 unchanged lines hidden ---
190 if (initrd_start & ~PAGE_MASK) {
191 pr_err("initrd start must be page aligned\n");
192 goto disable;
193 }
194 if (initrd_start < PAGE_OFFSET) {
195 pr_err("initrd start < PAGE_OFFSET\n");
196 goto disable;
197 }

--- 413 unchanged lines hidden ---