Page MenuHomeFreeBSD

Implement a proper detach method for the PCI-PCI bridge driver.
ClosedPublic

Authored by jhb on May 17 2016, 8:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 27, 2:09 AM
Unknown Object (File)
Thu, Nov 14, 4:29 PM
Unknown Object (File)
Wed, Nov 6, 8:32 PM
Unknown Object (File)
Tue, Nov 5, 2:00 PM
Unknown Object (File)
Oct 1 2024, 5:01 AM
Unknown Object (File)
Sep 27 2024, 6:38 AM
Unknown Object (File)
Sep 26 2024, 1:58 AM
Unknown Object (File)
Sep 16 2024, 10:02 PM
Subscribers
None

Details

Summary

Implement a proper detach method for the PCI-PCI bridge driver.

  • Add a pcib_detach() function for the PCI-PCI bridge driver. It tears down the NEW_PCIB and hotplug state including destroying resource managers, deleting child devices, and disabling hotplug events.
  • Add a detach method to the ACPI PCI-PCI bridge driver which calls pcib_detach() and then frees the copy of the _PRT interrupt routing table.
  • Add a detach method to the PCI-Cardbus bridge driver which frees the PCI bus resources in addition to calling cbb_detach().
  • Explicitly clear any pending hotplug events during attach to ensure future events will generate an interrupt.
  • If a the Command Completed bit is set in the slot status register when the command completion timeout fires, treat it as if the command completed and the completion interrupt was just lost rather than forcing a detach.
  • Don't wait for a Command Completed notification if Command Completion interrupts are disabled. The spec explicitly says no interrupt is enabled when clearing CCIE, and on my T400 no interrupt is generated when CCIE is changed from cleared to set, either. In addition, the T400 doesn't appear to set the Command Completed bit in the cases where it doesn't generate an interrupt, so don't schedule the timer either. (If the CC bit were always set, one could always set the timer and rely on the logic of treating CC set as a missed interrupt.)
Test Plan
  • tested via 'devctl disable' and 'devctl enable' cycles of the parent 'pcib' device of an ExpressCard slot on my X220 and T400 as well as the parent 'cbb' device of the Cardbus slot in the T400.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3802
Build 3845: arc lint + arc unit

Event Timeline

jhb retitled this revision from to Implement a proper detach method for the PCI-PCI bridge driver..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: imp.
jhb updated this object.
  • Rebase.
  • First cut at actually shutting down hotplug machinery.
  • Fix shutdown of hotplug events if a command is pending.
  • Clear any pending events during attach.
imp edited edge metadata.
This revision is now accepted and ready to land.May 18 2016, 3:08 PM
jhb edited edge metadata.
jhb updated this object.
  • More fixes for command completions.

Had to adjust the command completion logic a bit after testing on the T400
(which uses command completions). I think it's a bug in the hardware that
it doesn't generate CC interrupts when setting CCIE and doesn't set CC in
the status register always, but that isn't fixable, so the driver has to cope
instead.

This revision now requires review to proceed.May 19 2016, 11:24 PM
This revision was automatically updated to reflect the committed changes.