4 * Copyright (C) 2007 OpenWrt.org
5 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
6 * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #include <linux/types.h>
15 #include <linux/autoconf.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/module.h>
20 #include <asm/bootinfo.h>
21 #include <asm/addrspace.h>
22 #include <asm/string.h>
23 #include <asm/mach-bcm963xx/bootloaders.h>
25 static char *boot_loader_names
[BOOT_LOADER_LAST
+1] = {
26 [BOOT_LOADER_UNKNOWN
] = "Unknown",
27 [BOOT_LOADER_CFE
] = "CFE",
28 [BOOT_LOADER_REDBOOT
] = "RedBoot"
31 /* boot loaders specific definitions */
32 #define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE from other bootloaders */
36 * Boot loader detection routines
38 static int __init
detect_cfe(void)
41 * This method only works, when we are booted directly from the CFE.
43 uint32_t cfe_handle
= (uint32_t) fw_arg0
;
44 uint32_t cfe_a1_val
= (uint32_t) fw_arg1
;
45 uint32_t cfe_entry
= (uint32_t) fw_arg2
;
46 uint32_t cfe_seal
= (uint32_t) fw_arg3
;
48 /* Check for CFE by finding the CFE magic number */
49 if (cfe_seal
!= CFE_EPTSEAL
)
50 /* We are not booted from CFE */
53 /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 SoC */
57 /* The cfe_handle, and the cfe_entry must be kernel mode addresses */
58 if ((cfe_handle
< KSEG0
) || (cfe_entry
< KSEG0
))
64 static int __init
detect_redboot(void)
66 /* On Inventel Livebox, the boot loader is passed as a command line argument, check for it */
67 if (!strncmp(arcs_cmdline
, "boot_loader=RedBoot", 19))
72 void __init
detect_bootloader(void)
75 boot_loader_type
= BOOT_LOADER_CFE
;
76 printk("Boot loader is : %s\n", boot_loader_names
[boot_loader_type
]);
79 if (detect_redboot()) {
80 boot_loader_type
= BOOT_LOADER_REDBOOT
;
83 boot_loader_type
= BOOT_LOADER_UNKNOWN
;
86 EXPORT_SYMBOL(boot_loader_type
);
This page took 0.045118 seconds and 5 git commands to generate.