xref: /titanic_51/usr/src/uts/common/sys/ndi_impldefs.h (revision f4da9be01648d6afa604495d9b9956dddeb92a8c)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <sys/types.h>
327c478bd9Sstevel@tonic-gate #include <sys/param.h>
337c478bd9Sstevel@tonic-gate #include <sys/t_lock.h>
347c478bd9Sstevel@tonic-gate #include <sys/ddipropdefs.h>
357c478bd9Sstevel@tonic-gate #include <sys/devops.h>
367c478bd9Sstevel@tonic-gate #include <sys/autoconf.h>
377c478bd9Sstevel@tonic-gate #include <sys/mutex.h>
387c478bd9Sstevel@tonic-gate #include <vm/page.h>
397c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /* event handle for callback management */
467c478bd9Sstevel@tonic-gate struct ndi_event_hdl {
477c478bd9Sstevel@tonic-gate 	dev_info_t		*ndi_evthdl_dip;
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate 	/*
507c478bd9Sstevel@tonic-gate 	 * mutex that protect the handle and event defs
517c478bd9Sstevel@tonic-gate 	 */
527c478bd9Sstevel@tonic-gate 	kmutex_t		ndi_evthdl_mutex;
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate 	/*
557c478bd9Sstevel@tonic-gate 	 * mutex that just protects the callback list
567c478bd9Sstevel@tonic-gate 	 */
577c478bd9Sstevel@tonic-gate 	kmutex_t		ndi_evthdl_cb_mutex;
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	ndi_evthdl_iblock_cookie;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate 	uint_t			ndi_evthdl_high_plevels;
627c478bd9Sstevel@tonic-gate 	uint_t			ndi_evthdl_other_plevels;
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate 	uint_t			ndi_evthdl_n_events;
657c478bd9Sstevel@tonic-gate 	ndi_event_cookie_t 	*ndi_evthdl_cookie_list;
667c478bd9Sstevel@tonic-gate 	ndi_event_hdl_t 	ndi_next_hdl;
677c478bd9Sstevel@tonic-gate };
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* prototypes needed by sunndi.c */
707c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_bytes(prop_handle_t *, void *data, uint_t);
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_ints(prop_handle_t *, void *data, uint_t);
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_int64(prop_handle_t *, void *data, uint_t);
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate int ddi_prop_int64_op(prop_handle_t *, uint_t, int64_t *);
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate int ddi_prop_update_common(dev_t, dev_info_t *, int, char *, void *, uint_t,
797c478bd9Sstevel@tonic-gate     int (*)(prop_handle_t *, void *, uint_t));
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate int ddi_prop_lookup_common(dev_t, dev_info_t *, uint_t, char *, void *,
827c478bd9Sstevel@tonic-gate     uint_t *, int (*)(prop_handle_t *, void *, uint_t *));
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate int ddi_prop_remove_common(dev_t, dev_info_t *, char *, int);
857c478bd9Sstevel@tonic-gate void ddi_prop_remove_all_common(dev_info_t *, int);
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_string(prop_handle_t *, void *, uint_t);
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate int ddi_prop_fm_encode_strings(prop_handle_t *, void *, uint_t);
907c478bd9Sstevel@tonic-gate int ddi_prop_fm_decode_strings(prop_handle_t *, void *, uint_t *);
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  * Internal configuration routines
947c478bd9Sstevel@tonic-gate  */
957c478bd9Sstevel@tonic-gate int i_ndi_config_node(dev_info_t *, ddi_node_state_t, uint_t);
967c478bd9Sstevel@tonic-gate int i_ndi_unconfig_node(dev_info_t *, ddi_node_state_t, uint_t);
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * Obsolete interface, no longer used, to be removed.
1007c478bd9Sstevel@tonic-gate  * Retained only for driver compatibility.
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate void i_ndi_block_device_tree_changes(uint_t *);		/* obsolete */
1037c478bd9Sstevel@tonic-gate void i_ndi_allow_device_tree_changes(uint_t);		/* obsolete */
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate /*
1067c478bd9Sstevel@tonic-gate  * ndi_dev_is_auto_assigned_node: Return non-zero if the nodeid in dev
1077c478bd9Sstevel@tonic-gate  * has been auto-assigned by the framework and should be auto-freed.
1087c478bd9Sstevel@tonic-gate  * (Intended for use by the framework only.)
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate int i_ndi_dev_is_auto_assigned_node(dev_info_t *);
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate /*
1137c478bd9Sstevel@tonic-gate  * Get and set nodeclass and node attributes.
1147c478bd9Sstevel@tonic-gate  * (Intended for ddi framework use only.)
1157c478bd9Sstevel@tonic-gate  */
1167c478bd9Sstevel@tonic-gate ddi_node_class_t i_ndi_get_node_class(dev_info_t *);
1177c478bd9Sstevel@tonic-gate void i_ndi_set_node_class(dev_info_t *, ddi_node_class_t);
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate int i_ndi_get_node_attributes(dev_info_t *);
1207c478bd9Sstevel@tonic-gate void i_ndi_set_node_attributes(dev_info_t *, int);
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate /*
1237c478bd9Sstevel@tonic-gate  * Set nodeid .. not generally advisable.
1247c478bd9Sstevel@tonic-gate  * (Intended for the ddi framework use only.)
1257c478bd9Sstevel@tonic-gate  */
1267c478bd9Sstevel@tonic-gate void i_ndi_set_nodeid(dev_info_t *, int);
1277c478bd9Sstevel@tonic-gate 
128*f4da9be0Scth /*
129*f4da9be0Scth  * Make driver.conf children.
130*f4da9be0Scth  * (Intended for the ddi framework use only.)
131*f4da9be0Scth  */
132*f4da9be0Scth int i_ndi_make_spec_children(dev_info_t *, uint_t);
133*f4da9be0Scth 
1347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1357c478bd9Sstevel@tonic-gate }
1367c478bd9Sstevel@tonic-gate #endif
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #endif	/* _SYS_NDI_IMPLDEFS_H */
139