blob: 131ff569a9ddb72276410b35ba88ec29dc0660cf [file] [log] [blame]
Zane Shelleyba5dc162020-11-09 21:47:55 -06001#!/usr/bin/env perl
Zane Shelleyabc51c22020-11-09 21:35:35 -06002
3use warnings;
4use strict;
5
6use Data::Dumper;
7use Getopt::Long qw(:config no_ignore_case);
8use File::Path qw(make_path);
9use XML::Simple qw(:strict);
Zane Shelley0a905012021-04-26 17:07:24 -050010use JSON;
Zane Shelleyabc51c22020-11-09 21:35:35 -060011
12# Pull in from the lib directory
13use FindBin qw($RealBin);
14use FindBin qw($RealScript);
15use lib "$RealBin/lib";
16
17use BitRange;
18
19#-------------------------------------------------------------------------------
20# Global Variables
21#-------------------------------------------------------------------------------
22
23# Supported file versions and their values.
24my $FILE_VERSION =
25{
26 VER_01 => 0x01,
27};
28
29# This is a map of all currently supported models/ECs and their IDs.
30my $SUPPORTED_MODEL_EC =
31{
Zane Shelley13d04082021-06-04 08:40:48 -050032 EXPLORER_11 => { id => 0x60D20011, type => "ocmb", desc => "Explorer 1.1" },
33 EXPLORER_20 => { id => 0x60D20020, type => "ocmb", desc => "Explorer 2.0" },
34 P10_10 => { id => 0x20DA0010, type => "proc", desc => "P10 1.0" },
35 P10_20 => { id => 0x20DA0020, type => "proc", desc => "P10 2.0" },
Zane Shelleyabc51c22020-11-09 21:35:35 -060036};
37
38# All models/ECs that may exist in the XML, but no longer needs to be built.
39# This is useful for build optimization and also help prevent build breaks when
40# the XML still exists, but not needed anymore.
41my $DEPRECATED_MODEL_EC = [];
42
43# Supported register types and their values.
44my $REGISTER_TYPE =
45{
46 SCOM => { id => 0x01, addr_size => 4, reg_size => 8 },
47 IDSCOM => { id => 0x02, addr_size => 8, reg_size => 8 },
48};
49
50# Supported attention types and their values.
51my $ATTN_TYPE =
52{
Zane Shelley3d308902021-06-04 16:35:33 -050053 CS => [ 1, 'checkstop' ], # System checkstop hardware attention
54 UCS => [ 2, 'unit checkstop' ], # Unit checkstop hardware attention
55 RE => [ 3, 'recoverable' ], # Recoverable hardware attention
56 SPA => [ 4, 'special attention' ], # event requiring action by the SP FW
57 HA => [ 5, 'host attention' ], # event requiring action by the host FW
Zane Shelleyabc51c22020-11-09 21:35:35 -060058};
59
60#-------------------------------------------------------------------------------
61# Help function
62#-------------------------------------------------------------------------------
63
64sub help()
65{
66 print <<EOF;
67Usage: $RealScript -h
68 $RealScript -i <input_dir> -o <output_dir>
69
Zane Shelley738276a2021-05-24 12:55:34 -050070Generates specified data files from the input Chip Data XML.
Zane Shelleyabc51c22020-11-09 21:35:35 -060071
Zane Shelley738276a2021-05-24 12:55:34 -050072General options:
73
Zane Shelleyabc51c22020-11-09 21:35:35 -060074 -h, --help Prints this menu.
75 -i, --input Directory containing the Chip Data XML files.
Zane Shelley738276a2021-05-24 12:55:34 -050076 -o, --output Directory that will contain the data files.
77
78Data file options (must specify at least one):
79
80 --cdb Generates Chip Data Binary files.
81 --json Generates PEL Parser Data JSON files.
82
Zane Shelleyabc51c22020-11-09 21:35:35 -060083EOF
84
85 exit;
86}
87
88#-------------------------------------------------------------------------------
89# Input
90#-------------------------------------------------------------------------------
91
92help() unless @ARGV; # print help if no arguments
93
94# Get options
Zane Shelley738276a2021-05-24 12:55:34 -050095my ( $help, $src_dir, $dest_dir, $gen_cdb, $gen_json );
96help() unless GetOptions(
97 'h|help' => \$help,
98 'i|input=s' => \$src_dir,
99 'o|output=s' => \$dest_dir,
100 'cdb' => \$gen_cdb,
101 'json' => \$gen_json,
102);
Zane Shelleyabc51c22020-11-09 21:35:35 -0600103
104help() if @ARGV; # print usage if there are extra arguments
105
106# -h,--help
107help() if ( $help );
108
109# -i,--input
110die "ERROR> Option -i required." unless ( defined $src_dir );
111die "ERROR> '$src_dir' is not a directory" unless ( -d $src_dir );
112
113# -o,--output
114die "ERROR> Option -o required." unless ( defined $dest_dir );
115make_path( $dest_dir, {error => \my $err} );
116if ( @{$err} )
117{
118 my ( $file, $message ) = %{shift @{$err}};
119 die "ERROR> $message: $file\n";
120}
121
Zane Shelley738276a2021-05-24 12:55:34 -0500122# --cdb, --json
123unless ( $gen_cdb or $gen_json )
124{
125 die "ERROR> Must specify at least one data file option.";
126}
127
Zane Shelleyabc51c22020-11-09 21:35:35 -0600128#-------------------------------------------------------------------------------
129# Prototypes
130#-------------------------------------------------------------------------------
131
132sub importXML($);
133sub normalizeXML($);
Zane Shelley738276a2021-05-24 12:55:34 -0500134sub buildDataFiles($$);
Zane Shelleyabc51c22020-11-09 21:35:35 -0600135
136#-------------------------------------------------------------------------------
137# Main
138#-------------------------------------------------------------------------------
139
140# Validate and import the XML.
141my $chip_data_xml = importXML( $src_dir );
142
143# There are some fields in the XML that are shorthand and need to be expanded
144# before building the binary files.
145my $normalized_data = normalizeXML( $chip_data_xml );
146
147# The XML should now be in a format to start building the binary files.
Zane Shelley738276a2021-05-24 12:55:34 -0500148buildDataFiles( $dest_dir, $normalized_data );
Zane Shelleyabc51c22020-11-09 21:35:35 -0600149
150#-------------------------------------------------------------------------------
151# Helper functions
152#-------------------------------------------------------------------------------
153
154sub FAIL($) { die( "ERROR> " . shift @_ ); }
155
156#-------------------------------------------------------------------------------
157# Import functions
158#-------------------------------------------------------------------------------
159
160# For each supported XML file in the given directory:
161# - Ensures the XML is well-formed.
162# - Ensures the XML validates against the schema.
163# - Imports the XML into Perl data structures.
164sub importXML($)
165{
166 my ( $dir ) = @_;
167
168 my $data = {};
169
170 # Get a list of all the XML files.
171 opendir DIR, $dir or die "Couldn't open dir '$dir': $!";
172 my @files = grep { /^.+\.xml$/ } readdir DIR;
173 closedir DIR;
174
175 # Iterate each supported file type.
176 for my $type ( "chip", "node" )
177 {
178 for my $file ( grep { /^$type\_.+\.xml$/ } @files )
179 {
180 my $path = "$dir/$file";
181
182 # Ensure the XML is well-formed and validates against the schema.
Zane Shelleyfc4aa5e2021-01-14 13:45:39 -0600183 my $out = `xmllint --noout --schema $RealBin/$type.xsd $path 2>&1`;
184 die "$out\nRAS XML validation failed on $file" if ( 0 != $? );
Zane Shelleyabc51c22020-11-09 21:35:35 -0600185
186 # Import the XML.
187 my $xml = XMLin( $path, KeyAttr => {}, ForceArray => 1 );
188
189 # Add the file path to the XML for error output.
190 $xml->{path} = $path;
191
192 # Push each file's data to a list for each file type.
193 push @{$data->{$type}}, $xml;
194 }
195 }
196
197 return $data;
198}
199
200#-------------------------------------------------------------------------------
201# Normalize functions
202#-------------------------------------------------------------------------------
203
204# Takes a string of models/ECs separated by ',' and returns a list of supported
205# models/ECs. See $SUPPORTED_MODEL_EC and $DEPRECATED_MODEL_EC.
206sub __expandModelEc($)
207{
208 my ( $str ) = @_;
209
210 my @list = split(/,/, $str);
211
212 # Remove any deprecated models/ECs.
213 for my $d ( @{$DEPRECATED_MODEL_EC} )
214 {
215 @list = grep { $d ne $_ } @list;
216 }
217
218 # Validate the remaining models/ECs.
219 for my $m ( @list )
220 {
221 unless ( defined $SUPPORTED_MODEL_EC->{$m} )
222 {
223 FAIL("Unsupported model/EC: $m");
224 }
225 }
226
227 return @list;
228}
229
230#-------------------------------------------------------------------------------
231
232sub __getInstRange($)
233{
234 my ( $insts ) = @_;
235
236 my $list = [];
237 for ( @{$insts} ) { push @{$list}, $_->{reg_inst}; }
238
239 @{$list} = sort @{$list}; # Sort the list just in case.
240
241 return BitRange::compress($list);
242}
243
244sub __getReg($$$$)
245{
246 my ( $inst_in, $reg_type, $name, $addr_mod ) = @_;
247
248 my $inst_out = [];
249 for ( @{$inst_in} )
250 {
251 my $addr = "";
252 if ( "SCOM" eq $reg_type )
253 {
254 $addr = sprintf( "0x%08x", hex($_->{addr}) + $addr_mod );
255 }
256 elsif ( "IDSCOM" eq $reg_type )
257 {
258 # TODO: Need a portable way of handling 64-bit numbers.
259 FAIL("IDSCOM address currently not supported");
260 }
261 else
262 {
263 FAIL("Unsupported register type for node: $name");
264 }
265
266 push @{$inst_out}, { reg_inst => $_->{reg_inst}, addr => $addr };
267 }
268
269 return { name => $name, instance => $inst_out };
270}
271
272sub __getExpr($$)
273{
274 my ( $name, $config ) = @_;
275
276 # Get the register expression.
277 my $expr = { type => 'reg', value1 => $name };
278
279 if ( '0' eq $config )
280 {
281 # Take the NOT of the register expression.
282 $expr = { type => 'not', expr => [ $expr ] };
283 }
284
285 return $expr;
286}
287
288sub __getAct($$$$)
289{
290 my ( $fir, $range, $type, $config ) = @_;
291
292 FAIL("Invalid action config: $config") unless ( $config =~ /^[01]{2,3}$/ );
293
294 my @c = split( //, $config );
295
296 my $e = [];
297 push( @{$e}, __getExpr("${fir}", '1' ) );
298 push( @{$e}, __getExpr("${fir}_MASK", '0' ) );
299 push( @{$e}, __getExpr("${fir}_ACT0", shift @c) );
300 push( @{$e}, __getExpr("${fir}_ACT1", shift @c) );
301 push( @{$e}, __getExpr("${fir}_ACT2", shift @c) ) if ( 0 < scalar @c );
302
303 return { node_inst => $range, attn_type => $type,
304 expr => [ { type => 'and', expr => $e } ] };
305}
306
307#-------------------------------------------------------------------------------
308
309sub __normalizeLocalFir($)
310{
311 my ( $node ) = @_;
312
313 return unless ( defined $node->{local_fir} );
314
315 # Note that the isolator will implicitly add all register referenced by the
316 # rules to the capture group. To reduce redundancy and overall file size, we
317 # won't add these registers to the capture group.
318
319 $node->{register} = [] unless ( defined $node->{register} );
320 $node->{rule} = [] unless ( defined $node->{rule} );
321
322 for my $l ( @{$node->{local_fir}} )
323 {
324 my $n = $l->{name};
325 my $i = $l->{instance};
326 my $t = $node->{reg_type};
327
328 my $inst_range = __getInstRange($i);
329
330 my $r = [];
331 push @{$r}, __getReg($i, $t, "${n}", 0);
332 push @{$r}, __getReg($i, $t, "${n}_MASK", 3);
333 push @{$r}, __getReg($i, $t, "${n}_ACT0", 6);
334 push @{$r}, __getReg($i, $t, "${n}_ACT1", 7);
335 push @{$r}, __getReg($i, $t, "${n}_WOF", 8) if ($l->{config} =~ /W/);
336 push @{$r}, __getReg($i, $t, "${n}_ACT2", 9) if ($l->{config} =~ /2/);
337
338 push @{$node->{register}}, @{$r};
339
340 for ( @{$l->{action}} )
341 {
342 push @{$node->{rule}},
343 __getAct( $n, $inst_range, $_->{attn_type}, $_->{config} );
344 }
345 }
346
347 delete $node->{local_fir};
348}
349
350#-------------------------------------------------------------------------------
351
352# This is not very efficient, especially for large data structures. It is
353# recommended to use Data::Compare, but that is not available on the pool
354# machines.
355sub __dirtyCompare($$)
356{
357 local $Data::Dumper::Terse = 1;
358 local $Data::Dumper::Indent = 0;
359 local $Data::Dumper::Sortkeys = 1;
360 my ( $a, $b ) = ( Dumper(shift), Dumper(shift) );
361 return $a eq $b;
362}
363
364#-------------------------------------------------------------------------------
365
366sub __normalizeRegister($$)
367{
368 my ( $node, $regs ) = @_;
369
370 # There must be at least one register entry.
371 unless ( defined $node->{register} and 0 < scalar @{$node->{register}} )
372 {
373 FAIL( "Node $node->{name} does not contain at least one register" );
374 }
375
376 # All of the registers will be put in the master register list for the chip.
377 for my $r ( @{$node->{register}} )
378 {
379 # Set the default access if needed.
380 $r->{access} = 'RW' unless ( defined $r->{access} );
381
382 # Each register will keep track of its type.
383 $r->{reg_type} = $node->{reg_type};
384
Zane Shelleyd6826e52020-11-10 17:39:00 -0600385 for my $model_ec ( __expandModelEc($node->{model_ec}) )
Zane Shelleyabc51c22020-11-09 21:35:35 -0600386 {
Zane Shelleyd6826e52020-11-10 17:39:00 -0600387 if ( defined $regs->{$model_ec}->{$r->{name}} )
Zane Shelleyabc51c22020-11-09 21:35:35 -0600388 {
Zane Shelleyd6826e52020-11-10 17:39:00 -0600389 # This register already exists so check the contents for
390 # accuracy
391 unless ( __dirtyCompare($r, $regs->{$model_ec}->{$r->{name}}) )
392 {
393 FAIL("Duplicate register: $r->{name}");
394 }
Zane Shelleyabc51c22020-11-09 21:35:35 -0600395 }
Zane Shelleyd6826e52020-11-10 17:39:00 -0600396 else
397 {
398 # Add this node's register to the master register list.
399 $regs->{$model_ec}->{$r->{name}} = $r;
400 }
Zane Shelleyabc51c22020-11-09 21:35:35 -0600401 }
402 }
403
404 # Clean up this node's register data.
405 delete $node->{register};
406}
407
408#-------------------------------------------------------------------------------
409
410sub __normalizeCaptureGroup($$)
411{
412 my ( $node, $insts_data ) = @_;
413
414 # Capture groups are optional (although recommended).
415 return unless ( defined $node->{capture_group} );
416
417 for my $c ( @{$node->{capture_group}} )
418 {
419 # There must be at least one capture_register.
420 unless ( defined $c->{capture_register} and
421 0 < scalar @{$c->{capture_register}} )
422 {
423 FAIL("<capture_group> for node $node->{name} does not contain at " .
424 "least one <capture_register>" );
425 }
426
427 my @node_insts = BitRange::expand($c->{node_inst});
428
429 for my $r ( @{$c->{capture_register}} )
430 {
431 # node_inst and reg_inst must be the same size.
432 my @reg_insts = BitRange::expand($r->{reg_inst});
433 unless ( scalar @node_insts == scalar @reg_insts )
434 {
435 FAIL("capture_group/\@node_inst and capture_register/" .
436 "\@reg_inst list sized not equal for node $node->{name}");
437 }
438
439 # Expand the capture groups so there is one per node instance.
440 for ( 0 .. (scalar @node_insts - 1) )
441 {
442 my ( $ni, $ri ) = ( $node_insts[$_], $reg_insts[$_] );
443 push @{$insts_data->{$ni}->{capture_group}},
444 { reg_name => $r->{reg_name}, reg_inst => $ri };
445 }
446 }
447 }
448
449 # Clean up this node's capture group data.
450 delete $node->{capture_group};
451}
452
453#-------------------------------------------------------------------------------
454
455sub __normalizeExpr($$$$); # Called recursively
456
457sub __normalizeExpr($$$$)
458{
459 my ( $in, $ni, $idx, $size ) = @_;
460
461 my ( $t, $e, $v1, $v2 ) = ( $in->{type}, $in->{expr},
462 $in->{value1}, $in->{value2} );
463
464 my $out = { type => $t };
465
466 if ( "and" eq $t or "or" eq $t )
467 {
468 if ( defined $v1 or defined $v2 or
469 not defined $e or not (0 < scalar @{$e}) )
470 {
471 FAIL("Invalid parameters for and/or expression");
472 }
473
474 # Iterate each sub expression.
475 push @{$out->{expr}}, __normalizeExpr($_, $ni, $idx, $size) for (@{$e});
476 }
477 elsif ( "not" eq $t )
478 {
479 if ( defined $v1 or defined $v2 or
480 not defined $e or not (1 == scalar @{$e}) )
481 {
482 FAIL("Invalid parameters for not expression");
483 }
484
485 # Iterate each sub expression.
486 push @{$out->{expr}}, __normalizeExpr($_, $ni, $idx, $size) for (@{$e});
487 }
488 elsif ( "lshift" eq $t or "rshift" eq $t )
489 {
490 if ( not defined $v1 or defined $v2 or
491 not defined $e or not (1 == scalar @{$e}) )
492 {
493 FAIL("Invalid parameters for lshift/rshift expression");
494 }
495
496 # Copy value1.
497 $out->{value1} = $v1;
498
499 # Iterate each sub expression.
500 push @{$out->{expr}}, __normalizeExpr($_, $ni, $idx, $size) for (@{$e});
501 }
502 elsif ( "reg" eq $t )
503 {
504 if ( not defined $v1 or defined $e )
505 {
506 FAIL("Invalid parameters for reg expression");
507 }
508
509 # Copy value1.
510 $out->{value1} = $v1;
511
512 # value2 is optional in the XML, update the value to the node or
513 # register instance.
514 if ( defined $v2 )
515 {
516 my @reg_insts = BitRange::expand($v2);
517 unless ( $size == scalar @reg_insts )
518 {
519 FAIL("reg expression value2:$v2 list not the same ".
520 "size as containing node's rule instances:$size");
521 }
522
523 $out->{value2} = $reg_insts[$idx];
524 }
525 else
526 {
527 # The register instance is the same as the node instance.
528 $out->{value2} = $ni;
529 }
530 }
531 elsif ( "int" eq $t )
532 {
533 if ( not defined $v1 or defined $v2 or defined $e )
534 {
535 FAIL("Invalid parameters for int expression");
536 }
537
538 # Copy value1.
539 $out->{value1} = $v1;
540 }
541 else
542 {
543 FAIL("Unsupported expression type: $t");
544 }
545
546 return $out;
547}
548
549#-------------------------------------------------------------------------------
550
551sub __normalizeRule($$)
552{
553 my ( $node, $insts_data ) = @_;
554
555 # There must be at least one rule entry.
556 unless ( defined $node->{rule} and 0 < scalar @{$node->{rule}} )
557 {
558 FAIL( "Node $node->{name} does not contain at least one rule" );
559 }
560
561 # There should be only one rule per attention type and node instance for
562 # this node.
563 my $rule_dups = {};
564
565 for my $r ( @{$node->{rule}} )
566 {
567 # There should be exactly one parent expression.
568 unless ( 1 == scalar @{$r->{expr}} )
569 {
570 FAIL("Multiple parent expressions for rule: $node->{name} " .
571 "$r->{attn_type}");
572 }
573 my $expr = $r->{expr}->[0];
574
575 my @node_insts = BitRange::expand($r->{node_inst});
576 my $sz_insts = scalar @node_insts;
577
578 # Expand the expression for each node instance.
579 for my $idx ( 0 .. ($sz_insts - 1) )
580 {
581 my $ni = $node_insts[$idx];
582
583 # Check for duplicates.
584 if ( defined $rule_dups->{$r->{attn_type}}->{$ni} )
585 {
586 FAIL("Duplicate rule: $node->{name} $r->{attn_type} $ni");
587 }
588 else
589 {
590 $rule_dups->{$r->{attn_type}}->{$ni} = 1;
591 }
592
593 # Add the rule for this expression.
594 push @{$insts_data->{$ni}->{rule}},
595 { attn_type => $r->{attn_type},
596 expr => __normalizeExpr($expr, $ni, $idx, $sz_insts) };
597 }
598 }
599
600 # Clean up this node's rule data.
601 delete $node->{rule};
602}
603
604#-------------------------------------------------------------------------------
605
606sub __normalizeBit($$$)
607{
608 my ( $node, $sigs, $insts_data ) = @_;
609
610 # There must be at least one bit entry.
611 unless ( defined $node->{bit} and 0 < scalar @{$node->{bit}} )
612 {
613 FAIL( "Node $node->{name} does not contain at least one bit" );
614 }
615
616 my @node_insts = sort keys %{$insts_data};
617 my $sz_insts = scalar @node_insts;
618
619 # There should be only one child node per node instance bit position.
620 my $child_dups = {};
621
622 for my $b ( sort {$a->{pos} cmp $b->{pos}} @{$node->{bit}} )
623 {
624 my @child_insts = ();
625
626 # Ensure child_node and node_inst are set properly.
627 if ( defined $b->{child_node} )
628 {
629 # Ensure each bit has a default node_inst attribute if needed.
630 $b->{node_inst} = "0" unless ( defined $b->{node_inst} );
631
632 # Get all of the instances for this child node.
633 @child_insts = BitRange::expand($b->{node_inst});
634
635 # Both inst list must be equal in size.
636 unless ( $sz_insts == scalar @child_insts )
637 {
638 FAIL("node_inst attribute list size for node:$node->{name} " .
639 "bit:$b->{pos} does not match node instances " .
640 "represented by the <rule> element");
641 }
642 }
643 elsif ( defined $b->{node_inst} )
644 {
645 FAIL("node_inst attribute exists for node:$node->{name} " .
646 "bit:$b->{pos} with no child_node attribute");
647 }
648
649 # Get the signatures for each node, instance, and bit position.
650 for my $p ( BitRange::expand($b->{pos}) )
651 {
652 for my $i ( 0 .. ($sz_insts-1) )
653 {
654 my ( $n, $ni ) = ( $node->{name}, $node_insts[$i] );
655
656 # This is to cover a bug in the figtree information where there
657 # currently is no comment for some bits.
658 $b->{content} = "" unless ( defined $b->{content} );
659
Zane Shelleyd6826e52020-11-10 17:39:00 -0600660 for my $model_ec ( __expandModelEc($node->{model_ec}) )
Zane Shelleyabc51c22020-11-09 21:35:35 -0600661 {
Zane Shelleyd6826e52020-11-10 17:39:00 -0600662 # Check if this signature already exists.
663 if ( defined $sigs->{$model_ec}->{$n}->{$ni}->{$p} and
664 $b->{content} ne $sigs->{$model_ec}->{$n}->{$ni}->{$p} )
665 {
666 FAIL("Duplicate signature for $n $ni $p");
667 }
Zane Shelleyabc51c22020-11-09 21:35:35 -0600668
Zane Shelleyd6826e52020-11-10 17:39:00 -0600669 # Get the signatures for each node, instance, and bit
670 # position.
671 $sigs->{$model_ec}->{$n}->{$ni}->{$p} = $b->{content};
672 }
Zane Shelleyabc51c22020-11-09 21:35:35 -0600673
674 # Move onto the next instance unless a child node exists.
675 next unless ( defined $b->{child_node} );
676
677 my $pi = $child_insts[$i];
678
679 my $child = { pos => $p,
680 child_node => $b->{child_node},
681 node_inst => $pi };
682
683 # Ensure this child node doesn't already exist.
684 if ( defined $child_dups->{$ni}->{$p} and
685 not __dirtyCompare($child, $child_dups->{$ni}->{$p}) )
686 {
687 FAIL("Duplicate child_node for $n $ni $p");
688 }
689
690 # Add this child node.
691 push @{$insts_data->{$ni}->{bit}}, $child;
692 }
693 }
694 }
695
696 # Clean up this node's bit data.
697 delete $node->{bit};
698}
699
700#-------------------------------------------------------------------------------
701
702sub __normalizeNode($$$)
703{
704 my ( $node, $regs, $sigs ) = @_;
705
706 # Ensure a valid register type.
707 unless ( grep { /^$node->{reg_type}$/ } keys %{$REGISTER_TYPE} )
708 {
709 FAIL( "Unsupported register type: $node->{reg_type}" );
710 }
711
712 my $insts_data = {}; # Collect data for each instance of this node.
713
714 # First, expand the <local_fir> data if it exists.
715 __normalizeLocalFir($node);
716
717 # All registers will be put in a master register list for the chip.
718 __normalizeRegister($node, $regs);
719
720 # Split the capture group information per node instance.
721 __normalizeCaptureGroup($node, $insts_data);
722
723 # Split the rule information per node instance. The sorted instance list
724 # will be used as indexes for the node_inst attribute of the <bit> elements.
725 __normalizeRule($node, $insts_data);
726
727 # Finally, collect the signature details and split the bit information per
728 # node instance.
729 __normalizeBit($node, $sigs, $insts_data);
730
731 # Now that we have all of the node data, collapse the instance data into
732 # a list.
733 for ( sort keys %{$insts_data} )
734 {
735 $insts_data->{$_}->{node_inst} = $_;
736 push @{$node->{instance}}, $insts_data->{$_};
737 }
738}
739
740#-------------------------------------------------------------------------------
741
742sub normalizeXML($)
743{
744 my ( $xml ) = @_;
745
746 my $data = {};
747
748 # Iterate each chip file.
749 for my $chip ( @{$xml->{chip}} )
750 {
751 # Iterate each model/EC.
752 for my $model_ec ( __expandModelEc($chip->{model_ec}) )
753 {
754 # Ensure there is not a duplicate definition for a model/EC.
755 if ( $data->{$model_ec}->{chip} )
756 {
757 FAIL("Duplicate data for model/EC $model_ec in:\n" .
758 " $data->{$model_ec}->{chip}->{path}\n" .
759 " $chip->{path}");
760 }
761
762 # Add this chip to the data.
763 $data->{$model_ec}->{attn_tree} = $chip->{attn_tree};
764 }
765 }
766
767 # Extract the data for each node.
768 my ( $regs, $sigs, $node_dups ) = ( {}, {}, {} );
769 for my $node ( sort { $a->{name} cmp $b->{name} } @{$xml->{node}} )
770 {
771 # A node may be defined for more than one model/EC.
772 for my $model_ec ( __expandModelEc($node->{model_ec}) )
773 {
774 # A node can only be defined once per model/EC.
775 if ( defined $node_dups->{$model_ec}->{$node->{name}} )
776 {
777 FAIL( "Duplicate node defined for $model_ec -> $node->{name} ");
778 }
779 else
780 {
781 $node_dups->{$model_ec}->{$node->{name}} = 1;
782 }
783
Zane Shelleyd6826e52020-11-10 17:39:00 -0600784 # Initialize the master list of registers and signatures of this
785 # model/EC, if necessary.
Zane Shelleyabc51c22020-11-09 21:35:35 -0600786
Zane Shelleyd6826e52020-11-10 17:39:00 -0600787 $regs->{$model_ec} = {} unless ( defined $regs->{$model_ec} );
788 $sigs->{$model_ec} = {} unless ( defined $sigs->{$model_ec} );
789 }
Zane Shelleyabc51c22020-11-09 21:35:35 -0600790
Zane Shelleyd6826e52020-11-10 17:39:00 -0600791 # The same node content will be used for each model/EC characterized by
792 # this node. There is some normalization that needs to happen because of
793 # shorthand elements, like <local_fir>, and some error checking. This
794 # only needs to be done once per node, not per model/EC.
795 __normalizeNode( $node, $regs, $sigs );
Zane Shelleyabc51c22020-11-09 21:35:35 -0600796
Zane Shelleyd6826e52020-11-10 17:39:00 -0600797 # Push the node data for each model/EC.
798 for my $model_ec ( __expandModelEc($node->{model_ec}) )
799 {
Zane Shelleyabc51c22020-11-09 21:35:35 -0600800 push @{$data->{$model_ec}->{node}}, $node;
801 }
802 }
803
804 # Sort and collapse the master register list.
805 for my $m ( keys %{$regs} )
806 {
807 for my $n ( sort keys %{$regs->{$m}} )
808 {
809 push @{$data->{$m}->{register}}, $regs->{$m}->{$n};
810 }
811 }
812
813 # Collapse the signature lists.
814 for my $m ( keys %{$sigs} )
815 {
816 for my $n ( sort keys %{$sigs->{$m}} )
817 {
818 for my $i ( sort {$a <=> $b} keys %{$sigs->{$m}->{$n}} )
819 {
820 for my $b ( sort {$a <=> $b} keys %{$sigs->{$m}->{$n}->{$i}} )
821 {
822 push @{$data->{$m}->{signature}},
823 { name => $n, inst => $i, bit => $b,
824 desc => $sigs->{$m}->{$n}->{$i}->{$b} };
825 }
826 }
827 }
828 }
829
830 return $data;
831}
832
833#-------------------------------------------------------------------------------
834# Output functions
835#-------------------------------------------------------------------------------
836
837# The $num passed into this function can be a numeric of string. All values are
838# converted to a hex string and then into the binary format. This helps avoid
839# portability issues with endianess. Requirements:
840# - Hex strings must start with '0x'.
841# - For portability, 64-bit numbers must be passed as a hex string.
842sub __bin($$$)
843{
844 my ( $fh, $bytes, $num ) = @_;
845
846 # $bytes must be a positive integer.
847 die "Invalid bytes: $bytes" unless ( 0 < $bytes );
848
849 my $str = ''; # Default invalid string
850
851 my $char = $bytes * 2; # Number of characters in the string.
852
853 # Check if $num is a hex string.
854 if ( $num =~ /^0[x|X](.*)/ )
855 {
856 $str = $1; # strip the '0x'
857 }
858 # Check if $num is string or numeric decimal integer (32-bit max).
859 elsif ( $num =~ /^[0-9]+$/ and $bytes <= 4 )
860 {
861 $str = sprintf("%0${char}x", $num); # Convert to hex string
862 }
863
864 # Check for a hex number with the valid size.
865 unless ( $str =~ /^[0-9a-fA-F]{$char}$/ )
866 {
867 die "Invalid number: $num (size: $bytes)";
868 }
869
870 # Print the binary string.
871 print $fh pack( "H$char", $str );
872}
873
874#-------------------------------------------------------------------------------
875
876sub __hash($$)
877{
878 my $bytes = shift;
879 my @str = unpack("C*", shift); # returns an array of ascii values
880
881 # Currently only supporting 1, 2, 3, and 4 byte hashes.
882 unless ( 1 <= $bytes and $bytes <= 4 )
883 {
884 FAIL("Unsupported hash size: $bytes");
885 }
886
887 # Add padding to the end of the character array so that the size is
888 # divisible by $bytes.
889 push @str, 0 until ( 0 == scalar(@str) % $bytes );
890
891 # This hash is a simple "n*s[0] + (n-1)*s[1] + ... + s[n-1]" algorithm,
892 # where s[i] is a $bytes size chunk of the input string.
893
894 my ( $sumA, $sumB ) = ( 0, 0 );
895 while ( my @chunk = splice @str, 0, $bytes )
896 {
897 # Combine the chunk array into a single value.
898 my $val = 0; for ( @chunk ) { $val <<= 8; $val |= $_; }
899
900 # Apply the simple hash.
901 $sumA += $val;
902 $sumB += $sumA;
903 }
904
905 # Mask off everything except the target number of bytes.
906 $sumB &= 0xffffffff >> ((4 - $bytes) * 8);
907
908 return $sumB;
909}
910
911#-------------------------------------------------------------------------------
912
913sub __printRegisters($$)
914{
915 my ( $fh, $data ) = @_;
916
917 my $num_regs = scalar @{$data};
918 FAIL("No registers defined") unless ( 0 < $num_regs );
919
920 # Register list metadata
921 __bin($fh, 1, $_) for ( unpack("C*", "REGS") );
922 __bin($fh, 3, $num_regs);
923
924 my $reg_ids = {}; # for hash duplicate checking
925
926 for my $r ( @{$data} )
927 {
928 # Get the hash of the register name and check for duplicates.
929 my $id = __hash(3, $r->{name});
930 if ( defined $reg_ids->{$id} )
931 {
932 FAIL("Duplicate register ID hash " . sprintf('0x%08x', $id) .
933 " for $r->{name} and $reg_ids->{$id}");
934 }
935 else
936 {
937 $reg_ids->{$id} = $r->{name};
938 }
939
940 # Get the attribute flags.
941 my $flags = 0x00;
942 $flags |= 0x80 if ( $r->{access} =~ /R/ );
943 $flags |= 0x40 if ( $r->{access} =~ /W/ );
944
945 # Get the number of address instances.
946 my $num_inst = scalar @{$r->{instance}};
947 unless ( 0 < $num_inst )
948 {
949 FAIL("No register instances defined for $r->{name}");
950 }
951
952 # Register metadata
953 __bin($fh, 3, $id );
954 __bin($fh, 1, $REGISTER_TYPE->{$r->{reg_type}}->{id});
955 __bin($fh, 1, $flags );
956 __bin($fh, 1, $num_inst);
957
958 for my $i ( @{$r->{instance}} )
959 {
960 my $s = $REGISTER_TYPE->{$r->{reg_type}}->{addr_size};
961
962 # Register Instance metadata
963 __bin($fh, 1, $i->{reg_inst});
964 __bin($fh, $s, $i->{addr} );
965 }
966 }
967}
968
969#-------------------------------------------------------------------------------
970
971sub __printExpr($$$);
972
973sub __printExpr($$$)
974{
975 my ( $fh, $size, $expr ) = @_;
976
977 my ( $t, $e, $v1, $v2 ) = ( $expr->{type}, $expr->{expr},
978 $expr->{value1}, $expr->{value2} );
979
980 if ( "reg" eq $t )
981 {
982 __bin($fh, 1, 0x01); # expression type for "reg"
983 __bin($fh, 3, __hash(3,$v1)); # register id
984 __bin($fh, 1, $v2); # register instance
985 }
986 elsif ( "int" eq $t )
987 {
988 __bin($fh, 1, 0x02); # expression type for "int"
989 __bin($fh, $size, $v1); # integer value
990 }
991 elsif ( "and" eq $t )
992 {
993 __bin($fh, 1, 0x10); # expression type for "and"
994 __bin($fh, 1, scalar @{$e}); # number of sub-expressions
995 __printExpr($fh, $size, $_) for ( @{$e} ); # add each sub-expression
996 }
997 elsif ( "or" eq $t )
998 {
999 __bin($fh, 1, 0x11); # expression type for "or"
1000 __bin($fh, 1, scalar @{$e}); # number of sub-expressions
1001 __printExpr($fh, $size, $_) for ( @{$e} ); # add each sub-expression
1002 }
1003 elsif ( "not" eq $t )
1004 {
1005 __bin($fh, 1, 0x12); # expression type for "not"
1006 __printExpr($fh, $size, $e->[0]); # add only sub-expression
1007 }
1008 elsif ( "lshift" eq $t )
1009 {
1010 __bin($fh, 1, 0x13); # expression type for "lshift"
1011 __bin($fh, 1, $v1); # shift amount
1012 __printExpr($fh, $size, $e->[0]); # add only sub-expression
1013 }
1014 elsif ( "rshift" eq $t )
1015 {
1016 __bin($fh, 1, 0x14); # expression type for "rshift"
1017 __bin($fh, 1, $v1); # shift amount
1018 __printExpr($fh, $size, $e->[0]); # add only sub-expression
1019 }
1020}
1021
1022#-------------------------------------------------------------------------------
1023
1024sub __printNodes($$)
1025{
1026 my ( $fh, $data ) = @_;
1027
1028 my $num_nodes = scalar @{$data};
1029 FAIL("No nodes defined") unless ( 0 < $num_nodes );
1030
1031 # Isolation Node list metadata
1032 __bin($fh, 1, $_) for ( unpack("C*", "NODE") );
1033 __bin($fh, 2, $num_nodes);
1034
1035 my $node_ids = {}; # for hash duplicate checking
1036
1037 for my $n ( @{$data} )
1038 {
1039 # Get the hash of the node name and check for duplicates.
1040 my $id = __hash(2, $n->{name});
1041 if ( defined $node_ids->{$id} )
1042 {
1043 FAIL("Duplicate node ID hash " . sprintf('0x%08x', $id) .
1044 " for $n->{name} and $node_ids->{$id}");
1045 }
1046 else
1047 {
1048 $node_ids->{$id} = $n->{name};
1049 }
1050
1051 my $num_insts = scalar @{$n->{instance}};
1052 unless ( 0 < $num_insts )
1053 {
1054 FAIL("No nodes instances defined for $n->{name}");
1055 }
1056
1057 my $reg_type = $REGISTER_TYPE->{$n->{reg_type}}->{id};
1058 my $reg_size = $REGISTER_TYPE->{$n->{reg_type}}->{reg_size};
1059
1060 # Register metadata
1061 __bin($fh, 2, $id);
1062 __bin($fh, 1, $reg_type);
1063 __bin($fh, 1, $num_insts);
1064
1065 for my $i ( @{$n->{instance}} )
1066 {
1067 # Capture groups are optional.
1068 my $num_cap_regs = (defined $i->{capture_group})
1069 ? scalar @{$i->{capture_group}} : 0;
1070
1071 # At least one rule is required.
1072 my $num_rules = scalar @{$i->{rule}};
1073 unless ( 0 < $num_rules )
1074 {
1075 FAIL("No rule for $n->{name} $i->{node_inst}");
1076 }
1077
1078 # Child nodes may not exist for this node.
1079 my $num_bit = (defined $i->{bit}) ? scalar @{$i->{bit}} : 0;
1080
1081 # Register instance metadata
1082 __bin($fh, 1, $i->{node_inst});
1083 __bin($fh, 1, $num_cap_regs );
1084 __bin($fh, 1, $num_rules );
1085 __bin($fh, 1, $num_bit );
1086
1087 if ( 0 < $num_cap_regs )
1088 {
1089 for my $cg ( @{$i->{capture_group}} )
1090 {
1091 # Register capture register metadata
1092 __bin($fh, 3, __hash(3, $cg->{reg_name}));
1093 __bin($fh, 1, $cg->{reg_inst} );
1094 }
1095 }
1096
1097 for my $r ( @{$i->{rule}} )
1098 {
1099 # Register rule metadata
Zane Shelley3d308902021-06-04 16:35:33 -05001100 __bin($fh, 1, $ATTN_TYPE->{$r->{attn_type}}->[0]);
Zane Shelleyabc51c22020-11-09 21:35:35 -06001101 __printExpr($fh, $reg_size, $r->{expr});
1102 }
1103
1104 if ( 0 < $num_bit )
1105 {
1106 for my $b ( @{$i->{bit}} )
1107 {
1108 # Register child node metadata
1109 __bin($fh, 1, $b->{pos} );
1110 __bin($fh, 2, __hash(2, $b->{child_node}));
1111 __bin($fh, 1, $b->{node_inst} );
1112 }
1113 }
1114 }
1115 }
1116}
1117
1118#-------------------------------------------------------------------------------
1119
1120sub __printAttnTree($$)
1121{
1122 my ( $fh, $data ) = @_;
1123
1124 my $num_root_nodes = scalar @{$data};
1125 FAIL("No root nodes defined") unless ( 0 < $num_root_nodes );
1126
1127 # Root Node list metadata
1128 __bin($fh, 1, $_) for ( unpack("C*", "ROOT") );
1129 __bin($fh, 1, $num_root_nodes);
1130
1131 for my $r ( @{$data} )
1132 {
1133 # Root Node metadata
Zane Shelley3d308902021-06-04 16:35:33 -05001134 __bin($fh, 1, $ATTN_TYPE->{$r->{attn_type}}->[0]);
1135 __bin($fh, 2, __hash(2, $r->{root_node}) );
1136 __bin($fh, 1, $r->{node_inst} );
Zane Shelleyabc51c22020-11-09 21:35:35 -06001137 }
1138}
1139
1140#-------------------------------------------------------------------------------
1141
Zane Shelley0a905012021-04-26 17:07:24 -05001142sub __printParserData($$$$)
Zane Shelleyabc51c22020-11-09 21:35:35 -06001143{
Zane Shelley0a905012021-04-26 17:07:24 -05001144 my ( $fh, $model_ec, $sig_list, $reg_list) = @_;
Zane Shelleyabc51c22020-11-09 21:35:35 -06001145
Zane Shelley74678c12021-06-04 15:46:16 -05001146 # IMPORTANT: All hash keys with hex values must be lowercase.
1147
Zane Shelley3d308902021-06-04 16:35:33 -05001148 my $attns = {};
Zane Shelley0a905012021-04-26 17:07:24 -05001149 my $regs = {};
1150 my $sigs = {};
Zane Shelleyabc51c22020-11-09 21:35:35 -06001151
Zane Shelley13d04082021-06-04 08:40:48 -05001152 # Get the chip info.
1153 my $info = $SUPPORTED_MODEL_EC->{$model_ec};
1154 $info->{'id'} = sprintf('%08x', $info->{'id'});
1155
Zane Shelley3d308902021-06-04 16:35:33 -05001156 # Get the list of attention types.
1157 while ( my ($k, $v) = each %{$ATTN_TYPE} )
1158 {
1159 $attns->{$v->[0]} = $v->[1];
1160 }
1161
Zane Shelleybc3c0402021-06-04 16:11:21 -05001162 # Get the signature data.
Zane Shelley0a905012021-04-26 17:07:24 -05001163 for my $s ( @{$sig_list} )
Zane Shelleyabc51c22020-11-09 21:35:35 -06001164 {
Zane Shelleybc3c0402021-06-04 16:11:21 -05001165 # Format is:
1166 # { id : [ name, { bit : desc, ... } ], ... }
Zane Shelley0a905012021-04-26 17:07:24 -05001167
Zane Shelleybc3c0402021-06-04 16:11:21 -05001168 # The ID is a 2-byte hash of the node name (lowercase).
1169 my $id = sprintf('%04x', __hash(2, $s->{name}));
1170
1171 if ( exists($sigs->{$id}) )
Zane Shelley0a905012021-04-26 17:07:24 -05001172 {
Zane Shelleybc3c0402021-06-04 16:11:21 -05001173 # Check for hash collisions.
1174 if ($sigs->{$id}->[0] ne $s->{name} )
1175 {
1176 FAIL("Node hash collision for $id: $sigs->{$id}->[0] " .
1177 "and $s->{name}");
1178 }
1179 }
1180 else
1181 {
1182 # Initialize this node.
1183 $sigs->{$id} = [ $s->{name}, {} ];
Zane Shelley0a905012021-04-26 17:07:24 -05001184 }
1185
Zane Shelleybc3c0402021-06-04 16:11:21 -05001186 # Check for signature collisions.
1187 if ( exists($sigs->{$id}->[1]->{$s->{bit}}) )
Zane Shelley0a905012021-04-26 17:07:24 -05001188 {
Zane Shelleybc3c0402021-06-04 16:11:21 -05001189 # Check for signature collisions.
1190 if ( $sigs->{$id}->[1]->{$s->{bit}} ne $s->{desc} )
1191 {
1192 FAIL("Multiple signatures for $s->{name} bit $s->{bit}:\n" .
1193 " $sigs->{$id}->[1]->{$s->{bit}}\n" .
1194 " $s->{desc}");
1195 }
Zane Shelley0a905012021-04-26 17:07:24 -05001196 }
Zane Shelleybc3c0402021-06-04 16:11:21 -05001197 else
1198 {
1199 # Set the signature for this bit.
1200 $sigs->{$id}->[1]->{$s->{bit}} = $s->{desc};
1201 }
Zane Shelleyabc51c22020-11-09 21:35:35 -06001202 }
Zane Shelley0a905012021-04-26 17:07:24 -05001203
Zane Shelley74678c12021-06-04 15:46:16 -05001204 # Get the register data.
Zane Shelley0a905012021-04-26 17:07:24 -05001205 for my $r ( @{$reg_list} )
1206 {
Zane Shelley74678c12021-06-04 15:46:16 -05001207 # Format is:
1208 # { id : [ name, { inst : addr, ... } ], ... }
1209
1210 # The ID is a 3-byte hash of the register name (lowercase).
Zane Shelley0a905012021-04-26 17:07:24 -05001211 my $id = sprintf('%06x', __hash(3, $r->{name}));
1212
Zane Shelley74678c12021-06-04 15:46:16 -05001213 if ( exists($regs->{$id}) )
Zane Shelley0a905012021-04-26 17:07:24 -05001214 {
Zane Shelley74678c12021-06-04 15:46:16 -05001215 # Check for hash collisions.
1216 if ( $regs->{$id}->[0] ne $r->{name} )
1217 {
1218 FAIL("Register hash collision for $id: " .
1219 "$regs->{$id}->[0] and $r->{name}");
1220 }
1221 }
1222 else
1223 {
1224 # Initialize this register.
1225 $regs->{$id} = [ $r->{name}, {} ];
Zane Shelley0a905012021-04-26 17:07:24 -05001226 }
1227
Zane Shelley74678c12021-06-04 15:46:16 -05001228 # Add the address for each instance of the register (shouldn't have to
1229 # worry about duplicates).
1230 for ( @{$r->{instance}} )
1231 {
1232 $regs->{$id}->[1]->{$_->{reg_inst}} = $_->{addr};
1233 }
Zane Shelley0a905012021-04-26 17:07:24 -05001234 }
1235
1236 my $data =
1237 {
Zane Shelley13d04082021-06-04 08:40:48 -05001238 'model_ec' => $info,
Zane Shelley3d308902021-06-04 16:35:33 -05001239 'attn_types' => $attns,
Zane Shelleybc3c0402021-06-04 16:11:21 -05001240 'registers' => $regs,
1241 'signatures' => $sigs,
Zane Shelley0a905012021-04-26 17:07:24 -05001242 };
1243
1244 print $fh to_json( $data, {utf8 => 1, pretty => 1, canonical => 1} );
Zane Shelleyabc51c22020-11-09 21:35:35 -06001245}
1246
1247#-------------------------------------------------------------------------------
1248
Zane Shelley738276a2021-05-24 12:55:34 -05001249sub buildDataFiles($$)
Zane Shelleyabc51c22020-11-09 21:35:35 -06001250{
1251 my ( $dir, $data ) = @_;
1252
1253 while ( my ($model_ec, $chip) = each %{$data} )
1254 {
1255 unless ( defined $chip->{register} )
1256 {
1257 FAIL("Chip $model_ec does not contain registers");
1258 }
1259 unless ( defined $chip->{node} )
1260 {
1261 FAIL("Chip $model_ec does not contain nodes");
1262 }
1263 unless ( defined $chip->{attn_tree} )
1264 {
1265 FAIL("Chip $model_ec does not contain attn_tree information");
1266 }
Zane Shelley0a905012021-04-26 17:07:24 -05001267 unless ( defined $chip->{signature} )
1268 {
1269 FAIL("Chip $model_ec does not contain signatures");
1270 }
1271
1272 # Chip Data Binary files ###############################################
Zane Shelleyabc51c22020-11-09 21:35:35 -06001273
Zane Shelley738276a2021-05-24 12:55:34 -05001274 if ( $gen_cdb )
1275 {
1276 my $bin_file = "$dir/chip_data_" . lc $model_ec . ".cdb";
1277 open my $bin_fh, '>', $bin_file or die "Cannot open $bin_file: $!";
1278 binmode $bin_fh; # writes a binary file
Zane Shelleyabc51c22020-11-09 21:35:35 -06001279
Zane Shelley738276a2021-05-24 12:55:34 -05001280 # Chip Data File metadata
1281 __bin($bin_fh, 1, $_) for ( unpack("C*", "CHIPDATA") );
Zane Shelley13d04082021-06-04 08:40:48 -05001282 __bin($bin_fh, 4, $SUPPORTED_MODEL_EC->{$model_ec}->{id});
1283 __bin($bin_fh, 1, $FILE_VERSION->{VER_01} );
Zane Shelleyabc51c22020-11-09 21:35:35 -06001284
Zane Shelley738276a2021-05-24 12:55:34 -05001285 __printRegisters( $bin_fh, $chip->{register} );
1286 __printNodes( $bin_fh, $chip->{node} );
1287 __printAttnTree( $bin_fh, $chip->{attn_tree} );
Zane Shelleyabc51c22020-11-09 21:35:35 -06001288
Zane Shelley738276a2021-05-24 12:55:34 -05001289 close $bin_fh;
1290 }
Zane Shelleyabc51c22020-11-09 21:35:35 -06001291
Zane Shelley0a905012021-04-26 17:07:24 -05001292 # eBMC PEL parsing JSON ################################################
Zane Shelleyabc51c22020-11-09 21:35:35 -06001293
Zane Shelley738276a2021-05-24 12:55:34 -05001294 if ( $gen_json )
1295 {
1296 my $file = "$dir/pel_parser_data_" . lc $model_ec . ".json";
1297 open my $fh, '>', $file or die "Cannot open $file: $!";
Zane Shelleyabc51c22020-11-09 21:35:35 -06001298
Zane Shelley738276a2021-05-24 12:55:34 -05001299 __printParserData( $fh, $model_ec, $chip->{signature},
1300 $chip->{register} );
Zane Shelleyabc51c22020-11-09 21:35:35 -06001301
Zane Shelley738276a2021-05-24 12:55:34 -05001302 close $fh;
1303 }
Zane Shelleyabc51c22020-11-09 21:35:35 -06001304 }
1305}
1306