All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
	linux-usb-devel@lists.sourceforge.net, rajesh.shah@intel.com
Subject: [patch 10/22] PCI Express Hotplug: clear sticky power-fault bit
Date: Wed, 23 Nov 2005 15:44:54 -0800	[thread overview]
Message-ID: <20051123234454.GK527@kroah.com> (raw)
In-Reply-To: <20051123234335.GA527@kroah.com>

[-- Attachment #1: pci-express-hotplug-clear-sticky-power-fault-bit.patch --]
[-- Type: text/plain, Size: 3310 bytes --]

From: Rajesh Shah <rajesh.shah@intel.com>


Per the PCI Express spec, the power-fault-detected bit in the
slot status register can be set anytime hardware detects a power
fault, regardless of whether the slot has a device populated in
it or not. This bit is sticky and must be explicitly cleared.
This patch is needed to allow hot-add after such a power fault
has been detected.

Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/pci/hotplug/pciehp.h      |    1 -
 drivers/pci/hotplug/pciehp_ctrl.c |   15 ++-------------
 drivers/pci/hotplug/pciehp_hpc.c  |   10 +++++++++-
 3 files changed, 11 insertions(+), 15 deletions(-)

--- usb-2.6.orig/drivers/pci/hotplug/pciehp.h
+++ usb-2.6/drivers/pci/hotplug/pciehp.h
@@ -59,7 +59,6 @@ struct slot {
 	struct slot *next;
 	u8 bus;
 	u8 device;
-	u16 status;
 	u32 number;
 	u8 state;
 	struct timer_list task_event;
--- usb-2.6.orig/drivers/pci/hotplug/pciehp_ctrl.c
+++ usb-2.6/drivers/pci/hotplug/pciehp_ctrl.c
@@ -207,7 +207,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot,
 		 * power fault Cleared
 		 */
 		info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot);
-		p_slot->status = 0x00;
 		taskInfo->event_type = INT_POWER_FAULT_CLEAR;
 	} else {
 		/*
@@ -215,8 +214,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot,
 		 */
 		info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot);
 		taskInfo->event_type = INT_POWER_FAULT;
-		/* set power fault status for this board */
-		p_slot->status = 0xFF;
 		info("power fault bit %x set\n", hp_slot);
 	}
 	if (rc)
@@ -317,13 +314,10 @@ static int board_added(struct slot *p_sl
 		return rc;
 	}
 
-	dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status);
-
 	/* Check for a power fault */
-	if (p_slot->status == 0xFF) {
-		/* power fault occurred, but it was benign */
+	if (p_slot->hpc_ops->query_power_fault(p_slot)) {
+		dbg("%s: power fault detected\n", __FUNCTION__);
 		rc = POWER_FAILURE;
-		p_slot->status = 0;
 		goto err_exit;
 	}
 
@@ -334,8 +328,6 @@ static int board_added(struct slot *p_sl
 		goto err_exit;
 	}
 
-	p_slot->status = 0;
-
 	/*
 	 * Some PCI Express root ports require fixup after hot-plug operation.
 	 */
@@ -382,9 +374,6 @@ static int remove_board(struct slot *p_s
 
 	dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot);
 
-	/* Change status to shutdown */
-	p_slot->status = 0x01;
-
 	/* Wait for exclusive access to hardware */
 	down(&ctrl->crit_sect);
 
--- usb-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ usb-2.6/drivers/pci/hotplug/pciehp_hpc.c
@@ -750,7 +750,7 @@ static int hpc_power_on_slot(struct slot
 {
 	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd;
-	u16 slot_ctrl;
+	u16 slot_ctrl, slot_status;
 
 	int retval = 0;
 
@@ -767,6 +767,14 @@ static int hpc_power_on_slot(struct slot
 		return -1;
 	}
 
+	/* Clear sticky power-fault bit from previous power failures */
+	hp_register_read_word(php_ctlr->pci_dev,
+			SLOT_STATUS(slot->ctrl->cap_base), slot_status);
+	slot_status &= PWR_FAULT_DETECTED;
+	if (slot_status)
+		hp_register_write_word(php_ctlr->pci_dev,
+			SLOT_STATUS(slot->ctrl->cap_base), slot_status);
+
 	retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), slot_ctrl);
 
 	if (retval) {

--

  parent reply	other threads:[~2005-11-23 23:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20051123225156.624397000@press.kroah.org>
2005-11-23 23:43 ` [patch 00/22] PCI, USB and hwmon patches for 2.6.15-rc2-git Greg Kroah-Hartman
2005-11-23 23:43   ` [patch 01/22] Small fixes to driver core Greg Kroah-Hartman
2005-11-23 23:43   ` [patch 02/22] MTD git tree location added to MAINTAINERS Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 03/22] Clarify T: field in MAINTAINERS Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 04/22] Add more SCM trees to MAINTAINERS Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 05/22] hwmon: Fix missing boundary check when setting W83627THF in0 limits Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 06/22] hwmon: Fix lm78 VID conversion Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 07/22] hwmon: Fix missing it87 fan div init Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 08/22] hwmon: hdaps missing an axis Greg Kroah-Hartman
2005-11-23 23:44   ` [patch 09/22] PCI: trivial printk updates in common.c Greg Kroah-Hartman
2005-11-23 23:44   ` Greg Kroah-Hartman [this message]
2005-11-23 23:44   ` [patch 11/22] PCI: remove bogus resource collision error Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 12/22] PCI: kernel-doc fix for pci-acpi.c Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 13/22] PCI: direct.c: DBG Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 14/22] USB: SN9C10x driver - bad page state fix Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 15/22] USB: ftdi_sio: new IDs for KOBIL devices Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 16/22] USB: EHCI updates Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 17/22] USB: EHCI updates mostly whitespace cleanups Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 18/22] USB: EHCI updates split init/reinit logic for resume Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 19/22] USB: ohci, move ppc asic tweaks nearer pci Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 20/22] USB: fix USB key generates ioctl_internal_command errors issue Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 21/22] USB: kernel-doc for linux/usb.h Greg Kroah-Hartman
2005-11-23 23:45   ` [patch 22/22] usb serial: remove redundant include Greg Kroah-Hartman
2005-11-24  0:01   ` [patch 00/22] PCI, USB and hwmon patches for 2.6.15-rc2-git Linus Torvalds
2005-11-24  0:57     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051123234454.GK527@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=rajesh.shah@intel.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.