summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-04-26 17:02:41 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-04-26 17:02:41 +0000
commit9d95aa779435c2d53dd82d80f4d001cc35845543 (patch)
treea7eb70f4ec5cacf0e0f5076c3347f18b3dad29e2 /sys
parentb70ce41c22de7e2281a07553ebb61643145ed28a (diff)
Do not invoke arcbios routines from the moment our page tables are set up,
to the moment we reboot, for we do not know what it can do behind our back; this means the built-in ethernet address has to be read from the arcbios environment earlier.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mips64/include/arcbios.h3
-rw-r--r--sys/arch/mips64/mips64/arcbios.c7
-rw-r--r--sys/arch/sgi/dev/if_mec.c11
-rw-r--r--sys/arch/sgi/sgi/machdep.c18
4 files changed, 28 insertions, 11 deletions
diff --git a/sys/arch/mips64/include/arcbios.h b/sys/arch/mips64/include/arcbios.h
index 42bc74fc849..70876bd462d 100644
--- a/sys/arch/mips64/include/arcbios.h
+++ b/sys/arch/mips64/include/arcbios.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.h,v 1.6 2004/10/20 12:49:15 pefo Exp $ */
+/* $OpenBSD: arcbios.h,v 1.7 2007/04/26 17:02:38 miod Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
*
@@ -370,6 +370,7 @@ typedef struct arc_param_blk_64
#define ArcBios (ArcBiosBase->firmware_vect)
extern int bios_is_32bit;
+extern char bios_enaddr[20];
int bios_getchar(void);
void bios_putchar(char);
diff --git a/sys/arch/mips64/mips64/arcbios.c b/sys/arch/mips64/mips64/arcbios.c
index 0afb7f3d9f9..07fe748fa26 100644
--- a/sys/arch/mips64/mips64/arcbios.c
+++ b/sys/arch/mips64/mips64/arcbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.c,v 1.8 2006/03/09 23:06:20 miod Exp $ */
+/* $OpenBSD: arcbios.c,v 1.9 2007/04/26 17:02:40 miod Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
* Copyright (c) 1996-2004 Opsycon AB. All rights reserved.
@@ -41,6 +41,11 @@
#endif
int bios_is_32bit = 1;
+/*
+ * If we can not get the onboard ethernet address to override this bogus
+ * value, ether_ifattach() will pick a valid address.
+ */
+char bios_enaddr[20] = "ff:ff:ff:ff:ff:ff";
extern int physmem; /* Total physical memory size */
extern int rsvdmem; /* Total reserved memory size */
diff --git a/sys/arch/sgi/dev/if_mec.c b/sys/arch/sgi/dev/if_mec.c
index 600a413ade3..a1b949f07e1 100644
--- a/sys/arch/sgi/dev/if_mec.c
+++ b/sys/arch/sgi/dev/if_mec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mec.c,v 1.10 2006/03/25 22:41:41 djm Exp $ */
+/* $OpenBSD: if_mec.c,v 1.11 2007/04/26 17:02:40 miod Exp $ */
/* $NetBSD: if_mec_mace.c,v 1.5 2004/08/01 06:36:36 tsutsui Exp $ */
/*
@@ -363,7 +363,6 @@ mec_attach(struct device *parent, struct device *self, void *aux)
struct confargs *ca = aux;
struct ifnet *ifp = &sc->sc_ac.ac_if;
uint32_t command;
- char *macaddr;
struct mii_softc *child;
bus_dma_segment_t seg;
int i, err, rseg;
@@ -433,12 +432,8 @@ mec_attach(struct device *parent, struct device *self, void *aux)
timeout_set(&sc->sc_tick_ch, mec_tick, sc);
- /* get ethernet address from ARCBIOS */
- if ((macaddr = Bios_GetEnvironmentVariable("eaddr")) == NULL) {
- printf(": unable to get MAC address!\n");
- goto fail_4;
- }
- enaddr_aton(macaddr, sc->sc_ac.ac_enaddr);
+ /* use ethernet address from ARCBIOS */
+ enaddr_aton(bios_enaddr, sc->sc_ac.ac_enaddr);
/* reset device */
mec_reset(sc);
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index 8a1ec37b5ec..a4a91d02845 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.35 2007/04/10 16:54:46 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.36 2007/04/26 17:02:40 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -297,6 +297,22 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */
bios_printf("Boot device unrecognized: '%s'\n", cp);
/*
+ * Read platform-specific environment variables.
+ */
+ switch (sys_config.system_type) {
+#if defined(TGT_O2)
+ case SGI_O2:
+ /* get ethernet address from ARCBIOS */
+ cp = Bios_GetEnvironmentVariable("eaddr");
+ if (cp != NULL && strlen(cp) > 0)
+ strlcpy(bios_enaddr, cp, sizeof bios_enaddr);
+ break;
+#endif
+ default:
+ break;
+ }
+
+ /*
* Set pagesize to enable use of page macros and functions.
* Commit available memory to UVM system
*/