From patchwork Tue Sep 26 19:21:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 818787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="lov4KAlo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3y1rRt2mjlz9t5l for ; Wed, 27 Sep 2017 05:21:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CFBE3C21DE7; Tue, 26 Sep 2017 19:21:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E14ECC21DE7; Tue, 26 Sep 2017 19:21:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3B49DC21E08; Tue, 26 Sep 2017 19:21:52 +0000 (UTC) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com [209.85.218.46]) by lists.denx.de (Postfix) with ESMTPS id 90BF1C21DE7 for ; Tue, 26 Sep 2017 19:21:51 +0000 (UTC) Received: by mail-oi0-f46.google.com with SMTP id x85so13488947oix.12 for ; Tue, 26 Sep 2017 12:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=PV5T8OxEz/czJx0+h6ENeShZr5Fl54JCZXMTY66I2MM=; b=lov4KAlo/nAzQm7BwpsKDjpT+bKQ3qHxFEtJb01sfxRxWWwgw6e59MmroHaoCn1est jDqh1jE2OuOOuMeiI09HXaJO1KfZ60RAfHrM4wz0NaNflHFoR0W1qmeGLUAtpSHRIr0+ rlNf6i4dFJoNg6zouopjoYi10utfaxHd33whMwtiJSoJZsYUTcgwKM8gt5CSABzRuytq Gbh4XD1mPiIbFvlvJaUZxUHvNtC5FXJuIPMIzIQCtCDhBdKz9dS6MMP2zAdc4CQx6dt8 hgPMrF8vIq/ePqOhxISZx1BoH2DNvAVW6HsMiAU85+nnioKODKzBBirdw22zIplXWo1O ZusQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=PV5T8OxEz/czJx0+h6ENeShZr5Fl54JCZXMTY66I2MM=; b=N1kBnwpn/UKGZLGY97JOmjiy1l6uJZxHeGqHgPVosgpB3nsGBfelJ++juwNZ7/xRuh KuEHrQcU42K9iq+ZYRKsKU436AKefAU6t9Mkp5HXfc6GzEMxmATCyawfBkINnzzfVcBU yjgh2CPbzpHFt8h3QniV09Os23PsxOh0zIiMPP7M73/fWr/lusHIdo2L+tDzuH+SVMzn ZvLDTX1baqewA9j1+oBx0XEvurYaaRiRU4icriyr0bsPdbax029fTq1SiimiyaRscw3k Qr9TGOuz3VZcGt/sOCwMBFTXSLrEfwUPkkle0qCND4ZUsbbtSaEHJBI+b/IbtS2F3685 JVEQ== X-Gm-Message-State: AHPjjUgR3HKYcO3F2nqnwBub6WWM6kwnDb/05cS8gq19TfE2k0bb0i4X eN5jZcLPr8fqY02LBchJf9TmUQ== X-Google-Smtp-Source: AOwi7QCAJ4p875vYIPgTg04psPpj7gmcpYHsyT+ZPmT8edAcAyrfte5fg0rzuVYk4sZNjwYvQxA6Jw== X-Received: by 10.202.81.21 with SMTP id f21mr1156120oib.433.1506453709810; Tue, 26 Sep 2017 12:21:49 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id h63sm1478111otb.59.2017.09.26.12.21.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 12:21:48 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 49BF8140573; Tue, 26 Sep 2017 13:21:47 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 26 Sep 2017 13:21:28 -0600 Message-Id: <20170926192142.42308-1-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.992.g2c7b836f3a-goog Cc: Tom Rini Subject: [U-Boot] [PATCH v2 00/14] log: Add a new logging feature X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" U-Boot currently has fairly rudimentary logging features. A basic printf() provides console output and debug() provides debug output which is activated if DEBUG is defined in the file containing the debug() statements. It would be useful to have a few more features: - control of debug output at runtime, so problems can potentially be debugged without recompiling U-Boot - control of which subsystems output debug information, so that (for example) it is possible to enable debugging for MMC or SATA at runtime - indication of severity with each message, so that the user can control whether just errors are displayed, warnings, or all debug messages - sending logging information to different destinations, such as console, memory, linux, etc, At present U-Boot has a logbuffer feature which records output in a memory buffer for later display or storage. This is useful but is not at present enabled for any board. This series introduced a new logging system which supports: - various log levels from panic to debug - log categories including all uclasses and a few others - log drivers to which all log records can be sent - log filters which control which log records make it to which drivers Enabling logging with the default options does not add much to code size. By default the maximum recorded log level is LOGL_INFO, meaning that debug messages (and above) are discarded a build-time. Increasing this level provides more run-time flexibility to enable/disable logging at the cost of increased code size. This feature is by no means finished. The README provides a long list of features and clean-ups that could be done. But hopefully this is a starting point for improving this important area in U-Boot. The series is available at u-boot-dm/log-working Changes in v2: - Add a comment as to why CONFIG_LOG_MAX_LEVEL is not defined - Change log levels to match new header - Change sandbox log level to 6 - Drop MAINTAINERS entries for files not added by this patch - Drop the special log() functions from the README - Drop the use of 'continue' in the macro - Fix LOG_SPL_MAX_LEVEL typo (should be SPL_LOG_MAX_LEVEL) - Fix function called when test command is selected - Fix help output for 'log test' - Fix up bad use of #if CONFIG_VAL() - use #ifdef instead - Line up log levels with Linux - Only execute log tests if CONFIG_LOG is enabled - Rename LOGL_WARN to LOGL_WARNING - Split pre-console address change into a separate patch - Update commit message to explain that this is not just for serial output Simon Glass (14): Revert "sandbox: remove os_putc() and os_puts()" sandbox: Adjust pre-console address to avoid conflict Revert "sandbox: Drop special case console code for sandbox" Move debug and logging support to a separate header mtdparts: Correct use of debug() Drop the log buffer log: Add an implemention of logging log: Add a console driver log: Add a 'log level' command log: Add a test command log: Plumb logging into the init sequence log: sandbox: Enable logging log: test: Add a pytest for logging log: Add documentation MAINTAINERS | 9 ++ arch/sandbox/cpu/os.c | 11 ++ cmd/Kconfig | 8 + cmd/Makefile | 2 +- cmd/log.c | 326 +++++--------------------------------- cmd/mtdparts.c | 3 - common/Kconfig | 86 ++++++++++ common/Makefile | 2 + common/board_f.c | 23 +-- common/board_r.c | 27 +--- common/console.c | 7 + common/image.c | 9 -- common/log.c | 245 ++++++++++++++++++++++++++++ common/log_console.c | 23 +++ common/stdio.c | 6 - configs/sandbox_defconfig | 5 +- doc/README.log | 214 +++++++++++++++++++++++++ include/asm-generic/global_data.h | 8 +- include/common.h | 64 +------- include/log.h | 316 ++++++++++++++++++++++++++++++++++++ include/logbuff.h | 49 ------ include/os.h | 20 +++ include/post.h | 4 +- post/post.c | 9 -- post/tests.c | 4 - scripts/config_whitelist.txt | 1 - test/Makefile | 1 + test/log/Makefile | 7 + test/log/log_test.c | 204 ++++++++++++++++++++++++ test/py/tests/test_log.py | 107 +++++++++++++ 30 files changed, 1320 insertions(+), 480 deletions(-) create mode 100644 common/log.c create mode 100644 common/log_console.c create mode 100644 doc/README.log create mode 100644 include/log.h delete mode 100644 include/logbuff.h create mode 100644 test/log/Makefile create mode 100644 test/log/log_test.c create mode 100644 test/py/tests/test_log.py