summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1996-09-15 09:46:09 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1996-09-15 09:46:09 +0000
commit8ee68b094f476fa26e6694ad8bbf872386ed6bf5 (patch)
treee735f2b5b493f2d2864537a7b5fd1dca084bd058
parent5839b84db8fa4a49976868786c93b29df9c4d568 (diff)
Ok, ok! We now autosense system type. Same compiled kernel works on both
Deskstation TYNE and Acer PICA.
-rw-r--r--sys/arch/arc/arc/arcbios.c76
-rw-r--r--sys/arch/arc/conf/GENERIC26
-rw-r--r--sys/arch/arc/conf/files.arc25
3 files changed, 96 insertions, 31 deletions
diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c
index 075d174dff2..39806af5b16 100644
--- a/sys/arch/arc/arc/arcbios.c
+++ b/sys/arch/arc/arc/arcbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.c,v 1.2 1996/09/14 15:58:11 pefo Exp $ */
+/* $OpenBSD: arcbios.c,v 1.3 1996/09/15 09:46:06 pefo Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
*
@@ -28,6 +28,7 @@
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/memconf.h>
@@ -43,18 +44,35 @@ extern int physmem; /* Total physical memory size */
char buf[100]; /*XXX*/
arc_dsp_stat_t displayinfo; /* Save area for display status info. */
+static struct systypes {
+ char *sys_vend; /* Vendor ID if name is ambigous */
+ char *sys_name; /* May be left NULL if name is sufficient */
+ int sys_type;
+} sys_types[] = {
+ { NULL, "PICA-61", ACER_PICA_61 },
+ { NULL, "DESKTECH-TYNE", DESKSTATION_TYNE },
+ { NULL, "DESKTECH-ARCStation I", DESKSTATION_RPC44 },
+ { NULL, "Microsoft-Jazz", MAGNUM },
+};
+
+#define KNOWNSYSTEMS (sizeof(sys_types) / sizeof(struct systypes))
+
/*
* ARC Bios trampoline code.
*/
#define ARC_Call(Name,Offset) \
__asm__("\n" \
+" .text\n" \
+" .ent " #Name "\n" \
+" .align 3\n" \
" .set noreorder\n" \
" .globl " #Name "\n" \
#Name":\n" \
" lw $2, 0x80001020\n"\
" lw $2," #Offset "($2)\n"\
" jr $2\n" \
-" nop\n" );
+" nop\n" \
+" .end " #Name "\n" );
ARC_Call(Bios_Load, 0x00);
ARC_Call(Bios_Invoke, 0x04);
@@ -138,6 +156,14 @@ char *s;
}
}
+/*
+ * Get memory descriptor for the memory configuration and
+ * create a layout database used by pmap init to set up
+ * the memory system. Note that kernel option "MACHINE_NONCONTIG"
+ * must be set for systems with non contigous physical memory.
+ *
+ * Concatenate obvious adjecent segments.
+ */
bios_configure_memory()
{
arc_mem_t *descr = 0;
@@ -201,25 +227,65 @@ bios_configure_memory()
}
for( i = 0; i < MAXMEMSEGS; i++) {
+ if(mem_layout[i].mem_size) {
sprintf(buf, "MEM %d, 0x%x, 0x%x\n",i,
mem_layout[i].mem_start,
mem_layout[i].mem_size);
bios_putstring(buf);
+ }
+ }
+}
+
+/*
+ * Find out system type.
+ */
+int
+get_cpu_type()
+{
+ arc_config_t *cf;
+ arc_sid_t *sid;
+ int i;
+
+ sid = (arc_sid_t *)Bios_GetSystemId();
+ cf = (arc_config_t *)Bios_GetChild(NULL);
+ if(cf) {
+ for(i = 0; i < KNOWNSYSTEMS; i++) {
+ if(strcmp(sys_types[i].sys_name, cf->id) != 0)
+ continue;
+ if(sys_types[i].sys_vend &&
+ strncmp(sys_types[i].sys_vend, sid->vendor, 8) != 0)
+ continue;
+ return(sys_types[i].sys_type); /* Found it. */
+ }
}
+
+ bios_putstring("UNIDENTIFIED ARC SYSTEM `");
+ if(cf)
+ bios_putstring(cf->id);
+ else
+ bios_putstring("????????");
+ bios_putstring("' VENDOR `");
+ sid->vendor[8] = 0;
+ bios_putstring("sid->vendor");
+ bios_putstring("'. Please contact OpenBSD (www.openbsd.org).\n");
+ while(1);
}
+
/*
* Incomplete version of bios_ident
*/
void
bios_ident()
{
- bios_putstring("calling bios_ident\n");
+ cputype = get_cpu_type();
bios_configure_memory();
displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1);
- cputype = ACER_PICA_61;
}
-
+/*
+ * Return geometry of the display. Used by pccons.c to set up the
+ * display configuration.
+ */
void
bios_display_info(xpos, ypos, xsize, ysize)
int *xpos;
diff --git a/sys/arch/arc/conf/GENERIC b/sys/arch/arc/conf/GENERIC
index 1ad298a0ee7..340d023ad6d 100644
--- a/sys/arch/arc/conf/GENERIC
+++ b/sys/arch/arc/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.4 1996/09/14 15:58:19 pefo Exp $
+# $OpenBSD: GENERIC,v 1.5 1996/09/15 09:46:07 pefo Exp $
#
# Generic configuration file for MIPS R4x00 ARC Systems
#
@@ -56,7 +56,7 @@ options INET # Internet protocols
# Special options
options MACHINE_NONCONTIG # Support noncontigous memory.
-# Specify storage configuration
+# Specify storage configuration (its a joke..)
config bsd swap generic
#
@@ -66,6 +66,7 @@ mainbus0 at root
cpu* at mainbus0
pica* at mainbus0
+isabr* at mainbus0
clock0 at pica?
pc0 at pica?
@@ -81,21 +82,13 @@ fd* at fdc? drive ?
asc0 at pica?
scsibus* at asc?
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-
#
# ISA Bus.
#
-isabr* at mainbus0
isa* at isabr?
-clock0 at isa?
+clock0 at isa? port 0x70 irq 0
pc0 at isa? port 0x60 irq 1 # generic PC console device
ace0 at isa? port 0x3f8 irq 4
@@ -110,7 +103,18 @@ ep0 at isa? port ? irq ? # 3C509 ethernet cards
btl0 at isa? port 0x330 irq ? drq ?
scsibus* at btl?
+#
+# SCSI Bus devices
+#
+sd* at scsibus? target ? lun ?
+st* at scsibus? target ? lun ?
+cd* at scsibus? target ? lun ?
+ch* at scsibus? target ? lun ?
+ss* at scsibus? target ? lun ?
+uk* at scsibus? target ? lun ?
+
+#
pseudo-device sl 2 # serial-line IP ports
pseudo-device ppp 2 # serial-line PPP ports
pseudo-device tun 2 # network tunneling over tty
diff --git a/sys/arch/arc/conf/files.arc b/sys/arch/arc/conf/files.arc
index 66d183f3b32..e586b597f91 100644
--- a/sys/arch/arc/conf/files.arc
+++ b/sys/arch/arc/conf/files.arc
@@ -1,4 +1,4 @@
-# $OpenBSD: files.arc,v 1.4 1996/09/14 15:58:20 pefo Exp $
+# $OpenBSD: files.arc,v 1.5 1996/09/15 09:46:08 pefo Exp $
#
# maxpartitions must be first item in files.${ARCH}
#
@@ -8,7 +8,6 @@ maxusers 2 8 64
# Required files
-
file arch/arc/arc/autoconf.c
file arch/arc/arc/conf.c
file arch/arc/arc/cpu_exec.c
@@ -28,14 +27,11 @@ file arch/arc/arc/arcbios.c
#
# Machine-independent ATAPI drivers
#
-
include "../../../dev/atapi/files.atapi"
-
#
# System BUS types
#
-
define mainbus {}
device mainbus
attach mainbus at root
@@ -50,9 +46,17 @@ file arch/arc/arc/cpu.c cpu
# PICA bus autoconfiguration devices
#
device pica {}
-attach pica at mainbus # { slot = -1, offset = -1 }
+attach pica at mainbus #
file arch/arc/pica/picabus.c pica
+#
+# ISA Bus bridge
+#
+device isabr {} : isabus
+attach isabr at mainbus
+file arch/arc/isa/isabus.c isabr
+file arch/arc/isa/isadma.c isadma needs-flag
+
# Ethernet chip
device sn
attach sn at pica: ifnet, ether
@@ -76,15 +80,6 @@ attach fd at fdc
file arch/arc/dev/fd.c fdc needs-flag
major {fd = 7}
-
-#
-# ISA
-#
-device isabr {} : isabus
-attach isabr at mainbus
-file arch/arc/isa/isabus.c isabr
-file arch/arc/isa/isadma.c isadma needs-flag
-
#
# Stock ISA bus support
#