Linux Audio

Check our new training course

Yocto distribution development and maintenance

Need a Yocto distribution for your embedded project?
Loading...
v6.2
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * bootstr.c:  Boot string/argument acquisition from the PROM.
 4 *
 5 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu)
 6 * Copyright(C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
 7 */
 8
 9#include <linux/string.h>
10#include <linux/init.h>
11#include <asm/oplib.h>
12
13/* WARNING: The boot loader knows that these next three variables come one right
14 *          after another in the .data section.  Do not move this stuff into
15 *          the .bss section or it will break things.
16 */
17
18/* We limit BARG_LEN to 1024 because this is the size of the
19 * 'barg_out' command line buffer in the SILO bootloader.
20 */
21#define BARG_LEN 1024
22struct {
23	int bootstr_len;
24	int bootstr_valid;
25	char bootstr_buf[BARG_LEN];
26} bootstr_info = {
27	.bootstr_len = BARG_LEN,
28#ifdef CONFIG_CMDLINE
29	.bootstr_valid = 1,
30	.bootstr_buf = CONFIG_CMDLINE,
31#endif
32};
33
34char * __init
35prom_getbootargs(void)
36{
37	/* This check saves us from a panic when bootfd patches args. */
38	if (bootstr_info.bootstr_valid)
39		return bootstr_info.bootstr_buf;
40	prom_getstring(prom_chosen_node, "bootargs",
41		       bootstr_info.bootstr_buf, BARG_LEN);
42	bootstr_info.bootstr_valid = 1;
43	return bootstr_info.bootstr_buf;
44}
v3.1
 
 1/*
 2 * bootstr.c:  Boot string/argument acquisition from the PROM.
 3 *
 4 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu)
 5 * Copyright(C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
 6 */
 7
 8#include <linux/string.h>
 9#include <linux/init.h>
10#include <asm/oplib.h>
11
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.
15 */
16
17#define BARG_LEN  256
 
 
 
18struct {
19	int bootstr_len;
20	int bootstr_valid;
21	char bootstr_buf[BARG_LEN];
22} bootstr_info = {
23	.bootstr_len = BARG_LEN,
24#ifdef CONFIG_CMDLINE
25	.bootstr_valid = 1,
26	.bootstr_buf = CONFIG_CMDLINE,
27#endif
28};
29
30char * __init
31prom_getbootargs(void)
32{
33	/* This check saves us from a panic when bootfd patches args. */
34	if (bootstr_info.bootstr_valid)
35		return bootstr_info.bootstr_buf;
36	prom_getstring(prom_chosen_node, "bootargs",
37		       bootstr_info.bootstr_buf, BARG_LEN);
38	bootstr_info.bootstr_valid = 1;
39	return bootstr_info.bootstr_buf;
40}