aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/scsi/ChangeLog.megaraid_sas24
-rw-r--r--Documentation/scsi/aic79xx.txt93
-rw-r--r--Documentation/scsi/aic7xxx.txt86
-rw-r--r--drivers/message/fusion/Makefile2
-rw-r--r--drivers/message/fusion/mptbase.c184
-rw-r--r--drivers/message/fusion/mptbase.h16
-rw-r--r--drivers/message/fusion/mptfc.c203
-rw-r--r--drivers/message/fusion/mptsas.c241
-rw-r--r--drivers/message/fusion/mptscsih.c116
-rw-r--r--drivers/message/fusion/mptscsih.h1
-rw-r--r--drivers/message/fusion/mptspi.c10
-rw-r--r--drivers/scsi/aic7xxx/Kconfig.aic79xx4
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.h3
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.reg29
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.seq143
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c286
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_inline.h7
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c43
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h10
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c17
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_pci.c11
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_reg.h_shipped27
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped21
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_seq.h_shipped881
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm.c23
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_gram.y19
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h88
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_scan.l27
-rw-r--r--drivers/scsi/dc395x.c6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c67
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h3
-rw-r--r--drivers/scsi/ibmvscsi/iseries_vscsi.c13
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c22
-rw-r--r--drivers/scsi/ips.c54
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c291
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h24
-rw-r--r--drivers/scsi/qla1280.c311
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h6
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c83
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c16
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c55
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/scsi/scsi_transport_sas.c6
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/st.c2
-rw-r--r--include/scsi/scsi_device.h2
48 files changed, 2161 insertions, 1428 deletions
diff --git a/Documentation/scsi/ChangeLog.megaraid_sas b/Documentation/scsi/ChangeLog.megaraid_sas
new file mode 100644
index 000000000000..f8c16cbf56ba
--- /dev/null
+++ b/Documentation/scsi/ChangeLog.megaraid_sas
@@ -0,0 +1,24 @@
11 Release Date : Mon Jan 23 14:09:01 PST 2006 - Sumant Patro <Sumant.Patro@lsil.com>
22 Current Version : 00.00.02.02
33 Older Version : 00.00.02.01
4
5i. New template defined to represent each family of controllers (identified by processor used).
6 The template will have defintions that will be initialised to appropritae values for a specific family of controllers. The template definition has four function pointers. During driver initialisation the function pointers will be set based on the controller family type. This change is done to support new controllers that has different processors and thus different register set.
7
8 -Sumant Patro <Sumant.Patro@lsil.com>
9
101 Release Date : Mon Dec 19 14:36:26 PST 2005 - Sumant Patro <Sumant.Patro@lsil.com>
112 Current Version : 00.00.02.00-rc4
123 Older Version : 00.00.02.01
13
14i. Code reorganized to remove code duplication in megasas_build_cmd.
15
16 "There's a lot of duplicate code megasas_build_cmd. Move that out of the different codepathes and merge the reminder of megasas_build_cmd into megasas_queue_command"
17
18 - Christoph Hellwig <hch@lst.de>
19
20ii. Defined MEGASAS_IOC_FIRMWARE32 for code paths that handles 32 bit applications in 64 bit systems.
21
22 "MEGASAS_IOC_FIRMWARE can't be redefined if CONFIG_COMPAT is set, we need to define a MEGASAS_IOC_FIRMWARE32 define so native binaries continue to work"
23
24 - Christoph Hellwig <hch@lst.de>
diff --git a/Documentation/scsi/aic79xx.txt b/Documentation/scsi/aic79xx.txt
index 0aeef740a95a..382b439b439e 100644
--- a/Documentation/scsi/aic79xx.txt
+++ b/Documentation/scsi/aic79xx.txt
@@ -1,5 +1,5 @@
1==================================================================== 1====================================================================
2= Adaptec Ultra320 Family Manager Set v1.3.11 = 2= Adaptec Ultra320 Family Manager Set =
3= = 3= =
4= README for = 4= README for =
5= The Linux Operating System = 5= The Linux Operating System =
@@ -63,6 +63,11 @@ The following information is available in this file:
63 68-pin) 63 68-pin)
642. Version History 642. Version History
65 65
66 3.0 (December 1st, 2005)
67 - Updated driver to use SCSI transport class infrastructure
68 - Upported sequencer and core fixes from adaptec released
69 version 2.0.15 of the driver.
70
66 1.3.11 (July 11, 2003) 71 1.3.11 (July 11, 2003)
67 - Fix several deadlock issues. 72 - Fix several deadlock issues.
68 - Add 29320ALP and 39320B Id's. 73 - Add 29320ALP and 39320B Id's.
@@ -194,7 +199,7 @@ The following information is available in this file:
194 supported) 199 supported)
195 - Support for the PCI-X standard up to 133MHz 200 - Support for the PCI-X standard up to 133MHz
196 - Support for the PCI v2.2 standard 201 - Support for the PCI v2.2 standard
197 - Domain Validation 202 - Domain Validation
198 203
199 2.2. Operating System Support: 204 2.2. Operating System Support:
200 - Redhat Linux 7.2, 7.3, 8.0, Advanced Server 2.1 205 - Redhat Linux 7.2, 7.3, 8.0, Advanced Server 2.1
@@ -411,77 +416,53 @@ The following information is available in this file:
411 http://www.adaptec.com. 416 http://www.adaptec.com.
412 417
413 418
4145. Contacting Adaptec 4195. Adaptec Customer Support
415 420
416 A Technical Support Identification (TSID) Number is required for 421 A Technical Support Identification (TSID) Number is required for
417 Adaptec technical support. 422 Adaptec technical support.
418 - The 12-digit TSID can be found on the white barcode-type label 423 - The 12-digit TSID can be found on the white barcode-type label
419 included inside the box with your product. The TSID helps us 424 included inside the box with your product. The TSID helps us
420 provide more efficient service by accurately identifying your 425 provide more efficient service by accurately identifying your
421 product and support status. 426 product and support status.
427
422 Support Options 428 Support Options
423 - Search the Adaptec Support Knowledgebase (ASK) at 429 - Search the Adaptec Support Knowledgebase (ASK) at
424 http://ask.adaptec.com for articles, troubleshooting tips, and 430 http://ask.adaptec.com for articles, troubleshooting tips, and
425 frequently asked questions for your product. 431 frequently asked questions about your product.
426 - For support via Email, submit your question to Adaptec's 432 - For support via Email, submit your question to Adaptec's
427 Technical Support Specialists at http://ask.adaptec.com. 433 Technical Support Specialists at http://ask.adaptec.com/.
428 434
429 North America 435 North America
430 - Visit our Web site at http://www.adaptec.com. 436 - Visit our Web site at http://www.adaptec.com/.
431 - To speak with a Fibre Channel/RAID/External Storage Technical 437 - For information about Adaptec's support options, call
432 Support Specialist, call 1-321-207-2000, 438 408-957-2550, 24 hours a day, 7 days a week.
433 Hours: Monday-Friday, 3:00 A.M. to 5:00 P.M., PST. 439 - To speak with a Technical Support Specialist,
434 (Not open on holidays) 440 * For hardware products, call 408-934-7274,
435 - For Technical Support in all other technologies including 441 Monday to Friday, 3:00 am to 5:00 pm, PDT.
436 SCSI, call 1-408-934-7274, 442 * For RAID and Fibre Channel products, call 321-207-2000,
437 Hours: Monday-Friday, 6:00 A.M. to 5:00 P.M., PST. 443 Monday to Friday, 3:00 am to 5:00 pm, PDT.
438 (Not open on holidays) 444 To expedite your service, have your computer with you.
439 - For after hours support, call 1-800-416-8066 ($99/call, 445 - To order Adaptec products, including accessories and cables,
440 $149/call on holidays) 446 call 408-957-7274. To order cables online go to
441 - To order Adaptec products including software and cables, call 447 http://www.adaptec.com/buy-cables/.
442 1-800-442-7274 or 1-408-957-7274. You can also visit our
443 online store at http://www.adaptecstore.com
444 448
445 Europe 449 Europe
446 - Visit our Web site at http://www.adaptec-europe.com. 450 - Visit our Web site at http://www.adaptec-europe.com/.
447 - English and French: To speak with a Technical Support 451 - To speak with a Technical Support Specialist, call, or email,
448 Specialist, call one of the following numbers: 452 * German: +49 89 4366 5522, Monday-Friday, 9:00-17:00 CET,
449 - English: +32-2-352-3470 453 http://ask-de.adaptec.com/.
450 - French: +32-2-352-3460 454 * French: +49 89 4366 5533, Monday-Friday, 9:00-17:00 CET,
451 Hours: Monday-Thursday, 10:00 to 12:30, 13:30 to 17:30 CET 455 http://ask-fr.adaptec.com/.
452 Friday, 10:00 to 12:30, 13:30 to 16:30 CET 456 * English: +49 89 4366 5544, Monday-Friday, 9:00-17:00 GMT,
453 - German: To speak with a Technical Support Specialist, 457 http://ask.adaptec.com/.
454 call +49-89-456-40660 458 - You can order Adaptec cables online at
455 Hours: Monday-Thursday, 09:30 to 12:30, 13:30 to 16:30 CET 459 http://www.adaptec.com/buy-cables/.
456 Friday, 09:30 to 12:30, 13:30 to 15:00 CET
457 - To order Adaptec products, including accessories and cables:
458 - UK: +0800-96-65-26 or fax +0800-731-02-95
459 - Other European countries: +32-11-300-379
460
461 Australia and New Zealand
462 - Visit our Web site at http://www.adaptec.com.au.
463 - To speak with a Technical Support Specialist, call
464 +612-9416-0698
465 Hours: Monday-Friday, 10:00 A.M. to 4:30 P.M., EAT
466 (Not open on holidays)
467 460
468 Japan 461 Japan
462 - Visit our web site at http://www.adaptec.co.jp/.
469 - To speak with a Technical Support Specialist, call 463 - To speak with a Technical Support Specialist, call
470 +81-3-5308-6120 464 +81 3 5308 6120, Monday-Friday, 9:00 a.m. to 12:00 p.m.,
471 Hours: Monday-Friday, 9:00 a.m. to 12:00 p.m., 1:00 p.m. to 465 1:00 p.m. to 6:00 p.m.
472 6:00 p.m. TSC
473
474 Hong Kong and China
475 - To speak with a Technical Support Specialist, call
476 +852-2869-7200
477 Hours: Monday-Friday, 10:00 to 17:00.
478 - Fax Technical Support at +852-2869-7100.
479
480 Singapore
481 - To speak with a Technical Support Specialist, call
482 +65-245-7470
483 Hours: Monday-Friday, 10:00 to 17:00.
484 - Fax Technical Support at +852-2869-7100
485 466
486------------------------------------------------------------------- 467-------------------------------------------------------------------
487/* 468/*
diff --git a/Documentation/scsi/aic7xxx.txt b/Documentation/scsi/aic7xxx.txt
index 47e74ddc4bc9..3481fcded4c2 100644
--- a/Documentation/scsi/aic7xxx.txt
+++ b/Documentation/scsi/aic7xxx.txt
@@ -309,81 +309,57 @@ The following information is available in this file:
309 ----------------------------------------------------------------- 309 -----------------------------------------------------------------
310 310
311 Example: 311 Example:
312 'options aic7xxx aic7xxx=verbose,no_probe,tag_info:{{},{,,10}},seltime:1" 312 'options aic7xxx aic7xxx=verbose,no_probe,tag_info:{{},{,,10}},seltime:1'
313 enables verbose logging, Disable EISA/VLB probing, 313 enables verbose logging, Disable EISA/VLB probing,
314 and set tag depth on Controller 1/Target 2 to 10 tags. 314 and set tag depth on Controller 1/Target 2 to 10 tags.
315 315
3163. Contacting Adaptec 3164. Adaptec Customer Support
317 317
318 A Technical Support Identification (TSID) Number is required for 318 A Technical Support Identification (TSID) Number is required for
319 Adaptec technical support. 319 Adaptec technical support.
320 - The 12-digit TSID can be found on the white barcode-type label 320 - The 12-digit TSID can be found on the white barcode-type label
321 included inside the box with your product. The TSID helps us 321 included inside the box with your product. The TSID helps us
322 provide more efficient service by accurately identifying your 322 provide more efficient service by accurately identifying your
323 product and support status. 323 product and support status.
324
324 Support Options 325 Support Options
325 - Search the Adaptec Support Knowledgebase (ASK) at 326 - Search the Adaptec Support Knowledgebase (ASK) at
326 http://ask.adaptec.com for articles, troubleshooting tips, and 327 http://ask.adaptec.com for articles, troubleshooting tips, and
327 frequently asked questions for your product. 328 frequently asked questions about your product.
328 - For support via Email, submit your question to Adaptec's 329 - For support via Email, submit your question to Adaptec's
329 Technical Support Specialists at http://ask.adaptec.com. 330 Technical Support Specialists at http://ask.adaptec.com/.
330 331
331 North America 332 North America
332 - Visit our Web site at http://www.adaptec.com. 333 - Visit our Web site at http://www.adaptec.com/.
333 - To speak with a Fibre Channel/RAID/External Storage Technical 334 - For information about Adaptec's support options, call
334 Support Specialist, call 1-321-207-2000, 335 408-957-2550, 24 hours a day, 7 days a week.
335 Hours: Monday-Friday, 3:00 A.M. to 5:00 P.M., PST. 336 - To speak with a Technical Support Specialist,
336 (Not open on holidays) 337 * For hardware products, call 408-934-7274,
337 - For Technical Support in all other technologies including 338 Monday to Friday, 3:00 am to 5:00 pm, PDT.
338 SCSI, call 1-408-934-7274, 339 * For RAID and Fibre Channel products, call 321-207-2000,
339 Hours: Monday-Friday, 6:00 A.M. to 5:00 P.M., PST. 340 Monday to Friday, 3:00 am to 5:00 pm, PDT.
340 (Not open on holidays) 341 To expedite your service, have your computer with you.
341 - For after hours support, call 1-800-416-8066 ($99/call, 342 - To order Adaptec products, including accessories and cables,
342 $149/call on holidays) 343 call 408-957-7274. To order cables online go to
343 - To order Adaptec products including software and cables, call 344 http://www.adaptec.com/buy-cables/.
344 1-800-442-7274 or 1-408-957-7274. You can also visit our
345 online store at http://www.adaptecstore.com
346 345
347 Europe 346 Europe
348 - Visit our Web site at http://www.adaptec-europe.com. 347 - Visit our Web site at http://www.adaptec-europe.com/.
349 - English and French: To speak with a Technical Support 348 - To speak with a Technical Support Specialist, call, or email,
350 Specialist, call one of the following numbers: 349 * German: +49 89 4366 5522, Monday-Friday, 9:00-17:00 CET,
351 - English: +32-2-352-3470 350 http://ask-de.adaptec.com/.
352 - French: +32-2-352-3460 351 * French: +49 89 4366 5533, Monday-Friday, 9:00-17:00 CET,
353 Hours: Monday-Thursday, 10:00 to 12:30, 13:30 to 17:30 CET 352 http://ask-fr.adaptec.com/.
354 Friday, 10:00 to 12:30, 13:30 to 16:30 CET 353 * English: +49 89 4366 5544, Monday-Friday, 9:00-17:00 GMT,
355 - German: To speak with a Technical Support Specialist, 354 http://ask.adaptec.com/.
356 call +49-89-456-40660 355 - You can order Adaptec cables online at
357 Hours: Monday-Thursday, 09:30 to 12:30, 13:30 to 16:30 CET 356 http://www.adaptec.com/buy-cables/.
358 Friday, 09:30 to 12:30, 13:30 to 15:00 CET
359 - To order Adaptec products, including accessories and cables:
360 - UK: +0800-96-65-26 or fax +0800-731-02-95
361 - Other European countries: +32-11-300-379
362
363 Australia and New Zealand
364 - Visit our Web site at http://www.adaptec.com.au.
365 - To speak with a Technical Support Specialist, call
366 +612-9416-0698
367 Hours: Monday-Friday, 10:00 A.M. to 4:30 P.M., EAT
368 (Not open on holidays)
369 357
370 Japan 358 Japan
359 - Visit our web site at http://www.adaptec.co.jp/.
371 - To speak with a Technical Support Specialist, call 360 - To speak with a Technical Support Specialist, call
372 +81-3-5308-6120 361 +81 3 5308 6120, Monday-Friday, 9:00 a.m. to 12:00 p.m.,
373 Hours: Monday-Friday, 9:00 a.m. to 12:00 p.m., 1:00 p.m. to 362 1:00 p.m. to 6:00 p.m.
374 6:00 p.m. TSC
375
376 Hong Kong and China
377 - To speak with a Technical Support Specialist, call
378 +852-2869-7200
379 Hours: Monday-Friday, 10:00 to 17:00.
380 - Fax Technical Support at +852-2869-7100.
381
382 Singapore
383 - To speak with a Technical Support Specialist, call
384 +65-245-7470
385 Hours: Monday-Friday, 10:00 to 17:00.
386 - Fax Technical Support at +852-2869-7100
387 363
388------------------------------------------------------------------- 364-------------------------------------------------------------------
389/* 365/*
diff --git a/drivers/message/fusion/Makefile b/drivers/message/fusion/Makefile
index 8a2e2657f4c2..33ace373241c 100644
--- a/drivers/message/fusion/Makefile
+++ b/drivers/message/fusion/Makefile
@@ -29,6 +29,8 @@
29# For mptctl: 29# For mptctl:
30#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL 30#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
31# 31#
32# For mptfc:
33#CFLAGS_mptfc.o += -DMPT_DEBUG_FC
32 34
33#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC 35#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
34 36
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index d890b2b8a93e..9a2c7605d49c 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -81,6 +81,10 @@ MODULE_LICENSE("GPL");
81/* 81/*
82 * cmd line parameters 82 * cmd line parameters
83 */ 83 */
84static int mpt_msi_enable;
85module_param(mpt_msi_enable, int, 0);
86MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)");
87
84#ifdef MFCNT 88#ifdef MFCNT
85static int mfcounter = 0; 89static int mfcounter = 0;
86#define PRINT_MF_COUNT 20000 90#define PRINT_MF_COUNT 20000
@@ -174,7 +178,7 @@ static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
174static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers); 178static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers);
175static void mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); 179static void mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf);
176static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); 180static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
177static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info); 181static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info);
178static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); 182static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info);
179 183
180/* module entry point */ 184/* module entry point */
@@ -313,7 +317,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
313 if (ioc->bus_type == FC) 317 if (ioc->bus_type == FC)
314 mpt_fc_log_info(ioc, log_info); 318 mpt_fc_log_info(ioc, log_info);
315 else if (ioc->bus_type == SPI) 319 else if (ioc->bus_type == SPI)
316 mpt_sp_log_info(ioc, log_info); 320 mpt_spi_log_info(ioc, log_info);
317 else if (ioc->bus_type == SAS) 321 else if (ioc->bus_type == SAS)
318 mpt_sas_log_info(ioc, log_info); 322 mpt_sas_log_info(ioc, log_info);
319 } 323 }
@@ -1444,6 +1448,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1444 1448
1445 ioc->pci_irq = -1; 1449 ioc->pci_irq = -1;
1446 if (pdev->irq) { 1450 if (pdev->irq) {
1451 if (mpt_msi_enable && !pci_enable_msi(pdev))
1452 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name);
1453
1447 r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc); 1454 r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc);
1448 1455
1449 if (r < 0) { 1456 if (r < 0) {
@@ -1483,6 +1490,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1483 1490
1484 list_del(&ioc->list); 1491 list_del(&ioc->list);
1485 free_irq(ioc->pci_irq, ioc); 1492 free_irq(ioc->pci_irq, ioc);
1493 if (mpt_msi_enable)
1494 pci_disable_msi(pdev);
1495 if (ioc->alt_ioc)
1496 ioc->alt_ioc->alt_ioc = NULL;
1486 iounmap(mem); 1497 iounmap(mem);
1487 kfree(ioc); 1498 kfree(ioc);
1488 pci_set_drvdata(pdev, NULL); 1499 pci_set_drvdata(pdev, NULL);
@@ -2136,6 +2147,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
2136 2147
2137 if (ioc->pci_irq != -1) { 2148 if (ioc->pci_irq != -1) {
2138 free_irq(ioc->pci_irq, ioc); 2149 free_irq(ioc->pci_irq, ioc);
2150 if (mpt_msi_enable)
2151 pci_disable_msi(ioc->pcidev);
2139 ioc->pci_irq = -1; 2152 ioc->pci_irq = -1;
2140 } 2153 }
2141 2154
@@ -2157,6 +2170,10 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
2157 sz_last = ioc->alloc_total; 2170 sz_last = ioc->alloc_total;
2158 dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n", 2171 dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n",
2159 ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first)); 2172 ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first));
2173
2174 if (ioc->alt_ioc)
2175 ioc->alt_ioc->alt_ioc = NULL;
2176
2160 kfree(ioc); 2177 kfree(ioc);
2161} 2178}
2162 2179
@@ -2770,13 +2787,16 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
2770 2787
2771 /* RAID FW may take a long time to enable 2788 /* RAID FW may take a long time to enable
2772 */ 2789 */
2773 if ( (ioc->facts.ProductID & MPI_FW_HEADER_PID_PROD_MASK) 2790 if (((ioc->facts.ProductID & MPI_FW_HEADER_PID_PROD_MASK)
2774 > MPI_FW_HEADER_PID_PROD_TARGET_SCSI ) { 2791 > MPI_FW_HEADER_PID_PROD_TARGET_SCSI) ||
2775 rc = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&port_enable, 2792 (ioc->bus_type == SAS)) {
2776 reply_sz, (u16*)&reply_buf, 300 /*seconds*/, sleepFlag); 2793 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
2794 (u32*)&port_enable, reply_sz, (u16*)&reply_buf,
2795 300 /*seconds*/, sleepFlag);
2777 } else { 2796 } else {
2778 rc = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&port_enable, 2797 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
2779 reply_sz, (u16*)&reply_buf, 30 /*seconds*/, sleepFlag); 2798 (u32*)&port_enable, reply_sz, (u16*)&reply_buf,
2799 30 /*seconds*/, sleepFlag);
2780 } 2800 }
2781 return rc; 2801 return rc;
2782} 2802}
@@ -4387,6 +4407,138 @@ mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode)
4387} 4407}
4388 4408
4389/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 4409/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4410
4411static void
4412mptbase_raid_process_event_data(MPT_ADAPTER *ioc,
4413 MpiEventDataRaid_t * pRaidEventData)
4414{
4415 int volume;
4416 int reason;
4417 int disk;
4418 int status;
4419 int flags;
4420 int state;
4421
4422 volume = pRaidEventData->VolumeID;
4423 reason = pRaidEventData->ReasonCode;
4424 disk = pRaidEventData->PhysDiskNum;
4425 status = le32_to_cpu(pRaidEventData->SettingsStatus);
4426 flags = (status >> 0) & 0xff;
4427 state = (status >> 8) & 0xff;
4428
4429 if (reason == MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED) {
4430 return;
4431 }
4432
4433 if ((reason >= MPI_EVENT_RAID_RC_PHYSDISK_CREATED &&
4434 reason <= MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED) ||
4435 (reason == MPI_EVENT_RAID_RC_SMART_DATA)) {
4436 printk(MYIOC_s_INFO_FMT "RAID STATUS CHANGE for PhysDisk %d\n",
4437 ioc->name, disk);
4438 } else {
4439 printk(MYIOC_s_INFO_FMT "RAID STATUS CHANGE for VolumeID %d\n",
4440 ioc->name, volume);
4441 }
4442
4443 switch(reason) {
4444 case MPI_EVENT_RAID_RC_VOLUME_CREATED:
4445 printk(MYIOC_s_INFO_FMT " volume has been created\n",
4446 ioc->name);
4447 break;
4448
4449 case MPI_EVENT_RAID_RC_VOLUME_DELETED:
4450
4451 printk(MYIOC_s_INFO_FMT " volume has been deleted\n",
4452 ioc->name);
4453 break;
4454
4455 case MPI_EVENT_RAID_RC_VOLUME_SETTINGS_CHANGED:
4456 printk(MYIOC_s_INFO_FMT " volume settings have been changed\n",
4457 ioc->name);
4458 break;
4459
4460 case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED:
4461 printk(MYIOC_s_INFO_FMT " volume is now %s%s%s%s\n",
4462 ioc->name,
4463 state == MPI_RAIDVOL0_STATUS_STATE_OPTIMAL
4464 ? "optimal"
4465 : state == MPI_RAIDVOL0_STATUS_STATE_DEGRADED
4466 ? "degraded"
4467 : state == MPI_RAIDVOL0_STATUS_STATE_FAILED
4468 ? "failed"
4469 : "state unknown",
4470 flags & MPI_RAIDVOL0_STATUS_FLAG_ENABLED
4471 ? ", enabled" : "",
4472 flags & MPI_RAIDVOL0_STATUS_FLAG_QUIESCED
4473 ? ", quiesced" : "",
4474 flags & MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS
4475 ? ", resync in progress" : "" );
4476 break;
4477
4478 case MPI_EVENT_RAID_RC_VOLUME_PHYSDISK_CHANGED:
4479 printk(MYIOC_s_INFO_FMT " volume membership of PhysDisk %d has changed\n",
4480 ioc->name, disk);
4481 break;
4482
4483 case MPI_EVENT_RAID_RC_PHYSDISK_CREATED:
4484 printk(MYIOC_s_INFO_FMT " PhysDisk has been created\n",
4485 ioc->name);
4486 break;
4487
4488 case MPI_EVENT_RAID_RC_PHYSDISK_DELETED:
4489 printk(MYIOC_s_INFO_FMT " PhysDisk has been deleted\n",
4490 ioc->name);
4491 break;
4492
4493 case MPI_EVENT_RAID_RC_PHYSDISK_SETTINGS_CHANGED:
4494 printk(MYIOC_s_INFO_FMT " PhysDisk settings have been changed\n",
4495 ioc->name);
4496 break;
4497
4498 case MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED:
4499 printk(MYIOC_s_INFO_FMT " PhysDisk is now %s%s%s\n",
4500 ioc->name,
4501 state == MPI_PHYSDISK0_STATUS_ONLINE
4502 ? "online"
4503 : state == MPI_PHYSDISK0_STATUS_MISSING
4504 ? "missing"
4505 : state == MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE
4506 ? "not compatible"
4507 : state == MPI_PHYSDISK0_STATUS_FAILED
4508 ? "failed"
4509 : state == MPI_PHYSDISK0_STATUS_INITIALIZING
4510 ? "initializing"
4511 : state == MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED
4512 ? "offline requested"
4513 : state == MPI_PHYSDISK0_STATUS_FAILED_REQUESTED
4514 ? "failed requested"
4515 : state == MPI_PHYSDISK0_STATUS_OTHER_OFFLINE
4516 ? "offline"
4517 : "state unknown",
4518 flags & MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC
4519 ? ", out of sync" : "",
4520 flags & MPI_PHYSDISK0_STATUS_FLAG_QUIESCED
4521 ? ", quiesced" : "" );
4522 break;
4523
4524 case MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED:
4525 printk(MYIOC_s_INFO_FMT " Domain Validation needed for PhysDisk %d\n",
4526 ioc->name, disk);
4527 break;
4528
4529 case MPI_EVENT_RAID_RC_SMART_DATA:
4530 printk(MYIOC_s_INFO_FMT " SMART data received, ASC/ASCQ = %02xh/%02xh\n",
4531 ioc->name, pRaidEventData->ASC, pRaidEventData->ASCQ);
4532 break;
4533
4534 case MPI_EVENT_RAID_RC_REPLACE_ACTION_STARTED:
4535 printk(MYIOC_s_INFO_FMT " replacement of PhysDisk %d has started\n",
4536 ioc->name, disk);
4537 break;
4538 }
4539}
4540
4541/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4390/* 4542/*
4391 * GetIoUnitPage2 - Retrieve BIOS version and boot order information. 4543 * GetIoUnitPage2 - Retrieve BIOS version and boot order information.
4392 * @ioc: Pointer to MPT_ADAPTER structure 4544 * @ioc: Pointer to MPT_ADAPTER structure
@@ -4598,6 +4750,14 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4598 SCSIPortPage2_t *pPP2 = (SCSIPortPage2_t *) pbuf; 4750 SCSIPortPage2_t *pPP2 = (SCSIPortPage2_t *) pbuf;
4599 MpiDeviceInfo_t *pdevice = NULL; 4751 MpiDeviceInfo_t *pdevice = NULL;
4600 4752
4753 /*
4754 * Save "Set to Avoid SCSI Bus Resets" flag
4755 */
4756 ioc->spi_data.bus_reset =
4757 (le32_to_cpu(pPP2->PortFlags) &
4758 MPI_SCSIPORTPAGE2_PORT_FLAGS_AVOID_SCSI_RESET) ?
4759 0 : 1 ;
4760
4601 /* Save the Port Page 2 data 4761 /* Save the Port Page 2 data
4602 * (reformat into a 32bit quantity) 4762 * (reformat into a 32bit quantity)
4603 */ 4763 */
@@ -5967,6 +6127,10 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
5967 } 6127 }
5968 } 6128 }
5969 break; 6129 break;
6130 case MPI_EVENT_INTEGRATED_RAID:
6131 mptbase_raid_process_event_data(ioc,
6132 (MpiEventDataRaid_t *)pEventReply->Data);
6133 break;
5970 default: 6134 default:
5971 break; 6135 break;
5972 } 6136 }
@@ -6046,7 +6210,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info)
6046 6210
6047/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6211/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6048/* 6212/*
6049 * mpt_sp_log_info - Log information returned from SCSI Parallel IOC. 6213 * mpt_spi_log_info - Log information returned from SCSI Parallel IOC.
6050 * @ioc: Pointer to MPT_ADAPTER structure 6214 * @ioc: Pointer to MPT_ADAPTER structure
6051 * @mr: Pointer to MPT reply frame 6215 * @mr: Pointer to MPT reply frame
6052 * @log_info: U32 LogInfo word from the IOC 6216 * @log_info: U32 LogInfo word from the IOC
@@ -6054,7 +6218,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info)
6054 * Refer to lsi/sp_log.h. 6218 * Refer to lsi/sp_log.h.
6055 */ 6219 */
6056static void 6220static void
6057mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info) 6221mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
6058{ 6222{
6059 u32 info = log_info & 0x00FF0000; 6223 u32 info = log_info & 0x00FF0000;
6060 char *desc = "unknown"; 6224 char *desc = "unknown";
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 47053ac65068..ea2649ecad1f 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -76,8 +76,8 @@
76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR 76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
77#endif 77#endif
78 78
79#define MPT_LINUX_VERSION_COMMON "3.03.06" 79#define MPT_LINUX_VERSION_COMMON "3.03.07"
80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.06" 80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.07"
81#define WHAT_MAGIC_STRING "@" "(" "#" ")" 81#define WHAT_MAGIC_STRING "@" "(" "#" ")"
82 82
83#define show_mptmod_ver(s,ver) \ 83#define show_mptmod_ver(s,ver) \
@@ -123,7 +123,7 @@
123#define MPT_MAX_FRAME_SIZE 128 123#define MPT_MAX_FRAME_SIZE 128
124#define MPT_DEFAULT_FRAME_SIZE 128 124#define MPT_DEFAULT_FRAME_SIZE 128
125 125
126#define MPT_REPLY_FRAME_SIZE 0x40 /* Must be a multiple of 8 */ 126#define MPT_REPLY_FRAME_SIZE 0x50 /* Must be a multiple of 8 */
127 127
128#define MPT_SG_REQ_128_SCALE 1 128#define MPT_SG_REQ_128_SCALE 1
129#define MPT_SG_REQ_96_SCALE 2 129#define MPT_SG_REQ_96_SCALE 2
@@ -510,9 +510,10 @@ struct mptfc_rport_info
510{ 510{
511 struct list_head list; 511 struct list_head list;
512 struct fc_rport *rport; 512 struct fc_rport *rport;
513 VirtDevice *vdev; 513 struct scsi_target *starget;
514 FCDevicePage0_t pg0; 514 FCDevicePage0_t pg0;
515 u8 flags; 515 u8 flags;
516 u8 remap_needed;
516}; 517};
517 518
518/* 519/*
@@ -631,6 +632,7 @@ typedef struct _MPT_ADAPTER
631 struct mutex sas_topology_mutex; 632 struct mutex sas_topology_mutex;
632 MPT_SAS_MGMT sas_mgmt; 633 MPT_SAS_MGMT sas_mgmt;
633 int num_ports; 634 int num_ports;
635 struct work_struct mptscsih_persistTask;
634 636
635 struct list_head fc_rports; 637 struct list_head fc_rports;
636 spinlock_t fc_rport_lock; /* list and ri flags */ 638 spinlock_t fc_rport_lock; /* list and ri flags */
@@ -803,6 +805,12 @@ typedef struct _mpt_sge {
803#define dreplyprintk(x) 805#define dreplyprintk(x)
804#endif 806#endif
805 807
808#ifdef DMPT_DEBUG_FC
809#define dfcprintk(x) printk x
810#else
811#define dfcprintk(x)
812#endif
813
806#ifdef MPT_DEBUG_TM 814#ifdef MPT_DEBUG_TM
807#define dtmprintk(x) printk x 815#define dtmprintk(x) printk x
808#define DBG_DUMP_TM_REQUEST_FRAME(mfp) \ 816#define DBG_DUMP_TM_REQUEST_FRAME(mfp) \
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index b102c7666d0e..c3a3499bce2a 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -93,10 +93,11 @@ static int mptfcDoneCtx = -1;
93static int mptfcTaskCtx = -1; 93static int mptfcTaskCtx = -1;
94static int mptfcInternalCtx = -1; /* Used only for internal commands */ 94static int mptfcInternalCtx = -1; /* Used only for internal commands */
95 95
96int mptfc_slave_alloc(struct scsi_device *device); 96static int mptfc_target_alloc(struct scsi_target *starget);
97static int mptfc_slave_alloc(struct scsi_device *sdev);
97static int mptfc_qcmd(struct scsi_cmnd *SCpnt, 98static int mptfc_qcmd(struct scsi_cmnd *SCpnt,
98 void (*done)(struct scsi_cmnd *)); 99 void (*done)(struct scsi_cmnd *));
99 100static void mptfc_target_destroy(struct scsi_target *starget);
100static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); 101static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
101static void __devexit mptfc_remove(struct pci_dev *pdev); 102static void __devexit mptfc_remove(struct pci_dev *pdev);
102 103
@@ -107,10 +108,10 @@ static struct scsi_host_template mptfc_driver_template = {
107 .name = "MPT FC Host", 108 .name = "MPT FC Host",
108 .info = mptscsih_info, 109 .info = mptscsih_info,
109 .queuecommand = mptfc_qcmd, 110 .queuecommand = mptfc_qcmd,
110 .target_alloc = mptscsih_target_alloc, 111 .target_alloc = mptfc_target_alloc,
111 .slave_alloc = mptfc_slave_alloc, 112 .slave_alloc = mptfc_slave_alloc,
112 .slave_configure = mptscsih_slave_configure, 113 .slave_configure = mptscsih_slave_configure,
113 .target_destroy = mptscsih_target_destroy, 114 .target_destroy = mptfc_target_destroy,
114 .slave_destroy = mptscsih_slave_destroy, 115 .slave_destroy = mptscsih_slave_destroy,
115 .change_queue_depth = mptscsih_change_queue_depth, 116 .change_queue_depth = mptscsih_change_queue_depth,
116 .eh_abort_handler = mptscsih_abort, 117 .eh_abort_handler = mptscsih_abort,
@@ -348,14 +349,33 @@ mptfc_generate_rport_ids(FCDevicePage0_t *pg0, struct fc_rport_identifiers *rid)
348} 349}
349 350
350static void 351static void
352mptfc_remap_sdev(struct scsi_device *sdev, void *arg)
353{
354 VirtDevice *vdev;
355 VirtTarget *vtarget;
356 struct scsi_target *starget;
357
358 starget = scsi_target(sdev);
359 if (starget->hostdata == arg) {
360 vtarget = arg;
361 vdev = sdev->hostdata;
362 if (vdev) {
363 vdev->bus_id = vtarget->bus_id;
364 vdev->target_id = vtarget->target_id;
365 }
366 }
367}
368
369static void
351mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) 370mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
352{ 371{
353 struct fc_rport_identifiers rport_ids; 372 struct fc_rport_identifiers rport_ids;
354 struct fc_rport *rport; 373 struct fc_rport *rport;
355 struct mptfc_rport_info *ri; 374 struct mptfc_rport_info *ri;
356 int match = 0; 375 int new_ri = 1;
357 u64 port_name; 376 u64 pn;
358 unsigned long flags; 377 unsigned long flags;
378 VirtTarget *vtarget;
359 379
360 if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) 380 if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0)
361 return; 381 return;
@@ -363,14 +383,14 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
363 /* scan list looking for a match */ 383 /* scan list looking for a match */
364 spin_lock_irqsave(&ioc->fc_rport_lock, flags); 384 spin_lock_irqsave(&ioc->fc_rport_lock, flags);
365 list_for_each_entry(ri, &ioc->fc_rports, list) { 385 list_for_each_entry(ri, &ioc->fc_rports, list) {
366 port_name = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; 386 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
367 if (port_name == rport_ids.port_name) { /* match */ 387 if (pn == rport_ids.port_name) { /* match */
368 list_move_tail(&ri->list, &ioc->fc_rports); 388 list_move_tail(&ri->list, &ioc->fc_rports);
369 match = 1; 389 new_ri = 0;
370 break; 390 break;
371 } 391 }
372 } 392 }
373 if (!match) { /* allocate one */ 393 if (new_ri) { /* allocate one */
374 spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); 394 spin_unlock_irqrestore(&ioc->fc_rport_lock, flags);
375 ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); 395 ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL);
376 if (!ri) 396 if (!ri)
@@ -382,40 +402,43 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
382 ri->pg0 = *pg0; /* add/update pg0 data */ 402 ri->pg0 = *pg0; /* add/update pg0 data */
383 ri->flags &= ~MPT_RPORT_INFO_FLAGS_MISSING; 403 ri->flags &= ~MPT_RPORT_INFO_FLAGS_MISSING;
384 404
405 /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */
385 if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { 406 if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) {
386 ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; 407 ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED;
387 spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); 408 spin_unlock_irqrestore(&ioc->fc_rport_lock, flags);
388 rport = fc_remote_port_add(ioc->sh,channel, &rport_ids); 409 rport = fc_remote_port_add(ioc->sh, channel, &rport_ids);
389 spin_lock_irqsave(&ioc->fc_rport_lock, flags); 410 spin_lock_irqsave(&ioc->fc_rport_lock, flags);
390 if (rport) { 411 if (rport) {
391 if (*((struct mptfc_rport_info **)rport->dd_data) != ri) { 412 ri->rport = rport;
392 ri->flags &= ~MPT_RPORT_INFO_FLAGS_MAPPED_VDEV; 413 if (new_ri) /* may have been reset by user */
393 ri->vdev = NULL; 414 rport->dev_loss_tmo = mptfc_dev_loss_tmo;
394 ri->rport = rport; 415 *((struct mptfc_rport_info **)rport->dd_data) = ri;
395 *((struct mptfc_rport_info **)rport->dd_data) = ri;
396 }
397 rport->dev_loss_tmo = mptfc_dev_loss_tmo;
398 /* 416 /*
399 * if already mapped, remap here. If not mapped, 417 * if already mapped, remap here. If not mapped,
400 * slave_alloc will allocate vdev and map 418 * target_alloc will allocate vtarget and map,
419 * slave_alloc will fill in vdev from vtarget.
401 */ 420 */
402 if (ri->flags & MPT_RPORT_INFO_FLAGS_MAPPED_VDEV) { 421 if (ri->starget) {
403 ri->vdev->target_id = ri->pg0.CurrentTargetID; 422 vtarget = ri->starget->hostdata;
404 ri->vdev->bus_id = ri->pg0.CurrentBus; 423 if (vtarget) {
405 ri->vdev->vtarget->target_id = ri->vdev->target_id; 424 vtarget->target_id = pg0->CurrentTargetID;
406 ri->vdev->vtarget->bus_id = ri->vdev->bus_id; 425 vtarget->bus_id = pg0->CurrentBus;
426 starget_for_each_device(ri->starget,
427 vtarget,mptfc_remap_sdev);
428 }
429 ri->remap_needed = 0;
407 } 430 }
408 #ifdef MPT_DEBUG 431 dfcprintk ((MYIOC_s_INFO_FMT
409 printk ("mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " 432 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, "
410 "rport tid %d, tmo %d\n", 433 "rport tid %d, tmo %d\n",
411 ioc->sh->host_no, 434 ioc->name,
435 oc->sh->host_no,
412 pg0->PortIdentifier, 436 pg0->PortIdentifier,
413 pg0->WWNN, 437 pg0->WWNN,
414 pg0->WWPN, 438 pg0->WWPN,
415 pg0->CurrentTargetID, 439 pg0->CurrentTargetID,
416 ri->rport->scsi_target_id, 440 ri->rport->scsi_target_id,
417 ri->rport->dev_loss_tmo); 441 ri->rport->dev_loss_tmo));
418 #endif
419 } else { 442 } else {
420 list_del(&ri->list); 443 list_del(&ri->list);
421 kfree(ri); 444 kfree(ri);
@@ -427,6 +450,65 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
427} 450}
428 451
429/* 452/*
453 * OS entry point to allow for host driver to free allocated memory
454 * Called if no device present or device being unloaded
455 */
456static void
457mptfc_target_destroy(struct scsi_target *starget)
458{
459 struct fc_rport *rport;
460 struct mptfc_rport_info *ri;
461
462 rport = starget_to_rport(starget);
463 if (rport) {
464 ri = *((struct mptfc_rport_info **)rport->dd_data);
465 if (ri) /* better be! */
466 ri->starget = NULL;
467 }
468 if (starget->hostdata)
469 kfree(starget->hostdata);
470 starget->hostdata = NULL;
471}
472
473/*
474 * OS entry point to allow host driver to alloc memory
475 * for each scsi target. Called once per device the bus scan.
476 * Return non-zero if allocation fails.
477 */
478static int
479mptfc_target_alloc(struct scsi_target *starget)
480{
481 VirtTarget *vtarget;
482 struct fc_rport *rport;
483 struct mptfc_rport_info *ri;
484 int rc;
485
486 vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
487 if (!vtarget)
488 return -ENOMEM;
489 starget->hostdata = vtarget;
490
491 rc = -ENODEV;
492 rport = starget_to_rport(starget);
493 if (rport) {
494 ri = *((struct mptfc_rport_info **)rport->dd_data);
495 if (ri) { /* better be! */
496 vtarget->target_id = ri->pg0.CurrentTargetID;
497 vtarget->bus_id = ri->pg0.CurrentBus;
498 ri->starget = starget;
499 ri->remap_needed = 0;
500 rc = 0;
501 }
502 }
503 if (rc != 0) {
504 kfree(vtarget);
505 starget->hostdata = NULL;
506 }
507
508 return rc;
509}
510
511/*
430 * OS entry point to allow host driver to alloc memory 512 * OS entry point to allow host driver to alloc memory
431 * for each scsi device. Called once per device the bus scan. 513 * for each scsi device. Called once per device the bus scan.
432 * Return non-zero if allocation fails. 514 * Return non-zero if allocation fails.
@@ -440,7 +522,6 @@ mptfc_slave_alloc(struct scsi_device *sdev)
440 VirtDevice *vdev; 522 VirtDevice *vdev;
441 struct scsi_target *starget; 523 struct scsi_target *starget;
442 struct fc_rport *rport; 524 struct fc_rport *rport;
443 struct mptfc_rport_info *ri;
444 unsigned long flags; 525 unsigned long flags;
445 526
446 527
@@ -451,55 +532,44 @@ mptfc_slave_alloc(struct scsi_device *sdev)
451 532
452 hd = (MPT_SCSI_HOST *)sdev->host->hostdata; 533 hd = (MPT_SCSI_HOST *)sdev->host->hostdata;
453 534
454 vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL); 535 vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
455 if (!vdev) { 536 if (!vdev) {
456 printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", 537 printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
457 hd->ioc->name, sizeof(VirtDevice)); 538 hd->ioc->name, sizeof(VirtDevice));
458 return -ENOMEM; 539 return -ENOMEM;
459 } 540 }
460 memset(vdev, 0, sizeof(VirtDevice));
461 541
462 spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags); 542 spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags);
463 543
464 if (!(ri = *((struct mptfc_rport_info **)rport->dd_data))) {
465 spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags);
466 kfree(vdev);
467 return -ENODEV;
468 }
469
470 sdev->hostdata = vdev; 544 sdev->hostdata = vdev;
471 starget = scsi_target(sdev); 545 starget = scsi_target(sdev);
472 vtarget = starget->hostdata; 546 vtarget = starget->hostdata;
547
473 if (vtarget->num_luns == 0) { 548 if (vtarget->num_luns == 0) {
549 vtarget->ioc_id = hd->ioc->id;
474 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES | 550 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES |
475 MPT_TARGET_FLAGS_VALID_INQUIRY; 551 MPT_TARGET_FLAGS_VALID_INQUIRY;
476 hd->Targets[sdev->id] = vtarget; 552 hd->Targets[sdev->id] = vtarget;
477 } 553 }
478 554
479 vtarget->target_id = vdev->target_id;
480 vtarget->bus_id = vdev->bus_id;
481
482 vdev->vtarget = vtarget; 555 vdev->vtarget = vtarget;
483 vdev->ioc_id = hd->ioc->id; 556 vdev->ioc_id = hd->ioc->id;
484 vdev->lun = sdev->lun; 557 vdev->lun = sdev->lun;
485 vdev->target_id = ri->pg0.CurrentTargetID; 558 vdev->target_id = vtarget->target_id;
486 vdev->bus_id = ri->pg0.CurrentBus; 559 vdev->bus_id = vtarget->bus_id;
487
488 ri->flags |= MPT_RPORT_INFO_FLAGS_MAPPED_VDEV;
489 ri->vdev = vdev;
490 560
491 spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); 561 spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags);
492 562
493 vtarget->num_luns++; 563 vtarget->num_luns++;
494 564
495#ifdef MPT_DEBUG 565 dfcprintk ((MYIOC_s_INFO_FMT
496 printk ("mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " 566 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
497 "CurrentTargetID %d, %x %llx %llx\n", 567 "CurrentTargetID %d, %x %llx %llx\n",
498 sdev->host->host_no, 568 ioc->name,
499 vtarget->num_luns, 569 sdev->host->host_no,
500 sdev->id, ri->pg0.CurrentTargetID, 570 vtarget->num_luns,
501 ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN); 571 sdev->id, ri->pg0.CurrentTargetID,
502#endif 572 ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN));
503 573
504 return 0; 574 return 0;
505} 575}
@@ -507,6 +577,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
507static int 577static int
508mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 578mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
509{ 579{
580 struct mptfc_rport_info *ri;
510 struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); 581 struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
511 int err; 582 int err;
512 583
@@ -516,6 +587,10 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
516 done(SCpnt); 587 done(SCpnt);
517 return 0; 588 return 0;
518 } 589 }
590 ri = *((struct mptfc_rport_info **)rport->dd_data);
591 if (unlikely(ri->remap_needed))
592 return SCSI_MLQUEUE_HOST_BUSY;
593
519 return mptscsih_qcmd(SCpnt,done); 594 return mptscsih_qcmd(SCpnt,done);
520} 595}
521 596
@@ -591,16 +666,20 @@ mptfc_rescan_devices(void *arg)
591 666
592 ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| 667 ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED|
593 MPT_RPORT_INFO_FLAGS_MISSING); 668 MPT_RPORT_INFO_FLAGS_MISSING);
669 ri->remap_needed = 1;
594 fc_remote_port_delete(ri->rport); 670 fc_remote_port_delete(ri->rport);
595 /* 671 /*
596 * remote port not really deleted 'cause 672 * remote port not really deleted 'cause
597 * binding is by WWPN and driver only 673 * binding is by WWPN and driver only
598 * registers FCP_TARGETs 674 * registers FCP_TARGETs but cannot trust
675 * data structures.
599 */ 676 */
600 #ifdef MPT_DEBUG 677 ri->rport = NULL;
601 printk ("mptfc_rescan.%d: %llx deleted\n", 678 dfcprintk ((MYIOC_s_INFO_FMT
602 ioc->sh->host_no, ri->pg0.WWPN); 679 "mptfc_rescan.%d: %llx deleted\n",
603 #endif 680 ioc->name,
681 ioc->sh->host_no,
682 ri->pg0.WWPN));
604 } 683 }
605 } 684 }
606 spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); 685 spin_unlock_irqrestore(&ioc->fc_rport_lock,flags);
@@ -872,9 +951,8 @@ mptfc_init(void)
872 } 951 }
873 952
874 error = pci_register_driver(&mptfc_driver); 953 error = pci_register_driver(&mptfc_driver);
875 if (error) { 954 if (error)
876 fc_release_transport(mptfc_transport_template); 955 fc_release_transport(mptfc_transport_template);
877 }
878 956
879 return error; 957 return error;
880} 958}
@@ -885,7 +963,8 @@ mptfc_init(void)
885 * @pdev: Pointer to pci_dev structure 963 * @pdev: Pointer to pci_dev structure
886 * 964 *
887 */ 965 */
888static void __devexit mptfc_remove(struct pci_dev *pdev) 966static void __devexit
967mptfc_remove(struct pci_dev *pdev)
889{ 968{
890 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 969 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
891 struct mptfc_rport_info *p, *n; 970 struct mptfc_rport_info *p, *n;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 5a06d8d8694e..2512d0e6155e 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -89,6 +89,8 @@ static int mptsasMgmtCtx = -1;
89enum mptsas_hotplug_action { 89enum mptsas_hotplug_action {
90 MPTSAS_ADD_DEVICE, 90 MPTSAS_ADD_DEVICE,
91 MPTSAS_DEL_DEVICE, 91 MPTSAS_DEL_DEVICE,
92 MPTSAS_ADD_RAID,
93 MPTSAS_DEL_RAID,
92}; 94};
93 95
94struct mptsas_hotplug_event { 96struct mptsas_hotplug_event {
@@ -114,6 +116,7 @@ struct mptsas_hotplug_event {
114 116
115struct mptsas_devinfo { 117struct mptsas_devinfo {
116 u16 handle; /* unique id to address this device */ 118 u16 handle; /* unique id to address this device */
119 u16 handle_parent; /* unique id to address parent device */
117 u8 phy_id; /* phy number of parent device */ 120 u8 phy_id; /* phy number of parent device */
118 u8 port_id; /* sas physical port this device 121 u8 port_id; /* sas physical port this device
119 is assoc'd with */ 122 is assoc'd with */
@@ -301,9 +304,8 @@ mptsas_slave_alloc(struct scsi_device *sdev)
301 } 304 }
302 mutex_unlock(&hd->ioc->sas_topology_mutex); 305 mutex_unlock(&hd->ioc->sas_topology_mutex);
303 306
304 printk("No matching SAS device found!!\n");
305 kfree(vdev); 307 kfree(vdev);
306 return -ENODEV; 308 return -ENXIO;
307 309
308 out: 310 out:
309 vtarget->ioc_id = vdev->ioc_id; 311 vtarget->ioc_id = vdev->ioc_id;
@@ -321,6 +323,7 @@ mptsas_slave_destroy(struct scsi_device *sdev)
321 struct sas_rphy *rphy; 323 struct sas_rphy *rphy;
322 struct mptsas_portinfo *p; 324 struct mptsas_portinfo *p;
323 int i; 325 int i;
326 VirtDevice *vdev;
324 327
325 /* 328 /*
326 * Handle hotplug removal case. 329 * Handle hotplug removal case.
@@ -344,8 +347,29 @@ mptsas_slave_destroy(struct scsi_device *sdev)
344 out: 347 out:
345 mutex_unlock(&hd->ioc->sas_topology_mutex); 348 mutex_unlock(&hd->ioc->sas_topology_mutex);
346 /* 349 /*
347 * TODO: Issue target reset to flush firmware outstanding commands. 350 * Issue target reset to flush firmware outstanding commands.
348 */ 351 */
352 vdev = sdev->hostdata;
353 if (vdev->configured_lun){
354 if (mptscsih_TMHandler(hd,
355 MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
356 vdev->bus_id,
357 vdev->target_id,
358 0, 0, 5 /* 5 second timeout */)
359 < 0){
360
361 /* The TM request failed!
362 * Fatal error case.
363 */
364 printk(MYIOC_s_WARN_FMT
365 "Error processing TaskMgmt id=%d TARGET_RESET\n",
366 hd->ioc->name,
367 vdev->target_id);
368
369 hd->tmPending = 0;
370 hd->tmState = TM_STATE_NONE;
371 }
372 }
349 mptscsih_slave_destroy(sdev); 373 mptscsih_slave_destroy(sdev);
350} 374}
351 375
@@ -714,6 +738,7 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
714 mptsas_print_device_pg0(buffer); 738 mptsas_print_device_pg0(buffer);
715 739
716 device_info->handle = le16_to_cpu(buffer->DevHandle); 740 device_info->handle = le16_to_cpu(buffer->DevHandle);
741 device_info->handle_parent = le16_to_cpu(buffer->ParentDevHandle);
717 device_info->phy_id = buffer->PhyNum; 742 device_info->phy_id = buffer->PhyNum;
718 device_info->port_id = buffer->PhysicalPort; 743 device_info->port_id = buffer->PhysicalPort;
719 device_info->id = buffer->TargetID; 744 device_info->id = buffer->TargetID;
@@ -863,6 +888,26 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
863 return error; 888 return error;
864} 889}
865 890
891/*
892 * Returns true if there is a scsi end device
893 */
894static inline int
895mptsas_is_end_device(struct mptsas_devinfo * attached)
896{
897 if ((attached->handle) &&
898 (attached->device_info &
899 MPI_SAS_DEVICE_INFO_END_DEVICE) &&
900 ((attached->device_info &
901 MPI_SAS_DEVICE_INFO_SSP_TARGET) |
902 (attached->device_info &
903 MPI_SAS_DEVICE_INFO_STP_TARGET) |
904 (attached->device_info &
905 MPI_SAS_DEVICE_INFO_SATA_DEVICE)))
906 return 1;
907 else
908 return 0;
909}
910
866static void 911static void
867mptsas_parse_device_info(struct sas_identify *identify, 912mptsas_parse_device_info(struct sas_identify *identify,
868 struct mptsas_devinfo *device_info) 913 struct mptsas_devinfo *device_info)
@@ -1227,7 +1272,7 @@ mptsas_find_phyinfo_by_parent(MPT_ADAPTER *ioc, u16 parent_handle, u8 phy_id)
1227} 1272}
1228 1273
1229static struct mptsas_phyinfo * 1274static struct mptsas_phyinfo *
1230mptsas_find_phyinfo_by_handle(MPT_ADAPTER *ioc, u16 handle) 1275mptsas_find_phyinfo_by_target(MPT_ADAPTER *ioc, u32 id)
1231{ 1276{
1232 struct mptsas_portinfo *port_info; 1277 struct mptsas_portinfo *port_info;
1233 struct mptsas_phyinfo *phy_info = NULL; 1278 struct mptsas_phyinfo *phy_info = NULL;
@@ -1239,12 +1284,12 @@ mptsas_find_phyinfo_by_handle(MPT_ADAPTER *ioc, u16 handle)
1239 */ 1284 */
1240 mutex_lock(&ioc->sas_topology_mutex); 1285 mutex_lock(&ioc->sas_topology_mutex);
1241 list_for_each_entry(port_info, &ioc->sas_topology, list) { 1286 list_for_each_entry(port_info, &ioc->sas_topology, list) {
1242 for (i = 0; i < port_info->num_phys; i++) { 1287 for (i = 0; i < port_info->num_phys; i++)
1243 if (port_info->phy_info[i].attached.handle == handle) { 1288 if (mptsas_is_end_device(&port_info->phy_info[i].attached))
1244 phy_info = &port_info->phy_info[i]; 1289 if (port_info->phy_info[i].attached.id == id) {
1245 break; 1290 phy_info = &port_info->phy_info[i];
1246 } 1291 break;
1247 } 1292 }
1248 } 1293 }
1249 mutex_unlock(&ioc->sas_topology_mutex); 1294 mutex_unlock(&ioc->sas_topology_mutex);
1250 1295
@@ -1258,36 +1303,58 @@ mptsas_hotplug_work(void *arg)
1258 MPT_ADAPTER *ioc = ev->ioc; 1303 MPT_ADAPTER *ioc = ev->ioc;
1259 struct mptsas_phyinfo *phy_info; 1304 struct mptsas_phyinfo *phy_info;
1260 struct sas_rphy *rphy; 1305 struct sas_rphy *rphy;
1306 struct scsi_device *sdev;
1261 char *ds = NULL; 1307 char *ds = NULL;
1262 1308 struct mptsas_devinfo sas_device;
1263 if (ev->device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET)
1264 ds = "ssp";
1265 if (ev->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET)
1266 ds = "stp";
1267 if (ev->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
1268 ds = "sata";
1269 1309
1270 switch (ev->event_type) { 1310 switch (ev->event_type) {
1271 case MPTSAS_DEL_DEVICE: 1311 case MPTSAS_DEL_DEVICE:
1272 printk(MYIOC_s_INFO_FMT
1273 "removing %s device, channel %d, id %d, phy %d\n",
1274 ioc->name, ds, ev->channel, ev->id, ev->phy_id);
1275 1312
1276 phy_info = mptsas_find_phyinfo_by_handle(ioc, ev->handle); 1313 phy_info = mptsas_find_phyinfo_by_target(ioc, ev->id);
1277 if (!phy_info) { 1314 if (!phy_info) {
1278 printk("mptsas: remove event for non-existant PHY.\n"); 1315 printk("mptsas: remove event for non-existant PHY.\n");
1279 break; 1316 break;
1280 } 1317 }
1281 1318
1319 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET)
1320 ds = "ssp";
1321 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_STP_TARGET)
1322 ds = "stp";
1323 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
1324 ds = "sata";
1325
1326 printk(MYIOC_s_INFO_FMT
1327 "removing %s device, channel %d, id %d, phy %d\n",
1328 ioc->name, ds, ev->channel, ev->id, phy_info->phy_id);
1329
1282 if (phy_info->rphy) { 1330 if (phy_info->rphy) {
1283 sas_rphy_delete(phy_info->rphy); 1331 sas_rphy_delete(phy_info->rphy);
1284 phy_info->rphy = NULL; 1332 phy_info->rphy = NULL;
1285 } 1333 }
1286 break; 1334 break;
1287 case MPTSAS_ADD_DEVICE: 1335 case MPTSAS_ADD_DEVICE:
1288 printk(MYIOC_s_INFO_FMT 1336
1289 "attaching %s device, channel %d, id %d, phy %d\n", 1337 /*
1290 ioc->name, ds, ev->channel, ev->id, ev->phy_id); 1338 * When there is no sas address,
1339 * RAID volumes are being deleted,
1340 * and hidden phy disk are being added.
1341 * We don't know the SAS data yet,
1342 * so lookup sas device page to get
1343 * pertaining info
1344 */
1345 if (!ev->sas_address) {
1346 if (mptsas_sas_device_pg0(ioc,
1347 &sas_device, ev->id,
1348 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
1349 MPI_SAS_DEVICE_PGAD_FORM_SHIFT)))
1350 break;
1351 ev->handle = sas_device.handle;
1352 ev->parent_handle = sas_device.handle_parent;
1353 ev->channel = sas_device.channel;
1354 ev->phy_id = sas_device.phy_id;
1355 ev->sas_address = sas_device.sas_address;
1356 ev->device_info = sas_device.device_info;
1357 }
1291 1358
1292 phy_info = mptsas_find_phyinfo_by_parent(ioc, 1359 phy_info = mptsas_find_phyinfo_by_parent(ioc,
1293 ev->parent_handle, ev->phy_id); 1360 ev->parent_handle, ev->phy_id);
@@ -1310,10 +1377,23 @@ mptsas_hotplug_work(void *arg)
1310 phy_info->attached.sas_address = ev->sas_address; 1377 phy_info->attached.sas_address = ev->sas_address;
1311 phy_info->attached.device_info = ev->device_info; 1378 phy_info->attached.device_info = ev->device_info;
1312 1379
1380 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET)
1381 ds = "ssp";
1382 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_STP_TARGET)
1383 ds = "stp";
1384 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
1385 ds = "sata";
1386
1387 printk(MYIOC_s_INFO_FMT
1388 "attaching %s device, channel %d, id %d, phy %d\n",
1389 ioc->name, ds, ev->channel, ev->id, ev->phy_id);
1390
1391
1313 rphy = sas_rphy_alloc(phy_info->phy); 1392 rphy = sas_rphy_alloc(phy_info->phy);
1314 if (!rphy) 1393 if (!rphy)
1315 break; /* non-fatal: an rphy can be added later */ 1394 break; /* non-fatal: an rphy can be added later */
1316 1395
1396 rphy->scsi_target_id = phy_info->attached.id;
1317 mptsas_parse_device_info(&rphy->identify, &phy_info->attached); 1397 mptsas_parse_device_info(&rphy->identify, &phy_info->attached);
1318 if (sas_rphy_add(rphy)) { 1398 if (sas_rphy_add(rphy)) {
1319 sas_rphy_free(rphy); 1399 sas_rphy_free(rphy);
@@ -1322,6 +1402,40 @@ mptsas_hotplug_work(void *arg)
1322 1402
1323 phy_info->rphy = rphy; 1403 phy_info->rphy = rphy;
1324 break; 1404 break;
1405 case MPTSAS_ADD_RAID:
1406 sdev = scsi_device_lookup(
1407 ioc->sh,
1408 ioc->num_ports,
1409 ev->id,
1410 0);
1411 if (sdev) {
1412 scsi_device_put(sdev);
1413 break;
1414 }
1415 printk(MYIOC_s_INFO_FMT
1416 "attaching device, channel %d, id %d\n",
1417 ioc->name, ioc->num_ports, ev->id);
1418 scsi_add_device(ioc->sh,
1419 ioc->num_ports,
1420 ev->id,
1421 0);
1422 mpt_findImVolumes(ioc);
1423 break;
1424 case MPTSAS_DEL_RAID:
1425 sdev = scsi_device_lookup(
1426 ioc->sh,
1427 ioc->num_ports,
1428 ev->id,
1429 0);
1430 if (!sdev)
1431 break;
1432 printk(MYIOC_s_INFO_FMT
1433 "removing device, channel %d, id %d\n",
1434 ioc->name, ioc->num_ports, ev->id);
1435 scsi_remove_device(sdev);
1436 scsi_device_put(sdev);
1437 mpt_findImVolumes(ioc);
1438 break;
1325 } 1439 }
1326 1440
1327 kfree(ev); 1441 kfree(ev);
@@ -1372,23 +1486,94 @@ mptscsih_send_sas_event(MPT_ADAPTER *ioc,
1372 schedule_work(&ev->work); 1486 schedule_work(&ev->work);
1373} 1487}
1374 1488
1489static void
1490mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1491 EVENT_DATA_RAID *raid_event_data)
1492{
1493 struct mptsas_hotplug_event *ev;
1494 RAID_VOL0_STATUS * volumeStatus;
1495
1496 if (ioc->bus_type != SAS)
1497 return;
1498
1499 ev = kmalloc(sizeof(*ev), GFP_ATOMIC);
1500 if (!ev) {
1501 printk(KERN_WARNING "mptsas: lost hotplug event\n");
1502 return;
1503 }
1504
1505 memset(ev,0,sizeof(struct mptsas_hotplug_event));
1506 INIT_WORK(&ev->work, mptsas_hotplug_work, ev);
1507 ev->ioc = ioc;
1508 ev->id = raid_event_data->VolumeID;
1509
1510 switch (raid_event_data->ReasonCode) {
1511 case MPI_EVENT_RAID_RC_PHYSDISK_DELETED:
1512 ev->event_type = MPTSAS_ADD_DEVICE;
1513 break;
1514 case MPI_EVENT_RAID_RC_PHYSDISK_CREATED:
1515 ev->event_type = MPTSAS_DEL_DEVICE;
1516 break;
1517 case MPI_EVENT_RAID_RC_VOLUME_DELETED:
1518 ev->event_type = MPTSAS_DEL_RAID;
1519 break;
1520 case MPI_EVENT_RAID_RC_VOLUME_CREATED:
1521 ev->event_type = MPTSAS_ADD_RAID;
1522 break;
1523 case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED:
1524 volumeStatus = (RAID_VOL0_STATUS *) &
1525 raid_event_data->SettingsStatus;
1526 ev->event_type = (volumeStatus->State ==
1527 MPI_RAIDVOL0_STATUS_STATE_FAILED) ?
1528 MPTSAS_DEL_RAID : MPTSAS_ADD_RAID;
1529 break;
1530 default:
1531 break;
1532 }
1533 schedule_work(&ev->work);
1534}
1535
1536/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1537/* work queue thread to clear the persitency table */
1538static void
1539mptscsih_sas_persist_clear_table(void * arg)
1540{
1541 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
1542
1543 mptbase_sas_persist_operation(ioc, MPI_SAS_OP_CLEAR_NOT_PRESENT);
1544}
1545
1375static int 1546static int
1376mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) 1547mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
1377{ 1548{
1549 int rc=1;
1378 u8 event = le32_to_cpu(reply->Event) & 0xFF; 1550 u8 event = le32_to_cpu(reply->Event) & 0xFF;
1379 1551
1380 if (!ioc->sh) 1552 if (!ioc->sh)
1381 return 1; 1553 goto out;
1382 1554
1383 switch (event) { 1555 switch (event) {
1384 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 1556 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
1385 mptscsih_send_sas_event(ioc, 1557 mptscsih_send_sas_event(ioc,
1386 (EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *)reply->Data); 1558 (EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *)reply->Data);
1387 return 1; /* currently means nothing really */ 1559 break;
1388 1560 case MPI_EVENT_INTEGRATED_RAID:
1561 mptscsih_send_raid_event(ioc,
1562 (EVENT_DATA_RAID *)reply->Data);
1563 break;
1564 case MPI_EVENT_PERSISTENT_TABLE_FULL:
1565 INIT_WORK(&ioc->mptscsih_persistTask,
1566 mptscsih_sas_persist_clear_table,
1567 (void *)ioc);
1568 schedule_work(&ioc->mptscsih_persistTask);
1569 break;
1389 default: 1570 default:
1390 return mptscsih_event_process(ioc, reply); 1571 rc = mptscsih_event_process(ioc, reply);
1572 break;
1391 } 1573 }
1574 out:
1575
1576 return rc;
1392} 1577}
1393 1578
1394static int 1579static int
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index cdac5578fdf2..05789e505464 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -144,7 +144,6 @@ static int mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd);
144static int mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout ); 144static int mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout );
145static u32 SCPNT_TO_LOOKUP_IDX(struct scsi_cmnd *sc); 145static u32 SCPNT_TO_LOOKUP_IDX(struct scsi_cmnd *sc);
146 146
147static int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout);
148static int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout); 147static int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout);
149 148
150int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 149int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
@@ -159,11 +158,9 @@ static int mptscsih_writeIOCPage4(MPT_SCSI_HOST *hd, int target_id, int bus);
159int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 158int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
160static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); 159static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
161static void mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice); 160static void mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice);
162static void mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget); 161static void mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtDevice *vdevice);
163static int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id); 162static int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id);
164 163
165static struct work_struct mptscsih_persistTask;
166
167#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION 164#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
168static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); 165static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io);
169static void mptscsih_domainValidation(void *hd); 166static void mptscsih_domainValidation(void *hd);
@@ -563,11 +560,24 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
563 MPT_SCSI_HOST *hd; 560 MPT_SCSI_HOST *hd;
564 SCSIIORequest_t *pScsiReq; 561 SCSIIORequest_t *pScsiReq;
565 SCSIIOReply_t *pScsiReply; 562 SCSIIOReply_t *pScsiReply;
566 u16 req_idx; 563 u16 req_idx, req_idx_MR;
567 564
568 hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; 565 hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
569 566
570 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); 567 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
568 req_idx_MR = (mr != NULL) ?
569 le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx;
570 if ((req_idx != req_idx_MR) ||
571 (mf->u.frame.linkage.arg1 == 0xdeadbeaf)) {
572 printk(MYIOC_s_ERR_FMT "Received a mf that was already freed\n",
573 ioc->name);
574 printk (MYIOC_s_ERR_FMT
575 "req_idx=%x req_idx_MR=%x mf=%p mr=%p sc=%p\n",
576 ioc->name, req_idx, req_idx_MR, mf, mr,
577 hd->ScsiLookup[req_idx_MR]);
578 return 0;
579 }
580
571 sc = hd->ScsiLookup[req_idx]; 581 sc = hd->ScsiLookup[req_idx];
572 if (sc == NULL) { 582 if (sc == NULL) {
573 MPIHeader_t *hdr = (MPIHeader_t *)mf; 583 MPIHeader_t *hdr = (MPIHeader_t *)mf;
@@ -730,6 +740,8 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
730 740
731 break; 741 break;
732 742
743 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
744 sc->resid=0;
733 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ 745 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
734 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */ 746 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */
735 if (scsi_status == MPI_SCSI_STATUS_BUSY) 747 if (scsi_status == MPI_SCSI_STATUS_BUSY)
@@ -789,7 +801,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
789 case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */ 801 case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */
790 case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */ 802 case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */
791 case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */ 803 case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */
792 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
793 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */ 804 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */
794 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */ 805 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */
795 default: 806 default:
@@ -1530,7 +1541,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
1530 * 1541 *
1531 * Returns 0 for SUCCESS or -1 if FAILED. 1542 * Returns 0 for SUCCESS or -1 if FAILED.
1532 */ 1543 */
1533static int 1544int
1534mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout) 1545mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout)
1535{ 1546{
1536 MPT_ADAPTER *ioc; 1547 MPT_ADAPTER *ioc;
@@ -1721,6 +1732,20 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun
1721 return retval; 1732 return retval;
1722} 1733}
1723 1734
1735static int
1736mptscsih_get_tm_timeout(MPT_ADAPTER *ioc)
1737{
1738 switch (ioc->bus_type) {
1739 case FC:
1740 return 40;
1741 case SAS:
1742 return 10;
1743 case SPI:
1744 default:
1745 return 2;
1746 }
1747}
1748
1724/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1749/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1725/** 1750/**
1726 * mptscsih_abort - Abort linux scsi_cmnd routine, new_eh variant 1751 * mptscsih_abort - Abort linux scsi_cmnd routine, new_eh variant
@@ -1792,7 +1817,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1792 vdev = SCpnt->device->hostdata; 1817 vdev = SCpnt->device->hostdata;
1793 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1818 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
1794 vdev->bus_id, vdev->target_id, vdev->lun, 1819 vdev->bus_id, vdev->target_id, vdev->lun,
1795 ctx2abort, 2 /* 2 second timeout */); 1820 ctx2abort, mptscsih_get_tm_timeout(ioc));
1796 1821
1797 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1822 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n",
1798 hd->ioc->name, 1823 hd->ioc->name,
@@ -1843,7 +1868,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1843 vdev = SCpnt->device->hostdata; 1868 vdev = SCpnt->device->hostdata;
1844 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1869 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
1845 vdev->bus_id, vdev->target_id, 1870 vdev->bus_id, vdev->target_id,
1846 0, 0, 5 /* 5 second timeout */); 1871 0, 0, mptscsih_get_tm_timeout(hd->ioc));
1847 1872
1848 printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", 1873 printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n",
1849 hd->ioc->name, 1874 hd->ioc->name,
@@ -1893,7 +1918,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1893 1918
1894 vdev = SCpnt->device->hostdata; 1919 vdev = SCpnt->device->hostdata;
1895 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, 1920 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
1896 vdev->bus_id, 0, 0, 0, 5 /* 5 second timeout */); 1921 vdev->bus_id, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc));
1897 1922
1898 printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", 1923 printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n",
1899 hd->ioc->name, 1924 hd->ioc->name,
@@ -2016,6 +2041,42 @@ mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout )
2016} 2041}
2017 2042
2018/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 2043/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2044static void
2045mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code)
2046{
2047 char *desc;
2048
2049 switch (response_code) {
2050 case MPI_SCSITASKMGMT_RSP_TM_COMPLETE:
2051 desc = "The task completed.";
2052 break;
2053 case MPI_SCSITASKMGMT_RSP_INVALID_FRAME:
2054 desc = "The IOC received an invalid frame status.";
2055 break;
2056 case MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED:
2057 desc = "The task type is not supported.";
2058 break;
2059 case MPI_SCSITASKMGMT_RSP_TM_FAILED:
2060 desc = "The requested task failed.";
2061 break;
2062 case MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED:
2063 desc = "The task completed successfully.";
2064 break;
2065 case MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN:
2066 desc = "The LUN request is invalid.";
2067 break;
2068 case MPI_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC:
2069 desc = "The task is in the IOC queue and has not been sent to target.";
2070 break;
2071 default:
2072 desc = "unknown";
2073 break;
2074 }
2075 printk(MYIOC_s_INFO_FMT "Response Code(0x%08x): F/W: %s\n",
2076 ioc->name, response_code, desc);
2077}
2078
2079/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2019/** 2080/**
2020 * mptscsih_taskmgmt_complete - Registered with Fusion MPT base driver 2081 * mptscsih_taskmgmt_complete - Registered with Fusion MPT base driver
2021 * @ioc: Pointer to MPT_ADAPTER structure 2082 * @ioc: Pointer to MPT_ADAPTER structure
@@ -2064,6 +2125,11 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m
2064 /* Figure out if this was ABORT_TASK, TARGET_RESET, or BUS_RESET! */ 2125 /* Figure out if this was ABORT_TASK, TARGET_RESET, or BUS_RESET! */
2065 tmType = pScsiTmReq->TaskType; 2126 tmType = pScsiTmReq->TaskType;
2066 2127
2128 if (ioc->facts.MsgVersion >= MPI_VERSION_01_05 &&
2129 pScsiTmReply->ResponseCode)
2130 mptscsih_taskmgmt_response_code(ioc,
2131 pScsiTmReply->ResponseCode);
2132
2067 dtmprintk((MYIOC_s_WARN_FMT " TaskType = %d, TerminationCount=%d\n", 2133 dtmprintk((MYIOC_s_WARN_FMT " TaskType = %d, TerminationCount=%d\n",
2068 ioc->name, tmType, le32_to_cpu(pScsiTmReply->TerminationCount))); 2134 ioc->name, tmType, le32_to_cpu(pScsiTmReply->TerminationCount)));
2069 DBG_DUMP_TM_REPLY_FRAME((u32 *)pScsiTmReply); 2135 DBG_DUMP_TM_REPLY_FRAME((u32 *)pScsiTmReply);
@@ -2255,7 +2321,7 @@ mptscsih_slave_destroy(struct scsi_device *sdev)
2255 vtarget->luns[0] &= ~(1 << vdevice->lun); 2321 vtarget->luns[0] &= ~(1 << vdevice->lun);
2256 vtarget->num_luns--; 2322 vtarget->num_luns--;
2257 if (vtarget->num_luns == 0) { 2323 if (vtarget->num_luns == 0) {
2258 mptscsih_negotiate_to_asyn_narrow(hd, vtarget); 2324 mptscsih_negotiate_to_asyn_narrow(hd, vdevice);
2259 if (hd->ioc->bus_type == SPI) { 2325 if (hd->ioc->bus_type == SPI) {
2260 if (mptscsih_is_phys_disk(hd->ioc, vtarget->target_id)) { 2326 if (mptscsih_is_phys_disk(hd->ioc, vtarget->target_id)) {
2261 hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3; 2327 hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3;
@@ -2585,16 +2651,6 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2585} 2651}
2586 2652
2587/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 2653/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2588/* work queue thread to clear the persitency table */
2589static void
2590mptscsih_sas_persist_clear_table(void * arg)
2591{
2592 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
2593
2594 mptbase_sas_persist_operation(ioc, MPI_SAS_OP_CLEAR_NOT_PRESENT);
2595}
2596
2597/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2598int 2654int
2599mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) 2655mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2600{ 2656{
@@ -2656,13 +2712,6 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2656 break; 2712 break;
2657 } 2713 }
2658 2714
2659 /* Persistent table is full. */
2660 case MPI_EVENT_PERSISTENT_TABLE_FULL:
2661 INIT_WORK(&mptscsih_persistTask,
2662 mptscsih_sas_persist_clear_table,(void *)ioc);
2663 schedule_work(&mptscsih_persistTask);
2664 break;
2665
2666 case MPI_EVENT_NONE: /* 00 */ 2715 case MPI_EVENT_NONE: /* 00 */
2667 case MPI_EVENT_LOG_DATA: /* 01 */ 2716 case MPI_EVENT_LOG_DATA: /* 01 */
2668 case MPI_EVENT_STATE_CHANGE: /* 02 */ 2717 case MPI_EVENT_STATE_CHANGE: /* 02 */
@@ -3863,8 +3912,9 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
3863 * 3912 *
3864 */ 3913 */
3865static void 3914static void
3866mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget) 3915mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
3867{ 3916{
3917 VirtTarget *vtarget = vdevice->vtarget;
3868 MPT_ADAPTER *ioc= hd->ioc; 3918 MPT_ADAPTER *ioc= hd->ioc;
3869 SCSIDevicePage1_t *pcfg1Data; 3919 SCSIDevicePage1_t *pcfg1Data;
3870 CONFIGPARMS cfg; 3920 CONFIGPARMS cfg;
@@ -3874,7 +3924,8 @@ mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget)
3874 int requested, configuration, data,i; 3924 int requested, configuration, data,i;
3875 u8 flags, factor; 3925 u8 flags, factor;
3876 3926
3877 if (ioc->bus_type != SPI) 3927 if ((ioc->bus_type != SPI) ||
3928 (!vdevice->configured_lun))
3878 return; 3929 return;
3879 3930
3880 if (!ioc->spi_data.sdp1length) 3931 if (!ioc->spi_data.sdp1length)
@@ -3910,7 +3961,7 @@ mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget)
3910 } 3961 }
3911 mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested, 3962 mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested,
3912 &configuration, flags); 3963 &configuration, flags);
3913 dnegoprintk(("syncronize cache: id=%d width=0 factor=MPT_ASYNC " 3964 dnegoprintk(("nego asyn narrow: id=%d width=0 factor=MPT_ASYNC "
3914 "offset=0 negoFlags=%x request=%x config=%x\n", 3965 "offset=0 negoFlags=%x request=%x config=%x\n",
3915 id, flags, requested, configuration)); 3966 id, flags, requested, configuration));
3916 pcfg1Data->RequestedParameters = cpu_to_le32(requested); 3967 pcfg1Data->RequestedParameters = cpu_to_le32(requested);
@@ -3923,7 +3974,7 @@ mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget)
3923 flags = vtarget->negoFlags; 3974 flags = vtarget->negoFlags;
3924 mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested, 3975 mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested,
3925 &configuration, flags); 3976 &configuration, flags);
3926 dnegoprintk(("syncronize cache: id=%d width=0 factor=MPT_ASYNC " 3977 dnegoprintk(("nego asyn narrow: id=%d width=0 factor=MPT_ASYNC "
3927 "offset=0 negoFlags=%x request=%x config=%x\n", 3978 "offset=0 negoFlags=%x request=%x config=%x\n",
3928 vtarget->target_id, flags, requested, configuration)); 3979 vtarget->target_id, flags, requested, configuration));
3929 pcfg1Data->RequestedParameters = cpu_to_le32(requested); 3980 pcfg1Data->RequestedParameters = cpu_to_le32(requested);
@@ -5620,5 +5671,6 @@ EXPORT_SYMBOL(mptscsih_event_process);
5620EXPORT_SYMBOL(mptscsih_ioc_reset); 5671EXPORT_SYMBOL(mptscsih_ioc_reset);
5621EXPORT_SYMBOL(mptscsih_change_queue_depth); 5672EXPORT_SYMBOL(mptscsih_change_queue_depth);
5622EXPORT_SYMBOL(mptscsih_timer_expired); 5673EXPORT_SYMBOL(mptscsih_timer_expired);
5674EXPORT_SYMBOL(mptscsih_TMHandler);
5623 5675
5624/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5676/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index d3cba12f4bd9..44b248d51ea3 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -108,3 +108,4 @@ extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pE
108extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 108extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
109extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); 109extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
110extern void mptscsih_timer_expired(unsigned long data); 110extern void mptscsih_timer_expired(unsigned long data);
111extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout);
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 7dce29277cb7..f148dfa39117 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -384,6 +384,14 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
384 goto out_mptspi_probe; 384 goto out_mptspi_probe;
385 } 385 }
386 386
387 /*
388 * issue internal bus reset
389 */
390 if (ioc->spi_data.bus_reset)
391 mptscsih_TMHandler(hd,
392 MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
393 0, 0, 0, 0, 5);
394
387 scsi_scan_host(sh); 395 scsi_scan_host(sh);
388 return 0; 396 return 0;
389 397
@@ -445,7 +453,7 @@ static void __exit
445mptspi_exit(void) 453mptspi_exit(void)
446{ 454{
447 pci_unregister_driver(&mptspi_driver); 455 pci_unregister_driver(&mptspi_driver);
448 456
449 mpt_reset_deregister(mptspiDoneCtx); 457 mpt_reset_deregister(mptspiDoneCtx);
450 dprintk((KERN_INFO MYNAM 458 dprintk((KERN_INFO MYNAM
451 ": Deregistered for IOC reset notifications\n")); 459 ": Deregistered for IOC reset notifications\n"));
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx
index 69ed77fcb71f..7955ebe8e1e8 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -37,13 +37,13 @@ config AIC79XX_CMDS_PER_DEVICE
37config AIC79XX_RESET_DELAY_MS 37config AIC79XX_RESET_DELAY_MS
38 int "Initial bus reset delay in milli-seconds" 38 int "Initial bus reset delay in milli-seconds"
39 depends on SCSI_AIC79XX 39 depends on SCSI_AIC79XX
40 default "15000" 40 default "5000"
41 ---help--- 41 ---help---
42 The number of milliseconds to delay after an initial bus reset. 42 The number of milliseconds to delay after an initial bus reset.
43 The bus settle delay following all error recovery actions is 43 The bus settle delay following all error recovery actions is
44 dictated by the SCSI layer and is not affected by this value. 44 dictated by the SCSI layer and is not affected by this value.
45 45
46 Default: 15000 (15 seconds) 46 Default: 5000 (5 seconds)
47 47
48config AIC79XX_BUILD_FIRMWARE 48config AIC79XX_BUILD_FIRMWARE
49 bool "Build Adapter Firmware with Kernel Build" 49 bool "Build Adapter Firmware with Kernel Build"
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index 2cfdbef447db..1d11f7e77564 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -37,7 +37,7 @@
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES. 38 * POSSIBILITY OF SUCH DAMAGES.
39 * 39 *
40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#108 $ 40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#109 $
41 * 41 *
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
@@ -222,6 +222,7 @@ typedef enum {
222typedef enum { 222typedef enum {
223 AHD_FENONE = 0x00000, 223 AHD_FENONE = 0x00000,
224 AHD_WIDE = 0x00001,/* Wide Channel */ 224 AHD_WIDE = 0x00001,/* Wide Channel */
225 AHD_AIC79XXB_SLOWCRC = 0x00002,/* SLOWCRC bit should be set */
225 AHD_MULTI_FUNC = 0x00100,/* Multi-Function/Channel Device */ 226 AHD_MULTI_FUNC = 0x00100,/* Multi-Function/Channel Device */
226 AHD_TARGETMODE = 0x01000,/* Has tested target mode support */ 227 AHD_TARGETMODE = 0x01000,/* Has tested target mode support */
227 AHD_MULTIROLE = 0x02000,/* Space for two roles at a time */ 228 AHD_MULTIROLE = 0x02000,/* Space for two roles at a time */
diff --git a/drivers/scsi/aic7xxx/aic79xx.reg b/drivers/scsi/aic7xxx/aic79xx.reg
index 3a3204703b15..be14e2ecb8f7 100644
--- a/drivers/scsi/aic7xxx/aic79xx.reg
+++ b/drivers/scsi/aic7xxx/aic79xx.reg
@@ -1,7 +1,7 @@
1/* 1/*
2 * Aic79xx register and scratch ram definitions. 2 * Aic79xx register and scratch ram definitions.
3 * 3 *
4 * Copyright (c) 1994-2001 Justin T. Gibbs. 4 * Copyright (c) 1994-2001, 2004 Justin T. Gibbs.
5 * Copyright (c) 2000-2002 Adaptec Inc. 5 * Copyright (c) 2000-2002 Adaptec Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -39,7 +39,7 @@
39 * 39 *
40 * $FreeBSD$ 40 * $FreeBSD$
41 */ 41 */
42VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#76 $" 42VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $"
43 43
44/* 44/*
45 * This file is processed by the aic7xxx_asm utility for use in assembling 45 * This file is processed by the aic7xxx_asm utility for use in assembling
@@ -3715,8 +3715,9 @@ scratch_ram {
3715 3715
3716 SEQ_FLAGS2 { 3716 SEQ_FLAGS2 {
3717 size 1 3717 size 1
3718 field TARGET_MSG_PENDING 0x02 3718 field PENDING_MK_MESSAGE 0x01
3719 field SELECTOUT_QFROZEN 0x04 3719 field TARGET_MSG_PENDING 0x02
3720 field SELECTOUT_QFROZEN 0x04
3720 } 3721 }
3721 3722
3722 ALLOCFIFO_SCBPTR { 3723 ALLOCFIFO_SCBPTR {
@@ -3777,6 +3778,26 @@ scratch_ram {
3777 CMDSIZE_TABLE { 3778 CMDSIZE_TABLE {
3778 size 8 3779 size 8
3779 } 3780 }
3781 /*
3782 * When an SCB with the MK_MESSAGE flag is
3783 * queued to the controller, it cannot enter
3784 * the waiting for selection list until the
3785 * selections for any previously queued
3786 * commands to that target complete. During
3787 * the wait, the MK_MESSAGE SCB is queued
3788 * here.
3789 */
3790 MK_MESSAGE_SCB {
3791 size 2
3792 }
3793 /*
3794 * Saved SCSIID of MK_MESSAGE_SCB to avoid
3795 * an extra SCBPTR operation when deciding
3796 * if the MK_MESSAGE_SCB can be run.
3797 */
3798 MK_MESSAGE_SCSIID {
3799 size 1
3800 }
3780} 3801}
3781 3802
3782/************************* Hardware SCB Definition ****************************/ 3803/************************* Hardware SCB Definition ****************************/
diff --git a/drivers/scsi/aic7xxx/aic79xx.seq b/drivers/scsi/aic7xxx/aic79xx.seq
index bef1f9d369b6..58bc17591b54 100644
--- a/drivers/scsi/aic7xxx/aic79xx.seq
+++ b/drivers/scsi/aic7xxx/aic79xx.seq
@@ -1,7 +1,7 @@
1/* 1/*
2 * Adaptec U320 device driver firmware for Linux and FreeBSD. 2 * Adaptec U320 device driver firmware for Linux and FreeBSD.
3 * 3 *
4 * Copyright (c) 1994-2001 Justin T. Gibbs. 4 * Copyright (c) 1994-2001, 2004 Justin T. Gibbs.
5 * Copyright (c) 2000-2002 Adaptec Inc. 5 * Copyright (c) 2000-2002 Adaptec Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -40,7 +40,7 @@
40 * $FreeBSD$ 40 * $FreeBSD$
41 */ 41 */
42 42
43VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#119 $" 43VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $"
44PATCH_ARG_LIST = "struct ahd_softc *ahd" 44PATCH_ARG_LIST = "struct ahd_softc *ahd"
45PREFIX = "ahd_" 45PREFIX = "ahd_"
46 46
@@ -110,10 +110,8 @@ check_waiting_list:
110 * one last time. 110 * one last time.
111 */ 111 */
112 test SSTAT0, SELDO jnz select_out; 112 test SSTAT0, SELDO jnz select_out;
113END_CRITICAL;
114 call start_selection; 113 call start_selection;
115idle_loop_checkbus: 114idle_loop_checkbus:
116BEGIN_CRITICAL;
117 test SSTAT0, SELDO jnz select_out; 115 test SSTAT0, SELDO jnz select_out;
118END_CRITICAL; 116END_CRITICAL;
119 test SSTAT0, SELDI jnz select_in; 117 test SSTAT0, SELDI jnz select_in;
@@ -294,7 +292,6 @@ fetch_new_scb_inprog:
294 test CCSCBCTL, ARRDONE jz return; 292 test CCSCBCTL, ARRDONE jz return;
295fetch_new_scb_done: 293fetch_new_scb_done:
296 and CCSCBCTL, ~(CCARREN|CCSCBEN); 294 and CCSCBCTL, ~(CCARREN|CCSCBEN);
297 bmov REG0, SCBPTR, 2;
298 clr A; 295 clr A;
299 add CMDS_PENDING, 1; 296 add CMDS_PENDING, 1;
300 adc CMDS_PENDING[1], A; 297 adc CMDS_PENDING[1], A;
@@ -316,43 +313,117 @@ fetch_new_scb_done:
316 clr SCB_FIFO_USE_COUNT; 313 clr SCB_FIFO_USE_COUNT;
317 /* Update the next SCB address to download. */ 314 /* Update the next SCB address to download. */
318 bmov NEXT_QUEUED_SCB_ADDR, SCB_NEXT_SCB_BUSADDR, 4; 315 bmov NEXT_QUEUED_SCB_ADDR, SCB_NEXT_SCB_BUSADDR, 4;
316 /*
317 * NULL out the SCB links since these fields
318 * occupy the same location as SCB_NEXT_SCB_BUSADDR.
319 */
319 mvi SCB_NEXT[1], SCB_LIST_NULL; 320 mvi SCB_NEXT[1], SCB_LIST_NULL;
320 mvi SCB_NEXT2[1], SCB_LIST_NULL; 321 mvi SCB_NEXT2[1], SCB_LIST_NULL;
321 /* Increment our position in the QINFIFO. */ 322 /* Increment our position in the QINFIFO. */
322 mov NONE, SNSCB_QOFF; 323 mov NONE, SNSCB_QOFF;
324
323 /* 325 /*
324 * SCBs that want to send messages are always 326 * Save SCBID of this SCB in REG0 since
325 * queued independently. This ensures that they 327 * SCBPTR will be clobbered during target
326 * are at the head of the SCB list to select out 328 * list updates. We also record the SCB's
327 * to a target and we will see the MK_MESSAGE flag. 329 * flags so that we can refer to them even
330 * after SCBPTR has been changed.
331 */
332 bmov REG0, SCBPTR, 2;
333 mov A, SCB_CONTROL;
334
335 /*
336 * Find the tail SCB of the execution queue
337 * for this target.
328 */ 338 */
329 test SCB_CONTROL, MK_MESSAGE jnz first_new_target_scb;
330 shr SINDEX, 3, SCB_SCSIID; 339 shr SINDEX, 3, SCB_SCSIID;
331 and SINDEX, ~0x1; 340 and SINDEX, ~0x1;
332 mvi SINDEX[1], (WAITING_SCB_TAILS >> 8); 341 mvi SINDEX[1], (WAITING_SCB_TAILS >> 8);
333 bmov DINDEX, SINDEX, 2; 342 bmov DINDEX, SINDEX, 2;
334 bmov SCBPTR, SINDIR, 2; 343 bmov SCBPTR, SINDIR, 2;
344
345 /*
346 * Update the tail to point to the new SCB.
347 */
335 bmov DINDIR, REG0, 2; 348 bmov DINDIR, REG0, 2;
349
350 /*
351 * If the queue was empty, queue this SCB as
352 * the first for this target.
353 */
336 cmp SCBPTR[1], SCB_LIST_NULL je first_new_target_scb; 354 cmp SCBPTR[1], SCB_LIST_NULL je first_new_target_scb;
355
356 /*
357 * SCBs that want to send messages must always be
358 * at the head of their per-target queue so that
359 * ATN can be asserted even if the current
360 * negotiation agreement is packetized. If the
361 * target queue is empty, the SCB can be queued
362 * immediately. If the queue is not empty, we must
363 * wait for it to empty before entering this SCB
364 * into the waiting for selection queue. Otherwise
365 * our batching and round-robin selection scheme
366 * could allow commands to be queued out of order.
367 * To simplify the implementation, we stop pulling
368 * new commands from the host until the MK_MESSAGE
369 * SCB can be queued to the waiting for selection
370 * list.
371 */
372 test A, MK_MESSAGE jz batch_scb;
373
374 /*
375 * If the last SCB is also a MK_MESSAGE SCB, then
376 * order is preserved even if we batch.
377 */
378 test SCB_CONTROL, MK_MESSAGE jz batch_scb;
379
380 /*
381 * Defer this SCB and stop fetching new SCBs until
382 * it can be queued. Since the SCB_SCSIID of the
383 * tail SCB must be the same as that of the newly
384 * queued SCB, there is no need to restore the SCBID
385 * here.
386 */
387 or SEQ_FLAGS2, PENDING_MK_MESSAGE;
388 bmov MK_MESSAGE_SCB, REG0, 2;
389 mov MK_MESSAGE_SCSIID, SCB_SCSIID ret;
390
391batch_scb:
392 /*
393 * Otherwise just update the previous tail SCB to
394 * point to the new tail.
395 */
337 bmov SCB_NEXT, REG0, 2 ret; 396 bmov SCB_NEXT, REG0, 2 ret;
397
338first_new_target_scb: 398first_new_target_scb:
399 /*
400 * Append SCB to the tail of the waiting for
401 * selection list.
402 */
339 cmp WAITING_TID_HEAD[1], SCB_LIST_NULL je first_new_scb; 403 cmp WAITING_TID_HEAD[1], SCB_LIST_NULL je first_new_scb;
340 bmov SCBPTR, WAITING_TID_TAIL, 2; 404 bmov SCBPTR, WAITING_TID_TAIL, 2;
341 bmov SCB_NEXT2, REG0, 2; 405 bmov SCB_NEXT2, REG0, 2;
342 bmov WAITING_TID_TAIL, REG0, 2 ret; 406 bmov WAITING_TID_TAIL, REG0, 2 ret;
343first_new_scb: 407first_new_scb:
408 /*
409 * Whole list is empty, so the head of
410 * the list must be initialized too.
411 */
344 bmov WAITING_TID_HEAD, REG0, 2; 412 bmov WAITING_TID_HEAD, REG0, 2;
345 bmov WAITING_TID_TAIL, REG0, 2 ret; 413 bmov WAITING_TID_TAIL, REG0, 2 ret;
346END_CRITICAL; 414END_CRITICAL;
347 415
348scbdma_idle: 416scbdma_idle:
349 /* 417 /*
350 * Give precedence to downloading new SCBs to execute 418 * Don't bother downloading new SCBs to execute
351 * unless select-outs are currently frozen. 419 * if select-outs are currently frozen or we have
420 * a MK_MESSAGE SCB waiting to enter the queue.
352 */ 421 */
353 test SEQ_FLAGS2, SELECTOUT_QFROZEN jnz . + 2; 422 test SEQ_FLAGS2, SELECTOUT_QFROZEN|PENDING_MK_MESSAGE
423 jnz scbdma_no_new_scbs;
354BEGIN_CRITICAL; 424BEGIN_CRITICAL;
355 test QOFF_CTLSTA, NEW_SCB_AVAIL jnz fetch_new_scb; 425 test QOFF_CTLSTA, NEW_SCB_AVAIL jnz fetch_new_scb;
426scbdma_no_new_scbs:
356 cmp COMPLETE_DMA_SCB_HEAD[1], SCB_LIST_NULL jne dma_complete_scb; 427 cmp COMPLETE_DMA_SCB_HEAD[1], SCB_LIST_NULL jne dma_complete_scb;
357 cmp COMPLETE_SCB_HEAD[1], SCB_LIST_NULL je return; 428 cmp COMPLETE_SCB_HEAD[1], SCB_LIST_NULL je return;
358 /* FALLTHROUGH */ 429 /* FALLTHROUGH */
@@ -671,27 +742,41 @@ curscb_ww_done:
671 } 742 }
672 743
673 /* 744 /*
674 * Requeue any SCBs not sent, to the tail of the waiting Q. 745 * The whole list made it. Clear our tail pointer to indicate
746 * that the per-target selection queue is now empty.
675 */ 747 */
676 cmp SCB_NEXT[1], SCB_LIST_NULL je select_out_list_done; 748 cmp SCB_NEXT[1], SCB_LIST_NULL je select_out_clear_tail;
677 749
678 /* 750 /*
751 * Requeue any SCBs not sent, to the tail of the waiting Q.
679 * We know that neither the per-TID list nor the list of 752 * We know that neither the per-TID list nor the list of
680 * TIDs is empty. Use this knowledge to our advantage. 753 * TIDs is empty. Use this knowledge to our advantage and
754 * queue the remainder to the tail of the global execution
755 * queue.
681 */ 756 */
682 bmov REG0, SCB_NEXT, 2; 757 bmov REG0, SCB_NEXT, 2;
758select_out_queue_remainder:
683 bmov SCBPTR, WAITING_TID_TAIL, 2; 759 bmov SCBPTR, WAITING_TID_TAIL, 2;
684 bmov SCB_NEXT2, REG0, 2; 760 bmov SCB_NEXT2, REG0, 2;
685 bmov WAITING_TID_TAIL, REG0, 2; 761 bmov WAITING_TID_TAIL, REG0, 2;
686 jmp select_out_inc_tid_q; 762 jmp select_out_inc_tid_q;
687 763
688select_out_list_done: 764select_out_clear_tail:
765 /*
766 * Queue any pending MK_MESSAGE SCB for this target now
767 * that the queue is empty.
768 */
769 test SEQ_FLAGS2, PENDING_MK_MESSAGE jz select_out_no_mk_message_scb;
770 mov A, MK_MESSAGE_SCSIID;
771 cmp SCB_SCSIID, A jne select_out_no_mk_message_scb;
772 and SEQ_FLAGS2, ~PENDING_MK_MESSAGE;
773 bmov REG0, MK_MESSAGE_SCB, 2;
774 jmp select_out_queue_remainder;
775
776select_out_no_mk_message_scb:
689 /* 777 /*
690 * The whole list made it. Just clear our TID's tail pointer 778 * Clear this target's execution tail and increment the queue.
691 * unless we were queued independently due to our need to
692 * send a message.
693 */ 779 */
694 test SCB_CONTROL, MK_MESSAGE jnz select_out_inc_tid_q;
695 shr DINDEX, 3, SCB_SCSIID; 780 shr DINDEX, 3, SCB_SCSIID;
696 or DINDEX, 1; /* Want only the second byte */ 781 or DINDEX, 1; /* Want only the second byte */
697 mvi DINDEX[1], ((WAITING_SCB_TAILS) >> 8); 782 mvi DINDEX[1], ((WAITING_SCB_TAILS) >> 8);
@@ -703,8 +788,8 @@ select_out_inc_tid_q:
703 mvi WAITING_TID_TAIL[1], SCB_LIST_NULL; 788 mvi WAITING_TID_TAIL[1], SCB_LIST_NULL;
704 bmov SCBPTR, CURRSCB, 2; 789 bmov SCBPTR, CURRSCB, 2;
705 mvi CLRSINT0, CLRSELDO; 790 mvi CLRSINT0, CLRSELDO;
706 test LQOSTAT2, LQOPHACHGOUTPKT jnz unexpected_nonpkt_phase; 791 test LQOSTAT2, LQOPHACHGOUTPKT jnz unexpected_nonpkt_mode_cleared;
707 test LQOSTAT1, LQOPHACHGINPKT jnz unexpected_nonpkt_phase; 792 test LQOSTAT1, LQOPHACHGINPKT jnz unexpected_nonpkt_mode_cleared;
708 793
709 /* 794 /*
710 * If this is a packetized connection, return to our 795 * If this is a packetized connection, return to our
@@ -2127,6 +2212,18 @@ SET_DST_MODE M_DFF0;
2127 mvi DFFSXFRCTL, CLRCHN; 2212 mvi DFFSXFRCTL, CLRCHN;
2128unexpected_nonpkt_mode_cleared: 2213unexpected_nonpkt_mode_cleared:
2129 mvi CLRSINT2, CLRNONPACKREQ; 2214 mvi CLRSINT2, CLRNONPACKREQ;
2215 if ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0) {
2216 /*
2217 * Test to ensure that the bus has not
2218 * already gone free prior to clearing
2219 * any stale busfree status. This avoids
2220 * a window whereby a busfree just after
2221 * a selection could be missed.
2222 */
2223 test SCSISIGI, BSYI jz . + 2;
2224 mvi CLRSINT1,CLRBUSFREE;
2225 or SIMODE1, ENBUSFREE;
2226 }
2130 test SCSIPHASE, ~(MSG_IN_PHASE|MSG_OUT_PHASE) jnz illegal_phase; 2227 test SCSIPHASE, ~(MSG_IN_PHASE|MSG_OUT_PHASE) jnz illegal_phase;
2131 SET_SEQINTCODE(ENTERING_NONPACK) 2228 SET_SEQINTCODE(ENTERING_NONPACK)
2132 jmp ITloop; 2229 jmp ITloop;
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index db8f5ce99ee3..342f77966a5b 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -37,7 +37,7 @@
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES. 38 * POSSIBILITY OF SUCH DAMAGES.
39 * 39 *
40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#247 $ 40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#250 $
41 */ 41 */
42 42
43#ifdef __linux__ 43#ifdef __linux__
@@ -197,7 +197,8 @@ static int ahd_search_scb_list(struct ahd_softc *ahd, int target,
197 char channel, int lun, u_int tag, 197 char channel, int lun, u_int tag,
198 role_t role, uint32_t status, 198 role_t role, uint32_t status,
199 ahd_search_action action, 199 ahd_search_action action,
200 u_int *list_head, u_int tid); 200 u_int *list_head, u_int *list_tail,
201 u_int tid);
201static void ahd_stitch_tid_list(struct ahd_softc *ahd, 202static void ahd_stitch_tid_list(struct ahd_softc *ahd,
202 u_int tid_prev, u_int tid_cur, 203 u_int tid_prev, u_int tid_cur,
203 u_int tid_next); 204 u_int tid_next);
@@ -1660,7 +1661,8 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
1660 * so just clear the error. 1661 * so just clear the error.
1661 */ 1662 */
1662 ahd_outb(ahd, CLRLQIINT1, CLRLQICRCI_NLQ); 1663 ahd_outb(ahd, CLRLQIINT1, CLRLQICRCI_NLQ);
1663 } else if ((status & BUSFREE) != 0) { 1664 } else if ((status & BUSFREE) != 0
1665 || (lqistat1 & LQOBUSFREE) != 0) {
1664 u_int lqostat1; 1666 u_int lqostat1;
1665 int restart; 1667 int restart;
1666 int clear_fifo; 1668 int clear_fifo;
@@ -2025,10 +2027,6 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime)
2025 u_int waiting_t; 2027 u_int waiting_t;
2026 u_int next; 2028 u_int next;
2027 2029
2028 if ((busfreetime & BUSFREE_LQO) == 0)
2029 printf("%s: Warning, BUSFREE time is 0x%x. "
2030 "Expected BUSFREE_LQO.\n",
2031 ahd_name(ahd), busfreetime);
2032 /* 2030 /*
2033 * The LQO manager detected an unexpected busfree 2031 * The LQO manager detected an unexpected busfree
2034 * either: 2032 * either:
@@ -2251,8 +2249,14 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2251 struct ahd_tmode_tstate *tstate; 2249 struct ahd_tmode_tstate *tstate;
2252 2250
2253 /* 2251 /*
2254 * PPR Rejected. Try non-ppr negotiation 2252 * PPR Rejected.
2255 * and retry command. 2253 *
2254 * If the previous negotiation was packetized,
2255 * this could be because the device has been
2256 * reset without our knowledge. Force our
2257 * current negotiation to async and retry the
2258 * negotiation. Otherwise retry the command
2259 * with non-ppr negotiation.
2256 */ 2260 */
2257#ifdef AHD_DEBUG 2261#ifdef AHD_DEBUG
2258 if ((ahd_debug & AHD_SHOW_MESSAGES) != 0) 2262 if ((ahd_debug & AHD_SHOW_MESSAGES) != 0)
@@ -2261,11 +2265,34 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2261 tinfo = ahd_fetch_transinfo(ahd, devinfo.channel, 2265 tinfo = ahd_fetch_transinfo(ahd, devinfo.channel,
2262 devinfo.our_scsiid, 2266 devinfo.our_scsiid,
2263 devinfo.target, &tstate); 2267 devinfo.target, &tstate);
2264 tinfo->curr.transport_version = 2; 2268 if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ)!=0) {
2265 tinfo->goal.transport_version = 2; 2269 ahd_set_width(ahd, &devinfo,
2266 tinfo->goal.ppr_options = 0; 2270 MSG_EXT_WDTR_BUS_8_BIT,
2267 ahd_qinfifo_requeue_tail(ahd, scb); 2271 AHD_TRANS_CUR,
2268 printerror = 0; 2272 /*paused*/TRUE);
2273 ahd_set_syncrate(ahd, &devinfo,
2274 /*period*/0, /*offset*/0,
2275 /*ppr_options*/0,
2276 AHD_TRANS_CUR,
2277 /*paused*/TRUE);
2278 /*
2279 * The expect PPR busfree handler below
2280 * will effect the retry and necessary
2281 * abort.
2282 */
2283 } else {
2284 tinfo->curr.transport_version = 2;
2285 tinfo->goal.transport_version = 2;
2286 tinfo->goal.ppr_options = 0;
2287 /*
2288 * Remove any SCBs in the waiting for selection
2289 * queue that may also be for this target so
2290 * that command ordering is preserved.
2291 */
2292 ahd_freeze_devq(ahd, scb);
2293 ahd_qinfifo_requeue_tail(ahd, scb);
2294 printerror = 0;
2295 }
2269 } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_WDTR, FALSE) 2296 } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_WDTR, FALSE)
2270 && ppr_busfree == 0) { 2297 && ppr_busfree == 0) {
2271 /* 2298 /*
@@ -2280,6 +2307,12 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2280 MSG_EXT_WDTR_BUS_8_BIT, 2307 MSG_EXT_WDTR_BUS_8_BIT,
2281 AHD_TRANS_CUR|AHD_TRANS_GOAL, 2308 AHD_TRANS_CUR|AHD_TRANS_GOAL,
2282 /*paused*/TRUE); 2309 /*paused*/TRUE);
2310 /*
2311 * Remove any SCBs in the waiting for selection
2312 * queue that may also be for this target so that
2313 * command ordering is preserved.
2314 */
2315 ahd_freeze_devq(ahd, scb);
2283 ahd_qinfifo_requeue_tail(ahd, scb); 2316 ahd_qinfifo_requeue_tail(ahd, scb);
2284 printerror = 0; 2317 printerror = 0;
2285 } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_SDTR, FALSE) 2318 } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_SDTR, FALSE)
@@ -2297,6 +2330,12 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2297 /*ppr_options*/0, 2330 /*ppr_options*/0,
2298 AHD_TRANS_CUR|AHD_TRANS_GOAL, 2331 AHD_TRANS_CUR|AHD_TRANS_GOAL,
2299 /*paused*/TRUE); 2332 /*paused*/TRUE);
2333 /*
2334 * Remove any SCBs in the waiting for selection
2335 * queue that may also be for this target so that
2336 * command ordering is preserved.
2337 */
2338 ahd_freeze_devq(ahd, scb);
2300 ahd_qinfifo_requeue_tail(ahd, scb); 2339 ahd_qinfifo_requeue_tail(ahd, scb);
2301 printerror = 0; 2340 printerror = 0;
2302 } else if ((ahd->msg_flags & MSG_FLAG_EXPECT_IDE_BUSFREE) != 0 2341 } else if ((ahd->msg_flags & MSG_FLAG_EXPECT_IDE_BUSFREE) != 0
@@ -2369,14 +2408,14 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2369 */ 2408 */
2370 printf("%s: ", ahd_name(ahd)); 2409 printf("%s: ", ahd_name(ahd));
2371 } 2410 }
2372 if (lastphase != P_BUSFREE)
2373 ahd_force_renegotiation(ahd, &devinfo);
2374 printf("Unexpected busfree %s, %d SCBs aborted, " 2411 printf("Unexpected busfree %s, %d SCBs aborted, "
2375 "PRGMCNT == 0x%x\n", 2412 "PRGMCNT == 0x%x\n",
2376 ahd_lookup_phase_entry(lastphase)->phasemsg, 2413 ahd_lookup_phase_entry(lastphase)->phasemsg,
2377 aborted, 2414 aborted,
2378 ahd_inw(ahd, PRGMCNT)); 2415 ahd_inw(ahd, PRGMCNT));
2379 ahd_dump_card_state(ahd); 2416 ahd_dump_card_state(ahd);
2417 if (lastphase != P_BUSFREE)
2418 ahd_force_renegotiation(ahd, &devinfo);
2380 } 2419 }
2381 /* Always restart the sequencer. */ 2420 /* Always restart the sequencer. */
2382 return (1); 2421 return (1);
@@ -3293,6 +3332,15 @@ ahd_update_neg_table(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
3293 con_opts |= WIDEXFER; 3332 con_opts |= WIDEXFER;
3294 3333
3295 /* 3334 /*
3335 * Slow down our CRC interval to be
3336 * compatible with packetized U320 devices
3337 * that can't handle a CRC at full speed
3338 */
3339 if (ahd->features & AHD_AIC79XXB_SLOWCRC) {
3340 con_opts |= ENSLOWCRC;
3341 }
3342
3343 /*
3296 * During packetized transfers, the target will 3344 * During packetized transfers, the target will
3297 * give us the oportunity to send command packets 3345 * give us the oportunity to send command packets
3298 * without us asserting attention. 3346 * without us asserting attention.
@@ -3315,7 +3363,6 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
3315{ 3363{
3316 struct scb *pending_scb; 3364 struct scb *pending_scb;
3317 int pending_scb_count; 3365 int pending_scb_count;
3318 u_int scb_tag;
3319 int paused; 3366 int paused;
3320 u_int saved_scbptr; 3367 u_int saved_scbptr;
3321 ahd_mode_state saved_modes; 3368 ahd_mode_state saved_modes;
@@ -3333,7 +3380,6 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
3333 pending_scb_count = 0; 3380 pending_scb_count = 0;
3334 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { 3381 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
3335 struct ahd_devinfo devinfo; 3382 struct ahd_devinfo devinfo;
3336 struct hardware_scb *pending_hscb;
3337 struct ahd_initiator_tinfo *tinfo; 3383 struct ahd_initiator_tinfo *tinfo;
3338 struct ahd_tmode_tstate *tstate; 3384 struct ahd_tmode_tstate *tstate;
3339 3385
@@ -3341,11 +3387,10 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
3341 tinfo = ahd_fetch_transinfo(ahd, devinfo.channel, 3387 tinfo = ahd_fetch_transinfo(ahd, devinfo.channel,
3342 devinfo.our_scsiid, 3388 devinfo.our_scsiid,
3343 devinfo.target, &tstate); 3389 devinfo.target, &tstate);
3344 pending_hscb = pending_scb->hscb;
3345 if ((tstate->auto_negotiate & devinfo.target_mask) == 0 3390 if ((tstate->auto_negotiate & devinfo.target_mask) == 0
3346 && (pending_scb->flags & SCB_AUTO_NEGOTIATE) != 0) { 3391 && (pending_scb->flags & SCB_AUTO_NEGOTIATE) != 0) {
3347 pending_scb->flags &= ~SCB_AUTO_NEGOTIATE; 3392 pending_scb->flags &= ~SCB_AUTO_NEGOTIATE;
3348 pending_hscb->control &= ~MK_MESSAGE; 3393 pending_scb->hscb->control &= ~MK_MESSAGE;
3349 } 3394 }
3350 ahd_sync_scb(ahd, pending_scb, 3395 ahd_sync_scb(ahd, pending_scb,
3351 BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); 3396 BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
@@ -3377,18 +3422,15 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
3377 ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO); 3422 ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
3378 saved_scbptr = ahd_get_scbptr(ahd); 3423 saved_scbptr = ahd_get_scbptr(ahd);
3379 /* Ensure that the hscbs down on the card match the new information */ 3424 /* Ensure that the hscbs down on the card match the new information */
3380 for (scb_tag = 0; scb_tag < ahd->scb_data.maxhscbs; scb_tag++) { 3425 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
3381 struct hardware_scb *pending_hscb; 3426 u_int scb_tag;
3382 u_int control; 3427 u_int control;
3383 3428
3384 pending_scb = ahd_lookup_scb(ahd, scb_tag); 3429 scb_tag = SCB_GET_TAG(pending_scb);
3385 if (pending_scb == NULL)
3386 continue;
3387 ahd_set_scbptr(ahd, scb_tag); 3430 ahd_set_scbptr(ahd, scb_tag);
3388 pending_hscb = pending_scb->hscb;
3389 control = ahd_inb_scbram(ahd, SCB_CONTROL); 3431 control = ahd_inb_scbram(ahd, SCB_CONTROL);
3390 control &= ~MK_MESSAGE; 3432 control &= ~MK_MESSAGE;
3391 control |= pending_hscb->control & MK_MESSAGE; 3433 control |= pending_scb->hscb->control & MK_MESSAGE;
3392 ahd_outb(ahd, SCB_CONTROL, control); 3434 ahd_outb(ahd, SCB_CONTROL, control);
3393 } 3435 }
3394 ahd_set_scbptr(ahd, saved_scbptr); 3436 ahd_set_scbptr(ahd, saved_scbptr);
@@ -6500,13 +6542,14 @@ ahd_chip_init(struct ahd_softc *ahd)
6500 | ENLQIOVERI_LQ|ENLQIOVERI_NLQ); 6542 | ENLQIOVERI_LQ|ENLQIOVERI_NLQ);
6501 ahd_outb(ahd, LQOMODE0, ENLQOATNLQ|ENLQOATNPKT|ENLQOTCRC); 6543 ahd_outb(ahd, LQOMODE0, ENLQOATNLQ|ENLQOATNPKT|ENLQOTCRC);
6502 /* 6544 /*
6503 * An interrupt from LQOBUSFREE is made redundant by the 6545 * We choose to have the sequencer catch LQOPHCHGINPKT errors
6504 * BUSFREE interrupt. We choose to have the sequencer catch 6546 * manually for the command phase at the start of a packetized
6505 * LQOPHCHGINPKT errors manually for the command phase at the 6547 * selection case. ENLQOBUSFREE should be made redundant by
6506 * start of a packetized selection case. 6548 * the BUSFREE interrupt, but it seems that some LQOBUSFREE
6507 ahd_outb(ahd, LQOMODE1, ENLQOBUSFREE|ENLQOPHACHGINPKT); 6549 * events fail to assert the BUSFREE interrupt so we must
6550 * also enable LQOBUSFREE interrupts.
6508 */ 6551 */
6509 ahd_outb(ahd, LQOMODE1, 0); 6552 ahd_outb(ahd, LQOMODE1, ENLQOBUSFREE);
6510 6553
6511 /* 6554 /*
6512 * Setup sequencer interrupt handlers. 6555 * Setup sequencer interrupt handlers.
@@ -6617,6 +6660,8 @@ ahd_chip_init(struct ahd_softc *ahd)
6617 /* We don't have any waiting selections */ 6660 /* We don't have any waiting selections */
6618 ahd_outw(ahd, WAITING_TID_HEAD, SCB_LIST_NULL); 6661 ahd_outw(ahd, WAITING_TID_HEAD, SCB_LIST_NULL);
6619 ahd_outw(ahd, WAITING_TID_TAIL, SCB_LIST_NULL); 6662 ahd_outw(ahd, WAITING_TID_TAIL, SCB_LIST_NULL);
6663 ahd_outw(ahd, MK_MESSAGE_SCB, SCB_LIST_NULL);
6664 ahd_outw(ahd, MK_MESSAGE_SCSIID, 0xFF);
6620 for (i = 0; i < AHD_NUM_TARGETS; i++) 6665 for (i = 0; i < AHD_NUM_TARGETS; i++)
6621 ahd_outw(ahd, WAITING_SCB_TAILS + (2 * i), SCB_LIST_NULL); 6666 ahd_outw(ahd, WAITING_SCB_TAILS + (2 * i), SCB_LIST_NULL);
6622 6667
@@ -6704,6 +6749,18 @@ ahd_chip_init(struct ahd_softc *ahd)
6704 6749
6705 ahd_loadseq(ahd); 6750 ahd_loadseq(ahd);
6706 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); 6751 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
6752
6753 if (ahd->features & AHD_AIC79XXB_SLOWCRC) {
6754 u_int negodat3 = ahd_inb(ahd, NEGCONOPTS);
6755
6756 negodat3 |= ENSLOWCRC;
6757 ahd_outb(ahd, NEGCONOPTS, negodat3);
6758 negodat3 = ahd_inb(ahd, NEGCONOPTS);
6759 if (!(negodat3 & ENSLOWCRC))
6760 printf("aic79xx: failed to set the SLOWCRC bit\n");
6761 else
6762 printf("aic79xx: SLOWCRC bit set\n");
6763 }
6707} 6764}
6708 6765
6709/* 6766/*
@@ -7260,12 +7317,28 @@ ahd_reset_cmds_pending(struct ahd_softc *ahd)
7260 ahd->flags &= ~AHD_UPDATE_PEND_CMDS; 7317 ahd->flags &= ~AHD_UPDATE_PEND_CMDS;
7261} 7318}
7262 7319
7320void
7321ahd_done_with_status(struct ahd_softc *ahd, struct scb *scb, uint32_t status)
7322{
7323 cam_status ostat;
7324 cam_status cstat;
7325
7326 ostat = ahd_get_transaction_status(scb);
7327 if (ostat == CAM_REQ_INPROG)
7328 ahd_set_transaction_status(scb, status);
7329 cstat = ahd_get_transaction_status(scb);
7330 if (cstat != CAM_REQ_CMP)
7331 ahd_freeze_scb(scb);
7332 ahd_done(ahd, scb);
7333}
7334
7263int 7335int
7264ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, 7336ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7265 int lun, u_int tag, role_t role, uint32_t status, 7337 int lun, u_int tag, role_t role, uint32_t status,
7266 ahd_search_action action) 7338 ahd_search_action action)
7267{ 7339{
7268 struct scb *scb; 7340 struct scb *scb;
7341 struct scb *mk_msg_scb;
7269 struct scb *prev_scb; 7342 struct scb *prev_scb;
7270 ahd_mode_state saved_modes; 7343 ahd_mode_state saved_modes;
7271 u_int qinstart; 7344 u_int qinstart;
@@ -7274,6 +7347,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7274 u_int tid_next; 7347 u_int tid_next;
7275 u_int tid_prev; 7348 u_int tid_prev;
7276 u_int scbid; 7349 u_int scbid;
7350 u_int seq_flags2;
7277 u_int savedscbptr; 7351 u_int savedscbptr;
7278 uint32_t busaddr; 7352 uint32_t busaddr;
7279 int found; 7353 int found;
@@ -7329,23 +7403,10 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7329 found++; 7403 found++;
7330 switch (action) { 7404 switch (action) {
7331 case SEARCH_COMPLETE: 7405 case SEARCH_COMPLETE:
7332 {
7333 cam_status ostat;
7334 cam_status cstat;
7335
7336 ostat = ahd_get_transaction_status(scb);
7337 if (ostat == CAM_REQ_INPROG)
7338 ahd_set_transaction_status(scb,
7339 status);
7340 cstat = ahd_get_transaction_status(scb);
7341 if (cstat != CAM_REQ_CMP)
7342 ahd_freeze_scb(scb);
7343 if ((scb->flags & SCB_ACTIVE) == 0) 7406 if ((scb->flags & SCB_ACTIVE) == 0)
7344 printf("Inactive SCB in qinfifo\n"); 7407 printf("Inactive SCB in qinfifo\n");
7345 ahd_done(ahd, scb); 7408 ahd_done_with_status(ahd, scb, status);
7346
7347 /* FALLTHROUGH */ 7409 /* FALLTHROUGH */
7348 }
7349 case SEARCH_REMOVE: 7410 case SEARCH_REMOVE:
7350 break; 7411 break;
7351 case SEARCH_PRINT: 7412 case SEARCH_PRINT:
@@ -7375,21 +7436,24 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7375 * looking for matches. 7436 * looking for matches.
7376 */ 7437 */
7377 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); 7438 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
7439 seq_flags2 = ahd_inb(ahd, SEQ_FLAGS2);
7440 if ((seq_flags2 & PENDING_MK_MESSAGE) != 0) {
7441 scbid = ahd_inw(ahd, MK_MESSAGE_SCB);
7442 mk_msg_scb = ahd_lookup_scb(ahd, scbid);
7443 } else
7444 mk_msg_scb = NULL;
7378 savedscbptr = ahd_get_scbptr(ahd); 7445 savedscbptr = ahd_get_scbptr(ahd);
7379 tid_next = ahd_inw(ahd, WAITING_TID_HEAD); 7446 tid_next = ahd_inw(ahd, WAITING_TID_HEAD);
7380 tid_prev = SCB_LIST_NULL; 7447 tid_prev = SCB_LIST_NULL;
7381 targets = 0; 7448 targets = 0;
7382 for (scbid = tid_next; !SCBID_IS_NULL(scbid); scbid = tid_next) { 7449 for (scbid = tid_next; !SCBID_IS_NULL(scbid); scbid = tid_next) {
7383 u_int tid_head; 7450 u_int tid_head;
7451 u_int tid_tail;
7384 7452
7385 /*
7386 * We limit based on the number of SCBs since
7387 * MK_MESSAGE SCBs are not in the per-tid lists.
7388 */
7389 targets++; 7453 targets++;
7390 if (targets > AHD_SCB_MAX) { 7454 if (targets > AHD_NUM_TARGETS)
7391 panic("TID LIST LOOP"); 7455 panic("TID LIST LOOP");
7392 } 7456
7393 if (scbid >= ahd->scb_data.numscbs) { 7457 if (scbid >= ahd->scb_data.numscbs) {
7394 printf("%s: Waiting TID List inconsistency. " 7458 printf("%s: Waiting TID List inconsistency. "
7395 "SCB index == 0x%x, yet numscbs == 0x%x.", 7459 "SCB index == 0x%x, yet numscbs == 0x%x.",
@@ -7419,8 +7483,71 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7419 tid_head = scbid; 7483 tid_head = scbid;
7420 found += ahd_search_scb_list(ahd, target, channel, 7484 found += ahd_search_scb_list(ahd, target, channel,
7421 lun, tag, role, status, 7485 lun, tag, role, status,
7422 action, &tid_head, 7486 action, &tid_head, &tid_tail,
7423 SCB_GET_TARGET(ahd, scb)); 7487 SCB_GET_TARGET(ahd, scb));
7488 /*
7489 * Check any MK_MESSAGE SCB that is still waiting to
7490 * enter this target's waiting for selection queue.
7491 */
7492 if (mk_msg_scb != NULL
7493 && ahd_match_scb(ahd, mk_msg_scb, target, channel,
7494 lun, tag, role)) {
7495
7496 /*
7497 * We found an scb that needs to be acted on.
7498 */
7499 found++;
7500 switch (action) {
7501 case SEARCH_COMPLETE:
7502 if ((mk_msg_scb->flags & SCB_ACTIVE) == 0)
7503 printf("Inactive SCB pending MK_MSG\n");
7504 ahd_done_with_status(ahd, mk_msg_scb, status);
7505 /* FALLTHROUGH */
7506 case SEARCH_REMOVE:
7507 {
7508 u_int tail_offset;
7509
7510 printf("Removing MK_MSG scb\n");
7511
7512 /*
7513 * Reset our tail to the tail of the
7514 * main per-target list.
7515 */
7516 tail_offset = WAITING_SCB_TAILS
7517 + (2 * SCB_GET_TARGET(ahd, mk_msg_scb));
7518 ahd_outw(ahd, tail_offset, tid_tail);
7519
7520 seq_flags2 &= ~PENDING_MK_MESSAGE;
7521 ahd_outb(ahd, SEQ_FLAGS2, seq_flags2);
7522 ahd_outw(ahd, CMDS_PENDING,
7523 ahd_inw(ahd, CMDS_PENDING)-1);
7524 mk_msg_scb = NULL;
7525 break;
7526 }
7527 case SEARCH_PRINT:
7528 printf(" 0x%x", SCB_GET_TAG(scb));
7529 /* FALLTHROUGH */
7530 case SEARCH_COUNT:
7531 break;
7532 }
7533 }
7534
7535 if (mk_msg_scb != NULL
7536 && SCBID_IS_NULL(tid_head)
7537 && ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD,
7538 SCB_LIST_NULL, ROLE_UNKNOWN)) {
7539
7540 /*
7541 * When removing the last SCB for a target
7542 * queue with a pending MK_MESSAGE scb, we
7543 * must queue the MK_MESSAGE scb.
7544 */
7545 printf("Queueing mk_msg_scb\n");
7546 tid_head = ahd_inw(ahd, MK_MESSAGE_SCB);
7547 seq_flags2 &= ~PENDING_MK_MESSAGE;
7548 ahd_outb(ahd, SEQ_FLAGS2, seq_flags2);
7549 mk_msg_scb = NULL;
7550 }
7424 if (tid_head != scbid) 7551 if (tid_head != scbid)
7425 ahd_stitch_tid_list(ahd, tid_prev, tid_head, tid_next); 7552 ahd_stitch_tid_list(ahd, tid_prev, tid_head, tid_next);
7426 if (!SCBID_IS_NULL(tid_head)) 7553 if (!SCBID_IS_NULL(tid_head))
@@ -7428,6 +7555,8 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7428 if (action == SEARCH_PRINT) 7555 if (action == SEARCH_PRINT)
7429 printf(")\n"); 7556 printf(")\n");
7430 } 7557 }
7558
7559 /* Restore saved state. */
7431 ahd_set_scbptr(ahd, savedscbptr); 7560 ahd_set_scbptr(ahd, savedscbptr);
7432 ahd_restore_modes(ahd, saved_modes); 7561 ahd_restore_modes(ahd, saved_modes);
7433 return (found); 7562 return (found);
@@ -7436,7 +7565,8 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
7436static int 7565static int
7437ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, 7566ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
7438 int lun, u_int tag, role_t role, uint32_t status, 7567 int lun, u_int tag, role_t role, uint32_t status,
7439 ahd_search_action action, u_int *list_head, u_int tid) 7568 ahd_search_action action, u_int *list_head,
7569 u_int *list_tail, u_int tid)
7440{ 7570{
7441 struct scb *scb; 7571 struct scb *scb;
7442 u_int scbid; 7572 u_int scbid;
@@ -7448,6 +7578,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
7448 found = 0; 7578 found = 0;
7449 prev = SCB_LIST_NULL; 7579 prev = SCB_LIST_NULL;
7450 next = *list_head; 7580 next = *list_head;
7581 *list_tail = SCB_LIST_NULL;
7451 for (scbid = next; !SCBID_IS_NULL(scbid); scbid = next) { 7582 for (scbid = next; !SCBID_IS_NULL(scbid); scbid = next) {
7452 if (scbid >= ahd->scb_data.numscbs) { 7583 if (scbid >= ahd->scb_data.numscbs) {
7453 printf("%s:SCB List inconsistency. " 7584 printf("%s:SCB List inconsistency. "
@@ -7463,6 +7594,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
7463 panic("Waiting List traversal\n"); 7594 panic("Waiting List traversal\n");
7464 } 7595 }
7465 ahd_set_scbptr(ahd, scbid); 7596 ahd_set_scbptr(ahd, scbid);
7597 *list_tail = scbid;
7466 next = ahd_inw_scbram(ahd, SCB_NEXT); 7598 next = ahd_inw_scbram(ahd, SCB_NEXT);
7467 if (ahd_match_scb(ahd, scb, target, channel, 7599 if (ahd_match_scb(ahd, scb, target, channel,
7468 lun, SCB_LIST_NULL, role) == 0) { 7600 lun, SCB_LIST_NULL, role) == 0) {
@@ -7472,24 +7604,14 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
7472 found++; 7604 found++;
7473 switch (action) { 7605 switch (action) {
7474 case SEARCH_COMPLETE: 7606 case SEARCH_COMPLETE:
7475 {
7476 cam_status ostat;
7477 cam_status cstat;
7478
7479 ostat = ahd_get_transaction_status(scb);
7480 if (ostat == CAM_REQ_INPROG)
7481 ahd_set_transaction_status(scb, status);
7482 cstat = ahd_get_transaction_status(scb);
7483 if (cstat != CAM_REQ_CMP)
7484 ahd_freeze_scb(scb);
7485 if ((scb->flags & SCB_ACTIVE) == 0) 7607 if ((scb->flags & SCB_ACTIVE) == 0)
7486 printf("Inactive SCB in Waiting List\n"); 7608 printf("Inactive SCB in Waiting List\n");
7487 ahd_done(ahd, scb); 7609 ahd_done_with_status(ahd, scb, status);
7488 /* FALLTHROUGH */ 7610 /* FALLTHROUGH */
7489 }
7490 case SEARCH_REMOVE: 7611 case SEARCH_REMOVE:
7491 ahd_rem_wscb(ahd, scbid, prev, next, tid); 7612 ahd_rem_wscb(ahd, scbid, prev, next, tid);
7492 if (prev == SCB_LIST_NULL) 7613 *list_tail = prev;
7614 if (SCBID_IS_NULL(prev))
7493 *list_head = next; 7615 *list_head = next;
7494 break; 7616 break;
7495 case SEARCH_PRINT: 7617 case SEARCH_PRINT:
@@ -7558,14 +7680,17 @@ ahd_rem_wscb(struct ahd_softc *ahd, u_int scbid,
7558 } 7680 }
7559 7681
7560 /* 7682 /*
7561 * SCBs that had MK_MESSAGE set in them will not 7683 * SCBs that have MK_MESSAGE set in them may
7562 * be queued to the per-target lists, so don't 7684 * cause the tail pointer to be updated without
7563 * blindly clear the tail pointer. 7685 * setting the next pointer of the previous tail.
7686 * Only clear the tail if the removed SCB was
7687 * the tail.
7564 */ 7688 */
7565 tail_offset = WAITING_SCB_TAILS + (2 * tid); 7689 tail_offset = WAITING_SCB_TAILS + (2 * tid);
7566 if (SCBID_IS_NULL(next) 7690 if (SCBID_IS_NULL(next)
7567 && ahd_inw(ahd, tail_offset) == scbid) 7691 && ahd_inw(ahd, tail_offset) == scbid)
7568 ahd_outw(ahd, tail_offset, prev); 7692 ahd_outw(ahd, tail_offset, prev);
7693
7569 ahd_add_scb_to_free_list(ahd, scbid); 7694 ahd_add_scb_to_free_list(ahd, scbid);
7570 return (next); 7695 return (next);
7571} 7696}
@@ -8148,11 +8273,6 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
8148 ahd_setup_data_scb(ahd, scb); 8273 ahd_setup_data_scb(ahd, scb);
8149 scb->flags |= SCB_SENSE; 8274 scb->flags |= SCB_SENSE;
8150 ahd_queue_scb(ahd, scb); 8275 ahd_queue_scb(ahd, scb);
8151 /*
8152 * Ensure we have enough time to actually
8153 * retrieve the sense.
8154 */
8155 ahd_scb_timer_reset(scb, 5 * 1000000);
8156 break; 8276 break;
8157 } 8277 }
8158 case SCSI_STATUS_OK: 8278 case SCSI_STATUS_OK:
@@ -8793,6 +8913,9 @@ ahd_dump_card_state(struct ahd_softc *ahd)
8793 * Mode independent registers. 8913 * Mode independent registers.
8794 */ 8914 */
8795 cur_col = 0; 8915 cur_col = 0;
8916 ahd_intstat_print(ahd_inb(ahd, INTSTAT), &cur_col, 50);
8917 ahd_seloid_print(ahd_inb(ahd, SELOID), &cur_col, 50);
8918 ahd_selid_print(ahd_inb(ahd, SELID), &cur_col, 50);
8796 ahd_hs_mailbox_print(ahd_inb(ahd, LOCAL_HS_MAILBOX), &cur_col, 50); 8919 ahd_hs_mailbox_print(ahd_inb(ahd, LOCAL_HS_MAILBOX), &cur_col, 50);
8797 ahd_intctl_print(ahd_inb(ahd, INTCTL), &cur_col, 50); 8920 ahd_intctl_print(ahd_inb(ahd, INTCTL), &cur_col, 50);
8798 ahd_seqintstat_print(ahd_inb(ahd, SEQINTSTAT), &cur_col, 50); 8921 ahd_seqintstat_print(ahd_inb(ahd, SEQINTSTAT), &cur_col, 50);
@@ -8808,6 +8931,12 @@ ahd_dump_card_state(struct ahd_softc *ahd)
8808 ahd_seqintctl_print(ahd_inb(ahd, SEQINTCTL), &cur_col, 50); 8931 ahd_seqintctl_print(ahd_inb(ahd, SEQINTCTL), &cur_col, 50);
8809 ahd_seq_flags_print(ahd_inb(ahd, SEQ_FLAGS), &cur_col, 50); 8932 ahd_seq_flags_print(ahd_inb(ahd, SEQ_FLAGS), &cur_col, 50);
8810 ahd_seq_flags2_print(ahd_inb(ahd, SEQ_FLAGS2), &cur_col, 50); 8933 ahd_seq_flags2_print(ahd_inb(ahd, SEQ_FLAGS2), &cur_col, 50);
8934 ahd_qfreeze_count_print(ahd_inw(ahd, QFREEZE_COUNT), &cur_col, 50);
8935 ahd_kernel_qfreeze_count_print(ahd_inw(ahd, KERNEL_QFREEZE_COUNT),
8936 &cur_col, 50);
8937 ahd_mk_message_scb_print(ahd_inw(ahd, MK_MESSAGE_SCB), &cur_col, 50);
8938 ahd_mk_message_scsiid_print(ahd_inb(ahd, MK_MESSAGE_SCSIID),
8939 &cur_col, 50);
8811 ahd_sstat0_print(ahd_inb(ahd, SSTAT0), &cur_col, 50); 8940 ahd_sstat0_print(ahd_inb(ahd, SSTAT0), &cur_col, 50);
8812 ahd_sstat1_print(ahd_inb(ahd, SSTAT1), &cur_col, 50); 8941 ahd_sstat1_print(ahd_inb(ahd, SSTAT1), &cur_col, 50);
8813 ahd_sstat2_print(ahd_inb(ahd, SSTAT2), &cur_col, 50); 8942 ahd_sstat2_print(ahd_inb(ahd, SSTAT2), &cur_col, 50);
@@ -8915,7 +9044,7 @@ ahd_dump_card_state(struct ahd_softc *ahd)
8915 9044
8916 ahd_set_modes(ahd, AHD_MODE_DFF0 + i, AHD_MODE_DFF0 + i); 9045 ahd_set_modes(ahd, AHD_MODE_DFF0 + i, AHD_MODE_DFF0 + i);
8917 fifo_scbptr = ahd_get_scbptr(ahd); 9046 fifo_scbptr = ahd_get_scbptr(ahd);
8918 printf("\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n", 9047 printf("\n\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n",
8919 ahd_name(ahd), i, 9048 ahd_name(ahd), i,
8920 (dffstat & (FIFO0FREE << i)) ? "Free" : "Active", 9049 (dffstat & (FIFO0FREE << i)) ? "Free" : "Active",
8921 ahd_inw(ahd, LONGJMP_ADDR), fifo_scbptr); 9050 ahd_inw(ahd, LONGJMP_ADDR), fifo_scbptr);
@@ -8970,6 +9099,9 @@ ahd_dump_card_state(struct ahd_softc *ahd)
8970 printf("%s: OS_SPACE_CNT = 0x%x MAXCMDCNT = 0x%x\n", 9099 printf("%s: OS_SPACE_CNT = 0x%x MAXCMDCNT = 0x%x\n",
8971 ahd_name(ahd), ahd_inb(ahd, OS_SPACE_CNT), 9100 ahd_name(ahd), ahd_inb(ahd, OS_SPACE_CNT),
8972 ahd_inb(ahd, MAXCMDCNT)); 9101 ahd_inb(ahd, MAXCMDCNT));
9102 printf("%s: SAVED_SCSIID = 0x%x SAVED_LUN = 0x%x\n",
9103 ahd_name(ahd), ahd_inb(ahd, SAVED_SCSIID),
9104 ahd_inb(ahd, SAVED_LUN));
8973 ahd_simode0_print(ahd_inb(ahd, SIMODE0), &cur_col, 50); 9105 ahd_simode0_print(ahd_inb(ahd, SIMODE0), &cur_col, 50);
8974 printf("\n"); 9106 printf("\n");
8975 ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN); 9107 ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN);
diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h
index 91c4f7f484b1..8ad3ce945b9e 100644
--- a/drivers/scsi/aic7xxx/aic79xx_inline.h
+++ b/drivers/scsi/aic7xxx/aic79xx_inline.h
@@ -37,7 +37,7 @@
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES. 38 * POSSIBILITY OF SUCH DAMAGES.
39 * 39 *
40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#58 $ 40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#59 $
41 * 41 *
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
@@ -804,9 +804,10 @@ ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb)
804 uint64_t host_dataptr; 804 uint64_t host_dataptr;
805 805
806 host_dataptr = ahd_le64toh(scb->hscb->dataptr); 806 host_dataptr = ahd_le64toh(scb->hscb->dataptr);
807 printf("%s: Queueing SCB 0x%x bus addr 0x%x - 0x%x%x/0x%x\n", 807 printf("%s: Queueing SCB %d:0x%x bus addr 0x%x - 0x%x%x/0x%x\n",
808 ahd_name(ahd), 808 ahd_name(ahd),
809 SCB_GET_TAG(scb), ahd_le32toh(scb->hscb->hscb_busaddr), 809 SCB_GET_TAG(scb), scb->hscb->scsiid,
810 ahd_le32toh(scb->hscb->hscb_busaddr),
810 (u_int)((host_dataptr >> 32) & 0xFFFFFFFF), 811 (u_int)((host_dataptr >> 32) & 0xFFFFFFFF),
811 (u_int)(host_dataptr & 0xFFFFFFFF), 812 (u_int)(host_dataptr & 0xFFFFFFFF),
812 ahd_le32toh(scb->hscb->datacnt)); 813 ahd_le32toh(scb->hscb->datacnt));
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 2567e29960bd..7254ea535a16 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -314,6 +314,21 @@ static uint32_t aic79xx_seltime;
314 */ 314 */
315uint32_t aic79xx_periodic_otag; 315uint32_t aic79xx_periodic_otag;
316 316
317/* Some storage boxes are using an LSI chip which has a bug making it
318 * impossible to use aic79xx Rev B chip in 320 speeds. The following
319 * storage boxes have been reported to be buggy:
320 * EonStor 3U 16-Bay: U16U-G3A3
321 * EonStor 2U 12-Bay: U12U-G3A3
322 * SentinelRAID: 2500F R5 / R6
323 * SentinelRAID: 2500F R1
324 * SentinelRAID: 2500F/1500F
325 * SentinelRAID: 150F
326 *
327 * To get around this LSI bug, you can set your board to 160 mode
328 * or you can enable the SLOWCRC bit.
329 */
330uint32_t aic79xx_slowcrc;
331
317/* 332/*
318 * Module information and settable options. 333 * Module information and settable options.
319 */ 334 */
@@ -343,6 +358,7 @@ MODULE_PARM_DESC(aic79xx,
343" amplitude:<int> Set the signal amplitude (0-7).\n" 358" amplitude:<int> Set the signal amplitude (0-7).\n"
344" seltime:<int> Selection Timeout:\n" 359" seltime:<int> Selection Timeout:\n"
345" (0/256ms,1/128ms,2/64ms,3/32ms)\n" 360" (0/256ms,1/128ms,2/64ms,3/32ms)\n"
361" slowcrc Turn on the SLOWCRC bit (Rev B only)\n"
346"\n" 362"\n"
347" Sample /etc/modprobe.conf line:\n" 363" Sample /etc/modprobe.conf line:\n"
348" Enable verbose logging\n" 364" Enable verbose logging\n"
@@ -1003,6 +1019,7 @@ aic79xx_setup(char *s)
1003 { "slewrate", NULL }, 1019 { "slewrate", NULL },
1004 { "precomp", NULL }, 1020 { "precomp", NULL },
1005 { "amplitude", NULL }, 1021 { "amplitude", NULL },
1022 { "slowcrc", &aic79xx_slowcrc },
1006 }; 1023 };
1007 1024
1008 end = strchr(s, '\0'); 1025 end = strchr(s, '\0');
@@ -1072,7 +1089,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa
1072 return (ENOMEM); 1089 return (ENOMEM);
1073 1090
1074 *((struct ahd_softc **)host->hostdata) = ahd; 1091 *((struct ahd_softc **)host->hostdata) = ahd;
1075 ahd_lock(ahd, &s);
1076 ahd->platform_data->host = host; 1092 ahd->platform_data->host = host;
1077 host->can_queue = AHD_MAX_QUEUE; 1093 host->can_queue = AHD_MAX_QUEUE;
1078 host->cmd_per_lun = 2; 1094 host->cmd_per_lun = 2;
@@ -1083,7 +1099,9 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa
1083 host->max_lun = AHD_NUM_LUNS; 1099 host->max_lun = AHD_NUM_LUNS;
1084 host->max_channel = 0; 1100 host->max_channel = 0;
1085 host->sg_tablesize = AHD_NSEG; 1101 host->sg_tablesize = AHD_NSEG;
1102 ahd_lock(ahd, &s);
1086 ahd_set_unit(ahd, ahd_linux_unit++); 1103 ahd_set_unit(ahd, ahd_linux_unit++);
1104 ahd_unlock(ahd, &s);
1087 sprintf(buf, "scsi%d", host->host_no); 1105 sprintf(buf, "scsi%d", host->host_no);
1088 new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); 1106 new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT);
1089 if (new_name != NULL) { 1107 if (new_name != NULL) {
@@ -1093,7 +1111,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa
1093 host->unique_id = ahd->unit; 1111 host->unique_id = ahd->unit;
1094 ahd_linux_initialize_scsi_bus(ahd); 1112 ahd_linux_initialize_scsi_bus(ahd);
1095 ahd_intr_enable(ahd, TRUE); 1113 ahd_intr_enable(ahd, TRUE);
1096 ahd_unlock(ahd, &s);
1097 1114
1098 host->transportt = ahd_linux_transport_template; 1115 host->transportt = ahd_linux_transport_template;
1099 1116
@@ -1127,6 +1144,7 @@ ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
1127{ 1144{
1128 u_int target_id; 1145 u_int target_id;
1129 u_int numtarg; 1146 u_int numtarg;
1147 unsigned long s;
1130 1148
1131 target_id = 0; 1149 target_id = 0;
1132 numtarg = 0; 1150 numtarg = 0;
@@ -1139,6 +1157,8 @@ ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
1139 else 1157 else
1140 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; 1158 numtarg = (ahd->features & AHD_WIDE) ? 16 : 8;
1141 1159
1160 ahd_lock(ahd, &s);
1161
1142 /* 1162 /*
1143 * Force negotiation to async for all targets that 1163 * Force negotiation to async for all targets that
1144 * will not see an initial bus reset. 1164 * will not see an initial bus reset.
@@ -1155,16 +1175,12 @@ ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
1155 ahd_update_neg_request(ahd, &devinfo, tstate, 1175 ahd_update_neg_request(ahd, &devinfo, tstate,
1156 tinfo, AHD_NEG_ALWAYS); 1176 tinfo, AHD_NEG_ALWAYS);
1157 } 1177 }
1178 ahd_unlock(ahd, &s);
1158 /* Give the bus some time to recover */ 1179 /* Give the bus some time to recover */
1159 if ((ahd->flags & AHD_RESET_BUS_A) != 0) { 1180 if ((ahd->flags & AHD_RESET_BUS_A) != 0) {
1160 ahd_freeze_simq(ahd); 1181 ahd_freeze_simq(ahd);
1161 init_timer(&ahd->platform_data->reset_timer); 1182 msleep(AIC79XX_RESET_DELAY);
1162 ahd->platform_data->reset_timer.data = (u_long)ahd; 1183 ahd_release_simq(ahd);
1163 ahd->platform_data->reset_timer.expires =
1164 jiffies + (AIC79XX_RESET_DELAY * HZ)/1000;
1165 ahd->platform_data->reset_timer.function =
1166 (ahd_linux_callback_t *)ahd_release_simq;
1167 add_timer(&ahd->platform_data->reset_timer);
1168 } 1184 }
1169} 1185}
1170 1186
@@ -2033,6 +2049,9 @@ ahd_linux_sem_timeout(u_long arg)
2033void 2049void
2034ahd_freeze_simq(struct ahd_softc *ahd) 2050ahd_freeze_simq(struct ahd_softc *ahd)
2035{ 2051{
2052 unsigned long s;
2053
2054 ahd_lock(ahd, &s);
2036 ahd->platform_data->qfrozen++; 2055 ahd->platform_data->qfrozen++;
2037 if (ahd->platform_data->qfrozen == 1) { 2056 if (ahd->platform_data->qfrozen == 1) {
2038 scsi_block_requests(ahd->platform_data->host); 2057 scsi_block_requests(ahd->platform_data->host);
@@ -2040,6 +2059,7 @@ ahd_freeze_simq(struct ahd_softc *ahd)
2040 CAM_LUN_WILDCARD, SCB_LIST_NULL, 2059 CAM_LUN_WILDCARD, SCB_LIST_NULL,
2041 ROLE_INITIATOR, CAM_REQUEUE_REQ); 2060 ROLE_INITIATOR, CAM_REQUEUE_REQ);
2042 } 2061 }
2062 ahd_unlock(ahd, &s);
2043} 2063}
2044 2064
2045void 2065void
@@ -2344,8 +2364,9 @@ done:
2344 ahd_name(ahd), dev->active); 2364 ahd_name(ahd), dev->active);
2345 retval = FAILED; 2365 retval = FAILED;
2346 } 2366 }
2347 } 2367 } else
2348 ahd_unlock(ahd, &flags); 2368 ahd_unlock(ahd, &flags);
2369
2349 return (retval); 2370 return (retval);
2350} 2371}
2351 2372
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index cb74fccc8100..9cb101345107 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -36,7 +36,7 @@
36 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGES. 37 * POSSIBILITY OF SUCH DAMAGES.
38 * 38 *
39 * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#137 $ 39 * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#166 $
40 * 40 *
41 */ 41 */
42#ifndef _AIC79XX_LINUX_H_ 42#ifndef _AIC79XX_LINUX_H_
@@ -228,7 +228,6 @@ typedef struct timer_list ahd_timer_t;
228typedef void ahd_linux_callback_t (u_long); 228typedef void ahd_linux_callback_t (u_long);
229static __inline void ahd_timer_reset(ahd_timer_t *timer, int usec, 229static __inline void ahd_timer_reset(ahd_timer_t *timer, int usec,
230 ahd_callback_t *func, void *arg); 230 ahd_callback_t *func, void *arg);
231static __inline void ahd_scb_timer_reset(struct scb *scb, u_int usec);
232 231
233static __inline void 232static __inline void
234ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg) 233ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg)
@@ -243,12 +242,6 @@ ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg)
243 add_timer(timer); 242 add_timer(timer);
244} 243}
245 244
246static __inline void
247ahd_scb_timer_reset(struct scb *scb, u_int usec)
248{
249 mod_timer(&scb->io_ctx->eh_timeout, jiffies + (usec * HZ)/1000000);
250}
251
252/***************************** SMP support ************************************/ 245/***************************** SMP support ************************************/
253#include <linux/spinlock.h> 246#include <linux/spinlock.h>
254 247
@@ -389,7 +382,6 @@ struct ahd_platform_data {
389 382
390 spinlock_t spin_lock; 383 spinlock_t spin_lock;
391 u_int qfrozen; 384 u_int qfrozen;
392 struct timer_list reset_timer;
393 struct semaphore eh_sem; 385 struct semaphore eh_sem;
394 struct Scsi_Host *host; /* pointer to scsi host */ 386 struct Scsi_Host *host; /* pointer to scsi host */
395#define AHD_LINUX_NOIRQ ((uint32_t)~0) 387#define AHD_LINUX_NOIRQ ((uint32_t)~0)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index bf360ae021ab..ebbf7e4ff4cc 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -220,10 +220,10 @@ ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base,
220 *base2 = pci_resource_start(ahd->dev_softc, 3); 220 *base2 = pci_resource_start(ahd->dev_softc, 3);
221 if (*base == 0 || *base2 == 0) 221 if (*base == 0 || *base2 == 0)
222 return (ENOMEM); 222 return (ENOMEM);
223 if (request_region(*base, 256, "aic79xx") == 0) 223 if (!request_region(*base, 256, "aic79xx"))
224 return (ENOMEM); 224 return (ENOMEM);
225 if (request_region(*base2, 256, "aic79xx") == 0) { 225 if (!request_region(*base2, 256, "aic79xx")) {
226 release_region(*base2, 256); 226 release_region(*base, 256);
227 return (ENOMEM); 227 return (ENOMEM);
228 } 228 }
229 return (0); 229 return (0);
@@ -237,7 +237,7 @@ ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd,
237 u_long start; 237 u_long start;
238 u_long base_page; 238 u_long base_page;
239 u_long base_offset; 239 u_long base_offset;
240 int error; 240 int error = 0;
241 241
242 if (aic79xx_allow_memio == 0) 242 if (aic79xx_allow_memio == 0)
243 return (ENOMEM); 243 return (ENOMEM);
@@ -245,16 +245,15 @@ ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd,
245 if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) != 0) 245 if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) != 0)
246 return (ENOMEM); 246 return (ENOMEM);
247 247
248 error = 0;
249 start = pci_resource_start(ahd->dev_softc, 1); 248 start = pci_resource_start(ahd->dev_softc, 1);
250 base_page = start & PAGE_MASK; 249 base_page = start & PAGE_MASK;
251 base_offset = start - base_page; 250 base_offset = start - base_page;
252 if (start != 0) { 251 if (start != 0) {
253 *bus_addr = start; 252 *bus_addr = start;
254 if (request_mem_region(start, 0x1000, "aic79xx") == 0) 253 if (!request_mem_region(start, 0x1000, "aic79xx"))
255 error = ENOMEM; 254 error = ENOMEM;
256 if (error == 0) { 255 if (!error) {
257 *maddr = ioremap_nocache(base_page, base_offset + 256); 256 *maddr = ioremap_nocache(base_page, base_offset + 512);
258 if (*maddr == NULL) { 257 if (*maddr == NULL) {
259 error = ENOMEM; 258 error = ENOMEM;
260 release_mem_region(start, 0x1000); 259 release_mem_region(start, 0x1000);
@@ -344,7 +343,7 @@ ahd_pci_map_int(struct ahd_softc *ahd)
344 343
345 error = request_irq(ahd->dev_softc->irq, ahd_linux_isr, 344 error = request_irq(ahd->dev_softc->irq, ahd_linux_isr,
346 SA_SHIRQ, "aic79xx", ahd); 345 SA_SHIRQ, "aic79xx", ahd);
347 if (error == 0) 346 if (!error)
348 ahd->platform_data->irq = ahd->dev_softc->irq; 347 ahd->platform_data->irq = ahd->dev_softc->irq;
349 348
350 return (-error); 349 return (-error);
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
index 196a6344b037..757242e522c2 100644
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -38,7 +38,7 @@
38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGES. 39 * POSSIBILITY OF SUCH DAMAGES.
40 * 40 *
41 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#89 $ 41 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#92 $
42 */ 42 */
43 43
44#ifdef __linux__ 44#ifdef __linux__
@@ -950,12 +950,19 @@ ahd_aic790X_setup(struct ahd_softc *ahd)
950 if ((ahd->flags & AHD_HP_BOARD) == 0) 950 if ((ahd->flags & AHD_HP_BOARD) == 0)
951 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA); 951 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA);
952 } else { 952 } else {
953 /* This is revision B and newer. */
954 extern uint32_t aic79xx_slowcrc;
953 u_int devconfig1; 955 u_int devconfig1;
954 956
955 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS 957 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS
956 | AHD_NEW_DFCNTRL_OPTS|AHD_FAST_CDB_DELIVERY; 958 | AHD_NEW_DFCNTRL_OPTS|AHD_FAST_CDB_DELIVERY
959 | AHD_BUSFREEREV_BUG;
957 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG; 960 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG;
958 961
962 /* If the user requested the the SLOWCRC bit to be set. */
963 if (aic79xx_slowcrc)
964 ahd->features |= AHD_AIC79XXB_SLOWCRC;
965
959 /* 966 /*
960 * Some issues have been resolved in the 7901B. 967 * Some issues have been resolved in the 7901B.
961 */ 968 */
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
index 8763b158856b..2068e00d2c75 100644
--- a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
@@ -2,8 +2,8 @@
2 * DO NOT EDIT - This file is automatically generated 2 * DO NOT EDIT - This file is automatically generated
3 * from the following source files: 3 * from the following source files:
4 * 4 *
5 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#119 $ 5 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $
6 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#76 $ 6 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $
7 */ 7 */
8typedef int (ahd_reg_print_t)(u_int, u_int *, u_int); 8typedef int (ahd_reg_print_t)(u_int, u_int *, u_int);
9typedef struct ahd_reg_parse_entry { 9typedef struct ahd_reg_parse_entry {
@@ -2204,6 +2204,20 @@ ahd_reg_print_t ahd_cmdsize_table_print;
2204#endif 2204#endif
2205 2205
2206#if AIC_DEBUG_REGISTERS 2206#if AIC_DEBUG_REGISTERS
2207ahd_reg_print_t ahd_mk_message_scb_print;
2208#else
2209#define ahd_mk_message_scb_print(regvalue, cur_col, wrap) \
2210 ahd_print_register(NULL, 0, "MK_MESSAGE_SCB", 0x160, regvalue, cur_col, wrap)
2211#endif
2212
2213#if AIC_DEBUG_REGISTERS
2214ahd_reg_print_t ahd_mk_message_scsiid_print;
2215#else
2216#define ahd_mk_message_scsiid_print(regvalue, cur_col, wrap) \
2217 ahd_print_register(NULL, 0, "MK_MESSAGE_SCSIID", 0x162, regvalue, cur_col, wrap)
2218#endif
2219
2220#if AIC_DEBUG_REGISTERS
2207ahd_reg_print_t ahd_scb_base_print; 2221ahd_reg_print_t ahd_scb_base_print;
2208#else 2222#else
2209#define ahd_scb_base_print(regvalue, cur_col, wrap) \ 2223#define ahd_scb_base_print(regvalue, cur_col, wrap) \
@@ -3638,6 +3652,7 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
3638#define SEQ_FLAGS2 0x14d 3652#define SEQ_FLAGS2 0x14d
3639#define SELECTOUT_QFROZEN 0x04 3653#define SELECTOUT_QFROZEN 0x04
3640#define TARGET_MSG_PENDING 0x02 3654#define TARGET_MSG_PENDING 0x02
3655#define PENDING_MK_MESSAGE 0x01
3641 3656
3642#define ALLOCFIFO_SCBPTR 0x14e 3657#define ALLOCFIFO_SCBPTR 0x14e
3643 3658
@@ -3655,6 +3670,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
3655 3670
3656#define CMDSIZE_TABLE 0x158 3671#define CMDSIZE_TABLE 0x158
3657 3672
3673#define MK_MESSAGE_SCB 0x160
3674
3675#define MK_MESSAGE_SCSIID 0x162
3676
3658#define SCB_BASE 0x180 3677#define SCB_BASE 0x180
3659 3678
3660#define SCB_RESIDUAL_DATACNT 0x180 3679#define SCB_RESIDUAL_DATACNT 0x180
@@ -3800,5 +3819,5 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
3800 3819
3801 3820
3802/* Exported Labels */ 3821/* Exported Labels */
3803#define LABEL_seq_isr 0x285 3822#define LABEL_seq_isr 0x28f
3804#define LABEL_timer_isr 0x281 3823#define LABEL_timer_isr 0x28b
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
index a4137c985376..db38a61a8cb4 100644
--- a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
@@ -2,8 +2,8 @@
2 * DO NOT EDIT - This file is automatically generated 2 * DO NOT EDIT - This file is automatically generated
3 * from the following source files: 3 * from the following source files:
4 * 4 *
5 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#118 $ 5 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $
6 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#75 $ 6 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $
7 */ 7 */
8 8
9#include "aic79xx_osm.h" 9#include "aic79xx_osm.h"
@@ -3382,6 +3382,7 @@ ahd_initiator_tag_print(u_int regvalue, u_int *cur_col, u_int wrap)
3382} 3382}
3383 3383
3384static ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = { 3384static ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = {
3385 { "PENDING_MK_MESSAGE", 0x01, 0x01 },
3385 { "TARGET_MSG_PENDING", 0x02, 0x02 }, 3386 { "TARGET_MSG_PENDING", 0x02, 0x02 },
3386 { "SELECTOUT_QFROZEN", 0x04, 0x04 } 3387 { "SELECTOUT_QFROZEN", 0x04, 0x04 }
3387}; 3388};
@@ -3389,7 +3390,7 @@ static ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = {
3389int 3390int
3390ahd_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap) 3391ahd_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap)
3391{ 3392{
3392 return (ahd_print_register(SEQ_FLAGS2_parse_table, 2, "SEQ_FLAGS2", 3393 return (ahd_print_register(SEQ_FLAGS2_parse_table, 3, "SEQ_FLAGS2",
3393 0x14d, regvalue, cur_col, wrap)); 3394 0x14d, regvalue, cur_col, wrap));
3394} 3395}
3395 3396
@@ -3450,6 +3451,20 @@ ahd_cmdsize_table_print(u_int regvalue, u_int *cur_col, u_int wrap)
3450} 3451}
3451 3452
3452int 3453int
3454ahd_mk_message_scb_print(u_int regvalue, u_int *cur_col, u_int wrap)
3455{
3456 return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCB",
3457 0x160, regvalue, cur_col, wrap));
3458}
3459
3460int
3461ahd_mk_message_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap)
3462{
3463 return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCSIID",
3464 0x162, regvalue, cur_col, wrap));
3465}
3466
3467int
3453ahd_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap) 3468ahd_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap)
3454{ 3469{
3455 return (ahd_print_register(NULL, 0, "SCB_BASE", 3470 return (ahd_print_register(NULL, 0, "SCB_BASE",
diff --git a/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped b/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped
index b1e5365be230..11bed07e90b7 100644
--- a/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped
@@ -2,17 +2,17 @@
2 * DO NOT EDIT - This file is automatically generated 2 * DO NOT EDIT - This file is automatically generated
3 * from the following source files: 3 * from the following source files:
4 * 4 *
5 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#119 $ 5 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $
6 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#76 $ 6 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $
7 */ 7 */
8static uint8_t seqprog[] = { 8static uint8_t seqprog[] = {
9 0xff, 0x02, 0x06, 0x78, 9 0xff, 0x02, 0x06, 0x78,
10 0x00, 0xea, 0x64, 0x59, 10 0x00, 0xea, 0x6e, 0x59,
11 0x01, 0xea, 0x04, 0x30, 11 0x01, 0xea, 0x04, 0x30,
12 0xff, 0x04, 0x0c, 0x78, 12 0xff, 0x04, 0x0c, 0x78,
13 0x19, 0xea, 0x64, 0x59, 13 0x19, 0xea, 0x6e, 0x59,
14 0x19, 0xea, 0x04, 0x00, 14 0x19, 0xea, 0x04, 0x00,
15 0x33, 0xea, 0x5e, 0x59, 15 0x33, 0xea, 0x68, 0x59,
16 0x33, 0xea, 0x00, 0x00, 16 0x33, 0xea, 0x00, 0x00,
17 0x60, 0x3a, 0x3a, 0x68, 17 0x60, 0x3a, 0x3a, 0x68,
18 0x04, 0x4d, 0x35, 0x78, 18 0x04, 0x4d, 0x35, 0x78,
@@ -33,15 +33,15 @@ static uint8_t seqprog[] = {
33 0xff, 0xea, 0x62, 0x02, 33 0xff, 0xea, 0x62, 0x02,
34 0x00, 0xe2, 0x3a, 0x40, 34 0x00, 0xe2, 0x3a, 0x40,
35 0xff, 0x21, 0x3b, 0x70, 35 0xff, 0x21, 0x3b, 0x70,
36 0x40, 0x4b, 0xaa, 0x69, 36 0x40, 0x4b, 0xb4, 0x69,
37 0x00, 0xe2, 0x68, 0x59, 37 0x00, 0xe2, 0x72, 0x59,
38 0x40, 0x4b, 0xaa, 0x69, 38 0x40, 0x4b, 0xb4, 0x69,
39 0x20, 0x4b, 0x96, 0x69, 39 0x20, 0x4b, 0xa0, 0x69,
40 0xfc, 0x42, 0x44, 0x78, 40 0xfc, 0x42, 0x44, 0x78,
41 0x10, 0x40, 0x44, 0x78, 41 0x10, 0x40, 0x44, 0x78,
42 0x00, 0xe2, 0xfc, 0x5d, 42 0x00, 0xe2, 0x10, 0x5e,
43 0x20, 0x4d, 0x48, 0x78, 43 0x20, 0x4d, 0x48, 0x78,
44 0x00, 0xe2, 0xfc, 0x5d, 44 0x00, 0xe2, 0x10, 0x5e,
45 0x30, 0x3f, 0xc0, 0x09, 45 0x30, 0x3f, 0xc0, 0x09,
46 0x30, 0xe0, 0x50, 0x60, 46 0x30, 0xe0, 0x50, 0x60,
47 0x7f, 0x4a, 0x94, 0x08, 47 0x7f, 0x4a, 0x94, 0x08,
@@ -51,7 +51,7 @@ static uint8_t seqprog[] = {
51 0x00, 0xe2, 0x76, 0x58, 51 0x00, 0xe2, 0x76, 0x58,
52 0x00, 0xe2, 0x86, 0x58, 52 0x00, 0xe2, 0x86, 0x58,
53 0x00, 0xe2, 0x06, 0x40, 53 0x00, 0xe2, 0x06, 0x40,
54 0x33, 0xea, 0x5e, 0x59, 54 0x33, 0xea, 0x68, 0x59,
55 0x33, 0xea, 0x00, 0x00, 55 0x33, 0xea, 0x00, 0x00,
56 0x01, 0x52, 0x84, 0x78, 56 0x01, 0x52, 0x84, 0x78,
57 0x02, 0x58, 0x50, 0x31, 57 0x02, 0x58, 0x50, 0x31,
@@ -59,26 +59,26 @@ static uint8_t seqprog[] = {
59 0xff, 0x97, 0x6f, 0x78, 59 0xff, 0x97, 0x6f, 0x78,
60 0x50, 0x4b, 0x6a, 0x68, 60 0x50, 0x4b, 0x6a, 0x68,
61 0xbf, 0x3a, 0x74, 0x08, 61 0xbf, 0x3a, 0x74, 0x08,
62 0x14, 0xea, 0x64, 0x59, 62 0x14, 0xea, 0x6e, 0x59,
63 0x14, 0xea, 0x04, 0x00, 63 0x14, 0xea, 0x04, 0x00,
64 0x08, 0x92, 0x25, 0x03, 64 0x08, 0x92, 0x25, 0x03,
65 0xff, 0x90, 0x5f, 0x68, 65 0xff, 0x90, 0x5f, 0x68,
66 0x00, 0xe2, 0x76, 0x5b, 66 0x00, 0xe2, 0x8a, 0x5b,
67 0x00, 0xe2, 0x5e, 0x40, 67 0x00, 0xe2, 0x5e, 0x40,
68 0x00, 0xea, 0x5e, 0x59, 68 0x00, 0xea, 0x68, 0x59,
69 0x01, 0xea, 0x00, 0x30, 69 0x01, 0xea, 0x00, 0x30,
70 0x80, 0xf9, 0x7e, 0x68, 70 0x80, 0xf9, 0x7e, 0x68,
71 0x00, 0xe2, 0x5c, 0x59, 71 0x00, 0xe2, 0x66, 0x59,
72 0x11, 0xea, 0x5e, 0x59, 72 0x11, 0xea, 0x68, 0x59,
73 0x11, 0xea, 0x00, 0x00, 73 0x11, 0xea, 0x00, 0x00,
74 0x80, 0xf9, 0x5c, 0x79, 74 0x80, 0xf9, 0x66, 0x79,
75 0xff, 0xea, 0xd4, 0x0d, 75 0xff, 0xea, 0xd4, 0x0d,
76 0x22, 0xea, 0x5e, 0x59, 76 0x22, 0xea, 0x68, 0x59,
77 0x22, 0xea, 0x00, 0x00, 77 0x22, 0xea, 0x00, 0x00,
78 0x10, 0x16, 0x90, 0x78, 78 0x10, 0x16, 0x90, 0x78,
79 0x10, 0x16, 0x2c, 0x00, 79 0x10, 0x16, 0x2c, 0x00,
80 0x01, 0x0b, 0xae, 0x32, 80 0x01, 0x0b, 0xae, 0x32,
81 0x18, 0xad, 0x12, 0x79, 81 0x18, 0xad, 0x1c, 0x79,
82 0x04, 0xad, 0xdc, 0x68, 82 0x04, 0xad, 0xdc, 0x68,
83 0x80, 0xad, 0x84, 0x78, 83 0x80, 0xad, 0x84, 0x78,
84 0x10, 0xad, 0xaa, 0x78, 84 0x10, 0xad, 0xaa, 0x78,
@@ -118,7 +118,6 @@ static uint8_t seqprog[] = {
118 0x80, 0x18, 0x30, 0x04, 118 0x80, 0x18, 0x30, 0x04,
119 0x40, 0xad, 0x84, 0x78, 119 0x40, 0xad, 0x84, 0x78,
120 0xe7, 0xad, 0x5a, 0x09, 120 0xe7, 0xad, 0x5a, 0x09,
121 0x02, 0xa8, 0x40, 0x31,
122 0xff, 0xea, 0xc0, 0x09, 121 0xff, 0xea, 0xc0, 0x09,
123 0x01, 0x54, 0xa9, 0x1a, 122 0x01, 0x54, 0xa9, 0x1a,
124 0x00, 0x55, 0xab, 0x22, 123 0x00, 0x55, 0xab, 0x22,
@@ -128,24 +127,30 @@ static uint8_t seqprog[] = {
128 0xff, 0xea, 0x5a, 0x03, 127 0xff, 0xea, 0x5a, 0x03,
129 0xff, 0xea, 0x5e, 0x03, 128 0xff, 0xea, 0x5e, 0x03,
130 0x01, 0x10, 0xd4, 0x31, 129 0x01, 0x10, 0xd4, 0x31,
131 0x10, 0x92, 0x07, 0x69, 130 0x02, 0xa8, 0x40, 0x31,
131 0x01, 0x92, 0xc1, 0x31,
132 0x3d, 0x93, 0xc5, 0x29, 132 0x3d, 0x93, 0xc5, 0x29,
133 0xfe, 0xe2, 0xc4, 0x09, 133 0xfe, 0xe2, 0xc4, 0x09,
134 0x01, 0xea, 0xc6, 0x01, 134 0x01, 0xea, 0xc6, 0x01,
135 0x02, 0xe2, 0xc8, 0x31, 135 0x02, 0xe2, 0xc8, 0x31,
136 0x02, 0xec, 0x50, 0x31, 136 0x02, 0xec, 0x50, 0x31,
137 0x02, 0xa0, 0xda, 0x31, 137 0x02, 0xa0, 0xda, 0x31,
138 0xff, 0xa9, 0x06, 0x71, 138 0xff, 0xa9, 0x10, 0x71,
139 0x10, 0xe0, 0x0e, 0x79,
140 0x10, 0x92, 0x0f, 0x79,
141 0x01, 0x4d, 0x9b, 0x02,
142 0x02, 0xa0, 0xc0, 0x32,
143 0x01, 0x93, 0xc5, 0x36,
139 0x02, 0xa0, 0x58, 0x37, 144 0x02, 0xa0, 0x58, 0x37,
140 0xff, 0x21, 0x0f, 0x71, 145 0xff, 0x21, 0x19, 0x71,
141 0x02, 0x22, 0x51, 0x31, 146 0x02, 0x22, 0x51, 0x31,
142 0x02, 0xa0, 0x5c, 0x33, 147 0x02, 0xa0, 0x5c, 0x33,
143 0x02, 0xa0, 0x44, 0x36, 148 0x02, 0xa0, 0x44, 0x36,
144 0x02, 0xa0, 0x40, 0x32, 149 0x02, 0xa0, 0x40, 0x32,
145 0x02, 0xa0, 0x44, 0x36, 150 0x02, 0xa0, 0x44, 0x36,
146 0x04, 0x4d, 0x17, 0x69, 151 0x05, 0x4d, 0x21, 0x69,
147 0x40, 0x16, 0x48, 0x69, 152 0x40, 0x16, 0x52, 0x69,
148 0xff, 0x2d, 0x4d, 0x61, 153 0xff, 0x2d, 0x57, 0x61,
149 0xff, 0x29, 0x85, 0x70, 154 0xff, 0x29, 0x85, 0x70,
150 0x02, 0x28, 0x55, 0x32, 155 0x02, 0x28, 0x55, 0x32,
151 0x01, 0xea, 0x5a, 0x01, 156 0x01, 0xea, 0x5a, 0x01,
@@ -159,22 +164,22 @@ static uint8_t seqprog[] = {
159 0x01, 0x56, 0xad, 0x1a, 164 0x01, 0x56, 0xad, 0x1a,
160 0xff, 0x54, 0xa9, 0x1a, 165 0xff, 0x54, 0xa9, 0x1a,
161 0xff, 0x55, 0xab, 0x22, 166 0xff, 0x55, 0xab, 0x22,
162 0xff, 0x8d, 0x41, 0x71, 167 0xff, 0x8d, 0x4b, 0x71,
163 0x80, 0xac, 0x40, 0x71, 168 0x80, 0xac, 0x4a, 0x71,
164 0x20, 0x16, 0x40, 0x69, 169 0x20, 0x16, 0x4a, 0x69,
165 0x00, 0xac, 0xc4, 0x19, 170 0x00, 0xac, 0xc4, 0x19,
166 0x07, 0xe2, 0x40, 0xf9, 171 0x07, 0xe2, 0x4a, 0xf9,
167 0x02, 0x8c, 0x51, 0x31, 172 0x02, 0x8c, 0x51, 0x31,
168 0x00, 0xe2, 0x24, 0x41, 173 0x00, 0xe2, 0x2e, 0x41,
169 0x01, 0xac, 0x08, 0x31, 174 0x01, 0xac, 0x08, 0x31,
170 0x09, 0xea, 0x5a, 0x01, 175 0x09, 0xea, 0x5a, 0x01,
171 0x02, 0x8c, 0x51, 0x32, 176 0x02, 0x8c, 0x51, 0x32,
172 0xff, 0xea, 0x1a, 0x07, 177 0xff, 0xea, 0x1a, 0x07,
173 0x04, 0x24, 0xf9, 0x30, 178 0x04, 0x24, 0xf9, 0x30,
174 0x1d, 0xea, 0x52, 0x41, 179 0x1d, 0xea, 0x5c, 0x41,
175 0x02, 0x2c, 0x51, 0x31, 180 0x02, 0x2c, 0x51, 0x31,
176 0x04, 0xa8, 0xf9, 0x30, 181 0x04, 0xa8, 0xf9, 0x30,
177 0x19, 0xea, 0x52, 0x41, 182 0x19, 0xea, 0x5c, 0x41,
178 0x06, 0xea, 0x08, 0x81, 183 0x06, 0xea, 0x08, 0x81,
179 0x01, 0xe2, 0x5a, 0x35, 184 0x01, 0xe2, 0x5a, 0x35,
180 0x02, 0xf2, 0xf0, 0x31, 185 0x02, 0xf2, 0xf0, 0x31,
@@ -190,27 +195,27 @@ static uint8_t seqprog[] = {
190 0x02, 0x20, 0xb9, 0x30, 195 0x02, 0x20, 0xb9, 0x30,
191 0x02, 0x20, 0x51, 0x31, 196 0x02, 0x20, 0x51, 0x31,
192 0x4c, 0x93, 0xd7, 0x28, 197 0x4c, 0x93, 0xd7, 0x28,
193 0x10, 0x92, 0x77, 0x79, 198 0x10, 0x92, 0x81, 0x79,
194 0x01, 0x6b, 0xc0, 0x30, 199 0x01, 0x6b, 0xc0, 0x30,
195 0x02, 0x64, 0xc8, 0x00, 200 0x02, 0x64, 0xc8, 0x00,
196 0x40, 0x3a, 0x74, 0x04, 201 0x40, 0x3a, 0x74, 0x04,
197 0x00, 0xe2, 0x76, 0x58, 202 0x00, 0xe2, 0x76, 0x58,
198 0x33, 0xea, 0x5e, 0x59, 203 0x33, 0xea, 0x68, 0x59,
199 0x33, 0xea, 0x00, 0x00, 204 0x33, 0xea, 0x00, 0x00,
200 0x30, 0x3f, 0xc0, 0x09, 205 0x30, 0x3f, 0xc0, 0x09,
201 0x30, 0xe0, 0x78, 0x61, 206 0x30, 0xe0, 0x82, 0x61,
202 0x20, 0x3f, 0x8e, 0x69, 207 0x20, 0x3f, 0x98, 0x69,
203 0x10, 0x3f, 0x78, 0x79, 208 0x10, 0x3f, 0x82, 0x79,
204 0x02, 0xea, 0x7e, 0x00, 209 0x02, 0xea, 0x7e, 0x00,
205 0x00, 0xea, 0x5e, 0x59, 210 0x00, 0xea, 0x68, 0x59,
206 0x01, 0xea, 0x00, 0x30, 211 0x01, 0xea, 0x00, 0x30,
207 0x02, 0x4e, 0x51, 0x35, 212 0x02, 0x4e, 0x51, 0x35,
208 0x01, 0xea, 0x7e, 0x00, 213 0x01, 0xea, 0x7e, 0x00,
209 0x11, 0xea, 0x5e, 0x59, 214 0x11, 0xea, 0x68, 0x59,
210 0x11, 0xea, 0x00, 0x00, 215 0x11, 0xea, 0x00, 0x00,
211 0x02, 0x4e, 0x51, 0x35, 216 0x02, 0x4e, 0x51, 0x35,
212 0xc0, 0x4a, 0x94, 0x00, 217 0xc0, 0x4a, 0x94, 0x00,
213 0x04, 0x41, 0x9c, 0x79, 218 0x04, 0x41, 0xa6, 0x79,
214 0x08, 0xea, 0x98, 0x00, 219 0x08, 0xea, 0x98, 0x00,
215 0x08, 0x57, 0xae, 0x00, 220 0x08, 0x57, 0xae, 0x00,
216 0x08, 0x3c, 0x78, 0x00, 221 0x08, 0x3c, 0x78, 0x00,
@@ -218,12 +223,12 @@ static uint8_t seqprog[] = {
218 0x0f, 0x67, 0xc0, 0x09, 223 0x0f, 0x67, 0xc0, 0x09,
219 0x00, 0x3a, 0x75, 0x02, 224 0x00, 0x3a, 0x75, 0x02,
220 0x20, 0xea, 0x96, 0x00, 225 0x20, 0xea, 0x96, 0x00,
221 0x00, 0xe2, 0x14, 0x42, 226 0x00, 0xe2, 0x28, 0x42,
222 0xc0, 0x4a, 0x94, 0x00, 227 0xc0, 0x4a, 0x94, 0x00,
223 0x40, 0x3a, 0xc8, 0x69, 228 0x40, 0x3a, 0xd2, 0x69,
224 0x02, 0x55, 0x06, 0x68, 229 0x02, 0x55, 0x06, 0x68,
225 0x02, 0x56, 0xc8, 0x69, 230 0x02, 0x56, 0xd2, 0x69,
226 0xff, 0x5b, 0xc8, 0x61, 231 0xff, 0x5b, 0xd2, 0x61,
227 0x02, 0x20, 0x51, 0x31, 232 0x02, 0x20, 0x51, 0x31,
228 0x80, 0xea, 0xb2, 0x01, 233 0x80, 0xea, 0xb2, 0x01,
229 0x44, 0xea, 0x00, 0x00, 234 0x44, 0xea, 0x00, 0x00,
@@ -231,40 +236,45 @@ static uint8_t seqprog[] = {
231 0x33, 0xea, 0x00, 0x00, 236 0x33, 0xea, 0x00, 0x00,
232 0xff, 0xea, 0xb2, 0x09, 237 0xff, 0xea, 0xb2, 0x09,
233 0xff, 0xe0, 0xc0, 0x19, 238 0xff, 0xe0, 0xc0, 0x19,
234 0xff, 0xe0, 0xca, 0x79, 239 0xff, 0xe0, 0xd4, 0x79,
235 0x02, 0xac, 0x51, 0x31, 240 0x02, 0xac, 0x51, 0x31,
236 0x00, 0xe2, 0xc0, 0x41, 241 0x00, 0xe2, 0xca, 0x41,
237 0x02, 0x5e, 0x50, 0x31, 242 0x02, 0x5e, 0x50, 0x31,
238 0x02, 0xa8, 0xb8, 0x30, 243 0x02, 0xa8, 0xb8, 0x30,
239 0x02, 0x5c, 0x50, 0x31, 244 0x02, 0x5c, 0x50, 0x31,
240 0xff, 0xad, 0xdb, 0x71, 245 0xff, 0xad, 0xe5, 0x71,
241 0x02, 0xac, 0x41, 0x31, 246 0x02, 0xac, 0x41, 0x31,
242 0x02, 0x22, 0x51, 0x31, 247 0x02, 0x22, 0x51, 0x31,
243 0x02, 0xa0, 0x5c, 0x33, 248 0x02, 0xa0, 0x5c, 0x33,
244 0x02, 0xa0, 0x44, 0x32, 249 0x02, 0xa0, 0x44, 0x32,
245 0x00, 0xe2, 0xe4, 0x41, 250 0x00, 0xe2, 0xf8, 0x41,
246 0x10, 0x92, 0xe5, 0x69, 251 0x01, 0x4d, 0xf1, 0x79,
252 0x01, 0x62, 0xc1, 0x31,
253 0x00, 0x93, 0xf1, 0x61,
254 0xfe, 0x4d, 0x9b, 0x0a,
255 0x02, 0x60, 0x41, 0x31,
256 0x00, 0xe2, 0xdc, 0x41,
247 0x3d, 0x93, 0xc9, 0x29, 257 0x3d, 0x93, 0xc9, 0x29,
248 0x01, 0xe4, 0xc8, 0x01, 258 0x01, 0xe4, 0xc8, 0x01,
249 0x01, 0xea, 0xca, 0x01, 259 0x01, 0xea, 0xca, 0x01,
250 0xff, 0xea, 0xda, 0x01, 260 0xff, 0xea, 0xda, 0x01,
251 0x02, 0x20, 0x51, 0x31, 261 0x02, 0x20, 0x51, 0x31,
252 0x02, 0xae, 0x41, 0x32, 262 0x02, 0xae, 0x41, 0x32,
253 0xff, 0x21, 0xed, 0x61, 263 0xff, 0x21, 0x01, 0x62,
254 0xff, 0xea, 0x46, 0x02, 264 0xff, 0xea, 0x46, 0x02,
255 0x02, 0x5c, 0x50, 0x31, 265 0x02, 0x5c, 0x50, 0x31,
256 0x40, 0xea, 0x96, 0x00, 266 0x40, 0xea, 0x96, 0x00,
257 0x02, 0x56, 0x04, 0x6e, 267 0x02, 0x56, 0x20, 0x6e,
258 0x01, 0x55, 0x04, 0x6e, 268 0x01, 0x55, 0x20, 0x6e,
259 0x10, 0x92, 0xf9, 0x79, 269 0x10, 0x92, 0x0d, 0x7a,
260 0x10, 0x40, 0x02, 0x6a, 270 0x10, 0x40, 0x16, 0x6a,
261 0x01, 0x56, 0x02, 0x7a, 271 0x01, 0x56, 0x16, 0x7a,
262 0xff, 0x97, 0x07, 0x78, 272 0xff, 0x97, 0x07, 0x78,
263 0x13, 0xea, 0x64, 0x59, 273 0x13, 0xea, 0x6e, 0x59,
264 0x13, 0xea, 0x04, 0x00, 274 0x13, 0xea, 0x04, 0x00,
265 0x00, 0xe2, 0x06, 0x40, 275 0x00, 0xe2, 0x06, 0x40,
266 0xbf, 0x3a, 0x74, 0x08, 276 0xbf, 0x3a, 0x74, 0x08,
267 0x04, 0x41, 0x08, 0x7a, 277 0x04, 0x41, 0x1c, 0x7a,
268 0x08, 0xea, 0x98, 0x00, 278 0x08, 0xea, 0x98, 0x00,
269 0x08, 0x57, 0xae, 0x00, 279 0x08, 0x57, 0xae, 0x00,
270 0x01, 0x93, 0x75, 0x32, 280 0x01, 0x93, 0x75, 0x32,
@@ -272,108 +282,108 @@ static uint8_t seqprog[] = {
272 0x40, 0xea, 0x72, 0x02, 282 0x40, 0xea, 0x72, 0x02,
273 0x08, 0x3c, 0x78, 0x00, 283 0x08, 0x3c, 0x78, 0x00,
274 0x80, 0xea, 0x6e, 0x02, 284 0x80, 0xea, 0x6e, 0x02,
275 0x00, 0xe2, 0xe2, 0x5b, 285 0x00, 0xe2, 0xf6, 0x5b,
276 0x01, 0x3c, 0xc1, 0x31, 286 0x01, 0x3c, 0xc1, 0x31,
277 0x9f, 0xe0, 0x84, 0x7c, 287 0x9f, 0xe0, 0x98, 0x7c,
278 0x80, 0xe0, 0x28, 0x72, 288 0x80, 0xe0, 0x3c, 0x72,
279 0xa0, 0xe0, 0x64, 0x72, 289 0xa0, 0xe0, 0x78, 0x72,
280 0xc0, 0xe0, 0x5a, 0x72, 290 0xc0, 0xe0, 0x6e, 0x72,
281 0xe0, 0xe0, 0x94, 0x72, 291 0xe0, 0xe0, 0xa8, 0x72,
282 0x01, 0xea, 0x64, 0x59, 292 0x01, 0xea, 0x6e, 0x59,
283 0x01, 0xea, 0x04, 0x00, 293 0x01, 0xea, 0x04, 0x00,
284 0x00, 0xe2, 0x14, 0x42, 294 0x00, 0xe2, 0x28, 0x42,
285 0x80, 0x39, 0x2f, 0x7a, 295 0x80, 0x39, 0x43, 0x7a,
286 0x03, 0xea, 0x64, 0x59, 296 0x03, 0xea, 0x6e, 0x59,
287 0x03, 0xea, 0x04, 0x00, 297 0x03, 0xea, 0x04, 0x00,
288 0xee, 0x00, 0x36, 0x6a, 298 0xee, 0x00, 0x4a, 0x6a,
289 0x05, 0xea, 0xb4, 0x00, 299 0x05, 0xea, 0xb4, 0x00,
290 0x33, 0xea, 0x5e, 0x59, 300 0x33, 0xea, 0x68, 0x59,
291 0x33, 0xea, 0x00, 0x00, 301 0x33, 0xea, 0x00, 0x00,
292 0x02, 0xa8, 0x9c, 0x32, 302 0x02, 0xa8, 0x9c, 0x32,
293 0x00, 0xe2, 0x7e, 0x59, 303 0x00, 0xe2, 0x88, 0x59,
294 0xef, 0x96, 0xd5, 0x19, 304 0xef, 0x96, 0xd5, 0x19,
295 0x00, 0xe2, 0x46, 0x52, 305 0x00, 0xe2, 0x5a, 0x52,
296 0x09, 0x80, 0xe1, 0x30, 306 0x09, 0x80, 0xe1, 0x30,
297 0x02, 0xea, 0x36, 0x00, 307 0x02, 0xea, 0x36, 0x00,
298 0xa8, 0xea, 0x32, 0x00, 308 0xa8, 0xea, 0x32, 0x00,
299 0x00, 0xe2, 0x4c, 0x42, 309 0x00, 0xe2, 0x60, 0x42,
300 0x01, 0x96, 0xd1, 0x30, 310 0x01, 0x96, 0xd1, 0x30,
301 0x10, 0x80, 0x89, 0x31, 311 0x10, 0x80, 0x89, 0x31,
302 0x20, 0xea, 0x32, 0x00, 312 0x20, 0xea, 0x32, 0x00,
303 0xbf, 0x39, 0x73, 0x0a, 313 0xbf, 0x39, 0x73, 0x0a,
304 0x10, 0x4c, 0x56, 0x6a, 314 0x10, 0x4c, 0x6a, 0x6a,
305 0x20, 0x19, 0x4e, 0x6a, 315 0x20, 0x19, 0x62, 0x6a,
306 0x20, 0x19, 0x52, 0x6a, 316 0x20, 0x19, 0x66, 0x6a,
307 0x02, 0x4d, 0x14, 0x6a, 317 0x02, 0x4d, 0x28, 0x6a,
308 0x40, 0x39, 0x73, 0x02, 318 0x40, 0x39, 0x73, 0x02,
309 0x00, 0xe2, 0x14, 0x42, 319 0x00, 0xe2, 0x28, 0x42,
310 0x80, 0x39, 0xd5, 0x6a, 320 0x80, 0x39, 0xe9, 0x6a,
311 0x01, 0x44, 0x10, 0x33, 321 0x01, 0x44, 0x10, 0x33,
312 0x08, 0x92, 0x25, 0x03, 322 0x08, 0x92, 0x25, 0x03,
313 0x00, 0xe2, 0x14, 0x42, 323 0x00, 0xe2, 0x28, 0x42,
314 0x10, 0xea, 0x80, 0x00, 324 0x10, 0xea, 0x80, 0x00,
315 0x01, 0x37, 0xc5, 0x31, 325 0x01, 0x37, 0xc5, 0x31,
316 0x80, 0xe2, 0x80, 0x62, 326 0x80, 0xe2, 0x94, 0x62,
317 0x10, 0x92, 0xa5, 0x6a, 327 0x10, 0x92, 0xb9, 0x6a,
318 0xc0, 0x94, 0xc5, 0x01, 328 0xc0, 0x94, 0xc5, 0x01,
319 0x40, 0x92, 0x71, 0x6a, 329 0x40, 0x92, 0x85, 0x6a,
320 0xbf, 0xe2, 0xc4, 0x09, 330 0xbf, 0xe2, 0xc4, 0x09,
321 0x20, 0x92, 0x85, 0x7a, 331 0x20, 0x92, 0x99, 0x7a,
322 0x01, 0xe2, 0x88, 0x30, 332 0x01, 0xe2, 0x88, 0x30,
323 0x00, 0xe2, 0xe2, 0x5b, 333 0x00, 0xe2, 0xf6, 0x5b,
324 0xa0, 0x3c, 0x8d, 0x62, 334 0xa0, 0x3c, 0xa1, 0x62,
325 0x23, 0x92, 0x89, 0x08, 335 0x23, 0x92, 0x89, 0x08,
326 0x00, 0xe2, 0xe2, 0x5b, 336 0x00, 0xe2, 0xf6, 0x5b,
327 0xa0, 0x3c, 0x8d, 0x62, 337 0xa0, 0x3c, 0xa1, 0x62,
328 0x00, 0xa8, 0x84, 0x42, 338 0x00, 0xa8, 0x98, 0x42,
329 0xff, 0xe2, 0x84, 0x62, 339 0xff, 0xe2, 0x98, 0x62,
330 0x00, 0xe2, 0xa4, 0x42, 340 0x00, 0xe2, 0xb8, 0x42,
331 0x40, 0xea, 0x98, 0x00, 341 0x40, 0xea, 0x98, 0x00,
332 0x01, 0xe2, 0x88, 0x30, 342 0x01, 0xe2, 0x88, 0x30,
333 0x00, 0xe2, 0xe2, 0x5b, 343 0x00, 0xe2, 0xf6, 0x5b,
334 0xa0, 0x3c, 0x63, 0x72, 344 0xa0, 0x3c, 0x77, 0x72,
335 0x40, 0xea, 0x98, 0x00, 345 0x40, 0xea, 0x98, 0x00,
336 0x01, 0x37, 0x95, 0x32, 346 0x01, 0x37, 0x95, 0x32,
337 0x08, 0xea, 0x6e, 0x02, 347 0x08, 0xea, 0x6e, 0x02,
338 0x00, 0xe2, 0x14, 0x42, 348 0x00, 0xe2, 0x28, 0x42,
339 0xe0, 0xea, 0xfe, 0x5b, 349 0xe0, 0xea, 0x12, 0x5c,
340 0x80, 0xe0, 0xe0, 0x6a, 350 0x80, 0xe0, 0xf4, 0x6a,
341 0x04, 0xe0, 0x92, 0x73, 351 0x04, 0xe0, 0xa6, 0x73,
342 0x02, 0xe0, 0xc4, 0x73, 352 0x02, 0xe0, 0xd8, 0x73,
343 0x00, 0xea, 0x3e, 0x73, 353 0x00, 0xea, 0x52, 0x73,
344 0x03, 0xe0, 0xd4, 0x73, 354 0x03, 0xe0, 0xe8, 0x73,
345 0x23, 0xe0, 0xb6, 0x72, 355 0x23, 0xe0, 0xca, 0x72,
346 0x08, 0xe0, 0xdc, 0x72, 356 0x08, 0xe0, 0xf0, 0x72,
347 0x00, 0xe2, 0xe2, 0x5b, 357 0x00, 0xe2, 0xf6, 0x5b,
348 0x07, 0xea, 0x64, 0x59, 358 0x07, 0xea, 0x6e, 0x59,
349 0x07, 0xea, 0x04, 0x00, 359 0x07, 0xea, 0x04, 0x00,
350 0x08, 0x48, 0x15, 0x72, 360 0x08, 0x48, 0x29, 0x72,
351 0x04, 0x48, 0xb3, 0x62, 361 0x04, 0x48, 0xc7, 0x62,
352 0x01, 0x49, 0x89, 0x30, 362 0x01, 0x49, 0x89, 0x30,
353 0x00, 0xe2, 0xa4, 0x42, 363 0x00, 0xe2, 0xb8, 0x42,
354 0x01, 0x44, 0xd4, 0x31, 364 0x01, 0x44, 0xd4, 0x31,
355 0x00, 0xe2, 0xa4, 0x42, 365 0x00, 0xe2, 0xb8, 0x42,
356 0x01, 0x00, 0x6c, 0x32, 366 0x01, 0x00, 0x6c, 0x32,
357 0x33, 0xea, 0x5e, 0x59, 367 0x33, 0xea, 0x68, 0x59,
358 0x33, 0xea, 0x00, 0x00, 368 0x33, 0xea, 0x00, 0x00,
359 0x4c, 0x3a, 0xc1, 0x28, 369 0x4c, 0x3a, 0xc1, 0x28,
360 0x01, 0x64, 0xc0, 0x31, 370 0x01, 0x64, 0xc0, 0x31,
361 0x00, 0x36, 0x5f, 0x59, 371 0x00, 0x36, 0x69, 0x59,
362 0x01, 0x36, 0x01, 0x30, 372 0x01, 0x36, 0x01, 0x30,
363 0x01, 0xe0, 0xda, 0x7a, 373 0x01, 0xe0, 0xee, 0x7a,
364 0xa0, 0xea, 0xf4, 0x5b, 374 0xa0, 0xea, 0x08, 0x5c,
365 0x01, 0xa0, 0xda, 0x62, 375 0x01, 0xa0, 0xee, 0x62,
366 0x01, 0x84, 0xcf, 0x7a, 376 0x01, 0x84, 0xe3, 0x7a,
367 0x01, 0x95, 0xdd, 0x6a, 377 0x01, 0x95, 0xf1, 0x6a,
368 0x05, 0xea, 0x64, 0x59, 378 0x05, 0xea, 0x6e, 0x59,
369 0x05, 0xea, 0x04, 0x00, 379 0x05, 0xea, 0x04, 0x00,
370 0x00, 0xe2, 0xdc, 0x42, 380 0x00, 0xe2, 0xf0, 0x42,
371 0x03, 0xea, 0x64, 0x59, 381 0x03, 0xea, 0x6e, 0x59,
372 0x03, 0xea, 0x04, 0x00, 382 0x03, 0xea, 0x04, 0x00,
373 0x00, 0xe2, 0xdc, 0x42, 383 0x00, 0xe2, 0xf0, 0x42,
374 0x07, 0xea, 0x06, 0x5c, 384 0x07, 0xea, 0x1a, 0x5c,
375 0x01, 0x44, 0xd4, 0x31, 385 0x01, 0x44, 0xd4, 0x31,
376 0x00, 0xe2, 0x14, 0x42, 386 0x00, 0xe2, 0x28, 0x42,
377 0x3f, 0xe0, 0x76, 0x0a, 387 0x3f, 0xe0, 0x76, 0x0a,
378 0xc0, 0x3a, 0xc1, 0x09, 388 0xc0, 0x3a, 0xc1, 0x09,
379 0x00, 0x3b, 0x51, 0x01, 389 0x00, 0x3b, 0x51, 0x01,
@@ -384,54 +394,54 @@ static uint8_t seqprog[] = {
384 0x01, 0xea, 0xc6, 0x01, 394 0x01, 0xea, 0xc6, 0x01,
385 0x02, 0xe2, 0xc8, 0x31, 395 0x02, 0xe2, 0xc8, 0x31,
386 0x02, 0xec, 0x40, 0x31, 396 0x02, 0xec, 0x40, 0x31,
387 0xff, 0xa1, 0xfc, 0x72, 397 0xff, 0xa1, 0x10, 0x73,
388 0x02, 0xe8, 0xda, 0x31, 398 0x02, 0xe8, 0xda, 0x31,
389 0x02, 0xa0, 0x50, 0x31, 399 0x02, 0xa0, 0x50, 0x31,
390 0x00, 0xe2, 0x1e, 0x43, 400 0x00, 0xe2, 0x32, 0x43,
391 0x80, 0x39, 0x73, 0x02, 401 0x80, 0x39, 0x73, 0x02,
392 0x01, 0x44, 0xd4, 0x31, 402 0x01, 0x44, 0xd4, 0x31,
393 0x00, 0xe2, 0xe2, 0x5b, 403 0x00, 0xe2, 0xf6, 0x5b,
394 0x01, 0x39, 0x73, 0x02, 404 0x01, 0x39, 0x73, 0x02,
395 0xe0, 0x3c, 0x39, 0x63, 405 0xe0, 0x3c, 0x4d, 0x63,
396 0x02, 0x39, 0x73, 0x02, 406 0x02, 0x39, 0x73, 0x02,
397 0x20, 0x46, 0x32, 0x63, 407 0x20, 0x46, 0x46, 0x63,
398 0xff, 0xea, 0x52, 0x09, 408 0xff, 0xea, 0x52, 0x09,
399 0xa8, 0xea, 0xf4, 0x5b, 409 0xa8, 0xea, 0x08, 0x5c,
400 0x04, 0x92, 0x19, 0x7b, 410 0x04, 0x92, 0x2d, 0x7b,
401 0x01, 0x3a, 0xc1, 0x31, 411 0x01, 0x3a, 0xc1, 0x31,
402 0x00, 0x93, 0x19, 0x63, 412 0x00, 0x93, 0x2d, 0x63,
403 0x01, 0x3b, 0xc1, 0x31, 413 0x01, 0x3b, 0xc1, 0x31,
404 0x00, 0x94, 0x23, 0x73, 414 0x00, 0x94, 0x37, 0x73,
405 0x01, 0xa9, 0x52, 0x11, 415 0x01, 0xa9, 0x52, 0x11,
406 0xff, 0xa9, 0x0e, 0x6b, 416 0xff, 0xa9, 0x22, 0x6b,
407 0x00, 0xe2, 0x32, 0x43, 417 0x00, 0xe2, 0x46, 0x43,
408 0x10, 0x39, 0x73, 0x02, 418 0x10, 0x39, 0x73, 0x02,
409 0x04, 0x92, 0x33, 0x7b, 419 0x04, 0x92, 0x47, 0x7b,
410 0xfb, 0x92, 0x25, 0x0b, 420 0xfb, 0x92, 0x25, 0x0b,
411 0xff, 0xea, 0x72, 0x0a, 421 0xff, 0xea, 0x72, 0x0a,
412 0x01, 0xa4, 0x2d, 0x6b, 422 0x01, 0xa4, 0x41, 0x6b,
413 0x02, 0xa8, 0x9c, 0x32, 423 0x02, 0xa8, 0x9c, 0x32,
414 0x00, 0xe2, 0x7e, 0x59, 424 0x00, 0xe2, 0x88, 0x59,
415 0x10, 0x92, 0xdd, 0x7a, 425 0x10, 0x92, 0xf1, 0x7a,
416 0xff, 0xea, 0x06, 0x5c, 426 0xff, 0xea, 0x1a, 0x5c,
417 0x00, 0xe2, 0xdc, 0x42, 427 0x00, 0xe2, 0xf0, 0x42,
418 0x04, 0xea, 0x64, 0x59, 428 0x04, 0xea, 0x6e, 0x59,
419 0x04, 0xea, 0x04, 0x00, 429 0x04, 0xea, 0x04, 0x00,
420 0x00, 0xe2, 0xdc, 0x42, 430 0x00, 0xe2, 0xf0, 0x42,
421 0x04, 0xea, 0x64, 0x59, 431 0x04, 0xea, 0x6e, 0x59,
422 0x04, 0xea, 0x04, 0x00, 432 0x04, 0xea, 0x04, 0x00,
423 0x00, 0xe2, 0x14, 0x42, 433 0x00, 0xe2, 0x28, 0x42,
424 0x08, 0x92, 0xd5, 0x7a, 434 0x08, 0x92, 0xe9, 0x7a,
425 0xc0, 0x39, 0x49, 0x7b, 435 0xc0, 0x39, 0x5d, 0x7b,
426 0x80, 0x39, 0xd5, 0x6a, 436 0x80, 0x39, 0xe9, 0x6a,
427 0xff, 0x88, 0x49, 0x6b, 437 0xff, 0x88, 0x5d, 0x6b,
428 0x40, 0x39, 0xd5, 0x6a, 438 0x40, 0x39, 0xe9, 0x6a,
429 0x10, 0x92, 0x4f, 0x7b, 439 0x10, 0x92, 0x63, 0x7b,
430 0x0a, 0xea, 0x64, 0x59, 440 0x0a, 0xea, 0x6e, 0x59,
431 0x0a, 0xea, 0x04, 0x00, 441 0x0a, 0xea, 0x04, 0x00,
432 0x00, 0xe2, 0x6e, 0x5b, 442 0x00, 0xe2, 0x82, 0x5b,
433 0x00, 0xe2, 0xae, 0x43, 443 0x00, 0xe2, 0xc2, 0x43,
434 0x50, 0x4b, 0x56, 0x6b, 444 0x50, 0x4b, 0x6a, 0x6b,
435 0xbf, 0x3a, 0x74, 0x08, 445 0xbf, 0x3a, 0x74, 0x08,
436 0x01, 0xe0, 0xf4, 0x31, 446 0x01, 0xe0, 0xf4, 0x31,
437 0xff, 0xea, 0xc0, 0x09, 447 0xff, 0xea, 0xc0, 0x09,
@@ -441,31 +451,31 @@ static uint8_t seqprog[] = {
441 0x01, 0xfa, 0xc0, 0x35, 451 0x01, 0xfa, 0xc0, 0x35,
442 0x02, 0xa8, 0x90, 0x32, 452 0x02, 0xa8, 0x90, 0x32,
443 0x02, 0xea, 0xb4, 0x00, 453 0x02, 0xea, 0xb4, 0x00,
444 0x33, 0xea, 0x5e, 0x59, 454 0x33, 0xea, 0x68, 0x59,
445 0x33, 0xea, 0x00, 0x00, 455 0x33, 0xea, 0x00, 0x00,
446 0x02, 0x48, 0x51, 0x31, 456 0x02, 0x48, 0x51, 0x31,
447 0xff, 0x90, 0x85, 0x68, 457 0xff, 0x90, 0x85, 0x68,
448 0xff, 0x88, 0x7b, 0x6b, 458 0xff, 0x88, 0x8f, 0x6b,
449 0x01, 0xa4, 0x77, 0x6b, 459 0x01, 0xa4, 0x8b, 0x6b,
450 0x02, 0xa4, 0x7f, 0x6b, 460 0x02, 0xa4, 0x93, 0x6b,
451 0x01, 0x84, 0x7f, 0x7b, 461 0x01, 0x84, 0x93, 0x7b,
452 0x02, 0x28, 0x19, 0x33, 462 0x02, 0x28, 0x19, 0x33,
453 0x02, 0xa8, 0x50, 0x36, 463 0x02, 0xa8, 0x50, 0x36,
454 0xff, 0x88, 0x7f, 0x73, 464 0xff, 0x88, 0x93, 0x73,
455 0x00, 0xe2, 0x52, 0x5b, 465 0x00, 0xe2, 0x66, 0x5b,
456 0x02, 0xa8, 0x20, 0x33, 466 0x02, 0xa8, 0x20, 0x33,
457 0x04, 0xa4, 0x49, 0x03, 467 0x04, 0xa4, 0x49, 0x03,
458 0xff, 0xea, 0x1a, 0x03, 468 0xff, 0xea, 0x1a, 0x03,
459 0xff, 0x2d, 0x8b, 0x63, 469 0xff, 0x2d, 0x9f, 0x63,
460 0x02, 0xa8, 0x58, 0x32, 470 0x02, 0xa8, 0x58, 0x32,
461 0x02, 0xa8, 0x5c, 0x36, 471 0x02, 0xa8, 0x5c, 0x36,
462 0x02, 0xa8, 0x40, 0x31, 472 0x02, 0xa8, 0x40, 0x31,
463 0x02, 0x2e, 0x51, 0x31, 473 0x02, 0x2e, 0x51, 0x31,
464 0x02, 0xa0, 0x18, 0x33, 474 0x02, 0xa0, 0x18, 0x33,
465 0x02, 0xa0, 0x5c, 0x36, 475 0x02, 0xa0, 0x5c, 0x36,
466 0xc0, 0x39, 0xd5, 0x6a, 476 0xc0, 0x39, 0xe9, 0x6a,
467 0x04, 0x92, 0x25, 0x03, 477 0x04, 0x92, 0x25, 0x03,
468 0x20, 0x92, 0xaf, 0x6b, 478 0x20, 0x92, 0xc3, 0x6b,
469 0x02, 0xa8, 0x40, 0x31, 479 0x02, 0xa8, 0x40, 0x31,
470 0xc0, 0x3a, 0xc1, 0x09, 480 0xc0, 0x3a, 0xc1, 0x09,
471 0x00, 0x3b, 0x51, 0x01, 481 0x00, 0x3b, 0x51, 0x01,
@@ -480,60 +490,60 @@ static uint8_t seqprog[] = {
480 0xf7, 0x57, 0xae, 0x08, 490 0xf7, 0x57, 0xae, 0x08,
481 0x08, 0xea, 0x98, 0x00, 491 0x08, 0xea, 0x98, 0x00,
482 0x01, 0x44, 0xd4, 0x31, 492 0x01, 0x44, 0xd4, 0x31,
483 0xee, 0x00, 0xb8, 0x6b, 493 0xee, 0x00, 0xcc, 0x6b,
484 0x02, 0xea, 0xb4, 0x00, 494 0x02, 0xea, 0xb4, 0x00,
485 0xc0, 0xea, 0x72, 0x02, 495 0xc0, 0xea, 0x72, 0x02,
486 0x09, 0x4c, 0xba, 0x7b, 496 0x09, 0x4c, 0xce, 0x7b,
487 0x01, 0xea, 0x78, 0x02, 497 0x01, 0xea, 0x78, 0x02,
488 0x08, 0x4c, 0x06, 0x68, 498 0x08, 0x4c, 0x06, 0x68,
489 0x0b, 0xea, 0x64, 0x59, 499 0x0b, 0xea, 0x6e, 0x59,
490 0x0b, 0xea, 0x04, 0x00, 500 0x0b, 0xea, 0x04, 0x00,
491 0x01, 0x44, 0xd4, 0x31, 501 0x01, 0x44, 0xd4, 0x31,
492 0x20, 0x39, 0x15, 0x7a, 502 0x20, 0x39, 0x29, 0x7a,
493 0x00, 0xe2, 0xcc, 0x5b, 503 0x00, 0xe2, 0xe0, 0x5b,
494 0x00, 0xe2, 0x14, 0x42, 504 0x00, 0xe2, 0x28, 0x42,
495 0x01, 0x84, 0xd1, 0x7b, 505 0x01, 0x84, 0xe5, 0x7b,
496 0x01, 0xa4, 0x49, 0x07, 506 0x01, 0xa4, 0x49, 0x07,
497 0x08, 0x60, 0x30, 0x33, 507 0x08, 0x60, 0x30, 0x33,
498 0x08, 0x80, 0x41, 0x37, 508 0x08, 0x80, 0x41, 0x37,
499 0xdf, 0x39, 0x73, 0x0a, 509 0xdf, 0x39, 0x73, 0x0a,
500 0xee, 0x00, 0xde, 0x6b, 510 0xee, 0x00, 0xf2, 0x6b,
501 0x05, 0xea, 0xb4, 0x00, 511 0x05, 0xea, 0xb4, 0x00,
502 0x33, 0xea, 0x5e, 0x59, 512 0x33, 0xea, 0x68, 0x59,
503 0x33, 0xea, 0x00, 0x00, 513 0x33, 0xea, 0x00, 0x00,
504 0x00, 0xe2, 0x7e, 0x59, 514 0x00, 0xe2, 0x88, 0x59,
505 0x00, 0xe2, 0xdc, 0x42, 515 0x00, 0xe2, 0xf0, 0x42,
506 0xff, 0x42, 0xee, 0x6b, 516 0xff, 0x42, 0x02, 0x6c,
507 0x01, 0x41, 0xe2, 0x6b, 517 0x01, 0x41, 0xf6, 0x6b,
508 0x02, 0x41, 0xe2, 0x7b, 518 0x02, 0x41, 0xf6, 0x7b,
509 0xff, 0x42, 0xee, 0x6b, 519 0xff, 0x42, 0x02, 0x6c,
510 0x01, 0x41, 0xe2, 0x6b, 520 0x01, 0x41, 0xf6, 0x6b,
511 0x02, 0x41, 0xe2, 0x7b, 521 0x02, 0x41, 0xf6, 0x7b,
512 0xff, 0x42, 0xee, 0x7b, 522 0xff, 0x42, 0x02, 0x7c,
513 0x04, 0x4c, 0xe2, 0x6b, 523 0x04, 0x4c, 0xf6, 0x6b,
514 0xe0, 0x41, 0x78, 0x0e, 524 0xe0, 0x41, 0x78, 0x0e,
515 0x01, 0x44, 0xd4, 0x31, 525 0x01, 0x44, 0xd4, 0x31,
516 0xff, 0x42, 0xf6, 0x7b, 526 0xff, 0x42, 0x0a, 0x7c,
517 0x04, 0x4c, 0xf6, 0x6b, 527 0x04, 0x4c, 0x0a, 0x6c,
518 0xe0, 0x41, 0x78, 0x0a, 528 0xe0, 0x41, 0x78, 0x0a,
519 0xe0, 0x3c, 0x15, 0x62, 529 0xe0, 0x3c, 0x29, 0x62,
520 0xff, 0xea, 0xca, 0x09, 530 0xff, 0xea, 0xca, 0x09,
521 0x01, 0xe2, 0xc8, 0x31, 531 0x01, 0xe2, 0xc8, 0x31,
522 0x01, 0x46, 0xda, 0x35, 532 0x01, 0x46, 0xda, 0x35,
523 0x01, 0x44, 0xd4, 0x35, 533 0x01, 0x44, 0xd4, 0x35,
524 0x10, 0xea, 0x80, 0x00, 534 0x10, 0xea, 0x80, 0x00,
525 0x01, 0xe2, 0x6e, 0x36, 535 0x01, 0xe2, 0x6e, 0x36,
526 0x04, 0xa6, 0x0e, 0x7c, 536 0x04, 0xa6, 0x22, 0x7c,
527 0xff, 0xea, 0x5a, 0x09, 537 0xff, 0xea, 0x5a, 0x09,
528 0xff, 0xea, 0x4c, 0x0d, 538 0xff, 0xea, 0x4c, 0x0d,
529 0x01, 0xa6, 0x3a, 0x6c, 539 0x01, 0xa6, 0x4e, 0x6c,
530 0x10, 0xad, 0x84, 0x78, 540 0x10, 0xad, 0x84, 0x78,
531 0x80, 0xad, 0x32, 0x6c, 541 0x80, 0xad, 0x46, 0x6c,
532 0x08, 0xad, 0x84, 0x68, 542 0x08, 0xad, 0x84, 0x68,
533 0x20, 0x19, 0x26, 0x7c, 543 0x20, 0x19, 0x3a, 0x7c,
534 0x80, 0xea, 0xb2, 0x01, 544 0x80, 0xea, 0xb2, 0x01,
535 0x11, 0x00, 0x00, 0x10, 545 0x11, 0x00, 0x00, 0x10,
536 0x02, 0xa6, 0x22, 0x7c, 546 0x02, 0xa6, 0x36, 0x7c,
537 0xff, 0xea, 0xb2, 0x0d, 547 0xff, 0xea, 0xb2, 0x0d,
538 0x11, 0x00, 0x00, 0x10, 548 0x11, 0x00, 0x00, 0x10,
539 0xff, 0xea, 0xb2, 0x09, 549 0xff, 0xea, 0xb2, 0x09,
@@ -561,7 +571,7 @@ static uint8_t seqprog[] = {
561 0x00, 0x86, 0x0d, 0x23, 571 0x00, 0x86, 0x0d, 0x23,
562 0x00, 0x87, 0x0f, 0x23, 572 0x00, 0x87, 0x0f, 0x23,
563 0x01, 0x84, 0xc5, 0x31, 573 0x01, 0x84, 0xc5, 0x31,
564 0x80, 0x83, 0x5d, 0x7c, 574 0x80, 0x83, 0x71, 0x7c,
565 0x02, 0xe2, 0xc4, 0x01, 575 0x02, 0xe2, 0xc4, 0x01,
566 0xff, 0xea, 0x4c, 0x09, 576 0xff, 0xea, 0x4c, 0x09,
567 0x01, 0xe2, 0x36, 0x30, 577 0x01, 0xe2, 0x36, 0x30,
@@ -572,75 +582,75 @@ static uint8_t seqprog[] = {
572 0xfe, 0xa6, 0x4c, 0x0d, 582 0xfe, 0xa6, 0x4c, 0x0d,
573 0x0b, 0x98, 0xe1, 0x30, 583 0x0b, 0x98, 0xe1, 0x30,
574 0xfd, 0xa4, 0x49, 0x09, 584 0xfd, 0xa4, 0x49, 0x09,
575 0x80, 0xa3, 0x71, 0x7c, 585 0x80, 0xa3, 0x85, 0x7c,
576 0x02, 0xa4, 0x48, 0x01, 586 0x02, 0xa4, 0x48, 0x01,
577 0x01, 0xa4, 0x36, 0x30, 587 0x01, 0xa4, 0x36, 0x30,
578 0xa8, 0xea, 0x32, 0x00, 588 0xa8, 0xea, 0x32, 0x00,
579 0xfd, 0xa4, 0x49, 0x0b, 589 0xfd, 0xa4, 0x49, 0x0b,
580 0x05, 0xa3, 0x07, 0x33, 590 0x05, 0xa3, 0x07, 0x33,
581 0x80, 0x83, 0x7d, 0x6c, 591 0x80, 0x83, 0x91, 0x6c,
582 0x02, 0xea, 0x4c, 0x05, 592 0x02, 0xea, 0x4c, 0x05,
583 0xff, 0xea, 0x4c, 0x0d, 593 0xff, 0xea, 0x4c, 0x0d,
584 0x00, 0xe2, 0x56, 0x59, 594 0x00, 0xe2, 0x60, 0x59,
585 0x02, 0xa6, 0x10, 0x6c, 595 0x02, 0xa6, 0x24, 0x6c,
586 0x80, 0xf9, 0xf2, 0x05, 596 0x80, 0xf9, 0xf2, 0x05,
587 0xc0, 0x39, 0x8b, 0x7c, 597 0xc0, 0x39, 0x9f, 0x7c,
588 0x03, 0xea, 0x64, 0x59, 598 0x03, 0xea, 0x6e, 0x59,
589 0x03, 0xea, 0x04, 0x00, 599 0x03, 0xea, 0x04, 0x00,
590 0x20, 0x39, 0xaf, 0x7c, 600 0x20, 0x39, 0xc3, 0x7c,
591 0x01, 0x84, 0x95, 0x6c, 601 0x01, 0x84, 0xa9, 0x6c,
592 0x06, 0xea, 0x64, 0x59, 602 0x06, 0xea, 0x6e, 0x59,
593 0x06, 0xea, 0x04, 0x00, 603 0x06, 0xea, 0x04, 0x00,
594 0x00, 0xe2, 0xb2, 0x44, 604 0x00, 0xe2, 0xc6, 0x44,
595 0x01, 0x00, 0x6c, 0x32, 605 0x01, 0x00, 0x6c, 0x32,
596 0xee, 0x00, 0x9e, 0x6c, 606 0xee, 0x00, 0xb2, 0x6c,
597 0x05, 0xea, 0xb4, 0x00, 607 0x05, 0xea, 0xb4, 0x00,
598 0x33, 0xea, 0x5e, 0x59, 608 0x33, 0xea, 0x68, 0x59,
599 0x33, 0xea, 0x00, 0x00, 609 0x33, 0xea, 0x00, 0x00,
600 0x80, 0x3d, 0x7a, 0x00, 610 0x80, 0x3d, 0x7a, 0x00,
601 0xfc, 0x42, 0xa0, 0x7c, 611 0xfc, 0x42, 0xb4, 0x7c,
602 0x7f, 0x3d, 0x7a, 0x08, 612 0x7f, 0x3d, 0x7a, 0x08,
603 0x00, 0x36, 0x5f, 0x59, 613 0x00, 0x36, 0x69, 0x59,
604 0x01, 0x36, 0x01, 0x30, 614 0x01, 0x36, 0x01, 0x30,
605 0x09, 0xea, 0x64, 0x59, 615 0x09, 0xea, 0x6e, 0x59,
606 0x09, 0xea, 0x04, 0x00, 616 0x09, 0xea, 0x04, 0x00,
607 0x00, 0xe2, 0x14, 0x42, 617 0x00, 0xe2, 0x28, 0x42,
608 0x01, 0xa4, 0x95, 0x6c, 618 0x01, 0xa4, 0xa9, 0x6c,
609 0x00, 0xe2, 0x68, 0x5c, 619 0x00, 0xe2, 0x7c, 0x5c,
610 0x20, 0x39, 0x73, 0x02, 620 0x20, 0x39, 0x73, 0x02,
611 0x01, 0x00, 0x6c, 0x32, 621 0x01, 0x00, 0x6c, 0x32,
612 0x02, 0xa6, 0xba, 0x7c, 622 0x02, 0xa6, 0xce, 0x7c,
613 0x00, 0xe2, 0x7e, 0x5c, 623 0x00, 0xe2, 0x92, 0x5c,
614 0x00, 0xe2, 0x76, 0x58, 624 0x00, 0xe2, 0x76, 0x58,
615 0x00, 0xe2, 0x86, 0x58, 625 0x00, 0xe2, 0x86, 0x58,
616 0x00, 0xe2, 0x5a, 0x58, 626 0x00, 0xe2, 0x5a, 0x58,
617 0x00, 0x36, 0x5f, 0x59, 627 0x00, 0x36, 0x69, 0x59,
618 0x01, 0x36, 0x01, 0x30, 628 0x01, 0x36, 0x01, 0x30,
619 0x20, 0x19, 0xba, 0x6c, 629 0x20, 0x19, 0xce, 0x6c,
620 0x00, 0xe2, 0xea, 0x5c, 630 0x00, 0xe2, 0xfe, 0x5c,
621 0x04, 0x19, 0xd4, 0x6c, 631 0x04, 0x19, 0xe8, 0x6c,
622 0x02, 0x19, 0x32, 0x00, 632 0x02, 0x19, 0x32, 0x00,
623 0x01, 0x84, 0xd5, 0x7c, 633 0x01, 0x84, 0xe9, 0x7c,
624 0x01, 0x1b, 0xce, 0x7c, 634 0x01, 0x1b, 0xe2, 0x7c,
625 0x01, 0x1a, 0xd4, 0x6c, 635 0x01, 0x1a, 0xe8, 0x6c,
626 0x00, 0xe2, 0x84, 0x44, 636 0x00, 0xe2, 0x98, 0x44,
627 0x80, 0x4b, 0xda, 0x6c, 637 0x80, 0x4b, 0xee, 0x6c,
628 0x01, 0x4c, 0xd6, 0x7c, 638 0x01, 0x4c, 0xea, 0x7c,
629 0x03, 0x42, 0x84, 0x6c, 639 0x03, 0x42, 0x98, 0x6c,
630 0x00, 0xe2, 0x0a, 0x5c, 640 0x00, 0xe2, 0x1e, 0x5c,
631 0x80, 0xf9, 0xf2, 0x01, 641 0x80, 0xf9, 0xf2, 0x01,
632 0x04, 0x39, 0x15, 0x7a, 642 0x04, 0x39, 0x29, 0x7a,
633 0x00, 0xe2, 0x14, 0x42, 643 0x00, 0xe2, 0x28, 0x42,
634 0x08, 0x5d, 0xf2, 0x6c, 644 0x08, 0x5d, 0x06, 0x6d,
635 0x00, 0xe2, 0x76, 0x58, 645 0x00, 0xe2, 0x76, 0x58,
636 0x00, 0x36, 0x5f, 0x59, 646 0x00, 0x36, 0x69, 0x59,
637 0x01, 0x36, 0x01, 0x30, 647 0x01, 0x36, 0x01, 0x30,
638 0x02, 0x1b, 0xe2, 0x7c, 648 0x02, 0x1b, 0xf6, 0x7c,
639 0x08, 0x5d, 0xf0, 0x7c, 649 0x08, 0x5d, 0x04, 0x7d,
640 0x03, 0x68, 0x00, 0x37, 650 0x03, 0x68, 0x00, 0x37,
641 0x01, 0x84, 0x09, 0x07, 651 0x01, 0x84, 0x09, 0x07,
642 0x80, 0x1b, 0xfc, 0x7c, 652 0x80, 0x1b, 0x10, 0x7d,
643 0x80, 0x84, 0xfd, 0x6c, 653 0x80, 0x84, 0x11, 0x6d,
644 0xff, 0x85, 0x0b, 0x1b, 654 0xff, 0x85, 0x0b, 0x1b,
645 0xff, 0x86, 0x0d, 0x23, 655 0xff, 0x86, 0x0d, 0x23,
646 0xff, 0x87, 0x0f, 0x23, 656 0xff, 0x87, 0x0f, 0x23,
@@ -652,161 +662,164 @@ static uint8_t seqprog[] = {
652 0xf9, 0xd9, 0xb2, 0x0d, 662 0xf9, 0xd9, 0xb2, 0x0d,
653 0x01, 0xd9, 0xb2, 0x05, 663 0x01, 0xd9, 0xb2, 0x05,
654 0x01, 0x52, 0x48, 0x31, 664 0x01, 0x52, 0x48, 0x31,
655 0x20, 0xa4, 0x26, 0x7d, 665 0x20, 0xa4, 0x3a, 0x7d,
656 0x20, 0x5b, 0x26, 0x7d, 666 0x20, 0x5b, 0x3a, 0x7d,
657 0x80, 0xf9, 0x34, 0x7d, 667 0x80, 0xf9, 0x48, 0x7d,
658 0x02, 0xea, 0xb4, 0x00, 668 0x02, 0xea, 0xb4, 0x00,
659 0x11, 0x00, 0x00, 0x10, 669 0x11, 0x00, 0x00, 0x10,
660 0x04, 0x19, 0x40, 0x7d, 670 0x04, 0x19, 0x54, 0x7d,
661 0xdf, 0x19, 0x32, 0x08, 671 0xdf, 0x19, 0x32, 0x08,
662 0x60, 0x5b, 0x40, 0x6d, 672 0x60, 0x5b, 0x54, 0x6d,
663 0x01, 0x4c, 0x1a, 0x7d, 673 0x01, 0x4c, 0x2e, 0x7d,
664 0x20, 0x19, 0x32, 0x00, 674 0x20, 0x19, 0x32, 0x00,
665 0x01, 0xd9, 0xb2, 0x05, 675 0x01, 0xd9, 0xb2, 0x05,
666 0x02, 0xea, 0xb4, 0x00, 676 0x02, 0xea, 0xb4, 0x00,
667 0x01, 0xd9, 0xb2, 0x05, 677 0x01, 0xd9, 0xb2, 0x05,
668 0x10, 0x5b, 0x38, 0x6d, 678 0x10, 0x5b, 0x4c, 0x6d,
669 0x08, 0x5b, 0x42, 0x6d, 679 0x08, 0x5b, 0x56, 0x6d,
670 0x20, 0x5b, 0x32, 0x6d, 680 0x20, 0x5b, 0x46, 0x6d,
671 0x02, 0x5b, 0x62, 0x6d, 681 0x02, 0x5b, 0x76, 0x6d,
672 0x0e, 0xea, 0x64, 0x59, 682 0x0e, 0xea, 0x6e, 0x59,
673 0x0e, 0xea, 0x04, 0x00, 683 0x0e, 0xea, 0x04, 0x00,
674 0x80, 0xf9, 0x22, 0x6d, 684 0x80, 0xf9, 0x36, 0x6d,
675 0xdf, 0x5c, 0xb8, 0x08, 685 0xdf, 0x5c, 0xb8, 0x08,
676 0x01, 0xd9, 0xb2, 0x05, 686 0x01, 0xd9, 0xb2, 0x05,
677 0x01, 0xa4, 0x1d, 0x6e, 687 0x01, 0xa4, 0x37, 0x6e,
678 0x00, 0xe2, 0x68, 0x5c, 688 0x00, 0xe2, 0x7c, 0x5c,
679 0x00, 0xe2, 0x6c, 0x5d, 689 0x00, 0xe2, 0x80, 0x5d,
680 0x01, 0x90, 0x21, 0x1b, 690 0x01, 0x90, 0x21, 0x1b,
681 0x01, 0xd9, 0xb2, 0x05, 691 0x01, 0xd9, 0xb2, 0x05,
682 0x00, 0xe2, 0x52, 0x5b, 692 0x00, 0xe2, 0x66, 0x5b,
683 0xf3, 0x96, 0xd5, 0x19, 693 0xf3, 0x96, 0xd5, 0x19,
684 0x00, 0xe2, 0x50, 0x55, 694 0x00, 0xe2, 0x64, 0x55,
685 0x80, 0x96, 0x51, 0x6d, 695 0x80, 0x96, 0x65, 0x6d,
686 0x0f, 0xea, 0x64, 0x59, 696 0x0f, 0xea, 0x6e, 0x59,
687 0x0f, 0xea, 0x04, 0x00, 697 0x0f, 0xea, 0x04, 0x00,
688 0x00, 0xe2, 0x58, 0x45, 698 0x00, 0xe2, 0x6c, 0x45,
689 0x04, 0x8c, 0xe1, 0x30, 699 0x04, 0x8c, 0xe1, 0x30,
690 0x01, 0xea, 0xf2, 0x00, 700 0x01, 0xea, 0xf2, 0x00,
691 0x02, 0xea, 0x36, 0x00, 701 0x02, 0xea, 0x36, 0x00,
692 0xa8, 0xea, 0x32, 0x00, 702 0xa8, 0xea, 0x32, 0x00,
693 0xff, 0x97, 0x5f, 0x7d, 703 0xff, 0x97, 0x73, 0x7d,
694 0x14, 0xea, 0x64, 0x59, 704 0x14, 0xea, 0x6e, 0x59,
695 0x14, 0xea, 0x04, 0x00, 705 0x14, 0xea, 0x04, 0x00,
696 0x00, 0xe2, 0xce, 0x5d, 706 0x00, 0xe2, 0xe2, 0x5d,
697 0x01, 0xd9, 0xb2, 0x05, 707 0x01, 0xd9, 0xb2, 0x05,
698 0x09, 0x80, 0xe1, 0x30, 708 0x09, 0x80, 0xe1, 0x30,
699 0x02, 0xea, 0x36, 0x00, 709 0x02, 0xea, 0x36, 0x00,
700 0xa8, 0xea, 0x32, 0x00, 710 0xa8, 0xea, 0x32, 0x00,
701 0x00, 0xe2, 0xc6, 0x5d, 711 0x00, 0xe2, 0xda, 0x5d,
702 0x01, 0xd9, 0xb2, 0x05, 712 0x01, 0xd9, 0xb2, 0x05,
703 0x02, 0xa6, 0x7c, 0x7d, 713 0x02, 0xa6, 0x90, 0x7d,
704 0x00, 0xe2, 0x56, 0x59, 714 0x00, 0xe2, 0x60, 0x59,
705 0x20, 0x5b, 0x8a, 0x6d, 715 0x20, 0x5b, 0x9e, 0x6d,
706 0xfc, 0x42, 0x76, 0x7d, 716 0xfc, 0x42, 0x8a, 0x7d,
707 0x10, 0x40, 0x78, 0x6d, 717 0x10, 0x40, 0x8c, 0x6d,
708 0x20, 0x4d, 0x7a, 0x7d, 718 0x20, 0x4d, 0x8e, 0x7d,
709 0x08, 0x5d, 0x8a, 0x6d, 719 0x08, 0x5d, 0x9e, 0x6d,
710 0x02, 0xa6, 0x10, 0x6c, 720 0x02, 0xa6, 0x24, 0x6c,
711 0x00, 0xe2, 0x56, 0x59, 721 0x00, 0xe2, 0x60, 0x59,
712 0x20, 0x5b, 0x8a, 0x6d, 722 0x20, 0x5b, 0x9e, 0x6d,
713 0x01, 0x1b, 0xaa, 0x6d, 723 0x01, 0x1b, 0xbe, 0x6d,
714 0xfc, 0x42, 0x86, 0x7d, 724 0xfc, 0x42, 0x9a, 0x7d,
715 0x10, 0x40, 0x88, 0x6d, 725 0x10, 0x40, 0x9c, 0x6d,
716 0x20, 0x4d, 0x84, 0x78, 726 0x20, 0x4d, 0x84, 0x78,
717 0x08, 0x5d, 0x84, 0x78, 727 0x08, 0x5d, 0x84, 0x78,
718 0x02, 0x19, 0x32, 0x00, 728 0x02, 0x19, 0x32, 0x00,
719 0x01, 0x5b, 0x40, 0x31, 729 0x01, 0x5b, 0x40, 0x31,
720 0x00, 0xe2, 0xea, 0x5c, 730 0x00, 0xe2, 0xfe, 0x5c,
721 0x00, 0xe2, 0xcc, 0x5b, 731 0x00, 0xe2, 0xe0, 0x5b,
722 0x20, 0xea, 0xb6, 0x00, 732 0x20, 0xea, 0xb6, 0x00,
723 0x00, 0xe2, 0x0a, 0x5c, 733 0x00, 0xe2, 0x1e, 0x5c,
724 0x20, 0x5c, 0xb8, 0x00, 734 0x20, 0x5c, 0xb8, 0x00,
725 0x04, 0x19, 0xa0, 0x6d, 735 0x04, 0x19, 0xb4, 0x6d,
726 0x01, 0x1a, 0xa0, 0x6d, 736 0x01, 0x1a, 0xb4, 0x6d,
727 0x00, 0xe2, 0x56, 0x59, 737 0x00, 0xe2, 0x60, 0x59,
728 0x01, 0x1a, 0x84, 0x78, 738 0x01, 0x1a, 0x84, 0x78,
729 0x80, 0xf9, 0xf2, 0x01, 739 0x80, 0xf9, 0xf2, 0x01,
730 0x20, 0xa0, 0x04, 0x7e, 740 0x20, 0xa0, 0x18, 0x7e,
731 0xff, 0x90, 0x21, 0x1b, 741 0xff, 0x90, 0x21, 0x1b,
732 0x08, 0x92, 0x63, 0x6b, 742 0x08, 0x92, 0x77, 0x6b,
733 0x02, 0xea, 0xb4, 0x04, 743 0x02, 0xea, 0xb4, 0x04,
734 0x01, 0xa4, 0x49, 0x03, 744 0x01, 0xa4, 0x49, 0x03,
735 0x40, 0x5b, 0xba, 0x6d, 745 0x40, 0x5b, 0xce, 0x6d,
736 0x00, 0xe2, 0x56, 0x59, 746 0x00, 0xe2, 0x60, 0x59,
737 0x40, 0x5b, 0xba, 0x6d, 747 0x40, 0x5b, 0xce, 0x6d,
738 0x04, 0x5d, 0x1e, 0x7e, 748 0x04, 0x5d, 0x38, 0x7e,
739 0x01, 0x1a, 0x1e, 0x7e, 749 0x01, 0x1a, 0x38, 0x7e,
740 0x20, 0x4d, 0x84, 0x78, 750 0x20, 0x4d, 0x84, 0x78,
741 0x40, 0x5b, 0x04, 0x7e, 751 0x40, 0x5b, 0x18, 0x7e,
742 0x04, 0x5d, 0x1e, 0x7e, 752 0x04, 0x5d, 0x38, 0x7e,
743 0x01, 0x1a, 0x1e, 0x7e, 753 0x01, 0x1a, 0x38, 0x7e,
744 0x80, 0xf9, 0xf2, 0x01, 754 0x80, 0xf9, 0xf2, 0x01,
745 0xff, 0x90, 0x21, 0x1b, 755 0xff, 0x90, 0x21, 0x1b,
746 0x08, 0x92, 0x63, 0x6b, 756 0x08, 0x92, 0x77, 0x6b,
747 0x02, 0xea, 0xb4, 0x04, 757 0x02, 0xea, 0xb4, 0x04,
748 0x00, 0xe2, 0x56, 0x59, 758 0x00, 0xe2, 0x60, 0x59,
749 0x01, 0x1b, 0x84, 0x78, 759 0x01, 0x1b, 0x84, 0x78,
750 0x80, 0xf9, 0xf2, 0x01, 760 0x80, 0xf9, 0xf2, 0x01,
751 0x02, 0xea, 0xb4, 0x04, 761 0x02, 0xea, 0xb4, 0x04,
752 0x00, 0xe2, 0x56, 0x59, 762 0x00, 0xe2, 0x60, 0x59,
753 0x01, 0x1b, 0xe2, 0x6d, 763 0x01, 0x1b, 0xf6, 0x6d,
754 0x40, 0x5b, 0xf0, 0x7d, 764 0x40, 0x5b, 0x04, 0x7e,
755 0x01, 0x1b, 0xe2, 0x6d, 765 0x01, 0x1b, 0xf6, 0x6d,
756 0x02, 0x19, 0x32, 0x00, 766 0x02, 0x19, 0x32, 0x00,
757 0x01, 0x1a, 0x84, 0x78, 767 0x01, 0x1a, 0x84, 0x78,
758 0x80, 0xf9, 0xf2, 0x01, 768 0x80, 0xf9, 0xf2, 0x01,
759 0xff, 0xea, 0x10, 0x03, 769 0xff, 0xea, 0x10, 0x03,
760 0x08, 0x92, 0x25, 0x03, 770 0x08, 0x92, 0x25, 0x03,
761 0x00, 0xe2, 0x62, 0x43, 771 0x00, 0xe2, 0x76, 0x43,
762 0x01, 0x1a, 0xec, 0x7d, 772 0x01, 0x1a, 0x00, 0x7e,
763 0x40, 0x5b, 0xe8, 0x7d, 773 0x40, 0x5b, 0xfc, 0x7d,
764 0x01, 0x1a, 0xd6, 0x6d, 774 0x01, 0x1a, 0xea, 0x6d,
765 0xfc, 0x42, 0x84, 0x78, 775 0xfc, 0x42, 0x84, 0x78,
766 0x01, 0x1a, 0xf0, 0x6d, 776 0x01, 0x1a, 0x04, 0x6e,
767 0x10, 0xea, 0x64, 0x59, 777 0x10, 0xea, 0x6e, 0x59,
768 0x10, 0xea, 0x04, 0x00, 778 0x10, 0xea, 0x04, 0x00,
769 0xfc, 0x42, 0x84, 0x78, 779 0xfc, 0x42, 0x84, 0x78,
770 0x10, 0x40, 0xf6, 0x6d, 780 0x10, 0x40, 0x0a, 0x6e,
771 0x20, 0x4d, 0x84, 0x78, 781 0x20, 0x4d, 0x84, 0x78,
772 0x40, 0x5b, 0xd6, 0x6d, 782 0x40, 0x5b, 0xea, 0x6d,
773 0x01, 0x1a, 0x84, 0x78, 783 0x01, 0x1a, 0x84, 0x78,
774 0x01, 0x90, 0x21, 0x1b, 784 0x01, 0x90, 0x21, 0x1b,
775 0x30, 0x3f, 0xc0, 0x09, 785 0x30, 0x3f, 0xc0, 0x09,
776 0x30, 0xe0, 0x84, 0x60, 786 0x30, 0xe0, 0x84, 0x60,
777 0x40, 0x4b, 0x84, 0x68, 787 0x40, 0x4b, 0x84, 0x68,
778 0xff, 0xea, 0x52, 0x01, 788 0xff, 0xea, 0x52, 0x01,
779 0xee, 0x00, 0x0c, 0x6e, 789 0xee, 0x00, 0x20, 0x6e,
780 0x80, 0xf9, 0xf2, 0x01, 790 0x80, 0xf9, 0xf2, 0x01,
781 0xff, 0x90, 0x21, 0x1b, 791 0xff, 0x90, 0x21, 0x1b,
782 0x02, 0xea, 0xb4, 0x00, 792 0x02, 0xea, 0xb4, 0x00,
783 0x20, 0xea, 0x9a, 0x00, 793 0x20, 0xea, 0x9a, 0x00,
784 0xf3, 0x42, 0x16, 0x6e, 794 0x04, 0x41, 0x26, 0x7e,
785 0x12, 0xea, 0x64, 0x59, 795 0x08, 0xea, 0x98, 0x00,
796 0x08, 0x57, 0xae, 0x00,
797 0xf3, 0x42, 0x30, 0x6e,
798 0x12, 0xea, 0x6e, 0x59,
786 0x12, 0xea, 0x04, 0x00, 799 0x12, 0xea, 0x04, 0x00,
787 0x00, 0xe2, 0x14, 0x42, 800 0x00, 0xe2, 0x28, 0x42,
788 0x0d, 0xea, 0x64, 0x59, 801 0x0d, 0xea, 0x6e, 0x59,
789 0x0d, 0xea, 0x04, 0x00, 802 0x0d, 0xea, 0x04, 0x00,
790 0x00, 0xe2, 0x14, 0x42, 803 0x00, 0xe2, 0x28, 0x42,
791 0x01, 0x90, 0x21, 0x1b, 804 0x01, 0x90, 0x21, 0x1b,
792 0x11, 0xea, 0x64, 0x59, 805 0x11, 0xea, 0x6e, 0x59,
793 0x11, 0xea, 0x04, 0x00, 806 0x11, 0xea, 0x04, 0x00,
794 0x00, 0xe2, 0x52, 0x5b, 807 0x00, 0xe2, 0x66, 0x5b,
795 0x08, 0x5a, 0xb4, 0x00, 808 0x08, 0x5a, 0xb4, 0x00,
796 0x00, 0xe2, 0x44, 0x5e, 809 0x00, 0xe2, 0x5e, 0x5e,
797 0xa8, 0xea, 0x32, 0x00, 810 0xa8, 0xea, 0x32, 0x00,
798 0x00, 0xe2, 0x56, 0x59, 811 0x00, 0xe2, 0x60, 0x59,
799 0x80, 0x1a, 0x32, 0x7e, 812 0x80, 0x1a, 0x4c, 0x7e,
800 0x00, 0xe2, 0x44, 0x5e, 813 0x00, 0xe2, 0x5e, 0x5e,
801 0x80, 0x19, 0x32, 0x00, 814 0x80, 0x19, 0x32, 0x00,
802 0x40, 0x5b, 0x38, 0x6e, 815 0x40, 0x5b, 0x52, 0x6e,
803 0x08, 0x5a, 0x38, 0x7e, 816 0x08, 0x5a, 0x52, 0x7e,
804 0x20, 0x4d, 0x84, 0x78, 817 0x20, 0x4d, 0x84, 0x78,
805 0x02, 0x84, 0x09, 0x03, 818 0x02, 0x84, 0x09, 0x03,
806 0x40, 0x5b, 0x04, 0x7e, 819 0x40, 0x5b, 0x18, 0x7e,
807 0xff, 0x90, 0x21, 0x1b, 820 0xff, 0x90, 0x21, 0x1b,
808 0x80, 0xf9, 0xf2, 0x01, 821 0x80, 0xf9, 0xf2, 0x01,
809 0x08, 0x92, 0x63, 0x6b, 822 0x08, 0x92, 0x77, 0x6b,
810 0x02, 0xea, 0xb4, 0x04, 823 0x02, 0xea, 0xb4, 0x04,
811 0x01, 0x40, 0xe1, 0x30, 824 0x01, 0x40, 0xe1, 0x30,
812 0x05, 0x41, 0xe3, 0x98, 825 0x05, 0x41, 0xe3, 0x98,
@@ -1039,138 +1052,138 @@ static struct patch {
1039 { ahd_patch0_func, 64, 1, 1 }, 1052 { ahd_patch0_func, 64, 1, 1 },
1040 { ahd_patch2_func, 67, 1, 2 }, 1053 { ahd_patch2_func, 67, 1, 2 },
1041 { ahd_patch0_func, 68, 1, 1 }, 1054 { ahd_patch0_func, 68, 1, 1 },
1042 { ahd_patch4_func, 116, 1, 1 }, 1055 { ahd_patch4_func, 115, 1, 1 },
1043 { ahd_patch2_func, 175, 3, 1 }, 1056 { ahd_patch2_func, 180, 3, 1 },
1044 { ahd_patch1_func, 178, 2, 1 }, 1057 { ahd_patch1_func, 183, 2, 1 },
1045 { ahd_patch5_func, 180, 1, 1 }, 1058 { ahd_patch5_func, 185, 1, 1 },
1046 { ahd_patch2_func, 189, 1, 2 }, 1059 { ahd_patch2_func, 194, 1, 2 },
1047 { ahd_patch0_func, 190, 1, 1 }, 1060 { ahd_patch0_func, 195, 1, 1 },
1048 { ahd_patch6_func, 191, 2, 2 }, 1061 { ahd_patch6_func, 196, 2, 2 },
1049 { ahd_patch0_func, 193, 6, 3 }, 1062 { ahd_patch0_func, 198, 6, 3 },
1050 { ahd_patch2_func, 196, 1, 2 }, 1063 { ahd_patch2_func, 201, 1, 2 },
1051 { ahd_patch0_func, 197, 1, 1 }, 1064 { ahd_patch0_func, 202, 1, 1 },
1052 { ahd_patch2_func, 200, 1, 2 }, 1065 { ahd_patch2_func, 205, 1, 2 },
1053 { ahd_patch0_func, 201, 1, 1 }, 1066 { ahd_patch0_func, 206, 1, 1 },
1054 { ahd_patch3_func, 203, 1, 1 }, 1067 { ahd_patch3_func, 208, 1, 1 },
1055 { ahd_patch7_func, 204, 3, 1 }, 1068 { ahd_patch7_func, 209, 3, 1 },
1056 { ahd_patch3_func, 213, 1, 1 }, 1069 { ahd_patch3_func, 218, 1, 1 },
1057 { ahd_patch5_func, 214, 16, 2 }, 1070 { ahd_patch5_func, 219, 16, 2 },
1058 { ahd_patch0_func, 230, 1, 1 }, 1071 { ahd_patch0_func, 235, 1, 1 },
1059 { ahd_patch8_func, 250, 2, 1 }, 1072 { ahd_patch8_func, 260, 2, 1 },
1060 { ahd_patch1_func, 254, 1, 2 }, 1073 { ahd_patch1_func, 264, 1, 2 },
1061 { ahd_patch0_func, 255, 1, 1 }, 1074 { ahd_patch0_func, 265, 1, 1 },
1062 { ahd_patch7_func, 258, 3, 1 }, 1075 { ahd_patch7_func, 268, 3, 1 },
1063 { ahd_patch1_func, 273, 1, 2 }, 1076 { ahd_patch1_func, 283, 1, 2 },
1064 { ahd_patch0_func, 274, 1, 1 }, 1077 { ahd_patch0_func, 284, 1, 1 },
1065 { ahd_patch1_func, 277, 1, 2 }, 1078 { ahd_patch1_func, 287, 1, 2 },
1066 { ahd_patch0_func, 278, 1, 1 }, 1079 { ahd_patch0_func, 288, 1, 1 },
1067 { ahd_patch2_func, 281, 1, 2 }, 1080 { ahd_patch2_func, 291, 1, 2 },
1068 { ahd_patch0_func, 282, 1, 1 }, 1081 { ahd_patch0_func, 292, 1, 1 },
1069 { ahd_patch9_func, 295, 2, 2 }, 1082 { ahd_patch9_func, 305, 2, 2 },
1070 { ahd_patch0_func, 297, 1, 1 }, 1083 { ahd_patch0_func, 307, 1, 1 },
1071 { ahd_patch1_func, 339, 1, 2 }, 1084 { ahd_patch1_func, 349, 1, 2 },
1072 { ahd_patch0_func, 340, 1, 1 }, 1085 { ahd_patch0_func, 350, 1, 1 },
1073 { ahd_patch2_func, 348, 1, 2 }, 1086 { ahd_patch2_func, 358, 1, 2 },
1074 { ahd_patch0_func, 349, 1, 1 }, 1087 { ahd_patch0_func, 359, 1, 1 },
1075 { ahd_patch2_func, 352, 1, 2 }, 1088 { ahd_patch2_func, 362, 1, 2 },
1076 { ahd_patch0_func, 353, 1, 1 },
1077 { ahd_patch1_func, 359, 1, 2 },
1078 { ahd_patch0_func, 360, 1, 1 },
1079 { ahd_patch1_func, 362, 1, 2 },
1080 { ahd_patch0_func, 363, 1, 1 }, 1089 { ahd_patch0_func, 363, 1, 1 },
1081 { ahd_patch10_func, 382, 1, 1 }, 1090 { ahd_patch1_func, 369, 1, 2 },
1082 { ahd_patch10_func, 385, 1, 1 }, 1091 { ahd_patch0_func, 370, 1, 1 },
1083 { ahd_patch10_func, 387, 1, 1 }, 1092 { ahd_patch1_func, 372, 1, 2 },
1084 { ahd_patch10_func, 399, 1, 1 }, 1093 { ahd_patch0_func, 373, 1, 1 },
1085 { ahd_patch1_func, 409, 1, 2 }, 1094 { ahd_patch10_func, 392, 1, 1 },
1086 { ahd_patch0_func, 410, 1, 1 }, 1095 { ahd_patch10_func, 395, 1, 1 },
1087 { ahd_patch1_func, 412, 1, 2 }, 1096 { ahd_patch10_func, 397, 1, 1 },
1088 { ahd_patch0_func, 413, 1, 1 }, 1097 { ahd_patch10_func, 409, 1, 1 },
1089 { ahd_patch1_func, 421, 1, 2 }, 1098 { ahd_patch1_func, 419, 1, 2 },
1090 { ahd_patch0_func, 422, 1, 1 }, 1099 { ahd_patch0_func, 420, 1, 1 },
1091 { ahd_patch2_func, 435, 1, 2 }, 1100 { ahd_patch1_func, 422, 1, 2 },
1092 { ahd_patch0_func, 436, 1, 1 }, 1101 { ahd_patch0_func, 423, 1, 1 },
1093 { ahd_patch11_func, 472, 1, 1 }, 1102 { ahd_patch1_func, 431, 1, 2 },
1094 { ahd_patch1_func, 480, 1, 2 }, 1103 { ahd_patch0_func, 432, 1, 1 },
1095 { ahd_patch0_func, 481, 1, 1 }, 1104 { ahd_patch2_func, 445, 1, 2 },
1096 { ahd_patch2_func, 493, 1, 2 }, 1105 { ahd_patch0_func, 446, 1, 1 },
1097 { ahd_patch0_func, 494, 1, 1 }, 1106 { ahd_patch11_func, 482, 1, 1 },
1098 { ahd_patch12_func, 497, 6, 2 }, 1107 { ahd_patch1_func, 490, 1, 2 },
1099 { ahd_patch0_func, 503, 1, 1 }, 1108 { ahd_patch0_func, 491, 1, 1 },
1100 { ahd_patch13_func, 524, 7, 1 }, 1109 { ahd_patch2_func, 503, 1, 2 },
1101 { ahd_patch14_func, 533, 1, 1 }, 1110 { ahd_patch0_func, 504, 1, 1 },
1102 { ahd_patch15_func, 542, 1, 1 }, 1111 { ahd_patch12_func, 507, 6, 2 },
1103 { ahd_patch16_func, 543, 1, 2 }, 1112 { ahd_patch0_func, 513, 1, 1 },
1104 { ahd_patch0_func, 544, 1, 1 }, 1113 { ahd_patch13_func, 534, 7, 1 },
1105 { ahd_patch17_func, 547, 1, 1 }, 1114 { ahd_patch14_func, 543, 1, 1 },
1106 { ahd_patch16_func, 548, 1, 1 }, 1115 { ahd_patch15_func, 552, 1, 1 },
1107 { ahd_patch18_func, 559, 1, 2 }, 1116 { ahd_patch16_func, 553, 1, 2 },
1108 { ahd_patch0_func, 560, 1, 1 }, 1117 { ahd_patch0_func, 554, 1, 1 },
1109 { ahd_patch1_func, 579, 1, 2 }, 1118 { ahd_patch17_func, 557, 1, 1 },
1110 { ahd_patch0_func, 580, 1, 1 }, 1119 { ahd_patch16_func, 558, 1, 1 },
1111 { ahd_patch1_func, 583, 1, 2 }, 1120 { ahd_patch18_func, 569, 1, 2 },
1112 { ahd_patch0_func, 584, 1, 1 }, 1121 { ahd_patch0_func, 570, 1, 1 },
1113 { ahd_patch2_func, 589, 1, 2 }, 1122 { ahd_patch1_func, 589, 1, 2 },
1114 { ahd_patch0_func, 590, 1, 1 }, 1123 { ahd_patch0_func, 590, 1, 1 },
1115 { ahd_patch2_func, 594, 1, 2 }, 1124 { ahd_patch1_func, 593, 1, 2 },
1116 { ahd_patch0_func, 595, 1, 1 }, 1125 { ahd_patch0_func, 594, 1, 1 },
1117 { ahd_patch1_func, 596, 1, 2 }, 1126 { ahd_patch2_func, 599, 1, 2 },
1118 { ahd_patch0_func, 597, 1, 1 }, 1127 { ahd_patch0_func, 600, 1, 1 },
1119 { ahd_patch2_func, 608, 1, 2 }, 1128 { ahd_patch2_func, 604, 1, 2 },
1120 { ahd_patch0_func, 609, 1, 1 }, 1129 { ahd_patch0_func, 605, 1, 1 },
1121 { ahd_patch19_func, 613, 1, 1 }, 1130 { ahd_patch1_func, 606, 1, 2 },
1122 { ahd_patch20_func, 618, 1, 1 }, 1131 { ahd_patch0_func, 607, 1, 1 },
1123 { ahd_patch21_func, 619, 2, 1 }, 1132 { ahd_patch2_func, 618, 1, 2 },
1124 { ahd_patch20_func, 623, 1, 2 }, 1133 { ahd_patch0_func, 619, 1, 1 },
1125 { ahd_patch0_func, 624, 1, 1 }, 1134 { ahd_patch19_func, 623, 1, 1 },
1126 { ahd_patch2_func, 627, 1, 2 }, 1135 { ahd_patch20_func, 628, 1, 1 },
1127 { ahd_patch0_func, 628, 1, 1 }, 1136 { ahd_patch21_func, 629, 2, 1 },
1128 { ahd_patch2_func, 643, 1, 2 }, 1137 { ahd_patch20_func, 633, 1, 2 },
1129 { ahd_patch0_func, 644, 1, 1 }, 1138 { ahd_patch0_func, 634, 1, 1 },
1130 { ahd_patch13_func, 645, 14, 1 }, 1139 { ahd_patch2_func, 637, 1, 2 },
1131 { ahd_patch1_func, 663, 1, 2 }, 1140 { ahd_patch0_func, 638, 1, 1 },
1132 { ahd_patch0_func, 664, 1, 1 }, 1141 { ahd_patch2_func, 653, 1, 2 },
1133 { ahd_patch13_func, 665, 1, 1 }, 1142 { ahd_patch0_func, 654, 1, 1 },
1134 { ahd_patch1_func, 677, 1, 2 }, 1143 { ahd_patch13_func, 655, 14, 1 },
1135 { ahd_patch0_func, 678, 1, 1 }, 1144 { ahd_patch1_func, 673, 1, 2 },
1136 { ahd_patch1_func, 685, 1, 2 }, 1145 { ahd_patch0_func, 674, 1, 1 },
1137 { ahd_patch0_func, 686, 1, 1 }, 1146 { ahd_patch13_func, 675, 1, 1 },
1138 { ahd_patch19_func, 709, 1, 1 }, 1147 { ahd_patch1_func, 687, 1, 2 },
1139 { ahd_patch19_func, 747, 1, 1 }, 1148 { ahd_patch0_func, 688, 1, 1 },
1140 { ahd_patch1_func, 758, 1, 2 }, 1149 { ahd_patch1_func, 695, 1, 2 },
1141 { ahd_patch0_func, 759, 1, 1 }, 1150 { ahd_patch0_func, 696, 1, 1 },
1142 { ahd_patch1_func, 776, 1, 2 }, 1151 { ahd_patch19_func, 719, 1, 1 },
1143 { ahd_patch0_func, 777, 1, 1 }, 1152 { ahd_patch19_func, 757, 1, 1 },
1144 { ahd_patch1_func, 779, 1, 2 }, 1153 { ahd_patch1_func, 768, 1, 2 },
1145 { ahd_patch0_func, 780, 1, 1 }, 1154 { ahd_patch0_func, 769, 1, 1 },
1146 { ahd_patch1_func, 783, 1, 2 }, 1155 { ahd_patch7_func, 785, 3, 1 },
1147 { ahd_patch0_func, 784, 1, 1 }, 1156 { ahd_patch1_func, 789, 1, 2 },
1148 { ahd_patch22_func, 786, 1, 2 }, 1157 { ahd_patch0_func, 790, 1, 1 },
1149 { ahd_patch0_func, 787, 2, 1 }, 1158 { ahd_patch1_func, 792, 1, 2 },
1150 { ahd_patch23_func, 790, 4, 2 }, 1159 { ahd_patch0_func, 793, 1, 1 },
1151 { ahd_patch0_func, 794, 1, 1 }, 1160 { ahd_patch1_func, 796, 1, 2 },
1152 { ahd_patch23_func, 802, 11, 1 } 1161 { ahd_patch0_func, 797, 1, 1 },
1162 { ahd_patch22_func, 799, 1, 2 },
1163 { ahd_patch0_func, 800, 2, 1 },
1164 { ahd_patch23_func, 803, 4, 2 },
1165 { ahd_patch0_func, 807, 1, 1 },
1166 { ahd_patch23_func, 815, 11, 1 }
1153}; 1167};
1154 1168
1155static struct cs { 1169static struct cs {
1156 uint16_t begin; 1170 uint16_t begin;
1157 uint16_t end; 1171 uint16_t end;
1158} critical_sections[] = { 1172} critical_sections[] = {
1159 { 17, 28 }, 1173 { 17, 30 },
1160 { 29, 30 },
1161 { 47, 58 }, 1174 { 47, 58 },
1162 { 61, 63 }, 1175 { 61, 63 },
1163 { 65, 66 }, 1176 { 65, 66 },
1164 { 72, 92 }, 1177 { 72, 92 },
1165 { 110, 137 }, 1178 { 110, 142 },
1166 { 138, 175 }, 1179 { 143, 180 },
1167 { 180, 188 }, 1180 { 185, 193 },
1168 { 213, 264 }, 1181 { 218, 274 },
1169 { 425, 433 }, 1182 { 435, 443 },
1170 { 443, 445 }, 1183 { 453, 455 },
1171 { 448, 457 }, 1184 { 458, 467 },
1172 { 709, 739 }, 1185 { 719, 749 },
1173 { 749, 753 } 1186 { 759, 763 }
1174}; 1187};
1175 1188
1176static const int num_critical_sections = sizeof(critical_sections) 1189static const int num_critical_sections = sizeof(critical_sections)
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c
index f936b691232f..924102720b14 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c
@@ -37,7 +37,7 @@
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES. 38 * POSSIBILITY OF SUCH DAMAGES.
39 * 39 *
40 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm.c#22 $ 40 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm.c#23 $
41 * 41 *
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
@@ -609,10 +609,10 @@ output_listing(char *ifilename)
609 609
610 while (line < cur_instr->srcline) { 610 while (line < cur_instr->srcline) {
611 fgets(buf, sizeof(buf), ifile); 611 fgets(buf, sizeof(buf), ifile);
612 fprintf(listfile, "\t\t%s", buf); 612 fprintf(listfile, " \t%s", buf);
613 line++; 613 line++;
614 } 614 }
615 fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr, 615 fprintf(listfile, "%04x %02x%02x%02x%02x", instrptr,
616#ifdef __LITTLE_ENDIAN 616#ifdef __LITTLE_ENDIAN
617 cur_instr->format.bytes[0], 617 cur_instr->format.bytes[0],
618 cur_instr->format.bytes[1], 618 cur_instr->format.bytes[1],
@@ -624,14 +624,23 @@ output_listing(char *ifilename)
624 cur_instr->format.bytes[1], 624 cur_instr->format.bytes[1],
625 cur_instr->format.bytes[0]); 625 cur_instr->format.bytes[0]);
626#endif 626#endif
627 fgets(buf, sizeof(buf), ifile); 627 /*
628 fprintf(listfile, "\t%s", buf); 628 * Macro expansions can cause several instructions
629 line++; 629 * to be output for a single source line. Only
630 * advance the line once in these cases.
631 */
632 if (line == cur_instr->srcline) {
633 fgets(buf, sizeof(buf), ifile);
634 fprintf(listfile, "\t%s", buf);
635 line++;
636 } else {
637 fprintf(listfile, "\n");
638 }
630 instrptr++; 639 instrptr++;
631 } 640 }
632 /* Dump the remainder of the file */ 641 /* Dump the remainder of the file */
633 while(fgets(buf, sizeof(buf), ifile) != NULL) 642 while(fgets(buf, sizeof(buf), ifile) != NULL)
634 fprintf(listfile, "\t\t%s", buf); 643 fprintf(listfile, " %s", buf);
635 644
636 fclose(ifile); 645 fclose(ifile);
637} 646}
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
index 67e046d96625..c328596def3c 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
@@ -38,7 +38,7 @@
38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGES. 39 * POSSIBILITY OF SUCH DAMAGES.
40 * 40 *
41 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_gram.y#29 $ 41 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_gram.y#30 $
42 * 42 *
43 * $FreeBSD$ 43 * $FreeBSD$
44 */ 44 */
@@ -157,6 +157,8 @@ static int is_download_const(expression_t *immed);
157 157
158%token T_END_CS 158%token T_END_CS
159 159
160%token T_PAD_PAGE
161
160%token T_FIELD 162%token T_FIELD
161 163
162%token T_ENUM 164%token T_ENUM
@@ -189,6 +191,10 @@ static int is_download_const(expression_t *immed);
189 191
190%token <value> T_OR 192%token <value> T_OR
191 193
194/* 16 bit extensions */
195%token <value> T_OR16 T_AND16 T_XOR16 T_ADD16
196%token <value> T_ADC16 T_MVI16 T_TEST16 T_CMP16 T_CMPXCHG
197
192%token T_RET 198%token T_RET
193 199
194%token T_NOP 200%token T_NOP
@@ -207,7 +213,7 @@ static int is_download_const(expression_t *immed);
207 213
208%type <expression> expression immediate immediate_or_a 214%type <expression> expression immediate immediate_or_a
209 215
210%type <value> export ret f1_opcode f2_opcode jmp_jc_jnc_call jz_jnz je_jne 216%type <value> export ret f1_opcode f2_opcode f4_opcode jmp_jc_jnc_call jz_jnz je_jne
211 217
212%type <value> mode_value mode_list macro_arglist 218%type <value> mode_value mode_list macro_arglist
213 219
@@ -1304,6 +1310,15 @@ f2_opcode:
1304| T_ROR { $$ = AIC_OP_ROR; } 1310| T_ROR { $$ = AIC_OP_ROR; }
1305; 1311;
1306 1312
1313f4_opcode:
1314 T_OR16 { $$ = AIC_OP_OR16; }
1315| T_AND16 { $$ = AIC_OP_AND16; }
1316| T_XOR16 { $$ = AIC_OP_XOR16; }
1317| T_ADD16 { $$ = AIC_OP_ADD16; }
1318| T_ADC16 { $$ = AIC_OP_ADC16; }
1319| T_MVI16 { $$ = AIC_OP_MVI16; }
1320;
1321
1307code: 1322code:
1308 f2_opcode destination ',' expression opt_source ret ';' 1323 f2_opcode destination ',' expression opt_source ret ';'
1309 { 1324 {
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
index e64f802bbaaa..9df9e2ce3538 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
@@ -37,13 +37,14 @@
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES. 38 * POSSIBILITY OF SUCH DAMAGES.
39 * 39 *
40 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_insformat.h#11 $ 40 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_insformat.h#12 $
41 * 41 *
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
44 44
45#include <asm/byteorder.h> 45#include <asm/byteorder.h>
46 46
47/* 8bit ALU logic operations */
47struct ins_format1 { 48struct ins_format1 {
48#ifdef __LITTLE_ENDIAN 49#ifdef __LITTLE_ENDIAN
49 uint32_t immediate : 8, 50 uint32_t immediate : 8,
@@ -62,6 +63,7 @@ struct ins_format1 {
62#endif 63#endif
63}; 64};
64 65
66/* 8bit ALU shift/rotate operations */
65struct ins_format2 { 67struct ins_format2 {
66#ifdef __LITTLE_ENDIAN 68#ifdef __LITTLE_ENDIAN
67 uint32_t shift_control : 8, 69 uint32_t shift_control : 8,
@@ -80,6 +82,7 @@ struct ins_format2 {
80#endif 82#endif
81}; 83};
82 84
85/* 8bit branch control operations */
83struct ins_format3 { 86struct ins_format3 {
84#ifdef __LITTLE_ENDIAN 87#ifdef __LITTLE_ENDIAN
85 uint32_t immediate : 8, 88 uint32_t immediate : 8,
@@ -96,10 +99,68 @@ struct ins_format3 {
96#endif 99#endif
97}; 100};
98 101
102/* 16bit ALU logic operations */
103struct ins_format4 {
104#ifdef __LITTLE_ENDIAN
105 uint32_t opcode_ext : 8,
106 source : 9,
107 destination : 9,
108 ret : 1,
109 opcode : 4,
110 parity : 1;
111#else
112 uint32_t parity : 1,
113 opcode : 4,
114 ret : 1,
115 destination : 9,
116 source : 9,
117 opcode_ext : 8;
118#endif
119};
120
121/* 16bit branch control operations */
122struct ins_format5 {
123#ifdef __LITTLE_ENDIAN
124 uint32_t opcode_ext : 8,
125 source : 9,
126 address : 10,
127 opcode : 4,
128 parity : 1;
129#else
130 uint32_t parity : 1,
131 opcode : 4,
132 address : 10,
133 source : 9,
134 opcode_ext : 8;
135#endif
136};
137
138/* Far branch operations */
139struct ins_format6 {
140#ifdef __LITTLE_ENDIAN
141 uint32_t page : 3,
142 opcode_ext : 5,
143 source : 9,
144 address : 10,
145 opcode : 4,
146 parity : 1;
147#else
148 uint32_t parity : 1,
149 opcode : 4,
150 address : 10,
151 source : 9,
152 opcode_ext : 5,
153 page : 3;
154#endif
155};
156
99union ins_formats { 157union ins_formats {
100 struct ins_format1 format1; 158 struct ins_format1 format1;
101 struct ins_format2 format2; 159 struct ins_format2 format2;
102 struct ins_format3 format3; 160 struct ins_format3 format3;
161 struct ins_format4 format4;
162 struct ins_format5 format5;
163 struct ins_format6 format6;
103 uint8_t bytes[4]; 164 uint8_t bytes[4];
104 uint32_t integer; 165 uint32_t integer;
105}; 166};
@@ -118,6 +179,8 @@ struct instruction {
118#define AIC_OP_ROL 0x5 179#define AIC_OP_ROL 0x5
119#define AIC_OP_BMOV 0x6 180#define AIC_OP_BMOV 0x6
120 181
182#define AIC_OP_MVI16 0x7
183
121#define AIC_OP_JMP 0x8 184#define AIC_OP_JMP 0x8
122#define AIC_OP_JC 0x9 185#define AIC_OP_JC 0x9
123#define AIC_OP_JNC 0xa 186#define AIC_OP_JNC 0xa
@@ -131,3 +194,26 @@ struct instruction {
131#define AIC_OP_SHL 0x10 194#define AIC_OP_SHL 0x10
132#define AIC_OP_SHR 0x20 195#define AIC_OP_SHR 0x20
133#define AIC_OP_ROR 0x30 196#define AIC_OP_ROR 0x30
197
198/* 16bit Ops. Low byte main opcode. High byte extended opcode. */
199#define AIC_OP_OR16 0x8005
200#define AIC_OP_AND16 0x8105
201#define AIC_OP_XOR16 0x8205
202#define AIC_OP_ADD16 0x8305
203#define AIC_OP_ADC16 0x8405
204#define AIC_OP_JNE16 0x8805
205#define AIC_OP_JNZ16 0x8905
206#define AIC_OP_JE16 0x8C05
207#define AIC_OP_JZ16 0x8B05
208#define AIC_OP_JMP16 0x9005
209#define AIC_OP_JC16 0x9105
210#define AIC_OP_JNC16 0x9205
211#define AIC_OP_CALL16 0x9305
212#define AIC_OP_CALL16 0x9305
213
214/* Page extension is low three bits of second opcode byte. */
215#define AIC_OP_JMPF 0xA005
216#define AIC_OP_CALLF 0xB005
217#define AIC_OP_JCF 0xC005
218#define AIC_OP_JNCF 0xD005
219#define AIC_OP_CMPXCHG 0xE005
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
index 45c0b233d0bc..7c3983f868a9 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
@@ -38,7 +38,7 @@
38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGES. 39 * POSSIBILITY OF SUCH DAMAGES.
40 * 40 *
41 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#19 $ 41 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#20 $
42 * 42 *
43 * $FreeBSD$ 43 * $FreeBSD$
44 */ 44 */
@@ -132,7 +132,7 @@ if[ \t]*\( {
132 *string_buf_ptr++ = *yptr++; 132 *string_buf_ptr++ = *yptr++;
133 } 133 }
134 } 134 }
135 135else { return T_ELSE; }
136VERSION { return T_VERSION; } 136VERSION { return T_VERSION; }
137PREFIX { return T_PREFIX; } 137PREFIX { return T_PREFIX; }
138PATCH_ARG_LIST { return T_PATCH_ARG_LIST; } 138PATCH_ARG_LIST { return T_PATCH_ARG_LIST; }
@@ -173,10 +173,6 @@ RW|RO|WO {
173 yylval.value = WO; 173 yylval.value = WO;
174 return T_MODE; 174 return T_MODE;
175 } 175 }
176BEGIN_CRITICAL { return T_BEGIN_CS; }
177END_CRITICAL { return T_END_CS; }
178SET_SRC_MODE { return T_SET_SRC_MODE; }
179SET_DST_MODE { return T_SET_DST_MODE; }
180field { return T_FIELD; } 176field { return T_FIELD; }
181enum { return T_ENUM; } 177enum { return T_ENUM; }
182mask { return T_MASK; } 178mask { return T_MASK; }
@@ -192,6 +188,13 @@ none { return T_NONE; }
192sindex { return T_SINDEX; } 188sindex { return T_SINDEX; }
193A { return T_A; } 189A { return T_A; }
194 190
191 /* Instruction Formatting */
192PAD_PAGE { return T_PAD_PAGE; }
193BEGIN_CRITICAL { return T_BEGIN_CS; }
194END_CRITICAL { return T_END_CS; }
195SET_SRC_MODE { return T_SET_SRC_MODE; }
196SET_DST_MODE { return T_SET_DST_MODE; }
197
195 /* Opcodes */ 198 /* Opcodes */
196shl { return T_SHL; } 199shl { return T_SHL; }
197shr { return T_SHR; } 200shr { return T_SHR; }
@@ -223,7 +226,17 @@ and { return T_AND; }
223or { return T_OR; } 226or { return T_OR; }
224ret { return T_RET; } 227ret { return T_RET; }
225nop { return T_NOP; } 228nop { return T_NOP; }
226else { return T_ELSE; } 229
230 /* ARP2 16bit extensions */
231or16 { return T_OR16; }
232and16 { return T_AND16; }
233xor16 { return T_XOR16; }
234add16 { return T_ADD16; }
235adc16 { return T_ADC16; }
236mvi16 { return T_MVI16; }
237test16 { return T_TEST16; }
238cmp16 { return T_CMP16; }
239cmpxchg { return T_CMPXCHG; }
227 240
228 /* Allowed Symbols */ 241 /* Allowed Symbols */
229\<\< { return T_EXPR_LSHIFT; } 242\<\< { return T_EXPR_LSHIFT; }
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index c8a32cf47d73..cbf825263f3b 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -246,6 +246,7 @@ struct ScsiReqBlk {
246 * total_xfer_length in xferred. These values are restored in 246 * total_xfer_length in xferred. These values are restored in
247 * pci_unmap_srb_sense. This is the only place xferred is used. 247 * pci_unmap_srb_sense. This is the only place xferred is used.
248 */ 248 */
249 unsigned char *virt_addr_req; /* Saved virtual address of the request buffer */
249 u32 xferred; /* Saved copy of total_xfer_length */ 250 u32 xferred; /* Saved copy of total_xfer_length */
250 251
251 u16 state; 252 u16 state;
@@ -2017,7 +2018,7 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
2017 sg_verify_length(srb); 2018 sg_verify_length(srb);
2018 2019
2019 /* we need the corresponding virtual address */ 2020 /* we need the corresponding virtual address */
2020 if (!segment) { 2021 if (!segment || (srb->flag & AUTO_REQSENSE)) {
2021 srb->virt_addr += xferred; 2022 srb->virt_addr += xferred;
2022 return; 2023 return;
2023 } 2024 }
@@ -3318,6 +3319,7 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb,
3318 srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].address; 3319 srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].address;
3319 srb->segment_x[0].length = 3320 srb->segment_x[0].length =
3320 srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].length; 3321 srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].length;
3322 srb->virt_addr = srb->virt_addr_req;
3321} 3323}
3322 3324
3323 3325
@@ -3711,6 +3713,8 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
3711 srb->xferred = srb->total_xfer_length; 3713 srb->xferred = srb->total_xfer_length;
3712 /* srb->segment_x : a one entry of S/G list table */ 3714 /* srb->segment_x : a one entry of S/G list table */
3713 srb->total_xfer_length = sizeof(cmd->sense_buffer); 3715 srb->total_xfer_length = sizeof(cmd->sense_buffer);
3716 srb->virt_addr_req = srb->virt_addr;
3717 srb->virt_addr = cmd->sense_buffer;
3714 srb->segment_x[0].length = sizeof(cmd->sense_buffer); 3718 srb->segment_x[0].length = sizeof(cmd->sense_buffer);
3715 /* Map sense buffer */ 3719 /* Map sense buffer */
3716 srb->segment_x[0].address = 3720 srb->segment_x[0].address =
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 822b9fa706f3..eaefeddb2b4a 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -87,7 +87,7 @@ static int max_channel = 3;
87static int init_timeout = 5; 87static int init_timeout = 5;
88static int max_requests = 50; 88static int max_requests = 50;
89 89
90#define IBMVSCSI_VERSION "1.5.7" 90#define IBMVSCSI_VERSION "1.5.8"
91 91
92MODULE_DESCRIPTION("IBM Virtual SCSI"); 92MODULE_DESCRIPTION("IBM Virtual SCSI");
93MODULE_AUTHOR("Dave Boutcher"); 93MODULE_AUTHOR("Dave Boutcher");
@@ -534,7 +534,6 @@ static int map_data_for_srp_cmd(struct scsi_cmnd *cmd,
534static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, 534static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
535 struct ibmvscsi_host_data *hostdata) 535 struct ibmvscsi_host_data *hostdata)
536{ 536{
537 struct scsi_cmnd *cmnd;
538 u64 *crq_as_u64 = (u64 *) &evt_struct->crq; 537 u64 *crq_as_u64 = (u64 *) &evt_struct->crq;
539 int rc; 538 int rc;
540 539
@@ -544,19 +543,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
544 * can handle more requests (can_queue) when we actually can't 543 * can handle more requests (can_queue) when we actually can't
545 */ 544 */
546 if ((evt_struct->crq.format == VIOSRP_SRP_FORMAT) && 545 if ((evt_struct->crq.format == VIOSRP_SRP_FORMAT) &&
547 (atomic_dec_if_positive(&hostdata->request_limit) < 0)) { 546 (atomic_dec_if_positive(&hostdata->request_limit) < 0))
548 /* See if the adapter is disabled */ 547 goto send_error;
549 if (atomic_read(&hostdata->request_limit) < 0)
550 goto send_error;
551
552 printk(KERN_WARNING
553 "ibmvscsi: Warning, request_limit exceeded\n");
554 unmap_cmd_data(&evt_struct->iu.srp.cmd,
555 evt_struct,
556 hostdata->dev);
557 free_event_struct(&hostdata->pool, evt_struct);
558 return SCSI_MLQUEUE_HOST_BUSY;
559 }
560 548
561 /* Copy the IU into the transfer area */ 549 /* Copy the IU into the transfer area */
562 *evt_struct->xfer_iu = evt_struct->iu; 550 *evt_struct->xfer_iu = evt_struct->iu;
@@ -572,7 +560,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
572 ibmvscsi_send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) { 560 ibmvscsi_send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) {
573 list_del(&evt_struct->list); 561 list_del(&evt_struct->list);
574 562
575 printk(KERN_ERR "ibmvscsi: failed to send event struct rc %d\n", 563 printk(KERN_ERR "ibmvscsi: send error %d\n",
576 rc); 564 rc);
577 goto send_error; 565 goto send_error;
578 } 566 }
@@ -582,14 +570,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
582 send_error: 570 send_error:
583 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); 571 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
584 572
585 if ((cmnd = evt_struct->cmnd) != NULL) {
586 cmnd->result = DID_ERROR << 16;
587 evt_struct->cmnd_done(cmnd);
588 } else if (evt_struct->done)
589 evt_struct->done(evt_struct);
590
591 free_event_struct(&hostdata->pool, evt_struct); 573 free_event_struct(&hostdata->pool, evt_struct);
592 return 0; 574 return SCSI_MLQUEUE_HOST_BUSY;
593} 575}
594 576
595/** 577/**
@@ -802,7 +784,8 @@ static void login_rsp(struct srp_event_struct *evt_struct)
802 case SRP_LOGIN_RSP_TYPE: /* it worked! */ 784 case SRP_LOGIN_RSP_TYPE: /* it worked! */
803 break; 785 break;
804 case SRP_LOGIN_REJ_TYPE: /* refused! */ 786 case SRP_LOGIN_REJ_TYPE: /* refused! */
805 printk(KERN_INFO "ibmvscsi: SRP_LOGIN_REQ rejected\n"); 787 printk(KERN_INFO "ibmvscsi: SRP_LOGIN_REJ reason %u\n",
788 evt_struct->xfer_iu->srp.login_rej.reason);
806 /* Login failed. */ 789 /* Login failed. */
807 atomic_set(&hostdata->request_limit, -1); 790 atomic_set(&hostdata->request_limit, -1);
808 return; 791 return;
@@ -834,6 +817,9 @@ static void login_rsp(struct srp_event_struct *evt_struct)
834 return; 817 return;
835 } 818 }
836 819
820 /* If we had any pending I/Os, kick them */
821 scsi_unblock_requests(hostdata->host);
822
837 send_mad_adapter_info(hostdata); 823 send_mad_adapter_info(hostdata);
838 return; 824 return;
839} 825}
@@ -862,6 +848,7 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
862 init_timeout * HZ); 848 init_timeout * HZ);
863 849
864 login = &evt_struct->iu.srp.login_req; 850 login = &evt_struct->iu.srp.login_req;
851 memset(login, 0x00, sizeof(struct srp_login_req));
865 login->type = SRP_LOGIN_REQ_TYPE; 852 login->type = SRP_LOGIN_REQ_TYPE;
866 login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu); 853 login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu);
867 login->required_buffer_formats = 0x0006; 854 login->required_buffer_formats = 0x0006;
@@ -1122,7 +1109,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1122 * purge_requests: Our virtual adapter just shut down. purge any sent requests 1109 * purge_requests: Our virtual adapter just shut down. purge any sent requests
1123 * @hostdata: the adapter 1110 * @hostdata: the adapter
1124 */ 1111 */
1125static void purge_requests(struct ibmvscsi_host_data *hostdata) 1112static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
1126{ 1113{
1127 struct srp_event_struct *tmp_evt, *pos; 1114 struct srp_event_struct *tmp_evt, *pos;
1128 unsigned long flags; 1115 unsigned long flags;
@@ -1131,7 +1118,7 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata)
1131 list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) { 1118 list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) {
1132 list_del(&tmp_evt->list); 1119 list_del(&tmp_evt->list);
1133 if (tmp_evt->cmnd) { 1120 if (tmp_evt->cmnd) {
1134 tmp_evt->cmnd->result = (DID_ERROR << 16); 1121 tmp_evt->cmnd->result = (error_code << 16);
1135 unmap_cmd_data(&tmp_evt->iu.srp.cmd, 1122 unmap_cmd_data(&tmp_evt->iu.srp.cmd,
1136 tmp_evt, 1123 tmp_evt,
1137 tmp_evt->hostdata->dev); 1124 tmp_evt->hostdata->dev);
@@ -1186,12 +1173,30 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
1186 printk(KERN_ERR "ibmvscsi: unknown crq message type\n"); 1173 printk(KERN_ERR "ibmvscsi: unknown crq message type\n");
1187 } 1174 }
1188 return; 1175 return;
1189 case 0xFF: /* Hypervisor telling us the connection is closed */ 1176 case 0xFF: /* Hypervisor telling us the connection is closed */
1190 printk(KERN_INFO "ibmvscsi: Virtual adapter failed!\n"); 1177 scsi_block_requests(hostdata->host);
1178 if (crq->format == 0x06) {
1179 /* We need to re-setup the interpartition connection */
1180 printk(KERN_INFO
1181 "ibmvscsi: Re-enabling adapter!\n");
1182 purge_requests(hostdata, DID_REQUEUE);
1183 if (ibmvscsi_reenable_crq_queue(&hostdata->queue,
1184 hostdata) == 0)
1185 if (ibmvscsi_send_crq(hostdata,
1186 0xC001000000000000LL, 0))
1187 printk(KERN_ERR
1188 "ibmvscsi: transmit error after"
1189 " enable\n");
1190 } else {
1191 printk(KERN_INFO
1192 "ibmvscsi: Virtual adapter failed rc %d!\n",
1193 crq->format);
1191 1194
1192 atomic_set(&hostdata->request_limit, -1); 1195 atomic_set(&hostdata->request_limit, -1);
1193 purge_requests(hostdata); 1196 purge_requests(hostdata, DID_ERROR);
1194 ibmvscsi_reset_crq_queue(&hostdata->queue, hostdata); 1197 ibmvscsi_reset_crq_queue(&hostdata->queue, hostdata);
1198 }
1199 scsi_unblock_requests(hostdata->host);
1195 return; 1200 return;
1196 case 0x80: /* real payload */ 1201 case 0x80: /* real payload */
1197 break; 1202 break;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 5b0edd1f1921..4550d71e4744 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -103,6 +103,9 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
103int ibmvscsi_reset_crq_queue(struct crq_queue *queue, 103int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
104 struct ibmvscsi_host_data *hostdata); 104 struct ibmvscsi_host_data *hostdata);
105 105
106int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,
107 struct ibmvscsi_host_data *hostdata);
108
106void ibmvscsi_handle_crq(struct viosrp_crq *crq, 109void ibmvscsi_handle_crq(struct viosrp_crq *crq,
107 struct ibmvscsi_host_data *hostdata); 110 struct ibmvscsi_host_data *hostdata);
108int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, 111int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata,
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
index ce15d9e39621..7eed0b098171 100644
--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
+++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
@@ -124,6 +124,19 @@ int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
124} 124}
125 125
126/** 126/**
127 * reenable_crq_queue: - reenables a crq after a failure
128 * @queue: crq_queue to initialize and register
129 * @hostdata: ibmvscsi_host_data of host
130 *
131 * no-op for iSeries
132 */
133int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,
134 struct ibmvscsi_host_data *hostdata)
135{
136 return 0;
137}
138
139/**
127 * ibmvscsi_send_crq: - Send a CRQ 140 * ibmvscsi_send_crq: - Send a CRQ
128 * @hostdata: the adapter 141 * @hostdata: the adapter
129 * @word1: the first 64 bits of the data 142 * @word1: the first 64 bits of the data
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 75db2f5c545e..f47dd87c05e7 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -281,6 +281,28 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
281} 281}
282 282
283/** 283/**
284 * reenable_crq_queue: - reenables a crq after
285 * @queue: crq_queue to initialize and register
286 * @hostdata: ibmvscsi_host_data of host
287 *
288 */
289int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,
290 struct ibmvscsi_host_data *hostdata)
291{
292 int rc;
293 struct vio_dev *vdev = to_vio_dev(hostdata->dev);
294
295 /* Re-enable the CRQ */
296 do {
297 rc = plpar_hcall_norets(H_ENABLE_CRQ, vdev->unit_address);
298 } while ((rc == H_InProgress) || (rc == H_Busy) || (H_isLongBusy(rc)));
299
300 if (rc)
301 printk(KERN_ERR "ibmvscsi: Error %d enabling adapter\n", rc);
302 return rc;
303}
304
305/**
284 * reset_crq_queue: - resets a crq after a failure 306 * reset_crq_queue: - resets a crq after a failure
285 * @queue: crq_queue to initialize and register 307 * @queue: crq_queue to initialize and register
286 * @hostdata: ibmvscsi_host_data of host 308 * @hostdata: ibmvscsi_host_data of host
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index e5e1ca44e1ee..86c546164da9 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -3499,6 +3499,7 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp)
3499 int device_error; 3499 int device_error;
3500 uint32_t transfer_len; 3500 uint32_t transfer_len;
3501 IPS_DCDB_TABLE_TAPE *tapeDCDB; 3501 IPS_DCDB_TABLE_TAPE *tapeDCDB;
3502 IPS_SCSI_INQ_DATA inquiryData;
3502 3503
3503 METHOD_TRACE("ips_map_status", 1); 3504 METHOD_TRACE("ips_map_status", 1);
3504 3505
@@ -3557,13 +3558,13 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp)
3557 errcode = DID_OK; 3558 errcode = DID_OK;
3558 3559
3559 /* Restrict access to physical DASD */ 3560 /* Restrict access to physical DASD */
3560 if ((scb->scsi_cmd->cmnd[0] == INQUIRY) && 3561 if (scb->scsi_cmd->cmnd[0] == INQUIRY) {
3561 ((((char *) scb->scsi_cmd-> 3562 ips_scmd_buf_read(scb->scsi_cmd,
3562 buffer)[0] & 0x1f) == TYPE_DISK)) { 3563 &inquiryData, sizeof (inquiryData));
3563 /* underflow -- no error */ 3564 if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK) {
3564 /* restrict access to physical DASD */ 3565 errcode = DID_TIME_OUT;
3565 errcode = DID_TIME_OUT; 3566 break;
3566 break; 3567 }
3567 } 3568 }
3568 } else 3569 } else
3569 errcode = DID_ERROR; 3570 errcode = DID_ERROR;
@@ -4135,6 +4136,7 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)
4135 uint8_t basic_status; 4136 uint8_t basic_status;
4136 uint8_t ext_status; 4137 uint8_t ext_status;
4137 int errcode; 4138 int errcode;
4139 IPS_SCSI_INQ_DATA inquiryData;
4138 4140
4139 METHOD_TRACE("ips_chkstatus", 1); 4141 METHOD_TRACE("ips_chkstatus", 1);
4140 4142
@@ -4255,11 +4257,11 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)
4255 scb->scsi_cmd->result = errcode << 16; 4257 scb->scsi_cmd->result = errcode << 16;
4256 } else { /* bus == 0 */ 4258 } else { /* bus == 0 */
4257 /* restrict access to physical drives */ 4259 /* restrict access to physical drives */
4258 if ((scb->scsi_cmd->cmnd[0] == INQUIRY) && 4260 if (scb->scsi_cmd->cmnd[0] == INQUIRY) {
4259 ((((char *) scb->scsi_cmd->buffer)[0] & 0x1f) == 4261 ips_scmd_buf_read(scb->scsi_cmd,
4260 TYPE_DISK)) { 4262 &inquiryData, sizeof (inquiryData));
4261 4263 if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK)
4262 scb->scsi_cmd->result = DID_TIME_OUT << 16; 4264 scb->scsi_cmd->result = DID_TIME_OUT << 16;
4263 } 4265 }
4264 } /* else */ 4266 } /* else */
4265 } else { /* recovered error / success */ 4267 } else { /* recovered error / success */
@@ -5012,7 +5014,7 @@ ips_init_copperhead(ips_ha_t * ha)
5012 break; 5014 break;
5013 5015
5014 /* Delay for 1 Second */ 5016 /* Delay for 1 Second */
5015 MDELAY(IPS_ONE_SEC); 5017 msleep(IPS_ONE_SEC);
5016 } 5018 }
5017 5019
5018 if (j >= 45) 5020 if (j >= 45)
@@ -5038,7 +5040,7 @@ ips_init_copperhead(ips_ha_t * ha)
5038 break; 5040 break;
5039 5041
5040 /* Delay for 1 Second */ 5042 /* Delay for 1 Second */
5041 MDELAY(IPS_ONE_SEC); 5043 msleep(IPS_ONE_SEC);
5042 } 5044 }
5043 5045
5044 if (j >= 240) 5046 if (j >= 240)
@@ -5056,7 +5058,7 @@ ips_init_copperhead(ips_ha_t * ha)
5056 break; 5058 break;
5057 5059
5058 /* Delay for 1 Second */ 5060 /* Delay for 1 Second */
5059 MDELAY(IPS_ONE_SEC); 5061 msleep(IPS_ONE_SEC);
5060 } 5062 }
5061 5063
5062 if (i >= 240) 5064 if (i >= 240)
@@ -5106,7 +5108,7 @@ ips_init_copperhead_memio(ips_ha_t * ha)
5106 break; 5108 break;
5107 5109
5108 /* Delay for 1 Second */ 5110 /* Delay for 1 Second */
5109 MDELAY(IPS_ONE_SEC); 5111 msleep(IPS_ONE_SEC);
5110 } 5112 }
5111 5113
5112 if (j >= 45) 5114 if (j >= 45)
@@ -5132,7 +5134,7 @@ ips_init_copperhead_memio(ips_ha_t * ha)
5132 break; 5134 break;
5133 5135
5134 /* Delay for 1 Second */ 5136 /* Delay for 1 Second */
5135 MDELAY(IPS_ONE_SEC); 5137 msleep(IPS_ONE_SEC);
5136 } 5138 }
5137 5139
5138 if (j >= 240) 5140 if (j >= 240)
@@ -5150,7 +5152,7 @@ ips_init_copperhead_memio(ips_ha_t * ha)
5150 break; 5152 break;
5151 5153
5152 /* Delay for 1 Second */ 5154 /* Delay for 1 Second */
5153 MDELAY(IPS_ONE_SEC); 5155 msleep(IPS_ONE_SEC);
5154 } 5156 }
5155 5157
5156 if (i >= 240) 5158 if (i >= 240)
@@ -5202,7 +5204,7 @@ ips_init_morpheus(ips_ha_t * ha)
5202 break; 5204 break;
5203 5205
5204 /* Delay for 1 Second */ 5206 /* Delay for 1 Second */
5205 MDELAY(IPS_ONE_SEC); 5207 msleep(IPS_ONE_SEC);
5206 } 5208 }
5207 5209
5208 if (i >= 45) { 5210 if (i >= 45) {
@@ -5228,7 +5230,7 @@ ips_init_morpheus(ips_ha_t * ha)
5228 if (Post != 0x4F00) 5230 if (Post != 0x4F00)
5229 break; 5231 break;
5230 /* Delay for 1 Second */ 5232 /* Delay for 1 Second */
5231 MDELAY(IPS_ONE_SEC); 5233 msleep(IPS_ONE_SEC);
5232 } 5234 }
5233 5235
5234 if (i >= 120) { 5236 if (i >= 120) {
@@ -5258,7 +5260,7 @@ ips_init_morpheus(ips_ha_t * ha)
5258 break; 5260 break;
5259 5261
5260 /* Delay for 1 Second */ 5262 /* Delay for 1 Second */
5261 MDELAY(IPS_ONE_SEC); 5263 msleep(IPS_ONE_SEC);
5262 } 5264 }
5263 5265
5264 if (i >= 240) { 5266 if (i >= 240) {
@@ -5318,12 +5320,12 @@ ips_reset_copperhead(ips_ha_t * ha)
5318 outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR); 5320 outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR);
5319 5321
5320 /* Delay for 1 Second */ 5322 /* Delay for 1 Second */
5321 MDELAY(IPS_ONE_SEC); 5323 msleep(IPS_ONE_SEC);
5322 5324
5323 outb(0, ha->io_addr + IPS_REG_SCPR); 5325 outb(0, ha->io_addr + IPS_REG_SCPR);
5324 5326
5325 /* Delay for 1 Second */ 5327 /* Delay for 1 Second */
5326 MDELAY(IPS_ONE_SEC); 5328 msleep(IPS_ONE_SEC);
5327 5329
5328 if ((*ha->func.init) (ha)) 5330 if ((*ha->func.init) (ha))
5329 break; 5331 break;
@@ -5363,12 +5365,12 @@ ips_reset_copperhead_memio(ips_ha_t * ha)
5363 writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR); 5365 writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR);
5364 5366
5365 /* Delay for 1 Second */ 5367 /* Delay for 1 Second */
5366 MDELAY(IPS_ONE_SEC); 5368 msleep(IPS_ONE_SEC);
5367 5369
5368 writeb(0, ha->mem_ptr + IPS_REG_SCPR); 5370 writeb(0, ha->mem_ptr + IPS_REG_SCPR);
5369 5371
5370 /* Delay for 1 Second */ 5372 /* Delay for 1 Second */
5371 MDELAY(IPS_ONE_SEC); 5373 msleep(IPS_ONE_SEC);
5372 5374
5373 if ((*ha->func.init) (ha)) 5375 if ((*ha->func.init) (ha))
5374 break; 5376 break;
@@ -5409,7 +5411,7 @@ ips_reset_morpheus(ips_ha_t * ha)
5409 writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR); 5411 writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR);
5410 5412
5411 /* Delay for 5 Seconds */ 5413 /* Delay for 5 Seconds */
5412 MDELAY(5 * IPS_ONE_SEC); 5414 msleep(5 * IPS_ONE_SEC);
5413 5415
5414 /* Do a PCI config read to wait for adapter */ 5416 /* Do a PCI config read to wait for adapter */
5415 pci_read_config_byte(ha->pcidev, 4, &junk); 5417 pci_read_config_byte(ha->pcidev, 4, &junk);
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 511ed52a5807..a487f414960e 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.00-rc4 13 * Version : v00.00.02.02
14 * 14 *
15 * Authors: 15 * Authors:
16 * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> 16 * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com>
@@ -55,13 +55,13 @@ static struct pci_device_id megasas_pci_table[] = {
55 55
56 { 56 {
57 PCI_VENDOR_ID_LSI_LOGIC, 57 PCI_VENDOR_ID_LSI_LOGIC,
58 PCI_DEVICE_ID_LSI_SAS1064R, 58 PCI_DEVICE_ID_LSI_SAS1064R, // xscale IOP
59 PCI_ANY_ID, 59 PCI_ANY_ID,
60 PCI_ANY_ID, 60 PCI_ANY_ID,
61 }, 61 },
62 { 62 {
63 PCI_VENDOR_ID_DELL, 63 PCI_VENDOR_ID_DELL,
64 PCI_DEVICE_ID_DELL_PERC5, 64 PCI_DEVICE_ID_DELL_PERC5, // xscale IOP
65 PCI_ANY_ID, 65 PCI_ANY_ID,
66 PCI_ANY_ID, 66 PCI_ANY_ID,
67 }, 67 },
@@ -119,12 +119,18 @@ megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
119 spin_unlock_irqrestore(&instance->cmd_pool_lock, flags); 119 spin_unlock_irqrestore(&instance->cmd_pool_lock, flags);
120} 120}
121 121
122
123/**
124* The following functions are defined for xscale
125* (deviceid : 1064R, PERC5) controllers
126*/
127
122/** 128/**
123 * megasas_enable_intr - Enables interrupts 129 * megasas_enable_intr_xscale - Enables interrupts
124 * @regs: MFI register set 130 * @regs: MFI register set
125 */ 131 */
126static inline void 132static inline void
127megasas_enable_intr(struct megasas_register_set __iomem * regs) 133megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs)
128{ 134{
129 writel(1, &(regs)->outbound_intr_mask); 135 writel(1, &(regs)->outbound_intr_mask);
130 136
@@ -133,13 +139,73 @@ megasas_enable_intr(struct megasas_register_set __iomem * regs)
133} 139}
134 140
135/** 141/**
142 * megasas_read_fw_status_reg_xscale - returns the current FW status value
143 * @regs: MFI register set
144 */
145static u32
146megasas_read_fw_status_reg_xscale(struct megasas_register_set __iomem * regs)
147{
148 return readl(&(regs)->outbound_msg_0);
149}
150/**
151 * megasas_clear_interrupt_xscale - Check & clear interrupt
152 * @regs: MFI register set
153 */
154static int
155megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
156{
157 u32 status;
158 /*
159 * Check if it is our interrupt
160 */
161 status = readl(&regs->outbound_intr_status);
162
163 if (!(status & MFI_OB_INTR_STATUS_MASK)) {
164 return 1;
165 }
166
167 /*
168 * Clear the interrupt by writing back the same value
169 */
170 writel(status, &regs->outbound_intr_status);
171
172 return 0;
173}
174
175/**
176 * megasas_fire_cmd_xscale - Sends command to the FW
177 * @frame_phys_addr : Physical address of cmd
178 * @frame_count : Number of frames for the command
179 * @regs : MFI register set
180 */
181static inline void
182megasas_fire_cmd_xscale(dma_addr_t frame_phys_addr,u32 frame_count, struct megasas_register_set __iomem *regs)
183{
184 writel((frame_phys_addr >> 3)|(frame_count),
185 &(regs)->inbound_queue_port);
186}
187
188static struct megasas_instance_template megasas_instance_template_xscale = {
189
190 .fire_cmd = megasas_fire_cmd_xscale,
191 .enable_intr = megasas_enable_intr_xscale,
192 .clear_intr = megasas_clear_intr_xscale,
193 .read_fw_status_reg = megasas_read_fw_status_reg_xscale,
194};
195
196/**
197* This is the end of set of functions & definitions specific
198* to xscale (deviceid : 1064R, PERC5) controllers
199*/
200
201/**
136 * megasas_disable_intr - Disables interrupts 202 * megasas_disable_intr - Disables interrupts
137 * @regs: MFI register set 203 * @regs: MFI register set
138 */ 204 */
139static inline void 205static inline void
140megasas_disable_intr(struct megasas_register_set __iomem * regs) 206megasas_disable_intr(struct megasas_register_set __iomem * regs)
141{ 207{
142 u32 mask = readl(&regs->outbound_intr_mask) & (~0x00000001); 208 u32 mask = 0x1f;
143 writel(mask, &regs->outbound_intr_mask); 209 writel(mask, &regs->outbound_intr_mask);
144 210
145 /* Dummy readl to force pci flush */ 211 /* Dummy readl to force pci flush */
@@ -167,8 +233,7 @@ megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd)
167 /* 233 /*
168 * Issue the frame using inbound queue port 234 * Issue the frame using inbound queue port
169 */ 235 */
170 writel(cmd->frame_phys_addr >> 3, 236 instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set);
171 &instance->reg_set->inbound_queue_port);
172 237
173 /* 238 /*
174 * Wait for cmd_status to change 239 * Wait for cmd_status to change
@@ -198,8 +263,7 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance,
198{ 263{
199 cmd->cmd_status = ENODATA; 264 cmd->cmd_status = ENODATA;
200 265
201 writel(cmd->frame_phys_addr >> 3, 266 instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set);
202 &instance->reg_set->inbound_queue_port);
203 267
204 wait_event(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA)); 268 wait_event(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA));
205 269
@@ -242,8 +306,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance,
242 cmd->sync_cmd = 1; 306 cmd->sync_cmd = 1;
243 cmd->cmd_status = 0xFF; 307 cmd->cmd_status = 0xFF;
244 308
245 writel(cmd->frame_phys_addr >> 3, 309 instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set);
246 &instance->reg_set->inbound_queue_port);
247 310
248 /* 311 /*
249 * Wait for this cmd to complete 312 * Wait for this cmd to complete
@@ -558,112 +621,29 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
558} 621}
559 622
560/** 623/**
561 * megasas_build_cmd - Prepares a command packet 624 * megasas_is_ldio - Checks if the cmd is for logical drive
562 * @instance: Adapter soft state 625 * @scmd: SCSI command
563 * @scp: SCSI command 626 *
564 * @frame_count: [OUT] Number of frames used to prepare this command 627 * Called by megasas_queue_command to find out if the command to be queued
628 * is a logical drive command
565 */ 629 */
566static struct megasas_cmd *megasas_build_cmd(struct megasas_instance 630static inline int megasas_is_ldio(struct scsi_cmnd *cmd)
567 *instance,
568 struct scsi_cmnd *scp,
569 int *frame_count)
570{ 631{
571 u32 logical_cmd; 632 if (!MEGASAS_IS_LOGICAL(cmd))
572 struct megasas_cmd *cmd; 633 return 0;
573 634 switch (cmd->cmnd[0]) {
574 /* 635 case READ_10:
575 * Find out if this is logical or physical drive command. 636 case WRITE_10:
576 */ 637 case READ_12:
577 logical_cmd = MEGASAS_IS_LOGICAL(scp); 638 case WRITE_12:
578 639 case READ_6:
579 /* 640 case WRITE_6:
580 * Logical drive command 641 case READ_16:
581 */ 642 case WRITE_16:
582 if (logical_cmd) { 643 return 1;
583 644 default:
584 if (scp->device->id >= MEGASAS_MAX_LD) { 645 return 0;
585 scp->result = DID_BAD_TARGET << 16;
586 return NULL;
587 }
588
589 switch (scp->cmnd[0]) {
590
591 case READ_10:
592 case WRITE_10:
593 case READ_12:
594 case WRITE_12:
595 case READ_6:
596 case WRITE_6:
597 case READ_16:
598 case WRITE_16:
599 /*
600 * Fail for LUN > 0
601 */
602 if (scp->device->lun) {
603 scp->result = DID_BAD_TARGET << 16;
604 return NULL;
605 }
606
607 cmd = megasas_get_cmd(instance);
608
609 if (!cmd) {
610 scp->result = DID_IMM_RETRY << 16;
611 return NULL;
612 }
613
614 *frame_count = megasas_build_ldio(instance, scp, cmd);
615
616 if (!(*frame_count)) {
617 megasas_return_cmd(instance, cmd);
618 return NULL;
619 }
620
621 return cmd;
622
623 default:
624 /*
625 * Fail for LUN > 0
626 */
627 if (scp->device->lun) {
628 scp->result = DID_BAD_TARGET << 16;
629 return NULL;
630 }
631
632 cmd = megasas_get_cmd(instance);
633
634 if (!cmd) {
635 scp->result = DID_IMM_RETRY << 16;
636 return NULL;
637 }
638
639 *frame_count = megasas_build_dcdb(instance, scp, cmd);
640
641 if (!(*frame_count)) {
642 megasas_return_cmd(instance, cmd);
643 return NULL;
644 }
645
646 return cmd;
647 }
648 } else {
649 cmd = megasas_get_cmd(instance);
650
651 if (!cmd) {
652 scp->result = DID_IMM_RETRY << 16;
653 return NULL;
654 }
655
656 *frame_count = megasas_build_dcdb(instance, scp, cmd);
657
658 if (!(*frame_count)) {
659 megasas_return_cmd(instance, cmd);
660 return NULL;
661 }
662
663 return cmd;
664 } 646 }
665
666 return NULL;
667} 647}
668 648
669/** 649/**
@@ -684,13 +664,27 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
684 scmd->scsi_done = done; 664 scmd->scsi_done = done;
685 scmd->result = 0; 665 scmd->result = 0;
686 666
687 cmd = megasas_build_cmd(instance, scmd, &frame_count); 667 if (MEGASAS_IS_LOGICAL(scmd) &&
688 668 (scmd->device->id >= MEGASAS_MAX_LD || scmd->device->lun)) {
689 if (!cmd) { 669 scmd->result = DID_BAD_TARGET << 16;
690 done(scmd); 670 goto out_done;
691 return 0;
692 } 671 }
693 672
673 cmd = megasas_get_cmd(instance);
674 if (!cmd)
675 return SCSI_MLQUEUE_HOST_BUSY;
676
677 /*
678 * Logical drive command
679 */
680 if (megasas_is_ldio(scmd))
681 frame_count = megasas_build_ldio(instance, scmd, cmd);
682 else
683 frame_count = megasas_build_dcdb(instance, scmd, cmd);
684
685 if (!frame_count)
686 goto out_return_cmd;
687
694 cmd->scmd = scmd; 688 cmd->scmd = scmd;
695 scmd->SCp.ptr = (char *)cmd; 689 scmd->SCp.ptr = (char *)cmd;
696 scmd->SCp.sent_command = jiffies; 690 scmd->SCp.sent_command = jiffies;
@@ -702,10 +696,15 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
702 instance->fw_outstanding++; 696 instance->fw_outstanding++;
703 spin_unlock_irqrestore(&instance->instance_lock, flags); 697 spin_unlock_irqrestore(&instance->instance_lock, flags);
704 698
705 writel(((cmd->frame_phys_addr >> 3) | (cmd->frame_count - 1)), 699 instance->instancet->fire_cmd(cmd->frame_phys_addr ,cmd->frame_count-1,instance->reg_set);
706 &instance->reg_set->inbound_queue_port);
707 700
708 return 0; 701 return 0;
702
703 out_return_cmd:
704 megasas_return_cmd(instance, cmd);
705 out_done:
706 done(scmd);
707 return 0;
709} 708}
710 709
711/** 710/**
@@ -1108,7 +1107,6 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1108static int 1107static int
1109megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) 1108megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
1110{ 1109{
1111 u32 status;
1112 u32 producer; 1110 u32 producer;
1113 u32 consumer; 1111 u32 consumer;
1114 u32 context; 1112 u32 context;
@@ -1116,17 +1114,10 @@ megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
1116 1114
1117 /* 1115 /*
1118 * Check if it is our interrupt 1116 * Check if it is our interrupt
1117 * Clear the interrupt
1119 */ 1118 */
1120 status = readl(&instance->reg_set->outbound_intr_status); 1119 if(instance->instancet->clear_intr(instance->reg_set))
1121
1122 if (!(status & MFI_OB_INTR_STATUS_MASK)) {
1123 return IRQ_NONE; 1120 return IRQ_NONE;
1124 }
1125
1126 /*
1127 * Clear the interrupt by writing back the same value
1128 */
1129 writel(status, &instance->reg_set->outbound_intr_status);
1130 1121
1131 producer = *instance->producer; 1122 producer = *instance->producer;
1132 consumer = *instance->consumer; 1123 consumer = *instance->consumer;
@@ -1160,7 +1151,7 @@ static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs)
1160 1151
1161/** 1152/**
1162 * megasas_transition_to_ready - Move the FW to READY state 1153 * megasas_transition_to_ready - Move the FW to READY state
1163 * @reg_set: MFI register set 1154 * @instance: Adapter soft state
1164 * 1155 *
1165 * During the initialization, FW passes can potentially be in any one of 1156 * During the initialization, FW passes can potentially be in any one of
1166 * several possible states. If the FW in operational, waiting-for-handshake 1157 * several possible states. If the FW in operational, waiting-for-handshake
@@ -1168,14 +1159,14 @@ static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs)
1168 * has to wait for the ready state. 1159 * has to wait for the ready state.
1169 */ 1160 */
1170static int 1161static int
1171megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set) 1162megasas_transition_to_ready(struct megasas_instance* instance)
1172{ 1163{
1173 int i; 1164 int i;
1174 u8 max_wait; 1165 u8 max_wait;
1175 u32 fw_state; 1166 u32 fw_state;
1176 u32 cur_state; 1167 u32 cur_state;
1177 1168
1178 fw_state = readl(&reg_set->outbound_msg_0) & MFI_STATE_MASK; 1169 fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & MFI_STATE_MASK;
1179 1170
1180 while (fw_state != MFI_STATE_READY) { 1171 while (fw_state != MFI_STATE_READY) {
1181 1172
@@ -1193,7 +1184,7 @@ megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set)
1193 * Set the CLR bit in inbound doorbell 1184 * Set the CLR bit in inbound doorbell
1194 */ 1185 */
1195 writel(MFI_INIT_CLEAR_HANDSHAKE, 1186 writel(MFI_INIT_CLEAR_HANDSHAKE,
1196 &reg_set->inbound_doorbell); 1187 &instance->reg_set->inbound_doorbell);
1197 1188
1198 max_wait = 2; 1189 max_wait = 2;
1199 cur_state = MFI_STATE_WAIT_HANDSHAKE; 1190 cur_state = MFI_STATE_WAIT_HANDSHAKE;
@@ -1203,8 +1194,8 @@ megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set)
1203 /* 1194 /*
1204 * Bring it to READY state; assuming max wait 2 secs 1195 * Bring it to READY state; assuming max wait 2 secs
1205 */ 1196 */
1206 megasas_disable_intr(reg_set); 1197 megasas_disable_intr(instance->reg_set);
1207 writel(MFI_INIT_READY, &reg_set->inbound_doorbell); 1198 writel(MFI_INIT_READY, &instance->reg_set->inbound_doorbell);
1208 1199
1209 max_wait = 10; 1200 max_wait = 10;
1210 cur_state = MFI_STATE_OPERATIONAL; 1201 cur_state = MFI_STATE_OPERATIONAL;
@@ -1253,8 +1244,8 @@ megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set)
1253 * The cur_state should not last for more than max_wait secs 1244 * The cur_state should not last for more than max_wait secs
1254 */ 1245 */
1255 for (i = 0; i < (max_wait * 1000); i++) { 1246 for (i = 0; i < (max_wait * 1000); i++) {
1256 fw_state = MFI_STATE_MASK & 1247 fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) &
1257 readl(&reg_set->outbound_msg_0); 1248 MFI_STATE_MASK ;
1258 1249
1259 if (fw_state == cur_state) { 1250 if (fw_state == cur_state) {
1260 msleep(1); 1251 msleep(1);
@@ -1616,18 +1607,20 @@ static int megasas_init_mfi(struct megasas_instance *instance)
1616 1607
1617 reg_set = instance->reg_set; 1608 reg_set = instance->reg_set;
1618 1609
1610 instance->instancet = &megasas_instance_template_xscale;
1611
1619 /* 1612 /*
1620 * We expect the FW state to be READY 1613 * We expect the FW state to be READY
1621 */ 1614 */
1622 if (megasas_transition_to_ready(instance->reg_set)) 1615 if (megasas_transition_to_ready(instance))
1623 goto fail_ready_state; 1616 goto fail_ready_state;
1624 1617
1625 /* 1618 /*
1626 * Get various operational parameters from status register 1619 * Get various operational parameters from status register
1627 */ 1620 */
1628 instance->max_fw_cmds = readl(&reg_set->outbound_msg_0) & 0x00FFFF; 1621 instance->max_fw_cmds = instance->instancet->read_fw_status_reg(reg_set) & 0x00FFFF;
1629 instance->max_num_sge = (readl(&reg_set->outbound_msg_0) & 0xFF0000) >> 1622 instance->max_num_sge = (instance->instancet->read_fw_status_reg(reg_set) & 0xFF0000) >>
1630 0x10; 1623 0x10;
1631 /* 1624 /*
1632 * Create a pool of commands 1625 * Create a pool of commands
1633 */ 1626 */
@@ -1936,8 +1929,7 @@ megasas_register_aen(struct megasas_instance *instance, u32 seq_num,
1936 /* 1929 /*
1937 * Issue the aen registration frame 1930 * Issue the aen registration frame
1938 */ 1931 */
1939 writel(cmd->frame_phys_addr >> 3, 1932 instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set);
1940 &instance->reg_set->inbound_queue_port);
1941 1933
1942 return 0; 1934 return 0;
1943} 1935}
@@ -2126,7 +2118,7 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2126 goto fail_irq; 2118 goto fail_irq;
2127 } 2119 }
2128 2120
2129 megasas_enable_intr(instance->reg_set); 2121 instance->instancet->enable_intr(instance->reg_set);
2130 2122
2131 /* 2123 /*
2132 * Store instance in PCI softstate 2124 * Store instance in PCI softstate
@@ -2681,9 +2673,8 @@ megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd,
2681 unsigned long arg) 2673 unsigned long arg)
2682{ 2674{
2683 switch (cmd) { 2675 switch (cmd) {
2684 case MEGASAS_IOC_FIRMWARE:{ 2676 case MEGASAS_IOC_FIRMWARE32:
2685 return megasas_mgmt_compat_ioctl_fw(file, arg); 2677 return megasas_mgmt_compat_ioctl_fw(file, arg);
2686 }
2687 case MEGASAS_IOC_GET_AEN: 2678 case MEGASAS_IOC_GET_AEN:
2688 return megasas_mgmt_ioctl_aen(file, arg); 2679 return megasas_mgmt_ioctl_aen(file, arg);
2689 } 2680 }
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index eaec9d531424..d6d166c0663f 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -18,10 +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.00-rc4" 21#define MEGASAS_VERSION "00.00.02.02"
22#define MEGASAS_RELDATE "Sep 16, 2005" 22#define MEGASAS_RELDATE "Jan 23, 2006"
23#define MEGASAS_EXT_VERSION "Fri Sep 16 12:37:08 EDT 2005" 23#define MEGASAS_EXT_VERSION "Mon Jan 23 14:09:01 PST 2006"
24
25/* 24/*
26 * ===================================== 25 * =====================================
27 * MegaRAID SAS MFI firmware definitions 26 * MegaRAID SAS MFI firmware definitions
@@ -1013,6 +1012,16 @@ struct megasas_evt_detail {
1013 1012
1014} __attribute__ ((packed)); 1013} __attribute__ ((packed));
1015 1014
1015 struct megasas_instance_template {
1016 void (*fire_cmd)(dma_addr_t ,u32 ,struct megasas_register_set __iomem *);
1017
1018 void (*enable_intr)(struct megasas_register_set __iomem *) ;
1019
1020 int (*clear_intr)(struct megasas_register_set __iomem *);
1021
1022 u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *);
1023 };
1024
1016struct megasas_instance { 1025struct megasas_instance {
1017 1026
1018 u32 *producer; 1027 u32 *producer;
@@ -1056,6 +1065,8 @@ struct megasas_instance {
1056 u32 fw_outstanding; 1065 u32 fw_outstanding;
1057 u32 hw_crit_error; 1066 u32 hw_crit_error;
1058 spinlock_t instance_lock; 1067 spinlock_t instance_lock;
1068
1069 struct megasas_instance_template *instancet;
1059}; 1070};
1060 1071
1061#define MEGASAS_IS_LOGICAL(scp) \ 1072#define MEGASAS_IS_LOGICAL(scp) \
@@ -1125,11 +1136,10 @@ struct compat_megasas_iocpacket {
1125 struct compat_iovec sgl[MAX_IOCTL_SGE]; 1136 struct compat_iovec sgl[MAX_IOCTL_SGE];
1126} __attribute__ ((packed)); 1137} __attribute__ ((packed));
1127 1138
1128#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct compat_megasas_iocpacket)
1129#else
1130#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
1131#endif 1139#endif
1132 1140
1141#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
1142#define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket)
1133#define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) 1143#define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen)
1134 1144
1135struct megasas_mgmt_info { 1145struct megasas_mgmt_info {
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 0878f95b5449..e0230249fa0f 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -17,9 +17,11 @@
17* General Public License for more details. 17* General Public License for more details.
18* 18*
19******************************************************************************/ 19******************************************************************************/
20#define QLA1280_VERSION "3.25" 20#define QLA1280_VERSION "3.26"
21/***************************************************************************** 21/*****************************************************************************
22 Revision History: 22 Revision History:
23 Rev 3.26, January 16, 2006 Jes Sorensen
24 - Ditch all < 2.6 support
23 Rev 3.25.1, February 10, 2005 Christoph Hellwig 25 Rev 3.25.1, February 10, 2005 Christoph Hellwig
24 - use pci_map_single to map non-S/G requests 26 - use pci_map_single to map non-S/G requests
25 - remove qla1280_proc_info 27 - remove qla1280_proc_info
@@ -356,25 +358,18 @@
356#include <asm/types.h> 358#include <asm/types.h>
357#include <asm/system.h> 359#include <asm/system.h>
358 360
359#if LINUX_VERSION_CODE >= 0x020545
360#include <scsi/scsi.h> 361#include <scsi/scsi.h>
361#include <scsi/scsi_cmnd.h> 362#include <scsi/scsi_cmnd.h>
362#include <scsi/scsi_device.h> 363#include <scsi/scsi_device.h>
363#include <scsi/scsi_host.h> 364#include <scsi/scsi_host.h>
364#include <scsi/scsi_tcq.h> 365#include <scsi/scsi_tcq.h>
365#else
366#include <linux/blk.h>
367#include "scsi.h"
368#include <scsi/scsi_host.h>
369#include "sd.h"
370#endif
371 366
372#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 367#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
373#include <asm/sn/io.h> 368#include <asm/sn/io.h>
374#endif 369#endif
375 370
376#if LINUX_VERSION_CODE < 0x020407 371#if LINUX_VERSION_CODE < 0x020600
377#error "Kernels older than 2.4.7 are no longer supported" 372#error "Kernels older than 2.6.0 are no longer supported"
378#endif 373#endif
379 374
380 375
@@ -441,52 +436,6 @@
441 436
442#define NVRAM_DELAY() udelay(500) /* 2 microseconds */ 437#define NVRAM_DELAY() udelay(500) /* 2 microseconds */
443 438
444#if LINUX_VERSION_CODE < 0x020500
445#define HOST_LOCK &io_request_lock
446#define irqreturn_t void
447#define IRQ_RETVAL(foo)
448#define MSG_ORDERED_TAG 1
449
450#define DMA_BIDIRECTIONAL SCSI_DATA_UNKNOWN
451#define DMA_TO_DEVICE SCSI_DATA_WRITE
452#define DMA_FROM_DEVICE SCSI_DATA_READ
453#define DMA_NONE SCSI_DATA_NONE
454
455#ifndef HAVE_SECTOR_T
456typedef unsigned int sector_t;
457#endif
458
459static inline void
460scsi_adjust_queue_depth(struct scsi_device *device, int tag, int depth)
461{
462 if (tag) {
463 device->tagged_queue = tag;
464 device->current_tag = 0;
465 }
466 device->queue_depth = depth;
467}
468static inline struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *t, size_t s)
469{
470 return scsi_register(t, s);
471}
472static inline void scsi_host_put(struct Scsi_Host *h)
473{
474 scsi_unregister(h);
475}
476#else
477#define HOST_LOCK ha->host->host_lock
478#endif
479#if LINUX_VERSION_CODE < 0x020600
480#define DEV_SIMPLE_TAGS(device) device->tagged_queue
481/*
482 * Hack around that qla1280_remove_one is called from
483 * qla1280_release in 2.4
484 */
485#undef __devexit
486#define __devexit
487#else
488#define DEV_SIMPLE_TAGS(device) device->simple_tags
489#endif
490#if defined(__ia64__) && !defined(ia64_platform_is) 439#if defined(__ia64__) && !defined(ia64_platform_is)
491#define ia64_platform_is(foo) (!strcmp(x, platform_name)) 440#define ia64_platform_is(foo) (!strcmp(x, platform_name))
492#endif 441#endif
@@ -506,9 +455,6 @@ static void qla1280_remove_one(struct pci_dev *);
506 * QLogic Driver Support Function Prototypes. 455 * QLogic Driver Support Function Prototypes.
507 */ 456 */
508static void qla1280_done(struct scsi_qla_host *); 457static void qla1280_done(struct scsi_qla_host *);
509#if LINUX_VERSION_CODE < 0x020545
510static void qla1280_get_target_options(struct scsi_cmnd *, struct scsi_qla_host *);
511#endif
512static int qla1280_get_token(char *); 458static int qla1280_get_token(char *);
513static int qla1280_setup(char *s) __init; 459static int qla1280_setup(char *s) __init;
514 460
@@ -610,11 +556,7 @@ __setup("qla1280=", qla1280_setup);
610#define CMD_SNSLEN(Cmnd) sizeof(Cmnd->sense_buffer) 556#define CMD_SNSLEN(Cmnd) sizeof(Cmnd->sense_buffer)
611#define CMD_RESULT(Cmnd) Cmnd->result 557#define CMD_RESULT(Cmnd) Cmnd->result
612#define CMD_HANDLE(Cmnd) Cmnd->host_scribble 558#define CMD_HANDLE(Cmnd) Cmnd->host_scribble
613#if LINUX_VERSION_CODE < 0x020545
614#define CMD_REQUEST(Cmnd) Cmnd->request.cmd
615#else
616#define CMD_REQUEST(Cmnd) Cmnd->request->cmd 559#define CMD_REQUEST(Cmnd) Cmnd->request->cmd
617#endif
618 560
619#define CMD_HOST(Cmnd) Cmnd->device->host 561#define CMD_HOST(Cmnd) Cmnd->device->host
620#define SCSI_BUS_32(Cmnd) Cmnd->device->channel 562#define SCSI_BUS_32(Cmnd) Cmnd->device->channel
@@ -1064,10 +1006,10 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)
1064 add_timer(&timer); 1006 add_timer(&timer);
1065 1007
1066 /* wait for the action to complete (or the timer to expire) */ 1008 /* wait for the action to complete (or the timer to expire) */
1067 spin_unlock_irq(HOST_LOCK); 1009 spin_unlock_irq(ha->host->host_lock);
1068 wait_for_completion(&wait); 1010 wait_for_completion(&wait);
1069 del_timer_sync(&timer); 1011 del_timer_sync(&timer);
1070 spin_lock_irq(HOST_LOCK); 1012 spin_lock_irq(ha->host->host_lock);
1071 sp->wait = NULL; 1013 sp->wait = NULL;
1072 1014
1073 /* the only action we might get a fail for is abort */ 1015 /* the only action we might get a fail for is abort */
@@ -1173,96 +1115,6 @@ qla1280_biosparam(struct scsi_device *sdev, struct block_device *bdev,
1173 return 0; 1115 return 0;
1174} 1116}
1175 1117
1176#if LINUX_VERSION_CODE < 0x020600
1177static int
1178qla1280_detect(struct scsi_host_template *template)
1179{
1180 struct pci_device_id *id = &qla1280_pci_tbl[0];
1181 struct pci_dev *pdev = NULL;
1182 int num_hosts = 0;
1183
1184 if (sizeof(struct srb) > sizeof(Scsi_Pointer)) {
1185 printk(KERN_WARNING
1186 "qla1280: struct srb too big, aborting\n");
1187 return 0;
1188 }
1189
1190 if ((DMA_BIDIRECTIONAL != PCI_DMA_BIDIRECTIONAL) ||
1191 (DMA_TO_DEVICE != PCI_DMA_TODEVICE) ||
1192 (DMA_FROM_DEVICE != PCI_DMA_FROMDEVICE) ||
1193 (DMA_NONE != PCI_DMA_NONE)) {
1194 printk(KERN_WARNING
1195 "qla1280: dma direction bits don't match\n");
1196 return 0;
1197 }
1198
1199#ifdef MODULE
1200 /*
1201 * If we are called as a module, the qla1280 pointer may not be null
1202 * and it would point to our bootup string, just like on the lilo
1203 * command line. IF not NULL, then process this config string with
1204 * qla1280_setup
1205 *
1206 * Boot time Options
1207 * To add options at boot time add a line to your lilo.conf file like:
1208 * append="qla1280=verbose,max_tags:{{255,255,255,255},{255,255,255,255}}"
1209 * which will result in the first four devices on the first two
1210 * controllers being set to a tagged queue depth of 32.
1211 */
1212 if (qla1280)
1213 qla1280_setup(qla1280);
1214#endif
1215
1216 /* First Initialize QLA12160 on PCI Bus 1 Dev 2 */
1217 while ((pdev = pci_find_device(id->vendor, id->device, pdev))) {
1218 if (pdev->bus->number == 1 && PCI_SLOT(pdev->devfn) == 2) {
1219 if (!qla1280_probe_one(pdev, id))
1220 num_hosts++;
1221 }
1222 }
1223
1224 pdev = NULL;
1225 /* Try and find each different type of adapter we support */
1226 for (id = &qla1280_pci_tbl[0]; id->device; id++) {
1227 while ((pdev = pci_find_device(id->vendor, id->device, pdev))) {
1228 /*
1229 * skip QLA12160 already initialized on
1230 * PCI Bus 1 Dev 2 since we already initialized
1231 * and presented it
1232 */
1233 if (id->device == PCI_DEVICE_ID_QLOGIC_ISP12160 &&
1234 pdev->bus->number == 1 &&
1235 PCI_SLOT(pdev->devfn) == 2)
1236 continue;
1237
1238 if (!qla1280_probe_one(pdev, id))
1239 num_hosts++;
1240 }
1241 }
1242
1243 return num_hosts;
1244}
1245
1246/*
1247 * This looks a bit ugly as we could just pass down host to
1248 * qla1280_remove_one, but I want to keep qla1280_release purely a wrapper
1249 * around pci_driver::remove as used from 2.6 onwards.
1250 */
1251static int
1252qla1280_release(struct Scsi_Host *host)
1253{
1254 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
1255
1256 qla1280_remove_one(ha->pdev);
1257 return 0;
1258}
1259
1260static int
1261qla1280_biosparam_old(Disk * disk, kdev_t dev, int geom[])
1262{
1263 return qla1280_biosparam(disk->device, NULL, disk->capacity, geom);
1264}
1265#endif
1266 1118
1267/* disable risc and host interrupts */ 1119/* disable risc and host interrupts */
1268static inline void 1120static inline void
@@ -1295,7 +1147,7 @@ qla1280_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1295 ENTER_INTR ("qla1280_intr_handler"); 1147 ENTER_INTR ("qla1280_intr_handler");
1296 ha = (struct scsi_qla_host *)dev_id; 1148 ha = (struct scsi_qla_host *)dev_id;
1297 1149
1298 spin_lock(HOST_LOCK); 1150 spin_lock(ha->host->host_lock);
1299 1151
1300 ha->isr_count++; 1152 ha->isr_count++;
1301 reg = ha->iobase; 1153 reg = ha->iobase;
@@ -1311,7 +1163,7 @@ qla1280_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1311 if (!list_empty(&ha->done_q)) 1163 if (!list_empty(&ha->done_q))
1312 qla1280_done(ha); 1164 qla1280_done(ha);
1313 1165
1314 spin_unlock(HOST_LOCK); 1166 spin_unlock(ha->host->host_lock);
1315 1167
1316 qla1280_enable_intrs(ha); 1168 qla1280_enable_intrs(ha);
1317 1169
@@ -1411,11 +1263,9 @@ qla1280_slave_configure(struct scsi_device *device)
1411 scsi_adjust_queue_depth(device, 0, default_depth); 1263 scsi_adjust_queue_depth(device, 0, default_depth);
1412 } 1264 }
1413 1265
1414#if LINUX_VERSION_CODE > 0x020500
1415 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; 1266 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr;
1416 nv->bus[bus].target[target].parameter.enable_wide = device->wdtr; 1267 nv->bus[bus].target[target].parameter.enable_wide = device->wdtr;
1417 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = device->ppr; 1268 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = device->ppr;
1418#endif
1419 1269
1420 if (driver_setup.no_sync || 1270 if (driver_setup.no_sync ||
1421 (driver_setup.sync_mask && 1271 (driver_setup.sync_mask &&
@@ -1432,38 +1282,14 @@ qla1280_slave_configure(struct scsi_device *device)
1432 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0; 1282 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0;
1433 } 1283 }
1434 1284
1435 spin_lock_irqsave(HOST_LOCK, flags); 1285 spin_lock_irqsave(ha->host->host_lock, flags);
1436 if (nv->bus[bus].target[target].parameter.enable_sync) 1286 if (nv->bus[bus].target[target].parameter.enable_sync)
1437 status = qla1280_set_target_parameters(ha, bus, target); 1287 status = qla1280_set_target_parameters(ha, bus, target);
1438 qla1280_get_target_parameters(ha, device); 1288 qla1280_get_target_parameters(ha, device);
1439 spin_unlock_irqrestore(HOST_LOCK, flags); 1289 spin_unlock_irqrestore(ha->host->host_lock, flags);
1440 return status; 1290 return status;
1441} 1291}
1442 1292
1443#if LINUX_VERSION_CODE < 0x020545
1444/**************************************************************************
1445 * qla1280_select_queue_depth
1446 *
1447 * Sets the queue depth for each SCSI device hanging off the input
1448 * host adapter. We use a queue depth of 2 for devices that do not
1449 * support tagged queueing.
1450 **************************************************************************/
1451static void
1452qla1280_select_queue_depth(struct Scsi_Host *host, struct scsi_device *sdev_q)
1453{
1454 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
1455 struct scsi_device *sdev;
1456
1457 ENTER("qla1280_select_queue_depth");
1458 for (sdev = sdev_q; sdev; sdev = sdev->next)
1459 if (sdev->host == host)
1460 qla1280_slave_configure(sdev);
1461
1462 if (sdev_q)
1463 qla1280_check_for_dead_scsi_bus(ha, sdev_q->channel);
1464 LEAVE("qla1280_select_queue_depth");
1465}
1466#endif
1467 1293
1468/* 1294/*
1469 * qla1280_done 1295 * qla1280_done
@@ -1523,10 +1349,6 @@ qla1280_done(struct scsi_qla_host *ha)
1523 CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; 1349 CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE;
1524 ha->actthreads--; 1350 ha->actthreads--;
1525 1351
1526#if LINUX_VERSION_CODE < 0x020500
1527 if (cmd->cmnd[0] == INQUIRY)
1528 qla1280_get_target_options(cmd, ha);
1529#endif
1530 (*(cmd)->scsi_done)(cmd); 1352 (*(cmd)->scsi_done)(cmd);
1531 1353
1532 if(sp->wait != NULL) 1354 if(sp->wait != NULL)
@@ -1655,9 +1477,7 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha)
1655 struct device_reg __iomem *reg; 1477 struct device_reg __iomem *reg;
1656 int status; 1478 int status;
1657 int bus; 1479 int bus;
1658#if LINUX_VERSION_CODE > 0x020500
1659 unsigned long flags; 1480 unsigned long flags;
1660#endif
1661 1481
1662 ENTER("qla1280_initialize_adapter"); 1482 ENTER("qla1280_initialize_adapter");
1663 1483
@@ -1695,15 +1515,12 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha)
1695 "NVRAM\n"); 1515 "NVRAM\n");
1696 } 1516 }
1697 1517
1698#if LINUX_VERSION_CODE >= 0x020500
1699 /* 1518 /*
1700 * It's necessary to grab the spin here as qla1280_mailbox_command 1519 * It's necessary to grab the spin here as qla1280_mailbox_command
1701 * needs to be able to drop the lock unconditionally to wait 1520 * needs to be able to drop the lock unconditionally to wait
1702 * for completion. 1521 * for completion.
1703 * In 2.4 ->detect is called with the io_request_lock held.
1704 */ 1522 */
1705 spin_lock_irqsave(HOST_LOCK, flags); 1523 spin_lock_irqsave(ha->host->host_lock, flags);
1706#endif
1707 1524
1708 status = qla1280_load_firmware(ha); 1525 status = qla1280_load_firmware(ha);
1709 if (status) { 1526 if (status) {
@@ -1735,9 +1552,8 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha)
1735 1552
1736 ha->flags.online = 1; 1553 ha->flags.online = 1;
1737 out: 1554 out:
1738#if LINUX_VERSION_CODE >= 0x020500 1555 spin_unlock_irqrestore(ha->host->host_lock, flags);
1739 spin_unlock_irqrestore(HOST_LOCK, flags); 1556
1740#endif
1741 if (status) 1557 if (status)
1742 dprintk(2, "qla1280_initialize_adapter: **** FAILED ****\n"); 1558 dprintk(2, "qla1280_initialize_adapter: **** FAILED ****\n");
1743 1559
@@ -2650,14 +2466,14 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
2650 timer.function = qla1280_mailbox_timeout; 2466 timer.function = qla1280_mailbox_timeout;
2651 add_timer(&timer); 2467 add_timer(&timer);
2652 2468
2653 spin_unlock_irq(HOST_LOCK); 2469 spin_unlock_irq(ha->host->host_lock);
2654 WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT); 2470 WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT);
2655 data = qla1280_debounce_register(&reg->istatus); 2471 data = qla1280_debounce_register(&reg->istatus);
2656 2472
2657 wait_for_completion(&wait); 2473 wait_for_completion(&wait);
2658 del_timer_sync(&timer); 2474 del_timer_sync(&timer);
2659 2475
2660 spin_lock_irq(HOST_LOCK); 2476 spin_lock_irq(ha->host->host_lock);
2661 2477
2662 ha->mailbox_wait = NULL; 2478 ha->mailbox_wait = NULL;
2663 2479
@@ -2770,9 +2586,9 @@ qla1280_bus_reset(struct scsi_qla_host *ha, int bus)
2770 ha->bus_settings[bus].scsi_bus_dead = 1; 2586 ha->bus_settings[bus].scsi_bus_dead = 1;
2771 ha->bus_settings[bus].failed_reset_count++; 2587 ha->bus_settings[bus].failed_reset_count++;
2772 } else { 2588 } else {
2773 spin_unlock_irq(HOST_LOCK); 2589 spin_unlock_irq(ha->host->host_lock);
2774 ssleep(reset_delay); 2590 ssleep(reset_delay);
2775 spin_lock_irq(HOST_LOCK); 2591 spin_lock_irq(ha->host->host_lock);
2776 2592
2777 ha->bus_settings[bus].scsi_bus_dead = 0; 2593 ha->bus_settings[bus].scsi_bus_dead = 0;
2778 ha->bus_settings[bus].failed_reset_count = 0; 2594 ha->bus_settings[bus].failed_reset_count = 0;
@@ -3078,7 +2894,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3078 (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd); 2894 (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd);
3079 2895
3080 /* Enable simple tag queuing if device supports it. */ 2896 /* Enable simple tag queuing if device supports it. */
3081 if (DEV_SIMPLE_TAGS(cmd->device)) 2897 if (cmd->device->simple_tags)
3082 pkt->control_flags |= cpu_to_le16(BIT_3); 2898 pkt->control_flags |= cpu_to_le16(BIT_3);
3083 2899
3084 /* Load SCSI command packet. */ 2900 /* Load SCSI command packet. */
@@ -3377,7 +3193,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3377 (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd); 3193 (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd);
3378 3194
3379 /* Enable simple tag queuing if device supports it. */ 3195 /* Enable simple tag queuing if device supports it. */
3380 if (DEV_SIMPLE_TAGS(cmd->device)) 3196 if (cmd->device->simple_tags)
3381 pkt->control_flags |= cpu_to_le16(BIT_3); 3197 pkt->control_flags |= cpu_to_le16(BIT_3);
3382 3198
3383 /* Load SCSI command packet. */ 3199 /* Load SCSI command packet. */
@@ -3889,50 +3705,6 @@ qla1280_rst_aen(struct scsi_qla_host *ha)
3889} 3705}
3890 3706
3891 3707
3892#if LINUX_VERSION_CODE < 0x020500
3893/*
3894 *
3895 */
3896static void
3897qla1280_get_target_options(struct scsi_cmnd *cmd, struct scsi_qla_host *ha)
3898{
3899 unsigned char *result;
3900 struct nvram *n;
3901 int bus, target, lun;
3902
3903 bus = SCSI_BUS_32(cmd);
3904 target = SCSI_TCN_32(cmd);
3905 lun = SCSI_LUN_32(cmd);
3906
3907 /*
3908 * Make sure to not touch anything if someone is using the
3909 * sg interface.
3910 */
3911 if (cmd->use_sg || (CMD_RESULT(cmd) >> 16) != DID_OK || lun)
3912 return;
3913
3914 result = cmd->request_buffer;
3915 n = &ha->nvram;
3916
3917 n->bus[bus].target[target].parameter.enable_wide = 0;
3918 n->bus[bus].target[target].parameter.enable_sync = 0;
3919 n->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0;
3920
3921 if (result[7] & 0x60)
3922 n->bus[bus].target[target].parameter.enable_wide = 1;
3923 if (result[7] & 0x10)
3924 n->bus[bus].target[target].parameter.enable_sync = 1;
3925 if ((result[2] >= 3) && (result[4] + 5 > 56) &&
3926 (result[56] & 0x4))
3927 n->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 1;
3928
3929 dprintk(2, "get_target_options(): wide %i, sync %i, ppr %i\n",
3930 n->bus[bus].target[target].parameter.enable_wide,
3931 n->bus[bus].target[target].parameter.enable_sync,
3932 n->bus[bus].target[target].ppr_1x160.flags.enable_ppr);
3933}
3934#endif
3935
3936/* 3708/*
3937 * qla1280_status_entry 3709 * qla1280_status_entry
3938 * Processes received ISP status entry. 3710 * Processes received ISP status entry.
@@ -4271,7 +4043,7 @@ qla1280_get_target_parameters(struct scsi_qla_host *ha,
4271 } else 4043 } else
4272 printk(" Async"); 4044 printk(" Async");
4273 4045
4274 if (DEV_SIMPLE_TAGS(device)) 4046 if (device->simple_tags)
4275 printk(", Tagged queuing: depth %d", device->queue_depth); 4047 printk(", Tagged queuing: depth %d", device->queue_depth);
4276 printk("\n"); 4048 printk("\n");
4277} 4049}
@@ -4485,7 +4257,7 @@ qla1280_get_token(char *str)
4485 return ret; 4257 return ret;
4486} 4258}
4487 4259
4488#if LINUX_VERSION_CODE >= 0x020600 4260
4489static struct scsi_host_template qla1280_driver_template = { 4261static struct scsi_host_template qla1280_driver_template = {
4490 .module = THIS_MODULE, 4262 .module = THIS_MODULE,
4491 .proc_name = "qla1280", 4263 .proc_name = "qla1280",
@@ -4504,27 +4276,7 @@ static struct scsi_host_template qla1280_driver_template = {
4504 .cmd_per_lun = 1, 4276 .cmd_per_lun = 1,
4505 .use_clustering = ENABLE_CLUSTERING, 4277 .use_clustering = ENABLE_CLUSTERING,
4506}; 4278};
4507#else 4279
4508static struct scsi_host_template qla1280_driver_template = {
4509 .proc_name = "qla1280",
4510 .name = "Qlogic ISP 1280/12160",
4511 .detect = qla1280_detect,
4512 .release = qla1280_release,
4513 .info = qla1280_info,
4514 .queuecommand = qla1280_queuecommand,
4515 .eh_abort_handler = qla1280_eh_abort,
4516 .eh_device_reset_handler= qla1280_eh_device_reset,
4517 .eh_bus_reset_handler = qla1280_eh_bus_reset,
4518 .eh_host_reset_handler = qla1280_eh_adapter_reset,
4519 .bios_param = qla1280_biosparam_old,
4520 .can_queue = 0xfffff,
4521 .this_id = -1,
4522 .sg_tablesize = SG_ALL,
4523 .cmd_per_lun = 1,
4524 .use_clustering = ENABLE_CLUSTERING,
4525 .use_new_eh_code = 1,
4526};
4527#endif
4528 4280
4529static int __devinit 4281static int __devinit
4530qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 4282qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -4615,10 +4367,6 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4615 host->max_sectors = 1024; 4367 host->max_sectors = 1024;
4616 host->unique_id = host->host_no; 4368 host->unique_id = host->host_no;
4617 4369
4618#if LINUX_VERSION_CODE < 0x020545
4619 host->select_queue_depths = qla1280_select_queue_depth;
4620#endif
4621
4622 error = -ENODEV; 4370 error = -ENODEV;
4623 4371
4624#if MEMORY_MAPPED_IO 4372#if MEMORY_MAPPED_IO
@@ -4666,21 +4414,15 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4666 4414
4667 pci_set_drvdata(pdev, host); 4415 pci_set_drvdata(pdev, host);
4668 4416
4669#if LINUX_VERSION_CODE >= 0x020600
4670 error = scsi_add_host(host, &pdev->dev); 4417 error = scsi_add_host(host, &pdev->dev);
4671 if (error) 4418 if (error)
4672 goto error_disable_adapter; 4419 goto error_disable_adapter;
4673 scsi_scan_host(host); 4420 scsi_scan_host(host);
4674#else
4675 scsi_set_pci_device(host, pdev);
4676#endif
4677 4421
4678 return 0; 4422 return 0;
4679 4423
4680#if LINUX_VERSION_CODE >= 0x020600
4681 error_disable_adapter: 4424 error_disable_adapter:
4682 qla1280_disable_intrs(ha); 4425 qla1280_disable_intrs(ha);
4683#endif
4684 error_free_irq: 4426 error_free_irq:
4685 free_irq(pdev->irq, ha); 4427 free_irq(pdev->irq, ha);
4686 error_release_region: 4428 error_release_region:
@@ -4712,9 +4454,7 @@ qla1280_remove_one(struct pci_dev *pdev)
4712 struct Scsi_Host *host = pci_get_drvdata(pdev); 4454 struct Scsi_Host *host = pci_get_drvdata(pdev);
4713 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; 4455 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
4714 4456
4715#if LINUX_VERSION_CODE >= 0x020600
4716 scsi_remove_host(host); 4457 scsi_remove_host(host);
4717#endif
4718 4458
4719 qla1280_disable_intrs(ha); 4459 qla1280_disable_intrs(ha);
4720 4460
@@ -4738,7 +4478,6 @@ qla1280_remove_one(struct pci_dev *pdev)
4738 scsi_host_put(host); 4478 scsi_host_put(host);
4739} 4479}
4740 4480
4741#if LINUX_VERSION_CODE >= 0x020600
4742static struct pci_driver qla1280_pci_driver = { 4481static struct pci_driver qla1280_pci_driver = {
4743 .name = "qla1280", 4482 .name = "qla1280",
4744 .id_table = qla1280_pci_tbl, 4483 .id_table = qla1280_pci_tbl,
@@ -4784,10 +4523,6 @@ qla1280_exit(void)
4784module_init(qla1280_init); 4523module_init(qla1280_init);
4785module_exit(qla1280_exit); 4524module_exit(qla1280_exit);
4786 4525
4787#else
4788# define driver_template qla1280_driver_template
4789# include "scsi_module.c"
4790#endif
4791 4526
4792MODULE_AUTHOR("Qlogic & Jes Sorensen"); 4527MODULE_AUTHOR("Qlogic & Jes Sorensen");
4793MODULE_DESCRIPTION("Qlogic ISP SCSI (qla1x80/qla1x160) driver"); 4528MODULE_DESCRIPTION("Qlogic ISP SCSI (qla1x80/qla1x160) driver");
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 79d8a914f9d0..bad066e5772a 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1680,7 +1680,8 @@ typedef struct fc_port {
1680 uint8_t mp_byte; /* multi-path byte (not used) */ 1680 uint8_t mp_byte; /* multi-path byte (not used) */
1681 uint8_t cur_path; /* current path id */ 1681 uint8_t cur_path; /* current path id */
1682 1682
1683 struct fc_rport *rport; 1683 spinlock_t rport_lock;
1684 struct fc_rport *rport, *drport;
1684 u32 supported_classes; 1685 u32 supported_classes;
1685 struct work_struct rport_add_work; 1686 struct work_struct rport_add_work;
1686 struct work_struct rport_del_work; 1687 struct work_struct rport_del_work;
@@ -2270,6 +2271,7 @@ typedef struct scsi_qla_host {
2270#define LOOP_RESET_NEEDED 24 2271#define LOOP_RESET_NEEDED 24
2271#define BEACON_BLINK_NEEDED 25 2272#define BEACON_BLINK_NEEDED 25
2272#define REGISTER_FDMI_NEEDED 26 2273#define REGISTER_FDMI_NEEDED 26
2274#define FCPORT_UPDATE_NEEDED 27
2273 2275
2274 uint32_t device_flags; 2276 uint32_t device_flags;
2275#define DFLG_LOCAL_DEVICES BIT_0 2277#define DFLG_LOCAL_DEVICES BIT_0
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 32be4c14cccb..35266bd5d538 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -47,9 +47,11 @@ extern int qla2x00_local_device_login(scsi_qla_host_t *, uint16_t);
47extern void qla2x00_restart_queues(scsi_qla_host_t *, uint8_t); 47extern void qla2x00_restart_queues(scsi_qla_host_t *, uint8_t);
48 48
49extern void qla2x00_rescan_fcports(scsi_qla_host_t *); 49extern void qla2x00_rescan_fcports(scsi_qla_host_t *);
50extern void qla2x00_update_fcports(scsi_qla_host_t *);
50 51
51extern int qla2x00_abort_isp(scsi_qla_host_t *); 52extern int qla2x00_abort_isp(scsi_qla_host_t *);
52 53
54extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
53extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *); 55extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *);
54 56
55/* 57/*
@@ -70,8 +72,8 @@ extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
70 72
71extern void qla2x00_cmd_timeout(srb_t *); 73extern void qla2x00_cmd_timeout(srb_t *);
72 74
73extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int); 75extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int);
74extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *); 76extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int);
75 77
76extern void qla2x00_blink_led(scsi_qla_host_t *); 78extern void qla2x00_blink_led(scsi_qla_host_t *);
77 79
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index a91fea69ad63..e67bb0997818 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -32,7 +32,6 @@ static int qla2x00_fw_ready(scsi_qla_host_t *);
32static int qla2x00_configure_hba(scsi_qla_host_t *); 32static int qla2x00_configure_hba(scsi_qla_host_t *);
33static int qla2x00_configure_loop(scsi_qla_host_t *); 33static int qla2x00_configure_loop(scsi_qla_host_t *);
34static int qla2x00_configure_local_loop(scsi_qla_host_t *); 34static int qla2x00_configure_local_loop(scsi_qla_host_t *);
35static void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
36static int qla2x00_configure_fabric(scsi_qla_host_t *); 35static int qla2x00_configure_fabric(scsi_qla_host_t *);
37static int qla2x00_find_all_fabric_devs(scsi_qla_host_t *, struct list_head *); 36static int qla2x00_find_all_fabric_devs(scsi_qla_host_t *, struct list_head *);
38static int qla2x00_device_resync(scsi_qla_host_t *); 37static int qla2x00_device_resync(scsi_qla_host_t *);
@@ -1688,10 +1687,16 @@ static void
1688qla2x00_rport_del(void *data) 1687qla2x00_rport_del(void *data)
1689{ 1688{
1690 fc_port_t *fcport = data; 1689 fc_port_t *fcport = data;
1690 struct fc_rport *rport;
1691 unsigned long flags;
1692
1693 spin_lock_irqsave(&fcport->rport_lock, flags);
1694 rport = fcport->drport;
1695 fcport->drport = NULL;
1696 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1697 if (rport)
1698 fc_remote_port_delete(rport);
1691 1699
1692 if (fcport->rport)
1693 fc_remote_port_delete(fcport->rport);
1694 fcport->rport = NULL;
1695} 1700}
1696 1701
1697/** 1702/**
@@ -1719,6 +1724,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
1719 atomic_set(&fcport->state, FCS_UNCONFIGURED); 1724 atomic_set(&fcport->state, FCS_UNCONFIGURED);
1720 fcport->flags = FCF_RLC_SUPPORT; 1725 fcport->flags = FCF_RLC_SUPPORT;
1721 fcport->supported_classes = FC_COS_UNSPECIFIED; 1726 fcport->supported_classes = FC_COS_UNSPECIFIED;
1727 spin_lock_init(&fcport->rport_lock);
1722 INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport); 1728 INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport);
1723 INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport); 1729 INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport);
1724 1730
@@ -2008,7 +2014,7 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha)
2008{ 2014{
2009 fc_port_t *fcport; 2015 fc_port_t *fcport;
2010 2016
2011 qla2x00_mark_all_devices_lost(ha); 2017 qla2x00_mark_all_devices_lost(ha, 0);
2012 list_for_each_entry(fcport, &ha->fcports, list) { 2018 list_for_each_entry(fcport, &ha->fcports, list) {
2013 if (fcport->port_type != FCT_TARGET) 2019 if (fcport->port_type != FCT_TARGET)
2014 continue; 2020 continue;
@@ -2032,13 +2038,9 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha)
2032 * Context: 2038 * Context:
2033 * Kernel context. 2039 * Kernel context.
2034 */ 2040 */
2035static void 2041void
2036qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) 2042qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
2037{ 2043{
2038 uint16_t index;
2039 unsigned long flags;
2040 srb_t *sp;
2041
2042 fcport->ha = ha; 2044 fcport->ha = ha;
2043 fcport->login_retry = 0; 2045 fcport->login_retry = 0;
2044 fcport->port_login_retry_count = ha->port_down_retry_count * 2046 fcport->port_login_retry_count = ha->port_down_retry_count *
@@ -2047,28 +2049,6 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
2047 PORT_RETRY_TIME); 2049 PORT_RETRY_TIME);
2048 fcport->flags &= ~FCF_LOGIN_NEEDED; 2050 fcport->flags &= ~FCF_LOGIN_NEEDED;
2049 2051
2050 /*
2051 * Check for outstanding cmd on tape Bypass LUN discovery if active
2052 * command on tape.
2053 */
2054 if (fcport->flags & FCF_TAPE_PRESENT) {
2055 spin_lock_irqsave(&ha->hardware_lock, flags);
2056 for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
2057 fc_port_t *sfcp;
2058
2059 if ((sp = ha->outstanding_cmds[index]) != 0) {
2060 sfcp = sp->fcport;
2061 if (sfcp == fcport) {
2062 atomic_set(&fcport->state, FCS_ONLINE);
2063 spin_unlock_irqrestore(
2064 &ha->hardware_lock, flags);
2065 return;
2066 }
2067 }
2068 }
2069 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2070 }
2071
2072 if (fcport->port_type == FCT_INITIATOR || 2052 if (fcport->port_type == FCT_INITIATOR ||
2073 fcport->port_type == FCT_BROADCAST) 2053 fcport->port_type == FCT_BROADCAST)
2074 fcport->device_type = TYPE_PROCESSOR; 2054 fcport->device_type = TYPE_PROCESSOR;
@@ -2084,24 +2064,29 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
2084{ 2064{
2085 struct fc_rport_identifiers rport_ids; 2065 struct fc_rport_identifiers rport_ids;
2086 struct fc_rport *rport; 2066 struct fc_rport *rport;
2067 unsigned long flags;
2087 2068
2088 if (fcport->rport) { 2069 if (fcport->drport)
2089 fc_remote_port_delete(fcport->rport); 2070 qla2x00_rport_del(fcport);
2090 fcport->rport = NULL; 2071 if (fcport->rport)
2091 } 2072 return;
2092 2073
2093 rport_ids.node_name = wwn_to_u64(fcport->node_name); 2074 rport_ids.node_name = wwn_to_u64(fcport->node_name);
2094 rport_ids.port_name = wwn_to_u64(fcport->port_name); 2075 rport_ids.port_name = wwn_to_u64(fcport->port_name);
2095 rport_ids.port_id = fcport->d_id.b.domain << 16 | 2076 rport_ids.port_id = fcport->d_id.b.domain << 16 |
2096 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; 2077 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa;
2097 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 2078 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
2098 fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids); 2079 rport = fc_remote_port_add(ha->host, 0, &rport_ids);
2099 if (!rport) { 2080 if (!rport) {
2100 qla_printk(KERN_WARNING, ha, 2081 qla_printk(KERN_WARNING, ha,
2101 "Unable to allocate fc remote port!\n"); 2082 "Unable to allocate fc remote port!\n");
2102 return; 2083 return;
2103 } 2084 }
2085 spin_lock_irqsave(&fcport->rport_lock, flags);
2086 fcport->rport = rport;
2104 *((fc_port_t **)rport->dd_data) = fcport; 2087 *((fc_port_t **)rport->dd_data) = fcport;
2088 spin_unlock_irqrestore(&fcport->rport_lock, flags);
2089
2105 rport->supported_classes = fcport->supported_classes; 2090 rport->supported_classes = fcport->supported_classes;
2106 2091
2107 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 2092 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
@@ -2217,12 +2202,11 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
2217 2202
2218 if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) { 2203 if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
2219 qla2x00_mark_device_lost(ha, fcport, 2204 qla2x00_mark_device_lost(ha, fcport,
2220 ql2xplogiabsentdevice); 2205 ql2xplogiabsentdevice, 0);
2221 if (fcport->loop_id != FC_NO_LOOP_ID && 2206 if (fcport->loop_id != FC_NO_LOOP_ID &&
2222 (fcport->flags & FCF_TAPE_PRESENT) == 0 && 2207 (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
2223 fcport->port_type != FCT_INITIATOR && 2208 fcport->port_type != FCT_INITIATOR &&
2224 fcport->port_type != FCT_BROADCAST) { 2209 fcport->port_type != FCT_BROADCAST) {
2225
2226 ha->isp_ops.fabric_logout(ha, 2210 ha->isp_ops.fabric_logout(ha,
2227 fcport->loop_id, 2211 fcport->loop_id,
2228 fcport->d_id.b.domain, 2212 fcport->d_id.b.domain,
@@ -2694,7 +2678,8 @@ qla2x00_device_resync(scsi_qla_host_t *ha)
2694 if (atomic_read(&fcport->state) == FCS_ONLINE) { 2678 if (atomic_read(&fcport->state) == FCS_ONLINE) {
2695 if (format != 3 || 2679 if (format != 3 ||
2696 fcport->port_type != FCT_INITIATOR) { 2680 fcport->port_type != FCT_INITIATOR) {
2697 qla2x00_mark_device_lost(ha, fcport, 0); 2681 qla2x00_mark_device_lost(ha, fcport,
2682 0, 0);
2698 } 2683 }
2699 } 2684 }
2700 fcport->flags &= ~FCF_FARP_DONE; 2685 fcport->flags &= ~FCF_FARP_DONE;
@@ -2741,8 +2726,7 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *ha, fc_port_t *fcport,
2741 ha->isp_ops.fabric_logout(ha, fcport->loop_id, 2726 ha->isp_ops.fabric_logout(ha, fcport->loop_id,
2742 fcport->d_id.b.domain, fcport->d_id.b.area, 2727 fcport->d_id.b.domain, fcport->d_id.b.area,
2743 fcport->d_id.b.al_pa); 2728 fcport->d_id.b.al_pa);
2744 qla2x00_mark_device_lost(ha, fcport, 1); 2729 qla2x00_mark_device_lost(ha, fcport, 1, 0);
2745
2746 } else { 2730 } else {
2747 qla2x00_update_fcport(ha, fcport); 2731 qla2x00_update_fcport(ha, fcport);
2748 } 2732 }
@@ -2855,7 +2839,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport,
2855 ha->isp_ops.fabric_logout(ha, fcport->loop_id, 2839 ha->isp_ops.fabric_logout(ha, fcport->loop_id,
2856 fcport->d_id.b.domain, fcport->d_id.b.area, 2840 fcport->d_id.b.domain, fcport->d_id.b.area,
2857 fcport->d_id.b.al_pa); 2841 fcport->d_id.b.al_pa);
2858 qla2x00_mark_device_lost(ha, fcport, 1); 2842 qla2x00_mark_device_lost(ha, fcport, 1, 0);
2859 2843
2860 rval = 1; 2844 rval = 1;
2861 break; 2845 break;
@@ -2990,6 +2974,17 @@ qla2x00_rescan_fcports(scsi_qla_host_t *ha)
2990 qla2x00_probe_for_all_luns(ha); 2974 qla2x00_probe_for_all_luns(ha);
2991} 2975}
2992 2976
2977void
2978qla2x00_update_fcports(scsi_qla_host_t *ha)
2979{
2980 fc_port_t *fcport;
2981
2982 /* Go with deferred removal of rport references. */
2983 list_for_each_entry(fcport, &ha->fcports, list)
2984 if (fcport->drport)
2985 qla2x00_rport_del(fcport);
2986}
2987
2993/* 2988/*
2994* qla2x00_abort_isp 2989* qla2x00_abort_isp
2995* Resets ISP and aborts all outstanding commands. 2990* Resets ISP and aborts all outstanding commands.
@@ -3019,7 +3014,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3019 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); 3014 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
3020 if (atomic_read(&ha->loop_state) != LOOP_DOWN) { 3015 if (atomic_read(&ha->loop_state) != LOOP_DOWN) {
3021 atomic_set(&ha->loop_state, LOOP_DOWN); 3016 atomic_set(&ha->loop_state, LOOP_DOWN);
3022 qla2x00_mark_all_devices_lost(ha); 3017 qla2x00_mark_all_devices_lost(ha, 0);
3023 } else { 3018 } else {
3024 if (!atomic_read(&ha->loop_down_timer)) 3019 if (!atomic_read(&ha->loop_down_timer))
3025 atomic_set(&ha->loop_down_timer, 3020 atomic_set(&ha->loop_down_timer,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index f63af081d4ff..71a46fcee8cc 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -389,7 +389,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
389 if (atomic_read(&ha->loop_state) != LOOP_DOWN) { 389 if (atomic_read(&ha->loop_state) != LOOP_DOWN) {
390 atomic_set(&ha->loop_state, LOOP_DOWN); 390 atomic_set(&ha->loop_state, LOOP_DOWN);
391 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); 391 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
392 qla2x00_mark_all_devices_lost(ha); 392 qla2x00_mark_all_devices_lost(ha, 1);
393 } 393 }
394 394
395 set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags); 395 set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags);
@@ -432,7 +432,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
432 atomic_set(&ha->loop_state, LOOP_DOWN); 432 atomic_set(&ha->loop_state, LOOP_DOWN);
433 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); 433 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
434 ha->device_flags |= DFLG_NO_CABLE; 434 ha->device_flags |= DFLG_NO_CABLE;
435 qla2x00_mark_all_devices_lost(ha); 435 qla2x00_mark_all_devices_lost(ha, 1);
436 } 436 }
437 437
438 ha->flags.management_server_logged_in = 0; 438 ha->flags.management_server_logged_in = 0;
@@ -453,7 +453,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
453 if (atomic_read(&ha->loop_state) != LOOP_DOWN) { 453 if (atomic_read(&ha->loop_state) != LOOP_DOWN) {
454 atomic_set(&ha->loop_state, LOOP_DOWN); 454 atomic_set(&ha->loop_state, LOOP_DOWN);
455 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); 455 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
456 qla2x00_mark_all_devices_lost(ha); 456 qla2x00_mark_all_devices_lost(ha, 1);
457 } 457 }
458 458
459 set_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 459 set_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
@@ -482,7 +482,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
482 if (!atomic_read(&ha->loop_down_timer)) 482 if (!atomic_read(&ha->loop_down_timer))
483 atomic_set(&ha->loop_down_timer, 483 atomic_set(&ha->loop_down_timer,
484 LOOP_DOWN_TIME); 484 LOOP_DOWN_TIME);
485 qla2x00_mark_all_devices_lost(ha); 485 qla2x00_mark_all_devices_lost(ha, 1);
486 } 486 }
487 487
488 if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) { 488 if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) {
@@ -506,7 +506,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
506 if (!atomic_read(&ha->loop_down_timer)) 506 if (!atomic_read(&ha->loop_down_timer))
507 atomic_set(&ha->loop_down_timer, 507 atomic_set(&ha->loop_down_timer,
508 LOOP_DOWN_TIME); 508 LOOP_DOWN_TIME);
509 qla2x00_mark_all_devices_lost(ha); 509 qla2x00_mark_all_devices_lost(ha, 1);
510 } 510 }
511 511
512 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); 512 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
@@ -580,7 +580,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
580 */ 580 */
581 atomic_set(&ha->loop_state, LOOP_UP); 581 atomic_set(&ha->loop_state, LOOP_UP);
582 582
583 qla2x00_mark_all_devices_lost(ha); 583 qla2x00_mark_all_devices_lost(ha, 1);
584 584
585 ha->flags.rscn_queue_overflow = 1; 585 ha->flags.rscn_queue_overflow = 1;
586 586
@@ -1091,7 +1091,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1091 1091
1092 cp->result = DID_BUS_BUSY << 16; 1092 cp->result = DID_BUS_BUSY << 16;
1093 if (atomic_read(&fcport->state) == FCS_ONLINE) { 1093 if (atomic_read(&fcport->state) == FCS_ONLINE) {
1094 qla2x00_mark_device_lost(ha, fcport, 1); 1094 qla2x00_mark_device_lost(ha, fcport, 1, 1);
1095 } 1095 }
1096 break; 1096 break;
1097 1097
@@ -1135,7 +1135,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1135 1135
1136 /* Check to see if logout occurred. */ 1136 /* Check to see if logout occurred. */
1137 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) 1137 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT))
1138 qla2x00_mark_device_lost(ha, fcport, 1); 1138 qla2x00_mark_device_lost(ha, fcport, 1, 1);
1139 break; 1139 break;
1140 1140
1141 case CS_QUEUE_FULL: 1141 case CS_QUEUE_FULL:
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 4916847d84ec..5866a7c706a8 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -756,7 +756,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
756 if (ret == SUCCESS) { 756 if (ret == SUCCESS) {
757 if (fcport->flags & FC_FABRIC_DEVICE) { 757 if (fcport->flags & FC_FABRIC_DEVICE) {
758 ha->isp_ops.fabric_logout(ha, fcport->loop_id); 758 ha->isp_ops.fabric_logout(ha, fcport->loop_id);
759 qla2x00_mark_device_lost(ha, fcport); 759 qla2x00_mark_device_lost(ha, fcport, 0, 0);
760 } 760 }
761 } 761 }
762#endif 762#endif
@@ -1642,6 +1642,31 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1642 pci_disable_device(ha->pdev); 1642 pci_disable_device(ha->pdev);
1643} 1643}
1644 1644
1645static inline void
1646qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport,
1647 int defer)
1648{
1649 unsigned long flags;
1650 struct fc_rport *rport;
1651
1652 if (!fcport->rport)
1653 return;
1654
1655 rport = fcport->rport;
1656 if (defer) {
1657 spin_lock_irqsave(&fcport->rport_lock, flags);
1658 fcport->drport = rport;
1659 fcport->rport = NULL;
1660 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1661 set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags);
1662 } else {
1663 spin_lock_irqsave(&fcport->rport_lock, flags);
1664 fcport->rport = NULL;
1665 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1666 fc_remote_port_delete(rport);
1667 }
1668}
1669
1645/* 1670/*
1646 * qla2x00_mark_device_lost Updates fcport state when device goes offline. 1671 * qla2x00_mark_device_lost Updates fcport state when device goes offline.
1647 * 1672 *
@@ -1652,10 +1677,10 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1652 * Context: 1677 * Context:
1653 */ 1678 */
1654void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, 1679void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport,
1655 int do_login) 1680 int do_login, int defer)
1656{ 1681{
1657 if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport) 1682 if (atomic_read(&fcport->state) == FCS_ONLINE)
1658 schedule_work(&fcport->rport_del_work); 1683 qla2x00_schedule_rport_del(ha, fcport, defer);
1659 1684
1660 /* 1685 /*
1661 * We may need to retry the login, so don't change the state of the 1686 * We may need to retry the login, so don't change the state of the
@@ -1702,7 +1727,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport,
1702 * Context: 1727 * Context:
1703 */ 1728 */
1704void 1729void
1705qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha) 1730qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha, int defer)
1706{ 1731{
1707 fc_port_t *fcport; 1732 fc_port_t *fcport;
1708 1733
@@ -1716,10 +1741,13 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha)
1716 */ 1741 */
1717 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) 1742 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD)
1718 continue; 1743 continue;
1719 if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport) 1744 if (atomic_read(&fcport->state) == FCS_ONLINE)
1720 schedule_work(&fcport->rport_del_work); 1745 qla2x00_schedule_rport_del(ha, fcport, defer);
1721 atomic_set(&fcport->state, FCS_DEVICE_LOST); 1746 atomic_set(&fcport->state, FCS_DEVICE_LOST);
1722 } 1747 }
1748
1749 if (defer && ha->dpc_wait && !ha->dpc_active)
1750 up(ha->dpc_wait);
1723} 1751}
1724 1752
1725/* 1753/*
@@ -2161,6 +2189,9 @@ qla2x00_do_dpc(void *data)
2161 ha->host_no)); 2189 ha->host_no));
2162 } 2190 }
2163 2191
2192 if (test_and_clear_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags))
2193 qla2x00_update_fcports(ha);
2194
2164 if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) { 2195 if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) {
2165 DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n", 2196 DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n",
2166 ha->host_no)); 2197 ha->host_no));
@@ -2219,13 +2250,8 @@ qla2x00_do_dpc(void *data)
2219 DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n", 2250 DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n",
2220 ha->host_no, fcport->loop_id)); 2251 ha->host_no, fcport->loop_id));
2221 2252
2222 fcport->port_login_retry_count = 2253 qla2x00_update_fcport(ha,
2223 ha->port_down_retry_count * PORT_RETRY_TIME; 2254 fcport);
2224 atomic_set(&fcport->state, FCS_ONLINE);
2225 atomic_set(&fcport->port_down_timer,
2226 ha->port_down_retry_count * PORT_RETRY_TIME);
2227
2228 fcport->login_retry = 0;
2229 } else if (status == 1) { 2255 } else if (status == 1) {
2230 set_bit(RELOGIN_NEEDED, &ha->dpc_flags); 2256 set_bit(RELOGIN_NEEDED, &ha->dpc_flags);
2231 /* retry the login again */ 2257 /* retry the login again */
@@ -2469,6 +2495,7 @@ qla2x00_timer(scsi_qla_host_t *ha)
2469 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || 2495 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
2470 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || 2496 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) ||
2471 test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) || 2497 test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) ||
2498 test_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags) ||
2472 start_dpc || 2499 start_dpc ||
2473 test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) || 2500 test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) ||
2474 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || 2501 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a2333d2c7af0..5cc97b721661 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1350,7 +1350,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)
1350 cmnd[4] = SCSI_REMOVAL_PREVENT; 1350 cmnd[4] = SCSI_REMOVAL_PREVENT;
1351 cmnd[5] = 0; 1351 cmnd[5] = 0;
1352 1352
1353 scsi_execute_async(sdev, cmnd, DMA_NONE, NULL, 0, 0, 10 * HZ, 1353 scsi_execute_async(sdev, cmnd, 6, DMA_NONE, NULL, 0, 0, 10 * HZ,
1354 5, NULL, NULL, GFP_KERNEL); 1354 5, NULL, NULL, GFP_KERNEL);
1355} 1355}
1356 1356
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3574ba935af8..4a602853a98e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -436,6 +436,7 @@ free_bios:
436 * scsi_execute_async - insert request 436 * scsi_execute_async - insert request
437 * @sdev: scsi device 437 * @sdev: scsi device
438 * @cmd: scsi command 438 * @cmd: scsi command
439 * @cmd_len: length of scsi cdb
439 * @data_direction: data direction 440 * @data_direction: data direction
440 * @buffer: data buffer (this can be a kernel buffer or scatterlist) 441 * @buffer: data buffer (this can be a kernel buffer or scatterlist)
441 * @bufflen: len of buffer 442 * @bufflen: len of buffer
@@ -445,7 +446,7 @@ free_bios:
445 * @flags: or into request flags 446 * @flags: or into request flags
446 **/ 447 **/
447int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, 448int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
448 int data_direction, void *buffer, unsigned bufflen, 449 int cmd_len, int data_direction, void *buffer, unsigned bufflen,
449 int use_sg, int timeout, int retries, void *privdata, 450 int use_sg, int timeout, int retries, void *privdata,
450 void (*done)(void *, char *, int, int), gfp_t gfp) 451 void (*done)(void *, char *, int, int), gfp_t gfp)
451{ 452{
@@ -472,7 +473,7 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
472 if (err) 473 if (err)
473 goto free_req; 474 goto free_req;
474 475
475 req->cmd_len = COMMAND_SIZE(cmd[0]); 476 req->cmd_len = cmd_len;
476 memcpy(req->cmd, cmd, req->cmd_len); 477 memcpy(req->cmd, cmd, req->cmd_len);
477 req->sense = sioc->sense; 478 req->sense = sioc->sense;
478 req->sense_len = 0; 479 req->sense_len = 0;
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index a3e0b7bc2d7b..210dab5879fa 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -377,7 +377,7 @@ static void sas_phy_release(struct device *dev)
377/** 377/**
378 * sas_phy_alloc -- allocates and initialize a SAS PHY structure 378 * sas_phy_alloc -- allocates and initialize a SAS PHY structure
379 * @parent: Parent device 379 * @parent: Parent device
380 * @number: Port number 380 * @number: Phy index
381 * 381 *
382 * Allocates an SAS PHY structure. It will be added in the device tree 382 * Allocates an SAS PHY structure. It will be added in the device tree
383 * below the device specified by @parent, which has to be either a Scsi_Host 383 * below the device specified by @parent, which has to be either a Scsi_Host
@@ -595,8 +595,8 @@ struct sas_rphy *sas_rphy_alloc(struct sas_phy *parent)
595 device_initialize(&rphy->dev); 595 device_initialize(&rphy->dev);
596 rphy->dev.parent = get_device(&parent->dev); 596 rphy->dev.parent = get_device(&parent->dev);
597 rphy->dev.release = sas_rphy_release; 597 rphy->dev.release = sas_rphy_release;
598 sprintf(rphy->dev.bus_id, "rphy-%d:%d", 598 sprintf(rphy->dev.bus_id, "rphy-%d:%d-%d",
599 shost->host_no, parent->number); 599 shost->host_no, parent->port_identifier, parent->number);
600 transport_setup_device(&rphy->dev); 600 transport_setup_device(&rphy->dev);
601 601
602 return rphy; 602 return rphy;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 78aad9582bcf..7d0700091f3d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -741,7 +741,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
741 hp->duration = jiffies_to_msecs(jiffies); 741 hp->duration = jiffies_to_msecs(jiffies);
742/* Now send everything of to mid-level. The next time we hear about this 742/* Now send everything of to mid-level. The next time we hear about this
743 packet is when sg_cmd_done() is called (i.e. a callback). */ 743 packet is when sg_cmd_done() is called (i.e. a callback). */
744 if (scsi_execute_async(sdp->device, cmnd, data_dir, srp->data.buffer, 744 if (scsi_execute_async(sdp->device, cmnd, hp->cmd_len, data_dir, srp->data.buffer,
745 hp->dxfer_len, srp->data.k_use_sg, timeout, 745 hp->dxfer_len, srp->data.k_use_sg, timeout,
746 SG_DEFAULT_RETRIES, srp, sg_cmd_done, 746 SG_DEFAULT_RETRIES, srp, sg_cmd_done,
747 GFP_ATOMIC)) { 747 GFP_ATOMIC)) {
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 13b1d3aac265..7f96f33c1bb1 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -508,7 +508,7 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd
508 STp->buffer->cmdstat.have_sense = 0; 508 STp->buffer->cmdstat.have_sense = 0;
509 STp->buffer->syscall_result = 0; 509 STp->buffer->syscall_result = 0;
510 510
511 if (scsi_execute_async(STp->device, cmd, direction, 511 if (scsi_execute_async(STp->device, cmd, COMMAND_SIZE(cmd[0]), direction,
512 &((STp->buffer)->sg[0]), bytes, (STp->buffer)->sg_segs, 512 &((STp->buffer)->sg[0]), bytes, (STp->buffer)->sg_segs,
513 timeout, retries, SRpnt, st_sleep_done, GFP_KERNEL)) { 513 timeout, retries, SRpnt, st_sleep_done, GFP_KERNEL)) {
514 /* could not allocate the buffer or request was too large */ 514 /* could not allocate the buffer or request was too large */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index e94ca4d36035..290e3b4d2aec 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -275,7 +275,7 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
275 int data_direction, void *buffer, unsigned bufflen, 275 int data_direction, void *buffer, unsigned bufflen,
276 struct scsi_sense_hdr *, int timeout, int retries); 276 struct scsi_sense_hdr *, int timeout, int retries);
277extern int scsi_execute_async(struct scsi_device *sdev, 277extern int scsi_execute_async(struct scsi_device *sdev,
278 const unsigned char *cmd, int data_direction, 278 const unsigned char *cmd, int cmd_len, int data_direction,
279 void *buffer, unsigned bufflen, int use_sg, 279 void *buffer, unsigned bufflen, int use_sg,
280 int timeout, int retries, void *privdata, 280 int timeout, int retries, void *privdata,
281 void (*done)(void *, char *, int, int), 281 void (*done)(void *, char *, int, int),