* [PATCH 08/11] of/flattree: Merge unflatten_device_tree
From: Grant Likely @ 2009-11-05 7:46 UTC (permalink / raw)
To: linuxppc-dev, devicetree-discuss, benh, sfr, davem, sparclinux,
monstr, microblaze-uclinux
In-Reply-To: <20091105073728.10460.6061.stgit@angua>
Merge common code between PowerPC and MicroBlaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 1 -
arch/microblaze/kernel/prom.c | 49 ----------------------------------
arch/powerpc/kernel/prom.c | 50 -----------------------------------
drivers/of/fdt.c | 52 ++++++++++++++++++++++++++++++++++++
include/linux/of.h | 3 ++
include/linux/of_fdt.h | 4 ---
6 files changed, 55 insertions(+), 104 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index ef3ec1d..07d1063 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -37,7 +37,6 @@ extern struct device_node *of_chosen;
#define HAVE_ARCH_DEVTREE_FIXUPS
-extern struct device_node *allnodes; /* temporary while merging */
extern rwlock_t devtree_lock; /* temporary while merging */
/* For updating the device tree at runtime */
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 021770a..901d538 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -50,55 +50,6 @@ typedef u32 cell_t;
/* export that to outside world */
struct device_node *of_chosen;
-/**
- * unflattens the device-tree passed by the firmware, creating the
- * tree of struct device_node. It also fills the "name" and "type"
- * pointers of the nodes so the normal device-tree walking functions
- * can be used (this used to be done by finish_device_tree)
- */
-void __init unflatten_device_tree(void)
-{
- unsigned long start, mem, size;
- struct device_node **allnextp = &allnodes;
-
- pr_debug(" -> unflatten_device_tree()\n");
-
- /* First pass, scan for size */
- start = ((unsigned long)initial_boot_params) +
- initial_boot_params->off_dt_struct;
- size = unflatten_dt_node(0, &start, NULL, NULL, 0);
- size = (size | 3) + 1;
-
- pr_debug(" size is %lx, allocating...\n", size);
-
- /* Allocate memory for the expanded device tree */
- mem = lmb_alloc(size + 4, __alignof__(struct device_node));
- mem = (unsigned long) __va(mem);
-
- ((u32 *)mem)[size / 4] = 0xdeadbeef;
-
- pr_debug(" unflattening %lx...\n", mem);
-
- /* Second pass, do actual unflattening */
- start = ((unsigned long)initial_boot_params) +
- initial_boot_params->off_dt_struct;
- unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
- if (*((u32 *)start) != OF_DT_END)
- printk(KERN_WARNING "Weird tag at end of tree: %08x\n",
- *((u32 *)start));
- if (((u32 *)mem)[size / 4] != 0xdeadbeef)
- printk(KERN_WARNING "End of tree marker overwritten: %08x\n",
- ((u32 *)mem)[size / 4]);
- *allnextp = NULL;
-
- /* Get pointer to OF "/chosen" node for use everywhere */
- of_chosen = of_find_node_by_path("/chosen");
- if (of_chosen == NULL)
- of_chosen = of_find_node_by_path("/chosen@0");
-
- pr_debug(" <- unflatten_device_tree()\n");
-}
-
#define early_init_dt_scan_drconf_memory(node) 0
static int __init early_init_dt_scan_cpus(unsigned long node,
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a102a0a..1280f34 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -73,8 +73,6 @@ unsigned long tce_alloc_start, tce_alloc_end;
typedef u32 cell_t;
-extern struct device_node *allnodes; /* temporary while merging */
-
extern rwlock_t devtree_lock; /* temporary while merging */
/* export that to outside world */
@@ -119,54 +117,6 @@ static void __init move_device_tree(void)
DBG("<- move_device_tree\n");
}
-/**
- * unflattens the device-tree passed by the firmware, creating the
- * tree of struct device_node. It also fills the "name" and "type"
- * pointers of the nodes so the normal device-tree walking functions
- * can be used (this used to be done by finish_device_tree)
- */
-void __init unflatten_device_tree(void)
-{
- unsigned long start, mem, size;
- struct device_node **allnextp = &allnodes;
-
- DBG(" -> unflatten_device_tree()\n");
-
- /* First pass, scan for size */
- start = ((unsigned long)initial_boot_params) +
- initial_boot_params->off_dt_struct;
- size = unflatten_dt_node(0, &start, NULL, NULL, 0);
- size = (size | 3) + 1;
-
- DBG(" size is %lx, allocating...\n", size);
-
- /* Allocate memory for the expanded device tree */
- mem = lmb_alloc(size + 4, __alignof__(struct device_node));
- mem = (unsigned long) __va(mem);
-
- ((u32 *)mem)[size / 4] = 0xdeadbeef;
-
- DBG(" unflattening %lx...\n", mem);
-
- /* Second pass, do actual unflattening */
- start = ((unsigned long)initial_boot_params) +
- initial_boot_params->off_dt_struct;
- unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
- if (*((u32 *)start) != OF_DT_END)
- printk(KERN_WARNING "Weird tag at end of tree: %08x\n", *((u32 *)start));
- if (((u32 *)mem)[size / 4] != 0xdeadbeef)
- printk(KERN_WARNING "End of tree marker overwritten: %08x\n",
- ((u32 *)mem)[size / 4] );
- *allnextp = NULL;
-
- /* Get pointer to OF "/chosen" node for use everywhere */
- of_chosen = of_find_node_by_path("/chosen");
- if (of_chosen == NULL)
- of_chosen = of_find_node_by_path("/chosen@0");
-
- DBG(" <- unflatten_device_tree()\n");
-}
-
/*
* ibm,pa-features is a per-cpu property that contains a string of
* attribute descriptors, each of which has a 2 byte header plus up
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index df1ac8d..ad3a2b6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -9,6 +9,8 @@
* version 2 as published by the Free Software Foundation.
*/
+#include <linux/kernel.h>
+#include <linux/lmb.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
@@ -367,3 +369,53 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
*p += 4;
return mem;
}
+
+/**
+ * unflatten_device_tree - create tree of device_nodes from flat blob
+ *
+ * unflattens the device-tree passed by the firmware, creating the
+ * tree of struct device_node. It also fills the "name" and "type"
+ * pointers of the nodes so the normal device-tree walking functions
+ * can be used.
+ */
+void __init unflatten_device_tree(void)
+{
+ unsigned long start, mem, size;
+ struct device_node **allnextp = &allnodes;
+
+ pr_debug(" -> unflatten_device_tree()\n");
+
+ /* First pass, scan for size */
+ start = ((unsigned long)initial_boot_params) +
+ initial_boot_params->off_dt_struct;
+ size = unflatten_dt_node(0, &start, NULL, NULL, 0);
+ size = (size | 3) + 1;
+
+ pr_debug(" size is %lx, allocating...\n", size);
+
+ /* Allocate memory for the expanded device tree */
+ mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+ mem = (unsigned long) __va(mem);
+
+ ((u32 *)mem)[size / 4] = 0xdeadbeef;
+
+ pr_debug(" unflattening %lx...\n", mem);
+
+ /* Second pass, do actual unflattening */
+ start = ((unsigned long)initial_boot_params) +
+ initial_boot_params->off_dt_struct;
+ unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
+ if (*((u32 *)start) != OF_DT_END)
+ pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
+ if (((u32 *)mem)[size / 4] != 0xdeadbeef)
+ pr_warning("End of tree marker overwritten: %08x\n",
+ ((u32 *)mem)[size / 4]);
+ *allnextp = NULL;
+
+ /* Get pointer to OF "/chosen" node for use everywhere */
+ of_chosen = of_find_node_by_path("/chosen");
+ if (of_chosen == NULL)
+ of_chosen = of_find_node_by_path("/chosen@0");
+
+ pr_debug(" <- unflatten_device_tree()\n");
+}
diff --git a/include/linux/of.h b/include/linux/of.h
index e7facd8..bec2157 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -63,6 +63,9 @@ struct device_node {
#endif
};
+/* Pointer for first entry in chain of all nodes. */
+extern struct device_node *allnodes;
+
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
{
return test_bit(flag, &n->_flags);
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ace9068..81231e0 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -69,10 +69,6 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
unsigned long *size);
extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
extern unsigned long of_get_flat_dt_root(void);
-extern unsigned long unflatten_dt_node(unsigned long mem, unsigned long *p,
- struct device_node *dad,
- struct device_node ***allnextpp,
- unsigned long fpsize);
/* Other Prototypes */
extern void finish_device_tree(void);
^ permalink raw reply related
* [PATCH 09/11] of: merge prom_{add,remove,modify}_property
From: Grant Likely @ 2009-11-05 7:47 UTC (permalink / raw)
To: linuxppc-dev, devicetree-discuss, benh, sfr, davem, sparclinux,
monstr, microblaze-uclinux
In-Reply-To: <20091105073728.10460.6061.stgit@angua>
Merge common code between PowerPC and MicroBlaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/kernel/prom.c | 113 ----------------------------------------
arch/powerpc/kernel/prom.c | 114 ----------------------------------------
drivers/of/base.c | 116 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 116 insertions(+), 227 deletions(-)
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 901d538..a38e373 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -606,119 +606,6 @@ out_unlock:
write_unlock_irqrestore(&devtree_lock, flags);
}
-/*
- * Add a property to a node
- */
-int prom_add_property(struct device_node *np, struct property *prop)
-{
- struct property **next;
- unsigned long flags;
-
- prop->next = NULL;
- write_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
- if (strcmp(prop->name, (*next)->name) == 0) {
- /* duplicate ! don't insert it */
- write_unlock_irqrestore(&devtree_lock, flags);
- return -1;
- }
- next = &(*next)->next;
- }
- *next = prop;
- write_unlock_irqrestore(&devtree_lock, flags);
-
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to add to proc as well if it was initialized */
- if (np->pde)
- proc_device_tree_add_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
- return 0;
-}
-
-/*
- * Remove a property from a node. Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property. Instead we just move the property
- * to the "dead properties" list, so it won't be found any more.
- */
-int prom_remove_property(struct device_node *np, struct property *prop)
-{
- struct property **next;
- unsigned long flags;
- int found = 0;
-
- write_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
- if (*next == prop) {
- /* found the node */
- *next = prop->next;
- prop->next = np->deadprops;
- np->deadprops = prop;
- found = 1;
- break;
- }
- next = &(*next)->next;
- }
- write_unlock_irqrestore(&devtree_lock, flags);
-
- if (!found)
- return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to remove the proc node as well */
- if (np->pde)
- proc_device_tree_remove_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
- return 0;
-}
-
-/*
- * Update a property in a node. Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property. Instead we just move the property
- * to the "dead properties" list, and add the new property to the
- * property list
- */
-int prom_update_property(struct device_node *np,
- struct property *newprop,
- struct property *oldprop)
-{
- struct property **next;
- unsigned long flags;
- int found = 0;
-
- write_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
- if (*next == oldprop) {
- /* found the node */
- newprop->next = oldprop->next;
- *next = newprop;
- oldprop->next = np->deadprops;
- np->deadprops = oldprop;
- found = 1;
- break;
- }
- next = &(*next)->next;
- }
- write_unlock_irqrestore(&devtree_lock, flags);
-
- if (!found)
- return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to add to proc as well if it was initialized */
- if (np->pde)
- proc_device_tree_update_prop(np->pde, newprop, oldprop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
- return 0;
-}
-
#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
static struct debugfs_blob_wrapper flat_dt_blob;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1280f34..7f88566 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1130,120 +1130,6 @@ static int __init prom_reconfig_setup(void)
__initcall(prom_reconfig_setup);
#endif
-/*
- * Add a property to a node
- */
-int prom_add_property(struct device_node* np, struct property* prop)
-{
- struct property **next;
- unsigned long flags;
-
- prop->next = NULL;
- write_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
- if (strcmp(prop->name, (*next)->name) == 0) {
- /* duplicate ! don't insert it */
- write_unlock_irqrestore(&devtree_lock, flags);
- return -1;
- }
- next = &(*next)->next;
- }
- *next = prop;
- write_unlock_irqrestore(&devtree_lock, flags);
-
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to add to proc as well if it was initialized */
- if (np->pde)
- proc_device_tree_add_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
- return 0;
-}
-
-/*
- * Remove a property from a node. Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property. Instead we just move the property
- * to the "dead properties" list, so it won't be found any more.
- */
-int prom_remove_property(struct device_node *np, struct property *prop)
-{
- struct property **next;
- unsigned long flags;
- int found = 0;
-
- write_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
- if (*next == prop) {
- /* found the node */
- *next = prop->next;
- prop->next = np->deadprops;
- np->deadprops = prop;
- found = 1;
- break;
- }
- next = &(*next)->next;
- }
- write_unlock_irqrestore(&devtree_lock, flags);
-
- if (!found)
- return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to remove the proc node as well */
- if (np->pde)
- proc_device_tree_remove_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
- return 0;
-}
-
-/*
- * Update a property in a node. Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property. Instead we just move the property
- * to the "dead properties" list, and add the new property to the
- * property list
- */
-int prom_update_property(struct device_node *np,
- struct property *newprop,
- struct property *oldprop)
-{
- struct property **next;
- unsigned long flags;
- int found = 0;
-
- write_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
- if (*next == oldprop) {
- /* found the node */
- newprop->next = oldprop->next;
- *next = newprop;
- oldprop->next = np->deadprops;
- np->deadprops = oldprop;
- found = 1;
- break;
- }
- next = &(*next)->next;
- }
- write_unlock_irqrestore(&devtree_lock, flags);
-
- if (!found)
- return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to add to proc as well if it was initialized */
- if (np->pde)
- proc_device_tree_update_prop(np->pde, newprop, oldprop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
- return 0;
-}
-
-
/* Find the device node for a given logical cpu number, also returns the cpu
* local thread number (index in ibm,interrupt-server#s) if relevant and
* asked for (non NULL)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e6627b2..ec56739 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -658,3 +658,119 @@ err0:
return ret;
}
EXPORT_SYMBOL(of_parse_phandles_with_args);
+
+/**
+ * prom_add_property - Add a property to a node
+ */
+int prom_add_property(struct device_node *np, struct property *prop)
+{
+ struct property **next;
+ unsigned long flags;
+
+ prop->next = NULL;
+ write_lock_irqsave(&devtree_lock, flags);
+ next = &np->properties;
+ while (*next) {
+ if (strcmp(prop->name, (*next)->name) == 0) {
+ /* duplicate ! don't insert it */
+ write_unlock_irqrestore(&devtree_lock, flags);
+ return -1;
+ }
+ next = &(*next)->next;
+ }
+ *next = prop;
+ write_unlock_irqrestore(&devtree_lock, flags);
+
+#ifdef CONFIG_PROC_DEVICETREE
+ /* try to add to proc as well if it was initialized */
+ if (np->pde)
+ proc_device_tree_add_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+ return 0;
+}
+
+/**
+ * prom_remove_property - Remove a property from a node.
+ *
+ * Note that we don't actually remove it, since we have given out
+ * who-knows-how-many pointers to the data using get-property.
+ * Instead we just move the property to the "dead properties"
+ * list, so it won't be found any more.
+ */
+int prom_remove_property(struct device_node *np, struct property *prop)
+{
+ struct property **next;
+ unsigned long flags;
+ int found = 0;
+
+ write_lock_irqsave(&devtree_lock, flags);
+ next = &np->properties;
+ while (*next) {
+ if (*next == prop) {
+ /* found the node */
+ *next = prop->next;
+ prop->next = np->deadprops;
+ np->deadprops = prop;
+ found = 1;
+ break;
+ }
+ next = &(*next)->next;
+ }
+ write_unlock_irqrestore(&devtree_lock, flags);
+
+ if (!found)
+ return -ENODEV;
+
+#ifdef CONFIG_PROC_DEVICETREE
+ /* try to remove the proc node as well */
+ if (np->pde)
+ proc_device_tree_remove_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+ return 0;
+}
+
+/*
+ * prom_update_property - Update a property in a node.
+ *
+ * Note that we don't actually remove it, since we have given out
+ * who-knows-how-many pointers to the data using get-property.
+ * Instead we just move the property to the "dead properties" list,
+ * and add the new property to the property list
+ */
+int prom_update_property(struct device_node *np,
+ struct property *newprop,
+ struct property *oldprop)
+{
+ struct property **next;
+ unsigned long flags;
+ int found = 0;
+
+ write_lock_irqsave(&devtree_lock, flags);
+ next = &np->properties;
+ while (*next) {
+ if (*next == oldprop) {
+ /* found the node */
+ newprop->next = oldprop->next;
+ *next = newprop;
+ oldprop->next = np->deadprops;
+ np->deadprops = oldprop;
+ found = 1;
+ break;
+ }
+ next = &(*next)->next;
+ }
+ write_unlock_irqrestore(&devtree_lock, flags);
+
+ if (!found)
+ return -ENODEV;
+
+#ifdef CONFIG_PROC_DEVICETREE
+ /* try to add to proc as well if it was initialized */
+ if (np->pde)
+ proc_device_tree_update_prop(np->pde, newprop, oldprop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+ return 0;
+}
^ permalink raw reply related
* [PATCH 10/11] of: remove special case definition of of_read_ulong()
From: Grant Likely @ 2009-11-05 7:47 UTC (permalink / raw)
To: linuxppc-dev, devicetree-discuss, benh, sfr, davem, sparclinux,
monstr, microblaze-uclinux
In-Reply-To: <20091105073728.10460.6061.stgit@angua>
Special case of of_read_ulong() was defined for PPC32 to toss away
all but the last 32 bits when a large number value was read, and the
'normal' version for ppc64 just #defined of_read_ulong to of_read_number
which causes compiler warnings on MicroBlaze and other 32 bit
architectures because it returns a u64 instead of a ulong.
This patch fixes the problem by defining a common implementation of
of_read_ulong() that works everywhere.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
include/linux/of.h | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/include/linux/of.h b/include/linux/of.h
index bec2157..d4c014a 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -113,14 +113,11 @@ static inline u64 of_read_number(const u32 *cell, int size)
}
/* Like of_read_number, but we want an unsigned long result */
-#ifdef CONFIG_PPC32
static inline unsigned long of_read_ulong(const u32 *cell, int size)
{
- return cell[size-1];
+ /* toss away upper bits if unsigned long is smaller than u64 */
+ return of_read_number(cell, size);
}
-#else
-#define of_read_ulong(cell, size) of_read_number(cell, size)
-#endif
#include <asm/prom.h>
^ permalink raw reply related
* [PATCH 11/11] of/flattree: Merge early_init_dt_check_for_initrd()
From: Grant Likely @ 2009-11-05 7:47 UTC (permalink / raw)
To: linuxppc-dev, devicetree-discuss, benh, sfr, davem, sparclinux,
monstr, microblaze-uclinux
In-Reply-To: <20091105073728.10460.6061.stgit@angua>
Merge common code between PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/kernel/prom.c | 32 --------------------------------
arch/powerpc/kernel/prom.c | 30 ------------------------------
drivers/of/fdt.c | 37 +++++++++++++++++++++++++++++++++++++
include/linux/of_fdt.h | 1 +
4 files changed, 38 insertions(+), 62 deletions(-)
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index a38e373..7959495 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
return 0;
}
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
- unsigned long l;
- u32 *prop;
-
- pr_debug("Looking for initrd properties... ");
-
- prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
- if (prop) {
- initrd_start = (unsigned long)
- __va((u32)of_read_ulong(prop, l/4));
-
- prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
- if (prop) {
- initrd_end = (unsigned long)
- __va((u32)of_read_ulong(prop, 1/4));
- initrd_below_start_ok = 1;
- } else {
- initrd_start = 0;
- }
- }
-
- pr_debug("initrd_start=0x%lx initrd_end=0x%lx\n",
- initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
static int __init early_init_dt_scan_chosen(unsigned long node,
const char *uname, int depth, void *data)
{
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 7f88566..1ecd6c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
return 0;
}
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
- unsigned long l;
- u32 *prop;
-
- DBG("Looking for initrd properties... ");
-
- prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
- if (prop) {
- initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
-
- prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
- if (prop) {
- initrd_end = (unsigned long)
- __va(of_read_ulong(prop, l/4));
- initrd_below_start_ok = 1;
- } else {
- initrd_start = 0;
- }
- }
-
- DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
static int __init early_init_dt_scan_chosen(unsigned long node,
const char *uname, int depth, void *data)
{
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ad3a2b6..3c58f10 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/lmb.h>
+#include <linux/initrd.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
@@ -370,6 +371,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
return mem;
}
+#ifdef CONFIG_BLK_DEV_INITRD
+/**
+ * early_init_dt_check_for_initrd - Decode initrd location from flat tree
+ * @node: reference to node containing initrd location ('chosen')
+ */
+void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+ unsigned long len;
+ u32 *prop;
+
+ pr_debug("Looking for initrd properties... ");
+
+ prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+ if (prop) {
+ initrd_start = (unsigned long)
+ __va(of_read_ulong(prop, len/4));
+
+ prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+ if (prop) {
+ initrd_end = (unsigned long)
+ __va(of_read_ulong(prop, len/4));
+ initrd_below_start_ok = 1;
+ } else {
+ initrd_start = 0;
+ }
+ }
+
+ pr_debug("initrd_start=0x%lx initrd_end=0x%lx\n",
+ initrd_start, initrd_end);
+}
+#else
+inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
/**
* unflatten_device_tree - create tree of device_nodes from flat blob
*
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 81231e0..ec2db82 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
unsigned long *size);
extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_check_for_initrd(unsigned long node);
/* Other Prototypes */
extern void finish_device_tree(void);
^ permalink raw reply related
* Re: [RFC PATCH 2/5] Merge dynamic OF code to of_dynamic.c
From: Grant Likely @ 2009-11-05 7:55 UTC (permalink / raw)
To: Nathan Fontenot; +Cc: linuxppc-dev, devicetree-discuss, microblaze-uclinux
In-Reply-To: <4AF1FD46.9050101@austin.ibm.com>
Hi Nathan,
Thanks for the patches. Comments below.
On Wed, Nov 4, 2009 at 3:16 PM, Nathan Fontenot <nfont@austin.ibm.com> wrot=
e:
> Creation of the OF dynamic device tree update code in drivers/of. =A0This
> merges the common device tree updating routines to add/remove nodes and
> properties from powerpc and microblaze. =A0All of the new code is conditi=
onal
> based on a new OF_DYNAMIC config option.
Rather than one patch to create all the moved functions, and then
subsequent patches to remove the duplicates from each arch, I've been
using the pattern of one patch for each function or couple of
functions to both remove from the old files and add to the new home.
Would you be able to do the same for your patches here? The merging
is complicated enough without having to track changes to a function
between separate commits. Moving one function at a time will also
make bisecting more friendly.
Also, have you checked what impact these changes have on SPARC?
> --- linux-next.orig/drivers/of/Makefile 2009-11-03 11:18:08.000000000 -06=
00
> +++ linux-next/drivers/of/Makefile =A0 =A0 =A02009-11-03 13:42:35.0000000=
00 -0600
> @@ -1,6 +1,7 @@
> obj-y =3D base.o
> -obj-$(CONFIG_OF_DEVICE) +=3D device.o platform.o
> -obj-$(CONFIG_OF_GPIO) =A0 +=3D gpio.o
> -obj-$(CONFIG_OF_I2C) =A0 +=3D of_i2c.o
> -obj-$(CONFIG_OF_SPI) =A0 +=3D of_spi.o
> -obj-$(CONFIG_OF_MDIO) =A0+=3D of_mdio.o
> +obj-$(CONFIG_OF_DEVICE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D device.o pla=
tform.o
> +obj-$(CONFIG_OF_GPIO) =A0 =A0 =A0 =A0 =A0+=3D gpio.o
> +obj-$(CONFIG_OF_I2C) =A0 =A0 =A0 =A0 =A0 +=3D of_i2c.o
> +obj-$(CONFIG_OF_SPI) =A0 =A0 =A0 =A0 =A0 +=3D of_spi.o
> +obj-$(CONFIG_OF_MDIO) =A0 =A0 =A0 =A0 =A0+=3D of_mdio.o
> +obj-$(CONFIG_OF_DYNAMIC) =A0 =A0 =A0 +=3D of_dynamic.o
Unrelated whitespace churn makes it hard to see what actually changed.
Thanks,
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: 2.6.33 -next tree
From: Stephen Rothwell @ 2009-11-05 8:02 UTC (permalink / raw)
To: Grant Likely; +Cc: Andrew Morton, David Brownell, linuxppc-dev
In-Reply-To: <fa686aa40911042210q5bbbca2fi82911b7245d17588@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 707 bytes --]
Hi Grant,
On Wed, 4 Nov 2009 23:10:21 -0700 Grant Likely <grant.likely@secretlab.ca> wrote:
>
> I just prepared my next branch for 2.6.33:
> git://git.secretlab.ca/git/linux-2.6 next
>
> Steven, can you please add this tree to your linux-next pull list?
> This is the branch where I put stuff that gets fed up to Ben. This is
> separate from the branch that I'm using to collect OF related changes
> and that you are already pulling in.
What would you like this called? If you don't think of anything, I will
call it "52xx", but it seems like it may be of wider scope than that.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: 2.6.33 -next tree
From: Grant Likely @ 2009-11-05 8:08 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Andrew Morton, David Brownell, linuxppc-dev
In-Reply-To: <20091105190228.916c845c.sfr@canb.auug.org.au>
On Thu, Nov 5, 2009 at 1:02 AM, Stephen Rothwell <sfr@canb.auug.org.au> wro=
te:
> On Wed, 4 Nov 2009 23:10:21 -0700 Grant Likely <grant.likely@secretlab.ca=
> wrote:
>> Steven, can you please add this tree to your linux-next pull list?
>> This is the branch where I put stuff that gets fed up to Ben. =A0This is
>> separate from the branch that I'm using to collect OF related changes
>> and that you are already pulling in.
>
> What would you like this called? =A0If you don't think of anything, I wil=
l
> call it "52xx", but it seems like it may be of wider scope than that.
It is 5xxx and virtex related stuff, plus a smattering of generic ppc
changes. "5xxx-and-virtex" perhaps?
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: 2.6.33 -next tree
From: Stephen Rothwell @ 2009-11-05 8:13 UTC (permalink / raw)
To: Grant Likely; +Cc: Andrew Morton, David Brownell, linuxppc-dev
In-Reply-To: <fa686aa40911050008r33cff773w191e97654efacf19@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --]
Hi Grant,
On Thu, 5 Nov 2009 01:08:53 -0700 Grant Likely <grant.likely@secretlab.ca> wrote:
>
> It is 5xxx and virtex related stuff, plus a smattering of generic ppc
> changes. "5xxx-and-virtex" perhaps?
OK, done.
Thanks for adding your subsystem tree as a participant of linux-next. As
you may know, this is not a judgment of your code. The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window.
You will need to ensure that the patches/commits in your tree/series have
been:
* submitted under GPL v2 (or later) and include the Contributor's
Signed-off-by,
* posted to the relevant mailing list,
* reviewed by you (or another maintainer of your subsystem tree),
* successfully unit tested, and
* destined for the current or next Linux merge window.
Basically, this should be just what you would send to Linus (or ask him
to fetch). It is allowed to be rebased if you deem it necessary.
--
Cheers,
Stephen Rothwell
sfr@canb.auug.org.au
Legal Stuff:
By participating in linux-next, your subsystem tree contributions are
public and will be included in the linux-next trees. You may be sent
e-mail messages indicating errors or other issues when the
patches/commits from your subsystem tree are merged and tested in
linux-next. These messages may also be cross-posted to the linux-next
mailing list, the linux-kernel mailing list, etc. The linux-next tree
project and IBM (my employer) make no warranties regarding the linux-next
project, the testing procedures, the results, the e-mails, etc. If you
don't agree to these ground rules, let me know and I'll remove your tree
from participation in linux-next.
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH 01/11] of/flattree: merge find_flat_dt_string and initial_boot_params
From: Wolfram Sang @ 2009-11-05 8:39 UTC (permalink / raw)
To: Grant Likely
Cc: sfr, monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091105074515.10460.83467.stgit@angua>
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
On Thu, Nov 05, 2009 at 12:45:22AM -0700, Grant Likely wrote:
> Merge common code between Microblaze and PowerPC. Also move instance of
> ---
>
> arch/microblaze/Kconfig | 1 +
Commit message cut off?
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH 01/11] of/flattree: merge find_flat_dt_string and initial_boot_params
From: Grant Likely @ 2009-11-05 8:45 UTC (permalink / raw)
To: Wolfram Sang
Cc: sfr, monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091105083945.GA3478@pengutronix.de>
On Thu, Nov 5, 2009 at 1:39 AM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> On Thu, Nov 05, 2009 at 12:45:22AM -0700, Grant Likely wrote:
>> Merge common code between Microblaze and PowerPC. =A0Also move instance =
of
>> ---
>>
>> =A0arch/microblaze/Kconfig =A0 =A0 =A0 | =A0 =A01 +
>
> Commit message cut off?
No, I just never completed writing that log message. I don't know
why. I'll fix before the next posting.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [PATCH 02/11] of/flattree: merge of_scan_flat_dt
From: Wolfram Sang @ 2009-11-05 8:45 UTC (permalink / raw)
To: Grant Likely
Cc: sfr, monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091105074527.10460.23877.stgit@angua>
[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]
On Thu, Nov 05, 2009 at 12:45:35AM -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
Just minor fixes in nanodoc.
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 9faa9a5..7c3c13c 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -19,3 +19,68 @@ char *find_flat_dt_string(u32 offset)
> return ((char *)initial_boot_params) +
> initial_boot_params->off_dt_strings + offset;
> }
> +
> +/**
> + * of_scan_flat_dt - scan flattend tree blob and call callback on each.
flattened
> + * @it: callback function
> + * @data: context data pointer
> + *
> + * This function is used to scan the flattened device-tree, it is
> + * used to extract the memory informations at boot before we can
I am not a native speaker, yet I have been taught there is no "informations".
> + * unflatten the tree
> + */
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH 05/11] of/flattree: merge of_get_flat_dt_prop
From: Wolfram Sang @ 2009-11-05 8:49 UTC (permalink / raw)
To: Grant Likely
Cc: sfr, monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091105074606.10460.23775.stgit@angua>
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
On Thu, Nov 05, 2009 at 12:46:13AM -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
nanodoc comment again
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index a6e869e..7a51343 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -100,3 +100,46 @@ unsigned long __init of_get_flat_dt_root(void)
> return _ALIGN(p + strlen((char *)p) + 1, 4);
> }
>
> +/**
> + * of_get_flat_dt_prop - Given a node in the flat blob, return the property pointer
> + *
> + * This function can be used within scan_flattened_dt callback to get
double space
> + * access to properties
> + */
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH 07/11] of/flattree: Merge unflatten_dt_node
From: Wolfram Sang @ 2009-11-05 8:59 UTC (permalink / raw)
To: Grant Likely
Cc: sfr, monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091105074631.10460.97676.stgit@angua>
[-- Attachment #1: Type: text/plain, Size: 7202 bytes --]
On Thu, Nov 05, 2009 at 12:46:38AM -0700, Grant Likely wrote:
> Merge common code between PowerPC and MicroBlaze
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
[...]
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 01a7f5f..df1ac8d 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -167,3 +167,203 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> return 0;
> }
>
> +static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> + unsigned long align)
> +{
> + void *res;
> +
> + *mem = _ALIGN(*mem, align);
> + res = (void *)*mem;
> + *mem += size;
> +
> + return res;
> +}
> +
> +/**
> + * unflatten_dt_node - Alloc and populate a device_node from the flat tree
> + * @p: pointer to node in flat tree
> + * @dad: Parent struct device_node
> + * @allnextpp: pointer to ->allnext from last allocated device_node
> + * @fpsize: Size of the node path up at the current depth.
> + */
> +unsigned long __init unflatten_dt_node(unsigned long mem,
> + unsigned long *p,
> + struct device_node *dad,
> + struct device_node ***allnextpp,
> + unsigned long fpsize)
> +{
> + struct device_node *np;
> + struct property *pp, **prev_pp = NULL;
> + char *pathp;
> + u32 tag;
> + unsigned int l, allocl;
> + int has_name = 0;
> + int new_format = 0;
> +
> + tag = *((u32 *)(*p));
> + if (tag != OF_DT_BEGIN_NODE) {
> + printk("Weird tag at start of node: %x\n", tag);
Loglevel missing -> pr_info?
> + return mem;
> + }
> + *p += 4;
> + pathp = (char *)*p;
> + l = allocl = strlen(pathp) + 1;
> + *p = _ALIGN(*p + l, 4);
> +
> + /* version 0x10 has a more compact unit name here instead of the full
> + * path. we accumulate the full path size using "fpsize", we'll rebuild
> + * it later. We detect this because the first character of the name is
> + * not '/'.
> + */
> + if ((*pathp) != '/') {
> + new_format = 1;
> + if (fpsize == 0) {
> + /* root node: special case. fpsize accounts for path
> + * plus terminating zero. root node only has '/', so
> + * fpsize should be 2, but we want to avoid the first
> + * level nodes to have two '/' so we use fpsize 1 here
> + */
> + fpsize = 1;
> + allocl = 2;
> + } else {
> + /* account for '/' and path size minus terminal 0
> + * already in 'l'
> + */
> + fpsize += l;
> + allocl = fpsize;
> + }
> + }
> +
> + np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
> + __alignof__(struct device_node));
> + if (allnextpp) {
> + memset(np, 0, sizeof(*np));
> + np->full_name = ((char *)np) + sizeof(struct device_node);
> + if (new_format) {
> + char *fn = np->full_name;
> + /* rebuild full path for new format */
> + if (dad && dad->parent) {
> + strcpy(fn, dad->full_name);
> +#ifdef DEBUG
> + if ((strlen(fn) + l + 1) != allocl) {
> + pr_debug("%s: p: %d, l: %d, a: %d\n",
> + pathp, (int)strlen(fn),
> + l, allocl);
> + }
> +#endif
> + fn += strlen(fn);
> + }
> + *(fn++) = '/';
> + memcpy(fn, pathp, l);
> + } else
> + memcpy(np->full_name, pathp, l);
> + prev_pp = &np->properties;
> + **allnextpp = np;
> + *allnextpp = &np->allnext;
> + if (dad != NULL) {
> + np->parent = dad;
> + /* we temporarily use the next field as `last_child'*/
> + if (dad->next == NULL)
> + dad->child = np;
> + else
> + dad->next->sibling = np;
> + dad->next = np;
> + }
> + kref_init(&np->kref);
> + }
> + while (1) {
> + u32 sz, noff;
> + char *pname;
> +
> + tag = *((u32 *)(*p));
> + if (tag == OF_DT_NOP) {
> + *p += 4;
> + continue;
> + }
> + if (tag != OF_DT_PROP)
> + break;
> + *p += 4;
> + sz = *((u32 *)(*p));
> + noff = *((u32 *)((*p) + 4));
> + *p += 8;
> + if (initial_boot_params->version < 0x10)
> + *p = _ALIGN(*p, sz >= 8 ? 8 : 4);
> +
> + pname = find_flat_dt_string(noff);
> + if (pname == NULL) {
> + pr_info("Can't find property name in list !\n");
> + break;
> + }
> + if (strcmp(pname, "name") == 0)
> + has_name = 1;
> + l = strlen(pname) + 1;
> + pp = unflatten_dt_alloc(&mem, sizeof(struct property),
> + __alignof__(struct property));
> + if (allnextpp) {
> + if (strcmp(pname, "linux,phandle") == 0) {
> + np->node = *((u32 *)*p);
> + if (np->linux_phandle == 0)
> + np->linux_phandle = np->node;
> + }
> + if (strcmp(pname, "ibm,phandle") == 0)
> + np->linux_phandle = *((u32 *)*p);
> + pp->name = pname;
> + pp->length = sz;
> + pp->value = (void *)*p;
> + *prev_pp = pp;
> + prev_pp = &pp->next;
> + }
> + *p = _ALIGN((*p) + sz, 4);
> + }
> + /* with version 0x10 we may not have the name property, recreate
> + * it here from the unit name if absent
> + */
> + if (!has_name) {
> + char *p1 = pathp, *ps = pathp, *pa = NULL;
> + int sz;
> +
> + while (*p1) {
> + if ((*p1) == '@')
> + pa = p1;
> + if ((*p1) == '/')
> + ps = p1 + 1;
> + p1++;
> + }
> + if (pa < ps)
> + pa = p1;
> + sz = (pa - ps) + 1;
> + pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz,
> + __alignof__(struct property));
> + if (allnextpp) {
> + pp->name = "name";
> + pp->length = sz;
> + pp->value = pp + 1;
> + *prev_pp = pp;
> + prev_pp = &pp->next;
> + memcpy(pp->value, ps, sz - 1);
> + ((char *)pp->value)[sz - 1] = 0;
> + pr_debug("fixed up name for %s -> %s\n", pathp,
> + (char *)pp->value);
> + }
> + }
> + if (allnextpp) {
> + *prev_pp = NULL;
> + np->name = of_get_property(np, "name", NULL);
> + np->type = of_get_property(np, "device_type", NULL);
> +
> + if (!np->name)
> + np->name = "<NULL>";
> + if (!np->type)
> + np->type = "<NULL>";
> + }
> + while (tag == OF_DT_BEGIN_NODE) {
> + mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
> + tag = *((u32 *)(*p));
> + }
> + if (tag != OF_DT_END_NODE) {
> + printk("Weird tag at end of node: %x\n", tag);
Ditto (microblaze had KERN_INFO, too).
> + return mem;
> + }
> + *p += 4;
> + return mem;
> +}
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 81231e0..ace9068 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -69,6 +69,10 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
> unsigned long *size);
> extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
> extern unsigned long of_get_flat_dt_root(void);
> +extern unsigned long unflatten_dt_node(unsigned long mem, unsigned long *p,
> + struct device_node *dad,
> + struct device_node ***allnextpp,
> + unsigned long fpsize);
>
> /* Other Prototypes */
> extern void finish_device_tree(void);
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH 14/27] Add book3s_64 specific opcode emulation
From: Alexander Graf @ 2009-11-05 10:09 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Kevin Wolf, Arnd Bergmann, Hollis Blanchard, Marcelo Tosatti,
kvm-ppc, linuxppc-dev, Avi Kivity, kvm, bphilips, Olof Johansson
In-Reply-To: <070A7C13-92FC-482E-B72B-FDE84501E132@kernel.crashing.org>
On 05.11.2009, at 01:53, Segher Boessenkool wrote:
>>>> + case OP_31_XOP_EIOIO:
>>>> + break;
>>>
>>> Have you always executed an eieio or sync when you get here, or
>>> do you just not allow direct access to I/O devices? Other context
>>> synchronising insns are not enough, they do not broadcast on the
>>> bus.
>>
>> There is no device passthrough yet :-). It's theoretically
>> possible, but nothing for it is implemented so far.
>
> You could just always do an eieio here, it's not expensive at all
> compared to the emulation trap itself.
>
> However -- eieio is a Book II insn, it will never trap anyway!
Don't all 31 ops trap? I'm pretty sure I added the emulation because I
saw the trap.
>>>> + case OP_31_XOP_DCBZ:
>>>> + {
>>>> + ulong rb = vcpu->arch.gpr[get_rb(inst)];
>>>> + ulong ra = 0;
>>>> + ulong addr;
>>>> + u32 zeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
>>>> +
>>>> + if (get_ra(inst))
>>>> + ra = vcpu->arch.gpr[get_ra(inst)];
>>>> +
>>>> + addr = (ra + rb) & ~31ULL;
>>>> + if (!(vcpu->arch.msr & MSR_SF))
>>>> + addr &= 0xffffffff;
>>>> +
>>>> + if (kvmppc_st(vcpu, addr, 32, zeros)) {
>>>
>>> DCBZ zeroes out a cache line, not 32 bytes; except on 970, where
>>> there
>>> are HID bits to make it work on 32 bytes only, and an extra DCBZL
>>> insn
>>> that always clears a full cache line (128 bytes).
>>
>> Yes. We only come here when we patched the dcbz opcodes to invalid
>> instructions
>
> Ah yes, I forgot. Could you rename it to OP_31_XOP_FAKE_32BIT_DCBZ
> or such?
Good idea.
>> because cache line size of target == 32.
>> On 970 with MSR_HV = 0 we actually use the dcbz 32-bytes mode.
>>
>> Admittedly though, this could be a lot more clever.
>
>>>> + /* guest HID5 set can change is_dcbz32 */
>>>> + if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
>>>> + (mfmsr() & MSR_HV))
>>>> + vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
>>>> + break;
>>>
>>> Wait, does this mean you allow other HID writes when MSR[HV] isn't
>>> set? All HIDs (and many other SPRs) cannot be read or written in
>>> supervisor mode.
>>
>> When we're running in MSR_HV=0 mode on a 970 we can use the 32 byte
>> dcbz HID flag. So all we need to do is tell our entry/exit code to
>> set this bit.
>
> Which patch contains that entry/exit code?
That's patch 7 / 27.
+ /* Some guests may need to have dcbz set to 32 byte length.
+ *
+ * Usually we ensure that by patching the guest's instructions
+ * to trap on dcbz and emulate it in the hypervisor.
+ *
+ * If we can, we should tell the CPU to use 32 byte dcbz though,
+ * because that's a lot faster.
+ */
+
+ ld r3, VCPU_HFLAGS(r4)
+ rldicl. r3, r3, 0, 63 /* CR = ((r3 & 1) == 0) */
+ beq no_dcbz32_on
+
+ mfspr r3,SPRN_HID5
+ ori r3, r3, 0x80 /* XXX HID5_dcbz32 = 0x80 */
+ mtspr SPRN_HID5,r3
+
+no_dcbz32_on:
>> If we're on 970 on a hypervisor or on a non-970 though we can't use
>> the HID5 bit, so we need to binary patch the opcodes.
>>
>> So in order to emulate real 970 behavior, we need to be able to
>> emulate that HID5 bit too! That's what this chunk of code does - it
>> basically sets us in dcbz32 mode when allowed on 970 guests.
>
> But when MSR[HV]=0 and MSR[PR]=0, mtspr to a hypervisor resource
> will not trap but be silently ignored. Sorry for not being more
> clear.
> ...Oh. You run your guest as MSR[PR]=1 anyway! Tricky.
Yeah, the guest is always running in PR=1, so all HV checks are for
the host. Usually we run in HV=1 on the host, because IBM doesn't sell
machines that have HV=0 accessible for mortals :-).
I'll address your comments in a follow-up patch once the stuff is
merged.
Alex
^ permalink raw reply
* Re: [PATCH 00/11] More OF merge patches
From: Wolfram Sang @ 2009-11-05 10:11 UTC (permalink / raw)
To: Grant Likely
Cc: sfr, monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091105073728.10460.6061.stgit@angua>
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
On Thu, Nov 05, 2009 at 12:45:09AM -0700, Grant Likely wrote:
> I've also pushed this series out to the test-devicetree branch on my
> git server if anyone cares to pull and test:
I did :) Works fine on my phyCORE-IO (MPC5200B). If you pick up my comments:
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* System hangs when exceeding a certain initramfs size
From: Frank Prepelica @ 2009-11-05 10:02 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
I experience the issue when the kernel image (including the initramfs)
exceeds a=20
certain size (>6MB) that after unpacking the kernel the systems hangs
at:
bootm 2000000 - 3000000
## Booting image at 02000000 ...
Image Name: Linux-2.6.29
Created: 2009-11-04 14:25:01 UTC
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 6798037 Bytes =3D 6.5 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Booting using the fdt at 0x3000000
Loading Device Tree to 00ffc000, end 00ffefff ... OK
I've found some hints regarding this problem (load_address in the
wrapper script)=20
but this doesn't works for me.=20
I'm using Kernel v2.6.29 and U-Boot v1.3.0 on a customized MPC8313ERDB
board
Thank you for any help!
Kind regards
Frank
^ permalink raw reply
* [PATCH] PCI: Fix regression in powerpc MSI-X
From: Andre Detsch @ 2009-11-05 12:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1257399811.13611.94.camel@pasglop>
Patch f598282f5145036312d90875d0ed5c14b49fd8a7 exposed a problem in
powerpc MSI-X functionality, making network interfaces such as ixgbe
and cxgb3 stop to work when MSI-X is enabled. RX interrupts were not
being generated.
The problem was caused because MSI irq was not being effectively
unmasked after device initialization.
Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Index: linux-2.6/arch/powerpc/platforms/pseries/msi.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/msi.c 2009-11-04 06:35:39.000000000 -0700
+++ linux-2.6/arch/powerpc/platforms/pseries/msi.c 2009-11-04 07:23:27.000000000 -0700
@@ -432,8 +432,6 @@ static int rtas_setup_msi_irqs(struct pc
/* Read config space back so we can restore after reset */
read_msi_msg(virq, &msg);
entry->msg = msg;
-
- unmask_msi_irq(virq);
}
return 0;
Index: linux-2.6/arch/powerpc/platforms/pseries/xics.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/xics.c 2009-11-04 06:35:39.000000000 -0700
+++ linux-2.6/arch/powerpc/platforms/pseries/xics.c 2009-11-04 07:23:27.000000000 -0700
@@ -18,6 +18,7 @@
#include <linux/init.h>
#include <linux/radix-tree.h>
#include <linux/cpu.h>
+#include <linux/msi.h>
#include <linux/of.h>
#include <asm/firmware.h>
@@ -219,6 +220,14 @@ static void xics_unmask_irq(unsigned int
static unsigned int xics_startup(unsigned int virq)
{
+ /*
+ * The generic MSI code returns with the interrupt disabled on the
+ * card, using the MSI mask bits. Firmware doesn't appear to unmask
+ * at that level, so we do it here by hand.
+ */
+ if (irq_to_desc(virq)->msi_desc)
+ unmask_msi_irq(virq);
+
/* unmask it */
xics_unmask_irq(virq);
return 0;
^ permalink raw reply
* Re: [PATCH 1/3] fsl_pq_mdio: Fix compiler/sparse warnings (part 1)
From: Anton Vorontsov @ 2009-11-05 12:38 UTC (permalink / raw)
To: Kumar Gopalpet-B05799
Cc: netdev, Fleming Andy-AFLEMING, David Miller, linuxppc-dev
In-Reply-To: <9F4C7D19E8361D4C94921B95BE08B81B95069E@zin33exm22.fsl.freescale.net>
On Thu, Nov 05, 2009 at 11:11:56AM +0530, Kumar Gopalpet-B05799 wrote:
[...]
> >HI Anton, thanks for the changes. I have only one concern, has
> >this code been tried for ucc_geth ? I remember I had some
> >issues with getting the ucc_geth mdio also working. I will
> >take in these changes and try at my end for ucc_geth.
>
> Sorry, if my earlier statement was confusing. What I meant was with
> similar changes as Anton's changes
> I had some issues with ucc_geth mdio ( may be Anton's changes don't have
> that issue).
Nope, I see no issues on MPC8360E-MDS using ucc_geth and fsl_pq_mdio
drivers.
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: [PATCH][v2] powerpc/85xx: Create dts for each core in CAMP mode for P2020RDB
From: Kumar Gala @ 2009-11-05 13:15 UTC (permalink / raw)
To: Poonam Aggrwal; +Cc: linuxppc-dev
In-Reply-To: <1253380436-1590-1-git-send-email-poonam.aggrwal@freescale.com>
On Sep 19, 2009, at 12:13 PM, Poonam Aggrwal wrote:
> This patch creates the dts files for each core and splits the
> devices between
> the two cores for P2020RDB.
>
> core0 has memory, L2, i2c, spi, dma1, usb, eth0, eth1, crypto,
> global-util, pci0
> core1 has L2, dma2, eth0, pci1, msi.
>
> MPIC is shared between two cores but each core will protect its
> interrupts from other core by using "protected-sources" of mpic.
>
> Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
> ---
> - based on http://www.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git
> - branch->next
> - Removed interrupt properties for serial ports to make them work in
> polling mode.
> arch/powerpc/boot/dts/p2020rdb_camp_core0.dts | 363 ++++++++++++++++
> +++++++++
> arch/powerpc/boot/dts/p2020rdb_camp_core1.dts | 184 +++++++++++++
> arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 10 +-
> 3 files changed, 556 insertions(+), 1 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
> create mode 100644 arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
applied to next.
- k
^ permalink raw reply
* Re: [PATCH 1/7] powerpc/qe: Make qe_reset() code path safe for repeated invocation
From: Kumar Gala @ 2009-11-05 13:15 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Scott Wood, linuxppc-dev, Timur Tabi
In-Reply-To: <20090915214352.GA24821@oksana.dev.rtsoft.ru>
On Sep 15, 2009, at 4:43 PM, Anton Vorontsov wrote:
> For MPC8569 CPUs we'll need to reset QE after each suspend, so make
> qe_reset() code path suitable for repeated invocation, that is:
>
> - Don't initialize rheap structures if already initialized;
> - Don't allocate muram for SDMA if already allocated, just
> reinitialize
> registers with previously allocated muram offset;
> - Remove __init attributes from qe_reset() and cpm_muram_init();
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> arch/powerpc/include/asm/qe.h | 2 +-
> arch/powerpc/sysdev/cpm_common.c | 5 ++++-
> arch/powerpc/sysdev/qe_lib/qe.c | 12 +++++++-----
> 3 files changed, 12 insertions(+), 7 deletions(-)
applied to next.
- k
^ permalink raw reply
* Re: [PATCH 2/7] powerpc/qe: QE also shuts down on MPC8568
From: Kumar Gala @ 2009-11-05 13:15 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Scott Wood, linuxppc-dev, Timur Tabi
In-Reply-To: <20090915214354.GB24821@oksana.dev.rtsoft.ru>
On Sep 15, 2009, at 4:43 PM, Anton Vorontsov wrote:
> It appears that QE shuts down on all MPC85xx CPUs (i.e. MPC8568 and
> MPC8569) and thus needs reset upon resume.
>
> So modify qe_alive_during_sleep() to account that.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> arch/powerpc/include/asm/qe.h | 23 ++++++++++++++++++++++-
> arch/powerpc/sysdev/qe_lib/qe.c | 13 -------------
> 2 files changed, 22 insertions(+), 14 deletions(-)
applied to next.
- k
^ permalink raw reply
* Please pull from 'merge' branch for 2.6.32
From: Kumar Gala @ 2009-11-05 13:24 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
The following changes since commit 38634e6769920929385f1ffc8820dc3e893cc630:
Benjamin Herrenschmidt (1):
powerpc/kvm: Remove problematic BUILD_BUG_ON statement
are available in the git repository at:
master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git merge
Anton Vorontsov (2):
powerpc/85xx: Fix USB GPIOs for MPC8569E-MDS boards
powerpc/83xx: Fix u-boot partion size for MPC8377E-WLAN boards
Paul Gortmaker (1):
powerpc/85xx: sbc8548 - fixup of PCI-e related DTS fields
Roel Kluin (1):
powerpc/82xx: kmalloc failure ignored in ep8248e_mdio_probe()
arch/powerpc/boot/dts/mpc8377_wlan.dts | 2 +-
arch/powerpc/boot/dts/mpc8569mds.dts | 4 ++--
arch/powerpc/boot/dts/sbc8548.dts | 17 ++++++++---------
arch/powerpc/platforms/82xx/ep8248e.c | 15 ++++++++++++++-
4 files changed, 25 insertions(+), 13 deletions(-)
^ permalink raw reply
* Re: [PATCH][v4] powerpc/85xx: Added P1020RDB Platform support.
From: Kumar Gala @ 2009-11-05 13:30 UTC (permalink / raw)
To: Poonam Aggrwal; +Cc: linuxppc-dev
In-Reply-To: <1253852428-1156-1-git-send-email-poonam.aggrwal@freescale.com>
On Sep 24, 2009, at 11:20 PM, Poonam Aggrwal wrote:
> P1020 is another member of Freescale QorIQ series of processors.
> It is an e500 based dual core SOC.
> Being a scaled down version of P2020 it has following differences
> from P2020:
> - 533MHz - 800MHz core frequency.
> - 256Kbyte L2 cache
> - Ethernet controllers with classification capabilities(new
> controller).
>> From board perspective P1020RDB is same as P2020RDB.
>
> * This code adds the basic basic platform support for P1020RDB.
>
> Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
> ---
> - based on http://www.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git
> - branch->next
> - The patch does not contain ethernet support because P1020 contains
> new eTSEC
> controller. The support will be added in the later patches.
> - changes above v3-> minor change in a comment for localbus
> chipselects.
> PLEASE ignore the earlier patch mail with no subject.
> arch/powerpc/boot/dts/p1020rdb.dts | 477 ++++++++++++++++++++
> +++++++++
> arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 24 ++
> 2 files changed, 501 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/p1020rdb.dts
applied to next
- k
^ permalink raw reply
* Re: [PATCH] powerpc/85xx: Fix USB GPIOs for MPC8569E-MDS boards
From: Kumar Gala @ 2009-11-05 13:30 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Liu Yu
In-Reply-To: <20091016165013.GA13836@oksana.dev.rtsoft.ru>
On Oct 16, 2009, at 11:50 AM, Anton Vorontsov wrote:
> This patch fixes USB GPIOs numbers for MPC8569E-MDS boards, plus
> according to the latest HW Getting Started Guide (rev 3.3, pilot
> boards), USB "POWER" GPIO polarity has changed, it is no longer
> inverted.
>
> This patch makes USB Host somewhat work on pilot boards, though
> there are still some problems with determining devices speed and
> long bulk transfers.
>
> Reported-by: Liu Yu <Yu.Liu@freescale.com>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> arch/powerpc/boot/dts/mpc8569mds.dts | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
applied to merge
- k
^ permalink raw reply
* Re: [PATCH] powerpc/83xx: Fix u-boot partion size for MPC8377E-WLAN boards
From: Kumar Gala @ 2009-11-05 13:30 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev
In-Reply-To: <20091016164722.GA13433@oksana.dev.rtsoft.ru>
On Oct 16, 2009, at 11:47 AM, Anton Vorontsov wrote:
> u-boot partition size should be 0x80000 (512 KB), not 0x8000 (32 KB).
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> arch/powerpc/boot/dts/mpc8377_wlan.dts | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
applied to merge
- k
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox