4 * Broadcom's CFE specific prom routines
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
25 #include <linux/types.h>
26 #include <linux/init.h>
28 #include <asm/bootinfo.h>
29 #include <asm/addrspace.h>
32 #include "prom_read.h"
37 #define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE
38 from other bootloaders */
42 static u32 cfe_handle;
46 int __init cfe_present(void)
49 * This method only works, when we are booted directly from the CFE.
51 u32 a1 = (u32) fw_arg1;
56 cfe_handle = (u32) fw_arg0;
57 cfe_entry = (u32) fw_arg2;
58 cfe_seal = (u32) fw_arg3;
60 /* Check for CFE by finding the CFE magic number */
61 if (cfe_seal != CFE_EPTSEAL)
64 /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */
68 /* The cfe_handle, and the cfe_entry must be kernel mode addresses */
69 if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0))
76 char *cfe_getenv(char *envname)