dmd_impl.h revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __DMD_IMPL_H
#define __DMD_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <mms_dmd.h>
/* Begin: 32-bit align copyin() structs for amd64 only due to 32-bit x86 ABI */
#pragma pack(8)
#endif
typedef struct drm_blksize {
typedef struct drm_target {
} drm_target_t;
typedef struct drm_open {
} drm_open_t;
typedef struct drm_err {
} drm_err_t;
typedef struct drm_mtop {
/*
* This is the fixed length (32 and 64 bits) version of
* struct mtop used by the st driver.
*/
} drm_mtop_t;
typedef struct drm_request {
union {
} drm_req_u;
#define DRM_REQ_NONE 0 /* No request to drm */
#define DRM_REQ_OPEN 1
#define DRM_REQ_CLOSE 3
#define DRM_REQ_WRITE 4
#define DRM_REQ_READ 5
#define DRM_REQ_READ_TM 6
#define DRM_REQ_READ_ERR 7
#define DRM_REQ_WRITEERR 8
#define DRM_REQ_MTIOCTOP 9
#define DRM_REQ_MTGET 10
#define DRM_REQ_WRITE0 11
#define DRM_REQ_WRITE_ERR 12
#define DRM_REQ_CLRERR 13
#define DRM_REQ_BLK_LIMIT 14
#define DRM_REQ_GET_POS 15
#define DRM_REQ_LOCATE 16
#define DRM_REQ_MOUNT_OPT 17
#define DRM_REQ_GET_CAPACITY 18
#define DRM_REQ_UPT_CAPACITY 19
#define DRM_REQ_GET_DENSITY 20
#define DRM_REQ_SET_DENSITY 21
#define DRM_REQ_MTGETPOS 22
#define DRM_REQ_MTRESTPOS 23
#define DRM_REQ_MTIOCLTOP 24
typedef struct drm_mtget {
/*
* This is the fixed length (32 and 64 bits) version of
* struct mtget used by the st driver.
*/
/* the following two registers are grossly device dependent */
/* optional error info. */
} drm_mtget_t;
typedef struct drm_reply {
union {
} drm_rep_u;
} drm_reply_t;
#define DRM_REP_NOTIFY_WRITE 0x01
#define DRM_REP_NOTIFY_READ 0x02
#define DRM_REP_EOF 0x04
#define DRM_REP_FATAL 0x08
/*
* IOCTL to the watcher
*/
/*
* IOCTL to the drive manager
*/
#if defined(_SYSCALL32)
typedef struct drm_allowed_cmds32 {
}
}
#endif /* _SYSCALL32 */
typedef enum drm_cmd {
DRM_REQUEST, /* Get request from driver */
DRM_RESUME, /* Resume the user */
DRM_MMS_MODE, /* Set/unset MMS mode */
DRM_BLKSIZE, /* Set max blksize */
DRM_TARG_MINOR, /* Set target minor */
DRM_DM_READY, /* Rebind a device */
DRM_REBIND_DEV, /* Rebind a device */
DRM_PRSV_KEY, /* Set prsv key */
DRM_DISALLOWED_CMDS, /* Set disallowed scsi cmds */
DRM_DISALLOWED_IOCTLS, /* Set disallowed scsi ioctls */
DRM_PROBE_DEV, /* Probing this device */
DRM_TDV_PID /* Get tdv's pid */
} drm_cmd_t;
/*
* Struct for DRM_SET_INO
*/
typedef struct drm_probe_dev {
#define DMD_FIRST_DM_MINOR 2
#define DMD_NOT_READY 0
#define DMD_READY 1
#define DMD_FIRST_DEV_ORDINAL 1
#define DRM_MINOR_MASK 0xff
#define DMD_WCR_NAME "watcher"
#define DMD_STAT_NAME "stat"
#define DMD_DRM_NAME "drm"
#define DMD_TDV_NAME "tdv"
typedef struct dmd_stat_dev {
/*
* stat_flags
*/
#define STAT_OPENED 0x01
#define STAT_LDI_OPENED 0x02
#define STAT_WCR 0x04
#define STAT_DRM 0x08
#define STAT_TDV 0x10
#define STAT_STAT 0x20
#define STAT_WAIT_RESUME 0x40
typedef struct dmd_stat_info {
/*
* When using DMD_STAT_INFO ioctl to get info, the amount of
* memory for the array must be large enough to hold the number
* of devices specified in stat_num.
* malloc(sizeof(dmd_stat_info_t) +
* (stat_num - 1) * sizeof(dmd_stat_dev_t));
*/
/*
* DMD stat ioctl
*/
/* End: 32-bit align copyin() structs for amd64 only due to 32-bit x86 ABI */
#pragma pack()
#endif
#ifdef _KERNEL
typedef struct dmd_wcr {
int wcr_inst;
void *wcr_proc_ref; /* proc_ref for dm signal */
} dmd_wcr_t;
typedef struct dmd_stat {
int stat_inst;
void *stat_proc_ref; /* proc_ref for dm signal */
int stat_opens; /* num of dev's opened */
} dmd_stat_t;
typedef struct drm_share {
/*
* Data share with tdv
*/
void *drm_share_proc_ref; /* proc_ref for dm signal */
int drm_share_oflags; /* Open flags */
int drm_share_otyp; /* Open types */
} drm_share_t;
typedef struct dmd_drm {
int drm_inst;
int drm_ioctl_mode;
/* must hold drm_sync_mutex */
/* to change this field */
char drm_prsv_buf[24];
char drm_prsv_key[8];
} dmd_drm_t;
#define DRM_READY 0x02
#define DRM_DEV_ADDED 0x04
typedef struct dmd_tdv {
int tdv_inst;
} dmd_tdv_t;
#define TDV_BOUND 0x0002
#define TDV_NOTIFY_WRITE 0x0004
#define TDV_NOTIFY_READ 0x0008
#define TDV_MMS_MODE 0x0010
#define TDV_EOF 0x0020
/* signaled DRM */
typedef union dmd_soft_state {
#define DMD_BUSY() { \
dmd_busy++; \
mutex_exit(&dmd_busy_mutex); \
}
#define DMD_UNBUSY() { \
dmd_busy--; \
mutex_exit(&dmd_busy_mutex); \
}
#define DMD_INC_OPENS() DMD_BUSY()
#define DMD_DEC_OPENS() DMD_UNBUSY()
} \
}
#define DRM_UNBUSY(drm) { \
}
} \
}
#define TDV_UNBUSY(tdv) { \
}
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* __DMD_IMPL_H */