diff options
Diffstat (limited to 'drivers/video/vesafb.c')
-rw-r--r-- | drivers/video/vesafb.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 9ed1a931dd31..a272592b0373 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { | |||
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int inverse = 0; | 47 | static int inverse = 0; |
48 | static int mtrr = 1; | 48 | static int mtrr = 3; /* default to write-combining */ |
49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ | 49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ |
50 | static int vram_total __initdata = 0; /* Set total amount of memory */ | 50 | static int vram_total __initdata = 0; /* Set total amount of memory */ |
51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ | 51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ |
@@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options) | |||
204 | pmi_setpal=0; | 204 | pmi_setpal=0; |
205 | else if (! strcmp(this_opt, "pmipal")) | 205 | else if (! strcmp(this_opt, "pmipal")) |
206 | pmi_setpal=1; | 206 | pmi_setpal=1; |
207 | else if (! strcmp(this_opt, "mtrr")) | 207 | else if (! strncmp(this_opt, "mtrr:", 5)) |
208 | mtrr=1; | 208 | mtrr = simple_strtoul(this_opt+5, NULL, 0); |
209 | else if (! strcmp(this_opt, "nomtrr")) | 209 | else if (! strcmp(this_opt, "nomtrr")) |
210 | mtrr=0; | 210 | mtrr=0; |
211 | else if (! strncmp(this_opt, "vtotal:", 7)) | 211 | else if (! strncmp(this_opt, "vtotal:", 7)) |
@@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device) | |||
387 | 387 | ||
388 | if (mtrr) { | 388 | if (mtrr) { |
389 | unsigned int temp_size = size_total; | 389 | unsigned int temp_size = size_total; |
390 | /* Find the largest power-of-two */ | 390 | unsigned int type = 0; |
391 | while (temp_size & (temp_size - 1)) | 391 | |
392 | temp_size &= (temp_size - 1); | 392 | switch (mtrr) { |
393 | 393 | case 1: | |
394 | /* Try and find a power of two to add */ | 394 | type = MTRR_TYPE_UNCACHABLE; |
395 | while (temp_size > PAGE_SIZE && | 395 | break; |
396 | mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { | 396 | case 2: |
397 | temp_size >>= 1; | 397 | type = MTRR_TYPE_WRBACK; |
398 | break; | ||
399 | case 3: | ||
400 | type = MTRR_TYPE_WRCOMB; | ||
401 | break; | ||
402 | case 4: | ||
403 | type = MTRR_TYPE_WRTHROUGH; | ||
404 | break; | ||
405 | default: | ||
406 | type = 0; | ||
407 | break; | ||
408 | } | ||
409 | |||
410 | if (type) { | ||
411 | int rc; | ||
412 | |||
413 | /* Find the largest power-of-two */ | ||
414 | while (temp_size & (temp_size - 1)) | ||
415 | temp_size &= (temp_size - 1); | ||
416 | |||
417 | /* Try and find a power of two to add */ | ||
418 | do { | ||
419 | rc = mtrr_add(vesafb_fix.smem_start, temp_size, | ||
420 | type, 1); | ||
421 | temp_size >>= 1; | ||
422 | } while (temp_size >= PAGE_SIZE && rc == -EINVAL); | ||
398 | } | 423 | } |
399 | } | 424 | } |
400 | 425 | ||