sas_task.c (762f99f4f3cb41a775b5157dd761217beba65873) | sas_task.c (1d6049a3b14feb39c8d6c8f538a711dcc54f88e0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2 3#include "sas_internal.h" 4 5#include <linux/kernel.h> 6#include <linux/export.h> 7#include <scsi/sas.h> 8#include <scsi/libsas.h> 9 10/* fill task_status_struct based on SSP response frame */ 11void sas_ssp_task_response(struct device *dev, struct sas_task *task, 12 struct ssp_response_iu *iu) 13{ 14 struct task_status_struct *tstat = &task->task_status; 15 16 tstat->resp = SAS_TASK_COMPLETE; 17 | 1// SPDX-License-Identifier: GPL-2.0-only 2 3#include "sas_internal.h" 4 5#include <linux/kernel.h> 6#include <linux/export.h> 7#include <scsi/sas.h> 8#include <scsi/libsas.h> 9 10/* fill task_status_struct based on SSP response frame */ 11void sas_ssp_task_response(struct device *dev, struct sas_task *task, 12 struct ssp_response_iu *iu) 13{ 14 struct task_status_struct *tstat = &task->task_status; 15 16 tstat->resp = SAS_TASK_COMPLETE; 17 |
18 if (iu->datapres == 0) | 18 switch (iu->datapres) { 19 case SAS_DATAPRES_NO_DATA: |
19 tstat->stat = iu->status; | 20 tstat->stat = iu->status; |
20 else if (iu->datapres == 1) | 21 break; 22 case SAS_DATAPRES_RESPONSE_DATA: |
21 tstat->stat = iu->resp_data[3]; | 23 tstat->stat = iu->resp_data[3]; |
22 else if (iu->datapres == 2) { | 24 break; 25 case SAS_DATAPRES_SENSE_DATA: |
23 tstat->stat = SAS_SAM_STAT_CHECK_CONDITION; 24 tstat->buf_valid_size = 25 min_t(int, SAS_STATUS_BUF_SIZE, 26 be32_to_cpu(iu->sense_data_len)); 27 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size); 28 29 if (iu->status != SAM_STAT_CHECK_CONDITION) 30 dev_warn(dev, "dev %016llx sent sense data, but stat(0x%x) is not CHECK CONDITION\n", 31 SAS_ADDR(task->dev->sas_addr), iu->status); | 26 tstat->stat = SAS_SAM_STAT_CHECK_CONDITION; 27 tstat->buf_valid_size = 28 min_t(int, SAS_STATUS_BUF_SIZE, 29 be32_to_cpu(iu->sense_data_len)); 30 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size); 31 32 if (iu->status != SAM_STAT_CHECK_CONDITION) 33 dev_warn(dev, "dev %016llx sent sense data, but stat(0x%x) is not CHECK CONDITION\n", 34 SAS_ADDR(task->dev->sas_addr), iu->status); |
32 } 33 else | 35 break; 36 default: |
34 /* when datapres contains corrupt/unknown value... */ 35 tstat->stat = SAS_SAM_STAT_CHECK_CONDITION; | 37 /* when datapres contains corrupt/unknown value... */ 38 tstat->stat = SAS_SAM_STAT_CHECK_CONDITION; |
39 } |
|
36} 37EXPORT_SYMBOL_GPL(sas_ssp_task_response); 38 | 40} 41EXPORT_SYMBOL_GPL(sas_ssp_task_response); 42 |