Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (21 commits)
x86/PCI: make 32 bit NUMA node array int, not unsigned char
x86/PCI: default pcibus cpumask to all cpus if it lacks affinity
MAINTAINTERS: remove hotplug driver entries
PCI: pciehp: remove slot capabilities definitions
PCI: pciehp: remove error message definitions
PCI: pciehp: remove number field
PCI: pciehp: remove hpc_ops
PCI: pciehp: remove pci_dev field
PCI: pciehp: remove crit_sect mutex
PCI: pciehp: remove slot_bus field
PCI: pciehp: remove first_slot field
PCI: pciehp: remove slot_device_offset field
PCI: pciehp: remove hp_slot field
PCI: pciehp: remove device field
PCI: pciehp: remove bus field
PCI: pciehp: remove slot_num_inc field
PCI: pciehp: remove num_slots field
PCI: pciehp: remove slot_list field
PCI: fix VGA arbiter header file
PCI: Disable AER with pci=nomsi
...

Fixed up trivial conflicts in MAINTAINERS

+200 -330
+3 -16
MAINTAINERS
··· 257 S: Supported 258 F: drivers/acpi/fan.c 259 260 - ACPI PCI HOTPLUG DRIVER 261 - M: Kristen Carlson Accardi <kristen.c.accardi@intel.com> 262 - L: linux-pci@vger.kernel.org 263 - S: Supported 264 - F: drivers/pci/hotplug/acpi* 265 - 266 ACPI THERMAL DRIVER 267 M: Zhang Rui <rui.zhang@intel.com> 268 L: linux-acpi@vger.kernel.org ··· 3999 F: drivers/pci/ 4000 F: include/linux/pci* 4001 4002 - PCIE HOTPLUG DRIVER 4003 - M: Kristen Carlson Accardi <kristen.c.accardi@intel.com> 4004 L: linux-pci@vger.kernel.org 4005 S: Supported 4006 - F: drivers/pci/pcie/ 4007 4008 PCMCIA SUBSYSTEM 4009 P: Linux PCMCIA Team ··· 4666 F: drivers/usb/gadget/lh7a40* 4667 F: drivers/usb/host/ohci-lh7a40* 4668 4669 - SHPC HOTPLUG DRIVER 4670 - M: Kristen Carlson Accardi <kristen.c.accardi@intel.com> 4671 - L: linux-pci@vger.kernel.org 4672 - S: Supported 4673 - F: drivers/pci/hotplug/shpchp* 4674 - 4675 SIMPLE FIRMWARE INTERFACE (SFI) 4676 P: Len Brown 4677 M: lenb@kernel.org ··· 4676 F: arch/x86/kernel/*sfi* 4677 F: drivers/sfi/ 4678 F: include/linux/sfi*.h 4679 - 4680 4681 SIMTEC EB110ATX (Chalice CATS) 4682 P: Ben Dooks
··· 257 S: Supported 258 F: drivers/acpi/fan.c 259 260 ACPI THERMAL DRIVER 261 M: Zhang Rui <rui.zhang@intel.com> 262 L: linux-acpi@vger.kernel.org ··· 4005 F: drivers/pci/ 4006 F: include/linux/pci* 4007 4008 + PCI HOTPLUG 4009 + M: Jesse Barnes <jbarnes@virtuousgeek.org> 4010 L: linux-pci@vger.kernel.org 4011 S: Supported 4012 + F: drivers/pci/hotplug 4013 4014 PCMCIA SUBSYSTEM 4015 P: Linux PCMCIA Team ··· 4672 F: drivers/usb/gadget/lh7a40* 4673 F: drivers/usb/host/ohci-lh7a40* 4674 4675 SIMPLE FIRMWARE INTERFACE (SFI) 4676 P: Len Brown 4677 M: lenb@kernel.org ··· 4688 F: arch/x86/kernel/*sfi* 4689 F: drivers/sfi/ 4690 F: include/linux/sfi*.h 4691 4692 SIMTEC EB110ATX (Chalice CATS) 4693 P: Ben Dooks
+5 -1
arch/x86/include/asm/pci.h
··· 143 static inline const struct cpumask * 144 cpumask_of_pcibus(const struct pci_bus *bus) 145 { 146 - return cpumask_of_node(__pcibus_to_node(bus)); 147 } 148 #endif 149
··· 143 static inline const struct cpumask * 144 cpumask_of_pcibus(const struct pci_bus *bus) 145 { 146 + int node; 147 + 148 + node = __pcibus_to_node(bus); 149 + return (node == -1) ? cpu_online_mask : 150 + cpumask_of_node(node); 151 } 152 #endif 153
+1 -1
arch/x86/pci/common.c
··· 646 647 #else /* CONFIG_X86_32 */ 648 649 - static unsigned char mp_bus_to_node[BUS_NR] = { 650 [0 ... BUS_NR - 1] = -1 651 }; 652
··· 646 647 #else /* CONFIG_X86_32 */ 648 649 + static int mp_bus_to_node[BUS_NR] = { 650 [0 ... BUS_NR - 1] = -1 651 }; 652
+29 -78
drivers/pci/hotplug/pciehp.h
··· 72 73 #define SLOT_NAME_SIZE 10 74 struct slot { 75 - u8 bus; 76 - u8 device; 77 u8 state; 78 - u8 hp_slot; 79 - u32 number; 80 struct controller *ctrl; 81 - struct hpc_ops *hpc_ops; 82 struct hotplug_slot *hotplug_slot; 83 - struct list_head slot_list; 84 struct delayed_work work; /* work for button event */ 85 struct mutex lock; 86 }; ··· 86 }; 87 88 struct controller { 89 - struct mutex crit_sect; /* critical section mutex */ 90 struct mutex ctrl_lock; /* controller lock */ 91 - int num_slots; /* Number of slots on ctlr */ 92 - int slot_num_inc; /* 1 or -1 */ 93 - struct pci_dev *pci_dev; 94 struct pcie_device *pcie; /* PCI Express port service */ 95 - struct list_head slot_list; 96 - struct hpc_ops *hpc_ops; 97 wait_queue_head_t queue; /* sleep & wake process */ 98 - u8 slot_device_offset; 99 - u32 first_slot; /* First physical slot number */ /* PCIE only has 1 slot */ 100 - u8 slot_bus; /* Bus where the slots handled by this controller sit */ 101 u32 slot_cap; 102 u8 cap_base; 103 struct timer_list poll_timer; ··· 117 #define POWERON_STATE 3 118 #define POWEROFF_STATE 4 119 120 - /* Error messages */ 121 - #define INTERLOCK_OPEN 0x00000002 122 - #define ADD_NOT_SUPPORTED 0x00000003 123 - #define CARD_FUNCTIONING 0x00000005 124 - #define ADAPTER_NOT_SAME 0x00000006 125 - #define NO_ADAPTER_PRESENT 0x00000009 126 - #define NOT_ENOUGH_RESOURCES 0x0000000B 127 - #define DEVICE_TYPE_NOT_SUPPORTED 0x0000000C 128 - #define WRONG_BUS_FREQUENCY 0x0000000D 129 - #define POWER_FAILURE 0x0000000E 130 - 131 - /* Field definitions in Slot Capabilities Register */ 132 - #define ATTN_BUTTN_PRSN 0x00000001 133 - #define PWR_CTRL_PRSN 0x00000002 134 - #define MRL_SENS_PRSN 0x00000004 135 - #define ATTN_LED_PRSN 0x00000008 136 - #define PWR_LED_PRSN 0x00000010 137 - #define HP_SUPR_RM_SUP 0x00000020 138 - #define EMI_PRSN 0x00020000 139 - #define NO_CMD_CMPL_SUP 0x00040000 140 - 141 - #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) 142 - #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) 143 - #define MRL_SENS(ctrl) ((ctrl)->slot_cap & MRL_SENS_PRSN) 144 - #define ATTN_LED(ctrl) ((ctrl)->slot_cap & ATTN_LED_PRSN) 145 - #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) 146 - #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) 147 - #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) 148 - #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & NO_CMD_CMPL_SUP) 149 150 extern int pciehp_sysfs_enable_slot(struct slot *slot); 151 extern int pciehp_sysfs_disable_slot(struct slot *slot); 152 extern u8 pciehp_handle_attention_button(struct slot *p_slot); 153 - extern u8 pciehp_handle_switch_change(struct slot *p_slot); 154 extern u8 pciehp_handle_presence_change(struct slot *p_slot); 155 extern u8 pciehp_handle_power_fault(struct slot *p_slot); 156 extern int pciehp_configure_device(struct slot *p_slot); ··· 141 int pciehp_enable_slot(struct slot *p_slot); 142 int pciehp_disable_slot(struct slot *p_slot); 143 int pcie_enable_notification(struct controller *ctrl); 144 145 static inline const char *slot_name(struct slot *slot) 146 { 147 return hotplug_slot_name(slot->hotplug_slot); 148 } 149 - 150 - static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) 151 - { 152 - struct slot *slot; 153 - 154 - list_for_each_entry(slot, &ctrl->slot_list, slot_list) { 155 - if (slot->device == device) 156 - return slot; 157 - } 158 - 159 - ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device); 160 - return NULL; 161 - } 162 - 163 - struct hpc_ops { 164 - int (*power_on_slot)(struct slot *slot); 165 - int (*power_off_slot)(struct slot *slot); 166 - int (*get_power_status)(struct slot *slot, u8 *status); 167 - int (*get_attention_status)(struct slot *slot, u8 *status); 168 - int (*set_attention_status)(struct slot *slot, u8 status); 169 - int (*get_latch_status)(struct slot *slot, u8 *status); 170 - int (*get_adapter_status)(struct slot *slot, u8 *status); 171 - int (*get_max_bus_speed)(struct slot *slot, enum pci_bus_speed *speed); 172 - int (*get_cur_bus_speed)(struct slot *slot, enum pci_bus_speed *speed); 173 - int (*get_max_lnk_width)(struct slot *slot, enum pcie_link_width *val); 174 - int (*get_cur_lnk_width)(struct slot *slot, enum pcie_link_width *val); 175 - int (*query_power_fault)(struct slot *slot); 176 - void (*green_led_on)(struct slot *slot); 177 - void (*green_led_off)(struct slot *slot); 178 - void (*green_led_blink)(struct slot *slot); 179 - void (*release_ctlr)(struct controller *ctrl); 180 - int (*check_lnk_status)(struct controller *ctrl); 181 - }; 182 183 #ifdef CONFIG_ACPI 184 #include <acpi/acpi.h>
··· 72 73 #define SLOT_NAME_SIZE 10 74 struct slot { 75 u8 state; 76 struct controller *ctrl; 77 struct hotplug_slot *hotplug_slot; 78 struct delayed_work work; /* work for button event */ 79 struct mutex lock; 80 }; ··· 92 }; 93 94 struct controller { 95 struct mutex ctrl_lock; /* controller lock */ 96 struct pcie_device *pcie; /* PCI Express port service */ 97 + struct slot *slot; 98 wait_queue_head_t queue; /* sleep & wake process */ 99 u32 slot_cap; 100 u8 cap_base; 101 struct timer_list poll_timer; ··· 131 #define POWERON_STATE 3 132 #define POWEROFF_STATE 4 133 134 + #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_ABP) 135 + #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_PCP) 136 + #define MRL_SENS(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_MRLSP) 137 + #define ATTN_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_AIP) 138 + #define PWR_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_PIP) 139 + #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_HPS) 140 + #define EMI(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_EIP) 141 + #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_NCCS) 142 + #define PSN(ctrl) ((ctrl)->slot_cap >> 19) 143 144 extern int pciehp_sysfs_enable_slot(struct slot *slot); 145 extern int pciehp_sysfs_disable_slot(struct slot *slot); 146 extern u8 pciehp_handle_attention_button(struct slot *p_slot); 147 + extern u8 pciehp_handle_switch_change(struct slot *p_slot); 148 extern u8 pciehp_handle_presence_change(struct slot *p_slot); 149 extern u8 pciehp_handle_power_fault(struct slot *p_slot); 150 extern int pciehp_configure_device(struct slot *p_slot); ··· 175 int pciehp_enable_slot(struct slot *p_slot); 176 int pciehp_disable_slot(struct slot *p_slot); 177 int pcie_enable_notification(struct controller *ctrl); 178 + int pciehp_power_on_slot(struct slot *slot); 179 + int pciehp_power_off_slot(struct slot *slot); 180 + int pciehp_get_power_status(struct slot *slot, u8 *status); 181 + int pciehp_get_attention_status(struct slot *slot, u8 *status); 182 + 183 + int pciehp_set_attention_status(struct slot *slot, u8 status); 184 + int pciehp_get_latch_status(struct slot *slot, u8 *status); 185 + int pciehp_get_adapter_status(struct slot *slot, u8 *status); 186 + int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *speed); 187 + int pciehp_get_max_link_width(struct slot *slot, enum pcie_link_width *val); 188 + int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *speed); 189 + int pciehp_get_cur_link_width(struct slot *slot, enum pcie_link_width *val); 190 + int pciehp_query_power_fault(struct slot *slot); 191 + void pciehp_green_led_on(struct slot *slot); 192 + void pciehp_green_led_off(struct slot *slot); 193 + void pciehp_green_led_blink(struct slot *slot); 194 + int pciehp_check_link_status(struct controller *ctrl); 195 + void pciehp_release_ctrl(struct controller *ctrl); 196 197 static inline const char *slot_name(struct slot *slot) 198 { 199 return hotplug_slot_name(slot->hotplug_slot); 200 } 201 202 #ifdef CONFIG_ACPI 203 #include <acpi/acpi.h>
+11 -6
drivers/pci/hotplug/pciehp_acpi.c
··· 33 #define PCIEHP_DETECT_AUTO (2) 34 #define PCIEHP_DETECT_DEFAULT PCIEHP_DETECT_AUTO 35 36 static int slot_detection_mode; 37 static char *pciehp_detect_mode; 38 module_param(pciehp_detect_mode, charp, 0444); ··· 82 int pos; 83 u32 slot_cap; 84 acpi_handle handle; 85 - struct slot *slot, *tmp; 86 struct pci_dev *pdev = dev->port; 87 /* Note: pciehp_detect_mode != PCIEHP_DETECT_ACPI here */ 88 if (pciehp_get_hp_hw_control_from_firmware(pdev)) ··· 94 if (!slot) 95 return -ENOMEM; 96 slot->number = slot_cap >> 19; 97 - list_for_each_entry(tmp, &dummy_slots, slot_list) { 98 if (tmp->number == slot->number) 99 dup_slot_id++; 100 } 101 - list_add_tail(&slot->slot_list, &dummy_slots); 102 handle = DEVICE_ACPI_HANDLE(&pdev->dev); 103 if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle)) 104 acpi_slot_detected = 1; ··· 114 115 static int __init select_detection_mode(void) 116 { 117 - struct slot *slot, *tmp; 118 pcie_port_service_register(&dummy_driver); 119 pcie_port_service_unregister(&dummy_driver); 120 - list_for_each_entry_safe(slot, tmp, &dummy_slots, slot_list) { 121 - list_del(&slot->slot_list); 122 kfree(slot); 123 } 124 if (acpi_slot_detected && dup_slot_id)
··· 33 #define PCIEHP_DETECT_AUTO (2) 34 #define PCIEHP_DETECT_DEFAULT PCIEHP_DETECT_AUTO 35 36 + struct dummy_slot { 37 + u32 number; 38 + struct list_head list; 39 + }; 40 + 41 static int slot_detection_mode; 42 static char *pciehp_detect_mode; 43 module_param(pciehp_detect_mode, charp, 0444); ··· 77 int pos; 78 u32 slot_cap; 79 acpi_handle handle; 80 + struct dummy_slot *slot, *tmp; 81 struct pci_dev *pdev = dev->port; 82 /* Note: pciehp_detect_mode != PCIEHP_DETECT_ACPI here */ 83 if (pciehp_get_hp_hw_control_from_firmware(pdev)) ··· 89 if (!slot) 90 return -ENOMEM; 91 slot->number = slot_cap >> 19; 92 + list_for_each_entry(tmp, &dummy_slots, list) { 93 if (tmp->number == slot->number) 94 dup_slot_id++; 95 } 96 + list_add_tail(&slot->list, &dummy_slots); 97 handle = DEVICE_ACPI_HANDLE(&pdev->dev); 98 if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle)) 99 acpi_slot_detected = 1; ··· 109 110 static int __init select_detection_mode(void) 111 { 112 + struct dummy_slot *slot, *tmp; 113 pcie_port_service_register(&dummy_driver); 114 pcie_port_service_unregister(&dummy_driver); 115 + list_for_each_entry_safe(slot, tmp, &dummy_slots, list) { 116 + list_del(&slot->list); 117 kfree(slot); 118 } 119 if (acpi_slot_detected && dup_slot_id)
+60 -70
drivers/pci/hotplug/pciehp_core.c
··· 99 kfree(hotplug_slot); 100 } 101 102 - static int init_slots(struct controller *ctrl) 103 { 104 - struct slot *slot; 105 - struct hotplug_slot *hotplug_slot; 106 - struct hotplug_slot_info *info; 107 char name[SLOT_NAME_SIZE]; 108 int retval = -ENOMEM; 109 110 - list_for_each_entry(slot, &ctrl->slot_list, slot_list) { 111 - hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL); 112 - if (!hotplug_slot) 113 - goto error; 114 115 - info = kzalloc(sizeof(*info), GFP_KERNEL); 116 - if (!info) 117 - goto error_hpslot; 118 119 - /* register this slot with the hotplug pci core */ 120 - hotplug_slot->info = info; 121 - hotplug_slot->private = slot; 122 - hotplug_slot->release = &release_slot; 123 - hotplug_slot->ops = &pciehp_hotplug_slot_ops; 124 - slot->hotplug_slot = hotplug_slot; 125 - snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); 126 127 - ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " 128 - "hp_slot=%x sun=%x slot_device_offset=%x\n", 129 - pci_domain_nr(ctrl->pci_dev->subordinate), 130 - slot->bus, slot->device, slot->hp_slot, slot->number, 131 - ctrl->slot_device_offset); 132 - retval = pci_hp_register(hotplug_slot, 133 - ctrl->pci_dev->subordinate, 134 - slot->device, 135 - name); 136 - if (retval) { 137 - ctrl_err(ctrl, "pci_hp_register failed with error %d\n", 138 - retval); 139 - goto error_info; 140 - } 141 - get_power_status(hotplug_slot, &info->power_status); 142 - get_attention_status(hotplug_slot, &info->attention_status); 143 - get_latch_status(hotplug_slot, &info->latch_status); 144 - get_adapter_status(hotplug_slot, &info->adapter_status); 145 } 146 - 147 - return 0; 148 - error_info: 149 - kfree(info); 150 - error_hpslot: 151 - kfree(hotplug_slot); 152 - error: 153 return retval; 154 } 155 156 - static void cleanup_slots(struct controller *ctrl) 157 { 158 - struct slot *slot; 159 - list_for_each_entry(slot, &ctrl->slot_list, slot_list) 160 - pci_hp_deregister(slot->hotplug_slot); 161 } 162 163 /* ··· 163 hotplug_slot->info->attention_status = status; 164 165 if (ATTN_LED(slot->ctrl)) 166 - slot->hpc_ops->set_attention_status(slot, status); 167 168 return 0; 169 } ··· 198 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 199 __func__, slot_name(slot)); 200 201 - retval = slot->hpc_ops->get_power_status(slot, value); 202 if (retval < 0) 203 *value = hotplug_slot->info->power_status; 204 ··· 213 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 214 __func__, slot_name(slot)); 215 216 - retval = slot->hpc_ops->get_attention_status(slot, value); 217 if (retval < 0) 218 *value = hotplug_slot->info->attention_status; 219 ··· 228 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 229 __func__, slot_name(slot)); 230 231 - retval = slot->hpc_ops->get_latch_status(slot, value); 232 if (retval < 0) 233 *value = hotplug_slot->info->latch_status; 234 ··· 243 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 244 __func__, slot_name(slot)); 245 246 - retval = slot->hpc_ops->get_adapter_status(slot, value); 247 if (retval < 0) 248 *value = hotplug_slot->info->adapter_status; 249 ··· 259 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 260 __func__, slot_name(slot)); 261 262 - retval = slot->hpc_ops->get_max_bus_speed(slot, value); 263 if (retval < 0) 264 *value = PCI_SPEED_UNKNOWN; 265 ··· 274 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 275 __func__, slot_name(slot)); 276 277 - retval = slot->hpc_ops->get_cur_bus_speed(slot, value); 278 if (retval < 0) 279 *value = PCI_SPEED_UNKNOWN; 280 ··· 285 { 286 int rc; 287 struct controller *ctrl; 288 - struct slot *t_slot; 289 u8 value; 290 struct pci_dev *pdev = dev->port; 291 ··· 304 set_service_data(dev, ctrl); 305 306 /* Setup the slot information structures */ 307 - rc = init_slots(ctrl); 308 if (rc) { 309 if (rc == -EBUSY) 310 ctrl_warn(ctrl, "Slot already registered by another " ··· 322 } 323 324 /* Check if slot is occupied */ 325 - t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 326 - t_slot->hpc_ops->get_adapter_status(t_slot, &value); 327 if (value) { 328 if (pciehp_force) 329 - pciehp_enable_slot(t_slot); 330 } else { 331 /* Power off slot if not occupied */ 332 if (POWER_CTRL(ctrl)) { 333 - rc = t_slot->hpc_ops->power_off_slot(t_slot); 334 if (rc) 335 goto err_out_free_ctrl_slot; 336 } ··· 339 return 0; 340 341 err_out_free_ctrl_slot: 342 - cleanup_slots(ctrl); 343 err_out_release_ctlr: 344 - ctrl->hpc_ops->release_ctlr(ctrl); 345 err_out_none: 346 return -ENODEV; 347 } 348 349 - static void pciehp_remove (struct pcie_device *dev) 350 { 351 struct controller *ctrl = get_service_data(dev); 352 353 - cleanup_slots(ctrl); 354 - ctrl->hpc_ops->release_ctlr(ctrl); 355 } 356 357 #ifdef CONFIG_PM ··· 366 dev_info(&dev->device, "%s ENTRY\n", __func__); 367 if (pciehp_force) { 368 struct controller *ctrl = get_service_data(dev); 369 - struct slot *t_slot; 370 u8 status; 371 372 /* reinitialize the chipset's event detection logic */ 373 pcie_enable_notification(ctrl); 374 375 - t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 376 377 /* Check if slot is occupied */ 378 - t_slot->hpc_ops->get_adapter_status(t_slot, &status); 379 if (status) 380 - pciehp_enable_slot(t_slot); 381 else 382 - pciehp_disable_slot(t_slot); 383 } 384 return 0; 385 }
··· 99 kfree(hotplug_slot); 100 } 101 102 + static int init_slot(struct controller *ctrl) 103 { 104 + struct slot *slot = ctrl->slot; 105 + struct hotplug_slot *hotplug = NULL; 106 + struct hotplug_slot_info *info = NULL; 107 char name[SLOT_NAME_SIZE]; 108 int retval = -ENOMEM; 109 110 + hotplug = kzalloc(sizeof(*hotplug), GFP_KERNEL); 111 + if (!hotplug) 112 + goto out; 113 114 + info = kzalloc(sizeof(*info), GFP_KERNEL); 115 + if (!info) 116 + goto out; 117 118 + /* register this slot with the hotplug pci core */ 119 + hotplug->info = info; 120 + hotplug->private = slot; 121 + hotplug->release = &release_slot; 122 + hotplug->ops = &pciehp_hotplug_slot_ops; 123 + slot->hotplug_slot = hotplug; 124 + snprintf(name, SLOT_NAME_SIZE, "%u", PSN(ctrl)); 125 126 + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 sun=%x\n", 127 + pci_domain_nr(ctrl->pcie->port->subordinate), 128 + ctrl->pcie->port->subordinate->number, PSN(ctrl)); 129 + retval = pci_hp_register(hotplug, 130 + ctrl->pcie->port->subordinate, 0, name); 131 + if (retval) { 132 + ctrl_err(ctrl, 133 + "pci_hp_register failed with error %d\n", retval); 134 + goto out; 135 } 136 + get_power_status(hotplug, &info->power_status); 137 + get_attention_status(hotplug, &info->attention_status); 138 + get_latch_status(hotplug, &info->latch_status); 139 + get_adapter_status(hotplug, &info->adapter_status); 140 + out: 141 + if (retval) { 142 + kfree(info); 143 + kfree(hotplug); 144 + } 145 return retval; 146 } 147 148 + static void cleanup_slot(struct controller *ctrl) 149 { 150 + pci_hp_deregister(ctrl->slot->hotplug_slot); 151 } 152 153 /* ··· 173 hotplug_slot->info->attention_status = status; 174 175 if (ATTN_LED(slot->ctrl)) 176 + pciehp_set_attention_status(slot, status); 177 178 return 0; 179 } ··· 208 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 209 __func__, slot_name(slot)); 210 211 + retval = pciehp_get_power_status(slot, value); 212 if (retval < 0) 213 *value = hotplug_slot->info->power_status; 214 ··· 223 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 224 __func__, slot_name(slot)); 225 226 + retval = pciehp_get_attention_status(slot, value); 227 if (retval < 0) 228 *value = hotplug_slot->info->attention_status; 229 ··· 238 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 239 __func__, slot_name(slot)); 240 241 + retval = pciehp_get_latch_status(slot, value); 242 if (retval < 0) 243 *value = hotplug_slot->info->latch_status; 244 ··· 253 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 254 __func__, slot_name(slot)); 255 256 + retval = pciehp_get_adapter_status(slot, value); 257 if (retval < 0) 258 *value = hotplug_slot->info->adapter_status; 259 ··· 269 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 270 __func__, slot_name(slot)); 271 272 + retval = pciehp_get_max_link_speed(slot, value); 273 if (retval < 0) 274 *value = PCI_SPEED_UNKNOWN; 275 ··· 284 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 285 __func__, slot_name(slot)); 286 287 + retval = pciehp_get_cur_link_speed(slot, value); 288 if (retval < 0) 289 *value = PCI_SPEED_UNKNOWN; 290 ··· 295 { 296 int rc; 297 struct controller *ctrl; 298 + struct slot *slot; 299 u8 value; 300 struct pci_dev *pdev = dev->port; 301 ··· 314 set_service_data(dev, ctrl); 315 316 /* Setup the slot information structures */ 317 + rc = init_slot(ctrl); 318 if (rc) { 319 if (rc == -EBUSY) 320 ctrl_warn(ctrl, "Slot already registered by another " ··· 332 } 333 334 /* Check if slot is occupied */ 335 + slot = ctrl->slot; 336 + pciehp_get_adapter_status(slot, &value); 337 if (value) { 338 if (pciehp_force) 339 + pciehp_enable_slot(slot); 340 } else { 341 /* Power off slot if not occupied */ 342 if (POWER_CTRL(ctrl)) { 343 + rc = pciehp_power_off_slot(slot); 344 if (rc) 345 goto err_out_free_ctrl_slot; 346 } ··· 349 return 0; 350 351 err_out_free_ctrl_slot: 352 + cleanup_slot(ctrl); 353 err_out_release_ctlr: 354 + pciehp_release_ctrl(ctrl); 355 err_out_none: 356 return -ENODEV; 357 } 358 359 + static void pciehp_remove(struct pcie_device *dev) 360 { 361 struct controller *ctrl = get_service_data(dev); 362 363 + cleanup_slot(ctrl); 364 + pciehp_release_ctrl(ctrl); 365 } 366 367 #ifdef CONFIG_PM ··· 376 dev_info(&dev->device, "%s ENTRY\n", __func__); 377 if (pciehp_force) { 378 struct controller *ctrl = get_service_data(dev); 379 + struct slot *slot; 380 u8 status; 381 382 /* reinitialize the chipset's event detection logic */ 383 pcie_enable_notification(ctrl); 384 385 + slot = ctrl->slot; 386 387 /* Check if slot is occupied */ 388 + pciehp_get_adapter_status(slot, &status); 389 if (status) 390 + pciehp_enable_slot(slot); 391 else 392 + pciehp_disable_slot(slot); 393 } 394 return 0; 395 }
+44 -65
drivers/pci/hotplug/pciehp_ctrl.c
··· 82 /* Switch Change */ 83 ctrl_dbg(ctrl, "Switch interrupt received\n"); 84 85 - p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 86 if (getstatus) { 87 /* 88 * Switch opened ··· 114 /* Switch is open, assume a presence change 115 * Save the presence state 116 */ 117 - p_slot->hpc_ops->get_adapter_status(p_slot, &presence_save); 118 if (presence_save) { 119 /* 120 * Card Present ··· 143 /* power fault */ 144 ctrl_dbg(ctrl, "Power fault interrupt received\n"); 145 146 - if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 147 /* 148 * power fault Cleared 149 */ ··· 172 { 173 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ 174 if (POWER_CTRL(ctrl)) { 175 - if (pslot->hpc_ops->power_off_slot(pslot)) { 176 ctrl_err(ctrl, 177 "Issue of Slot Power Off command failed\n"); 178 return; ··· 186 } 187 188 if (PWR_LED(ctrl)) 189 - pslot->hpc_ops->green_led_off(pslot); 190 191 if (ATTN_LED(ctrl)) { 192 - if (pslot->hpc_ops->set_attention_status(pslot, 1)) { 193 ctrl_err(ctrl, 194 "Issue of Set Attention Led command failed\n"); 195 return; ··· 208 { 209 int retval = 0; 210 struct controller *ctrl = p_slot->ctrl; 211 - struct pci_bus *parent = ctrl->pci_dev->subordinate; 212 - 213 - ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n", 214 - __func__, p_slot->device, ctrl->slot_device_offset, 215 - p_slot->hp_slot); 216 217 if (POWER_CTRL(ctrl)) { 218 /* Power on slot */ 219 - retval = p_slot->hpc_ops->power_on_slot(p_slot); 220 if (retval) 221 return retval; 222 } 223 224 if (PWR_LED(ctrl)) 225 - p_slot->hpc_ops->green_led_blink(p_slot); 226 227 /* Check link training status */ 228 - retval = p_slot->hpc_ops->check_lnk_status(ctrl); 229 if (retval) { 230 ctrl_err(ctrl, "Failed to check link status\n"); 231 set_slot_off(ctrl, p_slot); ··· 229 } 230 231 /* Check for a power fault */ 232 - if (p_slot->hpc_ops->query_power_fault(p_slot)) { 233 ctrl_dbg(ctrl, "Power fault detected\n"); 234 - retval = POWER_FAILURE; 235 goto err_exit; 236 } 237 238 retval = pciehp_configure_device(p_slot); 239 if (retval) { 240 - ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", 241 - pci_domain_nr(parent), p_slot->bus, p_slot->device); 242 goto err_exit; 243 } 244 245 if (PWR_LED(ctrl)) 246 - p_slot->hpc_ops->green_led_on(p_slot); 247 248 return 0; 249 ··· 265 if (retval) 266 return retval; 267 268 - ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, p_slot->hp_slot); 269 - 270 if (POWER_CTRL(ctrl)) { 271 /* power off slot */ 272 - retval = p_slot->hpc_ops->power_off_slot(p_slot); 273 if (retval) { 274 ctrl_err(ctrl, 275 "Issue of Slot Disable command failed\n"); ··· 281 msleep(1000); 282 } 283 284 if (PWR_LED(ctrl)) 285 - /* turn off Green LED */ 286 - p_slot->hpc_ops->green_led_off(p_slot); 287 288 return 0; 289 } ··· 311 case POWEROFF_STATE: 312 mutex_unlock(&p_slot->lock); 313 ctrl_dbg(p_slot->ctrl, 314 - "Disabling domain:bus:device=%04x:%02x:%02x\n", 315 - pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), 316 - p_slot->bus, p_slot->device); 317 pciehp_disable_slot(p_slot); 318 mutex_lock(&p_slot->lock); 319 p_slot->state = STATIC_STATE; 320 break; 321 case POWERON_STATE: 322 mutex_unlock(&p_slot->lock); 323 - if (pciehp_enable_slot(p_slot) && 324 - PWR_LED(p_slot->ctrl)) 325 - p_slot->hpc_ops->green_led_off(p_slot); 326 mutex_lock(&p_slot->lock); 327 p_slot->state = STATIC_STATE; 328 break; ··· 372 if (!info) 373 return -ENOMEM; 374 375 - slot->hpc_ops->get_power_status(slot, &(info->power_status)); 376 - slot->hpc_ops->get_attention_status(slot, &(info->attention_status)); 377 - slot->hpc_ops->get_latch_status(slot, &(info->latch_status)); 378 - slot->hpc_ops->get_adapter_status(slot, &(info->adapter_status)); 379 380 result = pci_hp_change_slot_info(slot->hotplug_slot, info); 381 kfree (info); ··· 392 393 switch (p_slot->state) { 394 case STATIC_STATE: 395 - p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 396 if (getstatus) { 397 p_slot->state = BLINKINGOFF_STATE; 398 ctrl_info(ctrl, ··· 406 } 407 /* blink green LED and turn off amber */ 408 if (PWR_LED(ctrl)) 409 - p_slot->hpc_ops->green_led_blink(p_slot); 410 if (ATTN_LED(ctrl)) 411 - p_slot->hpc_ops->set_attention_status(p_slot, 0); 412 413 schedule_delayed_work(&p_slot->work, 5*HZ); 414 break; ··· 423 cancel_delayed_work(&p_slot->work); 424 if (p_slot->state == BLINKINGOFF_STATE) { 425 if (PWR_LED(ctrl)) 426 - p_slot->hpc_ops->green_led_on(p_slot); 427 } else { 428 if (PWR_LED(ctrl)) 429 - p_slot->hpc_ops->green_led_off(p_slot); 430 } 431 if (ATTN_LED(ctrl)) 432 - p_slot->hpc_ops->set_attention_status(p_slot, 0); 433 ctrl_info(ctrl, "PCI slot #%s - action canceled " 434 "due to button press\n", slot_name(p_slot)); 435 p_slot->state = STATIC_STATE; ··· 467 info->p_slot = p_slot; 468 INIT_WORK(&info->work, pciehp_power_thread); 469 470 - p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 471 if (!getstatus) 472 p_slot->state = POWEROFF_STATE; 473 else ··· 491 if (!POWER_CTRL(ctrl)) 492 break; 493 if (ATTN_LED(ctrl)) 494 - p_slot->hpc_ops->set_attention_status(p_slot, 1); 495 if (PWR_LED(ctrl)) 496 - p_slot->hpc_ops->green_led_off(p_slot); 497 break; 498 case INT_PRESENCE_ON: 499 case INT_PRESENCE_OFF: ··· 518 int rc; 519 struct controller *ctrl = p_slot->ctrl; 520 521 - /* Check to see if (latch closed, card present, power off) */ 522 - mutex_lock(&p_slot->ctrl->crit_sect); 523 - 524 - rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 525 if (rc || !getstatus) { 526 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 527 - mutex_unlock(&p_slot->ctrl->crit_sect); 528 return -ENODEV; 529 } 530 if (MRL_SENS(p_slot->ctrl)) { 531 - rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 532 if (rc || getstatus) { 533 ctrl_info(ctrl, "Latch open on slot(%s)\n", 534 slot_name(p_slot)); 535 - mutex_unlock(&p_slot->ctrl->crit_sect); 536 return -ENODEV; 537 } 538 } 539 540 if (POWER_CTRL(p_slot->ctrl)) { 541 - rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 542 if (rc || getstatus) { 543 ctrl_info(ctrl, "Already enabled on slot(%s)\n", 544 slot_name(p_slot)); 545 - mutex_unlock(&p_slot->ctrl->crit_sect); 546 return -EINVAL; 547 } 548 } 549 550 - p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 551 552 rc = board_added(p_slot); 553 if (rc) { 554 - p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 555 } 556 557 update_slot_info(p_slot); 558 559 - mutex_unlock(&p_slot->ctrl->crit_sect); 560 return rc; 561 } 562 ··· 563 if (!p_slot->ctrl) 564 return 1; 565 566 - /* Check to see if (latch closed, card present, power on) */ 567 - mutex_lock(&p_slot->ctrl->crit_sect); 568 - 569 if (!HP_SUPR_RM(p_slot->ctrl)) { 570 - ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 571 if (ret || !getstatus) { 572 ctrl_info(ctrl, "No adapter on slot(%s)\n", 573 slot_name(p_slot)); 574 - mutex_unlock(&p_slot->ctrl->crit_sect); 575 return -ENODEV; 576 } 577 } 578 579 if (MRL_SENS(p_slot->ctrl)) { 580 - ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 581 if (ret || getstatus) { 582 ctrl_info(ctrl, "Latch open on slot(%s)\n", 583 slot_name(p_slot)); 584 - mutex_unlock(&p_slot->ctrl->crit_sect); 585 return -ENODEV; 586 } 587 } 588 589 if (POWER_CTRL(p_slot->ctrl)) { 590 - ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 591 if (ret || !getstatus) { 592 ctrl_info(ctrl, "Already disabled on slot(%s)\n", 593 slot_name(p_slot)); 594 - mutex_unlock(&p_slot->ctrl->crit_sect); 595 return -EINVAL; 596 } 597 } ··· 593 ret = remove_board(p_slot); 594 update_slot_info(p_slot); 595 596 - mutex_unlock(&p_slot->ctrl->crit_sect); 597 return ret; 598 } 599
··· 82 /* Switch Change */ 83 ctrl_dbg(ctrl, "Switch interrupt received\n"); 84 85 + pciehp_get_latch_status(p_slot, &getstatus); 86 if (getstatus) { 87 /* 88 * Switch opened ··· 114 /* Switch is open, assume a presence change 115 * Save the presence state 116 */ 117 + pciehp_get_adapter_status(p_slot, &presence_save); 118 if (presence_save) { 119 /* 120 * Card Present ··· 143 /* power fault */ 144 ctrl_dbg(ctrl, "Power fault interrupt received\n"); 145 146 + if (!pciehp_query_power_fault(p_slot)) { 147 /* 148 * power fault Cleared 149 */ ··· 172 { 173 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ 174 if (POWER_CTRL(ctrl)) { 175 + if (pciehp_power_off_slot(pslot)) { 176 ctrl_err(ctrl, 177 "Issue of Slot Power Off command failed\n"); 178 return; ··· 186 } 187 188 if (PWR_LED(ctrl)) 189 + pciehp_green_led_off(pslot); 190 191 if (ATTN_LED(ctrl)) { 192 + if (pciehp_set_attention_status(pslot, 1)) { 193 ctrl_err(ctrl, 194 "Issue of Set Attention Led command failed\n"); 195 return; ··· 208 { 209 int retval = 0; 210 struct controller *ctrl = p_slot->ctrl; 211 + struct pci_bus *parent = ctrl->pcie->port->subordinate; 212 213 if (POWER_CTRL(ctrl)) { 214 /* Power on slot */ 215 + retval = pciehp_power_on_slot(p_slot); 216 if (retval) 217 return retval; 218 } 219 220 if (PWR_LED(ctrl)) 221 + pciehp_green_led_blink(p_slot); 222 223 /* Check link training status */ 224 + retval = pciehp_check_link_status(ctrl); 225 if (retval) { 226 ctrl_err(ctrl, "Failed to check link status\n"); 227 set_slot_off(ctrl, p_slot); ··· 233 } 234 235 /* Check for a power fault */ 236 + if (pciehp_query_power_fault(p_slot)) { 237 ctrl_dbg(ctrl, "Power fault detected\n"); 238 + retval = -EIO; 239 goto err_exit; 240 } 241 242 retval = pciehp_configure_device(p_slot); 243 if (retval) { 244 + ctrl_err(ctrl, "Cannot add device at %04x:%02x:00\n", 245 + pci_domain_nr(parent), parent->number); 246 goto err_exit; 247 } 248 249 if (PWR_LED(ctrl)) 250 + pciehp_green_led_on(p_slot); 251 252 return 0; 253 ··· 269 if (retval) 270 return retval; 271 272 if (POWER_CTRL(ctrl)) { 273 /* power off slot */ 274 + retval = pciehp_power_off_slot(p_slot); 275 if (retval) { 276 ctrl_err(ctrl, 277 "Issue of Slot Disable command failed\n"); ··· 287 msleep(1000); 288 } 289 290 + /* turn off Green LED */ 291 if (PWR_LED(ctrl)) 292 + pciehp_green_led_off(p_slot); 293 294 return 0; 295 } ··· 317 case POWEROFF_STATE: 318 mutex_unlock(&p_slot->lock); 319 ctrl_dbg(p_slot->ctrl, 320 + "Disabling domain:bus:device=%04x:%02x:00\n", 321 + pci_domain_nr(p_slot->ctrl->pcie->port->subordinate), 322 + p_slot->ctrl->pcie->port->subordinate->number); 323 pciehp_disable_slot(p_slot); 324 mutex_lock(&p_slot->lock); 325 p_slot->state = STATIC_STATE; 326 break; 327 case POWERON_STATE: 328 mutex_unlock(&p_slot->lock); 329 + if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl)) 330 + pciehp_green_led_off(p_slot); 331 mutex_lock(&p_slot->lock); 332 p_slot->state = STATIC_STATE; 333 break; ··· 379 if (!info) 380 return -ENOMEM; 381 382 + pciehp_get_power_status(slot, &info->power_status); 383 + pciehp_get_attention_status(slot, &info->attention_status); 384 + pciehp_get_latch_status(slot, &info->latch_status); 385 + pciehp_get_adapter_status(slot, &info->adapter_status); 386 387 result = pci_hp_change_slot_info(slot->hotplug_slot, info); 388 kfree (info); ··· 399 400 switch (p_slot->state) { 401 case STATIC_STATE: 402 + pciehp_get_power_status(p_slot, &getstatus); 403 if (getstatus) { 404 p_slot->state = BLINKINGOFF_STATE; 405 ctrl_info(ctrl, ··· 413 } 414 /* blink green LED and turn off amber */ 415 if (PWR_LED(ctrl)) 416 + pciehp_green_led_blink(p_slot); 417 if (ATTN_LED(ctrl)) 418 + pciehp_set_attention_status(p_slot, 0); 419 420 schedule_delayed_work(&p_slot->work, 5*HZ); 421 break; ··· 430 cancel_delayed_work(&p_slot->work); 431 if (p_slot->state == BLINKINGOFF_STATE) { 432 if (PWR_LED(ctrl)) 433 + pciehp_green_led_on(p_slot); 434 } else { 435 if (PWR_LED(ctrl)) 436 + pciehp_green_led_off(p_slot); 437 } 438 if (ATTN_LED(ctrl)) 439 + pciehp_set_attention_status(p_slot, 0); 440 ctrl_info(ctrl, "PCI slot #%s - action canceled " 441 "due to button press\n", slot_name(p_slot)); 442 p_slot->state = STATIC_STATE; ··· 474 info->p_slot = p_slot; 475 INIT_WORK(&info->work, pciehp_power_thread); 476 477 + pciehp_get_adapter_status(p_slot, &getstatus); 478 if (!getstatus) 479 p_slot->state = POWEROFF_STATE; 480 else ··· 498 if (!POWER_CTRL(ctrl)) 499 break; 500 if (ATTN_LED(ctrl)) 501 + pciehp_set_attention_status(p_slot, 1); 502 if (PWR_LED(ctrl)) 503 + pciehp_green_led_off(p_slot); 504 break; 505 case INT_PRESENCE_ON: 506 case INT_PRESENCE_OFF: ··· 525 int rc; 526 struct controller *ctrl = p_slot->ctrl; 527 528 + rc = pciehp_get_adapter_status(p_slot, &getstatus); 529 if (rc || !getstatus) { 530 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 531 return -ENODEV; 532 } 533 if (MRL_SENS(p_slot->ctrl)) { 534 + rc = pciehp_get_latch_status(p_slot, &getstatus); 535 if (rc || getstatus) { 536 ctrl_info(ctrl, "Latch open on slot(%s)\n", 537 slot_name(p_slot)); 538 return -ENODEV; 539 } 540 } 541 542 if (POWER_CTRL(p_slot->ctrl)) { 543 + rc = pciehp_get_power_status(p_slot, &getstatus); 544 if (rc || getstatus) { 545 ctrl_info(ctrl, "Already enabled on slot(%s)\n", 546 slot_name(p_slot)); 547 return -EINVAL; 548 } 549 } 550 551 + pciehp_get_latch_status(p_slot, &getstatus); 552 553 rc = board_added(p_slot); 554 if (rc) { 555 + pciehp_get_latch_status(p_slot, &getstatus); 556 } 557 558 update_slot_info(p_slot); 559 560 return rc; 561 } 562 ··· 577 if (!p_slot->ctrl) 578 return 1; 579 580 if (!HP_SUPR_RM(p_slot->ctrl)) { 581 + ret = pciehp_get_adapter_status(p_slot, &getstatus); 582 if (ret || !getstatus) { 583 ctrl_info(ctrl, "No adapter on slot(%s)\n", 584 slot_name(p_slot)); 585 return -ENODEV; 586 } 587 } 588 589 if (MRL_SENS(p_slot->ctrl)) { 590 + ret = pciehp_get_latch_status(p_slot, &getstatus); 591 if (ret || getstatus) { 592 ctrl_info(ctrl, "Latch open on slot(%s)\n", 593 slot_name(p_slot)); 594 return -ENODEV; 595 } 596 } 597 598 if (POWER_CTRL(p_slot->ctrl)) { 599 + ret = pciehp_get_power_status(p_slot, &getstatus); 600 if (ret || !getstatus) { 601 ctrl_info(ctrl, "Already disabled on slot(%s)\n", 602 slot_name(p_slot)); 603 return -EINVAL; 604 } 605 } ··· 613 ret = remove_board(p_slot); 614 update_slot_info(p_slot); 615 616 return ret; 617 } 618
+32 -77
drivers/pci/hotplug/pciehp_hpc.c
··· 44 45 static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value) 46 { 47 - struct pci_dev *dev = ctrl->pci_dev; 48 return pci_read_config_word(dev, ctrl->cap_base + reg, value); 49 } 50 51 static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value) 52 { 53 - struct pci_dev *dev = ctrl->pci_dev; 54 return pci_read_config_dword(dev, ctrl->cap_base + reg, value); 55 } 56 57 static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value) 58 { 59 - struct pci_dev *dev = ctrl->pci_dev; 60 return pci_write_config_word(dev, ctrl->cap_base + reg, value); 61 } 62 63 static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value) 64 { 65 - struct pci_dev *dev = ctrl->pci_dev; 66 return pci_write_config_dword(dev, ctrl->cap_base + reg, value); 67 } 68 ··· 266 ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n"); 267 } 268 269 - static int hpc_check_lnk_status(struct controller *ctrl) 270 { 271 u16 lnk_status; 272 int retval = 0; ··· 305 return retval; 306 } 307 308 - static int hpc_get_attention_status(struct slot *slot, u8 *status) 309 { 310 struct controller *ctrl = slot->ctrl; 311 u16 slot_ctrl; ··· 344 return 0; 345 } 346 347 - static int hpc_get_power_status(struct slot *slot, u8 *status) 348 { 349 struct controller *ctrl = slot->ctrl; 350 u16 slot_ctrl; ··· 376 return retval; 377 } 378 379 - static int hpc_get_latch_status(struct slot *slot, u8 *status) 380 { 381 struct controller *ctrl = slot->ctrl; 382 u16 slot_status; ··· 392 return 0; 393 } 394 395 - static int hpc_get_adapter_status(struct slot *slot, u8 *status) 396 { 397 struct controller *ctrl = slot->ctrl; 398 u16 slot_status; ··· 408 return 0; 409 } 410 411 - static int hpc_query_power_fault(struct slot *slot) 412 { 413 struct controller *ctrl = slot->ctrl; 414 u16 slot_status; ··· 422 return !!(slot_status & PCI_EXP_SLTSTA_PFD); 423 } 424 425 - static int hpc_set_attention_status(struct slot *slot, u8 value) 426 { 427 struct controller *ctrl = slot->ctrl; 428 u16 slot_cmd; ··· 450 return rc; 451 } 452 453 - static void hpc_set_green_led_on(struct slot *slot) 454 { 455 struct controller *ctrl = slot->ctrl; 456 u16 slot_cmd; ··· 463 __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); 464 } 465 466 - static void hpc_set_green_led_off(struct slot *slot) 467 { 468 struct controller *ctrl = slot->ctrl; 469 u16 slot_cmd; ··· 476 __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); 477 } 478 479 - static void hpc_set_green_led_blink(struct slot *slot) 480 { 481 struct controller *ctrl = slot->ctrl; 482 u16 slot_cmd; ··· 489 __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); 490 } 491 492 - static int hpc_power_on_slot(struct slot * slot) 493 { 494 struct controller *ctrl = slot->ctrl; 495 u16 slot_cmd; 496 u16 cmd_mask; 497 u16 slot_status; 498 int retval = 0; 499 - 500 - ctrl_dbg(ctrl, "%s: slot->hp_slot %x\n", __func__, slot->hp_slot); 501 502 /* Clear sticky power-fault bit from previous power failures */ 503 retval = pciehp_readw(ctrl, PCI_EXP_SLTSTA, &slot_status); ··· 537 538 static inline int pcie_mask_bad_dllp(struct controller *ctrl) 539 { 540 - struct pci_dev *dev = ctrl->pci_dev; 541 int pos; 542 u32 reg; 543 ··· 554 555 static inline void pcie_unmask_bad_dllp(struct controller *ctrl) 556 { 557 - struct pci_dev *dev = ctrl->pci_dev; 558 u32 reg; 559 int pos; 560 ··· 568 pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg); 569 } 570 571 - static int hpc_power_off_slot(struct slot * slot) 572 { 573 struct controller *ctrl = slot->ctrl; 574 u16 slot_cmd; 575 u16 cmd_mask; 576 int retval = 0; 577 int changed; 578 - 579 - ctrl_dbg(ctrl, "%s: slot->hp_slot %x\n", __func__, slot->hp_slot); 580 581 /* 582 * Set Bad DLLP Mask bit in Correctable Error Mask ··· 610 static irqreturn_t pcie_isr(int irq, void *dev_id) 611 { 612 struct controller *ctrl = (struct controller *)dev_id; 613 u16 detected, intr_loc; 614 - struct slot *p_slot; 615 616 /* 617 * In order to guarantee that all interrupt events are ··· 652 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) 653 return IRQ_HANDLED; 654 655 - p_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 656 - 657 /* Check MRL Sensor Changed */ 658 if (intr_loc & PCI_EXP_SLTSTA_MRLSC) 659 - pciehp_handle_switch_change(p_slot); 660 661 /* Check Attention Button Pressed */ 662 if (intr_loc & PCI_EXP_SLTSTA_ABP) 663 - pciehp_handle_attention_button(p_slot); 664 665 /* Check Presence Detect Changed */ 666 if (intr_loc & PCI_EXP_SLTSTA_PDC) 667 - pciehp_handle_presence_change(p_slot); 668 669 /* Check Power Fault Detected */ 670 if ((intr_loc & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) { 671 ctrl->power_fault_detected = 1; 672 - pciehp_handle_power_fault(p_slot); 673 } 674 return IRQ_HANDLED; 675 } 676 677 - static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value) 678 { 679 struct controller *ctrl = slot->ctrl; 680 enum pcie_link_speed lnk_speed; ··· 703 return retval; 704 } 705 706 - static int hpc_get_max_lnk_width(struct slot *slot, 707 enum pcie_link_width *value) 708 { 709 struct controller *ctrl = slot->ctrl; ··· 753 return retval; 754 } 755 756 - static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value) 757 { 758 struct controller *ctrl = slot->ctrl; 759 enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN; ··· 785 return retval; 786 } 787 788 - static int hpc_get_cur_lnk_width(struct slot *slot, 789 enum pcie_link_width *value) 790 { 791 struct controller *ctrl = slot->ctrl; ··· 835 836 return retval; 837 } 838 - 839 - static void pcie_release_ctrl(struct controller *ctrl); 840 - static struct hpc_ops pciehp_hpc_ops = { 841 - .power_on_slot = hpc_power_on_slot, 842 - .power_off_slot = hpc_power_off_slot, 843 - .set_attention_status = hpc_set_attention_status, 844 - .get_power_status = hpc_get_power_status, 845 - .get_attention_status = hpc_get_attention_status, 846 - .get_latch_status = hpc_get_latch_status, 847 - .get_adapter_status = hpc_get_adapter_status, 848 - 849 - .get_max_bus_speed = hpc_get_max_lnk_speed, 850 - .get_cur_bus_speed = hpc_get_cur_lnk_speed, 851 - .get_max_lnk_width = hpc_get_max_lnk_width, 852 - .get_cur_lnk_width = hpc_get_cur_lnk_width, 853 - 854 - .query_power_fault = hpc_query_power_fault, 855 - .green_led_on = hpc_set_green_led_on, 856 - .green_led_off = hpc_set_green_led_off, 857 - .green_led_blink = hpc_set_green_led_blink, 858 - 859 - .release_ctlr = pcie_release_ctrl, 860 - .check_lnk_status = hpc_check_lnk_status, 861 - }; 862 863 int pcie_enable_notification(struct controller *ctrl) 864 { ··· 900 if (!slot) 901 return -ENOMEM; 902 903 - slot->hp_slot = 0; 904 slot->ctrl = ctrl; 905 - slot->bus = ctrl->pci_dev->subordinate->number; 906 - slot->device = ctrl->slot_device_offset + slot->hp_slot; 907 - slot->hpc_ops = ctrl->hpc_ops; 908 - slot->number = ctrl->first_slot; 909 mutex_init(&slot->lock); 910 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); 911 - list_add(&slot->slot_list, &ctrl->slot_list); 912 return 0; 913 } 914 915 static void pcie_cleanup_slot(struct controller *ctrl) 916 { 917 - struct slot *slot; 918 - slot = list_first_entry(&ctrl->slot_list, struct slot, slot_list); 919 - list_del(&slot->slot_list); 920 cancel_delayed_work(&slot->work); 921 flush_scheduled_work(); 922 flush_workqueue(pciehp_wq); ··· 920 { 921 int i; 922 u16 reg16; 923 - struct pci_dev *pdev = ctrl->pci_dev; 924 925 if (!pciehp_debug) 926 return; ··· 943 (unsigned long long)pci_resource_start(pdev, i)); 944 } 945 ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap); 946 - ctrl_info(ctrl, " Physical Slot Number : %d\n", ctrl->first_slot); 947 ctrl_info(ctrl, " Attention Button : %3s\n", 948 ATTN_BUTTN(ctrl) ? "yes" : "no"); 949 ctrl_info(ctrl, " Power Controller : %3s\n", ··· 977 dev_err(&dev->device, "%s: Out of memory\n", __func__); 978 goto abort; 979 } 980 - INIT_LIST_HEAD(&ctrl->slot_list); 981 - 982 ctrl->pcie = dev; 983 - ctrl->pci_dev = pdev; 984 ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); 985 if (!ctrl->cap_base) { 986 ctrl_err(ctrl, "Cannot find PCI Express capability\n"); ··· 989 } 990 991 ctrl->slot_cap = slot_cap; 992 - ctrl->first_slot = slot_cap >> 19; 993 - ctrl->slot_device_offset = 0; 994 - ctrl->num_slots = 1; 995 - ctrl->hpc_ops = &pciehp_hpc_ops; 996 - mutex_init(&ctrl->crit_sect); 997 mutex_init(&ctrl->ctrl_lock); 998 init_waitqueue_head(&ctrl->queue); 999 dbg_ctrl(ctrl); ··· 1044 return NULL; 1045 } 1046 1047 - void pcie_release_ctrl(struct controller *ctrl) 1048 { 1049 pcie_shutdown_notification(ctrl); 1050 pcie_cleanup_slot(ctrl);
··· 44 45 static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value) 46 { 47 + struct pci_dev *dev = ctrl->pcie->port; 48 return pci_read_config_word(dev, ctrl->cap_base + reg, value); 49 } 50 51 static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value) 52 { 53 + struct pci_dev *dev = ctrl->pcie->port; 54 return pci_read_config_dword(dev, ctrl->cap_base + reg, value); 55 } 56 57 static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value) 58 { 59 + struct pci_dev *dev = ctrl->pcie->port; 60 return pci_write_config_word(dev, ctrl->cap_base + reg, value); 61 } 62 63 static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value) 64 { 65 + struct pci_dev *dev = ctrl->pcie->port; 66 return pci_write_config_dword(dev, ctrl->cap_base + reg, value); 67 } 68 ··· 266 ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n"); 267 } 268 269 + int pciehp_check_link_status(struct controller *ctrl) 270 { 271 u16 lnk_status; 272 int retval = 0; ··· 305 return retval; 306 } 307 308 + int pciehp_get_attention_status(struct slot *slot, u8 *status) 309 { 310 struct controller *ctrl = slot->ctrl; 311 u16 slot_ctrl; ··· 344 return 0; 345 } 346 347 + int pciehp_get_power_status(struct slot *slot, u8 *status) 348 { 349 struct controller *ctrl = slot->ctrl; 350 u16 slot_ctrl; ··· 376 return retval; 377 } 378 379 + int pciehp_get_latch_status(struct slot *slot, u8 *status) 380 { 381 struct controller *ctrl = slot->ctrl; 382 u16 slot_status; ··· 392 return 0; 393 } 394 395 + int pciehp_get_adapter_status(struct slot *slot, u8 *status) 396 { 397 struct controller *ctrl = slot->ctrl; 398 u16 slot_status; ··· 408 return 0; 409 } 410 411 + int pciehp_query_power_fault(struct slot *slot) 412 { 413 struct controller *ctrl = slot->ctrl; 414 u16 slot_status; ··· 422 return !!(slot_status & PCI_EXP_SLTSTA_PFD); 423 } 424 425 + int pciehp_set_attention_status(struct slot *slot, u8 value) 426 { 427 struct controller *ctrl = slot->ctrl; 428 u16 slot_cmd; ··· 450 return rc; 451 } 452 453 + void pciehp_green_led_on(struct slot *slot) 454 { 455 struct controller *ctrl = slot->ctrl; 456 u16 slot_cmd; ··· 463 __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); 464 } 465 466 + void pciehp_green_led_off(struct slot *slot) 467 { 468 struct controller *ctrl = slot->ctrl; 469 u16 slot_cmd; ··· 476 __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); 477 } 478 479 + void pciehp_green_led_blink(struct slot *slot) 480 { 481 struct controller *ctrl = slot->ctrl; 482 u16 slot_cmd; ··· 489 __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); 490 } 491 492 + int pciehp_power_on_slot(struct slot * slot) 493 { 494 struct controller *ctrl = slot->ctrl; 495 u16 slot_cmd; 496 u16 cmd_mask; 497 u16 slot_status; 498 int retval = 0; 499 500 /* Clear sticky power-fault bit from previous power failures */ 501 retval = pciehp_readw(ctrl, PCI_EXP_SLTSTA, &slot_status); ··· 539 540 static inline int pcie_mask_bad_dllp(struct controller *ctrl) 541 { 542 + struct pci_dev *dev = ctrl->pcie->port; 543 int pos; 544 u32 reg; 545 ··· 556 557 static inline void pcie_unmask_bad_dllp(struct controller *ctrl) 558 { 559 + struct pci_dev *dev = ctrl->pcie->port; 560 u32 reg; 561 int pos; 562 ··· 570 pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg); 571 } 572 573 + int pciehp_power_off_slot(struct slot * slot) 574 { 575 struct controller *ctrl = slot->ctrl; 576 u16 slot_cmd; 577 u16 cmd_mask; 578 int retval = 0; 579 int changed; 580 581 /* 582 * Set Bad DLLP Mask bit in Correctable Error Mask ··· 614 static irqreturn_t pcie_isr(int irq, void *dev_id) 615 { 616 struct controller *ctrl = (struct controller *)dev_id; 617 + struct slot *slot = ctrl->slot; 618 u16 detected, intr_loc; 619 620 /* 621 * In order to guarantee that all interrupt events are ··· 656 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) 657 return IRQ_HANDLED; 658 659 /* Check MRL Sensor Changed */ 660 if (intr_loc & PCI_EXP_SLTSTA_MRLSC) 661 + pciehp_handle_switch_change(slot); 662 663 /* Check Attention Button Pressed */ 664 if (intr_loc & PCI_EXP_SLTSTA_ABP) 665 + pciehp_handle_attention_button(slot); 666 667 /* Check Presence Detect Changed */ 668 if (intr_loc & PCI_EXP_SLTSTA_PDC) 669 + pciehp_handle_presence_change(slot); 670 671 /* Check Power Fault Detected */ 672 if ((intr_loc & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) { 673 ctrl->power_fault_detected = 1; 674 + pciehp_handle_power_fault(slot); 675 } 676 return IRQ_HANDLED; 677 } 678 679 + int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value) 680 { 681 struct controller *ctrl = slot->ctrl; 682 enum pcie_link_speed lnk_speed; ··· 709 return retval; 710 } 711 712 + int pciehp_get_max_lnk_width(struct slot *slot, 713 enum pcie_link_width *value) 714 { 715 struct controller *ctrl = slot->ctrl; ··· 759 return retval; 760 } 761 762 + int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value) 763 { 764 struct controller *ctrl = slot->ctrl; 765 enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN; ··· 791 return retval; 792 } 793 794 + int pciehp_get_cur_lnk_width(struct slot *slot, 795 enum pcie_link_width *value) 796 { 797 struct controller *ctrl = slot->ctrl; ··· 841 842 return retval; 843 } 844 845 int pcie_enable_notification(struct controller *ctrl) 846 { ··· 930 if (!slot) 931 return -ENOMEM; 932 933 slot->ctrl = ctrl; 934 mutex_init(&slot->lock); 935 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); 936 + ctrl->slot = slot; 937 return 0; 938 } 939 940 static void pcie_cleanup_slot(struct controller *ctrl) 941 { 942 + struct slot *slot = ctrl->slot; 943 cancel_delayed_work(&slot->work); 944 flush_scheduled_work(); 945 flush_workqueue(pciehp_wq); ··· 957 { 958 int i; 959 u16 reg16; 960 + struct pci_dev *pdev = ctrl->pcie->port; 961 962 if (!pciehp_debug) 963 return; ··· 980 (unsigned long long)pci_resource_start(pdev, i)); 981 } 982 ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap); 983 + ctrl_info(ctrl, " Physical Slot Number : %d\n", PSN(ctrl)); 984 ctrl_info(ctrl, " Attention Button : %3s\n", 985 ATTN_BUTTN(ctrl) ? "yes" : "no"); 986 ctrl_info(ctrl, " Power Controller : %3s\n", ··· 1014 dev_err(&dev->device, "%s: Out of memory\n", __func__); 1015 goto abort; 1016 } 1017 ctrl->pcie = dev; 1018 ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); 1019 if (!ctrl->cap_base) { 1020 ctrl_err(ctrl, "Cannot find PCI Express capability\n"); ··· 1029 } 1030 1031 ctrl->slot_cap = slot_cap; 1032 mutex_init(&ctrl->ctrl_lock); 1033 init_waitqueue_head(&ctrl->queue); 1034 dbg_ctrl(ctrl); ··· 1089 return NULL; 1090 } 1091 1092 + void pciehp_release_ctrl(struct controller *ctrl) 1093 { 1094 pcie_shutdown_notification(ctrl); 1095 pcie_cleanup_slot(ctrl);
+11 -12
drivers/pci/hotplug/pciehp_pci.c
··· 63 int pciehp_configure_device(struct slot *p_slot) 64 { 65 struct pci_dev *dev; 66 - struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 67 int num, fn; 68 struct controller *ctrl = p_slot->ctrl; 69 70 - dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 71 if (dev) { 72 ctrl_err(ctrl, "Device %s already exists " 73 - "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), 74 - pci_domain_nr(parent), p_slot->bus, p_slot->device); 75 pci_dev_put(dev); 76 return -EINVAL; 77 } 78 79 - num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); 80 if (num == 0) { 81 ctrl_err(ctrl, "No new device found\n"); 82 return -ENODEV; 83 } 84 85 for (fn = 0; fn < 8; fn++) { 86 - dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); 87 if (!dev) 88 continue; 89 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { ··· 111 int j; 112 u8 bctl = 0; 113 u8 presence = 0; 114 - struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 115 u16 command; 116 struct controller *ctrl = p_slot->ctrl; 117 118 - ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", 119 - __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device); 120 - ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); 121 if (ret) 122 presence = 0; 123 124 for (j = 0; j < 8; j++) { 125 - struct pci_dev* temp = pci_get_slot(parent, 126 - (p_slot->device << 3) | j); 127 if (!temp) 128 continue; 129 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
··· 63 int pciehp_configure_device(struct slot *p_slot) 64 { 65 struct pci_dev *dev; 66 + struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate; 67 int num, fn; 68 struct controller *ctrl = p_slot->ctrl; 69 70 + dev = pci_get_slot(parent, PCI_DEVFN(0, 0)); 71 if (dev) { 72 ctrl_err(ctrl, "Device %s already exists " 73 + "at %04x:%02x:00, cannot hot-add\n", pci_name(dev), 74 + pci_domain_nr(parent), parent->number); 75 pci_dev_put(dev); 76 return -EINVAL; 77 } 78 79 + num = pci_scan_slot(parent, PCI_DEVFN(0, 0)); 80 if (num == 0) { 81 ctrl_err(ctrl, "No new device found\n"); 82 return -ENODEV; 83 } 84 85 for (fn = 0; fn < 8; fn++) { 86 + dev = pci_get_slot(parent, PCI_DEVFN(0, fn)); 87 if (!dev) 88 continue; 89 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { ··· 111 int j; 112 u8 bctl = 0; 113 u8 presence = 0; 114 + struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate; 115 u16 command; 116 struct controller *ctrl = p_slot->ctrl; 117 118 + ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n", 119 + __func__, pci_domain_nr(parent), parent->number); 120 + ret = pciehp_get_adapter_status(p_slot, &presence); 121 if (ret) 122 presence = 0; 123 124 for (j = 0; j < 8; j++) { 125 + struct pci_dev* temp = pci_get_slot(parent, PCI_DEVFN(0, j)); 126 if (!temp) 127 continue; 128 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
+2
drivers/pci/pcie/aer/aerdrv.c
··· 318 { 319 if (pcie_aer_disable) 320 return -ENXIO; 321 return pcie_port_service_register(&aerdriver); 322 } 323
··· 318 { 319 if (pcie_aer_disable) 320 return -ENXIO; 321 + if (!pci_msi_enabled()) 322 + return -ENXIO; 323 return pcie_port_service_register(&aerdriver); 324 } 325
-3
drivers/pci/pcie/aspm.c
··· 303 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); 304 pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, &reg32); 305 info->support = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10; 306 - /* 00b and 10b are defined as "Reserved". */ 307 - if (info->support == PCIE_LINK_STATE_L1) 308 - info->support = 0; 309 info->latency_encoding_l0s = (reg32 & PCI_EXP_LNKCAP_L0SEL) >> 12; 310 info->latency_encoding_l1 = (reg32 & PCI_EXP_LNKCAP_L1EL) >> 15; 311 pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
··· 303 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); 304 pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, &reg32); 305 info->support = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10; 306 info->latency_encoding_l0s = (reg32 & PCI_EXP_LNKCAP_L0SEL) >> 12; 307 info->latency_encoding_l1 = (reg32 & PCI_EXP_LNKCAP_L1EL) >> 15; 308 pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
+2 -1
include/linux/vgaarb.h
··· 1 /* 2 - * vgaarb.c 3 * 4 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> 5 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
··· 1 /* 2 + * The VGA aribiter manages VGA space routing and VGA resource decode to 3 + * allow multiple VGA devices to be used in a system in a safe way. 4 * 5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> 6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>