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