changeset 3971:ad0c51c3d2f2

6505228 fix for 6328213 seems to have broken bofi 6529479 ddi_fm_fini should check if device is ERRCB_CAPABLE before calling ddi_fm_handler_unregister
author stephh
date Thu, 05 Apr 2007 03:14:36 -0700
parents e0cf0f3e7aa4
children cf5de7ce56fd
files usr/src/uts/common/io/bofi.c usr/src/uts/common/os/ddifm.c usr/src/uts/common/sys/bofi_impl.h
diffstat 3 files changed, 44 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/bofi.c	Thu Apr 05 02:55:03 2007 -0700
+++ b/usr/src/uts/common/io/bofi.c	Thu Apr 05 03:14:36 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -402,7 +402,8 @@
  * ddi_dmareq_mapin()
  */
 static void
-ddi_dmareq_mapout(caddr_t addr, offset_t len)
+ddi_dmareq_mapout(caddr_t addr, offset_t len, int map_flags, page_t *pp,
+    page_t **pplist)
 {
 	struct buf buf;
 
@@ -411,9 +412,11 @@
 	/*
 	 * mock up a buf structure
 	 */
-	buf.b_flags = B_REMAPPED;
+	buf.b_flags = B_REMAPPED | map_flags;
 	buf.b_un.b_addr = addr;
 	buf.b_bcount = (size_t)len;
+	buf.b_pages = pp;
+	buf.b_shadow = pplist;
 	bp_mapout(&buf);
 }
 
@@ -3364,6 +3367,15 @@
 	hp->instance = ddi_get_instance(rdip);
 	hp->dip = rdip;
 	hp->flags = dmareqp->dmar_flags;
+	if (dmareqp->dmar_object.dmao_type == DMA_OTYP_PAGES) {
+		hp->map_flags = B_PAGEIO;
+		hp->map_pp = dmareqp->dmar_object.dmao_obj.pp_obj.pp_pp;
+	} else if (dmareqp->dmar_object.dmao_obj.virt_obj.v_priv != NULL) {
+		hp->map_flags = B_SHADOW;
+		hp->map_pplist = dmareqp->dmar_object.dmao_obj.virt_obj.v_priv;
+	} else {
+		hp->map_flags = 0;
+	}
 	hp->link = NULL;
 	hp->type = BOFI_DMA_HDL;
 	/*
@@ -3479,7 +3491,8 @@
 	}
 error2:
 	if (hp) {
-		ddi_dmareq_mapout(hp->mapaddr, hp->len);
+		ddi_dmareq_mapout(hp->mapaddr, hp->len, hp->map_flags,
+		    hp->map_pp, hp->map_pplist);
 		if (bofi_sync_check && hp->allocaddr)
 			ddi_umem_free(hp->umem_cookie);
 		kmem_free(hp, sizeof (struct bofi_shadow));
@@ -3693,6 +3706,15 @@
 		return (DDI_DMA_INUSE);
 
 	hp->flags = dmareqp->dmar_flags;
+	if (dmareqp->dmar_object.dmao_type == DMA_OTYP_PAGES) {
+		hp->map_flags = B_PAGEIO;
+		hp->map_pp = dmareqp->dmar_object.dmao_obj.pp_obj.pp_pp;
+	} else if (dmareqp->dmar_object.dmao_obj.virt_obj.v_priv != NULL) {
+		hp->map_flags = B_SHADOW;
+		hp->map_pplist = dmareqp->dmar_object.dmao_obj.virt_obj.v_priv;
+	} else {
+		hp->map_flags = 0;
+	}
 	/*
 	 * get a kernel virtual mapping
 	 */
@@ -3760,7 +3782,8 @@
 	}
 error2:
 	if (hp) {
-		ddi_dmareq_mapout(hp->mapaddr, hp->len);
+		ddi_dmareq_mapout(hp->mapaddr, hp->len, hp->map_flags,
+		    hp->map_pp, hp->map_pplist);
 		if (bofi_sync_check && hp->allocaddr)
 			ddi_umem_free(hp->umem_cookie);
 		hp->mapaddr = NULL;
@@ -3839,7 +3862,8 @@
 		 */
 		if (hp->allocaddr)
 			xbcopy(hp->addr, hp->origaddr, hp->len);
-	ddi_dmareq_mapout(hp->mapaddr, hp->len);
+	ddi_dmareq_mapout(hp->mapaddr, hp->len, hp->map_flags,
+	    hp->map_pp, hp->map_pplist);
 	if (bofi_sync_check && hp->allocaddr)
 		ddi_umem_free(hp->umem_cookie);
 	hp->mapaddr = NULL;
@@ -4103,7 +4127,8 @@
 		if (bofi_sync_check && (hp->flags & DDI_DMA_READ))
 			if (hp->allocaddr)
 				xbcopy(hp->addr, hp->origaddr, hp->len);
-		ddi_dmareq_mapout(hp->mapaddr, hp->len);
+		ddi_dmareq_mapout(hp->mapaddr, hp->len, hp->map_flags,
+		    hp->map_pp, hp->map_pplist);
 		if (bofi_sync_check && hp->allocaddr)
 			ddi_umem_free(hp->umem_cookie);
 		kmem_free(hp, sizeof (struct bofi_shadow));
--- a/usr/src/uts/common/os/ddifm.c	Thu Apr 05 02:55:03 2007 -0700
+++ b/usr/src/uts/common/os/ddifm.c	Thu Apr 05 03:14:36 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -772,7 +772,11 @@
 	}
 
 	if (dip != ddi_root_node()) {
-		ddi_fm_handler_unregister(dip);
+		if (DDI_FM_ERRCB_CAP(fmhdl->fh_cap)) {
+			ddi_fm_handler_unregister(dip);
+			(void) ddi_prop_remove(DDI_DEV_T_NONE, dip,
+			    "fm-errcb-capable");
+		}
 
 		if (DDI_FM_DMA_ERR_CAP(fmhdl->fh_cap) ||
 		    DDI_FM_ACC_ERR_CAP(fmhdl->fh_cap)) {
--- a/usr/src/uts/common/sys/bofi_impl.h	Thu Apr 05 02:55:03 2007 -0700
+++ b/usr/src/uts/common/sys/bofi_impl.h	Thu Apr 05 03:14:36 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -95,6 +94,9 @@
 	caddr_t origaddr;
 	caddr_t allocaddr;
 	uint_t flags;
+	int map_flags;
+	page_t *map_pp;
+	page_t **map_pplist;
 	struct bofi_shadow **hparrayp;
 	int hilevel;
 	ddi_umem_cookie_t umem_cookie;