linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: linuxppc-dev@ozlabs.org, galak@kernel.crashing.org
Cc: Timur Tabi <timur@freescale.com>
Subject: qe: fix device tree lookup code in qe_muram_init()
Date: Thu, 29 Nov 2007 14:29:20 -0600	[thread overview]
Message-ID: <11963681602431-git-send-email-timur@freescale.com> (raw)

Function qe_muram_init() was only looking for a node called "data-only",
instead of making sure it is the correct node.  This patch modifies
qe_muram_init() to find the QE node first, then the MURAM node inside it,
and then the data-only node.  It also reports errors.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/sysdev/qe_lib/qe.c |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 3d57d38..298e073 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -282,6 +282,12 @@ static DEFINE_SPINLOCK(qe_muram_lock);
 static rh_block_t qe_boot_muram_rh_block[16];
 static rh_info_t qe_muram_info;
 
+/* Initialize the MURAM remote heap
+ *
+ * This function queries the device tree to obtain the offset within MURAM
+ * to initialize the MURAM remote heap, and then it initializes the remote
+ * heap with that value.
+ */
 static void qe_muram_init(void)
 {
 	struct device_node *np;
@@ -294,15 +300,32 @@ static void qe_muram_init(void)
 		sizeof(qe_boot_muram_rh_block) /
 		sizeof(qe_boot_muram_rh_block[0]), qe_boot_muram_rh_block);
 
-	/* Attach the usable muram area */
-	/* XXX: This is a subset of the available muram. It
-	 * varies with the processor and the microcode patches activated.
-	 */
-	if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
-		address = *of_get_address(np, 0, &size, &flags);
-		of_node_put(np);
-		rh_attach_region(&qe_muram_info, address, (int) size);
+	/* Find the data-only node in the QE's muram node */
+	np = of_find_node_by_type(NULL, "qe");
+	if (!np) {
+		printk(KERN_ERR
+			"qe-muram: cannot find 'qe' node in device tree\n");
+		return;
+	}
+
+	np = of_find_node_by_type(np, "muram");
+	if (!np) {
+		printk(KERN_ERR
+			"qe-muram: cannot find 'muram' node in device tree\n");
+		return;
 	}
+
+	np = of_find_node_by_name(np, "data-only");
+	if (!np) {
+		printk(KERN_ERR "qe-muram: "
+			"cannot find 'data-only' node in device tree\n");
+		return;
+	}
+
+	/* Attach the usable muram area */
+	address = *of_get_address(np, 0, &size, &flags);
+	of_node_put(np);
+	rh_attach_region(&qe_muram_info, address, (int) size);
 }
 
 /* This function returns an index into the MURAM area.
-- 
1.5.2.4

             reply	other threads:[~2007-11-29 20:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 20:29 Timur Tabi [this message]
2007-11-29 22:54 ` qe: fix device tree lookup code in qe_muram_init() Kumar Gala

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=11963681602431-git-send-email-timur@freescale.com \
    --to=timur@freescale.com \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).