From owner-svn-src-all@FreeBSD.ORG Fri Feb 5 18:00:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 941F51065695; Fri, 5 Feb 2010 18:00:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8392F8FC66; Fri, 5 Feb 2010 18:00:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o15I0OKt012543; Fri, 5 Feb 2010 18:00:24 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o15I0OMj012541; Fri, 5 Feb 2010 18:00:24 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201002051800.o15I0OMj012541@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 5 Feb 2010 18:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203530 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2010 18:00:24 -0000 Author: jkim Date: Fri Feb 5 18:00:24 2010 New Revision: 203530 URL: http://svn.freebsd.org/changeset/base/203530 Log: Replace some homegrown functions with better/correct ones. Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Fri Feb 5 17:20:48 2010 (r203529) +++ head/sys/dev/fb/vesa.c Fri Feb 5 18:00:24 2010 (r203530) @@ -199,25 +199,11 @@ static int vesa_translate_flags(u_int16_ static int vesa_translate_mmodel(u_int8_t vmodel); static int vesa_bios_init(void); static void vesa_clear_modes(video_info_t *info, int color); -static vm_offset_t vesa_map_buffer(u_int paddr, size_t size); -static void vesa_unmap_buffer(vm_offset_t vaddr, size_t size); #if 0 static int vesa_get_origin(video_adapter_t *adp, off_t *offset); #endif -static void -dump_buffer(u_char *buf, size_t len) -{ - int i; - - for(i = 0; i < len;) { - printf("%02x ", buf[i]); - if ((++i % 16) == 0) - printf("\n"); - } -} - /* INT 10 BIOS calls */ static int int10_set_mode(int mode) @@ -788,7 +774,7 @@ vesa_bios_init(void) vesa_adp_info = &buf; if (bootverbose) { printf("VESA: information block\n"); - dump_buffer((u_char *)&buf, sizeof(buf)); + hexdump(&buf, sizeof(buf), NULL, HD_OMIT_CHARS); } vers = buf.v_version = le16toh(buf.v_version); @@ -1032,31 +1018,6 @@ vesa_clear_modes(video_info_t *info, int } } -static vm_offset_t -vesa_map_buffer(u_int paddr, size_t size) -{ - vm_offset_t vaddr; - u_int off; - - off = paddr - trunc_page(paddr); - vaddr = (vm_offset_t)pmap_mapdev_attr(paddr - off, size + off, - PAT_WRITE_COMBINING); -#if VESA_DEBUG > 1 - printf("vesa_map_buffer: paddr:%x vaddr:%tx size:%zx off:%x\n", - paddr, vaddr, size, off); -#endif - return (vaddr + off); -} - -static void -vesa_unmap_buffer(vm_offset_t vaddr, size_t size) -{ -#if VESA_DEBUG > 1 - printf("vesa_unmap_buffer: vaddr:%tx size:%zx\n", vaddr, size); -#endif - kmem_free(kernel_map, vaddr, size); -} - /* entry points */ static int @@ -1246,8 +1207,8 @@ vesa_set_mode(video_adapter_t *adp, int (*prevvidsw->get_info)(adp, mode, &info) == 0) { int10_set_mode(adp->va_initial_bios_mode); if (adp->va_info.vi_flags & V_INFO_LINEAR) - vesa_unmap_buffer(adp->va_buffer, - vesa_adp_info->v_memsize*64*1024); + pmap_unmapdev(adp->va_buffer, + vesa_adp_info->v_memsize * 64 * 1024); /* * Once (*prevvidsw->get_info)() succeeded, * (*prevvidsw->set_mode)() below won't fail... @@ -1278,8 +1239,8 @@ vesa_set_mode(video_adapter_t *adp, int vesa_bios_set_dac(8); if (adp->va_info.vi_flags & V_INFO_LINEAR) - vesa_unmap_buffer(adp->va_buffer, - vesa_adp_info->v_memsize*64*1024); + pmap_unmapdev(adp->va_buffer, + vesa_adp_info->v_memsize * 64 * 1024); #if VESA_DEBUG > 0 printf("VESA: mode set!\n"); @@ -1295,8 +1256,8 @@ vesa_set_mode(video_adapter_t *adp, int printf("VESA: setting up LFB\n"); #endif vesa_adp->va_buffer = - vesa_map_buffer(info.vi_buffer, - vesa_adp_info->v_memsize*64*1024); + (vm_offset_t)pmap_mapdev_attr(info.vi_buffer, + vesa_adp_info->v_memsize * 64 * 1024, PAT_WRITE_COMBINING); vesa_adp->va_buffer_size = info.vi_buffer_size; vesa_adp->va_window = vesa_adp->va_buffer; vesa_adp->va_window_size = info.vi_buffer_size/info.vi_planes;