dkio.h revision 65908c77dfc02644236ba18bffe67b5ed6f23135
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKIO_H
#define _SYS_DKIO_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Structures and definitions for disk io control commands
*/
/*
* Structures used as data by ioctl calls.
*/
/* unit # & NULL (ie - "xyc1") */
/*
* Used for controller info
*/
struct dk_cinfo {
};
/*
* Controller types
*/
#define DKC_UNKNOWN 0
#define DKC_WDC2880 2
#define DKC_DSD5215 5
#define DKC_ACB4000 7
#define DKC_MD21 8
#define DKC_NCRFLOPPY 10
#define DKC_SMSFLOPPY 12
/*
* Sun reserves up through 1023
*/
#define DKC_CUSTOMER_BASE 1024
/*
* Flags
*/
/*
* Used for all partitions
*/
struct dk_allmap {
};
#if defined(_SYSCALL32)
struct dk_allmap32 {
};
#endif /* _SYSCALL32 */
/*
* Definition of a disk's geometry
*/
struct dk_geom {
unsigned short dkg_ncyl; /* # of data cylinders */
unsigned short dkg_acyl; /* # of alternate cylinders */
unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */
unsigned short dkg_nhead; /* # of heads */
unsigned short dkg_obs1; /* obsolete */
unsigned short dkg_nsect; /* # of data sectors per track */
unsigned short dkg_intrlv; /* interleave factor */
unsigned short dkg_obs2; /* obsolete */
unsigned short dkg_obs3; /* obsolete */
unsigned short dkg_apc; /* alternates per cyl (SCSI only) */
unsigned short dkg_rpm; /* revolutions per minute */
unsigned short dkg_pcyl; /* # of physical cylinders */
unsigned short dkg_write_reinstruct; /* # sectors to skip, writes */
unsigned short dkg_read_reinstruct; /* # sectors to skip, reads */
};
/*
* These defines are for historic compatibility with old drivers.
*/
/*
* Disk io control commands
* Warning: some other ioctls with the DIOC prefix exist elsewhere.
* The Generic DKIOC numbers are from 0 - 50.
* The Floppy Driver uses 51 - 100.
* The Hard Disk (except SCSI) 101 - 106. (these are obsolete)
* The CDROM Driver 151 - 200.
* The USCSI ioctl 201 - 250.
*/
/*
* The following ioctls are generic in nature and need to be
* suported as appropriate by all disk drivers
*/
/*
* Disk Cache Controls. These ioctls should be supported by
* all disk drivers.
*
* DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl
* argument, but it should be passed as NULL to allow for future
* reinterpretation. From user-mode, this ioctl request is synchronous.
*
* When invoked from within the kernel, the arg can be NULL to indicate
* a synchronous request or can be the address of a struct dk_callback
* to request an asynchronous callback when the flush request is complete.
* In this case, the flag to the ioctl must include FKIOCTL and the
* dkc_callback field of the pointed to struct must be non-null or the
* request is made synchronously.
*
* In the callback case: if the ioctl returns 0, a callback WILL be performed.
* If the ioctl returns non-zero, a callback will NOT be performed.
* NOTE: In some cases, the callback may be done BEFORE the ioctl call
* returns. The caller's locking strategy should be prepared for this case.
*/
struct dk_callback {
void *dkc_cookie;
int dkc_flag;
};
/* bit flag definitions for dkc_flag */
/* volatile cache; otherwise, flush */
/* volatile and non-volatile cache */
/* enablement status */
/*
* The following ioctls are used by Sun drivers to communicate
* with their associated format routines. Support of these ioctls
* is not required of foreign drivers
*/
/*
* The following ioctl's are removable media support
*/
/*
* ioctl for hotpluggable devices
*/
/*
* Ioctl to force driver to re-read the alternate partition and rebuild
* the internal defect map.
*/
/*
* Used by applications to get disk defect information from IDE
* drives.
*/
#ifdef _SYSCALL32
struct defect_header32 {
int head;
};
#endif /* _SYSCALL32 */
struct defect_header {
int head;
};
/* parameters */
/*
* Used by applications to get partition or slice information
*/
#ifdef _SYSCALL32
struct part_info32 {
int p_length;
};
#endif /* _SYSCALL32 */
struct part_info {
int p_length;
};
struct extpart_info {
};
/* The following ioctls are for Optical Memory Device */
/*
* This state enum is the argument passed to the DKIOCSTATE ioctl.
*/
/*
*/
/*
* ioctl to get the device temperature.
*/
/*
* ioctl to get the media info including physical block size
*/
/*
* Used for providing the temperature.
*/
struct dk_temperature {
short dkt_cur_temp; /* Current disk temperature */
short dkt_ref_temp; /* reference disk temperature */
};
#define DKT_BYPASS_PM 0x1
#define DKT_INVALID_TEMP 0xFFFF
/*
* Used for Media info or the current profile info
*/
struct dk_minfo {
};
/*
* Used for Media info or the current profile info
* including physical block size if supported.
*/
struct dk_minfo_ext {
};
/*
* Media types or profiles known
*/
/*
* SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to
* maintain compatibility with SFF8090. The following define the
* optical media type.
*/
/*
* Media types for other rewritable magnetic media
*/
/*
* specific underlying device of a replicated device.
*/
typedef uint_t volcapinfo_t;
typedef uint_t volcapset_t;
typedef struct volcap {
} volcap_t;
#define VOL_SIDENAME 256
typedef struct vol_directed_rd {
int vdr_flags;
void *vdr_data;
int vdr_side;
char vdr_side_name[VOL_SIDENAME];
#define DKV_SIDE_INIT (-1)
#define DKV_DMR_NEXT_SIDE 0x00000001
#define DKV_DMR_DONE 0x00000002
#define DKV_DMR_ERROR 0x00000004
#define DKV_DMR_SUCCESS 0x00000008
#define DKV_DMR_SHORT 0x00000010
#ifdef _MULTI_DATAMODEL
#pragma pack(4)
#endif
typedef struct vol_directed_rd32 {
char vdr_side_name[VOL_SIDENAME];
#pragma pack()
#endif
#endif /* _MULTI_DATAMODEL */
/*
* The ioctl is used to fetch disk's device type, vendor ID,
*
* Currently there are two device types - DKD_ATA_TYPE which means the
*/
/* These two labels are for dkd_dtype of dk_disk_id_t */
/*
* The argument type for DKIOC_GETDISKID ioctl.
*/
typedef struct dk_disk_id {
union {
struct {
} ata_disk_id;
struct {
} scsi_disk_id;
} disk_id;
} dk_disk_id_t;
/*
* The ioctl is used to update the firmware of device.
*/
/* The argument type for DKIOC_UPDATEFW ioctl */
typedef struct dk_updatefw {
#ifdef _SYSCALL32
typedef struct dk_updatefw_32 {
#endif /* _SYSCALL32 */
/*
* firmware update type - temporary or permanent use
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKIO_H */