xref: /freebsd/sys/dev/aac/aac_debug.c (revision da4c1ce305b609ca61962f3861d640bf3fd0ed45)
135863739SMike Smith /*-
235863739SMike Smith  * Copyright (c) 2000 Michael Smith
335863739SMike Smith  * Copyright (c) 2000 BSDi
435863739SMike Smith  * All rights reserved.
535863739SMike Smith  *
635863739SMike Smith  * Redistribution and use in source and binary forms, with or without
735863739SMike Smith  * modification, are permitted provided that the following conditions
835863739SMike Smith  * are met:
935863739SMike Smith  * 1. Redistributions of source code must retain the above copyright
1035863739SMike Smith  *    notice, this list of conditions and the following disclaimer.
1135863739SMike Smith  * 2. Redistributions in binary form must reproduce the above copyright
1235863739SMike Smith  *    notice, this list of conditions and the following disclaimer in the
1335863739SMike Smith  *    documentation and/or other materials provided with the distribution.
1435863739SMike Smith  *
1535863739SMike Smith  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1635863739SMike Smith  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1735863739SMike Smith  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1835863739SMike Smith  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1935863739SMike Smith  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2035863739SMike Smith  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2135863739SMike Smith  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2235863739SMike Smith  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2335863739SMike Smith  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2435863739SMike Smith  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2535863739SMike Smith  * SUCH DAMAGE.
2635863739SMike Smith  *
2735863739SMike Smith  *	$FreeBSD$
2835863739SMike Smith  */
2935863739SMike Smith 
3035863739SMike Smith /*
3135863739SMike Smith  * Debugging support.
3235863739SMike Smith  */
3335863739SMike Smith 
3435863739SMike Smith #include <sys/param.h>
3535863739SMike Smith #include <sys/systm.h>
3635863739SMike Smith #include <sys/kernel.h>
3735863739SMike Smith 
3835863739SMike Smith #include <dev/aac/aac_compat.h>
3935863739SMike Smith #include <sys/bus.h>
4035863739SMike Smith #include <sys/devicestat.h>
4135863739SMike Smith #include <sys/disk.h>
4235863739SMike Smith 
4335863739SMike Smith #include <machine/resource.h>
4435863739SMike Smith #include <machine/bus.h>
4535863739SMike Smith 
4635863739SMike Smith #include <dev/aac/aacreg.h>
470b94a66eSMike Smith #include <dev/aac/aac_ioctl.h>
4835863739SMike Smith #include <dev/aac/aacvar.h>
4935863739SMike Smith 
50da4c1ce3SJustin T. Gibbs #ifdef AAC_DEBUG
5135863739SMike Smith void		aac_printstate0(void);
5235863739SMike Smith void		aac_intr0(void);
5335863739SMike Smith 
5435863739SMike Smith /********************************************************************************
5535863739SMike Smith  * Dump the command queue indices
5635863739SMike Smith  */
5735863739SMike Smith void
5835863739SMike Smith aac_print_queues(struct aac_softc *sc)
5935863739SMike Smith {
6035863739SMike Smith     device_printf(sc->aac_dev, "FIB queue header at %p  queues at %p\n",
6135863739SMike Smith 		  &sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0],
6235863739SMike Smith 		  &sc->aac_queues->qt_HostNormCmdQueue[0]);
6335863739SMike Smith     device_printf(sc->aac_dev, "HOST_NORM_CMD  %d/%d (%d)\n",
6435863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX],
6535863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX],
6635863739SMike Smith 		  AAC_HOST_NORM_CMD_ENTRIES);
6735863739SMike Smith     device_printf(sc->aac_dev, "HOST_HIGH_CMD  %d/%d (%d)\n",
6835863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX],
6935863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX],
7035863739SMike Smith 		  AAC_HOST_HIGH_CMD_ENTRIES);
7135863739SMike Smith     device_printf(sc->aac_dev, "ADAP_NORM_CMD  %d/%d (%d)\n",
7235863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX],
7335863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX],
7435863739SMike Smith 		  AAC_ADAP_NORM_CMD_ENTRIES);
7535863739SMike Smith     device_printf(sc->aac_dev, "ADAP_HIGH_CMD  %d/%d (%d)\n",
7635863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX],
7735863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX],
7835863739SMike Smith 		  AAC_ADAP_HIGH_CMD_ENTRIES);
7935863739SMike Smith     device_printf(sc->aac_dev, "HOST_NORM_RESP %d/%d (%d)\n",
8035863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX],
8135863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX],
8235863739SMike Smith 		  AAC_HOST_NORM_RESP_ENTRIES);
8335863739SMike Smith     device_printf(sc->aac_dev, "HOST_HIGH_RESP %d/%d (%d)\n",
8435863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX],
8535863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX],
8635863739SMike Smith 		  AAC_HOST_HIGH_RESP_ENTRIES);
8735863739SMike Smith     device_printf(sc->aac_dev, "ADAP_NORM_RESP %d/%d (%d)\n",
8835863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX],
8935863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX],
9035863739SMike Smith 		  AAC_ADAP_NORM_RESP_ENTRIES);
9135863739SMike Smith     device_printf(sc->aac_dev, "ADAP_HIGH_RESP %d/%d (%d)\n",
9235863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX],
9335863739SMike Smith 		  sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX],
9435863739SMike Smith 		  AAC_ADAP_HIGH_RESP_ENTRIES);
950b94a66eSMike Smith     device_printf(sc->aac_dev, "AACQ_FREE      %d/%d\n",
960b94a66eSMike Smith 		  sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max);
970b94a66eSMike Smith     device_printf(sc->aac_dev, "AACQ_BIO       %d/%d\n",
980b94a66eSMike Smith 		  sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max);
990b94a66eSMike Smith     device_printf(sc->aac_dev, "AACQ_READY     %d/%d\n",
1000b94a66eSMike Smith 		  sc->aac_qstat[AACQ_READY].q_length, sc->aac_qstat[AACQ_READY].q_max);
1010b94a66eSMike Smith     device_printf(sc->aac_dev, "AACQ_BUSY      %d/%d\n",
1020b94a66eSMike Smith 		  sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max);
1030b94a66eSMike Smith     device_printf(sc->aac_dev, "AACQ_COMPLETE  %d/%d\n",
1040b94a66eSMike Smith 		  sc->aac_qstat[AACQ_COMPLETE].q_length, sc->aac_qstat[AACQ_COMPLETE].q_max);
10535863739SMike Smith }
10635863739SMike Smith 
10735863739SMike Smith /********************************************************************************
10835863739SMike Smith  * Print the command queue states for controller 0 (callable from DDB)
10935863739SMike Smith  */
11035863739SMike Smith void
11135863739SMike Smith aac_printstate0(void)
11235863739SMike Smith {
11335863739SMike Smith     struct aac_softc	*sc = devclass_get_softc(aac_devclass, 0);
11435863739SMike Smith 
11535863739SMike Smith     aac_print_queues(sc);
11635863739SMike Smith     switch (sc->aac_hwif) {
11735863739SMike Smith     case AAC_HWIF_I960RX:
11835863739SMike Smith 	device_printf(sc->aac_dev, "IDBR 0x%08x  IIMR 0x%08x  IISR 0x%08x\n",
11935863739SMike Smith 		      AAC_GETREG4(sc, AAC_RX_IDBR), AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR));
12035863739SMike Smith 	device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  OISR 0x%08x\n",
12135863739SMike Smith 		      AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
12235863739SMike Smith 	AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY | AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
12335863739SMike Smith 	device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  OISR 0x%08x\n",
12435863739SMike Smith 		      AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
12535863739SMike Smith 	break;
12635863739SMike Smith     case AAC_HWIF_STRONGARM:
12735863739SMike Smith 	/* XXX implement */
12835863739SMike Smith     }
12935863739SMike Smith }
13035863739SMike Smith 
13135863739SMike Smith /********************************************************************************
13235863739SMike Smith  * simulate an interrupt for controller 0
13335863739SMike Smith  */
13435863739SMike Smith void
13535863739SMike Smith aac_intr0(void)
13635863739SMike Smith {
13735863739SMike Smith     struct aac_softc	*sc = devclass_get_softc(aac_devclass, 0);
13835863739SMike Smith 
13935863739SMike Smith     aac_intr(sc);
14035863739SMike Smith }
14135863739SMike Smith 
14235863739SMike Smith /********************************************************************************
14335863739SMike Smith  * Panic in a slightly informative fashion
14435863739SMike Smith  */
14535863739SMike Smith void
14635863739SMike Smith aac_panic(struct aac_softc *sc, char *reason)
14735863739SMike Smith {
14835863739SMike Smith     aac_print_queues(sc);
14935863739SMike Smith     panic(reason);
15035863739SMike Smith }
15135863739SMike Smith 
15235863739SMike Smith /********************************************************************************
15335863739SMike Smith  * Print a FIB
15435863739SMike Smith  */
15535863739SMike Smith void
15635863739SMike Smith aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller)
15735863739SMike Smith {
15835863739SMike Smith     device_printf(sc->aac_dev, "%s: FIB @ %p\n", caller, fib);
15935863739SMike Smith     device_printf(sc->aac_dev, "  XferState %b\n", fib->Header.XferState, "\20"
16035863739SMike Smith 		  "\1HOSTOWNED"
16135863739SMike Smith 		  "\2ADAPTEROWNED"
16235863739SMike Smith 		  "\3INITIALISED"
16335863739SMike Smith 		  "\4EMPTY"
16435863739SMike Smith 		  "\5FROMPOOL"
16535863739SMike Smith 		  "\6FROMHOST"
16635863739SMike Smith 		  "\7FROMADAP"
16735863739SMike Smith 		  "\10REXPECTED"
16835863739SMike Smith 		  "\11RNOTEXPECTED"
16935863739SMike Smith 		  "\12DONEADAP"
17035863739SMike Smith 		  "\13DONEHOST"
17135863739SMike Smith 		  "\14HIGH"
17235863739SMike Smith 		  "\15NORM"
17335863739SMike Smith 		  "\16ASYNC"
17435863739SMike Smith 		  "\17PAGEFILEIO"
17535863739SMike Smith 		  "\20SHUTDOWN"
17635863739SMike Smith 		  "\21LAZYWRITE"
17735863739SMike Smith 		  "\22ADAPMICROFIB"
17835863739SMike Smith 		  "\23BIOSFIB"
17935863739SMike Smith 		  "\24FAST_RESPONSE"
18035863739SMike Smith 		  "\25APIFIB\n");
18135863739SMike Smith     device_printf(sc->aac_dev, "  Command         %d\n", fib->Header.Command);
18235863739SMike Smith     device_printf(sc->aac_dev, "  StructType      %d\n", fib->Header.StructType);
18335863739SMike Smith     device_printf(sc->aac_dev, "  Flags           0x%x\n", fib->Header.Flags);
18435863739SMike Smith     device_printf(sc->aac_dev, "  Size            %d\n", fib->Header.Size);
18535863739SMike Smith     device_printf(sc->aac_dev, "  SenderSize      %d\n", fib->Header.SenderSize);
18635863739SMike Smith     device_printf(sc->aac_dev, "  SenderAddress   0x%x\n", fib->Header.SenderFibAddress);
18735863739SMike Smith     device_printf(sc->aac_dev, "  ReceiverAddress 0x%x\n", fib->Header.ReceiverFibAddress);
18835863739SMike Smith     device_printf(sc->aac_dev, "  SenderData      0x%x\n", fib->Header.SenderData);
18935863739SMike Smith     switch(fib->Header.Command) {
19035863739SMike Smith     case ContainerCommand:
19135863739SMike Smith     {
19235863739SMike Smith 	struct aac_blockread	*br = (struct aac_blockread *)fib->data;
19335863739SMike Smith 	struct aac_blockwrite	*bw = (struct aac_blockwrite *)fib->data;
19435863739SMike Smith 	struct aac_sg_table	*sg = NULL;
19535863739SMike Smith 	int			i;
19635863739SMike Smith 	if (br->Command == VM_CtBlockRead) {
19735863739SMike Smith 	    device_printf(sc->aac_dev, "  BlockRead: container %d  0x%x/%d\n",
19835863739SMike Smith 			  br->ContainerId, br->BlockNumber, br->ByteCount);
19935863739SMike Smith 	    sg = &br->SgMap;
20035863739SMike Smith 	}
20135863739SMike Smith 	if (bw->Command == VM_CtBlockWrite) {
20235863739SMike Smith 	    device_printf(sc->aac_dev, "  BlockWrite: container %d  0x%x/%d (%s)\n",
20335863739SMike Smith 			  bw->ContainerId, bw->BlockNumber, bw->ByteCount,
20435863739SMike Smith 			  bw->Stable == CSTABLE ? "stable" : "unstable");
20535863739SMike Smith 	    sg = &bw->SgMap;
20635863739SMike Smith 	}
20735863739SMike Smith 	if (sg != NULL) {
20835863739SMike Smith 	    device_printf(sc->aac_dev, "  %d s/g entries\n", sg->SgCount);
20935863739SMike Smith 	    for (i = 0; i < sg->SgCount; i++)
21035863739SMike Smith 		device_printf(sc->aac_dev, "  0x%08x/%d\n", sg->SgEntry[i].SgAddress, sg->SgEntry[i].SgByteCount);
21135863739SMike Smith 	}
21235863739SMike Smith 	break;
21335863739SMike Smith     }
21435863739SMike Smith     default:
21535863739SMike Smith 	device_printf(sc->aac_dev, "   %16D\n", fib->data, " ");
21635863739SMike Smith 	device_printf(sc->aac_dev, "   %16D\n", fib->data + 16, " ");
21735863739SMike Smith 	break;
21835863739SMike Smith     }
21935863739SMike Smith }
22035863739SMike Smith 
22135863739SMike Smith /********************************************************************************
22235863739SMike Smith  * Describe an AIF we have received.
22335863739SMike Smith  */
22435863739SMike Smith void
22535863739SMike Smith aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif)
22635863739SMike Smith {
22735863739SMike Smith     switch(aif->command) {
22835863739SMike Smith     case AifCmdEventNotify:
22935863739SMike Smith 	device_printf(sc->aac_dev, "EventNotify (%d)\n", aif->seqNumber);
23035863739SMike Smith 	switch(aif->data.EN.type) {
23135863739SMike Smith 	case AifEnGeneric:			/* Generic notification */
23235863739SMike Smith 	    device_printf(sc->aac_dev, "(Generic) %.*s\n",
23335863739SMike Smith 			  (int)sizeof(aif->data.EN.data.EG), aif->data.EN.data.EG.text);
23435863739SMike Smith 	    break;
23535863739SMike Smith 	case AifEnTaskComplete:			/* Task has completed */
23635863739SMike Smith 	    device_printf(sc->aac_dev, "(TaskComplete)\n");
23735863739SMike Smith 	    break;
23835863739SMike Smith 	case AifEnConfigChange:			/* Adapter configuration change occurred */
23935863739SMike Smith 	    device_printf(sc->aac_dev, "(ConfigChange)\n");
24035863739SMike Smith 	    break;
24135863739SMike Smith 	case AifEnContainerChange:		/* Adapter specific container configuration change */
24235863739SMike Smith 	    device_printf(sc->aac_dev, "(ContainerChange) container %d,%d\n",
24335863739SMike Smith 			  aif->data.EN.data.ECC.container[0],
24435863739SMike Smith 			  aif->data.EN.data.ECC.container[1]);
24535863739SMike Smith 	    break;
24635863739SMike Smith 	case AifEnDeviceFailure:		/* SCSI device failed */
24735863739SMike Smith 	    device_printf(sc->aac_dev, "(DeviceFailure) handle %d\n",
24835863739SMike Smith 			  aif->data.EN.data.EDF.deviceHandle);	/* XXX interpret */
24935863739SMike Smith 	    break;
25035863739SMike Smith 	case AifEnMirrorFailover:		/* Mirror failover started */
25135863739SMike Smith 	    device_printf(sc->aac_dev, "(MirrorFailover) container %d failed, migrating from slice %d to %d\n",
25235863739SMike Smith 			  aif->data.EN.data.EMF.container,
25335863739SMike Smith 			  aif->data.EN.data.EMF.failedSlice,
25435863739SMike Smith 			  aif->data.EN.data.EMF.creatingSlice);
25535863739SMike Smith 	    break;
25635863739SMike Smith 	case AifEnContainerEvent:		/* Significant container event */
25735863739SMike Smith 	    device_printf(sc->aac_dev, "(ContainerEvent) container %d event %d\n",
25835863739SMike Smith 			  aif->data.EN.data.ECE.container,
25935863739SMike Smith 			  aif->data.EN.data.ECE.eventType);		/* XXX interpret? */
26035863739SMike Smith 	    break;
26135863739SMike Smith 	case AifEnFileSystemChange:		/* File system changed */
26235863739SMike Smith 	    device_printf(sc->aac_dev, "(FileSystemChange)\n");
26335863739SMike Smith 	    break;
26435863739SMike Smith 	case AifEnConfigPause:			/* Container pause event */
26535863739SMike Smith 	    device_printf(sc->aac_dev, "(ConfigPause)\n");
26635863739SMike Smith 	    break;
26735863739SMike Smith 	case AifEnConfigResume:			/* Container resume event */
26835863739SMike Smith 	    device_printf(sc->aac_dev, "(ConfigResume)\n");
26935863739SMike Smith 	    break;
27035863739SMike Smith 	case AifEnFailoverChange:		/* Failover space assignment changed */
27135863739SMike Smith 	    device_printf(sc->aac_dev, "(FailoverChange)\n");
27235863739SMike Smith 	    break;
27335863739SMike Smith 	case AifEnRAID5RebuildDone:		/* RAID5 rebuild finished */
27435863739SMike Smith 	    device_printf(sc->aac_dev, "(RAID5RebuildDone)\n");
27535863739SMike Smith 	    break;
27635863739SMike Smith 	case AifEnEnclosureManagement:		/* Enclosure management event */
27735863739SMike Smith 	    device_printf(sc->aac_dev, "(EnclosureManagement) EMPID %d unit %d event %d\n",
27835863739SMike Smith 			  aif->data.EN.data.EEE.empID,
27935863739SMike Smith 			  aif->data.EN.data.EEE.unitID,
28035863739SMike Smith 			  aif->data.EN.data.EEE.eventType);
28135863739SMike Smith 	    break;
28235863739SMike Smith 	case AifEnBatteryEvent:			/* Significant NV battery event */
28335863739SMike Smith 	    device_printf(sc->aac_dev, "(BatteryEvent) %d (state was %d, is %d)\n",
28435863739SMike Smith 			  aif->data.EN.data.EBE.transition_type, 	/* XXX interpret */
28535863739SMike Smith 			  aif->data.EN.data.EBE.current_state,
28635863739SMike Smith 			  aif->data.EN.data.EBE.prior_state);
28735863739SMike Smith 	    break;
28835863739SMike Smith 	case AifEnAddContainer:			/* A new container was created. */
28935863739SMike Smith 	    device_printf(sc->aac_dev, "(AddContainer)\n");
29035863739SMike Smith 	    break;
29135863739SMike Smith 	case AifEnDeleteContainer:		/* A container was deleted. */
29235863739SMike Smith 	    device_printf(sc->aac_dev, "(DeleteContainer)\n");
29335863739SMike Smith 	    break;
29435863739SMike Smith 	case AifEnBatteryNeedsRecond:		/* The battery needs reconditioning */
29535863739SMike Smith 	    device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n");
29635863739SMike Smith 	    break;
29735863739SMike Smith 	case AifEnClusterEvent:			/* Some cluster event */
29835863739SMike Smith 	    device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
29935863739SMike Smith 			  aif->data.EN.data.ECLE.eventType);
30035863739SMike Smith 	    break;
30135863739SMike Smith 	case AifEnDiskSetEvent:			/* A disk set event occured. */
30235863739SMike Smith 	    device_printf(sc->aac_dev, "(DiskSetEvent) event %d diskset %lld creator %lld\n",
30335863739SMike Smith 			  aif->data.EN.data.EDS.eventType,
30435863739SMike Smith 			  aif->data.EN.data.EDS.DsNum,
30535863739SMike Smith 			  aif->data.EN.data.EDS.CreatorId);
30635863739SMike Smith 	    break;
30735863739SMike Smith 	case AifDenMorphComplete: 		/* A morph operation completed */
30835863739SMike Smith 	    device_printf(sc->aac_dev, "(MorphComplete)\n");
30935863739SMike Smith 	    break;
31035863739SMike Smith 	case AifDenVolumeExtendComplete: 		/* A volume expand operation completed */
31135863739SMike Smith 	    device_printf(sc->aac_dev, "(VolumeExtendComplete)\n");
31235863739SMike Smith 	    break;
31335863739SMike Smith 	default:
31435863739SMike Smith 	    device_printf(sc->aac_dev, "(%d)\n", aif->data.EN.type);
31535863739SMike Smith 	    break;
31635863739SMike Smith 	}
31735863739SMike Smith 	break;
31835863739SMike Smith     case AifCmdJobProgress:
31935863739SMike Smith     {
32035863739SMike Smith 	char	*status;
32135863739SMike Smith 	switch(aif->data.PR[0].status) {
32235863739SMike Smith 	case AifJobStsSuccess:
32335863739SMike Smith 	    status = "success"; break;
32435863739SMike Smith 	case AifJobStsFinished:
32535863739SMike Smith 	    status = "finished"; break;
32635863739SMike Smith 	case AifJobStsAborted:
32735863739SMike Smith 	    status = "aborted"; break;
32835863739SMike Smith 	case AifJobStsFailed:
32935863739SMike Smith 	    status = "failed"; break;
33035863739SMike Smith 	case AifJobStsSuspended:
33135863739SMike Smith 	    status = "suspended"; break;
33235863739SMike Smith 	case AifJobStsRunning:
33335863739SMike Smith 	    status = "running"; break;
33435863739SMike Smith 	default:
33535863739SMike Smith 	    status = "unknown status"; break;
33635863739SMike Smith 	}
33735863739SMike Smith 
33835863739SMike Smith 	device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n", aif->seqNumber, status,
33935863739SMike Smith 		      aif->data.PR[0].currentTick, aif->data.PR[0].finalTick);
34035863739SMike Smith 	switch(aif->data.PR[0].jd.type) {
34135863739SMike Smith 	case AifJobScsiZero:			/* SCSI device clear operation */
34235863739SMike Smith 	    device_printf(sc->aac_dev, "(ScsiZero) handle %d\n", aif->data.PR[0].jd.client.scsi_dh);
34335863739SMike Smith 	    break;
34435863739SMike Smith 	case AifJobScsiVerify:			/* SCSI device Verify operation NO REPAIR */
34535863739SMike Smith 	    device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n", aif->data.PR[0].jd.client.scsi_dh);
34635863739SMike Smith 	    break;
34735863739SMike Smith 	case AifJobScsiExercise:		/* SCSI device Exercise operation */
34835863739SMike Smith 	    device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n", aif->data.PR[0].jd.client.scsi_dh);
34935863739SMike Smith 	    break;
35035863739SMike Smith 	case AifJobScsiVerifyRepair:		/* SCSI device Verify operation WITH repair */
35135863739SMike Smith 	    device_printf(sc->aac_dev, "(ScsiVerifyRepair) handle %d\n", aif->data.PR[0].jd.client.scsi_dh);
35235863739SMike Smith 	    break;
35335863739SMike Smith 	case AifJobCtrZero:			/* Container clear operation */
35435863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerZero) container %d\n",
35535863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);
35635863739SMike Smith 	    break;
35735863739SMike Smith 	case AifJobCtrCopy:			/* Container copy operation */
35835863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerCopy) container %d to %d\n",
35935863739SMike Smith 			  aif->data.PR[0].jd.client.container.src, aif->data.PR[0].jd.client.container.dst);
36035863739SMike Smith 	    break;
36135863739SMike Smith 	case AifJobCtrCreateMirror:		/* Container Create Mirror operation */
36235863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerCreateMirror) container %d\n",
36335863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);	/* XXX two containers? */
36435863739SMike Smith 	    break;
36535863739SMike Smith 	case AifJobCtrMergeMirror:		/* Container Merge Mirror operation */
36635863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerMergeMirror) container %d\n",
36735863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);	/* XXX two containers? */
36835863739SMike Smith 	    break;
36935863739SMike Smith 	case AifJobCtrScrubMirror:		/* Container Scrub Mirror operation */
37035863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerScrubMirror) container %d\n",
37135863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);
37235863739SMike Smith 	    break;
37335863739SMike Smith 	case AifJobCtrRebuildRaid5:		/* Container Rebuild Raid5 operation */
37435863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerRebuildRaid5) container %d\n",
37535863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);
37635863739SMike Smith 	    break;
37735863739SMike Smith 	case AifJobCtrScrubRaid5:		/* Container Scrub Raid5 operation */
37835863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerScrubRaid5) container %d\n",
37935863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);
38035863739SMike Smith 	    break;
38135863739SMike Smith 	case AifJobCtrMorph:			/* Container morph operation */
38235863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerMorph) container %d\n",
38335863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);	/* XXX two containers? */
38435863739SMike Smith 	    break;
38535863739SMike Smith 	case AifJobCtrPartCopy:			/* Container Partition copy operation */
38635863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerPartCopy) container %d to %d\n",
38735863739SMike Smith 			  aif->data.PR[0].jd.client.container.src, aif->data.PR[0].jd.client.container.dst);
38835863739SMike Smith 	    break;
38935863739SMike Smith 	case AifJobCtrRebuildMirror:		/* Container Rebuild Mirror operation */
39035863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerRebuildMirror) container %d\n",
39135863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);
39235863739SMike Smith 	    break;
39335863739SMike Smith 	case AifJobCtrCrazyCache:		/* crazy cache */
39435863739SMike Smith 	    device_printf(sc->aac_dev, "(ConatainerCrazyCache) container %d\n",
39535863739SMike Smith 			  aif->data.PR[0].jd.client.container.src);	/* XXX two containers? */
39635863739SMike Smith 	    break;
39735863739SMike Smith 	case AifJobFsCreate:			/* File System Create operation */
39835863739SMike Smith 	    device_printf(sc->aac_dev, "(FsCreate)\n");
39935863739SMike Smith 	    break;
40035863739SMike Smith 	case AifJobFsVerify:			/* File System Verify operation */
40135863739SMike Smith 	    device_printf(sc->aac_dev, "(FsVerivy)\n");
40235863739SMike Smith 	    break;
40335863739SMike Smith 	case AifJobFsExtend:			/* File System Extend operation */
40435863739SMike Smith 	    device_printf(sc->aac_dev, "(FsExtend)\n");
40535863739SMike Smith 	    break;
40635863739SMike Smith 	case AifJobApiFormatNTFS:		/* Format a drive to NTFS */
40735863739SMike Smith 	    device_printf(sc->aac_dev, "(FormatNTFS)\n");
40835863739SMike Smith 	    break;
40935863739SMike Smith 	case AifJobApiFormatFAT:		/* Format a drive to FAT */
41035863739SMike Smith 	    device_printf(sc->aac_dev, "(FormatFAT)\n");
41135863739SMike Smith 	    break;
41235863739SMike Smith 	case AifJobApiUpdateSnapshot:		/* update the read/write half of a snapshot */
41335863739SMike Smith 	    device_printf(sc->aac_dev, "(UpdateSnapshot)\n");
41435863739SMike Smith 	    break;
41535863739SMike Smith 	case AifJobApiFormatFAT32:		/* Format a drive to FAT32 */
41635863739SMike Smith 	    device_printf(sc->aac_dev, "(FormatFAT32)\n");
41735863739SMike Smith 	    break;
41835863739SMike Smith 	case AifJobCtlContinuousCtrVerify:	/* Adapter operation */
41935863739SMike Smith 	    device_printf(sc->aac_dev, "(ContinuousCtrVerify)\n");
42035863739SMike Smith 	    break;
42135863739SMike Smith 	default:
42235863739SMike Smith 	    device_printf(sc->aac_dev, "(%d)\n", aif->data.PR[0].jd.type);
42335863739SMike Smith 	    break;
42435863739SMike Smith 	}
42535863739SMike Smith 	break;
42635863739SMike Smith     }
42735863739SMike Smith     case AifCmdAPIReport:
42835863739SMike Smith 	device_printf(sc->aac_dev, "APIReport (%d)\n", aif->seqNumber);
42935863739SMike Smith 	break;
43035863739SMike Smith     case AifCmdDriverNotify:
43135863739SMike Smith 	device_printf(sc->aac_dev, "DriverNotify (%d)\n", aif->seqNumber);
43235863739SMike Smith 	break;
43335863739SMike Smith     default:
43435863739SMike Smith 	device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command, aif->seqNumber);
43535863739SMike Smith 	break;
43635863739SMike Smith     }
43735863739SMike Smith }
438da4c1ce3SJustin T. Gibbs #endif
439