[Midnightbsd-cvs] src [9061] trunk/sys/dev/fb/vesa.c: limit video memory mapped to max

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Oct 1 06:10:23 EDT 2016


Revision: 9061
          http://svnweb.midnightbsd.org/src/?rev=9061
Author:   laffer1
Date:     2016-10-01 06:10:23 -0400 (Sat, 01 Oct 2016)
Log Message:
-----------
limit video memory mapped to max

Modified Paths:
--------------
    trunk/sys/dev/fb/vesa.c

Modified: trunk/sys/dev/fb/vesa.c
===================================================================
--- trunk/sys/dev/fb/vesa.c	2016-10-01 10:09:53 UTC (rev 9060)
+++ trunk/sys/dev/fb/vesa.c	2016-10-01 10:10:23 UTC (rev 9061)
@@ -89,6 +89,7 @@
 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 @@
 #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 @@
 			}
 			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 @@
 		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 @@
 #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 Midnightbsd-cvs mailing list