2 * Big Endian PROM code for SNI RM machines
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 2005-2006 Florian Lohoff (flo@rfc822.org)
9 * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/string.h>
17 #include <linux/console.h>
19 #include <asm/addrspace.h>
21 #include <asm/mipsprom.h>
22 #include <asm/bootinfo.h>
24 /* special SNI prom calls */
26 * This does not exist in all proms - SINIX compares
27 * the prom env variable "version" against "2.0008"
28 * or greater. If lesser it tries to probe interesting
31 #define PROM_GET_MEMCONF 58
33 #define PROM_VEC (u64 *)CKSEG1ADDR(0x1fc00000)
34 #define PROM_ENTRY(x) (PROM_VEC + (x))
37 static int *(*__prom_putchar
)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR
);
39 void prom_putchar(char c
)
44 static char *(*__prom_getenv
)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV
);
45 static void (*__prom_get_memconf
)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF
);
47 char *prom_getenv (char *s
)
49 return __prom_getenv(s
);
52 void __init
prom_free_prom_memory(void)
57 * /proc/cpuinfo system type
60 static const char *systype
= "Unknown";
61 const char *get_system_type(void)
66 #define SNI_IDPROM_BASE 0xbff00000
67 #define SNI_IDPROM_MEMSIZE (SNI_IDPROM_BASE+0x28) /* Memsize in 16MB quantities */
68 #define SNI_IDPROM_BRDTYPE (SNI_IDPROM_BASE+0x29) /* Board Type */
69 #define SNI_IDPROM_CPUTYPE (SNI_IDPROM_BASE+0x30) /* CPU Type */
71 #define SNI_IDPROM_SIZE 0x1000
74 static void sni_idprom_dump(void)
78 pr_debug("SNI IDProm dump:\n");
79 for (i
= 0; i
< 256; i
++) {
83 printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE
+ i
));
91 static void sni_mem_init(void )
102 /* MemSIZE from prom in 16MByte chunks */
103 memsize
= *((unsigned char *) SNI_IDPROM_MEMSIZE
) * 16;
105 pr_debug("IDProm memsize: %lu MByte\n", memsize
);
107 /* get memory bank layout from prom */
108 __prom_get_memconf(&memconf
);
110 pr_debug("prom_get_mem_conf memory configuration:\n");
111 for (i
= 0;i
< 8 && memconf
[i
].size
; i
++) {
112 if (sni_brd_type
== SNI_BRD_PCI_TOWER
||
113 sni_brd_type
== SNI_BRD_PCI_TOWER_CPLUS
) {
114 if (memconf
[i
].base
>= 0x20000000 &&
115 memconf
[i
].base
< 0x30000000) {
116 memconf
[i
].base
-= 0x20000000;
119 pr_debug("Bank%d: %08x @ %08x\n", i
,
120 memconf
[i
].size
, memconf
[i
].base
);
121 add_memory_region(memconf
[i
].base
, memconf
[i
].size
, BOOT_MEM_RAM
);
125 static void __init
sni_console_setup(void)
131 static char options
[8];
133 cdev
= prom_getenv ("console_dev");
134 if (strncmp (cdev
, "tty", 3) == 0) {
135 ctype
= prom_getenv ("console");
140 baud
= prom_getenv("lbaud");
144 baud
= prom_getenv("rbaud");
148 strcpy(options
, baud
);
149 if (strncmp (cdev
, "tty552", 6) == 0)
150 add_preferred_console("ttyS", port
, baud
? options
: NULL
);
152 add_preferred_console("ttySC", port
, baud
? options
: NULL
);
156 void __init
prom_init(void)
159 char **argv
= (void *)fw_arg1
;
163 sni_brd_type
= *(unsigned char *)SNI_IDPROM_BRDTYPE
;
164 cputype
= *(unsigned char *)SNI_IDPROM_CPUTYPE
;
165 switch (sni_brd_type
) {
166 case SNI_BRD_TOWER_OASIC
:
169 systype
= "RM400-330";
172 systype
= "RM400-430";
175 systype
= "RM400-530";
178 systype
= "RM400-730";
181 systype
= "RM400-xxx";
185 case SNI_BRD_MINITOWER
:
189 systype
= "RM400-120";
192 systype
= "RM400-220";
195 systype
= "RM400-225";
198 systype
= "RM400-420";
201 systype
= "RM400-xxx";
205 case SNI_BRD_PCI_TOWER
:
206 systype
= "RM400-Cxx";
209 systype
= "RM200-xxx";
211 case SNI_BRD_PCI_MTOWER
:
212 systype
= "RM300-Cxx";
214 case SNI_BRD_PCI_DESKTOP
:
215 switch (read_c0_prid() & 0xff00) {
218 systype
= "RM200-C20";
221 systype
= "RM200-C40";
224 systype
= "RM200-Cxx";
228 case SNI_BRD_PCI_TOWER_CPLUS
:
229 systype
= "RM400-Exx";
231 case SNI_BRD_PCI_MTOWER_CPLUS
:
232 systype
= "RM300-Exx";
235 pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type
,systype
);
243 /* copy prom cmdline parameters to kernel cmdline */
244 for (i
= 1; i
< argc
; i
++) {
245 strcat(arcs_cmdline
, argv
[i
]);
247 strcat(arcs_cmdline
, " ");