View | Details | Raw Unified | Return to bug 197572
Collapse All | Expand All

(-)BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c.orig (-13 / +7 lines)
Lines 625-631 Link Here
625
625
626
#define MAX_DOMAINS 256
626
#define MAX_DOMAINS 256
627
static pointer DomainMmappedIO[MAX_DOMAINS];
627
static pointer DomainMmappedIO[MAX_DOMAINS];
628
static pointer DomainMmappedMem[MAX_DOMAINS];
629
628
630
static int
629
static int
631
linuxOpenLegacy(PCITAG Tag, char *name)
630
linuxOpenLegacy(PCITAG Tag, char *name)
Lines 682-687 Link Here
682
{
681
{
683
    int domain = xf86GetPciDomain(Tag);
682
    int domain = xf86GetPciDomain(Tag);
684
    int fd;
683
    int fd;
684
    pointer addr;
685
685
686
    /*
686
    /*
687
     * We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
687
     * We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
Lines 695-714 Link Here
695
	return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
695
	return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
696
			   PCIIOC_MMAP_IS_MEM);
696
			   PCIIOC_MMAP_IS_MEM);
697
697
698
698
    addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
699
    /* If we haven't already mapped this legacy space, try to. */
699
    if (addr == MAP_FAILED) {
700
    if (!DomainMmappedMem[domain]) {
700
	close (fd);
701
	DomainMmappedMem[domain] = mmap(NULL, 1024*1024, PROT_READ|PROT_WRITE,
701
	perror("mmap failure");
702
					MAP_SHARED, fd, 0);
702
	FatalError("xf86MapDomainMem():  mmap() failure\n");
703
	if (DomainMmappedMem[domain] == MAP_FAILED) {
704
	    close(fd);
705
	    perror("mmap failure");
706
	    FatalError("xf86MapDomainMem():  mmap() failure\n");
707
	}
708
    }
703
    }
709
710
    close(fd);
704
    close(fd);
711
    return (pointer)((char *)DomainMmappedMem[domain] + Base);
705
    return addr;
712
}
706
}
713
707
714
/*
708
/*

Return to bug 197572