Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_pci.c
Show First 20 Lines • Show All 599 Lines • ▼ Show 20 Lines | _linux_pci_register_driver(struct pci_driver *pdrv, devclass_t dc) | ||||
linux_set_current(curthread); | linux_set_current(curthread); | ||||
spin_lock(&pci_lock); | spin_lock(&pci_lock); | ||||
list_add(&pdrv->links, &pci_drivers); | list_add(&pdrv->links, &pci_drivers); | ||||
spin_unlock(&pci_lock); | spin_unlock(&pci_lock); | ||||
pdrv->bsddriver.name = pdrv->name; | pdrv->bsddriver.name = pdrv->name; | ||||
pdrv->bsddriver.methods = pci_methods; | pdrv->bsddriver.methods = pci_methods; | ||||
pdrv->bsddriver.size = sizeof(struct pci_dev); | pdrv->bsddriver.size = sizeof(struct pci_dev); | ||||
mtx_lock(&Giant); | bus_topo_lock(); | ||||
error = devclass_add_driver(dc, &pdrv->bsddriver, | error = devclass_add_driver(dc, &pdrv->bsddriver, | ||||
BUS_PASS_DEFAULT, &pdrv->bsdclass); | BUS_PASS_DEFAULT, &pdrv->bsdclass); | ||||
mtx_unlock(&Giant); | bus_topo_unlock(); | ||||
return (-error); | return (-error); | ||||
} | } | ||||
int | int | ||||
linux_pci_register_driver(struct pci_driver *pdrv) | linux_pci_register_driver(struct pci_driver *pdrv) | ||||
{ | { | ||||
devclass_t dc; | devclass_t dc; | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
devclass_t bus; | devclass_t bus; | ||||
bus = devclass_find("pci"); | bus = devclass_find("pci"); | ||||
spin_lock(&pci_lock); | spin_lock(&pci_lock); | ||||
list_del(&pdrv->links); | list_del(&pdrv->links); | ||||
spin_unlock(&pci_lock); | spin_unlock(&pci_lock); | ||||
mtx_lock(&Giant); | bus_topo_lock(); | ||||
if (bus != NULL) | if (bus != NULL) | ||||
devclass_delete_driver(bus, &pdrv->bsddriver); | devclass_delete_driver(bus, &pdrv->bsddriver); | ||||
mtx_unlock(&Giant); | bus_topo_unlock(); | ||||
} | } | ||||
void | void | ||||
linux_pci_unregister_drm_driver(struct pci_driver *pdrv) | linux_pci_unregister_drm_driver(struct pci_driver *pdrv) | ||||
{ | { | ||||
devclass_t bus; | devclass_t bus; | ||||
bus = devclass_find("vgapci"); | bus = devclass_find("vgapci"); | ||||
spin_lock(&pci_lock); | spin_lock(&pci_lock); | ||||
list_del(&pdrv->links); | list_del(&pdrv->links); | ||||
spin_unlock(&pci_lock); | spin_unlock(&pci_lock); | ||||
mtx_lock(&Giant); | bus_topo_lock(); | ||||
if (bus != NULL) | if (bus != NULL) | ||||
devclass_delete_driver(bus, &pdrv->bsddriver); | devclass_delete_driver(bus, &pdrv->bsddriver); | ||||
mtx_unlock(&Giant); | bus_topo_unlock(); | ||||
} | } | ||||
CTASSERT(sizeof(dma_addr_t) <= sizeof(uint64_t)); | CTASSERT(sizeof(dma_addr_t) <= sizeof(uint64_t)); | ||||
struct linux_dma_obj { | struct linux_dma_obj { | ||||
void *vaddr; | void *vaddr; | ||||
uint64_t dma_addr; | uint64_t dma_addr; | ||||
bus_dmamap_t dmamap; | bus_dmamap_t dmamap; | ||||
▲ Show 20 Lines • Show All 486 Lines • Show Last 20 Lines |