1919#include <linux/types.h>
2020#include <linux/pm_runtime.h>
2121#include <linux/pci.h>
22+ #include <trace/events/pci.h>
2223
2324#include "../pci.h"
2425#include "pciehp.h"
@@ -244,12 +245,20 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
244245 case ON_STATE :
245246 ctrl -> state = POWEROFF_STATE ;
246247 mutex_unlock (& ctrl -> state_lock );
247- if (events & PCI_EXP_SLTSTA_DLLSC )
248+ if (events & PCI_EXP_SLTSTA_DLLSC ) {
248249 ctrl_info (ctrl , "Slot(%s): Link Down\n" ,
249250 slot_name (ctrl ));
250- if (events & PCI_EXP_SLTSTA_PDC )
251+ trace_pci_hp_event (pci_name (ctrl -> pcie -> port ),
252+ slot_name (ctrl ),
253+ PCI_HOTPLUG_LINK_DOWN );
254+ }
255+ if (events & PCI_EXP_SLTSTA_PDC ) {
251256 ctrl_info (ctrl , "Slot(%s): Card not present\n" ,
252257 slot_name (ctrl ));
258+ trace_pci_hp_event (pci_name (ctrl -> pcie -> port ),
259+ slot_name (ctrl ),
260+ PCI_HOTPLUG_CARD_NOT_PRESENT );
261+ }
253262 pciehp_disable_slot (ctrl , SURPRISE_REMOVAL );
254263 break ;
255264 default :
@@ -269,6 +278,9 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
269278 INDICATOR_NOOP );
270279 ctrl_info (ctrl , "Slot(%s): Card not present\n" ,
271280 slot_name (ctrl ));
281+ trace_pci_hp_event (pci_name (ctrl -> pcie -> port ),
282+ slot_name (ctrl ),
283+ PCI_HOTPLUG_CARD_NOT_PRESENT );
272284 }
273285 mutex_unlock (& ctrl -> state_lock );
274286 return ;
@@ -281,12 +293,19 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
281293 case OFF_STATE :
282294 ctrl -> state = POWERON_STATE ;
283295 mutex_unlock (& ctrl -> state_lock );
284- if (present )
296+ if (present ) {
285297 ctrl_info (ctrl , "Slot(%s): Card present\n" ,
286298 slot_name (ctrl ));
287- if (link_active )
288- ctrl_info (ctrl , "Slot(%s): Link Up\n" ,
289- slot_name (ctrl ));
299+ trace_pci_hp_event (pci_name (ctrl -> pcie -> port ),
300+ slot_name (ctrl ),
301+ PCI_HOTPLUG_CARD_PRESENT );
302+ }
303+ if (link_active ) {
304+ ctrl_info (ctrl , "Slot(%s): Link Up\n" , slot_name (ctrl ));
305+ trace_pci_hp_event (pci_name (ctrl -> pcie -> port ),
306+ slot_name (ctrl ),
307+ PCI_HOTPLUG_LINK_UP );
308+ }
290309 ctrl -> request_result = pciehp_enable_slot (ctrl );
291310 break ;
292311 default :
0 commit comments