summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/isa_compat.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-04-19 18:03:51 +0000
committerpeter <peter@FreeBSD.org>1999-04-19 18:03:51 +0000
commit6339c0a99af81a56f93f75b133bd1fe3a6cff5a0 (patch)
tree749407041849f80f3010733e025ba2f553502bb4 /sys/i386/isa/isa_compat.c
parentc72fc3b9cde567c27fdad82eb290829e8def8645 (diff)
downloadFreeBSD-src-6339c0a99af81a56f93f75b133bd1fe3a6cff5a0.zip
FreeBSD-src-6339c0a99af81a56f93f75b133bd1fe3a6cff5a0.tar.gz
Don't do (1 << irq) to get an interrupt mask when irq = -1.
Submitted by: Luoqi Chen <luoqi@watermarkgroup.com>
Diffstat (limited to 'sys/i386/isa/isa_compat.c')
-rw-r--r--sys/i386/isa/isa_compat.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/i386/isa/isa_compat.c b/sys/i386/isa/isa_compat.c
index b85b34e..b1d84ac 100644
--- a/sys/i386/isa/isa_compat.c
+++ b/sys/i386/isa/isa_compat.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: isa_compat.c,v 1.2 1999/04/17 09:56:35 bde Exp $
+ * $Id: isa_compat.c,v 1.3 1999/04/19 08:42:39 dfr Exp $
*/
#include <sys/param.h>
@@ -131,12 +131,14 @@ isa_compat_release_resources(device_t dev, struct isa_compat_resources *res)
}
}
+#define irqmask(x) ((x) < 0 ? 0 : (1 << (x)))
+
static int
isa_compat_probe(device_t dev)
{
struct isa_device *dvp = device_get_softc(dev);
struct isa_compat_resources res;
-
+
bzero(&res, sizeof(res));
/*
* Fill in the isa_device fields.
@@ -144,7 +146,7 @@ isa_compat_probe(device_t dev)
dvp->id_id = isa_compat_nextid();
dvp->id_driver = device_get_driver(dev)->priv;
dvp->id_iobase = isa_get_port(dev);
- dvp->id_irq = (1 << isa_get_irq(dev));
+ dvp->id_irq = irqmask(isa_get_irq(dev));
dvp->id_drq = isa_get_drq(dev);
dvp->id_maddr = (void *)isa_get_maddr(dev);
dvp->id_msize = isa_get_msize(dev);
@@ -171,7 +173,7 @@ isa_compat_probe(device_t dev)
isa_set_portsize(dev, portsize);
if (dvp->id_iobase != isa_get_port(dev))
isa_set_port(dev, dvp->id_iobase);
- if (dvp->id_irq != (1 << isa_get_irq(dev)))
+ if (dvp->id_irq != irqmask(isa_get_irq(dev)))
isa_set_irq(dev, ffs(dvp->id_irq) - 1);
if (dvp->id_drq != isa_get_drq(dev))
isa_set_drq(dev, dvp->id_drq);
OpenPOWER on IntegriCloud