From owner-freebsd-current@FreeBSD.ORG Fri Feb 20 08:28:37 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DEA1B229 for ; Fri, 20 Feb 2015 08:28:36 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6974867E for ; Fri, 20 Feb 2015 08:28:35 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id F36CC1FE022; Fri, 20 Feb 2015 09:28:31 +0100 (CET) Message-ID: <54E6F060.2010301@selasky.org> Date: Fri, 20 Feb 2015 09:29:20 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Shawn Webb , freebsd-current@freebsd.org Subject: Re: Pluggable frame buffer devices References: <54E11A57.3030105@selasky.org> <5013637.Hs60HQbBR0@shawnwebb-laptop> <1963872.pLReSBKNjx@shawnwebb-laptop> In-Reply-To: <1963872.pLReSBKNjx@shawnwebb-laptop> Content-Type: multipart/mixed; boundary="------------020208060106010008060204" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2015 08:28:37 -0000 This is a multi-part message in MIME format. --------------020208060106010008060204 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 02/20/15 02:15, Shawn Webb wrote: > On Thursday, February 19, 2015 07:04:50 PM Shawn Webb wrote: >> On Sunday, February 15, 2015 11:14:47 PM Hans Petter Selasky wrote: >>> Hi, >>> >>> I've added support for USB display link adapters to FreeBSD-11-current, >>> but the kernel panics once "vt_fb_attach(info)" is called from >>> "fbd_register(struct fb_info* info)" when the USB device is plugged or >>> udl.ko is loaded. Is this a known issue? >>> >>> REF: https://svnweb.freebsd.org/base/head/sys/dev/usb/video/udl.c >>> >>> --HPS >> >> I just bought a DisplayLink adapter that's compatible. Compiling a new >> kernel with device udl brings this error: >> Hi, You need to also build the "sys/modules/videomode" and install and kldload. Does your device need a power supply? Can you plug the device through an external USB HUB after boot? Also you need some VT patches, before it will attach to VT which I can send you. See attachment. Beware the unplugging the device is not supported. It will crash / panic which needs to be resolved. --HPS --------------020208060106010008060204 Content-Type: text/x-diff; name="video.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="video.diff" diff --git a/sys/dev/fb/fbd.c b/sys/dev/fb/fbd.c index f9b4d8e..11cb30e 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,14 +170,21 @@ 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) { + if (offset >= info->fb_size) + return (EINVAL); + if (info->fb_pbase == 0) { + /* + * If there is no physical address + * assume there is a virtual address + * which is mappable: + */ + *paddr = vtophys((uint8_t *)info->fb_vbase + offset); + } else { *paddr = info->fb_pbase + offset; - return (0); } - return (EINVAL); + return (0); } static int @@ -354,5 +364,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 5a0fe4f..bd1b881 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -37,10 +37,14 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include +#include +#include + static struct vt_driver vt_fb_driver = { .vd_name = "fb", .vd_init = vt_fb_init, @@ -135,7 +139,7 @@ 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; + *paddr = vtophys(info->fb_vbase + offset); #ifdef VM_MEMATTR_WRITE_COMBINING *memattr = VM_MEMATTR_WRITE_COMBINING; #endif @@ -423,7 +427,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) { --------------020208060106010008060204--