sunmdi.h revision 25e8c5aa2b496d9026e958ac731a610167574f59
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SUNMDI_H
#define _SYS_SUNMDI_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Multiplexed I/O global include
*/
#include <sys/ddipropdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most MDI functions return success or failure
*/
#define MDI_SUCCESS 0 /* Call Success */
/*
* handle to mdi_pathinfo node
*/
typedef struct x_mdi_pathinfo *mdi_pathinfo_t;
/*
* Path info node state definitions
*/
typedef enum {
/*
* MDI vHCI class definitions
*/
#define MDI_HCI_CLASS_SCSI "scsi_vhci"
#define MDI_HCI_CLASS_IB "ib"
#ifdef _KERNEL
/*
* mpxio component definitions: Every registered component of the
* mpxio system has a "mpxio-component" property attached to it.
* Identify its function
*/
#define MDI_COMPONENT_NONE 0
#define MDI_COMPONENT_VHCI 0x1
#define MDI_COMPONENT_PHCI 0x2
#define MDI_COMPONENT_CLIENT 0x4
/*
* mdi_pathinfo node state utility definitions
*/
#define MDI_PATHINFO_STATE_TRANSIENT 0x00010000
#define MDI_PATHINFO_STATE_USER_DISABLE 0x00100000
#define MDI_PATHINFO_STATE_DRV_DISABLE 0x00200000
#define MDI_PATHINFO_STATE_DRV_DISABLE_TRANSIENT 0x00400000
#define MDI_PATHINFO_STATE_MASK 0x0000FFFF
#define MDI_PATHINFO_EXT_STATE_MASK 0xFFF00000
#define USER_DISABLE 1
#define DRIVER_DISABLE 2
#define DRIVER_DISABLE_TRANSIENT 3
/*
* Most MDI functions return success or failure
*/
#define MDI_SUCCESS 0 /* Call Success */
/*
* MDI operation vector structure definition
*/
#define MDI_OPS_REV_1 1
#define MDI_OPS_REV MDI_OPS_REV_1
/*
* MDI device hotplug notification
*/
/*
* MDI path retire interfaces
*/
/*
* MDI devinfo locking functions.
*/
void mdi_devi_enter(dev_info_t *, int *);
void mdi_devi_exit_phci(dev_info_t *, int);
void mdi_devi_enter_phci(dev_info_t *, int *);
void mdi_devi_exit(dev_info_t *, int);
/*
* MDI device support functions.
*/
int mdi_devi_pdip_entered(dev_info_t *);
/*
*/
/*
* mdi_pathinfo management functions.
*
* Find, allocate and Free functions.
*/
int mdi_pi_alloc_compatible(dev_info_t *, char *, char *, char *,
char **, int, int, mdi_pathinfo_t **);
int mdi_pi_free(mdi_pathinfo_t *, int);
void mdi_hold_path(mdi_pathinfo_t *);
void mdi_rele_path(mdi_pathinfo_t *);
/*
* mdi_pathinfo node state change functions.
*/
int mdi_pi_online(mdi_pathinfo_t *, int);
int mdi_pi_standby(mdi_pathinfo_t *, int);
int mdi_pi_fault(mdi_pathinfo_t *, int);
int mdi_pi_offline(mdi_pathinfo_t *, int);
/*
* NOTE: the next 2 interfaces will be removed once the NWS files are
* changed to use the new mdi_{enable,disable}_path interfaces
*/
int mdi_pi_disable_path(mdi_pathinfo_t *, int);
int mdi_pi_enable_path(mdi_pathinfo_t *, int);
/*
* MPxIO-PM stuff
*/
typedef enum {
MDI_PM_PRE_CONFIG = 0,
} mdi_pm_op_t;
int
int
/*
* mdi_pathinfo node walker function.
*/
int mdi_component_is_vhci(dev_info_t *, const char **);
int mdi_component_is_phci(dev_info_t *, const char **);
int mdi_component_is_client(dev_info_t *, const char **);
/*
* mdi_pathinfo node member functions
*/
void mdi_pi_lock(mdi_pathinfo_t *);
void mdi_pi_unlock(mdi_pathinfo_t *);
char *mdi_pi_get_addr(mdi_pathinfo_t *);
/*
* mdi_pathinfo Property handling functions
*/
int mdi_prop_remove(mdi_pathinfo_t *, char *);
int mdi_prop_update_int(mdi_pathinfo_t *, char *, int);
int mdi_prop_update_string(mdi_pathinfo_t *, char *, char *);
int mdi_prop_lookup_int(mdi_pathinfo_t *, char *, int *);
int mdi_prop_lookup_string(mdi_pathinfo_t *, char *, char **);
int mdi_prop_free(void *);
/*
* pHCI driver instance registration/unregistration
*
* mdi_phci_register() is called by a pHCI drivers to register itself as a
* transport provider for a specific 'class' (see mdi_vhci_register() above);
* it should be called from attach(9e).
*
* mdi_phci_unregister() is called from detach(9e) to unregister a pHCI
* instance from the framework.
*/
int mdi_phci_register(char *, dev_info_t *, int);
int mdi_phci_unregister(dev_info_t *, int);
/* get set phci private data */
dev_info_t **, char *);
/*
* mdi_vhci node walker function
*/
/*
* mdi_phci node walker function
*/
void *arg);
/*
* mdi_client node walker function
*/
void *arg);
/*
* MDI PHCI driver list helper functions
*/
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SUNMDI_H */