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)
Feb 23 2024, 3:52 PM
Unknown Object (File)
Feb 23 2024, 3:52 PM
Unknown Object (File)
Feb 23 2024, 3:52 PM
Unknown Object (File)
Feb 23 2024, 3:52 PM
Unknown Object (File)
Feb 23 2024, 3:51 PM
Unknown Object (File)
Feb 23 2024, 3:36 PM
Unknown Object (File)
Jan 9 2024, 6:18 PM
Unknown Object (File)
Nov 9 2023, 10:00 AM
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 Not Applicable
Unit
Tests Not Applicable

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.