|
From: Andy P. <at...@us...> - 2002-04-10 18:31:38
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/arc
In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/arc
Modified Files:
Makefile cmdline.c console.c env.c file.c identify.c init.c
memory.c misc.c salone.c time.c tree.c
Added Files:
arc_con.c
Removed Files:
printf.c
Log Message:
synch 2.4.15
--- NEW FILE ---
/*
* Wrap-around code for a console using the
* ARC io-routines.
*
* Copyright (c) 1998 Harald Koerfgen
*/
#include <linux/tty.h>
#include <linux/major.h>
#include <linux/ptrace.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/fs.h>
extern char prom_getchar (void);
extern void prom_printf (char *, ...);
static void prom_console_write(struct console *co, const char *s,
unsigned count)
{
unsigned i;
/*
* Now, do each character
*/
for (i = 0; i < count; i++) {
if (*s == 10)
prom_printf("%c", 13);
prom_printf("%c", *s++);
}
}
static int prom_console_wait_key(struct console *co)
{
return prom_getchar();
}
static int __init prom_console_setup(struct console *co, char *options)
{
return 0;
}
static kdev_t prom_console_device(struct console *c)
{
return MKDEV(TTY_MAJOR, 64 + c->index);
}
static struct console arc_cons = {
"ttyS",
prom_console_write,
NULL,
prom_console_device,
prom_console_wait_key,
NULL,
prom_console_setup,
CON_PRINTBUFFER,
-1,
0,
NULL
};
/*
* Register console.
*/
void __init arc_console_init(void)
{
register_console(&arc_cons);
}
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile 14 Jan 2001 19:28:33 -0000 1.1.1.1
+++ Makefile 10 Apr 2002 14:38:03 -0000 1.2
@@ -1,4 +1,3 @@
-# $Id$
#
# Makefile for the SGI arcs prom monitor library routines
# under Linux.
@@ -10,7 +9,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
L_TARGET = arclib.a
-L_OBJS = console.o init.o printf.o memory.o tree.o env.o cmdline.o misc.o \
- time.o file.o identify.o
+
+obj-y += console.o init.o memory.o tree.o env.o cmdline.o misc.o \
+ time.o file.o identify.o
+
+obj-$(CONFIG_ARC_CONSOLE) += arc_con.o
include $(TOPDIR)/Rules.make
Index: cmdline.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/cmdline.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- cmdline.c 14 Jan 2001 19:28:34 -0000 1.1.1.1
+++ cmdline.c 10 Apr 2002 14:38:03 -0000 1.2
@@ -2,8 +2,6 @@
* cmdline.c: Kernel command line creation using ARCS argc/argv.
*
* Copyright (C) 1996 David S. Miller (dm...@en...)
- *
- * $Id$
*/
#include <linux/init.h>
#include <linux/kernel.h>
@@ -12,9 +10,9 @@
#include <asm/sgialib.h>
#include <asm/bootinfo.h>
-/* #define DEBUG_CMDLINE */
+#undef DEBUG_CMDLINE
-char arcs_cmdline[CL_SIZE];
+char arcs_cmdline[COMMAND_LINE_SIZE];
char * __init prom_getcmdline(void)
{
@@ -27,10 +25,49 @@
"SystemPartition=",
"OSLoader=",
"OSLoadPartition=",
- "OSLoadFilename="
+ "OSLoadFilename=",
+ "OSLoadOptions="
};
#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+static char *used_arc[][2] = {
+ { "OSLoadPartition=", "root=" },
+ { "OSLoadOptions=", "" }
+};
+
+static char * __init move_firmware_args(char* cp)
+{
+ char *s;
+ int actr, i;
+
+ actr = 1; /* Always ignore argv[0] */
+
+ while (actr < prom_argc) {
+ for(i = 0; i < NENTS(used_arc); i++) {
+ int len = strlen(used_arc[i][0]);
+
+ if(!strncmp(prom_argv[actr], used_arc[i][0], len)) {
+ /* Ok, we want it. First append the replacement... */
+ strcat(cp, used_arc[i][1]);
+ cp += strlen(used_arc[i][1]);
+ /* ... and now the argument */
+ s = strstr(prom_argv[actr], "=");
+ if(s) {
+ s++;
+ strcpy(cp, s);
+ cp += strlen(s);
+ }
+ *cp++ = ' ';
+ break;
+ }
+ }
+ actr++;
+ }
+
+ return cp;
+}
+
+
void __init prom_init_cmdline(void)
{
char *cp;
@@ -39,8 +76,14 @@
actr = 1; /* Always ignore argv[0] */
cp = &(arcs_cmdline[0]);
- while(actr < prom_argc) {
- for(i = 0; i < NENTS(ignored); i++) {
+ /*
+ * Move ARC variables to the beginning to make sure they can be
+ * overridden by later arguments.
+ */
+ cp = move_firmware_args(cp);
+
+ while (actr < prom_argc) {
+ for (i = 0; i < NENTS(ignored); i++) {
int len = strlen(ignored[i]);
if(!strncmp(prom_argv[actr], ignored[i], len))
Index: console.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/console.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- console.c 14 Jan 2001 19:28:34 -0000 1.1.1.1
+++ console.c 10 Apr 2002 14:38:03 -0000 1.2
@@ -1,50 +1,70 @@
/*
- * console.c: SGI arcs console code.
+ * 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
+ * for more details.
*
* Copyright (C) 1996 David S. Miller (dm...@sg...)
* Compability with board caches, Ulf Carlsson
- *
- * $Id$
*/
#include <linux/config.h>
#include <linux/init.h>
+#include <linux/kernel.h>
#include <asm/sgialib.h>
#include <asm/bcache.h>
+#include <linux/console.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
-/* The romvec is not compatible with board caches. Thus we disable it during
- * romvec action. Since r4xx0.c is always compiled and linked with your kernel,
- * this shouldn't cause any harm regardless what MIPS processor you have.
+/*
+ * IP22 boardcache is not compatible with board caches. Thus we disable it
+ * during romvec action. Since r4xx0.c is always compiled and linked with your
+ * kernel, this shouldn't cause any harm regardless what MIPS processor you
+ * have.
*
- * The romvec write and read functions seem to interfere with the serial lines
+ * The ARC write and read functions seem to interfere with the serial lines
* in some way. You should be careful with them.
*/
-extern struct bcache_ops *bcops;
-#ifdef CONFIG_SGI_PROM_CONSOLE
void prom_putchar(char c)
-#else
-void __init prom_putchar(char c)
-#endif
{
long cnt;
char it = c;
- bcops->bc_disable();
+ bc_disable();
romvec->write(1, &it, 1, &cnt);
- bcops->bc_enable();
+ bc_enable();
}
-#ifdef CONFIG_SGI_PROM_CONSOLE
-char prom_getchar(void)
-#else
char __init prom_getchar(void)
-#endif
{
long cnt;
char c;
- bcops->bc_disable();
+ bc_disable();
romvec->read(0, &c, 1, &cnt);
- bcops->bc_enable();
+ bc_enable();
+
return c;
+}
+
+static char ppbuf[1024];
+
+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);
}
Index: env.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/env.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
Index: file.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/file.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
Index: identify.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/identify.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- identify.c 14 Jan 2001 19:28:34 -0000 1.1.1.1
+++ identify.c 10 Apr 2002 14:38:03 -0000 1.2
@@ -6,8 +6,6 @@
* This code is based on arch/mips/sgi/kernel/system.c, which is
*
* Copyright (C) 1996 David S. Miller (dm...@en...)
- *
- * $Id$
*/
#include <linux/init.h>
#include <linux/kernel.h>
@@ -19,50 +17,51 @@
#include <asm/bootinfo.h>
struct smatch {
- char *name;
- int group;
- int type;
- int flags;
+ char *name;
+ int group;
+ int type;
+ int flags;
};
static struct smatch mach_table[] = {
- { "SGI-IP22", MACH_GROUP_SGI, MACH_SGI_INDY, PROM_FLAG_ARCS },
- { "Microsoft-Jazz", MACH_GROUP_JAZZ, MACH_MIPS_MAGNUM_4000, 0 },
- { "PICA-61", MACH_GROUP_JAZZ, MACH_ACER_PICA_61, 0 },
- { "RM200PCI", MACH_GROUP_SNI_RM, MACH_SNI_RM200_PCI, 0 }
+ {"SGI-IP22", MACH_GROUP_SGI, MACH_SGI_INDY, PROM_FLAG_ARCS},
+ {"Microsoft-Jazz", MACH_GROUP_JAZZ, MACH_MIPS_MAGNUM_4000, 0},
+ {"PICA-61", MACH_GROUP_JAZZ, MACH_ACER_PICA_61, 0},
+ {"RM200PCI", MACH_GROUP_SNI_RM, MACH_SNI_RM200_PCI, 0}
};
int prom_flags;
-static struct smatch * __init string_to_mach(char *s)
+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;
+ int i;
+
+ for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); 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;
- prom_flags = mach->flags;
-}
+ 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;
+ prom_flags = mach->flags;
+}
Index: init.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/init.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- init.c 14 Jan 2001 19:28:34 -0000 1.1.1.1
+++ init.c 10 Apr 2002 14:38:03 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Id$
+/*
* 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
* for more details.
@@ -23,7 +23,9 @@
extern void prom_testtree(void);
-int __init prom_init(int argc, char **argv, char **envp, int *prom_vec)
+extern void arc_setup_console(void);
+
+void __init prom_init(int argc, char **argv, char **envp, int *prom_vec)
{
struct linux_promblock *pb;
@@ -33,7 +35,20 @@
prom_argv = argv;
prom_envp = envp;
- if(pb->magic != 0x53435241) {
+#if 0
+ /* arc_printf should not use prom_printf as soon as we free
+ * the prom buffers - This horribly breaks on Indys with framebuffer
+ * as it simply stops after initialising swap - On the Indigo2 serial
+ * console you will get A LOT illegal instructions - Only enable
+ * this for early init crashes - This also brings up artefacts of
+ * printing everything twice on serial console and on GFX Console
+ * this has the effect of having the prom printing everything
+ * in the small rectangle and the kernel printing around.
+ */
+
+ arc_setup_console();
+#endif
+ if (pb->magic != 0x53435241) {
prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
while(1)
;
@@ -55,5 +70,4 @@
romvec->imode();
}
#endif
- return 0;
}
Index: memory.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/memory.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- memory.c 14 Jan 2001 19:28:35 -0000 1.1.1.1
+++ memory.c 10 Apr 2002 14:38:03 -0000 1.2
@@ -3,8 +3,6 @@
* given to us from the ARCS firmware.
*
* Copyright (C) 1996 David S. Miller (dm...@en...)
- *
- * $Id$
*/
#include <linux/init.h>
#include <linux/kernel.h>
@@ -34,7 +32,7 @@
"Free/Contig RAM",
"Generic Free RAM",
"Bad Memory",
- "Standlong Program Pages",
+ "Standalone Program Pages",
"ARCS Temp Storage Area",
"ARCS Permanent Storage Area"
};
@@ -47,31 +45,25 @@
"LoadedProgram",
"FirmwareTemporary",
"FirmwarePermanent",
- "FreeContigiuous"
+ "FreeContiguous"
};
#define mtypes(a) (prom_flags & PROM_FLAG_ARCS) ? arcs_mtypes[a.arcs] : arc_mtypes[a.arc]
#endif
-static struct prom_pmemblock pblocks[PROM_MAX_PMEMBLOCKS];
-
-#define MEMTYPE_DONTUSE 0
-#define MEMTYPE_PROM 1
-#define MEMTYPE_FREE 2
-
static inline int memtype_classify_arcs (union linux_memtypes type)
{
switch (type.arcs) {
case arcs_fcontig:
case arcs_free:
- return MEMTYPE_FREE;
+ return BOOT_MEM_RAM;
case arcs_atmp:
- return MEMTYPE_PROM;
+ return BOOT_MEM_ROM_DATA;
case arcs_eblock:
case arcs_rvpage:
case arcs_bmem:
case arcs_prog:
case arcs_aperm:
- return MEMTYPE_DONTUSE;
+ return BOOT_MEM_RESERVED;
default:
BUG();
}
@@ -83,15 +75,15 @@
switch (type.arc) {
case arc_free:
case arc_fcontig:
- return MEMTYPE_FREE;
+ return BOOT_MEM_RAM;
case arc_atmp:
- return MEMTYPE_PROM;
+ return BOOT_MEM_ROM_DATA;
case arc_eblock:
case arc_rvpage:
case arc_bmem:
case arc_prog:
case arc_aperm:
- return MEMTYPE_DONTUSE;
+ return BOOT_MEM_RESERVED;
default:
BUG();
}
@@ -106,50 +98,13 @@
return memtype_classify_arc(type);
}
-static inline unsigned long find_max_low_pfn(void)
-{
- struct prom_pmemblock *p, *highest;
- unsigned long pfn;
-
- p = pblocks;
- highest = 0;
- while (p->size != 0) {
- if (!highest || p->base > highest->base)
- highest = p;
- p++;
- }
-
- pfn = (highest->base + highest->size) >> PAGE_SHIFT;
-#ifdef DEBUG
- prom_printf("find_max_low_pfn: 0x%lx pfns.\n", pfn);
-#endif
- return pfn;
-}
-
-static inline struct prom_pmemblock *find_largest_memblock(void)
-{
- struct prom_pmemblock *p, *largest;
-
- p = pblocks;
- largest = 0;
- while (p->size != 0) {
- if (!largest || p->size > largest->size)
- largest = p;
- p++;
- }
-
- return largest;
-}
-
void __init prom_meminit(void)
{
- struct prom_pmemblock *largest;
- unsigned long bootmap_size;
struct linux_mdesc *p;
- int totram;
- int i = 0;
#ifdef DEBUG
+ int i = 0;
+
prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
p = ArcGetMemoryDescriptor(PROM_NULL_MDESC);
while(p) {
@@ -160,77 +115,36 @@
}
#endif
- totram = 0;
- i = 0;
p = PROM_NULL_MDESC;
while ((p = ArcGetMemoryDescriptor(p))) {
- pblocks[i].type = prom_memtype_classify(p->type);
- pblocks[i].base = p->base << PAGE_SHIFT;
- pblocks[i].size = p->pages << PAGE_SHIFT;
-
- switch (pblocks[i].type) {
- case MEMTYPE_FREE:
- totram += pblocks[i].size;
-#ifdef DEBUG
- prom_printf("free_chunk[%d]: base=%08lx size=%x\n",
- i, pblocks[i].base,
- pblocks[i].size);
-#endif
- i++;
- break;
- case MEMTYPE_PROM:
-#ifdef DEBUG
- prom_printf("prom_chunk[%d]: base=%08lx size=%x\n",
- i, pblocks[i].base,
- pblocks[i].size);
-#endif
- i++;
- break;
- default:
- break;
- }
- }
- pblocks[i].size = 0;
-
- max_low_pfn = find_max_low_pfn();
-
- largest = find_largest_memblock();
- bootmap_size = init_bootmem(largest->base >> PAGE_SHIFT, max_low_pfn);
+ unsigned long base, size;
+ long type;
- for (i = 0; pblocks[i].size; i++)
- if (pblocks[i].type == MEMTYPE_FREE)
- free_bootmem(pblocks[i].base, pblocks[i].size);
+ base = p->base << PAGE_SHIFT;
+ size = p->pages << PAGE_SHIFT;
+ type = prom_memtype_classify(p->type);
- /* This test is simpleminded. It will fail if the bootmem bitmap
- falls into multiple adjacent ARC memory areas. */
- if (bootmap_size > largest->size) {
- prom_printf("CRITIAL: overwriting PROM data.\n");
- BUG();
+ add_memory_region(base, size, type);
}
-
- /* Reserve the memory bootmap itself */
- reserve_bootmem(largest->base, bootmap_size);
-
- printk("PROMLIB: Total free ram %dK / %dMB.\n",
- totram >> 10, totram >> 20);
}
void __init
prom_free_prom_memory (void)
{
- struct prom_pmemblock *p;
unsigned long freed = 0;
unsigned long addr;
+ int i;
- for (p = pblocks; p->size != 0; p++) {
- if (p->type != MEMTYPE_PROM)
+ for (i = 0; i < boot_mem_map.nr_map; i++) {
+ if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
continue;
- addr = PAGE_OFFSET + p->base;
- while (addr < p->base + p->size) {
- ClearPageReserved(virt_to_page(addr));
- set_page_count(virt_to_page(addr), 1);
- free_page(addr);
+ addr = boot_mem_map.map[i].addr;
+ while (addr < boot_mem_map.map[i].addr
+ + boot_mem_map.map[i].size) {
+ ClearPageReserved(virt_to_page(__va(addr)));
+ set_page_count(virt_to_page(__va(addr)), 1);
+ free_page((unsigned long)__va(addr));
addr += PAGE_SIZE;
freed += PAGE_SIZE;
}
Index: misc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- misc.c 14 Jan 2001 19:28:35 -0000 1.1.1.1
+++ misc.c 10 Apr 2002 14:38:03 -0000 1.2
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
* misc.c: Miscellaneous ARCS PROM routines.
*
* Copyright (C) 1996 David S. Miller (dm...@en...)
@@ -13,13 +12,12 @@
#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();
+ bc_disable();
cli();
#if CONFIG_SCSI_SGIWD93
reset_wd33c93(sgiwd93_host);
@@ -29,7 +27,7 @@
void prom_powerdown(void)
{
- bcops->bc_disable();
+ bc_disable();
cli();
#if CONFIG_SCSI_SGIWD93
reset_wd33c93(sgiwd93_host);
@@ -40,7 +38,7 @@
/* XXX is this a soft reset basically? XXX */
void prom_restart(void)
{
- bcops->bc_disable();
+ bc_disable();
cli();
#if CONFIG_SCSI_SGIWD93
reset_wd33c93(sgiwd93_host);
@@ -50,7 +48,7 @@
void prom_reboot(void)
{
- bcops->bc_disable();
+ bc_disable();
cli();
#if CONFIG_SCSI_SGIWD93
reset_wd33c93(sgiwd93_host);
@@ -58,9 +56,9 @@
romvec->reboot();
}
-void prom_imode(void)
+void ArcEnterInteractiveMode(void)
{
- bcops->bc_disable();
+ bc_disable();
cli();
#if CONFIG_SCSI_SGIWD93
reset_wd33c93(sgiwd93_host);
Index: salone.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/salone.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
Index: time.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/time.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
Index: tree.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/tree.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- printf.c DELETED ---
|