diff --git a/sys/dev/fb/fbd.c b/sys/dev/fb/fbd.c index 6b7b7316bf57..b7e45040f65e 100644 --- a/sys/dev/fb/fbd.c +++ b/sys/dev/fb/fbd.c @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include "fb_if.h" LIST_HEAD(fb_list_head_t, fb_list_entry) fb_list_head = @@ -167,11 +170,14 @@ fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, info = dev->si_drv1; - if ((info->fb_flags & FB_FLAG_NOMMAP) || info->fb_pbase == 0) + if (info->fb_flags & FB_FLAG_NOMMAP) return (ENODEV); - if (offset < info->fb_size) { - *paddr = info->fb_pbase + offset; + if (offset >= 0 && offset < info->fb_size) { + if (info->fb_pbase == 0) + *paddr = vtophys((uint8_t *)info->fb_vbase + offset); + else + *paddr = info->fb_pbase + offset; return (0); } return (EINVAL); @@ -356,5 +362,6 @@ devclass_t fbd_devclass; DRIVER_MODULE(fbd, fb, fbd_driver, fbd_devclass, 0, 0); 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/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index 5d38cc7dea0d..40f56fc097e8 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + static struct vt_driver vt_fb_driver = { .vd_name = "fb", .vd_init = vt_fb_init, @@ -136,10 +139,14 @@ vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr, return (ENODEV); if (offset >= 0 && offset < info->fb_size) { - *paddr = info->fb_pbase + offset; - #ifdef VM_MEMATTR_WRITE_COMBINING - *memattr = VM_MEMATTR_WRITE_COMBINING; - #endif + if (info->fb_pbase == 0) { + *paddr = vtophys((uint8_t *)info->fb_vbase + offset); + } else { + *paddr = info->fb_pbase + offset; +#ifdef VM_MEMATTR_WRITE_COMBINING + *memattr = VM_MEMATTR_WRITE_COMBINING; +#endif + } return (0); } @@ -425,7 +432,7 @@ vt_fb_init(struct vt_device *vd) if (info->fb_size == 0) return (CN_DEAD); - if (info->fb_pbase == 0) + if (info->fb_pbase == 0 && info->fb_vbase == 0) info->fb_flags |= FB_FLAG_NOMMAP; if (info->fb_cmsize <= 0) { diff --git a/sys/powerpc/ps3/ps3_syscons.c b/sys/powerpc/ps3/ps3_syscons.c index 521690c39446..4edf56eb513f 100644 --- a/sys/powerpc/ps3/ps3_syscons.c +++ b/sys/powerpc/ps3/ps3_syscons.c @@ -191,7 +191,6 @@ ps3fb_init(struct vt_device *vd) L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 1, 0, 0, 0); vt_fb_init(vd); - sc->fb_info.fb_flags &= ~FB_FLAG_NOMMAP; /* Set wrongly by vt_fb_init */ return (CN_INTERNAL); }