diff options
Diffstat (limited to 'sys/dev/thunderbolt')
| -rw-r--r-- | sys/dev/thunderbolt/nhi.c | 1 | ||||
| -rw-r--r-- | sys/dev/thunderbolt/nhi_pci.c | 10 | ||||
| -rw-r--r-- | sys/dev/thunderbolt/nhi_var.h | 1 | ||||
| -rw-r--r-- | sys/dev/thunderbolt/tb_pcib.c | 14 | 
4 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/thunderbolt/nhi.c b/sys/dev/thunderbolt/nhi.c index 205e69c16253..30a72652535a 100644 --- a/sys/dev/thunderbolt/nhi.c +++ b/sys/dev/thunderbolt/nhi.c @@ -322,6 +322,7 @@ nhi_detach(struct nhi_softc *sc)  	tbdev_remove_interface(sc);  	nhi_pci_disable_interrupts(sc); +	nhi_pci_free_interrupts(sc);  	nhi_free_ring0(sc); diff --git a/sys/dev/thunderbolt/nhi_pci.c b/sys/dev/thunderbolt/nhi_pci.c index 7dacff523cef..865963e275ec 100644 --- a/sys/dev/thunderbolt/nhi_pci.c +++ b/sys/dev/thunderbolt/nhi_pci.c @@ -67,7 +67,7 @@ static int	nhi_pci_suspend(device_t);  static int	nhi_pci_resume(device_t);  static void	nhi_pci_free(struct nhi_softc *);  static int	nhi_pci_allocate_interrupts(struct nhi_softc *); -static void	nhi_pci_free_interrupts(struct nhi_softc *); +static void	nhi_pci_free_resources(struct nhi_softc *);  static int	nhi_pci_icl_poweron(struct nhi_softc *);  static device_method_t nhi_methods[] = { @@ -253,7 +253,7 @@ static void  nhi_pci_free(struct nhi_softc *sc)  { -	nhi_pci_free_interrupts(sc); +	nhi_pci_free_resources(sc);  	if (sc->parent_dmat != NULL) {  		bus_dma_tag_destroy(sc->parent_dmat); @@ -307,7 +307,7 @@ nhi_pci_allocate_interrupts(struct nhi_softc *sc)  	return (error);  } -static void +void  nhi_pci_free_interrupts(struct nhi_softc *sc)  {  	int i; @@ -319,7 +319,11 @@ nhi_pci_free_interrupts(struct nhi_softc *sc)  	}  	pci_release_msi(sc->dev); +} +static void +nhi_pci_free_resources(struct nhi_softc *sc) +{  	if (sc->irq_table != NULL) {  		bus_release_resource(sc->dev, SYS_RES_MEMORY,  		    sc->irq_table_rid, sc->irq_table); diff --git a/sys/dev/thunderbolt/nhi_var.h b/sys/dev/thunderbolt/nhi_var.h index 2b9e878af47d..e79ecc954c1f 100644 --- a/sys/dev/thunderbolt/nhi_var.h +++ b/sys/dev/thunderbolt/nhi_var.h @@ -217,6 +217,7 @@ struct nhi_dispatch {  int nhi_pci_configure_interrupts(struct nhi_softc *sc);  void nhi_pci_enable_interrupt(struct nhi_ring_pair *r);  void nhi_pci_disable_interrupts(struct nhi_softc *sc); +void nhi_pci_free_interrupts(struct nhi_softc *sc);  int nhi_pci_get_uuid(struct nhi_softc *sc);  int nhi_read_lc_mailbox(struct nhi_softc *, u_int reg, uint32_t *val);  int nhi_write_lc_mailbox(struct nhi_softc *, u_int reg, uint32_t val); diff --git a/sys/dev/thunderbolt/tb_pcib.c b/sys/dev/thunderbolt/tb_pcib.c index 00738984ad1c..bc4fc1ce00ec 100644 --- a/sys/dev/thunderbolt/tb_pcib.c +++ b/sys/dev/thunderbolt/tb_pcib.c @@ -557,8 +557,20 @@ static int  tb_pci_probe(device_t dev)  {  	struct tb_pcib_ident *n; +	device_t parent; +	devclass_t dc; -	if ((n = tb_pcib_find_ident(device_get_parent(dev))) != NULL) { +	/* +	 * This driver is only valid if the parent device is a PCI-PCI +	 * bridge.  To determine that, check if the grandparent is a +	 * PCI bus. +	 */ +	parent = device_get_parent(dev); +	dc = device_get_devclass(device_get_parent(parent)); +	if (strcmp(devclass_get_name(dc), "pci") != 0) +		return (ENXIO); + +	if ((n = tb_pcib_find_ident(parent)) != NULL) {  		switch (n->flags & TB_GEN_MASK) {  		case TB_GEN_TB1:  			device_set_desc(dev, "Thunderbolt 1 Link");  | 
