15de18cdeSSam Ravnborg /* 25de18cdeSSam Ravnborg * bootstr.c: Boot string/argument acquisition from the PROM. 35de18cdeSSam Ravnborg * 45de18cdeSSam Ravnborg * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu) 55de18cdeSSam Ravnborg * Copyright(C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 65de18cdeSSam Ravnborg */ 75de18cdeSSam Ravnborg 85de18cdeSSam Ravnborg #include <linux/string.h> 95de18cdeSSam Ravnborg #include <linux/init.h> 105de18cdeSSam Ravnborg #include <asm/oplib.h> 115de18cdeSSam Ravnborg 125de18cdeSSam Ravnborg /* WARNING: The boot loader knows that these next three variables come one right 135de18cdeSSam Ravnborg * after another in the .data section. Do not move this stuff into 145de18cdeSSam Ravnborg * the .bss section or it will break things. 155de18cdeSSam Ravnborg */ 165de18cdeSSam Ravnborg 175de18cdeSSam Ravnborg #define BARG_LEN 256 185de18cdeSSam Ravnborg struct { 195de18cdeSSam Ravnborg int bootstr_len; 205de18cdeSSam Ravnborg int bootstr_valid; 215de18cdeSSam Ravnborg char bootstr_buf[BARG_LEN]; 225de18cdeSSam Ravnborg } bootstr_info = { 235de18cdeSSam Ravnborg .bootstr_len = BARG_LEN, 245de18cdeSSam Ravnborg #ifdef CONFIG_CMDLINE 255de18cdeSSam Ravnborg .bootstr_valid = 1, 265de18cdeSSam Ravnborg .bootstr_buf = CONFIG_CMDLINE, 275de18cdeSSam Ravnborg #endif 285de18cdeSSam Ravnborg }; 295de18cdeSSam Ravnborg 305de18cdeSSam Ravnborg char * __init 315de18cdeSSam Ravnborg prom_getbootargs(void) 325de18cdeSSam Ravnborg { 335de18cdeSSam Ravnborg /* This check saves us from a panic when bootfd patches args. */ 345de18cdeSSam Ravnborg if (bootstr_info.bootstr_valid) 355de18cdeSSam Ravnborg return bootstr_info.bootstr_buf; 365de18cdeSSam Ravnborg prom_getstring(prom_chosen_node, "bootargs", 375de18cdeSSam Ravnborg bootstr_info.bootstr_buf, BARG_LEN); 385de18cdeSSam Ravnborg bootstr_info.bootstr_valid = 1; 395de18cdeSSam Ravnborg return bootstr_info.bootstr_buf; 405de18cdeSSam Ravnborg } 41