[PATCH 6/6] fbd : Port to RTEMS

Christian Mauderer list at c-mauderer.de
Sun Jun 30 16:05:48 UTC 2019


On 30/06/2019 17:29, Vijay Kumar Banerjee wrote:
> ---
>  freebsd/sys/dev/fb/fbd.c                      | 11 ++++++
>  libbsd.py                                     |  4 +++
>  rtemsbsd/include/bsp/nexus-devices.h          |  1 +
>  .../machine/rtems-bsd-kernel-namespace.h      | 35 +++++++++++++++++++
>  rtemsbsd/include/rtems/bsd/local/opt_fb.h     |  0
>  5 files changed, 51 insertions(+)
>  create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_fb.h
> 
> diff --git a/freebsd/sys/dev/fb/fbd.c b/freebsd/sys/dev/fb/fbd.c
> index 60ce4bc3..1d303e67 100644
> --- a/freebsd/sys/dev/fb/fbd.c
> +++ b/freebsd/sys/dev/fb/fbd.c
> @@ -82,7 +82,9 @@ static d_close_t	fb_close;
>  static d_read_t		fb_read;
>  static d_write_t	fb_write;
>  static d_ioctl_t	fb_ioctl;
> +#ifndef __rtems__
>  static d_mmap_t		fb_mmap;
> +#endif /* __rtems__ */

Like discussed and like you most likely will tell in your summary: Most
likely you'll need mmap or an alternative read / write implementation
because read / write is quite empty for the fbd. I don't think that we
should merge anything before that is done although of course it is great
that this much already works and you get an fb0 device.

>  
>  static struct cdevsw fb_cdevsw = {
>  	.d_version =	D_VERSION,
> @@ -92,7 +94,9 @@ static struct cdevsw fb_cdevsw = {
>  	.d_read =	fb_read,
>  	.d_write =	fb_write,
>  	.d_ioctl =	fb_ioctl,
> +#ifndef __rtems__
>  	.d_mmap =	fb_mmap,
> +#endif /* __rtems__ */
>  	.d_name =	"fb",
>  };
>  
> @@ -257,11 +261,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 +280,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);
>  		}
> @@ -366,6 +374,9 @@ driver_t fbd_driver = {
>  devclass_t	fbd_devclass;
>  
>  DRIVER_MODULE(fbd, fb, fbd_driver, fbd_devclass, 0, 0);
> +#ifdef __rtems__
> +DRIVER_MODULE(fbd, am335x_lcd, fbd_driver, fbd_devclass, 0, 0);

Why is this necessary in this case? I don't see a similar connection in
FreeBSD.

> +#endif /* __rtems__ */
>  DRIVER_MODULE(fbd, drmn, fbd_driver, fbd_devclass, 0, 0);
>  DRIVER_MODULE(fbd, udl, fbd_driver, fbd_devclass, 0, 0);
>  MODULE_VERSION(fbd, 1);
> diff --git a/libbsd.py b/libbsd.py
> index bce1d268..43b06e1b 100644
> --- a/libbsd.py
> +++ b/libbsd.py
> @@ -807,6 +807,8 @@ class display(builder.Module):
>                  'sys/sys/fbio.h',
>                  'sys/sys/consio.h',
>                  'sys/sys/terminal.h',
> +                'sys/dev/vt/hw/fb/vt_fb.h',
> +                'sys/dev/vt/colors/vt_termcolors.h',
>              ]
>          )
>          self.addKernelSpaceSourceFiles(
> @@ -822,6 +824,8 @@ class display(builder.Module):
>                  'sys/arm/ti/am335x/am335x_lcd.c',
>                  'sys/arm/ti/am335x/am335x_pwmss.c',
>                  'sys/arm/ti/am335x/am335x_ecap.c',
> +                'sys/dev/fb/fb.c',
> +                'sys/dev/fb/fbd.c',
>              ],
>              mm.generator['source']()
>          )
> diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
> index 2c718295..6765b10d 100644
> --- a/rtemsbsd/include/bsp/nexus-devices.h
> +++ b/rtemsbsd/include/bsp/nexus-devices.h
> @@ -63,6 +63,7 @@ SYSINIT_DRIVER_REFERENCE(cpsw, cpswss);
>  SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
>  SYSINIT_DRIVER_REFERENCE(am335x_lcd, simplebus);
>  SYSINIT_DRIVER_REFERENCE(am335x_pwmss, simplebus);
> +SYSINIT_DRIVER_REFERENCE(fbd, am335x_lcd);
>  SYSINIT_DRIVER_REFERENCE(rtems_i2c, simplebus);
>  SYSINIT_DRIVER_REFERENCE(ofw_iicbus, rtems_i2c);
>  SYSINIT_DRIVER_REFERENCE(iic, iicbus);
> diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
> index 3951da79..d796d3d1 100644
> --- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
> +++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
> @@ -1266,6 +1266,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
> @@ -5515,8 +5525,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
> @@ -5533,6 +5553,21 @@
>  #define	vsnprintf _bsd_vsnprintf
>  #define	vsnrprintf _bsd_vsnrprintf
>  #define	vsprintf _bsd_vsprintf
> +#define	vt_fb_attach _bsd_vt_fb_attach
> +#define	vt_fb_bitblt_bitmap _bsd_vt_fb_bitblt_bitmap
> +#define	vt_fb_bitblt_text _bsd_vt_fb_bitblt_text
> +#define	vt_fb_blank _bsd_vt_fb_blank
> +#define	vt_fb_detach _bsd_vt_fb_detach
> +#define	vt_fb_drawrect _bsd_vt_fb_drawrect
> +#define	vt_fb_fini _bsd_vt_fb_fini
> +#define	vt_fb_init _bsd_vt_fb_init
> +#define	vt_fb_invalidate_text _bsd_vt_fb_invalidate_text
> +#define	vt_fb_ioctl _bsd_vt_fb_ioctl
> +#define	vt_fb_mmap _bsd_vt_fb_mmap
> +#define	vt_fb_postswitch _bsd_vt_fb_postswitch
> +#define	vt_fb_resume _bsd_vt_fb_resume
> +#define	vt_fb_setpixel _bsd_vt_fb_setpixel
> +#define	vt_fb_suspend _bsd_vt_fb_suspend
>  #define	wakeup _bsd_wakeup
>  #define	wakeup_one _bsd_wakeup_one
>  #define	window_deflate _bsd_window_deflate
> 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
> 



More information about the devel mailing list