From patchwork Fri Apr 17 11:10:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 26119 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 6E157B6F44 for ; Fri, 17 Apr 2009 21:10:44 +1000 (EST) Received: by ozlabs.org (Postfix) id 5F8C4DE0CE; Fri, 17 Apr 2009 21:10:44 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id E06A8DE0CC for ; Fri, 17 Apr 2009 21:10:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755540AbZDQLKb (ORCPT ); Fri, 17 Apr 2009 07:10:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756968AbZDQLKb (ORCPT ); Fri, 17 Apr 2009 07:10:31 -0400 Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:57691 "EHLO sunset.davemloft.net" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755540AbZDQLK3 (ORCPT ); Fri, 17 Apr 2009 07:10:29 -0400 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id 9141F35C523; Fri, 17 Apr 2009 04:10:21 -0700 (PDT) Date: Fri, 17 Apr 2009 04:10:21 -0700 (PDT) Message-Id: <20090417.041021.125958522.davem@davemloft.net> To: bluebird@gentoo.org Cc: mroos@linux.ee, sparclinux@vger.kernel.org Subject: Re: Ultra1 ESP detection problem From: David Miller In-Reply-To: <20090315.203236.173780380.davem@davemloft.net> References: <20090314.141442.34667369.davem@davemloft.net> <49BC24E0.1030308@gentoo.org> <20090315.203236.173780380.davem@davemloft.net> X-Mailer: Mew version 6.2.51 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org From: David Miller Date: Sun, 15 Mar 2009 20:32:36 -0700 (PDT) > Your change will make the 'qe' nodes match SBUS as a bus. That's > wrong, and we need to use na = 2 and ns = 2 for this case. > > So this doesn't work as a mechanism to bypass intermediate parent > nodes up to the SBUS. You need to fix this while preserving the > invariants and expectations of how this translation system works. > > For now, perhaps we can add those use_1to1_mapping() checks to > of_bus_sbus_match() as a quick fix that won't break other cases like > the 'qec' mentioned above. Ok, following through on this... Here is how I would like to fix this bug. sparc: Fix bus type probing for ESP and LE devices. If there is a dummy "espdma" or "ledma" parent device above ESP scsi or LE ethernet device nodes, we have to match the bus as SBUS. Otherwise the address and size cell counts are wrong and we don't calculate the final physical device resource values correctly at all. Commit 5280267c1dddb8d413595b87dc406624bb497946 ("sparc: Fix handling of LANCE and ESP parent nodes in of_device.c") was meant to fix this problem, but that only influences the inner loop of build_device_resources(). We need this logic to also kick in at the beginning of build_device_resources() as well, when we make the first attempt to determine the device's immediate parent bus type for 'reg' property element extraction. Based almost entirely upon a patch by Friedrich Oslage. Signed-off-by: David S. Miller --- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c index 0a83bd7..a7164c5 100644 --- a/arch/sparc/kernel/of_device_32.c +++ b/arch/sparc/kernel/of_device_32.c @@ -246,8 +246,25 @@ 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"); + struct device_node *dp = np; + + while (dp) { + if (!strcmp(np->name, "sbus") || + !strcmp(np->name, "sbi")) + return 1; + + /* Have a look at use_1to1_mapping(). We're trying + * to match SBUS if that's the top-level bus and we + * don't have some intervening real bus that provides + * ranges based translations. + */ + if (of_find_property(dp, "ranges", NULL) != NULL) + break; + + 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 27381f1..734f7ba 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c @@ -300,8 +300,25 @@ 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"); + struct device_node *dp = np; + + while (dp) { + if (!strcmp(np->name, "sbus") || + !strcmp(np->name, "sbi")) + return 1; + + /* Have a look at use_1to1_mapping(). We're trying + * to match SBUS if that's the top-level bus and we + * don't have some intervening real bus that provides + * ranges based translations. + */ + if (of_find_property(dp, "ranges", NULL) != NULL) + break; + + dp = dp->parent; + } + + return 0; } static void of_bus_sbus_count_cells(struct device_node *child,