[rtems-libbsd commit] fbd: Port to RTEMS

Christian Mauderer christianm at rtems.org
Sun Aug 11 15:03:16 UTC 2019


Module:    rtems-libbsd
Branch:    master
Commit:    d7c01f45691d4289c5b8d5cafe9e2776b03731ea
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=d7c01f45691d4289c5b8d5cafe9e2776b03731ea

Author:    Vijay Kumar Banerjee <vijaykumar9597 at gmail.com>
Date:      Sun Aug  4 02:07:43 2019 +0530

fbd: Port to RTEMS

---

 Makefile.todo                                      | 13 +++++++
 freebsd/sys/dev/fb/fbd.c                           |  4 ++
 libbsd.py                                          | 11 ++++++
 rtemsbsd/include/bsp/nexus-devices.h               |  3 ++
 .../include/machine/rtems-bsd-kernel-namespace.h   | 20 ++++++++++
 rtemsbsd/include/machine/vm.h                      |  1 +
 rtemsbsd/include/rtems/bsd/local/fb_if.h           | 45 ++++++++++++++++++++++
 rtemsbsd/include/rtems/bsd/local/opt_fb.h          |  0
 rtemsbsd/include/rtems/bsd/local/opt_splash.h      |  0
 rtemsbsd/include/rtems/bsd/local/opt_syscons.h     |  0
 rtemsbsd/include/rtems/bsd/local/opt_teken.h       |  0
 rtemsbsd/local/fb_if.c                             | 30 +++++++++++++++
 12 files changed, 127 insertions(+)

diff --git a/Makefile.todo b/Makefile.todo
index cad9b2a..80d582c 100644
--- a/Makefile.todo
+++ b/Makefile.todo
@@ -53,6 +53,8 @@ GENERATED += $(LOCAL_INC)/clknode_if.h
 GENERATED += $(LOCAL_SRC)/clknode_if.c
 GENERATED += $(LOCAL_INC)/hdmi_if.h
 GENERATED += $(LOCAL_SRC)/hdmi_if.c
+GENERATED += $(LOCAL_INC)/fb_if.h
+GENERATED += $(LOCAL_SRC)/fb_if.c
 GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
 GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
 
@@ -278,6 +280,17 @@ $(LOCAL_SRC)/hdmi_if.c: $(FREEBSD_SRC)/sys/dev/hdmi/hdmi_if.m
 	    -e 's|#include "hdmi_if.h"|#include <rtems/bsd/local/hdmi_if.h>|'
 	mv hdmi_if.c $@
 
+$(LOCAL_INC)/fb_if.h: $(FREEBSD_SRC)/sys/dev/fb/fb_if.m
+	awk -f $(TOOLS)/makeobjops.awk $< -h
+	mv fb_if.h $@
+
+$(LOCAL_SRC)/fb_if.c: $(FREEBSD_SRC)/sys/dev/fb/fb_if.m
+	awk -f $(TOOLS)/makeobjops.awk $< -c
+	sed -i fb_if.c \
+	    -e '1 i\#include <machine/rtems-bsd-kernel-space.h>\n' \
+	    -e 's|#include "fb_if.h"|#include <rtems/bsd/local/fb_if.h>|'
+	mv fb_if.c $@
+
 $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
 	awk -f $(TOOLS)/makeobjops.awk $< -c
 	mv gpio_if.c $@
diff --git a/freebsd/sys/dev/fb/fbd.c b/freebsd/sys/dev/fb/fbd.c
index 60ce4bc..871e193 100644
--- a/freebsd/sys/dev/fb/fbd.c
+++ b/freebsd/sys/dev/fb/fbd.c
@@ -257,11 +257,13 @@ fbd_register(struct fb_info* info)
 	err = fb_init(entry, framebuffer_dev_unit++);
 	if (err)
 		return (err);
+#ifndef __rtems__
 	if (first) {
 		err = vt_fb_attach(info);
 		if (err)
 			return (err);
 	}
+#endif /* __rtems__ */
 
 	return (0);
 }
@@ -274,8 +276,10 @@ fbd_unregister(struct fb_info* info)
 	LIST_FOREACH_SAFE(entry, &fb_list_head, fb_list, tmp) {
 		if (entry->fb_info == info) {
 			LIST_REMOVE(entry, fb_list);
+#ifndef __rtems__
 			if (LIST_EMPTY(&fb_list_head))
 				vt_fb_detach(info);
+#endif /* __rtems__ */
 			free(entry, M_DEVBUF);
 			return (0);
 		}
diff --git a/libbsd.py b/libbsd.py
index bdc9177..4b729b6 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -797,6 +797,14 @@ class display(builder.Module):
                 'sys/dev/videomode/ediddevs.h',
                 'sys/dev/videomode/ediddevs_data.h',
                 'sys/dev/videomode/vesagtf.h',
+                'sys/dev/vt/hw/fb/vt_fb.h',
+                'sys/dev/vt/colors/vt_termcolors.h',
+                'sys/dev/vt/vt.h',
+                'sys/dev/fb/fbreg.h',
+                'sys/teken/teken.h',
+                'sys/sys/fbio.h',
+                'sys/sys/consio.h',
+                'sys/sys/terminal.h',
             ]
         )
         self.addKernelSpaceSourceFiles(
@@ -806,6 +814,8 @@ class display(builder.Module):
                 'sys/dev/videomode/edid.c',
                 'sys/dev/videomode/vesagtf.c',
                 'sys/dev/videomode/videomode.c',
+                'sys/dev/fb/fb.c',
+                'sys/dev/fb/fbd.c',
             ],
             mm.generator['source']()
         )
@@ -813,6 +823,7 @@ class display(builder.Module):
             [
                 'local/clknode_if.c',
                 'local/hdmi_if.c',
+                'local/fb_if.c',
             ],
             mm.generator['source']()
         )
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index e330679..ebf1ba1 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -67,6 +67,9 @@ SYSINIT_DRIVER_REFERENCE(ofw_iicbus, rtems_i2c);
 SYSINIT_DRIVER_REFERENCE(iic, iicbus);
 SYSINIT_DRIVER_REFERENCE(tda, iicbus);
 SYSINIT_DRIVER_REFERENCE(iicbus, rtems_i2c);
+SYSINIT_DRIVER_REFERENCE(fbd, fb);
+SYSINIT_DRIVER_REFERENCE(fb, fb_mod);
+SYSINIT_MODULE_REFERENCE(fb_mod);
 #ifdef RTEMS_BSD_MODULE_NET80211
 SYSINIT_DRIVER_REFERENCE(rtwn_usb, uhub);
 SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
index 1606543..94dc2cb 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
@@ -1264,6 +1264,16 @@
 #define	eventhandler_find_list _bsd_eventhandler_find_list
 #define	eventhandler_prune_list _bsd_eventhandler_prune_list
 #define	eventhandler_register _bsd_eventhandler_register
+#define	fb_commonioctl _bsd_fb_commonioctl
+#define	fbd_devclass _bsd_fbd_devclass
+#define	fbd_driver _bsd_fbd_driver
+#define	fbd_list _bsd_fbd_list
+#define	fbd_register _bsd_fbd_register
+#define	fb_dump_adp_info _bsd_fb_dump_adp_info
+#define	fb_dump_mode_info _bsd_fb_dump_mode_info
+#define	fbd_unregister _bsd_fbd_unregister
+#define	fb_list_head _bsd_fb_list_head
+#define	fb_type _bsd_fb_type
 #define	fdt_addrsize_cells _bsd_fdt_addrsize_cells
 #define	fdt_data_get _bsd_fdt_data_get
 #define	fdt_data_to_res _bsd_fdt_data_to_res
@@ -5522,8 +5532,18 @@
 #define	vht80_chan_ranges _bsd_vht80_chan_ranges
 #define	vesagtf_mode _bsd_vesagtf_mode
 #define	vesagtf_mode_params _bsd_vesagtf_mode_params
+#define	vid_allocate _bsd_vid_allocate
+#define	vid_configure _bsd_vid_configure
 #define	videomode_count _bsd_videomode_count
 #define	videomode_list _bsd_videomode_list
+#define	vid_find_adapter _bsd_vid_find_adapter
+#define	vid_get_adapter _bsd_vid_get_adapter
+#define	vid_get_switch _bsd_vid_get_switch
+#define	vid_init_struct _bsd_vid_init_struct
+#define	vid_register _bsd_vid_register
+#define	vid_release _bsd_vid_release
+#define	vidsw _bsd_vidsw
+#define	vid_unregister _bsd_vid_unregister
 #define	vlan_cookie_p _bsd_vlan_cookie_p
 #define	vlan_devat_p _bsd_vlan_devat_p
 #define	vlan_input_p _bsd_vlan_input_p
diff --git a/rtemsbsd/include/machine/vm.h b/rtemsbsd/include/machine/vm.h
index 351b747..b90a4cf 100644
--- a/rtemsbsd/include/machine/vm.h
+++ b/rtemsbsd/include/machine/vm.h
@@ -1,2 +1,3 @@
 #define VM_MEMATTR_DEFAULT 0
 #define VM_MEMATTR_UNCACHEABLE 1
+#define vtophys(a) (a)
diff --git a/rtemsbsd/include/rtems/bsd/local/fb_if.h b/rtemsbsd/include/rtems/bsd/local/fb_if.h
new file mode 100644
index 0000000..29d2b66
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/fb_if.h
@@ -0,0 +1,45 @@
+/*
+ * This file is produced automatically.
+ * Do not modify anything in here by hand.
+ *
+ * Created from source file
+ *   freebsd-org/sys/dev/fb/fb_if.m
+ * with
+ *   makeobjops.awk
+ *
+ * See the source file for legal information
+ */
+
+
+#ifndef _fb_if_h_
+#define _fb_if_h_
+
+/** @brief Unique descriptor for the FB_PIN_MAX() method */
+extern struct kobjop_desc fb_pin_max_desc;
+/** @brief A function implementing the FB_PIN_MAX() method */
+typedef int fb_pin_max_t(device_t dev, int *npins);
+
+static __inline int FB_PIN_MAX(device_t dev, int *npins)
+{
+	kobjop_t _m;
+	int rc;
+	KOBJOPLOOKUP(((kobj_t)dev)->ops,fb_pin_max);
+	rc = ((fb_pin_max_t *) _m)(dev, npins);
+	return (rc);
+}
+
+/** @brief Unique descriptor for the FB_GETINFO() method */
+extern struct kobjop_desc fb_getinfo_desc;
+/** @brief A function implementing the FB_GETINFO() method */
+typedef struct fb_info * fb_getinfo_t(device_t dev);
+
+static __inline struct fb_info * FB_GETINFO(device_t dev)
+{
+	kobjop_t _m;
+	struct fb_info * rc;
+	KOBJOPLOOKUP(((kobj_t)dev)->ops,fb_getinfo);
+	rc = ((fb_getinfo_t *) _m)(dev);
+	return (rc);
+}
+
+#endif /* _fb_if_h_ */
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_fb.h b/rtemsbsd/include/rtems/bsd/local/opt_fb.h
new file mode 100644
index 0000000..e69de29
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_splash.h b/rtemsbsd/include/rtems/bsd/local/opt_splash.h
new file mode 100644
index 0000000..e69de29
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_syscons.h b/rtemsbsd/include/rtems/bsd/local/opt_syscons.h
new file mode 100644
index 0000000..e69de29
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_teken.h b/rtemsbsd/include/rtems/bsd/local/opt_teken.h
new file mode 100644
index 0000000..e69de29
diff --git a/rtemsbsd/local/fb_if.c b/rtemsbsd/local/fb_if.c
new file mode 100644
index 0000000..b56e4a1
--- /dev/null
+++ b/rtemsbsd/local/fb_if.c
@@ -0,0 +1,30 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
+/*
+ * This file is produced automatically.
+ * Do not modify anything in here by hand.
+ *
+ * Created from source file
+ *   freebsd-org/sys/dev/fb/fb_if.m
+ * with
+ *   makeobjops.awk
+ *
+ * See the source file for legal information
+ */
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/kernel.h>
+#include <sys/kobj.h>
+#include <sys/bus.h>
+#include <sys/fbio.h>
+#include <rtems/bsd/local/fb_if.h>
+
+struct kobjop_desc fb_pin_max_desc = {
+	0, { &fb_pin_max_desc, (kobjop_t)kobj_error_method }
+};
+
+struct kobjop_desc fb_getinfo_desc = {
+	0, { &fb_getinfo_desc, (kobjop_t)kobj_error_method }
+};
+




More information about the vc mailing list