Lines Matching refs:request_id

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