Fix conficts in probe:

o For bt and aha only probe the one I/O range if a specific I/O is specified
  in the config file.
o Don't even try to probe I/O ranges that have been seen already.
o If we conflict with an IRQ or DRQ, then fail the probe.

Requested by: bde, gibbs
Approved by: jkh
This commit is contained in:
Warner Losh 1998-10-10 00:44:12 +00:00
parent 51f3fe7ab2
commit 19bed41a5d
7 changed files with 182 additions and 7 deletions

View File

@ -44,7 +44,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: adv_isa.c,v 1.3 1997/02/22 09:35:51 peter Exp $ * $Id: adv_isa.c,v 1.4 1998/09/15 07:03:39 gibbs Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -149,6 +149,13 @@ advisaprobe(struct isa_device *id)
if (port_addr == 0) if (port_addr == 0)
/* Already been attached */ /* Already been attached */
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(id, CC_IOADDR))
continue;
if (adv_find_signature(I386_BUS_SPACE_IO, port_addr)) { if (adv_find_signature(I386_BUS_SPACE_IO, port_addr)) {
/* /*
* Got one. Now allocate our softc * Got one. Now allocate our softc
@ -263,6 +270,18 @@ advisaprobe(struct isa_device *id)
adv->overrun_physbase = overrun_physbase; adv->overrun_physbase = overrun_physbase;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(id, CC_DRQ)) {
printf("advisaprobe: Aha card at I/O 0x%x's "
"drq %d conflicts, ignoring card.\n",
id->id_iobase, id->id_drq);
adv_free(adv);
return 0;
}
if (adv_init(adv) != 0) { if (adv_init(adv) != 0) {
adv_free(adv); adv_free(adv);
return (0); return (0);
@ -295,6 +314,7 @@ advisaprobe(struct isa_device *id)
id->id_irq = 1 << adv_get_chip_irq(adv); id->id_irq = 1 << adv_get_chip_irq(adv);
else else
adv_set_chip_irq(adv, ffs(id->id_irq) - 1); adv_set_chip_irq(adv, ffs(id->id_irq) - 1);
id->id_intr = adv_isa_intr; id->id_intr = adv_isa_intr;
/* Mark as probed */ /* Mark as probed */

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: aha_isa.c,v 1.1 1998/09/15 07:39:55 gibbs Exp $ * $Id: aha_isa.c,v 1.2 1998/09/24 10:43:42 bde Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -101,6 +101,7 @@ aha_isa_probe: Failing probe.\n",
: aha_isa_ports[max_port_index].addr); : aha_isa_ports[max_port_index].addr);
return 0; return 0;
} }
max_port_index = port_index;
} }
/* Attempt to find an adapter */ /* Attempt to find an adapter */
@ -118,6 +119,13 @@ aha_isa_probe: Failing probe.\n",
if (aha_check_probed_iop(ioport) != 0) if (aha_check_probed_iop(ioport) != 0)
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(dev, CC_IOADDR))
continue;
/* Allocate a softc for use during probing */ /* Allocate a softc for use during probing */
aha = aha_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); aha = aha_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
@ -166,6 +174,25 @@ aha_isa_probe: Failing probe.\n",
dev->id_iobase = aha_isa_ports[port_index].addr; dev->id_iobase = aha_isa_ports[port_index].addr;
dev->id_irq = (config_data.irq << 9); dev->id_irq = (config_data.irq << 9);
dev->id_intr = aha_isa_intr; dev->id_intr = aha_isa_intr;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(dev, CC_DRQ)) {
printf("aha_isa_probe: Aha card at I/O 0x%x's drq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
dev->id_drq);
aha_free(aha);
return 0;
}
if (haveseen_isadev(dev, CC_IRQ)) {
printf("aha_isa_probe: Aha card at I/O 0x%x's irq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
config_data.irq + 9);
aha_free(aha);
return 0;
}
aha_unit++; aha_unit++;
return (AHA_NREGS); return (AHA_NREGS);
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: bt_isa.c,v 1.1 1998/09/15 07:32:54 gibbs Exp $ * $Id: bt_isa.c,v 1.2 1998/09/24 10:43:42 bde Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -102,6 +102,7 @@ bt_isa_probe: Failing probe.\n",
: bt_isa_ports[max_port_index].addr); : bt_isa_ports[max_port_index].addr);
return 0; return 0;
} }
max_port_index = port_index;
} }
/* Attempt to find an adapter */ /* Attempt to find an adapter */
@ -119,6 +120,13 @@ bt_isa_probe: Failing probe.\n",
if (bt_check_probed_iop(ioport) != 0) if (bt_check_probed_iop(ioport) != 0)
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(dev, CC_IOADDR))
continue;
/* Allocate a softc for use during probing */ /* Allocate a softc for use during probing */
bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
@ -173,6 +181,25 @@ bt_isa_probe: Failing probe.\n",
dev->id_iobase = bt_isa_ports[port_index].addr; dev->id_iobase = bt_isa_ports[port_index].addr;
dev->id_irq = (config_data.irq << 9); dev->id_irq = (config_data.irq << 9);
dev->id_intr = bt_isa_intr; dev->id_intr = bt_isa_intr;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(dev, CC_DRQ)) {
printf("bt_isa_probe: Bt card at I/O 0x%x's drq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
dev->id_drq);
bt_free(bt);
return 0;
}
if (haveseen_isadev(dev, CC_IRQ)) {
printf("bt_isa_probe: Bt card at I/O 0x%x's irq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
config_data.irq + 9);
bt_free(bt);
return 0;
}
bt_unit++; bt_unit++;
return (BT_NREGS); return (BT_NREGS);
} }

View File

@ -44,7 +44,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: adv_isa.c,v 1.3 1997/02/22 09:35:51 peter Exp $ * $Id: adv_isa.c,v 1.4 1998/09/15 07:03:39 gibbs Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -149,6 +149,13 @@ advisaprobe(struct isa_device *id)
if (port_addr == 0) if (port_addr == 0)
/* Already been attached */ /* Already been attached */
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(id, CC_IOADDR))
continue;
if (adv_find_signature(I386_BUS_SPACE_IO, port_addr)) { if (adv_find_signature(I386_BUS_SPACE_IO, port_addr)) {
/* /*
* Got one. Now allocate our softc * Got one. Now allocate our softc
@ -263,6 +270,18 @@ advisaprobe(struct isa_device *id)
adv->overrun_physbase = overrun_physbase; adv->overrun_physbase = overrun_physbase;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(id, CC_DRQ)) {
printf("advisaprobe: Aha card at I/O 0x%x's "
"drq %d conflicts, ignoring card.\n",
id->id_iobase, id->id_drq);
adv_free(adv);
return 0;
}
if (adv_init(adv) != 0) { if (adv_init(adv) != 0) {
adv_free(adv); adv_free(adv);
return (0); return (0);
@ -295,6 +314,7 @@ advisaprobe(struct isa_device *id)
id->id_irq = 1 << adv_get_chip_irq(adv); id->id_irq = 1 << adv_get_chip_irq(adv);
else else
adv_set_chip_irq(adv, ffs(id->id_irq) - 1); adv_set_chip_irq(adv, ffs(id->id_irq) - 1);
id->id_intr = adv_isa_intr; id->id_intr = adv_isa_intr;
/* Mark as probed */ /* Mark as probed */

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: aha_isa.c,v 1.1 1998/09/15 07:39:55 gibbs Exp $ * $Id: aha_isa.c,v 1.2 1998/09/24 10:43:42 bde Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -101,6 +101,7 @@ aha_isa_probe: Failing probe.\n",
: aha_isa_ports[max_port_index].addr); : aha_isa_ports[max_port_index].addr);
return 0; return 0;
} }
max_port_index = port_index;
} }
/* Attempt to find an adapter */ /* Attempt to find an adapter */
@ -118,6 +119,13 @@ aha_isa_probe: Failing probe.\n",
if (aha_check_probed_iop(ioport) != 0) if (aha_check_probed_iop(ioport) != 0)
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(dev, CC_IOADDR))
continue;
/* Allocate a softc for use during probing */ /* Allocate a softc for use during probing */
aha = aha_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); aha = aha_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
@ -166,6 +174,25 @@ aha_isa_probe: Failing probe.\n",
dev->id_iobase = aha_isa_ports[port_index].addr; dev->id_iobase = aha_isa_ports[port_index].addr;
dev->id_irq = (config_data.irq << 9); dev->id_irq = (config_data.irq << 9);
dev->id_intr = aha_isa_intr; dev->id_intr = aha_isa_intr;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(dev, CC_DRQ)) {
printf("aha_isa_probe: Aha card at I/O 0x%x's drq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
dev->id_drq);
aha_free(aha);
return 0;
}
if (haveseen_isadev(dev, CC_IRQ)) {
printf("aha_isa_probe: Aha card at I/O 0x%x's irq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
config_data.irq + 9);
aha_free(aha);
return 0;
}
aha_unit++; aha_unit++;
return (AHA_NREGS); return (AHA_NREGS);
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: bt_isa.c,v 1.1 1998/09/15 07:32:54 gibbs Exp $ * $Id: bt_isa.c,v 1.2 1998/09/24 10:43:42 bde Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -102,6 +102,7 @@ bt_isa_probe: Failing probe.\n",
: bt_isa_ports[max_port_index].addr); : bt_isa_ports[max_port_index].addr);
return 0; return 0;
} }
max_port_index = port_index;
} }
/* Attempt to find an adapter */ /* Attempt to find an adapter */
@ -119,6 +120,13 @@ bt_isa_probe: Failing probe.\n",
if (bt_check_probed_iop(ioport) != 0) if (bt_check_probed_iop(ioport) != 0)
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(dev, CC_IOADDR))
continue;
/* Allocate a softc for use during probing */ /* Allocate a softc for use during probing */
bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
@ -173,6 +181,25 @@ bt_isa_probe: Failing probe.\n",
dev->id_iobase = bt_isa_ports[port_index].addr; dev->id_iobase = bt_isa_ports[port_index].addr;
dev->id_irq = (config_data.irq << 9); dev->id_irq = (config_data.irq << 9);
dev->id_intr = bt_isa_intr; dev->id_intr = bt_isa_intr;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(dev, CC_DRQ)) {
printf("bt_isa_probe: Bt card at I/O 0x%x's drq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
dev->id_drq);
bt_free(bt);
return 0;
}
if (haveseen_isadev(dev, CC_IRQ)) {
printf("bt_isa_probe: Bt card at I/O 0x%x's irq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
config_data.irq + 9);
bt_free(bt);
return 0;
}
bt_unit++; bt_unit++;
return (BT_NREGS); return (BT_NREGS);
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: bt_isa.c,v 1.1 1998/09/15 07:32:54 gibbs Exp $ * $Id: bt_isa.c,v 1.2 1998/09/24 10:43:42 bde Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -102,6 +102,7 @@ bt_isa_probe: Failing probe.\n",
: bt_isa_ports[max_port_index].addr); : bt_isa_ports[max_port_index].addr);
return 0; return 0;
} }
max_port_index = port_index;
} }
/* Attempt to find an adapter */ /* Attempt to find an adapter */
@ -119,6 +120,13 @@ bt_isa_probe: Failing probe.\n",
if (bt_check_probed_iop(ioport) != 0) if (bt_check_probed_iop(ioport) != 0)
continue; continue;
/*
* Make sure that we do not conflict with another device's
* I/O address.
*/
if (haveseen_isadev(dev, CC_IOADDR))
continue;
/* Allocate a softc for use during probing */ /* Allocate a softc for use during probing */
bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
@ -173,6 +181,25 @@ bt_isa_probe: Failing probe.\n",
dev->id_iobase = bt_isa_ports[port_index].addr; dev->id_iobase = bt_isa_ports[port_index].addr;
dev->id_irq = (config_data.irq << 9); dev->id_irq = (config_data.irq << 9);
dev->id_intr = bt_isa_intr; dev->id_intr = bt_isa_intr;
/*
* OK, check to make sure that we're not stepping on
* someone else's IRQ or DRQ
*/
if (haveseen_isadev(dev, CC_DRQ)) {
printf("bt_isa_probe: Bt card at I/O 0x%x's drq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
dev->id_drq);
bt_free(bt);
return 0;
}
if (haveseen_isadev(dev, CC_IRQ)) {
printf("bt_isa_probe: Bt card at I/O 0x%x's irq %d "
"conflicts, ignoring card.\n", dev->id_iobase,
config_data.irq + 9);
bt_free(bt);
return 0;
}
bt_unit++; bt_unit++;
return (BT_NREGS); return (BT_NREGS);
} }