sunndi.h revision c333dd99c762d509c7eb6cce222221958e23b4c8
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Sun Specific NDI definitions
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_SUCCESS DDI_SUCCESS /* successful return */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_FAILURE DDI_FAILURE /* unsuccessful return */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_NOMEM -2 /* failed to allocate resources */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_BADHANDLE -3 /* bad handle passed to in function */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_FAULT -4 /* fault during copyin/copyout */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_BUSY -5 /* device busy - could not offline */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define NDI_UNBOUND -6 /* device not bound to a driver */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Property functions: See also, ddipropdefs.h.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * In general, the underlying driver MUST be held
fa9e4066f08beec538e775443c5be79dd423fcabahrens * to call it's property functions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Used to create boolean properties
fa9e4066f08beec538e775443c5be79dd423fcabahrensndi_prop_create_boolean(dev_t match_dev, dev_info_t *dip, char *name);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Used to create, modify, and lookup integer properties
fa9e4066f08beec538e775443c5be79dd423fcabahrensndi_prop_update_int(dev_t match_dev, dev_info_t *dip, char *name, int data);
fa9e4066f08beec538e775443c5be79dd423fcabahrensndi_prop_update_int_array(dev_t match_dev, dev_info_t *dip, char *name,
fa9e4066f08beec538e775443c5be79dd423fcabahrensndi_prop_update_int64(dev_t match_dev, dev_info_t *dip, char *name,
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickndi_prop_update_int64_array(dev_t match_dev, dev_info_t *dip, char *name,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Used to create, modify, and lookup string properties
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickndi_prop_update_string(dev_t match_dev, dev_info_t *dip, char *name,
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickndi_prop_update_string_array(dev_t match_dev, dev_info_t *dip,
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * Used to create, modify, and lookup byte properties
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickndi_prop_update_byte_array(dev_t match_dev, dev_info_t *dip,
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * Used to remove properties
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickndi_prop_remove(dev_t dev, dev_info_t *dip, char *name);
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * Nexus Driver Functions
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * Allocate and initialize a new dev_info structure.
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * This routine will often be called at interrupt time by a nexus in
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * response to a hotplug event, therefore memory allocations are
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * not allowed to sleep.
fa9e4066f08beec538e775443c5be79dd423fcabahrensndi_devi_alloc(dev_info_t *parent, char *node_name, pnode_t nodeid,
99653d4ee642c6528e88224f12409a5f23060994eschrockndi_devi_alloc_sleep(dev_info_t *parent, char *node_name, pnode_t nodeid,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Remove an initialized (but not yet attached) dev_info
99653d4ee642c6528e88224f12409a5f23060994eschrock * node from it's parent.
99653d4ee642c6528e88224f12409a5f23060994eschrock/* devinfo locking: use DEVI_BUSY_OWNED in ASSERTs to verify */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* devinfo ref counting */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* driver ref counting */
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickstruct dev_ops *ndi_hold_driver(dev_info_t *dip);
0373e76b3c3643df49ef3483e0f293fdea61d8c6bonwick * Change the node name
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwickndi_devi_set_nodename(dev_info_t *dip, char *name, int flags);
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * Place the devinfo in the DS_BOUND state,
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick * binding a driver to the device
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * all flags are ignored.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devi_bind_driver(dev_info_t *dip, uint_t flags);
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Asynchronous version of ndi_devi_bind_driver, callable from
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * interrupt context. The dip must be a persistent node.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devi_bind_driver_async(dev_info_t *dip, uint_t flags);
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Return devctl state of the child addressed by "name@addr".
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * For use by a driver's DEVCTL_DEVICE_GETSTATE handler.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp,
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Transition the child addressed by "name@addr" to the online state.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * For use by a driver's DEVCTL_DEVICE_ONLINE handler.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp,
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Transition the child addressed by "name@addr" to the offline state.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * For use by a driver's DEVCTL_DEVICE_OFFLINE handler.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp,
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Remove the child addressed by name@addr.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * For use by a driver's DEVCTL_DEVICE_REMOVE handler.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp,
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Bus get state
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * For use by a driver's DEVCTL_BUS_GETSTATE handler.
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharovndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp,
0e60744c982adecd0a1f146f5637475d07ab1069Pavel Zakharov * Place the devinfo in the ONLINE state
int flags);
nvlist_t *
void *impl_data);
typedef struct ndi_event_callbacks {
void (*ndi_evtcb_callback)();
void *ndi_evtcb_arg;
typedef struct ndi_event_definition {
int ndi_event_tag;
char *ndi_event_name;
typedef struct ndi_event_cookie {
typedef struct ndi_event_set {
#define NDI_EVENTS_REV0 0
char *eventname,
void (*event_callback)
(dev_info_t *,
void *arg,
void *impldata),
void *arg,
ndi_devi_config_vhci(char *, int);
#ifdef DEBUG
void *arg);
typedef struct ndi_ra_request {
struct ddi_fault_event_data {
const char *f_message;
/* Driver.conf property merging */
#ifdef __cplusplus