Lines Matching refs:command

37  * command.  This very generic callback simply stores
38 * the command's return value in command->arg and wake's
39 * up anyone waiting on the command.
41 static void ips_wakeup_callback(ips_command_t *command)
43 bus_dmamap_sync(command->sc->command_dmatag, command->command_dmamap,
45 sema_post(&command->sc->cmd_sema);
51 static void ips_io_request_finish(ips_command_t *command)
54 struct bio *iobuf = command->arg;
56 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
59 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
62 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
63 if(COMMAND_ERROR(command)){
66 printf("ips: io error, status= 0x%x\n", command->status.value);
68 ips_insert_free_cmd(command->sc, command);
75 ips_command_t *command = cmdptr;
78 struct bio *iobuf = command->arg;
82 sc = command->sc;
85 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
88 ips_insert_free_cmd(sc, command);
92 command_struct = (ips_io_cmd *)command->command_buffer;
93 command_struct->id = command->id;
102 command->command_buffer + IPS_COMMAND_LEN);
109 (u_int32_t)command->command_phys_addr + IPS_COMMAND_LEN;
118 command_struct->command = cmdtype;
122 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
125 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
128 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
131 PRINTF(10, "ips test: command id: %d segments: %d "
132 "pblkno: %lld length: %d, ds_len: %d\n", command->id, segnum,
136 sc->ips_issue_cmd(command);
140 static int ips_send_io_request(ips_command_t *command, struct bio *iobuf)
142 command->callback = ips_io_request_finish;
143 command->arg = iobuf;
145 bus_dmamap_load(command->data_dmatag, command->data_dmamap,
147 ips_io_request_callback, command, 0);
154 ips_command_t *command;
160 if (ips_get_free_cmd(sc, &command, 0))
164 ips_send_io_request(command, iobuf);
175 ips_command_t *command = cmdptr;
177 sc = command->sc;
179 ips_set_error(command, error);
183 command_struct = (ips_adapter_info_cmd *)command->command_buffer;
184 command_struct->command = IPS_ADAPTER_INFO_CMD;
185 command_struct->id = command->id;
188 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
190 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
192 sc->ips_issue_cmd(command);
194 ips_set_error(command, ETIMEDOUT);
198 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
200 memcpy(&(sc->adapter_info), command->data_buffer, IPS_ADAPTER_INFO_LEN);
205 static int ips_send_adapter_info_cmd(ips_command_t *command)
208 ips_softc_t *sc = command->sc;
223 &command->data_dmatag) != 0) {
228 if(bus_dmamem_alloc(command->data_dmatag, &command->data_buffer,
229 BUS_DMA_NOWAIT, &command->data_dmamap)){
233 command->callback = ips_wakeup_callback;
234 error = bus_dmamap_load(command->data_dmatag, command->data_dmamap,
235 command->data_buffer,IPS_ADAPTER_INFO_LEN,
236 ips_adapter_info_callback, command,
240 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
244 bus_dmamem_free(command->data_dmatag, command->data_buffer,
245 command->data_dmamap);
246 bus_dma_tag_destroy(command->data_dmatag);
247 ips_insert_free_cmd(sc, command);
253 ips_command_t *command;
256 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) > 0){
260 ips_send_adapter_info_cmd(command);
261 if (COMMAND_ERROR(command)){
274 ips_command_t *command = cmdptr;
278 sc = command->sc;
280 ips_set_error(command, error);
284 command_struct = (ips_drive_cmd *)command->command_buffer;
285 command_struct->command = IPS_DRIVE_INFO_CMD;
286 command_struct->id = command->id;
289 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
291 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
293 sc->ips_issue_cmd(command);
295 ips_set_error(command, ETIMEDOUT);
299 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
301 driveinfo = command->data_buffer;
307 static int ips_send_drive_info_cmd(ips_command_t *command)
310 ips_softc_t *sc = command->sc;
325 &command->data_dmatag) != 0) {
330 if(bus_dmamem_alloc(command->data_dmatag, &command->data_buffer,
331 BUS_DMA_NOWAIT, &command->data_dmamap)){
335 command->callback = ips_wakeup_callback;
336 error = bus_dmamap_load(command->data_dmatag, command->data_dmamap,
337 command->data_buffer,IPS_DRIVE_INFO_LEN,
338 ips_drive_info_callback, command,
341 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
345 bus_dmamem_free(command->data_dmatag, command->data_buffer,
346 command->data_dmamap);
347 bus_dma_tag_destroy(command->data_dmatag);
348 ips_insert_free_cmd(sc, command);
355 ips_command_t *command;
357 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG) > 0){
361 ips_send_drive_info_cmd(command);
362 if(COMMAND_ERROR(command)){
370 static int ips_send_flush_cache_cmd(ips_command_t *command)
372 ips_softc_t *sc = command->sc;
375 PRINTF(10,"ips test: got a command, building flush command\n");
376 command->callback = ips_wakeup_callback;
377 command_struct = (ips_generic_cmd *)command->command_buffer;
378 command_struct->command = IPS_CACHE_FLUSH_CMD;
379 command_struct->id = command->id;
380 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
382 sc->ips_issue_cmd(command);
383 if (COMMAND_ERROR(command) == 0)
385 ips_insert_free_cmd(sc, command);
391 ips_command_t *command;
394 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG)){
395 device_printf(sc->dev, "ERROR: unable to get a command! can't flush cache!\n");
397 ips_send_flush_cache_cmd(command);
398 if(COMMAND_ERROR(command)){
399 device_printf(sc->dev, "ERROR: cache flush command failed!\n");
407 void static ips_ffdc_settime(ips_adapter_ffdc_cmd *command, time_t sctime)
420 command->hour = rem / IPS_SECSPERHOUR;
423 command->minute = rem / IPS_SECSPERMIN;
424 command->second = rem % IPS_SECSPERMIN;
438 command->yearH = y / 100;
439 command->yearL = y % 100;
443 command->month = month + 1;
444 command->day = days + 1;
447 static int ips_send_ffdc_reset_cmd(ips_command_t *command)
449 ips_softc_t *sc = command->sc;
452 PRINTF(10,"ips test: got a command, building ffdc reset command\n");
453 command->callback = ips_wakeup_callback;
454 command_struct = (ips_adapter_ffdc_cmd *)command->command_buffer;
455 command_struct->command = IPS_FFDC_CMD;
456 command_struct->id = command->id;
461 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
463 sc->ips_issue_cmd(command);
464 if (COMMAND_ERROR(command) == 0)
466 ips_insert_free_cmd(sc, command);
472 ips_command_t *command;
474 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG)){
475 device_printf(sc->dev, "ERROR: unable to get a command! can't send ffdc reset!\n");
477 ips_send_ffdc_reset_cmd(command);
478 if(COMMAND_ERROR(command)){
479 device_printf(sc->dev, "ERROR: ffdc reset command failed!\n");
484 static void ips_write_nvram(ips_command_t *command){
485 ips_softc_t *sc = command->sc;
490 command->callback = ips_wakeup_callback;
491 command_struct = (ips_rw_nvram_cmd *)command->command_buffer;
492 command_struct->command = IPS_RW_NVRAM_CMD;
493 command_struct->id = command->id;
496 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
498 nvram = command->data_buffer;
505 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
507 sc->ips_issue_cmd(command);
513 ips_command_t *command = cmdptr;
515 sc = command->sc;
517 ips_set_error(command, error);
521 command_struct = (ips_rw_nvram_cmd *)command->command_buffer;
522 command_struct->command = IPS_RW_NVRAM_CMD;
523 command_struct->id = command->id;
528 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
530 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
532 sc->ips_issue_cmd(command);
534 ips_set_error(command, ETIMEDOUT);
537 bus_dmamap_sync(command->data_dmatag, command->data_dmamap,
541 static int ips_read_nvram(ips_command_t *command)
544 ips_softc_t *sc = command->sc;
559 &command->data_dmatag) != 0) {
564 if(bus_dmamem_alloc(command->data_dmatag, &command->data_buffer,
565 BUS_DMA_NOWAIT, &command->data_dmamap)){
569 command->callback = ips_write_nvram;
570 error = bus_dmamap_load(command->data_dmatag, command->data_dmamap,
571 command->data_buffer,IPS_NVRAM_PAGE_SIZE,
572 ips_read_nvram_callback, command,
575 bus_dmamap_unload(command->data_dmatag, command->data_dmamap);
578 bus_dmamem_free(command->data_dmatag, command->data_buffer,
579 command->data_dmamap);
580 bus_dma_tag_destroy(command->data_dmatag);
581 ips_insert_free_cmd(sc, command);
587 ips_command_t *command;
589 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG)){
590 device_printf(sc->dev, "ERROR: unable to get a command! can't update nvram\n");
593 ips_read_nvram(command);
594 if(COMMAND_ERROR(command)){
595 device_printf(sc->dev, "ERROR: nvram update command failed!\n");
603 static int ips_send_config_sync_cmd(ips_command_t *command)
605 ips_softc_t *sc = command->sc;
608 PRINTF(10,"ips test: got a command, building flush command\n");
609 command->callback = ips_wakeup_callback;
610 command_struct = (ips_generic_cmd *)command->command_buffer;
611 command_struct->command = IPS_CONFIG_SYNC_CMD;
612 command_struct->id = command->id;
614 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
616 sc->ips_issue_cmd(command);
617 if (COMMAND_ERROR(command) == 0)
619 ips_insert_free_cmd(sc, command);
623 static int ips_send_error_table_cmd(ips_command_t *command)
625 ips_softc_t *sc = command->sc;
628 PRINTF(10,"ips test: got a command, building errortable command\n");
629 command->callback = ips_wakeup_callback;
630 command_struct = (ips_generic_cmd *)command->command_buffer;
631 command_struct->command = IPS_ERROR_TABLE_CMD;
632 command_struct->id = command->id;
634 bus_dmamap_sync(sc->command_dmatag, command->command_dmamap,
636 sc->ips_issue_cmd(command);
637 if (COMMAND_ERROR(command) == 0)
639 ips_insert_free_cmd(sc, command);
646 ips_command_t *command;
649 if (ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG)){
650 device_printf(sc->dev, "ERROR: unable to get a command! can't sync cache!\n");
653 ips_send_config_sync_cmd(command);
654 if(COMMAND_ERROR(command)){
655 device_printf(sc->dev, "ERROR: cache sync command failed!\n");
660 if(ips_get_free_cmd(sc, &command, IPS_STATIC_FLAG)){
661 device_printf(sc->dev, "ERROR: unable to get a command! can't sync cache!\n");
664 ips_send_error_table_cmd(command);
665 if(COMMAND_ERROR(command)){
666 device_printf(sc->dev, "ERROR: etable command failed!\n");