diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-05-17 12:33:12 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-05-17 12:33:12 -0700 |
commit | 468b33ff03bc265acda25ae8d4704210899c753f (patch) | |
tree | b2a95b32a406960c3f81f28940962dec1d9635ef /pci | |
parent | 7c5395a42608efa0065723c3a3cf52ca5a1e0d68 (diff) | |
download | patches-468b33ff03bc265acda25ae8d4704210899c753f.tar.gz |
pci hotplug patches added
Diffstat (limited to 'pci')
-rw-r--r-- | pci/pciehp-add-missing-pci_dev_put.patch | 36 | ||||
-rw-r--r-- | pci/pciehp-implement-get_address-callback.patch | 60 | ||||
-rw-r--r-- | pci/pciehp-replace-pci_find_slot-with-pci_get_slot.patch | 70 | ||||
-rw-r--r-- | pci/shpchp-cleanup-improper-info-messages.patch | 164 | ||||
-rw-r--r-- | pci/shpchp-cleanup-interrupt-handler.patch | 204 | ||||
-rw-r--r-- | pci/shpchp-cleanup-interrupt-polling-timer.patch | 105 | ||||
-rw-r--r-- | pci/shpchp-cleanup-shpc-commands.patch | 191 | ||||
-rw-r--r-- | pci/shpchp-remove-unnecessary-hpc_ctlr_handle-check.patch | 371 | ||||
-rw-r--r-- | pci/shpchp-remove-unused-hpc_evelnt_lock.patch | 50 |
9 files changed, 1251 insertions, 0 deletions
diff --git a/pci/pciehp-add-missing-pci_dev_put.patch b/pci/pciehp-add-missing-pci_dev_put.patch new file mode 100644 index 0000000000000..945982bf03828 --- /dev/null +++ b/pci/pciehp-add-missing-pci_dev_put.patch @@ -0,0 +1,36 @@ +From kaneshige.kenji@jp.fujitsu.com Thu May 11 19:26:26 2006 +Message-ID: <4463F1AB.10908@jp.fujitsu.com> +Date: Fri, 12 May 2006 11:23:39 +0900 +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com>, "Shah, Rajesh" <rajesh.shah@intel.com> +Subject: pciehp: Add missing pci_dev_put + +The PCIEHP driver leaks reference counter of pci_dev structures. This +patch adds missing pci_dev_put() calls to PCIEHP driver. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/pciehp_pci.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- gregkh-2.6.orig/drivers/pci/hotplug/pciehp_pci.c ++++ gregkh-2.6/drivers/pci/hotplug/pciehp_pci.c +@@ -225,6 +225,7 @@ int pciehp_configure_device(struct slot + if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { + err("Cannot hot-add display device %s\n", + pci_name(dev)); ++ pci_dev_put(dev); + continue; + } + if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || +@@ -232,6 +233,7 @@ int pciehp_configure_device(struct slot + pciehp_add_bridge(dev); + } + program_fw_provided_values(dev); ++ pci_dev_put(dev); + } + + pci_bus_assign_resources(parent); diff --git a/pci/pciehp-implement-get_address-callback.patch b/pci/pciehp-implement-get_address-callback.patch new file mode 100644 index 0000000000000..0e003a00f1106 --- /dev/null +++ b/pci/pciehp-implement-get_address-callback.patch @@ -0,0 +1,60 @@ +From kaneshige.kenji@jp.fujitsu.com Thu May 11 21:42:19 2006 +Message-ID: <44641191.9070300@jp.fujitsu.com> +Date: Fri, 12 May 2006 13:39:45 +0900 +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com>, "Shah, Rajesh" <rajesh.shah@intel.com> +Subject: pciehp: Implement get_address callback + +This patch implements .get_address callback of hotplug_slot_ops for +PCIEHP driver. With this patch, we can see bus address of hotplug +slots as follows: + + # cat /sys/bus/pci/slots/0010_0000/address + 0000:0a:00 + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- +--- + drivers/pci/hotplug/pciehp_core.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- gregkh-2.6.orig/drivers/pci/hotplug/pciehp_core.c ++++ gregkh-2.6/drivers/pci/hotplug/pciehp_core.c +@@ -69,6 +69,7 @@ static int get_power_status (struct hotp + static int get_attention_status (struct hotplug_slot *slot, u8 *value); + static int get_latch_status (struct hotplug_slot *slot, u8 *value); + static int get_adapter_status (struct hotplug_slot *slot, u8 *value); ++static int get_address (struct hotplug_slot *slot, u32 *value); + static int get_max_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value); + static int get_cur_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value); + +@@ -81,6 +82,7 @@ static struct hotplug_slot_ops pciehp_ho + .get_attention_status = get_attention_status, + .get_latch_status = get_latch_status, + .get_adapter_status = get_adapter_status, ++ .get_address = get_address, + .get_max_bus_speed = get_max_bus_speed, + .get_cur_bus_speed = get_cur_bus_speed, + }; +@@ -331,6 +333,18 @@ static int get_adapter_status(struct hot + return 0; + } + ++static int get_address(struct hotplug_slot *hotplug_slot, u32 *value) ++{ ++ struct slot *slot = hotplug_slot->private; ++ struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; ++ ++ dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); ++ ++ *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device; ++ ++ return 0; ++} ++ + static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value) + { + struct slot *slot = hotplug_slot->private; diff --git a/pci/pciehp-replace-pci_find_slot-with-pci_get_slot.patch b/pci/pciehp-replace-pci_find_slot-with-pci_get_slot.patch new file mode 100644 index 0000000000000..0b1bddbbba482 --- /dev/null +++ b/pci/pciehp-replace-pci_find_slot-with-pci_get_slot.patch @@ -0,0 +1,70 @@ +From kaneshige.kenji@jp.fujitsu.com Thu May 11 19:25:20 2006 +Message-ID: <4463F160.9040806@jp.fujitsu.com> +Date: Fri, 12 May 2006 11:22:24 +0900 +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com>, "Shah, Rajesh" <rajesh.shah@intel.com> +Subject: pciehp: Replace pci_find_slot() with pci_get_slot() + + +This patch replaces pci_find_slot() with pci_get_slot() in PCIEHP +driver. This patch enables PCI Express Hotplug on the system which has +multiple PCI domains. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/pciehp_pci.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/pciehp_pci.c ++++ gregkh-2.6/drivers/pci/hotplug/pciehp_pci.c +@@ -204,10 +204,11 @@ int pciehp_configure_device(struct slot + struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; + int num, fn; + +- dev = pci_find_slot(p_slot->bus, PCI_DEVFN(p_slot->device, 0)); ++ dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); + if (dev) { + err("Device %s already exists at %x:%x, cannot hot-add\n", + pci_name(dev), p_slot->bus, p_slot->device); ++ pci_dev_put(dev); + return -EINVAL; + } + +@@ -243,18 +244,20 @@ int pciehp_unconfigure_device(struct slo + int rc = 0; + int j; + u8 bctl = 0; ++ struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; + + dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, + p_slot->device); + + for (j=0; j<8 ; j++) { +- struct pci_dev* temp = pci_find_slot(p_slot->bus, ++ struct pci_dev* temp = pci_get_slot(parent, + (p_slot->device << 3) | j); + if (!temp) + continue; + if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { + err("Cannot remove display device %s\n", + pci_name(temp)); ++ pci_dev_put(temp); + continue; + } + if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { +@@ -262,10 +265,12 @@ int pciehp_unconfigure_device(struct slo + if (bctl & PCI_BRIDGE_CTL_VGA) { + err("Cannot remove display device %s\n", + pci_name(temp)); ++ pci_dev_put(temp); + continue; + } + } + pci_remove_bus_device(temp); ++ pci_dev_put(temp); + } + /* + * Some PCI Express root ports require fixup after hot-plug operation. diff --git a/pci/shpchp-cleanup-improper-info-messages.patch b/pci/shpchp-cleanup-improper-info-messages.patch new file mode 100644 index 0000000000000..76af0339b403e --- /dev/null +++ b/pci/shpchp-cleanup-improper-info-messages.patch @@ -0,0 +1,164 @@ +From pcihpd-discuss-admin@lists.sourceforge.net Thu May 11 19:17:11 2006 +Message-ID: <4463EF5E.1040502@jp.fujitsu.com> +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com> +Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Subject: shpchp: Cleanup improper info messages +Date: Fri, 12 May 2006 11:13:50 +0900 + +Current SHPCHP driver shows device number of slots in info messages, +but it is useless and should be replaced with slot name. + +This patch replaces the device number shown in the info messages with +the slot name. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/shpchp.h | 6 +++--- + drivers/pci/hotplug/shpchp_ctrl.c | 32 ++++++++++++++++---------------- + 2 files changed, 19 insertions(+), 19 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp.h ++++ gregkh-2.6/drivers/pci/hotplug/shpchp.h +@@ -168,9 +168,9 @@ struct controller { + * error Messages + */ + #define msg_initialization_err "Initialization failure, error=%d\n" +-#define msg_button_on "PCI slot #%d - powering on due to button press.\n" +-#define msg_button_off "PCI slot #%d - powering off due to button press.\n" +-#define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n" ++#define msg_button_on "PCI slot #%s - powering on due to button press.\n" ++#define msg_button_off "PCI slot #%s - powering off due to button press.\n" ++#define msg_button_cancel "PCI slot #%s - action canceled due to button press.\n" + + /* sysfs functions for the hotplug controller info */ + extern void shpchp_create_ctrl_files (struct controller *ctrl); +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_ctrl.c ++++ gregkh-2.6/drivers/pci/hotplug/shpchp_ctrl.c +@@ -72,7 +72,7 @@ u8 shpchp_handle_attention_button(u8 hp_ + /* + * Button pressed - See if need to TAKE ACTION!!! + */ +- info("Button pressed on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Button pressed on Slot(%s)\n", p_slot->name); + event_type = INT_BUTTON_PRESS; + + queue_interrupt_event(p_slot, event_type); +@@ -101,7 +101,7 @@ u8 shpchp_handle_switch_change(u8 hp_slo + /* + * Switch opened + */ +- info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Latch open on Slot(%s)\n", p_slot->name); + event_type = INT_SWITCH_OPEN; + if (p_slot->pwr_save && p_slot->presence_save) { + event_type = INT_POWER_FAULT; +@@ -111,7 +111,7 @@ u8 shpchp_handle_switch_change(u8 hp_slo + /* + * Switch closed + */ +- info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Latch close on Slot(%s)\n", p_slot->name); + event_type = INT_SWITCH_CLOSE; + } + +@@ -139,13 +139,13 @@ u8 shpchp_handle_presence_change(u8 hp_s + /* + * Card Present + */ +- info("Card present on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Card present on Slot(%s)\n", p_slot->name); + event_type = INT_PRESENCE_ON; + } else { + /* + * Not Present + */ +- info("Card not present on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Card not present on Slot(%s)\n", p_slot->name); + event_type = INT_PRESENCE_OFF; + } + +@@ -169,14 +169,14 @@ u8 shpchp_handle_power_fault(u8 hp_slot, + /* + * Power fault Cleared + */ +- info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Power fault cleared on Slot(%s)\n", p_slot->name); + p_slot->status = 0x00; + event_type = INT_POWER_FAULT_CLEAR; + } else { + /* + * Power fault + */ +- info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); ++ info("Power fault on Slot(%s)\n", p_slot->name); + event_type = INT_POWER_FAULT; + /* set power fault status for this board */ + p_slot->status = 0xFF; +@@ -496,10 +496,10 @@ static void handle_button_press_event(st + p_slot->hpc_ops->get_power_status(p_slot, &getstatus); + if (getstatus) { + p_slot->state = BLINKINGOFF_STATE; +- info(msg_button_off, p_slot->number); ++ info(msg_button_off, p_slot->name); + } else { + p_slot->state = BLINKINGON_STATE; +- info(msg_button_on, p_slot->number); ++ info(msg_button_on, p_slot->name); + } + /* blink green LED and turn off amber */ + p_slot->hpc_ops->green_led_blink(p_slot); +@@ -522,7 +522,7 @@ static void handle_button_press_event(st + else + p_slot->hpc_ops->green_led_off(p_slot); + p_slot->hpc_ops->set_attention_status(p_slot, 0); +- info(msg_button_cancel, p_slot->number); ++ info(msg_button_cancel, p_slot->name); + p_slot->state = STATIC_STATE; + break; + case POWEROFF_STATE: +@@ -575,17 +575,17 @@ static int shpchp_enable_slot (struct sl + mutex_lock(&p_slot->ctrl->crit_sect); + rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); + if (rc || !getstatus) { +- info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); ++ info("No adapter on slot(%s)\n", p_slot->name); + goto out; + } + rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); + if (rc || getstatus) { +- info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); ++ info("Latch open on slot(%s)\n", p_slot->name); + goto out; + } + rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); + if (rc || getstatus) { +- info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); ++ info("Already enabled on slot(%s)\n", p_slot->name); + goto out; + } + +@@ -634,17 +634,17 @@ static int shpchp_disable_slot (struct s + + rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); + if (rc || !getstatus) { +- info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); ++ info("No adapter on slot(%s)\n", p_slot->name); + goto out; + } + rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); + if (rc || getstatus) { +- info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); ++ info("Latch open on slot(%s)\n", p_slot->name); + goto out; + } + rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); + if (rc || !getstatus) { +- info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); ++ info("Already disabled slot(%s)\n", p_slot->name); + goto out; + } + diff --git a/pci/shpchp-cleanup-interrupt-handler.patch b/pci/shpchp-cleanup-interrupt-handler.patch new file mode 100644 index 0000000000000..888f6b27e112e --- /dev/null +++ b/pci/shpchp-cleanup-interrupt-handler.patch @@ -0,0 +1,204 @@ +From pcihpd-discuss-admin@lists.sourceforge.net Thu May 11 19:14:09 2006 +Message-ID: <4463EEB0.4050300@jp.fujitsu.com> +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com> +Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Subject: shpchp: Cleanup interrupt handler +Date: Fri, 12 May 2006 11:10:56 +0900 + +This patch cleans up the interrupt handler of shpchp driver. This +patch has no functional changes. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/shpchp_hpc.c | 123 +++++++++++++++++---------------------- + 1 file changed, 56 insertions(+), 67 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_hpc.c ++++ gregkh-2.6/drivers/pci/hotplug/shpchp_hpc.c +@@ -91,6 +91,12 @@ + #define ATTN_BUTTON 0x80000000 + + /* ++ * Interrupt Locator Register definitions ++ */ ++#define CMD_INTR_PENDING (1 << 0) ++#define SLOT_INTR_PENDING(i) (1 << (i + 1)) ++ ++/* + * Controller SERR-INT Register + */ + #define GLOBAL_INTR_MASK (1 << 0) +@@ -218,7 +224,7 @@ static spinlock_t list_lock; + + static atomic_t shpchp_num_controllers = ATOMIC_INIT(0); + +-static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs); ++static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs); + + static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds); + static int hpc_check_cmd_status(struct controller *ctrl); +@@ -279,7 +285,7 @@ static void int_poll_timeout(unsigned lo + } + + /* Poll for interrupt events. regs == NULL => polling */ +- shpc_isr( 0, (void *)php_ctlr, NULL ); ++ shpc_isr(0, php_ctlr->callback_instance_id, NULL ); + + init_timer(&php_ctlr->int_poll_timer); + if (!shpchp_poll_time) +@@ -875,103 +881,86 @@ static int hpc_set_bus_speed_mode(struct + return retval; + } + +-static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs) ++static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs) + { +- struct controller *ctrl = NULL; +- struct php_ctlr_state_s *php_ctlr; +- u8 schedule_flag = 0; +- u32 temp_dword, intr_loc, intr_loc2; ++ struct controller *ctrl = (struct controller *)dev_id; ++ struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle; ++ u32 serr_int, slot_reg, intr_loc, intr_loc2; + int hp_slot; + +- if (!dev_id) +- return IRQ_NONE; +- +- if (!shpchp_poll_mode) { +- ctrl = (struct controller *)dev_id; +- php_ctlr = ctrl->hpc_ctlr_handle; +- } else { +- php_ctlr = (struct php_ctlr_state_s *) dev_id; +- ctrl = (struct controller *)php_ctlr->callback_instance_id; +- } +- +- if (!ctrl) +- return IRQ_NONE; +- +- if (!php_ctlr || !php_ctlr->creg) +- return IRQ_NONE; +- + /* Check to see if it was our interrupt */ + intr_loc = shpc_readl(ctrl, INTR_LOC); +- + if (!intr_loc) + return IRQ_NONE; ++ + dbg("%s: intr_loc = %x\n",__FUNCTION__, intr_loc); + + if(!shpchp_poll_mode) { +- /* Mask Global Interrupt Mask - see implementation note on p. 139 */ +- /* of SHPC spec rev 1.0*/ +- temp_dword = shpc_readl(ctrl, SERR_INTR_ENABLE); +- temp_dword |= GLOBAL_INTR_MASK; +- temp_dword &= ~SERR_INTR_RSVDZ_MASK; +- shpc_writel(ctrl, SERR_INTR_ENABLE, temp_dword); ++ /* ++ * Mask Global Interrupt Mask - see implementation ++ * note on p. 139 of SHPC spec rev 1.0 ++ */ ++ serr_int = shpc_readl(ctrl, SERR_INTR_ENABLE); ++ serr_int |= GLOBAL_INTR_MASK; ++ serr_int &= ~SERR_INTR_RSVDZ_MASK; ++ shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); + + intr_loc2 = shpc_readl(ctrl, INTR_LOC); + dbg("%s: intr_loc2 = %x\n",__FUNCTION__, intr_loc2); + } + +- if (intr_loc & 0x0001) { ++ if (intr_loc & CMD_INTR_PENDING) { + /* + * Command Complete Interrupt Pending + * RO only - clear by writing 1 to the Command Completion + * Detect bit in Controller SERR-INT register + */ +- temp_dword = shpc_readl(ctrl, SERR_INTR_ENABLE); +- temp_dword &= ~SERR_INTR_RSVDZ_MASK; +- shpc_writel(ctrl, SERR_INTR_ENABLE, temp_dword); ++ serr_int = shpc_readl(ctrl, SERR_INTR_ENABLE); ++ serr_int &= ~SERR_INTR_RSVDZ_MASK; ++ shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); ++ + ctrl->cmd_busy = 0; + wake_up_interruptible(&ctrl->queue); + } + +- if ((intr_loc = (intr_loc >> 1)) == 0) ++ if (!(intr_loc & ~CMD_INTR_PENDING)) + goto out; + + for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { +- /* To find out which slot has interrupt pending */ +- if ((intr_loc >> hp_slot) & 0x01) { +- temp_dword = shpc_readl(ctrl, SLOT_REG(hp_slot)); +- dbg("%s: Slot %x with intr, slot register = %x\n", +- __FUNCTION__, hp_slot, temp_dword); +- if ((php_ctlr->switch_change_callback) && +- (temp_dword & MRL_CHANGE_DETECTED)) +- schedule_flag += php_ctlr->switch_change_callback( +- hp_slot, php_ctlr->callback_instance_id); +- if ((php_ctlr->attention_button_callback) && +- (temp_dword & BUTTON_PRESS_DETECTED)) +- schedule_flag += php_ctlr->attention_button_callback( +- hp_slot, php_ctlr->callback_instance_id); +- if ((php_ctlr->presence_change_callback) && +- (temp_dword & PRSNT_CHANGE_DETECTED)) +- schedule_flag += php_ctlr->presence_change_callback( +- hp_slot , php_ctlr->callback_instance_id); +- if ((php_ctlr->power_fault_callback) && +- (temp_dword & (ISO_PFAULT_DETECTED | CON_PFAULT_DETECTED))) +- schedule_flag += php_ctlr->power_fault_callback( +- hp_slot, php_ctlr->callback_instance_id); +- +- /* Clear all slot events */ +- temp_dword &= ~SLOT_REG_RSVDZ_MASK; +- shpc_writel(ctrl, SLOT_REG(hp_slot), temp_dword); ++ /* To find out which slot has interrupt pending */ ++ if (!(intr_loc & SLOT_INTR_PENDING(hp_slot))) ++ continue; + +- intr_loc2 = shpc_readl(ctrl, INTR_LOC); +- dbg("%s: intr_loc2 = %x\n",__FUNCTION__, intr_loc2); +- } ++ slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); ++ dbg("%s: Slot %x with intr, slot register = %x\n", ++ __FUNCTION__, hp_slot, slot_reg); ++ ++ if (slot_reg & MRL_CHANGE_DETECTED) ++ php_ctlr->switch_change_callback( ++ hp_slot, php_ctlr->callback_instance_id); ++ ++ if (slot_reg & BUTTON_PRESS_DETECTED) ++ php_ctlr->attention_button_callback( ++ hp_slot, php_ctlr->callback_instance_id); ++ ++ if (slot_reg & PRSNT_CHANGE_DETECTED) ++ php_ctlr->presence_change_callback( ++ hp_slot , php_ctlr->callback_instance_id); ++ ++ if (slot_reg & (ISO_PFAULT_DETECTED | CON_PFAULT_DETECTED)) ++ php_ctlr->power_fault_callback( ++ hp_slot, php_ctlr->callback_instance_id); ++ ++ /* Clear all slot events */ ++ slot_reg &= ~SLOT_REG_RSVDZ_MASK; ++ shpc_writel(ctrl, SLOT_REG(hp_slot), slot_reg); + } + out: + if (!shpchp_poll_mode) { + /* Unmask Global Interrupt Mask */ +- temp_dword = shpc_readl(ctrl, SERR_INTR_ENABLE); +- temp_dword &= ~(GLOBAL_INTR_MASK | SERR_INTR_RSVDZ_MASK); +- shpc_writel(ctrl, SERR_INTR_ENABLE, temp_dword); ++ serr_int = shpc_readl(ctrl, SERR_INTR_ENABLE); ++ serr_int &= ~(GLOBAL_INTR_MASK | SERR_INTR_RSVDZ_MASK); ++ shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); + } + + return IRQ_HANDLED; diff --git a/pci/shpchp-cleanup-interrupt-polling-timer.patch b/pci/shpchp-cleanup-interrupt-polling-timer.patch new file mode 100644 index 0000000000000..24c7e6ce04602 --- /dev/null +++ b/pci/shpchp-cleanup-interrupt-polling-timer.patch @@ -0,0 +1,105 @@ +From kaneshige.kenji@jp.fujitsu.com Thu May 11 19:15:59 2006 +Message-ID: <4463EF2E.4030906@jp.fujitsu.com> +Date: Fri, 12 May 2006 11:13:02 +0900 +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com> +CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Subject: shpchp: Cleanup interrupt polling timer + +This patch cleans up the interrupt polling timer code in +shpchp_hpc.c. This has no functional changes. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/shpchp_hpc.c | 61 +++++++++++++++++---------------------- + 1 file changed, 27 insertions(+), 34 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_hpc.c ++++ gregkh-2.6/drivers/pci/hotplug/shpchp_hpc.c +@@ -221,8 +221,7 @@ static spinlock_t list_lock; + static atomic_t shpchp_num_controllers = ATOMIC_INIT(0); + + static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs); +- +-static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds); ++static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int sec); + static int hpc_check_cmd_status(struct controller *ctrl); + + static inline u8 shpc_readb(struct controller *ctrl, int reg) +@@ -268,47 +267,41 @@ static inline int shpc_indirect_read(str + return pci_read_config_dword(pdev, cap_offset + DWORD_DATA, value); + } + +-/* This is the interrupt polling timeout function. */ ++/* ++ * This is the interrupt polling timeout function. ++ */ + static void int_poll_timeout(unsigned long lphp_ctlr) + { +- struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *)lphp_ctlr; +- +- DBG_ENTER_ROUTINE ++ struct php_ctlr_state_s *php_ctlr = ++ (struct php_ctlr_state_s *)lphp_ctlr; + +- if ( !php_ctlr ) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return; +- } ++ DBG_ENTER_ROUTINE + +- /* Poll for interrupt events. regs == NULL => polling */ +- shpc_isr(0, php_ctlr->callback_instance_id, NULL ); ++ /* Poll for interrupt events. regs == NULL => polling */ ++ shpc_isr(0, php_ctlr->callback_instance_id, NULL); + +- init_timer(&php_ctlr->int_poll_timer); ++ init_timer(&php_ctlr->int_poll_timer); + if (!shpchp_poll_time) +- shpchp_poll_time = 2; /* reset timer to poll in 2 secs if user doesn't specify at module installation*/ ++ shpchp_poll_time = 2; /* default polling interval is 2 sec */ + +- start_int_poll_timer(php_ctlr, shpchp_poll_time); +- +- return; +-} ++ start_int_poll_timer(php_ctlr, shpchp_poll_time); + +-/* This function starts the interrupt polling timer. */ +-static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds) +-{ +- if (!php_ctlr) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return; +- } +- +- if ( ( seconds <= 0 ) || ( seconds > 60 ) ) +- seconds = 2; /* Clamp to sane value */ +- +- php_ctlr->int_poll_timer.function = &int_poll_timeout; +- php_ctlr->int_poll_timer.data = (unsigned long)php_ctlr; /* Instance data */ +- php_ctlr->int_poll_timer.expires = jiffies + seconds * HZ; +- add_timer(&php_ctlr->int_poll_timer); ++ DBG_LEAVE_ROUTINE ++} + +- return; ++/* ++ * This function starts the interrupt polling timer. ++ */ ++static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int sec) ++{ ++ /* Clamp to sane value */ ++ if ((sec <= 0) || (sec > 60)) ++ sec = 2; ++ ++ php_ctlr->int_poll_timer.function = &int_poll_timeout; ++ php_ctlr->int_poll_timer.data = (unsigned long)php_ctlr; ++ php_ctlr->int_poll_timer.expires = jiffies + sec * HZ; ++ add_timer(&php_ctlr->int_poll_timer); + } + + static inline int shpc_wait_cmd(struct controller *ctrl) diff --git a/pci/shpchp-cleanup-shpc-commands.patch b/pci/shpchp-cleanup-shpc-commands.patch new file mode 100644 index 0000000000000..0f7016c566a29 --- /dev/null +++ b/pci/shpchp-cleanup-shpc-commands.patch @@ -0,0 +1,191 @@ +From kaneshige.kenji@jp.fujitsu.com Thu May 11 19:14:23 2006 +Message-ID: <4463EEE4.7080605@jp.fujitsu.com> +Date: Fri, 12 May 2006 11:11:48 +0900 +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com> +CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Subject: shpchp: Cleanup SHPC commands + +This patch cleans up the code related to issuing SHPC commands. This +patch has no functional changes. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/shpchp_hpc.c | 98 +++++++++++++++++++-------------------- + 1 file changed, 48 insertions(+), 50 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_hpc.c ++++ gregkh-2.6/drivers/pci/hotplug/shpchp_hpc.c +@@ -147,39 +147,37 @@ + #define CON_PFAULT_SERR_MASK (1 << 30) + #define SLOT_REG_RSVDZ_MASK (1 << 15) | (7 << 21) + +-/* SHPC 'write' operations/commands */ +- +-/* Slot operation - 0x00h to 0x3Fh */ +- +-#define NO_CHANGE 0x00 +- +-/* Slot state - Bits 0 & 1 of controller command register */ +-#define SET_SLOT_PWR 0x01 +-#define SET_SLOT_ENABLE 0x02 +-#define SET_SLOT_DISABLE 0x03 +- +-/* Power indicator state - Bits 2 & 3 of controller command register*/ +-#define SET_PWR_ON 0x04 +-#define SET_PWR_BLINK 0x08 +-#define SET_PWR_OFF 0x0C +- +-/* Attention indicator state - Bits 4 & 5 of controller command register*/ +-#define SET_ATTN_ON 0x010 +-#define SET_ATTN_BLINK 0x020 +-#define SET_ATTN_OFF 0x030 +- +-/* Set bus speed/mode A - 0x40h to 0x47h */ +-#define SETA_PCI_33MHZ 0x40 ++/* ++ * SHPC Command Code definitnions ++ * ++ * Slot Operation 00h - 3Fh ++ * Set Bus Segment Speed/Mode A 40h - 47h ++ * Power-Only All Slots 48h ++ * Enable All Slots 49h ++ * Set Bus Segment Speed/Mode B (PI=2) 50h - 5Fh ++ * Reserved Command Codes 60h - BFh ++ * Vendor Specific Commands C0h - FFh ++ */ ++#define SET_SLOT_PWR 0x01 /* Slot Operation */ ++#define SET_SLOT_ENABLE 0x02 ++#define SET_SLOT_DISABLE 0x03 ++#define SET_PWR_ON 0x04 ++#define SET_PWR_BLINK 0x08 ++#define SET_PWR_OFF 0x0c ++#define SET_ATTN_ON 0x10 ++#define SET_ATTN_BLINK 0x20 ++#define SET_ATTN_OFF 0x30 ++#define SETA_PCI_33MHZ 0x40 /* Set Bus Segment Speed/Mode A */ + #define SETA_PCI_66MHZ 0x41 + #define SETA_PCIX_66MHZ 0x42 + #define SETA_PCIX_100MHZ 0x43 + #define SETA_PCIX_133MHZ 0x44 +-#define RESERV_1 0x45 +-#define RESERV_2 0x46 +-#define RESERV_3 0x47 +- +-/* Set bus speed/mode B - 0x50h to 0x5fh */ +-#define SETB_PCI_33MHZ 0x50 ++#define SETA_RESERVED1 0x45 ++#define SETA_RESERVED2 0x46 ++#define SETA_RESERVED3 0x47 ++#define SET_PWR_ONLY_ALL 0x48 /* Power-Only All Slots */ ++#define SET_ENABLE_ALL 0x49 /* Enable All Slots */ ++#define SETB_PCI_33MHZ 0x50 /* Set Bus Segment Speed/Mode B */ + #define SETB_PCI_66MHZ 0x51 + #define SETB_PCIX_66MHZ_PM 0x52 + #define SETB_PCIX_100MHZ_PM 0x53 +@@ -193,23 +191,21 @@ + #define SETB_PCIX_66MHZ_533 0x5b + #define SETB_PCIX_100MHZ_533 0x5c + #define SETB_PCIX_133MHZ_533 0x5d ++#define SETB_RESERVED1 0x5e ++#define SETB_RESERVED2 0x5f + +- +-/* Power-on all slots - 0x48h */ +-#define SET_PWR_ON_ALL 0x48 +- +-/* Enable all slots - 0x49h */ +-#define SET_ENABLE_ALL 0x49 +- +-/* SHPC controller command error code */ ++/* ++ * SHPC controller command error code ++ */ + #define SWITCH_OPEN 0x1 + #define INVALID_CMD 0x2 + #define INVALID_SPEED_MODE 0x4 + +-/* For accessing SHPC Working Register Set */ ++/* ++ * For accessing SHPC Working Register Set via PCI Configuration Space ++ */ + #define DWORD_SELECT 0x2 + #define DWORD_DATA 0x4 +-#define BASE_OFFSET 0x0 + + /* Field Offset in Logical Slot Register - byte boundary */ + #define SLOT_EVENT_LATCH 0x2 +@@ -630,13 +626,13 @@ static int hpc_set_attention_status(stru + + switch (value) { + case 0 : +- slot_cmd = 0x30; /* OFF */ ++ slot_cmd = SET_ATTN_OFF; /* OFF */ + break; + case 1: +- slot_cmd = 0x10; /* ON */ ++ slot_cmd = SET_ATTN_ON; /* ON */ + break; + case 2: +- slot_cmd = 0x20; /* BLINK */ ++ slot_cmd = SET_ATTN_BLINK; /* BLINK */ + break; + default: + return -1; +@@ -648,17 +644,17 @@ static int hpc_set_attention_status(stru + + static void hpc_set_green_led_on(struct slot *slot) + { +- shpc_write_cmd(slot, slot->hp_slot, 0x04); ++ shpc_write_cmd(slot, slot->hp_slot, SET_PWR_ON); + } + + static void hpc_set_green_led_off(struct slot *slot) + { +- shpc_write_cmd(slot, slot->hp_slot, 0x0c); ++ shpc_write_cmd(slot, slot->hp_slot, SET_PWR_OFF); + } + + static void hpc_set_green_led_blink(struct slot *slot) + { +- shpc_write_cmd(slot, slot->hp_slot, 0x08); ++ shpc_write_cmd(slot, slot->hp_slot, SET_PWR_BLINK); + } + + int shpc_get_ctlr_slot_config(struct controller *ctrl, +@@ -769,7 +765,7 @@ static int hpc_power_on_slot(struct slot + + DBG_ENTER_ROUTINE + +- retval = shpc_write_cmd(slot, slot->hp_slot, 0x01); ++ retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR); + if (retval) { + err("%s: Write command failed!\n", __FUNCTION__); + return retval; +@@ -786,8 +782,9 @@ static int hpc_slot_enable(struct slot * + + DBG_ENTER_ROUTINE + +- /* 3A => Slot - Enable, Power Indicator - Blink, Attention Indicator - Off */ +- retval = shpc_write_cmd(slot, slot->hp_slot, 0x3a); ++ /* Slot - Enable, Power Indicator - Blink, Attention Indicator - Off */ ++ retval = shpc_write_cmd(slot, slot->hp_slot, ++ SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF); + if (retval) { + err("%s: Write command failed!\n", __FUNCTION__); + return retval; +@@ -803,8 +800,9 @@ static int hpc_slot_disable(struct slot + + DBG_ENTER_ROUTINE + +- /* 1F => Slot - Disable, Power Indicator - Off, Attention Indicator - On */ +- retval = shpc_write_cmd(slot, slot->hp_slot, 0x1f); ++ /* Slot - Disable, Power Indicator - Off, Attention Indicator - On */ ++ retval = shpc_write_cmd(slot, slot->hp_slot, ++ SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON); + if (retval) { + err("%s: Write command failed!\n", __FUNCTION__); + return retval; diff --git a/pci/shpchp-remove-unnecessary-hpc_ctlr_handle-check.patch b/pci/shpchp-remove-unnecessary-hpc_ctlr_handle-check.patch new file mode 100644 index 0000000000000..a10b142111694 --- /dev/null +++ b/pci/shpchp-remove-unnecessary-hpc_ctlr_handle-check.patch @@ -0,0 +1,371 @@ +From kaneshige.kenji@jp.fujitsu.com Thu May 11 19:08:56 2006 +Message-ID: <4463ED87.6050108@jp.fujitsu.com> +Date: Fri, 12 May 2006 11:05:59 +0900 +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com> +Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Subject: shpchp: Remove unnecessary hpc_ctlr_handle check + +This patch removes unnecessary error check for hpc_ctlr_handle. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/shpchp_hpc.c | 197 +++------------------------------------ + 1 file changed, 16 insertions(+), 181 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_hpc.c ++++ gregkh-2.6/drivers/pci/hotplug/shpchp_hpc.c +@@ -330,7 +330,6 @@ static inline int shpc_wait_cmd(struct c + + static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; + struct controller *ctrl = slot->ctrl; + u16 cmd_status; + int retval = 0; +@@ -341,12 +340,6 @@ static int shpc_write_cmd(struct slot *s + + mutex_lock(&slot->ctrl->cmd_lock); + +- if (!php_ctlr) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- retval = -EINVAL; +- goto out; +- } +- + for (i = 0; i < 10; i++) { + cmd_status = shpc_readw(ctrl, CMD_STATUS); + +@@ -401,11 +394,6 @@ static int hpc_check_cmd_status(struct c + int retval = 0; + + DBG_ENTER_ROUTINE +- +- if (!ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } + + cmd_status = shpc_readw(ctrl, CMD_STATUS) & 0x000F; + +@@ -442,11 +430,6 @@ static int hpc_get_attention_status(stru + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); + state = (slot_reg & ATN_LED_STATE_MASK) >> ATN_LED_STATE_SHIFT; + +@@ -477,11 +460,6 @@ static int hpc_get_power_status(struct s + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); + state = (slot_reg & SLOT_STATE_MASK) >> SLOT_STATE_SHIFT; + +@@ -512,11 +490,6 @@ static int hpc_get_latch_status(struct s + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); + *status = !!(slot_reg & MRL_SENSOR); /* 0 -> close; 1 -> open */ + +@@ -532,11 +505,6 @@ static int hpc_get_adapter_status(struct + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); + state = (slot_reg & PRSNT_MASK) >> PRSNT_SHIFT; + *status = (state != 0x3) ? 1 : 0; +@@ -550,11 +518,6 @@ static int hpc_get_prog_int(struct slot + struct controller *ctrl = slot->ctrl; + + DBG_ENTER_ROUTINE +- +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } + + *prog_int = shpc_readb(ctrl, PROG_INTERFACE); + +@@ -626,11 +589,6 @@ static int hpc_get_mode1_ECC_cap(struct + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + pi = shpc_readb(ctrl, PROG_INTERFACE); + sec_bus_status = shpc_readw(ctrl, SEC_BUS_CONFIG); + +@@ -653,11 +611,6 @@ static int hpc_query_power_fault(struct + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); + + DBG_LEAVE_ROUTINE +@@ -667,19 +620,7 @@ static int hpc_query_power_fault(struct + + static int hpc_set_attention_status(struct slot *slot, u8 value) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; + u8 slot_cmd = 0; +- int rc = 0; +- +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return -1; +- } + + switch (value) { + case 0 : +@@ -695,76 +636,23 @@ static int hpc_set_attention_status(stru + return -1; + } + +- shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- +- return rc; ++ return shpc_write_cmd(slot, slot->hp_slot, slot_cmd); + } + + + static void hpc_set_green_led_on(struct slot *slot) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; +- u8 slot_cmd; +- +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return ; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return ; +- } +- +- slot_cmd = 0x04; +- +- shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- +- return; ++ shpc_write_cmd(slot, slot->hp_slot, 0x04); + } + + static void hpc_set_green_led_off(struct slot *slot) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; +- u8 slot_cmd; +- +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return ; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return ; +- } +- +- slot_cmd = 0x0C; +- +- shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- +- return; ++ shpc_write_cmd(slot, slot->hp_slot, 0x0c); + } + + static void hpc_set_green_led_blink(struct slot *slot) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; +- u8 slot_cmd; +- +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return ; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return ; +- } +- +- slot_cmd = 0x08; +- +- shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- +- return; ++ shpc_write_cmd(slot, slot->hp_slot, 0x08); + } + + int shpc_get_ctlr_slot_config(struct controller *ctrl, +@@ -778,11 +666,6 @@ int shpc_get_ctlr_slot_config(struct con + + DBG_ENTER_ROUTINE + +- if (!ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- + slot_config = shpc_readl(ctrl, SLOT_CONFIG); + *first_device_num = (slot_config & FIRST_DEV_NUM) >> 8; + *num_ctlr_slots = slot_config & SLOT_NUM; +@@ -804,11 +687,6 @@ static void hpc_release_ctlr(struct cont + + DBG_ENTER_ROUTINE + +- if (!ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return ; +- } +- + /* + * Mask event interrupts and SERRs of all slots + */ +@@ -881,96 +759,53 @@ DBG_LEAVE_ROUTINE + + static int hpc_power_on_slot(struct slot * slot) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; +- u8 slot_cmd; +- int retval = 0; ++ int retval; + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return -1; +- } +- slot_cmd = 0x01; +- +- retval = shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- ++ retval = shpc_write_cmd(slot, slot->hp_slot, 0x01); + if (retval) { + err("%s: Write command failed!\n", __FUNCTION__); +- return -1; ++ return retval; + } + + DBG_LEAVE_ROUTINE + +- return retval; ++ return 0; + } + + static int hpc_slot_enable(struct slot * slot) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; +- u8 slot_cmd; +- int retval = 0; ++ int retval; + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return -1; +- } + /* 3A => Slot - Enable, Power Indicator - Blink, Attention Indicator - Off */ +- slot_cmd = 0x3A; +- +- retval = shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- ++ retval = shpc_write_cmd(slot, slot->hp_slot, 0x3a); + if (retval) { + err("%s: Write command failed!\n", __FUNCTION__); +- return -1; ++ return retval; + } + + DBG_LEAVE_ROUTINE +- return retval; ++ return 0; + } + + static int hpc_slot_disable(struct slot * slot) + { +- struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; +- u8 slot_cmd; +- int retval = 0; ++ int retval; + + DBG_ENTER_ROUTINE + +- if (!slot->ctrl->hpc_ctlr_handle) { +- err("%s: Invalid HPC controller handle!\n", __FUNCTION__); +- return -1; +- } +- +- if (slot->hp_slot >= php_ctlr->num_slots) { +- err("%s: Invalid HPC slot number!\n", __FUNCTION__); +- return -1; +- } +- + /* 1F => Slot - Disable, Power Indicator - Off, Attention Indicator - On */ +- slot_cmd = 0x1F; +- +- retval = shpc_write_cmd(slot, slot->hp_slot, slot_cmd); +- ++ retval = shpc_write_cmd(slot, slot->hp_slot, 0x1f); + if (retval) { + err("%s: Write command failed!\n", __FUNCTION__); +- return -1; ++ return retval; + } + + DBG_LEAVE_ROUTINE +- return retval; ++ return 0; + } + + static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) diff --git a/pci/shpchp-remove-unused-hpc_evelnt_lock.patch b/pci/shpchp-remove-unused-hpc_evelnt_lock.patch new file mode 100644 index 0000000000000..5ee26de82f0c4 --- /dev/null +++ b/pci/shpchp-remove-unused-hpc_evelnt_lock.patch @@ -0,0 +1,50 @@ +From pcihpd-discuss-admin@lists.sourceforge.net Thu May 11 19:16:08 2006 +Message-ID: <4463EF07.6020904@jp.fujitsu.com> +From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Greg KH <greg@kroah.com>, Greg KH <gregkh@suse.de>, Kristen Accardi <kristen.c.accardi@intel.com> +Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Subject: shpchp: Remove Unused hpc_evelnt_lock +Date: Fri, 12 May 2006 11:12:23 +0900 + +This patch removes unused hpc_event_lock. This patch has no functional +change. + +Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +Cc: Kristen Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/hotplug/shpchp_hpc.c | 8 -------- + 1 file changed, 8 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_hpc.c ++++ gregkh-2.6/drivers/pci/hotplug/shpchp_hpc.c +@@ -211,8 +211,6 @@ + #define SLOT_EVENT_LATCH 0x2 + #define SLOT_SERR_INT_MASK 0x3 + +-static spinlock_t hpc_event_lock; +- + DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ + static struct php_ctlr_state_s *php_ctlr_list_head; /* HPC state linked list */ + static int ctlr_seq_num = 0; /* Controller sequenc # */ +@@ -1105,7 +1103,6 @@ int shpc_init(struct controller * ctrl, + void *instance_id = ctrl; + int rc, num_slots = 0; + u8 hp_slot; +- static int first = 1; + u32 shpc_base_offset; + u32 tempdword, slot_reg, slot_config; + u8 i; +@@ -1167,11 +1164,6 @@ int shpc_init(struct controller * ctrl, + ctrl->mmio_size = 0x24 + 0x4 * num_slots; + } + +- if (first) { +- spin_lock_init(&hpc_event_lock); +- first = 0; +- } +- + info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, + pdev->subsystem_device); + |