summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenji Aoyama <aoyama@cvs.openbsd.org>2004-08-30 13:10:33 +0000
committerKenji Aoyama <aoyama@cvs.openbsd.org>2004-08-30 13:10:33 +0000
commitccef508628226cae051e8472a7797353b185ddd8 (patch)
treec0d31deab6923ed4409265691edb81bb5a0567df /sys
parent379d70369797c00657d1cdd2c01eab8125913a36 (diff)
Add the original LUNA-88K support.
- retrieve auto-boot information from NVRAM - retrieve ethernet address information from FUSE ROM They are stored different way from LUNA-88K2. Tested by Jeff McMahill, ok by miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/luna88k/dev/if_le.c78
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c29
2 files changed, 72 insertions, 35 deletions
diff --git a/sys/arch/luna88k/dev/if_le.c b/sys/arch/luna88k/dev/if_le.c
index 54db089fc20..6a4e5e9b1ab 100644
--- a/sys/arch/luna88k/dev/if_le.c
+++ b/sys/arch/luna88k/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.3 2004/07/27 12:36:32 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.4 2004/08/30 13:10:32 aoyama Exp $ */
/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */
/*-
@@ -56,6 +56,7 @@
#include <net/if_media.h>
#include <machine/autoconf.h>
+#include <machine/board.h>
#include <machine/cpu.h>
#include <dev/ic/am7990reg.h>
@@ -167,13 +168,19 @@ le_attach(parent, self, aux)
}
/*
- * Taken from NetBSD/luna68k
+ * Partially taken from NetBSD/luna68k
*
- * LUNA-88K2 (and LUNA-88K?) has 16Kbit NVSRAM on its ethercard, whose
- * contents are accessible 4bit-wise by ctl register operation. The
- * register is mapped at 0xF1000008.
+ * LUNA-88K has FUSE ROM, which contains MAC address. The FUSE ROM
+ * contents are stored in fuse_rom_data[] during cpu_startup().
+ *
+ * LUNA-88K2 has 16Kbit NVSRAM on its ethercard, whose contents are
+ * accessible 4bit-wise by ctl register operation. The register is
+ * mapped at 0xF1000008.
*/
+extern int machtype;
+extern char fuse_rom_data[];
+
hide void
myetheraddr(ether)
u_int8_t *ether;
@@ -181,23 +188,48 @@ myetheraddr(ether)
unsigned i, loc;
volatile struct { u_int32_t ctl; } *ds1220;
- ds1220 = (void *)0xF1000008;
- loc = 12;
- for (i = 0; i < 6; i++) {
- unsigned u, l, hex;
-
- ds1220->ctl = (loc) << 16;
- u = 0xf0 & (ds1220->ctl >> 12);
- ds1220->ctl = (loc + 1) << 16;
- l = 0x0f & (ds1220->ctl >> 16);
- hex = (u < '9') ? l : l + 9;
-
- ds1220->ctl = (loc + 2) << 16;
- u = 0xf0 & (ds1220->ctl >> 12);
- ds1220->ctl = (loc + 3) << 16;
- l = 0x0f & (ds1220->ctl >> 16);
-
- ether[i] = ((u < '9') ? l : l + 9) | (hex << 4);
- loc += 4;
+ switch (machtype) {
+ case LUNA_88K:
+ /*
+ * fuse_rom_data[] begins with "ENADDR=00000Axxxxxx"
+ */
+ loc = 7;
+ for (i = 0; i < 6; i++) {
+ int u, l;
+
+ u = fuse_rom_data[loc];
+ u = (u < 'A') ? u & 0xf : u - 'A' + 10;
+ l = fuse_rom_data[loc + 1];
+ l = (l < 'A') ? l & 0xf : l - 'A' + 10;
+
+ ether[i] = l | (u << 4);
+ loc += 2;
+ }
+ break;
+ case LUNA_88K2:
+ ds1220 = (void *)0xF1000008;
+ loc = 12;
+ for (i = 0; i < 6; i++) {
+ unsigned u, l, hex;
+
+ ds1220->ctl = (loc) << 16;
+ u = 0xf0 & (ds1220->ctl >> 12);
+ ds1220->ctl = (loc + 1) << 16;
+ l = 0x0f & (ds1220->ctl >> 16);
+ hex = (u < '9') ? l : l + 9;
+
+ ds1220->ctl = (loc + 2) << 16;
+ u = 0xf0 & (ds1220->ctl >> 12);
+ ds1220->ctl = (loc + 3) << 16;
+ l = 0x0f & (ds1220->ctl >> 16);
+
+ ether[i] = ((u < '9') ? l : l + 9) | (hex << 4);
+ loc += 4;
+ }
+ break;
+ default:
+ ether[0] = 0x00; ether[1] = 0x00; ether[2] = 0x0a;
+ ether[3] = 0xDE; ether[4] = 0xAD; ether[5] = 0x00;
+ break;
}
}
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index ccb3568dff4..f620834b784 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.10 2004/08/24 12:59:51 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.11 2004/08/30 13:10:32 aoyama Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -153,7 +153,7 @@ struct fuse_rom_byte {
u_int32_t l;
};
#define FUSE_ROM_BYTES (FUSE_ROM_SPACE / sizeof(struct fuse_rom_byte))
-static char fuse_rom_data[FUSE_ROM_BYTES];
+char fuse_rom_data[FUSE_ROM_BYTES];
#define NNVSYM 8
#define NVSYMLEN 16
@@ -1797,21 +1797,26 @@ get_fuse_rom_data(void)
void
get_nvram_data(void)
{
- int i;
+ int i, j;
u_int8_t *page;
- char *data;
+ char buf[NVSYMLEN], *data;
if (machtype == LUNA_88K) {
-#if 0
- /* this is not tested... */
- int i;
- struct nvram_byte *p = (struct nvram_byte *)NVRAM_ADDR;
+ data = (char *)(NVRAM_ADDR + 0x80);
- for (i = 0; i < NVRAM_BYTES; i++) {
- nvram_data[i] = p->data;
- p++;
+ for (i = 0; i < NNVSYM; i++) {
+ for (j = 0; j < NVSYMLEN; j++) {
+ buf[j] = *data;
+ data += 4;
+ }
+ strlcpy(nvram[i].symbol, buf, sizeof(nvram[i].symbol));
+
+ for (j = 0; j < NVVALLEN; j++) {
+ buf[j] = *data;
+ data += 4;
+ }
+ strlcpy(nvram[i].value, buf, sizeof(nvram[i].value));
}
-#endif
} else if (machtype == LUNA_88K2) {
page = (u_int8_t *)(NVRAM_ADDR_88K2 + 0x20);