[PATCH 2/2] bsps/sparc: Add XtratuM BSP.

Gedare Bloom gedare at rtems.org
Wed May 21 13:54:24 UTC 2014


On Wed, May 21, 2014 at 4:04 AM, Christian Mauderer
<Christian.Mauderer at embedded-brains.de> wrote:
> First of all: Thanks for your comments. You will find answers below.
>
> Am 20.05.2014 16:58, schrieb Gedare Bloom:
>> On Tue, May 20, 2014 at 5:16 AM, Christian Mauderer
>> <christian.mauderer at embedded-brains.de> wrote:
>>> From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>
>>>
>>> ---
>>>  c/src/lib/libbsp/shared/include/fatal.h            |   6 +-
>>>  c/src/lib/libbsp/sparc/acinclude.m4                |   2 +
>>>  c/src/lib/libbsp/sparc/shared/irq_asm.S            |  97 ++++++++++++++++
>>>  c/src/lib/libbsp/sparc/shared/start/start.S        |  58 +++++++++-
>>>  .../lib/libbsp/sparc/shared/startup/linkcmds.base  |  19 ++++
>>>  c/src/lib/libbsp/sparc/xtratum/Makefile.am         | 119 ++++++++++++++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/README              |   8 ++
>>>  c/src/lib/libbsp/sparc/xtratum/bsp_specs           |  17 +++
>>>  .../sparc/xtratum/clock/clock-xtratum-exec.c       |  23 ++++
>>>  .../libbsp/sparc/xtratum/clock/clock-xtratum-hw.c  |  21 ++++
>>>  .../lib/libbsp/sparc/xtratum/clock/clock-xtratum.h | 103 +++++++++++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/configure.ac        |  33 ++++++
>>>  .../libbsp/sparc/xtratum/console/console-config.c  |  27 +++++
>>>  .../libbsp/sparc/xtratum/console/printk-support.c  |  28 +++++
>>>  .../sparc/xtratum/console/xtratum-hyper-console.c  |  71 ++++++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/include/bsp.h       |  52 +++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/include/cache_.h    | 113 +++++++++++++++++++
>>>  .../sparc/xtratum/include/clock-xtratum-exec.h     |  26 +++++
>>>  c/src/lib/libbsp/sparc/xtratum/include/irq.h       |   2 +
>>>  c/src/lib/libbsp/sparc/xtratum/include/tm27.h      |  30 +++++
>>>  .../sparc/xtratum/include/xtratum-hyper-console.h  |  30 +++++
>>>  c/src/lib/libbsp/sparc/xtratum/include/xtratum.h   |  87 +++++++++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/irq/irq.c           |  77 +++++++++++++
>>>  .../libbsp/sparc/xtratum/make/custom/xtratum.cfg   |  55 +++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/preinstall.am       | 123 +++++++++++++++++++++
>>>  .../libbsp/sparc/xtratum/startup/bsppredriver.c    |   7 ++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/bspreset.c  |  52 +++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/bspsmp.c    | 104 +++++++++++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/bspstart.c  |  22 ++++
>>>  .../libbsp/sparc/xtratum/startup/example_xm_cf.xml |  66 +++++++++++
>>>  .../lib/libbsp/sparc/xtratum/startup/isr-en-dis.S  |  50 +++++++++
>>>  .../libbsp/sparc/xtratum/startup/linkcmds.xtratum  |  20 ++++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/psr.c       |  26 +++++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/setvec.c    |  61 ++++++++++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/spurious.c  |  35 ++++++
>>>  c/src/lib/libbsp/sparc/xtratum/startup/tbr.c       |  30 +++++
>>>  c/src/lib/libbsp/sparc/xtratum/xm/xmhdr.c          |  36 ++++++
>>>  cpukit/score/cpu/sparc/rtems/score/cpu.h           |  11 +-
>>>  testsuites/smptests/smpfatal08/init.c              |   3 +-
>>>  39 files changed, 1735 insertions(+), 15 deletions(-)
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/Makefile.am
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/README
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/bsp_specs
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/clock/clock-xtratum-exec.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/clock/clock-xtratum-hw.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/clock/clock-xtratum.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/configure.ac
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/console/console-config.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/console/printk-support.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/console/xtratum-hyper-console.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/bsp.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/cache_.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/clock-xtratum-exec.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/irq.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/tm27.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/xtratum-hyper-console.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/include/xtratum.h
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/irq/irq.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/make/custom/xtratum.cfg
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/preinstall.am
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/bsppredriver.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/bspreset.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/bspsmp.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/bspstart.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/example_xm_cf.xml
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/isr-en-dis.S
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/linkcmds.xtratum
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/psr.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/setvec.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/spurious.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/startup/tbr.c
>>>  create mode 100644 c/src/lib/libbsp/sparc/xtratum/xm/xmhdr.c
>>>
>>> diff --git a/c/src/lib/libbsp/shared/include/fatal.h b/c/src/lib/libbsp/shared/include/fatal.h
>>> index e928bba..8ca90bb 100644
>>> --- a/c/src/lib/libbsp/shared/include/fatal.h
>>> +++ b/c/src/lib/libbsp/shared/include/fatal.h
>>> @@ -101,7 +101,11 @@ typedef enum {
>>>    PPC_FATAL_EXCEPTION_INITIALIZATION = BSP_FATAL_CODE_BLOCK(7),
>>>
>>>    /* Libchip fatal codes */
>>> -  DWMAC_FATAL_TOO_MANY_RBUFS_CONFIGURED = BSP_FATAL_CODE_BLOCK(8)
>>> +  DWMAC_FATAL_TOO_MANY_RBUFS_CONFIGURED = BSP_FATAL_CODE_BLOCK(8),
>>> +
>>> +  /* XtratuM fatal codes */
>>> +  XTRATUM_FATAL_CLOCK_IRQ_INSTALL = BSP_FATAL_CODE_BLOCK(9),
>>> +  XTRATUM_FATAL_CPU_SMP_INITIALIZE
>>>  } bsp_fatal_code;
>>>
>>>  RTEMS_COMPILER_NO_RETURN_ATTRIBUTE static inline void
>>> diff --git a/c/src/lib/libbsp/sparc/acinclude.m4 b/c/src/lib/libbsp/sparc/acinclude.m4
>>> index 4d40305..0e053fa 100644
>>> --- a/c/src/lib/libbsp/sparc/acinclude.m4
>>> +++ b/c/src/lib/libbsp/sparc/acinclude.m4
>>> @@ -8,6 +8,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
>>>      AC_CONFIG_SUBDIRS([leon2]);;
>>>    leon3 )
>>>      AC_CONFIG_SUBDIRS([leon3]);;
>>> +  xtratum )
>>> +    AC_CONFIG_SUBDIRS([xtratum]);;
>>>    *)
>>>      AC_MSG_ERROR([Invalid BSP]);;
>>>    esac
>>> diff --git a/c/src/lib/libbsp/sparc/shared/irq_asm.S b/c/src/lib/libbsp/sparc/shared/irq_asm.S
>>> index bf2dca9..69522a2 100644
>>> --- a/c/src/lib/libbsp/sparc/shared/irq_asm.S
>>> +++ b/c/src/lib/libbsp/sparc/shared/irq_asm.S
>>> @@ -23,6 +23,10 @@
>>>  #include <rtems/score/percpu.h>
>>>  #include <bspopts.h>
>>>
>>> +#ifdef RTEMS_PARAVIRT_XTRATUM
>>> +#include <xm.h>
>> What is this header file? I don't see it in the commit, is it part of
>> the installed XtratuM?
>>
>
> That is correct. It's part of XtratuM. Is there some preferred way of
> marking such headers?
>
Not that I know of. We have discussed a similar issue with the POK
paravirtualization project. The problem is to allow external code
linking to RTEMS. The design should be considered carefully and
probably discussed in a separate thread.

[...]

>>> diff --git a/c/src/lib/libbsp/sparc/xtratum/startup/spurious.c b/c/src/lib/libbsp/sparc/xtratum/startup/spurious.c
>>> new file mode 100644
>>> index 0000000..2d4428a
>>> --- /dev/null
>>> +++ b/c/src/lib/libbsp/sparc/xtratum/startup/spurious.c
>>> @@ -0,0 +1,35 @@
>>> +/*
>>> + *  LEON Spurious Trap Handler
>>> + *
>>> + *  This is just enough of a trap handler to let us know what
>>> + *  the likely source of the trap was.
>>> + *
>>> + *  Developed as part of the port of RTEMS to the LEON implementation
>>> + *  of the SPARC by On-Line Applications Research Corporation (OAR)
>>> + *  under contract to the European Space Agency (ESA).
>>> + *
>>> + *  COPYRIGHT (c) 1995. European Space Agency.
>>> + *
>>> + *  Modified for LEON3 BSP.
>>> + *  COPYRIGHT (c) 2004.
>>> + *  Gaisler Research.
>>> + *
>>> + *  This terms of the RTEMS license apply to this file.
>>> + */
>>> +
>>> +#include <bsp.h>
>>> +#include <rtems/bspIo.h>
>>> +
>>> +void _BSP_Exception_frame_print( const CPU_Exception_frame *frame )
>>> +{
>>> +  uint32_t trap;
>>> +  uint32_t real_trap;
>>> +  const CPU_Interrupt_frame *isf;
>>> +
>>> +  trap = frame->trap;
>>> +  real_trap = SPARC_REAL_TRAP_NUMBER(trap);
>>> +  isf = frame->isf;
>>> +
>>> +  printk( "Unexpected trap (0x%02x) at address 0x%08x\n", real_trap, isf->tpc);
>>> +}
>>> +
>> I don't think this code will get called ever?
>>
> The _BSP_Exception_frame_print of the sparc gets called by the
> _CPU_Exception_frame_print. This again is called by
> rtems_exception_frame_print which is called i.E. in the
> bsp_fatal_extension or in spfatal26-test.
>
OK. It should get a more suitable file name e.g.
bspexceptionframeprint.c. I realize the other sparc BSPs implemented
it in spurious.c, but this BSP does not have a spurious exception
handler, so it doesn't make a lot of sense to have spurious.c.

Gedare



More information about the devel mailing list