[adm5120] license cleanup
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / prom / generic.c
1 /*
2 * $Id$
3 *
4 * Generic PROM routines
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 *
13 */
14
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/string.h>
18
19 #include <asm/bootinfo.h>
20
21 #include <prom/generic.h>
22
23 static int *_prom_argc;
24 static char **_prom_argv;
25 static char **_prom_envp;
26
27 char *generic_prom_getenv(char *envname)
28 {
29 char **env;
30 char *ret;
31
32 ret = NULL;
33 for (env = _prom_envp; *env != NULL; env++) {
34 if (strcmp(envname, *env++) == 0) {
35 ret = *env;
36 break;
37 }
38 }
39
40 return ret;
41 }
42
43 int generic_prom_present(void)
44 {
45 _prom_argc = (int *)fw_arg0;
46 _prom_argv = (char **)fw_arg1;
47 _prom_envp = (char **)fw_arg2;
48
49 return 1;
50 }