Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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