// SPDX-License-Identifier: GPL-2.01/*2* bootstr.c: Boot string/argument acquisition from the PROM.3*4* Copyright(C) 1995 David S. Miller ([email protected])5* Copyright(C) 1996,1998 Jakub Jelinek ([email protected])6*/78#include <linux/string.h>9#include <linux/init.h>10#include <asm/oplib.h>1112/* WARNING: The boot loader knows that these next three variables come one right13* after another in the .data section. Do not move this stuff into14* the .bss section or it will break things.15*/1617/* We limit BARG_LEN to 1024 because this is the size of the18* 'barg_out' command line buffer in the SILO bootloader.19*/20#define BARG_LEN 102421struct {22int bootstr_len;23int bootstr_valid;24char bootstr_buf[BARG_LEN];25} bootstr_info = {26.bootstr_len = BARG_LEN,27#ifdef CONFIG_CMDLINE28.bootstr_valid = 1,29.bootstr_buf = CONFIG_CMDLINE,30#endif31};3233char * __init34prom_getbootargs(void)35{36/* This check saves us from a panic when bootfd patches args. */37if (bootstr_info.bootstr_valid)38return bootstr_info.bootstr_buf;39prom_getstring(prom_chosen_node, "bootargs",40bootstr_info.bootstr_buf, BARG_LEN);41bootstr_info.bootstr_valid = 1;42return bootstr_info.bootstr_buf;43}444546