Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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