[6-freebsd-12 PATCH 1/2] rtemsbsd/bus: Add PCI support to the nexus bus

Chris Johns chrisj at rtems.org
Wed Mar 3 07:52:23 UTC 2021


On 19/2/21 9:02 am, Chris Johns wrote:
> On 17/2/21 4:54 pm, Sebastian Huber wrote:
>> On 17/02/2021 03:20, Chris Johns wrote:
>>> On 16/2/21 5:49 pm, Chris Johns wrote:
>>>> On 16/2/21 5:05 pm, Sebastian Huber wrote:
>>>> I prefer the first option with the increased build time due to including bsp.h,
>>> rtems.h etc.
>> I am not concerned about the increased build time. The <bsp.h> and <rtems.h>
>> define all sorts of stuff. I would rather use a new BSP provided header file for
>> this, e.g. <bsp/bus.h>.
> 
> I think this is a good idea and worth sorting out now. It will require a
> configure test to enable the include. I am not sure when I will get back to this.
> 

Looking into this has uncovered some things I did not expect ... let me explain ....

There is an interdependency between the powerpc BSP header libcpu/io.h and
bsp.h. The libcpu/io.h header wants bsp.h to get _IO_BASE and friends and bsp.h
needs libcpu/io.h to get PREP_ISA_IO_BASE and CHRP_ISA_IO_BASE to create
_IO_BASE. These two headers include each other which seems to work when used in
either order so that seems fine. The bsp.h includes rtems.h which is the cause
of your valid concern.

A check of the bsps in the powerpc shows there is a dependence by a few of the
BSPs on libcpu/io.h and so the interdependence of libcpu/io.h and bsp.h.

In response to avoiding having to refactor these BSPs I decided to try a simple
but brutal first step and removed all the headers listed here ....

https://git.rtems.org/rtems/tree/bsps/powerpc/motorola_powerpc/include/bsp.h#n28

To my surprise this in a group of other errors popped up ...

[  30/4197] Compiling bsps/shared/ofw/ofw.c
In file included from ../../../bsps/shared/ofw/ofw.c:38:
../../../bsps/include/bsp/fdt.h:61:1: error: unknown type name 'uint32_t'
   61 | uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells);
      | ^~~~~~~~
../../../bsps/include/bsp/fdt.h:61:33: error: unknown type name 'uint32_t'
   61 | uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells);
      |                                 ^~~~~~~~
../../../bsps/include/bsp/fdt.h:61:49: error: unknown type name 'size_t'
   61 | uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells);
      |                                                 ^~~~~~
../../../bsps/include/bsp/fdt.h:19:1: note: 'size_t' is defined in header
'<stddef.h>'; did you forget to '#include <stddef.h>'?
   18 | #include <bsp.h>
  +++ |+#include <stddef.h>
   19 |

There is nothing in that header than needs bsp.h and stddef.h and stdint.h would do.

I then added stddef.h and stddint.h to bsp.h and then the build had warnings in
bsps/shared/dev/rtc/mc146818a_ioreg.c and bsps/powerpc/shared/console/uart.c.

Adding libcpu/io.h back to bsp.h got a lot further. I added back bspopt.h given
it is clean then got these errors:

- bsps/shared/start/bspfatal-default.c need bsp/default-initial-extension.h

- A couple of link errors related to the libcpu/powerpc-utility.h header needing
to be included.

- tests mouse01 and uid0 needed to include rtems.h

Then I hit minimum and some validation tests and they failed because I had
removed bsp/default-initial-extension.h and I suppose it needs to come via bsp.h
however it includes rtems.h because it needs to have access to
rtems_fatal_source etc.

It seems there is a lot of places that subtly depend on bsp.h and what it includes.

I will chat to Joel tomorrow to figure out how this is to be resolved.

Any suggestions?

Chris


More information about the devel mailing list