Root/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c

1/*
2 * Broadcom's CFE specific prom routines
3 *
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 */
11
12#include <linux/types.h>
13#include <linux/init.h>
14
15#include <asm/bootinfo.h>
16#include <asm/addrspace.h>
17
18#include <prom/cfe.h>
19#include "prom_read.h"
20
21/*
22 * CFE based boards
23 */
24#define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE
25from other bootloaders */
26
27static int cfe_found;
28
29static u32 cfe_handle;
30static u32 cfe_entry;
31static u32 cfe_seal;
32
33int __init cfe_present(void)
34{
35    /*
36     * This method only works, when we are booted directly from the CFE.
37     */
38    u32 a1 = (u32) fw_arg1;
39
40    if (cfe_found)
41        return 1;
42
43    cfe_handle = (u32) fw_arg0;
44    cfe_entry = (u32) fw_arg2;
45    cfe_seal = (u32) fw_arg3;
46
47    /* Check for CFE by finding the CFE magic number */
48    if (cfe_seal != CFE_EPTSEAL)
49        return 0;
50
51    /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */
52    if (a1 != 0)
53        return 0;
54
55    /* The cfe_handle, and the cfe_entry must be kernel mode addresses */
56    if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0))
57        return 0;
58
59    cfe_found = 1;
60    return 1;
61}
62
63char *cfe_getenv(char *envname)
64{
65    if (cfe_found == 0)
66        return NULL;
67
68    return NULL;
69}
70

Archive Download this file



interactive