Bring the aac driver *much* closer to style(9).
Reviewed by: ken
This commit is contained in:
parent
8e25dc9b10
commit
914da7d0d3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83114
3197
sys/dev/aac/aac.c
3197
sys/dev/aac/aac.c
File diff suppressed because it is too large
Load Diff
@ -35,30 +35,30 @@
|
||||
*/
|
||||
|
||||
#if __FreeBSD_version < 500003 /* old buf style */
|
||||
# include <sys/buf.h>
|
||||
# define FREEBSD_4
|
||||
# define bio buf
|
||||
# define bioq_init(x) bufq_init(x)
|
||||
# define bioq_insert_tail(x, y) bufq_insert_tail(x, y)
|
||||
# define bioq_remove(x, y) bufq_remove(x, y)
|
||||
# define bioq_first(x) bufq_first(x)
|
||||
# define bio_queue_head buf_queue_head
|
||||
# define bio_bcount b_bcount
|
||||
# define bio_blkno b_blkno
|
||||
# define bio_caller1 b_caller1
|
||||
# define bio_data b_data
|
||||
# define bio_dev b_dev
|
||||
# define bio_driver1 b_driver1
|
||||
# define bio_driver2 b_driver2
|
||||
# define bio_error b_error
|
||||
# define bio_flags b_flags
|
||||
# define bio_pblkno b_pblkno
|
||||
# define bio_resid b_resid
|
||||
# define BIO_ERROR B_ERROR
|
||||
# define devstat_end_transaction_bio(x, y) devstat_end_transaction_buf(x, y)
|
||||
# define BIO_IS_READ(x) ((x)->b_flags & B_READ)
|
||||
#include <sys/buf.h>
|
||||
#define FREEBSD_4
|
||||
#define bio buf
|
||||
#define bioq_init(x) bufq_init(x)
|
||||
#define bioq_insert_tail(x, y) bufq_insert_tail(x, y)
|
||||
#define bioq_remove(x, y) bufq_remove(x, y)
|
||||
#define bioq_first(x) bufq_first(x)
|
||||
#define bio_queue_head buf_queue_head
|
||||
#define bio_bcount b_bcount
|
||||
#define bio_blkno b_blkno
|
||||
#define bio_caller1 b_caller1
|
||||
#define bio_data b_data
|
||||
#define bio_dev b_dev
|
||||
#define bio_driver1 b_driver1
|
||||
#define bio_driver2 b_driver2
|
||||
#define bio_error b_error
|
||||
#define bio_flags b_flags
|
||||
#define bio_pblkno b_pblkno
|
||||
#define bio_resid b_resid
|
||||
#define BIO_ERROR B_ERROR
|
||||
#define devstat_end_transaction_bio(x, y) devstat_end_transaction_buf(x, y)
|
||||
#define BIO_IS_READ(x) ((x)->b_flags & B_READ)
|
||||
|
||||
#else /* new bio style */
|
||||
# include <sys/bio.h>
|
||||
# define BIO_IS_READ(x) ((x)->bio_cmd == BIO_READ)
|
||||
#include <sys/bio.h>
|
||||
#define BIO_IS_READ(x) ((x)->bio_cmd == BIO_READ)
|
||||
#endif
|
||||
|
@ -51,443 +51,497 @@
|
||||
#include <dev/aac/aacvar.h>
|
||||
|
||||
#ifdef AAC_DEBUG
|
||||
void aac_printstate0(void);
|
||||
void aac_intr0(void);
|
||||
void aac_printstate0(void);
|
||||
void aac_intr0(void);
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Dump the command queue indices
|
||||
*/
|
||||
void
|
||||
aac_print_queues(struct aac_softc *sc)
|
||||
{
|
||||
device_printf(sc->aac_dev, "FIB queue header at %p queues at %p\n",
|
||||
&sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0],
|
||||
&sc->aac_queues->qt_HostNormCmdQueue[0]);
|
||||
device_printf(sc->aac_dev, "HOST_NORM_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_NORM_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "HOST_HIGH_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_HIGH_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_NORM_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_NORM_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_HIGH_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_HIGH_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "HOST_NORM_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_NORM_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "HOST_HIGH_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_HIGH_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_NORM_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_NORM_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_HIGH_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_HIGH_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "AACQ_FREE %d/%d\n",
|
||||
sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_BIO %d/%d\n",
|
||||
sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_READY %d/%d\n",
|
||||
sc->aac_qstat[AACQ_READY].q_length, sc->aac_qstat[AACQ_READY].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_BUSY %d/%d\n",
|
||||
sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_COMPLETE %d/%d\n",
|
||||
sc->aac_qstat[AACQ_COMPLETE].q_length,
|
||||
sc->aac_qstat[AACQ_COMPLETE].q_max);
|
||||
device_printf(sc->aac_dev, "FIB queue header at %p queues at %p\n",
|
||||
&sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0],
|
||||
&sc->aac_queues->qt_HostNormCmdQueue[0]);
|
||||
device_printf(sc->aac_dev, "HOST_NORM_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_NORM_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "HOST_HIGH_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_HIGH_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_NORM_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_NORM_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_HIGH_CMD %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_HIGH_CMD_ENTRIES);
|
||||
device_printf(sc->aac_dev, "HOST_NORM_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_NORM_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "HOST_HIGH_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_HOST_HIGH_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_NORM_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_NORM_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "ADAP_HIGH_RESP %d/%d (%d)\n",
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][
|
||||
AAC_PRODUCER_INDEX],
|
||||
sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][
|
||||
AAC_CONSUMER_INDEX],
|
||||
AAC_ADAP_HIGH_RESP_ENTRIES);
|
||||
device_printf(sc->aac_dev, "AACQ_FREE %d/%d\n",
|
||||
sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_BIO %d/%d\n",
|
||||
sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_READY %d/%d\n",
|
||||
sc->aac_qstat[AACQ_READY].q_length,
|
||||
sc->aac_qstat[AACQ_READY].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_BUSY %d/%d\n",
|
||||
sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max);
|
||||
device_printf(sc->aac_dev, "AACQ_COMPLETE %d/%d\n",
|
||||
sc->aac_qstat[AACQ_COMPLETE].q_length,
|
||||
sc->aac_qstat[AACQ_COMPLETE].q_max);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Print the command queue states for controller 0 (callable from DDB)
|
||||
*/
|
||||
void
|
||||
aac_printstate0(void)
|
||||
{
|
||||
struct aac_softc *sc = devclass_get_softc(aac_devclass, 0);
|
||||
struct aac_softc *sc;
|
||||
|
||||
aac_print_queues(sc);
|
||||
switch (sc->aac_hwif) {
|
||||
case AAC_HWIF_I960RX:
|
||||
device_printf(sc->aac_dev, "IDBR 0x%08x IIMR 0x%08x IISR 0x%08x\n",
|
||||
AAC_GETREG4(sc, AAC_RX_IDBR), AAC_GETREG4(sc, AAC_RX_IIMR),
|
||||
AAC_GETREG4(sc, AAC_RX_IISR));
|
||||
device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x OISR 0x%08x\n",
|
||||
AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR),
|
||||
AAC_GETREG4(sc, AAC_RX_OISR));
|
||||
AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
|
||||
AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
|
||||
device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x OISR 0x%08x\n",
|
||||
AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR),
|
||||
AAC_GETREG4(sc, AAC_RX_OISR));
|
||||
break;
|
||||
case AAC_HWIF_STRONGARM:
|
||||
/* XXX implement */
|
||||
}
|
||||
sc = devclass_get_softc(aac_devclass, 0);
|
||||
|
||||
aac_print_queues(sc);
|
||||
switch (sc->aac_hwif) {
|
||||
case AAC_HWIF_I960RX:
|
||||
device_printf(sc->aac_dev, "IDBR 0x%08x IIMR 0x%08x "
|
||||
"IISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_IDBR),
|
||||
AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR));
|
||||
device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x "
|
||||
"OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
|
||||
AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
|
||||
AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
|
||||
AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
|
||||
device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x "
|
||||
"OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
|
||||
AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
|
||||
break;
|
||||
case AAC_HWIF_STRONGARM:
|
||||
/* XXX implement */
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* simulate an interrupt for controller 0
|
||||
*/
|
||||
void
|
||||
aac_intr0(void)
|
||||
{
|
||||
struct aac_softc *sc = devclass_get_softc(aac_devclass, 0);
|
||||
struct aac_softc *sc;
|
||||
|
||||
aac_intr(sc);
|
||||
sc = devclass_get_softc(aac_devclass, 0);
|
||||
|
||||
aac_intr(sc);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Panic in a slightly informative fashion
|
||||
*/
|
||||
void
|
||||
aac_panic(struct aac_softc *sc, char *reason)
|
||||
{
|
||||
aac_print_queues(sc);
|
||||
panic(reason);
|
||||
aac_print_queues(sc);
|
||||
panic(reason);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Print a FIB
|
||||
*/
|
||||
void
|
||||
aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller)
|
||||
{
|
||||
device_printf(sc->aac_dev, "%s: FIB @ %p\n", caller, fib);
|
||||
device_printf(sc->aac_dev, " XferState %b\n", fib->Header.XferState, "\20"
|
||||
"\1HOSTOWNED"
|
||||
"\2ADAPTEROWNED"
|
||||
"\3INITIALISED"
|
||||
"\4EMPTY"
|
||||
"\5FROMPOOL"
|
||||
"\6FROMHOST"
|
||||
"\7FROMADAP"
|
||||
"\10REXPECTED"
|
||||
"\11RNOTEXPECTED"
|
||||
"\12DONEADAP"
|
||||
"\13DONEHOST"
|
||||
"\14HIGH"
|
||||
"\15NORM"
|
||||
"\16ASYNC"
|
||||
"\17PAGEFILEIO"
|
||||
"\20SHUTDOWN"
|
||||
"\21LAZYWRITE"
|
||||
"\22ADAPMICROFIB"
|
||||
"\23BIOSFIB"
|
||||
"\24FAST_RESPONSE"
|
||||
"\25APIFIB\n");
|
||||
device_printf(sc->aac_dev, " Command %d\n", fib->Header.Command);
|
||||
device_printf(sc->aac_dev, " StructType %d\n",
|
||||
fib->Header.StructType);
|
||||
device_printf(sc->aac_dev, " Flags 0x%x\n", fib->Header.Flags);
|
||||
device_printf(sc->aac_dev, " Size %d\n", fib->Header.Size);
|
||||
device_printf(sc->aac_dev, " SenderSize %d\n",
|
||||
fib->Header.SenderSize);
|
||||
device_printf(sc->aac_dev, " SenderAddress 0x%x\n",
|
||||
fib->Header.SenderFibAddress);
|
||||
device_printf(sc->aac_dev, " ReceiverAddress 0x%x\n",
|
||||
fib->Header.ReceiverFibAddress);
|
||||
device_printf(sc->aac_dev, " SenderData 0x%x\n",
|
||||
fib->Header.SenderData);
|
||||
switch(fib->Header.Command) {
|
||||
case ContainerCommand:
|
||||
{
|
||||
struct aac_blockread *br = (struct aac_blockread *)fib->data;
|
||||
struct aac_blockwrite *bw = (struct aac_blockwrite *)fib->data;
|
||||
struct aac_sg_table *sg = NULL;
|
||||
int i;
|
||||
if (br->Command == VM_CtBlockRead) {
|
||||
device_printf(sc->aac_dev, " BlockRead: container %d 0x%x/%d\n",
|
||||
br->ContainerId, br->BlockNumber, br->ByteCount);
|
||||
sg = &br->SgMap;
|
||||
device_printf(sc->aac_dev, "%s: FIB @ %p\n", caller, fib);
|
||||
device_printf(sc->aac_dev, " XferState %b\n", fib->Header.XferState,
|
||||
"\20"
|
||||
"\1HOSTOWNED"
|
||||
"\2ADAPTEROWNED"
|
||||
"\3INITIALISED"
|
||||
"\4EMPTY"
|
||||
"\5FROMPOOL"
|
||||
"\6FROMHOST"
|
||||
"\7FROMADAP"
|
||||
"\10REXPECTED"
|
||||
"\11RNOTEXPECTED"
|
||||
"\12DONEADAP"
|
||||
"\13DONEHOST"
|
||||
"\14HIGH"
|
||||
"\15NORM"
|
||||
"\16ASYNC"
|
||||
"\17PAGEFILEIO"
|
||||
"\20SHUTDOWN"
|
||||
"\21LAZYWRITE"
|
||||
"\22ADAPMICROFIB"
|
||||
"\23BIOSFIB"
|
||||
"\24FAST_RESPONSE"
|
||||
"\25APIFIB\n");
|
||||
device_printf(sc->aac_dev, " Command %d\n", fib->Header.Command);
|
||||
device_printf(sc->aac_dev, " StructType %d\n",
|
||||
fib->Header.StructType);
|
||||
device_printf(sc->aac_dev, " Flags 0x%x\n", fib->Header.Flags);
|
||||
device_printf(sc->aac_dev, " Size %d\n", fib->Header.Size);
|
||||
device_printf(sc->aac_dev, " SenderSize %d\n",xi
|
||||
fib->Header.SenderSize);
|
||||
device_printf(sc->aac_dev, " SenderAddress 0x%x\n",
|
||||
fib->Header.SenderFibAddress);
|
||||
device_printf(sc->aac_dev, " RcvrAddress 0x%x\n",
|
||||
fib->Header.ReceiverFibAddress);
|
||||
device_printf(sc->aac_dev, " SenderData 0x%x\n",
|
||||
fib->Header.SenderData);
|
||||
switch(fib->Header.Command) {
|
||||
case ContainerCommand:
|
||||
{
|
||||
struct aac_blockread *br;
|
||||
struct aac_blockwrite *br;
|
||||
struct aac_sg_table *sg;
|
||||
int i;
|
||||
|
||||
br = (struct aac_blockread*)fib->data;
|
||||
bw = (struct aac_blockwrite*)fib->data;
|
||||
sg = NULL;
|
||||
|
||||
if (br->Command == VM_CtBlockRead) {
|
||||
device_printf(sc->aac_dev,
|
||||
" BlockRead: container %d 0x%x/%d\n",
|
||||
br->ContainerId, br->BlockNumber,
|
||||
br->ByteCount);
|
||||
sg = &br->SgMap;
|
||||
}
|
||||
if (bw->Command == VM_CtBlockWrite) {
|
||||
device_printf(sc->aac_dev,
|
||||
" BlockWrite: container %d 0x%x/%d "
|
||||
"(%s)\n", bw->ContainerId,
|
||||
bw->BlockNumber, bw->ByteCount,
|
||||
bw->Stable == CSTABLE ? "stable" :
|
||||
"unstable");
|
||||
sg = &bw->SgMap;
|
||||
}
|
||||
if (sg != NULL) {
|
||||
device_printf(sc->aac_dev,
|
||||
" %d s/g entries\n", sg->SgCount);
|
||||
for (i = 0; i < sg->SgCount; i++)
|
||||
device_printf(sc->aac_dev, " 0x%08x/%d\n",
|
||||
sg->SgEntry[i].SgAddress,
|
||||
sg->SgEntry[i].SgByteCount);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (bw->Command == VM_CtBlockWrite) {
|
||||
device_printf(sc->aac_dev, " BlockWrite: container %d 0x%x/%d "
|
||||
"(%s)\n", bw->ContainerId, bw->BlockNumber,
|
||||
bw->ByteCount, bw->Stable == CSTABLE ? "stable" :
|
||||
"unstable");
|
||||
sg = &bw->SgMap;
|
||||
default:
|
||||
device_printf(sc->aac_dev, " %16D\n", fib->data, " ");
|
||||
device_printf(sc->aac_dev, " %16D\n", fib->data + 16, " ");
|
||||
break;
|
||||
}
|
||||
if (sg != NULL) {
|
||||
device_printf(sc->aac_dev, " %d s/g entries\n", sg->SgCount);
|
||||
for (i = 0; i < sg->SgCount; i++)
|
||||
device_printf(sc->aac_dev, " 0x%08x/%d\n",
|
||||
sg->SgEntry[i].SgAddress,
|
||||
sg->SgEntry[i].SgByteCount);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
device_printf(sc->aac_dev, " %16D\n", fib->data, " ");
|
||||
device_printf(sc->aac_dev, " %16D\n", fib->data + 16, " ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Describe an AIF we have received.
|
||||
*/
|
||||
void
|
||||
aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif)
|
||||
{
|
||||
switch(aif->command) {
|
||||
case AifCmdEventNotify:
|
||||
device_printf(sc->aac_dev, "EventNotify (%d)\n", aif->seqNumber);
|
||||
switch(aif->data.EN.type) {
|
||||
case AifEnGeneric: /* Generic notification */
|
||||
device_printf(sc->aac_dev, "(Generic) %.*s\n",
|
||||
(int)sizeof(aif->data.EN.data.EG),
|
||||
aif->data.EN.data.EG.text);
|
||||
break;
|
||||
case AifEnTaskComplete: /* Task has completed */
|
||||
device_printf(sc->aac_dev, "(TaskComplete)\n");
|
||||
break;
|
||||
case AifEnConfigChange: /* Adapter configuration change
|
||||
switch(aif->command) {
|
||||
case AifCmdEventNotify:
|
||||
device_printf(sc->aac_dev, "EventNotify(%d)\n", aif->seqNumber);
|
||||
switch(aif->data.EN.type) {
|
||||
case AifEnGeneric: /* Generic notification */
|
||||
device_printf(sc->aac_dev, "(Generic) %.*s\n",
|
||||
(int)sizeof(aif->data.EN.data.EG),
|
||||
aif->data.EN.data.EG.text);
|
||||
break;
|
||||
case AifEnTaskComplete: /* Task has completed */
|
||||
device_printf(sc->aac_dev, "(TaskComplete)\n");
|
||||
break;
|
||||
case AifEnConfigChange: /* Adapter configuration change
|
||||
* occurred */
|
||||
device_printf(sc->aac_dev, "(ConfigChange)\n");
|
||||
break;
|
||||
case AifEnContainerChange: /* Adapter specific container
|
||||
device_printf(sc->aac_dev, "(ConfigChange)\n");
|
||||
break;
|
||||
case AifEnContainerChange: /* Adapter specific container
|
||||
* configuration change */
|
||||
device_printf(sc->aac_dev, "(ContainerChange) container %d,%d\n",
|
||||
aif->data.EN.data.ECC.container[0],
|
||||
aif->data.EN.data.ECC.container[1]);
|
||||
break;
|
||||
case AifEnDeviceFailure: /* SCSI device failed */
|
||||
device_printf(sc->aac_dev, "(DeviceFailure) handle %d\n",
|
||||
aif->data.EN.data.EDF.deviceHandle); /* XXX
|
||||
* interpret */
|
||||
break;
|
||||
case AifEnMirrorFailover: /* Mirror failover started */
|
||||
device_printf(sc->aac_dev, "(MirrorFailover) container %d failed, "
|
||||
"migrating from slice %d to %d\n",
|
||||
aif->data.EN.data.EMF.container,
|
||||
aif->data.EN.data.EMF.failedSlice,
|
||||
aif->data.EN.data.EMF.creatingSlice);
|
||||
break;
|
||||
case AifEnContainerEvent: /* Significant container
|
||||
device_printf(sc->aac_dev, "(ContainerChange) "
|
||||
"container %d,%d\n",
|
||||
aif->data.EN.data.ECC.container[0],
|
||||
aif->data.EN.data.ECC.container[1]);
|
||||
break;
|
||||
case AifEnDeviceFailure: /* SCSI device failed */
|
||||
device_printf(sc->aac_dev, "(DeviceFailure) "
|
||||
"handle %d\n",
|
||||
aif->data.EN.data.EDF.deviceHandle);
|
||||
break;
|
||||
case AifEnMirrorFailover: /* Mirror failover started */
|
||||
device_printf(sc->aac_dev, "(MirrorFailover) "
|
||||
"container %d failed, "
|
||||
"migrating from slice %d to %d\n",
|
||||
aif->data.EN.data.EMF.container,
|
||||
aif->data.EN.data.EMF.failedSlice,
|
||||
aif->data.EN.data.EMF.creatingSlice);
|
||||
break;
|
||||
case AifEnContainerEvent: /* Significant container
|
||||
* event */
|
||||
device_printf(sc->aac_dev, "(ContainerEvent) container %d event "
|
||||
"%d\n", aif->data.EN.data.ECE.container,
|
||||
aif->data.EN.data.ECE.eventType); /* XXX
|
||||
* interpret? */
|
||||
break;
|
||||
case AifEnFileSystemChange: /* File system changed */
|
||||
device_printf(sc->aac_dev, "(FileSystemChange)\n");
|
||||
break;
|
||||
case AifEnConfigPause: /* Container pause event */
|
||||
device_printf(sc->aac_dev, "(ConfigPause)\n");
|
||||
break;
|
||||
case AifEnConfigResume: /* Container resume event */
|
||||
device_printf(sc->aac_dev, "(ConfigResume)\n");
|
||||
break;
|
||||
case AifEnFailoverChange: /* Failover space assignment
|
||||
device_printf(sc->aac_dev, "(ContainerEvent) "
|
||||
"container %d event "
|
||||
"%d\n", aif->data.EN.data.ECE.container,
|
||||
aif->data.EN.data.ECE.eventType);
|
||||
break;
|
||||
case AifEnFileSystemChange: /* File system changed */
|
||||
device_printf(sc->aac_dev, "(FileSystemChange)\n");
|
||||
break;
|
||||
case AifEnConfigPause: /* Container pause event */
|
||||
device_printf(sc->aac_dev, "(ConfigPause)\n");
|
||||
break;
|
||||
case AifEnConfigResume: /* Container resume event */
|
||||
device_printf(sc->aac_dev, "(ConfigResume)\n");
|
||||
break;
|
||||
case AifEnFailoverChange: /* Failover space assignment
|
||||
* changed */
|
||||
device_printf(sc->aac_dev, "(FailoverChange)\n");
|
||||
break;
|
||||
case AifEnRAID5RebuildDone: /* RAID5 rebuild finished */
|
||||
device_printf(sc->aac_dev, "(RAID5RebuildDone)\n");
|
||||
break;
|
||||
case AifEnEnclosureManagement: /* Enclosure management event */
|
||||
device_printf(sc->aac_dev, "(EnclosureManagement) EMPID %d unit %d "
|
||||
"event %d\n", aif->data.EN.data.EEE.empID,
|
||||
aif->data.EN.data.EEE.unitID,
|
||||
aif->data.EN.data.EEE.eventType);
|
||||
break;
|
||||
case AifEnBatteryEvent: /* Significant NV battery
|
||||
device_printf(sc->aac_dev, "(FailoverChange)\n");
|
||||
break;
|
||||
case AifEnRAID5RebuildDone: /* RAID5 rebuild finished */
|
||||
device_printf(sc->aac_dev, "(RAID5RebuildDone)\n");
|
||||
break;
|
||||
case AifEnEnclosureManagement: /* Enclosure management event */
|
||||
device_printf(sc->aac_dev, "(EnclosureManagement) "
|
||||
"EMPID %d unit %d "
|
||||
"event %d\n", aif->data.EN.data.EEE.empID,
|
||||
aif->data.EN.data.EEE.unitID,
|
||||
aif->data.EN.data.EEE.eventType);
|
||||
break;
|
||||
case AifEnBatteryEvent: /* Significant NV battery
|
||||
* event */
|
||||
device_printf(sc->aac_dev, "(BatteryEvent) %d (state was %d, "
|
||||
"is %d\n", aif->data.EN.data.EBE.transition_type,
|
||||
aif->data.EN.data.EBE.current_state, /* XXX */
|
||||
aif->data.EN.data.EBE.prior_state); /* interpret? */
|
||||
break;
|
||||
case AifEnAddContainer: /* A new container was
|
||||
device_printf(sc->aac_dev, "(BatteryEvent) %d "
|
||||
"(state was %d, is %d\n",
|
||||
aif->data.EN.data.EBE.transition_type,
|
||||
aif->data.EN.data.EBE.current_state,
|
||||
aif->data.EN.data.EBE.prior_state);
|
||||
break;
|
||||
case AifEnAddContainer: /* A new container was
|
||||
* created. */
|
||||
device_printf(sc->aac_dev, "(AddContainer)\n");
|
||||
break;
|
||||
case AifEnDeleteContainer: /* A container was deleted. */
|
||||
device_printf(sc->aac_dev, "(DeleteContainer)\n");
|
||||
break;
|
||||
case AifEnBatteryNeedsRecond: /* The battery needs
|
||||
device_printf(sc->aac_dev, "(AddContainer)\n");
|
||||
break;
|
||||
case AifEnDeleteContainer: /* A container was deleted. */
|
||||
device_printf(sc->aac_dev, "(DeleteContainer)\n");
|
||||
break;
|
||||
case AifEnBatteryNeedsRecond: /* The battery needs
|
||||
* reconditioning */
|
||||
device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n");
|
||||
break;
|
||||
case AifEnClusterEvent: /* Some cluster event */
|
||||
device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
|
||||
aif->data.EN.data.ECLE.eventType);
|
||||
break;
|
||||
case AifEnDiskSetEvent: /* A disk set event occured. */
|
||||
device_printf(sc->aac_dev, "(DiskSetEvent) event %d diskset %lld "
|
||||
"creator %lld\n", aif->data.EN.data.EDS.eventType,
|
||||
aif->data.EN.data.EDS.DsNum,
|
||||
aif->data.EN.data.EDS.CreatorId);
|
||||
break;
|
||||
case AifDenMorphComplete: /* A morph operation
|
||||
device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n");
|
||||
break;
|
||||
case AifEnClusterEvent: /* Some cluster event */
|
||||
device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
|
||||
aif->data.EN.data.ECLE.eventType);
|
||||
break;
|
||||
case AifEnDiskSetEvent: /* A disk set event occured. */
|
||||
device_printf(sc->aac_dev, "(DiskSetEvent) event %d "
|
||||
"diskset %lld creator %lld\n",
|
||||
aif->data.EN.data.EDS.eventType,
|
||||
aif->data.EN.data.EDS.DsNum,
|
||||
aif->data.EN.data.EDS.CreatorId);
|
||||
break;
|
||||
case AifDenMorphComplete: /* A morph operation
|
||||
* completed */
|
||||
device_printf(sc->aac_dev, "(MorphComplete)\n");
|
||||
break;
|
||||
case AifDenVolumeExtendComplete: /* A volume expand operation
|
||||
* completed */
|
||||
device_printf(sc->aac_dev, "(VolumeExtendComplete)\n");
|
||||
break;
|
||||
default:
|
||||
device_printf(sc->aac_dev, "(%d)\n", aif->data.EN.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AifCmdJobProgress:
|
||||
{
|
||||
char *status;
|
||||
switch(aif->data.PR[0].status) {
|
||||
case AifJobStsSuccess:
|
||||
status = "success"; break;
|
||||
case AifJobStsFinished:
|
||||
status = "finished"; break;
|
||||
case AifJobStsAborted:
|
||||
status = "aborted"; break;
|
||||
case AifJobStsFailed:
|
||||
status = "failed"; break;
|
||||
case AifJobStsSuspended:
|
||||
status = "suspended"; break;
|
||||
case AifJobStsRunning:
|
||||
status = "running"; break;
|
||||
default:
|
||||
status = "unknown status"; break;
|
||||
}
|
||||
device_printf(sc->aac_dev, "(MorphComplete)\n");
|
||||
break;
|
||||
case AifDenVolumeExtendComplete: /* A volume expand operation
|
||||
* completed */
|
||||
device_printf(sc->aac_dev, "(VolumeExtendComplete)\n");
|
||||
break;
|
||||
default:
|
||||
device_printf(sc->aac_dev, "(%d)\n", aif->data.EN.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AifCmdJobProgress:
|
||||
{
|
||||
char *status;
|
||||
switch(aif->data.PR[0].status) {
|
||||
case AifJobStsSuccess:
|
||||
status = "success"; break;
|
||||
case AifJobStsFinished:
|
||||
status = "finished"; break;
|
||||
case AifJobStsAborted:
|
||||
status = "aborted"; break;
|
||||
case AifJobStsFailed:
|
||||
status = "failed"; break;
|
||||
case AifJobStsSuspended:
|
||||
status = "suspended"; break;
|
||||
case AifJobStsRunning:
|
||||
status = "running"; break;
|
||||
default:
|
||||
status = "unknown status"; break;
|
||||
}
|
||||
|
||||
device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n",
|
||||
aif->seqNumber, status, aif->data.PR[0].currentTick,
|
||||
aif->data.PR[0].finalTick);
|
||||
switch(aif->data.PR[0].jd.type) {
|
||||
case AifJobScsiZero: /* SCSI dev clear operation */
|
||||
device_printf(sc->aac_dev, "(ScsiZero) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobScsiVerify: /* SCSI device Verify operation
|
||||
device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n",
|
||||
aif->seqNumber, status,
|
||||
aif->data.PR[0].currentTick,
|
||||
aif->data.PR[0].finalTick);
|
||||
switch(aif->data.PR[0].jd.type) {
|
||||
case AifJobScsiZero: /* SCSI dev clear operation */
|
||||
device_printf(sc->aac_dev, "(ScsiZero) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobScsiVerify: /* SCSI device Verify operation
|
||||
* NO REPAIR */
|
||||
device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobScsiExercise: /* SCSI device Exercise
|
||||
device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobScsiExercise: /* SCSI device Exercise
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobScsiVerifyRepair: /* SCSI device Verify operation
|
||||
device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobScsiVerifyRepair: /* SCSI device Verify operation
|
||||
* WITH repair */
|
||||
device_printf(sc->aac_dev, "(ScsiVerifyRepair) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobCtrZero: /* Container clear operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerZero) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrCopy: /* Container copy operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerCopy) container %d to %d\n",
|
||||
aif->data.PR[0].jd.client.container.src,
|
||||
aif->data.PR[0].jd.client.container.dst);
|
||||
break;
|
||||
case AifJobCtrCreateMirror: /* Container Create Mirror
|
||||
device_printf(sc->aac_dev,
|
||||
"(ScsiVerifyRepair) handle %d\n",
|
||||
aif->data.PR[0].jd.client.scsi_dh);
|
||||
break;
|
||||
case AifJobCtrZero: /* Container clear operation */
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerZero) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrCopy: /* Container copy operation */
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerCopy) container %d to %d\n",
|
||||
aif->data.PR[0].jd.client.container.src,
|
||||
aif->data.PR[0].jd.client.container.dst);
|
||||
break;
|
||||
case AifJobCtrCreateMirror: /* Container Create Mirror
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerCreateMirror) container "
|
||||
"%d\n", aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobCtrMergeMirror: /* Container Merge Mirror
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerCreateMirror) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobCtrMergeMirror: /* Container Merge Mirror
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerMergeMirror) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobCtrScrubMirror: /* Container Scrub Mirror
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerMergeMirror) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobCtrScrubMirror: /* Container Scrub Mirror
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerScrubMirror) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrRebuildRaid5: /* Container Rebuild Raid5
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerScrubMirror) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrRebuildRaid5: /* Container Rebuild Raid5
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerRebuildRaid5) container "
|
||||
"%d\n", aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrScrubRaid5: /* Container Scrub Raid5
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerRebuildRaid5) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrScrubRaid5: /* Container Scrub Raid5
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerScrubRaid5) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrMorph: /* Container morph operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerMorph) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobCtrPartCopy: /* Container Partition copy
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerScrubRaid5) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrMorph: /* Container morph operation */
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerMorph) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobCtrPartCopy: /* Container Partition copy
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerPartCopy) container %d to "
|
||||
"%d\n", aif->data.PR[0].jd.client.container.src,
|
||||
aif->data.PR[0].jd.client.container.dst);
|
||||
break;
|
||||
case AifJobCtrRebuildMirror: /* Container Rebuild Mirror
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerPartCopy) container %d to "
|
||||
"%d\n",
|
||||
aif->data.PR[0].jd.client.container.src,
|
||||
aif->data.PR[0].jd.client.container.dst);
|
||||
break;
|
||||
case AifJobCtrRebuildMirror: /* Container Rebuild Mirror
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(ConatainerRebuildMirror) container "
|
||||
"%d\n", aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrCrazyCache: /* crazy cache */
|
||||
device_printf(sc->aac_dev, "(ConatainerCrazyCache) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobFsCreate: /* File System Create
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerRebuildMirror) container "
|
||||
"%d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
break;
|
||||
case AifJobCtrCrazyCache: /* crazy cache */
|
||||
device_printf(sc->aac_dev,
|
||||
"(ConatainerCrazyCache) container %d\n",
|
||||
aif->data.PR[0].jd.client.container.src);
|
||||
/* XXX two containers? */
|
||||
break;
|
||||
case AifJobFsCreate: /* File System Create
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(FsCreate)\n");
|
||||
break;
|
||||
case AifJobFsVerify: /* File System Verify
|
||||
device_printf(sc->aac_dev, "(FsCreate)\n");
|
||||
break;
|
||||
case AifJobFsVerify: /* File System Verify
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(FsVerivy)\n");
|
||||
break;
|
||||
case AifJobFsExtend: /* File System Extend
|
||||
device_printf(sc->aac_dev, "(FsVerivy)\n");
|
||||
break;
|
||||
case AifJobFsExtend: /* File System Extend
|
||||
* operation */
|
||||
device_printf(sc->aac_dev, "(FsExtend)\n");
|
||||
break;
|
||||
case AifJobApiFormatNTFS: /* Format a drive to NTFS */
|
||||
device_printf(sc->aac_dev, "(FormatNTFS)\n");
|
||||
break;
|
||||
case AifJobApiFormatFAT: /* Format a drive to FAT */
|
||||
device_printf(sc->aac_dev, "(FormatFAT)\n");
|
||||
break;
|
||||
case AifJobApiUpdateSnapshot: /* update the read/write half
|
||||
device_printf(sc->aac_dev, "(FsExtend)\n");
|
||||
break;
|
||||
case AifJobApiFormatNTFS: /* Format a drive to NTFS */
|
||||
device_printf(sc->aac_dev, "(FormatNTFS)\n");
|
||||
break;
|
||||
case AifJobApiFormatFAT: /* Format a drive to FAT */
|
||||
device_printf(sc->aac_dev, "(FormatFAT)\n");
|
||||
break;
|
||||
case AifJobApiUpdateSnapshot: /* update the read/write half
|
||||
* of a snapshot */
|
||||
device_printf(sc->aac_dev, "(UpdateSnapshot)\n");
|
||||
break;
|
||||
case AifJobApiFormatFAT32: /* Format a drive to FAT32 */
|
||||
device_printf(sc->aac_dev, "(FormatFAT32)\n");
|
||||
break;
|
||||
case AifJobCtlContinuousCtrVerify: /* Adapter operation */
|
||||
device_printf(sc->aac_dev, "(ContinuousCtrVerify)\n");
|
||||
break;
|
||||
default:
|
||||
device_printf(sc->aac_dev, "(%d)\n", aif->data.PR[0].jd.type);
|
||||
break;
|
||||
device_printf(sc->aac_dev, "(UpdateSnapshot)\n");
|
||||
break;
|
||||
case AifJobApiFormatFAT32: /* Format a drive to FAT32 */
|
||||
device_printf(sc->aac_dev, "(FormatFAT32)\n");
|
||||
break;
|
||||
case AifJobCtlContinuousCtrVerify: /* Adapter operation */
|
||||
device_printf(sc->aac_dev, "(ContinuousCtrVerify)\n");
|
||||
break;
|
||||
default:
|
||||
device_printf(sc->aac_dev, "(%d)\n",
|
||||
aif->data.PR[0].jd.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AifCmdAPIReport:
|
||||
device_printf(sc->aac_dev, "APIReport (%d)\n", aif->seqNumber);
|
||||
break;
|
||||
case AifCmdDriverNotify:
|
||||
device_printf(sc->aac_dev, "DriverNotify (%d)\n",
|
||||
aif->seqNumber);
|
||||
break;
|
||||
default:
|
||||
device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command,
|
||||
aif->seqNumber);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AifCmdAPIReport:
|
||||
device_printf(sc->aac_dev, "APIReport (%d)\n", aif->seqNumber);
|
||||
break;
|
||||
case AifCmdDriverNotify:
|
||||
device_printf(sc->aac_dev, "DriverNotify (%d)\n", aif->seqNumber);
|
||||
break;
|
||||
default:
|
||||
device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command,
|
||||
aif->seqNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* AAC_DEBUG */
|
||||
|
@ -71,21 +71,21 @@ static d_dump_t aac_disk_dump;
|
||||
#define AAC_DISK_CDEV_MAJOR 151
|
||||
|
||||
static struct cdevsw aac_disk_cdevsw = {
|
||||
/* open */ aac_disk_open,
|
||||
/* close */ aac_disk_close,
|
||||
/* read */ physread,
|
||||
/* write */ physwrite,
|
||||
/* ioctl */ noioctl,
|
||||
/* poll */ nopoll,
|
||||
/* mmap */ nommap,
|
||||
/* strategy */ aac_disk_strategy,
|
||||
/* name */ "aacd",
|
||||
/* maj */ AAC_DISK_CDEV_MAJOR,
|
||||
/* dump */ aac_disk_dump,
|
||||
/* psize */ nopsize,
|
||||
/* flags */ D_DISK,
|
||||
/* open */ aac_disk_open,
|
||||
/* close */ aac_disk_close,
|
||||
/* read */ physread,
|
||||
/* write */ physwrite,
|
||||
/* ioctl */ noioctl,
|
||||
/* poll */ nopoll,
|
||||
/* mmap */ nommap,
|
||||
/* strategy */ aac_disk_strategy,
|
||||
/* name */ "aacd",
|
||||
/* maj */ AAC_DISK_CDEV_MAJOR,
|
||||
/* dump */ aac_disk_dump,
|
||||
/* psize */ nopsize,
|
||||
/* flags */ D_DISK,
|
||||
#if __FreeBSD_version < 500005
|
||||
/* bmaj */ -1
|
||||
/* bmaj */ -1
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -96,16 +96,16 @@ static int disks_registered = 0;
|
||||
#endif
|
||||
|
||||
static device_method_t aac_disk_methods[] = {
|
||||
DEVMETHOD(device_probe, aac_disk_probe),
|
||||
DEVMETHOD(device_attach, aac_disk_attach),
|
||||
DEVMETHOD(device_detach, aac_disk_detach),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD(device_probe, aac_disk_probe),
|
||||
DEVMETHOD(device_attach, aac_disk_attach),
|
||||
DEVMETHOD(device_detach, aac_disk_detach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t aac_disk_driver = {
|
||||
"aacd",
|
||||
aac_disk_methods,
|
||||
sizeof(struct aac_disk)
|
||||
"aacd",
|
||||
aac_disk_methods,
|
||||
sizeof(struct aac_disk)
|
||||
};
|
||||
|
||||
DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, 0, 0);
|
||||
@ -120,7 +120,7 @@ SYSCTL_UINT(_hw_aac, OID_AUTO, iosize_max, CTLFLAG_RD, &aac_iosize_max, 0,
|
||||
|
||||
#define AAC_MAXIO 65536
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Handle open from generic layer.
|
||||
*
|
||||
* This is called by the diskslice code on first open in order to get the
|
||||
@ -129,84 +129,90 @@ SYSCTL_UINT(_hw_aac, OID_AUTO, iosize_max, CTLFLAG_RD, &aac_iosize_max, 0,
|
||||
static int
|
||||
aac_disk_open(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
{
|
||||
struct aac_disk *sc = (struct aac_disk *)dev->si_drv1;
|
||||
struct disklabel *label;
|
||||
struct aac_disk *sc;
|
||||
struct disklabel *label;
|
||||
|
||||
debug_called(4);
|
||||
debug_called(4);
|
||||
|
||||
sc = (struct aac_disk *)dev->si_drv1;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
/* check that the controller is up and running */
|
||||
if (sc->ad_controller->aac_state & AAC_STATE_SUSPEND)
|
||||
return(ENXIO);
|
||||
/* check that the controller is up and running */
|
||||
if (sc->ad_controller->aac_state & AAC_STATE_SUSPEND)
|
||||
return(ENXIO);
|
||||
|
||||
/* build synthetic label */
|
||||
label = &sc->ad_disk.d_label;
|
||||
bzero(label, sizeof(*label));
|
||||
label->d_type = DTYPE_ESDI;
|
||||
label->d_secsize = AAC_BLOCK_SIZE;
|
||||
label->d_nsectors = sc->ad_sectors;
|
||||
label->d_ntracks = sc->ad_heads;
|
||||
label->d_ncylinders = sc->ad_cylinders;
|
||||
label->d_secpercyl = sc->ad_sectors * sc->ad_heads;
|
||||
label->d_secperunit = sc->ad_size;
|
||||
/* build synthetic label */
|
||||
label = &sc->ad_disk.d_label;
|
||||
bzero(label, sizeof(*label));
|
||||
label->d_type = DTYPE_ESDI;
|
||||
label->d_secsize = AAC_BLOCK_SIZE;
|
||||
label->d_nsectors = sc->ad_sectors;
|
||||
label->d_ntracks = sc->ad_heads;
|
||||
label->d_ncylinders = sc->ad_cylinders;
|
||||
label->d_secpercyl = sc->ad_sectors * sc->ad_heads;
|
||||
label->d_secperunit = sc->ad_size;
|
||||
|
||||
sc->ad_flags |= AAC_DISK_OPEN;
|
||||
return (0);
|
||||
sc->ad_flags |= AAC_DISK_OPEN;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Handle last close of the disk device.
|
||||
*/
|
||||
static int
|
||||
aac_disk_close(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
{
|
||||
struct aac_disk *sc = (struct aac_disk *)dev->si_drv1;
|
||||
struct aac_disk *sc;
|
||||
|
||||
debug_called(4);
|
||||
debug_called(4);
|
||||
|
||||
sc = (struct aac_disk *)dev->si_drv1;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
sc->ad_flags &= ~AAC_DISK_OPEN;
|
||||
return (0);
|
||||
sc->ad_flags &= ~AAC_DISK_OPEN;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Handle an I/O request.
|
||||
*/
|
||||
static void
|
||||
aac_disk_strategy(struct bio *bp)
|
||||
{
|
||||
struct aac_disk *sc = (struct aac_disk *)bp->bio_dev->si_drv1;
|
||||
struct aac_disk *sc;
|
||||
|
||||
debug_called(4);
|
||||
debug_called(4);
|
||||
|
||||
/* bogus disk? */
|
||||
if (sc == NULL) {
|
||||
bp->bio_flags |= BIO_ERROR;
|
||||
bp->bio_error = EINVAL;
|
||||
biodone(bp);
|
||||
sc = (struct aac_disk *)bp->bio_dev->si_drv1;
|
||||
|
||||
/* bogus disk? */
|
||||
if (sc == NULL) {
|
||||
bp->bio_flags |= BIO_ERROR;
|
||||
bp->bio_error = EINVAL;
|
||||
biodone(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* do-nothing operation? */
|
||||
if (bp->bio_bcount == 0) {
|
||||
bp->bio_resid = bp->bio_bcount;
|
||||
biodone(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* perform accounting */
|
||||
devstat_start_transaction(&sc->ad_stats);
|
||||
|
||||
/* pass the bio to the controller - it can work out who we are */
|
||||
aac_submit_bio(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* do-nothing operation? */
|
||||
if (bp->bio_bcount == 0) {
|
||||
bp->bio_resid = bp->bio_bcount;
|
||||
biodone(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* perform accounting */
|
||||
devstat_start_transaction(&sc->ad_stats);
|
||||
|
||||
/* pass the bio to the controller - it can work out who we are */
|
||||
aac_submit_bio(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Dump memory out to an array
|
||||
*
|
||||
* This queues blocks of memory of size AAC_MAXIO to the controller and waits
|
||||
@ -215,186 +221,193 @@ aac_disk_strategy(struct bio *bp)
|
||||
static int
|
||||
aac_disk_dump(dev_t dev)
|
||||
{
|
||||
struct aac_disk *ad = dev->si_drv1;
|
||||
struct aac_softc *sc;
|
||||
vm_offset_t addr = 0;
|
||||
long blkcnt;
|
||||
unsigned int count, blkno, secsize;
|
||||
int dumppages = AAC_MAXIO / PAGE_SIZE;
|
||||
int i, error;
|
||||
struct aac_disk *ad;
|
||||
struct aac_softc *sc;
|
||||
vm_offset_t addr;
|
||||
long blkcnt;
|
||||
unsigned int count, blkno, secsize;
|
||||
int dumppages;
|
||||
int i, error;
|
||||
|
||||
if ((error = disk_dumpcheck(dev, &count, &blkno, &secsize)))
|
||||
return (error);
|
||||
ad = dev->si_drv1;
|
||||
addr = 0;
|
||||
dumppages = AAC_MAXIO / PAGE_SIZE;
|
||||
|
||||
if (ad == NULL)
|
||||
return (ENXIO);
|
||||
if ((error = disk_dumpcheck(dev, &count, &blkno, &secsize)))
|
||||
return (error);
|
||||
|
||||
sc= ad->ad_controller;
|
||||
if (ad == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
blkcnt = howmany(PAGE_SIZE, secsize);
|
||||
sc= ad->ad_controller;
|
||||
|
||||
while (count > 0) {
|
||||
caddr_t va = NULL;
|
||||
blkcnt = howmany(PAGE_SIZE, secsize);
|
||||
|
||||
if ((count / blkcnt) < dumppages)
|
||||
dumppages = count / blkcnt;
|
||||
while (count > 0) {
|
||||
caddr_t va = NULL;
|
||||
|
||||
for (i = 0; i < dumppages; ++i) {
|
||||
vm_offset_t a = addr + (i * PAGE_SIZE);
|
||||
if (is_physical_memory(a)) {
|
||||
va = pmap_kenter_temporary(trunc_page(a), i);
|
||||
} else {
|
||||
va = pmap_kenter_temporary(trunc_page(0), i);
|
||||
}
|
||||
}
|
||||
if ((count / blkcnt) < dumppages)
|
||||
dumppages = count / blkcnt;
|
||||
|
||||
for (i = 0; i < dumppages; ++i) {
|
||||
vm_offset_t a = addr + (i * PAGE_SIZE);
|
||||
if (is_physical_memory(a)) {
|
||||
va = pmap_kenter_temporary(trunc_page(a), i);
|
||||
} else {
|
||||
va = pmap_kenter_temporary(trunc_page(0), i);
|
||||
}
|
||||
}
|
||||
|
||||
retry:
|
||||
/*
|
||||
* Queue the block to the controller. If the queue is full, EBUSY
|
||||
* will be returned.
|
||||
*/
|
||||
error = aac_dump_enqueue(ad, blkno, va, dumppages);
|
||||
if (error && (error != EBUSY))
|
||||
return (error);
|
||||
/*
|
||||
* Queue the block to the controller. If the queue is full,
|
||||
* EBUSY will be returned.
|
||||
*/
|
||||
error = aac_dump_enqueue(ad, blkno, va, dumppages);
|
||||
if (error && (error != EBUSY))
|
||||
return (error);
|
||||
|
||||
if (!error) {
|
||||
if (dumpstatus(addr, (long)(count * DEV_BSIZE)) < 0)
|
||||
return (EINTR);
|
||||
if (!error) {
|
||||
if (dumpstatus(addr, (long)(count * DEV_BSIZE)) < 0)
|
||||
return (EINTR);
|
||||
|
||||
blkno += blkcnt * dumppages;
|
||||
count -= blkcnt * dumppages;
|
||||
addr += PAGE_SIZE * dumppages;
|
||||
if (count > 0)
|
||||
continue;
|
||||
blkno += blkcnt * dumppages;
|
||||
count -= blkcnt * dumppages;
|
||||
addr += PAGE_SIZE * dumppages;
|
||||
if (count > 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Either the queue was full on the last attemp, or we have no
|
||||
* more data to dump. Let the queue drain out and retry the
|
||||
* block if the queue was full.
|
||||
*/
|
||||
aac_dump_complete(sc);
|
||||
|
||||
if (error == EBUSY)
|
||||
goto retry;
|
||||
}
|
||||
|
||||
/*
|
||||
* Either the queue was full on the last attemp, or we have no more
|
||||
* data to dump. Let the queue drain out and retry the block if
|
||||
* the queue was full.
|
||||
*/
|
||||
aac_dump_complete(sc);
|
||||
|
||||
if (error == EBUSY)
|
||||
goto retry;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Handle completion of an I/O request.
|
||||
*/
|
||||
void
|
||||
aac_biodone(struct bio *bp)
|
||||
{
|
||||
struct aac_disk *sc = (struct aac_disk *)bp->bio_dev->si_drv1;
|
||||
struct aac_disk *sc;
|
||||
int blkno;
|
||||
|
||||
debug_called(4);
|
||||
debug_called(4);
|
||||
|
||||
devstat_end_transaction_bio(&sc->ad_stats, bp);
|
||||
if (bp->bio_flags & BIO_ERROR) {
|
||||
/*
|
||||
* XXX For some reason, the disklabel seems to get zero'd out. This
|
||||
* will cause diskerr to panic unless we pass in -1 as the blkno.
|
||||
*/
|
||||
int blkno = (sc->ad_label.d_nsectors) ? 0 : -1;
|
||||
sc = (struct aac_disk *)bp->bio_dev->si_drv1;
|
||||
|
||||
devstat_end_transaction_bio(&sc->ad_stats, bp);
|
||||
if (bp->bio_flags & BIO_ERROR) {
|
||||
blkno = (sc->ad_label.d_nsectors) ? 0 : -1;
|
||||
#if __FreeBSD_version > 500005
|
||||
diskerr(bp, (char *)bp->bio_driver1, blkno, &sc->ad_label);
|
||||
diskerr(bp, (char *)bp->bio_driver1, blkno, &sc->ad_label);
|
||||
#else
|
||||
diskerr(bp, (char *)bp->bio_driver1, 0, blkno, &sc->ad_label);
|
||||
diskerr(bp, (char *)bp->bio_driver1, 0, blkno, &sc->ad_label);
|
||||
#endif
|
||||
}
|
||||
biodone(bp);
|
||||
}
|
||||
biodone(bp);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Stub only.
|
||||
*/
|
||||
static int
|
||||
aac_disk_probe(device_t dev)
|
||||
{
|
||||
|
||||
debug_called(2);
|
||||
debug_called(2);
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Attach a unit to the controller.
|
||||
*/
|
||||
static int
|
||||
aac_disk_attach(device_t dev)
|
||||
{
|
||||
struct aac_disk *sc = (struct aac_disk *)device_get_softc(dev);
|
||||
|
||||
debug_called(1);
|
||||
struct aac_disk *sc;
|
||||
|
||||
debug_called(1);
|
||||
|
||||
/* initialise our softc */
|
||||
sc->ad_controller =
|
||||
(struct aac_softc *)device_get_softc(device_get_parent(dev));
|
||||
sc->ad_container = device_get_ivars(dev);
|
||||
sc->ad_dev = dev;
|
||||
sc = (struct aac_disk *)device_get_softc(dev);
|
||||
|
||||
/*
|
||||
* require that extended translation be enabled - other drivers read the
|
||||
* disk!
|
||||
*/
|
||||
sc->ad_size = sc->ad_container->co_mntobj.Capacity;
|
||||
if (sc->ad_size >= (2 * 1024 * 1024)) { /* 2GB */
|
||||
sc->ad_heads = 255;
|
||||
sc->ad_sectors = 63;
|
||||
} else if (sc->ad_size >= (1 * 1024 * 1024)) { /* 1GB */
|
||||
sc->ad_heads = 128;
|
||||
sc->ad_sectors = 32;
|
||||
} else {
|
||||
sc->ad_heads = 64;
|
||||
sc->ad_sectors = 32;
|
||||
}
|
||||
sc->ad_cylinders = (sc->ad_size / (sc->ad_heads * sc->ad_sectors));
|
||||
/* initialise our softc */
|
||||
sc->ad_controller =
|
||||
(struct aac_softc *)device_get_softc(device_get_parent(dev));
|
||||
sc->ad_container = device_get_ivars(dev);
|
||||
sc->ad_dev = dev;
|
||||
|
||||
device_printf(dev, "%uMB (%u sectors)\n",
|
||||
sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), sc->ad_size);
|
||||
/*
|
||||
* require that extended translation be enabled - other drivers read the
|
||||
* disk!
|
||||
*/
|
||||
sc->ad_size = sc->ad_container->co_mntobj.Capacity;
|
||||
if (sc->ad_size >= (2 * 1024 * 1024)) { /* 2GB */
|
||||
sc->ad_heads = 255;
|
||||
sc->ad_sectors = 63;
|
||||
} else if (sc->ad_size >= (1 * 1024 * 1024)) { /* 1GB */
|
||||
sc->ad_heads = 128;
|
||||
sc->ad_sectors = 32;
|
||||
} else {
|
||||
sc->ad_heads = 64;
|
||||
sc->ad_sectors = 32;
|
||||
}
|
||||
sc->ad_cylinders = (sc->ad_size / (sc->ad_heads * sc->ad_sectors));
|
||||
|
||||
devstat_add_entry(&sc->ad_stats, "aacd", device_get_unit(dev),
|
||||
AAC_BLOCK_SIZE, DEVSTAT_NO_ORDERED_TAGS,
|
||||
DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER,
|
||||
DEVSTAT_PRIORITY_ARRAY);
|
||||
device_printf(dev, "%uMB (%u sectors)\n",
|
||||
sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE),
|
||||
sc->ad_size);
|
||||
|
||||
/* attach a generic disk device to ourselves */
|
||||
sc->ad_dev_t = disk_create(device_get_unit(dev), &sc->ad_disk, 0,
|
||||
&aac_disk_cdevsw, &aac_disk_disk_cdevsw);
|
||||
sc->ad_dev_t->si_drv1 = sc;
|
||||
devstat_add_entry(&sc->ad_stats, "aacd", device_get_unit(dev),
|
||||
AAC_BLOCK_SIZE, DEVSTAT_NO_ORDERED_TAGS,
|
||||
DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER,
|
||||
DEVSTAT_PRIORITY_ARRAY);
|
||||
|
||||
/* attach a generic disk device to ourselves */
|
||||
sc->ad_dev_t = disk_create(device_get_unit(dev), &sc->ad_disk, 0,
|
||||
&aac_disk_cdevsw, &aac_disk_disk_cdevsw);
|
||||
sc->ad_dev_t->si_drv1 = sc;
|
||||
#ifdef FREEBSD_4
|
||||
disks_registered++;
|
||||
disks_registered++;
|
||||
#endif
|
||||
|
||||
sc->ad_dev_t->si_iosize_max = aac_iosize_max;
|
||||
sc->unit = device_get_unit(dev);
|
||||
sc->ad_dev_t->si_iosize_max = aac_iosize_max;
|
||||
sc->unit = device_get_unit(dev);
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Disconnect ourselves from the system.
|
||||
*/
|
||||
static int
|
||||
aac_disk_detach(device_t dev)
|
||||
{
|
||||
struct aac_disk *sc = (struct aac_disk *)device_get_softc(dev);
|
||||
struct aac_disk *sc;
|
||||
|
||||
debug_called(2);
|
||||
debug_called(2);
|
||||
|
||||
if (sc->ad_flags & AAC_DISK_OPEN)
|
||||
return(EBUSY);
|
||||
sc = (struct aac_disk *)device_get_softc(dev);
|
||||
|
||||
devstat_remove_entry(&sc->ad_stats);
|
||||
disk_destroy(sc->ad_dev_t);
|
||||
if (sc->ad_flags & AAC_DISK_OPEN)
|
||||
return(EBUSY);
|
||||
|
||||
devstat_remove_entry(&sc->ad_stats);
|
||||
disk_destroy(sc->ad_dev_t);
|
||||
#ifdef FREEBSD_4
|
||||
if (--disks_registered == 0)
|
||||
cdevsw_remove(&aac_disk_cdevsw);
|
||||
if (--disks_registered == 0)
|
||||
cdevsw_remove(&aac_disk_cdevsw);
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -39,16 +39,16 @@
|
||||
#define AACQ_COUNT 5 /* total number of queues */
|
||||
|
||||
struct aac_qstat {
|
||||
u_int32_t q_length;
|
||||
u_int32_t q_max;
|
||||
u_int32_t q_length;
|
||||
u_int32_t q_max;
|
||||
};
|
||||
|
||||
/*
|
||||
* Statistics request
|
||||
*/
|
||||
union aac_statrequest {
|
||||
u_int32_t as_item;
|
||||
struct aac_qstat as_qstat;
|
||||
u_int32_t as_item;
|
||||
struct aac_qstat as_qstat;
|
||||
};
|
||||
|
||||
#define AACIO_STATS _IOWR('T', 101, union aac_statrequest)
|
||||
@ -147,33 +147,33 @@ union aac_statrequest {
|
||||
* Support for faking the "miniport" version.
|
||||
*/
|
||||
struct aac_rev_check {
|
||||
RevComponent callingComponent;
|
||||
struct FsaRevision callingRevision;
|
||||
RevComponent callingComponent;
|
||||
struct FsaRevision callingRevision;
|
||||
};
|
||||
|
||||
struct aac_rev_check_resp {
|
||||
int possiblyCompatible;
|
||||
struct FsaRevision adapterSWRevision;
|
||||
int possiblyCompatible;
|
||||
struct FsaRevision adapterSWRevision;
|
||||
};
|
||||
|
||||
/*
|
||||
* Context passed in by a consumer looking to collect an AIF.
|
||||
*/
|
||||
struct get_adapter_fib_ioctl {
|
||||
u_int32_t AdapterFibContext;
|
||||
int Wait;
|
||||
caddr_t AifFib;
|
||||
u_int32_t AdapterFibContext;
|
||||
int Wait;
|
||||
caddr_t AifFib;
|
||||
};
|
||||
|
||||
struct aac_query_disk {
|
||||
int32_t ContainerNumber;
|
||||
int32_t Bus;
|
||||
int32_t Target;
|
||||
int32_t Lun;
|
||||
u_int32_t Valid;
|
||||
u_int32_t Locked;
|
||||
u_int32_t Deleted;
|
||||
int32_t Instance;
|
||||
char diskDeviceName[10];
|
||||
u_int32_t UnMapped;
|
||||
int32_t ContainerNumber;
|
||||
int32_t Bus;
|
||||
int32_t Target;
|
||||
int32_t Lun;
|
||||
u_int32_t Valid;
|
||||
u_int32_t Locked;
|
||||
u_int32_t Deleted;
|
||||
int32_t Instance;
|
||||
char diskDeviceName[10];
|
||||
u_int32_t UnMapped;
|
||||
};
|
||||
|
@ -57,20 +57,20 @@
|
||||
#include <dev/aac/aac_ioctl.h>
|
||||
#include <dev/aac/aacvar.h>
|
||||
|
||||
static int aac_pci_probe(device_t dev);
|
||||
static int aac_pci_attach(device_t dev);
|
||||
static int aac_pci_probe(device_t dev);
|
||||
static int aac_pci_attach(device_t dev);
|
||||
|
||||
static device_method_t aac_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, aac_pci_probe),
|
||||
DEVMETHOD(device_attach, aac_pci_attach),
|
||||
DEVMETHOD(device_detach, aac_detach),
|
||||
DEVMETHOD(device_suspend, aac_suspend),
|
||||
DEVMETHOD(device_resume, aac_resume),
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, aac_pci_probe),
|
||||
DEVMETHOD(device_attach, aac_pci_attach),
|
||||
DEVMETHOD(device_detach, aac_detach),
|
||||
DEVMETHOD(device_suspend, aac_suspend),
|
||||
DEVMETHOD(device_resume, aac_resume),
|
||||
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t aac_pci_driver = {
|
||||
@ -83,147 +83,154 @@ DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, 0, 0);
|
||||
|
||||
struct aac_ident
|
||||
{
|
||||
u_int16_t vendor;
|
||||
u_int16_t device;
|
||||
u_int16_t subvendor;
|
||||
u_int16_t subdevice;
|
||||
int hwif;
|
||||
char *desc;
|
||||
u_int16_t vendor;
|
||||
u_int16_t device;
|
||||
u_int16_t subvendor;
|
||||
u_int16_t subdevice;
|
||||
int hwif;
|
||||
char *desc;
|
||||
} aac_identifiers[] = {
|
||||
{0x1028, 0x0001, 0x1028, 0x0001, AAC_HWIF_I960RX, "Dell PERC 2/Si"},
|
||||
{0x1028, 0x0002, 0x1028, 0x0002, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x0003, 0x1028, 0x0003, AAC_HWIF_I960RX, "Dell PERC 3/Si"},
|
||||
{0x1028, 0x0004, 0x1028, 0x00d0, AAC_HWIF_I960RX, "Dell PERC 3/Si"},
|
||||
{0x1028, 0x0002, 0x1028, 0x00d1, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x0002, 0x1028, 0x00d9, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x0008, 0x1028, 0x00cf, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x000a, 0x1028, 0x0106, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1011, 0x0046, 0x9005, 0x0364, AAC_HWIF_STRONGARM, "Adaptec AAC-364"},
|
||||
{0x1011, 0x0046, 0x9005, 0x0365, AAC_HWIF_STRONGARM,
|
||||
"Adaptec SCSI RAID 5400S"},
|
||||
{0x1011, 0x0046, 0x9005, 0x1364, AAC_HWIF_STRONGARM, "Dell PERC 2/QC"},
|
||||
{0x1011, 0x0046, 0x103c, 0x10c2, AAC_HWIF_STRONGARM, "HP NetRaid-4M"},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
{0x1028, 0x0001, 0x1028, 0x0001, AAC_HWIF_I960RX, "Dell PERC 2/Si"},
|
||||
{0x1028, 0x0002, 0x1028, 0x0002, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x0003, 0x1028, 0x0003, AAC_HWIF_I960RX, "Dell PERC 3/Si"},
|
||||
{0x1028, 0x0004, 0x1028, 0x00d0, AAC_HWIF_I960RX, "Dell PERC 3/Si"},
|
||||
{0x1028, 0x0002, 0x1028, 0x00d1, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x0002, 0x1028, 0x00d9, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x0008, 0x1028, 0x00cf, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1028, 0x000a, 0x1028, 0x0106, AAC_HWIF_I960RX, "Dell PERC 3/Di"},
|
||||
{0x1011, 0x0046, 0x9005, 0x0364, AAC_HWIF_STRONGARM, "Adaptec AAC-364"},
|
||||
{0x1011, 0x0046, 0x9005, 0x0365, AAC_HWIF_STRONGARM,
|
||||
"Adaptec SCSI RAID 5400S"},
|
||||
{0x1011, 0x0046, 0x9005, 0x1364, AAC_HWIF_STRONGARM, "Dell PERC 2/QC"},
|
||||
{0x1011, 0x0046, 0x103c, 0x10c2, AAC_HWIF_STRONGARM, "HP NetRaid-4M"},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Determine whether this is one of our supported adapters.
|
||||
*/
|
||||
static int
|
||||
aac_pci_probe(device_t dev)
|
||||
{
|
||||
struct aac_ident *m;
|
||||
struct aac_ident *m;
|
||||
|
||||
debug_called(1);
|
||||
debug_called(1);
|
||||
|
||||
for (m = aac_identifiers; m->vendor != 0; m++) {
|
||||
if ((m->vendor == pci_get_vendor(dev)) &&
|
||||
(m->device == pci_get_device(dev)) &&
|
||||
((m->subvendor == 0) || (m->subvendor == pci_get_subvendor(dev))) &&
|
||||
((m->subdevice == 0) || ((m->subdevice == pci_get_subdevice(dev))))) {
|
||||
|
||||
device_set_desc(dev, m->desc);
|
||||
return(-10); /* allow room to be overridden */
|
||||
for (m = aac_identifiers; m->vendor != 0; m++) {
|
||||
if ((m->vendor == pci_get_vendor(dev)) &&
|
||||
(m->device == pci_get_device(dev)) &&
|
||||
((m->subvendor == 0) || (m->subvendor ==
|
||||
pci_get_subvendor(dev))) &&
|
||||
((m->subdevice == 0) || ((m->subdevice ==
|
||||
pci_get_subdevice(dev))))) {
|
||||
|
||||
device_set_desc(dev, m->desc);
|
||||
return(-10); /* allow room to be overridden */
|
||||
}
|
||||
}
|
||||
}
|
||||
return(ENXIO);
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Allocate resources for our device, set up the bus interface.
|
||||
*/
|
||||
static int
|
||||
aac_pci_attach(device_t dev)
|
||||
{
|
||||
struct aac_softc *sc;
|
||||
int i, error;
|
||||
u_int32_t command;
|
||||
struct aac_softc *sc;
|
||||
int i, error;
|
||||
u_int32_t command;
|
||||
|
||||
debug_called(1);
|
||||
debug_called(1);
|
||||
|
||||
/*
|
||||
* Initialise softc.
|
||||
*/
|
||||
sc = device_get_softc(dev);
|
||||
bzero(sc, sizeof(*sc));
|
||||
sc->aac_dev = dev;
|
||||
/*
|
||||
* Initialise softc.
|
||||
*/
|
||||
sc = device_get_softc(dev);
|
||||
bzero(sc, sizeof(*sc));
|
||||
sc->aac_dev = dev;
|
||||
|
||||
/* assume failure is 'not configured' */
|
||||
error = ENXIO;
|
||||
/* assume failure is 'not configured' */
|
||||
error = ENXIO;
|
||||
|
||||
/*
|
||||
* Verify that the adapter is correctly set up in PCI space.
|
||||
*/
|
||||
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
|
||||
command |= PCIM_CMD_BUSMASTEREN;
|
||||
pci_write_config(dev, PCIR_COMMAND, command, 2);
|
||||
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
|
||||
if (!(command & PCIM_CMD_BUSMASTEREN)) {
|
||||
device_printf(sc->aac_dev, "can't enable bus-master feature\n");
|
||||
goto out;
|
||||
}
|
||||
if ((command & PCIM_CMD_MEMEN) == 0) {
|
||||
device_printf(sc->aac_dev, "memory window not available\n");
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Verify that the adapter is correctly set up in PCI space.
|
||||
*/
|
||||
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
|
||||
command |= PCIM_CMD_BUSMASTEREN;
|
||||
pci_write_config(dev, PCIR_COMMAND, command, 2);
|
||||
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
|
||||
if (!(command & PCIM_CMD_BUSMASTEREN)) {
|
||||
device_printf(sc->aac_dev, "can't enable bus-master feature\n");
|
||||
goto out;
|
||||
}
|
||||
if ((command & PCIM_CMD_MEMEN) == 0) {
|
||||
device_printf(sc->aac_dev, "memory window not available\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the PCI register window.
|
||||
*/
|
||||
sc->aac_regs_rid = 0x10; /* first base address register */
|
||||
if ((sc->aac_regs_resource = bus_alloc_resource(sc->aac_dev, SYS_RES_MEMORY,
|
||||
&sc->aac_regs_rid, 0, ~0, 1,
|
||||
RF_ACTIVE)) == NULL) {
|
||||
device_printf(sc->aac_dev, "couldn't allocate register window\n");
|
||||
goto out;
|
||||
}
|
||||
sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
|
||||
sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
|
||||
/*
|
||||
* Allocate the PCI register window.
|
||||
*/
|
||||
sc->aac_regs_rid = 0x10; /* first base address register */
|
||||
if ((sc->aac_regs_resource = bus_alloc_resource(sc->aac_dev,
|
||||
SYS_RES_MEMORY,
|
||||
&sc->aac_regs_rid,
|
||||
0, ~0, 1,
|
||||
RF_ACTIVE)) == NULL) {
|
||||
device_printf(sc->aac_dev,
|
||||
"couldn't allocate register window\n");
|
||||
goto out;
|
||||
}
|
||||
sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
|
||||
sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
|
||||
|
||||
/*
|
||||
* Allocate and connect our interrupt.
|
||||
*/
|
||||
sc->aac_irq_rid = 0;
|
||||
if ((sc->aac_irq = bus_alloc_resource(sc->aac_dev, SYS_RES_IRQ,
|
||||
&sc->aac_irq_rid, 0, ~0, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE)) == NULL) {
|
||||
device_printf(sc->aac_dev, "can't allocate interrupt\n");
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Allocate and connect our interrupt.
|
||||
*/
|
||||
sc->aac_irq_rid = 0;
|
||||
if ((sc->aac_irq = bus_alloc_resource(sc->aac_dev, SYS_RES_IRQ,
|
||||
&sc->aac_irq_rid, 0, ~0, 1,
|
||||
RF_SHAREABLE |
|
||||
RF_ACTIVE)) == NULL) {
|
||||
device_printf(sc->aac_dev, "can't allocate interrupt\n");
|
||||
goto out;
|
||||
}
|
||||
#if __FreeBSD_version < 500005
|
||||
#define INTR_ENTROPY 0
|
||||
#endif
|
||||
if (bus_setup_intr(sc->aac_dev, sc->aac_irq, INTR_TYPE_BIO|INTR_ENTROPY,
|
||||
aac_intr, sc, &sc->aac_intr)) {
|
||||
device_printf(sc->aac_dev, "can't set up interrupt\n");
|
||||
goto out;
|
||||
}
|
||||
if (bus_setup_intr(sc->aac_dev, sc->aac_irq, INTR_TYPE_BIO|INTR_ENTROPY,
|
||||
aac_intr, sc, &sc->aac_intr)) {
|
||||
device_printf(sc->aac_dev, "can't set up interrupt\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* assume failure is 'out of memory' */
|
||||
error = ENOMEM;
|
||||
/* assume failure is 'out of memory' */
|
||||
error = ENOMEM;
|
||||
|
||||
/*
|
||||
* Allocate the parent bus DMA tag appropriate for our PCI interface.
|
||||
*
|
||||
* Note that some of these controllers are 64-bit capable.
|
||||
*/
|
||||
if (bus_dma_tag_create(NULL, /* parent */
|
||||
1, 0, /* algnmnt, boundary */
|
||||
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
MAXBSIZE, AAC_MAXSGENTRIES, /* maxsize, nsegments */
|
||||
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
|
||||
BUS_DMA_ALLOCNOW, /* flags */
|
||||
&sc->aac_parent_dmat)) {
|
||||
device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Allocate the parent bus DMA tag appropriate for our PCI interface.
|
||||
*
|
||||
* Note that some of these controllers are 64-bit capable.
|
||||
*/
|
||||
if (bus_dma_tag_create(NULL, /* parent */
|
||||
1, 0, /* algnmnt, boundary */
|
||||
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
MAXBSIZE, /* maxsize */
|
||||
AAC_MAXSGENTRIES, /* nsegments */
|
||||
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
|
||||
BUS_DMA_ALLOCNOW, /* flags */
|
||||
&sc->aac_parent_dmat)) {
|
||||
device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create DMA tag for mapping buffers into controller-addressable space.
|
||||
*/
|
||||
if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */
|
||||
/*
|
||||
* Create DMA tag for mapping buffers into controller-addressable space.
|
||||
*/
|
||||
if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */
|
||||
1, 0, /* algnmnt, boundary */
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
@ -232,14 +239,14 @@ aac_pci_attach(device_t dev)
|
||||
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
|
||||
0, /* flags */
|
||||
&sc->aac_buffer_dmat)) {
|
||||
device_printf(sc->aac_dev, "can't allocate buffer DMA tag\n");
|
||||
goto out;
|
||||
}
|
||||
device_printf(sc->aac_dev, "can't allocate buffer DMA tag\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create DMA tag for mapping FIBs into controller-addressable space..
|
||||
*/
|
||||
if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */
|
||||
/*
|
||||
* Create DMA tag for mapping FIBs into controller-addressable space..
|
||||
*/
|
||||
if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */
|
||||
1, 0, /* algnmnt, boundary */
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
@ -249,46 +256,46 @@ aac_pci_attach(device_t dev)
|
||||
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
|
||||
0, /* flags */
|
||||
&sc->aac_fib_dmat)) {
|
||||
device_printf(sc->aac_dev, "can't allocate FIB DMA tag\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect the hardware interface version, set up the bus interface
|
||||
* indirection.
|
||||
*/
|
||||
sc->aac_hwif = AAC_HWIF_UNKNOWN;
|
||||
for (i = 0; aac_identifiers[i].vendor != 0; i++) {
|
||||
if ((aac_identifiers[i].vendor == pci_get_vendor(dev)) &&
|
||||
(aac_identifiers[i].device == pci_get_device(dev))) {
|
||||
sc->aac_hwif = aac_identifiers[i].hwif;
|
||||
switch(sc->aac_hwif) {
|
||||
case AAC_HWIF_I960RX:
|
||||
debug(2, "set hardware up for i960Rx");
|
||||
sc->aac_if = aac_rx_interface;
|
||||
break;
|
||||
|
||||
case AAC_HWIF_STRONGARM:
|
||||
debug(2, "set hardware up for StrongARM");
|
||||
sc->aac_if = aac_sa_interface;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
device_printf(sc->aac_dev, "can't allocate FIB DMA tag\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (sc->aac_hwif == AAC_HWIF_UNKNOWN) {
|
||||
device_printf(sc->aac_dev, "unknown hardware type\n");
|
||||
error = ENXIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do bus-independent initialisation.
|
||||
*/
|
||||
error = aac_attach(sc);
|
||||
|
||||
/*
|
||||
* Detect the hardware interface version, set up the bus interface
|
||||
* indirection.
|
||||
*/
|
||||
sc->aac_hwif = AAC_HWIF_UNKNOWN;
|
||||
for (i = 0; aac_identifiers[i].vendor != 0; i++) {
|
||||
if ((aac_identifiers[i].vendor == pci_get_vendor(dev)) &&
|
||||
(aac_identifiers[i].device == pci_get_device(dev))) {
|
||||
sc->aac_hwif = aac_identifiers[i].hwif;
|
||||
switch(sc->aac_hwif) {
|
||||
case AAC_HWIF_I960RX:
|
||||
debug(2, "set hardware up for i960Rx");
|
||||
sc->aac_if = aac_rx_interface;
|
||||
break;
|
||||
|
||||
case AAC_HWIF_STRONGARM:
|
||||
debug(2, "set hardware up for StrongARM");
|
||||
sc->aac_if = aac_sa_interface;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sc->aac_hwif == AAC_HWIF_UNKNOWN) {
|
||||
device_printf(sc->aac_dev, "unknown hardware type\n");
|
||||
error = ENXIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do bus-independent initialisation.
|
||||
*/
|
||||
error = aac_attach(sc);
|
||||
|
||||
out:
|
||||
if (error)
|
||||
aac_free(sc);
|
||||
return(error);
|
||||
if (error)
|
||||
aac_free(sc);
|
||||
return(error);
|
||||
}
|
||||
|
@ -34,84 +34,84 @@
|
||||
* relevant only to FSA operations.
|
||||
*/
|
||||
static struct aac_code_lookup aac_command_status_table[] = {
|
||||
{"OK", 0},
|
||||
{"operation not permitted", 1},
|
||||
{"not found", 2},
|
||||
{"I/O error", 5},
|
||||
{"device not configured", 6},
|
||||
{"too big", 7},
|
||||
{"permission denoed", 13},
|
||||
{"file exists", 17},
|
||||
{"cross-device link", 18},
|
||||
{"operation not supported by device", 19},
|
||||
{"not a directory", 20},
|
||||
{"is a directory", 21},
|
||||
{"invalid argument", 22},
|
||||
{"file too large", 27},
|
||||
{"no space on device", 28},
|
||||
{"readonly filesystem", 30},
|
||||
{"too many links", 31},
|
||||
{"operation would block", 35},
|
||||
{"file name too long", 63},
|
||||
{"directory not empty", 66},
|
||||
{"quota exceeded", 69},
|
||||
{"stale file handle", 70},
|
||||
{"too many levels of remote in path", 71},
|
||||
{"bad file handle", 10001},
|
||||
{"not sync", 10002},
|
||||
{"bad cookie", 10003},
|
||||
{"operation not supported", 10004},
|
||||
{"too small", 10005},
|
||||
{"server fault", 10006},
|
||||
{"bad type", 10007},
|
||||
{"jukebox", 10008},
|
||||
{"not mounted", 10009},
|
||||
{"in maintenace mode", 10010},
|
||||
{"stale ACL", 10011},
|
||||
{NULL, 0},
|
||||
{"unknown command status", 0}
|
||||
{"OK", 0},
|
||||
{"operation not permitted", 1},
|
||||
{"not found", 2},
|
||||
{"I/O error", 5},
|
||||
{"device not configured", 6},
|
||||
{"too big", 7},
|
||||
{"permission denoed", 13},
|
||||
{"file exists", 17},
|
||||
{"cross-device link", 18},
|
||||
{"operation not supported by device", 19},
|
||||
{"not a directory", 20},
|
||||
{"is a directory", 21},
|
||||
{"invalid argument", 22},
|
||||
{"file too large", 27},
|
||||
{"no space on device", 28},
|
||||
{"readonly filesystem", 30},
|
||||
{"too many links", 31},
|
||||
{"operation would block", 35},
|
||||
{"file name too long", 63},
|
||||
{"directory not empty", 66},
|
||||
{"quota exceeded", 69},
|
||||
{"stale file handle", 70},
|
||||
{"too many levels of remote in path", 71},
|
||||
{"bad file handle", 10001},
|
||||
{"not sync", 10002},
|
||||
{"bad cookie", 10003},
|
||||
{"operation not supported", 10004},
|
||||
{"too small", 10005},
|
||||
{"server fault", 10006},
|
||||
{"bad type", 10007},
|
||||
{"jukebox", 10008},
|
||||
{"not mounted", 10009},
|
||||
{"in maintenace mode", 10010},
|
||||
{"stale ACL", 10011},
|
||||
{NULL, 0},
|
||||
{"unknown command status", 0}
|
||||
};
|
||||
|
||||
#define AAC_COMMAND_STATUS(x) aac_describe_code(aac_command_status_table, x)
|
||||
|
||||
static struct aac_code_lookup aac_cpu_variant[] = {
|
||||
{"i960JX", CPUI960_JX},
|
||||
{"i960CX", CPUI960_CX},
|
||||
{"i960HX", CPUI960_HX},
|
||||
{"i960RX", CPUI960_RX},
|
||||
{"StrongARM SA110", CPUARM_SA110},
|
||||
{"PowerPC 603e", CPUPPC_603e},
|
||||
{"Unknown StrongARM", CPUARM_xxx},
|
||||
{"Unknown PowerPC", CPUPPC_xxx},
|
||||
{NULL, 0},
|
||||
{"Unknown processor", 0}
|
||||
{"i960JX", CPUI960_JX},
|
||||
{"i960CX", CPUI960_CX},
|
||||
{"i960HX", CPUI960_HX},
|
||||
{"i960RX", CPUI960_RX},
|
||||
{"StrongARM SA110", CPUARM_SA110},
|
||||
{"PowerPC 603e", CPUPPC_603e},
|
||||
{"Unknown StrongARM", CPUARM_xxx},
|
||||
{"Unknown PowerPC", CPUPPC_xxx},
|
||||
{NULL, 0},
|
||||
{"Unknown processor", 0}
|
||||
};
|
||||
|
||||
static struct aac_code_lookup aac_battery_platform[] = {
|
||||
{"required battery present", PLATFORM_BAT_REQ_PRESENT},
|
||||
{"REQUIRED BATTERY NOT PRESENT", PLATFORM_BAT_REQ_NOTPRESENT},
|
||||
{"optional battery present", PLATFORM_BAT_OPT_PRESENT},
|
||||
{"optional battery not installed", PLATFORM_BAT_OPT_NOTPRESENT},
|
||||
{"no battery support", PLATFORM_BAT_NOT_SUPPORTED},
|
||||
{NULL, 0},
|
||||
{"unknown battery platform", 0}
|
||||
{"required battery present", PLATFORM_BAT_REQ_PRESENT},
|
||||
{"REQUIRED BATTERY NOT PRESENT", PLATFORM_BAT_REQ_NOTPRESENT},
|
||||
{"optional battery present", PLATFORM_BAT_OPT_PRESENT},
|
||||
{"optional battery not installed", PLATFORM_BAT_OPT_NOTPRESENT},
|
||||
{"no battery support", PLATFORM_BAT_NOT_SUPPORTED},
|
||||
{NULL, 0},
|
||||
{"unknown battery platform", 0}
|
||||
};
|
||||
|
||||
static struct aac_code_lookup aac_container_types[] = {
|
||||
{"Volume", CT_VOLUME},
|
||||
{"RAID 1 (Mirror)", CT_MIRROR},
|
||||
{"RAID 0 (Stripe)", CT_STRIPE},
|
||||
{"RAID 5", CT_RAID5},
|
||||
{"SSRW", CT_SSRW},
|
||||
{"SSRO", CT_SSRO},
|
||||
{"Morph", CT_MORPH},
|
||||
{"Passthrough", CT_PASSTHRU},
|
||||
{"RAID 4", CT_RAID4},
|
||||
{"RAID 10", CT_RAID10},
|
||||
{"RAID 00", CT_RAID00},
|
||||
{"Volume of Mirrors", CT_VOLUME_OF_MIRRORS},
|
||||
{"Pseudo RAID 3", CT_PSEUDO_RAID3},
|
||||
{NULL, 0},
|
||||
{"unknown", 0}
|
||||
{"Volume", CT_VOLUME},
|
||||
{"RAID 1 (Mirror)", CT_MIRROR},
|
||||
{"RAID 0 (Stripe)", CT_STRIPE},
|
||||
{"RAID 5", CT_RAID5},
|
||||
{"SSRW", CT_SSRW},
|
||||
{"SSRO", CT_SSRO},
|
||||
{"Morph", CT_MORPH},
|
||||
{"Passthrough", CT_PASSTHRU},
|
||||
{"RAID 4", CT_RAID4},
|
||||
{"RAID 10", CT_RAID10},
|
||||
{"RAID 00", CT_RAID00},
|
||||
{"Volume of Mirrors", CT_VOLUME_OF_MIRRORS},
|
||||
{"Pseudo RAID 3", CT_PSEUDO_RAID3},
|
||||
{NULL, 0},
|
||||
{"unknown", 0}
|
||||
};
|
||||
|
||||
|
1095
sys/dev/aac/aacreg.h
1095
sys/dev/aac/aacreg.h
File diff suppressed because it is too large
Load Diff
@ -29,11 +29,9 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
******************************************************************************
|
||||
Driver Parameter Definitions
|
||||
******************************************************************************
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Driver Parameter Definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* The firmware interface allows for a 16-bit s/g list length. We limit
|
||||
@ -92,11 +90,9 @@
|
||||
*/
|
||||
#define AAC_DISK_MAJOR 200
|
||||
|
||||
/******************************************************************************
|
||||
******************************************************************************
|
||||
Driver Variable Definitions
|
||||
******************************************************************************
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Driver Variable Definitions
|
||||
*/
|
||||
|
||||
#if __FreeBSD_version >= 500005
|
||||
# include <sys/taskqueue.h>
|
||||
@ -107,10 +103,10 @@
|
||||
*/
|
||||
struct aac_container
|
||||
{
|
||||
struct aac_mntobj co_mntobj;
|
||||
device_t co_disk;
|
||||
int co_found;
|
||||
TAILQ_ENTRY(aac_container) co_link;
|
||||
struct aac_mntobj co_mntobj;
|
||||
device_t co_disk;
|
||||
int co_found;
|
||||
TAILQ_ENTRY(aac_container) co_link;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -118,20 +114,20 @@ struct aac_container
|
||||
*/
|
||||
struct aac_disk
|
||||
{
|
||||
device_t ad_dev;
|
||||
dev_t ad_dev_t;
|
||||
struct aac_softc *ad_controller;
|
||||
struct aac_container *ad_container;
|
||||
struct disk ad_disk;
|
||||
struct devstat ad_stats;
|
||||
struct disklabel ad_label;
|
||||
int ad_flags;
|
||||
device_t ad_dev;
|
||||
dev_t ad_dev_t;
|
||||
struct aac_softc *ad_controller;
|
||||
struct aac_container *ad_container;
|
||||
struct disk ad_disk;
|
||||
struct devstat ad_stats;
|
||||
struct disklabel ad_label;
|
||||
int ad_flags;
|
||||
#define AAC_DISK_OPEN (1<<0)
|
||||
int ad_cylinders;
|
||||
int ad_heads;
|
||||
int ad_sectors;
|
||||
u_int32_t ad_size;
|
||||
int unit;
|
||||
int ad_cylinders;
|
||||
int ad_heads;
|
||||
int ad_sectors;
|
||||
u_int32_t ad_size;
|
||||
int unit;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -139,21 +135,20 @@ struct aac_disk
|
||||
*/
|
||||
struct aac_command
|
||||
{
|
||||
TAILQ_ENTRY(aac_command) cm_link; /* list linkage */
|
||||
TAILQ_ENTRY(aac_command) cm_link; /* list linkage */
|
||||
|
||||
struct aac_softc *cm_sc; /* controller that owns us */
|
||||
struct aac_softc *cm_sc; /* controller that owns us */
|
||||
|
||||
struct aac_fib *cm_fib; /* FIB associated with this
|
||||
struct aac_fib *cm_fib; /* FIB associated with this
|
||||
* command */
|
||||
u_int32_t cm_fibphys; /* bus address of the FIB */
|
||||
struct bio *cm_data; /* pointer to data in kernel
|
||||
u_int32_t cm_fibphys; /* bus address of the FIB */
|
||||
struct bio *cm_data; /* pointer to data in kernel
|
||||
* space */
|
||||
u_int32_t cm_datalen; /* data length */
|
||||
bus_dmamap_t cm_datamap; /* DMA map for bio data */
|
||||
struct aac_sg_table *cm_sgtable; /* pointer to s/g table in
|
||||
u_int32_t cm_datalen; /* data length */
|
||||
bus_dmamap_t cm_datamap; /* DMA map for bio data */
|
||||
struct aac_sg_table *cm_sgtable; /* pointer to s/g table in
|
||||
* command */
|
||||
|
||||
int cm_flags;
|
||||
int cm_flags;
|
||||
#define AAC_CMD_MAPPED (1<<0) /* command has had its data
|
||||
* mapped */
|
||||
#define AAC_CMD_DATAIN (1<<1) /* command involves data moving
|
||||
@ -168,10 +163,10 @@ struct aac_command
|
||||
#define AAC_ON_AACQ_COMPLETE (1<<8)
|
||||
#define AAC_ON_AACQ_MASK ((1<<5)|(1<<6)|(1<<7)|(1<<8))
|
||||
|
||||
void (* cm_complete)(struct aac_command *cm);
|
||||
void *cm_private;
|
||||
time_t cm_timestamp; /* command creation time */
|
||||
int cm_queue;
|
||||
void (* cm_complete)(struct aac_command *cm);
|
||||
void *cm_private;
|
||||
time_t cm_timestamp; /* command creation time */
|
||||
int cm_queue;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -188,21 +183,21 @@ struct aac_command
|
||||
* Sync Fib
|
||||
*/
|
||||
struct aac_common {
|
||||
/* fibs for the controller to send us messages */
|
||||
struct aac_fib ac_fibs[AAC_ADAPTER_FIBS];
|
||||
/* fibs for the controller to send us messages */
|
||||
struct aac_fib ac_fibs[AAC_ADAPTER_FIBS];
|
||||
|
||||
/* the init structure */
|
||||
struct aac_adapter_init ac_init;
|
||||
/* the init structure */
|
||||
struct aac_adapter_init ac_init;
|
||||
|
||||
/* arena within which the queue structures are kept */
|
||||
u_int8_t ac_qbuf[sizeof(struct aac_queue_table) +
|
||||
AAC_QUEUE_ALIGN];
|
||||
/* arena within which the queue structures are kept */
|
||||
u_int8_t ac_qbuf[sizeof(struct aac_queue_table) +
|
||||
AAC_QUEUE_ALIGN];
|
||||
|
||||
/* buffer for text messages from the controller */
|
||||
char ac_printf[AAC_PRINTF_BUFSIZE];
|
||||
|
||||
/* fib for synchronous commands */
|
||||
struct aac_fib ac_sync_fib;
|
||||
/* buffer for text messages from the controller */
|
||||
char ac_printf[AAC_PRINTF_BUFSIZE];
|
||||
|
||||
/* fib for synchronous commands */
|
||||
struct aac_fib ac_sync_fib;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -210,15 +205,15 @@ struct aac_common {
|
||||
*/
|
||||
struct aac_interface
|
||||
{
|
||||
int (* aif_get_fwstatus)(struct aac_softc *sc);
|
||||
void (* aif_qnotify)(struct aac_softc *sc, int qbit);
|
||||
int (* aif_get_istatus)(struct aac_softc *sc);
|
||||
void (* aif_set_istatus)(struct aac_softc *sc, int mask);
|
||||
void (* aif_set_mailbox)(struct aac_softc *sc, u_int32_t command,
|
||||
u_int32_t arg0, u_int32_t arg1,
|
||||
u_int32_t arg2, u_int32_t arg3);
|
||||
int (* aif_get_mailboxstatus)(struct aac_softc *sc);
|
||||
void (* aif_set_interrupts)(struct aac_softc *sc, int enable);
|
||||
int (*aif_get_fwstatus)(struct aac_softc *sc);
|
||||
void (*aif_qnotify)(struct aac_softc *sc, int qbit);
|
||||
int (*aif_get_istatus)(struct aac_softc *sc);
|
||||
void (*aif_set_istatus)(struct aac_softc *sc, int mask);
|
||||
void (*aif_set_mailbox)(struct aac_softc *sc, u_int32_t command,
|
||||
u_int32_t arg0, u_int32_t arg1,
|
||||
u_int32_t arg2, u_int32_t arg3);
|
||||
int (*aif_get_mailboxstatus)(struct aac_softc *sc);
|
||||
void (*aif_set_interrupts)(struct aac_softc *sc, int enable);
|
||||
};
|
||||
extern struct aac_interface aac_rx_interface;
|
||||
extern struct aac_interface aac_sa_interface;
|
||||
@ -231,9 +226,12 @@ extern struct aac_interface aac_sa_interface;
|
||||
#define AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3) \
|
||||
((sc)->aac_if.aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
|
||||
(arg3)))
|
||||
#define AAC_GET_MAILBOXSTATUS(sc) ((sc)->aac_if.aif_get_mailboxstatus((sc)))
|
||||
#define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), 0))
|
||||
#define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), 1))
|
||||
#define AAC_GET_MAILBOXSTATUS(sc) ((sc)->aac_if.aif_get_mailboxstatus( \
|
||||
(sc)))
|
||||
#define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), \
|
||||
0))
|
||||
#define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), \
|
||||
1))
|
||||
|
||||
#define AAC_SETREG4(sc, reg, val) bus_space_write_4(sc->aac_btag, \
|
||||
sc->aac_bhandle, reg, val)
|
||||
@ -270,80 +268,80 @@ typedef struct simplelock aac_lock_t;
|
||||
*/
|
||||
struct aac_softc
|
||||
{
|
||||
/* bus connections */
|
||||
device_t aac_dev;
|
||||
struct resource *aac_regs_resource; /* register interface
|
||||
/* bus connections */
|
||||
device_t aac_dev;
|
||||
struct resource *aac_regs_resource; /* register interface
|
||||
* window */
|
||||
int aac_regs_rid; /* resource ID */
|
||||
bus_space_handle_t aac_bhandle; /* bus space handle */
|
||||
bus_space_tag_t aac_btag; /* bus space tag */
|
||||
bus_dma_tag_t aac_parent_dmat; /* parent DMA tag */
|
||||
bus_dma_tag_t aac_buffer_dmat; /* data buffer/command
|
||||
int aac_regs_rid; /* resource ID */
|
||||
bus_space_handle_t aac_bhandle; /* bus space handle */
|
||||
bus_space_tag_t aac_btag; /* bus space tag */
|
||||
bus_dma_tag_t aac_parent_dmat; /* parent DMA tag */
|
||||
bus_dma_tag_t aac_buffer_dmat; /* data buffer/command
|
||||
* DMA tag */
|
||||
struct resource *aac_irq; /* interrupt */
|
||||
int aac_irq_rid;
|
||||
void *aac_intr; /* interrupt handle */
|
||||
struct resource *aac_irq; /* interrupt */
|
||||
int aac_irq_rid;
|
||||
void *aac_intr; /* interrupt handle */
|
||||
|
||||
/* controller features, limits and status */
|
||||
int aac_state;
|
||||
/* controller features, limits and status */
|
||||
int aac_state;
|
||||
#define AAC_STATE_SUSPEND (1<<0)
|
||||
#define AAC_STATE_OPEN (1<<1)
|
||||
#define AAC_STATE_INTERRUPTS_ON (1<<2)
|
||||
#define AAC_STATE_AIF_SLEEPER (1<<3)
|
||||
struct FsaRevision aac_revision;
|
||||
struct FsaRevision aac_revision;
|
||||
|
||||
/* controller hardware interface */
|
||||
int aac_hwif;
|
||||
/* controller hardware interface */
|
||||
int aac_hwif;
|
||||
#define AAC_HWIF_I960RX 0
|
||||
#define AAC_HWIF_STRONGARM 1
|
||||
#define AAC_HWIF_UNKNOWN -1
|
||||
bus_dma_tag_t aac_common_dmat; /* common structure
|
||||
bus_dma_tag_t aac_common_dmat; /* common structure
|
||||
* DMA tag */
|
||||
bus_dmamap_t aac_common_dmamap; /* common structure
|
||||
bus_dmamap_t aac_common_dmamap; /* common structure
|
||||
* DMA map */
|
||||
struct aac_common *aac_common;
|
||||
u_int32_t aac_common_busaddr;
|
||||
struct aac_interface aac_if;
|
||||
struct aac_common *aac_common;
|
||||
u_int32_t aac_common_busaddr;
|
||||
struct aac_interface aac_if;
|
||||
|
||||
/* command/fib resources */
|
||||
bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocing FIBs */
|
||||
struct aac_fib *aac_fibs;
|
||||
bus_dmamap_t aac_fibmap;
|
||||
u_int32_t aac_fibphys;
|
||||
struct aac_command aac_command[AAC_FIB_COUNT];
|
||||
/* command/fib resources */
|
||||
bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocing FIBs */
|
||||
struct aac_fib *aac_fibs;
|
||||
bus_dmamap_t aac_fibmap;
|
||||
u_int32_t aac_fibphys;
|
||||
struct aac_command aac_command[AAC_FIB_COUNT];
|
||||
|
||||
/* command management */
|
||||
TAILQ_HEAD(,aac_command) aac_free; /* command structures
|
||||
/* command management */
|
||||
TAILQ_HEAD(,aac_command) aac_free; /* command structures
|
||||
* available for reuse */
|
||||
TAILQ_HEAD(,aac_command) aac_ready; /* commands on hold for
|
||||
TAILQ_HEAD(,aac_command) aac_ready; /* commands on hold for
|
||||
* controller resources */
|
||||
TAILQ_HEAD(,aac_command) aac_busy;
|
||||
TAILQ_HEAD(,aac_command) aac_complete; /* commands which have been
|
||||
TAILQ_HEAD(,aac_command) aac_busy;
|
||||
TAILQ_HEAD(,aac_command) aac_complete; /* commands which have been
|
||||
* returned by the controller */
|
||||
struct bio_queue_head aac_bioq;
|
||||
struct aac_queue_table *aac_queues;
|
||||
struct aac_queue_entry *aac_qentries[AAC_QUEUE_COUNT];
|
||||
struct bio_queue_head aac_bioq;
|
||||
struct aac_queue_table *aac_queues;
|
||||
struct aac_queue_entry *aac_qentries[AAC_QUEUE_COUNT];
|
||||
|
||||
struct aac_qstat aac_qstat[AACQ_COUNT]; /* queue statistics */
|
||||
struct aac_qstat aac_qstat[AACQ_COUNT]; /* queue statistics */
|
||||
|
||||
/* connected containters */
|
||||
struct aac_container_tq aac_container_tqh;
|
||||
aac_lock_t aac_container_lock;
|
||||
/* connected containters */
|
||||
struct aac_container_tq aac_container_tqh;
|
||||
aac_lock_t aac_container_lock;
|
||||
|
||||
/* delayed activity infrastructure */
|
||||
/* delayed activity infrastructure */
|
||||
#if __FreeBSD_version >= 500005
|
||||
struct task aac_task_complete; /* deferred-completion
|
||||
struct task aac_task_complete; /* deferred-completion
|
||||
* task */
|
||||
#endif
|
||||
struct intr_config_hook aac_ich;
|
||||
struct intr_config_hook aac_ich;
|
||||
|
||||
/* management interface */
|
||||
dev_t aac_dev_t;
|
||||
struct aac_aif_command aac_aifq[AAC_AIFQ_LENGTH];
|
||||
int aac_aifq_head;
|
||||
int aac_aifq_tail;
|
||||
struct proc *aifthread;
|
||||
int aifflags;
|
||||
/* management interface */
|
||||
dev_t aac_dev_t;
|
||||
struct aac_aif_command aac_aifq[AAC_AIFQ_LENGTH];
|
||||
int aac_aifq_head;
|
||||
int aac_aifq_tail;
|
||||
struct proc *aifthread;
|
||||
int aifflags;
|
||||
#define AAC_AIFFLAGS_RUNNING (1 << 0)
|
||||
#define AAC_AIFFLAGS_PENDING (1 << 1)
|
||||
#define AAC_AIFFLAGS_EXIT (1 << 2)
|
||||
@ -376,13 +374,13 @@ extern void aac_dump_complete(struct aac_softc *sc);
|
||||
*/
|
||||
#ifdef AAC_DEBUG
|
||||
# define debug(level, fmt, args...) \
|
||||
do { \
|
||||
do { \
|
||||
if (level <=AAC_DEBUG) printf("%s: " fmt "\n", __FUNCTION__ , ##args); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
# define debug_called(level) \
|
||||
do { \
|
||||
do { \
|
||||
if (level <= AAC_DEBUG) printf(__FUNCTION__ ": called\n"); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
extern void aac_print_queues(struct aac_softc *sc);
|
||||
extern void aac_panic(struct aac_softc *sc, char *reason);
|
||||
@ -405,104 +403,108 @@ extern void aac_print_aif(struct aac_softc *sc,
|
||||
#endif
|
||||
|
||||
struct aac_code_lookup {
|
||||
char *string;
|
||||
u_int32_t code;
|
||||
char *string;
|
||||
u_int32_t code;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
/*
|
||||
* Queue primitives for driver queues.
|
||||
*/
|
||||
#define AACQ_ADD(sc, qname) \
|
||||
do { \
|
||||
struct aac_qstat *qs = &(sc)->aac_qstat[qname]; \
|
||||
struct aac_qstat *qs; \
|
||||
\
|
||||
qs->q_length++; \
|
||||
if (qs->q_length > qs->q_max) \
|
||||
qs->q_max = qs->q_length; \
|
||||
} while(0)
|
||||
qs = &(sc)->aac_qstat[qname]; \
|
||||
\
|
||||
qs->q_length++; \
|
||||
if (qs->q_length > qs->q_max) \
|
||||
qs->q_max = qs->q_length; \
|
||||
} while (0)
|
||||
|
||||
#define AACQ_REMOVE(sc, qname) (sc)->aac_qstat[qname].q_length--
|
||||
#define AACQ_INIT(sc, qname) \
|
||||
do { \
|
||||
sc->aac_qstat[qname].q_length = 0; \
|
||||
sc->aac_qstat[qname].q_max = 0; \
|
||||
} while(0)
|
||||
#define AACQ_INIT(sc, qname) \
|
||||
do { \
|
||||
sc->aac_qstat[qname].q_length = 0; \
|
||||
sc->aac_qstat[qname].q_max = 0; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define AACQ_COMMAND_QUEUE(name, index) \
|
||||
static __inline void \
|
||||
aac_initq_ ## name (struct aac_softc *sc) \
|
||||
{ \
|
||||
TAILQ_INIT(&sc->aac_ ## name); \
|
||||
AACQ_INIT(sc, index); \
|
||||
TAILQ_INIT(&sc->aac_ ## name); \
|
||||
AACQ_INIT(sc, index); \
|
||||
} \
|
||||
static __inline void \
|
||||
aac_enqueue_ ## name (struct aac_command *cm) \
|
||||
{ \
|
||||
int s; \
|
||||
int s; \
|
||||
\
|
||||
s = splbio(); \
|
||||
if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) { \
|
||||
printf("command %p is on another queue, flags = %#x\n", \
|
||||
cm, cm->cm_flags); \
|
||||
panic("command is on another queue"); \
|
||||
} \
|
||||
TAILQ_INSERT_TAIL(&cm->cm_sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags |= AAC_ON_ ## index; \
|
||||
AACQ_ADD(cm->cm_sc, index); \
|
||||
splx(s); \
|
||||
s = splbio(); \
|
||||
if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) { \
|
||||
printf("command %p is on another queue, flags = %#x\n", \
|
||||
cm, cm->cm_flags); \
|
||||
panic("command is on another queue"); \
|
||||
} \
|
||||
TAILQ_INSERT_TAIL(&cm->cm_sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags |= AAC_ON_ ## index; \
|
||||
AACQ_ADD(cm->cm_sc, index); \
|
||||
splx(s); \
|
||||
} \
|
||||
static __inline void \
|
||||
aac_requeue_ ## name (struct aac_command *cm) \
|
||||
{ \
|
||||
int s; \
|
||||
int s; \
|
||||
\
|
||||
s = splbio(); \
|
||||
if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) { \
|
||||
printf("command %p is on another queue, flags = %#x\n", \
|
||||
cm, cm->cm_flags); \
|
||||
panic("command is on another queue"); \
|
||||
} \
|
||||
TAILQ_INSERT_HEAD(&cm->cm_sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags |= AAC_ON_ ## index; \
|
||||
AACQ_ADD(cm->cm_sc, index); \
|
||||
splx(s); \
|
||||
s = splbio(); \
|
||||
if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) { \
|
||||
printf("command %p is on another queue, flags = %#x\n", \
|
||||
cm, cm->cm_flags); \
|
||||
panic("command is on another queue"); \
|
||||
} \
|
||||
TAILQ_INSERT_HEAD(&cm->cm_sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags |= AAC_ON_ ## index; \
|
||||
AACQ_ADD(cm->cm_sc, index); \
|
||||
splx(s); \
|
||||
} \
|
||||
static __inline struct aac_command * \
|
||||
aac_dequeue_ ## name (struct aac_softc *sc) \
|
||||
{ \
|
||||
struct aac_command *cm; \
|
||||
int s; \
|
||||
struct aac_command *cm; \
|
||||
int s; \
|
||||
\
|
||||
s = splbio(); \
|
||||
if ((cm = TAILQ_FIRST(&sc->aac_ ## name)) != NULL) { \
|
||||
if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
|
||||
printf("command %p not in queue, flags = %#x, bit = %#x\n",\
|
||||
cm, cm->cm_flags, AAC_ON_ ## index); \
|
||||
panic("command not in queue"); \
|
||||
s = splbio(); \
|
||||
if ((cm = TAILQ_FIRST(&sc->aac_ ## name)) != NULL) { \
|
||||
if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
|
||||
printf("command %p not in queue, flags = %#x, " \
|
||||
"bit = %#x\n", cm, cm->cm_flags, \
|
||||
AAC_ON_ ## index); \
|
||||
panic("command not in queue"); \
|
||||
} \
|
||||
TAILQ_REMOVE(&sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags &= ~AAC_ON_ ## index; \
|
||||
AACQ_REMOVE(sc, index); \
|
||||
} \
|
||||
TAILQ_REMOVE(&sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags &= ~AAC_ON_ ## index; \
|
||||
AACQ_REMOVE(sc, index); \
|
||||
} \
|
||||
splx(s); \
|
||||
return(cm); \
|
||||
splx(s); \
|
||||
return(cm); \
|
||||
} \
|
||||
static __inline void \
|
||||
aac_remove_ ## name (struct aac_command *cm) \
|
||||
{ \
|
||||
int s; \
|
||||
int s; \
|
||||
\
|
||||
s = splbio(); \
|
||||
if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
|
||||
printf("command %p not in queue, flags = %#x, bit = %#x\n", \
|
||||
cm, cm->cm_flags, AAC_ON_ ## index); \
|
||||
panic("command not in queue"); \
|
||||
} \
|
||||
TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags &= ~AAC_ON_ ## index; \
|
||||
AACQ_REMOVE(cm->cm_sc, index); \
|
||||
splx(s); \
|
||||
s = splbio(); \
|
||||
if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
|
||||
printf("command %p not in queue, flags = %#x, " \
|
||||
"bit = %#x\n", cm, cm->cm_flags, \
|
||||
AAC_ON_ ## index); \
|
||||
panic("command not in queue"); \
|
||||
} \
|
||||
TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link); \
|
||||
cm->cm_flags &= ~AAC_ON_ ## index; \
|
||||
AACQ_REMOVE(cm->cm_sc, index); \
|
||||
splx(s); \
|
||||
} \
|
||||
struct hack
|
||||
|
||||
@ -517,43 +519,43 @@ AACQ_COMMAND_QUEUE(complete, AACQ_COMPLETE);
|
||||
static __inline void
|
||||
aac_initq_bio(struct aac_softc *sc)
|
||||
{
|
||||
bioq_init(&sc->aac_bioq);
|
||||
AACQ_INIT(sc, AACQ_BIO);
|
||||
bioq_init(&sc->aac_bioq);
|
||||
AACQ_INIT(sc, AACQ_BIO);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
aac_enqueue_bio(struct aac_softc *sc, struct bio *bp)
|
||||
{
|
||||
int s;
|
||||
int s;
|
||||
|
||||
s = splbio();
|
||||
bioq_insert_tail(&sc->aac_bioq, bp);
|
||||
AACQ_ADD(sc, AACQ_BIO);
|
||||
splx(s);
|
||||
s = splbio();
|
||||
bioq_insert_tail(&sc->aac_bioq, bp);
|
||||
AACQ_ADD(sc, AACQ_BIO);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
static __inline struct bio *
|
||||
aac_dequeue_bio(struct aac_softc *sc)
|
||||
{
|
||||
int s;
|
||||
struct bio *bp;
|
||||
int s;
|
||||
struct bio *bp;
|
||||
|
||||
s = splbio();
|
||||
if ((bp = bioq_first(&sc->aac_bioq)) != NULL) {
|
||||
s = splbio();
|
||||
if ((bp = bioq_first(&sc->aac_bioq)) != NULL) {
|
||||
bioq_remove(&sc->aac_bioq, bp);
|
||||
AACQ_REMOVE(sc, AACQ_BIO);
|
||||
}
|
||||
splx(s);
|
||||
return(bp);
|
||||
}
|
||||
splx(s);
|
||||
return(bp);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
aac_print_printf(struct aac_softc *sc)
|
||||
{
|
||||
if (sc->aac_common->ac_printf[0]) {
|
||||
if (sc->aac_common->ac_printf[0]) {
|
||||
device_printf(sc->aac_dev, "**Monitor** %.*s", AAC_PRINTF_BUFSIZE,
|
||||
sc->aac_common->ac_printf);
|
||||
sc->aac_common->ac_printf[0] = 0;
|
||||
AAC_QNOTIFY(sc, AAC_DB_PRINTF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,16 +39,16 @@
|
||||
#define AACQ_COUNT 5 /* total number of queues */
|
||||
|
||||
struct aac_qstat {
|
||||
u_int32_t q_length;
|
||||
u_int32_t q_max;
|
||||
u_int32_t q_length;
|
||||
u_int32_t q_max;
|
||||
};
|
||||
|
||||
/*
|
||||
* Statistics request
|
||||
*/
|
||||
union aac_statrequest {
|
||||
u_int32_t as_item;
|
||||
struct aac_qstat as_qstat;
|
||||
u_int32_t as_item;
|
||||
struct aac_qstat as_qstat;
|
||||
};
|
||||
|
||||
#define AACIO_STATS _IOWR('T', 101, union aac_statrequest)
|
||||
@ -147,33 +147,33 @@ union aac_statrequest {
|
||||
* Support for faking the "miniport" version.
|
||||
*/
|
||||
struct aac_rev_check {
|
||||
RevComponent callingComponent;
|
||||
struct FsaRevision callingRevision;
|
||||
RevComponent callingComponent;
|
||||
struct FsaRevision callingRevision;
|
||||
};
|
||||
|
||||
struct aac_rev_check_resp {
|
||||
int possiblyCompatible;
|
||||
struct FsaRevision adapterSWRevision;
|
||||
int possiblyCompatible;
|
||||
struct FsaRevision adapterSWRevision;
|
||||
};
|
||||
|
||||
/*
|
||||
* Context passed in by a consumer looking to collect an AIF.
|
||||
*/
|
||||
struct get_adapter_fib_ioctl {
|
||||
u_int32_t AdapterFibContext;
|
||||
int Wait;
|
||||
caddr_t AifFib;
|
||||
u_int32_t AdapterFibContext;
|
||||
int Wait;
|
||||
caddr_t AifFib;
|
||||
};
|
||||
|
||||
struct aac_query_disk {
|
||||
int32_t ContainerNumber;
|
||||
int32_t Bus;
|
||||
int32_t Target;
|
||||
int32_t Lun;
|
||||
u_int32_t Valid;
|
||||
u_int32_t Locked;
|
||||
u_int32_t Deleted;
|
||||
int32_t Instance;
|
||||
char diskDeviceName[10];
|
||||
u_int32_t UnMapped;
|
||||
int32_t ContainerNumber;
|
||||
int32_t Bus;
|
||||
int32_t Target;
|
||||
int32_t Lun;
|
||||
u_int32_t Valid;
|
||||
u_int32_t Locked;
|
||||
u_int32_t Deleted;
|
||||
int32_t Instance;
|
||||
char diskDeviceName[10];
|
||||
u_int32_t UnMapped;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user