[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Merge
# HG changeset patch # User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> # Date 1321981752 0 # Node ID 53bec838bb083a56211dd2d184be98578be4c37e # Parent 8edcd2e3f3f1751d3e85b7612d1fa72c8d071047 # Parent 2b5c6fff0e5b51035656a4af8214c724defce17b Merge --- diff -r 8edcd2e3f3f1 -r 53bec838bb08 xen/arch/ia64/xen/pci.c --- a/xen/arch/ia64/xen/pci.c Tue Nov 22 17:07:32 2011 +0000 +++ b/xen/arch/ia64/xen/pci.c Tue Nov 22 17:09:12 2011 +0000 @@ -135,8 +135,3 @@ BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255)); pci_sal_write(seg, bus, (dev<<3)|func, reg, 4, data); } - -int pci_find_ext_capability(int seg, int bus, int devfn, int cap) -{ - return 0; -} diff -r 8edcd2e3f3f1 -r 53bec838bb08 xen/arch/x86/x86_32/pci.c --- a/xen/arch/x86/x86_32/pci.c Tue Nov 22 17:07:32 2011 +0000 +++ b/xen/arch/x86/x86_32/pci.c Tue Nov 22 17:09:12 2011 +0000 @@ -15,9 +15,9 @@ unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg) { - if ( seg ) + if ( seg || (reg > 255) ) return ~0; - BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255)); + BUG_ON((bus > 255) || (dev > 31) || (func > 7)); return pci_conf_read(PCI_CONF_ADDRESS(bus, dev, func, reg), reg & 3, 1); } @@ -25,9 +25,9 @@ unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg) { - if ( seg ) + if ( seg || (reg > 255) ) return ~0; - BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255)); + BUG_ON((bus > 255) || (dev > 31) || (func > 7)); return pci_conf_read(PCI_CONF_ADDRESS(bus, dev, func, reg), reg & 2, 2); } @@ -35,9 +35,9 @@ unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg) { - if ( seg ) + if ( seg || (reg > 255) ) return ~0; - BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255)); + BUG_ON((bus > 255) || (dev > 31) || (func > 7)); return pci_conf_read(PCI_CONF_ADDRESS(bus, dev, func, reg), 0, 4); } @@ -70,8 +70,3 @@ BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255)); pci_conf_write(PCI_CONF_ADDRESS(bus, dev, func, reg), 0, 4, data); } - -int pci_find_ext_capability(int seg, int bus, int devfn, int cap) -{ - return 0; -} diff -r 8edcd2e3f3f1 -r 53bec838bb08 xen/arch/x86/x86_64/mmconfig-shared.c --- a/xen/arch/x86/x86_64/mmconfig-shared.c Tue Nov 22 17:07:32 2011 +0000 +++ b/xen/arch/x86/x86_64/mmconfig-shared.c Tue Nov 22 17:09:12 2011 +0000 @@ -450,43 +450,3 @@ return -ENODEV; } - -/** - * pci_find_ext_capability - Find an extended capability - * @dev: PCI device to query - * @cap: capability code - * - * Returns the address of the requested extended capability structure - * within the device's PCI configuration space or 0 if the device does - * not support it. Possible values for @cap: - * - * %PCI_EXT_CAP_ID_ERR Advanced Error Reporting - * %PCI_EXT_CAP_ID_VC Virtual Channel - * %PCI_EXT_CAP_ID_DSN Device Serial Number - * %PCI_EXT_CAP_ID_PWR Power Budgeting - */ -int pci_find_ext_capability(int seg, int bus, int devfn, int cap) -{ - u32 header; - int ttl = 480; /* 3840 bytes, minimum 8 bytes per capability */ - int pos = 0x100; - - header = pci_conf_read32(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); - - /* - * If we have no capabilities, this is indicated by cap ID, - * cap version and next pointer all being 0. - */ - if ( (header == 0) || (header == -1) ) - return 0; - - while ( ttl-- > 0 ) { - if ( PCI_EXT_CAP_ID(header) == cap ) - return pos; - pos = PCI_EXT_CAP_NEXT(header); - if ( pos < 0x100 ) - break; - header = pci_conf_read32(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); - } - return 0; -} diff -r 8edcd2e3f3f1 -r 53bec838bb08 xen/drivers/pci/pci.c --- a/xen/drivers/pci/pci.c Tue Nov 22 17:07:32 2011 +0000 +++ b/xen/drivers/pci/pci.c Tue Nov 22 17:09:12 2011 +0000 @@ -62,3 +62,43 @@ } return 0; } + +/** + * pci_find_ext_capability - Find an extended capability + * @dev: PCI device to query + * @cap: capability code + * + * Returns the address of the requested extended capability structure + * within the device's PCI configuration space or 0 if the device does + * not support it. Possible values for @cap: + * + * %PCI_EXT_CAP_ID_ERR Advanced Error Reporting + * %PCI_EXT_CAP_ID_VC Virtual Channel + * %PCI_EXT_CAP_ID_DSN Device Serial Number + * %PCI_EXT_CAP_ID_PWR Power Budgeting + */ +int pci_find_ext_capability(int seg, int bus, int devfn, int cap) +{ + u32 header; + int ttl = 480; /* 3840 bytes, minimum 8 bytes per capability */ + int pos = 0x100; + + header = pci_conf_read32(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); + + /* + * If we have no capabilities, this is indicated by cap ID, + * cap version and next pointer all being 0. + */ + if ( (header == 0) || (header == -1) ) + return 0; + + while ( ttl-- > 0 ) { + if ( PCI_EXT_CAP_ID(header) == cap ) + return pos; + pos = PCI_EXT_CAP_NEXT(header); + if ( pos < 0x100 ) + break; + header = pci_conf_read32(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); + } + return 0; +} _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |