summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Kumar Banerjee <vijaykumar9597@gmail.com>2019-08-04 01:49:43 +0530
committerChristian Mauderer <oss@c-mauderer.de>2019-08-11 15:57:54 +0200
commitd7c01f45691d4289c5b8d5cafe9e2776b03731ea (patch)
tree1af44bf7d6cfce60ed3605c20d5d86b4500379c4
parentfa976bc5aa12591f1fb4194bab3f91e02d7cace4 (diff)
downloadrtems-libbsd-d7c01f45691d4289c5b8d5cafe9e2776b03731ea.tar.bz2
fbd: Port to RTEMS
-rw-r--r--Makefile.todo13
-rw-r--r--freebsd/sys/dev/fb/fbd.c4
-rw-r--r--libbsd.py11
-rw-r--r--rtemsbsd/include/bsp/nexus-devices.h3
-rw-r--r--rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h20
-rw-r--r--rtemsbsd/include/machine/vm.h1
-rw-r--r--rtemsbsd/include/rtems/bsd/local/fb_if.h45
-rw-r--r--rtemsbsd/include/rtems/bsd/local/opt_fb.h0
-rw-r--r--rtemsbsd/include/rtems/bsd/local/opt_splash.h0
-rw-r--r--rtemsbsd/include/rtems/bsd/local/opt_syscons.h0
-rw-r--r--rtemsbsd/include/rtems/bsd/local/opt_teken.h0
-rw-r--r--rtemsbsd/local/fb_if.c30
12 files changed, 127 insertions, 0 deletions
diff --git a/Makefile.todo b/Makefile.todo
index cad9b2a0..80d582c0 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 60ce4bc3..871e193c 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 bdc91776..4b729b6a 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 e330679d..ebf1ba13 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 1606543c..94dc2cbd 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 351b7472..b90a4cf4 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 00000000..29d2b66a
--- /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 00000000..e69de29b
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/opt_fb.h
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 00000000..e69de29b
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/opt_splash.h
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 00000000..e69de29b
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/opt_syscons.h
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 00000000..e69de29b
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/opt_teken.h
diff --git a/rtemsbsd/local/fb_if.c b/rtemsbsd/local/fb_if.c
new file mode 100644
index 00000000..b56e4a1d
--- /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 }
+};
+