From: David Gibson <david@gibson.dropbear.id.au>
To: Jon Loeliger <jdl@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: dtc: Make helper macros in trees.S more flexible
Date: Thu, 18 Oct 2007 14:14:09 +1000 [thread overview]
Message-ID: <20071018041409.GC8206@localhost.localdomain> (raw)
This patch makes the helper macros in trees.S use separate labels for
the end of each dt subblock, rather than using only start labels.
This means that the macros can now be used to create trees with the
subblocks in non-standard orders.
In addition, it adds a bunch of extra ; after lines of asm code in
macros, making them safe to use in nested macros.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/tests/trees.S
===================================================================
--- dtc.orig/tests/trees.S 2007-10-17 10:27:35.000000000 +1000
+++ dtc/tests/trees.S 2007-10-18 14:09:06.000000000 +1000
@@ -5,7 +5,7 @@
.byte ((val) >> 24) & 0xff ; \
.byte ((val) >> 16) & 0xff ; \
.byte ((val) >> 8) & 0xff ; \
- .byte (val) & 0xff
+ .byte (val) & 0xff ;
#define FDTQUAD(val) \
.byte ((val) >> 56) & 0xff ; \
@@ -15,10 +15,10 @@
.byte ((val) >> 24) & 0xff ; \
.byte ((val) >> 16) & 0xff ; \
.byte ((val) >> 8) & 0xff ; \
- .byte (val) & 0xff
+ .byte (val) & 0xff ;
#define TREE_HDR(tree) \
- .balign 4 ; \
+ .balign 8 ; \
.globl _##tree ; \
_##tree: \
tree: \
@@ -30,17 +30,18 @@
FDTLONG(0x11) ; \
FDTLONG(0x10) ; \
FDTLONG(0) ; \
- FDTLONG(tree##_end - tree##_strings) ; \
- FDTLONG(tree##_strings - tree##_struct) ;
+ FDTLONG(tree##_strings_end - tree##_strings) ; \
+ FDTLONG(tree##_struct_end - tree##_struct) ;
#define RSVMAP_ENTRY(addr, len) \
FDTQUAD(addr) ; \
- FDTQUAD(len) ;
+ FDTQUAD(len) ; \
#define EMPTY_RSVMAP(tree) \
.balign 8 ; \
tree##_rsvmap: ; \
- RSVMAP_ENTRY(0, 0)
+ RSVMAP_ENTRY(0, 0) \
+tree##_rsvmap_end: ;
#define PROPHDR(tree, name, len) \
FDTLONG(FDT_PROP) ; \
@@ -50,26 +51,26 @@
#define PROP_INT(tree, name, val) \
PROPHDR(tree, name, 4) \
/* For ease of testing the property values go in native-endian */ \
- .long val
+ .long val ;
#define PROP_STR(tree, name, str) \
PROPHDR(tree, name, 55f - 54f) \
54: \
.string str ; \
55: \
- .balign 4
+ .balign 4 ;
#define BEGIN_NODE(name) \
FDTLONG(FDT_BEGIN_NODE) ; \
.string name ; \
- .balign 4
+ .balign 4 ;
#define END_NODE \
FDTLONG(FDT_END_NODE) ;
#define STRING(tree, name, str) \
-tree##_##name: \
- .string str
+tree##_##name: ; \
+ .string str ;
.data
@@ -80,6 +81,7 @@
RSVMAP_ENTRY(TEST_ADDR_1, TEST_SIZE_1)
RSVMAP_ENTRY(TEST_ADDR_2, TEST_SIZE_2)
RSVMAP_ENTRY(0, 0)
+test_tree1_rsvmap_end:
test_tree1_struct:
BEGIN_NODE("")
@@ -108,13 +110,16 @@
END_NODE
FDTLONG(FDT_END)
+test_tree1_struct_end:
test_tree1_strings:
STRING(test_tree1, compatible, "compatible")
STRING(test_tree1, prop_int, "prop-int")
STRING(test_tree1, prop_str, "prop-str")
+test_tree1_strings_end:
test_tree1_end:
+
TREE_HDR(truncated_property)
EMPTY_RSVMAP(truncated_property)
@@ -122,7 +127,10 @@
BEGIN_NODE("")
PROPHDR(truncated_property, prop_truncated, 4)
/* Oops, no actual property data here */
+truncated_property_struct_end:
truncated_property_strings:
STRING(truncated_property, prop_truncated, "truncated")
+truncated_property_strings_end:
+
truncated_property_end:
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next reply other threads:[~2007-10-18 4:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 4:14 David Gibson [this message]
2007-10-22 16:38 ` dtc: Make helper macros in trees.S more flexible Jon Loeliger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071018041409.GC8206@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=jdl@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).