xserver: Branch 'server-1.2-branch'

Adam Jackson ajax at kemper.freedesktop.org
Wed Nov 8 17:18:53 EET 2006


 hw/xfree86/os-support/bus/linuxPci.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

New commits:
diff-tree 58653b676d68b731c046128eade8efff9ab61582 (from 93ae22b16bde0db10cdf6a58c793f973b1bf31e2)
Author: Bjorn Helgaas <bjorn.helgaas at hp.com>
Date:   Fri Nov 3 18:54:06 2006 +0100

    Do not map full 0-1MB legacy range
    
    If we're mapping something in the "legacy range" (0-1Mb), we shouldn't
    expand the requested range to the entire 0-1Mb range.  Typically this
    is for mapping the VGA frame buffer, and some platforms support mmap of
    the frame buffer but not the entire 0-1Mb range.
    
    For example, HP sx1000 and sx2000 ia64 platforms can have memory from
    0-0x9ffff, VGA frame buffer from 0xa0000-0xbffff, and memory from
    0xc0000-0xfffff.  On these platforms, we can't map the entire 0-1Mb
    range with the same attribute because the memory only supports WB,
    while the frame buffer supports only UC.  But an mmap of just the
    frame buffer should work fine.
    (cherry picked from bd0c829654903ca45543dfa59cda967c4fafd8ac commit)

diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index d603087..4acd12a 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -581,7 +581,6 @@ linuxMapPci(int ScreenNum, int Flags, PC
 
 #define MAX_DOMAINS 257
 static pointer DomainMmappedIO[MAX_DOMAINS];
-static pointer DomainMmappedMem[MAX_DOMAINS];
 
 static int
 linuxOpenLegacy(PCITAG Tag, char *name)
@@ -639,6 +638,7 @@ xf86MapDomainMemory(int ScreenNum, int F
 {
     int domain = xf86GetPciDomain(Tag);
     int fd;
+    pointer addr;
 
     /*
      * We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
@@ -652,20 +652,14 @@ xf86MapDomainMemory(int ScreenNum, int F
 	return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
 			   PCIIOC_MMAP_IS_MEM);
 
-
-    /* If we haven't already mapped this legacy space, try to. */
-    if (!DomainMmappedMem[domain]) {
-	DomainMmappedMem[domain] = mmap(NULL, 1024*1024, PROT_READ|PROT_WRITE,
-					MAP_SHARED, fd, 0);
-	if (DomainMmappedMem[domain] == MAP_FAILED) {
-	    close(fd);
-	    perror("mmap failure");
-	    FatalError("xf86MapDomainMem():  mmap() failure\n");
-	}
+    addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+    if (addr == MAP_FAILED) {
+	close (fd);
+	perror("mmap failure");
+	FatalError("xf86MapDomainMem():  mmap() failure\n");
     }
-
     close(fd);
-    return (pointer)((char *)DomainMmappedMem[domain] + Base);
+    return addr;
 }
 
 /*



More information about the xorg-commit mailing list