xref: /freebsd/sys/dev/aac/aac_debug.c (revision a4d7a3c06992389ecbca4ae8d12e8166d35d98af)
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>
40a4d7a3c0SPoul-Henning Kamp #include <sys/conf.h>
4135863739SMike Smith 
4235863739SMike Smith #include <dev/aac/aac_compat.h>
4335863739SMike Smith #include <sys/bus.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 */
1557d05a383SPeter Wemm 		break;
15635863739SMike Smith 	}
15735863739SMike Smith }
15835863739SMike Smith 
159914da7d0SScott Long /*
16035863739SMike Smith  * simulate an interrupt for controller 0
16135863739SMike Smith  */
16235863739SMike Smith void
16335863739SMike Smith aac_intr0(void)
16435863739SMike Smith {
165914da7d0SScott Long 	struct aac_softc *sc;
166914da7d0SScott Long 
167e45bef2aSMike Smith 	sc = devclass_get_softc(devclass_find("aac"), 0);
16835863739SMike Smith 
16935863739SMike Smith 	aac_intr(sc);
17035863739SMike Smith }
17135863739SMike Smith 
172914da7d0SScott Long /*
17335863739SMike Smith  * Panic in a slightly informative fashion
17435863739SMike Smith  */
17535863739SMike Smith void
17635863739SMike Smith aac_panic(struct aac_softc *sc, char *reason)
17735863739SMike Smith {
17835863739SMike Smith 	aac_print_queues(sc);
17935863739SMike Smith 	panic(reason);
18035863739SMike Smith }
18135863739SMike Smith 
182914da7d0SScott Long /*
18335863739SMike Smith  * Print a FIB
18435863739SMike Smith  */
18535863739SMike Smith void
18670148712SPeter Wemm aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, const char *caller)
18735863739SMike Smith {
188f30ac74cSScott Long 	if (fib == NULL) {
189f30ac74cSScott Long 		device_printf(sc->aac_dev,
190f30ac74cSScott Long 			      "aac_print_fib called with NULL fib\n");
191f30ac74cSScott Long 		return;
192f30ac74cSScott Long 	}
19335863739SMike Smith 	device_printf(sc->aac_dev, "%s: FIB @ %p\n", caller, fib);
194914da7d0SScott Long 	device_printf(sc->aac_dev, "  XferState %b\n", fib->Header.XferState,
195914da7d0SScott Long 		      "\20"
19635863739SMike Smith 		      "\1HOSTOWNED"
19735863739SMike Smith 		      "\2ADAPTEROWNED"
19835863739SMike Smith 		      "\3INITIALISED"
19935863739SMike Smith 		      "\4EMPTY"
20035863739SMike Smith 		      "\5FROMPOOL"
20135863739SMike Smith 		      "\6FROMHOST"
20235863739SMike Smith 		      "\7FROMADAP"
20335863739SMike Smith 		      "\10REXPECTED"
20435863739SMike Smith 		      "\11RNOTEXPECTED"
20535863739SMike Smith 		      "\12DONEADAP"
20635863739SMike Smith 		      "\13DONEHOST"
20735863739SMike Smith 		      "\14HIGH"
20835863739SMike Smith 		      "\15NORM"
20935863739SMike Smith 		      "\16ASYNC"
21035863739SMike Smith 		      "\17PAGEFILEIO"
21135863739SMike Smith 		      "\20SHUTDOWN"
21235863739SMike Smith 		      "\21LAZYWRITE"
21335863739SMike Smith 		      "\22ADAPMICROFIB"
21435863739SMike Smith 		      "\23BIOSFIB"
21535863739SMike Smith 		      "\24FAST_RESPONSE"
21635863739SMike Smith 		      "\25APIFIB\n");
21735863739SMike Smith 	device_printf(sc->aac_dev, "  Command       %d\n", fib->Header.Command);
218c6eafcf2SScott Long 	device_printf(sc->aac_dev, "  StructType    %d\n",
219c6eafcf2SScott Long 		      fib->Header.StructType);
22035863739SMike Smith 	device_printf(sc->aac_dev, "  Flags         0x%x\n", fib->Header.Flags);
22135863739SMike Smith 	device_printf(sc->aac_dev, "  Size          %d\n", fib->Header.Size);
222b3457b51SScott Long 	device_printf(sc->aac_dev, "  SenderSize    %d\n",
223c6eafcf2SScott Long 		      fib->Header.SenderSize);
224c6eafcf2SScott Long 	device_printf(sc->aac_dev, "  SenderAddress 0x%x\n",
225c6eafcf2SScott Long 		      fib->Header.SenderFibAddress);
226914da7d0SScott Long 	device_printf(sc->aac_dev, "  RcvrAddress   0x%x\n",
227c6eafcf2SScott Long 		      fib->Header.ReceiverFibAddress);
228c6eafcf2SScott Long 	device_printf(sc->aac_dev, "  SenderData    0x%x\n",
229c6eafcf2SScott Long 		      fib->Header.SenderData);
23035863739SMike Smith 	switch(fib->Header.Command) {
23135863739SMike Smith 	case ContainerCommand:
23235863739SMike Smith 	{
233914da7d0SScott Long 		struct aac_blockread *br;
234b3457b51SScott Long 		struct aac_blockwrite *bw;
235914da7d0SScott Long 		struct aac_sg_table *sg;
23635863739SMike Smith 		int i;
237914da7d0SScott Long 
238914da7d0SScott Long 		br = (struct aac_blockread*)fib->data;
239914da7d0SScott Long 		bw = (struct aac_blockwrite*)fib->data;
240914da7d0SScott Long 		sg = NULL;
241914da7d0SScott Long 
24235863739SMike Smith 		if (br->Command == VM_CtBlockRead) {
243914da7d0SScott Long 			device_printf(sc->aac_dev,
244914da7d0SScott Long 				      "  BlockRead: container %d  0x%x/%d\n",
245914da7d0SScott Long 				      br->ContainerId, br->BlockNumber,
246914da7d0SScott Long 				      br->ByteCount);
24735863739SMike Smith 			sg = &br->SgMap;
24835863739SMike Smith 		}
24935863739SMike Smith 		if (bw->Command == VM_CtBlockWrite) {
250914da7d0SScott Long 			device_printf(sc->aac_dev,
251914da7d0SScott Long 				      "  BlockWrite: container %d  0x%x/%d "
252914da7d0SScott Long 				      "(%s)\n", bw->ContainerId,
253914da7d0SScott Long 				      bw->BlockNumber, bw->ByteCount,
254914da7d0SScott Long 				      bw->Stable == CSTABLE ? "stable" :
255c6eafcf2SScott Long 				      "unstable");
25635863739SMike Smith 			sg = &bw->SgMap;
25735863739SMike Smith 		}
25835863739SMike Smith 		if (sg != NULL) {
259914da7d0SScott Long 			device_printf(sc->aac_dev,
260914da7d0SScott Long 				      "  %d s/g entries\n", sg->SgCount);
26135863739SMike Smith 			for (i = 0; i < sg->SgCount; i++)
262c6eafcf2SScott Long 				device_printf(sc->aac_dev, "  0x%08x/%d\n",
263c6eafcf2SScott Long 					      sg->SgEntry[i].SgAddress,
264c6eafcf2SScott Long 					      sg->SgEntry[i].SgByteCount);
26535863739SMike Smith 		}
26635863739SMike Smith 		break;
26735863739SMike Smith 	}
26835863739SMike Smith 	default:
26935863739SMike Smith 		device_printf(sc->aac_dev, "   %16D\n", fib->data, " ");
27035863739SMike Smith 		device_printf(sc->aac_dev, "   %16D\n", fib->data + 16, " ");
27135863739SMike Smith 		break;
27235863739SMike Smith 	}
27335863739SMike Smith }
27435863739SMike Smith 
275914da7d0SScott Long /*
27635863739SMike Smith  * Describe an AIF we have received.
27735863739SMike Smith  */
27835863739SMike Smith void
27935863739SMike Smith aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif)
28035863739SMike Smith {
28135863739SMike Smith 	switch(aif->command) {
28235863739SMike Smith 	case AifCmdEventNotify:
28335863739SMike Smith 		device_printf(sc->aac_dev, "EventNotify(%d)\n", aif->seqNumber);
28435863739SMike Smith 		switch(aif->data.EN.type) {
28535863739SMike Smith 		case AifEnGeneric:		/* Generic notification */
28635863739SMike Smith 			device_printf(sc->aac_dev, "(Generic) %.*s\n",
287c6eafcf2SScott Long 				  (int)sizeof(aif->data.EN.data.EG),
288c6eafcf2SScott Long 				  aif->data.EN.data.EG.text);
28935863739SMike Smith 			break;
29035863739SMike Smith 		case AifEnTaskComplete:		/* Task has completed */
29135863739SMike Smith 			device_printf(sc->aac_dev, "(TaskComplete)\n");
29235863739SMike Smith 			break;
293c6eafcf2SScott Long 		case AifEnConfigChange:		/* Adapter configuration change
294c6eafcf2SScott Long 						 * occurred */
29535863739SMike Smith 			device_printf(sc->aac_dev, "(ConfigChange)\n");
29635863739SMike Smith 			break;
297c6eafcf2SScott Long 		case AifEnContainerChange:	/* Adapter specific container
298c6eafcf2SScott Long 						 * configuration change */
299914da7d0SScott Long 			device_printf(sc->aac_dev, "(ContainerChange) "
300914da7d0SScott Long 				      "container %d,%d\n",
30135863739SMike Smith 				      aif->data.EN.data.ECC.container[0],
30235863739SMike Smith 				      aif->data.EN.data.ECC.container[1]);
30335863739SMike Smith 			break;
30435863739SMike Smith 		case AifEnDeviceFailure:	/* SCSI device failed */
305914da7d0SScott Long 			device_printf(sc->aac_dev, "(DeviceFailure) "
306914da7d0SScott Long 				      "handle %d\n",
307914da7d0SScott Long 				      aif->data.EN.data.EDF.deviceHandle);
30835863739SMike Smith 			break;
30935863739SMike Smith 		case AifEnMirrorFailover:	/* Mirror failover started */
310914da7d0SScott Long 			device_printf(sc->aac_dev, "(MirrorFailover) "
311914da7d0SScott Long 				      "container %d failed, "
312c6eafcf2SScott Long 				      "migrating from slice %d to %d\n",
31335863739SMike Smith 				      aif->data.EN.data.EMF.container,
31435863739SMike Smith 				      aif->data.EN.data.EMF.failedSlice,
31535863739SMike Smith 				      aif->data.EN.data.EMF.creatingSlice);
31635863739SMike Smith 			break;
317c6eafcf2SScott Long 		case AifEnContainerEvent:	/* Significant container
318c6eafcf2SScott Long 						 * event */
319914da7d0SScott Long 			device_printf(sc->aac_dev, "(ContainerEvent) "
320914da7d0SScott Long 				      "container %d event "
321c6eafcf2SScott Long 				      "%d\n", aif->data.EN.data.ECE.container,
322914da7d0SScott Long 				      aif->data.EN.data.ECE.eventType);
32335863739SMike Smith 			break;
32435863739SMike Smith 		case AifEnFileSystemChange:	/* File system changed */
32535863739SMike Smith 			device_printf(sc->aac_dev, "(FileSystemChange)\n");
32635863739SMike Smith 			break;
32735863739SMike Smith 		case AifEnConfigPause:		/* Container pause event */
32835863739SMike Smith 			device_printf(sc->aac_dev, "(ConfigPause)\n");
32935863739SMike Smith 			break;
33035863739SMike Smith 		case AifEnConfigResume:		/* Container resume event */
33135863739SMike Smith 			device_printf(sc->aac_dev, "(ConfigResume)\n");
33235863739SMike Smith 			break;
333c6eafcf2SScott Long 		case AifEnFailoverChange:	/* Failover space assignment
334c6eafcf2SScott Long 						 * changed */
33535863739SMike Smith 			device_printf(sc->aac_dev, "(FailoverChange)\n");
33635863739SMike Smith 			break;
33735863739SMike Smith 		case AifEnRAID5RebuildDone:	/* RAID5 rebuild finished */
33835863739SMike Smith 			device_printf(sc->aac_dev, "(RAID5RebuildDone)\n");
33935863739SMike Smith 			break;
34035863739SMike Smith 		case AifEnEnclosureManagement:	/* Enclosure management event */
341914da7d0SScott Long 			device_printf(sc->aac_dev, "(EnclosureManagement) "
342914da7d0SScott Long 				      "EMPID %d unit %d "
343c6eafcf2SScott Long 				      "event %d\n", aif->data.EN.data.EEE.empID,
34435863739SMike Smith 				      aif->data.EN.data.EEE.unitID,
34535863739SMike Smith 				      aif->data.EN.data.EEE.eventType);
34635863739SMike Smith 			break;
347c6eafcf2SScott Long 		case AifEnBatteryEvent:		/* Significant NV battery
348c6eafcf2SScott Long 						 * event */
349914da7d0SScott Long 			device_printf(sc->aac_dev, "(BatteryEvent) %d "
350914da7d0SScott Long 				      "(state was %d, is %d\n",
351914da7d0SScott Long 				      aif->data.EN.data.EBE.transition_type,
352914da7d0SScott Long 				      aif->data.EN.data.EBE.current_state,
353914da7d0SScott Long 				      aif->data.EN.data.EBE.prior_state);
35435863739SMike Smith 			break;
355c6eafcf2SScott Long 		case AifEnAddContainer:		/* A new container was
356c6eafcf2SScott Long 						 * created. */
35735863739SMike Smith 			device_printf(sc->aac_dev, "(AddContainer)\n");
35835863739SMike Smith 			break;
35935863739SMike Smith 		case AifEnDeleteContainer:	/* A container was deleted. */
36035863739SMike Smith 			device_printf(sc->aac_dev, "(DeleteContainer)\n");
36135863739SMike Smith 			break;
362c6eafcf2SScott Long 		case AifEnBatteryNeedsRecond:	/* The battery needs
363c6eafcf2SScott Long 						 * reconditioning */
36435863739SMike Smith 			device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n");
36535863739SMike Smith 			break;
36635863739SMike Smith 		case AifEnClusterEvent:		/* Some cluster event */
36735863739SMike Smith 			device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
36835863739SMike Smith 				      aif->data.EN.data.ECLE.eventType);
36935863739SMike Smith 			break;
37035863739SMike Smith 		case AifEnDiskSetEvent:		/* A disk set event occured. */
371914da7d0SScott Long 			device_printf(sc->aac_dev, "(DiskSetEvent) event %d "
372914da7d0SScott Long 				      "diskset %lld creator %lld\n",
373914da7d0SScott Long 				      aif->data.EN.data.EDS.eventType,
37435863739SMike Smith 				      aif->data.EN.data.EDS.DsNum,
37535863739SMike Smith 				      aif->data.EN.data.EDS.CreatorId);
37635863739SMike Smith 			break;
377c6eafcf2SScott Long 		case AifDenMorphComplete: 	/* A morph operation
378c6eafcf2SScott Long 						 * completed */
37935863739SMike Smith 			device_printf(sc->aac_dev, "(MorphComplete)\n");
38035863739SMike Smith 			break;
381c6eafcf2SScott Long 		case AifDenVolumeExtendComplete: /* A volume expand operation
382c6eafcf2SScott Long 						  * completed */
38335863739SMike Smith 			device_printf(sc->aac_dev, "(VolumeExtendComplete)\n");
38435863739SMike Smith 			break;
38535863739SMike Smith 		default:
38635863739SMike Smith 			device_printf(sc->aac_dev, "(%d)\n", aif->data.EN.type);
38735863739SMike Smith 			break;
38835863739SMike Smith 		}
38935863739SMike Smith 		break;
39035863739SMike Smith 	case AifCmdJobProgress:
39135863739SMike Smith 	{
39235863739SMike Smith 		char	*status;
39335863739SMike Smith 		switch(aif->data.PR[0].status) {
39435863739SMike Smith 		case AifJobStsSuccess:
39535863739SMike Smith 			status = "success"; break;
39635863739SMike Smith 		case AifJobStsFinished:
39735863739SMike Smith 			status = "finished"; break;
39835863739SMike Smith 		case AifJobStsAborted:
39935863739SMike Smith 			status = "aborted"; break;
40035863739SMike Smith 		case AifJobStsFailed:
40135863739SMike Smith 			status = "failed"; break;
40235863739SMike Smith 		case AifJobStsSuspended:
40335863739SMike Smith 			status = "suspended"; break;
40435863739SMike Smith 		case AifJobStsRunning:
40535863739SMike Smith 			status = "running"; break;
40635863739SMike Smith 		default:
40735863739SMike Smith 			status = "unknown status"; break;
40835863739SMike Smith 		}
40935863739SMike Smith 
410c6eafcf2SScott Long 		device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n",
411914da7d0SScott Long 			      aif->seqNumber, status,
412914da7d0SScott Long 			      aif->data.PR[0].currentTick,
413c6eafcf2SScott Long 			      aif->data.PR[0].finalTick);
41435863739SMike Smith 		switch(aif->data.PR[0].jd.type) {
415c6eafcf2SScott Long 		case AifJobScsiZero:		/* SCSI dev clear operation */
416c6eafcf2SScott Long 			device_printf(sc->aac_dev, "(ScsiZero) handle %d\n",
417c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
41835863739SMike Smith 			break;
419c6eafcf2SScott Long 		case AifJobScsiVerify:		/* SCSI device Verify operation
420c6eafcf2SScott Long 						 * NO REPAIR */
421c6eafcf2SScott Long 			device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n",
422c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
42335863739SMike Smith 			break;
424c6eafcf2SScott Long 		case AifJobScsiExercise:	/* SCSI device Exercise
425c6eafcf2SScott Long 						 * operation */
426c6eafcf2SScott Long 			device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n",
427c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
42835863739SMike Smith 			break;
429c6eafcf2SScott Long 		case AifJobScsiVerifyRepair:	/* SCSI device Verify operation
430c6eafcf2SScott Long 						 * WITH repair */
431914da7d0SScott Long 			device_printf(sc->aac_dev,
432914da7d0SScott Long 				      "(ScsiVerifyRepair) handle %d\n",
433c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.scsi_dh);
43435863739SMike Smith 			break;
43535863739SMike Smith 		case AifJobCtrZero:		/* Container clear operation */
436914da7d0SScott Long 			device_printf(sc->aac_dev,
437914da7d0SScott Long 				      "(ConatainerZero) container %d\n",
43835863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
43935863739SMike Smith 			break;
44035863739SMike Smith 		case AifJobCtrCopy:		/* Container copy operation */
441914da7d0SScott Long 			device_printf(sc->aac_dev,
442914da7d0SScott Long 				      "(ConatainerCopy) container %d to %d\n",
443c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.src,
444c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.dst);
44535863739SMike Smith 			break;
446c6eafcf2SScott Long 		case AifJobCtrCreateMirror:	/* Container Create Mirror
447c6eafcf2SScott Long 						 * operation */
448914da7d0SScott Long 			device_printf(sc->aac_dev,
449914da7d0SScott Long 				      "(ConatainerCreateMirror) container %d\n",
450914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src);
451c6eafcf2SScott Long 				      /* XXX two containers? */
45235863739SMike Smith 			break;
453c6eafcf2SScott Long 		case AifJobCtrMergeMirror:	/* Container Merge Mirror
454c6eafcf2SScott Long 						 * operation */
455914da7d0SScott Long 			device_printf(sc->aac_dev,
456914da7d0SScott Long 				      "(ConatainerMergeMirror) container %d\n",
457c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.src);
458c6eafcf2SScott Long 				      /* XXX two containers? */
45935863739SMike Smith 			break;
460c6eafcf2SScott Long 		case AifJobCtrScrubMirror:	/* Container Scrub Mirror
461c6eafcf2SScott Long 						 * operation */
462914da7d0SScott Long 			device_printf(sc->aac_dev,
463914da7d0SScott Long 				      "(ConatainerScrubMirror) container %d\n",
46435863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
46535863739SMike Smith 			break;
466c6eafcf2SScott Long 		case AifJobCtrRebuildRaid5:	/* Container Rebuild Raid5
467c6eafcf2SScott Long 						 * operation */
468914da7d0SScott Long 			device_printf(sc->aac_dev,
469914da7d0SScott Long 				      "(ConatainerRebuildRaid5) container %d\n",
470914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src);
47135863739SMike Smith 			break;
472c6eafcf2SScott Long 		case AifJobCtrScrubRaid5:	/* Container Scrub Raid5
473c6eafcf2SScott Long 						 * operation */
474914da7d0SScott Long 			device_printf(sc->aac_dev,
475914da7d0SScott Long 				      "(ConatainerScrubRaid5) container %d\n",
47635863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
47735863739SMike Smith 			break;
47835863739SMike Smith 		case AifJobCtrMorph:		/* Container morph operation */
479914da7d0SScott Long 			device_printf(sc->aac_dev,
480914da7d0SScott Long 				      "(ConatainerMorph) container %d\n",
48135863739SMike Smith 				      aif->data.PR[0].jd.client.container.src);
482c6eafcf2SScott Long 				      /* XXX two containers? */
483c6eafcf2SScott Long 			break;
484c6eafcf2SScott Long 		case AifJobCtrPartCopy:		/* Container Partition copy
485c6eafcf2SScott Long 						 * operation */
486914da7d0SScott Long 			device_printf(sc->aac_dev,
487914da7d0SScott Long 				      "(ConatainerPartCopy) container %d to "
488914da7d0SScott Long 				      "%d\n",
489914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src,
490c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.dst);
491c6eafcf2SScott Long 			break;
492c6eafcf2SScott Long 		case AifJobCtrRebuildMirror:	/* Container Rebuild Mirror
493c6eafcf2SScott Long 						 * operation */
494914da7d0SScott Long 			device_printf(sc->aac_dev,
495914da7d0SScott Long 				      "(ConatainerRebuildMirror) container "
496914da7d0SScott Long 				      "%d\n",
497914da7d0SScott Long 				      aif->data.PR[0].jd.client.container.src);
49835863739SMike Smith 			break;
49935863739SMike Smith 		case AifJobCtrCrazyCache:	/* crazy cache */
500914da7d0SScott Long 			device_printf(sc->aac_dev,
501914da7d0SScott Long 				      "(ConatainerCrazyCache) container %d\n",
502c6eafcf2SScott Long 				      aif->data.PR[0].jd.client.container.src);
503c6eafcf2SScott Long 				      /* XXX two containers? */
50435863739SMike Smith 			break;
505c6eafcf2SScott Long 		case AifJobFsCreate:		/* File System Create
506c6eafcf2SScott Long 						 * operation */
50735863739SMike Smith 			device_printf(sc->aac_dev, "(FsCreate)\n");
50835863739SMike Smith 			break;
509c6eafcf2SScott Long 		case AifJobFsVerify:		/* File System Verify
510c6eafcf2SScott Long 						 * operation */
51135863739SMike Smith 			device_printf(sc->aac_dev, "(FsVerivy)\n");
51235863739SMike Smith 			break;
513c6eafcf2SScott Long 		case AifJobFsExtend:		/* File System Extend
514c6eafcf2SScott Long 						 * operation */
51535863739SMike Smith 			device_printf(sc->aac_dev, "(FsExtend)\n");
51635863739SMike Smith 			break;
51735863739SMike Smith 		case AifJobApiFormatNTFS:	/* Format a drive to NTFS */
51835863739SMike Smith 			device_printf(sc->aac_dev, "(FormatNTFS)\n");
51935863739SMike Smith 			break;
52035863739SMike Smith 		case AifJobApiFormatFAT:	/* Format a drive to FAT */
52135863739SMike Smith 			device_printf(sc->aac_dev, "(FormatFAT)\n");
52235863739SMike Smith 			break;
523c6eafcf2SScott Long 		case AifJobApiUpdateSnapshot:	/* update the read/write half
524c6eafcf2SScott Long 						 * of a snapshot */
52535863739SMike Smith 			device_printf(sc->aac_dev, "(UpdateSnapshot)\n");
52635863739SMike Smith 			break;
52735863739SMike Smith 		case AifJobApiFormatFAT32:	/* Format a drive to FAT32 */
52835863739SMike Smith 			device_printf(sc->aac_dev, "(FormatFAT32)\n");
52935863739SMike Smith 			break;
53035863739SMike Smith 		case AifJobCtlContinuousCtrVerify: /* Adapter operation */
53135863739SMike Smith 			device_printf(sc->aac_dev, "(ContinuousCtrVerify)\n");
53235863739SMike Smith 			break;
53335863739SMike Smith 		default:
534914da7d0SScott Long 			device_printf(sc->aac_dev, "(%d)\n",
535914da7d0SScott Long 				      aif->data.PR[0].jd.type);
53635863739SMike Smith 			break;
53735863739SMike Smith 		}
53835863739SMike Smith 		break;
53935863739SMike Smith 	}
54035863739SMike Smith 	case AifCmdAPIReport:
54135863739SMike Smith 		device_printf(sc->aac_dev, "APIReport (%d)\n", aif->seqNumber);
54235863739SMike Smith 		break;
54335863739SMike Smith 	case AifCmdDriverNotify:
544914da7d0SScott Long 		device_printf(sc->aac_dev, "DriverNotify (%d)\n",
545914da7d0SScott Long 			      aif->seqNumber);
54635863739SMike Smith 		break;
54735863739SMike Smith 	default:
548c6eafcf2SScott Long 		device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command,
549c6eafcf2SScott Long 			      aif->seqNumber);
55035863739SMike Smith 		break;
55135863739SMike Smith 	}
55235863739SMike Smith }
553f6c4dd3fSScott Long #endif /* AAC_DEBUG */
554