17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*f4da9be0Scth  * Common Development and Distribution License (the "License").
6*f4da9be0Scth  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*f4da9be0Scth  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_NDI_IMPLDEFS_H
277c478bd9Sstevel@tonic-gate #define	_SYS_NDI_IMPLDEFS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/types.h>
307c478bd9Sstevel@tonic-gate #include <sys/param.h>
317c478bd9Sstevel@tonic-gate #include <sys/t_lock.h>
327c478bd9Sstevel@tonic-gate #include <sys/ddipropdefs.h>
337c478bd9Sstevel@tonic-gate #include <sys/devops.h>
347c478bd9Sstevel@tonic-gate #include <sys/autoconf.h>
357c478bd9Sstevel@tonic-gate #include <sys/mutex.h>
367c478bd9Sstevel@tonic-gate #include <vm/page.h>
377c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /* event handle for callback management */
447c478bd9Sstevel@tonic-gate struct ndi_event_hdl {
457c478bd9Sstevel@tonic-gate 	dev_info_t		*ndi_evthdl_dip;
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate 	/*
487c478bd9Sstevel@tonic-gate 	 * mutex that protect the handle and event defs
497c478bd9Sstevel@tonic-gate 	 */
507c478bd9Sstevel@tonic-gate 	kmutex_t		ndi_evthdl_mutex;
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate 	/*
537c478bd9Sstevel@tonic-gate 	 * mutex that just protects the callback list
547c478bd9Sstevel@tonic-gate 	 */
557c478bd9Sstevel@tonic-gate 	kmutex_t		ndi_evthdl_cb_mutex;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	ndi_evthdl_iblock_cookie;
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate 	uint_t			ndi_evthdl_high_plevels;
607c478bd9Sstevel@tonic-gate 	uint_t			ndi_evthdl_other_plevels;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate 	uint_t			ndi_evthdl_n_events;
637c478bd9Sstevel@tonic-gate 	ndi_event_cookie_t 	*ndi_evthdl_cookie_list;
647c478bd9Sstevel@tonic-gate 	ndi_event_hdl_t 	ndi_next_hdl;
657c478bd9Sstevel@tonic-gate };
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /* prototypes needed by sunndi.c */
687c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_bytes(prop_handle_t *, void *data, uint_t);
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_ints(prop_handle_t *, void *data, uint_t);
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_int64(prop_handle_t *, void *data, uint_t);
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate int ddi_prop_int64_op(prop_handle_t *, uint_t, int64_t *);
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate int ddi_prop_update_common(dev_t, dev_info_t *, int, char *, void *, uint_t,
777c478bd9Sstevel@tonic-gate     int (*)(prop_handle_t *, void *, uint_t));
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate int ddi_prop_lookup_common(dev_t, dev_info_t *, uint_t, char *, void *,
807c478bd9Sstevel@tonic-gate     uint_t *, int (*)(prop_handle_t *, void *, uint_t *));
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate int ddi_prop_remove_common(dev_t, dev_info_t *, char *, int);
837c478bd9Sstevel@tonic-gate void ddi_prop_remove_all_common(dev_info_t *, int);
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_string(prop_handle_t *, void *, uint_t);
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_strings(prop_handle_t *, void *, uint_t);
887c478bd9Sstevel@tonic-gate int ddi_prop_fm_decode_strings(prop_handle_t *, void *, uint_t *);
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * Internal configuration routines
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate int i_ndi_config_node(dev_info_t *, ddi_node_state_t, uint_t);
947c478bd9Sstevel@tonic-gate int i_ndi_unconfig_node(dev_info_t *, ddi_node_state_t, uint_t);
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Obsolete interface, no longer used, to be removed.
987c478bd9Sstevel@tonic-gate  * Retained only for driver compatibility.
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate void i_ndi_block_device_tree_changes(uint_t *);		/* obsolete */
1017c478bd9Sstevel@tonic-gate void i_ndi_allow_device_tree_changes(uint_t);		/* obsolete */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * ndi_dev_is_auto_assigned_node: Return non-zero if the nodeid in dev
1057c478bd9Sstevel@tonic-gate  * has been auto-assigned by the framework and should be auto-freed.
1067c478bd9Sstevel@tonic-gate  * (Intended for use by the framework only.)
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate int i_ndi_dev_is_auto_assigned_node(dev_info_t *);
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * Get and set nodeclass and node attributes.
1127c478bd9Sstevel@tonic-gate  * (Intended for ddi framework use only.)
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate ddi_node_class_t i_ndi_get_node_class(dev_info_t *);
1157c478bd9Sstevel@tonic-gate void i_ndi_set_node_class(dev_info_t *, ddi_node_class_t);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate int i_ndi_get_node_attributes(dev_info_t *);
1187c478bd9Sstevel@tonic-gate void i_ndi_set_node_attributes(dev_info_t *, int);
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * Set nodeid .. not generally advisable.
1227c478bd9Sstevel@tonic-gate  * (Intended for the ddi framework use only.)
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate void i_ndi_set_nodeid(dev_info_t *, int);
1257c478bd9Sstevel@tonic-gate 
126*f4da9be0Scth /*
127*f4da9be0Scth  * Make driver.conf children.
128*f4da9be0Scth  * (Intended for the ddi framework use only.)
129*f4da9be0Scth  */
130*f4da9be0Scth int i_ndi_make_spec_children(dev_info_t *, uint_t);
131*f4da9be0Scth 
1327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate #endif
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate #endif	/* _SYS_NDI_IMPLDEFS_H */
137