Linux 4.8-rc8
[linux/fpc-iii.git] / arch / sparc / prom / bootstr_64.c
blob7149e77714a4a45b3ffb96e1388adca25577cca6
1 /*
2 * bootstr.c: Boot string/argument acquisition from the PROM.
4 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright(C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
8 #include <linux/string.h>
9 #include <linux/init.h>
10 #include <asm/oplib.h>
12 /* WARNING: The boot loader knows that these next three variables come one right
13 * after another in the .data section. Do not move this stuff into
14 * the .bss section or it will break things.
17 /* We limit BARG_LEN to 1024 because this is the size of the
18 * 'barg_out' command line buffer in the SILO bootloader.
20 #define BARG_LEN 1024
21 struct {
22 int bootstr_len;
23 int bootstr_valid;
24 char bootstr_buf[BARG_LEN];
25 } bootstr_info = {
26 .bootstr_len = BARG_LEN,
27 #ifdef CONFIG_CMDLINE
28 .bootstr_valid = 1,
29 .bootstr_buf = CONFIG_CMDLINE,
30 #endif
33 char * __init
34 prom_getbootargs(void)
36 /* This check saves us from a panic when bootfd patches args. */
37 if (bootstr_info.bootstr_valid)
38 return bootstr_info.bootstr_buf;
39 prom_getstring(prom_chosen_node, "bootargs",
40 bootstr_info.bootstr_buf, BARG_LEN);
41 bootstr_info.bootstr_valid = 1;
42 return bootstr_info.bootstr_buf;