blob: 742043f8d755626f7f42afc3b5c5d864ac983f2c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#include <linux/config.h>
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/blkdev.h>
24#include <linux/bootmem.h>
25#include <linux/smp.h>
26#include <linux/initrd.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000027#include <linux/pm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29#include <asm/bootinfo.h>
30#include <asm/reboot.h>
31
32#define MAX_RAM_SIZE ((CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024) - 1)
33
34static __init void prom_meminit(void)
35{
36#ifdef CONFIG_BLK_DEV_INITRD
37 unsigned long initrd_pstart;
38 unsigned long initrd_pend;
39
40 initrd_pstart = __pa(initrd_start);
41 initrd_pend = __pa(initrd_end);
42 if (initrd_start &&
43 ((initrd_pstart > MAX_RAM_SIZE)
44 || (initrd_pend > MAX_RAM_SIZE))) {
45 panic("initrd out of addressable memory");
46 }
47
48 add_memory_region(0, initrd_pstart,
49 BOOT_MEM_RAM);
50 add_memory_region(initrd_pstart, initrd_pend - initrd_pstart,
51 BOOT_MEM_RESERVED);
52 add_memory_region(initrd_pend,
53 (CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024) - initrd_pend,
54 BOOT_MEM_RAM);
55#else
56 add_memory_region(0, CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024,
57 BOOT_MEM_RAM);
58#endif
59}
60
61void prom_cpu0_exit(void *unused)
62{
63 while (1) ;
64}
65
66static void prom_linux_exit(void)
67{
68#ifdef CONFIG_SMP
69 if (smp_processor_id()) {
70 smp_call_function(prom_cpu0_exit,NULL,1,1);
71 }
72#endif
73 while(1);
74}
75
76/*
77 * prom_init is called just after the cpu type is determined, from setup_arch()
78 */
79void __init prom_init(void)
80{
81 _machine_restart = (void (*)(char *))prom_linux_exit;
82 _machine_halt = prom_linux_exit;
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000083 pm_power_off = prom_linux_exit;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85 strcpy(arcs_cmdline, "root=/dev/ram0 ");
86
87 mips_machgroup = MACH_GROUP_SIBYTE;
88 prom_meminit();
89}
90
91unsigned long __init prom_free_prom_memory(void)
92{
93 /* Not sure what I'm supposed to do here. Nothing, I think */
94 return 0;
95}
96
97void prom_putchar(char c)
98{
99}