the following patch was just integrated into master:
commit dde96fb2f13ae3e21d6a6fff0fe1f2f422dbecf6
Author: Martin Roth <martinroth(a)google.com>
Date: Wed Nov 25 22:33:20 2015 -0700
soc/intel/common: Fix whitespace in Kconfig
Change leading spaces to tabs.
Change-Id: Ief138f5f68198578ba9dddb8fbdabbd9a0185a21
Signed-off-by: Martin Roth <martinroth(a)google.com>
Reviewed-on: https://review.coreboot.org/12546
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
See https://review.coreboot.org/12546 for details.
-gerrit
the following patch was just integrated into master:
commit 232df8b2d232f481576737de952c6168d4d00874
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Nov 23 16:14:13 2015 -0700
kontron/986lcd-m: Fix IASL warning and remark
- Add an empty Operating Region for the empty _REG method
- Serialize _CRS Method
- Remove Kconfig default disabling IASL warnings as errors
Fixes IASL Warning and remark:
dsdt.aml 1451: Method (_CRS, 0)
Remark 2120 - ^ Control Method should be made Serialized
(due to creation of named objects within)
dsdt.aml 1460: Method (_REG, 2)
Warning 3079 - ^ _REG has no corresponding Operation Region
Change-Id: I4aa59468a89c4013146ab34004476a0968c60707
Signed-off-by: Martin Roth <martinroth(a)google.com>
Reviewed-on: https://review.coreboot.org/12521
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
Tested-by: build bot (Jenkins)
See https://review.coreboot.org/12521 for details.
-gerrit
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12558
-gerrit
commit 1800c7045a984dfcbfaa29f6f574417a3256c312
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Fri Nov 27 12:36:28 2015 +0100
build system: actually provide revision information in defconfig
The config file added to CBFS is the short version created by defconfig.
The build system tried to add a header describing the version for quite
a while now, but failed because it wrote to the file, then had kconfig
overwrite it with the config data.
While at it, rely on build.h and its version information instead of
calling git manually.
Change-Id: I5e4d6c857594a55432c05bf1480973fc950f4d4a
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
---
Makefile.inc | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 5aae86b..5da7441 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -228,10 +228,13 @@ cbfs-files-processor-vsa= \
# arg1: input
# arg2: output
cbfs-files-processor-defconfig= \
- $(eval $(2): $(1) ; \
+ $(eval $(2): $(1) $(obj)/build.h; \
printf " CREATE $(2) (from $(1))\n"; \
- echo "\# This image was built using git revision" `git rev-parse HEAD` > $(2).tmp && \
- $(MAKE) DOTCONFIG=$(1) DEFCONFIG=$(2).tmp savedefconfig && \
+ printf "\# This image was built using coreboot " > $(2).tmp && \
+ grep "\<COREBOOT_VERSION\>" $(obj)/build.h |cut -d\" -f2 >> $(2).tmp && \
+ $(MAKE) DOTCONFIG=$(1) DEFCONFIG=$(2).tmp2 savedefconfig && \
+ cat $(2).tmp2 >> $(2).tmp && \
+ rm -f $(2).tmp2 && \
\mv -f $(2).tmp $(2))
#######################################################################
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12557
-gerrit
commit 8aa528f6c8b1b3890fa3235141be3cd7f21f7e4d
Author: Martin Roth <martinroth(a)google.com>
Date: Wed Nov 25 12:44:15 2015 -0700
toolchain.inc: Improve help messages for coreboot toolchain
Show better help text on how to compile the coreboot toolchain or use
an unsupported toolchain.
Change-Id: I64a2159d324d673784669b2464c1a2769b048678
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
toolchain.inc | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/toolchain.inc b/toolchain.inc
index 0f3da83..e35b5b5 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -155,10 +155,16 @@ ifeq ($(CONFIG_COMPILER_GCC),y)
ifneq ($(CONFIG_ANY_TOOLCHAIN),y)
$(foreach arch,$(sort $(foreach stage,$(COREBOOT_STANDARD_STAGES),$(ARCH-$(stage)-y))), \
$(if $(shell $(CC_$(arch)) -v 2>&1 |grep -q "gcc version .*coreboot toolchain" || echo not-coreboot), \
- $(eval COMPILERFAIL:=1)$(warning Please use the coreboot toolchain for '$(arch)' (or prove that your toolchain works))))
+ $(eval COMPILERFAIL:=1)$(warning Please use the coreboot toolchain for '$(arch)')))
endif
endif
endif
ifeq ($(COMPILERFAIL),1)
-$(error consider building our compilers: make crossgcc)
+$(warning )
+$(warning To build the entire coreboot toolchain: make crossgcc)
+$(warning For more toolchain build targets: make help_toolchain)
+$(warning )
+$(warning *** To try to use your own toolchain, run 'make menuconfig', then select the)
+$(warning *** config option: General setup -> Allow building with any toolchain)
+$(error Note that this is NOT supported. Using it means you're on your own)
endif
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12543
-gerrit
commit 9611e01257f9cce96c6739871e8682b1c4255b0e
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Nov 26 22:34:42 2015 -0700
toolchain.inc: Add IASL test as part of coreboot toolchain
Even though coreboot has IASL as part of its toolchain, it was not being
picked up when testing to make sure coreboot is being compiled with
the coreboot toolchain.
This patch adds an iasl test when testing coreboot toolchain.
Change-Id: I5b989869417c3f60057a91842b911855d9528f1b
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
toolchain.inc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/toolchain.inc b/toolchain.inc
index e35b5b5..1b73ce9 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -151,17 +151,24 @@ ifneq ($(NOCOMPILE),1)
# only run if we're doing a build (not for tests, kconfig, ...), using gcc
# rationale: gcc versions by Linux distributions tend to be quite messed up
COMPILERFAIL:=0
+IASLFAIL:=0
ifeq ($(CONFIG_COMPILER_GCC),y)
ifneq ($(CONFIG_ANY_TOOLCHAIN),y)
$(foreach arch,$(sort $(foreach stage,$(COREBOOT_STANDARD_STAGES),$(ARCH-$(stage)-y))), \
$(if $(shell $(CC_$(arch)) -v 2>&1 |grep -q "gcc version .*coreboot toolchain" || echo not-coreboot), \
$(eval COMPILERFAIL:=1)$(warning Please use the coreboot toolchain for '$(arch)')))
+#if iasl doesn't match the current coreboot version, fail the test
+$(if $(shell $(IASL) -v 2>&1 | grep -q "$(shell util/crossgcc/buildgcc -s iasl)" || echo not-coreboot), \
+ $(eval COMPILERFAIL:=1)$(eval IASLFAIL:=1)$(warning Please use the coreboot toolchain version of iasl - $(shell util/crossgcc/buildgcc -s iasl)))
endif
endif
endif
ifeq ($(COMPILERFAIL),1)
$(warning )
$(warning To build the entire coreboot toolchain: make crossgcc)
+ifeq ($(IASLFAIL),1)
+$(warning To build just IASL: make iasl)
+endif
$(warning For more toolchain build targets: make help_toolchain)
$(warning )
$(warning *** To try to use your own toolchain, run 'make menuconfig', then select the)
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12556
-gerrit
commit 5ca64f512903c562d26538b9a0fde8c9b2a77f81
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Nov 26 21:51:03 2015 -0700
[DO_NOT_SUBMIT] amd/pi/00630F01: add HT3 Kconfig option
In northbridge.c, the Kconfig option _HT3_SUPPORT is being used.
Unfortunately, until this patch, that option didn't esixt, so the
value was always set to 4.
Should the kconfig option be added? What's the help text.
Should it default to on or off.
Should this be done in a different fashion? Can HT3 support
be detected?
Should this just always be set to 4, and the HT3 support be
removed?
Change-Id: I2682d3b620e2cee613c7421622a8c79db5ba3a86
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
src/northbridge/amd/pi/00630F01/Kconfig | 3 +++
src/northbridge/amd/pi/00630F01/northbridge.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/northbridge/amd/pi/00630F01/Kconfig b/src/northbridge/amd/pi/00630F01/Kconfig
index 293b12d..dbcb149 100644
--- a/src/northbridge/amd/pi/00630F01/Kconfig
+++ b/src/northbridge/amd/pi/00630F01/Kconfig
@@ -34,6 +34,9 @@ config MMCONF_BUS_NUMBER
int
default 64
+config HT3_SUPPORT
+ bool "Enable HT3 support"
+
config VGA_BIOS_ID
string
default "1002,1304"
diff --git a/src/northbridge/amd/pi/00630F01/northbridge.c b/src/northbridge/amd/pi/00630F01/northbridge.c
index 9f55874..72a0b64 100644
--- a/src/northbridge/amd/pi/00630F01/northbridge.c
+++ b/src/northbridge/amd/pi/00630F01/northbridge.c
@@ -1040,7 +1040,7 @@ static void cpu_bus_scan(device_t dev)
* otherwise the device under it will not be scanned
*/
int linknum;
-#if IS_ENABLED(CONFIG_HT3_SUPPORT)
+#if IS_ENABLED(CONFIG_HT3_SUPPORT) /* CONFIG_HT3_SUPPORT used here */
linknum = 8;
#else
linknum = 4;
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12553
-gerrit
commit 6c8f1a84756800c25f75f04cb3708690f21c1107
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Nov 26 17:46:45 2015 -0700
fsp_baytrail: Remove use of BAYTRAIL_SMM Kconfig symbol
The symbol BAYTRAIL_SMM was never valid (there's no config statment
initializing the symbol), but it was being selected and used
in the code.
Now that SMM is supported in fsp_baytrail, the code it was trying
to switch can be removed, and just set up for SMM.
Change-Id: I0fd4865a951734e728500e7baf593ff7eb556f73
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
src/soc/intel/fsp_baytrail/Kconfig | 1 -
src/soc/intel/fsp_baytrail/acpi.c | 11 ++---------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/soc/intel/fsp_baytrail/Kconfig b/src/soc/intel/fsp_baytrail/Kconfig
index 2325d75..506e731 100644
--- a/src/soc/intel/fsp_baytrail/Kconfig
+++ b/src/soc/intel/fsp_baytrail/Kconfig
@@ -35,7 +35,6 @@ config CPU_SPECIFIC_OPTIONS
select PARALLEL_MP
select REG_SCRIPT
select SMM_TSEG
- select BAYTRAIL_SMM
select SMP
select SPI_FLASH
select SSE2
diff --git a/src/soc/intel/fsp_baytrail/acpi.c b/src/soc/intel/fsp_baytrail/acpi.c
index 5a5b880..b925872 100644
--- a/src/soc/intel/fsp_baytrail/acpi.c
+++ b/src/soc/intel/fsp_baytrail/acpi.c
@@ -22,6 +22,7 @@
#include <arch/acpigen.h>
#include <arch/cpu.h>
#include <cpu/x86/msr.h>
+#include <cpu/x86/smm.h>
#include <cpu/intel/speedstep.h>
#include <cpu/intel/turbo.h>
#include <arch/smp/mpspec.h>
@@ -208,18 +209,10 @@ void acpi_fill_in_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
/* System Management */
fadt->sci_int = acpi_sci_irq();
-#if IS_ENABLED(CONFIG_BAYTRAIL_SMM)
+
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
-#else
- fadt->smi_cmd = 0x00; /* disable SMM */
- fadt->acpi_enable = 0x00; /* unused if SMI_CMD = 0 */
- fadt->acpi_disable = 0x00; /* unused if SMI_CMD = 0 */
-
- /* Enable ACPI */
- outl(inl(pmbase + 4) | 0x01, pmbase + 4);
-#endif
/* Power Control */
fadt->s4bios_req = 0x00;
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12555
-gerrit
commit 12f8821ba2f0561c9c398739aad124f5fcc2c1a4
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Nov 26 19:12:44 2015 -0700
kconfig_lint: Separate errors from warnings
- Create subroutines for printing warnings and errors
- Change all the existing warning and error routines to use subroutines
- Add new command line options to suppress errors and to print notes
Change-Id: I04893faffca21c5bb7b51be920cca4620dc283c3
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 233 ++++++++++++++++++++-----------------------------
1 file changed, 93 insertions(+), 140 deletions(-)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 36facb7..77913a6 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -25,18 +25,21 @@ use File::Find;
use Getopt::Long;
use Getopt::Std;
-my $suppress_error_output = 0; # flag to prevent warning and error text
-my $print_full_output = 0; # flag to print wholeconfig output
-my $output_file = "-"; # filename of output - set stdout by default
-my $dont_use_git_grep = 0;
+my $suppress_error_output = 0; # flag to prevent error text
+my $suppress_warning_output = 0; # flag to prevent warning text
+my $show_note_output = 0; # flag to show minor notes text
+my $print_full_output = 0; # flag to print wholeconfig output
+my $output_file = "-"; # filename of output - set stdout by default
+my $dont_use_git_grep = 0;
#globals
-my $top_dir = "."; # Directory where Kconfig is run
-my $root_dir = "src"; # Directory of the top level Kconfig file
-my $errors_found = 0; # count of warnings and errors
-my $exclude_dirs = '--exclude-dir="build" --exclude-dir="coreboot-builds" --exclude-dir="payloads" --exclude-dir="configs" --exclude-dir="util"'; # directories to exclude when searching for used symbols - NOT USED FOR GIT GREP (TODO)
-my @exclude_files = ('\.txt$', '\.tex$', 'config', '\.tags'); #files to exclude when looking for symbols
-my $config_file = ""; # name of config file to load symbol values from.
+my $top_dir = "."; # Directory where Kconfig is run
+my $root_dir = "src"; # Directory of the top level Kconfig file
+my $errors_found = 0; # count of errors
+my $warnings_found = 0;
+my $exclude_dirs = '--exclude-dir="build" --exclude-dir="coreboot-builds" --exclude-dir="payloads" --exclude-dir="configs" --exclude-dir="util"'; # directories to exclude when searching for used symbols - NOT USED FOR GIT GREP (TODO)
+my @exclude_files = ('\.txt$', '\.tex$', 'config', '\.tags'); #files to exclude when looking for symbols
+my $config_file = ""; # name of config file to load symbol values from.
my @wholeconfig; # document the entire kconfig structure
my %loaded_files; # list of each Kconfig file loaded
my %symbols; # main structure of all symbols declared
@@ -83,7 +86,37 @@ sub Main {
print_wholeconfig();
- exit($errors_found);
+ if ($errors_found) {
+ print "# $errors_found errors";
+ if ($warnings_found) {
+ print ", $warnings_found warnings";
+ }
+ print "\n";
+ }
+
+ exit($errors_found + $warnings_found);
+}
+
+#-------------------------------------------------------------------------------
+# Print and count errors
+#-------------------------------------------------------------------------------
+sub show_error {
+ my ($error_msg) = @_;
+ unless ($suppress_error_output) {
+ print "#!!!!! Error: $error_msg\n";
+ $errors_found++;
+ }
+}
+
+#-------------------------------------------------------------------------------
+# Print and count warnings
+#-------------------------------------------------------------------------------
+sub show_warning {
+ my ($warning_msg) = @_;
+ unless ($suppress_warning_output) {
+ print "#!!!!! Warning: $warning_msg\n";
+ $warnings_found++;
+ }
}
#-------------------------------------------------------------------------------
@@ -104,10 +137,7 @@ sub check_for_ifdef {
my $symbol = $3;
if ((exists $symbols{$symbol}) && ($symbols{$symbol}{type} ne "string")) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: #ifdef 'CONFIG_$symbol' used in $file at line $lineno. Symbols of type '$symbols{$symbol}{type}' are always defined.\n";
- }
- $errors_found++;
+ show_error("#ifdef 'CONFIG_$symbol' used in $file at line $lineno. Symbols of type '$symbols{$symbol}{type}' are always defined.");
}
}
}
@@ -124,10 +154,7 @@ sub check_for_ifdef {
next if ( $line =~ /^([^:]+):(\d+):.+defined\s*\(\s*CONFIG_$symbol.*(&&|\|\|)\s*!?\s*\(?\s*CONFIG_$symbol/ );
if ((exists $symbols{$symbol}) && ($symbols{$symbol}{type} ne "string")) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: defined 'CONFIG_$symbol' used in $file at line $lineno. Symbols of type '$symbols{$symbol}{type}' are always defined.\n";
- }
- $errors_found++;
+ show_error("defined 'CONFIG_$symbol' used in $file at line $lineno. Symbols of type '$symbols{$symbol}{type}' are always defined.");
}
}
}
@@ -150,15 +177,9 @@ sub check_for_def {
my $symbol = $3;
if ((exists $symbols{$symbol})) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: #define of symbol 'CONFIG_$symbol' used in $file at line $lineno.\n";
- }
- $errors_found++;
+ show_warning("#define of symbol 'CONFIG_$symbol' used in $file at line $lineno.");
} else {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: #define 'CONFIG_$symbol' used in $file at line $lineno. Other #defines should not look like Kconfig symbols.\n";
- }
- $errors_found++;
+ show_warning("#define 'CONFIG_$symbol' used in $file at line $lineno. Other #defines should not look like Kconfig symbols.");
}
}
}
@@ -182,16 +203,13 @@ sub check_is_enabled {
#make sure that
if (exists $symbols{$symbol}) {
if ($symbols{$symbol}{type} ne "bool") {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: IS_ENABLED(CONFIG_$symbol) used in $file at line $lineno. IS_ENABLED is only valid for type 'bool', not '$symbols{$symbol}{type}'.\n";
- }
- $errors_found++;
+ show_error("IS_ENABLED(CONFIG_$symbol) used in $file at line $lineno. IS_ENABLED is only valid for type 'bool', not '$symbols{$symbol}{type}'.");
}
} else {
- print "#!!!!! Warning: IS_ENABLED() used on unknown value CONFIG_$symbol in $file at line $lineno.\n";
+ show_error("IS_ENABLED() used on unknown value CONFIG_$symbol in $file at line $lineno.");
}
} else {
- print "# uninterpreted IS_ENABLED line: $line\n";
+ show_error("# uninterpreted IS_ENABLED line: $line");
}
}
}
@@ -221,10 +239,7 @@ sub check_defaults {
if ($default_set) {
my $filename = $symbols{$sym}{$sym_num}{file};
my $line_no = $symbols{$sym}{$sym_num}{default}{$def_num}{default_line_no};
- unless ($suppress_error_output) {
- print "#!!!!! Error: Default for '$sym' referenced in $filename at line $line_no will never be set - overridden by default set in $default_filename at line $default_line_no \n";
- }
- $errors_found++;
+ show_warning("Default for '$sym' referenced in $filename at line $line_no will never be set - overridden by default set in $default_filename at line $default_line_no");
}
else {
#if no default is set, see if this is a default with no dependencies
@@ -253,14 +268,11 @@ sub check_referenced_symbols {
#make sure the symbol was defined by a 'config' or 'choice' keyword
next if ( exists $symbols{$key} );
- #loop through each instance of the symbol to print out all of the invalid references
- for ( my $i = 0 ; $i <= $referenced_symbols{$key}{count} ; $i++ ) {
- my $filename = $referenced_symbols{$key}{$i}{filename};
- my $line_no = $referenced_symbols{$key}{$i}{line_no};
- unless ($suppress_error_output) {
- print "#!!!!! Error: Undefined Symbol '$key' used in $filename at line $line_no.\n";
- }
- $errors_found++;
+ #loop through each instance of the symbol to print out all of the invalid references
+ for ( my $i = 0 ; $i <= $referenced_symbols{$key}{count} ; $i++ ) {
+ my $filename = $referenced_symbols{$key}{$i}{filename};
+ my $line_no = $referenced_symbols{$key}{$i}{line_no};
+ show_error("Undefined Symbol '$key' used in $filename at line $line_no.");
}
}
}
@@ -322,10 +334,7 @@ sub check_used_symbols {
for ( my $i = 0 ; $i <= $symbols{$key}{count} ; $i++ ) {
my $filename = $symbols{$key}{$i}{file};
my $line_no = $symbols{$key}{$i}{line_no};
- unless ($suppress_error_output) {
- print "#!!!!! Warning: Unused symbol '$key' referenced in $filename at line $line_no.\n";
- }
- $errors_found++;
+ show_warning("Unused symbol '$key' referenced in $filename at line $line_no.");
}
}
}
@@ -439,18 +448,12 @@ sub build_and_parse_kconfig_tree {
elsif ( $line =~ /^\s*endchoice/ ) {
$inside_config = "";
if ( !$inside_choice ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: 'endchoice' keyword not within a choice block in $filename at line $line_no.\n";
- }
- $errors_found++;
+ show_error("'endchoice' keyword not within a choice block in $filename at line $line_no.");
}
$inside_choice = "";
if ( $configs_inside_choice == 0 ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: choice block has no symbols in $filename at line $line_no.\n";
- }
- $errors_found++;
+ show_error("choice block has no symbols in $filename at line $line_no.");
}
$configs_inside_choice = 0;
}
@@ -458,16 +461,10 @@ sub build_and_parse_kconfig_tree {
# [optional]
elsif ( $line =~ /^\s*optional/ ) {
if ($inside_config) {
- unless ($suppress_error_output) {
- print "#!!!!! Error: Keyword 'optional' appears inside config for '$inside_config' in $filename at line $line_no. This is not valid.\n";
- }
- $errors_found++;
+ show_error("Keyword 'optional' appears inside config for '$inside_config' in $filename at line $line_no. This is not valid.");
}
if ( !$inside_choice ) {
- unless ($suppress_error_output) {
- print "#!!!!! Error: Keyword 'optional' appears outside of a choice block in $filename at line $line_no. This is not valid.\n";
- }
- $errors_found++;
+ show_error("Keyword 'optional' appears outside of a choice block in $filename at line $line_no. This is not valid.");
}
}
@@ -521,10 +518,7 @@ sub build_and_parse_kconfig_tree {
# select <symbol> [if <expr>]
elsif ( $line =~ /^\s*select/ ) {
unless ($inside_config) {
- unless ($suppress_error_output) {
- print "#!!!!! Error: Keyword 'select' appears outside of config in $filename at line $line_no. This is not valid.\n";
- }
- $errors_found++;
+ show_error("Keyword 'select' appears outside of config in $filename at line $line_no. This is not valid.");
}
if ( $line =~ /^\s*select\s+(.*)$/ ) {
@@ -551,10 +545,7 @@ sub build_and_parse_kconfig_tree {
# do nothing
}
else {
- unless ($suppress_error_output) {
- print "### $line ($filename line $line_no unrecognized)\n";
- }
- $errors_found++;
+ show_error("$line ($filename line $line_no unrecognized)");
}
push @wholeconfig, @parseline;
@@ -630,17 +621,13 @@ sub handle_range {
my $checkrange2 = $1;
if ( $checkrange1 && $checkrange2 && ( hex($checkrange1) > hex($checkrange2) ) ) {
- unless ($suppress_error_output) {
- print "#!!!!! Error: Range entry in $filename line $line_no value 1 ($range1) is greater than value 2 ($range2).\n";
- }
- $errors_found++;
-
+ show_error("Range entry in $filename line $line_no value 1 ($range1) is greater than value 2 ($range2).");
}
if ($inside_config) {
if ( exists( $symbols{$inside_config}{range1} ) ) {
if ( ( $symbols{$inside_config}{range1} != $range1 ) || ( $symbols{$inside_config}{range2} != $range2 ) ) {
- unless ($suppress_error_output) {
+ if ($show_note_output) {
print "#!!!!! Note: Config '$inside_config' range entry $range1 $range2 at $filename line $line_no does";
print " not match the previously defined range $symbols{$inside_config}{range1} $symbols{$inside_config}{range2}";
print " defined in $symbols{$inside_config}{range_file} on line";
@@ -656,10 +643,7 @@ sub handle_range {
}
}
else {
- unless ($suppress_error_output) {
- print "#!!!!! Error: Range entry in $filename line $line_no is not inside a config block.\n";
- }
- $errors_found++;
+ show_error("Range entry in $filename line $line_no is not inside a config block.");
}
}
@@ -689,10 +673,7 @@ sub handle_default {
handle_expressions( $default, $inside_config, $filename, $line_no );
}
else {
- unless ($suppress_error_output) {
- print "#!!!!! Error: $name entry in $filename line $line_no is not inside a config or choice block.\n";
- }
- $errors_found++;
+ show_error("$name entry in $filename line $line_no is not inside a config or choice block.");
}
}
@@ -783,10 +764,7 @@ sub handle_expressions {
return;
}
else {
- unless ($suppress_error_output) {
- print "#### Unrecognized expression '$exprline' in $filename line $line_no.\n";
- }
- $errors_found++;
+ show_error("Unrecognized expression '$exprline' in $filename line $line_no.");
}
return;
@@ -826,11 +804,8 @@ sub add_referenced_symbol {
$line =~ /^(\s+)/; #find the indentation level.
$help_whitespace = $1;
if ( !$help_whitespace ) {
- unless ($suppress_error_output) {
- print "# Warning: $filename line $line_no help text starts with no whitespace.\n";
- }
+ show_warning("$filename line $line_no help text starts with no whitespace.");
return $inside_help;
- $errors_found++;
}
}
@@ -850,10 +825,9 @@ sub add_referenced_symbol {
elsif ( ( $line =~ /^(\s*)help/ ) || ( $line =~ /^(\s*)---help---/ ) ) {
$inside_help = $line_no;
if ( ( !$inside_config ) && ( !$inside_choice ) ) {
- unless ($suppress_error_output) {
+ if ($show_note_output) {
print "# Note: $filename line $line_no help is not inside a config or choice block.\n";
}
- $errors_found++;
}
elsif ($inside_config) {
$help_whitespace = "";
@@ -878,11 +852,7 @@ sub handle_type {
if ($inside_config) {
if ( exists( $symbols{$inside_config}{type} ) ) {
if ( $symbols{$inside_config}{type} !~ /$type/ ) {
- print "#!!!!! Error: Config '$inside_config' type entry $type at $filename line $line_no does not match";
- print " the previously defined type $symbols{$inside_config}{type}";
- print " defined in $symbols{$inside_config}{type_file} on line";
- print " $symbols{$inside_config}{type_line_no}.\n";
- $errors_found++;
+ show_error("Config '$inside_config' type entry $type at $filename line $line_no does not match $symbols{$inside_config}{type} defined in $symbols{$inside_config}{type_file} on line $symbols{$inside_config}{type_line_no}.");
}
}
else {
@@ -892,10 +862,7 @@ sub handle_type {
}
}
else {
- unless ($suppress_error_output) {
- print "#!!!!! Error: Type entry in $filename line $line_no is not inside a config block.\n";
- }
- $errors_found++;
+ show_error("Type entry in $filename line $line_no is not inside a config block.");
}
}
@@ -915,10 +882,7 @@ sub handle_prompt {
}
if ( !defined @$menu_array_ref[0] ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: Symbol '$inside_config' with prompt '$prompt' appears outside of a menu in $filename at line $line_no. This is discouraged.\n";
- }
- $errors_found++;
+ show_error("Symbol '$inside_config' with prompt '$prompt' appears outside of a menu in $filename at line $line_no.");
}
my $sym_num = $symbols{$inside_config}{count};
@@ -938,10 +902,7 @@ sub handle_prompt {
#do nothing
}
else {
- unless ($suppress_error_output) {
- print "#!!!!! Error: $name entry in $filename line $line_no is not inside a config or choice block.\n";
- }
- $errors_found++;
+ show_error("$name entry in $filename line $line_no is not inside a config or choice block.");
}
}
@@ -954,19 +915,12 @@ sub simple_line_checks {
#check for spaces instead of tabs
if ( $line =~ /^ +/ ) {
- unless ($suppress_error_output) {
- print "# Note: $filename line $line_no starts with a space.\n";
- }
- $errors_found++;
+ show_error("$filename line $line_no starts with a space.");
}
#verify a linefeed at the end of the line
if ( $line !~ /.*\n/ ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: $filename line $line_no does not end with linefeed. This can cause the line to not be recognized by the Kconfig parser.\n";
- print "#($line)\n";
- }
- $errors_found++;
+ show_error("$filename line $line_no does not end with linefeed. This can cause the line to not be recognized by the Kconfig parser.\n#($line)");
$line =~ s/\s*$//;
}
else {
@@ -1005,10 +959,7 @@ sub load_kconfig_file {
#the directory should exist when using a glob
else {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: Could not find dir '$dir_prefix'\n";
- }
- $errors_found++;
+ show_warning("Could not find dir '$dir_prefix'");
}
}
@@ -1017,10 +968,7 @@ sub load_kconfig_file {
#throw a warning if the file has already been loaded.
if ( exists $loaded_files{$input_file} ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: '$input_file' sourced in '$loadfile' at line $loadline was already loaded by $loaded_files{$input_file}\n";
- }
- $errors_found++;
+ show_warning("'$input_file' sourced in '$loadfile' at line $loadline was already loaded by $loaded_files{$input_file}");
}
#load the file's contents and mark the file as loaded for checking later
@@ -1032,10 +980,7 @@ sub load_kconfig_file {
# if the file isn't being loaded from a glob, it should exist.
elsif ( $expanded == 0 ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: Could not find file '$input_file' sourced in $loadfile at line $loadline\n";
- }
- $errors_found++;
+ show_warning("Could not find file '$input_file' sourced in $loadfile at line $loadline");
}
my $line_in_file = 0;
@@ -1109,10 +1054,7 @@ sub print_wholeconfig {
sub check_if_file_referenced {
my $filename = $File::Find::name;
if ( ( $filename =~ /Kconfig/ ) && ( !exists $loaded_files{$filename} ) ) {
- unless ($suppress_error_output) {
- print "#!!!!! Warning: '$filename' is never referenced\n";
- }
- $errors_found++;
+ show_warning("'$filename' is never referenced");
}
}
@@ -1123,13 +1065,22 @@ sub check_arguments {
my $show_usage = 0;
GetOptions(
'help|?' => sub { usage() },
+ 'e|errors_off' => \$suppress_error_output,
+ 'n|notes' => \$show_note_output,
'o|output=s' => \$output_file,
'p|print' => \$print_full_output,
- 'w|warnings_off' => \$suppress_error_output,
+ 'w|warnings_off' => \$suppress_warning_output,
'path=s' => \$top_dir,
'c|config=s' => \$config_file,
'G|no_git_grep' => \$dont_use_git_grep,
);
+
+ if ($suppress_error_output) {
+ $suppress_warning_output = 1;
+ }
+ if ($suppress_warning_output) {
+ $show_note_output=0;
+ }
}
#-------------------------------------------------------------------------------
@@ -1139,7 +1090,9 @@ sub usage {
print "kconfig_lint <options>\n";
print " -o|--output=file Set output filename\n";
print " -p|--print Print full output\n";
+ print " -e|--errors_off Don't print warnings or errors\n";
print " -w|--warnings_off Don't print warnings\n";
+ print " -n|--notes Show minor notes\n";
print " --path=dir Path to top level kconfig\n";
print " -c|--config=file Filename of config file to load\n";
print " -G|--no_git_grep Use standard grep tools instead of git grep\n";