summaryrefslogtreecommitdiff
path: root/sys/dev/biovar.h
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2005-03-29 22:13:38 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2005-03-29 22:13:38 +0000
commit492880d39deb2fbd02b3f5a61dddbf67218e95ab (patch)
treecf923db14a96e03f9a45c2c6f42971fcc90d26cb /sys/dev/biovar.h
parenta7ade1e7288061f5bdf3cffc36ab46d4c98cbc83 (diff)
add raid defines
ok mickey@
Diffstat (limited to 'sys/dev/biovar.h')
-rw-r--r--sys/dev/biovar.h136
1 files changed, 135 insertions, 1 deletions
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h
index b0251f82e00..111e0f3979a 100644
--- a/sys/dev/biovar.h
+++ b/sys/dev/biovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biovar.h,v 1.2 2003/06/03 20:49:28 deraadt Exp $ */
+/* $OpenBSD: biovar.h,v 1.3 2005/03/29 22:13:37 marco Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -31,6 +31,8 @@
* cookie.
*/
+#include <sys/types.h>
+
struct bio_common {
void *cookie;
};
@@ -45,3 +47,135 @@ struct bio_locate {
int bio_register(struct device *, int (*)(struct device *, u_long,
caddr_t));
#endif
+
+/* RAID section */
+
+#define BIOC_MAX_CDB 16
+#define BIOC_MAX_SENSE 32
+#define BIOC_MAX_PHYSDISK 128 /* based on FC arrays */
+#define BIOC_MAX_VIRTDISK 128 /* based on FC arrays */
+
+/* ioctl tunnel defines */
+/* SHALL be implemented */
+#define BIOCPING _IOWR('B', 32, bioc_ping)
+typedef struct _bioc_ping {
+ void *cookie;
+ int x;
+} bioc_ping;
+
+/* SHALL be implemented */
+#define BIOCCAPABILITIES _IOWR('B', 33, bioc_capabilities)
+typedef struct _bioc_capabilities {
+ void *cookie;
+ u_int64_t ioctls; /* bit field, 1 ioctl supported */
+#define BIOC_PING 0x01
+#define BIOC_ALARM 0x02
+#define BIOC_PREP_REMOVAL 0x04
+#define BIOC_REBUILD 0x08
+#define BIOC_STATUS 0x10
+#define BIOC_SCSICMD 0x20
+#define BIOC_STARTSTOP 0x40
+ u_int32_t raid_types; /* bit field, 1 supported raid type */
+#define BIOC_RAID0 0x01
+#define BIOC_RAID1 0x02
+#define BIOC_RAID3 0x04
+#define BIOC_RAID5 0x08
+#define BIOC_RAID10 0x10
+#define BIOC_RAID01 0x20
+#define BIOC_RAID50 0x40
+} bioc_capabilities;
+
+/* OPTIONAL */
+#define BIOCALARM _IOWR('B', 34, bioc_alarm)
+typedef struct _bioc_alarm {
+ void *cookie;
+ u_int32_t opcode;
+#define BIOCSALARM_DISABLE 0x00
+#define BIOCSALARM_ENABLE 0x01
+#define BIOCSALARM_SILENCE 0x02
+#define BIOCGALARM_STATE 0x03
+#define BIOCSALARM_TEST 0x04
+ u_int8_t state; /* only used with GET function */
+} bioc_alarm;
+
+/* OPTIONAL */
+#define BIOCSCSICMD _IOWR('B', 35, bioc_scsicmd)
+typedef struct _bioc_scsicmd {
+ void *cookie;
+
+ /* in (kernel centric) */
+ u_int8_t channel;
+ u_int8_t target;
+ u_int8_t cdb[BIOC_MAX_CDB];
+ u_int8_t cdblen;
+ u_int8_t direction; /* 0 = out, 1 = in, this is userland centric */
+#define BIOC_DIROUT 0x00
+#define BIOC_DIRIN 0x01
+#define BIOC_DIRNONE 0x02
+
+ /* out (kernel centric) */
+ u_int8_t status;
+ u_int8_t sensebuf[BIOC_MAX_SENSE];
+ u_int8_t senselen;
+
+ /* in & out (kernel centric) */
+ void *data;
+ u_int32_t datalen; /* going in it governs the maximum buffer size
+ going out it contains actual bytes transfered */
+} bioc_scsicmd;
+
+/* OPTIONAL */
+#define BIOCSTARTSTOP _IOWR('B', 36, bioc_startstop)
+typedef struct _bioc_startstop {
+ void *cookie;
+ u_int8_t opcode;
+#define BIOCSUNIT_START 0x00
+#define BIOCSUNIT_STOP 0x01
+ u_int8_t channel;
+ u_int8_t target;
+} bioc_startstop;
+
+/* SHALL be implemented */
+#define BIOCSTATUS _IOWR('B', 37, bioc_status)
+typedef struct _bioc_status {
+ void *cookie;
+ u_int8_t opcode;
+#define BIOCGSTAT_CHANGE 0x00 /* any changes since last call? */
+#define BIOCGSTAT_ALL 0x01 /* get all status */
+#define BIOCGSTAT_PHYSDISK 0x02 /* get physical disk status only */
+#define BIOCGSTAT_VIRTDISK 0x03 /* get virtual disk status only */
+#define BIOCGSTAT_BATTERY 0x04 /* get battery status only */
+#define BIOCGSTAT_ENCLOSURE 0x05 /* get enclosure status only */
+#define BIOCGSTAT_TEMPERATURE 0x06 /* get temperature status only */
+ u_int8_t status; /* global status flag */
+#define BIOC_STATOK 0x00 /* status is OK */
+#define BIOC_STATDEGRAD 0x01 /* status is degraded */
+#define BIOC_STATCRIT 0x02 /* status is critical */
+#define BIOC_STATBAT 0x04 /* something wrong with battery */
+#define BIOC_STATENC 0x08 /* something wrong with enclosure */
+#define BIOC_STATTEMP 0x10 /* something is over/under heating */
+ /* return fields used per request define in opcode */
+ u_int8_t channels; /* max channels */
+ u_int8_t buswidth; /* max physical drives per channel */
+ /* filled in when called with BIOCGSTAT_PHYSDISK set */
+ u_int8_t pdcount; /* physical disk counter */
+ u_int8_t physdisk[BIOC_MAX_PHYSDISK];
+#define BIOC_PDUNUSED 0x00 /* disk not present */
+#define BIOC_PDONLINE 0x01 /* disk present */
+#define BIOC_PDOFFLINE 0x02 /* disk present but offline */
+#define BIOC_PDINUSE 0x04 /* critical operation in progress */
+ /* filled in when called with BIOCGSTAT_VIRTDISK set */
+ u_int8_t vdcount; /* virtual disk counter */
+ u_int8_t virtdisk[BIOC_MAX_VIRTDISK];
+#define BIOC_VDUNUSED 0x00 /* disk not present */
+#define BIOC_VDONLINE 0x01 /* disk present */
+#define BIOC_VDOFFLINE 0x02 /* disk present but offline */
+#define BIOC_VDINUSE 0x04 /* critical operation in progress */
+ /* filled in when called with BIOCGSTAT_BATTERY set */
+ u_int8_t batstat; /* battery status */
+#define BIOC_BATNOTPRES 0x00 /* battery not present */
+#define BIOC_BATMISSING 0x01 /* battery removed */
+#define BIOC_BATVOLTERR 0x02 /* battery low/high power */
+#define BIOC_BATTEMP 0x04 /* battery over/under temp*/
+ /* NOTYET: encloure status & temperature status */
+} bioc_status;