[U-Boot] [PATCH 1/1] cmd: add exception command

Simon Glass sjg at chromium.org
Sat Jan 5 01:56:58 UTC 2019


Hi Heinrich,

On Sun, 30 Dec 2018 at 01:33, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 12/29/18 2:39 PM, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Wed, 26 Dec 2018 at 09:20, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> >>
> >> The 'exception' command allows to test exception handling.
> >>
> >> This implementation supports ARM, x86, RISC-V and the following exceptions:
> >> * 'breakpoint' - prefetch abort exception (ARM 32bit only)
> >> * 'unaligned'  - data abort exception (ARM only)
> >> * 'undefined'  - undefined instruction exception
> >>
> >> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> >> ---
> >> v2:
> >>         Split architecture specific code into separate files.
> >>         Provide include for common code.
> >>         Update MAINTAINERS file.
> >> ---
> >>  MAINTAINERS           |  3 +++
> >>  cmd/Kconfig           |  6 +++++
> >>  cmd/Makefile          |  2 ++
> >>  cmd/arm/Makefile      |  7 +++++
> >>  cmd/arm/exception.c   | 61 +++++++++++++++++++++++++++++++++++++++++++
> >>  cmd/arm/exception64.c | 33 +++++++++++++++++++++++
> >>  cmd/riscv/Makefile    |  3 +++
> >>  cmd/riscv/exception.c | 29 ++++++++++++++++++++
> >>  cmd/x86/Makefile      |  1 +
> >>  cmd/x86/exception.c   | 29 ++++++++++++++++++++
> >>  include/exception.h   | 58 ++++++++++++++++++++++++++++++++++++++++
> >>  11 files changed, 232 insertions(+)
> >>  create mode 100644 cmd/arm/Makefile
> >>  create mode 100644 cmd/arm/exception.c
> >>  create mode 100644 cmd/arm/exception64.c
> >>  create mode 100644 cmd/riscv/Makefile
> >>  create mode 100644 cmd/riscv/exception.c
> >>  create mode 100644 cmd/x86/exception.c
> >>  create mode 100644 include/exception.h
> >
> > This needs something like Series-version: 2 (if you use patman) to set
> > the version number in the header.
>
> Sorry for the mishap.
>
> >
> > Did you look at using a uclass and driver, like sysreset?
>
> Yes I have considered using a u-class. But I could not see how adding a
> separate u-class file would save lines, make the coding less complex, or
> make the coding easier to maintain. A u-class would make sense if there
> were other consumers for exceptions but the exception command. But I
> cannot imagine any.

In some sense driver model matches consumers and producers. There are
clearly multiple producers - you have effectively implemented an API
in a few places. We even have multiple impls for each arch.

So I still favour a uclass, but since you are pretty adamant that we
should not do it, I'm not going to insist.

>
> There are better places to apply u-classes, e.g. I am really missing a
> u-class for file systems.
>
> Best regards
>
> Heinrich
>
> >
> > Regards,
> > Simon
> >

Regards,
Simon


More information about the U-Boot mailing list