/*-
* Copyright (c) 2002, Pierre David <Pierre.David@crc.u-strasbg.fr>
* Copyright (c) 2006, 2007, Jung-uk Kim <jkim@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice unmodified, this list of conditions, and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _AMRSTAT_H_
#ifndef __packed
#define __packed __attribute__((__packed__))
#endif
#define NATTEMPTS 5
#define SLEEPTIME 100000 /* microseconds */
int nattempts = NATTEMPTS; /* # of attempts before giving up */
int sleeptime = SLEEPTIME; /* between attempts, in ms */
#define AMR_BUFSIZE 1024
struct {
uint8_t cmd;
uint8_t cmdsub;
uint8_t cmdqual;
int result;
char *buffer;
} amr_enq;
#define AMR_MAX_NCTRLS 16
#define AMR_MAX_NSDEVS 16
u_int8_t nschan = 0;
/*
* Include lookup tables, and a function to match a code to a string.
*
* XXX Lookup tables cannot be included, since they require symbols from
* amrreg.h which need in turn the _KERNEL define.
*/
/* #define AMR_DEFINE_TABLES */
/* #include "amr_tables.h" */
/*
* Offsets in an amr_user_ioctl.au_cmd [] array See amrio.h
*/
#define MB_COMMAND 0
#define MB_CHANNEL 1
#define MB_PARAM 2
#define MB_PAD 3
#define MB_DRIVE 4
#define FIRMWARE_40LD 1
#define FIRMWARE_8LD 2
static struct {
const char *product;
const int signature;
} prodtable[] = {
{
"Series 431",
AMR_SIG_431
},
{
"Series 438",
AMR_SIG_438
},
{ "Series 762",
AMR_SIG_762
},
{
"Integrated HP NetRAID (T5)",
AMR_SIG_T5
},
{
"Series 466",
AMR_SIG_466
},
{
"Series 467",
AMR_SIG_467
},
{
"Integrated HP NetRAID (T7)",
AMR_SIG_T7
},
{
"Series 490",
AMR_SIG_490
},
};
static struct {
const int code;
const char *on;
const char *off;
} proptable[] = {
{
AMR_DRV_WRITEBACK,
"writeback",
"write-through"
},
{
AMR_DRV_READHEAD,
"read-ahead",
"no-read-ahead"
},
{
AMR_DRV_ADAPTIVE,
"adaptative-io",
"no-adaptative-io"
},
};
static struct {
const int code;
const char *status;
} statetable[] = {
{
AMR_DRV_OFFLINE,
"offline"
},
{
AMR_DRV_DEGRADED,
"degraded"
},
{
AMR_DRV_OPTIMAL,
"optimal"
},
{
AMR_DRV_ONLINE,
"online"
},
{
AMR_DRV_FAILED,
"failed"
},
{
AMR_DRV_REBUILD,
"rebuild"
},
{
AMR_DRV_HOTSPARE,
"hotspare"
},
};
static struct {
const u_int8_t code;
const char *status;
} battable[] = {
{
AMR_BATT_MODULE_MISSING,
"not present"
},
{
AMR_BATT_LOW_VOLTAGE,
"low voltage"
},
{
AMR_BATT_TEMP_HIGH,
"high temperature"
},
{
AMR_BATT_PACK_MISSING,
"pack missing"
},
{
AMR_BATT_CYCLES_EXCEEDED,
"cycle exceeded"
},
};
static struct {
const u_int8_t code;
const char *status;
} bcstatble[] = {
{
AMR_BATT_CHARGE_DONE,
"charge done"
},
{
AMR_BATT_CHARGE_INPROG,
"charge in progress"
},
{
AMR_BATT_CHARGE_FAIL,
"charge failed"
},
};
#define NTAB(tab) (sizeof(tab) / sizeof((tab)[0]))
#endif
syntax highlighted by Code2HTML, v. 0.9.1