xserver: Branch 'pci-rework' - 2 commits
Ian Romanick
idr at kemper.freedesktop.org
Fri Jan 12 20:24:17 EET 2007
hw/xfree86/int10/generic.c | 13 ++++---------
hw/xfree86/int10/helper_exec.c | 26 ++++++--------------------
hw/xfree86/int10/xf86int10.c | 3 +--
hw/xfree86/int10/xf86int10.h | 2 +-
hw/xfree86/os-support/bus/Pci.c | 4 ++--
hw/xfree86/os-support/bus/linuxPci.c | 13 +++----------
hw/xfree86/os-support/bus/xf86Pci.h | 6 +++---
hw/xfree86/vgahw/vgaHW.c | 7 ++-----
hw/xfree86/vgahw/vgaHW.h | 2 +-
9 files changed, 23 insertions(+), 53 deletions(-)
New commits:
diff-tree c3016a29964761478305cf2f5241c563ff3eab0a (from ca9c41e09ddb72d150d86f5d372eb07eeca7c1a2)
Author: Ian Romanick <idr at us.ibm.com>
Date: Fri Jan 12 09:56:00 2007 -0800
Missed file from previous commit.
Convert xf86ReadLegacyVideoBIOS to take a 'struct pci_device *'
parameter instead of a PCITAG.
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 2c58806..7f163f2 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -593,18 +593,13 @@ xf86MapLegacyIO(struct pci_device *dev)
* The number of bytes read on success or -1 on failure.
*/
_X_EXPORT int
-xf86ReadLegacyVideoBIOS(PCITAG Tag, unsigned char *Buf)
+xf86ReadLegacyVideoBIOS(struct pci_device *dev, unsigned char *Buf)
{
const ADDRESS Base = V_BIOS;
const int Len = V_BIOS_SIZE * 2;
const int pagemask = getpagesize() - 1;
const ADDRESS 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),
- PCI_BUS_NO_DOM(PCI_BUS_FROM_TAG(Tag)),
- PCI_DEV_FROM_TAG(Tag),
- PCI_FUNC_FROM_TAG(Tag));
unsigned char *ptr, *src;
int len;
@@ -615,7 +610,7 @@ xf86ReadLegacyVideoBIOS(PCITAG Tag, unsi
return dev->rom_size;
}
- ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, Tag, offset, size);
+ ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, dev, offset, size);
if (!ptr)
return -1;
diff-tree ca9c41e09ddb72d150d86f5d372eb07eeca7c1a2 (from da09964a931cc64d05ab571bf545fdad35a6d395)
Author: Ian Romanick <idr at us.ibm.com>
Date: Thu Jan 11 21:09:20 2007 -0800
Convert int10 and vgaHW to use 'struct pci_device' instead of PCITAG.
Convert all uses of PCITAG in int10 and vgaHW to 'struct pci_device'.
This allows the conversion of xf86ReadLegacyVideoBIOS and
xf86MapDomainMemory to 'struct pci_device' from PCITAG.
diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 8f68ab4..b3a9460 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -69,7 +69,6 @@ xf86ExtendedInitInt10(int entityIndex, i
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, i
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, i
*/
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 a8e9e3c..9937d65 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 9d3c132..1b58b92 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 ce60ed6..a7beeea 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 85fb6dd..3ecb851 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 5afcbdb..2c58806 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,
* 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 1ab0749..2ecd8d7 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 59fd929..ccbd195 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 ff7d1e5..a38ea75 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 */
More information about the xorg-commit
mailing list