STRUCT CONTROLLER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct controller(9) β€” PCIe hotplug controller πŸ’–

okay so bestie, welcome to the Kernel API Manual page for struct controller. It’s the PCIe hotplug controller, and yes, it’s giving main character energy. ✨

🌸 NAME 🌸

struct controller β€” PCIe hotplug controller πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

       struct controller {
           struct pcie_device *pcie;
           u64 dsn;
           u32 slot_cap;
           unsigned int inband_presence_disabled:1;
           u16 slot_ctrl;
           struct mutex ctrl_lock;
           unsigned long cmd_started;
           unsigned int cmd_busy:1;
           wait_queue_head_t queue;
           atomic_t pending_events;
           unsigned int notification_enabled:1;
           unsigned int power_fault_detected;
           struct task_struct *poll_thread;
           u8 state;
           struct mutex state_lock;
           struct delayed_work button_work;
           struct hotplug_slot hotplug_slot;
           struct rw_semaphore reset_lock;
           unsigned int depth;
           unsigned int ist_running;
           int request_result;
           wait_queue_head_t requester;
        };

πŸŽ€ Members πŸŽ€

  • pcie β€” pointer to the controller’s PCIe port service device. πŸ’…
  • dsn β€” cached copy of the Device Serial Number of Function 0 in the hotplug slot (PCIe r6.2 sec 7.9.3); it’s used to determine whether a hotplugged device was replaced with a different one during system sleep.
  • slot_cap β€” cached copy of the Slot Capabilities register.
  • inband_presence_disabled β€” In-Band Presence Detect Disable supported by the controller and disabled per the spec recommendation (PCIe r5.0, appendix I implementation note).
  • slot_ctrl β€” cached copy of the Slot Control register.
  • ctrl_lock β€” serializes writes to the Slot Control register.
  • cmd_started β€” jiffies when the Slot Control register was last written; the next write is allowed 1 second later, absent a Command Completed interrupt (PCIe r4.0, sec 6.7.3.2).
  • cmd_busy β€” flag set on Slot Control register write, cleared by the IRQ handler on reception of a Command Completed event.
  • queue β€” wait queue to wake up on reception of a Command Completed event, used for synchronous writes to the Slot Control register.
  • pending_events β€” used by the IRQ handler to save events retrieved from the Slot Status register for later consumption by the IRQ thread.
  • notification_enabled β€” whether the IRQ was requested successfully.
  • power_fault_detected β€” whether a power fault was detected by the hardware that has not yet been cleared by the user.
  • poll_thread β€” thread to poll for slot events if no IRQ is available, enabled with the pciehp_poll_mode module parameter.
  • state β€” current state machine position.
  • state_lock β€” protects reads and writes of state; protects scheduling, execution and cancellation of button_work.
  • button_work β€” work item to turn the slot on or off after 5 seconds in response to an Attention Button press.
  • hotplug_slot β€” structure registered with the PCI hotplug core.
  • reset_lock β€” prevents access to the Data Link Layer Link Active bit in the Link Status register and to the Presence Detect State bit in the Slot Status register during a slot reset which may cause them to flap.
  • depth β€” Number of additional hotplug ports in the path to the root bus, used as lock subclass for reset_lock.
  • ist_running β€” flag to keep user request waiting while the IRQ thread is running.
  • request_result β€” result of last user request submitted to the IRQ thread.
  • requester β€” wait queue to wake up on completion of user request, used for synchronous slot enable/disable request via sysfs.

🌸 Description 🌸

PCIe hotplug has a 1:1 relationship between controller and slot, hence unlike other drivers, the two aren’t represented by separate structures. slay, simplicity. πŸ’–

🌈 SEE ALSO 🌈

  • Kernel file ./drivers/pci/hotplug/pciehp.h
  • Slot state(9)
  • Flags to request an action from the IRQ thread(9)

mwah πŸ’‹ this cutie comes from ./drivers/pci/hotplug, dated October 2026. source/version + date sign-off complete, bestie. πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from