~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m68k/kernel/uboot.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * uboot.c -- uboot arguments support
  3  *
  4  * This file is subject to the terms and conditions of the GNU General Public
  5  * License.  See the file COPYING in the main directory of this archive
  6  * for more details.
  7  */
  8 
  9 #include <linux/kernel.h>
 10 #include <linux/sched.h>
 11 #include <linux/delay.h>
 12 #include <linux/interrupt.h>
 13 #include <linux/fb.h>
 14 #include <linux/module.h>
 15 #include <linux/mm.h>
 16 #include <linux/console.h>
 17 #include <linux/errno.h>
 18 #include <linux/string.h>
 19 #include <linux/memblock.h>
 20 #include <linux/seq_file.h>
 21 #include <linux/init.h>
 22 #include <linux/initrd.h>
 23 #include <linux/root_dev.h>
 24 #include <linux/rtc.h>
 25 
 26 #include <asm/setup.h>
 27 #include <asm/irq.h>
 28 #include <asm/machdep.h>
 29 #include <asm/sections.h>
 30 #include <asm/bootinfo.h>
 31 
 32 /*
 33  * parse_uboot_commandline
 34  *
 35  * Copies u-boot commandline arguments and store them in the proper linux
 36  * variables.
 37  *
 38  * Assumes:
 39  *      _init_sp global contains the address in the stack pointer when the
 40  *      kernel starts (see head.S::_start)
 41  *
 42  *      U-Boot calling convention:
 43  *      (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
 44  *
 45  *      _init_sp can be parsed as such
 46  *
 47  *      _init_sp+00 = u-boot cmd after jsr into kernel (skip)
 48  *      _init_sp+04 = &kernel board_info (residual data)
 49  *      _init_sp+08 = &initrd_start
 50  *      _init_sp+12 = &initrd_end
 51  *      _init_sp+16 = &cmd_start
 52  *      _init_sp+20 = &cmd_end
 53  *
 54  *      This also assumes that the memory locations pointed to are still
 55  *      unmodified. U-boot places them near the end of external SDRAM.
 56  *
 57  * Argument(s):
 58  *      commandp = the linux commandline arg container to fill.
 59  *      size     = the sizeof commandp.
 60  *
 61  * Returns:
 62  */
 63 static void __init parse_uboot_commandline(char *commandp, int size)
 64 {
 65         extern unsigned long _init_sp;
 66         unsigned long *sp;
 67         unsigned long uboot_cmd_start, uboot_cmd_end;
 68 #if defined(CONFIG_BLK_DEV_INITRD)
 69         unsigned long uboot_initrd_start, uboot_initrd_end;
 70 #endif /* if defined(CONFIG_BLK_DEV_INITRD) */
 71 
 72         sp = (unsigned long *)_init_sp;
 73         uboot_cmd_start = sp[4];
 74         uboot_cmd_end = sp[5];
 75 
 76         if (uboot_cmd_start && uboot_cmd_end)
 77                 strncpy(commandp, (const char *)uboot_cmd_start, size);
 78 
 79 #if defined(CONFIG_BLK_DEV_INITRD)
 80         uboot_initrd_start = sp[2];
 81         uboot_initrd_end = sp[3];
 82 
 83         if (uboot_initrd_start && uboot_initrd_end &&
 84             (uboot_initrd_end > uboot_initrd_start)) {
 85                 initrd_start = uboot_initrd_start;
 86                 initrd_end = uboot_initrd_end;
 87                 ROOT_DEV = Root_RAM0;
 88                 pr_info("initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
 89         }
 90 #endif /* if defined(CONFIG_BLK_DEV_INITRD) */
 91 }
 92 
 93 __init void process_uboot_commandline(char *commandp, int size)
 94 {
 95         int len, n;
 96 
 97         n = strnlen(commandp, size);
 98         commandp += n;
 99         len = size - n;
100         if (len) {
101                 /* Add the whitespace separator */
102                 *commandp++ = ' ';
103                 len--;
104         }
105 
106         parse_uboot_commandline(commandp, len);
107         commandp[len - 1] = 0;
108 }
109 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php