[PATCH v2 6/8] fbd: Port to RTEMS

Christian Mauderer list at c-mauderer.de
Sat Aug 3 11:58:55 UTC 2019


Hello Vijay,

this commit doesn't compile on it's own. Please make sure that every
commit can be compiled. If someone wants to use git bisect for searching
for errors that is essential.

````
Waf: Entering directory
`/home/christian/rtems/rtems-bbb/libs/rtems-libbsd/build/arm-rtems5-beagleboneblack-noIPSec'
[1419/2153] Compiling freebsd/sys/dev/fb/fb.c
../../freebsd/sys/dev/fb/fb.c:46:10: fatal error: sys/fbio.h: No such
file or directory
 #include <sys/fbio.h>
          ^~~~~~~~~~~~
compilation terminated.

[1618/2153] Compiling freebsd/sys/dev/fb/fbd.c
../../freebsd/sys/dev/fb/fbd.c:51:10: fatal error: sys/fbio.h: No such
file or directory
 #include <sys/fbio.h>
          ^~~~~~~~~~~~
compilation terminated.

[1971/2153] Compiling rtemsbsd/local/fb_if.c
../../rtemsbsd/local/fb_if.c:20:10: fatal error: sys/fbio.h: No such
file or directory
 #include <sys/fbio.h>
          ^~~~~~~~~~~~
compilation terminated.

Waf: Leaving directory
`/home/christian/rtems/rtems-bbb/libs/rtems-libbsd/build/arm-rtems5-beagleboneblack-noIPSec'
Build failed
````

Best regards

Christian

On 02/08/2019 23:00, Vijay Kumar Banerjee wrote:
> ---
>  Makefile.todo                                 | 13 ++++++
>  freebsd/sys/dev/fb/fbd.c                      |  4 ++
>  libbsd.py                                     |  8 ++++
>  rtemsbsd/include/bsp/nexus-devices.h          |  3 ++
>  .../machine/rtems-bsd-kernel-namespace.h      | 21 ++++++++-
>  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/local/fb_if.c                        | 30 +++++++++++++
>  9 files changed, 124 insertions(+), 1 deletion(-)
>  create mode 100644 rtemsbsd/include/rtems/bsd/local/fb_if.h
>  create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_fb.h
>  create mode 100644 rtemsbsd/local/fb_if.c
> 
> 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..f94f7b3d 100644
> --- a/libbsd.py
> +++ b/libbsd.py
> @@ -797,6 +797,11 @@ 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',
>              ]
>          )
>          self.addKernelSpaceSourceFiles(
> @@ -806,6 +811,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 +820,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..ee643d59 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
> @@ -5519,11 +5529,20 @@
>  #define	uuidcmp _bsd_uuidcmp
>  #define	uuid_ether_add _bsd_uuid_ether_add
>  #define	uuid_ether_del _bsd_uuid_ether_del
> -#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
> 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 }
> +};
> +
> 



More information about the devel mailing list