Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2006 15:22:47 +0100
From:      "Norbert Koch" <NKoch@demig.de>
To:        <freebsd-hackers@freebsd.org>
Subject:   device probe re-tried for failed isa device
Message-ID:  <000701c6184c$d3f27060$4801a8c0@ws-ew-3.demig.intra>

next in thread | raw e-mail | index | archive | help
Hello.

I wrote two isa device drivers A and B for FreeBSD4.11.
Both are kld-loaded and have identify() entries.

Here is the pseudo code for the identify() routines:

A_identify() /* 2 units */
{
  for (i = 0; i <=1; ++ i)
  {
    dev = BUS_ADD_CHILD(parent, ISA-ORDER_SPECULATIVE, "a", 0);
    If (bus_set_resource (dev, ...) != 0)
    {
      device_delete_child (parent, dev);
      continue;
    };
    init (device_get_softc (dev, i));
  }
}

B_identify() /* 1 unit */
{
  dev = BUS_ADD_CHILD(parent, ISA-ORDER_SPECULATIVE, "a", 0);
  If (bus_set_resource (dev, ...) != 0)
  {
    device_delete_child (parent, dev);
  }
}

When I kldload the two drivers I see these function calls:

1. A_identify
2. A_probe(unit 0)
3. A_attach(unit 0)
4. A_probe(unit 1)
  <-- fails with ENXIO because hardware is not present
5. B_identify
6. A_probe(unit 1)
  <-- probed again!?
7. B_probe(unit 0)
8. B_attach(unit 0)

Is it correct, that the isa bus re-tries
to probe failed devices?

The results from calling device_get_softc()
differ for the two probe() calls 4 and 6.
Is this correct?

Is it correct to initialize softc in identify()?

Should I call device_delete_child() in
probe() when the hardware fails?

Thank you,

Norbert Koch



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000701c6184c$d3f27060$4801a8c0>