summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-04-15 21:36:01 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-04-15 21:36:01 +0000
commita9b706f40fbe6e72caf77ec452e9921a24846374 (patch)
tree5744230fff8f6368e7c384db2d4a8383ded78cdf /sys
parentb813b353cd9163dae837c450bf381847d272e297 (diff)
Since *ramread and *ramwrite are the same code, really, factorize them a la
memread/memwrite.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme88k/dev/nvram.c19
-rw-r--r--sys/arch/mvme88k/dev/sram.c19
-rw-r--r--sys/arch/mvme88k/include/conf.h7
3 files changed, 12 insertions, 33 deletions
diff --git a/sys/arch/mvme88k/dev/nvram.c b/sys/arch/mvme88k/dev/nvram.c
index 5638b8b2946..58e4a299c97 100644
--- a/sys/arch/mvme88k/dev/nvram.c
+++ b/sys/arch/mvme88k/dev/nvram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvram.c,v 1.23 2004/01/14 20:50:48 miod Exp $ */
+/* $OpenBSD: nvram.c,v 1.24 2004/04/15 21:35:59 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -444,20 +444,7 @@ nvramioctl(dev, cmd, data, flag, p)
/*ARGSUSED*/
int
-nvramread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
-
- return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
-}
-
-/*ARGSUSED*/
-int
-nvramwrite(dev, uio, flags)
+nvramrw(dev, uio, flags)
dev_t dev;
struct uio *uio;
int flags;
@@ -486,7 +473,7 @@ nvrammmap(dev, off, prot)
return (-1);
/* allow access only in RAM */
- if (off > sc->sc_len)
+ if (off < 0 || off > sc->sc_len)
return (-1);
return (atop(sc->sc_paddr + off));
}
diff --git a/sys/arch/mvme88k/dev/sram.c b/sys/arch/mvme88k/dev/sram.c
index 544ec82bad9..39f91c8216a 100644
--- a/sys/arch/mvme88k/dev/sram.c
+++ b/sys/arch/mvme88k/dev/sram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sram.c,v 1.15 2004/01/14 20:50:48 miod Exp $ */
+/* $OpenBSD: sram.c,v 1.16 2004/04/15 21:35:59 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -157,20 +157,7 @@ sramioctl(dev, cmd, data, flag, p)
/*ARGSUSED*/
int
-sramread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
-
- return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
-}
-
-/*ARGSUSED*/
-int
-sramwrite(dev, uio, flags)
+sramrw(dev, uio, flags)
dev_t dev;
struct uio *uio;
int flags;
@@ -194,7 +181,7 @@ srammmap(dev, off, prot)
return (-1);
/* allow access only in RAM */
- if (off > sc->sc_len)
+ if (off < 0 || off > sc->sc_len)
return (-1);
return (atop(sc->sc_paddr + off));
}
diff --git a/sys/arch/mvme88k/include/conf.h b/sys/arch/mvme88k/include/conf.h
index c88978e541c..559b0eedd81 100644
--- a/sys/arch/mvme88k/include/conf.h
+++ b/sys/arch/mvme88k/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.2 2003/04/16 17:34:49 miod Exp $ */
+/* $OpenBSD: conf.h,v 1.3 2004/04/15 21:36:00 miod Exp $ */
/*
* Copyright (c) 2002, Miodrag Vallat.
* All rights reserved.
@@ -36,7 +36,12 @@ cdev_decl(mm);
cdev_decl(vmel);
cdev_decl(vmes);
+#define nvramread nvramrw
+#define nvramwrite nvramrw
cdev_decl(nvram);
+
+#define sramread sramrw
+#define sramwrite sramrw
cdev_decl(sram);
cdev_decl(bugtty);