diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index 85fb6dd..d2c8d1f 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -248,8 +248,8 @@ pciInit(void) } } -_X_EXPORT ADDRESS -pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) +_X_EXPORT unsigned long __pcimem * +pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, unsigned long addr) { int bus = PCI_BUS_FROM_TAG(tag); @@ -262,8 +262,8 @@ pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) return(addr); } -_X_EXPORT ADDRESS -pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) +_X_EXPORT unsigned long +pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, unsigned long addr) { int bus = PCI_BUS_FROM_TAG(tag); @@ -282,8 +282,8 @@ pciTag(int busnum, int devnum, int funcnum) return(PCI_MAKE_TAG(busnum,devnum,funcnum)); } -ADDRESS -pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr) +unsigned long __pcimem * +pciAddrNOOP(PCITAG tag, PciAddrType type, unsigned long addr) { return(addr); } @@ -320,7 +320,7 @@ xf86GetPciDomain(PCITAG Tag) _X_EXPORT pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) + unsigned long Base, unsigned long Size) { return xf86MapVidMem(ScreenNum, Flags, Base, Size); } @@ -336,7 +336,7 @@ _X_EXPORT int xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf) { const unsigned Len = (2 * 0x10000); - ADDRESS Base = 0xC0000; + unsigned long Base = 0xC0000; int ret, length, rlength; /* Read in 64kB chunks */ diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 8c12e56..63bc484 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -321,8 +321,10 @@ extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags); * (e.g. a primary PCI bus and all of its secondaries) */ typedef struct pci_bus_funcs { - ADDRESS (*pciAddrHostToBus)(PCITAG, PciAddrType, ADDRESS); - ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS); + unsigned long (*pciAddrHostToBus)(PCITAG, PciAddrType, + unsigned long); + unsigned long __pcimem *(*pciAddrBusToHost)(PCITAG, PciAddrType, + unsigned long); /* * The next three are optional. If NULL, the corresponding function is * to be performed generically. @@ -359,7 +361,8 @@ CARD32 pciCfgMech1Read(PCITAG tag, int offset); void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val); void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, CARD32 val); -ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); +unsigned long __pcimem *pciAddrNOOP(PCITAG tag, PciAddrType type, + unsigned long); extern int pciMaxBusNum; diff --git a/hw/xfree86/os-support/bus/axpPci.c b/hw/xfree86/os-support/bus/axpPci.c index e7e996a..43f83ee 100644 --- a/hw/xfree86/os-support/bus/axpPci.c +++ b/hw/xfree86/os-support/bus/axpPci.c @@ -305,9 +305,9 @@ xf86GetPciDomain(PCITAG Tag) return PCI_DOM_FROM_TAG(Tag); } -_X_EXPORT pointer +_X_EXPORT unsigned long __pcimem * xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) + unsigned long Base, unsigned long Size) { axpDomainPtr pDomain; int domain = PCI_DOM_FROM_TAG(Tag); @@ -365,9 +365,9 @@ _X_EXPORT int xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf) { const unsigned long pagemask = xf86getpagesize() - 1; - const ADDRESS Base = 0xC0000; + const unsigned long Base = 0xC0000; const int Len = 0x20000; - const ADDRESS MapBase = Base & ~pagemask; + const unsigned long MapBase = Base & ~pagemask; unsigned long MapSize = ((Base + Len + pagemask) & ~pagemask) - MapBase; unsigned char *MappedAddr; int i; diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 5afcbdb..8610ec9 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -60,10 +60,14 @@ * linux platform specific PCI access functions -- using /proc/bus/pci * needs kernel version 2.2.x */ -static ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr); +static unsigned long __pcimem *linuxTransAddrBusToHost(PCITAG tag, + PciAddrType type, + unsigned long addr); #if defined(__powerpc__) -static ADDRESS linuxPpcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS); -static ADDRESS linuxPpcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS); +static unsigned long __pcimem *linuxPpcBusAddrToHostAddr(PCITAG, PciAddrType, + unsigned long); +static unsigned long linuxPpcHostAddrToBusAddr(PCITAG, PciAddrType, + unsigned long); #endif static pciBusFuncs_t linuxFuncs0 = { @@ -197,9 +201,11 @@ linuxPciOpenFile(struct pci_device *dev, Bool write) * suitable for passing into the mmap function of a /proc/bus * device. */ -ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr) +static unsigned long __pcimem * +linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, unsigned long addr) { - ADDRESS ret = xf86GetOSOffsetFromPCI(tag, PCI_MEM|PCI_IO, addr); + unsigned long __pcimem *ret; + ret = xf86GetOSOffsetFromPCI(tag, PCI_MEM|PCI_IO, addr); if (ret) return ret; @@ -218,36 +224,36 @@ ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr) #define __NR_pciconfig_iobase 200 #endif -static ADDRESS -linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) +static unsigned long __pcimem * +linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, unsigned long addr) { if (type == PCI_MEM) { - ADDRESS membase = syscall(__NR_pciconfig_iobase, 1, + unsigned long membase = syscall(__NR_pciconfig_iobase, 1, PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); return (addr + membase); } else if (type == PCI_IO) { - ADDRESS iobase = syscall(__NR_pciconfig_iobase, 2, + unsigned long iobase = syscall(__NR_pciconfig_iobase, 2, PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); return (addr + iobase); } else return addr; } -static ADDRESS -linuxPpcHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) +static unsigned long +linuxPpcHostAddrToBusAddr(PCITAG tag, PciAddrType type, unsigned long addr) { if (type == PCI_MEM) { - ADDRESS membase = syscall(__NR_pciconfig_iobase, 1, + unsigned long membase = syscall(__NR_pciconfig_iobase, 1, PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); return (addr - membase); } else if (type == PCI_IO) { - ADDRESS iobase = syscall(__NR_pciconfig_iobase, 2, + unsigned long iobase = syscall(__NR_pciconfig_iobase, 2, PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); return (addr - iobase); } @@ -399,13 +405,13 @@ xf86GetPciDomain(PCITAG Tag) return result + 1; /* Domain 0 is reserved */ } -static pointer +static unsigned long __pcimem * linuxMapPci(int ScreenNum, int Flags, struct pci_device *dev, - ADDRESS Base, unsigned long Size, int mmap_ioctl) + unsigned long Base, unsigned long Size, int mmap_ioctl) { /* Align to page boundary */ - const ADDRESS realBase = Base & ~(getpagesize() - 1); - const ADDRESS Offset = Base - realBase; + const unsigned long realBase = Base & ~(getpagesize() - 1); + const unsigned long Offset = Base - realBase; do { unsigned char *result; @@ -512,9 +518,9 @@ linuxOpenLegacy(struct pci_device *dev, char *name) * returns a pointer to it. The pointer is saved for future use if it's in * the legacy ISA memory space (memory in a domain between 0 and 1MB). */ -_X_EXPORT pointer +_X_EXPORT unsigned long __pcimem * xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) + unsigned long Base, unsigned long Size) { int domain = xf86GetPciDomain(Tag); const struct pci_device *dev = xf86GetPciHostConfigFromTag(Tag); @@ -597,10 +603,10 @@ xf86MapLegacyIO(struct pci_device *dev) _X_EXPORT int xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf) { - const ADDRESS Base = V_BIOS; + const unsigned long Base = V_BIOS; const int Len = V_BIOS_SIZE * 2; const int pagemask = getpagesize() - 1; - const ADDRESS offset = Base & ~pagemask; + const unsigned long offset = Base & ~pagemask; const unsigned long size = ((Base + Len + pagemask) & ~pagemask) - offset; const struct pci_device * const dev = pci_device_find_by_slot(PCI_DOM_FROM_TAG(Tag), @@ -654,7 +660,7 @@ xf86BusAccWindowsFromOS(void) const int domain = xf86GetPciDomain(tag); const struct pciSizes * const sizes = linuxGetSizesStruct(dev); - RANGE(range, 0, (ADDRESS)(sizes->mem_size - 1), + RANGE(range, 0, (unsigned long)(sizes->mem_size - 1), RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); @@ -707,8 +713,8 @@ xf86AccResFromOS(resPtr pRes) RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, (ADDRESS)(sizes->mem_size - 1), - (ADDRESS)(sizes->mem_size - 1), + RANGE(range, (unsigned long)(sizes->mem_size - 1), + (unsigned long)(sizes->mem_size - 1), RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); diff --git a/hw/xfree86/os-support/bus/sparcPci.c b/hw/xfree86/os-support/bus/sparcPci.c index f09ed9f..002dc28 100644 --- a/hw/xfree86/os-support/bus/sparcPci.c +++ b/hw/xfree86/os-support/bus/sparcPci.c @@ -597,9 +597,9 @@ xf86GetPciDomain(PCITAG Tag) return PCI_DOM_FROM_TAG(Tag); } -_X_EXPORT pointer +_X_EXPORT unsigned long __pcimem * xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) + unsigned long Base, unsigned long Size) { sparcDomainPtr pDomain; pointer result; @@ -649,10 +649,11 @@ xf86MapLegacyIO(int ScreenNum, int Flags, PCITAG Tag, } _X_EXPORT int -xf86ReadLegacyVideoBIOS(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) +xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned long Base, int Len, + unsigned char *Buf) { unsigned char *ptr, *src; - ADDRESS offset; + unsigned long offset; unsigned long size; int len; diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h index 1ab0749..2e19b71 100644 --- a/hw/xfree86/os-support/bus/xf86Pci.h +++ b/hw/xfree86/os-support/bus/xf86Pci.h @@ -232,8 +232,13 @@ * Typedefs, etc... */ +#ifdef __CHECKER__ +#define __pcimem __attribute__((noderef, address_space(1))) +#else +#define __pcimem +#endif + /* Primitive Types */ -typedef unsigned long ADDRESS; /* Memory/PCI address */ typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */ typedef unsigned long PCITAG; @@ -250,8 +255,10 @@ typedef enum { /* Public PCI access functions */ -ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr); -ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr); +unsigned long __pcimem *pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, + unsigned long addr); +unsigned long pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, + unsigned long addr); PCITAG pciTag(int busnum, int devnum, int funcnum); int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min); Bool xf86scanpci(void); @@ -260,8 +267,8 @@ extern int pciNumBuses; /* Domain access functions. Some of these probably shouldn't be public */ int xf86GetPciDomain(PCITAG tag); -pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size); +__pcimem pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, + unsigned long Base, unsigned long Size); IOADDRESS xf86MapLegacyIO(struct pci_device *dev); int xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf); diff --git a/hw/xfree86/os-support/linux/lnx_pci.c b/hw/xfree86/os-support/linux/lnx_pci.c index 8415aa0..425449a 100644 --- a/hw/xfree86/os-support/linux/lnx_pci.c +++ b/hw/xfree86/os-support/linux/lnx_pci.c @@ -211,7 +211,7 @@ xf86GetPciOffsetFromOS(PCITAG tag, int index, unsigned long* bases) #endif /* Query the kvirt address (64bit) of a BAR range from size for a given TAG */ -unsigned long +unsigned long __pcimem * xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base) { unsigned int ndx; diff --git a/hw/xfree86/os-support/shared/stdResource.c b/hw/xfree86/os-support/shared/stdResource.c index ad46856..7fd500b 100644 --- a/hw/xfree86/os-support/shared/stdResource.c +++ b/hw/xfree86/os-support/shared/stdResource.c @@ -43,9 +43,6 @@ #include "xf86_OSlib.h" #include "xf86Resources.h" -#ifdef __UNIXOS2__ -# undef ADDRESS -#endif /* Avoid Imakefile changes */ #include "bus/Pci.h"