<div dir="ltr"><div class="gmail_default" style="font-size:small">Hello,<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I would like to add some more information regarding these patches here.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">These patches are currently not meant to replace the OpenFirmWare API from libBSD.</div><div class="gmail_default" style="font-size:small">For these patches to be completely compatible with libBSD we must support creating and</div><div class="gmail_default" style="font-size:small">registering <b>xref's</b> since the drivers use the <b>xref</b> mechanism to create a cross-reference</div><div class="gmail_default" style="font-size:small">between the devices, they are handling and the node handles in FDT for efficient translation.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The current plan is to let libBSD initialize the <b>xref</b> structure during its initialization. And have</div><div class="gmail_default" style="font-size:small">RTEMS provide the openfirmware API.</div><div class="gmail_default" style="font-size:small">i.e.</div><div class="gmail_default" style="font-size:small">RTEMS will contain the openfirm.h and openfirm.c with FreeBSD independent function</div><div class="gmail_default" style="font-size:small">declarations and definitions. For functions like</div><div class="gmail_default" style="font-size:small"><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-size:small">device_t OF_device_from_xref(phandle_t xref);</div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-size:small">phandle_t OF_xref_from_device(device_t dev);</div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-size:small">int OF_device_register_xref(phandle_t xref, device_t dev);</div></blockquote><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">which are dependent on FreeBSD we will have the declarations in RTEMS and definitions</div><div class="gmail_default" style="font-size:small">in FreeBSD. Though we have tried this with the pinmux driver more extensive testing has</div><div class="gmail_default" style="font-size:small">to done.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To allow for definitions of the above function in openfirm.h(present in RTEMS) we forward</div><div class="gmail_default" style="font-size:small">declared the *device* structure.</div><div class="gmail_default" style="font-size:small"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-size:small">typedef struct device *device_t;</div></blockquote></div><div class="gmail_default" style="font-size:small"><div class="gmail_default" style="font-size:small">If anyone doesn't like this solution please suggest an alternative solution.</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small">Niteesh.</div><div class="gmail_default" style="font-size:small"></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 15, 2020 at 12:02 PM G S Niteesh Babu <<a href="mailto:niteesh.gs@gmail.com" target="_blank">niteesh.gs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This commit move the bsp/fdt.h header to cpukit/include/rtems.<br>
The reason for this is, with inclusion of libfreebsd there are<br>
cases where their is need for bsp_fdt_get(). And with this<br>
header under bsps directory it is not possible to include it<br>
under a cpukit directory.<br>
---<br>
bsps/include/bsp/fdt.h | 86 +++++++++++--------------------<br>
cpukit/include/rtems/fdt.h | 69 +++++++++++++++++++++++++<br>
spec/build/cpukit/librtemscpu.yml | 1 +<br>
3 files changed, 100 insertions(+), 56 deletions(-)<br>
create mode 100644 cpukit/include/rtems/fdt.h<br>
<br>
diff --git a/bsps/include/bsp/fdt.h b/bsps/include/bsp/fdt.h<br>
index 4ed05b136c..4a7c3dfb24 100644<br>
--- a/bsps/include/bsp/fdt.h<br>
+++ b/bsps/include/bsp/fdt.h<br>
@@ -1,67 +1,41 @@<br>
-/*<br>
- * Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved.<br>
- *<br>
- * embedded brains GmbH<br>
- * Dornierstr. 4<br>
- * 82178 Puchheim<br>
- * Germany<br>
- * <<a href="mailto:rtems@embedded-brains.de" target="_blank">rtems@embedded-brains.de</a>><br>
- *<br>
- * The license and distribution terms for this file may be<br>
- * found in the file LICENSE in this distribution or at<br>
- * <a href="http://www.rtems.org/license/LICENSE" rel="noreferrer" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
- */<br>
-<br>
-#ifndef LIBBSP_SHARED_FDT_H<br>
-#define LIBBSP_SHARED_FDT_H<br>
-<br>
-#include <bsp.h><br>
-<br>
-#ifdef __cplusplus<br>
-extern "C" {<br>
-#endif /* __cplusplus */<br>
-<br>
-/*<br>
- * BSPs that implement the FDT support functions must define<br>
- * BSP_FDT_IS_SUPPORTED.<br>
- */<br>
+/* SPDX-License-Identifier: BSD-2-Clause */<br>
<br>
/**<br>
- * @brief Copies the specified source FDT to a dedicated global data area.<br>
+ * @file<br>
*<br>
- * The source FDT is usually provided by a bootloader and may be located in a<br>
- * memory area that is used by the program. The low-level initialization<br>
- * should copy the FDT for later use.<br>
+ * @ingroup RTEMSBSPsShared<br>
*<br>
- * The copy can be accessed by bsp_fdt_get().<br>
- *<br>
- * @param[in] src The source FDT.<br>
*/<br>
-void bsp_fdt_copy(const void *src);<br>
<br>
-/**<br>
- * @brief Returns the FDT of the BSP.<br>
- *<br>
- * @return The FDT of the BSP.<br>
+/*<br>
+ * Copyright (C) <2020>, Niteesh G S <<a href="mailto:niteesh.gs@gmail.com" target="_blank">niteesh.gs@gmail.com</a>><br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ * notice, this list of conditions and the following disclaimer.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br>
+ * notice, this list of conditions and the following disclaimer in the<br>
+ * documentation and/or other materials provided with the distribution.<br>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE<br>
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
+ * POSSIBILITY OF SUCH DAMAGE.<br>
*/<br>
-const void *bsp_fdt_get(void);<br>
<br>
-/**<br>
- * @brief Maps the interrupt number of the FDT to the interrupt vector used by<br>
- * the interrupt management.<br>
- *<br>
- * This function is used by the libbsd to implement the OFW_BUS_MAP_INTR bus<br>
- * method.<br>
- *<br>
- * @param[in] intr The FDT interrupt number cells.<br>
- * @param[in] icells The FDT interrupt cell count.<br>
- *<br>
- * @return The interrupt vector of the FDT interrupt number.<br>
- */<br>
-uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells);<br>
+#ifndef LIBBSP_SHARED_FDT_H<br>
+#define LIBBSP_SHARED_FDT_H<br>
<br>
-#ifdef __cplusplus<br>
-}<br>
-#endif /* __cplusplus */<br>
+#include <bsp.h><br>
+#include <rtems/fdt.h><br>
<br>
#endif /* LIBBSP_SHARED_FDT_H */<br>
diff --git a/cpukit/include/rtems/fdt.h b/cpukit/include/rtems/fdt.h<br>
new file mode 100644<br>
index 0000000000..149f7ff906<br>
--- /dev/null<br>
+++ b/cpukit/include/rtems/fdt.h<br>
@@ -0,0 +1,69 @@<br>
+/*<br>
+ * Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved.<br>
+ *<br>
+ * embedded brains GmbH<br>
+ * Dornierstr. 4<br>
+ * 82178 Puchheim<br>
+ * Germany<br>
+ * <<a href="mailto:rtems@embedded-brains.de" target="_blank">rtems@embedded-brains.de</a>><br>
+ *<br>
+ * Modified by Niteesh G S <<a href="mailto:niteesh.gs@gmail.com" target="_blank">niteesh.gs@gmail.com</a>><br>
+ *<br>
+ * The license and distribution terms for this file may be<br>
+ * found in the file LICENSE in this distribution or at<br>
+ * <a href="http://www.rtems.org/license/LICENSE" rel="noreferrer" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
+ */<br>
+<br>
+#ifndef RTEMS_FDT_H<br>
+#define RTEMS_FDT_H<br>
+<br>
+#include <rtems.h><br>
+<br>
+#ifdef __cplusplus<br>
+extern "C" {<br>
+#endif /* __cplusplus */<br>
+<br>
+/*<br>
+ * BSPs that implement the FDT support functions must define<br>
+ * BSP_FDT_IS_SUPPORTED.<br>
+ */<br>
+<br>
+/**<br>
+ * @brief Copies the specified source FDT to a dedicated global data area.<br>
+ *<br>
+ * The source FDT is usually provided by a bootloader and may be located in a<br>
+ * memory area that is used by the program. The low-level initialization<br>
+ * should copy the FDT for later use.<br>
+ *<br>
+ * The copy can be accessed by bsp_fdt_get().<br>
+ *<br>
+ * @param[in] src The source FDT.<br>
+ */<br>
+void bsp_fdt_copy(const void *src);<br>
+<br>
+/**<br>
+ * @brief Returns the FDT of the BSP.<br>
+ *<br>
+ * @return The FDT of the BSP.<br>
+ */<br>
+const void *bsp_fdt_get(void);<br>
+<br>
+/**<br>
+ * @brief Maps the interrupt number of the FDT to the interrupt vector used by<br>
+ * the interrupt management.<br>
+ *<br>
+ * This function is used by the libbsd to implement the OFW_BUS_MAP_INTR bus<br>
+ * method.<br>
+ *<br>
+ * @param[in] intr The FDT interrupt number cells.<br>
+ * @param[in] icells The FDT interrupt cell count.<br>
+ *<br>
+ * @return The interrupt vector of the FDT interrupt number.<br>
+ */<br>
+uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells);<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif /* __cplusplus */<br>
+<br>
+#endif /* RTEMS_FDT_H */<br>
diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml<br>
index 2af315da71..403662b97d 100644<br>
--- a/spec/build/cpukit/librtemscpu.yml<br>
+++ b/spec/build/cpukit/librtemscpu.yml<br>
@@ -105,6 +105,7 @@ install:<br>
- cpukit/include/rtems/extensionimpl.h<br>
- cpukit/include/rtems/fatal.h<br>
- cpukit/include/rtems/fb.h<br>
+ - cpukit/include/rtems/fdt.h<br>
- cpukit/include/rtems/flashdisk.h<br>
- cpukit/include/rtems/framebuffer.h<br>
- cpukit/include/rtems/fs.h<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>