2 * Written by: David Jeffery
3 * Copyright (c) 2002 Adaptec Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * $FreeBSD: src/sys/dev/ips/ips_commands.c,v 1.10 2004/05/30 04:01:29 scottl Exp $
28 * $DragonFly: src/sys/dev/raid/ips/ips_commands.c,v 1.13 2006/12/22 23:26:23 swildner Exp $
31 #include <sys/devicestat.h>
32 #include <dev/raid/ips/ips.h>
33 #include <dev/raid/ips/ips_disk.h>
36 ips_timed_wait(ips_command_t *command, const char *id, int timo)
40 while (command->completed == 0) {
42 if (command->completed == 0)
43 error = tsleep(&command->completed, 0, id, timo);
45 if (error == EWOULDBLOCK) {
54 * This is an interrupt callback. It is called from
55 * interrupt context when the adapter has completed the
56 * command, and wakes up anyone waiting on the command.
59 ips_wakeup_callback(ips_command_t *command)
61 bus_dmamap_sync(command->sc->command_dmatag, command->command_dmamap,
62 BUS_DMASYNC_POSTWRITE);
63 command->completed = 1;
64 wakeup(&command->completed);
68 * Below are a series of functions for sending an IO request
69 * to the adapter. The flow order is: start, send, callback, finish.
70 * The caller must have already assembled an iorequest struct to hold
71 * the details of the IO request.
74 ips_io_request_finish(ips_command_t *command)
76 struct bio *bio = command->arg;
78 if (ips_read_request(bio)) {
79 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
80 BUS_DMASYNC_POSTREAD);
82 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
83 BUS_DMASYNC_POSTWRITE);
85 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
86 if (COMMAND_ERROR(&command->status)) {
87 bio->bio_buf->b_flags |=B_ERROR;
88 bio->bio_buf->b_error = EIO;
90 ips_insert_free_cmd(command->sc, command);
95 ips_io_request_callback(void *cmdptr, bus_dma_segment_t *segments, int segnum,
99 ips_command_t *command = cmdptr;
100 ips_sg_element_t *sg_list;
101 ips_io_cmd *command_struct;
102 struct bio *bio = command->arg;
103 struct buf *bp = bio->bio_buf;
104 ipsdisk_softc_t *dsc;
110 kprintf("ips: error = %d in ips_sg_request_callback\n", error);
111 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
112 bp->b_flags |= B_ERROR;
113 bp->b_error = ENOMEM;
114 ips_insert_free_cmd(sc, command);
118 dsc = bio->bio_driver_info;
119 command_struct = (ips_io_cmd *)command->command_buffer;
120 command_struct->id = command->id;
121 command_struct->drivenum = dsc->sc->drives[dsc->disk_number].drivenum;
124 if (ips_read_request(bio))
125 cmdtype = IPS_SG_READ_CMD;
127 cmdtype = IPS_SG_WRITE_CMD;
128 command_struct->segnum = segnum;
129 sg_list = (ips_sg_element_t *)((u_int8_t *)
130 command->command_buffer + IPS_COMMAND_LEN);
131 for (i = 0; i < segnum; i++) {
132 sg_list[i].addr = segments[i].ds_addr;
133 sg_list[i].len = segments[i].ds_len;
134 length += segments[i].ds_len;
136 command_struct->buffaddr =
137 (u_int32_t)command->command_phys_addr + IPS_COMMAND_LEN;
139 if (ips_read_request(bio))
140 cmdtype = IPS_READ_CMD;
142 cmdtype = IPS_WRITE_CMD;
143 command_struct->buffaddr = segments[0].ds_addr;
144 length = segments[0].ds_len;
146 command_struct->command = cmdtype;
147 command_struct->lba = bio->bio_offset / IPS_BLKSIZE;
148 length = (length + IPS_BLKSIZE - 1)/IPS_BLKSIZE;
149 command_struct->length = length;
150 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
151 BUS_DMASYNC_PREWRITE);
152 if (ips_read_request(bio)) {
153 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
154 BUS_DMASYNC_PREREAD);
156 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
157 BUS_DMASYNC_PREWRITE);
159 PRINTF(10, "ips test: command id: %d segments: %d "
160 "pblkno: %lld length: %d, ds_len: %d\n", command->id, segnum,
161 bio->bio_offset / IPS_BLKSIZE,
162 length, segments[0].ds_len);
164 sc->ips_issue_cmd(command);
169 ips_send_io_request(ips_command_t *command, struct bio *bio)
171 struct buf *bp = bio->bio_buf;
173 command->callback = ips_io_request_finish;
175 PRINTF(10, "ips test: : bcount %ld\n", bp->b_bcount);
176 bus_dmamap_load(command->data_dmatag, command->data_dmamap,
177 bp->b_data, bp->b_bcount,
178 ips_io_request_callback, command, 0);
183 ips_start_io_request(ips_softc_t *sc)
185 ips_command_t *command;
188 bio = bioq_first(&sc->bio_queue);
191 if (ips_get_free_cmd(sc, &command, 0) != 0)
193 bioq_remove(&sc->bio_queue, bio);
194 ips_send_io_request(command, bio);
198 * Below are a series of functions for sending an adapter info request
199 * to the adapter. The flow order is: get, send, callback. It uses
200 * the generic finish callback at the top of this file.
201 * This can be used to get configuration/status info from the card
204 ips_adapter_info_callback(void *cmdptr, bus_dma_segment_t *segments,int segnum,
208 ips_command_t *command = cmdptr;
209 ips_adapter_info_cmd *command_struct;
212 command->status.value = IPS_ERROR_STATUS; /* a lovely error value */
213 ips_insert_free_cmd(sc, command);
214 kprintf("ips: error = %d in ips_get_adapter_info\n", error);
217 command_struct = (ips_adapter_info_cmd *)command->command_buffer;
218 command_struct->command = IPS_ADAPTER_INFO_CMD;
219 command_struct->id = command->id;
220 command_struct->buffaddr = segments[0].ds_addr;
222 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
223 BUS_DMASYNC_PREWRITE);
224 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
225 BUS_DMASYNC_PREREAD);
226 sc->ips_issue_cmd(command);
230 ips_send_adapter_info_cmd(ips_command_t *command)
232 ips_softc_t *sc = command->sc;
235 if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag,
238 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT,
239 /* highaddr */ BUS_SPACE_MAXADDR,
241 /* filterarg */ NULL,
242 /* maxsize */ IPS_ADAPTER_INFO_LEN,
244 /* maxsegsize*/ IPS_ADAPTER_INFO_LEN,
246 &command->data_dmatag) != 0) {
247 kprintf("ips: can't alloc dma tag for adapter status\n");
251 if (bus_dmamem_alloc(command->data_dmatag, &command->data_buffer,
252 BUS_DMA_NOWAIT, &command->data_dmamap)) {
256 command->callback = ips_wakeup_callback;
257 bus_dmamap_load(command->data_dmatag, command->data_dmamap,
258 command->data_buffer, IPS_ADAPTER_INFO_LEN,
259 ips_adapter_info_callback, command, BUS_DMA_NOWAIT);
260 if ((command->status.value == IPS_ERROR_STATUS) ||
261 ips_timed_wait(command, "ips", 30 * hz) != 0)
264 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
265 BUS_DMASYNC_POSTREAD);
266 memcpy(&(sc->adapter_info), command->data_buffer,
267 IPS_ADAPTER_INFO_LEN);
269 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
271 /* I suppose I should clean up my memory allocations */
272 bus_dmamem_free(command->data_dmatag, command->data_buffer,
273 command->data_dmamap);
274 bus_dma_tag_destroy(command->data_dmatag);
275 ips_insert_free_cmd(sc, command);
280 ips_get_adapter_info(ips_softc_t *sc)
282 ips_command_t *command;
285 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
286 device_printf(sc->dev, "unable to get adapter configuration\n");
289 ips_send_adapter_info_cmd(command);
290 if (COMMAND_ERROR(&command->status))
296 * Below are a series of functions for sending a drive info request
297 * to the adapter. The flow order is: get, send, callback. It uses
298 * the generic finish callback at the top of this file.
299 * This can be used to get drive status info from the card
302 ips_drive_info_callback(void *cmdptr, bus_dma_segment_t *segments, int segnum,
306 ips_command_t *command = cmdptr;
307 ips_drive_cmd *command_struct;
312 command->status.value = IPS_ERROR_STATUS;
313 ips_insert_free_cmd(sc, command);
314 kprintf("ips: error = %d in ips_get_drive_info\n", error);
317 command_struct = (ips_drive_cmd *)command->command_buffer;
318 command_struct->command = IPS_DRIVE_INFO_CMD;
319 command_struct->id = command->id;
320 command_struct->buffaddr = segments[0].ds_addr;
321 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
322 BUS_DMASYNC_PREWRITE);
323 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
324 BUS_DMASYNC_PREREAD);
325 sc->ips_issue_cmd(command);
329 ips_send_drive_info_cmd(ips_command_t *command)
332 ips_softc_t *sc = command->sc;
333 ips_drive_info_t *driveinfo;
335 if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag,
338 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT,
339 /* highaddr */ BUS_SPACE_MAXADDR,
341 /* filterarg */ NULL,
342 /* maxsize */ IPS_DRIVE_INFO_LEN,
344 /* maxsegsize*/ IPS_DRIVE_INFO_LEN,
346 &command->data_dmatag) != 0) {
347 kprintf("ips: can't alloc dma tag for drive status\n");
351 if (bus_dmamem_alloc(command->data_dmatag, &command->data_buffer,
352 BUS_DMA_NOWAIT, &command->data_dmamap)) {
356 command->callback = ips_wakeup_callback;
357 bus_dmamap_load(command->data_dmatag, command->data_dmamap,
358 command->data_buffer,IPS_DRIVE_INFO_LEN,
359 ips_drive_info_callback, command, BUS_DMA_NOWAIT);
360 if ((command->status.value == IPS_ERROR_STATUS) ||
361 ips_timed_wait(command, "ips", 10 * hz) != 0)
365 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
366 BUS_DMASYNC_POSTREAD);
367 driveinfo = command->data_buffer;
368 memcpy(sc->drives, driveinfo->drives, sizeof(ips_drive_t) * 8);
369 sc->drivecount = driveinfo->drivecount;
370 device_printf(sc->dev, "logical drives: %d\n", sc->drivecount);
372 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
374 /* I suppose I should clean up my memory allocations */
375 bus_dmamem_free(command->data_dmatag, command->data_buffer,
376 command->data_dmamap);
377 bus_dma_tag_destroy(command->data_dmatag);
378 ips_insert_free_cmd(sc, command);
383 ips_get_drive_info(ips_softc_t *sc)
386 ips_command_t *command;
388 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
389 device_printf(sc->dev, "unable to get drive configuration\n");
392 ips_send_drive_info_cmd(command);
393 if (COMMAND_ERROR(&command->status))
399 * Below is a pair of functions for making sure data is safely
400 * on disk by flushing the adapter's cache.
403 ips_send_flush_cache_cmd(ips_command_t *command)
405 ips_softc_t *sc = command->sc;
406 ips_generic_cmd *command_struct;
408 PRINTF(10,"ips test: got a command, building flush command\n");
409 command->callback = ips_wakeup_callback;
410 command_struct = (ips_generic_cmd *)command->command_buffer;
411 command_struct->command = IPS_CACHE_FLUSH_CMD;
412 command_struct->id = command->id;
413 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
414 BUS_DMASYNC_PREWRITE);
415 sc->ips_issue_cmd(command);
416 if (command->status.value != IPS_ERROR_STATUS)
417 ips_timed_wait(command, "flush2", 0);
418 ips_insert_free_cmd(sc, command);
423 ips_flush_cache(ips_softc_t *sc)
425 ips_command_t *command;
427 device_printf(sc->dev, "flushing cache\n");
428 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
429 device_printf(sc->dev, "ERROR: unable to get a command! "
430 "can't flush cache!\n");
433 ips_send_flush_cache_cmd(command);
434 if (COMMAND_ERROR(&command->status)) {
435 device_printf(sc->dev, "ERROR: cache flush command failed!\n");
442 * Simplified localtime to provide timevalues for ffdc.
443 * Taken from libc/stdtime/localtime.c
446 ips_ffdc_settime(ips_adapter_ffdc_cmd *command, time_t sctime)
449 int yleap, *ip, month;
450 int year_lengths[2] = { IPS_DAYSPERNYEAR, IPS_DAYSPERLYEAR };
451 int mon_lengths[2][IPS_MONSPERYEAR] = {
452 { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
453 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
456 days = sctime / IPS_SECSPERDAY;
457 rem = sctime % IPS_SECSPERDAY;
459 command->hour = rem / IPS_SECSPERHOUR;
460 rem = rem % IPS_SECSPERHOUR;
462 command->minute = rem / IPS_SECSPERMIN;
463 command->second = rem % IPS_SECSPERMIN;
466 while (days < 0 || days >= (long)year_lengths[yleap = ips_isleap(y)]) {
469 newy = y + days / IPS_DAYSPERNYEAR;
472 days -= (newy - y) * IPS_DAYSPERNYEAR +
473 IPS_LEAPS_THRU_END_OF(newy - 1) -
474 IPS_LEAPS_THRU_END_OF(y - 1);
477 command->yearH = y / 100;
478 command->yearL = y % 100;
479 ip = mon_lengths[yleap];
480 for (month = 0; days >= (long)ip[month]; ++month)
481 days = days - (long)ip[month];
482 command->month = month + 1;
483 command->day = days + 1;
487 ips_send_ffdc_reset_cmd(ips_command_t *command)
489 ips_softc_t *sc = command->sc;
490 ips_adapter_ffdc_cmd *command_struct;
492 PRINTF(10, "ips test: got a command, building ffdc reset command\n");
493 command->callback = ips_wakeup_callback;
494 command_struct = (ips_adapter_ffdc_cmd *)command->command_buffer;
495 command_struct->command = IPS_FFDC_CMD;
496 command_struct->id = command->id;
497 command_struct->reset_count = sc->ffdc_resetcount;
498 command_struct->reset_type = 0x0;
499 ips_ffdc_settime(command_struct, sc->ffdc_resettime.tv_sec);
500 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
501 BUS_DMASYNC_PREWRITE);
502 sc->ips_issue_cmd(command);
503 if (command->status.value != IPS_ERROR_STATUS)
504 ips_timed_wait(command, "ffdc", 0);
505 ips_insert_free_cmd(sc, command);
510 ips_ffdc_reset(ips_softc_t *sc)
512 ips_command_t *command;
514 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
515 device_printf(sc->dev, "ERROR: unable to get a command! "
516 "can't send ffdc reset!\n");
519 ips_send_ffdc_reset_cmd(command);
520 if (COMMAND_ERROR(&command->status)) {
522 * apparently some cards may report error status for
523 * an ffdc reset command, even though it works correctly
524 * afterwards. just complain about that and proceed here.
526 device_printf(sc->dev,
527 "ERROR: ffdc reset command failed(0x%04x)!\n",
528 command->status.value);
534 ips_write_nvram(ips_command_t *command)
536 ips_softc_t *sc = command->sc;
537 ips_rw_nvram_cmd *command_struct;
538 ips_nvram_page5 *nvram;
540 /*FIXME check for error */
541 command->callback = ips_wakeup_callback;
542 command_struct = (ips_rw_nvram_cmd *)command->command_buffer;
543 command_struct->command = IPS_RW_NVRAM_CMD;
544 command_struct->id = command->id;
545 command_struct->pagenum = 5;
546 command_struct->rw = 1; /* write */
547 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
548 BUS_DMASYNC_POSTREAD);
549 nvram = command->data_buffer;
550 /* retrieve adapter info and save in sc */
551 sc->adapter_type = nvram->adapter_type;
552 strncpy(nvram->driver_high, IPS_VERSION_MAJOR, 4);
553 strncpy(nvram->driver_low, IPS_VERSION_MINOR, 4);
554 nvram->operating_system = IPS_OS_FREEBSD;
555 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
556 BUS_DMASYNC_PREWRITE);
557 sc->ips_issue_cmd(command);
561 ips_read_nvram_callback(void *cmdptr, bus_dma_segment_t *segments, int segnum,
565 ips_command_t *command = cmdptr;
566 ips_rw_nvram_cmd *command_struct;
570 command->status.value = IPS_ERROR_STATUS;
571 ips_insert_free_cmd(sc, command);
572 kprintf("ips: error = %d in ips_read_nvram_callback\n", error);
575 command_struct = (ips_rw_nvram_cmd *)command->command_buffer;
576 command_struct->command = IPS_RW_NVRAM_CMD;
577 command_struct->id = command->id;
578 command_struct->pagenum = 5;
579 command_struct->rw = 0;
580 command_struct->buffaddr = segments[0].ds_addr;
582 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
583 BUS_DMASYNC_PREWRITE);
584 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
585 BUS_DMASYNC_PREREAD);
586 sc->ips_issue_cmd(command);
590 ips_read_nvram(ips_command_t *command)
593 ips_softc_t *sc = command->sc;
595 if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag,
598 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT,
599 /* highaddr */ BUS_SPACE_MAXADDR,
601 /* filterarg */ NULL,
602 /* maxsize */ IPS_NVRAM_PAGE_SIZE,
604 /* maxsegsize*/ IPS_NVRAM_PAGE_SIZE,
606 &command->data_dmatag) != 0) {
607 kprintf("ips: can't alloc dma tag for nvram\n");
611 if (bus_dmamem_alloc(command->data_dmatag, &command->data_buffer,
612 BUS_DMA_NOWAIT, &command->data_dmamap)) {
616 command->callback = ips_write_nvram;
617 bus_dmamap_load(command->data_dmatag, command->data_dmamap,
618 command->data_buffer, IPS_NVRAM_PAGE_SIZE, ips_read_nvram_callback,
619 command, BUS_DMA_NOWAIT);
620 if ((command->status.value == IPS_ERROR_STATUS) ||
621 ips_timed_wait(command, "ips", 0) != 0)
624 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
625 BUS_DMASYNC_POSTWRITE);
627 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
629 bus_dmamem_free(command->data_dmatag, command->data_buffer,
630 command->data_dmamap);
631 bus_dma_tag_destroy(command->data_dmatag);
632 ips_insert_free_cmd(sc, command);
637 ips_update_nvram(ips_softc_t *sc)
639 ips_command_t *command;
641 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
642 device_printf(sc->dev, "ERROR: unable to get a command! "
643 "can't update nvram\n");
646 ips_read_nvram(command);
647 if (COMMAND_ERROR(&command->status)) {
648 device_printf(sc->dev, "ERROR: nvram update command failed!\n");
655 ips_send_config_sync_cmd(ips_command_t *command)
657 ips_softc_t *sc = command->sc;
658 ips_generic_cmd *command_struct;
660 PRINTF(10, "ips test: got a command, building flush command\n");
661 command->callback = ips_wakeup_callback;
662 command_struct = (ips_generic_cmd *)command->command_buffer;
663 command_struct->command = IPS_CONFIG_SYNC_CMD;
664 command_struct->id = command->id;
665 command_struct->reserve2 = IPS_POCL;
666 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
667 BUS_DMASYNC_PREWRITE);
668 sc->ips_issue_cmd(command);
669 if (command->status.value != IPS_ERROR_STATUS)
670 ips_timed_wait(command, "ipssyn", 0);
671 ips_insert_free_cmd(sc, command);
676 ips_send_error_table_cmd(ips_command_t *command)
678 ips_softc_t *sc = command->sc;
679 ips_generic_cmd *command_struct;
681 PRINTF(10, "ips test: got a command, building errortable command\n");
682 command->callback = ips_wakeup_callback;
683 command_struct = (ips_generic_cmd *)command->command_buffer;
684 command_struct->command = IPS_ERROR_TABLE_CMD;
685 command_struct->id = command->id;
686 command_struct->reserve2 = IPS_CSL;
687 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
688 BUS_DMASYNC_PREWRITE);
689 sc->ips_issue_cmd(command);
690 if (command->status.value != IPS_ERROR_STATUS)
691 ips_timed_wait(command, "ipsetc", 0);
692 ips_insert_free_cmd(sc, command);
697 ips_clear_adapter(ips_softc_t *sc)
699 ips_command_t *command;
701 device_printf(sc->dev, "syncing config\n");
702 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
703 device_printf(sc->dev, "ERROR: unable to get a command! "
704 "can't sync cache!\n");
707 ips_send_config_sync_cmd(command);
708 if (COMMAND_ERROR(&command->status)) {
709 device_printf(sc->dev, "ERROR: cache sync command failed!\n");
712 device_printf(sc->dev, "clearing error table\n");
713 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) != 0) {
714 device_printf(sc->dev, "ERROR: unable to get a command! "
715 "can't sync cache!\n");
718 ips_send_error_table_cmd(command);
719 if (COMMAND_ERROR(&command->status)) {
720 device_printf(sc->dev, "ERROR: etable command failed!\n");