summaryrefslogtreecommitdiff
path: root/dtc-lexer.l
diff options
context:
space:
mode:
authorDavid Gibson <dgibson@sneetch.(none)>2005-07-15 17:14:24 +1000
committerDavid Gibson <dgibson@sneetch.(none)>2005-07-15 17:14:24 +1000
commitf0517db25008374955e1b09a140413d7e0f499c3 (patch)
tree4afdb633dbff1189b950b2c5ba633c23125a4ef5 /dtc-lexer.l
parent586606e35d1e72d3ee2073bca4247b340233af53 (diff)
downloaddtc-f0517db25008374955e1b09a140413d7e0f499c3.tar.gz
Support for specifying memreserve ranges in the source format, based on
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked substantially.
Diffstat (limited to 'dtc-lexer.l')
-rw-r--r--dtc-lexer.l26
1 files changed, 25 insertions, 1 deletions
diff --git a/dtc-lexer.l b/dtc-lexer.l
index 0f94dfc..cd3229f 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -22,6 +22,7 @@
%x CELLDATA
%x BYTESTRING
+%x MEMRESERVE
PROPCHAR [a-zA-Z0-9,._+*#?-]
UNITCHAR [0-9a-f,]
@@ -53,6 +54,29 @@ REFCHAR ({PROPCHAR}|{UNITCHAR}|[/@])
return DT_STRING;
}
+"/memreserve/" {
+ DPRINT("Keyword: /memreserve/\n");
+ BEGIN(MEMRESERVE);
+ return DT_MEMRESERVE;
+ }
+
+<MEMRESERVE>[0-9a-fA-F]+ {
+ if (yyleng > 2*sizeof(yylval.addr)) {
+ fprintf(stderr, "Address value %s too large\n",
+ yytext);
+ }
+ yylval.addr = (u64) strtoull(yytext, NULL, 16);
+ DPRINT("Addr: %llx\n",
+ (unsigned long long)yylval.addr);
+ return DT_ADDR;
+ }
+
+<MEMRESERVE>";" {
+ DPRINT("/MEMRESERVE\n");
+ BEGIN(INITIAL);
+ return ';';
+ }
+
<CELLDATA>[0-9a-fA-F]+ {
if (yyleng > 2*sizeof(yylval.cval)) {
fprintf(stderr,
@@ -116,7 +140,7 @@ REFCHAR ({PROPCHAR}|{UNITCHAR}|[/@])
<*>"//".*\n /* eat line comments */
-. {
+<*>. {
switch (yytext[0]) {
case '<':
DPRINT("CELLDATA\n");