Lines Matching refs:request_id

271 static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id)  in twl_post_command_packet()  argument
275 command_que_value = tw_dev->command_packet_phys[request_id]; in twl_post_command_packet()
283 tw_dev->state[request_id] = TW_S_POSTED; in twl_post_command_packet()
292 static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, in twl_scsiop_execute_scsi() argument
303 if (tw_dev->srb[request_id]) in twl_scsiop_execute_scsi()
304 srb = tw_dev->srb[request_id]; in twl_scsiop_execute_scsi()
307 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_scsiop_execute_scsi()
325 cpu_to_le16(TW_REQ_LUN_IN(srb->device->lun, request_id)); in twl_scsiop_execute_scsi()
328 cpu_to_le16(TW_REQ_LUN_IN(0, request_id)); in twl_scsiop_execute_scsi()
345 …lunh = cpu_to_le16(TW_REQ_LUN_IN((srb->device->lun >> 4), scsi_sg_count(tw_dev->srb[request_id]))); in twl_scsiop_execute_scsi()
367 retval = twl_post_command_packet(tw_dev, request_id); in twl_scsiop_execute_scsi()
374 static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) in twl_aen_read_queue() argument
381 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_read_queue()
392 sglist[0].address = tw_dev->generic_buffer_phys[request_id]; in twl_aen_read_queue()
395 tw_dev->srb[request_id] = NULL; in twl_aen_read_queue()
398 if (twl_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { in twl_aen_read_queue()
408 static void twl_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) in twl_aen_sync_time() argument
417 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_sync_time()
421 command_packet->request_id = request_id; in twl_aen_sync_time()
422 …packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twl_aen_sync_time()
428 param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; in twl_aen_sync_time()
443 tw_dev->srb[request_id] = NULL; in twl_aen_sync_time()
446 twl_post_command_packet(tw_dev, request_id); in twl_aen_sync_time()
450 static void twl_get_request_id(TW_Device_Extension *tw_dev, int *request_id) in twl_get_request_id() argument
452 *request_id = tw_dev->free_queue[tw_dev->free_head]; in twl_get_request_id()
454 tw_dev->state[*request_id] = TW_S_STARTED; in twl_get_request_id()
458 static void twl_free_request_id(TW_Device_Extension *tw_dev, int request_id) in twl_free_request_id() argument
460 tw_dev->free_queue[tw_dev->free_tail] = request_id; in twl_free_request_id()
461 tw_dev->state[request_id] = TW_S_FINISHED; in twl_free_request_id()
466 static int twl_aen_complete(TW_Device_Extension *tw_dev, int request_id) in twl_aen_complete() argument
474 header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; in twl_aen_complete()
477 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_complete()
483 if (twl_aen_read_queue(tw_dev, request_id)) in twl_aen_complete()
496 twl_aen_sync_time(tw_dev, request_id); in twl_aen_complete()
503 if (twl_aen_read_queue(tw_dev, request_id)) in twl_aen_complete()
512 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_aen_complete()
513 twl_free_request_id(tw_dev, request_id); in twl_aen_complete()
520 static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) in twl_poll_response() argument
541 if (TW_RESID_OUT(response) == request_id) in twl_poll_response()
557 int request_id = 0; in twl_aen_drain_queue() local
571 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_drain_queue()
582 sglist[0].address = tw_dev->generic_buffer_phys[request_id]; in twl_aen_drain_queue()
585 tw_dev->srb[request_id] = NULL; in twl_aen_drain_queue()
589 if (twl_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { in twl_aen_drain_queue()
595 if (twl_poll_response(tw_dev, request_id, 30)) { in twl_aen_drain_queue()
602 header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; in twl_aen_drain_queue()
636 tw_dev->state[request_id] = TW_S_INITIAL; in twl_aen_drain_queue()
678 …TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_… in twl_load_sgl() argument
691 cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id)); in twl_load_sgl()
700 oldcommand->request_id = request_id; in twl_load_sgl()
720 int request_id = 0; in twl_chrdev_ioctl() local
767 twl_get_request_id(tw_dev, &request_id); in twl_chrdev_ioctl()
770 tw_dev->srb[request_id] = NULL; in twl_chrdev_ioctl()
773 tw_dev->chrdev_request_id = request_id; in twl_chrdev_ioctl()
778 twl_load_sgl(tw_dev, full_command_packet, request_id, dma_handle, data_buffer_length_adjusted); in twl_chrdev_ioctl()
780 …memcpy(tw_dev->command_packet_virt[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command_F… in twl_chrdev_ioctl()
783 twl_post_command_packet(tw_dev, request_id); in twl_chrdev_ioctl()
803 …memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_F… in twl_chrdev_ioctl()
808 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_chrdev_ioctl()
809 twl_free_request_id(tw_dev, request_id); in twl_chrdev_ioctl()
859 static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, int copy_sense, int p… in twl_fill_sense() argument
867 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_fill_sense()
891 memcpy(tw_dev->srb[request_id]->sense_buffer, header->sense_data, TW_SENSE_DATA_LENGTH); in twl_fill_sense()
892 tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1); in twl_fill_sense()
925 static void *twl_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter… in twl_get_param() argument
933 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_get_param()
939 command_packet->request_id = request_id; in twl_get_param()
943 param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; in twl_get_param()
949 …packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twl_get_param()
953 twl_post_command_packet(tw_dev, request_id); in twl_get_param()
956 if (twl_poll_response(tw_dev, request_id, 30)) in twl_get_param()
962 tw_dev->state[request_id] = TW_S_INITIAL; in twl_get_param()
981 int request_id = 0, retval = 1; in twl_initconnection() local
984 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_initconnection()
990 tw_initconnect->request_id = request_id; in twl_initconnection()
1009 twl_post_command_packet(tw_dev, request_id); in twl_initconnection()
1012 if (twl_poll_response(tw_dev, request_id, 30)) { in twl_initconnection()
1026 tw_dev->state[request_id] = TW_S_INITIAL; in twl_initconnection()
1084 u32 request_id, doorbell; in twl_handle_attention_interrupt() local
1098 twl_get_request_id(tw_dev, &request_id); in twl_handle_attention_interrupt()
1099 if (twl_aen_read_queue(tw_dev, request_id)) { in twl_handle_attention_interrupt()
1100 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_handle_attention_interrupt()
1101 twl_free_request_id(tw_dev, request_id); in twl_handle_attention_interrupt()
1124 u32 reg, regl, regh, response, request_id = 0; in twl_interrupt() local
1167 request_id = le16_to_cpu(tw_dev->sense_buffer_virt[i]->header_desc.request_id); in twl_interrupt()
1168 if (tw_dev->srb[request_id] != NULL) in twl_interrupt()
1169 error = twl_fill_sense(tw_dev, i, request_id, 1, 1); in twl_interrupt()
1172 if (request_id != tw_dev->chrdev_request_id) in twl_interrupt()
1173 error = twl_fill_sense(tw_dev, i, request_id, 0, 1); in twl_interrupt()
1175 …memcpy(tw_dev->command_packet_virt[request_id], tw_dev->sense_buffer_virt[i], sizeof(TW_Command_Ap… in twl_interrupt()
1185 request_id = TW_RESID_OUT(response); in twl_interrupt()
1187 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_interrupt()
1190 if (tw_dev->state[request_id] != TW_S_POSTED) { in twl_interrupt()
1191 if (tw_dev->srb[request_id] != NULL) { in twl_interrupt()
1199 if (tw_dev->srb[request_id] == NULL) { in twl_interrupt()
1200 if (request_id != tw_dev->chrdev_request_id) { in twl_interrupt()
1201 if (twl_aen_complete(tw_dev, request_id)) in twl_interrupt()
1208 cmd = tw_dev->srb[request_id]; in twl_interrupt()
1215 …(full_command_packet->command.newcommand.sg_list[0].length < scsi_bufflen(tw_dev->srb[request_id])) in twl_interrupt()
1222 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_interrupt()
1223 twl_free_request_id(tw_dev, request_id); in twl_interrupt()
1458 int request_id, retval; in twl_scsi_queue_lck() local
1468 twl_get_request_id(tw_dev, &request_id); in twl_scsi_queue_lck()
1471 tw_dev->srb[request_id] = SCpnt; in twl_scsi_queue_lck()
1473 retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); in twl_scsi_queue_lck()
1475 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_scsi_queue_lck()
1476 twl_free_request_id(tw_dev, request_id); in twl_scsi_queue_lck()