Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/pci.h
Show First 20 Lines • Show All 454 Lines • ▼ Show 20 Lines | linux_pci_disable_msi(struct pci_dev *pdev) | ||||
pci_release_msi(pdev->dev.bsddev); | pci_release_msi(pdev->dev.bsddev); | ||||
pdev->dev.irq_start = 0; | pdev->dev.irq_start = 0; | ||||
pdev->dev.irq_end = 0; | pdev->dev.irq_end = 0; | ||||
pdev->irq = pdev->dev.irq; | pdev->irq = pdev->dev.irq; | ||||
pdev->msi_enabled = false; | pdev->msi_enabled = false; | ||||
} | } | ||||
#define pci_free_irq_vectors(pdev) \ | |||||
linux_pci_disable_msi(pdev) | |||||
unsigned long pci_resource_start(struct pci_dev *pdev, int bar); | unsigned long pci_resource_start(struct pci_dev *pdev, int bar); | ||||
unsigned long pci_resource_len(struct pci_dev *pdev, int bar); | unsigned long pci_resource_len(struct pci_dev *pdev, int bar); | ||||
static inline bus_addr_t | static inline bus_addr_t | ||||
pci_bus_address(struct pci_dev *pdev, int bar) | pci_bus_address(struct pci_dev *pdev, int bar) | ||||
{ | { | ||||
return (pci_resource_start(pdev, bar)); | return (pci_resource_start(pdev, bar)); | ||||
▲ Show 20 Lines • Show All 226 Lines • ▼ Show 20 Lines | TAILQ_FOREACH_SAFE(mmio, &dev->mmio, next, p) { | ||||
bus_release_resource(dev->dev.bsddev, | bus_release_resource(dev->dev.bsddev, | ||||
mmio->type, mmio->rid, mmio->res); | mmio->type, mmio->rid, mmio->res); | ||||
TAILQ_REMOVE(&dev->mmio, mmio, next); | TAILQ_REMOVE(&dev->mmio, mmio, next); | ||||
free(mmio, M_DEVBUF); | free(mmio, M_DEVBUF); | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
static inline void | |||||
lkpi_pci_save_state(struct pci_dev *pdev) | |||||
{ | |||||
pci_save_state(pdev->dev.bsddev); | |||||
} | |||||
static inline void | |||||
lkpi_pci_restore_state(struct pci_dev *pdev) | |||||
{ | |||||
pci_restore_state(pdev->dev.bsddev); | |||||
} | |||||
#define pci_save_state(dev) lkpi_pci_save_state(dev) | |||||
#define pci_restore_state(dev) lkpi_pci_restore_state(dev) | |||||
#define DEFINE_PCI_DEVICE_TABLE(_table) \ | #define DEFINE_PCI_DEVICE_TABLE(_table) \ | ||||
const struct pci_device_id _table[] __devinitdata | const struct pci_device_id _table[] __devinitdata | ||||
/* XXX This should not be necessary. */ | /* XXX This should not be necessary. */ | ||||
#define pcix_set_mmrbc(d, v) 0 | #define pcix_set_mmrbc(d, v) 0 | ||||
#define pcix_get_max_mmrbc(d) 0 | #define pcix_get_max_mmrbc(d) 0 | ||||
#define pcie_set_readrq(d, v) pci_set_max_read_req(&(d)->dev, (v)) | #define pcie_set_readrq(d, v) pci_set_max_read_req(&(d)->dev, (v)) | ||||
▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | pci_dev_present(const struct pci_device_id *cur) | ||||
while (cur != NULL && (cur->vendor || cur->device)) { | while (cur != NULL && (cur->vendor || cur->device)) { | ||||
if (pci_find_device(cur->vendor, cur->device) != NULL) { | if (pci_find_device(cur->vendor, cur->device) != NULL) { | ||||
return (1); | return (1); | ||||
} | } | ||||
cur++; | cur++; | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static inline bool | |||||
pci_is_root_bus(struct pci_bus *pbus) | |||||
{ | |||||
return (pbus->self == NULL); | |||||
} | |||||
struct pci_dev *lkpi_pci_get_domain_bus_and_slot(int domain, | |||||
unsigned int bus, unsigned int devfn); | |||||
#define pci_get_domain_bus_and_slot(domain, bus, devfn) \ | |||||
lkpi_pci_get_domain_bus_and_slot(domain, bus, devfn) | |||||
static inline int | |||||
pci_domain_nr(struct pci_bus *pbus) | |||||
{ | |||||
return (pci_get_domain(pbus->self->dev.bsddev)); | |||||
} | |||||
static inline int | |||||
pci_bus_read_config(struct pci_bus *bus, unsigned int devfn, | |||||
int pos, uint32_t *val, int len) | |||||
{ | |||||
*val = pci_read_config(bus->self->dev.bsddev, pos, len); | |||||
return (0); | |||||
} | |||||
static inline int | |||||
pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn, int pos, u16 *val) | |||||
{ | |||||
uint32_t tmp; | |||||
int ret; | |||||
ret = pci_bus_read_config(bus, devfn, pos, &tmp, 2); | |||||
*val = (u16)tmp; | |||||
return (ret); | |||||
} | |||||
static inline int | |||||
pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, int pos, u8 *val) | |||||
{ | |||||
uint32_t tmp; | |||||
int ret; | |||||
ret = pci_bus_read_config(bus, devfn, pos, &tmp, 1); | |||||
*val = (u8)tmp; | |||||
return (ret); | |||||
} | |||||
static inline int | |||||
pci_bus_write_config(struct pci_bus *bus, unsigned int devfn, int pos, | |||||
uint32_t val, int size) | |||||
{ | |||||
pci_write_config(bus->self->dev.bsddev, pos, val, size); | |||||
return (0); | |||||
} | |||||
static inline int | |||||
pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn, int pos, | |||||
uint8_t val) | |||||
{ | |||||
return (pci_bus_write_config(bus, devfn, pos, val, 1)); | |||||
} | |||||
static inline int | |||||
pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, int pos, | |||||
uint16_t val) | |||||
{ | |||||
return (pci_bus_write_config(bus, devfn, pos, val, 2)); | |||||
} | |||||
struct pci_dev *lkpi_pci_get_class(unsigned int class, struct pci_dev *from); | |||||
#define pci_get_class(class, from) lkpi_pci_get_class(class, from) | |||||
#endif /* _LINUX_PCI_H_ */ | #endif /* _LINUX_PCI_H_ */ |