diff mbox

Ultra1 ESP detection problem

Message ID 49BBC27B.4050200@gentoo.org
State Superseded
Delegated to: David Miller
Headers show

Commit Message

Friedrich Oslage March 14, 2009, 2:43 p.m. UTC
Meelis Roos schrieb:
> [   60.565134] esp: probe of f0062a74 failed with error -12

I can reproduce this on my Ultra 2. I didn't notice it until now because
the boot disk is attached to an hme esp(which still works).

In esp_sbus_map_regs the of_ioremap call failes because res->start is 0
for non hme cards.

Basicly your tree looks like this:

SUNW,Ultra-1
  sbus
    SUNW,fas
    espdma
      esp

Of_bus_sbus_match works for "SUNW,fas" but not for "esp" because it only
checks the direct parent and not the parent's parent for name == "sbus".

This makes the kernel use of_bus_default_count_cells to calculate the
resources for "esp" instead of of_bus_sbus_count_cells.
And since of_bus_default_count_cells doesn't work for sbus systems the
resources of "esp" aren't detected.

I attached a patch, let me know if it works for you.

Cheers,
Friedrich

Comments

Meelis Roos March 15, 2009, 1:23 p.m. UTC | #1
> I attached a patch, let me know if it works for you.

It works, thank you!

[   43.147216] esp: esp0, regs[1ffe8800000:1ffe8400000] irq[10]
[   43.213133] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7
[   46.291912] scsi0 : esp
[   46.323301] scsi 0:0:0:0: Direct-Access     MAXTOR   ATLAS10K4_36SCA  DFV0 PQ: 0 ANSI: 3
[   46.418551] scsi target0:0:0: Beginning Domain Validation
[   46.485859] scsi target0:0:0: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
[   46.568915] scsi target0:0:0: Domain Validation skipping write tests
[   46.643444] scsi target0:0:0: Ending Domain Validation
[   47.884605] scsi 0:0:6:0: CD-ROM            TOSHIBA  XM-5401TASUN4XCD 2565 PQ: 0 ANSI: 2
[   47.979808] scsi target0:0:6: Beginning Domain Validation
[   48.058500] scsi target0:0:6: FAST-5 SCSI 4.2 MB/s ST (236 ns, offset 15)
[   48.145698] scsi target0:0:6: Domain Validation skipping write tests
[   48.219925] scsi target0:0:6: Ending Domain Validation
[   48.290452] esp: esp1, regs[1ff08810000:1ff08800000] irq[14]
[   48.356317] esp: esp1 is a FASHME, 40 MHz (ccf=0), SCSI ID 7
[   51.432077] scsi1 : esp
[   54.975344] Driver 'sd' needs updating - please use bus_type methods
[   55.051093] sd 0:0:0:0: [sda] 71833096 512-byte hardware sectors: (36.7 GB/34.2 GiB)
[   55.144227] sd 0:0:0:0: [sda] Write Protect is off
[   55.199693] sd 0:0:0:0: [sda] Mode Sense: ed 00 10 08
[   55.261650] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA
[   55.364374] sd 0:0:0:0: [sda] 71833096 512-byte hardware sectors: (36.7 GB/34.2 GiB)
[   55.457911] sd 0:0:0:0: [sda] Write Protect is off
[   55.513420] sd 0:0:0:0: [sda] Mode Sense: ed 00 10 08
[   55.575465] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA
[   55.677044]  sda: sda1 sda2 sda3 sda4
[   55.725075] sd 0:0:0:0: [sda] Attached SCSI disk
[   62.519240] Driver 'sr' needs updating - please use bus_type methods
[   63.493504] sr0: scsi-1 drive
[   63.527163] Uniform CD-ROM driver Revision: 3.20
[   63.583676] sr 0:0:6:0: Attached scsi CD-ROM sr0
[   64.471604] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   64.533811] sr 0:0:6:0: Attached scsi generic sg1 type 5
diff mbox

Patch

sparc: of_bus_sbus_match must also check the parent's parents.

To determine wheter the bus is sbus not only the direct parent but all the
parents of the parent must be checked, too.

In a tree like this

SUNW,Ultra-2
  sbus
    SUNW,hme
    SUNW,fas
    dma/espdma
      esp

only checking the direct parent would make of_match_bus use
of_bus_default_count_cells for "esp", instead of the desired
of_bus_sbus_count_cells, and return an incorrect cell count. Which, in this
case, would make allocating resources for "esp" fail.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Friedrich Oslage <bluebird@gentoo.org>
---
 arch/sparc/kernel/of_device_32.c |   13 +++++++++++--
 arch/sparc/kernel/of_device_64.c |   13 +++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 0a83bd7..bee16a5 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -246,8 +246,17 @@  static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
 
 static int of_bus_sbus_match(struct device_node *np)
 {
-	return !strcmp(np->name, "sbus") ||
-		!strcmp(np->name, "sbi");
+	/* return true if the direct parent or any of the parent's parents is
+	 * "sbus" or "sbi"
+	 */
+	struct device_node *dp = np;
+
+	do {
+		if (!strcmp(dp->name, "sbus") || !strcmp(dp->name, "sbi"))
+			return 1;
+	} while ((dp = dp->parent));
+
+	return 0;
 }
 
 static void of_bus_sbus_count_cells(struct device_node *child,
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index b4a12c9..7a27cfd 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -301,8 +301,17 @@  static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
 
 static int of_bus_sbus_match(struct device_node *np)
 {
-	return !strcmp(np->name, "sbus") ||
-		!strcmp(np->name, "sbi");
+	/* return true if the direct parent or any of the parent's parents is
+	 * "sbus" or "sbi"
+	 */
+	struct device_node *dp = np;
+
+	do {
+		if (!strcmp(dp->name, "sbus") || !strcmp(dp->name, "sbi"))
+			return 1;
+	} while ((dp = dp->parent));
+
+	return 0;
 }
 
 static void of_bus_sbus_count_cells(struct device_node *child,