MIPS: powertv: Drop BOOTLOADER_DRIVER Kconfig symbol
[deliverable/linux.git] / arch / mips / powertv / init.c
CommitLineData
a3a0f8c8 1/*
70342287 2 * Copyright (C) 1999, 2000, 2004, 2005 MIPS Technologies, Inc.
a3a0f8c8
DV
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Portions copyright (C) 2009 Cisco Systems, Inc.
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 *
21 * PROM library initialisation code.
22 */
23#include <linux/init.h>
24#include <linux/string.h>
25#include <linux/kernel.h>
26
27#include <asm/bootinfo.h>
28#include <linux/io.h>
a3a0f8c8
DV
29#include <asm/cacheflush.h>
30#include <asm/traps.h>
31
a3a0f8c8
DV
32#include <asm/mips-boards/generic.h>
33#include <asm/mach-powertv/asic.h>
34
270690e0
SH
35#include "init.h"
36
7e326d68 37static int *_prom_envp;
a3a0f8c8
DV
38unsigned long _prom_memsize;
39
40/*
41 * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
42 * This macro take care of sign extension, if running in 64-bit mode.
43 */
44#define prom_envp(index) ((char *)(long)_prom_envp[(index)])
45
46char *prom_getenv(char *envname)
47{
48 char *result = NULL;
49
50 if (_prom_envp != NULL) {
51 /*
52 * Return a pointer to the given environment variable.
53 * In 64-bit mode: we're using 64-bit pointers, but all pointers
54 * in the PROM structures are only 32-bit, so we need some
55 * workarounds, if we are running in 64-bit mode.
56 */
57 int i, index = 0;
58
59 i = strlen(envname);
60
61 while (prom_envp(index)) {
62 if (strncmp(envname, prom_envp(index), i) == 0) {
63 result = prom_envp(index + 1);
64 break;
65 }
66 index += 2;
67 }
68 }
69
70 return result;
71}
72
a3a0f8c8
DV
73void __init prom_init(void)
74{
7e326d68
YY
75 int prom_argc;
76 char *prom_argv;
77
a3a0f8c8 78 prom_argc = fw_arg0;
7e326d68 79 prom_argv = (char *) fw_arg1;
a3a0f8c8
DV
80 _prom_envp = (int *) fw_arg2;
81 _prom_memsize = (unsigned long) fw_arg3;
82
0d590504
DV
83 if (prom_argc == 1) {
84 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
7e326d68 85 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE);
0d590504 86 }
7e326d68 87
a3a0f8c8
DV
88 configure_platform();
89 prom_meminit();
a3a0f8c8 90}
This page took 0.216577 seconds and 5 git commands to generate.