xref: /onnv-gate/usr/src/lib/mpapi/libmpscsi_vhci/common/mp_utils.c (revision 12334:6920dcae2224)
17836SJohn.Forte@Sun.COM /*
27836SJohn.Forte@Sun.COM  * CDDL HEADER START
37836SJohn.Forte@Sun.COM  *
47836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
57836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
67836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
77836SJohn.Forte@Sun.COM  *
87836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
107836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
117836SJohn.Forte@Sun.COM  * and limitations under the License.
127836SJohn.Forte@Sun.COM  *
137836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
147836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
167836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
177836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
187836SJohn.Forte@Sun.COM  *
197836SJohn.Forte@Sun.COM  * CDDL HEADER END
207836SJohn.Forte@Sun.COM  */
217836SJohn.Forte@Sun.COM /*
2212087SJiri.Svoboda@Sun.COM  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
237836SJohn.Forte@Sun.COM  */
247836SJohn.Forte@Sun.COM 
257836SJohn.Forte@Sun.COM #include "mp_utils.h"
267836SJohn.Forte@Sun.COM #include <sys/sunddi.h>
277836SJohn.Forte@Sun.COM 
287836SJohn.Forte@Sun.COM #ifndef OIDLIST
297836SJohn.Forte@Sun.COM #define	OIDLIST "oid"
307836SJohn.Forte@Sun.COM #endif
317836SJohn.Forte@Sun.COM 
327836SJohn.Forte@Sun.COM 
337836SJohn.Forte@Sun.COM /* Remove these 5 when this source can compile with sunddi.h */
347836SJohn.Forte@Sun.COM #ifndef EC_DDI
357836SJohn.Forte@Sun.COM #define	EC_DDI				"EC_ddi"
367836SJohn.Forte@Sun.COM #endif
377836SJohn.Forte@Sun.COM 
387836SJohn.Forte@Sun.COM #ifndef ESC_DDI_INITIATOR_REGISTER
397836SJohn.Forte@Sun.COM #define	ESC_DDI_INITIATOR_REGISTER	"ESC_ddi_initiator_register"
407836SJohn.Forte@Sun.COM #endif
417836SJohn.Forte@Sun.COM 
427836SJohn.Forte@Sun.COM #ifndef ESC_DDI_INITIATOR_UNREGISTER
437836SJohn.Forte@Sun.COM #define	ESC_DDI_INITIATOR_UNREGISTER	"ESC_ddi_initiator_unregister"
447836SJohn.Forte@Sun.COM #endif
457836SJohn.Forte@Sun.COM 
467836SJohn.Forte@Sun.COM #ifndef DDI_DRIVER_MAJOR
477836SJohn.Forte@Sun.COM #define	DDI_DRIVER_MAJOR		"ddi.major"
487836SJohn.Forte@Sun.COM #endif
497836SJohn.Forte@Sun.COM 
507836SJohn.Forte@Sun.COM #ifndef DDI_INSTANCE
517836SJohn.Forte@Sun.COM #define	DDI_INSTANCE			"ddi.instance"
527836SJohn.Forte@Sun.COM #endif
537836SJohn.Forte@Sun.COM 
547836SJohn.Forte@Sun.COM 
557836SJohn.Forte@Sun.COM #define	VISA_CHANGE 1
567836SJohn.Forte@Sun.COM #define	PROP_CHANGE 2
577836SJohn.Forte@Sun.COM 
587836SJohn.Forte@Sun.COM 
597836SJohn.Forte@Sun.COM 
607836SJohn.Forte@Sun.COM MP_STATUS
getStatus4ErrorCode(int driverError)617836SJohn.Forte@Sun.COM getStatus4ErrorCode(int driverError)
627836SJohn.Forte@Sun.COM {
637836SJohn.Forte@Sun.COM 	MP_STATUS mpStatus = MP_STATUS_FAILED;
647836SJohn.Forte@Sun.COM 
657836SJohn.Forte@Sun.COM 	log(LOG_INFO, "getStatus4ErrorCode()", "- enter");
667836SJohn.Forte@Sun.COM 
677836SJohn.Forte@Sun.COM 	switch (driverError) {
687836SJohn.Forte@Sun.COM 
697836SJohn.Forte@Sun.COM 		case MP_DRVR_INVALID_ID:
707836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
7112087SJiri.Svoboda@Sun.COM 			    " received mp_errno=MP_DRVR_INVALID_ID"
7212087SJiri.Svoboda@Sun.COM 			    " from driver call.");
737836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
7412087SJiri.Svoboda@Sun.COM 			    " returning MP_STATUS_OBJECT_NOT_FOUND"
7512087SJiri.Svoboda@Sun.COM 			    " to caller.");
767836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_OBJECT_NOT_FOUND;
777836SJohn.Forte@Sun.COM 			break;
787836SJohn.Forte@Sun.COM 
797836SJohn.Forte@Sun.COM 
807836SJohn.Forte@Sun.COM 		case MP_DRVR_ID_OBSOLETE:
817836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
8212087SJiri.Svoboda@Sun.COM 			    " received mp_errno=MP_DRVR_ID_OBSOLETE"
8312087SJiri.Svoboda@Sun.COM 			    " from driver call.");
847836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
8512087SJiri.Svoboda@Sun.COM 			    " returning MP_STATUS_OBJECT_NOT_FOUND"
8612087SJiri.Svoboda@Sun.COM 			    " to caller.");
877836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_OBJECT_NOT_FOUND;
887836SJohn.Forte@Sun.COM 			break;
897836SJohn.Forte@Sun.COM 
907836SJohn.Forte@Sun.COM 
917836SJohn.Forte@Sun.COM 		case MP_DRVR_ACCESS_SYMMETRIC:
927836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
9312087SJiri.Svoboda@Sun.COM 			    " received mp_errno=MP_DRVR_ACCESS_SYMMETRIC"
9412087SJiri.Svoboda@Sun.COM 			    " from driver call.");
957836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
9612087SJiri.Svoboda@Sun.COM 			    " returning MP_STATUS_INVALID_PARAMETER"
9712087SJiri.Svoboda@Sun.COM 			    " to caller.");
987836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_INVALID_PARAMETER;
997836SJohn.Forte@Sun.COM 			break;
1007836SJohn.Forte@Sun.COM 
1017836SJohn.Forte@Sun.COM 
1027836SJohn.Forte@Sun.COM 		case MP_DRVR_PATH_UNAVAILABLE:
1037836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
10412087SJiri.Svoboda@Sun.COM 			    " received mp_errno=MP_DRVR_PATH_UNAVAILABLE"
10512087SJiri.Svoboda@Sun.COM 			    " from driver call.");
1067836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
10712087SJiri.Svoboda@Sun.COM 			    " returning MP_STATUS_PATH_NONOPERATIONAL"
10812087SJiri.Svoboda@Sun.COM 			    " to caller.");
1097836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_PATH_NONOPERATIONAL;
1107836SJohn.Forte@Sun.COM 			break;
1117836SJohn.Forte@Sun.COM 
1127836SJohn.Forte@Sun.COM 
1137836SJohn.Forte@Sun.COM 		case MP_DRVR_IDS_NOT_ASSOCIATED:
1147836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
11512087SJiri.Svoboda@Sun.COM 			    " received mp_errno=MP_DRVR_IDS_NOT_ASSOCIATED"
11612087SJiri.Svoboda@Sun.COM 			    " from driver call.");
1177836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
11812087SJiri.Svoboda@Sun.COM 			    " returning MP_STATUS_INVALID_PARAMETER"
11912087SJiri.Svoboda@Sun.COM 			    " to caller.");
1207836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_INVALID_PARAMETER;
1217836SJohn.Forte@Sun.COM 			break;
1227836SJohn.Forte@Sun.COM 
1237836SJohn.Forte@Sun.COM 
1247836SJohn.Forte@Sun.COM 		case MP_DRVR_ILLEGAL_ACCESS_STATE_REQUEST:
1257836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
12612087SJiri.Svoboda@Sun.COM 			    " received mp_errno="
12712087SJiri.Svoboda@Sun.COM 			    "MP_DRVR_ILLEGAL_ACCESS_STATE_REQUEST"
12812087SJiri.Svoboda@Sun.COM 			    " from driver call.");
1297836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
13012087SJiri.Svoboda@Sun.COM 			    " returning MP_STATUS_INVALID_PARAMETER"
13112087SJiri.Svoboda@Sun.COM 			    " to caller.");
1327836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_ACCESS_STATE_INVALID;
1337836SJohn.Forte@Sun.COM 			break;
1347836SJohn.Forte@Sun.COM 
1357836SJohn.Forte@Sun.COM 
1367836SJohn.Forte@Sun.COM 		default:
1377836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
13812087SJiri.Svoboda@Sun.COM 			    " - received (unsupported) mp_errno=%d from"
13912087SJiri.Svoboda@Sun.COM 			    " driver call.", driverError);
1407836SJohn.Forte@Sun.COM 			log(LOG_INFO, "getStatus4ErrorCode()",
14112087SJiri.Svoboda@Sun.COM 			    " - returning MP_STATUS_FAILED to caller.");
1427836SJohn.Forte@Sun.COM 			mpStatus = MP_STATUS_FAILED;
1437836SJohn.Forte@Sun.COM 	}
1447836SJohn.Forte@Sun.COM 
1457836SJohn.Forte@Sun.COM 	log(LOG_INFO, "getStatus4ErrorCode()", "- exit");
1467836SJohn.Forte@Sun.COM 
1477836SJohn.Forte@Sun.COM 	return (mpStatus);
1487836SJohn.Forte@Sun.COM }
1497836SJohn.Forte@Sun.COM 
1507836SJohn.Forte@Sun.COM 
1517836SJohn.Forte@Sun.COM 
1527836SJohn.Forte@Sun.COM MP_OID_LIST
createOidList(int size)1537836SJohn.Forte@Sun.COM *createOidList(int size) {
1547836SJohn.Forte@Sun.COM 
1557836SJohn.Forte@Sun.COM 	MP_OID_LIST *pOidList = NULL;
1567836SJohn.Forte@Sun.COM 
1577836SJohn.Forte@Sun.COM 
1587836SJohn.Forte@Sun.COM 	log(LOG_INFO, "createOidList()", "- enter");
1597836SJohn.Forte@Sun.COM 
1607836SJohn.Forte@Sun.COM 
1617836SJohn.Forte@Sun.COM 	if (size < 1) {
1627836SJohn.Forte@Sun.COM 
1637836SJohn.Forte@Sun.COM 		log(LOG_INFO, "createOidList()",
1647836SJohn.Forte@Sun.COM 			"requested size is less than 1");
1657836SJohn.Forte@Sun.COM 		log(LOG_INFO, "createOidList()",
1667836SJohn.Forte@Sun.COM 			" - error exit");
1677836SJohn.Forte@Sun.COM 		return (NULL);
1687836SJohn.Forte@Sun.COM 
1697836SJohn.Forte@Sun.COM 	} else {
1707836SJohn.Forte@Sun.COM 
1717836SJohn.Forte@Sun.COM 		pOidList = (MP_OID_LIST*)calloc(1,
1727836SJohn.Forte@Sun.COM 			sizeof (MP_OID_LIST) +
1737836SJohn.Forte@Sun.COM 			((size - 1) *
1747836SJohn.Forte@Sun.COM 		    sizeof (MP_OID)));
1757836SJohn.Forte@Sun.COM 
1767836SJohn.Forte@Sun.COM 		if (NULL == pOidList) {
1777836SJohn.Forte@Sun.COM 			log(LOG_INFO, "createOidList()",
1787836SJohn.Forte@Sun.COM 				"no memory for pOidList");
1797836SJohn.Forte@Sun.COM 			log(LOG_INFO, "createOidList()",
1807836SJohn.Forte@Sun.COM 				" - error exit");
1817836SJohn.Forte@Sun.COM 			return (NULL);
1827836SJohn.Forte@Sun.COM 		}
1837836SJohn.Forte@Sun.COM 
1847836SJohn.Forte@Sun.COM 		log(LOG_INFO,
1857836SJohn.Forte@Sun.COM 		    "createOidList()",
1867836SJohn.Forte@Sun.COM 			"- exit(%d)",
1877836SJohn.Forte@Sun.COM 			size);
1887836SJohn.Forte@Sun.COM 
1897836SJohn.Forte@Sun.COM 		return (pOidList);
1907836SJohn.Forte@Sun.COM 	}
1917836SJohn.Forte@Sun.COM }
1927836SJohn.Forte@Sun.COM 
1937836SJohn.Forte@Sun.COM /* Calls the client callback function, if one is registered */
1947836SJohn.Forte@Sun.COM static void
notifyClient(sysevent_t * ev)1957836SJohn.Forte@Sun.COM notifyClient(sysevent_t *ev)
1967836SJohn.Forte@Sun.COM {
1977836SJohn.Forte@Sun.COM 	nvlist_t *attr_list = NULL;
1987836SJohn.Forte@Sun.COM 
1997836SJohn.Forte@Sun.COM 	uint64_t *val = NULL;
2007836SJohn.Forte@Sun.COM 	int32_t  *instance = NULL;
2017836SJohn.Forte@Sun.COM 	int32_t  *major = NULL;
2027836SJohn.Forte@Sun.COM 
2037836SJohn.Forte@Sun.COM 	int valAllocated = 0;
2047836SJohn.Forte@Sun.COM 
2057836SJohn.Forte@Sun.COM 	uint_t nelem = 0;
2067836SJohn.Forte@Sun.COM 
2077836SJohn.Forte@Sun.COM 	int i = 0;
2087836SJohn.Forte@Sun.COM 	int eventType = 0;
2097836SJohn.Forte@Sun.COM 	int index = -1;
2107836SJohn.Forte@Sun.COM 
2117836SJohn.Forte@Sun.COM 	void *pCallerData = NULL;
2127836SJohn.Forte@Sun.COM 
2137836SJohn.Forte@Sun.COM 	char subClassName[256];
2147836SJohn.Forte@Sun.COM 
2157836SJohn.Forte@Sun.COM 	MP_BOOL becomingVisible = MP_FALSE;
2167836SJohn.Forte@Sun.COM 
2177836SJohn.Forte@Sun.COM 	MP_OID_LIST *oidList = NULL;
2187836SJohn.Forte@Sun.COM 
2197836SJohn.Forte@Sun.COM 
2207836SJohn.Forte@Sun.COM 	log(LOG_INFO, "notifyClient()", "- enter");
2217836SJohn.Forte@Sun.COM 
2227836SJohn.Forte@Sun.COM 
2237836SJohn.Forte@Sun.COM 	(void) strncpy(subClassName, sysevent_get_subclass_name(ev), 256);
2247836SJohn.Forte@Sun.COM 
2257836SJohn.Forte@Sun.COM 	if (strstr(subClassName, "change")) {
2267836SJohn.Forte@Sun.COM 
2277836SJohn.Forte@Sun.COM 		eventType = PROP_CHANGE;
2287836SJohn.Forte@Sun.COM 
2297836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", "- got a change event");
2307836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", ": [%s]",
2317836SJohn.Forte@Sun.COM 		    subClassName);
2327836SJohn.Forte@Sun.COM 
23312087SJiri.Svoboda@Sun.COM 		if (strncmp(subClassName, ESC_SUN_MP_PLUGIN_CHANGE, 255)
23412087SJiri.Svoboda@Sun.COM 		    == 0) {
23512087SJiri.Svoboda@Sun.COM 
23612087SJiri.Svoboda@Sun.COM 			index = MP_OBJECT_TYPE_PLUGIN;
23712087SJiri.Svoboda@Sun.COM 
23812087SJiri.Svoboda@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_LU_CHANGE, 255)
23912087SJiri.Svoboda@Sun.COM 		    == 0) {
2407836SJohn.Forte@Sun.COM 
2417836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_MULTIPATH_LU;
2427836SJohn.Forte@Sun.COM 
2437836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_PATH_CHANGE, 255)
2447836SJohn.Forte@Sun.COM 		    == 0) {
2457836SJohn.Forte@Sun.COM 
2467836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_PATH_LU;
2477836SJohn.Forte@Sun.COM 
2487836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_INIT_PORT_CHANGE,
24912087SJiri.Svoboda@Sun.COM 		    255) == 0) {
2507836SJohn.Forte@Sun.COM 
2517836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_INITIATOR_PORT;
2527836SJohn.Forte@Sun.COM 
2537836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_TPG_CHANGE, 255)
2547836SJohn.Forte@Sun.COM 		    == 0) {
2557836SJohn.Forte@Sun.COM 
2567836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_TARGET_PORT_GROUP;
2577836SJohn.Forte@Sun.COM 
2587836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_TARGET_PORT_CHANGE,
25912087SJiri.Svoboda@Sun.COM 		    255) == 0) {
2607836SJohn.Forte@Sun.COM 
2617836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_TARGET_PORT;
2627836SJohn.Forte@Sun.COM 
2637836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_DEV_PROD_CHANGE,
26412087SJiri.Svoboda@Sun.COM 		    255) == 0) {
2657836SJohn.Forte@Sun.COM 
2667836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_DEVICE_PRODUCT;
2677836SJohn.Forte@Sun.COM 		}
2687836SJohn.Forte@Sun.COM 
2697836SJohn.Forte@Sun.COM 	} else if ((strstr(subClassName, "add")) ||
27012087SJiri.Svoboda@Sun.COM 	    (strstr(subClassName, "initiator_register"))) {
2717836SJohn.Forte@Sun.COM 
2727836SJohn.Forte@Sun.COM 		eventType = VISA_CHANGE;
2737836SJohn.Forte@Sun.COM 		becomingVisible = MP_TRUE;
2747836SJohn.Forte@Sun.COM 
2757836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", "- got a visibility"
2767836SJohn.Forte@Sun.COM 		    " add event");
2777836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", ": [%s]",
2787836SJohn.Forte@Sun.COM 		    subClassName);
2797836SJohn.Forte@Sun.COM 
28012087SJiri.Svoboda@Sun.COM 		if (strncmp(subClassName, ESC_SUN_MP_LU_ADD, 255) == 0) {
2817836SJohn.Forte@Sun.COM 
2827836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_MULTIPATH_LU;
2837836SJohn.Forte@Sun.COM 
2847836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_PATH_ADD, 255)
2857836SJohn.Forte@Sun.COM 		    == 0) {
2867836SJohn.Forte@Sun.COM 
2877836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_PATH_LU;
2887836SJohn.Forte@Sun.COM 
2897836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_DDI_INITIATOR_REGISTER,
29012087SJiri.Svoboda@Sun.COM 		    244) == 0) {
2917836SJohn.Forte@Sun.COM 
2927836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_INITIATOR_PORT;
2937836SJohn.Forte@Sun.COM 
2947836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_TPG_ADD,
29512087SJiri.Svoboda@Sun.COM 		    255) == 0) {
2967836SJohn.Forte@Sun.COM 
2977836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_TARGET_PORT_GROUP;
2987836SJohn.Forte@Sun.COM 
2997836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_TARGET_PORT_ADD,
30012087SJiri.Svoboda@Sun.COM 		    255) == 0) {
3017836SJohn.Forte@Sun.COM 
3027836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_TARGET_PORT;
3037836SJohn.Forte@Sun.COM 
3047836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_DEV_PROD_ADD, 255)
3057836SJohn.Forte@Sun.COM 		    == 0) {
3067836SJohn.Forte@Sun.COM 
3077836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_DEVICE_PRODUCT;
3087836SJohn.Forte@Sun.COM 		}
3097836SJohn.Forte@Sun.COM 
3107836SJohn.Forte@Sun.COM 
3117836SJohn.Forte@Sun.COM 	} else if ((strstr(subClassName, "remove")) ||
31212087SJiri.Svoboda@Sun.COM 	    (strstr(subClassName, "initiator_unregister"))) {
3137836SJohn.Forte@Sun.COM 
3147836SJohn.Forte@Sun.COM 		eventType = VISA_CHANGE;
3157836SJohn.Forte@Sun.COM 		becomingVisible = MP_FALSE;
3167836SJohn.Forte@Sun.COM 
3177836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", "- got a visibility"
3187836SJohn.Forte@Sun.COM 		    " remove event");
3197836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", ": [%s]",
3207836SJohn.Forte@Sun.COM 		    subClassName);
3217836SJohn.Forte@Sun.COM 
32212087SJiri.Svoboda@Sun.COM 		if (strncmp(subClassName, ESC_SUN_MP_LU_REMOVE, 255) == 0) {
3237836SJohn.Forte@Sun.COM 
3247836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_MULTIPATH_LU;
3257836SJohn.Forte@Sun.COM 
3267836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_PATH_REMOVE, 255)
3277836SJohn.Forte@Sun.COM 		    == 0) {
3287836SJohn.Forte@Sun.COM 
3297836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_PATH_LU;
3307836SJohn.Forte@Sun.COM 
3317836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_DDI_INITIATOR_UNREGISTER,
33212087SJiri.Svoboda@Sun.COM 		    255) == 0) {
3337836SJohn.Forte@Sun.COM 
3347836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_INITIATOR_PORT;
3357836SJohn.Forte@Sun.COM 
3367836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_TPG_REMOVE, 255)
3377836SJohn.Forte@Sun.COM 		    == 0) {
3387836SJohn.Forte@Sun.COM 
3397836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_TARGET_PORT_GROUP;
3407836SJohn.Forte@Sun.COM 
3417836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_TARGET_PORT_REMOVE,
34212087SJiri.Svoboda@Sun.COM 		    255) == 0) {
3437836SJohn.Forte@Sun.COM 
3447836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_TARGET_PORT;
3457836SJohn.Forte@Sun.COM 
3467836SJohn.Forte@Sun.COM 		} else if (strncmp(subClassName, ESC_SUN_MP_DEV_PROD_REMOVE,
34712087SJiri.Svoboda@Sun.COM 		    255) == 0) {
3487836SJohn.Forte@Sun.COM 
3497836SJohn.Forte@Sun.COM 			index = MP_OBJECT_TYPE_DEVICE_PRODUCT;
3507836SJohn.Forte@Sun.COM 		}
3517836SJohn.Forte@Sun.COM 
3527836SJohn.Forte@Sun.COM 
3537836SJohn.Forte@Sun.COM 	} else {
3547836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", "- got an unsupported event");
3557836SJohn.Forte@Sun.COM 		return;
3567836SJohn.Forte@Sun.COM 	}
3577836SJohn.Forte@Sun.COM 
3587836SJohn.Forte@Sun.COM 	if (index < 0) {
3597836SJohn.Forte@Sun.COM 
3607836SJohn.Forte@Sun.COM 		log(LOG_INFO, "notifyClient()", "- index is less than zero");
3617836SJohn.Forte@Sun.COM 		return;
3627836SJohn.Forte@Sun.COM 	}
3637836SJohn.Forte@Sun.COM 
3647836SJohn.Forte@Sun.COM 	if (eventType == VISA_CHANGE) {
3657836SJohn.Forte@Sun.COM 
3667836SJohn.Forte@Sun.COM 		(void) pthread_mutex_lock(&g_visa_mutex);
3677836SJohn.Forte@Sun.COM 
3687836SJohn.Forte@Sun.COM 		if (NULL == g_Visibility_Callback_List[index].pClientFn) {
3697836SJohn.Forte@Sun.COM 
3707836SJohn.Forte@Sun.COM 			log(LOG_INFO, "notifyClient()",
3717836SJohn.Forte@Sun.COM 			    "- no visibility change callback to notify");
3727836SJohn.Forte@Sun.COM 
3737836SJohn.Forte@Sun.COM 			(void) pthread_mutex_unlock(&g_visa_mutex);
3747836SJohn.Forte@Sun.COM 
3757836SJohn.Forte@Sun.COM 			return;
3767836SJohn.Forte@Sun.COM 		}
3777836SJohn.Forte@Sun.COM 
3787836SJohn.Forte@Sun.COM 		(void) pthread_mutex_unlock(&g_visa_mutex);
3797836SJohn.Forte@Sun.COM 	}
3807836SJohn.Forte@Sun.COM 
3817836SJohn.Forte@Sun.COM 	if (eventType == PROP_CHANGE) {
3827836SJohn.Forte@Sun.COM 
3837836SJohn.Forte@Sun.COM 		(void) pthread_mutex_lock(&g_prop_mutex);
3847836SJohn.Forte@Sun.COM 
3857836SJohn.Forte@Sun.COM 		if (NULL == g_Property_Callback_List[index].pClientFn) {
3867836SJohn.Forte@Sun.COM 
3877836SJohn.Forte@Sun.COM 			log(LOG_INFO, "notifyClient()",
3887836SJohn.Forte@Sun.COM 			    "- no property change callback to notify");
3897836SJohn.Forte@Sun.COM 
39012087SJiri.Svoboda@Sun.COM 			(void) pthread_mutex_unlock(&g_prop_mutex);
3917836SJohn.Forte@Sun.COM 
39212087SJiri.Svoboda@Sun.COM 			return;
39312087SJiri.Svoboda@Sun.COM 		}
3947836SJohn.Forte@Sun.COM 
39512087SJiri.Svoboda@Sun.COM 		(void) pthread_mutex_unlock(&g_prop_mutex);
3967836SJohn.Forte@Sun.COM 	}
3977836SJohn.Forte@Sun.COM 
3987836SJohn.Forte@Sun.COM 	(void) sysevent_get_attr_list(ev, &attr_list);
3997836SJohn.Forte@Sun.COM 	if (NULL != attr_list) {
4007836SJohn.Forte@Sun.COM 
4017836SJohn.Forte@Sun.COM 		if ((VISA_CHANGE == eventType) &&
40212087SJiri.Svoboda@Sun.COM 		    (MP_OBJECT_TYPE_PLUGIN == index)) {
4037836SJohn.Forte@Sun.COM 
40412087SJiri.Svoboda@Sun.COM 			val = (uint64_t *)malloc(sizeof (uint64_t));
40512087SJiri.Svoboda@Sun.COM 			valAllocated = 1;
4067836SJohn.Forte@Sun.COM 
40712087SJiri.Svoboda@Sun.COM 			/*
40812087SJiri.Svoboda@Sun.COM 			 * We have no well-defined way to determine our OSN.
40912087SJiri.Svoboda@Sun.COM 			 * Currently the common library uses 0 as OSN for every
41012087SJiri.Svoboda@Sun.COM 			 * plugin, so just use 0. If the OSN assigned by the
41112087SJiri.Svoboda@Sun.COM 			 * common library changed, this code would have to be
41212087SJiri.Svoboda@Sun.COM 			 * updated.
41312087SJiri.Svoboda@Sun.COM 			 */
41412087SJiri.Svoboda@Sun.COM 			*val = 0;
41512087SJiri.Svoboda@Sun.COM 			nelem = 1;
4167836SJohn.Forte@Sun.COM 
4177836SJohn.Forte@Sun.COM 		} else if ((VISA_CHANGE == eventType) &&
41812087SJiri.Svoboda@Sun.COM 		    (MP_OBJECT_TYPE_INITIATOR_PORT == index)) {
4197836SJohn.Forte@Sun.COM 
4207836SJohn.Forte@Sun.COM 			(void) nvlist_lookup_int32_array(attr_list,
4217836SJohn.Forte@Sun.COM 			    DDI_INSTANCE, &instance, &nelem);
4227836SJohn.Forte@Sun.COM 
4237836SJohn.Forte@Sun.COM 			log(LOG_INFO, "notifyClient()",
4247836SJohn.Forte@Sun.COM 			    "- event (PHCI_INSTANCE) has [%d] elements",
4257836SJohn.Forte@Sun.COM 			    nelem);
4267836SJohn.Forte@Sun.COM 
4277836SJohn.Forte@Sun.COM 			(void) nvlist_lookup_int32_array(attr_list,
4287836SJohn.Forte@Sun.COM 			    DDI_DRIVER_MAJOR, &major, &nelem);
4297836SJohn.Forte@Sun.COM 
4307836SJohn.Forte@Sun.COM 			log(LOG_INFO, "notifyClient()",
4317836SJohn.Forte@Sun.COM 			    "- event (PHCI_DRIVER_MAJOR) has [%d] elements",
4327836SJohn.Forte@Sun.COM 			    nelem);
4337836SJohn.Forte@Sun.COM 
4347836SJohn.Forte@Sun.COM 			if ((NULL != instance) & (NULL != major)) {
4357836SJohn.Forte@Sun.COM 
4367836SJohn.Forte@Sun.COM 				val = (uint64_t *)malloc(sizeof (uint64_t));
4377836SJohn.Forte@Sun.COM 
4387836SJohn.Forte@Sun.COM 				valAllocated = 1;
4397836SJohn.Forte@Sun.COM 
440*12334SJiri.Svoboda@Sun.COM 				*val = 0;
4417836SJohn.Forte@Sun.COM 				*val = MP_STORE_INST_TO_ID(*instance, *val);
4427836SJohn.Forte@Sun.COM 				*val = MP_STORE_MAJOR_TO_ID(*major, *val);
4437836SJohn.Forte@Sun.COM 
4447836SJohn.Forte@Sun.COM 				nelem = 1;
4457836SJohn.Forte@Sun.COM 
4467836SJohn.Forte@Sun.COM 			} else {
4477836SJohn.Forte@Sun.COM 
4487836SJohn.Forte@Sun.COM 				nelem = 0;
4497836SJohn.Forte@Sun.COM 			}
4507836SJohn.Forte@Sun.COM 
4517836SJohn.Forte@Sun.COM 		} else {
4527836SJohn.Forte@Sun.COM 
4537836SJohn.Forte@Sun.COM 			(void) nvlist_lookup_uint64_array(attr_list, OIDLIST,
45412087SJiri.Svoboda@Sun.COM 			    &val, &nelem);
4557836SJohn.Forte@Sun.COM 
4567836SJohn.Forte@Sun.COM 			log(LOG_INFO, "notifyClient()",
4577836SJohn.Forte@Sun.COM 			    "- event has [%d] elements",
4587836SJohn.Forte@Sun.COM 			    nelem);
4597836SJohn.Forte@Sun.COM 		}
4607836SJohn.Forte@Sun.COM 
4617836SJohn.Forte@Sun.COM 		if (nelem > 0) {
4627836SJohn.Forte@Sun.COM 
4637836SJohn.Forte@Sun.COM 			for (i = 0; i < nelem; i++) {
4647836SJohn.Forte@Sun.COM 
4657836SJohn.Forte@Sun.COM 				log(LOG_INFO, "notifyClient()",
4667836SJohn.Forte@Sun.COM 				    "- event [%d] = %llx",
4677836SJohn.Forte@Sun.COM 				    i, val[i]);
4687836SJohn.Forte@Sun.COM 			}
4697836SJohn.Forte@Sun.COM 
4707836SJohn.Forte@Sun.COM 			oidList = createOidList(nelem);
4717836SJohn.Forte@Sun.COM 			if (NULL == oidList) {
4727836SJohn.Forte@Sun.COM 
4737836SJohn.Forte@Sun.COM 				log(LOG_INFO, "notifyClient()",
4747836SJohn.Forte@Sun.COM 				    "- unable to create MP_OID_LIST");
4757836SJohn.Forte@Sun.COM 
4767836SJohn.Forte@Sun.COM 				log(LOG_INFO, "notifyClient()",
4777836SJohn.Forte@Sun.COM 				    "- error exit");
4787836SJohn.Forte@Sun.COM 
4797836SJohn.Forte@Sun.COM 				nvlist_free(attr_list);
4807836SJohn.Forte@Sun.COM 
4817836SJohn.Forte@Sun.COM 				return;
4827836SJohn.Forte@Sun.COM 			}
4837836SJohn.Forte@Sun.COM 
4847836SJohn.Forte@Sun.COM 			oidList->oidCount = nelem;
4857836SJohn.Forte@Sun.COM 
4867836SJohn.Forte@Sun.COM 			for (i = 0; i < nelem; i++) {
4877836SJohn.Forte@Sun.COM 
4887836SJohn.Forte@Sun.COM 				oidList->oids[i].objectType = index;
4897836SJohn.Forte@Sun.COM 				oidList->oids[i].ownerId = g_pluginOwnerID;
4907836SJohn.Forte@Sun.COM 				oidList->oids[i].objectSequenceNumber = val[i];
4917836SJohn.Forte@Sun.COM 			}
4927836SJohn.Forte@Sun.COM 
4937836SJohn.Forte@Sun.COM 			if (valAllocated) {
4947836SJohn.Forte@Sun.COM 
4957836SJohn.Forte@Sun.COM 				free(val);
4967836SJohn.Forte@Sun.COM 			}
4977836SJohn.Forte@Sun.COM 
4987836SJohn.Forte@Sun.COM 			for (i = 0; i < oidList->oidCount; i++) {
4997836SJohn.Forte@Sun.COM 
5007836SJohn.Forte@Sun.COM 				log(LOG_INFO, "notifyClient()",
50112087SJiri.Svoboda@Sun.COM 				    "oidList->oids[%d].objectType"
50212087SJiri.Svoboda@Sun.COM 				    "           = %d",
50312087SJiri.Svoboda@Sun.COM 				    i, oidList->oids[i].objectType);
5047836SJohn.Forte@Sun.COM 				log(LOG_INFO, "notifyClient()",
50512087SJiri.Svoboda@Sun.COM 				    "oidList->oids[%d].ownerId"
50612087SJiri.Svoboda@Sun.COM 				    "              = %d",
50712087SJiri.Svoboda@Sun.COM 				    i, oidList->oids[i].ownerId);
5087836SJohn.Forte@Sun.COM 				log(LOG_INFO, "notifyClient()",
50912087SJiri.Svoboda@Sun.COM 				    "oidList->oids[%d].objectSequenceNumber"
51012087SJiri.Svoboda@Sun.COM 				    " = %llx",
51112087SJiri.Svoboda@Sun.COM 				    i, oidList->oids[i].objectSequenceNumber);
5127836SJohn.Forte@Sun.COM 			}
5137836SJohn.Forte@Sun.COM 
5147836SJohn.Forte@Sun.COM 			if (eventType == PROP_CHANGE) {
5157836SJohn.Forte@Sun.COM 
5167836SJohn.Forte@Sun.COM 				(void) pthread_mutex_lock(&g_prop_mutex);
5177836SJohn.Forte@Sun.COM 
5187836SJohn.Forte@Sun.COM 				pCallerData = g_Property_Callback_List[index].
51912087SJiri.Svoboda@Sun.COM 				    pCallerData;
5207836SJohn.Forte@Sun.COM 
5217836SJohn.Forte@Sun.COM 				(g_Property_Callback_List[index].pClientFn)
52212087SJiri.Svoboda@Sun.COM 				    (oidList, pCallerData);
5237836SJohn.Forte@Sun.COM 
5247836SJohn.Forte@Sun.COM 				(void) pthread_mutex_unlock(&g_prop_mutex);
5257836SJohn.Forte@Sun.COM 
5267836SJohn.Forte@Sun.COM 			} else if (eventType == VISA_CHANGE) {
5277836SJohn.Forte@Sun.COM 
5287836SJohn.Forte@Sun.COM 				(void) pthread_mutex_lock(&g_visa_mutex);
5297836SJohn.Forte@Sun.COM 
5307836SJohn.Forte@Sun.COM 				pCallerData = g_Visibility_Callback_List[index].
53112087SJiri.Svoboda@Sun.COM 				    pCallerData;
5327836SJohn.Forte@Sun.COM 
5337836SJohn.Forte@Sun.COM 				(g_Visibility_Callback_List[index].pClientFn)
53412087SJiri.Svoboda@Sun.COM 				    (becomingVisible, oidList, pCallerData);
5357836SJohn.Forte@Sun.COM 
5367836SJohn.Forte@Sun.COM 				(void) pthread_mutex_unlock(&g_visa_mutex);
5377836SJohn.Forte@Sun.COM 
5387836SJohn.Forte@Sun.COM 			}
5397836SJohn.Forte@Sun.COM 		}
5407836SJohn.Forte@Sun.COM 
5417836SJohn.Forte@Sun.COM 		nvlist_free(attr_list);
5427836SJohn.Forte@Sun.COM 	}
5437836SJohn.Forte@Sun.COM 
5447836SJohn.Forte@Sun.COM 
5457836SJohn.Forte@Sun.COM 	log(LOG_INFO, "notifyClient()", "- exit");
5467836SJohn.Forte@Sun.COM }
5477836SJohn.Forte@Sun.COM 
5487836SJohn.Forte@Sun.COM /* Event handler called by system */
5497836SJohn.Forte@Sun.COM static void
sysevent_handler(sysevent_t * ev)5507836SJohn.Forte@Sun.COM sysevent_handler(sysevent_t *ev)
5517836SJohn.Forte@Sun.COM {
5527836SJohn.Forte@Sun.COM 	log(LOG_INFO, "sysevent_handler()", "- enter");
5537836SJohn.Forte@Sun.COM 
5547836SJohn.Forte@Sun.COM 	/* Is the event one of ours? */
5557836SJohn.Forte@Sun.COM 	if ((strncmp(EC_SUN_MP, sysevent_get_class_name(ev), 9) != 0) &&
5567836SJohn.Forte@Sun.COM 	    (strncmp(EC_DDI,    sysevent_get_class_name(ev), 6) != 0)) {
5577836SJohn.Forte@Sun.COM 
5587836SJohn.Forte@Sun.COM 		return;
5597836SJohn.Forte@Sun.COM 	}
5607836SJohn.Forte@Sun.COM 
5617836SJohn.Forte@Sun.COM 	/* Notify client if it cares */
5627836SJohn.Forte@Sun.COM 	notifyClient(ev);
5637836SJohn.Forte@Sun.COM 
5647836SJohn.Forte@Sun.COM 
5657836SJohn.Forte@Sun.COM 	log(LOG_INFO, "sysevent_handler()", "- exit");
5667836SJohn.Forte@Sun.COM }
5677836SJohn.Forte@Sun.COM 
5687836SJohn.Forte@Sun.COM /* Registers the plugin to the sysevent framework */
56912087SJiri.Svoboda@Sun.COM MP_STATUS
init_sysevents(void)57012087SJiri.Svoboda@Sun.COM init_sysevents(void) {
5717836SJohn.Forte@Sun.COM 
5727836SJohn.Forte@Sun.COM 	const char *subclass_list[] = {
5737836SJohn.Forte@Sun.COM 
57412087SJiri.Svoboda@Sun.COM 		ESC_SUN_MP_PLUGIN_CHANGE,
57512087SJiri.Svoboda@Sun.COM 
5767836SJohn.Forte@Sun.COM 		ESC_SUN_MP_LU_CHANGE,
57712087SJiri.Svoboda@Sun.COM 		ESC_SUN_MP_LU_ADD,
57812087SJiri.Svoboda@Sun.COM 		ESC_SUN_MP_LU_REMOVE,
5797836SJohn.Forte@Sun.COM 
5807836SJohn.Forte@Sun.COM 		ESC_SUN_MP_PATH_CHANGE,
5817836SJohn.Forte@Sun.COM 		ESC_SUN_MP_PATH_ADD,
5827836SJohn.Forte@Sun.COM 		ESC_SUN_MP_PATH_REMOVE,
5837836SJohn.Forte@Sun.COM 
5847836SJohn.Forte@Sun.COM 		ESC_SUN_MP_INIT_PORT_CHANGE,
5857836SJohn.Forte@Sun.COM 
5867836SJohn.Forte@Sun.COM 		ESC_SUN_MP_TPG_CHANGE,
5877836SJohn.Forte@Sun.COM 		ESC_SUN_MP_TPG_ADD,
5887836SJohn.Forte@Sun.COM 		ESC_SUN_MP_TPG_REMOVE,
5897836SJohn.Forte@Sun.COM 
5907836SJohn.Forte@Sun.COM 		ESC_SUN_MP_TARGET_PORT_CHANGE,
5917836SJohn.Forte@Sun.COM 		ESC_SUN_MP_TARGET_PORT_ADD,
5927836SJohn.Forte@Sun.COM 		ESC_SUN_MP_TARGET_PORT_REMOVE,
5937836SJohn.Forte@Sun.COM 
5947836SJohn.Forte@Sun.COM 		ESC_SUN_MP_DEV_PROD_CHANGE,
5957836SJohn.Forte@Sun.COM 		ESC_SUN_MP_DEV_PROD_ADD,
5967836SJohn.Forte@Sun.COM 		ESC_SUN_MP_DEV_PROD_REMOVE
5977836SJohn.Forte@Sun.COM 
5987836SJohn.Forte@Sun.COM 	};
5997836SJohn.Forte@Sun.COM 
6007836SJohn.Forte@Sun.COM 	const char *init_port_subclass_list[] = {
6017836SJohn.Forte@Sun.COM 
6027836SJohn.Forte@Sun.COM 		ESC_DDI_INITIATOR_REGISTER,
6037836SJohn.Forte@Sun.COM 		ESC_DDI_INITIATOR_UNREGISTER
6047836SJohn.Forte@Sun.COM 	};
6057836SJohn.Forte@Sun.COM 
6067836SJohn.Forte@Sun.COM 
6077836SJohn.Forte@Sun.COM 
6087836SJohn.Forte@Sun.COM 	log(LOG_INFO, "init_sysevents()", "- enter");
6097836SJohn.Forte@Sun.COM 
6107836SJohn.Forte@Sun.COM 
6117836SJohn.Forte@Sun.COM 	g_SysEventHandle = sysevent_bind_handle(sysevent_handler);
6127836SJohn.Forte@Sun.COM 	if (g_SysEventHandle == NULL) {
6137836SJohn.Forte@Sun.COM 
6147836SJohn.Forte@Sun.COM 		log(LOG_INFO, "init_sysevents()",
6157836SJohn.Forte@Sun.COM 		    "- sysevent_bind_handle() failed");
6167836SJohn.Forte@Sun.COM 
6177836SJohn.Forte@Sun.COM 		log(LOG_INFO, "init_sysevents()", "- error exit");
6187836SJohn.Forte@Sun.COM 
6197836SJohn.Forte@Sun.COM 		return (MP_STATUS_FAILED);
6207836SJohn.Forte@Sun.COM 	}
6217836SJohn.Forte@Sun.COM 
6227836SJohn.Forte@Sun.COM 	if (sysevent_subscribe_event(g_SysEventHandle, EC_SUN_MP,
62312087SJiri.Svoboda@Sun.COM 	    subclass_list, sizeof (subclass_list) / sizeof (subclass_list[0]))
62412087SJiri.Svoboda@Sun.COM 	    != 0) {
6257836SJohn.Forte@Sun.COM 
6267836SJohn.Forte@Sun.COM 
6277836SJohn.Forte@Sun.COM 		log(LOG_INFO, "init_sysevents()",
6287836SJohn.Forte@Sun.COM 		    "- sysevent_subscribe_event() failed for subclass_list");
6297836SJohn.Forte@Sun.COM 
6307836SJohn.Forte@Sun.COM 		log(LOG_INFO, "init_sysevents()", "- error exit");
6317836SJohn.Forte@Sun.COM 
6327836SJohn.Forte@Sun.COM 		sysevent_unbind_handle(g_SysEventHandle);
6337836SJohn.Forte@Sun.COM 
6347836SJohn.Forte@Sun.COM 		return (MP_STATUS_FAILED);
6357836SJohn.Forte@Sun.COM 	}
6367836SJohn.Forte@Sun.COM 
6377836SJohn.Forte@Sun.COM 	if (sysevent_subscribe_event(g_SysEventHandle, EC_DDI,
63812087SJiri.Svoboda@Sun.COM 	    init_port_subclass_list, sizeof (init_port_subclass_list) /
63912087SJiri.Svoboda@Sun.COM 	    sizeof (init_port_subclass_list[0])) != 0) {
6407836SJohn.Forte@Sun.COM 
6417836SJohn.Forte@Sun.COM 
6427836SJohn.Forte@Sun.COM 		log(LOG_INFO, "init_sysevents()",
6437836SJohn.Forte@Sun.COM 		    "- sysevent_subscribe_event() failed "
6447836SJohn.Forte@Sun.COM 		    "for init_port_subclass_list");
6457836SJohn.Forte@Sun.COM 
6467836SJohn.Forte@Sun.COM 		log(LOG_INFO, "init_sysevents()", "- error exit");
6477836SJohn.Forte@Sun.COM 
6487836SJohn.Forte@Sun.COM 		sysevent_unbind_handle(g_SysEventHandle);
6497836SJohn.Forte@Sun.COM 
6507836SJohn.Forte@Sun.COM 		return (MP_STATUS_FAILED);
6517836SJohn.Forte@Sun.COM 	}
6527836SJohn.Forte@Sun.COM 
6537836SJohn.Forte@Sun.COM 
6547836SJohn.Forte@Sun.COM 	log(LOG_INFO, "init_sysevents()", "- exit");
6557836SJohn.Forte@Sun.COM 
6567836SJohn.Forte@Sun.COM 	return (MP_STATUS_SUCCESS);
6577836SJohn.Forte@Sun.COM }
658