Subversion Repositories Kolibri OS

Rev

Rev 6936 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6936 Rev 7143
Line 740... Line 740...
740
 
740
 
741
#define PCI_VDEVICE(vend, dev) \
741
#define PCI_VDEVICE(vend, dev) \
742
	.vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
742
	.vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
Line -... Line 743...
-
 
743
	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
-
 
744
 
-
 
745
enum {
-
 
746
	PCI_REASSIGN_ALL_RSRC	= 0x00000001,	/* ignore firmware setup */
-
 
747
	PCI_REASSIGN_ALL_BUS	= 0x00000002,	/* reassign all bus numbers */
-
 
748
	PCI_PROBE_ONLY		= 0x00000004,	/* use existing setup */
-
 
749
	PCI_CAN_SKIP_ISA_ALIGN	= 0x00000008,	/* don't do ISA alignment */
-
 
750
	PCI_ENABLE_PROC_DOMAINS	= 0x00000010,	/* enable domains in /proc */
-
 
751
	PCI_COMPAT_DOMAIN_0	= 0x00000020,	/* ... except domain 0 */
-
 
752
	PCI_SCAN_ALL_PCIE_DEVS	= 0x00000040,	/* scan all, not just dev 0 */
743
	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
753
};
744
 
754
 
Line -... Line 755...
-
 
755
/* these external functions are only available when PCI support is enabled */
-
 
756
#ifdef CONFIG_PCI
-
 
757
 
-
 
758
extern unsigned int pci_flags;
-
 
759
 
-
 
760
static inline void pci_set_flags(int flags) { pci_flags = flags; }
-
 
761
static inline void pci_add_flags(int flags) { pci_flags |= flags; }
745
/* these external functions are only available when PCI support is enabled */
762
static inline void pci_clear_flags(int flags) { pci_flags &= ~flags; }
Line 746... Line 763...
746
#ifdef CONFIG_PCI
763
static inline int pci_has_flag(int flag) { return pci_flags & flag; }
747
 
764
 
748
void pcie_bus_configure_settings(struct pci_bus *bus);
765
void pcie_bus_configure_settings(struct pci_bus *bus);
Line 764... Line 781...
764
extern struct list_head pci_root_buses;	/* list of all known PCI buses */
781
extern struct list_head pci_root_buses;	/* list of all known PCI buses */
765
/* Some device drivers need know if PCI is initiated */
782
/* Some device drivers need know if PCI is initiated */
766
int no_pci_devices(void);
783
int no_pci_devices(void);
Line 767... Line 784...
767
 
784
 
-
 
785
void pcibios_resource_survey_bus(struct pci_bus *bus);
768
void pcibios_resource_survey_bus(struct pci_bus *bus);
786
void pcibios_bus_add_device(struct pci_dev *pdev);
769
void pcibios_add_bus(struct pci_bus *bus);
787
void pcibios_add_bus(struct pci_bus *bus);
770
void pcibios_remove_bus(struct pci_bus *bus);
788
void pcibios_remove_bus(struct pci_bus *bus);
771
void pcibios_fixup_bus(struct pci_bus *);
789
void pcibios_fixup_bus(struct pci_bus *);
772
int __must_check pcibios_enable_device(struct pci_dev *, int mask);
790
int __must_check pcibios_enable_device(struct pci_dev *, int mask);
Line 1004... Line 1022...
1004
void pci_clear_mwi(struct pci_dev *dev);
1022
void pci_clear_mwi(struct pci_dev *dev);
1005
void pci_intx(struct pci_dev *dev, int enable);
1023
void pci_intx(struct pci_dev *dev, int enable);
1006
bool pci_intx_mask_supported(struct pci_dev *dev);
1024
bool pci_intx_mask_supported(struct pci_dev *dev);
1007
bool pci_check_and_mask_intx(struct pci_dev *dev);
1025
bool pci_check_and_mask_intx(struct pci_dev *dev);
1008
bool pci_check_and_unmask_intx(struct pci_dev *dev);
1026
bool pci_check_and_unmask_intx(struct pci_dev *dev);
1009
int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
-
 
1010
int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
-
 
1011
int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask);
1027
int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask);
1012
int pci_wait_for_pending_transaction(struct pci_dev *dev);
1028
int pci_wait_for_pending_transaction(struct pci_dev *dev);
1013
int pcix_get_max_mmrbc(struct pci_dev *dev);
1029
int pcix_get_max_mmrbc(struct pci_dev *dev);
1014
int pcix_get_mmrbc(struct pci_dev *dev);
1030
int pcix_get_mmrbc(struct pci_dev *dev);
1015
int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
1031
int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
Line 1098... Line 1114...
1098
void pci_unlock_rescan_remove(void);
1114
void pci_unlock_rescan_remove(void);
Line 1099... Line 1115...
1099
 
1115
 
1100
/* Vital product data routines */
1116
/* Vital product data routines */
1101
ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
1117
ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
-
 
1118
ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
Line 1102... Line 1119...
1102
ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
1119
int pci_set_vpd_size(struct pci_dev *dev, size_t len);
1103
 
1120
 
1104
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
1121
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
1105
resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
1122
resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
Line 1229... Line 1246...
1229
#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
1246
#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
1230
#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
1247
#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
Line 1231... Line 1248...
1231
 
1248
 
1232
int pci_set_vga_state(struct pci_dev *pdev, bool decode,
1249
int pci_set_vga_state(struct pci_dev *pdev, bool decode,
-
 
1250
		      unsigned int command_bits, u32 flags);
1233
		      unsigned int command_bits, u32 flags);
1251
 
Line 1234... Line 1252...
1234
/* kmem_cache style wrapper around pci_alloc_consistent() */
1252
/* kmem_cache style wrapper around pci_alloc_consistent() */
1235
 
1253
 
Line 1396... Line 1414...
1396
		      unsigned int command_bits, u32 flags);
1414
		      unsigned int command_bits, u32 flags);
1397
void pci_register_set_vga_state(arch_set_vga_state_t func);
1415
void pci_register_set_vga_state(arch_set_vga_state_t func);
Line 1398... Line 1416...
1398
 
1416
 
Line -... Line 1417...
-
 
1417
#else /* CONFIG_PCI is not enabled */
-
 
1418
 
-
 
1419
static inline void pci_set_flags(int flags) { }
-
 
1420
static inline void pci_add_flags(int flags) { }
-
 
1421
static inline void pci_clear_flags(int flags) { }
1399
#else /* CONFIG_PCI is not enabled */
1422
static inline int pci_has_flag(int flag) { return 0; }
1400
 
1423
 
1401
/*
1424
/*
1402
 *  If the system does not have PCI, clearly these return errors.  Define
1425
 *  If the system does not have PCI, clearly these return errors.  Define
Line 1435... Line 1458...
1435
#define pci_dev_put(dev)	do { } while (0)
1458
#define pci_dev_put(dev)	do { } while (0)
Line 1436... Line 1459...
1436
 
1459
 
1437
static inline void pci_set_master(struct pci_dev *dev) { }
1460
static inline void pci_set_master(struct pci_dev *dev) { }
1438
static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; }
1461
static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; }
1439
static inline void pci_disable_device(struct pci_dev *dev) { }
-
 
1440
static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
-
 
1441
{ return -EIO; }
-
 
1442
static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
-
 
1443
{ return -EIO; }
-
 
1444
static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
-
 
1445
					unsigned int size)
-
 
1446
{ return -EIO; }
-
 
1447
static inline int pci_set_dma_seg_boundary(struct pci_dev *dev,
-
 
1448
					unsigned long mask)
-
 
1449
{ return -EIO; }
1462
static inline void pci_disable_device(struct pci_dev *dev) { }
1450
static inline int pci_assign_resource(struct pci_dev *dev, int i)
1463
static inline int pci_assign_resource(struct pci_dev *dev, int i)
1451
{ return -EBUSY; }
1464
{ return -EBUSY; }
1452
static inline int __pci_register_driver(struct pci_driver *drv,
1465
static inline int __pci_register_driver(struct pci_driver *drv,
1453
					struct module *owner)
1466
					struct module *owner)
Line 1506... Line 1519...
1506
 
1519
 
Line 1507... Line 1520...
1507
/* Include architecture-dependent settings and functions */
1520
/* Include architecture-dependent settings and functions */
Line -... Line 1521...
-
 
1521
 
-
 
1522
#include 
-
 
1523
 
-
 
1524
#ifndef pci_root_bus_fwnode
1508
 
1525
#define pci_root_bus_fwnode(bus)	NULL
1509
#include 
1526
#endif
1510
 
1527
 
1511
/* these helpers provide future and backwards compatibility
1528
/* these helpers provide future and backwards compatibility
1512
 * for accessing popular PCI BAR info */
1529
 * for accessing popular PCI BAR info */
Line 1729... Line 1746...
1729
int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
1746
int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
1730
int pci_iov_virtfn_devfn(struct pci_dev *dev, int id);
1747
int pci_iov_virtfn_devfn(struct pci_dev *dev, int id);
Line 1731... Line 1748...
1731
 
1748
 
1732
int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1749
int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
-
 
1750
void pci_disable_sriov(struct pci_dev *dev);
-
 
1751
int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset);
1733
void pci_disable_sriov(struct pci_dev *dev);
1752
void pci_iov_remove_virtfn(struct pci_dev *dev, int id, int reset);
1734
int pci_num_vf(struct pci_dev *dev);
1753
int pci_num_vf(struct pci_dev *dev);
1735
int pci_vfs_assigned(struct pci_dev *dev);
1754
int pci_vfs_assigned(struct pci_dev *dev);
1736
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1755
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1737
int pci_sriov_get_totalvfs(struct pci_dev *dev);
1756
int pci_sriov_get_totalvfs(struct pci_dev *dev);
Line 1745... Line 1764...
1745
{
1764
{
1746
	return -ENOSYS;
1765
	return -ENOSYS;
1747
}
1766
}
1748
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1767
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1749
{ return -ENODEV; }
1768
{ return -ENODEV; }
-
 
1769
static inline int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)
-
 
1770
{
-
 
1771
	return -ENOSYS;
-
 
1772
}
-
 
1773
static inline void pci_iov_remove_virtfn(struct pci_dev *dev,
-
 
1774
					 int id, int reset) { }
1750
static inline void pci_disable_sriov(struct pci_dev *dev) { }
1775
static inline void pci_disable_sriov(struct pci_dev *dev) { }
1751
static inline int pci_num_vf(struct pci_dev *dev) { return 0; }
1776
static inline int pci_num_vf(struct pci_dev *dev) { return 0; }
1752
static inline int pci_vfs_assigned(struct pci_dev *dev)
1777
static inline int pci_vfs_assigned(struct pci_dev *dev)
1753
{ return 0; }
1778
{ return 0; }
1754
static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1779
static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
Line 1825... Line 1850...
1825
#define PCI_VPD_LRDT_ID_STRING		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING)
1850
#define PCI_VPD_LRDT_ID_STRING		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING)
1826
#define PCI_VPD_LRDT_RO_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA)
1851
#define PCI_VPD_LRDT_RO_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA)
1827
#define PCI_VPD_LRDT_RW_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
1852
#define PCI_VPD_LRDT_RW_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
Line 1828... Line 1853...
1828
 
1853
 
1829
/* Small Resource Data Type Tag Item Names */
1854
/* Small Resource Data Type Tag Item Names */
Line 1830... Line 1855...
1830
#define PCI_VPD_STIN_END		0x78	/* End */
1855
#define PCI_VPD_STIN_END		0x0f	/* End */
Line 1831... Line 1856...
1831
 
1856
 
1832
#define PCI_VPD_SRDT_END		PCI_VPD_STIN_END
1857
#define PCI_VPD_SRDT_END		(PCI_VPD_STIN_END << 3)
-
 
1858
 
Line 1833... Line 1859...
1833
 
1859
#define PCI_VPD_SRDT_TIN_MASK		0x78
1834
#define PCI_VPD_SRDT_TIN_MASK		0x78
1860
#define PCI_VPD_SRDT_LEN_MASK		0x07
Line 1835... Line 1861...
1835
#define PCI_VPD_SRDT_LEN_MASK		0x07
1861
#define PCI_VPD_LRDT_TIN_MASK		0x7f
Line 1854... Line 1880...
1854
{
1880
{
1855
	return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
1881
	return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
1856
}
1882
}
Line 1857... Line 1883...
1857
 
1883
 
-
 
1884
/**
-
 
1885
 * pci_vpd_lrdt_tag - Extracts the Large Resource Data Type Tag Item
-
 
1886
 * @lrdt: Pointer to the beginning of the Large Resource Data Type tag
-
 
1887
 *
-
 
1888
 * Returns the extracted Large Resource Data Type Tag item.
-
 
1889
 */
-
 
1890
static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt)
-
 
1891
{
-
 
1892
    return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK);
-
 
1893
}
-
 
1894
 
1858
/**
1895
/**
1859
 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
1896
 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
1860
 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag
1897
 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag
1861
 *
1898
 *
1862
 * Returns the extracted Small Resource Data Type length.
1899
 * Returns the extracted Small Resource Data Type length.
Line 1865... Line 1902...
1865
{
1902
{
1866
	return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
1903
	return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
1867
}
1904
}
Line 1868... Line 1905...
1868
 
1905
 
-
 
1906
/**
-
 
1907
 * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
-
 
1908
 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag
-
 
1909
 *
-
 
1910
 * Returns the extracted Small Resource Data Type Tag Item.
-
 
1911
 */
-
 
1912
static inline u8 pci_vpd_srdt_tag(const u8 *srdt)
-
 
1913
{
-
 
1914
	return ((*srdt) & PCI_VPD_SRDT_TIN_MASK) >> 3;
-
 
1915
}
-
 
1916
 
1869
/**
1917
/**
1870
 * pci_vpd_info_field_size - Extracts the information field length
1918
 * pci_vpd_info_field_size - Extracts the information field length
1871
 * @lrdt: Pointer to the beginning of an information field header
1919
 * @lrdt: Pointer to the beginning of an information field header
1872
 *
1920
 *
1873
 * Returns the extracted information field length.
1921
 * Returns the extracted information field length.
Line 1981... Line 2029...
1981
static inline bool pci_ari_enabled(struct pci_bus *bus)
2029
static inline bool pci_ari_enabled(struct pci_bus *bus)
1982
{
2030
{
1983
	return bus->self && bus->self->ari_enabled;
2031
	return bus->self && bus->self->ari_enabled;
1984
}
2032
}
Line -... Line 2033...
-
 
2033
 
-
 
2034
/* provide the legacy pci_dma_* API */
-
 
2035
#include 
1985
 
2036
 
1986
typedef struct
2037
typedef struct
1987
{
2038
{
1988
	struct list_head    link;
2039
	struct list_head    link;
1989
	struct pci_dev      pci_dev;
2040
	struct pci_dev      pci_dev;