diff options
author | David Gibson <dgibson@sneetch.(none)> | 2005-07-15 17:14:24 +1000 |
---|---|---|
committer | David Gibson <dgibson@sneetch.(none)> | 2005-07-15 17:14:24 +1000 |
commit | f0517db25008374955e1b09a140413d7e0f499c3 (patch) | |
tree | 4afdb633dbff1189b950b2c5ba633c23125a4ef5 /dtc-parser.y | |
parent | 586606e35d1e72d3ee2073bca4247b340233af53 (diff) | |
download | dtc-f0517db25008374955e1b09a140413d7e0f499c3.zip dtc-f0517db25008374955e1b09a140413d7e0f499c3.tar.gz dtc-f0517db25008374955e1b09a140413d7e0f499c3.tar.bz2 |
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-parser.y')
-rw-r--r-- | dtc-parser.y | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/dtc-parser.y b/dtc-parser.y index e833627..66e243d 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -24,7 +24,7 @@ int yylex (void); void yyerror (char const *); -extern struct node *device_tree; +extern struct boot_info *the_boot_info; %} @@ -39,8 +39,12 @@ extern struct node *device_tree; struct node *nodelist; int datalen; int hexlen; + u64 addr; + struct reserve_entry re; } +%token DT_MEMRESERVE +%token <addr> DT_ADDR %token <str> DT_PROPNAME %token <str> DT_NODENAME %token <cval> DT_CELL @@ -51,11 +55,14 @@ extern struct node *device_tree; %token <str> DT_REF %type <data> propdata +%type <re> memreserve +%type <data> memreserves %type <data> celllist %type <data> bytestring %type <prop> propdef %type <proplist> proplist +%type <node> devicetree %type <node> nodedef %type <node> subnode %type <nodelist> subnodes @@ -66,9 +73,33 @@ extern struct node *device_tree; %% -devicetree: { - assert(device_tree == NULL); - } '/' nodedef { device_tree = name_node($3, "", NULL); } +sourcefile: memreserves devicetree { + the_boot_info = build_boot_info($1, $2); + } + ; + +memreserves: memreserves memreserve { + $$ = data_append_addr(data_append_addr($1, $2.address), + $2.size); + } + | /* empty */ { + $$ = empty_data; + } + ; + +memreserve: DT_MEMRESERVE DT_ADDR DT_ADDR ';' { + $$.address = $2; + $$.size = $3; + } + | DT_MEMRESERVE DT_ADDR '-' DT_ADDR ';' { + $$.address = $2; + $$.size = $4 - $2 + 1; + } + ; + +devicetree: '/' nodedef { + $$ = name_node($2, "", NULL); + } ; nodedef: '{' proplist subnodes '}' ';' { |