From 1046c915b67a8cfc926520cf1bc17e31347568a0 Mon Sep 17 00:00:00 2001 From: gwr Date: Mon, 28 Apr 1997 23:30:19 +0000 Subject: [PATCH] Drivers that use obio_mapin should enforce OBIO attachment (just to be paranoid). --- sys/arch/sun3/sun3x/clock.c | 11 +++++++++-- sys/arch/sun3x/dev/eeprom.c | 12 ++++++++---- sys/arch/sun3x/sun3x/clock.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/sys/arch/sun3/sun3x/clock.c b/sys/arch/sun3/sun3x/clock.c index 3f4c10ac5eb0..1b0397b8fa70 100644 --- a/sys/arch/sun3/sun3x/clock.c +++ b/sys/arch/sun3/sun3x/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.10 1997/04/25 18:31:37 gwr Exp $ */ +/* $NetBSD: clock.c,v 1.11 1997/04/28 23:30:19 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -74,7 +74,6 @@ #include #include #include -#include #include @@ -146,6 +145,10 @@ oclock_match(parent, cf, args) if (cf->cf_unit != 0) return (0); + /* We use obio_mapin(), so require OBIO. */ + if (ca->ca_bustype != BUS_OBIO) + return (0); + /* * The 3/80 can not probe the Intersil absent, * but it never has one, so "just say no." @@ -228,6 +231,10 @@ clock_match(parent, cf, args) if (cf->cf_unit != 0) return (0); + /* We use obio_mapin(), so require OBIO. */ + if (ca->ca_bustype != BUS_OBIO) + return (0); + /* If intersil was found, use that. */ if (intersil_va) return (0); diff --git a/sys/arch/sun3x/dev/eeprom.c b/sys/arch/sun3x/dev/eeprom.c index f83ff5488a80..12d9f95f86c4 100644 --- a/sys/arch/sun3x/dev/eeprom.c +++ b/sys/arch/sun3x/dev/eeprom.c @@ -1,4 +1,4 @@ -/* $NetBSD: eeprom.c,v 1.3 1997/04/25 18:57:49 gwr Exp $ */ +/* $NetBSD: eeprom.c,v 1.4 1997/04/28 23:30:22 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -92,8 +92,11 @@ eeprom_match(parent, cf, args) if (cf->cf_unit != 0) return (0); - /* Validate the given address. */ - if (ca->ca_paddr != OBIO_EEPROM) + /* We use obio_mapin(), so require OBIO. */ + if (ca->ca_bustype != BUS_OBIO) + return (0); + + if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1) return (0); return (1); @@ -105,11 +108,12 @@ eeprom_attach(parent, self, args) struct device *self; void *args; { + struct confargs *ca = args; char *src, *dst, *lim; printf("\n"); - eeprom_va = obio_mapin(OBIO_EEPROM, OBIO_EEPROM_SIZE); + eeprom_va = obio_mapin(ca->ca_paddr, OBIO_EEPROM_SIZE); if (!eeprom_va) panic("eeprom_attach"); diff --git a/sys/arch/sun3x/sun3x/clock.c b/sys/arch/sun3x/sun3x/clock.c index 3f4c10ac5eb0..1b0397b8fa70 100644 --- a/sys/arch/sun3x/sun3x/clock.c +++ b/sys/arch/sun3x/sun3x/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.10 1997/04/25 18:31:37 gwr Exp $ */ +/* $NetBSD: clock.c,v 1.11 1997/04/28 23:30:19 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -74,7 +74,6 @@ #include #include #include -#include #include @@ -146,6 +145,10 @@ oclock_match(parent, cf, args) if (cf->cf_unit != 0) return (0); + /* We use obio_mapin(), so require OBIO. */ + if (ca->ca_bustype != BUS_OBIO) + return (0); + /* * The 3/80 can not probe the Intersil absent, * but it never has one, so "just say no." @@ -228,6 +231,10 @@ clock_match(parent, cf, args) if (cf->cf_unit != 0) return (0); + /* We use obio_mapin(), so require OBIO. */ + if (ca->ca_bustype != BUS_OBIO) + return (0); + /* If intersil was found, use that. */ if (intersil_va) return (0);