Re: Loading drivers via kldload



on 16/08/2011 22:09 John Baldwin said the following:
On Tuesday, August 16, 2011 12:26:11 pm Andriy Gapon wrote:

The following are pure speculations, I'd rather let David speak, but just in case;

on 16/08/2011 18:45 John Baldwin said the following:
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.

Maybe it doesn't do that exactly because device and vendor ID are zeroes as David
described earlier.

Eh? device_probe_and_attach()'s loop to probe drivers is not PCI-specific, it
has no idea if a given device is PCI device or not let alone if it has non-zero
subvendor IDs. Also, ata_pci_probe() doesn't look at the subvendor IDs at all.

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).

This makes only if the BAR has sane values. Not sure what happens if the BAR has
some junk that duplicates other PCI device, or something like that.

The panic in question is due to a resource that was reserved by the parent
bus (i.e. either ACPI or PCI) using resource_list_reserve(), then a driver
called resource_list_alloc() on it once successfully, and
resource_list_alloc() is being called a second time to allocate an already-
allocated resource. That won't happen due to junk in a BAR (and BARs are
all standard config header registers anyway).


Thanks for straightening me on both accounts.

--
Andriy Gapon
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Loading drivers via kldload
    ... The following are pure speculations, I'd rather let David speak, but just in case; ... This makes only if the BAR has sane values. ... some junk that duplicates other PCI device, ... allocated resource. ...
    (freebsd-current)
  • Re: Loading drivers via kldload
    ... The following are pure speculations, I'd rather let David speak, but just in case; ... David's driver's probe routine should still be called to get a chance to attach to ... trigger the panic in question in that case (the panic is only triggered when you ... This makes only if the BAR has sane values. ...
    (freebsd-current)
  • Re: [PATCH 1/4 v2] PCI: introduce new base functions
    ... parameter will be used by the SR-IOV code. ... * @dev: the PCI device ... * @resno: the resource number ... * Returns BAR position in config space, or 0 if the BAR is invalid. ...
    (Linux-Kernel)
  • Re: bus device driver
    ... Do they consume subranges of BARs or are they assigned fixed addresses somehow? ... If you wish to have the PCI bus assign you resources then that implies that your PCI device has a BAR and that you want to request resources for that BAR and then hand out subranges of that to your children. ...
    (freebsd-hackers)
  • Re: [PATCH 3/4] x86: ioremap: remove physical address warning message
    ... , H. Peter Anvin wrote: ... if 64-bit BAR is assigned to a PCI device and its device ... I can see dropping the WARN_ON_ONCEthough. ...
    (Linux-Kernel)