diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index 8f68ab43f..b3a946076 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -69,7 +69,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) void* base = 0; void* vbiosMem = 0; void* options = NULL; - struct pci_device * pvp; int screen; legacyVGARec vga; xf86int10BiosLocation bios; @@ -98,14 +97,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->scrnIndex = screen; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); - /* FIXME: Shouldn't this be a failure case? Leaving Tag as 0 seems like + /* FIXME: Shouldn't this be a failure case? Leaving dev as NULL seems like * FIXME: an error */ - pvp = xf86GetPciInfoForEntity(entityIndex); - if (pvp != NULL) { - pInt->Tag = PCI_MAKE_TAG(PCI_MAKE_BUS(pvp->domain, pvp->bus), - pvp->dev, pvp->func); - } + pInt->dev = xf86GetPciInfoForEntity(entityIndex); /* * we need to map video RAM MMIO as some chipsets map mmio @@ -221,7 +216,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) */ vbiosMem = (char *)base + V_BIOS; (void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE); - if (xf86ReadLegacyVideoBIOS(pInt->Tag, vbiosMem) < V_BIOS_SIZE) { + if (xf86ReadLegacyVideoBIOS(pInt->dev, vbiosMem) < V_BIOS_SIZE) { xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x0C0000.\n"); } @@ -299,7 +294,7 @@ MapVRam(xf86Int10InfoPtr pInt) int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize; INTPriv(pInt)->vRam = xf86MapDomainMemory(pInt->scrnIndex, VIDMEM_MMIO, - pInt->Tag, V_RAM, size); + pInt->dev, V_RAM, size); pInt->ioBase = xf86Screens[pInt->scrnIndex]->domainIOBase; } diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index a8e9e3c62..9937d65b9 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -471,12 +471,6 @@ Mem_wl(CARD32 addr, CARD32 val) static CARD32 PciCfg1Addr = 0; #define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff) -#define _DOM(x) PCI_DOM_FROM_TAG(x) -#define _BUS(x) PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(x)) -#define _DEV(x) PCI_DEV_FROM_TAG(x) -#define _FUNC(x) PCI_FUNC_FROM_TAG(x) -#define GET_DEVICE(_tag) \ - pci_device_find_by_slot(_DOM(_tag), _BUS(_tag), _DEV(_tag), _FUNC(_tag)) static int pciCfg1in(CARD16 addr, CARD32 *val) @@ -486,9 +480,7 @@ pciCfg1in(CARD16 addr, CARD32 *val) return 1; } if (addr == 0xCFC) { - struct pci_device *dev = GET_DEVICE(Int10Current->Tag); - - pci_device_cfg_read_u32(dev, val, OFFSET(PciCfg1Addr)); + pci_device_cfg_read_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr)); return 1; } return 0; @@ -502,9 +494,7 @@ pciCfg1out(CARD16 addr, CARD32 val) return 1; } if (addr == 0xCFC) { - struct pci_device *dev = GET_DEVICE(Int10Current->Tag); - - pci_device_cfg_write_u32(dev, & val, OFFSET(PciCfg1Addr)); + pci_device_cfg_write_u32(Int10Current->dev, & val, OFFSET(PciCfg1Addr)); return 1; } return 0; @@ -522,9 +512,8 @@ pciCfg1inw(CARD16 addr, CARD16 *val) } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; - struct pci_device *dev = GET_DEVICE(Int10Current->Tag); - pci_device_cfg_read_u16(dev, val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_read_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset); return 1; } return 0; @@ -543,9 +532,8 @@ pciCfg1outw(CARD16 addr, CARD16 val) } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; - struct pci_device *dev = GET_DEVICE(Int10Current->Tag); - pci_device_cfg_write_u16(dev, & val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_write_u16(Int10Current->dev, & val, OFFSET(PciCfg1Addr) + offset); return 1; } return 0; @@ -563,9 +551,8 @@ pciCfg1inb(CARD16 addr, CARD8 *val) } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; - struct pci_device *dev = GET_DEVICE(Int10Current->Tag); - pci_device_cfg_read_u8(dev, val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_read_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset); return 1; } return 0; @@ -584,9 +571,8 @@ pciCfg1outb(CARD16 addr, CARD8 val) } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; - struct pci_device *dev = GET_DEVICE(Int10Current->Tag); - pci_device_cfg_write_u8(dev, & val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_write_u8(Int10Current->dev, & val, OFFSET(PciCfg1Addr) + offset); return 1; } return 0; diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c index 9d3c132c7..1b58b923d 100644 --- a/hw/xfree86/int10/xf86int10.c +++ b/hw/xfree86/int10/xf86int10.c @@ -819,12 +819,11 @@ int1A_handler(xf86Int10InfoPtr pInt) static struct pci_device * findPci(xf86Int10InfoPtr pInt, unsigned short bx) { - const unsigned domain = PCI_DOM_FROM_TAG( pInt->Tag ); const unsigned bus = (bx >> 8) & 0x00FF; const unsigned dev = (bx >> 3) & 0x001F; const unsigned func = (bx ) & 0x0007; - return pci_device_find_by_slot(domain, bus, dev, func); + return pci_device_find_by_slot(pInt->dev->domain, bus, dev, func); } static CARD32 diff --git a/hw/xfree86/int10/xf86int10.h b/hw/xfree86/int10/xf86int10.h index ce60ed61a..a7beeea6c 100644 --- a/hw/xfree86/int10/xf86int10.h +++ b/hw/xfree86/int10/xf86int10.h @@ -40,7 +40,7 @@ typedef struct { int bp; int flags; int stackseg; - PCITAG Tag; + struct pci_device *dev; IOADDRESS ioBase; } xf86Int10InfoRec, *xf86Int10InfoPtr; diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index 85fb6dd65..3ecb85190 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -319,7 +319,7 @@ xf86GetPciDomain(PCITAG Tag) } _X_EXPORT pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, +xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, ADDRESS Base, unsigned long Size) { return xf86MapVidMem(ScreenNum, Flags, Base, Size); @@ -333,7 +333,7 @@ xf86MapLegacyIO(struct pci_device *dev) } _X_EXPORT int -xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf) +xf86ReadLegacyVideoBIOS(struct pci_device *dev, unsigned char *Buf) { const unsigned Len = (2 * 0x10000); ADDRESS Base = 0xC0000; diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 5afcbdb51..2c588062f 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -513,11 +513,9 @@ linuxOpenLegacy(struct pci_device *dev, char *name) * the legacy ISA memory space (memory in a domain between 0 and 1MB). */ _X_EXPORT pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, +xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, ADDRESS Base, unsigned long Size) { - int domain = xf86GetPciDomain(Tag); - const struct pci_device *dev = xf86GetPciHostConfigFromTag(Tag); int fd = -1; pointer addr; diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h index 1ab0749f1..2ecd8d7c9 100644 --- a/hw/xfree86/os-support/bus/xf86Pci.h +++ b/hw/xfree86/os-support/bus/xf86Pci.h @@ -260,9 +260,9 @@ 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); +pointer xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, + ADDRESS Base, unsigned long Size); IOADDRESS xf86MapLegacyIO(struct pci_device *dev); -int xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf); +int xf86ReadLegacyVideoBIOS(struct pci_device *dev, unsigned char *Buf); #endif /* _XF86PCI_H */ diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c index 59fd92974..ccbd19574 100644 --- a/hw/xfree86/vgahw/vgaHW.c +++ b/hw/xfree86/vgahw/vgaHW.c @@ -1638,7 +1638,6 @@ vgaHWGetHWRec(ScrnInfoPtr scrp) { vgaRegPtr regp; vgaHWPtr hwp; - struct pci_device * pvp; int i; /* @@ -1724,9 +1723,7 @@ vgaHWGetHWRec(ScrnInfoPtr scrp) vgaHWSetStdFuncs(hwp); hwp->PIOOffset = scrp->domainIOBase; - if ((pvp = xf86GetPciInfoForEntity(scrp->entityList[0]))) - hwp->Tag = pciTag( PCI_MAKE_BUS( pvp->domain, pvp->bus ), - pvp->dev, pvp->func ); + hwp->dev = xf86GetPciInfoForEntity(scrp->entityList[0]); return TRUE; } @@ -1778,7 +1775,7 @@ vgaHWMapMem(ScrnInfoPtr scrp) #ifdef DEBUG ErrorF("Mapping VGAMem\n"); #endif - hwp->Base = xf86MapDomainMemory(scr_index, VIDMEM_MMIO_32BIT, hwp->Tag, + hwp->Base = xf86MapDomainMemory(scr_index, VIDMEM_MMIO_32BIT, hwp->dev, hwp->MapPhys, hwp->MapSize); return hwp->Base != NULL; } diff --git a/hw/xfree86/vgahw/vgaHW.h b/hw/xfree86/vgahw/vgaHW.h index ff7d1e5e0..a38ea7559 100644 --- a/hw/xfree86/vgahw/vgaHW.h +++ b/hw/xfree86/vgahw/vgaHW.h @@ -156,7 +156,7 @@ typedef struct _vgaHWRec { = pioreg */ vgaHWReadProcPtr readEnable; vgaHWWriteProcPtr writeEnable; - PCITAG Tag; + struct pci_device *dev; } vgaHWRec; /* Some macros that VGA drivers can use in their ChipProbe() function */