diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-13 23:36:52 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-13 23:36:52 -0500 |
commit | 58a343f22e8ef987b90e34bbef7f1455e3bb5a15 (patch) | |
tree | fc811fb570639f2083df6d9191b6a8d7cff65352 /drivers/scsi | |
parent | 51c38f9bce274a1e8a90aa457fb433be738f7458 (diff) | |
parent | 3759fa9c55923f719ae944a3f8fbb029b36f759d (diff) |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/scsi')
50 files changed, 2227 insertions, 596 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 31c497542272..d9152d02088c 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -61,6 +61,7 @@ | |||
61 | Add support for embedded firmware error strings. | 61 | Add support for embedded firmware error strings. |
62 | 2.26.02.003 - Correctly handle single sgl's with use_sg=1. | 62 | 2.26.02.003 - Correctly handle single sgl's with use_sg=1. |
63 | 2.26.02.004 - Add support for 9550SX controllers. | 63 | 2.26.02.004 - Add support for 9550SX controllers. |
64 | 2.26.02.005 - Fix use_sg == 0 mapping on systems with 4GB or higher. | ||
64 | */ | 65 | */ |
65 | 66 | ||
66 | #include <linux/module.h> | 67 | #include <linux/module.h> |
@@ -84,7 +85,7 @@ | |||
84 | #include "3w-9xxx.h" | 85 | #include "3w-9xxx.h" |
85 | 86 | ||
86 | /* Globals */ | 87 | /* Globals */ |
87 | #define TW_DRIVER_VERSION "2.26.02.004" | 88 | #define TW_DRIVER_VERSION "2.26.02.005" |
88 | static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; | 89 | static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; |
89 | static unsigned int twa_device_extension_count; | 90 | static unsigned int twa_device_extension_count; |
90 | static int twa_major = -1; | 91 | static int twa_major = -1; |
@@ -1408,7 +1409,7 @@ static dma_addr_t twa_map_scsi_single_data(TW_Device_Extension *tw_dev, int requ | |||
1408 | dma_addr_t mapping; | 1409 | dma_addr_t mapping; |
1409 | struct scsi_cmnd *cmd = tw_dev->srb[request_id]; | 1410 | struct scsi_cmnd *cmd = tw_dev->srb[request_id]; |
1410 | struct pci_dev *pdev = tw_dev->tw_pci_dev; | 1411 | struct pci_dev *pdev = tw_dev->tw_pci_dev; |
1411 | int retval = 0; | 1412 | dma_addr_t retval = 0; |
1412 | 1413 | ||
1413 | if (cmd->request_bufflen == 0) { | 1414 | if (cmd->request_bufflen == 0) { |
1414 | retval = 0; | 1415 | retval = 0; |
@@ -1798,7 +1799,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, | |||
1798 | int i, sg_count; | 1799 | int i, sg_count; |
1799 | struct scsi_cmnd *srb = NULL; | 1800 | struct scsi_cmnd *srb = NULL; |
1800 | struct scatterlist *sglist = NULL; | 1801 | struct scatterlist *sglist = NULL; |
1801 | u32 buffaddr = 0x0; | 1802 | dma_addr_t buffaddr = 0x0; |
1802 | int retval = 1; | 1803 | int retval = 1; |
1803 | 1804 | ||
1804 | if (tw_dev->srb[request_id]) { | 1805 | if (tw_dev->srb[request_id]) { |
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 7139659dd952..a16f8ded8f1d 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -173,10 +173,10 @@ int aac_get_config_status(struct aac_dev *dev) | |||
173 | int status = 0; | 173 | int status = 0; |
174 | struct fib * fibptr; | 174 | struct fib * fibptr; |
175 | 175 | ||
176 | if (!(fibptr = fib_alloc(dev))) | 176 | if (!(fibptr = aac_fib_alloc(dev))) |
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | 178 | ||
179 | fib_init(fibptr); | 179 | aac_fib_init(fibptr); |
180 | { | 180 | { |
181 | struct aac_get_config_status *dinfo; | 181 | struct aac_get_config_status *dinfo; |
182 | dinfo = (struct aac_get_config_status *) fib_data(fibptr); | 182 | dinfo = (struct aac_get_config_status *) fib_data(fibptr); |
@@ -186,7 +186,7 @@ int aac_get_config_status(struct aac_dev *dev) | |||
186 | dinfo->count = cpu_to_le32(sizeof(((struct aac_get_config_status_resp *)NULL)->data)); | 186 | dinfo->count = cpu_to_le32(sizeof(((struct aac_get_config_status_resp *)NULL)->data)); |
187 | } | 187 | } |
188 | 188 | ||
189 | status = fib_send(ContainerCommand, | 189 | status = aac_fib_send(ContainerCommand, |
190 | fibptr, | 190 | fibptr, |
191 | sizeof (struct aac_get_config_status), | 191 | sizeof (struct aac_get_config_status), |
192 | FsaNormal, | 192 | FsaNormal, |
@@ -209,30 +209,30 @@ int aac_get_config_status(struct aac_dev *dev) | |||
209 | status = -EINVAL; | 209 | status = -EINVAL; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | fib_complete(fibptr); | 212 | aac_fib_complete(fibptr); |
213 | /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ | 213 | /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ |
214 | if (status >= 0) { | 214 | if (status >= 0) { |
215 | if (commit == 1) { | 215 | if (commit == 1) { |
216 | struct aac_commit_config * dinfo; | 216 | struct aac_commit_config * dinfo; |
217 | fib_init(fibptr); | 217 | aac_fib_init(fibptr); |
218 | dinfo = (struct aac_commit_config *) fib_data(fibptr); | 218 | dinfo = (struct aac_commit_config *) fib_data(fibptr); |
219 | 219 | ||
220 | dinfo->command = cpu_to_le32(VM_ContainerConfig); | 220 | dinfo->command = cpu_to_le32(VM_ContainerConfig); |
221 | dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); | 221 | dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); |
222 | 222 | ||
223 | status = fib_send(ContainerCommand, | 223 | status = aac_fib_send(ContainerCommand, |
224 | fibptr, | 224 | fibptr, |
225 | sizeof (struct aac_commit_config), | 225 | sizeof (struct aac_commit_config), |
226 | FsaNormal, | 226 | FsaNormal, |
227 | 1, 1, | 227 | 1, 1, |
228 | NULL, NULL); | 228 | NULL, NULL); |
229 | fib_complete(fibptr); | 229 | aac_fib_complete(fibptr); |
230 | } else if (commit == 0) { | 230 | } else if (commit == 0) { |
231 | printk(KERN_WARNING | 231 | printk(KERN_WARNING |
232 | "aac_get_config_status: Foreign device configurations are being ignored\n"); | 232 | "aac_get_config_status: Foreign device configurations are being ignored\n"); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | fib_free(fibptr); | 235 | aac_fib_free(fibptr); |
236 | return status; | 236 | return status; |
237 | } | 237 | } |
238 | 238 | ||
@@ -255,15 +255,15 @@ int aac_get_containers(struct aac_dev *dev) | |||
255 | 255 | ||
256 | instance = dev->scsi_host_ptr->unique_id; | 256 | instance = dev->scsi_host_ptr->unique_id; |
257 | 257 | ||
258 | if (!(fibptr = fib_alloc(dev))) | 258 | if (!(fibptr = aac_fib_alloc(dev))) |
259 | return -ENOMEM; | 259 | return -ENOMEM; |
260 | 260 | ||
261 | fib_init(fibptr); | 261 | aac_fib_init(fibptr); |
262 | dinfo = (struct aac_get_container_count *) fib_data(fibptr); | 262 | dinfo = (struct aac_get_container_count *) fib_data(fibptr); |
263 | dinfo->command = cpu_to_le32(VM_ContainerConfig); | 263 | dinfo->command = cpu_to_le32(VM_ContainerConfig); |
264 | dinfo->type = cpu_to_le32(CT_GET_CONTAINER_COUNT); | 264 | dinfo->type = cpu_to_le32(CT_GET_CONTAINER_COUNT); |
265 | 265 | ||
266 | status = fib_send(ContainerCommand, | 266 | status = aac_fib_send(ContainerCommand, |
267 | fibptr, | 267 | fibptr, |
268 | sizeof (struct aac_get_container_count), | 268 | sizeof (struct aac_get_container_count), |
269 | FsaNormal, | 269 | FsaNormal, |
@@ -272,7 +272,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
272 | if (status >= 0) { | 272 | if (status >= 0) { |
273 | dresp = (struct aac_get_container_count_resp *)fib_data(fibptr); | 273 | dresp = (struct aac_get_container_count_resp *)fib_data(fibptr); |
274 | maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); | 274 | maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); |
275 | fib_complete(fibptr); | 275 | aac_fib_complete(fibptr); |
276 | } | 276 | } |
277 | 277 | ||
278 | if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) | 278 | if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) |
@@ -280,7 +280,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
280 | fsa_dev_ptr = (struct fsa_dev_info *) kmalloc( | 280 | fsa_dev_ptr = (struct fsa_dev_info *) kmalloc( |
281 | sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); | 281 | sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); |
282 | if (!fsa_dev_ptr) { | 282 | if (!fsa_dev_ptr) { |
283 | fib_free(fibptr); | 283 | aac_fib_free(fibptr); |
284 | return -ENOMEM; | 284 | return -ENOMEM; |
285 | } | 285 | } |
286 | memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers); | 286 | memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers); |
@@ -294,14 +294,14 @@ int aac_get_containers(struct aac_dev *dev) | |||
294 | 294 | ||
295 | fsa_dev_ptr[index].devname[0] = '\0'; | 295 | fsa_dev_ptr[index].devname[0] = '\0'; |
296 | 296 | ||
297 | fib_init(fibptr); | 297 | aac_fib_init(fibptr); |
298 | dinfo = (struct aac_query_mount *) fib_data(fibptr); | 298 | dinfo = (struct aac_query_mount *) fib_data(fibptr); |
299 | 299 | ||
300 | dinfo->command = cpu_to_le32(VM_NameServe); | 300 | dinfo->command = cpu_to_le32(VM_NameServe); |
301 | dinfo->count = cpu_to_le32(index); | 301 | dinfo->count = cpu_to_le32(index); |
302 | dinfo->type = cpu_to_le32(FT_FILESYS); | 302 | dinfo->type = cpu_to_le32(FT_FILESYS); |
303 | 303 | ||
304 | status = fib_send(ContainerCommand, | 304 | status = aac_fib_send(ContainerCommand, |
305 | fibptr, | 305 | fibptr, |
306 | sizeof (struct aac_query_mount), | 306 | sizeof (struct aac_query_mount), |
307 | FsaNormal, | 307 | FsaNormal, |
@@ -319,7 +319,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
319 | dinfo->count = cpu_to_le32(index); | 319 | dinfo->count = cpu_to_le32(index); |
320 | dinfo->type = cpu_to_le32(FT_FILESYS); | 320 | dinfo->type = cpu_to_le32(FT_FILESYS); |
321 | 321 | ||
322 | if (fib_send(ContainerCommand, | 322 | if (aac_fib_send(ContainerCommand, |
323 | fibptr, | 323 | fibptr, |
324 | sizeof(struct aac_query_mount), | 324 | sizeof(struct aac_query_mount), |
325 | FsaNormal, | 325 | FsaNormal, |
@@ -347,7 +347,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
347 | if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) | 347 | if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) |
348 | fsa_dev_ptr[index].ro = 1; | 348 | fsa_dev_ptr[index].ro = 1; |
349 | } | 349 | } |
350 | fib_complete(fibptr); | 350 | aac_fib_complete(fibptr); |
351 | /* | 351 | /* |
352 | * If there are no more containers, then stop asking. | 352 | * If there are no more containers, then stop asking. |
353 | */ | 353 | */ |
@@ -355,7 +355,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
355 | break; | 355 | break; |
356 | } | 356 | } |
357 | } | 357 | } |
358 | fib_free(fibptr); | 358 | aac_fib_free(fibptr); |
359 | return status; | 359 | return status; |
360 | } | 360 | } |
361 | 361 | ||
@@ -413,8 +413,8 @@ static void get_container_name_callback(void *context, struct fib * fibptr) | |||
413 | 413 | ||
414 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; | 414 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; |
415 | 415 | ||
416 | fib_complete(fibptr); | 416 | aac_fib_complete(fibptr); |
417 | fib_free(fibptr); | 417 | aac_fib_free(fibptr); |
418 | scsicmd->scsi_done(scsicmd); | 418 | scsicmd->scsi_done(scsicmd); |
419 | } | 419 | } |
420 | 420 | ||
@@ -430,10 +430,10 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) | |||
430 | 430 | ||
431 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; | 431 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; |
432 | 432 | ||
433 | if (!(cmd_fibcontext = fib_alloc(dev))) | 433 | if (!(cmd_fibcontext = aac_fib_alloc(dev))) |
434 | return -ENOMEM; | 434 | return -ENOMEM; |
435 | 435 | ||
436 | fib_init(cmd_fibcontext); | 436 | aac_fib_init(cmd_fibcontext); |
437 | dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext); | 437 | dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext); |
438 | 438 | ||
439 | dinfo->command = cpu_to_le32(VM_ContainerConfig); | 439 | dinfo->command = cpu_to_le32(VM_ContainerConfig); |
@@ -441,7 +441,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) | |||
441 | dinfo->cid = cpu_to_le32(cid); | 441 | dinfo->cid = cpu_to_le32(cid); |
442 | dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); | 442 | dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); |
443 | 443 | ||
444 | status = fib_send(ContainerCommand, | 444 | status = aac_fib_send(ContainerCommand, |
445 | cmd_fibcontext, | 445 | cmd_fibcontext, |
446 | sizeof (struct aac_get_name), | 446 | sizeof (struct aac_get_name), |
447 | FsaNormal, | 447 | FsaNormal, |
@@ -455,14 +455,14 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) | |||
455 | if (status == -EINPROGRESS) | 455 | if (status == -EINPROGRESS) |
456 | return 0; | 456 | return 0; |
457 | 457 | ||
458 | printk(KERN_WARNING "aac_get_container_name: fib_send failed with status: %d.\n", status); | 458 | printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); |
459 | fib_complete(cmd_fibcontext); | 459 | aac_fib_complete(cmd_fibcontext); |
460 | fib_free(cmd_fibcontext); | 460 | aac_fib_free(cmd_fibcontext); |
461 | return -1; | 461 | return -1; |
462 | } | 462 | } |
463 | 463 | ||
464 | /** | 464 | /** |
465 | * probe_container - query a logical volume | 465 | * aac_probe_container - query a logical volume |
466 | * @dev: device to query | 466 | * @dev: device to query |
467 | * @cid: container identifier | 467 | * @cid: container identifier |
468 | * | 468 | * |
@@ -470,7 +470,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) | |||
470 | * is updated in the struct fsa_dev_info structure rather than returned. | 470 | * is updated in the struct fsa_dev_info structure rather than returned. |
471 | */ | 471 | */ |
472 | 472 | ||
473 | int probe_container(struct aac_dev *dev, int cid) | 473 | int aac_probe_container(struct aac_dev *dev, int cid) |
474 | { | 474 | { |
475 | struct fsa_dev_info *fsa_dev_ptr; | 475 | struct fsa_dev_info *fsa_dev_ptr; |
476 | int status; | 476 | int status; |
@@ -482,10 +482,10 @@ int probe_container(struct aac_dev *dev, int cid) | |||
482 | fsa_dev_ptr = dev->fsa_dev; | 482 | fsa_dev_ptr = dev->fsa_dev; |
483 | instance = dev->scsi_host_ptr->unique_id; | 483 | instance = dev->scsi_host_ptr->unique_id; |
484 | 484 | ||
485 | if (!(fibptr = fib_alloc(dev))) | 485 | if (!(fibptr = aac_fib_alloc(dev))) |
486 | return -ENOMEM; | 486 | return -ENOMEM; |
487 | 487 | ||
488 | fib_init(fibptr); | 488 | aac_fib_init(fibptr); |
489 | 489 | ||
490 | dinfo = (struct aac_query_mount *)fib_data(fibptr); | 490 | dinfo = (struct aac_query_mount *)fib_data(fibptr); |
491 | 491 | ||
@@ -493,14 +493,14 @@ int probe_container(struct aac_dev *dev, int cid) | |||
493 | dinfo->count = cpu_to_le32(cid); | 493 | dinfo->count = cpu_to_le32(cid); |
494 | dinfo->type = cpu_to_le32(FT_FILESYS); | 494 | dinfo->type = cpu_to_le32(FT_FILESYS); |
495 | 495 | ||
496 | status = fib_send(ContainerCommand, | 496 | status = aac_fib_send(ContainerCommand, |
497 | fibptr, | 497 | fibptr, |
498 | sizeof(struct aac_query_mount), | 498 | sizeof(struct aac_query_mount), |
499 | FsaNormal, | 499 | FsaNormal, |
500 | 1, 1, | 500 | 1, 1, |
501 | NULL, NULL); | 501 | NULL, NULL); |
502 | if (status < 0) { | 502 | if (status < 0) { |
503 | printk(KERN_WARNING "aacraid: probe_container query failed.\n"); | 503 | printk(KERN_WARNING "aacraid: aac_probe_container query failed.\n"); |
504 | goto error; | 504 | goto error; |
505 | } | 505 | } |
506 | 506 | ||
@@ -512,7 +512,7 @@ int probe_container(struct aac_dev *dev, int cid) | |||
512 | dinfo->count = cpu_to_le32(cid); | 512 | dinfo->count = cpu_to_le32(cid); |
513 | dinfo->type = cpu_to_le32(FT_FILESYS); | 513 | dinfo->type = cpu_to_le32(FT_FILESYS); |
514 | 514 | ||
515 | if (fib_send(ContainerCommand, | 515 | if (aac_fib_send(ContainerCommand, |
516 | fibptr, | 516 | fibptr, |
517 | sizeof(struct aac_query_mount), | 517 | sizeof(struct aac_query_mount), |
518 | FsaNormal, | 518 | FsaNormal, |
@@ -535,8 +535,8 @@ int probe_container(struct aac_dev *dev, int cid) | |||
535 | } | 535 | } |
536 | 536 | ||
537 | error: | 537 | error: |
538 | fib_complete(fibptr); | 538 | aac_fib_complete(fibptr); |
539 | fib_free(fibptr); | 539 | aac_fib_free(fibptr); |
540 | 540 | ||
541 | return status; | 541 | return status; |
542 | } | 542 | } |
@@ -700,14 +700,14 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
700 | struct aac_bus_info *command; | 700 | struct aac_bus_info *command; |
701 | struct aac_bus_info_response *bus_info; | 701 | struct aac_bus_info_response *bus_info; |
702 | 702 | ||
703 | if (!(fibptr = fib_alloc(dev))) | 703 | if (!(fibptr = aac_fib_alloc(dev))) |
704 | return -ENOMEM; | 704 | return -ENOMEM; |
705 | 705 | ||
706 | fib_init(fibptr); | 706 | aac_fib_init(fibptr); |
707 | info = (struct aac_adapter_info *) fib_data(fibptr); | 707 | info = (struct aac_adapter_info *) fib_data(fibptr); |
708 | memset(info,0,sizeof(*info)); | 708 | memset(info,0,sizeof(*info)); |
709 | 709 | ||
710 | rcode = fib_send(RequestAdapterInfo, | 710 | rcode = aac_fib_send(RequestAdapterInfo, |
711 | fibptr, | 711 | fibptr, |
712 | sizeof(*info), | 712 | sizeof(*info), |
713 | FsaNormal, | 713 | FsaNormal, |
@@ -716,8 +716,8 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
716 | NULL); | 716 | NULL); |
717 | 717 | ||
718 | if (rcode < 0) { | 718 | if (rcode < 0) { |
719 | fib_complete(fibptr); | 719 | aac_fib_complete(fibptr); |
720 | fib_free(fibptr); | 720 | aac_fib_free(fibptr); |
721 | return rcode; | 721 | return rcode; |
722 | } | 722 | } |
723 | memcpy(&dev->adapter_info, info, sizeof(*info)); | 723 | memcpy(&dev->adapter_info, info, sizeof(*info)); |
@@ -725,13 +725,13 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
725 | if (dev->adapter_info.options & AAC_OPT_SUPPLEMENT_ADAPTER_INFO) { | 725 | if (dev->adapter_info.options & AAC_OPT_SUPPLEMENT_ADAPTER_INFO) { |
726 | struct aac_supplement_adapter_info * info; | 726 | struct aac_supplement_adapter_info * info; |
727 | 727 | ||
728 | fib_init(fibptr); | 728 | aac_fib_init(fibptr); |
729 | 729 | ||
730 | info = (struct aac_supplement_adapter_info *) fib_data(fibptr); | 730 | info = (struct aac_supplement_adapter_info *) fib_data(fibptr); |
731 | 731 | ||
732 | memset(info,0,sizeof(*info)); | 732 | memset(info,0,sizeof(*info)); |
733 | 733 | ||
734 | rcode = fib_send(RequestSupplementAdapterInfo, | 734 | rcode = aac_fib_send(RequestSupplementAdapterInfo, |
735 | fibptr, | 735 | fibptr, |
736 | sizeof(*info), | 736 | sizeof(*info), |
737 | FsaNormal, | 737 | FsaNormal, |
@@ -748,7 +748,7 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
748 | * GetBusInfo | 748 | * GetBusInfo |
749 | */ | 749 | */ |
750 | 750 | ||
751 | fib_init(fibptr); | 751 | aac_fib_init(fibptr); |
752 | 752 | ||
753 | bus_info = (struct aac_bus_info_response *) fib_data(fibptr); | 753 | bus_info = (struct aac_bus_info_response *) fib_data(fibptr); |
754 | 754 | ||
@@ -761,7 +761,7 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
761 | command->MethodId = cpu_to_le32(1); | 761 | command->MethodId = cpu_to_le32(1); |
762 | command->CtlCmd = cpu_to_le32(GetBusInfo); | 762 | command->CtlCmd = cpu_to_le32(GetBusInfo); |
763 | 763 | ||
764 | rcode = fib_send(ContainerCommand, | 764 | rcode = aac_fib_send(ContainerCommand, |
765 | fibptr, | 765 | fibptr, |
766 | sizeof (*bus_info), | 766 | sizeof (*bus_info), |
767 | FsaNormal, | 767 | FsaNormal, |
@@ -891,8 +891,8 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
891 | } | 891 | } |
892 | } | 892 | } |
893 | 893 | ||
894 | fib_complete(fibptr); | 894 | aac_fib_complete(fibptr); |
895 | fib_free(fibptr); | 895 | aac_fib_free(fibptr); |
896 | 896 | ||
897 | return rcode; | 897 | return rcode; |
898 | } | 898 | } |
@@ -976,8 +976,8 @@ static void io_callback(void *context, struct fib * fibptr) | |||
976 | ? sizeof(scsicmd->sense_buffer) | 976 | ? sizeof(scsicmd->sense_buffer) |
977 | : sizeof(dev->fsa_dev[cid].sense_data)); | 977 | : sizeof(dev->fsa_dev[cid].sense_data)); |
978 | } | 978 | } |
979 | fib_complete(fibptr); | 979 | aac_fib_complete(fibptr); |
980 | fib_free(fibptr); | 980 | aac_fib_free(fibptr); |
981 | 981 | ||
982 | scsicmd->scsi_done(scsicmd); | 982 | scsicmd->scsi_done(scsicmd); |
983 | } | 983 | } |
@@ -1062,11 +1062,11 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1062 | /* | 1062 | /* |
1063 | * Alocate and initialize a Fib | 1063 | * Alocate and initialize a Fib |
1064 | */ | 1064 | */ |
1065 | if (!(cmd_fibcontext = fib_alloc(dev))) { | 1065 | if (!(cmd_fibcontext = aac_fib_alloc(dev))) { |
1066 | return -1; | 1066 | return -1; |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | fib_init(cmd_fibcontext); | 1069 | aac_fib_init(cmd_fibcontext); |
1070 | 1070 | ||
1071 | if (dev->raw_io_interface) { | 1071 | if (dev->raw_io_interface) { |
1072 | struct aac_raw_io *readcmd; | 1072 | struct aac_raw_io *readcmd; |
@@ -1086,7 +1086,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1086 | /* | 1086 | /* |
1087 | * Now send the Fib to the adapter | 1087 | * Now send the Fib to the adapter |
1088 | */ | 1088 | */ |
1089 | status = fib_send(ContainerRawIo, | 1089 | status = aac_fib_send(ContainerRawIo, |
1090 | cmd_fibcontext, | 1090 | cmd_fibcontext, |
1091 | fibsize, | 1091 | fibsize, |
1092 | FsaNormal, | 1092 | FsaNormal, |
@@ -1112,7 +1112,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1112 | /* | 1112 | /* |
1113 | * Now send the Fib to the adapter | 1113 | * Now send the Fib to the adapter |
1114 | */ | 1114 | */ |
1115 | status = fib_send(ContainerCommand64, | 1115 | status = aac_fib_send(ContainerCommand64, |
1116 | cmd_fibcontext, | 1116 | cmd_fibcontext, |
1117 | fibsize, | 1117 | fibsize, |
1118 | FsaNormal, | 1118 | FsaNormal, |
@@ -1136,7 +1136,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1136 | /* | 1136 | /* |
1137 | * Now send the Fib to the adapter | 1137 | * Now send the Fib to the adapter |
1138 | */ | 1138 | */ |
1139 | status = fib_send(ContainerCommand, | 1139 | status = aac_fib_send(ContainerCommand, |
1140 | cmd_fibcontext, | 1140 | cmd_fibcontext, |
1141 | fibsize, | 1141 | fibsize, |
1142 | FsaNormal, | 1142 | FsaNormal, |
@@ -1153,14 +1153,14 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1153 | if (status == -EINPROGRESS) | 1153 | if (status == -EINPROGRESS) |
1154 | return 0; | 1154 | return 0; |
1155 | 1155 | ||
1156 | printk(KERN_WARNING "aac_read: fib_send failed with status: %d.\n", status); | 1156 | printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); |
1157 | /* | 1157 | /* |
1158 | * For some reason, the Fib didn't queue, return QUEUE_FULL | 1158 | * For some reason, the Fib didn't queue, return QUEUE_FULL |
1159 | */ | 1159 | */ |
1160 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; | 1160 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; |
1161 | scsicmd->scsi_done(scsicmd); | 1161 | scsicmd->scsi_done(scsicmd); |
1162 | fib_complete(cmd_fibcontext); | 1162 | aac_fib_complete(cmd_fibcontext); |
1163 | fib_free(cmd_fibcontext); | 1163 | aac_fib_free(cmd_fibcontext); |
1164 | return 0; | 1164 | return 0; |
1165 | } | 1165 | } |
1166 | 1166 | ||
@@ -1228,12 +1228,12 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1228 | /* | 1228 | /* |
1229 | * Allocate and initialize a Fib then setup a BlockWrite command | 1229 | * Allocate and initialize a Fib then setup a BlockWrite command |
1230 | */ | 1230 | */ |
1231 | if (!(cmd_fibcontext = fib_alloc(dev))) { | 1231 | if (!(cmd_fibcontext = aac_fib_alloc(dev))) { |
1232 | scsicmd->result = DID_ERROR << 16; | 1232 | scsicmd->result = DID_ERROR << 16; |
1233 | scsicmd->scsi_done(scsicmd); | 1233 | scsicmd->scsi_done(scsicmd); |
1234 | return 0; | 1234 | return 0; |
1235 | } | 1235 | } |
1236 | fib_init(cmd_fibcontext); | 1236 | aac_fib_init(cmd_fibcontext); |
1237 | 1237 | ||
1238 | if (dev->raw_io_interface) { | 1238 | if (dev->raw_io_interface) { |
1239 | struct aac_raw_io *writecmd; | 1239 | struct aac_raw_io *writecmd; |
@@ -1253,7 +1253,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1253 | /* | 1253 | /* |
1254 | * Now send the Fib to the adapter | 1254 | * Now send the Fib to the adapter |
1255 | */ | 1255 | */ |
1256 | status = fib_send(ContainerRawIo, | 1256 | status = aac_fib_send(ContainerRawIo, |
1257 | cmd_fibcontext, | 1257 | cmd_fibcontext, |
1258 | fibsize, | 1258 | fibsize, |
1259 | FsaNormal, | 1259 | FsaNormal, |
@@ -1279,7 +1279,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1279 | /* | 1279 | /* |
1280 | * Now send the Fib to the adapter | 1280 | * Now send the Fib to the adapter |
1281 | */ | 1281 | */ |
1282 | status = fib_send(ContainerCommand64, | 1282 | status = aac_fib_send(ContainerCommand64, |
1283 | cmd_fibcontext, | 1283 | cmd_fibcontext, |
1284 | fibsize, | 1284 | fibsize, |
1285 | FsaNormal, | 1285 | FsaNormal, |
@@ -1305,7 +1305,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1305 | /* | 1305 | /* |
1306 | * Now send the Fib to the adapter | 1306 | * Now send the Fib to the adapter |
1307 | */ | 1307 | */ |
1308 | status = fib_send(ContainerCommand, | 1308 | status = aac_fib_send(ContainerCommand, |
1309 | cmd_fibcontext, | 1309 | cmd_fibcontext, |
1310 | fibsize, | 1310 | fibsize, |
1311 | FsaNormal, | 1311 | FsaNormal, |
@@ -1322,15 +1322,15 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1322 | return 0; | 1322 | return 0; |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | printk(KERN_WARNING "aac_write: fib_send failed with status: %d\n", status); | 1325 | printk(KERN_WARNING "aac_write: aac_fib_send failed with status: %d\n", status); |
1326 | /* | 1326 | /* |
1327 | * For some reason, the Fib didn't queue, return QUEUE_FULL | 1327 | * For some reason, the Fib didn't queue, return QUEUE_FULL |
1328 | */ | 1328 | */ |
1329 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; | 1329 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; |
1330 | scsicmd->scsi_done(scsicmd); | 1330 | scsicmd->scsi_done(scsicmd); |
1331 | 1331 | ||
1332 | fib_complete(cmd_fibcontext); | 1332 | aac_fib_complete(cmd_fibcontext); |
1333 | fib_free(cmd_fibcontext); | 1333 | aac_fib_free(cmd_fibcontext); |
1334 | return 0; | 1334 | return 0; |
1335 | } | 1335 | } |
1336 | 1336 | ||
@@ -1369,8 +1369,8 @@ static void synchronize_callback(void *context, struct fib *fibptr) | |||
1369 | sizeof(cmd->sense_buffer))); | 1369 | sizeof(cmd->sense_buffer))); |
1370 | } | 1370 | } |
1371 | 1371 | ||
1372 | fib_complete(fibptr); | 1372 | aac_fib_complete(fibptr); |
1373 | fib_free(fibptr); | 1373 | aac_fib_free(fibptr); |
1374 | cmd->scsi_done(cmd); | 1374 | cmd->scsi_done(cmd); |
1375 | } | 1375 | } |
1376 | 1376 | ||
@@ -1407,10 +1407,10 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) | |||
1407 | * Allocate and initialize a Fib | 1407 | * Allocate and initialize a Fib |
1408 | */ | 1408 | */ |
1409 | if (!(cmd_fibcontext = | 1409 | if (!(cmd_fibcontext = |
1410 | fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) | 1410 | aac_fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) |
1411 | return SCSI_MLQUEUE_HOST_BUSY; | 1411 | return SCSI_MLQUEUE_HOST_BUSY; |
1412 | 1412 | ||
1413 | fib_init(cmd_fibcontext); | 1413 | aac_fib_init(cmd_fibcontext); |
1414 | 1414 | ||
1415 | synchronizecmd = fib_data(cmd_fibcontext); | 1415 | synchronizecmd = fib_data(cmd_fibcontext); |
1416 | synchronizecmd->command = cpu_to_le32(VM_ContainerConfig); | 1416 | synchronizecmd->command = cpu_to_le32(VM_ContainerConfig); |
@@ -1422,7 +1422,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) | |||
1422 | /* | 1422 | /* |
1423 | * Now send the Fib to the adapter | 1423 | * Now send the Fib to the adapter |
1424 | */ | 1424 | */ |
1425 | status = fib_send(ContainerCommand, | 1425 | status = aac_fib_send(ContainerCommand, |
1426 | cmd_fibcontext, | 1426 | cmd_fibcontext, |
1427 | sizeof(struct aac_synchronize), | 1427 | sizeof(struct aac_synchronize), |
1428 | FsaNormal, | 1428 | FsaNormal, |
@@ -1437,9 +1437,9 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) | |||
1437 | return 0; | 1437 | return 0; |
1438 | 1438 | ||
1439 | printk(KERN_WARNING | 1439 | printk(KERN_WARNING |
1440 | "aac_synchronize: fib_send failed with status: %d.\n", status); | 1440 | "aac_synchronize: aac_fib_send failed with status: %d.\n", status); |
1441 | fib_complete(cmd_fibcontext); | 1441 | aac_fib_complete(cmd_fibcontext); |
1442 | fib_free(cmd_fibcontext); | 1442 | aac_fib_free(cmd_fibcontext); |
1443 | return SCSI_MLQUEUE_HOST_BUSY; | 1443 | return SCSI_MLQUEUE_HOST_BUSY; |
1444 | } | 1444 | } |
1445 | 1445 | ||
@@ -1465,7 +1465,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1465 | * itself. | 1465 | * itself. |
1466 | */ | 1466 | */ |
1467 | if (scmd_id(scsicmd) != host->this_id) { | 1467 | if (scmd_id(scsicmd) != host->this_id) { |
1468 | if ((scsicmd->device->channel == 0) ){ | 1468 | if ((scsicmd->device->channel == CONTAINER_CHANNEL)) { |
1469 | if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ | 1469 | if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ |
1470 | scsicmd->result = DID_NO_CONNECT << 16; | 1470 | scsicmd->result = DID_NO_CONNECT << 16; |
1471 | scsicmd->scsi_done(scsicmd); | 1471 | scsicmd->scsi_done(scsicmd); |
@@ -1488,7 +1488,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1488 | case READ_CAPACITY: | 1488 | case READ_CAPACITY: |
1489 | case TEST_UNIT_READY: | 1489 | case TEST_UNIT_READY: |
1490 | spin_unlock_irq(host->host_lock); | 1490 | spin_unlock_irq(host->host_lock); |
1491 | probe_container(dev, cid); | 1491 | aac_probe_container(dev, cid); |
1492 | if ((fsa_dev_ptr[cid].valid & 1) == 0) | 1492 | if ((fsa_dev_ptr[cid].valid & 1) == 0) |
1493 | fsa_dev_ptr[cid].valid = 0; | 1493 | fsa_dev_ptr[cid].valid = 0; |
1494 | spin_lock_irq(host->host_lock); | 1494 | spin_lock_irq(host->host_lock); |
@@ -1935,33 +1935,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
1935 | case SRB_STATUS_ERROR_RECOVERY: | 1935 | case SRB_STATUS_ERROR_RECOVERY: |
1936 | case SRB_STATUS_PENDING: | 1936 | case SRB_STATUS_PENDING: |
1937 | case SRB_STATUS_SUCCESS: | 1937 | case SRB_STATUS_SUCCESS: |
1938 | if(scsicmd->cmnd[0] == INQUIRY ){ | 1938 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; |
1939 | u8 b; | ||
1940 | u8 b1; | ||
1941 | /* We can't expose disk devices because we can't tell whether they | ||
1942 | * are the raw container drives or stand alone drives. If they have | ||
1943 | * the removable bit set then we should expose them though. | ||
1944 | */ | ||
1945 | b = (*(u8*)scsicmd->buffer)&0x1f; | ||
1946 | b1 = ((u8*)scsicmd->buffer)[1]; | ||
1947 | if( b==TYPE_TAPE || b==TYPE_WORM || b==TYPE_ROM || b==TYPE_MOD|| b==TYPE_MEDIUM_CHANGER | ||
1948 | || (b==TYPE_DISK && (b1&0x80)) ){ | ||
1949 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; | ||
1950 | /* | ||
1951 | * We will allow disk devices if in RAID/SCSI mode and | ||
1952 | * the channel is 2 | ||
1953 | */ | ||
1954 | } else if ((dev->raid_scsi_mode) && | ||
1955 | (scmd_channel(scsicmd) == 2)) { | ||
1956 | scsicmd->result = DID_OK << 16 | | ||
1957 | COMMAND_COMPLETE << 8; | ||
1958 | } else { | ||
1959 | scsicmd->result = DID_NO_CONNECT << 16 | | ||
1960 | COMMAND_COMPLETE << 8; | ||
1961 | } | ||
1962 | } else { | ||
1963 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; | ||
1964 | } | ||
1965 | break; | 1939 | break; |
1966 | case SRB_STATUS_DATA_OVERRUN: | 1940 | case SRB_STATUS_DATA_OVERRUN: |
1967 | switch(scsicmd->cmnd[0]){ | 1941 | switch(scsicmd->cmnd[0]){ |
@@ -1981,28 +1955,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
1981 | scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; | 1955 | scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; |
1982 | break; | 1956 | break; |
1983 | case INQUIRY: { | 1957 | case INQUIRY: { |
1984 | u8 b; | 1958 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; |
1985 | u8 b1; | ||
1986 | /* We can't expose disk devices because we can't tell whether they | ||
1987 | * are the raw container drives or stand alone drives | ||
1988 | */ | ||
1989 | b = (*(u8*)scsicmd->buffer)&0x0f; | ||
1990 | b1 = ((u8*)scsicmd->buffer)[1]; | ||
1991 | if( b==TYPE_TAPE || b==TYPE_WORM || b==TYPE_ROM || b==TYPE_MOD|| b==TYPE_MEDIUM_CHANGER | ||
1992 | || (b==TYPE_DISK && (b1&0x80)) ){ | ||
1993 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; | ||
1994 | /* | ||
1995 | * We will allow disk devices if in RAID/SCSI mode and | ||
1996 | * the channel is 2 | ||
1997 | */ | ||
1998 | } else if ((dev->raid_scsi_mode) && | ||
1999 | (scmd_channel(scsicmd) == 2)) { | ||
2000 | scsicmd->result = DID_OK << 16 | | ||
2001 | COMMAND_COMPLETE << 8; | ||
2002 | } else { | ||
2003 | scsicmd->result = DID_NO_CONNECT << 16 | | ||
2004 | COMMAND_COMPLETE << 8; | ||
2005 | } | ||
2006 | break; | 1959 | break; |
2007 | } | 1960 | } |
2008 | default: | 1961 | default: |
@@ -2089,8 +2042,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2089 | */ | 2042 | */ |
2090 | scsicmd->result |= le32_to_cpu(srbreply->scsi_status); | 2043 | scsicmd->result |= le32_to_cpu(srbreply->scsi_status); |
2091 | 2044 | ||
2092 | fib_complete(fibptr); | 2045 | aac_fib_complete(fibptr); |
2093 | fib_free(fibptr); | 2046 | aac_fib_free(fibptr); |
2094 | scsicmd->scsi_done(scsicmd); | 2047 | scsicmd->scsi_done(scsicmd); |
2095 | } | 2048 | } |
2096 | 2049 | ||
@@ -2142,10 +2095,10 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2142 | /* | 2095 | /* |
2143 | * Allocate and initialize a Fib then setup a BlockWrite command | 2096 | * Allocate and initialize a Fib then setup a BlockWrite command |
2144 | */ | 2097 | */ |
2145 | if (!(cmd_fibcontext = fib_alloc(dev))) { | 2098 | if (!(cmd_fibcontext = aac_fib_alloc(dev))) { |
2146 | return -1; | 2099 | return -1; |
2147 | } | 2100 | } |
2148 | fib_init(cmd_fibcontext); | 2101 | aac_fib_init(cmd_fibcontext); |
2149 | 2102 | ||
2150 | srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); | 2103 | srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); |
2151 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); | 2104 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); |
@@ -2179,7 +2132,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2179 | /* | 2132 | /* |
2180 | * Now send the Fib to the adapter | 2133 | * Now send the Fib to the adapter |
2181 | */ | 2134 | */ |
2182 | status = fib_send(ScsiPortCommand64, cmd_fibcontext, | 2135 | status = aac_fib_send(ScsiPortCommand64, cmd_fibcontext, |
2183 | fibsize, FsaNormal, 0, 1, | 2136 | fibsize, FsaNormal, 0, 1, |
2184 | (fib_callback) aac_srb_callback, | 2137 | (fib_callback) aac_srb_callback, |
2185 | (void *) scsicmd); | 2138 | (void *) scsicmd); |
@@ -2201,7 +2154,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2201 | /* | 2154 | /* |
2202 | * Now send the Fib to the adapter | 2155 | * Now send the Fib to the adapter |
2203 | */ | 2156 | */ |
2204 | status = fib_send(ScsiPortCommand, cmd_fibcontext, fibsize, FsaNormal, 0, 1, | 2157 | status = aac_fib_send(ScsiPortCommand, cmd_fibcontext, fibsize, FsaNormal, 0, 1, |
2205 | (fib_callback) aac_srb_callback, (void *) scsicmd); | 2158 | (fib_callback) aac_srb_callback, (void *) scsicmd); |
2206 | } | 2159 | } |
2207 | /* | 2160 | /* |
@@ -2211,9 +2164,9 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2211 | return 0; | 2164 | return 0; |
2212 | } | 2165 | } |
2213 | 2166 | ||
2214 | printk(KERN_WARNING "aac_srb: fib_send failed with status: %d\n", status); | 2167 | printk(KERN_WARNING "aac_srb: aac_fib_send failed with status: %d\n", status); |
2215 | fib_complete(cmd_fibcontext); | 2168 | aac_fib_complete(cmd_fibcontext); |
2216 | fib_free(cmd_fibcontext); | 2169 | aac_fib_free(cmd_fibcontext); |
2217 | 2170 | ||
2218 | return -1; | 2171 | return -1; |
2219 | } | 2172 | } |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 66dbb6d2c506..2d430b7e8cf4 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1774,16 +1774,16 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor) | |||
1774 | struct scsi_cmnd; | 1774 | struct scsi_cmnd; |
1775 | 1775 | ||
1776 | const char *aac_driverinfo(struct Scsi_Host *); | 1776 | const char *aac_driverinfo(struct Scsi_Host *); |
1777 | struct fib *fib_alloc(struct aac_dev *dev); | 1777 | struct fib *aac_fib_alloc(struct aac_dev *dev); |
1778 | int fib_setup(struct aac_dev *dev); | 1778 | int aac_fib_setup(struct aac_dev *dev); |
1779 | void fib_map_free(struct aac_dev *dev); | 1779 | void aac_fib_map_free(struct aac_dev *dev); |
1780 | void fib_free(struct fib * context); | 1780 | void aac_fib_free(struct fib * context); |
1781 | void fib_init(struct fib * context); | 1781 | void aac_fib_init(struct fib * context); |
1782 | void aac_printf(struct aac_dev *dev, u32 val); | 1782 | void aac_printf(struct aac_dev *dev, u32 val); |
1783 | int fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt); | 1783 | int aac_fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt); |
1784 | int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry); | 1784 | int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry); |
1785 | void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum); | 1785 | void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum); |
1786 | int fib_complete(struct fib * context); | 1786 | int aac_fib_complete(struct fib * context); |
1787 | #define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data) | 1787 | #define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data) |
1788 | struct aac_dev *aac_init_adapter(struct aac_dev *dev); | 1788 | struct aac_dev *aac_init_adapter(struct aac_dev *dev); |
1789 | int aac_get_config_status(struct aac_dev *dev); | 1789 | int aac_get_config_status(struct aac_dev *dev); |
@@ -1799,11 +1799,11 @@ unsigned int aac_command_normal(struct aac_queue * q); | |||
1799 | unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index); | 1799 | unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index); |
1800 | int aac_command_thread(struct aac_dev * dev); | 1800 | int aac_command_thread(struct aac_dev * dev); |
1801 | int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx); | 1801 | int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx); |
1802 | int fib_adapter_complete(struct fib * fibptr, unsigned short size); | 1802 | int aac_fib_adapter_complete(struct fib * fibptr, unsigned short size); |
1803 | struct aac_driver_ident* aac_get_driver_ident(int devtype); | 1803 | struct aac_driver_ident* aac_get_driver_ident(int devtype); |
1804 | int aac_get_adapter_info(struct aac_dev* dev); | 1804 | int aac_get_adapter_info(struct aac_dev* dev); |
1805 | int aac_send_shutdown(struct aac_dev *dev); | 1805 | int aac_send_shutdown(struct aac_dev *dev); |
1806 | int probe_container(struct aac_dev *dev, int cid); | 1806 | int aac_probe_container(struct aac_dev *dev, int cid); |
1807 | extern int numacb; | 1807 | extern int numacb; |
1808 | extern int acbsize; | 1808 | extern int acbsize; |
1809 | extern char aac_driver_version[]; | 1809 | extern char aac_driver_version[]; |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 4fe79cd7c957..47fefca72695 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -63,7 +63,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
63 | unsigned size; | 63 | unsigned size; |
64 | int retval; | 64 | int retval; |
65 | 65 | ||
66 | fibptr = fib_alloc(dev); | 66 | fibptr = aac_fib_alloc(dev); |
67 | if(fibptr == NULL) { | 67 | if(fibptr == NULL) { |
68 | return -ENOMEM; | 68 | return -ENOMEM; |
69 | } | 69 | } |
@@ -73,7 +73,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
73 | * First copy in the header so that we can check the size field. | 73 | * First copy in the header so that we can check the size field. |
74 | */ | 74 | */ |
75 | if (copy_from_user((void *)kfib, arg, sizeof(struct aac_fibhdr))) { | 75 | if (copy_from_user((void *)kfib, arg, sizeof(struct aac_fibhdr))) { |
76 | fib_free(fibptr); | 76 | aac_fib_free(fibptr); |
77 | return -EFAULT; | 77 | return -EFAULT; |
78 | } | 78 | } |
79 | /* | 79 | /* |
@@ -110,13 +110,13 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
110 | */ | 110 | */ |
111 | kfib->header.XferState = 0; | 111 | kfib->header.XferState = 0; |
112 | } else { | 112 | } else { |
113 | retval = fib_send(le16_to_cpu(kfib->header.Command), fibptr, | 113 | retval = aac_fib_send(le16_to_cpu(kfib->header.Command), fibptr, |
114 | le16_to_cpu(kfib->header.Size) , FsaNormal, | 114 | le16_to_cpu(kfib->header.Size) , FsaNormal, |
115 | 1, 1, NULL, NULL); | 115 | 1, 1, NULL, NULL); |
116 | if (retval) { | 116 | if (retval) { |
117 | goto cleanup; | 117 | goto cleanup; |
118 | } | 118 | } |
119 | if (fib_complete(fibptr) != 0) { | 119 | if (aac_fib_complete(fibptr) != 0) { |
120 | retval = -EINVAL; | 120 | retval = -EINVAL; |
121 | goto cleanup; | 121 | goto cleanup; |
122 | } | 122 | } |
@@ -138,7 +138,7 @@ cleanup: | |||
138 | fibptr->hw_fib_pa = hw_fib_pa; | 138 | fibptr->hw_fib_pa = hw_fib_pa; |
139 | fibptr->hw_fib = hw_fib; | 139 | fibptr->hw_fib = hw_fib; |
140 | } | 140 | } |
141 | fib_free(fibptr); | 141 | aac_fib_free(fibptr); |
142 | return retval; | 142 | return retval; |
143 | } | 143 | } |
144 | 144 | ||
@@ -464,10 +464,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
464 | /* | 464 | /* |
465 | * Allocate and initialize a Fib then setup a BlockWrite command | 465 | * Allocate and initialize a Fib then setup a BlockWrite command |
466 | */ | 466 | */ |
467 | if (!(srbfib = fib_alloc(dev))) { | 467 | if (!(srbfib = aac_fib_alloc(dev))) { |
468 | return -ENOMEM; | 468 | return -ENOMEM; |
469 | } | 469 | } |
470 | fib_init(srbfib); | 470 | aac_fib_init(srbfib); |
471 | 471 | ||
472 | srbcmd = (struct aac_srb*) fib_data(srbfib); | 472 | srbcmd = (struct aac_srb*) fib_data(srbfib); |
473 | 473 | ||
@@ -601,7 +601,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
601 | 601 | ||
602 | srbcmd->count = cpu_to_le32(byte_count); | 602 | srbcmd->count = cpu_to_le32(byte_count); |
603 | psg->count = cpu_to_le32(sg_indx+1); | 603 | psg->count = cpu_to_le32(sg_indx+1); |
604 | status = fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL); | 604 | status = aac_fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL); |
605 | } else { | 605 | } else { |
606 | struct user_sgmap* upsg = &user_srbcmd->sg; | 606 | struct user_sgmap* upsg = &user_srbcmd->sg; |
607 | struct sgmap* psg = &srbcmd->sg; | 607 | struct sgmap* psg = &srbcmd->sg; |
@@ -649,7 +649,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
649 | } | 649 | } |
650 | srbcmd->count = cpu_to_le32(byte_count); | 650 | srbcmd->count = cpu_to_le32(byte_count); |
651 | psg->count = cpu_to_le32(sg_indx+1); | 651 | psg->count = cpu_to_le32(sg_indx+1); |
652 | status = fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL); | 652 | status = aac_fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL); |
653 | } | 653 | } |
654 | 654 | ||
655 | if (status != 0){ | 655 | if (status != 0){ |
@@ -684,8 +684,8 @@ cleanup: | |||
684 | for(i=0; i <= sg_indx; i++){ | 684 | for(i=0; i <= sg_indx; i++){ |
685 | kfree(sg_list[i]); | 685 | kfree(sg_list[i]); |
686 | } | 686 | } |
687 | fib_complete(srbfib); | 687 | aac_fib_complete(srbfib); |
688 | fib_free(srbfib); | 688 | aac_fib_free(srbfib); |
689 | 689 | ||
690 | return rcode; | 690 | return rcode; |
691 | } | 691 | } |
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 82821d331c07..1628d094943d 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -185,17 +185,17 @@ int aac_send_shutdown(struct aac_dev * dev) | |||
185 | struct aac_close *cmd; | 185 | struct aac_close *cmd; |
186 | int status; | 186 | int status; |
187 | 187 | ||
188 | fibctx = fib_alloc(dev); | 188 | fibctx = aac_fib_alloc(dev); |
189 | if (!fibctx) | 189 | if (!fibctx) |
190 | return -ENOMEM; | 190 | return -ENOMEM; |
191 | fib_init(fibctx); | 191 | aac_fib_init(fibctx); |
192 | 192 | ||
193 | cmd = (struct aac_close *) fib_data(fibctx); | 193 | cmd = (struct aac_close *) fib_data(fibctx); |
194 | 194 | ||
195 | cmd->command = cpu_to_le32(VM_CloseAll); | 195 | cmd->command = cpu_to_le32(VM_CloseAll); |
196 | cmd->cid = cpu_to_le32(0xffffffff); | 196 | cmd->cid = cpu_to_le32(0xffffffff); |
197 | 197 | ||
198 | status = fib_send(ContainerCommand, | 198 | status = aac_fib_send(ContainerCommand, |
199 | fibctx, | 199 | fibctx, |
200 | sizeof(struct aac_close), | 200 | sizeof(struct aac_close), |
201 | FsaNormal, | 201 | FsaNormal, |
@@ -203,8 +203,8 @@ int aac_send_shutdown(struct aac_dev * dev) | |||
203 | NULL, NULL); | 203 | NULL, NULL); |
204 | 204 | ||
205 | if (status == 0) | 205 | if (status == 0) |
206 | fib_complete(fibctx); | 206 | aac_fib_complete(fibctx); |
207 | fib_free(fibctx); | 207 | aac_fib_free(fibctx); |
208 | return status; | 208 | return status; |
209 | } | 209 | } |
210 | 210 | ||
@@ -427,7 +427,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) | |||
427 | /* | 427 | /* |
428 | * Initialize the list of fibs | 428 | * Initialize the list of fibs |
429 | */ | 429 | */ |
430 | if(fib_setup(dev)<0){ | 430 | if (aac_fib_setup(dev) < 0) { |
431 | kfree(dev->queues); | 431 | kfree(dev->queues); |
432 | return NULL; | 432 | return NULL; |
433 | } | 433 | } |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 014cc8d54a9f..609fd19b1844 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -67,27 +67,27 @@ static int fib_map_alloc(struct aac_dev *dev) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * fib_map_free - free the fib objects | 70 | * aac_fib_map_free - free the fib objects |
71 | * @dev: Adapter to free | 71 | * @dev: Adapter to free |
72 | * | 72 | * |
73 | * Free the PCI mappings and the memory allocated for FIB blocks | 73 | * Free the PCI mappings and the memory allocated for FIB blocks |
74 | * on this adapter. | 74 | * on this adapter. |
75 | */ | 75 | */ |
76 | 76 | ||
77 | void fib_map_free(struct aac_dev *dev) | 77 | void aac_fib_map_free(struct aac_dev *dev) |
78 | { | 78 | { |
79 | pci_free_consistent(dev->pdev, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB), dev->hw_fib_va, dev->hw_fib_pa); | 79 | pci_free_consistent(dev->pdev, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB), dev->hw_fib_va, dev->hw_fib_pa); |
80 | } | 80 | } |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * fib_setup - setup the fibs | 83 | * aac_fib_setup - setup the fibs |
84 | * @dev: Adapter to set up | 84 | * @dev: Adapter to set up |
85 | * | 85 | * |
86 | * Allocate the PCI space for the fibs, map it and then intialise the | 86 | * Allocate the PCI space for the fibs, map it and then intialise the |
87 | * fib area, the unmapped fib data and also the free list | 87 | * fib area, the unmapped fib data and also the free list |
88 | */ | 88 | */ |
89 | 89 | ||
90 | int fib_setup(struct aac_dev * dev) | 90 | int aac_fib_setup(struct aac_dev * dev) |
91 | { | 91 | { |
92 | struct fib *fibptr; | 92 | struct fib *fibptr; |
93 | struct hw_fib *hw_fib_va; | 93 | struct hw_fib *hw_fib_va; |
@@ -134,14 +134,14 @@ int fib_setup(struct aac_dev * dev) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * fib_alloc - allocate a fib | 137 | * aac_fib_alloc - allocate a fib |
138 | * @dev: Adapter to allocate the fib for | 138 | * @dev: Adapter to allocate the fib for |
139 | * | 139 | * |
140 | * Allocate a fib from the adapter fib pool. If the pool is empty we | 140 | * Allocate a fib from the adapter fib pool. If the pool is empty we |
141 | * return NULL. | 141 | * return NULL. |
142 | */ | 142 | */ |
143 | 143 | ||
144 | struct fib * fib_alloc(struct aac_dev *dev) | 144 | struct fib *aac_fib_alloc(struct aac_dev *dev) |
145 | { | 145 | { |
146 | struct fib * fibptr; | 146 | struct fib * fibptr; |
147 | unsigned long flags; | 147 | unsigned long flags; |
@@ -170,14 +170,14 @@ struct fib * fib_alloc(struct aac_dev *dev) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * fib_free - free a fib | 173 | * aac_fib_free - free a fib |
174 | * @fibptr: fib to free up | 174 | * @fibptr: fib to free up |
175 | * | 175 | * |
176 | * Frees up a fib and places it on the appropriate queue | 176 | * Frees up a fib and places it on the appropriate queue |
177 | * (either free or timed out) | 177 | * (either free or timed out) |
178 | */ | 178 | */ |
179 | 179 | ||
180 | void fib_free(struct fib * fibptr) | 180 | void aac_fib_free(struct fib *fibptr) |
181 | { | 181 | { |
182 | unsigned long flags; | 182 | unsigned long flags; |
183 | 183 | ||
@@ -188,7 +188,7 @@ void fib_free(struct fib * fibptr) | |||
188 | fibptr->dev->timeout_fib = fibptr; | 188 | fibptr->dev->timeout_fib = fibptr; |
189 | } else { | 189 | } else { |
190 | if (fibptr->hw_fib->header.XferState != 0) { | 190 | if (fibptr->hw_fib->header.XferState != 0) { |
191 | printk(KERN_WARNING "fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n", | 191 | printk(KERN_WARNING "aac_fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n", |
192 | (void*)fibptr, | 192 | (void*)fibptr, |
193 | le32_to_cpu(fibptr->hw_fib->header.XferState)); | 193 | le32_to_cpu(fibptr->hw_fib->header.XferState)); |
194 | } | 194 | } |
@@ -199,13 +199,13 @@ void fib_free(struct fib * fibptr) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | /** | 201 | /** |
202 | * fib_init - initialise a fib | 202 | * aac_fib_init - initialise a fib |
203 | * @fibptr: The fib to initialize | 203 | * @fibptr: The fib to initialize |
204 | * | 204 | * |
205 | * Set up the generic fib fields ready for use | 205 | * Set up the generic fib fields ready for use |
206 | */ | 206 | */ |
207 | 207 | ||
208 | void fib_init(struct fib *fibptr) | 208 | void aac_fib_init(struct fib *fibptr) |
209 | { | 209 | { |
210 | struct hw_fib *hw_fib = fibptr->hw_fib; | 210 | struct hw_fib *hw_fib = fibptr->hw_fib; |
211 | 211 | ||
@@ -362,7 +362,7 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f | |||
362 | */ | 362 | */ |
363 | 363 | ||
364 | /** | 364 | /** |
365 | * fib_send - send a fib to the adapter | 365 | * aac_fib_send - send a fib to the adapter |
366 | * @command: Command to send | 366 | * @command: Command to send |
367 | * @fibptr: The fib | 367 | * @fibptr: The fib |
368 | * @size: Size of fib data area | 368 | * @size: Size of fib data area |
@@ -378,7 +378,9 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f | |||
378 | * response FIB is received from the adapter. | 378 | * response FIB is received from the adapter. |
379 | */ | 379 | */ |
380 | 380 | ||
381 | int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority, int wait, int reply, fib_callback callback, void * callback_data) | 381 | int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, |
382 | int priority, int wait, int reply, fib_callback callback, | ||
383 | void *callback_data) | ||
382 | { | 384 | { |
383 | struct aac_dev * dev = fibptr->dev; | 385 | struct aac_dev * dev = fibptr->dev; |
384 | struct hw_fib * hw_fib = fibptr->hw_fib; | 386 | struct hw_fib * hw_fib = fibptr->hw_fib; |
@@ -493,7 +495,7 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority | |||
493 | q->numpending++; | 495 | q->numpending++; |
494 | *(q->headers.producer) = cpu_to_le32(index + 1); | 496 | *(q->headers.producer) = cpu_to_le32(index + 1); |
495 | spin_unlock_irqrestore(q->lock, qflags); | 497 | spin_unlock_irqrestore(q->lock, qflags); |
496 | dprintk((KERN_DEBUG "fib_send: inserting a queue entry at index %d.\n",index)); | 498 | dprintk((KERN_DEBUG "aac_fib_send: inserting a queue entry at index %d.\n",index)); |
497 | if (!(nointr & aac_config.irq_mod)) | 499 | if (!(nointr & aac_config.irq_mod)) |
498 | aac_adapter_notify(dev, AdapNormCmdQueue); | 500 | aac_adapter_notify(dev, AdapNormCmdQueue); |
499 | } | 501 | } |
@@ -520,7 +522,7 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority | |||
520 | list_del(&fibptr->queue); | 522 | list_del(&fibptr->queue); |
521 | spin_unlock_irqrestore(q->lock, qflags); | 523 | spin_unlock_irqrestore(q->lock, qflags); |
522 | if (wait == -1) { | 524 | if (wait == -1) { |
523 | printk(KERN_ERR "aacraid: fib_send: first asynchronous command timed out.\n" | 525 | printk(KERN_ERR "aacraid: aac_fib_send: first asynchronous command timed out.\n" |
524 | "Usually a result of a PCI interrupt routing problem;\n" | 526 | "Usually a result of a PCI interrupt routing problem;\n" |
525 | "update mother board BIOS or consider utilizing one of\n" | 527 | "update mother board BIOS or consider utilizing one of\n" |
526 | "the SAFE mode kernel options (acpi, apic etc)\n"); | 528 | "the SAFE mode kernel options (acpi, apic etc)\n"); |
@@ -624,7 +626,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) | |||
624 | } | 626 | } |
625 | 627 | ||
626 | /** | 628 | /** |
627 | * fib_adapter_complete - complete adapter issued fib | 629 | * aac_fib_adapter_complete - complete adapter issued fib |
628 | * @fibptr: fib to complete | 630 | * @fibptr: fib to complete |
629 | * @size: size of fib | 631 | * @size: size of fib |
630 | * | 632 | * |
@@ -632,7 +634,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) | |||
632 | * the adapter. | 634 | * the adapter. |
633 | */ | 635 | */ |
634 | 636 | ||
635 | int fib_adapter_complete(struct fib * fibptr, unsigned short size) | 637 | int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) |
636 | { | 638 | { |
637 | struct hw_fib * hw_fib = fibptr->hw_fib; | 639 | struct hw_fib * hw_fib = fibptr->hw_fib; |
638 | struct aac_dev * dev = fibptr->dev; | 640 | struct aac_dev * dev = fibptr->dev; |
@@ -683,20 +685,20 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size) | |||
683 | } | 685 | } |
684 | else | 686 | else |
685 | { | 687 | { |
686 | printk(KERN_WARNING "fib_adapter_complete: Unknown xferstate detected.\n"); | 688 | printk(KERN_WARNING "aac_fib_adapter_complete: Unknown xferstate detected.\n"); |
687 | BUG(); | 689 | BUG(); |
688 | } | 690 | } |
689 | return 0; | 691 | return 0; |
690 | } | 692 | } |
691 | 693 | ||
692 | /** | 694 | /** |
693 | * fib_complete - fib completion handler | 695 | * aac_fib_complete - fib completion handler |
694 | * @fib: FIB to complete | 696 | * @fib: FIB to complete |
695 | * | 697 | * |
696 | * Will do all necessary work to complete a FIB. | 698 | * Will do all necessary work to complete a FIB. |
697 | */ | 699 | */ |
698 | 700 | ||
699 | int fib_complete(struct fib * fibptr) | 701 | int aac_fib_complete(struct fib *fibptr) |
700 | { | 702 | { |
701 | struct hw_fib * hw_fib = fibptr->hw_fib; | 703 | struct hw_fib * hw_fib = fibptr->hw_fib; |
702 | 704 | ||
@@ -995,14 +997,14 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
995 | if (!dev || !dev->scsi_host_ptr) | 997 | if (!dev || !dev->scsi_host_ptr) |
996 | return; | 998 | return; |
997 | /* | 999 | /* |
998 | * force reload of disk info via probe_container | 1000 | * force reload of disk info via aac_probe_container |
999 | */ | 1001 | */ |
1000 | if ((device_config_needed == CHANGE) | 1002 | if ((device_config_needed == CHANGE) |
1001 | && (dev->fsa_dev[container].valid == 1)) | 1003 | && (dev->fsa_dev[container].valid == 1)) |
1002 | dev->fsa_dev[container].valid = 2; | 1004 | dev->fsa_dev[container].valid = 2; |
1003 | if ((device_config_needed == CHANGE) || | 1005 | if ((device_config_needed == CHANGE) || |
1004 | (device_config_needed == ADD)) | 1006 | (device_config_needed == ADD)) |
1005 | probe_container(dev, container); | 1007 | aac_probe_container(dev, container); |
1006 | device = scsi_device_lookup(dev->scsi_host_ptr, | 1008 | device = scsi_device_lookup(dev->scsi_host_ptr, |
1007 | CONTAINER_TO_CHANNEL(container), | 1009 | CONTAINER_TO_CHANNEL(container), |
1008 | CONTAINER_TO_ID(container), | 1010 | CONTAINER_TO_ID(container), |
@@ -1104,7 +1106,7 @@ int aac_command_thread(struct aac_dev * dev) | |||
1104 | /* Handle Driver Notify Events */ | 1106 | /* Handle Driver Notify Events */ |
1105 | aac_handle_aif(dev, fib); | 1107 | aac_handle_aif(dev, fib); |
1106 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); | 1108 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
1107 | fib_adapter_complete(fib, (u16)sizeof(u32)); | 1109 | aac_fib_adapter_complete(fib, (u16)sizeof(u32)); |
1108 | } else { | 1110 | } else { |
1109 | struct list_head *entry; | 1111 | struct list_head *entry; |
1110 | /* The u32 here is important and intended. We are using | 1112 | /* The u32 here is important and intended. We are using |
@@ -1241,7 +1243,7 @@ int aac_command_thread(struct aac_dev * dev) | |||
1241 | * Set the status of this FIB | 1243 | * Set the status of this FIB |
1242 | */ | 1244 | */ |
1243 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); | 1245 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
1244 | fib_adapter_complete(fib, sizeof(u32)); | 1246 | aac_fib_adapter_complete(fib, sizeof(u32)); |
1245 | spin_unlock_irqrestore(&dev->fib_lock, flagv); | 1247 | spin_unlock_irqrestore(&dev->fib_lock, flagv); |
1246 | /* Free up the remaining resources */ | 1248 | /* Free up the remaining resources */ |
1247 | hw_fib_p = hw_fib_pool; | 1249 | hw_fib_p = hw_fib_pool; |
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index 439948ef8251..f6bcb9486f85 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c | |||
@@ -206,7 +206,7 @@ unsigned int aac_command_normal(struct aac_queue *q) | |||
206 | * Set the status of this FIB | 206 | * Set the status of this FIB |
207 | */ | 207 | */ |
208 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); | 208 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
209 | fib_adapter_complete(fib, sizeof(u32)); | 209 | aac_fib_adapter_complete(fib, sizeof(u32)); |
210 | spin_lock_irqsave(q->lock, flags); | 210 | spin_lock_irqsave(q->lock, flags); |
211 | } | 211 | } |
212 | } | 212 | } |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 0bf5f9a943e8..271617890562 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -385,17 +385,45 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, | |||
385 | 385 | ||
386 | static int aac_slave_configure(struct scsi_device *sdev) | 386 | static int aac_slave_configure(struct scsi_device *sdev) |
387 | { | 387 | { |
388 | struct Scsi_Host *host = sdev->host; | 388 | if (sdev_channel(sdev) == CONTAINER_CHANNEL) { |
389 | sdev->skip_ms_page_8 = 1; | ||
390 | sdev->skip_ms_page_3f = 1; | ||
391 | } | ||
392 | if ((sdev->type == TYPE_DISK) && | ||
393 | (sdev_channel(sdev) != CONTAINER_CHANNEL)) { | ||
394 | struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata; | ||
395 | if (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) | ||
396 | sdev->no_uld_attach = 1; | ||
397 | } | ||
398 | if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && | ||
399 | (sdev_channel(sdev) == CONTAINER_CHANNEL)) { | ||
400 | struct scsi_device * dev; | ||
401 | struct Scsi_Host *host = sdev->host; | ||
402 | unsigned num_lsu = 0; | ||
403 | unsigned num_one = 0; | ||
404 | unsigned depth; | ||
389 | 405 | ||
390 | if (sdev->tagged_supported) | 406 | __shost_for_each_device(dev, host) { |
391 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, 128); | 407 | if (dev->tagged_supported && (dev->type == TYPE_DISK) && |
392 | else | 408 | (sdev_channel(dev) == CONTAINER_CHANNEL)) |
409 | ++num_lsu; | ||
410 | else | ||
411 | ++num_one; | ||
412 | } | ||
413 | if (num_lsu == 0) | ||
414 | ++num_lsu; | ||
415 | depth = (host->can_queue - num_one) / num_lsu; | ||
416 | if (depth > 256) | ||
417 | depth = 256; | ||
418 | else if (depth < 2) | ||
419 | depth = 2; | ||
420 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth); | ||
421 | if (!(((struct aac_dev *)host->hostdata)->adapter_info.options & | ||
422 | AAC_OPT_NEW_COMM)) | ||
423 | blk_queue_max_segment_size(sdev->request_queue, 65536); | ||
424 | } else | ||
393 | scsi_adjust_queue_depth(sdev, 0, 1); | 425 | scsi_adjust_queue_depth(sdev, 0, 1); |
394 | 426 | ||
395 | if (!(((struct aac_dev *)host->hostdata)->adapter_info.options | ||
396 | & AAC_OPT_NEW_COMM)) | ||
397 | blk_queue_max_segment_size(sdev->request_queue, 65536); | ||
398 | |||
399 | return 0; | 427 | return 0; |
400 | } | 428 | } |
401 | 429 | ||
@@ -870,7 +898,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
870 | 898 | ||
871 | /* | 899 | /* |
872 | * max channel will be the physical channels plus 1 virtual channel | 900 | * max channel will be the physical channels plus 1 virtual channel |
873 | * all containers are on the virtual channel 0 | 901 | * all containers are on the virtual channel 0 (CONTAINER_CHANNEL) |
874 | * physical channels are address by their actual physical number+1 | 902 | * physical channels are address by their actual physical number+1 |
875 | */ | 903 | */ |
876 | if (aac->nondasd_support == 1) | 904 | if (aac->nondasd_support == 1) |
@@ -913,7 +941,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
913 | aac_adapter_disable_int(aac); | 941 | aac_adapter_disable_int(aac); |
914 | free_irq(pdev->irq, aac); | 942 | free_irq(pdev->irq, aac); |
915 | out_unmap: | 943 | out_unmap: |
916 | fib_map_free(aac); | 944 | aac_fib_map_free(aac); |
917 | pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); | 945 | pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); |
918 | kfree(aac->queues); | 946 | kfree(aac->queues); |
919 | iounmap(aac->regs.sa); | 947 | iounmap(aac->regs.sa); |
@@ -947,7 +975,7 @@ static void __devexit aac_remove_one(struct pci_dev *pdev) | |||
947 | 975 | ||
948 | aac_send_shutdown(aac); | 976 | aac_send_shutdown(aac); |
949 | aac_adapter_disable_int(aac); | 977 | aac_adapter_disable_int(aac); |
950 | fib_map_free(aac); | 978 | aac_fib_map_free(aac); |
951 | pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, | 979 | pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, |
952 | aac->comm_phys); | 980 | aac->comm_phys); |
953 | kfree(aac->queues); | 981 | kfree(aac->queues); |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index cb2ee25f213f..531a1f9ceb51 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -1260,16 +1260,15 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs) | |||
1260 | * Reset the bus | 1260 | * Reset the bus |
1261 | * | 1261 | * |
1262 | */ | 1262 | */ |
1263 | static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) | 1263 | static int aha152x_bus_reset_host(struct Scsi_Host *shpnt) |
1264 | { | 1264 | { |
1265 | struct Scsi_Host *shpnt = SCpnt->device->host; | ||
1266 | unsigned long flags; | 1265 | unsigned long flags; |
1267 | 1266 | ||
1268 | DO_LOCK(flags); | 1267 | DO_LOCK(flags); |
1269 | 1268 | ||
1270 | #if defined(AHA152X_DEBUG) | 1269 | #if defined(AHA152X_DEBUG) |
1271 | if(HOSTDATA(shpnt)->debug & debug_eh) { | 1270 | if(HOSTDATA(shpnt)->debug & debug_eh) { |
1272 | printk(DEBUG_LEAD "aha152x_bus_reset(%p)", CMDINFO(SCpnt), SCpnt); | 1271 | printk(KERN_DEBUG "scsi%d: bus reset", shpnt->host_no); |
1273 | show_queues(shpnt); | 1272 | show_queues(shpnt); |
1274 | } | 1273 | } |
1275 | #endif | 1274 | #endif |
@@ -1277,14 +1276,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) | |||
1277 | free_hard_reset_SCs(shpnt, &ISSUE_SC); | 1276 | free_hard_reset_SCs(shpnt, &ISSUE_SC); |
1278 | free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); | 1277 | free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); |
1279 | 1278 | ||
1280 | DPRINTK(debug_eh, DEBUG_LEAD "resetting bus\n", CMDINFO(SCpnt)); | 1279 | DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting bus\n", shpnt->host_no); |
1281 | 1280 | ||
1282 | SETPORT(SCSISEQ, SCSIRSTO); | 1281 | SETPORT(SCSISEQ, SCSIRSTO); |
1283 | mdelay(256); | 1282 | mdelay(256); |
1284 | SETPORT(SCSISEQ, 0); | 1283 | SETPORT(SCSISEQ, 0); |
1285 | mdelay(DELAY); | 1284 | mdelay(DELAY); |
1286 | 1285 | ||
1287 | DPRINTK(debug_eh, DEBUG_LEAD "bus resetted\n", CMDINFO(SCpnt)); | 1286 | DPRINTK(debug_eh, KERN_DEBUG "scsi%d: bus resetted\n", shpnt->host_no); |
1288 | 1287 | ||
1289 | setup_expected_interrupts(shpnt); | 1288 | setup_expected_interrupts(shpnt); |
1290 | if(HOSTDATA(shpnt)->commands==0) | 1289 | if(HOSTDATA(shpnt)->commands==0) |
@@ -1295,6 +1294,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) | |||
1295 | return SUCCESS; | 1294 | return SUCCESS; |
1296 | } | 1295 | } |
1297 | 1296 | ||
1297 | /* | ||
1298 | * Reset the bus | ||
1299 | * | ||
1300 | */ | ||
1301 | static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) | ||
1302 | { | ||
1303 | return aha152x_bus_reset_host(SCpnt->device->host); | ||
1304 | } | ||
1298 | 1305 | ||
1299 | /* | 1306 | /* |
1300 | * Restore default values to the AIC-6260 registers and reset the fifos | 1307 | * Restore default values to the AIC-6260 registers and reset the fifos |
@@ -1337,23 +1344,28 @@ static void reset_ports(struct Scsi_Host *shpnt) | |||
1337 | * Reset the host (bus and controller) | 1344 | * Reset the host (bus and controller) |
1338 | * | 1345 | * |
1339 | */ | 1346 | */ |
1340 | int aha152x_host_reset(Scsi_Cmnd * SCpnt) | 1347 | int aha152x_host_reset_host(struct Scsi_Host *shpnt) |
1341 | { | 1348 | { |
1342 | #if defined(AHA152X_DEBUG) | 1349 | DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no); |
1343 | struct Scsi_Host *shpnt = SCpnt->device->host; | ||
1344 | #endif | ||
1345 | |||
1346 | DPRINTK(debug_eh, DEBUG_LEAD "aha152x_host_reset(%p)\n", CMDINFO(SCpnt), SCpnt); | ||
1347 | 1350 | ||
1348 | aha152x_bus_reset(SCpnt); | 1351 | aha152x_bus_reset_host(shpnt); |
1349 | 1352 | ||
1350 | DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt)); | 1353 | DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting ports\n", shpnt->host_no); |
1351 | reset_ports(SCpnt->device->host); | 1354 | reset_ports(shpnt); |
1352 | 1355 | ||
1353 | return SUCCESS; | 1356 | return SUCCESS; |
1354 | } | 1357 | } |
1355 | 1358 | ||
1356 | /* | 1359 | /* |
1360 | * Reset the host (bus and controller) | ||
1361 | * | ||
1362 | */ | ||
1363 | static int aha152x_host_reset(Scsi_Cmnd *SCpnt) | ||
1364 | { | ||
1365 | return aha152x_host_reset_host(SCpnt->device->host); | ||
1366 | } | ||
1367 | |||
1368 | /* | ||
1357 | * Return the "logical geometry" | 1369 | * Return the "logical geometry" |
1358 | * | 1370 | * |
1359 | */ | 1371 | */ |
@@ -1431,22 +1443,18 @@ static void run(void) | |||
1431 | { | 1443 | { |
1432 | int i; | 1444 | int i; |
1433 | for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) { | 1445 | for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) { |
1434 | struct Scsi_Host *shpnt = aha152x_host[i]; | 1446 | is_complete(aha152x_host[i]); |
1435 | if (shpnt && HOSTDATA(shpnt)->service) { | ||
1436 | HOSTDATA(shpnt)->service=0; | ||
1437 | is_complete(shpnt); | ||
1438 | } | ||
1439 | } | 1447 | } |
1440 | } | 1448 | } |
1441 | 1449 | ||
1442 | /* | 1450 | /* |
1443 | * Interrupts handler | 1451 | * Interrupt handler |
1444 | * | 1452 | * |
1445 | */ | 1453 | */ |
1446 | |||
1447 | static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs) | 1454 | static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs) |
1448 | { | 1455 | { |
1449 | struct Scsi_Host *shpnt = lookup_irq(irqno); | 1456 | struct Scsi_Host *shpnt = lookup_irq(irqno); |
1457 | unsigned long flags; | ||
1450 | unsigned char rev, dmacntrl0; | 1458 | unsigned char rev, dmacntrl0; |
1451 | 1459 | ||
1452 | if (!shpnt) { | 1460 | if (!shpnt) { |
@@ -1472,23 +1480,23 @@ static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs) | |||
1472 | if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) | 1480 | if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) |
1473 | return IRQ_NONE; | 1481 | return IRQ_NONE; |
1474 | 1482 | ||
1483 | if( TESTLO(DMASTAT, INTSTAT) ) | ||
1484 | return IRQ_NONE; | ||
1485 | |||
1475 | /* no more interrupts from the controller, while we're busy. | 1486 | /* no more interrupts from the controller, while we're busy. |
1476 | INTEN is restored by the BH handler */ | 1487 | INTEN is restored by the BH handler */ |
1477 | CLRBITS(DMACNTRL0, INTEN); | 1488 | CLRBITS(DMACNTRL0, INTEN); |
1478 | 1489 | ||
1479 | #if 0 | 1490 | DO_LOCK(flags); |
1480 | /* check if there is already something to be | 1491 | if( HOSTDATA(shpnt)->service==0 ) { |
1481 | serviced; should not happen */ | 1492 | HOSTDATA(shpnt)->service=1; |
1482 | if(HOSTDATA(shpnt)->service) { | 1493 | |
1483 | printk(KERN_ERR "aha152x%d: lost interrupt (%d)\n", HOSTNO, HOSTDATA(shpnt)->service); | 1494 | /* Poke the BH handler */ |
1484 | show_queues(shpnt); | 1495 | INIT_WORK(&aha152x_tq, (void *) run, NULL); |
1496 | schedule_work(&aha152x_tq); | ||
1485 | } | 1497 | } |
1486 | #endif | 1498 | DO_UNLOCK(flags); |
1487 | 1499 | ||
1488 | /* Poke the BH handler */ | ||
1489 | HOSTDATA(shpnt)->service++; | ||
1490 | INIT_WORK(&aha152x_tq, (void *) run, NULL); | ||
1491 | schedule_work(&aha152x_tq); | ||
1492 | return IRQ_HANDLED; | 1500 | return IRQ_HANDLED; |
1493 | } | 1501 | } |
1494 | 1502 | ||
@@ -2527,7 +2535,18 @@ static void is_complete(struct Scsi_Host *shpnt) | |||
2527 | unsigned long flags; | 2535 | unsigned long flags; |
2528 | int pending; | 2536 | int pending; |
2529 | 2537 | ||
2538 | if(!shpnt) | ||
2539 | return; | ||
2540 | |||
2530 | DO_LOCK(flags); | 2541 | DO_LOCK(flags); |
2542 | |||
2543 | if( HOSTDATA(shpnt)->service==0 ) { | ||
2544 | DO_UNLOCK(flags); | ||
2545 | return; | ||
2546 | } | ||
2547 | |||
2548 | HOSTDATA(shpnt)->service = 0; | ||
2549 | |||
2531 | if(HOSTDATA(shpnt)->in_intr) { | 2550 | if(HOSTDATA(shpnt)->in_intr) { |
2532 | DO_UNLOCK(flags); | 2551 | DO_UNLOCK(flags); |
2533 | /* aha152x_error never returns.. */ | 2552 | /* aha152x_error never returns.. */ |
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h index d277613af29b..d2add24d02a3 100644 --- a/drivers/scsi/aha152x.h +++ b/drivers/scsi/aha152x.h | |||
@@ -332,6 +332,6 @@ struct aha152x_setup { | |||
332 | 332 | ||
333 | struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *); | 333 | struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *); |
334 | void aha152x_release(struct Scsi_Host *); | 334 | void aha152x_release(struct Scsi_Host *); |
335 | int aha152x_host_reset(Scsi_Cmnd *); | 335 | int aha152x_host_reset_host(struct Scsi_Host *); |
336 | 336 | ||
337 | #endif /* _AHA152X_H */ | 337 | #endif /* _AHA152X_H */ |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index a800fb51168b..559ff7aae3f1 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -742,23 +742,17 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * | |||
742 | struct ata_queued_cmd *qc; | 742 | struct ata_queued_cmd *qc; |
743 | qc = ata_qc_from_tag(ap, ap->active_tag); | 743 | qc = ata_qc_from_tag(ap, ap->active_tag); |
744 | if (!ahci_host_intr(ap, qc)) | 744 | if (!ahci_host_intr(ap, qc)) |
745 | if (ata_ratelimit()) { | 745 | if (ata_ratelimit()) |
746 | struct pci_dev *pdev = | 746 | dev_printk(KERN_WARNING, host_set->dev, |
747 | to_pci_dev(ap->host_set->dev); | ||
748 | dev_printk(KERN_WARNING, &pdev->dev, | ||
749 | "unhandled interrupt on port %u\n", | 747 | "unhandled interrupt on port %u\n", |
750 | i); | 748 | i); |
751 | } | ||
752 | 749 | ||
753 | VPRINTK("port %u\n", i); | 750 | VPRINTK("port %u\n", i); |
754 | } else { | 751 | } else { |
755 | VPRINTK("port %u (no irq)\n", i); | 752 | VPRINTK("port %u (no irq)\n", i); |
756 | if (ata_ratelimit()) { | 753 | if (ata_ratelimit()) |
757 | struct pci_dev *pdev = | 754 | dev_printk(KERN_WARNING, host_set->dev, |
758 | to_pci_dev(ap->host_set->dev); | ||
759 | dev_printk(KERN_WARNING, &pdev->dev, | ||
760 | "interrupt on disabled port %u\n", i); | 755 | "interrupt on disabled port %u\n", i); |
761 | } | ||
762 | } | 756 | } |
763 | 757 | ||
764 | irq_ack |= (1 << i); | 758 | irq_ack |= (1 << i); |
diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index f6900538be90..87a8c3d2072c 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c | |||
@@ -2068,14 +2068,12 @@ static int esp_reset(struct scsi_cmnd *SCptr) | |||
2068 | { | 2068 | { |
2069 | struct esp *esp = (struct esp *) SCptr->device->host->hostdata; | 2069 | struct esp *esp = (struct esp *) SCptr->device->host->hostdata; |
2070 | 2070 | ||
2071 | spin_lock_irq(esp->ehost->host_lock); | ||
2071 | (void) esp_do_resetbus(esp); | 2072 | (void) esp_do_resetbus(esp); |
2072 | |||
2073 | spin_unlock_irq(esp->ehost->host_lock); | 2073 | spin_unlock_irq(esp->ehost->host_lock); |
2074 | 2074 | ||
2075 | wait_event(esp->reset_queue, (esp->resetting_bus == 0)); | 2075 | wait_event(esp->reset_queue, (esp->resetting_bus == 0)); |
2076 | 2076 | ||
2077 | spin_lock_irq(esp->ehost->host_lock); | ||
2078 | |||
2079 | return SUCCESS; | 2077 | return SUCCESS; |
2080 | } | 2078 | } |
2081 | 2079 | ||
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index bd3ffdf6c800..62e3cda859af 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -2816,7 +2816,7 @@ static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive) | |||
2816 | } | 2816 | } |
2817 | #endif | 2817 | #endif |
2818 | 2818 | ||
2819 | } else { | 2819 | } else if (scp->request_bufflen) { |
2820 | scp->SCp.Status = GDTH_MAP_SINGLE; | 2820 | scp->SCp.Status = GDTH_MAP_SINGLE; |
2821 | scp->SCp.Message = (read_write == 1 ? | 2821 | scp->SCp.Message = (read_write == 1 ? |
2822 | PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); | 2822 | PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 27acf78cf8d8..2bba5e55d7bc 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4236,35 +4236,6 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) | |||
4236 | } | 4236 | } |
4237 | 4237 | ||
4238 | /** | 4238 | /** |
4239 | * ipr_save_ioafp_mode_select - Save adapters mode select data | ||
4240 | * @ioa_cfg: ioa config struct | ||
4241 | * @scsi_cmd: scsi command struct | ||
4242 | * | ||
4243 | * This function saves mode select data for the adapter to | ||
4244 | * use following an adapter reset. | ||
4245 | * | ||
4246 | * Return value: | ||
4247 | * 0 on success / SCSI_MLQUEUE_HOST_BUSY on failure | ||
4248 | **/ | ||
4249 | static int ipr_save_ioafp_mode_select(struct ipr_ioa_cfg *ioa_cfg, | ||
4250 | struct scsi_cmnd *scsi_cmd) | ||
4251 | { | ||
4252 | if (!ioa_cfg->saved_mode_pages) { | ||
4253 | ioa_cfg->saved_mode_pages = kmalloc(sizeof(struct ipr_mode_pages), | ||
4254 | GFP_ATOMIC); | ||
4255 | if (!ioa_cfg->saved_mode_pages) { | ||
4256 | dev_err(&ioa_cfg->pdev->dev, | ||
4257 | "IOA mode select buffer allocation failed\n"); | ||
4258 | return SCSI_MLQUEUE_HOST_BUSY; | ||
4259 | } | ||
4260 | } | ||
4261 | |||
4262 | memcpy(ioa_cfg->saved_mode_pages, scsi_cmd->buffer, scsi_cmd->cmnd[4]); | ||
4263 | ioa_cfg->saved_mode_page_len = scsi_cmd->cmnd[4]; | ||
4264 | return 0; | ||
4265 | } | ||
4266 | |||
4267 | /** | ||
4268 | * ipr_queuecommand - Queue a mid-layer request | 4239 | * ipr_queuecommand - Queue a mid-layer request |
4269 | * @scsi_cmd: scsi command struct | 4240 | * @scsi_cmd: scsi command struct |
4270 | * @done: done function | 4241 | * @done: done function |
@@ -4338,9 +4309,6 @@ static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd, | |||
4338 | (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE)) | 4309 | (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE)) |
4339 | ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD; | 4310 | ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD; |
4340 | 4311 | ||
4341 | if (ipr_is_ioa_resource(res) && scsi_cmd->cmnd[0] == MODE_SELECT) | ||
4342 | rc = ipr_save_ioafp_mode_select(ioa_cfg, scsi_cmd); | ||
4343 | |||
4344 | if (likely(rc == 0)) | 4312 | if (likely(rc == 0)) |
4345 | rc = ipr_build_ioadl(ioa_cfg, ipr_cmd); | 4313 | rc = ipr_build_ioadl(ioa_cfg, ipr_cmd); |
4346 | 4314 | ||
@@ -4829,17 +4797,11 @@ static int ipr_ioafp_mode_select_page28(struct ipr_cmnd *ipr_cmd) | |||
4829 | int length; | 4797 | int length; |
4830 | 4798 | ||
4831 | ENTER; | 4799 | ENTER; |
4832 | if (ioa_cfg->saved_mode_pages) { | 4800 | ipr_scsi_bus_speed_limit(ioa_cfg); |
4833 | memcpy(mode_pages, ioa_cfg->saved_mode_pages, | 4801 | ipr_check_term_power(ioa_cfg, mode_pages); |
4834 | ioa_cfg->saved_mode_page_len); | 4802 | ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages); |
4835 | length = ioa_cfg->saved_mode_page_len; | 4803 | length = mode_pages->hdr.length + 1; |
4836 | } else { | 4804 | mode_pages->hdr.length = 0; |
4837 | ipr_scsi_bus_speed_limit(ioa_cfg); | ||
4838 | ipr_check_term_power(ioa_cfg, mode_pages); | ||
4839 | ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages); | ||
4840 | length = mode_pages->hdr.length + 1; | ||
4841 | mode_pages->hdr.length = 0; | ||
4842 | } | ||
4843 | 4805 | ||
4844 | ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, | 4806 | ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, |
4845 | ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), | 4807 | ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), |
@@ -5969,7 +5931,6 @@ static void ipr_free_mem(struct ipr_ioa_cfg *ioa_cfg) | |||
5969 | } | 5931 | } |
5970 | 5932 | ||
5971 | ipr_free_dump(ioa_cfg); | 5933 | ipr_free_dump(ioa_cfg); |
5972 | kfree(ioa_cfg->saved_mode_pages); | ||
5973 | kfree(ioa_cfg->trace); | 5934 | kfree(ioa_cfg->trace); |
5974 | } | 5935 | } |
5975 | 5936 | ||
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index b639332131f1..fd360bfe56dd 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
@@ -36,8 +36,8 @@ | |||
36 | /* | 36 | /* |
37 | * Literals | 37 | * Literals |
38 | */ | 38 | */ |
39 | #define IPR_DRIVER_VERSION "2.1.1" | 39 | #define IPR_DRIVER_VERSION "2.1.2" |
40 | #define IPR_DRIVER_DATE "(November 15, 2005)" | 40 | #define IPR_DRIVER_DATE "(February 8, 2006)" |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding | 43 | * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding |
@@ -1000,7 +1000,6 @@ struct ipr_ioa_cfg { | |||
1000 | struct Scsi_Host *host; | 1000 | struct Scsi_Host *host; |
1001 | struct pci_dev *pdev; | 1001 | struct pci_dev *pdev; |
1002 | struct ipr_sglist *ucode_sglist; | 1002 | struct ipr_sglist *ucode_sglist; |
1003 | struct ipr_mode_pages *saved_mode_pages; | ||
1004 | u8 saved_mode_page_len; | 1003 | u8 saved_mode_page_len; |
1005 | 1004 | ||
1006 | struct work_struct work_q; | 1005 | struct work_struct work_q; |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 780bfcc67096..ff79e68b347c 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -146,7 +146,7 @@ iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err) | |||
146 | spin_unlock_irqrestore(&session->lock, flags); | 146 | spin_unlock_irqrestore(&session->lock, flags); |
147 | set_bit(SUSPEND_BIT, &conn->suspend_tx); | 147 | set_bit(SUSPEND_BIT, &conn->suspend_tx); |
148 | set_bit(SUSPEND_BIT, &conn->suspend_rx); | 148 | set_bit(SUSPEND_BIT, &conn->suspend_rx); |
149 | iscsi_conn_error(iscsi_handle(conn), err); | 149 | iscsi_conn_error(conn->cls_conn, err); |
150 | } | 150 | } |
151 | 151 | ||
152 | static inline int | 152 | static inline int |
@@ -244,12 +244,10 @@ iscsi_ctask_cleanup(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
244 | if (sc->sc_data_direction == DMA_TO_DEVICE) { | 244 | if (sc->sc_data_direction == DMA_TO_DEVICE) { |
245 | struct iscsi_data_task *dtask, *n; | 245 | struct iscsi_data_task *dtask, *n; |
246 | /* WRITE: cleanup Data-Out's if any */ | 246 | /* WRITE: cleanup Data-Out's if any */ |
247 | spin_lock(&conn->lock); | ||
248 | list_for_each_entry_safe(dtask, n, &ctask->dataqueue, item) { | 247 | list_for_each_entry_safe(dtask, n, &ctask->dataqueue, item) { |
249 | list_del(&dtask->item); | 248 | list_del(&dtask->item); |
250 | mempool_free(dtask, ctask->datapool); | 249 | mempool_free(dtask, ctask->datapool); |
251 | } | 250 | } |
252 | spin_unlock(&conn->lock); | ||
253 | } | 251 | } |
254 | ctask->xmstate = XMSTATE_IDLE; | 252 | ctask->xmstate = XMSTATE_IDLE; |
255 | ctask->r2t = NULL; | 253 | ctask->r2t = NULL; |
@@ -689,7 +687,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn) | |||
689 | break; | 687 | break; |
690 | 688 | ||
691 | if (!conn->in.datalen) { | 689 | if (!conn->in.datalen) { |
692 | rc = iscsi_recv_pdu(iscsi_handle(conn), hdr, | 690 | rc = iscsi_recv_pdu(conn->cls_conn, hdr, |
693 | NULL, 0); | 691 | NULL, 0); |
694 | if (conn->login_mtask != mtask) { | 692 | if (conn->login_mtask != mtask) { |
695 | spin_lock(&session->lock); | 693 | spin_lock(&session->lock); |
@@ -737,7 +735,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn) | |||
737 | if (!conn->in.datalen) { | 735 | if (!conn->in.datalen) { |
738 | struct iscsi_mgmt_task *mtask; | 736 | struct iscsi_mgmt_task *mtask; |
739 | 737 | ||
740 | rc = iscsi_recv_pdu(iscsi_handle(conn), hdr, | 738 | rc = iscsi_recv_pdu(conn->cls_conn, hdr, |
741 | NULL, 0); | 739 | NULL, 0); |
742 | mtask = (struct iscsi_mgmt_task *) | 740 | mtask = (struct iscsi_mgmt_task *) |
743 | session->mgmt_cmds[conn->in.itt - | 741 | session->mgmt_cmds[conn->in.itt - |
@@ -761,7 +759,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn) | |||
761 | rc = iscsi_check_assign_cmdsn(session, | 759 | rc = iscsi_check_assign_cmdsn(session, |
762 | (struct iscsi_nopin*)hdr); | 760 | (struct iscsi_nopin*)hdr); |
763 | if (!rc && hdr->ttt != ISCSI_RESERVED_TAG) | 761 | if (!rc && hdr->ttt != ISCSI_RESERVED_TAG) |
764 | rc = iscsi_recv_pdu(iscsi_handle(conn), | 762 | rc = iscsi_recv_pdu(conn->cls_conn, |
765 | hdr, NULL, 0); | 763 | hdr, NULL, 0); |
766 | } else | 764 | } else |
767 | rc = ISCSI_ERR_PROTO; | 765 | rc = ISCSI_ERR_PROTO; |
@@ -1044,7 +1042,7 @@ iscsi_data_recv(struct iscsi_conn *conn) | |||
1044 | goto exit; | 1042 | goto exit; |
1045 | } | 1043 | } |
1046 | 1044 | ||
1047 | rc = iscsi_recv_pdu(iscsi_handle(conn), conn->in.hdr, | 1045 | rc = iscsi_recv_pdu(conn->cls_conn, conn->in.hdr, |
1048 | conn->data, conn->in.datalen); | 1046 | conn->data, conn->in.datalen); |
1049 | 1047 | ||
1050 | if (!rc && conn->datadgst_en && | 1048 | if (!rc && conn->datadgst_en && |
@@ -2428,19 +2426,20 @@ iscsi_pool_free(struct iscsi_queue *q, void **items) | |||
2428 | } | 2426 | } |
2429 | 2427 | ||
2430 | static struct iscsi_cls_conn * | 2428 | static struct iscsi_cls_conn * |
2431 | iscsi_conn_create(struct Scsi_Host *shost, uint32_t conn_idx) | 2429 | iscsi_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx) |
2432 | { | 2430 | { |
2431 | struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); | ||
2433 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); | 2432 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); |
2434 | struct iscsi_conn *conn; | 2433 | struct iscsi_conn *conn; |
2435 | struct iscsi_cls_conn *cls_conn; | 2434 | struct iscsi_cls_conn *cls_conn; |
2436 | 2435 | ||
2437 | cls_conn = iscsi_create_conn(hostdata_session(shost->hostdata), | 2436 | cls_conn = iscsi_create_conn(cls_session, conn_idx); |
2438 | conn_idx); | ||
2439 | if (!cls_conn) | 2437 | if (!cls_conn) |
2440 | return NULL; | 2438 | return NULL; |
2441 | conn = cls_conn->dd_data; | 2439 | conn = cls_conn->dd_data; |
2440 | memset(conn, 0, sizeof(*conn)); | ||
2442 | 2441 | ||
2443 | memset(conn, 0, sizeof(struct iscsi_conn)); | 2442 | conn->cls_conn = cls_conn; |
2444 | conn->c_stage = ISCSI_CONN_INITIAL_STAGE; | 2443 | conn->c_stage = ISCSI_CONN_INITIAL_STAGE; |
2445 | conn->in_progress = IN_PROGRESS_WAIT_HEADER; | 2444 | conn->in_progress = IN_PROGRESS_WAIT_HEADER; |
2446 | conn->id = conn_idx; | 2445 | conn->id = conn_idx; |
@@ -2452,8 +2451,6 @@ iscsi_conn_create(struct Scsi_Host *shost, uint32_t conn_idx) | |||
2452 | conn->data_size = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; | 2451 | conn->data_size = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; |
2453 | conn->max_recv_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; | 2452 | conn->max_recv_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; |
2454 | 2453 | ||
2455 | spin_lock_init(&conn->lock); | ||
2456 | |||
2457 | /* initialize general xmit PDU commands queue */ | 2454 | /* initialize general xmit PDU commands queue */ |
2458 | conn->xmitqueue = kfifo_alloc(session->cmds_max * sizeof(void*), | 2455 | conn->xmitqueue = kfifo_alloc(session->cmds_max * sizeof(void*), |
2459 | GFP_KERNEL, NULL); | 2456 | GFP_KERNEL, NULL); |
@@ -2625,11 +2622,13 @@ iscsi_conn_destroy(struct iscsi_cls_conn *cls_conn) | |||
2625 | } | 2622 | } |
2626 | 2623 | ||
2627 | static int | 2624 | static int |
2628 | iscsi_conn_bind(iscsi_sessionh_t sessionh, iscsi_connh_t connh, | 2625 | iscsi_conn_bind(struct iscsi_cls_session *cls_session, |
2629 | uint32_t transport_fd, int is_leading) | 2626 | struct iscsi_cls_conn *cls_conn, uint32_t transport_fd, |
2627 | int is_leading) | ||
2630 | { | 2628 | { |
2631 | struct iscsi_session *session = iscsi_ptr(sessionh); | 2629 | struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); |
2632 | struct iscsi_conn *tmp = ERR_PTR(-EEXIST), *conn = iscsi_ptr(connh); | 2630 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); |
2631 | struct iscsi_conn *tmp = ERR_PTR(-EEXIST), *conn = cls_conn->dd_data; | ||
2633 | struct sock *sk; | 2632 | struct sock *sk; |
2634 | struct socket *sock; | 2633 | struct socket *sock; |
2635 | int err; | 2634 | int err; |
@@ -2703,9 +2702,9 @@ iscsi_conn_bind(iscsi_sessionh_t sessionh, iscsi_connh_t connh, | |||
2703 | } | 2702 | } |
2704 | 2703 | ||
2705 | static int | 2704 | static int |
2706 | iscsi_conn_start(iscsi_connh_t connh) | 2705 | iscsi_conn_start(struct iscsi_cls_conn *cls_conn) |
2707 | { | 2706 | { |
2708 | struct iscsi_conn *conn = iscsi_ptr(connh); | 2707 | struct iscsi_conn *conn = cls_conn->dd_data; |
2709 | struct iscsi_session *session = conn->session; | 2708 | struct iscsi_session *session = conn->session; |
2710 | struct sock *sk; | 2709 | struct sock *sk; |
2711 | 2710 | ||
@@ -2754,9 +2753,9 @@ iscsi_conn_start(iscsi_connh_t connh) | |||
2754 | } | 2753 | } |
2755 | 2754 | ||
2756 | static void | 2755 | static void |
2757 | iscsi_conn_stop(iscsi_connh_t connh, int flag) | 2756 | iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) |
2758 | { | 2757 | { |
2759 | struct iscsi_conn *conn = iscsi_ptr(connh); | 2758 | struct iscsi_conn *conn = cls_conn->dd_data; |
2760 | struct iscsi_session *session = conn->session; | 2759 | struct iscsi_session *session = conn->session; |
2761 | struct sock *sk; | 2760 | struct sock *sk; |
2762 | unsigned long flags; | 2761 | unsigned long flags; |
@@ -3253,9 +3252,9 @@ static struct scsi_host_template iscsi_sht = { | |||
3253 | 3252 | ||
3254 | static struct iscsi_transport iscsi_tcp_transport; | 3253 | static struct iscsi_transport iscsi_tcp_transport; |
3255 | 3254 | ||
3256 | static struct Scsi_Host * | 3255 | static struct iscsi_cls_session * |
3257 | iscsi_session_create(struct scsi_transport_template *scsit, | 3256 | iscsi_session_create(struct scsi_transport_template *scsit, |
3258 | uint32_t initial_cmdsn) | 3257 | uint32_t initial_cmdsn, uint32_t *sid) |
3259 | { | 3258 | { |
3260 | struct Scsi_Host *shost; | 3259 | struct Scsi_Host *shost; |
3261 | struct iscsi_session *session; | 3260 | struct iscsi_session *session; |
@@ -3268,13 +3267,14 @@ iscsi_session_create(struct scsi_transport_template *scsit, | |||
3268 | session = iscsi_hostdata(shost->hostdata); | 3267 | session = iscsi_hostdata(shost->hostdata); |
3269 | memset(session, 0, sizeof(struct iscsi_session)); | 3268 | memset(session, 0, sizeof(struct iscsi_session)); |
3270 | session->host = shost; | 3269 | session->host = shost; |
3271 | session->state = ISCSI_STATE_LOGGED_IN; | 3270 | session->state = ISCSI_STATE_FREE; |
3272 | session->mgmtpool_max = ISCSI_MGMT_CMDS_MAX; | 3271 | session->mgmtpool_max = ISCSI_MGMT_CMDS_MAX; |
3273 | session->cmds_max = ISCSI_XMIT_CMDS_MAX; | 3272 | session->cmds_max = ISCSI_XMIT_CMDS_MAX; |
3274 | session->cmdsn = initial_cmdsn; | 3273 | session->cmdsn = initial_cmdsn; |
3275 | session->exp_cmdsn = initial_cmdsn + 1; | 3274 | session->exp_cmdsn = initial_cmdsn + 1; |
3276 | session->max_cmdsn = initial_cmdsn + 1; | 3275 | session->max_cmdsn = initial_cmdsn + 1; |
3277 | session->max_r2t = 1; | 3276 | session->max_r2t = 1; |
3277 | *sid = shost->host_no; | ||
3278 | 3278 | ||
3279 | /* initialize SCSI PDU commands pool */ | 3279 | /* initialize SCSI PDU commands pool */ |
3280 | if (iscsi_pool_init(&session->cmdpool, session->cmds_max, | 3280 | if (iscsi_pool_init(&session->cmdpool, session->cmds_max, |
@@ -3311,22 +3311,24 @@ iscsi_session_create(struct scsi_transport_template *scsit, | |||
3311 | if (iscsi_r2tpool_alloc(session)) | 3311 | if (iscsi_r2tpool_alloc(session)) |
3312 | goto r2tpool_alloc_fail; | 3312 | goto r2tpool_alloc_fail; |
3313 | 3313 | ||
3314 | return shost; | 3314 | return hostdata_session(shost->hostdata); |
3315 | 3315 | ||
3316 | r2tpool_alloc_fail: | 3316 | r2tpool_alloc_fail: |
3317 | for (cmd_i = 0; cmd_i < session->mgmtpool_max; cmd_i++) | 3317 | for (cmd_i = 0; cmd_i < session->mgmtpool_max; cmd_i++) |
3318 | kfree(session->mgmt_cmds[cmd_i]->data); | 3318 | kfree(session->mgmt_cmds[cmd_i]->data); |
3319 | iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds); | ||
3320 | immdata_alloc_fail: | 3319 | immdata_alloc_fail: |
3320 | iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds); | ||
3321 | mgmtpool_alloc_fail: | 3321 | mgmtpool_alloc_fail: |
3322 | iscsi_pool_free(&session->cmdpool, (void**)session->cmds); | 3322 | iscsi_pool_free(&session->cmdpool, (void**)session->cmds); |
3323 | cmdpool_alloc_fail: | 3323 | cmdpool_alloc_fail: |
3324 | iscsi_transport_destroy_session(shost); | ||
3324 | return NULL; | 3325 | return NULL; |
3325 | } | 3326 | } |
3326 | 3327 | ||
3327 | static void | 3328 | static void |
3328 | iscsi_session_destroy(struct Scsi_Host *shost) | 3329 | iscsi_session_destroy(struct iscsi_cls_session *cls_session) |
3329 | { | 3330 | { |
3331 | struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); | ||
3330 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); | 3332 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); |
3331 | int cmd_i; | 3333 | int cmd_i; |
3332 | struct iscsi_data_task *dtask, *n; | 3334 | struct iscsi_data_task *dtask, *n; |
@@ -3350,10 +3352,10 @@ iscsi_session_destroy(struct Scsi_Host *shost) | |||
3350 | } | 3352 | } |
3351 | 3353 | ||
3352 | static int | 3354 | static int |
3353 | iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param, | 3355 | iscsi_conn_set_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, |
3354 | uint32_t value) | 3356 | uint32_t value) |
3355 | { | 3357 | { |
3356 | struct iscsi_conn *conn = iscsi_ptr(connh); | 3358 | struct iscsi_conn *conn = cls_conn->dd_data; |
3357 | struct iscsi_session *session = conn->session; | 3359 | struct iscsi_session *session = conn->session; |
3358 | 3360 | ||
3359 | spin_lock_bh(&session->lock); | 3361 | spin_lock_bh(&session->lock); |
@@ -3495,9 +3497,10 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param, | |||
3495 | } | 3497 | } |
3496 | 3498 | ||
3497 | static int | 3499 | static int |
3498 | iscsi_session_get_param(struct Scsi_Host *shost, | 3500 | iscsi_session_get_param(struct iscsi_cls_session *cls_session, |
3499 | enum iscsi_param param, uint32_t *value) | 3501 | enum iscsi_param param, uint32_t *value) |
3500 | { | 3502 | { |
3503 | struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); | ||
3501 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); | 3504 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); |
3502 | 3505 | ||
3503 | switch(param) { | 3506 | switch(param) { |
@@ -3539,9 +3542,10 @@ iscsi_session_get_param(struct Scsi_Host *shost, | |||
3539 | } | 3542 | } |
3540 | 3543 | ||
3541 | static int | 3544 | static int |
3542 | iscsi_conn_get_param(void *data, enum iscsi_param param, uint32_t *value) | 3545 | iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, |
3546 | enum iscsi_param param, uint32_t *value) | ||
3543 | { | 3547 | { |
3544 | struct iscsi_conn *conn = data; | 3548 | struct iscsi_conn *conn = cls_conn->dd_data; |
3545 | 3549 | ||
3546 | switch(param) { | 3550 | switch(param) { |
3547 | case ISCSI_PARAM_MAX_RECV_DLENGTH: | 3551 | case ISCSI_PARAM_MAX_RECV_DLENGTH: |
@@ -3564,9 +3568,9 @@ iscsi_conn_get_param(void *data, enum iscsi_param param, uint32_t *value) | |||
3564 | } | 3568 | } |
3565 | 3569 | ||
3566 | static void | 3570 | static void |
3567 | iscsi_conn_get_stats(iscsi_connh_t connh, struct iscsi_stats *stats) | 3571 | iscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats) |
3568 | { | 3572 | { |
3569 | struct iscsi_conn *conn = iscsi_ptr(connh); | 3573 | struct iscsi_conn *conn = cls_conn->dd_data; |
3570 | 3574 | ||
3571 | stats->txdata_octets = conn->txdata_octets; | 3575 | stats->txdata_octets = conn->txdata_octets; |
3572 | stats->rxdata_octets = conn->rxdata_octets; | 3576 | stats->rxdata_octets = conn->rxdata_octets; |
@@ -3587,10 +3591,10 @@ iscsi_conn_get_stats(iscsi_connh_t connh, struct iscsi_stats *stats) | |||
3587 | } | 3591 | } |
3588 | 3592 | ||
3589 | static int | 3593 | static int |
3590 | iscsi_conn_send_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, char *data, | 3594 | iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, |
3591 | uint32_t data_size) | 3595 | char *data, uint32_t data_size) |
3592 | { | 3596 | { |
3593 | struct iscsi_conn *conn = iscsi_ptr(connh); | 3597 | struct iscsi_conn *conn = cls_conn->dd_data; |
3594 | int rc; | 3598 | int rc; |
3595 | 3599 | ||
3596 | mutex_lock(&conn->xmitmutex); | 3600 | mutex_lock(&conn->xmitmutex); |
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index f95e61b76f70..ba26741ac154 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h | |||
@@ -113,7 +113,10 @@ struct iscsi_tcp_recv { | |||
113 | int datadgst; | 113 | int datadgst; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | struct iscsi_cls_conn; | ||
117 | |||
116 | struct iscsi_conn { | 118 | struct iscsi_conn { |
119 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ | ||
117 | struct iscsi_hdr hdr; /* header placeholder */ | 120 | struct iscsi_hdr hdr; /* header placeholder */ |
118 | char hdrext[4*sizeof(__u16) + | 121 | char hdrext[4*sizeof(__u16) + |
119 | sizeof(__u32)]; | 122 | sizeof(__u32)]; |
@@ -143,7 +146,6 @@ struct iscsi_conn { | |||
143 | struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ | 146 | struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ |
144 | struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ | 147 | struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ |
145 | struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ | 148 | struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ |
146 | spinlock_t lock; /* FIXME: to be removed */ | ||
147 | 149 | ||
148 | /* old values for socket callbacks */ | 150 | /* old values for socket callbacks */ |
149 | void (*old_data_ready)(struct sock *, int); | 151 | void (*old_data_ready)(struct sock *, int); |
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index 23728d1c980c..fcd304e11c26 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c | |||
@@ -65,27 +65,6 @@ static int jazz_esp_release(struct Scsi_Host *shost) | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static struct scsi_host_template driver_template = { | ||
69 | .proc_name = "jazz_esp", | ||
70 | .proc_info = &esp_proc_info, | ||
71 | .name = "ESP 100/100a/200", | ||
72 | .detect = jazz_esp_detect, | ||
73 | .slave_alloc = esp_slave_alloc, | ||
74 | .slave_destroy = esp_slave_destroy, | ||
75 | .release = jazz_esp_release, | ||
76 | .info = esp_info, | ||
77 | .queuecommand = esp_queue, | ||
78 | .eh_abort_handler = esp_abort, | ||
79 | .eh_bus_reset_handler = esp_reset, | ||
80 | .can_queue = 7, | ||
81 | .this_id = 7, | ||
82 | .sg_tablesize = SG_ALL, | ||
83 | .cmd_per_lun = 1, | ||
84 | .use_clustering = DISABLE_CLUSTERING, | ||
85 | }; | ||
86 | |||
87 | #include "scsi_module.c" | ||
88 | |||
89 | /***************************************************************** Detection */ | 68 | /***************************************************************** Detection */ |
90 | static int jazz_esp_detect(struct scsi_host_template *tpnt) | 69 | static int jazz_esp_detect(struct scsi_host_template *tpnt) |
91 | { | 70 | { |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 46c4cdbaee86..4f91b0dc572b 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -82,6 +82,10 @@ int atapi_enabled = 0; | |||
82 | module_param(atapi_enabled, int, 0444); | 82 | module_param(atapi_enabled, int, 0444); |
83 | MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); | 83 | MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); |
84 | 84 | ||
85 | int libata_fua = 0; | ||
86 | module_param_named(fua, libata_fua, int, 0444); | ||
87 | MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on)"); | ||
88 | |||
85 | MODULE_AUTHOR("Jeff Garzik"); | 89 | MODULE_AUTHOR("Jeff Garzik"); |
86 | MODULE_DESCRIPTION("Library module for ATA devices"); | 90 | MODULE_DESCRIPTION("Library module for ATA devices"); |
87 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
@@ -614,7 +618,7 @@ int ata_rwcmd_protocol(struct ata_queued_cmd *qc) | |||
614 | } else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) { | 618 | } else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) { |
615 | /* Unable to use DMA due to host limitation */ | 619 | /* Unable to use DMA due to host limitation */ |
616 | tf->protocol = ATA_PROT_PIO; | 620 | tf->protocol = ATA_PROT_PIO; |
617 | index = dev->multi_count ? 0 : 4; | 621 | index = dev->multi_count ? 0 : 8; |
618 | } else { | 622 | } else { |
619 | tf->protocol = ATA_PROT_DMA; | 623 | tf->protocol = ATA_PROT_DMA; |
620 | index = 16; | 624 | index = 16; |
@@ -2514,7 +2518,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2514 | assert(sg != NULL); | 2518 | assert(sg != NULL); |
2515 | 2519 | ||
2516 | if (qc->flags & ATA_QCFLAG_SINGLE) | 2520 | if (qc->flags & ATA_QCFLAG_SINGLE) |
2517 | assert(qc->n_elem == 1); | 2521 | assert(qc->n_elem <= 1); |
2518 | 2522 | ||
2519 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); | 2523 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); |
2520 | 2524 | ||
@@ -2537,7 +2541,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2537 | kunmap_atomic(addr, KM_IRQ0); | 2541 | kunmap_atomic(addr, KM_IRQ0); |
2538 | } | 2542 | } |
2539 | } else { | 2543 | } else { |
2540 | if (sg_dma_len(&sg[0]) > 0) | 2544 | if (qc->n_elem) |
2541 | dma_unmap_single(ap->host_set->dev, | 2545 | dma_unmap_single(ap->host_set->dev, |
2542 | sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), | 2546 | sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), |
2543 | dir); | 2547 | dir); |
@@ -2570,7 +2574,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc) | |||
2570 | unsigned int idx; | 2574 | unsigned int idx; |
2571 | 2575 | ||
2572 | assert(qc->__sg != NULL); | 2576 | assert(qc->__sg != NULL); |
2573 | assert(qc->n_elem > 0); | 2577 | assert(qc->n_elem > 0 || qc->pad_len > 0); |
2574 | 2578 | ||
2575 | idx = 0; | 2579 | idx = 0; |
2576 | ata_for_each_sg(sg, qc) { | 2580 | ata_for_each_sg(sg, qc) { |
@@ -2715,6 +2719,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
2715 | int dir = qc->dma_dir; | 2719 | int dir = qc->dma_dir; |
2716 | struct scatterlist *sg = qc->__sg; | 2720 | struct scatterlist *sg = qc->__sg; |
2717 | dma_addr_t dma_address; | 2721 | dma_addr_t dma_address; |
2722 | int trim_sg = 0; | ||
2718 | 2723 | ||
2719 | /* we must lengthen transfers to end on a 32-bit boundary */ | 2724 | /* we must lengthen transfers to end on a 32-bit boundary */ |
2720 | qc->pad_len = sg->length & 3; | 2725 | qc->pad_len = sg->length & 3; |
@@ -2734,13 +2739,15 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
2734 | sg_dma_len(psg) = ATA_DMA_PAD_SZ; | 2739 | sg_dma_len(psg) = ATA_DMA_PAD_SZ; |
2735 | /* trim sg */ | 2740 | /* trim sg */ |
2736 | sg->length -= qc->pad_len; | 2741 | sg->length -= qc->pad_len; |
2742 | if (sg->length == 0) | ||
2743 | trim_sg = 1; | ||
2737 | 2744 | ||
2738 | DPRINTK("padding done, sg->length=%u pad_len=%u\n", | 2745 | DPRINTK("padding done, sg->length=%u pad_len=%u\n", |
2739 | sg->length, qc->pad_len); | 2746 | sg->length, qc->pad_len); |
2740 | } | 2747 | } |
2741 | 2748 | ||
2742 | if (!sg->length) { | 2749 | if (trim_sg) { |
2743 | sg_dma_address(sg) = 0; | 2750 | qc->n_elem--; |
2744 | goto skip_map; | 2751 | goto skip_map; |
2745 | } | 2752 | } |
2746 | 2753 | ||
@@ -2753,9 +2760,9 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
2753 | } | 2760 | } |
2754 | 2761 | ||
2755 | sg_dma_address(sg) = dma_address; | 2762 | sg_dma_address(sg) = dma_address; |
2756 | skip_map: | ||
2757 | sg_dma_len(sg) = sg->length; | 2763 | sg_dma_len(sg) = sg->length; |
2758 | 2764 | ||
2765 | skip_map: | ||
2759 | DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), | 2766 | DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), |
2760 | qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | 2767 | qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
2761 | 2768 | ||
@@ -3357,11 +3364,12 @@ static void ata_pio_error(struct ata_port *ap) | |||
3357 | { | 3364 | { |
3358 | struct ata_queued_cmd *qc; | 3365 | struct ata_queued_cmd *qc; |
3359 | 3366 | ||
3360 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
3361 | |||
3362 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3367 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3363 | assert(qc != NULL); | 3368 | assert(qc != NULL); |
3364 | 3369 | ||
3370 | if (qc->tf.command != ATA_CMD_PACKET) | ||
3371 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
3372 | |||
3365 | /* make sure qc->err_mask is available to | 3373 | /* make sure qc->err_mask is available to |
3366 | * know what's wrong and recover | 3374 | * know what's wrong and recover |
3367 | */ | 3375 | */ |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 07b1e7cc61df..59503c9ccac9 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1708,6 +1708,8 @@ static int ata_dev_supports_fua(u16 *id) | |||
1708 | { | 1708 | { |
1709 | unsigned char model[41], fw[9]; | 1709 | unsigned char model[41], fw[9]; |
1710 | 1710 | ||
1711 | if (!libata_fua) | ||
1712 | return 0; | ||
1711 | if (!ata_id_has_fua(id)) | 1713 | if (!ata_id_has_fua(id)) |
1712 | return 0; | 1714 | return 0; |
1713 | 1715 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index e03ce48b7b4b..fddaf479a544 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -41,6 +41,7 @@ struct ata_scsi_args { | |||
41 | 41 | ||
42 | /* libata-core.c */ | 42 | /* libata-core.c */ |
43 | extern int atapi_enabled; | 43 | extern int atapi_enabled; |
44 | extern int libata_fua; | ||
44 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 45 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
45 | struct ata_device *dev); | 46 | struct ata_device *dev); |
46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 47 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index d101a8a6f4e8..7144674bc8e6 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -5049,7 +5049,7 @@ static struct pci_device_id megaraid_pci_tbl[] = { | |||
5049 | MODULE_DEVICE_TABLE(pci, megaraid_pci_tbl); | 5049 | MODULE_DEVICE_TABLE(pci, megaraid_pci_tbl); |
5050 | 5050 | ||
5051 | static struct pci_driver megaraid_pci_driver = { | 5051 | static struct pci_driver megaraid_pci_driver = { |
5052 | .name = "megaraid", | 5052 | .name = "megaraid_legacy", |
5053 | .id_table = megaraid_pci_tbl, | 5053 | .id_table = megaraid_pci_tbl, |
5054 | .probe = megaraid_probe_one, | 5054 | .probe = megaraid_probe_one, |
5055 | .remove = __devexit_p(megaraid_remove_one), | 5055 | .remove = __devexit_p(megaraid_remove_one), |
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index 4b3e0d6e5afa..4b75fe619d9c 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/mutex.h> | 5 | #include <linux/mutex.h> |
6 | 6 | ||
7 | #define MEGARAID_VERSION \ | 7 | #define MEGARAID_VERSION \ |
8 | "v2.00.3 (Release Date: Wed Feb 19 08:51:30 EST 2003)\n" | 8 | "v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n" |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Driver features - change the values to enable or disable features in the | 11 | * Driver features - change the values to enable or disable features in the |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index a487f414960e..4f39dd01936d 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.02.02 | 13 | * Version : v00.00.02.04 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> | 16 | * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> |
@@ -60,6 +60,12 @@ static struct pci_device_id megasas_pci_table[] = { | |||
60 | PCI_ANY_ID, | 60 | PCI_ANY_ID, |
61 | }, | 61 | }, |
62 | { | 62 | { |
63 | PCI_VENDOR_ID_LSI_LOGIC, | ||
64 | PCI_DEVICE_ID_LSI_SAS1078R, // ppc IOP | ||
65 | PCI_ANY_ID, | ||
66 | PCI_ANY_ID, | ||
67 | }, | ||
68 | { | ||
63 | PCI_VENDOR_ID_DELL, | 69 | PCI_VENDOR_ID_DELL, |
64 | PCI_DEVICE_ID_DELL_PERC5, // xscale IOP | 70 | PCI_DEVICE_ID_DELL_PERC5, // xscale IOP |
65 | PCI_ANY_ID, | 71 | PCI_ANY_ID, |
@@ -199,6 +205,86 @@ static struct megasas_instance_template megasas_instance_template_xscale = { | |||
199 | */ | 205 | */ |
200 | 206 | ||
201 | /** | 207 | /** |
208 | * The following functions are defined for ppc (deviceid : 0x60) | ||
209 | * controllers | ||
210 | */ | ||
211 | |||
212 | /** | ||
213 | * megasas_enable_intr_ppc - Enables interrupts | ||
214 | * @regs: MFI register set | ||
215 | */ | ||
216 | static inline void | ||
217 | megasas_enable_intr_ppc(struct megasas_register_set __iomem * regs) | ||
218 | { | ||
219 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); | ||
220 | |||
221 | writel(~0x80000004, &(regs)->outbound_intr_mask); | ||
222 | |||
223 | /* Dummy readl to force pci flush */ | ||
224 | readl(®s->outbound_intr_mask); | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * megasas_read_fw_status_reg_ppc - returns the current FW status value | ||
229 | * @regs: MFI register set | ||
230 | */ | ||
231 | static u32 | ||
232 | megasas_read_fw_status_reg_ppc(struct megasas_register_set __iomem * regs) | ||
233 | { | ||
234 | return readl(&(regs)->outbound_scratch_pad); | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * megasas_clear_interrupt_ppc - Check & clear interrupt | ||
239 | * @regs: MFI register set | ||
240 | */ | ||
241 | static int | ||
242 | megasas_clear_intr_ppc(struct megasas_register_set __iomem * regs) | ||
243 | { | ||
244 | u32 status; | ||
245 | /* | ||
246 | * Check if it is our interrupt | ||
247 | */ | ||
248 | status = readl(®s->outbound_intr_status); | ||
249 | |||
250 | if (!(status & MFI_REPLY_1078_MESSAGE_INTERRUPT)) { | ||
251 | return 1; | ||
252 | } | ||
253 | |||
254 | /* | ||
255 | * Clear the interrupt by writing back the same value | ||
256 | */ | ||
257 | writel(status, ®s->outbound_doorbell_clear); | ||
258 | |||
259 | return 0; | ||
260 | } | ||
261 | /** | ||
262 | * megasas_fire_cmd_ppc - Sends command to the FW | ||
263 | * @frame_phys_addr : Physical address of cmd | ||
264 | * @frame_count : Number of frames for the command | ||
265 | * @regs : MFI register set | ||
266 | */ | ||
267 | static inline void | ||
268 | megasas_fire_cmd_ppc(dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs) | ||
269 | { | ||
270 | writel((frame_phys_addr | (frame_count<<1))|1, | ||
271 | &(regs)->inbound_queue_port); | ||
272 | } | ||
273 | |||
274 | static struct megasas_instance_template megasas_instance_template_ppc = { | ||
275 | |||
276 | .fire_cmd = megasas_fire_cmd_ppc, | ||
277 | .enable_intr = megasas_enable_intr_ppc, | ||
278 | .clear_intr = megasas_clear_intr_ppc, | ||
279 | .read_fw_status_reg = megasas_read_fw_status_reg_ppc, | ||
280 | }; | ||
281 | |||
282 | /** | ||
283 | * This is the end of set of functions & definitions | ||
284 | * specific to ppc (deviceid : 0x60) controllers | ||
285 | */ | ||
286 | |||
287 | /** | ||
202 | * megasas_disable_intr - Disables interrupts | 288 | * megasas_disable_intr - Disables interrupts |
203 | * @regs: MFI register set | 289 | * @regs: MFI register set |
204 | */ | 290 | */ |
@@ -707,6 +793,20 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
707 | return 0; | 793 | return 0; |
708 | } | 794 | } |
709 | 795 | ||
796 | static int megasas_slave_configure(struct scsi_device *sdev) | ||
797 | { | ||
798 | /* | ||
799 | * Don't export physical disk devices to the disk driver. | ||
800 | * | ||
801 | * FIXME: Currently we don't export them to the midlayer at all. | ||
802 | * That will be fixed once LSI engineers have audited the | ||
803 | * firmware for possible issues. | ||
804 | */ | ||
805 | if (sdev->channel < MEGASAS_MAX_PD_CHANNELS && sdev->type == TYPE_DISK) | ||
806 | return -ENXIO; | ||
807 | return 0; | ||
808 | } | ||
809 | |||
710 | /** | 810 | /** |
711 | * megasas_wait_for_outstanding - Wait for all outstanding cmds | 811 | * megasas_wait_for_outstanding - Wait for all outstanding cmds |
712 | * @instance: Adapter soft state | 812 | * @instance: Adapter soft state |
@@ -857,6 +957,7 @@ static struct scsi_host_template megasas_template = { | |||
857 | .module = THIS_MODULE, | 957 | .module = THIS_MODULE, |
858 | .name = "LSI Logic SAS based MegaRAID driver", | 958 | .name = "LSI Logic SAS based MegaRAID driver", |
859 | .proc_name = "megaraid_sas", | 959 | .proc_name = "megaraid_sas", |
960 | .slave_configure = megasas_slave_configure, | ||
860 | .queuecommand = megasas_queue_command, | 961 | .queuecommand = megasas_queue_command, |
861 | .eh_device_reset_handler = megasas_reset_device, | 962 | .eh_device_reset_handler = megasas_reset_device, |
862 | .eh_bus_reset_handler = megasas_reset_bus_host, | 963 | .eh_bus_reset_handler = megasas_reset_bus_host, |
@@ -985,20 +1086,6 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
985 | break; | 1086 | break; |
986 | } | 1087 | } |
987 | 1088 | ||
988 | /* | ||
989 | * Don't export physical disk devices to mid-layer. | ||
990 | */ | ||
991 | if (!MEGASAS_IS_LOGICAL(cmd->scmd) && | ||
992 | (hdr->cmd_status == MFI_STAT_OK) && | ||
993 | (cmd->scmd->cmnd[0] == INQUIRY)) { | ||
994 | |||
995 | if (((*(u8 *) cmd->scmd->request_buffer) & 0x1F) == | ||
996 | TYPE_DISK) { | ||
997 | cmd->scmd->result = DID_BAD_TARGET << 16; | ||
998 | exception = 1; | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | case MFI_CMD_LD_READ: | 1089 | case MFI_CMD_LD_READ: |
1003 | case MFI_CMD_LD_WRITE: | 1090 | case MFI_CMD_LD_WRITE: |
1004 | 1091 | ||
@@ -1607,7 +1694,17 @@ static int megasas_init_mfi(struct megasas_instance *instance) | |||
1607 | 1694 | ||
1608 | reg_set = instance->reg_set; | 1695 | reg_set = instance->reg_set; |
1609 | 1696 | ||
1610 | instance->instancet = &megasas_instance_template_xscale; | 1697 | switch(instance->pdev->device) |
1698 | { | ||
1699 | case PCI_DEVICE_ID_LSI_SAS1078R: | ||
1700 | instance->instancet = &megasas_instance_template_ppc; | ||
1701 | break; | ||
1702 | case PCI_DEVICE_ID_LSI_SAS1064R: | ||
1703 | case PCI_DEVICE_ID_DELL_PERC5: | ||
1704 | default: | ||
1705 | instance->instancet = &megasas_instance_template_xscale; | ||
1706 | break; | ||
1707 | } | ||
1611 | 1708 | ||
1612 | /* | 1709 | /* |
1613 | * We expect the FW state to be READY | 1710 | * We expect the FW state to be READY |
@@ -1983,6 +2080,7 @@ static int megasas_io_attach(struct megasas_instance *instance) | |||
1983 | host->max_channel = MEGASAS_MAX_CHANNELS - 1; | 2080 | host->max_channel = MEGASAS_MAX_CHANNELS - 1; |
1984 | host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL; | 2081 | host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL; |
1985 | host->max_lun = MEGASAS_MAX_LUN; | 2082 | host->max_lun = MEGASAS_MAX_LUN; |
2083 | host->max_cmd_len = 16; | ||
1986 | 2084 | ||
1987 | /* | 2085 | /* |
1988 | * Notify the mid-layer about the new controller | 2086 | * Notify the mid-layer about the new controller |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index d6d166c0663f..89639f0c38ef 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,9 +18,9 @@ | |||
18 | /** | 18 | /** |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.02.02" | 21 | #define MEGASAS_VERSION "00.00.02.04" |
22 | #define MEGASAS_RELDATE "Jan 23, 2006" | 22 | #define MEGASAS_RELDATE "Feb 03, 2006" |
23 | #define MEGASAS_EXT_VERSION "Mon Jan 23 14:09:01 PST 2006" | 23 | #define MEGASAS_EXT_VERSION "Fri Feb 03 14:31:44 PST 2006" |
24 | /* | 24 | /* |
25 | * ===================================== | 25 | * ===================================== |
26 | * MegaRAID SAS MFI firmware definitions | 26 | * MegaRAID SAS MFI firmware definitions |
@@ -553,31 +553,46 @@ struct megasas_ctrl_info { | |||
553 | #define MFI_OB_INTR_STATUS_MASK 0x00000002 | 553 | #define MFI_OB_INTR_STATUS_MASK 0x00000002 |
554 | #define MFI_POLL_TIMEOUT_SECS 10 | 554 | #define MFI_POLL_TIMEOUT_SECS 10 |
555 | 555 | ||
556 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 | ||
557 | #define PCI_DEVICE_ID_LSI_SAS1078R 0x00000060 | ||
558 | |||
556 | struct megasas_register_set { | 559 | struct megasas_register_set { |
560 | u32 reserved_0[4]; /*0000h*/ | ||
557 | 561 | ||
558 | u32 reserved_0[4]; /*0000h */ | 562 | u32 inbound_msg_0; /*0010h*/ |
563 | u32 inbound_msg_1; /*0014h*/ | ||
564 | u32 outbound_msg_0; /*0018h*/ | ||
565 | u32 outbound_msg_1; /*001Ch*/ | ||
559 | 566 | ||
560 | u32 inbound_msg_0; /*0010h */ | 567 | u32 inbound_doorbell; /*0020h*/ |
561 | u32 inbound_msg_1; /*0014h */ | 568 | u32 inbound_intr_status; /*0024h*/ |
562 | u32 outbound_msg_0; /*0018h */ | 569 | u32 inbound_intr_mask; /*0028h*/ |
563 | u32 outbound_msg_1; /*001Ch */ | ||
564 | 570 | ||
565 | u32 inbound_doorbell; /*0020h */ | 571 | u32 outbound_doorbell; /*002Ch*/ |
566 | u32 inbound_intr_status; /*0024h */ | 572 | u32 outbound_intr_status; /*0030h*/ |
567 | u32 inbound_intr_mask; /*0028h */ | 573 | u32 outbound_intr_mask; /*0034h*/ |
568 | 574 | ||
569 | u32 outbound_doorbell; /*002Ch */ | 575 | u32 reserved_1[2]; /*0038h*/ |
570 | u32 outbound_intr_status; /*0030h */ | ||
571 | u32 outbound_intr_mask; /*0034h */ | ||
572 | 576 | ||
573 | u32 reserved_1[2]; /*0038h */ | 577 | u32 inbound_queue_port; /*0040h*/ |
578 | u32 outbound_queue_port; /*0044h*/ | ||
574 | 579 | ||
575 | u32 inbound_queue_port; /*0040h */ | 580 | u32 reserved_2[22]; /*0048h*/ |
576 | u32 outbound_queue_port; /*0044h */ | ||
577 | 581 | ||
578 | u32 reserved_2; /*004Ch */ | 582 | u32 outbound_doorbell_clear; /*00A0h*/ |
579 | 583 | ||
580 | u32 index_registers[1004]; /*0050h */ | 584 | u32 reserved_3[3]; /*00A4h*/ |
585 | |||
586 | u32 outbound_scratch_pad ; /*00B0h*/ | ||
587 | |||
588 | u32 reserved_4[3]; /*00B4h*/ | ||
589 | |||
590 | u32 inbound_low_queue_port ; /*00C0h*/ | ||
591 | |||
592 | u32 inbound_high_queue_port ; /*00C4h*/ | ||
593 | |||
594 | u32 reserved_5; /*00C8h*/ | ||
595 | u32 index_registers[820]; /*00CCh*/ | ||
581 | 596 | ||
582 | } __attribute__ ((packed)); | 597 | } __attribute__ ((packed)); |
583 | 598 | ||
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 0c9edb7051f4..5609847e254a 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -275,10 +275,8 @@ static int aha152x_resume(struct pcmcia_device *dev) | |||
275 | 275 | ||
276 | link->state &= ~DEV_SUSPEND; | 276 | link->state &= ~DEV_SUSPEND; |
277 | if (link->state & DEV_CONFIG) { | 277 | if (link->state & DEV_CONFIG) { |
278 | Scsi_Cmnd tmp; | ||
279 | pcmcia_request_configuration(link->handle, &link->conf); | 278 | pcmcia_request_configuration(link->handle, &link->conf); |
280 | tmp.device->host = info->host; | 279 | aha152x_host_reset_host(info->host); |
281 | aha152x_host_reset(&tmp); | ||
282 | } | 280 | } |
283 | 281 | ||
284 | return 0; | 282 | return 0; |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index b17ee62dd1a9..92b3e13e9061 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include "qla_def.h" | 7 | #include "qla_def.h" |
8 | 8 | ||
9 | #include <linux/vmalloc.h> | 9 | #include <linux/vmalloc.h> |
10 | #include <scsi/scsi_transport_fc.h> | ||
11 | 10 | ||
12 | /* SYSFS attributes --------------------------------------------------------- */ | 11 | /* SYSFS attributes --------------------------------------------------------- */ |
13 | 12 | ||
@@ -114,7 +113,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | |||
114 | struct device, kobj))); | 113 | struct device, kobj))); |
115 | unsigned long flags; | 114 | unsigned long flags; |
116 | 115 | ||
117 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size) | 116 | if (!capable(CAP_SYS_ADMIN) || off != 0) |
118 | return 0; | 117 | return 0; |
119 | 118 | ||
120 | /* Read NVRAM. */ | 119 | /* Read NVRAM. */ |
@@ -123,7 +122,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | |||
123 | ha->nvram_size); | 122 | ha->nvram_size); |
124 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 123 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
125 | 124 | ||
126 | return (count); | 125 | return ha->nvram_size; |
127 | } | 126 | } |
128 | 127 | ||
129 | static ssize_t | 128 | static ssize_t |
@@ -175,19 +174,150 @@ static struct bin_attribute sysfs_nvram_attr = { | |||
175 | .mode = S_IRUSR | S_IWUSR, | 174 | .mode = S_IRUSR | S_IWUSR, |
176 | .owner = THIS_MODULE, | 175 | .owner = THIS_MODULE, |
177 | }, | 176 | }, |
178 | .size = 0, | 177 | .size = 512, |
179 | .read = qla2x00_sysfs_read_nvram, | 178 | .read = qla2x00_sysfs_read_nvram, |
180 | .write = qla2x00_sysfs_write_nvram, | 179 | .write = qla2x00_sysfs_write_nvram, |
181 | }; | 180 | }; |
182 | 181 | ||
182 | static ssize_t | ||
183 | qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | ||
184 | size_t count) | ||
185 | { | ||
186 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | ||
187 | struct device, kobj))); | ||
188 | |||
189 | if (ha->optrom_state != QLA_SREADING) | ||
190 | return 0; | ||
191 | if (off > ha->optrom_size) | ||
192 | return 0; | ||
193 | if (off + count > ha->optrom_size) | ||
194 | count = ha->optrom_size - off; | ||
195 | |||
196 | memcpy(buf, &ha->optrom_buffer[off], count); | ||
197 | |||
198 | return count; | ||
199 | } | ||
200 | |||
201 | static ssize_t | ||
202 | qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off, | ||
203 | size_t count) | ||
204 | { | ||
205 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | ||
206 | struct device, kobj))); | ||
207 | |||
208 | if (ha->optrom_state != QLA_SWRITING) | ||
209 | return -EINVAL; | ||
210 | if (off > ha->optrom_size) | ||
211 | return -ERANGE; | ||
212 | if (off + count > ha->optrom_size) | ||
213 | count = ha->optrom_size - off; | ||
214 | |||
215 | memcpy(&ha->optrom_buffer[off], buf, count); | ||
216 | |||
217 | return count; | ||
218 | } | ||
219 | |||
220 | static struct bin_attribute sysfs_optrom_attr = { | ||
221 | .attr = { | ||
222 | .name = "optrom", | ||
223 | .mode = S_IRUSR | S_IWUSR, | ||
224 | .owner = THIS_MODULE, | ||
225 | }, | ||
226 | .size = OPTROM_SIZE_24XX, | ||
227 | .read = qla2x00_sysfs_read_optrom, | ||
228 | .write = qla2x00_sysfs_write_optrom, | ||
229 | }; | ||
230 | |||
231 | static ssize_t | ||
232 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off, | ||
233 | size_t count) | ||
234 | { | ||
235 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | ||
236 | struct device, kobj))); | ||
237 | int val; | ||
238 | |||
239 | if (off) | ||
240 | return 0; | ||
241 | |||
242 | if (sscanf(buf, "%d", &val) != 1) | ||
243 | return -EINVAL; | ||
244 | |||
245 | switch (val) { | ||
246 | case 0: | ||
247 | if (ha->optrom_state != QLA_SREADING && | ||
248 | ha->optrom_state != QLA_SWRITING) | ||
249 | break; | ||
250 | |||
251 | ha->optrom_state = QLA_SWAITING; | ||
252 | vfree(ha->optrom_buffer); | ||
253 | ha->optrom_buffer = NULL; | ||
254 | break; | ||
255 | case 1: | ||
256 | if (ha->optrom_state != QLA_SWAITING) | ||
257 | break; | ||
258 | |||
259 | ha->optrom_state = QLA_SREADING; | ||
260 | ha->optrom_buffer = (uint8_t *)vmalloc(ha->optrom_size); | ||
261 | if (ha->optrom_buffer == NULL) { | ||
262 | qla_printk(KERN_WARNING, ha, | ||
263 | "Unable to allocate memory for optrom retrieval " | ||
264 | "(%x).\n", ha->optrom_size); | ||
265 | |||
266 | ha->optrom_state = QLA_SWAITING; | ||
267 | return count; | ||
268 | } | ||
269 | |||
270 | memset(ha->optrom_buffer, 0, ha->optrom_size); | ||
271 | ha->isp_ops.read_optrom(ha, ha->optrom_buffer, 0, | ||
272 | ha->optrom_size); | ||
273 | break; | ||
274 | case 2: | ||
275 | if (ha->optrom_state != QLA_SWAITING) | ||
276 | break; | ||
277 | |||
278 | ha->optrom_state = QLA_SWRITING; | ||
279 | ha->optrom_buffer = (uint8_t *)vmalloc(ha->optrom_size); | ||
280 | if (ha->optrom_buffer == NULL) { | ||
281 | qla_printk(KERN_WARNING, ha, | ||
282 | "Unable to allocate memory for optrom update " | ||
283 | "(%x).\n", ha->optrom_size); | ||
284 | |||
285 | ha->optrom_state = QLA_SWAITING; | ||
286 | return count; | ||
287 | } | ||
288 | memset(ha->optrom_buffer, 0, ha->optrom_size); | ||
289 | break; | ||
290 | case 3: | ||
291 | if (ha->optrom_state != QLA_SWRITING) | ||
292 | break; | ||
293 | |||
294 | ha->isp_ops.write_optrom(ha, ha->optrom_buffer, 0, | ||
295 | ha->optrom_size); | ||
296 | break; | ||
297 | } | ||
298 | return count; | ||
299 | } | ||
300 | |||
301 | static struct bin_attribute sysfs_optrom_ctl_attr = { | ||
302 | .attr = { | ||
303 | .name = "optrom_ctl", | ||
304 | .mode = S_IWUSR, | ||
305 | .owner = THIS_MODULE, | ||
306 | }, | ||
307 | .size = 0, | ||
308 | .write = qla2x00_sysfs_write_optrom_ctl, | ||
309 | }; | ||
310 | |||
183 | void | 311 | void |
184 | qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) | 312 | qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) |
185 | { | 313 | { |
186 | struct Scsi_Host *host = ha->host; | 314 | struct Scsi_Host *host = ha->host; |
187 | 315 | ||
188 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); | 316 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); |
189 | sysfs_nvram_attr.size = ha->nvram_size; | ||
190 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); | 317 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); |
318 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr); | ||
319 | sysfs_create_bin_file(&host->shost_gendev.kobj, | ||
320 | &sysfs_optrom_ctl_attr); | ||
191 | } | 321 | } |
192 | 322 | ||
193 | void | 323 | void |
@@ -197,6 +327,12 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) | |||
197 | 327 | ||
198 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); | 328 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); |
199 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); | 329 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); |
330 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr); | ||
331 | sysfs_remove_bin_file(&host->shost_gendev.kobj, | ||
332 | &sysfs_optrom_ctl_attr); | ||
333 | |||
334 | if (ha->beacon_blink_led == 1) | ||
335 | ha->isp_ops.beacon_off(ha); | ||
200 | } | 336 | } |
201 | 337 | ||
202 | /* Scsi_Host attributes. */ | 338 | /* Scsi_Host attributes. */ |
@@ -384,6 +520,50 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | |||
384 | return strlen(buf); | 520 | return strlen(buf); |
385 | } | 521 | } |
386 | 522 | ||
523 | static ssize_t | ||
524 | qla2x00_beacon_show(struct class_device *cdev, char *buf) | ||
525 | { | ||
526 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
527 | int len = 0; | ||
528 | |||
529 | if (ha->beacon_blink_led) | ||
530 | len += snprintf(buf + len, PAGE_SIZE-len, "Enabled\n"); | ||
531 | else | ||
532 | len += snprintf(buf + len, PAGE_SIZE-len, "Disabled\n"); | ||
533 | return len; | ||
534 | } | ||
535 | |||
536 | static ssize_t | ||
537 | qla2x00_beacon_store(struct class_device *cdev, const char *buf, | ||
538 | size_t count) | ||
539 | { | ||
540 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
541 | int val = 0; | ||
542 | int rval; | ||
543 | |||
544 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | ||
545 | return -EPERM; | ||
546 | |||
547 | if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) { | ||
548 | qla_printk(KERN_WARNING, ha, | ||
549 | "Abort ISP active -- ignoring beacon request.\n"); | ||
550 | return -EBUSY; | ||
551 | } | ||
552 | |||
553 | if (sscanf(buf, "%d", &val) != 1) | ||
554 | return -EINVAL; | ||
555 | |||
556 | if (val) | ||
557 | rval = ha->isp_ops.beacon_on(ha); | ||
558 | else | ||
559 | rval = ha->isp_ops.beacon_off(ha); | ||
560 | |||
561 | if (rval != QLA_SUCCESS) | ||
562 | count = 0; | ||
563 | |||
564 | return count; | ||
565 | } | ||
566 | |||
387 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 567 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, |
388 | NULL); | 568 | NULL); |
389 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 569 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
@@ -398,6 +578,8 @@ static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, | |||
398 | qla2x00_zio_store); | 578 | qla2x00_zio_store); |
399 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | 579 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, |
400 | qla2x00_zio_timer_store); | 580 | qla2x00_zio_timer_store); |
581 | static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, | ||
582 | qla2x00_beacon_store); | ||
401 | 583 | ||
402 | struct class_device_attribute *qla2x00_host_attrs[] = { | 584 | struct class_device_attribute *qla2x00_host_attrs[] = { |
403 | &class_device_attr_driver_version, | 585 | &class_device_attr_driver_version, |
@@ -411,6 +593,7 @@ struct class_device_attribute *qla2x00_host_attrs[] = { | |||
411 | &class_device_attr_state, | 593 | &class_device_attr_state, |
412 | &class_device_attr_zio, | 594 | &class_device_attr_zio, |
413 | &class_device_attr_zio_timer, | 595 | &class_device_attr_zio_timer, |
596 | &class_device_attr_beacon, | ||
414 | NULL, | 597 | NULL, |
415 | }; | 598 | }; |
416 | 599 | ||
@@ -426,6 +609,49 @@ qla2x00_get_host_port_id(struct Scsi_Host *shost) | |||
426 | } | 609 | } |
427 | 610 | ||
428 | static void | 611 | static void |
612 | qla2x00_get_host_speed(struct Scsi_Host *shost) | ||
613 | { | ||
614 | scsi_qla_host_t *ha = to_qla_host(shost); | ||
615 | uint32_t speed = 0; | ||
616 | |||
617 | switch (ha->link_data_rate) { | ||
618 | case LDR_1GB: | ||
619 | speed = 1; | ||
620 | break; | ||
621 | case LDR_2GB: | ||
622 | speed = 2; | ||
623 | break; | ||
624 | case LDR_4GB: | ||
625 | speed = 4; | ||
626 | break; | ||
627 | } | ||
628 | fc_host_speed(shost) = speed; | ||
629 | } | ||
630 | |||
631 | static void | ||
632 | qla2x00_get_host_port_type(struct Scsi_Host *shost) | ||
633 | { | ||
634 | scsi_qla_host_t *ha = to_qla_host(shost); | ||
635 | uint32_t port_type = FC_PORTTYPE_UNKNOWN; | ||
636 | |||
637 | switch (ha->current_topology) { | ||
638 | case ISP_CFG_NL: | ||
639 | port_type = FC_PORTTYPE_LPORT; | ||
640 | break; | ||
641 | case ISP_CFG_FL: | ||
642 | port_type = FC_PORTTYPE_NLPORT; | ||
643 | break; | ||
644 | case ISP_CFG_N: | ||
645 | port_type = FC_PORTTYPE_PTP; | ||
646 | break; | ||
647 | case ISP_CFG_F: | ||
648 | port_type = FC_PORTTYPE_NPORT; | ||
649 | break; | ||
650 | } | ||
651 | fc_host_port_type(shost) = port_type; | ||
652 | } | ||
653 | |||
654 | static void | ||
429 | qla2x00_get_starget_node_name(struct scsi_target *starget) | 655 | qla2x00_get_starget_node_name(struct scsi_target *starget) |
430 | { | 656 | { |
431 | struct Scsi_Host *host = dev_to_shost(starget->dev.parent); | 657 | struct Scsi_Host *host = dev_to_shost(starget->dev.parent); |
@@ -512,6 +738,41 @@ qla2x00_issue_lip(struct Scsi_Host *shost) | |||
512 | return 0; | 738 | return 0; |
513 | } | 739 | } |
514 | 740 | ||
741 | static struct fc_host_statistics * | ||
742 | qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | ||
743 | { | ||
744 | scsi_qla_host_t *ha = to_qla_host(shost); | ||
745 | int rval; | ||
746 | uint16_t mb_stat[1]; | ||
747 | link_stat_t stat_buf; | ||
748 | struct fc_host_statistics *pfc_host_stat; | ||
749 | |||
750 | pfc_host_stat = &ha->fc_host_stat; | ||
751 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); | ||
752 | |||
753 | if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { | ||
754 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, | ||
755 | sizeof(stat_buf) / 4, mb_stat); | ||
756 | } else { | ||
757 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, | ||
758 | mb_stat); | ||
759 | } | ||
760 | if (rval != 0) { | ||
761 | qla_printk(KERN_WARNING, ha, | ||
762 | "Unable to retrieve host statistics (%d).\n", mb_stat[0]); | ||
763 | return pfc_host_stat; | ||
764 | } | ||
765 | |||
766 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; | ||
767 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; | ||
768 | pfc_host_stat->loss_of_signal_count = stat_buf.loss_sig_cnt; | ||
769 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; | ||
770 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; | ||
771 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; | ||
772 | |||
773 | return pfc_host_stat; | ||
774 | } | ||
775 | |||
515 | struct fc_function_template qla2xxx_transport_functions = { | 776 | struct fc_function_template qla2xxx_transport_functions = { |
516 | 777 | ||
517 | .show_host_node_name = 1, | 778 | .show_host_node_name = 1, |
@@ -520,6 +781,10 @@ struct fc_function_template qla2xxx_transport_functions = { | |||
520 | 781 | ||
521 | .get_host_port_id = qla2x00_get_host_port_id, | 782 | .get_host_port_id = qla2x00_get_host_port_id, |
522 | .show_host_port_id = 1, | 783 | .show_host_port_id = 1, |
784 | .get_host_speed = qla2x00_get_host_speed, | ||
785 | .show_host_speed = 1, | ||
786 | .get_host_port_type = qla2x00_get_host_port_type, | ||
787 | .show_host_port_type = 1, | ||
523 | 788 | ||
524 | .dd_fcrport_size = sizeof(struct fc_port *), | 789 | .dd_fcrport_size = sizeof(struct fc_port *), |
525 | .show_rport_supported_classes = 1, | 790 | .show_rport_supported_classes = 1, |
@@ -536,6 +801,7 @@ struct fc_function_template qla2xxx_transport_functions = { | |||
536 | .show_rport_dev_loss_tmo = 1, | 801 | .show_rport_dev_loss_tmo = 1, |
537 | 802 | ||
538 | .issue_fc_host_lip = qla2x00_issue_lip, | 803 | .issue_fc_host_lip = qla2x00_issue_lip, |
804 | .get_fc_host_stats = qla2x00_get_fc_host_stats, | ||
539 | }; | 805 | }; |
540 | 806 | ||
541 | void | 807 | void |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index bad066e5772a..b31a03bbd14f 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <scsi/scsi_host.h> | 29 | #include <scsi/scsi_host.h> |
30 | #include <scsi/scsi_device.h> | 30 | #include <scsi/scsi_device.h> |
31 | #include <scsi/scsi_cmnd.h> | 31 | #include <scsi/scsi_cmnd.h> |
32 | #include <scsi/scsi_transport_fc.h> | ||
32 | 33 | ||
33 | #if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE) | 34 | #if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE) |
34 | #if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE) | 35 | #if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE) |
@@ -181,6 +182,13 @@ | |||
181 | #define WRT_REG_DWORD(addr, data) writel(data,addr) | 182 | #define WRT_REG_DWORD(addr, data) writel(data,addr) |
182 | 183 | ||
183 | /* | 184 | /* |
185 | * The ISP2312 v2 chip cannot access the FLASH/GPIO registers via MMIO in an | ||
186 | * 133Mhz slot. | ||
187 | */ | ||
188 | #define RD_REG_WORD_PIO(addr) (inw((unsigned long)addr)) | ||
189 | #define WRT_REG_WORD_PIO(addr, data) (outw(data,(unsigned long)addr)) | ||
190 | |||
191 | /* | ||
184 | * Fibre Channel device definitions. | 192 | * Fibre Channel device definitions. |
185 | */ | 193 | */ |
186 | #define WWN_SIZE 8 /* Size of WWPN, WWN & WWNN */ | 194 | #define WWN_SIZE 8 /* Size of WWPN, WWN & WWNN */ |
@@ -432,6 +440,9 @@ struct device_reg_2xxx { | |||
432 | #define GPIO_LED_GREEN_ON_AMBER_OFF 0x0040 | 440 | #define GPIO_LED_GREEN_ON_AMBER_OFF 0x0040 |
433 | #define GPIO_LED_GREEN_OFF_AMBER_ON 0x0080 | 441 | #define GPIO_LED_GREEN_OFF_AMBER_ON 0x0080 |
434 | #define GPIO_LED_GREEN_ON_AMBER_ON 0x00C0 | 442 | #define GPIO_LED_GREEN_ON_AMBER_ON 0x00C0 |
443 | #define GPIO_LED_ALL_OFF 0x0000 | ||
444 | #define GPIO_LED_RED_ON_OTHER_OFF 0x0001 /* isp2322 */ | ||
445 | #define GPIO_LED_RGA_ON 0x00C1 /* isp2322: red green amber */ | ||
435 | 446 | ||
436 | union { | 447 | union { |
437 | struct { | 448 | struct { |
@@ -2199,6 +2210,15 @@ struct isp_operations { | |||
2199 | 2210 | ||
2200 | void (*fw_dump) (struct scsi_qla_host *, int); | 2211 | void (*fw_dump) (struct scsi_qla_host *, int); |
2201 | void (*ascii_fw_dump) (struct scsi_qla_host *); | 2212 | void (*ascii_fw_dump) (struct scsi_qla_host *); |
2213 | |||
2214 | int (*beacon_on) (struct scsi_qla_host *); | ||
2215 | int (*beacon_off) (struct scsi_qla_host *); | ||
2216 | void (*beacon_blink) (struct scsi_qla_host *); | ||
2217 | |||
2218 | uint8_t * (*read_optrom) (struct scsi_qla_host *, uint8_t *, | ||
2219 | uint32_t, uint32_t); | ||
2220 | int (*write_optrom) (struct scsi_qla_host *, uint8_t *, uint32_t, | ||
2221 | uint32_t); | ||
2202 | }; | 2222 | }; |
2203 | 2223 | ||
2204 | /* | 2224 | /* |
@@ -2331,6 +2351,10 @@ typedef struct scsi_qla_host { | |||
2331 | uint16_t min_external_loopid; /* First external loop Id */ | 2351 | uint16_t min_external_loopid; /* First external loop Id */ |
2332 | 2352 | ||
2333 | uint16_t link_data_rate; /* F/W operating speed */ | 2353 | uint16_t link_data_rate; /* F/W operating speed */ |
2354 | #define LDR_1GB 0 | ||
2355 | #define LDR_2GB 1 | ||
2356 | #define LDR_4GB 3 | ||
2357 | #define LDR_UNKNOWN 0xFFFF | ||
2334 | 2358 | ||
2335 | uint8_t current_topology; | 2359 | uint8_t current_topology; |
2336 | uint8_t prev_topology; | 2360 | uint8_t prev_topology; |
@@ -2486,12 +2510,26 @@ typedef struct scsi_qla_host { | |||
2486 | uint8_t *port_name; | 2510 | uint8_t *port_name; |
2487 | uint32_t isp_abort_cnt; | 2511 | uint32_t isp_abort_cnt; |
2488 | 2512 | ||
2513 | /* Option ROM information. */ | ||
2514 | char *optrom_buffer; | ||
2515 | uint32_t optrom_size; | ||
2516 | int optrom_state; | ||
2517 | #define QLA_SWAITING 0 | ||
2518 | #define QLA_SREADING 1 | ||
2519 | #define QLA_SWRITING 2 | ||
2520 | |||
2489 | /* Needed for BEACON */ | 2521 | /* Needed for BEACON */ |
2490 | uint16_t beacon_blink_led; | 2522 | uint16_t beacon_blink_led; |
2491 | uint16_t beacon_green_on; | 2523 | uint8_t beacon_color_state; |
2524 | #define QLA_LED_GRN_ON 0x01 | ||
2525 | #define QLA_LED_YLW_ON 0x02 | ||
2526 | #define QLA_LED_ABR_ON 0x04 | ||
2527 | #define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */ | ||
2528 | /* ISP2322: red, green, amber. */ | ||
2492 | 2529 | ||
2493 | uint16_t zio_mode; | 2530 | uint16_t zio_mode; |
2494 | uint16_t zio_timer; | 2531 | uint16_t zio_timer; |
2532 | struct fc_host_statistics fc_host_stat; | ||
2495 | } scsi_qla_host_t; | 2533 | } scsi_qla_host_t; |
2496 | 2534 | ||
2497 | 2535 | ||
@@ -2557,7 +2595,9 @@ struct _qla2x00stats { | |||
2557 | /* | 2595 | /* |
2558 | * Flash support definitions | 2596 | * Flash support definitions |
2559 | */ | 2597 | */ |
2560 | #define FLASH_IMAGE_SIZE 131072 | 2598 | #define OPTROM_SIZE_2300 0x20000 |
2599 | #define OPTROM_SIZE_2322 0x100000 | ||
2600 | #define OPTROM_SIZE_24XX 0x100000 | ||
2561 | 2601 | ||
2562 | #include "qla_gbl.h" | 2602 | #include "qla_gbl.h" |
2563 | #include "qla_dbg.h" | 2603 | #include "qla_dbg.h" |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 35266bd5d538..ffdc2680f049 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -75,12 +75,12 @@ extern void qla2x00_cmd_timeout(srb_t *); | |||
75 | extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); | 75 | extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); |
76 | extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); | 76 | extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); |
77 | 77 | ||
78 | extern void qla2x00_blink_led(scsi_qla_host_t *); | ||
79 | |||
80 | extern int qla2x00_down_timeout(struct semaphore *, unsigned long); | 78 | extern int qla2x00_down_timeout(struct semaphore *, unsigned long); |
81 | 79 | ||
82 | extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *); | 80 | extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *); |
83 | 81 | ||
82 | extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *); | ||
83 | |||
84 | /* | 84 | /* |
85 | * Global Function Prototypes in qla_iocb.c source file. | 85 | * Global Function Prototypes in qla_iocb.c source file. |
86 | */ | 86 | */ |
@@ -185,6 +185,13 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *, | |||
185 | extern int | 185 | extern int |
186 | qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); | 186 | qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); |
187 | 187 | ||
188 | extern int | ||
189 | qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *, | ||
190 | uint16_t *); | ||
191 | |||
192 | extern int | ||
193 | qla24xx_get_isp_stats(scsi_qla_host_t *, uint32_t *, uint32_t, uint16_t *); | ||
194 | |||
188 | extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); | 195 | extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); |
189 | extern int qla24xx_abort_target(fc_port_t *); | 196 | extern int qla24xx_abort_target(fc_port_t *); |
190 | 197 | ||
@@ -228,6 +235,22 @@ extern int qla2x00_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, | |||
228 | extern int qla24xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, | 235 | extern int qla24xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, |
229 | uint32_t); | 236 | uint32_t); |
230 | 237 | ||
238 | extern int qla2x00_beacon_on(struct scsi_qla_host *); | ||
239 | extern int qla2x00_beacon_off(struct scsi_qla_host *); | ||
240 | extern void qla2x00_beacon_blink(struct scsi_qla_host *); | ||
241 | extern int qla24xx_beacon_on(struct scsi_qla_host *); | ||
242 | extern int qla24xx_beacon_off(struct scsi_qla_host *); | ||
243 | extern void qla24xx_beacon_blink(struct scsi_qla_host *); | ||
244 | |||
245 | extern uint8_t *qla2x00_read_optrom_data(struct scsi_qla_host *, uint8_t *, | ||
246 | uint32_t, uint32_t); | ||
247 | extern int qla2x00_write_optrom_data(struct scsi_qla_host *, uint8_t *, | ||
248 | uint32_t, uint32_t); | ||
249 | extern uint8_t *qla24xx_read_optrom_data(struct scsi_qla_host *, uint8_t *, | ||
250 | uint32_t, uint32_t); | ||
251 | extern int qla24xx_write_optrom_data(struct scsi_qla_host *, uint8_t *, | ||
252 | uint32_t, uint32_t); | ||
253 | |||
231 | /* | 254 | /* |
232 | * Global Function Prototypes in qla_dbg.c source file. | 255 | * Global Function Prototypes in qla_dbg.c source file. |
233 | */ | 256 | */ |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index e67bb0997818..634ee174bff2 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
11 | #include <scsi/scsi_transport_fc.h> | ||
12 | 11 | ||
13 | #include "qla_devtbl.h" | 12 | #include "qla_devtbl.h" |
14 | 13 | ||
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 7ec0b8d6f07b..6544b6d0891d 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -814,6 +814,7 @@ qla24xx_start_scsi(srb_t *sp) | |||
814 | cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; | 814 | cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; |
815 | 815 | ||
816 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); | 816 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); |
817 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); | ||
817 | 818 | ||
818 | /* Load SCSI command packet. */ | 819 | /* Load SCSI command packet. */ |
819 | memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); | 820 | memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 71a46fcee8cc..42aa7a7c1a73 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -402,9 +402,9 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
402 | break; | 402 | break; |
403 | 403 | ||
404 | case MBA_LOOP_UP: /* Loop Up Event */ | 404 | case MBA_LOOP_UP: /* Loop Up Event */ |
405 | ha->link_data_rate = 0; | ||
406 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { | 405 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { |
407 | link_speed = link_speeds[0]; | 406 | link_speed = link_speeds[0]; |
407 | ha->link_data_rate = LDR_1GB; | ||
408 | } else { | 408 | } else { |
409 | link_speed = link_speeds[LS_UNKNOWN]; | 409 | link_speed = link_speeds[LS_UNKNOWN]; |
410 | if (mb[1] < 5) | 410 | if (mb[1] < 5) |
@@ -436,7 +436,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
436 | } | 436 | } |
437 | 437 | ||
438 | ha->flags.management_server_logged_in = 0; | 438 | ha->flags.management_server_logged_in = 0; |
439 | ha->link_data_rate = 0; | 439 | ha->link_data_rate = LDR_UNKNOWN; |
440 | if (ql2xfdmienable) | 440 | if (ql2xfdmienable) |
441 | set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags); | 441 | set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags); |
442 | 442 | ||
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 3099b379de9d..363dfdd042b0 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include "qla_def.h" | 7 | #include "qla_def.h" |
8 | 8 | ||
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | #include <scsi/scsi_transport_fc.h> | ||
11 | 10 | ||
12 | static void | 11 | static void |
13 | qla2x00_mbx_sem_timeout(unsigned long data) | 12 | qla2x00_mbx_sem_timeout(unsigned long data) |
@@ -1874,7 +1873,8 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, | |||
1874 | mcp->mb[3] = LSW(id_list_dma); | 1873 | mcp->mb[3] = LSW(id_list_dma); |
1875 | mcp->mb[6] = MSW(MSD(id_list_dma)); | 1874 | mcp->mb[6] = MSW(MSD(id_list_dma)); |
1876 | mcp->mb[7] = LSW(MSD(id_list_dma)); | 1875 | mcp->mb[7] = LSW(MSD(id_list_dma)); |
1877 | mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2; | 1876 | mcp->mb[8] = 0; |
1877 | mcp->out_mb |= MBX_8|MBX_7|MBX_6|MBX_3|MBX_2; | ||
1878 | } else { | 1878 | } else { |
1879 | mcp->mb[1] = MSW(id_list_dma); | 1879 | mcp->mb[1] = MSW(id_list_dma); |
1880 | mcp->mb[2] = LSW(id_list_dma); | 1880 | mcp->mb[2] = LSW(id_list_dma); |
@@ -2017,8 +2017,109 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) | |||
2017 | 2017 | ||
2018 | return rval; | 2018 | return rval; |
2019 | } | 2019 | } |
2020 | #endif | ||
2021 | |||
2022 | /* | ||
2023 | * qla2x00_get_link_status | ||
2024 | * | ||
2025 | * Input: | ||
2026 | * ha = adapter block pointer. | ||
2027 | * loop_id = device loop ID. | ||
2028 | * ret_buf = pointer to link status return buffer. | ||
2029 | * | ||
2030 | * Returns: | ||
2031 | * 0 = success. | ||
2032 | * BIT_0 = mem alloc error. | ||
2033 | * BIT_1 = mailbox error. | ||
2034 | */ | ||
2035 | int | ||
2036 | qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, | ||
2037 | link_stat_t *ret_buf, uint16_t *status) | ||
2038 | { | ||
2039 | int rval; | ||
2040 | mbx_cmd_t mc; | ||
2041 | mbx_cmd_t *mcp = &mc; | ||
2042 | link_stat_t *stat_buf; | ||
2043 | dma_addr_t stat_buf_dma; | ||
2044 | |||
2045 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) | ||
2046 | |||
2047 | stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma); | ||
2048 | if (stat_buf == NULL) { | ||
2049 | DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", | ||
2050 | __func__, ha->host_no)); | ||
2051 | return BIT_0; | ||
2052 | } | ||
2053 | memset(stat_buf, 0, sizeof(link_stat_t)); | ||
2054 | |||
2055 | mcp->mb[0] = MBC_GET_LINK_STATUS; | ||
2056 | mcp->mb[2] = MSW(stat_buf_dma); | ||
2057 | mcp->mb[3] = LSW(stat_buf_dma); | ||
2058 | mcp->mb[6] = MSW(MSD(stat_buf_dma)); | ||
2059 | mcp->mb[7] = LSW(MSD(stat_buf_dma)); | ||
2060 | mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | ||
2061 | mcp->in_mb = MBX_0; | ||
2062 | if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { | ||
2063 | mcp->mb[1] = loop_id; | ||
2064 | mcp->mb[4] = 0; | ||
2065 | mcp->mb[10] = 0; | ||
2066 | mcp->out_mb |= MBX_10|MBX_4|MBX_1; | ||
2067 | mcp->in_mb |= MBX_1; | ||
2068 | } else if (HAS_EXTENDED_IDS(ha)) { | ||
2069 | mcp->mb[1] = loop_id; | ||
2070 | mcp->mb[10] = 0; | ||
2071 | mcp->out_mb |= MBX_10|MBX_1; | ||
2072 | } else { | ||
2073 | mcp->mb[1] = loop_id << 8; | ||
2074 | mcp->out_mb |= MBX_1; | ||
2075 | } | ||
2076 | mcp->tov = 30; | ||
2077 | mcp->flags = IOCTL_CMD; | ||
2078 | rval = qla2x00_mailbox_command(ha, mcp); | ||
2079 | |||
2080 | if (rval == QLA_SUCCESS) { | ||
2081 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { | ||
2082 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", | ||
2083 | __func__, ha->host_no, mcp->mb[0]);) | ||
2084 | status[0] = mcp->mb[0]; | ||
2085 | rval = BIT_1; | ||
2086 | } else { | ||
2087 | /* copy over data -- firmware data is LE. */ | ||
2088 | ret_buf->link_fail_cnt = | ||
2089 | le32_to_cpu(stat_buf->link_fail_cnt); | ||
2090 | ret_buf->loss_sync_cnt = | ||
2091 | le32_to_cpu(stat_buf->loss_sync_cnt); | ||
2092 | ret_buf->loss_sig_cnt = | ||
2093 | le32_to_cpu(stat_buf->loss_sig_cnt); | ||
2094 | ret_buf->prim_seq_err_cnt = | ||
2095 | le32_to_cpu(stat_buf->prim_seq_err_cnt); | ||
2096 | ret_buf->inval_xmit_word_cnt = | ||
2097 | le32_to_cpu(stat_buf->inval_xmit_word_cnt); | ||
2098 | ret_buf->inval_crc_cnt = | ||
2099 | le32_to_cpu(stat_buf->inval_crc_cnt); | ||
2100 | |||
2101 | DEBUG11(printk("%s(%ld): stat dump: fail_cnt=%d " | ||
2102 | "loss_sync=%d loss_sig=%d seq_err=%d " | ||
2103 | "inval_xmt_word=%d inval_crc=%d.\n", __func__, | ||
2104 | ha->host_no, stat_buf->link_fail_cnt, | ||
2105 | stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt, | ||
2106 | stat_buf->prim_seq_err_cnt, | ||
2107 | stat_buf->inval_xmit_word_cnt, | ||
2108 | stat_buf->inval_crc_cnt);) | ||
2109 | } | ||
2110 | } else { | ||
2111 | /* Failed. */ | ||
2112 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | ||
2113 | ha->host_no, rval);) | ||
2114 | rval = BIT_1; | ||
2115 | } | ||
2116 | |||
2117 | dma_pool_free(ha->s_dma_pool, stat_buf, stat_buf_dma); | ||
2020 | 2118 | ||
2021 | uint8_t | 2119 | return rval; |
2120 | } | ||
2121 | |||
2122 | int | ||
2022 | qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, | 2123 | qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, |
2023 | uint16_t *status) | 2124 | uint16_t *status) |
2024 | { | 2125 | { |
@@ -2080,7 +2181,6 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, | |||
2080 | 2181 | ||
2081 | return rval; | 2182 | return rval; |
2082 | } | 2183 | } |
2083 | #endif | ||
2084 | 2184 | ||
2085 | int | 2185 | int |
2086 | qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) | 2186 | qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 5866a7c706a8..9f91f1a20542 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -366,6 +366,12 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
366 | goto qc_fail_command; | 366 | goto qc_fail_command; |
367 | } | 367 | } |
368 | 368 | ||
369 | /* Close window on fcport/rport state-transitioning. */ | ||
370 | if (!*(fc_port_t **)rport->dd_data) { | ||
371 | cmd->result = DID_IMM_RETRY << 16; | ||
372 | goto qc_fail_command; | ||
373 | } | ||
374 | |||
369 | if (atomic_read(&fcport->state) != FCS_ONLINE) { | 375 | if (atomic_read(&fcport->state) != FCS_ONLINE) { |
370 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || | 376 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || |
371 | atomic_read(&ha->loop_state) == LOOP_DEAD) { | 377 | atomic_read(&ha->loop_state) == LOOP_DEAD) { |
@@ -421,6 +427,12 @@ qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
421 | goto qc24_fail_command; | 427 | goto qc24_fail_command; |
422 | } | 428 | } |
423 | 429 | ||
430 | /* Close window on fcport/rport state-transitioning. */ | ||
431 | if (!*(fc_port_t **)rport->dd_data) { | ||
432 | cmd->result = DID_IMM_RETRY << 16; | ||
433 | goto qc24_fail_command; | ||
434 | } | ||
435 | |||
424 | if (atomic_read(&fcport->state) != FCS_ONLINE) { | 436 | if (atomic_read(&fcport->state) != FCS_ONLINE) { |
425 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || | 437 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || |
426 | atomic_read(&ha->loop_state) == LOOP_DEAD) { | 438 | atomic_read(&ha->loop_state) == LOOP_DEAD) { |
@@ -513,7 +525,7 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) | |||
513 | * Success (Adapter is online) : 0 | 525 | * Success (Adapter is online) : 0 |
514 | * Failed (Adapter is offline/disabled) : 1 | 526 | * Failed (Adapter is offline/disabled) : 1 |
515 | */ | 527 | */ |
516 | static int | 528 | int |
517 | qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) | 529 | qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) |
518 | { | 530 | { |
519 | int return_status; | 531 | int return_status; |
@@ -1312,6 +1324,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1312 | ha->ports = MAX_BUSES; | 1324 | ha->ports = MAX_BUSES; |
1313 | ha->init_cb_size = sizeof(init_cb_t); | 1325 | ha->init_cb_size = sizeof(init_cb_t); |
1314 | ha->mgmt_svr_loop_id = MANAGEMENT_SERVER; | 1326 | ha->mgmt_svr_loop_id = MANAGEMENT_SERVER; |
1327 | ha->link_data_rate = LDR_UNKNOWN; | ||
1328 | ha->optrom_size = OPTROM_SIZE_2300; | ||
1315 | 1329 | ||
1316 | /* Assign ISP specific operations. */ | 1330 | /* Assign ISP specific operations. */ |
1317 | ha->isp_ops.pci_config = qla2100_pci_config; | 1331 | ha->isp_ops.pci_config = qla2100_pci_config; |
@@ -1339,6 +1353,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1339 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; | 1353 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; |
1340 | ha->isp_ops.fw_dump = qla2100_fw_dump; | 1354 | ha->isp_ops.fw_dump = qla2100_fw_dump; |
1341 | ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump; | 1355 | ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump; |
1356 | ha->isp_ops.read_optrom = qla2x00_read_optrom_data; | ||
1357 | ha->isp_ops.write_optrom = qla2x00_write_optrom_data; | ||
1342 | if (IS_QLA2100(ha)) { | 1358 | if (IS_QLA2100(ha)) { |
1343 | host->max_id = MAX_TARGETS_2100; | 1359 | host->max_id = MAX_TARGETS_2100; |
1344 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; | 1360 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; |
@@ -1364,7 +1380,12 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1364 | ha->isp_ops.intr_handler = qla2300_intr_handler; | 1380 | ha->isp_ops.intr_handler = qla2300_intr_handler; |
1365 | ha->isp_ops.fw_dump = qla2300_fw_dump; | 1381 | ha->isp_ops.fw_dump = qla2300_fw_dump; |
1366 | ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump; | 1382 | ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump; |
1383 | ha->isp_ops.beacon_on = qla2x00_beacon_on; | ||
1384 | ha->isp_ops.beacon_off = qla2x00_beacon_off; | ||
1385 | ha->isp_ops.beacon_blink = qla2x00_beacon_blink; | ||
1367 | ha->gid_list_info_size = 6; | 1386 | ha->gid_list_info_size = 6; |
1387 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) | ||
1388 | ha->optrom_size = OPTROM_SIZE_2322; | ||
1368 | } else if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { | 1389 | } else if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { |
1369 | host->max_id = MAX_TARGETS_2200; | 1390 | host->max_id = MAX_TARGETS_2200; |
1370 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | 1391 | ha->mbx_count = MAILBOX_REGISTER_COUNT; |
@@ -1400,7 +1421,13 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1400 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; | 1421 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; |
1401 | ha->isp_ops.fw_dump = qla24xx_fw_dump; | 1422 | ha->isp_ops.fw_dump = qla24xx_fw_dump; |
1402 | ha->isp_ops.ascii_fw_dump = qla24xx_ascii_fw_dump; | 1423 | ha->isp_ops.ascii_fw_dump = qla24xx_ascii_fw_dump; |
1424 | ha->isp_ops.read_optrom = qla24xx_read_optrom_data; | ||
1425 | ha->isp_ops.write_optrom = qla24xx_write_optrom_data; | ||
1426 | ha->isp_ops.beacon_on = qla24xx_beacon_on; | ||
1427 | ha->isp_ops.beacon_off = qla24xx_beacon_off; | ||
1428 | ha->isp_ops.beacon_blink = qla24xx_beacon_blink; | ||
1403 | ha->gid_list_info_size = 8; | 1429 | ha->gid_list_info_size = 8; |
1430 | ha->optrom_size = OPTROM_SIZE_24XX; | ||
1404 | } | 1431 | } |
1405 | host->can_queue = ha->request_q_length + 128; | 1432 | host->can_queue = ha->request_q_length + 128; |
1406 | 1433 | ||
@@ -1657,11 +1684,13 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport, | |||
1657 | spin_lock_irqsave(&fcport->rport_lock, flags); | 1684 | spin_lock_irqsave(&fcport->rport_lock, flags); |
1658 | fcport->drport = rport; | 1685 | fcport->drport = rport; |
1659 | fcport->rport = NULL; | 1686 | fcport->rport = NULL; |
1687 | *(fc_port_t **)rport->dd_data = NULL; | ||
1660 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | 1688 | spin_unlock_irqrestore(&fcport->rport_lock, flags); |
1661 | set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags); | 1689 | set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags); |
1662 | } else { | 1690 | } else { |
1663 | spin_lock_irqsave(&fcport->rport_lock, flags); | 1691 | spin_lock_irqsave(&fcport->rport_lock, flags); |
1664 | fcport->rport = NULL; | 1692 | fcport->rport = NULL; |
1693 | *(fc_port_t **)rport->dd_data = NULL; | ||
1665 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | 1694 | spin_unlock_irqrestore(&fcport->rport_lock, flags); |
1666 | fc_remote_port_delete(rport); | 1695 | fc_remote_port_delete(rport); |
1667 | } | 1696 | } |
@@ -2066,6 +2095,8 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2066 | ha->fw_dumped = 0; | 2095 | ha->fw_dumped = 0; |
2067 | ha->fw_dump_reading = 0; | 2096 | ha->fw_dump_reading = 0; |
2068 | ha->fw_dump_buffer = NULL; | 2097 | ha->fw_dump_buffer = NULL; |
2098 | |||
2099 | vfree(ha->optrom_buffer); | ||
2069 | } | 2100 | } |
2070 | 2101 | ||
2071 | /* | 2102 | /* |
@@ -2314,6 +2345,9 @@ qla2x00_do_dpc(void *data) | |||
2314 | if (!ha->interrupts_on) | 2345 | if (!ha->interrupts_on) |
2315 | ha->isp_ops.enable_intrs(ha); | 2346 | ha->isp_ops.enable_intrs(ha); |
2316 | 2347 | ||
2348 | if (test_and_clear_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags)) | ||
2349 | ha->isp_ops.beacon_blink(ha); | ||
2350 | |||
2317 | ha->dpc_active = 0; | 2351 | ha->dpc_active = 0; |
2318 | } /* End of while(1) */ | 2352 | } /* End of while(1) */ |
2319 | 2353 | ||
@@ -2491,6 +2525,12 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2491 | atomic_read(&ha->loop_down_timer))); | 2525 | atomic_read(&ha->loop_down_timer))); |
2492 | } | 2526 | } |
2493 | 2527 | ||
2528 | /* Check if beacon LED needs to be blinked */ | ||
2529 | if (ha->beacon_blink_led == 1) { | ||
2530 | set_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags); | ||
2531 | start_dpc++; | ||
2532 | } | ||
2533 | |||
2494 | /* Schedule the DPC routine if needed */ | 2534 | /* Schedule the DPC routine if needed */ |
2495 | if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || | 2535 | if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || |
2496 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || | 2536 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || |
@@ -2499,6 +2539,7 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2499 | start_dpc || | 2539 | start_dpc || |
2500 | test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) || | 2540 | test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) || |
2501 | test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || | 2541 | test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || |
2542 | test_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags) || | ||
2502 | test_bit(RELOGIN_NEEDED, &ha->dpc_flags)) && | 2543 | test_bit(RELOGIN_NEEDED, &ha->dpc_flags)) && |
2503 | ha->dpc_wait && !ha->dpc_active) { | 2544 | ha->dpc_wait && !ha->dpc_active) { |
2504 | 2545 | ||
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c index 2c3342108dd8..b70bebe18c01 100644 --- a/drivers/scsi/qla2xxx/qla_rscn.c +++ b/drivers/scsi/qla2xxx/qla_rscn.c | |||
@@ -6,8 +6,6 @@ | |||
6 | */ | 6 | */ |
7 | #include "qla_def.h" | 7 | #include "qla_def.h" |
8 | 8 | ||
9 | #include <scsi/scsi_transport_fc.h> | ||
10 | |||
11 | /** | 9 | /** |
12 | * IO descriptor handle definitions. | 10 | * IO descriptor handle definitions. |
13 | * | 11 | * |
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index f4d755a643e4..3866a5760f15 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -695,3 +695,966 @@ qla24xx_write_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr, | |||
695 | 695 | ||
696 | return ret; | 696 | return ret; |
697 | } | 697 | } |
698 | |||
699 | |||
700 | static inline void | ||
701 | qla2x00_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags) | ||
702 | { | ||
703 | if (IS_QLA2322(ha)) { | ||
704 | /* Flip all colors. */ | ||
705 | if (ha->beacon_color_state == QLA_LED_ALL_ON) { | ||
706 | /* Turn off. */ | ||
707 | ha->beacon_color_state = 0; | ||
708 | *pflags = GPIO_LED_ALL_OFF; | ||
709 | } else { | ||
710 | /* Turn on. */ | ||
711 | ha->beacon_color_state = QLA_LED_ALL_ON; | ||
712 | *pflags = GPIO_LED_RGA_ON; | ||
713 | } | ||
714 | } else { | ||
715 | /* Flip green led only. */ | ||
716 | if (ha->beacon_color_state == QLA_LED_GRN_ON) { | ||
717 | /* Turn off. */ | ||
718 | ha->beacon_color_state = 0; | ||
719 | *pflags = GPIO_LED_GREEN_OFF_AMBER_OFF; | ||
720 | } else { | ||
721 | /* Turn on. */ | ||
722 | ha->beacon_color_state = QLA_LED_GRN_ON; | ||
723 | *pflags = GPIO_LED_GREEN_ON_AMBER_OFF; | ||
724 | } | ||
725 | } | ||
726 | } | ||
727 | |||
728 | void | ||
729 | qla2x00_beacon_blink(struct scsi_qla_host *ha) | ||
730 | { | ||
731 | uint16_t gpio_enable; | ||
732 | uint16_t gpio_data; | ||
733 | uint16_t led_color = 0; | ||
734 | unsigned long flags; | ||
735 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
736 | |||
737 | if (ha->pio_address) | ||
738 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | ||
739 | |||
740 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
741 | |||
742 | /* Save the Original GPIOE. */ | ||
743 | if (ha->pio_address) { | ||
744 | gpio_enable = RD_REG_WORD_PIO(®->gpioe); | ||
745 | gpio_data = RD_REG_WORD_PIO(®->gpiod); | ||
746 | } else { | ||
747 | gpio_enable = RD_REG_WORD(®->gpioe); | ||
748 | gpio_data = RD_REG_WORD(®->gpiod); | ||
749 | } | ||
750 | |||
751 | /* Set the modified gpio_enable values */ | ||
752 | gpio_enable |= GPIO_LED_MASK; | ||
753 | |||
754 | if (ha->pio_address) { | ||
755 | WRT_REG_WORD_PIO(®->gpioe, gpio_enable); | ||
756 | } else { | ||
757 | WRT_REG_WORD(®->gpioe, gpio_enable); | ||
758 | RD_REG_WORD(®->gpioe); | ||
759 | } | ||
760 | |||
761 | qla2x00_flip_colors(ha, &led_color); | ||
762 | |||
763 | /* Clear out any previously set LED color. */ | ||
764 | gpio_data &= ~GPIO_LED_MASK; | ||
765 | |||
766 | /* Set the new input LED color to GPIOD. */ | ||
767 | gpio_data |= led_color; | ||
768 | |||
769 | /* Set the modified gpio_data values */ | ||
770 | if (ha->pio_address) { | ||
771 | WRT_REG_WORD_PIO(®->gpiod, gpio_data); | ||
772 | } else { | ||
773 | WRT_REG_WORD(®->gpiod, gpio_data); | ||
774 | RD_REG_WORD(®->gpiod); | ||
775 | } | ||
776 | |||
777 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
778 | } | ||
779 | |||
780 | int | ||
781 | qla2x00_beacon_on(struct scsi_qla_host *ha) | ||
782 | { | ||
783 | uint16_t gpio_enable; | ||
784 | uint16_t gpio_data; | ||
785 | unsigned long flags; | ||
786 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
787 | |||
788 | ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING; | ||
789 | ha->fw_options[1] |= FO1_DISABLE_GPIO6_7; | ||
790 | |||
791 | if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) { | ||
792 | qla_printk(KERN_WARNING, ha, | ||
793 | "Unable to update fw options (beacon on).\n"); | ||
794 | return QLA_FUNCTION_FAILED; | ||
795 | } | ||
796 | |||
797 | if (ha->pio_address) | ||
798 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | ||
799 | |||
800 | /* Turn off LEDs. */ | ||
801 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
802 | if (ha->pio_address) { | ||
803 | gpio_enable = RD_REG_WORD_PIO(®->gpioe); | ||
804 | gpio_data = RD_REG_WORD_PIO(®->gpiod); | ||
805 | } else { | ||
806 | gpio_enable = RD_REG_WORD(®->gpioe); | ||
807 | gpio_data = RD_REG_WORD(®->gpiod); | ||
808 | } | ||
809 | gpio_enable |= GPIO_LED_MASK; | ||
810 | |||
811 | /* Set the modified gpio_enable values. */ | ||
812 | if (ha->pio_address) { | ||
813 | WRT_REG_WORD_PIO(®->gpioe, gpio_enable); | ||
814 | } else { | ||
815 | WRT_REG_WORD(®->gpioe, gpio_enable); | ||
816 | RD_REG_WORD(®->gpioe); | ||
817 | } | ||
818 | |||
819 | /* Clear out previously set LED colour. */ | ||
820 | gpio_data &= ~GPIO_LED_MASK; | ||
821 | if (ha->pio_address) { | ||
822 | WRT_REG_WORD_PIO(®->gpiod, gpio_data); | ||
823 | } else { | ||
824 | WRT_REG_WORD(®->gpiod, gpio_data); | ||
825 | RD_REG_WORD(®->gpiod); | ||
826 | } | ||
827 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
828 | |||
829 | /* | ||
830 | * Let the per HBA timer kick off the blinking process based on | ||
831 | * the following flags. No need to do anything else now. | ||
832 | */ | ||
833 | ha->beacon_blink_led = 1; | ||
834 | ha->beacon_color_state = 0; | ||
835 | |||
836 | return QLA_SUCCESS; | ||
837 | } | ||
838 | |||
839 | int | ||
840 | qla2x00_beacon_off(struct scsi_qla_host *ha) | ||
841 | { | ||
842 | int rval = QLA_SUCCESS; | ||
843 | |||
844 | ha->beacon_blink_led = 0; | ||
845 | |||
846 | /* Set the on flag so when it gets flipped it will be off. */ | ||
847 | if (IS_QLA2322(ha)) | ||
848 | ha->beacon_color_state = QLA_LED_ALL_ON; | ||
849 | else | ||
850 | ha->beacon_color_state = QLA_LED_GRN_ON; | ||
851 | |||
852 | ha->isp_ops.beacon_blink(ha); /* This turns green LED off */ | ||
853 | |||
854 | ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING; | ||
855 | ha->fw_options[1] &= ~FO1_DISABLE_GPIO6_7; | ||
856 | |||
857 | rval = qla2x00_set_fw_options(ha, ha->fw_options); | ||
858 | if (rval != QLA_SUCCESS) | ||
859 | qla_printk(KERN_WARNING, ha, | ||
860 | "Unable to update fw options (beacon off).\n"); | ||
861 | return rval; | ||
862 | } | ||
863 | |||
864 | |||
865 | static inline void | ||
866 | qla24xx_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags) | ||
867 | { | ||
868 | /* Flip all colors. */ | ||
869 | if (ha->beacon_color_state == QLA_LED_ALL_ON) { | ||
870 | /* Turn off. */ | ||
871 | ha->beacon_color_state = 0; | ||
872 | *pflags = 0; | ||
873 | } else { | ||
874 | /* Turn on. */ | ||
875 | ha->beacon_color_state = QLA_LED_ALL_ON; | ||
876 | *pflags = GPDX_LED_YELLOW_ON | GPDX_LED_AMBER_ON; | ||
877 | } | ||
878 | } | ||
879 | |||
880 | void | ||
881 | qla24xx_beacon_blink(struct scsi_qla_host *ha) | ||
882 | { | ||
883 | uint16_t led_color = 0; | ||
884 | uint32_t gpio_data; | ||
885 | unsigned long flags; | ||
886 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | ||
887 | |||
888 | /* Save the Original GPIOD. */ | ||
889 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
890 | gpio_data = RD_REG_DWORD(®->gpiod); | ||
891 | |||
892 | /* Enable the gpio_data reg for update. */ | ||
893 | gpio_data |= GPDX_LED_UPDATE_MASK; | ||
894 | |||
895 | WRT_REG_DWORD(®->gpiod, gpio_data); | ||
896 | gpio_data = RD_REG_DWORD(®->gpiod); | ||
897 | |||
898 | /* Set the color bits. */ | ||
899 | qla24xx_flip_colors(ha, &led_color); | ||
900 | |||
901 | /* Clear out any previously set LED color. */ | ||
902 | gpio_data &= ~GPDX_LED_COLOR_MASK; | ||
903 | |||
904 | /* Set the new input LED color to GPIOD. */ | ||
905 | gpio_data |= led_color; | ||
906 | |||
907 | /* Set the modified gpio_data values. */ | ||
908 | WRT_REG_DWORD(®->gpiod, gpio_data); | ||
909 | gpio_data = RD_REG_DWORD(®->gpiod); | ||
910 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
911 | } | ||
912 | |||
913 | int | ||
914 | qla24xx_beacon_on(struct scsi_qla_host *ha) | ||
915 | { | ||
916 | uint32_t gpio_data; | ||
917 | unsigned long flags; | ||
918 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | ||
919 | |||
920 | if (ha->beacon_blink_led == 0) { | ||
921 | /* Enable firmware for update */ | ||
922 | ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL; | ||
923 | |||
924 | if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) | ||
925 | return QLA_FUNCTION_FAILED; | ||
926 | |||
927 | if (qla2x00_get_fw_options(ha, ha->fw_options) != | ||
928 | QLA_SUCCESS) { | ||
929 | qla_printk(KERN_WARNING, ha, | ||
930 | "Unable to update fw options (beacon on).\n"); | ||
931 | return QLA_FUNCTION_FAILED; | ||
932 | } | ||
933 | |||
934 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
935 | gpio_data = RD_REG_DWORD(®->gpiod); | ||
936 | |||
937 | /* Enable the gpio_data reg for update. */ | ||
938 | gpio_data |= GPDX_LED_UPDATE_MASK; | ||
939 | WRT_REG_DWORD(®->gpiod, gpio_data); | ||
940 | RD_REG_DWORD(®->gpiod); | ||
941 | |||
942 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
943 | } | ||
944 | |||
945 | /* So all colors blink together. */ | ||
946 | ha->beacon_color_state = 0; | ||
947 | |||
948 | /* Let the per HBA timer kick off the blinking process. */ | ||
949 | ha->beacon_blink_led = 1; | ||
950 | |||
951 | return QLA_SUCCESS; | ||
952 | } | ||
953 | |||
954 | int | ||
955 | qla24xx_beacon_off(struct scsi_qla_host *ha) | ||
956 | { | ||
957 | uint32_t gpio_data; | ||
958 | unsigned long flags; | ||
959 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | ||
960 | |||
961 | ha->beacon_blink_led = 0; | ||
962 | ha->beacon_color_state = QLA_LED_ALL_ON; | ||
963 | |||
964 | ha->isp_ops.beacon_blink(ha); /* Will flip to all off. */ | ||
965 | |||
966 | /* Give control back to firmware. */ | ||
967 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
968 | gpio_data = RD_REG_DWORD(®->gpiod); | ||
969 | |||
970 | /* Disable the gpio_data reg for update. */ | ||
971 | gpio_data &= ~GPDX_LED_UPDATE_MASK; | ||
972 | WRT_REG_DWORD(®->gpiod, gpio_data); | ||
973 | RD_REG_DWORD(®->gpiod); | ||
974 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
975 | |||
976 | ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL; | ||
977 | |||
978 | if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) { | ||
979 | qla_printk(KERN_WARNING, ha, | ||
980 | "Unable to update fw options (beacon off).\n"); | ||
981 | return QLA_FUNCTION_FAILED; | ||
982 | } | ||
983 | |||
984 | if (qla2x00_get_fw_options(ha, ha->fw_options) != QLA_SUCCESS) { | ||
985 | qla_printk(KERN_WARNING, ha, | ||
986 | "Unable to get fw options (beacon off).\n"); | ||
987 | return QLA_FUNCTION_FAILED; | ||
988 | } | ||
989 | |||
990 | return QLA_SUCCESS; | ||
991 | } | ||
992 | |||
993 | |||
994 | /* | ||
995 | * Flash support routines | ||
996 | */ | ||
997 | |||
998 | /** | ||
999 | * qla2x00_flash_enable() - Setup flash for reading and writing. | ||
1000 | * @ha: HA context | ||
1001 | */ | ||
1002 | static void | ||
1003 | qla2x00_flash_enable(scsi_qla_host_t *ha) | ||
1004 | { | ||
1005 | uint16_t data; | ||
1006 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1007 | |||
1008 | data = RD_REG_WORD(®->ctrl_status); | ||
1009 | data |= CSR_FLASH_ENABLE; | ||
1010 | WRT_REG_WORD(®->ctrl_status, data); | ||
1011 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1012 | } | ||
1013 | |||
1014 | /** | ||
1015 | * qla2x00_flash_disable() - Disable flash and allow RISC to run. | ||
1016 | * @ha: HA context | ||
1017 | */ | ||
1018 | static void | ||
1019 | qla2x00_flash_disable(scsi_qla_host_t *ha) | ||
1020 | { | ||
1021 | uint16_t data; | ||
1022 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1023 | |||
1024 | data = RD_REG_WORD(®->ctrl_status); | ||
1025 | data &= ~(CSR_FLASH_ENABLE); | ||
1026 | WRT_REG_WORD(®->ctrl_status, data); | ||
1027 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1028 | } | ||
1029 | |||
1030 | /** | ||
1031 | * qla2x00_read_flash_byte() - Reads a byte from flash | ||
1032 | * @ha: HA context | ||
1033 | * @addr: Address in flash to read | ||
1034 | * | ||
1035 | * A word is read from the chip, but, only the lower byte is valid. | ||
1036 | * | ||
1037 | * Returns the byte read from flash @addr. | ||
1038 | */ | ||
1039 | static uint8_t | ||
1040 | qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr) | ||
1041 | { | ||
1042 | uint16_t data; | ||
1043 | uint16_t bank_select; | ||
1044 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1045 | |||
1046 | bank_select = RD_REG_WORD(®->ctrl_status); | ||
1047 | |||
1048 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) { | ||
1049 | /* Specify 64K address range: */ | ||
1050 | /* clear out Module Select and Flash Address bits [19:16]. */ | ||
1051 | bank_select &= ~0xf8; | ||
1052 | bank_select |= addr >> 12 & 0xf0; | ||
1053 | bank_select |= CSR_FLASH_64K_BANK; | ||
1054 | WRT_REG_WORD(®->ctrl_status, bank_select); | ||
1055 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1056 | |||
1057 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); | ||
1058 | data = RD_REG_WORD(®->flash_data); | ||
1059 | |||
1060 | return (uint8_t)data; | ||
1061 | } | ||
1062 | |||
1063 | /* Setup bit 16 of flash address. */ | ||
1064 | if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) { | ||
1065 | bank_select |= CSR_FLASH_64K_BANK; | ||
1066 | WRT_REG_WORD(®->ctrl_status, bank_select); | ||
1067 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1068 | } else if (((addr & BIT_16) == 0) && | ||
1069 | (bank_select & CSR_FLASH_64K_BANK)) { | ||
1070 | bank_select &= ~(CSR_FLASH_64K_BANK); | ||
1071 | WRT_REG_WORD(®->ctrl_status, bank_select); | ||
1072 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1073 | } | ||
1074 | |||
1075 | /* Always perform IO mapped accesses to the FLASH registers. */ | ||
1076 | if (ha->pio_address) { | ||
1077 | uint16_t data2; | ||
1078 | |||
1079 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | ||
1080 | WRT_REG_WORD_PIO(®->flash_address, (uint16_t)addr); | ||
1081 | do { | ||
1082 | data = RD_REG_WORD_PIO(®->flash_data); | ||
1083 | barrier(); | ||
1084 | cpu_relax(); | ||
1085 | data2 = RD_REG_WORD_PIO(®->flash_data); | ||
1086 | } while (data != data2); | ||
1087 | } else { | ||
1088 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); | ||
1089 | data = qla2x00_debounce_register(®->flash_data); | ||
1090 | } | ||
1091 | |||
1092 | return (uint8_t)data; | ||
1093 | } | ||
1094 | |||
1095 | /** | ||
1096 | * qla2x00_write_flash_byte() - Write a byte to flash | ||
1097 | * @ha: HA context | ||
1098 | * @addr: Address in flash to write | ||
1099 | * @data: Data to write | ||
1100 | */ | ||
1101 | static void | ||
1102 | qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data) | ||
1103 | { | ||
1104 | uint16_t bank_select; | ||
1105 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1106 | |||
1107 | bank_select = RD_REG_WORD(®->ctrl_status); | ||
1108 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) { | ||
1109 | /* Specify 64K address range: */ | ||
1110 | /* clear out Module Select and Flash Address bits [19:16]. */ | ||
1111 | bank_select &= ~0xf8; | ||
1112 | bank_select |= addr >> 12 & 0xf0; | ||
1113 | bank_select |= CSR_FLASH_64K_BANK; | ||
1114 | WRT_REG_WORD(®->ctrl_status, bank_select); | ||
1115 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1116 | |||
1117 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); | ||
1118 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1119 | WRT_REG_WORD(®->flash_data, (uint16_t)data); | ||
1120 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1121 | |||
1122 | return; | ||
1123 | } | ||
1124 | |||
1125 | /* Setup bit 16 of flash address. */ | ||
1126 | if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) { | ||
1127 | bank_select |= CSR_FLASH_64K_BANK; | ||
1128 | WRT_REG_WORD(®->ctrl_status, bank_select); | ||
1129 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1130 | } else if (((addr & BIT_16) == 0) && | ||
1131 | (bank_select & CSR_FLASH_64K_BANK)) { | ||
1132 | bank_select &= ~(CSR_FLASH_64K_BANK); | ||
1133 | WRT_REG_WORD(®->ctrl_status, bank_select); | ||
1134 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1135 | } | ||
1136 | |||
1137 | /* Always perform IO mapped accesses to the FLASH registers. */ | ||
1138 | if (ha->pio_address) { | ||
1139 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | ||
1140 | WRT_REG_WORD_PIO(®->flash_address, (uint16_t)addr); | ||
1141 | WRT_REG_WORD_PIO(®->flash_data, (uint16_t)data); | ||
1142 | } else { | ||
1143 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); | ||
1144 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1145 | WRT_REG_WORD(®->flash_data, (uint16_t)data); | ||
1146 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | ||
1147 | } | ||
1148 | } | ||
1149 | |||
1150 | /** | ||
1151 | * qla2x00_poll_flash() - Polls flash for completion. | ||
1152 | * @ha: HA context | ||
1153 | * @addr: Address in flash to poll | ||
1154 | * @poll_data: Data to be polled | ||
1155 | * @man_id: Flash manufacturer ID | ||
1156 | * @flash_id: Flash ID | ||
1157 | * | ||
1158 | * This function polls the device until bit 7 of what is read matches data | ||
1159 | * bit 7 or until data bit 5 becomes a 1. If that hapens, the flash ROM timed | ||
1160 | * out (a fatal error). The flash book recommeds reading bit 7 again after | ||
1161 | * reading bit 5 as a 1. | ||
1162 | * | ||
1163 | * Returns 0 on success, else non-zero. | ||
1164 | */ | ||
1165 | static int | ||
1166 | qla2x00_poll_flash(scsi_qla_host_t *ha, uint32_t addr, uint8_t poll_data, | ||
1167 | uint8_t man_id, uint8_t flash_id) | ||
1168 | { | ||
1169 | int status; | ||
1170 | uint8_t flash_data; | ||
1171 | uint32_t cnt; | ||
1172 | |||
1173 | status = 1; | ||
1174 | |||
1175 | /* Wait for 30 seconds for command to finish. */ | ||
1176 | poll_data &= BIT_7; | ||
1177 | for (cnt = 3000000; cnt; cnt--) { | ||
1178 | flash_data = qla2x00_read_flash_byte(ha, addr); | ||
1179 | if ((flash_data & BIT_7) == poll_data) { | ||
1180 | status = 0; | ||
1181 | break; | ||
1182 | } | ||
1183 | |||
1184 | if (man_id != 0x40 && man_id != 0xda) { | ||
1185 | if ((flash_data & BIT_5) && cnt > 2) | ||
1186 | cnt = 2; | ||
1187 | } | ||
1188 | udelay(10); | ||
1189 | barrier(); | ||
1190 | } | ||
1191 | return status; | ||
1192 | } | ||
1193 | |||
1194 | #define IS_OEM_001(ha) \ | ||
1195 | ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322 && \ | ||
1196 | (ha)->pdev->subsystem_vendor == 0x1028 && \ | ||
1197 | (ha)->pdev->subsystem_device == 0x0170) | ||
1198 | |||
1199 | /** | ||
1200 | * qla2x00_program_flash_address() - Programs a flash address | ||
1201 | * @ha: HA context | ||
1202 | * @addr: Address in flash to program | ||
1203 | * @data: Data to be written in flash | ||
1204 | * @man_id: Flash manufacturer ID | ||
1205 | * @flash_id: Flash ID | ||
1206 | * | ||
1207 | * Returns 0 on success, else non-zero. | ||
1208 | */ | ||
1209 | static int | ||
1210 | qla2x00_program_flash_address(scsi_qla_host_t *ha, uint32_t addr, uint8_t data, | ||
1211 | uint8_t man_id, uint8_t flash_id) | ||
1212 | { | ||
1213 | /* Write Program Command Sequence. */ | ||
1214 | if (IS_OEM_001(ha)) { | ||
1215 | qla2x00_write_flash_byte(ha, 0xaaa, 0xaa); | ||
1216 | qla2x00_write_flash_byte(ha, 0x555, 0x55); | ||
1217 | qla2x00_write_flash_byte(ha, 0xaaa, 0xa0); | ||
1218 | qla2x00_write_flash_byte(ha, addr, data); | ||
1219 | } else { | ||
1220 | if (man_id == 0xda && flash_id == 0xc1) { | ||
1221 | qla2x00_write_flash_byte(ha, addr, data); | ||
1222 | if (addr & 0x7e) | ||
1223 | return 0; | ||
1224 | } else { | ||
1225 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1226 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1227 | qla2x00_write_flash_byte(ha, 0x5555, 0xa0); | ||
1228 | qla2x00_write_flash_byte(ha, addr, data); | ||
1229 | } | ||
1230 | } | ||
1231 | |||
1232 | udelay(150); | ||
1233 | |||
1234 | /* Wait for write to complete. */ | ||
1235 | return qla2x00_poll_flash(ha, addr, data, man_id, flash_id); | ||
1236 | } | ||
1237 | |||
1238 | /** | ||
1239 | * qla2x00_erase_flash() - Erase the flash. | ||
1240 | * @ha: HA context | ||
1241 | * @man_id: Flash manufacturer ID | ||
1242 | * @flash_id: Flash ID | ||
1243 | * | ||
1244 | * Returns 0 on success, else non-zero. | ||
1245 | */ | ||
1246 | static int | ||
1247 | qla2x00_erase_flash(scsi_qla_host_t *ha, uint8_t man_id, uint8_t flash_id) | ||
1248 | { | ||
1249 | /* Individual Sector Erase Command Sequence */ | ||
1250 | if (IS_OEM_001(ha)) { | ||
1251 | qla2x00_write_flash_byte(ha, 0xaaa, 0xaa); | ||
1252 | qla2x00_write_flash_byte(ha, 0x555, 0x55); | ||
1253 | qla2x00_write_flash_byte(ha, 0xaaa, 0x80); | ||
1254 | qla2x00_write_flash_byte(ha, 0xaaa, 0xaa); | ||
1255 | qla2x00_write_flash_byte(ha, 0x555, 0x55); | ||
1256 | qla2x00_write_flash_byte(ha, 0xaaa, 0x10); | ||
1257 | } else { | ||
1258 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1259 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1260 | qla2x00_write_flash_byte(ha, 0x5555, 0x80); | ||
1261 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1262 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1263 | qla2x00_write_flash_byte(ha, 0x5555, 0x10); | ||
1264 | } | ||
1265 | |||
1266 | udelay(150); | ||
1267 | |||
1268 | /* Wait for erase to complete. */ | ||
1269 | return qla2x00_poll_flash(ha, 0x00, 0x80, man_id, flash_id); | ||
1270 | } | ||
1271 | |||
1272 | /** | ||
1273 | * qla2x00_erase_flash_sector() - Erase a flash sector. | ||
1274 | * @ha: HA context | ||
1275 | * @addr: Flash sector to erase | ||
1276 | * @sec_mask: Sector address mask | ||
1277 | * @man_id: Flash manufacturer ID | ||
1278 | * @flash_id: Flash ID | ||
1279 | * | ||
1280 | * Returns 0 on success, else non-zero. | ||
1281 | */ | ||
1282 | static int | ||
1283 | qla2x00_erase_flash_sector(scsi_qla_host_t *ha, uint32_t addr, | ||
1284 | uint32_t sec_mask, uint8_t man_id, uint8_t flash_id) | ||
1285 | { | ||
1286 | /* Individual Sector Erase Command Sequence */ | ||
1287 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1288 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1289 | qla2x00_write_flash_byte(ha, 0x5555, 0x80); | ||
1290 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1291 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1292 | if (man_id == 0x1f && flash_id == 0x13) | ||
1293 | qla2x00_write_flash_byte(ha, addr & sec_mask, 0x10); | ||
1294 | else | ||
1295 | qla2x00_write_flash_byte(ha, addr & sec_mask, 0x30); | ||
1296 | |||
1297 | udelay(150); | ||
1298 | |||
1299 | /* Wait for erase to complete. */ | ||
1300 | return qla2x00_poll_flash(ha, addr, 0x80, man_id, flash_id); | ||
1301 | } | ||
1302 | |||
1303 | /** | ||
1304 | * qla2x00_get_flash_manufacturer() - Read manufacturer ID from flash chip. | ||
1305 | * @man_id: Flash manufacturer ID | ||
1306 | * @flash_id: Flash ID | ||
1307 | */ | ||
1308 | static void | ||
1309 | qla2x00_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id, | ||
1310 | uint8_t *flash_id) | ||
1311 | { | ||
1312 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1313 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1314 | qla2x00_write_flash_byte(ha, 0x5555, 0x90); | ||
1315 | *man_id = qla2x00_read_flash_byte(ha, 0x0000); | ||
1316 | *flash_id = qla2x00_read_flash_byte(ha, 0x0001); | ||
1317 | qla2x00_write_flash_byte(ha, 0x5555, 0xaa); | ||
1318 | qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); | ||
1319 | qla2x00_write_flash_byte(ha, 0x5555, 0xf0); | ||
1320 | } | ||
1321 | |||
1322 | |||
1323 | static inline void | ||
1324 | qla2x00_suspend_hba(struct scsi_qla_host *ha) | ||
1325 | { | ||
1326 | int cnt; | ||
1327 | unsigned long flags; | ||
1328 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1329 | |||
1330 | /* Suspend HBA. */ | ||
1331 | scsi_block_requests(ha->host); | ||
1332 | ha->isp_ops.disable_intrs(ha); | ||
1333 | set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); | ||
1334 | |||
1335 | /* Pause RISC. */ | ||
1336 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1337 | WRT_REG_WORD(®->hccr, HCCR_PAUSE_RISC); | ||
1338 | RD_REG_WORD(®->hccr); | ||
1339 | if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) { | ||
1340 | for (cnt = 0; cnt < 30000; cnt++) { | ||
1341 | if ((RD_REG_WORD(®->hccr) & HCCR_RISC_PAUSE) != 0) | ||
1342 | break; | ||
1343 | udelay(100); | ||
1344 | } | ||
1345 | } else { | ||
1346 | udelay(10); | ||
1347 | } | ||
1348 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1349 | } | ||
1350 | |||
1351 | static inline void | ||
1352 | qla2x00_resume_hba(struct scsi_qla_host *ha) | ||
1353 | { | ||
1354 | /* Resume HBA. */ | ||
1355 | clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); | ||
1356 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | ||
1357 | up(ha->dpc_wait); | ||
1358 | qla2x00_wait_for_hba_online(ha); | ||
1359 | scsi_unblock_requests(ha->host); | ||
1360 | } | ||
1361 | |||
1362 | uint8_t * | ||
1363 | qla2x00_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf, | ||
1364 | uint32_t offset, uint32_t length) | ||
1365 | { | ||
1366 | unsigned long flags; | ||
1367 | uint32_t addr, midpoint; | ||
1368 | uint8_t *data; | ||
1369 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1370 | |||
1371 | /* Suspend HBA. */ | ||
1372 | qla2x00_suspend_hba(ha); | ||
1373 | |||
1374 | /* Go with read. */ | ||
1375 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1376 | midpoint = ha->optrom_size / 2; | ||
1377 | |||
1378 | qla2x00_flash_enable(ha); | ||
1379 | WRT_REG_WORD(®->nvram, 0); | ||
1380 | RD_REG_WORD(®->nvram); /* PCI Posting. */ | ||
1381 | for (addr = offset, data = buf; addr < length; addr++, data++) { | ||
1382 | if (addr == midpoint) { | ||
1383 | WRT_REG_WORD(®->nvram, NVR_SELECT); | ||
1384 | RD_REG_WORD(®->nvram); /* PCI Posting. */ | ||
1385 | } | ||
1386 | |||
1387 | *data = qla2x00_read_flash_byte(ha, addr); | ||
1388 | } | ||
1389 | qla2x00_flash_disable(ha); | ||
1390 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1391 | |||
1392 | /* Resume HBA. */ | ||
1393 | qla2x00_resume_hba(ha); | ||
1394 | |||
1395 | return buf; | ||
1396 | } | ||
1397 | |||
1398 | int | ||
1399 | qla2x00_write_optrom_data(struct scsi_qla_host *ha, uint8_t *buf, | ||
1400 | uint32_t offset, uint32_t length) | ||
1401 | { | ||
1402 | |||
1403 | int rval; | ||
1404 | unsigned long flags; | ||
1405 | uint8_t man_id, flash_id, sec_number, data; | ||
1406 | uint16_t wd; | ||
1407 | uint32_t addr, liter, sec_mask, rest_addr; | ||
1408 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1409 | |||
1410 | /* Suspend HBA. */ | ||
1411 | qla2x00_suspend_hba(ha); | ||
1412 | |||
1413 | rval = QLA_SUCCESS; | ||
1414 | sec_number = 0; | ||
1415 | |||
1416 | /* Reset ISP chip. */ | ||
1417 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1418 | WRT_REG_WORD(®->ctrl_status, CSR_ISP_SOFT_RESET); | ||
1419 | pci_read_config_word(ha->pdev, PCI_COMMAND, &wd); | ||
1420 | |||
1421 | /* Go with write. */ | ||
1422 | qla2x00_flash_enable(ha); | ||
1423 | do { /* Loop once to provide quick error exit */ | ||
1424 | /* Structure of flash memory based on manufacturer */ | ||
1425 | if (IS_OEM_001(ha)) { | ||
1426 | /* OEM variant with special flash part. */ | ||
1427 | man_id = flash_id = 0; | ||
1428 | rest_addr = 0xffff; | ||
1429 | sec_mask = 0x10000; | ||
1430 | goto update_flash; | ||
1431 | } | ||
1432 | qla2x00_get_flash_manufacturer(ha, &man_id, &flash_id); | ||
1433 | switch (man_id) { | ||
1434 | case 0x20: /* ST flash. */ | ||
1435 | if (flash_id == 0xd2 || flash_id == 0xe3) { | ||
1436 | /* | ||
1437 | * ST m29w008at part - 64kb sector size with | ||
1438 | * 32kb,8kb,8kb,16kb sectors at memory address | ||
1439 | * 0xf0000. | ||
1440 | */ | ||
1441 | rest_addr = 0xffff; | ||
1442 | sec_mask = 0x10000; | ||
1443 | break; | ||
1444 | } | ||
1445 | /* | ||
1446 | * ST m29w010b part - 16kb sector size | ||
1447 | * Default to 16kb sectors | ||
1448 | */ | ||
1449 | rest_addr = 0x3fff; | ||
1450 | sec_mask = 0x1c000; | ||
1451 | break; | ||
1452 | case 0x40: /* Mostel flash. */ | ||
1453 | /* Mostel v29c51001 part - 512 byte sector size. */ | ||
1454 | rest_addr = 0x1ff; | ||
1455 | sec_mask = 0x1fe00; | ||
1456 | break; | ||
1457 | case 0xbf: /* SST flash. */ | ||
1458 | /* SST39sf10 part - 4kb sector size. */ | ||
1459 | rest_addr = 0xfff; | ||
1460 | sec_mask = 0x1f000; | ||
1461 | break; | ||
1462 | case 0xda: /* Winbond flash. */ | ||
1463 | /* Winbond W29EE011 part - 256 byte sector size. */ | ||
1464 | rest_addr = 0x7f; | ||
1465 | sec_mask = 0x1ff80; | ||
1466 | break; | ||
1467 | case 0xc2: /* Macronix flash. */ | ||
1468 | /* 64k sector size. */ | ||
1469 | if (flash_id == 0x38 || flash_id == 0x4f) { | ||
1470 | rest_addr = 0xffff; | ||
1471 | sec_mask = 0x10000; | ||
1472 | break; | ||
1473 | } | ||
1474 | /* Fall through... */ | ||
1475 | |||
1476 | case 0x1f: /* Atmel flash. */ | ||
1477 | /* 512k sector size. */ | ||
1478 | if (flash_id == 0x13) { | ||
1479 | rest_addr = 0x7fffffff; | ||
1480 | sec_mask = 0x80000000; | ||
1481 | break; | ||
1482 | } | ||
1483 | /* Fall through... */ | ||
1484 | |||
1485 | case 0x01: /* AMD flash. */ | ||
1486 | if (flash_id == 0x38 || flash_id == 0x40 || | ||
1487 | flash_id == 0x4f) { | ||
1488 | /* Am29LV081 part - 64kb sector size. */ | ||
1489 | /* Am29LV002BT part - 64kb sector size. */ | ||
1490 | rest_addr = 0xffff; | ||
1491 | sec_mask = 0x10000; | ||
1492 | break; | ||
1493 | } else if (flash_id == 0x3e) { | ||
1494 | /* | ||
1495 | * Am29LV008b part - 64kb sector size with | ||
1496 | * 32kb,8kb,8kb,16kb sector at memory address | ||
1497 | * h0xf0000. | ||
1498 | */ | ||
1499 | rest_addr = 0xffff; | ||
1500 | sec_mask = 0x10000; | ||
1501 | break; | ||
1502 | } else if (flash_id == 0x20 || flash_id == 0x6e) { | ||
1503 | /* | ||
1504 | * Am29LV010 part or AM29f010 - 16kb sector | ||
1505 | * size. | ||
1506 | */ | ||
1507 | rest_addr = 0x3fff; | ||
1508 | sec_mask = 0x1c000; | ||
1509 | break; | ||
1510 | } else if (flash_id == 0x6d) { | ||
1511 | /* Am29LV001 part - 8kb sector size. */ | ||
1512 | rest_addr = 0x1fff; | ||
1513 | sec_mask = 0x1e000; | ||
1514 | break; | ||
1515 | } | ||
1516 | default: | ||
1517 | /* Default to 16 kb sector size. */ | ||
1518 | rest_addr = 0x3fff; | ||
1519 | sec_mask = 0x1c000; | ||
1520 | break; | ||
1521 | } | ||
1522 | |||
1523 | update_flash: | ||
1524 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) { | ||
1525 | if (qla2x00_erase_flash(ha, man_id, flash_id)) { | ||
1526 | rval = QLA_FUNCTION_FAILED; | ||
1527 | break; | ||
1528 | } | ||
1529 | } | ||
1530 | |||
1531 | for (addr = offset, liter = 0; liter < length; liter++, | ||
1532 | addr++) { | ||
1533 | data = buf[liter]; | ||
1534 | /* Are we at the beginning of a sector? */ | ||
1535 | if ((addr & rest_addr) == 0) { | ||
1536 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) { | ||
1537 | if (addr >= 0x10000UL) { | ||
1538 | if (((addr >> 12) & 0xf0) && | ||
1539 | ((man_id == 0x01 && | ||
1540 | flash_id == 0x3e) || | ||
1541 | (man_id == 0x20 && | ||
1542 | flash_id == 0xd2))) { | ||
1543 | sec_number++; | ||
1544 | if (sec_number == 1) { | ||
1545 | rest_addr = | ||
1546 | 0x7fff; | ||
1547 | sec_mask = | ||
1548 | 0x18000; | ||
1549 | } else if ( | ||
1550 | sec_number == 2 || | ||
1551 | sec_number == 3) { | ||
1552 | rest_addr = | ||
1553 | 0x1fff; | ||
1554 | sec_mask = | ||
1555 | 0x1e000; | ||
1556 | } else if ( | ||
1557 | sec_number == 4) { | ||
1558 | rest_addr = | ||
1559 | 0x3fff; | ||
1560 | sec_mask = | ||
1561 | 0x1c000; | ||
1562 | } | ||
1563 | } | ||
1564 | } | ||
1565 | } else if (addr == ha->optrom_size / 2) { | ||
1566 | WRT_REG_WORD(®->nvram, NVR_SELECT); | ||
1567 | RD_REG_WORD(®->nvram); | ||
1568 | } | ||
1569 | |||
1570 | if (flash_id == 0xda && man_id == 0xc1) { | ||
1571 | qla2x00_write_flash_byte(ha, 0x5555, | ||
1572 | 0xaa); | ||
1573 | qla2x00_write_flash_byte(ha, 0x2aaa, | ||
1574 | 0x55); | ||
1575 | qla2x00_write_flash_byte(ha, 0x5555, | ||
1576 | 0xa0); | ||
1577 | } else if (!IS_QLA2322(ha) && !IS_QLA6322(ha)) { | ||
1578 | /* Then erase it */ | ||
1579 | if (qla2x00_erase_flash_sector(ha, | ||
1580 | addr, sec_mask, man_id, | ||
1581 | flash_id)) { | ||
1582 | rval = QLA_FUNCTION_FAILED; | ||
1583 | break; | ||
1584 | } | ||
1585 | if (man_id == 0x01 && flash_id == 0x6d) | ||
1586 | sec_number++; | ||
1587 | } | ||
1588 | } | ||
1589 | |||
1590 | if (man_id == 0x01 && flash_id == 0x6d) { | ||
1591 | if (sec_number == 1 && | ||
1592 | addr == (rest_addr - 1)) { | ||
1593 | rest_addr = 0x0fff; | ||
1594 | sec_mask = 0x1f000; | ||
1595 | } else if (sec_number == 3 && (addr & 0x7ffe)) { | ||
1596 | rest_addr = 0x3fff; | ||
1597 | sec_mask = 0x1c000; | ||
1598 | } | ||
1599 | } | ||
1600 | |||
1601 | if (qla2x00_program_flash_address(ha, addr, data, | ||
1602 | man_id, flash_id)) { | ||
1603 | rval = QLA_FUNCTION_FAILED; | ||
1604 | break; | ||
1605 | } | ||
1606 | } | ||
1607 | } while (0); | ||
1608 | qla2x00_flash_disable(ha); | ||
1609 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1610 | |||
1611 | /* Resume HBA. */ | ||
1612 | qla2x00_resume_hba(ha); | ||
1613 | |||
1614 | return rval; | ||
1615 | } | ||
1616 | |||
1617 | uint8_t * | ||
1618 | qla24xx_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf, | ||
1619 | uint32_t offset, uint32_t length) | ||
1620 | { | ||
1621 | /* Suspend HBA. */ | ||
1622 | scsi_block_requests(ha->host); | ||
1623 | ha->isp_ops.disable_intrs(ha); | ||
1624 | set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); | ||
1625 | |||
1626 | /* Go with read. */ | ||
1627 | qla24xx_read_flash_data(ha, (uint32_t *)buf, offset >> 2, length >> 2); | ||
1628 | |||
1629 | /* Resume HBA. */ | ||
1630 | clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); | ||
1631 | ha->isp_ops.enable_intrs(ha); | ||
1632 | scsi_unblock_requests(ha->host); | ||
1633 | |||
1634 | return buf; | ||
1635 | } | ||
1636 | |||
1637 | int | ||
1638 | qla24xx_write_optrom_data(struct scsi_qla_host *ha, uint8_t *buf, | ||
1639 | uint32_t offset, uint32_t length) | ||
1640 | { | ||
1641 | int rval; | ||
1642 | |||
1643 | /* Suspend HBA. */ | ||
1644 | scsi_block_requests(ha->host); | ||
1645 | ha->isp_ops.disable_intrs(ha); | ||
1646 | set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); | ||
1647 | |||
1648 | /* Go with write. */ | ||
1649 | rval = qla24xx_write_flash_data(ha, (uint32_t *)buf, offset >> 2, | ||
1650 | length >> 2); | ||
1651 | |||
1652 | /* Resume HBA -- RISC reset needed. */ | ||
1653 | clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); | ||
1654 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | ||
1655 | up(ha->dpc_wait); | ||
1656 | qla2x00_wait_for_hba_online(ha); | ||
1657 | scsi_unblock_requests(ha->host); | ||
1658 | |||
1659 | return rval; | ||
1660 | } | ||
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 6fddf17a3b70..2770005324b4 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -997,6 +997,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
997 | case ATA_CMD_READ_EXT: | 997 | case ATA_CMD_READ_EXT: |
998 | case ATA_CMD_WRITE: | 998 | case ATA_CMD_WRITE: |
999 | case ATA_CMD_WRITE_EXT: | 999 | case ATA_CMD_WRITE_EXT: |
1000 | case ATA_CMD_WRITE_FUA_EXT: | ||
1000 | mv_crqb_pack_cmd(cw++, tf->hob_nsect, ATA_REG_NSECT, 0); | 1001 | mv_crqb_pack_cmd(cw++, tf->hob_nsect, ATA_REG_NSECT, 0); |
1001 | break; | 1002 | break; |
1002 | #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ | 1003 | #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index de05e2883f9c..80480f0fb2b8 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -277,7 +277,7 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc) | |||
277 | u8 *prd = pp->pkt + QS_CPB_BYTES; | 277 | u8 *prd = pp->pkt + QS_CPB_BYTES; |
278 | 278 | ||
279 | assert(qc->__sg != NULL); | 279 | assert(qc->__sg != NULL); |
280 | assert(qc->n_elem > 0); | 280 | assert(qc->n_elem > 0 || qc->pad_len > 0); |
281 | 281 | ||
282 | nelem = 0; | 282 | nelem = 0; |
283 | ata_for_each_sg(sg, qc) { | 283 | ata_for_each_sg(sg, qc) { |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index 17f74d3c10e7..9face3c6aa21 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -49,11 +49,13 @@ | |||
49 | #define DRV_VERSION "0.9" | 49 | #define DRV_VERSION "0.9" |
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), | ||
52 | SIL_FLAG_MOD15WRITE = (1 << 30), | 53 | SIL_FLAG_MOD15WRITE = (1 << 30), |
53 | 54 | ||
54 | sil_3112 = 0, | 55 | sil_3112 = 0, |
55 | sil_3112_m15w = 1, | 56 | sil_3112_m15w = 1, |
56 | sil_3114 = 2, | 57 | sil_3512 = 2, |
58 | sil_3114 = 3, | ||
57 | 59 | ||
58 | SIL_FIFO_R0 = 0x40, | 60 | SIL_FIFO_R0 = 0x40, |
59 | SIL_FIFO_W0 = 0x41, | 61 | SIL_FIFO_W0 = 0x41, |
@@ -90,7 +92,7 @@ static void sil_post_set_mode (struct ata_port *ap); | |||
90 | static const struct pci_device_id sil_pci_tbl[] = { | 92 | static const struct pci_device_id sil_pci_tbl[] = { |
91 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 93 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
92 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 94 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
93 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, | 95 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 }, |
94 | { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, | 96 | { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, |
95 | { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 97 | { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
96 | { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 98 | { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
@@ -185,7 +187,8 @@ static const struct ata_port_info sil_port_info[] = { | |||
185 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 187 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
186 | .udma_mask = 0x3f, /* udma0-5 */ | 188 | .udma_mask = 0x3f, /* udma0-5 */ |
187 | .port_ops = &sil_ops, | 189 | .port_ops = &sil_ops, |
188 | }, /* sil_3112_15w - keep it sync'd w/ sil_3112 */ | 190 | }, |
191 | /* sil_3112_15w - keep it sync'd w/ sil_3112 */ | ||
189 | { | 192 | { |
190 | .sht = &sil_sht, | 193 | .sht = &sil_sht, |
191 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 194 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
@@ -195,11 +198,24 @@ static const struct ata_port_info sil_port_info[] = { | |||
195 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 198 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
196 | .udma_mask = 0x3f, /* udma0-5 */ | 199 | .udma_mask = 0x3f, /* udma0-5 */ |
197 | .port_ops = &sil_ops, | 200 | .port_ops = &sil_ops, |
198 | }, /* sil_3114 */ | 201 | }, |
202 | /* sil_3512 */ | ||
199 | { | 203 | { |
200 | .sht = &sil_sht, | 204 | .sht = &sil_sht, |
201 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 205 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
202 | ATA_FLAG_SRST | ATA_FLAG_MMIO, | 206 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
207 | SIL_FLAG_RERR_ON_DMA_ACT, | ||
208 | .pio_mask = 0x1f, /* pio0-4 */ | ||
209 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
210 | .udma_mask = 0x3f, /* udma0-5 */ | ||
211 | .port_ops = &sil_ops, | ||
212 | }, | ||
213 | /* sil_3114 */ | ||
214 | { | ||
215 | .sht = &sil_sht, | ||
216 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
217 | ATA_FLAG_SRST | ATA_FLAG_MMIO | | ||
218 | SIL_FLAG_RERR_ON_DMA_ACT, | ||
203 | .pio_mask = 0x1f, /* pio0-4 */ | 219 | .pio_mask = 0x1f, /* pio0-4 */ |
204 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 220 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
205 | .udma_mask = 0x3f, /* udma0-5 */ | 221 | .udma_mask = 0x3f, /* udma0-5 */ |
@@ -216,12 +232,13 @@ static const struct { | |||
216 | unsigned long scr; /* SATA control register block */ | 232 | unsigned long scr; /* SATA control register block */ |
217 | unsigned long sien; /* SATA Interrupt Enable register */ | 233 | unsigned long sien; /* SATA Interrupt Enable register */ |
218 | unsigned long xfer_mode;/* data transfer mode register */ | 234 | unsigned long xfer_mode;/* data transfer mode register */ |
235 | unsigned long sfis_cfg; /* SATA FIS reception config register */ | ||
219 | } sil_port[] = { | 236 | } sil_port[] = { |
220 | /* port 0 ... */ | 237 | /* port 0 ... */ |
221 | { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4 }, | 238 | { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4, 0x14c }, |
222 | { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4 }, | 239 | { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4, 0x1cc }, |
223 | { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4 }, | 240 | { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4, 0x34c }, |
224 | { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4 }, | 241 | { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4, 0x3cc }, |
225 | /* ... port 3 */ | 242 | /* ... port 3 */ |
226 | }; | 243 | }; |
227 | 244 | ||
@@ -471,6 +488,23 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
471 | dev_printk(KERN_WARNING, &pdev->dev, | 488 | dev_printk(KERN_WARNING, &pdev->dev, |
472 | "cache line size not set. Driver may not function\n"); | 489 | "cache line size not set. Driver may not function\n"); |
473 | 490 | ||
491 | /* Apply R_ERR on DMA activate FIS errata workaround */ | ||
492 | if (probe_ent->host_flags & SIL_FLAG_RERR_ON_DMA_ACT) { | ||
493 | int cnt; | ||
494 | |||
495 | for (i = 0, cnt = 0; i < probe_ent->n_ports; i++) { | ||
496 | tmp = readl(mmio_base + sil_port[i].sfis_cfg); | ||
497 | if ((tmp & 0x3) != 0x01) | ||
498 | continue; | ||
499 | if (!cnt) | ||
500 | dev_printk(KERN_INFO, &pdev->dev, | ||
501 | "Applying R_ERR on DMA activate " | ||
502 | "FIS errata fix\n"); | ||
503 | writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg); | ||
504 | cnt++; | ||
505 | } | ||
506 | } | ||
507 | |||
474 | if (ent->driver_data == sil_3114) { | 508 | if (ent->driver_data == sil_3114) { |
475 | irq_mask = SIL_MASK_4PORT; | 509 | irq_mask = SIL_MASK_4PORT; |
476 | 510 | ||
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 2e2c3b7acb0c..e484e8db6810 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -81,6 +81,19 @@ | |||
81 | /* Port stride */ | 81 | /* Port stride */ |
82 | #define VSC_SATA_PORT_OFFSET 0x200 | 82 | #define VSC_SATA_PORT_OFFSET 0x200 |
83 | 83 | ||
84 | /* Error interrupt status bit offsets */ | ||
85 | #define VSC_SATA_INT_ERROR_E_OFFSET 2 | ||
86 | #define VSC_SATA_INT_ERROR_P_OFFSET 4 | ||
87 | #define VSC_SATA_INT_ERROR_T_OFFSET 5 | ||
88 | #define VSC_SATA_INT_ERROR_M_OFFSET 1 | ||
89 | #define is_vsc_sata_int_err(port_idx, int_status) \ | ||
90 | (int_status & ((1 << (VSC_SATA_INT_ERROR_E_OFFSET + (8 * port_idx))) | \ | ||
91 | (1 << (VSC_SATA_INT_ERROR_P_OFFSET + (8 * port_idx))) | \ | ||
92 | (1 << (VSC_SATA_INT_ERROR_T_OFFSET + (8 * port_idx))) | \ | ||
93 | (1 << (VSC_SATA_INT_ERROR_M_OFFSET + (8 * port_idx))) \ | ||
94 | )\ | ||
95 | ) | ||
96 | |||
84 | 97 | ||
85 | static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | 98 | static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) |
86 | { | 99 | { |
@@ -201,13 +214,28 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, | |||
201 | struct ata_port *ap; | 214 | struct ata_port *ap; |
202 | 215 | ||
203 | ap = host_set->ports[i]; | 216 | ap = host_set->ports[i]; |
217 | |||
218 | if (is_vsc_sata_int_err(i, int_status)) { | ||
219 | u32 err_status; | ||
220 | printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__); | ||
221 | err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0; | ||
222 | vsc_sata_scr_write(ap, SCR_ERROR, err_status); | ||
223 | handled++; | ||
224 | } | ||
225 | |||
204 | if (ap && !(ap->flags & | 226 | if (ap && !(ap->flags & |
205 | (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { | 227 | (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { |
206 | struct ata_queued_cmd *qc; | 228 | struct ata_queued_cmd *qc; |
207 | 229 | ||
208 | qc = ata_qc_from_tag(ap, ap->active_tag); | 230 | qc = ata_qc_from_tag(ap, ap->active_tag); |
209 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) | 231 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
210 | handled += ata_host_intr(ap, qc); | 232 | handled += ata_host_intr(ap, qc); |
233 | } else { | ||
234 | printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__); | ||
235 | ata_chk_status(ap); | ||
236 | handled++; | ||
237 | } | ||
238 | |||
211 | } | 239 | } |
212 | } | 240 | } |
213 | } | 241 | } |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 5cc97b721661..ff82ccfbb106 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1308,7 +1308,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) | |||
1308 | * the request was not marked fast fail. Note that above, | 1308 | * the request was not marked fast fail. Note that above, |
1309 | * even if the request is marked fast fail, we still requeue | 1309 | * even if the request is marked fast fail, we still requeue |
1310 | * for queue congestion conditions (QUEUE_FULL or BUSY) */ | 1310 | * for queue congestion conditions (QUEUE_FULL or BUSY) */ |
1311 | if ((++scmd->retries) < scmd->allowed | 1311 | if ((++scmd->retries) <= scmd->allowed |
1312 | && !blk_noretry_request(scmd->request)) { | 1312 | && !blk_noretry_request(scmd->request)) { |
1313 | return NEEDS_RETRY; | 1313 | return NEEDS_RETRY; |
1314 | } else { | 1314 | } else { |
@@ -1433,7 +1433,7 @@ static void scsi_eh_flush_done_q(struct list_head *done_q) | |||
1433 | list_del_init(&scmd->eh_entry); | 1433 | list_del_init(&scmd->eh_entry); |
1434 | if (scsi_device_online(scmd->device) && | 1434 | if (scsi_device_online(scmd->device) && |
1435 | !blk_noretry_request(scmd->request) && | 1435 | !blk_noretry_request(scmd->request) && |
1436 | (++scmd->retries < scmd->allowed)) { | 1436 | (++scmd->retries <= scmd->allowed)) { |
1437 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush" | 1437 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush" |
1438 | " retry cmd: %p\n", | 1438 | " retry cmd: %p\n", |
1439 | current->comm, | 1439 | current->comm, |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 4a602853a98e..701a328f7beb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/hardirq.h> | ||
19 | 20 | ||
20 | #include <scsi/scsi.h> | 21 | #include <scsi/scsi.h> |
21 | #include <scsi/scsi_dbg.h> | 22 | #include <scsi/scsi_dbg.h> |
@@ -1497,7 +1498,7 @@ static void scsi_kill_request(struct request *req, request_queue_t *q) | |||
1497 | static void scsi_softirq_done(struct request *rq) | 1498 | static void scsi_softirq_done(struct request *rq) |
1498 | { | 1499 | { |
1499 | struct scsi_cmnd *cmd = rq->completion_data; | 1500 | struct scsi_cmnd *cmd = rq->completion_data; |
1500 | unsigned long wait_for = cmd->allowed * cmd->timeout_per_command; | 1501 | unsigned long wait_for = (cmd->allowed + 1) * cmd->timeout_per_command; |
1501 | int disposition; | 1502 | int disposition; |
1502 | 1503 | ||
1503 | INIT_LIST_HEAD(&cmd->eh_entry); | 1504 | INIT_LIST_HEAD(&cmd->eh_entry); |
@@ -2248,3 +2249,61 @@ scsi_target_unblock(struct device *dev) | |||
2248 | device_for_each_child(dev, NULL, target_unblock); | 2249 | device_for_each_child(dev, NULL, target_unblock); |
2249 | } | 2250 | } |
2250 | EXPORT_SYMBOL_GPL(scsi_target_unblock); | 2251 | EXPORT_SYMBOL_GPL(scsi_target_unblock); |
2252 | |||
2253 | |||
2254 | struct work_queue_work { | ||
2255 | struct work_struct work; | ||
2256 | void (*fn)(void *); | ||
2257 | void *data; | ||
2258 | }; | ||
2259 | |||
2260 | static void execute_in_process_context_work(void *data) | ||
2261 | { | ||
2262 | void (*fn)(void *data); | ||
2263 | struct work_queue_work *wqw = data; | ||
2264 | |||
2265 | fn = wqw->fn; | ||
2266 | data = wqw->data; | ||
2267 | |||
2268 | kfree(wqw); | ||
2269 | |||
2270 | fn(data); | ||
2271 | } | ||
2272 | |||
2273 | /** | ||
2274 | * scsi_execute_in_process_context - reliably execute the routine with user context | ||
2275 | * @fn: the function to execute | ||
2276 | * @data: data to pass to the function | ||
2277 | * | ||
2278 | * Executes the function immediately if process context is available, | ||
2279 | * otherwise schedules the function for delayed execution. | ||
2280 | * | ||
2281 | * Returns: 0 - function was executed | ||
2282 | * 1 - function was scheduled for execution | ||
2283 | * <0 - error | ||
2284 | */ | ||
2285 | int scsi_execute_in_process_context(void (*fn)(void *data), void *data) | ||
2286 | { | ||
2287 | struct work_queue_work *wqw; | ||
2288 | |||
2289 | if (!in_interrupt()) { | ||
2290 | fn(data); | ||
2291 | return 0; | ||
2292 | } | ||
2293 | |||
2294 | wqw = kmalloc(sizeof(struct work_queue_work), GFP_ATOMIC); | ||
2295 | |||
2296 | if (unlikely(!wqw)) { | ||
2297 | printk(KERN_ERR "Failed to allocate memory\n"); | ||
2298 | WARN_ON(1); | ||
2299 | return -ENOMEM; | ||
2300 | } | ||
2301 | |||
2302 | INIT_WORK(&wqw->work, execute_in_process_context_work, wqw); | ||
2303 | wqw->fn = fn; | ||
2304 | wqw->data = data; | ||
2305 | schedule_work(&wqw->work); | ||
2306 | |||
2307 | return 1; | ||
2308 | } | ||
2309 | EXPORT_SYMBOL_GPL(scsi_execute_in_process_context); | ||
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 752fb5da3de4..f9ecc3dea7df 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -387,19 +387,12 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, | |||
387 | return found_target; | 387 | return found_target; |
388 | } | 388 | } |
389 | 389 | ||
390 | struct work_queue_wrapper { | 390 | static void scsi_target_reap_usercontext(void *data) |
391 | struct work_struct work; | 391 | { |
392 | struct scsi_target *starget; | 392 | struct scsi_target *starget = data; |
393 | }; | ||
394 | |||
395 | static void scsi_target_reap_work(void *data) { | ||
396 | struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data; | ||
397 | struct scsi_target *starget = wqw->starget; | ||
398 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 393 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
399 | unsigned long flags; | 394 | unsigned long flags; |
400 | 395 | ||
401 | kfree(wqw); | ||
402 | |||
403 | spin_lock_irqsave(shost->host_lock, flags); | 396 | spin_lock_irqsave(shost->host_lock, flags); |
404 | 397 | ||
405 | if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { | 398 | if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { |
@@ -428,18 +421,7 @@ static void scsi_target_reap_work(void *data) { | |||
428 | */ | 421 | */ |
429 | void scsi_target_reap(struct scsi_target *starget) | 422 | void scsi_target_reap(struct scsi_target *starget) |
430 | { | 423 | { |
431 | struct work_queue_wrapper *wqw = | 424 | scsi_execute_in_process_context(scsi_target_reap_usercontext, starget); |
432 | kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC); | ||
433 | |||
434 | if (!wqw) { | ||
435 | starget_printk(KERN_ERR, starget, | ||
436 | "Failed to allocate memory in scsi_reap_target()\n"); | ||
437 | return; | ||
438 | } | ||
439 | |||
440 | INIT_WORK(&wqw->work, scsi_target_reap_work, wqw); | ||
441 | wqw->starget = starget; | ||
442 | schedule_work(&wqw->work); | ||
443 | } | 425 | } |
444 | 426 | ||
445 | /** | 427 | /** |
@@ -770,8 +752,20 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) | |||
770 | 752 | ||
771 | transport_configure_device(&sdev->sdev_gendev); | 753 | transport_configure_device(&sdev->sdev_gendev); |
772 | 754 | ||
773 | if (sdev->host->hostt->slave_configure) | 755 | if (sdev->host->hostt->slave_configure) { |
774 | sdev->host->hostt->slave_configure(sdev); | 756 | int ret = sdev->host->hostt->slave_configure(sdev); |
757 | if (ret) { | ||
758 | /* | ||
759 | * if LLDD reports slave not present, don't clutter | ||
760 | * console with alloc failure messages | ||
761 | */ | ||
762 | if (ret != -ENXIO) { | ||
763 | sdev_printk(KERN_ERR, sdev, | ||
764 | "failed to configure device\n"); | ||
765 | } | ||
766 | return SCSI_SCAN_NO_RESPONSE; | ||
767 | } | ||
768 | } | ||
775 | 769 | ||
776 | /* | 770 | /* |
777 | * Ok, the device is now all set up, we can | 771 | * Ok, the device is now all set up, we can |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index a77b32deaf8f..902a5def8e62 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -217,8 +217,9 @@ static void scsi_device_cls_release(struct class_device *class_dev) | |||
217 | put_device(&sdev->sdev_gendev); | 217 | put_device(&sdev->sdev_gendev); |
218 | } | 218 | } |
219 | 219 | ||
220 | static void scsi_device_dev_release(struct device *dev) | 220 | static void scsi_device_dev_release_usercontext(void *data) |
221 | { | 221 | { |
222 | struct device *dev = data; | ||
222 | struct scsi_device *sdev; | 223 | struct scsi_device *sdev; |
223 | struct device *parent; | 224 | struct device *parent; |
224 | struct scsi_target *starget; | 225 | struct scsi_target *starget; |
@@ -237,6 +238,7 @@ static void scsi_device_dev_release(struct device *dev) | |||
237 | 238 | ||
238 | if (sdev->request_queue) { | 239 | if (sdev->request_queue) { |
239 | sdev->request_queue->queuedata = NULL; | 240 | sdev->request_queue->queuedata = NULL; |
241 | /* user context needed to free queue */ | ||
240 | scsi_free_queue(sdev->request_queue); | 242 | scsi_free_queue(sdev->request_queue); |
241 | /* temporary expedient, try to catch use of queue lock | 243 | /* temporary expedient, try to catch use of queue lock |
242 | * after free of sdev */ | 244 | * after free of sdev */ |
@@ -252,6 +254,11 @@ static void scsi_device_dev_release(struct device *dev) | |||
252 | put_device(parent); | 254 | put_device(parent); |
253 | } | 255 | } |
254 | 256 | ||
257 | static void scsi_device_dev_release(struct device *dev) | ||
258 | { | ||
259 | scsi_execute_in_process_context(scsi_device_dev_release_usercontext, dev); | ||
260 | } | ||
261 | |||
255 | static struct class sdev_class = { | 262 | static struct class sdev_class = { |
256 | .name = "scsi_device", | 263 | .name = "scsi_device", |
257 | .release = scsi_device_cls_release, | 264 | .release = scsi_device_cls_release, |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index f2c9acf11bd0..929032e370db 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -1498,8 +1498,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel, | |||
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | /* Search the bindings array */ | 1500 | /* Search the bindings array */ |
1501 | if (likely((ids->roles & FC_RPORT_ROLE_FCP_TARGET) && | 1501 | if (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE) { |
1502 | (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE))) { | ||
1503 | 1502 | ||
1504 | /* search for a matching consistent binding */ | 1503 | /* search for a matching consistent binding */ |
1505 | 1504 | ||
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 723f7acbeb12..71e54a64adca 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -39,10 +39,6 @@ struct iscsi_internal { | |||
39 | struct iscsi_transport *iscsi_transport; | 39 | struct iscsi_transport *iscsi_transport; |
40 | struct list_head list; | 40 | struct list_head list; |
41 | /* | 41 | /* |
42 | * List of sessions for this transport | ||
43 | */ | ||
44 | struct list_head sessions; | ||
45 | /* | ||
46 | * based on transport capabilities, at register time we set these | 42 | * based on transport capabilities, at register time we set these |
47 | * bits to tell the transport class it wants attributes displayed | 43 | * bits to tell the transport class it wants attributes displayed |
48 | * in sysfs or that it can support different iSCSI Data-Path | 44 | * in sysfs or that it can support different iSCSI Data-Path |
@@ -164,9 +160,43 @@ static struct mempool_zone *z_reply; | |||
164 | #define Z_MAX_ERROR 16 | 160 | #define Z_MAX_ERROR 16 |
165 | #define Z_HIWAT_ERROR 12 | 161 | #define Z_HIWAT_ERROR 12 |
166 | 162 | ||
163 | static LIST_HEAD(sesslist); | ||
164 | static DEFINE_SPINLOCK(sesslock); | ||
167 | static LIST_HEAD(connlist); | 165 | static LIST_HEAD(connlist); |
168 | static DEFINE_SPINLOCK(connlock); | 166 | static DEFINE_SPINLOCK(connlock); |
169 | 167 | ||
168 | static struct iscsi_cls_session *iscsi_session_lookup(uint64_t handle) | ||
169 | { | ||
170 | unsigned long flags; | ||
171 | struct iscsi_cls_session *sess; | ||
172 | |||
173 | spin_lock_irqsave(&sesslock, flags); | ||
174 | list_for_each_entry(sess, &sesslist, sess_list) { | ||
175 | if (sess == iscsi_ptr(handle)) { | ||
176 | spin_unlock_irqrestore(&sesslock, flags); | ||
177 | return sess; | ||
178 | } | ||
179 | } | ||
180 | spin_unlock_irqrestore(&sesslock, flags); | ||
181 | return NULL; | ||
182 | } | ||
183 | |||
184 | static struct iscsi_cls_conn *iscsi_conn_lookup(uint64_t handle) | ||
185 | { | ||
186 | unsigned long flags; | ||
187 | struct iscsi_cls_conn *conn; | ||
188 | |||
189 | spin_lock_irqsave(&connlock, flags); | ||
190 | list_for_each_entry(conn, &connlist, conn_list) { | ||
191 | if (conn == iscsi_ptr(handle)) { | ||
192 | spin_unlock_irqrestore(&connlock, flags); | ||
193 | return conn; | ||
194 | } | ||
195 | } | ||
196 | spin_unlock_irqrestore(&connlock, flags); | ||
197 | return NULL; | ||
198 | } | ||
199 | |||
170 | /* | 200 | /* |
171 | * The following functions can be used by LLDs that allocate | 201 | * The following functions can be used by LLDs that allocate |
172 | * their own scsi_hosts or by software iscsi LLDs | 202 | * their own scsi_hosts or by software iscsi LLDs |
@@ -365,6 +395,7 @@ iscsi_transport_create_session(struct scsi_transport_template *scsit, | |||
365 | { | 395 | { |
366 | struct iscsi_cls_session *session; | 396 | struct iscsi_cls_session *session; |
367 | struct Scsi_Host *shost; | 397 | struct Scsi_Host *shost; |
398 | unsigned long flags; | ||
368 | 399 | ||
369 | shost = scsi_host_alloc(transport->host_template, | 400 | shost = scsi_host_alloc(transport->host_template, |
370 | hostdata_privsize(transport)); | 401 | hostdata_privsize(transport)); |
@@ -389,6 +420,9 @@ iscsi_transport_create_session(struct scsi_transport_template *scsit, | |||
389 | goto remove_host; | 420 | goto remove_host; |
390 | 421 | ||
391 | *(unsigned long*)shost->hostdata = (unsigned long)session; | 422 | *(unsigned long*)shost->hostdata = (unsigned long)session; |
423 | spin_lock_irqsave(&sesslock, flags); | ||
424 | list_add(&session->sess_list, &sesslist); | ||
425 | spin_unlock_irqrestore(&sesslock, flags); | ||
392 | return shost; | 426 | return shost; |
393 | 427 | ||
394 | remove_host: | 428 | remove_host: |
@@ -410,9 +444,13 @@ EXPORT_SYMBOL_GPL(iscsi_transport_create_session); | |||
410 | int iscsi_transport_destroy_session(struct Scsi_Host *shost) | 444 | int iscsi_transport_destroy_session(struct Scsi_Host *shost) |
411 | { | 445 | { |
412 | struct iscsi_cls_session *session; | 446 | struct iscsi_cls_session *session; |
447 | unsigned long flags; | ||
413 | 448 | ||
414 | scsi_remove_host(shost); | 449 | scsi_remove_host(shost); |
415 | session = hostdata_session(shost->hostdata); | 450 | session = hostdata_session(shost->hostdata); |
451 | spin_lock_irqsave(&sesslock, flags); | ||
452 | list_del(&session->sess_list); | ||
453 | spin_unlock_irqrestore(&sesslock, flags); | ||
416 | iscsi_destroy_session(session); | 454 | iscsi_destroy_session(session); |
417 | /* ref from host alloc */ | 455 | /* ref from host alloc */ |
418 | scsi_host_put(shost); | 456 | scsi_host_put(shost); |
@@ -424,22 +462,6 @@ EXPORT_SYMBOL_GPL(iscsi_transport_destroy_session); | |||
424 | /* | 462 | /* |
425 | * iscsi interface functions | 463 | * iscsi interface functions |
426 | */ | 464 | */ |
427 | static struct iscsi_cls_conn* | ||
428 | iscsi_if_find_conn(uint64_t key) | ||
429 | { | ||
430 | unsigned long flags; | ||
431 | struct iscsi_cls_conn *conn; | ||
432 | |||
433 | spin_lock_irqsave(&connlock, flags); | ||
434 | list_for_each_entry(conn, &connlist, conn_list) | ||
435 | if (conn->connh == key) { | ||
436 | spin_unlock_irqrestore(&connlock, flags); | ||
437 | return conn; | ||
438 | } | ||
439 | spin_unlock_irqrestore(&connlock, flags); | ||
440 | return NULL; | ||
441 | } | ||
442 | |||
443 | static struct iscsi_internal * | 465 | static struct iscsi_internal * |
444 | iscsi_if_transport_lookup(struct iscsi_transport *tt) | 466 | iscsi_if_transport_lookup(struct iscsi_transport *tt) |
445 | { | 467 | { |
@@ -504,6 +526,12 @@ mempool_zone_init(unsigned max, unsigned size, unsigned hiwat) | |||
504 | if (!zp) | 526 | if (!zp) |
505 | return NULL; | 527 | return NULL; |
506 | 528 | ||
529 | zp->size = size; | ||
530 | zp->hiwat = hiwat; | ||
531 | INIT_LIST_HEAD(&zp->freequeue); | ||
532 | spin_lock_init(&zp->freelock); | ||
533 | atomic_set(&zp->allocated, 0); | ||
534 | |||
507 | zp->pool = mempool_create(max, mempool_zone_alloc_skb, | 535 | zp->pool = mempool_create(max, mempool_zone_alloc_skb, |
508 | mempool_zone_free_skb, zp); | 536 | mempool_zone_free_skb, zp); |
509 | if (!zp->pool) { | 537 | if (!zp->pool) { |
@@ -511,13 +539,6 @@ mempool_zone_init(unsigned max, unsigned size, unsigned hiwat) | |||
511 | return NULL; | 539 | return NULL; |
512 | } | 540 | } |
513 | 541 | ||
514 | zp->size = size; | ||
515 | zp->hiwat = hiwat; | ||
516 | |||
517 | INIT_LIST_HEAD(&zp->freequeue); | ||
518 | spin_lock_init(&zp->freelock); | ||
519 | atomic_set(&zp->allocated, 0); | ||
520 | |||
521 | return zp; | 542 | return zp; |
522 | } | 543 | } |
523 | 544 | ||
@@ -559,25 +580,21 @@ iscsi_unicast_skb(struct mempool_zone *zone, struct sk_buff *skb) | |||
559 | return 0; | 580 | return 0; |
560 | } | 581 | } |
561 | 582 | ||
562 | int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, | 583 | int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, |
563 | char *data, uint32_t data_size) | 584 | char *data, uint32_t data_size) |
564 | { | 585 | { |
565 | struct nlmsghdr *nlh; | 586 | struct nlmsghdr *nlh; |
566 | struct sk_buff *skb; | 587 | struct sk_buff *skb; |
567 | struct iscsi_uevent *ev; | 588 | struct iscsi_uevent *ev; |
568 | struct iscsi_cls_conn *conn; | ||
569 | char *pdu; | 589 | char *pdu; |
570 | int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) + | 590 | int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) + |
571 | data_size); | 591 | data_size); |
572 | 592 | ||
573 | conn = iscsi_if_find_conn(connh); | ||
574 | BUG_ON(!conn); | ||
575 | |||
576 | mempool_zone_complete(conn->z_pdu); | 593 | mempool_zone_complete(conn->z_pdu); |
577 | 594 | ||
578 | skb = mempool_zone_get_skb(conn->z_pdu); | 595 | skb = mempool_zone_get_skb(conn->z_pdu); |
579 | if (!skb) { | 596 | if (!skb) { |
580 | iscsi_conn_error(connh, ISCSI_ERR_CONN_FAILED); | 597 | iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); |
581 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " | 598 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " |
582 | "control PDU: OOM\n"); | 599 | "control PDU: OOM\n"); |
583 | return -ENOMEM; | 600 | return -ENOMEM; |
@@ -590,7 +607,7 @@ int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, | |||
590 | ev->type = ISCSI_KEVENT_RECV_PDU; | 607 | ev->type = ISCSI_KEVENT_RECV_PDU; |
591 | if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) | 608 | if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) |
592 | ev->iferror = -ENOMEM; | 609 | ev->iferror = -ENOMEM; |
593 | ev->r.recv_req.conn_handle = connh; | 610 | ev->r.recv_req.conn_handle = iscsi_handle(conn); |
594 | pdu = (char*)ev + sizeof(*ev); | 611 | pdu = (char*)ev + sizeof(*ev); |
595 | memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); | 612 | memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); |
596 | memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); | 613 | memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); |
@@ -599,17 +616,13 @@ int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, | |||
599 | } | 616 | } |
600 | EXPORT_SYMBOL_GPL(iscsi_recv_pdu); | 617 | EXPORT_SYMBOL_GPL(iscsi_recv_pdu); |
601 | 618 | ||
602 | void iscsi_conn_error(iscsi_connh_t connh, enum iscsi_err error) | 619 | void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error) |
603 | { | 620 | { |
604 | struct nlmsghdr *nlh; | 621 | struct nlmsghdr *nlh; |
605 | struct sk_buff *skb; | 622 | struct sk_buff *skb; |
606 | struct iscsi_uevent *ev; | 623 | struct iscsi_uevent *ev; |
607 | struct iscsi_cls_conn *conn; | ||
608 | int len = NLMSG_SPACE(sizeof(*ev)); | 624 | int len = NLMSG_SPACE(sizeof(*ev)); |
609 | 625 | ||
610 | conn = iscsi_if_find_conn(connh); | ||
611 | BUG_ON(!conn); | ||
612 | |||
613 | mempool_zone_complete(conn->z_error); | 626 | mempool_zone_complete(conn->z_error); |
614 | 627 | ||
615 | skb = mempool_zone_get_skb(conn->z_error); | 628 | skb = mempool_zone_get_skb(conn->z_error); |
@@ -626,7 +639,7 @@ void iscsi_conn_error(iscsi_connh_t connh, enum iscsi_err error) | |||
626 | if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat) | 639 | if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat) |
627 | ev->iferror = -ENOMEM; | 640 | ev->iferror = -ENOMEM; |
628 | ev->r.connerror.error = error; | 641 | ev->r.connerror.error = error; |
629 | ev->r.connerror.conn_handle = connh; | 642 | ev->r.connerror.conn_handle = iscsi_handle(conn); |
630 | 643 | ||
631 | iscsi_unicast_skb(conn->z_error, skb); | 644 | iscsi_unicast_skb(conn->z_error, skb); |
632 | 645 | ||
@@ -662,8 +675,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi, | |||
662 | } | 675 | } |
663 | 676 | ||
664 | static int | 677 | static int |
665 | iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb, | 678 | iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) |
666 | struct nlmsghdr *nlh) | ||
667 | { | 679 | { |
668 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); | 680 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); |
669 | struct iscsi_stats *stats; | 681 | struct iscsi_stats *stats; |
@@ -677,7 +689,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb, | |||
677 | ISCSI_STATS_CUSTOM_MAX); | 689 | ISCSI_STATS_CUSTOM_MAX); |
678 | int err = 0; | 690 | int err = 0; |
679 | 691 | ||
680 | conn = iscsi_if_find_conn(ev->u.get_stats.conn_handle); | 692 | conn = iscsi_conn_lookup(ev->u.get_stats.conn_handle); |
681 | if (!conn) | 693 | if (!conn) |
682 | return -EEXIST; | 694 | return -EEXIST; |
683 | 695 | ||
@@ -707,14 +719,14 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb, | |||
707 | ((char*)evstat + sizeof(*evstat)); | 719 | ((char*)evstat + sizeof(*evstat)); |
708 | memset(stats, 0, sizeof(*stats)); | 720 | memset(stats, 0, sizeof(*stats)); |
709 | 721 | ||
710 | transport->get_stats(ev->u.get_stats.conn_handle, stats); | 722 | transport->get_stats(conn, stats); |
711 | actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) + | 723 | actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) + |
712 | sizeof(struct iscsi_stats) + | 724 | sizeof(struct iscsi_stats) + |
713 | sizeof(struct iscsi_stats_custom) * | 725 | sizeof(struct iscsi_stats_custom) * |
714 | stats->custom_length); | 726 | stats->custom_length); |
715 | actual_size -= sizeof(*nlhstat); | 727 | actual_size -= sizeof(*nlhstat); |
716 | actual_size = NLMSG_LENGTH(actual_size); | 728 | actual_size = NLMSG_LENGTH(actual_size); |
717 | skb_trim(skb, NLMSG_ALIGN(actual_size)); | 729 | skb_trim(skbstat, NLMSG_ALIGN(actual_size)); |
718 | nlhstat->nlmsg_len = actual_size; | 730 | nlhstat->nlmsg_len = actual_size; |
719 | 731 | ||
720 | err = iscsi_unicast_skb(conn->z_pdu, skbstat); | 732 | err = iscsi_unicast_skb(conn->z_pdu, skbstat); |
@@ -727,58 +739,34 @@ static int | |||
727 | iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) | 739 | iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) |
728 | { | 740 | { |
729 | struct iscsi_transport *transport = priv->iscsi_transport; | 741 | struct iscsi_transport *transport = priv->iscsi_transport; |
730 | struct Scsi_Host *shost; | 742 | struct iscsi_cls_session *session; |
731 | 743 | uint32_t sid; | |
732 | if (!transport->create_session) | ||
733 | return -EINVAL; | ||
734 | 744 | ||
735 | shost = transport->create_session(&priv->t, | 745 | session = transport->create_session(&priv->t, |
736 | ev->u.c_session.initial_cmdsn); | 746 | ev->u.c_session.initial_cmdsn, |
737 | if (!shost) | 747 | &sid); |
748 | if (!session) | ||
738 | return -ENOMEM; | 749 | return -ENOMEM; |
739 | 750 | ||
740 | ev->r.c_session_ret.session_handle = iscsi_handle(iscsi_hostdata(shost->hostdata)); | 751 | ev->r.c_session_ret.session_handle = iscsi_handle(session); |
741 | ev->r.c_session_ret.sid = shost->host_no; | 752 | ev->r.c_session_ret.sid = sid; |
742 | return 0; | 753 | return 0; |
743 | } | 754 | } |
744 | 755 | ||
745 | static int | 756 | static int |
746 | iscsi_if_destroy_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) | 757 | iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) |
747 | { | 758 | { |
748 | struct iscsi_transport *transport = priv->iscsi_transport; | ||
749 | |||
750 | struct Scsi_Host *shost; | ||
751 | |||
752 | if (!transport->destroy_session) | ||
753 | return -EINVAL; | ||
754 | |||
755 | shost = scsi_host_lookup(ev->u.d_session.sid); | ||
756 | if (shost == ERR_PTR(-ENXIO)) | ||
757 | return -EEXIST; | ||
758 | |||
759 | if (transport->destroy_session) | ||
760 | transport->destroy_session(shost); | ||
761 | /* ref from host lookup */ | ||
762 | scsi_host_put(shost); | ||
763 | return 0; | ||
764 | } | ||
765 | |||
766 | static int | ||
767 | iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev){ | ||
768 | struct Scsi_Host *shost; | ||
769 | struct iscsi_cls_conn *conn; | 759 | struct iscsi_cls_conn *conn; |
760 | struct iscsi_cls_session *session; | ||
770 | unsigned long flags; | 761 | unsigned long flags; |
771 | 762 | ||
772 | if (!transport->create_conn) | 763 | session = iscsi_session_lookup(ev->u.c_conn.session_handle); |
764 | if (!session) | ||
773 | return -EINVAL; | 765 | return -EINVAL; |
774 | 766 | ||
775 | shost = scsi_host_lookup(ev->u.c_conn.sid); | 767 | conn = transport->create_conn(session, ev->u.c_conn.cid); |
776 | if (shost == ERR_PTR(-ENXIO)) | ||
777 | return -EEXIST; | ||
778 | |||
779 | conn = transport->create_conn(shost, ev->u.c_conn.cid); | ||
780 | if (!conn) | 768 | if (!conn) |
781 | goto release_ref; | 769 | return -ENOMEM; |
782 | 770 | ||
783 | conn->z_pdu = mempool_zone_init(Z_MAX_PDU, | 771 | conn->z_pdu = mempool_zone_init(Z_MAX_PDU, |
784 | NLMSG_SPACE(sizeof(struct iscsi_uevent) + | 772 | NLMSG_SPACE(sizeof(struct iscsi_uevent) + |
@@ -800,14 +788,13 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) | |||
800 | goto free_pdu_pool; | 788 | goto free_pdu_pool; |
801 | } | 789 | } |
802 | 790 | ||
803 | ev->r.handle = conn->connh = iscsi_handle(conn->dd_data); | 791 | ev->r.handle = iscsi_handle(conn); |
804 | 792 | ||
805 | spin_lock_irqsave(&connlock, flags); | 793 | spin_lock_irqsave(&connlock, flags); |
806 | list_add(&conn->conn_list, &connlist); | 794 | list_add(&conn->conn_list, &connlist); |
807 | conn->active = 1; | 795 | conn->active = 1; |
808 | spin_unlock_irqrestore(&connlock, flags); | 796 | spin_unlock_irqrestore(&connlock, flags); |
809 | 797 | ||
810 | scsi_host_put(shost); | ||
811 | return 0; | 798 | return 0; |
812 | 799 | ||
813 | free_pdu_pool: | 800 | free_pdu_pool: |
@@ -815,8 +802,6 @@ free_pdu_pool: | |||
815 | destroy_conn: | 802 | destroy_conn: |
816 | if (transport->destroy_conn) | 803 | if (transport->destroy_conn) |
817 | transport->destroy_conn(conn->dd_data); | 804 | transport->destroy_conn(conn->dd_data); |
818 | release_ref: | ||
819 | scsi_host_put(shost); | ||
820 | return -ENOMEM; | 805 | return -ENOMEM; |
821 | } | 806 | } |
822 | 807 | ||
@@ -827,13 +812,9 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev | |||
827 | struct iscsi_cls_conn *conn; | 812 | struct iscsi_cls_conn *conn; |
828 | struct mempool_zone *z_error, *z_pdu; | 813 | struct mempool_zone *z_error, *z_pdu; |
829 | 814 | ||
830 | conn = iscsi_if_find_conn(ev->u.d_conn.conn_handle); | 815 | conn = iscsi_conn_lookup(ev->u.d_conn.conn_handle); |
831 | if (!conn) | 816 | if (!conn) |
832 | return -EEXIST; | ||
833 | |||
834 | if (!transport->destroy_conn) | ||
835 | return -EINVAL; | 817 | return -EINVAL; |
836 | |||
837 | spin_lock_irqsave(&connlock, flags); | 818 | spin_lock_irqsave(&connlock, flags); |
838 | conn->active = 0; | 819 | conn->active = 0; |
839 | list_del(&conn->conn_list); | 820 | list_del(&conn->conn_list); |
@@ -858,23 +839,27 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
858 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); | 839 | struct iscsi_uevent *ev = NLMSG_DATA(nlh); |
859 | struct iscsi_transport *transport = NULL; | 840 | struct iscsi_transport *transport = NULL; |
860 | struct iscsi_internal *priv; | 841 | struct iscsi_internal *priv; |
861 | 842 | struct iscsi_cls_session *session; | |
862 | if (NETLINK_CREDS(skb)->uid) | 843 | struct iscsi_cls_conn *conn; |
863 | return -EPERM; | ||
864 | 844 | ||
865 | priv = iscsi_if_transport_lookup(iscsi_ptr(ev->transport_handle)); | 845 | priv = iscsi_if_transport_lookup(iscsi_ptr(ev->transport_handle)); |
866 | if (!priv) | 846 | if (!priv) |
867 | return -EINVAL; | 847 | return -EINVAL; |
868 | transport = priv->iscsi_transport; | 848 | transport = priv->iscsi_transport; |
869 | 849 | ||
870 | daemon_pid = NETLINK_CREDS(skb)->pid; | 850 | if (!try_module_get(transport->owner)) |
851 | return -EINVAL; | ||
871 | 852 | ||
872 | switch (nlh->nlmsg_type) { | 853 | switch (nlh->nlmsg_type) { |
873 | case ISCSI_UEVENT_CREATE_SESSION: | 854 | case ISCSI_UEVENT_CREATE_SESSION: |
874 | err = iscsi_if_create_session(priv, ev); | 855 | err = iscsi_if_create_session(priv, ev); |
875 | break; | 856 | break; |
876 | case ISCSI_UEVENT_DESTROY_SESSION: | 857 | case ISCSI_UEVENT_DESTROY_SESSION: |
877 | err = iscsi_if_destroy_session(priv, ev); | 858 | session = iscsi_session_lookup(ev->u.d_session.session_handle); |
859 | if (session) | ||
860 | transport->destroy_session(session); | ||
861 | else | ||
862 | err = -EINVAL; | ||
878 | break; | 863 | break; |
879 | case ISCSI_UEVENT_CREATE_CONN: | 864 | case ISCSI_UEVENT_CREATE_CONN: |
880 | err = iscsi_if_create_conn(transport, ev); | 865 | err = iscsi_if_create_conn(transport, ev); |
@@ -883,56 +868,64 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
883 | err = iscsi_if_destroy_conn(transport, ev); | 868 | err = iscsi_if_destroy_conn(transport, ev); |
884 | break; | 869 | break; |
885 | case ISCSI_UEVENT_BIND_CONN: | 870 | case ISCSI_UEVENT_BIND_CONN: |
886 | if (!iscsi_if_find_conn(ev->u.b_conn.conn_handle)) | 871 | session = iscsi_session_lookup(ev->u.b_conn.session_handle); |
887 | return -EEXIST; | 872 | conn = iscsi_conn_lookup(ev->u.b_conn.conn_handle); |
888 | ev->r.retcode = transport->bind_conn( | 873 | |
889 | ev->u.b_conn.session_handle, | 874 | if (session && conn) |
890 | ev->u.b_conn.conn_handle, | 875 | ev->r.retcode = transport->bind_conn(session, conn, |
891 | ev->u.b_conn.transport_fd, | 876 | ev->u.b_conn.transport_fd, |
892 | ev->u.b_conn.is_leading); | 877 | ev->u.b_conn.is_leading); |
878 | else | ||
879 | err = -EINVAL; | ||
893 | break; | 880 | break; |
894 | case ISCSI_UEVENT_SET_PARAM: | 881 | case ISCSI_UEVENT_SET_PARAM: |
895 | if (!iscsi_if_find_conn(ev->u.set_param.conn_handle)) | 882 | conn = iscsi_conn_lookup(ev->u.set_param.conn_handle); |
896 | return -EEXIST; | 883 | if (conn) |
897 | ev->r.retcode = transport->set_param( | 884 | ev->r.retcode = transport->set_param(conn, |
898 | ev->u.set_param.conn_handle, | 885 | ev->u.set_param.param, ev->u.set_param.value); |
899 | ev->u.set_param.param, ev->u.set_param.value); | 886 | else |
887 | err = -EINVAL; | ||
900 | break; | 888 | break; |
901 | case ISCSI_UEVENT_START_CONN: | 889 | case ISCSI_UEVENT_START_CONN: |
902 | if (!iscsi_if_find_conn(ev->u.start_conn.conn_handle)) | 890 | conn = iscsi_conn_lookup(ev->u.start_conn.conn_handle); |
903 | return -EEXIST; | 891 | if (conn) |
904 | ev->r.retcode = transport->start_conn( | 892 | ev->r.retcode = transport->start_conn(conn); |
905 | ev->u.start_conn.conn_handle); | 893 | else |
894 | err = -EINVAL; | ||
895 | |||
906 | break; | 896 | break; |
907 | case ISCSI_UEVENT_STOP_CONN: | 897 | case ISCSI_UEVENT_STOP_CONN: |
908 | if (!iscsi_if_find_conn(ev->u.stop_conn.conn_handle)) | 898 | conn = iscsi_conn_lookup(ev->u.stop_conn.conn_handle); |
909 | return -EEXIST; | 899 | if (conn) |
910 | transport->stop_conn(ev->u.stop_conn.conn_handle, | 900 | transport->stop_conn(conn, ev->u.stop_conn.flag); |
911 | ev->u.stop_conn.flag); | 901 | else |
902 | err = -EINVAL; | ||
912 | break; | 903 | break; |
913 | case ISCSI_UEVENT_SEND_PDU: | 904 | case ISCSI_UEVENT_SEND_PDU: |
914 | if (!iscsi_if_find_conn(ev->u.send_pdu.conn_handle)) | 905 | conn = iscsi_conn_lookup(ev->u.send_pdu.conn_handle); |
915 | return -EEXIST; | 906 | if (conn) |
916 | ev->r.retcode = transport->send_pdu( | 907 | ev->r.retcode = transport->send_pdu(conn, |
917 | ev->u.send_pdu.conn_handle, | 908 | (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), |
918 | (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), | 909 | (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, |
919 | (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, | 910 | ev->u.send_pdu.data_size); |
920 | ev->u.send_pdu.data_size); | 911 | else |
912 | err = -EINVAL; | ||
921 | break; | 913 | break; |
922 | case ISCSI_UEVENT_GET_STATS: | 914 | case ISCSI_UEVENT_GET_STATS: |
923 | err = iscsi_if_get_stats(transport, skb, nlh); | 915 | err = iscsi_if_get_stats(transport, nlh); |
924 | break; | 916 | break; |
925 | default: | 917 | default: |
926 | err = -EINVAL; | 918 | err = -EINVAL; |
927 | break; | 919 | break; |
928 | } | 920 | } |
929 | 921 | ||
922 | module_put(transport->owner); | ||
930 | return err; | 923 | return err; |
931 | } | 924 | } |
932 | 925 | ||
933 | /* Get message from skb (based on rtnetlink_rcv_skb). Each message is | 926 | /* Get message from skb (based on rtnetlink_rcv_skb). Each message is |
934 | * processed by iscsi_if_recv_msg. Malformed skbs with wrong length are | 927 | * processed by iscsi_if_recv_msg. Malformed skbs with wrong length are |
935 | * discarded silently. */ | 928 | * or invalid creds discarded silently. */ |
936 | static void | 929 | static void |
937 | iscsi_if_rx(struct sock *sk, int len) | 930 | iscsi_if_rx(struct sock *sk, int len) |
938 | { | 931 | { |
@@ -940,6 +933,12 @@ iscsi_if_rx(struct sock *sk, int len) | |||
940 | 933 | ||
941 | mutex_lock(&rx_queue_mutex); | 934 | mutex_lock(&rx_queue_mutex); |
942 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 935 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
936 | if (NETLINK_CREDS(skb)->uid) { | ||
937 | skb_pull(skb, skb->len); | ||
938 | goto free_skb; | ||
939 | } | ||
940 | daemon_pid = NETLINK_CREDS(skb)->pid; | ||
941 | |||
943 | while (skb->len >= NLMSG_SPACE(0)) { | 942 | while (skb->len >= NLMSG_SPACE(0)) { |
944 | int err; | 943 | int err; |
945 | uint32_t rlen; | 944 | uint32_t rlen; |
@@ -951,10 +950,12 @@ iscsi_if_rx(struct sock *sk, int len) | |||
951 | skb->len < nlh->nlmsg_len) { | 950 | skb->len < nlh->nlmsg_len) { |
952 | break; | 951 | break; |
953 | } | 952 | } |
953 | |||
954 | ev = NLMSG_DATA(nlh); | 954 | ev = NLMSG_DATA(nlh); |
955 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | 955 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); |
956 | if (rlen > skb->len) | 956 | if (rlen > skb->len) |
957 | rlen = skb->len; | 957 | rlen = skb->len; |
958 | |||
958 | err = iscsi_if_recv_msg(skb, nlh); | 959 | err = iscsi_if_recv_msg(skb, nlh); |
959 | if (err) { | 960 | if (err) { |
960 | ev->type = ISCSI_KEVENT_IF_ERROR; | 961 | ev->type = ISCSI_KEVENT_IF_ERROR; |
@@ -978,6 +979,7 @@ iscsi_if_rx(struct sock *sk, int len) | |||
978 | } while (err < 0 && err != -ECONNREFUSED); | 979 | } while (err < 0 && err != -ECONNREFUSED); |
979 | skb_pull(skb, rlen); | 980 | skb_pull(skb, rlen); |
980 | } | 981 | } |
982 | free_skb: | ||
981 | kfree_skb(skb); | 983 | kfree_skb(skb); |
982 | } | 984 | } |
983 | mutex_unlock(&rx_queue_mutex); | 985 | mutex_unlock(&rx_queue_mutex); |
@@ -997,7 +999,7 @@ show_conn_int_param_##param(struct class_device *cdev, char *buf) \ | |||
997 | struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \ | 999 | struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \ |
998 | struct iscsi_transport *t = conn->transport; \ | 1000 | struct iscsi_transport *t = conn->transport; \ |
999 | \ | 1001 | \ |
1000 | t->get_conn_param(conn->dd_data, param, &value); \ | 1002 | t->get_conn_param(conn, param, &value); \ |
1001 | return snprintf(buf, 20, format"\n", value); \ | 1003 | return snprintf(buf, 20, format"\n", value); \ |
1002 | } | 1004 | } |
1003 | 1005 | ||
@@ -1024,10 +1026,9 @@ show_session_int_param_##param(struct class_device *cdev, char *buf) \ | |||
1024 | { \ | 1026 | { \ |
1025 | uint32_t value = 0; \ | 1027 | uint32_t value = 0; \ |
1026 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ | 1028 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ |
1027 | struct Scsi_Host *shost = iscsi_session_to_shost(session); \ | ||
1028 | struct iscsi_transport *t = session->transport; \ | 1029 | struct iscsi_transport *t = session->transport; \ |
1029 | \ | 1030 | \ |
1030 | t->get_session_param(shost, param, &value); \ | 1031 | t->get_session_param(session, param, &value); \ |
1031 | return snprintf(buf, 20, format"\n", value); \ | 1032 | return snprintf(buf, 20, format"\n", value); \ |
1032 | } | 1033 | } |
1033 | 1034 | ||
@@ -1121,7 +1122,6 @@ iscsi_register_transport(struct iscsi_transport *tt) | |||
1121 | return NULL; | 1122 | return NULL; |
1122 | memset(priv, 0, sizeof(*priv)); | 1123 | memset(priv, 0, sizeof(*priv)); |
1123 | INIT_LIST_HEAD(&priv->list); | 1124 | INIT_LIST_HEAD(&priv->list); |
1124 | INIT_LIST_HEAD(&priv->sessions); | ||
1125 | priv->iscsi_transport = tt; | 1125 | priv->iscsi_transport = tt; |
1126 | 1126 | ||
1127 | priv->cdev.class = &iscsi_transport_class; | 1127 | priv->cdev.class = &iscsi_transport_class; |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 930db398d107..9d9872347f56 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -89,6 +89,11 @@ | |||
89 | #define SD_MAX_RETRIES 5 | 89 | #define SD_MAX_RETRIES 5 |
90 | #define SD_PASSTHROUGH_RETRIES 1 | 90 | #define SD_PASSTHROUGH_RETRIES 1 |
91 | 91 | ||
92 | /* | ||
93 | * Size of the initial data buffer for mode and read capacity data | ||
94 | */ | ||
95 | #define SD_BUF_SIZE 512 | ||
96 | |||
92 | static void scsi_disk_release(struct kref *kref); | 97 | static void scsi_disk_release(struct kref *kref); |
93 | 98 | ||
94 | struct scsi_disk { | 99 | struct scsi_disk { |
@@ -1239,7 +1244,7 @@ sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage, | |||
1239 | 1244 | ||
1240 | /* | 1245 | /* |
1241 | * read write protect setting, if possible - called only in sd_revalidate_disk() | 1246 | * read write protect setting, if possible - called only in sd_revalidate_disk() |
1242 | * called with buffer of length 512 | 1247 | * called with buffer of length SD_BUF_SIZE |
1243 | */ | 1248 | */ |
1244 | static void | 1249 | static void |
1245 | sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, | 1250 | sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, |
@@ -1297,7 +1302,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, | |||
1297 | 1302 | ||
1298 | /* | 1303 | /* |
1299 | * sd_read_cache_type - called only from sd_revalidate_disk() | 1304 | * sd_read_cache_type - called only from sd_revalidate_disk() |
1300 | * called with buffer of length 512 | 1305 | * called with buffer of length SD_BUF_SIZE |
1301 | */ | 1306 | */ |
1302 | static void | 1307 | static void |
1303 | sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | 1308 | sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, |
@@ -1342,6 +1347,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1342 | 1347 | ||
1343 | /* Take headers and block descriptors into account */ | 1348 | /* Take headers and block descriptors into account */ |
1344 | len += data.header_length + data.block_descriptor_length; | 1349 | len += data.header_length + data.block_descriptor_length; |
1350 | if (len > SD_BUF_SIZE) | ||
1351 | goto bad_sense; | ||
1345 | 1352 | ||
1346 | /* Get the data */ | 1353 | /* Get the data */ |
1347 | res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); | 1354 | res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); |
@@ -1354,6 +1361,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1354 | int ct = 0; | 1361 | int ct = 0; |
1355 | int offset = data.header_length + data.block_descriptor_length; | 1362 | int offset = data.header_length + data.block_descriptor_length; |
1356 | 1363 | ||
1364 | if (offset >= SD_BUF_SIZE - 2) { | ||
1365 | printk(KERN_ERR "%s: malformed MODE SENSE response", | ||
1366 | diskname); | ||
1367 | goto defaults; | ||
1368 | } | ||
1369 | |||
1357 | if ((buffer[offset] & 0x3f) != modepage) { | 1370 | if ((buffer[offset] & 0x3f) != modepage) { |
1358 | printk(KERN_ERR "%s: got wrong page\n", diskname); | 1371 | printk(KERN_ERR "%s: got wrong page\n", diskname); |
1359 | goto defaults; | 1372 | goto defaults; |
@@ -1398,6 +1411,7 @@ defaults: | |||
1398 | diskname); | 1411 | diskname); |
1399 | sdkp->WCE = 0; | 1412 | sdkp->WCE = 0; |
1400 | sdkp->RCD = 0; | 1413 | sdkp->RCD = 0; |
1414 | sdkp->DPOFUA = 0; | ||
1401 | } | 1415 | } |
1402 | 1416 | ||
1403 | /** | 1417 | /** |
@@ -1421,7 +1435,7 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1421 | if (!scsi_device_online(sdp)) | 1435 | if (!scsi_device_online(sdp)) |
1422 | goto out; | 1436 | goto out; |
1423 | 1437 | ||
1424 | buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA); | 1438 | buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA); |
1425 | if (!buffer) { | 1439 | if (!buffer) { |
1426 | printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " | 1440 | printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " |
1427 | "failure.\n"); | 1441 | "failure.\n"); |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 2a547538d444..5a0a19322d01 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -2162,7 +2162,7 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size) | |||
2162 | 2162 | ||
2163 | srp->res_used = 1; | 2163 | srp->res_used = 1; |
2164 | SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size)); | 2164 | SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size)); |
2165 | rem = size = (size + 1) & (~1); /* round to even for aha1542 */ | 2165 | rem = size; |
2166 | 2166 | ||
2167 | for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) { | 2167 | for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) { |
2168 | num = sg->length; | 2168 | num = sg->length; |
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 5d02ff4db6cc..b65462f76484 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c | |||
@@ -192,7 +192,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) | |||
192 | SDev = cd->device; | 192 | SDev = cd->device; |
193 | 193 | ||
194 | if (!sense) { | 194 | if (!sense) { |
195 | sense = kmalloc(sizeof(*sense), GFP_KERNEL); | 195 | sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); |
196 | if (!sense) { | 196 | if (!sense) { |
197 | err = -ENOMEM; | 197 | err = -ENOMEM; |
198 | goto out; | 198 | goto out; |
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index 8260f040d39c..2627000ca653 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c | |||
@@ -919,6 +919,8 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru | |||
919 | 919 | ||
920 | tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED); | 920 | tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED); |
921 | tp->usrtags = SYM_SETUP_MAX_TAG; | 921 | tp->usrtags = SYM_SETUP_MAX_TAG; |
922 | tp->usr_width = np->maxwide; | ||
923 | tp->usr_period = 9; | ||
922 | 924 | ||
923 | sym_nvram_setup_target(tp, i, nvram); | 925 | sym_nvram_setup_target(tp, i, nvram); |
924 | 926 | ||
@@ -3588,7 +3590,7 @@ static int sym_evaluate_dp(struct sym_hcb *np, struct sym_ccb *cp, u32 scr, int | |||
3588 | 3590 | ||
3589 | if (pm) { | 3591 | if (pm) { |
3590 | dp_scr = scr_to_cpu(pm->ret); | 3592 | dp_scr = scr_to_cpu(pm->ret); |
3591 | dp_ofs -= scr_to_cpu(pm->sg.size); | 3593 | dp_ofs -= scr_to_cpu(pm->sg.size) & 0x00ffffff; |
3592 | } | 3594 | } |
3593 | 3595 | ||
3594 | /* | 3596 | /* |