Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic MI code should not compare bus_space_tag_t! Intr...
details: https://anonhg.NetBSD.org/src/rev/5629e826bf1d
branches: trunk
changeset: 753326:5629e826bf1d
user: dyoung <dyoung%NetBSD.org@localhost>
date: Mon Mar 22 23:00:08 2010 +0000
description:
MI code should not compare bus_space_tag_t! Introduce tags_are_equal()
for "comparing" two bus_space_tag_t's. It is always true.
Everywhere that com(4) compares two tags, it compares to I/O base
addresses, too; comparing the base addresses should suffice.
TBD Clean this up more thoroughly.
diffstat:
sys/dev/ic/com.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diffs (74 lines):
diff -r 0dd8f12f61d0 -r 5629e826bf1d sys/dev/ic/com.c
--- a/sys/dev/ic/com.c Mon Mar 22 22:59:06 2010 +0000
+++ b/sys/dev/ic/com.c Mon Mar 22 23:00:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.295 2010/02/24 22:37:58 dyoung Exp $ */
+/* $NetBSD: com.c,v 1.296 2010/03/22 23:00:08 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.295 2010/02/24 22:37:58 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.296 2010/03/22 23:00:08 dyoung Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -263,6 +263,13 @@
#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)
@@ -392,7 +399,7 @@
CSR_WRITE_1(regsp, COM_REG_IER, sc->sc_ier);
- if (regsp->cr_iot == comcons_info.regs.cr_iot &&
+ if (tags_are_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
regsp->cr_iobase == comcons_info.regs.cr_iobase) {
comconsattached = 1;
@@ -541,7 +548,7 @@
* exclusive use. If it's the console _and_ the
* kgdb device, it doesn't.
*/
- if (regsp->cr_iot == comkgdbregs.cr_iot &&
+ if (tags_are_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;
@@ -2302,7 +2309,7 @@
{
int res;
- if (regsp->cr_iot == comcons_info.regs.cr_iot &&
+ if (tags_are_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 */
@@ -2371,12 +2378,12 @@
bus_space_handle_t help;
if (!comconsattached &&
- iot == comcons_info.regs.cr_iot &&
+ tags_are_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 &&
- iot == comkgdbregs.cr_iot && iobase == comkgdbregs.cr_iobase)
+ tags_are_equal(iot, comkgdbregs.cr_iot) && iobase == comkgdbregs.cr_iobase)
help = comkgdbregs.cr_ioh;
#endif
else
Home |
Main Index |
Thread Index |
Old Index