Lines Matching refs:request_id
269 static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id) in twl_post_command_packet() argument
273 command_que_value = tw_dev->command_packet_phys[request_id]; in twl_post_command_packet()
281 tw_dev->state[request_id] = TW_S_POSTED; in twl_post_command_packet()
290 static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, in twl_scsiop_execute_scsi() argument
301 if (tw_dev->srb[request_id]) { in twl_scsiop_execute_scsi()
302 srb = tw_dev->srb[request_id]; in twl_scsiop_execute_scsi()
308 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_scsiop_execute_scsi()
326 cpu_to_le16(TW_REQ_LUN_IN(srb->device->lun, request_id)); in twl_scsiop_execute_scsi()
329 cpu_to_le16(TW_REQ_LUN_IN(0, request_id)); in twl_scsiop_execute_scsi()
346 …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()
368 retval = twl_post_command_packet(tw_dev, request_id); in twl_scsiop_execute_scsi()
375 static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) in twl_aen_read_queue() argument
382 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_read_queue()
393 sglist[0].address = tw_dev->generic_buffer_phys[request_id]; in twl_aen_read_queue()
396 tw_dev->srb[request_id] = NULL; in twl_aen_read_queue()
399 if (twl_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { in twl_aen_read_queue()
409 static void twl_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) in twl_aen_sync_time() argument
418 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_sync_time()
422 command_packet->request_id = request_id; in twl_aen_sync_time()
423 …packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twl_aen_sync_time()
429 param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; in twl_aen_sync_time()
444 tw_dev->srb[request_id] = NULL; in twl_aen_sync_time()
447 twl_post_command_packet(tw_dev, request_id); in twl_aen_sync_time()
451 static void twl_get_request_id(TW_Device_Extension *tw_dev, int *request_id) in twl_get_request_id() argument
453 *request_id = tw_dev->free_queue[tw_dev->free_head]; in twl_get_request_id()
455 tw_dev->state[*request_id] = TW_S_STARTED; in twl_get_request_id()
459 static void twl_free_request_id(TW_Device_Extension *tw_dev, int request_id) in twl_free_request_id() argument
461 tw_dev->free_queue[tw_dev->free_tail] = request_id; in twl_free_request_id()
462 tw_dev->state[request_id] = TW_S_FINISHED; in twl_free_request_id()
467 static int twl_aen_complete(TW_Device_Extension *tw_dev, int request_id) in twl_aen_complete() argument
475 header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; in twl_aen_complete()
478 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_complete()
484 if (twl_aen_read_queue(tw_dev, request_id)) in twl_aen_complete()
497 twl_aen_sync_time(tw_dev, request_id); in twl_aen_complete()
504 if (twl_aen_read_queue(tw_dev, request_id)) in twl_aen_complete()
513 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_aen_complete()
514 twl_free_request_id(tw_dev, request_id); in twl_aen_complete()
521 static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) in twl_poll_response() argument
542 if (TW_RESID_OUT(response) == request_id) in twl_poll_response()
558 int request_id = 0; in twl_aen_drain_queue() local
572 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_aen_drain_queue()
583 sglist[0].address = tw_dev->generic_buffer_phys[request_id]; in twl_aen_drain_queue()
586 tw_dev->srb[request_id] = NULL; in twl_aen_drain_queue()
590 if (twl_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { in twl_aen_drain_queue()
596 if (twl_poll_response(tw_dev, request_id, 30)) { in twl_aen_drain_queue()
603 header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; in twl_aen_drain_queue()
637 tw_dev->state[request_id] = TW_S_INITIAL; in twl_aen_drain_queue()
679 …TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_… in twl_load_sgl() argument
692 cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id)); in twl_load_sgl()
701 oldcommand->request_id = request_id; in twl_load_sgl()
721 int request_id = 0; in twl_chrdev_ioctl() local
768 twl_get_request_id(tw_dev, &request_id); in twl_chrdev_ioctl()
771 tw_dev->srb[request_id] = NULL; in twl_chrdev_ioctl()
774 tw_dev->chrdev_request_id = request_id; in twl_chrdev_ioctl()
779 twl_load_sgl(tw_dev, full_command_packet, request_id, dma_handle, data_buffer_length_adjusted); in twl_chrdev_ioctl()
781 …memcpy(tw_dev->command_packet_virt[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command_F… in twl_chrdev_ioctl()
784 twl_post_command_packet(tw_dev, request_id); in twl_chrdev_ioctl()
804 …memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_F… in twl_chrdev_ioctl()
809 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_chrdev_ioctl()
810 twl_free_request_id(tw_dev, request_id); in twl_chrdev_ioctl()
860 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
869 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_fill_sense()
893 memcpy(tw_dev->srb[request_id]->sense_buffer, header->sense_data, TW_SENSE_DATA_LENGTH); in twl_fill_sense()
894 tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1); in twl_fill_sense()
927 static void *twl_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter… in twl_get_param() argument
935 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_get_param()
941 command_packet->request_id = request_id; in twl_get_param()
945 param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; in twl_get_param()
951 …packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twl_get_param()
955 twl_post_command_packet(tw_dev, request_id); in twl_get_param()
958 if (twl_poll_response(tw_dev, request_id, 30)) in twl_get_param()
964 tw_dev->state[request_id] = TW_S_INITIAL; in twl_get_param()
983 int request_id = 0, retval = 1; in twl_initconnection() local
986 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_initconnection()
992 tw_initconnect->request_id = request_id; in twl_initconnection()
1011 twl_post_command_packet(tw_dev, request_id); in twl_initconnection()
1014 if (twl_poll_response(tw_dev, request_id, 30)) { in twl_initconnection()
1028 tw_dev->state[request_id] = TW_S_INITIAL; in twl_initconnection()
1086 u32 request_id, doorbell; in twl_handle_attention_interrupt() local
1100 twl_get_request_id(tw_dev, &request_id); in twl_handle_attention_interrupt()
1101 if (twl_aen_read_queue(tw_dev, request_id)) { in twl_handle_attention_interrupt()
1102 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_handle_attention_interrupt()
1103 twl_free_request_id(tw_dev, request_id); in twl_handle_attention_interrupt()
1126 u32 reg, regl, regh, response, request_id = 0; in twl_interrupt() local
1169 request_id = le16_to_cpu(tw_dev->sense_buffer_virt[i]->header_desc.request_id); in twl_interrupt()
1170 if (tw_dev->srb[request_id] != NULL) in twl_interrupt()
1171 error = twl_fill_sense(tw_dev, i, request_id, 1, 1); in twl_interrupt()
1174 if (request_id != tw_dev->chrdev_request_id) in twl_interrupt()
1175 error = twl_fill_sense(tw_dev, i, request_id, 0, 1); in twl_interrupt()
1177 …memcpy(tw_dev->command_packet_virt[request_id], tw_dev->sense_buffer_virt[i], sizeof(TW_Command_Ap… in twl_interrupt()
1187 request_id = TW_RESID_OUT(response); in twl_interrupt()
1189 full_command_packet = tw_dev->command_packet_virt[request_id]; in twl_interrupt()
1192 if (tw_dev->state[request_id] != TW_S_POSTED) { in twl_interrupt()
1193 if (tw_dev->srb[request_id] != NULL) { in twl_interrupt()
1201 if (tw_dev->srb[request_id] == NULL) { in twl_interrupt()
1202 if (request_id != tw_dev->chrdev_request_id) { in twl_interrupt()
1203 if (twl_aen_complete(tw_dev, request_id)) in twl_interrupt()
1210 cmd = tw_dev->srb[request_id]; in twl_interrupt()
1217 …(full_command_packet->command.newcommand.sg_list[0].length < scsi_bufflen(tw_dev->srb[request_id])) in twl_interrupt()
1224 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_interrupt()
1225 twl_free_request_id(tw_dev, request_id); in twl_interrupt()
1462 int request_id, retval; in twl_scsi_queue_lck() local
1475 twl_get_request_id(tw_dev, &request_id); in twl_scsi_queue_lck()
1478 tw_dev->srb[request_id] = SCpnt; in twl_scsi_queue_lck()
1480 retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); in twl_scsi_queue_lck()
1482 tw_dev->state[request_id] = TW_S_COMPLETED; in twl_scsi_queue_lck()
1483 twl_free_request_id(tw_dev, request_id); in twl_scsi_queue_lck()