diff options
author | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2008-01-04 17:31:07 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-29 05:14:59 -0500 |
commit | 231a35d37293ab88d325a9cb94e5474c156282c0 (patch) | |
tree | 75f38d069e5e49de03fb789975b8a102c282b979 /arch/mips/fw | |
parent | 237cfee1db66147aef4457f02b56a41e6f84bfd3 (diff) |
[MIPS] RM: Collected changes
- EISA support for non PCI RMs (RM200 and RM400-xxx). The major part
is the splitting of the EISA and onboard ISA of the RM200, which
makes the EISA bus on the RM200 look like on other RMs.
- 64bit kernel support
- system type detection is now common for big and little endian
- moved sniprom code to arch/mips/fw
- added call_o32 function to arch/mips/fw/lib, which uses a private
stack for calling prom functions
- fix problem with ISA interrupts, which makes using PIT clockevent
possible
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/fw')
-rw-r--r-- | arch/mips/fw/lib/Makefile | 5 | ||||
-rw-r--r-- | arch/mips/fw/lib/call_o32.S | 97 | ||||
-rw-r--r-- | arch/mips/fw/sni/Makefile | 5 | ||||
-rw-r--r-- | arch/mips/fw/sni/sniprom.c | 151 |
4 files changed, 258 insertions, 0 deletions
diff --git a/arch/mips/fw/lib/Makefile b/arch/mips/fw/lib/Makefile new file mode 100644 index 000000000000..84befc968fc4 --- /dev/null +++ b/arch/mips/fw/lib/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for generic prom monitor library routines under Linux. | ||
3 | # | ||
4 | |||
5 | lib-$(CONFIG_64BIT) += call_o32.o | ||
diff --git a/arch/mips/fw/lib/call_o32.S b/arch/mips/fw/lib/call_o32.S new file mode 100644 index 000000000000..bdf7d1d4081a --- /dev/null +++ b/arch/mips/fw/lib/call_o32.S | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * arch/mips/dec/prom/call_o32.S | ||
3 | * | ||
4 | * O32 interface for the 64 (or N32) ABI. | ||
5 | * | ||
6 | * Copyright (C) 2002 Maciej W. Rozycki | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <asm/asm.h> | ||
15 | #include <asm/regdef.h> | ||
16 | |||
17 | /* Maximum number of arguments supported. Must be even! */ | ||
18 | #define O32_ARGC 32 | ||
19 | /* Number of static registers we save. */ | ||
20 | #define O32_STATC 11 | ||
21 | /* Frame size for static register */ | ||
22 | #define O32_FRAMESZ (SZREG * O32_STATC) | ||
23 | /* Frame size on new stack */ | ||
24 | #define O32_FRAMESZ_NEW (SZREG + 4 * O32_ARGC) | ||
25 | |||
26 | .text | ||
27 | |||
28 | /* | ||
29 | * O32 function call dispatcher, for interfacing 32-bit ROM routines. | ||
30 | * | ||
31 | * The standard 64 (N32) calling sequence is supported, with a0 | ||
32 | * holding a function pointer, a1 a new stack pointer, a2-a7 -- its | ||
33 | * first six arguments and the stack -- remaining ones (up to O32_ARGC, | ||
34 | * including a2-a7). Static registers, gp and fp are preserved, v0 holds | ||
35 | * a result. This code relies on the called o32 function for sp and ra | ||
36 | * restoration and this dispatcher has to be placed in a KSEGx (or KUSEG) | ||
37 | * address space. Any pointers passed have to point to addresses within | ||
38 | * one of these spaces as well. | ||
39 | */ | ||
40 | NESTED(call_o32, O32_FRAMESZ, ra) | ||
41 | REG_SUBU sp,O32_FRAMESZ | ||
42 | |||
43 | REG_S ra,O32_FRAMESZ-1*SZREG(sp) | ||
44 | REG_S fp,O32_FRAMESZ-2*SZREG(sp) | ||
45 | REG_S gp,O32_FRAMESZ-3*SZREG(sp) | ||
46 | REG_S s7,O32_FRAMESZ-4*SZREG(sp) | ||
47 | REG_S s6,O32_FRAMESZ-5*SZREG(sp) | ||
48 | REG_S s5,O32_FRAMESZ-6*SZREG(sp) | ||
49 | REG_S s4,O32_FRAMESZ-7*SZREG(sp) | ||
50 | REG_S s3,O32_FRAMESZ-8*SZREG(sp) | ||
51 | REG_S s2,O32_FRAMESZ-9*SZREG(sp) | ||
52 | REG_S s1,O32_FRAMESZ-10*SZREG(sp) | ||
53 | REG_S s0,O32_FRAMESZ-11*SZREG(sp) | ||
54 | |||
55 | move jp,a0 | ||
56 | REG_SUBU s0,a1,O32_FRAMESZ_NEW | ||
57 | REG_S sp,O32_FRAMESZ_NEW-1*SZREG(s0) | ||
58 | |||
59 | sll a0,a2,zero | ||
60 | sll a1,a3,zero | ||
61 | sll a2,a4,zero | ||
62 | sll a3,a5,zero | ||
63 | sw a6,0x10(s0) | ||
64 | sw a7,0x14(s0) | ||
65 | |||
66 | PTR_LA t0,O32_FRAMESZ(sp) | ||
67 | PTR_LA t1,0x18(s0) | ||
68 | li t2,O32_ARGC-6 | ||
69 | 1: | ||
70 | lw t3,(t0) | ||
71 | REG_ADDU t0,SZREG | ||
72 | sw t3,(t1) | ||
73 | REG_SUBU t2,1 | ||
74 | REG_ADDU t1,4 | ||
75 | bnez t2,1b | ||
76 | |||
77 | move sp,s0 | ||
78 | |||
79 | jalr jp | ||
80 | |||
81 | REG_L sp,O32_FRAMESZ_NEW-1*SZREG(sp) | ||
82 | |||
83 | REG_L s0,O32_FRAMESZ-11*SZREG(sp) | ||
84 | REG_L s1,O32_FRAMESZ-10*SZREG(sp) | ||
85 | REG_L s2,O32_FRAMESZ-9*SZREG(sp) | ||
86 | REG_L s3,O32_FRAMESZ-8*SZREG(sp) | ||
87 | REG_L s4,O32_FRAMESZ-7*SZREG(sp) | ||
88 | REG_L s5,O32_FRAMESZ-6*SZREG(sp) | ||
89 | REG_L s6,O32_FRAMESZ-5*SZREG(sp) | ||
90 | REG_L s7,O32_FRAMESZ-4*SZREG(sp) | ||
91 | REG_L gp,O32_FRAMESZ-3*SZREG(sp) | ||
92 | REG_L fp,O32_FRAMESZ-2*SZREG(sp) | ||
93 | REG_L ra,O32_FRAMESZ-1*SZREG(sp) | ||
94 | |||
95 | REG_ADDU sp,O32_FRAMESZ | ||
96 | jr ra | ||
97 | END(call_o32) | ||
diff --git a/arch/mips/fw/sni/Makefile b/arch/mips/fw/sni/Makefile new file mode 100644 index 000000000000..d9740a3788e2 --- /dev/null +++ b/arch/mips/fw/sni/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the SNI prom monitor routines under Linux. | ||
3 | # | ||
4 | |||
5 | lib-$(CONFIG_SNIPROM) += sniprom.o | ||
diff --git a/arch/mips/fw/sni/sniprom.c b/arch/mips/fw/sni/sniprom.c new file mode 100644 index 000000000000..96ba99202758 --- /dev/null +++ b/arch/mips/fw/sni/sniprom.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * Big Endian PROM code for SNI RM machines | ||
3 | * | ||
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 | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2005-2006 Florian Lohoff (flo@rfc822.org) | ||
9 | * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <linux/console.h> | ||
16 | |||
17 | #include <asm/addrspace.h> | ||
18 | #include <asm/sni.h> | ||
19 | #include <asm/mipsprom.h> | ||
20 | #include <asm/mipsregs.h> | ||
21 | #include <asm/bootinfo.h> | ||
22 | |||
23 | /* special SNI prom calls */ | ||
24 | /* | ||
25 | * This does not exist in all proms - SINIX compares | ||
26 | * the prom env variable "version" against "2.0008" | ||
27 | * or greater. If lesser it tries to probe interesting | ||
28 | * registers | ||
29 | */ | ||
30 | #define PROM_GET_MEMCONF 58 | ||
31 | #define PROM_GET_HWCONF 61 | ||
32 | |||
33 | #define PROM_VEC (u64 *)CKSEG1ADDR(0x1fc00000) | ||
34 | #define PROM_ENTRY(x) (PROM_VEC + (x)) | ||
35 | |||
36 | #define ___prom_putchar ((int *(*)(int))PROM_ENTRY(PROM_PUTCHAR)) | ||
37 | #define ___prom_getenv ((char *(*)(char *))PROM_ENTRY(PROM_GETENV)) | ||
38 | #define ___prom_get_memconf ((void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF)) | ||
39 | #define ___prom_get_hwconf ((u32 (*)(void))PROM_ENTRY(PROM_GET_HWCONF)) | ||
40 | |||
41 | #ifdef CONFIG_64BIT | ||
42 | |||
43 | static u8 o32_stk[16384]; | ||
44 | #define O32_STK &o32_stk[sizeof(o32_stk)] | ||
45 | |||
46 | #define __PROM_O32(fun, arg) fun arg __asm__(#fun); \ | ||
47 | __asm__(#fun " = call_o32") | ||
48 | |||
49 | int __PROM_O32(__prom_putchar, (int *(*)(int), void *, int)); | ||
50 | char *__PROM_O32(__prom_getenv, (char *(*)(char *), void *, char *)); | ||
51 | void __PROM_O32(__prom_get_memconf, (void (*)(void *), void *, void *)); | ||
52 | u32 __PROM_O32(__prom_get_hwconf, (u32 (*)(void), void *)); | ||
53 | |||
54 | #define _prom_putchar(x) __prom_putchar(___prom_putchar, O32_STK, x) | ||
55 | #define _prom_getenv(x) __prom_getenv(___prom_getenv, O32_STK, x) | ||
56 | #define _prom_get_memconf(x) __prom_get_memconf(___prom_get_memconf, O32_STK, x) | ||
57 | #define _prom_get_hwconf() __prom_get_hwconf(___prom_get_hwconf, O32_STK) | ||
58 | |||
59 | #else | ||
60 | #define _prom_putchar(x) ___prom_putchar(x) | ||
61 | #define _prom_getenv(x) ___prom_getenv(x) | ||
62 | #define _prom_get_memconf(x) ___prom_get_memconf(x) | ||
63 | #define _prom_get_hwconf(x) ___prom_get_hwconf(x) | ||
64 | #endif | ||
65 | |||
66 | void prom_putchar(char c) | ||
67 | { | ||
68 | _prom_putchar(c); | ||
69 | } | ||
70 | |||
71 | |||
72 | char *prom_getenv(char *s) | ||
73 | { | ||
74 | return _prom_getenv(s); | ||
75 | } | ||
76 | |||
77 | void *prom_get_hwconf(void) | ||
78 | { | ||
79 | u32 hwconf = _prom_get_hwconf(); | ||
80 | |||
81 | if (hwconf == 0xffffffff) | ||
82 | return NULL; | ||
83 | |||
84 | return (void *)CKSEG1ADDR(hwconf); | ||
85 | } | ||
86 | |||
87 | void __init prom_free_prom_memory(void) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * /proc/cpuinfo system type | ||
93 | * | ||
94 | */ | ||
95 | char *system_type = "Unknown"; | ||
96 | const char *get_system_type(void) | ||
97 | { | ||
98 | return system_type; | ||
99 | } | ||
100 | |||
101 | static void __init sni_mem_init(void) | ||
102 | { | ||
103 | int i, memsize; | ||
104 | struct membank { | ||
105 | u32 size; | ||
106 | u32 base; | ||
107 | u32 size2; | ||
108 | u32 pad1; | ||
109 | u32 pad2; | ||
110 | } memconf[8]; | ||
111 | int brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE; | ||
112 | |||
113 | |||
114 | /* MemSIZE from prom in 16MByte chunks */ | ||
115 | memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; | ||
116 | |||
117 | pr_debug("IDProm memsize: %u MByte\n", memsize); | ||
118 | |||
119 | /* get memory bank layout from prom */ | ||
120 | _prom_get_memconf(&memconf); | ||
121 | |||
122 | pr_debug("prom_get_mem_conf memory configuration:\n"); | ||
123 | for (i = 0; i < 8 && memconf[i].size; i++) { | ||
124 | if (brd_type == SNI_BRD_PCI_TOWER || | ||
125 | brd_type == SNI_BRD_PCI_TOWER_CPLUS) { | ||
126 | if (memconf[i].base >= 0x20000000 && | ||
127 | memconf[i].base < 0x30000000) | ||
128 | memconf[i].base -= 0x20000000; | ||
129 | } | ||
130 | pr_debug("Bank%d: %08x @ %08x\n", i, | ||
131 | memconf[i].size, memconf[i].base); | ||
132 | add_memory_region(memconf[i].base, memconf[i].size, | ||
133 | BOOT_MEM_RAM); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | void __init prom_init(void) | ||
138 | { | ||
139 | int argc = fw_arg0; | ||
140 | u32 *argv = (u32 *)CKSEG0ADDR(fw_arg1); | ||
141 | int i; | ||
142 | |||
143 | sni_mem_init(); | ||
144 | |||
145 | /* copy prom cmdline parameters to kernel cmdline */ | ||
146 | for (i = 1; i < argc; i++) { | ||
147 | strcat(arcs_cmdline, (char *)CKSEG0ADDR(argv[i])); | ||
148 | if (i < (argc - 1)) | ||
149 | strcat(arcs_cmdline, " "); | ||
150 | } | ||
151 | } | ||