aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aacraid/commsup.c2
-rw-r--r--drivers/scsi/ahci.c19
-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/ata_piix.c3
-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/ide-scsi.c14
-rw-r--r--drivers/scsi/ips.c54
-rw-r--r--drivers/scsi/libata-core.c411
-rw-r--r--drivers/scsi/libata-scsi.c47
-rw-r--r--drivers/scsi/mac53c94.c4
-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/sata_mv.c223
-rw-r--r--drivers/scsi/sata_promise.c104
-rw-r--r--drivers/scsi/scsi.c2
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/scsi_transport_sas.c6
-rw-r--r--drivers/scsi/sg.c4
-rw-r--r--drivers/scsi/st.c2
47 files changed, 2186 insertions, 1258 deletions
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 38d6d00fb0fc..014cc8d54a9f 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -38,10 +38,10 @@
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/completion.h> 39#include <linux/completion.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41#include <linux/delay.h>
41#include <scsi/scsi_host.h> 42#include <scsi/scsi_host.h>
42#include <scsi/scsi_device.h> 43#include <scsi/scsi_device.h>
43#include <asm/semaphore.h> 44#include <asm/semaphore.h>
44#include <asm/delay.h>
45 45
46#include "aacraid.h" 46#include "aacraid.h"
47 47
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 5caf6dec1d40..c840d5ec12a7 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -290,6 +290,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
290 board_ahci }, /* ICH8M */ 290 board_ahci }, /* ICH8M */
291 { PCI_VENDOR_ID_INTEL, 0x282a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 291 { PCI_VENDOR_ID_INTEL, 0x282a, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
292 board_ahci }, /* ICH8M */ 292 board_ahci }, /* ICH8M */
293 { 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
294 board_ahci }, /* JMicron JMB360 */
295 { 0x197b, 0x2363, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
296 board_ahci }, /* JMicron JMB363 */
293 { } /* terminate list */ 297 { } /* terminate list */
294}; 298};
295 299
@@ -830,7 +834,6 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent)
830 struct pci_dev *pdev = to_pci_dev(probe_ent->dev); 834 struct pci_dev *pdev = to_pci_dev(probe_ent->dev);
831 void __iomem *mmio = probe_ent->mmio_base; 835 void __iomem *mmio = probe_ent->mmio_base;
832 u32 tmp, cap_save; 836 u32 tmp, cap_save;
833 u16 tmp16;
834 unsigned int i, j, using_dac; 837 unsigned int i, j, using_dac;
835 int rc; 838 int rc;
836 void __iomem *port_mmio; 839 void __iomem *port_mmio;
@@ -864,9 +867,13 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent)
864 writel(0xf, mmio + HOST_PORTS_IMPL); 867 writel(0xf, mmio + HOST_PORTS_IMPL);
865 (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ 868 (void) readl(mmio + HOST_PORTS_IMPL); /* flush */
866 869
867 pci_read_config_word(pdev, 0x92, &tmp16); 870 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
868 tmp16 |= 0xf; 871 u16 tmp16;
869 pci_write_config_word(pdev, 0x92, tmp16); 872
873 pci_read_config_word(pdev, 0x92, &tmp16);
874 tmp16 |= 0xf;
875 pci_write_config_word(pdev, 0x92, tmp16);
876 }
870 877
871 hpriv->cap = readl(mmio + HOST_CAP); 878 hpriv->cap = readl(mmio + HOST_CAP);
872 hpriv->port_map = readl(mmio + HOST_PORTS_IMPL); 879 hpriv->port_map = readl(mmio + HOST_PORTS_IMPL);
@@ -1110,6 +1117,10 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1110 if (have_msi) 1117 if (have_msi)
1111 hpriv->flags |= AHCI_FLAG_MSI; 1118 hpriv->flags |= AHCI_FLAG_MSI;
1112 1119
1120 /* JMicron-specific fixup: make sure we're in AHCI mode */
1121 if (pdev->vendor == 0x197b)
1122 pci_write_config_byte(pdev, 0x41, 0xa1);
1123
1113 /* initialize adapter */ 1124 /* initialize adapter */
1114 rc = ahci_host_init(probe_ent); 1125 rc = ahci_host_init(probe_ent);
1115 if (rc) 1126 if (rc)
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/ata_piix.c b/drivers/scsi/ata_piix.c
index 19d8d4ba6a1e..49cc4209fe16 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -630,6 +630,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
630 630
631/** 631/**
632 * piix_check_450nx_errata - Check for problem 450NX setup 632 * piix_check_450nx_errata - Check for problem 450NX setup
633 * @ata_dev: the PCI device to check
633 * 634 *
634 * Check for the present of 450NX errata #19 and errata #25. If 635 * Check for the present of 450NX errata #19 and errata #25. If
635 * they are found return an error code so we can turn off DMA 636 * they are found return an error code so we can turn off DMA
@@ -713,7 +714,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
713 pci_read_config_byte(pdev, ICH5_PMR, &tmp); 714 pci_read_config_byte(pdev, ICH5_PMR, &tmp);
714 715
715 if (host_flags & PIIX_FLAG_COMBINED_ICH6) { 716 if (host_flags & PIIX_FLAG_COMBINED_ICH6) {
716 switch (tmp) { 717 switch (tmp & 0x3) {
717 case 0: 718 case 0:
718 break; 719 break;
719 case 1: 720 case 1:
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/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 3c688ef54660..0cf0e4c7ac0c 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -751,9 +751,8 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
751 idescsi_add_settings(drive); 751 idescsi_add_settings(drive);
752} 752}
753 753
754static int ide_scsi_remove(struct device *dev) 754static void ide_scsi_remove(ide_drive_t *drive)
755{ 755{
756 ide_drive_t *drive = to_ide_device(dev);
757 struct Scsi_Host *scsihost = drive->driver_data; 756 struct Scsi_Host *scsihost = drive->driver_data;
758 struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost); 757 struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost);
759 struct gendisk *g = scsi->disk; 758 struct gendisk *g = scsi->disk;
@@ -768,11 +767,9 @@ static int ide_scsi_remove(struct device *dev)
768 767
769 scsi_remove_host(scsihost); 768 scsi_remove_host(scsihost);
770 ide_scsi_put(scsi); 769 ide_scsi_put(scsi);
771
772 return 0;
773} 770}
774 771
775static int ide_scsi_probe(struct device *); 772static int ide_scsi_probe(ide_drive_t *);
776 773
777#ifdef CONFIG_PROC_FS 774#ifdef CONFIG_PROC_FS
778static ide_proc_entry_t idescsi_proc[] = { 775static ide_proc_entry_t idescsi_proc[] = {
@@ -788,9 +785,9 @@ static ide_driver_t idescsi_driver = {
788 .owner = THIS_MODULE, 785 .owner = THIS_MODULE,
789 .name = "ide-scsi", 786 .name = "ide-scsi",
790 .bus = &ide_bus_type, 787 .bus = &ide_bus_type,
791 .probe = ide_scsi_probe,
792 .remove = ide_scsi_remove,
793 }, 788 },
789 .probe = ide_scsi_probe,
790 .remove = ide_scsi_remove,
794 .version = IDESCSI_VERSION, 791 .version = IDESCSI_VERSION,
795 .media = ide_scsi, 792 .media = ide_scsi,
796 .supports_dsc_overlap = 0, 793 .supports_dsc_overlap = 0,
@@ -1119,9 +1116,8 @@ static struct scsi_host_template idescsi_template = {
1119 .proc_name = "ide-scsi", 1116 .proc_name = "ide-scsi",
1120}; 1117};
1121 1118
1122static int ide_scsi_probe(struct device *dev) 1119static int ide_scsi_probe(ide_drive_t *drive)
1123{ 1120{
1124 ide_drive_t *drive = to_ide_device(dev);
1125 idescsi_scsi_t *idescsi; 1121 idescsi_scsi_t *idescsi;
1126 struct Scsi_Host *host; 1122 struct Scsi_Host *host;
1127 struct gendisk *g; 1123 struct gendisk *g;
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/libata-core.c b/drivers/scsi/libata-core.c
index ff31b0b6a6b3..c93bb1bd3332 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1075,13 +1075,59 @@ static unsigned int ata_pio_modes(const struct ata_device *adev)
1075static inline void 1075static inline void
1076ata_queue_pio_task(struct ata_port *ap) 1076ata_queue_pio_task(struct ata_port *ap)
1077{ 1077{
1078 queue_work(ata_wq, &ap->pio_task); 1078 if (!(ap->flags & ATA_FLAG_FLUSH_PIO_TASK))
1079 queue_work(ata_wq, &ap->pio_task);
1079} 1080}
1080 1081
1081static inline void 1082static inline void
1082ata_queue_delayed_pio_task(struct ata_port *ap, unsigned long delay) 1083ata_queue_delayed_pio_task(struct ata_port *ap, unsigned long delay)
1083{ 1084{
1084 queue_delayed_work(ata_wq, &ap->pio_task, delay); 1085 if (!(ap->flags & ATA_FLAG_FLUSH_PIO_TASK))
1086 queue_delayed_work(ata_wq, &ap->pio_task, delay);
1087}
1088
1089/**
1090 * ata_flush_pio_tasks - Flush pio_task and packet_task
1091 * @ap: the target ata_port
1092 *
1093 * After this function completes, pio_task and packet_task are
1094 * guranteed not to be running or scheduled.
1095 *
1096 * LOCKING:
1097 * Kernel thread context (may sleep)
1098 */
1099
1100static void ata_flush_pio_tasks(struct ata_port *ap)
1101{
1102 int tmp = 0;
1103 unsigned long flags;
1104
1105 DPRINTK("ENTER\n");
1106
1107 spin_lock_irqsave(&ap->host_set->lock, flags);
1108 ap->flags |= ATA_FLAG_FLUSH_PIO_TASK;
1109 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1110
1111 DPRINTK("flush #1\n");
1112 flush_workqueue(ata_wq);
1113
1114 /*
1115 * At this point, if a task is running, it's guaranteed to see
1116 * the FLUSH flag; thus, it will never queue pio tasks again.
1117 * Cancel and flush.
1118 */
1119 tmp |= cancel_delayed_work(&ap->pio_task);
1120 tmp |= cancel_delayed_work(&ap->packet_task);
1121 if (!tmp) {
1122 DPRINTK("flush #2\n");
1123 flush_workqueue(ata_wq);
1124 }
1125
1126 spin_lock_irqsave(&ap->host_set->lock, flags);
1127 ap->flags &= ~ATA_FLAG_FLUSH_PIO_TASK;
1128 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1129
1130 DPRINTK("EXIT\n");
1085} 1131}
1086 1132
1087void ata_qc_complete_internal(struct ata_queued_cmd *qc) 1133void ata_qc_complete_internal(struct ata_queued_cmd *qc)
@@ -1446,12 +1492,11 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap)
1446} 1492}
1447 1493
1448/** 1494/**
1449 * ata_dev_config - Run device specific handlers and check for 1495 * ata_dev_config - Run device specific handlers & check for SATA->PATA bridges
1450 * SATA->PATA bridges 1496 * @ap: Bus
1451 * @ap: Bus 1497 * @i: Device
1452 * @i: Device
1453 * 1498 *
1454 * LOCKING: 1499 * LOCKING:
1455 */ 1500 */
1456 1501
1457void ata_dev_config(struct ata_port *ap, unsigned int i) 1502void ata_dev_config(struct ata_port *ap, unsigned int i)
@@ -1798,9 +1843,9 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1798 ata_timing_quantize(t, t, T, UT); 1843 ata_timing_quantize(t, t, T, UT);
1799 1844
1800 /* 1845 /*
1801 * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T 1846 * Even in DMA/UDMA modes we still use PIO access for IDENTIFY,
1802 * and some other commands. We have to ensure that the DMA cycle timing is 1847 * S.M.A.R.T * and some other commands. We have to ensure that the
1803 * slower/equal than the fastest PIO timing. 1848 * DMA cycle timing is slower/equal than the fastest PIO timing.
1804 */ 1849 */
1805 1850
1806 if (speed > XFER_PIO_4) { 1851 if (speed > XFER_PIO_4) {
@@ -1809,7 +1854,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1809 } 1854 }
1810 1855
1811 /* 1856 /*
1812 * Lenghten active & recovery time so that cycle time is correct. 1857 * Lengthen active & recovery time so that cycle time is correct.
1813 */ 1858 */
1814 1859
1815 if (t->act8b + t->rec8b < t->cyc8b) { 1860 if (t->act8b + t->rec8b < t->cyc8b) {
@@ -1928,7 +1973,6 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode,
1928 * 1973 *
1929 * LOCKING: 1974 * LOCKING:
1930 * PCI/etc. bus probe sem. 1975 * PCI/etc. bus probe sem.
1931 *
1932 */ 1976 */
1933static void ata_set_mode(struct ata_port *ap) 1977static void ata_set_mode(struct ata_port *ap)
1934{ 1978{
@@ -1977,7 +2021,6 @@ err_out:
1977 * or a timeout occurs. 2021 * or a timeout occurs.
1978 * 2022 *
1979 * LOCKING: None. 2023 * LOCKING: None.
1980 *
1981 */ 2024 */
1982 2025
1983unsigned int ata_busy_sleep (struct ata_port *ap, 2026unsigned int ata_busy_sleep (struct ata_port *ap,
@@ -2237,6 +2280,324 @@ err_out:
2237 DPRINTK("EXIT\n"); 2280 DPRINTK("EXIT\n");
2238} 2281}
2239 2282
2283static int sata_phy_resume(struct ata_port *ap)
2284{
2285 unsigned long timeout = jiffies + (HZ * 5);
2286 u32 sstatus;
2287
2288 scr_write_flush(ap, SCR_CONTROL, 0x300);
2289
2290 /* Wait for phy to become ready, if necessary. */
2291 do {
2292 msleep(200);
2293 sstatus = scr_read(ap, SCR_STATUS);
2294 if ((sstatus & 0xf) != 1)
2295 return 0;
2296 } while (time_before(jiffies, timeout));
2297
2298 return -1;
2299}
2300
2301/**
2302 * ata_std_probeinit - initialize probing
2303 * @ap: port to be probed
2304 *
2305 * @ap is about to be probed. Initialize it. This function is
2306 * to be used as standard callback for ata_drive_probe_reset().
2307 */
2308extern void ata_std_probeinit(struct ata_port *ap)
2309{
2310 if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read)
2311 sata_phy_resume(ap);
2312}
2313
2314/**
2315 * ata_std_softreset - reset host port via ATA SRST
2316 * @ap: port to reset
2317 * @verbose: fail verbosely
2318 * @classes: resulting classes of attached devices
2319 *
2320 * Reset host port using ATA SRST. This function is to be used
2321 * as standard callback for ata_drive_*_reset() functions.
2322 *
2323 * LOCKING:
2324 * Kernel thread context (may sleep)
2325 *
2326 * RETURNS:
2327 * 0 on success, -errno otherwise.
2328 */
2329int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
2330{
2331 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
2332 unsigned int devmask = 0, err_mask;
2333 u8 err;
2334
2335 DPRINTK("ENTER\n");
2336
2337 /* determine if device 0/1 are present */
2338 if (ata_devchk(ap, 0))
2339 devmask |= (1 << 0);
2340 if (slave_possible && ata_devchk(ap, 1))
2341 devmask |= (1 << 1);
2342
2343 /* devchk reports device presence without actual device on
2344 * most SATA controllers. Check SStatus and turn devmask off
2345 * if link is offline. Note that we should continue resetting
2346 * even when it seems like there's no device.
2347 */
2348 if (ap->ops->scr_read && !sata_dev_present(ap))
2349 devmask = 0;
2350
2351 /* select device 0 again */
2352 ap->ops->dev_select(ap, 0);
2353
2354 /* issue bus reset */
2355 DPRINTK("about to softreset, devmask=%x\n", devmask);
2356 err_mask = ata_bus_softreset(ap, devmask);
2357 if (err_mask) {
2358 if (verbose)
2359 printk(KERN_ERR "ata%u: SRST failed (err_mask=0x%x)\n",
2360 ap->id, err_mask);
2361 else
2362 DPRINTK("EXIT, softreset failed (err_mask=0x%x)\n",
2363 err_mask);
2364 return -EIO;
2365 }
2366
2367 /* determine by signature whether we have ATA or ATAPI devices */
2368 classes[0] = ata_dev_try_classify(ap, 0, &err);
2369 if (slave_possible && err != 0x81)
2370 classes[1] = ata_dev_try_classify(ap, 1, &err);
2371
2372 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
2373 return 0;
2374}
2375
2376/**
2377 * sata_std_hardreset - reset host port via SATA phy reset
2378 * @ap: port to reset
2379 * @verbose: fail verbosely
2380 * @class: resulting class of attached device
2381 *
2382 * SATA phy-reset host port using DET bits of SControl register.
2383 * This function is to be used as standard callback for
2384 * ata_drive_*_reset().
2385 *
2386 * LOCKING:
2387 * Kernel thread context (may sleep)
2388 *
2389 * RETURNS:
2390 * 0 on success, -errno otherwise.
2391 */
2392int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
2393{
2394 u32 serror;
2395
2396 DPRINTK("ENTER\n");
2397
2398 /* Issue phy wake/reset */
2399 scr_write_flush(ap, SCR_CONTROL, 0x301);
2400
2401 /*
2402 * Couldn't find anything in SATA I/II specs, but AHCI-1.1
2403 * 10.4.2 says at least 1 ms.
2404 */
2405 msleep(1);
2406
2407 /* Bring phy back */
2408 sata_phy_resume(ap);
2409
2410 /* Clear SError */
2411 serror = scr_read(ap, SCR_ERROR);
2412 scr_write(ap, SCR_ERROR, serror);
2413
2414 /* TODO: phy layer with polling, timeouts, etc. */
2415 if (!sata_dev_present(ap)) {
2416 *class = ATA_DEV_NONE;
2417 DPRINTK("EXIT, link offline\n");
2418 return 0;
2419 }
2420
2421 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
2422 if (verbose)
2423 printk(KERN_ERR "ata%u: COMRESET failed "
2424 "(device not ready)\n", ap->id);
2425 else
2426 DPRINTK("EXIT, device not ready\n");
2427 return -EIO;
2428 }
2429
2430 *class = ata_dev_try_classify(ap, 0, NULL);
2431
2432 DPRINTK("EXIT, class=%u\n", *class);
2433 return 0;
2434}
2435
2436/**
2437 * ata_std_postreset - standard postreset callback
2438 * @ap: the target ata_port
2439 * @classes: classes of attached devices
2440 *
2441 * This function is invoked after a successful reset. Note that
2442 * the device might have been reset more than once using
2443 * different reset methods before postreset is invoked.
2444 * postreset is also reponsible for setting cable type.
2445 *
2446 * This function is to be used as standard callback for
2447 * ata_drive_*_reset().
2448 *
2449 * LOCKING:
2450 * Kernel thread context (may sleep)
2451 */
2452void ata_std_postreset(struct ata_port *ap, unsigned int *classes)
2453{
2454 DPRINTK("ENTER\n");
2455
2456 /* set cable type */
2457 if (ap->cbl == ATA_CBL_NONE && ap->flags & ATA_FLAG_SATA)
2458 ap->cbl = ATA_CBL_SATA;
2459
2460 /* print link status */
2461 if (ap->cbl == ATA_CBL_SATA)
2462 sata_print_link_status(ap);
2463
2464 /* bail out if no device is present */
2465 if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
2466 DPRINTK("EXIT, no device\n");
2467 return;
2468 }
2469
2470 /* is double-select really necessary? */
2471 if (classes[0] != ATA_DEV_NONE)
2472 ap->ops->dev_select(ap, 1);
2473 if (classes[1] != ATA_DEV_NONE)
2474 ap->ops->dev_select(ap, 0);
2475
2476 /* re-enable interrupts & set up device control */
2477 if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */
2478 ata_irq_on(ap);
2479
2480 DPRINTK("EXIT\n");
2481}
2482
2483/**
2484 * ata_std_probe_reset - standard probe reset method
2485 * @ap: prot to perform probe-reset
2486 * @classes: resulting classes of attached devices
2487 *
2488 * The stock off-the-shelf ->probe_reset method.
2489 *
2490 * LOCKING:
2491 * Kernel thread context (may sleep)
2492 *
2493 * RETURNS:
2494 * 0 on success, -errno otherwise.
2495 */
2496int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes)
2497{
2498 ata_reset_fn_t hardreset;
2499
2500 hardreset = NULL;
2501 if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read)
2502 hardreset = sata_std_hardreset;
2503
2504 return ata_drive_probe_reset(ap, ata_std_probeinit,
2505 ata_std_softreset, hardreset,
2506 ata_std_postreset, classes);
2507}
2508
2509static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset,
2510 ata_postreset_fn_t postreset,
2511 unsigned int *classes)
2512{
2513 int i, rc;
2514
2515 for (i = 0; i < ATA_MAX_DEVICES; i++)
2516 classes[i] = ATA_DEV_UNKNOWN;
2517
2518 rc = reset(ap, 0, classes);
2519 if (rc)
2520 return rc;
2521
2522 /* If any class isn't ATA_DEV_UNKNOWN, consider classification
2523 * is complete and convert all ATA_DEV_UNKNOWN to
2524 * ATA_DEV_NONE.
2525 */
2526 for (i = 0; i < ATA_MAX_DEVICES; i++)
2527 if (classes[i] != ATA_DEV_UNKNOWN)
2528 break;
2529
2530 if (i < ATA_MAX_DEVICES)
2531 for (i = 0; i < ATA_MAX_DEVICES; i++)
2532 if (classes[i] == ATA_DEV_UNKNOWN)
2533 classes[i] = ATA_DEV_NONE;
2534
2535 if (postreset)
2536 postreset(ap, classes);
2537
2538 return classes[0] != ATA_DEV_UNKNOWN ? 0 : -ENODEV;
2539}
2540
2541/**
2542 * ata_drive_probe_reset - Perform probe reset with given methods
2543 * @ap: port to reset
2544 * @probeinit: probeinit method (can be NULL)
2545 * @softreset: softreset method (can be NULL)
2546 * @hardreset: hardreset method (can be NULL)
2547 * @postreset: postreset method (can be NULL)
2548 * @classes: resulting classes of attached devices
2549 *
2550 * Reset the specified port and classify attached devices using
2551 * given methods. This function prefers softreset but tries all
2552 * possible reset sequences to reset and classify devices. This
2553 * function is intended to be used for constructing ->probe_reset
2554 * callback by low level drivers.
2555 *
2556 * Reset methods should follow the following rules.
2557 *
2558 * - Return 0 on sucess, -errno on failure.
2559 * - If classification is supported, fill classes[] with
2560 * recognized class codes.
2561 * - If classification is not supported, leave classes[] alone.
2562 * - If verbose is non-zero, print error message on failure;
2563 * otherwise, shut up.
2564 *
2565 * LOCKING:
2566 * Kernel thread context (may sleep)
2567 *
2568 * RETURNS:
2569 * 0 on success, -EINVAL if no reset method is avaliable, -ENODEV
2570 * if classification fails, and any error code from reset
2571 * methods.
2572 */
2573int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2574 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
2575 ata_postreset_fn_t postreset, unsigned int *classes)
2576{
2577 int rc = -EINVAL;
2578
2579 if (probeinit)
2580 probeinit(ap);
2581
2582 if (softreset) {
2583 rc = do_probe_reset(ap, softreset, postreset, classes);
2584 if (rc == 0)
2585 return 0;
2586 }
2587
2588 if (!hardreset)
2589 return rc;
2590
2591 rc = do_probe_reset(ap, hardreset, postreset, classes);
2592 if (rc == 0 || rc != -ENODEV)
2593 return rc;
2594
2595 if (softreset)
2596 rc = do_probe_reset(ap, softreset, postreset, classes);
2597
2598 return rc;
2599}
2600
2240static void ata_pr_blacklisted(const struct ata_port *ap, 2601static void ata_pr_blacklisted(const struct ata_port *ap,
2241 const struct ata_device *dev) 2602 const struct ata_device *dev)
2242{ 2603{
@@ -2913,7 +3274,7 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc)
2913} 3274}
2914 3275
2915/** 3276/**
2916 * ata_pio_poll - 3277 * ata_pio_poll - poll using PIO, depending on current state
2917 * @ap: the target ata_port 3278 * @ap: the target ata_port
2918 * 3279 *
2919 * LOCKING: 3280 * LOCKING:
@@ -3021,7 +3382,7 @@ static int ata_pio_complete (struct ata_port *ap)
3021 3382
3022 3383
3023/** 3384/**
3024 * swap_buf_le16 - swap halves of 16-words in place 3385 * swap_buf_le16 - swap halves of 16-bit words in place
3025 * @buf: Buffer to swap 3386 * @buf: Buffer to swap
3026 * @buf_words: Number of 16-bit words in buffer. 3387 * @buf_words: Number of 16-bit words in buffer.
3027 * 3388 *
@@ -3658,6 +4019,9 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
3658 4019
3659 DPRINTK("ENTER\n"); 4020 DPRINTK("ENTER\n");
3660 4021
4022 ata_flush_pio_tasks(ap);
4023 ap->hsm_task_state = HSM_ST_IDLE;
4024
3661 spin_lock_irqsave(&host_set->lock, flags); 4025 spin_lock_irqsave(&host_set->lock, flags);
3662 4026
3663 switch (qc->tf.protocol) { 4027 switch (qc->tf.protocol) {
@@ -4561,6 +4925,8 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev)
4561 4925
4562/** 4926/**
4563 * ata_device_resume - wakeup a previously suspended devices 4927 * ata_device_resume - wakeup a previously suspended devices
4928 * @ap: port the device is connected to
4929 * @dev: the device to resume
4564 * 4930 *
4565 * Kick the drive back into action, by sending it an idle immediate 4931 * Kick the drive back into action, by sending it an idle immediate
4566 * command and making sure its transfer mode matches between drive 4932 * command and making sure its transfer mode matches between drive
@@ -4583,10 +4949,11 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
4583 4949
4584/** 4950/**
4585 * ata_device_suspend - prepare a device for suspend 4951 * ata_device_suspend - prepare a device for suspend
4952 * @ap: port the device is connected to
4953 * @dev: the device to suspend
4586 * 4954 *
4587 * Flush the cache on the drive, if appropriate, then issue a 4955 * Flush the cache on the drive, if appropriate, then issue a
4588 * standbynow command. 4956 * standbynow command.
4589 *
4590 */ 4957 */
4591int ata_device_suspend(struct ata_port *ap, struct ata_device *dev) 4958int ata_device_suspend(struct ata_port *ap, struct ata_device *dev)
4592{ 4959{
@@ -4869,9 +5236,9 @@ int ata_device_add(const struct ata_probe_ent *ent)
4869 5236
4870 ap = host_set->ports[i]; 5237 ap = host_set->ports[i];
4871 5238
4872 DPRINTK("ata%u: probe begin\n", ap->id); 5239 DPRINTK("ata%u: bus probe begin\n", ap->id);
4873 rc = ata_bus_probe(ap); 5240 rc = ata_bus_probe(ap);
4874 DPRINTK("ata%u: probe end\n", ap->id); 5241 DPRINTK("ata%u: bus probe end\n", ap->id);
4875 5242
4876 if (rc) { 5243 if (rc) {
4877 /* FIXME: do something useful here? 5244 /* FIXME: do something useful here?
@@ -4895,7 +5262,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
4895 } 5262 }
4896 5263
4897 /* probes are done, now scan each port's disk(s) */ 5264 /* probes are done, now scan each port's disk(s) */
4898 DPRINTK("probe begin\n"); 5265 DPRINTK("host probe begin\n");
4899 for (i = 0; i < count; i++) { 5266 for (i = 0; i < count; i++) {
4900 struct ata_port *ap = host_set->ports[i]; 5267 struct ata_port *ap = host_set->ports[i];
4901 5268
@@ -5459,6 +5826,12 @@ EXPORT_SYMBOL_GPL(ata_port_probe);
5459EXPORT_SYMBOL_GPL(sata_phy_reset); 5826EXPORT_SYMBOL_GPL(sata_phy_reset);
5460EXPORT_SYMBOL_GPL(__sata_phy_reset); 5827EXPORT_SYMBOL_GPL(__sata_phy_reset);
5461EXPORT_SYMBOL_GPL(ata_bus_reset); 5828EXPORT_SYMBOL_GPL(ata_bus_reset);
5829EXPORT_SYMBOL_GPL(ata_std_probeinit);
5830EXPORT_SYMBOL_GPL(ata_std_softreset);
5831EXPORT_SYMBOL_GPL(sata_std_hardreset);
5832EXPORT_SYMBOL_GPL(ata_std_postreset);
5833EXPORT_SYMBOL_GPL(ata_std_probe_reset);
5834EXPORT_SYMBOL_GPL(ata_drive_probe_reset);
5462EXPORT_SYMBOL_GPL(ata_port_disable); 5835EXPORT_SYMBOL_GPL(ata_port_disable);
5463EXPORT_SYMBOL_GPL(ata_ratelimit); 5836EXPORT_SYMBOL_GPL(ata_ratelimit);
5464EXPORT_SYMBOL_GPL(ata_busy_sleep); 5837EXPORT_SYMBOL_GPL(ata_busy_sleep);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index ab6b53349d6f..b007bb409382 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -151,7 +151,7 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
151 struct scsi_sense_hdr sshdr; 151 struct scsi_sense_hdr sshdr;
152 enum dma_data_direction data_dir; 152 enum dma_data_direction data_dir;
153 153
154 if (NULL == (void *)arg) 154 if (arg == NULL)
155 return -EINVAL; 155 return -EINVAL;
156 156
157 if (copy_from_user(args, arg, sizeof(args))) 157 if (copy_from_user(args, arg, sizeof(args)))
@@ -201,7 +201,7 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
201 /* Need code to retrieve data from check condition? */ 201 /* Need code to retrieve data from check condition? */
202 202
203 if ((argbuf) 203 if ((argbuf)
204 && copy_to_user((void *)(arg + sizeof(args)), argbuf, argsize)) 204 && copy_to_user(arg + sizeof(args), argbuf, argsize))
205 rc = -EFAULT; 205 rc = -EFAULT;
206error: 206error:
207 if (argbuf) 207 if (argbuf)
@@ -228,7 +228,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
228 u8 args[7]; 228 u8 args[7];
229 struct scsi_sense_hdr sshdr; 229 struct scsi_sense_hdr sshdr;
230 230
231 if (NULL == (void *)arg) 231 if (arg == NULL)
232 return -EINVAL; 232 return -EINVAL;
233 233
234 if (copy_from_user(args, arg, sizeof(args))) 234 if (copy_from_user(args, arg, sizeof(args)))
@@ -732,16 +732,27 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
732int ata_scsi_error(struct Scsi_Host *host) 732int ata_scsi_error(struct Scsi_Host *host)
733{ 733{
734 struct ata_port *ap; 734 struct ata_port *ap;
735 unsigned long flags;
735 736
736 DPRINTK("ENTER\n"); 737 DPRINTK("ENTER\n");
737 738
738 ap = (struct ata_port *) &host->hostdata[0]; 739 ap = (struct ata_port *) &host->hostdata[0];
740
741 spin_lock_irqsave(&ap->host_set->lock, flags);
742 assert(!(ap->flags & ATA_FLAG_IN_EH));
743 ap->flags |= ATA_FLAG_IN_EH;
744 spin_unlock_irqrestore(&ap->host_set->lock, flags);
745
739 ap->ops->eng_timeout(ap); 746 ap->ops->eng_timeout(ap);
740 747
741 assert(host->host_failed == 0 && list_empty(&host->eh_cmd_q)); 748 assert(host->host_failed == 0 && list_empty(&host->eh_cmd_q));
742 749
743 scsi_eh_flush_done_q(&ap->eh_done_q); 750 scsi_eh_flush_done_q(&ap->eh_done_q);
744 751
752 spin_lock_irqsave(&ap->host_set->lock, flags);
753 ap->flags &= ~ATA_FLAG_IN_EH;
754 spin_unlock_irqrestore(&ap->host_set->lock, flags);
755
745 DPRINTK("EXIT\n"); 756 DPRINTK("EXIT\n");
746 return 0; 757 return 0;
747} 758}
@@ -1742,6 +1753,31 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last)
1742 return sizeof(def_rw_recovery_mpage); 1753 return sizeof(def_rw_recovery_mpage);
1743} 1754}
1744 1755
1756/*
1757 * We can turn this into a real blacklist if it's needed, for now just
1758 * blacklist any Maxtor BANC1G10 revision firmware
1759 */
1760static int ata_dev_supports_fua(u16 *id)
1761{
1762 unsigned char model[41], fw[9];
1763
1764 if (!ata_id_has_fua(id))
1765 return 0;
1766
1767 model[40] = '\0';
1768 fw[8] = '\0';
1769
1770 ata_dev_id_string(id, model, ATA_ID_PROD_OFS, sizeof(model) - 1);
1771 ata_dev_id_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw) - 1);
1772
1773 if (strncmp(model, "Maxtor", 6))
1774 return 1;
1775 if (strncmp(fw, "BANC1G10", 8))
1776 return 1;
1777
1778 return 0; /* blacklisted */
1779}
1780
1745/** 1781/**
1746 * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands 1782 * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands
1747 * @args: device IDENTIFY data / SCSI command of interest. 1783 * @args: device IDENTIFY data / SCSI command of interest.
@@ -1839,7 +1875,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf,
1839 return 0; 1875 return 0;
1840 1876
1841 dpofua = 0; 1877 dpofua = 0;
1842 if (ata_id_has_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && 1878 if (ata_dev_supports_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 &&
1843 (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) 1879 (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count))
1844 dpofua = 1 << 4; 1880 dpofua = 1 << 4;
1845 1881
@@ -2533,7 +2569,8 @@ out_unlock:
2533 2569
2534/** 2570/**
2535 * ata_scsi_simulate - simulate SCSI command on ATA device 2571 * ata_scsi_simulate - simulate SCSI command on ATA device
2536 * @id: current IDENTIFY data for target device. 2572 * @ap: port the device is connected to
2573 * @dev: the target device
2537 * @cmd: SCSI command being sent to device. 2574 * @cmd: SCSI command being sent to device.
2538 * @done: SCSI command completion function. 2575 * @done: SCSI command completion function.
2539 * 2576 *
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index 311a4122bd70..93edaa8696cf 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -537,9 +537,9 @@ static int mac53c94_remove(struct macio_dev *mdev)
537 free_irq(fp->intr, fp); 537 free_irq(fp->intr, fp);
538 538
539 if (fp->regs) 539 if (fp->regs)
540 iounmap((void *) fp->regs); 540 iounmap(fp->regs);
541 if (fp->dma) 541 if (fp->dma)
542 iounmap((void *) fp->dma); 542 iounmap(fp->dma);
543 kfree(fp->dma_cmd_space); 543 kfree(fp->dma_cmd_space);
544 544
545 scsi_host_put(host); 545 scsi_host_put(host);
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/sata_mv.c b/drivers/scsi/sata_mv.c
index 0042c7840d80..5b36a23455de 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -37,7 +37,7 @@
37#include <asm/io.h> 37#include <asm/io.h>
38 38
39#define DRV_NAME "sata_mv" 39#define DRV_NAME "sata_mv"
40#define DRV_VERSION "0.5" 40#define DRV_VERSION "0.6"
41 41
42enum { 42enum {
43 /* BAR's are enumerated in terms of pci_resource_start() terms */ 43 /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -228,7 +228,9 @@ enum {
228 MV_HP_ERRATA_50XXB2 = (1 << 2), 228 MV_HP_ERRATA_50XXB2 = (1 << 2),
229 MV_HP_ERRATA_60X1B2 = (1 << 3), 229 MV_HP_ERRATA_60X1B2 = (1 << 3),
230 MV_HP_ERRATA_60X1C0 = (1 << 4), 230 MV_HP_ERRATA_60X1C0 = (1 << 4),
231 MV_HP_50XX = (1 << 5), 231 MV_HP_ERRATA_XX42A0 = (1 << 5),
232 MV_HP_50XX = (1 << 6),
233 MV_HP_GEN_IIE = (1 << 7),
232 234
233 /* Port private flags (pp_flags) */ 235 /* Port private flags (pp_flags) */
234 MV_PP_FLAG_EDMA_EN = (1 << 0), 236 MV_PP_FLAG_EDMA_EN = (1 << 0),
@@ -237,6 +239,9 @@ enum {
237 239
238#define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX) 240#define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX)
239#define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0) 241#define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0)
242#define IS_GEN_I(hpriv) IS_50XX(hpriv)
243#define IS_GEN_II(hpriv) IS_60XX(hpriv)
244#define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE)
240 245
241enum { 246enum {
242 /* Our DMA boundary is determined by an ePRD being unable to handle 247 /* Our DMA boundary is determined by an ePRD being unable to handle
@@ -255,6 +260,8 @@ enum chip_type {
255 chip_5080, 260 chip_5080,
256 chip_604x, 261 chip_604x,
257 chip_608x, 262 chip_608x,
263 chip_6042,
264 chip_7042,
258}; 265};
259 266
260/* Command ReQuest Block: 32B */ 267/* Command ReQuest Block: 32B */
@@ -265,6 +272,14 @@ struct mv_crqb {
265 u16 ata_cmd[11]; 272 u16 ata_cmd[11];
266}; 273};
267 274
275struct mv_crqb_iie {
276 u32 addr;
277 u32 addr_hi;
278 u32 flags;
279 u32 len;
280 u32 ata_cmd[4];
281};
282
268/* Command ResPonse Block: 8B */ 283/* Command ResPonse Block: 8B */
269struct mv_crpb { 284struct mv_crpb {
270 u16 id; 285 u16 id;
@@ -328,6 +343,7 @@ static void mv_host_stop(struct ata_host_set *host_set);
328static int mv_port_start(struct ata_port *ap); 343static int mv_port_start(struct ata_port *ap);
329static void mv_port_stop(struct ata_port *ap); 344static void mv_port_stop(struct ata_port *ap);
330static void mv_qc_prep(struct ata_queued_cmd *qc); 345static void mv_qc_prep(struct ata_queued_cmd *qc);
346static void mv_qc_prep_iie(struct ata_queued_cmd *qc);
331static unsigned int mv_qc_issue(struct ata_queued_cmd *qc); 347static unsigned int mv_qc_issue(struct ata_queued_cmd *qc);
332static irqreturn_t mv_interrupt(int irq, void *dev_instance, 348static irqreturn_t mv_interrupt(int irq, void *dev_instance,
333 struct pt_regs *regs); 349 struct pt_regs *regs);
@@ -430,6 +446,33 @@ static const struct ata_port_operations mv6_ops = {
430 .host_stop = mv_host_stop, 446 .host_stop = mv_host_stop,
431}; 447};
432 448
449static const struct ata_port_operations mv_iie_ops = {
450 .port_disable = ata_port_disable,
451
452 .tf_load = ata_tf_load,
453 .tf_read = ata_tf_read,
454 .check_status = ata_check_status,
455 .exec_command = ata_exec_command,
456 .dev_select = ata_std_dev_select,
457
458 .phy_reset = mv_phy_reset,
459
460 .qc_prep = mv_qc_prep_iie,
461 .qc_issue = mv_qc_issue,
462
463 .eng_timeout = mv_eng_timeout,
464
465 .irq_handler = mv_interrupt,
466 .irq_clear = mv_irq_clear,
467
468 .scr_read = mv_scr_read,
469 .scr_write = mv_scr_write,
470
471 .port_start = mv_port_start,
472 .port_stop = mv_port_stop,
473 .host_stop = mv_host_stop,
474};
475
433static const struct ata_port_info mv_port_info[] = { 476static const struct ata_port_info mv_port_info[] = {
434 { /* chip_504x */ 477 { /* chip_504x */
435 .sht = &mv_sht, 478 .sht = &mv_sht,
@@ -467,6 +510,21 @@ static const struct ata_port_info mv_port_info[] = {
467 .udma_mask = 0x7f, /* udma0-6 */ 510 .udma_mask = 0x7f, /* udma0-6 */
468 .port_ops = &mv6_ops, 511 .port_ops = &mv6_ops,
469 }, 512 },
513 { /* chip_6042 */
514 .sht = &mv_sht,
515 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
516 .pio_mask = 0x1f, /* pio0-4 */
517 .udma_mask = 0x7f, /* udma0-6 */
518 .port_ops = &mv_iie_ops,
519 },
520 { /* chip_7042 */
521 .sht = &mv_sht,
522 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS |
523 MV_FLAG_DUAL_HC),
524 .pio_mask = 0x1f, /* pio0-4 */
525 .udma_mask = 0x7f, /* udma0-6 */
526 .port_ops = &mv_iie_ops,
527 },
470}; 528};
471 529
472static const struct pci_device_id mv_pci_tbl[] = { 530static const struct pci_device_id mv_pci_tbl[] = {
@@ -477,6 +535,7 @@ static const struct pci_device_id mv_pci_tbl[] = {
477 535
478 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, 536 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x},
479 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, 537 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x},
538 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6042), 0, 0, chip_6042},
480 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x}, 539 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x},
481 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x}, 540 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x},
482 541
@@ -510,6 +569,12 @@ static const struct mv_hw_ops mv6xxx_ops = {
510}; 569};
511 570
512/* 571/*
572 * module options
573 */
574static int msi; /* Use PCI msi; either zero (off, default) or non-zero */
575
576
577/*
513 * Functions 578 * Functions
514 */ 579 */
515 580
@@ -767,6 +832,33 @@ static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev)
767 dma_free_coherent(dev, MV_PORT_PRIV_DMA_SZ, pp->crpb, pp->crpb_dma); 832 dma_free_coherent(dev, MV_PORT_PRIV_DMA_SZ, pp->crpb, pp->crpb_dma);
768} 833}
769 834
835static void mv_edma_cfg(struct mv_host_priv *hpriv, void __iomem *port_mmio)
836{
837 u32 cfg = readl(port_mmio + EDMA_CFG_OFS);
838
839 /* set up non-NCQ EDMA configuration */
840 cfg &= ~0x1f; /* clear queue depth */
841 cfg &= ~EDMA_CFG_NCQ; /* clear NCQ mode */
842 cfg &= ~(1 << 9); /* disable equeue */
843
844 if (IS_GEN_I(hpriv))
845 cfg |= (1 << 8); /* enab config burst size mask */
846
847 else if (IS_GEN_II(hpriv))
848 cfg |= EDMA_CFG_RD_BRST_EXT | EDMA_CFG_WR_BUFF_LEN;
849
850 else if (IS_GEN_IIE(hpriv)) {
851 cfg |= (1 << 23); /* dis RX PM port mask */
852 cfg &= ~(1 << 16); /* dis FIS-based switching (for now) */
853 cfg &= ~(1 << 19); /* dis 128-entry queue (for now?) */
854 cfg |= (1 << 18); /* enab early completion */
855 cfg |= (1 << 17); /* enab host q cache */
856 cfg |= (1 << 22); /* enab cutthrough */
857 }
858
859 writelfl(cfg, port_mmio + EDMA_CFG_OFS);
860}
861
770/** 862/**
771 * mv_port_start - Port specific init/start routine. 863 * mv_port_start - Port specific init/start routine.
772 * @ap: ATA channel to manipulate 864 * @ap: ATA channel to manipulate
@@ -780,6 +872,7 @@ static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev)
780static int mv_port_start(struct ata_port *ap) 872static int mv_port_start(struct ata_port *ap)
781{ 873{
782 struct device *dev = ap->host_set->dev; 874 struct device *dev = ap->host_set->dev;
875 struct mv_host_priv *hpriv = ap->host_set->private_data;
783 struct mv_port_priv *pp; 876 struct mv_port_priv *pp;
784 void __iomem *port_mmio = mv_ap_base(ap); 877 void __iomem *port_mmio = mv_ap_base(ap);
785 void *mem; 878 void *mem;
@@ -823,17 +916,26 @@ static int mv_port_start(struct ata_port *ap)
823 pp->sg_tbl = mem; 916 pp->sg_tbl = mem;
824 pp->sg_tbl_dma = mem_dma; 917 pp->sg_tbl_dma = mem_dma;
825 918
826 writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | 919 mv_edma_cfg(hpriv, port_mmio);
827 EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS);
828 920
829 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); 921 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS);
830 writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, 922 writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK,
831 port_mmio + EDMA_REQ_Q_IN_PTR_OFS); 923 port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
832 924
833 writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); 925 if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0)
834 writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); 926 writelfl(pp->crqb_dma & 0xffffffff,
927 port_mmio + EDMA_REQ_Q_OUT_PTR_OFS);
928 else
929 writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS);
835 930
836 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); 931 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS);
932
933 if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0)
934 writelfl(pp->crpb_dma & 0xffffffff,
935 port_mmio + EDMA_RSP_Q_IN_PTR_OFS);
936 else
937 writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS);
938
837 writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, 939 writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK,
838 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 940 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
839 941
@@ -954,9 +1056,8 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
954 struct ata_taskfile *tf; 1056 struct ata_taskfile *tf;
955 u16 flags = 0; 1057 u16 flags = 0;
956 1058
957 if (ATA_PROT_DMA != qc->tf.protocol) { 1059 if (ATA_PROT_DMA != qc->tf.protocol)
958 return; 1060 return;
959 }
960 1061
961 /* the req producer index should be the same as we remember it */ 1062 /* the req producer index should be the same as we remember it */
962 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> 1063 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
@@ -965,9 +1066,8 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
965 1066
966 /* Fill in command request block 1067 /* Fill in command request block
967 */ 1068 */
968 if (!(qc->tf.flags & ATA_TFLAG_WRITE)) { 1069 if (!(qc->tf.flags & ATA_TFLAG_WRITE))
969 flags |= CRQB_FLAG_READ; 1070 flags |= CRQB_FLAG_READ;
970 }
971 assert(MV_MAX_Q_DEPTH > qc->tag); 1071 assert(MV_MAX_Q_DEPTH > qc->tag);
972 flags |= qc->tag << CRQB_TAG_SHIFT; 1072 flags |= qc->tag << CRQB_TAG_SHIFT;
973 1073
@@ -1022,9 +1122,76 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
1022 mv_crqb_pack_cmd(cw++, tf->device, ATA_REG_DEVICE, 0); 1122 mv_crqb_pack_cmd(cw++, tf->device, ATA_REG_DEVICE, 0);
1023 mv_crqb_pack_cmd(cw++, tf->command, ATA_REG_CMD, 1); /* last */ 1123 mv_crqb_pack_cmd(cw++, tf->command, ATA_REG_CMD, 1); /* last */
1024 1124
1025 if (!(qc->flags & ATA_QCFLAG_DMAMAP)) { 1125 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
1126 return;
1127 mv_fill_sg(qc);
1128}
1129
1130/**
1131 * mv_qc_prep_iie - Host specific command preparation.
1132 * @qc: queued command to prepare
1133 *
1134 * This routine simply redirects to the general purpose routine
1135 * if command is not DMA. Else, it handles prep of the CRQB
1136 * (command request block), does some sanity checking, and calls
1137 * the SG load routine.
1138 *
1139 * LOCKING:
1140 * Inherited from caller.
1141 */
1142static void mv_qc_prep_iie(struct ata_queued_cmd *qc)
1143{
1144 struct ata_port *ap = qc->ap;
1145 struct mv_port_priv *pp = ap->private_data;
1146 struct mv_crqb_iie *crqb;
1147 struct ata_taskfile *tf;
1148 u32 flags = 0;
1149
1150 if (ATA_PROT_DMA != qc->tf.protocol)
1151 return;
1152
1153 /* the req producer index should be the same as we remember it */
1154 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
1155 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
1156 pp->req_producer);
1157
1158 /* Fill in Gen IIE command request block
1159 */
1160 if (!(qc->tf.flags & ATA_TFLAG_WRITE))
1161 flags |= CRQB_FLAG_READ;
1162
1163 assert(MV_MAX_Q_DEPTH > qc->tag);
1164 flags |= qc->tag << CRQB_TAG_SHIFT;
1165
1166 crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer];
1167 crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);
1168 crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);
1169 crqb->flags = cpu_to_le32(flags);
1170
1171 tf = &qc->tf;
1172 crqb->ata_cmd[0] = cpu_to_le32(
1173 (tf->command << 16) |
1174 (tf->feature << 24)
1175 );
1176 crqb->ata_cmd[1] = cpu_to_le32(
1177 (tf->lbal << 0) |
1178 (tf->lbam << 8) |
1179 (tf->lbah << 16) |
1180 (tf->device << 24)
1181 );
1182 crqb->ata_cmd[2] = cpu_to_le32(
1183 (tf->hob_lbal << 0) |
1184 (tf->hob_lbam << 8) |
1185 (tf->hob_lbah << 16) |
1186 (tf->hob_feature << 24)
1187 );
1188 crqb->ata_cmd[3] = cpu_to_le32(
1189 (tf->nsect << 0) |
1190 (tf->hob_nsect << 8)
1191 );
1192
1193 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
1026 return; 1194 return;
1027 }
1028 mv_fill_sg(qc); 1195 mv_fill_sg(qc);
1029} 1196}
1030 1197
@@ -1673,6 +1840,12 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
1673 m2 |= hpriv->signal[port].pre; 1840 m2 |= hpriv->signal[port].pre;
1674 m2 &= ~(1 << 16); 1841 m2 &= ~(1 << 16);
1675 1842
1843 /* according to mvSata 3.6.1, some IIE values are fixed */
1844 if (IS_GEN_IIE(hpriv)) {
1845 m2 &= ~0xC30FF01F;
1846 m2 |= 0x0000900F;
1847 }
1848
1676 writel(m2, port_mmio + PHY_MODE2); 1849 writel(m2, port_mmio + PHY_MODE2);
1677} 1850}
1678 1851
@@ -1977,6 +2150,27 @@ static int mv_chip_id(struct pci_dev *pdev, struct mv_host_priv *hpriv,
1977 } 2150 }
1978 break; 2151 break;
1979 2152
2153 case chip_7042:
2154 case chip_6042:
2155 hpriv->ops = &mv6xxx_ops;
2156
2157 hp_flags |= MV_HP_GEN_IIE;
2158
2159 switch (rev_id) {
2160 case 0x0:
2161 hp_flags |= MV_HP_ERRATA_XX42A0;
2162 break;
2163 case 0x1:
2164 hp_flags |= MV_HP_ERRATA_60X1C0;
2165 break;
2166 default:
2167 dev_printk(KERN_WARNING, &pdev->dev,
2168 "Applying 60X1C0 workarounds to unknown rev\n");
2169 hp_flags |= MV_HP_ERRATA_60X1C0;
2170 break;
2171 }
2172 break;
2173
1980 default: 2174 default:
1981 printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx); 2175 printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx);
1982 return 1; 2176 return 1;
@@ -2180,7 +2374,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2180 } 2374 }
2181 2375
2182 /* Enable interrupts */ 2376 /* Enable interrupts */
2183 if (pci_enable_msi(pdev) == 0) { 2377 if (msi && pci_enable_msi(pdev) == 0) {
2184 hpriv->hp_flags |= MV_HP_FLAG_MSI; 2378 hpriv->hp_flags |= MV_HP_FLAG_MSI;
2185 } else { 2379 } else {
2186 pci_intx(pdev, 1); 2380 pci_intx(pdev, 1);
@@ -2235,5 +2429,8 @@ MODULE_LICENSE("GPL");
2235MODULE_DEVICE_TABLE(pci, mv_pci_tbl); 2429MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
2236MODULE_VERSION(DRV_VERSION); 2430MODULE_VERSION(DRV_VERSION);
2237 2431
2432module_param(msi, int, 0444);
2433MODULE_PARM_DESC(msi, "Enable use of PCI MSI (0=off, 1=on)");
2434
2238module_init(mv_init); 2435module_init(mv_init);
2239module_exit(mv_exit); 2436module_exit(mv_exit);
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 760c56f71632..dcd1667f4144 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -46,7 +46,7 @@
46#include "sata_promise.h" 46#include "sata_promise.h"
47 47
48#define DRV_NAME "sata_promise" 48#define DRV_NAME "sata_promise"
49#define DRV_VERSION "1.03" 49#define DRV_VERSION "1.04"
50 50
51 51
52enum { 52enum {
@@ -58,6 +58,7 @@ enum {
58 PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ 58 PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */
59 PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ 59 PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */
60 PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ 60 PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */
61 PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */
61 PDC_SLEW_CTL = 0x470, /* slew rate control reg */ 62 PDC_SLEW_CTL = 0x470, /* slew rate control reg */
62 63
63 PDC_ERR_MASK = (1<<19) | (1<<20) | (1<<21) | (1<<22) | 64 PDC_ERR_MASK = (1<<19) | (1<<20) | (1<<21) | (1<<22) |
@@ -67,8 +68,10 @@ enum {
67 board_20319 = 1, /* FastTrak S150 TX4 */ 68 board_20319 = 1, /* FastTrak S150 TX4 */
68 board_20619 = 2, /* FastTrak TX4000 */ 69 board_20619 = 2, /* FastTrak TX4000 */
69 board_20771 = 3, /* FastTrak TX2300 */ 70 board_20771 = 3, /* FastTrak TX2300 */
71 board_2057x = 4, /* SATAII150 Tx2plus */
72 board_40518 = 5, /* SATAII150 Tx4 */
70 73
71 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ 74 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */
72 75
73 PDC_RESET = (1 << 11), /* HDMA reset */ 76 PDC_RESET = (1 << 11), /* HDMA reset */
74 77
@@ -83,6 +86,10 @@ struct pdc_port_priv {
83 dma_addr_t pkt_dma; 86 dma_addr_t pkt_dma;
84}; 87};
85 88
89struct pdc_host_priv {
90 int hotplug_offset;
91};
92
86static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); 93static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
87static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 94static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
88static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 95static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
@@ -97,6 +104,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
97static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 104static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
98static void pdc_irq_clear(struct ata_port *ap); 105static void pdc_irq_clear(struct ata_port *ap);
99static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 106static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
107static void pdc_host_stop(struct ata_host_set *host_set);
100 108
101 109
102static struct scsi_host_template pdc_ata_sht = { 110static struct scsi_host_template pdc_ata_sht = {
@@ -138,7 +146,7 @@ static const struct ata_port_operations pdc_sata_ops = {
138 .scr_write = pdc_sata_scr_write, 146 .scr_write = pdc_sata_scr_write,
139 .port_start = pdc_port_start, 147 .port_start = pdc_port_start,
140 .port_stop = pdc_port_stop, 148 .port_stop = pdc_port_stop,
141 .host_stop = ata_pci_host_stop, 149 .host_stop = pdc_host_stop,
142}; 150};
143 151
144static const struct ata_port_operations pdc_pata_ops = { 152static const struct ata_port_operations pdc_pata_ops = {
@@ -159,7 +167,7 @@ static const struct ata_port_operations pdc_pata_ops = {
159 167
160 .port_start = pdc_port_start, 168 .port_start = pdc_port_start,
161 .port_stop = pdc_port_stop, 169 .port_stop = pdc_port_stop,
162 .host_stop = ata_pci_host_stop, 170 .host_stop = pdc_host_stop,
163}; 171};
164 172
165static const struct ata_port_info pdc_port_info[] = { 173static const struct ata_port_info pdc_port_info[] = {
@@ -202,6 +210,26 @@ static const struct ata_port_info pdc_port_info[] = {
202 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 210 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
203 .port_ops = &pdc_sata_ops, 211 .port_ops = &pdc_sata_ops,
204 }, 212 },
213
214 /* board_2057x */
215 {
216 .sht = &pdc_ata_sht,
217 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
218 .pio_mask = 0x1f, /* pio0-4 */
219 .mwdma_mask = 0x07, /* mwdma0-2 */
220 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
221 .port_ops = &pdc_sata_ops,
222 },
223
224 /* board_40518 */
225 {
226 .sht = &pdc_ata_sht,
227 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
228 .pio_mask = 0x1f, /* pio0-4 */
229 .mwdma_mask = 0x07, /* mwdma0-2 */
230 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
231 .port_ops = &pdc_sata_ops,
232 },
205}; 233};
206 234
207static const struct pci_device_id pdc_ata_pci_tbl[] = { 235static const struct pci_device_id pdc_ata_pci_tbl[] = {
@@ -218,9 +246,9 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
218 { PCI_VENDOR_ID_PROMISE, 0x3376, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 246 { PCI_VENDOR_ID_PROMISE, 0x3376, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
219 board_2037x }, 247 board_2037x },
220 { PCI_VENDOR_ID_PROMISE, 0x3574, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 248 { PCI_VENDOR_ID_PROMISE, 0x3574, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
221 board_2037x }, 249 board_2057x },
222 { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 250 { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
223 board_2037x }, 251 board_2057x },
224 { PCI_VENDOR_ID_PROMISE, 0x3d73, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 252 { PCI_VENDOR_ID_PROMISE, 0x3d73, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
225 board_2037x }, 253 board_2037x },
226 254
@@ -233,7 +261,7 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
233 { PCI_VENDOR_ID_PROMISE, 0x3d17, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 261 { PCI_VENDOR_ID_PROMISE, 0x3d17, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
234 board_20319 }, 262 board_20319 },
235 { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 263 { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
236 board_20319 }, 264 board_40518 },
237 265
238 { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 266 { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
239 board_20619 }, 267 board_20619 },
@@ -262,12 +290,11 @@ static int pdc_port_start(struct ata_port *ap)
262 if (rc) 290 if (rc)
263 return rc; 291 return rc;
264 292
265 pp = kmalloc(sizeof(*pp), GFP_KERNEL); 293 pp = kzalloc(sizeof(*pp), GFP_KERNEL);
266 if (!pp) { 294 if (!pp) {
267 rc = -ENOMEM; 295 rc = -ENOMEM;
268 goto err_out; 296 goto err_out;
269 } 297 }
270 memset(pp, 0, sizeof(*pp));
271 298
272 pp->pkt = dma_alloc_coherent(dev, 128, &pp->pkt_dma, GFP_KERNEL); 299 pp->pkt = dma_alloc_coherent(dev, 128, &pp->pkt_dma, GFP_KERNEL);
273 if (!pp->pkt) { 300 if (!pp->pkt) {
@@ -299,6 +326,16 @@ static void pdc_port_stop(struct ata_port *ap)
299} 326}
300 327
301 328
329static void pdc_host_stop(struct ata_host_set *host_set)
330{
331 struct pdc_host_priv *hp = host_set->private_data;
332
333 ata_pci_host_stop(host_set);
334
335 kfree(hp);
336}
337
338
302static void pdc_reset_port(struct ata_port *ap) 339static void pdc_reset_port(struct ata_port *ap)
303{ 340{
304 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT; 341 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT;
@@ -488,14 +525,15 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
488 VPRINTK("QUICK EXIT 2\n"); 525 VPRINTK("QUICK EXIT 2\n");
489 return IRQ_NONE; 526 return IRQ_NONE;
490 } 527 }
528
529 spin_lock(&host_set->lock);
530
491 mask &= 0xffff; /* only 16 tags possible */ 531 mask &= 0xffff; /* only 16 tags possible */
492 if (!mask) { 532 if (!mask) {
493 VPRINTK("QUICK EXIT 3\n"); 533 VPRINTK("QUICK EXIT 3\n");
494 return IRQ_NONE; 534 goto done_irq;
495 } 535 }
496 536
497 spin_lock(&host_set->lock);
498
499 writel(mask, mmio_base + PDC_INT_SEQMASK); 537 writel(mask, mmio_base + PDC_INT_SEQMASK);
500 538
501 for (i = 0; i < host_set->n_ports; i++) { 539 for (i = 0; i < host_set->n_ports; i++) {
@@ -512,10 +550,10 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
512 } 550 }
513 } 551 }
514 552
515 spin_unlock(&host_set->lock);
516
517 VPRINTK("EXIT\n"); 553 VPRINTK("EXIT\n");
518 554
555done_irq:
556 spin_unlock(&host_set->lock);
519 return IRQ_RETVAL(handled); 557 return IRQ_RETVAL(handled);
520} 558}
521 559
@@ -593,6 +631,8 @@ static void pdc_ata_setup_port(struct ata_ioports *port, unsigned long base)
593static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) 631static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
594{ 632{
595 void __iomem *mmio = pe->mmio_base; 633 void __iomem *mmio = pe->mmio_base;
634 struct pdc_host_priv *hp = pe->private_data;
635 int hotplug_offset = hp->hotplug_offset;
596 u32 tmp; 636 u32 tmp;
597 637
598 /* 638 /*
@@ -607,12 +647,12 @@ static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
607 writel(tmp, mmio + PDC_FLASH_CTL); 647 writel(tmp, mmio + PDC_FLASH_CTL);
608 648
609 /* clear plug/unplug flags for all ports */ 649 /* clear plug/unplug flags for all ports */
610 tmp = readl(mmio + PDC_SATA_PLUG_CSR); 650 tmp = readl(mmio + hotplug_offset);
611 writel(tmp | 0xff, mmio + PDC_SATA_PLUG_CSR); 651 writel(tmp | 0xff, mmio + hotplug_offset);
612 652
613 /* mask plug/unplug ints */ 653 /* mask plug/unplug ints */
614 tmp = readl(mmio + PDC_SATA_PLUG_CSR); 654 tmp = readl(mmio + hotplug_offset);
615 writel(tmp | 0xff0000, mmio + PDC_SATA_PLUG_CSR); 655 writel(tmp | 0xff0000, mmio + hotplug_offset);
616 656
617 /* reduce TBG clock to 133 Mhz. */ 657 /* reduce TBG clock to 133 Mhz. */
618 tmp = readl(mmio + PDC_TBG_MODE); 658 tmp = readl(mmio + PDC_TBG_MODE);
@@ -634,6 +674,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
634{ 674{
635 static int printed_version; 675 static int printed_version;
636 struct ata_probe_ent *probe_ent = NULL; 676 struct ata_probe_ent *probe_ent = NULL;
677 struct pdc_host_priv *hp;
637 unsigned long base; 678 unsigned long base;
638 void __iomem *mmio_base; 679 void __iomem *mmio_base;
639 unsigned int board_idx = (unsigned int) ent->driver_data; 680 unsigned int board_idx = (unsigned int) ent->driver_data;
@@ -664,13 +705,12 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
664 if (rc) 705 if (rc)
665 goto err_out_regions; 706 goto err_out_regions;
666 707
667 probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); 708 probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL);
668 if (probe_ent == NULL) { 709 if (probe_ent == NULL) {
669 rc = -ENOMEM; 710 rc = -ENOMEM;
670 goto err_out_regions; 711 goto err_out_regions;
671 } 712 }
672 713
673 memset(probe_ent, 0, sizeof(*probe_ent));
674 probe_ent->dev = pci_dev_to_dev(pdev); 714 probe_ent->dev = pci_dev_to_dev(pdev);
675 INIT_LIST_HEAD(&probe_ent->node); 715 INIT_LIST_HEAD(&probe_ent->node);
676 716
@@ -681,6 +721,16 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
681 } 721 }
682 base = (unsigned long) mmio_base; 722 base = (unsigned long) mmio_base;
683 723
724 hp = kzalloc(sizeof(*hp), GFP_KERNEL);
725 if (hp == NULL) {
726 rc = -ENOMEM;
727 goto err_out_free_ent;
728 }
729
730 /* Set default hotplug offset */
731 hp->hotplug_offset = PDC_SATA_PLUG_CSR;
732 probe_ent->private_data = hp;
733
684 probe_ent->sht = pdc_port_info[board_idx].sht; 734 probe_ent->sht = pdc_port_info[board_idx].sht;
685 probe_ent->host_flags = pdc_port_info[board_idx].host_flags; 735 probe_ent->host_flags = pdc_port_info[board_idx].host_flags;
686 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask; 736 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask;
@@ -700,6 +750,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
700 750
701 /* notice 4-port boards */ 751 /* notice 4-port boards */
702 switch (board_idx) { 752 switch (board_idx) {
753 case board_40518:
754 /* Override hotplug offset for SATAII150 */
755 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
756 /* Fall through */
703 case board_20319: 757 case board_20319:
704 probe_ent->n_ports = 4; 758 probe_ent->n_ports = 4;
705 759
@@ -709,6 +763,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
709 probe_ent->port[2].scr_addr = base + 0x600; 763 probe_ent->port[2].scr_addr = base + 0x600;
710 probe_ent->port[3].scr_addr = base + 0x700; 764 probe_ent->port[3].scr_addr = base + 0x700;
711 break; 765 break;
766 case board_2057x:
767 /* Override hotplug offset for SATAII150 */
768 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
769 /* Fall through */
712 case board_2037x: 770 case board_2037x:
713 probe_ent->n_ports = 2; 771 probe_ent->n_ports = 2;
714 break; 772 break;
@@ -734,8 +792,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
734 /* initialize adapter */ 792 /* initialize adapter */
735 pdc_host_init(board_idx, probe_ent); 793 pdc_host_init(board_idx, probe_ent);
736 794
737 /* FIXME: check ata_device_add return value */ 795 /* FIXME: Need any other frees than hp? */
738 ata_device_add(probe_ent); 796 if (!ata_device_add(probe_ent))
797 kfree(hp);
798
739 kfree(probe_ent); 799 kfree(probe_ent);
740 800
741 return 0; 801 return 0;
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 245ca99a641e..c551bb84dbfb 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1245,7 +1245,7 @@ static int __init init_scsi(void)
1245 if (error) 1245 if (error)
1246 goto cleanup_sysctl; 1246 goto cleanup_sysctl;
1247 1247
1248 for (i = 0; i < NR_CPUS; i++) 1248 for_each_cpu(i)
1249 INIT_LIST_HEAD(&per_cpu(scsi_done_q, i)); 1249 INIT_LIST_HEAD(&per_cpu(scsi_done_q, i));
1250 1250
1251 devfs_mk_dir("scsi"); 1251 devfs_mk_dir("scsi");
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 6bac3d2668fa..50f8057be75d 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_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 59a1c9d9d3bd..723f7acbeb12 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -463,7 +463,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
463} 463}
464 464
465static void* 465static void*
466mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 466mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
467{ 467{
468 struct mempool_zone *zone = pool_data; 468 struct mempool_zone *zone = pool_data;
469 469
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..2a547538d444 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)) {
@@ -1679,7 +1679,7 @@ static int
1679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) 1679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
1680{ 1680{
1681 int sg_bufflen = tablesize * sizeof(struct scatterlist); 1681 int sg_bufflen = tablesize * sizeof(struct scatterlist);
1682 unsigned int gfp_flags = GFP_ATOMIC | __GFP_NOWARN; 1682 gfp_t gfp_flags = GFP_ATOMIC | __GFP_NOWARN;
1683 1683
1684 /* 1684 /*
1685 * TODO: test without low_dma, we should not need it since 1685 * TODO: test without low_dma, we should not need it since
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 */