diff options
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 23 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 397 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commctrl.c | 93 | ||||
-rw-r--r-- | drivers/scsi/aacraid/comminit.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commsup.c | 13 | ||||
-rw-r--r-- | drivers/scsi/aacraid/dpcsup.c | 6 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 2 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rkt.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 6 | ||||
-rw-r--r-- | drivers/scsi/aacraid/sa.c | 2 |
10 files changed, 303 insertions, 247 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 66d48e0c4cd7..9946e305055b 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -1893,7 +1893,9 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg) | |||
1893 | } | 1893 | } |
1894 | /* hba wants the size to be exact */ | 1894 | /* hba wants the size to be exact */ |
1895 | if(byte_count > scsicmd->request_bufflen){ | 1895 | if(byte_count > scsicmd->request_bufflen){ |
1896 | psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen); | 1896 | u32 temp = le32_to_cpu(psg->sg[i-1].count) - |
1897 | (byte_count - scsicmd->request_bufflen); | ||
1898 | psg->sg[i-1].count = cpu_to_le32(temp); | ||
1897 | byte_count = scsicmd->request_bufflen; | 1899 | byte_count = scsicmd->request_bufflen; |
1898 | } | 1900 | } |
1899 | /* Check for command underflow */ | 1901 | /* Check for command underflow */ |
@@ -1922,7 +1924,7 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p | |||
1922 | { | 1924 | { |
1923 | struct aac_dev *dev; | 1925 | struct aac_dev *dev; |
1924 | unsigned long byte_count = 0; | 1926 | unsigned long byte_count = 0; |
1925 | u64 le_addr; | 1927 | u64 addr; |
1926 | 1928 | ||
1927 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; | 1929 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; |
1928 | // Get rid of old data | 1930 | // Get rid of old data |
@@ -1943,16 +1945,18 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p | |||
1943 | byte_count = 0; | 1945 | byte_count = 0; |
1944 | 1946 | ||
1945 | for (i = 0; i < sg_count; i++) { | 1947 | for (i = 0; i < sg_count; i++) { |
1946 | le_addr = cpu_to_le64(sg_dma_address(sg)); | 1948 | addr = sg_dma_address(sg); |
1947 | psg->sg[i].addr[1] = (u32)(le_addr>>32); | 1949 | psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); |
1948 | psg->sg[i].addr[0] = (u32)(le_addr & 0xffffffff); | 1950 | psg->sg[i].addr[1] = cpu_to_le32(addr>>32); |
1949 | psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); | 1951 | psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); |
1950 | byte_count += sg_dma_len(sg); | 1952 | byte_count += sg_dma_len(sg); |
1951 | sg++; | 1953 | sg++; |
1952 | } | 1954 | } |
1953 | /* hba wants the size to be exact */ | 1955 | /* hba wants the size to be exact */ |
1954 | if(byte_count > scsicmd->request_bufflen){ | 1956 | if(byte_count > scsicmd->request_bufflen){ |
1955 | psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen); | 1957 | u32 temp = le32_to_cpu(psg->sg[i-1].count) - |
1958 | (byte_count - scsicmd->request_bufflen); | ||
1959 | psg->sg[i-1].count = cpu_to_le32(temp); | ||
1956 | byte_count = scsicmd->request_bufflen; | 1960 | byte_count = scsicmd->request_bufflen; |
1957 | } | 1961 | } |
1958 | /* Check for command underflow */ | 1962 | /* Check for command underflow */ |
@@ -1962,15 +1966,14 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p | |||
1962 | } | 1966 | } |
1963 | } | 1967 | } |
1964 | else if(scsicmd->request_bufflen) { | 1968 | else if(scsicmd->request_bufflen) { |
1965 | dma_addr_t addr; | 1969 | u64 addr; |
1966 | addr = pci_map_single(dev->pdev, | 1970 | addr = pci_map_single(dev->pdev, |
1967 | scsicmd->request_buffer, | 1971 | scsicmd->request_buffer, |
1968 | scsicmd->request_bufflen, | 1972 | scsicmd->request_bufflen, |
1969 | scsicmd->sc_data_direction); | 1973 | scsicmd->sc_data_direction); |
1970 | psg->count = cpu_to_le32(1); | 1974 | psg->count = cpu_to_le32(1); |
1971 | le_addr = cpu_to_le64(addr); | 1975 | psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff); |
1972 | psg->sg[0].addr[1] = (u32)(le_addr>>32); | 1976 | psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); |
1973 | psg->sg[0].addr[0] = (u32)(le_addr & 0xffffffff); | ||
1974 | psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); | 1977 | psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); |
1975 | scsicmd->SCp.dma_handle = addr; | 1978 | scsicmd->SCp.dma_handle = addr; |
1976 | byte_count = scsicmd->request_bufflen; | 1979 | byte_count = scsicmd->request_bufflen; |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 3f89ee995130..a250a6f359b1 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -89,11 +89,21 @@ struct diskparm | |||
89 | * on 64 bit systems not all cards support the 64 bit version | 89 | * on 64 bit systems not all cards support the 64 bit version |
90 | */ | 90 | */ |
91 | struct sgentry { | 91 | struct sgentry { |
92 | __le32 addr; /* 32-bit address. */ | ||
93 | __le32 count; /* Length. */ | ||
94 | }; | ||
95 | |||
96 | struct user_sgentry { | ||
92 | u32 addr; /* 32-bit address. */ | 97 | u32 addr; /* 32-bit address. */ |
93 | u32 count; /* Length. */ | 98 | u32 count; /* Length. */ |
94 | }; | 99 | }; |
95 | 100 | ||
96 | struct sgentry64 { | 101 | struct sgentry64 { |
102 | __le32 addr[2]; /* 64-bit addr. 2 pieces for data alignment */ | ||
103 | __le32 count; /* Length. */ | ||
104 | }; | ||
105 | |||
106 | struct user_sgentry64 { | ||
97 | u32 addr[2]; /* 64-bit addr. 2 pieces for data alignment */ | 107 | u32 addr[2]; /* 64-bit addr. 2 pieces for data alignment */ |
98 | u32 count; /* Length. */ | 108 | u32 count; /* Length. */ |
99 | }; | 109 | }; |
@@ -106,15 +116,25 @@ struct sgentry64 { | |||
106 | */ | 116 | */ |
107 | 117 | ||
108 | struct sgmap { | 118 | struct sgmap { |
109 | u32 count; | 119 | __le32 count; |
110 | struct sgentry sg[1]; | 120 | struct sgentry sg[1]; |
111 | }; | 121 | }; |
112 | 122 | ||
113 | struct sgmap64 { | 123 | struct user_sgmap { |
114 | u32 count; | 124 | u32 count; |
125 | struct user_sgentry sg[1]; | ||
126 | }; | ||
127 | |||
128 | struct sgmap64 { | ||
129 | __le32 count; | ||
115 | struct sgentry64 sg[1]; | 130 | struct sgentry64 sg[1]; |
116 | }; | 131 | }; |
117 | 132 | ||
133 | struct user_sgmap64 { | ||
134 | u32 count; | ||
135 | struct user_sgentry64 sg[1]; | ||
136 | }; | ||
137 | |||
118 | struct creation_info | 138 | struct creation_info |
119 | { | 139 | { |
120 | u8 buildnum; /* e.g., 588 */ | 140 | u8 buildnum; /* e.g., 588 */ |
@@ -123,14 +143,14 @@ struct creation_info | |||
123 | * 2 = API | 143 | * 2 = API |
124 | */ | 144 | */ |
125 | u8 year; /* e.g., 1997 = 97 */ | 145 | u8 year; /* e.g., 1997 = 97 */ |
126 | u32 date; /* | 146 | __le32 date; /* |
127 | * unsigned Month :4; // 1 - 12 | 147 | * unsigned Month :4; // 1 - 12 |
128 | * unsigned Day :6; // 1 - 32 | 148 | * unsigned Day :6; // 1 - 32 |
129 | * unsigned Hour :6; // 0 - 23 | 149 | * unsigned Hour :6; // 0 - 23 |
130 | * unsigned Minute :6; // 0 - 60 | 150 | * unsigned Minute :6; // 0 - 60 |
131 | * unsigned Second :6; // 0 - 60 | 151 | * unsigned Second :6; // 0 - 60 |
132 | */ | 152 | */ |
133 | u32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */ | 153 | __le32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */ |
134 | }; | 154 | }; |
135 | 155 | ||
136 | 156 | ||
@@ -175,8 +195,8 @@ struct creation_info | |||
175 | */ | 195 | */ |
176 | 196 | ||
177 | struct aac_entry { | 197 | struct aac_entry { |
178 | u32 size; /* Size in bytes of Fib which this QE points to */ | 198 | __le32 size; /* Size in bytes of Fib which this QE points to */ |
179 | u32 addr; /* Receiver address of the FIB */ | 199 | __le32 addr; /* Receiver address of the FIB */ |
180 | }; | 200 | }; |
181 | 201 | ||
182 | /* | 202 | /* |
@@ -185,9 +205,10 @@ struct aac_entry { | |||
185 | */ | 205 | */ |
186 | 206 | ||
187 | struct aac_qhdr { | 207 | struct aac_qhdr { |
188 | u64 header_addr; /* Address to hand the adapter to access to this queue head */ | 208 | __le64 header_addr;/* Address to hand the adapter to access |
189 | u32 *producer; /* The producer index for this queue (host address) */ | 209 | to this queue head */ |
190 | u32 *consumer; /* The consumer index for this queue (host address) */ | 210 | __le32 *producer; /* The producer index for this queue (host address) */ |
211 | __le32 *consumer; /* The consumer index for this queue (host address) */ | ||
191 | }; | 212 | }; |
192 | 213 | ||
193 | /* | 214 | /* |
@@ -261,19 +282,23 @@ enum aac_queue_types { | |||
261 | */ | 282 | */ |
262 | 283 | ||
263 | struct aac_fibhdr { | 284 | struct aac_fibhdr { |
264 | u32 XferState; // Current transfer state for this CCB | 285 | __le32 XferState; /* Current transfer state for this CCB */ |
265 | u16 Command; // Routing information for the destination | 286 | __le16 Command; /* Routing information for the destination */ |
266 | u8 StructType; // Type FIB | 287 | u8 StructType; /* Type FIB */ |
267 | u8 Flags; // Flags for FIB | 288 | u8 Flags; /* Flags for FIB */ |
268 | u16 Size; // Size of this FIB in bytes | 289 | __le16 Size; /* Size of this FIB in bytes */ |
269 | u16 SenderSize; // Size of the FIB in the sender (for response sizing) | 290 | __le16 SenderSize; /* Size of the FIB in the sender |
270 | u32 SenderFibAddress; // Host defined data in the FIB | 291 | (for response sizing) */ |
271 | u32 ReceiverFibAddress; // Logical address of this FIB for the adapter | 292 | __le32 SenderFibAddress; /* Host defined data in the FIB */ |
272 | u32 SenderData; // Place holder for the sender to store data | 293 | __le32 ReceiverFibAddress;/* Logical address of this FIB for |
294 | the adapter */ | ||
295 | u32 SenderData; /* Place holder for the sender to store data */ | ||
273 | union { | 296 | union { |
274 | struct { | 297 | struct { |
275 | u32 _ReceiverTimeStart; // Timestamp for receipt of fib | 298 | __le32 _ReceiverTimeStart; /* Timestamp for |
276 | u32 _ReceiverTimeDone; // Timestamp for completion of fib | 299 | receipt of fib */ |
300 | __le32 _ReceiverTimeDone; /* Timestamp for | ||
301 | completion of fib */ | ||
277 | } _s; | 302 | } _s; |
278 | } _u; | 303 | } _u; |
279 | }; | 304 | }; |
@@ -385,19 +410,20 @@ enum fib_xfer_state { | |||
385 | 410 | ||
386 | struct aac_init | 411 | struct aac_init |
387 | { | 412 | { |
388 | u32 InitStructRevision; | 413 | __le32 InitStructRevision; |
389 | u32 MiniPortRevision; | 414 | __le32 MiniPortRevision; |
390 | u32 fsrev; | 415 | __le32 fsrev; |
391 | u32 CommHeaderAddress; | 416 | __le32 CommHeaderAddress; |
392 | u32 FastIoCommAreaAddress; | 417 | __le32 FastIoCommAreaAddress; |
393 | u32 AdapterFibsPhysicalAddress; | 418 | __le32 AdapterFibsPhysicalAddress; |
394 | u32 AdapterFibsVirtualAddress; | 419 | __le32 AdapterFibsVirtualAddress; |
395 | u32 AdapterFibsSize; | 420 | __le32 AdapterFibsSize; |
396 | u32 AdapterFibAlign; | 421 | __le32 AdapterFibAlign; |
397 | u32 printfbuf; | 422 | __le32 printfbuf; |
398 | u32 printfbufsiz; | 423 | __le32 printfbufsiz; |
399 | u32 HostPhysMemPages; // number of 4k pages of host physical memory | 424 | __le32 HostPhysMemPages; /* number of 4k pages of host |
400 | u32 HostElapsedSeconds; // number of seconds since 1970. | 425 | physical memory */ |
426 | __le32 HostElapsedSeconds; /* number of seconds since 1970. */ | ||
401 | }; | 427 | }; |
402 | 428 | ||
403 | enum aac_log_level { | 429 | enum aac_log_level { |
@@ -763,27 +789,27 @@ struct fib { | |||
763 | 789 | ||
764 | struct aac_adapter_info | 790 | struct aac_adapter_info |
765 | { | 791 | { |
766 | u32 platform; | 792 | __le32 platform; |
767 | u32 cpu; | 793 | __le32 cpu; |
768 | u32 subcpu; | 794 | __le32 subcpu; |
769 | u32 clock; | 795 | __le32 clock; |
770 | u32 execmem; | 796 | __le32 execmem; |
771 | u32 buffermem; | 797 | __le32 buffermem; |
772 | u32 totalmem; | 798 | __le32 totalmem; |
773 | u32 kernelrev; | 799 | __le32 kernelrev; |
774 | u32 kernelbuild; | 800 | __le32 kernelbuild; |
775 | u32 monitorrev; | 801 | __le32 monitorrev; |
776 | u32 monitorbuild; | 802 | __le32 monitorbuild; |
777 | u32 hwrev; | 803 | __le32 hwrev; |
778 | u32 hwbuild; | 804 | __le32 hwbuild; |
779 | u32 biosrev; | 805 | __le32 biosrev; |
780 | u32 biosbuild; | 806 | __le32 biosbuild; |
781 | u32 cluster; | 807 | __le32 cluster; |
782 | u32 clusterchannelmask; | 808 | __le32 clusterchannelmask; |
783 | u32 serial[2]; | 809 | __le32 serial[2]; |
784 | u32 battery; | 810 | __le32 battery; |
785 | u32 options; | 811 | __le32 options; |
786 | u32 OEM; | 812 | __le32 OEM; |
787 | }; | 813 | }; |
788 | 814 | ||
789 | /* | 815 | /* |
@@ -1016,83 +1042,102 @@ struct aac_dev | |||
1016 | 1042 | ||
1017 | struct aac_read | 1043 | struct aac_read |
1018 | { | 1044 | { |
1019 | u32 command; | 1045 | __le32 command; |
1020 | u32 cid; | 1046 | __le32 cid; |
1021 | u32 block; | 1047 | __le32 block; |
1022 | u32 count; | 1048 | __le32 count; |
1023 | struct sgmap sg; // Must be last in struct because it is variable | 1049 | struct sgmap sg; // Must be last in struct because it is variable |
1024 | }; | 1050 | }; |
1025 | 1051 | ||
1026 | struct aac_read64 | 1052 | struct aac_read64 |
1027 | { | 1053 | { |
1028 | u32 command; | 1054 | __le32 command; |
1029 | u16 cid; | 1055 | __le16 cid; |
1030 | u16 sector_count; | 1056 | __le16 sector_count; |
1031 | u32 block; | 1057 | __le32 block; |
1032 | u16 pad; | 1058 | __le16 pad; |
1033 | u16 flags; | 1059 | __le16 flags; |
1034 | struct sgmap64 sg; // Must be last in struct because it is variable | 1060 | struct sgmap64 sg; // Must be last in struct because it is variable |
1035 | }; | 1061 | }; |
1036 | 1062 | ||
1037 | struct aac_read_reply | 1063 | struct aac_read_reply |
1038 | { | 1064 | { |
1039 | u32 status; | 1065 | __le32 status; |
1040 | u32 count; | 1066 | __le32 count; |
1041 | }; | 1067 | }; |
1042 | 1068 | ||
1043 | struct aac_write | 1069 | struct aac_write |
1044 | { | 1070 | { |
1045 | u32 command; | 1071 | __le32 command; |
1046 | u32 cid; | 1072 | __le32 cid; |
1047 | u32 block; | 1073 | __le32 block; |
1048 | u32 count; | 1074 | __le32 count; |
1049 | u32 stable; // Not used | 1075 | __le32 stable; // Not used |
1050 | struct sgmap sg; // Must be last in struct because it is variable | 1076 | struct sgmap sg; // Must be last in struct because it is variable |
1051 | }; | 1077 | }; |
1052 | 1078 | ||
1053 | struct aac_write64 | 1079 | struct aac_write64 |
1054 | { | 1080 | { |
1055 | u32 command; | 1081 | __le32 command; |
1056 | u16 cid; | 1082 | __le16 cid; |
1057 | u16 sector_count; | 1083 | __le16 sector_count; |
1058 | u32 block; | 1084 | __le32 block; |
1059 | u16 pad; | 1085 | __le16 pad; |
1060 | u16 flags; | 1086 | __le16 flags; |
1061 | struct sgmap64 sg; // Must be last in struct because it is variable | 1087 | struct sgmap64 sg; // Must be last in struct because it is variable |
1062 | }; | 1088 | }; |
1063 | struct aac_write_reply | 1089 | struct aac_write_reply |
1064 | { | 1090 | { |
1065 | u32 status; | 1091 | __le32 status; |
1066 | u32 count; | 1092 | __le32 count; |
1067 | u32 committed; | 1093 | __le32 committed; |
1068 | }; | 1094 | }; |
1069 | 1095 | ||
1070 | #define CT_FLUSH_CACHE 129 | 1096 | #define CT_FLUSH_CACHE 129 |
1071 | struct aac_synchronize { | 1097 | struct aac_synchronize { |
1072 | u32 command; /* VM_ContainerConfig */ | 1098 | __le32 command; /* VM_ContainerConfig */ |
1073 | u32 type; /* CT_FLUSH_CACHE */ | 1099 | __le32 type; /* CT_FLUSH_CACHE */ |
1074 | u32 cid; | 1100 | __le32 cid; |
1075 | u32 parm1; | 1101 | __le32 parm1; |
1076 | u32 parm2; | 1102 | __le32 parm2; |
1077 | u32 parm3; | 1103 | __le32 parm3; |
1078 | u32 parm4; | 1104 | __le32 parm4; |
1079 | u32 count; /* sizeof(((struct aac_synchronize_reply *)NULL)->data) */ | 1105 | __le32 count; /* sizeof(((struct aac_synchronize_reply *)NULL)->data) */ |
1080 | }; | 1106 | }; |
1081 | 1107 | ||
1082 | struct aac_synchronize_reply { | 1108 | struct aac_synchronize_reply { |
1083 | u32 dummy0; | 1109 | __le32 dummy0; |
1084 | u32 dummy1; | 1110 | __le32 dummy1; |
1085 | u32 status; /* CT_OK */ | 1111 | __le32 status; /* CT_OK */ |
1086 | u32 parm1; | 1112 | __le32 parm1; |
1087 | u32 parm2; | 1113 | __le32 parm2; |
1088 | u32 parm3; | 1114 | __le32 parm3; |
1089 | u32 parm4; | 1115 | __le32 parm4; |
1090 | u32 parm5; | 1116 | __le32 parm5; |
1091 | u8 data[16]; | 1117 | u8 data[16]; |
1092 | }; | 1118 | }; |
1093 | 1119 | ||
1094 | struct aac_srb | 1120 | struct aac_srb |
1095 | { | 1121 | { |
1122 | __le32 function; | ||
1123 | __le32 channel; | ||
1124 | __le32 id; | ||
1125 | __le32 lun; | ||
1126 | __le32 timeout; | ||
1127 | __le32 flags; | ||
1128 | __le32 count; // Data xfer size | ||
1129 | __le32 retry_limit; | ||
1130 | __le32 cdb_size; | ||
1131 | u8 cdb[16]; | ||
1132 | struct sgmap sg; | ||
1133 | }; | ||
1134 | |||
1135 | /* | ||
1136 | * This and assocated data structs are used by the | ||
1137 | * ioctl caller and are in cpu order. | ||
1138 | */ | ||
1139 | struct user_aac_srb | ||
1140 | { | ||
1096 | u32 function; | 1141 | u32 function; |
1097 | u32 channel; | 1142 | u32 channel; |
1098 | u32 id; | 1143 | u32 id; |
@@ -1103,20 +1148,18 @@ struct aac_srb | |||
1103 | u32 retry_limit; | 1148 | u32 retry_limit; |
1104 | u32 cdb_size; | 1149 | u32 cdb_size; |
1105 | u8 cdb[16]; | 1150 | u8 cdb[16]; |
1106 | struct sgmap sg; | 1151 | struct user_sgmap sg; |
1107 | }; | 1152 | }; |
1108 | 1153 | ||
1109 | |||
1110 | |||
1111 | #define AAC_SENSE_BUFFERSIZE 30 | 1154 | #define AAC_SENSE_BUFFERSIZE 30 |
1112 | 1155 | ||
1113 | struct aac_srb_reply | 1156 | struct aac_srb_reply |
1114 | { | 1157 | { |
1115 | u32 status; | 1158 | __le32 status; |
1116 | u32 srb_status; | 1159 | __le32 srb_status; |
1117 | u32 scsi_status; | 1160 | __le32 scsi_status; |
1118 | u32 data_xfer_length; | 1161 | __le32 data_xfer_length; |
1119 | u32 sense_data_size; | 1162 | __le32 sense_data_size; |
1120 | u8 sense_data[AAC_SENSE_BUFFERSIZE]; // Can this be SCSI_SENSE_BUFFERSIZE | 1163 | u8 sense_data[AAC_SENSE_BUFFERSIZE]; // Can this be SCSI_SENSE_BUFFERSIZE |
1121 | }; | 1164 | }; |
1122 | /* | 1165 | /* |
@@ -1223,14 +1266,14 @@ struct aac_srb_reply | |||
1223 | */ | 1266 | */ |
1224 | 1267 | ||
1225 | struct aac_fsinfo { | 1268 | struct aac_fsinfo { |
1226 | u32 fsTotalSize; /* Consumed by fs, incl. metadata */ | 1269 | __le32 fsTotalSize; /* Consumed by fs, incl. metadata */ |
1227 | u32 fsBlockSize; | 1270 | __le32 fsBlockSize; |
1228 | u32 fsFragSize; | 1271 | __le32 fsFragSize; |
1229 | u32 fsMaxExtendSize; | 1272 | __le32 fsMaxExtendSize; |
1230 | u32 fsSpaceUnits; | 1273 | __le32 fsSpaceUnits; |
1231 | u32 fsMaxNumFiles; | 1274 | __le32 fsMaxNumFiles; |
1232 | u32 fsNumFreeFiles; | 1275 | __le32 fsNumFreeFiles; |
1233 | u32 fsInodeDensity; | 1276 | __le32 fsInodeDensity; |
1234 | }; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */ | 1277 | }; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */ |
1235 | 1278 | ||
1236 | union aac_contentinfo { | 1279 | union aac_contentinfo { |
@@ -1243,32 +1286,32 @@ union aac_contentinfo { | |||
1243 | 1286 | ||
1244 | #define CT_GET_CONFIG_STATUS 147 | 1287 | #define CT_GET_CONFIG_STATUS 147 |
1245 | struct aac_get_config_status { | 1288 | struct aac_get_config_status { |
1246 | u32 command; /* VM_ContainerConfig */ | 1289 | __le32 command; /* VM_ContainerConfig */ |
1247 | u32 type; /* CT_GET_CONFIG_STATUS */ | 1290 | __le32 type; /* CT_GET_CONFIG_STATUS */ |
1248 | u32 parm1; | 1291 | __le32 parm1; |
1249 | u32 parm2; | 1292 | __le32 parm2; |
1250 | u32 parm3; | 1293 | __le32 parm3; |
1251 | u32 parm4; | 1294 | __le32 parm4; |
1252 | u32 parm5; | 1295 | __le32 parm5; |
1253 | u32 count; /* sizeof(((struct aac_get_config_status_resp *)NULL)->data) */ | 1296 | __le32 count; /* sizeof(((struct aac_get_config_status_resp *)NULL)->data) */ |
1254 | }; | 1297 | }; |
1255 | 1298 | ||
1256 | #define CFACT_CONTINUE 0 | 1299 | #define CFACT_CONTINUE 0 |
1257 | #define CFACT_PAUSE 1 | 1300 | #define CFACT_PAUSE 1 |
1258 | #define CFACT_ABORT 2 | 1301 | #define CFACT_ABORT 2 |
1259 | struct aac_get_config_status_resp { | 1302 | struct aac_get_config_status_resp { |
1260 | u32 response; /* ST_OK */ | 1303 | __le32 response; /* ST_OK */ |
1261 | u32 dummy0; | 1304 | __le32 dummy0; |
1262 | u32 status; /* CT_OK */ | 1305 | __le32 status; /* CT_OK */ |
1263 | u32 parm1; | 1306 | __le32 parm1; |
1264 | u32 parm2; | 1307 | __le32 parm2; |
1265 | u32 parm3; | 1308 | __le32 parm3; |
1266 | u32 parm4; | 1309 | __le32 parm4; |
1267 | u32 parm5; | 1310 | __le32 parm5; |
1268 | struct { | 1311 | struct { |
1269 | u32 action; /* CFACT_CONTINUE, CFACT_PAUSE or CFACT_ABORT */ | 1312 | __le32 action; /* CFACT_CONTINUE, CFACT_PAUSE or CFACT_ABORT */ |
1270 | u16 flags; | 1313 | __le16 flags; |
1271 | s16 count; | 1314 | __le16 count; |
1272 | } data; | 1315 | } data; |
1273 | }; | 1316 | }; |
1274 | 1317 | ||
@@ -1279,8 +1322,8 @@ struct aac_get_config_status_resp { | |||
1279 | #define CT_COMMIT_CONFIG 152 | 1322 | #define CT_COMMIT_CONFIG 152 |
1280 | 1323 | ||
1281 | struct aac_commit_config { | 1324 | struct aac_commit_config { |
1282 | u32 command; /* VM_ContainerConfig */ | 1325 | __le32 command; /* VM_ContainerConfig */ |
1283 | u32 type; /* CT_COMMIT_CONFIG */ | 1326 | __le32 type; /* CT_COMMIT_CONFIG */ |
1284 | }; | 1327 | }; |
1285 | 1328 | ||
1286 | /* | 1329 | /* |
@@ -1289,16 +1332,16 @@ struct aac_commit_config { | |||
1289 | 1332 | ||
1290 | #define CT_GET_CONTAINER_COUNT 4 | 1333 | #define CT_GET_CONTAINER_COUNT 4 |
1291 | struct aac_get_container_count { | 1334 | struct aac_get_container_count { |
1292 | u32 command; /* VM_ContainerConfig */ | 1335 | __le32 command; /* VM_ContainerConfig */ |
1293 | u32 type; /* CT_GET_CONTAINER_COUNT */ | 1336 | __le32 type; /* CT_GET_CONTAINER_COUNT */ |
1294 | }; | 1337 | }; |
1295 | 1338 | ||
1296 | struct aac_get_container_count_resp { | 1339 | struct aac_get_container_count_resp { |
1297 | u32 response; /* ST_OK */ | 1340 | __le32 response; /* ST_OK */ |
1298 | u32 dummy0; | 1341 | __le32 dummy0; |
1299 | u32 MaxContainers; | 1342 | __le32 MaxContainers; |
1300 | u32 ContainerSwitchEntries; | 1343 | __le32 ContainerSwitchEntries; |
1301 | u32 MaxPartitions; | 1344 | __le32 MaxPartitions; |
1302 | }; | 1345 | }; |
1303 | 1346 | ||
1304 | 1347 | ||
@@ -1308,15 +1351,19 @@ struct aac_get_container_count_resp { | |||
1308 | */ | 1351 | */ |
1309 | 1352 | ||
1310 | struct aac_mntent { | 1353 | struct aac_mntent { |
1311 | u32 oid; | 1354 | __le32 oid; |
1312 | u8 name[16]; // if applicable | 1355 | u8 name[16]; /* if applicable */ |
1313 | struct creation_info create_info; // if applicable | 1356 | struct creation_info create_info; /* if applicable */ |
1314 | u32 capacity; | 1357 | __le32 capacity; |
1315 | u32 vol; // substrate structure | 1358 | __le32 vol; /* substrate structure */ |
1316 | u32 obj; // FT_FILESYS, FT_DATABASE, etc. | 1359 | __le32 obj; /* FT_FILESYS, |
1317 | u32 state; // unready for mounting, readonly, etc. | 1360 | FT_DATABASE, etc. */ |
1318 | union aac_contentinfo fileinfo; // Info specific to content manager (eg, filesystem) | 1361 | __le32 state; /* unready for mounting, |
1319 | u32 altoid; // != oid <==> snapshot or broken mirror exists | 1362 | readonly, etc. */ |
1363 | union aac_contentinfo fileinfo; /* Info specific to content | ||
1364 | manager (eg, filesystem) */ | ||
1365 | __le32 altoid; /* != oid <==> snapshot or | ||
1366 | broken mirror exists */ | ||
1320 | }; | 1367 | }; |
1321 | 1368 | ||
1322 | #define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */ | 1369 | #define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */ |
@@ -1324,40 +1371,40 @@ struct aac_mntent { | |||
1324 | #define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */ | 1371 | #define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */ |
1325 | 1372 | ||
1326 | struct aac_query_mount { | 1373 | struct aac_query_mount { |
1327 | u32 command; | 1374 | __le32 command; |
1328 | u32 type; | 1375 | __le32 type; |
1329 | u32 count; | 1376 | __le32 count; |
1330 | }; | 1377 | }; |
1331 | 1378 | ||
1332 | struct aac_mount { | 1379 | struct aac_mount { |
1333 | u32 status; | 1380 | __le32 status; |
1334 | u32 type; /* should be same as that requested */ | 1381 | __le32 type; /* should be same as that requested */ |
1335 | u32 count; | 1382 | __le32 count; |
1336 | struct aac_mntent mnt[1]; | 1383 | struct aac_mntent mnt[1]; |
1337 | }; | 1384 | }; |
1338 | 1385 | ||
1339 | #define CT_READ_NAME 130 | 1386 | #define CT_READ_NAME 130 |
1340 | struct aac_get_name { | 1387 | struct aac_get_name { |
1341 | u32 command; /* VM_ContainerConfig */ | 1388 | __le32 command; /* VM_ContainerConfig */ |
1342 | u32 type; /* CT_READ_NAME */ | 1389 | __le32 type; /* CT_READ_NAME */ |
1343 | u32 cid; | 1390 | __le32 cid; |
1344 | u32 parm1; | 1391 | __le32 parm1; |
1345 | u32 parm2; | 1392 | __le32 parm2; |
1346 | u32 parm3; | 1393 | __le32 parm3; |
1347 | u32 parm4; | 1394 | __le32 parm4; |
1348 | u32 count; /* sizeof(((struct aac_get_name_resp *)NULL)->data) */ | 1395 | __le32 count; /* sizeof(((struct aac_get_name_resp *)NULL)->data) */ |
1349 | }; | 1396 | }; |
1350 | 1397 | ||
1351 | #define CT_OK 218 | 1398 | #define CT_OK 218 |
1352 | struct aac_get_name_resp { | 1399 | struct aac_get_name_resp { |
1353 | u32 dummy0; | 1400 | __le32 dummy0; |
1354 | u32 dummy1; | 1401 | __le32 dummy1; |
1355 | u32 status; /* CT_OK */ | 1402 | __le32 status; /* CT_OK */ |
1356 | u32 parm1; | 1403 | __le32 parm1; |
1357 | u32 parm2; | 1404 | __le32 parm2; |
1358 | u32 parm3; | 1405 | __le32 parm3; |
1359 | u32 parm4; | 1406 | __le32 parm4; |
1360 | u32 parm5; | 1407 | __le32 parm5; |
1361 | u8 data[16]; | 1408 | u8 data[16]; |
1362 | }; | 1409 | }; |
1363 | 1410 | ||
@@ -1366,8 +1413,8 @@ struct aac_get_name_resp { | |||
1366 | */ | 1413 | */ |
1367 | 1414 | ||
1368 | struct aac_close { | 1415 | struct aac_close { |
1369 | u32 command; | 1416 | __le32 command; |
1370 | u32 cid; | 1417 | __le32 cid; |
1371 | }; | 1418 | }; |
1372 | 1419 | ||
1373 | struct aac_query_disk | 1420 | struct aac_query_disk |
@@ -1573,8 +1620,8 @@ extern struct aac_common aac_config; | |||
1573 | */ | 1620 | */ |
1574 | 1621 | ||
1575 | struct aac_aifcmd { | 1622 | struct aac_aifcmd { |
1576 | u32 command; /* Tell host what type of notify this is */ | 1623 | __le32 command; /* Tell host what type of notify this is */ |
1577 | u32 seqnum; /* To allow ordering of reports (if necessary) */ | 1624 | __le32 seqnum; /* To allow ordering of reports (if necessary) */ |
1578 | u8 data[1]; /* Undefined length (from kernel viewpoint) */ | 1625 | u8 data[1]; /* Undefined length (from kernel viewpoint) */ |
1579 | }; | 1626 | }; |
1580 | 1627 | ||
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index d9a93f8a728d..e6da87d17832 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -86,7 +86,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
86 | return -EFAULT; | 86 | return -EFAULT; |
87 | } | 87 | } |
88 | 88 | ||
89 | if (kfib->header.Command == cpu_to_le32(TakeABreakPt)) { | 89 | if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { |
90 | aac_adapter_interrupt(dev); | 90 | aac_adapter_interrupt(dev); |
91 | /* | 91 | /* |
92 | * Since we didn't really send a fib, zero out the state to allow | 92 | * Since we didn't really send a fib, zero out the state to allow |
@@ -94,7 +94,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
94 | */ | 94 | */ |
95 | kfib->header.XferState = 0; | 95 | kfib->header.XferState = 0; |
96 | } else { | 96 | } else { |
97 | int retval = fib_send(kfib->header.Command, fibptr, | 97 | int retval = fib_send(le16_to_cpu(kfib->header.Command), fibptr, |
98 | le16_to_cpu(kfib->header.Size) , FsaNormal, | 98 | le16_to_cpu(kfib->header.Size) , FsaNormal, |
99 | 1, 1, NULL, NULL); | 99 | 1, 1, NULL, NULL); |
100 | if (retval) { | 100 | if (retval) { |
@@ -114,7 +114,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
114 | * was already included by the adapter.) | 114 | * was already included by the adapter.) |
115 | */ | 115 | */ |
116 | 116 | ||
117 | if (copy_to_user(arg, (void *)kfib, kfib->header.Size)) { | 117 | if (copy_to_user(arg, (void *)kfib, le16_to_cpu(kfib->header.Size))) { |
118 | fib_free(fibptr); | 118 | fib_free(fibptr); |
119 | return -EFAULT; | 119 | return -EFAULT; |
120 | } | 120 | } |
@@ -391,8 +391,8 @@ static int check_revision(struct aac_dev *dev, void __user *arg) | |||
391 | struct revision response; | 391 | struct revision response; |
392 | 392 | ||
393 | response.compat = 1; | 393 | response.compat = 1; |
394 | response.version = dev->adapter_info.kernelrev; | 394 | response.version = le32_to_cpu(dev->adapter_info.kernelrev); |
395 | response.build = dev->adapter_info.kernelbuild; | 395 | response.build = le32_to_cpu(dev->adapter_info.kernelbuild); |
396 | 396 | ||
397 | if (copy_to_user(arg, &response, sizeof(response))) | 397 | if (copy_to_user(arg, &response, sizeof(response))) |
398 | return -EFAULT; | 398 | return -EFAULT; |
@@ -409,8 +409,9 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
409 | { | 409 | { |
410 | struct fib* srbfib; | 410 | struct fib* srbfib; |
411 | int status; | 411 | int status; |
412 | struct aac_srb *srbcmd; | 412 | struct aac_srb *srbcmd = NULL; |
413 | struct aac_srb __user *user_srb = arg; | 413 | struct user_aac_srb *user_srbcmd = NULL; |
414 | struct user_aac_srb __user *user_srb = arg; | ||
414 | struct aac_srb_reply __user *user_reply; | 415 | struct aac_srb_reply __user *user_reply; |
415 | struct aac_srb_reply* reply; | 416 | struct aac_srb_reply* reply; |
416 | u32 fibsize = 0; | 417 | u32 fibsize = 0; |
@@ -450,7 +451,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
450 | goto cleanup; | 451 | goto cleanup; |
451 | } | 452 | } |
452 | 453 | ||
453 | if(copy_from_user(srbcmd, user_srb,fibsize)){ | 454 | user_srbcmd = kmalloc(GFP_KERNEL, fibsize); |
455 | if(copy_from_user(user_srbcmd, user_srb,fibsize)){ | ||
454 | printk(KERN_DEBUG"aacraid: Could not copy srb from user\n"); | 456 | printk(KERN_DEBUG"aacraid: Could not copy srb from user\n"); |
455 | rcode = -EFAULT; | 457 | rcode = -EFAULT; |
456 | goto cleanup; | 458 | goto cleanup; |
@@ -458,18 +460,19 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
458 | 460 | ||
459 | user_reply = arg+fibsize; | 461 | user_reply = arg+fibsize; |
460 | 462 | ||
461 | flags = srbcmd->flags; | 463 | flags = user_srbcmd->flags; /* from user in cpu order */ |
462 | // Fix up srb for endian and force some values | 464 | // Fix up srb for endian and force some values |
465 | |||
463 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this | 466 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this |
464 | srbcmd->channel = cpu_to_le32(srbcmd->channel); | 467 | srbcmd->channel = cpu_to_le32(user_srbcmd->channel); |
465 | srbcmd->id = cpu_to_le32(srbcmd->id); | 468 | srbcmd->id = cpu_to_le32(user_srbcmd->id); |
466 | srbcmd->lun = cpu_to_le32(srbcmd->lun); | 469 | srbcmd->lun = cpu_to_le32(user_srbcmd->lun); |
467 | srbcmd->flags = cpu_to_le32(srbcmd->flags); | 470 | srbcmd->flags = cpu_to_le32(user_srbcmd->flags); |
468 | srbcmd->timeout = cpu_to_le32(srbcmd->timeout); | 471 | srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout); |
469 | srbcmd->retry_limit =cpu_to_le32(0); // Obsolete parameter | 472 | srbcmd->retry_limit = 0; |
470 | srbcmd->cdb_size = cpu_to_le32(srbcmd->cdb_size); | 473 | srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); |
471 | 474 | ||
472 | switch (srbcmd->flags & (SRB_DataIn | SRB_DataOut)) { | 475 | switch (flags & (SRB_DataIn | SRB_DataOut)) { |
473 | case SRB_DataOut: | 476 | case SRB_DataOut: |
474 | data_dir = DMA_TO_DEVICE; | 477 | data_dir = DMA_TO_DEVICE; |
475 | break; | 478 | break; |
@@ -483,60 +486,61 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
483 | data_dir = DMA_NONE; | 486 | data_dir = DMA_NONE; |
484 | } | 487 | } |
485 | if (dev->dac_support == 1) { | 488 | if (dev->dac_support == 1) { |
486 | struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg; | 489 | struct user_sgmap64* upsg = (struct user_sgmap64*)&user_srbcmd->sg; |
490 | struct sgmap64* psg = (struct sgmap64*)&user_srbcmd->sg; | ||
487 | byte_count = 0; | 491 | byte_count = 0; |
488 | 492 | ||
489 | /* | 493 | /* |
490 | * This should also catch if user used the 32 bit sgmap | 494 | * This should also catch if user used the 32 bit sgmap |
491 | */ | 495 | */ |
492 | actual_fibsize = sizeof(struct aac_srb) - | 496 | actual_fibsize = sizeof(struct aac_srb) - |
493 | sizeof(struct sgentry) + ((srbcmd->sg.count & 0xff) * | 497 | sizeof(struct sgentry) + |
494 | sizeof(struct sgentry64)); | 498 | ((user_srbcmd->sg.count & 0xff) * |
499 | sizeof(struct sgentry64)); | ||
495 | if(actual_fibsize != fibsize){ // User made a mistake - should not continue | 500 | if(actual_fibsize != fibsize){ // User made a mistake - should not continue |
496 | printk(KERN_DEBUG"aacraid: Bad Size specified in Raw SRB command\n"); | 501 | printk(KERN_DEBUG"aacraid: Bad Size specified in Raw SRB command\n"); |
497 | rcode = -EINVAL; | 502 | rcode = -EINVAL; |
498 | goto cleanup; | 503 | goto cleanup; |
499 | } | 504 | } |
500 | if ((data_dir == DMA_NONE) && psg->count) { | 505 | if ((data_dir == DMA_NONE) && upsg->count) { |
501 | printk(KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n"); | 506 | printk(KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n"); |
502 | rcode = -EINVAL; | 507 | rcode = -EINVAL; |
503 | goto cleanup; | 508 | goto cleanup; |
504 | } | 509 | } |
505 | 510 | ||
506 | for (i = 0; i < psg->count; i++) { | 511 | for (i = 0; i < upsg->count; i++) { |
507 | dma_addr_t addr; | 512 | u64 addr; |
508 | u64 le_addr; | ||
509 | void* p; | 513 | void* p; |
510 | p = kmalloc(psg->sg[i].count,GFP_KERNEL|__GFP_DMA); | 514 | p = kmalloc(upsg->sg[i].count, GFP_KERNEL|__GFP_DMA); |
511 | if(p == 0) { | 515 | if(p == 0) { |
512 | printk(KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", | 516 | printk(KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", |
513 | psg->sg[i].count,i,psg->count); | 517 | upsg->sg[i].count,i,upsg->count); |
514 | rcode = -ENOMEM; | 518 | rcode = -ENOMEM; |
515 | goto cleanup; | 519 | goto cleanup; |
516 | } | 520 | } |
517 | sg_user[i] = (void __user *)psg->sg[i].addr; | 521 | sg_user[i] = (void __user *)upsg->sg[i].addr; |
518 | sg_list[i] = p; // save so we can clean up later | 522 | sg_list[i] = p; // save so we can clean up later |
519 | sg_indx = i; | 523 | sg_indx = i; |
520 | 524 | ||
521 | if( flags & SRB_DataOut ){ | 525 | if( flags & SRB_DataOut ){ |
522 | if(copy_from_user(p,sg_user[i],psg->sg[i].count)){ | 526 | if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ |
523 | printk(KERN_DEBUG"aacraid: Could not copy sg data from user\n"); | 527 | printk(KERN_DEBUG"aacraid: Could not copy sg data from user\n"); |
524 | rcode = -EFAULT; | 528 | rcode = -EFAULT; |
525 | goto cleanup; | 529 | goto cleanup; |
526 | } | 530 | } |
527 | } | 531 | } |
528 | addr = pci_map_single(dev->pdev, p, psg->sg[i].count, data_dir); | 532 | addr = pci_map_single(dev->pdev, p, upsg->sg[i].count, data_dir); |
529 | 533 | ||
530 | le_addr = cpu_to_le64(addr); | 534 | psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); |
531 | psg->sg[i].addr[1] = (u32)(le_addr>>32); | 535 | psg->sg[i].addr[1] = cpu_to_le32(addr >> 32); |
532 | psg->sg[i].addr[0] = (u32)(le_addr & 0xffffffff); | 536 | psg->sg[i].count = cpu_to_le32(upsg->sg[i].count); |
533 | psg->sg[i].count = cpu_to_le32(psg->sg[i].count); | 537 | byte_count += upsg->sg[i].count; |
534 | byte_count += psg->sg[i].count; | ||
535 | } | 538 | } |
536 | 539 | ||
537 | srbcmd->count = cpu_to_le32(byte_count); | 540 | srbcmd->count = cpu_to_le32(byte_count); |
538 | status = fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL); | 541 | status = fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL); |
539 | } else { | 542 | } else { |
543 | struct user_sgmap* upsg = &user_srbcmd->sg; | ||
540 | struct sgmap* psg = &srbcmd->sg; | 544 | struct sgmap* psg = &srbcmd->sg; |
541 | byte_count = 0; | 545 | byte_count = 0; |
542 | 546 | ||
@@ -548,37 +552,39 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
548 | rcode = -EINVAL; | 552 | rcode = -EINVAL; |
549 | goto cleanup; | 553 | goto cleanup; |
550 | } | 554 | } |
551 | if ((data_dir == DMA_NONE) && psg->count) { | 555 | if ((data_dir == DMA_NONE) && upsg->count) { |
552 | printk(KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n"); | 556 | printk(KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n"); |
553 | rcode = -EINVAL; | 557 | rcode = -EINVAL; |
554 | goto cleanup; | 558 | goto cleanup; |
555 | } | 559 | } |
556 | for (i = 0; i < psg->count; i++) { | 560 | for (i = 0; i < upsg->count; i++) { |
557 | dma_addr_t addr; | 561 | dma_addr_t addr; |
558 | void* p; | 562 | void* p; |
559 | p = kmalloc(psg->sg[i].count,GFP_KERNEL); | 563 | p = kmalloc(upsg->sg[i].count, GFP_KERNEL); |
560 | if(p == 0) { | 564 | if(p == 0) { |
561 | printk(KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", | 565 | printk(KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", |
562 | psg->sg[i].count,i,psg->count); | 566 | upsg->sg[i].count, i, upsg->count); |
563 | rcode = -ENOMEM; | 567 | rcode = -ENOMEM; |
564 | goto cleanup; | 568 | goto cleanup; |
565 | } | 569 | } |
566 | sg_user[i] = (void __user *)(psg->sg[i].addr); | 570 | sg_user[i] = (void __user *)upsg->sg[i].addr; |
567 | sg_list[i] = p; // save so we can clean up later | 571 | sg_list[i] = p; // save so we can clean up later |
568 | sg_indx = i; | 572 | sg_indx = i; |
569 | 573 | ||
570 | if( flags & SRB_DataOut ){ | 574 | if( flags & SRB_DataOut ){ |
571 | if(copy_from_user(p,sg_user[i],psg->sg[i].count)){ | 575 | if(copy_from_user(p, sg_user[i], |
576 | upsg->sg[i].count)) { | ||
572 | printk(KERN_DEBUG"aacraid: Could not copy sg data from user\n"); | 577 | printk(KERN_DEBUG"aacraid: Could not copy sg data from user\n"); |
573 | rcode = -EFAULT; | 578 | rcode = -EFAULT; |
574 | goto cleanup; | 579 | goto cleanup; |
575 | } | 580 | } |
576 | } | 581 | } |
577 | addr = pci_map_single(dev->pdev, p, psg->sg[i].count, data_dir); | 582 | addr = pci_map_single(dev->pdev, p, |
583 | upsg->sg[i].count, data_dir); | ||
578 | 584 | ||
579 | psg->sg[i].addr = cpu_to_le32(addr); | 585 | psg->sg[i].addr = cpu_to_le32(addr); |
580 | psg->sg[i].count = cpu_to_le32(psg->sg[i].count); | 586 | psg->sg[i].count = cpu_to_le32(upsg->sg[i].count); |
581 | byte_count += psg->sg[i].count; | 587 | byte_count += upsg->sg[i].count; |
582 | } | 588 | } |
583 | srbcmd->count = cpu_to_le32(byte_count); | 589 | srbcmd->count = cpu_to_le32(byte_count); |
584 | status = fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL); | 590 | status = fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL); |
@@ -609,6 +615,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
609 | } | 615 | } |
610 | 616 | ||
611 | cleanup: | 617 | cleanup: |
618 | kfree(user_srbcmd); | ||
612 | for(i=0; i <= sg_indx; i++){ | 619 | for(i=0; i <= sg_indx; i++){ |
613 | kfree(sg_list[i]); | 620 | kfree(sg_list[i]); |
614 | } | 621 | } |
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index c3d3bce74378..34a4feb1dc0d 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -152,8 +152,8 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem, | |||
152 | init_waitqueue_head(&q->qfull); | 152 | init_waitqueue_head(&q->qfull); |
153 | spin_lock_init(&q->lockdata); | 153 | spin_lock_init(&q->lockdata); |
154 | q->lock = &q->lockdata; | 154 | q->lock = &q->lockdata; |
155 | q->headers.producer = mem; | 155 | q->headers.producer = (__le32 *)mem; |
156 | q->headers.consumer = mem+1; | 156 | q->headers.consumer = (__le32 *)(mem+1); |
157 | *(q->headers.producer) = cpu_to_le32(qsize); | 157 | *(q->headers.producer) = cpu_to_le32(qsize); |
158 | *(q->headers.consumer) = cpu_to_le32(qsize); | 158 | *(q->headers.consumer) = cpu_to_le32(qsize); |
159 | q->entries = qsize; | 159 | q->entries = qsize; |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 2d6bae661790..e2720b7be652 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -102,7 +102,7 @@ int fib_setup(struct aac_dev * dev) | |||
102 | fibptr->next = fibptr+1; /* Forward chain the fibs */ | 102 | fibptr->next = fibptr+1; /* Forward chain the fibs */ |
103 | init_MUTEX_LOCKED(&fibptr->event_wait); | 103 | init_MUTEX_LOCKED(&fibptr->event_wait); |
104 | spin_lock_init(&fibptr->event_lock); | 104 | spin_lock_init(&fibptr->event_lock); |
105 | hw_fib_va->header.XferState = 0xffffffff; | 105 | hw_fib_va->header.XferState = cpu_to_le32(0xffffffff); |
106 | hw_fib_va->header.SenderSize = cpu_to_le16(sizeof(struct hw_fib)); | 106 | hw_fib_va->header.SenderSize = cpu_to_le16(sizeof(struct hw_fib)); |
107 | fibptr->hw_fib_pa = hw_fib_pa; | 107 | fibptr->hw_fib_pa = hw_fib_pa; |
108 | hw_fib_va = (struct hw_fib *)((unsigned char *)hw_fib_va + sizeof(struct hw_fib)); | 108 | hw_fib_va = (struct hw_fib *)((unsigned char *)hw_fib_va + sizeof(struct hw_fib)); |
@@ -658,9 +658,8 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size) | |||
658 | } | 658 | } |
659 | if (aac_insert_entry(dev, index, AdapHighRespQueue, (nointr & (int)aac_config.irq_mod)) != 0) { | 659 | if (aac_insert_entry(dev, index, AdapHighRespQueue, (nointr & (int)aac_config.irq_mod)) != 0) { |
660 | } | 660 | } |
661 | } | 661 | } else if (hw_fib->header.XferState & |
662 | else if (hw_fib->header.XferState & NormalPriority) | 662 | cpu_to_le32(NormalPriority)) { |
663 | { | ||
664 | u32 index; | 663 | u32 index; |
665 | 664 | ||
666 | if (size) { | 665 | if (size) { |
@@ -832,8 +831,8 @@ int aac_command_thread(struct aac_dev * dev) | |||
832 | aifcmd = (struct aac_aifcmd *) hw_fib->data; | 831 | aifcmd = (struct aac_aifcmd *) hw_fib->data; |
833 | if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { | 832 | if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { |
834 | /* Handle Driver Notify Events */ | 833 | /* Handle Driver Notify Events */ |
835 | *(u32 *)hw_fib->data = cpu_to_le32(ST_OK); | 834 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
836 | fib_adapter_complete(fib, sizeof(u32)); | 835 | fib_adapter_complete(fib, (u16)sizeof(u32)); |
837 | } else { | 836 | } else { |
838 | struct list_head *entry; | 837 | struct list_head *entry; |
839 | /* The u32 here is important and intended. We are using | 838 | /* The u32 here is important and intended. We are using |
@@ -916,7 +915,7 @@ int aac_command_thread(struct aac_dev * dev) | |||
916 | /* | 915 | /* |
917 | * Set the status of this FIB | 916 | * Set the status of this FIB |
918 | */ | 917 | */ |
919 | *(u32 *)hw_fib->data = cpu_to_le32(ST_OK); | 918 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
920 | fib_adapter_complete(fib, sizeof(u32)); | 919 | fib_adapter_complete(fib, sizeof(u32)); |
921 | spin_unlock_irqrestore(&dev->fib_lock, flagv); | 920 | spin_unlock_irqrestore(&dev->fib_lock, flagv); |
922 | } | 921 | } |
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index 8480b427a6d9..be2e98de9fab 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c | |||
@@ -99,7 +99,7 @@ unsigned int aac_response_normal(struct aac_queue * q) | |||
99 | /* | 99 | /* |
100 | * Doctor the fib | 100 | * Doctor the fib |
101 | */ | 101 | */ |
102 | *(u32 *)hwfib->data = cpu_to_le32(ST_OK); | 102 | *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); |
103 | hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); | 103 | hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); |
104 | } | 104 | } |
105 | 105 | ||
@@ -107,7 +107,7 @@ unsigned int aac_response_normal(struct aac_queue * q) | |||
107 | 107 | ||
108 | if (hwfib->header.Command == cpu_to_le16(NuFileSystem)) | 108 | if (hwfib->header.Command == cpu_to_le16(NuFileSystem)) |
109 | { | 109 | { |
110 | u32 *pstatus = (u32 *)hwfib->data; | 110 | __le32 *pstatus = (__le32 *)hwfib->data; |
111 | if (*pstatus & cpu_to_le32(0xffff0000)) | 111 | if (*pstatus & cpu_to_le32(0xffff0000)) |
112 | *pstatus = cpu_to_le32(ST_OK); | 112 | *pstatus = cpu_to_le32(ST_OK); |
113 | } | 113 | } |
@@ -205,7 +205,7 @@ unsigned int aac_command_normal(struct aac_queue *q) | |||
205 | /* | 205 | /* |
206 | * Set the status of this FIB | 206 | * Set the status of this FIB |
207 | */ | 207 | */ |
208 | *(u32 *)hw_fib->data = cpu_to_le32(ST_OK); | 208 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
209 | fib_adapter_complete(fib, sizeof(u32)); | 209 | fib_adapter_complete(fib, sizeof(u32)); |
210 | spin_lock_irqsave(q->lock, flags); | 210 | spin_lock_irqsave(q->lock, flags); |
211 | } | 211 | } |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 9f1be6cb2c18..7e9e6b3186ae 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -288,7 +288,7 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, | |||
288 | * translations ( 64/32, 128/32, 255/63 ). | 288 | * translations ( 64/32, 128/32, 255/63 ). |
289 | */ | 289 | */ |
290 | buf = scsi_bios_ptable(bdev); | 290 | buf = scsi_bios_ptable(bdev); |
291 | if(*(unsigned short *)(buf + 0x40) == cpu_to_le16(0xaa55)) { | 291 | if(*(__le16 *)(buf + 0x40) == cpu_to_le16(0xaa55)) { |
292 | struct partition *first = (struct partition * )buf; | 292 | struct partition *first = (struct partition * )buf; |
293 | struct partition *entry = first; | 293 | struct partition *entry = first; |
294 | int saved_cylinders = param->cylinders; | 294 | int saved_cylinders = param->cylinders; |
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c index 1b8ed47cfe30..2d8ecd7f1479 100644 --- a/drivers/scsi/aacraid/rkt.c +++ b/drivers/scsi/aacraid/rkt.c | |||
@@ -288,8 +288,8 @@ static int aac_rkt_check_health(struct aac_dev *dev) | |||
288 | if (status & KERNEL_PANIC) { | 288 | if (status & KERNEL_PANIC) { |
289 | char * buffer; | 289 | char * buffer; |
290 | struct POSTSTATUS { | 290 | struct POSTSTATUS { |
291 | u32 Post_Command; | 291 | __le32 Post_Command; |
292 | u32 Post_Address; | 292 | __le32 Post_Address; |
293 | } * post; | 293 | } * post; |
294 | dma_addr_t paddr, baddr; | 294 | dma_addr_t paddr, baddr; |
295 | int ret; | 295 | int ret; |
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 630b99e1fe83..d447f45f70d1 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -63,7 +63,7 @@ static irqreturn_t aac_rx_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
63 | { | 63 | { |
64 | bellbits = rx_readl(dev, OutboundDoorbellReg); | 64 | bellbits = rx_readl(dev, OutboundDoorbellReg); |
65 | if (bellbits & DoorBellPrintfReady) { | 65 | if (bellbits & DoorBellPrintfReady) { |
66 | aac_printf(dev, le32_to_cpu(rx_readl (dev, IndexRegs.Mailbox[5]))); | 66 | aac_printf(dev, rx_readl(dev, IndexRegs.Mailbox[5])); |
67 | rx_writel(dev, MUnit.ODR,DoorBellPrintfReady); | 67 | rx_writel(dev, MUnit.ODR,DoorBellPrintfReady); |
68 | rx_writel(dev, InboundDoorbellReg,DoorBellPrintfDone); | 68 | rx_writel(dev, InboundDoorbellReg,DoorBellPrintfDone); |
69 | } | 69 | } |
@@ -288,8 +288,8 @@ static int aac_rx_check_health(struct aac_dev *dev) | |||
288 | if (status & KERNEL_PANIC) { | 288 | if (status & KERNEL_PANIC) { |
289 | char * buffer; | 289 | char * buffer; |
290 | struct POSTSTATUS { | 290 | struct POSTSTATUS { |
291 | u32 Post_Command; | 291 | __le32 Post_Command; |
292 | u32 Post_Address; | 292 | __le32 Post_Address; |
293 | } * post; | 293 | } * post; |
294 | dma_addr_t paddr, baddr; | 294 | dma_addr_t paddr, baddr; |
295 | int ret; | 295 | int ret; |
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index 01cf1d9acae7..100c5a0866b4 100644 --- a/drivers/scsi/aacraid/sa.c +++ b/drivers/scsi/aacraid/sa.c | |||
@@ -230,7 +230,7 @@ static void aac_sa_start_adapter(struct aac_dev *dev) | |||
230 | * First clear out all interrupts. Then enable the one's that | 230 | * First clear out all interrupts. Then enable the one's that |
231 | * we can handle. | 231 | * we can handle. |
232 | */ | 232 | */ |
233 | sa_writew(dev, SaDbCSR.PRISETIRQMASK, cpu_to_le16(0xffff)); | 233 | sa_writew(dev, SaDbCSR.PRISETIRQMASK, 0xffff); |
234 | sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, (PrintfReady | DOORBELL_1 | DOORBELL_2 | DOORBELL_3 | DOORBELL_4)); | 234 | sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, (PrintfReady | DOORBELL_1 | DOORBELL_2 | DOORBELL_3 | DOORBELL_4)); |
235 | /* We can only use a 32 bit address here */ | 235 | /* We can only use a 32 bit address here */ |
236 | sa_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, (u32)(ulong)dev->init_pa, &ret); | 236 | sa_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, (u32)(ulong)dev->init_pa, &ret); |