Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add default implementations for bus_space_is_equal(9),
details: https://anonhg.NetBSD.org/src/rev/1b035ef1607c
branches: trunk
changeset: 754086:1b035ef1607c
user: dyoung <dyoung%NetBSD.org@localhost>
date: Mon Apr 19 18:24:26 2010 +0000
description:
Add default implementations for bus_space_is_equal(9),
bus_space_tag_create(9), and bus_space_tag_destroy(9). Use
bus_space_is_equal(9) throughout the kernel to compare
bus_space_tag_t's. Tested on i386 and on sparc64.
diffstat:
sys/arch/i386/isa/isapnp_machdep.c | 8 ++--
sys/dev/ic/com.c | 22 ++++-------
sys/dev/ic/i82365.c | 12 ++----
sys/dev/ic/pckbc.c | 8 +--
sys/dev/ic/tcic2.c | 12 ++----
sys/dev/ic/vga.c | 8 +--
sys/dev/isa/isadma.c | 9 ++--
sys/dev/isa/pcdisplay.c | 11 ++---
sys/dev/pci/cy82c693.c | 9 +---
sys/dev/pci/pccbb.c | 24 ++++++------
sys/kern/kern_stub.c | 16 +++++++-
sys/sys/bus.h | 71 +++++++++++++++++++++++++++++++++++++-
12 files changed, 133 insertions(+), 77 deletions(-)
diffs (truncated from 581 to 300 lines):
diff -r af3c781c457c -r 1b035ef1607c sys/arch/i386/isa/isapnp_machdep.c
--- a/sys/arch/i386/isa/isapnp_machdep.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/arch/i386/isa/isapnp_machdep.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isapnp_machdep.c,v 1.13 2008/04/28 20:23:24 martin Exp $ */
+/* $NetBSD: isapnp_machdep.c,v 1.14 2010/04/19 18:24:26 dyoung Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isapnp_machdep.c,v 1.13 2008/04/28 20:23:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isapnp_machdep.c,v 1.14 2010/04/19 18:24:26 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,7 +67,7 @@
{
#ifdef DIAGNOSTIC
- if (sc->sc_iot != X86_BUS_SPACE_IO)
+ if (!bus_space_is_equal(sc->sc_iot, x86_bus_space_io))
panic("isapnp_map: bogus bus space tag");
#endif
@@ -100,7 +100,7 @@
#endif
#ifdef DIAGNOSTIC
- if (sc->sc_iot != X86_BUS_SPACE_IO)
+ if (!bus_space_is_equal(sc->sc_iot, x86_bus_space_io))
panic("isapnp_map_readport: bogus bus space tag");
#endif
diff -r af3c781c457c -r 1b035ef1607c sys/dev/ic/com.c
--- a/sys/dev/ic/com.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/ic/com.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.296 2010/03/22 23:00:08 dyoung Exp $ */
+/* $NetBSD: com.c,v 1.297 2010/04/19 18:24:26 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.296 2010/03/22 23:00:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.297 2010/04/19 18:24:26 dyoung Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -263,13 +263,6 @@
#define COM_BARRIER(r, f) \
bus_space_barrier((r)->cr_iot, (r)->cr_ioh, 0, (r)->cr_nports, (f))
-/* XXX Comparing bus_space_tag_t's is not allowed! */
-static bool
-tags_are_equal(const bus_space_tag_t lt, const bus_space_tag_t rt)
-{
- return true;
-}
-
/*ARGSUSED*/
int
comspeed(long speed, long frequency, int type)
@@ -399,7 +392,7 @@
CSR_WRITE_1(regsp, COM_REG_IER, sc->sc_ier);
- if (tags_are_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
+ if (bus_space_is_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
regsp->cr_iobase == comcons_info.regs.cr_iobase) {
comconsattached = 1;
@@ -548,7 +541,7 @@
* exclusive use. If it's the console _and_ the
* kgdb device, it doesn't.
*/
- if (tags_are_equal(regsp->cr_iot, comkgdbregs.cr_iot) &&
+ if (bus_space_is_equal(regsp->cr_iot, comkgdbregs.cr_iot) &&
regsp->cr_iobase == comkgdbregs.cr_iobase) {
if (!ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
com_kgdb_attached = 1;
@@ -2309,7 +2302,7 @@
{
int res;
- if (tags_are_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
+ if (bus_space_is_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
regsp->cr_iobase == comcons_info.regs.cr_iobase) {
#if !defined(DDB)
return (EBUSY); /* cannot share with console */
@@ -2378,12 +2371,13 @@
bus_space_handle_t help;
if (!comconsattached &&
- tags_are_equal(iot, comcons_info.regs.cr_iot) &&
+ bus_space_is_equal(iot, comcons_info.regs.cr_iot) &&
iobase == comcons_info.regs.cr_iobase)
help = comcons_info.regs.cr_ioh;
#ifdef KGDB
else if (!com_kgdb_attached &&
- tags_are_equal(iot, comkgdbregs.cr_iot) && iobase == comkgdbregs.cr_iobase)
+ bus_space_is_equal(iot, comkgdbregs.cr_iot) &&
+ iobase == comkgdbregs.cr_iobase)
help = comkgdbregs.cr_ioh;
#endif
else
diff -r af3c781c457c -r 1b035ef1607c sys/dev/ic/i82365.c
--- a/sys/dev/ic/i82365.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/ic/i82365.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82365.c,v 1.112 2010/03/22 22:22:57 dyoung Exp $ */
+/* $NetBSD: i82365.c,v 1.113 2010/04/19 18:24:26 dyoung Exp $ */
/*
* Copyright (c) 2004 Charles M. Hannum. All rights reserved.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.112 2010/03/22 22:22:57 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.113 2010/04/19 18:24:26 dyoung Exp $");
#define PCICDEBUG
@@ -992,13 +992,11 @@
/* XXX this is pretty gross */
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
{
struct pcic_softc *sc = device_private(h->ph_parent);
- if (sc->memt != pcmhp->memt)
+ if (!bus_space_is_equal(sc->memt, pcmhp->memt))
panic("pcic_chip_mem_map memt is bogus");
}
-#endif
busaddr = pcmhp->addr;
@@ -1207,10 +1205,8 @@
/* XXX this is pretty gross */
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
- if (sc->iot != pcihp->iot)
+ if (!bus_space_is_equal(sc->iot, pcihp->iot))
panic("pcic_chip_io_map iot is bogus");
-#endif
DPRINTF(("pcic_chip_io_map window %d %s port %lx+%lx\n",
win, width_names[width], (u_long) ioaddr, (u_long) size));
diff -r af3c781c457c -r 1b035ef1607c sys/dev/ic/pckbc.c
--- a/sys/dev/ic/pckbc.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/ic/pckbc.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc.c,v 1.49 2010/03/22 23:08:34 dyoung Exp $ */
+/* $NetBSD: pckbc.c,v 1.50 2010/04/19 18:24:26 dyoung Exp $ */
/*
* Copyright (c) 2004 Ben Harris.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.49 2010/03/22 23:08:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.50 2010/04/19 18:24:26 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -238,9 +238,7 @@
pckbc_is_console(bus_space_tag_t iot, bus_addr_t addr)
{
if (pckbc_console && !pckbc_console_attached &&
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
- pckbc_consdata.t_iot == iot &&
-#endif
+ bus_space_is_equal(pckbc_consdata.t_iot, iot) &&
pckbc_consdata.t_addr == addr)
return (1);
return (0);
diff -r af3c781c457c -r 1b035ef1607c sys/dev/ic/tcic2.c
--- a/sys/dev/ic/tcic2.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/ic/tcic2.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcic2.c,v 1.34 2010/03/22 23:08:34 dyoung Exp $ */
+/* $NetBSD: tcic2.c,v 1.35 2010/04/19 18:24:26 dyoung Exp $ */
/*
* Copyright (c) 1998, 1999 Christoph Badura. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.34 2010/03/22 23:08:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.35 2010/04/19 18:24:26 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -883,10 +883,8 @@
/* XXX this is pretty gross */
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
- if (h->sc->memt != pcmhp->memt)
+ if (!bus_space_is_equal(h->sc->memt, pcmhp->memt))
panic("tcic_chip_mem_map memt is bogus");
-#endif
busaddr = pcmhp->addr;
@@ -1104,10 +1102,8 @@
/* XXX this is pretty gross */
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
- if (h->sc->iot != pcihp->iot)
+ if (!bus_space_is_equal(h->sc->iot, pcihp->iot))
panic("tcic_chip_io_map iot is bogus");
-#endif
DPRINTF(("tcic_chip_io_map window %d %s port %lx+%lx\n",
win, width_names[width], (u_long) ioaddr, (u_long) size));
diff -r af3c781c457c -r 1b035ef1607c sys/dev/ic/vga.c
--- a/sys/dev/ic/vga.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/ic/vga.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.103 2010/03/22 23:08:34 dyoung Exp $ */
+/* $NetBSD: vga.c,v 1.104 2010/04/19 18:24:26 dyoung Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.103 2010/03/22 23:08:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.104 2010/04/19 18:24:26 dyoung Exp $");
/* for WSCONS_SUPPORT_PCVTFONTS */
#include "opt_wsdisplay_compat.h"
@@ -736,9 +736,7 @@
{
if (vgaconsole &&
!vga_console_attached &&
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
- iot == vga_console_vc.hdl.vh_iot &&
-#endif
+ bus_space_is_equal(iot, vga_console_vc.hdl.vh_iot) &&
(vga_console_type == -1 || (type == vga_console_type)))
return (1);
return (0);
diff -r af3c781c457c -r 1b035ef1607c sys/dev/isa/isadma.c
--- a/sys/dev/isa/isadma.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/isa/isadma.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isadma.c,v 1.63 2010/03/22 22:30:58 dyoung Exp $ */
+/* $NetBSD: isadma.c,v 1.64 2010/04/19 18:24:26 dyoung Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.63 2010/03/22 22:30:58 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.64 2010/04/19 18:24:26 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -155,10 +155,9 @@
* configuration mechanisms, the space and dma tags
* must be the same!
*/
-#if 0 /* XXX Comparing bus_space_tag_t is a no-no! */
- if (ids->ids_bst != bst || ids->ids_dmat != dmat)
+ if (!bus_space_is_equal(ids->ids_bst, bst) ||
+ ids->ids_dmat != dmat)
panic("_isa_dmainit: inconsistent ISA tags");
-#endif
} else {
ids->ids_bst = bst;
ids->ids_dmat = dmat;
diff -r af3c781c457c -r 1b035ef1607c sys/dev/isa/pcdisplay.c
--- a/sys/dev/isa/pcdisplay.c Mon Apr 19 12:59:36 2010 +0000
+++ b/sys/dev/isa/pcdisplay.c Mon Apr 19 18:24:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplay.c,v 1.39 2010/03/22 22:30:58 dyoung Exp $ */
+/* $NetBSD: pcdisplay.c,v 1.40 2010/04/19 18:24:26 dyoung Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
Home |
Main Index |
Thread Index |
Old Index