[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] vtd: Make some pci access functions architecture independent.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1223552851 -3600 # Node ID 69f670979660d7feda8ca89987ef8ea509470de2 # Parent 0033c944318f266a0e367678bf9f46042ae03397 vtd: Make some pci access functions architecture independent. Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx> Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx> --- xen/arch/x86/pci.c | 61 -------------------------------------------- xen/drivers/Makefile | 1 xen/drivers/pci/Makefile | 1 xen/drivers/pci/pci.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 60 deletions(-) diff -r 0033c944318f -r 69f670979660 xen/arch/x86/pci.c --- a/xen/arch/x86/pci.c Thu Oct 09 11:17:51 2008 +0100 +++ b/xen/arch/x86/pci.c Thu Oct 09 12:47:31 2008 +0100 @@ -1,12 +1,9 @@ /****************************************************************************** * pci.c * - * PCI access functions. + * Architecture-dependent PCI access functions. */ -#include <xen/config.h> -#include <xen/pci.h> -#include <xen/pci_regs.h> #include <xen/spinlock.h> #include <asm/io.h> @@ -118,59 +115,3 @@ void pci_conf_write32( pci_conf_write(PCI_CONF_ADDRESS(bus, dev, func, reg), 0, 4, data); } -int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap) -{ - u8 id; - int max_cap = 48; - u8 pos = PCI_CAPABILITY_LIST; - u16 status; - - status = pci_conf_read16(bus, dev, func, PCI_STATUS); - if ( (status & PCI_STATUS_CAP_LIST) == 0 ) - return 0; - - while ( max_cap-- ) - { - pos = pci_conf_read8(bus, dev, func, pos); - if ( pos < 0x40 ) - break; - - pos &= ~3; - id = pci_conf_read8(bus, dev, func, pos + PCI_CAP_LIST_ID); - - if ( id == 0xff ) - break; - else if ( id == cap ) - return pos; - - pos += PCI_CAP_LIST_NEXT; - } - - return 0; -} - -int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap) -{ - u8 id; - int ttl = 48; - - while ( ttl-- ) - { - pos = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); - if ( pos < 0x40 ) - break; - - pos &= ~3; - id = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - pos + PCI_CAP_LIST_ID); - - if ( id == 0xff ) - break; - if ( id == cap ) - return pos; - - pos += PCI_CAP_LIST_NEXT; - } - return 0; -} - diff -r 0033c944318f -r 69f670979660 xen/drivers/Makefile --- a/xen/drivers/Makefile Thu Oct 09 11:17:51 2008 +0100 +++ b/xen/drivers/Makefile Thu Oct 09 12:47:31 2008 +0100 @@ -1,5 +1,6 @@ subdir-y += char subdir-y += char subdir-y += cpufreq +subdir-y += pci subdir-$(x86) += passthrough subdir-$(HAS_ACPI) += acpi subdir-$(HAS_VGA) += video diff -r 0033c944318f -r 69f670979660 xen/drivers/pci/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/drivers/pci/Makefile Thu Oct 09 12:47:31 2008 +0100 @@ -0,0 +1,1 @@ +obj-y += pci.o diff -r 0033c944318f -r 69f670979660 xen/drivers/pci/pci.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/drivers/pci/pci.c Thu Oct 09 12:47:31 2008 +0100 @@ -0,0 +1,64 @@ +/****************************************************************************** + * pci.c + * + * Architecture-independent PCI access functions. + */ + +#include <xen/pci.h> +#include <xen/pci_regs.h> + +int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap) +{ + u8 id; + int max_cap = 48; + u8 pos = PCI_CAPABILITY_LIST; + u16 status; + + status = pci_conf_read16(bus, dev, func, PCI_STATUS); + if ( (status & PCI_STATUS_CAP_LIST) == 0 ) + return 0; + + while ( max_cap-- ) + { + pos = pci_conf_read8(bus, dev, func, pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = pci_conf_read8(bus, dev, func, pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + else if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + + return 0; +} + +int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap) +{ + u8 id; + int ttl = 48; + + while ( ttl-- ) + { + pos = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), + pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + return 0; +} _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |