diff options
author | Jing Huang <huangj@brocade.com> | 2010-03-19 14:07:36 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:24:23 -0400 |
commit | 077424e2e2c97c830d903891dfcd1532068b85b7 (patch) | |
tree | d3e37bbbcc8d5f0d45dc39b95db05b6ddcd1a5a9 /drivers | |
parent | 42b426ecb453cf49c3d16cf1d7a5e5d8cab9869d (diff) |
[SCSI] bfa: sg addr big endian fix
sg address in IO request is not set up correctly for big endian platform.
add new macros to properly swap the address.
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/bfa/bfa_ioim.c | 4 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_os_inc.h | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/scsi/bfa/bfa_ioim.c b/drivers/scsi/bfa/bfa_ioim.c index 8a1be201d29b..687f3d6e252b 100644 --- a/drivers/scsi/bfa/bfa_ioim.c +++ b/drivers/scsi/bfa/bfa_ioim.c | |||
@@ -758,7 +758,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
758 | sge = &m->sges[0]; | 758 | sge = &m->sges[0]; |
759 | if (ioim->nsges) { | 759 | if (ioim->nsges) { |
760 | sg = (struct scatterlist *)scsi_sglist(cmnd); | 760 | sg = (struct scatterlist *)scsi_sglist(cmnd); |
761 | addr = (u64) sg_dma_address(sg); | 761 | addr = bfa_os_sgaddr(sg_dma_address(sg)); |
762 | sge->sga = *(union bfi_addr_u *) &addr; | 762 | sge->sga = *(union bfi_addr_u *) &addr; |
763 | pgdlen = sg_dma_len(sg); | 763 | pgdlen = sg_dma_len(sg); |
764 | sge->sg_len = pgdlen; | 764 | sge->sg_len = pgdlen; |
@@ -891,7 +891,7 @@ bfa_ioim_sgpg_setup(struct bfa_ioim_s *ioim) | |||
891 | 891 | ||
892 | pgcumsz = 0; | 892 | pgcumsz = 0; |
893 | for (i = 0; i < nsges; i++, sge++, sgeid++, sg = sg_next(sg)) { | 893 | for (i = 0; i < nsges; i++, sge++, sgeid++, sg = sg_next(sg)) { |
894 | addr = (u64) sg_dma_address(sg); | 894 | addr = bfa_os_sgaddr(sg_dma_address(sg)); |
895 | sge->sga = *(union bfi_addr_u *) &addr; | 895 | sge->sga = *(union bfi_addr_u *) &addr; |
896 | sge->sg_len = sg_dma_len(sg); | 896 | sge->sg_len = sg_dma_len(sg); |
897 | pgcumsz += sge->sg_len; | 897 | pgcumsz += sge->sg_len; |
diff --git a/drivers/scsi/bfa/bfa_os_inc.h b/drivers/scsi/bfa/bfa_os_inc.h index 10a89f75fa94..4eb1330d5b30 100644 --- a/drivers/scsi/bfa/bfa_os_inc.h +++ b/drivers/scsi/bfa/bfa_os_inc.h | |||
@@ -50,6 +50,10 @@ | |||
50 | #include <scsi/scsi_transport_fc.h> | 50 | #include <scsi/scsi_transport_fc.h> |
51 | #include <scsi/scsi_transport.h> | 51 | #include <scsi/scsi_transport.h> |
52 | 52 | ||
53 | #ifdef __BIG_ENDIAN | ||
54 | #define __BIGENDIAN | ||
55 | #endif | ||
56 | |||
53 | #define BFA_ERR KERN_ERR | 57 | #define BFA_ERR KERN_ERR |
54 | #define BFA_WARNING KERN_WARNING | 58 | #define BFA_WARNING KERN_WARNING |
55 | #define BFA_NOTICE KERN_NOTICE | 59 | #define BFA_NOTICE KERN_NOTICE |
@@ -123,6 +127,15 @@ int bfa_os_MWB(void *); | |||
123 | (((_x) & 0x00ff0000) >> 8) | \ | 127 | (((_x) & 0x00ff0000) >> 8) | \ |
124 | (((_x) & 0xff000000) >> 24)) | 128 | (((_x) & 0xff000000) >> 24)) |
125 | 129 | ||
130 | #define bfa_os_swap_sgaddr(_x) ((u64)( \ | ||
131 | (((u64)(_x) & (u64)0x00000000000000ffull) << 32) | \ | ||
132 | (((u64)(_x) & (u64)0x000000000000ff00ull) << 32) | \ | ||
133 | (((u64)(_x) & (u64)0x0000000000ff0000ull) << 32) | \ | ||
134 | (((u64)(_x) & (u64)0x00000000ff000000ull) << 32) | \ | ||
135 | (((u64)(_x) & (u64)0x000000ff00000000ull) >> 32) | \ | ||
136 | (((u64)(_x) & (u64)0x0000ff0000000000ull) >> 32) | \ | ||
137 | (((u64)(_x) & (u64)0x00ff000000000000ull) >> 32) | \ | ||
138 | (((u64)(_x) & (u64)0xff00000000000000ull) >> 32))) | ||
126 | 139 | ||
127 | #ifndef __BIGENDIAN | 140 | #ifndef __BIGENDIAN |
128 | #define bfa_os_htons(_x) ((u16)((((_x) & 0xff00) >> 8) | \ | 141 | #define bfa_os_htons(_x) ((u16)((((_x) & 0xff00) >> 8) | \ |
@@ -133,6 +146,7 @@ int bfa_os_MWB(void *); | |||
133 | #define bfa_os_hton3b(_x) bfa_swap_3b(_x) | 146 | #define bfa_os_hton3b(_x) bfa_swap_3b(_x) |
134 | 147 | ||
135 | #define bfa_os_wtole(_x) (_x) | 148 | #define bfa_os_wtole(_x) (_x) |
149 | #define bfa_os_sgaddr(_x) (_x) | ||
136 | 150 | ||
137 | #else | 151 | #else |
138 | 152 | ||
@@ -141,6 +155,7 @@ int bfa_os_MWB(void *); | |||
141 | #define bfa_os_hton3b(_x) (_x) | 155 | #define bfa_os_hton3b(_x) (_x) |
142 | #define bfa_os_htonll(_x) (_x) | 156 | #define bfa_os_htonll(_x) (_x) |
143 | #define bfa_os_wtole(_x) bfa_os_swap32(_x) | 157 | #define bfa_os_wtole(_x) bfa_os_swap32(_x) |
158 | #define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x) | ||
144 | 159 | ||
145 | #endif | 160 | #endif |
146 | 161 | ||