sunndi.h revision 5cd376e8b7030707d78315f63adb4bb2b4d9963e
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * Sun Specific NDI definitions 0N/A#
define NDI_BUSY -
5 /* device busy - could not offline */ 0N/A * In general, the underlying driver MUST be held 0N/A * to call it's property functions. 0N/A * Used to create boolean properties 0N/A * Used to create, modify, and lookup integer properties 0N/A * Used to create, modify, and lookup string properties 0N/A * Used to create, modify, and lookup byte properties 0N/A * Used to remove properties 0N/A * Nexus Driver Functions 0N/A * Allocate and initialize a new dev_info structure. 0N/A * This routine will often be called at interrupt time by a nexus in 0N/A * response to a hotplug event, therefore memory allocations are 0N/A * not allowed to sleep. 0N/A * Remove an initialized (but not yet attached) dev_info 0N/A * node from it's parent. 0N/A/* devinfo locking: use DEVI_BUSY_OWNED in ASSERTs to verify */ 0N/A/* devinfo ref counting */ 0N/A/* driver ref counting */ 0N/A * Change the node name 0N/A * Place the devinfo in the DS_BOUND state, 0N/A * binding a driver to the device 0N/A * all flags are ignored. 0N/A * Asynchronous version of ndi_devi_bind_driver, callable from 0N/A * interrupt context. The dip must be a persistent node. 0N/A * Return devctl state of the child addressed by "name@addr". 0N/A * For use by a driver's DEVCTL_DEVICE_GETSTATE handler. 0N/A * Transition the child addressed by "name@addr" to the online state. * For use by a driver's DEVCTL_DEVICE_ONLINE handler. * Transition the child addressed by "name@addr" to the offline state. * For use by a driver's DEVCTL_DEVICE_OFFLINE handler. * Remove the child addressed by name@addr. * For use by a driver's DEVCTL_DEVICE_REMOVE handler. * For use by a driver's DEVCTL_BUS_GETSTATE handler. * Place the devinfo in the ONLINE state * Generic devctl ioctl handler * Asynchronous version of ndi_devi_online, callable from interrupt * context. The dip must be a persistent node. * Configure children of a nexus node. * NDI_ONLINE_ATTACH - Attach driver to devinfo node when placing * NDI_CONFIG - Recursively configure children if child is nexus node * Unconfigure children of a nexus node. * NDI_DEVI_REMOVE - Remove child devinfo nodes * NDI_UNCONFIG - Put child devinfo nodes to uninitialized state, * release resources held by child nodes. * Interrupt Resource Management (IRM) Pools. * Take a device node "Offline". * Offline means to detach the device instance from the bound * driver and setting the devinfo state to prevent deferred attach * from re-attaching the device instance. * NDI_DEVI_REMOVE - Remove the node from the devinfo tree after * first taking it Offline. #
define NDI_CONFIG 0x00000008 /* recursively config descendants */#
define NDI_UNCONFIG 0x00000010 /* unconfig to uninitialized state */#
define NDI_DEVI_BIND 0x00000020 /* transition to DS_BOUND state */#
define NDI_MTC_OFF 0x10000000 /* disable multi-threading */#
define NDI_USER_REQ 0x20000000 /* user requested operation *//* ndi interface flag values */ * Find the child dev_info node of parent nexus 'p' whose name * matches "cname"@"caddr". Use ndi_devi_findchild() instead. * Find the child dev_info node of parent nexus 'p' whose name * matches device name "name"@"addr". * Find the child dev_info node of parent nexus 'p' whose name * matches "dname"@"ua". If a child doesn't have a "ua" * value, it calls the function "make_ua" to create it. * Maintain DEVI_DEVICE_REMOVED hotplug devi_state for remove/reinsert hotplug * generate debug msg via NDI_DEVI_DEBUG flag * Copy in the devctl IOCTL data structure and the strings referenced * Convenience functions for use by nexus drivers as part of the * implementation of devctl IOCTL handling. * Post an event notification up the device tree hierarchy to the * parent nexus, until claimed by a bus nexus driver or the top * of the dev_info tree is reached. * Called by the NDI Event Framework to deliver a registration request to the * appropriate bus nexus driver. * Called by the NDI Event Framework to deliver an unregister request to the * appropriate bus nexus driver. * Called by the NDI Event Framework and/or a bus nexus driver's * implementation of the (*bus_get_eventcookie)() interface up the device tree * hierarchy, until claimed by a bus nexus driver or the top of the dev_info * tree is reached. The NDI Event Framework will skip nexus drivers which are * not configured to handle NDI events. * ndi event callback support routines: * these functions require an opaque ndi event handle * structure for maintaining each registered callback char *
devname;
/* name of device defining this callback */ * a nexus driver defines events that it can support using the /* ndi_event_attributes */ * allocate an ndi event handle * free the ndi event handle * bind or unbind a set of events to/from the event handle * add an event callback info to the ndi event handle * remove an event callback registration from the ndi event handle * perform callbacks for a specified cookie * do callback for just one child_dip, regardless of attributes * ndi_event_tag_to_cookie: utility function to find an event cookie * ndi_event_cookie_to_tag: utility function to find an event tag * ndi_event_cookie_to_name: utility function to find an event * name given an event_cookie * ndi_event_tag_to_name: utility function to find an event * name given an event_tag * ndi_event_dump_hdl: debug functionality used to display event handle * Default busop bus_config helper functions * Called by the Nexus/HPC drivers to register, unregister and interact * with the hotplug framework for the specified hotplug connection. * Bus Resource allocation structures and function prototypes exported /* structure for specifying a request */ /* see bit definitions below */ /* the allocated resource to be */ /* from ra_boundbase, for the */ /* allocated resource to be */ /* allocated base address */ /* ra_flags bit definitions */ /* allocated resource address */ /* according to the ra_len */ /* value (alignment mask will */ /* be (ra_len - 1)). Value of */ /* ra_len has to be power of 2. */ /* If this flag is set, value of */ /* ra_align_mask will be ignored. */ /* should be restricted to the */ /* area specified by ra_boundbase */ /* address (ra_addr value) is */ /* (ra_len) chunk is not available */ /* then allocate as big chunk as */ /* possible which is less than or */ /* equal to ra_len size. */ /* return values specific to bus resource allocator */ /* Predefined types for generic type of resources */ /* flag bit definition */ #
define NDI_RA_PASS 0x0001 /* pass request up the dev tree */ * Prototype definitions for functions exported * ndi_dev_is_prom_node: Return non-zero if the node is a prom node * ndi_dev_is_pseudo_node: Return non-zero if the node is a pseudo node. * NB: all non-prom nodes are pseudo nodes. * c.f. ndi_dev_is_persistent_node * ndi_dev_is_persistent_node: Return non-zero if the node has the * property of persistence. * ndi_dev_is_hotplug_node: Return non-zero if the node was created by hotplug. * ndi_dev_is_hidden_node: Return non-zero if the node is hidden. * ndi_devi_set_hidden: mark a node as hidden * ndi_devi_clr_hidden: mark a node as visible * Event posted when a fault is reported * Ndi 'flavor' support: These interfaces are to support a nexus driver * with multiple 'flavors' of children (devi_flavor of child), coupled * with a child flavor-specifc private data mechanism (via devi_flavor_v * of parent). This is provided as an extension to ddi_[sg]et_driver_private, * where the vanilla 'flavor' is what is stored or retrieved via * ddi_[sg]et_driver_private. * Flavors are indexed with a small integer. The first flavor, flavor * zero, is always present and reserved as the 'vanilla' flavor. * Space for extra flavors can be allocated and private pointers * with respect to each flavor set and retrieved. * NOTE:For a nexus driver, if the need to support multiple flavors of * children is understood from the begining, then a private 'flavor' * mechanism can be implemented via ddi_[sg]et_driver_private. * With SCSA, the need to support multiple flavors of children was not * anticipated, and ddi_get_driver_private(9F) of an initiator port * devinfo node was publicly defined in the DDI to return a * scsi_device(9S) child-flavor specific value: a pointer to * scsi_hba_tran(9S). Over the years, each time the need to support * has been devised. The ndi 'flavors' interfaces provide a simple way * to address this issue that can be used by both SCSA nexus support, * and by other nexus drivers. * Interfaces to maintain flavor-specific private data for children of self /* Interfaces for 'self' nexus driver to get/set flavor of child */ #
endif /* _SYS_SUNNDI_H */