Lines Matching refs:request_id
122 static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id);
124 static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id);
127 static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_ho…
128 static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id);
129 static void twa_get_request_id(TW_Device_Extension *tw_dev, int *request_id);
140 …TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_…
141 static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds);
143 static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal);
146 static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
149 static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
228 static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) in twa_aen_complete() argument
236 header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; in twa_aen_complete()
239 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_aen_complete()
245 if (twa_aen_read_queue(tw_dev, request_id)) in twa_aen_complete()
258 twa_aen_sync_time(tw_dev, request_id); in twa_aen_complete()
265 if (twa_aen_read_queue(tw_dev, request_id)) in twa_aen_complete()
274 tw_dev->state[request_id] = TW_S_COMPLETED; in twa_aen_complete()
275 twa_free_request_id(tw_dev, request_id); in twa_aen_complete()
284 int request_id = 0; in twa_aen_drain_queue() local
298 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_aen_drain_queue()
309 sglist[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twa_aen_drain_queue()
311 if (tw_dev->generic_buffer_phys[request_id] & TW_ALIGNMENT_9000_SGL) { in twa_aen_drain_queue()
317 tw_dev->srb[request_id] = NULL; in twa_aen_drain_queue()
321 if (twa_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { in twa_aen_drain_queue()
327 if (twa_poll_response(tw_dev, request_id, 30)) { in twa_aen_drain_queue()
334 header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; in twa_aen_drain_queue()
368 tw_dev->state[request_id] = TW_S_INITIAL; in twa_aen_drain_queue()
428 static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) in twa_aen_read_queue() argument
435 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_aen_read_queue()
446 sglist[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twa_aen_read_queue()
449 tw_dev->srb[request_id] = NULL; in twa_aen_read_queue()
452 if (twa_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { in twa_aen_read_queue()
476 static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) in twa_aen_sync_time() argument
485 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_aen_sync_time()
489 command_packet->request_id = request_id; in twa_aen_sync_time()
490 …packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twa_aen_sync_time()
496 param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; in twa_aen_sync_time()
510 tw_dev->srb[request_id] = NULL; in twa_aen_sync_time()
513 twa_post_command_packet(tw_dev, request_id, 1); in twa_aen_sync_time()
644 int request_id = 0; in twa_chrdev_ioctl() local
698 twa_get_request_id(tw_dev, &request_id); in twa_chrdev_ioctl()
701 tw_dev->srb[request_id] = NULL; in twa_chrdev_ioctl()
704 tw_dev->chrdev_request_id = request_id; in twa_chrdev_ioctl()
709 twa_load_sgl(tw_dev, full_command_packet, request_id, dma_handle, data_buffer_length_adjusted); in twa_chrdev_ioctl()
711 …memcpy(tw_dev->command_packet_virt[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command_F… in twa_chrdev_ioctl()
714 twa_post_command_packet(tw_dev, request_id, 1); in twa_chrdev_ioctl()
734 …memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_F… in twa_chrdev_ioctl()
739 tw_dev->state[request_id] = TW_S_COMPLETED; in twa_chrdev_ioctl()
740 twa_free_request_id(tw_dev, request_id); in twa_chrdev_ioctl()
990 static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_ho… in twa_fill_sense() argument
997 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_fill_sense()
1019 …memcpy(tw_dev->srb[request_id]->sense_buffer, full_command_packet->header.sense_data, TW_SENSE_DAT… in twa_fill_sense()
1020 tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1); in twa_fill_sense()
1048 static void twa_free_request_id(TW_Device_Extension *tw_dev, int request_id) in twa_free_request_id() argument
1050 tw_dev->free_queue[tw_dev->free_tail] = request_id; in twa_free_request_id()
1051 tw_dev->state[request_id] = TW_S_FINISHED; in twa_free_request_id()
1056 static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter… in twa_get_param() argument
1064 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_get_param()
1070 command_packet->request_id = request_id; in twa_get_param()
1074 param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; in twa_get_param()
1080 …packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in twa_get_param()
1084 twa_post_command_packet(tw_dev, request_id, 1); in twa_get_param()
1087 if (twa_poll_response(tw_dev, request_id, 30)) in twa_get_param()
1093 tw_dev->state[request_id] = TW_S_INITIAL; in twa_get_param()
1099 static void twa_get_request_id(TW_Device_Extension *tw_dev, int *request_id) in twa_get_request_id() argument
1101 *request_id = tw_dev->free_queue[tw_dev->free_head]; in twa_get_request_id()
1103 tw_dev->state[*request_id] = TW_S_STARTED; in twa_get_request_id()
1120 int request_id = 0, retval = 1; in twa_initconnection() local
1123 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_initconnection()
1129 tw_initconnect->request_id = request_id; in twa_initconnection()
1147 twa_post_command_packet(tw_dev, request_id, 1); in twa_initconnection()
1150 if (twa_poll_response(tw_dev, request_id, 30)) { in twa_initconnection()
1164 tw_dev->state[request_id] = TW_S_INITIAL; in twa_initconnection()
1218 int request_id, error = 0; in twa_interrupt() local
1257 twa_get_request_id(tw_dev, &request_id); in twa_interrupt()
1259 error = twa_aen_read_queue(tw_dev, request_id); in twa_interrupt()
1261 tw_dev->state[request_id] = TW_S_COMPLETED; in twa_interrupt()
1262 twa_free_request_id(tw_dev, request_id); in twa_interrupt()
1273 request_id = tw_dev->pending_queue[tw_dev->pending_head]; in twa_interrupt()
1274 if (tw_dev->state[request_id] != TW_S_PENDING) { in twa_interrupt()
1279 if (twa_post_command_packet(tw_dev, request_id, 1)==0) { in twa_interrupt()
1296 request_id = TW_RESID_OUT(response_que.response_id); in twa_interrupt()
1297 full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_interrupt()
1301 if (tw_dev->srb[request_id] != NULL) { in twa_interrupt()
1302 error = twa_fill_sense(tw_dev, request_id, 1, 1); in twa_interrupt()
1305 if (request_id != tw_dev->chrdev_request_id) { in twa_interrupt()
1306 error = twa_fill_sense(tw_dev, request_id, 0, 1); in twa_interrupt()
1312 if (tw_dev->state[request_id] != TW_S_POSTED) { in twa_interrupt()
1313 if (tw_dev->srb[request_id] != NULL) { in twa_interrupt()
1321 if (tw_dev->srb[request_id] == NULL) { in twa_interrupt()
1322 if (request_id != tw_dev->chrdev_request_id) { in twa_interrupt()
1323 if (twa_aen_complete(tw_dev, request_id)) in twa_interrupt()
1332 cmd = tw_dev->srb[request_id]; in twa_interrupt()
1334 twa_scsiop_execute_scsi_complete(tw_dev, request_id); in twa_interrupt()
1358 tw_dev->state[request_id] = TW_S_COMPLETED; in twa_interrupt()
1359 twa_free_request_id(tw_dev, request_id); in twa_interrupt()
1380 …TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_… in twa_load_sgl() argument
1393 TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id); in twa_load_sgl()
1402 oldcommand->request_id = request_id; in twa_load_sgl()
1419 static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) in twa_poll_response() argument
1423 TW_Command_Full *full_command_packet = tw_dev->command_packet_virt[request_id]; in twa_poll_response()
1428 if (request_id != response_request_id) { in twa_poll_response()
1435 twa_fill_sense(tw_dev, request_id, 0, 0); in twa_poll_response()
1442 twa_fill_sense(tw_dev, request_id, 0, 0); in twa_poll_response()
1513 static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal) in twa_post_command_packet() argument
1519 command_que_value = tw_dev->command_packet_phys[request_id]; in twa_post_command_packet()
1533 …if (((tw_dev->pending_request_count > 0) && (tw_dev->state[request_id] != TW_S_PENDING)) || (statu… in twa_post_command_packet()
1542 if (tw_dev->state[request_id] != TW_S_PENDING) { in twa_post_command_packet()
1543 tw_dev->state[request_id] = TW_S_PENDING; in twa_post_command_packet()
1548 tw_dev->pending_queue[tw_dev->pending_tail] = request_id; in twa_post_command_packet()
1567 tw_dev->state[request_id] = TW_S_POSTED; in twa_post_command_packet()
1752 int request_id, retval; in twa_scsi_queue_lck() local
1770 twa_get_request_id(tw_dev, &request_id); in twa_scsi_queue_lck()
1773 tw_dev->srb[request_id] = SCpnt; in twa_scsi_queue_lck()
1775 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); in twa_scsi_queue_lck()
1780 twa_free_request_id(tw_dev, request_id); in twa_scsi_queue_lck()
1787 tw_dev->state[request_id] = TW_S_COMPLETED; in twa_scsi_queue_lck()
1788 twa_free_request_id(tw_dev, request_id); in twa_scsi_queue_lck()
1798 static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, in DEF_SCSI_QCMD()
1810 if (tw_dev->srb[request_id]) in DEF_SCSI_QCMD()
1811 srb = tw_dev->srb[request_id]; in DEF_SCSI_QCMD()
1814 full_command_packet = tw_dev->command_packet_virt[request_id]; in DEF_SCSI_QCMD()
1832 TW_REQ_LUN_IN(srb->device->lun, request_id); in DEF_SCSI_QCMD()
1835 TW_REQ_LUN_IN(0, request_id); in DEF_SCSI_QCMD()
1849 tw_dev->generic_buffer_virt[request_id], in DEF_SCSI_QCMD()
1851 command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); in DEF_SCSI_QCMD()
1867 …sgl_entries__lunh = TW_REQ_LUN_IN((srb->device->lun >> 4), scsi_sg_count(tw_dev->srb[request_id])); in DEF_SCSI_QCMD()
1897 tw_dev->sgl_entries = scsi_sg_count(tw_dev->srb[request_id]); in DEF_SCSI_QCMD()
1904 retval = twa_post_command_packet(tw_dev, request_id, 0); in DEF_SCSI_QCMD()
1906 twa_post_command_packet(tw_dev, request_id, 1); in DEF_SCSI_QCMD()
1914 static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id) in twa_scsiop_execute_scsi_complete() argument
1916 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; in twa_scsiop_execute_scsi_complete()
1922 void *buf = tw_dev->generic_buffer_virt[request_id]; in twa_scsiop_execute_scsi_complete()