[PATCH] bsps: Provide <bsp/fdt.h> for every BSP

Gedare Bloom gedare at rtems.org
Tue Mar 7 14:29:46 UTC 2017


On Tue, Mar 7, 2017 at 9:12 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> Add bsp_fdt_map_intr() intended for the libbsd FDT support.
> ---
>  c/src/lib/libbsp/Makefile.am                      |  1 +
>  c/src/lib/libbsp/powerpc/qoriq/Makefile.am        |  1 -
>  c/src/lib/libbsp/powerpc/qoriq/include/bsp.h      |  4 +++-
>  c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c |  7 +++++-
>  c/src/lib/libbsp/preinstall.am                    |  4 ++++
>  c/src/lib/libbsp/shared/include/fdt.h             | 27 ++++++++++++++++++++++-
>  c/src/lib/libbsp/shared/src/bsp-fdt.c             |  7 ++++--
>  7 files changed, 45 insertions(+), 6 deletions(-)
>
> diff --git a/c/src/lib/libbsp/Makefile.am b/c/src/lib/libbsp/Makefile.am
> index c54fdcb..85ddbe2 100644
> --- a/c/src/lib/libbsp/Makefile.am
> +++ b/c/src/lib/libbsp/Makefile.am
> @@ -37,6 +37,7 @@ include_bspdir = $(includedir)/bsp
>  include_bsp_HEADERS =
>  include_bsp_HEADERS += shared/include/default-initial-extension.h
>  include_bsp_HEADERS += shared/include/fatal.h
> +include_bsp_HEADERS += shared/include/fdt.h
>  include_bsp_HEADERS += shared/include/console-termios.h
>  include_bsp_HEADERS += shared/include/gpio.h
>
> diff --git a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
> index 64ef08d..93473ab 100644
> --- a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
> +++ b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
> @@ -22,7 +22,6 @@ include_bsp_HEADERS = include/irq.h \
>         ../../shared/include/irq-generic.h \
>         ../../shared/include/irq-info.h \
>         ../../shared/include/bootcard.h \
> -       ../../shared/include/fdt.h \
>         ../../shared/include/utility.h \
>         ../shared/include/start.h \
>         ../shared/include/tictac.h \
> diff --git a/c/src/lib/libbsp/powerpc/qoriq/include/bsp.h b/c/src/lib/libbsp/powerpc/qoriq/include/bsp.h
> index d1fd907..7469ab1 100644
> --- a/c/src/lib/libbsp/powerpc/qoriq/include/bsp.h
> +++ b/c/src/lib/libbsp/powerpc/qoriq/include/bsp.h
> @@ -7,7 +7,7 @@
>   */
>
>  /*
> - * Copyright (c) 2010-2015 embedded brains GmbH.  All rights reserved.
> + * Copyright (c) 2010, 2017 embedded brains GmbH.  All rights reserved.
>   *
>   *  embedded brains GmbH
>   *  Dornierstr. 4
> @@ -37,6 +37,8 @@ extern "C" {
>
>  #define BSP_FEATURE_IRQ_EXTENSION
>
> +#define BSP_FDT_IS_SUPPORTED
> +
This seems fairly reasonable. It needs an addition to the BSP guide.

>  #define QORIQ_CHIP(alpha, num) ((alpha) * 10000 + (num))
>
>  #define QORIQ_CHIP_P1020 QORIQ_CHIP('P', 1020)
> diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c b/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
> index cbe1970..7aba178 100644
> --- a/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
> +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
> @@ -7,7 +7,7 @@
>   */
>
>  /*
> - * Copyright (c) 2010-2015 embedded brains GmbH.  All rights reserved.
> + * Copyright (c) 2010, 2017 embedded brains GmbH.  All rights reserved.
>   *
>   *  embedded brains GmbH
>   *  Dornierstr. 4
> @@ -169,3 +169,8 @@ void bsp_start(void)
>    qoriq.lcc.bptr &= ~BPTR_EN;
>  #endif
>  }
> +
> +uint32_t bsp_fdt_map_intr(uint32_t intr)
> +{
> +  return intr - 16;
> +}
> diff --git a/c/src/lib/libbsp/preinstall.am b/c/src/lib/libbsp/preinstall.am
> index bbcb7c5..505803f 100644
> --- a/c/src/lib/libbsp/preinstall.am
> +++ b/c/src/lib/libbsp/preinstall.am
> @@ -26,6 +26,10 @@ $(PROJECT_INCLUDE)/bsp/fatal.h: shared/include/fatal.h $(PROJECT_INCLUDE)/bsp/$(
>         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fatal.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fatal.h
>
> +$(PROJECT_INCLUDE)/bsp/fdt.h: shared/include/fdt.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fdt.h
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fdt.h
> +
>  $(PROJECT_INCLUDE)/bsp/console-termios.h: shared/include/console-termios.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/console-termios.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/console-termios.h
> diff --git a/c/src/lib/libbsp/shared/include/fdt.h b/c/src/lib/libbsp/shared/include/fdt.h
> index a4c7df6..44298f4 100644
> --- a/c/src/lib/libbsp/shared/include/fdt.h
> +++ b/c/src/lib/libbsp/shared/include/fdt.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
> + * Copyright (c) 2015, 2017 embedded brains GmbH.  All rights reserved.
>   *
>   *  embedded brains GmbH
>   *  Dornierstr. 4
> @@ -15,14 +15,39 @@
>  #ifndef LIBBSP_SHARED_FDT_H
>  #define LIBBSP_SHARED_FDT_H
>
> +#include <bsp.h>
> +
>  #ifdef __cplusplus
>  extern "C" {
>  #endif /* __cplusplus */
>
> +/*
> + * BSPs that implement the FDT support functions must define
> + * BSP_FDT_IS_SUPPORTED.
> + */
> +
>  void bsp_fdt_copy(const void *src);
>
Missing doxygen for this function.

> +/**
> + * @brief Returns the FDT of the BSP.
> + *
> + * @return The FDT of the BSP.
> + */
>  const void *bsp_fdt_get(void);
>
> +/**
> + * @brief Maps the interrupt number of the FDT to the interrupt vector used by
> + * the interrupt management.
> + *
> + * This function is used by the libbsd to implement the OFW_BUS_MAP_INTR bus
> + * method.
> + *
> + * @param[in] intr The FDT interrupt number.
> + *
> + * @return The interrupt vector of the FDT interrupt number.
> + */
> +uint32_t bsp_fdt_map_intr(uint32_t intr);
> +
>  #ifdef __cplusplus
>  }
>  #endif /* __cplusplus */
> diff --git a/c/src/lib/libbsp/shared/src/bsp-fdt.c b/c/src/lib/libbsp/shared/src/bsp-fdt.c
> index 635cb85..faf59be 100644
> --- a/c/src/lib/libbsp/shared/src/bsp-fdt.c
> +++ b/c/src/lib/libbsp/shared/src/bsp-fdt.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
> + * Copyright (c) 2015, 2017 embedded brains GmbH.  All rights reserved.
>   *
>   *  embedded brains GmbH
>   *  Dornierstr. 4
> @@ -16,10 +16,13 @@
>
>  #include <libfdt.h>
>
> -#include <bsp.h>
>  #include <bsp/fdt.h>
>  #include <bsp/linker-symbols.h>
>
> +#ifndef BSP_FDT_IS_SUPPORTED
> +#warning "BSP FDT support indication not defined"
> +#endif
> +
>  #ifndef BSP_FDT_BLOB_SIZE_MAX
>  #define BSP_FDT_BLOB_SIZE_MAX 0
>  #endif
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list