Remove the last remants of the pci{Read,Write}{Long,Word,Byte}
functionality. This also allows the removal of PCI_CPU, PCI_CPU16, and a few other dangling bits of cruft.
This commit is contained in:
		
							parent
							
								
									a0f2e1cae4
								
							
						
					
					
						commit
						5bfb2ee965
					
				| 
						 | 
				
			
			@ -156,18 +156,6 @@
 | 
			
		|||
#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
 | 
			
		||||
#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
 | 
			
		||||
 | 
			
		||||
#if X_BYTE_ORDER == X_BIG_ENDIAN
 | 
			
		||||
#define PCI_CPU(val)	(((val >> 24) & 0x000000ff) |	\
 | 
			
		||||
			 ((val >>  8) & 0x0000ff00) |	\
 | 
			
		||||
			 ((val <<  8) & 0x00ff0000) |	\
 | 
			
		||||
			 ((val << 24) & 0xff000000))
 | 
			
		||||
#define PCI_CPU16(val)	(((val >>  8) & 0x000000ff) |	\
 | 
			
		||||
			 ((val <<  8) & 0x0000ff00))
 | 
			
		||||
#else
 | 
			
		||||
#define PCI_CPU(val)	(val)
 | 
			
		||||
#define PCI_CPU16(val)	(val)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Debug Macros/Definitions
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -333,9 +321,6 @@ extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags);
 | 
			
		|||
 * (e.g. a primary PCI bus and all of its secondaries)
 | 
			
		||||
 */
 | 
			
		||||
typedef struct pci_bus_funcs {
 | 
			
		||||
	CARD32  (*pciReadLong)(PCITAG, int);
 | 
			
		||||
	void    (*pciWriteLong)(PCITAG, int, CARD32);
 | 
			
		||||
	void    (*pciSetBitsLong)(PCITAG, int, CARD32, CARD32);
 | 
			
		||||
	ADDRESS (*pciAddrHostToBus)(PCITAG, PciAddrType, ADDRESS);
 | 
			
		||||
	ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
 | 
			
		||||
	/*
 | 
			
		||||
| 
						 | 
				
			
			@ -346,14 +331,6 @@ typedef struct pci_bus_funcs {
 | 
			
		|||
	void    (*pciGetBridgeBuses)(int, int *, int *, int *);
 | 
			
		||||
	/* Use pointer's to avoid #include recursion */
 | 
			
		||||
	void    (*pciGetBridgeResources)(int, pointer *, pointer *, pointer *);
 | 
			
		||||
 | 
			
		||||
	/* These are optional and will be implemented using read long
 | 
			
		||||
	 * if not present. */
 | 
			
		||||
	CARD8   (*pciReadByte)(PCITAG, int);
 | 
			
		||||
	void    (*pciWriteByte)(PCITAG, int, CARD8);
 | 
			
		||||
	CARD16  (*pciReadWord)(PCITAG, int);
 | 
			
		||||
	void    (*pciWriteWord)(PCITAG, int, CARD16);
 | 
			
		||||
 | 
			
		||||
} pciBusFuncs_t, *pciBusFuncs_p;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -171,6 +171,7 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Intel x86 platform specific PCI access functions
 | 
			
		||||
 */
 | 
			
		||||
#if 0
 | 
			
		||||
static CARD32 ix86PciReadLongSetup(PCITAG tag, int off);
 | 
			
		||||
static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val);
 | 
			
		||||
static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val);
 | 
			
		||||
| 
						 | 
				
			
			@ -180,27 +181,34 @@ static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val);
 | 
			
		|||
static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off);
 | 
			
		||||
static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val);
 | 
			
		||||
static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static pciBusFuncs_t ix86Funcs0 = {
 | 
			
		||||
#if 0
 | 
			
		||||
/* pciReadLong      */	ix86PciReadLongSetup,
 | 
			
		||||
/* pciWriteLong     */	ix86PciWriteLongSetup,
 | 
			
		||||
/* pciSetBitsLong   */	ix86PciSetBitsLongSetup,
 | 
			
		||||
#endif
 | 
			
		||||
/* pciAddrHostToBus */	pciAddrNOOP,
 | 
			
		||||
/* pciAddrBusToHost */	pciAddrNOOP
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static pciBusFuncs_t ix86Funcs1 = {
 | 
			
		||||
#if 0
 | 
			
		||||
/* pciReadLong      */	ix86PciReadLongCFG1,
 | 
			
		||||
/* pciWriteLong     */	ix86PciWriteLongCFG1,
 | 
			
		||||
/* pciSetBitsLong   */	ix86PciSetBitsLongCFG1,
 | 
			
		||||
#endif
 | 
			
		||||
/* pciAddrHostToBus */	pciAddrNOOP,
 | 
			
		||||
/* pciAddrBusToHost */	pciAddrNOOP
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static pciBusFuncs_t ix86Funcs2 = {
 | 
			
		||||
#if 0
 | 
			
		||||
/* pciReadLong      */	ix86PciReadLongCFG2,
 | 
			
		||||
/* pciWriteLong     */	ix86PciWriteLongCFG2,
 | 
			
		||||
/* pciSetBitsLong   */	ix86PciSetBitsLongCFG2,
 | 
			
		||||
#endif
 | 
			
		||||
/* pciAddrHostToBus */	pciAddrNOOP,
 | 
			
		||||
/* pciAddrBusToHost */	pciAddrNOOP
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -218,6 +226,7 @@ static pciBusInfo_t ix86Pci0 = {
 | 
			
		|||
static Bool
 | 
			
		||||
ix86PciBusCheck(void)
 | 
			
		||||
{
 | 
			
		||||
#if 0
 | 
			
		||||
    PCITAG tag;
 | 
			
		||||
    CARD32 id, class;
 | 
			
		||||
    CARD8 device;
 | 
			
		||||
| 
						 | 
				
			
			@ -250,6 +259,7 @@ ix86PciBusCheck(void)
 | 
			
		|||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -544,6 +554,7 @@ ix86PcibusTag(CARD8 bus, CARD8 cardnum, CARD8 func)
 | 
			
		|||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
static CARD32
 | 
			
		||||
ix86PciReadLongSetup(PCITAG Tag, int reg)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -680,6 +691,7 @@ ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val)
 | 
			
		|||
    outb(PCI_CFGMECH2_ENABLE_REG, 0);
 | 
			
		||||
    outb(PCI_CFGMECH2_FORWARD_REG, 0);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
ix86PciInit()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,24 +59,13 @@
 | 
			
		|||
 * linux platform specific PCI access functions -- using /proc/bus/pci
 | 
			
		||||
 * needs kernel version 2.2.x
 | 
			
		||||
 */
 | 
			
		||||
static CARD32 linuxPciCfgRead(PCITAG tag, int off);
 | 
			
		||||
static void linuxPciCfgWrite(PCITAG, int off, CARD32 val);
 | 
			
		||||
static void linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits);
 | 
			
		||||
static ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr);
 | 
			
		||||
#if defined(__powerpc__)
 | 
			
		||||
static ADDRESS linuxPpcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS);
 | 
			
		||||
static ADDRESS linuxPpcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static CARD8 linuxPciCfgReadByte(PCITAG tag, int off);
 | 
			
		||||
static void linuxPciCfgWriteByte(PCITAG tag, int off, CARD8 val);
 | 
			
		||||
static CARD16 linuxPciCfgReadWord(PCITAG tag, int off);
 | 
			
		||||
static void linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val);
 | 
			
		||||
 | 
			
		||||
static pciBusFuncs_t linuxFuncs0 = {
 | 
			
		||||
/* pciReadLong      */	linuxPciCfgRead,
 | 
			
		||||
/* pciWriteLong     */	linuxPciCfgWrite,
 | 
			
		||||
/* pciSetBitsLong   */	linuxPciCfgSetBits,
 | 
			
		||||
#if defined(__powerpc__)
 | 
			
		||||
/* pciAddrHostToBus */	linuxPpcHostAddrToBusAddr,
 | 
			
		||||
/* pciAddrBusToHost */	linuxPpcBusAddrToHostAddr,
 | 
			
		||||
| 
						 | 
				
			
			@ -88,12 +77,6 @@ static pciBusFuncs_t linuxFuncs0 = {
 | 
			
		|||
/* pciControlBridge */		NULL,
 | 
			
		||||
/* pciGetBridgeBuses */		NULL,
 | 
			
		||||
/* pciGetBridgeResources */	NULL,
 | 
			
		||||
 | 
			
		||||
/* pciReadByte */	linuxPciCfgReadByte,
 | 
			
		||||
/* pciWriteByte */	linuxPciCfgWriteByte,
 | 
			
		||||
 | 
			
		||||
/* pciReadWord */	linuxPciCfgReadWord,
 | 
			
		||||
/* pciWriteWord */	linuxPciCfgWriteWord,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static pciBusInfo_t linuxPci0 = {
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +99,7 @@ static const struct pci_id_match match_host_bridge = {
 | 
			
		|||
extern int lnxPciInit(void);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
linuxPciInit()
 | 
			
		||||
linuxPciInit(void)
 | 
			
		||||
{
 | 
			
		||||
	struct stat st;
 | 
			
		||||
	if ((xf86Info.pciFlags == PCIForceNone) ||
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +114,8 @@ linuxPciInit()
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * \bug
 | 
			
		||||
 * The generation of the procfs for the domain != 0 case may not be correct.
 | 
			
		||||
 * The generation of the procfs file name for the domain != 0 case may not be 
 | 
			
		||||
 * correct.
 | 
			
		||||
 */
 | 
			
		||||
static int
 | 
			
		||||
linuxPciOpenFile(struct pci_device *dev, Bool write)
 | 
			
		||||
| 
						 | 
				
			
			@ -196,48 +180,6 @@ linuxPciOpenFile(struct pci_device *dev, Bool write)
 | 
			
		|||
    return fd;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static CARD32
 | 
			
		||||
linuxPciCfgRead(PCITAG tag, int off)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
	CARD32	val = 0xffffffff;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) {
 | 
			
		||||
		lseek(fd,off,SEEK_SET);
 | 
			
		||||
		read(fd,&val,4);
 | 
			
		||||
	}
 | 
			
		||||
	return PCI_CPU(val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
linuxPciCfgWrite(PCITAG tag, int off, CARD32 val)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) {
 | 
			
		||||
		lseek(fd,off,SEEK_SET);
 | 
			
		||||
		val = PCI_CPU(val);
 | 
			
		||||
		write(fd,&val,4);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
	CARD32	val = 0xffffffff;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) {
 | 
			
		||||
		lseek(fd,off,SEEK_SET);
 | 
			
		||||
		read(fd,&val,4);
 | 
			
		||||
		val = PCI_CPU(val);
 | 
			
		||||
		val = (val & ~mask) | (bits & mask);
 | 
			
		||||
		val = PCI_CPU(val);
 | 
			
		||||
		lseek(fd,off,SEEK_SET);
 | 
			
		||||
		write(fd,&val,4);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This function will convert a BAR address into a host address
 | 
			
		||||
 * suitable for passing into the mmap function of a /proc/bus
 | 
			
		||||
| 
						 | 
				
			
			@ -302,57 +244,6 @@ linuxPpcHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
 | 
			
		|||
 | 
			
		||||
#endif /* __powerpc__ */
 | 
			
		||||
 | 
			
		||||
static CARD8
 | 
			
		||||
linuxPciCfgReadByte(PCITAG tag, int off)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
	CARD8	val = 0xff;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) {
 | 
			
		||||
		lseek(fd,off,SEEK_SET);
 | 
			
		||||
		read(fd,&val,1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
linuxPciCfgWriteByte(PCITAG tag, int off, CARD8 val)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) {
 | 
			
		||||
		lseek(fd,off,SEEK_SET);
 | 
			
		||||
		write(fd, &val, 1);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static CARD16
 | 
			
		||||
linuxPciCfgReadWord(PCITAG tag, int off)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
	CARD16	val = 0xff;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) {
 | 
			
		||||
		lseek(fd, off, SEEK_SET);
 | 
			
		||||
		read(fd, &val, 2);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return PCI_CPU16(val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val)
 | 
			
		||||
{
 | 
			
		||||
	int	fd;
 | 
			
		||||
 | 
			
		||||
	if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) {
 | 
			
		||||
		lseek(fd, off, SEEK_SET);
 | 
			
		||||
		val = PCI_CPU16(val);
 | 
			
		||||
		write(fd, &val, 2);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef INCLUDE_XF86_NO_DOMAIN
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue