svn commit: r249282 - stable/9/sys/dev/fb

Jung-uk Kim jkim at FreeBSD.org
Mon Apr 8 20:43:54 UTC 2013


Author: jkim
Date: Mon Apr  8 20:43:53 2013
New Revision: 249282
URL: http://svnweb.freebsd.org/changeset/base/249282

Log:
  MFC:	r248799
  
  Limit the amount of video memory we map for the driver to the maximum value.

Modified:
  stable/9/sys/dev/fb/vesa.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/fb/vesa.c
==============================================================================
--- stable/9/sys/dev/fb/vesa.c	Mon Apr  8 20:33:51 2013	(r249281)
+++ stable/9/sys/dev/fb/vesa.c	Mon Apr  8 20:43:53 2013	(r249282)
@@ -89,6 +89,7 @@ static u_char *vesa_palette;
 static uint32_t vesa_palette_offs;
 
 static void *vesa_vmem_buf;
+static size_t vesa_vmem_max;
 
 static void *vesa_bios;
 static uint32_t vesa_bios_offs;
@@ -927,6 +928,8 @@ vesa_bios_init(void)
 #endif
 			continue;
 		}
+		if (bsize > vesa_vmem_max)
+			vesa_vmem_max = bsize;
 
 		/* expand the array if necessary */
 		if (modes >= vesa_vmode_max) {
@@ -1297,8 +1300,7 @@ vesa_set_mode(video_adapter_t *adp, int 
 			}
 			int10_set_mode(adp->va_initial_bios_mode);
 			if (adp->va_info.vi_flags & V_INFO_LINEAR)
-				pmap_unmapdev(adp->va_buffer,
-				    vesa_adp_info->v_memsize * 64 * 1024);
+				pmap_unmapdev(adp->va_buffer, vesa_vmem_max);
 			/* 
 			 * Once (*prevvidsw->get_info)() succeeded, 
 			 * (*prevvidsw->set_mode)() below won't fail...
@@ -1336,8 +1338,7 @@ vesa_set_mode(video_adapter_t *adp, int 
 		adp->va_flags |= V_ADP_DAC8;
 
 	if (adp->va_info.vi_flags & V_INFO_LINEAR)
-		pmap_unmapdev(adp->va_buffer,
-		    vesa_adp_info->v_memsize * 64 * 1024);
+		pmap_unmapdev(adp->va_buffer, vesa_vmem_max);
 
 #if VESA_DEBUG > 0
 	printf("VESA: mode set!\n");
@@ -1372,7 +1373,7 @@ vesa_set_mode(video_adapter_t *adp, int 
 #endif
 		vesa_adp->va_buffer =
 		    (vm_offset_t)pmap_mapdev_attr(info.vi_buffer,
-		    vesa_adp_info->v_memsize * 64 * 1024, PAT_WRITE_COMBINING);
+		    vesa_vmem_max, PAT_WRITE_COMBINING);
 		vesa_adp->va_window = vesa_adp->va_buffer;
 		vesa_adp->va_window_size = info.vi_buffer_size / info.vi_planes;
 		vesa_adp->va_window_gran = info.vi_buffer_size / info.vi_planes;


More information about the svn-src-stable mailing list