qe: fix device tree lookup code in qe_muram_init()
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.
--- arch/powerpc/sysdev/qe_lib/qe.c | 39 +++++++++++++++++++++++++++++++-------- 1 files changed, 31 insertions(+), 8 deletions(-)
arch/powerpc/sysdev/qe_lib/qe.c +31 -8
@@ -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.
Signature · 1 line
1.5.2.4
Quoted 10 lines · Timur Tabi
Function
qe_muram_init()was only looking for a node called "data-only", instead of making sure it is the correct node. This patch modifiesqe_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 <[email protected]>---
arch/powerpc/sysdev/qe_lib/qe.c| 39 ++++++++++++++++++++++++++++++
+--------1 files changed, 31 insertions(+), 8 deletions(-)
Add a compatible property in the muram data-only node called "fsl,qe-muram-data" and match on that compatible to find the node instead of walking the tree like you are. And report an error if there isn't a 'fsl,qe-muram-data' node
- k