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