summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>1998-10-18 13:32:08 +0000
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>1998-10-18 13:32:08 +0000
commit25a83c8ea51aa41db55dc9995479851c9802a9d9 (patch)
tree771e989f138b1824adedf1d9f146fc26267cbe3c /arch
parentc71fb12ee22941aa89fea27670b7d88992b253aa (diff)
moved sgi/prom and made it a little bit more generic for ARC like firmwares
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/arc/Makefile23
-rw-r--r--arch/mips/arc/cmdline.c64
-rw-r--r--arch/mips/arc/console.c26
-rw-r--r--arch/mips/arc/env.c22
-rw-r--r--arch/mips/arc/file.c59
-rw-r--r--arch/mips/arc/identify.c64
-rw-r--r--arch/mips/arc/init.c67
-rw-r--r--arch/mips/arc/memory.c144
-rw-r--r--arch/mips/arc/misc.c84
-rw-r--r--arch/mips/arc/printf.c35
-rw-r--r--arch/mips/arc/salone.c25
-rw-r--r--arch/mips/arc/tags.c69
-rw-r--r--arch/mips/arc/time.c19
-rw-r--r--arch/mips/arc/tree.c109
14 files changed, 810 insertions, 0 deletions
diff --git a/arch/mips/arc/Makefile b/arch/mips/arc/Makefile
new file mode 100644
index 000000000..110eb340b
--- /dev/null
+++ b/arch/mips/arc/Makefile
@@ -0,0 +1,23 @@
+# $Id: Makefile,v 1.1.1.1 1997/06/01 03:16:40 ralf Exp $
+# Makefile for the SGI arcs prom monitor library routines
+# under Linux.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+OBJS = console.o init.o printf.o memory.o tree.o env.o \
+ cmdline.o misc.o time.o file.o identify.o
+
+all: arclib.a
+
+arclib.a: $(OBJS)
+ $(AR) rcs arclib.a $(OBJS)
+ sync
+
+dep:
+ $(CPP) -M *.c > .depend
+
+include $(TOPDIR)/Rules.make
diff --git a/arch/mips/arc/cmdline.c b/arch/mips/arc/cmdline.c
new file mode 100644
index 000000000..94f0230ec
--- /dev/null
+++ b/arch/mips/arc/cmdline.c
@@ -0,0 +1,64 @@
+/*
+ * cmdline.c: Kernel command line creation using ARCS argc/argv.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: cmdline.c,v 1.3 1998/04/05 11:24:01 ralf Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+
+/* #define DEBUG_CMDLINE */
+
+char arcs_cmdline[CL_SIZE];
+
+__initfunc(char *prom_getcmdline(void))
+{
+ return &(arcs_cmdline[0]);
+}
+
+static char *ignored[] = {
+ "ConsoleIn=",
+ "ConsoleOut=",
+ "SystemPartition=",
+ "OSLoader=",
+ "OSLoadPartition=",
+ "OSLoadFilename="
+};
+#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+
+__initfunc(void prom_init_cmdline(void))
+{
+ char *cp;
+ int actr, i;
+
+ actr = 1; /* Always ignore argv[0] */
+
+ cp = &(arcs_cmdline[0]);
+ while(actr < prom_argc) {
+ for(i = 0; i < NENTS(ignored); i++) {
+ int len = strlen(ignored[i]);
+
+ 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]);
+ *cp++ = ' ';
+
+ pic_cont:
+ actr++;
+ }
+ if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
+ --cp;
+ *cp = '\0';
+
+#ifdef DEBUG_CMDLINE
+ prom_printf("prom_init_cmdline: %s\n", &(arcs_cmdline[0]));
+#endif
+}
diff --git a/arch/mips/arc/console.c b/arch/mips/arc/console.c
new file mode 100644
index 000000000..c1934e796
--- /dev/null
+++ b/arch/mips/arc/console.c
@@ -0,0 +1,26 @@
+/*
+ * console.c: SGI arcs console code.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@sgi.com)
+ *
+ * $Id: console.c,v 1.2 1998/04/05 11:24:01 ralf Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(void prom_putchar(char c))
+{
+ long cnt;
+ char it = c;
+
+ romvec->write(1, &it, 1, &cnt);
+}
+
+__initfunc(char prom_getchar(void))
+{
+ long cnt;
+ char c;
+
+ romvec->read(0, &c, 1, &cnt);
+ return c;
+}
diff --git a/arch/mips/arc/env.c b/arch/mips/arc/env.c
new file mode 100644
index 000000000..133cb8733
--- /dev/null
+++ b/arch/mips/arc/env.c
@@ -0,0 +1,22 @@
+/*
+ * env.c: ARCS environment variable routines.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: env.c,v 1.2 1998/04/05 11:24:01 ralf Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+#include <asm/sgialib.h>
+
+__initfunc(char *prom_getenv(char *name))
+{
+ return romvec->get_evar(name);
+}
+
+__initfunc(long prom_setenv(char *name, char *value))
+{
+ return romvec->set_evar(name, value);
+}
diff --git a/arch/mips/arc/file.c b/arch/mips/arc/file.c
new file mode 100644
index 000000000..93bd2570e
--- /dev/null
+++ b/arch/mips/arc/file.c
@@ -0,0 +1,59 @@
+/*
+ * file.c: ARCS firmware interface to files.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: file.c,v 1.2 1998/04/05 11:24:02 ralf Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt))
+{
+ return romvec->get_vdirent(fd, ent, num, cnt);
+}
+
+__initfunc(long prom_open(char *name, enum linux_omode md, unsigned long *fd))
+{
+ return romvec->open(name, md, fd);
+}
+
+__initfunc(long prom_close(unsigned long fd))
+{
+ return romvec->close(fd);
+}
+
+__initfunc(long prom_read(unsigned long fd, void *buf, unsigned long num, unsigned long *cnt))
+{
+ return romvec->read(fd, buf, num, cnt);
+}
+
+__initfunc(long prom_getrstatus(unsigned long fd))
+{
+ return romvec->get_rstatus(fd);
+}
+
+__initfunc(long prom_write(unsigned long fd, void *buf, unsigned long num, unsigned long *cnt))
+{
+ return romvec->write(fd, buf, num, cnt);
+}
+
+__initfunc(long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm))
+{
+ return romvec->seek(fd, off, sm);
+}
+
+__initfunc(long prom_mount(char *name, enum linux_mountops op))
+{
+ return romvec->mount(name, op);
+}
+
+__initfunc(long prom_getfinfo(unsigned long fd, struct linux_finfo *buf))
+{
+ return romvec->get_finfo(fd, buf);
+}
+
+__initfunc(long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk))
+{
+ return romvec->set_finfo(fd, flags, msk);
+}
diff --git a/arch/mips/arc/identify.c b/arch/mips/arc/identify.c
new file mode 100644
index 000000000..b8292f073
--- /dev/null
+++ b/arch/mips/arc/identify.c
@@ -0,0 +1,64 @@
+/*
+ * identify.c: identify machine by looking up system identifier
+ *
+ * Copyright (C) 1998 Thomas Bogendoerfer
+ *
+ * This code is based on arch/mips/sgi/kernel/system.c, which is
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id$
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/string.h>
+
+#include <asm/sgi.h>
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+
+struct smatch {
+ char *name;
+ int group;
+ int type;
+};
+
+static struct smatch mach_table[] = {
+ { "SGI-IP22", MACH_GROUP_SGI, MACH_SGI_INDY },
+ { "Microsoft-Jazz", MACH_GROUP_JAZZ, MACH_MIPS_MAGNUM_4000 },
+ { "PICA-61", MACH_GROUP_JAZZ, MACH_ACER_PICA_61 },
+ { "RM200PCI", MACH_GROUP_SNI_RM, MACH_SNI_RM200_PCI }
+};
+
+static struct smatch * __init string_to_mach(char *s)
+{
+ int i;
+
+ for (i = 0; i < sizeof (mach_table); i++) {
+ if(!strcmp(s, mach_table[i].name))
+ return &mach_table[i];
+ }
+ prom_printf("\nYeee, could not determine architecture type <%s>\n", s);
+ prom_printf("press a key to reboot\n");
+ prom_getchar();
+ romvec->imode();
+ return NULL;
+}
+
+void __init prom_identify_arch(void)
+{
+ pcomponent *p;
+ struct smatch *mach;
+
+ /* The root component tells us what machine architecture we
+ * have here.
+ */
+ p = prom_getchild(PROM_NULL_COMPONENT);
+ printk("ARCH: %s\n", p->iname);
+ mach = string_to_mach(p->iname);
+
+ mips_machgroup = mach->group;
+ mips_machtype = mach->type;
+}
+
diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c
new file mode 100644
index 000000000..b574911ff
--- /dev/null
+++ b/arch/mips/arc/init.c
@@ -0,0 +1,67 @@
+/*
+ * init.c: PROM library initialisation code.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: init.c,v 1.2 1998/04/05 11:24:02 ralf Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/config.h>
+
+#include <asm/sgialib.h>
+
+/* #define DEBUG_PROM_INIT */
+
+/* Master romvec interface. */
+struct linux_romvec *romvec;
+struct linux_promblock *sgi_pblock;
+int prom_argc;
+char **prom_argv, **prom_envp;
+unsigned short prom_vers, prom_rev;
+
+extern void prom_testtree(void);
+
+__initfunc(int prom_init(int argc, char **argv, char **envp))
+{
+ struct linux_promblock *pb;
+
+ romvec = ROMVECTOR;
+ pb = sgi_pblock = PROMBLOCK;
+ prom_argc = argc;
+ prom_argv = argv;
+ prom_envp = envp;
+
+ if(pb->magic != 0x53435241) {
+ prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
+ while(1)
+ ;
+ }
+
+ prom_init_cmdline();
+
+ prom_vers = pb->ver;
+ prom_rev = pb->rev;
+#ifdef CONFIG_SGI
+ printk("PROMLIB: SGI ARCS firmware Version %d Revision %d\n",
+ prom_vers, prom_rev);
+#else
+ printk("PROMLIB: ARC firmware Version %d Revision %d\n",
+ prom_vers, prom_rev);
+#endif
+ prom_meminit();
+ prom_identify_arch();
+
+#if 0
+ prom_testtree();
+#endif
+
+#ifdef DEBUG_PROM_INIT
+ {
+ prom_printf("Press a key to reboot\n");
+ (void) prom_getchar();
+ romvec->imode();
+ }
+#endif
+ return 0;
+}
diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c
new file mode 100644
index 000000000..655446a01
--- /dev/null
+++ b/arch/mips/arc/memory.c
@@ -0,0 +1,144 @@
+/*
+ * 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)
+ *
+ * $Id: memory.c,v 1.2 1998/04/05 11:24:02 ralf Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/swap.h>
+#include <linux/config.h>
+
+#include <asm/sgialib.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/bootinfo.h>
+
+/* #define DEBUG */
+
+__initfunc(struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr))
+{
+ return romvec->get_mdesc(curr);
+}
+
+#ifdef DEBUG /* convenient for debugging */
+#ifdef CONFIG_SGI
+static char *mtypes[8] = {
+ "Exception Block",
+ "ARCS Romvec Page",
+ "Free/Contig RAM",
+ "Generic Free RAM",
+ "Bad Memory",
+ "Standlong Program Pages",
+ "ARCS Temp Storage Area",
+ "ARCS Permanent Storage Area"
+};
+#else
+static char *mtypes[8] = {
+ "Exception Block",
+ "SystemParameterBlock",
+ "FreeMemory",
+ "Bad Memory",
+ "LoadedProgram",
+ "FirmwareTemporary",
+ "FirmwarePermanent",
+ "FreeContigiuous"
+#endif
+#endif
+
+static struct prom_pmemblock prom_pblocks[PROM_MAX_PMEMBLOCKS];
+
+__initfunc(struct prom_pmemblock *prom_getpblock_array(void))
+{
+ return &prom_pblocks[0];
+}
+
+__initfunc(static void prom_setup_memupper(void))
+{
+ struct prom_pmemblock *p, *highest;
+
+ for(p = prom_getpblock_array(), highest = 0; p->size != 0; p++) {
+ if(p->base == 0xdeadbeef)
+ prom_printf("WHEEE, bogus pmemblock\n");
+ if(!highest || p->base > highest->base)
+ highest = p;
+ }
+ mips_memory_upper = highest->base + highest->size;
+#ifdef DEBUG
+ prom_printf("prom_setup_memupper: mips_memory_upper = %08lx\n",
+ mips_memory_upper);
+#endif
+}
+
+__initfunc(void prom_meminit(void))
+{
+ struct linux_mdesc *p;
+ int totram;
+ int i = 0;
+
+ p = prom_getmdesc(PROM_NULL_MDESC);
+#ifdef DEBUG
+ prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
+ while(p) {
+ prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
+ i, p, p->base, p->pages, mtypes[p->type]);
+ p = prom_getmdesc(p);
+ i++;
+ }
+#endif
+ p = prom_getmdesc(PROM_NULL_MDESC);
+ totram = 0;
+ i = 0;
+ while(p) {
+ if(p->type == free || p->type == fcontig) {
+ prom_pblocks[i].base =
+ ((p->base<<PAGE_SHIFT) + 0x80000000);
+ prom_pblocks[i].size = p->pages << PAGE_SHIFT;
+ totram += prom_pblocks[i].size;
+#ifdef DEBUG
+ prom_printf("free_chunk[%d]: base=%08lx size=%d\n",
+ i, prom_pblocks[i].base,
+ prom_pblocks[i].size);
+#endif
+ i++;
+ }
+ p = prom_getmdesc(p);
+ }
+ prom_pblocks[i].base = 0xdeadbeef;
+ prom_pblocks[i].size = 0; /* indicates last elem. of array */
+ printk("PROMLIB: Total free ram %d bytes (%dK,%dMB)\n",
+ totram, (totram/1024), (totram/1024/1024));
+
+ /* Setup upper physical memory bound. */
+ prom_setup_memupper();
+}
+
+/* Called from mem_init() to fixup the mem_map page settings. */
+__initfunc(void prom_fixup_mem_map(unsigned long start, unsigned long end))
+{
+ struct prom_pmemblock *p;
+ int i, nents;
+
+ /* Determine number of pblockarray entries. */
+ p = prom_getpblock_array();
+ for(i = 0; p[i].size; i++)
+ ;
+ nents = i;
+ while(start < end) {
+ for(i = 0; i < nents; i++) {
+ if((start >= (p[i].base)) &&
+ (start < (p[i].base + p[i].size))) {
+ start = p[i].base + p[i].size;
+ start &= PAGE_MASK;
+ continue;
+ }
+ }
+ set_bit(PG_reserved, &mem_map[MAP_NR(start)].flags);
+ start += PAGE_SIZE;
+ }
+}
diff --git a/arch/mips/arc/misc.c b/arch/mips/arc/misc.c
new file mode 100644
index 000000000..ab50caf1e
--- /dev/null
+++ b/arch/mips/arc/misc.c
@@ -0,0 +1,84 @@
+/* $Id: misc.c,v 1.5 1998/08/25 09:14:50 ralf Exp $
+ *
+ * misc.c: Miscellaneous ARCS PROM routines.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ */
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#include <asm/bcache.h>
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+#include <asm/system.h>
+
+extern unsigned long mips_cputype;
+extern void *sgiwd93_host;
+extern void reset_wd33c93(void *instance);
+
+void prom_halt(void)
+{
+ bcops->bc_disable();
+ cli();
+#if CONFIG_SCSI_SGIWD93
+ reset_wd33c93(sgiwd93_host);
+#endif
+ romvec->halt();
+}
+
+void prom_powerdown(void)
+{
+ bcops->bc_disable();
+ cli();
+#if CONFIG_SCSI_SGIWD93
+ reset_wd33c93(sgiwd93_host);
+#endif
+ romvec->pdown();
+}
+
+/* XXX is this a soft reset basically? XXX */
+void prom_restart(void)
+{
+ bcops->bc_disable();
+ cli();
+#if CONFIG_SCSI_SGIWD93
+ reset_wd33c93(sgiwd93_host);
+#endif
+ romvec->restart();
+}
+
+void prom_reboot(void)
+{
+ bcops->bc_disable();
+ cli();
+#if CONFIG_SCSI_SGIWD93
+ reset_wd33c93(sgiwd93_host);
+#endif
+ romvec->reboot();
+}
+
+void prom_imode(void)
+{
+ bcops->bc_disable();
+ cli();
+#if CONFIG_SCSI_SGIWD93
+ reset_wd33c93(sgiwd93_host);
+#endif
+ romvec->imode();
+}
+
+long prom_cfgsave(void)
+{
+ return romvec->cfg_save();
+}
+
+struct linux_sysid *prom_getsysid(void)
+{
+ return romvec->get_sysid();
+}
+
+__initfunc(void prom_cacheflush(void))
+{
+ romvec->cache_flush();
+}
diff --git a/arch/mips/arc/printf.c b/arch/mips/arc/printf.c
new file mode 100644
index 000000000..132f97c82
--- /dev/null
+++ b/arch/mips/arc/printf.c
@@ -0,0 +1,35 @@
+/*
+ * printf.c: Putting things on the screen using SGI arcs
+ * PROM facilities.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@sgi.com)
+ *
+ * $Id: printf.c,v 1.2 1998/04/05 11:24:03 ralf Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#include <asm/sgialib.h>
+
+static char ppbuf[1024];
+
+__initfunc(void prom_printf(char *fmt, ...))
+{
+ va_list args;
+ char ch, *bptr;
+ int i;
+
+ va_start(args, fmt);
+ i = vsprintf(ppbuf, fmt, args);
+
+ bptr = ppbuf;
+
+ while((ch = *(bptr++)) != 0) {
+ if(ch == '\n')
+ prom_putchar('\r');
+
+ prom_putchar(ch);
+ }
+ va_end(args);
+ return;
+}
diff --git a/arch/mips/arc/salone.c b/arch/mips/arc/salone.c
new file mode 100644
index 000000000..e9502c545
--- /dev/null
+++ b/arch/mips/arc/salone.c
@@ -0,0 +1,25 @@
+/*
+ * salone.c: Routines to load into memory and execute stand-along
+ * program images using ARCS PROM firmware.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: salone.c,v 1.2 1998/04/05 11:24:03 ralf Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr))
+{
+ return romvec->load(name, end, pc, eaddr);
+}
+
+__initfunc(long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp))
+{
+ return romvec->invoke(pc, sp, argc, argv, envp);
+}
+
+__initfunc(long prom_exec(char *name, long argc, char **argv, char **envp))
+{
+ return romvec->exec(name, argc, argv, envp);
+}
diff --git a/arch/mips/arc/tags.c b/arch/mips/arc/tags.c
new file mode 100644
index 000000000..cb935b9ff
--- /dev/null
+++ b/arch/mips/arc/tags.c
@@ -0,0 +1,69 @@
+/*
+ * tags.c: Initialize the arch tags the way the MIPS kernel setup
+ * expects.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: tags.c,v 1.2 1998/04/05 11:24:04 ralf Exp $
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+#include <asm/addrspace.h>
+#include <asm/sgialib.h>
+#include <asm/bootinfo.h>
+#include <asm/sgimc.h>
+
+/* XXX This tag thing is a fucking rats nest, I'm very inclined to completely
+ * XXX rework the MIPS people's multi-arch code _NOW_.
+ */
+
+static unsigned long machtype_SGI_INDY = MACH_SGI_INDY;
+static unsigned long machgroup_SGI = MACH_GROUP_SGI;
+static unsigned long memlower_SGI_INDY = (KSEG0 + SGIMC_SEG0_BADDR);
+static unsigned long cputype_SGI_INDY = CPU_R4400SC;
+static unsigned long tlb_entries_SGI_INDY = 48;
+static unsigned long dummy_SGI_INDY = 0;
+static struct drive_info_struct dummy_dinfo_SGI_INDY = { { 0, }, };
+char arcs_cmdline[CL_SIZE];
+
+#define TAG(t,l) {tag_##t,(l)} /* XXX RATS NEST CODE!!! XXX */
+#define TAGVAL(v) (void*)&(v) /* XXX FUCKING LOSING!!! XXX */
+
+tag_def taglist_sgi_indy[] = {
+ {TAG(machtype, ULONGSIZE), TAGVAL(machtype_SGI_INDY)},
+ {TAG(machgroup, ULONGSIZE), TAGVAL(machgroup_SGI)},
+ {TAG(memlower, ULONGSIZE), TAGVAL(memlower_SGI_INDY)},
+ {TAG(cputype, ULONGSIZE), TAGVAL(cputype_SGI_INDY)},
+ {TAG(tlb_entries, ULONGSIZE), TAGVAL(tlb_entries_SGI_INDY)},
+ {TAG(vram_base, ULONGSIZE), TAGVAL(dummy_SGI_INDY)},
+ {TAG(drive_info, DRVINFOSIZE), TAGVAL(dummy_dinfo_SGI_INDY)},
+ {TAG(mount_root_rdonly, ULONGSIZE), TAGVAL(dummy_SGI_INDY)},
+ {TAG(command_line, CL_SIZE), TAGVAL(arcs_cmdline[0])},
+ {TAG(dummy, 0), NULL}
+ /* XXX COLOSTOMY BAG!!!! XXX */
+};
+
+__initfunc(void prom_setup_archtags(void))
+{
+ tag_def *tdp = &taglist_sgi_indy[0];
+ tag *tp;
+
+ tp = (tag *) (mips_memory_upper - sizeof(tag));
+ while(tdp->t.tag != tag_dummy) {
+ unsigned long size;
+ char *d;
+
+ *tp = tdp->t;
+ size = tp->size;
+ d = (char *) tdp->d;
+ tp = (tag *)(((unsigned long)tp) - (tp->size));
+ if(size)
+ memcpy(tp, d, size);
+
+ tp--;
+ tdp++;
+ }
+ *tp = tdp->t; /* copy last dummy element over */
+}
diff --git a/arch/mips/arc/time.c b/arch/mips/arc/time.c
new file mode 100644
index 000000000..b8dcb1251
--- /dev/null
+++ b/arch/mips/arc/time.c
@@ -0,0 +1,19 @@
+/*
+ * time.c: Extracting time information from ARCS prom.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: time.c,v 1.2 1998/04/05 11:24:04 ralf Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+__initfunc(struct linux_tinfo *prom_gettinfo(void))
+{
+ return romvec->get_tinfo();
+}
+
+__initfunc(unsigned long prom_getrtime(void))
+{
+ return romvec->get_rtime();
+}
diff --git a/arch/mips/arc/tree.c b/arch/mips/arc/tree.c
new file mode 100644
index 000000000..0ef7ab7f0
--- /dev/null
+++ b/arch/mips/arc/tree.c
@@ -0,0 +1,109 @@
+/*
+ * tree.c: PROM component device tree code.
+ *
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: tree.c,v 1.2 1998/04/05 11:24:05 ralf Exp $
+ */
+#include <linux/init.h>
+#include <asm/sgialib.h>
+
+#define DEBUG_PROM_TREE
+
+__initfunc(pcomponent *prom_getsibling(pcomponent *this))
+{
+ if(this == PROM_NULL_COMPONENT)
+ return PROM_NULL_COMPONENT;
+ return romvec->next_component(this);
+}
+
+__initfunc(pcomponent *prom_getchild(pcomponent *this))
+{
+ return romvec->child_component(this);
+}
+
+__initfunc(pcomponent *prom_getparent(pcomponent *child))
+{
+ if(child == PROM_NULL_COMPONENT)
+ return PROM_NULL_COMPONENT;
+ return romvec->parent_component(child);
+}
+
+__initfunc(long prom_getcdata(void *buffer, pcomponent *this))
+{
+ return romvec->component_data(buffer, this);
+}
+
+__initfunc(pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data))
+{
+ return romvec->child_add(this, tmp, data);
+}
+
+__initfunc(long prom_delcomponent(pcomponent *this))
+{
+ return romvec->comp_del(this);
+}
+
+__initfunc(pcomponent *prom_componentbypath(char *path))
+{
+ return romvec->component_by_path(path);
+}
+
+#ifdef DEBUG_PROM_TREE
+static char *classes[] = {
+ "system", "processor", "cache", "adapter", "controller", "peripheral",
+ "memory"
+};
+
+static char *types[] = {
+ "arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache", "sccache",
+ "memdev", "eisa adapter", "tc adapter", "scsi adapter", "dti adapter",
+ "multi-func adapter", "disk controller", "tp controller",
+ "cdrom controller", "worm controller", "serial controller",
+ "net controller", "display controller", "parallel controller",
+ "pointer controller", "keyboard controller", "audio controller",
+ "misc controller", "disk peripheral", "floppy peripheral",
+ "tp peripheral", "modem peripheral", "monitor peripheral",
+ "printer peripheral", "pointer peripheral", "keyboard peripheral",
+ "terminal peripheral", "line peripheral", "net peripheral",
+ "misc peripheral", "anonymous"
+};
+
+static char *iflags[] = {
+ "bogus", "read only", "removable", "console in", "console out",
+ "input", "output"
+};
+
+__initfunc(static void dump_component(pcomponent *p))
+{
+ prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
+ p, classes[p->class], types[p->type],
+ iflags[p->iflags], p->vers, p->rev);
+ prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
+ p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
+}
+
+__initfunc(static void traverse(pcomponent *p, int op))
+{
+ dump_component(p);
+ if(prom_getchild(p))
+ traverse(prom_getchild(p), 1);
+ if(prom_getsibling(p) && op)
+ traverse(prom_getsibling(p), 1);
+}
+
+__initfunc(void prom_testtree(void))
+{
+ pcomponent *p;
+
+ p = prom_getchild(PROM_NULL_COMPONENT);
+ dump_component(p);
+ p = prom_getchild(p);
+ while(p) {
+ dump_component(p);
+ p = prom_getsibling(p);
+ }
+ prom_printf("press a key\n");
+ prom_getchar();
+}
+#endif