changeset 10768:433b5e1b2cfc

6765706 Panic assertion failed: pwr_p->pwr_hold >0,file:../../sun4/io/px/pcie_pwr.c,line: 698
author Ramesh Chitrothu <Ramesh.Chitrothu@Sun.COM>
date Mon, 12 Oct 2009 15:34:36 -0700
parents 67bc80b80c57
children fc952250c2d4
files usr/src/uts/common/io/pciex/pcieb.c usr/src/uts/sun4/io/px/px.c
diffstat 2 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/pciex/pcieb.c	Tue Oct 13 05:30:12 2009 +0800
+++ b/usr/src/uts/common/io/pciex/pcieb.c	Mon Oct 12 15:34:36 2009 -0700
@@ -539,8 +539,17 @@
 			return (DDI_SUCCESS);
 
 		case DDI_POST:
-			if (as->cmd == DDI_ATTACH && as->result != DDI_SUCCESS)
-				pcie_pm_release(dip);
+			if (as->cmd == DDI_ATTACH &&
+			    as->result != DDI_SUCCESS) {
+				/*
+				 * Attach failed for the child device. The child
+				 * driver may have made PM calls before the
+				 * attach failed. pcie_pm_remove_child() should
+				 * cleanup PM state and holds (if any)
+				 * associated with the child device.
+				 */
+				return (pcie_pm_remove_child(dip, rdip));
+			}
 
 			if (as->result == DDI_SUCCESS) {
 				pf_init(rdip, (void *)pcieb->pcieb_fm_ibc,
--- a/usr/src/uts/sun4/io/px/px.c	Tue Oct 13 05:30:12 2009 +0800
+++ b/usr/src/uts/sun4/io/px/px.c	Mon Oct 12 15:34:36 2009 -0700
@@ -1238,8 +1238,17 @@
 		case DDI_POST:
 			DBG(DBG_PWR, dip, "POST_ATTACH for %s@%d\n",
 			    ddi_driver_name(rdip), ddi_get_instance(rdip));
-			if (as->cmd == DDI_ATTACH && as->result != DDI_SUCCESS)
-				pcie_pm_release(dip);
+			if (as->cmd == DDI_ATTACH &&
+			    as->result != DDI_SUCCESS) {
+				/*
+				 * Attach failed for the child device. The child
+				 * driver may have made PM calls before the
+				 * attach failed. pcie_pm_remove_child() should
+				 * cleanup PM state and holds (if any)
+				 * associated with the child device.
+				 */
+				return (pcie_pm_remove_child(dip, rdip));
+			}
 
 			if (as->result == DDI_SUCCESS)
 				pf_init(rdip, (void *)px_p->px_fm_ibc, as->cmd);