FDT clean-ups and libfdt support
Subsystems (18)
cover FDT clean-ups and libfdt support
From: Rob Herring <[email protected]>
This is a series of clean-ups of architecture FDT code and converts the core FDT code over to using libfdt functions. This is in preparation to add FDT based address translation parsing functions for early console support.
The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need to be copied out of init section. Patches 2 and 3 should be applied to 3.15.
A branch is available here[1]. Please test! I've compiled on arm, arm64, mips, microblaze, and powerpc and booted on arm and arm64.
Rob
[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git libfdt
Rob Herring (20):
mips: octeon: convert to use unflatten_and_copy_device_tree
mips: lantiq: copy built-in DTB out of init section
mips: xlp: copy built-in DTB out of init section
mips: ralink: convert to use unflatten_and_copy_device_tree
ARM: dt: use default early_init_dt_alloc_memory_arch
c6x: convert fdt pointers to opaque pointers
mips: convert fdt pointers to opaque pointers of/fdt: consolidate built-in dtb section variables of/fdt: create common debugfs
of/fdt: remove some unneeded includes
of/fdt: remove unused of_scan_flat_dt_by_path of/fdt: update of_get_flat_dt_prop in prep for libfdt of/fdt: Convert FDT functions to use libfdt
of/fdt: use libfdt accessors for header data of/fdt: move memreserve and dtb memory reservations into core
build: add libfdt include path globally
powerpc: use libfdt accessors for header data
x86: use libfdt accessors for header data
of/fdt: convert initial_boot_params to opaque pointer
of: push struct boot_param_header and defines into powerpc
Makefile | 5 + arch/arc/include/asm/sections.h | 1 - arch/arc/kernel/devtree.c | 2 +- arch/arm/include/asm/prom.h | 2 - arch/arm/kernel/devtree.c | 34 +-- arch/arm/mach-exynos/exynos.c | 2 +- arch/arm/mach-vexpress/platsmp.c | 2 +- arch/arm/mm/init.c | 1 - arch/arm/plat-samsung/s5p-dev-mfc.c | 4 +- arch/arm64/mm/init.c | 21 -- arch/c6x/kernel/setup.c | 4 +- arch/metag/kernel/setup.c | 4 - arch/microblaze/kernel/prom.c | 37 +-- arch/mips/cavium-octeon/Makefile | 3 - arch/mips/cavium-octeon/setup.c | 18 +- arch/mips/include/asm/mips-boards/generic.h | 4 - arch/mips/include/asm/prom.h | 6 +- arch/mips/kernel/prom.c | 2 +- arch/mips/lantiq/prom.c | 15 +- arch/mips/lantiq/prom.h | 2 - arch/mips/mti-sead3/Makefile | 2 - arch/mips/mti-sead3/sead3-setup.c | 8 +- arch/mips/netlogic/xlp/dt.c | 17 +- arch/mips/ralink/of.c | 29 +-- arch/openrisc/kernel/vmlinux.h | 2 - arch/powerpc/include/asm/prom.h | 39 +++ arch/powerpc/kernel/epapr_paravirt.c | 2 +- arch/powerpc/kernel/fadump.c | 4 +- arch/powerpc/kernel/prom.c | 77 ++---- arch/powerpc/kernel/rtas.c | 2 +- arch/powerpc/mm/hash_utils_64.c | 22 +- arch/powerpc/platforms/52xx/efika.c | 4 +- arch/powerpc/platforms/chrp/setup.c | 4 +- arch/powerpc/platforms/powernv/opal.c | 12 +- arch/powerpc/platforms/pseries/setup.c | 4 +- arch/x86/kernel/devicetree.c | 7 +- arch/xtensa/kernel/setup.c | 3 +- drivers/of/Kconfig | 1 + drivers/of/fdt.c | 379 +++++++++------------------- drivers/of/of_reserved_mem.c | 4 +- include/linux/of_fdt.h | 64 +---- lib/Makefile | 2 - 42 files changed, 261 insertions(+), 596 deletions(-)
Signature · 1 line
1.8.3.2
PATCH 5/20 ARM: dt: use default early_init_dt_alloc_memory_arch
From: Rob Herring <[email protected]>
Now that ARM is using memblock instead of bootmem, the default version of early_init_dt_alloc_memory_arch can be used.
--- arch/arm/kernel/devtree.c | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/kernel/devtree.c +0 -5
@@ -32,11 +32,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)arm_add_memory (base, size); } -void *__init early_init_dt_alloc_memory_arch (u64 size,u64 align) -{ -return memblock_virt_alloc (size, align); -} -void __init arm_dt_memblock_reserve (void ) {u64 *reserve_map, base, size;
Signature · 1 line
1.8.3.2
PATCH 8/20 of/fdt: consolidate built-in dtb section variables
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Unify the various architectures __dtb_start and __dtb_end definitions moving them into of_fdt.h.
--- arch/arc/include/asm/sections.h | 1 - arch/metag/kernel/setup.c | 4 ---- arch/mips/include/asm/mips-boards/generic.h | 2 -- arch/mips/lantiq/prom.h | 2 -- arch/mips/netlogic/xlp/dt.c | 2 +- arch/mips/ralink/of.c | 2 -- arch/openrisc/kernel/vmlinux.h | 2 -- arch/xtensa/kernel/setup.c | 1 - include/linux/of_fdt.h | 3 +++ 9 files changed, 4 insertions(+), 15 deletions(-)
arch/arc/include/asm/sections.h +0 -1
@@ -12,6 +12,5 @@#include <asm-generic/sections.h> extern char __arc_dccm_base[]; -extern char __dtb_start[];#endif
arch/metag/kernel/setup.c +0 -4
@@ -105,10 +105,6 @@extern char _heap_start[]; -#ifdef CONFIG_METAG_BUILTIN_DTB -extern u32 __dtb_start[]; -#endif -#ifdef CONFIG_DA_CONSOLE /* Our early channel based console driver */ extern struct console dash_console;
arch/mips/include/asm/mips-boards/generic.h +0 -2
@@ -67,8 +67,6 @@extern int mips_revision_sconid; -extern char __dtb_start[]; -#ifdef CONFIG_PCI extern void mips_pcibios_init (void );#else
arch/mips/lantiq/prom.h +0 -2
@@ -26,6 +26,4 @@ struct ltq_soc_info {extern void ltq_soc_detect (struct ltq_soc_info *i);extern void ltq_soc_init (void ); -extern char __dtb_start[]; -#endif
arch/mips/netlogic/xlp/dt.c +1 -1
@@ -42,7 +42,7 @@#include <asm/prom.h> extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], - __dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[], __dtb_start[]; + __dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[];static void *xlp_fdt_blob;void __init *xlp_dt_init (void *fdtp)
arch/mips/ralink/of.c +0 -2
@@ -28,8 +28,6 @@__iomem void *rt_sysc_membase;__iomem void *rt_memc_membase; -extern char __dtb_start[]; -__iomem void *plat_of_remap_node (const char *node) {struct resource res;
arch/openrisc/kernel/vmlinux.h +0 -2
@@ -5,6 +5,4 @@extern char __initrd_start, __initrd_end;#endif -extern u32 __dtb_start[]; -#endif
arch/xtensa/kernel/setup.c +0 -1
@@ -73,7 +73,6 @@ extern int initrd_below_start_ok;#endif #ifdef CONFIG_OF -extern u32 __dtb_start[];void *dtb_start = __dtb_start;#endif
include/linux/of_fdt.h +3 -0
@@ -80,6 +80,9 @@ extern int __initdata dt_root_addr_cells;extern int __initdata dt_root_size_cells;extern struct boot_param_header *initial_boot_params; +extern char __dtb_start[]; +extern char __dtb_end[]; +/* For scanning the flat device-tree at boot time */ extern char *find_flat_dt_string (u32 offset); extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
Signature · 1 line
1.8.3.2
PATCH 1/20 mips: octeon: convert to use unflatten_and_copy_device_tree
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The octeon FDT code can be simplified by using unflatten_and_copy_device_tree function. This removes all accesses to FDT header data by the arch code.
--- arch/mips/cavium-octeon/setup.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
arch/mips/cavium-octeon/setup.c +5 -13
@@ -1058,31 +1058,23 @@ extern const char __dtb_octeon_68xx_begin;extern const char __dtb_octeon_68xx_end;void __init device_tree_init (void ) { -int dt_size; -struct boot_param_header *fdt; +void *fdt;bool do_prune;if (octeon_bootinfo->minor_version >=3 && octeon_bootinfo->fdt_addr) { fdt =phys_to_virt (octeon_bootinfo->fdt_addr);if (fdt_check_header (fdt))panic ("Corrupt Device Tree passed to kernel." ); - dt_size =be32_to_cpu (fdt->totalsize); do_prune = false; }else if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { - fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin; - dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin; + fdt = &__dtb_octeon_68xx_begin; do_prune = true; }else { - fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin; - dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin; + fdt = &__dtb_octeon_3xxx_begin; do_prune = true; } -/* Copy the default tree from init memory. */ - initial_boot_params =early_init_dt_alloc_memory_arch (dt_size,8 ); -if (initial_boot_params ==NULL ) -panic ("Could not allocate initial_boot_params" ); -memcpy (initial_boot_params, fdt, dt_size); + initial_boot_params = fdt;if (do_prune) {octeon_prune_device_tree ();
@@ -1090,7 +1082,7 @@ void __init device_tree_init(void) }else {pr_info ("Using passed Device Tree.\n" ); } -unflatten_device_tree (); +unflatten_and_copy_device_tree (); }static int __initdata disable_octeon_edac_p;
Signature · 1 line
1.8.3.2
PATCH 9/20 of/fdt: create common debugfs
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
This changes the path of the blob from "$arch/flat-device-tree" to "device-tree/flat-device-tree".
--- arch/microblaze/kernel/prom.c | 31 ------------------------------- arch/powerpc/kernel/prom.c | 21 --------------------- drivers/of/fdt.c | 24 ++++++++++++++++++++++++ 3 files changed, 24 insertions(+), 52 deletions(-)
arch/microblaze/kernel/prom.c +0 -31
@@ -114,34 +114,3 @@ void __init early_init_devtree(void *params)pr_debug (" <- early_init_devtree()\n" ); } - -/******* -* -* New implementation of the OF "find" APIs, return a refcounted -* object, call of_node_put() when done. The device tree and list -* are protected by a rw_lock. -* -* Note that property management will need some locking as well, -* this isn't dealt with yet. -* -*******/ - -#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree (void ) -{ -struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params->totalsize; - - d =debugfs_create_blob ("flat-device-tree" ,S_IFREG |S_IRUSR , - of_debugfs_root, &flat_dt_blob); -if (!d) -return 1 ; - -return 0 ; -} -device_initcall (export_flat_device_tree); -#endif
arch/powerpc/kernel/prom.c +0 -21
@@ -29,7 +29,6 @@#include <linux/bitops.h> #include <linux/export.h> #include <linux/kexec.h> -#include <linux/debugfs.h> #include <linux/irq.h> #include <linux/memblock.h> #include <linux/of.h>
@@ -918,23 +917,3 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id) {return (int )phys_id ==get_hard_smp_processor_id (cpu); } - -#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree (void ) -{ -struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size =be32_to_cpu (initial_boot_params->totalsize); - - d =debugfs_create_blob ("flat-device-tree" ,S_IFREG |S_IRUSR , - powerpc_debugfs_root, &flat_dt_blob); -if (!d) -return 1 ; - -return 0 ; -} -__initcall (export_flat_device_tree); -#endif
drivers/of/fdt.c +24 -0
@@ -20,6 +20,7 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/slab.h> +#include <linux/debugfs.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC
@@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void) unflatten_device_tree(); } +#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) +static struct debugfs_blob_wrapper flat_dt_blob; + +static int __init of_flat_dt_debugfs_export_fdt (void ) +{ +struct dentry *d =debugfs_create_dir ("device-tree" ,NULL ); + +if (!d) +return -ENOENT ; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size =fdt_totalsize (initial_boot_params); + + d =debugfs_create_blob ("flat-device-tree" ,S_IFREG |S_IRUSR , + d, &flat_dt_blob); +if (!d) +return -ENOENT ; + +return 0 ; +} +module_init (of_flat_dt_debugfs_export_fdt); +#endif +#endif /* CONFIG_OF_EARLY_FLATTREE */
Signature · 1 line
1.8.3.2
PATCH 4/20 mips: ralink: convert to use unflatten_and_copy_device_tree
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The ralink FDT code can be simplified by using unflatten_and_copy_device_tree function. This removes all accesses to FDT header data by the arch code.
--- arch/mips/ralink/of.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
arch/mips/ralink/of.c +1 -24
@@ -52,30 +52,7 @@ __iomem void *plat_of_remap_node(const char *node)void __init device_tree_init (void ) { -unsigned long base, size; -void *fdt_copy; - -if (!initial_boot_params) -return ; - - base =virt_to_phys ((void *)initial_boot_params); - size =be32_to_cpu (initial_boot_params->totalsize); - -/* Before we do anything, lets reserve the dt blob */ -reserve_bootmem (base, size,BOOTMEM_DEFAULT ); - -/* The strings in the flattened tree are referenced directly by the -* device tree, so copy the flattened device tree from init memory -* to regular memory. -*/ - fdt_copy =alloc_bootmem (size); -memcpy (fdt_copy, initial_boot_params, size); - initial_boot_params = fdt_copy; - -unflatten_device_tree (); - -/* free the space reserved for the dt blob */ -free_bootmem (base, size); +unflatten_and_copy_device_tree (); }void __init plat_mem_setup (void )
Signature · 1 line
1.8.3.2
PATCH 3/20 mips: xlp: copy built-in DTB out of init section
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The existing code is buggy because built-in DTBs are in init memory. It is also broken because the reserved bootmem was then freed after unflattening, but the unflattened tree points to data in the flat tree. Fix this by using the unflatten_and_copy_device_tree function.
This removes all accesses to FDT header data by the arch code.
--- arch/mips/netlogic/xlp/dt.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
arch/mips/netlogic/xlp/dt.c +1 -16
@@ -87,22 +87,7 @@ void __init xlp_early_init_devtree(void)void __init device_tree_init (void ) { -unsigned long base, size; -struct boot_param_header *fdtp = xlp_fdt_blob; - -if (!fdtp) -return ; - - base =virt_to_phys (fdtp); - size =be32_to_cpu (fdtp->totalsize); - -/* Before we do anything, lets reserve the dt blob */ -reserve_bootmem (base, size,BOOTMEM_DEFAULT ); - -unflatten_device_tree (); - -/* free the space reserved for the dt blob */ -free_bootmem (base, size); +unflatten_and_copy_device_tree (); }static struct of_device_id __initdata xlp_ids[] = {
Signature · 1 line
1.8.3.2
PATCH 20/20 of: push struct boot_param_header and defines into powerpc
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Now powerpc is the only user of struct boot_param_header and FDT defines, so they can be moved into the powerpc architecture code.
--- arch/powerpc/include/asm/prom.h | 39 +++++++++++++++++++++++++++++++++++++++ include/linux/of_fdt.h | 37 ------------------------------------- 2 files changed, 39 insertions(+), 37 deletions(-)
arch/powerpc/include/asm/prom.h +39 -0
@@ -26,6 +26,45 @@#include <linux/of_irq.h> #include <linux/platform_device.h> +#define OF_DT_BEGIN_NODE 0x1/* Start of node, full name */ +#define OF_DT_END_NODE 0x2/* End node */ +#define OF_DT_PROP 0x3/* Property: name off, size, +* content */ +#define OF_DT_NOP 0x4/* nop */ +#define OF_DT_END 0x9 + +#define OF_DT_VERSION 0x10 + +/* +* This is what gets passed to the kernel by prom_init or kexec +* +* The dt struct contains the device tree structure, full pathes and +* property contents. The dt strings contain a separate block with just +* the strings for the property names, and is fully page aligned and +* self contained in a page, so that it can be kept around by the kernel, +* each property name appears only once in this page (cheap compression) +* +* the mem_rsvmap contains a map of reserved ranges of physical memory, +* passing it here instead of in the device-tree itself greatly simplifies +* the job of everybody. It's just a list of u64 pairs (base/size) that +* ends when size is 0 +*/ +struct boot_param_header { +__be32 magic;/* magic word OF_DT_HEADER */ +__be32 totalsize;/* total size of DT block */ +__be32 off_dt_struct;/* offset to structure */ +__be32 off_dt_strings;/* offset to strings */ +__be32 off_mem_rsvmap;/* offset to memory reserve map */ +__be32 version;/* format version */ +__be32 last_comp_version;/* last compatible version */ +/* version 2 fields below */ +__be32 boot_cpuid_phys;/* Physical CPU id we're booting on */ +/* version 3 fields below */ +__be32 dt_strings_size;/* size of the DT strings block */ +/* version 17 fields below */ +__be32 dt_struct_size;/* size of the DT structure block */ +}; +/* * OF address retreival & translation */
include/linux/of_fdt.h +0 -37
@@ -17,47 +17,10 @@/* Definitions used by the flattened device tree */ #define OF_DT_HEADER 0xd00dfeed/* marker */ -#define OF_DT_BEGIN_NODE 0x1/* Start of node, full name */ -#define OF_DT_END_NODE 0x2/* End node */ -#define OF_DT_PROP 0x3/* Property: name off, size, -* content */ -#define OF_DT_NOP 0x4/* nop */ -#define OF_DT_END 0x9 - -#define OF_DT_VERSION 0x10#ifndef __ASSEMBLY__#include <linux/libfdt.h> -/* -* This is what gets passed to the kernel by prom_init or kexec -* -* The dt struct contains the device tree structure, full pathes and -* property contents. The dt strings contain a separate block with just -* the strings for the property names, and is fully page aligned and -* self contained in a page, so that it can be kept around by the kernel, -* each property name appears only once in this page (cheap compression) -* -* the mem_rsvmap contains a map of reserved ranges of physical memory, -* passing it here instead of in the device-tree itself greatly simplifies -* the job of everybody. It's just a list of u64 pairs (base/size) that -* ends when size is 0 -*/ -struct boot_param_header { -__be32 magic;/* magic word OF_DT_HEADER */ -__be32 totalsize;/* total size of DT block */ -__be32 off_dt_struct;/* offset to structure */ -__be32 off_dt_strings;/* offset to strings */ -__be32 off_mem_rsvmap;/* offset to memory reserve map */ -__be32 version;/* format version */ -__be32 last_comp_version;/* last compatible version */ -/* version 2 fields below */ -__be32 boot_cpuid_phys;/* Physical CPU id we're booting on */ -/* version 3 fields below */ -__be32 dt_strings_size;/* size of the DT strings block */ -/* version 17 fields below */ -__be32 dt_struct_size;/* size of the DT structure block */ -};#if defined(CONFIG_OF_FLATTREE )
Signature · 1 line
1.8.3.2
PATCH 10/20 of/fdt: remove some unneeded includes
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Whatever needed powerpc machdep.h appears to have been removed, so the include can be dropped.
module.h is not needed as this code is always built-in.
--- drivers/of/fdt.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/of/fdt.c +0 -5
@@ -12,7 +12,6 @@#include <linux/kernel.h> #include <linux/initrd.h> #include <linux/memblock.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/of_fdt.h> #include <linux/of_reserved_mem.h>
@@ -23,10 +22,6 @@#include <linux/debugfs.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ -#ifdef CONFIG_PPC -#include <asm/machdep.h> -#endif /* CONFIG_PPC */ -#include <asm/page.h> char *of_fdt_get_string (struct boot_param_header *blob,u32 offset)
Signature · 1 line
1.8.3.2
PATCH 12/20 of/fdt: update of_get_flat_dt_prop in prep for libfdt
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Make of_get_flat_dt_prop arguments compatible with libfdt fdt_getprop call in preparation to convert FDT code to use libfdt. Make the return value const and the property length ptr type an int.
--- arch/arc/kernel/devtree.c | 2 +- arch/arm/kernel/devtree.c | 2 +- arch/arm/mach-exynos/exynos.c | 2 +- arch/arm/mach-vexpress/platsmp.c | 2 +- arch/arm/plat-samsung/s5p-dev-mfc.c | 4 ++-- arch/microblaze/kernel/prom.c | 6 +++--- arch/powerpc/kernel/epapr_paravirt.c | 2 +- arch/powerpc/kernel/fadump.c | 4 ++-- arch/powerpc/kernel/prom.c | 24 +++++++++++---------- arch/powerpc/kernel/rtas.c | 2 +- arch/powerpc/mm/hash_utils_64.c | 22 +++++++++---------- arch/powerpc/platforms/52xx/efika.c | 4 ++-- arch/powerpc/platforms/chrp/setup.c | 4 ++-- arch/powerpc/platforms/powernv/opal.c | 12 +++++------ arch/powerpc/platforms/pseries/setup.c | 4 ++-- arch/xtensa/kernel/setup.c | 2 +- drivers/of/fdt.c | 39 +++++++++++++++++----------------- drivers/of/of_reserved_mem.c | 4 ++-- include/linux/of_fdt.h | 8 +++---- 19 files changed, 76 insertions(+), 73 deletions(-)
arch/arc/kernel/devtree.c +1 -1
@@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)const struct machine_desc *mdesc;unsigned long dt_root;void *clk; -unsigned long len; +int len;if (!early_init_dt_scan (dt))return NULL ;
arch/arm/kernel/devtree.c +1 -1
@@ -247,7 +247,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)if (!mdesc) {const char *prop; -long size; +int size;unsigned long dt_root; early_print("\nError: unrecognized/unsupported "
arch/arm/mach-exynos/exynos.c +1 -1
@@ -250,7 +250,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, {struct map_desc iodesc;__be32 *reg; -unsigned long len; +int len;if (!of_flat_dt_is_compatible (node,"samsung,exynos4210-chipid" ) && !of_flat_dt_is_compatible (node,"samsung,exynos5440-clock" ))
arch/arm/mach-vexpress/platsmp.c +1 -1
@@ -53,7 +53,7 @@ static int __init vexpress_dt_find_scu(unsigned long node, {if (of_flat_dt_match (node, vexpress_dt_cortex_a9_match)) {phys_addr_t phys_addr; -__be32 *reg =of_get_flat_dt_prop (node,"reg" ,NULL ); +const __be32 *reg =of_get_flat_dt_prop (node,"reg" ,NULL );if (WARN_ON (!reg))return -EINVAL ;
arch/arm/plat-samsung/s5p-dev-mfc.c +2 -2
@@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init);int __init s5p_fdt_alloc_mfc_mem (unsigned long node,const char *uname,int depth,void *data) { -__be32 *prop; -unsigned long len; +const __be32 *prop; +int len;struct s5p_mfc_dt_meminfo mfc_mem;if (!data)
arch/microblaze/kernel/prom.c +3 -3
@@ -48,8 +48,8 @@ static char *stdout;static int __init early_init_dt_scan_chosen_serial (unsigned long node,const char *uname,int depth,void *data) { -unsigned long l; -char *p; +int l; +const char *p;pr_debug ("%s: depth: %d, uname: %s\n" , __func__, depth, uname);
@@ -80,7 +80,7 @@ static int __init early_init_dt_scan_chosen_serial(unsigned long node, (strncmp(p, "xlnx,opb-uartlite", 17) == 0) || (strncmp(p, "xlnx,axi-uartlite", 17) == 0) || (strncmp(p, "xlnx,mdm", 8) == 0)) { -unsigned int *addrp; +const unsigned int *addrp; *(u32 *)data =UARTLITE ;
arch/powerpc/kernel/epapr_paravirt.c +1 -1
@@ -36,7 +36,7 @@ static int __init early_init_dt_scan_epapr(unsigned long node, int depth, void *data) { const u32 *insts; -unsigned long len; +int len;int i; insts =of_get_flat_dt_prop (node,"hcall-instructions" , &len);
arch/powerpc/kernel/fadump.c +2 -2
@@ -55,9 +55,9 @@ int crash_mem_ranges;int __init early_init_dt_scan_fw_dump (unsigned long node,const char *uname,int depth,void *data) { -__be32 *sections; +const __be32 *sections;int i, num_sections; -unsigned long size; +int size;const int *token;if (depth !=1 ||strcmp (uname,"rtas" ) !=0 )
arch/powerpc/kernel/prom.c +13 -11
@@ -162,7 +162,7 @@ static struct ibm_pa_feature { {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, }; -static void __init scan_features (unsigned long node,unsigned char *ftrs, +static void __init scan_features (unsigned long node,const unsigned char *ftrs,unsigned long tablelen,struct ibm_pa_feature *fp,unsigned long ft_size)
@@ -201,8 +201,8 @@ static void __init scan_features(unsigned long node, unsigned char *ftrs,static void __init check_cpu_pa_features (unsigned long node) { -unsigned char *pa_ftrs; -unsigned long tablelen; +const unsigned char *pa_ftrs; +int tablelen; pa_ftrs =of_get_flat_dt_prop (node,"ibm,pa-features" , &tablelen);if (pa_ftrs ==NULL )
@@ -215,7 +215,7 @@ static void __init check_cpu_pa_features(unsigned long node)#ifdef CONFIG_PPC_STD_MMU_64 static void __init check_cpu_slb_size (unsigned long node) { -__be32 *slb_size_ptr; +const __be32 *slb_size_ptr; slb_size_ptr =of_get_flat_dt_prop (node,"slb-size" ,NULL );if (slb_size_ptr !=NULL ) {
@@ -256,7 +256,7 @@ static struct feature_property {static inline void identical_pvr_fixup (unsigned long node) {unsigned int pvr; -char *model =of_get_flat_dt_prop (node,"model" ,NULL ); +const char *model =of_get_flat_dt_prop (node,"model" ,NULL );/* * Since 440GR(x)/440EP(x) processors have the same pvr,
@@ -294,11 +294,11 @@ static int __init early_init_dt_scan_cpus(unsigned long node, const char *uname, int depth, void *data) { - char *type = of_get_flat_dt_prop(node, "device_type", NULL); + const char *type = of_get_flat_dt_prop(node, "device_type", NULL);const __be32 *prop;const __be32 *intserv;int i, nthreads; -unsigned long len; +int len;int found =-1 ;int found_thread =0 ;
@@ -391,7 +391,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,int __init early_init_dt_scan_chosen_ppc (unsigned long node,const char *uname,int depth,void *data) { -unsigned long *lprop;/* All these set by kernel, so no need to convert endian */ +const unsigned long *lprop;/* All these set by kernel, so no need to convert endian */ /* Use common scan routine to determine if this is the chosen node */ if (early_init_dt_scan_chosen (node, uname, depth, data) ==0 )
@@ -442,8 +442,9 @@ int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,*/ static int __init early_init_dt_scan_drconf_memory (unsigned long node) { -__be32 *dm, *ls, *usm; -unsigned long l, n, flags; +const __be32 *dm, *ls, *usm; +int l; +unsigned long n, flags;u64 base, size, memblock_size;unsigned int is_kexec_kdump =0 , rngs;
@@ -563,7 +564,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)static void __init early_reserve_mem_dt (void ) { -unsigned long i, len, dt_root; +unsigned long i, dt_root; +int len;const __be32 *prop; dt_root =of_get_flat_dt_root ();
arch/powerpc/kernel/rtas.c +1 -1
@@ -1139,7 +1139,7 @@ void __init rtas_initialize(void)int __init early_init_dt_scan_rtas (unsigned long node,const char *uname,int depth,void *data) { -u32 *basep, *entryp, *sizep; +const u32 *basep, *entryp, *sizep;if (depth !=1 ||strcmp (uname,"rtas" ) !=0 )return 0 ;
arch/powerpc/mm/hash_utils_64.c +11 -11
@@ -265,9 +265,9 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node, const char *uname, int depth, void *data) { - char *type = of_get_flat_dt_prop(node, "device_type", NULL); -__be32 *prop; -unsigned long size =0 ; + const char *type = of_get_flat_dt_prop(node, "device_type", NULL); +const __be32 *prop; +int size =0 ;/* We are scanning "cpu" nodes only */ if (type ==NULL ||strcmp (type,"cpu" ) !=0 )
@@ -320,9 +320,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node, const char *uname, int depth, void *data) { - char *type = of_get_flat_dt_prop(node, "device_type", NULL); -__be32 *prop; -unsigned long size =0 ; + const char *type = of_get_flat_dt_prop(node, "device_type", NULL); +const __be32 *prop; +int size =0 ;/* We are scanning "cpu" nodes only */ if (type ==NULL ||strcmp (type,"cpu" ) !=0 )
@@ -402,9 +402,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,static int __init htab_dt_scan_hugepage_blocks (unsigned long node,const char *uname,int depth,void *data) { -char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); -__be64 *addr_prop; -__be32 *page_count_prop; +const char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); +const __be64 *addr_prop; +const __be32 *page_count_prop;unsigned int expected_pages;long unsigned int phys_addr;long unsigned int block_size;
@@ -546,8 +546,8 @@ static int __init htab_dt_scan_pftsize(unsigned long node, const char *uname, int depth, void *data) { - char *type = of_get_flat_dt_prop(node, "device_type", NULL); -__be32 *prop; + const char *type = of_get_flat_dt_prop(node, "device_type", NULL); +const __be32 *prop;/* We are scanning "cpu" nodes only */ if (type ==NULL ||strcmp (type,"cpu" ) !=0 )
arch/powerpc/platforms/52xx/efika.c +2 -2
@@ -199,8 +199,8 @@ static void __init efika_setup_arch(void)static int __init efika_probe (void ) { -char *model =of_get_flat_dt_prop (of_get_flat_dt_root (), -"model" ,NULL ); +const char *model =of_get_flat_dt_prop (of_get_flat_dt_root (), +"model" ,NULL );if (model ==NULL )return 0 ;
arch/powerpc/platforms/chrp/setup.c +2 -2
@@ -574,8 +574,8 @@ chrp_init2(void)static int __init chrp_probe (void ) { -char *dtype =of_get_flat_dt_prop (of_get_flat_dt_root (), -"device_type" ,NULL ); +const char *dtype =of_get_flat_dt_prop (of_get_flat_dt_root (), +"device_type" ,NULL );if (dtype ==NULL )return 0 ;if (strcmp (dtype,"chrp" ))
arch/powerpc/platforms/powernv/opal.c +6 -6
@@ -61,7 +61,7 @@ int __init early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data) { const void *basep, *entryp, *sizep; -unsigned long basesz, entrysz, runtimesz; +int basesz, entrysz, runtimesz;if (depth !=1 ||strcmp (uname,"ibm,opal" ) !=0 )return 0 ;
@@ -77,11 +77,11 @@ int __init early_init_dt_scan_opal(unsigned long node, opal.entry =of_read_number (entryp, entrysz/4 ); opal.size =of_read_number (sizep, runtimesz/4 ); -pr_debug ("OPAL Base = 0x%llx (basep=%p basesz=%ld)\n" , +pr_debug ("OPAL Base = 0x%llx (basep=%p basesz=%d)\n" , opal.base, basep, basesz); -pr_debug ("OPAL Entry = 0x%llx (entryp=%p basesz=%ld)\n" , +pr_debug ("OPAL Entry = 0x%llx (entryp=%p basesz=%d)\n" , opal.entry, entryp, entrysz); -pr_debug ("OPAL Entry = 0x%llx (sizep=%p runtimesz=%ld)\n" , +pr_debug ("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n" , opal.size, sizep, runtimesz); powerpc_firmware_features |=FW_FEATURE_OPAL ;
@@ -102,7 +102,7 @@ int __init early_init_dt_scan_opal(unsigned long node,int __init early_init_dt_scan_recoverable_ranges (unsigned long node,const char *uname,int depth,void *data) { -unsigned long i, size; +int i, size;const __be32 *prop;if (depth !=1 ||strcmp (uname,"ibm,opal" ) !=0 )
@@ -331,7 +331,7 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)if ((be64_to_cpu (evt) &OPAL_EVENT_CONSOLE_INPUT ) ==0 )return 0 ; len =cpu_to_be64 (count); - rc =opal_console_read (vtermno, &len, buf); + rc =opal_console_read (vtermno, &len, buf);if (rc ==OPAL_SUCCESS )return be64_to_cpu (len);return 0 ;
arch/powerpc/platforms/pseries/setup.c +2 -2
@@ -665,7 +665,7 @@ static int __init pseries_probe_fw_features(unsigned long node, void *data) {const char *prop; -unsigned long len; +int len;static int hypertas_found;static int vec5_found;
@@ -698,7 +698,7 @@ static int __init pseries_probe_fw_features(unsigned long node,static int __init pSeries_probe (void ) {unsigned long root =of_get_flat_dt_root (); -char *dtype =of_get_flat_dt_prop (root,"device_type" ,NULL ); +const char *dtype =of_get_flat_dt_prop (root,"device_type" ,NULL );if (dtype ==NULL )return 0 ;
arch/xtensa/kernel/setup.c +1 -1
@@ -220,7 +220,7 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname, int depth, void *data) { const __be32 *ranges; -unsigned long len; +int len;if (depth >1 )return 0 ;
drivers/of/fdt.c +20 -19
@@ -36,7 +36,7 @@ char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)*/ void *of_fdt_get_property (struct boot_param_header *blob,unsigned long node,const char *name, -unsigned long *size) +int *size) {unsigned long p = node;
@@ -86,7 +86,8 @@ int of_fdt_is_compatible(struct boot_param_header *blob, unsigned long node, const char *compat) { const char *cp; -unsigned long cplen, l, score =0 ; +int cplen; +unsigned long l, score =0 ; cp =of_fdt_get_property (blob, node,"compatible" , &cplen);if (cp ==NULL )
@@ -445,8 +446,8 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, {int t_len = (dt_root_addr_cells + dt_root_size_cells) *sizeof (__be32);phys_addr_t base, size; -unsigned long len; -__be32 *prop; +int len; +const __be32 *prop;int nomap, first =1 ; prop =of_get_flat_dt_prop (node,"reg" , &len);
@@ -489,7 +490,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,*/ static int __reserved_mem_check_root (unsigned long node) { -__be32 *prop; +const __be32 *prop; prop =of_get_flat_dt_prop (node,"#size-cells" ,NULL );if (!prop ||be32_to_cpup (prop) != dt_root_size_cells)
@@ -639,8 +640,8 @@ unsigned long __init of_get_flat_dt_root(void)* This function can be used within scan_flattened_dt callback to get * access to properties */ -void *__init of_get_flat_dt_prop (unsigned long node,const char *name, -unsigned long *size) +const void *__init of_get_flat_dt_prop (unsigned long node,const char *name, +int *size) {return of_fdt_get_property (initial_boot_params, node, name, size); }
@@ -711,7 +712,7 @@ const void * __init of_flat_dt_match_machine(const void *default_match, }if (!best_data) {const char *prop; -long size; +int size;pr_err ("\n unrecognized device tree list:\n[ " );
@@ -740,8 +741,8 @@ const void * __init of_flat_dt_match_machine(const void *default_match,static void __init early_init_dt_check_for_initrd (unsigned long node) {u64 start, end; -unsigned long len; -__be32 *prop; +int len; +const __be32 *prop;pr_debug ("Looking for initrd properties... " );
@@ -774,7 +775,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)int __init early_init_dt_scan_root (unsigned long node,const char *uname,int depth,void *data) { -__be32 *prop; +const __be32 *prop;if (depth !=0 )return 0 ;
@@ -796,9 +797,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,return 1 ; } -u64 __init dt_mem_next_cell (int s,__be32 **cellp) +u64 __init dt_mem_next_cell (int s,const __be32 **cellp) { -__be32 *p = *cellp; +const __be32 *p = *cellp; *cellp = p + s;return of_read_number (p, s);
@@ -810,9 +811,9 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp)int __init early_init_dt_scan_memory (unsigned long node,const char *uname,int depth,void *data) { -char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); -__be32 *reg, *endp; -unsigned long l; +const char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); +const __be32 *reg, *endp; +int l;/* We are scanning "memory" nodes only */ if (type ==NULL ) {
@@ -833,7 +834,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l /sizeof (__be32)); -pr_debug ("memory scan node %s, reg size %ld, data: %x %x %x %x,\n" , +pr_debug ("memory scan node %s, reg size %d, data: %x %x %x %x,\n" , uname, l, reg[0 ], reg[1 ], reg[2 ], reg[3 ]);while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
@@ -856,8 +857,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,int __init early_init_dt_scan_chosen (unsigned long node,const char *uname,int depth,void *data) { -unsigned long l; -char *p; +int l; +const char *p;pr_debug ("search \"chosen\", depth: %d, uname: %s\n" , depth, uname);
drivers/of/of_reserved_mem.c +2 -2
@@ -95,8 +95,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node,int t_len = (dt_root_addr_cells + dt_root_size_cells) *sizeof (__be32);phys_addr_t start =0 , end =0 ;phys_addr_t base =0 , align =0 , size; -unsigned long len; -__be32 *prop; +int len; +const __be32 *prop;int nomap;int ret;
include/linux/of_fdt.h +4 -4
@@ -66,7 +66,7 @@ extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);extern void *of_fdt_get_property (struct boot_param_header *blob,unsigned long node,const char *name, -unsigned long *size); +int *size);extern int of_fdt_is_compatible (struct boot_param_header *blob,unsigned long node,const char *compat);
@@ -88,8 +88,8 @@ extern char *find_flat_dt_string(u32 offset);extern int of_scan_flat_dt (int (*it)(unsigned long node,const char *uname,int depth,void *data),void *data); -extern void *of_get_flat_dt_prop (unsigned long node,const char *name, -unsigned long *size); +extern const void *of_get_flat_dt_prop (unsigned long node,const char *name, +int *size);extern int of_flat_dt_is_compatible (unsigned long node,const char *name);extern int of_flat_dt_match (unsigned long node,const char *const *matches);extern unsigned long of_get_flat_dt_root (void );
@@ -103,7 +103,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);extern int early_init_dt_reserve_memory_arch (phys_addr_t base,phys_addr_t size,bool no_map);extern void *early_init_dt_alloc_memory_arch (u64 size,u64 align); -extern u64 dt_mem_next_cell (int s,__be32 **cellp); +extern u64 dt_mem_next_cell (int s,const __be32 **cellp);/* Early flat tree scan hooks */ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
Signature · 1 line
1.8.3.2
PATCH 11/20 of/fdt: remove unused of_scan_flat_dt_by_path
In reply to Rob HerringFrom: Rob Herring <[email protected]>
of_scan_flat_dt_by_path is unused anywhere in the kernel, so remove it.
--- drivers/of/fdt.c | 67 -------------------------------------------------- include/linux/of_fdt.h | 3 --- 2 files changed, 70 deletions(-)
drivers/of/fdt.c +0 -67
@@ -672,73 +672,6 @@ struct fdt_scan_status {void *data; }; -/** -* fdt_scan_node_by_path - iterator for of_scan_flat_dt_by_path function -*/ -static int __init fdt_scan_node_by_path (unsigned long node,const char *uname, -int depth,void *data) -{ -struct fdt_scan_status *st = data; - -/* -* if scan at the requested fdt node has been completed, -* return -ENXIO to abort further scanning -*/ -if (depth <= st->depth) -return -ENXIO ; - -/* requested fdt node has been found, so call iterator function */ -if (st->found) -return st->iterator (node, uname, depth, st->data); - -/* check if scanning automata is entering next level of fdt nodes */ -if (depth == st->depth +1 && -strncmp (st->name, uname, st->namelen) ==0 && - uname[st->namelen] ==0 ) { - st->depth +=1 ; -if (st->name[st->namelen] ==0 ) { - st->found =1 ; - }else { -const char *next = st->name + st->namelen +1 ; - st->name = next; - st->namelen =strcspn (next,"/" ); - } -return 0 ; - } - -/* scan next fdt node */ -return 0 ; -} - -/** -* of_scan_flat_dt_by_path - scan flattened tree blob and call callback on each -* child of the given path. -* @path: path to start searching for children -* @it: callback function -* @data: context data pointer -* -* This function is used to scan the flattened device-tree starting from the -* node given by path. It is used to extract information (like reserved -* memory), which is required on ealy boot before we can unflatten the tree. -*/ -int __init of_scan_flat_dt_by_path (const char *path, -int (*it)(unsigned long node,const char *name,int depth,void *data), -void *data) -{ -struct fdt_scan_status st = {path,0 ,-1 ,0 , it, data}; -int ret =0 ; - -if (initial_boot_params) - ret =of_scan_flat_dt (fdt_scan_node_by_path, &st); - -if (!st.found) -return -ENOENT ; -else if (ret == -ENXIO )/* scan has been completed */ -return 0 ; -else -return ret; -} -const char *__init of_flat_dt_get_machine_name (void ) {const char *name;
include/linux/of_fdt.h +0 -3
@@ -93,9 +93,6 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,extern int of_flat_dt_is_compatible (unsigned long node,const char *name);extern int of_flat_dt_match (unsigned long node,const char *const *matches);extern unsigned long of_get_flat_dt_root (void ); -extern int of_scan_flat_dt_by_path (const char *path, -int (*it)(unsigned long node,const char *name,int depth,void *data), -void *data);extern int early_init_dt_scan_chosen (unsigned long node,const char *uname,int depth,void *data);
Signature · 1 line
1.8.3.2
PATCH 2/20 mips: lantiq: copy built-in DTB out of init section
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The existing code is buggy because built-in DTBs are in init memory. Fix this by using the unflatten_and_copy_device_tree function.
This removes all accesses to FDT header data by the arch code.
--- arch/mips/lantiq/prom.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
arch/mips/lantiq/prom.c +1 -12
@@ -76,18 +76,7 @@ void __init plat_mem_setup(void)void __init device_tree_init (void ) { -unsigned long base, size; - -if (!initial_boot_params) -return ; - - base =virt_to_phys ((void *)initial_boot_params); - size =be32_to_cpu (initial_boot_params->totalsize); - -/* Before we do anything, lets reserve the dt blob */ -reserve_bootmem (base, size,BOOTMEM_DEFAULT ); - -unflatten_device_tree (); +unflatten_and_copy_device_tree (); }void __init prom_init (void )
Signature · 1 line
1.8.3.2
PATCH 15/20 of/fdt: move memreserve and dtb memory reservations into core
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Move the /memreserve/ processing and dtb memory reservations into early_init_fdt_scan_reserved_mem. This converts arm, arm64, and powerpc as they are the only users of early_init_fdt_scan_reserved_mem.
memblock_reserve is safe to call on the same region twice, so the reservation check for the dtb in powerpc 32-bit reservations is safe to remove.
--- arch/arm/include/asm/prom.h | 2 -- arch/arm/kernel/devtree.c | 27 --------------------------- arch/arm/mm/init.c | 1 - arch/arm64/mm/init.c | 21 --------------------- arch/powerpc/kernel/prom.c | 22 ---------------------- drivers/of/fdt.c | 16 ++++++++++++++++ 6 files changed, 16 insertions(+), 73 deletions(-)
arch/arm/include/asm/prom.h +0 -2
@@ -14,7 +14,6 @@#ifdef CONFIG_OF extern const struct machine_desc *setup_machine_fdt (unsigned int dt_phys); -extern void arm_dt_memblock_reserve (void );extern void __init arm_dt_init_cpu_maps (void );#else /* CONFIG_OF */
@@ -24,7 +23,6 @@ static inline const struct machine_desc *setup_machine_fdt(unsigned int dt_phys) return NULL; } -static inline void arm_dt_memblock_reserve (void ) { }static inline void arm_dt_init_cpu_maps (void ) { }#endif /* CONFIG_OF */
arch/arm/kernel/devtree.c +0 -27
@@ -32,33 +32,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)arm_add_memory (base, size); } -void __init arm_dt_memblock_reserve (void ) -{ -u64 *reserve_map, base, size; - -if (!initial_boot_params) -return ; - -/* Reserve the dtb region */ -memblock_reserve (virt_to_phys (initial_boot_params), -be32_to_cpu (initial_boot_params->totalsize)); - -/* -* Process the reserve map. This will probably overlap the initrd -* and dtb locations which are already reserved, but overlaping -* doesn't hurt anything -*/ - reserve_map = ((void *)initial_boot_params) + -be32_to_cpu (initial_boot_params->off_mem_rsvmap); -while (1 ) { - base =be64_to_cpup (reserve_map++); - size =be64_to_cpup (reserve_map++); -if (!size) -break ; -memblock_reserve (base, size); - } -} -#ifdef CONFIG_SMP extern struct of_cpu_method __cpu_method_of_table_begin[];extern struct of_cpu_method __cpu_method_of_table_end[];
arch/arm/mm/init.c +0 -1
@@ -318,7 +318,6 @@ void __init arm_memblock_init(struct meminfo *mi,#endif arm_mm_memblock_reserve (); -arm_dt_memblock_reserve ();/* reserve any platform specific memblock areas */ if (mdesc->reserve)
arch/arm64/mm/init.c +0 -21
@@ -126,8 +126,6 @@ static void arm64_memory_present(void)void __init arm64_memblock_init (void ) { -u64 *reserve_map, base, size; -/* Register the kernel text, kernel data and initrd with memblock */ memblock_reserve (__pa (_text), _end - _text);#ifdef CONFIG_BLK_DEV_INITRD
@@ -142,25 +140,6 @@ void __init arm64_memblock_init(void)memblock_reserve (__pa (swapper_pg_dir),SWAPPER_DIR_SIZE );memblock_reserve (__pa (idmap_pg_dir),IDMAP_DIR_SIZE ); -/* Reserve the dtb region */ -memblock_reserve (virt_to_phys (initial_boot_params), -be32_to_cpu (initial_boot_params->totalsize)); - -/* -* Process the reserve map. This will probably overlap the initrd -* and dtb locations which are already reserved, but overlapping -* doesn't hurt anything -*/ - reserve_map = ((void *)initial_boot_params) + -be32_to_cpu (initial_boot_params->off_mem_rsvmap); -while (1 ) { - base =be64_to_cpup (reserve_map++); - size =be64_to_cpup (reserve_map++); -if (!size) -break ; -memblock_reserve (base, size); - } -early_init_fdt_scan_reserved_mem ();dma_contiguous_reserve (0 );
arch/powerpc/kernel/prom.c +0 -22
@@ -596,19 +596,11 @@ static void __init early_reserve_mem_dt(void)static void __init early_reserve_mem (void ) { -u64 base, size;__be64 *reserve_map; -unsigned long self_base; -unsigned long self_size; reserve_map = (__be64 *)(((unsigned long )initial_boot_params) +be32_to_cpu (initial_boot_params->off_mem_rsvmap)); -/* before we do anything, lets reserve the dt blob */ - self_base =__pa ((unsigned long )initial_boot_params); - self_size =be32_to_cpu (initial_boot_params->totalsize); -memblock_reserve (self_base, self_size); -/* Look for the new "reserved-regions" property in the DT */ early_reserve_mem_dt ();
@@ -637,26 +629,12 @@ static void __init early_reserve_mem(void) size_32 =be32_to_cpup (reserve_map_32++);if (size_32 ==0 )break ; -/* skip if the reservation is for the blob */ -if (base_32 == self_base && size_32 == self_size) -continue ;DBG ("reserving: %x -> %x\n" , base_32, size_32); memblock_reserve(base_32, size_32); }return ; }#endif -DBG ("Processing reserve map\n" ); - -/* Handle the reserve map in the fdt blob if it exists */ -while (1 ) { - base =be64_to_cpup (reserve_map++); - size =be64_to_cpup (reserve_map++); -if (size ==0 ) -break ; -DBG ("reserving: %llx -> %llx\n" , base, size); -memblock_reserve (base, size); - } }void __init early_init_devtree (void *params)
drivers/of/fdt.c +16 -0
@@ -486,9 +486,25 @@ static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname,*/ void __init early_init_fdt_scan_reserved_mem (void ) { +int n; +u64 base, size; +if (!initial_boot_params)return ; +/* Reserve the dtb region */ +early_init_dt_reserve_memory_arch (__pa (initial_boot_params), +fdt_totalsize (initial_boot_params), +0 ); + +/* Process header /memreserve/ fields */ +for (n =0 ; ; n++) { +fdt_get_mem_rsv (initial_boot_params, n, &base, &size); +if (!size) +break ; +early_init_dt_reserve_memory_arch (base, size,0 ); + } +of_scan_flat_dt (__fdt_scan_reserved_mem,NULL );fdt_init_reserved_mem (); }
Signature · 1 line
1.8.3.2
PATCH 16/20 build: add libfdt include path globally
In reply to Rob HerringFrom: Rob Herring <[email protected]>
In order use libfdt headers more widely available, make the libfdt include path globally available. It's a bit ugly, but other solutions would probably make importing libfdt more difficult.
--- Makefile | 5 +++++ arch/mips/cavium-octeon/Makefile | 3 --- arch/mips/mti-sead3/Makefile | 2 -- drivers/of/Makefile | 2 -- include/linux/of_fdt.h | 2 ++ lib/Makefile | 2 -- 6 files changed, 7 insertions(+), 9 deletions(-)
Makefile +5 -0
@@ -692,6 +692,11 @@ ifdef CONFIG_DYNAMIC_FTRACE endif endif +ifdef CONFIG_LIBFDT +KBUILD_CFLAGS += -I$(srctree)/scripts/dtc/libfdt +KBUILD_AFLAGS += -I$(srctree)/scripts/dtc/libfdt +endif + # We trigger additional mismatches with less inlining ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
arch/mips/cavium-octeon/Makefile +0 -3
@@ -9,9 +9,6 @@ # Copyright (C) 2005-2009 Cavium Networks # -CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt -CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt - obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o obj-y += dma-octeon.o obj-y += octeon-memcpy.o
arch/mips/mti-sead3/Makefile +0 -2
@@ -21,7 +21,5 @@ obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o obj-$(CONFIG_OF) += sead3.dtb.o -CFLAGS_sead3-setup.o = -I$(src)/../../../scripts/dtc/libfdt - $(obj)/%.dtb: $(obj)/%.dts $(call if_changed,dtc)
drivers/of/Makefile +0 -2
@@ -10,5 +10,3 @@ obj-$(CONFIG_OF_PCI) += of_pci.o obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o obj-$(CONFIG_OF_MTD) += of_mtd.o obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o - -CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
include/linux/of_fdt.h +2 -0
@@ -27,6 +27,8 @@#define OF_DT_VERSION 0x10#ifndef __ASSEMBLY__ +#include <linux/libfdt.h> +/* * This is what gets passed to the kernel by prom_init or kexec *
lib/Makefile +0 -2
@@ -150,8 +150,6 @@ obj-$(CONFIG_GENERIC_NET_UTILS) += net_utils.o obj-$(CONFIG_STMP_DEVICE) += stmp_device.o libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o -$(foreach file, $(libfdt_files), \ - $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) lib-$(CONFIG_LIBFDT) += $(libfdt_files) obj-$(CONFIG_RBTREE_TEST) += rbtree_test.o
Signature · 1 line
1.8.3.2
PATCH 19/20 of/fdt: convert initial_boot_params to opaque pointer
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Now that all accesses to FDT header data has been converted to accessor helpers, initial_boot_params can become an opaque pointer.
--- drivers/of/fdt.c | 2 +- include/linux/of_fdt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/of/fdt.c +1 -1
@@ -366,7 +366,7 @@ EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);int __initdata dt_root_addr_cells;int __initdata dt_root_size_cells; -struct boot_param_header *initial_boot_params; +void *initial_boot_params;#ifdef CONFIG_OF_EARLY_FLATTREE
include/linux/of_fdt.h +1 -1
@@ -80,7 +80,7 @@ extern void of_fdt_unflatten_tree(unsigned long *blob,/* TBD: Temporary export of fdt globals - remove when code fully merged */ extern int __initdata dt_root_addr_cells;extern int __initdata dt_root_size_cells; -extern struct boot_param_header *initial_boot_params; +extern void *initial_boot_params;extern char __dtb_start[];extern char __dtb_end[];
Signature · 1 line
1.8.3.2
PATCH 18/20 x86: use libfdt accessors for header data
In reply to Rob HerringFrom: Rob Herring <[email protected]>
With libfdt support, we can take advantage of helper accessors in libfdt for accessing the FDT header data. This makes the code more readable and makes the FDT blob structure more opaque to the kernel. This also prepares for removing struct boot_param_header completely.
--- arch/x86/kernel/devicetree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/kernel/devicetree.c +3 -4
@@ -206,16 +206,15 @@ static void __init dtb_apic_setup(void)static void __init x86_flattree_get_config (void ) {u32 size, map_len; -struct boot_param_header *dt; +const void *dt;if (!initial_dtb)return ; - map_len =max (PAGE_SIZE - (initial_dtb & ~PAGE_MASK ), - (u64 )sizeof (struct boot_param_header )); + map_len =max (PAGE_SIZE - (initial_dtb & ~PAGE_MASK ),FDT_V17_SIZE ); dt =early_memremap (initial_dtb, map_len); - size =be32_to_cpu (dt->totalsize); + size =fdt_totalsize (dt);if (map_len < size) {early_iounmap (dt, map_len); dt =early_memremap (initial_dtb, size);
Signature · 1 line
1.8.3.2
PATCH 17/20 powerpc: use libfdt accessors for header data
In reply to Rob HerringFrom: Rob Herring <[email protected]>
With libfdt support, we can take advantage of helper accessors in libfdt for accessing the FDT header data. This makes the code more readable and makes the FDT blob structure more opaque to the kernel. This also prepares for removing struct boot_param_header completely.
--- arch/powerpc/kernel/prom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/kernel/prom.c +5 -5
@@ -117,14 +117,14 @@ static void __init move_device_tree(void)DBG ("-> move_device_tree\n" ); start =__pa (initial_boot_params); - size =be32_to_cpu (initial_boot_params->totalsize); + size =fdt_totalsize (initial_boot_params);if ((memory_limit && (start + size) >PHYSICAL_START + memory_limit) ||overlaps_crashkernel (start, size) ||overlaps_initrd (start, size)) { p =__va (memblock_alloc (size,PAGE_SIZE ));memcpy (p, initial_boot_params, size); - initial_boot_params = (struct boot_param_header *)p; + initial_boot_params = p;DBG ("Moved device tree to 0x%p\n" , p); }
@@ -324,9 +324,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,* version 2 of the kexec param format adds the phys cpuid of * booted proc. */ -if (be32_to_cpu (initial_boot_params->version) >=2 ) { +if (fdt_version (initial_boot_params) >=2 ) {if (be32_to_cpu (intserv[i]) == -be32_to_cpu (initial_boot_params->boot_cpuid_phys)) { +fdt_boot_cpuid_phys (initial_boot_params)) { found = boot_cpu_count; found_thread = i; }
@@ -599,7 +599,7 @@ static void __init early_reserve_mem(void)__be64 *reserve_map; reserve_map = (__be64 *)(((unsigned long )initial_boot_params) + -be32_to_cpu (initial_boot_params->off_mem_rsvmap)); +fdt_off_mem_rsvmap (initial_boot_params));/* Look for the new "reserved-regions" property in the DT */ early_reserve_mem_dt ();
Signature · 1 line
1.8.3.2
PATCH 14/20 of/fdt: use libfdt accessors for header data
In reply to Rob HerringFrom: Rob Herring <[email protected]>
With libfdt support, we can take advantage of helper accessors in libfdt for accessing the FDT header data. This makes the code more readable and makes the FDT blob structure more opaque to the kernel. This also prepares for removing struct boot_param_header completely.
--- drivers/of/fdt.c | 27 ++++++++++++--------------- include/linux/of_fdt.h | 8 ++++---- 2 files changed, 16 insertions(+), 19 deletions(-)
drivers/of/fdt.c +12 -15
@@ -35,7 +35,7 @@* On match, returns a non-zero value with smaller values returned for more * specific compatible values. */ -int of_fdt_is_compatible (struct boot_param_header *blob, +int of_fdt_is_compatible (const void *blob,unsigned long node,const char *compat) {const char *cp;
@@ -60,7 +60,7 @@ int of_fdt_is_compatible(struct boot_param_header *blob,/** * of_fdt_match - Return true if node matches a list of compatible values */ -int of_fdt_match (struct boot_param_header *blob,unsigned long node, +int of_fdt_match (const void *blob,unsigned long node,const char *const *compat) {unsigned int tmp, score =0 ;
@@ -99,7 +99,7 @@ static void *unflatten_dt_alloc(void **mem, unsigned long size,* @allnextpp: pointer to ->allnext from last allocated device_node * @fpsize: Size of the node path up at the current depth. */ -static void * unflatten_dt_node(struct boot_param_header *blob, +static void * unflatten_dt_node(void *blob, void *mem, int *poffset, struct device_node *dad,
@@ -290,7 +290,7 @@ static void * unflatten_dt_node(struct boot_param_header *blob,* @dt_alloc: An allocator that provides a virtual address to memory * for the resulting tree */ -static void __unflatten_device_tree (struct boot_param_header *blob, +static void __unflatten_device_tree (void *blob,struct device_node **mynodes,void * (*dt_alloc)(u64 size,u64 align)) {
@@ -307,11 +307,11 @@ static void __unflatten_device_tree(struct boot_param_header *blob, }pr_debug ("Unflattening device tree:\n" ); -pr_debug ("magic: %08x\n" ,be32_to_cpu (blob->magic)); -pr_debug ("size: %08x\n" ,be32_to_cpu (blob->totalsize)); -pr_debug ("version: %08x\n" ,be32_to_cpu (blob->version)); +pr_debug ("magic: %08x\n" ,fdt_magic (blob)); +pr_debug ("size: %08x\n" ,fdt_totalsize (blob)); +pr_debug ("version: %08x\n" ,fdt_version (blob)); -if (be32_to_cpu (blob->magic) !=OF_DT_HEADER ) { +if (fdt_check_header (blob)) {pr_err ("Invalid device tree blob header\n" );return ; }
@@ -358,9 +358,7 @@ static void *kernel_tree_alloc(u64 size, u64 align)void of_fdt_unflatten_tree (unsigned long *blob,struct device_node **mynodes) { -struct boot_param_header *device_tree = - (struct boot_param_header *)blob; -__unflatten_device_tree (device_tree, mynodes, &kernel_tree_alloc); +__unflatten_device_tree (blob, mynodes, &kernel_tree_alloc); }EXPORT_SYMBOL_GPL (of_fdt_unflatten_tree);
@@ -847,7 +845,7 @@ bool __init early_init_dt_scan(void *params) initial_boot_params = params;/* check device tree validity */ -if (be32_to_cpu (initial_boot_params->magic) !=OF_DT_HEADER ) { +if (fdt_check_header (params)) { initial_boot_params =NULL ;return false; }
@@ -902,9 +900,8 @@ void __init unflatten_and_copy_device_tree(void)return ; } - size =__be32_to_cpu (initial_boot_params->totalsize); - dt =early_init_dt_alloc_memory_arch (size, - __alignof__(struct boot_param_header )); + size =fdt_totalsize (initial_boot_params); + dt =early_init_dt_alloc_memory_arch (size,FDT_V17_SIZE );if (dt) {memcpy (dt, initial_boot_params, size);
include/linux/of_fdt.h +4 -4
@@ -62,15 +62,15 @@ struct boot_param_header {struct device_node ;/* For scanning an arbitrary device-tree at any time */ -extern char *of_fdt_get_string (struct boot_param_header *blob,u32 offset); -extern void *of_fdt_get_property (struct boot_param_header *blob, +extern char *of_fdt_get_string (const void *blob,u32 offset); +extern void *of_fdt_get_property (const void *blob,unsigned long node,const char *name,int *size); -extern int of_fdt_is_compatible (struct boot_param_header *blob, +extern int of_fdt_is_compatible (const void *blob,unsigned long node,const char *compat); -extern int of_fdt_match (struct boot_param_header *blob,unsigned long node, +extern int of_fdt_match (const void *blob,unsigned long node,const char *const *compat);extern void of_fdt_unflatten_tree (unsigned long *blob,struct device_node **mynodes);
Signature · 1 line
1.8.3.2
PATCH 13/20 of/fdt: Convert FDT functions to use libfdt
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The kernel FDT functions predate libfdt and are much more limited in functionality. Also, the kernel functions and libfdt functions are not compatible with each other because they have different definitions of node offsets. To avoid this incompatibility and in preparation to add more FDT parsing functions which will need libfdt, let's first convert the existing code to use libfdt.
The FDT unflattening, top-level FDT scanning, and property retrieval functions are converted to use libfdt. The scanning code should be re-worked to be more efficient and understandable by using libfdt to find nodes directly by path or compatible strings.
--- drivers/of/Kconfig | 1 + drivers/of/Makefile | 2 + drivers/of/fdt.c | 201 ++++++++++++------------------------------------- include/linux/of_fdt.h | 1 - 4 files changed, 53 insertions(+), 152 deletions(-)
drivers/of/Kconfig +1 -0
@@ -20,6 +20,7 @@ config OF_SELFTEST config OF_FLATTREE bool select DTC + select LIBFDT config OF_EARLY_FLATTREE bool
drivers/of/Makefile +2 -0
@@ -10,3 +10,5 @@ obj-$(CONFIG_OF_PCI) += of_pci.o obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o obj-$(CONFIG_OF_MTD) += of_mtd.o obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o + +CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
drivers/of/fdt.c +50 -151
319 lines not on this page · raw message
include/linux/of_fdt.h +0 -1
@@ -84,7 +84,6 @@ extern char __dtb_start[];extern char __dtb_end[];/* For scanning the flat device-tree at boot time */ -extern char *find_flat_dt_string (u32 offset);extern int of_scan_flat_dt (int (*it)(unsigned long node,const char *uname,int depth,void *data),void *data);
Signature · 1 line
1.8.3.2
PATCH 7/20 mips: convert fdt pointers to opaque pointers
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The architecture code does not need to access the internals of the FDT blob, so make the pointer to it void *.
--- arch/mips/include/asm/mips-boards/generic.h | 4 +--- arch/mips/include/asm/prom.h | 6 +++--- arch/mips/kernel/prom.c | 2 +- arch/mips/lantiq/prom.c | 2 +- arch/mips/lantiq/prom.h | 2 +- arch/mips/mti-sead3/sead3-setup.c | 8 ++++---- arch/mips/ralink/of.c | 4 ++-- 7 files changed, 13 insertions(+), 15 deletions(-)
arch/mips/include/asm/mips-boards/generic.h +1 -3
@@ -67,9 +67,7 @@extern int mips_revision_sconid; -#ifdef CONFIG_OF -extern struct boot_param_header __dtb_start; -#endif +extern char __dtb_start[];#ifdef CONFIG_PCI extern void mips_pcibios_init (void );
arch/mips/include/asm/prom.h +3 -3
@@ -21,13 +21,13 @@ extern void device_tree_init(void);struct boot_param_header ; -extern void __dt_setup_arch (struct boot_param_header *bph); +extern void __dt_setup_arch (void *bph);#define dt_setup_arch (sym) \ ({ \ - extern struct boot_param_header __dtb_##sym##_begin; \ + extern char __dtb_##sym##_begin[]; \ \ - __dt_setup_arch(&__dtb_##sym##_begin); \ + __dt_setup_arch(__dtb_##sym##_begin); \ })#else /* CONFIG_OF */
arch/mips/kernel/prom.c +1 -1
@@ -47,7 +47,7 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)return __alloc_bootmem (size, align,__pa (MAX_DMA_ADDRESS )); } -void __init __dt_setup_arch (struct boot_param_header *bph) +void __init __dt_setup_arch (void *bph) {if (!early_init_dt_scan (bph))return ;
arch/mips/lantiq/prom.c +1 -1
@@ -71,7 +71,7 @@ void __init plat_mem_setup(void)* Load the builtin devicetree. This causes the chosen node to be * parsed resulting in our memory appearing */ -__dt_setup_arch (&__dtb_start); +__dt_setup_arch (__dtb_start); }void __init device_tree_init (void )
arch/mips/lantiq/prom.h +1 -1
@@ -26,6 +26,6 @@ struct ltq_soc_info {extern void ltq_soc_detect (struct ltq_soc_info *i);extern void ltq_soc_init (void ); -extern struct boot_param_header __dtb_start; +extern char __dtb_start[];#endif
arch/mips/mti-sead3/sead3-setup.c +4 -4
@@ -69,17 +69,17 @@ static void __init parse_memsize_param(void)if (!memsize)return ; - offset =fdt_path_offset (&__dtb_start,"/memory" ); + offset =fdt_path_offset (__dtb_start,"/memory" );if (offset >0 ) {uint64_t new_value;/* * reg contains 2 32-bits BE values, offset and size. We just * want to replace the size value without affecting the offset */ - prop_value =fdt_getprop (&__dtb_start, offset,"reg" , &prop_len); + prop_value =fdt_getprop (__dtb_start, offset,"reg" , &prop_len); new_value =be64_to_cpu (*prop_value); new_value = (new_value & ~0xffffffffllu ) | memsize; -fdt_setprop_inplace_u64 (&__dtb_start, offset,"reg" , new_value); +fdt_setprop_inplace_u64 (__dtb_start, offset,"reg" , new_value); } }
@@ -92,7 +92,7 @@ void __init plat_mem_setup(void)* Load the builtin devicetree. This causes the chosen node to be * parsed resulting in our memory appearing */ -__dt_setup_arch (&__dtb_start); +__dt_setup_arch (__dtb_start); }void __init device_tree_init (void )
arch/mips/ralink/of.c +2 -2
@@ -28,7 +28,7 @@__iomem void *rt_sysc_membase;__iomem void *rt_memc_membase; -extern struct boot_param_header __dtb_start; +extern char __dtb_start[];__iomem void *plat_of_remap_node (const char *node) {
@@ -63,7 +63,7 @@ void __init plat_mem_setup(void)* Load the builtin devicetree. This causes the chosen node to be * parsed resulting in our memory appearing */ -__dt_setup_arch (&__dtb_start); +__dt_setup_arch (__dtb_start);if (soc_info.mem_size) add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
Signature · 1 line
1.8.3.2
PATCH 6/20 c6x: convert fdt pointers to opaque pointers
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The architecture code does not need to access the internals of the FDT blob, so make the pointer to it void *.
--- arch/c6x/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/c6x/kernel/setup.c +2 -2
@@ -265,8 +265,8 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)*/ notrace void __init machine_init(unsigned long dt_ptr) { -struct boot_param_header *dtb =__va (dt_ptr); -struct boot_param_header *fdt = (struct boot_param_header *)_fdt_start; +const void *dtb =__va (dt_ptr); +const void *fdt = (const void *)_fdt_start;/* interrupts must be masked */ set_creg (IER ,2 );
Signature · 1 line
1.8.3.2
Re: [PATCH 06/20] c6x: convert fdt pointers to opaque pointers
Hi Rob,
arch/c6x/kernel/setup.c int __init c6x_add_memory(phys_addr_t start, unsigned long size) · line 269
Quoted 10 lines · Rob Herring
arch/c6x/kernel/setup.c +2
-2@@ -265,8 +265,8 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)*/ notrace void __init machine_init(unsigned long dt_ptr) { -struct boot_param_header *dtb =__va (dt_ptr); -struct boot_param_header *fdt = (struct boot_param_header *)_fdt_start; +const void *dtb =__va (dt_ptr); +const void *fdt = (const void *)_fdt_start;
Unless it has changed recently, _fdt_start is "char _fdt_start[]", so the cast should not be needed.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Michal Simek
maintainerRe: [PATCH 09/20] of/fdt: create common debugfs
In reply to Rob HerringQuoted 40 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
This changes the path of the blob from "$arch/flat-device-tree" to "device-tree/flat-device-tree".
Signed-off-by Rob Herring <[email protected]>Cc Michal Simek <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>--- arch/microblaze/kernel/prom.c | 31 ------------------------------- arch/powerpc/kernel/prom.c | 21 --------------------- drivers/of/fdt.c | 24 ++++++++++++++++++++++++ 3 files changed, 24 insertions(+), 52 deletions(-)arch/microblaze/kernel/prom.c +0
-11@@ -114,34 +114,3 @@ void __init early_init_devtree(void *params)pr_debug (" <- early_init_devtree()\n" ); } - -/******* -* -* New implementation of the OF "find" APIs, return a refcounted -* object, call of_node_put() when done. The device tree and list -* are protected by a rw_lock. -* -* Note that property management will need some locking as well, -* this isn't dealt with yet. -* -*******/
arch/microblaze/kernel/prom.c void __init early_init_devtree(void *params) · line 137
Quoted 10 lines
arch/microblaze/kernel/prom.c +0
-10- -#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree (void ) -{ -struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params->totalsize;
As I see even microblaze version was buggy.
...
Quoted 18 lines
drivers/of/fdt.c +3
-0@@ -20,6 +20,7 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/slab.h> +#include <linux/debugfs.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void)unflatten_device_tree (); } +#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) +static struct debugfs_blob_wrapper flat_dt_blob;
drivers/of/fdt.c void __init unflatten_and_copy_device_tree(void) · line 1099
Quoted 10 lines
drivers/of/fdt.c +10
-0+ +static int __init of_flat_dt_debugfs_export_fdt (void ) +{ +struct dentry *d =debugfs_create_dir ("device-tree" ,NULL ); + +if (!d) +return -ENOENT ; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size =fdt_totalsize (initial_boot_params);
Have you tried to compile this?
From my tests fdt_totalsize is not available for target just for host from libfdt.h
drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt':drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration]
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Michal Simek
maintainerRe: [PATCH 09/20] of/fdt: create common debugfs
Quoted 31 lines
Quoted 18 lines
drivers/of/fdt.c +3
-0@@ -20,6 +20,7 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/slab.h> +#include <linux/debugfs.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void)unflatten_device_tree (); } +#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) +static struct debugfs_blob_wrapper flat_dt_blob;drivers/of/fdt.c void __init unflatten_and_copy_device_tree(void) · line 1099
Quoted 10 lines
drivers/of/fdt.c +10
-0+ +static int __init of_flat_dt_debugfs_export_fdt (void ) +{ +struct dentry *d =debugfs_create_dir ("device-tree" ,NULL ); + +if (!d) +return -ENOENT ; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size =fdt_totalsize (initial_boot_params);Have you tried to compile this?
Quoted 5 lines
From my tests
fdt_totalsizeis not available for target just for host fromlibfdt.h
drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt':drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration]
Ignore this one - there is no compilation problem.
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Re: [PATCH 09/20] of/fdt: create common debugfs
In reply to Michal SimekQuoted 10 lines · Michal Simek
Quoted 9 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
This changes the path of the blob from "$arch/flat-device-tree" to "device-tree/flat-device-tree".
[snip]
Quoted 11 lines
arch/microblaze/kernel/prom.c void __init early_init_devtree(void *params) · line 137
Quoted 9 lines
arch/microblaze/kernel/prom.c +0
-9-#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree (void ) -{ -struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params->totalsize;As I see even microblaze version was buggy.
How so?
Quoted 33 lines
...
Quoted 18 lines
drivers/of/fdt.c +3
-0@@ -20,6 +20,7 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/slab.h> +#include <linux/debugfs.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void)unflatten_device_tree (); } +#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) +static struct debugfs_blob_wrapper flat_dt_blob;drivers/of/fdt.c void __init unflatten_and_copy_device_tree(void) · line 1099
Quoted 10 lines
drivers/of/fdt.c +10
-0+ +static int __init of_flat_dt_debugfs_export_fdt (void ) +{ +struct dentry *d =debugfs_create_dir ("device-tree" ,NULL ); + +if (!d) +return -ENOENT ; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size =fdt_totalsize (initial_boot_params);Have you tried to compile this?
Quoted 5 lines
From my tests
fdt_totalsizeis not available for target just for host fromlibfdt.h
drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt':drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration]
Ah, it needs to be re-ordered after the libfdt conversion when libfdt.h gets added.
Rob
Michal Simek
maintainerRe: [PATCH 09/20] of/fdt: create common debugfs
Quoted 26 lines · Rob Herring
Quoted 10 lines · Michal Simek
Quoted 9 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
This changes the path of the blob from "$arch/flat-device-tree" to "device-tree/flat-device-tree".
[snip]
Quoted 11 lines
arch/microblaze/kernel/prom.c void __init early_init_devtree(void *params) · line 137
Quoted 9 lines
arch/microblaze/kernel/prom.c +0
-9-#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree (void ) -{ -struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params->totalsize;As I see even microblaze version was buggy.
Quoted 1 line
How so?
if you compare it with powerpc version here is missing be to cpu conversion.
Quoted 34 lines
Quoted 34 lines
...
Quoted 18 lines
drivers/of/fdt.c +3
-0@@ -20,6 +20,7 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/slab.h> +#include <linux/debugfs.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void)unflatten_device_tree (); } +#if defined(CONFIG_DEBUG_FS ) && defined(DEBUG ) +static struct debugfs_blob_wrapper flat_dt_blob;drivers/of/fdt.c void __init unflatten_and_copy_device_tree(void) · line 1099
Quoted 10 lines
drivers/of/fdt.c +10
-0+ +static int __init of_flat_dt_debugfs_export_fdt (void ) +{ +struct dentry *d =debugfs_create_dir ("device-tree" ,NULL ); + +if (!d) +return -ENOENT ; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size =fdt_totalsize (initial_boot_params);Have you tried to compile this?
Quoted 8 lines
Quoted 5 lines
From my tests
fdt_totalsizeis not available for target just for host fromlibfdt.h
drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt':drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration]Ah, it needs to be re-ordered after the libfdt conversion when
libfdt.hgets added.
I just pick some of them not all of them and send email. :-(
Anyway I am testing it for microblaze and getting problem caused by this patch:
commit 3d2ee8571ac0580d49c3f41fa28336289934900a
Author: Rob Herring <[email protected]> Date: Wed Apr 2 15:10:14 2014 -0500
of/fdt: Convert FDT functions to use libfdt
And reason is that in unflatten_dt_node()
pathp = fdt_get_name(blob, *poffset, &l);
is returning NULL
and here
/* 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) != '/') {code is trying to read it which is causing this kernel bug:
Oops: kernel access of bad area, sig: 11
It means fdt_next_node(is doing something wrong)
Any easy way how to debug it?
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
/*
* Device Tree Generator version: 1.1
*
* (C) Copyright 2007-2013 Xilinx, Inc.
* (C) Copyright 2007-2013 Michal Simek
* (C) Copyright 2007-2012 PetaLogix Qld Pty Ltd
*
* Michal SIMEK <[email protected]>
*
* CAUTION: This file is automatically generated by libgen.
* Version: Xilinx EDK 2013.3 EDK_P.20131013
* Today is: Thursday, the 21 of November, 2013; 19:47:51 *
* XPS project directory: .
*/
/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,microblaze";
hard-reset-gpios = <&reset_gpio 0 1>;
model = ".";
aliases {
ethernet0 = &axi_ethernet_eth_buf;
serial0 = &rs232_uart;
} ;
chosen {
bootargs = "console=ttyS0,115200 earlyprintk";
linux,stdout-path = "/axi@0/serial@40400000";
} ;
cpus {
#address-cells = <1>;
#cpus = <0x1>;
#size-cells = <0>;
microblaze_0: cpu@0 {
bus-handle = <µblaze_0_axi_periph_xbar>;
clock-frequency = <100000000>;
compatible = "xlnx,microblaze-9.2";
d-cache-baseaddr = <0x80000000>;
d-cache-highaddr = <0xbfffffff>;
d-cache-line-size = <0x20>;
d-cache-size = <0x4000>;
device_type = "cpu";
i-cache-baseaddr = <0x80000000>;
i-cache-highaddr = <0xbfffffff>;
i-cache-line-size = <0x10>;
i-cache-size = <0x4000>;
interrupt-handle = <µblaze_0_axi_intc>;
model = "microblaze,9.2";
reg = <0>;
timebase-frequency = <100000000>;
xlnx,addr-tag-bits = <0x10>;
xlnx,allow-dcache-wr = <0x1>;
xlnx,allow-icache-wr = <0x1>;
xlnx,area-optimized = <0x0>;
xlnx,async-interrupt = <0x1>;
xlnx,avoid-primitives = <0x0>;
xlnx,base-vectors = <0x0>;
xlnx,branch-target-cache-size = <0x0>;
xlnx,cache-byte-size = <0x4000>;
xlnx,d-axi = <0x1>;
xlnx,d-lmb = <0x1>;
xlnx,data-size = <0x20>;
xlnx,dcache-addr-tag = <0x10>;
xlnx,dcache-always-used = <0x1>;
xlnx,dcache-byte-size = <0x4000>;
xlnx,dcache-data-width = <0x0>;
xlnx,dcache-force-tag-lutram = <0x0>;
xlnx,dcache-line-len = <0x8>;
xlnx,dcache-use-writeback = <0x1>;
xlnx,dcache-victims = <0x0>;
xlnx,debug-enabled = <0x1>;
xlnx,div-zero-exception = <0x1>;
xlnx,dynamic-bus-sizing = <0x0>;
xlnx,ecc-use-ce-exception = <0x0>;
xlnx,edge-is-positive = <0x0>;
xlnx,enable-discrete-ports = <0x0>;
xlnx,endianness = <0x1>;
xlnx,fault-tolerant = <0x0>;
xlnx,fpu-exception = <0x0>;
xlnx,freq = <0x5f5e100>;
xlnx,fsl-exception = <0x0>;
xlnx,fsl-links = <0x0>;
xlnx,i-axi = <0x0>;
xlnx,i-lmb = <0x1>;
xlnx,icache-always-used = <0x1>;
xlnx,icache-data-width = <0x0>;
xlnx,icache-force-tag-lutram = <0x0>;
xlnx,icache-line-len = <0x4>;
xlnx,icache-streams = <0x1>;
xlnx,icache-victims = <0x8>;
xlnx,ill-opcode-exception = <0x1>;
xlnx,instance = "kc705_microblaze_0_0";
xlnx,interconnect = <0x2>;
xlnx,interrupt-is-edge = <0x0>;
xlnx,lockstep-select = <0x0>;
xlnx,lockstep-slave = <0x0>;
xlnx,mmu-dtlb-size = <0x4>;
xlnx,mmu-itlb-size = <0x2>;
xlnx,mmu-privileged-instr = <0x0>;
xlnx,mmu-tlb-access = <0x3>;
xlnx,mmu-zones = <0x2>;
xlnx,number-of-pc-brk = <0x1>;
xlnx,number-of-rd-addr-brk = <0x0>;
xlnx,number-of-wr-addr-brk = <0x0>;
xlnx,opcode-0x0-illegal = <0x1>;
xlnx,optimization = <0x0>;
xlnx,pc-width = <0x20>;
xlnx,pvr = <0x2>;
xlnx,pvr-user1 = <0x0>;
xlnx,pvr-user2 = <0x0>;
xlnx,reset-msr = <0x0>;
xlnx,sco = <0x0>;
xlnx,trace = <0x0>;
xlnx,unaligned-exceptions = <0x1>;
xlnx,use-barrel = <0x1>;
xlnx,use-branch-target-cache = <0x1>;
xlnx,use-config-reset = <0x0>;
xlnx,use-dcache = <0x1>;
xlnx,use-div = <0x1>;
xlnx,use-ext-brk = <0x0>;
xlnx,use-ext-nm-brk = <0x0>;
xlnx,use-extended-fsl-instr = <0x0>;
xlnx,use-fpu = <0x0>;
xlnx,use-hw-mul = <0x2>;
xlnx,use-icache = <0x1>;
xlnx,use-interrupt = <0x2>;
xlnx,use-mmu = <0x3>;
xlnx,use-msr-instr = <0x1>;
xlnx,use-pcmp-instr = <0x1>;
xlnx,use-reorder-instr = <0x1>;
xlnx,use-stack-protection = <0x0>;
} ;
} ;
ddr3_sdram: memory@80000000 {
device_type = "memory";
reg = <0x80000000 0x40000000>;
} ;
microblaze_0_axi_periph_xbar: axi@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,axi-crossbar-2.1", "simple-bus";
ranges ;
axi_ethernet_dma: axi-dma@41e00000 {
axistream-connected = <&axi_ethernet_eth_buf>;
axistream-control-connected = <&axi_ethernet_eth_buf>;
compatible = "xlnx,axi-dma-7.1", "xlnx,axi-dma-1.00.a";
interrupt-parent = <µblaze_0_axi_intc>;
interrupts = <2 2>, <3 2>;
reg = <0x41e00000 0x10000>;
xlnx,dlytmr-resolution = <0x7d>;
xlnx,enable-multi-channel = <0x0>;
xlnx,include-mm2s = <0x1>;
xlnx,include-mm2s-dre = <0x1>;
xlnx,include-mm2s-sf = <0x1>;
xlnx,include-s2mm = <0x1>;
xlnx,include-s2mm-dre = <0x1>;
xlnx,include-s2mm-sf = <0x1>;
xlnx,include-sg = <0x1>;
xlnx,micro-dma = <0x0>;
xlnx,mm2s-burst-size = <0x10>;
xlnx,num-mm2s-channels = <0x1>;
xlnx,num-s2mm-channels = <0x1>;
xlnx,prmry-is-aclk-async = <0x0>;
xlnx,s2mm-burst-size = <0x10>;
xlnx,sg-include-stscntrl-strm = <0x1>;
xlnx,sg-length-width = <0xe>;
xlnx,sg-use-stsapp-length = <0x1>;
} ;
axi_ethernet_eth_buf: axi-ethernet@44a00000 {
axistream-connected = <&axi_ethernet_dma>;
axistream-control-connected = <&axi_ethernet_dma>;
clock-frequency = <100000000>;
compatible = "xlnx,axi-ethernet-buffer-2.0", "xlnx,axi-ethernet-1.00.a";
device_type = "network";
interrupt-parent = <µblaze_0_axi_intc>;
interrupts = <1 2>;
local-mac-address = [ 00 0a 35 00 42 4a ];
phy-handle = <&phy0>;
reg = <0x44a00000 0x40000>;
xlnx,avb = <0x0>;
xlnx,halfdup = "1";
xlnx,include-io = "1";
xlnx,mcast-extend = <0x0>;
xlnx,phy-type = <0x1>;
xlnx,phyaddr = <0x1>;
xlnx,rxcsum = <0x0>;
xlnx,rxmem = <0x1000>;
xlnx,rxvlan-strp = <0x0>;
xlnx,rxvlan-tag = <0x0>;
xlnx,rxvlan-tran = <0x0>;
xlnx,stats = <0x0>;
xlnx,txcsum = <0x0>;
xlnx,txmem = <0x1000>;
xlnx,txvlan-strp = <0x0>;
xlnx,txvlan-tag = <0x0>;
xlnx,txvlan-tran = <0x0>;
xlnx,type = <0x1>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@7 {
compatible = "marvell,88e1111";
device_type = "ethernet-phy";
reg = <7>;
} ;
} ;
} ;
axi_timer_0: system-timer@41c00000 {
clock-frequency = <100000000>;
compatible = "xlnx,axi-timer-2.0", "xlnx,xps-timer-1.00.a";
interrupt-parent = <µblaze_0_axi_intc>;
interrupts = <0 2>;
reg = <0x41c00000 0x10000>;
xlnx,count-width = <0x20>;
xlnx,gen0-assert = <0x1>;
xlnx,gen1-assert = <0x1>;
xlnx,one-timer-only = <0x0>;
xlnx,trig0-assert = <0x1>;
xlnx,trig1-assert = <0x1>;
} ;
dip_switches_4bits: gpio@40010000 {
#gpio-cells = <2>;
compatible = "xlnx,axi-gpio-2.0", "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x40010000 0x10000>;
xlnx,all-inputs = <0x1>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x0>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,gpio-width = <0x4>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
led_8bits: gpio@40020000 {
#gpio-cells = <2>;
compatible = "xlnx,axi-gpio-2.0", "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x40020000 0x10000>;
xlnx,all-inputs = <0x0>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x1>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,gpio-width = <0x8>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
microblaze_0_axi_intc: interrupt-controller@41200000 {
#interrupt-cells = <0x2>;
compatible = "xlnx,axi-intc-4.0", "xlnx,xps-intc-1.00.a";
interrupt-controller ;
reg = <0x41200000 0x10000>;
xlnx,kind-of-intr = <0x0>;
xlnx,num-intr-inputs = <0x5>;
} ;
primary_flash: flash@60000000 {
#address-cells = <1>;
#size-cells = <1>;
bank-width = <2>;
compatible = "xlnx,axi-emc-2.0", "cfi-flash";
reg = <0x60000000 0x8000000>;
xlnx,axi-clk-period-ps = <0x2710>;
xlnx,include-datawidth-matching-0 = <0x1>;
xlnx,include-datawidth-matching-1 = <0x1>;
xlnx,include-datawidth-matching-2 = <0x1>;
xlnx,include-datawidth-matching-3 = <0x1>;
xlnx,include-negedge-ioregs = <0x0>;
xlnx,instance = "axi_emc_inst";
xlnx,lflash-period-ps = <0x4e20>;
xlnx,linear-flash-sync-burst = <0x0>;
xlnx,max-mem-width = <0x10>;
xlnx,mem0-type = <0x2>;
xlnx,mem0-width = <0x10>;
xlnx,mem1-type = <0x2>;
xlnx,mem1-width = <0x10>;
xlnx,mem2-type = <0x2>;
xlnx,mem2-width = <0x10>;
xlnx,mem3-type = <0x2>;
xlnx,mem3-width = <0x10>;
xlnx,num-banks-mem = <0x1>;
xlnx,parity-type-mem-0 = <0x0>;
xlnx,parity-type-mem-1 = <0x0>;
xlnx,parity-type-mem-2 = <0x0>;
xlnx,parity-type-mem-3 = <0x0>;
xlnx,s-axi-en-reg = <0x0>;
xlnx,s-axi-mem-addr-width = <0x20>;
xlnx,s-axi-mem-data-width = <0x20>;
xlnx,s-axi-mem-id-width = <0x1>;
xlnx,s-axi-reg-addr-width = <0x5>;
xlnx,s-axi-reg-data-width = <0x20>;
xlnx,synch-pipedelay-0 = <0x1>;
xlnx,synch-pipedelay-1 = <0x1>;
xlnx,synch-pipedelay-2 = <0x1>;
xlnx,synch-pipedelay-3 = <0x1>;
xlnx,tavdv-ps-mem-0 = <0x1fbd0>;
xlnx,tavdv-ps-mem-1 = <0x3a98>;
xlnx,tavdv-ps-mem-2 = <0x3a98>;
xlnx,tavdv-ps-mem-3 = <0x3a98>;
xlnx,tcedv-ps-mem-0 = <0x1fbd0>;
xlnx,tcedv-ps-mem-1 = <0x3a98>;
xlnx,tcedv-ps-mem-2 = <0x3a98>;
xlnx,tcedv-ps-mem-3 = <0x3a98>;
xlnx,thzce-ps-mem-0 = <0x1b58>;
xlnx,thzce-ps-mem-1 = <0x1b58>;
xlnx,thzce-ps-mem-2 = <0x1b58>;
xlnx,thzce-ps-mem-3 = <0x1b58>;
xlnx,thzoe-ps-mem-0 = <0x1b58>;
xlnx,thzoe-ps-mem-1 = <0x1b58>;
xlnx,thzoe-ps-mem-2 = <0x1b58>;
xlnx,thzoe-ps-mem-3 = <0x1b58>;
xlnx,tlzwe-ps-mem-0 = <0xc350>;
xlnx,tlzwe-ps-mem-1 = <0x0>;
xlnx,tlzwe-ps-mem-2 = <0x0>;
xlnx,tlzwe-ps-mem-3 = <0x0>;
xlnx,tpacc-ps-flash-0 = <0x61a8>;
xlnx,tpacc-ps-flash-1 = <0x61a8>;
xlnx,tpacc-ps-flash-2 = <0x61a8>;
xlnx,tpacc-ps-flash-3 = <0x61a8>;
xlnx,twc-ps-mem-0 = <0x3a98>;
xlnx,twc-ps-mem-1 = <0x3a98>;
xlnx,twc-ps-mem-2 = <0x3a98>;
xlnx,twc-ps-mem-3 = <0x3a98>;
xlnx,twp-ps-mem-0 = <0x13880>;
xlnx,twp-ps-mem-1 = <0x2ee0>;
xlnx,twp-ps-mem-2 = <0x2ee0>;
xlnx,twp-ps-mem-3 = <0x2ee0>;
xlnx,twph-ps-mem-0 = <0x13880>;
xlnx,twph-ps-mem-1 = <0x2ee0>;
xlnx,twph-ps-mem-2 = <0x2ee0>;
xlnx,twph-ps-mem-3 = <0x2ee0>;
xlnx,wr-rec-time-mem-0 = <0x186a0>;
xlnx,wr-rec-time-mem-1 = <0x6978>;
xlnx,wr-rec-time-mem-2 = <0x6978>;
xlnx,wr-rec-time-mem-3 = <0x6978>;
partition@0x00000000 {
label = "fpga";
reg = <0x00000000 0x00b00000>;
};
partition@0x00b00000 {
label = "boot";
reg = <0x00b00000 0x00040000>;
};
partition@0x00b40000 {
label = "bootenv";
reg = <0x00b40000 0x00020000>;
};
partition@0x00b60000 {
label = "image";
reg = <0x00b60000 0x00c00000>;
};
partition@0x01760000 {
label = "spare";
reg = <0x01760000 0x00000000>;
};
} ;
push_buttons_5bits: gpio@40030000 {
#gpio-cells = <2>;
compatible = "xlnx,axi-gpio-2.0", "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x40030000 0x10000>;
xlnx,all-inputs = <0x1>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x0>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,gpio-width = <0x5>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
reset_gpio: gpio@40000000 {
#gpio-cells = <2>;
compatible = "xlnx,axi-gpio-2.0", "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x40000000 0x10000>;
xlnx,all-inputs = <0x0>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x1>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,gpio-width = <0x1>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
rs232_uart: serial@40400000 {
clock-frequency = <100000000>;
compatible = "xlnx,axi-uart16550-2.0", "xlnx,xps-uart16550-2.00.a", "ns16550a";
current-speed = <115200>;
device_type = "serial";
interrupt-parent = <µblaze_0_axi_intc>;
interrupts = <4 2>;
reg = <0x40400000 0x2000>;
reg-offset = <0x1000>;
reg-shift = <2>;
xlnx,external-xin-clk-hz = <0x17d7840>;
xlnx,external-xin-clk-hz-d = <0x19>;
xlnx,has-external-rclk = <0x0>;
xlnx,has-external-xin = <0x0>;
xlnx,is-a-16550 = <0x1>;
xlnx,s-axi-aclk-freq-hz-d = <0x64>;
xlnx,use-modem-ports = <0x1>;
xlnx,use-user-ports = <0x1>;
} ;
} ;
} ;Re: [PATCH 09/20] of/fdt: create common debugfs
Quoted 33 lines · Michal Simek
Quoted 10 lines · Rob Herring
Quoted 7 lines · Michal Simek
Quoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
[snip]
Anyway I am testing it for microblaze and getting problem caused by this patch:
commit3d2ee8571ac0580d49c3f41fa28336289934900aAuthor: Rob Herring <[email protected]> Date: Wed Apr 2 15:10:14 2014 -0500of/fdt: Convert FDT functions to use libfdt
And reason is that in
unflatten_dt_node()pathp =
fdt_get_name(blob, *poffset, &l);is returning NULL
and here
/* version0x10has 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) != '/') {
Quoted 6 lines
code is trying to read it which is causing this kernel bug:
Oops: kernel access of bad area, sig: 11It means
fdt_next_node(is doing something wrong)Any easy way how to debug it?
I didn't think fdt_get_path should fail. Can you add a print of *poffset and pathp values.
Rob
Michal Simek
maintainerRe: [PATCH 09/20] of/fdt: create common debugfs
Quoted 37 lines · Rob Herring
Quoted 36 lines · Michal Simek
Quoted 10 lines · Rob Herring
Quoted 7 lines · Michal Simek
Quoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
[snip]
Anyway I am testing it for microblaze and getting problem caused by this patch:
commit3d2ee8571ac0580d49c3f41fa28336289934900aAuthor: Rob Herring <[email protected]> Date: Wed Apr 2 15:10:14 2014 -0500of/fdt: Convert FDT functions to use libfdt
And reason is that in
unflatten_dt_node()pathp =
fdt_get_name(blob, *poffset, &l);is returning NULL
and here
/* version0x10has 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) != '/') {code is trying to read it which is causing this kernel bug:
Oops: kernel access of bad area, sig: 11
Quoted 6 lines
Quoted 3 lines
It means
fdt_next_node(is doing something wrong)Any easy way how to debug it?
I didn't think
fdt_get_pathshould fail. Can you add a print of *poffset and pathp values.
Early console on uart16650 at 0x40401000
bootconsole [earlyser0] enabled
Ramdisk addr 0x00000000,
FDT at 0x806b96d4
Linux version 3.14.0-rc8-next-20140331-12541-g43b5fdb-dirty (monstr@monstr-desktop) (gcc version 4.6.4 20120924 (prerelease) (crosstool-NG 1.18.0) ) #51 Fri Apr 4 16:09:17 CEST 2014
-> unflatten_device_tree()
Unflattening device tree:
magic: d00dfeed
size: 00014e20
version: 00000011unflatten_dt_node blob c0298b00, c0331f84 0unflatten_dt_node 1a c0298b3c/ -- len 0unflatten_dt_node 8 old offset 0unflatten_dt_node 8 new offset 6cunflatten_dt_node blob c0298b00, c0331f84 6cunflatten_dt_node 1a c0298ba8/aliases -- len 7unflatten_dt_node 8 old offset 6cunflatten_dt_node 8 new offset ccunflatten_dt_node blob c0298b00, c0331f84 ccunflatten_dt_node 1a c0298c08/chosen -- len 6unflatten_dt_node 8 old offset ccunflatten_dt_node 8 new offset 130unflatten_dt_node blob c0298b00, c0331f84 130unflatten_dt_node 1a c0298c6c/cpus -- len 4unflatten_dt_node 8 old offset 130unflatten_dt_node 8 new offset 16cunflatten_dt_node blob c0298b00, c0331f84 16cunflatten_dt_node 1a c0298ca8/cpu@0 -- len 5unflatten_dt_node 8 old offset 16cunflatten_dt_node 8 new offset 7bcunflatten_dt_node blob c0298b00, c0331f84 7bcunflatten_dt_node 1a (null)/NULL -- len fffffffc
Below is the possition of debug messages.
Thanks,
Michal
drivers/of/fdt.c +9 -0
@@ -8,6 +8,7 @@* modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ +#define DEBUG #include <linux/kernel.h> #include <linux/initrd.h>
@@ -116,9 +117,15 @@ static void * unflatten_dt_node(struct boot_param_header *blob,int has_name =0 ;int new_format =0 ; +printk ("%s blob %x, %x %x\n" , __func__, blob, poffset, *poffset); + pathp =fdt_get_name (blob, *poffset, &l); +printk ("%s 1a %p/%s -- len %x\n" , __func__, pathp, pathp ? pathp :"NULL" , l); + allocl = l++; +if (!pathp) +while (1 );/* 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
@@ -267,7 +274,9 @@ static void * unflatten_dt_node(struct boot_param_header *blob, } old_depth = depth; +printk ("%s 8 old offset %x\n" , __func__, *poffset); *poffset =fdt_next_node (blob, *poffset, &depth); +printk ("%s 8 new offset %x\n" , __func__, *poffset);while (*poffset >0 && depth > old_depth) { mem =unflatten_dt_node (blob, mem, poffset, np, allnextpp, fpsize);
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Re: [PATCH 09/20] of/fdt: create common debugfs
Quoted 38 lines · Michal Simek
Quoted 37 lines · Rob Herring
Quoted 36 lines · Michal Simek
Quoted 10 lines · Rob Herring
Quoted 7 lines · Michal Simek
Quoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
[snip]
Anyway I am testing it for microblaze and getting problem caused by this patch:
commit3d2ee8571ac0580d49c3f41fa28336289934900aAuthor: Rob Herring <[email protected]> Date: Wed Apr 2 15:10:14 2014 -0500of/fdt: Convert FDT functions to use libfdt
And reason is that in
unflatten_dt_node()pathp =
fdt_get_name(blob, *poffset, &l);is returning NULL
and here
/* version0x10has 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) != '/') {code is trying to read it which is causing this kernel bug:
Oops: kernel access of bad area, sig: 11
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
It means
fdt_next_node(is doing something wrong)Any easy way how to debug it?
I didn't think
fdt_get_pathshould fail. Can you add a print of *poffset and pathp values.
I think I've fixed this now and updated the branch. Please test again when you have a chance.
Thanks,
Rob
Michal Simek
maintainerRe: [PATCH 09/20] of/fdt: create common debugfs
Quoted 41 lines · Rob Herring
Quoted 40 lines · Michal Simek
Quoted 39 lines · Rob Herring
Quoted 38 lines · Michal Simek
Quoted 10 lines · Rob Herring
Quoted 7 lines · Michal Simek
Quoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added.
[snip]
Anyway I am testing it for microblaze and getting problem caused by this patch:
commit3d2ee8571ac0580d49c3f41fa28336289934900aAuthor: Rob Herring <[email protected]> Date: Wed Apr 2 15:10:14 2014 -0500of/fdt: Convert FDT functions to use libfdt
And reason is that in
unflatten_dt_node()pathp =
fdt_get_name(blob, *poffset, &l);is returning NULL
and here
/* version0x10has 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) != '/') {code is trying to read it which is causing this kernel bug:
Oops: kernel access of bad area, sig: 11It means
fdt_next_node(is doing something wrong)
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Any easy way how to debug it?
I didn't think
fdt_get_pathshould fail. Can you add a print of *poffset and pathp values.I think I've fixed this now and updated the branch. Please test again when you have a chance.
yep. The updated branch works for Microblaze.
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Re: [PATCH 08/20] of/fdt: consolidate built-in dtb section variables
In reply to Rob HerringQuoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
Unify the various architectures
__dtb_startand__dtb_enddefinitions moving them intoof_fdt.h.
Quoted 11 lines
Signed-off-by Rob Herring <[email protected]>Cc Vineet Gupta <[email protected]>Cc James Hogan <[email protected]>Cc Ralf Baechle <[email protected]>Cc Jonas Bonn <[email protected]>Cc Chris Zankel <[email protected]>Cc Max Filippov <[email protected]>
Cheers
James
Re: [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree
In reply to Rob HerringQuoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
The octeon FDT code can be simplified by using
unflatten_and_copy_device_treefunction. This removes all accesses to FDT header data by the arch code.
Hi Rob,
I think (in general) this modification is ok. But I suggest to use following (slightly modified) version.
Thanks,
Andreas
-- 8< --
Subject: MIPS: Octeon: Convert to use unflatten_and_copy_device_tree
From: Rob Herring <[email protected]>
The octeon FDT code can be simplified by using unflatten_and_copy_device_tree function. This removes all accesses to FDT header data by the arch code.
[andreas.herrmann: * Fixed compile problem:
arch/mips/cavium-octeon/setup.c: In function 'device_tree_init':
arch/mips/cavium-octeon/setup.c:1070:7: error: assignment discards 'const' qualifier from pointer target type [-Werror] arch/mips/cavium-octeon/setup.c:1073:7: error: assignment discards 'const' qualifier from pointer target type [-Werror]
* Removed (now) obsolete extern declarations (for __dtb_octeon_3xxx_end, __dtb_octeon_68xx_end)]
--- arch/mips/cavium-octeon/setup.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
arch/mips/cavium-octeon/setup.c +5 -15
@@ -1053,36 +1053,26 @@ void prom_free_prom_memory(void)int octeon_prune_device_tree (void );extern const char __dtb_octeon_3xxx_begin; -extern const char __dtb_octeon_3xxx_end;extern const char __dtb_octeon_68xx_begin; -extern const char __dtb_octeon_68xx_end;void __init device_tree_init (void ) { -int dt_size; -struct boot_param_header *fdt; +const void *fdt;bool do_prune;if (octeon_bootinfo->minor_version >=3 && octeon_bootinfo->fdt_addr) { fdt =phys_to_virt (octeon_bootinfo->fdt_addr);if (fdt_check_header (fdt))panic ("Corrupt Device Tree passed to kernel." ); - dt_size =be32_to_cpu (fdt->totalsize); do_prune = false; }else if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { - fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin; - dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin; + fdt = &__dtb_octeon_68xx_begin; do_prune = true; }else { - fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin; - dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin; + fdt = &__dtb_octeon_3xxx_begin; do_prune = true; } -/* Copy the default tree from init memory. */ - initial_boot_params =early_init_dt_alloc_memory_arch (dt_size,8 ); -if (initial_boot_params ==NULL ) -panic ("Could not allocate initial_boot_params" ); -memcpy (initial_boot_params, fdt, dt_size); + initial_boot_params = (void *)fdt;if (do_prune) {octeon_prune_device_tree ();
@@ -1090,7 +1080,7 @@ void __init device_tree_init(void) }else {pr_info ("Using passed Device Tree.\n" ); } -unflatten_device_tree (); +unflatten_and_copy_device_tree (); }static int __initdata disable_octeon_edac_p;
Signature · 1 line
1.7.9.5
Max Filippov
maintainerRe: [PATCH 14/20] of/fdt: use libfdt accessors for header data
In reply to Rob HerringHi Rob,
Quoted 17 lines · Rob Herring
From: Rob Herring <[email protected]>
With libfdt support, we can take advantage of helper accessors in libfdt for accessing the FDT header data. This makes the code more readable and makes the FDT blob structure more opaque to the kernel. This also prepares for removing struct
boot_param_headercompletely.Signed-off-by Rob Herring <[email protected]>--- drivers/of/fdt.c | 27 ++++++++++++--------------- include/linux/of_fdt.h | 8 ++++---- 2 files changed, 16 insertions(+), 19 deletions(-)drivers/of/fdt.c +0
-0
[...]
drivers/of/fdt.c void __init unflatten_and_copy_device_tree(void) · line 904
Quoted 9 lines
drivers/of/fdt.c +2
-3@@ -902,9 +900,8 @@ void __init unflatten_and_copy_device_tree(void)return ; } - size =__be32_to_cpu (initial_boot_params->totalsize); - dt =early_init_dt_alloc_memory_arch (size, - __alignof__(struct boot_param_header )); + size =fdt_totalsize (initial_boot_params); + dt =early_init_dt_alloc_memory_arch (size,FDT_V17_SIZE );
This change triggers BUG_ON(align & (align - 1)) in the alloc_bootmem_bdata() on xtensa.
Signature · 2 lines
Thanks. -- Max
Re: [PATCH 08/20] of/fdt: consolidate built-in dtb section variables
In reply to Rob HerringHi Rob,
Quoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
Unify the various architectures
__dtb_startand__dtb_enddefinitions moving them intoof_fdt.h.
Quoted 11 lines
Signed-off-by Rob Herring <[email protected]>Cc Vineet Gupta <vgupta-HKixBCOQz3hWk0Htik3J/[email protected]>Cc James Hogan <[email protected]>Cc Ralf Baechle <ralf-6z/[email protected]>Cc Jonas Bonn <[email protected]>Cc Chris Zankel <[email protected]>Cc Max Filippov <[email protected]>Cc linux-mips-6z/[email protected]Cc linux-xtensa-PjhNF2WwrV/[email protected]
Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree
In reply to Andreas HerrmannQuoted 11 lines · Andreas Herrmann
Quoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
The octeon FDT code can be simplified by using
unflatten_and_copy_device_treefunction. This removes all accesses to FDT header data by the arch code.Hi Rob,
I think (in general) this modification is ok. But I suggest to use following (slightly modified) version.
Having to compile each platform on MIPS sure is annoying. Reminds me of ARM a few years ago. We need a good rant from Linus about MIPS. ;)
arch/mips/cavium-octeon/setup.c void prom_free_prom_memory(void) · line 1075
Quoted 7 lines
arch/mips/cavium-octeon/setup.c +1
-5-/* Copy the default tree from init memory. */ - initial_boot_params =early_init_dt_alloc_memory_arch (dt_size,8 ); -if (initial_boot_params ==NULL ) -panic ("Could not allocate initial_boot_params" ); -memcpy (initial_boot_params, fdt, dt_size); + initial_boot_params = (void *)fdt;
Does calling early_init_devtree here work instead. This will add parsing memory, initrd and command line. If you don't have those then it should be a nop other than setting initial_boot_params. It should only matter if your DT has these things and you want/need to ignore them. Do this would get things more inline with other arches.
Rob
Re: [PATCH 06/20] c6x: convert fdt pointers to opaque pointers
In reply to Geert UytterhoevenHi Rob,
Quoted 14 lines · Geert Uytterhoeven
arch/c6x/kernel/setup.c int __init c6x_add_memory(phys_addr_t start, unsigned long size) · line 269
Quoted 10 lines · Rob Herring
arch/c6x/kernel/setup.c +2
-2@@ -265,8 +265,8 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)*/ notrace void __init machine_init(unsigned long dt_ptr) { -struct boot_param_header *dtb =__va (dt_ptr); -struct boot_param_header *fdt = (struct boot_param_header *)_fdt_start; +const void *dtb =__va (dt_ptr); +const void *fdt = (const void *)_fdt_start;Unless it has changed recently,
_fdt_startis "char _fdt_start[]", so the cast should not be needed.
Also, just noticed the following with evmc6678_defconfig arch/c6x/kernel/setup.c: In function ‘machine_init’:arch/c6x/kernel/setup.c:290:21: warning: passing argument 1 of ‘early_init_dt_scan’ discards ‘const’ qualifier from pointer target type
early_init_dt_scan(fdt);
^In file included from arch/c6x/kernel/setup.c:19:0:include/linux/of_fdt.h:75:13: note: expected ‘void *’ but argument is of type ‘const void *’
extern bool early_init_dt_scan(void *params);
on current tip "af13e86 Merge branch 'drm-fixes' ofgit://people.freedesktop.org/~airlied/linux"
Compiler used:
c6x-linux-gnu-gcc (GCC) 4.9.2 20150107 (Red Hat Cross 4.9.2-3) Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.