host.c (621120ca56850249554996c94efe75f8200a2cc0) host.c (f8381807ebdfffa34c2c5aa38eda33673d1a7adf)
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *

--- 1063 unchanged lines hidden (view full) ---

1072
1073 /* Clear the interrupt and enable all interrupts again */
1074 writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status);
1075 /* Could we write the value of SMU_ISR_COMPLETION? */
1076 writel(0xFF000000, &ihost->smu_registers->interrupt_mask);
1077 writel(0, &ihost->smu_registers->interrupt_mask);
1078}
1079
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *

--- 1063 unchanged lines hidden (view full) ---

1072
1073 /* Clear the interrupt and enable all interrupts again */
1074 writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status);
1075 /* Could we write the value of SMU_ISR_COMPLETION? */
1076 writel(0xFF000000, &ihost->smu_registers->interrupt_mask);
1077 writel(0, &ihost->smu_registers->interrupt_mask);
1078}
1079
1080void ireq_done(struct isci_host *ihost, struct isci_request *ireq, struct sas_task *task)
1081{
1082 task->lldd_task = NULL;
1083 if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags) &&
1084 !(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
1085 if (test_bit(IREQ_COMPLETE_IN_TARGET, &ireq->flags)) {
1086 /* Normal notification (task_done) */
1087 dev_dbg(&ihost->pdev->dev,
1088 "%s: Normal - ireq/task = %p/%p\n",
1089 __func__, ireq, task);
1090
1091 task->task_done(task);
1092 } else {
1093 dev_dbg(&ihost->pdev->dev,
1094 "%s: Error - ireq/task = %p/%p\n",
1095 __func__, ireq, task);
1096
1097 sas_task_abort(task);
1098 }
1099 }
1100 if (test_and_clear_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags))
1101 wake_up_all(&ihost->eventq);
1102
1103 if (!test_bit(IREQ_NO_AUTO_FREE_TAG, &ireq->flags))
1104 isci_free_tag(ihost, ireq->io_tag);
1105}
1080/**
1081 * isci_host_completion_routine() - This function is the delayed service
1082 * routine that calls the sci core library's completion handler. It's
1083 * scheduled as a tasklet from the interrupt service routine when interrupts
1084 * in use, or set as the timeout function in polled mode.
1085 * @data: This parameter specifies the ISCI host object
1086 *
1087 */
1088void isci_host_completion_routine(unsigned long data)
1089{
1090 struct isci_host *ihost = (struct isci_host *)data;
1106/**
1107 * isci_host_completion_routine() - This function is the delayed service
1108 * routine that calls the sci core library's completion handler. It's
1109 * scheduled as a tasklet from the interrupt service routine when interrupts
1110 * in use, or set as the timeout function in polled mode.
1111 * @data: This parameter specifies the ISCI host object
1112 *
1113 */
1114void isci_host_completion_routine(unsigned long data)
1115{
1116 struct isci_host *ihost = (struct isci_host *)data;
1091 struct list_head completed_request_list;
1092 struct list_head *current_position;
1093 struct list_head *next_position;
1094 struct isci_request *request;
1095 struct sas_task *task;
1096 u16 active;
1097
1117 u16 active;
1118
1098 INIT_LIST_HEAD(&completed_request_list);
1099
1100 spin_lock_irq(&ihost->scic_lock);
1119 spin_lock_irq(&ihost->scic_lock);
1101
1102 sci_controller_completion_handler(ihost);
1120 sci_controller_completion_handler(ihost);
1103
1104 /* Take the lists of completed I/Os from the host. */
1105 list_splice_init(&ihost->requests_to_complete,
1106 &completed_request_list);
1107
1108 /* Process any completions in the list. */
1109 list_for_each_safe(current_position, next_position,
1110 &completed_request_list) {
1111
1112 request = list_entry(current_position, struct isci_request,
1113 completed_node);
1114 task = isci_request_access_task(request);
1115
1116 /* Return the task to libsas */
1117 if (task != NULL) {
1118
1119 task->lldd_task = NULL;
1120 if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &request->flags) &&
1121 !(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
1122 if (test_bit(IREQ_COMPLETE_IN_TARGET,
1123 &request->flags)) {
1124
1125 /* Normal notification (task_done) */
1126 dev_dbg(&ihost->pdev->dev, "%s: Normal"
1127 " - request/task = %p/%p\n",
1128 __func__, request, task);
1129
1130 task->task_done(task);
1131 } else {
1132 dev_warn(&ihost->pdev->dev,
1133 "%s: Error - request/task"
1134 " = %p/%p\n",
1135 __func__, request, task);
1136
1137 sas_task_abort(task);
1138 }
1139 }
1140 }
1141 if (test_and_clear_bit(IREQ_ABORT_PATH_ACTIVE, &request->flags))
1142 wake_up_all(&ihost->eventq);
1143
1144 if (!test_bit(IREQ_NO_AUTO_FREE_TAG, &request->flags))
1145 isci_free_tag(ihost, request->io_tag);
1146 }
1147 spin_unlock_irq(&ihost->scic_lock);
1148
1149 /* the coalesence timeout doubles at each encoding step, so
1150 * update it based on the ilog2 value of the outstanding requests
1151 */
1152 active = isci_tci_active(ihost);
1153 writel(SMU_ICC_GEN_VAL(NUMBER, active) |
1154 SMU_ICC_GEN_VAL(TIMER, ISCI_COALESCE_BASE + ilog2(active)),

--- 1671 unchanged lines hidden ---
1121 spin_unlock_irq(&ihost->scic_lock);
1122
1123 /* the coalesence timeout doubles at each encoding step, so
1124 * update it based on the ilog2 value of the outstanding requests
1125 */
1126 active = isci_tci_active(ihost);
1127 writel(SMU_ICC_GEN_VAL(NUMBER, active) |
1128 SMU_ICC_GEN_VAL(TIMER, ISCI_COALESCE_BASE + ilog2(active)),

--- 1671 unchanged lines hidden ---