diff options
author | Bradley Grove <bgrove@attotech.com> | 2013-10-01 14:26:02 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-10-25 04:58:59 -0400 |
commit | 8e65e2f07c1fdbd952570591bf78316aeed1c74a (patch) | |
tree | 4e9fa1c055dc6c513893502b304c46ea31158156 | |
parent | 9588d24e36003b53f76e43b4fadfc5b35207be04 (diff) |
[SCSI] esas2r: Fixes for big-endian platforms
In esas2r_format_init_msg(), sgl_page_size and epoch_time params
are converted to little endian and the firmware version read from
the hba is converted to cpu endianess.
In esas2r_rq_init_request, correct and simplify the construction
of the SCSI handle.
These fixes are the result of testing on a PPC64 machine.
Signed-off-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/esas2r/esas2r.h | 7 | ||||
-rw-r--r-- | drivers/scsi/esas2r/esas2r_init.c | 11 |
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h index d128c96a501d..3fd305d6b67d 100644 --- a/drivers/scsi/esas2r/esas2r.h +++ b/drivers/scsi/esas2r/esas2r.h | |||
@@ -1207,7 +1207,6 @@ static inline void esas2r_rq_init_request(struct esas2r_request *rq, | |||
1207 | struct esas2r_adapter *a) | 1207 | struct esas2r_adapter *a) |
1208 | { | 1208 | { |
1209 | union atto_vda_req *vrq = rq->vrq; | 1209 | union atto_vda_req *vrq = rq->vrq; |
1210 | u32 handle; | ||
1211 | 1210 | ||
1212 | INIT_LIST_HEAD(&rq->sg_table_head); | 1211 | INIT_LIST_HEAD(&rq->sg_table_head); |
1213 | rq->data_buf = (void *)(vrq + 1); | 1212 | rq->data_buf = (void *)(vrq + 1); |
@@ -1243,11 +1242,9 @@ static inline void esas2r_rq_init_request(struct esas2r_request *rq, | |||
1243 | 1242 | ||
1244 | /* | 1243 | /* |
1245 | * add a reference number to the handle to make it unique (until it | 1244 | * add a reference number to the handle to make it unique (until it |
1246 | * wraps of course) while preserving the upper word | 1245 | * wraps of course) while preserving the least significant word |
1247 | */ | 1246 | */ |
1248 | 1247 | vrq->scsi.handle = (a->cmd_ref_no++ << 16) | (u16)vrq->scsi.handle; | |
1249 | handle = be32_to_cpu(vrq->scsi.handle) & 0xFFFF0000; | ||
1250 | vrq->scsi.handle = cpu_to_be32(handle + a->cmd_ref_no++); | ||
1251 | 1248 | ||
1252 | /* | 1249 | /* |
1253 | * the following formats a SCSI request. the caller can override as | 1250 | * the following formats a SCSI request. the caller can override as |
diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index 15d222b407f6..8278819669e3 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c | |||
@@ -1235,8 +1235,8 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a, | |||
1235 | 0, | 1235 | 0, |
1236 | NULL); | 1236 | NULL); |
1237 | ci = (struct atto_vda_cfg_init *)&rq->vrq->cfg.data.init; | 1237 | ci = (struct atto_vda_cfg_init *)&rq->vrq->cfg.data.init; |
1238 | ci->sgl_page_size = sgl_page_size; | 1238 | ci->sgl_page_size = cpu_to_le32(sgl_page_size); |
1239 | ci->epoch_time = now.tv_sec; | 1239 | ci->epoch_time = cpu_to_le32(now.tv_sec); |
1240 | rq->flags |= RF_FAILURE_OK; | 1240 | rq->flags |= RF_FAILURE_OK; |
1241 | a->init_msg = ESAS2R_INIT_MSG_INIT; | 1241 | a->init_msg = ESAS2R_INIT_MSG_INIT; |
1242 | break; | 1242 | break; |
@@ -1246,12 +1246,15 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a, | |||
1246 | if (rq->req_stat == RS_SUCCESS) { | 1246 | if (rq->req_stat == RS_SUCCESS) { |
1247 | u32 major; | 1247 | u32 major; |
1248 | u32 minor; | 1248 | u32 minor; |
1249 | u16 fw_release; | ||
1249 | 1250 | ||
1250 | a->fw_version = le16_to_cpu( | 1251 | a->fw_version = le16_to_cpu( |
1251 | rq->func_rsp.cfg_rsp.vda_version); | 1252 | rq->func_rsp.cfg_rsp.vda_version); |
1252 | a->fw_build = rq->func_rsp.cfg_rsp.fw_build; | 1253 | a->fw_build = rq->func_rsp.cfg_rsp.fw_build; |
1253 | major = LOBYTE(rq->func_rsp.cfg_rsp.fw_release); | 1254 | fw_release = le16_to_cpu( |
1254 | minor = HIBYTE(rq->func_rsp.cfg_rsp.fw_release); | 1255 | rq->func_rsp.cfg_rsp.fw_release); |
1256 | major = LOBYTE(fw_release); | ||
1257 | minor = HIBYTE(fw_release); | ||
1255 | a->fw_version += (major << 16) + (minor << 24); | 1258 | a->fw_version += (major << 16) + (minor << 24); |
1256 | } else { | 1259 | } else { |
1257 | esas2r_hdebug("FAILED"); | 1260 | esas2r_hdebug("FAILED"); |