Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-04 Thread Gedare Bloom
On Mon, Nov 2, 2020 at 12:13 PM Christian Mauderer  wrote:
>
> Hello Niteesh,
>
> On 02/11/2020 18:06, Niteesh G. S. wrote:
> > ping.
>
> Yes, of course you are right that it would be time to integrate it. The
> nasty part why I haven't started to do something into that direction is
> that we currently still have the old build system and the new in
> parallel. But I think we should start to integrate your code anyway.
>
> Please correct me if I'm wrong: Currently there are two parts:
>
> 1. Adding the OFW interface.
>
> 2. Using in in BBB.
>
> Is that correct?
>
> I think the first one should be not too hard. There are already some
> parts that use only the new build system. Wouldn't be a problem to do
> that with OFW too. So to all participating at the discussion: Is there
> any blocker left why we wouldn't integrate an updated version of the
> patches?
>

I think this is fine. Of course, we get less confident about the
comparison between the two build systems. But, without someone
actively engaged in verifying them, I think at some point we need to
just start to move on.

I currently lack time, hopefully in Dec I can revisit. I have a
t2080rdb I want to get set up and may be able to test both old/new
build systems.

It will be good to keep bsps building with the old build system until
we kill it off. Especially the BBB (and other common test targets). So
your analysis is spot on.

Gedare
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-02 Thread Christian Mauderer
Hello Niteesh,

On 03/11/2020 03:42, Niteesh G. S. wrote:
> Hello Christian,
> 
> On Tue, Nov 3, 2020 at 12:43 AM Christian Mauderer  > wrote:
> 
> Hello Niteesh,
> 
> On 02/11/2020 18:06, Niteesh G. S. wrote:
> > ping.
> 
> Yes, of course you are right that it would be time to integrate it. The
> nasty part why I haven't started to do something into that direction is
> that we currently still have the old build system and the new in
> parallel. But I think we should start to integrate your code anyway.
> 
> Please correct me if I'm wrong: Currently there are two parts:
> 
> 1. Adding the OFW interface.
> 
> 2. Using in in BBB.
> 
> Is that correct?
> 
> There is also the FreeBSD structures to makeporting of drivers easy.
> I guess merging this after a thorough inspection should also not be
> an issue.
> 

Do the patches for the OFW interface and the FreeBSD structures still
work on a current RTEMS master?

Best regards

Christian

> 
> I think the first one should be not too hard. There are already some
> parts that use only the new build system. Wouldn't be a problem to do
> that with OFW too. So to all participating at the discussion: Is there
> any blocker left why we wouldn't integrate an updated version of the
> patches?
> 
>  
> The only blocker seen during the development was the license issue.
> But that is now resolved since we figured out that all the referenced
> code comes under the BSD 2 license.
>  
> 
> The second part is a bit harder. BBB is one of the BSPs that are quite
> entry friendly and therefore it should currently build with old and new
> build system till the old system is removed.
> 
>  
> OK. I'll wait until the old system gets removed, I still have some work left
> to do on the drivers.
> 
> Thanks,
> Niteesh
> 
> Best regards
> 
> Christian
> 
> >
> > On Thu, Sep 24, 2020 at 9:00 AM Niteesh G. S.
> mailto:niteesh...@gmail.com>
> > >> wrote:
> >
> >     Hello,
> >
> >     On Sat, Sep 19, 2020 at 4:13 PM Christian Mauderer
> >     mailto:o...@c-mauderer.de>
> >> wrote:
> >
> >         Hello Niteesh,
> >
> >         sorry for adding another delay: I think the new build system
> >         needs a bit
> >         of time to settle. As soon as there are some more PASS in the
> >         table that
> >         Sebastian created [1] (especially for beagle) we should try to
> >         get these
> >         patches merged. Before that I would like to avoid big changes
> >         because it
> >         might get hard to distinguish new bugs from build system bugs.
> >
> >
> >     No problem. Currently, I have my university exams going on and
> also I am
> >     waiting for my logic analyzer. As soon as it arrives I'll start
> >     verifying the previous
> >     drivers and finish refactoring the other ones.
> >
> >     Thanks,
> >     Niteesh.
> >
> >      
> >
> >
> >         Best regards
> >
> >         Christian
> >
> >         [1]
> https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist
> >
> >         On 16/09/2020 19:05, Niteesh G. S. wrote:
> >         > Hello,
> >         >
> >         > Sorry for the delay, I was a bit occupied with my
> university work.
> >         > Now since the new build system is merged I would like to
> get my
> >         > GSoC work merged too.
> >         >
> >         > The goal of this series patches is to implement the OFW API
> >         into RTEMS
> >         > and modify libBSD to use this RTEMS API instead of its own.
> >         >
> >         > Thanks,
> >         > Niteesh.
> >         >
> >         > On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu
> >         mailto:niteesh...@gmail.com>
> >
> >         >     >         wrote:
> >         >
> >         >     RTEMS OFW is a FDT only implementation of the
> OpenFirmWare
> >         >     interface. This API is created to be compatible with
> FreeBSD
> >         >     OpenFirmWare interface. The main intention is to make
> >         >     porting of FreeBSD drivers to RTEMS easier.
> >         >
> >         >     Most functions implemented have an direct one-one
> mapping
> >         >     with the original OFW API and some extra auxiliary
> functions
> >         >     were implemented to make working with device trees
> easier in
> >         >     RTEMS.
> >         >

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-02 Thread Christian Mauderer
Hello Niteesh,

On 02/11/2020 18:06, Niteesh G. S. wrote:
> ping.

Yes, of course you are right that it would be time to integrate it. The
nasty part why I haven't started to do something into that direction is
that we currently still have the old build system and the new in
parallel. But I think we should start to integrate your code anyway.

Please correct me if I'm wrong: Currently there are two parts:

1. Adding the OFW interface.

2. Using in in BBB.

Is that correct?

I think the first one should be not too hard. There are already some
parts that use only the new build system. Wouldn't be a problem to do
that with OFW too. So to all participating at the discussion: Is there
any blocker left why we wouldn't integrate an updated version of the
patches?

The second part is a bit harder. BBB is one of the BSPs that are quite
entry friendly and therefore it should currently build with old and new
build system till the old system is removed.

Best regards

Christian

> 
> On Thu, Sep 24, 2020 at 9:00 AM Niteesh G. S.  > wrote:
> 
> Hello,
> 
> On Sat, Sep 19, 2020 at 4:13 PM Christian Mauderer
> mailto:o...@c-mauderer.de>> wrote:
> 
> Hello Niteesh,
> 
> sorry for adding another delay: I think the new build system
> needs a bit
> of time to settle. As soon as there are some more PASS in the
> table that
> Sebastian created [1] (especially for beagle) we should try to
> get these
> patches merged. Before that I would like to avoid big changes
> because it
> might get hard to distinguish new bugs from build system bugs.
> 
> 
> No problem. Currently, I have my university exams going on and also I am
> waiting for my logic analyzer. As soon as it arrives I'll start
> verifying the previous
> drivers and finish refactoring the other ones.
> 
> Thanks,
> Niteesh.
> 
>  
> 
> 
> Best regards
> 
> Christian
> 
> [1] https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist
> 
> On 16/09/2020 19:05, Niteesh G. S. wrote:
> > Hello,
> >
> > Sorry for the delay, I was a bit occupied with my university work.
> > Now since the new build system is merged I would like to get my
> > GSoC work merged too.
> >
> > The goal of this series patches is to implement the OFW API
> into RTEMS
> > and modify libBSD to use this RTEMS API instead of its own.
> >
> > Thanks,
> > Niteesh.
> >
> > On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu
> mailto:niteesh...@gmail.com>
> > >>
> wrote:
> >
> >     RTEMS OFW is a FDT only implementation of the OpenFirmWare
> >     interface. This API is created to be compatible with FreeBSD
> >     OpenFirmWare interface. The main intention is to make
> >     porting of FreeBSD drivers to RTEMS easier.
> >
> >     Most functions implemented have an direct one-one mapping
> >     with the original OFW API and some extra auxiliary functions
> >     were implemented to make working with device trees easier in
> >     RTEMS.
> >
> >     Update #3784
> >     ---
> >      bsps/include/ofw/ofw.h        | 548
> +++
> >      bsps/include/ofw/ofw_compat.h |  74 
> >      bsps/shared/ofw/ofw.c         | 682
> ++
> >      spec/build/bsps/obj.yml       |   5 +
> >      4 files changed, 1309 insertions(+)
> >      create mode 100644 bsps/include/ofw/ofw.h
> >      create mode 100644 bsps/include/ofw/ofw_compat.h
> >      create mode 100644 bsps/shared/ofw/ofw.c
> >
> >     diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> >     new file mode 100644
> >     index 00..411010be89
> >     --- /dev/null
> >     +++ b/bsps/include/ofw/ofw.h
> >     @@ -0,0 +1,548 @@
> >     +/* SPDX-License-Identifier: BSD-2-Clause */
> >     +
> >     +/**
> >     + * @file
> >     + *
> >     + * @ingroup ofw
> >     + *
> >     + * RTEMS FDT implementation of OpenFirmWare Interface.
> >     + *
> >     + * RTEMS OFW is a FDT only implementation of the OpenFirmWare
> >     interface.
> >     + * This API is created to be compatible with FreeBSD
> OpenFirmWare
> >     interface.
> >     + * The main intention is to make porting of FreeBSD
> drivers to
> >     RTEMS easier.
> >     + */
> >     +
> >     +/*
> >     + * Copyright (C) 2020 Niteesh Babu G S
> 

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-02 Thread Niteesh G. S.
ping.

On Thu, Sep 24, 2020 at 9:00 AM Niteesh G. S.  wrote:

> Hello,
>
> On Sat, Sep 19, 2020 at 4:13 PM Christian Mauderer 
> wrote:
>
>> Hello Niteesh,
>>
>> sorry for adding another delay: I think the new build system needs a bit
>> of time to settle. As soon as there are some more PASS in the table that
>> Sebastian created [1] (especially for beagle) we should try to get these
>> patches merged. Before that I would like to avoid big changes because it
>> might get hard to distinguish new bugs from build system bugs.
>
>
> No problem. Currently, I have my university exams going on and also I am
> waiting for my logic analyzer. As soon as it arrives I'll start verifying
> the previous
> drivers and finish refactoring the other ones.
>
> Thanks,
> Niteesh.
>
>
>
>>
>> Best regards
>>
>> Christian
>>
>> [1] https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist
>>
>> On 16/09/2020 19:05, Niteesh G. S. wrote:
>> > Hello,
>> >
>> > Sorry for the delay, I was a bit occupied with my university work.
>> > Now since the new build system is merged I would like to get my
>> > GSoC work merged too.
>> >
>> > The goal of this series patches is to implement the OFW API into RTEMS
>> > and modify libBSD to use this RTEMS API instead of its own.
>> >
>> > Thanks,
>> > Niteesh.
>> >
>> > On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu > > > wrote:
>> >
>> > RTEMS OFW is a FDT only implementation of the OpenFirmWare
>> > interface. This API is created to be compatible with FreeBSD
>> > OpenFirmWare interface. The main intention is to make
>> > porting of FreeBSD drivers to RTEMS easier.
>> >
>> > Most functions implemented have an direct one-one mapping
>> > with the original OFW API and some extra auxiliary functions
>> > were implemented to make working with device trees easier in
>> > RTEMS.
>> >
>> > Update #3784
>> > ---
>> >  bsps/include/ofw/ofw.h| 548 +++
>> >  bsps/include/ofw/ofw_compat.h |  74 
>> >  bsps/shared/ofw/ofw.c | 682
>> ++
>> >  spec/build/bsps/obj.yml   |   5 +
>> >  4 files changed, 1309 insertions(+)
>> >  create mode 100644 bsps/include/ofw/ofw.h
>> >  create mode 100644 bsps/include/ofw/ofw_compat.h
>> >  create mode 100644 bsps/shared/ofw/ofw.c
>> >
>> > diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
>> > new file mode 100644
>> > index 00..411010be89
>> > --- /dev/null
>> > +++ b/bsps/include/ofw/ofw.h
>> > @@ -0,0 +1,548 @@
>> > +/* SPDX-License-Identifier: BSD-2-Clause */
>> > +
>> > +/**
>> > + * @file
>> > + *
>> > + * @ingroup ofw
>> > + *
>> > + * RTEMS FDT implementation of OpenFirmWare Interface.
>> > + *
>> > + * RTEMS OFW is a FDT only implementation of the OpenFirmWare
>> > interface.
>> > + * This API is created to be compatible with FreeBSD OpenFirmWare
>> > interface.
>> > + * The main intention is to make porting of FreeBSD drivers to
>> > RTEMS easier.
>> > + */
>> > +
>> > +/*
>> > + * Copyright (C) 2020 Niteesh Babu G S > > >
>> > + *
>> > + * Redistribution and use in source and binary forms, with or
>> without
>> > + * modification, are permitted provided that the following
>> conditions
>> > + * are met:
>> > + * 1. Redistributions of source code must retain the above
>> copyright
>> > + *notice, this list of conditions and the following disclaimer.
>> > + * 2. Redistributions in binary form must reproduce the above
>> copyright
>> > + *notice, this list of conditions and the following disclaimer
>> > in the
>> > + *documentation and/or other materials provided with the
>> > distribution.
>> > + *
>> > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
>> > CONTRIBUTORS "AS IS"
>> > + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> > LIMITED TO, THE
>> > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
>> > PARTICULAR PURPOSE
>> > + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
>> > CONTRIBUTORS BE
>> > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
>> EXEMPLARY, OR
>> > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
>> PROCUREMENT OF
>> > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> > BUSINESS
>> > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
>> > WHETHER IN
>> > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
>> > OTHERWISE)
>> > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
>> > ADVISED OF THE
>> > + * POSSIBILITY OF SUCH DAMAGE.
>> > + */
>> > +
>> > +#ifndef _OFW_H
>> > +#define _OFW_H
>> > +
>> > +#ifdef __cplusplus
>> > 

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-09-23 Thread Niteesh G. S.
Hello,

On Sat, Sep 19, 2020 at 4:13 PM Christian Mauderer 
wrote:

> Hello Niteesh,
>
> sorry for adding another delay: I think the new build system needs a bit
> of time to settle. As soon as there are some more PASS in the table that
> Sebastian created [1] (especially for beagle) we should try to get these
> patches merged. Before that I would like to avoid big changes because it
> might get hard to distinguish new bugs from build system bugs.


No problem. Currently, I have my university exams going on and also I am
waiting for my logic analyzer. As soon as it arrives I'll start verifying
the previous
drivers and finish refactoring the other ones.

Thanks,
Niteesh.



>
> Best regards
>
> Christian
>
> [1] https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist
>
> On 16/09/2020 19:05, Niteesh G. S. wrote:
> > Hello,
> >
> > Sorry for the delay, I was a bit occupied with my university work.
> > Now since the new build system is merged I would like to get my
> > GSoC work merged too.
> >
> > The goal of this series patches is to implement the OFW API into RTEMS
> > and modify libBSD to use this RTEMS API instead of its own.
> >
> > Thanks,
> > Niteesh.
> >
> > On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu  > > wrote:
> >
> > RTEMS OFW is a FDT only implementation of the OpenFirmWare
> > interface. This API is created to be compatible with FreeBSD
> > OpenFirmWare interface. The main intention is to make
> > porting of FreeBSD drivers to RTEMS easier.
> >
> > Most functions implemented have an direct one-one mapping
> > with the original OFW API and some extra auxiliary functions
> > were implemented to make working with device trees easier in
> > RTEMS.
> >
> > Update #3784
> > ---
> >  bsps/include/ofw/ofw.h| 548 +++
> >  bsps/include/ofw/ofw_compat.h |  74 
> >  bsps/shared/ofw/ofw.c | 682
> ++
> >  spec/build/bsps/obj.yml   |   5 +
> >  4 files changed, 1309 insertions(+)
> >  create mode 100644 bsps/include/ofw/ofw.h
> >  create mode 100644 bsps/include/ofw/ofw_compat.h
> >  create mode 100644 bsps/shared/ofw/ofw.c
> >
> > diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> > new file mode 100644
> > index 00..411010be89
> > --- /dev/null
> > +++ b/bsps/include/ofw/ofw.h
> > @@ -0,0 +1,548 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause */
> > +
> > +/**
> > + * @file
> > + *
> > + * @ingroup ofw
> > + *
> > + * RTEMS FDT implementation of OpenFirmWare Interface.
> > + *
> > + * RTEMS OFW is a FDT only implementation of the OpenFirmWare
> > interface.
> > + * This API is created to be compatible with FreeBSD OpenFirmWare
> > interface.
> > + * The main intention is to make porting of FreeBSD drivers to
> > RTEMS easier.
> > + */
> > +
> > +/*
> > + * Copyright (C) 2020 Niteesh Babu G S  > >
> > + *
> > + * Redistribution and use in source and binary forms, with or
> without
> > + * modification, are permitted provided that the following
> conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *notice, this list of conditions and the following disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above
> copyright
> > + *notice, this list of conditions and the following disclaimer
> > in the
> > + *documentation and/or other materials provided with the
> > distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> > CONTRIBUTORS "AS IS"
> > + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> > LIMITED TO, THE
> > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> > PARTICULAR PURPOSE
> > + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
> > CONTRIBUTORS BE
> > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
> OR
> > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
> PROCUREMENT OF
> > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> > BUSINESS
> > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> > WHETHER IN
> > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> > OTHERWISE)
> > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> > ADVISED OF THE
> > + * POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +#ifndef _OFW_H
> > +#define _OFW_H
> > +
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/**
> > + * Represents a node in the device tree. The offset from fdtp to
> > node 

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-09-19 Thread Christian Mauderer
Hello Niteesh,

sorry for adding another delay: I think the new build system needs a bit
of time to settle. As soon as there are some more PASS in the table that
Sebastian created [1] (especially for beagle) we should try to get these
patches merged. Before that I would like to avoid big changes because it
might get hard to distinguish new bugs from build system bugs.

Best regards

Christian

[1] https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist

On 16/09/2020 19:05, Niteesh G. S. wrote:
> Hello,
> 
> Sorry for the delay, I was a bit occupied with my university work.
> Now since the new build system is merged I would like to get my
> GSoC work merged too.
> 
> The goal of this series patches is to implement the OFW API into RTEMS
> and modify libBSD to use this RTEMS API instead of its own.
> 
> Thanks,
> Niteesh.
> 
> On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu  > wrote:
> 
> RTEMS OFW is a FDT only implementation of the OpenFirmWare
> interface. This API is created to be compatible with FreeBSD
> OpenFirmWare interface. The main intention is to make
> porting of FreeBSD drivers to RTEMS easier.
> 
> Most functions implemented have an direct one-one mapping
> with the original OFW API and some extra auxiliary functions
> were implemented to make working with device trees easier in
> RTEMS.
> 
> Update #3784
> ---
>  bsps/include/ofw/ofw.h        | 548 +++
>  bsps/include/ofw/ofw_compat.h |  74 
>  bsps/shared/ofw/ofw.c         | 682 ++
>  spec/build/bsps/obj.yml       |   5 +
>  4 files changed, 1309 insertions(+)
>  create mode 100644 bsps/include/ofw/ofw.h
>  create mode 100644 bsps/include/ofw/ofw_compat.h
>  create mode 100644 bsps/shared/ofw/ofw.c
> 
> diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> new file mode 100644
> index 00..411010be89
> --- /dev/null
> +++ b/bsps/include/ofw/ofw.h
> @@ -0,0 +1,548 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup ofw
> + *
> + * RTEMS FDT implementation of OpenFirmWare Interface.
> + *
> + * RTEMS OFW is a FDT only implementation of the OpenFirmWare
> interface.
> + * This API is created to be compatible with FreeBSD OpenFirmWare
> interface.
> + * The main intention is to make porting of FreeBSD drivers to
> RTEMS easier.
> + */
> +
> +/*
> + * Copyright (C) 2020 Niteesh Babu G S  >
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer
> in the
> + *    documentation and/or other materials provided with the
> distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
> CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifndef _OFW_H
> +#define _OFW_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * Represents a node in the device tree. The offset from fdtp to
> node is used
> + * instead of fdt offset to make sure this is compatible with OF
> interface in
> + * FreeBSD.
> + */
> +typedef uint32_t  phandle_t;
> +/**
> + * Represents the effective phandle of the node.
> + */
> +typedef uint32_t  ihandle_t;
> +/**
> + * Represents the data type of the buffer.
> + */
> +typedef uint32_t  pcell_t;
> +
> +/**
> + * @struct rtems_ofw_memory_area
> + *
> + * This is used to represent elements(FDT properties) that define
> + * region 

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-09-16 Thread Niteesh G. S.
Hello,

Sorry for the delay, I was a bit occupied with my university work.
Now since the new build system is merged I would like to get my
GSoC work merged too.

The goal of this series patches is to implement the OFW API into RTEMS
and modify libBSD to use this RTEMS API instead of its own.

Thanks,
Niteesh.

On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu 
wrote:

> RTEMS OFW is a FDT only implementation of the OpenFirmWare
> interface. This API is created to be compatible with FreeBSD
> OpenFirmWare interface. The main intention is to make
> porting of FreeBSD drivers to RTEMS easier.
>
> Most functions implemented have an direct one-one mapping
> with the original OFW API and some extra auxiliary functions
> were implemented to make working with device trees easier in
> RTEMS.
>
> Update #3784
> ---
>  bsps/include/ofw/ofw.h| 548 +++
>  bsps/include/ofw/ofw_compat.h |  74 
>  bsps/shared/ofw/ofw.c | 682 ++
>  spec/build/bsps/obj.yml   |   5 +
>  4 files changed, 1309 insertions(+)
>  create mode 100644 bsps/include/ofw/ofw.h
>  create mode 100644 bsps/include/ofw/ofw_compat.h
>  create mode 100644 bsps/shared/ofw/ofw.c
>
> diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> new file mode 100644
> index 00..411010be89
> --- /dev/null
> +++ b/bsps/include/ofw/ofw.h
> @@ -0,0 +1,548 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup ofw
> + *
> + * RTEMS FDT implementation of OpenFirmWare Interface.
> + *
> + * RTEMS OFW is a FDT only implementation of the OpenFirmWare interface.
> + * This API is created to be compatible with FreeBSD OpenFirmWare
> interface.
> + * The main intention is to make porting of FreeBSD drivers to RTEMS
> easier.
> + */
> +
> +/*
> + * Copyright (C) 2020 Niteesh Babu G S 
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
> THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
> BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
> THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifndef _OFW_H
> +#define _OFW_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * Represents a node in the device tree. The offset from fdtp to node is
> used
> + * instead of fdt offset to make sure this is compatible with OF
> interface in
> + * FreeBSD.
> + */
> +typedef uint32_t  phandle_t;
> +/**
> + * Represents the effective phandle of the node.
> + */
> +typedef uint32_t  ihandle_t;
> +/**
> + * Represents the data type of the buffer.
> + */
> +typedef uint32_t  pcell_t;
> +
> +/**
> + * @struct rtems_ofw_memory_area
> + *
> + * This is used to represent elements(FDT properties) that define
> + * region of memory address.
> + */
> +typedef struct {
> +  /** The start address of the memory region. */
> +  uint32_t start;
> +  /** The size of the memory region. */
> +  uint32_t size;
> +} rtems_ofw_memory_area;
> +
> +/**
> + * @struct rtems_ofw_ranges
> + *
> + * This is used to represent the ranges property in the device tree.
> + */
> +typedef struct {
> +  /** The physical address within the child bus address space */
> +  uint32_t child_bus;
> +  /** The physical address within the parent bus address space */
> +  uint32_t parent_bus;
> +  /** The size of the range in the child’s address space */
> +  uint32_t size;
> +} rtems_ofw_ranges;
> +
> +/**
> + * @brief Gets the node that is next to @a node.
> + *
> + * @param[in] node Node offset
> + *
> + * @retval Peer node offset Successful operation.
> + * @retval 0 No peer node or invalid node handle
> + */
> +phandle_t rtems_ofw_peer(
> +  phandle_t   node
> +);
> +
> +/**
> + * @brief Gets the node that is the child of @a node.
> + *
> + * @param[in] node Node offset
> + *
> + * 

[PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-09-16 Thread G S Niteesh Babu
RTEMS OFW is a FDT only implementation of the OpenFirmWare
interface. This API is created to be compatible with FreeBSD
OpenFirmWare interface. The main intention is to make
porting of FreeBSD drivers to RTEMS easier.

Most functions implemented have an direct one-one mapping
with the original OFW API and some extra auxiliary functions
were implemented to make working with device trees easier in
RTEMS.

Update #3784
---
 bsps/include/ofw/ofw.h| 548 +++
 bsps/include/ofw/ofw_compat.h |  74 
 bsps/shared/ofw/ofw.c | 682 ++
 spec/build/bsps/obj.yml   |   5 +
 4 files changed, 1309 insertions(+)
 create mode 100644 bsps/include/ofw/ofw.h
 create mode 100644 bsps/include/ofw/ofw_compat.h
 create mode 100644 bsps/shared/ofw/ofw.c

diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
new file mode 100644
index 00..411010be89
--- /dev/null
+++ b/bsps/include/ofw/ofw.h
@@ -0,0 +1,548 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup ofw
+ *
+ * RTEMS FDT implementation of OpenFirmWare Interface.
+ *
+ * RTEMS OFW is a FDT only implementation of the OpenFirmWare interface.
+ * This API is created to be compatible with FreeBSD OpenFirmWare interface.
+ * The main intention is to make porting of FreeBSD drivers to RTEMS easier.
+ */
+
+/*
+ * Copyright (C) 2020 Niteesh Babu G S 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _OFW_H
+#define _OFW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+#include 
+
+/**
+ * Represents a node in the device tree. The offset from fdtp to node is used
+ * instead of fdt offset to make sure this is compatible with OF interface in
+ * FreeBSD.
+ */
+typedef uint32_t  phandle_t;
+/**
+ * Represents the effective phandle of the node.
+ */
+typedef uint32_t  ihandle_t;
+/**
+ * Represents the data type of the buffer.
+ */
+typedef uint32_t  pcell_t;
+
+/**
+ * @struct rtems_ofw_memory_area
+ *
+ * This is used to represent elements(FDT properties) that define
+ * region of memory address.
+ */
+typedef struct {
+  /** The start address of the memory region. */
+  uint32_t start;
+  /** The size of the memory region. */
+  uint32_t size;
+} rtems_ofw_memory_area;
+
+/**
+ * @struct rtems_ofw_ranges
+ *
+ * This is used to represent the ranges property in the device tree.
+ */
+typedef struct {
+  /** The physical address within the child bus address space */
+  uint32_t child_bus;
+  /** The physical address within the parent bus address space */
+  uint32_t parent_bus;
+  /** The size of the range in the child’s address space */
+  uint32_t size;
+} rtems_ofw_ranges;
+
+/**
+ * @brief Gets the node that is next to @a node.
+ *
+ * @param[in] node Node offset
+ *
+ * @retval Peer node offset Successful operation.
+ * @retval 0 No peer node or invalid node handle
+ */
+phandle_t rtems_ofw_peer(
+  phandle_t   node
+);
+
+/**
+ * @brief Gets the node that is the child of @a node.
+ *
+ * @param[in] node Node offset
+ *
+ * @retval child node offset Successful operation.
+ * @retval 0 No child node or invalid node handle
+ */
+phandle_t rtems_ofw_child(
+  phandle_t   node
+);
+
+/**
+ * @brief Gets the node that is the parent of @a node.
+ *
+ * @param[in] node Node offset
+ *
+ * @retval child node offset Successful operation.
+ * @retval 0 No child node or invalid node handle
+ */
+phandle_t rtems_ofw_parent(
+  phandle_t   node
+);
+
+/**
+ * @brief Gets the length of the property mentioned in @a propname.
+ *
+ * @param[in] node Node offset
+ * @param[in] prop Property name
+ *
+ * @retval -1 Invalid node or property
+ * @retval  Length of property on successful