changeset 21410:6fec3e496bcb

10938 PCI hotplug probe doesn't properly handle ARI devices Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Peter Tribble <peter.tribble@gmail.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Gergő Doma <domag02@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
author Robert Mustacchi <rm@joyent.com>
date Tue, 19 Dec 2017 00:40:27 +0000
parents de7115fb7b83
children 31c8c83cb060
files usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c	Sun Jun 02 21:54:47 2019 +0000
+++ b/usr/src/uts/intel/io/hotplug/pcicfg/pcicfg.c	Tue Dec 19 00:40:27 2017 +0000
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Joyent, Inc.
  */
 
 /*
@@ -557,7 +558,7 @@
 	pci_bus_range_t pci_bus_range;
 	int rv;
 	int circ;
-	uint_t highest_bus;
+	uint_t highest_bus, visited = 0;
 	int ari_mode = B_FALSE;
 	int max_function = PCI_MAX_FUNCTIONS;
 	int trans_device;
@@ -669,6 +670,11 @@
 				goto cleanup;
 		}
 
+		/*
+		 * Note that we've successfully gone through and visited at
+		 * least one node.
+		 */
+		visited++;
 next:
 		/*
 		 * Determine if ARI Forwarding should be enabled.
@@ -696,7 +702,7 @@
 				goto cleanup;
 
 			/*
-			 * Check if there are more fucntions to probe.
+			 * Check if there are more functions to probe.
 			 */
 			if (next_function == 0) {
 				DEBUG0("Next Function - "
@@ -712,7 +718,7 @@
 
 	ndi_devi_exit(devi, circ);
 
-	if (func == 0)
+	if (visited == 0)
 		return (PCICFG_FAILURE);	/* probe failed */
 	else
 		return (PCICFG_SUCCESS);