Fixed regressions in rev.1.274:

1) Non-AST4 multiport cards were broken by bypassing the code that changes
   `idev' to the multiport master device.
2) AST4 multiport cards apparently were broken by inverting the test for
   the master device having an irq.
3) Error handling for nonexistent master devices was broken by removing a
   check for a null pointer.
4) `int' error codes returned by bus_get_resource() were assigned directly
   to the boolean variable com->no_irq.  Probably harmless, since the
   boolean is implemented as a u_char.

Submitted by:	part 1) by Chris Radek <cradek@in221.inetnebr.com>
		part 2) by yokota
Approved by:	jkh
This commit is contained in:
Bruce Evans 2000-02-15 17:29:09 +00:00
parent 1d1ade86f0
commit 34ae9210dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57234
2 changed files with 30 additions and 22 deletions

View File

@ -692,7 +692,7 @@ sioprobe(dev)
idev = dev;
mcr_image = MCR_IENABLE;
#ifdef COM_MULTIPORT
if (COM_ISMULTIPORT(flags) && !COM_NOTAST4(flags)) {
if (COM_ISMULTIPORT(flags)) {
Port_t xiobase;
u_long io;
@ -702,14 +702,18 @@ sioprobe(dev)
device_get_unit(dev), COM_MPMASTER(flags));
idev = dev;
}
if (bus_get_resource(idev, SYS_RES_IOPORT, 0, &io, NULL) == 0) {
xiobase = io;
if (bus_get_resource(idev, SYS_RES_IRQ, 0, NULL, NULL))
outb(xiobase + com_scr, 0x80); /* no irq */
else
outb(xiobase + com_scr, 0);
if (!COM_NOTAST4(flags)) {
if (bus_get_resource(idev, SYS_RES_IOPORT, 0, &io,
NULL) == 0) {
xiobase = io;
if (bus_get_resource(idev, SYS_RES_IRQ, 0,
NULL, NULL) == 0)
outb(xiobase + com_scr, 0x80);
else
outb(xiobase + com_scr, 0);
}
mcr_image = 0;
}
mcr_image = 0;
}
#endif /* COM_MULTIPORT */
if (bus_get_resource(idev, SYS_RES_IRQ, 0, NULL, NULL) != 0)
@ -1011,7 +1015,7 @@ sioattach(dev)
com->cfcr_image = CFCR_8BITS;
com->dtr_wait = 3 * hz;
com->loses_outints = COM_LOSESOUTINTS(flags) != 0;
com->no_irq = bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL);
com->no_irq = bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0;
com->tx_fifo_size = 1;
com->obufs[0].l_head = com->obuf1;
com->obufs[1].l_head = com->obuf2;
@ -1170,8 +1174,8 @@ determined_type: ;
printf(")");
masterdev = devclass_get_device(sio_devclass,
COM_MPMASTER(flags));
com->no_irq = bus_get_resource(masterdev, SYS_RES_IRQ, 0, NULL,
NULL);
com->no_irq = (masterdev == NULL || bus_get_resource(masterdev,
SYS_RES_IRQ, 0, NULL, NULL) != 0);
}
#endif /* COM_MULTIPORT */
if (unit == comconsole)

View File

@ -692,7 +692,7 @@ sioprobe(dev)
idev = dev;
mcr_image = MCR_IENABLE;
#ifdef COM_MULTIPORT
if (COM_ISMULTIPORT(flags) && !COM_NOTAST4(flags)) {
if (COM_ISMULTIPORT(flags)) {
Port_t xiobase;
u_long io;
@ -702,14 +702,18 @@ sioprobe(dev)
device_get_unit(dev), COM_MPMASTER(flags));
idev = dev;
}
if (bus_get_resource(idev, SYS_RES_IOPORT, 0, &io, NULL) == 0) {
xiobase = io;
if (bus_get_resource(idev, SYS_RES_IRQ, 0, NULL, NULL))
outb(xiobase + com_scr, 0x80); /* no irq */
else
outb(xiobase + com_scr, 0);
if (!COM_NOTAST4(flags)) {
if (bus_get_resource(idev, SYS_RES_IOPORT, 0, &io,
NULL) == 0) {
xiobase = io;
if (bus_get_resource(idev, SYS_RES_IRQ, 0,
NULL, NULL) == 0)
outb(xiobase + com_scr, 0x80);
else
outb(xiobase + com_scr, 0);
}
mcr_image = 0;
}
mcr_image = 0;
}
#endif /* COM_MULTIPORT */
if (bus_get_resource(idev, SYS_RES_IRQ, 0, NULL, NULL) != 0)
@ -1011,7 +1015,7 @@ sioattach(dev)
com->cfcr_image = CFCR_8BITS;
com->dtr_wait = 3 * hz;
com->loses_outints = COM_LOSESOUTINTS(flags) != 0;
com->no_irq = bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL);
com->no_irq = bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0;
com->tx_fifo_size = 1;
com->obufs[0].l_head = com->obuf1;
com->obufs[1].l_head = com->obuf2;
@ -1170,8 +1174,8 @@ determined_type: ;
printf(")");
masterdev = devclass_get_device(sio_devclass,
COM_MPMASTER(flags));
com->no_irq = bus_get_resource(masterdev, SYS_RES_IRQ, 0, NULL,
NULL);
com->no_irq = (masterdev == NULL || bus_get_resource(masterdev,
SYS_RES_IRQ, 0, NULL, NULL) != 0);
}
#endif /* COM_MULTIPORT */
if (unit == comconsole)