Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_pci.c
Show All 38 Lines | |||||
#include "opt_pci.h" | #include "opt_pci.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/pciio.h> | |||||
imp: Do you need the PCI ioctls here? You don't seem to add a reference to them..
| |||||
Done Inline Actionssys/dev/pcivar.h only exposes pci_devinfo when both sys/bus.h and sys/pciio.h are included. I need it for pdinfo in pcib_reset() below. kib: sys/dev/pcivar.h only exposes pci_devinfo when both sys/bus.h and sys/pciio.h are included. I… | |||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pci_private.h> | #include <dev/pci/pci_private.h> | ||||
Show All 20 Lines | static void pcib_ari_decode_rid(device_t pcib, uint16_t rid, | ||||
int *bus, int *slot, int *func); | int *bus, int *slot, int *func); | ||||
#ifdef PCI_HP | #ifdef PCI_HP | ||||
static void pcib_pcie_ab_timeout(void *arg); | static void pcib_pcie_ab_timeout(void *arg); | ||||
static void pcib_pcie_cc_timeout(void *arg); | static void pcib_pcie_cc_timeout(void *arg); | ||||
static void pcib_pcie_dll_timeout(void *arg); | static void pcib_pcie_dll_timeout(void *arg); | ||||
#endif | #endif | ||||
static int pcib_request_feature_default(device_t pcib, device_t dev, | static int pcib_request_feature_default(device_t pcib, device_t dev, | ||||
enum pci_feature feature); | enum pci_feature feature); | ||||
static int pcib_reset(device_t dev, device_t child, int flags); | |||||
static device_method_t pcib_methods[] = { | static device_method_t pcib_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, pcib_probe), | DEVMETHOD(device_probe, pcib_probe), | ||||
DEVMETHOD(device_attach, pcib_attach), | DEVMETHOD(device_attach, pcib_attach), | ||||
DEVMETHOD(device_detach, pcib_detach), | DEVMETHOD(device_detach, pcib_detach), | ||||
DEVMETHOD(device_shutdown, bus_generic_shutdown), | DEVMETHOD(device_shutdown, bus_generic_shutdown), | ||||
DEVMETHOD(device_suspend, pcib_suspend), | DEVMETHOD(device_suspend, pcib_suspend), | ||||
Show All 10 Lines | |||||
#else | #else | ||||
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), | DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), | ||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource), | DEVMETHOD(bus_release_resource, bus_generic_release_resource), | ||||
#endif | #endif | ||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), | DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), | ||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), | DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), | ||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), | DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), | ||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), | DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), | ||||
DEVMETHOD(bus_reset, pcib_reset), | |||||
/* pcib interface */ | /* pcib interface */ | ||||
DEVMETHOD(pcib_maxslots, pcib_ari_maxslots), | DEVMETHOD(pcib_maxslots, pcib_ari_maxslots), | ||||
DEVMETHOD(pcib_maxfuncs, pcib_ari_maxfuncs), | DEVMETHOD(pcib_maxfuncs, pcib_ari_maxfuncs), | ||||
DEVMETHOD(pcib_read_config, pcib_read_config), | DEVMETHOD(pcib_read_config, pcib_read_config), | ||||
DEVMETHOD(pcib_write_config, pcib_write_config), | DEVMETHOD(pcib_write_config, pcib_write_config), | ||||
DEVMETHOD(pcib_route_interrupt, pcib_route_interrupt), | DEVMETHOD(pcib_route_interrupt, pcib_route_interrupt), | ||||
DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi), | DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi), | ||||
▲ Show 20 Lines • Show All 2,786 Lines • ▼ Show 20 Lines | pcib_request_feature_default(device_t pcib, device_t dev, | ||||
/* | /* | ||||
* Our parent is necessarily a pci bus. Its parent will either be | * Our parent is necessarily a pci bus. Its parent will either be | ||||
* another pci bridge (which passes it up) or a host bridge that can | * another pci bridge (which passes it up) or a host bridge that can | ||||
* approve or reject the request. | * approve or reject the request. | ||||
*/ | */ | ||||
bus = device_get_parent(pcib); | bus = device_get_parent(pcib); | ||||
return (PCIB_REQUEST_FEATURE(device_get_parent(bus), dev, feature)); | return (PCIB_REQUEST_FEATURE(device_get_parent(bus), dev, feature)); | ||||
} | |||||
static int | |||||
pcib_reset(device_t dev, device_t child, int flags) | |||||
{ | |||||
struct pci_devinfo *pdinfo; | |||||
int error; | |||||
error = 0; | |||||
if (dev == NULL || device_get_parent(child) != dev) | |||||
goto out; | |||||
error = ENXIO; | |||||
if (device_get_devclass(child) != devclass_find("pci")) | |||||
goto out; | |||||
pdinfo = device_get_ivars(dev); | |||||
if (pdinfo->cfg.pcie.pcie_location != 0 && | |||||
(pdinfo->cfg.pcie.pcie_type != PCIEM_TYPE_DOWNSTREAM_PORT || | |||||
pdinfo->cfg.pcie.pcie_type == PCIEM_TYPE_ROOT_PORT)) { | |||||
error = bus_helper_reset_prepare(child, flags); | |||||
if (error == 0) { | |||||
error = pcie_link_reset(dev, | |||||
pdinfo->cfg.pcie.pcie_location); | |||||
/* XXXKIB call _post even if error != 0 ? */ | |||||
bus_helper_reset_post(child, flags); | |||||
} | |||||
} | |||||
out: | |||||
return (error); | |||||
} | } |
Do you need the PCI ioctls here? You don't seem to add a reference to them..