]> err.no Git - linux-2.6/commitdiff
[PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Thu, 22 Jun 2006 21:47:32 +0000 (14:47 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 22 Jun 2006 22:05:58 +0000 (15:05 -0700)
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>
13 files changed:
drivers/video/console/mdacon.c
drivers/video/console/vgacon.c
drivers/video/vga16fb.c
include/asm-alpha/vga.h
include/asm-arm/vga.h
include/asm-i386/vga.h
include/asm-ia64/vga.h
include/asm-m32r/vga.h
include/asm-mips/vga.h
include/asm-powerpc/vga.h
include/asm-sparc64/vga.h
include/asm-x86_64/vga.h
include/asm-xtensa/vga.h

index 989e4d49e5bbea32cf2b04c3e85c815ad8e3c436..7f939d066a5a40151e3e35ab4316d6abe06e25b0 100644 (file)
@@ -313,8 +313,8 @@ static const char __init *mdacon_startup(void)
        mda_num_columns = 80;
        mda_num_lines   = 25;
 
-       mda_vram_base = VGA_MAP_MEM(0xb0000);
        mda_vram_len  = 0x01000;
+       mda_vram_base = VGA_MAP_MEM(0xb0000, mda_vram_len);
 
        mda_index_port  = 0x3b4;
        mda_value_port  = 0x3b5;
index d5a04b68c4d49bf8101f6c9c0b31ec8fa065fffa..e64d42e2449e4dd5ac104042000d0fe005ce09ca 100644 (file)
@@ -391,7 +391,7 @@ static const char __init *vgacon_startup(void)
                        static struct resource ega_console_resource =
                            { "ega", 0x3B0, 0x3BF };
                        vga_video_type = VIDEO_TYPE_EGAM;
-                       vga_vram_end = 0xb8000;
+                       vga_vram_size = 0x8000;
                        display_desc = "EGA+";
                        request_resource(&ioport_resource,
                                         &ega_console_resource);
@@ -401,7 +401,7 @@ static const char __init *vgacon_startup(void)
                        static struct resource mda2_console_resource =
                            { "mda", 0x3BF, 0x3BF };
                        vga_video_type = VIDEO_TYPE_MDA;
-                       vga_vram_end = 0xb2000;
+                       vga_vram_size = 0x2000;
                        display_desc = "*MDA";
                        request_resource(&ioport_resource,
                                         &mda1_console_resource);
@@ -418,7 +418,7 @@ static const char __init *vgacon_startup(void)
                if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) {
                        int i;
 
-                       vga_vram_end = 0xc0000;
+                       vga_vram_size = 0x8000;
 
                        if (!ORIG_VIDEO_ISVGA) {
                                static struct resource ega_console_resource
@@ -443,7 +443,7 @@ static const char __init *vgacon_startup(void)
                                 * and COE=1 isn't necessarily a good idea)
                                 */
                                vga_vram_base = 0xa0000;
-                               vga_vram_end = 0xb0000;
+                               vga_vram_size = 0x10000;
                                outb_p(6, VGA_GFX_I);
                                outb_p(6, VGA_GFX_D);
 #endif
@@ -475,7 +475,7 @@ static const char __init *vgacon_startup(void)
                        static struct resource cga_console_resource =
                            { "cga", 0x3D4, 0x3D5 };
                        vga_video_type = VIDEO_TYPE_CGA;
-                       vga_vram_end = 0xba000;
+                       vga_vram_size = 0x2000;
                        display_desc = "*CGA";
                        request_resource(&ioport_resource,
                                         &cga_console_resource);
@@ -483,9 +483,8 @@ static const char __init *vgacon_startup(void)
                }
        }
 
-       vga_vram_base = VGA_MAP_MEM(vga_vram_base);
-       vga_vram_end = VGA_MAP_MEM(vga_vram_end);
-       vga_vram_size = vga_vram_end - vga_vram_base;
+       vga_vram_base = VGA_MAP_MEM(vga_vram_base, vga_vram_size);
+       vga_vram_end = vga_vram_base + vga_vram_size;
 
        /*
         *      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)
        char *charmap;
        
        if (vga_video_type != VIDEO_TYPE_EGAM) {
-               charmap = (char *) VGA_MAP_MEM(colourmap);
+               charmap = (char *) VGA_MAP_MEM(colourmap, 0);
                beg = 0x0e;
 #ifdef VGA_CAN_DO_64KB
                if (vga_video_type == VIDEO_TYPE_VGAC)
                        beg = 0x06;
 #endif
        } else {
-               charmap = (char *) VGA_MAP_MEM(blackwmap);
+               charmap = (char *) VGA_MAP_MEM(blackwmap, 0);
                beg = 0x0a;
        }
 
index f3f16fd9f2316d32c89a2d9ae63b47864cd28fb0..4fd2a272e03d350ea3a0cec9c4b1d3c15ca63740 100644 (file)
@@ -1351,7 +1351,7 @@ static int __init vga16fb_probe(struct device *device)
        }
 
        /* XXX share VGA_FB_PHYS and I/O region with vgacon and others */
-       info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS);
+       info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS, 0);
 
        if (!info->screen_base) {
                printk(KERN_ERR "vga16fb: unable to map device\n");
index 8ca4f6b2da19e87af861971b23b7b1c4778014e5..ed06f59b544d4c7c84ef7ccdb20ab56fa1444554 100644 (file)
@@ -46,6 +46,6 @@ extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count);
 #define vga_readb(a)   readb((u8 __iomem *)(a))
 #define vga_writeb(v,a)        writeb(v, (u8 __iomem *)(a))
 
-#define VGA_MAP_MEM(x) ((unsigned long) ioremap(x, 0))
+#define VGA_MAP_MEM(x,s)       ((unsigned long) ioremap(x, s))
 
 #endif
index 926e5ee128e92cdbdc91e6f5bda075cf06186014..1e0b913c3d71ce9be96847b128b3965da2672f21 100644 (file)
@@ -4,7 +4,7 @@
 #include <asm/hardware.h>
 #include <asm/io.h>
 
-#define VGA_MAP_MEM(x) (PCIMEM_BASE + (x))
+#define VGA_MAP_MEM(x,s)       (PCIMEM_BASE + (x))
 
 #define vga_readb(x)   (*((volatile unsigned char *)x))
 #define vga_writeb(x,y)        (*((volatile unsigned char *)y) = (x))
index ef0c0e50cc951e898ea4f50661db2e4f1dc551fa..0ecf68ac03aa95c312a15876473d5df5a8851301 100644 (file)
@@ -12,7 +12,7 @@
  *     access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x)
+#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
 
 #define vga_readb(x) (*(x))
 #define vga_writeb(x,y) (*(y) = (x))
index 091177cda223708f6c0a3560b58bfe775845f02a..02184ecd820822af282794071456ebba12502c07 100644 (file)
@@ -17,7 +17,7 @@
 extern unsigned long vga_console_iobase;
 extern unsigned long vga_console_membase;
 
-#define VGA_MAP_MEM(x) ((unsigned long) ioremap_nocache(vga_console_membase + (x), 0))
+#define VGA_MAP_MEM(x,s)       ((unsigned long) ioremap_nocache(vga_console_membase + (x), s))
 
 #define vga_readb(x)   (*(x))
 #define vga_writeb(x,y)        (*(y) = (x))
index d0f4b6eed7a34f0c234200ec0cb3ab81297964d7..533163447cc9d3f711d256c144bb6095b982b0f9 100644 (file)
@@ -14,7 +14,7 @@
  *     access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x)
+#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
 
 #define vga_readb(x) (*(x))
 #define vga_writeb(x,y) (*(y) = (x))
index 34755c0a63988e21121a33c943fbada2234bb7da..c1dd0b10bc2737ba1abb23434106b5560b78924f 100644 (file)
@@ -13,7 +13,7 @@
  *     access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x) (0xb0000000L + (unsigned long)(x))
+#define VGA_MAP_MEM(x,s)       (0xb0000000L + (unsigned long)(x))
 
 #define vga_readb(x)   (*(x))
 #define vga_writeb(x,y)        (*(y) = (x))
index eadaf2f3d03255c0eefe558138a943894cecdaf1..a2eac409c1ec2cbcd81ce48ced5b07aac04195a0 100644 (file)
@@ -41,9 +41,9 @@ static inline u16 scr_readw(volatile const u16 *addr)
 extern unsigned long vgacon_remap_base;
 
 #ifdef __powerpc64__
-#define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0))
+#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
 #else
-#define VGA_MAP_MEM(x) (x + vgacon_remap_base)
+#define VGA_MAP_MEM(x,s) (x + vgacon_remap_base)
 #endif
 
 #define vga_readb(x) (*(x))
index 9c57eb363b40466582d127da68f0025bac7c380f..c69d5b2ba19a488ea3abf8a75c25383edd13d562 100644 (file)
@@ -28,6 +28,6 @@ static inline u16 scr_readw(const u16 *addr)
        return *addr;
 }
 
-#define VGA_MAP_MEM(x) (x)
+#define VGA_MAP_MEM(x,s) (x)
 
 #endif
index ef0c0e50cc951e898ea4f50661db2e4f1dc551fa..0ecf68ac03aa95c312a15876473d5df5a8851301 100644 (file)
@@ -12,7 +12,7 @@
  *     access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x)
+#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
 
 #define vga_readb(x) (*(x))
 #define vga_writeb(x,y) (*(y) = (x))
index 23d82f6acb572b77971e33b379ab34ea6627c8cf..1fd8cab3a297fb1446fe5081048ca737a402e900 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef _XTENSA_VGA_H
 #define _XTENSA_VGA_H
 
-#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x)
+#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
 
 #define vga_readb(x)   (*(x))
 #define vga_writeb(x,y)        (*(y) = (x))