All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dr. Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/13] log: Add an implemention of logging
Date: Wed, 20 Sep 2017 16:51:56 +0200	[thread overview]
Message-ID: <8FD7D10A-1AC7-455B-9E85-EC58B5E92D76@theobroma-systems.com> (raw)
In-Reply-To: <CAEUhbmUm679ZpWVV9WJkT9QmZkQJ-Kfjoh9Xtt8XULou2H3k1Q@mail.gmail.com>


> On 20 Sep 2017, at 16:41, Bin Meng <bmeng.cn@gmail.com> wrote:
> 
> Hi Simon,
> 
> On Wed, Sep 20, 2017 at 9:50 PM, Simon Glass <sjg@chromium.org> wrote:
>> Hi Bin,
>> 
>> On 17 September 2017 at 21:45, Bin Meng <bmeng.cn@gmail.com> wrote:
>>> Hi Simon,
>>> 
>>> On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass <sjg@chromium.org> wrote:
>>>> Add the logging header file and implementation with some configuration
>>>> options to control it.
>>>> 
>>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>>> ---
>>>> 
>>>> MAINTAINERS                       |   9 ++
>>>> common/Kconfig                    |  56 +++++++++
>>>> common/Makefile                   |   1 +
>>>> common/log.c                      | 246 +++++++++++++++++++++++++++++++++++++
>>>> include/asm-generic/global_data.h |   5 +
>>>> include/log.h                     | 247 ++++++++++++++++++++++++++++++++++++--
>>>> 6 files changed, 555 insertions(+), 9 deletions(-)
>>>> create mode 100644 common/log.c
>>>> 
>>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>>> index 04acf2b89d..eb420afa8d 100644
>>>> --- a/MAINTAINERS
>>>> +++ b/MAINTAINERS
>>>> @@ -290,6 +290,15 @@ S: Maintained
>>>> T:     git git://git.denx.de/u-boot-i2c.git
>>>> F:     drivers/i2c/
>>>> 
>>>> +LOGGING
>>>> +M:     Simon Glass <sjg@chromium.org>
>>>> +S:     Maintained
>>>> +T:     git git://git.denx.de/u-boot.git
>>>> +F:     common/log.c
>>>> +F:     cmd/log.c
>>>> +F:     test/log/log_test.c
>>>> +F:     test/py/tests/test_log.py
>>> 
>>> test/log/log_test.c and test/py/tests/test_log.py have not been
>>> introduced at this point.
>> 
>> OK I can tweak that,
>> [..]
>> 
>>>> +/**
>>>> + * struct log_driver - a driver which accepts and processes log records
>>>> + *
>>>> + * @name: Name of driver
>>>> + */
>>>> +struct log_driver {
>>>> +       const char *name;
>>>> +       /**
>>>> +        * emit() - emit a log record
>>>> +        *
>>>> +        * Called by the log system to pass a log record to a particular driver
>>>> +        * for processing. The filter is checked before calling this function.
>>>> +        */
>>>> +       int (*emit)(struct log_device *ldev, struct log_rec *rec);
>>>> +};
>>>> +
>>> 
>>> So we are creating a new type of non-DM driver which is log-specific?
>>> How about we add this emit to the existing uclass driver that can be
>>> used as the log driver? (eg: blk devices with file system?)
>> 
>> Yes that's right. I think I can link it to DM once it starts up, but a
>> logging of DM start-up is useful.
>> 
>> Re your idea are you saying add an emit() method to UCLASS_BLK?
>> 
> 
> Yep, something like
> 
> #ifdef CONFIG_LOG
>    .log_emit = xxx_log_emit,
> #endif
> 
> Probably we need a flag to find out which driver provides such log
> functionality.

I had started to sketch (but have been able to fully flesh this out, due to 
other priorities intervening) a mechanism for MISC devices that might
be a good fit for this.

My work centers around the idea of having devices comply to “protocols”
and was aimed at distinguishing between an efuse-device and a GbE 
RGMII-control (one where we need to adjust the RGMII clock depending
on the link rate the PHY negotiated) device.

I.e. I had started to implement something along the lines of:

	/**
	 * misc_supports - tests if a misc device complies to a given protocol
	 *
	 * protocols can either be ‘how data is processed after calling write()’,
	 * ‘how data is presented for a read()’ or ‘what ioctl-values are supported’.
	 * The assumption is that protocols can be versioned and higher versions
	 * offer full backward compatibility (i.e. a client for “Ethernet PHY control, v1”
	 * can work with a driver implementing v1 or any higher version).
	 */
	bool misc_supports(struct udevice *dev, const char *protocol, u32 version);

and a way to register a list of protocols as part of the misc uclass-priv for
any given driver.

This would allow us to enumerate all MISC devices until we find one that
complies to the ‘logging’-protocol and then invoke write or ioctl on it.

Regards,
Philipp.

  reply	other threads:[~2017-09-20 14:51 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16 21:23 [U-Boot] [PATCH 00/13] log: Add a new logging feature Simon Glass
2017-09-16 21:23 ` [U-Boot] [PATCH 01/13] Revert "sandbox: remove os_putc() and os_puts()" Simon Glass
2017-09-17 12:48   ` Bin Meng
2017-09-17 17:55     ` Simon Glass
2017-09-16 21:23 ` [U-Boot] [PATCH 02/13] Revert "sandbox: Drop special case console code for sandbox" Simon Glass
2017-09-17 12:50   ` Bin Meng
2017-09-17 17:55     ` Simon Glass
2017-09-16 21:23 ` [U-Boot] [PATCH 03/13] Move debug and logging support to a separate header Simon Glass
2017-09-17 12:52   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 04/13] mtdparts: Correct use of debug() Simon Glass
2017-09-17 12:54   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 05/13] Drop the log buffer Simon Glass
2017-09-17 12:58   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 06/13] log: Add an implemention of logging Simon Glass
2017-09-18  3:45   ` Bin Meng
2017-09-20 13:50     ` Simon Glass
2017-09-20 14:41       ` Bin Meng
2017-09-20 14:51         ` Dr. Philipp Tomsich [this message]
2017-09-21  4:58         ` Simon Glass
2017-09-22 13:37           ` Bin Meng
2017-09-25  2:14             ` Simon Glass
2017-09-20  2:51   ` Masahiro Yamada
2017-09-20 13:49     ` Simon Glass
2017-09-20 14:37       ` Dr. Philipp Tomsich
2017-09-20 17:34         ` Masahiro Yamada
2017-09-20 17:51           ` Dr. Philipp Tomsich
2017-09-27 16:19             ` Masahiro Yamada
2017-09-20 17:19       ` Masahiro Yamada
2017-09-26 19:10         ` Simon Glass
2017-09-27 17:11           ` Masahiro Yamada
2017-09-28 12:39             ` Simon Glass
2017-09-16 21:23 ` [U-Boot] [PATCH 07/13] log: Add a console driver Simon Glass
2017-09-18  3:45   ` Bin Meng
2017-09-26 19:10     ` Simon Glass
2017-09-16 21:23 ` [U-Boot] [PATCH 08/13] log: Add a 'log level' command Simon Glass
2017-09-18  3:46   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 09/13] log: Add a test command Simon Glass
2017-09-18  3:47   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 10/13] log: Plumb logging into the init sequence Simon Glass
2017-09-18  3:47   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 11/13] log: sandbox: Enable logging Simon Glass
2017-09-18  3:47   ` Bin Meng
2017-09-16 21:23 ` [U-Boot] [PATCH 12/13] log: test: Add a pytest for logging Simon Glass
2017-09-16 21:23 ` [U-Boot] [PATCH 13/13] log: Add documentation Simon Glass
2017-09-18  3:47   ` Bin Meng
2017-09-20  3:04   ` Masahiro Yamada
2017-09-20 13:49     ` Simon Glass
2017-09-20  2:32 ` [U-Boot] [PATCH 00/13] log: Add a new logging feature Masahiro Yamada
2017-09-20 20:20   ` Heinrich Schuchardt
2017-09-21  4:58     ` Simon Glass
2017-09-20 19:55 ` Wolfgang Denk
2017-09-21  4:58   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8FD7D10A-1AC7-455B-9E85-EC58B5E92D76@theobroma-systems.com \
    --to=philipp.tomsich@theobroma-systems.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.