VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   1) #!/usr/bin/perl
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   2) # SPDX-License-Identifier: GPL-2.0
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   3) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   4) use strict;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   5) use Pod::Usage;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   6) use Getopt::Long;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   7) use File::Find;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100   8) use Fcntl ':mode';
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100   9) use Cwd 'abs_path';
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  10) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  11) my $help;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  12) my $man;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  13) my $debug;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  14) my $arch;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  15) my $feat;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  16) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  17) my $basename = abs_path($0);
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  18) $basename =~ s,/[^/]+$,/,;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  19) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  20) my $prefix=$basename . "../Documentation/features";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  21) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  22) # Used only at for full features output. The script will auto-adjust
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  23) # such values for the minimal possible values
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  24) my $status_size = 1;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  25) my $description_size = 1;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  26) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  27) GetOptions(
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  28) 	"debug|d+" => \$debug,
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  29) 	"dir=s" => \$prefix,
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  30) 	'help|?' => \$help,
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  31) 	'arch=s' => \$arch,
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  32) 	'feat=s' => \$feat,
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  33) 	'feature=s' => \$feat,
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  34) 	man => \$man
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  35) ) or pod2usage(2);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  36) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  37) pod2usage(1) if $help;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  38) pod2usage(-exitstatus => 0, -verbose => 2) if $man;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  39) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  40) pod2usage(1) if (scalar @ARGV < 1 || @ARGV > 2);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  41) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  42) my ($cmd, $arg) = @ARGV;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  43) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  44) pod2usage(2) if ($cmd ne "current" && $cmd ne "rest" && $cmd ne "validate"
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100  45) 		&& $cmd ne "ls" && $cmd ne "list");
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  46) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  47) require Data::Dumper if ($debug);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  48) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  49) my %data;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  50) my %archs;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  51) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  52) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  53) # Displays an error message, printing file name and line
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  54) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  55) sub parse_error($$$$) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  56) 	my ($file, $ln, $msg, $data) = @_;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  57) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  58) 	$data =~ s/\s+$/\n/;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  59) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  60) 	print STDERR "Warning: file $file#$ln:\n\t$msg";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  61) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  62) 	if ($data ne "") {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  63) 		print STDERR ". Line\n\t\t$data";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  64) 	} else {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  65) 	    print STDERR "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  66) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  67) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  68) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  69) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  70) # Parse a features file, storing its contents at %data
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  71) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  72) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  73) my $h_name = "Feature";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  74) my $h_kconfig = "Kconfig";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  75) my $h_description = "Description";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  76) my $h_subsys = "Subsystem";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  77) my $h_status = "Status";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  78) my $h_arch = "Architecture";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  79) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  80) my $max_size_name = length($h_name);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  81) my $max_size_kconfig = length($h_kconfig);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  82) my $max_size_description = length($h_description);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  83) my $max_size_subsys = length($h_subsys);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  84) my $max_size_status = length($h_status);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  85) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  86) my $max_size_arch = 0;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  87) my $max_size_arch_with_header;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100  88) my $max_description_word = 0;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  89) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  90) sub parse_feat {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  91) 	my $file = $File::Find::name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  92) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  93) 	my $mode = (stat($file))[2];
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  94) 	return if ($mode & S_IFDIR);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  95) 	return if ($file =~ m,($prefix)/arch-support.txt,);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  96) 	return if (!($file =~ m,arch-support.txt$,));
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  97) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  98) 	my $subsys = "";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100  99) 	$subsys = $2 if ( m,.*($prefix)/([^/]+).*,);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 100) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 101) 	if (length($subsys) > $max_size_subsys) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 102) 		$max_size_subsys = length($subsys);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 103) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 104) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 105) 	my $name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 106) 	my $kconfig;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 107) 	my $description;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 108) 	my $comments = "";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 109) 	my $last_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 110) 	my $ln;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 111) 	my %arch_table;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 112) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 113) 	print STDERR "Opening $file\n" if ($debug > 1);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 114) 	open IN, $file;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 115) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 116) 	while(<IN>) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 117) 		$ln++;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 118) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 119) 		if (m/^\#\s+Feature\s+name:\s*(.*\S)/) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 120) 			$name = $1;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 121) 			if (length($name) > $max_size_name) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 122) 				$max_size_name = length($name);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 123) 			}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 124) 			next;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 125) 		}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 126) 		if (m/^\#\s+Kconfig:\s*(.*\S)/) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 127) 			$kconfig = $1;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 128) 			if (length($kconfig) > $max_size_kconfig) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 129) 				$max_size_kconfig = length($kconfig);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 130) 			}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 131) 			next;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 132) 		}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 133) 		if (m/^\#\s+description:\s*(.*\S)/) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 134) 			$description = $1;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 135) 			if (length($description) > $max_size_description) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 136) 				$max_size_description = length($description);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 137) 			}
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 138) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 139) 			foreach my $word (split /\s+/, $description) {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 140) 				if (length($word) > $max_description_word) {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 141) 					$max_description_word = length($word);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 142) 				}
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 143) 			}
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 144) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 145) 			next;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 146) 		}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 147) 		next if (m/^\\s*$/);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 148) 		next if (m/^\s*\-+\s*$/);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 149) 		next if (m/^\s*\|\s*arch\s*\|\s*status\s*\|\s*$/);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 150) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 151) 		if (m/^\#\s*(.*)/) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 152) 			$comments .= "$1\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 153) 			next;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 154) 		}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 155) 		if (m/^\s*\|\s*(\S+):\s*\|\s*(\S+)\s*\|\s*$/) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 156) 			my $a = $1;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 157) 			my $status = $2;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 158) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 159) 			if (length($status) > $max_size_status) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 160) 				$max_size_status = length($status);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 161) 			}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 162) 			if (length($a) > $max_size_arch) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 163) 				$max_size_arch = length($a);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 164) 			}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 165) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 166) 			$status = "---" if ($status =~ m/^\.\.$/);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 167) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 168) 			$archs{$a} = 1;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 169) 			$arch_table{$a} = $status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 170) 			next;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 171) 		}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 172) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 173) 		#Everything else is an error
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 174) 		parse_error($file, $ln, "line is invalid", $_);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 175) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 176) 	close IN;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 177) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 178) 	if (!$name) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 179) 		parse_error($file, $ln, "Feature name not found", "");
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 180) 		return;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 181) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 182) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 183) 	parse_error($file, $ln, "Subsystem not found", "") if (!$subsys);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 184) 	parse_error($file, $ln, "Kconfig not found", "") if (!$kconfig);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 185) 	parse_error($file, $ln, "Description not found", "") if (!$description);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 186) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 187) 	if (!%arch_table) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 188) 		parse_error($file, $ln, "Architecture table not found", "");
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 189) 		return;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 190) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 191) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 192) 	$data{$name}->{where} = $file;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 193) 	$data{$name}->{subsys} = $subsys;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 194) 	$data{$name}->{kconfig} = $kconfig;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 195) 	$data{$name}->{description} = $description;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 196) 	$data{$name}->{comments} = $comments;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 197) 	$data{$name}->{table} = \%arch_table;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 198) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 199) 	$max_size_arch_with_header = $max_size_arch + length($h_arch);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 200) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 201) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 202) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 203) # Output feature(s) for a given architecture
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 204) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 205) sub output_arch_table {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 206) 	my $title = "Feature status on $arch architecture";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 207) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 208) 	print "=" x length($title) . "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 209) 	print "$title\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 210) 	print "=" x length($title) . "\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 211) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 212) 	print "=" x $max_size_subsys;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 213) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 214) 	print "=" x $max_size_name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 215) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 216) 	print "=" x $max_size_kconfig;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 217) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 218) 	print "=" x $max_size_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 219) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 220) 	print "=" x $max_size_description;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 221) 	print "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 222) 	printf "%-${max_size_subsys}s  ", $h_subsys;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 223) 	printf "%-${max_size_name}s  ", $h_name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 224) 	printf "%-${max_size_kconfig}s  ", $h_kconfig;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 225) 	printf "%-${max_size_status}s  ", $h_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 226) 	printf "%-${max_size_description}s\n", $h_description;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 227) 	print "=" x $max_size_subsys;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 228) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 229) 	print "=" x $max_size_name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 230) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 231) 	print "=" x $max_size_kconfig;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 232) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 233) 	print "=" x $max_size_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 234) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 235) 	print "=" x $max_size_description;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 236) 	print "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 237) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 238) 	foreach my $name (sort {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 239) 				($data{$a}->{subsys} cmp $data{$b}->{subsys}) ||
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 240) 				("\L$a" cmp "\L$b")
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 241) 			       } keys %data) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 242) 		next if ($feat && $name ne $feat);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 243) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 244) 		my %arch_table = %{$data{$name}->{table}};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 245) 		printf "%-${max_size_subsys}s  ", $data{$name}->{subsys};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 246) 		printf "%-${max_size_name}s  ", $name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 247) 		printf "%-${max_size_kconfig}s  ", $data{$name}->{kconfig};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 248) 		printf "%-${max_size_status}s  ", $arch_table{$arch};
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 249) 		printf "%-s\n", $data{$name}->{description};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 250) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 251) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 252) 	print "=" x $max_size_subsys;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 253) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 254) 	print "=" x $max_size_name;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 255) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 256) 	print "=" x $max_size_kconfig;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 257) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 258) 	print "=" x $max_size_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 259) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 260) 	print "=" x $max_size_description;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 261) 	print "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 262) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 263) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 264) #
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 265) # list feature(s) for a given architecture
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 266) #
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 267) sub list_arch_features {
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 268) 	print "#\n# Kernel feature support matrix of the '$arch' architecture:\n#\n";
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 269) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 270) 	foreach my $name (sort {
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 271) 				($data{$a}->{subsys} cmp $data{$b}->{subsys}) ||
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 272) 				("\L$a" cmp "\L$b")
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 273) 			       } keys %data) {
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 274) 		next if ($feat && $name ne $feat);
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 275) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 276) 		my %arch_table = %{$data{$name}->{table}};
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 277) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 278) 		my $status = $arch_table{$arch};
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 279) 		$status = " " x ((4 - length($status)) / 2) . $status;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 280) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 281) 		printf " %${max_size_subsys}s/ ", $data{$name}->{subsys};
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 282) 		printf "%-${max_size_name}s: ", $name;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 283) 		printf "%-5s|   ", $status;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 284) 		printf "%${max_size_kconfig}s # ", $data{$name}->{kconfig};
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 285) 		printf " %s\n", $data{$name}->{description};
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 286) 	}
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 287) }
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 288) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 289) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 290) # Output a feature on all architectures
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 291) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 292) sub output_feature {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 293) 	my $title = "Feature $feat";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 294) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 295) 	print "=" x length($title) . "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 296) 	print "$title\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 297) 	print "=" x length($title) . "\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 298) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 299) 	print ":Subsystem: $data{$feat}->{subsys} \n" if ($data{$feat}->{subsys});
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 300) 	print ":Kconfig: $data{$feat}->{kconfig} \n" if ($data{$feat}->{kconfig});
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 301) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 302) 	my $desc = $data{$feat}->{description};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 303) 	$desc =~ s/^([a-z])/\U$1/;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 304) 	$desc =~ s/\.?\s*//;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 305) 	print "\n$desc.\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 306) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 307) 	my $com = $data{$feat}->{comments};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 308) 	$com =~ s/^\s+//;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 309) 	$com =~ s/\s+$//;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 310) 	if ($com) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 311) 		print "Comments\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 312) 		print "--------\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 313) 		print "$com\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 314) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 315) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 316) 	print "=" x $max_size_arch_with_header;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 317) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 318) 	print "=" x $max_size_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 319) 	print "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 320) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 321) 	printf "%-${max_size_arch}s  ", $h_arch;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 322) 	printf "%-${max_size_status}s", $h_status . "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 323) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 324) 	print "=" x $max_size_arch_with_header;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 325) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 326) 	print "=" x $max_size_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 327) 	print "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 328) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 329) 	my %arch_table = %{$data{$feat}->{table}};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 330) 	foreach my $arch (sort keys %arch_table) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 331) 		printf "%-${max_size_arch}s  ", $arch;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 332) 		printf "%-${max_size_status}s\n", $arch_table{$arch};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 333) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 334) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 335) 	print "=" x $max_size_arch_with_header;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 336) 	print "  ";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 337) 	print "=" x $max_size_status;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 338) 	print "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 339) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 340) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 341) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 342) # Output all features for all architectures
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 343) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 344) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 345) sub matrix_lines($$$) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 346) 	my $desc_size = shift;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 347) 	my $status_size = shift;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 348) 	my $header = shift;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 349) 	my $fill;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 350) 	my $ln_marker;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 351) 
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 352) 	if ($header) {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 353) 		$ln_marker = "=";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 354) 	} else {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 355) 		$ln_marker = "-";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 356) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 357) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 358) 	$fill = $ln_marker;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 359) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 360) 	print "+";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 361) 	print $fill x $max_size_name;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 362) 	print "+";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 363) 	print $fill x $desc_size;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 364) 	print "+";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 365) 	print $ln_marker x $status_size;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 366) 	print "+\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 367) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 368) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 369) sub output_matrix {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 370) 	my $title = "Feature status on all architectures";
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 371) 	my $notcompat = "Not compatible";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 372) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 373) 	print "=" x length($title) . "\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 374) 	print "$title\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 375) 	print "=" x length($title) . "\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 376) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 377) 	my $desc_title = "$h_kconfig / $h_description";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 378) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 379) 	my $desc_size = $max_size_kconfig + 4;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 380) 	if (!$description_size) {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 381) 		$desc_size = $max_size_description if ($max_size_description > $desc_size);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 382) 	} else {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 383) 		$desc_size = $description_size if ($description_size > $desc_size);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 384) 	}
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 385) 	$desc_size = $max_description_word if ($max_description_word > $desc_size);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 386) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 387) 	$desc_size = length($desc_title) if (length($desc_title) > $desc_size);
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 388) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 389) 	$max_size_status = length($notcompat) if (length($notcompat) > $max_size_status);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 390) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 391) 	# Ensure that the status will fit
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 392) 	my $min_status_size = $max_size_status + $max_size_arch + 6;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 393) 	$status_size = $min_status_size if ($status_size < $min_status_size);
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 394) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 395) 
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 396) 	my $cur_subsys = "";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 397) 	foreach my $name (sort {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 398) 				($data{$a}->{subsys} cmp $data{$b}->{subsys}) or
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 399) 				("\L$a" cmp "\L$b")
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 400) 			       } keys %data) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 401) 
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 402) 		if ($cur_subsys ne $data{$name}->{subsys}) {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 403) 			if ($cur_subsys ne "") {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 404) 				printf "\n";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 405) 			}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 406) 
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 407) 			$cur_subsys = $data{$name}->{subsys};
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 408) 
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 409) 			my $title = "Subsystem: $cur_subsys";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 410) 			print "$title\n";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 411) 			print "=" x length($title) . "\n\n";
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 412) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 413) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 414) 			matrix_lines($desc_size, $status_size, 0);
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 415) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 416) 			printf "|%-${max_size_name}s", $h_name;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 417) 			printf "|%-${desc_size}s", $desc_title;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 418) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 419) 			printf "|%-${status_size}s|\n", "Status per architecture";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 420) 			matrix_lines($desc_size, $status_size, 1);
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 421) 		}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 422) 
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 423) 		my %arch_table = %{$data{$name}->{table}};
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 424) 		my $cur_status = "";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 425) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 426) 		my (@lines, @descs);
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 427) 		my $line = "";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 428) 		foreach my $arch (sort {
4fa32f8702891 (Mauro Carvalho Chehab 2020-12-04 16:32:29 +0100 429) 					($arch_table{$b} cmp $arch_table{$a}) or
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 430) 					("\L$a" cmp "\L$b")
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 431) 				       } keys %arch_table) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 432) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 433) 			my $status = $arch_table{$arch};
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 434) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 435) 			if ($status eq "---") {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 436) 				$status = $notcompat;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 437) 			}
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 438) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 439) 			if ($status ne $cur_status) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 440) 				if ($line ne "") {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 441) 					push @lines, $line;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 442) 					$line = "";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 443) 				}
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 444) 				$line = "- **" . $status . "**: " . $arch;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 445) 			} elsif (length($line) + length ($arch) + 2 < $status_size) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 446) 				$line .= ", " . $arch;
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 447) 			} else {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 448) 				push @lines, $line;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 449) 				$line = "  " . $arch;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 450) 			}
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 451) 			$cur_status = $status;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 452) 		}
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 453) 		push @lines, $line if ($line ne "");
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 454) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 455) 		my $description = $data{$name}->{description};
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 456) 		while (length($description) > $desc_size) {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 457) 			my $d = substr $description, 0, $desc_size;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 458) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 459) 			# Ensure that it will end on a space
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 460) 			# if it can't, it means that the size is too small
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 461) 			# Instead of aborting it, let's print what we have
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 462) 			if (!($d =~ s/^(.*)\s+.*/$1/)) {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 463) 				$d = substr $d, 0, -1;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 464) 				push @descs, "$d\\";
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 465) 				$description =~ s/^\Q$d\E//;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 466) 			} else {
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 467) 				push @descs, $d;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 468) 				$description =~ s/^\Q$d\E\s+//;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 469) 			}
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 470) 		}
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 471) 		push @descs, $description;
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 472) 
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 473) 		# Ensure that the full description will be printed
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 474) 		push @lines, "" while (scalar(@lines) < 2 + scalar(@descs));
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 475) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 476) 		my $ln = 0;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 477) 		for my $line(@lines) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 478) 			if (!$ln) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 479) 				printf "|%-${max_size_name}s", $name;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 480) 				printf "|%-${desc_size}s", "``" . $data{$name}->{kconfig} . "``";
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 481) 			} elsif ($ln >= 2 && scalar(@descs)) {
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 482) 				printf "|%-${max_size_name}s", "";
f5889e70b9ccd (Mauro Carvalho Chehab 2020-12-04 16:32:30 +0100 483) 				printf "|%-${desc_size}s", shift @descs;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 484) 			} else {
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 485) 				printf "|%-${max_size_name}s", "";
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 486) 				printf "|%-${desc_size}s", "";
ba813f7c2dc89 (Mauro Carvalho Chehab 2020-11-30 16:36:31 +0100 487) 			}
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 488) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 489) 			printf "|%-${status_size}s|\n", $line;
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 490) 
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 491) 			$ln++;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 492) 		}
dbb9090232936 (Mauro Carvalho Chehab 2020-12-04 16:32:28 +0100 493) 		matrix_lines($desc_size, $status_size, 0);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 494) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 495) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 496) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 497) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 498) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 499) # Parses all feature files located at $prefix dir
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 500) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 501) find({wanted =>\&parse_feat, no_chdir => 1}, $prefix);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 502) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 503) print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug);
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 504) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 505) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 506) # Handles the command
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 507) #
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 508) if ($cmd eq "current") {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 509) 	$arch = qx(uname -m | sed 's/x86_64/x86/' | sed 's/i386/x86/');
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 510) 	$arch =~s/\s+$//;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 511) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 512) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 513) if ($cmd eq "ls" or $cmd eq "list") {
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 514) 	if (!$arch) {
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 515) 		$arch = qx(uname -m | sed 's/x86_64/x86/' | sed 's/i386/x86/');
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 516) 		$arch =~s/\s+$//;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 517) 	}
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 518) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 519) 	list_arch_features;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 520) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 521) 	exit;
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 522) }
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 523) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 524) if ($cmd ne "validate") {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 525) 	if ($arch) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 526) 		output_arch_table;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 527) 	} elsif ($feat) {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 528) 		output_feature;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 529) 	} else {
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 530) 		output_matrix;
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 531) 	}
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 532) }
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 533) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 534) __END__
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 535) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 536) =head1 NAME
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 537) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 538) get_feat.pl - parse the Linux Feature files and produce a ReST book.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 539) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 540) =head1 SYNOPSIS
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 541) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 542) B<get_feat.pl> [--debug] [--man] [--help] [--dir=<dir>] [--arch=<arch>]
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 543) 	       [--feature=<feature>|--feat=<feature>] <COMAND> [<ARGUMENT>]
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 544) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 545) Where <COMMAND> can be:
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 546) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 547) =over 8
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 548) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 549) B<current>               - output table in ReST compatible ASCII format
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 550) 			   with features for this machine's architecture
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 551) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 552) B<rest>                  - output table(s)  in ReST compatible ASCII format
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 553) 			   with features in ReST markup language. The output
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 554) 			   is affected by --arch or --feat/--feature flags.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 555) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 556) B<validate>              - validate the contents of the files under
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 557) 			   Documentation/features.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 558) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 559) B<ls> or B<list>         - list features for this machine's architecture,
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 560) 			   using an easier to parse format.
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 561) 			   The output is affected by --arch flag.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 562) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 563) =back
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 564) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 565) =head1 OPTIONS
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 566) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 567) =over 8
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 568) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 569) =item B<--arch>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 570) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 571) Output features for an specific architecture, optionally filtering for
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 572) a single specific feature.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 573) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 574) =item B<--feat> or B<--feature>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 575) 
ca908577790fd (Mauro Carvalho Chehab 2020-11-30 16:36:32 +0100 576) Output features for a single specific feature.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 577) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 578) =item B<--dir>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 579) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 580) Changes the location of the Feature files. By default, it uses
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 581) the Documentation/features directory.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 582) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 583) =item B<--debug>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 584) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 585) Put the script in verbose mode, useful for debugging. Can be called multiple
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 586) times, to increase verbosity.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 587) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 588) =item B<--help>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 589) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 590) Prints a brief help message and exits.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 591) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 592) =item B<--man>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 593) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 594) Prints the manual page and exits.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 595) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 596) =back
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 597) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 598) =head1 DESCRIPTION
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 599) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 600) Parse the Linux feature files from Documentation/features (by default),
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 601) optionally producing results at ReST format.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 602) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 603) It supports output data per architecture, per feature or a
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 604) feature x arch matrix.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 605) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 606) When used with B<rest> command, it will use either one of the tree formats:
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 607) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 608) If neither B<--arch> or B<--feature> arguments are used, it will output a
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 609) matrix with features per architecture.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 610) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 611) If B<--arch> argument is used, it will output the features availability for
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 612) a given architecture.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 613) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 614) If B<--feat> argument is used, it will output the content of the feature
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 615) file using ReStructured Text markup.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 616) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 617) =head1 BUGS
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 618) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 619) Report bugs to Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 620) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 621) =head1 COPYRIGHT
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 622) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 623) Copyright (c) 2019 by Mauro Carvalho Chehab <mchehab+samsung@kernel.org>.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 624) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 625) License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 626) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 627) This is free software: you are free to change and redistribute it.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 628) There is NO WARRANTY, to the extent permitted by law.
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 629) 
52a4be3ffc0fe (Mauro Carvalho Chehab 2020-11-30 16:36:30 +0100 630) =cut