summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1997-05-01 15:13:31 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1997-05-01 15:13:31 +0000
commit4163dfee490ef5c718b2d89280d095bfe8dd4762 (patch)
treec394d8dde32da9ff104feb9814ead64be150d138
parent6808486e7efb55dd7867ff158c25cf66e95cfe53 (diff)
Some arc bioses are faulty...
-rw-r--r--sys/arch/arc/arc/arcbios.c48
-rw-r--r--sys/arch/arc/arc/arcbios.h9
2 files changed, 51 insertions, 6 deletions
diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c
index defd56eb6e9..ac9f0fb4470 100644
--- a/sys/arch/arc/arc/arcbios.c
+++ b/sys/arch/arc/arc/arcbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.c,v 1.7 1997/04/19 17:19:38 pefo Exp $ */
+/* $OpenBSD: arcbios.c,v 1.8 1997/05/01 15:13:28 pefo Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
* Copyright (c) 1996 Per Fogelstrom. All rights reserved.
@@ -29,6 +29,7 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <lib/libkern/libkern.h>
@@ -46,6 +47,8 @@ extern int physmem; /* Total physical memory size */
int Bios_Read __P((int, char *, int, int *));
int Bios_Write __P((int, char *, int, int *));
+int Bios_Open __P((char *, int, u_int *));
+int Bios_Close __P((u_int));
arc_mem_t *Bios_GetMemoryDescriptor __P((arc_mem_t *));
arc_sid_t *Bios_GetSystemId __P((void));
arc_config_t *Bios_GetChild __P((arc_config_t *));
@@ -258,7 +261,8 @@ get_cpu_type()
arc_sid_t *sid;
int i;
- if(bios_base->magic != ARC_PARAM_BLK_MAGIC) {
+ if((bios_base->magic != ARC_PARAM_BLK_MAGIC) &&
+ (bios_base->magic != ARC_PARAM_BLK_MAGIC_BUG)) {
return(-1); /* This is not an ARC system */
}
@@ -318,3 +322,43 @@ bios_display_info(xpos, ypos, xsize, ysize)
*ysize = displayinfo.CursorMaxYPosition;
}
+/*
+ * Load the incore miniroot into memory. This is used for
+ * Initial booting before we have any file system. CD-rom booting.
+ */
+int
+bios_load_miniroot(path, where)
+ char *path;
+ caddr_t where;
+{
+ u_int file;
+ u_int count;
+ int i;
+ char s[32];
+
+static char mrdefault[] = {"scsi(0)disk(0)rdisk(0)partition(1)\\miniroot" };
+
+ bios_putstring("Loading miniroot:");
+
+ if(path == 0)
+ path = mrdefault;
+ bios_putstring(path);
+ bios_putstring("\n");
+
+ if((i = Bios_Open(path,0,&file)) != arc_ESUCCESS) {
+ sprintf(s, "Error %d. Load failed!\n", i);
+ bios_putstring(s);
+ return(-1);
+ }
+ do {
+
+ i = Bios_Read(file, where, 4096, &count);
+ bios_putstring(".");
+ where += count;
+ } while((i == 0) && (count != 0));
+
+ Bios_Close(file);
+ bios_putstring("\nLoaded.\n");
+ return(0);
+}
+
diff --git a/sys/arch/arc/arc/arcbios.h b/sys/arch/arc/arc/arcbios.h
index 9fb004ee156..58b4d89f2c7 100644
--- a/sys/arch/arc/arc/arcbios.h
+++ b/sys/arch/arc/arc/arcbios.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.h,v 1.3 1997/04/19 17:19:38 pefo Exp $ */
+/* $OpenBSD: arcbios.h,v 1.4 1997/05/01 15:13:30 pefo Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
*
@@ -303,7 +303,8 @@ typedef struct arc_calls
u_int32_t); /* FileId */
} arc_calls_t;
-#define ARC_PARAM_BLK_MAGIC 0x41524353
+#define ARC_PARAM_BLK_MAGIC 0x53435241
+#define ARC_PARAM_BLK_MAGIC_BUG 0x41524353 /* This is wrong... but req */
typedef struct arc_param_blk
{
@@ -329,10 +330,10 @@ typedef struct arc_param_blk
#define ArcBios (ArcBiosBase->firmware_vect)
-int bios_getchar __P((void));
+int bios_getchar __P((void));
void bios_putchar __P((char));
void bios_putstring __P((char *));
void bios_ident __P((void));
void bios_display_info __P((int *, int *, int *, int *));
-
+int bios_load_miniroot __P((char *, caddr_t));