raidcfg_spi.h revision 3e4f2897f6618210c2ddb7529d87dc4395159768
/*
* 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_RAIDCFG_SPI_H
#define _SYS_RAIDCFG_SPI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Controller capabilities
*/
#define RAID_CAP_RAID0 1
/*
* General constants
*/
#define OBJ_SEPARATOR_BEGIN -1
#define OBJ_SEPARATOR_END -2
#define OBJ_ATTR_NONE -1
/*
* Array RAID level definition
*/
#define RAID_LEVEL_0 1
#define RAID_LEVEL_1 2
#define RAID_LEVEL_1E 3
#define RAID_LEVEL_5 4
#define RAID_LEVEL_10 5
#define RAID_LEVEL_50 6
/*
* Array cache write policy
*/
#define CACHE_WR_OFF 0
#define CACHE_WR_ON 1
/*
* Array cache read policy
*/
#define CACHE_RD_OFF 0
#define CACHE_RD_ON 1
/*
* Array status
*/
#define ARRAY_STATE_OPTIMAL 0
#define ARRAY_STATE_DEGRADED 1
#define ARRAY_STATE_FAILED 2
/*
* Disk state
*/
#define DISK_STATE_GOOD 0
#define DISK_STATE_FAILED 1
/*
* Array part state
*/
#define ARRAYPART_STATE_GOOD 0
#define ARRAYPART_STATE_MISSED 1
/*
* Disk segment state
*/
#define DISKSEG_STATE_GOOD 1
/*
* Controller connection type
*/
#define TYPE_UNKNOWN 0
#define TYPE_SCSI 1
#define TYPE_SAS 2
#define RAID_TASK_SUSPEND 0
#define RAID_TASK_RESUME 1
#define RAID_TASK_TERMINATE 2
#define HSP_TYPE_GLOBAL 0
#define HSP_TYPE_LOCAL 1
/*
* Sub-command of set attribute
*/
#define SET_CACHE_WR_PLY 0
#define SET_CACHE_RD_PLY 1
/*
* Sub-commands for act method of object
*/
#define ACT_CONTROLLER_OPEN 0
#define ACT_CONTROLLER_CLOSE 1
#define ACT_CONTROLLER_FLASH_FW 2
/*
* Some definitions
*/
#define CONTROLLER_FW_LEN 32
#define CONTROLLER_TYPE_LEN 32
#define DISK_VENDER_LEN 8
#define DISK_PRODUCT_LEN 16
#define DISK_REV_LEN 4
#define RDCFG_PLUGIN_V1 0x10000
#define MAX_PATH_LEN 255
/*
* Mininum array part size: 256M
*/
/*
* Return code
*/
#define SUCCESS 0
#define STD_IOCTL -1
#define ERR_DRIVER_NOT_FOUND -2
#define ERR_DRIVER_OPEN -3
#define ERR_DRIVER_LOCK -4
#define ERR_DRIVER_CLOSED -5
#define ERR_DRIVER_ACROSS -6
#define ERR_ARRAY_LEVEL -7
#define ERR_ARRAY_SIZE -8
#define ERR_ARRAY_STRIPE_SIZE -9
#define ERR_ARRAY_CACHE_POLICY -10
#define ERR_ARRAY_IN_USE -11
#define ERR_ARRAY_TASK -12
#define ERR_ARRAY_CONFIG -13
#define ERR_ARRAY_DISKNUM -14
#define ERR_ARRAY_LAYOUT -15
#define ERR_ARRAY_AMOUNT -16
#define ERR_DISK_STATE -17
#define ERR_DISK_SPACE -18
#define ERR_DISK_SEG_AMOUNT -19
#define ERR_DISK_NOT_EMPTY -20
#define ERR_DISK_TASK -21
#define ERR_TASK_STATE -22
#define ERR_OP_ILLEGAL -23
#define ERR_OP_NO_IMPL -24
#define ERR_OP_FAILED -25
#define ERR_DEVICE_NOENT -26
#define ERR_DEVICE_TYPE -27
#define ERR_DEVICE_DUP -28
#define ERR_DEVICE_OVERFLOW -29
#define ERR_DEVICE_UNCLEAN -30
#define ERR_DEVICE_INVALID -31
#define ERR_NOMEM -32
#define ERR_PRIV -33
#define ERR_PLUGIN -34
/*
* Raid object types
*/
typedef enum {
/*
* Task functions
*/
typedef enum {
/*
* Task state
*/
typedef enum {
/*
* Attributes of all RAID objects
*/
typedef union {
struct {
} idl;
} array_tag_t;
typedef union {
struct {
} cidl;
} disk_tag_t;
typedef struct {
char fw_version[CONTROLLER_FW_LEN];
typedef struct {
} array_attr_t;
typedef struct {
char vendorid[DISK_VENDER_LEN];
char productid[DISK_PRODUCT_LEN];
char revision[DISK_REV_LEN];
} disk_attr_t;
typedef struct {
} hsp_attr_t;
typedef struct {
typedef struct {
typedef struct {
} task_attr_t;
typedef struct {
/*
* Structure used to register plug-in modules
*/
typedef struct raid_lib_type {
struct raid_lib_type *next;
void *lib_handle;
const char *name;
int (*open_controller)(uint32_t, char **);
int (*close_controller)(uint32_t, char **);
raid_obj_type_id_t, int, void *);
void *);
arraypart_attr_t *, char **);
} raid_lib_t;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_RAIDCFG_SPI_H */