Re: [BISECTED] pata_jmicron: no drives found on post 2.6.25 kernels

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Shaohua Li
Date: Wednesday, May 21, 2008 - 1:58 am

On Tue, 2008-05-20 at 19:09 +0300, Plamen Petrov wrote:
Can you please try below patch?
The Slot 03:00.* of JMicron controller has two functions, but one is
PCIE endpoint the other isn't PCIE device, very strange. PCIE spec
defines all functions should have the same config for ASPM, so disable
ASPM for the whole slot in this case.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

Index: linux/drivers/pci/pcie/aspm.c
===================================================================
--- linux.orig/drivers/pci/pcie/aspm.c	2008-05-21 16:38:17.000000000 +0800
+++ linux/drivers/pci/pcie/aspm.c	2008-05-21 16:52:35.000000000 +0800
@@ -506,6 +506,23 @@ static void free_link_state(struct pci_d
 	pdev->link_state = NULL;
 }
 
+static int pcie_aspm_sanity_check(struct pci_dev *pdev)
+{
+	struct pci_dev *child_dev;
+	int child_pos;
+
+	/*
+	 * Some functions in a slot might not all be PCIE functions, very
+	 * strange. Disable ASPM for the whole slot
+	 */
+	list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
+		child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
+		if (!child_pos)
+			return -EINVAL;
+	}
+	return 0;
+}
+
 /*
  * pcie_aspm_init_link_state: Initiate PCI express link state.
  * It is called after the pcie and its children devices are scaned.
@@ -526,6 +543,9 @@ void pcie_aspm_init_link_state(struct pc
 	if (list_empty(&pdev->subordinate->devices))
 		goto out;
 
+	if (pcie_aspm_sanity_check(pdev))
+		goto out;
+
 	mutex_lock(&aspm_lock);
 
 	link_state = kzalloc(sizeof(*link_state), GFP_KERNEL);


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [BISECTED] pata_jmicron: no drives found on post 2.6.2 ..., Shaohua Li, (Wed May 21, 1:58 am)