Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2011 11:45:02 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        Stanislav Sedov <stas@freebsd.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>, David Somayajulu <david.somayajulu@qlogic.com>
Subject:   Re: Loading drivers via kldload
Message-ID:  <201108161145.02733.jhb@freebsd.org>
In-Reply-To: <4E4919DA.5000706@FreeBSD.org>
References:  <75E1A2A7D185F841A975979B0906BBA67BCC877062@AVEXMB1.qlogic.org> <75E1A2A7D185F841A975979B0906BBA67BCC877180@AVEXMB1.qlogic.org> <4E4919DA.5000706@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, August 15, 2011 9:06:34 am Andriy Gapon wrote:
> on 13/08/2011 00:20 David Somayajulu said the following:
> > This is pretty bizarre. I have been experimenting with a very simple driver
> > (see source below) which essentially checks the PCI vendor and Device ID's in
> > the probe routine. The attach and detach are empty functions. When I run
> > kldload and load the driver in a system with HBAs which have a valid Subsytem
> > Vendor and Device ID's, the driver loads and attaches to the functions.
> > 
> > However when the Subsystem Vendor and Device ID's are zero, the system panics
> > and the stack trace is as shown below(FreeBSD 8.2 on amd64 machine). I don't
> > understand why ata_pci_attach() is getting invoked.
> 
> This is because ata_pci_probe returns BUS_PROBE_GENERIC for any pci device that
> has PCIC_STORAGE class and PCIS_STORAGE_IDE subclass.  So I'd guess that it tries
> to attach to your non-trivial hardware in this case and gets some incorrect
> resource configuration (e.g. BARs) from the hardware.

Well, that would seem odd, still.  It only returns BUS_PROBE_GENERIC (not 0), so
David's driver's probe routine should still be called to get a chance to attach to
the device.  Also, the ATA driver only allocates its BAR once, so it shouldn't
trigger the panic in question in that case (the panic is only triggered when you
try to double-allocate a BAR).

> Whether we actually have to panic in such situation is a different question.

Yes, it could possibly return an error instead.  Other places in the resource list
code currently panic rather than returning errors as well though.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108161145.02733.jhb>