PSARC/2007/477 Drivers registering devids
6337062 e_ddi_devid_hold_driver_list is missing cmdk
--- a/usr/src/uts/common/io/sata/adapters/nv_sata/nv_sata.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/common/io/sata/adapters/nv_sata/nv_sata.conf Mon Jun 21 11:12:09 2010 -0700
@@ -19,10 +19,12 @@
# CDDL HEADER END
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
+use-cmdk-devid-format=1;
-use-cmdk-devid-format=1;
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;
--- a/usr/src/uts/common/io/scsi/targets/smp.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/common/io/scsi/targets/smp.conf Mon Jun 21 11:12:09 2010 -0700
@@ -20,9 +20,10 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;
--- a/usr/src/uts/common/os/devid_cache.c Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/common/os/devid_cache.c Mon Jun 21 11:12:09 2010 -0700
@@ -391,18 +391,19 @@
ddi_rele_driver(major);
}
-static char *e_ddi_devid_hold_driver_list[] = { "sd", "ssd", "dad" };
+/* legacy support - see below */
+static char *e_ddi_devid_hold_driver_list[] = { "sd", "ssd" };
#define N_DRIVERS_TO_HOLD \
(sizeof (e_ddi_devid_hold_driver_list) / sizeof (char *))
-
static void
e_ddi_devid_hold_installed_driver(ddi_devid_t devid)
{
impl_devid_t *id = (impl_devid_t *)devid;
major_t major, hint_major;
char hint[DEVID_HINT_SIZE + 1];
+ struct devnames *dnp;
char **drvp;
int i;
@@ -421,6 +422,23 @@
e_ddi_devid_hold_by_major(hint_major);
}
+ /*
+ * search for the devid with each driver declaring
+ * itself as a devid registrant.
+ */
+ for (major = 0; major < devcnt; major++) {
+ if (major == hint_major)
+ continue;
+ dnp = &devnamesp[major];
+ if (dnp->dn_flags & DN_DEVID_REGISTRANT) {
+ e_ddi_devid_hold_by_major(major);
+ }
+ }
+
+ /*
+ * Legacy support: may be removed once an upgrade mechanism
+ * for driver conf files is available.
+ */
drvp = e_ddi_devid_hold_driver_list;
for (i = 0; i < N_DRIVERS_TO_HOLD; i++, drvp++) {
major = ddi_name_to_major(*drvp);
@@ -430,7 +448,6 @@
}
}
-
/*
* Return success if discovery was attempted, to indicate
* that the desired device may now be available.
--- a/usr/src/uts/common/os/modsubr.c Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/common/os/modsubr.c Mon Jun 21 11:12:09 2010 -0700
@@ -426,6 +426,11 @@
DDI_PROP_TYPE_STRING, &props))
dnp->dn_flags |= DN_PHCI_DRIVER;
+ if (i_ddi_prop_search(DDI_DEV_T_ANY, DDI_DEVID_REGISTRANT,
+ DDI_PROP_TYPE_INT, &props)) {
+ dnp->dn_flags |= DN_DEVID_REGISTRANT;
+ }
+
dnp->dn_flags |= DN_CONF_PARSED;
dnp->dn_pl = pl;
return (pl);
--- a/usr/src/uts/common/sys/autoconf.h Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/common/sys/autoconf.h Mon Jun 21 11:12:09 2010 -0700
@@ -88,6 +88,7 @@
#define DN_OPEN_RETURNS_EINTR 0x4000 /* DDI_OPEN_RETURNS_EINTR prop */
#define DN_SCSI_SIZE_CLEAN 0x8000 /* driver is scsi_size_clean() */
#define DN_NETWORK_PHYSDRIVER 0x10000 /* physical network driver */
+#define DN_DEVID_REGISTRANT 0x20000 /* ddi-devid-registrant prop */
#ifdef _KERNEL
--- a/usr/src/uts/common/sys/sunddi.h Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/common/sys/sunddi.h Mon Jun 21 11:12:09 2010 -0700
@@ -337,6 +337,7 @@
#define DDI_VHCI_CLASS "ddi-vhci-class"
#define DDI_NO_ROOT_SUPPORT "ddi-no-root-support"
#define DDI_OPEN_RETURNS_EINTR "ddi-open-returns-eintr"
+#define DDI_DEVID_REGISTRANT "ddi-devid-registrant"
/*
* Values that the function supplied to the dev_info
--- a/usr/src/uts/intel/io/dktp/disk/cmdk.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/intel/io/dktp/disk/cmdk.conf Mon Jun 21 11:12:09 2010 -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,12 +19,9 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
-
name="cmdk" class="dada" target=0 lun=0 class_prop="dada";
name="cmdk" class="dada" target=1 lun=0 class_prop="dada";
name="cmdk" class="dada" target=2 lun=0 class_prop="dada";
@@ -33,3 +29,8 @@
name="cmdk" class="dada" target=4 lun=0 class_prop="dada";
name="cmdk" class="dada" target=5 lun=0 class_prop="dada";
name="cmdk" class="dada" target=6 lun=0 class_prop="dada";
+
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;
--- a/usr/src/uts/intel/io/scsi/targets/sd.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/intel/io/scsi/targets/sd.conf Mon Jun 21 11:12:09 2010 -0700
@@ -20,10 +20,7 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
#
name="sd" class="scsi" target=0 lun=0;
@@ -48,3 +45,8 @@
# devid resolution on a self-identifying transport.
#
name="sd" class="scsi-self-identifying";
+
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;
--- a/usr/src/uts/sun/io/dada/targets/dad.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/sun/io/dada/targets/dad.conf Mon Jun 21 11:12:09 2010 -0700
@@ -20,10 +20,8 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
name="dad" class="dada" type="ata" class_prop="ata"
target=0 lun=0;
@@ -33,3 +31,8 @@
target=2 lun=0;
name="dad" class="dada" type="ata" class_prop="ata"
target=3 lun=0;
+
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;
--- a/usr/src/uts/sun/io/scsi/targets/sd.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/sun/io/scsi/targets/sd.conf Mon Jun 21 11:12:09 2010 -0700
@@ -20,10 +20,7 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
#
name="sd" class="scsi" class_prop="atapi"
@@ -84,3 +81,8 @@
# devid resolution on a self-identifying transport.
#
name="sd" class="scsi-self-identifying";
+
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;
--- a/usr/src/uts/sun/io/scsi/targets/ssd.conf Mon Jun 21 09:44:26 2010 -0700
+++ b/usr/src/uts/sun/io/scsi/targets/ssd.conf Mon Jun 21 11:12:09 2010 -0700
@@ -20,10 +20,7 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
#
name="ssd" parent="sf" target=0;
@@ -34,5 +31,7 @@
#
name="ssd" class="scsi-self-identifying";
-
-
+#
+# Associate the driver with devid resolution.
+#
+ddi-devid-registrant=1;