* [PATCH 0/2] Make of_fdt conditionally compile gracefully
@ 2010-02-22 15:50 Grant Likely
2010-02-22 15:50 ` [PATCH 1/2] of/flattree: make of_fdt.h safe to unconditionally include Grant Likely
2010-02-22 15:50 ` [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch Grant Likely
0 siblings, 2 replies; 6+ messages in thread
From: Grant Likely @ 2010-02-22 15:50 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
monstr-pSz03upnqPeHXe+LvDLADg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw
A couple more minor changes for cross-arch device tree support.
g.
---
Grant Likely (2):
of/flattree: Make unflatten_device_tree() safe to call from any arch
of/flattree: make of_fdt.h safe to unconditionally include.
drivers/of/fdt.c | 15 +++++++++++++++
include/linux/of_fdt.h | 4 ++++
2 files changed, 19 insertions(+), 0 deletions(-)
--
Signature
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] of/flattree: make of_fdt.h safe to unconditionally include.
2010-02-22 15:50 [PATCH 0/2] Make of_fdt conditionally compile gracefully Grant Likely
@ 2010-02-22 15:50 ` Grant Likely
2010-02-22 15:50 ` [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch Grant Likely
1 sibling, 0 replies; 6+ messages in thread
From: Grant Likely @ 2010-02-22 15:50 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
monstr-pSz03upnqPeHXe+LvDLADg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw
If CONFIG_OF_FLATTREE is not set, then don't process the body of
linux/of_fdt.h
Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---
include/linux/of_fdt.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index a1ca92c..f0fdd1f 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -57,6 +57,7 @@ struct boot_param_header {
__be32 dt_struct_size; /* size of the DT structure block */
};
+#if defined(CONFIG_OF_FLATTREE)
/* 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;
@@ -98,6 +99,7 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
/* Other Prototypes */
extern void unflatten_device_tree(void);
extern void early_init_devtree(void *);
+#endif /* CONFIG_OF_FLATTREE */
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_OF_FDT_H */
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch
2010-02-22 15:50 [PATCH 0/2] Make of_fdt conditionally compile gracefully Grant Likely
2010-02-22 15:50 ` [PATCH 1/2] of/flattree: make of_fdt.h safe to unconditionally include Grant Likely
@ 2010-02-22 15:50 ` Grant Likely
2010-02-22 22:51 ` Stephen Rothwell
1 sibling, 1 reply; 6+ messages in thread
From: Grant Likely @ 2010-02-22 15:50 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
monstr-pSz03upnqPeHXe+LvDLADg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw
This patch makes unflatten_device_tree() safe to call from any arch
setup code with the following changes:
- Make sure initial_boot_params actually points to a device tree blob
before unflattening
- Make sure the initial_boot_params->magic field is correct
- If CONFIG_OF_FLATTREE is not set, then make unflatten_device_tree()
an empty #define.
This patch also adds some additional debug output to the top of
unflatten_device_tree().
Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---
drivers/of/fdt.c | 15 +++++++++++++++
include/linux/of_fdt.h | 2 ++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 406757a..5ce7bd5 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -553,6 +553,21 @@ void __init unflatten_device_tree(void)
pr_debug(" -> unflatten_device_tree()\n");
+ if (!initial_boot_params) {
+ pr_debug("No device tree pointer\n");
+ return;
+ }
+
+ pr_debug("Unflattening device tree:\n");
+ pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic));
+ pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize));
+ pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version));
+
+ if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
+ pr_err("Invalid device tree blob header\n");
+ return;
+ }
+
/* First pass, scan for size */
start = ((unsigned long)initial_boot_params) +
be32_to_cpu(initial_boot_params->off_dt_struct);
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index f0fdd1f..9d7fd6d 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -99,6 +99,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
/* Other Prototypes */
extern void unflatten_device_tree(void);
extern void early_init_devtree(void *);
+#else /* CONFIG_OF_FLATTREE */
+#define unflatten_device_tree() do {} while(0)
#endif /* CONFIG_OF_FLATTREE */
#endif /* __ASSEMBLY__ */
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch
2010-02-22 15:50 ` [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch Grant Likely
@ 2010-02-22 22:51 ` Stephen Rothwell
[not found] ` <20100223095118.bed93bac.sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2010-02-22 22:51 UTC (permalink / raw)
To: Grant Likely
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1.1: Type: text/plain, Size: 509 bytes --]
Hi Grant,
On Mon, 22 Feb 2010 08:50:59 -0700 Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>
> - If CONFIG_OF_FLATTREE is not set, then make unflatten_device_tree()
> an empty #define.
Any reason not to make this a static inline?
> +#define unflatten_device_tree() do {} while(0)
static inline void unflatten_device_tree(void) {}
--
Cheers,
Stephen Rothwell sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org
http://www.canb.auug.org.au/~sfr/
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch
[not found] ` <20100223095118.bed93bac.sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
@ 2010-02-22 23:11 ` Grant Likely
[not found] ` <fa686aa41002221511r67c79534od562bef934c4d7a7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2010-02-22 23:11 UTC (permalink / raw)
To: Stephen Rothwell
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Mon, Feb 22, 2010 at 3:51 PM, Stephen Rothwell <sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org> wrote:
> Hi Grant,
>
> On Mon, 22 Feb 2010 08:50:59 -0700 Grant Likely <grant.likely@secretlab.ca> wrote:
>>
>> - If CONFIG_OF_FLATTREE is not set, then make unflatten_device_tree()
>> an empty #define.
>
> Any reason not to make this a static inline?
>
>> +#define unflatten_device_tree() do {} while(0)
>
> static inline void unflatten_device_tree(void) {}
No reason, just wasn't thinking of that. I've changed this.
g.
>
> --
> Cheers,
> Stephen Rothwell sfr-3FnU+UHB4dMh9ZMKESR00Q@public.gmane.org.au
> http://www.canb.auug.org.au/~sfr/
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch
[not found] ` <fa686aa41002221511r67c79534od562bef934c4d7a7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-02-22 23:25 ` Stephen Rothwell
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2010-02-22 23:25 UTC (permalink / raw)
To: Grant Likely
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1.1: Type: text/plain, Size: 435 bytes --]
Hi Grant,
On Mon, 22 Feb 2010 16:11:48 -0700 Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>
> No reason, just wasn't thinking of that. I've changed this.
Thanks. Andrew Morton says that (unless there is a good reason) we
should program the kernel in C not CPP.
--
Cheers,
Stephen Rothwell sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org
http://www.canb.auug.org.au/~sfr/
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-02-22 23:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 15:50 [PATCH 0/2] Make of_fdt conditionally compile gracefully Grant Likely
2010-02-22 15:50 ` [PATCH 1/2] of/flattree: make of_fdt.h safe to unconditionally include Grant Likely
2010-02-22 15:50 ` [PATCH 2/2] of/flattree: Make unflatten_device_tree() safe to call from any arch Grant Likely
2010-02-22 22:51 ` Stephen Rothwell
[not found] ` <20100223095118.bed93bac.sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
2010-02-22 23:11 ` Grant Likely
[not found] ` <fa686aa41002221511r67c79534od562bef934c4d7a7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-22 23:25 ` Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox