[rtems commit] bsp/qoriq: Use U-Boot provided FDT

Chris Johns chrisj at rtems.org
Mon Oct 19 22:46:59 UTC 2015


Was this patch posted to devel at rtems.org for review?

I do not remember any discussion about how BSPs and FDT will be
supported. I posted an RTEMS API for FDT which seems to have been ignored.

Can you please describe this use of FDT in RTEMS and how this can used
by more than the immediate use you have for your BSP?

Where is the documentation on how this is to be used by the BSP it is
designed to support? I do not see now a user is to build an application
to use this.

Which BSPs is this new BSP API intended for?

I do not support this change and would like it reverted until a better
proposal is put forward.

On 19/10/2015 6:53 pm, Sebastian Huber wrote:
>  c/src/lib/libbsp/shared/include/fdt.h             | 30 +++++++
>  c/src/lib/libbsp/shared/src/bsp-fdt.c             | 59 ++++++++++++++

This is being adding the shared BSP API. Why?

> diff --git a/c/src/lib/libbsp/shared/include/fdt.h b/c/src/lib/libbsp/shared/include/fdt.h
> new file mode 100644
> index 0000000..a4c7df6
> --- /dev/null
> +++ b/c/src/lib/libbsp/shared/include/fdt.h
> @@ -0,0 +1,30 @@
> +/*
> + * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  <rtems at embedded-brains.de>
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#ifndef LIBBSP_SHARED_FDT_H
> +#define LIBBSP_SHARED_FDT_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif /* __cplusplus */
> +
> +void bsp_fdt_copy(const void *src);
> +
> +const void *bsp_fdt_get(void);
> +
> +#ifdef __cplusplus
> +}
> +#endif /* __cplusplus */
> +
> +#endif /* LIBBSP_SHARED_FDT_H */
> diff --git a/c/src/lib/libbsp/shared/src/bsp-fdt.c b/c/src/lib/libbsp/shared/src/bsp-fdt.c
> new file mode 100644
> index 0000000..1b149d9
> --- /dev/null
> +++ b/c/src/lib/libbsp/shared/src/bsp-fdt.c
> @@ -0,0 +1,59 @@
> +/*
> + * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  <rtems at embedded-brains.de>
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#include <sys/param.h>
> +
> +#include <libfdt.h>
> +
> +#include <bsp.h>
> +#include <bsp/fdt.h>
> +#include <bsp/linker-symbols.h>
> +
> +#ifndef BSP_FDT_BLOB_SIZE_MAX
> +#define BSP_FDT_BLOB_SIZE_MAX 0
> +#endif
> +
> +#ifdef BSP_FDT_BLOB_READ_ONLY
> +static const uint32_t
> +bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)] = { 0xdeadbeef };
> +#else
> +static uint32_t
> +bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)];
> +#endif
> +
> +void bsp_fdt_copy(const void *src)

Is this a pointer to the blob or FDT source? What is this pointing to?

> +{
> +  const uint32_t *s = (const uint32_t *) src;
> +#ifdef BSP_FDT_BLOB_READ_ONLY
> +  uint32_t *d = (uint32_t *) ((uintptr_t) &bsp_fdt_blob[0]
> +    - (uintptr_t) bsp_section_rodata_begin
> +    + (uintptr_t) bsp_section_rodata_load_begin);
> +#else
> +  uint32_t *d = &bsp_fdt_blob[0];
> +#endif
> +  uint32_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(src));
> +  uint32_t n = (m + sizeof(*d) - 1) / sizeof(*d);
> +  uint32_t i;
> +
> +  for (i = 0; i < n; ++i) {
> +    d[i] = s[i];
> +  }
> +
> +  rtems_cache_flush_multiple_data_lines(d, m);
> +}
> +
> +const void *bsp_fdt_get(void)
> +{
> +  return &bsp_fdt_blob[0];
> +}

This looks very specific and custom to a specific board and u-boot. I
think linker tricks are useful but I cannot follow what is happening
here and this is the down side of using them.

Chris


More information about the devel mailing list