daddef.h revision cd210bb4840e6add5921c775aa07cebd6891f738
/*
* 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 _SYS_DADA_TARGETS_DADDF_H
#define _SYS_DADA_TARGETS_DADDF_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Defines for SCSI direct access devices
*/
#define FIXEDFIRMWARE /* fixed firmware for volume control */
/*
* Local definitions, for clarity of code
*/
#define NO_PKT_ALLOCATED ((struct buf *)0)
#define Restore_state(un) \
#define CTYPE_DISK 2
/*
* Structure for recording whether a device is fully open or closed.
* Assumptions:
*
* + There are only 8 partitions possible.
* + BLK, MNT, CHR, SWP don't change in some future release!
*
*/
#define DCDUNIT_SHIFT 3
#define DCDPART_MASK 7
struct ocinfo {
/*
* Types BLK, MNT, CHR, SWP,
* assumed to be types 0-3.
*/
};
union ocmap {
};
/*
* Private info for dcd disks.
*
* Pointed to by the un_private pointer
* of one of the dcd_device structures.
*/
struct dcd_disk {
char *un_srqbufp; /* sense buffer for special io */
int un_diskcapacity; /* capacity as returned by drive */
int un_lbasize; /* logical (i.e. device) block size */
int un_lbadiv; /* log2 of lbasize */
int un_blknoshift; /* log2 of multiple of DEV_BSIZE */
/* blocks making up a logical block */
int un_secsize; /* sector size (allow request on */
/* this boundry) */
int un_secdiv; /* log2 of secsize */
short un_ncmds; /* number of cmds in transport */
short un_throttle; /* This is used for throttling if */
/* HBA has queuing */
short un_sbuf_busy; /* Busy wait flag for the sbuf */
int un_cmd_flags; /* cache some frequently used values */
int un_cmd_stat_size; /* in make_sd_cmd */
int un_dcvb_timeid; /* timeout id for dlyd cv broadcast */
void *un_devid; /* device id */
/* Bus master capability */
/* This is used in busy handler */
short un_power_level; /* Power Level */
short un_save_state; /* Save the state for suspend/resume */
};
/*
* device error statistics
*/
struct dcd_errstats {
};
dk_map32))
#endif /* defined(_KERNEL) || defined(_KMEMUSER) */
/*
* Disk driver states
*/
#define DCD_STATE_NORMAL 0
#define DCD_STATE_OFFLINE 1
#define DCD_STATE_RWAIT 2
#define DCD_STATE_DUMPING 3
#define DCD_STATE_SUSPENDED 4
#define DCD_STATE_FATAL 5
#define DCD_STATE_PM_SUSPENDED 6
/*
* Disk power levels.
*/
#define DCD_DEVICE_ACTIVE 0x2
#define DCD_DEVICE_IDLE 0x1
#define DCD_DEVICE_STANDBY 0x0
/*
* Macros used in obtaining the device ID for the disk.
*/
#define DCD_SERIAL_NUMBER_LENGTH 20
#define DCD_MODEL_NUMBER_LENGTH 40
/*
* The table is to be interpreted as follows: The rows lists all the states
* and each column is a state that a state in each row *can* reach. The entries
* in the table list the event that cause that transition to take place.
* For e.g.: To go from state RWAIT to SUSPENDED, event (d)-- which is the
* invocation of DDI_SUSPEND-- has to take place. Note the same event could
* cause the transition from one state to two different states. e.g., from
* state SUSPENDED, when we get a DDI_RESUME, we just go back to the *last
* state* whatever that might be. (NORMAL or OFFLINE).
*
*
* State Transition Table:
*
* NORMAL OFFLINE RWAIT DUMPING SUSPENDED
*
* NORMAL - (a) (b) (c) (d)
*
* OFFLINE (e) - (e) (c) (d)
*
* RWAIT (f) NP - (c) (d)
*
* DUMPING NP NP NP - NP
*
* SUSPENDED (g) (g) (b) NP* -
*
*
* NP: Not Possible.
* (a): Disk does not respond.
* (b): Packet Allocation Fails
* (c): Panic - Crash dump
* (d): DDI_SUSPEND is called.
* (e): Disk has a successful I/O completed.
* (f): sdrunout() calls sdstart() which sets it NORMAL
* (g): DDI_RESUME is called.
* * : When suspended, we dont change state during panic dump
*/
/*
* Error levels
*/
#define DCDERR_ALL 0
#define DCDERR_UNKNOWN 1
#define DCDERR_INFORMATIONAL 2
#define DCDERR_RECOVERED 3
#define DCDERR_RETRYABLE 4
#define DCDERR_FATAL 5
/*
* Parameters
*/
/*
* 60 seconds is a *very* reasonable amount of time for most slow CD
* operations.
*/
#define DCD_IO_TIME 60
/*
* Timeout value for ATA_FLUSH_CACHE used in DKIOCFLUSHWRITECACHE
*/
#define DCD_FLUSH_TIME 60
/*
* 2 hours is an excessively reasonable amount of time for format operations.
*/
/*
* 5 seconds is what we'll wait if we get a Busy Status back
*/
/*
* Number of times we'll retry a normal operation.
*
* This includes retries due to transport failure
* (need to distinguish between Target and Transport failure)
*/
#define DCD_RETRY_COUNT 5
/*
* Maximum number of units we can support
* (controlled by room in minor device byte)
* XXX: this is out of date!
*/
#define DCD_MAXUNIT 32
/*
* 30 seconds is what we will wait for the IO to finish
* before we fail the DDI_SUSPEND
*/
#define DCD_WAIT_CMDS_COMPLETE 30
/*
* dcdintr action codes
*/
#define COMMAND_DONE 0
#define COMMAND_DONE_ERROR 1
#define QUE_COMMAND 2
#define QUE_SENSE 3
#define JUST_RETURN 4
/*
* Indicator for Soft and hard errors
*/
#define COMMAND_SOFT_ERROR 1
#define COMMAND_HARD_ERROR 2
/*
* Drive Types (and characteristics)
*/
#define VIDMAX 8
#define PIDMAX 16
struct dcd_drivetype {
char *name; /* for debug purposes */
char ctype; /* controller type */
char options; /* drive options */
char pio_mode; /* This the Pio mode number */
char dma_mode; /* Multi word dma mode */
};
/*
* The options values
*/
#define DMA_SUPPORTTED 0x01
#define BLOCK_MODE 0x02
#ifndef LOG_EMERG
#define LOG_WARNING CE_NOTE
#define LOG_NOTICE CE_NOTE
#endif
/*
* Some internal error codes for driver functions.
*/
#define DCD_EACCES 1
/*
* Error returns from sd_validate_geometry()
*/
#define DCD_BAD_LABEL -1
#define DCD_NO_MEM_FOR_LABEL -2
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DADA_TARGETS_DADDF_H */