]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.drivers/mpt-fusion-4.16.00.00-update
Disable build of xen kernel.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / mpt-fusion-4.16.00.00-update
1 Subject: MPT fusion driver update to 4.16.00.00
2 From: Satya Prakash <sathya.prakash@lsi.com>
3 Date: Thu Nov 20 14:13:01 2008 +0100:
4 References: bnc#425660
5
6 Update the mpt fusion driver to internal version 4.16.00.00.
7
8 Signed-off-by: Satya Prakash <sathya.prakash@lsi.com>
9 Acked-by: Hannes Reinecke <hare@suse.de>
10
11 Index: linux-2.6.27/drivers/message/fusion/csmi/csmisas.c
12 ===================================================================
13 --- linux-2.6.27.orig/drivers/message/fusion/csmi/csmisas.c
14 +++ linux-2.6.27/drivers/message/fusion/csmi/csmisas.c
15 @@ -43,16 +43,13 @@
16 */
17 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
18
19 -#define MPT_CSMI_DESCRIPTION "LSI Corporation: Fusion MPT Driver "MPT_LINUX_VERSION_COMMON
20 +#define MPT_CSMI_DESCRIPTION \
21 + "LSI Corporation: Fusion MPT Driver "MPT_LINUX_VERSION_COMMON
22 #define csmisas_is_this_sas_cntr(ioc) (ioc->bus_type == SAS) ? 1 : 0
23
24 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
25 -#define __user
26 -#include <asm/div64.h>
27 -#endif
28
29 -static int csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum, u8 VolumeBus,
30 - u8 VolumeId, pMpiRaidActionReply_t reply);
31 +static int csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum,
32 + u8 VolumeBus, u8 VolumeId, pMpiRaidActionReply_t reply);
33 static u8 map_sas_status_to_csmi(u8 mpi_sas_status);
34
35 /**
36 @@ -66,7 +63,7 @@ reverse_byte_order64(u64 data64)
37 {
38 int i;
39 u64 rc;
40 - u8 *inWord = (u8*)&data64, *outWord = (u8*)&rc;
41 + u8 *inWord = (u8 *)&data64, *outWord = (u8 *)&rc;
42
43 for (i = 0 ; i < 8 ; i++)
44 outWord[i] = inWord[7-i];
45 @@ -98,7 +95,7 @@ csmisas_is_sata(RaidPhysDiskPage0_t *phy
46 *
47 **/
48 static inline int
49 -csmisas_is_end_device(struct mptsas_devinfo * attached)
50 +csmisas_is_end_device(struct mptsas_devinfo *attached)
51 {
52 if ((attached->sas_address) &&
53 (attached->device_info &
54 @@ -130,7 +127,8 @@ csmisas_is_phys_disk(MPT_ADAPTER *ioc, i
55 goto out;
56 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) {
57 if ((id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) &&
58 - (channel == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
59 + (channel ==
60 + ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
61 rc = 1;
62 goto out;
63 }
64 @@ -142,14 +140,14 @@ csmisas_is_phys_disk(MPT_ADAPTER *ioc, i
65 if (list_empty(&ioc->raid_data.inactive_list))
66 goto out;
67
68 - down(&ioc->raid_data.inactive_list_mutex);
69 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
70 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
71 list) {
72 if ((component_info->d.PhysDiskID == id) &&
73 (component_info->d.PhysDiskBus == channel))
74 rc = 1;
75 }
76 - up(&ioc->raid_data.inactive_list_mutex);
77 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
78
79 out:
80 return rc;
81 @@ -161,7 +159,8 @@ csmisas_is_phys_disk(MPT_ADAPTER *ioc, i
82 * Obtains the phys disk num for given H:C:T nexus
83 *
84 * input (channel/id)
85 - * output (phys disk number - used by SCSI_IO_PASSTHRU to access hidden component)
86 + * output (phys disk number - used by SCSI_IO_PASSTHRU to access hidden
87 + * component)
88 *
89 * returns - signed return means failure
90 **/
91 @@ -176,7 +175,8 @@ csmisas_raid_id_to_num(MPT_ADAPTER *ioc,
92 goto out;
93 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) {
94 if ((id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) &&
95 - (channel == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
96 + (channel ==
97 + ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
98 rc = ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum;
99 goto out;
100 }
101 @@ -188,14 +188,14 @@ csmisas_raid_id_to_num(MPT_ADAPTER *ioc,
102 if (list_empty(&ioc->raid_data.inactive_list))
103 goto out;
104
105 - down(&ioc->raid_data.inactive_list_mutex);
106 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
107 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
108 list) {
109 if ((component_info->d.PhysDiskID == id) &&
110 (component_info->d.PhysDiskBus == channel))
111 rc = component_info->d.PhysDiskNum;
112 }
113 - up(&ioc->raid_data.inactive_list_mutex);
114 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
115
116 out:
117 return rc;
118 @@ -218,7 +218,7 @@ csmisas_get_device_component_by_os(MPT_A
119
120 sas_info = NULL;
121
122 - down(&ioc->sas_device_info_mutex);
123 + mutex_lock(&ioc->sas_device_info_mutex);
124 list_for_each_entry(p, &ioc->sas_device_info_list, list) {
125 if (p->os.channel == channel && p->os.id == id) {
126 sas_info = p;
127 @@ -227,7 +227,7 @@ csmisas_get_device_component_by_os(MPT_A
128 }
129
130 out:
131 - up(&ioc->sas_device_info_mutex);
132 + mutex_unlock(&ioc->sas_device_info_mutex);
133 return sas_info;
134 }
135
136 @@ -248,7 +248,7 @@ csmisas_get_device_component_by_fw(MPT_A
137
138 sas_info = NULL;
139
140 - down(&ioc->sas_device_info_mutex);
141 + mutex_lock(&ioc->sas_device_info_mutex);
142 list_for_each_entry(p, &ioc->sas_device_info_list, list) {
143 if (p->fw.channel == channel && p->fw.id == id) {
144 sas_info = p;
145 @@ -257,7 +257,7 @@ csmisas_get_device_component_by_fw(MPT_A
146 }
147
148 out:
149 - up(&ioc->sas_device_info_mutex);
150 + mutex_unlock(&ioc->sas_device_info_mutex);
151 return sas_info;
152 }
153
154 @@ -279,7 +279,7 @@ csmisas_get_device_component_by_sas_addr
155
156 sas_info = NULL;
157
158 - down(&ioc->sas_device_info_mutex);
159 + mutex_lock(&ioc->sas_device_info_mutex);
160 list_for_each_entry(p, &ioc->sas_device_info_list, list) {
161 if (p->sas_address == sas_address) {
162 sas_info = p;
163 @@ -288,7 +288,7 @@ csmisas_get_device_component_by_sas_addr
164 }
165
166 out:
167 - up(&ioc->sas_device_info_mutex);
168 + mutex_unlock(&ioc->sas_device_info_mutex);
169 return sas_info;
170 }
171
172 @@ -305,7 +305,8 @@ csmisas_get_device_component_by_sas_addr
173 * non-zero, failure
174 **/
175 static int
176 -csmisas_send_command_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, unsigned long timeout)
177 +csmisas_send_command_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf,
178 + unsigned long timeout)
179 {
180 int rc;
181 unsigned long timeleft;
182 @@ -314,40 +315,15 @@ csmisas_send_command_wait(MPT_ADAPTER *i
183 rc = 0;
184 timeleft = 0;
185
186 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
187 -
188 - INITIALIZE_IOCTL_STATUS(ioc->ioctl_cmds.status)
189 - ioc->ioctl_cmds.wait_done = 0;
190 - ioc->ioctl_cmds.timer.expires = jiffies + (MPT_JIFFY * timeout);
191 - ioc->ioctl_cmds.status |= MPT_MGMT_STATUS_TIMER_ACTIVE;
192 - ADD_TIMER(&ioc->ioctl_cmds.timer);
193 - mpt_put_msg_frame(mptctl_id, ioc, mf);
194 - WAIT_EVENT(mptctl_wait, ioc->ioctl_cmds.wait_done);
195 -
196 -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
197 -
198 - INITIALIZE_IOCTL_STATUS(ioc->ioctl_cmds.status)
199 - ioc->ioctl_cmds.wait_done = 0;
200 - mpt_put_msg_frame(mptctl_id, ioc, mf);
201 -
202 - if ((wait_event_timeout(mptctl_wait,
203 - ioc->ioctl_cmds.wait_done == 1, HZ * timeout) <=0) &&
204 - ioc->ioctl_cmds.wait_done != 1 ) {
205 - mptctl_timeout_expired(ioc,mf);
206 - mpt_free_msg_frame(ioc, mf);
207 - rc = -1;
208 - }
209 -
210 -#else
211 -
212 SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context,
213 mf->u.hdr.MsgContext);
214 INITIALIZE_MGMT_STATUS(ioc->ioctl_cmds.status)
215 mpt_put_msg_frame(mptctl_id, ioc, mf);
216 - timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, timeout*HZ);
217 + timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done,
218 + timeout*HZ);
219 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
220 rc = -1;
221 - printk("%s: failed\n", __FUNCTION__);
222 + printk(KERN_WARNING "%s: failed\n", __func__);
223 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
224 mpt_free_msg_frame(ioc, mf);
225 CLEAR_MGMT_STATUS(ioc->ioctl_cmds.status)
226 @@ -357,7 +333,6 @@ csmisas_send_command_wait(MPT_ADAPTER *i
227 mptctl_timeout_expired(ioc, mf);
228 }
229 SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, 0);
230 -#endif
231 return rc;
232 }
233
234 @@ -375,7 +350,8 @@ csmisas_send_command_wait(MPT_ADAPTER *i
235 * non-zero, failure
236 **/
237 static int
238 -csmisas_send_handshake_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, unsigned long timeout)
239 +csmisas_send_handshake_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf,
240 + unsigned long timeout)
241 {
242 int rc;
243 unsigned long timeleft;
244 @@ -384,42 +360,13 @@ csmisas_send_handshake_wait(MPT_ADAPTER
245 rc = 0;
246 timeleft = 0;
247
248 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
249 -
250 - INITIALIZE_IOCTL_STATUS(ioc->taskmgmt_cmds.status)
251 - ioc->taskmgmt_cmds.timer.expires = jiffies + (MPT_JIFFY*timeout);
252 - ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_TIMER_ACTIVE;
253 - ioc->taskmgmt_cmds.wait_done = 0;
254 - ADD_TIMER(&ioc->taskmgmt_cmds.timer);
255 - rc = mpt_send_special_message(mptctl_taskmgmt_id, ioc,
256 - sizeof(SCSITaskMgmt_t), (u32*)mf, timeout, CAN_SLEEP);
257 - if (rc != 0)
258 - return rc;
259 - WAIT_EVENT(mptctl_taskmgmt_wait, ioc->taskmgmt_cmds.wait_done);
260 -
261 -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
262 -
263 - INITIALIZE_IOCTL_STATUS(ioc->taskmgmt_cmds.status)
264 - ioc->taskmgmt_cmds.wait_done = 0;
265 - rc = mpt_send_special_message(mptctl_taskmgmt_id, ioc,
266 - sizeof(SCSITaskMgmt_t), (u32*)mf, timeout, CAN_SLEEP);
267 - if (rc != 0)
268 - return rc;
269 - if ((wait_event_timeout(mptctl_taskmgmt_wait,
270 - ioc->taskmgmt_cmds.wait_done == 1, HZ * timeout) <=0) &&
271 - ioc->taskmgmt_cmds.wait_done != 1 ) {
272 - mptctl_timeout_expired(ioc, mf);
273 - mpt_free_msg_frame(ioc, mf);
274 - rc = -1;
275 - }
276 -
277 -#else
278 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
279 mpt_put_msg_frame_hi_pri(mptctl_taskmgmt_id, ioc, mf);
280 - timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, timeout*HZ);
281 + timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done,
282 + timeout*HZ);
283 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
284 rc = -1;
285 - printk("%s: failed\n", __FUNCTION__);
286 + printk(KERN_WARNING "%s: failed\n", __func__);
287 mpt_clear_taskmgmt_in_progress_flag(ioc);
288 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
289 mpt_free_msg_frame(ioc, mf);
290 @@ -429,7 +376,6 @@ csmisas_send_handshake_wait(MPT_ADAPTER
291 if (!timeleft)
292 mptctl_timeout_expired(ioc, mf);
293 }
294 -#endif
295 return rc;
296 }
297
298 @@ -527,7 +473,8 @@ csmisas_get_ioc_pg5(MPT_ADAPTER *ioc, IO
299 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
300 cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;
301
302 - if ((rc = mpt_config(ioc, &cfg)) != 0)
303 + rc = mpt_config(ioc, &cfg);
304 + if (rc != 0)
305 goto get_ioc_pg5;
306
307 if (hdr.PageLength == 0) {
308 @@ -547,7 +494,8 @@ csmisas_get_ioc_pg5(MPT_ADAPTER *ioc, IO
309 cfg.physAddr = dma_handle;
310 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
311
312 - if ((rc = mpt_config(ioc, &cfg)) != 0)
313 + rc = mpt_config(ioc, &cfg);
314 + if (rc != 0)
315 goto get_ioc_pg5;
316
317 memcpy(iocPage5, buffer, data_size);
318 @@ -565,7 +513,8 @@ csmisas_get_ioc_pg5(MPT_ADAPTER *ioc, IO
319 * csmisas_sas_device_pg0 - sas device page 0
320 * @ioc: Pointer to MPT_ADAPTER structure
321 * @mptsas_devinfo: structure found in mptsas.h
322 - * @form, @form_specific - defines the Page Address field in the config page
323 + * @form, @form_specific - defines the Page Address field in
324 + * the config page
325 * (pls refer to chapter 5.1 in the mpi spec)
326 *
327 * Return: 0 for success
328 @@ -602,7 +551,8 @@ csmisas_sas_device_pg0(MPT_ADAPTER *ioc,
329 cfg.timeout = 10;
330
331 memset(device_info, 0, sizeof(struct mptsas_devinfo));
332 - if ((rc = mpt_config(ioc, &cfg)) != 0)
333 + rc = mpt_config(ioc, &cfg);
334 + if (rc != 0)
335 goto out;
336
337 if (!hdr.ExtPageLength) {
338 @@ -620,7 +570,8 @@ csmisas_sas_device_pg0(MPT_ADAPTER *ioc,
339 cfg.physAddr = dma_handle;
340 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
341
342 - if ((rc = mpt_config(ioc, &cfg)) != 0)
343 + rc = mpt_config(ioc, &cfg);
344 + if (rc != 0)
345 goto out_free_consistent;
346
347 device_info->handle = le16_to_cpu(buffer->DevHandle);
348 @@ -664,31 +615,31 @@ csmisas_get_driver_info(unsigned long ar
349 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_DRIVER_INFO_BUFFER))) {
350 printk(KERN_ERR "%s@%d::%s - "
351 "Unable to read in csmi_sas_get_driver_info_buffer struct @ %p\n",
352 - __FILE__, __LINE__, __FUNCTION__, uarg);
353 + __FILE__, __LINE__, __func__, uarg);
354 return -EFAULT;
355 }
356
357 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
358 &ioc)) < 0) || (ioc == NULL)) {
359 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
360 - __FILE__, __FUNCTION__, __LINE__, iocnum);
361 + __FILE__, __func__, __LINE__, iocnum);
362 return -ENODEV;
363 }
364
365 if (!csmisas_is_this_sas_cntr(ioc)) {
366 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
367 - __FILE__, __FUNCTION__, __LINE__, iocnum);
368 + __FILE__, __func__, __LINE__, iocnum);
369 return -ENODEV;
370 }
371
372 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
373 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
374
375 /* Fill in the data and return the structure to the calling
376 * program
377 */
378 - memcpy( karg.Information.szName, MPT_MISCDEV_BASENAME,
379 + memcpy(karg.Information.szName, MPT_MISCDEV_BASENAME,
380 sizeof(MPT_MISCDEV_BASENAME));
381 - memcpy( karg.Information.szDescription, MPT_CSMI_DESCRIPTION,
382 + memcpy(karg.Information.szDescription, MPT_CSMI_DESCRIPTION,
383 sizeof(MPT_CSMI_DESCRIPTION));
384
385 karg.Information.usMajorRevision = MPT_LINUX_MAJOR_VERSION;
386 @@ -707,11 +658,11 @@ csmisas_get_driver_info(unsigned long ar
387 sizeof(CSMI_SAS_DRIVER_INFO_BUFFER))) {
388 printk(KERN_ERR "%s@%d::%s - "
389 "Unable to write out csmi_sas_get_driver_info_buffer @ %p\n",
390 - __FILE__, __LINE__, __FUNCTION__, uarg);
391 + __FILE__, __LINE__, __func__, uarg);
392 return -EFAULT;
393 }
394
395 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
396 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
397 return 0;
398 }
399
400 @@ -736,28 +687,28 @@ csmisas_get_cntlr_config(unsigned long a
401 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_CNTLR_CONFIG_BUFFER))) {
402 printk(KERN_ERR "%s@%d::%s - "
403 "Unable to read in csmi_sas_get_cntlr_config_buffer struct @ %p\n",
404 - __FILE__, __LINE__, __FUNCTION__, uarg);
405 + __FILE__, __LINE__, __func__, uarg);
406 return -EFAULT;
407 }
408
409 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
410 &ioc)) < 0) || (ioc == NULL)) {
411 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
412 - __FILE__, __FUNCTION__, __LINE__, iocnum);
413 + __FILE__, __func__, __LINE__, iocnum);
414 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
415 return -ENODEV;
416 }
417
418 if (!csmisas_is_this_sas_cntr(ioc)) {
419 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
420 - __FILE__, __FUNCTION__, __LINE__, iocnum);
421 + __FILE__, __func__, __LINE__, iocnum);
422 return -ENODEV;
423 }
424
425 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
426 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
427
428 /* Clear the struct before filling in data. */
429 - memset( &karg.Configuration, 0, sizeof(CSMI_SAS_CNTLR_CONFIG));
430 + memset(&karg.Configuration, 0, sizeof(CSMI_SAS_CNTLR_CONFIG));
431
432 /* Fill in the data and return the structure to the calling
433 * program
434 @@ -786,7 +737,7 @@ csmisas_get_cntlr_config(unsigned long a
435 karg.Configuration.BusAddress.PciAddress.bFunctionNumber =
436 PCI_FUNC(ioc->pcidev->devfn);
437 karg.Configuration.BusAddress.PciAddress.bReserved = 0;
438 - memcpy( &karg.Configuration.szSerialNumber, ioc->board_tracer, 16 );
439 + memcpy(&karg.Configuration.szSerialNumber, ioc->board_tracer, 16);
440 karg.Configuration.usMajorRevision = ioc->facts.FWVersion.Struct.Major;
441 karg.Configuration.usMinorRevision = ioc->facts.FWVersion.Struct.Minor;
442 karg.Configuration.usBuildRevision = ioc->facts.FWVersion.Struct.Unit;
443 @@ -819,11 +770,11 @@ csmisas_get_cntlr_config(unsigned long a
444 sizeof(CSMI_SAS_DRIVER_INFO_BUFFER))) {
445 printk(KERN_ERR "%s@%d::%s - "
446 "Unable to write out csmi_sas_get_driver_info_buffer @ %p\n",
447 - __FILE__, __LINE__, __FUNCTION__, uarg);
448 + __FILE__, __LINE__, __func__, uarg);
449 return -EFAULT;
450 }
451
452 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
453 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
454 return 0;
455 }
456
457 @@ -848,24 +799,24 @@ csmisas_get_cntlr_status(unsigned long a
458 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_CNTLR_STATUS_BUFFER))) {
459 printk(KERN_ERR "%s@%d::%s - "
460 "Unable to read in csmi_sas_get_cntlr_status_buffer struct @ %p\n",
461 - __FILE__, __LINE__, __FUNCTION__, uarg);
462 + __FILE__, __LINE__, __func__, uarg);
463 return -EFAULT;
464 }
465
466 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
467 &ioc)) < 0) || (ioc == NULL)) {
468 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
469 - __FILE__, __FUNCTION__, __LINE__, iocnum);
470 + __FILE__, __func__, __LINE__, iocnum);
471 return -ENODEV;
472 }
473
474 if (!csmisas_is_this_sas_cntr(ioc)) {
475 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
476 - __FILE__, __FUNCTION__, __LINE__, iocnum);
477 + __FILE__, __func__, __LINE__, iocnum);
478 return -ENODEV;
479 }
480
481 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
482 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
483
484 /* Fill in the data and return the structure to the calling
485 * program
486 @@ -902,11 +853,11 @@ csmisas_get_cntlr_status(unsigned long a
487 sizeof(CSMI_SAS_CNTLR_STATUS_BUFFER))) {
488 printk(KERN_ERR "%s@%d::%s - "
489 "Unable to write out csmi_sas_get_cntlr_status @ %p\n",
490 - __FILE__, __LINE__, __FUNCTION__, uarg);
491 + __FILE__, __LINE__, __func__, uarg);
492 return -EFAULT;
493 }
494
495 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
496 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
497 return 0;
498 }
499
500 @@ -940,19 +891,19 @@ csmisas_get_phy_info(unsigned long arg)
501 struct mptsas_devinfo device_info;
502 int memory_pages;
503
504 - sasIoUnitPg0=NULL;
505 - sasPhyPg0=NULL;
506 - sasIoUnitPg0_data_sz=0;
507 - sasPhyPg0_data_sz=0;
508 + sasIoUnitPg0 = NULL;
509 + sasPhyPg0 = NULL;
510 + sasIoUnitPg0_data_sz = 0;
511 + sasPhyPg0_data_sz = 0;
512
513 memory_pages = get_order(sizeof(CSMI_SAS_PHY_INFO_BUFFER));
514 karg = (CSMI_SAS_PHY_INFO_BUFFER *)__get_free_pages(
515 GFP_KERNEL, memory_pages);
516 - if (!karg){
517 + if (!karg) {
518 printk(KERN_ERR "%s@%d::%s() - "
519 "Unable to malloc CSMI_SAS_PHY_INFO_BUFFER "
520 "malloc_data_sz=%d memory_pages=%d\n",
521 - __FILE__, __LINE__, __FUNCTION__,
522 + __FILE__, __LINE__, __func__,
523 (int)sizeof(CSMI_SAS_PHY_INFO_BUFFER), memory_pages);
524 return -ENOMEM;
525 }
526 @@ -962,7 +913,7 @@ csmisas_get_phy_info(unsigned long arg)
527 if (copy_from_user(karg, uarg, sizeof(CSMI_SAS_PHY_INFO_BUFFER))) {
528 printk(KERN_ERR "%s@%d::%s - "
529 "Unable to read in csmisas_get_phy_info_buffer struct @ %p\n",
530 - __FILE__, __LINE__, __FUNCTION__, uarg);
531 + __FILE__, __LINE__, __func__, uarg);
532 free_pages((unsigned long)karg, memory_pages);
533 return -EFAULT;
534 }
535 @@ -970,19 +921,19 @@ csmisas_get_phy_info(unsigned long arg)
536 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
537 &ioc)) < 0) || (ioc == NULL)) {
538 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
539 - __FILE__, __FUNCTION__, __LINE__, iocnum);
540 + __FILE__, __func__, __LINE__, iocnum);
541 free_pages((unsigned long)karg, memory_pages);
542 return -ENODEV;
543 }
544
545 if (!csmisas_is_this_sas_cntr(ioc)) {
546 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
547 - __FILE__, __FUNCTION__, __LINE__, iocnum);
548 + __FILE__, __func__, __LINE__, iocnum);
549 free_pages((unsigned long)karg, memory_pages);
550 return -ENODEV;
551 }
552
553 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
554 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
555
556 /* Fill in the data and return the structure to the calling
557 * program
558 @@ -1011,7 +962,7 @@ csmisas_get_phy_info(unsigned long arg)
559 */
560 dcsmisasprintk(ioc, printk(KERN_ERR
561 ": FAILED: MPI_SASIOUNITPAGE0_PAGEVERSION: HEADER\n"));
562 - dcsmisasprintk(ioc, printk(": rc=%x\n",rc));
563 + dcsmisasprintk(ioc, printk(": rc=%x\n", rc));
564 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
565 goto sas_get_phy_info_exit;
566 }
567 @@ -1020,7 +971,8 @@ csmisas_get_phy_info(unsigned long arg)
568 /* Don't check if this failed. Already in a
569 * failure case.
570 */
571 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
572 + dcsmisasprintk(ioc, printk(KERN_ERR
573 + ": hdr.ExtPageLength == 0\n"));
574 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
575 goto sas_get_phy_info_exit;
576 }
577 @@ -1032,7 +984,8 @@ csmisas_get_phy_info(unsigned long arg)
578 sasIoUnitPg0_data_sz, &sasIoUnitPg0_dma);
579
580 if (!sasIoUnitPg0) {
581 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
582 + dcsmisasprintk(ioc, printk(KERN_ERR
583 + ": pci_alloc_consistent: FAILED\n"));
584 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
585 goto sas_get_phy_info_exit;
586 }
587 @@ -1048,7 +1001,7 @@ csmisas_get_phy_info(unsigned long arg)
588 */
589 dcsmisasprintk(ioc, printk(KERN_ERR
590 ": FAILED: MPI_SASIOUNITPAGE0_PAGEVERSION: PAGE\n"));
591 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
592 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
593 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
594 goto sas_get_phy_info_exit;
595 }
596 @@ -1058,27 +1011,30 @@ csmisas_get_phy_info(unsigned long arg)
597
598 /* Fill in information for each phy. */
599 for (ii = 0; ii < karg->Information.bNumberOfPhys; ii++) {
600 -
601 -/* EDM : dump IO Unit Page 0 data*/
602 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- IO UNIT PAGE 0 ------------\n"));
603 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n",
604 + dcsmisasprintk(ioc, printk(KERN_DEBUG
605 + "---- IO UNIT PAGE 0 ------------\n"));
606 + dcsmisasprintk(ioc, printk(KERN_DEBUG
607 + "Handle=0x%X\n",
608 le16_to_cpu(sasIoUnitPg0->PhyData[ii].AttachedDeviceHandle)));
609 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Controller Handle=0x%X\n",
610 + dcsmisasprintk(ioc, printk(KERN_DEBUG
611 + "Controller Handle=0x%X\n",
612 le16_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerDevHandle)));
613 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Port=0x%X\n",
614 + dcsmisasprintk(ioc, printk(KERN_DEBUG
615 + "Port=0x%X\n",
616 sasIoUnitPg0->PhyData[ii].Port));
617 dcsmisasprintk(ioc, printk(KERN_DEBUG "Port Flags=0x%X\n",
618 sasIoUnitPg0->PhyData[ii].PortFlags));
619 dcsmisasprintk(ioc, printk(KERN_DEBUG "PHY Flags=0x%X\n",
620 sasIoUnitPg0->PhyData[ii].PhyFlags));
621 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Negotiated Link Rate=0x%X\n",
622 + dcsmisasprintk(ioc, printk(KERN_DEBUG
623 + "Negotiated Link Rate=0x%X\n",
624 sasIoUnitPg0->PhyData[ii].NegotiatedLinkRate));
625 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Controller PHY Device Info=0x%X\n",
626 + dcsmisasprintk(ioc, printk(KERN_DEBUG
627 + "Controller PHY Device Info=0x%X\n",
628 le32_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo)));
629 dcsmisasprintk(ioc, printk(KERN_DEBUG "DiscoveryStatus=0x%X\n",
630 le32_to_cpu(sasIoUnitPg0->PhyData[ii].DiscoveryStatus)));
631 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
632 -/* EDM : debug data */
633
634 /* PHY stuff. */
635 karg->Information.Phy[ii].bPortIdentifier =
636 @@ -1147,13 +1103,14 @@ csmisas_get_phy_info(unsigned long arg)
637 if ((rc = mpt_config(ioc, &cfg)) != 0) {
638 dcsmisasprintk(ioc, printk(KERN_ERR
639 ": FAILED: MPI_SASPHY0_PAGEVERSION: HEADER\n"));
640 - dcsmisasprintk(ioc, printk(": rc=%x\n",rc));
641 + dcsmisasprintk(ioc, printk(": rc=%x\n", rc));
642 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
643 goto sas_get_phy_info_exit;
644 }
645
646 if (hdr.ExtPageLength == 0) {
647 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
648 + dcsmisasprintk(ioc, printk(KERN_ERR
649 + ": pci_alloc_consistent: FAILED\n"));
650 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
651 goto sas_get_phy_info_exit;
652 }
653 @@ -1164,8 +1121,9 @@ csmisas_get_phy_info(unsigned long arg)
654 sasPhyPg0 = (SasPhyPage0_t *) pci_alloc_consistent(
655 ioc->pcidev, sasPhyPg0_data_sz, &sasPhyPg0_dma);
656
657 - if (! sasPhyPg0) {
658 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
659 + if (!sasPhyPg0) {
660 + dcsmisasprintk(ioc, printk(KERN_ERR
661 + ": pci_alloc_consistent: FAILED\n"));
662 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
663 goto sas_get_phy_info_exit;
664 }
665 @@ -1177,34 +1135,37 @@ csmisas_get_phy_info(unsigned long arg)
666 if ((rc = mpt_config(ioc, &cfg)) != 0) {
667 dcsmisasprintk(ioc, printk(KERN_ERR
668 ": FAILED: MPI_SASPHY0_PAGEVERSION: PAGE\n"));
669 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
670 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
671 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
672 pci_free_consistent(ioc->pcidev, sasPhyPg0_data_sz,
673 (u8 *) sasPhyPg0, sasPhyPg0_dma);
674 goto sas_get_phy_info_exit;
675 }
676
677 -/* EDM : dump PHY Page 0 data*/
678 memcpy(&sas_address, &sasPhyPg0->SASAddress, sizeof(u64));
679 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 0 ------------\n"));
680 + dcsmisasprintk(ioc, printk(KERN_DEBUG
681 + "---- SAS PHY PAGE 0 ------------\n"));
682 dcsmisasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n",
683 le16_to_cpu(sasPhyPg0->AttachedDevHandle)));
684 dcsmisasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n",
685 (unsigned long long)sas_address));
686 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Attached PHY Identifier=0x%X\n",
687 + dcsmisasprintk(ioc, printk(KERN_DEBUG
688 + "Attached PHY Identifier=0x%X\n",
689 sasPhyPg0->AttachedPhyIdentifier));
690 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Attached Device Info=0x%X\n",
691 + dcsmisasprintk(ioc, printk(KERN_DEBUG
692 + "Attached Device Info=0x%X\n",
693 le32_to_cpu(sasPhyPg0->AttachedDeviceInfo)));
694 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Programmed Link Rate=0x%X\n",
695 + dcsmisasprintk(ioc, printk(KERN_DEBUG
696 + "Programmed Link Rate=0x%X\n",
697 sasPhyPg0->ProgrammedLinkRate));
698 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Hardware Link Rate=0x%X\n",
699 + dcsmisasprintk(ioc, printk(KERN_DEBUG
700 + "Hardware Link Rate=0x%X\n",
701 sasPhyPg0->HwLinkRate));
702 dcsmisasprintk(ioc, printk(KERN_DEBUG "Change Count=0x%X\n",
703 sasPhyPg0->ChangeCount));
704 dcsmisasprintk(ioc, printk(KERN_DEBUG "PHY Info=0x%X\n",
705 le32_to_cpu(sasPhyPg0->PhyInfo)));
706 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
707 -/* EDM : debug data */
708
709 /* save the data */
710
711 @@ -1284,8 +1245,9 @@ csmisas_get_phy_info(unsigned long arg)
712 }
713
714 karg->Information.Phy[ii].bPhyChangeCount = sasPhyPg0->ChangeCount;
715 - if( sasPhyPg0->PhyInfo & MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY )
716 - karg->Information.Phy[ii].bPhyFeatures = CSMI_SAS_PHY_VIRTUAL_SMP;
717 + if (sasPhyPg0->PhyInfo & MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY)
718 + karg->Information.Phy[ii].bPhyFeatures
719 + = CSMI_SAS_PHY_VIRTUAL_SMP;
720
721 /* Fill in Attached Device
722 * Initiator Port Protocol.
723 @@ -1295,17 +1257,17 @@ csmisas_get_phy_info(unsigned long arg)
724 protocol = le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) & 0x78;
725 karg->Information.Phy[ii].Attached.bInitiatorPortProtocol = 0;
726 if (protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR)
727 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol =
728 - CSMI_SAS_PROTOCOL_SSP;
729 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
730 + = CSMI_SAS_PROTOCOL_SSP;
731 if (protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR)
732 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol |=
733 - CSMI_SAS_PROTOCOL_STP;
734 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
735 + |= CSMI_SAS_PROTOCOL_STP;
736 if (protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR)
737 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol |=
738 - CSMI_SAS_PROTOCOL_SMP;
739 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
740 + |= CSMI_SAS_PROTOCOL_SMP;
741 if (protocol & MPI_SAS_DEVICE_INFO_SATA_HOST)
742 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol |=
743 - CSMI_SAS_PROTOCOL_SATA;
744 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
745 + |= CSMI_SAS_PROTOCOL_SATA;
746
747 /* Fill in Phy Target Port
748 * Protocol. Bits 10:7
749 @@ -1314,17 +1276,17 @@ csmisas_get_phy_info(unsigned long arg)
750 protocol = le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) & 0x780;
751 karg->Information.Phy[ii].Attached.bTargetPortProtocol = 0;
752 if (protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET)
753 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
754 - CSMI_SAS_PROTOCOL_SSP;
755 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
756 + |= CSMI_SAS_PROTOCOL_SSP;
757 if (protocol & MPI_SAS_DEVICE_INFO_STP_TARGET)
758 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
759 - CSMI_SAS_PROTOCOL_STP;
760 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
761 + |= CSMI_SAS_PROTOCOL_STP;
762 if (protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET)
763 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
764 - CSMI_SAS_PROTOCOL_SMP;
765 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
766 + |= CSMI_SAS_PROTOCOL_SMP;
767 if (protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
768 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
769 - CSMI_SAS_PROTOCOL_SATA;
770 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
771 + |= CSMI_SAS_PROTOCOL_SATA;
772
773
774 /* Fill in Attached device type */
775 @@ -1353,7 +1315,8 @@ csmisas_get_phy_info(unsigned long arg)
776 }
777
778 /* Identify Info. */
779 - switch (le32_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) &
780 + switch (le32_to_cpu
781 + (sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) &
782 MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE) {
783
784 case MPI_SAS_DEVICE_INFO_NO_DEVICE:
785 @@ -1383,18 +1346,18 @@ csmisas_get_phy_info(unsigned long arg)
786 protocol = le32_to_cpu(
787 sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) & 0x78;
788 karg->Information.Phy[ii].Identify.bInitiatorPortProtocol = 0;
789 - if( protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR )
790 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
791 - CSMI_SAS_PROTOCOL_SSP;
792 - if( protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR )
793 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
794 - CSMI_SAS_PROTOCOL_STP;
795 - if( protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR )
796 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
797 - CSMI_SAS_PROTOCOL_SMP;
798 - if( protocol & MPI_SAS_DEVICE_INFO_SATA_HOST )
799 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
800 - CSMI_SAS_PROTOCOL_SATA;
801 + if (protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR)
802 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
803 + |= CSMI_SAS_PROTOCOL_SSP;
804 + if (protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR)
805 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
806 + |= CSMI_SAS_PROTOCOL_STP;
807 + if (protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR)
808 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
809 + |= CSMI_SAS_PROTOCOL_SMP;
810 + if (protocol & MPI_SAS_DEVICE_INFO_SATA_HOST)
811 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
812 + |= CSMI_SAS_PROTOCOL_SATA;
813
814 /* Fill in Phy Target Port Protocol. Bits 10:7
815 * More than one bit can be set, fall through cases.
816 @@ -1402,18 +1365,18 @@ csmisas_get_phy_info(unsigned long arg)
817 protocol = le32_to_cpu(
818 sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) & 0x780;
819 karg->Information.Phy[ii].Identify.bTargetPortProtocol = 0;
820 - if( protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET )
821 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
822 - CSMI_SAS_PROTOCOL_SSP;
823 - if( protocol & MPI_SAS_DEVICE_INFO_STP_TARGET )
824 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
825 - CSMI_SAS_PROTOCOL_STP;
826 - if( protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET )
827 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
828 - CSMI_SAS_PROTOCOL_SMP;
829 - if( protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE )
830 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
831 - CSMI_SAS_PROTOCOL_SATA;
832 + if (protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET)
833 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
834 + |= CSMI_SAS_PROTOCOL_SSP;
835 + if (protocol & MPI_SAS_DEVICE_INFO_STP_TARGET)
836 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
837 + |= CSMI_SAS_PROTOCOL_STP;
838 + if (protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET)
839 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
840 + |= CSMI_SAS_PROTOCOL_SMP;
841 + if (protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
842 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
843 + |= CSMI_SAS_PROTOCOL_SATA;
844
845 /* Setup SAS Address for the attached device */
846 if (sasPhyPg0->AttachedDevHandle) {
847 @@ -1450,13 +1413,13 @@ sas_get_phy_info_exit:
848 sizeof(CSMI_SAS_PHY_INFO_BUFFER))) {
849 printk(KERN_ERR "%s@%d::%s - "
850 "Unable to write out csmisas_get_phy_info_buffer @ %p\n",
851 - __FILE__, __LINE__, __FUNCTION__, uarg);
852 + __FILE__, __LINE__, __func__, uarg);
853 free_pages((unsigned long)karg, memory_pages);
854 return -EFAULT;
855 }
856
857 free_pages((unsigned long)karg, memory_pages);
858 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
859 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
860 return 0;
861 }
862
863 @@ -1479,30 +1442,28 @@ csmisas_set_phy_info(unsigned long arg)
864 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_SET_PHY_INFO_BUFFER))) {
865 printk(KERN_ERR "%s@%d::%s() - "
866 "Unable to read in csmi_sas_set_phy_info struct @ %p\n",
867 - __FILE__, __LINE__, __FUNCTION__, uarg);
868 + __FILE__, __LINE__, __func__, uarg);
869 return -EFAULT;
870 }
871
872 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
873 &ioc)) < 0) || (ioc == NULL)) {
874 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
875 - __FILE__, __FUNCTION__, __LINE__, iocnum);
876 + __FILE__, __func__, __LINE__, iocnum);
877 return -ENODEV;
878 }
879
880 if (!csmisas_is_this_sas_cntr(ioc)) {
881 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
882 - __FILE__, __FUNCTION__, __LINE__, iocnum);
883 + __FILE__, __func__, __LINE__, iocnum);
884 return -ENODEV;
885 }
886
887 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
888 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
889
890 -/* TODO - implement IOCTL here */
891 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;
892 dcsmisasprintk(ioc, printk(KERN_DEBUG ": not implemented\n"));
893
894 -// cim_set_phy_info_exit:
895
896 /* Copy the data from kernel memory to user memory
897 */
898 @@ -1510,11 +1471,11 @@ csmisas_set_phy_info(unsigned long arg)
899 sizeof(CSMI_SAS_SET_PHY_INFO_BUFFER))) {
900 printk(KERN_ERR "%s@%d::%s() - "
901 "Unable to write out csmi_sas_set_phy_info @ %p\n",
902 - __FILE__, __LINE__, __FUNCTION__, uarg);
903 + __FILE__, __LINE__, __func__, uarg);
904 return -EFAULT;
905 }
906
907 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
908 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
909 return 0;
910
911 }
912 @@ -1541,24 +1502,24 @@ csmisas_get_scsi_address(unsigned long a
913 sizeof(CSMI_SAS_GET_SCSI_ADDRESS_BUFFER))) {
914 printk(KERN_ERR "%s@%d::%s() - "
915 "Unable to read in csmi_sas_get_scsi_address struct @ %p\n",
916 - __FILE__, __LINE__, __FUNCTION__, uarg);
917 + __FILE__, __LINE__, __func__, uarg);
918 return -EFAULT;
919 }
920
921 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
922 &ioc)) < 0) || (ioc == NULL)) {
923 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
924 - __FILE__, __FUNCTION__, __LINE__, iocnum);
925 + __FILE__, __func__, __LINE__, iocnum);
926 return -ENODEV;
927 }
928
929 if (!csmisas_is_this_sas_cntr(ioc)) {
930 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
931 - __FILE__, __FUNCTION__, __LINE__, iocnum);
932 + __FILE__, __func__, __LINE__, iocnum);
933 return -ENODEV;
934 }
935
936 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
937 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
938
939 /* reverse byte order the sas address */
940 memcpy(&sas_address, karg.bSASAddress, sizeof(u64));
941 @@ -1586,11 +1547,11 @@ csmisas_get_scsi_address(unsigned long a
942 sizeof(CSMI_SAS_GET_SCSI_ADDRESS_BUFFER))) {
943 printk(KERN_ERR "%s@%d::%s() - "
944 "Unable to write out csmi_sas_get_scsi_address @ %p\n",
945 - __FILE__, __LINE__, __FUNCTION__, uarg);
946 + __FILE__, __LINE__, __func__, uarg);
947 return -EFAULT;
948 }
949
950 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
951 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
952 return 0;
953 }
954
955 @@ -1621,37 +1582,38 @@ csmisas_get_sata_signature(unsigned long
956 u8 phyId;
957 u64 sas_address;
958
959 - sasPhyPg0=NULL;
960 - sasPhyPg0_data_sz=0;
961 - sasDevicePg1=NULL;
962 - sasDevicePg1_data_sz=0;
963 + sasPhyPg0 = NULL;
964 + sasPhyPg0_data_sz = 0;
965 + sasDevicePg1 = NULL;
966 + sasDevicePg1_data_sz = 0;
967
968 if (copy_from_user(&karg, uarg,
969 sizeof(CSMI_SAS_SATA_SIGNATURE_BUFFER))) {
970 printk(KERN_ERR "%s@%d::%s() - "
971 "Unable to read in csmi_sas_sata_signature struct @ %p\n",
972 - __FILE__, __LINE__, __FUNCTION__, uarg);
973 + __FILE__, __LINE__, __func__, uarg);
974 return -EFAULT;
975 }
976
977 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
978 &ioc)) < 0) || (ioc == NULL)) {
979 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
980 - __FILE__, __FUNCTION__, __LINE__, iocnum);
981 + __FILE__, __func__, __LINE__, iocnum);
982 return -ENODEV;
983 }
984
985 if (!csmisas_is_this_sas_cntr(ioc)) {
986 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
987 - __FILE__, __FUNCTION__, __LINE__, iocnum);
988 + __FILE__, __func__, __LINE__, iocnum);
989 return -ENODEV;
990 }
991
992 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
993 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
994 phyId = karg.Signature.bPhyIdentifier;
995 if (phyId >= ioc->num_ports) {
996 karg.IoctlHeader.ReturnCode = CSMI_SAS_PHY_DOES_NOT_EXIST;
997 - dcsmisasprintk(ioc, printk(KERN_WARNING ": phyId >= ioc->num_ports\n"));
998 + dcsmisasprintk(ioc,
999 + printk(KERN_WARNING ": phyId >= ioc->num_ports\n"));
1000 goto cim_sata_signature_exit;
1001 }
1002
1003 @@ -1683,7 +1645,7 @@ csmisas_get_sata_signature(unsigned long
1004 */
1005 dcsmisasprintk(ioc, printk(KERN_ERR
1006 ": FAILED: MPI_SASPHY0_PAGEVERSION: HEADER\n"));
1007 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1008 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1009 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1010 goto cim_sata_signature_exit;
1011 }
1012 @@ -1692,7 +1654,8 @@ csmisas_get_sata_signature(unsigned long
1013 /* Don't check if this failed. Already in a
1014 * failure case.
1015 */
1016 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1017 + dcsmisasprintk(ioc,
1018 + printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1019 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1020 goto cim_sata_signature_exit;
1021 }
1022 @@ -1704,8 +1667,9 @@ csmisas_get_sata_signature(unsigned long
1023 sasPhyPg0 = (SasPhyPage0_t *) pci_alloc_consistent(ioc->pcidev,
1024 sasPhyPg0_data_sz, &sasPhyPg0_dma);
1025
1026 - if (! sasPhyPg0) {
1027 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1028 + if (!sasPhyPg0) {
1029 + dcsmisasprintk(ioc,
1030 + printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1031 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1032 goto cim_sata_signature_exit;
1033 }
1034 @@ -1720,7 +1684,7 @@ csmisas_get_sata_signature(unsigned long
1035 */
1036 dcsmisasprintk(ioc, printk(KERN_ERR
1037 ": FAILED: MPI_SASPHY0_PAGEVERSION: PAGE\n"));
1038 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1039 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1040 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1041 goto cim_sata_signature_exit;
1042 }
1043 @@ -1728,7 +1692,8 @@ csmisas_get_sata_signature(unsigned long
1044 /* Make sure a SATA device is attached. */
1045 if ((le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) &
1046 MPI_SAS_DEVICE_INFO_SATA_DEVICE) == 0) {
1047 - dcsmisasprintk(ioc, printk(KERN_WARNING ": NOT A SATA DEVICE\n"));
1048 + dcsmisasprintk(ioc,
1049 + printk(KERN_WARNING ": NOT A SATA DEVICE\n"));
1050 karg.IoctlHeader.ReturnCode = CSMI_SAS_NO_SATA_DEVICE;
1051 goto cim_sata_signature_exit;
1052 }
1053 @@ -1755,13 +1720,14 @@ csmisas_get_sata_signature(unsigned long
1054 if ((rc = mpt_config(ioc, &cfg)) != 0) {
1055 dcsmisasprintk(ioc, printk(KERN_ERR
1056 ": FAILED: MPI_SASDEVICE1_PAGEVERSION: HEADER\n"));
1057 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1058 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1059 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1060 goto cim_sata_signature_exit;
1061 }
1062
1063 if (hdr.ExtPageLength == 0) {
1064 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1065 + dcsmisasprintk(ioc, printk(KERN_ERR
1066 + ": hdr.ExtPageLength == 0\n"));
1067 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1068 goto cim_sata_signature_exit;
1069 }
1070 @@ -1772,8 +1738,9 @@ csmisas_get_sata_signature(unsigned long
1071 sasDevicePg1 = (SasDevicePage1_t *) pci_alloc_consistent
1072 (ioc->pcidev, sasDevicePg1_data_sz, &sasDevicePg1_dma);
1073
1074 - if (! sasDevicePg1) {
1075 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1076 + if (!sasDevicePg1) {
1077 + dcsmisasprintk(ioc, printk(KERN_ERR
1078 + ": pci_alloc_consistent: FAILED\n"));
1079 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1080 goto cim_sata_signature_exit;
1081 }
1082 @@ -1785,29 +1752,31 @@ csmisas_get_sata_signature(unsigned long
1083 if ((rc = mpt_config(ioc, &cfg)) != 0) {
1084 dcsmisasprintk(ioc, printk(KERN_ERR
1085 ": FAILED: MPI_SASDEVICE1_PAGEVERSION: PAGE\n"));
1086 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1087 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1088 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1089 goto cim_sata_signature_exit;
1090 }
1091
1092 -/* EDM : dump Device Page 1 data*/
1093 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- SAS DEVICE PAGE 1 ---------\n"));
1094 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Handle=0x%x\n",sasDevicePg1->DevHandle));
1095 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1096 + "---- SAS DEVICE PAGE 1 ---------\n"));
1097 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1098 + "Handle=0x%x\n", sasDevicePg1->DevHandle));
1099 memcpy(&sas_address, &sasDevicePg1->SASAddress, sizeof(u64));
1100 dcsmisasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n",
1101 (unsigned long long)sas_address));
1102 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
1103 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Target ID=0x%x\n",sasDevicePg1->TargetID));
1104 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Bus=0x%x\n",sasDevicePg1->Bus));
1105 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1106 + "Target ID=0x%x\n", sasDevicePg1->TargetID));
1107 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1108 + "Bus=0x%x\n", sasDevicePg1->Bus));
1109 dcsmisasprintk(ioc, printk(KERN_DEBUG "Initial Reg Device FIS="));
1110 - for(jj=0;jj<20;jj++)
1111 + for (jj = 0; jj < 20; jj++)
1112 dcsmisasprintk(ioc, printk("%02x ",
1113 ((u8 *)&sasDevicePg1->InitialRegDeviceFIS)[jj]));
1114 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n\n"));
1115 -/* EDM : debug data */
1116
1117 memcpy(karg.Signature.bSignatureFIS,
1118 - sasDevicePg1->InitialRegDeviceFIS,20);
1119 + sasDevicePg1->InitialRegDeviceFIS, 20);
1120
1121 cim_sata_signature_exit:
1122
1123 @@ -1825,11 +1794,11 @@ csmisas_get_sata_signature(unsigned long
1124 sizeof(CSMI_SAS_SATA_SIGNATURE_BUFFER))) {
1125 printk(KERN_ERR "%s@%d::%s() - "
1126 "Unable to write out csmi_sas_sata_signature @ %p\n",
1127 - __FILE__, __LINE__, __FUNCTION__, uarg);
1128 + __FILE__, __LINE__, __func__, uarg);
1129 return -EFAULT;
1130 }
1131
1132 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1133 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1134 return 0;
1135 }
1136
1137 @@ -1855,24 +1824,24 @@ csmisas_get_device_address(unsigned long
1138 sizeof(CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER))) {
1139 printk(KERN_ERR "%s@%d::%s() - "
1140 "Unable to read in csmi_sas_get_device_address_buffer struct @ %p\n",
1141 - __FILE__, __LINE__, __FUNCTION__, uarg);
1142 + __FILE__, __LINE__, __func__, uarg);
1143 return -EFAULT;
1144 }
1145
1146 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
1147 &ioc)) < 0) || (ioc == NULL)) {
1148 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1149 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1150 + __FILE__, __func__, __LINE__, iocnum);
1151 return -ENODEV;
1152 }
1153
1154 if (!csmisas_is_this_sas_cntr(ioc)) {
1155 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1156 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1157 + __FILE__, __func__, __LINE__, iocnum);
1158 return -ENODEV;
1159 }
1160
1161 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1162 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1163
1164 karg.IoctlHeader.ReturnCode = CSMI_SAS_NO_DEVICE_ADDRESS;
1165 memset(karg.bSASAddress, 0, sizeof(u64));
1166 @@ -1896,11 +1865,11 @@ csmisas_get_device_address(unsigned long
1167 sizeof(CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER))) {
1168 printk(KERN_ERR "%s@%d::%s() - "
1169 "Unable to write out csmi_sas_get_device_address_buffer @ %p\n",
1170 - __FILE__, __LINE__, __FUNCTION__, uarg);
1171 + __FILE__, __LINE__, __func__, uarg);
1172 return -EFAULT;
1173 }
1174
1175 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1176 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1177 return 0;
1178 }
1179
1180 @@ -1933,35 +1902,36 @@ csmisas_get_link_errors(unsigned long ar
1181 u16 ioc_status;
1182 u32 MsgContext;
1183
1184 - sasPhyPage1=NULL;
1185 - sasPhyPage1_data_sz=0;
1186 + sasPhyPage1 = NULL;
1187 + sasPhyPage1_data_sz = 0;
1188
1189 if (copy_from_user(&karg, uarg,
1190 sizeof(CSMI_SAS_LINK_ERRORS_BUFFER))) {
1191 printk(KERN_ERR "%s@%d::%s() - "
1192 "Unable to read in csmisas_get_link_errors struct @ %p\n",
1193 - __FILE__, __LINE__, __FUNCTION__, uarg);
1194 + __FILE__, __LINE__, __func__, uarg);
1195 return -EFAULT;
1196 }
1197
1198 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
1199 &ioc)) < 0) || (ioc == NULL)) {
1200 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1201 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1202 + __FILE__, __func__, __LINE__, iocnum);
1203 return -ENODEV;
1204 }
1205
1206 if (!csmisas_is_this_sas_cntr(ioc)) {
1207 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1208 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1209 + __FILE__, __func__, __LINE__, iocnum);
1210 return -ENODEV;
1211 }
1212
1213 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1214 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1215 phyId = karg.Information.bPhyIdentifier;
1216 if (phyId >= ioc->num_ports) {
1217 karg.IoctlHeader.ReturnCode = CSMI_SAS_PHY_DOES_NOT_EXIST;
1218 - dcsmisasprintk(ioc, printk(KERN_WARNING ": phyId >= ioc->num_ports\n"));
1219 + dcsmisasprintk(ioc, printk(KERN_WARNING
1220 + ": phyId >= ioc->num_ports\n"));
1221 goto cim_get_link_errors_exit;
1222 }
1223
1224 @@ -1993,7 +1963,7 @@ csmisas_get_link_errors(unsigned long ar
1225 */
1226 dcsmisasprintk(ioc, printk(KERN_ERR
1227 ": FAILED: MPI_SASPHY1_PAGEVERSION: HEADER\n"));
1228 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1229 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1230 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1231 goto cim_get_link_errors_exit;
1232 }
1233 @@ -2002,7 +1972,8 @@ csmisas_get_link_errors(unsigned long ar
1234 /* Don't check if this failed. Already in a
1235 * failure case.
1236 */
1237 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1238 + dcsmisasprintk(ioc, printk(KERN_ERR
1239 + ": hdr.ExtPageLength == 0\n"));
1240 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1241 goto cim_get_link_errors_exit;
1242 }
1243 @@ -2014,8 +1985,9 @@ csmisas_get_link_errors(unsigned long ar
1244 sasPhyPage1 = (SasPhyPage1_t *) pci_alloc_consistent(ioc->pcidev,
1245 sasPhyPage1_data_sz, &sasPhyPage1_dma);
1246
1247 - if (! sasPhyPage1) {
1248 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1249 + if (!sasPhyPage1) {
1250 + dcsmisasprintk(ioc, printk(KERN_ERR
1251 + ": pci_alloc_consistent: FAILED\n"));
1252 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1253 goto cim_get_link_errors_exit;
1254 }
1255 @@ -2028,24 +2000,25 @@ csmisas_get_link_errors(unsigned long ar
1256 /* Don't check if this failed. Already in a
1257 * failure case.
1258 */
1259 - dcsmisasprintk(ioc, printk(KERN_ERR ": FAILED: MPI_SASPHY1_PAGEVERSION: PAGE\n"));
1260 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1261 + dcsmisasprintk(ioc, printk(KERN_ERR
1262 + ": FAILED: MPI_SASPHY1_PAGEVERSION: PAGE\n"));
1263 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1264 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1265 goto cim_get_link_errors_exit;
1266 }
1267
1268 -/* EDM : dump PHY Page 1 data*/
1269 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 1 ------------\n"));
1270 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1271 + "---- SAS PHY PAGE 1 ------------\n"));
1272 dcsmisasprintk(ioc, printk(KERN_DEBUG "Invalid Dword Count=0x%x\n",
1273 sasPhyPage1->InvalidDwordCount));
1274 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Running Disparity Error Count=0x%x\n",
1275 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1276 + "Running Disparity Error Count=0x%x\n",
1277 sasPhyPage1->RunningDisparityErrorCount));
1278 dcsmisasprintk(ioc, printk(KERN_DEBUG "Loss Dword Synch Count=0x%x\n",
1279 sasPhyPage1->LossDwordSynchCount));
1280 dcsmisasprintk(ioc, printk(KERN_DEBUG "PHY Reset Problem Count=0x%x\n",
1281 sasPhyPage1->PhyResetProblemCount));
1282 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n\n"));
1283 -/* EDM : debug data */
1284
1285 karg.Information.uInvalidDwordCount =
1286 le32_to_cpu(sasPhyPage1->InvalidDwordCount);
1287 @@ -2057,7 +2030,7 @@ csmisas_get_link_errors(unsigned long ar
1288 le32_to_cpu(sasPhyPage1->PhyResetProblemCount);
1289
1290 if (karg.Information.bResetCounts ==
1291 - CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS ) {
1292 + CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS) {
1293 goto cim_get_link_errors_exit;
1294 }
1295
1296 @@ -2072,12 +2045,12 @@ csmisas_get_link_errors(unsigned long ar
1297 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
1298 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1299 goto cim_get_link_errors_exit;
1300 - }
1301 + }
1302
1303 mpi_hdr = (MPIHeader_t *) mf;
1304 MsgContext = mpi_hdr->MsgContext;
1305 sasIoUnitCntrReq = (SasIoUnitControlRequest_t *)mf;
1306 - memset(sasIoUnitCntrReq,0,sizeof(SasIoUnitControlRequest_t));
1307 + memset(sasIoUnitCntrReq, 0, sizeof(SasIoUnitControlRequest_t));
1308 sasIoUnitCntrReq->Function = MPI_FUNCTION_SAS_IO_UNIT_CONTROL;
1309 sasIoUnitCntrReq->MsgContext = MsgContext;
1310 sasIoUnitCntrReq->PhyNum = phyId;
1311 @@ -2097,8 +2070,10 @@ csmisas_get_link_errors(unsigned long ar
1312 & MPI_IOCSTATUS_MASK;
1313
1314 if (ioc_status != MPI_IOCSTATUS_SUCCESS) {
1315 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": SAS IO Unit Control: "));
1316 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X\n",
1317 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1318 + ": SAS IO Unit Control: "));
1319 + dcsmisasprintk(ioc, printk(
1320 + "IOCStatus=0x%X IOCLogInfo=0x%X\n",
1321 sasIoUnitCntrReply->IOCStatus,
1322 sasIoUnitCntrReply->IOCLogInfo));
1323 }
1324 @@ -2116,11 +2091,11 @@ csmisas_get_link_errors(unsigned long ar
1325 sizeof(CSMI_SAS_LINK_ERRORS_BUFFER))) {
1326 printk(KERN_ERR "%s@%d::%s() - "
1327 "Unable to write out csmisas_get_link_errors @ %p\n",
1328 - __FILE__, __LINE__, __FUNCTION__, uarg);
1329 + __FILE__, __LINE__, __func__, uarg);
1330 return -EFAULT;
1331 }
1332
1333 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1334 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1335 return 0;
1336
1337 }
1338 @@ -2145,10 +2120,10 @@ csmisas_smp_passthru(unsigned long arg)
1339 MPIHeader_t *mpi_hdr;
1340 char *psge;
1341 int iocnum, flagsLength;
1342 - void * request_data;
1343 + void *request_data;
1344 dma_addr_t request_data_dma;
1345 u32 request_data_sz;
1346 - void * response_data;
1347 + void *response_data;
1348 dma_addr_t response_data_dma;
1349 u32 response_data_sz;
1350 u16 ioc_status;
1351 @@ -2161,11 +2136,11 @@ csmisas_smp_passthru(unsigned long arg)
1352 memory_pages = get_order(malloc_data_sz);
1353 karg = (CSMI_SAS_SMP_PASSTHRU_BUFFER *)__get_free_pages(
1354 GFP_KERNEL, memory_pages);
1355 - if (!karg){
1356 + if (!karg) {
1357 printk(KERN_ERR "%s@%d::%s() - "
1358 "Unable to malloc CSMI_SAS_SMP_PASSTHRU_BUFFER "
1359 "malloc_data_sz=%d memory_pages=%d\n",
1360 - __FILE__, __LINE__, __FUNCTION__,
1361 + __FILE__, __LINE__, __func__,
1362 malloc_data_sz, memory_pages);
1363 return -ENOMEM;
1364 }
1365 @@ -2173,7 +2148,7 @@ csmisas_smp_passthru(unsigned long arg)
1366 if (copy_from_user(karg, uarg, sizeof(CSMI_SAS_SMP_PASSTHRU_BUFFER))) {
1367 printk(KERN_ERR "%s@%d::%s() - "
1368 "Unable to read in csmi_sas_smp_passthru struct @ %p\n",
1369 - __FILE__, __LINE__, __FUNCTION__, uarg);
1370 + __FILE__, __LINE__, __func__, uarg);
1371 free_pages((unsigned long)karg, memory_pages);
1372 return -EFAULT;
1373 }
1374 @@ -2186,7 +2161,7 @@ csmisas_smp_passthru(unsigned long arg)
1375 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
1376 &ioc)) < 0) || (ioc == NULL)) {
1377 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1378 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1379 + __FILE__, __func__, __LINE__, iocnum);
1380 free_pages((unsigned long)karg, memory_pages);
1381 return -ENODEV;
1382 }
1383 @@ -2194,19 +2169,19 @@ csmisas_smp_passthru(unsigned long arg)
1384 if (ioc->ioc_reset_in_progress) {
1385 printk(KERN_ERR "%s@%d::%s - "
1386 "Busy with IOC Reset \n",
1387 - __FILE__, __LINE__,__FUNCTION__);
1388 + __FILE__, __LINE__, __func__);
1389 free_pages((unsigned long)karg, memory_pages);
1390 return -EBUSY;
1391 }
1392
1393 if (!csmisas_is_this_sas_cntr(ioc)) {
1394 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1395 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1396 + __FILE__, __func__, __LINE__, iocnum);
1397 free_pages((unsigned long)karg, memory_pages);
1398 return -ENODEV;
1399 }
1400
1401 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1402 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1403
1404 /* Default to success.*/
1405 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
1406 @@ -2228,13 +2203,13 @@ csmisas_smp_passthru(unsigned long arg)
1407 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
1408 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1409 goto cim_smp_passthru_exit;
1410 - }
1411 + }
1412
1413 mpi_hdr = (MPIHeader_t *) mf;
1414 MsgContext = mpi_hdr->MsgContext;
1415 - smpReq = (pSmpPassthroughRequest_t ) mf;
1416 + smpReq = (pSmpPassthroughRequest_t) mf;
1417
1418 - memset(smpReq,0,ioc->req_sz);
1419 + memset(smpReq, 0, ioc->req_sz);
1420
1421 memcpy(&sas_address, karg->Parameters.bDestinationSASAddress,
1422 sizeof(u64));
1423 @@ -2270,7 +2245,8 @@ csmisas_smp_passthru(unsigned long arg)
1424 ioc->pcidev, request_data_sz, &request_data_dma);
1425
1426 if (!request_data) {
1427 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1428 + dcsmisasprintk(ioc, printk(KERN_ERR
1429 + ": pci_alloc_consistent: FAILED\n"));
1430 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1431 mpt_free_msg_frame(ioc, mf);
1432 goto cim_smp_passthru_exit;
1433 @@ -2286,7 +2262,8 @@ csmisas_smp_passthru(unsigned long arg)
1434 ioc->pcidev, response_data_sz, &response_data_dma);
1435
1436 if (!response_data) {
1437 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1438 + dcsmisasprintk(ioc, printk(KERN_ERR
1439 + ": pci_alloc_consistent: FAILED\n"));
1440 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1441 mpt_free_msg_frame(ioc, mf);
1442 goto cim_smp_passthru_exit;
1443 @@ -2302,26 +2279,29 @@ csmisas_smp_passthru(unsigned long arg)
1444
1445 ioc->add_sge(psge, flagsLength, response_data_dma);
1446
1447 - if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout) != 0) {
1448 + if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout)
1449 + != 0) {
1450 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1451 goto cim_smp_passthru_exit;
1452 }
1453
1454 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
1455 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": SMP Passthru: oh no, there is no reply!!"));
1456 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1457 + ": SMP Passthru: oh no, there is no reply!!"));
1458 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1459 goto cim_smp_passthru_exit;
1460 }
1461
1462 /* process the completed Reply Message Frame */
1463 - smpReply = (pSmpPassthroughReply_t )ioc->ioctl_cmds.reply;
1464 + smpReply = (pSmpPassthroughReply_t)ioc->ioctl_cmds.reply;
1465 ioc_status = le16_to_cpu(smpReply->IOCStatus) & MPI_IOCSTATUS_MASK;
1466
1467 if ((ioc_status != MPI_IOCSTATUS_SUCCESS) &&
1468 (ioc_status != MPI_IOCSTATUS_SCSI_DATA_UNDERRUN)) {
1469 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1470 dcsmisasprintk(ioc, printk(KERN_DEBUG ": SMP Passthru: "));
1471 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
1472 + dcsmisasprintk(ioc, printk(
1473 + "IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
1474 le16_to_cpu(smpReply->IOCStatus),
1475 le32_to_cpu(smpReply->IOCLogInfo),
1476 smpReply->SASStatus));
1477 @@ -2333,7 +2313,8 @@ csmisas_smp_passthru(unsigned long arg)
1478
1479
1480 if (le16_to_cpu(smpReply->ResponseDataLength)) {
1481 - karg->Parameters.uResponseBytes = le16_to_cpu(smpReply->ResponseDataLength);
1482 + karg->Parameters.uResponseBytes
1483 + = le16_to_cpu(smpReply->ResponseDataLength);
1484 memcpy(&karg->Parameters.Response,
1485 response_data, le16_to_cpu(smpReply->ResponseDataLength));
1486 }
1487 @@ -2355,13 +2336,13 @@ csmisas_smp_passthru(unsigned long arg)
1488 sizeof(CSMI_SAS_SMP_PASSTHRU_BUFFER))) {
1489 printk(KERN_ERR "%s@%d::%s() - "
1490 "Unable to write out csmi_sas_smp_passthru @ %p\n",
1491 - __FILE__, __LINE__, __FUNCTION__, uarg);
1492 + __FILE__, __LINE__, __func__, uarg);
1493 free_pages((unsigned long)karg, memory_pages);
1494 return -EFAULT;
1495 }
1496
1497 free_pages((unsigned long)karg, memory_pages);
1498 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n",__FUNCTION__));
1499 + dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n", __func__));
1500 return 0;
1501 }
1502
1503 @@ -2376,18 +2357,18 @@ csmisas_smp_passthru(unsigned long arg)
1504 static int csmisas_ssp_passthru(unsigned long arg)
1505 {
1506 CSMI_SAS_SSP_PASSTHRU_BUFFER __user *uarg = (void __user *) arg;
1507 - CSMI_SAS_SSP_PASSTHRU_BUFFER karg_hdr, * karg;
1508 + CSMI_SAS_SSP_PASSTHRU_BUFFER karg_hdr, *karg;
1509 MPT_ADAPTER *ioc = NULL;
1510 pSCSIIORequest_t pScsiRequest;
1511 pSCSIIOReply_t pScsiReply;
1512 MPT_FRAME_HDR *mf = NULL;
1513 MPIHeader_t *mpi_hdr;
1514 - int iocnum,ii;
1515 + int iocnum, ii;
1516 u64 sas_address;
1517 u16 req_idx;
1518 char *psge;
1519 int flagsLength;
1520 - void * request_data;
1521 + void *request_data;
1522 dma_addr_t request_data_dma;
1523 u32 request_data_sz;
1524 int malloc_data_sz;
1525 @@ -2402,10 +2383,11 @@ static int csmisas_ssp_passthru(unsigned
1526 u8 skey, asc, ascq;
1527 u32 MsgContext;
1528
1529 - if (copy_from_user(&karg_hdr, uarg, sizeof(CSMI_SAS_SSP_PASSTHRU_BUFFER))) {
1530 + if (copy_from_user(&karg_hdr, uarg,
1531 + sizeof(CSMI_SAS_SSP_PASSTHRU_BUFFER))) {
1532 printk(KERN_ERR "%s@%d::%s() - "
1533 "Unable to read in csmi_sas_ssp_passthru struct @ %p\n",
1534 - __FILE__, __LINE__, __FUNCTION__, uarg);
1535 + __FILE__, __LINE__, __func__, uarg);
1536 return -EFAULT;
1537 }
1538
1539 @@ -2422,11 +2404,11 @@ static int csmisas_ssp_passthru(unsigned
1540 memory_pages = get_order(malloc_data_sz);
1541 karg = (CSMI_SAS_SSP_PASSTHRU_BUFFER *)__get_free_pages(
1542 GFP_KERNEL, memory_pages);
1543 - if (!karg){
1544 + if (!karg) {
1545 printk(KERN_ERR "%s@%d::%s() - "
1546 "Unable to malloc SAS_SSP_PASSTHRU_BUFFER "
1547 "malloc_data_sz=%d memory_pages=%d\n",
1548 - __FILE__, __LINE__, __FUNCTION__,
1549 + __FILE__, __LINE__, __func__,
1550 malloc_data_sz, memory_pages);
1551 return -ENOMEM;
1552 }
1553 @@ -2434,10 +2416,10 @@ static int csmisas_ssp_passthru(unsigned
1554 memset(karg, 0, sizeof(*karg));
1555
1556 if (copy_from_user(karg, uarg, request_data_sz +
1557 - offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER,bDataBuffer))) {
1558 + offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER, bDataBuffer))) {
1559 printk(KERN_ERR "%s@%d::%s() - "
1560 "Unable to read in csmi_sas_ssp_passthru struct @ %p\n",
1561 - __FILE__, __LINE__, __FUNCTION__, uarg);
1562 + __FILE__, __LINE__, __func__, uarg);
1563 free_pages((unsigned long)karg, memory_pages);
1564 return -EFAULT;
1565 }
1566 @@ -2445,40 +2427,43 @@ static int csmisas_ssp_passthru(unsigned
1567 /*
1568 * some checks of the incoming frame
1569 */
1570 - if ( offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER,bDataBuffer) +
1571 + if (offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER, bDataBuffer) +
1572 request_data_sz - sizeof(IOCTL_HEADER) >
1573 - karg->IoctlHeader.Length ) {
1574 - karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
1575 + karg->IoctlHeader.Length) {
1576 + karg->IoctlHeader.ReturnCode
1577 + = CSMI_SAS_STATUS_INVALID_PARAMETER;
1578 dcsmisasprintk(ioc, printk(KERN_ERR
1579 "%s::%s()"
1580 " @%d - expected datalen incorrect!\n",
1581 - __FILE__, __FUNCTION__, __LINE__));
1582 + __FILE__, __func__, __LINE__));
1583 goto cim_ssp_passthru_exit;
1584 }
1585
1586 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
1587 &ioc)) < 0) || (ioc == NULL)) {
1588 - karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
1589 + karg->IoctlHeader.ReturnCode
1590 + = CSMI_SAS_STATUS_INVALID_PARAMETER;
1591 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1592 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1593 + __FILE__, __func__, __LINE__, iocnum);
1594 goto cim_ssp_passthru_exit;
1595 }
1596
1597 if (ioc->ioc_reset_in_progress) {
1598 printk(KERN_ERR "%s@%d::%s - "
1599 "Busy with IOC Reset \n",
1600 - __FILE__, __LINE__,__FUNCTION__);
1601 + __FILE__, __LINE__, __func__);
1602 return -EBUSY;
1603 }
1604
1605 if (!csmisas_is_this_sas_cntr(ioc)) {
1606 - karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
1607 + karg->IoctlHeader.ReturnCode
1608 + = CSMI_SAS_STATUS_INVALID_PARAMETER;
1609 printk(KERN_ERR "%s::%s()@%d - ioc%d not SAS controller!\n",
1610 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1611 + __FILE__, __func__, __LINE__, iocnum);
1612 goto cim_ssp_passthru_exit;
1613 }
1614
1615 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1616 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1617
1618 /* Default to success.
1619 */
1620 @@ -2492,7 +2477,7 @@ static int csmisas_ssp_passthru(unsigned
1621 dcsmisasprintk(ioc, printk(KERN_ERR
1622 "%s::%s()"
1623 " @%d - incorrect bPhyIdentifier and bPortIdentifier!\n",
1624 - __FILE__, __FUNCTION__, __LINE__));
1625 + __FILE__, __func__, __LINE__));
1626 goto cim_ssp_passthru_exit;
1627 }
1628
1629 @@ -2502,7 +2487,8 @@ static int csmisas_ssp_passthru(unsigned
1630
1631 /* Is the phy in range? */
1632 if (karg->Parameters.bPhyIdentifier >= ioc->num_ports) {
1633 - dcsmisasprintk(ioc, printk(KERN_WARNING ": phyId >= ioc->num_ports (%d %d)\n",
1634 + dcsmisasprintk(ioc, printk(KERN_WARNING
1635 + ": phyId >= ioc->num_ports (%d %d)\n",
1636 karg->Parameters.bPhyIdentifier,
1637 ioc->num_ports));
1638 karg->IoctlHeader.ReturnCode =
1639 @@ -2511,10 +2497,9 @@ static int csmisas_ssp_passthru(unsigned
1640 }
1641 }
1642
1643 - if(karg->Parameters.bAdditionalCDBLength) {
1644 - /* TODO - SCSI IO (32) Request Message support
1645 - */
1646 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": greater than 16-byte cdb "
1647 + if (karg->Parameters.bAdditionalCDBLength) {
1648 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1649 + ": greater than 16-byte cdb "
1650 "is not supported!\n"));
1651 karg->IoctlHeader.ReturnCode =
1652 CSMI_SAS_STATUS_INVALID_PARAMETER;
1653 @@ -2538,7 +2523,7 @@ static int csmisas_ssp_passthru(unsigned
1654 CSMI_SAS_STATUS_INVALID_PARAMETER;
1655 dcsmisasprintk(ioc, printk(KERN_ERR
1656 "%s::%s() @%d - couldn't find associated "
1657 - "SASAddress=%llX!\n", __FILE__, __FUNCTION__, __LINE__,
1658 + "SASAddress=%llX!\n", __FILE__, __func__, __LINE__,
1659 (unsigned long long)sas_address));
1660 goto cim_ssp_passthru_exit;
1661 }
1662 @@ -2558,20 +2543,21 @@ static int csmisas_ssp_passthru(unsigned
1663 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
1664 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1665 goto cim_ssp_passthru_exit;
1666 - }
1667 + }
1668
1669 mpi_hdr = (MPIHeader_t *) mf;
1670 MsgContext = mpi_hdr->MsgContext;
1671 pScsiRequest = (pSCSIIORequest_t) mf;
1672 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
1673
1674 - memset(pScsiRequest,0,sizeof(SCSIIORequest_t));
1675 + memset(pScsiRequest, 0, sizeof(SCSIIORequest_t));
1676
1677 /* Fill in SCSI IO (16) request.
1678 */
1679
1680 pScsiRequest->Function = (is_hidden_raid_component == 1) ?
1681 - MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH : MPI_FUNCTION_SCSI_IO_REQUEST;
1682 + MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH
1683 + : MPI_FUNCTION_SCSI_IO_REQUEST;
1684 pScsiRequest->TargetID = id;
1685 pScsiRequest->Bus = channel;
1686 memcpy(pScsiRequest->LUN, &karg->Parameters.bLun, 8);
1687 @@ -2583,10 +2569,11 @@ static int csmisas_ssp_passthru(unsigned
1688
1689 dcsmisasprintk(ioc, printk(KERN_DEBUG "\tchannel = %d id = %d ",
1690 sas_info->fw.channel, sas_info->fw.id));
1691 - dcsmisasprintk(ioc, if(is_hidden_raid_component)
1692 + dcsmisasprintk(ioc, if (is_hidden_raid_component)
1693 printk(KERN_DEBUG "num_id = %d ", id));
1694 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
1695 - dcsmisasprintk(ioc, printk(KERN_DEBUG "\tcdb_len = %d request_len = %d\n",
1696 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1697 + "\tcdb_len = %d request_len = %d\n",
1698 pScsiRequest->CDBLength, request_data_sz));
1699 dcsmisasprintk(ioc, printk(KERN_DEBUG "\t"));
1700 dcsmisasprintk(ioc, for (ii = 0; ii < pScsiRequest->CDBLength; ++ii)
1701 @@ -2603,7 +2590,8 @@ static int csmisas_ssp_passthru(unsigned
1702 (!karg->Parameters.uDataLength)) {
1703 /* no data transfer
1704 */
1705 - pScsiRequest->Control = cpu_to_le32(MPI_SCSIIO_CONTROL_NODATATRANSFER);
1706 + pScsiRequest->Control
1707 + = cpu_to_le32(MPI_SCSIIO_CONTROL_NODATATRANSFER);
1708 } else {
1709 /* no direction specified
1710 */
1711 @@ -2618,19 +2606,23 @@ static int csmisas_ssp_passthru(unsigned
1712
1713 /* task attributes
1714 */
1715 - if((karg->Parameters.uFlags && 0xFF) == 0) {
1716 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_SIMPLEQ);
1717 + if ((karg->Parameters.uFlags && 0xFF) == 0) {
1718 + pScsiRequest->Control
1719 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_SIMPLEQ);
1720 } else if (karg->Parameters.uFlags &
1721 CSMI_SAS_SSP_TASK_ATTRIBUTE_HEAD_OF_QUEUE) {
1722 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_HEADOFQ);
1723 + pScsiRequest->Control
1724 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_HEADOFQ);
1725 } else if (karg->Parameters.uFlags &
1726 CSMI_SAS_SSP_TASK_ATTRIBUTE_ORDERED) {
1727 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_ORDEREDQ);
1728 + pScsiRequest->Control
1729 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_ORDEREDQ);
1730 } else if (karg->Parameters.uFlags &
1731 CSMI_SAS_SSP_TASK_ATTRIBUTE_ACA) {
1732 pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_ACAQ);
1733 } else {
1734 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_UNTAGGED);
1735 + pScsiRequest->Control
1736 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_UNTAGGED);
1737 }
1738
1739 /* setup sense
1740 @@ -2647,19 +2639,20 @@ static int csmisas_ssp_passthru(unsigned
1741 flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE;
1742 } else if (karg->Parameters.uFlags & CSMI_SAS_SSP_READ) {
1743 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ;
1744 - }else {
1745 - flagsLength = ( MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1746 - MPI_SGE_FLAGS_DIRECTION )
1747 + } else {
1748 + flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1749 + MPI_SGE_FLAGS_DIRECTION)
1750 << MPI_SGE_FLAGS_SHIFT;
1751 }
1752 flagsLength |= request_data_sz;
1753
1754 - if ( request_data_sz > 0) {
1755 + if (request_data_sz > 0) {
1756 request_data = pci_alloc_consistent(
1757 ioc->pcidev, request_data_sz, &request_data_dma);
1758
1759 if (request_data == NULL) {
1760 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED "
1761 + dcsmisasprintk(ioc, printk(KERN_ERR
1762 + ": pci_alloc_consistent: FAILED "
1763 "request_data_sz=%d\n", request_data_sz));
1764 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1765 mpt_free_msg_frame(ioc, mf);
1766 @@ -2668,17 +2661,19 @@ static int csmisas_ssp_passthru(unsigned
1767
1768 ioc->add_sge(psge, flagsLength, request_data_dma);
1769 if (karg->Parameters.uFlags & CSMI_SAS_SSP_WRITE)
1770 - memcpy(request_data, karg->bDataBuffer, request_data_sz);
1771 + memcpy(request_data, karg->bDataBuffer,
1772 + request_data_sz);
1773 } else {
1774 ioc->add_sge(psge, flagsLength, (dma_addr_t) -1);
1775 }
1776
1777 - if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout) != 0) {
1778 + if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout)
1779 + != 0) {
1780 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1781 goto cim_ssp_passthru_exit;
1782 }
1783
1784 - memset(&karg->Status,0,sizeof(CSMI_SAS_SSP_PASSTHRU_STATUS));
1785 + memset(&karg->Status, 0, sizeof(CSMI_SAS_SSP_PASSTHRU_STATUS));
1786 karg->Status.bConnectionStatus = CSMI_SAS_OPEN_ACCEPT;
1787 karg->Status.bDataPresent = CSMI_SAS_SSP_NO_DATA_PRESENT;
1788 karg->Status.bStatus = GOOD;
1789 @@ -2689,11 +2684,13 @@ static int csmisas_ssp_passthru(unsigned
1790 /* process the completed Reply Message Frame */
1791 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) {
1792
1793 - pScsiReply = (pSCSIIOReply_t ) ioc->ioctl_cmds.reply;
1794 + pScsiReply = (pSCSIIOReply_t) ioc->ioctl_cmds.reply;
1795 karg->Status.bStatus = pScsiReply->SCSIStatus;
1796 - karg->Status.uDataBytes = min(le32_to_cpu(pScsiReply->TransferCount),
1797 + karg->Status.uDataBytes
1798 + = min(le32_to_cpu(pScsiReply->TransferCount),
1799 request_data_sz);
1800 - ioc_status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
1801 + ioc_status
1802 + = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
1803
1804 if (pScsiReply->SCSIState ==
1805 MPI_SCSI_STATE_AUTOSENSE_VALID) {
1806 @@ -2701,26 +2698,28 @@ static int csmisas_ssp_passthru(unsigned
1807 CSMI_SAS_SSP_SENSE_DATA_PRESENT;
1808 karg->Status.bResponseLength[0] =
1809 (u8)le32_to_cpu(pScsiReply->SenseCount) & 0xFF;
1810 - memcpy(karg->Status.bResponse,
1811 - ioc->ioctl_cmds.sense, le32_to_cpu(pScsiReply->SenseCount));
1812 + memcpy(karg->Status.bResponse, ioc->ioctl_cmds.sense,
1813 + le32_to_cpu(pScsiReply->SenseCount));
1814
1815 skey = ioc->ioctl_cmds.sense[2] & 0x0F;
1816 asc = ioc->ioctl_cmds.sense[12];
1817 ascq = ioc->ioctl_cmds.sense[13];
1818
1819 - dcsmisasprintk(ioc, printk(KERN_DEBUG "\t [sense_key,asc,ascq]: "
1820 - "[0x%02x,0x%02x,0x%02x]\n",
1821 - skey, asc, ascq));
1822 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1823 + "\t [sense_key,asc,ascq]: "
1824 + "[0x%02x,0x%02x,0x%02x]\n",
1825 + skey, asc, ascq));
1826
1827 - } else if(pScsiReply->SCSIState ==
1828 + } else if (pScsiReply->SCSIState ==
1829 MPI_SCSI_STATE_RESPONSE_INFO_VALID) {
1830 karg->Status.bDataPresent =
1831 CSMI_SAS_SSP_RESPONSE_DATA_PRESENT;
1832 karg->Status.bResponseLength[0] =
1833 sizeof(pScsiReply->ResponseInfo);
1834 - for (ii=0;ii<sizeof(pScsiReply->ResponseInfo);ii++) {
1835 + for (ii = 0; ii < sizeof(pScsiReply->ResponseInfo);
1836 + ii++) {
1837 karg->Status.bResponse[ii] =
1838 - ((u8*)&pScsiReply->ResponseInfo)[
1839 + ((u8 *)&pScsiReply->ResponseInfo)[
1840 (sizeof(pScsiReply->ResponseInfo)-1)-ii];
1841 }
1842 } else if ((ioc_status != MPI_IOCSTATUS_SUCCESS) &&
1843 @@ -2728,7 +2727,8 @@ static int csmisas_ssp_passthru(unsigned
1844 (ioc_status != MPI_IOCSTATUS_SCSI_DATA_UNDERRUN)) {
1845 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1846 dcsmisasprintk(ioc, printk(KERN_DEBUG ": SCSI IO : "));
1847 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X\n",
1848 + dcsmisasprintk(ioc,
1849 + printk("IOCStatus=0x%X IOCLogInfo=0x%X\n",
1850 pScsiReply->IOCStatus,
1851 pScsiReply->IOCLogInfo));
1852 }
1853 @@ -2740,8 +2740,8 @@ static int csmisas_ssp_passthru(unsigned
1854 request_data, karg->Status.uDataBytes)) {
1855 printk(KERN_ERR "%s@%d::%s - "
1856 "Unable to write data to user %p\n",
1857 - __FILE__, __LINE__,__FUNCTION__,
1858 - (void*)karg->bDataBuffer);
1859 + __FILE__, __LINE__, __func__,
1860 + (void *)karg->bDataBuffer);
1861 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1862 }
1863 }
1864 @@ -2759,12 +2759,12 @@ static int csmisas_ssp_passthru(unsigned
1865 offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER, bDataBuffer))) {
1866 printk(KERN_ERR "%s@%d::%s() - "
1867 "Unable to write out csmi_sas_ssp_passthru @ %p\n",
1868 - __FILE__, __LINE__, __FUNCTION__, uarg);
1869 + __FILE__, __LINE__, __func__, uarg);
1870 free_pages((unsigned long)karg, memory_pages);
1871 return -EFAULT;
1872 }
1873
1874 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1875 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1876 free_pages((unsigned long)karg, memory_pages);
1877 return 0;
1878 }
1879 @@ -2793,7 +2793,7 @@ csmisas_stp_passthru(unsigned long arg)
1880 u16 req_idx;
1881 char *psge;
1882 int flagsLength;
1883 - void * request_data;
1884 + void *request_data;
1885 dma_addr_t request_data_dma;
1886 u32 request_data_sz;
1887 int malloc_data_sz;
1888 @@ -2806,14 +2806,15 @@ csmisas_stp_passthru(unsigned long arg)
1889 u16 ioc_status;
1890 u32 MsgContext;
1891
1892 - if (copy_from_user(&karg_hdr, uarg, sizeof(CSMI_SAS_STP_PASSTHRU_BUFFER))) {
1893 + if (copy_from_user(&karg_hdr, uarg,
1894 + sizeof(CSMI_SAS_STP_PASSTHRU_BUFFER))) {
1895 printk(KERN_ERR "%s@%d::%s() - "
1896 "Unable to read struct @ %p\n",
1897 - __FILE__, __LINE__, __FUNCTION__, uarg);
1898 + __FILE__, __LINE__, __func__, uarg);
1899 return -EFAULT;
1900 }
1901
1902 - request_data=NULL;
1903 + request_data = NULL;
1904 request_data_sz = karg_hdr.Parameters.uDataLength;
1905 volume_id = 0;
1906 volume_bus = 0;
1907 @@ -2825,11 +2826,11 @@ csmisas_stp_passthru(unsigned long arg)
1908 memory_pages = get_order(malloc_data_sz);
1909 karg = (CSMI_SAS_STP_PASSTHRU_BUFFER *)__get_free_pages(
1910 GFP_KERNEL, memory_pages);
1911 - if (!karg){
1912 + if (!karg) {
1913 printk(KERN_ERR "%s@%d::%s() - "
1914 "Unable to malloc CSMI_SAS_STP_PASSTHRU_BUFFER "
1915 "malloc_data_sz=%d memory_pages=%d\n",
1916 - __FILE__, __LINE__, __FUNCTION__,
1917 + __FILE__, __LINE__, __func__,
1918 malloc_data_sz, memory_pages);
1919 return -ENOMEM;
1920 }
1921 @@ -2839,7 +2840,7 @@ csmisas_stp_passthru(unsigned long arg)
1922 if (copy_from_user(karg, uarg, malloc_data_sz)) {
1923 printk(KERN_ERR "%s@%d::%s() - "
1924 "Unable to read in csmi_sas_ssp_passthru struct @ %p\n",
1925 - __FILE__, __LINE__, __FUNCTION__, uarg);
1926 + __FILE__, __LINE__, __func__, uarg);
1927 free_pages((unsigned long)karg, memory_pages);
1928 return -EFAULT;
1929 }
1930 @@ -2847,7 +2848,7 @@ csmisas_stp_passthru(unsigned long arg)
1931 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
1932 &ioc)) < 0) || (ioc == NULL)) {
1933 printk(KERN_ERR "%s::%s @%d - ioc%d not found!\n",
1934 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1935 + __FILE__, __func__, __LINE__, iocnum);
1936 free_pages((unsigned long)karg, memory_pages);
1937 return -ENODEV;
1938 }
1939 @@ -2855,19 +2856,19 @@ csmisas_stp_passthru(unsigned long arg)
1940 if (ioc->ioc_reset_in_progress) {
1941 printk(KERN_ERR "%s@%d::%s - "
1942 "Busy with IOC Reset \n",
1943 - __FILE__, __LINE__,__FUNCTION__);
1944 + __FILE__, __LINE__, __func__);
1945 free_pages((unsigned long)karg, memory_pages);
1946 return -EBUSY;
1947 }
1948
1949 if (!csmisas_is_this_sas_cntr(ioc)) {
1950 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1951 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1952 + __FILE__, __func__, __LINE__, iocnum);
1953 free_pages((unsigned long)karg, memory_pages);
1954 return -ENODEV;
1955 }
1956
1957 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1958 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1959
1960 /* Default to success.
1961 */
1962 @@ -2879,8 +2880,9 @@ csmisas_stp_passthru(unsigned long arg)
1963 (karg->Parameters.bPortIdentifier == CSMI_SAS_IGNORE_PORT)) {
1964 karg->IoctlHeader.ReturnCode = CSMI_SAS_SELECT_PHY_OR_PORT;
1965 dcsmisasprintk(ioc, printk(KERN_ERR
1966 - "%s::%s() @%d - incorrect bPhyIdentifier and bPortIdentifier!\n",
1967 - __FILE__,__FUNCTION__, __LINE__));
1968 + "%s::%s() @%d -incorrect bPhyIdentifier"
1969 + " and bPortIdentifier!\n",
1970 + __FILE__, __func__, __LINE__));
1971 goto cim_stp_passthru_exit;
1972 }
1973
1974 @@ -2897,15 +2899,15 @@ csmisas_stp_passthru(unsigned long arg)
1975 }
1976
1977 data_sz = sizeof(CSMI_SAS_STP_PASSTHRU_BUFFER) -
1978 - sizeof(IOCTL_HEADER) - sizeof(u8*) +
1979 + sizeof(IOCTL_HEADER) - sizeof(u8 *) +
1980 request_data_sz;
1981
1982 - if ( data_sz > karg->IoctlHeader.Length ) {
1983 + if (data_sz > karg->IoctlHeader.Length) {
1984 karg->IoctlHeader.ReturnCode =
1985 CSMI_SAS_STATUS_INVALID_PARAMETER;
1986 dcsmisasprintk(ioc, printk(KERN_ERR
1987 "%s::%s() @%d - expected datalen incorrect!\n",
1988 - __FILE__, __FUNCTION__,__LINE__));
1989 + __FILE__, __func__, __LINE__));
1990 goto cim_stp_passthru_exit;
1991 }
1992
1993 @@ -2927,7 +2929,7 @@ csmisas_stp_passthru(unsigned long arg)
1994 CSMI_SAS_STATUS_INVALID_PARAMETER;
1995 dcsmisasprintk(ioc, printk(KERN_ERR
1996 "%s::%s() @%d - couldn't find associated "
1997 - "SASAddress=%llX!\n", __FILE__, __FUNCTION__, __LINE__,
1998 + "SASAddress=%llX!\n", __FILE__, __func__, __LINE__,
1999 (unsigned long long)sas_address));
2000 goto cim_stp_passthru_exit;
2001 }
2002 @@ -2937,8 +2939,8 @@ csmisas_stp_passthru(unsigned long arg)
2003
2004 /* check that this is an STP or SATA target device
2005 */
2006 - if ( !(sas_info->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET ) &&
2007 - !(sas_info->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE )) {
2008 + if (!(sas_info->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET) &&
2009 + !(sas_info->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE)) {
2010 karg->IoctlHeader.ReturnCode =
2011 CSMI_SAS_STATUS_INVALID_PARAMETER;
2012 goto cim_stp_passthru_exit;
2013 @@ -2950,14 +2952,14 @@ csmisas_stp_passthru(unsigned long arg)
2014 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
2015 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2016 goto cim_stp_passthru_exit;
2017 - }
2018 + }
2019
2020 mpi_hdr = (MPIHeader_t *) mf;
2021 MsgContext = mpi_hdr->MsgContext;
2022 pSataRequest = (pSataPassthroughRequest_t) mf;
2023 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
2024
2025 - memset(pSataRequest,0,sizeof(pSataPassthroughRequest_t));
2026 + memset(pSataRequest, 0, sizeof(pSataPassthroughRequest_t));
2027
2028 pSataRequest->TargetID = id;
2029 pSataRequest->Bus = channel;
2030 @@ -2967,16 +2969,16 @@ csmisas_stp_passthru(unsigned long arg)
2031 pSataRequest->MsgContext = MsgContext;
2032 pSataRequest->DataLength = cpu_to_le32(request_data_sz);
2033 pSataRequest->MsgFlags = 0;
2034 - memcpy( pSataRequest->CommandFIS,karg->Parameters.bCommandFIS, 20);
2035 + memcpy(pSataRequest->CommandFIS, karg->Parameters.bCommandFIS, 20);
2036
2037 psge = (char *)&pSataRequest->SGL;
2038 if (karg->Parameters.uFlags & CSMI_SAS_STP_WRITE) {
2039 flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE;
2040 } else if (karg->Parameters.uFlags & CSMI_SAS_STP_READ) {
2041 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ;
2042 - }else {
2043 - flagsLength = ( MPI_SGE_FLAGS_SIMPLE_ELEMENT |
2044 - MPI_SGE_FLAGS_DIRECTION )
2045 + } else {
2046 + flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
2047 + MPI_SGE_FLAGS_DIRECTION)
2048 << MPI_SGE_FLAGS_SHIFT;
2049 }
2050
2051 @@ -2986,7 +2988,8 @@ csmisas_stp_passthru(unsigned long arg)
2052 ioc->pcidev, request_data_sz, &request_data_dma);
2053
2054 if (request_data == NULL) {
2055 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
2056 + dcsmisasprintk(ioc, printk(KERN_ERR
2057 + ": pci_alloc_consistent: FAILED\n"));
2058 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2059 mpt_free_msg_frame(ioc, mf);
2060 goto cim_stp_passthru_exit;
2061 @@ -2994,33 +2997,37 @@ csmisas_stp_passthru(unsigned long arg)
2062
2063 ioc->add_sge(psge, flagsLength, request_data_dma);
2064 if (karg->Parameters.uFlags & CSMI_SAS_SSP_WRITE)
2065 - memcpy(request_data, karg->bDataBuffer, request_data_sz);
2066 + memcpy(request_data, karg->bDataBuffer,
2067 + request_data_sz);
2068 } else {
2069 ioc->add_sge(psge, flagsLength, (dma_addr_t) -1);
2070 }
2071
2072 - if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout) != 0) {
2073 + if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout)
2074 + != 0) {
2075 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2076 goto cim_stp_passthru_exit;
2077 }
2078
2079 - memset(&karg->Status,0,sizeof(CSMI_SAS_STP_PASSTHRU_STATUS));
2080 + memset(&karg->Status, 0, sizeof(CSMI_SAS_STP_PASSTHRU_STATUS));
2081
2082 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
2083 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": STP Passthru: oh no, there is no reply!!"));
2084 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2085 + ": STP Passthru: oh no, there is no reply!!"));
2086 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2087 goto cim_stp_passthru_exit;
2088 }
2089
2090 /* process the completed Reply Message Frame */
2091 - pSataReply = (pSataPassthroughReply_t ) ioc->ioctl_cmds.reply;
2092 + pSataReply = (pSataPassthroughReply_t) ioc->ioctl_cmds.reply;
2093 ioc_status = le16_to_cpu(pSataReply->IOCStatus) & MPI_IOCSTATUS_MASK;
2094
2095 if (ioc_status != MPI_IOCSTATUS_SUCCESS &&
2096 ioc_status != MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) {
2097 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2098 dcsmisasprintk(ioc, printk(KERN_DEBUG ": STP Passthru: "));
2099 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
2100 + dcsmisasprintk(ioc,
2101 + printk("IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
2102 le16_to_cpu(pSataReply->IOCStatus),
2103 le32_to_cpu(pSataReply->IOCLogInfo),
2104 pSataReply->SASStatus));
2105 @@ -3029,26 +3036,27 @@ csmisas_stp_passthru(unsigned long arg)
2106 karg->Status.bConnectionStatus =
2107 map_sas_status_to_csmi(pSataReply->SASStatus);
2108
2109 - memcpy(karg->Status.bStatusFIS,pSataReply->StatusFIS, 20);
2110 + memcpy(karg->Status.bStatusFIS, pSataReply->StatusFIS, 20);
2111
2112 /*
2113 * for now, just zero out uSCR array,
2114 * then copy the one dword returned
2115 * in the reply frame into uSCR[0]
2116 */
2117 - memset( karg->Status.uSCR, 0, 64);
2118 + memset(karg->Status.uSCR, 0, 64);
2119 karg->Status.uSCR[0] = le32_to_cpu(pSataReply->StatusControlRegisters);
2120
2121 - if((le32_to_cpu(pSataReply->TransferCount)) && (request_data) &&
2122 + if ((le32_to_cpu(pSataReply->TransferCount)) && (request_data) &&
2123 (karg->Parameters.uFlags & CSMI_SAS_STP_READ)) {
2124 karg->Status.uDataBytes =
2125 - min(le32_to_cpu(pSataReply->TransferCount),request_data_sz);
2126 + min(le32_to_cpu(pSataReply->TransferCount),
2127 + request_data_sz);
2128 if (copy_to_user((void __user *)uarg->bDataBuffer,
2129 request_data, karg->Status.uDataBytes)) {
2130 printk(KERN_ERR "%s::%s() @%d - "
2131 "Unable to write data to user %p\n",
2132 - __FILE__, __FUNCTION__, __LINE__,
2133 - (void*)karg->bDataBuffer);
2134 + __FILE__, __func__, __LINE__,
2135 + (void *)karg->bDataBuffer);
2136 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2137 }
2138 }
2139 @@ -3065,13 +3073,13 @@ csmisas_stp_passthru(unsigned long arg)
2140 offsetof(CSMI_SAS_STP_PASSTHRU_BUFFER, bDataBuffer))) {
2141 printk(KERN_ERR "%s@%d::%s() - "
2142 "Unable to write out csmi_sas_ssp_passthru @ %p\n",
2143 - __FILE__, __LINE__, __FUNCTION__, uarg);
2144 + __FILE__, __LINE__, __func__, uarg);
2145 free_pages((unsigned long)karg, memory_pages);
2146 return -EFAULT;
2147 }
2148
2149 free_pages((unsigned long)karg, memory_pages);
2150 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n",__FUNCTION__));
2151 + dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n", __func__));
2152 return 0;
2153 }
2154
2155 @@ -3090,30 +3098,30 @@ csmisas_firmware_download(unsigned long
2156 CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER karg;
2157 MPT_ADAPTER *ioc = NULL;
2158 int iocnum;
2159 - pMpiFwHeader_t pFwHeader=NULL;
2160 + pMpiFwHeader_t pFwHeader = NULL;
2161
2162 if (copy_from_user(&karg, uarg,
2163 sizeof(CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER))) {
2164 printk(KERN_ERR "%s@%d::%s() - "
2165 - "Unable to read in csmi_sas_firmware_download struct @ %p\n",
2166 - __FILE__, __LINE__, __FUNCTION__, uarg);
2167 + "Unable to read in csmi_sas_firmware_download struct@ %p\n",
2168 + __FILE__, __LINE__, __func__, uarg);
2169 return -EFAULT;
2170 }
2171
2172 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
2173 &ioc)) < 0) || (ioc == NULL)) {
2174 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2175 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2176 + __FILE__, __func__, __LINE__, iocnum);
2177 return -ENODEV;
2178 }
2179
2180 if (!csmisas_is_this_sas_cntr(ioc)) {
2181 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2182 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2183 + __FILE__, __func__, __LINE__, iocnum);
2184 return -ENODEV;
2185 }
2186
2187 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2188 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2189
2190 /* Default to success.*/
2191 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
2192 @@ -3130,7 +3138,7 @@ csmisas_firmware_download(unsigned long
2193 goto cim_firmware_download_exit;
2194 }
2195
2196 - if ( karg.Information.uDownloadFlags &
2197 + if (karg.Information.uDownloadFlags &
2198 (CSMI_SAS_FWD_SOFT_RESET | CSMI_SAS_FWD_VALIDATE)) {
2199 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2200 karg.Information.usStatus = CSMI_SAS_FWD_REJECT;
2201 @@ -3142,7 +3150,7 @@ csmisas_firmware_download(unsigned long
2202 * fw image attached to end of incoming packet.
2203 */
2204 pFwHeader = kmalloc(karg.Information.uBufferLength, GFP_KERNEL);
2205 - if (!pFwHeader){
2206 + if (!pFwHeader) {
2207 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2208 karg.Information.usStatus = CSMI_SAS_FWD_REJECT;
2209 karg.Information.usSeverity = CSMI_SAS_FWD_ERROR;
2210 @@ -3154,21 +3162,21 @@ csmisas_firmware_download(unsigned long
2211 karg.Information.uBufferLength)) {
2212 printk(KERN_ERR "%s@%d::%s() - "
2213 "Unable to read in pFwHeader @ %p\n",
2214 - __FILE__, __LINE__, __FUNCTION__, uarg);
2215 + __FILE__, __LINE__, __func__, uarg);
2216 return -EFAULT;
2217 }
2218
2219 - if ( !((pFwHeader->Signature0 == MPI_FW_HEADER_SIGNATURE_0) &&
2220 + if (!((pFwHeader->Signature0 == MPI_FW_HEADER_SIGNATURE_0) &&
2221 (pFwHeader->Signature1 == MPI_FW_HEADER_SIGNATURE_1) &&
2222 (pFwHeader->Signature2 == MPI_FW_HEADER_SIGNATURE_2))) {
2223 - // the signature check failed
2224 + /* the signature check failed */
2225 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2226 karg.Information.usStatus = CSMI_SAS_FWD_REJECT;
2227 karg.Information.usSeverity = CSMI_SAS_FWD_ERROR;
2228 goto cim_firmware_download_exit;
2229 }
2230
2231 - if ( mptctl_do_fw_download(karg.IoctlHeader.IOControllerNumber,
2232 + if (mptctl_do_fw_download(karg.IoctlHeader.IOControllerNumber,
2233 uarg->bDataBuffer, karg.Information.uBufferLength)
2234 != 0) {
2235 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2236 @@ -3177,7 +3185,7 @@ csmisas_firmware_download(unsigned long
2237 goto cim_firmware_download_exit;
2238 }
2239
2240 - if((karg.Information.uDownloadFlags & CSMI_SAS_FWD_SOFT_RESET) ||
2241 + if ((karg.Information.uDownloadFlags & CSMI_SAS_FWD_SOFT_RESET) ||
2242 (karg.Information.uDownloadFlags & CSMI_SAS_FWD_HARD_RESET)) {
2243 if (mpt_HardResetHandler(ioc, CAN_SLEEP) != 0) {
2244 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2245 @@ -3188,7 +3196,7 @@ csmisas_firmware_download(unsigned long
2246
2247 cim_firmware_download_exit:
2248
2249 - if(pFwHeader)
2250 + if (pFwHeader)
2251 kfree(pFwHeader);
2252
2253 /* Copy the data from kernel memory to user memory
2254 @@ -3197,11 +3205,11 @@ csmisas_firmware_download(unsigned long
2255 sizeof(CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER))) {
2256 printk(KERN_ERR "%s@%d::%s() - "
2257 "Unable to write out csmi_sas_firmware_download @ %p\n",
2258 - __FILE__, __LINE__, __FUNCTION__, uarg);
2259 + __FILE__, __LINE__, __func__, uarg);
2260 return -EFAULT;
2261 }
2262
2263 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2264 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2265 return 0;
2266 }
2267
2268 @@ -3227,24 +3235,24 @@ csmisas_get_raid_info(unsigned long arg)
2269 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_RAID_INFO_BUFFER))) {
2270 printk(KERN_ERR "%s@%d::%s() - "
2271 "Unable to read in csmi_sas_get_raid_info struct @ %p\n",
2272 - __FILE__, __LINE__, __FUNCTION__, uarg);
2273 + __FILE__, __LINE__, __func__, uarg);
2274 return -EFAULT;
2275 }
2276
2277 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
2278 &ioc)) < 0) || (ioc == NULL)) {
2279 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2280 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2281 + __FILE__, __func__, __LINE__, iocnum);
2282 return -ENODEV;
2283 }
2284
2285 if (!csmisas_is_this_sas_cntr(ioc)) {
2286 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2287 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2288 + __FILE__, __func__, __LINE__, iocnum);
2289 return -ENODEV;
2290 }
2291
2292 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2293 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2294
2295 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2296 if (!ioc->raid_data.pIocPg2)
2297 @@ -3252,8 +3260,8 @@ csmisas_get_raid_info(unsigned long arg)
2298 karg.Information.uNumRaidSets =
2299 ioc->raid_data.pIocPg2->NumActiveVolumes;
2300 karg.Information.uMaxRaidSets = ioc->raid_data.pIocPg2->MaxVolumes;
2301 - if( ioc->raid_data.pIocPg6 ) {
2302 - // get absolute maximum for all RAID sets
2303 + if (ioc->raid_data.pIocPg6) {
2304 + /* get absolute maximum for all RAID sets */
2305 maxDrivesPerSet = ioc->raid_data.pIocPg6->MaxDrivesIS;
2306 maxDrivesPerSet = max(ioc->raid_data.pIocPg6->MaxDrivesIM,
2307 maxDrivesPerSet);
2308 @@ -3263,17 +3271,19 @@ csmisas_get_raid_info(unsigned long arg)
2309 }
2310 else
2311 karg.Information.uMaxDrivesPerSet = 8;
2312 - // For bMaxRaidSets, count bits set in bits 0-6 of CapabilitiesFlags
2313 + /* For bMaxRaidSets, count bits set in bits 0-6 of CapabilitiesFlags */
2314 raidFlags = ioc->raid_data.pIocPg2->CapabilitiesFlags & 0x0000007F;
2315 - for( maxRaidTypes=0; raidFlags; maxRaidTypes++ )
2316 + for (maxRaidTypes = 0; raidFlags; maxRaidTypes++)
2317 raidFlags &= raidFlags - 1;
2318 karg.Information.bMaxRaidTypes = maxRaidTypes;
2319 - // ulMinRaidSetBlocks hard coded to 1MB until available from config page
2320 + /* ulMinRaidSetBlocks hard coded to 1MB until available
2321 + * from config page
2322 + */
2323 karg.Information.ulMinRaidSetBlocks.uLowPart = 2048;
2324 karg.Information.ulMinRaidSetBlocks.uHighPart = 0;
2325 karg.Information.ulMaxRaidSetBlocks.uLowPart = 0xffffffff;
2326 - if( ioc->raid_data.pIocPg2->CapabilitiesFlags &
2327 - MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING )
2328 + if (ioc->raid_data.pIocPg2->CapabilitiesFlags &
2329 + MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING)
2330 karg.Information.ulMaxRaidSetBlocks.uHighPart = 0xffffffff;
2331 else
2332 karg.Information.ulMaxRaidSetBlocks.uHighPart = 0;
2333 @@ -3293,11 +3303,11 @@ csmisas_get_raid_info_out:
2334 sizeof(CSMI_SAS_RAID_INFO_BUFFER))) {
2335 printk(KERN_ERR "%s@%d::%s() - "
2336 "Unable to write out csmi_sas_get_raid_info @ %p\n",
2337 - __FILE__, __LINE__, __FUNCTION__, uarg);
2338 + __FILE__, __LINE__, __func__, uarg);
2339 return -EFAULT;
2340 }
2341
2342 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2343 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2344 return 0;
2345 }
2346
2347 @@ -3315,7 +3325,8 @@ csmisas_get_raid_info_out:
2348 * Remark: Wait to return until reply processed by the ISR.
2349 **/
2350 static int
2351 -csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum, u8 VolumeBus, u8 VolumeId, pMpiRaidActionReply_t reply)
2352 +csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum, u8 VolumeBus,
2353 + u8 VolumeId, pMpiRaidActionReply_t reply)
2354 {
2355 MpiRaidActionRequest_t *pReq;
2356 MpiRaidActionReply_t *pReply;
2357 @@ -3338,7 +3349,6 @@ csmisas_do_raid(MPT_ADAPTER *ioc, u8 act
2358 pReq->MsgFlags = 0;
2359 pReq->Reserved2 = 0;
2360 pReq->ActionDataWord = 0; /* Reserved for this action */
2361 - //pReq->ActionDataSGE = 0;
2362
2363 ioc->add_sge((char *)&pReq->ActionDataSGE,
2364 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
2365 @@ -3347,7 +3357,7 @@ csmisas_do_raid(MPT_ADAPTER *ioc, u8 act
2366 return -ENODATA;
2367
2368 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) &&
2369 - (reply != NULL)){
2370 + (reply != NULL)) {
2371 pReply = (MpiRaidActionReply_t *)&(ioc->ioctl_cmds.reply);
2372 memcpy(reply, pReply,
2373 min(ioc->reply_sz,
2374 @@ -3371,7 +3381,7 @@ csmisas_do_raid(MPT_ADAPTER *ioc, u8 act
2375 **/
2376 static int
2377 csmisas_raid_inq(MPT_ADAPTER *ioc, u8 opcode, u8 bus, u8 id, u8 inq_vpd_page,
2378 - u8 * inq_vpd, u32 inq_vpd_sz)
2379 + u8 *inq_vpd, u32 inq_vpd_sz)
2380 {
2381 MPT_FRAME_HDR *mf = NULL;
2382 MPIHeader_t *mpi_hdr;
2383 @@ -3379,7 +3389,7 @@ csmisas_raid_inq(MPT_ADAPTER *ioc, u8 op
2384 u16 req_idx;
2385 char *psge;
2386 u8 inq_vpd_cdb[6];
2387 - u8 *request_data=NULL;
2388 + u8 *request_data = NULL;
2389 dma_addr_t request_data_dma;
2390 u32 request_data_sz;
2391 int rc = 0;
2392 @@ -3409,14 +3419,14 @@ csmisas_raid_inq(MPT_ADAPTER *ioc, u8 op
2393 pScsiRequest = (pSCSIIORequest_t) mf;
2394 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
2395
2396 - memset(pScsiRequest,0,sizeof(SCSIIORequest_t));
2397 + memset(pScsiRequest, 0, sizeof(SCSIIORequest_t));
2398 pScsiRequest->Function = opcode;
2399 pScsiRequest->TargetID = id;
2400 pScsiRequest->Bus = bus;
2401 pScsiRequest->CDBLength = 6;
2402 pScsiRequest->DataLength = cpu_to_le32(request_data_sz);
2403 pScsiRequest->MsgContext = MsgContext;
2404 - memcpy(pScsiRequest->CDB,inq_vpd_cdb,pScsiRequest->CDBLength);
2405 + memcpy(pScsiRequest->CDB, inq_vpd_cdb, pScsiRequest->CDBLength);
2406 pScsiRequest->Control = cpu_to_le32(MPI_SCSIIO_CONTROL_READ);
2407 pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_SIMPLEQ);
2408 pScsiRequest->MsgFlags &= ~MPI_SCSIIO_MSGFLGS_SENSE_WIDTH;
2409 @@ -3434,17 +3444,18 @@ csmisas_raid_inq(MPT_ADAPTER *ioc, u8 op
2410
2411 if (request_data == NULL) {
2412 mpt_free_msg_frame(ioc, mf);
2413 - rc=-1;
2414 + rc = -1;
2415 goto csmisas_raid_inq_exit;
2416 }
2417
2418 - memset(request_data,0,request_data_sz);
2419 + memset(request_data, 0, request_data_sz);
2420 psge = (char *)&pScsiRequest->SGL;
2421 ioc->add_sge(psge, (MPT_SGE_FLAGS_SSIMPLE_READ | 0xFC) ,
2422 request_data_dma);
2423
2424 - if (csmisas_send_command_wait(ioc, mf, MPT_IOCTL_DEFAULT_TIMEOUT) != 0) {
2425 - rc=-1;
2426 + if (csmisas_send_command_wait(ioc, mf, MPT_IOCTL_DEFAULT_TIMEOUT)
2427 + != 0) {
2428 + rc = -1;
2429 goto csmisas_raid_inq_exit;
2430 }
2431
2432 @@ -3472,7 +3483,7 @@ static int
2433 csmisas_get_raid_config(unsigned long arg)
2434 {
2435 CSMI_SAS_RAID_CONFIG_BUFFER __user *uarg = (void __user *) arg;
2436 - CSMI_SAS_RAID_CONFIG_BUFFER karg,*pKarg=NULL;
2437 + CSMI_SAS_RAID_CONFIG_BUFFER karg, *pKarg = NULL;
2438 CONFIGPARMS cfg;
2439 ConfigPageHeader_t header;
2440 MPT_ADAPTER *ioc = NULL;
2441 @@ -3498,7 +3509,7 @@ csmisas_get_raid_config(unsigned long ar
2442 if (copy_from_user(&karg, uarg, sizeof(IOCTL_HEADER))) {
2443 printk(KERN_ERR "%s@%d::%s() - "
2444 "Unable to read in csmisas_get_raid_config struct @ %p\n",
2445 - __FILE__, __LINE__, __FUNCTION__, uarg);
2446 + __FILE__, __LINE__, __func__, uarg);
2447 return -EFAULT;
2448 }
2449
2450 @@ -3506,11 +3517,11 @@ csmisas_get_raid_config(unsigned long ar
2451 memory_pages = get_order(csmi_sas_raid_config_buffer_sz);
2452 pKarg = (CSMI_SAS_RAID_CONFIG_BUFFER *)__get_free_pages(
2453 GFP_KERNEL, memory_pages);
2454 - if (!pKarg){
2455 + if (!pKarg) {
2456 printk(KERN_ERR "%s@%d::%s() - "
2457 "Unable to malloc RAID_CONFIG_BUFFER "
2458 "csmi_sas_raid_config_buffer_sz=%d memory_pages=%d\n",
2459 - __FILE__, __LINE__, __FUNCTION__,
2460 + __FILE__, __LINE__, __func__,
2461 csmi_sas_raid_config_buffer_sz, memory_pages);
2462 return -ENOMEM;
2463 }
2464 @@ -3519,7 +3530,7 @@ csmisas_get_raid_config(unsigned long ar
2465 if (copy_from_user(pKarg, uarg, csmi_sas_raid_config_buffer_sz)) {
2466 printk(KERN_ERR "%s@%d::%s() - "
2467 "Unable to read in csmisas_get_raid_config struct @ %p\n",
2468 - __FILE__, __LINE__, __FUNCTION__, uarg);
2469 + __FILE__, __LINE__, __func__, uarg);
2470 free_pages((unsigned long)pKarg, memory_pages);
2471 return -EFAULT;
2472 }
2473 @@ -3527,22 +3538,22 @@ csmisas_get_raid_config(unsigned long ar
2474 if (((iocnum = mpt_verify_adapter(pKarg->IoctlHeader.IOControllerNumber,
2475 &ioc)) < 0) || (ioc == NULL)) {
2476 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2477 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2478 + __FILE__, __func__, __LINE__, iocnum);
2479 free_pages((unsigned long)pKarg, memory_pages);
2480 return -ENODEV;
2481 }
2482
2483 if (!csmisas_is_this_sas_cntr(ioc)) {
2484 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2485 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2486 + __FILE__, __func__, __LINE__, iocnum);
2487 free_pages((unsigned long)pKarg, memory_pages);
2488 return -ENODEV;
2489 }
2490
2491 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2492 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2493
2494 if (pKarg->Configuration.uChangeCount != 0 &&
2495 - pKarg->Configuration.uChangeCount != ioc->csmi_change_count ) {
2496 + pKarg->Configuration.uChangeCount != ioc->csmi_change_count) {
2497 pKarg->IoctlHeader.ReturnCode =
2498 CSMI_SAS_STATUS_INVALID_PARAMETER;
2499 pKarg->Configuration.uFailureCode =
2500 @@ -3615,7 +3626,7 @@ csmisas_get_raid_config(unsigned long ar
2501 pKarg->Configuration.uStripeSize =
2502 le32_to_cpu(pVolume0->StripeSize)/2;
2503
2504 - switch(pVolume0->VolumeType) {
2505 + switch (pVolume0->VolumeType) {
2506 case MPI_RAID_VOL_TYPE_IS:
2507 pKarg->Configuration.bRaidType = CSMI_SAS_RAID_TYPE_0;
2508 break;
2509 @@ -3636,7 +3647,8 @@ csmisas_get_raid_config(unsigned long ar
2510 break;
2511 case MPI_RAIDVOL0_STATUS_STATE_DEGRADED:
2512 /* Volume is degraded, check if Resyncing or Inactive */
2513 - pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_DEGRADED;
2514 + pKarg->Configuration.bStatus
2515 + = CSMI_SAS_RAID_SET_STATUS_DEGRADED;
2516 break;
2517 case MPI_RAIDVOL0_STATUS_STATE_FAILED:
2518 pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_FAILED;
2519 @@ -3649,25 +3661,26 @@ csmisas_get_raid_config(unsigned long ar
2520 pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_OFFLINE;
2521 else if (pVolume0->VolumeStatus.Flags &
2522 MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS)
2523 - pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_REBUILDING;
2524 + pKarg->Configuration.bStatus
2525 + = CSMI_SAS_RAID_SET_STATUS_REBUILDING;
2526
2527 pKarg->Configuration.bInformation = 0; /* default */
2528 - if(pVolume0->VolumeStatus.Flags &
2529 - MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS ) {
2530 + if (pVolume0->VolumeStatus.Flags &
2531 + MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) {
2532
2533 - uint64_t * ptrUint64;
2534 + uint64_t *ptrUint64;
2535 uint64_t totalBlocks64, blocksRemaining64;
2536 uint32_t totalBlocks32, blocksRemaining32;
2537
2538 /* get percentage complete */
2539 - pRaidActionReply = kmalloc( sizeof(MPI_RAID_VOL_INDICATOR) +
2540 - offsetof(MSG_RAID_ACTION_REPLY,ActionData),
2541 + pRaidActionReply = kmalloc(sizeof(MPI_RAID_VOL_INDICATOR) +
2542 + offsetof(MSG_RAID_ACTION_REPLY, ActionData),
2543 GFP_KERNEL);
2544
2545 - if (!pRaidActionReply){
2546 + if (!pRaidActionReply) {
2547 printk(KERN_ERR "%s@%d::%s() - "
2548 "Unable to malloc @ %p\n",
2549 - __FILE__, __LINE__, __FUNCTION__,pKarg);
2550 + __FILE__, __LINE__, __func__, pKarg);
2551 goto cim_get_raid_config_exit;
2552 }
2553 memset(pRaidActionReply, 0, sizeof(*pRaidActionReply));
2554 @@ -3680,14 +3693,14 @@ csmisas_get_raid_config(unsigned long ar
2555 totalBlocks64 = *ptrUint64;
2556 ptrUint64++;
2557 blocksRemaining64 = *ptrUint64;
2558 - while(totalBlocks64 > 0xFFFFFFFFUL){
2559 + while (totalBlocks64 > 0xFFFFFFFFUL) {
2560 totalBlocks64 = totalBlocks64 >> 1;
2561 blocksRemaining64 = blocksRemaining64 >> 1;
2562 }
2563 totalBlocks32 = (uint32_t)totalBlocks64;
2564 blocksRemaining32 = (uint32_t)blocksRemaining64;
2565
2566 - if(totalBlocks32)
2567 + if (totalBlocks32)
2568 pKarg->Configuration.bInformation =
2569 (totalBlocks32 - blocksRemaining32) /
2570 (totalBlocks32 / 100);
2571 @@ -3713,15 +3726,14 @@ csmisas_get_raid_config(unsigned long ar
2572 pKarg->Configuration.Data->ulRaidSetBlocks.uHighPart =
2573 le32_to_cpu(pVolume0->MaxLBAHigh);
2574 if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IS ||
2575 - pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME ) {
2576 + pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME) {
2577 pKarg->Configuration.Data->uStripeSizeInBlocks =
2578 le32_to_cpu(pVolume0->StripeSize);
2579 } else {
2580 pKarg->Configuration.Data->uStripeSizeInBlocks = 0;
2581 }
2582 pKarg->Configuration.Data->uSectorsPerTrack = 128;
2583 - for (i=0; i<16; i++) {
2584 - // unsupported
2585 + for (i = 0; i < 16; i++) {
2586 pKarg->Configuration.Data->bApplicationScratchPad[i] =
2587 0xFF;
2588 }
2589 @@ -3732,15 +3744,15 @@ csmisas_get_raid_config(unsigned long ar
2590 (pKarg->Configuration.Data->uNumberOfHeads *
2591 pKarg->Configuration.Data->uSectorsPerTrack));
2592 pKarg->Configuration.Data->uNumberOfTracks = tmpTotalMaxLBA;
2593 - } else if ( pKarg->Configuration.bDataType ==
2594 - CSMI_SAS_RAID_DATA_DEVICE_ID ) {
2595 + } else if (pKarg->Configuration.bDataType ==
2596 + CSMI_SAS_RAID_DATA_DEVICE_ID) {
2597 /* Send inquiry to get VPD Page 0x83 */
2598 u32 vpd_page_sz;
2599 vpd_page_sz = csmi_sas_raid_config_buffer_sz -
2600 - offsetof(CSMI_SAS_RAID_CONFIG,DeviceId);
2601 + offsetof(CSMI_SAS_RAID_CONFIG, DeviceId);
2602 if (csmisas_raid_inq(ioc, MPI_FUNCTION_SCSI_IO_REQUEST,
2603 VolumeBus, volumeID, 0x83,
2604 - (u8*)&pKarg->Configuration.DeviceId->bDeviceIdentificationVPDPage,
2605 + (u8 *)&pKarg->Configuration.DeviceId->bDeviceIdentificationVPDPage,
2606 vpd_page_sz) != 0) {
2607 pKarg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2608 goto cim_get_raid_config_exit;
2609 @@ -3773,7 +3785,7 @@ csmisas_get_raid_config(unsigned long ar
2610 pIocPage5 = pci_alloc_consistent(ioc->pcidev,
2611 ioc_page5_sz,
2612 &ioc_page5_dma);
2613 - memset(pIocPage5,0,ioc_page5_sz);
2614 + memset(pIocPage5, 0, ioc_page5_sz);
2615 if (ioc_page5_dma) {
2616 cfg.physAddr = ioc_page5_dma;
2617 cfg.action =
2618 @@ -3816,52 +3828,55 @@ csmisas_get_raid_config(unsigned long ar
2619 cfg.physAddr = physdisk0_dma;
2620
2621 physDiskNumMax = (csmi_sas_raid_config_buffer_sz -
2622 - offsetof(CSMI_SAS_RAID_CONFIG,Drives))
2623 + offsetof(CSMI_SAS_RAID_CONFIG, Drives))
2624 / sizeof(CSMI_SAS_RAID_DRIVES);
2625
2626 tmpTotalMaxLBA = totalMaxLBA;
2627 if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IS) {
2628 do_div(tmpTotalMaxLBA, pVolume0->NumPhysDisks);
2629 - dcsmisasprintk(ioc, printk(KERN_DEBUG "IS Volume tmpTotalMaxLBA=%llX\n",
2630 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2631 + "IS Volume tmpTotalMaxLBA=%llX\n",
2632 (unsigned long long)tmpTotalMaxLBA));
2633 - }
2634 - else if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME) {
2635 + } else if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME) {
2636 do_div(tmpTotalMaxLBA, pVolume0->NumPhysDisks * 2);
2637 - dcsmisasprintk(ioc, printk(KERN_DEBUG "IME Volume tmpTotalMaxLBA=%llX\n",
2638 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2639 + "IME Volume tmpTotalMaxLBA=%llX\n",
2640 (unsigned long long)tmpTotalMaxLBA));
2641 } else {
2642 - dcsmisasprintk(ioc, printk(KERN_DEBUG "IM Volume tmpTotalMaxLBA=%llX\n",
2643 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2644 + "IM Volume tmpTotalMaxLBA=%llX\n",
2645 (unsigned long long)tmpTotalMaxLBA));
2646 }
2647
2648 - for (i=0; i< min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
2649 + for (i = 0; i < min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
2650
2651 physDiskNum = pVolume0->PhysDisk[i].PhysDiskNum;
2652 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
2653 cfg.pageAddr = physDiskNum;
2654 - if (mpt_config(ioc, &cfg) != 0){
2655 + if (mpt_config(ioc, &cfg) != 0) {
2656 pKarg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2657 goto cim_get_raid_config_exit;
2658 }
2659
2660 - pKarg->Configuration.bDriveCount++;
2661 + pKarg->Configuration.bDriveCount++;
2662 if (pKarg->Configuration.bDataType != CSMI_SAS_RAID_DATA_DRIVES)
2663 continue;
2664
2665 /* Search the list for the matching SAS address. */
2666 - sas_info = csmisas_get_device_component_by_fw(ioc, pPhysDisk0->PhysDiskBus,
2667 - pPhysDisk0->PhysDiskID);
2668 + sas_info = csmisas_get_device_component_by_fw(ioc,
2669 + pPhysDisk0->PhysDiskBus, pPhysDisk0->PhysDiskID);
2670 if (sas_info) {
2671 - sas_address = reverse_byte_order64(sas_info->sas_address);
2672 + sas_address
2673 + = reverse_byte_order64(sas_info->sas_address);
2674 memcpy(pKarg->Configuration.Drives[i].bSASAddress,
2675 - &sas_address,sizeof(u64));
2676 + &sas_address, sizeof(u64));
2677 if (!device_info)
2678 device_info = sas_info->device_info;
2679 }
2680
2681 memcpy(pKarg->Configuration.Drives[i].bModel,
2682 pPhysDisk0->InquiryData.VendorID,
2683 - offsetof(RAID_PHYS_DISK0_INQUIRY_DATA,ProductRevLevel));
2684 + offsetof(RAID_PHYS_DISK0_INQUIRY_DATA, ProductRevLevel));
2685 memcpy(pKarg->Configuration.Drives[i].bFirmware,
2686 pPhysDisk0->InquiryData.ProductRevLevel,
2687 sizeof(pPhysDisk0->InquiryData.ProductRevLevel));
2688 @@ -3890,19 +3905,19 @@ csmisas_get_raid_config(unsigned long ar
2689 MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED) {
2690 pKarg->Configuration.Drives[i].bDriveStatus =
2691 CSMI_SAS_DRIVE_STATUS_OFFLINE;
2692 - } else if(pPhysDisk0->PhysDiskStatus.State) {
2693 + } else if (pPhysDisk0->PhysDiskStatus.State) {
2694 pKarg->Configuration.Drives[i].bDriveStatus =
2695 CSMI_SAS_DRIVE_STATUS_FAILED;
2696 - if(pKarg->Configuration.bStatus ==
2697 + if (pKarg->Configuration.bStatus ==
2698 CSMI_SAS_RAID_SET_STATUS_DEGRADED)
2699 pKarg->Configuration.bInformation = i;
2700 - } else if((pVolume0->VolumeStatus.Flags &
2701 + } else if ((pVolume0->VolumeStatus.Flags &
2702 MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) &&
2703 (pPhysDisk0->PhysDiskStatus.Flags &
2704 MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC))
2705 pKarg->Configuration.Drives[i].bDriveStatus =
2706 CSMI_SAS_DRIVE_STATUS_REBUILDING;
2707 - else if(pPhysDisk0->ErrorData.SmartCount ||
2708 + else if (pPhysDisk0->ErrorData.SmartCount ||
2709 (pPhysDisk0->PhysDiskStatus.Flags &
2710 MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC))
2711 pKarg->Configuration.Drives[i].bDriveStatus =
2712 @@ -3918,7 +3933,7 @@ csmisas_get_raid_config(unsigned long ar
2713 CSMI_SAS_DRIVE_TYPE_SINGLE_PORT_SAS;
2714 if (mpt_raid_phys_disk_get_num_paths(ioc,
2715 pVolume0->PhysDisk[i].PhysDiskNum) > 1)
2716 - pKarg->Configuration.Drives[i].bDriveType =
2717 + pKarg->Configuration.Drives[i].bDriveType =
2718 CSMI_SAS_DRIVE_TYPE_DUAL_PORT_SAS;
2719 }
2720
2721 @@ -3941,9 +3956,9 @@ csmisas_get_raid_config(unsigned long ar
2722 if ((pVolume0->VolumeSettings.HotSparePool &
2723 pIocPage5->HotSpare[idx].HotSparePool) == 0)
2724 continue;
2725 - if(pIocPage5->HotSpare[idx].Flags !=
2726 + if (pIocPage5->HotSpare[idx].Flags !=
2727 MPI_IOC_PAGE_5_HOT_SPARE_ACTIVE)
2728 - continue;
2729 + continue;
2730 physDiskNum = pIocPage5->HotSpare[idx].PhysDiskNum;
2731 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
2732 cfg.pageAddr = physDiskNum;
2733 @@ -3981,11 +3996,11 @@ csmisas_get_raid_config(unsigned long ar
2734 MPI_RAID_VOL_TYPE_IME) &&
2735 (((totalMaxLBA +
2736 pVolume0->NumPhysDisks) * 2) +
2737 - (64*2*1024 ) /*metadata = 64MB*/ >
2738 + (64*2*1024) /*metadata = 64MB*/ >
2739 le32_to_cpu(pPhysDisk0->MaxLBA)))
2740 continue;
2741
2742 - pKarg->Configuration.bDriveCount++;
2743 + pKarg->Configuration.bDriveCount++;
2744 if (pKarg->Configuration.bDataType !=
2745 CSMI_SAS_RAID_DATA_DRIVES) {
2746 i++;
2747 @@ -3996,14 +4011,16 @@ csmisas_get_raid_config(unsigned long ar
2748 sas_info = csmisas_get_device_component_by_fw(ioc,
2749 pPhysDisk0->PhysDiskBus, pPhysDisk0->PhysDiskID);
2750 if (sas_info) {
2751 - sas_address = reverse_byte_order64(sas_info->sas_address);
2752 + sas_address =
2753 + reverse_byte_order64(sas_info->sas_address);
2754 memcpy(pKarg->Configuration.Drives[i].bSASAddress,
2755 - &sas_address,sizeof(u64));
2756 + &sas_address, sizeof(u64));
2757 }
2758
2759 memcpy(pKarg->Configuration.Drives[i].bModel,
2760 pPhysDisk0->InquiryData.VendorID,
2761 - offsetof(RAID_PHYS_DISK0_INQUIRY_DATA,ProductRevLevel));
2762 + offsetof(RAID_PHYS_DISK0_INQUIRY_DATA,
2763 + ProductRevLevel));
2764 memcpy(pKarg->Configuration.Drives[i].bFirmware,
2765 pPhysDisk0->InquiryData.ProductRevLevel,
2766 sizeof(pPhysDisk0->InquiryData.ProductRevLevel));
2767 @@ -4021,10 +4038,10 @@ csmisas_get_raid_config(unsigned long ar
2768 }
2769 pKarg->Configuration.Drives[i].bDriveStatus =
2770 CSMI_SAS_DRIVE_STATUS_OK;
2771 - if(pPhysDisk0->PhysDiskStatus.State)
2772 + if (pPhysDisk0->PhysDiskStatus.State)
2773 pKarg->Configuration.Drives[i].bDriveStatus =
2774 CSMI_SAS_DRIVE_STATUS_FAILED;
2775 - else if(pPhysDisk0->ErrorData.SmartCount)
2776 + else if (pPhysDisk0->ErrorData.SmartCount)
2777 pKarg->Configuration.Drives[i].bDriveStatus =
2778 CSMI_SAS_DRIVE_STATUS_DEGRADED;
2779 pKarg->Configuration.Drives[i].bDriveUsage =
2780 @@ -4047,8 +4064,8 @@ csmisas_get_raid_config(unsigned long ar
2781 }
2782 }
2783
2784 - // Only return data on the first 240 drives
2785 - if( pKarg->Configuration.bDriveCount > 0xF0 )
2786 + /* Only return data on the first 240 drives */
2787 + if (pKarg->Configuration.bDriveCount > 0xF0)
2788 pKarg->Configuration.bDriveCount =
2789 CSMI_SAS_RAID_DRIVE_COUNT_TOO_BIG;
2790
2791 @@ -4060,11 +4077,11 @@ csmisas_get_raid_config(unsigned long ar
2792 pci_free_consistent(ioc->pcidev, volumepage0sz, pVolume0,
2793 volume0_dma);
2794
2795 - if(pPhysDisk0 != NULL)
2796 + if (pPhysDisk0 != NULL)
2797 pci_free_consistent(ioc->pcidev, physdiskpage0sz, pPhysDisk0,
2798 physdisk0_dma);
2799
2800 - if(pIocPage5 != NULL)
2801 + if (pIocPage5 != NULL)
2802 pci_free_consistent(ioc->pcidev, ioc_page5_sz, pIocPage5,
2803 ioc_page5_dma);
2804
2805 @@ -4075,17 +4092,17 @@ csmisas_get_raid_config(unsigned long ar
2806 switch (pKarg->Configuration.bDataType) {
2807 case CSMI_SAS_RAID_DATA_ADDITIONAL_DATA:
2808 copy_buffer_sz = sizeof(IOCTL_HEADER) +
2809 - offsetof(CSMI_SAS_RAID_CONFIG,Data) +
2810 + offsetof(CSMI_SAS_RAID_CONFIG, Data) +
2811 sizeof(CSMI_SAS_RAID_SET_ADDITIONAL_DATA);
2812 break;
2813 case CSMI_SAS_RAID_DATA_DRIVES:
2814 if (pKarg->Configuration.bDriveCount ==
2815 CSMI_SAS_RAID_DRIVE_COUNT_SUPRESSED)
2816 copy_buffer_sz = sizeof(IOCTL_HEADER) +
2817 - offsetof(CSMI_SAS_RAID_CONFIG,Drives);
2818 - else
2819 + offsetof(CSMI_SAS_RAID_CONFIG, Drives);
2820 + else
2821 copy_buffer_sz = sizeof(IOCTL_HEADER) +
2822 - offsetof(CSMI_SAS_RAID_CONFIG,Drives) +
2823 + offsetof(CSMI_SAS_RAID_CONFIG, Drives) +
2824 (pKarg->Configuration.bDriveCount *
2825 sizeof(CSMI_SAS_RAID_DRIVES));
2826 break;
2827 @@ -4097,12 +4114,12 @@ csmisas_get_raid_config(unsigned long ar
2828 if (copy_to_user(uarg, pKarg, copy_buffer_sz)) {
2829 printk(KERN_ERR "%s@%d::%s() - "
2830 "Unable to write out csmi_sas_get_raid_config @ %p\n",
2831 - __FILE__, __LINE__, __FUNCTION__, uarg);
2832 + __FILE__, __LINE__, __func__, uarg);
2833 free_pages((unsigned long)pKarg, memory_pages);
2834 return -EFAULT;
2835 }
2836
2837 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2838 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2839 free_pages((unsigned long)pKarg, memory_pages);
2840 return 0;
2841 }
2842 @@ -4119,15 +4136,15 @@ static int
2843 csmisas_get_raid_features(unsigned long arg)
2844 {
2845 CSMI_SAS_RAID_FEATURES_BUFFER __user *uarg = (void __user *) arg;
2846 - CSMI_SAS_RAID_FEATURES_BUFFER karg, *pKarg=NULL;
2847 + CSMI_SAS_RAID_FEATURES_BUFFER karg, *pKarg = NULL;
2848 int csmi_sas_raid_features_buffer_sz, iocnum;
2849 int memory_pages;
2850 MPT_ADAPTER *ioc = NULL;
2851
2852 if (copy_from_user(&karg, uarg, sizeof(IOCTL_HEADER))) {
2853 - printk(KERN_ERR "%s@%d::%s() - "
2854 - "Unable to read in csmi_sas_get_raid_features struct @ %p\n",
2855 - __FILE__, __LINE__, __FUNCTION__, uarg);
2856 + printk(KERN_ERR "%s@%d::%s() - Unable to "
2857 + "read in csmi_sas_get_raid_features struct @ %p\n",
2858 + __FILE__, __LINE__, __func__, uarg);
2859 return -EFAULT;
2860 }
2861
2862 @@ -4135,20 +4152,20 @@ csmisas_get_raid_features(unsigned long
2863 memory_pages = get_order(csmi_sas_raid_features_buffer_sz);
2864 pKarg = (CSMI_SAS_RAID_FEATURES_BUFFER *)__get_free_pages(
2865 GFP_KERNEL, memory_pages);
2866 - if (!pKarg){
2867 + if (!pKarg) {
2868 printk(KERN_ERR "%s@%d::%s() - "
2869 "Unable to malloc RAID_FEATURES_BUFFER "
2870 "csmi_sas_raid_features_buffer_sz=%d memory_pages=%d\n",
2871 - __FILE__, __LINE__, __FUNCTION__,
2872 + __FILE__, __LINE__, __func__,
2873 csmi_sas_raid_features_buffer_sz, memory_pages);
2874 return -ENOMEM;
2875 }
2876 memset(pKarg, 0, sizeof(*pKarg));
2877
2878 if (copy_from_user(pKarg, uarg, csmi_sas_raid_features_buffer_sz)) {
2879 - printk(KERN_ERR "%s@%d::%s() - "
2880 - "Unable to read in csmi_sas_get_raid_features struct @ %p\n",
2881 - __FILE__, __LINE__, __FUNCTION__, uarg);
2882 + printk(KERN_ERR "%s@%d::%s() - Unable to "
2883 + "read in csmi_sas_get_raid_features struct @ %p\n",
2884 + __FILE__, __LINE__, __func__, uarg);
2885 free_pages((unsigned long)pKarg, memory_pages);
2886 return -EFAULT;
2887 }
2888 @@ -4156,22 +4173,22 @@ csmisas_get_raid_features(unsigned long
2889 if (((iocnum = mpt_verify_adapter(pKarg->IoctlHeader.IOControllerNumber,
2890 &ioc)) < 0) || (ioc == NULL)) {
2891 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2892 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2893 + __FILE__, __func__, __LINE__, iocnum);
2894 free_pages((unsigned long)pKarg, memory_pages);
2895 return -ENODEV;
2896 }
2897
2898 if (!csmisas_is_this_sas_cntr(ioc)) {
2899 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2900 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2901 + __FILE__, __func__, __LINE__, iocnum);
2902 free_pages((unsigned long)pKarg, memory_pages);
2903 return -ENODEV;
2904 }
2905
2906 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2907 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2908
2909 if (pKarg->Information.uChangeCount != 0 &&
2910 - pKarg->Information.uChangeCount != ioc->csmi_change_count ) {
2911 + pKarg->Information.uChangeCount != ioc->csmi_change_count) {
2912 pKarg->IoctlHeader.ReturnCode =
2913 CSMI_SAS_STATUS_INVALID_PARAMETER;
2914 pKarg->Information.uFailureCode =
2915 @@ -4218,12 +4235,12 @@ csmisas_get_raid_features(unsigned long
2916 sizeof(CSMI_SAS_RAID_FEATURES_BUFFER))) {
2917 printk(KERN_ERR "%s@%d::%s() - "
2918 "Unable to write out csmi_sas_get_raid_features @ %p\n",
2919 - __FILE__, __LINE__, __FUNCTION__, uarg);
2920 + __FILE__, __LINE__, __func__, uarg);
2921 free_pages((unsigned long)pKarg, memory_pages);
2922 return -EFAULT;
2923 }
2924
2925 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2926 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2927 free_pages((unsigned long)pKarg, memory_pages);
2928 return 0;
2929 }
2930 @@ -4240,7 +4257,7 @@ static int
2931 csmisas_set_raid_control(unsigned long arg)
2932 {
2933 CSMI_SAS_RAID_CONTROL_BUFFER __user *uarg = (void __user *) arg;
2934 - CSMI_SAS_RAID_CONTROL_BUFFER karg, *pKarg=NULL;
2935 + CSMI_SAS_RAID_CONTROL_BUFFER karg, *pKarg = NULL;
2936 int csmi_sas_raid_control_buffer_sz, iocnum;
2937 int memory_pages;
2938 MPT_ADAPTER *ioc = NULL;
2939 @@ -4248,7 +4265,7 @@ csmisas_set_raid_control(unsigned long a
2940 if (copy_from_user(&karg, uarg, sizeof(IOCTL_HEADER))) {
2941 printk(KERN_ERR "%s@%d::%s() - "
2942 "Unable to read in csmi_sas_set_raid_control struct @ %p\n",
2943 - __FILE__, __LINE__, __FUNCTION__, uarg);
2944 + __FILE__, __LINE__, __func__, uarg);
2945 return -EFAULT;
2946 }
2947
2948 @@ -4256,11 +4273,11 @@ csmisas_set_raid_control(unsigned long a
2949 memory_pages = get_order(csmi_sas_raid_control_buffer_sz);
2950 pKarg = (CSMI_SAS_RAID_CONTROL_BUFFER *)__get_free_pages(
2951 GFP_KERNEL, memory_pages);
2952 - if (!pKarg){
2953 + if (!pKarg) {
2954 printk(KERN_ERR "%s@%d::%s() - "
2955 "Unable to malloc RAID_CONTROL_BUFFER "
2956 "csmi_sas_raid_control_buffer_sz=%d memory_pages=%d\n",
2957 - __FILE__, __LINE__, __FUNCTION__,
2958 + __FILE__, __LINE__, __func__,
2959 csmi_sas_raid_control_buffer_sz, memory_pages);
2960 return -ENOMEM;
2961 }
2962 @@ -4269,7 +4286,7 @@ csmisas_set_raid_control(unsigned long a
2963 if (copy_from_user(pKarg, uarg, csmi_sas_raid_control_buffer_sz)) {
2964 printk(KERN_ERR "%s@%d::%s() - "
2965 "Unable to read in csmi_sas_set_raid_control struct @ %p\n",
2966 - __FILE__, __LINE__, __FUNCTION__, uarg);
2967 + __FILE__, __LINE__, __func__, uarg);
2968 free_pages((unsigned long)pKarg, memory_pages);
2969 return -EFAULT;
2970 }
2971 @@ -4277,22 +4294,22 @@ csmisas_set_raid_control(unsigned long a
2972 if (((iocnum = mpt_verify_adapter(pKarg->IoctlHeader.IOControllerNumber,
2973 &ioc)) < 0) || (ioc == NULL)) {
2974 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2975 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2976 + __FILE__, __func__, __LINE__, iocnum);
2977 free_pages((unsigned long)pKarg, memory_pages);
2978 return -ENODEV;
2979 }
2980
2981 if (!csmisas_is_this_sas_cntr(ioc)) {
2982 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2983 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2984 + __FILE__, __func__, __LINE__, iocnum);
2985 free_pages((unsigned long)pKarg, memory_pages);
2986 return -ENODEV;
2987 }
2988
2989 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2990 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2991
2992 if (pKarg->Information.uChangeCount != 0 &&
2993 - pKarg->Information.uChangeCount != ioc->csmi_change_count ) {
2994 + pKarg->Information.uChangeCount != ioc->csmi_change_count) {
2995 pKarg->IoctlHeader.ReturnCode =
2996 CSMI_SAS_STATUS_INVALID_PARAMETER;
2997 pKarg->Information.uFailureCode =
2998 @@ -4329,8 +4346,8 @@ csmisas_set_raid_control(unsigned long a
2999 goto cim_set_raid_control_exit;
3000 }
3001
3002 - if( !strcmp(pKarg->Information.bClearConfiguration,
3003 - CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE) ) {
3004 + if (!strcmp(pKarg->Information.bClearConfiguration,
3005 + CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE)) {
3006 pKarg->IoctlHeader.ReturnCode =
3007 CSMI_SAS_STATUS_INVALID_PARAMETER;
3008 pKarg->Information.uFailureCode =
3009 @@ -4349,12 +4366,12 @@ csmisas_set_raid_control(unsigned long a
3010 sizeof(CSMI_SAS_RAID_CONTROL_BUFFER))) {
3011 printk(KERN_ERR "%s@%d::%s() - "
3012 "Unable to write out csmi_sas_set_raid_control @ %p\n",
3013 - __FILE__, __LINE__, __FUNCTION__, uarg);
3014 + __FILE__, __LINE__, __func__, uarg);
3015 free_pages((unsigned long)pKarg, memory_pages);
3016 return -EFAULT;
3017 }
3018
3019 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3020 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3021 free_pages((unsigned long)pKarg, memory_pages);
3022 return 0;
3023 }
3024 @@ -4378,42 +4395,39 @@ csmisas_get_raid_element(unsigned long a
3025 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_RAID_ELEMENT_BUFFER))) {
3026 printk(KERN_ERR "%s@%d::%s() - "
3027 "Unable to read in csmisas_get_raid_element struct @ %p\n",
3028 - __FILE__, __LINE__, __FUNCTION__, uarg);
3029 + __FILE__, __LINE__, __func__, uarg);
3030 return -EFAULT;
3031 }
3032
3033 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3034 &ioc)) < 0) || (ioc == NULL)) {
3035 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3036 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3037 + __FILE__, __func__, __LINE__, iocnum);
3038 return -ENODEV;
3039 }
3040
3041 if (!csmisas_is_this_sas_cntr(ioc)) {
3042 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3043 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3044 + __FILE__, __func__, __LINE__, iocnum);
3045 return -ENODEV;
3046 }
3047
3048 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3049 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3050
3051 -/* TODO - implement IOCTL here */
3052 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;
3053 dcsmisasprintk(ioc, printk(KERN_DEBUG ": not implemented\n"));
3054
3055 -// csmisas_get_raid_element_exit:
3056 -
3057 /* Copy the data from kernel memory to user memory
3058 */
3059 if (copy_to_user(uarg, &karg,
3060 sizeof(CSMI_SAS_RAID_ELEMENT_BUFFER))) {
3061 printk(KERN_ERR "%s@%d::%s() - "
3062 "Unable to write out csmisas_get_raid_element @ %p\n",
3063 - __FILE__, __LINE__, __FUNCTION__, uarg);
3064 + __FILE__, __LINE__, __func__, uarg);
3065 return -EFAULT;
3066 }
3067
3068 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3069 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3070 return 0;
3071
3072 }
3073 @@ -4434,45 +4448,43 @@ csmisas_set_raid_operation(unsigned long
3074 MPT_ADAPTER *ioc = NULL;
3075 int iocnum;
3076
3077 - if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_RAID_SET_OPERATION_BUFFER))) {
3078 + if (copy_from_user(&karg, uarg,
3079 + sizeof(CSMI_SAS_RAID_SET_OPERATION_BUFFER))) {
3080 printk(KERN_ERR "%s@%d::%s() - "
3081 "Unable to read in csmi_set_raid_operation struct @ %p\n",
3082 - __FILE__, __LINE__, __FUNCTION__, uarg);
3083 + __FILE__, __LINE__, __func__, uarg);
3084 return -EFAULT;
3085 }
3086
3087 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3088 &ioc)) < 0) || (ioc == NULL)) {
3089 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3090 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3091 + __FILE__, __func__, __LINE__, iocnum);
3092 return -ENODEV;
3093 }
3094
3095 if (!csmisas_is_this_sas_cntr(ioc)) {
3096 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3097 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3098 + __FILE__, __func__, __LINE__, iocnum);
3099 return -ENODEV;
3100 }
3101
3102 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3103 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3104
3105 -/* TODO - implement IOCTL here */
3106 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;
3107 dcsmisasprintk(ioc, printk(KERN_DEBUG ": not implemented\n"));
3108
3109 -// cim_set_raid_operation:
3110 -
3111 /* Copy the data from kernel memory to user memory
3112 */
3113 if (copy_to_user(uarg, &karg,
3114 sizeof(CSMI_SAS_RAID_SET_OPERATION_BUFFER))) {
3115 printk(KERN_ERR "%s@%d::%s() - "
3116 "Unable to write out csmi_set_raid_operation @ %p\n",
3117 - __FILE__, __LINE__, __FUNCTION__, uarg);
3118 + __FILE__, __LINE__, __func__, uarg);
3119 return -EFAULT;
3120 }
3121
3122 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3123 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3124 return 0;
3125
3126 }
3127 @@ -4512,24 +4524,24 @@ csmisas_task_managment(unsigned long arg
3128 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_SSP_TASK_IU_BUFFER))) {
3129 printk(KERN_ERR "%s@%d::%s() - "
3130 "Unable to read in csmi_sas_task_managment struct @ %p\n",
3131 - __FILE__, __LINE__, __FUNCTION__, uarg);
3132 + __FILE__, __LINE__, __func__, uarg);
3133 return -EFAULT;
3134 }
3135
3136 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3137 &ioc)) < 0) || (ioc == NULL)) {
3138 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3139 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3140 + __FILE__, __func__, __LINE__, iocnum);
3141 return -ENODEV;
3142 }
3143
3144 if (!csmisas_is_this_sas_cntr(ioc)) {
3145 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3146 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3147 + __FILE__, __func__, __LINE__, iocnum);
3148 return -ENODEV;
3149 }
3150
3151 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3152 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3153
3154 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
3155
3156 @@ -4575,18 +4587,22 @@ csmisas_task_managment(unsigned long arg
3157 goto cim_get_task_managment_exit;
3158
3159 switch (karg.Parameters.uInformation) {
3160 - case CSMI_SAS_SSP_TEST:
3161 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request for test purposes\n"));
3162 - break;
3163 - case CSMI_SAS_SSP_EXCEEDED:
3164 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request due to timeout\n"));
3165 - break;
3166 - case CSMI_SAS_SSP_DEMAND:
3167 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request demanded by app\n"));
3168 - break;
3169 - case CSMI_SAS_SSP_TRIGGER:
3170 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request sent to trigger event\n"));
3171 - break;
3172 + case CSMI_SAS_SSP_TEST:
3173 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3174 + "TM request for test purposes\n"));
3175 + break;
3176 + case CSMI_SAS_SSP_EXCEEDED:
3177 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3178 + "TM request due to timeout\n"));
3179 + break;
3180 + case CSMI_SAS_SSP_DEMAND:
3181 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3182 + "TM request demanded by app\n"));
3183 + break;
3184 + case CSMI_SAS_SSP_TRIGGER:
3185 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3186 + "TM request sent to trigger event\n"));
3187 + break;
3188 }
3189
3190 switch (taskType) {
3191 @@ -4601,12 +4617,12 @@ csmisas_task_managment(unsigned long arg
3192 mf = MPT_INDEX_2_MFPTR(hd->ioc, i);
3193 TaskMsgContext =
3194 mf->u.frame.hwhdr.msgctxu.MsgContext;
3195 - found_qtag=1;
3196 + found_qtag = 1;
3197 break;
3198 }
3199 }
3200
3201 - if(!found_qtag)
3202 + if (!found_qtag)
3203 goto cim_get_task_managment_exit;
3204
3205 case MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET:
3206 @@ -4618,7 +4634,6 @@ csmisas_task_managment(unsigned long arg
3207
3208 /* Single threading ....
3209 */
3210 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3211 mutex_lock(&ioc->taskmgmt_cmds.mutex);
3212 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
3213 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3214 @@ -4626,50 +4641,34 @@ csmisas_task_managment(unsigned long arg
3215 CSMI_SAS_STATUS_FAILED;
3216 goto cim_get_task_managment_exit;
3217 }
3218 -#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0))
3219 - if (mptctl_set_tm_flags(hd) != 0) {
3220 - karg.IoctlHeader.ReturnCode =
3221 - CSMI_SAS_STATUS_FAILED;
3222 - goto cim_get_task_managment_exit;
3223 - }
3224 -#endif
3225 /* Send request
3226 */
3227 if ((mf = mpt_get_msg_frame(mptctl_taskmgmt_id, ioc)) == NULL) {
3228 - dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
3229 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3230 + dcsmisasprintk(ioc,
3231 + printk(KERN_ERR ": no msg frames!\n"));
3232 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3233 mpt_clear_taskmgmt_in_progress_flag(ioc);
3234 -#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0))
3235 - mptctl_free_tm_flags(ioc);
3236 -#endif
3237 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3238 goto cim_get_task_managment_exit;
3239 }
3240
3241 mpi_hdr = (MPIHeader_t *) mf;
3242 MsgContext = mpi_hdr->MsgContext;
3243 - pScsiTm = (pSCSITaskMgmt_t ) mf;
3244 + pScsiTm = (pSCSITaskMgmt_t) mf;
3245
3246 - memset(pScsiTm,0,sizeof(SCSITaskMgmt_t));
3247 + memset(pScsiTm, 0, sizeof(SCSITaskMgmt_t));
3248 pScsiTm->TaskType = taskType;
3249 pScsiTm->Bus = channel;
3250 pScsiTm->TargetID = id;
3251 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3252 int_to_scsilun(karg.Parameters.bLun,
3253 (struct scsi_lun *)pScsiTm->LUN);
3254 -#else
3255 - pScsiTm->LUN[1] = karg.Parameters.bLun;
3256 -#endif
3257 pScsiTm->MsgContext = MsgContext;
3258 pScsiTm->TaskMsgContext = TaskMsgContext;
3259 pScsiTm->Function = MPI_FUNCTION_SCSI_TASK_MGMT;
3260
3261 if (csmisas_send_handshake_wait(ioc, mf,
3262 karg.IoctlHeader.Timeout) != 0) {
3263 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3264 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3265 -#endif
3266 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3267 goto cim_get_task_managment_exit;
3268 }
3269 @@ -4677,25 +4676,26 @@ csmisas_task_managment(unsigned long arg
3270 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) {
3271
3272 pScsiTmReply =
3273 - (pSCSITaskMgmtReply_t ) ioc->ioctl_cmds.reply;
3274 + (pSCSITaskMgmtReply_t) ioc->ioctl_cmds.reply;
3275
3276 ioc_status = le16_to_cpu(pScsiTmReply->IOCStatus)
3277 & MPI_IOCSTATUS_MASK;
3278
3279 - memset(&karg.Status,0,
3280 + memset(&karg.Status, 0,
3281 sizeof(CSMI_SAS_SSP_PASSTHRU_STATUS));
3282
3283 - if(ioc_status == MPI_IOCSTATUS_SUCCESS) {
3284 + if (ioc_status == MPI_IOCSTATUS_SUCCESS) {
3285 karg.IoctlHeader.ReturnCode =
3286 CSMI_SAS_STATUS_SUCCESS;
3287 karg.Status.bSSPStatus =
3288 CSMI_SAS_SSP_STATUS_COMPLETED;
3289 - }else if(ioc_status == MPI_IOCSTATUS_INSUFFICIENT_RESOURCES) {
3290 + } else if (ioc_status
3291 + == MPI_IOCSTATUS_INSUFFICIENT_RESOURCES) {
3292 karg.IoctlHeader.ReturnCode =
3293 CSMI_SAS_STATUS_SUCCESS;
3294 karg.Status.bSSPStatus =
3295 CSMI_SAS_SSP_STATUS_RETRY;
3296 - }else {
3297 + } else {
3298 karg.IoctlHeader.ReturnCode =
3299 CSMI_SAS_STATUS_FAILED;
3300 karg.Status.bSSPStatus =
3301 @@ -4711,9 +4711,7 @@ csmisas_task_managment(unsigned long arg
3302 break;
3303 }
3304
3305 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3306 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3307 -#endif
3308
3309 cim_get_task_managment_exit:
3310
3311 @@ -4723,11 +4721,11 @@ csmisas_task_managment(unsigned long arg
3312 sizeof(CSMI_SAS_SSP_TASK_IU_BUFFER))) {
3313 printk(KERN_ERR "%s@%d::%s() - "
3314 "Unable to write out csmi_sas_task_managment @ %p\n",
3315 - __FILE__, __LINE__, __FUNCTION__, uarg);
3316 + __FILE__, __LINE__, __func__, uarg);
3317 return -EFAULT;
3318 }
3319
3320 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3321 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3322 return 0;
3323 }
3324
3325 @@ -4827,19 +4825,19 @@ csmisas_phy_reset(MPT_ADAPTER *ioc, u8 P
3326
3327 if ((opcode != MPI_SAS_OP_PHY_LINK_RESET) &&
3328 (opcode != MPI_SAS_OP_PHY_HARD_RESET))
3329 - return -1;
3330 + return -1;
3331
3332 /* Get a MF for this command.
3333 */
3334 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
3335 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
3336 return -1;
3337 - }
3338 + }
3339
3340 mpi_hdr = (MPIHeader_t *) mf;
3341 MsgContext = mpi_hdr->MsgContext;
3342 sasIoUnitCntrReq = (SasIoUnitControlRequest_t *)mf;
3343 - memset(sasIoUnitCntrReq,0,sizeof(SasIoUnitControlRequest_t));
3344 + memset(sasIoUnitCntrReq, 0, sizeof(SasIoUnitControlRequest_t));
3345 sasIoUnitCntrReq->Function = MPI_FUNCTION_SAS_IO_UNIT_CONTROL;
3346 sasIoUnitCntrReq->MsgContext = MsgContext;
3347 sasIoUnitCntrReq->Operation = opcode;
3348 @@ -4857,7 +4855,7 @@ csmisas_phy_reset(MPT_ADAPTER *ioc, u8 P
3349 & MPI_IOCSTATUS_MASK;
3350 if (ioc_status != MPI_IOCSTATUS_SUCCESS) {
3351 printk(KERN_DEBUG "%s: IOCStatus=0x%X IOCLogInfo=0x%X\n",
3352 - __FUNCTION__,
3353 + __func__,
3354 sasIoUnitCntrReply->IOCStatus,
3355 sasIoUnitCntrReply->IOCLogInfo);
3356 return -1;
3357 @@ -4878,12 +4876,12 @@ csmisas_phy_control(unsigned long arg)
3358 CSMI_SAS_PHY_CONTROL_BUFFER __user *uarg = (void __user *) arg;
3359 IOCTL_HEADER ioctl_header;
3360 PCSMI_SAS_PHY_CONTROL_BUFFER karg;
3361 - SasIOUnitPage0_t *sasIoUnitPg0=NULL;
3362 + SasIOUnitPage0_t *sasIoUnitPg0 = NULL;
3363 dma_addr_t sasIoUnitPg0_dma;
3364 - int sasIoUnitPg0_data_sz=0;
3365 - SasIOUnitPage1_t *sasIoUnitPg1=NULL;
3366 + int sasIoUnitPg0_data_sz = 0;
3367 + SasIOUnitPage1_t *sasIoUnitPg1 = NULL;
3368 dma_addr_t sasIoUnitPg1_dma;
3369 - int sasIoUnitPg1_data_sz=0;
3370 + int sasIoUnitPg1_data_sz = 0;
3371 ConfigExtendedPageHeader_t hdr;
3372 CONFIGPARMS cfg;
3373 MPT_ADAPTER *ioc = NULL;
3374 @@ -4894,7 +4892,7 @@ csmisas_phy_control(unsigned long arg)
3375 if (copy_from_user(&ioctl_header, uarg, sizeof(IOCTL_HEADER))) {
3376 printk(KERN_ERR "%s@%d::%s() - "
3377 "Unable to read in IOCTL_HEADER"
3378 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3379 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3380 return -EFAULT;
3381 }
3382
3383 @@ -4902,11 +4900,11 @@ csmisas_phy_control(unsigned long arg)
3384 memory_pages = get_order(csmi_sas_phy_control_buffer_sz);
3385 karg = (PCSMI_SAS_PHY_CONTROL_BUFFER)__get_free_pages(
3386 GFP_KERNEL, memory_pages);
3387 - if (!karg){
3388 + if (!karg) {
3389 printk(KERN_ERR "%s@%d::%s() - "
3390 "Unable to malloc SAS_PHY_CONTROL_BUFFER "
3391 "csmi_sas_phy_control_buffer_sz=%d memory_pages=%d\n",
3392 - __FILE__, __LINE__, __FUNCTION__,
3393 + __FILE__, __LINE__, __func__,
3394 csmi_sas_phy_control_buffer_sz, memory_pages);
3395 return -ENOMEM;
3396 }
3397 @@ -4915,7 +4913,7 @@ csmisas_phy_control(unsigned long arg)
3398 if (copy_from_user(karg, uarg, csmi_sas_phy_control_buffer_sz)) {
3399 printk(KERN_ERR "%s@%d::%s() - "
3400 "Unable to read in csmi_sas_phy_control_buffer "
3401 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3402 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3403 free_pages((unsigned long)karg, memory_pages);
3404 return -EFAULT;
3405 }
3406 @@ -4923,19 +4921,19 @@ csmisas_phy_control(unsigned long arg)
3407 if (((iocnum = mpt_verify_adapter(ioctl_header.IOControllerNumber,
3408 &ioc)) < 0) || (ioc == NULL)) {
3409 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3410 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3411 + __FILE__, __func__, __LINE__, iocnum);
3412 free_pages((unsigned long)karg, memory_pages);
3413 return -ENODEV;
3414 }
3415
3416 if (!csmisas_is_this_sas_cntr(ioc)) {
3417 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3418 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3419 + __FILE__, __func__, __LINE__, iocnum);
3420 free_pages((unsigned long)karg, memory_pages);
3421 return -ENODEV;
3422 }
3423
3424 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3425 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3426
3427 if (karg->bPhyIdentifier >= ioc->num_ports) {
3428 karg->IoctlHeader.ReturnCode =
3429 @@ -4970,7 +4968,8 @@ csmisas_phy_control(unsigned long arg)
3430 }
3431
3432 if (hdr.ExtPageLength == 0) {
3433 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3434 + dcsmisasprintk(ioc,
3435 + printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3436 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3437 goto cim_sas_phy_control_exit;
3438 }
3439 @@ -4980,7 +4979,8 @@ csmisas_phy_control(unsigned long arg)
3440 sasIoUnitPg0_data_sz, &sasIoUnitPg0_dma);
3441
3442 if (!sasIoUnitPg0) {
3443 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3444 + dcsmisasprintk(ioc,
3445 + printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3446 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3447 goto cim_sas_phy_control_exit;
3448 }
3449 @@ -5023,7 +5023,8 @@ csmisas_phy_control(unsigned long arg)
3450 }
3451
3452 if (hdr.ExtPageLength == 0) {
3453 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3454 + dcsmisasprintk(ioc,
3455 + printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3456 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3457 goto cim_sas_phy_control_exit;
3458 }
3459 @@ -5033,7 +5034,8 @@ csmisas_phy_control(unsigned long arg)
3460 sasIoUnitPg1_data_sz, &sasIoUnitPg1_dma);
3461
3462 if (!sasIoUnitPg1) {
3463 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3464 + dcsmisasprintk(ioc,
3465 + printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3466 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3467 goto cim_sas_phy_control_exit;
3468 }
3469 @@ -5054,19 +5056,18 @@ csmisas_phy_control(unsigned long arg)
3470 case CSMI_SAS_PC_LINK_RESET:
3471 case CSMI_SAS_PC_HARD_RESET:
3472 {
3473 - u8 opcode = (karg->uFunction==CSMI_SAS_PC_LINK_RESET) ?
3474 + u8 opcode = (karg->uFunction == CSMI_SAS_PC_LINK_RESET) ?
3475 MPI_SAS_OP_PHY_LINK_RESET : MPI_SAS_OP_PHY_HARD_RESET;
3476
3477 - if((karg->uLinkFlags & CSMI_SAS_PHY_ACTIVATE_CONTROL) &&
3478 + if ((karg->uLinkFlags & CSMI_SAS_PHY_ACTIVATE_CONTROL) &&
3479 (karg->usLengthOfControl >= sizeof(CSMI_SAS_PHY_CONTROL)) &&
3480 - (karg->bNumberOfControls > 0)){
3481 - if(karg->Control[0].bRate ==
3482 + (karg->bNumberOfControls > 0)) {
3483 + if (karg->Control[0].bRate ==
3484 CSMI_SAS_LINK_RATE_1_5_GBPS) {
3485 sasIoUnitPg1->PhyData[karg->bPhyIdentifier].MaxMinLinkRate =
3486 MPI_SAS_IOUNIT1_MAX_RATE_1_5 |
3487 MPI_SAS_IOUNIT1_MIN_RATE_1_5;
3488 - }
3489 - else if(karg->Control[0].bRate ==
3490 + } else if (karg->Control[0].bRate ==
3491 CSMI_SAS_LINK_RATE_3_0_GBPS) {
3492 sasIoUnitPg1->PhyData[karg->bPhyIdentifier].MaxMinLinkRate =
3493 MPI_SAS_IOUNIT1_MAX_RATE_3_0 |
3494 @@ -5103,7 +5104,7 @@ csmisas_phy_control(unsigned long arg)
3495
3496 }
3497 case CSMI_SAS_PC_PHY_DISABLE:
3498 - if(karg->usLengthOfControl || karg->bNumberOfControls) {
3499 + if (karg->usLengthOfControl || karg->bNumberOfControls) {
3500 karg->IoctlHeader.ReturnCode =
3501 CSMI_SAS_STATUS_INVALID_PARAMETER;
3502 break;
3503 @@ -5135,14 +5136,14 @@ csmisas_phy_control(unsigned long arg)
3504 break;
3505
3506 case CSMI_SAS_PC_GET_PHY_SETTINGS:
3507 - if(karg->usLengthOfControl || karg->bNumberOfControls) {
3508 + if (karg->usLengthOfControl || karg->bNumberOfControls) {
3509 karg->IoctlHeader.ReturnCode =
3510 CSMI_SAS_STATUS_INVALID_PARAMETER;
3511 break;
3512 }
3513 - if(csmi_sas_phy_control_buffer_sz <
3514 - offsetof(CSMI_SAS_PHY_CONTROL_BUFFER,Control) +
3515 - (4* sizeof(CSMI_SAS_PHY_CONTROL))) {
3516 + if (csmi_sas_phy_control_buffer_sz <
3517 + offsetof(CSMI_SAS_PHY_CONTROL_BUFFER, Control) +
3518 + (4 * sizeof(CSMI_SAS_PHY_CONTROL))) {
3519 karg->IoctlHeader.ReturnCode =
3520 CSMI_SAS_STATUS_INVALID_PARAMETER;
3521 break;
3522 @@ -5175,15 +5176,15 @@ csmisas_phy_control(unsigned long arg)
3523
3524 /* Copy the data from kernel memory to user memory
3525 */
3526 - if (copy_to_user(uarg, karg,csmi_sas_phy_control_buffer_sz)) {
3527 + if (copy_to_user(uarg, karg, csmi_sas_phy_control_buffer_sz)) {
3528 printk(KERN_ERR "%s@%d::%s() - "
3529 "Unable to write out csmi_sas_phy_control_buffer @ %p\n",
3530 - __FILE__, __LINE__, __FUNCTION__, uarg);
3531 + __FILE__, __LINE__, __func__, uarg);
3532 free_pages((unsigned long)karg, memory_pages);
3533 return -EFAULT;
3534 }
3535
3536 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3537 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3538 free_pages((unsigned long)karg, memory_pages);
3539 return 0;
3540 }
3541 @@ -5202,7 +5203,8 @@ csmisas_phy_control(unsigned long arg)
3542 * -EFAULT for non-successful reply or no reply (timeout)
3543 **/
3544 static int
3545 -csmisas_get_manuf_pg_7(MPT_ADAPTER *ioc, ManufacturingPage7_t *mfgpage7_buffer, int mfg_size)
3546 +csmisas_get_manuf_pg_7(MPT_ADAPTER *ioc, ManufacturingPage7_t *mfgpage7_buffer,
3547 + int mfg_size)
3548 {
3549 ConfigPageHeader_t hdr;
3550 CONFIGPARMS cfg;
3551 @@ -5281,41 +5283,41 @@ csmisas_get_connector_info(unsigned long
3552 printk(KERN_ERR "%s@%d::%s() - "
3553 "Unable to read in csmi_sas_connector_info_buffer"
3554 " struct @ %p\n",
3555 - __FILE__, __LINE__, __FUNCTION__, uarg);
3556 + __FILE__, __LINE__, __func__, uarg);
3557 return -EFAULT;
3558 }
3559
3560 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3561 &ioc)) < 0) || (ioc == NULL)) {
3562 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3563 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3564 + __FILE__, __func__, __LINE__, iocnum);
3565 return -ENODEV;
3566 }
3567
3568 if (!csmisas_is_this_sas_cntr(ioc)) {
3569 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3570 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3571 + __FILE__, __func__, __LINE__, iocnum);
3572 return -ENODEV;
3573 }
3574
3575 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3576 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3577
3578 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
3579
3580 /* `32` is the sizeof MPI_MANPAGE7_CONNECTOR_INFO */
3581 for (i = 0; i < 32; i++) {
3582 karg.Reference[i].uPinout = CSMI_SAS_CON_UNKNOWN;
3583 - strcpy(karg.Reference[i].bConnector,"");
3584 + strcpy(karg.Reference[i].bConnector, "");
3585 karg.Reference[i].bLocation = CSMI_SAS_CON_UNKNOWN;
3586 }
3587
3588 - mfgPg7_sz = offsetof(CONFIG_PAGE_MANUFACTURING_7,ConnectorInfo) +
3589 + mfgPg7_sz = offsetof(CONFIG_PAGE_MANUFACTURING_7, ConnectorInfo) +
3590 (ioc->num_ports * sizeof(MPI_MANPAGE7_CONNECTOR_INFO));
3591 mfgPg7 = kmalloc(mfgPg7_sz, GFP_KERNEL);
3592 - if (!mfgPg7){
3593 + if (!mfgPg7) {
3594 printk(KERN_ERR "%s@%d::%s() - "
3595 "Unable to malloc @ %p\n",
3596 - __FILE__, __LINE__, __FUNCTION__, mfgPg7);
3597 + __FILE__, __LINE__, __func__, mfgPg7);
3598 return -EFAULT;
3599 }
3600 memset(mfgPg7, 0, mfgPg7_sz);
3601 @@ -5339,13 +5341,12 @@ csmisas_get_connector_info(unsigned long
3602 if (copy_to_user(uarg, &karg,
3603 sizeof(CSMI_SAS_CONNECTOR_INFO_BUFFER))) {
3604 printk(KERN_ERR "%s@%d::%s() - "
3605 - "Unable to write out csmi_sas_connector_info_buffer @"
3606 - "%p\n",
3607 - __FILE__, __LINE__, __FUNCTION__, uarg);
3608 + "Unable to write out csmi_sas_connector_info_buffer @%p\n",
3609 + __FILE__, __LINE__, __func__, uarg);
3610 return -EFAULT;
3611 }
3612
3613 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3614 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3615 return 0;
3616 }
3617
3618 @@ -5357,21 +5358,21 @@ csmisas_get_connector_info(unsigned long
3619 **/
3620 static int
3621 csmisas_fill_location_data(MPT_ADAPTER *ioc, u8 bus, u8 id, u8 opcode,
3622 - CSMI_SAS_LOCATION_IDENTIFIER * location_ident)
3623 + CSMI_SAS_LOCATION_IDENTIFIER *location_ident)
3624 {
3625
3626 ConfigExtendedPageHeader_t hdr;
3627 CONFIGPARMS cfg;
3628 int rc;
3629 - SasDevicePage0_t *sasDevicePg0=NULL;
3630 - SasEnclosurePage0_t *sasEnclosurePg0=NULL;
3631 - dma_addr_t sasDevicePg0_dma,sasEnclosurePg0_dma;
3632 - int sasDevicePg0_data_sz=0;
3633 - int sasEnclosurePg0_data_sz=0;
3634 + SasDevicePage0_t *sasDevicePg0 = NULL;
3635 + SasEnclosurePage0_t *sasEnclosurePg0 = NULL;
3636 + dma_addr_t sasDevicePg0_dma, sasEnclosurePg0_dma;
3637 + int sasDevicePg0_data_sz = 0;
3638 + int sasEnclosurePg0_data_sz = 0;
3639 u64 sas_address;
3640
3641 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3642 - memset (location_ident, 0, sizeof(*location_ident));
3643 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3644 + memset(location_ident, 0, sizeof(*location_ident));
3645
3646 /* SAS Device Page 0 */
3647 hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION;
3648 @@ -5389,12 +5390,12 @@ csmisas_fill_location_data(MPT_ADAPTER *
3649 cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;
3650
3651 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3652 - rc=-1;
3653 + rc = -1;
3654 goto fill_location_data_exit;
3655 }
3656
3657 if (hdr.ExtPageLength == 0) {
3658 - rc=-1;
3659 + rc = -1;
3660 goto fill_location_data_exit;
3661 }
3662
3663 @@ -5402,7 +5403,7 @@ csmisas_fill_location_data(MPT_ADAPTER *
3664 sasDevicePg0 = (SasDevicePage0_t *) pci_alloc_consistent(
3665 ioc->pcidev, sasDevicePg0_data_sz, &sasDevicePg0_dma);
3666 if (!sasDevicePg0) {
3667 - rc=-1;
3668 + rc = -1;
3669 goto fill_location_data_exit;
3670 }
3671
3672 @@ -5411,10 +5412,10 @@ csmisas_fill_location_data(MPT_ADAPTER *
3673 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3674 cfg.pageAddr = (bus << 8) + id
3675 + (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
3676 - MPI_SAS_DEVICE_PGAD_FORM_SHIFT);
3677 + MPI_SAS_DEVICE_PGAD_FORM_SHIFT);
3678
3679 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3680 - rc=-1;
3681 + rc = -1;
3682 goto fill_location_data_exit;
3683 }
3684
3685 @@ -5442,12 +5443,12 @@ csmisas_fill_location_data(MPT_ADAPTER *
3686 cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;
3687
3688 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3689 - rc=0;
3690 + rc = 0;
3691 goto fill_location_data_exit;
3692 }
3693
3694 if (hdr.ExtPageLength == 0) {
3695 - rc=0;
3696 + rc = 0;
3697 goto fill_location_data_exit;
3698 }
3699
3700 @@ -5455,36 +5456,34 @@ csmisas_fill_location_data(MPT_ADAPTER *
3701 sasEnclosurePg0 = (SasEnclosurePage0_t *) pci_alloc_consistent(
3702 ioc->pcidev, sasEnclosurePg0_data_sz, &sasEnclosurePg0_dma);
3703 if (!sasEnclosurePg0) {
3704 - rc=0;
3705 + rc = 0;
3706 goto fill_location_data_exit;
3707 }
3708 cfg.physAddr = sasEnclosurePg0_dma;
3709 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3710 cfg.pageAddr = sasDevicePg0->EnclosureHandle
3711 - + (MPI_SAS_ENCLOS_PGAD_FORM_HANDLE << MPI_SAS_ENCLOS_PGAD_FORM_SHIFT);
3712 + + (MPI_SAS_ENCLOS_PGAD_FORM_HANDLE <<
3713 + MPI_SAS_ENCLOS_PGAD_FORM_SHIFT);
3714
3715 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3716 - rc=0;
3717 + rc = 0;
3718 goto fill_location_data_exit;
3719 }
3720
3721 - location_ident->bLocationFlags |= CSMI_SAS_LOCATE_ENCLOSURE_IDENTIFIER_VALID;
3722 + location_ident->bLocationFlags |=
3723 + CSMI_SAS_LOCATE_ENCLOSURE_IDENTIFIER_VALID;
3724 memcpy(&sas_address, &sasEnclosurePg0->EnclosureLogicalID, sizeof(u64));
3725 sas_address = reverse_byte_order64(sas_address);
3726 if (sas_address)
3727 - memcpy(location_ident->bEnclosureIdentifier, &sas_address, sizeof(u64));
3728 + memcpy(location_ident->bEnclosureIdentifier, &sas_address,
3729 + sizeof(u64));
3730 else
3731 - strcpy(location_ident->bEnclosureIdentifier,"Internal");
3732 + strcpy(location_ident->bEnclosureIdentifier, "Internal");
3733
3734 -// bBayPrefix - not supported
3735 +/* bBayPrefix - not supported */
3736
3737 -// TODO - We need to look at sasEnclosurePg0-.Flags , to determine
3738 -// whether SEP BUS/TargetID is valid. Ifs its a SES device, then
3739 -// issue internal inquiry to (bus/id) to gather the Enclosure name.
3740 -// If the device is SMP, then issue SMP_MANUFACTURING to get enclosure name
3741 -// If its direct attached, there is no enclosure name
3742 location_ident->bLocationFlags |= CSMI_SAS_LOCATE_ENCLOSURE_NAME_VALID;
3743 - strcpy(location_ident->bEnclosureName,"Not Supported");
3744 + strcpy(location_ident->bEnclosureName, "Not Supported");
3745
3746 location_ident->bLocationFlags |= CSMI_SAS_LOCATE_LOCATION_STATE_VALID;
3747 location_ident->bLocationState = CSMI_SAS_LOCATE_UNKNOWN;
3748 @@ -5493,11 +5492,6 @@ csmisas_fill_location_data(MPT_ADAPTER *
3749 location_ident->bBayIdentifier = le16_to_cpu(sasDevicePg0->Slot);
3750
3751
3752 -// TODO - illuminating LEDs,
3753 -// karg->bIdentify = CSMI_SAS_LOCATE_FORCE_OFF, CSMI_SAS_LOCATE_FORCE_ON
3754 -// We can enable/disable LEDs by SCSI Enclosure Processor MPI request message
3755 -// printk("Flags=0x%x\n",sasEnclosurePg0->Flags);
3756 -
3757 /* check sasEnclosurePg0->Flags -
3758 * to validate whether we need to send the SEPRequest
3759 * bit:5 should be set
3760 @@ -5527,13 +5521,13 @@ fill_location_data_exit:
3761 pci_free_consistent(ioc->pcidev, sasEnclosurePg0_data_sz,
3762 sasEnclosurePg0, sasEnclosurePg0_dma);
3763
3764 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3765 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3766 return rc;
3767 }
3768
3769 static int
3770 -csmisas_fill_location_data_raid(MPT_ADAPTER *ioc, PCSMI_SAS_GET_LOCATION_BUFFER karg, u8 VolumeBus,
3771 - u8 volumeID)
3772 +csmisas_fill_location_data_raid(MPT_ADAPTER *ioc,
3773 + PCSMI_SAS_GET_LOCATION_BUFFER karg, u8 VolumeBus, u8 volumeID)
3774 {
3775 pRaidVolumePage0_t pVolume0 = NULL;
3776 pRaidPhysDiskPage0_t pPhysDisk0 = NULL;
3777 @@ -5554,9 +5548,9 @@ csmisas_fill_location_data_raid(MPT_ADAP
3778
3779 csmi_sas_get_location_sz = karg->IoctlHeader.Length;
3780 physDiskNumMax = (csmi_sas_get_location_sz -
3781 - offsetof(CSMI_SAS_GET_LOCATION_BUFFER,Location))
3782 + offsetof(CSMI_SAS_GET_LOCATION_BUFFER, Location))
3783 / sizeof(CSMI_SAS_LOCATION_IDENTIFIER);
3784 - karg->bNumberOfLocationIdentifiers=0;
3785 + karg->bNumberOfLocationIdentifiers = 0;
3786
3787 /*
3788 * get RAID Volume Page 0
3789 @@ -5592,7 +5586,7 @@ csmisas_fill_location_data_raid(MPT_ADAP
3790
3791 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3792 cfg.physAddr = volume0_dma;
3793 - if (mpt_config(ioc, &cfg) != 0){
3794 + if (mpt_config(ioc, &cfg) != 0) {
3795 rc = -1;
3796 goto sas_fill_location_data_raid_exit;
3797 }
3798 @@ -5632,17 +5626,17 @@ csmisas_fill_location_data_raid(MPT_ADAP
3799 }
3800 cfg.physAddr = physdisk0_dma;
3801
3802 - for (i=0; i < min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
3803 + for (i = 0; i < min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
3804
3805 /* obtain a refresh of pPhysDisk0 */
3806 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3807 cfg.pageAddr = pVolume0->PhysDisk[i].PhysDiskNum;
3808 - if (mpt_config(ioc, &cfg) != 0){
3809 + if (mpt_config(ioc, &cfg) != 0) {
3810 rc = -1;
3811 goto sas_fill_location_data_raid_exit;
3812 }
3813
3814 - if((csmisas_fill_location_data(ioc, pPhysDisk0->PhysDiskBus,
3815 + if ((csmisas_fill_location_data(ioc, pPhysDisk0->PhysDiskBus,
3816 pPhysDisk0->PhysDiskID, karg->bIdentify,
3817 &karg->Location[karg->bNumberOfLocationIdentifiers])) == 0)
3818 karg->bNumberOfLocationIdentifiers++;
3819 @@ -5679,7 +5673,7 @@ csmisas_fill_location_data_raid(MPT_ADAP
3820 if (csmisas_get_ioc_pg5(ioc, iocPage5, sz) != 0)
3821 goto sas_fill_location_data_raid_exit;
3822
3823 - for(i = 0, idx = pVolume0->NumPhysDisks ; i < num_hotpares;
3824 + for (i = 0, idx = pVolume0->NumPhysDisks ; i < num_hotpares;
3825 i++, idx++) {
3826
3827 if (idx >= physDiskNumMax)
3828 @@ -5728,11 +5722,11 @@ csmisas_fill_location_data_raid(MPT_ADAP
3829 if ((pVolume0->VolumeType ==
3830 MPI_RAID_VOL_TYPE_IME) &&
3831 ((tmpTotalMaxLBA * 2) +
3832 - (64*2*1024 ) /*metadata = 64MB*/ >
3833 + (64*2*1024) /*metadata = 64MB*/ >
3834 le32_to_cpu(pPhysDisk0->MaxLBA)))
3835 continue;
3836
3837 - if((csmisas_fill_location_data(ioc,
3838 + if ((csmisas_fill_location_data(ioc,
3839 pPhysDisk0->PhysDiskBus, pPhysDisk0->PhysDiskID,
3840 karg->bIdentify,
3841 &karg->Location[karg->bNumberOfLocationIdentifiers])) == 0)
3842 @@ -5749,7 +5743,7 @@ csmisas_fill_location_data_raid(MPT_ADAP
3843 pci_free_consistent(ioc->pcidev, volumepage0sz, pVolume0,
3844 volume0_dma);
3845
3846 - if(pPhysDisk0)
3847 + if (pPhysDisk0)
3848 pci_free_consistent(ioc->pcidev, physdiskpage0sz, pPhysDisk0,
3849 physdisk0_dma);
3850
3851 @@ -5771,7 +5765,7 @@ csmisas_get_location(unsigned long arg)
3852 PCSMI_SAS_GET_LOCATION_BUFFER karg;
3853 IOCTL_HEADER ioctl_header;
3854 MPT_ADAPTER *ioc = NULL;
3855 - int iocnum,i;
3856 + int iocnum, i;
3857 int csmi_sas_get_location_sz;
3858 int memory_pages;
3859 struct sas_device_info *sas_info;
3860 @@ -5779,7 +5773,7 @@ csmisas_get_location(unsigned long arg)
3861 if (copy_from_user(&ioctl_header, uarg, sizeof(IOCTL_HEADER))) {
3862 printk(KERN_ERR "%s@%d::%s() - "
3863 "Unable to read in IOCTL_HEADER"
3864 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3865 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3866 return -EFAULT;
3867 }
3868
3869 @@ -5787,11 +5781,11 @@ csmisas_get_location(unsigned long arg)
3870 memory_pages = get_order(csmi_sas_get_location_sz);
3871 karg = (PCSMI_SAS_GET_LOCATION_BUFFER)__get_free_pages(
3872 GFP_KERNEL, memory_pages);
3873 - if (!karg){
3874 + if (!karg) {
3875 printk(KERN_ERR "%s@%d::%s() - "
3876 "Unable to malloc GET_LOCATION_BUFFER "
3877 "csmi_sas_get_location_sz=%d memory_pages=%d\n",
3878 - __FILE__, __LINE__, __FUNCTION__,
3879 + __FILE__, __LINE__, __func__,
3880 csmi_sas_get_location_sz, memory_pages);
3881 return -ENOMEM;
3882 }
3883 @@ -5800,7 +5794,7 @@ csmisas_get_location(unsigned long arg)
3884 if (copy_from_user(karg, uarg, csmi_sas_get_location_sz)) {
3885 printk(KERN_ERR "%s@%d::%s() - "
3886 "Unable to read in csmi_sas_phy_control_buffer "
3887 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3888 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3889 free_pages((unsigned long)karg, memory_pages);
3890 return -EFAULT;
3891 }
3892 @@ -5808,22 +5802,22 @@ csmisas_get_location(unsigned long arg)
3893 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
3894 &ioc)) < 0) || (ioc == NULL)) {
3895 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3896 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3897 + __FILE__, __func__, __LINE__, iocnum);
3898 free_pages((unsigned long)karg, memory_pages);
3899 return -ENODEV;
3900 }
3901
3902 if (!csmisas_is_this_sas_cntr(ioc)) {
3903 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3904 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3905 + __FILE__, __func__, __LINE__, iocnum);
3906 free_pages((unsigned long)karg, memory_pages);
3907 return -ENODEV;
3908 }
3909
3910 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3911 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3912
3913 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
3914 - if(karg->bLengthOfLocationIdentifier !=
3915 + if (karg->bLengthOfLocationIdentifier !=
3916 sizeof(CSMI_SAS_LOCATION_IDENTIFIER))
3917 goto cim_sas_get_location_exit;
3918
3919 @@ -5834,12 +5828,12 @@ csmisas_get_location(unsigned long arg)
3920
3921 /* RAID SUPPORT */
3922 if (ioc->raid_data.pIocPg2 && sas_info->is_logical_volume) {
3923 - for (i=0; i<ioc->raid_data.pIocPg2->NumActiveVolumes; i++){
3924 + for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
3925 if (sas_info->fw.id ==
3926 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID &&
3927 sas_info->fw.channel ==
3928 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus) {
3929 - if(csmisas_fill_location_data_raid(ioc, karg,
3930 + if (csmisas_fill_location_data_raid(ioc, karg,
3931 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus,
3932 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) == 0)
3933 karg->IoctlHeader.ReturnCode =
3934 @@ -5858,13 +5852,13 @@ csmisas_get_location(unsigned long arg)
3935
3936 /* make sure there's enough room to populate the Location[] struct */
3937 if ((csmi_sas_get_location_sz -
3938 - offsetof(CSMI_SAS_GET_LOCATION_BUFFER,Location)) <
3939 + offsetof(CSMI_SAS_GET_LOCATION_BUFFER, Location)) <
3940 sizeof(CSMI_SAS_LOCATION_IDENTIFIER))
3941 goto cim_sas_get_location_exit;
3942
3943 - karg->bNumberOfLocationIdentifiers=1;
3944 - karg->Location[0].bLocationFlags=0;
3945 - if((csmisas_fill_location_data(ioc, sas_info->fw.channel,
3946 + karg->bNumberOfLocationIdentifiers = 1;
3947 + karg->Location[0].bLocationFlags = 0;
3948 + if ((csmisas_fill_location_data(ioc, sas_info->fw.channel,
3949 sas_info->fw.id, karg->bIdentify, &karg->Location[0])) == 0)
3950 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
3951 else
3952 @@ -5877,12 +5871,12 @@ csmisas_get_location(unsigned long arg)
3953 if (copy_to_user(uarg, karg, csmi_sas_get_location_sz)) {
3954 printk(KERN_ERR "%s@%d::%s() - "
3955 "Unable to write out csmi_sas_get_location_buffer "
3956 - "@ %p\n",__FILE__, __LINE__, __FUNCTION__, uarg);
3957 + "@ %p\n", __FILE__, __LINE__, __func__, uarg);
3958 free_pages((unsigned long)karg, memory_pages);
3959 return -EFAULT;
3960 }
3961
3962 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3963 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3964 free_pages((unsigned long)karg, memory_pages);
3965 return 0;
3966 }
3967 Index: linux-2.6.27/drivers/message/fusion/csmi/csmisas.h
3968 ===================================================================
3969 --- linux-2.6.27.orig/drivers/message/fusion/csmi/csmisas.h
3970 +++ linux-2.6.27/drivers/message/fusion/csmi/csmisas.h
3971 @@ -87,10 +87,10 @@ Revision History:
3972 #ifndef _CSMI_SAS_H_
3973 #define _CSMI_SAS_H_
3974
3975 -// CSMI Specification Revision, the intent is that all versions of the
3976 -// specification will be backward compatible after the 1.00 release.
3977 -// Major revision number, corresponds to xxxx. of CSMI specification
3978 -// Minor revision number, corresponds to .xxxx of CSMI specification
3979 +/* CSMI Specification Revision, the intent is that all versions of the
3980 + specification will be backward compatible after the 1.00 release.
3981 + Major revision number, corresponds to xxxx. of CSMI specification
3982 + Minor revision number, corresponds to .xxxx of CSMI specification */
3983 #define CSMI_MAJOR_REVISION 0
3984 #define CSMI_MINOR_REVISION 90
3985
3986 @@ -104,60 +104,60 @@ Revision History:
3987 /* TARGET OS LINUX SPECIFIC CODE */
3988 /*************************************************************************/
3989
3990 -// EDM #ifdef _linux
3991 #ifdef __KERNEL__
3992
3993 -// Linux base types
3994 +/* Linux base types */
3995
3996 #include <linux/types.h>
3997
3998 #define __i8 char
3999
4000 -// pack definition
4001 +/* pack definition */
4002
4003 -// EDM #define CSMI_SAS_BEGIN_PACK(x) pack(x)
4004 -// EDM #define CSMI_SAS_END_PACK pack()
4005 +#if 0
4006 + #define CSMI_SAS_BEGIN_PACK(x) pack(x)
4007 + #define CSMI_SAS_END_PACK pack()
4008
4009 -// IOCTL Control Codes
4010 -// (IoctlHeader.ControlCode)
4011 + /* IOCTL Control Codes */
4012 + /* (IoctlHeader.ControlCode) */
4013
4014 -// Control Codes prior to 0.77
4015 + /* Control Codes prior to 0.77 */
4016
4017 -// Control Codes requiring CSMI_ALL_SIGNATURE
4018 + /* Control Codes requiring CSMI_ALL_SIGNATURE */
4019
4020 -// #define CC_CSMI_SAS_GET_DRIVER_INFO 0x12345678
4021 -// #define CC_CSMI_SAS_GET_CNTLR_CONFIG 0x23456781
4022 -// #define CC_CSMI_SAS_GET_CNTLR_STATUS 0x34567812
4023 -// #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0x92345678
4024 + #define CC_CSMI_SAS_GET_DRIVER_INFO 0x12345678
4025 + #define CC_CSMI_SAS_GET_CNTLR_CONFIG 0x23456781
4026 + #define CC_CSMI_SAS_GET_CNTLR_STATUS 0x34567812
4027 + #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0x92345678
4028
4029 -// Control Codes requiring CSMI_RAID_SIGNATURE
4030 + /* Control Codes requiring CSMI_RAID_SIGNATURE */
4031
4032 -// #define CC_CSMI_SAS_GET_RAID_INFO 0x45678123
4033 -// #define CC_CSMI_SAS_GET_RAID_CONFIG 0x56781234
4034 + #define CC_CSMI_SAS_GET_RAID_INFO 0x45678123
4035 + #define CC_CSMI_SAS_GET_RAID_CONFIG 0x56781234
4036
4037 -// Control Codes requiring CSMI_SAS_SIGNATURE
4038 + /* Control Codes requiring CSMI_SAS_SIGNATURE */
4039
4040 -// #define CC_CSMI_SAS_GET_PHY_INFO 0x67812345
4041 -// #define CC_CSMI_SAS_SET_PHY_INFO 0x78123456
4042 -// #define CC_CSMI_SAS_GET_LINK_ERRORS 0x81234567
4043 -// #define CC_CSMI_SAS_SMP_PASSTHRU 0xA1234567
4044 -// #define CC_CSMI_SAS_SSP_PASSTHRU 0xB1234567
4045 -// #define CC_CSMI_SAS_STP_PASSTHRU 0xC1234567
4046 -// #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xD1234567
4047 -// #define CC_CSMI_SAS_GET_SCSI_ADDRESS 0xE1234567
4048 -// #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xF1234567
4049 -// #define CC_CSMI_SAS_TASK_MANAGEMENT 0xA2345678
4050 -
4051 -// Control Codes for 0.77 and later
4052 + #define CC_CSMI_SAS_GET_PHY_INFO 0x67812345
4053 + #define CC_CSMI_SAS_SET_PHY_INFO 0x78123456
4054 + #define CC_CSMI_SAS_GET_LINK_ERRORS 0x81234567
4055 + #define CC_CSMI_SAS_SMP_PASSTHRU 0xA1234567
4056 + #define CC_CSMI_SAS_SSP_PASSTHRU 0xB1234567
4057 + #define CC_CSMI_SAS_STP_PASSTHRU 0xC1234567
4058 + #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xD1234567
4059 + #define CC_CSMI_SAS_GET_SCSI_ADDRESS 0xE1234567
4060 + #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xF1234567
4061 + #define CC_CSMI_SAS_TASK_MANAGEMENT 0xA2345678
4062 +#endif
4063 + /* Control Codes for 0.77 and later */
4064
4065 -// Control Codes requiring CSMI_ALL_SIGNATURE
4066 + /* Control Codes requiring CSMI_ALL_SIGNATURE */
4067
4068 #define CC_CSMI_SAS_GET_DRIVER_INFO 0xCC770001
4069 #define CC_CSMI_SAS_GET_CNTLR_CONFIG 0xCC770002
4070 #define CC_CSMI_SAS_GET_CNTLR_STATUS 0xCC770003
4071 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0xCC770004
4072
4073 -// Control Codes requiring CSMI_RAID_SIGNATURE
4074 +/* Control Codes requiring CSMI_RAID_SIGNATURE */
4075
4076 #define CC_CSMI_SAS_GET_RAID_INFO 0xCC77000A
4077 #define CC_CSMI_SAS_GET_RAID_CONFIG 0xCC77000B
4078 @@ -166,7 +166,7 @@ Revision History:
4079 #define CC_CSMI_SAS_GET_RAID_ELEMENT 0xCC77000E
4080 #define CC_CSMI_SAS_SET_RAID_OPERATION 0xCC77000F
4081
4082 -// Control Codes requiring CSMI_SAS_SIGNATURE
4083 +/* Control Codes requiring CSMI_SAS_SIGNATURE */
4084
4085 #define CC_CSMI_SAS_GET_PHY_INFO 0xCC770014
4086 #define CC_CSMI_SAS_SET_PHY_INFO 0xCC770015
4087 @@ -182,14 +182,14 @@ Revision History:
4088 #define CC_CSMI_SAS_GET_LOCATION 0xCC770025
4089
4090
4091 -// Control Codes requiring CSMI_PHY_SIGNATURE
4092 +/* Control Codes requiring CSMI_PHY_SIGNATURE */
4093
4094 #define CC_CSMI_SAS_PHY_CONTROL 0xCC77003C
4095
4096 -// EDM #pragma CSMI_SAS_BEGIN_PACK(8)
4097 +/* #pragma CSMI_SAS_BEGIN_PACK(8) */
4098 #pragma pack(8)
4099
4100 -// IOCTL_HEADER
4101 +/* IOCTL_HEADER */
4102 typedef struct _IOCTL_HEADER {
4103 __u32 IOControllerNumber;
4104 __u32 Length;
4105 @@ -199,189 +199,18 @@ typedef struct _IOCTL_HEADER {
4106 } IOCTL_HEADER,
4107 *PIOCTL_HEADER;
4108
4109 -// EDM #pragma CSMI_SAS_END_PACK
4110 -#pragma pack()
4111 -
4112 -#endif
4113 -
4114 -/*************************************************************************/
4115 -/* TARGET OS WINDOWS SPECIFIC CODE */
4116 -/*************************************************************************/
4117 -
4118 -#ifdef _WIN32
4119 -
4120 -// windows IOCTL definitions
4121 -
4122 -#ifndef _NTDDSCSIH_
4123 -#include <ntddscsi.h>
4124 -#endif
4125 -
4126 -// pack definition
4127 -
4128 -#if defined _MSC_VER
4129 - #define CSMI_SAS_BEGIN_PACK(x) pack(push,x)
4130 - #define CSMI_SAS_END_PACK pack(pop)
4131 -#elif defined __BORLANDC__
4132 - #define CSMI_SAS_BEGIN_PACK(x) option -a##x
4133 - #define CSMI_SAS_END_PACK option -a.
4134 -#else
4135 - #error "CSMISAS.H - Must externally define a pack compiler designator."
4136 -#endif
4137 -
4138 -// base types
4139 -
4140 -#define __u8 unsigned char
4141 -#define __u16 unsigned short
4142 -#define __u32 unsigned long
4143 -#define __u64 unsigned __int64
4144 -
4145 -#define __i8 char
4146 -
4147 -// IOCTL Control Codes
4148 -// (IoctlHeader.ControlCode)
4149 -
4150 -// Control Codes requiring CSMI_ALL_SIGNATURE
4151 -
4152 -#define CC_CSMI_SAS_GET_DRIVER_INFO 1
4153 -#define CC_CSMI_SAS_GET_CNTLR_CONFIG 2
4154 -#define CC_CSMI_SAS_GET_CNTLR_STATUS 3
4155 -#define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 4
4156 -
4157 -// Control Codes requiring CSMI_RAID_SIGNATURE
4158 -
4159 -#define CC_CSMI_SAS_GET_RAID_INFO 10
4160 -#define CC_CSMI_SAS_GET_RAID_CONFIG 11
4161 -#define CC_CSMI_SAS_GET_RAID_FEATURES 12
4162 -#define CC_CSMI_SAS_SET_RAID_CONTROL 13
4163 -#define CC_CSMI_SAS_GET_RAID_ELEMENT 14
4164 -#define CC_CSMI_SAS_SET_RAID_OPERATION 15
4165 -
4166 -// Control Codes requiring CSMI_SAS_SIGNATURE
4167 -
4168 -#define CC_CSMI_SAS_GET_PHY_INFO 20
4169 -#define CC_CSMI_SAS_SET_PHY_INFO 21
4170 -#define CC_CSMI_SAS_GET_LINK_ERRORS 22
4171 -#define CC_CSMI_SAS_SMP_PASSTHRU 23
4172 -#define CC_CSMI_SAS_SSP_PASSTHRU 24
4173 -#define CC_CSMI_SAS_STP_PASSTHRU 25
4174 -#define CC_CSMI_SAS_GET_SATA_SIGNATURE 26
4175 -#define CC_CSMI_SAS_GET_SCSI_ADDRESS 27
4176 -#define CC_CSMI_SAS_GET_DEVICE_ADDRESS 28
4177 -#define CC_CSMI_SAS_TASK_MANAGEMENT 29
4178 -#define CC_CSMI_SAS_GET_CONNECTOR_INFO 30
4179 -#define CC_CSMI_SAS_GET_LOCATION 31
4180 -
4181 -// Control Codes requiring CSMI_PHY_SIGNATURE
4182 -
4183 -#define CC_CSMI_SAS_PHY_CONTROL 60
4184 -
4185 -#define IOCTL_HEADER SRB_IO_CONTROL
4186 -#define PIOCTL_HEADER PSRB_IO_CONTROL
4187 -
4188 -#endif
4189 -
4190 -/*************************************************************************/
4191 -/* TARGET OS NETWARE SPECIFIC CODE */
4192 -/*************************************************************************/
4193 -
4194 -#ifdef _NETWARE
4195 -
4196 -// NetWare IOCTL definitions
4197 -
4198 -#define CSMI_SAS_BEGIN_PACK(x) pack(x)
4199 -#define CSMI_SAS_END_PACK pack()
4200 -
4201 -#ifndef LONG
4202 -typedef unsigned long LONG;
4203 -#endif
4204 -
4205 -#ifndef WORD
4206 -typedef unsigned short WORD;
4207 -#endif
4208 -
4209 -#ifndef BYTE
4210 -typedef unsigned char BYTE;
4211 -#endif
4212 -
4213 -/* Need to have these definitions for Netware */
4214 -#define __u8 unsigned char
4215 -#define __u16 unsigned short
4216 -#define __u32 unsigned long
4217 -#define __u64 unsigned __int64
4218 -
4219 -#define __i8 char
4220 -
4221 -
4222 -// EDM #pragma CSMI_SAS_BEGIN_PACK(8)
4223 -#pragma pack(8)
4224 -
4225 -// IOCTL_HEADER
4226 -typedef struct _IOCTL_HEADER {
4227 - __u32 Length;
4228 - __u32 ReturnCode;
4229 -} IOCTL_HEADER,
4230 - *PIOCTL_HEADER;
4231 -
4232 -// EDM #pragma CSMI_SAS_END_PACK
4233 #pragma pack()
4234
4235 -// IOCTL Control Codes
4236 -// (IoctlHeader.ControlCode)
4237 -
4238 -// Control Codes requiring CSMI_ALL_SIGNATURE
4239 -
4240 -#define CC_CSMI_SAS_GET_DRIVER_INFO 0x01FF0001
4241 -#define CC_CSMI_SAS_GET_CNTLR_CONFIG 0x01FF0002
4242 -#define CC_CSMI_SAS_GET_CNTLR_STATUS 0x01FF0003
4243 -#define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0x01FF0004
4244 -
4245 -// Control Codes requiring CSMI_RAID_SIGNATURE
4246 -
4247 -#define CC_CSMI_SAS_GET_RAID_INFO 0x01FF000A
4248 -#define CC_CSMI_SAS_GET_RAID_CONFIG 0x01FF000B
4249 -#define CC_CSMI_SAS_GET_RAID_FEATURES 0x01FF000C
4250 -#define CC_CSMI_SAS_SET_RAID_CONTROL 0x01FF000D
4251 -#define CC_CSMI_SAS_GET_RAID_ELEMENT 0x01FF000E
4252 -#define CC_CSMI_SAS_SET_RAID_OPERATION 0x01FF000F
4253 -
4254 -// Control Codes requiring CSMI_SAS_SIGNATURE
4255 -
4256 -#define CC_CSMI_SAS_GET_PHY_INFO 0x01FF0014
4257 -#define CC_CSMI_SAS_SET_PHY_INFO 0x01FF0015
4258 -#define CC_CSMI_SAS_GET_LINK_ERRORS 0x01FF0016
4259 -#define CC_CSMI_SAS_SMP_PASSTHRU 0x01FF0017
4260 -#define CC_CSMI_SAS_SSP_PASSTHRU 0x01FF0018
4261 -#define CC_CSMI_SAS_STP_PASSTHRU 0x01FF0019
4262 -#define CC_CSMI_SAS_GET_SATA_SIGNATURE 0x01FF001A
4263 -#define CC_CSMI_SAS_GET_SCSI_ADDRESS 0x01FF001B
4264 -#define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0x01FF001C
4265 -#define CC_CSMI_SAS_TASK_MANAGEMENT 0x01FF001D
4266 -#define CC_CSMI_SAS_GET_CONNECTOR_INFO 0x01FF001E
4267 -#define CC_CSMI_SAS_GET_LOCATION 0x01FF001F
4268 -
4269 -// Control Codes requiring CSMI_PHY_SIGNATURE
4270 -
4271 -#define CC_CSMI_SAS_PHY_CONTROL 60
4272 -
4273 #endif
4274
4275 /*************************************************************************/
4276 -/* TARGET OS NOT DEFINED ERROR */
4277 -/*************************************************************************/
4278 -
4279 -// EDM
4280 -//#if (!_WIN32 && !_linux && !_NETWARE)
4281 -// #error "Unknown target OS."
4282 -//#endif
4283 -
4284 -/*************************************************************************/
4285 /* OS INDEPENDENT CODE */
4286 /*************************************************************************/
4287
4288 /* * * * * * * * * * Class Independent IOCTL Constants * * * * * * * * * */
4289
4290 -// Return codes for all IOCTL's regardless of class
4291 -// (IoctlHeader.ReturnCode)
4292 +/* Return codes for all IOCTL's regardless of class*/
4293 +/* (IoctlHeader.ReturnCode) */
4294
4295 #define CSMI_SAS_STATUS_SUCCESS 0
4296 #define CSMI_SAS_STATUS_FAILED 1
4297 @@ -389,51 +218,51 @@ typedef struct _IOCTL_HEADER {
4298 #define CSMI_SAS_STATUS_INVALID_PARAMETER 3
4299 #define CSMI_SAS_STATUS_WRITE_ATTEMPTED 4
4300
4301 -// Signature value
4302 -// (IoctlHeader.Signature)
4303 +/* Signature value
4304 + (IoctlHeader.Signature) */
4305
4306 #define CSMI_ALL_SIGNATURE "CSMIALL"
4307
4308 -// Timeout value default of 60 seconds
4309 -// (IoctlHeader.Timeout)
4310 +/* Timeout value default of 60 seconds
4311 + (IoctlHeader.Timeout) */
4312
4313 #define CSMI_ALL_TIMEOUT 60
4314
4315 -// Direction values for data flow on this IOCTL
4316 -// (IoctlHeader.Direction, Linux only)
4317 +/* Direction values for data flow on this IOCTL
4318 + (IoctlHeader.Direction, Linux only) */
4319 #define CSMI_SAS_DATA_READ 0
4320 #define CSMI_SAS_DATA_WRITE 1
4321
4322 -// I/O Bus Types
4323 -// ISA and EISA bus types are not supported
4324 -// (bIoBusType)
4325 +/* I/O Bus Types
4326 + ISA and EISA bus types are not supported
4327 + (bIoBusType) */
4328
4329 #define CSMI_SAS_BUS_TYPE_PCI 3
4330 #define CSMI_SAS_BUS_TYPE_PCMCIA 4
4331
4332 -// Controller Status
4333 -// (uStatus)
4334 +/* Controller Status
4335 + (uStatus) */
4336
4337 #define CSMI_SAS_CNTLR_STATUS_GOOD 1
4338 #define CSMI_SAS_CNTLR_STATUS_FAILED 2
4339 #define CSMI_SAS_CNTLR_STATUS_OFFLINE 3
4340 #define CSMI_SAS_CNTLR_STATUS_POWEROFF 4
4341
4342 -// Offline Status Reason
4343 -// (uOfflineReason)
4344 +/* Offline Status Reason
4345 + (uOfflineReason) */
4346
4347 #define CSMI_SAS_OFFLINE_REASON_NO_REASON 0
4348 #define CSMI_SAS_OFFLINE_REASON_INITIALIZING 1
4349 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_DEGRADED 2
4350 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_FAILURE 3
4351
4352 -// Controller Class
4353 -// (bControllerClass)
4354 +/* Controller Class
4355 + (bControllerClass) */
4356
4357 #define CSMI_SAS_CNTLR_CLASS_HBA 5
4358
4359 -// Controller Flag bits
4360 -// (uControllerFlags)
4361 +/* Controller Flag bits
4362 + (uControllerFlags) */
4363
4364 #define CSMI_SAS_CNTLR_SAS_HBA 0x00000001
4365 #define CSMI_SAS_CNTLR_SAS_RAID 0x00000002
4366 @@ -441,32 +270,29 @@ typedef struct _IOCTL_HEADER {
4367 #define CSMI_SAS_CNTLR_SATA_RAID 0x00000008
4368 #define CSMI_SAS_CNTLR_SMART_ARRAY 0x00000010
4369
4370 -// for firmware download
4371 +/* for firmware download */
4372 #define CSMI_SAS_CNTLR_FWD_SUPPORT 0x00010000
4373 #define CSMI_SAS_CNTLR_FWD_ONLINE 0x00020000
4374 #define CSMI_SAS_CNTLR_FWD_SRESET 0x00040000
4375 #define CSMI_SAS_CNTLR_FWD_HRESET 0x00080000
4376 #define CSMI_SAS_CNTLR_FWD_RROM 0x00100000
4377
4378 -// for RAID configuration supported
4379 +/* for RAID configuration supported */
4380 #define CSMI_SAS_CNTLR_RAID_CFG_SUPPORT 0x01000000
4381
4382 -// Download Flag bits
4383 -// (uDownloadFlags)
4384 +/* Download Flag bits (uDownloadFlags) */
4385 #define CSMI_SAS_FWD_VALIDATE 0x00000001
4386 #define CSMI_SAS_FWD_SOFT_RESET 0x00000002
4387 #define CSMI_SAS_FWD_HARD_RESET 0x00000004
4388
4389 -// Firmware Download Status
4390 -// (usStatus)
4391 +/* Firmware Download Status (usStatus) */
4392 #define CSMI_SAS_FWD_SUCCESS 0
4393 #define CSMI_SAS_FWD_FAILED 1
4394 #define CSMI_SAS_FWD_USING_RROM 2
4395 #define CSMI_SAS_FWD_REJECT 3
4396 #define CSMI_SAS_FWD_DOWNREV 4
4397
4398 -// Firmware Download Severity
4399 -// (usSeverity>
4400 +/* Firmware Download Severity (usSeverity) */
4401 #define CSMI_SAS_FWD_INFORMATION 0
4402 #define CSMI_SAS_FWD_WARNING 1
4403 #define CSMI_SAS_FWD_ERROR 2
4404 @@ -474,25 +300,22 @@ typedef struct _IOCTL_HEADER {
4405
4406 /* * * * * * * * * * SAS RAID Class IOCTL Constants * * * * * * * * */
4407
4408 -// Return codes for the RAID IOCTL's regardless of class
4409 -// (IoctlHeader.ReturnCode)
4410 +/* Return codes for the RAID IOCTL's regardless of class */
4411 +/* (IoctlHeader.ReturnCode) */
4412
4413 #define CSMI_SAS_RAID_SET_OUT_OF_RANGE 1000
4414 #define CSMI_SAS_RAID_SET_BUFFER_TOO_SMALL 1001
4415 #define CSMI_SAS_RAID_SET_DATA_CHANGED 1002
4416
4417 -// Signature value
4418 -// (IoctlHeader.Signature)
4419 +/* Signature value (IoctlHeader.Signature) */
4420
4421 #define CSMI_RAID_SIGNATURE "CSMIARY"
4422
4423 -// Timeout value default of 60 seconds
4424 -// (IoctlHeader.Timeout)
4425 +/* Timeout value default of 60 seconds (IoctlHeader.Timeout) */
4426
4427 #define CSMI_RAID_TIMEOUT 60
4428
4429 -// RAID Types
4430 -// (bRaidType)
4431 +/* RAID Types (bRaidType) */
4432 #define CSMI_SAS_RAID_TYPE_NONE 0
4433 #define CSMI_SAS_RAID_TYPE_0 1
4434 #define CSMI_SAS_RAID_TYPE_1 2
4435 @@ -504,12 +327,11 @@ typedef struct _IOCTL_HEADER {
4436 #define CSMI_SAS_RAID_TYPE_VOLUME 8
4437 #define CSMI_SAS_RAID_TYPE_1E 9
4438 #define CSMI_SAS_RAID_TYPE_OTHER 255
4439 -// the last value 255 was already defined for other
4440 -// so end is defined as 254
4441 +/* the last value 255 was already defined for other so end is defined as 254 */
4442 #define CSMI_SAS_RAID_TYPE_END 254
4443
4444 -// RAID Status
4445 -// (bStatus)
4446 +/* RAID Status (bStatus) */
4447 +
4448 #define CSMI_SAS_RAID_SET_STATUS_OK 0
4449 #define CSMI_SAS_RAID_SET_STATUS_DEGRADED 1
4450 #define CSMI_SAS_RAID_SET_STATUS_REBUILDING 2
4451 @@ -519,19 +341,16 @@ typedef struct _IOCTL_HEADER {
4452 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_REBUILD 6
4453 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_TRANSFORMATION 7
4454
4455 -// RAID Drive Count
4456 -// (bDriveCount, 0xF1 to 0xFF are reserved)
4457 +/* RAID Drive Count (bDriveCount, 0xF1 to 0xFF are reserved) */
4458 #define CSMI_SAS_RAID_DRIVE_COUNT_TOO_BIG 0xF1
4459 #define CSMI_SAS_RAID_DRIVE_COUNT_SUPRESSED 0xF2
4460
4461 -// RAID Data Type
4462 -// (bDataType)
4463 +/* RAID Data Type (bDataType) */
4464 #define CSMI_SAS_RAID_DATA_DRIVES 0
4465 #define CSMI_SAS_RAID_DATA_DEVICE_ID 1
4466 #define CSMI_SAS_RAID_DATA_ADDITIONAL_DATA 2
4467
4468 -// RAID Drive Status
4469 -// (bDriveStatus)
4470 +/* RAID Drive Status (bDriveStatus) */
4471 #define CSMI_SAS_DRIVE_STATUS_OK 0
4472 #define CSMI_SAS_DRIVE_STATUS_REBUILDING 1
4473 #define CSMI_SAS_DRIVE_STATUS_FAILED 2
4474 @@ -539,15 +358,13 @@ typedef struct _IOCTL_HEADER {
4475 #define CSMI_SAS_DRIVE_STATUS_OFFLINE 4
4476 #define CSMI_SAS_DRIVE_STATUS_QUEUED_FOR_REBUILD 5
4477
4478 -// RAID Drive Usage
4479 -// (bDriveUsage)
4480 +/* RAID Drive Usage (bDriveUsage) */
4481 #define CSMI_SAS_DRIVE_CONFIG_NOT_USED 0
4482 #define CSMI_SAS_DRIVE_CONFIG_MEMBER 1
4483 #define CSMI_SAS_DRIVE_CONFIG_SPARE 2
4484 #define CSMI_SAS_DRIVE_CONFIG_SPARE_ACTIVE 3
4485
4486 -// RAID Drive Type
4487 -// (bDriveType)
4488 +/* RAID Drive Type (bDriveType) */
4489 #define CSMI_SAS_DRIVE_TYPE_UNKNOWN 0
4490 #define CSMI_SAS_DRIVE_TYPE_SINGLE_PORT_SAS 1
4491 #define CSMI_SAS_DRIVE_TYPE_DUAL_PORT_SAS 2
4492 @@ -555,23 +372,20 @@ typedef struct _IOCTL_HEADER {
4493 #define CSMI_SAS_DRIVE_TYPE_SATA_PS 4
4494 #define CSMI_SAS_DRIVE_TYPE_OTHER 255
4495
4496 -// RAID Write Protect
4497 -// (bWriteProtect)
4498 +/* RAID Write Protect (bWriteProtect) */
4499 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNKNOWN 0
4500 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNCHANGED 0
4501 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_ENABLED 1
4502 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_DISABLED 2
4503
4504 -// RAID Cache Setting
4505 -// (bCacheSetting)
4506 +/* RAID Cache Setting (bCacheSetting) */
4507 #define CSMI_SAS_RAID_SET_CACHE_UNKNOWN 0
4508 #define CSMI_SAS_RAID_SET_CACHE_UNCHANGED 0
4509 #define CSMI_SAS_RAID_SET_CACHE_ENABLED 1
4510 #define CSMI_SAS_RAID_SET_CACHE_DISABLED 2
4511 #define CSMI_SAS_RAID_SET_CACHE_CORRUPT 3
4512
4513 -// RAID Features
4514 -// (uFeatures)
4515 +/* RAID Features (uFeatures) */
4516 #define CSMI_SAS_RAID_FEATURE_TRANSFORMATION 0x00000001
4517 #define CSMI_SAS_RAID_FEATURE_REBUILD 0x00000002
4518 #define CSMI_SAS_RAID_FEATURE_SPLIT_MIRROR 0x00000004
4519 @@ -580,8 +394,7 @@ typedef struct _IOCTL_HEADER {
4520 #define CSMI_SAS_RAID_FEATURE_SURFACE_SCAN 0x00000020
4521 #define CSMI_SAS_RAID_FEATURE_SPARES_SHARED 0x00000040
4522
4523 -// RAID Priority
4524 -// (bDefaultTransformPriority, etc.)
4525 +/* RAID Priority (bDefaultTransformPriority, etc.) */
4526 #define CSMI_SAS_PRIORITY_UNKNOWN 0
4527 #define CSMI_SAS_PRIORITY_UNCHANGED 0
4528 #define CSMI_SAS_PRIORITY_AUTO 1
4529 @@ -590,30 +403,25 @@ typedef struct _IOCTL_HEADER {
4530 #define CSMI_SAS_PRIORITY_MEDIUM 4
4531 #define CSMI_SAS_PRIORITY_HIGH 5
4532
4533 -// RAID Transformation Rules
4534 -// (uRaidSetTransformationRules)
4535 +/* RAID Transformation Rules (uRaidSetTransformationRules) */
4536 #define CSMI_SAS_RAID_RULE_AVAILABLE_MEMORY 0x00000001
4537 #define CSMI_SAS_RAID_RULE_OVERLAPPED_EXTENTS 0x00000002
4538
4539 -// RAID Cache Ratios Supported
4540 -// (bCacheRatiosSupported)
4541 -// from 0 to 100 defines the write to read ratio, 0 is 100% write
4542 +/* RAID Cache Ratios Supported (bCacheRatiosSupported) */
4543 +/* from 0 to 100 defines the write to read ratio, 0 is 100% write */
4544 #define CSMI_SAS_RAID_CACHE_RATIO_RANGE 101
4545 #define CSMI_SAS_RAID_CACHE_RATIO_FIXED 102
4546 #define CSMI_SAS_RAID_CACHE_RATIO_AUTO 103
4547 #define CSMI_SAS_RAID_CACHE_RATIO_END 255
4548
4549 -// RAID Cache Ratio Flag
4550 -// (bCacheRatioFlag)
4551 +/* RAID Cache Ratio Flag (bCacheRatioFlag) */
4552 #define CSMI_SAS_RAID_CACHE_RATIO_DISABLE 0
4553 #define CSMI_SAS_RAID_CACHE_RATIO_ENABLE 1
4554
4555 -// RAID Clear Configuration Signature
4556 -// (bClearConfiguration)
4557 +/* RAID Clear Configuration Signature (bClearConfiguration) */
4558 #define CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE "RAIDCLR"
4559
4560 -// RAID Failure Codes
4561 -// (uFailureCode)
4562 +/* RAID Failure Codes (uFailureCode) */
4563 #define CSMI_SAS_FAIL_CODE_OK 0
4564 #define CSMI_SAS_FAIL_CODE_PARAMETER_INVALID 1000
4565 #define CSMI_SAS_FAIL_CODE_TRANSFORM_PRIORITY_INVALID 1001
4566 @@ -638,22 +446,19 @@ typedef struct _IOCTL_HEADER {
4567
4568 #define CSMI_SAS_FAIL_CODE_WAIT_FOR_OPERATION 3000
4569
4570 -// RAID Enumeration Types
4571 -// (uEnumerationType)
4572 +/* RAID Enumeration Types (uEnumerationType) */
4573 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE 0
4574 #define CSMI_SAS_RAID_ELEMENT_TYPE_MODULE 1
4575 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE_RAID_SET 2
4576 #define CSMI_SAS_RAID_ELEMENT_TYPE_EXTENT_DRIVE 3
4577
4578 -// RAID Extent Types
4579 -// (bExtentType)
4580 +/* RAID Extent Types (bExtentType) */
4581 #define CSMI_SAS_RAID_EXTENT_RESERVED 0
4582 #define CSMI_SAS_RAID_EXTENT_METADATA 1
4583 #define CSMI_SAS_RAID_EXTENT_ALLOCATED 2
4584 #define CSMI_SAS_RAID_EXTENT_UNALLOCATED 3
4585
4586 -// RAID Operation Types
4587 -// (uOperationType)
4588 +/* RAID Operation Types (uOperationType) */
4589 #define CSMI_SAS_RAID_SET_CREATE 0
4590 #define CSMI_SAS_RAID_SET_LABEL 1
4591 #define CSMI_SAS_RAID_SET_TRANSFORM 2
4592 @@ -663,23 +468,20 @@ typedef struct _IOCTL_HEADER {
4593 #define CSMI_SAS_RAID_SET_ONLINE_STATE 6
4594 #define CSMI_SAS_RAID_SET_SPARE 7
4595
4596 -// RAID Transform Types
4597 -// (bTransformType)
4598 +/* RAID Transform Types (bTransformType) */
4599 #define CSMI_SAS_RAID_SET_TRANSFORM_SPLIT_MIRROR 0
4600 #define CSMI_SAS_RAID_SET_TRANSFORM_MERGE_RAID_0 1
4601 #define CSMI_SAS_RAID_SET_TRANSFORM_LUN_RENUMBER 2
4602 #define CSMI_SAS_RAID_SET_TRANSFORM_RAID_SET 3
4603
4604 -// RAID Online State
4605 -// (bOnlineState)
4606 +/* RAID Online State (bOnlineState) */
4607 #define CSMI_SAS_RAID_SET_STATE_UNKNOWN 0
4608 #define CSMI_SAS_RAID_SET_STATE_ONLINE 1
4609 #define CSMI_SAS_RAID_SET_STATE_OFFLINE 2
4610
4611 /* * * * * * * * * * SAS HBA Class IOCTL Constants * * * * * * * * * */
4612
4613 -// Return codes for SAS IOCTL's
4614 -// (IoctlHeader.ReturnCode)
4615 +/* Return codes for SAS IOCTL's (IoctlHeader.ReturnCode) */
4616
4617 #define CSMI_SAS_PHY_INFO_CHANGED CSMI_SAS_STATUS_SUCCESS
4618 #define CSMI_SAS_PHY_INFO_NOT_CHANGEABLE 2000
4619 @@ -700,18 +502,15 @@ typedef struct _IOCTL_HEADER {
4620 #define CSMI_SAS_NO_SCSI_ADDRESS 2013
4621 #define CSMI_SAS_NO_DEVICE_ADDRESS 2014
4622
4623 -// Signature value
4624 -// (IoctlHeader.Signature)
4625 +/* Signature value (IoctlHeader.Signature) */
4626
4627 #define CSMI_SAS_SIGNATURE "CSMISAS"
4628
4629 -// Timeout value default of 60 seconds
4630 -// (IoctlHeader.Timeout)
4631 +/* Timeout value default of 60 seconds (IoctlHeader.Timeout) */
4632
4633 #define CSMI_SAS_TIMEOUT 60
4634
4635 -// Device types
4636 -// (bDeviceType)
4637 +/* Device types (bDeviceType) */
4638
4639 #define CSMI_SAS_PHY_UNUSED 0x00
4640 #define CSMI_SAS_NO_DEVICE_ATTACHED 0x00
4641 @@ -719,16 +518,15 @@ typedef struct _IOCTL_HEADER {
4642 #define CSMI_SAS_EDGE_EXPANDER_DEVICE 0x20
4643 #define CSMI_SAS_FANOUT_EXPANDER_DEVICE 0x30
4644
4645 -// Protocol options
4646 -// (bInitiatorPortProtocol, bTargetPortProtocol)
4647 +/* Protocol options (bInitiatorPortProtocol, bTargetPortProtocol) */
4648
4649 #define CSMI_SAS_PROTOCOL_SATA 0x01
4650 #define CSMI_SAS_PROTOCOL_SMP 0x02
4651 #define CSMI_SAS_PROTOCOL_STP 0x04
4652 #define CSMI_SAS_PROTOCOL_SSP 0x08
4653
4654 -// Negotiated and hardware link rates
4655 -// (bNegotiatedLinkRate, bMinimumLinkRate, bMaximumLinkRate)
4656 +/* Negotiated and hardware link rates */
4657 +/* (bNegotiatedLinkRate, bMinimumLinkRate, bMaximumLinkRate) */
4658
4659 #define CSMI_SAS_LINK_RATE_UNKNOWN 0x00
4660 #define CSMI_SAS_PHY_DISABLED 0x01
4661 @@ -739,8 +537,7 @@ typedef struct _IOCTL_HEADER {
4662 #define CSMI_SAS_LINK_RATE_3_0_GBPS 0x09
4663 #define CSMI_SAS_LINK_VIRTUAL 0x10
4664
4665 -// Discover state
4666 -// (bAutoDiscover)
4667 +/* Discover state (bAutoDiscover) */
4668
4669 #define CSMI_SAS_DISCOVER_NOT_SUPPORTED 0x00
4670 #define CSMI_SAS_DISCOVER_NOT_STARTED 0x01
4671 @@ -748,57 +545,49 @@ typedef struct _IOCTL_HEADER {
4672 #define CSMI_SAS_DISCOVER_COMPLETE 0x03
4673 #define CSMI_SAS_DISCOVER_ERROR 0x04
4674
4675 -// Phy features
4676 +/* Phy features */
4677
4678 #define CSMI_SAS_PHY_VIRTUAL_SMP 0x01
4679
4680 -// Programmed link rates
4681 -// (bMinimumLinkRate, bMaximumLinkRate)
4682 -// (bProgrammedMinimumLinkRate, bProgrammedMaximumLinkRate)
4683 +/* Programmed link rates (bMinimumLinkRate, bMaximumLinkRate) */
4684 +/* (bProgrammedMinimumLinkRate, bProgrammedMaximumLinkRate) */
4685
4686 #define CSMI_SAS_PROGRAMMED_LINK_RATE_UNCHANGED 0x00
4687 #define CSMI_SAS_PROGRAMMED_LINK_RATE_1_5_GBPS 0x08
4688 #define CSMI_SAS_PROGRAMMED_LINK_RATE_3_0_GBPS 0x09
4689
4690 -// Link rate
4691 -// (bNegotiatedLinkRate in CSMI_SAS_SET_PHY_INFO)
4692 +/* Link rate (bNegotiatedLinkRate in CSMI_SAS_SET_PHY_INFO) */
4693
4694 #define CSMI_SAS_LINK_RATE_NEGOTIATE 0x00
4695 #define CSMI_SAS_LINK_RATE_PHY_DISABLED 0x01
4696
4697 -// Signal class
4698 -// (bSignalClass in CSMI_SAS_SET_PHY_INFO)
4699 +/* Signal class (bSignalClass in CSMI_SAS_SET_PHY_INFO) */
4700
4701 #define CSMI_SAS_SIGNAL_CLASS_UNKNOWN 0x00
4702 #define CSMI_SAS_SIGNAL_CLASS_DIRECT 0x01
4703 #define CSMI_SAS_SIGNAL_CLASS_SERVER 0x02
4704 #define CSMI_SAS_SIGNAL_CLASS_ENCLOSURE 0x03
4705
4706 -// Link error reset
4707 -// (bResetCounts)
4708 +/* Link error reset (bResetCounts) */
4709
4710 #define CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS 0x00
4711 #define CSMI_SAS_LINK_ERROR_RESET_COUNTS 0x01
4712
4713 -// Phy identifier
4714 -// (bPhyIdentifier)
4715 +/* Phy identifier (bPhyIdentifier) */
4716
4717 #define CSMI_SAS_USE_PORT_IDENTIFIER 0xFF
4718
4719 -// Port identifier
4720 -// (bPortIdentifier)
4721 +/* Port identifier (bPortIdentifier) */
4722
4723 #define CSMI_SAS_IGNORE_PORT 0xFF
4724
4725 -// Programmed link rates
4726 -// (bConnectionRate)
4727 +/* Programmed link rates (bConnectionRate) */
4728
4729 #define CSMI_SAS_LINK_RATE_NEGOTIATED 0x00
4730 #define CSMI_SAS_LINK_RATE_1_5_GBPS 0x08
4731 #define CSMI_SAS_LINK_RATE_3_0_GBPS 0x09
4732
4733 -// Connection status
4734 -// (bConnectionStatus)
4735 +/* Connection status (bConnectionStatus) */
4736
4737 #define CSMI_SAS_OPEN_ACCEPT 0
4738 #define CSMI_SAS_OPEN_REJECT_BAD_DESTINATION 1
4739 @@ -814,8 +603,7 @@ typedef struct _IOCTL_HEADER {
4740 #define CSMI_SAS_OPEN_REJECT_STP_RESOURCES_BUSY 11
4741 #define CSMI_SAS_OPEN_REJECT_WRONG_DESTINATION 12
4742
4743 -// SSP Status
4744 -// (bSSPStatus)
4745 +/* SSP Status (bSSPStatus)*/
4746
4747 #define CSMI_SAS_SSP_STATUS_UNKNOWN 0x00
4748 #define CSMI_SAS_SSP_STATUS_WAITING 0x01
4749 @@ -824,8 +612,7 @@ typedef struct _IOCTL_HEADER {
4750 #define CSMI_SAS_SSP_STATUS_RETRY 0x04
4751 #define CSMI_SAS_SSP_STATUS_NO_TAG 0x05
4752
4753 -// SSP Flags
4754 -// (uFlags)
4755 +/* SSP Flags (uFlags) */
4756
4757 #define CSMI_SAS_SSP_READ 0x00000001
4758 #define CSMI_SAS_SSP_WRITE 0x00000002
4759 @@ -836,15 +623,13 @@ typedef struct _IOCTL_HEADER {
4760 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ORDERED 0x00000020
4761 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ACA 0x00000040
4762
4763 -// SSP Data present
4764 -// (bDataPresent)
4765 +/* SSP Data present (bDataPresent) */
4766
4767 #define CSMI_SAS_SSP_NO_DATA_PRESENT 0x00
4768 #define CSMI_SAS_SSP_RESPONSE_DATA_PRESENT 0x01
4769 #define CSMI_SAS_SSP_SENSE_DATA_PRESENT 0x02
4770
4771 -// STP Flags
4772 -// (uFlags)
4773 +/* STP Flags (uFlags) */
4774
4775 #define CSMI_SAS_STP_READ 0x00000001
4776 #define CSMI_SAS_STP_WRITE 0x00000002
4777 @@ -856,15 +641,13 @@ typedef struct _IOCTL_HEADER {
4778 #define CSMI_SAS_STP_EXECUTE_DIAG 0x00000100
4779 #define CSMI_SAS_STP_RESET_DEVICE 0x00000200
4780
4781 -// Task Management Flags
4782 -// (uFlags)
4783 +/* Task Management Flags (uFlags) */
4784
4785 #define CSMI_SAS_TASK_IU 0x00000001
4786 #define CSMI_SAS_HARD_RESET_SEQUENCE 0x00000002
4787 #define CSMI_SAS_SUPPRESS_RESULT 0x00000004
4788
4789 -// Task Management Functions
4790 -// (bTaskManagement)
4791 +/* Task Management Functions (bTaskManagement) */
4792
4793 #define CSMI_SAS_SSP_ABORT_TASK 0x01
4794 #define CSMI_SAS_SSP_ABORT_TASK_SET 0x02
4795 @@ -873,16 +656,14 @@ typedef struct _IOCTL_HEADER {
4796 #define CSMI_SAS_SSP_CLEAR_ACA 0x40
4797 #define CSMI_SAS_SSP_QUERY_TASK 0x80
4798
4799 -// Task Management Information
4800 -// (uInformation)
4801 +/* Task Management Information (uInformation) */
4802
4803 #define CSMI_SAS_SSP_TEST 1
4804 #define CSMI_SAS_SSP_EXCEEDED 2
4805 #define CSMI_SAS_SSP_DEMAND 3
4806 #define CSMI_SAS_SSP_TRIGGER 4
4807
4808 -// Connector Pinout Information
4809 -// (uPinout)
4810 +/* Connector Pinout Information (uPinout) */
4811
4812 #define CSMI_SAS_CON_UNKNOWN 0x00000001
4813 #define CSMI_SAS_CON_SFF_8482 0x00000002
4814 @@ -895,10 +676,9 @@ typedef struct _IOCTL_HEADER {
4815 #define CSMI_SAS_CON_SFF_8484_LANE_3 0x00040000
4816 #define CSMI_SAS_CON_SFF_8484_LANE_4 0x00080000
4817
4818 -// Connector Location Information
4819 -// (bLocation)
4820 +/* Connector Location Information (bLocation) */
4821
4822 -// same as uPinout above...
4823 +/* same as uPinout above... */
4824 // #define CSMI_SAS_CON_UNKNOWN 0x01
4825 #define CSMI_SAS_CON_INTERNAL 0x02
4826 #define CSMI_SAS_CON_EXTERNAL 0x04
4827 @@ -907,15 +687,13 @@ typedef struct _IOCTL_HEADER {
4828 #define CSMI_SAS_CON_NOT_PRESENT 0x20
4829 #define CSMI_SAS_CON_NOT_CONNECTED 0x80
4830
4831 -// Device location identification
4832 -// (bIdentify)
4833 +/* Device location identification (bIdentify) */
4834
4835 #define CSMI_SAS_LOCATE_UNKNOWN 0x00
4836 #define CSMI_SAS_LOCATE_FORCE_OFF 0x01
4837 #define CSMI_SAS_LOCATE_FORCE_ON 0x02
4838
4839 -// Location Valid flags
4840 -// (uLocationFlags)
4841 +/* Location Valid flags (uLocationFlags) */
4842
4843 #define CSMI_SAS_LOCATE_SAS_ADDRESS_VALID 0x00000001
4844 #define CSMI_SAS_LOCATE_SAS_LUN_VALID 0x00000002
4845 @@ -927,48 +705,41 @@ typedef struct _IOCTL_HEADER {
4846
4847 /* * * * * * * * SAS Phy Control Class IOCTL Constants * * * * * * * * */
4848
4849 -// Return codes for SAS Phy Control IOCTL's
4850 -// (IoctlHeader.ReturnCode)
4851 +/* Return codes for SAS Phy Control IOCTL's (IoctlHeader.ReturnCode) */
4852
4853 -// Signature value
4854 -// (IoctlHeader.Signature)
4855 +/* Signature value (IoctlHeader.Signature) */
4856
4857 #define CSMI_PHY_SIGNATURE "CSMIPHY"
4858
4859 -// Phy Control Functions
4860 -// (bFunction)
4861 +/* Phy Control Functions (bFunction) */
4862
4863 -// values 0x00 to 0xFF are consistent in definition with the SMP PHY CONTROL
4864 -// function defined in the SAS spec
4865 +/* values 0x00 to 0xFF are consistent in definition with the SMP PHY CONTROL
4866 + function defined in the SAS spec */
4867 #define CSMI_SAS_PC_NOP 0x00000000
4868 #define CSMI_SAS_PC_LINK_RESET 0x00000001
4869 #define CSMI_SAS_PC_HARD_RESET 0x00000002
4870 #define CSMI_SAS_PC_PHY_DISABLE 0x00000003
4871 -// 0x04 to 0xFF reserved...
4872 +/* 0x04 to 0xFF reserved... */
4873 #define CSMI_SAS_PC_GET_PHY_SETTINGS 0x00000100
4874
4875 -// Link Flags
4876 +/* Link Flags */
4877 #define CSMI_SAS_PHY_ACTIVATE_CONTROL 0x00000001
4878 #define CSMI_SAS_PHY_UPDATE_SPINUP_RATE 0x00000002
4879 #define CSMI_SAS_PHY_AUTO_COMWAKE 0x00000004
4880
4881 -// Device Types for Phy Settings
4882 -// (bType)
4883 +/* Device Types for Phy Settings (bType) */
4884 #define CSMI_SAS_UNDEFINED 0x00
4885 #define CSMI_SAS_SATA 0x01
4886 #define CSMI_SAS_SAS 0x02
4887
4888 -// Transmitter Flags
4889 -// (uTransmitterFlags)
4890 +/* Transmitter Flags (uTransmitterFlags) */
4891 #define CSMI_SAS_PHY_PREEMPHASIS_DISABLED 0x00000001
4892
4893 -// Receiver Flags
4894 -// (uReceiverFlags)
4895 +/* Receiver Flags (uReceiverFlags) */
4896 #define CSMI_SAS_PHY_EQUALIZATION_DISABLED 0x00000001
4897
4898 -// Pattern Flags
4899 -// (uPatternFlags)
4900 -// #define CSMI_SAS_PHY_ACTIVATE_CONTROL 0x00000001
4901 +/* Pattern Flags (uPatternFlags) */
4902 +#define CSMI_SAS_PHY_ACTIVATE_CONTROL 0x00000001
4903 #define CSMI_SAS_PHY_DISABLE_SCRAMBLING 0x00000002
4904 #define CSMI_SAS_PHY_DISABLE_ALIGN 0x00000004
4905 #define CSMI_SAS_PHY_DISABLE_SSC 0x00000008
4906 @@ -976,18 +747,16 @@ typedef struct _IOCTL_HEADER {
4907 #define CSMI_SAS_PHY_FIXED_PATTERN 0x00000010
4908 #define CSMI_SAS_PHY_USER_PATTERN 0x00000020
4909
4910 -// Fixed Patterns
4911 -// (bFixedPattern)
4912 +/* Fixed Patterns (bFixedPattern) */
4913 #define CSMI_SAS_PHY_CJPAT 0x00000001
4914 #define CSMI_SAS_PHY_ALIGN 0x00000002
4915
4916 -// Type Flags
4917 -// (bTypeFlags)
4918 +/* Type Flags (bTypeFlags) */
4919 #define CSMI_SAS_PHY_POSITIVE_DISPARITY 0x01
4920 #define CSMI_SAS_PHY_NEGATIVE_DISPARITY 0x02
4921 #define CSMI_SAS_PHY_CONTROL_CHARACTER 0x04
4922
4923 -// Miscellaneous
4924 +/* Miscellaneous */
4925 #define SLOT_NUMBER_UNKNOWN 0xFFFF
4926
4927 /*************************************************************************/
4928 @@ -996,10 +765,9 @@ typedef struct _IOCTL_HEADER {
4929
4930 /* * * * * * * * * * Class Independent Structures * * * * * * * * * */
4931
4932 -// EDM #pragma CSMI_SAS_BEGIN_PACK(8)
4933 #pragma pack(8)
4934
4935 -// CC_CSMI_SAS_DRIVER_INFO
4936 +/* CC_CSMI_SAS_DRIVER_INFO */
4937
4938 typedef struct _CSMI_SAS_DRIVER_INFO {
4939 __u8 szName[81];
4940 @@ -1019,7 +787,7 @@ typedef struct _CSMI_SAS_DRIVER_INFO_BUF
4941 } CSMI_SAS_DRIVER_INFO_BUFFER,
4942 *PCSMI_SAS_DRIVER_INFO_BUFFER;
4943
4944 -// CC_CSMI_SAS_CNTLR_CONFIGURATION
4945 +/* CC_CSMI_SAS_CNTLR_CONFIGURATION */
4946
4947 typedef struct _CSMI_SAS_PCI_BUS_ADDRESS {
4948 __u8 bBusNumber;
4949 @@ -1074,7 +842,7 @@ typedef struct _CSMI_SAS_CNTLR_CONFIG_BU
4950 } CSMI_SAS_CNTLR_CONFIG_BUFFER,
4951 *PCSMI_SAS_CNTLR_CONFIG_BUFFER;
4952
4953 -// CC_CSMI_SAS_CNTLR_STATUS
4954 +/* CC_CSMI_SAS_CNTLR_STATUS */
4955
4956 typedef struct _CSMI_SAS_CNTLR_STATUS {
4957 __u32 uStatus;
4958 @@ -1089,7 +857,7 @@ typedef struct _CSMI_SAS_CNTLR_STATUS_BU
4959 } CSMI_SAS_CNTLR_STATUS_BUFFER,
4960 *PCSMI_SAS_CNTLR_STATUS_BUFFER;
4961
4962 -// CC_CSMI_SAS_FIRMWARE_DOWNLOAD
4963 +/* CC_CSMI_SAS_FIRMWARE_DOWNLOAD */
4964
4965 typedef struct _CSMI_SAS_FIRMWARE_DOWNLOAD {
4966 __u32 uBufferLength;
4967 @@ -1107,7 +875,7 @@ typedef struct _CSMI_SAS_FIRMWARE_DOWNLO
4968 } CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER,
4969 *PCSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER;
4970
4971 -// CC_CSMI_SAS_RAID_INFO
4972 +/* CC_CSMI_SAS_RAID_INFO */
4973
4974 typedef struct _CSMI_SAS_RAID_INFO {
4975 __u32 uNumRaidSets;
4976 @@ -1140,7 +908,7 @@ typedef struct _CSMI_SAS_RAID_INFO_BUFFE
4977 } CSMI_SAS_RAID_INFO_BUFFER,
4978 *PCSMI_SAS_RAID_INFO_BUFFER;
4979
4980 -// CC_CSMI_SAS_GET_RAID_CONFIG
4981 +/* CC_CSMI_SAS_GET_RAID_CONFIG */
4982
4983 typedef struct _CSMI_SAS_RAID_DRIVES {
4984 __u8 bModel[40];
4985 @@ -1220,7 +988,7 @@ typedef struct _CSMI_SAS_RAID_CONFIG_BUF
4986 } CSMI_SAS_RAID_CONFIG_BUFFER,
4987 *PCSMI_SAS_RAID_CONFIG_BUFFER;
4988
4989 -// CC_CSMI_SAS_GET_RAID_FEATURES
4990 +/* CC_CSMI_SAS_GET_RAID_FEATURES */
4991
4992 typedef struct _CSMI_SAS_RAID_TYPE_DESCRIPTION {
4993 __u8 bRaidType;
4994 @@ -1256,7 +1024,7 @@ typedef struct _CSMI_SAS_RAID_FEATURES_B
4995 } CSMI_SAS_RAID_FEATURES_BUFFER,
4996 *PCSMI_SAS_RAID_FEATURES_BUFFER;
4997
4998 -// CC_CSMI_SAS_SET_RAID_CONTROL
4999 +/* CC_CSMI_SAS_SET_RAID_CONTROL */
5000
5001 typedef struct _CSMI_SAS_RAID_CONTROL {
5002 __u8 bTransformPriority;
5003 @@ -1279,7 +1047,7 @@ typedef struct _CSMI_SAS_RAID_CONTROL_BU
5004 } CSMI_SAS_RAID_CONTROL_BUFFER,
5005 *PCSMI_SAS_RAID_CONTROL_BUFFER;
5006
5007 -// CC_CSMI_SAS_GET_RAID_ELEMENT
5008 +/* CC_CSMI_SAS_GET_RAID_ELEMENT */
5009
5010 typedef struct _CSMI_SAS_DRIVE_EXTENT_INFO {
5011 __u32 uDriveIndex;
5012 @@ -1353,7 +1121,7 @@ typedef struct _CSMI_SAS_RAID_ELEMENT_BU
5013 } CSMI_SAS_RAID_ELEMENT_BUFFER,
5014 *PCSMI_SAS_RAID_ELEMENT_BUFFER;
5015
5016 -// CC_CSMI_SAS_SET_RAID_OPERATION
5017 +/* CC_CSMI_SAS_SET_RAID_OPERATION */
5018
5019 typedef struct _CSMI_SAS_RAID_SET_LIST {
5020 __u32 uRaidSetIndex;
5021 @@ -1503,7 +1271,7 @@ typedef struct _CSMI_SAS_RAID_SET_OPERAT
5022
5023 /* * * * * * * * * * SAS HBA Class Structures * * * * * * * * * */
5024
5025 -// CC_CSMI_SAS_GET_PHY_INFO
5026 +/* CC_CSMI_SAS_GET_PHY_INFO */
5027
5028 typedef struct _CSMI_SAS_IDENTIFY {
5029 __u8 bDeviceType;
5030 @@ -1545,7 +1313,7 @@ typedef struct _CSMI_SAS_PHY_INFO_BUFFER
5031 } CSMI_SAS_PHY_INFO_BUFFER,
5032 *PCSMI_SAS_PHY_INFO_BUFFER;
5033
5034 -// CC_CSMI_SAS_SET_PHY_INFO
5035 +/* CC_CSMI_SAS_SET_PHY_INFO */
5036
5037 typedef struct _CSMI_SAS_SET_PHY_INFO {
5038 __u8 bPhyIdentifier;
5039 @@ -1563,7 +1331,7 @@ typedef struct _CSMI_SAS_SET_PHY_INFO_BU
5040 } CSMI_SAS_SET_PHY_INFO_BUFFER,
5041 *PCSMI_SAS_SET_PHY_INFO_BUFFER;
5042
5043 -// CC_CSMI_SAS_GET_LINK_ERRORS
5044 +/* CC_CSMI_SAS_GET_LINK_ERRORS */
5045
5046 typedef struct _CSMI_SAS_LINK_ERRORS {
5047 __u8 bPhyIdentifier;
5048 @@ -1582,7 +1350,7 @@ typedef struct _CSMI_SAS_LINK_ERRORS_BUF
5049 } CSMI_SAS_LINK_ERRORS_BUFFER,
5050 *PCSMI_SAS_LINK_ERRORS_BUFFER;
5051
5052 -// CC_CSMI_SAS_SMP_PASSTHRU
5053 +/* CC_CSMI_SAS_SMP_PASSTHRU */
5054
5055 typedef struct _CSMI_SAS_SMP_REQUEST {
5056 __u8 bFrameType;
5057 @@ -1622,7 +1390,7 @@ typedef struct _CSMI_SAS_SMP_PASSTHRU_BU
5058 } CSMI_SAS_SMP_PASSTHRU_BUFFER,
5059 *PCSMI_SAS_SMP_PASSTHRU_BUFFER;
5060
5061 -// CC_CSMI_SAS_SSP_PASSTHRU
5062 +/* CC_CSMI_SAS_SSP_PASSTHRU */
5063
5064 typedef struct _CSMI_SAS_SSP_PASSTHRU {
5065 __u8 bPhyIdentifier;
5066 @@ -1661,7 +1429,7 @@ typedef struct _CSMI_SAS_SSP_PASSTHRU_BU
5067 } CSMI_SAS_SSP_PASSTHRU_BUFFER,
5068 *PCSMI_SAS_SSP_PASSTHRU_BUFFER;
5069
5070 -// CC_CSMI_SAS_STP_PASSTHRU
5071 +/* CC_CSMI_SAS_STP_PASSTHRU */
5072
5073 typedef struct _CSMI_SAS_STP_PASSTHRU {
5074 __u8 bPhyIdentifier;
5075 @@ -1693,7 +1461,7 @@ typedef struct _CSMI_SAS_STP_PASSTHRU_BU
5076 } CSMI_SAS_STP_PASSTHRU_BUFFER,
5077 *PCSMI_SAS_STP_PASSTHRU_BUFFER;
5078
5079 -// CC_CSMI_SAS_GET_SATA_SIGNATURE
5080 +/* CC_CSMI_SAS_GET_SATA_SIGNATURE */
5081
5082 typedef struct _CSMI_SAS_SATA_SIGNATURE {
5083 __u8 bPhyIdentifier;
5084 @@ -1708,7 +1476,7 @@ typedef struct _CSMI_SAS_SATA_SIGNATURE_
5085 } CSMI_SAS_SATA_SIGNATURE_BUFFER,
5086 *PCSMI_SAS_SATA_SIGNATURE_BUFFER;
5087
5088 -// CC_CSMI_SAS_GET_SCSI_ADDRESS
5089 +/* CC_CSMI_SAS_GET_SCSI_ADDRESS */
5090
5091 typedef struct _CSMI_SAS_GET_SCSI_ADDRESS_BUFFER {
5092 IOCTL_HEADER IoctlHeader;
5093 @@ -1721,7 +1489,7 @@ typedef struct _CSMI_SAS_GET_SCSI_ADDRES
5094 } CSMI_SAS_GET_SCSI_ADDRESS_BUFFER,
5095 *PCSMI_SAS_GET_SCSI_ADDRESS_BUFFER;
5096
5097 -// CC_CSMI_SAS_GET_DEVICE_ADDRESS
5098 +/* CC_CSMI_SAS_GET_DEVICE_ADDRESS */
5099
5100 typedef struct _CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER {
5101 IOCTL_HEADER IoctlHeader;
5102 @@ -1734,7 +1502,7 @@ typedef struct _CSMI_SAS_GET_DEVICE_ADDR
5103 } CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER,
5104 *PCSMI_SAS_GET_DEVICE_ADDRESS_BUFFER;
5105
5106 -// CC_CSMI_SAS_TASK_MANAGEMENT
5107 +/* CC_CSMI_SAS_TASK_MANAGEMENT */
5108
5109 typedef struct _CSMI_SAS_SSP_TASK_IU {
5110 __u8 bHostIndex;
5111 @@ -1757,7 +1525,7 @@ typedef struct _CSMI_SAS_SSP_TASK_IU_BUF
5112 } CSMI_SAS_SSP_TASK_IU_BUFFER,
5113 *PCSMI_SAS_SSP_TASK_IU_BUFFER;
5114
5115 -// CC_CSMI_SAS_GET_CONNECTOR_INFO
5116 +/* CC_CSMI_SAS_GET_CONNECTOR_INFO */
5117
5118 typedef struct _CSMI_SAS_GET_CONNECTOR_INFO {
5119 __u32 uPinout;
5120 @@ -1773,7 +1541,7 @@ typedef struct _CSMI_SAS_CONNECTOR_INFO_
5121 } CSMI_SAS_CONNECTOR_INFO_BUFFER,
5122 *PCSMI_SAS_CONNECTOR_INFO_BUFFER;
5123
5124 -// CC_CSMI_SAS_GET_LOCATION
5125 +/* CC_CSMI_SAS_GET_LOCATION */
5126
5127 typedef struct _CSMI_SAS_LOCATION_IDENTIFIER {
5128 __u32 bLocationFlags;
5129 @@ -1801,7 +1569,7 @@ typedef struct _CSMI_SAS_GET_LOCATION_BU
5130 } CSMI_SAS_GET_LOCATION_BUFFER,
5131 *PCSMI_SAS_GET_LOCATION_BUFFER;
5132
5133 -// CC_CSMI_SAS_PHY_CONTROL
5134 +/* CC_CSMI_SAS_PHY_CONTROL */
5135
5136 typedef struct _CSMI_SAS_CHARACTER {
5137 __u8 bTypeFlags;
5138 @@ -1848,7 +1616,6 @@ typedef struct _CSMI_SAS_PHY_CONTROL_BUF
5139 } CSMI_SAS_PHY_CONTROL_BUFFER,
5140 *PCSMI_SAS_PHY_CONTROL_BUFFER;
5141
5142 -//EDM #pragma CSMI_SAS_END_PACK
5143 #pragma pack()
5144
5145 #endif // _CSMI_SAS_H_
5146 Index: linux-2.6.27/drivers/message/fusion/lsi/mpi_cnfg.h
5147 ===================================================================
5148 --- linux-2.6.27.orig/drivers/message/fusion/lsi/mpi_cnfg.h
5149 +++ linux-2.6.27/drivers/message/fusion/lsi/mpi_cnfg.h
5150 @@ -1452,8 +1452,7 @@ typedef struct _CONFIG_PAGE_BIOS_2
5151 #define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05)
5152 #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06)
5153
5154 -typedef struct _CONFIG_PAGE_BIOS_4
5155 -{
5156 +typedef struct _CONFIG_PAGE_BIOS_4 {
5157 CONFIG_PAGE_HEADER Header; /* 00h */
5158 U64 ReassignmentBaseWWID; /* 04h */
5159 } CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4,
5160 Index: linux-2.6.27/drivers/message/fusion/lsi/mpi_log_sas.h
5161 ===================================================================
5162 --- linux-2.6.27.orig/drivers/message/fusion/lsi/mpi_log_sas.h
5163 +++ linux-2.6.27/drivers/message/fusion/lsi/mpi_log_sas.h
5164 @@ -160,11 +160,12 @@
5165
5166
5167 #define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200)
5168 +
5169 #define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300)
5170 -#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */
5171 - /* Bit 0 is Status Bit 0: FrameXferErr */
5172 - /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
5173 - /* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
5174 +/* Bits 0-3 encode Transport Status Register (offset 0x08) */
5175 +/* Bit 0 is Status Bit 0: FrameXferErr */
5176 +/* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
5177 +/* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
5178
5179 #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500)
5180 #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600)
5181 @@ -179,7 +180,7 @@
5182 #define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01)
5183 #define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00)
5184 #define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000)
5185 -#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000) /* not currently used in mainline */
5186 +#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000)
5187 #define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK (0x00003000)
5188 #define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP (0x00004000)
5189 #define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD (0x00005000)
5190 @@ -308,7 +309,6 @@
5191 /* Device Firmware Update: Unable to allocate memory for page */
5192 #define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE (0x00010056)
5193 /* Device Firmware Update: */
5194 -//#define IR_LOGINFO_DEV_FW_UPDATE_ERR_ (0x00010054)
5195
5196
5197 /****************************************************************************/
5198 Index: linux-2.6.27/drivers/message/fusion/lsi/mpi_type.h
5199 ===================================================================
5200 --- linux-2.6.27.orig/drivers/message/fusion/lsi/mpi_type.h
5201 +++ linux-2.6.27/drivers/message/fusion/lsi/mpi_type.h
5202 @@ -50,18 +50,8 @@ typedef signed short S16;
5203 typedef unsigned short U16;
5204
5205
5206 -#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__PPC__) || defined(__ppc)
5207 -
5208 - typedef signed int S32;
5209 - typedef unsigned int U32;
5210 -
5211 -#else
5212 -
5213 - typedef signed long S32;
5214 - typedef unsigned long U32;
5215 -
5216 -#endif
5217 -
5218 +typedef int32_t S32;
5219 +typedef u_int32_t U32;
5220
5221 typedef struct _S64
5222 {
5223 Index: linux-2.6.27/drivers/message/fusion/mptbase.c
5224 ===================================================================
5225 --- linux-2.6.27.orig/drivers/message/fusion/mptbase.c
5226 +++ linux-2.6.27/drivers/message/fusion/mptbase.c
5227 @@ -83,15 +83,18 @@ MODULE_VERSION(my_VERSION);
5228
5229 static int mpt_msi_enable_spi;
5230 module_param(mpt_msi_enable_spi, int, 0);
5231 -MODULE_PARM_DESC(mpt_msi_enable_spi, " Enable MSI Support for SPI controllers (default=0)");
5232 +MODULE_PARM_DESC(mpt_msi_enable_spi,
5233 + " Enable MSI Support for SPI controllers (default=0)");
5234
5235 static int mpt_msi_enable_fc;
5236 module_param(mpt_msi_enable_fc, int, 0);
5237 -MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC controllers (default=0)");
5238 +MODULE_PARM_DESC(mpt_msi_enable_fc,
5239 + " Enable MSI Support for FC controllers (default=0)");
5240
5241 static int mpt_msi_enable_sas = 1;
5242 module_param(mpt_msi_enable_sas, int, 0);
5243 -MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS controllers (default=1)");
5244 +MODULE_PARM_DESC(mpt_msi_enable_sas,
5245 + " Enable MSI Support for SAS controllers (default=1)");
5246
5247
5248 static int mpt_channel_mapping;
5249 @@ -99,18 +102,20 @@ module_param(mpt_channel_mapping, int, 0
5250 MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)");
5251
5252 int mpt_debug_level;
5253 +EXPORT_SYMBOL(mpt_debug_level);
5254 +
5255 static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
5256 module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
5257 &mpt_debug_level, 0600);
5258 -MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)");
5259 -EXPORT_SYMBOL(mpt_debug_level);
5260 +MODULE_PARM_DESC(mpt_debug_level,
5261 + " debug level - refer to mptdebug.h - (default=0)");
5262
5263 int mpt_fwfault_debug;
5264 +EXPORT_SYMBOL(mpt_fwfault_debug);
5265 module_param_call(mpt_fwfault_debug, param_set_int, param_get_int,
5266 &mpt_fwfault_debug, 0600);
5267 MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
5268 " and halt Firmware on fault - (default=0)");
5269 -EXPORT_SYMBOL(mpt_fwfault_debug);
5270
5271
5272 #ifdef MFCNT
5273 @@ -122,7 +127,7 @@ static int mfcounter = 0;
5274 /*
5275 * Public data...
5276 */
5277 -struct proc_dir_entry *mpt_proc_root_dir;
5278 +static struct proc_dir_entry *mpt_proc_root_dir;
5279
5280 #define WHOINIT_UNKNOWN 0xAA
5281
5282 @@ -156,7 +161,8 @@ static u8 last_drv_idx;
5283 /*
5284 * Forward protos...
5285 */
5286 -static int mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply);
5287 +static int mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
5288 + MPT_FRAME_HDR *reply);
5289 static int mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes,
5290 u32 *req, int replyBytes, u16 *u16reply, int maxwait,
5291 int sleepFlag);
5292 @@ -188,7 +194,8 @@ static int mpt_readScsiDevicePageHeaders
5293 static void mpt_read_ioc_pg_1(MPT_ADAPTER *ioc);
5294 static void mpt_read_ioc_pg_4(MPT_ADAPTER *ioc);
5295 static void mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc);
5296 -static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch, int sleepFlag);
5297 +static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch,
5298 + int sleepFlag);
5299 static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp);
5300 static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag);
5301 static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init);
5302 @@ -353,10 +360,10 @@ mpt_fault_reset_work(struct work_struct
5303 printk(MYIOC_s_WARN_FMT "IOC is in FAULT state (%04xh)!!!\n",
5304 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
5305 printk(MYIOC_s_WARN_FMT "Issuing HardReset from %s!!\n",
5306 - ioc->name, __FUNCTION__);
5307 + ioc->name, __func__);
5308 rc = mpt_HardResetHandler(ioc, CAN_SLEEP);
5309 printk(MYIOC_s_WARN_FMT "%s: HardReset: %s\n", ioc->name,
5310 - __FUNCTION__, (rc == 0) ? "success" : "failed");
5311 + __func__, (rc == 0) ? "success" : "failed");
5312 ioc_raw_state = mpt_GetIocState(ioc, 0);
5313 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT)
5314 printk(MYIOC_s_WARN_FMT "IOC is in FAULT state after "
5315 @@ -378,11 +385,11 @@ mpt_fault_reset_work(struct work_struct
5316 ioc = ioc->alt_ioc;
5317
5318 /* rearm the timer */
5319 - spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
5320 + spin_lock_irqsave(&ioc->fault_reset_work_lock, flags);
5321 if (ioc->reset_work_q)
5322 queue_delayed_work(ioc->reset_work_q, &ioc->fault_reset_work,
5323 msecs_to_jiffies(MPT_POLLING_INTERVAL));
5324 - spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
5325 + spin_unlock_irqrestore(&ioc->fault_reset_work_lock, flags);
5326 }
5327
5328 /*
5329 @@ -439,7 +446,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa
5330 if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
5331 MptCallbacks[cb_idx] == NULL) {
5332 printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n",
5333 - __FUNCTION__, ioc->name, cb_idx);
5334 + __func__, ioc->name, cb_idx);
5335 goto out;
5336 }
5337
5338 @@ -497,9 +504,6 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5339 mpt_sas_log_info(ioc, log_info);
5340 }
5341
5342 - /* TODO - add shost_attrs, or command line option, and
5343 - * extend this to SAS/FC
5344 - */
5345 if (ioc_stat & MPI_IOCSTATUS_MASK)
5346 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf);
5347
5348 @@ -507,7 +511,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5349 if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
5350 MptCallbacks[cb_idx] == NULL) {
5351 printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n",
5352 - __FUNCTION__, ioc->name, cb_idx);
5353 + __func__, ioc->name, cb_idx);
5354 freeme = 0;
5355 goto out;
5356 }
5357 @@ -523,11 +527,11 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5358 mb();
5359 }
5360
5361 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5362 /**
5363 * mpt_interrupt - MPT adapter (IOC) specific interrupt handler.
5364 * @irq: irq number (not used)
5365 * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure
5366 - * @r: pt_regs pointer (not used)
5367 *
5368 * This routine is registered via the request_irq() kernel API call,
5369 * and handles all interrupts generated from a specific MPT adapter
5370 @@ -539,7 +543,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5371 * This routine handles register-level access of the adapter but
5372 * dispatches (calls) a protocol-specific callback routine to handle
5373 * the protocol-specific details of the MPT request completion.
5374 - **/
5375 + */
5376 static irqreturn_t
5377 mpt_interrupt(int irq, void *bus_id)
5378 {
5379 @@ -630,6 +634,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAM
5380 return freereq;
5381 }
5382
5383 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5384 /**
5385 * mpt_register - Register protocol-specific main callback handler.
5386 * @cbfunc: callback function pointer
5387 @@ -648,7 +653,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAM
5388 * {N,...,7,6,5,...,1} if successful.
5389 * A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be
5390 * considered an error by the caller.
5391 - **/
5392 + */
5393 u8
5394 mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
5395 {
5396 @@ -672,13 +677,14 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DR
5397 return last_drv_idx;
5398 }
5399
5400 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5401 /**
5402 * mpt_deregister - Deregister a protocol drivers resources.
5403 * @cb_idx: previously registered callback handle
5404 *
5405 * Each protocol-specific driver should call this routine when its
5406 * module is unloaded.
5407 - **/
5408 + */
5409 void
5410 mpt_deregister(u8 cb_idx)
5411 {
5412 @@ -691,9 +697,9 @@ mpt_deregister(u8 cb_idx)
5413 }
5414 }
5415
5416 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5417 /**
5418 - * mpt_event_register - Register protocol-specific event callback
5419 - * handler.
5420 + * mpt_event_register - Register protocol-specific event callback handler.
5421 * @cb_idx: previously registered (via mpt_register) callback handle
5422 * @ev_cbfunc: callback function
5423 *
5424 @@ -701,7 +707,7 @@ mpt_deregister(u8 cb_idx)
5425 * if/when they choose to be notified of MPT events.
5426 *
5427 * Returns 0 for success.
5428 - **/
5429 + */
5430 int
5431 mpt_event_register(u8 cb_idx, MPT_EVHANDLER ev_cbfunc)
5432 {
5433 @@ -712,15 +718,15 @@ mpt_event_register(u8 cb_idx, MPT_EVHAND
5434 return 0;
5435 }
5436
5437 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5438 /**
5439 - * mpt_event_deregister - Deregister protocol-specific event callback
5440 - * handler.
5441 + * mpt_event_deregister - Deregister protocol-specific event callback handler.
5442 * @cb_idx: previously registered callback handle
5443 *
5444 * Each protocol-specific driver should call this routine
5445 * when it does not (or can no longer) handle events,
5446 * or when its module is unloaded.
5447 - **/
5448 + */
5449 void
5450 mpt_event_deregister(u8 cb_idx)
5451 {
5452 @@ -730,6 +736,7 @@ mpt_event_deregister(u8 cb_idx)
5453 MptEvHandlers[cb_idx] = NULL;
5454 }
5455
5456 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5457 /**
5458 * mpt_reset_register - Register protocol-specific IOC reset handler.
5459 * @cb_idx: previously registered (via mpt_register) callback handle
5460 @@ -739,7 +746,7 @@ mpt_event_deregister(u8 cb_idx)
5461 * if/when they choose to be notified of IOC resets.
5462 *
5463 * Returns 0 for success.
5464 - **/
5465 + */
5466 int
5467 mpt_reset_register(u8 cb_idx, MPT_RESETHANDLER reset_func)
5468 {
5469 @@ -750,6 +757,7 @@ mpt_reset_register(u8 cb_idx, MPT_RESETH
5470 return 0;
5471 }
5472
5473 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5474 /**
5475 * mpt_reset_deregister - Deregister protocol-specific IOC reset handler.
5476 * @cb_idx: previously registered callback handle
5477 @@ -757,7 +765,7 @@ mpt_reset_register(u8 cb_idx, MPT_RESETH
5478 * Each protocol-specific driver should call this routine
5479 * when it does not (or can no longer) handle IOC reset handling,
5480 * or when its module is unloaded.
5481 - **/
5482 + */
5483 void
5484 mpt_reset_deregister(u8 cb_idx)
5485 {
5486 @@ -767,11 +775,12 @@ mpt_reset_deregister(u8 cb_idx)
5487 MptResetHandlers[cb_idx] = NULL;
5488 }
5489
5490 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5491 /**
5492 * mpt_device_driver_register - Register device driver hooks
5493 * @dd_cbfunc: driver callbacks struct
5494 * @cb_idx: MPT protocol driver index
5495 - **/
5496 + */
5497 int
5498 mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, u8 cb_idx)
5499 {
5500 @@ -785,8 +794,6 @@ mpt_device_driver_register(struct mpt_pc
5501
5502 /* call per pci device probe entry point */
5503 list_for_each_entry(ioc, &ioc_list, list) {
5504 - if (!pci_get_drvdata(ioc->pcidev))
5505 - continue;
5506 id = ioc->pcidev->driver ?
5507 ioc->pcidev->driver->id_table : NULL;
5508 if (dd_cbfunc->probe)
5509 @@ -796,10 +803,11 @@ mpt_device_driver_register(struct mpt_pc
5510 return 0;
5511 }
5512
5513 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5514 /**
5515 * mpt_device_driver_deregister - DeRegister device driver hooks
5516 * @cb_idx: MPT protocol driver index
5517 - **/
5518 + */
5519 void
5520 mpt_device_driver_deregister(u8 cb_idx)
5521 {
5522 @@ -819,15 +827,18 @@ mpt_device_driver_deregister(u8 cb_idx)
5523 MptDeviceDriverHandlers[cb_idx] = NULL;
5524 }
5525
5526 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5527 /**
5528 - * mpt_get_msg_frame - Obtain a MPT request frame from the pool (of 1024)
5529 - * allocated per MPT adapter.
5530 + * mpt_get_msg_frame - Obtain an MPT request frame from the pool
5531 * @cb_idx: Handle of registered MPT protocol driver
5532 * @ioc: Pointer to MPT adapter structure
5533 *
5534 + * Obtain an MPT request frame from the pool (of 1024) that are
5535 + * allocated per MPT adapter.
5536 + *
5537 * Returns pointer to a MPT request frame or %NULL if none are available
5538 * or IOC is not active.
5539 - **/
5540 + */
5541 MPT_FRAME_HDR*
5542 mpt_get_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc)
5543 {
5544 @@ -886,16 +897,16 @@ mpt_get_msg_frame(u8 cb_idx, MPT_ADAPTER
5545 return mf;
5546 }
5547
5548 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5549 /**
5550 - * mpt_put_msg_frame - Send a protocol specific MPT request frame
5551 - * to a IOC.
5552 + * mpt_put_msg_frame - Send a protocol-specific MPT request frame to an IOC
5553 * @cb_idx: Handle of registered MPT protocol driver
5554 * @ioc: Pointer to MPT adapter structure
5555 * @mf: Pointer to MPT request frame
5556 *
5557 - * This routine posts a MPT request frame to the request post FIFO of a
5558 + * This routine posts an MPT request frame to the request post FIFO of a
5559 * specific MPT adapter.
5560 - **/
5561 + */
5562 void
5563 mpt_put_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
5564 {
5565 @@ -921,13 +932,15 @@ mpt_put_msg_frame(u8 cb_idx, MPT_ADAPTER
5566 }
5567
5568 /**
5569 - * mpt_put_msg_frame_hi_pri - Send a protocol specific MPT request frame
5570 - * to a IOC using hi priority request queue.
5571 + * mpt_put_msg_frame_hi_pri - Send a hi-pri protocol-specific MPT request frame
5572 * @cb_idx: Handle of registered MPT protocol driver
5573 * @ioc: Pointer to MPT adapter structure
5574 * @mf: Pointer to MPT request frame
5575 *
5576 - * This routine posts a MPT request frame to the request post FIFO of a
5577 + * Send a protocol-specific MPT request frame to an IOC using
5578 + * hi-priority request queue.
5579 + *
5580 + * This routine posts an MPT request frame to the request post FIFO of a
5581 * specific MPT adapter.
5582 **/
5583 void
5584 @@ -952,6 +965,7 @@ mpt_put_msg_frame_hi_pri(u8 cb_idx, MPT_
5585 CHIPREG_WRITE32(&ioc->chip->RequestHiPriFifo, mf_dma_addr);
5586 }
5587
5588 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5589 /**
5590 * mpt_free_msg_frame - Place MPT request frame back on FreeQ.
5591 * @handle: Handle of registered MPT protocol driver
5592 @@ -960,7 +974,7 @@ mpt_put_msg_frame_hi_pri(u8 cb_idx, MPT_
5593 *
5594 * This routine places a MPT request frame back on the MPT adapter's
5595 * FreeQ.
5596 - **/
5597 + */
5598 void
5599 mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
5600 {
5601 @@ -970,7 +984,8 @@ mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT
5602 spin_lock_irqsave(&ioc->FreeQlock, flags);
5603 if (cpu_to_le32(mf->u.frame.linkage.arg1) == 0xdeadbeaf)
5604 goto out;
5605 - mf->u.frame.linkage.arg1 = cpu_to_le32(0xdeadbeaf); /* signature to know if this mf is freed */
5606 + /* signature to know if this mf is freed */
5607 + mf->u.frame.linkage.arg1 = cpu_to_le32(0xdeadbeaf);
5608 list_add_tail(&mf->u.frame.linkage.list, &ioc->FreeQ);
5609 #ifdef MFCNT
5610 ioc->mfcnt--;
5611 @@ -1122,7 +1137,7 @@ mpt_add_chain_64bit(char *pAddr, u8 next
5612 * request which are greater than 1 byte in size.
5613 *
5614 * Returns 0 for success, non-zero for failure.
5615 - **/
5616 + */
5617 int
5618 mpt_send_handshake_request(u8 cb_idx, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag)
5619 {
5620 @@ -1199,6 +1214,7 @@ mpt_send_handshake_request(u8 cb_idx, MP
5621 return r;
5622 }
5623
5624 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5625 /**
5626 * mpt_host_page_access_control - control the IOC's Host Page Buffer access
5627 * @ioc: Pointer to MPT adapter structure
5628 @@ -1215,7 +1231,7 @@ mpt_send_handshake_request(u8 cb_idx, MP
5629 * 3h Free Buffer { MPI_DB_HPBAC_FREE_BUFFER }
5630 *
5631 * Returns 0 for success, non-zero for failure.
5632 - **/
5633 + */
5634 static int
5635 mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag)
5636 {
5637 @@ -1240,6 +1256,7 @@ mpt_host_page_access_control(MPT_ADAPTER
5638 return 0;
5639 }
5640
5641 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5642 /**
5643 * mpt_host_page_alloc - allocate system memory for the fw
5644 * @ioc: Pointer to pointer to IOC adapter
5645 @@ -1247,7 +1264,7 @@ mpt_host_page_access_control(MPT_ADAPTER
5646 *
5647 * If we already allocated memory in past, then resend the same pointer.
5648 * Returns 0 for success, non-zero for failure.
5649 - **/
5650 + */
5651 static int
5652 mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
5653 {
5654 @@ -1305,6 +1322,7 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pI
5655 return 0;
5656 }
5657
5658 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5659 /**
5660 * mpt_verify_adapter - Given IOC identifier, set pointer to its adapter structure.
5661 * @iocid: IOC unique identifier (integer)
5662 @@ -1315,7 +1333,7 @@ return 0;
5663 *
5664 * Returns iocid and sets iocpp if iocid is found.
5665 * Returns -1 if iocid is not found.
5666 - **/
5667 + */
5668 int
5669 mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
5670 {
5671 @@ -1604,7 +1622,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
5672 return r;
5673 }
5674 if (sizeof(dma_addr_t) > 4) {
5675 - const uint64_t required_mask = dma_get_required_mask(&pdev->dev);
5676 + uint64_t required_mask;
5677 + required_mask = dma_get_required_mask(&pdev->dev);
5678 if (required_mask > DMA_32BIT_MASK
5679 && !pci_set_dma_mask(pdev, DMA_64BIT_MASK)
5680 && !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
5681 @@ -1674,15 +1693,13 @@ mpt_mapresources(MPT_ADAPTER *ioc)
5682 ioc->chip = (SYSIF_REGS __iomem *)mem;
5683
5684 /* Save Port IO values in case we need to do downloadboot */
5685 - {
5686 - u8 *pmem = (u8*)port;
5687 - ioc->pio_mem_phys = port;
5688 - ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
5689 - }
5690 + ioc->pio_mem_phys = port;
5691 + ioc->pio_chip = (SYSIF_REGS __iomem *)port;
5692
5693 return 0;
5694 }
5695
5696 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5697 /**
5698 * mpt_attach - Install a PCI intelligent MPT adapter.
5699 * @pdev: Pointer to pci_dev structure
5700 @@ -1698,8 +1715,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
5701 *
5702 * Returns 0 for success, non-zero for failure.
5703 *
5704 - * TODO: Add support for polled controllers
5705 - **/
5706 + */
5707 int
5708 mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
5709 {
5710 @@ -1795,6 +1811,7 @@ mpt_attach(struct pci_dev *pdev, const s
5711
5712 /* Initialize work */
5713 INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work);
5714 + spin_lock_init(&ioc->fault_reset_work_lock);
5715
5716 /* Initialize workqueue */
5717 snprintf(ioc->reset_work_q_name, sizeof(ioc->reset_work_q_name),
5718 @@ -1809,7 +1826,8 @@ mpt_attach(struct pci_dev *pdev, const s
5719 return -ENOMEM;
5720 }
5721
5722 - dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "facts @ %p, pfacts[0] @ %p\n",
5723 + dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "facts @ %p,"
5724 + " pfacts[0] @ %p\n",
5725 ioc->name, &ioc->facts, &ioc->pfacts[0]));
5726
5727 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
5728 @@ -1911,6 +1929,9 @@ mpt_attach(struct pci_dev *pdev, const s
5729 ioc->active = 0;
5730 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
5731
5732 + /* Set IOC ptr in the pcidev's driver data. */
5733 + pci_set_drvdata(ioc->pcidev, ioc);
5734 +
5735 /* Set lookup ptr. */
5736 list_add_tail(&ioc->list, &ioc_list);
5737
5738 @@ -1979,10 +2000,11 @@ mpt_attach(struct pci_dev *pdev, const s
5739 return 0;
5740 }
5741
5742 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5743 /**
5744 * mpt_detach - Remove a PCI intelligent MPT adapter.
5745 * @pdev: Pointer to pci_dev structure
5746 - **/
5747 + */
5748 void
5749 mpt_detach(struct pci_dev *pdev)
5750 {
5751 @@ -1995,10 +2017,10 @@ mpt_detach(struct pci_dev *pdev)
5752 /*
5753 * Stop polling ioc for fault condition
5754 */
5755 - spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
5756 + spin_lock_irqsave(&ioc->fault_reset_work_lock, flags);
5757 wq = ioc->reset_work_q;
5758 ioc->reset_work_q = NULL;
5759 - spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
5760 + spin_unlock_irqrestore(&ioc->fault_reset_work_lock, flags);
5761 cancel_delayed_work(&ioc->fault_reset_work);
5762 destroy_workqueue(wq);
5763
5764 @@ -2030,11 +2052,12 @@ mpt_detach(struct pci_dev *pdev)
5765 * Power Management
5766 */
5767 #ifdef CONFIG_PM
5768 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5769 /**
5770 * mpt_suspend - Fusion MPT base driver suspend routine.
5771 * @pdev: Pointer to pci_dev structure
5772 * @state: new state to enter
5773 - **/
5774 + */
5775 int
5776 mpt_suspend(struct pci_dev *pdev, pm_message_t state)
5777 {
5778 @@ -2069,10 +2092,11 @@ mpt_suspend(struct pci_dev *pdev, pm_mes
5779 return 0;
5780 }
5781
5782 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5783 /**
5784 * mpt_resume - Fusion MPT base driver resume routine.
5785 * @pdev: Pointer to pci_dev structure
5786 - **/
5787 + */
5788 int
5789 mpt_resume(struct pci_dev *pdev)
5790 {
5791 @@ -2132,7 +2156,9 @@ mpt_resume(struct pci_dev *pdev)
5792
5793 /* bring ioc to operational state */
5794 printk(MYIOC_s_INFO_FMT "Sending mpt_do_ioc_recovery\n", ioc->name);
5795 - if ((recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0)
5796 + recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
5797 + CAN_SLEEP);
5798 + if (recovery_state != 0)
5799 printk(MYIOC_s_WARN_FMT "pci-resume: Cannot recover, "
5800 "error:[%x]\n", ioc->name, recovery_state);
5801 else
5802 @@ -2158,6 +2184,7 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *
5803 return (MptResetHandlers[index])(ioc, reset_phase);
5804 }
5805
5806 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5807 /**
5808 * mpt_do_ioc_recovery - Initialize or recover MPT adapter.
5809 * @ioc: Pointer to MPT adapter structure
5810 @@ -2176,7 +2203,9 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *
5811 * -2 if READY but IOCFacts Failed
5812 * -3 if READY but PrimeIOCFifos Failed
5813 * -4 if READY but IOCInit Failed
5814 - **/
5815 + * -5 if failed to enable_device and/or request_selected_regions
5816 + * -6 if failed to upload firmware
5817 + */
5818 static int
5819 mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
5820 {
5821 @@ -2217,14 +2246,16 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5822
5823 if (reset_alt_ioc_active && ioc->alt_ioc) {
5824 /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */
5825 - dprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": alt-ioc reply irq re-enabled\n",
5826 + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5827 + ": alt-ioc reply irq re-enabled\n",
5828 ioc->alt_ioc->name));
5829 CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
5830 ioc->alt_ioc->active = 1;
5831 }
5832
5833 } else {
5834 - printk(MYIOC_s_WARN_FMT "NOT READY WARNING!\n", ioc->name);
5835 + printk(MYIOC_s_WARN_FMT "NOT READY WARNING!\n",
5836 + ioc->name);
5837 }
5838 ret = -1;
5839 goto out;
5840 @@ -2238,7 +2269,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5841 alt_ioc_ready = 1;
5842 else
5843 printk(MYIOC_s_WARN_FMT
5844 - ": alt-ioc Not ready WARNING!\n", ioc->alt_ioc->name);
5845 + ": alt-ioc Not ready WARNING!\n",
5846 + ioc->alt_ioc->name);
5847 }
5848
5849 for (ii=0; ii<5; ii++) {
5850 @@ -2340,8 +2372,9 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5851 ret = -4;
5852 // NEW!
5853 if (alt_ioc_ready && ((rc = PrimeIocFifos(ioc->alt_ioc)) != 0)) {
5854 - printk(MYIOC_s_WARN_FMT ": alt-ioc (%d) FIFO mgmt alloc WARNING!\n",
5855 - ioc->alt_ioc->name, rc);
5856 + printk(MYIOC_s_WARN_FMT
5857 + ": alt-ioc (%d) FIFO mgmt alloc WARNING!\n",
5858 + ioc->alt_ioc->name, rc);
5859 alt_ioc_ready = 0;
5860 reset_alt_ioc_active = 0;
5861 }
5862 @@ -2382,7 +2415,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5863 } else {
5864 printk(MYIOC_s_WARN_FMT
5865 "firmware upload failure!\n", ioc->name);
5866 - ret = -5;
5867 + ret = -6;
5868 }
5869 }
5870 }
5871 @@ -2392,8 +2425,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5872 * and EventAck handling.
5873 */
5874 if ((ret == 0) && (!ioc->facts.EventState)) {
5875 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "SendEventNotification\n",
5876 - ioc->name));
5877 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
5878 + "SendEventNotification\n", ioc->name));
5879 ret = SendEventNotification(ioc, 1, sleepFlag); /* 1=Enable */
5880 }
5881
5882 @@ -2408,9 +2441,11 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5883 if (rc == 0) { /* alt ioc */
5884 if (reset_alt_ioc_active && ioc->alt_ioc) {
5885 /* (re)Enable alt-IOC! (reply interrupt) */
5886 - dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "alt-ioc reply irq re-enabled\n",
5887 + dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5888 + "alt-ioc reply irq re-enabled\n",
5889 ioc->alt_ioc->name));
5890 - CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
5891 + CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask,
5892 + MPI_HIM_DIM);
5893 ioc->alt_ioc->active = 1;
5894 }
5895 }
5896 @@ -2427,7 +2462,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5897 /*
5898 * Initalize link list for inactive raid volumes.
5899 */
5900 - init_MUTEX(&ioc->raid_data.inactive_list_mutex);
5901 + mutex_init(&ioc->raid_data.inactive_list_mutex);
5902 INIT_LIST_HEAD(&ioc->raid_data.inactive_list);
5903
5904 switch (ioc->bus_type) {
5905 @@ -2461,7 +2496,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5906 * (LANPage1_t stuff)
5907 */
5908 (void) GetLanConfigPages(ioc);
5909 - a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
5910 + a = (u8 *)
5911 + &ioc->lan_cnfg_page1.HardwareAddressLow;
5912 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5913 "LanAddr = %02X:%02X:%02X"
5914 ":%02X:%02X:%02X\n",
5915 @@ -2507,6 +2543,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5916 return ret;
5917 }
5918
5919 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5920 /**
5921 * mpt_detect_bound_ports - Search for matching PCI bus/dev_function
5922 * @ioc: Pointer to MPT adapter structure
5923 @@ -2518,7 +2555,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5924 *
5925 * If match on PCI dev_function +/-1 is found, bind the two MPT adapters
5926 * using alt_ioc pointer fields in their %MPT_ADAPTER structures.
5927 - **/
5928 + */
5929 static void
5930 mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
5931 {
5932 @@ -2544,15 +2581,19 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc,
5933 if (_pcidev == peer) {
5934 /* Paranoia checks */
5935 if (ioc->alt_ioc != NULL) {
5936 - printk(MYIOC_s_WARN_FMT "Oops, already bound (%s <==> %s)!\n",
5937 - ioc->name, ioc->name, ioc->alt_ioc->name);
5938 + printk(MYIOC_s_WARN_FMT
5939 + "Oops, already bound (%s <==> %s)!\n",
5940 + ioc->name, ioc->name, ioc->alt_ioc->name);
5941 break;
5942 } else if (ioc_srch->alt_ioc != NULL) {
5943 - printk(MYIOC_s_WARN_FMT "Oops, already bound (%s <==> %s)!\n",
5944 - ioc_srch->name, ioc_srch->name, ioc_srch->alt_ioc->name);
5945 + printk(MYIOC_s_WARN_FMT
5946 + "Oops, already bound (%s <==> %s)!\n",
5947 + ioc_srch->name, ioc_srch->name,
5948 + ioc_srch->alt_ioc->name);
5949 break;
5950 }
5951 - dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FOUND! binding %s <==> %s\n",
5952 + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5953 + "FOUND! binding %s <==> %s\n",
5954 ioc->name, ioc->name, ioc_srch->name));
5955 ioc_srch->alt_ioc = ioc;
5956 ioc->alt_ioc = ioc_srch;
5957 @@ -2561,10 +2602,11 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc,
5958 pci_dev_put(peer);
5959 }
5960
5961 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5962 /**
5963 * mpt_adapter_disable - Disable misbehaving MPT adapter.
5964 * @ioc: Pointer to MPT adapter structure
5965 - **/
5966 + */
5967 static void
5968 mpt_adapter_disable(MPT_ADAPTER *ioc)
5969 {
5970 @@ -2577,7 +2619,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
5971 if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)
5972 ioc->cached_fw, CAN_SLEEP)) < 0) {
5973 printk(MYIOC_s_WARN_FMT
5974 - ": firmware downloadboot failure (%d)!\n", ioc->name, ret);
5975 + ": firmware downloadboot failure (%d)!\n",
5976 + ioc->name, ret);
5977 }
5978 }
5979
5980 @@ -2585,15 +2628,15 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
5981 * Put the controller into ready state (if its not already)
5982 */
5983 if (mpt_GetIocState(ioc, 1) != MPI_IOC_STATE_READY) {
5984 - if(!SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET,
5985 + if (!SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET,
5986 CAN_SLEEP)) {
5987 if (mpt_GetIocState(ioc, 1) != MPI_IOC_STATE_READY)
5988 printk(MYIOC_s_ERR_FMT "%s: IOC msg unit "
5989 "reset failed to put ioc in ready state!\n",
5990 - ioc->name, __FUNCTION__);
5991 + ioc->name, __func__);
5992 } else
5993 printk(MYIOC_s_ERR_FMT "%s: IOC msg unit reset "
5994 - "failed!\n", ioc->name, __FUNCTION__);
5995 + "failed!\n", ioc->name, __func__);
5996 }
5997
5998 /* Disable adapter interrupts! */
5999 @@ -2607,8 +2650,9 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
6000
6001 if (ioc->alloc != NULL) {
6002 sz = ioc->alloc_sz;
6003 - dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free @ %p, sz=%d bytes\n",
6004 - ioc->name, ioc->alloc, ioc->alloc_sz));
6005 + dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6006 + "free @ %p, sz=%d bytes\n", ioc->name,
6007 + ioc->alloc, ioc->alloc_sz));
6008 pci_free_consistent(ioc->pcidev, sz,
6009 ioc->alloc, ioc->alloc_dma);
6010 ioc->reply_frames = NULL;
6011 @@ -2666,10 +2710,11 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
6012 MPI_DB_HPBAC_FREE_BUFFER, NO_SLEEP)) != 0) {
6013 printk(MYIOC_s_ERR_FMT
6014 ": %s: host page buffers free failed (%d)!\n",
6015 - ioc->name, __FUNCTION__, ret);
6016 + ioc->name, __func__, ret);
6017 }
6018 - dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HostPageBuffer free @ %p, sz=%d bytes\n",
6019 - ioc->name, ioc->HostPageBuffer, ioc->HostPageBuffer_sz));
6020 + dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6021 + "HostPageBuffer free @ %p, sz=%d bytes\n", ioc->name,
6022 + ioc->HostPageBuffer, ioc->HostPageBuffer_sz));
6023 pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz,
6024 ioc->HostPageBuffer,
6025 ioc->HostPageBuffer_dma);
6026 @@ -2681,13 +2726,14 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
6027 pci_set_drvdata(ioc->pcidev, NULL);
6028 }
6029
6030 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6031 /**
6032 * mpt_adapter_dispose - Free all resources associated with an MPT adapter
6033 * @ioc: Pointer to MPT adapter structure
6034 *
6035 * This routine unregisters h/w resources and frees all alloc'd memory
6036 * associated with a MPT adapter structure.
6037 - **/
6038 + */
6039 static void
6040 mpt_adapter_dispose(MPT_ADAPTER *ioc)
6041 {
6042 @@ -2718,7 +2764,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
6043 #if defined(CONFIG_MTRR) && 0
6044 if (ioc->mtrr_reg > 0) {
6045 mtrr_del(ioc->mtrr_reg, 0, 0);
6046 - dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MTRR region de-registered\n", ioc->name));
6047 + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6048 + "MTRR region de-registered\n", ioc->name));
6049 }
6050 #endif
6051
6052 @@ -2727,7 +2774,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
6053
6054 sz_last = ioc->alloc_total;
6055 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free'd %d of %d bytes\n",
6056 - ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first));
6057 + ioc->name, sz_first-sz_last+(int)sizeof(*ioc),
6058 + sz_first));
6059
6060 if (ioc->alt_ioc)
6061 ioc->alt_ioc->alt_ioc = NULL;
6062 @@ -2735,10 +2783,11 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
6063 kfree(ioc);
6064 }
6065
6066 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6067 /**
6068 * MptDisplayIocCapabilities - Disply IOC's capabilities.
6069 * @ioc: Pointer to MPT adapter structure
6070 - **/
6071 + */
6072 static void
6073 MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
6074 {
6075 @@ -2777,6 +2826,7 @@ MptDisplayIocCapabilities(MPT_ADAPTER *i
6076 printk("}\n");
6077 }
6078
6079 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6080 /**
6081 * MakeIocReady - Get IOC to a READY state, using KickStart if needed.
6082 * @ioc: Pointer to MPT_ADAPTER structure
6083 @@ -2790,7 +2840,7 @@ MptDisplayIocCapabilities(MPT_ADAPTER *i
6084 * -2 - Msg Unit Reset Failed
6085 * -3 - IO Unit Reset Failed
6086 * -4 - IOC owned by a PEER
6087 - **/
6088 + */
6089 static int
6090 MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
6091 {
6092 @@ -2804,7 +2854,8 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6093
6094 /* Get current [raw] IOC state */
6095 ioc_state = mpt_GetIocState(ioc, 0);
6096 - dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MakeIocReady, [raw] state=%08x\n", ioc->name, ioc_state));
6097 + dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6098 + "MakeIocReady, [raw] state=%08x\n", ioc->name, ioc_state));
6099
6100 /*
6101 * Check to see if IOC got left/stuck in doorbell handshake
6102 @@ -2817,8 +2868,10 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6103 }
6104
6105 /* Is it already READY? */
6106 - if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) {
6107 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "IOC is in READY state\n",
6108 + if (!statefault &&
6109 + (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) {
6110 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6111 + "IOC is in READY state\n",
6112 ioc->name));
6113 return 0;
6114 }
6115 @@ -2894,8 +2947,9 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6116
6117 ii++; cntdn--;
6118 if (!cntdn) {
6119 - printk(MYIOC_s_ERR_FMT "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6120 - ioc->name, ioc_state, (int)((ii+5)/HZ));
6121 + printk(MYIOC_s_ERR_FMT
6122 + "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6123 + ioc->name, ioc_state, (int)((ii+5)/HZ));
6124 return -ETIME;
6125 }
6126
6127 @@ -2916,6 +2970,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6128 return hard_reset_done;
6129 }
6130
6131 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6132 /**
6133 * mpt_GetIocState - Get the current state of a MPT adapter.
6134 * @ioc: Pointer to MPT_ADAPTER structure
6135 @@ -2923,7 +2978,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6136 *
6137 * Returns all IOC Doorbell register bits if cooked==0, else just the
6138 * Doorbell bits in MPI_IOC_STATE_MASK.
6139 - **/
6140 + */
6141 u32
6142 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked)
6143 {
6144 @@ -2939,6 +2994,7 @@ mpt_GetIocState(MPT_ADAPTER *ioc, int co
6145 return cooked ? sc : s;
6146 }
6147
6148 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6149 /**
6150 * GetIocFacts - Send IOCFacts request to MPT adapter.
6151 * @ioc: Pointer to MPT_ADAPTER structure
6152 @@ -2946,7 +3002,7 @@ mpt_GetIocState(MPT_ADAPTER *ioc, int co
6153 * @reason: If recovery, only update facts.
6154 *
6155 * Returns 0 for success, non-zero for failure.
6156 - **/
6157 + */
6158 static int
6159 GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
6160 {
6161 @@ -2961,9 +3017,9 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6162
6163 /* IOC *must* NOT be in RESET state! */
6164 if (ioc->last_state == MPI_IOC_STATE_RESET) {
6165 - printk(KERN_ERR MYNAM ": ERROR - Can't get IOCFacts, %s NOT READY! (%08x)\n",
6166 - ioc->name,
6167 - ioc->last_state );
6168 + printk(KERN_ERR MYNAM
6169 + ": ERROR - Can't get IOCFacts, %s NOT READY! (%08x)\n",
6170 + ioc->name, ioc->last_state);
6171 return -44;
6172 }
6173
6174 @@ -3011,7 +3067,8 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6175
6176 facts->MsgVersion = le16_to_cpu(facts->MsgVersion);
6177 if (facts->MsgVersion == MPI_VERSION_01_05)
6178 - facts->HeaderVersion = le16_to_cpu(facts->HeaderVersion);
6179 + facts->HeaderVersion =
6180 + le16_to_cpu(facts->HeaderVersion);
6181 facts->MsgContext = le32_to_cpu(facts->MsgContext);
6182 facts->IOCExceptions = le16_to_cpu(facts->IOCExceptions);
6183 facts->IOCStatus = le16_to_cpu(facts->IOCStatus);
6184 @@ -3120,6 +3177,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6185 return 0;
6186 }
6187
6188 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6189 /**
6190 * GetPortFacts - Send PortFacts request to MPT adapter.
6191 * @ioc: Pointer to MPT_ADAPTER structure
6192 @@ -3127,7 +3185,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6193 * @sleepFlag: Specifies whether the process can sleep
6194 *
6195 * Returns 0 for success, non-zero for failure.
6196 - **/
6197 + */
6198 static int
6199 GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
6200 {
6201 @@ -3141,7 +3199,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6202 /* IOC *must* NOT be in RESET state! */
6203 if (ioc->last_state == MPI_IOC_STATE_RESET) {
6204 printk(MYIOC_s_ERR_FMT "Can't get PortFacts, "
6205 - " NOT READY! (%08x)\n", ioc->name, ioc->last_state );
6206 + " NOT READY! (%08x)\n", ioc->name, ioc->last_state);
6207 return -4;
6208 }
6209
6210 @@ -3159,14 +3217,14 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6211 get_pfacts.PortNumber = portnum;
6212 /* Assert: All other get_pfacts fields are zero! */
6213
6214 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "Sending get PortFacts(%d) request\n",
6215 - ioc->name, portnum));
6216 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6217 + "Sending get PortFacts(%d) request\n", ioc->name, portnum));
6218
6219 /* No non-zero fields in the get_pfacts request are greater than
6220 * 1 byte in size, so we can just fire it off as is.
6221 */
6222 ii = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&get_pfacts,
6223 - reply_sz, (u16*)pfacts, 5 /*seconds*/, sleepFlag);
6224 + reply_sz, (u16 *)pfacts, 5 /*seconds*/, sleepFlag);
6225 if (ii != 0)
6226 return ii;
6227
6228 @@ -3201,6 +3259,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6229 return 0;
6230 }
6231
6232 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6233 /**
6234 * SendIocInit - Send IOCInit request to MPT adapter.
6235 * @ioc: Pointer to MPT_ADAPTER structure
6236 @@ -3209,7 +3268,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6237 * Send IOCInit followed by PortEnable to bring IOC to OPERATIONAL state.
6238 *
6239 * Returns 0 for success, non-zero for failure.
6240 - **/
6241 + */
6242 static int
6243 SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
6244 {
6245 @@ -3323,6 +3382,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepF
6246 return r;
6247 }
6248
6249 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6250 /**
6251 * SendPortEnable - Send PortEnable request to MPT adapter port.
6252 * @ioc: Pointer to MPT_ADAPTER structure
6253 @@ -3332,7 +3392,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepF
6254 * Send PortEnable to bring IOC to OPERATIONAL state.
6255 *
6256 * Returns 0 for success, non-zero for failure.
6257 - **/
6258 + */
6259 static int
6260 SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
6261 {
6262 @@ -3355,18 +3415,19 @@ SendPortEnable(MPT_ADAPTER *ioc, int por
6263 /* port_enable.MsgFlags = 0; */
6264 /* port_enable.MsgContext = 0; */
6265
6266 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "Sending Port(%d)Enable (req @ %p)\n",
6267 - ioc->name, portnum, &port_enable));
6268 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6269 + "Sending Port(%d)Enable (req @ %p)\n", ioc->name,
6270 + portnum, &port_enable));
6271
6272 /* RAID FW may take a long time to enable
6273 */
6274 if (ioc->ir_firmware || ioc->bus_type == SAS) {
6275 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
6276 - (u32*)&port_enable, reply_sz, (u16*)&reply_buf,
6277 + (u32 *)&port_enable, reply_sz, (u16 *)&reply_buf,
6278 300 /*seconds*/, sleepFlag);
6279 } else {
6280 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
6281 - (u32*)&port_enable, reply_sz, (u16*)&reply_buf,
6282 + (u32 *)&port_enable, reply_sz, (u16 *)&reply_buf,
6283 30 /*seconds*/, sleepFlag);
6284 }
6285 return rc;
6286 @@ -3435,6 +3496,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
6287 ioc->cached_fw = NULL;
6288 }
6289
6290 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6291 /**
6292 * mpt_do_upload - Construct and Send FWUpload request to MPT adapter port.
6293 * @ioc: Pointer to MPT_ADAPTER structure
6294 @@ -3447,7 +3509,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
6295 * on the bound IOC, the second image is discarded
6296 * and memory is free'd. Both channels must upload to prevent
6297 * IOC from running in degraded mode.
6298 - **/
6299 + */
6300 static int
6301 mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
6302 {
6303 @@ -3499,8 +3561,8 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6304 ioc->facts.FWImageSize, request_size));
6305 DBG_DUMP_FW_REQUEST_FRAME(ioc, (u32 *)prequest);
6306
6307 - ii = mpt_handshake_req_reply_wait(ioc, request_size, (u32*)prequest,
6308 - reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag);
6309 + ii = mpt_handshake_req_reply_wait(ioc, request_size, (u32 *)prequest,
6310 + reply_sz, (u16 *)preply, 65 /*seconds*/, sleepFlag);
6311
6312 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FW Upload completed "
6313 "rc=%x \n", ioc->name, ii));
6314 @@ -3512,10 +3574,10 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6315 */
6316 int status;
6317 status = le16_to_cpu(preply->IOCStatus) &
6318 - MPI_IOCSTATUS_MASK;
6319 + MPI_IOCSTATUS_MASK;
6320 if (status == MPI_IOCSTATUS_SUCCESS &&
6321 ioc->facts.FWImageSize ==
6322 - le32_to_cpu(preply->ActualImageSize));
6323 + le32_to_cpu(preply->ActualImageSize))
6324 cmdStatus = 0;
6325 }
6326 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "do_upload cmdStatus=%d \n",
6327 @@ -3532,6 +3594,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6328 return cmdStatus;
6329 }
6330
6331 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6332 /**
6333 * mpt_downloadboot - DownloadBoot code
6334 * @ioc: Pointer to MPT_ADAPTER structure
6335 @@ -3544,7 +3607,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6336 * -1 FW Image size is 0
6337 * -2 No valid cached_fw Pointer
6338 * <0 for fw upload failure.
6339 - **/
6340 + */
6341 static int
6342 mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
6343 {
6344 @@ -3648,13 +3711,15 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6345 }
6346
6347 /* Write the IopResetVectorRegAddr */
6348 - ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Addr=%x! \n",
6349 - ioc->name, pFwHeader->IopResetRegAddr));
6350 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6351 + "Write IopResetVector Addr=%x!\n", ioc->name,
6352 + pFwHeader->IopResetRegAddr));
6353 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->IopResetRegAddr);
6354
6355 /* Write the IopResetVectorValue */
6356 - ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Value=%x! \n",
6357 - ioc->name, pFwHeader->IopResetVectorValue));
6358 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6359 + "Write IopResetVector Value=%x!\n", ioc->name,
6360 + pFwHeader->IopResetVectorValue));
6361 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, pFwHeader->IopResetVectorValue);
6362
6363 /* Clear the internal flash bad bit - autoincrementing register,
6364 @@ -3684,7 +3749,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6365 ioc->name, diag0val));
6366 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val);
6367
6368 - if (ioc->bus_type == SAS ) {
6369 + if (ioc->bus_type == SAS) {
6370 /* wait 1 sec */
6371 if (sleepFlag == CAN_SLEEP)
6372 msleep(1000);
6373 @@ -3692,7 +3757,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6374 mdelay(1000);
6375
6376 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
6377 - ddlprintk(ioc, printk (MYIOC_s_DEBUG_FMT
6378 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6379 "diag0val=%x, turning off RW_ENABLE\n", ioc->name,
6380 diag0val));
6381 diag0val &= ~(MPI_DIAG_RW_ENABLE);
6382 @@ -3715,8 +3780,9 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6383 /* Write 0xFF to reset the sequencer */
6384 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
6385
6386 - for (count = 0; count < 30; count ++) {
6387 - doorbell = CHIPREG_READ32(&ioc->chip->Doorbell) & MPI_IOC_STATE_MASK;
6388 + for (count = 0; count < 30; count++) {
6389 + doorbell = CHIPREG_READ32(&ioc->chip->Doorbell)
6390 + & MPI_IOC_STATE_MASK;
6391 if (doorbell == MPI_IOC_STATE_READY) {
6392 if (ioc->bus_type == SAS)
6393 return 0;
6394 @@ -3729,17 +3795,20 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6395 "SendIocInit successful\n", ioc->name));
6396 return 0;
6397 }
6398 - ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "looking for READY STATE:"
6399 - " doorbell=%x count=%d\n", ioc->name, doorbell, count));
6400 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6401 + "looking for READY STATE: doorbell=%x count=%d\n",
6402 + ioc->name, doorbell, count));
6403 if (sleepFlag == CAN_SLEEP)
6404 msleep(1000);
6405 else
6406 mdelay(1000);
6407 }
6408 - ddlprintk(ioc, printk(MYIOC_s_WARN_FMT "downloadboot failed! count=%d\n", ioc->name, count));
6409 + ddlprintk(ioc, printk(MYIOC_s_WARN_FMT
6410 + "downloadboot failed! count=%d\n", ioc->name, count));
6411 return -EFAULT;
6412 }
6413
6414 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6415 /**
6416 * KickStart - Perform hard reset of MPT adapter.
6417 * @ioc: Pointer to MPT_ADAPTER structure
6418 @@ -3764,7 +3833,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6419 * OR reset but failed to come READY
6420 * -2 - no reset, could not enter DIAG mode
6421 * -3 - reset but bad FW bit
6422 - **/
6423 + */
6424 static int
6425 KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
6426 {
6427 @@ -3790,16 +3859,20 @@ KickStart(MPT_ADAPTER *ioc, int force, i
6428 if (hard_reset_done < 0)
6429 return hard_reset_done;
6430
6431 - /* may not have worked but hard_reset_done doesn't always signal failure */
6432 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "Diagnostic reset completed!\n",
6433 - ioc->name));
6434 + /* may not have worked but hard_reset_done
6435 + * doesn't always signal failure
6436 + */
6437 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6438 + "Diagnostic reset completed!\n", ioc->name));
6439
6440 cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 2; /* 2 seconds */
6441 for (cnt=0; cnt<cntdn; cnt++) {
6442 ioc_state = mpt_GetIocState(ioc, 1);
6443 - if ((ioc_state == MPI_IOC_STATE_READY) || (ioc_state == MPI_IOC_STATE_OPERATIONAL)) {
6444 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "KickStart successful! (cnt=%d)\n",
6445 - ioc->name, cnt));
6446 + if ((ioc_state == MPI_IOC_STATE_READY) ||
6447 + (ioc_state == MPI_IOC_STATE_OPERATIONAL)) {
6448 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6449 + "KickStart successful! (cnt=%d)\n", ioc->name,
6450 + cnt));
6451 return hard_reset_done;
6452 }
6453 if (sleepFlag == CAN_SLEEP) {
6454 @@ -3814,6 +3887,7 @@ KickStart(MPT_ADAPTER *ioc, int force, i
6455 return -1;
6456 }
6457
6458 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6459 /**
6460 * mpt_diag_reset - Perform hard reset of the adapter.
6461 * @ioc: Pointer to MPT_ADAPTER structure
6462 @@ -3831,7 +3905,7 @@ KickStart(MPT_ADAPTER *ioc, int force, i
6463 * 0 no reset performed because reset history bit set
6464 * -2 enabling diagnostic mode failed
6465 * -3 diagnostic reset failed
6466 - **/
6467 + */
6468 static int
6469 mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
6470 {
6471 @@ -3852,7 +3926,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6472 return 0;
6473
6474 drsprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
6475 - "address=%p\n", ioc->name, __FUNCTION__, &ioc->chip->Doorbell,
6476 + "address=%p\n", ioc->name, __func__, &ioc->chip->Doorbell,
6477 &ioc->chip->Reset_1078));
6478 CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07);
6479 if (sleepFlag == CAN_SLEEP)
6480 @@ -3868,7 +3942,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6481 */
6482 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
6483 if (MptResetHandlers[cb_idx])
6484 - (*(MptResetHandlers[cb_idx]))(ioc, MPT_IOC_PRE_RESET);
6485 + (*(MptResetHandlers[cb_idx]))
6486 + (ioc, MPT_IOC_PRE_RESET);
6487 }
6488
6489 for (count = 0; count < 60; count ++) {
6490 @@ -3907,8 +3982,10 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6491
6492 if (ioc->debug_level & MPT_DEBUG_RESET) {
6493 if (ioc->alt_ioc)
6494 - diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6495 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG1: diag0=%08x, diag1=%08x\n",
6496 + diag1val =
6497 + CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6498 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6499 + "DbG1: diag0=%08x, diag1=%08x\n",
6500 ioc->name, diag0val, diag1val));
6501 }
6502
6503 @@ -3943,14 +4020,16 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6504
6505 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
6506
6507 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Wrote magic DiagWriteEn sequence (%x)\n",
6508 - ioc->name, diag0val));
6509 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6510 + "Wrote magic DiagWriteEn sequence (%x)\n",
6511 + ioc->name, diag0val));
6512 }
6513
6514 if (ioc->debug_level & MPT_DEBUG_RESET) {
6515 if (ioc->alt_ioc)
6516 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6517 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG2: diag0=%08x, diag1=%08x\n",
6518 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6519 + "DbG2: diag0=%08x, diag1=%08x\n",
6520 ioc->name, diag0val, diag1val));
6521 }
6522 /*
6523 @@ -3966,8 +4045,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6524 */
6525 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER);
6526 hard_reset_done = 1;
6527 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Diagnostic reset performed\n",
6528 - ioc->name));
6529 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6530 + "Diagnostic reset performed\n", ioc->name));
6531
6532 /*
6533 * Call each currently registered protocol IOC reset handler
6534 @@ -3977,10 +4056,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6535 */
6536 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
6537 if (MptResetHandlers[cb_idx]) {
6538 - mpt_signal_reset(cb_idx, ioc, MPT_IOC_PRE_RESET);
6539 - if (ioc->alt_ioc) {
6540 - mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_PRE_RESET);
6541 - }
6542 + mpt_signal_reset(cb_idx, ioc,
6543 + MPT_IOC_PRE_RESET);
6544 + if (ioc->alt_ioc)
6545 + mpt_signal_reset(cb_idx,
6546 + ioc->alt_ioc, MPT_IOC_PRE_RESET);
6547 }
6548 }
6549
6550 @@ -4001,7 +4081,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6551 break;
6552 }
6553
6554 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "cached_fw: diag0val=%x count=%d\n",
6555 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6556 + "cached_fw: diag0val=%x count=%d\n",
6557 ioc->name, diag0val, count));
6558 /* wait 1 sec */
6559 if (sleepFlag == CAN_SLEEP)
6560 @@ -4055,7 +4136,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6561 if (ioc->debug_level & MPT_DEBUG_RESET) {
6562 if (ioc->alt_ioc)
6563 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6564 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG3: diag0=%08x, diag1=%08x\n",
6565 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6566 + "DbG3: diag0=%08x, diag1=%08x\n",
6567 ioc->name, diag0val, diag1val));
6568 }
6569
6570 @@ -4113,8 +4195,9 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6571 if (ioc->debug_level & MPT_DEBUG_RESET) {
6572 if (ioc->alt_ioc)
6573 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6574 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG4: diag0=%08x, diag1=%08x\n",
6575 - ioc->name, diag0val, diag1val));
6576 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6577 + "DbG4: diag0=%08x, diag1=%08x\n",
6578 + ioc->name, diag0val, diag1val));
6579 }
6580
6581 /*
6582 @@ -4128,6 +4211,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6583 return hard_reset_done;
6584 }
6585
6586 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6587 /**
6588 * SendIocReset - Send IOCReset request to MPT adapter.
6589 * @ioc: Pointer to MPT_ADAPTER structure
6590 @@ -4138,7 +4222,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6591 * Send IOCReset request to the MPT adapter.
6592 *
6593 * Returns 0 for success, non-zero for failure.
6594 - **/
6595 + */
6596 static int
6597 SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
6598 {
6599 @@ -4164,8 +4248,9 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_
6600 if (sleepFlag != CAN_SLEEP)
6601 count *= 10;
6602
6603 - printk(MYIOC_s_ERR_FMT "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6604 - ioc->name, state, (int)((count+5)/HZ));
6605 + printk(MYIOC_s_ERR_FMT
6606 + "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6607 + ioc->name, state, (int)((count+5)/HZ));
6608 return -ETIME;
6609 }
6610
6611 @@ -4176,23 +4261,20 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_
6612 }
6613 }
6614
6615 - /* TODO!
6616 - * Cleanup all event stuff for this IOC; re-issue EventNotification
6617 - * request if needed.
6618 - */
6619 if (ioc->facts.Function)
6620 ioc->facts.EventState = 0;
6621
6622 return 0;
6623 }
6624
6625 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6626 /**
6627 * initChainBuffers - Allocate memory for and initialize chain buffers
6628 * @ioc: Pointer to MPT_ADAPTER structure
6629 *
6630 * Allocates memory for and initializes chain buffers,
6631 * chain buffer control arrays and spinlock.
6632 - **/
6633 + */
6634 static int
6635 initChainBuffers(MPT_ADAPTER *ioc)
6636 {
6637 @@ -4234,11 +4316,11 @@ initChainBuffers(MPT_ADAPTER *ioc)
6638 * num_sge = num sge in request frame + last chain buffer
6639 * scale = num sge per chain buffer if no chain element
6640 */
6641 - scale = ioc->req_sz/ ioc->SGE_size;
6642 + scale = ioc->req_sz / ioc->SGE_size;
6643 if (ioc->sg_addr_size == sizeof(u64))
6644 num_sge = scale + (ioc->req_sz - 60) / ioc->SGE_size;
6645 else
6646 - num_sge = 1+ scale + (ioc->req_sz - 64) / ioc->SGE_size;
6647 + num_sge = 1 + scale + (ioc->req_sz - 64) / ioc->SGE_size;
6648
6649 if (ioc->sg_addr_size == sizeof(u64)) {
6650 numSGE = (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale +
6651 @@ -4253,8 +4335,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
6652 if (ioc->bus_type == FC) {
6653 if (numSGE > MPT_SCSI_FC_SG_DEPTH)
6654 numSGE = MPT_SCSI_FC_SG_DEPTH;
6655 - }
6656 - else {
6657 + } else {
6658 if (numSGE > MPT_SCSI_SG_DEPTH)
6659 numSGE = MPT_SCSI_SG_DEPTH;
6660 }
6661 @@ -4292,6 +4373,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
6662 return num_chain;
6663 }
6664
6665 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6666 /**
6667 * PrimeIocFifos - Initialize IOC request and reply FIFOs.
6668 * @ioc: Pointer to MPT_ADAPTER structure
6669 @@ -4301,7 +4383,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
6670 * reply frames.
6671 *
6672 * Returns 0 for success, non-zero for failure.
6673 - **/
6674 + */
6675 static int
6676 PrimeIocFifos(MPT_ADAPTER *ioc)
6677 {
6678 @@ -4513,6 +4595,7 @@ out_fail:
6679 return -1;
6680 }
6681
6682 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6683 /**
6684 * mpt_handshake_req_reply_wait - Send MPT request to and receive reply
6685 * from IOC via doorbell handshake method.
6686 @@ -4530,7 +4613,7 @@ out_fail:
6687 * greater than 1 byte in size.
6688 *
6689 * Returns 0 for success, non-zero for failure.
6690 - **/
6691 + */
6692 static int
6693 mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
6694 int replyBytes, u16 *u16reply, int maxwait, int sleepFlag)
6695 @@ -4624,6 +4707,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER
6696 return -failcnt;
6697 }
6698
6699 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6700 /**
6701 * WaitForDoorbellAck - Wait for IOC doorbell handshake acknowledge
6702 * @ioc: Pointer to MPT_ADAPTER structure
6703 @@ -4635,7 +4719,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER
6704 * bit in its IntStatus register being clear.
6705 *
6706 * Returns a negative value on failure, else wait loop count.
6707 - **/
6708 + */
6709 static int
6710 WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
6711 {
6712 @@ -4674,6 +4758,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int
6713 return -1;
6714 }
6715
6716 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6717 /**
6718 * WaitForDoorbellInt - Wait for IOC to set its doorbell interrupt bit
6719 * @ioc: Pointer to MPT_ADAPTER structure
6720 @@ -4684,7 +4769,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int
6721 * (MPI_HIS_DOORBELL_INTERRUPT) to be set in the IntStatus register.
6722 *
6723 * Returns a negative value on failure, else wait loop count.
6724 - **/
6725 + */
6726 static int
6727 WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
6728 {
6729 @@ -4703,7 +4788,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
6730 }
6731 } else {
6732 while (--cntdn) {
6733 - udelay (1000);
6734 + udelay(1000);
6735 intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
6736 if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
6737 break;
6738 @@ -4722,6 +4807,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
6739 return -1;
6740 }
6741
6742 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6743 /**
6744 * WaitForDoorbellReply - Wait for and capture an IOC handshake reply.
6745 * @ioc: Pointer to MPT_ADAPTER structure
6746 @@ -4733,7 +4819,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
6747 * of 128 bytes of reply data.
6748 *
6749 * Returns a negative value on failure, else size of reply in WORDS.
6750 - **/
6751 + */
6752 static int
6753 WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
6754 {
6755 @@ -4807,6 +4893,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, i
6756 return u16cnt/2;
6757 }
6758
6759 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6760 /**
6761 * GetLanConfigPages - Fetch LANConfig pages.
6762 * @ioc: Pointer to MPT_ADAPTER structure
6763 @@ -4816,7 +4903,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, i
6764 * -EPERM if not allowed due to ISR context
6765 * -EAGAIN if no msg frames currently available
6766 * -EFAULT for non-successful reply or no reply (timeout)
6767 - **/
6768 + */
6769 static int
6770 GetLanConfigPages(MPT_ADAPTER *ioc)
6771 {
6772 @@ -4863,10 +4950,6 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
6773
6774 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
6775
6776 - /* FIXME!
6777 - * Normalize endianness of structure data,
6778 - * by byte-swapping all > 1 byte fields!
6779 - */
6780
6781 }
6782
6783 @@ -4907,16 +4990,12 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
6784
6785 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage1_alloc, page1_dma);
6786
6787 - /* FIXME!
6788 - * Normalize endianness of structure data,
6789 - * by byte-swapping all > 1 byte fields!
6790 - */
6791 -
6792 }
6793
6794 return rc;
6795 }
6796
6797 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6798 /**
6799 * mptbase_sas_persist_operation - Perform operation on SAS Persistent Table
6800 * @ioc: Pointer to MPT_ADAPTER structure
6801 @@ -4929,7 +5008,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
6802 * NOTE: Don't use not this function during interrupt time.
6803 *
6804 * Returns 0 for success, non-zero error
6805 - **/
6806 + */
6807 int
6808 mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode)
6809 {
6810 @@ -4958,12 +5037,12 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6811 goto out;
6812 }
6813
6814 - printk("%s: persist_opcode=%x\n",__FUNCTION__, persist_opcode);
6815 + printk("%s: persist_opcode=%x\n",__func__, persist_opcode);
6816
6817 /* Get a MF for this command.
6818 */
6819 if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
6820 - printk("%s: no msg frames!\n",__FUNCTION__);
6821 + printk("%s: no msg frames!\n",__func__);
6822 ret = -1;
6823 goto out;
6824 }
6825 @@ -4979,12 +5058,12 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6826 timeleft = wait_for_completion_timeout(&ioc->mptbase_cmds.done, 10*HZ);
6827 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
6828 ret = -ETIME;
6829 - printk("%s: failed\n", __FUNCTION__);
6830 + printk(KERN_WARNING "%s: failed\n", __func__);
6831 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
6832 goto out;
6833 if (!timeleft) {
6834 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
6835 - ioc->name, __FUNCTION__);
6836 + ioc->name, __func__);
6837 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
6838 mpt_HardResetHandler(ioc, CAN_SLEEP);
6839 mpt_free_msg_frame(ioc, mf);
6840 @@ -5000,12 +5079,13 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6841 sasIoUnitCntrReply =
6842 (SasIoUnitControlReply_t *)ioc->mptbase_cmds.reply;
6843 if (le16_to_cpu(sasIoUnitCntrReply->IOCStatus) != MPI_IOCSTATUS_SUCCESS) {
6844 - printk("%s: IOCStatus=0x%X IOCLogInfo=0x%X\n", __FUNCTION__,
6845 - sasIoUnitCntrReply->IOCStatus, sasIoUnitCntrReply->IOCLogInfo);
6846 - printk("%s: failed\n",__FUNCTION__);
6847 + printk(KERN_WARNING "%s: IOCStatus=0x%X IOCLogInfo=0x%X\n",
6848 + __func__, sasIoUnitCntrReply->IOCStatus,
6849 + sasIoUnitCntrReply->IOCLogInfo);
6850 + printk(KERN_WARNING "%s: failed\n", __func__);
6851 ret = -1;
6852 } else
6853 - printk("%s: success\n",__FUNCTION__);
6854 + printk(KERN_INFO "%s: success\n", __func__);
6855 out:
6856
6857 CLEAR_MGMT_STATUS(ioc->mptbase_cmds.status)
6858 @@ -5013,6 +5093,8 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6859 return ret;
6860 }
6861
6862 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6863 +
6864 static void
6865 mptbase_raid_process_event_data(MPT_ADAPTER *ioc,
6866 MpiEventDataRaid_t * pRaidEventData)
6867 @@ -5143,6 +5225,7 @@ mptbase_raid_process_event_data(MPT_ADAP
6868 }
6869 }
6870
6871 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6872 /**
6873 * GetIoUnitPage2 - Retrieve BIOS version and boot order information.
6874 * @ioc: Pointer to MPT_ADAPTER structure
6875 @@ -5152,7 +5235,7 @@ mptbase_raid_process_event_data(MPT_ADAP
6876 * -EPERM if not allowed due to ISR context
6877 * -EAGAIN if no msg frames currently available
6878 * -EFAULT for non-successful reply or no reply (timeout)
6879 - **/
6880 + */
6881 static int
6882 GetIoUnitPage2(MPT_ADAPTER *ioc)
6883 {
6884 @@ -5200,6 +5283,7 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
6885 return rc;
6886 }
6887
6888 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6889 /**
6890 * mpt_GetScsiPortSettings - read SCSI Port Page 0 and 2
6891 * @ioc: Pointer to a Adapter Strucutre
6892 @@ -5219,7 +5303,7 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
6893 * Both valid
6894 * Return 0
6895 * CHECK - what type of locking mechanisms should be used????
6896 - **/
6897 + */
6898 static int
6899 mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
6900 {
6901 @@ -5290,7 +5374,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6902
6903 if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) {
6904 ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS;
6905 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "noQas due to Capabilities=%x\n",
6906 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6907 + "noQas due to Capabilities=%x\n",
6908 ioc->name, pPP0->Capabilities));
6909 }
6910 ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0;
6911 @@ -5299,7 +5384,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6912 ioc->spi_data.maxSyncOffset = (u8) (data >> 16);
6913 data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK;
6914 ioc->spi_data.minSyncFactor = (u8) (data >> 8);
6915 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PortPage0 minSyncFactor=%x\n",
6916 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6917 + "PortPage0 minSyncFactor=%x\n",
6918 ioc->name, ioc->spi_data.minSyncFactor));
6919 } else {
6920 ioc->spi_data.maxSyncOffset = 0;
6921 @@ -5315,7 +5401,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6922
6923 if (ioc->spi_data.minSyncFactor < MPT_ULTRA) {
6924 ioc->spi_data.minSyncFactor = MPT_ULTRA;
6925 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HVD or SE detected, minSyncFactor=%x\n",
6926 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6927 + "HVD or SE detected, minSyncFactor=%x\n",
6928 ioc->name, ioc->spi_data.minSyncFactor));
6929 }
6930 }
6931 @@ -5420,6 +5507,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6932 return rc;
6933 }
6934
6935 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6936 /**
6937 * mpt_readScsiDevicePageHeaders - save version and length of SDP1
6938 * @ioc: Pointer to a Adapter Strucutre
6939 @@ -5427,7 +5515,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6940 *
6941 * Return: -EFAULT if read of config page header fails
6942 * or 0 if success.
6943 - **/
6944 + */
6945 static int
6946 mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum)
6947 {
6948 @@ -5475,7 +5563,7 @@ mpt_read_ioc_pg_6(MPT_ADAPTER *ioc)
6949 {
6950 CONFIGPARMS cfg;
6951 ConfigPageHeader_t header;
6952 - IOCPage6_t *pIoc6=NULL;
6953 + IOCPage6_t *pIoc6 = NULL;
6954 dma_addr_t ioc6_dma;
6955 int iocpage6sz;
6956 void *mem;
6957 @@ -5546,13 +5634,13 @@ mpt_inactive_raid_list_free(MPT_ADAPTER
6958 if (list_empty(&ioc->raid_data.inactive_list))
6959 return;
6960
6961 - down(&ioc->raid_data.inactive_list_mutex);
6962 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
6963 list_for_each_entry_safe(component_info, pNext,
6964 &ioc->raid_data.inactive_list, list) {
6965 list_del(&component_info->list);
6966 kfree(component_info);
6967 }
6968 - up(&ioc->raid_data.inactive_list_mutex);
6969 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
6970 }
6971
6972 /**
6973 @@ -5615,7 +5703,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
6974 if (!handle_inactive_volumes)
6975 goto out;
6976
6977 - down(&ioc->raid_data.inactive_list_mutex);
6978 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
6979 for (i = 0; i < buffer->NumPhysDisks; i++) {
6980 if(mpt_raid_phys_disk_pg0(ioc,
6981 buffer->PhysDisk[i].PhysDiskNum, &phys_disk) != 0)
6982 @@ -5631,7 +5719,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
6983 buffer->PhysDisk[i].PhysDiskNum);
6984 if (num_paths < 2)
6985 continue;
6986 - phys_disk_1 = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
6987 + phys_disk_1 = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
6988 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
6989 if (!phys_disk_1)
6990 continue;
6991 @@ -5658,7 +5746,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
6992 list_add_tail(&component_info->list,
6993 &ioc->raid_data.inactive_list);
6994 }
6995 - up(&ioc->raid_data.inactive_list_mutex);
6996 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
6997
6998 out:
6999 if (buffer)
7000 @@ -5678,7 +5766,8 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
7001 * -ENOMEM if pci_alloc failed
7002 **/
7003 int
7004 -mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, RaidPhysDiskPage0_t *phys_disk)
7005 +mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num,
7006 + RaidPhysDiskPage0_t *phys_disk)
7007 {
7008 CONFIGPARMS cfg;
7009 ConfigPageHeader_t hdr;
7010 @@ -5812,7 +5901,8 @@ mpt_raid_phys_disk_get_num_paths(MPT_ADA
7011 * -ENOMEM if pci_alloc failed
7012 **/
7013 int
7014 -mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, RaidPhysDiskPage1_t *phys_disk)
7015 +mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num,
7016 + RaidPhysDiskPage1_t *phys_disk)
7017 {
7018 CONFIGPARMS cfg;
7019 ConfigPageHeader_t hdr;
7020 @@ -5865,14 +5955,20 @@ mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc,
7021 for (i = 0; i < phys_disk->NumPhysDiskPaths; i++) {
7022 phys_disk->Path[i].PhysDiskID = buffer->Path[i].PhysDiskID;
7023 phys_disk->Path[i].PhysDiskBus = buffer->Path[i].PhysDiskBus;
7024 - phys_disk->Path[i].OwnerIdentifier = buffer->Path[i].OwnerIdentifier;
7025 - phys_disk->Path[i].Flags = le16_to_cpu(buffer->Path[i].Flags);
7026 - memcpy(&sas_address, &buffer->Path[i].WWID, sizeof(__le64));
7027 + phys_disk->Path[i].OwnerIdentifier =
7028 + buffer->Path[i].OwnerIdentifier;
7029 + phys_disk->Path[i].Flags =
7030 + le16_to_cpu(buffer->Path[i].Flags);
7031 + memcpy(&sas_address, &buffer->Path[i].WWID,
7032 + sizeof(__le64));
7033 sas_address = le64_to_cpu(sas_address);
7034 - memcpy(&phys_disk->Path[i].WWID, &sas_address, sizeof(__le64));
7035 - memcpy(&sas_address, &buffer->Path[i].OwnerWWID, sizeof(__le64));
7036 + memcpy(&phys_disk->Path[i].WWID, &sas_address,
7037 + sizeof(__le64));
7038 + memcpy(&sas_address, &buffer->Path[i].OwnerWWID,
7039 + sizeof(__le64));
7040 sas_address = le64_to_cpu(sas_address);
7041 - memcpy(&phys_disk->Path[i].OwnerWWID, &sas_address, sizeof(__le64));
7042 + memcpy(&phys_disk->Path[i].OwnerWWID, &sas_address,
7043 + sizeof(__le64));
7044 }
7045
7046 out:
7047 @@ -5896,8 +5992,8 @@ mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc,
7048 static int
7049 mpt_sort_ioc_pg2(const void *a, const void *b)
7050 {
7051 - ConfigPageIoc2RaidVol_t * volume_a = (ConfigPageIoc2RaidVol_t *)a;
7052 - ConfigPageIoc2RaidVol_t * volume_b = (ConfigPageIoc2RaidVol_t *)b;
7053 + ConfigPageIoc2RaidVol_t *volume_a = (ConfigPageIoc2RaidVol_t *)a;
7054 + ConfigPageIoc2RaidVol_t *volume_b = (ConfigPageIoc2RaidVol_t *)b;
7055
7056 if (volume_a->VolumeBus == volume_b->VolumeBus) {
7057 if (volume_a->VolumeID == volume_b->VolumeID)
7058 @@ -6186,7 +6282,8 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
7059 }
7060
7061 } else {
7062 - dprintk(ioc, printk(MYIOC_s_WARN_FMT "Coalescing Disabled\n", ioc->name));
7063 + dprintk(ioc, printk(MYIOC_s_WARN_FMT
7064 + "Coalescing Disabled\n", ioc->name));
7065 }
7066 }
7067
7068 @@ -6238,12 +6335,13 @@ mpt_get_manufacturing_pg_0(MPT_ADAPTER *
7069 pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);
7070 }
7071
7072 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7073 /**
7074 * SendEventNotification - Send EventNotification (on or off) request to adapter
7075 * @ioc: Pointer to MPT_ADAPTER structure
7076 * @EvSwitch: Event switch flags
7077 * @sleepFlag: Specifies whether the process can sleep
7078 - **/
7079 + */
7080 static int
7081 SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch, int sleepFlag)
7082 {
7083 @@ -6262,15 +6360,16 @@ SendEventNotification(MPT_ADAPTER *ioc,
7084 ioc->name, EvSwitch, &evn));
7085
7086 return mpt_handshake_req_reply_wait(ioc, sizeof(EventNotification_t),
7087 - (u32*)&evn, sizeof(MPIDefaultReply_t), (u16*)&reply_buf, 30,
7088 + (u32 *)&evn, sizeof(MPIDefaultReply_t), (u16 *)&reply_buf, 30,
7089 sleepFlag);
7090 }
7091
7092 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7093 /**
7094 * SendEventAck - Send EventAck request to MPT adapter.
7095 * @ioc: Pointer to MPT_ADAPTER structure
7096 * @evnp: Pointer to original EventNotification request
7097 - **/
7098 + */
7099 static int
7100 SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp)
7101 {
7102 @@ -6278,7 +6377,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNoti
7103
7104 if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
7105 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
7106 - ioc->name,__FUNCTION__));
7107 + ioc->name,__func__));
7108 return -1;
7109 }
7110
7111 @@ -6297,6 +6396,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNoti
7112 return 0;
7113 }
7114
7115 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7116 /**
7117 * mpt_config - Generic function to issue config message
7118 * @ioc: Pointer to an adapter structure
7119 @@ -6309,7 +6409,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNoti
7120 * -EPERM if not allowed due to ISR context
7121 * -EAGAIN if no msg frames currently available
7122 * -EFAULT for non-successful reply or no reply (timeout)
7123 - **/
7124 + */
7125 int
7126 mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
7127 {
7128 @@ -6334,7 +6434,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7129 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
7130 if (ioc->ioc_reset_in_progress) {
7131 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7132 - "%s: busy with host reset\n", ioc->name, __FUNCTION__));
7133 + "%s: busy with host reset\n", ioc->name, __func__));
7134 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7135 return -EBUSY;
7136 }
7137 @@ -6345,7 +6445,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7138 mpt_GetIocState(ioc, 1) != MPI_IOC_STATE_OPERATIONAL) {
7139 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7140 "%s: ioc not operational, %d, %xh\n",
7141 - ioc->name, __FUNCTION__, ioc->active,
7142 + ioc->name, __func__, ioc->active,
7143 mpt_GetIocState(ioc, 0)));
7144 return -EFAULT;
7145 }
7146 @@ -6423,7 +6523,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7147 ioc->add_sge((char *)&pReq->PageBufferSGE, flagsLength, pCfg->physAddr);
7148 timeout = (pCfg->timeout < 15) ? HZ*15 : HZ*pCfg->timeout;
7149 mpt_put_msg_frame(mpt_base_index, ioc, mf);
7150 - timeleft = wait_for_completion_timeout(&ioc->mptbase_cmds.done, timeout);
7151 + timeleft =
7152 + wait_for_completion_timeout(&ioc->mptbase_cmds.done, timeout);
7153 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
7154 ret = -ETIME;
7155 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7156 @@ -6459,7 +6560,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7157 }
7158
7159 if (retry_count)
7160 - printk(MYIOC_s_INFO_FMT "Retry completed ret=0x%x timeleft=%ld\n",
7161 + printk(MYIOC_s_INFO_FMT
7162 + "Retry completed ret=0x%x timeleft=%ld\n",
7163 ioc->name, ret, timeleft);
7164
7165 dcprintk(ioc, printk(KERN_DEBUG "IOCStatus=%04xh, IOCLogInfo=%08xh\n",
7166 @@ -6472,15 +6574,15 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7167 if (issue_hard_reset) {
7168 issue_hard_reset = 0;
7169 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
7170 - ioc->name, __FUNCTION__);
7171 + ioc->name, __func__);
7172 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
7173 mpt_HardResetHandler(ioc, CAN_SLEEP);
7174 mpt_free_msg_frame(ioc, mf);
7175 /* attempt one retry for a timed out command */
7176 if (!retry_count) {
7177 printk(MYIOC_s_INFO_FMT
7178 - "Attempting Retry Config request type 0x%x, page 0x%x,"
7179 - " action %d\n", ioc->name, page_type,
7180 + "Attempting Retry Config request type 0x%x,"
7181 + " page 0x%x, action %d\n", ioc->name, page_type,
7182 pCfg->cfghdr.hdr->PageNumber, pCfg->action);
7183 retry_count++;
7184 goto retry_config;
7185 @@ -6489,37 +6591,40 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7186 return ret;
7187 }
7188
7189 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7190 /**
7191 * mpt_ioc_reset - Base cleanup for hard reset
7192 * @ioc: Pointer to the adapter structure
7193 * @reset_phase: Indicates pre- or post-reset functionality
7194 *
7195 * Remark: Frees resources with internally generated commands.
7196 - **/
7197 + */
7198 static int
7199 mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
7200 {
7201 - switch(reset_phase) {
7202 + switch (reset_phase) {
7203 case MPT_IOC_SETUP_RESET:
7204 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7205 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
7206 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
7207 ioc->taskmgmt_quiesce_io = 1;
7208 break;
7209 case MPT_IOC_PRE_RESET:
7210 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7211 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
7212 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
7213 break;
7214 case MPT_IOC_POST_RESET:
7215 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7216 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
7217 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
7218 /* wake up mptbase_cmds */
7219 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_PENDING) {
7220 - ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
7221 + ioc->mptbase_cmds.status
7222 + |= MPT_MGMT_STATUS_DID_IOCRESET;
7223 complete(&ioc->mptbase_cmds.done);
7224 }
7225 /* wake up taskmgmt_cmds */
7226 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_PENDING) {
7227 - ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
7228 + ioc->taskmgmt_cmds.status
7229 + |= MPT_MGMT_STATUS_DID_IOCRESET;
7230 complete(&ioc->taskmgmt_cmds.done);
7231 }
7232 break;
7233 @@ -6532,11 +6637,12 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int rese
7234
7235
7236 #ifdef CONFIG_PROC_FS /* { */
7237 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7238 /**
7239 * procmpt_create - Create %MPT_PROCFS_MPTBASEDIR entries.
7240 *
7241 * Returns 0 for success, non-zero for failure.
7242 - **/
7243 + */
7244 static int
7245 procmpt_create(void)
7246 {
7247 @@ -6557,11 +6663,12 @@ procmpt_create(void)
7248 return 0;
7249 }
7250
7251 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7252 /**
7253 * procmpt_destroy - Tear down %MPT_PROCFS_MPTBASEDIR entries.
7254 *
7255 * Returns 0 for success, non-zero for failure.
7256 - **/
7257 + */
7258 static void
7259 procmpt_destroy(void)
7260 {
7261 @@ -6570,6 +6677,7 @@ procmpt_destroy(void)
7262 remove_proc_entry(MPT_PROCFS_MPTBASEDIR, NULL);
7263 }
7264
7265 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7266 /**
7267 * procmpt_summary_read - Handle read request of a summary file
7268 * @buf: Pointer to area to write information
7269 @@ -6581,7 +6689,7 @@ procmpt_destroy(void)
7270 *
7271 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary.
7272 * Returns number of characters written to process performing the read.
7273 - **/
7274 + */
7275 static int
7276 procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
7277 {
7278 @@ -6613,6 +6721,7 @@ procmpt_summary_read(char *buf, char **s
7279 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len);
7280 }
7281
7282 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7283 /**
7284 * procmpt_version_read - Handle read request from /proc/mpt/version.
7285 * @buf: Pointer to area to write information
7286 @@ -6623,7 +6732,7 @@ procmpt_summary_read(char *buf, char **s
7287 * @data: Pointer
7288 *
7289 * Returns number of characters written to process performing the read.
7290 - **/
7291 + */
7292 static int
7293 procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
7294 {
7295 @@ -6668,6 +6777,7 @@ procmpt_version_read(char *buf, char **s
7296 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len);
7297 }
7298
7299 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7300 /**
7301 * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info.
7302 * @buf: Pointer to area to write information
7303 @@ -6678,7 +6788,7 @@ procmpt_version_read(char *buf, char **s
7304 * @data: Pointer
7305 *
7306 * Returns number of characters written to process performing the read.
7307 - **/
7308 + */
7309 static int
7310 procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
7311 {
7312 @@ -6779,6 +6889,7 @@ mpt_get_fw_exp_ver(char *buf, MPT_ADAPTE
7313 }
7314 }
7315
7316 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7317 /**
7318 * mpt_print_ioc_summary - Write ASCII summary of IOC to a buffer.
7319 * @ioc: Pointer to MPT_ADAPTER structure
7320 @@ -6789,7 +6900,7 @@ mpt_get_fw_exp_ver(char *buf, MPT_ADAPTE
7321 *
7322 * This routine writes (english readable) ASCII text, which represents
7323 * a summary of IOC information, to a buffer.
7324 - **/
7325 + */
7326 void
7327 mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int showlan)
7328 {
7329 @@ -6901,19 +7012,19 @@ mpt_halt_firmware(MPT_ADAPTER *ioc)
7330 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {
7331 printk(MYIOC_s_ERR_FMT "IOC is in FAULT state (%04xh)!!!\n",
7332 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
7333 - if(mpt_fwfault_debug == 2)
7334 - for(;;);
7335 + if (mpt_fwfault_debug == 2)
7336 + for (;;);
7337 else
7338 - panic("%s: IOC Fault (%04xh)!!!\n",ioc->name,
7339 + panic("%s: IOC Fault (%04xh)!!!\n", ioc->name,
7340 ioc_raw_state & MPI_DOORBELL_DATA_MASK);
7341 } else {
7342 CHIPREG_WRITE32(&ioc->chip->Doorbell, 0xC0FFEE00);
7343 - if(mpt_fwfault_debug == 2) {
7344 - printk("%s: Firmware is halted due to command timeout\n"
7345 - ,ioc->name);
7346 - for(;;);
7347 - }
7348 - else
7349 + if (mpt_fwfault_debug == 2) {
7350 + printk(KERN_ERR
7351 + "%s: Firmware is halted due to command timeout\n",
7352 + ioc->name);
7353 + for (;;);
7354 + } else
7355 panic("%s: Firmware is halted due to command timeout\n",
7356 ioc->name);
7357 }
7358 @@ -6943,14 +7054,16 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7359 u32 ioc_state;
7360 unsigned long time_count;
7361
7362 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SoftResetHandler Entered!\n", ioc->name));
7363 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7364 + "SoftResetHandler Entered!\n", ioc->name));
7365
7366 ioc_state = mpt_GetIocState(ioc, 0) & MPI_IOC_STATE_MASK;
7367
7368 - if(mpt_fwfault_debug)
7369 + if (mpt_fwfault_debug)
7370 mpt_halt_firmware(ioc);
7371
7372 - if (ioc_state == MPI_IOC_STATE_FAULT || ioc_state == MPI_IOC_STATE_RESET) {
7373 + if (ioc_state == MPI_IOC_STATE_FAULT
7374 + || ioc_state == MPI_IOC_STATE_RESET) {
7375 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7376 "skipping, either in FAULT or RESET state!\n", ioc->name));
7377 return -1;
7378 @@ -6995,11 +7108,10 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7379 if ((rc = GetIocFacts(ioc, sleepFlag,
7380 MPT_HOSTEVENT_IOC_RECOVER)) == 0)
7381 break;
7382 - if (sleepFlag == CAN_SLEEP) {
7383 + if (sleepFlag == CAN_SLEEP)
7384 msleep(100);
7385 - } else {
7386 + else
7387 mdelay(100);
7388 - }
7389 }
7390 if (ii == 5)
7391 goto out;
7392 @@ -7033,13 +7145,15 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7393 if (ioc->active) { /* otherwise, hard reset coming */
7394 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
7395 if (MptResetHandlers[cb_idx])
7396 - mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
7397 + mpt_signal_reset(cb_idx,
7398 + ioc, MPT_IOC_POST_RESET);
7399 }
7400 }
7401
7402 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SoftResetHandler: completed (%d seconds): %s\n",
7403 - ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7404 - ((rc == 0) ? "SUCCESS" : "FAILED")));
7405 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7406 + "SoftResetHandler: completed (%d seconds): %s\n",
7407 + ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7408 + ((rc == 0) ? "SUCCESS" : "FAILED")));
7409
7410 return rc;
7411 }
7412 @@ -7060,7 +7174,7 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7413 * FW reload/initialization failed.
7414 *
7415 * Returns 0 for SUCCESS or -1 if FAILED.
7416 - **/
7417 + */
7418 int
7419 mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7420 {
7421 @@ -7075,7 +7189,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, i
7422 printk("MF count 0x%x !\n", ioc->mfcnt);
7423 #endif
7424
7425 - if(mpt_fwfault_debug)
7426 + if (mpt_fwfault_debug)
7427 mpt_halt_firmware(ioc);
7428
7429 /* Reset the adapter. Prevent more than 1 call to
7430 @@ -7101,14 +7215,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, i
7431 if (MptResetHandlers[cb_idx]) {
7432 mpt_signal_reset(cb_idx, ioc, MPT_IOC_SETUP_RESET);
7433 if (ioc->alt_ioc)
7434 - mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_SETUP_RESET);
7435 + mpt_signal_reset(cb_idx,
7436 + ioc->alt_ioc, MPT_IOC_SETUP_RESET);
7437 }
7438 }
7439
7440 time_count = jiffies;
7441 if ((rc = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_RECOVER, sleepFlag)) != 0) {
7442 - printk(KERN_WARNING MYNAM ": WARNING - (%d) Cannot recover %s\n",
7443 - rc, ioc->name);
7444 + printk(KERN_WARNING MYNAM
7445 + ": WARNING - (%d) Cannot recover %s\n", rc, ioc->name);
7446 } else {
7447 if (ioc->hard_resets < -1)
7448 ioc->hard_resets++;
7449 @@ -7129,13 +7244,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, i
7450 if (MptResetHandlers[cb_idx]) {
7451 mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
7452 if (ioc->alt_ioc)
7453 - mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_POST_RESET);
7454 + mpt_signal_reset(cb_idx,
7455 + ioc->alt_ioc, MPT_IOC_POST_RESET);
7456 }
7457 }
7458
7459 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler: completed (%d seconds): %s\n",
7460 - ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7461 - ((rc == 0) ? "SUCCESS" : "FAILED")));
7462 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7463 + "HardResetHandler: completed (%d seconds): %s\n",
7464 + ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7465 + ((rc == 0) ? "SUCCESS" : "FAILED")));
7466 return rc;
7467 }
7468
7469 @@ -7607,6 +7724,7 @@ mpt_display_event_info(MPT_ADAPTER *ioc,
7470 }
7471 #endif
7472
7473 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7474 /**
7475 * ProcessEventNotification - Route EventNotificationReply to all event handlers
7476 * @ioc: Pointer to MPT_ADAPTER structure
7477 @@ -7616,7 +7734,7 @@ mpt_display_event_info(MPT_ADAPTER *ioc,
7478 * Routes a received EventNotificationReply to all currently registered
7479 * event handlers.
7480 * Returns sum of event handlers return values.
7481 - **/
7482 + */
7483 static int
7484 ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply, int *evHandlers)
7485 {
7486 @@ -7695,12 +7813,12 @@ ProcessEventNotification(MPT_ADAPTER *io
7487 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
7488 if (MptEvHandlers[cb_idx]) {
7489 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7490 - "Routing Event to event handler #%d\n", ioc->name, cb_idx));
7491 + "Routing Event to event handler #%d\n",
7492 + ioc->name, cb_idx));
7493 r += (*(MptEvHandlers[cb_idx]))(ioc, pEventReply);
7494 handlers++;
7495 }
7496 }
7497 - /* FIXME? Examine results here? */
7498
7499 /*
7500 * If needed, send (a single) EventAck.
7501 @@ -7762,6 +7880,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 lo
7502 ioc->name, log_info, desc, (log_info & 0xFFFFFF));
7503 }
7504
7505 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7506 /**
7507 * mpt_spi_log_info - Log information returned from SCSI Parallel IOC.
7508 * @ioc: Pointer to MPT_ADAPTER structure
7509 @@ -7769,7 +7888,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 lo
7510 * @log_info: U32 LogInfo word from the IOC
7511 *
7512 * Refer to lsi/sp_log.h.
7513 - **/
7514 + */
7515 static void
7516 mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
7517 {
7518 @@ -8353,7 +8472,8 @@ mpt_iocstatus_info(MPT_ADAPTER *ioc, u32
7519 if (!desc)
7520 return;
7521
7522 - dreplyprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IOCStatus(0x%04X): %s\n", ioc->name, status, desc));
7523 + dreplyprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7524 + "IOCStatus(0x%04X): %s\n", ioc->name, status, desc));
7525 }
7526
7527 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7528 @@ -8364,7 +8484,6 @@ EXPORT_SYMBOL(mpt_resume);
7529 EXPORT_SYMBOL(mpt_suspend);
7530 #endif
7531 EXPORT_SYMBOL(ioc_list);
7532 -EXPORT_SYMBOL(mpt_proc_root_dir);
7533 EXPORT_SYMBOL(mpt_register);
7534 EXPORT_SYMBOL(mpt_deregister);
7535 EXPORT_SYMBOL(mpt_event_register);
7536 @@ -8395,11 +8514,12 @@ EXPORT_SYMBOL(mpt_set_taskmgmt_in_progre
7537 EXPORT_SYMBOL(mpt_clear_taskmgmt_in_progress_flag);
7538 EXPORT_SYMBOL(mpt_halt_firmware);
7539
7540 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7541 /**
7542 * fusion_init - Fusion MPT base driver initialization routine.
7543 *
7544 * Returns 0 for success, non-zero for failure.
7545 - **/
7546 + */
7547 static int __init
7548 fusion_init(void)
7549 {
7550 @@ -8430,12 +8550,13 @@ fusion_init(void)
7551 return 0;
7552 }
7553
7554 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7555 /**
7556 * fusion_exit - Perform driver unload cleanup.
7557 *
7558 * This routine frees all resources associated with each MPT adapter
7559 * and removes all %MPT_PROCFS_MPTBASEDIR entries.
7560 - **/
7561 + */
7562 static void __exit
7563 fusion_exit(void)
7564 {
7565 Index: linux-2.6.27/drivers/message/fusion/mptbase.h
7566 ===================================================================
7567 --- linux-2.6.27.orig/drivers/message/fusion/mptbase.h
7568 +++ linux-2.6.27/drivers/message/fusion/mptbase.h
7569 @@ -72,8 +72,8 @@
7570 #define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR
7571 #endif
7572
7573 -#define MPT_LINUX_VERSION_COMMON "4.00.43.00"
7574 -#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-4.00.43.00"
7575 +#define MPT_LINUX_VERSION_COMMON "4.00.43.00suse"
7576 +#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-4.00.43.00suse"
7577 #define WHAT_MAGIC_STRING "@" "(" "#" ")"
7578 #define MPT_LINUX_MAJOR_VERSION 4
7579 #define MPT_LINUX_MINOR_VERSION 00
7580 @@ -177,10 +177,10 @@
7581 #define MPT_SCSI_SG_DEPTH 40
7582 #endif
7583
7584 -#ifdef CONFIG_FUSION_MAX_FC_SGE
7585 -#if CONFIG_FUSION_MAX_FC_SGE < 16
7586 +#ifdef CONFIG_FUSION_MAX_FC_SGE
7587 +#if CONFIG_FUSION_MAX_FC_SGE < 16
7588 #define MPT_SCSI_FC_SG_DEPTH 16
7589 -#elif CONFIG_FUSION_MAX_FC_SGE > 256
7590 +#elif CONFIG_FUSION_MAX_FC_SGE > 256
7591 #define MPT_SCSI_FC_SG_DEPTH 256
7592 #else
7593 #define MPT_SCSI_FC_SG_DEPTH CONFIG_FUSION_MAX_FC_SGE
7594 @@ -444,10 +444,10 @@ do { \
7595 #define MPT_MGMT_STATUS_RF_VALID 0x01 /* The Reply Frame is VALID */
7596 #define MPT_MGMT_STATUS_COMMAND_GOOD 0x02 /* Command Status GOOD */
7597 #define MPT_MGMT_STATUS_PENDING 0x04 /* command is pending */
7598 -#define MPT_MGMT_STATUS_DID_IOCRESET 0x08 /* IOC Reset occurred on the current*/
7599 +#define MPT_MGMT_STATUS_DID_IOCRESET 0x08 /* IOC Reset occurred */
7600 #define MPT_MGMT_STATUS_SENSE_VALID 0x10 /* valid sense info */
7601 #define MPT_MGMT_STATUS_TIMER_ACTIVE 0x20 /* obsolete */
7602 -#define MPT_MGMT_STATUS_FREE_MF 0x40 /* free the mf from complete routine */
7603 +#define MPT_MGMT_STATUS_FREE_MF 0x40 /* free the mf */
7604
7605
7606 #define INITIALIZE_MGMT_STATUS(status) \
7607 @@ -467,7 +467,7 @@ typedef struct _MPT_MGMT {
7608 u8 status; /* current command status */
7609 int completion_code;
7610 u32 msg_context;
7611 -}MPT_MGMT;
7612 +} MPT_MGMT;
7613
7614 /*
7615 * Event Structure and define
7616 @@ -540,7 +540,7 @@ typedef struct _RaidCfgData {
7617 IOCPage2_t *pIocPg2; /* table of Raid Volumes */
7618 IOCPage3_t *pIocPg3; /* table of physical disks */
7619 IOCPage6_t *pIocPg6; /* table of IR static data */
7620 - struct semaphore inactive_list_mutex;
7621 + struct mutex inactive_list_mutex;
7622 struct list_head inactive_list; /* link list for physical
7623 disk that belong in
7624 inactive volumes */
7625 @@ -571,7 +571,8 @@ struct mptfc_rport_info
7626 };
7627
7628 typedef void (*MPT_ADD_SGE)(char *pAddr, u32 flagslength, dma_addr_t dma_addr);
7629 -typedef void (*MPT_ADD_CHAIN)(char *pAddr, u8 next, u16 length, dma_addr_t dma_addr);
7630 +typedef void (*MPT_ADD_CHAIN)
7631 + (char *pAddr, u8 next, u16 length, dma_addr_t dma_addr);
7632
7633 /*
7634 * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS
7635 @@ -583,7 +584,8 @@ typedef struct _MPT_ADAPTER
7636 char name[MPT_NAME_LENGTH]; /* "iocN" */
7637 char prod_name[MPT_NAME_LENGTH]; /* "LSIFC9x9" */
7638 #ifdef CONFIG_FUSION_LOGGING
7639 - char evStr[EVENT_DESCR_STR_SZ]; /* used in mpt_display_event_info */
7640 + /* used in mpt_display_event_info */
7641 + char evStr[EVENT_DESCR_STR_SZ];
7642 #endif
7643 char board_name[16];
7644 char board_assembly[16];
7645 @@ -597,7 +599,8 @@ typedef struct _MPT_ADAPTER
7646 SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */
7647 u8 bus_type;
7648 unsigned long mem_phys; /* == f4020000 (mmap) */
7649 - unsigned long pio_mem_phys; /* Programmed IO (downloadboot) */
7650 + /* Programmed IO (downloadboot) */
7651 + unsigned long pio_mem_phys;
7652 int mem_size; /* mmap memory size */
7653 int number_of_buses;
7654 int devices_per_bus;
7655 @@ -612,8 +615,10 @@ typedef struct _MPT_ADAPTER
7656 int reply_depth; /* Num Allocated reply frames */
7657 int reply_sz; /* Reply frame size */
7658 int num_chain; /* Number of chain buffers */
7659 - MPT_ADD_SGE add_sge; /* Pointer to add_sge function */
7660 - MPT_ADD_CHAIN add_chain; /* Pointer to add_chain function */
7661 + /* Pointer to add_sge function */
7662 + MPT_ADD_SGE add_sge;
7663 + /* Pointer to add_chain function */
7664 + MPT_ADD_CHAIN add_chain;
7665 /* Pool of buffers for chaining. ReqToChain
7666 * and ChainToChain track index of chain buffers.
7667 * ChainBuffer (DMA) virt/phys addresses.
7668 @@ -646,7 +651,8 @@ typedef struct _MPT_ADAPTER
7669 dma_addr_t HostPageBuffer_dma;
7670 int mtrr_reg;
7671 struct pci_dev *pcidev; /* struct pci_dev pointer */
7672 - int bars; /* bitmask of BAR's that must be configured */
7673 + /* bitmask of BAR's that must be configured */
7674 + int bars;
7675 int msi_enable;
7676 u8 __iomem *memmap; /* mmap address */
7677 struct Scsi_Host *sh; /* Scsi Host pointer */
7678 @@ -680,7 +686,8 @@ typedef struct _MPT_ADAPTER
7679 #if defined(CPQ_CIM)
7680 u32 csmi_change_count; /* count to track all IR
7681 events for CSMI */
7682 - u8 pci_slot_number; /* ioc page 1 - pci slot number */
7683 + /* ioc page 1 - pci slot number */
7684 + u8 pci_slot_number;
7685 #endif
7686
7687 u8 ir_firmware; /* =1 if IR firmware detected */
7688 @@ -711,11 +718,12 @@ typedef struct _MPT_ADAPTER
7689 u8 fw_events_off; /* if '1', then ignore events */
7690 char fw_event_q_name[20];
7691
7692 - struct mptsas_portinfo *hba_port_info; /* port_info object for the host */
7693 + /* port_info object for the host */
7694 + struct mptsas_portinfo *hba_port_info;
7695 u64 hba_port_sas_addr;
7696 u16 hba_port_num_phy;
7697 struct list_head sas_device_info_list;
7698 - struct semaphore sas_device_info_mutex;
7699 + struct mutex sas_device_info_mutex;
7700 u8 old_sas_discovery_protocal;
7701 u8 sas_discovery_quiesce_io;
7702 int sas_index; /* index refrencing */
7703 @@ -735,6 +743,7 @@ typedef struct _MPT_ADAPTER
7704 char reset_work_q_name[20];
7705 struct workqueue_struct *reset_work_q;
7706 struct delayed_work fault_reset_work;
7707 + spinlock_t fault_reset_work_lock;
7708 struct work_struct fc_setup_reset_work;
7709 struct list_head fc_rports;
7710 struct work_struct fc_lsc_work;
7711 @@ -743,9 +752,12 @@ typedef struct _MPT_ADAPTER
7712 struct work_struct fc_rescan_work;
7713 char fc_rescan_work_q_name[20];
7714 struct workqueue_struct *fc_rescan_work_q;
7715 - unsigned long hard_resets; /* driver forced bus resets count */
7716 - unsigned long soft_resets; /* fw/external bus resets count */
7717 - unsigned long timeouts; /* cmd timeouts */
7718 + /* driver forced bus resets count */
7719 + unsigned long hard_resets;
7720 + /* fw/external bus resets count */
7721 + unsigned long soft_resets;
7722 + /* cmd timeouts */
7723 + unsigned long timeouts;
7724 struct scsi_cmnd **ScsiLookup;
7725 spinlock_t scsi_lookup_lock;
7726 int sdev_queue_depth; /* sdev queue depth */
7727 @@ -907,10 +919,14 @@ extern int mpt_config(MPT_ADAPTER *ioc,
7728 extern int mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size);
7729 extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
7730 extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
7731 -extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
7732 -extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk);
7733 -extern int mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage1_t phys_disk);
7734 -extern int mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc, u8 phys_disk_num);
7735 +extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc,
7736 + u8 persist_opcode);
7737 +extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num,
7738 + pRaidPhysDiskPage0_t phys_disk);
7739 +extern int mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num,
7740 + pRaidPhysDiskPage1_t phys_disk);
7741 +extern int mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc,
7742 + u8 phys_disk_num);
7743
7744 extern int mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc);
7745 extern void mpt_clear_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc);
7746 @@ -920,7 +936,6 @@ extern void mpt_halt_firmware(MPT_ADAPT
7747 * Public data decl's...
7748 */
7749 extern struct list_head ioc_list;
7750 -extern struct proc_dir_entry *mpt_proc_root_dir;
7751 extern int mpt_debug_level;
7752 extern int mpt_fwfault_debug;
7753
7754 Index: linux-2.6.27/drivers/message/fusion/mptctl.c
7755 ===================================================================
7756 --- linux-2.6.27.orig/drivers/message/fusion/mptctl.c
7757 +++ linux-2.6.27/drivers/message/fusion/mptctl.c
7758 @@ -75,7 +75,7 @@
7759 #if defined(CPQ_CIM)
7760 #include "mptsas.h"
7761 #include "csmi/csmisas.h"
7762 -#endif // CPQ_CIM
7763 +#endif
7764
7765 #if defined(DIAG_BUFFER_SUPPORT)
7766 #include "rejected_ioctls/diag_buffer.h"
7767 @@ -148,7 +148,7 @@ static int csmisas_task_managment(unsign
7768 static int csmisas_phy_control(unsigned long arg);
7769 static int csmisas_get_connector_info(unsigned long arg);
7770 static int csmisas_get_location(unsigned long arg);
7771 -#endif // CPQ_CIM
7772 +#endif
7773
7774 #if defined(DIAG_BUFFER_SUPPORT)
7775 /* diag_buffer proto's */
7776 @@ -157,7 +157,7 @@ static int mptctl_release_diag_buffer(un
7777 static int mptctl_unregister_diag_buffer(unsigned long arg);
7778 static int mptctl_query_diag_buffer(unsigned long arg);
7779 static int mptctl_read_diag_buffer(unsigned long arg);
7780 -#endif // DIAG_BUFFER_SUPPORT
7781 +#endif
7782
7783 static int mptctl_probe(struct pci_dev *, const struct pci_device_id *);
7784 static void mptctl_remove(struct pci_dev *);
7785 @@ -279,7 +279,8 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME
7786 le32_to_cpu(reply->u.reply.IOCLogInfo)));
7787
7788 if ((req->u.hdr.Function == MPI_FUNCTION_SCSI_IO_REQUEST) ||
7789 - (req->u.hdr.Function == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
7790 + (req->u.hdr.Function
7791 + == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
7792
7793 if (reply->u.sreply.SCSIStatus || reply->u.sreply.SCSIState)
7794 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7795 @@ -290,7 +291,8 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME
7796 le16_to_cpu(reply->u.sreply.TaskTag),
7797 le32_to_cpu(reply->u.sreply.TransferCount)));
7798
7799 - if (reply->u.sreply.SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
7800 + if (reply->u.sreply.SCSIState
7801 + & MPI_SCSI_STATE_AUTOSENSE_VALID) {
7802 sz = req->u.scsireq.SenseBufferLength;
7803 req_index =
7804 le16_to_cpu(req->u.frame.hwhdr.msgctxu.fld.req_idx);
7805 @@ -324,7 +326,8 @@ mptctl_taskmgmt_reply(MPT_ADAPTER *ioc,
7806 if (!mf)
7807 return 0;
7808
7809 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed (mf=%p, mr=%p)\n",
7810 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7811 + "TaskMgmt completed (mf=%p, mr=%p)\n",
7812 ioc->name, mf, mr));
7813
7814 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
7815 @@ -365,8 +368,8 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7816 /* bus reset is only good for SCSI IO, RAID PASSTHRU */
7817 if (!(function == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) ||
7818 (function == MPI_FUNCTION_SCSI_IO_REQUEST)) {
7819 - dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt, not SCSI_IO!!\n",
7820 - ioc->name));
7821 + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
7822 + "TaskMgmt, not SCSI_IO!!\n", ioc->name));
7823 return -EPERM;
7824 }
7825
7826 @@ -381,8 +384,8 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7827 /* Send request
7828 */
7829 if ((mf = mpt_get_msg_frame(mptctl_taskmgmt_id, ioc)) == NULL) {
7830 - dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt, no msg frames!!\n",
7831 - ioc->name));
7832 + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
7833 + "TaskMgmt, no msg frames!!\n", ioc->name));
7834 mpt_clear_taskmgmt_in_progress_flag(ioc);
7835 retval = -ENOMEM;
7836 goto mptctl_bus_reset_done;
7837 @@ -408,20 +411,21 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7838 pScsiTm->Reserved2[ii] = 0;
7839
7840 switch (ioc->bus_type) {
7841 - case FC:
7842 - timeout = 40;
7843 - break;
7844 - case SAS:
7845 - timeout = 30;
7846 - break;
7847 - case SPI:
7848 - default:
7849 - timeout = 2;
7850 - break;
7851 + case FC:
7852 + timeout = 40;
7853 + break;
7854 + case SAS:
7855 + timeout = 30;
7856 + break;
7857 + case SPI:
7858 + default:
7859 + timeout = 10;
7860 + break;
7861 }
7862
7863 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt type=%d timeout=%ld\n",
7864 - ioc->name, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
7865 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7866 + "TaskMgmt type=%d timeout=%ld\n", ioc->name,
7867 + MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
7868
7869 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
7870 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status)
7871 @@ -431,9 +435,10 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7872 mpt_put_msg_frame_hi_pri(mptctl_taskmgmt_id, ioc, mf);
7873 else {
7874 retval = mpt_send_handshake_request(mptctl_taskmgmt_id, ioc,
7875 - sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
7876 + sizeof(SCSITaskMgmt_t), (u32 *)pScsiTm, CAN_SLEEP);
7877 if (retval != 0) {
7878 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt send_handshake FAILED!"
7879 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
7880 + "TaskMgmt send_handshake FAILED!"
7881 " (ioc %p, mf %p, rc=%d) \n", ioc->name,
7882 ioc, mf, retval));
7883 mpt_clear_taskmgmt_in_progress_flag(ioc);
7884 @@ -498,11 +503,10 @@ mptctl_timeout_expired(MPT_ADAPTER *ioc,
7885 unsigned long flags;
7886
7887 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": %s\n",
7888 - ioc->name, __FUNCTION__));
7889 + ioc->name, __func__));
7890
7891 - if(mpt_fwfault_debug)
7892 + if (mpt_fwfault_debug)
7893 mpt_halt_firmware(ioc);
7894 -
7895 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
7896 if (ioc->ioc_reset_in_progress) {
7897 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7898 @@ -540,15 +544,15 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int r
7899 switch(reset_phase) {
7900 case MPT_IOC_SETUP_RESET:
7901 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7902 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
7903 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
7904 break;
7905 case MPT_IOC_PRE_RESET:
7906 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7907 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
7908 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
7909 break;
7910 case MPT_IOC_POST_RESET:
7911 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7912 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
7913 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
7914 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_PENDING) {
7915 ioc->ioctl_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
7916 complete(&ioc->ioctl_cmds.done);
7917 @@ -571,13 +575,11 @@ mptctl_event_process(MPT_ADAPTER *ioc, E
7918 event = le32_to_cpu(pEvReply->Event) & 0xFF;
7919
7920 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s() called\n",
7921 - ioc->name, __FUNCTION__));
7922 + ioc->name, __func__));
7923 if(async_queue == NULL)
7924 return 1;
7925
7926 /* Raise SIGIO for persistent events.
7927 - * TODO - this define is not in MPI spec yet,
7928 - * but they plan to set it to 0x21
7929 */
7930 if (event == 0x21 ) {
7931 ioc->aen_event_read_flag=1;
7932 @@ -660,8 +662,9 @@ __mptctl_ioctl(struct file *file, unsign
7933 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
7934 (iocp == NULL)) {
7935 if (mpt_debug_level & MPT_DEBUG_IOCTL)
7936 - printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
7937 - __FILE__, __LINE__, iocnumX);
7938 + printk(KERN_DEBUG MYNAM
7939 + "%s::%s @%d - ioc%d not found!\n",
7940 + __FILE__, __func__, __LINE__, iocnumX);
7941 return -ENODEV;
7942 }
7943
7944 @@ -700,9 +703,9 @@ __mptctl_ioctl(struct file *file, unsign
7945 return csmisas_get_cntlr_status(arg);
7946 } else if (cmd == CC_CSMI_SAS_GET_SCSI_ADDRESS) {
7947 return csmisas_get_scsi_address(arg);
7948 - } else if (cmd == CC_CSMI_SAS_GET_DEVICE_ADDRESS){
7949 + } else if (cmd == CC_CSMI_SAS_GET_DEVICE_ADDRESS) {
7950 return csmisas_get_device_address(arg);
7951 -#endif // CPQ_CIM
7952 +#endif
7953 }
7954
7955 /* All of these commands require an interrupt or
7956 @@ -711,8 +714,6 @@ __mptctl_ioctl(struct file *file, unsign
7957 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
7958 return ret;
7959
7960 -// dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT ": mptctl_ioctl()\n", iocp->name));
7961 -
7962 if (cmd == MPTFWDOWNLOAD)
7963 ret = mptctl_fw_download(arg);
7964 else if (cmd == MPTCOMMAND)
7965 @@ -763,7 +764,7 @@ __mptctl_ioctl(struct file *file, unsign
7966 ret = csmisas_get_connector_info(arg);
7967 else if (cmd == CC_CSMI_SAS_GET_LOCATION)
7968 ret = csmisas_get_location(arg);
7969 -#endif // CPQ_CIM
7970 +#endif
7971
7972 #if defined(DIAG_BUFFER_SUPPORT)
7973 /* diag_buffer requiring fw calls*/
7974 @@ -773,7 +774,7 @@ __mptctl_ioctl(struct file *file, unsign
7975 ret = mptctl_release_diag_buffer(arg);
7976 else if (cmd == MPTDIAGREADBUFFER)
7977 ret = mptctl_read_diag_buffer(arg);
7978 -#endif // DIAG_BUFFER_SUPPORT
7979 +#endif
7980 else
7981 ret = -EINVAL;
7982
7983 @@ -807,8 +808,9 @@ static int mptctl_do_reset(unsigned long
7984
7985 if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
7986 if (mpt_debug_level & MPT_DEBUG_IOCTL)
7987 - printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
7988 - __FILE__, __LINE__, krinfo.hdr.iocnum);
7989 + printk(KERN_DEBUG MYNAM
7990 + "%s@%d::%s - ioc%d not found!\n",
7991 + __FILE__, __LINE__, __func__, krinfo.hdr.iocnum);
7992 return -ENODEV; /* (-6) No such device or address */
7993 }
7994
7995 @@ -898,7 +900,8 @@ mptctl_do_fw_download(int ioc, char __us
7996
7997 if (mpt_verify_adapter(ioc, &iocp) < 0) {
7998 if (mpt_debug_level & MPT_DEBUG_IOCTL)
7999 - printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", ioc);
8000 + printk(KERN_DEBUG MYNAM
8001 + "ioctl_fwdl - ioc%d not found!\n", ioc);
8002 return -ENODEV; /* (-6) No such device or address */
8003 } else {
8004
8005 @@ -982,7 +985,7 @@ mptctl_do_fw_download(int ioc, char __us
8006 / iocp->SGE_size;
8007 if (numfrags > maxfrags) {
8008 ret = -EMLINK;
8009 - goto fwdl_out;
8010 + goto fwdl_out;
8011 }
8012
8013 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: sgl buffer = %p, sgfrags = %d\n",
8014 @@ -1036,7 +1039,7 @@ mptctl_do_fw_download(int ioc, char __us
8015 timeleft = wait_for_completion_timeout(&iocp->ioctl_cmds.done, HZ*60);
8016 if (!(iocp->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
8017 ret = -ETIME;
8018 - printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __FUNCTION__);
8019 + printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __func__);
8020 if (iocp->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
8021 mpt_free_msg_frame(iocp, mf);
8022 goto fwdl_out;
8023 @@ -1047,7 +1050,7 @@ mptctl_do_fw_download(int ioc, char __us
8024 }
8025
8026 if (!(iocp->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID)) {
8027 - printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __FUNCTION__);
8028 + printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __func__);
8029 mpt_free_msg_frame(iocp, mf);
8030 ret = -ENODATA;
8031 goto fwdl_out;
8032 @@ -1059,10 +1062,12 @@ mptctl_do_fw_download(int ioc, char __us
8033 ReplyMsg = (pFWDownloadReply_t)iocp->ioctl_cmds.reply;
8034 iocstat = le16_to_cpu(ReplyMsg->IOCStatus) & MPI_IOCSTATUS_MASK;
8035 if (iocstat == MPI_IOCSTATUS_SUCCESS) {
8036 - printk(MYIOC_s_INFO_FMT ": F/W update successfully sent!\n", iocp->name);
8037 + printk(MYIOC_s_INFO_FMT
8038 + ": F/W update successfully sent!\n", iocp->name);
8039 return 0;
8040 } else if (iocstat == MPI_IOCSTATUS_INVALID_FUNCTION) {
8041 - printk(MYIOC_s_WARN_FMT "Hmmm... doesn't support F/W download?\n",
8042 + printk(MYIOC_s_WARN_FMT
8043 + "Hmmm... doesn't support F/W download?\n",
8044 iocp->name);
8045 printk(MYIOC_s_WARN_FMT "(time to go bang on somebodies door)\n",
8046 iocp->name);
8047 @@ -1177,7 +1182,8 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, i
8048 bytes_allocd += this_alloc;
8049 sgl->FlagsLength = (0x10000000|sgdir|this_alloc);
8050 if (ioc->sg_addr_size == sizeof(u64))
8051 - sgl->FlagsLength |= MPT_SGE_FLAGS_64_BIT_ADDRESSING;
8052 + sgl->FlagsLength
8053 + |= MPT_SGE_FLAGS_64_BIT_ADDRESSING;
8054 dma_addr = pci_map_single(ioc->pcidev, buflist[buflist_ent].kptr, this_alloc, dir);
8055 sgl->Address = dma_addr;
8056
8057 @@ -1362,8 +1368,9 @@ mptctl_getiocinfo (unsigned long arg, un
8058 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
8059 (ioc == NULL)) {
8060 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8061 - printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
8062 - __FILE__, __LINE__, iocnum);
8063 + printk(KERN_DEBUG MYNAM
8064 + "%s::%s @%d - ioc%d not found!\n",
8065 + __FILE__, __func__, __LINE__, iocnum);
8066 kfree(karg);
8067 return -ENODEV;
8068 }
8069 @@ -1498,8 +1505,9 @@ mptctl_gettargetinfo (unsigned long arg)
8070 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8071 (ioc == NULL)) {
8072 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8073 - printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
8074 - __FILE__, __LINE__, iocnum);
8075 + printk(KERN_DEBUG MYNAM
8076 + "%s::%s @%d - ioc%d not found!\n",
8077 + __FILE__, __func__, __LINE__, iocnum);
8078 return -ENODEV;
8079 }
8080
8081 @@ -1514,7 +1522,8 @@ mptctl_gettargetinfo (unsigned long arg)
8082 port = karg.hdr.port;
8083
8084 if (maxWordsLeft <= 0) {
8085 - printk(MYIOC_s_ERR_FMT "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8086 + printk(MYIOC_s_ERR_FMT
8087 + "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8088 ioc->name, __FILE__, __LINE__);
8089 return -ENOMEM;
8090 }
8091 @@ -1535,7 +1544,8 @@ mptctl_gettargetinfo (unsigned long arg)
8092 */
8093 pmem = kzalloc(numBytes, GFP_KERNEL);
8094 if (!pmem) {
8095 - printk(MYIOC_s_ERR_FMT "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8096 + printk(MYIOC_s_ERR_FMT
8097 + "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8098 ioc->name, __FILE__, __LINE__);
8099 return -ENOMEM;
8100 }
8101 @@ -1615,8 +1625,9 @@ mptctl_readtest (unsigned long arg)
8102 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8103 (ioc == NULL)) {
8104 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8105 - printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n",
8106 - __FILE__, __LINE__, iocnum);
8107 + printk(KERN_DEBUG MYNAM
8108 + "%s::%s @%d - ioc%d not found!\n",
8109 + __FILE__, __func__, __LINE__, iocnum);
8110 return -ENODEV;
8111 }
8112
8113 @@ -1677,8 +1688,9 @@ mptctl_eventquery (unsigned long arg)
8114 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8115 (ioc == NULL)) {
8116 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8117 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
8118 - __FILE__, __LINE__, iocnum);
8119 + printk(KERN_DEBUG MYNAM
8120 + "%s::%s @%d - ioc%d not found!\n",
8121 + __FILE__, __func__, __LINE__, iocnum);
8122 return -ENODEV;
8123 }
8124
8125 @@ -1717,8 +1729,9 @@ mptctl_eventenable (unsigned long arg)
8126 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8127 (ioc == NULL)) {
8128 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8129 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
8130 - __FILE__, __LINE__, iocnum);
8131 + printk(KERN_DEBUG MYNAM
8132 + "%s::%s @%d - ioc%d not found!\n",
8133 + __FILE__, __func__, __LINE__, iocnum);
8134 return -ENODEV;
8135 }
8136
8137 @@ -1730,7 +1743,8 @@ mptctl_eventenable (unsigned long arg)
8138 int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS);
8139 ioc->events = kzalloc(sz, GFP_KERNEL);
8140 if (!ioc->events) {
8141 - printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
8142 + printk(MYIOC_s_ERR_FMT
8143 + "Insufficient memory to add adapter!\n",
8144 ioc->name);
8145 return -ENOMEM;
8146 }
8147 @@ -1766,8 +1780,9 @@ mptctl_eventreport (unsigned long arg)
8148 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8149 (ioc == NULL)) {
8150 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8151 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
8152 - __FILE__, __LINE__, iocnum);
8153 + printk(KERN_DEBUG MYNAM
8154 + "%s::%s @%d - ioc%d not found!\n",
8155 + __FILE__, __func__, __LINE__, iocnum);
8156 return -ENODEV;
8157 }
8158
8159 @@ -1821,8 +1836,9 @@ mptctl_replace_fw (unsigned long arg)
8160 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8161 (ioc == NULL)) {
8162 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8163 - printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
8164 - __FILE__, __LINE__, iocnum);
8165 + printk(KERN_DEBUG MYNAM
8166 + "%s::%s @%d - ioc%d not found!\n",
8167 + __FILE__, __func__, __LINE__, iocnum);
8168 return -ENODEV;
8169 }
8170
8171 @@ -1870,7 +1886,8 @@ mptctl_replace_fw (unsigned long arg)
8172 *
8173 * Outputs: None.
8174 * Return: 0 if successful
8175 - * -EBUSY if previous command timout and IOC reset is not complete.
8176 + * -EBUSY if previous command timout and IOC reset is
8177 + * not complete.
8178 * -EFAULT if data unavailable
8179 * -ENODEV if no such device/adapter
8180 * -ETIME if timer expires
8181 @@ -1896,8 +1913,9 @@ mptctl_mpt_command (unsigned long arg)
8182 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8183 (ioc == NULL)) {
8184 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8185 - printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
8186 - __FILE__, __LINE__, iocnum);
8187 + printk(KERN_DEBUG MYNAM
8188 + "%s::%s @%d - ioc%d not found!\n",
8189 + __FILE__, __func__, __LINE__, iocnum);
8190 return -ENODEV;
8191 }
8192
8193 @@ -1911,7 +1929,8 @@ mptctl_mpt_command (unsigned long arg)
8194 *
8195 * Outputs: None.
8196 * Return: 0 if successful
8197 - * -EBUSY if previous command timout and IOC reset is not complete.
8198 + * -EBUSY if previous command timout and IOC reset is
8199 + * not complete.
8200 * -EFAULT if data unavailable
8201 * -ENODEV if no such device/adapter
8202 * -ETIME if timer expires
8203 @@ -1948,8 +1967,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8204 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8205 (ioc == NULL)) {
8206 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8207 - printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
8208 - __FILE__, __LINE__, iocnum);
8209 + printk(KERN_DEBUG MYNAM
8210 + "%s::%s @%d - ioc%d not found!\n",
8211 + __FILE__, __func__, __LINE__, iocnum);
8212 return -ENODEV;
8213 }
8214
8215 @@ -2194,10 +2214,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8216 {
8217 SCSITaskMgmt_t *pScsiTm;
8218 pScsiTm = (SCSITaskMgmt_t *)mf;
8219 - dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tTaskType=0x%x MsgFlags=0x%x "
8220 - "TaskMsgContext=0x%x id=%d channel=%d\n", ioc->name, pScsiTm->TaskType,
8221 - le32_to_cpu(pScsiTm->TaskMsgContext), pScsiTm->MsgFlags,
8222 - pScsiTm->TargetID, pScsiTm->Bus));
8223 + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8224 + "\tTaskType=0x%x MsgFlags=0x%x "
8225 + "TaskMsgContext=0x%x id=%d channel=%d\n",
8226 + ioc->name, pScsiTm->TaskType,
8227 + le32_to_cpu(pScsiTm->TaskMsgContext),
8228 + pScsiTm->MsgFlags, pScsiTm->TargetID, pScsiTm->Bus));
8229 break;
8230 }
8231
8232 @@ -2286,9 +2308,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8233 /* Set up the dataOut memory allocation */
8234 if (karg.dataOutSize > 0) {
8235 if (karg.dataInSize > 0) {
8236 - flagsLength = ( MPI_SGE_FLAGS_SIMPLE_ELEMENT |
8237 + flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
8238 MPI_SGE_FLAGS_END_OF_BUFFER |
8239 - MPI_SGE_FLAGS_DIRECTION )
8240 + MPI_SGE_FLAGS_DIRECTION)
8241 << MPI_SGE_FLAGS_SHIFT;
8242 } else {
8243 flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE;
8244 @@ -2365,7 +2387,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8245 mpt_put_msg_frame_hi_pri(mptctl_id, ioc, mf);
8246 else {
8247 rc = mpt_send_handshake_request(mptctl_id, ioc,
8248 - sizeof(SCSITaskMgmt_t), (u32*)mf, CAN_SLEEP);
8249 + sizeof(SCSITaskMgmt_t), (u32 *)mf, CAN_SLEEP);
8250 if (rc != 0) {
8251 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
8252 "send_handshake FAILED! (ioc %p, mf %p)\n",
8253 @@ -2381,16 +2403,16 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8254
8255 /* Now wait for the command to complete */
8256 timeout = (karg.timeout > 0) ? karg.timeout : MPT_IOCTL_DEFAULT_TIMEOUT;
8257 - timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*timeout);
8258 + timeleft =
8259 + wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*timeout);
8260 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
8261 rc = -ETIME;
8262 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "%s: TIMED OUT!\n",
8263 - ioc->name, __FUNCTION__));
8264 + ioc->name, __func__));
8265 if (function == MPI_FUNCTION_SCSI_TASK_MGMT)
8266 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
8267 - if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
8268 + if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
8269 goto done_free_mem;
8270 - }
8271 if (!timeleft) {
8272 mptctl_timeout_expired(ioc, mf);
8273 mf = NULL;
8274 @@ -2408,7 +2430,8 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8275 */
8276 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) {
8277 if (karg.maxReplyBytes < ioc->reply_sz) {
8278 - sz = min(karg.maxReplyBytes, 4*ioc->ioctl_cmds.reply[2]);
8279 + sz = min(karg.maxReplyBytes,
8280 + 4*ioc->ioctl_cmds.reply[2]);
8281 } else {
8282 sz = min(ioc->reply_sz, 4*ioc->ioctl_cmds.reply[2]);
8283 }
8284 @@ -2430,7 +2453,8 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8285 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_SENSE_VALID) {
8286 sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
8287 if (sz > 0) {
8288 - if (copy_to_user(karg.senseDataPtr, ioc->ioctl_cmds.sense, sz)) {
8289 + if (copy_to_user(karg.senseDataPtr,
8290 + ioc->ioctl_cmds.sense, sz)) {
8291 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
8292 "Unable to write sense data to user %p\n",
8293 ioc->name, __FILE__, __LINE__,
8294 @@ -2488,7 +2512,8 @@ done_free_mem:
8295 * Outputs: None.
8296 * Return: 0 if successful
8297 * -EFAULT if data unavailable
8298 - * -EBUSY if previous command timout and IOC reset is not complete.
8299 + * -EBUSY if previous command timout and IOC reset is
8300 + * not complete.
8301 * -ENODEV if no such device/adapter
8302 * -ETIME if timer expires
8303 * -ENOMEM if memory allocation error
8304 @@ -2499,7 +2524,7 @@ mptctl_hp_hostinfo(unsigned long arg, un
8305 hp_host_info_t __user *uarg = (void __user *) arg;
8306 MPT_ADAPTER *ioc;
8307 struct pci_dev *pdev;
8308 - char *pbuf=NULL;
8309 + char *pbuf = NULL;
8310 dma_addr_t buf_dma;
8311 hp_host_info_t karg;
8312 int iocnum;
8313 @@ -2530,8 +2555,9 @@ mptctl_hp_hostinfo(unsigned long arg, un
8314 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8315 (ioc == NULL)) {
8316 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8317 - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
8318 - __FILE__, __LINE__, iocnum);
8319 + printk(KERN_DEBUG MYNAM
8320 + "%s::%s @%d - ioc%d not found!\n",
8321 + __FILE__, __func__, __LINE__, iocnum);
8322 return -ENODEV;
8323 }
8324
8325 @@ -2619,7 +2645,7 @@ mptctl_hp_hostinfo(unsigned long arg, un
8326 */
8327 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
8328 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
8329 - ioc->name,__FUNCTION__));
8330 + ioc->name,__func__));
8331 retval = -ENOMEM;
8332 goto out;
8333 }
8334 @@ -2644,16 +2670,19 @@ mptctl_hp_hostinfo(unsigned long arg, un
8335 retval = -ENOMEM;
8336 goto out;
8337 }
8338 - ioc->add_sge((char *)&IstwiRWRequest->SGL, (MPT_SGE_FLAGS_SSIMPLE_READ|4),buf_dma);
8339 + ioc->add_sge((char *)&IstwiRWRequest->SGL,
8340 + (MPT_SGE_FLAGS_SSIMPLE_READ|4), buf_dma);
8341
8342 retval = 0;
8343 - SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, IstwiRWRequest->MsgContext);
8344 + SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context,
8345 + IstwiRWRequest->MsgContext);
8346 INITIALIZE_MGMT_STATUS(ioc->ioctl_cmds.status)
8347 mpt_put_msg_frame(mptctl_id, ioc, mf);
8348 - timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*MPT_IOCTL_DEFAULT_TIMEOUT);
8349 + timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done,
8350 + HZ*MPT_IOCTL_DEFAULT_TIMEOUT);
8351 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
8352 retval = -ETIME;
8353 - printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name, __FUNCTION__);
8354 + printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name, __func__);
8355 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
8356 mpt_free_msg_frame(ioc, mf);
8357 goto out;
8358 @@ -2701,7 +2730,8 @@ mptctl_hp_hostinfo(unsigned long arg, un
8359 * Outputs: None.
8360 * Return: 0 if successful
8361 * -EFAULT if data unavailable
8362 - * -EBUSY if previous command timout and IOC reset is not complete.
8363 + * -EBUSY if previous command timout and IOC reset is
8364 + * not complete.
8365 * -ENODEV if no such device/adapter
8366 * -ETIME if timer expires
8367 * -ENOMEM if memory allocation error
8368 @@ -2732,12 +2762,14 @@ mptctl_hp_targetinfo(unsigned long arg)
8369 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8370 (ioc == NULL)) {
8371 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8372 - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
8373 - __FILE__, __LINE__, iocnum);
8374 + printk(KERN_DEBUG MYNAM
8375 + "%s::%s @%d - ioc%d not found!\n",
8376 + __FILE__, __func__, __LINE__, iocnum);
8377 return -ENODEV;
8378 }
8379
8380 - dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_targetinfo called.\n",
8381 + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8382 + ": mptctl_hp_targetinfo called.\n",
8383 ioc->name));
8384 /* There is nothing to do for FCP parts.
8385 */
8386 @@ -2889,8 +2921,9 @@ compat_mptfwxfer_ioctl(struct file *filp
8387 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
8388 (iocp == NULL)) {
8389 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8390 - printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
8391 - __LINE__, iocnumX);
8392 + printk(KERN_DEBUG MYNAM
8393 + "::%s @%d - ioc%d not found!\n", __func__,
8394 + __LINE__, iocnumX);
8395 return -ENODEV;
8396 }
8397
8398 @@ -2930,8 +2963,9 @@ compat_mpt_command(struct file *filp, un
8399 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
8400 (iocp == NULL)) {
8401 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8402 - printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
8403 - __LINE__, iocnumX);
8404 + printk(KERN_DEBUG MYNAM
8405 + "::%s @%d - ioc%d not found!\n",
8406 + __func__, __LINE__, iocnumX);
8407 return -ENODEV;
8408 }
8409
8410 @@ -3144,7 +3178,7 @@ static void mptctl_exit(void)
8411
8412 #if defined(CPQ_CIM)
8413 #include "csmi/csmisas.c"
8414 -#endif // CPQ_CIM
8415 +#endif
8416
8417 #if defined(DIAG_BUFFER_SUPPORT)
8418 #include "rejected_ioctls/diag_buffer.c"
8419 Index: linux-2.6.27/drivers/message/fusion/mptfc.c
8420 ===================================================================
8421 --- linux-2.6.27.orig/drivers/message/fusion/mptfc.c
8422 +++ linux-2.6.27/drivers/message/fusion/mptfc.c
8423 @@ -270,28 +270,28 @@ static int
8424 mptfc_abort(struct scsi_cmnd *SCpnt)
8425 {
8426 return
8427 - mptfc_block_error_handler(SCpnt, mptscsih_abort, __FUNCTION__);
8428 + mptfc_block_error_handler(SCpnt, mptscsih_abort, __func__);
8429 }
8430
8431 static int
8432 mptfc_dev_reset(struct scsi_cmnd *SCpnt)
8433 {
8434 return
8435 - mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __FUNCTION__);
8436 + mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __func__);
8437 }
8438
8439 static int
8440 mptfc_bus_reset(struct scsi_cmnd *SCpnt)
8441 {
8442 return
8443 - mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __FUNCTION__);
8444 + mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __func__);
8445 }
8446
8447 static int
8448 mptfc_host_reset(struct scsi_cmnd *SCpnt)
8449 {
8450 return
8451 - mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __FUNCTION__);
8452 + mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __func__);
8453 }
8454
8455 static void
8456 @@ -553,7 +553,6 @@ mptfc_target_destroy(struct scsi_target
8457 struct fc_rport *rport;
8458 struct mptfc_rport_info *ri;
8459
8460 - printk("%s - starget=%p\n", __FUNCTION__, starget);
8461 rport = starget_to_rport(starget);
8462 if (rport) {
8463 ri = *((struct mptfc_rport_info **)rport->dd_data);
8464 @@ -994,7 +993,8 @@ mptfc_SetFcPortPage1_defaults(MPT_ADAPTE
8465 #define OFF_FLAGS (MPI_FCPORTPAGE1_FLAGS_VERBOSE_RESCAN_EVENTS)
8466
8467 for (ii=0; ii<ioc->facts.NumberOfPorts; ii++) {
8468 - if ((rc = mptfc_GetFcPortPage1(ioc, ii)) < 0)
8469 + rc = mptfc_GetFcPortPage1(ioc, ii);
8470 + if (rc < 0)
8471 return rc;
8472 pp1 = ioc->fc_data.fc_port_page1[ii].data;
8473 if ((pp1->InitiatorDeviceTimeout == MPTFC_FW_DEVICE_TIMEOUT)
8474 @@ -1006,7 +1006,8 @@ mptfc_SetFcPortPage1_defaults(MPT_ADAPTE
8475 pp1->InitiatorIoPendTimeout = MPTFC_FW_IO_PEND_TIMEOUT;
8476 pp1->Flags &= ~OFF_FLAGS;
8477 pp1->Flags |= ON_FLAGS;
8478 - if ((rc = mptfc_WriteFcPortPage1(ioc, ii)) < 0)
8479 + rc = mptfc_WriteFcPortPage1(ioc, ii);
8480 + if (rc < 0)
8481 return rc;
8482 }
8483 return 0;
8484 @@ -1170,8 +1171,9 @@ mptfc_rescan_devices(struct work_struct
8485 * if cannot set defaults, something's really wrong, bail out
8486 */
8487
8488 - if ((rc = mptfc_SetFcPortPage1_defaults(ioc)) < 0) {
8489 - dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
8490 + rc = mptfc_SetFcPortPage1_defaults(ioc);
8491 + if (rc < 0) {
8492 + dfcprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8493 "mptfc_rescan.%d: unable to set PP1 defaults, rc %d.\n",
8494 ioc->name, ioc->sh->host_no, rc));
8495 return;
8496 @@ -1373,8 +1375,9 @@ mptfc_probe(struct pci_dev *pdev, const
8497
8498 /* initialize workqueue */
8499
8500 - snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name), "mptfc_wq_%d",
8501 - sh->host_no);
8502 + snprintf(ioc->fc_rescan_work_q_name,
8503 + sizeof(ioc->fc_rescan_work_q_name), "mptfc_wq_%d",
8504 + sh->host_no);
8505 ioc->fc_rescan_work_q =
8506 create_singlethread_workqueue(ioc->fc_rescan_work_q_name);
8507 if (!ioc->fc_rescan_work_q)
8508 @@ -1462,10 +1465,10 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int re
8509 if ((ioc->bus_type != FC) || (!rc))
8510 return rc;
8511
8512 - switch(reset_phase) {
8513 + switch (reset_phase) {
8514 case MPT_IOC_SETUP_RESET:
8515 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8516 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
8517 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
8518 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
8519 if (ioc->fc_rescan_work_q) {
8520 queue_work(ioc->fc_rescan_work_q,
8521 @@ -1475,11 +1478,11 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int re
8522 break;
8523 case MPT_IOC_PRE_RESET:
8524 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8525 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
8526 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
8527 break;
8528 case MPT_IOC_POST_RESET:
8529 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8530 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
8531 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
8532 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
8533 if (ioc->fc_rescan_work_q) {
8534 queue_work(ioc->fc_rescan_work_q,
8535 @@ -1493,11 +1496,12 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int re
8536 return 1;
8537 }
8538
8539 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
8540 /**
8541 * mptfc_init - Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
8542 *
8543 * Returns 0 for success, non-zero for failure.
8544 - **/
8545 + */
8546 static int __init
8547 mptfc_init(void)
8548 {
8549 @@ -1529,11 +1533,12 @@ mptfc_init(void)
8550 return error;
8551 }
8552
8553 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
8554 /**
8555 * mptfc_remove - Remove fc infrastructure for devices
8556 * @pdev: Pointer to pci_dev structure
8557 *
8558 - **/
8559 + */
8560 static void __devexit
8561 mptfc_remove(struct pci_dev *pdev)
8562 {
8563 @@ -1543,8 +1548,6 @@ mptfc_remove(struct pci_dev *pdev)
8564 unsigned long flags;
8565 int ii;
8566
8567 - printk("%s -pdev=%p\n", __FUNCTION__, pdev);
8568 -
8569 /* destroy workqueue */
8570 if ((work_q=ioc->fc_rescan_work_q)) {
8571 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
8572 Index: linux-2.6.27/drivers/message/fusion/mptlan.c
8573 ===================================================================
8574 --- linux-2.6.27.orig/drivers/message/fusion/mptlan.c
8575 +++ linux-2.6.27/drivers/message/fusion/mptlan.c
8576 @@ -614,7 +614,7 @@ mpt_lan_send_turbo(struct net_device *de
8577
8578 dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
8579 IOC_AND_NETDEV_NAMES_s_s(dev),
8580 - __FUNCTION__, sent));
8581 + __func__, sent));
8582
8583 priv->SendCtl[ctx].skb = NULL;
8584 pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma,
8585 @@ -680,7 +680,7 @@ mpt_lan_send_reply(struct net_device *de
8586
8587 dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
8588 IOC_AND_NETDEV_NAMES_s_s(dev),
8589 - __FUNCTION__, sent));
8590 + __func__, sent));
8591
8592 priv->SendCtl[ctx].skb = NULL;
8593 pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma,
8594 @@ -719,7 +719,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, s
8595 u16 cur_naa = 0x1000;
8596
8597 dioprintk((KERN_INFO MYNAM ": %s called, skb_addr = %p\n",
8598 - __FUNCTION__, skb));
8599 + __func__, skb));
8600
8601 spin_lock_irqsave(&priv->txfidx_lock, flags);
8602 if (priv->mpt_txfidx_tail < 0) {
8603 @@ -727,7 +727,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, s
8604 spin_unlock_irqrestore(&priv->txfidx_lock, flags);
8605
8606 printk (KERN_ERR "%s: no tx context available: %u\n",
8607 - __FUNCTION__, priv->mpt_txfidx_tail);
8608 + __func__, priv->mpt_txfidx_tail);
8609 return 1;
8610 }
8611
8612 @@ -737,7 +737,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, s
8613 spin_unlock_irqrestore(&priv->txfidx_lock, flags);
8614
8615 printk (KERN_ERR "%s: Unable to alloc request frame\n",
8616 - __FUNCTION__);
8617 + __func__);
8618 return 1;
8619 }
8620
8621 @@ -1213,7 +1213,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8622
8623 dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, Start_buckets = %u, buckets_out = %u\n",
8624 IOC_AND_NETDEV_NAMES_s_s(dev),
8625 - __FUNCTION__, buckets, curr));
8626 + __func__, buckets, curr));
8627
8628 max = (mpt_dev->req_sz - MPT_LAN_RECEIVE_POST_REQUEST_SIZE) /
8629 (MPT_LAN_TRANSACTION32_SIZE + sizeof(SGESimple64_t));
8630 @@ -1222,9 +1222,9 @@ mpt_lan_post_receive_buckets(struct mpt_
8631 mf = mpt_get_msg_frame(LanCtx, mpt_dev);
8632 if (mf == NULL) {
8633 printk (KERN_ERR "%s: Unable to alloc request frame\n",
8634 - __FUNCTION__);
8635 + __func__);
8636 dioprintk((KERN_ERR "%s: %u buckets remaining\n",
8637 - __FUNCTION__, buckets));
8638 + __func__, buckets));
8639 goto out;
8640 }
8641 pRecvReq = (LANReceivePostRequest_t *) mf;
8642 @@ -1249,7 +1249,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8643 spin_lock_irqsave(&priv->rxfidx_lock, flags);
8644 if (priv->mpt_rxfidx_tail < 0) {
8645 printk (KERN_ERR "%s: Can't alloc context\n",
8646 - __FUNCTION__);
8647 + __func__);
8648 spin_unlock_irqrestore(&priv->rxfidx_lock,
8649 flags);
8650 break;
8651 @@ -1272,7 +1272,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8652 if (skb == NULL) {
8653 printk (KERN_WARNING
8654 MYNAM "/%s: Can't alloc skb\n",
8655 - __FUNCTION__);
8656 + __func__);
8657 priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
8658 spin_unlock_irqrestore(&priv->rxfidx_lock, flags);
8659 break;
8660 @@ -1310,7 +1310,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8661
8662 if (pSimple == NULL) {
8663 /**/ printk (KERN_WARNING MYNAM "/%s: No buckets posted\n",
8664 -/**/ __FUNCTION__);
8665 +/**/ __func__);
8666 mpt_free_msg_frame(mpt_dev, mf);
8667 goto out;
8668 }
8669 @@ -1334,9 +1334,9 @@ mpt_lan_post_receive_buckets(struct mpt_
8670
8671 out:
8672 dioprintk((KERN_INFO MYNAM "/%s: End_buckets = %u, priv->buckets_out = %u\n",
8673 - __FUNCTION__, buckets, atomic_read(&priv->buckets_out)));
8674 + __func__, buckets, atomic_read(&priv->buckets_out)));
8675 dioprintk((KERN_INFO MYNAM "/%s: Posted %u buckets and received %u back\n",
8676 - __FUNCTION__, priv->total_posted, priv->total_received));
8677 + __func__, priv->total_posted, priv->total_received));
8678
8679 clear_bit(0, &priv->post_buckets_active);
8680 }
8681 Index: linux-2.6.27/drivers/message/fusion/mptsas.c
8682 ===================================================================
8683 --- linux-2.6.27.orig/drivers/message/fusion/mptsas.c
8684 +++ linux-2.6.27/drivers/message/fusion/mptsas.c
8685 @@ -117,19 +117,23 @@ static u8 mptsasInternalCtx = MPT_MAX_PR
8686 static u8 mptsasMgmtCtx = MPT_MAX_PROTOCOL_DRIVERS;
8687 static u8 mptsasDeviceResetCtx = MPT_MAX_PROTOCOL_DRIVERS;
8688
8689 -static inline void mptsas_set_rphy(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy);
8690 -static struct mptsas_phyinfo * mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc,
8691 - u64 sas_address);
8692 -static int mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
8693 - u32 form, u32 form_specific);
8694 -static int mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
8695 - u32 form, u32 form_specific);
8696 -
8697 -static int mptsas_add_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info);
8698 -static void mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info);
8699 -static void mptsas_expander_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info);
8700 -static int mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
8701 - u32 form, u32 form_specific);
8702 +static inline void mptsas_set_rphy(MPT_ADAPTER *ioc,
8703 + struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy);
8704 +static struct mptsas_phyinfo *mptsas_find_phyinfo_by_sas_address(
8705 + MPT_ADAPTER *ioc, u64 sas_address);
8706 +static int mptsas_sas_device_pg0(MPT_ADAPTER *ioc,
8707 + struct mptsas_devinfo *device_info, u32 form, u32 form_specific);
8708 +static int mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc,
8709 + struct mptsas_enclosure *enclosure, u32 form, u32 form_specific);
8710 +
8711 +static int mptsas_add_end_device(MPT_ADAPTER *ioc,
8712 + struct mptsas_phyinfo *phy_info);
8713 +static void mptsas_del_end_device(MPT_ADAPTER *ioc,
8714 + struct mptsas_phyinfo *phy_info);
8715 +static void mptsas_expander_delete(MPT_ADAPTER *ioc,
8716 + struct mptsas_portinfo *port_info);
8717 +static int mptsas_sas_expander_pg0(MPT_ADAPTER *ioc,
8718 + struct mptsas_portinfo *port_info, u32 form, u32 form_specific);
8719 static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
8720 static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
8721
8722 @@ -323,7 +327,7 @@ mptsas_add_fw_event(MPT_ADAPTER *ioc, st
8723 list_add_tail(&fw_event->list, &ioc->fw_event_list);
8724 INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work);
8725 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: add (fw_event=0x%p)\n",
8726 - ioc->name,__FUNCTION__, fw_event));
8727 + ioc->name, __func__, fw_event));
8728 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
8729 msecs_to_jiffies(delay));
8730 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
8731 @@ -337,7 +341,7 @@ mptsas_requeue_fw_event(MPT_ADAPTER *ioc
8732 unsigned long flags;
8733 spin_lock_irqsave(&ioc->fw_event_lock, flags);
8734 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: reschedule task "
8735 - "(fw_event=0x%p)\n", ioc->name,__FUNCTION__, fw_event));
8736 + "(fw_event=0x%p)\n", ioc->name, __func__, fw_event));
8737 fw_event->retries++;
8738 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
8739 msecs_to_jiffies(delay));
8740 @@ -352,13 +356,14 @@ mptsas_free_fw_event(MPT_ADAPTER *ioc, s
8741
8742 spin_lock_irqsave(&ioc->fw_event_lock, flags);
8743 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: kfree (fw_event=0x%p)\n",
8744 - ioc->name,__FUNCTION__, fw_event));
8745 + ioc->name, __func__, fw_event));
8746 list_del(&fw_event->list);
8747 kfree(fw_event);
8748 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
8749 }
8750
8751 -/* walk the firmware event queue, and either stop or wait for outstanding events to complete */
8752 +/* walk the firmware event queue, and either stop or wait for
8753 + * outstanding events to complete */
8754 static void
8755 mptsas_cleanup_fw_event_q(MPT_ADAPTER *ioc)
8756 {
8757 @@ -373,7 +378,7 @@ mptsas_cleanup_fw_event_q(MPT_ADAPTER *i
8758 &hd->target_reset_list, list) {
8759 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8760 "%s: removing target reset for id=%d\n",
8761 - ioc->name, __FUNCTION__,
8762 + ioc->name, __func__,
8763 target_reset_list->sas_event_data.TargetID));
8764 list_del(&target_reset_list->list);
8765 kfree(target_reset_list);
8766 @@ -433,7 +438,7 @@ rphy_to_ioc(struct sas_rphy *rphy)
8767 static struct mptsas_portinfo *
8768 mptsas_find_portinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
8769 {
8770 - struct mptsas_portinfo *port_info, *rc=NULL;
8771 + struct mptsas_portinfo *port_info, *rc = NULL;
8772 int i;
8773
8774 if (sas_address >= ioc->hba_port_sas_addr &&
8775 @@ -523,7 +528,7 @@ mptsas_port_delete(MPT_ADAPTER *ioc, str
8776 phy_info = port_info->phy_info;
8777
8778 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: [%p]: num_phys=%02d "
8779 - "bitmask=0x%016llX\n", ioc->name, __FUNCTION__, port_details,
8780 + "bitmask=0x%016llX\n", ioc->name, __func__, port_details,
8781 port_details->num_phys, (unsigned long long)
8782 port_details->phy_bitmask));
8783
8784 @@ -659,7 +664,7 @@ mptsas_add_device_component(MPT_ADAPTER
8785 /*
8786 * Delete all matching devices out of the list
8787 */
8788 - down(&ioc->sas_device_info_mutex);
8789 + mutex_lock(&ioc->sas_device_info_mutex);
8790 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
8791 list) {
8792 if (!sas_info->is_logical_volume &&
8793 @@ -700,7 +705,7 @@ mptsas_add_device_component(MPT_ADAPTER
8794 }
8795
8796 out:
8797 - up(&ioc->sas_device_info_mutex);
8798 + mutex_unlock(&ioc->sas_device_info_mutex);
8799 return;
8800 }
8801
8802 @@ -745,7 +750,8 @@ mptsas_add_device_component_by_fw(MPT_AD
8803 *
8804 **/
8805 static void
8806 -mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc, struct scsi_target *starget)
8807 +mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
8808 + struct scsi_target *starget)
8809 {
8810 CONFIGPARMS cfg;
8811 ConfigPageHeader_t hdr;
8812 @@ -790,14 +796,14 @@ mptsas_add_device_component_starget_ir(M
8813 */
8814 for (i = 0; i < buffer->NumPhysDisks; i++) {
8815
8816 - if(mpt_raid_phys_disk_pg0(ioc,
8817 + if (mpt_raid_phys_disk_pg0(ioc,
8818 buffer->PhysDisk[i].PhysDiskNum, &phys_disk) != 0)
8819 continue;
8820
8821 mptsas_add_device_component_by_fw(ioc, phys_disk.PhysDiskBus,
8822 phys_disk.PhysDiskID);
8823
8824 - down(&ioc->sas_device_info_mutex);
8825 + mutex_lock(&ioc->sas_device_info_mutex);
8826 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
8827 list) {
8828 if (!sas_info->is_logical_volume &&
8829 @@ -807,13 +813,13 @@ mptsas_add_device_component_starget_ir(M
8830 sas_info->volume_id = starget->id;
8831 }
8832 }
8833 - up(&ioc->sas_device_info_mutex);
8834 + mutex_unlock(&ioc->sas_device_info_mutex);
8835 }
8836
8837 /*
8838 * Delete all matching devices out of the list
8839 */
8840 - down(&ioc->sas_device_info_mutex);
8841 + mutex_lock(&ioc->sas_device_info_mutex);
8842 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
8843 list) {
8844 if (sas_info->is_logical_volume && sas_info->fw.id ==
8845 @@ -832,7 +838,7 @@ mptsas_add_device_component_starget_ir(M
8846 INIT_LIST_HEAD(&sas_info->list);
8847 list_add_tail(&sas_info->list, &ioc->sas_device_info_list);
8848 }
8849 - up(&ioc->sas_device_info_mutex);
8850 + mutex_unlock(&ioc->sas_device_info_mutex);
8851
8852 out:
8853 if (buffer)
8854 @@ -847,7 +853,8 @@ mptsas_add_device_component_starget_ir(M
8855 *
8856 **/
8857 static void
8858 -mptsas_add_device_component_starget(MPT_ADAPTER *ioc, struct scsi_target *starget)
8859 +mptsas_add_device_component_starget(MPT_ADAPTER *ioc,
8860 + struct scsi_target *starget)
8861 {
8862 VirtTarget *vtarget;
8863 struct sas_rphy *rphy;
8864 @@ -906,13 +913,13 @@ mptsas_del_device_components(MPT_ADAPTER
8865 {
8866 struct sas_device_info *sas_info, *next;
8867
8868 - down(&ioc->sas_device_info_mutex);
8869 + mutex_lock(&ioc->sas_device_info_mutex);
8870 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
8871 list) {
8872 list_del(&sas_info->list);
8873 kfree(sas_info);
8874 }
8875 - up(&ioc->sas_device_info_mutex);
8876 + mutex_unlock(&ioc->sas_device_info_mutex);
8877 }
8878
8879 /**
8880 @@ -926,7 +933,7 @@ mptsas_del_device_components(MPT_ADAPTER
8881 static void
8882 mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
8883 {
8884 - struct mptsas_portinfo_details * port_details;
8885 + struct mptsas_portinfo_details *port_details;
8886 struct mptsas_phyinfo *phy_info, *phy_info_cmp;
8887 u64 sas_address;
8888 int i, j;
8889 @@ -949,9 +956,9 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8890 */
8891 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8892 "%s: [%p]: deleting phy = %d\n",
8893 - ioc->name, __FUNCTION__, port_details, i));
8894 + ioc->name, __func__, port_details, i));
8895 port_details->num_phys--;
8896 - port_details->phy_bitmask &= ~ (1 << phy_info->phy_id);
8897 + port_details->phy_bitmask &= ~(1 << phy_info->phy_id);
8898 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo));
8899 devtprintk(ioc, dev_printk(KERN_DEBUG, &phy_info->phy->dev,
8900 MYIOC_s_FMT "delete phy %d, phy-obj (0x%p)\n", ioc->name,
8901 @@ -966,8 +973,9 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8902 phy_info = port_info->phy_info;
8903 for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) {
8904 sas_address = phy_info->attached.sas_address;
8905 - dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "phy_id=%d sas_address=0x%018llX\n",
8906 - ioc->name, i, (unsigned long long)sas_address));
8907 + dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8908 + "phy_id=%d sas_address=0x%018llX\n",
8909 + ioc->name, i, (unsigned long long)sas_address));
8910 if (!sas_address)
8911 continue;
8912 port_details = phy_info->port_details;
8913 @@ -981,13 +989,14 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8914 goto out;
8915 port_details->num_phys = 1;
8916 port_details->port_info = port_info;
8917 - if (phy_info->phy_id < 64 )
8918 + if (phy_info->phy_id < 64)
8919 port_details->phy_bitmask |=
8920 (1 << phy_info->phy_id);
8921 - phy_info->sas_port_add_phy=1;
8922 - dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tForming port\n\t\t"
8923 - "phy_id=%d sas_address=0x%018llX\n", ioc->name, i,
8924 - (unsigned long long) sas_address));
8925 + phy_info->sas_port_add_phy = 1;
8926 + dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8927 + "\t\tForming port\n\t\t"
8928 + "phy_id=%d sas_address=0x%018llX\n", ioc->name,
8929 + i, (unsigned long long) sas_address));
8930 phy_info->port_details = port_details;
8931 }
8932
8933 @@ -1000,7 +1009,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8934 continue;
8935 if (sas_address != phy_info_cmp->attached.sas_address)
8936 continue;
8937 - if (phy_info_cmp->port_details == port_details )
8938 + if (phy_info_cmp->port_details == port_details)
8939 continue;
8940 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8941 "\t\tphy_id=%d sas_address=0x%018llX\n",
8942 @@ -1018,12 +1027,12 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8943 if (!phy_info_cmp->port_details->num_phys)
8944 kfree(phy_info_cmp->port_details);
8945 } else
8946 - phy_info_cmp->sas_port_add_phy=1;
8947 + phy_info_cmp->sas_port_add_phy = 1;
8948 /*
8949 * Adding a phy to a port
8950 */
8951 phy_info_cmp->port_details = port_details;
8952 - if (phy_info_cmp->phy_id < 64 )
8953 + if (phy_info_cmp->phy_id < 64)
8954 port_details->phy_bitmask |=
8955 (1 << phy_info_cmp->phy_id);
8956 port_details->num_phys++;
8957 @@ -1038,11 +1047,12 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8958 continue;
8959 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8960 "%s: [%p]: phy_id=%02d num_phys=%02d "
8961 - "bitmask=0x%016llX\n", ioc->name, __FUNCTION__,
8962 + "bitmask=0x%016llX\n", ioc->name, __func__,
8963 port_details, i, port_details->num_phys,
8964 (unsigned long long)port_details->phy_bitmask));
8965 - dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tport = %p rphy=%p\n",
8966 - ioc->name, port_details->port, port_details->rphy));
8967 + dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8968 + "\t\tport = %p rphy=%p\n",
8969 + ioc->name, port_details->port, port_details->rphy));
8970 }
8971 dsaswideprintk(ioc, printk("\n"));
8972 mutex_unlock(&ioc->sas_topology_mutex);
8973 @@ -1089,7 +1099,7 @@ mptsas_queue_device_delete(MPT_ADAPTER *
8974 fw_event = kzalloc(sz, GFP_ATOMIC);
8975 if (!fw_event) {
8976 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n",
8977 - ioc->name, __FUNCTION__, __LINE__);
8978 + ioc->name, __func__, __LINE__);
8979 return;
8980 }
8981 memcpy(fw_event->event_data, sas_event_data,
8982 @@ -1109,7 +1119,7 @@ mptsas_queue_rescan(MPT_ADAPTER *ioc)
8983 fw_event = kzalloc(sz, GFP_ATOMIC);
8984 if (!fw_event) {
8985 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n",
8986 - ioc->name, __FUNCTION__, __LINE__);
8987 + ioc->name, __func__, __LINE__);
8988 return;
8989 }
8990 fw_event->event = -1;
8991 @@ -1139,8 +1149,9 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8
8992 return 0;
8993
8994 if ((mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc)) == NULL) {
8995 - dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames @%d!!\n",
8996 - ioc->name,__FUNCTION__, __LINE__));
8997 + dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
8998 + "%s, no msg frames @%d!!\n",
8999 + ioc->name, __func__, __LINE__));
9000 goto out_fail;
9001 }
9002
9003 @@ -1150,7 +1161,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8
9004 /* Format the Request
9005 */
9006 pScsiTm = (SCSITaskMgmt_t *) mf;
9007 - memset (pScsiTm, 0, sizeof(SCSITaskMgmt_t));
9008 + memset(pScsiTm, 0, sizeof(SCSITaskMgmt_t));
9009 pScsiTm->TargetID = id;
9010 pScsiTm->Bus = channel;
9011 pScsiTm->Function = MPI_FUNCTION_SCSI_TASK_MGMT;
9012 @@ -1201,8 +1212,9 @@ mptsas_target_reset_queue(MPT_ADAPTER *i
9013 target_reset_list = kzalloc(sizeof(struct mptsas_target_reset_event),
9014 GFP_ATOMIC);
9015 if (!target_reset_list) {
9016 - dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
9017 - ioc->name,__FUNCTION__, __LINE__));
9018 + dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
9019 + "%s, failed to allocate mem @%d..!!\n",
9020 + ioc->name, __func__, __LINE__));
9021 return;
9022 }
9023
9024 @@ -1227,7 +1239,7 @@ static int
9025 mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
9026 {
9027 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
9028 - struct list_head *head = &hd->target_reset_list;
9029 + struct list_head *head = &hd->target_reset_list;
9030 struct mptsas_target_reset_event *target_reset_list;
9031 u8 id, channel;
9032 SCSITaskMgmtReply_t *pScsiTmReply;
9033 @@ -1300,7 +1312,8 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
9034 */
9035 list_del(&target_reset_list->list);
9036 if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
9037 - mptsas_queue_device_delete(ioc, &target_reset_list->sas_event_data);
9038 + mptsas_queue_device_delete(ioc,
9039 + &target_reset_list->sas_event_data);
9040
9041
9042 /*
9043 @@ -1311,8 +1324,8 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
9044 if (list_empty(head))
9045 return 1;
9046
9047 - target_reset_list = list_entry(head->next, struct mptsas_target_reset_event,
9048 - list);
9049 + target_reset_list = list_entry(head->next,
9050 + struct mptsas_target_reset_event, list);
9051
9052 id = target_reset_list->sas_event_data.TargetID;
9053 channel = target_reset_list->sas_event_data.Bus;
9054 @@ -1344,19 +1357,19 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int r
9055 if (!hd->ioc)
9056 goto out;
9057
9058 - switch(reset_phase) {
9059 + switch (reset_phase) {
9060 case MPT_IOC_SETUP_RESET:
9061 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9062 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
9063 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
9064 mptsas_fw_event_off(ioc);
9065 break;
9066 case MPT_IOC_PRE_RESET:
9067 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9068 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
9069 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
9070 break;
9071 case MPT_IOC_POST_RESET:
9072 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9073 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
9074 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
9075 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_PENDING) {
9076 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_DID_IOCRESET;
9077 complete(&ioc->sas_mgmt.done);
9078 @@ -1473,7 +1486,7 @@ mptsas_get_lun_number(MPT_ADAPTER *ioc,
9079 &lun_data_dma);
9080 if (!lun_data) {
9081 printk(MYIOC_s_ERR_FMT "%s: pci_alloc_consistent(%d) FAILED!\n",
9082 - ioc->name, __FUNCTION__, lun_data_len);
9083 + ioc->name, __func__, lun_data_len);
9084 rc = -ENOMEM;
9085 goto out;
9086 }
9087 @@ -1481,7 +1494,7 @@ mptsas_get_lun_number(MPT_ADAPTER *ioc,
9088 iocmd = kzalloc(sizeof(INTERNAL_CMD), GFP_KERNEL);
9089 if (!iocmd) {
9090 printk(MYIOC_s_ERR_FMT "%s: kzalloc(%zd) FAILED!\n",
9091 - ioc->name, __FUNCTION__, sizeof(INTERNAL_CMD));
9092 + ioc->name, __func__, sizeof(INTERNAL_CMD));
9093 rc = -ENOMEM;
9094 goto out;
9095 }
9096 @@ -1499,14 +1512,14 @@ mptsas_get_lun_number(MPT_ADAPTER *ioc,
9097 if ((rc = mptscsih_do_cmd(hd, iocmd)) < 0) {
9098 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9099 "report_luns failed due to rc=0x%x\n", ioc->name,
9100 - __FUNCTION__, channel, id, rc);
9101 + __func__, channel, id, rc);
9102 goto out;
9103 }
9104
9105 if (rc != MPT_SCANDV_GOOD) {
9106 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9107 "report_luns failed due to rc=0x%x\n", ioc->name,
9108 - __FUNCTION__, channel, id, rc);
9109 + __func__, channel, id, rc);
9110 rc = -rc;
9111 goto out;
9112 }
9113 @@ -1576,7 +1589,7 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9114 iocmd = kzalloc(sizeof(INTERNAL_CMD), GFP_KERNEL);
9115 if (!iocmd) {
9116 printk(MYIOC_s_ERR_FMT "%s: kzalloc(%zd) FAILED!\n",
9117 - __FUNCTION__, ioc->name, sizeof(INTERNAL_CMD));
9118 + __func__, ioc->name, sizeof(INTERNAL_CMD));
9119 return DEVICE_ERROR;
9120 }
9121
9122 @@ -1595,31 +1608,31 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9123
9124 retry:
9125 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: fw_channel=%d "
9126 - "fw_id=%d retry=%d\n", ioc->name, __FUNCTION__, channel, id, count));
9127 + "fw_id=%d retry=%d\n", ioc->name, __func__, channel, id, count));
9128 rc = mptscsih_do_cmd(hd, iocmd);
9129 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: rc=0x%02x\n",
9130 - ioc->name, __FUNCTION__, rc));
9131 + ioc->name, __func__, rc));
9132 if (rc < 0) {
9133 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9134 "tur failed due to timeout\n", ioc->name,
9135 - __FUNCTION__, channel, id);
9136 + __func__, channel, id);
9137 goto tur_done;
9138 }
9139
9140 - switch(rc) {
9141 + switch (rc) {
9142 case MPT_SCANDV_GOOD:
9143 state = DEVICE_READY;
9144 goto tur_done;
9145 case MPT_SCANDV_BUSY:
9146 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: "
9147 "fw_channel=%d fw_id=%d : device busy\n",
9148 - ioc->name, __FUNCTION__, channel, id));
9149 + ioc->name, __func__, channel, id));
9150 state = DEVICE_RETRY;
9151 break;
9152 case MPT_SCANDV_DID_RESET:
9153 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: "
9154 "fw_channel=%d fw_id=%d : did reset\n",
9155 - ioc->name, __FUNCTION__, channel, id));
9156 + ioc->name, __func__, channel, id));
9157 state = DEVICE_RETRY;
9158 break;
9159 case MPT_SCANDV_SENSE:
9160 @@ -1630,7 +1643,7 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9161 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: "
9162 "fw_channel=%d fw_id=%d : [sense_key,asc,"
9163 "ascq]: [0x%02x,0x%02x,0x%02x]\n", ioc->name,
9164 - __FUNCTION__, channel, id, skey, asc, ascq));
9165 + __func__, channel, id, skey, asc, ascq));
9166
9167 if (skey == UNIT_ATTENTION) {
9168 if (!retry_ua) {
9169 @@ -1656,7 +1669,7 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9170 break;
9171 }
9172 } else if (skey == ILLEGAL_REQUEST) {
9173 - /* try sending a tur to a non-zero lun number */
9174 + /* try sending a tur to a non-zero lun number */
9175 if (!iocmd->lun && !mptsas_get_lun_number(ioc,
9176 channel, id, &iocmd->lun) && iocmd->lun)
9177 goto retry;
9178 @@ -1664,25 +1677,25 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9179 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d : "
9180 "tur failed due to [sense_key,asc,ascq]: "
9181 "[0x%02x,0x%02x,0x%02x]\n", ioc->name,
9182 - __FUNCTION__, channel, id, skey, asc, ascq);
9183 + __func__, channel, id, skey, asc, ascq);
9184 goto tur_done;
9185 case MPT_SCANDV_SELECTION_TIMEOUT:
9186 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9187 "tur failed due to no device\n", ioc->name,
9188 - __FUNCTION__, channel,
9189 + __func__, channel,
9190 id);
9191 goto tur_done;
9192 case MPT_SCANDV_SOME_ERROR:
9193 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9194 "tur failed due to some error\n", ioc->name,
9195 - __FUNCTION__,
9196 + __func__,
9197 channel, id);
9198 goto tur_done;
9199 default:
9200 printk(MYIOC_s_ERR_FMT
9201 "%s: fw_channel=%d fw_id=%d: tur failed due to "
9202 - "unknown rc=0x%02x\n", ioc->name, __FUNCTION__,
9203 - channel, id, rc );
9204 + "unknown rc=0x%02x\n", ioc->name, __func__,
9205 + channel, id, rc);
9206 goto tur_done;
9207 }
9208 tur_done:
9209 @@ -1705,19 +1718,19 @@ mptsas_issue_tlr(MPT_SCSI_HOST *hd, stru
9210 u8 rc;
9211 MPT_ADAPTER *ioc = hd->ioc;
9212
9213 - if ( sdev->inquiry[8] == 'H' &&
9214 + if (sdev->inquiry[8] == 'H' &&
9215 sdev->inquiry[9] == 'P' &&
9216 sdev->inquiry[10] == ' ' &&
9217 sdev->inquiry[11] == ' ' &&
9218 sdev->inquiry[12] == ' ' &&
9219 sdev->inquiry[13] == ' ' &&
9220 sdev->inquiry[14] == ' ' &&
9221 - sdev->inquiry[15] == ' ' ) {
9222 + sdev->inquiry[15] == ' ') {
9223
9224 iocmd = kzalloc(sizeof(INTERNAL_CMD), GFP_KERNEL);
9225 if (!iocmd) {
9226 printk(MYIOC_s_ERR_FMT "%s: kzalloc(%zd) FAILED!\n",
9227 - __FUNCTION__, ioc->name, sizeof(INTERNAL_CMD));
9228 + __func__, ioc->name, sizeof(INTERNAL_CMD));
9229 return;
9230 }
9231 iocmd->id = vdevice->vtarget->id;
9232 @@ -1773,7 +1786,7 @@ mptsas_slave_configure(struct scsi_devic
9233 mptsas_add_device_component_starget(ioc, scsi_target(sdev));
9234
9235 if (sdev->type == TYPE_TAPE &&
9236 - (ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_TLR ))
9237 + (ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_TLR))
9238 mptsas_issue_tlr(hd, sdev);
9239 out:
9240
9241 @@ -1815,7 +1828,7 @@ mptsas_target_alloc(struct scsi_target *
9242 kfree(vtarget);
9243 return -ENXIO;
9244 }
9245 - for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
9246 + for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
9247 if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID)
9248 channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus;
9249 vtarget->raidVolume = 1;
9250 @@ -1834,9 +1847,11 @@ mptsas_target_alloc(struct scsi_target *
9251 mptsas_set_starget(&p->phy_info[i], starget);
9252
9253 starget_printk(KERN_INFO, starget, MYIOC_s_FMT
9254 - "add device: fw_channel %d, fw_id %d, phy %d, sas_addr 0x%llx\n",
9255 + "add device: fw_channel %d, fw_id %d, phy %d,"
9256 + " sas_addr 0x%llx\n",
9257 ioc->name, p->phy_info[i].attached.channel,
9258 - p->phy_info[i].attached.id, p->phy_info[i].attached.phy_id,
9259 + p->phy_info[i].attached.id,
9260 + p->phy_info[i].attached.phy_id,
9261 (unsigned long long)p->phy_info[i].attached.sas_address);
9262
9263 /*
9264 @@ -1899,9 +1914,9 @@ mptsas_target_destroy(struct scsi_target
9265 starget_printk(KERN_INFO, starget, MYIOC_s_FMT
9266 "delete device: fw_channel %d, fw_id %d, phy %d, "
9267 "sas_addr 0x%llx\n", ioc->name,
9268 - p->phy_info[i].attached.channel,
9269 + p->phy_info[i].attached.channel,
9270 p->phy_info[i].attached.id,
9271 - p->phy_info[i].attached.phy_id, (unsigned long long)
9272 + p->phy_info[i].attached.phy_id, (unsigned long long)
9273 p->phy_info[i].attached.sas_address);
9274
9275 mptsas_port_delete(ioc, p->phy_info[i].port_details);
9276 @@ -2000,8 +2015,7 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, voi
9277 if (ioc->sas_discovery_quiesce_io)
9278 return SCSI_MLQUEUE_HOST_BUSY;
9279
9280 -// scsi_print_command(SCpnt);
9281 - return mptscsih_qcmd(SCpnt,done);
9282 + return mptscsih_qcmd(SCpnt, done);
9283 }
9284
9285
9286 @@ -2046,7 +2060,6 @@ static int mptsas_get_linkerrors(struct
9287 dma_addr_t dma_handle;
9288 int error;
9289
9290 - /* FIXME: only have link errors on local phys */
9291 if (!scsi_is_sas_phy_local(phy))
9292 return -EINVAL;
9293
9294 @@ -2140,7 +2153,6 @@ static int mptsas_phy_reset(struct sas_p
9295 unsigned long timeleft;
9296 int error = -ERESTARTSYS;
9297
9298 - /* FIXME: fusion doesn't allow non-local phy reset */
9299 if (!scsi_is_sas_phy_local(phy))
9300 return -EINVAL;
9301
9302 @@ -2192,7 +2204,7 @@ static int mptsas_phy_reset(struct sas_p
9303 reply = (SasIoUnitControlReply_t *)ioc->sas_mgmt.reply;
9304 if (reply->IOCStatus != MPI_IOCSTATUS_SUCCESS) {
9305 printk(MYIOC_s_INFO_FMT "%s: IOCStatus=0x%X IOCLogInfo=0x%X\n",
9306 - ioc->name, __FUNCTION__, reply->IOCStatus, reply->IOCLogInfo);
9307 + ioc->name, __func__, reply->IOCStatus, reply->IOCLogInfo);
9308 error = -ENXIO;
9309 goto out_unlock;
9310 }
9311 @@ -2275,11 +2287,160 @@ mptsas_get_bay_identifier(struct sas_rph
9312 return rc;
9313 }
9314
9315 +static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
9316 + struct request *req)
9317 +{
9318 + MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc;
9319 + MPT_FRAME_HDR *mf;
9320 + SmpPassthroughRequest_t *smpreq;
9321 + struct request *rsp = req->next_rq;
9322 + int ret;
9323 + int flagsLength;
9324 + unsigned long timeleft;
9325 + char *psge;
9326 + dma_addr_t dma_addr_in = 0;
9327 + dma_addr_t dma_addr_out = 0;
9328 + u64 sas_address = 0;
9329 +
9330 + if (!rsp) {
9331 + printk(MYIOC_s_ERR_FMT
9332 + "%s: the smp response space is missing\n",
9333 + ioc->name, __func__);
9334 + return -EINVAL;
9335 + }
9336 +
9337 + /* do we need to support multiple segments? */
9338 + if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) {
9339 + printk(MYIOC_s_ERR_FMT
9340 + "%s: multiple segments req %u %u, rsp %u %u\n",
9341 + ioc->name, __func__, req->bio->bi_vcnt, req->data_len,
9342 + rsp->bio->bi_vcnt, rsp->data_len);
9343 + return -EINVAL;
9344 + }
9345 +
9346 + ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
9347 + if (ret)
9348 + goto out;
9349 +
9350 + mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
9351 + if (!mf) {
9352 + ret = -ENOMEM;
9353 + goto out_unlock;
9354 + }
9355 +
9356 + smpreq = (SmpPassthroughRequest_t *)mf;
9357 + memset(smpreq, 0, sizeof(*smpreq));
9358 +
9359 + smpreq->RequestDataLength = cpu_to_le16(req->data_len - 4);
9360 + smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH;
9361 +
9362 + if (rphy)
9363 + sas_address = rphy->identify.sas_address;
9364 + else {
9365 + struct mptsas_portinfo *port_info;
9366 +
9367 + mutex_lock(&ioc->sas_topology_mutex);
9368 + port_info = ioc->hba_port_info;
9369 + if (port_info && port_info->phy_info)
9370 + sas_address =
9371 + port_info->phy_info[0].phy->identify.sas_address;
9372 + mutex_unlock(&ioc->sas_topology_mutex);
9373 + }
9374 +
9375 + *((u64 *)&smpreq->SASAddress) = cpu_to_le64(sas_address);
9376 +
9377 + psge = (char *)
9378 + (((int *) mf) + (offsetof(SmpPassthroughRequest_t, SGL) / 4));
9379 +
9380 + /* request */
9381 +
9382 + flagsLength = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
9383 + MPI_SGE_FLAGS_SYSTEM_ADDRESS |
9384 + MPI_SGE_FLAGS_HOST_TO_IOC |
9385 + MPI_SGE_FLAGS_END_OF_BUFFER;
9386 +
9387 + flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
9388 +
9389 + flagsLength |= (req->data_len - 4);
9390 +
9391 + dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
9392 + req->data_len, PCI_DMA_BIDIRECTIONAL);
9393 + if (!dma_addr_out)
9394 + goto put_mf;
9395 + ioc->add_sge(psge, flagsLength, dma_addr_out);
9396 + psge += ioc->SGE_size;
9397 +
9398 + /* response */
9399 + flagsLength = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
9400 + MPI_SGE_FLAGS_SYSTEM_ADDRESS |
9401 + MPI_SGE_FLAGS_IOC_TO_HOST |
9402 + MPI_SGE_FLAGS_END_OF_BUFFER;
9403 +
9404 + flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
9405 + flagsLength |= rsp->data_len + 4;
9406 + dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio),
9407 + rsp->data_len, PCI_DMA_BIDIRECTIONAL);
9408 + if (!dma_addr_in)
9409 + goto out_unmap;
9410 +
9411 + ioc->add_sge(psge, flagsLength, dma_addr_in);
9412 +
9413 + INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status)
9414 + mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
9415 +
9416 + timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
9417 + if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
9418 + ret = -ETIME;
9419 + mpt_free_msg_frame(ioc, mf);
9420 + mf = NULL;
9421 + if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
9422 + goto out_unmap;
9423 + if (!timeleft) {
9424 + if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
9425 + mpt_HardResetHandler(ioc, CAN_SLEEP);
9426 + }
9427 + goto out_unmap;
9428 + }
9429 +
9430 + mf = NULL;
9431 +
9432 + if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) {
9433 + SmpPassthroughReply_t *smprep;
9434 +
9435 + smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
9436 + memcpy(req->sense, smprep, sizeof(*smprep));
9437 + req->sense_len = sizeof(*smprep);
9438 + req->data_len = 0;
9439 + rsp->data_len -= smprep->ResponseDataLength;
9440 + } else {
9441 + printk(MYIOC_s_ERR_FMT
9442 + "%s: smp passthru reply failed to be returned\n",
9443 + ioc->name, __func__);
9444 + ret = -ENXIO;
9445 + }
9446 +out_unmap:
9447 + if (dma_addr_out)
9448 + pci_unmap_single(ioc->pcidev, dma_addr_out, req->data_len,
9449 + PCI_DMA_BIDIRECTIONAL);
9450 + if (dma_addr_in)
9451 + pci_unmap_single(ioc->pcidev, dma_addr_in, rsp->data_len,
9452 + PCI_DMA_BIDIRECTIONAL);
9453 +put_mf:
9454 + if (mf)
9455 + mpt_free_msg_frame(ioc, mf);
9456 +out_unlock:
9457 + CLEAR_MGMT_STATUS(ioc->sas_mgmt.status)
9458 + mutex_unlock(&ioc->sas_mgmt.mutex);
9459 +out:
9460 + return ret;
9461 +}
9462 +
9463 static struct sas_function_template mptsas_transport_functions = {
9464 .get_linkerrors = mptsas_get_linkerrors,
9465 .get_enclosure_identifier = mptsas_get_enclosure_identifier,
9466 .get_bay_identifier = mptsas_get_bay_identifier,
9467 .phy_reset = mptsas_phy_reset,
9468 + .smp_handler = mptsas_smp_handler,
9469 };
9470
9471 static struct scsi_transport_template *mptsas_transport_template;
9472 @@ -2338,7 +2499,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc,
9473
9474 port_info->num_phys = buffer->NumPhys;
9475 port_info->phy_info = kcalloc(port_info->num_phys,
9476 - sizeof(struct mptsas_phyinfo),GFP_KERNEL);
9477 + sizeof(struct mptsas_phyinfo), GFP_KERNEL);
9478 if (!port_info->phy_info) {
9479 error = -ENOMEM;
9480 goto out_free_consistent;
9481 @@ -2659,7 +2820,7 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc
9482 /* save config data */
9483 port_info->num_phys = (buffer->NumPhys) ? buffer->NumPhys : 1;
9484 port_info->phy_info = kcalloc(port_info->num_phys,
9485 - sizeof(struct mptsas_phyinfo),GFP_KERNEL);
9486 + sizeof(struct mptsas_phyinfo), GFP_KERNEL);
9487 if (!port_info->phy_info) {
9488 error = -ENOMEM;
9489 goto out_free_consistent;
9490 @@ -2970,7 +3131,7 @@ static int mptsas_probe_one_phy(struct d
9491 if (error) {
9492 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9493 "%s: exit at line=%d\n", ioc->name,
9494 - __FUNCTION__, __LINE__));
9495 + __func__, __LINE__));
9496 goto out;
9497 }
9498 mptsas_set_port(ioc, phy_info, port);
9499 @@ -3036,7 +3197,7 @@ static int mptsas_probe_one_phy(struct d
9500 if (!rphy) {
9501 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9502 "%s: exit at line=%d\n", ioc->name,
9503 - __FUNCTION__, __LINE__));
9504 + __func__, __LINE__));
9505 goto out;
9506 }
9507
9508 @@ -3045,7 +3206,7 @@ static int mptsas_probe_one_phy(struct d
9509 if (error) {
9510 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9511 "%s: exit at line=%d\n", ioc->name,
9512 - __FUNCTION__, __LINE__));
9513 + __func__, __LINE__));
9514 sas_rphy_free(rphy);
9515 goto out;
9516 }
9517 @@ -3069,7 +3230,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
9518 int error = -ENOMEM, i;
9519
9520 hba = kzalloc(sizeof(struct mptsas_portinfo), GFP_KERNEL);
9521 - if (! hba)
9522 + if (!hba)
9523 goto out;
9524
9525 error = mptsas_sas_io_unit_pg0(ioc, hba);
9526 @@ -3195,7 +3356,7 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT
9527 num_paths = mpt_raid_phys_disk_get_num_paths(ioc, phys_disk_num);
9528 if (!num_paths)
9529 goto out;
9530 - phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
9531 + phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
9532 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
9533 if (!phys_disk)
9534 goto out;
9535 @@ -3208,7 +3369,8 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT
9536 (channel == phys_disk->Path[i].PhysDiskBus)) {
9537 memcpy(&sas_address, &phys_disk->Path[i].WWID,
9538 sizeof(u64));
9539 - phy_info = mptsas_find_phyinfo_by_sas_address(ioc, sas_address);
9540 + phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
9541 + sas_address);
9542 goto out;
9543 }
9544 }
9545 @@ -3230,7 +3392,8 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT
9546 continue;
9547 if (port_info->phy_info[i].attached.phys_disk_num == ~0)
9548 continue;
9549 - if (port_info->phy_info[i].attached.phys_disk_num == phys_disk_num &&
9550 + if (port_info->phy_info[i].attached.phys_disk_num ==
9551 + phys_disk_num &&
9552 port_info->phy_info[i].attached.id == id &&
9553 port_info->phy_info[i].attached.channel == channel)
9554 phy_info = &port_info->phy_info[i];
9555 @@ -3275,7 +3438,6 @@ mptsas_reprobe_target(struct scsi_target
9556 * @id:
9557 *
9558 *
9559 - * TODO: check for hotspares
9560 **/
9561 static void
9562 mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id)
9563 @@ -3363,10 +3525,10 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9564 char *ds = NULL;
9565 u8 fw_id;
9566
9567 - if (!phy_info){
9568 + if (!phy_info) {
9569 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9570 "%s: exit at line=%d\n", ioc->name,
9571 - __FUNCTION__, __LINE__));
9572 + __func__, __LINE__));
9573 return 1;
9574 }
9575
9576 @@ -3375,7 +3537,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9577 if (mptsas_get_rphy(phy_info)) {
9578 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9579 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9580 - __FUNCTION__, fw_id, __LINE__));
9581 + __func__, fw_id, __LINE__));
9582 return 2;
9583 }
9584
9585 @@ -3383,7 +3545,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9586 if (!port) {
9587 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9588 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9589 - __FUNCTION__, fw_id, __LINE__));
9590 + __func__, fw_id, __LINE__));
9591 return 3;
9592 }
9593
9594 @@ -3408,7 +3570,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9595 if (!rphy) {
9596 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9597 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9598 - __FUNCTION__, fw_id, __LINE__));
9599 + __func__, fw_id, __LINE__));
9600 return 5; /* non-fatal: an rphy can be added later */
9601 }
9602
9603 @@ -3416,7 +3578,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9604 if (sas_rphy_add(rphy)) {
9605 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9606 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9607 - __FUNCTION__, fw_id, __LINE__));
9608 + __func__, fw_id, __LINE__));
9609 sas_rphy_free(rphy);
9610 return 6;
9611 }
9612 @@ -3439,7 +3601,7 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9613 struct mptsas_portinfo *port_info;
9614 struct mptsas_phyinfo *phy_info_parent;
9615 int i;
9616 - struct scsi_target * starget;
9617 + struct scsi_target *starget;
9618 char *ds = NULL;
9619 u8 fw_id;
9620 u64 sas_address;
9621 @@ -3453,14 +3615,14 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9622 if (!phy_info->port_details) {
9623 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9624 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9625 - __FUNCTION__, fw_id, __LINE__));
9626 + __func__, fw_id, __LINE__));
9627 return;
9628 }
9629 rphy = mptsas_get_rphy(phy_info);
9630 if (!rphy) {
9631 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9632 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9633 - __FUNCTION__, fw_id, __LINE__));
9634 + __func__, fw_id, __LINE__));
9635 return;
9636 }
9637 if (phy_info->attached.device_info &
9638 @@ -3485,13 +3647,13 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9639 if (!port) {
9640 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9641 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9642 - __FUNCTION__, fw_id, __LINE__));
9643 + __func__, fw_id, __LINE__));
9644 return;
9645 }
9646 port_info = phy_info->portinfo;
9647 phy_info_parent = port_info->phy_info;
9648 for (i = 0; i < port_info->num_phys; i++, phy_info_parent++) {
9649 - if(!phy_info_parent->phy)
9650 + if (!phy_info_parent->phy)
9651 continue;
9652 if (phy_info_parent->attached.sas_address !=
9653 sas_address)
9654 @@ -3507,11 +3669,11 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9655 "delete port %d, sas_addr (0x%llx)\n", ioc->name,
9656 port->port_identifier, (unsigned long long)sas_address);
9657 sas_port_delete(port);
9658 -// mptsas_port_delete(ioc, phy_info->port_details);
9659 }
9660
9661 struct mptsas_phyinfo *
9662 -mptsas_refreshing_device_handles(MPT_ADAPTER *ioc, struct mptsas_devinfo *sas_device)
9663 +mptsas_refreshing_device_handles(MPT_ADAPTER *ioc,
9664 + struct mptsas_devinfo *sas_device)
9665 {
9666 struct mptsas_phyinfo *phy_info;
9667 struct mptsas_portinfo *port_info;
9668 @@ -3526,7 +3688,7 @@ mptsas_refreshing_device_handles(MPT_ADA
9669 goto out;
9670 mutex_lock(&ioc->sas_topology_mutex);
9671 for (i = 0; i < port_info->num_phys; i++) {
9672 - if(port_info->phy_info[i].attached.sas_address !=
9673 + if (port_info->phy_info[i].attached.sas_address !=
9674 sas_device->sas_address)
9675 continue;
9676 port_info->phy_info[i].attached.channel = sas_device->channel;
9677 @@ -3555,7 +3717,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9678 struct mptsas_hotplug_event *hot_plug_info)
9679 {
9680 struct mptsas_phyinfo *phy_info;
9681 - struct scsi_target * starget;
9682 + struct scsi_target *starget;
9683 struct mptsas_devinfo sas_device;
9684 VirtTarget *vtarget;
9685 enum device_state state;
9686 @@ -3636,17 +3798,17 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9687 (hot_plug_info->channel << 8) + hot_plug_info->id)) {
9688 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9689 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9690 - __FUNCTION__, hot_plug_info->id, __LINE__));
9691 + __func__, hot_plug_info->id, __LINE__));
9692 break;
9693 }
9694
9695 phy_info = mptsas_find_phyinfo_by_sas_address(
9696 ioc, sas_device.sas_address);
9697
9698 - if (!phy_info){
9699 + if (!phy_info) {
9700 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9701 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9702 - __FUNCTION__, hot_plug_info->id, __LINE__));
9703 + __func__, hot_plug_info->id, __LINE__));
9704 break;
9705 }
9706
9707 @@ -3654,7 +3816,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9708 if (!starget) {
9709 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9710 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9711 - __FUNCTION__, hot_plug_info->id, __LINE__));
9712 + __func__, hot_plug_info->id, __LINE__));
9713 break;
9714 }
9715
9716 @@ -3662,7 +3824,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9717 if (!vtarget) {
9718 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9719 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9720 - __FUNCTION__, hot_plug_info->id, __LINE__));
9721 + __func__, hot_plug_info->id, __LINE__));
9722 break;
9723 }
9724
9725 @@ -3688,7 +3850,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9726 (hot_plug_info->channel << 8) + hot_plug_info->id)) {
9727 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9728 "%s: fw_id=%d exit at line=%d\n",
9729 - ioc->name, __FUNCTION__,
9730 + ioc->name, __func__,
9731 hot_plug_info->id, __LINE__));
9732 break;
9733 }
9734 @@ -3698,7 +3860,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9735 if (!phy_info) {
9736 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9737 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9738 - __FUNCTION__, hot_plug_info->id, __LINE__));
9739 + __func__, hot_plug_info->id, __LINE__));
9740 break;
9741 }
9742
9743 @@ -3706,7 +3868,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9744 if (!starget) {
9745 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9746 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9747 - __FUNCTION__, hot_plug_info->id, __LINE__));
9748 + __func__, hot_plug_info->id, __LINE__));
9749 break;
9750 }
9751
9752 @@ -3714,14 +3876,14 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9753 if (!vtarget) {
9754 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9755 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9756 - __FUNCTION__, hot_plug_info->id, __LINE__));
9757 + __func__, hot_plug_info->id, __LINE__));
9758 break;
9759 }
9760
9761 if (!(vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT)) {
9762 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9763 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9764 - __FUNCTION__, hot_plug_info->id, __LINE__));
9765 + __func__, hot_plug_info->id, __LINE__));
9766 break;
9767 }
9768
9769 @@ -3800,7 +3962,7 @@ mptsas_send_sas_event(struct fw_event_wo
9770 if ((device_info &
9771 (MPI_SAS_DEVICE_INFO_SSP_TARGET |
9772 MPI_SAS_DEVICE_INFO_STP_TARGET |
9773 - MPI_SAS_DEVICE_INFO_SATA_DEVICE )) == 0) {
9774 + MPI_SAS_DEVICE_INFO_SATA_DEVICE)) == 0) {
9775 mptsas_free_fw_event(ioc, fw_event);
9776 return;
9777 }
9778 @@ -3840,9 +4002,7 @@ mptsas_send_sas_event(struct fw_event_wo
9779 break;
9780
9781 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
9782 - /* TODO */
9783 case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET:
9784 - /* TODO */
9785 default:
9786 mptsas_free_fw_event(ioc, fw_event);
9787 break;
9788 @@ -3892,7 +4052,7 @@ mptsas_send_raid_event(struct fw_event_w
9789 }
9790
9791 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "Entering %s: "
9792 - "ReasonCode=%02x\n", ioc->name, __FUNCTION__,
9793 + "ReasonCode=%02x\n", ioc->name, __func__,
9794 raid_event_data->ReasonCode));
9795
9796 switch (raid_event_data->ReasonCode) {
9797 @@ -3988,8 +4148,8 @@ mptsas_send_raid_event(struct fw_event_w
9798 *
9799 **/
9800 static int
9801 -mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, int task_context, ulong timeout,
9802 - u8 *issue_reset)
9803 +mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun,
9804 + int task_context, ulong timeout, u8 *issue_reset)
9805 {
9806 MPT_FRAME_HDR *mf;
9807 SCSITaskMgmt_t *pScsiTm;
9808 @@ -4068,7 +4228,7 @@ mptsas_broadcast_primative_work(struct f
9809 VirtDevice *vdevice;
9810 int ii;
9811 struct scsi_cmnd *sc;
9812 - SCSITaskMgmtReply_t * pScsiTmReply;
9813 + SCSITaskMgmtReply_t *pScsiTmReply;
9814 u8 issue_reset;
9815 int task_context;
9816 u8 channel, id;
9817 @@ -4077,7 +4237,7 @@ mptsas_broadcast_primative_work(struct f
9818 u32 query_count;
9819
9820 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9821 - "%s - enter\n", ioc->name, __FUNCTION__));
9822 + "%s - enter\n", ioc->name, __func__));
9823
9824 mutex_lock(&ioc->taskmgmt_cmds.mutex);
9825 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
9826 @@ -4133,7 +4293,7 @@ mptsas_broadcast_primative_work(struct f
9827 out:
9828 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9829 "%s - exit, query_count = %d termination_count = %d\n",
9830 - ioc->name, __FUNCTION__, query_count, termination_count));
9831 + ioc->name, __func__, query_count, termination_count));
9832
9833 ioc->broadcast_aen_busy = 0;
9834 mpt_clear_taskmgmt_in_progress_flag(ioc);
9835 @@ -4141,7 +4301,7 @@ mptsas_broadcast_primative_work(struct f
9836
9837 if (issue_reset) {
9838 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
9839 - ioc->name, __FUNCTION__);
9840 + ioc->name, __func__);
9841 if (mpt_SoftResetHandler(ioc, CAN_SLEEP))
9842 mpt_HardResetHandler(ioc, CAN_SLEEP);
9843 }
9844 @@ -4159,7 +4319,7 @@ mptsas_send_ir2_event(struct fw_event_wo
9845 {
9846 MPT_ADAPTER *ioc;
9847 struct mptsas_hotplug_event hot_plug_info;
9848 - MPI_EVENT_DATA_IR2 * ir2_data;
9849 + MPI_EVENT_DATA_IR2 *ir2_data;
9850 u8 reasonCode;
9851 RaidPhysDiskPage0_t phys_disk;
9852
9853 @@ -4168,7 +4328,7 @@ mptsas_send_ir2_event(struct fw_event_wo
9854 reasonCode = ir2_data->ReasonCode;
9855
9856 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "Entering %s: "
9857 - "ReasonCode=%02x\n", ioc->name,__FUNCTION__, reasonCode));
9858 + "ReasonCode=%02x\n", ioc->name, __func__, reasonCode));
9859
9860 memset(&hot_plug_info, 0, sizeof(struct mptsas_hotplug_event));
9861 hot_plug_info.id = ir2_data->TargetID;
9862 @@ -4255,7 +4415,7 @@ mptsas_expander_refresh(MPT_ADAPTER *ioc
9863
9864 static void
9865 mptsas_expander_event_add(MPT_ADAPTER *ioc,
9866 - MpiEventDataSasExpanderStatusChange_t* expander_data)
9867 + MpiEventDataSasExpanderStatusChange_t *expander_data)
9868 {
9869 struct mptsas_portinfo *port_info;
9870 int i;
9871 @@ -4267,7 +4427,7 @@ mptsas_expander_event_add(MPT_ADAPTER *i
9872 port_info->num_phys = (expander_data->NumPhys) ?
9873 expander_data->NumPhys : 1;
9874 port_info->phy_info = kcalloc(port_info->num_phys,
9875 - sizeof(struct mptsas_phyinfo),GFP_KERNEL);
9876 + sizeof(struct mptsas_phyinfo), GFP_KERNEL);
9877 if (!port_info->phy_info)
9878 BUG();
9879 memcpy(&sas_address, &expander_data->SASAddress, sizeof(__le64));
9880 @@ -4351,8 +4511,8 @@ mptsas_expander_delete(MPT_ADAPTER *ioc,
9881 u64 expander_sas_address;
9882 struct mptsas_phyinfo *phy_info;
9883 struct mptsas_portinfo buffer;
9884 - struct mptsas_portinfo_details * port_details;
9885 - struct sas_port * port;
9886 + struct mptsas_portinfo_details *port_details;
9887 + struct sas_port *port;
9888
9889 if (!port_info)
9890 return;
9891 @@ -4388,7 +4548,7 @@ mptsas_expander_delete(MPT_ADAPTER *ioc,
9892 phy_info = parent->phy_info;
9893 port = NULL;
9894 for (i = 0; i < parent->num_phys; i++, phy_info++) {
9895 - if(!phy_info->phy)
9896 + if (!phy_info->phy)
9897 continue;
9898 if (phy_info->attached.sas_address !=
9899 expander_sas_address)
9900 @@ -4438,7 +4598,7 @@ static void
9901 mptsas_send_expander_event(struct fw_event_work *fw_event)
9902 {
9903 MPT_ADAPTER *ioc;
9904 - MpiEventDataSasExpanderStatusChange_t* expander_data;
9905 + MpiEventDataSasExpanderStatusChange_t *expander_data;
9906 struct mptsas_portinfo *port_info;
9907 __le64 sas_address;
9908 int i;
9909 @@ -4492,7 +4652,7 @@ mptsas_expander_add(MPT_ADAPTER *ioc, u1
9910 if (!port_info) {
9911 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9912 "%s: exit at line=%d\n", ioc->name,
9913 - __FUNCTION__, __LINE__));
9914 + __func__, __LINE__));
9915 return NULL;
9916 }
9917 port_info->num_phys = buffer.num_phys;
9918 @@ -4589,7 +4749,7 @@ mptsas_handle_queue_full_event(struct fw
9919 current_depth = le16_to_cpu(qfull_data->CurrentDepth);
9920
9921 /* if hidden raid component, look for the volume id */
9922 - down(&ioc->sas_device_info_mutex);
9923 + mutex_lock(&ioc->sas_device_info_mutex);
9924 if (mptscsih_is_phys_disk(ioc, fw_channel, fw_id)) {
9925 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
9926 list) {
9927 @@ -4622,7 +4782,7 @@ mptsas_handle_queue_full_event(struct fw
9928 }
9929
9930 out:
9931 - up(&ioc->sas_device_info_mutex);
9932 + mutex_unlock(&ioc->sas_device_info_mutex);
9933
9934 if (id != -1) {
9935 shost_for_each_device(sdev, ioc->sh) {
9936 @@ -4643,8 +4803,8 @@ mptsas_handle_queue_full_event(struct fw
9937 depth);
9938 else if (depth < 0)
9939 sdev_printk(KERN_INFO, sdev,
9940 - "Tagged Command Queueing is being "
9941 - "disabled\n");
9942 + "Tagged Command Queueing is being "
9943 + "disabled\n");
9944 else if (depth == 0)
9945 sdev_printk(KERN_INFO, sdev,
9946 "Queue depth not changed yet\n");
9947 @@ -4671,7 +4831,7 @@ mptsas_firmware_event_work(struct work_s
9948 /* special rescan topology handling */
9949 if (fw_event->event == -1) {
9950 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: rescan after "
9951 - "reset\n", ioc->name,__FUNCTION__));
9952 + "reset\n", ioc->name, __func__));
9953 mptsas_not_responding_devices(ioc);
9954 mptsas_scan_sas_topology(ioc);
9955 mptsas_free_fw_event(ioc, fw_event);
9956 @@ -4685,7 +4845,7 @@ mptsas_firmware_event_work(struct work_s
9957 }
9958
9959 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: fw_event=(0x%p), "
9960 - "event = (0x%02x)\n", ioc->name,__FUNCTION__, fw_event,
9961 + "event = (0x%02x)\n", ioc->name, __func__, fw_event,
9962 (fw_event->event & 0xFF)));
9963
9964 switch (fw_event->event) {
9965 @@ -4805,7 +4965,7 @@ mptsas_event_process(MPT_ADAPTER *ioc, E
9966 fw_event = kzalloc(sz, GFP_ATOMIC);
9967 if (!fw_event) {
9968 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name,
9969 - __FUNCTION__, __LINE__);
9970 + __func__, __LINE__);
9971 return 0;
9972 }
9973 memcpy(fw_event->event_data, reply->Data, event_data_sz);
9974 @@ -4835,7 +4995,7 @@ static void mptsas_volume_delete(MPT_ADA
9975 goto release_sdev;
9976 out:
9977 printk(MYIOC_s_INFO_FMT "removing raid volume, channel %d, "
9978 - "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL,id);
9979 + "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, id);
9980 scsi_remove_device(sdev);
9981 release_sdev:
9982 scsi_device_put(sdev);
9983 @@ -4953,7 +5113,7 @@ mptsas_probe_expanders(MPT_ADAPTER *ioc)
9984 if (!port_info) {
9985 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9986 "%s: exit at line=%d\n", ioc->name,
9987 - __FUNCTION__, __LINE__));
9988 + __func__, __LINE__));
9989 return;
9990 }
9991 port_info->num_phys = buffer.num_phys;
9992 @@ -5000,7 +5160,7 @@ mptsas_probe_devices(MPT_ADAPTER *ioc)
9993
9994 state = DEVICE_RETRY;
9995 retry_count = 0;
9996 - while(state == DEVICE_RETRY) {
9997 + while (state == DEVICE_RETRY) {
9998 state = mptsas_test_unit_ready(ioc, sas_device.channel,
9999 sas_device.id, retry_count++);
10000 ssleep(1);
10001 @@ -5032,7 +5192,7 @@ mptsas_scan_sas_topology(MPT_ADAPTER *io
10002 if (!ioc->ir_firmware || !ioc->raid_data.pIocPg2 ||
10003 !ioc->raid_data.pIocPg2->NumActiveVolumes)
10004 return;
10005 - for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
10006 + for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
10007 if ((sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
10008 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0))) {
10009 scsi_device_put(sdev);
10010 @@ -5196,11 +5356,12 @@ mptsas_probe(struct pci_dev *pdev, const
10011 hd->last_queue_full = 0;
10012 ioc->disable_hotplug_remove = mpt_disable_hotplug_remove;
10013 if (ioc->disable_hotplug_remove)
10014 - printk(MYIOC_s_INFO_FMT "disabling hotplug remove\n", ioc->name);
10015 + printk(MYIOC_s_INFO_FMT
10016 + "disabling hotplug remove\n", ioc->name);
10017
10018 INIT_LIST_HEAD(&hd->target_reset_list);
10019 INIT_LIST_HEAD(&ioc->sas_device_info_list);
10020 - init_MUTEX(&ioc->sas_device_info_mutex);
10021 + mutex_init(&ioc->sas_device_info_mutex);
10022
10023 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
10024
10025 Index: linux-2.6.27/drivers/message/fusion/mptsas.h
10026 ===================================================================
10027 --- linux-2.6.27.orig/drivers/message/fusion/mptsas.h
10028 +++ linux-2.6.27/drivers/message/fusion/mptsas.h
10029 @@ -84,9 +84,12 @@ struct sas_device_info {
10030 u16 slot; /* enclosure slot id */
10031 u64 enclosure_logical_id; /*enclosure address */
10032 u8 is_logical_volume; /* is this logical volume */
10033 - u8 is_hidden_raid_component; /* this belongs to volume */
10034 - u8 volume_id; /* this valid when is_hidden_raid_component set */
10035 - u8 is_cached; /* cached data for a removed device */
10036 + /* this belongs to volume */
10037 + u8 is_hidden_raid_component;
10038 + /* this valid when is_hidden_raid_component set */
10039 + u8 volume_id;
10040 + /* cached data for a removed device */
10041 + u8 is_cached;
10042 };
10043
10044 struct mptsas_hotplug_event {
10045 Index: linux-2.6.27/drivers/message/fusion/mptscsih.c
10046 ===================================================================
10047 --- linux-2.6.27.orig/drivers/message/fusion/mptscsih.c
10048 +++ linux-2.6.27/drivers/message/fusion/mptscsih.c
10049 @@ -102,7 +102,8 @@ static void mptscsih_copy_sense_data(str
10050
10051 int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
10052 int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
10053 -static void mptscsih_synchronize_cache(struct scsi_device *sdev, MPT_SCSI_HOST *hd, VirtDevice *vdevice);
10054 +static void mptscsih_synchronize_cache(struct scsi_device *sdev,
10055 + MPT_SCSI_HOST *hd, VirtDevice *vdevice);
10056
10057 void mptscsih_remove(struct pci_dev *);
10058 void mptscsih_shutdown(struct pci_dev *);
10059 @@ -142,12 +143,16 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER
10060 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer;
10061 chain_idx = offset / ioc->req_sz;
10062 rc = SUCCESS;
10063 - dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n",
10064 - ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx));
10065 + dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10066 + "getFreeChainBuffer chainBuf=%p ChainBuffer=%p"
10067 + " offset=%d chain_idx=%d\n",
10068 + ioc->name, chainBuf, ioc->ChainBuffer, offset,
10069 + chain_idx));
10070 } else {
10071 rc = FAILED;
10072 chain_idx = MPT_HOST_NO_CHAIN;
10073 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "getFreeChainBuffer failed\n",
10074 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10075 + "getFreeChainBuffer failed\n",
10076 ioc->name));
10077 }
10078 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
10079 @@ -216,7 +221,7 @@ mptscsih_AddSGE(MPT_ADAPTER *ioc, struct
10080 */
10081
10082 nextSGEset:
10083 - numSgeSlots = ((frm_sz - sgeOffset) / ioc->SGE_size );
10084 + numSgeSlots = ((frm_sz - sgeOffset) / ioc->SGE_size);
10085 numSgeThisFrame = (sges_left < numSgeSlots) ? sges_left : numSgeSlots;
10086
10087 sgflags = MPT_SGE_FLAGS_SIMPLE_ELEMENT | sgdir;
10088 @@ -265,7 +270,8 @@ nextSGEset:
10089 * Update the chain element
10090 * Offset and Length fields.
10091 */
10092 - ioc->add_chain((char *)chainSge, 0, sgeOffset, ioc->ChainBufferDMA + chain_dma_off);
10093 + ioc->add_chain((char *)chainSge, 0, sgeOffset,
10094 + ioc->ChainBufferDMA + chain_dma_off);
10095 } else {
10096 /* The current buffer is the original MF
10097 * and there is no Chain buffer.
10098 @@ -313,7 +319,8 @@ nextSGEset:
10099 */
10100 u8 nextChain = (u8) (sgeOffset >> 2);
10101 sgeOffset += ioc->SGE_size;
10102 - ioc->add_chain((char *)chainSge, nextChain, sgeOffset, ioc->ChainBufferDMA + chain_dma_off);
10103 + ioc->add_chain((char *)chainSge, nextChain, sgeOffset,
10104 + ioc->ChainBufferDMA + chain_dma_off);
10105 } else {
10106 /* The original MF buffer requires a chain buffer -
10107 * set the offset.
10108 @@ -392,7 +399,7 @@ mptscsih_issue_sep_command(MPT_ADAPTER *
10109
10110 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
10111 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!!\n",
10112 - ioc->name,__FUNCTION__));
10113 + ioc->name,__func__));
10114 return;
10115 }
10116
10117 @@ -525,9 +532,11 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, s
10118 scsi_print_command(sc);
10119 printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %d\n",
10120 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun);
10121 - printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, resid = %d\n",
10122 + printk(MYIOC_s_DEBUG_FMT
10123 + "\trequest_len = %d, underflow = %d, resid = %d\n",
10124 ioc->name, scsi_bufflen(sc), sc->underflow, scsi_get_resid(sc));
10125 - printk(MYIOC_s_DEBUG_FMT "\ttag = %d, transfer_count = %d, sc->result = %08X\n",
10126 + printk(MYIOC_s_DEBUG_FMT
10127 + "\ttag = %d, transfer_count = %d, sc->result = %08X\n",
10128 ioc->name, le16_to_cpu(pScsiReply->TaskTag),
10129 le32_to_cpu(pScsiReply->TransferCount), sc->result);
10130
10131 @@ -590,7 +599,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
10132 (le32_to_cpu(mf->u.frame.linkage.arg1) == 0xdeadbeaf)) {
10133 printk(MYIOC_s_WARN_FMT
10134 "Received a mf that was already freed\n", ioc->name);
10135 - printk (MYIOC_s_WARN_FMT
10136 + printk(MYIOC_s_WARN_FMT
10137 "req_idx=%x req_idx_MR=%x mf=%p mr=%p sc=%p\n",
10138 ioc->name, req_idx, req_idx_MR, mf, mr,
10139 mptscsih_get_scsi_lookup(ioc, req_idx_MR));
10140 @@ -715,11 +724,12 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
10141 }
10142 }
10143 } else if (ioc->bus_type == FC) {
10144 - /* The FC IOC may kill a request for variety of reasons,
10145 - some of which may be recovered by a retry, some which
10146 - are unlikely to be recovered. Return DID_ERROR instead
10147 - of DID_RESET to permit retry of the command, just not
10148 - an infinite number of them */
10149 + /* The FC IOC may kill a request for variety
10150 + * of reasons, some of which may be recovered
10151 + * by a retry, some which are unlikely to be
10152 + * recovered. Return DID_ERROR instead of
10153 + * DID_RESET to permit retry of the command,
10154 + * just not an infinite number of them */
10155 sc->result = DID_ERROR << 16;
10156 break;
10157 }
10158 @@ -735,7 +745,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
10159 sc->result = DID_RESET << 16;
10160
10161 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
10162 - if ( ioc->bus_type == FC )
10163 + if (ioc->bus_type == FC)
10164 sc->result = DID_ERROR << 16;
10165 else
10166 sc->result = DID_RESET << 16;
10167 @@ -1421,8 +1431,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, v
10168 */
10169 if (datalen == 0) {
10170 /* Add a NULL SGE */
10171 - ioc->add_sge((char *)&pScsiReq->SGL, MPT_SGE_FLAGS_SSIMPLE_READ | 0,
10172 - (dma_addr_t) -1);
10173 + ioc->add_sge((char *)&pScsiReq->SGL,
10174 + MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
10175 } else {
10176 /* Add a 32 or 64 bit SGE */
10177 if (mptscsih_AddSGE(ioc, SCpnt, pScsiReq, my_idx) != SUCCESS)
10178 @@ -1523,8 +1533,8 @@ mptscsih_scandv_bus_reset(MPT_ADAPTER *i
10179 /* Send request
10180 */
10181 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
10182 - dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt, no msg frames!!\n",
10183 - ioc->name));
10184 + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
10185 + "TaskMgmt, no msg frames!!\n", ioc->name));
10186 mpt_clear_taskmgmt_in_progress_flag(ioc);
10187 retval = -ENOMEM;
10188 goto out;
10189 @@ -1544,26 +1554,27 @@ mptscsih_scandv_bus_reset(MPT_ADAPTER *i
10190 pScsiTm->Reserved = 0;
10191 pScsiTm->Reserved1 = 0;
10192 pScsiTm->TaskMsgContext = 0;
10193 - for (ii= 0; ii < 8; ii++)
10194 + for (ii = 0; ii < 8; ii++)
10195 pScsiTm->LUN[ii] = 0;
10196 - for (ii=0; ii < 7; ii++)
10197 + for (ii = 0; ii < 7; ii++)
10198 pScsiTm->Reserved2[ii] = 0;
10199
10200 switch (ioc->bus_type) {
10201 - case FC:
10202 - timeout = 40;
10203 - break;
10204 - case SAS:
10205 - timeout = 30;
10206 - break;
10207 - case SPI:
10208 - default:
10209 - timeout = 2;
10210 - break;
10211 + case FC:
10212 + timeout = 40;
10213 + break;
10214 + case SAS:
10215 + timeout = 30;
10216 + break;
10217 + case SPI:
10218 + default:
10219 + timeout = 10;
10220 + break;
10221 }
10222
10223 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt type=%d timeout=%ld\n",
10224 - ioc->name, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
10225 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10226 + "TaskMgmt type=%d timeout=%ld\n", ioc->name,
10227 + MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
10228
10229 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
10230 CLEAR_MGMT_STATUS(ioc->internal_cmds.status)
10231 @@ -1576,7 +1587,8 @@ mptscsih_scandv_bus_reset(MPT_ADAPTER *i
10232 retval = mpt_send_handshake_request(ioc->TaskCtx, ioc,
10233 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
10234 if (retval != 0) {
10235 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt send_handshake FAILED!"
10236 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10237 + "TaskMgmt send_handshake FAILED!"
10238 " (ioc %p, mf %p, rc=%d) \n", ioc->name,
10239 ioc, mf, retval));
10240 mpt_clear_taskmgmt_in_progress_flag(ioc);
10241 @@ -1642,19 +1654,20 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int
10242 switch (reset_phase) {
10243 case MPT_IOC_SETUP_RESET:
10244 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10245 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
10246 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
10247 break;
10248 case MPT_IOC_PRE_RESET:
10249 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10250 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
10251 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
10252 hd = shost_priv(ioc->sh);
10253 mptscsih_flush_running_cmds(hd);
10254 break;
10255 case MPT_IOC_POST_RESET:
10256 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10257 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
10258 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
10259 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_PENDING) {
10260 - ioc->internal_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
10261 + ioc->internal_cmds.status
10262 + |= MPT_MGMT_STATUS_DID_IOCRESET;
10263 complete(&ioc->internal_cmds.done);
10264 }
10265 break;
10266 @@ -1700,7 +1713,8 @@ mptscsih_taskmgmt_response_code(MPT_ADAP
10267 }
10268
10269 static int
10270 -mptscsih_taskmgmt_reply(MPT_ADAPTER *ioc, u8 type, SCSITaskMgmtReply_t *pScsiTmReply)
10271 +mptscsih_taskmgmt_reply(MPT_ADAPTER *ioc, u8 type,
10272 + SCSITaskMgmtReply_t *pScsiTmReply)
10273 {
10274 u16 iocstatus;
10275 u32 termination_count;
10276 @@ -1764,7 +1778,8 @@ mptscsih_taskmgmt_reply(MPT_ADAPTER *ioc
10277 * Returns 1 indicating alloc'd request frame ptr should be freed.
10278 **/
10279 int
10280 -mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
10281 +mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf,
10282 + MPT_FRAME_HDR *mr)
10283 {
10284 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed (mf=%p, mr=%p)\n",
10285 ioc->name, mf, mr));
10286 @@ -1807,7 +1822,8 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *
10287 *
10288 **/
10289 int
10290 -mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout)
10291 +mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun,
10292 + int ctx2abort, ulong timeout)
10293 {
10294 MPT_FRAME_HDR *mf = NULL;
10295 SCSITaskMgmt_t *pScsiTm;
10296 @@ -1827,7 +1843,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10297 "TaskMgmt type=%x: IOC Not operational (0x%x)!\n",
10298 ioc->name, type, ioc_raw_state);
10299 printk(MYIOC_s_WARN_FMT "Issuing HardReset from %s!!\n",
10300 - ioc->name, __FUNCTION__);
10301 + ioc->name, __func__);
10302 if (mpt_HardResetHandler(ioc, CAN_SLEEP) < 0)
10303 printk(MYIOC_s_WARN_FMT "TaskMgmt HardReset "
10304 "FAILED!!\n", ioc->name);
10305 @@ -1844,7 +1860,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10306
10307 mutex_lock(&ioc->taskmgmt_cmds.mutex);
10308 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
10309 - mutex_unlock(&ioc->taskmgmt_cmds.mutex);
10310 + mutex_unlock(&ioc->taskmgmt_cmds.mutex);
10311 retval = FAILED;
10312 goto out;
10313 }
10314 @@ -1852,8 +1868,9 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10315 /* Return Fail to calling function if no message frames available.
10316 */
10317 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
10318 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt no msg frames!!\n",
10319 - ioc->name));
10320 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10321 + "TaskMgmt no msg frames!!\n",
10322 + ioc->name));
10323 retval = FAILED;
10324 mpt_clear_taskmgmt_in_progress_flag(ioc);
10325 goto out;
10326 @@ -1873,11 +1890,11 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10327 pScsiTm->TaskType = type;
10328 pScsiTm->Reserved1 = 0;
10329 pScsiTm->MsgFlags = (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS)
10330 - ? MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION : 0;
10331 + ? MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION : 0;
10332
10333 int_to_scsilun(lun, (struct scsi_lun *)pScsiTm->LUN);
10334
10335 - for (ii=0; ii < 7; ii++)
10336 + for (ii = 0; ii < 7; ii++)
10337 pScsiTm->Reserved2[ii] = 0;
10338
10339 pScsiTm->TaskMsgContext = ctx2abort;
10340 @@ -1895,17 +1912,19 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10341 mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf);
10342 else {
10343 retval = mpt_send_handshake_request(ioc->TaskCtx, ioc,
10344 - sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
10345 + sizeof(SCSITaskMgmt_t), (u32 *)pScsiTm, CAN_SLEEP);
10346 if (retval) {
10347 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt handshake FAILED!"
10348 - " (mf=%p, rc=%d) \n", ioc->name, mf, retval));
10349 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10350 + "TaskMgmt handshake FAILED!"
10351 + " (mf=%p, rc=%d) \n", ioc->name, mf, retval));
10352 mpt_free_msg_frame(ioc, mf);
10353 mpt_clear_taskmgmt_in_progress_flag(ioc);
10354 goto out;
10355 }
10356 }
10357
10358 - timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, timeout*HZ);
10359 + timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done,
10360 + timeout*HZ);
10361 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10362 retval = FAILED;
10363 dtmprintk(ioc, printk(MYIOC_s_ERR_FMT
10364 @@ -1927,9 +1946,9 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10365 out:
10366
10367 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status)
10368 - if(issue_hard_reset) {
10369 + if (issue_hard_reset) {
10370 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
10371 - ioc->name, __FUNCTION__);
10372 + ioc->name, __func__);
10373 if ((retval = mpt_SoftResetHandler(ioc, CAN_SLEEP)) != 0)
10374 retval = mpt_HardResetHandler(ioc, CAN_SLEEP);
10375 mpt_free_msg_frame(ioc, mf);
10376 @@ -2037,7 +2056,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
10377 goto out;
10378 }
10379
10380 - if(mpt_fwfault_debug)
10381 + if (mpt_fwfault_debug)
10382 mpt_halt_firmware(ioc);
10383
10384 if (ioc->timeouts < -1)
10385 @@ -2075,7 +2094,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
10386
10387 out:
10388 printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
10389 - ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED" ), SCpnt);
10390 + ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), SCpnt);
10391
10392 return retval;
10393 }
10394 @@ -2306,7 +2325,7 @@ mptscsih_is_phys_disk(MPT_ADAPTER *ioc,
10395 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum);
10396 if (num_paths < 2)
10397 continue;
10398 - phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
10399 + phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
10400 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
10401 if (!phys_disk)
10402 continue;
10403 @@ -2339,14 +2358,14 @@ mptscsih_is_phys_disk(MPT_ADAPTER *ioc,
10404 if (list_empty(&ioc->raid_data.inactive_list))
10405 goto out;
10406
10407 - down(&ioc->raid_data.inactive_list_mutex);
10408 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
10409 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
10410 list) {
10411 if ((component_info->d.PhysDiskID == id) &&
10412 (component_info->d.PhysDiskBus == channel))
10413 rc = 1;
10414 }
10415 - up(&ioc->raid_data.inactive_list_mutex);
10416 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
10417
10418 out:
10419 return rc;
10420 @@ -2357,7 +2376,7 @@ u8
10421 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id)
10422 {
10423 struct inactive_raid_component_info *component_info;
10424 - int i,j;
10425 + int i, j;
10426 RaidPhysDiskPage1_t *phys_disk;
10427 int rc = -ENXIO;
10428 u8 num_paths;
10429 @@ -2384,7 +2403,7 @@ mptscsih_raid_id_to_num(MPT_ADAPTER *ioc
10430 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum);
10431 if (num_paths < 2)
10432 continue;
10433 - phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
10434 + phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
10435 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
10436 if (!phys_disk)
10437 continue;
10438 @@ -2417,14 +2436,14 @@ mptscsih_raid_id_to_num(MPT_ADAPTER *ioc
10439 if (list_empty(&ioc->raid_data.inactive_list))
10440 goto out;
10441
10442 - down(&ioc->raid_data.inactive_list_mutex);
10443 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
10444 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
10445 list) {
10446 if ((component_info->d.PhysDiskID == id) &&
10447 (component_info->d.PhysDiskBus == channel))
10448 rc = component_info->d.PhysDiskNum;
10449 }
10450 - up(&ioc->raid_data.inactive_list_mutex);
10451 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
10452
10453 out:
10454 return rc;
10455 @@ -2595,9 +2614,11 @@ mptscsih_copy_sense_data(struct scsi_cmn
10456
10457 ioc->eventContext++;
10458 if (ioc->pcidev->vendor == PCI_VENDOR_ID_IBM) {
10459 - mptscsih_issue_sep_command(ioc, vdevice->vtarget,
10460 + mptscsih_issue_sep_command(ioc,
10461 + vdevice->vtarget,
10462 MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT);
10463 - vdevice->vtarget->tflags |= MPT_TARGET_FLAGS_LED_ON;
10464 + vdevice->vtarget->tflags |=
10465 + MPT_TARGET_FLAGS_LED_ON;
10466 }
10467 }
10468 }
10469 @@ -2736,8 +2757,9 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10470 /* Get and Populate a free Frame
10471 */
10472 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
10473 - dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!\n",
10474 - ioc->name, __FUNCTION__));
10475 + dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT
10476 + "%s: no msg frames!\n",
10477 + ioc->name, __func__));
10478 ret = -EAGAIN;
10479 goto out;
10480 }
10481 @@ -2759,8 +2781,9 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10482 ioc->add_sge((char *)&pReq->ActionDataSGE,
10483 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
10484
10485 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
10486 - ioc->name, pReq->Action, channel, id));
10487 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10488 + "RAID Volume action=%x channel=%d id=%d\n",
10489 + ioc->name, pReq->Action, channel, id));
10490
10491 INITIALIZE_MGMT_STATUS(ioc->internal_cmds.status)
10492 mpt_put_msg_frame(ioc->InternalCtx, ioc, mf);
10493 @@ -2768,12 +2791,12 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10494 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10495 ret = -ETIME;
10496 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: TIMED OUT!\n",
10497 - ioc->name, __FUNCTION__));
10498 + ioc->name, __func__));
10499 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
10500 goto out;
10501 if (!timeleft) {
10502 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
10503 - ioc->name, __FUNCTION__);
10504 + ioc->name, __func__);
10505 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
10506 mpt_HardResetHandler(ioc, CAN_SLEEP);
10507 mpt_free_msg_frame(ioc, mf);
10508 @@ -2797,7 +2820,8 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10509 *
10510 **/
10511 static int
10512 -mptscsih_get_completion_code(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
10513 +mptscsih_get_completion_code(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
10514 + MPT_FRAME_HDR *reply)
10515 {
10516 SCSIIOReply_t *pReply;
10517 MpiRaidActionReply_t *pr;
10518 @@ -2810,10 +2834,12 @@ mptscsih_get_completion_code(MPT_ADAPTER
10519 scsi_status = pReply->SCSIStatus;
10520
10521 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10522 - "IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh, IOCLogInfo=%08xh\n",
10523 - ioc->name, status, pReply->SCSIState, scsi_status, le32_to_cpu(pReply->IOCLogInfo)));
10524 + "IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh,"
10525 + " IOCLogInfo=%08xh\n",
10526 + ioc->name, status, pReply->SCSIState, scsi_status,
10527 + le32_to_cpu(pReply->IOCLogInfo)));
10528
10529 - switch(status) {
10530 + switch (status) {
10531
10532 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
10533 completion_code = MPT_SCANDV_SELECTION_TIMEOUT;
10534 @@ -2836,9 +2862,11 @@ mptscsih_get_completion_code(MPT_ADAPTER
10535 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */
10536 if (pReply->Function == MPI_FUNCTION_CONFIG) {
10537 completion_code = MPT_SCANDV_GOOD;
10538 - } else if (pReply->Function == MPI_FUNCTION_RAID_ACTION) {
10539 + } else if (pReply->Function ==
10540 + MPI_FUNCTION_RAID_ACTION) {
10541 pr = (MpiRaidActionReply_t *)reply;
10542 - if (le16_to_cpu(pr->ActionStatus) == MPI_RAID_ACTION_ASTATUS_SUCCESS)
10543 + if (le16_to_cpu(pr->ActionStatus) ==
10544 + MPI_RAID_ACTION_ASTATUS_SUCCESS)
10545 completion_code = MPT_SCANDV_GOOD;
10546 else
10547 completion_code = MPT_SCANDV_SOME_ERROR;
10548 @@ -2849,8 +2877,7 @@ mptscsih_get_completion_code(MPT_ADAPTER
10549 completion_code = MPT_SCANDV_ISSUE_SENSE;
10550 else
10551 completion_code = MPT_SCANDV_DID_RESET;
10552 - }
10553 - else if (pReply->SCSIState & MPI_SCSI_STATE_NO_SCSI_STATUS)
10554 + } else if (pReply->SCSIState & MPI_SCSI_STATE_NO_SCSI_STATUS)
10555 completion_code = MPT_SCANDV_DID_RESET;
10556 else if (pReply->SCSIState & MPI_SCSI_STATE_TERMINATED)
10557 completion_code = MPT_SCANDV_DID_RESET;
10558 @@ -2885,7 +2912,8 @@ mptscsih_get_completion_code(MPT_ADAPTER
10559 *
10560 **/
10561 int
10562 -mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
10563 +mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
10564 + MPT_FRAME_HDR *reply)
10565 {
10566 SCSIIORequest_t *pReq;
10567 SCSIIOReply_t *pReply;
10568 @@ -2965,7 +2993,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10569 if (ioc->ioc_reset_in_progress) {
10570 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
10571 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10572 - "%s: busy with host reset\n", ioc->name, __FUNCTION__));
10573 + "%s: busy with host reset\n", ioc->name, __func__));
10574 return MPT_SCANDV_BUSY;
10575 }
10576 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
10577 @@ -3091,7 +3119,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10578 */
10579 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
10580 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: No msg frames!\n",
10581 - ioc->name, __FUNCTION__));
10582 + ioc->name, __func__));
10583 ret = MPT_SCANDV_BUSY;
10584 goto out;
10585 }
10586 @@ -3128,11 +3156,11 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10587 if (cmd == REQUEST_SENSE) {
10588 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED);
10589 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10590 - "%s: Untagged! 0x%02x\n", ioc->name, __FUNCTION__, cmd));
10591 + "%s: Untagged! 0x%02x\n", ioc->name, __func__, cmd));
10592 }
10593
10594 for (ii = 0; ii < 16; ii++)
10595 - pScsiReq->CDB[ii] = CDB[ii];
10596 + pScsiReq->CDB[ii] = CDB[ii];
10597
10598 pScsiReq->DataLength = cpu_to_le32(io->size);
10599 pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma
10600 @@ -3140,7 +3168,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10601
10602 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10603 "%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%d\n",
10604 - ioc->name, __FUNCTION__, cmd, io->channel, io->id, io->lun));
10605 + ioc->name, __func__, cmd, io->channel, io->id, io->lun));
10606
10607 if (dir == MPI_SCSIIO_CONTROL_READ)
10608 ioc->add_sge((char *) &pScsiReq->SGL,
10609 @@ -3156,7 +3184,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10610 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10611 ret = MPT_SCANDV_DID_RESET;
10612 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10613 - "%s: TIMED OUT for cmd=0x%02x\n", ioc->name, __FUNCTION__,
10614 + "%s: TIMED OUT for cmd=0x%02x\n", ioc->name, __func__,
10615 cmd));
10616 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
10617 mpt_free_msg_frame(ioc, mf);
10618 @@ -3166,7 +3194,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10619 if (!mptscsih_scandv_bus_reset(ioc))
10620 goto out;
10621 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
10622 - ioc->name, __FUNCTION__);
10623 + ioc->name, __func__);
10624 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
10625 mpt_HardResetHandler(ioc, CAN_SLEEP);
10626 mpt_free_msg_frame(ioc, mf);
10627 @@ -3176,7 +3204,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10628
10629 ret = ioc->internal_cmds.completion_code;
10630 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: success, rc=0x%02x\n",
10631 - ioc->name, __FUNCTION__, ret));
10632 + ioc->name, __func__, ret));
10633
10634 out:
10635 CLEAR_MGMT_STATUS(ioc->internal_cmds.status)
10636 @@ -3195,7 +3223,8 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10637 *
10638 */
10639 static void
10640 -mptscsih_synchronize_cache(struct scsi_device *sdev, MPT_SCSI_HOST *hd, VirtDevice *vdevice)
10641 +mptscsih_synchronize_cache(struct scsi_device *sdev, MPT_SCSI_HOST *hd,
10642 + VirtDevice *vdevice)
10643 {
10644 INTERNAL_CMD iocmd;
10645 MPT_ADAPTER *ioc = hd->ioc;
10646 @@ -3219,8 +3248,9 @@ mptscsih_synchronize_cache(struct scsi_d
10647 iocmd.id = vdevice->vtarget->id;
10648 iocmd.lun = vdevice->lun;
10649
10650 - sdev_printk(KERN_INFO, sdev, MYIOC_s_FMT "SYNCHRONIZE_CACHE: fw_channel %d,"
10651 - " fw_id %d\n", ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id);
10652 + sdev_printk(KERN_INFO, sdev, MYIOC_s_FMT
10653 + "SYNCHRONIZE_CACHE: fw_channel %d, fw_id %d\n",
10654 + ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id);
10655 mptscsih_do_cmd(hd, &iocmd);
10656 }
10657
10658 @@ -3408,7 +3438,8 @@ static DEVICE_ATTR(debug_level, S_IRUGO
10659 mptscsih_debug_level_show, mptscsih_debug_level_store);
10660
10661 static ssize_t
10662 -mptscsih_disable_hotplug_remove_show(struct device *dev, struct device_attribute *attr, char *buf)
10663 +mptscsih_disable_hotplug_remove_show(struct device *dev,
10664 + struct device_attribute *attr, char *buf)
10665 {
10666 struct Scsi_Host *host = class_to_shost(dev);
10667 MPT_SCSI_HOST *hd = shost_priv(host);
10668 @@ -3417,7 +3448,8 @@ mptscsih_disable_hotplug_remove_show(str
10669 return snprintf(buf, PAGE_SIZE, "%02xh\n", ioc->disable_hotplug_remove);
10670 }
10671 static ssize_t
10672 -mptscsih_disable_hotplug_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
10673 +mptscsih_disable_hotplug_remove_store(struct device *dev,
10674 + struct device_attribute *attr, const char *buf, size_t count)
10675 {
10676 struct Scsi_Host *host = class_to_shost(dev);
10677 MPT_SCSI_HOST *hd = shost_priv(host);
10678 @@ -3436,7 +3468,8 @@ mptscsih_disable_hotplug_remove_store(st
10679 return strlen(buf);
10680 }
10681 static DEVICE_ATTR(disable_hotplug_remove, S_IRUGO | S_IWUSR,
10682 - mptscsih_disable_hotplug_remove_show, mptscsih_disable_hotplug_remove_store);
10683 + mptscsih_disable_hotplug_remove_show,
10684 + mptscsih_disable_hotplug_remove_store);
10685
10686 struct device_attribute *mptscsih_host_attrs[] = {
10687 &dev_attr_version_fw,
10688 Index: linux-2.6.27/drivers/message/fusion/mptscsih.h
10689 ===================================================================
10690 --- linux-2.6.27.orig/drivers/message/fusion/mptscsih.h
10691 +++ linux-2.6.27/drivers/message/fusion/mptscsih.h
10692 @@ -129,11 +129,13 @@ extern int mptscsih_scandv_complete(MPT_
10693 extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
10694 extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
10695 extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
10696 -extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout);
10697 +extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
10698 + u8 id, int lun, int ctx2abort, ulong timeout);
10699 extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
10700 extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
10701 extern int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
10702 extern struct device_attribute *mptscsih_host_attrs[];
10703 -extern int mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id);
10704 +extern int mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel,
10705 + u8 id);
10706 extern struct scsi_cmnd * mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i);
10707 extern void mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code);
10708 Index: linux-2.6.27/drivers/message/fusion/mptspi.c
10709 ===================================================================
10710 --- linux-2.6.27.orig/drivers/message/fusion/mptspi.c
10711 +++ linux-2.6.27/drivers/message/fusion/mptspi.c
10712 @@ -87,7 +87,8 @@ MODULE_PARM_DESC(mpt_saf_te, " Force ena
10713
10714 static int mpt_qas = MPTSCSIH_QAS;
10715 module_param(mpt_qas, int, 1);
10716 -MODULE_PARM_DESC(mpt_qas, " Quick Arbitration and Selection (QAS) enabled=1, disabled=0 (default=MPTSCSIH_QAS=1)");
10717 +MODULE_PARM_DESC(mpt_qas, " Quick Arbitration and Selection (QAS) enabled=1,"
10718 + " disabled= (default=MPTSCSIH_QAS=1)");
10719
10720 static void mptspi_write_offset(struct scsi_target *, int);
10721 static void mptspi_write_width(struct scsi_target *, int);
10722 @@ -240,7 +241,7 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST
10723 */
10724
10725 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10726 - "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id));
10727 + "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id));
10728 }
10729 }
10730
10731 @@ -314,7 +315,7 @@ mptspi_writeIOCPage4(MPT_SCSI_HOST *hd,
10732
10733 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10734 "writeIOCPage4: MaxSEP=%d ActiveSEP=%d id=%d bus=%d\n",
10735 - ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel));
10736 + ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel));
10737
10738 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);
10739
10740 @@ -495,7 +496,7 @@ mptspi_print_write_nego(struct _MPT_SCSI
10741 ii & MPI_SCSIDEVPAGE0_NP_WR_FLOW ? "WRFLOW ": "",
10742 ii & MPI_SCSIDEVPAGE0_NP_RD_STRM ? "RDSTRM ": "",
10743 ii & MPI_SCSIDEVPAGE0_NP_RTI ? "RTI ": "",
10744 - ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP ": "");
10745 + ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP " : "");
10746 }
10747
10748 /**
10749 @@ -523,7 +524,7 @@ mptspi_print_read_nego(struct _MPT_SCSI_
10750 ii & MPI_SCSIDEVPAGE0_NP_WR_FLOW ? "WRFLOW ": "",
10751 ii & MPI_SCSIDEVPAGE0_NP_RD_STRM ? "RDSTRM ": "",
10752 ii & MPI_SCSIDEVPAGE0_NP_RTI ? "RTI ": "",
10753 - ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP ": "");
10754 + ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP " : "");
10755 }
10756
10757 static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
10758 @@ -822,8 +823,8 @@ static int mptspi_write_spi_device_pg1(s
10759
10760 pg1 = dma_alloc_coherent(&ioc->pcidev->dev, size, &pg1_dma, GFP_KERNEL);
10761 if (pg1 == NULL) {
10762 - starget_printk(KERN_ERR, starget,
10763 - MYIOC_s_FMT "dma_alloc_coherent for parameters failed\n", ioc->name);
10764 + starget_printk(KERN_ERR, starget, MYIOC_s_FMT
10765 + "dma_alloc_coherent for parameters failed\n", ioc->name);
10766 return -EINVAL;
10767 }
10768
10769 @@ -1071,12 +1072,12 @@ mpt_work_wrapper(struct work_struct *wor
10770 if(vtarget->id != disk)
10771 continue;
10772
10773 - starget_printk(KERN_INFO, vtarget->starget,
10774 - MYIOC_s_FMT "Integrated RAID requests DV of new device\n", ioc->name);
10775 + starget_printk(KERN_INFO, vtarget->starget, MYIOC_s_FMT
10776 + "Integrated RAID requests DV of new device\n", ioc->name);
10777 mptspi_dv_device(hd, sdev);
10778 }
10779 - shost_printk(KERN_INFO, shost,
10780 - MYIOC_s_FMT "Integrated RAID detects new device %d\n", ioc->name, disk);
10781 + shost_printk(KERN_INFO, shost, MYIOC_s_FMT
10782 + "Integrated RAID detects new device %d\n", ioc->name, disk);
10783 scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1);
10784 }
10785
10786 @@ -1087,8 +1088,8 @@ static void mpt_dv_raid(struct _MPT_SCSI
10787 MPT_ADAPTER *ioc = hd->ioc;
10788
10789 if (!wqw) {
10790 - shost_printk(KERN_ERR, ioc->sh,
10791 - MYIOC_s_FMT "Failed to act on RAID event for physical disk %d\n",
10792 + shost_printk(KERN_ERR, ioc->sh, MYIOC_s_FMT
10793 + "Failed to act on RAID event for physical disk %d\n",
10794 ioc->name, disk);
10795 return;
10796 }
10797 Index: linux-2.6.27/drivers/message/fusion/rejected_ioctls/diag_buffer.c
10798 ===================================================================
10799 --- linux-2.6.27.orig/drivers/message/fusion/rejected_ioctls/diag_buffer.c
10800 +++ linux-2.6.27/drivers/message/fusion/rejected_ioctls/diag_buffer.c
10801 @@ -4,19 +4,20 @@
10802 * Outputs: None.
10803 * Return: 0 if successful
10804 * -EFAULT if data unavailable
10805 - * -EBUSY if previous command timout and IOC reset is not complete.
10806 + * -EBUSY if previous command timout and IOC reset is not
10807 + * complete.
10808 * -ENODEV if no such device/adapter
10809 * -ETIME if timer expires
10810 * -ENOMEM if memory allocation error
10811 */
10812 static int
10813 -mptctl_register_diag_buffer (unsigned long arg)
10814 +mptctl_register_diag_buffer(unsigned long arg)
10815 {
10816 mpt_diag_register_t __user *uarg = (void __user *) arg;
10817 mpt_diag_register_t karg;
10818 MPT_ADAPTER *ioc;
10819 int iocnum, rc, ii;
10820 - void * request_data;
10821 + void *request_data;
10822 dma_addr_t request_data_dma;
10823 u32 request_data_sz;
10824 MPT_FRAME_HDR *mf;
10825 @@ -30,37 +31,39 @@ mptctl_register_diag_buffer (unsigned lo
10826 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_register_t))) {
10827 printk(KERN_ERR "%s@%d::%s - "
10828 "Unable to read in mpt_diag_register_t struct @ %p\n",
10829 - __FILE__, __LINE__, __FUNCTION__, uarg);
10830 + __FILE__, __LINE__, __func__, uarg);
10831 return -EFAULT;
10832 }
10833
10834 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
10835 - (ioc == NULL)) {
10836 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
10837 +
10838 + if ((iocnum < 0) || (ioc == NULL)) {
10839 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
10840 - __FILE__, __FUNCTION__, __LINE__, iocnum);
10841 + __FILE__, __func__, __LINE__, iocnum);
10842 return -ENODEV;
10843 }
10844
10845 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
10846 - __FUNCTION__));
10847 + __func__));
10848 buffer_type = karg.data.BufferType;
10849 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
10850 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
10851 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
10852 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
10853 return -ENODEV;
10854 }
10855
10856 if (ioc->DiagBuffer_Status[buffer_type] &
10857 MPT_DIAG_BUFFER_IS_REGISTERED) {
10858 printk(MYIOC_s_DEBUG_FMT "%s: already has a Registered "
10859 - "buffer for buffer_type=%x\n", ioc->name, __FUNCTION__,
10860 + "buffer for buffer_type=%x\n", ioc->name, __func__,
10861 buffer_type);
10862 return -EFAULT;
10863 }
10864
10865 /* Get a free request frame and save the message context.
10866 */
10867 - if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL)
10868 + mf = mpt_get_msg_frame(mptctl_id, ioc);
10869 + if (mf == NULL)
10870 return -EAGAIN;
10871
10872 request_data = ioc->DiagBuffer[buffer_type];
10873 @@ -85,9 +88,9 @@ mptctl_register_diag_buffer (unsigned lo
10874 if (request_data == NULL) {
10875 printk(MYIOC_s_DEBUG_FMT "%s: pci_alloc_consistent"
10876 " FAILED, (request_sz=%d)\n", ioc->name,
10877 - __FUNCTION__, request_data_sz);
10878 + __func__, request_data_sz);
10879 mpt_free_msg_frame(ioc, mf);
10880 - return -EAGAIN;
10881 + return -EAGAIN;
10882 }
10883 ioc->DiagBuffer[buffer_type] = request_data;
10884 ioc->DiagBuffer_sz[buffer_type] = request_data_sz;
10885 @@ -95,7 +98,7 @@ mptctl_register_diag_buffer (unsigned lo
10886 }
10887
10888 ioc->DiagBuffer_Status[buffer_type] = 0;
10889 - diag_buffer_post_request = (DiagBufferPostRequest_t *)mf;
10890 + diag_buffer_post_request = (DiagBufferPostRequest_t *)mf;
10891 diag_buffer_post_request->Function = MPI_FUNCTION_DIAG_BUFFER_POST;
10892 diag_buffer_post_request->ChainOffset = 0;
10893 diag_buffer_post_request->BufferType = karg.data.BufferType;
10894 @@ -137,7 +140,7 @@ mptctl_register_diag_buffer (unsigned lo
10895 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10896 rc = -ETIME;
10897 printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name,
10898 - __FUNCTION__);
10899 + __func__);
10900 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
10901 mpt_free_msg_frame(ioc, mf);
10902 goto out;
10903 @@ -150,7 +153,7 @@ mptctl_register_diag_buffer (unsigned lo
10904 /* process the completed Reply Message Frame */
10905 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
10906 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: status=%x\n",
10907 - ioc->name, __FUNCTION__, ioc->ioctl_cmds.status));
10908 + ioc->name, __func__, ioc->ioctl_cmds.status));
10909 rc = -EFAULT;
10910 goto out;
10911 }
10912 @@ -160,12 +163,13 @@ mptctl_register_diag_buffer (unsigned lo
10913 MPI_IOCSTATUS_SUCCESS) {
10914 if (diag_buffer_post_reply->MsgLength > 5)
10915 ioc->DataSize[buffer_type] =
10916 - le32_to_cpu(diag_buffer_post_reply->TransferLength);
10917 + le32_to_cpu
10918 + (diag_buffer_post_reply->TransferLength);
10919 ioc->DiagBuffer_Status[buffer_type] |=
10920 MPT_DIAG_BUFFER_IS_REGISTERED;
10921 } else {
10922 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: IOCStatus=%x "
10923 - "IOCLogInfo=%x\n", ioc->name, __FUNCTION__,
10924 + "IOCLogInfo=%x\n", ioc->name, __func__,
10925 diag_buffer_post_reply->IOCStatus,
10926 diag_buffer_post_reply->IOCLogInfo));
10927 rc = -EFAULT;
10928 @@ -187,18 +191,19 @@ mptctl_register_diag_buffer (unsigned lo
10929 * Outputs: None.
10930 * Return: 0 if successful
10931 * -EFAULT if data unavailable
10932 - * -EBUSY if previous command timout and IOC reset is not complete.
10933 + * -EBUSY if previous command timout and IOC reset is
10934 + * not complete.
10935 * -ENODEV if no such device/adapter
10936 * -ETIME if timer expires
10937 * -ENOMEM if memory allocation error
10938 */
10939 static int
10940 -mptctl_release_diag_buffer (unsigned long arg)
10941 +mptctl_release_diag_buffer(unsigned long arg)
10942 {
10943 mpt_diag_release_t __user *uarg = (void __user *) arg;
10944 mpt_diag_release_t karg;
10945 MPT_ADAPTER *ioc;
10946 - void * request_data;
10947 + void *request_data;
10948 int iocnum, rc;
10949 MPT_FRAME_HDR *mf;
10950 DiagReleaseRequest_t *diag_release;
10951 @@ -210,42 +215,42 @@ mptctl_release_diag_buffer (unsigned lon
10952 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_release_t))) {
10953 printk(KERN_ERR "%s@%d::%s - "
10954 "Unable to read in mpt_diag_release_t struct @ %p\n",
10955 - __FILE__, __LINE__, __FUNCTION__, uarg);
10956 + __FILE__, __LINE__, __func__, uarg);
10957 return -EFAULT;
10958 }
10959
10960 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
10961 - (ioc == NULL)) {
10962 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
10963 + if ((iocnum < 0) || (ioc == NULL)) {
10964 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
10965 - __FILE__, __FUNCTION__, __LINE__, iocnum);
10966 + __FILE__, __func__, __LINE__, iocnum);
10967 return -ENODEV;
10968 }
10969
10970 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
10971 - __FUNCTION__));
10972 + __func__));
10973 buffer_type = karg.data.UniqueId & 0x000000ff;
10974 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
10975 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
10976 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
10977 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
10978 return -ENODEV;
10979 }
10980
10981 if ((ioc->DiagBuffer_Status[buffer_type] &
10982 - MPT_DIAG_BUFFER_IS_REGISTERED) == 0 ) {
10983 + MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
10984 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x is not "
10985 - "registered\n", ioc->name, __FUNCTION__, buffer_type);
10986 + "registered\n", ioc->name, __func__, buffer_type);
10987 return -EFAULT;
10988 }
10989
10990 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
10991 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not registered\n",
10992 - ioc->name, __FUNCTION__, karg.data.UniqueId);
10993 + ioc->name, __func__, karg.data.UniqueId);
10994 return -EFAULT;
10995 }
10996
10997 if (ioc->DiagBuffer_Status[buffer_type] & MPT_DIAG_BUFFER_IS_RELEASED) {
10998 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x "
10999 - "is already released\n", ioc->name, __FUNCTION__,
11000 + "is already released\n", ioc->name, __func__,
11001 buffer_type));
11002 return rc;
11003 }
11004 @@ -254,13 +259,14 @@ mptctl_release_diag_buffer (unsigned lon
11005
11006 if (request_data == NULL) {
11007 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11008 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11009 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11010 return -ENODEV;
11011 }
11012
11013 /* Get a free request frame and save the message context.
11014 */
11015 - if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL)
11016 + mf = mpt_get_msg_frame(mptctl_id, ioc);
11017 + if (mf == NULL)
11018 return -EAGAIN;
11019
11020 diag_release = (DiagReleaseRequest_t *)mf;
11021 @@ -281,7 +287,7 @@ mptctl_release_diag_buffer (unsigned lon
11022 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
11023 rc = -ETIME;
11024 printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name,
11025 - __FUNCTION__);
11026 + __func__);
11027 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
11028 mpt_free_msg_frame(ioc, mf);
11029 goto out;
11030 @@ -294,7 +300,7 @@ mptctl_release_diag_buffer (unsigned lon
11031 /* process the completed Reply Message Frame */
11032 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
11033 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: status=%x\n",
11034 - ioc->name, __FUNCTION__, ioc->ioctl_cmds.status));
11035 + ioc->name, __func__, ioc->ioctl_cmds.status));
11036 rc = -EFAULT;
11037 goto out;
11038 }
11039 @@ -304,7 +310,7 @@ mptctl_release_diag_buffer (unsigned lon
11040 MPI_IOCSTATUS_SUCCESS) {
11041 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: IOCStatus=%x "
11042 "IOCLogInfo=%x\n",
11043 - ioc->name, __FUNCTION__, diag_release_reply->IOCStatus,
11044 + ioc->name, __func__, diag_release_reply->IOCStatus,
11045 diag_release_reply->IOCLogInfo));
11046 rc = -EFAULT;
11047 } else
11048 @@ -324,19 +330,20 @@ mptctl_release_diag_buffer (unsigned lon
11049 * Outputs: None.
11050 * Return: 0 if successful
11051 * -EFAULT if data unavailable
11052 - * -EBUSY if previous command timout and IOC reset is not complete.
11053 + * -EBUSY if previous command timout and IOC reset is
11054 + * not complete.
11055 * -ENODEV if no such device/adapter
11056 * -ETIME if timer expires
11057 * -ENOMEM if memory allocation error
11058 */
11059 static int
11060 -mptctl_unregister_diag_buffer (unsigned long arg)
11061 +mptctl_unregister_diag_buffer(unsigned long arg)
11062 {
11063 mpt_diag_unregister_t __user *uarg = (void __user *) arg;
11064 mpt_diag_unregister_t karg;
11065 MPT_ADAPTER *ioc;
11066 int iocnum;
11067 - void * request_data;
11068 + void *request_data;
11069 dma_addr_t request_data_dma;
11070 u32 request_data_sz;
11071 u8 buffer_type;
11072 @@ -344,49 +351,48 @@ mptctl_unregister_diag_buffer (unsigned
11073 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_unregister_t))) {
11074 printk(KERN_ERR "%s@%d::%s - "
11075 "Unable to read in mpt_diag_unregister_t struct @ %p\n",
11076 - __FILE__, __LINE__, __FUNCTION__, uarg);
11077 + __FILE__, __LINE__, __func__, uarg);
11078 return -EFAULT;
11079 }
11080 -
11081 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
11082 - (ioc == NULL)) {
11083 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
11084 + if ((iocnum < 0) || (ioc == NULL)) {
11085 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
11086 - __FILE__, __FUNCTION__, __LINE__, iocnum);
11087 + __FILE__, __func__, __LINE__, iocnum);
11088 return -ENODEV;
11089 }
11090
11091 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
11092 - __FUNCTION__));
11093 + __func__));
11094 buffer_type = karg.data.UniqueId & 0x000000ff;
11095 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
11096 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
11097 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11098 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11099 return -ENODEV;
11100 }
11101
11102 if ((ioc->DiagBuffer_Status[buffer_type] &
11103 MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
11104 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x is not "
11105 - "registered\n", ioc->name, __FUNCTION__, buffer_type);
11106 + "registered\n", ioc->name, __func__, buffer_type);
11107 return -EFAULT;
11108 }
11109 if ((ioc->DiagBuffer_Status[buffer_type] &
11110 MPT_DIAG_BUFFER_IS_RELEASED) == 0) {
11111 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x has not been "
11112 - "released\n", ioc->name, __FUNCTION__, buffer_type);
11113 + "released\n", ioc->name, __func__, buffer_type);
11114 return -EFAULT;
11115 }
11116
11117 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
11118 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not registered\n",
11119 - ioc->name, __FUNCTION__, karg.data.UniqueId);
11120 + ioc->name, __func__, karg.data.UniqueId);
11121 return -EFAULT;
11122 }
11123
11124 request_data = ioc->DiagBuffer[buffer_type];
11125 if (!request_data) {
11126 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11127 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11128 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11129 return -ENODEV;
11130 }
11131
11132 @@ -405,18 +411,19 @@ mptctl_unregister_diag_buffer (unsigned
11133 * Outputs: None.
11134 * Return: 0 if successful
11135 * -EFAULT if data unavailable
11136 - * -EBUSY if previous command timout and IOC reset is not complete.
11137 + * -EBUSY if previous command timout and IOC reset
11138 + * is not complete.
11139 * -ENODEV if no such device/adapter
11140 * -ETIME if timer expires
11141 * -ENOMEM if memory allocation error
11142 */
11143 static int
11144 -mptctl_query_diag_buffer (unsigned long arg)
11145 +mptctl_query_diag_buffer(unsigned long arg)
11146 {
11147 mpt_diag_query_t __user *uarg = (void __user *)arg;
11148 mpt_diag_query_t karg;
11149 MPT_ADAPTER *ioc;
11150 - void * request_data;
11151 + void *request_data;
11152 int iocnum, ii, rc;
11153 u8 buffer_type;
11154
11155 @@ -424,38 +431,38 @@ mptctl_query_diag_buffer (unsigned long
11156 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_query_t))) {
11157 printk(KERN_ERR "%s@%d::%s - "
11158 "Unable to read in mpt_diag_query_t struct @ %p\n",
11159 - __FILE__, __LINE__, __FUNCTION__, uarg);
11160 + __FILE__, __LINE__, __func__, uarg);
11161 return -EFAULT;
11162 }
11163
11164 karg.data.Flags = 0;
11165 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
11166 - (ioc == NULL)) {
11167 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
11168 + if ((iocnum < 0) || (ioc == NULL)) {
11169 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
11170 - __FILE__, __FUNCTION__, __LINE__, iocnum);
11171 + __FILE__, __func__, __LINE__, iocnum);
11172 goto out;
11173 }
11174
11175 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
11176 - __FUNCTION__));
11177 + __func__));
11178 buffer_type = karg.data.BufferType;
11179 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
11180 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
11181 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11182 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11183 goto out;
11184 }
11185
11186 if ((ioc->DiagBuffer_Status[buffer_type] &
11187 - MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
11188 + MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
11189 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x is not "
11190 - "registered\n", ioc->name, __FUNCTION__, buffer_type);
11191 + "registered\n", ioc->name, __func__, buffer_type);
11192 goto out;
11193 }
11194
11195 if (karg.data.UniqueId & 0xffffff00) {
11196 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
11197 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not "
11198 - "registered\n", ioc->name, __FUNCTION__,
11199 + "registered\n", ioc->name, __func__,
11200 karg.data.UniqueId);
11201 goto out;
11202 }
11203 @@ -464,7 +471,7 @@ mptctl_query_diag_buffer (unsigned long
11204 request_data = ioc->DiagBuffer[buffer_type];
11205 if (!request_data) {
11206 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11207 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11208 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11209 goto out;
11210 }
11211
11212 @@ -490,7 +497,7 @@ mptctl_query_diag_buffer (unsigned long
11213 out:
11214 if (copy_to_user(uarg, &karg, sizeof(mpt_diag_query_t))) {
11215 printk(MYIOC_s_ERR_FMT "%s Unable to write mpt_diag_query_t "
11216 - "data @ %p\n", ioc->name, __FUNCTION__, uarg);
11217 + "data @ %p\n", ioc->name, __func__, uarg);
11218 return -EFAULT;
11219 }
11220 return rc;
11221 @@ -502,13 +509,14 @@ mptctl_query_diag_buffer (unsigned long
11222 * Outputs: None.
11223 * Return: 0 if successful
11224 * -EFAULT if data unavailable
11225 - * -EBUSY if previous command timout and IOC reset is not complete.
11226 + * -EBUSY if previous command timout and IOC reset
11227 + * is not complete.
11228 * -ENODEV if no such device/adapter
11229 * -ETIME if timer expires
11230 * -ENOMEM if memory allocation error
11231 */
11232 static int
11233 -mptctl_read_diag_buffer (unsigned long arg)
11234 +mptctl_read_diag_buffer(unsigned long arg)
11235 {
11236 mpt_diag_read_buffer_t __user *uarg = (void __user *) arg;
11237 mpt_diag_read_buffer_t karg;
11238 @@ -527,50 +535,49 @@ mptctl_read_diag_buffer (unsigned long a
11239 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_read_buffer_t))) {
11240 printk(KERN_ERR "%s@%d::%s - "
11241 "Unable to read in mpt_diag_read_buffer_t struct @ %p\n",
11242 - __FILE__, __LINE__, __FUNCTION__, uarg);
11243 + __FILE__, __LINE__, __func__, uarg);
11244 return -EFAULT;
11245 }
11246 -
11247 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
11248 - (ioc == NULL)) {
11249 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
11250 + if ((iocnum < 0) || (ioc == NULL)) {
11251 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
11252 - __FILE__, __FUNCTION__, __LINE__, iocnum);
11253 + __FILE__, __func__, __LINE__, iocnum);
11254 return -ENODEV;
11255 }
11256
11257 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
11258 - __FUNCTION__));
11259 + __func__));
11260 buffer_type = karg.data.UniqueId & 0x000000ff;
11261 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
11262 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability "
11263 - "for buffer_type=%x\n", ioc->name, __FUNCTION__,
11264 + "for buffer_type=%x\n", ioc->name, __func__,
11265 buffer_type);
11266 return -EFAULT;
11267 }
11268
11269 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
11270 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not registered\n",
11271 - ioc->name, __FUNCTION__, karg.data.UniqueId);
11272 + ioc->name, __func__, karg.data.UniqueId);
11273 return -EFAULT;
11274 }
11275
11276 request_data = ioc->DiagBuffer[buffer_type];
11277 if (!request_data) {
11278 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11279 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11280 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11281 return -EFAULT;
11282 }
11283
11284 diagData = (void *)(request_data + karg.data.StartingOffset);
11285 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: diagData=%p "
11286 - "request_data=%p StartingOffset=%x\n", ioc->name, __FUNCTION__,
11287 + "request_data=%p StartingOffset=%x\n", ioc->name, __func__,
11288 diagData, request_data, karg.data.StartingOffset));
11289
11290 if (copy_to_user((void __user *)&uarg->data.DiagnosticData[0],
11291 diagData, karg.data.BytesToRead)) {
11292 printk(MYIOC_s_ERR_FMT "%s: Unable to write "
11293 "mpt_diag_read_buffer_t data @ %p\n", ioc->name,
11294 - __FUNCTION__, diagData);
11295 + __func__, diagData);
11296 return -EFAULT;
11297 }
11298
11299 @@ -578,17 +585,18 @@ mptctl_read_diag_buffer (unsigned long a
11300 goto out;
11301
11302 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: Reregister "
11303 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type));
11304 + "buffer_type=%x\n", ioc->name, __func__, buffer_type));
11305 if ((ioc->DiagBuffer_Status[buffer_type] &
11306 - MPT_DIAG_BUFFER_IS_RELEASED) == 0) {
11307 + MPT_DIAG_BUFFER_IS_RELEASED) == 0) {
11308 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x "
11309 - "is still registered\n", ioc->name, __FUNCTION__,
11310 + "is still registered\n", ioc->name, __func__,
11311 buffer_type));
11312 return rc;
11313 }
11314 /* Get a free request frame and save the message context.
11315 */
11316 - if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL)
11317 + mf = mpt_get_msg_frame(mptctl_id, ioc);
11318 + if (mf == NULL)
11319 return -EAGAIN;
11320
11321 diag_buffer_post_request = (DiagBufferPostRequest_t *)mf;
11322 @@ -602,7 +610,7 @@ mptctl_read_diag_buffer (unsigned long a
11323 diag_buffer_post_request->Reserved2 = 0;
11324 diag_buffer_post_request->Reserved3 = 0;
11325 diag_buffer_post_request->BufferAddress.High = 0;
11326 - if ( buffer_type == MPI_DIAG_BUF_TYPE_EXTENDED )
11327 + if (buffer_type == MPI_DIAG_BUF_TYPE_EXTENDED)
11328 diag_buffer_post_request->ExtendedType =
11329 cpu_to_le32(ioc->ExtendedType[buffer_type]);
11330 diag_buffer_post_request->BufferLength =
11331 @@ -627,7 +635,7 @@ mptctl_read_diag_buffer (unsigned long a
11332 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
11333 rc = -ETIME;
11334 printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name,
11335 - __FUNCTION__);
11336 + __func__);
11337 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
11338 mpt_free_msg_frame(ioc, mf);
11339 goto out;
11340 @@ -640,7 +648,7 @@ mptctl_read_diag_buffer (unsigned long a
11341 /* process the completed Reply Message Frame */
11342 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
11343 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: status=%x\n",
11344 - ioc->name, __FUNCTION__, ioc->ioctl_cmds.status));
11345 + ioc->name, __func__, ioc->ioctl_cmds.status));
11346 rc = -EFAULT;
11347 }
11348
11349 @@ -654,7 +662,7 @@ mptctl_read_diag_buffer (unsigned long a
11350 MPT_DIAG_BUFFER_IS_REGISTERED;
11351 } else {
11352 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: IOCStatus=%x "
11353 - "IOCLogInfo=%x\n", ioc->name, __FUNCTION__,
11354 + "IOCLogInfo=%x\n", ioc->name, __func__,
11355 diag_buffer_post_reply->IOCStatus,
11356 diag_buffer_post_reply->IOCLogInfo));
11357 rc = -EFAULT;
11358 Index: linux-2.6.27/drivers/message/fusion/rejected_ioctls/diag_buffer.h
11359 ===================================================================
11360 --- linux-2.6.27.orig/drivers/message/fusion/rejected_ioctls/diag_buffer.h
11361 +++ linux-2.6.27/drivers/message/fusion/rejected_ioctls/diag_buffer.h
11362 @@ -1,8 +1,13 @@
11363 -#define MPTDIAGREGISTER _IOWR(MPT_MAGIC_NUMBER,26,mpt_diag_register_t)
11364 -#define MPTDIAGRELEASE _IOWR(MPT_MAGIC_NUMBER,27,mpt_diag_release_t)
11365 -#define MPTDIAGUNREGISTER _IOWR(MPT_MAGIC_NUMBER,28,mpt_diag_unregister_t)
11366 -#define MPTDIAGQUERY _IOWR(MPT_MAGIC_NUMBER,29,mpt_diag_query_t)
11367 -#define MPTDIAGREADBUFFER _IOWR(MPT_MAGIC_NUMBER,30,mpt_diag_read_buffer_t)
11368 +#define MPTDIAGREGISTER \
11369 + _IOWR(MPT_MAGIC_NUMBER, 26, mpt_diag_register_t)
11370 +#define MPTDIAGRELEASE \
11371 + _IOWR(MPT_MAGIC_NUMBER, 27, mpt_diag_release_t)
11372 +#define MPTDIAGUNREGISTER \
11373 + _IOWR(MPT_MAGIC_NUMBER, 28, mpt_diag_unregister_t)
11374 +#define MPTDIAGQUERY \
11375 + _IOWR(MPT_MAGIC_NUMBER, 29, mpt_diag_query_t)
11376 +#define MPTDIAGREADBUFFER \
11377 + _IOWR(MPT_MAGIC_NUMBER, 30, mpt_diag_read_buffer_t)
11378
11379 #define MPI_FW_DIAG_IOCTL (0x80646961)
11380 #define MPI_FW_DIAG_TYPE_REGISTER (0x00000001)
11381 @@ -25,7 +30,8 @@
11382 #define MPI_FW_DIAG_ERROR_NO_BUFFER (0x00000013)
11383 #define MPI_FW_DIAG_ERROR_ALREADY_RELEASED (0x00000014)
11384
11385 -#define MPT_DIAG_CAPABILITY(bufftype) (MPI_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER << bufftype)
11386 +#define MPT_DIAG_CAPABILITY(bufftype) \
11387 + (MPI_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER << bufftype)
11388
11389 #define MPT_DIAG_BUFFER_IS_REGISTERED 1
11390 #define MPT_DIAG_BUFFER_IS_RELEASED 2