Drivers that use obio_mapin should enforce OBIO attachment

(just to be paranoid).
This commit is contained in:
gwr 1997-04-28 23:30:19 +00:00
parent 304d49b554
commit 1046c915b6
3 changed files with 26 additions and 8 deletions

View File

@ -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 <machine/leds.h>
#include <machine/obio.h>
#include <machine/machdep.h>
#include <machine/mon.h>
#include <sun3/sun3/interreg.h>
@ -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);

View File

@ -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");

View File

@ -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 <machine/leds.h>
#include <machine/obio.h>
#include <machine/machdep.h>
#include <machine/mon.h>
#include <sun3/sun3/interreg.h>
@ -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);