aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-06-22 17:47:32 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-22 18:05:58 -0400
commit4f1bcaf094ccc512c23e10104c05a6f8e5b7a9e4 (patch)
tree883c6ece20a28f86eb73cd329bb9d4674b1e5480
parentd702ccb342e49f7591df5a87c3857c698183b0fa (diff)
[PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use
VGA_MAP_MEM translates to ioremap() on some architectures. It makes sense to do this to vga_vram_base, because we're going to access memory between vga_vram_base and vga_vram_end. But it doesn't really make sense to map starting at vga_vram_end, because we aren't going to access memory starting there. On ia64, which always has to be different, ioremapping vga_vram_end gives you something completely incompatible with ioremapped vga_vram_start, so vga_vram_size ends up being nonsense. As a bonus, we often know the size up front, so we can use ioremap() correctly, rather than giving it a zero size. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/console/mdacon.c2
-rw-r--r--drivers/video/console/vgacon.c19
-rw-r--r--drivers/video/vga16fb.c2
-rw-r--r--include/asm-alpha/vga.h2
-rw-r--r--include/asm-arm/vga.h2
-rw-r--r--include/asm-i386/vga.h2
-rw-r--r--include/asm-ia64/vga.h2
-rw-r--r--include/asm-m32r/vga.h2
-rw-r--r--include/asm-mips/vga.h2
-rw-r--r--include/asm-powerpc/vga.h4
-rw-r--r--include/asm-sparc64/vga.h2
-rw-r--r--include/asm-x86_64/vga.h2
-rw-r--r--include/asm-xtensa/vga.h2
13 files changed, 22 insertions, 23 deletions
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 989e4d49e5bb..7f939d066a5a 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -313,8 +313,8 @@ static const char __init *mdacon_startup(void)
313 mda_num_columns = 80; 313 mda_num_columns = 80;
314 mda_num_lines = 25; 314 mda_num_lines = 25;
315 315
316 mda_vram_base = VGA_MAP_MEM(0xb0000);
317 mda_vram_len = 0x01000; 316 mda_vram_len = 0x01000;
317 mda_vram_base = VGA_MAP_MEM(0xb0000, mda_vram_len);
318 318
319 mda_index_port = 0x3b4; 319 mda_index_port = 0x3b4;
320 mda_value_port = 0x3b5; 320 mda_value_port = 0x3b5;
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index d5a04b68c4d4..e64d42e2449e 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -391,7 +391,7 @@ static const char __init *vgacon_startup(void)
391 static struct resource ega_console_resource = 391 static struct resource ega_console_resource =
392 { "ega", 0x3B0, 0x3BF }; 392 { "ega", 0x3B0, 0x3BF };
393 vga_video_type = VIDEO_TYPE_EGAM; 393 vga_video_type = VIDEO_TYPE_EGAM;
394 vga_vram_end = 0xb8000; 394 vga_vram_size = 0x8000;
395 display_desc = "EGA+"; 395 display_desc = "EGA+";
396 request_resource(&ioport_resource, 396 request_resource(&ioport_resource,
397 &ega_console_resource); 397 &ega_console_resource);
@@ -401,7 +401,7 @@ static const char __init *vgacon_startup(void)
401 static struct resource mda2_console_resource = 401 static struct resource mda2_console_resource =
402 { "mda", 0x3BF, 0x3BF }; 402 { "mda", 0x3BF, 0x3BF };
403 vga_video_type = VIDEO_TYPE_MDA; 403 vga_video_type = VIDEO_TYPE_MDA;
404 vga_vram_end = 0xb2000; 404 vga_vram_size = 0x2000;
405 display_desc = "*MDA"; 405 display_desc = "*MDA";
406 request_resource(&ioport_resource, 406 request_resource(&ioport_resource,
407 &mda1_console_resource); 407 &mda1_console_resource);
@@ -418,7 +418,7 @@ static const char __init *vgacon_startup(void)
418 if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { 418 if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) {
419 int i; 419 int i;
420 420
421 vga_vram_end = 0xc0000; 421 vga_vram_size = 0x8000;
422 422
423 if (!ORIG_VIDEO_ISVGA) { 423 if (!ORIG_VIDEO_ISVGA) {
424 static struct resource ega_console_resource 424 static struct resource ega_console_resource
@@ -443,7 +443,7 @@ static const char __init *vgacon_startup(void)
443 * and COE=1 isn't necessarily a good idea) 443 * and COE=1 isn't necessarily a good idea)
444 */ 444 */
445 vga_vram_base = 0xa0000; 445 vga_vram_base = 0xa0000;
446 vga_vram_end = 0xb0000; 446 vga_vram_size = 0x10000;
447 outb_p(6, VGA_GFX_I); 447 outb_p(6, VGA_GFX_I);
448 outb_p(6, VGA_GFX_D); 448 outb_p(6, VGA_GFX_D);
449#endif 449#endif
@@ -475,7 +475,7 @@ static const char __init *vgacon_startup(void)
475 static struct resource cga_console_resource = 475 static struct resource cga_console_resource =
476 { "cga", 0x3D4, 0x3D5 }; 476 { "cga", 0x3D4, 0x3D5 };
477 vga_video_type = VIDEO_TYPE_CGA; 477 vga_video_type = VIDEO_TYPE_CGA;
478 vga_vram_end = 0xba000; 478 vga_vram_size = 0x2000;
479 display_desc = "*CGA"; 479 display_desc = "*CGA";
480 request_resource(&ioport_resource, 480 request_resource(&ioport_resource,
481 &cga_console_resource); 481 &cga_console_resource);
@@ -483,9 +483,8 @@ static const char __init *vgacon_startup(void)
483 } 483 }
484 } 484 }
485 485
486 vga_vram_base = VGA_MAP_MEM(vga_vram_base); 486 vga_vram_base = VGA_MAP_MEM(vga_vram_base, vga_vram_size);
487 vga_vram_end = VGA_MAP_MEM(vga_vram_end); 487 vga_vram_end = vga_vram_base + vga_vram_size;
488 vga_vram_size = vga_vram_end - vga_vram_base;
489 488
490 /* 489 /*
491 * Find out if there is a graphics card present. 490 * Find out if there is a graphics card present.
@@ -1020,14 +1019,14 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
1020 char *charmap; 1019 char *charmap;
1021 1020
1022 if (vga_video_type != VIDEO_TYPE_EGAM) { 1021 if (vga_video_type != VIDEO_TYPE_EGAM) {
1023 charmap = (char *) VGA_MAP_MEM(colourmap); 1022 charmap = (char *) VGA_MAP_MEM(colourmap, 0);
1024 beg = 0x0e; 1023 beg = 0x0e;
1025#ifdef VGA_CAN_DO_64KB 1024#ifdef VGA_CAN_DO_64KB
1026 if (vga_video_type == VIDEO_TYPE_VGAC) 1025 if (vga_video_type == VIDEO_TYPE_VGAC)
1027 beg = 0x06; 1026 beg = 0x06;
1028#endif 1027#endif
1029 } else { 1028 } else {
1030 charmap = (char *) VGA_MAP_MEM(blackwmap); 1029 charmap = (char *) VGA_MAP_MEM(blackwmap, 0);
1031 beg = 0x0a; 1030 beg = 0x0a;
1032 } 1031 }
1033 1032
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index f3f16fd9f231..4fd2a272e03d 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -1351,7 +1351,7 @@ static int __init vga16fb_probe(struct device *device)
1351 } 1351 }
1352 1352
1353 /* XXX share VGA_FB_PHYS and I/O region with vgacon and others */ 1353 /* XXX share VGA_FB_PHYS and I/O region with vgacon and others */
1354 info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS); 1354 info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS, 0);
1355 1355
1356 if (!info->screen_base) { 1356 if (!info->screen_base) {
1357 printk(KERN_ERR "vga16fb: unable to map device\n"); 1357 printk(KERN_ERR "vga16fb: unable to map device\n");
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h
index 8ca4f6b2da19..ed06f59b544d 100644
--- a/include/asm-alpha/vga.h
+++ b/include/asm-alpha/vga.h
@@ -46,6 +46,6 @@ extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count);
46#define vga_readb(a) readb((u8 __iomem *)(a)) 46#define vga_readb(a) readb((u8 __iomem *)(a))
47#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) 47#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a))
48 48
49#define VGA_MAP_MEM(x) ((unsigned long) ioremap(x, 0)) 49#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s))
50 50
51#endif 51#endif
diff --git a/include/asm-arm/vga.h b/include/asm-arm/vga.h
index 926e5ee128e9..1e0b913c3d71 100644
--- a/include/asm-arm/vga.h
+++ b/include/asm-arm/vga.h
@@ -4,7 +4,7 @@
4#include <asm/hardware.h> 4#include <asm/hardware.h>
5#include <asm/io.h> 5#include <asm/io.h>
6 6
7#define VGA_MAP_MEM(x) (PCIMEM_BASE + (x)) 7#define VGA_MAP_MEM(x,s) (PCIMEM_BASE + (x))
8 8
9#define vga_readb(x) (*((volatile unsigned char *)x)) 9#define vga_readb(x) (*((volatile unsigned char *)x))
10#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x)) 10#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x))
diff --git a/include/asm-i386/vga.h b/include/asm-i386/vga.h
index ef0c0e50cc95..0ecf68ac03aa 100644
--- a/include/asm-i386/vga.h
+++ b/include/asm-i386/vga.h
@@ -12,7 +12,7 @@
12 * access the videoram directly without any black magic. 12 * access the videoram directly without any black magic.
13 */ 13 */
14 14
15#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 15#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
16 16
17#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
18#define vga_writeb(x,y) (*(y) = (x)) 18#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-ia64/vga.h b/include/asm-ia64/vga.h
index 091177cda223..02184ecd8208 100644
--- a/include/asm-ia64/vga.h
+++ b/include/asm-ia64/vga.h
@@ -17,7 +17,7 @@
17extern unsigned long vga_console_iobase; 17extern unsigned long vga_console_iobase;
18extern unsigned long vga_console_membase; 18extern unsigned long vga_console_membase;
19 19
20#define VGA_MAP_MEM(x) ((unsigned long) ioremap_nocache(vga_console_membase + (x), 0)) 20#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap_nocache(vga_console_membase + (x), s))
21 21
22#define vga_readb(x) (*(x)) 22#define vga_readb(x) (*(x))
23#define vga_writeb(x,y) (*(y) = (x)) 23#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-m32r/vga.h b/include/asm-m32r/vga.h
index d0f4b6eed7a3..533163447cc9 100644
--- a/include/asm-m32r/vga.h
+++ b/include/asm-m32r/vga.h
@@ -14,7 +14,7 @@
14 * access the videoram directly without any black magic. 14 * access the videoram directly without any black magic.
15 */ 15 */
16 16
17#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 17#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
18 18
19#define vga_readb(x) (*(x)) 19#define vga_readb(x) (*(x))
20#define vga_writeb(x,y) (*(y) = (x)) 20#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-mips/vga.h b/include/asm-mips/vga.h
index 34755c0a6398..c1dd0b10bc27 100644
--- a/include/asm-mips/vga.h
+++ b/include/asm-mips/vga.h
@@ -13,7 +13,7 @@
13 * access the videoram directly without any black magic. 13 * access the videoram directly without any black magic.
14 */ 14 */
15 15
16#define VGA_MAP_MEM(x) (0xb0000000L + (unsigned long)(x)) 16#define VGA_MAP_MEM(x,s) (0xb0000000L + (unsigned long)(x))
17 17
18#define vga_readb(x) (*(x)) 18#define vga_readb(x) (*(x))
19#define vga_writeb(x,y) (*(y) = (x)) 19#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-powerpc/vga.h b/include/asm-powerpc/vga.h
index eadaf2f3d032..a2eac409c1ec 100644
--- a/include/asm-powerpc/vga.h
+++ b/include/asm-powerpc/vga.h
@@ -41,9 +41,9 @@ static inline u16 scr_readw(volatile const u16 *addr)
41extern unsigned long vgacon_remap_base; 41extern unsigned long vgacon_remap_base;
42 42
43#ifdef __powerpc64__ 43#ifdef __powerpc64__
44#define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0)) 44#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
45#else 45#else
46#define VGA_MAP_MEM(x) (x + vgacon_remap_base) 46#define VGA_MAP_MEM(x,s) (x + vgacon_remap_base)
47#endif 47#endif
48 48
49#define vga_readb(x) (*(x)) 49#define vga_readb(x) (*(x))
diff --git a/include/asm-sparc64/vga.h b/include/asm-sparc64/vga.h
index 9c57eb363b40..c69d5b2ba19a 100644
--- a/include/asm-sparc64/vga.h
+++ b/include/asm-sparc64/vga.h
@@ -28,6 +28,6 @@ static inline u16 scr_readw(const u16 *addr)
28 return *addr; 28 return *addr;
29} 29}
30 30
31#define VGA_MAP_MEM(x) (x) 31#define VGA_MAP_MEM(x,s) (x)
32 32
33#endif 33#endif
diff --git a/include/asm-x86_64/vga.h b/include/asm-x86_64/vga.h
index ef0c0e50cc95..0ecf68ac03aa 100644
--- a/include/asm-x86_64/vga.h
+++ b/include/asm-x86_64/vga.h
@@ -12,7 +12,7 @@
12 * access the videoram directly without any black magic. 12 * access the videoram directly without any black magic.
13 */ 13 */
14 14
15#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 15#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
16 16
17#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
18#define vga_writeb(x,y) (*(y) = (x)) 18#define vga_writeb(x,y) (*(y) = (x))
diff --git a/include/asm-xtensa/vga.h b/include/asm-xtensa/vga.h
index 23d82f6acb57..1fd8cab3a297 100644
--- a/include/asm-xtensa/vga.h
+++ b/include/asm-xtensa/vga.h
@@ -11,7 +11,7 @@
11#ifndef _XTENSA_VGA_H 11#ifndef _XTENSA_VGA_H
12#define _XTENSA_VGA_H 12#define _XTENSA_VGA_H
13 13
14#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) 14#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
15 15
16#define vga_readb(x) (*(x)) 16#define vga_readb(x) (*(x))
17#define vga_writeb(x,y) (*(y) = (x)) 17#define vga_writeb(x,y) (*(y) = (x))