diff options
author | scottl <scottl@FreeBSD.org> | 2001-08-03 00:50:30 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2001-08-03 00:50:30 +0000 |
commit | a48590ff89404e12e997518b9a392bb40fde83b3 (patch) | |
tree | cce2360f0a65a831051d7c460149d46e0958c6a8 | |
parent | d83e2b381c7b74091edd587f049d237fe1376606 (diff) | |
download | FreeBSD-src-a48590ff89404e12e997518b9a392bb40fde83b3.zip FreeBSD-src-a48590ff89404e12e997518b9a392bb40fde83b3.tar.gz |
Reformat for 80 columns. Sorry, but I had to do it.
-rw-r--r-- | sys/dev/aac/aac.c | 460 | ||||
-rw-r--r-- | sys/dev/aac/aac_debug.c | 276 | ||||
-rw-r--r-- | sys/dev/aac/aac_disk.c | 48 | ||||
-rw-r--r-- | sys/dev/aac/aac_pci.c | 43 | ||||
-rw-r--r-- | sys/dev/aac/aacreg.h | 233 | ||||
-rw-r--r-- | sys/dev/aac/aacvar.h | 117 |
6 files changed, 696 insertions, 481 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 1808e0d..122cda7 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -1,6 +1,8 @@ /*- * Copyright (c) 2000 Michael Smith + * Copyright (c) 2001 Scott Long * Copyright (c) 2000 BSDi + * Copyright (c) 2001 Adaptec, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,23 +75,28 @@ static void aac_host_response(struct aac_softc *sc); /* Command Buffer Management */ static int aac_alloc_command(struct aac_softc *sc, struct aac_command **cmp); static void aac_release_command(struct aac_command *cm); -static void aac_map_command_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error); +static void aac_map_command_helper(void *arg, bus_dma_segment_t *segs, + int nseg, int error); static int aac_alloc_commands(struct aac_softc *sc); static void aac_free_commands(struct aac_softc *sc); static void aac_map_command(struct aac_command *cm); static void aac_unmap_command(struct aac_command *cm); /* Hardware Interface */ -static void aac_common_map(void *arg, bus_dma_segment_t *segs, int nseg, int error); +static void aac_common_map(void *arg, bus_dma_segment_t *segs, int nseg, + int error); static int aac_init(struct aac_softc *sc); static int aac_sync_command(struct aac_softc *sc, u_int32_t command, - u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3, - u_int32_t *sp); -static int aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, - void *data, u_int16_t datasize, - void *result, u_int16_t *resultsize); -static int aac_enqueue_fib(struct aac_softc *sc, int queue, u_int32_t fib_size, u_int32_t fib_addr); -static int aac_dequeue_fib(struct aac_softc *sc, int queue, u_int32_t *fib_size, struct aac_fib **fib_addr); + u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, + u_int32_t arg3, u_int32_t *sp); +static int aac_sync_fib(struct aac_softc *sc, u_int32_t command, + u_int32_t xferstate, void *data, + u_int16_t datasize, void *result, + u_int16_t *resultsize); +static int aac_enqueue_fib(struct aac_softc *sc, int queue, + u_int32_t fib_size, u_int32_t fib_addr); +static int aac_dequeue_fib(struct aac_softc *sc, int queue, + u_int32_t *fib_size, struct aac_fib **fib_addr); /* StrongARM interface */ static int aac_sa_get_fwstatus(struct aac_softc *sc); @@ -97,7 +104,8 @@ static void aac_sa_qnotify(struct aac_softc *sc, int qbit); static int aac_sa_get_istatus(struct aac_softc *sc); static void aac_sa_clear_istatus(struct aac_softc *sc, int mask); static void aac_sa_set_mailbox(struct aac_softc *sc, u_int32_t command, - u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3); + u_int32_t arg0, u_int32_t arg1, + u_int32_t arg2, u_int32_t arg3); static int aac_sa_get_mailboxstatus(struct aac_softc *sc); static void aac_sa_set_interrupts(struct aac_softc *sc, int enable); @@ -117,7 +125,8 @@ static void aac_rx_qnotify(struct aac_softc *sc, int qbit); static int aac_rx_get_istatus(struct aac_softc *sc); static void aac_rx_clear_istatus(struct aac_softc *sc, int mask); static void aac_rx_set_mailbox(struct aac_softc *sc, u_int32_t command, - u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3); + u_int32_t arg0, u_int32_t arg1, + u_int32_t arg2, u_int32_t arg3); static int aac_rx_get_mailboxstatus(struct aac_softc *sc); static void aac_rx_set_interrupts(struct aac_softc *sc, int enable); @@ -133,18 +142,23 @@ struct aac_interface aac_rx_interface = { /* Debugging and Diagnostics */ static void aac_describe_controller(struct aac_softc *sc); -static char *aac_describe_code(struct aac_code_lookup *table, u_int32_t code); +static char *aac_describe_code(struct aac_code_lookup *table, + u_int32_t code); /* Management Interface */ static d_open_t aac_open; static d_close_t aac_close; static d_ioctl_t aac_ioctl; -static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib) __unused; -static void aac_handle_aif(struct aac_softc *sc, struct aac_aif_command *aif); +static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib); +static void aac_handle_aif(struct aac_softc *sc, + struct aac_aif_command *aif); #ifdef AAC_COMPAT_LINUX -static int aac_linux_rev_check(struct aac_softc *sc, caddr_t udata); -static int aac_linux_getnext_aif(struct aac_softc *sc, caddr_t arg); -static int aac_linux_return_aif(struct aac_softc *sc, caddr_t uptr); +static int aac_linux_rev_check(struct aac_softc *sc, + caddr_t udata); +static int aac_linux_getnext_aif(struct aac_softc *sc, + caddr_t arg); +static int aac_linux_return_aif(struct aac_softc *sc, + caddr_t uptr); #endif #define AAC_CDEV_MAJOR 150 @@ -165,13 +179,13 @@ static struct cdevsw aac_cdevsw = { 0, /* flags */ }; -/******************************************************************************** - ******************************************************************************** - Device Interface - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Device Interface + ****************************************************************************** + ******************************************************************************/ -/******************************************************************************** +/****************************************************************************** * Initialise the controller and softc */ int @@ -234,7 +248,8 @@ aac_attach(struct aac_softc *sc) * Make the control device. */ unit = device_get_unit(sc->aac_dev); - sc->aac_dev_t = make_dev(&aac_cdevsw, unit, UID_ROOT, GID_WHEEL, 0644, "aac%d", unit); + sc->aac_dev_t = make_dev(&aac_cdevsw, unit, UID_ROOT, GID_WHEEL, 0644, + "aac%d", unit); (void)make_dev_alias(sc->aac_dev_t, "afa%d", unit); (void)make_dev_alias(sc->aac_dev_t, "hpn%d", unit); @@ -243,7 +258,7 @@ aac_attach(struct aac_softc *sc) return(0); } -/******************************************************************************** +/****************************************************************************** * Probe for containers, create disks. */ static void @@ -267,18 +282,20 @@ aac_startup(void *arg) for (i = 0; i < AAC_MAX_CONTAINERS; i++) { /* request information on this container */ mi.MntCount = i; - if (aac_sync_fib(sc, ContainerCommand, 0, &mi, sizeof(struct aac_mntinfo), &mir, &rsize)) { + if (aac_sync_fib(sc, ContainerCommand, 0, &mi, + sizeof(struct aac_mntinfo), &mir, &rsize)) { debug(2, "error probing container %d", i); continue; } /* check response size */ if (rsize != sizeof(mir)) { - debug(2, "container info response wrong size (%d should be %d)", rsize, sizeof(mir)); + debug(2, "container info response wrong size (%d should be %d)", + rsize, sizeof(mir)); continue; } /* - * Check container volume type for validity. Note that many of the possible types - * may never show up. + * Check container volume type for validity. Note that many of the + * possible types may never show up. */ if ((mir.Status == ST_OK) && (mir.MntTable[0].VolType != CT_NONE)) { debug(1, "%d: id %x name '%.16s' size %u type %d", @@ -291,7 +308,8 @@ aac_startup(void *arg) } else { device_set_ivars(child, &sc->aac_container[i]); } - device_set_desc(child, aac_describe_code(aac_container_types, mir.MntTable[0].VolType)); + device_set_desc(child, aac_describe_code(aac_container_types, + mir.MntTable[0].VolType)); sc->aac_container[i].co_disk = child; sc->aac_container[i].co_mntobj = mir.MntTable[0]; } @@ -311,7 +329,7 @@ aac_startup(void *arg) timeout((timeout_t*)aac_timeout, sc, AAC_PERIODIC_INTERVAL * hz); } -/******************************************************************************** +/****************************************************************************** * Free all of the resources associated with (sc) * * Should not be called if the controller is active. @@ -334,7 +352,8 @@ aac_free(struct aac_softc *sc) /* destroy the common area */ if (sc->aac_common) { bus_dmamap_unload(sc->aac_common_dmat, sc->aac_common_dmamap); - bus_dmamem_free(sc->aac_common_dmat, sc->aac_common, sc->aac_common_dmamap); + bus_dmamem_free(sc->aac_common_dmat, sc->aac_common, + sc->aac_common_dmamap); } if (sc->aac_common_dmat) bus_dma_tag_destroy(sc->aac_common_dmat); @@ -343,7 +362,8 @@ aac_free(struct aac_softc *sc) if (sc->aac_intr) bus_teardown_intr(sc->aac_dev, sc->aac_irq, sc->aac_intr); if (sc->aac_irq != NULL) - bus_release_resource(sc->aac_dev, SYS_RES_IRQ, sc->aac_irq_rid, sc->aac_irq); + bus_release_resource(sc->aac_dev, SYS_RES_IRQ, sc->aac_irq_rid, + sc->aac_irq); /* destroy data-transfer DMA tag */ if (sc->aac_buffer_dmat) @@ -355,10 +375,11 @@ aac_free(struct aac_softc *sc) /* release the register window mapping */ if (sc->aac_regs_resource != NULL) - bus_release_resource(sc->aac_dev, SYS_RES_MEMORY, sc->aac_regs_rid, sc->aac_regs_resource); + bus_release_resource(sc->aac_dev, SYS_RES_MEMORY, sc->aac_regs_rid, + sc->aac_regs_resource); } -/******************************************************************************** +/****************************************************************************** * Disconnect from the controller completely, in preparation for unload. */ int @@ -380,7 +401,7 @@ aac_detach(device_t dev) return(0); } -/******************************************************************************** +/****************************************************************************** * Bring the controller down to a dormant state and detach all child devices. * * This function is called before detach or system shutdown. @@ -414,7 +435,8 @@ aac_shutdown(device_t dev) printf("FAILED.\n"); } else { i = 0; - if (aac_sync_fib(sc, FsaHostShutdown, AAC_FIBSTATE_SHUTDOWN, &i, sizeof(i), NULL, NULL)) { + if (aac_sync_fib(sc, FsaHostShutdown, AAC_FIBSTATE_SHUTDOWN, &i, + sizeof(i), NULL, NULL)) { printf("FAILED.\n"); } else { printf("done.\n"); @@ -427,7 +449,7 @@ aac_shutdown(device_t dev) return(0); } -/******************************************************************************** +/****************************************************************************** * Bring the controller to a quiescent state, ready for system suspend. */ int @@ -446,7 +468,7 @@ aac_suspend(device_t dev) return(0); } -/******************************************************************************** +/****************************************************************************** * Bring the controller back to a state ready for operation. */ int @@ -460,7 +482,7 @@ aac_resume(device_t dev) return(0); } -/******************************************************************************* +/****************************************************************************** * Take an interrupt. */ void @@ -476,7 +498,8 @@ aac_intr(void *arg) /* controller wants to talk to the log? XXX should we defer this? */ if (reason & AAC_DB_PRINTF) { if (sc->aac_common->ac_printf[0]) { - device_printf(sc->aac_dev, "** %.*s", AAC_PRINTF_BUFSIZE, sc->aac_common->ac_printf); + device_printf(sc->aac_dev, "** %.*s", AAC_PRINTF_BUFSIZE, + sc->aac_common->ac_printf); sc->aac_common->ac_printf[0] = 0; } AAC_CLEAR_ISTATUS(sc, AAC_DB_PRINTF); @@ -495,20 +518,24 @@ aac_intr(void *arg) aac_host_response(sc); } - /* spurious interrupts that we don't use - reset the mask and clear the interrupts */ + /* + * spurious interrupts that we don't use - reset the mask and clear the + * interrupts + */ if (reason & (AAC_DB_COMMAND_NOT_FULL | AAC_DB_RESPONSE_NOT_FULL)) { AAC_UNMASK_INTERRUPTS(sc); - AAC_CLEAR_ISTATUS(sc, AAC_DB_COMMAND_NOT_FULL | AAC_DB_RESPONSE_NOT_FULL); + AAC_CLEAR_ISTATUS(sc, AAC_DB_COMMAND_NOT_FULL | + AAC_DB_RESPONSE_NOT_FULL); } }; -/******************************************************************************** - ******************************************************************************** - Command Processing - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Command Processing + ****************************************************************************** + ******************************************************************************/ -/******************************************************************************** +/****************************************************************************** * Start as much queued I/O as possible on the controller */ static void @@ -539,7 +566,7 @@ aac_startio(struct aac_softc *sc) } } -/******************************************************************************** +/****************************************************************************** * Deliver a command to the controller; allocate controller resources at the * last moment when possible. */ @@ -559,7 +586,8 @@ aac_start(struct aac_command *cm) cm->cm_fib->Header.ReceiverFibAddress = cm->cm_fibphys; /* save a pointer to the command for speedy reverse-lookup */ - cm->cm_fib->Header.SenderData = (u_int32_t)cm; /* XXX 64-bit physical address issue */ + cm->cm_fib->Header.SenderData = (u_int32_t)cm; /* XXX 64-bit physical + * address issue */ /* put the FIB on the outbound queue */ if (aac_enqueue_fib(sc, AAC_ADAP_NORM_CMD_QUEUE, cm->cm_fib->Header.Size, @@ -572,7 +600,7 @@ aac_start(struct aac_command *cm) return(error); } -/******************************************************************************** +/****************************************************************************** * Handle notification of one or more FIBs coming from the controller. */ static void @@ -602,7 +630,7 @@ aac_host_command(struct aac_softc *sc) } } -/******************************************************************************** +/****************************************************************************** * Handle notification of one or more FIBs completed by the controller */ static void @@ -638,7 +666,7 @@ aac_host_response(struct aac_softc *sc) #endif } -/******************************************************************************** +/****************************************************************************** * Process completed commands. */ static void @@ -669,7 +697,7 @@ aac_complete(void *context, int pending) aac_startio(sc); } -/******************************************************************************** +/****************************************************************************** * Handle a bio submitted from a disk device. */ void @@ -685,7 +713,7 @@ aac_submit_bio(struct bio *bp) aac_startio(sc); } -/******************************************************************************** +/****************************************************************************** * Get a bio and build a command to go with it. */ static int @@ -759,7 +787,7 @@ fail: return(ENOMEM); } -/******************************************************************************** +/****************************************************************************** * Handle a bio-instigated command that has been completed. */ static void @@ -793,7 +821,7 @@ aac_bio_complete(struct aac_command *cm) aac_biodone(bp); } -/******************************************************************************** +/****************************************************************************** * Submit a command to the controller, return when it completes. */ static int @@ -814,13 +842,13 @@ aac_wait_command(struct aac_command *cm, int timeout) return(error); } -/******************************************************************************** - ******************************************************************************** - Command Buffer Management - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Command Buffer Management + ****************************************************************************** + ******************************************************************************/ -/******************************************************************************** +/****************************************************************************** * Allocate a command. */ static int @@ -837,7 +865,7 @@ aac_alloc_command(struct aac_softc *sc, struct aac_command **cmp) return(0); } -/******************************************************************************** +/****************************************************************************** * Release a command back to the freelist. */ static void @@ -866,7 +894,7 @@ aac_release_command(struct aac_command *cm) aac_enqueue_free(cm); } -/******************************************************************************** +/****************************************************************************** * Map helper for command/FIB allocation. */ static void @@ -879,7 +907,7 @@ aac_map_command_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) sc->aac_fibphys = segs[0].ds_addr; } -/******************************************************************************** +/****************************************************************************** * Allocate and initialise commands/FIBs for this adapter. */ static int @@ -891,11 +919,13 @@ aac_alloc_commands(struct aac_softc *sc) debug_called(1); /* allocate the FIBs in DMAable memory and load them */ - if (bus_dmamem_alloc(sc->aac_fib_dmat, (void **)&sc->aac_fibs, BUS_DMA_NOWAIT, &sc->aac_fibmap)) { + if (bus_dmamem_alloc(sc->aac_fib_dmat, (void **)&sc->aac_fibs, + BUS_DMA_NOWAIT, &sc->aac_fibmap)) { return(ENOMEM); } bus_dmamap_load(sc->aac_fib_dmat, sc->aac_fibmap, sc->aac_fibs, - AAC_FIB_COUNT * sizeof(struct aac_fib), aac_map_command_helper, sc, 0); + AAC_FIB_COUNT * sizeof(struct aac_fib), + aac_map_command_helper, sc, 0); /* initialise constant fields in the command structure */ for (i = 0; i < AAC_FIB_COUNT; i++) { @@ -910,7 +940,7 @@ aac_alloc_commands(struct aac_softc *sc) return(0); } -/******************************************************************************** +/****************************************************************************** * Free FIBs owned by this adapter. */ static void @@ -926,7 +956,7 @@ aac_free_commands(struct aac_softc *sc) bus_dmamem_free(sc->aac_fib_dmat, sc->aac_fibs, sc->aac_fibmap); } -/******************************************************************************** +/****************************************************************************** * Command-mapping helper function - populate this command's s/g table. */ static void @@ -955,7 +985,7 @@ aac_map_command_sg(void *arg, bus_dma_segment_t *segs, int nseg, int error) } -/******************************************************************************** +/****************************************************************************** * Map a command into controller-visible space. */ static void @@ -974,14 +1004,16 @@ aac_map_command(struct aac_command *cm) cm->cm_datalen, aac_map_command_sg, cm, 0); if (cm->cm_flags & AAC_CMD_DATAIN) - bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, + BUS_DMASYNC_PREREAD); if (cm->cm_flags & AAC_CMD_DATAOUT) - bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, + BUS_DMASYNC_PREWRITE); } cm->cm_flags |= AAC_CMD_MAPPED; } -/******************************************************************************** +/****************************************************************************** * Unmap a command from controller-visible space. */ static void @@ -996,22 +1028,24 @@ aac_unmap_command(struct aac_command *cm) if (cm->cm_datalen != 0) { if (cm->cm_flags & AAC_CMD_DATAIN) - bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, + BUS_DMASYNC_POSTREAD); if (cm->cm_flags & AAC_CMD_DATAOUT) - bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->aac_buffer_dmat, cm->cm_datamap); } cm->cm_flags &= ~AAC_CMD_MAPPED; } -/******************************************************************************** - ******************************************************************************** - Hardware Interface - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Hardware Interface + ****************************************************************************** + ******************************************************************************/ -/******************************************************************************** +/****************************************************************************** * Initialise the adapter. */ static void @@ -1049,7 +1083,8 @@ aac_init(struct aac_softc *sc) return(ENXIO); } if (time_second > (then + AAC_BOOT_TIMEOUT)) { - device_printf(sc->aac_dev, "FATAL: controller not coming ready, status %x\n", code); + device_printf(sc->aac_dev, "FATAL: controller not coming ready, " + "status %x\n", code); return(ENXIO); } } while (!(code & AAC_UP_AND_RUNNING)); @@ -1058,7 +1093,7 @@ aac_init(struct aac_softc *sc) * Create DMA tag for the common structure and allocate it. */ if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ + 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -1069,76 +1104,105 @@ aac_init(struct aac_softc *sc) device_printf(sc->aac_dev, "can't allocate common structure DMA tag\n"); return(ENOMEM); } - if (bus_dmamem_alloc(sc->aac_common_dmat, (void **)&sc->aac_common, BUS_DMA_NOWAIT, &sc->aac_common_dmamap)) { + if (bus_dmamem_alloc(sc->aac_common_dmat, (void **)&sc->aac_common, + BUS_DMA_NOWAIT, &sc->aac_common_dmamap)) { device_printf(sc->aac_dev, "can't allocate common structure\n"); return(ENOMEM); } - bus_dmamap_load(sc->aac_common_dmat, sc->aac_common_dmamap, sc->aac_common, sizeof(*sc->aac_common), - aac_common_map, sc, 0); + bus_dmamap_load(sc->aac_common_dmat, sc->aac_common_dmamap, sc->aac_common, + sizeof(*sc->aac_common), aac_common_map, sc, 0); bzero(sc->aac_common, sizeof(*sc->aac_common)); /* - * Fill in the init structure. This tells the adapter about the physical location - * of various important shared data structures. + * Fill in the init structure. This tells the adapter about the physical + * location of various important shared data structures. */ ip = &sc->aac_common->ac_init; ip->InitStructRevision = AAC_INIT_STRUCT_REVISION; - ip->AdapterFibsPhysicalAddress = sc->aac_common_busaddr + offsetof(struct aac_common, ac_fibs); + ip->AdapterFibsPhysicalAddress = sc->aac_common_busaddr + + offsetof(struct aac_common, ac_fibs); ip->AdapterFibsVirtualAddress = &sc->aac_common->ac_fibs[0]; ip->AdapterFibsSize = AAC_ADAPTER_FIBS * sizeof(struct aac_fib); ip->AdapterFibAlign = sizeof(struct aac_fib); - ip->PrintfBufferAddress = sc->aac_common_busaddr + offsetof(struct aac_common, ac_printf); + ip->PrintfBufferAddress = sc->aac_common_busaddr + + offsetof(struct aac_common, ac_printf); ip->PrintfBufferSize = AAC_PRINTF_BUFSIZE; ip->HostPhysMemPages = 0; /* not used? */ ip->HostElapsedSeconds = time_second; /* reset later if invalid */ /* - * Initialise FIB queues. Note that it appears that the layout of the indexes - * and the segmentation of the entries may be mandated by the adapter, which is - * only told about the base of the queue index fields. + * Initialise FIB queues. Note that it appears that the layout of the + * indexes and the segmentation of the entries may be mandated by the + * adapter, which is only told about the base of the queue index fields. * * The initial values of the indices are assumed to inform the adapter - * of the sizes of the respective queues, and theoretically it could work out - * the entire layout of the queue structures from this. We take the easy - * route and just lay this area out like everyone else does. + * of the sizes of the respective queues, and theoretically it could work + * out the entire layout of the queue structures from this. We take the + * easy route and just lay this area out like everyone else does. * * The Linux driver uses a much more complex scheme whereby several header - * records are kept for each queue. We use a couple of generic list manipulation - * functions which 'know' the size of each list by virtue of a table. + * records are kept for each queue. We use a couple of generic list + * manipulation functions which 'know' the size of each list by virtue of a + * table. */ qaddr = &sc->aac_common->ac_qbuf[0] + AAC_QUEUE_ALIGN; qaddr -= (u_int32_t)qaddr % AAC_QUEUE_ALIGN; sc->aac_queues = (struct aac_queue_table *)qaddr; - ip->CommHeaderAddress = sc->aac_common_busaddr + ((u_int32_t)sc->aac_queues - (u_int32_t)sc->aac_common); + ip->CommHeaderAddress = sc->aac_common_busaddr + ((u_int32_t)sc->aac_queues + - (u_int32_t)sc->aac_common); bzero(sc->aac_queues, sizeof(struct aac_queue_table)); - sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX] = AAC_HOST_NORM_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX] = AAC_HOST_NORM_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX] = AAC_HOST_HIGH_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX] = AAC_HOST_HIGH_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX] = AAC_ADAP_NORM_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX] = AAC_ADAP_NORM_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX] = AAC_ADAP_HIGH_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX] = AAC_ADAP_HIGH_CMD_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX] = AAC_HOST_NORM_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX] = AAC_HOST_NORM_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX] = AAC_HOST_HIGH_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX] = AAC_HOST_HIGH_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX] = AAC_ADAP_NORM_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX] = AAC_ADAP_NORM_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX] = AAC_ADAP_HIGH_RESP_ENTRIES; - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX] = AAC_ADAP_HIGH_RESP_ENTRIES; - sc->aac_qentries[AAC_HOST_NORM_CMD_QUEUE] = &sc->aac_queues->qt_HostNormCmdQueue[0]; - sc->aac_qentries[AAC_HOST_HIGH_CMD_QUEUE] = &sc->aac_queues->qt_HostHighCmdQueue[0]; - sc->aac_qentries[AAC_ADAP_NORM_CMD_QUEUE] = &sc->aac_queues->qt_AdapNormCmdQueue[0]; - sc->aac_qentries[AAC_ADAP_HIGH_CMD_QUEUE] = &sc->aac_queues->qt_AdapHighCmdQueue[0]; - sc->aac_qentries[AAC_HOST_NORM_RESP_QUEUE] = &sc->aac_queues->qt_HostNormRespQueue[0]; - sc->aac_qentries[AAC_HOST_HIGH_RESP_QUEUE] = &sc->aac_queues->qt_HostHighRespQueue[0]; - sc->aac_qentries[AAC_ADAP_NORM_RESP_QUEUE] = &sc->aac_queues->qt_AdapNormRespQueue[0]; - sc->aac_qentries[AAC_ADAP_HIGH_RESP_QUEUE] = &sc->aac_queues->qt_AdapHighRespQueue[0]; + sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX] = + AAC_HOST_NORM_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX] = + AAC_HOST_NORM_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX] = + AAC_HOST_HIGH_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX] = + AAC_HOST_HIGH_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX] = + AAC_ADAP_NORM_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX] = + AAC_ADAP_NORM_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX] = + AAC_ADAP_HIGH_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX] = + AAC_ADAP_HIGH_CMD_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX] = + AAC_HOST_NORM_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX] = + AAC_HOST_NORM_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX] = + AAC_HOST_HIGH_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX] = + AAC_HOST_HIGH_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX] = + AAC_ADAP_NORM_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX] = + AAC_ADAP_NORM_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX] = + AAC_ADAP_HIGH_RESP_ENTRIES; + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX] = + AAC_ADAP_HIGH_RESP_ENTRIES; + sc->aac_qentries[AAC_HOST_NORM_CMD_QUEUE] = + &sc->aac_queues->qt_HostNormCmdQueue[0]; + sc->aac_qentries[AAC_HOST_HIGH_CMD_QUEUE] = + &sc->aac_queues->qt_HostHighCmdQueue[0]; + sc->aac_qentries[AAC_ADAP_NORM_CMD_QUEUE] = + &sc->aac_queues->qt_AdapNormCmdQueue[0]; + sc->aac_qentries[AAC_ADAP_HIGH_CMD_QUEUE] = + &sc->aac_queues->qt_AdapHighCmdQueue[0]; + sc->aac_qentries[AAC_HOST_NORM_RESP_QUEUE] = + &sc->aac_queues->qt_HostNormRespQueue[0]; + sc->aac_qentries[AAC_HOST_HIGH_RESP_QUEUE] = + &sc->aac_queues->qt_HostHighRespQueue[0]; + sc->aac_qentries[AAC_ADAP_NORM_RESP_QUEUE] = + &sc->aac_queues->qt_AdapNormRespQueue[0]; + sc->aac_qentries[AAC_ADAP_HIGH_RESP_QUEUE] = + &sc->aac_queues->qt_AdapHighRespQueue[0]; /* * Do controller-type-specific initialisation @@ -1153,8 +1217,8 @@ aac_init(struct aac_softc *sc) * Give the init structure to the controller. */ if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT, - sc->aac_common_busaddr + offsetof(struct aac_common, ac_init), - 0, 0, 0, NULL)) { + sc->aac_common_busaddr + offsetof(struct aac_common, + ac_init), 0, 0, 0, NULL)) { device_printf(sc->aac_dev, "error establishing init structure\n"); return(EIO); } @@ -1162,7 +1226,7 @@ aac_init(struct aac_softc *sc) return(0); } -/******************************************************************************** +/****************************************************************************** * Send a synchronous command to the controller and wait for a result. */ static int @@ -1203,7 +1267,7 @@ aac_sync_command(struct aac_softc *sc, u_int32_t command, return(0); } -/******************************************************************************** +/****************************************************************************** * Send a synchronous FIB to the controller and wait for a result. */ static int @@ -1221,14 +1285,16 @@ aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, /* * Set up the sync FIB */ - fib->Header.XferState = AAC_FIBSTATE_HOSTOWNED | AAC_FIBSTATE_INITIALISED | AAC_FIBSTATE_EMPTY; + fib->Header.XferState = AAC_FIBSTATE_HOSTOWNED | AAC_FIBSTATE_INITIALISED | + AAC_FIBSTATE_EMPTY; fib->Header.XferState |= xferstate; fib->Header.Command = command; fib->Header.StructType = AAC_FIBTYPE_TFIB; fib->Header.Size = sizeof(struct aac_fib) + datasize; fib->Header.SenderSize = sizeof(struct aac_fib); fib->Header.SenderFibAddress = (u_int32_t)fib; - fib->Header.ReceiverFibAddress = sc->aac_common_busaddr + offsetof(struct aac_common, ac_sync_fib); + fib->Header.ReceiverFibAddress = sc->aac_common_busaddr + + offsetof(struct aac_common, ac_sync_fib); /* * Copy in data. @@ -1278,16 +1344,17 @@ static struct { }; /* - * Atomically insert an entry into the nominated queue, returns 0 on success or EBUSY - * if the queue is full. + * Atomically insert an entry into the nominated queue, returns 0 on success or + * EBUSY if the queue is full. * * Note: it would be more efficient to defer notifying the controller in - * the case where we may be inserting several entries in rapid succession, but - * implementing this usefully may be difficult (it would involve a separate - * queue/notify interface). + * the case where we may be inserting several entries in rapid succession, + * but implementing this usefully may be difficult (it would involve a + * separate queue/notify interface). */ static int -aac_enqueue_fib(struct aac_softc *sc, int queue, u_int32_t fib_size, u_int32_t fib_addr) +aac_enqueue_fib(struct aac_softc *sc, int queue, u_int32_t fib_size, + u_int32_t fib_addr) { u_int32_t pi, ci; int s, error; @@ -1329,11 +1396,12 @@ out: } /* - * Atomically remove one entry from the nominated queue, returns 0 on success or ENOENT - * if the queue is empty. + * Atomically remove one entry from the nominated queue, returns 0 on success or + * ENOENT if the queue is empty. */ static int -aac_dequeue_fib(struct aac_softc *sc, int queue, u_int32_t *fib_size, struct aac_fib **fib_addr) +aac_dequeue_fib(struct aac_softc *sc, int queue, u_int32_t *fib_size, + struct aac_fib **fib_addr) { u_int32_t pi, ci; int s, error; @@ -1373,7 +1441,7 @@ out: return(error); } -/******************************************************************************** +/****************************************************************************** * Check for commands that have been outstanding for a suspiciously long time, * and complain about them. */ @@ -1394,7 +1462,8 @@ aac_timeout(struct aac_softc *sc) deadline = time_second - AAC_CMD_TIMEOUT; s = splbio(); TAILQ_FOREACH(cm, &sc->aac_busy, cm_link) { - if ((cm->cm_timestamp < deadline) && !(cm->cm_flags & AAC_CMD_TIMEDOUT)) { + if ((cm->cm_timestamp < deadline) && + !(cm->cm_flags & AAC_CMD_TIMEDOUT)) { cm->cm_flags |= AAC_CMD_TIMEDOUT; device_printf(sc->aac_dev, "COMMAND TIMED OUT AFTER %d SECONDS\n", (int)(time_second - cm->cm_timestamp)); @@ -1408,13 +1477,13 @@ aac_timeout(struct aac_softc *sc) return; } -/******************************************************************************** - ******************************************************************************** - Interface Function Vectors - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Interface Function Vectors + ****************************************************************************** + ******************************************************************************/ -/******************************************************************************** +/****************************************************************************** * Read the current firmware status word. */ static int @@ -1433,7 +1502,7 @@ aac_rx_get_fwstatus(struct aac_softc *sc) return(AAC_GETREG4(sc, AAC_RX_FWSTATUS)); } -/******************************************************************************** +/****************************************************************************** * Notify the controller of a change in a given queue */ @@ -1453,7 +1522,7 @@ aac_rx_qnotify(struct aac_softc *sc, int qbit) AAC_SETREG4(sc, AAC_RX_IDBR, qbit); } -/******************************************************************************** +/****************************************************************************** * Get the interrupt reason bits */ static int @@ -1472,7 +1541,7 @@ aac_rx_get_istatus(struct aac_softc *sc) return(AAC_GETREG4(sc, AAC_RX_ODBR)); } -/******************************************************************************** +/****************************************************************************** * Clear some interrupt reason bits */ static void @@ -1491,7 +1560,7 @@ aac_rx_clear_istatus(struct aac_softc *sc, int mask) AAC_SETREG4(sc, AAC_RX_ODBR, mask); } -/******************************************************************************** +/****************************************************************************** * Populate the mailbox and set the command word */ static void @@ -1520,7 +1589,7 @@ aac_rx_set_mailbox(struct aac_softc *sc, u_int32_t command, AAC_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3); } -/******************************************************************************** +/****************************************************************************** * Fetch the immediate command status word */ static int @@ -1539,7 +1608,7 @@ aac_rx_get_mailboxstatus(struct aac_softc *sc) return(AAC_GETREG4(sc, AAC_RX_MAILBOX)); } -/******************************************************************************** +/****************************************************************************** * Set/clear interrupt masks */ static void @@ -1566,19 +1635,20 @@ aac_rx_set_interrupts(struct aac_softc *sc, int enable) } } -/******************************************************************************** - ******************************************************************************** - Debugging and Diagnostics - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Debugging and Diagnostics + ****************************************************************************** + ******************************************************************************/ -/******************************************************************************** +/****************************************************************************** * Print some information about the controller. */ static void aac_describe_controller(struct aac_softc *sc) { - u_int8_t buf[AAC_FIB_DATASIZE]; /* XXX really a bit big for the stack */ + u_int8_t buf[AAC_FIB_DATASIZE]; /* XXX really a bit big + * for the stack */ u_int16_t bufsize; struct aac_adapter_info *info; u_int8_t arg; @@ -1586,21 +1656,23 @@ aac_describe_controller(struct aac_softc *sc) debug_called(2); arg = 0; - if (aac_sync_fib(sc, RequestAdapterInfo, 0, &arg, sizeof(arg), &buf, &bufsize)) { + if (aac_sync_fib(sc, RequestAdapterInfo, 0, &arg, sizeof(arg), &buf, + &bufsize)) { device_printf(sc->aac_dev, "RequestAdapterInfo failed\n"); return; } if (bufsize != sizeof(*info)) { - device_printf(sc->aac_dev, "RequestAdapterInfo returned wrong data size (%d != %d)\n", - bufsize, sizeof(*info)); + device_printf(sc->aac_dev, "RequestAdapterInfo returned wrong data " + "size (%d != %d)\n", bufsize, sizeof(*info)); /*return;*/ } info = (struct aac_adapter_info *)&buf[0]; device_printf(sc->aac_dev, "%s %dMHz, %dMB total memory, %s (%d)\n", - aac_describe_code(aac_cpu_variant, info->CpuVariant), info->ClockSpeed, - info->TotalMem / (1024 * 1024), - aac_describe_code(aac_battery_platform, info->batteryPlatform), info->batteryPlatform); + aac_describe_code(aac_cpu_variant, info->CpuVariant), + info->ClockSpeed, info->TotalMem / (1024 * 1024), + aac_describe_code(aac_battery_platform, + info->batteryPlatform), info->batteryPlatform); /* save the kernel revision structure for later use */ sc->aac_revision = info->KernelRevision; @@ -1608,10 +1680,10 @@ aac_describe_controller(struct aac_softc *sc) info->KernelRevision.external.comp.major, info->KernelRevision.external.comp.minor, info->KernelRevision.external.comp.dash, - info->SerialNumber); /* XXX how is this meant to be formatted? */ + info->SerialNumber); /* XXX format? */ } -/******************************************************************************** +/****************************************************************************** * Look up a text description of a numeric error code and return a pointer to * same. */ @@ -1628,7 +1700,7 @@ aac_describe_code(struct aac_code_lookup *table, u_int32_t code) /***************************************************************************** ***************************************************************************** - Management Interface + Management Interface ***************************************************************************** *****************************************************************************/ @@ -1681,7 +1753,8 @@ aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) case AACQ_READY: case AACQ_BUSY: case AACQ_COMPLETE: - bcopy(&sc->aac_qstat[as->as_item], &as->as_qstat, sizeof(struct aac_qstat)); + bcopy(&sc->aac_qstat[as->as_item], &as->as_qstat, + sizeof(struct aac_qstat)); break; default: error = ENOENT; @@ -1734,7 +1807,7 @@ aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) return(error); } -/******************************************************************************** +/****************************************************************************** * Send a FIB supplied from userspace */ static int @@ -1762,7 +1835,8 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib) goto out; size = cm->cm_fib->Header.Size + sizeof(struct aac_fib_header); if (size > sizeof(struct aac_fib)) { - device_printf(sc->aac_dev, "incoming FIB oversized (%d > %d)\n", size, sizeof(struct aac_fib)); + device_printf(sc->aac_dev, "incoming FIB oversized (%d > %d)\n", size, + sizeof(struct aac_fib)); size = sizeof(struct aac_fib); } if ((error = copyin(ufib, cm->cm_fib, size)) != 0) @@ -1780,7 +1854,8 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib) */ size = cm->cm_fib->Header.Size; if (size > sizeof(struct aac_fib)) { - device_printf(sc->aac_dev, "outbound FIB oversized (%d > %d)\n", size, sizeof(struct aac_fib)); + device_printf(sc->aac_dev, "outbound FIB oversized (%d > %d)\n", size, + sizeof(struct aac_fib)); size = sizeof(struct aac_fib); } error = copyout(cm->cm_fib, ufib, size); @@ -1791,7 +1866,7 @@ out: return(error); } -/******************************************************************************** +/****************************************************************************** * Handle an AIF sent to us by the controller; queue it for later reference. * * XXX what's the right thing to do here when the queue is full? Drop the older @@ -1816,11 +1891,11 @@ aac_handle_aif(struct aac_softc *sc, struct aac_aif_command *aif) aac_print_aif(sc, aif); } -/******************************************************************************** - ******************************************************************************** - Linux Management Interface - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Linux Management Interface + ****************************************************************************** + ******************************************************************************/ #ifdef AAC_COMPAT_LINUX @@ -1833,10 +1908,14 @@ aac_handle_aif(struct aac_softc *sc, struct aac_aif_command *aif) #define AAC_LINUX_IOCTL_MAX 0x21ff static linux_ioctl_function_t aac_linux_ioctl; -static struct linux_ioctl_handler aac_handler = {aac_linux_ioctl, AAC_LINUX_IOCTL_MIN, AAC_LINUX_IOCTL_MAX}; +static struct linux_ioctl_handler aac_handler = {aac_linux_ioctl, + AAC_LINUX_IOCTL_MIN, + AAC_LINUX_IOCTL_MAX}; -SYSINIT (aac_register, SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_register_handler, &aac_handler); -SYSUNINIT(aac_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_unregister_handler, &aac_handler); +SYSINIT (aac_register, SI_SUB_KLD, SI_ORDER_MIDDLE, + linux_ioctl_register_handler, &aac_handler); +SYSUNINIT(aac_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, + linux_ioctl_unregister_handler, &aac_handler); MODULE_DEPEND(aac, linux, 1, 1, 1); @@ -1852,7 +1931,7 @@ aac_linux_ioctl(struct proc *p, struct linux_ioctl_args *args) return(fo_ioctl(fp, cmd, (caddr_t)args->arg, p)); } -/******************************************************************************** +/****************************************************************************** * Return the Revision of the driver to userspace and check to see if the * userspace app is possibly compatible. This is extremely bogus right now * because I have no idea how to handle the versioning of this driver. It is @@ -1870,7 +1949,8 @@ aac_linux_rev_check(struct aac_softc *sc, caddr_t udata) /* * Copyin the revision struct from userspace */ - if ((error = copyin(udata, (caddr_t)&rev_check, sizeof(struct aac_rev_check))) != 0) { + if ((error = copyin(udata, (caddr_t)&rev_check, + sizeof(struct aac_rev_check))) != 0) { return error; } @@ -1883,10 +1963,11 @@ aac_linux_rev_check(struct aac_softc *sc, caddr_t udata) rev_check_resp.adapterSWRevision.external.ul = sc->aac_revision.external.ul; rev_check_resp.adapterSWRevision.buildNumber = sc->aac_revision.buildNumber; - return(copyout((caddr_t)&rev_check_resp, udata, sizeof(struct aac_rev_check_resp))); + return(copyout((caddr_t)&rev_check_resp, udata, + sizeof(struct aac_rev_check_resp))); } -/******************************************************************************** +/****************************************************************************** * Pass the caller the next AIF in their queue */ static int @@ -1924,7 +2005,7 @@ aac_linux_getnext_aif(struct aac_softc *sc, caddr_t arg) return(error); } -/******************************************************************************** +/****************************************************************************** * Hand the next AIF off the top of the queue out to userspace. */ static int @@ -1938,7 +2019,8 @@ aac_linux_return_aif(struct aac_softc *sc, caddr_t uptr) if (sc->aac_aifq_tail == sc->aac_aifq_head) { error = EAGAIN; } else { - error = copyout(&sc->aac_aifq[sc->aac_aifq_tail], uptr, sizeof(struct aac_aif_command)); + error = copyout(&sc->aac_aifq[sc->aac_aifq_tail], uptr, + sizeof(struct aac_aif_command)); if (!error) sc->aac_aifq_tail = (sc->aac_aifq_tail + 1) % AAC_AIFQ_LENGTH; } diff --git a/sys/dev/aac/aac_debug.c b/sys/dev/aac/aac_debug.c index d4b7cb9..11cfee1 100644 --- a/sys/dev/aac/aac_debug.c +++ b/sys/dev/aac/aac_debug.c @@ -1,6 +1,8 @@ /*- * Copyright (c) 2000 Michael Smith + * Copyright (c) 2001 Scott Long * Copyright (c) 2000 BSDi + * Copyright (c) 2001 Adaptec, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,60 +53,61 @@ void aac_printstate0(void); void aac_intr0(void); -/******************************************************************************** +/****************************************************************************** * Dump the command queue indices */ void aac_print_queues(struct aac_softc *sc) { device_printf(sc->aac_dev, "FIB queue header at %p queues at %p\n", - &sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0], - &sc->aac_queues->qt_HostNormCmdQueue[0]); + &sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][0], + &sc->aac_queues->qt_HostNormCmdQueue[0]); device_printf(sc->aac_dev, "HOST_NORM_CMD %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX], - AAC_HOST_NORM_CMD_ENTRIES); + sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX], + AAC_HOST_NORM_CMD_ENTRIES); device_printf(sc->aac_dev, "HOST_HIGH_CMD %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX], - AAC_HOST_HIGH_CMD_ENTRIES); + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX], + AAC_HOST_HIGH_CMD_ENTRIES); device_printf(sc->aac_dev, "ADAP_NORM_CMD %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX], - AAC_ADAP_NORM_CMD_ENTRIES); + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_CMD_QUEUE][AAC_CONSUMER_INDEX], + AAC_ADAP_NORM_CMD_ENTRIES); device_printf(sc->aac_dev, "ADAP_HIGH_CMD %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX], - AAC_ADAP_HIGH_CMD_ENTRIES); + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_CMD_QUEUE][AAC_CONSUMER_INDEX], + AAC_ADAP_HIGH_CMD_ENTRIES); device_printf(sc->aac_dev, "HOST_NORM_RESP %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX], - AAC_HOST_NORM_RESP_ENTRIES); + sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_HOST_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX], + AAC_HOST_NORM_RESP_ENTRIES); device_printf(sc->aac_dev, "HOST_HIGH_RESP %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX], - AAC_HOST_HIGH_RESP_ENTRIES); + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_HOST_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX], + AAC_HOST_HIGH_RESP_ENTRIES); device_printf(sc->aac_dev, "ADAP_NORM_RESP %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX], - AAC_ADAP_NORM_RESP_ENTRIES); + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_ADAP_NORM_RESP_QUEUE][AAC_CONSUMER_INDEX], + AAC_ADAP_NORM_RESP_ENTRIES); device_printf(sc->aac_dev, "ADAP_HIGH_RESP %d/%d (%d)\n", - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX], - sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX], - AAC_ADAP_HIGH_RESP_ENTRIES); + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_PRODUCER_INDEX], + sc->aac_queues->qt_qindex[AAC_ADAP_HIGH_RESP_QUEUE][AAC_CONSUMER_INDEX], + AAC_ADAP_HIGH_RESP_ENTRIES); device_printf(sc->aac_dev, "AACQ_FREE %d/%d\n", - sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max); + sc->aac_qstat[AACQ_FREE].q_length, sc->aac_qstat[AACQ_FREE].q_max); device_printf(sc->aac_dev, "AACQ_BIO %d/%d\n", - sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max); + sc->aac_qstat[AACQ_BIO].q_length, sc->aac_qstat[AACQ_BIO].q_max); device_printf(sc->aac_dev, "AACQ_READY %d/%d\n", - sc->aac_qstat[AACQ_READY].q_length, sc->aac_qstat[AACQ_READY].q_max); + sc->aac_qstat[AACQ_READY].q_length, sc->aac_qstat[AACQ_READY].q_max); device_printf(sc->aac_dev, "AACQ_BUSY %d/%d\n", - sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max); + sc->aac_qstat[AACQ_BUSY].q_length, sc->aac_qstat[AACQ_BUSY].q_max); device_printf(sc->aac_dev, "AACQ_COMPLETE %d/%d\n", - sc->aac_qstat[AACQ_COMPLETE].q_length, sc->aac_qstat[AACQ_COMPLETE].q_max); + sc->aac_qstat[AACQ_COMPLETE].q_length, + sc->aac_qstat[AACQ_COMPLETE].q_max); } -/******************************************************************************** +/****************************************************************************** * Print the command queue states for controller 0 (callable from DDB) */ void @@ -116,19 +119,23 @@ aac_printstate0(void) switch (sc->aac_hwif) { case AAC_HWIF_I960RX: device_printf(sc->aac_dev, "IDBR 0x%08x IIMR 0x%08x IISR 0x%08x\n", - AAC_GETREG4(sc, AAC_RX_IDBR), AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR)); + AAC_GETREG4(sc, AAC_RX_IDBR), AAC_GETREG4(sc, AAC_RX_IIMR), + AAC_GETREG4(sc, AAC_RX_IISR)); device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x OISR 0x%08x\n", - AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR)); - AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY | AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/); + AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), + AAC_GETREG4(sc, AAC_RX_OISR)); + AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY | + AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/); device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x OISR 0x%08x\n", - AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR)); + AAC_GETREG4(sc, AAC_RX_ODBR), AAC_GETREG4(sc, AAC_RX_OIMR), + AAC_GETREG4(sc, AAC_RX_OISR)); break; case AAC_HWIF_STRONGARM: /* XXX implement */ } } -/******************************************************************************** +/****************************************************************************** * simulate an interrupt for controller 0 */ void @@ -139,7 +146,7 @@ aac_intr0(void) aac_intr(sc); } -/******************************************************************************** +/****************************************************************************** * Panic in a slightly informative fashion */ void @@ -149,7 +156,7 @@ aac_panic(struct aac_softc *sc, char *reason) panic(reason); } -/******************************************************************************** +/****************************************************************************** * Print a FIB */ void @@ -179,13 +186,18 @@ aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller) "\24FAST_RESPONSE" "\25APIFIB\n"); device_printf(sc->aac_dev, " Command %d\n", fib->Header.Command); - device_printf(sc->aac_dev, " StructType %d\n", fib->Header.StructType); + device_printf(sc->aac_dev, " StructType %d\n", + fib->Header.StructType); device_printf(sc->aac_dev, " Flags 0x%x\n", fib->Header.Flags); device_printf(sc->aac_dev, " Size %d\n", fib->Header.Size); - device_printf(sc->aac_dev, " SenderSize %d\n", fib->Header.SenderSize); - device_printf(sc->aac_dev, " SenderAddress 0x%x\n", fib->Header.SenderFibAddress); - device_printf(sc->aac_dev, " ReceiverAddress 0x%x\n", fib->Header.ReceiverFibAddress); - device_printf(sc->aac_dev, " SenderData 0x%x\n", fib->Header.SenderData); + device_printf(sc->aac_dev, " SenderSize %d\n", + fib->Header.SenderSize); + device_printf(sc->aac_dev, " SenderAddress 0x%x\n", + fib->Header.SenderFibAddress); + device_printf(sc->aac_dev, " ReceiverAddress 0x%x\n", + fib->Header.ReceiverFibAddress); + device_printf(sc->aac_dev, " SenderData 0x%x\n", + fib->Header.SenderData); switch(fib->Header.Command) { case ContainerCommand: { @@ -199,15 +211,18 @@ aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller) sg = &br->SgMap; } if (bw->Command == VM_CtBlockWrite) { - device_printf(sc->aac_dev, " BlockWrite: container %d 0x%x/%d (%s)\n", - bw->ContainerId, bw->BlockNumber, bw->ByteCount, - bw->Stable == CSTABLE ? "stable" : "unstable"); + device_printf(sc->aac_dev, " BlockWrite: container %d 0x%x/%d " + "(%s)\n", bw->ContainerId, bw->BlockNumber, + bw->ByteCount, bw->Stable == CSTABLE ? "stable" : + "unstable"); sg = &bw->SgMap; } if (sg != NULL) { device_printf(sc->aac_dev, " %d s/g entries\n", sg->SgCount); for (i = 0; i < sg->SgCount; i++) - device_printf(sc->aac_dev, " 0x%08x/%d\n", sg->SgEntry[i].SgAddress, sg->SgEntry[i].SgByteCount); + device_printf(sc->aac_dev, " 0x%08x/%d\n", + sg->SgEntry[i].SgAddress, + sg->SgEntry[i].SgByteCount); } break; } @@ -218,7 +233,7 @@ aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller) } } -/******************************************************************************** +/****************************************************************************** * Describe an AIF we have received. */ void @@ -230,33 +245,40 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) switch(aif->data.EN.type) { case AifEnGeneric: /* Generic notification */ device_printf(sc->aac_dev, "(Generic) %.*s\n", - (int)sizeof(aif->data.EN.data.EG), aif->data.EN.data.EG.text); + (int)sizeof(aif->data.EN.data.EG), + aif->data.EN.data.EG.text); break; case AifEnTaskComplete: /* Task has completed */ device_printf(sc->aac_dev, "(TaskComplete)\n"); break; - case AifEnConfigChange: /* Adapter configuration change occurred */ + case AifEnConfigChange: /* Adapter configuration change + * occurred */ device_printf(sc->aac_dev, "(ConfigChange)\n"); break; - case AifEnContainerChange: /* Adapter specific container configuration change */ + case AifEnContainerChange: /* Adapter specific container + * configuration change */ device_printf(sc->aac_dev, "(ContainerChange) container %d,%d\n", aif->data.EN.data.ECC.container[0], aif->data.EN.data.ECC.container[1]); break; case AifEnDeviceFailure: /* SCSI device failed */ device_printf(sc->aac_dev, "(DeviceFailure) handle %d\n", - aif->data.EN.data.EDF.deviceHandle); /* XXX interpret */ + aif->data.EN.data.EDF.deviceHandle); /* XXX + * interpret */ break; case AifEnMirrorFailover: /* Mirror failover started */ - device_printf(sc->aac_dev, "(MirrorFailover) container %d failed, migrating from slice %d to %d\n", + device_printf(sc->aac_dev, "(MirrorFailover) container %d failed, " + "migrating from slice %d to %d\n", aif->data.EN.data.EMF.container, aif->data.EN.data.EMF.failedSlice, aif->data.EN.data.EMF.creatingSlice); break; - case AifEnContainerEvent: /* Significant container event */ - device_printf(sc->aac_dev, "(ContainerEvent) container %d event %d\n", - aif->data.EN.data.ECE.container, - aif->data.EN.data.ECE.eventType); /* XXX interpret? */ + case AifEnContainerEvent: /* Significant container + * event */ + device_printf(sc->aac_dev, "(ContainerEvent) container %d event " + "%d\n", aif->data.EN.data.ECE.container, + aif->data.EN.data.ECE.eventType); /* XXX + * interpret? */ break; case AifEnFileSystemChange: /* File system changed */ device_printf(sc->aac_dev, "(FileSystemChange)\n"); @@ -267,31 +289,35 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) case AifEnConfigResume: /* Container resume event */ device_printf(sc->aac_dev, "(ConfigResume)\n"); break; - case AifEnFailoverChange: /* Failover space assignment changed */ + case AifEnFailoverChange: /* Failover space assignment + * changed */ device_printf(sc->aac_dev, "(FailoverChange)\n"); break; case AifEnRAID5RebuildDone: /* RAID5 rebuild finished */ device_printf(sc->aac_dev, "(RAID5RebuildDone)\n"); break; case AifEnEnclosureManagement: /* Enclosure management event */ - device_printf(sc->aac_dev, "(EnclosureManagement) EMPID %d unit %d event %d\n", - aif->data.EN.data.EEE.empID, + device_printf(sc->aac_dev, "(EnclosureManagement) EMPID %d unit %d " + "event %d\n", aif->data.EN.data.EEE.empID, aif->data.EN.data.EEE.unitID, aif->data.EN.data.EEE.eventType); break; - case AifEnBatteryEvent: /* Significant NV battery event */ - device_printf(sc->aac_dev, "(BatteryEvent) %d (state was %d, is %d)\n", - aif->data.EN.data.EBE.transition_type, /* XXX interpret */ - aif->data.EN.data.EBE.current_state, - aif->data.EN.data.EBE.prior_state); + case AifEnBatteryEvent: /* Significant NV battery + * event */ + device_printf(sc->aac_dev, "(BatteryEvent) %d (state was %d, " + "is %d\n", aif->data.EN.data.EBE.transition_type, + aif->data.EN.data.EBE.current_state, /* XXX */ + aif->data.EN.data.EBE.prior_state); /* interpret? */ break; - case AifEnAddContainer: /* A new container was created. */ + case AifEnAddContainer: /* A new container was + * created. */ device_printf(sc->aac_dev, "(AddContainer)\n"); break; case AifEnDeleteContainer: /* A container was deleted. */ device_printf(sc->aac_dev, "(DeleteContainer)\n"); break; - case AifEnBatteryNeedsRecond: /* The battery needs reconditioning */ + case AifEnBatteryNeedsRecond: /* The battery needs + * reconditioning */ device_printf(sc->aac_dev, "(BatteryNeedsRecond)\n"); break; case AifEnClusterEvent: /* Some cluster event */ @@ -299,15 +325,17 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) aif->data.EN.data.ECLE.eventType); break; case AifEnDiskSetEvent: /* A disk set event occured. */ - device_printf(sc->aac_dev, "(DiskSetEvent) event %d diskset %lld creator %lld\n", - aif->data.EN.data.EDS.eventType, + device_printf(sc->aac_dev, "(DiskSetEvent) event %d diskset %lld " + "creator %lld\n", aif->data.EN.data.EDS.eventType, aif->data.EN.data.EDS.DsNum, aif->data.EN.data.EDS.CreatorId); break; - case AifDenMorphComplete: /* A morph operation completed */ + case AifDenMorphComplete: /* A morph operation + * completed */ device_printf(sc->aac_dev, "(MorphComplete)\n"); break; - case AifDenVolumeExtendComplete: /* A volume expand operation completed */ + case AifDenVolumeExtendComplete: /* A volume expand operation + * completed */ device_printf(sc->aac_dev, "(VolumeExtendComplete)\n"); break; default: @@ -335,20 +363,28 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) status = "unknown status"; break; } - device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n", aif->seqNumber, status, - aif->data.PR[0].currentTick, aif->data.PR[0].finalTick); + device_printf(sc->aac_dev, "JobProgress (%d) - %s (%d, %d)\n", + aif->seqNumber, status, aif->data.PR[0].currentTick, + aif->data.PR[0].finalTick); switch(aif->data.PR[0].jd.type) { - case AifJobScsiZero: /* SCSI device clear operation */ - device_printf(sc->aac_dev, "(ScsiZero) handle %d\n", aif->data.PR[0].jd.client.scsi_dh); + case AifJobScsiZero: /* SCSI dev clear operation */ + device_printf(sc->aac_dev, "(ScsiZero) handle %d\n", + aif->data.PR[0].jd.client.scsi_dh); break; - case AifJobScsiVerify: /* SCSI device Verify operation NO REPAIR */ - device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n", aif->data.PR[0].jd.client.scsi_dh); + case AifJobScsiVerify: /* SCSI device Verify operation + * NO REPAIR */ + device_printf(sc->aac_dev, "(ScsiVerify) handle %d\n", + aif->data.PR[0].jd.client.scsi_dh); break; - case AifJobScsiExercise: /* SCSI device Exercise operation */ - device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n", aif->data.PR[0].jd.client.scsi_dh); + case AifJobScsiExercise: /* SCSI device Exercise + * operation */ + device_printf(sc->aac_dev, "(ScsiExercise) handle %d\n", + aif->data.PR[0].jd.client.scsi_dh); break; - case AifJobScsiVerifyRepair: /* SCSI device Verify operation WITH repair */ - device_printf(sc->aac_dev, "(ScsiVerifyRepair) handle %d\n", aif->data.PR[0].jd.client.scsi_dh); + case AifJobScsiVerifyRepair: /* SCSI device Verify operation + * WITH repair */ + device_printf(sc->aac_dev, "(ScsiVerifyRepair) handle %d\n", + aif->data.PR[0].jd.client.scsi_dh); break; case AifJobCtrZero: /* Container clear operation */ device_printf(sc->aac_dev, "(ConatainerZero) container %d\n", @@ -356,51 +392,67 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) break; case AifJobCtrCopy: /* Container copy operation */ device_printf(sc->aac_dev, "(ConatainerCopy) container %d to %d\n", - aif->data.PR[0].jd.client.container.src, aif->data.PR[0].jd.client.container.dst); - break; - case AifJobCtrCreateMirror: /* Container Create Mirror operation */ - device_printf(sc->aac_dev, "(ConatainerCreateMirror) container %d\n", - aif->data.PR[0].jd.client.container.src); /* XXX two containers? */ - break; - case AifJobCtrMergeMirror: /* Container Merge Mirror operation */ - device_printf(sc->aac_dev, "(ConatainerMergeMirror) container %d\n", - aif->data.PR[0].jd.client.container.src); /* XXX two containers? */ - break; - case AifJobCtrScrubMirror: /* Container Scrub Mirror operation */ - device_printf(sc->aac_dev, "(ConatainerScrubMirror) container %d\n", + aif->data.PR[0].jd.client.container.src, + aif->data.PR[0].jd.client.container.dst); + break; + case AifJobCtrCreateMirror: /* Container Create Mirror + * operation */ + device_printf(sc->aac_dev, "(ConatainerCreateMirror) container " + "%d\n", aif->data.PR[0].jd.client.container.src); + /* XXX two containers? */ + break; + case AifJobCtrMergeMirror: /* Container Merge Mirror + * operation */ + device_printf(sc->aac_dev, "(ConatainerMergeMirror) container %d\n", aif->data.PR[0].jd.client.container.src); + /* XXX two containers? */ break; - case AifJobCtrRebuildRaid5: /* Container Rebuild Raid5 operation */ - device_printf(sc->aac_dev, "(ConatainerRebuildRaid5) container %d\n", + case AifJobCtrScrubMirror: /* Container Scrub Mirror + * operation */ + device_printf(sc->aac_dev, "(ConatainerScrubMirror) container %d\n", aif->data.PR[0].jd.client.container.src); break; - case AifJobCtrScrubRaid5: /* Container Scrub Raid5 operation */ + case AifJobCtrRebuildRaid5: /* Container Rebuild Raid5 + * operation */ + device_printf(sc->aac_dev, "(ConatainerRebuildRaid5) container " + "%d\n", aif->data.PR[0].jd.client.container.src); + break; + case AifJobCtrScrubRaid5: /* Container Scrub Raid5 + * operation */ device_printf(sc->aac_dev, "(ConatainerScrubRaid5) container %d\n", aif->data.PR[0].jd.client.container.src); break; case AifJobCtrMorph: /* Container morph operation */ device_printf(sc->aac_dev, "(ConatainerMorph) container %d\n", - aif->data.PR[0].jd.client.container.src); /* XXX two containers? */ + aif->data.PR[0].jd.client.container.src); + /* XXX two containers? */ break; - case AifJobCtrPartCopy: /* Container Partition copy operation */ - device_printf(sc->aac_dev, "(ConatainerPartCopy) container %d to %d\n", - aif->data.PR[0].jd.client.container.src, aif->data.PR[0].jd.client.container.dst); + case AifJobCtrPartCopy: /* Container Partition copy + * operation */ + device_printf(sc->aac_dev, "(ConatainerPartCopy) container %d to " + "%d\n", aif->data.PR[0].jd.client.container.src, + aif->data.PR[0].jd.client.container.dst); break; - case AifJobCtrRebuildMirror: /* Container Rebuild Mirror operation */ - device_printf(sc->aac_dev, "(ConatainerRebuildMirror) container %d\n", - aif->data.PR[0].jd.client.container.src); + case AifJobCtrRebuildMirror: /* Container Rebuild Mirror + * operation */ + device_printf(sc->aac_dev, "(ConatainerRebuildMirror) container " + "%d\n", aif->data.PR[0].jd.client.container.src); break; case AifJobCtrCrazyCache: /* crazy cache */ device_printf(sc->aac_dev, "(ConatainerCrazyCache) container %d\n", - aif->data.PR[0].jd.client.container.src); /* XXX two containers? */ + aif->data.PR[0].jd.client.container.src); + /* XXX two containers? */ break; - case AifJobFsCreate: /* File System Create operation */ + case AifJobFsCreate: /* File System Create + * operation */ device_printf(sc->aac_dev, "(FsCreate)\n"); break; - case AifJobFsVerify: /* File System Verify operation */ + case AifJobFsVerify: /* File System Verify + * operation */ device_printf(sc->aac_dev, "(FsVerivy)\n"); break; - case AifJobFsExtend: /* File System Extend operation */ + case AifJobFsExtend: /* File System Extend + * operation */ device_printf(sc->aac_dev, "(FsExtend)\n"); break; case AifJobApiFormatNTFS: /* Format a drive to NTFS */ @@ -409,7 +461,8 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) case AifJobApiFormatFAT: /* Format a drive to FAT */ device_printf(sc->aac_dev, "(FormatFAT)\n"); break; - case AifJobApiUpdateSnapshot: /* update the read/write half of a snapshot */ + case AifJobApiUpdateSnapshot: /* update the read/write half + * of a snapshot */ device_printf(sc->aac_dev, "(UpdateSnapshot)\n"); break; case AifJobApiFormatFAT32: /* Format a drive to FAT32 */ @@ -431,7 +484,8 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif) device_printf(sc->aac_dev, "DriverNotify (%d)\n", aif->seqNumber); break; default: - device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command, aif->seqNumber); + device_printf(sc->aac_dev, "AIF %d (%d)\n", aif->command, + aif->seqNumber); break; } } diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 564f79e..c240256 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -1,6 +1,8 @@ /*- * Copyright (c) 2000 Michael Smith + * Copyright (c) 2001 Scott Long * Copyright (c) 2000 BSDi + * Copyright (c) 2001 Adaptec, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,7 +99,7 @@ static driver_t aac_disk_driver = { DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, 0, 0); -/******************************************************************************** +/****************************************************************************** * Handle open from generic layer. * * This is called by the diskslice code on first open in order to get the @@ -133,7 +135,7 @@ aac_disk_open(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -/******************************************************************************** +/****************************************************************************** * Handle last close of the disk device. */ static int @@ -150,7 +152,7 @@ aac_disk_close(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -/******************************************************************************** +/****************************************************************************** * Handle an I/O request. */ static void @@ -176,7 +178,7 @@ aac_disk_strategy(struct bio *bp) return; } -/******************************************************************************** +/****************************************************************************** * Handle completion of an I/O request. */ void @@ -192,7 +194,7 @@ aac_biodone(struct bio *bp) biodone(bp); } -/******************************************************************************** +/****************************************************************************** * Stub only. */ static int @@ -204,7 +206,7 @@ aac_disk_probe(device_t dev) return (0); } -/******************************************************************************** +/****************************************************************************** * Attach a unit to the controller. */ static int @@ -217,11 +219,15 @@ aac_disk_attach(device_t dev) debug_called(4); /* initialise our softc */ - sc->ad_controller = (struct aac_softc *)device_get_softc(device_get_parent(dev)); + sc->ad_controller = + (struct aac_softc *)device_get_softc(device_get_parent(dev)); sc->ad_container = device_get_ivars(dev); sc->ad_dev = dev; - /* require that extended translation be enabled - other drivers read the disk! */ + /* + * require that extended translation be enabled - other drivers read the + * disk! + */ sc->ad_size = sc->ad_container->co_mntobj.Capacity; if (sc->ad_size >= (2 * 1024 * 1024)) { /* 2GB */ sc->ad_heads = 255; @@ -238,33 +244,39 @@ aac_disk_attach(device_t dev) device_printf(dev, "%uMB (%u sectors)\n", sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), sc->ad_size); - devstat_add_entry(&sc->ad_stats, "aacd", device_get_unit(dev), AAC_BLOCK_SIZE, - DEVSTAT_NO_ORDERED_TAGS, + devstat_add_entry(&sc->ad_stats, "aacd", device_get_unit(dev), + AAC_BLOCK_SIZE, DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_ARRAY); /* attach a generic disk device to ourselves */ - sc->ad_dev_t = disk_create(device_get_unit(dev), &sc->ad_disk, 0, &aac_disk_cdevsw, &aac_disk_disk_cdevsw); + sc->ad_dev_t = disk_create(device_get_unit(dev), &sc->ad_disk, 0, + &aac_disk_cdevsw, &aac_disk_disk_cdevsw); sc->ad_dev_t->si_drv1 = sc; #ifdef FREEBSD_4 disks_registered++; #endif /* - * We can calculate the maximum number of s/g entries based on the size of the - * FIB and the command structures packed within it. + * We can calculate the maximum number of s/g entries based on the size of + * the FIB and the command structures packed within it. */ sgspace = (sizeof(struct aac_fib) - sizeof(struct aac_fib_header) - - imax(sizeof(struct aac_blockwrite), sizeof(struct aac_blockread))); - maxsg = (sgspace - sizeof(struct aac_sg_table)) / sizeof(struct aac_sg_entry); - - /* set the maximum I/O size to the theoretical worst maximum allowed by the S/G list size */ + imax(sizeof(struct aac_blockwrite), + sizeof(struct aac_blockread))); + maxsg = (sgspace - sizeof(struct aac_sg_table)) / + sizeof(struct aac_sg_entry); + + /* + * set the maximum I/O size to the theoretical worst maximum allowed by the + * S/G list size + */ sc->ad_dev_t->si_iosize_max = (maxsg - 1) * PAGE_SIZE; return (0); } -/******************************************************************************** +/****************************************************************************** * Disconnect ourselves from the system. */ static int diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c index bd264ee..d569761 100644 --- a/sys/dev/aac/aac_pci.c +++ b/sys/dev/aac/aac_pci.c @@ -1,6 +1,8 @@ /*- * Copyright (c) 2000 Michael Smith + * Copyright (c) 2001 Scott Long * Copyright (c) 2000 BSDi + * Copyright (c) Adaptec, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -104,7 +106,7 @@ struct aac_ident {0, 0, 0, 0, 0, 0} }; -/******************************************************************************** +/****************************************************************************** * Determine whether this is one of our supported adapters. */ static int @@ -127,7 +129,7 @@ aac_pci_probe(device_t dev) return(ENXIO); } -/******************************************************************************** +/****************************************************************************** * Allocate resources for our device, set up the bus interface. */ static int @@ -169,8 +171,9 @@ aac_pci_attach(device_t dev) * Allocate the PCI register window. */ sc->aac_regs_rid = 0x10; /* first base address register */ - if ((sc->aac_regs_resource = bus_alloc_resource(sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid, - 0, ~0, 1, RF_ACTIVE)) == NULL) { + if ((sc->aac_regs_resource = bus_alloc_resource(sc->aac_dev, SYS_RES_MEMORY, + &sc->aac_regs_rid, 0, ~0, 1, + RF_ACTIVE)) == NULL) { device_printf(sc->aac_dev, "couldn't allocate register window\n"); goto out; } @@ -181,12 +184,14 @@ aac_pci_attach(device_t dev) * Allocate and connect our interrupt. */ sc->aac_irq_rid = 0; - if ((sc->aac_irq = bus_alloc_resource(sc->aac_dev, SYS_RES_IRQ, &sc->aac_irq_rid, - 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + if ((sc->aac_irq = bus_alloc_resource(sc->aac_dev, SYS_RES_IRQ, + &sc->aac_irq_rid, 0, ~0, 1, + RF_SHAREABLE | RF_ACTIVE)) == NULL) { device_printf(sc->aac_dev, "can't allocate interrupt\n"); goto out; } - if (bus_setup_intr(sc->aac_dev, sc->aac_irq, INTR_TYPE_BIO|INTR_ENTROPY, aac_intr, sc, &sc->aac_intr)) { + if (bus_setup_intr(sc->aac_dev, sc->aac_irq, INTR_TYPE_BIO|INTR_ENTROPY, + aac_intr, sc, &sc->aac_intr)) { device_printf(sc->aac_dev, "can't set up interrupt\n"); goto out; } @@ -200,7 +205,7 @@ aac_pci_attach(device_t dev) * Note that some of these controllers are 64-bit capable. */ if (bus_dma_tag_create(NULL, /* parent */ - 1, 0, /* alignment, boundary */ + 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -216,7 +221,7 @@ aac_pci_attach(device_t dev) * Create DMA tag for mapping buffers into controller-addressable space. */ if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ + 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -231,21 +236,23 @@ aac_pci_attach(device_t dev) /* * Create DMA tag for mapping FIBs into controller-addressable space.. */ - if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - AAC_FIB_COUNT * sizeof(struct aac_fib), 1, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - 0, /* flags */ + if (bus_dma_tag_create(sc->aac_parent_dmat, /* parent */ + 1, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + AAC_FIB_COUNT * + sizeof(struct aac_fib), 1, /* maxsize, nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ &sc->aac_fib_dmat)) { device_printf(sc->aac_dev, "can't allocate FIB DMA tag\n"); goto out; } /* - * Detect the hardware interface version, set up the bus interface indirection. + * Detect the hardware interface version, set up the bus interface + * indirection. */ sc->aac_hwif = AAC_HWIF_UNKNOWN; for (i = 0; aac_identifiers[i].vendor != 0; i++) { diff --git a/sys/dev/aac/aacreg.h b/sys/dev/aac/aacreg.h index 3fda514..848c0b3 100644 --- a/sys/dev/aac/aacreg.h +++ b/sys/dev/aac/aacreg.h @@ -1,7 +1,8 @@ /*- * Copyright (c) 2000 Michael Smith - * Copyright (c) 2000 Scott Long + * Copyright (c) 2001 Scott Long * Copyright (c) 2000 BSDi + * Copyright (c) 2001 Adaptec, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,13 +36,13 @@ * two slightly easier. */ -/******************************************************************************** +/****************************************************************************** * Misc. magic numbers. */ #define AAC_MAX_CONTAINERS 64 #define AAC_BLOCK_SIZE 512 -/******************************************************************************** +/****************************************************************************** * Communications interface. * * Where datastructure layouts are closely parallel to the Adaptec sample code, @@ -52,14 +53,22 @@ * We establish 4 command queues and matching response queues. Queues must * be 16-byte aligned, and are sized as follows: */ -#define AAC_HOST_NORM_CMD_ENTRIES 8 /* command adapter->host, normal priority */ -#define AAC_HOST_HIGH_CMD_ENTRIES 4 /* command adapter->host, high priority */ -#define AAC_ADAP_NORM_CMD_ENTRIES 512 /* command host->adapter, normal priority */ -#define AAC_ADAP_HIGH_CMD_ENTRIES 4 /* command host->adapter, high priority */ -#define AAC_HOST_NORM_RESP_ENTRIES 512 /* response, adapter->host, normal priority */ -#define AAC_HOST_HIGH_RESP_ENTRIES 4 /* response, adapter->host, high priority */ -#define AAC_ADAP_NORM_RESP_ENTRIES 8 /* response, host->adapter, normal priority */ -#define AAC_ADAP_HIGH_RESP_ENTRIES 4 /* response, host->adapter, high priority */ +#define AAC_HOST_NORM_CMD_ENTRIES 8 /* command adapter->host, + * normal priority */ +#define AAC_HOST_HIGH_CMD_ENTRIES 4 /* command adapter->host, + * high priority */ +#define AAC_ADAP_NORM_CMD_ENTRIES 512 /* command host->adapter, + * normal priority */ +#define AAC_ADAP_HIGH_CMD_ENTRIES 4 /* command host->adapter, + * high priority */ +#define AAC_HOST_NORM_RESP_ENTRIES 512 /* response, adapter->host, + * normal priority */ +#define AAC_HOST_HIGH_RESP_ENTRIES 4 /* response, adapter->host, + * high priority */ +#define AAC_ADAP_NORM_RESP_ENTRIES 8 /* response, host->adapter, + * normal priority */ +#define AAC_ADAP_HIGH_RESP_ENTRIES 4 /* response, host->adapter, + * high priority */ #define AAC_TOTALQ_LENGTH (AAC_HOST_HIGH_CMD_ENTRIES + \ AAC_HOST_NORM_CMD_ENTRIES + \ @@ -89,14 +98,14 @@ struct aac_queue_table { u_int32_t qt_qindex[AAC_QUEUE_COUNT][2]; /* queue entry structures (layout mandated by adapter) */ - struct aac_queue_entry qt_HostNormCmdQueue [AAC_HOST_NORM_CMD_ENTRIES]; - struct aac_queue_entry qt_HostHighCmdQueue [AAC_HOST_HIGH_CMD_ENTRIES]; - struct aac_queue_entry qt_AdapNormCmdQueue [AAC_ADAP_NORM_CMD_ENTRIES]; - struct aac_queue_entry qt_AdapHighCmdQueue [AAC_ADAP_HIGH_CMD_ENTRIES]; - struct aac_queue_entry qt_HostNormRespQueue[AAC_HOST_NORM_RESP_ENTRIES]; - struct aac_queue_entry qt_HostHighRespQueue[AAC_HOST_HIGH_RESP_ENTRIES]; - struct aac_queue_entry qt_AdapNormRespQueue[AAC_ADAP_NORM_RESP_ENTRIES]; - struct aac_queue_entry qt_AdapHighRespQueue[AAC_ADAP_HIGH_RESP_ENTRIES]; + struct aac_queue_entry qt_HostNormCmdQueue [AAC_HOST_NORM_CMD_ENTRIES]; + struct aac_queue_entry qt_HostHighCmdQueue [AAC_HOST_HIGH_CMD_ENTRIES]; + struct aac_queue_entry qt_AdapNormCmdQueue [AAC_ADAP_NORM_CMD_ENTRIES]; + struct aac_queue_entry qt_AdapHighCmdQueue [AAC_ADAP_HIGH_CMD_ENTRIES]; + struct aac_queue_entry qt_HostNormRespQueue[AAC_HOST_NORM_RESP_ENTRIES]; + struct aac_queue_entry qt_HostHighRespQueue[AAC_HOST_HIGH_RESP_ENTRIES]; + struct aac_queue_entry qt_AdapNormRespQueue[AAC_ADAP_NORM_RESP_ENTRIES]; + struct aac_queue_entry qt_AdapHighRespQueue[AAC_ADAP_HIGH_RESP_ENTRIES]; } __attribute__ ((packed)); /* @@ -218,28 +227,28 @@ typedef enum { /* * FIB transfer state */ -#define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */ -#define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */ -#define AAC_FIBSTATE_INITIALISED (1<<2) /* initialised */ -#define AAC_FIBSTATE_EMPTY (1<<3) /* empty */ -#define AAC_FIBSTATE_FROMPOOL (1<<4) /* allocated from pool */ -#define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */ -#define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */ -#define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */ -#define AAC_FIBSTATE_RNOTEXPECTED (1<<8) /* response is not expected */ -#define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */ -#define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */ -#define AAC_FIBSTATE_HIGH (1<<11) /* high priority */ -#define AAC_FIBSTATE_NORM (1<<12) /* normal priority */ -#define AAC_FIBSTATE_ASYNC (1<<13) -#define AAC_FIBSTATE_ASYNCIO (1<<13) /* to be removed */ -#define AAC_FIBSTATE_PAGEFILEIO (1<<14) /* to be removed */ -#define AAC_FIBSTATE_SHUTDOWN (1<<15) -#define AAC_FIBSTATE_LAZYWRITE (1<<16) /* to be removed */ -#define AAC_FIBSTATE_ADAPMICROFIB (1<<17) -#define AAC_FIBSTATE_BIOSFIB (1<<18) -#define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */ -#define AAC_FIBSTATE_APIFIB (1<<20) +#define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */ +#define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */ +#define AAC_FIBSTATE_INITIALISED (1<<2) /* initialised */ +#define AAC_FIBSTATE_EMPTY (1<<3) /* empty */ +#define AAC_FIBSTATE_FROMPOOL (1<<4) /* allocated from pool */ +#define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */ +#define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */ +#define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */ +#define AAC_FIBSTATE_RNOTEXPECTED (1<<8) /* response is not expected */ +#define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */ +#define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */ +#define AAC_FIBSTATE_HIGH (1<<11) /* high priority */ +#define AAC_FIBSTATE_NORM (1<<12) /* normal priority */ +#define AAC_FIBSTATE_ASYNC (1<<13) +#define AAC_FIBSTATE_ASYNCIO (1<<13) /* to be removed */ +#define AAC_FIBSTATE_PAGEFILEIO (1<<14) /* to be removed */ +#define AAC_FIBSTATE_SHUTDOWN (1<<15) +#define AAC_FIBSTATE_LAZYWRITE (1<<16) /* to be removed */ +#define AAC_FIBSTATE_ADAPMICROFIB (1<<17) +#define AAC_FIBSTATE_BIOSFIB (1<<18) +#define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */ +#define AAC_FIBSTATE_APIFIB (1<<20) /* * FIB error values @@ -275,7 +284,7 @@ struct aac_adapter_init { u_int32_t HostElapsedSeconds; } __attribute__ ((packed)); -/******************************************************************************** +/****************************************************************************** * Shared data types */ /* @@ -312,7 +321,8 @@ typedef enum { FT_FILESYS, /* ADAPTEC's "FSA"(tm) filesystem */ FT_DRIVE, /* physical disk - addressable in scsi by bus/target/lun */ FT_SLICE, /* virtual disk - raw volume - slice */ - FT_PARTITION, /* FSA partition - carved out of a slice - building block for containers */ + FT_PARTITION, /* FSA partition - carved out of a slice - building block + * for containers */ FT_VOLUME, /* Container - Volume Set */ FT_STRIPE, /* Container - Stripe Set */ FT_MIRROR, /* Container - Mirror Set */ @@ -359,7 +369,7 @@ struct aac_container_creation { u_int64_t ViaAdapterSerialNumber; } __attribute__ ((packed)); -/******************************************************************************** +/****************************************************************************** * Revision number handling */ @@ -388,7 +398,7 @@ struct FsaRevision { u_int32_t buildNumber; } __attribute__ ((packed)); -/******************************************************************************** +/****************************************************************************** * Adapter Information */ @@ -488,18 +498,20 @@ struct aac_adapter_info { u_int32_t BufferMem; /* adapter Data Memory */ u_int32_t TotalMem; /* adapter Total Memory */ struct FsaRevision KernelRevision; /* adapter Kernel Software Revision */ - struct FsaRevision MonitorRevision; /* adapter Monitor/Diagnostic Software Revision */ + struct FsaRevision MonitorRevision; /* adapter Monitor/Diagnostic + * Software Revision */ struct FsaRevision HardwareRevision;/* TBD */ struct FsaRevision BIOSRevision; /* adapter BIOS Revision */ u_int32_t ClusteringEnabled; u_int32_t ClusterChannelMask; u_int64_t SerialNumber; AAC_BatteryPlatform batteryPlatform; - u_int32_t SupportedOptions; /* supported features of this controller */ + u_int32_t SupportedOptions; /* supported features of this + * controller */ AAC_OemFlavor OemVariant; } __attribute__ ((packed)); -/******************************************************************************** +/****************************************************************************** * Monitor/Kernel interface. */ @@ -525,7 +537,7 @@ struct aac_adapter_info { #define AAC_UP_AND_RUNNING 0x00000080 #define AAC_KERNEL_PANIC 0x00000100 -/******************************************************************************** +/****************************************************************************** * Data types relating to control and monitoring of the NVRAM/WriteCache * subsystem. */ @@ -576,21 +588,26 @@ struct aac_nvramdevinfo { } __attribute__ ((packed)); struct aac_nvraminfo { - AAC_NVSTATUS NV_Status; /* nvram subsystem status */ - AAC_NVBATTSTATUS NV_BattStatus; /* battery status */ - u_int32_t NV_Size; /* size of WriteCache NVRAM in bytes */ - u_int32_t NV_BufSize; /* size of NVRAM buffers in bytes */ - u_int32_t NV_NBufs; /* number of NVRAM buffers */ - u_int32_t NV_NDirty; /* count of dirty NVRAM buffers */ - u_int32_t NV_NClean; /* count of clean NVRAM buffers */ - u_int32_t NV_NActive; /* count of NVRAM buffers being written */ - u_int32_t NV_NBrokered; /* count of brokered NVRAM buffers */ - struct aac_nvramdevinfo NV_DevInfo[AAC_NFILESYS]; /* per device info */ + AAC_NVSTATUS NV_Status; /* nvram subsystem status */ + AAC_NVBATTSTATUS NV_BattStatus; /* battery status */ + u_int32_t NV_Size; /* size of WriteCache NVRAM in + * bytes */ + u_int32_t NV_BufSize; /* size of NVRAM buffers in + * bytes */ + u_int32_t NV_NBufs; /* number of NVRAM buffers */ + u_int32_t NV_NDirty; /* Num dirty NVRAM buffers */ + u_int32_t NV_NClean; /* Num clean NVRAM buffers */ + u_int32_t NV_NActive; /* Num NVRAM buffers being + * written */ + u_int32_t NV_NBrokered; /* Num brokered NVRAM buffers */ + struct aac_nvramdevinfo NV_DevInfo[AAC_NFILESYS]; /* per device + * info */ u_int32_t NV_BattNeedsReconditioning; /* boolean */ - u_int32_t NV_TotalSize; /* size of all non-volatile memories in bytes */ + u_int32_t NV_TotalSize; /* size of all non-volatile + * memories in bytes */ } __attribute__ ((packed)); -/******************************************************************************** +/****************************************************************************** * Data types relating to adapter-initiated FIBs * * Based on types and structures in <aifstruc.h> @@ -612,9 +629,11 @@ typedef enum { typedef enum { AifJobScsiMin = 1, /* Minimum value for Scsi operation */ AifJobScsiZero, /* SCSI device clear operation */ - AifJobScsiVerify, /* SCSI device Verify operation NO REPAIR */ + AifJobScsiVerify, /* SCSI device Verify operation NO + * REPAIR */ AifJobScsiExercise, /* SCSI device Exercise operation */ - AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH repair */ + AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH + * repair */ AifJobScsiMax = 99, /* Max Scsi value */ AifJobCtrMin, /* Min Ctr op value */ AifJobCtrZero, /* Container clear operation */ @@ -636,7 +655,8 @@ typedef enum { AifJobFsMax = 299, /* Max Fs type operation */ AifJobApiFormatNTFS, /* Format a drive to NTFS */ AifJobApiFormatFAT, /* Format a drive to FAT */ - AifJobApiUpdateSnapshot, /* update the read/write half of a snapshot */ + AifJobApiUpdateSnapshot, /* update the read/write half of a + * snapshot */ AifJobApiFormatFAT32, /* Format a drive to FAT32 */ AifJobApiMax = 399, /* Max API type operation */ AifJobCtlContinuousCtrVerify, /* Adapter operation */ @@ -649,13 +669,16 @@ struct aac_AifContainers { } __attribute__ ((packed)); union aac_AifJobClient { - struct aac_AifContainers container; /* For Container and file system progress ops; */ + struct aac_AifContainers container; /* For Container and file + * system progress ops; */ int32_t scsi_dh; /* For SCSI progress ops */ }; struct aac_AifJobDesc { - u_int32_t jobID; /* DO NOT FILL IN! Will be filled in by AIF */ - AAC_AifJobType type; /* Operation that is being performed */ + u_int32_t jobID; /* DO NOT FILL IN! Will be + * filled in by AIF */ + AAC_AifJobType type; /* Operation that is being + * performed */ union aac_AifJobClient client; /* Details */ } __attribute__ ((packed)); @@ -675,8 +698,9 @@ typedef enum { /* General application notifies start here */ AifEnGeneric = 1, /* Generic notification */ AifEnTaskComplete, /* Task has completed */ - AifEnConfigChange, /* Adapter configuration change occurred */ - AifEnContainerChange, /* Adapter specific container configuration change */ + AifEnConfigChange, /* Adapter config change occurred */ + AifEnContainerChange, /* Adapter specific container + * configuration change */ AifEnDeviceFailure, /* SCSI device failed */ AifEnMirrorFailover, /* Mirror failover started */ AifEnContainerEvent, /* Significant container event */ @@ -714,7 +738,8 @@ struct aac_AifEnsMirrorFailover { } __attribute__ ((packed)); struct aac_AifEnsContainerChange { - u_int32_t container[2]; /* container that changed, -1 if no container */ + u_int32_t container[2]; /* container that changed, -1 if no + * container */ } __attribute__ ((packed)); struct aac_AifEnsContainerEvent { @@ -723,15 +748,16 @@ struct aac_AifEnsContainerEvent { } __attribute__ ((packed)); struct aac_AifEnsEnclosureEvent { - u_int32_t empID; /* enclosure management processor number */ - u_int32_t unitID; /* unitId, fan id, power supply id, slot id, tempsensor id. */ + u_int32_t empID; /* enclosure management proc number */ + u_int32_t unitID; /* unitId, fan id, power supply id, + * slot id, tempsensor id. */ u_int32_t eventType; /* event type */ } __attribute__ ((packed)); struct aac_AifEnsBatteryEvent { - AAC_NVBATT_TRANSITION transition_type; /* e.g. from low to ok */ - AAC_NVBATTSTATUS current_state; /* current battery state */ - AAC_NVBATTSTATUS prior_state; /* previous battery state */ + AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */ + AAC_NVBATTSTATUS current_state; /* current batt state */ + AAC_NVBATTSTATUS prior_state; /* prev batt state */ } __attribute__ ((packed)); struct aac_AifEnsDiskSetEvent { @@ -742,9 +768,11 @@ struct aac_AifEnsDiskSetEvent { typedef enum { CLUSTER_NULL_EVENT = 0, - CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or adaptername from NULL to non-NULL */ + CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or + * adaptername from NULL to non-NULL */ /* (partner's agent may be up) */ - CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or adaptername from non-null to NULL */ + CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or + * adaptername from non-null to NULL */ /* (partner has rebooted) */ } AAC_ClusterAifEvent; @@ -783,7 +811,7 @@ typedef enum { AifReqJobList = 100, /* Gets back complete job list */ AifReqJobsForCtr, /* Gets back jobs for specific container */ AifReqJobsForScsi, /* Gets back jobs for specific SCSI device */ - AifReqJobReport, /* Gets back a specific job report or list of them */ + AifReqJobReport, /* Gets back a specific job report or list */ AifReqTerminateJob, /* Terminates job */ AifReqSuspendJob, /* Suspends a job */ AifReqResumeJob, /* Resumes a job */ @@ -794,8 +822,10 @@ typedef enum { } AAC_AifCommand; struct aac_aif_command { - AAC_AifCommand command; /* Tell host what type of notify this is */ - u_int32_t seqNumber; /* To allow ordering of reports (if necessary) */ + AAC_AifCommand command; /* Tell host what type of + * notify this is */ + u_int32_t seqNumber; /* To allow ordering of + * reports (if necessary) */ union { struct aac_AifEventNotify EN; /* Event notify structure */ struct aac_AifJobProgressReport PR[1]; /* Progress report */ @@ -803,7 +833,7 @@ struct aac_aif_command { } data; } __attribute__ ((packed)); -/******************************************************************************** +/****************************************************************************** * Filesystem commands/data * * The adapter has a very complex filesystem interface, most of which we ignore. @@ -931,7 +961,8 @@ struct aac_mntobj { AAC_FSAVolType VolType; AAC_FType ObjType; u_int32_t ContentState; -#define FSCS_READONLY 0x0002 /* XXX need more information than this */ +#define FSCS_READONLY 0x0002 /* XXX need more information + * than this */ union { u_int32_t pad[8]; } ObjExtension; @@ -1019,7 +1050,7 @@ struct aac_close_command { u_int32_t ContainerId; }; -/******************************************************************************** +/****************************************************************************** * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based * on the SA110 'StrongArm'. */ @@ -1038,33 +1069,33 @@ struct aac_close_command { #define AAC_SA_MAILBOX 0xa8 /* mailbox (20 bytes) */ #define AAC_SA_FWSTATUS 0xc4 -/******************************************************************************** +/****************************************************************************** * Register definitions for the Adaptec 'Pablano' adapters, based on the i960Rx, * and other related adapters. */ -#define AAC_RX_IDBR 0x20 /* inbound doorbell register */ -#define AAC_RX_IISR 0x24 /* inbound interrupt status register */ -#define AAC_RX_IIMR 0x28 /* inbound interrupt mask register */ -#define AAC_RX_ODBR 0x2c /* outbound doorbell register */ -#define AAC_RX_OISR 0x30 /* outbound interrupt status register */ -#define AAC_RX_OIMR 0x34 /* outbound interrupt mask register */ +#define AAC_RX_IDBR 0x20 /* inbound doorbell register */ +#define AAC_RX_IISR 0x24 /* inbound interrupt status register */ +#define AAC_RX_IIMR 0x28 /* inbound interrupt mask register */ +#define AAC_RX_ODBR 0x2c /* outbound doorbell register */ +#define AAC_RX_OISR 0x30 /* outbound interrupt status register */ +#define AAC_RX_OIMR 0x34 /* outbound interrupt mask register */ -#define AAC_RX_MAILBOX 0x50 /* mailbox (20 bytes) */ -#define AAC_RX_FWSTATUS 0x6c +#define AAC_RX_MAILBOX 0x50 /* mailbox (20 bytes) */ +#define AAC_RX_FWSTATUS 0x6c -/******************************************************************************** +/****************************************************************************** * Common bit definitions for the doorbell registers. */ /* * Status bits in the doorbell registers. */ -#define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous FIB */ -#define AAC_DB_COMMAND_READY (1<<1) /* posted one or more commands */ -#define AAC_DB_RESPONSE_READY (1<<2) /* one or more commands complete */ -#define AAC_DB_COMMAND_NOT_FULL (1<<3) /* command queue not full */ -#define AAC_DB_RESPONSE_NOT_FULL (1<<4) /* response queue not full */ +#define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous FIB */ +#define AAC_DB_COMMAND_READY (1<<1) /* posted one or more commands */ +#define AAC_DB_RESPONSE_READY (1<<2) /* one or more commands complete */ +#define AAC_DB_COMMAND_NOT_FULL (1<<3) /* command queue not full */ +#define AAC_DB_RESPONSE_NOT_FULL (1<<4) /* response queue not full */ /* * The adapter can request the host print a message by setting the @@ -1073,10 +1104,10 @@ struct aac_close_command { * DOORBELL0 and setting it in DOORBELL1. * (ODBR and IDBR respectively for the i960Rx adapters) */ -#define AAC_DB_PRINTF (1<<5) /* adapter requests host printf */ +#define AAC_DB_PRINTF (1<<5) /* adapter requests host printf */ /* - * Mask containing the interrupt bits we care about. We don't anticipate (or want) - * interrupts not in this mask. + * Mask containing the interrupt bits we care about. We don't anticipate (or + * want) interrupts not in this mask. */ #define AAC_DB_INTERRUPTS (AAC_DB_COMMAND_READY | AAC_DB_RESPONSE_READY | AAC_DB_PRINTF) diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index 2870531..7c76d56 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -1,6 +1,8 @@ /*- * Copyright (c) 2000 Michael Smith + * Copyright (c) 2001 Scott Long * Copyright (c) 2000 BSDi + * Copyright (c) 2001 Adaptec, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,11 +29,11 @@ * $FreeBSD$ */ -/******************************************************************************** - ******************************************************************************** - Driver Parameter Definitions - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Driver Parameter Definitions + ****************************************************************************** + ******************************************************************************/ /* * The firmware interface allows for a 16-bit s/g list length. We limit @@ -53,8 +55,8 @@ #define AAC_FIB_COUNT 128 /* - * The controller reports status events in AIFs. We hang on to a number of these - * in order to pass them out to user-space management tools. + * The controller reports status events in AIFs. We hang on to a number of + * these in order to pass them out to user-space management tools. */ #define AAC_AIFQ_LENGTH 64 @@ -64,7 +66,8 @@ #define AAC_PRINTF_BUFSIZE 256 /* - * We wait this many seconds for the adapter to come ready if it is still booting + * We wait this many seconds for the adapter to come ready if it is still + * booting */ #define AAC_BOOT_TIMEOUT (3 * 60) @@ -89,11 +92,11 @@ */ #define AAC_DISK_MAJOR 200 -/******************************************************************************** - ******************************************************************************** - Driver Variable Definitions - ******************************************************************************** - ********************************************************************************/ +/****************************************************************************** + ****************************************************************************** + Driver Variable Definitions + ****************************************************************************** + ******************************************************************************/ #include "opt_aac.h" @@ -139,17 +142,23 @@ struct aac_command struct aac_softc *cm_sc; /* controller that owns us */ - struct aac_fib *cm_fib; /* FIB associated with this command */ + struct aac_fib *cm_fib; /* FIB associated with this + * command */ u_int32_t cm_fibphys; /* bus address of the FIB */ - struct bio *cm_data; /* pointer to data in kernel space */ + struct bio *cm_data; /* pointer to data in kernel + * space */ u_int32_t cm_datalen; /* data length */ bus_dmamap_t cm_datamap; /* DMA map for bio data */ - struct aac_sg_table *cm_sgtable; /* pointer to s/g table in command */ + struct aac_sg_table *cm_sgtable; /* pointer to s/g table in + * command */ int cm_flags; -#define AAC_CMD_MAPPED (1<<0) /* command has had its data mapped */ -#define AAC_CMD_DATAIN (1<<1) /* command involves data moving from controller to host */ -#define AAC_CMD_DATAOUT (1<<2) /* command involves data moving from host to controller */ +#define AAC_CMD_MAPPED (1<<0) /* command has had its data + * mapped */ +#define AAC_CMD_DATAIN (1<<1) /* command involves data moving + * from controller to host */ +#define AAC_CMD_DATAOUT (1<<2) /* command involves data moving + * from host to controller */ #define AAC_CMD_COMPLETED (1<<3) /* command has been completed */ #define AAC_CMD_TIMEDOUT (1<<4) /* command taken too long */ @@ -179,7 +188,8 @@ struct aac_common { struct aac_adapter_init ac_init; /* arena within which the queue structures are kept */ - u_int8_t ac_qbuf[sizeof(struct aac_queue_table) + AAC_QUEUE_ALIGN]; + u_int8_t ac_qbuf[sizeof(struct aac_queue_table) + + AAC_QUEUE_ALIGN]; /* buffer for text messages from the controller */ char ac_printf[AAC_PRINTF_BUFSIZE]; @@ -198,7 +208,8 @@ struct aac_interface int (* aif_get_istatus)(struct aac_softc *sc); void (* aif_set_istatus)(struct aac_softc *sc, int mask); void (* aif_set_mailbox)(struct aac_softc *sc, u_int32_t command, - u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3); + u_int32_t arg0, u_int32_t arg1, + u_int32_t arg2, u_int32_t arg3); int (* aif_get_mailboxstatus)(struct aac_softc *sc); void (* aif_set_interrupts)(struct aac_softc *sc, int enable); }; @@ -208,19 +219,27 @@ extern struct aac_interface aac_sa_interface; #define AAC_GET_FWSTATUS(sc) ((sc)->aac_if.aif_get_fwstatus((sc))) #define AAC_QNOTIFY(sc, qbit) ((sc)->aac_if.aif_qnotify((sc), (qbit))) #define AAC_GET_ISTATUS(sc) ((sc)->aac_if.aif_get_istatus((sc))) -#define AAC_CLEAR_ISTATUS(sc, mask) ((sc)->aac_if.aif_set_istatus((sc), (mask))) +#define AAC_CLEAR_ISTATUS(sc, mask) ((sc)->aac_if.aif_set_istatus((sc), \ + (mask))) #define AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3) \ - ((sc)->aac_if.aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), (arg3))) + ((sc)->aac_if.aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \ + (arg3))) #define AAC_GET_MAILBOXSTATUS(sc) ((sc)->aac_if.aif_get_mailboxstatus((sc))) #define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), 0)) #define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), 1)) -#define AAC_SETREG4(sc, reg, val) bus_space_write_4(sc->aac_btag, sc->aac_bhandle, reg, val) -#define AAC_GETREG4(sc, reg) bus_space_read_4 (sc->aac_btag, sc->aac_bhandle, reg) -#define AAC_SETREG2(sc, reg, val) bus_space_write_2(sc->aac_btag, sc->aac_bhandle, reg, val) -#define AAC_GETREG2(sc, reg) bus_space_read_2 (sc->aac_btag, sc->aac_bhandle, reg) -#define AAC_SETREG1(sc, reg, val) bus_space_write_1(sc->aac_btag, sc->aac_bhandle, reg, val) -#define AAC_GETREG1(sc, reg) bus_space_read_1 (sc->aac_btag, sc->aac_bhandle, reg) +#define AAC_SETREG4(sc, reg, val) bus_space_write_4(sc->aac_btag, \ + sc->aac_bhandle, reg, val) +#define AAC_GETREG4(sc, reg) bus_space_read_4 (sc->aac_btag, \ + sc->aac_bhandle, reg) +#define AAC_SETREG2(sc, reg, val) bus_space_write_2(sc->aac_btag, \ + sc->aac_bhandle, reg, val) +#define AAC_GETREG2(sc, reg) bus_space_read_2 (sc->aac_btag, \ + sc->aac_bhandle, reg) +#define AAC_SETREG1(sc, reg, val) bus_space_write_1(sc->aac_btag, \ + sc->aac_bhandle, reg, val) +#define AAC_GETREG1(sc, reg) bus_space_read_1 (sc->aac_btag, \ + sc->aac_bhandle, reg) /* * Per-controller structure. @@ -229,12 +248,14 @@ struct aac_softc { /* bus connections */ device_t aac_dev; - struct resource *aac_regs_resource; /* register interface window */ + struct resource *aac_regs_resource; /* register interface + * window */ int aac_regs_rid; /* resource ID */ bus_space_handle_t aac_bhandle; /* bus space handle */ bus_space_tag_t aac_btag; /* bus space tag */ bus_dma_tag_t aac_parent_dmat; /* parent DMA tag */ - bus_dma_tag_t aac_buffer_dmat; /* data buffer/command DMA tag */ + bus_dma_tag_t aac_buffer_dmat; /* data buffer/command + * DMA tag */ struct resource *aac_irq; /* interrupt */ int aac_irq_rid; void *aac_intr; /* interrupt handle */ @@ -252,24 +273,29 @@ struct aac_softc #define AAC_HWIF_I960RX 0 #define AAC_HWIF_STRONGARM 1 #define AAC_HWIF_UNKNOWN -1 - bus_dma_tag_t aac_common_dmat; /* common structure DMA tag */ - bus_dmamap_t aac_common_dmamap; /* common structure DMA map */ + bus_dma_tag_t aac_common_dmat; /* common structure + * DMA tag */ + bus_dmamap_t aac_common_dmamap; /* common structure + * DMA map */ struct aac_common *aac_common; u_int32_t aac_common_busaddr; struct aac_interface aac_if; /* command/fib resources */ - bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocating FIBs */ + bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocing FIBs */ struct aac_fib *aac_fibs; bus_dmamap_t aac_fibmap; u_int32_t aac_fibphys; struct aac_command aac_command[AAC_FIB_COUNT]; /* command management */ - TAILQ_HEAD(,aac_command) aac_free; /* command structures available for reuse */ - TAILQ_HEAD(,aac_command) aac_ready; /* commands on hold for controller resources */ + TAILQ_HEAD(,aac_command) aac_free; /* command structures + * available for reuse */ + TAILQ_HEAD(,aac_command) aac_ready; /* commands on hold for + * controller resources */ TAILQ_HEAD(,aac_command) aac_busy; - TAILQ_HEAD(,aac_command) aac_complete; /* commands which have been returned by the controller */ + TAILQ_HEAD(,aac_command) aac_complete; /* commands which have been + * returned by the controller */ struct bio_queue_head aac_bioq; struct aac_queue_table *aac_queues; struct aac_queue_entry *aac_qentries[AAC_QUEUE_COUNT]; @@ -281,7 +307,8 @@ struct aac_softc /* delayed activity infrastructure */ #if __FreeBSD_version >= 500005 - struct task aac_task_complete; /* deferred-completion task */ + struct task aac_task_complete; /* deferred-completion + * task */ #endif struct intr_config_hook aac_ich; @@ -314,9 +341,9 @@ extern void aac_biodone(struct bio *bp); * 2 - extremely noisy, emit trace items in loops, etc. */ #ifdef AAC_DEBUG -# define debug(level, fmt, args...) \ - do { \ - if (level <= AAC_DEBUG) printf("%s: " fmt "\n", __FUNCTION__ , ##args); \ +# define debug(level, fmt, args...) \ + do { \ + if (level <=AAC_DEBUG) printf("%s: " fmt "\n", __FUNCTION__ , ##args); \ } while(0) # define debug_called(level) \ do { \ @@ -325,8 +352,10 @@ extern void aac_biodone(struct bio *bp); extern void aac_print_queues(struct aac_softc *sc); extern void aac_panic(struct aac_softc *sc, char *reason); -extern void aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, char *caller); -extern void aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif); +extern void aac_print_fib(struct aac_softc *sc, struct aac_fib *fib, + char *caller); +extern void aac_print_aif(struct aac_softc *sc, + struct aac_aif_command *aif); # define AAC_PRINT_FIB(sc, fib) aac_print_fib(sc, fib, __FUNCTION__) @@ -346,7 +375,7 @@ struct aac_code_lookup { u_int32_t code; }; -/******************************************************************************** +/****************************************************************************** * Queue primitives for driver queues. */ #define AACQ_ADD(sc, qname) \ |