135863739SMike Smith /*- 235863739SMike Smith * Copyright (c) 2000 Michael Smith 3c6eafcf2SScott Long * Copyright (c) 2001 Scott Long 435863739SMike Smith * Copyright (c) 2000 BSDi 5c6eafcf2SScott Long * Copyright (c) 2001 Adaptec, Inc. 635863739SMike Smith * All rights reserved. 735863739SMike Smith * 835863739SMike Smith * Redistribution and use in source and binary forms, with or without 935863739SMike Smith * modification, are permitted provided that the following conditions 1035863739SMike Smith * are met: 1135863739SMike Smith * 1. Redistributions of source code must retain the above copyright 1235863739SMike Smith * notice, this list of conditions and the following disclaimer. 1335863739SMike Smith * 2. Redistributions in binary form must reproduce the above copyright 1435863739SMike Smith * notice, this list of conditions and the following disclaimer in the 1535863739SMike Smith * documentation and/or other materials provided with the distribution. 1635863739SMike Smith * 1735863739SMike Smith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1835863739SMike Smith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1935863739SMike Smith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2035863739SMike Smith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2135863739SMike Smith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2235863739SMike Smith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2335863739SMike Smith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2435863739SMike Smith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2535863739SMike Smith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2635863739SMike Smith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2735863739SMike Smith * SUCH DAMAGE. 2835863739SMike Smith * 2935863739SMike Smith * $FreeBSD$ 3035863739SMike Smith */ 3135863739SMike Smith 3235863739SMike Smith /* 3335863739SMike Smith * Debugging support. 3435863739SMike Smith */ 35f6c4dd3fSScott Long #include "opt_aac.h" 3635863739SMike Smith 37f6c4dd3fSScott Long #ifdef AAC_DEBUG 3835863739SMike Smith #include <sys/param.h> 3935863739SMike Smith #include <sys/systm.h> 4035863739SMike Smith #include <sys/kernel.h> 4135863739SMike Smith 4235863739SMike Smith #include <dev/aac/aac_compat.h> 4335863739SMike Smith #include <sys/bus.h> 4435863739SMike Smith #include <sys/devicestat.h> 4535863739SMike Smith #include <sys/disk.h> 4635863739SMike Smith 4735863739SMike Smith #include <machine/resource.h> 4835863739SMike Smith #include <machine/bus.h> 4935863739SMike Smith 5035863739SMike Smith #include <dev/aac/aacreg.h> 510b94a66eSMike Smith #include <dev/aac/aac_ioctl.h> 5235863739SMike Smith #include <dev/aac/aacvar.h> 5335863739SMike Smith 54da4c1ce3SJustin T. Gibbs #ifdef AAC_DEBUG 5535863739SMike Smith void aac_printstate0(void); 5635863739SMike Smith void aac_intr0(void); 5735863739SMike Smith 58c6eafcf2SScott Long /****************************************************************************** 5935863739SMike Smith * Dump the command queue indices 6035863739SMike Smith */ 6135863739SMike Smith void 6235863739SMike Smith aac_print_queues(struct aac_softc *sc) 6335863739SMike Smith { 6435863739SMike Smith device_printf(sc->aac_dev, "FIB queue header at %p queues at %p\n", 6535863739SMike Smith &sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0], 6635863739SMike Smith &sc->aac_queues->qt_HostNormCmdQueue[0]); 6735863739SMike Smith device_printf(sc->aac_dev, "HOST_NORM_CMD %d/%d (%d)\n", 6835863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX], 6935863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX], 7035863739SMike Smith AAC_HOST_NORM_CMD_ENTRIES); 7135863739SMike Smith device_printf(sc->aac_dev, "HOST_HIGH_CMD %d/%d (%d)\n", 7235863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX], 7335863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX], 7435863739SMike Smith AAC_HOST_HIGH_CMD_ENTRIES); 7535863739SMike Smith device_printf(sc->aac_dev, "ADAP_NORM_CMD %d/%d (%d)\n", 7635863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX], 7735863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX], 7835863739SMike Smith AAC_ADAP_NORM_CMD_ENTRIES); 7935863739SMike Smith device_printf(sc->aac_dev, "ADAP_HIGH_CMD %d/%d (%d)\n", 8035863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX], 8135863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX], 8235863739SMike Smith AAC_ADAP_HIGH_CMD_ENTRIES); 8335863739SMike Smith device_printf(sc->aac_dev, "HOST_NORM_RESP %d/%d (%d)\n", 8435863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX], 8535863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX], 8635863739SMike Smith AAC_HOST_NORM_RESP_ENTRIES); 8735863739SMike Smith device_printf(sc->aac_dev, "HOST_HIGH_RESP %d/%d (%d)\n", 8835863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX], 8935863739SMike Smith sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX], 9035863739SMike Smith AAC_HOST_HIGH_RESP_ENTRIES); 9135863739SMike Smith device_printf(sc->aac_dev, "ADAP_NORM_RESP %d/%d (%d)\n", 9235863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX], 9335863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX], 9435863739SMike Smith AAC_ADAP_NORM_RESP_ENTRIES); 9535863739SMike Smith device_printf(sc->aac_dev, "ADAP_HIGH_RESP %d/%d (%d)\n", 9635863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX], 9735863739SMike Smith sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX], 9835863739SMike Smith AAC_ADAP_HIGH_RESP_ENTRIES); 990b94a66eSMike Smith device_printf(sc->aac_dev, "AACQ_FREE %d/%d\n", 1000b94a66eSMike Smith sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max); 1010b94a66eSMike Smith device_printf(sc->aac_dev, "AACQ_BIO %d/%d\n", 1020b94a66eSMike Smith sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max); 1030b94a66eSMike Smith device_printf(sc->aac_dev, "AACQ_READY %d/%d\n", 1040b94a66eSMike Smith sc->aac_qstat[AACQ_READY].q_length, sc->aac_qstat[AACQ_READY].q_max); 1050b94a66eSMike Smith device_printf(sc->aac_dev, "AACQ_BUSY %d/%d\n", 1060b94a66eSMike Smith sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max); 1070b94a66eSMike Smith device_printf(sc->aac_dev, "AACQ_COMPLETE %d/%d\n", 108c6eafcf2SScott Long sc->aac_qstat[AACQ_COMPLETE].q_length, 109c6eafcf2SScott Long sc->aac_qstat[AACQ_COMPLETE].q_max); 11035863739SMike Smith } 11135863739SMike Smith 112c6eafcf2SScott Long /****************************************************************************** 11335863739SMike Smith * Print the command queue states for controller 0 (callable from DDB) 11435863739SMike Smith */ 11535863739SMike Smith void 11635863739SMike Smith aac_printstate0(void) 11735863739SMike Smith { 11835863739SMike Smith struct aac_softc *sc = devclass_get_softc(aac_devclass, 0); 11935863739SMike Smith 12035863739SMike Smith aac_print_queues(sc); 12135863739SMike Smith switch (sc->aac_hwif) { 12235863739SMike Smith case AAC_HWIF_I960RX: 12335863739SMike Smith device_printf(sc->aac_dev, "IDBR 0x%08x IIMR 0x%08x IISR 0x%08x\n", 124c6eafcf2SScott Long AAC_GETREG4(sc, AAC_RX_IDBR), AAC_GETREG4(sc, AAC_RX_IIMR), 125c6eafcf2SScott Long AAC_GETREG4(sc, AAC_RX_IISR)); 12635863739SMike Smith device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x OISR 0x%08x\n", 127c6eafcf2SScott Long AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), 128c6eafcf2SScott Long AAC_GETREG4(sc, AAC_RX_OISR)); 129c6eafcf2SScott Long AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY | 130c6eafcf2SScott Long AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/); 13135863739SMike Smith device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x OISR 0x%08x\n", 132c6eafcf2SScott Long AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), 133c6eafcf2SScott Long AAC_GETREG4(sc, AAC_RX_OISR)); 13435863739SMike Smith break; 13535863739SMike Smith case AAC_HWIF_STRONGARM: 13635863739SMike Smith /* XXX implement */ 13735863739SMike Smith } 13835863739SMike Smith } 13935863739SMike Smith 140c6eafcf2SScott Long /****************************************************************************** 14135863739SMike Smith * simulate an interrupt for controller 0 14235863739SMike Smith */ 14335863739SMike Smith void 14435863739SMike Smith aac_intr0(void) 14535863739SMike Smith { 14635863739SMike Smith struct aac_softc *sc = devclass_get_softc(aac_devclass, 0); 14735863739SMike Smith 14835863739SMike Smith aac_intr(sc); 14935863739SMike Smith } 15035863739SMike Smith 151c6eafcf2SScott Long /****************************************************************************** 15235863739SMike Smith * Panic in a slightly informative fashion 15335863739SMike Smith */ 15435863739SMike Smith void 15535863739SMike Smith aac_panic(struct aac_softc *sc, char *reason) 15635863739SMike Smith { 15735863739SMike Smith aac_print_queues(sc); 15835863739SMike Smith panic(reason); 15935863739SMike Smith } 16035863739SMike Smith 161c6eafcf2SScott Long /****************************************************************************** 16235863739SMike Smith * Print a FIB 16335863739SMike Smith */ 16435863739SMike Smith void 16535863739SMike Smith aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller) 16635863739SMike Smith { 16735863739SMike Smith device_printf(sc->aac_dev, "%s: FIB @ %p\n", caller, fib); 16835863739SMike Smith device_printf(sc->aac_dev, " XferState %b\n", fib->Header.XferState, "\20" 16935863739SMike Smith "\1HOSTOWNED" 17035863739SMike Smith "\2ADAPTEROWNED" 17135863739SMike Smith "\3INITIALISED" 17235863739SMike Smith "\4EMPTY" 17335863739SMike Smith "\5FROMPOOL" 17435863739SMike Smith "\6FROMHOST" 17535863739SMike Smith "\7FROMADAP" 17635863739SMike Smith "\10REXPECTED" 17735863739SMike Smith "\11RNOTEXPECTED" 17835863739SMike Smith "\12DONEADAP" 17935863739SMike Smith "\13DONEHOST" 18035863739SMike Smith "\14HIGH" 18135863739SMike Smith "\15NORM" 18235863739SMike Smith "\16ASYNC" 18335863739SMike Smith "\17PAGEFILEIO" 18435863739SMike Smith "\20SHUTDOWN" 18535863739SMike Smith "\21LAZYWRITE" 18635863739SMike Smith "\22ADAPMICROFIB" 18735863739SMike Smith "\23BIOSFIB" 18835863739SMike Smith "\24FAST_RESPONSE" 18935863739SMike Smith "\25APIFIB\n"); 19035863739SMike Smith device_printf(sc->aac_dev, " Command %d\n", fib->Header.Command); 191c6eafcf2SScott Long device_printf(sc->aac_dev, " StructType %d\n", 192c6eafcf2SScott Long fib->Header.StructType); 19335863739SMike Smith device_printf(sc->aac_dev, " Flags 0x%x\n", fib->Header.Flags); 19435863739SMike Smith device_printf(sc->aac_dev, " Size %d\n", fib->Header.Size); 195c6eafcf2SScott Long device_printf(sc->aac_dev, " SenderSize %d\n", 196c6eafcf2SScott Long fib->Header.SenderSize); 197c6eafcf2SScott Long device_printf(sc->aac_dev, " SenderAddress 0x%x\n", 198c6eafcf2SScott Long fib->Header.SenderFibAddress); 199c6eafcf2SScott Long device_printf(sc->aac_dev, " ReceiverAddress 0x%x\n", 200c6eafcf2SScott Long fib->Header.ReceiverFibAddress); 201c6eafcf2SScott Long device_printf(sc->aac_dev, " SenderData 0x%x\n", 202c6eafcf2SScott Long fib->Header.SenderData); 20335863739SMike Smith switch(fib->Header.Command) { 20435863739SMike Smith case ContainerCommand: 20535863739SMike Smith { 20635863739SMike Smith struct aac_blockread *br = (struct aac_blockread *)fib->data; 20735863739SMike Smith struct aac_blockwrite *bw = (struct aac_blockwrite *)fib->data; 20835863739SMike Smith struct aac_sg_table *sg = NULL; 20935863739SMike Smith int i; 21035863739SMike Smith if (br->Command == VM_CtBlockRead) { 21135863739SMike Smith device_printf(sc->aac_dev, " BlockRead: container %d 0x%x/%d\n", 21235863739SMike Smith br->ContainerId, br->BlockNumber, br->ByteCount); 21335863739SMike Smith sg = &br->SgMap; 21435863739SMike Smith } 21535863739SMike Smith if (bw->Command == VM_CtBlockWrite) { 216c6eafcf2SScott Long device_printf(sc->aac_dev, " BlockWrite: container %d 0x%x/%d " 217c6eafcf2SScott Long "(%s)\n", bw->ContainerId, bw->BlockNumber, 218c6eafcf2SScott Long bw->ByteCount, bw->Stable == CSTABLE ? "stable" : 219c6eafcf2SScott Long "unstable"); 22035863739SMike Smith sg = &bw->SgMap; 22135863739SMike Smith } 22235863739SMike Smith if (sg != NULL) { 22335863739SMike Smith device_printf(sc->aac_dev, " %d s/g entries\n", sg->SgCount); 22435863739SMike Smith for (i = 0; i < sg->SgCount; i++) 225c6eafcf2SScott Long device_printf(sc->aac_dev, " 0x%08x/%d\n", 226c6eafcf2SScott Long sg->SgEntry[i].SgAddress, 227c6eafcf2SScott Long sg->SgEntry[i].SgByteCount); 22835863739SMike Smith } 22935863739SMike Smith break; 23035863739SMike Smith } 23135863739SMike Smith default: 23235863739SMike Smith device_printf(sc->aac_dev, " %16D\n", fib->data, " "); 23335863739SMike Smith device_printf(sc->aac_dev, " %16D\n", fib->data + 16, " "); 23435863739SMike Smith break; 23535863739SMike Smith } 23635863739SMike Smith } 23735863739SMike Smith 238c6eafcf2SScott Long /****************************************************************************** 23935863739SMike Smith * Describe an AIF we have received. 24035863739SMike Smith */ 24135863739SMike Smith void 24235863739SMike Smith aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) 24335863739SMike Smith { 24435863739SMike Smith switch(aif->command) { 24535863739SMike Smith case AifCmdEventNotify: 24635863739SMike Smith device_printf(sc->aac_dev, "EventNotify (%d)\n", aif->seqNumber); 24735863739SMike Smith switch(aif->data.EN.type) { 24835863739SMike Smith case AifEnGeneric: /* Generic notification */ 24935863739SMike Smith device_printf(sc->aac_dev, "(Generic) %.*s\n", 250c6eafcf2SScott Long (int)sizeof(aif->data.EN.data.EG), 251c6eafcf2SScott Long aif->data.EN.data.EG.text); 25235863739SMike Smith break; 25335863739SMike Smith case AifEnTaskComplete: /* Task has completed */ 25435863739SMike Smith device_printf(sc->aac_dev, "(TaskComplete)\n"); 25535863739SMike Smith break; 256c6eafcf2SScott Long case AifEnConfigChange: /* Adapter configuration change 257c6eafcf2SScott Long * occurred */ 25835863739SMike Smith device_printf(sc->aac_dev, "(ConfigChange)\n"); 25935863739SMike Smith break; 260c6eafcf2SScott Long case AifEnContainerChange: /* Adapter specific container 261c6eafcf2SScott Long * configuration change */ 26235863739SMike Smith device_printf(sc->aac_dev, "(ContainerChange) container %d,%d\n", 26335863739SMike Smith aif->data.EN.data.ECC.container[0], 26435863739SMike Smith aif->data.EN.data.ECC.container[1]); 26535863739SMike Smith break; 26635863739SMike Smith case AifEnDeviceFailure: /* SCSI device failed */ 26735863739SMike Smith device_printf(sc->aac_dev, "(DeviceFailure) handle %d\n", 268c6eafcf2SScott Long aif->data.EN.data.EDF.deviceHandle); /* XXX 269c6eafcf2SScott Long * interpret */ 27035863739SMike Smith break; 27135863739SMike Smith case AifEnMirrorFailover: /* Mirror failover started */ 272c6eafcf2SScott Long device_printf(sc->aac_dev, "(MirrorFailover) container %d failed, " 273c6eafcf2SScott Long "migrating from slice %d to %d\n", 27435863739SMike Smith aif->data.EN.data.EMF.container, 27535863739SMike Smith aif->data.EN.data.EMF.failedSlice, 27635863739SMike Smith aif->data.EN.data.EMF.creatingSlice); 27735863739SMike Smith break; 278c6eafcf2SScott Long case AifEnContainerEvent: /* Significant container 279c6eafcf2SScott Long * event */ 280c6eafcf2SScott Long device_printf(sc->aac_dev, "(ContainerEvent) container %d event " 281c6eafcf2SScott Long "%d\n", aif->data.EN.data.ECE.container, 282c6eafcf2SScott Long aif->data.EN.data.ECE.eventType); /* XXX 283c6eafcf2SScott Long * interpret? */ 28435863739SMike Smith break; 28535863739SMike Smith case AifEnFileSystemChange: /* File system changed */ 28635863739SMike Smith device_printf(sc->aac_dev, "(FileSystemChange)\n"); 28735863739SMike Smith break; 28835863739SMike Smith case AifEnConfigPause: /* Container pause event */ 28935863739SMike Smith device_printf(sc->aac_dev, "(ConfigPause)\n"); 29035863739SMike Smith break; 29135863739SMike Smith case AifEnConfigResume: /* Container resume event */ 29235863739SMike Smith device_printf(sc->aac_dev, "(ConfigResume)\n"); 29335863739SMike Smith break; 294c6eafcf2SScott Long case AifEnFailoverChange: /* Failover space assignment 295c6eafcf2SScott Long * changed */ 29635863739SMike Smith device_printf(sc->aac_dev, "(FailoverChange)\n"); 29735863739SMike Smith break; 29835863739SMike Smith case AifEnRAID5RebuildDone: /* RAID5 rebuild finished */ 29935863739SMike Smith device_printf(sc->aac_dev, "(RAID5RebuildDone)\n"); 30035863739SMike Smith break; 30135863739SMike Smith case AifEnEnclosureManagement: /* Enclosure management event */ 302c6eafcf2SScott Long device_printf(sc->aac_dev, "(EnclosureManagement) EMPID %d unit %d " 303c6eafcf2SScott Long "event %d\n", aif->data.EN.data.EEE.empID, 30435863739SMike Smith aif->data.EN.data.EEE.unitID, 30535863739SMike Smith aif->data.EN.data.EEE.eventType); 30635863739SMike Smith break; 307c6eafcf2SScott Long case AifEnBatteryEvent: /* Significant NV battery 308c6eafcf2SScott Long * event */ 309c6eafcf2SScott Long device_printf(sc->aac_dev, "(BatteryEvent) %d (state was %d, " 310c6eafcf2SScott Long "is %d\n", aif->data.EN.data.EBE.transition_type, 311c6eafcf2SScott Long aif->data.EN.data.EBE.current_state, /* XXX */ 312c6eafcf2SScott Long aif->data.EN.data.EBE.prior_state); /* interpret? */ 31335863739SMike Smith break; 314c6eafcf2SScott Long case AifEnAddContainer: /* A new container was 315c6eafcf2SScott Long * created. */ 31635863739SMike Smith device_printf(sc->aac_dev, "(AddContainer)\n"); 31735863739SMike Smith break; 31835863739SMike Smith case AifEnDeleteContainer: /* A container was deleted. */ 31935863739SMike Smith device_printf(sc->aac_dev, "(DeleteContainer)\n"); 32035863739SMike Smith break; 321c6eafcf2SScott Long case AifEnBatteryNeedsRecond: /* The battery needs 322c6eafcf2SScott Long * reconditioning */ 32335863739SMike Smith device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n"); 32435863739SMike Smith break; 32535863739SMike Smith case AifEnClusterEvent: /* Some cluster event */ 32635863739SMike Smith device_printf(sc->aac_dev, "(ClusterEvent) event %d\n", 32735863739SMike Smith aif->data.EN.data.ECLE.eventType); 32835863739SMike Smith break; 32935863739SMike Smith case AifEnDiskSetEvent: /* A disk set event occured. */ 330c6eafcf2SScott Long device_printf(sc->aac_dev, "(DiskSetEvent) event %d diskset %lld " 331c6eafcf2SScott Long "creator %lld\n", aif->data.EN.data.EDS.eventType, 33235863739SMike Smith aif->data.EN.data.EDS.DsNum, 33335863739SMike Smith aif->data.EN.data.EDS.CreatorId); 33435863739SMike Smith break; 335c6eafcf2SScott Long case AifDenMorphComplete: /* A morph operation 336c6eafcf2SScott Long * completed */ 33735863739SMike Smith device_printf(sc->aac_dev, "(MorphComplete)\n"); 33835863739SMike Smith break; 339c6eafcf2SScott Long case AifDenVolumeExtendComplete: /* A volume expand operation 340c6eafcf2SScott Long * completed */ 34135863739SMike Smith device_printf(sc->aac_dev, "(VolumeExtendComplete)\n"); 34235863739SMike Smith break; 34335863739SMike Smith default: 34435863739SMike Smith device_printf(sc->aac_dev, "(%d)\n", aif->data.EN.type); 34535863739SMike Smith break; 34635863739SMike Smith } 34735863739SMike Smith break; 34835863739SMike Smith case AifCmdJobProgress: 34935863739SMike Smith { 35035863739SMike Smith char *status; 35135863739SMike Smith switch(aif->data.PR[0].status) { 35235863739SMike Smith case AifJobStsSuccess: 35335863739SMike Smith status = "success"; break; 35435863739SMike Smith case AifJobStsFinished: 35535863739SMike Smith status = "finished"; break; 35635863739SMike Smith case AifJobStsAborted: 35735863739SMike Smith status = "aborted"; break; 35835863739SMike Smith case AifJobStsFailed: 35935863739SMike Smith status = "failed"; break; 36035863739SMike Smith case AifJobStsSuspended: 36135863739SMike Smith status = "suspended"; break; 36235863739SMike Smith case AifJobStsRunning: 36335863739SMike Smith status = "running"; break; 36435863739SMike Smith default: 36535863739SMike Smith status = "unknown status"; break; 36635863739SMike Smith } 36735863739SMike Smith 368c6eafcf2SScott Long device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n", 369c6eafcf2SScott Long aif->seqNumber, status, aif->data.PR[0].currentTick, 370c6eafcf2SScott Long aif->data.PR[0].finalTick); 37135863739SMike Smith switch(aif->data.PR[0].jd.type) { 372c6eafcf2SScott Long case AifJobScsiZero: /* SCSI dev clear operation */ 373c6eafcf2SScott Long device_printf(sc->aac_dev, "(ScsiZero) handle %d\n", 374c6eafcf2SScott Long aif->data.PR[0].jd.client.scsi_dh); 37535863739SMike Smith break; 376c6eafcf2SScott Long case AifJobScsiVerify: /* SCSI device Verify operation 377c6eafcf2SScott Long * NO REPAIR */ 378c6eafcf2SScott Long device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n", 379c6eafcf2SScott Long aif->data.PR[0].jd.client.scsi_dh); 38035863739SMike Smith break; 381c6eafcf2SScott Long case AifJobScsiExercise: /* SCSI device Exercise 382c6eafcf2SScott Long * operation */ 383c6eafcf2SScott Long device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n", 384c6eafcf2SScott Long aif->data.PR[0].jd.client.scsi_dh); 38535863739SMike Smith break; 386c6eafcf2SScott Long case AifJobScsiVerifyRepair: /* SCSI device Verify operation 387c6eafcf2SScott Long * WITH repair */ 388c6eafcf2SScott Long device_printf(sc->aac_dev, "(ScsiVerifyRepair) handle %d\n", 389c6eafcf2SScott Long aif->data.PR[0].jd.client.scsi_dh); 39035863739SMike Smith break; 39135863739SMike Smith case AifJobCtrZero: /* Container clear operation */ 39235863739SMike Smith device_printf(sc->aac_dev, "(ConatainerZero) container %d\n", 39335863739SMike Smith aif->data.PR[0].jd.client.container.src); 39435863739SMike Smith break; 39535863739SMike Smith case AifJobCtrCopy: /* Container copy operation */ 39635863739SMike Smith device_printf(sc->aac_dev, "(ConatainerCopy) container %d to %d\n", 397c6eafcf2SScott Long aif->data.PR[0].jd.client.container.src, 398c6eafcf2SScott Long aif->data.PR[0].jd.client.container.dst); 39935863739SMike Smith break; 400c6eafcf2SScott Long case AifJobCtrCreateMirror: /* Container Create Mirror 401c6eafcf2SScott Long * operation */ 402c6eafcf2SScott Long device_printf(sc->aac_dev, "(ConatainerCreateMirror) container " 403c6eafcf2SScott Long "%d\n", aif->data.PR[0].jd.client.container.src); 404c6eafcf2SScott Long /* XXX two containers? */ 40535863739SMike Smith break; 406c6eafcf2SScott Long case AifJobCtrMergeMirror: /* Container Merge Mirror 407c6eafcf2SScott Long * operation */ 40835863739SMike Smith device_printf(sc->aac_dev, "(ConatainerMergeMirror) container %d\n", 409c6eafcf2SScott Long aif->data.PR[0].jd.client.container.src); 410c6eafcf2SScott Long /* XXX two containers? */ 41135863739SMike Smith break; 412c6eafcf2SScott Long case AifJobCtrScrubMirror: /* Container Scrub Mirror 413c6eafcf2SScott Long * operation */ 41435863739SMike Smith device_printf(sc->aac_dev, "(ConatainerScrubMirror) container %d\n", 41535863739SMike Smith aif->data.PR[0].jd.client.container.src); 41635863739SMike Smith break; 417c6eafcf2SScott Long case AifJobCtrRebuildRaid5: /* Container Rebuild Raid5 418c6eafcf2SScott Long * operation */ 419c6eafcf2SScott Long device_printf(sc->aac_dev, "(ConatainerRebuildRaid5) container " 420c6eafcf2SScott Long "%d\n", aif->data.PR[0].jd.client.container.src); 42135863739SMike Smith break; 422c6eafcf2SScott Long case AifJobCtrScrubRaid5: /* Container Scrub Raid5 423c6eafcf2SScott Long * operation */ 42435863739SMike Smith device_printf(sc->aac_dev, "(ConatainerScrubRaid5) container %d\n", 42535863739SMike Smith aif->data.PR[0].jd.client.container.src); 42635863739SMike Smith break; 42735863739SMike Smith case AifJobCtrMorph: /* Container morph operation */ 42835863739SMike Smith device_printf(sc->aac_dev, "(ConatainerMorph) container %d\n", 42935863739SMike Smith aif->data.PR[0].jd.client.container.src); 430c6eafcf2SScott Long /* XXX two containers? */ 431c6eafcf2SScott Long break; 432c6eafcf2SScott Long case AifJobCtrPartCopy: /* Container Partition copy 433c6eafcf2SScott Long * operation */ 434c6eafcf2SScott Long device_printf(sc->aac_dev, "(ConatainerPartCopy) container %d to " 435c6eafcf2SScott Long "%d\n", aif->data.PR[0].jd.client.container.src, 436c6eafcf2SScott Long aif->data.PR[0].jd.client.container.dst); 437c6eafcf2SScott Long break; 438c6eafcf2SScott Long case AifJobCtrRebuildMirror: /* Container Rebuild Mirror 439c6eafcf2SScott Long * operation */ 440c6eafcf2SScott Long device_printf(sc->aac_dev, "(ConatainerRebuildMirror) container " 441c6eafcf2SScott Long "%d\n", aif->data.PR[0].jd.client.container.src); 44235863739SMike Smith break; 44335863739SMike Smith case AifJobCtrCrazyCache: /* crazy cache */ 44435863739SMike Smith device_printf(sc->aac_dev, "(ConatainerCrazyCache) container %d\n", 445c6eafcf2SScott Long aif->data.PR[0].jd.client.container.src); 446c6eafcf2SScott Long /* XXX two containers? */ 44735863739SMike Smith break; 448c6eafcf2SScott Long case AifJobFsCreate: /* File System Create 449c6eafcf2SScott Long * operation */ 45035863739SMike Smith device_printf(sc->aac_dev, "(FsCreate)\n"); 45135863739SMike Smith break; 452c6eafcf2SScott Long case AifJobFsVerify: /* File System Verify 453c6eafcf2SScott Long * operation */ 45435863739SMike Smith device_printf(sc->aac_dev, "(FsVerivy)\n"); 45535863739SMike Smith break; 456c6eafcf2SScott Long case AifJobFsExtend: /* File System Extend 457c6eafcf2SScott Long * operation */ 45835863739SMike Smith device_printf(sc->aac_dev, "(FsExtend)\n"); 45935863739SMike Smith break; 46035863739SMike Smith case AifJobApiFormatNTFS: /* Format a drive to NTFS */ 46135863739SMike Smith device_printf(sc->aac_dev, "(FormatNTFS)\n"); 46235863739SMike Smith break; 46335863739SMike Smith case AifJobApiFormatFAT: /* Format a drive to FAT */ 46435863739SMike Smith device_printf(sc->aac_dev, "(FormatFAT)\n"); 46535863739SMike Smith break; 466c6eafcf2SScott Long case AifJobApiUpdateSnapshot: /* update the read/write half 467c6eafcf2SScott Long * of a snapshot */ 46835863739SMike Smith device_printf(sc->aac_dev, "(UpdateSnapshot)\n"); 46935863739SMike Smith break; 47035863739SMike Smith case AifJobApiFormatFAT32: /* Format a drive to FAT32 */ 47135863739SMike Smith device_printf(sc->aac_dev, "(FormatFAT32)\n"); 47235863739SMike Smith break; 47335863739SMike Smith case AifJobCtlContinuousCtrVerify: /* Adapter operation */ 47435863739SMike Smith device_printf(sc->aac_dev, "(ContinuousCtrVerify)\n"); 47535863739SMike Smith break; 47635863739SMike Smith default: 47735863739SMike Smith device_printf(sc->aac_dev, "(%d)\n", aif->data.PR[0].jd.type); 47835863739SMike Smith break; 47935863739SMike Smith } 48035863739SMike Smith break; 48135863739SMike Smith } 48235863739SMike Smith case AifCmdAPIReport: 48335863739SMike Smith device_printf(sc->aac_dev, "APIReport (%d)\n", aif->seqNumber); 48435863739SMike Smith break; 48535863739SMike Smith case AifCmdDriverNotify: 48635863739SMike Smith device_printf(sc->aac_dev, "DriverNotify (%d)\n", aif->seqNumber); 48735863739SMike Smith break; 48835863739SMike Smith default: 489c6eafcf2SScott Long device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command, 490c6eafcf2SScott Long aif->seqNumber); 49135863739SMike Smith break; 49235863739SMike Smith } 49335863739SMike Smith } 494f6c4dd3fSScott Long #endif /* AAC_DEBUG */ 495da4c1ce3SJustin T. Gibbs #endif 496