xref: /freebsd/sys/dev/aac/aac_debug.c (revision 70148712be48a71af2372a7f96fc3959cf1cfba9)
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 
3735863739SMike Smith #include <sys/param.h>
3835863739SMike Smith #include <sys/systm.h>
3935863739SMike Smith #include <sys/kernel.h>
4035863739SMike Smith 
4135863739SMike Smith #include <dev/aac/aac_compat.h>
4235863739SMike Smith #include <sys/bus.h>
4335863739SMike Smith #include <sys/devicestat.h>
4435863739SMike Smith #include <sys/disk.h>
4535863739SMike Smith 
4635863739SMike Smith #include <machine/resource.h>
4735863739SMike Smith #include <machine/bus.h>
4835863739SMike Smith 
4935863739SMike Smith #include <dev/aac/aacreg.h>
500b94a66eSMike Smith #include <dev/aac/aac_ioctl.h>
5135863739SMike Smith #include <dev/aac/aacvar.h>
5235863739SMike Smith 
53da4c1ce3SJustin T. Gibbs #ifdef AAC_DEBUG
5435863739SMike Smith void	aac_printstate0(void);
5535863739SMike Smith void	aac_intr0(void);
5635863739SMike Smith 
57914da7d0SScott Long /*
5835863739SMike Smith  * Dump the command queue indices
5935863739SMike Smith  */
6035863739SMike Smith void
6135863739SMike Smith aac_print_queues(struct aac_softc *sc)
6235863739SMike Smith {
6335863739SMike Smith 	device_printf(sc->aac_dev, "FIB queue header at %p  queues at %p\n",
6435863739SMike Smith 	    &sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0],
6535863739SMike Smith 	    &sc->aac_queues->qt_HostNormCmdQueue[0]);
6635863739SMike Smith 	device_printf(sc->aac_dev, "HOST_NORM_CMD  %d/%d (%d)\n",
67914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][
68914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
69914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][
70914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
7135863739SMike Smith 	    AAC_HOST_NORM_CMD_ENTRIES);
7235863739SMike Smith 	device_printf(sc->aac_dev, "HOST_HIGH_CMD  %d/%d (%d)\n",
73914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][
74914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
75914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][
76914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
7735863739SMike Smith 	    AAC_HOST_HIGH_CMD_ENTRIES);
7835863739SMike Smith 	device_printf(sc->aac_dev, "ADAP_NORM_CMD  %d/%d (%d)\n",
79914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][
80914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
81914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][
82914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
8335863739SMike Smith 	    AAC_ADAP_NORM_CMD_ENTRIES);
8435863739SMike Smith 	device_printf(sc->aac_dev, "ADAP_HIGH_CMD  %d/%d (%d)\n",
85914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][
86914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
87914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][
88914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
8935863739SMike Smith 	    AAC_ADAP_HIGH_CMD_ENTRIES);
9035863739SMike Smith 	device_printf(sc->aac_dev, "HOST_NORM_RESP %d/%d (%d)\n",
91914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][
92914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
93914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][
94914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
9535863739SMike Smith 	    AAC_HOST_NORM_RESP_ENTRIES);
9635863739SMike Smith 	device_printf(sc->aac_dev, "HOST_HIGH_RESP %d/%d (%d)\n",
97914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][
98914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
99914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][
100914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
10135863739SMike Smith 	    AAC_HOST_HIGH_RESP_ENTRIES);
10235863739SMike Smith 	device_printf(sc->aac_dev, "ADAP_NORM_RESP %d/%d (%d)\n",
103914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][
104914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
105914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][
106914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
10735863739SMike Smith 	    AAC_ADAP_NORM_RESP_ENTRIES);
10835863739SMike Smith 	device_printf(sc->aac_dev, "ADAP_HIGH_RESP %d/%d (%d)\n",
109914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][
110914da7d0SScott Long 				      AAC_PRODUCER_INDEX],
111914da7d0SScott Long 	    sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][
112914da7d0SScott Long 				      AAC_CONSUMER_INDEX],
11335863739SMike Smith 	    AAC_ADAP_HIGH_RESP_ENTRIES);
1140b94a66eSMike Smith 	device_printf(sc->aac_dev, "AACQ_FREE      %d/%d\n",
1150b94a66eSMike Smith 	    sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max);
1160b94a66eSMike Smith 	device_printf(sc->aac_dev, "AACQ_BIO       %d/%d\n",
1170b94a66eSMike Smith 	    sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max);
1180b94a66eSMike Smith 	device_printf(sc->aac_dev, "AACQ_READY     %d/%d\n",
119914da7d0SScott Long 	    sc->aac_qstat[AACQ_READY].q_length,
120914da7d0SScott Long 	    sc->aac_qstat[AACQ_READY].q_max);
1210b94a66eSMike Smith 	device_printf(sc->aac_dev, "AACQ_BUSY      %d/%d\n",
1220b94a66eSMike Smith 	    sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max);
1230b94a66eSMike Smith 	device_printf(sc->aac_dev, "AACQ_COMPLETE  %d/%d\n",
124c6eafcf2SScott Long 	    sc->aac_qstat[AACQ_COMPLETE].q_length,
125c6eafcf2SScott Long 	    sc->aac_qstat[AACQ_COMPLETE].q_max);
12635863739SMike Smith }
12735863739SMike Smith 
128914da7d0SScott Long /*
12935863739SMike Smith  * Print the command queue states for controller 0 (callable from DDB)
13035863739SMike Smith  */
13135863739SMike Smith void
13235863739SMike Smith aac_printstate0(void)
13335863739SMike Smith {
134914da7d0SScott Long 	struct aac_softc *sc;
135914da7d0SScott Long 
136e45bef2aSMike Smith 	sc = devclass_get_softc(devclass_find("aac"), 0);
13735863739SMike Smith 
13835863739SMike Smith 	aac_print_queues(sc);
13935863739SMike Smith 	switch (sc->aac_hwif) {
14035863739SMike Smith 	case AAC_HWIF_I960RX:
141914da7d0SScott Long 		device_printf(sc->aac_dev, "IDBR 0x%08x  IIMR 0x%08x  "
142914da7d0SScott Long 		    "IISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_IDBR),
143914da7d0SScott Long 		    AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR));
144914da7d0SScott Long 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
145914da7d0SScott Long 		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
146914da7d0SScott Long 		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
147c6eafcf2SScott Long 		AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
148c6eafcf2SScott Long 			    AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
149914da7d0SScott Long 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
150914da7d0SScott Long 		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
151914da7d0SScott Long 		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
15235863739SMike Smith 		break;
15335863739SMike Smith 	case AAC_HWIF_STRONGARM:
15435863739SMike Smith 		/* XXX implement */
15535863739SMike Smith 	}
15635863739SMike Smith }
15735863739SMike Smith 
158914da7d0SScott Long /*
15935863739SMike Smith  * simulate an interrupt for controller 0
16035863739SMike Smith  */
16135863739SMike Smith void
16235863739SMike Smith aac_intr0(void)
16335863739SMike Smith {
164914da7d0SScott Long 	struct aac_softc *sc;
165914da7d0SScott Long 
166e45bef2aSMike Smith 	sc = devclass_get_softc(devclass_find("aac"), 0);
16735863739SMike Smith 
16835863739SMike Smith 	aac_intr(sc);
16935863739SMike Smith }
17035863739SMike Smith 
171914da7d0SScott Long /*
17235863739SMike Smith  * Panic in a slightly informative fashion
17335863739SMike Smith  */
17435863739SMike Smith void
17535863739SMike Smith aac_panic(struct aac_softc *sc, char *reason)
17635863739SMike Smith {
17735863739SMike Smith 	aac_print_queues(sc);
17835863739SMike Smith 	panic(reason);
17935863739SMike Smith }
18035863739SMike Smith 
181914da7d0SScott Long /*
18235863739SMike Smith  * Print a FIB
18335863739SMike Smith  */
18435863739SMike Smith void
18570148712SPeter Wemm aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, const char *caller)
18635863739SMike Smith {
18735863739SMike Smith 	device_printf(sc->aac_dev, "%s: FIB @ %p\n", caller, fib);
188914da7d0SScott Long 	device_printf(sc->aac_dev, "  XferState %b\n", fib->Header.XferState,
189914da7d0SScott Long 		      "\20"
19035863739SMike Smith 		      "\1HOSTOWNED"
19135863739SMike Smith 		      "\2ADAPTEROWNED"
19235863739SMike Smith 		      "\3INITIALISED"
19335863739SMike Smith 		      "\4EMPTY"
19435863739SMike Smith 		      "\5FROMPOOL"
19535863739SMike Smith 		      "\6FROMHOST"
19635863739SMike Smith 		      "\7FROMADAP"
19735863739SMike Smith 		      "\10REXPECTED"
19835863739SMike Smith 		      "\11RNOTEXPECTED"
19935863739SMike Smith 		      "\12DONEADAP"
20035863739SMike Smith 		      "\13DONEHOST"
20135863739SMike Smith 		      "\14HIGH"
20235863739SMike Smith 		      "\15NORM"
20335863739SMike Smith 		      "\16ASYNC"
20435863739SMike Smith 		      "\17PAGEFILEIO"
20535863739SMike Smith 		      "\20SHUTDOWN"
20635863739SMike Smith 		      "\21LAZYWRITE"
20735863739SMike Smith 		      "\22ADAPMICROFIB"
20835863739SMike Smith 		      "\23BIOSFIB"
20935863739SMike Smith 		      "\24FAST_RESPONSE"
21035863739SMike Smith 		      "\25APIFIB\n");
21135863739SMike Smith 	device_printf(sc->aac_dev, "  Command       %d\n", fib->Header.Command);
212c6eafcf2SScott Long 	device_printf(sc->aac_dev, "  StructType    %d\n",
213c6eafcf2SScott Long 		      fib->Header.StructType);
21435863739SMike Smith 	device_printf(sc->aac_dev, "  Flags         0x%x\n", fib->Header.Flags);
21535863739SMike Smith 	device_printf(sc->aac_dev, "  Size          %d\n", fib->Header.Size);
216b3457b51SScott Long 	device_printf(sc->aac_dev, "  SenderSize    %d\n",
217c6eafcf2SScott Long 		      fib->Header.SenderSize);
218c6eafcf2SScott Long 	device_printf(sc->aac_dev, "  SenderAddress 0x%x\n",
219c6eafcf2SScott Long 		      fib->Header.SenderFibAddress);
220914da7d0SScott Long 	device_printf(sc->aac_dev, "  RcvrAddress   0x%x\n",
221c6eafcf2SScott Long 		      fib->Header.ReceiverFibAddress);
222c6eafcf2SScott Long 	device_printf(sc->aac_dev, "  SenderData    0x%x\n",
223c6eafcf2SScott Long 		      fib->Header.SenderData);
22435863739SMike Smith 	switch(fib->Header.Command) {
22535863739SMike Smith 	case ContainerCommand:
22635863739SMike Smith 	{
227914da7d0SScott Long 		struct aac_blockread *br;
228b3457b51SScott Long 		struct aac_blockwrite *bw;
229914da7d0SScott Long 		struct aac_sg_table *sg;
23035863739SMike Smith 		int i;
231914da7d0SScott Long 
232914da7d0SScott Long 		br = (struct aac_blockread*)fib->data;
233914da7d0SScott Long 		bw = (struct aac_blockwrite*)fib->data;
234914da7d0SScott Long 		sg = NULL;
235914da7d0SScott Long 
23635863739SMike Smith 		if (br->Command == VM_CtBlockRead) {
237914da7d0SScott Long 			device_printf(sc->aac_dev,
238914da7d0SScott Long 				      "  BlockRead: container %d  0x%x/%d\n",
239914da7d0SScott Long 				      br->ContainerId, br->BlockNumber,
240914da7d0SScott Long 				      br->ByteCount);
24135863739SMike Smith 			sg = &br->SgMap;
24235863739SMike Smith 		}
24335863739SMike Smith 		if (bw->Command == VM_CtBlockWrite) {
244914da7d0SScott Long 			device_printf(sc->aac_dev,
245914da7d0SScott Long 				      "  BlockWrite: container %d  0x%x/%d "
246914da7d0SScott Long 				      "(%s)\n", bw->ContainerId,
247914da7d0SScott Long 				      bw->BlockNumber, bw->ByteCount,
248914da7d0SScott Long 				      bw->Stable == CSTABLE ? "stable" :
249c6eafcf2SScott Long 				      "unstable");
25035863739SMike Smith 			sg = &bw->SgMap;
25135863739SMike Smith 		}
25235863739SMike Smith 		if (sg != NULL) {
253914da7d0SScott Long 			device_printf(sc->aac_dev,
254914da7d0SScott Long 				      "  %d s/g entries\n", sg->SgCount);
25535863739SMike Smith 			for (i = 0; i < sg->SgCount; i++)
256c6eafcf2SScott Long 				device_printf(sc->aac_dev, "  0x%08x/%d\n",
257c6eafcf2SScott Long 					      sg->SgEntry[i].SgAddress,
258c6eafcf2SScott Long 					      sg->SgEntry[i].SgByteCount);
25935863739SMike Smith 		}
26035863739SMike Smith 		break;
26135863739SMike Smith 	}
26235863739SMike Smith 	default:
26335863739SMike Smith 		device_printf(sc->aac_dev, "   %16D\n", fib->data, " ");
26435863739SMike Smith 		device_printf(sc->aac_dev, "   %16D\n", fib->data + 16, " ");
26535863739SMike Smith 		break;
26635863739SMike Smith 	}
26735863739SMike Smith }
26835863739SMike Smith 
269914da7d0SScott Long /*
27035863739SMike Smith  * Describe an AIF we have received.
27135863739SMike Smith  */
27235863739SMike Smith void
27335863739SMike Smith aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif)
27435863739SMike Smith {
27535863739SMike Smith 	switch(aif->command) {
27635863739SMike Smith 	case AifCmdEventNotify:
27735863739SMike Smith 		device_printf(sc->aac_dev, "EventNotify(%d)\n", aif->seqNumber);
27835863739SMike Smith 		switch(aif->data.EN.type) {
27935863739SMike Smith 		case AifEnGeneric:		/* Generic notification */
28035863739SMike Smith 			device_printf(sc->aac_dev, "(Generic) %.*s\n",
281c6eafcf2SScott Long 				  (int)sizeof(aif->data.EN.data.EG),
282c6eafcf2SScott Long 				  aif->data.EN.data.EG.text);
28335863739SMike Smith 			break;
28435863739SMike Smith 		case AifEnTaskComplete:		/* Task has completed */
28535863739SMike Smith 			device_printf(sc->aac_dev, "(TaskComplete)\n");
28635863739SMike Smith 			break;
287c6eafcf2SScott Long 		case AifEnConfigChange:		/* Adapter configuration change
288c6eafcf2SScott Long 						 * occurred */
28935863739SMike Smith 			device_printf(sc->aac_dev, "(ConfigChange)\n");
29035863739SMike Smith 			break;
291c6eafcf2SScott Long 		case AifEnContainerChange:	/* Adapter specific container
292c6eafcf2SScott Long 						 * configuration change */
293914da7d0SScott Long 			device_printf(sc->aac_dev, "(ContainerChange) "
294914da7d0SScott Long 				      "container %d,%d\n",
29535863739SMike Smith 				      aif->data.EN.data.ECC.container[0],
29635863739SMike Smith 				      aif->data.EN.data.ECC.container[1]);
29735863739SMike Smith 			break;
29835863739SMike Smith 		case AifEnDeviceFailure:	/* SCSI device failed */
299914da7d0SScott Long 			device_printf(sc->aac_dev, "(DeviceFailure) "
300914da7d0SScott Long 				      "handle %d\n",
301914da7d0SScott Long 				      aif->data.EN.data.EDF.deviceHandle);
30235863739SMike Smith 			break;
30335863739SMike Smith 		case AifEnMirrorFailover:	/* Mirror failover started */
304914da7d0SScott Long 			device_printf(sc->aac_dev, "(MirrorFailover) "
305914da7d0SScott Long 				      "container %d failed, "
306c6eafcf2SScott Long 				      "migrating from slice %d to %d\n",
30735863739SMike Smith 				      aif->data.EN.data.EMF.container,
30835863739SMike Smith 				      aif->data.EN.data.EMF.failedSlice,
30935863739SMike Smith 				      aif->data.EN.data.EMF.creatingSlice);
31035863739SMike Smith 			break;
311c6eafcf2SScott Long 		case AifEnContainerEvent:	/* Significant container
312c6eafcf2SScott Long 						 * event */
313914da7d0SScott Long 			device_printf(sc->aac_dev, "(ContainerEvent) "
314914da7d0SScott Long 				      "container %d event "
315c6eafcf2SScott Long 				      "%d\n", aif->data.EN.data.ECE.container,
316914da7d0SScott Long 				      aif->data.EN.data.ECE.eventType);
31735863739SMike Smith 			break;
31835863739SMike Smith 		case AifEnFileSystemChange:	/* File system changed */
31935863739SMike Smith 			device_printf(sc->aac_dev, "(FileSystemChange)\n");
32035863739SMike Smith 			break;
32135863739SMike Smith 		case AifEnConfigPause:		/* Container pause event */
32235863739SMike Smith 			device_printf(sc->aac_dev, "(ConfigPause)\n");
32335863739SMike Smith 			break;
32435863739SMike Smith 		case AifEnConfigResume:		/* Container resume event */
32535863739SMike Smith 			device_printf(sc->aac_dev, "(ConfigResume)\n");
32635863739SMike Smith 			break;
327c6eafcf2SScott Long 		case AifEnFailoverChange:	/* Failover space assignment
328c6eafcf2SScott Long 						 * changed */
32935863739SMike Smith 			device_printf(sc->aac_dev, "(FailoverChange)\n");
33035863739SMike Smith 			break;
33135863739SMike Smith 		case AifEnRAID5RebuildDone:	/* RAID5 rebuild finished */
33235863739SMike Smith 			device_printf(sc->aac_dev, "(RAID5RebuildDone)\n");
33335863739SMike Smith 			break;
33435863739SMike Smith 		case AifEnEnclosureManagement:	/* Enclosure management event */
335914da7d0SScott Long 			device_printf(sc->aac_dev, "(EnclosureManagement) "
336914da7d0SScott Long 				      "EMPID %d unit %d "
337c6eafcf2SScott Long 				      "event %d\n", aif->data.EN.data.EEE.empID,
33835863739SMike Smith 				      aif->data.EN.data.EEE.unitID,
33935863739SMike Smith 				      aif->data.EN.data.EEE.eventType);
34035863739SMike Smith 			break;
341c6eafcf2SScott Long 		case AifEnBatteryEvent:		/* Significant NV battery
342c6eafcf2SScott Long 						 * event */
343914da7d0SScott Long 			device_printf(sc->aac_dev, "(BatteryEvent) %d "
344914da7d0SScott Long 				      "(state was %d, is %d\n",
345914da7d0SScott Long 				      aif->data.EN.data.EBE.transition_type,
346914da7d0SScott Long 				      aif->data.EN.data.EBE.current_state,
347914da7d0SScott Long 				      aif->data.EN.data.EBE.prior_state);
34835863739SMike Smith 			break;
349c6eafcf2SScott Long 		case AifEnAddContainer:		/* A new container was
350c6eafcf2SScott Long 						 * created. */
35135863739SMike Smith 			device_printf(sc->aac_dev, "(AddContainer)\n");
35235863739SMike Smith 			break;
35335863739SMike Smith 		case AifEnDeleteContainer:	/* A container was deleted. */
35435863739SMike Smith 			device_printf(sc->aac_dev, "(DeleteContainer)\n");
35535863739SMike Smith 			break;
356c6eafcf2SScott Long 		case AifEnBatteryNeedsRecond:	/* The battery needs
357c6eafcf2SScott Long 						 * reconditioning */
35835863739SMike Smith 			device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n");
35935863739SMike Smith 			break;
36035863739SMike Smith 		case AifEnClusterEvent:		/* Some cluster event */
36135863739SMike Smith 			device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
36235863739SMike Smith 				      aif->data.EN.data.ECLE.eventType);
36335863739SMike Smith 			break;
36435863739SMike Smith 		case AifEnDiskSetEvent:		/* A disk set event occured. */
365914da7d0SScott Long 			device_printf(sc->aac_dev, "(DiskSetEvent) event %d "
366914da7d0SScott Long 				      "diskset %lld creator %lld\n",
367914da7d0SScott Long 				      aif->data.EN.data.EDS.eventType,
36835863739SMike Smith 				      aif->data.EN.data.EDS.DsNum,
36935863739SMike Smith 				      aif->data.EN.data.EDS.CreatorId);
37035863739SMike Smith 			break;
371c6eafcf2SScott Long 		case AifDenMorphComplete: 	/* A morph operation
372c6eafcf2SScott Long 						 * completed */
37335863739SMike Smith 			device_printf(sc->aac_dev, "(MorphComplete)\n");
37435863739SMike Smith 			break;
375c6eafcf2SScott Long 		case AifDenVolumeExtendComplete: /* A volume expand operation
376c6eafcf2SScott Long 						  * completed */
37735863739SMike Smith 			device_printf(sc->aac_dev, "(VolumeExtendComplete)\n");
37835863739SMike Smith 			break;
37935863739SMike Smith 		default:
38035863739SMike Smith 			device_printf(sc->aac_dev, "(%d)\n", aif->data.EN.type);
38135863739SMike Smith 			break;
38235863739SMike Smith 		}
38335863739SMike Smith 		break;
38435863739SMike Smith 	case AifCmdJobProgress:
38535863739SMike Smith 	{
38635863739SMike Smith 		char	*status;
38735863739SMike Smith 		switch(aif->data.PR[0].status) {
38835863739SMike Smith 		case AifJobStsSuccess:
38935863739SMike Smith 			status = "success"; break;
39035863739SMike Smith 		case AifJobStsFinished:
39135863739SMike Smith 			status = "finished"; break;
39235863739SMike Smith 		case AifJobStsAborted:
39335863739SMike Smith 			status = "aborted"; break;
39435863739SMike Smith 		case AifJobStsFailed:
39535863739SMike Smith 			status = "failed"; break;
39635863739SMike Smith 		case AifJobStsSuspended:
39735863739SMike Smith 			status = "suspended"; break;
39835863739SMike Smith 		case AifJobStsRunning:
39935863739SMike Smith 			status = "running"; break;
40035863739SMike Smith 		default:
40135863739SMike Smith 			status = "unknown status"; break;
40235863739SMike Smith 		}
40335863739SMike Smith 
404c6eafcf2SScott Long 		device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n",
405914da7d0SScott Long 			      aif->seqNumber, status,
406914da7d0SScott Long 			      aif->data.PR[0].currentTick,
407c6eafcf2SScott Long 			      aif->data.PR[0].finalTick);
40835863739SMike Smith 		switch(aif->data.PR[0].jd.type) {
409c6eafcf2SScott Long 		case AifJobScsiZero:		/* SCSI dev clear operation */
410c6eafcf2SScott Long 			device_printf(sc->aac_dev, "(ScsiZero) handle %d\n",
411c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
41235863739SMike Smith 			break;
413c6eafcf2SScott Long 		case AifJobScsiVerify:		/* SCSI device Verify operation
414c6eafcf2SScott Long 						 * NO REPAIR */
415c6eafcf2SScott Long 			device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n",
416c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
41735863739SMike Smith 			break;
418c6eafcf2SScott Long 		case AifJobScsiExercise:	/* SCSI device Exercise
419c6eafcf2SScott Long 						 * operation */
420c6eafcf2SScott Long 			device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n",
421c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
42235863739SMike Smith 			break;
423c6eafcf2SScott Long 		case AifJobScsiVerifyRepair:	/* SCSI device Verify operation
424c6eafcf2SScott Long 						 * WITH repair */
425914da7d0SScott Long 			device_printf(sc->aac_dev,
426914da7d0SScott Long 				      "(ScsiVerifyRepair) handle %d\n",
427c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
42835863739SMike Smith 			break;
42935863739SMike Smith 		case AifJobCtrZero:		/* Container clear operation */
430914da7d0SScott Long 			device_printf(sc->aac_dev,
431914da7d0SScott Long 				      "(ConatainerZero) container %d\n",
43235863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
43335863739SMike Smith 			break;
43435863739SMike Smith 		case AifJobCtrCopy:		/* Container copy operation */
435914da7d0SScott Long 			device_printf(sc->aac_dev,
436914da7d0SScott Long 				      "(ConatainerCopy) container %d to %d\n",
437c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.src,
438c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.dst);
43935863739SMike Smith 			break;
440c6eafcf2SScott Long 		case AifJobCtrCreateMirror:	/* Container Create Mirror
441c6eafcf2SScott Long 						 * operation */
442914da7d0SScott Long 			device_printf(sc->aac_dev,
443914da7d0SScott Long 				      "(ConatainerCreateMirror) container %d\n",
444914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src);
445c6eafcf2SScott Long 				      /* XXX two containers? */
44635863739SMike Smith 			break;
447c6eafcf2SScott Long 		case AifJobCtrMergeMirror:	/* Container Merge Mirror
448c6eafcf2SScott Long 						 * operation */
449914da7d0SScott Long 			device_printf(sc->aac_dev,
450914da7d0SScott Long 				      "(ConatainerMergeMirror) container %d\n",
451c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.src);
452c6eafcf2SScott Long 				      /* XXX two containers? */
45335863739SMike Smith 			break;
454c6eafcf2SScott Long 		case AifJobCtrScrubMirror:	/* Container Scrub Mirror
455c6eafcf2SScott Long 						 * operation */
456914da7d0SScott Long 			device_printf(sc->aac_dev,
457914da7d0SScott Long 				      "(ConatainerScrubMirror) container %d\n",
45835863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
45935863739SMike Smith 			break;
460c6eafcf2SScott Long 		case AifJobCtrRebuildRaid5:	/* Container Rebuild Raid5
461c6eafcf2SScott Long 						 * operation */
462914da7d0SScott Long 			device_printf(sc->aac_dev,
463914da7d0SScott Long 				      "(ConatainerRebuildRaid5) container %d\n",
464914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src);
46535863739SMike Smith 			break;
466c6eafcf2SScott Long 		case AifJobCtrScrubRaid5:	/* Container Scrub Raid5
467c6eafcf2SScott Long 						 * operation */
468914da7d0SScott Long 			device_printf(sc->aac_dev,
469914da7d0SScott Long 				      "(ConatainerScrubRaid5) container %d\n",
47035863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
47135863739SMike Smith 			break;
47235863739SMike Smith 		case AifJobCtrMorph:		/* Container morph operation */
473914da7d0SScott Long 			device_printf(sc->aac_dev,
474914da7d0SScott Long 				      "(ConatainerMorph) container %d\n",
47535863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
476c6eafcf2SScott Long 				      /* XXX two containers? */
477c6eafcf2SScott Long 			break;
478c6eafcf2SScott Long 		case AifJobCtrPartCopy:		/* Container Partition copy
479c6eafcf2SScott Long 						 * operation */
480914da7d0SScott Long 			device_printf(sc->aac_dev,
481914da7d0SScott Long 				      "(ConatainerPartCopy) container %d to "
482914da7d0SScott Long 				      "%d\n",
483914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src,
484c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.dst);
485c6eafcf2SScott Long 			break;
486c6eafcf2SScott Long 		case AifJobCtrRebuildMirror:	/* Container Rebuild Mirror
487c6eafcf2SScott Long 						 * operation */
488914da7d0SScott Long 			device_printf(sc->aac_dev,
489914da7d0SScott Long 				      "(ConatainerRebuildMirror) container "
490914da7d0SScott Long 				      "%d\n",
491914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src);
49235863739SMike Smith 			break;
49335863739SMike Smith 		case AifJobCtrCrazyCache:	/* crazy cache */
494914da7d0SScott Long 			device_printf(sc->aac_dev,
495914da7d0SScott Long 				      "(ConatainerCrazyCache) container %d\n",
496c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.src);
497c6eafcf2SScott Long 				      /* XXX two containers? */
49835863739SMike Smith 			break;
499c6eafcf2SScott Long 		case AifJobFsCreate:		/* File System Create
500c6eafcf2SScott Long 						 * operation */
50135863739SMike Smith 			device_printf(sc->aac_dev, "(FsCreate)\n");
50235863739SMike Smith 			break;
503c6eafcf2SScott Long 		case AifJobFsVerify:		/* File System Verify
504c6eafcf2SScott Long 						 * operation */
50535863739SMike Smith 			device_printf(sc->aac_dev, "(FsVerivy)\n");
50635863739SMike Smith 			break;
507c6eafcf2SScott Long 		case AifJobFsExtend:		/* File System Extend
508c6eafcf2SScott Long 						 * operation */
50935863739SMike Smith 			device_printf(sc->aac_dev, "(FsExtend)\n");
51035863739SMike Smith 			break;
51135863739SMike Smith 		case AifJobApiFormatNTFS:	/* Format a drive to NTFS */
51235863739SMike Smith 			device_printf(sc->aac_dev, "(FormatNTFS)\n");
51335863739SMike Smith 			break;
51435863739SMike Smith 		case AifJobApiFormatFAT:	/* Format a drive to FAT */
51535863739SMike Smith 			device_printf(sc->aac_dev, "(FormatFAT)\n");
51635863739SMike Smith 			break;
517c6eafcf2SScott Long 		case AifJobApiUpdateSnapshot:	/* update the read/write half
518c6eafcf2SScott Long 						 * of a snapshot */
51935863739SMike Smith 			device_printf(sc->aac_dev, "(UpdateSnapshot)\n");
52035863739SMike Smith 			break;
52135863739SMike Smith 		case AifJobApiFormatFAT32:	/* Format a drive to FAT32 */
52235863739SMike Smith 			device_printf(sc->aac_dev, "(FormatFAT32)\n");
52335863739SMike Smith 			break;
52435863739SMike Smith 		case AifJobCtlContinuousCtrVerify: /* Adapter operation */
52535863739SMike Smith 			device_printf(sc->aac_dev, "(ContinuousCtrVerify)\n");
52635863739SMike Smith 			break;
52735863739SMike Smith 		default:
528914da7d0SScott Long 			device_printf(sc->aac_dev, "(%d)\n",
529914da7d0SScott Long 				      aif->data.PR[0].jd.type);
53035863739SMike Smith 			break;
53135863739SMike Smith 		}
53235863739SMike Smith 		break;
53335863739SMike Smith 	}
53435863739SMike Smith 	case AifCmdAPIReport:
53535863739SMike Smith 		device_printf(sc->aac_dev, "APIReport (%d)\n", aif->seqNumber);
53635863739SMike Smith 		break;
53735863739SMike Smith 	case AifCmdDriverNotify:
538914da7d0SScott Long 		device_printf(sc->aac_dev, "DriverNotify (%d)\n",
539914da7d0SScott Long 			      aif->seqNumber);
54035863739SMike Smith 		break;
54135863739SMike Smith 	default:
542c6eafcf2SScott Long 		device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command,
543c6eafcf2SScott Long 			      aif->seqNumber);
54435863739SMike Smith 		break;
54535863739SMike Smith 	}
54635863739SMike Smith }
547f6c4dd3fSScott Long #endif /* AAC_DEBUG */
548