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)
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/string.h>
16 #include <asm/addrspace.h>
18 #include <asm/mipsprom.h>
19 #include <asm/bootinfo.h>
21 /* special SNI prom calls */
23 * This does not exist in all proms - SINIX compares
24 * the prom env variable "version" against "2.0008"
25 * or greater. If lesser it tries to probe interesting
28 #define PROM_GET_MEMCONF 58
30 #define PROM_VEC (u64 *)CKSEG1ADDR(0x1fc00000)
31 #define PROM_ENTRY(x) (PROM_VEC + (x))
36 #define DBG_PRINTF(x...) prom_printf(x)
38 #define DBG_PRINTF(x...)
41 static int *(*__prom_putchar
)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR
);
42 static char *(*__prom_getenv
)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV
);
43 static void (*__prom_get_memconf
)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF
);
45 char *prom_getenv (char *s
)
47 return __prom_getenv(s
);
50 void prom_printf(char *fmt
, ...)
57 vsprintf(ppbuf
, fmt
, args
);
65 __prom_putchar(*bptr
++);
70 unsigned long prom_free_prom_memory(void)
76 * /proc/cpuinfo system type
79 static const char *systype
= "Unknown";
80 const char *get_system_type(void)
85 #define SNI_IDPROM_BASE 0xbff00000
86 #define SNI_IDPROM_MEMSIZE (SNI_IDPROM_BASE+0x28) /* Memsize in 16MB quantities */
87 #define SNI_IDPROM_BRDTYPE (SNI_IDPROM_BASE+0x29) /* Board Type */
88 #define SNI_IDPROM_CPUTYPE (SNI_IDPROM_BASE+0x30) /* CPU Type */
90 #define SNI_IDPROM_SIZE 0x1000
93 static void sni_idprom_dump(void)
97 prom_printf("SNI IDProm dump (first 128byte):\n");
100 prom_printf("%04x ", i
);
102 prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE
+i
));
110 static void sni_mem_init(void )
121 /* MemSIZE from prom in 16MByte chunks */
122 memsize
=*((unsigned char *) SNI_IDPROM_MEMSIZE
) * 16;
124 DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize
);
126 /* get memory bank layout from prom */
127 __prom_get_memconf(&memconf
);
129 DBG_PRINTF("prom_get_mem_conf memory configuration:\n");
130 for(i
=0;i
<8 && memconf
[i
].size
;i
++) {
131 prom_printf("Bank%d: %08x @ %08x\n", i
,
132 memconf
[i
].size
, memconf
[i
].base
);
133 add_memory_region(memconf
[i
].base
, memconf
[i
].size
, BOOT_MEM_RAM
);
137 void __init
prom_init(void)
140 char **argv
= (void *)fw_arg1
;
141 unsigned int sni_brd_type
= *(unsigned char *) SNI_IDPROM_BRDTYPE
;
144 DBG_PRINTF("Found SNI brdtype %02x\n", sni_brd_type
);
151 /* copy prom cmdline parameters to kernel cmdline */
152 for (i
= 1; i
< argc
; i
++) {
153 strcat(arcs_cmdline
, argv
[i
]);
155 strcat(arcs_cmdline
, " ");