Author: jkim
Date: Mon Apr  8 20:45:11 2013
New Revision: 249283
URL: http://svnweb.freebsd.org/changeset/base/249283

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

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

Modified: stable/8/sys/dev/fb/vesa.c
==============================================================================
--- stable/8/sys/dev/fb/vesa.c  Mon Apr  8 20:43:53 2013        (r249282)
+++ stable/8/sys/dev/fb/vesa.c  Mon Apr  8 20:45:11 2013        (r249283)
@@ -73,6 +73,8 @@ struct adp_state {
 };
 typedef struct adp_state adp_state_t;
 
+static size_t vesa_vmem_max;
+
 /* VESA video adapter */
 static video_adapter_t *vesa_adp = NULL;
 static ssize_t vesa_state_buf_size = -1;
@@ -914,6 +916,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) {
@@ -1250,8 +1254,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...
@@ -1287,8 +1290,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");
@@ -1323,7 +1325,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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to