ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / mips / gt64120 / momenco_ocelot / prom.c
1 /*
2  * Copyright 2001 MontaVista Software Inc.
3  * Author: jsun@mvista.com or jsun@junsun.net
4  *
5  * This program is free software; you can redistribute  it and/or modify it
6  * under  the terms of  the GNU General  Public License as published by the
7  * Free Software Foundation;  either version 2 of the  License, or (at your
8  * option) any later version.
9  */
10 #include <linux/init.h>
11 #include <linux/mm.h>
12 #include <linux/sched.h>
13 #include <linux/bootmem.h>
14
15 #include <asm/addrspace.h>
16 #include <asm/bootinfo.h>
17
18 struct callvectors {
19         int     (*open) (char*, int, int);
20         int     (*close) (int);
21         int     (*read) (int, void*, int);
22         int     (*write) (int, void*, int);
23         off_t   (*lseek) (int, off_t, int);
24         int     (*printf) (const char*, ...);
25         void    (*cacheflush) (void);
26         char*   (*gets) (char*);
27 };
28
29 struct callvectors* debug_vectors;
30
31 extern unsigned long gt64120_base;
32
33 const char *get_system_type(void)
34 {
35         return "Momentum Ocelot";
36 }
37
38 /* [jsun@junsun.net] PMON passes arguments in C main() style */
39 void __init prom_init(void)
40 {
41         int argc = fw_arg0;
42         char **arg = (char **) fw_arg1;
43         char **env = (char **) fw_arg2;
44         struct callvectors *cv = (struct callvectors *) fw_arg3;
45         uint32_t tmp;
46         int i;
47
48         /* save the PROM vectors for debugging use */
49         debug_vectors = cv;
50
51         /* arg[0] is "g", the rest is boot parameters */
52         arcs_cmdline[0] = '\0';
53         for (i = 1; i < argc; i++) {
54                 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
55                     >= sizeof(arcs_cmdline))
56                         break;
57                 strcat(arcs_cmdline, arg[i]);
58                 strcat(arcs_cmdline, " ");
59         }
60
61         mips_machgroup = MACH_GROUP_MOMENCO;
62         mips_machtype = MACH_MOMENCO_OCELOT;
63
64         while (*env) {
65                 if (strncmp("gtbase", *env, 6) == 0) {
66                         gt64120_base = simple_strtol(*env + strlen("gtbase="),
67                                                         NULL, 16);
68                         break;
69                 }
70                 *env++;
71         }
72
73         debug_vectors->printf("Booting Linux kernel...\n");
74
75         /* All the boards have at least 64MiB. If there's more, we
76            detect and register it later */
77         add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
78 }
79
80 unsigned long __init prom_free_prom_memory(void)
81 {
82         return 0;
83 }