4d4caa8476fa8d50904fbcf4f658b7fd9ee7d8d0
[openwrt.git] / target / linux / adm5120 / files-3.14 / arch / mips / adm5120 / prom / generic.c
1 /*
2  *  Generic 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/kernel.h>
13 #include <linux/init.h>
14 #include <linux/string.h>
15
16 #include <asm/bootinfo.h>
17
18 #include <prom/generic.h>
19
20 static int *_prom_argc;
21 static char **_prom_argv;
22 static char **_prom_envp;
23
24 char *generic_prom_getenv(char *envname)
25 {
26         char **env;
27         char *ret;
28
29         ret = NULL;
30         for (env = _prom_envp; *env != NULL; env++) {
31                 if (strcmp(envname, *env++) == 0) {
32                         ret = *env;
33                         break;
34                 }
35         }
36
37         return ret;
38 }
39
40 int generic_prom_present(void)
41 {
42         _prom_argc = (int *)fw_arg0;
43         _prom_argv = (char **)fw_arg1;
44         _prom_envp = (char **)fw_arg2;
45
46         return 1;
47 }