summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-11-19 23:29:05 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-11-19 23:29:05 +0000
commitaea27b2e18d69af87e673972246e66657b4fa274 (patch)
treee3822f273e8a28fea1faf30151db0224ad3332e4
parent0458ce25ec4e796cc0ac4421e0f2ad2d1c60688e (diff)
The ARC code hasn't changed in quite a while, so commit it ...
Until I I merge with even newer kernel releases from Linus this code limits the MIPS64 kernel to a maximum of 64mb RAM on Indys. If I wouldn't do so, on startup kernel internal structures would collide with PROM memory. Solving this for real doesn't to make sense for now as a shiny new bootmem allocator is available in newer kernels.
-rw-r--r--arch/mips64/arc/Makefile2
-rw-r--r--arch/mips64/arc/cmdline.c8
-rw-r--r--arch/mips64/arc/console.c10
-rw-r--r--arch/mips64/arc/env.c6
-rw-r--r--arch/mips64/arc/file.c4
-rw-r--r--arch/mips64/arc/identify.c7
-rw-r--r--arch/mips64/arc/init.c12
-rw-r--r--arch/mips64/arc/memory.c58
-rw-r--r--arch/mips64/arc/misc.c2
-rw-r--r--arch/mips64/arc/printf.c2
-rw-r--r--arch/mips64/arc/salone.c2
-rw-r--r--arch/mips64/arc/time.c2
-rw-r--r--arch/mips64/arc/tree.c2
13 files changed, 68 insertions, 49 deletions
diff --git a/arch/mips64/arc/Makefile b/arch/mips64/arc/Makefile
index 86a5ad8f2..471ff92a1 100644
--- a/arch/mips64/arc/Makefile
+++ b/arch/mips64/arc/Makefile
@@ -1,4 +1,4 @@
-# $Id$
+# $Id: Makefile,v 1.1 1999/08/20 21:13:32 ralf Exp $
# Makefile for the SGI arcs prom monitor library routines
# under Linux.
#
diff --git a/arch/mips64/arc/cmdline.c b/arch/mips64/arc/cmdline.c
index 7e58e8f7e..8ab66fa59 100644
--- a/arch/mips64/arc/cmdline.c
+++ b/arch/mips64/arc/cmdline.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: cmdline.c,v 1.2 1999/10/19 20:51:44 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -46,12 +46,12 @@ void __init prom_init_cmdline(void)
for(i = 0; i < NENTS(ignored); i++) {
int len = strlen(ignored[i]);
- if(!strncmp(prom_argv[actr], ignored[i], len))
+ if(!strncmp(prom_argv(actr), ignored[i], len))
goto pic_cont;
}
/* Ok, we want it. */
- strcpy(cp, prom_argv[actr]);
- cp += strlen(prom_argv[actr]);
+ strcpy(cp, prom_argv(actr));
+ cp += strlen(prom_argv(actr));
*cp++ = ' ';
pic_cont:
diff --git a/arch/mips64/arc/console.c b/arch/mips64/arc/console.c
index 61a5296e4..0f087e912 100644
--- a/arch/mips64/arc/console.c
+++ b/arch/mips64/arc/console.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: console.c,v 1.3 1999/10/19 20:51:44 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -13,16 +13,16 @@
void __init prom_putchar(char c)
{
- long cnt;
- char it = c;
+ ULONG cnt;
+ CHAR it = c;
ArcWrite(1, &it, 1, &cnt);
}
char __init prom_getchar(void)
{
- long cnt;
- char c;
+ ULONG cnt;
+ CHAR c;
ArcRead(0, &c, 1, &cnt);
diff --git a/arch/mips64/arc/env.c b/arch/mips64/arc/env.c
index 17ae2631b..f379c63a4 100644
--- a/arch/mips64/arc/env.c
+++ b/arch/mips64/arc/env.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: env.c,v 1.4 1999/10/19 20:51:44 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -15,14 +15,14 @@
#include <asm/arc/types.h>
#include <asm/sgialib.h>
-CHAR * __init
+PCHAR __init
ArcGetEnvironmentVariable(CHAR *name)
{
return (CHAR *) ARC_CALL1(get_evar, name);
}
LONG __init
-ArcSetEnvironmentVariable(CHAR *name, CHAR *value)
+ArcSetEnvironmentVariable(PCHAR name, PCHAR value)
{
return ARC_CALL2(set_evar, name, value);
}
diff --git a/arch/mips64/arc/file.c b/arch/mips64/arc/file.c
index 958d2adcd..a11583b01 100644
--- a/arch/mips64/arc/file.c
+++ b/arch/mips64/arc/file.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: file.c,v 1.3 1999/10/19 20:51:44 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -46,7 +46,7 @@ ArcGetReadStatus(ULONG FileID)
}
LONG __init
-ArcWrite(ULONG long FileID, void *Buffer, ULONG N, ULONG *Count)
+ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count)
{
return ARC_CALL4(write, FileID, Buffer, N, Count);
}
diff --git a/arch/mips64/arc/identify.c b/arch/mips64/arc/identify.c
index f87de0bda..2103dd427 100644
--- a/arch/mips64/arc/identify.c
+++ b/arch/mips64/arc/identify.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: identify.c,v 1.5 1999/11/19 20:35:21 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -17,7 +17,6 @@
#include <linux/types.h>
#include <linux/string.h>
-#include <asm/sgi/sgi.h>
#include <asm/sgialib.h>
#include <asm/bootinfo.h>
@@ -63,8 +62,8 @@ prom_identify_arch(void)
/* The root component tells us what machine architecture we
have here. */
p = ArcGetChild(PROM_NULL_COMPONENT);
- printk("ARCH: %s\n", p->iname);
- mach = string_to_mach(p->iname);
+ printk("ARCH: %s\n", (char *) (long) p->iname);
+ mach = string_to_mach((char *) (long) p->iname);
mips_machgroup = mach->group;
mips_machtype = mach->type;
diff --git a/arch/mips64/arc/init.c b/arch/mips64/arc/init.c
index d1dbdb2f8..496f296ef 100644
--- a/arch/mips64/arc/init.c
+++ b/arch/mips64/arc/init.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: init.c,v 1.3 1999/10/19 20:51:45 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -18,9 +18,9 @@
/* Master romvec interface. */
struct linux_romvec *romvec;
-struct linux_promblock *sgi_pblock;
+PSYSTEM_PARAMETER_BLOCK sgi_pblock;
int prom_argc;
-char **prom_argv, **prom_envp;
+LONG *_prom_argv, *_prom_envp;
unsigned short prom_vers, prom_rev;
extern void prom_testtree(void);
@@ -28,13 +28,13 @@ extern void prom_testtree(void);
int __init
prom_init(int argc, char **argv, char **envp)
{
- struct linux_promblock *pb;
+ PSYSTEM_PARAMETER_BLOCK pb;
romvec = ROMVECTOR;
pb = sgi_pblock = PROMBLOCK;
prom_argc = argc;
- prom_argv = argv;
- prom_envp = envp;
+ _prom_argv = (LONG *) argv;
+ _prom_envp = (LONG *) envp;
if(pb->magic != 0x53435241) {
prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
diff --git a/arch/mips64/arc/memory.c b/arch/mips64/arc/memory.c
index ae83ef92c..85129ee99 100644
--- a/arch/mips64/arc/memory.c
+++ b/arch/mips64/arc/memory.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: memory.c,v 1.4 1999/11/19 20:35:22 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -7,8 +7,11 @@
* memory.c: PROM library functions for acquiring/using memory descriptors
* given to us from the ARCS firmware.
*
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ * Copyright (C) 1996 by David S. Miller (dm@engr.sgi.com)
+ * Copyright (C) 1999 by Ralf Baechle
+ * Copyright (C) 1999 by Silicon Graphics, Inc.
*/
+#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
@@ -108,9 +111,20 @@ prom_setup_memupper(void)
if(!highest || p->base > highest->base)
highest = p;
}
- mips_memory_upper = highest->base + highest->size;
+ mips_memory_upper = (long) highest->base + highest->size;
+
+#ifdef CONFIG_SGI_IP22
+ /* Evil temporary hack - free_area_init may overwrite firmware reserved
+ memory during the initialization on an Indy if we have more than
+ a certain amount of memory. For now on Indys we limit memory to
+ 64mb max. */
+ if (mips_memory_upper > PAGE_OFFSET + 0x08000000 + 64 * 1024 * 1024) {
+ prom_printf("WARNING: Limiting memory to 64mb.\n");
+ mips_memory_upper = PAGE_OFFSET + 0x08000000 + 64 * 1024 * 1024;
+ }
+#endif
#ifdef DEBUG
- prom_printf("prom_setup_memupper: mips_memory_upper = %08lx\n",
+ prom_printf("prom_setup_memupper: mips_memory_upper = %016lx\n",
mips_memory_upper);
#endif
}
@@ -186,10 +200,14 @@ prom_fixup_mem_map(unsigned long start, unsigned long end)
restart:
while(start < end) {
for(i = 0; i < nents; i++) {
+ unsigned long base, size;
+
+ base = (unsigned long) (long) p[i].base;
+ size = p[i].size;
if ((p[i].type == MEMTYPE_FREE)
- && (start >= (p[i].base))
- && (start < (p[i].base + p[i].size))) {
- start = p[i].base + p[i].size;
+ && (start >= base)
+ && (start < base + size)) {
+ start = base + size;
start &= PAGE_MASK;
goto restart;
}
@@ -203,18 +221,20 @@ void
prom_free_prom_memory (void)
{
struct prom_pmemblock *p;
- unsigned long addr;
- unsigned long num_pages = 0;
-
- for(p = prom_getpblock_array(); p->size != 0; p++) {
- if (p->type == MEMTYPE_PROM) {
- for (addr = p->base; addr < p->base + p->size; addr += PAGE_SIZE) {
- mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved);
- atomic_set(&mem_map[MAP_NR(addr)].count, 1);
- free_page(addr);
- num_pages++;
- }
+ unsigned long addr, base;
+ unsigned long freed = 0;
+
+ for (p = prom_getpblock_array(); p->size != 0; p++) {
+ if (p->type != MEMTYPE_PROM)
+ continue;
+ addr = base = (unsigned long) (long) p->base;
+ while (addr < base + p->size) {
+ mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved);
+ atomic_set(&mem_map[MAP_NR(addr)].count, 1);
+ free_page(addr);
+ freed += PAGE_SIZE;
+ addr += PAGE_SIZE;
}
}
- printk ("Freeing prom memory: %ldk freed\n", num_pages * PAGE_SIZE);
+ printk("Freeing prom memory: %ldkb freed\n", freed / 1024);
}
diff --git a/arch/mips64/arc/misc.c b/arch/mips64/arc/misc.c
index 86c678a60..220c3cc71 100644
--- a/arch/mips64/arc/misc.c
+++ b/arch/mips64/arc/misc.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: misc.c,v 1.2 1999/08/21 21:42:59 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
diff --git a/arch/mips64/arc/printf.c b/arch/mips64/arc/printf.c
index ccefab0c7..2d175ebf8 100644
--- a/arch/mips64/arc/printf.c
+++ b/arch/mips64/arc/printf.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: printf.c,v 1.1 1999/08/20 21:13:33 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
diff --git a/arch/mips64/arc/salone.c b/arch/mips64/arc/salone.c
index 5cba050a1..f3abd90a2 100644
--- a/arch/mips64/arc/salone.c
+++ b/arch/mips64/arc/salone.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: salone.c,v 1.2 1999/08/21 21:42:59 ralf Exp $
*
* Routines to load into memory and execute stand-along program images using
* ARCS PROM firmware.
diff --git a/arch/mips64/arc/time.c b/arch/mips64/arc/time.c
index 81289a53b..82742c4fd 100644
--- a/arch/mips64/arc/time.c
+++ b/arch/mips64/arc/time.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: time.c,v 1.2 1999/08/21 21:42:59 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
diff --git a/arch/mips64/arc/tree.c b/arch/mips64/arc/tree.c
index 36045cbdd..68c6787df 100644
--- a/arch/mips64/arc/tree.c
+++ b/arch/mips64/arc/tree.c
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: tree.c,v 1.3 1999/09/27 16:01:37 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive