aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/53c7xx.c6
-rw-r--r--drivers/scsi/53c7xx.h2
-rw-r--r--drivers/scsi/Kconfig31
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/NCR53C9x.c10
-rw-r--r--drivers/scsi/NCR53C9x.h6
-rw-r--r--drivers/scsi/NCR53c406a.c4
-rw-r--r--drivers/scsi/a2091.c4
-rw-r--r--drivers/scsi/a2091.h2
-rw-r--r--drivers/scsi/a3000.c4
-rw-r--r--drivers/scsi/a3000.h2
-rw-r--r--drivers/scsi/aacraid/aachba.c23
-rw-r--r--drivers/scsi/aacraid/commsup.c4
-rw-r--r--drivers/scsi/aacraid/linit.c2
-rw-r--r--drivers/scsi/advansys.c6
-rw-r--r--drivers/scsi/advansys.h2
-rw-r--r--drivers/scsi/aha152x.c4
-rw-r--r--drivers/scsi/aha1542.c4
-rw-r--r--drivers/scsi/aha1542.h2
-rw-r--r--drivers/scsi/aha1740.c2
-rw-r--r--drivers/scsi/ahci.c73
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c39
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c41
-rw-r--r--drivers/scsi/aic7xxx_old.c18
-rw-r--r--drivers/scsi/amiga7xx.c8
-rw-r--r--drivers/scsi/amiga7xx.h2
-rw-r--r--drivers/scsi/arm/acornscsi.c6
-rw-r--r--drivers/scsi/arm/acornscsi.h2
-rw-r--r--drivers/scsi/arm/arxescsi.c8
-rw-r--r--drivers/scsi/arm/cumana_1.c2
-rw-r--r--drivers/scsi/arm/cumana_2.c8
-rw-r--r--drivers/scsi/arm/ecoscsi.c2
-rw-r--r--drivers/scsi/arm/eesox.c8
-rw-r--r--drivers/scsi/arm/fas216.c10
-rw-r--r--drivers/scsi/arm/fas216.h8
-rw-r--r--drivers/scsi/arm/oak.c2
-rw-r--r--drivers/scsi/arm/powertec.c6
-rw-r--r--drivers/scsi/arm/scsi.h8
-rw-r--r--drivers/scsi/ata_piix.c4
-rw-r--r--drivers/scsi/atari_NCR5380.c2
-rw-r--r--drivers/scsi/atari_scsi.c4
-rw-r--r--drivers/scsi/atari_scsi.h2
-rw-r--r--drivers/scsi/blz1230.c4
-rw-r--r--drivers/scsi/blz2060.c4
-rw-r--r--drivers/scsi/bvme6000.c4
-rw-r--r--drivers/scsi/bvme6000.h2
-rw-r--r--drivers/scsi/cyberstorm.c4
-rw-r--r--drivers/scsi/cyberstormII.c4
-rw-r--r--drivers/scsi/dec_esp.c2
-rw-r--r--drivers/scsi/dpt_i2o.c34
-rw-r--r--drivers/scsi/dpti.h2
-rw-r--r--drivers/scsi/dtc.c6
-rw-r--r--drivers/scsi/dtc.h2
-rw-r--r--drivers/scsi/fastlane.c4
-rw-r--r--drivers/scsi/fcal.c8
-rw-r--r--drivers/scsi/fcal.h4
-rw-r--r--drivers/scsi/fd_mcs.c4
-rw-r--r--drivers/scsi/g_NCR5380.c6
-rw-r--r--drivers/scsi/g_NCR5380.h2
-rw-r--r--drivers/scsi/gdth.c12
-rw-r--r--drivers/scsi/gdth.h4
-rw-r--r--drivers/scsi/gdth_proc.c10
-rw-r--r--drivers/scsi/gvp11.c4
-rw-r--r--drivers/scsi/gvp11.h2
-rw-r--r--drivers/scsi/ibmmca.c8
-rw-r--r--drivers/scsi/ibmmca.h2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/iseries_vscsi.c3
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c8
-rw-r--r--drivers/scsi/ide-scsi.c4
-rw-r--r--drivers/scsi/in2000.c4
-rw-r--r--drivers/scsi/in2000.h2
-rw-r--r--drivers/scsi/ipr.c904
-rw-r--r--drivers/scsi/ipr.h243
-rw-r--r--drivers/scsi/ips.c150
-rw-r--r--drivers/scsi/ips.h4
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/jazz_esp.c4
-rw-r--r--drivers/scsi/libata-core.c111
-rw-r--r--drivers/scsi/libata-scsi.c146
-rw-r--r--drivers/scsi/libata.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c1
-rw-r--r--drivers/scsi/mac_esp.c4
-rw-r--r--drivers/scsi/mac_scsi.c6
-rw-r--r--drivers/scsi/mca_53c9x.c4
-rw-r--r--drivers/scsi/megaraid.c63
-rw-r--r--drivers/scsi/megaraid.h10
-rw-r--r--drivers/scsi/megaraid/mega_common.h2
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c81
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c5
-rw-r--r--drivers/scsi/mvme147.c4
-rw-r--r--drivers/scsi/mvme147.h2
-rw-r--r--drivers/scsi/mvme16x.c4
-rw-r--r--drivers/scsi/mvme16x.h2
-rw-r--r--drivers/scsi/nsp32.c6
-rw-r--r--drivers/scsi/oktagon_esp.c4
-rw-r--r--drivers/scsi/pas16.c6
-rw-r--r--drivers/scsi/pas16.h2
-rw-r--r--drivers/scsi/pci2000.h2
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c8
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h6
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c4
-rw-r--r--drivers/scsi/pdc_adma.c2
-rw-r--r--drivers/scsi/pluto.c8
-rw-r--r--drivers/scsi/pluto.h4
-rw-r--r--drivers/scsi/psi240i.c4
-rw-r--r--drivers/scsi/qla1280.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h10
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c28
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c15
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c10
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h4
-rw-r--r--drivers/scsi/qlogicfas.c6
-rw-r--r--drivers/scsi/qlogicfc.c4
-rw-r--r--drivers/scsi/qlogicisp.c1934
-rw-r--r--drivers/scsi/qlogicisp_asm.c2034
-rw-r--r--drivers/scsi/raid_class.c96
-rw-r--r--drivers/scsi/sata_mv.c1001
-rw-r--r--drivers/scsi/sata_nv.c2
-rw-r--r--drivers/scsi/sata_promise.c16
-rw-r--r--drivers/scsi/sata_qstor.c13
-rw-r--r--drivers/scsi/sata_sil.c2
-rw-r--r--drivers/scsi/sata_sil24.c221
-rw-r--r--drivers/scsi/sata_sis.c2
-rw-r--r--drivers/scsi/sata_svw.c4
-rw-r--r--drivers/scsi/sata_sx4.c7
-rw-r--r--drivers/scsi/sata_uli.c2
-rw-r--r--drivers/scsi/sata_via.c2
-rw-r--r--drivers/scsi/sata_vsc.c4
-rw-r--r--drivers/scsi/scsi.c2
-rw-r--r--drivers/scsi/scsi_debug.c2
-rw-r--r--drivers/scsi/scsi_error.c158
-rw-r--r--drivers/scsi/scsi_lib.c91
-rw-r--r--drivers/scsi/scsi_priv.h1
-rw-r--r--drivers/scsi/scsi_scan.c106
-rw-r--r--drivers/scsi/scsi_sysfs.c9
-rw-r--r--drivers/scsi/scsi_transport_fc.c59
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/scsi_transport_spi.c28
-rw-r--r--drivers/scsi/scsi_typedefs.h3
-rw-r--r--drivers/scsi/sd.c38
-rw-r--r--drivers/scsi/seagate.c4
-rw-r--r--drivers/scsi/seagate.h2
-rw-r--r--drivers/scsi/sg.c6
-rw-r--r--drivers/scsi/sgiwd93.c6
-rw-r--r--drivers/scsi/sr.c20
-rw-r--r--drivers/scsi/st.c22
-rw-r--r--drivers/scsi/sun3_NCR5380.c2
-rw-r--r--drivers/scsi/sun3_scsi.c6
-rw-r--r--drivers/scsi/sun3_scsi.h2
-rw-r--r--drivers/scsi/sun3_scsi_vme.c6
-rw-r--r--drivers/scsi/sun3x_esp.c4
-rw-r--r--drivers/scsi/sym53c416.c4
-rw-r--r--drivers/scsi/sym53c416.h2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c5
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c4
-rw-r--r--drivers/scsi/t128.c6
-rw-r--r--drivers/scsi/t128.h2
-rw-r--r--drivers/scsi/u14-34f.c2
-rw-r--r--drivers/scsi/ultrastor.c8
-rw-r--r--drivers/scsi/ultrastor.h2
163 files changed, 2879 insertions, 5530 deletions
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c
index 7a33c708f5b3..9cb5dd48383f 100644
--- a/drivers/scsi/53c7xx.c
+++ b/drivers/scsi/53c7xx.c
@@ -343,7 +343,7 @@ static void NCR53c7x0_soft_reset (struct Scsi_Host *host);
343/* Size of event list (per host adapter) */ 343/* Size of event list (per host adapter) */
344static int track_events = 0; 344static int track_events = 0;
345static struct Scsi_Host *first_host = NULL; /* Head of list of NCR boards */ 345static struct Scsi_Host *first_host = NULL; /* Head of list of NCR boards */
346static Scsi_Host_Template *the_template = NULL; 346static struct scsi_host_template *the_template = NULL;
347 347
348/* NCR53c710 script handling code */ 348/* NCR53c710 script handling code */
349 349
@@ -1103,7 +1103,7 @@ NCR53c7x0_init (struct Scsi_Host *host) {
1103} 1103}
1104 1104
1105/* 1105/*
1106 * Function : int ncr53c7xx_init(Scsi_Host_Template *tpnt, int board, int chip, 1106 * Function : int ncr53c7xx_init(struct scsi_host_template *tpnt, int board, int chip,
1107 * unsigned long base, int io_port, int irq, int dma, long long options, 1107 * unsigned long base, int io_port, int irq, int dma, long long options,
1108 * int clock); 1108 * int clock);
1109 * 1109 *
@@ -1118,7 +1118,7 @@ NCR53c7x0_init (struct Scsi_Host *host) {
1118 */ 1118 */
1119 1119
1120int 1120int
1121ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip, 1121ncr53c7xx_init (struct scsi_host_template *tpnt, int board, int chip,
1122 unsigned long base, int io_port, int irq, int dma, 1122 unsigned long base, int io_port, int irq, int dma,
1123 long long options, int clock) 1123 long long options, int clock)
1124{ 1124{
diff --git a/drivers/scsi/53c7xx.h b/drivers/scsi/53c7xx.h
index d9098bdace05..218f3b901537 100644
--- a/drivers/scsi/53c7xx.h
+++ b/drivers/scsi/53c7xx.h
@@ -1600,7 +1600,7 @@ struct NCR53c7x0_hostdata {
1600/* Paranoid people could use panic() here. */ 1600/* Paranoid people could use panic() here. */
1601#define FATAL(host) shutdown((host)); 1601#define FATAL(host) shutdown((host));
1602 1602
1603extern int ncr53c7xx_init(Scsi_Host_Template *tpnt, int board, int chip, 1603extern int ncr53c7xx_init(struct scsi_host_template *tpnt, int board, int chip,
1604 unsigned long base, int io_port, int irq, int dma, 1604 unsigned long base, int io_port, int irq, int dma,
1605 long long options, int clock); 1605 long long options, int clock);
1606 1606
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index afeca325b4dc..20dd85a77813 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -497,7 +497,7 @@ config SCSI_ATA_PIIX
497 If unsure, say N. 497 If unsure, say N.
498 498
499config SCSI_SATA_MV 499config SCSI_SATA_MV
500 tristate "Marvell SATA support" 500 tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)"
501 depends on SCSI_SATA && PCI && EXPERIMENTAL 501 depends on SCSI_SATA && PCI && EXPERIMENTAL
502 help 502 help
503 This option enables support for the Marvell Serial ATA family. 503 This option enables support for the Marvell Serial ATA family.
@@ -1295,27 +1295,6 @@ config SCSI_QLOGIC_FAS
1295 To compile this driver as a module, choose M here: the 1295 To compile this driver as a module, choose M here: the
1296 module will be called qlogicfas. 1296 module will be called qlogicfas.
1297 1297
1298config SCSI_QLOGIC_ISP
1299 tristate "Qlogic ISP SCSI support (old driver)"
1300 depends on PCI && SCSI && BROKEN
1301 ---help---
1302 This driver works for all QLogic PCI SCSI host adapters (IQ-PCI,
1303 IQ-PCI-10, IQ_PCI-D) except for the PCI-basic card. (This latter
1304 card is supported by the "AM53/79C974 PCI SCSI" driver.)
1305
1306 If you say Y here, make sure to choose "BIOS" at the question "PCI
1307 access mode".
1308
1309 Please read the file <file:Documentation/scsi/qlogicisp.txt>. You
1310 should also read the SCSI-HOWTO, available from
1311 <http://www.tldp.org/docs.html#howto>.
1312
1313 To compile this driver as a module, choose M here: the
1314 module will be called qlogicisp.
1315
1316 These days the hardware is also supported by the more modern qla1280
1317 driver. In doubt use that one instead of qlogicisp.
1318
1319config SCSI_QLOGIC_FC 1298config SCSI_QLOGIC_FC
1320 tristate "Qlogic ISP FC SCSI support" 1299 tristate "Qlogic ISP FC SCSI support"
1321 depends on PCI && SCSI 1300 depends on PCI && SCSI
@@ -1342,14 +1321,6 @@ config SCSI_QLOGIC_1280
1342 To compile this driver as a module, choose M here: the 1321 To compile this driver as a module, choose M here: the
1343 module will be called qla1280. 1322 module will be called qla1280.
1344 1323
1345config SCSI_QLOGIC_1280_1040
1346 bool "Qlogic QLA 1020/1040 SCSI support"
1347 depends on SCSI_QLOGIC_1280 && SCSI_QLOGIC_ISP!=y
1348 help
1349 Say Y here if you have a QLogic ISP1020/1040 SCSI host adapter and
1350 do not want to use the old driver. This option enables support in
1351 the qla1280 driver for those host adapters.
1352
1353config SCSI_QLOGICPTI 1324config SCSI_QLOGICPTI
1354 tristate "PTI Qlogic, ISP Driver" 1325 tristate "PTI Qlogic, ISP Driver"
1355 depends on SBUS && SCSI 1326 depends on SBUS && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index b88b8c455598..f062ea0f813a 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -78,7 +78,6 @@ obj-$(CONFIG_SCSI_NCR_Q720) += NCR_Q720_mod.o
78obj-$(CONFIG_SCSI_SYM53C416) += sym53c416.o 78obj-$(CONFIG_SCSI_SYM53C416) += sym53c416.o
79obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o 79obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o
80obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o 80obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o
81obj-$(CONFIG_SCSI_QLOGIC_ISP) += qlogicisp.o
82obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o 81obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o
83obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o 82obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
84obj-$(CONFIG_SCSI_QLA2XXX) += qla2xxx/ 83obj-$(CONFIG_SCSI_QLA2XXX) += qla2xxx/
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 26146a4b67b8..640590bd014a 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -529,7 +529,7 @@ void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs)
529/* Allocate structure and insert basic data such as SCSI chip frequency 529/* Allocate structure and insert basic data such as SCSI chip frequency
530 * data and a pointer to the device 530 * data and a pointer to the device
531 */ 531 */
532struct NCR_ESP* esp_allocate(Scsi_Host_Template *tpnt, void *esp_dev) 532struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev)
533{ 533{
534 struct NCR_ESP *esp, *elink; 534 struct NCR_ESP *esp, *elink;
535 struct Scsi_Host *esp_host; 535 struct Scsi_Host *esp_host;
@@ -1006,7 +1006,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
1006 struct ESP_regs *eregs = esp->eregs; 1006 struct ESP_regs *eregs = esp->eregs;
1007 struct esp_device *esp_dev; 1007 struct esp_device *esp_dev;
1008 Scsi_Cmnd *SCptr; 1008 Scsi_Cmnd *SCptr;
1009 Scsi_Device *SDptr; 1009 struct scsi_device *SDptr;
1010 volatile unchar *cmdp = esp->esp_command; 1010 volatile unchar *cmdp = esp->esp_command;
1011 unsigned char the_esp_command; 1011 unsigned char the_esp_command;
1012 int lun, target; 1012 int lun, target;
@@ -1687,7 +1687,7 @@ static inline int reconnect_lun(struct NCR_ESP *esp, struct ESP_regs *eregs)
1687static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs, 1687static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs,
1688 Scsi_Cmnd *sp) 1688 Scsi_Cmnd *sp)
1689{ 1689{
1690 Scsi_Device *dp = sp->device; 1690 struct scsi_device *dp = sp->device;
1691 struct esp_device *esp_dev = dp->hostdata; 1691 struct esp_device *esp_dev = dp->hostdata;
1692 1692
1693 if(esp->prev_soff != esp_dev->sync_max_offset || 1693 if(esp->prev_soff != esp_dev->sync_max_offset ||
@@ -3605,7 +3605,7 @@ out:
3605} 3605}
3606#endif 3606#endif
3607 3607
3608int esp_slave_alloc(Scsi_Device *SDptr) 3608int esp_slave_alloc(struct scsi_device *SDptr)
3609{ 3609{
3610 struct esp_device *esp_dev = 3610 struct esp_device *esp_dev =
3611 kmalloc(sizeof(struct esp_device), GFP_ATOMIC); 3611 kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
@@ -3617,7 +3617,7 @@ int esp_slave_alloc(Scsi_Device *SDptr)
3617 return 0; 3617 return 0;
3618} 3618}
3619 3619
3620void esp_slave_destroy(Scsi_Device *SDptr) 3620void esp_slave_destroy(struct scsi_device *SDptr)
3621{ 3621{
3622 struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata; 3622 struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;
3623 3623
diff --git a/drivers/scsi/NCR53C9x.h b/drivers/scsi/NCR53C9x.h
index 06e7edf23326..65a9b377a410 100644
--- a/drivers/scsi/NCR53C9x.h
+++ b/drivers/scsi/NCR53C9x.h
@@ -653,7 +653,7 @@ extern int nesps, esps_in_use, esps_running;
653 653
654/* External functions */ 654/* External functions */
655extern void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs); 655extern void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs);
656extern struct NCR_ESP *esp_allocate(Scsi_Host_Template *, void *); 656extern struct NCR_ESP *esp_allocate(struct scsi_host_template *, void *);
657extern void esp_deallocate(struct NCR_ESP *); 657extern void esp_deallocate(struct NCR_ESP *);
658extern void esp_release(void); 658extern void esp_release(void);
659extern void esp_initialize(struct NCR_ESP *); 659extern void esp_initialize(struct NCR_ESP *);
@@ -664,6 +664,6 @@ extern int esp_abort(Scsi_Cmnd *);
664extern int esp_reset(Scsi_Cmnd *); 664extern int esp_reset(Scsi_Cmnd *);
665extern int esp_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length, 665extern int esp_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length,
666 int inout); 666 int inout);
667extern int esp_slave_alloc(Scsi_Device *); 667extern int esp_slave_alloc(struct scsi_device *);
668extern void esp_slave_destroy(Scsi_Device *); 668extern void esp_slave_destroy(struct scsi_device *);
669#endif /* !(NCR53C9X_H) */ 669#endif /* !(NCR53C9X_H) */
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index 135376992a57..ae37d3ab9c4a 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -447,7 +447,7 @@ static __inline__ int NCR53c406a_pio_write(unsigned char *request, unsigned int
447} 447}
448#endif /* USE_PIO */ 448#endif /* USE_PIO */
449 449
450static int __init NCR53c406a_detect(Scsi_Host_Template * tpnt) 450static int __init NCR53c406a_detect(struct scsi_host_template * tpnt)
451{ 451{
452 int present = 0; 452 int present = 0;
453 struct Scsi_Host *shpnt = NULL; 453 struct Scsi_Host *shpnt = NULL;
@@ -1057,7 +1057,7 @@ MODULE_LICENSE("GPL");
1057 * Use SG_NONE if DMA mode is enabled! 1057 * Use SG_NONE if DMA mode is enabled!
1058 */ 1058 */
1059 1059
1060static Scsi_Host_Template driver_template = 1060static struct scsi_host_template driver_template =
1061{ 1061{
1062 .proc_name = "NCR53c406a" /* proc_name */, 1062 .proc_name = "NCR53c406a" /* proc_name */,
1063 .name = "NCR53c406a" /* name */, 1063 .name = "NCR53c406a" /* name */,
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index 30a14ba77a6a..54996eaae979 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -172,7 +172,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
172 } 172 }
173} 173}
174 174
175int __init a2091_detect(Scsi_Host_Template *tpnt) 175int __init a2091_detect(struct scsi_host_template *tpnt)
176{ 176{
177 static unsigned char called = 0; 177 static unsigned char called = 0;
178 struct Scsi_Host *instance; 178 struct Scsi_Host *instance;
@@ -233,7 +233,7 @@ static int a2091_bus_reset(Scsi_Cmnd *cmd)
233 233
234#define HOSTS_C 234#define HOSTS_C
235 235
236static Scsi_Host_Template driver_template = { 236static struct scsi_host_template driver_template = {
237 .proc_name = "A2901", 237 .proc_name = "A2901",
238 .name = "Commodore A2091/A590 SCSI", 238 .name = "Commodore A2091/A590 SCSI",
239 .detect = a2091_detect, 239 .detect = a2091_detect,
diff --git a/drivers/scsi/a2091.h b/drivers/scsi/a2091.h
index 54993972dcc6..22d6a13dd8be 100644
--- a/drivers/scsi/a2091.h
+++ b/drivers/scsi/a2091.h
@@ -11,7 +11,7 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13 13
14int a2091_detect(Scsi_Host_Template *); 14int a2091_detect(struct scsi_host_template *);
15int a2091_release(struct Scsi_Host *); 15int a2091_release(struct Scsi_Host *);
16const char *wd33c93_info(void); 16const char *wd33c93_info(void);
17int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 17int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c
index 306caf56f3d9..f425d424bf08 100644
--- a/drivers/scsi/a3000.c
+++ b/drivers/scsi/a3000.c
@@ -168,7 +168,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
168 } 168 }
169} 169}
170 170
171int __init a3000_detect(Scsi_Host_Template *tpnt) 171int __init a3000_detect(struct scsi_host_template *tpnt)
172{ 172{
173 wd33c93_regs regs; 173 wd33c93_regs regs;
174 174
@@ -221,7 +221,7 @@ static int a3000_bus_reset(Scsi_Cmnd *cmd)
221 221
222#define HOSTS_C 222#define HOSTS_C
223 223
224static Scsi_Host_Template driver_template = { 224static struct scsi_host_template driver_template = {
225 .proc_name = "A3000", 225 .proc_name = "A3000",
226 .name = "Amiga 3000 built-in SCSI", 226 .name = "Amiga 3000 built-in SCSI",
227 .detect = a3000_detect, 227 .detect = a3000_detect,
diff --git a/drivers/scsi/a3000.h b/drivers/scsi/a3000.h
index b1eda731877d..5535a65150a4 100644
--- a/drivers/scsi/a3000.h
+++ b/drivers/scsi/a3000.h
@@ -11,7 +11,7 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13 13
14int a3000_detect(Scsi_Host_Template *); 14int a3000_detect(struct scsi_host_template *);
15int a3000_release(struct Scsi_Host *); 15int a3000_release(struct Scsi_Host *);
16const char *wd33c93_info(void); 16const char *wd33c93_info(void);
17int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 17int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 2a128a156aa1..7139659dd952 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1579,18 +1579,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1579 break; 1579 break;
1580 { 1580 {
1581 u64 capacity; 1581 u64 capacity;
1582 char cp[12]; 1582 char cp[13];
1583 unsigned int offset = 0;
1584 1583
1585 dprintk((KERN_DEBUG "READ CAPACITY_16 command.\n")); 1584 dprintk((KERN_DEBUG "READ CAPACITY_16 command.\n"));
1586 capacity = fsa_dev_ptr[cid].size - 1; 1585 capacity = fsa_dev_ptr[cid].size - 1;
1587 if (scsicmd->cmnd[13] > 12) {
1588 offset = scsicmd->cmnd[13] - 12;
1589 if (offset > sizeof(cp))
1590 break;
1591 memset(cp, 0, offset);
1592 aac_internal_transfer(scsicmd, cp, 0, offset);
1593 }
1594 cp[0] = (capacity >> 56) & 0xff; 1586 cp[0] = (capacity >> 56) & 0xff;
1595 cp[1] = (capacity >> 48) & 0xff; 1587 cp[1] = (capacity >> 48) & 0xff;
1596 cp[2] = (capacity >> 40) & 0xff; 1588 cp[2] = (capacity >> 40) & 0xff;
@@ -1603,7 +1595,18 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1603 cp[9] = 0; 1595 cp[9] = 0;
1604 cp[10] = 2; 1596 cp[10] = 2;
1605 cp[11] = 0; 1597 cp[11] = 0;
1606 aac_internal_transfer(scsicmd, cp, offset, sizeof(cp)); 1598 cp[12] = 0;
1599 aac_internal_transfer(scsicmd, cp, 0,
1600 min((unsigned int)scsicmd->cmnd[13], sizeof(cp)));
1601 if (sizeof(cp) < scsicmd->cmnd[13]) {
1602 unsigned int len, offset = sizeof(cp);
1603
1604 memset(cp, 0, offset);
1605 do {
1606 len = min(scsicmd->cmnd[13]-offset, sizeof(cp));
1607 aac_internal_transfer(scsicmd, cp, offset, len);
1608 } while ((offset += len) < scsicmd->cmnd[13]);
1609 }
1607 1610
1608 /* Do not cache partition table for arrays */ 1611 /* Do not cache partition table for arrays */
1609 scsicmd->device->removable = 1; 1612 scsicmd->device->removable = 1;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 723c0cea7c04..38d6d00fb0fc 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -820,7 +820,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
820 break; 820 break;
821 821
822 /* 822 /*
823 * Find the Scsi_Device associated with the SCSI 823 * Find the scsi_device associated with the SCSI
824 * address. Make sure we have the right array, and if 824 * address. Make sure we have the right array, and if
825 * so set the flag to initiate a new re-config once we 825 * so set the flag to initiate a new re-config once we
826 * see an AifEnConfigChange AIF come through. 826 * see an AifEnConfigChange AIF come through.
@@ -987,7 +987,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
987 987
988 988
989 /* 989 /*
990 * Find the Scsi_Device associated with the SCSI address, 990 * Find the scsi_device associated with the SCSI address,
991 * and mark it as changed, invalidating the cache. This deals 991 * and mark it as changed, invalidating the cache. This deals
992 * with changes to existing device IDs. 992 * with changes to existing device IDs.
993 */ 993 */
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index ab383d1f59e2..3cb68af90456 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -325,6 +325,8 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
325 * translations ( 64/32, 128/32, 255/63 ). 325 * translations ( 64/32, 128/32, 255/63 ).
326 */ 326 */
327 buf = scsi_bios_ptable(bdev); 327 buf = scsi_bios_ptable(bdev);
328 if (!buf)
329 return 0;
328 if(*(__le16 *)(buf + 0x40) == cpu_to_le16(0xaa55)) { 330 if(*(__le16 *)(buf + 0x40) == cpu_to_le16(0xaa55)) {
329 struct partition *first = (struct partition * )buf; 331 struct partition *first = (struct partition * )buf;
330 struct partition *entry = first; 332 struct partition *entry = first;
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index f4cfb8f29620..28b93057b607 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -114,7 +114,7 @@
114 #include "advansys.h" 114 #include "advansys.h"
115 #endif 115 #endif
116 116
117 and after "static Scsi_Host_Template builtin_scsi_hosts[] =": 117 and after "static struct scsi_host_template builtin_scsi_hosts[] =":
118 118
119 #ifdef CONFIG_SCSI_ADVANSYS 119 #ifdef CONFIG_SCSI_ADVANSYS
120 ADVANSYS, 120 ADVANSYS,
@@ -160,7 +160,7 @@
160 --- Driver Structures 160 --- Driver Structures
161 --- Driver Data 161 --- Driver Data
162 --- Driver Function Prototypes 162 --- Driver Function Prototypes
163 --- Linux 'Scsi_Host_Template' and advansys_setup() Functions 163 --- Linux 'struct scsi_host_template' and advansys_setup() Functions
164 --- Loadable Driver Support 164 --- Loadable Driver Support
165 --- Miscellaneous Driver Functions 165 --- Miscellaneous Driver Functions
166 --- Functions Required by the Asc Library 166 --- Functions Required by the Asc Library
@@ -4068,7 +4068,7 @@ STATIC void asc_prt_hex(char *f, uchar *, int);
4068 4068
4069 4069
4070/* 4070/*
4071 * --- Linux 'Scsi_Host_Template' and advansys_setup() Functions 4071 * --- Linux 'struct scsi_host_template' and advansys_setup() Functions
4072 */ 4072 */
4073 4073
4074#ifdef CONFIG_PROC_FS 4074#ifdef CONFIG_PROC_FS
diff --git a/drivers/scsi/advansys.h b/drivers/scsi/advansys.h
index 3f4bde02302e..8ee7fb16a725 100644
--- a/drivers/scsi/advansys.h
+++ b/drivers/scsi/advansys.h
@@ -19,7 +19,7 @@
19#define _ADVANSYS_H 19#define _ADVANSYS_H
20 20
21/* 21/*
22 * Scsi_Host_Template function prototypes. 22 * struct scsi_host_template function prototypes.
23 */ 23 */
24int advansys_detect(struct scsi_host_template *); 24int advansys_detect(struct scsi_host_template *);
25int advansys_release(struct Scsi_Host *); 25int advansys_release(struct Scsi_Host *);
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 9b7caf504a56..9df23b654cec 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -424,7 +424,7 @@ MODULE_DEVICE_TABLE(isapnp, id_table);
424 424
425static int registered_count=0; 425static int registered_count=0;
426static struct Scsi_Host *aha152x_host[2]; 426static struct Scsi_Host *aha152x_host[2];
427static Scsi_Host_Template aha152x_driver_template; 427static struct scsi_host_template aha152x_driver_template;
428 428
429/* 429/*
430 * internal states of the host 430 * internal states of the host
@@ -3464,7 +3464,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start
3464 return thislength < length ? thislength : length; 3464 return thislength < length ? thislength : length;
3465} 3465}
3466 3466
3467static Scsi_Host_Template aha152x_driver_template = { 3467static struct scsi_host_template aha152x_driver_template = {
3468 .module = THIS_MODULE, 3468 .module = THIS_MODULE,
3469 .name = AHA152X_REVID, 3469 .name = AHA152X_REVID,
3470 .proc_name = "aha152x", 3470 .proc_name = "aha152x",
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 1b1adfb384cb..51bad7a1e773 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -1021,7 +1021,7 @@ __setup("aha1542=",do_setup);
1021#endif 1021#endif
1022 1022
1023/* return non-zero on detection */ 1023/* return non-zero on detection */
1024static int __init aha1542_detect(Scsi_Host_Template * tpnt) 1024static int __init aha1542_detect(struct scsi_host_template * tpnt)
1025{ 1025{
1026 unsigned char dma_chan; 1026 unsigned char dma_chan;
1027 unsigned char irq_level; 1027 unsigned char irq_level;
@@ -1789,7 +1789,7 @@ static int aha1542_biosparam(struct scsi_device *sdev,
1789MODULE_LICENSE("GPL"); 1789MODULE_LICENSE("GPL");
1790 1790
1791 1791
1792static Scsi_Host_Template driver_template = { 1792static struct scsi_host_template driver_template = {
1793 .proc_name = "aha1542", 1793 .proc_name = "aha1542",
1794 .name = "Adaptec 1542", 1794 .name = "Adaptec 1542",
1795 .detect = aha1542_detect, 1795 .detect = aha1542_detect,
diff --git a/drivers/scsi/aha1542.h b/drivers/scsi/aha1542.h
index 3821ee17f471..1db538552d56 100644
--- a/drivers/scsi/aha1542.h
+++ b/drivers/scsi/aha1542.h
@@ -131,7 +131,7 @@ struct ccb { /* Command Control Block 5.3 */
131 /* REQUEST SENSE */ 131 /* REQUEST SENSE */
132}; 132};
133 133
134static int aha1542_detect(Scsi_Host_Template *); 134static int aha1542_detect(struct scsi_host_template *);
135static int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 135static int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
136static int aha1542_bus_reset(Scsi_Cmnd * SCpnt); 136static int aha1542_bus_reset(Scsi_Cmnd * SCpnt);
137static int aha1542_dev_reset(Scsi_Cmnd * SCpnt); 137static int aha1542_dev_reset(Scsi_Cmnd * SCpnt);
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index 8f85dcc0e7fa..4b8c6a543925 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -570,7 +570,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy)
570 return 0; 570 return 0;
571} 571}
572 572
573static Scsi_Host_Template aha1740_template = { 573static struct scsi_host_template aha1740_template = {
574 .module = THIS_MODULE, 574 .module = THIS_MODULE,
575 .proc_name = "aha1740", 575 .proc_name = "aha1740",
576 .proc_info = aha1740_proc_info, 576 .proc_info = aha1740_proc_info,
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 10c470e7d316..83467a05dc8e 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -48,7 +48,7 @@
48#include <asm/io.h> 48#include <asm/io.h>
49 49
50#define DRV_NAME "ahci" 50#define DRV_NAME "ahci"
51#define DRV_VERSION "1.01" 51#define DRV_VERSION "1.2"
52 52
53 53
54enum { 54enum {
@@ -134,6 +134,7 @@ enum {
134 PORT_IRQ_D2H_REG_FIS, 134 PORT_IRQ_D2H_REG_FIS,
135 135
136 /* PORT_CMD bits */ 136 /* PORT_CMD bits */
137 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */
137 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ 138 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
138 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ 139 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */
139 PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ 140 PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */
@@ -255,7 +256,7 @@ static struct ata_port_info ahci_port_info[] = {
255 }, 256 },
256}; 257};
257 258
258static struct pci_device_id ahci_pci_tbl[] = { 259static const struct pci_device_id ahci_pci_tbl[] = {
259 { PCI_VENDOR_ID_INTEL, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 260 { PCI_VENDOR_ID_INTEL, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
260 board_ahci }, /* ICH6 */ 261 board_ahci }, /* ICH6 */
261 { PCI_VENDOR_ID_INTEL, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 262 { PCI_VENDOR_ID_INTEL, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
@@ -441,7 +442,7 @@ static void ahci_phy_reset(struct ata_port *ap)
441 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; 442 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
442 struct ata_taskfile tf; 443 struct ata_taskfile tf;
443 struct ata_device *dev = &ap->device[0]; 444 struct ata_device *dev = &ap->device[0];
444 u32 tmp; 445 u32 new_tmp, tmp;
445 446
446 __sata_phy_reset(ap); 447 __sata_phy_reset(ap);
447 448
@@ -455,8 +456,21 @@ static void ahci_phy_reset(struct ata_port *ap)
455 tf.nsect = (tmp) & 0xff; 456 tf.nsect = (tmp) & 0xff;
456 457
457 dev->class = ata_dev_classify(&tf); 458 dev->class = ata_dev_classify(&tf);
458 if (!ata_dev_present(dev)) 459 if (!ata_dev_present(dev)) {
459 ata_port_disable(ap); 460 ata_port_disable(ap);
461 return;
462 }
463
464 /* Make sure port's ATAPI bit is set appropriately */
465 new_tmp = tmp = readl(port_mmio + PORT_CMD);
466 if (dev->class == ATA_DEV_ATAPI)
467 new_tmp |= PORT_CMD_ATAPI;
468 else
469 new_tmp &= ~PORT_CMD_ATAPI;
470 if (new_tmp != tmp) {
471 writel(new_tmp, port_mmio + PORT_CMD);
472 readl(port_mmio + PORT_CMD); /* flush */
473 }
460} 474}
461 475
462static u8 ahci_check_status(struct ata_port *ap) 476static u8 ahci_check_status(struct ata_port *ap)
@@ -474,11 +488,12 @@ static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
474 ata_tf_from_fis(d2h_fis, tf); 488 ata_tf_from_fis(d2h_fis, tf);
475} 489}
476 490
477static void ahci_fill_sg(struct ata_queued_cmd *qc) 491static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc)
478{ 492{
479 struct ahci_port_priv *pp = qc->ap->private_data; 493 struct ahci_port_priv *pp = qc->ap->private_data;
480 struct scatterlist *sg; 494 struct scatterlist *sg;
481 struct ahci_sg *ahci_sg; 495 struct ahci_sg *ahci_sg;
496 unsigned int n_sg = 0;
482 497
483 VPRINTK("ENTER\n"); 498 VPRINTK("ENTER\n");
484 499
@@ -493,8 +508,12 @@ static void ahci_fill_sg(struct ata_queued_cmd *qc)
493 ahci_sg->addr = cpu_to_le32(addr & 0xffffffff); 508 ahci_sg->addr = cpu_to_le32(addr & 0xffffffff);
494 ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 509 ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
495 ahci_sg->flags_size = cpu_to_le32(sg_len - 1); 510 ahci_sg->flags_size = cpu_to_le32(sg_len - 1);
511
496 ahci_sg++; 512 ahci_sg++;
513 n_sg++;
497 } 514 }
515
516 return n_sg;
498} 517}
499 518
500static void ahci_qc_prep(struct ata_queued_cmd *qc) 519static void ahci_qc_prep(struct ata_queued_cmd *qc)
@@ -503,13 +522,14 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
503 struct ahci_port_priv *pp = ap->private_data; 522 struct ahci_port_priv *pp = ap->private_data;
504 u32 opts; 523 u32 opts;
505 const u32 cmd_fis_len = 5; /* five dwords */ 524 const u32 cmd_fis_len = 5; /* five dwords */
525 unsigned int n_elem;
506 526
507 /* 527 /*
508 * Fill in command slot information (currently only one slot, 528 * Fill in command slot information (currently only one slot,
509 * slot 0, is currently since we don't do queueing) 529 * slot 0, is currently since we don't do queueing)
510 */ 530 */
511 531
512 opts = (qc->n_elem << 16) | cmd_fis_len; 532 opts = cmd_fis_len;
513 if (qc->tf.flags & ATA_TFLAG_WRITE) 533 if (qc->tf.flags & ATA_TFLAG_WRITE)
514 opts |= AHCI_CMD_WRITE; 534 opts |= AHCI_CMD_WRITE;
515 if (is_atapi_taskfile(&qc->tf)) 535 if (is_atapi_taskfile(&qc->tf))
@@ -533,16 +553,31 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
533 if (!(qc->flags & ATA_QCFLAG_DMAMAP)) 553 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
534 return; 554 return;
535 555
536 ahci_fill_sg(qc); 556 n_elem = ahci_fill_sg(qc);
557
558 pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16);
537} 559}
538 560
539static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) 561static void ahci_restart_port(struct ata_port *ap, u32 irq_stat)
540{ 562{
541 void __iomem *mmio = ap->host_set->mmio_base; 563 void __iomem *mmio = ap->host_set->mmio_base;
542 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 564 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
543 u32 tmp; 565 u32 tmp;
544 int work; 566 int work;
545 567
568 if ((ap->device[0].class != ATA_DEV_ATAPI) ||
569 ((irq_stat & PORT_IRQ_TF_ERR) == 0))
570 printk(KERN_WARNING "ata%u: port reset, "
571 "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n",
572 ap->id,
573 irq_stat,
574 readl(mmio + HOST_IRQ_STAT),
575 readl(port_mmio + PORT_IRQ_STAT),
576 readl(port_mmio + PORT_CMD),
577 readl(port_mmio + PORT_TFDATA),
578 readl(port_mmio + PORT_SCR_STAT),
579 readl(port_mmio + PORT_SCR_ERR));
580
546 /* stop DMA */ 581 /* stop DMA */
547 tmp = readl(port_mmio + PORT_CMD); 582 tmp = readl(port_mmio + PORT_CMD);
548 tmp &= ~PORT_CMD_START; 583 tmp &= ~PORT_CMD_START;
@@ -580,8 +615,6 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
580 tmp |= PORT_CMD_START; 615 tmp |= PORT_CMD_START;
581 writel(tmp, port_mmio + PORT_CMD); 616 writel(tmp, port_mmio + PORT_CMD);
582 readl(port_mmio + PORT_CMD); /* flush */ 617 readl(port_mmio + PORT_CMD); /* flush */
583
584 printk(KERN_WARNING "ata%u: error occurred, port reset\n", ap->id);
585} 618}
586 619
587static void ahci_eng_timeout(struct ata_port *ap) 620static void ahci_eng_timeout(struct ata_port *ap)
@@ -592,17 +625,17 @@ static void ahci_eng_timeout(struct ata_port *ap)
592 struct ata_queued_cmd *qc; 625 struct ata_queued_cmd *qc;
593 unsigned long flags; 626 unsigned long flags;
594 627
595 DPRINTK("ENTER\n"); 628 printk(KERN_WARNING "ata%u: handling error/timeout\n", ap->id);
596 629
597 spin_lock_irqsave(&host_set->lock, flags); 630 spin_lock_irqsave(&host_set->lock, flags);
598 631
599 ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT));
600
601 qc = ata_qc_from_tag(ap, ap->active_tag); 632 qc = ata_qc_from_tag(ap, ap->active_tag);
602 if (!qc) { 633 if (!qc) {
603 printk(KERN_ERR "ata%u: BUG: timeout without command\n", 634 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
604 ap->id); 635 ap->id);
605 } else { 636 } else {
637 ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT));
638
606 /* hack alert! We cannot use the supplied completion 639 /* hack alert! We cannot use the supplied completion
607 * function from inside the ->eh_strategy_handler() thread. 640 * function from inside the ->eh_strategy_handler() thread.
608 * libata is the only user of ->eh_strategy_handler() in 641 * libata is the only user of ->eh_strategy_handler() in
@@ -637,9 +670,19 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
637 } 670 }
638 671
639 if (status & PORT_IRQ_FATAL) { 672 if (status & PORT_IRQ_FATAL) {
640 ahci_intr_error(ap, status); 673 unsigned int err_mask;
674 if (status & PORT_IRQ_TF_ERR)
675 err_mask = AC_ERR_DEV;
676 else if (status & PORT_IRQ_IF_ERR)
677 err_mask = AC_ERR_ATA_BUS;
678 else
679 err_mask = AC_ERR_HOST_BUS;
680
681 /* command processing has stopped due to error; restart */
682 ahci_restart_port(ap, status);
683
641 if (qc) 684 if (qc)
642 ata_qc_complete(qc, AC_ERR_OTHER); 685 ata_qc_complete(qc, err_mask);
643 } 686 }
644 687
645 return 1; 688 return 1;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index cfb46c241b38..6aab9dacdeea 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -436,29 +436,20 @@ ahd_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
436{ 436{
437 struct ahd_softc *ahd; 437 struct ahd_softc *ahd;
438 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); 438 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device);
439 int rtn = SCSI_MLQUEUE_HOST_BUSY;
440 unsigned long flags;
439 441
440 ahd = *(struct ahd_softc **)cmd->device->host->hostdata; 442 ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
441 443
442 /* 444 ahd_lock(ahd, &flags);
443 * Close the race of a command that was in the process of 445 if (ahd->platform_data->qfrozen == 0) {
444 * being queued to us just as our simq was frozen. Let 446 cmd->scsi_done = scsi_done;
445 * DV commands through so long as we are only frozen to 447 cmd->result = CAM_REQ_INPROG << 16;
446 * perform DV. 448 rtn = ahd_linux_run_command(ahd, dev, cmd);
447 */
448 if (ahd->platform_data->qfrozen != 0) {
449 printf("%s: queue frozen\n", ahd_name(ahd));
450 449
451 return SCSI_MLQUEUE_HOST_BUSY;
452 } 450 }
453 451 ahd_unlock(ahd, &flags);
454 /* 452 return rtn;
455 * Save the callback on completion function.
456 */
457 cmd->scsi_done = scsi_done;
458
459 cmd->result = CAM_REQ_INPROG << 16;
460
461 return ahd_linux_run_command(ahd, dev, cmd);
462} 453}
463 454
464static inline struct scsi_target ** 455static inline struct scsi_target **
@@ -1081,7 +1072,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa
1081 1072
1082 *((struct ahd_softc **)host->hostdata) = ahd; 1073 *((struct ahd_softc **)host->hostdata) = ahd;
1083 ahd_lock(ahd, &s); 1074 ahd_lock(ahd, &s);
1084 scsi_assign_lock(host, &ahd->platform_data->spin_lock);
1085 ahd->platform_data->host = host; 1075 ahd->platform_data->host = host;
1086 host->can_queue = AHD_MAX_QUEUE; 1076 host->can_queue = AHD_MAX_QUEUE;
1087 host->cmd_per_lun = 2; 1077 host->cmd_per_lun = 2;
@@ -2062,6 +2052,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2062 int wait; 2052 int wait;
2063 int disconnected; 2053 int disconnected;
2064 ahd_mode_state saved_modes; 2054 ahd_mode_state saved_modes;
2055 unsigned long flags;
2065 2056
2066 pending_scb = NULL; 2057 pending_scb = NULL;
2067 paused = FALSE; 2058 paused = FALSE;
@@ -2077,7 +2068,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2077 printf(" 0x%x", cmd->cmnd[cdb_byte]); 2068 printf(" 0x%x", cmd->cmnd[cdb_byte]);
2078 printf("\n"); 2069 printf("\n");
2079 2070
2080 spin_lock_irq(&ahd->platform_data->spin_lock); 2071 ahd_lock(ahd, &flags);
2081 2072
2082 /* 2073 /*
2083 * First determine if we currently own this command. 2074 * First determine if we currently own this command.
@@ -2114,7 +2105,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2114 scmd_id(cmd), 2105 scmd_id(cmd),
2115 scmd_channel(cmd) + 'A', 2106 scmd_channel(cmd) + 'A',
2116 CAM_LUN_WILDCARD, 2107 CAM_LUN_WILDCARD,
2117 SCB_LIST_NULL, ROLE_INITIATOR) == 0) 2108 SCB_LIST_NULL, ROLE_INITIATOR))
2118 break; 2109 break;
2119 } 2110 }
2120 } 2111 }
@@ -2291,7 +2282,8 @@ done:
2291 int ret; 2282 int ret;
2292 2283
2293 ahd->platform_data->flags |= AHD_SCB_UP_EH_SEM; 2284 ahd->platform_data->flags |= AHD_SCB_UP_EH_SEM;
2294 spin_unlock_irq(&ahd->platform_data->spin_lock); 2285 ahd_unlock(ahd, &flags);
2286
2295 init_timer(&timer); 2287 init_timer(&timer);
2296 timer.data = (u_long)ahd; 2288 timer.data = (u_long)ahd;
2297 timer.expires = jiffies + (5 * HZ); 2289 timer.expires = jiffies + (5 * HZ);
@@ -2305,9 +2297,8 @@ done:
2305 printf("Timer Expired\n"); 2297 printf("Timer Expired\n");
2306 retval = FAILED; 2298 retval = FAILED;
2307 } 2299 }
2308 spin_lock_irq(&ahd->platform_data->spin_lock);
2309 } 2300 }
2310 spin_unlock_irq(&ahd->platform_data->spin_lock); 2301 ahd_unlock(ahd, &flags);
2311 return (retval); 2302 return (retval);
2312} 2303}
2313 2304
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 1861407422e4..d866213f42b8 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -476,26 +476,20 @@ ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
476{ 476{
477 struct ahc_softc *ahc; 477 struct ahc_softc *ahc;
478 struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); 478 struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device);
479 int rtn = SCSI_MLQUEUE_HOST_BUSY;
480 unsigned long flags;
479 481
480 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; 482 ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
481 483
482 /* 484 ahc_lock(ahc, &flags);
483 * Save the callback on completion function. 485 if (ahc->platform_data->qfrozen == 0) {
484 */ 486 cmd->scsi_done = scsi_done;
485 cmd->scsi_done = scsi_done; 487 cmd->result = CAM_REQ_INPROG << 16;
486 488 rtn = ahc_linux_run_command(ahc, dev, cmd);
487 /* 489 }
488 * Close the race of a command that was in the process of 490 ahc_unlock(ahc, &flags);
489 * being queued to us just as our simq was frozen. Let
490 * DV commands through so long as we are only frozen to
491 * perform DV.
492 */
493 if (ahc->platform_data->qfrozen != 0)
494 return SCSI_MLQUEUE_HOST_BUSY;
495
496 cmd->result = CAM_REQ_INPROG << 16;
497 491
498 return ahc_linux_run_command(ahc, dev, cmd); 492 return rtn;
499} 493}
500 494
501static inline struct scsi_target ** 495static inline struct scsi_target **
@@ -1079,7 +1073,6 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
1079 1073
1080 *((struct ahc_softc **)host->hostdata) = ahc; 1074 *((struct ahc_softc **)host->hostdata) = ahc;
1081 ahc_lock(ahc, &s); 1075 ahc_lock(ahc, &s);
1082 scsi_assign_lock(host, &ahc->platform_data->spin_lock);
1083 ahc->platform_data->host = host; 1076 ahc->platform_data->host = host;
1084 host->can_queue = AHC_MAX_QUEUE; 1077 host->can_queue = AHC_MAX_QUEUE;
1085 host->cmd_per_lun = 2; 1078 host->cmd_per_lun = 2;
@@ -2111,6 +2104,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2111 int paused; 2104 int paused;
2112 int wait; 2105 int wait;
2113 int disconnected; 2106 int disconnected;
2107 unsigned long flags;
2114 2108
2115 pending_scb = NULL; 2109 pending_scb = NULL;
2116 paused = FALSE; 2110 paused = FALSE;
@@ -2125,7 +2119,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2125 printf(" 0x%x", cmd->cmnd[cdb_byte]); 2119 printf(" 0x%x", cmd->cmnd[cdb_byte]);
2126 printf("\n"); 2120 printf("\n");
2127 2121
2128 spin_lock_irq(&ahc->platform_data->spin_lock); 2122 ahc_lock(ahc, &flags);
2129 2123
2130 /* 2124 /*
2131 * First determine if we currently own this command. 2125 * First determine if we currently own this command.
@@ -2175,7 +2169,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2175 if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd), 2169 if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd),
2176 scmd_channel(cmd) + 'A', 2170 scmd_channel(cmd) + 'A',
2177 CAM_LUN_WILDCARD, 2171 CAM_LUN_WILDCARD,
2178 SCB_LIST_NULL, ROLE_INITIATOR) == 0) 2172 SCB_LIST_NULL, ROLE_INITIATOR))
2179 break; 2173 break;
2180 } 2174 }
2181 } 2175 }
@@ -2357,7 +2351,8 @@ done:
2357 int ret; 2351 int ret;
2358 2352
2359 ahc->platform_data->flags |= AHC_UP_EH_SEMAPHORE; 2353 ahc->platform_data->flags |= AHC_UP_EH_SEMAPHORE;
2360 spin_unlock_irq(&ahc->platform_data->spin_lock); 2354 ahc_unlock(ahc, &flags);
2355
2361 init_timer(&timer); 2356 init_timer(&timer);
2362 timer.data = (u_long)ahc; 2357 timer.data = (u_long)ahc;
2363 timer.expires = jiffies + (5 * HZ); 2358 timer.expires = jiffies + (5 * HZ);
@@ -2371,10 +2366,8 @@ done:
2371 printf("Timer Expired\n"); 2366 printf("Timer Expired\n");
2372 retval = FAILED; 2367 retval = FAILED;
2373 } 2368 }
2374 spin_lock_irq(&ahc->platform_data->spin_lock); 2369 } else
2375 } 2370 ahc_unlock(ahc, &flags);
2376
2377 spin_unlock_irq(&ahc->platform_data->spin_lock);
2378 return (retval); 2371 return (retval);
2379} 2372}
2380 2373
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 880e2d9ffe9b..33d56c344944 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -6514,7 +6514,7 @@ do_aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs)
6514static void 6514static void
6515aic7xxx_init_transinfo(struct aic7xxx_host *p, struct aic_dev_data *aic_dev) 6515aic7xxx_init_transinfo(struct aic7xxx_host *p, struct aic_dev_data *aic_dev)
6516{ 6516{
6517 Scsi_Device *sdpnt = aic_dev->SDptr; 6517 struct scsi_device *sdpnt = aic_dev->SDptr;
6518 unsigned char tindex; 6518 unsigned char tindex;
6519 6519
6520 tindex = sdpnt->id | (sdpnt->channel << 3); 6520 tindex = sdpnt->id | (sdpnt->channel << 3);
@@ -6581,7 +6581,7 @@ aic7xxx_init_transinfo(struct aic7xxx_host *p, struct aic_dev_data *aic_dev)
6581 * Set up the initial aic_dev struct pointers 6581 * Set up the initial aic_dev struct pointers
6582 *-F*************************************************************************/ 6582 *-F*************************************************************************/
6583static int 6583static int
6584aic7xxx_slave_alloc(Scsi_Device *SDptr) 6584aic7xxx_slave_alloc(struct scsi_device *SDptr)
6585{ 6585{
6586 struct aic7xxx_host *p = (struct aic7xxx_host *)SDptr->host->hostdata; 6586 struct aic7xxx_host *p = (struct aic7xxx_host *)SDptr->host->hostdata;
6587 struct aic_dev_data *aic_dev; 6587 struct aic_dev_data *aic_dev;
@@ -6644,7 +6644,7 @@ aic7xxx_slave_alloc(Scsi_Device *SDptr)
6644 * queueing to be [en|dis]abled for a specific adapter. 6644 * queueing to be [en|dis]abled for a specific adapter.
6645 *-F*************************************************************************/ 6645 *-F*************************************************************************/
6646static void 6646static void
6647aic7xxx_device_queue_depth(struct aic7xxx_host *p, Scsi_Device *device) 6647aic7xxx_device_queue_depth(struct aic7xxx_host *p, struct scsi_device *device)
6648{ 6648{
6649 int tag_enabled = FALSE; 6649 int tag_enabled = FALSE;
6650 struct aic_dev_data *aic_dev = device->hostdata; 6650 struct aic_dev_data *aic_dev = device->hostdata;
@@ -6734,7 +6734,7 @@ aic7xxx_device_queue_depth(struct aic7xxx_host *p, Scsi_Device *device)
6734 * prepare for this device to go away 6734 * prepare for this device to go away
6735 *-F*************************************************************************/ 6735 *-F*************************************************************************/
6736static void 6736static void
6737aic7xxx_slave_destroy(Scsi_Device *SDptr) 6737aic7xxx_slave_destroy(struct scsi_device *SDptr)
6738{ 6738{
6739 struct aic_dev_data *aic_dev = SDptr->hostdata; 6739 struct aic_dev_data *aic_dev = SDptr->hostdata;
6740 6740
@@ -6754,7 +6754,7 @@ aic7xxx_slave_destroy(Scsi_Device *SDptr)
6754 * depths, allocate command structs, etc. 6754 * depths, allocate command structs, etc.
6755 *-F*************************************************************************/ 6755 *-F*************************************************************************/
6756static int 6756static int
6757aic7xxx_slave_configure(Scsi_Device *SDptr) 6757aic7xxx_slave_configure(struct scsi_device *SDptr)
6758{ 6758{
6759 struct aic7xxx_host *p = (struct aic7xxx_host *) SDptr->host->hostdata; 6759 struct aic7xxx_host *p = (struct aic7xxx_host *) SDptr->host->hostdata;
6760 struct aic_dev_data *aic_dev; 6760 struct aic_dev_data *aic_dev;
@@ -7865,7 +7865,7 @@ detect_maxscb(struct aic7xxx_host *p)
7865 * Register a Adaptec aic7xxx chip SCSI controller with the kernel. 7865 * Register a Adaptec aic7xxx chip SCSI controller with the kernel.
7866 *-F*************************************************************************/ 7866 *-F*************************************************************************/
7867static int 7867static int
7868aic7xxx_register(Scsi_Host_Template *template, struct aic7xxx_host *p, 7868aic7xxx_register(struct scsi_host_template *template, struct aic7xxx_host *p,
7869 int reset_delay) 7869 int reset_delay)
7870{ 7870{
7871 int i, result; 7871 int i, result;
@@ -8412,7 +8412,7 @@ aic7xxx_chip_reset(struct aic7xxx_host *p)
8412 * and a pointer to a aic7xxx_host struct upon success. 8412 * and a pointer to a aic7xxx_host struct upon success.
8413 *-F*************************************************************************/ 8413 *-F*************************************************************************/
8414static struct aic7xxx_host * 8414static struct aic7xxx_host *
8415aic7xxx_alloc(Scsi_Host_Template *sht, struct aic7xxx_host *temp) 8415aic7xxx_alloc(struct scsi_host_template *sht, struct aic7xxx_host *temp)
8416{ 8416{
8417 struct aic7xxx_host *p = NULL; 8417 struct aic7xxx_host *p = NULL;
8418 struct Scsi_Host *host; 8418 struct Scsi_Host *host;
@@ -8991,7 +8991,7 @@ aic7xxx_configure_bugs(struct aic7xxx_host *p)
8991 * mid-level SCSI code is overhauled. 8991 * mid-level SCSI code is overhauled.
8992 *-F*************************************************************************/ 8992 *-F*************************************************************************/
8993static int 8993static int
8994aic7xxx_detect(Scsi_Host_Template *template) 8994aic7xxx_detect(struct scsi_host_template *template)
8995{ 8995{
8996 struct aic7xxx_host *temp_p = NULL; 8996 struct aic7xxx_host *temp_p = NULL;
8997 struct aic7xxx_host *current_p = NULL; 8997 struct aic7xxx_host *current_p = NULL;
@@ -11161,7 +11161,7 @@ MODULE_LICENSE("Dual BSD/GPL");
11161MODULE_VERSION(AIC7XXX_H_VERSION); 11161MODULE_VERSION(AIC7XXX_H_VERSION);
11162 11162
11163 11163
11164static Scsi_Host_Template driver_template = { 11164static struct scsi_host_template driver_template = {
11165 .proc_info = aic7xxx_proc_info, 11165 .proc_info = aic7xxx_proc_info,
11166 .detect = aic7xxx_detect, 11166 .detect = aic7xxx_detect,
11167 .release = aic7xxx_release, 11167 .release = aic7xxx_release,
diff --git a/drivers/scsi/amiga7xx.c b/drivers/scsi/amiga7xx.c
index dea8446f5360..c0844fa32c5d 100644
--- a/drivers/scsi/amiga7xx.c
+++ b/drivers/scsi/amiga7xx.c
@@ -29,7 +29,7 @@
29#include "amiga7xx.h" 29#include "amiga7xx.h"
30 30
31 31
32static int amiga7xx_register_one(Scsi_Host_Template *tpnt, 32static int amiga7xx_register_one(struct scsi_host_template *tpnt,
33 unsigned long address) 33 unsigned long address)
34{ 34{
35 long long options; 35 long long options;
@@ -65,7 +65,7 @@ static struct {
65 { 0 } 65 { 0 }
66}; 66};
67 67
68static int __init amiga7xx_zorro_detect(Scsi_Host_Template *tpnt) 68static int __init amiga7xx_zorro_detect(struct scsi_host_template *tpnt)
69{ 69{
70 int num = 0, i; 70 int num = 0, i;
71 struct zorro_dev *z = NULL; 71 struct zorro_dev *z = NULL;
@@ -89,7 +89,7 @@ static int __init amiga7xx_zorro_detect(Scsi_Host_Template *tpnt)
89#endif /* CONFIG_ZORRO */ 89#endif /* CONFIG_ZORRO */
90 90
91 91
92int __init amiga7xx_detect(Scsi_Host_Template *tpnt) 92int __init amiga7xx_detect(struct scsi_host_template *tpnt)
93{ 93{
94 static unsigned char called = 0; 94 static unsigned char called = 0;
95 int num = 0; 95 int num = 0;
@@ -122,7 +122,7 @@ static int amiga7xx_release(struct Scsi_Host *shost)
122 return 0; 122 return 0;
123} 123}
124 124
125static Scsi_Host_Template driver_template = { 125static struct scsi_host_template driver_template = {
126 .name = "Amiga NCR53c710 SCSI", 126 .name = "Amiga NCR53c710 SCSI",
127 .detect = amiga7xx_detect, 127 .detect = amiga7xx_detect,
128 .release = amiga7xx_release, 128 .release = amiga7xx_release,
diff --git a/drivers/scsi/amiga7xx.h b/drivers/scsi/amiga7xx.h
index 8cc54a5b889e..1b637592d5ae 100644
--- a/drivers/scsi/amiga7xx.h
+++ b/drivers/scsi/amiga7xx.h
@@ -2,7 +2,7 @@
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4 4
5int amiga7xx_detect(Scsi_Host_Template *); 5int amiga7xx_detect(struct scsi_host_template *);
6const char *NCR53c7x0_info(void); 6const char *NCR53c7x0_info(void);
7int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 7int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
8int NCR53c7xx_abort(Scsi_Cmnd *); 8int NCR53c7xx_abort(Scsi_Cmnd *);
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index be2caecbbdd9..b7b20c689c24 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -896,7 +896,7 @@ void acornscsi_done(AS_Host *host, Scsi_Cmnd **SCpntp, unsigned int result)
896 * Notes : this will only be one SG entry or less 896 * Notes : this will only be one SG entry or less
897 */ 897 */
898static 898static
899void acornscsi_data_updateptr(AS_Host *host, Scsi_Pointer *SCp, unsigned int length) 899void acornscsi_data_updateptr(AS_Host *host, struct scsi_pointer *SCp, unsigned int length)
900{ 900{
901 SCp->ptr += length; 901 SCp->ptr += length;
902 SCp->this_residual -= length; 902 SCp->this_residual -= length;
@@ -2862,7 +2862,7 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start,
2862 int length, int inout) 2862 int length, int inout)
2863{ 2863{
2864 int pos, begin = 0, devidx; 2864 int pos, begin = 0, devidx;
2865 Scsi_Device *scd; 2865 struct scsi_device *scd;
2866 AS_Host *host; 2866 AS_Host *host;
2867 char *p = buffer; 2867 char *p = buffer;
2868 2868
@@ -2971,7 +2971,7 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start,
2971 return pos; 2971 return pos;
2972} 2972}
2973 2973
2974static Scsi_Host_Template acornscsi_template = { 2974static struct scsi_host_template acornscsi_template = {
2975 .module = THIS_MODULE, 2975 .module = THIS_MODULE,
2976 .proc_info = acornscsi_proc_info, 2976 .proc_info = acornscsi_proc_info,
2977 .name = "AcornSCSI", 2977 .name = "AcornSCSI",
diff --git a/drivers/scsi/arm/acornscsi.h b/drivers/scsi/arm/acornscsi.h
index 03881f091645..2142290f8404 100644
--- a/drivers/scsi/arm/acornscsi.h
+++ b/drivers/scsi/arm/acornscsi.h
@@ -292,7 +292,7 @@ typedef struct acornscsi_hostdata {
292 unsigned char tag; /* reconnected tag */ 292 unsigned char tag; /* reconnected tag */
293 } reconnected; 293 } reconnected;
294 294
295 Scsi_Pointer SCp; /* current commands data pointer */ 295 struct scsi_pointer SCp; /* current commands data pointer */
296 296
297 MsgQueue_t msgs; 297 MsgQueue_t msgs;
298 298
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index 29811f5891ee..804125e35fc3 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -65,7 +65,7 @@ struct arxescsi_info {
65 * Returns : 0 if we should not set CMD_WITHDMA for transfer info command 65 * Returns : 0 if we should not set CMD_WITHDMA for transfer info command
66 */ 66 */
67static fasdmatype_t 67static fasdmatype_t
68arxescsi_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp, 68arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
69 fasdmadir_t direction, fasdmatype_t min_type) 69 fasdmadir_t direction, fasdmatype_t min_type)
70{ 70{
71 /* 71 /*
@@ -111,7 +111,7 @@ static void arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)
111 * transfer - minimum number of bytes we expect to transfer 111 * transfer - minimum number of bytes we expect to transfer
112 */ 112 */
113static void 113static void
114arxescsi_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp, 114arxescsi_dma_pseudo(struct Scsi_Host *host, struct scsi_pointer *SCp,
115 fasdmadir_t direction, int transfer) 115 fasdmadir_t direction, int transfer)
116{ 116{
117 struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata; 117 struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata;
@@ -197,7 +197,7 @@ arxescsi_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp,
197 * Params : host - host 197 * Params : host - host
198 * SCpnt - command 198 * SCpnt - command
199 */ 199 */
200static void arxescsi_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp) 200static void arxescsi_dma_stop(struct Scsi_Host *host, struct scsi_pointer *SCp)
201{ 201{
202 /* 202 /*
203 * no DMA to stop 203 * no DMA to stop
@@ -261,7 +261,7 @@ arxescsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t off
261 return pos; 261 return pos;
262} 262}
263 263
264static Scsi_Host_Template arxescsi_template = { 264static struct scsi_host_template arxescsi_template = {
265 .proc_info = arxescsi_proc_info, 265 .proc_info = arxescsi_proc_info,
266 .name = "ARXE SCSI card", 266 .name = "ARXE SCSI card",
267 .info = arxescsi_info, 267 .info = arxescsi_info,
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index 26498553a7cc..81e266be26d0 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -238,7 +238,7 @@ static void cumanascsi_write(struct Scsi_Host *instance, int reg, int value)
238 238
239#include "../NCR5380.c" 239#include "../NCR5380.c"
240 240
241static Scsi_Host_Template cumanascsi_template = { 241static struct scsi_host_template cumanascsi_template = {
242 .module = THIS_MODULE, 242 .module = THIS_MODULE,
243 .name = "Cumana 16-bit SCSI", 243 .name = "Cumana 16-bit SCSI",
244 .info = cumanascsi_info, 244 .info = cumanascsi_info,
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index 0ef0644eeb29..3a7a46b0dc41 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -157,7 +157,7 @@ cumanascsi_2_intr(int irq, void *dev_id, struct pt_regs *regs)
157 * Returns : type of transfer to be performed 157 * Returns : type of transfer to be performed
158 */ 158 */
159static fasdmatype_t 159static fasdmatype_t
160cumanascsi_2_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp, 160cumanascsi_2_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
161 fasdmadir_t direction, fasdmatype_t min_type) 161 fasdmadir_t direction, fasdmatype_t min_type)
162{ 162{
163 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; 163 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata;
@@ -209,7 +209,7 @@ cumanascsi_2_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp,
209 * transfer - minimum number of bytes we expect to transfer 209 * transfer - minimum number of bytes we expect to transfer
210 */ 210 */
211static void 211static void
212cumanascsi_2_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp, 212cumanascsi_2_dma_pseudo(struct Scsi_Host *host, struct scsi_pointer *SCp,
213 fasdmadir_t direction, int transfer) 213 fasdmadir_t direction, int transfer)
214{ 214{
215 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; 215 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata;
@@ -283,7 +283,7 @@ cumanascsi_2_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp,
283 * SCpnt - command 283 * SCpnt - command
284 */ 284 */
285static void 285static void
286cumanascsi_2_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp) 286cumanascsi_2_dma_stop(struct Scsi_Host *host, struct scsi_pointer *SCp)
287{ 287{
288 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; 288 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata;
289 if (info->info.scsi.dma != NO_DMA) { 289 if (info->info.scsi.dma != NO_DMA) {
@@ -381,7 +381,7 @@ int cumanascsi_2_proc_info (struct Scsi_Host *host, char *buffer, char **start,
381 return pos; 381 return pos;
382} 382}
383 383
384static Scsi_Host_Template cumanascsi2_template = { 384static struct scsi_host_template cumanascsi2_template = {
385 .module = THIS_MODULE, 385 .module = THIS_MODULE,
386 .proc_info = cumanascsi_2_proc_info, 386 .proc_info = cumanascsi_2_proc_info,
387 .name = "Cumana SCSI II", 387 .name = "Cumana SCSI II",
diff --git a/drivers/scsi/arm/ecoscsi.c b/drivers/scsi/arm/ecoscsi.c
index f8a7fdd3c465..6adcccbf444b 100644
--- a/drivers/scsi/arm/ecoscsi.c
+++ b/drivers/scsi/arm/ecoscsi.c
@@ -155,7 +155,7 @@ printk("reading %p len %d\n",addr, len);
155 155
156#include "../NCR5380.c" 156#include "../NCR5380.c"
157 157
158static Scsi_Host_Template ecoscsi_template = { 158static struct scsi_host_template ecoscsi_template = {
159 .module = THIS_MODULE, 159 .module = THIS_MODULE,
160 .name = "Serial Port EcoSCSI NCR5380", 160 .name = "Serial Port EcoSCSI NCR5380",
161 .proc_name = "ecoscsi", 161 .proc_name = "ecoscsi",
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
index ce711f166cfb..4d1e8f52c924 100644
--- a/drivers/scsi/arm/eesox.c
+++ b/drivers/scsi/arm/eesox.c
@@ -158,7 +158,7 @@ eesoxscsi_intr(int irq, void *dev_id, struct pt_regs *regs)
158 * Returns : type of transfer to be performed 158 * Returns : type of transfer to be performed
159 */ 159 */
160static fasdmatype_t 160static fasdmatype_t
161eesoxscsi_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp, 161eesoxscsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
162 fasdmadir_t direction, fasdmatype_t min_type) 162 fasdmadir_t direction, fasdmatype_t min_type)
163{ 163{
164 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; 164 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata;
@@ -353,7 +353,7 @@ static void eesoxscsi_buffer_out(void *buf, int length, void __iomem *base)
353} 353}
354 354
355static void 355static void
356eesoxscsi_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp, 356eesoxscsi_dma_pseudo(struct Scsi_Host *host, struct scsi_pointer *SCp,
357 fasdmadir_t dir, int transfer_size) 357 fasdmadir_t dir, int transfer_size)
358{ 358{
359 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; 359 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata;
@@ -370,7 +370,7 @@ eesoxscsi_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp,
370 * SCpnt - command 370 * SCpnt - command
371 */ 371 */
372static void 372static void
373eesoxscsi_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp) 373eesoxscsi_dma_stop(struct Scsi_Host *host, struct scsi_pointer *SCp)
374{ 374{
375 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; 375 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata;
376 if (info->info.scsi.dma != NO_DMA) 376 if (info->info.scsi.dma != NO_DMA)
@@ -499,7 +499,7 @@ static ssize_t eesoxscsi_store_term(struct device *dev, struct device_attribute
499static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR, 499static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR,
500 eesoxscsi_show_term, eesoxscsi_store_term); 500 eesoxscsi_show_term, eesoxscsi_store_term);
501 501
502static Scsi_Host_Template eesox_template = { 502static struct scsi_host_template eesox_template = {
503 .module = THIS_MODULE, 503 .module = THIS_MODULE,
504 .proc_info = eesoxscsi_proc_info, 504 .proc_info = eesoxscsi_proc_info,
505 .name = "EESOX SCSI", 505 .name = "EESOX SCSI",
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 4772fb317f3e..3e1053f111dc 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -173,7 +173,7 @@ static void fas216_dumpstate(FAS216_Info *info)
173 fas216_readb(info, REG_CTCH)); 173 fas216_readb(info, REG_CTCH));
174} 174}
175 175
176static void print_SCp(Scsi_Pointer *SCp, const char *prefix, const char *suffix) 176static void print_SCp(struct scsi_pointer *SCp, const char *prefix, const char *suffix)
177{ 177{
178 printk("%sptr %p this_residual 0x%x buffer %p buffers_residual 0x%x%s", 178 printk("%sptr %p this_residual 0x%x buffer %p buffers_residual 0x%x%s",
179 prefix, SCp->ptr, SCp->this_residual, SCp->buffer, 179 prefix, SCp->ptr, SCp->this_residual, SCp->buffer,
@@ -628,7 +628,7 @@ static void fas216_handlesync(FAS216_Info *info, char *msg)
628 */ 628 */
629static void fas216_updateptrs(FAS216_Info *info, int bytes_transferred) 629static void fas216_updateptrs(FAS216_Info *info, int bytes_transferred)
630{ 630{
631 Scsi_Pointer *SCp = &info->scsi.SCp; 631 struct scsi_pointer *SCp = &info->scsi.SCp;
632 632
633 fas216_checkmagic(info); 633 fas216_checkmagic(info);
634 634
@@ -668,7 +668,7 @@ static void fas216_updateptrs(FAS216_Info *info, int bytes_transferred)
668 */ 668 */
669static void fas216_pio(FAS216_Info *info, fasdmadir_t direction) 669static void fas216_pio(FAS216_Info *info, fasdmadir_t direction)
670{ 670{
671 Scsi_Pointer *SCp = &info->scsi.SCp; 671 struct scsi_pointer *SCp = &info->scsi.SCp;
672 672
673 fas216_checkmagic(info); 673 fas216_checkmagic(info);
674 674
@@ -2559,7 +2559,7 @@ int fas216_eh_bus_reset(Scsi_Cmnd *SCpnt)
2559{ 2559{
2560 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; 2560 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata;
2561 unsigned long flags; 2561 unsigned long flags;
2562 Scsi_Device *SDpnt; 2562 struct scsi_device *SDpnt;
2563 2563
2564 fas216_checkmagic(info); 2564 fas216_checkmagic(info);
2565 fas216_log(info, LOG_ERROR, "resetting bus"); 2565 fas216_log(info, LOG_ERROR, "resetting bus");
@@ -3000,7 +3000,7 @@ int fas216_print_stats(FAS216_Info *info, char *buffer)
3000int fas216_print_devices(FAS216_Info *info, char *buffer) 3000int fas216_print_devices(FAS216_Info *info, char *buffer)
3001{ 3001{
3002 struct fas216_device *dev; 3002 struct fas216_device *dev;
3003 Scsi_Device *scd; 3003 struct scsi_device *scd;
3004 char *p = buffer; 3004 char *p = buffer;
3005 3005
3006 p += sprintf(p, "Device/Lun TaggedQ Parity Sync\n"); 3006 p += sprintf(p, "Device/Lun TaggedQ Parity Sync\n");
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h
index 60a2a120205b..540914d6fd32 100644
--- a/drivers/scsi/arm/fas216.h
+++ b/drivers/scsi/arm/fas216.h
@@ -243,7 +243,7 @@ typedef struct {
243 unsigned int irq; /* interrupt */ 243 unsigned int irq; /* interrupt */
244 int dma; /* dma channel */ 244 int dma; /* dma channel */
245 245
246 Scsi_Pointer SCp; /* current commands data pointer */ 246 struct scsi_pointer SCp; /* current commands data pointer */
247 247
248 MsgQueue_t msgs; /* message queue for connected device */ 248 MsgQueue_t msgs; /* message queue for connected device */
249 249
@@ -304,9 +304,9 @@ typedef struct {
304 /* dma */ 304 /* dma */
305 struct { 305 struct {
306 fasdmatype_t transfer_type; /* current type of DMA transfer */ 306 fasdmatype_t transfer_type; /* current type of DMA transfer */
307 fasdmatype_t (*setup) (struct Scsi_Host *host, Scsi_Pointer *SCp, fasdmadir_t direction, fasdmatype_t min_dma); 307 fasdmatype_t (*setup) (struct Scsi_Host *host, struct scsi_pointer *SCp, fasdmadir_t direction, fasdmatype_t min_dma);
308 void (*pseudo)(struct Scsi_Host *host, Scsi_Pointer *SCp, fasdmadir_t direction, int transfer); 308 void (*pseudo)(struct Scsi_Host *host, struct scsi_pointer *SCp, fasdmadir_t direction, int transfer);
309 void (*stop) (struct Scsi_Host *host, Scsi_Pointer *SCp); 309 void (*stop) (struct Scsi_Host *host, struct scsi_pointer *SCp);
310 } dma; 310 } dma;
311 311
312 /* miscellaneous */ 312 /* miscellaneous */
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c
index de24bb991f1d..d806b024c3bd 100644
--- a/drivers/scsi/arm/oak.c
+++ b/drivers/scsi/arm/oak.c
@@ -111,7 +111,7 @@ printk("reading %p len %d\n", addr, len);
111 111
112#include "../NCR5380.c" 112#include "../NCR5380.c"
113 113
114static Scsi_Host_Template oakscsi_template = { 114static struct scsi_host_template oakscsi_template = {
115 .module = THIS_MODULE, 115 .module = THIS_MODULE,
116 .proc_info = oakscsi_proc_info, 116 .proc_info = oakscsi_proc_info,
117 .name = "Oak 16-bit SCSI", 117 .name = "Oak 16-bit SCSI",
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index abda216113f1..3333d7b39139 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -132,7 +132,7 @@ powertecscsi_intr(int irq, void *dev_id, struct pt_regs *regs)
132 * Returns : type of transfer to be performed 132 * Returns : type of transfer to be performed
133 */ 133 */
134static fasdmatype_t 134static fasdmatype_t
135powertecscsi_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp, 135powertecscsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
136 fasdmadir_t direction, fasdmatype_t min_type) 136 fasdmadir_t direction, fasdmatype_t min_type)
137{ 137{
138 struct powertec_info *info = (struct powertec_info *)host->hostdata; 138 struct powertec_info *info = (struct powertec_info *)host->hostdata;
@@ -174,7 +174,7 @@ powertecscsi_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp,
174 * SCpnt - command 174 * SCpnt - command
175 */ 175 */
176static void 176static void
177powertecscsi_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp) 177powertecscsi_dma_stop(struct Scsi_Host *host, struct scsi_pointer *SCp)
178{ 178{
179 struct powertec_info *info = (struct powertec_info *)host->hostdata; 179 struct powertec_info *info = (struct powertec_info *)host->hostdata;
180 if (info->info.scsi.dma != NO_DMA) 180 if (info->info.scsi.dma != NO_DMA)
@@ -293,7 +293,7 @@ powertecscsi_store_term(struct device *dev, struct device_attribute *attr, const
293static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR, 293static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR,
294 powertecscsi_show_term, powertecscsi_store_term); 294 powertecscsi_show_term, powertecscsi_store_term);
295 295
296static Scsi_Host_Template powertecscsi_template = { 296static struct scsi_host_template powertecscsi_template = {
297 .module = THIS_MODULE, 297 .module = THIS_MODULE,
298 .proc_info = powertecscsi_proc_info, 298 .proc_info = powertecscsi_proc_info,
299 .name = "PowerTec SCSI", 299 .name = "PowerTec SCSI",
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h
index 19937640e2e7..6dd544a5eb56 100644
--- a/drivers/scsi/arm/scsi.h
+++ b/drivers/scsi/arm/scsi.h
@@ -18,7 +18,7 @@
18 * The scatter-gather list handling. This contains all 18 * The scatter-gather list handling. This contains all
19 * the yucky stuff that needs to be fixed properly. 19 * the yucky stuff that needs to be fixed properly.
20 */ 20 */
21static inline int copy_SCp_to_sg(struct scatterlist *sg, Scsi_Pointer *SCp, int max) 21static inline int copy_SCp_to_sg(struct scatterlist *sg, struct scsi_pointer *SCp, int max)
22{ 22{
23 int bufs = SCp->buffers_residual; 23 int bufs = SCp->buffers_residual;
24 24
@@ -32,7 +32,7 @@ static inline int copy_SCp_to_sg(struct scatterlist *sg, Scsi_Pointer *SCp, int
32 return bufs + 1; 32 return bufs + 1;
33} 33}
34 34
35static inline int next_SCp(Scsi_Pointer *SCp) 35static inline int next_SCp(struct scsi_pointer *SCp)
36{ 36{
37 int ret = SCp->buffers_residual; 37 int ret = SCp->buffers_residual;
38 if (ret) { 38 if (ret) {
@@ -49,7 +49,7 @@ static inline int next_SCp(Scsi_Pointer *SCp)
49 return ret; 49 return ret;
50} 50}
51 51
52static inline unsigned char get_next_SCp_byte(Scsi_Pointer *SCp) 52static inline unsigned char get_next_SCp_byte(struct scsi_pointer *SCp)
53{ 53{
54 char c = *SCp->ptr; 54 char c = *SCp->ptr;
55 55
@@ -59,7 +59,7 @@ static inline unsigned char get_next_SCp_byte(Scsi_Pointer *SCp)
59 return c; 59 return c;
60} 60}
61 61
62static inline void put_next_SCp_byte(Scsi_Pointer *SCp, unsigned char c) 62static inline void put_next_SCp_byte(struct scsi_pointer *SCp, unsigned char c)
63{ 63{
64 *SCp->ptr = c; 64 *SCp->ptr = c;
65 SCp->ptr += 1; 65 SCp->ptr += 1;
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index a1bd8d95623c..333d69dd84ef 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -50,7 +50,7 @@
50#include <linux/libata.h> 50#include <linux/libata.h>
51 51
52#define DRV_NAME "ata_piix" 52#define DRV_NAME "ata_piix"
53#define DRV_VERSION "1.04" 53#define DRV_VERSION "1.05"
54 54
55enum { 55enum {
56 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 56 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
@@ -95,7 +95,7 @@ static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
95 95
96static unsigned int in_module_init = 1; 96static unsigned int in_module_init = 1;
97 97
98static struct pci_device_id piix_pci_tbl[] = { 98static const struct pci_device_id piix_pci_tbl[] = {
99#ifdef ATA_ENABLE_PATA 99#ifdef ATA_ENABLE_PATA
100 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata }, 100 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata },
101 { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, 101 { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata },
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 2c12be72c4c6..2ae31ceb32a8 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -255,7 +255,7 @@
255 */ 255 */
256 256
257static struct Scsi_Host *first_instance = NULL; 257static struct Scsi_Host *first_instance = NULL;
258static Scsi_Host_Template *the_template = NULL; 258static struct scsi_host_template *the_template = NULL;
259 259
260/* Macros ease life... :-) */ 260/* Macros ease life... :-) */
261#define SETUP_HOSTDATA(in) \ 261#define SETUP_HOSTDATA(in) \
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index af8adb629b33..f4c1ca7c1572 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -600,7 +600,7 @@ int atari_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
600#endif 600#endif
601 601
602 602
603int atari_scsi_detect (Scsi_Host_Template *host) 603int atari_scsi_detect (struct scsi_host_template *host)
604{ 604{
605 static int called = 0; 605 static int called = 0;
606 struct Scsi_Host *instance; 606 struct Scsi_Host *instance;
@@ -1141,7 +1141,7 @@ static void atari_scsi_falcon_reg_write( unsigned char reg, unsigned char value
1141 1141
1142#include "atari_NCR5380.c" 1142#include "atari_NCR5380.c"
1143 1143
1144static Scsi_Host_Template driver_template = { 1144static struct scsi_host_template driver_template = {
1145 .proc_info = atari_scsi_proc_info, 1145 .proc_info = atari_scsi_proc_info,
1146 .name = "Atari native SCSI", 1146 .name = "Atari native SCSI",
1147 .detect = atari_scsi_detect, 1147 .detect = atari_scsi_detect,
diff --git a/drivers/scsi/atari_scsi.h b/drivers/scsi/atari_scsi.h
index cc1256988841..f917bdd09b41 100644
--- a/drivers/scsi/atari_scsi.h
+++ b/drivers/scsi/atari_scsi.h
@@ -18,7 +18,7 @@
18/* (I_HAVE_OVERRUNS stuff removed) */ 18/* (I_HAVE_OVERRUNS stuff removed) */
19 19
20#ifndef ASM 20#ifndef ASM
21int atari_scsi_detect (Scsi_Host_Template *); 21int atari_scsi_detect (struct scsi_host_template *);
22const char *atari_scsi_info (struct Scsi_Host *); 22const char *atari_scsi_info (struct Scsi_Host *);
23int atari_scsi_reset (Scsi_Cmnd *, unsigned int); 23int atari_scsi_reset (Scsi_Cmnd *, unsigned int);
24#ifdef MODULE 24#ifdef MODULE
diff --git a/drivers/scsi/blz1230.c b/drivers/scsi/blz1230.c
index 4cd9fcf4dc50..763e409a1ff3 100644
--- a/drivers/scsi/blz1230.c
+++ b/drivers/scsi/blz1230.c
@@ -94,7 +94,7 @@ static volatile unsigned char cmd_buffer[16];
94 */ 94 */
95 95
96/***************************************************************** Detection */ 96/***************************************************************** Detection */
97int __init blz1230_esp_detect(Scsi_Host_Template *tpnt) 97int __init blz1230_esp_detect(struct scsi_host_template *tpnt)
98{ 98{
99 struct NCR_ESP *esp; 99 struct NCR_ESP *esp;
100 struct zorro_dev *z = NULL; 100 struct zorro_dev *z = NULL;
@@ -328,7 +328,7 @@ int blz1230_esp_release(struct Scsi_Host *instance)
328} 328}
329 329
330 330
331static Scsi_Host_Template driver_template = { 331static struct scsi_host_template driver_template = {
332 .proc_name = "esp-blz1230", 332 .proc_name = "esp-blz1230",
333 .proc_info = esp_proc_info, 333 .proc_info = esp_proc_info,
334 .name = "Blizzard1230 SCSI IV", 334 .name = "Blizzard1230 SCSI IV",
diff --git a/drivers/scsi/blz2060.c b/drivers/scsi/blz2060.c
index c5221d0de5ca..d72d05fffdfa 100644
--- a/drivers/scsi/blz2060.c
+++ b/drivers/scsi/blz2060.c
@@ -90,7 +90,7 @@ static volatile unsigned char cmd_buffer[16];
90 */ 90 */
91 91
92/***************************************************************** Detection */ 92/***************************************************************** Detection */
93int __init blz2060_esp_detect(Scsi_Host_Template *tpnt) 93int __init blz2060_esp_detect(struct scsi_host_template *tpnt)
94{ 94{
95 struct NCR_ESP *esp; 95 struct NCR_ESP *esp;
96 struct zorro_dev *z = NULL; 96 struct zorro_dev *z = NULL;
@@ -282,7 +282,7 @@ int blz2060_esp_release(struct Scsi_Host *instance)
282} 282}
283 283
284 284
285static Scsi_Host_Template driver_template = { 285static struct scsi_host_template driver_template = {
286 .proc_name = "esp-blz2060", 286 .proc_name = "esp-blz2060",
287 .proc_info = esp_proc_info, 287 .proc_info = esp_proc_info,
288 .name = "Blizzard2060 SCSI", 288 .name = "Blizzard2060 SCSI",
diff --git a/drivers/scsi/bvme6000.c b/drivers/scsi/bvme6000.c
index 130f30f51a9b..2958b8c2bfb7 100644
--- a/drivers/scsi/bvme6000.c
+++ b/drivers/scsi/bvme6000.c
@@ -23,7 +23,7 @@
23#include<linux/stat.h> 23#include<linux/stat.h>
24 24
25 25
26int bvme6000_scsi_detect(Scsi_Host_Template *tpnt) 26int bvme6000_scsi_detect(struct scsi_host_template *tpnt)
27{ 27{
28 static unsigned char called = 0; 28 static unsigned char called = 0;
29 int clock; 29 int clock;
@@ -59,7 +59,7 @@ static int bvme6000_scsi_release(struct Scsi_Host *shost)
59 return 0; 59 return 0;
60} 60}
61 61
62static Scsi_Host_Template driver_template = { 62static struct scsi_host_template driver_template = {
63 .name = "BVME6000 NCR53c710 SCSI", 63 .name = "BVME6000 NCR53c710 SCSI",
64 .detect = bvme6000_scsi_detect, 64 .detect = bvme6000_scsi_detect,
65 .release = bvme6000_scsi_release, 65 .release = bvme6000_scsi_release,
diff --git a/drivers/scsi/bvme6000.h b/drivers/scsi/bvme6000.h
index 49b6bbb0978e..7c9c0366cc08 100644
--- a/drivers/scsi/bvme6000.h
+++ b/drivers/scsi/bvme6000.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6int bvme6000_scsi_detect(Scsi_Host_Template *); 6int bvme6000_scsi_detect(struct scsi_host_template *);
7const char *NCR53c7x0_info(void); 7const char *NCR53c7x0_info(void);
8int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 8int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
9int NCR53c7xx_abort(Scsi_Cmnd *); 9int NCR53c7xx_abort(Scsi_Cmnd *);
diff --git a/drivers/scsi/cyberstorm.c b/drivers/scsi/cyberstorm.c
index bdbca85d1675..f9b940e56430 100644
--- a/drivers/scsi/cyberstorm.c
+++ b/drivers/scsi/cyberstorm.c
@@ -104,7 +104,7 @@ static volatile unsigned char cmd_buffer[16];
104 */ 104 */
105 105
106/***************************************************************** Detection */ 106/***************************************************************** Detection */
107int __init cyber_esp_detect(Scsi_Host_Template *tpnt) 107int __init cyber_esp_detect(struct scsi_host_template *tpnt)
108{ 108{
109 struct NCR_ESP *esp; 109 struct NCR_ESP *esp;
110 struct zorro_dev *z = NULL; 110 struct zorro_dev *z = NULL;
@@ -353,7 +353,7 @@ int cyber_esp_release(struct Scsi_Host *instance)
353} 353}
354 354
355 355
356static Scsi_Host_Template driver_template = { 356static struct scsi_host_template driver_template = {
357 .proc_name = "esp-cyberstorm", 357 .proc_name = "esp-cyberstorm",
358 .proc_info = esp_proc_info, 358 .proc_info = esp_proc_info,
359 .name = "CyberStorm SCSI", 359 .name = "CyberStorm SCSI",
diff --git a/drivers/scsi/cyberstormII.c b/drivers/scsi/cyberstormII.c
index 845d9259821e..a3caabfd7557 100644
--- a/drivers/scsi/cyberstormII.c
+++ b/drivers/scsi/cyberstormII.c
@@ -81,7 +81,7 @@ static volatile unsigned char cmd_buffer[16];
81 */ 81 */
82 82
83/***************************************************************** Detection */ 83/***************************************************************** Detection */
84int __init cyberII_esp_detect(Scsi_Host_Template *tpnt) 84int __init cyberII_esp_detect(struct scsi_host_template *tpnt)
85{ 85{
86 struct NCR_ESP *esp; 86 struct NCR_ESP *esp;
87 struct zorro_dev *z = NULL; 87 struct zorro_dev *z = NULL;
@@ -290,7 +290,7 @@ int cyberII_esp_release(struct Scsi_Host *instance)
290} 290}
291 291
292 292
293static Scsi_Host_Template driver_template = { 293static struct scsi_host_template driver_template = {
294 .proc_name = "esp-cyberstormII", 294 .proc_name = "esp-cyberstormII",
295 .proc_info = esp_proc_info, 295 .proc_info = esp_proc_info,
296 .name = "CyberStorm Mk II SCSI", 296 .name = "CyberStorm Mk II SCSI",
diff --git a/drivers/scsi/dec_esp.c b/drivers/scsi/dec_esp.c
index 256d6baf8df3..a35ee43a48df 100644
--- a/drivers/scsi/dec_esp.c
+++ b/drivers/scsi/dec_esp.c
@@ -133,7 +133,7 @@ static struct scsi_host_template driver_template = {
133#include "scsi_module.c" 133#include "scsi_module.c"
134 134
135/***************************************************************** Detection */ 135/***************************************************************** Detection */
136static int dec_esp_detect(Scsi_Host_Template * tpnt) 136static int dec_esp_detect(struct scsi_host_template * tpnt)
137{ 137{
138 struct NCR_ESP *esp; 138 struct NCR_ESP *esp;
139 struct ConfigDev *esp_dev; 139 struct ConfigDev *esp_dev;
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index c28e3aea1c3c..6252b9ddc01e 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -660,7 +660,12 @@ static int adpt_abort(struct scsi_cmnd * cmd)
660 msg[2] = 0; 660 msg[2] = 0;
661 msg[3]= 0; 661 msg[3]= 0;
662 msg[4] = (u32)cmd; 662 msg[4] = (u32)cmd;
663 if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){ 663 if (pHba->host)
664 spin_lock_irq(pHba->host->host_lock);
665 rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
666 if (pHba->host)
667 spin_unlock_irq(pHba->host->host_lock);
668 if (rcode != 0) {
664 if(rcode == -EOPNOTSUPP ){ 669 if(rcode == -EOPNOTSUPP ){
665 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name); 670 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name);
666 return FAILED; 671 return FAILED;
@@ -697,10 +702,15 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)
697 msg[2] = 0; 702 msg[2] = 0;
698 msg[3] = 0; 703 msg[3] = 0;
699 704
705 if (pHba->host)
706 spin_lock_irq(pHba->host->host_lock);
700 old_state = d->state; 707 old_state = d->state;
701 d->state |= DPTI_DEV_RESET; 708 d->state |= DPTI_DEV_RESET;
702 if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){ 709 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
703 d->state = old_state; 710 d->state = old_state;
711 if (pHba->host)
712 spin_unlock_irq(pHba->host->host_lock);
713 if (rcode != 0) {
704 if(rcode == -EOPNOTSUPP ){ 714 if(rcode == -EOPNOTSUPP ){
705 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); 715 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name);
706 return FAILED; 716 return FAILED;
@@ -708,7 +718,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)
708 printk(KERN_INFO"%s: Device reset failed\n",pHba->name); 718 printk(KERN_INFO"%s: Device reset failed\n",pHba->name);
709 return FAILED; 719 return FAILED;
710 } else { 720 } else {
711 d->state = old_state;
712 printk(KERN_INFO"%s: Device reset successful\n",pHba->name); 721 printk(KERN_INFO"%s: Device reset successful\n",pHba->name);
713 return SUCCESS; 722 return SUCCESS;
714 } 723 }
@@ -721,6 +730,7 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
721{ 730{
722 adpt_hba* pHba; 731 adpt_hba* pHba;
723 u32 msg[4]; 732 u32 msg[4];
733 u32 rcode;
724 734
725 pHba = (adpt_hba*)cmd->device->host->hostdata[0]; 735 pHba = (adpt_hba*)cmd->device->host->hostdata[0];
726 memset(msg, 0, sizeof(msg)); 736 memset(msg, 0, sizeof(msg));
@@ -729,7 +739,12 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
729 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); 739 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
730 msg[2] = 0; 740 msg[2] = 0;
731 msg[3] = 0; 741 msg[3] = 0;
732 if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){ 742 if (pHba->host)
743 spin_lock_irq(pHba->host->host_lock);
744 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
745 if (pHba->host)
746 spin_unlock_irq(pHba->host->host_lock);
747 if (rcode != 0) {
733 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); 748 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name);
734 return FAILED; 749 return FAILED;
735 } else { 750 } else {
@@ -816,7 +831,7 @@ static int adpt_hba_reset(adpt_hba* pHba)
816static void adpt_i2o_sys_shutdown(void) 831static void adpt_i2o_sys_shutdown(void)
817{ 832{
818 adpt_hba *pHba, *pNext; 833 adpt_hba *pHba, *pNext;
819 struct adpt_i2o_post_wait_data *p1, *p2; 834 struct adpt_i2o_post_wait_data *p1, *old;
820 835
821 printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n"); 836 printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n");
822 printk(KERN_INFO" This could take a few minutes if there are many devices attached\n"); 837 printk(KERN_INFO" This could take a few minutes if there are many devices attached\n");
@@ -830,13 +845,14 @@ static void adpt_i2o_sys_shutdown(void)
830 } 845 }
831 846
832 /* Remove any timedout entries from the wait queue. */ 847 /* Remove any timedout entries from the wait queue. */
833 p2 = NULL;
834// spin_lock_irqsave(&adpt_post_wait_lock, flags); 848// spin_lock_irqsave(&adpt_post_wait_lock, flags);
835 /* Nothing should be outstanding at this point so just 849 /* Nothing should be outstanding at this point so just
836 * free them 850 * free them
837 */ 851 */
838 for(p1 = adpt_post_wait_queue; p1; p2 = p1, p1 = p2->next) { 852 for(p1 = adpt_post_wait_queue; p1;) {
839 kfree(p1); 853 old = p1;
854 p1 = p1->next;
855 kfree(old);
840 } 856 }
841// spin_unlock_irqrestore(&adpt_post_wait_lock, flags); 857// spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
842 adpt_post_wait_queue = NULL; 858 adpt_post_wait_queue = NULL;
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index 489194af43d0..2ad2a89b5db4 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -44,7 +44,7 @@ static int adpt_device_reset(struct scsi_cmnd* cmd);
44 44
45 45
46/* 46/*
47 * Scsi_Host_Template (see hosts.h) 47 * struct scsi_host_template (see hosts.h)
48 */ 48 */
49 49
50#define DPT_DRIVER_NAME "Adaptec I2O RAID" 50#define DPT_DRIVER_NAME "Adaptec I2O RAID"
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index 897743b23342..310d2f488668 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -199,7 +199,7 @@ static void __init dtc_setup(char *str, int *ints)
199#endif 199#endif
200 200
201/* 201/*
202 * Function : int dtc_detect(Scsi_Host_Template * tpnt) 202 * Function : int dtc_detect(struct scsi_host_template * tpnt)
203 * 203 *
204 * Purpose : detects and initializes DTC 3180/3280 controllers 204 * Purpose : detects and initializes DTC 3180/3280 controllers
205 * that were autoprobed, overridden on the LILO command line, 205 * that were autoprobed, overridden on the LILO command line,
@@ -211,7 +211,7 @@ static void __init dtc_setup(char *str, int *ints)
211 * 211 *
212*/ 212*/
213 213
214static int __init dtc_detect(Scsi_Host_Template * tpnt) 214static int __init dtc_detect(struct scsi_host_template * tpnt)
215{ 215{
216 static int current_override = 0, current_base = 0; 216 static int current_override = 0, current_base = 0;
217 struct Scsi_Host *instance; 217 struct Scsi_Host *instance;
@@ -471,7 +471,7 @@ static int dtc_release(struct Scsi_Host *shost)
471 return 0; 471 return 0;
472} 472}
473 473
474static Scsi_Host_Template driver_template = { 474static struct scsi_host_template driver_template = {
475 .name = "DTC 3180/3280 ", 475 .name = "DTC 3180/3280 ",
476 .detect = dtc_detect, 476 .detect = dtc_detect,
477 .release = dtc_release, 477 .release = dtc_release,
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h
index 277cd015ee4e..0b205f8c7326 100644
--- a/drivers/scsi/dtc.h
+++ b/drivers/scsi/dtc.h
@@ -35,7 +35,7 @@
35static int dtc_abort(Scsi_Cmnd *); 35static int dtc_abort(Scsi_Cmnd *);
36static int dtc_biosparam(struct scsi_device *, struct block_device *, 36static int dtc_biosparam(struct scsi_device *, struct block_device *,
37 sector_t, int*); 37 sector_t, int*);
38static int dtc_detect(Scsi_Host_Template *); 38static int dtc_detect(struct scsi_host_template *);
39static int dtc_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 39static int dtc_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
40static int dtc_bus_reset(Scsi_Cmnd *); 40static int dtc_bus_reset(Scsi_Cmnd *);
41 41
diff --git a/drivers/scsi/fastlane.c b/drivers/scsi/fastlane.c
index ae47612b3614..ccee68b52f7e 100644
--- a/drivers/scsi/fastlane.c
+++ b/drivers/scsi/fastlane.c
@@ -125,7 +125,7 @@ static inline void dma_clear(struct NCR_ESP *esp)
125} 125}
126 126
127/***************************************************************** Detection */ 127/***************************************************************** Detection */
128int __init fastlane_esp_detect(Scsi_Host_Template *tpnt) 128int __init fastlane_esp_detect(struct scsi_host_template *tpnt)
129{ 129{
130 struct NCR_ESP *esp; 130 struct NCR_ESP *esp;
131 struct zorro_dev *z = NULL; 131 struct zorro_dev *z = NULL;
@@ -398,7 +398,7 @@ int fastlane_esp_release(struct Scsi_Host *instance)
398} 398}
399 399
400 400
401static Scsi_Host_Template driver_template = { 401static struct scsi_host_template driver_template = {
402 .proc_name = "esp-fastlane", 402 .proc_name = "esp-fastlane",
403 .proc_info = esp_proc_info, 403 .proc_info = esp_proc_info,
404 .name = "Fastlane SCSI", 404 .name = "Fastlane SCSI",
diff --git a/drivers/scsi/fcal.c b/drivers/scsi/fcal.c
index a6f120dcdfc3..03416548f20c 100644
--- a/drivers/scsi/fcal.c
+++ b/drivers/scsi/fcal.c
@@ -70,7 +70,7 @@ static unsigned char target2alpa[] = {
70 70
71static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); 71static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
72 72
73int fcal_slave_configure(Scsi_Device *device) 73int fcal_slave_configure(struct scsi_device *device)
74{ 74{
75 int depth_to_use; 75 int depth_to_use;
76 76
@@ -89,7 +89,7 @@ int fcal_slave_configure(Scsi_Device *device)
89 89
90/* Detect all FC Arbitrated Loops attached to the machine. 90/* Detect all FC Arbitrated Loops attached to the machine.
91 fc4 module has done all the work for us... */ 91 fc4 module has done all the work for us... */
92int __init fcal_detect(Scsi_Host_Template *tpnt) 92int __init fcal_detect(struct scsi_host_template *tpnt)
93{ 93{
94 int nfcals = 0; 94 int nfcals = 0;
95 fc_channel *fc; 95 fc_channel *fc;
@@ -244,7 +244,7 @@ int fcal_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t of
244 SPRINTF (" [AL-PA: %02x, Port WWN: %08x%08x, Node WWN: %08x%08x] Not responded to PRLI\n", 244 SPRINTF (" [AL-PA: %02x, Port WWN: %08x%08x, Node WWN: %08x%08x] Not responded to PRLI\n",
245 alpa, u1[0], u1[1], u2[0], u2[1]); 245 alpa, u1[0], u1[1], u2[0], u2[1]);
246 } else { 246 } else {
247 Scsi_Device *scd; 247 struct scsi_device *scd;
248 shost_for_each_device(scd, host) 248 shost_for_each_device(scd, host)
249 if (scd->id == target) { 249 if (scd->id == target) {
250 SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ", 250 SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ",
@@ -297,7 +297,7 @@ static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmn
297 return 0; 297 return 0;
298} 298}
299 299
300static Scsi_Host_Template driver_template = { 300static struct scsi_host_template driver_template = {
301 .name = "Fibre Channel Arbitrated Loop", 301 .name = "Fibre Channel Arbitrated Loop",
302 .detect = fcal_detect, 302 .detect = fcal_detect,
303 .release = fcal_release, 303 .release = fcal_release,
diff --git a/drivers/scsi/fcal.h b/drivers/scsi/fcal.h
index 21aa32ef9134..7ff2c3494f9e 100644
--- a/drivers/scsi/fcal.h
+++ b/drivers/scsi/fcal.h
@@ -20,8 +20,8 @@ struct fcal {
20 for a particular channel */ 20 for a particular channel */
21#define FCAL_CAN_QUEUE 512 21#define FCAL_CAN_QUEUE 512
22 22
23int fcal_detect(Scsi_Host_Template *); 23int fcal_detect(struct scsi_host_template *);
24int fcal_release(struct Scsi_Host *); 24int fcal_release(struct Scsi_Host *);
25int fcal_slave_configure(Scsi_Device *); 25int fcal_slave_configure(struct scsi_device *);
26 26
27#endif /* !(_FCAL_H) */ 27#endif /* !(_FCAL_H) */
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
index 6d44602aae78..cca485a2b438 100644
--- a/drivers/scsi/fd_mcs.c
+++ b/drivers/scsi/fd_mcs.c
@@ -343,7 +343,7 @@ static void fd_mcs_make_bus_idle(struct Scsi_Host *shpnt)
343 outb(0x01 | PARITY_MASK, TMC_Cntl_port); 343 outb(0x01 | PARITY_MASK, TMC_Cntl_port);
344} 344}
345 345
346static int fd_mcs_detect(Scsi_Host_Template * tpnt) 346static int fd_mcs_detect(struct scsi_host_template * tpnt)
347{ 347{
348 int loop; 348 int loop;
349 struct Scsi_Host *shpnt; 349 struct Scsi_Host *shpnt;
@@ -1343,7 +1343,7 @@ static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev
1343 return 0; 1343 return 0;
1344} 1344}
1345 1345
1346static Scsi_Host_Template driver_template = { 1346static struct scsi_host_template driver_template = {
1347 .proc_name = "fd_mcs", 1347 .proc_name = "fd_mcs",
1348 .proc_info = fd_mcs_proc_info, 1348 .proc_info = fd_mcs_proc_info,
1349 .detect = fd_mcs_detect, 1349 .detect = fd_mcs_detect,
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index a3aa729b9d3c..45756fa90777 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -285,7 +285,7 @@ static int __init do_DTC3181E_setup(char *str)
285 * Locks: none 285 * Locks: none
286 */ 286 */
287 287
288int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt) 288int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
289{ 289{
290 static int current_override = 0; 290 static int current_override = 0;
291 int count, i; 291 int count, i;
@@ -798,7 +798,7 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c
798 Scsi_Cmnd *ptr; 798 Scsi_Cmnd *ptr;
799 struct NCR5380_hostdata *hostdata; 799 struct NCR5380_hostdata *hostdata;
800#ifdef NCR5380_STATS 800#ifdef NCR5380_STATS
801 Scsi_Device *dev; 801 struct scsi_device *dev;
802 extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; 802 extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
803#endif 803#endif
804 804
@@ -899,7 +899,7 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c
899#undef PRINTP 899#undef PRINTP
900#undef ANDP 900#undef ANDP
901 901
902static Scsi_Host_Template driver_template = { 902static struct scsi_host_template driver_template = {
903 .proc_info = generic_NCR5380_proc_info, 903 .proc_info = generic_NCR5380_proc_info,
904 .name = "Generic NCR5380/NCR53C400 Scsi Driver", 904 .name = "Generic NCR5380/NCR53C400 Scsi Driver",
905 .detect = generic_NCR5380_detect, 905 .detect = generic_NCR5380_detect,
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h
index c8adc5a94884..656fbe2f91f6 100644
--- a/drivers/scsi/g_NCR5380.h
+++ b/drivers/scsi/g_NCR5380.h
@@ -45,7 +45,7 @@
45 45
46#ifndef ASM 46#ifndef ASM
47static int generic_NCR5380_abort(Scsi_Cmnd *); 47static int generic_NCR5380_abort(Scsi_Cmnd *);
48static int generic_NCR5380_detect(Scsi_Host_Template *); 48static int generic_NCR5380_detect(struct scsi_host_template *);
49static int generic_NCR5380_release_resources(struct Scsi_Host *); 49static int generic_NCR5380_release_resources(struct Scsi_Host *);
50static int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 50static int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
51static int generic_NCR5380_bus_reset(Scsi_Cmnd *); 51static int generic_NCR5380_bus_reset(Scsi_Cmnd *);
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index af682301beac..a6deb016584c 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -94,7 +94,7 @@
94 * Bugfix free_irq() 94 * Bugfix free_irq()
95 * 95 *
96 * Revision 1.56 2001/08/09 11:19:39 achim 96 * Revision 1.56 2001/08/09 11:19:39 achim
97 * Scsi_Host_Template changes 97 * struct scsi_host_template changes
98 * 98 *
99 * Revision 1.55 2001/08/09 10:11:28 achim 99 * Revision 1.55 2001/08/09 10:11:28 achim
100 * Command HOST_UNFREEZE_IO before cache service init. 100 * Command HOST_UNFREEZE_IO before cache service init.
@@ -4153,7 +4153,7 @@ int __init option_setup(char *str)
4153 return 1; 4153 return 1;
4154} 4154}
4155 4155
4156static int __init gdth_detect(Scsi_Host_Template *shtp) 4156static int __init gdth_detect(struct scsi_host_template *shtp)
4157{ 4157{
4158 struct Scsi_Host *shp; 4158 struct Scsi_Host *shp;
4159 gdth_pci_str pcistr[MAXHA]; 4159 gdth_pci_str pcistr[MAXHA];
@@ -5562,7 +5562,7 @@ static void gdth_flush(int hanum)
5562#else 5562#else
5563 Scsi_Cmnd *scp; 5563 Scsi_Cmnd *scp;
5564#endif 5564#endif
5565 Scsi_Device *sdev; 5565 struct scsi_device *sdev;
5566 char cmnd[MAX_COMMAND_SIZE]; 5566 char cmnd[MAX_COMMAND_SIZE];
5567 memset(cmnd, 0xff, MAX_COMMAND_SIZE); 5567 memset(cmnd, 0xff, MAX_COMMAND_SIZE);
5568 5568
@@ -5624,10 +5624,10 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
5624 gdth_cmd_str gdtcmd; 5624 gdth_cmd_str gdtcmd;
5625#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 5625#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
5626 Scsi_Request *srp; 5626 Scsi_Request *srp;
5627 Scsi_Device *sdev; 5627 struct scsi_device *sdev;
5628#else 5628#else
5629 Scsi_Cmnd *scp; 5629 Scsi_Cmnd *scp;
5630 Scsi_Device *sdev; 5630 struct scsi_device *sdev;
5631#endif 5631#endif
5632 char cmnd[MAX_COMMAND_SIZE]; 5632 char cmnd[MAX_COMMAND_SIZE];
5633#endif 5633#endif
@@ -5683,7 +5683,7 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
5683 return NOTIFY_OK; 5683 return NOTIFY_OK;
5684} 5684}
5685 5685
5686static Scsi_Host_Template driver_template = { 5686static struct scsi_host_template driver_template = {
5687 .proc_name = "gdth", 5687 .proc_name = "gdth",
5688 .proc_info = gdth_proc_info, 5688 .proc_info = gdth_proc_info,
5689 .name = "GDT SCSI Disk Array Controller", 5689 .name = "GDT SCSI Disk Array Controller",
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h
index c0f1e3411524..cc4882fb97ad 100644
--- a/drivers/scsi/gdth.h
+++ b/drivers/scsi/gdth.h
@@ -944,9 +944,9 @@ typedef struct {
944 ulong dma32_cnt, dma64_cnt; /* statistics: DMA buffer */ 944 ulong dma32_cnt, dma64_cnt; /* statistics: DMA buffer */
945#endif 945#endif
946#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) 946#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
947 Scsi_Device *sdev; 947 struct scsi_device *sdev;
948#else 948#else
949 Scsi_Device sdev; 949 struct scsi_device sdev;
950#endif 950#endif
951} gdth_ha_str; 951} gdth_ha_str;
952 952
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index 1bd02f8d1e6a..5e8657f9cdf6 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -54,10 +54,10 @@ static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host,
54 int ret_val = -EINVAL; 54 int ret_val = -EINVAL;
55#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 55#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
56 Scsi_Request *scp; 56 Scsi_Request *scp;
57 Scsi_Device *sdev; 57 struct scsi_device *sdev;
58#else 58#else
59 Scsi_Cmnd *scp; 59 Scsi_Cmnd *scp;
60 Scsi_Device *sdev; 60 struct scsi_device *sdev;
61#endif 61#endif
62 TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum)); 62 TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum));
63 63
@@ -232,10 +232,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
232 gdth_evt_str *estr; 232 gdth_evt_str *estr;
233#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 233#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
234 Scsi_Request *scp; 234 Scsi_Request *scp;
235 Scsi_Device *sdev; 235 struct scsi_device *sdev;
236#else 236#else
237 Scsi_Cmnd *scp; 237 Scsi_Cmnd *scp;
238 Scsi_Device *sdev; 238 struct scsi_device *sdev;
239#endif 239#endif
240 char hrec[161]; 240 char hrec[161];
241 struct timeval tv; 241 struct timeval tv;
@@ -275,7 +275,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
275 scp->cmd_len = 12; 275 scp->cmd_len = 12;
276 scp->use_sg = 0; 276 scp->use_sg = 0;
277#else 277#else
278 memset(&sdev,0,sizeof(Scsi_Device)); 278 memset(&sdev,0,sizeof(struct scsi_device));
279 memset(&scp, 0,sizeof(Scsi_Cmnd)); 279 memset(&scp, 0,sizeof(Scsi_Cmnd));
280 sdev.host = scp.host = host; 280 sdev.host = scp.host = host;
281 sdev.id = scp.target = sdev.host->this_id; 281 sdev.id = scp.target = sdev.host->this_id;
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index ab22387c9df1..5b154498056d 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -169,7 +169,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
169 169
170#define CHECK_WD33C93 170#define CHECK_WD33C93
171 171
172int __init gvp11_detect(Scsi_Host_Template *tpnt) 172int __init gvp11_detect(struct scsi_host_template *tpnt)
173{ 173{
174 static unsigned char called = 0; 174 static unsigned char called = 0;
175 struct Scsi_Host *instance; 175 struct Scsi_Host *instance;
@@ -361,7 +361,7 @@ static int gvp11_bus_reset(Scsi_Cmnd *cmd)
361 361
362#include "gvp11.h" 362#include "gvp11.h"
363 363
364static Scsi_Host_Template driver_template = { 364static struct scsi_host_template driver_template = {
365 .proc_name = "GVP11", 365 .proc_name = "GVP11",
366 .name = "GVP Series II SCSI", 366 .name = "GVP Series II SCSI",
367 .detect = gvp11_detect, 367 .detect = gvp11_detect,
diff --git a/drivers/scsi/gvp11.h b/drivers/scsi/gvp11.h
index 5148d9fada19..575d219d14ba 100644
--- a/drivers/scsi/gvp11.h
+++ b/drivers/scsi/gvp11.h
@@ -11,7 +11,7 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13 13
14int gvp11_detect(Scsi_Host_Template *); 14int gvp11_detect(struct scsi_host_template *);
15int gvp11_release(struct Scsi_Host *); 15int gvp11_release(struct Scsi_Host *);
16const char *wd33c93_info(void); 16const char *wd33c93_info(void);
17int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 17int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index 8d97999db60e..b60c1b9270f1 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -492,7 +492,7 @@ static char *ibmrate(unsigned int, int);
492static int probe_display(int); 492static int probe_display(int);
493static int probe_bus_mode(int); 493static int probe_bus_mode(int);
494static int device_exists(int, int, int *, int *); 494static int device_exists(int, int, int *, int *);
495static struct Scsi_Host *ibmmca_register(Scsi_Host_Template *, int, int, int, char *); 495static struct Scsi_Host *ibmmca_register(struct scsi_host_template *, int, int, int, char *);
496static int option_setup(char *); 496static int option_setup(char *);
497/* local functions needed for proc_info */ 497/* local functions needed for proc_info */
498static int ldn_access_load(int, int); 498static int ldn_access_load(int, int);
@@ -1483,7 +1483,7 @@ static int ibmmca_getinfo(char *buf, int slot, void *dev_id)
1483 return len; 1483 return len;
1484} 1484}
1485 1485
1486int ibmmca_detect(Scsi_Host_Template * scsi_template) 1486int ibmmca_detect(struct scsi_host_template * scsi_template)
1487{ 1487{
1488 struct Scsi_Host *shpnt; 1488 struct Scsi_Host *shpnt;
1489 int port, id, i, j, k, list_size, slot; 1489 int port, id, i, j, k, list_size, slot;
@@ -1736,7 +1736,7 @@ int ibmmca_detect(Scsi_Host_Template * scsi_template)
1736 return found; /* return the number of found SCSI hosts. Should be 1 or 0. */ 1736 return found; /* return the number of found SCSI hosts. Should be 1 or 0. */
1737} 1737}
1738 1738
1739static struct Scsi_Host *ibmmca_register(Scsi_Host_Template * scsi_template, int port, int id, int adaptertype, char *hostname) 1739static struct Scsi_Host *ibmmca_register(struct scsi_host_template * scsi_template, int port, int id, int adaptertype, char *hostname)
1740{ 1740{
1741 struct Scsi_Host *shpnt; 1741 struct Scsi_Host *shpnt;
1742 int i, j; 1742 int i, j;
@@ -2494,7 +2494,7 @@ static int option_setup(char *str)
2494 2494
2495__setup("ibmmcascsi=", option_setup); 2495__setup("ibmmcascsi=", option_setup);
2496 2496
2497static Scsi_Host_Template driver_template = { 2497static struct scsi_host_template driver_template = {
2498 .proc_name = "ibmmca", 2498 .proc_name = "ibmmca",
2499 .proc_info = ibmmca_proc_info, 2499 .proc_info = ibmmca_proc_info,
2500 .name = "IBM SCSI-Subsystem", 2500 .name = "IBM SCSI-Subsystem",
diff --git a/drivers/scsi/ibmmca.h b/drivers/scsi/ibmmca.h
index 6d68f603e9b8..017ee2fa6d63 100644
--- a/drivers/scsi/ibmmca.h
+++ b/drivers/scsi/ibmmca.h
@@ -11,7 +11,7 @@
11/* Common forward declarations for all Linux-versions: */ 11/* Common forward declarations for all Linux-versions: */
12 12
13/* Interfaces to the midlevel Linux SCSI driver */ 13/* Interfaces to the midlevel Linux SCSI driver */
14static int ibmmca_detect (Scsi_Host_Template *); 14static int ibmmca_detect (struct scsi_host_template *);
15static int ibmmca_release (struct Scsi_Host *); 15static int ibmmca_release (struct Scsi_Host *);
16static int ibmmca_queuecommand (Scsi_Cmnd *, void (*done) (Scsi_Cmnd *)); 16static int ibmmca_queuecommand (Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
17static int ibmmca_abort (Scsi_Cmnd *); 17static int ibmmca_abort (Scsi_Cmnd *);
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 8bec0438dc8a..5b0edd1f1921 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -100,7 +100,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
100void ibmvscsi_release_crq_queue(struct crq_queue *queue, 100void ibmvscsi_release_crq_queue(struct crq_queue *queue,
101 struct ibmvscsi_host_data *hostdata, 101 struct ibmvscsi_host_data *hostdata,
102 int max_requests); 102 int max_requests);
103void 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
106void ibmvscsi_handle_crq(struct viosrp_crq *crq, 106void ibmvscsi_handle_crq(struct viosrp_crq *crq,
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
index 1045872b0175..ce15d9e39621 100644
--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
+++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
@@ -117,9 +117,10 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
117 * 117 *
118 * no-op for iSeries 118 * no-op for iSeries
119 */ 119 */
120void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 120int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
121 struct ibmvscsi_host_data *hostdata) 121 struct ibmvscsi_host_data *hostdata)
122{ 122{
123 return 0;
123} 124}
124 125
125/** 126/**
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 8bf5652f1060..75db2f5c545e 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -230,6 +230,11 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
230 rc = plpar_hcall_norets(H_REG_CRQ, 230 rc = plpar_hcall_norets(H_REG_CRQ,
231 vdev->unit_address, 231 vdev->unit_address,
232 queue->msg_token, PAGE_SIZE); 232 queue->msg_token, PAGE_SIZE);
233 if (rc == H_Resource)
234 /* maybe kexecing and resource is busy. try a reset */
235 rc = ibmvscsi_reset_crq_queue(queue,
236 hostdata);
237
233 if (rc == 2) { 238 if (rc == 2) {
234 /* Adapter is good, but other end is not ready */ 239 /* Adapter is good, but other end is not ready */
235 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); 240 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
@@ -281,7 +286,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
281 * @hostdata: ibmvscsi_host_data of host 286 * @hostdata: ibmvscsi_host_data of host
282 * 287 *
283 */ 288 */
284void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 289int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
285 struct ibmvscsi_host_data *hostdata) 290 struct ibmvscsi_host_data *hostdata)
286{ 291{
287 int rc; 292 int rc;
@@ -309,4 +314,5 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue,
309 printk(KERN_WARNING 314 printk(KERN_WARNING
310 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc); 315 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
311 } 316 }
317 return rc;
312} 318}
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 3553da0e1cd5..4cb1f3ed9100 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -784,8 +784,8 @@ static ide_proc_entry_t idescsi_proc[] = {
784#endif 784#endif
785 785
786static ide_driver_t idescsi_driver = { 786static ide_driver_t idescsi_driver = {
787 .owner = THIS_MODULE,
788 .gen_driver = { 787 .gen_driver = {
788 .owner = THIS_MODULE,
789 .name = "ide-scsi", 789 .name = "ide-scsi",
790 .bus = &ide_bus_type, 790 .bus = &ide_bus_type,
791 .probe = ide_scsi_probe, 791 .probe = ide_scsi_probe,
@@ -882,7 +882,7 @@ static inline int should_transform(ide_drive_t *drive, struct scsi_cmnd *cmd)
882 struct gendisk *disk = cmd->request->rq_disk; 882 struct gendisk *disk = cmd->request->rq_disk;
883 883
884 if (disk) { 884 if (disk) {
885 struct Scsi_Device_Template **p = disk->private_data; 885 struct struct scsi_device_Template **p = disk->private_data;
886 if (strcmp((*p)->scsi_driverfs_driver.name, "sg") == 0) 886 if (strcmp((*p)->scsi_driverfs_driver.name, "sg") == 0)
887 return test_bit(IDESCSI_SG_TRANSFORM, &scsi->transform); 887 return test_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
888 } 888 }
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index fe387b5ce8bd..34daa3e068de 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -1899,7 +1899,7 @@ static int int_tab[] in2000__INITDATA = {
1899}; 1899};
1900 1900
1901 1901
1902static int __init in2000_detect(Scsi_Host_Template * tpnt) 1902static int __init in2000_detect(struct scsi_host_template * tpnt)
1903{ 1903{
1904 struct Scsi_Host *instance; 1904 struct Scsi_Host *instance;
1905 struct IN2000_hostdata *hostdata; 1905 struct IN2000_hostdata *hostdata;
@@ -2305,7 +2305,7 @@ static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start,
2305MODULE_LICENSE("GPL"); 2305MODULE_LICENSE("GPL");
2306 2306
2307 2307
2308static Scsi_Host_Template driver_template = { 2308static struct scsi_host_template driver_template = {
2309 .proc_name = "in2000", 2309 .proc_name = "in2000",
2310 .proc_info = in2000_proc_info, 2310 .proc_info = in2000_proc_info,
2311 .name = "Always IN2000", 2311 .name = "Always IN2000",
diff --git a/drivers/scsi/in2000.h b/drivers/scsi/in2000.h
index a240b52554d8..0fb8b06b8392 100644
--- a/drivers/scsi/in2000.h
+++ b/drivers/scsi/in2000.h
@@ -395,7 +395,7 @@ struct IN2000_hostdata {
395# define CLISPIN_UNLOCK(host,flags) spin_unlock_irqrestore(host->host_lock, \ 395# define CLISPIN_UNLOCK(host,flags) spin_unlock_irqrestore(host->host_lock, \
396 flags) 396 flags)
397 397
398static int in2000_detect(Scsi_Host_Template *) in2000__INIT; 398static int in2000_detect(struct scsi_host_template *) in2000__INIT;
399static int in2000_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 399static int in2000_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
400static int in2000_abort(Scsi_Cmnd *); 400static int in2000_abort(Scsi_Cmnd *);
401static void in2000_setup(char *, int *) in2000__INIT; 401static void in2000_setup(char *, int *) in2000__INIT;
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e0039dfae8e5..fa2cb3582cfa 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -91,11 +91,14 @@ static unsigned int ipr_max_speed = 1;
91static int ipr_testmode = 0; 91static int ipr_testmode = 0;
92static unsigned int ipr_fastfail = 0; 92static unsigned int ipr_fastfail = 0;
93static unsigned int ipr_transop_timeout = IPR_OPERATIONAL_TIMEOUT; 93static unsigned int ipr_transop_timeout = IPR_OPERATIONAL_TIMEOUT;
94static unsigned int ipr_enable_cache = 1;
95static unsigned int ipr_debug = 0;
96static int ipr_auto_create = 1;
94static DEFINE_SPINLOCK(ipr_driver_lock); 97static DEFINE_SPINLOCK(ipr_driver_lock);
95 98
96/* This table describes the differences between DMA controller chips */ 99/* This table describes the differences between DMA controller chips */
97static const struct ipr_chip_cfg_t ipr_chip_cfg[] = { 100static const struct ipr_chip_cfg_t ipr_chip_cfg[] = {
98 { /* Gemstone and Citrine */ 101 { /* Gemstone, Citrine, and Obsidian */
99 .mailbox = 0x0042C, 102 .mailbox = 0x0042C,
100 .cache_line_size = 0x20, 103 .cache_line_size = 0x20,
101 { 104 {
@@ -130,6 +133,8 @@ static const struct ipr_chip_cfg_t ipr_chip_cfg[] = {
130static const struct ipr_chip_t ipr_chip[] = { 133static const struct ipr_chip_t ipr_chip[] = {
131 { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, &ipr_chip_cfg[0] }, 134 { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, &ipr_chip_cfg[0] },
132 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, &ipr_chip_cfg[0] }, 135 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, &ipr_chip_cfg[0] },
136 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, &ipr_chip_cfg[0] },
137 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, &ipr_chip_cfg[0] },
133 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, &ipr_chip_cfg[1] }, 138 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, &ipr_chip_cfg[1] },
134 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, &ipr_chip_cfg[1] } 139 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, &ipr_chip_cfg[1] }
135}; 140};
@@ -150,6 +155,12 @@ module_param_named(fastfail, ipr_fastfail, int, 0);
150MODULE_PARM_DESC(fastfail, "Reduce timeouts and retries"); 155MODULE_PARM_DESC(fastfail, "Reduce timeouts and retries");
151module_param_named(transop_timeout, ipr_transop_timeout, int, 0); 156module_param_named(transop_timeout, ipr_transop_timeout, int, 0);
152MODULE_PARM_DESC(transop_timeout, "Time in seconds to wait for adapter to come operational (default: 300)"); 157MODULE_PARM_DESC(transop_timeout, "Time in seconds to wait for adapter to come operational (default: 300)");
158module_param_named(enable_cache, ipr_enable_cache, int, 0);
159MODULE_PARM_DESC(enable_cache, "Enable adapter's non-volatile write cache (default: 1)");
160module_param_named(debug, ipr_debug, int, 0);
161MODULE_PARM_DESC(debug, "Enable device driver debugging logging. Set to 1 to enable. (default: 0)");
162module_param_named(auto_create, ipr_auto_create, int, 0);
163MODULE_PARM_DESC(auto_create, "Auto-create single device RAID 0 arrays when initialized (default: 1)");
153MODULE_LICENSE("GPL"); 164MODULE_LICENSE("GPL");
154MODULE_VERSION(IPR_DRIVER_VERSION); 165MODULE_VERSION(IPR_DRIVER_VERSION);
155 166
@@ -285,12 +296,18 @@ struct ipr_error_table_t ipr_error_table[] = {
285 "3110: Device bus error, message or command phase"}, 296 "3110: Device bus error, message or command phase"},
286 {0x04670400, 0, 1, 297 {0x04670400, 0, 1,
287 "9091: Incorrect hardware configuration change has been detected"}, 298 "9091: Incorrect hardware configuration change has been detected"},
299 {0x04678000, 0, 1,
300 "9073: Invalid multi-adapter configuration"},
288 {0x046E0000, 0, 1, 301 {0x046E0000, 0, 1,
289 "FFF4: Command to logical unit failed"}, 302 "FFF4: Command to logical unit failed"},
290 {0x05240000, 1, 0, 303 {0x05240000, 1, 0,
291 "Illegal request, invalid request type or request packet"}, 304 "Illegal request, invalid request type or request packet"},
292 {0x05250000, 0, 0, 305 {0x05250000, 0, 0,
293 "Illegal request, invalid resource handle"}, 306 "Illegal request, invalid resource handle"},
307 {0x05258000, 0, 0,
308 "Illegal request, commands not allowed to this device"},
309 {0x05258100, 0, 0,
310 "Illegal request, command not allowed to a secondary adapter"},
294 {0x05260000, 0, 0, 311 {0x05260000, 0, 0,
295 "Illegal request, invalid field in parameter list"}, 312 "Illegal request, invalid field in parameter list"},
296 {0x05260100, 0, 0, 313 {0x05260100, 0, 0,
@@ -299,6 +316,8 @@ struct ipr_error_table_t ipr_error_table[] = {
299 "Illegal request, parameter value invalid"}, 316 "Illegal request, parameter value invalid"},
300 {0x052C0000, 0, 0, 317 {0x052C0000, 0, 0,
301 "Illegal request, command sequence error"}, 318 "Illegal request, command sequence error"},
319 {0x052C8000, 1, 0,
320 "Illegal request, dual adapter support not enabled"},
302 {0x06040500, 0, 1, 321 {0x06040500, 0, 1,
303 "9031: Array protection temporarily suspended, protection resuming"}, 322 "9031: Array protection temporarily suspended, protection resuming"},
304 {0x06040600, 0, 1, 323 {0x06040600, 0, 1,
@@ -315,18 +334,26 @@ struct ipr_error_table_t ipr_error_table[] = {
315 "3029: A device replacement has occurred"}, 334 "3029: A device replacement has occurred"},
316 {0x064C8000, 0, 1, 335 {0x064C8000, 0, 1,
317 "9051: IOA cache data exists for a missing or failed device"}, 336 "9051: IOA cache data exists for a missing or failed device"},
337 {0x064C8100, 0, 1,
338 "9055: Auxiliary cache IOA contains cache data needed by the primary IOA"},
318 {0x06670100, 0, 1, 339 {0x06670100, 0, 1,
319 "9025: Disk unit is not supported at its physical location"}, 340 "9025: Disk unit is not supported at its physical location"},
320 {0x06670600, 0, 1, 341 {0x06670600, 0, 1,
321 "3020: IOA detected a SCSI bus configuration error"}, 342 "3020: IOA detected a SCSI bus configuration error"},
322 {0x06678000, 0, 1, 343 {0x06678000, 0, 1,
323 "3150: SCSI bus configuration error"}, 344 "3150: SCSI bus configuration error"},
345 {0x06678100, 0, 1,
346 "9074: Asymmetric advanced function disk configuration"},
324 {0x06690200, 0, 1, 347 {0x06690200, 0, 1,
325 "9041: Array protection temporarily suspended"}, 348 "9041: Array protection temporarily suspended"},
326 {0x06698200, 0, 1, 349 {0x06698200, 0, 1,
327 "9042: Corrupt array parity detected on specified device"}, 350 "9042: Corrupt array parity detected on specified device"},
328 {0x066B0200, 0, 1, 351 {0x066B0200, 0, 1,
329 "9030: Array no longer protected due to missing or failed disk unit"}, 352 "9030: Array no longer protected due to missing or failed disk unit"},
353 {0x066B8000, 0, 1,
354 "9071: Link operational transition"},
355 {0x066B8100, 0, 1,
356 "9072: Link not operational transition"},
330 {0x066B8200, 0, 1, 357 {0x066B8200, 0, 1,
331 "9032: Array exposed but still protected"}, 358 "9032: Array exposed but still protected"},
332 {0x07270000, 0, 0, 359 {0x07270000, 0, 0,
@@ -789,7 +816,7 @@ static void ipr_send_hcam(struct ipr_ioa_cfg *ioa_cfg, u8 type,
789 **/ 816 **/
790static void ipr_init_res_entry(struct ipr_resource_entry *res) 817static void ipr_init_res_entry(struct ipr_resource_entry *res)
791{ 818{
792 res->needs_sync_complete = 1; 819 res->needs_sync_complete = 0;
793 res->in_erp = 0; 820 res->in_erp = 0;
794 res->add_to_ml = 0; 821 res->add_to_ml = 0;
795 res->del_from_ml = 0; 822 res->del_from_ml = 0;
@@ -889,29 +916,74 @@ static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd)
889 916
890/** 917/**
891 * ipr_log_vpd - Log the passed VPD to the error log. 918 * ipr_log_vpd - Log the passed VPD to the error log.
892 * @vpids: vendor/product id struct 919 * @vpd: vendor/product id/sn struct
893 * @serial_num: serial number string
894 * 920 *
895 * Return value: 921 * Return value:
896 * none 922 * none
897 **/ 923 **/
898static void ipr_log_vpd(struct ipr_std_inq_vpids *vpids, u8 *serial_num) 924static void ipr_log_vpd(struct ipr_vpd *vpd)
899{ 925{
900 char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN 926 char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN
901 + IPR_SERIAL_NUM_LEN]; 927 + IPR_SERIAL_NUM_LEN];
902 928
903 memcpy(buffer, vpids->vendor_id, IPR_VENDOR_ID_LEN); 929 memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);
904 memcpy(buffer + IPR_VENDOR_ID_LEN, vpids->product_id, 930 memcpy(buffer + IPR_VENDOR_ID_LEN, vpd->vpids.product_id,
905 IPR_PROD_ID_LEN); 931 IPR_PROD_ID_LEN);
906 buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN] = '\0'; 932 buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN] = '\0';
907 ipr_err("Vendor/Product ID: %s\n", buffer); 933 ipr_err("Vendor/Product ID: %s\n", buffer);
908 934
909 memcpy(buffer, serial_num, IPR_SERIAL_NUM_LEN); 935 memcpy(buffer, vpd->sn, IPR_SERIAL_NUM_LEN);
910 buffer[IPR_SERIAL_NUM_LEN] = '\0'; 936 buffer[IPR_SERIAL_NUM_LEN] = '\0';
911 ipr_err(" Serial Number: %s\n", buffer); 937 ipr_err(" Serial Number: %s\n", buffer);
912} 938}
913 939
914/** 940/**
941 * ipr_log_ext_vpd - Log the passed extended VPD to the error log.
942 * @vpd: vendor/product id/sn/wwn struct
943 *
944 * Return value:
945 * none
946 **/
947static void ipr_log_ext_vpd(struct ipr_ext_vpd *vpd)
948{
949 ipr_log_vpd(&vpd->vpd);
950 ipr_err(" WWN: %08X%08X\n", be32_to_cpu(vpd->wwid[0]),
951 be32_to_cpu(vpd->wwid[1]));
952}
953
954/**
955 * ipr_log_enhanced_cache_error - Log a cache error.
956 * @ioa_cfg: ioa config struct
957 * @hostrcb: hostrcb struct
958 *
959 * Return value:
960 * none
961 **/
962static void ipr_log_enhanced_cache_error(struct ipr_ioa_cfg *ioa_cfg,
963 struct ipr_hostrcb *hostrcb)
964{
965 struct ipr_hostrcb_type_12_error *error =
966 &hostrcb->hcam.u.error.u.type_12_error;
967
968 ipr_err("-----Current Configuration-----\n");
969 ipr_err("Cache Directory Card Information:\n");
970 ipr_log_ext_vpd(&error->ioa_vpd);
971 ipr_err("Adapter Card Information:\n");
972 ipr_log_ext_vpd(&error->cfc_vpd);
973
974 ipr_err("-----Expected Configuration-----\n");
975 ipr_err("Cache Directory Card Information:\n");
976 ipr_log_ext_vpd(&error->ioa_last_attached_to_cfc_vpd);
977 ipr_err("Adapter Card Information:\n");
978 ipr_log_ext_vpd(&error->cfc_last_attached_to_ioa_vpd);
979
980 ipr_err("Additional IOA Data: %08X %08X %08X\n",
981 be32_to_cpu(error->ioa_data[0]),
982 be32_to_cpu(error->ioa_data[1]),
983 be32_to_cpu(error->ioa_data[2]));
984}
985
986/**
915 * ipr_log_cache_error - Log a cache error. 987 * ipr_log_cache_error - Log a cache error.
916 * @ioa_cfg: ioa config struct 988 * @ioa_cfg: ioa config struct
917 * @hostrcb: hostrcb struct 989 * @hostrcb: hostrcb struct
@@ -927,17 +999,15 @@ static void ipr_log_cache_error(struct ipr_ioa_cfg *ioa_cfg,
927 999
928 ipr_err("-----Current Configuration-----\n"); 1000 ipr_err("-----Current Configuration-----\n");
929 ipr_err("Cache Directory Card Information:\n"); 1001 ipr_err("Cache Directory Card Information:\n");
930 ipr_log_vpd(&error->ioa_vpids, error->ioa_sn); 1002 ipr_log_vpd(&error->ioa_vpd);
931 ipr_err("Adapter Card Information:\n"); 1003 ipr_err("Adapter Card Information:\n");
932 ipr_log_vpd(&error->cfc_vpids, error->cfc_sn); 1004 ipr_log_vpd(&error->cfc_vpd);
933 1005
934 ipr_err("-----Expected Configuration-----\n"); 1006 ipr_err("-----Expected Configuration-----\n");
935 ipr_err("Cache Directory Card Information:\n"); 1007 ipr_err("Cache Directory Card Information:\n");
936 ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpids, 1008 ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpd);
937 error->ioa_last_attached_to_cfc_sn);
938 ipr_err("Adapter Card Information:\n"); 1009 ipr_err("Adapter Card Information:\n");
939 ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpids, 1010 ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpd);
940 error->cfc_last_attached_to_ioa_sn);
941 1011
942 ipr_err("Additional IOA Data: %08X %08X %08X\n", 1012 ipr_err("Additional IOA Data: %08X %08X %08X\n",
943 be32_to_cpu(error->ioa_data[0]), 1013 be32_to_cpu(error->ioa_data[0]),
@@ -946,6 +1016,46 @@ static void ipr_log_cache_error(struct ipr_ioa_cfg *ioa_cfg,
946} 1016}
947 1017
948/** 1018/**
1019 * ipr_log_enhanced_config_error - Log a configuration error.
1020 * @ioa_cfg: ioa config struct
1021 * @hostrcb: hostrcb struct
1022 *
1023 * Return value:
1024 * none
1025 **/
1026static void ipr_log_enhanced_config_error(struct ipr_ioa_cfg *ioa_cfg,
1027 struct ipr_hostrcb *hostrcb)
1028{
1029 int errors_logged, i;
1030 struct ipr_hostrcb_device_data_entry_enhanced *dev_entry;
1031 struct ipr_hostrcb_type_13_error *error;
1032
1033 error = &hostrcb->hcam.u.error.u.type_13_error;
1034 errors_logged = be32_to_cpu(error->errors_logged);
1035
1036 ipr_err("Device Errors Detected/Logged: %d/%d\n",
1037 be32_to_cpu(error->errors_detected), errors_logged);
1038
1039 dev_entry = error->dev;
1040
1041 for (i = 0; i < errors_logged; i++, dev_entry++) {
1042 ipr_err_separator;
1043
1044 ipr_phys_res_err(ioa_cfg, dev_entry->dev_res_addr, "Device %d", i + 1);
1045 ipr_log_ext_vpd(&dev_entry->vpd);
1046
1047 ipr_err("-----New Device Information-----\n");
1048 ipr_log_ext_vpd(&dev_entry->new_vpd);
1049
1050 ipr_err("Cache Directory Card Information:\n");
1051 ipr_log_ext_vpd(&dev_entry->ioa_last_with_dev_vpd);
1052
1053 ipr_err("Adapter Card Information:\n");
1054 ipr_log_ext_vpd(&dev_entry->cfc_last_with_dev_vpd);
1055 }
1056}
1057
1058/**
949 * ipr_log_config_error - Log a configuration error. 1059 * ipr_log_config_error - Log a configuration error.
950 * @ioa_cfg: ioa config struct 1060 * @ioa_cfg: ioa config struct
951 * @hostrcb: hostrcb struct 1061 * @hostrcb: hostrcb struct
@@ -966,30 +1076,22 @@ static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,
966 ipr_err("Device Errors Detected/Logged: %d/%d\n", 1076 ipr_err("Device Errors Detected/Logged: %d/%d\n",
967 be32_to_cpu(error->errors_detected), errors_logged); 1077 be32_to_cpu(error->errors_detected), errors_logged);
968 1078
969 dev_entry = error->dev_entry; 1079 dev_entry = error->dev;
970 1080
971 for (i = 0; i < errors_logged; i++, dev_entry++) { 1081 for (i = 0; i < errors_logged; i++, dev_entry++) {
972 ipr_err_separator; 1082 ipr_err_separator;
973 1083
974 if (dev_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) { 1084 ipr_phys_res_err(ioa_cfg, dev_entry->dev_res_addr, "Device %d", i + 1);
975 ipr_err("Device %d: missing\n", i + 1); 1085 ipr_log_vpd(&dev_entry->vpd);
976 } else {
977 ipr_err("Device %d: %d:%d:%d:%d\n", i + 1,
978 ioa_cfg->host->host_no, dev_entry->dev_res_addr.bus,
979 dev_entry->dev_res_addr.target, dev_entry->dev_res_addr.lun);
980 }
981 ipr_log_vpd(&dev_entry->dev_vpids, dev_entry->dev_sn);
982 1086
983 ipr_err("-----New Device Information-----\n"); 1087 ipr_err("-----New Device Information-----\n");
984 ipr_log_vpd(&dev_entry->new_dev_vpids, dev_entry->new_dev_sn); 1088 ipr_log_vpd(&dev_entry->new_vpd);
985 1089
986 ipr_err("Cache Directory Card Information:\n"); 1090 ipr_err("Cache Directory Card Information:\n");
987 ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpids, 1091 ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpd);
988 dev_entry->ioa_last_with_dev_sn);
989 1092
990 ipr_err("Adapter Card Information:\n"); 1093 ipr_err("Adapter Card Information:\n");
991 ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpids, 1094 ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpd);
992 dev_entry->cfc_last_with_dev_sn);
993 1095
994 ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n", 1096 ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n",
995 be32_to_cpu(dev_entry->ioa_data[0]), 1097 be32_to_cpu(dev_entry->ioa_data[0]),
@@ -1001,6 +1103,57 @@ static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,
1001} 1103}
1002 1104
1003/** 1105/**
1106 * ipr_log_enhanced_array_error - Log an array configuration error.
1107 * @ioa_cfg: ioa config struct
1108 * @hostrcb: hostrcb struct
1109 *
1110 * Return value:
1111 * none
1112 **/
1113static void ipr_log_enhanced_array_error(struct ipr_ioa_cfg *ioa_cfg,
1114 struct ipr_hostrcb *hostrcb)
1115{
1116 int i, num_entries;
1117 struct ipr_hostrcb_type_14_error *error;
1118 struct ipr_hostrcb_array_data_entry_enhanced *array_entry;
1119 const u8 zero_sn[IPR_SERIAL_NUM_LEN] = { [0 ... IPR_SERIAL_NUM_LEN-1] = '0' };
1120
1121 error = &hostrcb->hcam.u.error.u.type_14_error;
1122
1123 ipr_err_separator;
1124
1125 ipr_err("RAID %s Array Configuration: %d:%d:%d:%d\n",
1126 error->protection_level,
1127 ioa_cfg->host->host_no,
1128 error->last_func_vset_res_addr.bus,
1129 error->last_func_vset_res_addr.target,
1130 error->last_func_vset_res_addr.lun);
1131
1132 ipr_err_separator;
1133
1134 array_entry = error->array_member;
1135 num_entries = min_t(u32, be32_to_cpu(error->num_entries),
1136 sizeof(error->array_member));
1137
1138 for (i = 0; i < num_entries; i++, array_entry++) {
1139 if (!memcmp(array_entry->vpd.vpd.sn, zero_sn, IPR_SERIAL_NUM_LEN))
1140 continue;
1141
1142 if (be32_to_cpu(error->exposed_mode_adn) == i)
1143 ipr_err("Exposed Array Member %d:\n", i);
1144 else
1145 ipr_err("Array Member %d:\n", i);
1146
1147 ipr_log_ext_vpd(&array_entry->vpd);
1148 ipr_phys_res_err(ioa_cfg, array_entry->dev_res_addr, "Current Location");
1149 ipr_phys_res_err(ioa_cfg, array_entry->expected_dev_res_addr,
1150 "Expected Location");
1151
1152 ipr_err_separator;
1153 }
1154}
1155
1156/**
1004 * ipr_log_array_error - Log an array configuration error. 1157 * ipr_log_array_error - Log an array configuration error.
1005 * @ioa_cfg: ioa config struct 1158 * @ioa_cfg: ioa config struct
1006 * @hostrcb: hostrcb struct 1159 * @hostrcb: hostrcb struct
@@ -1032,36 +1185,19 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
1032 array_entry = error->array_member; 1185 array_entry = error->array_member;
1033 1186
1034 for (i = 0; i < 18; i++) { 1187 for (i = 0; i < 18; i++) {
1035 if (!memcmp(array_entry->serial_num, zero_sn, IPR_SERIAL_NUM_LEN)) 1188 if (!memcmp(array_entry->vpd.sn, zero_sn, IPR_SERIAL_NUM_LEN))
1036 continue; 1189 continue;
1037 1190
1038 if (be32_to_cpu(error->exposed_mode_adn) == i) { 1191 if (be32_to_cpu(error->exposed_mode_adn) == i)
1039 ipr_err("Exposed Array Member %d:\n", i); 1192 ipr_err("Exposed Array Member %d:\n", i);
1040 } else { 1193 else
1041 ipr_err("Array Member %d:\n", i); 1194 ipr_err("Array Member %d:\n", i);
1042 }
1043 1195
1044 ipr_log_vpd(&array_entry->vpids, array_entry->serial_num); 1196 ipr_log_vpd(&array_entry->vpd);
1045
1046 if (array_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
1047 ipr_err("Current Location: unknown\n");
1048 } else {
1049 ipr_err("Current Location: %d:%d:%d:%d\n",
1050 ioa_cfg->host->host_no,
1051 array_entry->dev_res_addr.bus,
1052 array_entry->dev_res_addr.target,
1053 array_entry->dev_res_addr.lun);
1054 }
1055 1197
1056 if (array_entry->expected_dev_res_addr.bus >= IPR_MAX_NUM_BUSES) { 1198 ipr_phys_res_err(ioa_cfg, array_entry->dev_res_addr, "Current Location");
1057 ipr_err("Expected Location: unknown\n"); 1199 ipr_phys_res_err(ioa_cfg, array_entry->expected_dev_res_addr,
1058 } else { 1200 "Expected Location");
1059 ipr_err("Expected Location: %d:%d:%d:%d\n",
1060 ioa_cfg->host->host_no,
1061 array_entry->expected_dev_res_addr.bus,
1062 array_entry->expected_dev_res_addr.target,
1063 array_entry->expected_dev_res_addr.lun);
1064 }
1065 1201
1066 ipr_err_separator; 1202 ipr_err_separator;
1067 1203
@@ -1073,35 +1209,95 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
1073} 1209}
1074 1210
1075/** 1211/**
1076 * ipr_log_generic_error - Log an adapter error. 1212 * ipr_log_hex_data - Log additional hex IOA error data.
1077 * @ioa_cfg: ioa config struct 1213 * @data: IOA error data
1078 * @hostrcb: hostrcb struct 1214 * @len: data length
1079 * 1215 *
1080 * Return value: 1216 * Return value:
1081 * none 1217 * none
1082 **/ 1218 **/
1083static void ipr_log_generic_error(struct ipr_ioa_cfg *ioa_cfg, 1219static void ipr_log_hex_data(u32 *data, int len)
1084 struct ipr_hostrcb *hostrcb)
1085{ 1220{
1086 int i; 1221 int i;
1087 int ioa_data_len = be32_to_cpu(hostrcb->hcam.length);
1088 1222
1089 if (ioa_data_len == 0) 1223 if (len == 0)
1090 return; 1224 return;
1091 1225
1092 ipr_err("IOA Error Data:\n"); 1226 for (i = 0; i < len / 4; i += 4) {
1093 ipr_err("Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");
1094
1095 for (i = 0; i < ioa_data_len / 4; i += 4) {
1096 ipr_err("%08X: %08X %08X %08X %08X\n", i*4, 1227 ipr_err("%08X: %08X %08X %08X %08X\n", i*4,
1097 be32_to_cpu(hostrcb->hcam.u.raw.data[i]), 1228 be32_to_cpu(data[i]),
1098 be32_to_cpu(hostrcb->hcam.u.raw.data[i+1]), 1229 be32_to_cpu(data[i+1]),
1099 be32_to_cpu(hostrcb->hcam.u.raw.data[i+2]), 1230 be32_to_cpu(data[i+2]),
1100 be32_to_cpu(hostrcb->hcam.u.raw.data[i+3])); 1231 be32_to_cpu(data[i+3]));
1101 } 1232 }
1102} 1233}
1103 1234
1104/** 1235/**
1236 * ipr_log_enhanced_dual_ioa_error - Log an enhanced dual adapter error.
1237 * @ioa_cfg: ioa config struct
1238 * @hostrcb: hostrcb struct
1239 *
1240 * Return value:
1241 * none
1242 **/
1243static void ipr_log_enhanced_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg,
1244 struct ipr_hostrcb *hostrcb)
1245{
1246 struct ipr_hostrcb_type_17_error *error;
1247
1248 error = &hostrcb->hcam.u.error.u.type_17_error;
1249 error->failure_reason[sizeof(error->failure_reason) - 1] = '\0';
1250
1251 ipr_err("%s\n", error->failure_reason);
1252 ipr_err("Remote Adapter VPD:\n");
1253 ipr_log_ext_vpd(&error->vpd);
1254 ipr_log_hex_data(error->data,
1255 be32_to_cpu(hostrcb->hcam.length) -
1256 (offsetof(struct ipr_hostrcb_error, u) +
1257 offsetof(struct ipr_hostrcb_type_17_error, data)));
1258}
1259
1260/**
1261 * ipr_log_dual_ioa_error - Log a dual adapter error.
1262 * @ioa_cfg: ioa config struct
1263 * @hostrcb: hostrcb struct
1264 *
1265 * Return value:
1266 * none
1267 **/
1268static void ipr_log_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg,
1269 struct ipr_hostrcb *hostrcb)
1270{
1271 struct ipr_hostrcb_type_07_error *error;
1272
1273 error = &hostrcb->hcam.u.error.u.type_07_error;
1274 error->failure_reason[sizeof(error->failure_reason) - 1] = '\0';
1275
1276 ipr_err("%s\n", error->failure_reason);
1277 ipr_err("Remote Adapter VPD:\n");
1278 ipr_log_vpd(&error->vpd);
1279 ipr_log_hex_data(error->data,
1280 be32_to_cpu(hostrcb->hcam.length) -
1281 (offsetof(struct ipr_hostrcb_error, u) +
1282 offsetof(struct ipr_hostrcb_type_07_error, data)));
1283}
1284
1285/**
1286 * ipr_log_generic_error - Log an adapter error.
1287 * @ioa_cfg: ioa config struct
1288 * @hostrcb: hostrcb struct
1289 *
1290 * Return value:
1291 * none
1292 **/
1293static void ipr_log_generic_error(struct ipr_ioa_cfg *ioa_cfg,
1294 struct ipr_hostrcb *hostrcb)
1295{
1296 ipr_log_hex_data(hostrcb->hcam.u.raw.data,
1297 be32_to_cpu(hostrcb->hcam.length));
1298}
1299
1300/**
1105 * ipr_get_error - Find the specfied IOASC in the ipr_error_table. 1301 * ipr_get_error - Find the specfied IOASC in the ipr_error_table.
1106 * @ioasc: IOASC 1302 * @ioasc: IOASC
1107 * 1303 *
@@ -1172,11 +1368,10 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
1172 1368
1173 if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL) 1369 if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL)
1174 return; 1370 return;
1371 if (be32_to_cpu(hostrcb->hcam.length) > sizeof(hostrcb->hcam.u.raw))
1372 hostrcb->hcam.length = cpu_to_be32(sizeof(hostrcb->hcam.u.raw));
1175 1373
1176 switch (hostrcb->hcam.overlay_id) { 1374 switch (hostrcb->hcam.overlay_id) {
1177 case IPR_HOST_RCB_OVERLAY_ID_1:
1178 ipr_log_generic_error(ioa_cfg, hostrcb);
1179 break;
1180 case IPR_HOST_RCB_OVERLAY_ID_2: 1375 case IPR_HOST_RCB_OVERLAY_ID_2:
1181 ipr_log_cache_error(ioa_cfg, hostrcb); 1376 ipr_log_cache_error(ioa_cfg, hostrcb);
1182 break; 1377 break;
@@ -1187,13 +1382,26 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
1187 case IPR_HOST_RCB_OVERLAY_ID_6: 1382 case IPR_HOST_RCB_OVERLAY_ID_6:
1188 ipr_log_array_error(ioa_cfg, hostrcb); 1383 ipr_log_array_error(ioa_cfg, hostrcb);
1189 break; 1384 break;
1190 case IPR_HOST_RCB_OVERLAY_ID_DEFAULT: 1385 case IPR_HOST_RCB_OVERLAY_ID_7:
1191 ipr_log_generic_error(ioa_cfg, hostrcb); 1386 ipr_log_dual_ioa_error(ioa_cfg, hostrcb);
1387 break;
1388 case IPR_HOST_RCB_OVERLAY_ID_12:
1389 ipr_log_enhanced_cache_error(ioa_cfg, hostrcb);
1390 break;
1391 case IPR_HOST_RCB_OVERLAY_ID_13:
1392 ipr_log_enhanced_config_error(ioa_cfg, hostrcb);
1393 break;
1394 case IPR_HOST_RCB_OVERLAY_ID_14:
1395 case IPR_HOST_RCB_OVERLAY_ID_16:
1396 ipr_log_enhanced_array_error(ioa_cfg, hostrcb);
1192 break; 1397 break;
1398 case IPR_HOST_RCB_OVERLAY_ID_17:
1399 ipr_log_enhanced_dual_ioa_error(ioa_cfg, hostrcb);
1400 break;
1401 case IPR_HOST_RCB_OVERLAY_ID_1:
1402 case IPR_HOST_RCB_OVERLAY_ID_DEFAULT:
1193 default: 1403 default:
1194 dev_err(&ioa_cfg->pdev->dev, 1404 ipr_log_generic_error(ioa_cfg, hostrcb);
1195 "Unknown error received. Overlay ID: %d\n",
1196 hostrcb->hcam.overlay_id);
1197 break; 1405 break;
1198 } 1406 }
1199} 1407}
@@ -1972,6 +2180,103 @@ static struct bin_attribute ipr_trace_attr = {
1972}; 2180};
1973#endif 2181#endif
1974 2182
2183static const struct {
2184 enum ipr_cache_state state;
2185 char *name;
2186} cache_state [] = {
2187 { CACHE_NONE, "none" },
2188 { CACHE_DISABLED, "disabled" },
2189 { CACHE_ENABLED, "enabled" }
2190};
2191
2192/**
2193 * ipr_show_write_caching - Show the write caching attribute
2194 * @class_dev: class device struct
2195 * @buf: buffer
2196 *
2197 * Return value:
2198 * number of bytes printed to buffer
2199 **/
2200static ssize_t ipr_show_write_caching(struct class_device *class_dev, char *buf)
2201{
2202 struct Scsi_Host *shost = class_to_shost(class_dev);
2203 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
2204 unsigned long lock_flags = 0;
2205 int i, len = 0;
2206
2207 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2208 for (i = 0; i < ARRAY_SIZE(cache_state); i++) {
2209 if (cache_state[i].state == ioa_cfg->cache_state) {
2210 len = snprintf(buf, PAGE_SIZE, "%s\n", cache_state[i].name);
2211 break;
2212 }
2213 }
2214 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2215 return len;
2216}
2217
2218
2219/**
2220 * ipr_store_write_caching - Enable/disable adapter write cache
2221 * @class_dev: class_device struct
2222 * @buf: buffer
2223 * @count: buffer size
2224 *
2225 * This function will enable/disable adapter write cache.
2226 *
2227 * Return value:
2228 * count on success / other on failure
2229 **/
2230static ssize_t ipr_store_write_caching(struct class_device *class_dev,
2231 const char *buf, size_t count)
2232{
2233 struct Scsi_Host *shost = class_to_shost(class_dev);
2234 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
2235 unsigned long lock_flags = 0;
2236 enum ipr_cache_state new_state = CACHE_INVALID;
2237 int i;
2238
2239 if (!capable(CAP_SYS_ADMIN))
2240 return -EACCES;
2241 if (ioa_cfg->cache_state == CACHE_NONE)
2242 return -EINVAL;
2243
2244 for (i = 0; i < ARRAY_SIZE(cache_state); i++) {
2245 if (!strncmp(cache_state[i].name, buf, strlen(cache_state[i].name))) {
2246 new_state = cache_state[i].state;
2247 break;
2248 }
2249 }
2250
2251 if (new_state != CACHE_DISABLED && new_state != CACHE_ENABLED)
2252 return -EINVAL;
2253
2254 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2255 if (ioa_cfg->cache_state == new_state) {
2256 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2257 return count;
2258 }
2259
2260 ioa_cfg->cache_state = new_state;
2261 dev_info(&ioa_cfg->pdev->dev, "%s adapter write cache.\n",
2262 new_state == CACHE_ENABLED ? "Enabling" : "Disabling");
2263 if (!ioa_cfg->in_reset_reload)
2264 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL);
2265 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2266 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
2267
2268 return count;
2269}
2270
2271static struct class_device_attribute ipr_ioa_cache_attr = {
2272 .attr = {
2273 .name = "write_cache",
2274 .mode = S_IRUGO | S_IWUSR,
2275 },
2276 .show = ipr_show_write_caching,
2277 .store = ipr_store_write_caching
2278};
2279
1975/** 2280/**
1976 * ipr_show_fw_version - Show the firmware version 2281 * ipr_show_fw_version - Show the firmware version
1977 * @class_dev: class device struct 2282 * @class_dev: class device struct
@@ -2112,6 +2417,74 @@ static struct class_device_attribute ipr_diagnostics_attr = {
2112}; 2417};
2113 2418
2114/** 2419/**
2420 * ipr_show_adapter_state - Show the adapter's state
2421 * @class_dev: class device struct
2422 * @buf: buffer
2423 *
2424 * Return value:
2425 * number of bytes printed to buffer
2426 **/
2427static ssize_t ipr_show_adapter_state(struct class_device *class_dev, char *buf)
2428{
2429 struct Scsi_Host *shost = class_to_shost(class_dev);
2430 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
2431 unsigned long lock_flags = 0;
2432 int len;
2433
2434 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2435 if (ioa_cfg->ioa_is_dead)
2436 len = snprintf(buf, PAGE_SIZE, "offline\n");
2437 else
2438 len = snprintf(buf, PAGE_SIZE, "online\n");
2439 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2440 return len;
2441}
2442
2443/**
2444 * ipr_store_adapter_state - Change adapter state
2445 * @class_dev: class_device struct
2446 * @buf: buffer
2447 * @count: buffer size
2448 *
2449 * This function will change the adapter's state.
2450 *
2451 * Return value:
2452 * count on success / other on failure
2453 **/
2454static ssize_t ipr_store_adapter_state(struct class_device *class_dev,
2455 const char *buf, size_t count)
2456{
2457 struct Scsi_Host *shost = class_to_shost(class_dev);
2458 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
2459 unsigned long lock_flags;
2460 int result = count;
2461
2462 if (!capable(CAP_SYS_ADMIN))
2463 return -EACCES;
2464
2465 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2466 if (ioa_cfg->ioa_is_dead && !strncmp(buf, "online", 6)) {
2467 ioa_cfg->ioa_is_dead = 0;
2468 ioa_cfg->reset_retries = 0;
2469 ioa_cfg->in_ioa_bringdown = 0;
2470 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
2471 }
2472 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2473 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
2474
2475 return result;
2476}
2477
2478static struct class_device_attribute ipr_ioa_state_attr = {
2479 .attr = {
2480 .name = "state",
2481 .mode = S_IRUGO | S_IWUSR,
2482 },
2483 .show = ipr_show_adapter_state,
2484 .store = ipr_store_adapter_state
2485};
2486
2487/**
2115 * ipr_store_reset_adapter - Reset the adapter 2488 * ipr_store_reset_adapter - Reset the adapter
2116 * @class_dev: class_device struct 2489 * @class_dev: class_device struct
2117 * @buf: buffer 2490 * @buf: buffer
@@ -2183,7 +2556,7 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len)
2183 num_elem = buf_len / bsize_elem; 2556 num_elem = buf_len / bsize_elem;
2184 2557
2185 /* Allocate a scatter/gather list for the DMA */ 2558 /* Allocate a scatter/gather list for the DMA */
2186 sglist = kmalloc(sizeof(struct ipr_sglist) + 2559 sglist = kzalloc(sizeof(struct ipr_sglist) +
2187 (sizeof(struct scatterlist) * (num_elem - 1)), 2560 (sizeof(struct scatterlist) * (num_elem - 1)),
2188 GFP_KERNEL); 2561 GFP_KERNEL);
2189 2562
@@ -2192,9 +2565,6 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len)
2192 return NULL; 2565 return NULL;
2193 } 2566 }
2194 2567
2195 memset(sglist, 0, sizeof(struct ipr_sglist) +
2196 (sizeof(struct scatterlist) * (num_elem - 1)));
2197
2198 scatterlist = sglist->scatterlist; 2568 scatterlist = sglist->scatterlist;
2199 2569
2200 sglist->order = order; 2570 sglist->order = order;
@@ -2289,31 +2659,24 @@ static int ipr_copy_ucode_buffer(struct ipr_sglist *sglist,
2289} 2659}
2290 2660
2291/** 2661/**
2292 * ipr_map_ucode_buffer - Map a microcode download buffer 2662 * ipr_build_ucode_ioadl - Build a microcode download IOADL
2293 * @ipr_cmd: ipr command struct 2663 * @ipr_cmd: ipr command struct
2294 * @sglist: scatter/gather list 2664 * @sglist: scatter/gather list
2295 * @len: total length of download buffer
2296 * 2665 *
2297 * Maps a microcode download scatter/gather list for DMA and 2666 * Builds a microcode download IOA data list (IOADL).
2298 * builds the IOADL.
2299 * 2667 *
2300 * Return value:
2301 * 0 on success / -EIO on failure
2302 **/ 2668 **/
2303static int ipr_map_ucode_buffer(struct ipr_cmnd *ipr_cmd, 2669static void ipr_build_ucode_ioadl(struct ipr_cmnd *ipr_cmd,
2304 struct ipr_sglist *sglist, int len) 2670 struct ipr_sglist *sglist)
2305{ 2671{
2306 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
2307 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 2672 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
2308 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 2673 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
2309 struct scatterlist *scatterlist = sglist->scatterlist; 2674 struct scatterlist *scatterlist = sglist->scatterlist;
2310 int i; 2675 int i;
2311 2676
2312 ipr_cmd->dma_use_sg = pci_map_sg(ioa_cfg->pdev, scatterlist, 2677 ipr_cmd->dma_use_sg = sglist->num_dma_sg;
2313 sglist->num_sg, DMA_TO_DEVICE);
2314
2315 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ; 2678 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ;
2316 ioarcb->write_data_transfer_length = cpu_to_be32(len); 2679 ioarcb->write_data_transfer_length = cpu_to_be32(sglist->buffer_len);
2317 ioarcb->write_ioadl_len = 2680 ioarcb->write_ioadl_len =
2318 cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg); 2681 cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg);
2319 2682
@@ -2324,15 +2687,52 @@ static int ipr_map_ucode_buffer(struct ipr_cmnd *ipr_cmd,
2324 cpu_to_be32(sg_dma_address(&scatterlist[i])); 2687 cpu_to_be32(sg_dma_address(&scatterlist[i]));
2325 } 2688 }
2326 2689
2327 if (likely(ipr_cmd->dma_use_sg)) { 2690 ioadl[i-1].flags_and_data_len |=
2328 ioadl[i-1].flags_and_data_len |= 2691 cpu_to_be32(IPR_IOADL_FLAGS_LAST);
2329 cpu_to_be32(IPR_IOADL_FLAGS_LAST); 2692}
2693
2694/**
2695 * ipr_update_ioa_ucode - Update IOA's microcode
2696 * @ioa_cfg: ioa config struct
2697 * @sglist: scatter/gather list
2698 *
2699 * Initiate an adapter reset to update the IOA's microcode
2700 *
2701 * Return value:
2702 * 0 on success / -EIO on failure
2703 **/
2704static int ipr_update_ioa_ucode(struct ipr_ioa_cfg *ioa_cfg,
2705 struct ipr_sglist *sglist)
2706{
2707 unsigned long lock_flags;
2708
2709 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2710
2711 if (ioa_cfg->ucode_sglist) {
2712 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2713 dev_err(&ioa_cfg->pdev->dev,
2714 "Microcode download already in progress\n");
2715 return -EIO;
2330 } 2716 }
2331 else { 2717
2332 dev_err(&ioa_cfg->pdev->dev, "pci_map_sg failed!\n"); 2718 sglist->num_dma_sg = pci_map_sg(ioa_cfg->pdev, sglist->scatterlist,
2719 sglist->num_sg, DMA_TO_DEVICE);
2720
2721 if (!sglist->num_dma_sg) {
2722 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2723 dev_err(&ioa_cfg->pdev->dev,
2724 "Failed to map microcode download buffer!\n");
2333 return -EIO; 2725 return -EIO;
2334 } 2726 }
2335 2727
2728 ioa_cfg->ucode_sglist = sglist;
2729 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL);
2730 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2731 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
2732
2733 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2734 ioa_cfg->ucode_sglist = NULL;
2735 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2336 return 0; 2736 return 0;
2337} 2737}
2338 2738
@@ -2355,7 +2755,6 @@ static ssize_t ipr_store_update_fw(struct class_device *class_dev,
2355 struct ipr_ucode_image_header *image_hdr; 2755 struct ipr_ucode_image_header *image_hdr;
2356 const struct firmware *fw_entry; 2756 const struct firmware *fw_entry;
2357 struct ipr_sglist *sglist; 2757 struct ipr_sglist *sglist;
2358 unsigned long lock_flags;
2359 char fname[100]; 2758 char fname[100];
2360 char *src; 2759 char *src;
2361 int len, result, dnld_size; 2760 int len, result, dnld_size;
@@ -2396,35 +2795,17 @@ static ssize_t ipr_store_update_fw(struct class_device *class_dev,
2396 if (result) { 2795 if (result) {
2397 dev_err(&ioa_cfg->pdev->dev, 2796 dev_err(&ioa_cfg->pdev->dev,
2398 "Microcode buffer copy to DMA buffer failed\n"); 2797 "Microcode buffer copy to DMA buffer failed\n");
2399 ipr_free_ucode_buffer(sglist); 2798 goto out;
2400 release_firmware(fw_entry);
2401 return result;
2402 }
2403
2404 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2405
2406 if (ioa_cfg->ucode_sglist) {
2407 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2408 dev_err(&ioa_cfg->pdev->dev,
2409 "Microcode download already in progress\n");
2410 ipr_free_ucode_buffer(sglist);
2411 release_firmware(fw_entry);
2412 return -EIO;
2413 } 2799 }
2414 2800
2415 ioa_cfg->ucode_sglist = sglist; 2801 result = ipr_update_ioa_ucode(ioa_cfg, sglist);
2416 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL);
2417 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2418 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
2419
2420 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
2421 ioa_cfg->ucode_sglist = NULL;
2422 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2423 2802
2803 if (!result)
2804 result = count;
2805out:
2424 ipr_free_ucode_buffer(sglist); 2806 ipr_free_ucode_buffer(sglist);
2425 release_firmware(fw_entry); 2807 release_firmware(fw_entry);
2426 2808 return result;
2427 return count;
2428} 2809}
2429 2810
2430static struct class_device_attribute ipr_update_fw_attr = { 2811static struct class_device_attribute ipr_update_fw_attr = {
@@ -2439,8 +2820,10 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
2439 &ipr_fw_version_attr, 2820 &ipr_fw_version_attr,
2440 &ipr_log_level_attr, 2821 &ipr_log_level_attr,
2441 &ipr_diagnostics_attr, 2822 &ipr_diagnostics_attr,
2823 &ipr_ioa_state_attr,
2442 &ipr_ioa_reset_attr, 2824 &ipr_ioa_reset_attr,
2443 &ipr_update_fw_attr, 2825 &ipr_update_fw_attr,
2826 &ipr_ioa_cache_attr,
2444 NULL, 2827 NULL,
2445}; 2828};
2446 2829
@@ -2548,14 +2931,13 @@ static int ipr_alloc_dump(struct ipr_ioa_cfg *ioa_cfg)
2548 unsigned long lock_flags = 0; 2931 unsigned long lock_flags = 0;
2549 2932
2550 ENTER; 2933 ENTER;
2551 dump = kmalloc(sizeof(struct ipr_dump), GFP_KERNEL); 2934 dump = kzalloc(sizeof(struct ipr_dump), GFP_KERNEL);
2552 2935
2553 if (!dump) { 2936 if (!dump) {
2554 ipr_err("Dump memory allocation failed\n"); 2937 ipr_err("Dump memory allocation failed\n");
2555 return -ENOMEM; 2938 return -ENOMEM;
2556 } 2939 }
2557 2940
2558 memset(dump, 0, sizeof(struct ipr_dump));
2559 kref_init(&dump->kref); 2941 kref_init(&dump->kref);
2560 dump->ioa_cfg = ioa_cfg; 2942 dump->ioa_cfg = ioa_cfg;
2561 2943
@@ -2824,8 +3206,10 @@ static int ipr_slave_configure(struct scsi_device *sdev)
2824 if (res) { 3206 if (res) {
2825 if (ipr_is_af_dasd_device(res)) 3207 if (ipr_is_af_dasd_device(res))
2826 sdev->type = TYPE_RAID; 3208 sdev->type = TYPE_RAID;
2827 if (ipr_is_af_dasd_device(res) || ipr_is_ioa_resource(res)) 3209 if (ipr_is_af_dasd_device(res) || ipr_is_ioa_resource(res)) {
2828 sdev->scsi_level = 4; 3210 sdev->scsi_level = 4;
3211 sdev->no_uld_attach = 1;
3212 }
2829 if (ipr_is_vset_device(res)) { 3213 if (ipr_is_vset_device(res)) {
2830 sdev->timeout = IPR_VSET_RW_TIMEOUT; 3214 sdev->timeout = IPR_VSET_RW_TIMEOUT;
2831 blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS); 3215 blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
@@ -2848,13 +3232,14 @@ static int ipr_slave_configure(struct scsi_device *sdev)
2848 * handling new commands. 3232 * handling new commands.
2849 * 3233 *
2850 * Return value: 3234 * Return value:
2851 * 0 on success 3235 * 0 on success / -ENXIO if device does not exist
2852 **/ 3236 **/
2853static int ipr_slave_alloc(struct scsi_device *sdev) 3237static int ipr_slave_alloc(struct scsi_device *sdev)
2854{ 3238{
2855 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata; 3239 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
2856 struct ipr_resource_entry *res; 3240 struct ipr_resource_entry *res;
2857 unsigned long lock_flags; 3241 unsigned long lock_flags;
3242 int rc = -ENXIO;
2858 3243
2859 sdev->hostdata = NULL; 3244 sdev->hostdata = NULL;
2860 3245
@@ -2868,14 +3253,16 @@ static int ipr_slave_alloc(struct scsi_device *sdev)
2868 res->add_to_ml = 0; 3253 res->add_to_ml = 0;
2869 res->in_erp = 0; 3254 res->in_erp = 0;
2870 sdev->hostdata = res; 3255 sdev->hostdata = res;
2871 res->needs_sync_complete = 1; 3256 if (!ipr_is_naca_model(res))
3257 res->needs_sync_complete = 1;
3258 rc = 0;
2872 break; 3259 break;
2873 } 3260 }
2874 } 3261 }
2875 3262
2876 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 3263 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2877 3264
2878 return 0; 3265 return rc;
2879} 3266}
2880 3267
2881/** 3268/**
@@ -2939,7 +3326,7 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
2939 ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; 3326 ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
2940 res = scsi_cmd->device->hostdata; 3327 res = scsi_cmd->device->hostdata;
2941 3328
2942 if (!res || (!ipr_is_gscsi(res) && !ipr_is_vset_device(res))) 3329 if (!res)
2943 return FAILED; 3330 return FAILED;
2944 3331
2945 /* 3332 /*
@@ -3131,7 +3518,8 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd)
3131 } 3518 }
3132 3519
3133 list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q); 3520 list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
3134 res->needs_sync_complete = 1; 3521 if (!ipr_is_naca_model(res))
3522 res->needs_sync_complete = 1;
3135 3523
3136 LEAVE; 3524 LEAVE;
3137 return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS); 3525 return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS);
@@ -3435,7 +3823,8 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
3435 } 3823 }
3436 3824
3437 if (res) { 3825 if (res) {
3438 res->needs_sync_complete = 1; 3826 if (!ipr_is_naca_model(res))
3827 res->needs_sync_complete = 1;
3439 res->in_erp = 0; 3828 res->in_erp = 0;
3440 } 3829 }
3441 ipr_unmap_sglist(ioa_cfg, ipr_cmd); 3830 ipr_unmap_sglist(ioa_cfg, ipr_cmd);
@@ -3705,6 +4094,30 @@ static void ipr_gen_sense(struct ipr_cmnd *ipr_cmd)
3705} 4094}
3706 4095
3707/** 4096/**
4097 * ipr_get_autosense - Copy autosense data to sense buffer
4098 * @ipr_cmd: ipr command struct
4099 *
4100 * This function copies the autosense buffer to the buffer
4101 * in the scsi_cmd, if there is autosense available.
4102 *
4103 * Return value:
4104 * 1 if autosense was available / 0 if not
4105 **/
4106static int ipr_get_autosense(struct ipr_cmnd *ipr_cmd)
4107{
4108 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
4109
4110 if ((be32_to_cpu(ioasa->ioasc_specific) &
4111 (IPR_ADDITIONAL_STATUS_FMT | IPR_AUTOSENSE_VALID)) == 0)
4112 return 0;
4113
4114 memcpy(ipr_cmd->scsi_cmd->sense_buffer, ioasa->auto_sense.data,
4115 min_t(u16, be16_to_cpu(ioasa->auto_sense.auto_sense_len),
4116 SCSI_SENSE_BUFFERSIZE));
4117 return 1;
4118}
4119
4120/**
3708 * ipr_erp_start - Process an error response for a SCSI op 4121 * ipr_erp_start - Process an error response for a SCSI op
3709 * @ioa_cfg: ioa config struct 4122 * @ioa_cfg: ioa config struct
3710 * @ipr_cmd: ipr command struct 4123 * @ipr_cmd: ipr command struct
@@ -3734,14 +4147,19 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
3734 4147
3735 switch (ioasc & IPR_IOASC_IOASC_MASK) { 4148 switch (ioasc & IPR_IOASC_IOASC_MASK) {
3736 case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST: 4149 case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST:
3737 scsi_cmd->result |= (DID_IMM_RETRY << 16); 4150 if (ipr_is_naca_model(res))
4151 scsi_cmd->result |= (DID_ABORT << 16);
4152 else
4153 scsi_cmd->result |= (DID_IMM_RETRY << 16);
3738 break; 4154 break;
3739 case IPR_IOASC_IR_RESOURCE_HANDLE: 4155 case IPR_IOASC_IR_RESOURCE_HANDLE:
4156 case IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA:
3740 scsi_cmd->result |= (DID_NO_CONNECT << 16); 4157 scsi_cmd->result |= (DID_NO_CONNECT << 16);
3741 break; 4158 break;
3742 case IPR_IOASC_HW_SEL_TIMEOUT: 4159 case IPR_IOASC_HW_SEL_TIMEOUT:
3743 scsi_cmd->result |= (DID_NO_CONNECT << 16); 4160 scsi_cmd->result |= (DID_NO_CONNECT << 16);
3744 res->needs_sync_complete = 1; 4161 if (!ipr_is_naca_model(res))
4162 res->needs_sync_complete = 1;
3745 break; 4163 break;
3746 case IPR_IOASC_SYNC_REQUIRED: 4164 case IPR_IOASC_SYNC_REQUIRED:
3747 if (!res->in_erp) 4165 if (!res->in_erp)
@@ -3749,6 +4167,7 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
3749 scsi_cmd->result |= (DID_IMM_RETRY << 16); 4167 scsi_cmd->result |= (DID_IMM_RETRY << 16);
3750 break; 4168 break;
3751 case IPR_IOASC_MED_DO_NOT_REALLOC: /* prevent retries */ 4169 case IPR_IOASC_MED_DO_NOT_REALLOC: /* prevent retries */
4170 case IPR_IOASA_IR_DUAL_IOA_DISABLED:
3752 scsi_cmd->result |= (DID_PASSTHROUGH << 16); 4171 scsi_cmd->result |= (DID_PASSTHROUGH << 16);
3753 break; 4172 break;
3754 case IPR_IOASC_BUS_WAS_RESET: 4173 case IPR_IOASC_BUS_WAS_RESET:
@@ -3760,21 +4179,27 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
3760 if (!res->resetting_device) 4179 if (!res->resetting_device)
3761 scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel); 4180 scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel);
3762 scsi_cmd->result |= (DID_ERROR << 16); 4181 scsi_cmd->result |= (DID_ERROR << 16);
3763 res->needs_sync_complete = 1; 4182 if (!ipr_is_naca_model(res))
4183 res->needs_sync_complete = 1;
3764 break; 4184 break;
3765 case IPR_IOASC_HW_DEV_BUS_STATUS: 4185 case IPR_IOASC_HW_DEV_BUS_STATUS:
3766 scsi_cmd->result |= IPR_IOASC_SENSE_STATUS(ioasc); 4186 scsi_cmd->result |= IPR_IOASC_SENSE_STATUS(ioasc);
3767 if (IPR_IOASC_SENSE_STATUS(ioasc) == SAM_STAT_CHECK_CONDITION) { 4187 if (IPR_IOASC_SENSE_STATUS(ioasc) == SAM_STAT_CHECK_CONDITION) {
3768 ipr_erp_cancel_all(ipr_cmd); 4188 if (!ipr_get_autosense(ipr_cmd)) {
3769 return; 4189 if (!ipr_is_naca_model(res)) {
4190 ipr_erp_cancel_all(ipr_cmd);
4191 return;
4192 }
4193 }
3770 } 4194 }
3771 res->needs_sync_complete = 1; 4195 if (!ipr_is_naca_model(res))
4196 res->needs_sync_complete = 1;
3772 break; 4197 break;
3773 case IPR_IOASC_NR_INIT_CMD_REQUIRED: 4198 case IPR_IOASC_NR_INIT_CMD_REQUIRED:
3774 break; 4199 break;
3775 default: 4200 default:
3776 scsi_cmd->result |= (DID_ERROR << 16); 4201 scsi_cmd->result |= (DID_ERROR << 16);
3777 if (!ipr_is_vset_device(res)) 4202 if (!ipr_is_vset_device(res) && !ipr_is_naca_model(res))
3778 res->needs_sync_complete = 1; 4203 res->needs_sync_complete = 1;
3779 break; 4204 break;
3780 } 4205 }
@@ -4073,6 +4498,7 @@ static int ipr_ioa_reset_done(struct ipr_cmnd *ipr_cmd)
4073 ioa_cfg->in_reset_reload = 0; 4498 ioa_cfg->in_reset_reload = 0;
4074 ioa_cfg->allow_cmds = 1; 4499 ioa_cfg->allow_cmds = 1;
4075 ioa_cfg->reset_cmd = NULL; 4500 ioa_cfg->reset_cmd = NULL;
4501 ioa_cfg->doorbell |= IPR_RUNTIME_RESET;
4076 4502
4077 list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { 4503 list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
4078 if (ioa_cfg->allow_ml_add_del && (res->add_to_ml || res->del_from_ml)) { 4504 if (ioa_cfg->allow_ml_add_del && (res->add_to_ml || res->del_from_ml)) {
@@ -4146,7 +4572,7 @@ static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd)
4146 ipr_cmd->job_step = ipr_ioa_reset_done; 4572 ipr_cmd->job_step = ipr_ioa_reset_done;
4147 4573
4148 list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) { 4574 list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) {
4149 if (!ipr_is_af_dasd_device(res)) 4575 if (!IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data))
4150 continue; 4576 continue;
4151 4577
4152 ipr_cmd->u.res = res; 4578 ipr_cmd->u.res = res;
@@ -4179,6 +4605,36 @@ static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd)
4179} 4605}
4180 4606
4181/** 4607/**
4608 * ipr_setup_write_cache - Disable write cache if needed
4609 * @ipr_cmd: ipr command struct
4610 *
4611 * This function sets up adapters write cache to desired setting
4612 *
4613 * Return value:
4614 * IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
4615 **/
4616static int ipr_setup_write_cache(struct ipr_cmnd *ipr_cmd)
4617{
4618 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
4619
4620 ipr_cmd->job_step = ipr_set_supported_devs;
4621 ipr_cmd->u.res = list_entry(ioa_cfg->used_res_q.next,
4622 struct ipr_resource_entry, queue);
4623
4624 if (ioa_cfg->cache_state != CACHE_DISABLED)
4625 return IPR_RC_JOB_CONTINUE;
4626
4627 ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
4628 ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
4629 ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN;
4630 ipr_cmd->ioarcb.cmd_pkt.cdb[1] = IPR_SHUTDOWN_PREPARE_FOR_NORMAL;
4631
4632 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
4633
4634 return IPR_RC_JOB_RETURN;
4635}
4636
4637/**
4182 * ipr_get_mode_page - Locate specified mode page 4638 * ipr_get_mode_page - Locate specified mode page
4183 * @mode_pages: mode page buffer 4639 * @mode_pages: mode page buffer
4184 * @page_code: page code to find 4640 * @page_code: page code to find
@@ -4389,10 +4845,7 @@ static int ipr_ioafp_mode_select_page28(struct ipr_cmnd *ipr_cmd)
4389 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), 4845 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages),
4390 length); 4846 length);
4391 4847
4392 ipr_cmd->job_step = ipr_set_supported_devs; 4848 ipr_cmd->job_step = ipr_setup_write_cache;
4393 ipr_cmd->u.res = list_entry(ioa_cfg->used_res_q.next,
4394 struct ipr_resource_entry, queue);
4395
4396 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); 4849 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
4397 4850
4398 LEAVE; 4851 LEAVE;
@@ -4431,6 +4884,51 @@ static void ipr_build_mode_sense(struct ipr_cmnd *ipr_cmd,
4431} 4884}
4432 4885
4433/** 4886/**
4887 * ipr_reset_cmd_failed - Handle failure of IOA reset command
4888 * @ipr_cmd: ipr command struct
4889 *
4890 * This function handles the failure of an IOA bringup command.
4891 *
4892 * Return value:
4893 * IPR_RC_JOB_RETURN
4894 **/
4895static int ipr_reset_cmd_failed(struct ipr_cmnd *ipr_cmd)
4896{
4897 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
4898 u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
4899
4900 dev_err(&ioa_cfg->pdev->dev,
4901 "0x%02X failed with IOASC: 0x%08X\n",
4902 ipr_cmd->ioarcb.cmd_pkt.cdb[0], ioasc);
4903
4904 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
4905 list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
4906 return IPR_RC_JOB_RETURN;
4907}
4908
4909/**
4910 * ipr_reset_mode_sense_failed - Handle failure of IOAFP mode sense
4911 * @ipr_cmd: ipr command struct
4912 *
4913 * This function handles the failure of a Mode Sense to the IOAFP.
4914 * Some adapters do not handle all mode pages.
4915 *
4916 * Return value:
4917 * IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
4918 **/
4919static int ipr_reset_mode_sense_failed(struct ipr_cmnd *ipr_cmd)
4920{
4921 u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
4922
4923 if (ioasc == IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT) {
4924 ipr_cmd->job_step = ipr_setup_write_cache;
4925 return IPR_RC_JOB_CONTINUE;
4926 }
4927
4928 return ipr_reset_cmd_failed(ipr_cmd);
4929}
4930
4931/**
4434 * ipr_ioafp_mode_sense_page28 - Issue Mode Sense Page 28 to IOA 4932 * ipr_ioafp_mode_sense_page28 - Issue Mode Sense Page 28 to IOA
4435 * @ipr_cmd: ipr command struct 4933 * @ipr_cmd: ipr command struct
4436 * 4934 *
@@ -4451,6 +4949,7 @@ static int ipr_ioafp_mode_sense_page28(struct ipr_cmnd *ipr_cmd)
4451 sizeof(struct ipr_mode_pages)); 4949 sizeof(struct ipr_mode_pages));
4452 4950
4453 ipr_cmd->job_step = ipr_ioafp_mode_select_page28; 4951 ipr_cmd->job_step = ipr_ioafp_mode_select_page28;
4952 ipr_cmd->job_step_failed = ipr_reset_mode_sense_failed;
4454 4953
4455 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); 4954 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
4456 4955
@@ -4612,6 +5111,27 @@ static void ipr_ioafp_inquiry(struct ipr_cmnd *ipr_cmd, u8 flags, u8 page,
4612} 5111}
4613 5112
4614/** 5113/**
5114 * ipr_inquiry_page_supported - Is the given inquiry page supported
5115 * @page0: inquiry page 0 buffer
5116 * @page: page code.
5117 *
5118 * This function determines if the specified inquiry page is supported.
5119 *
5120 * Return value:
5121 * 1 if page is supported / 0 if not
5122 **/
5123static int ipr_inquiry_page_supported(struct ipr_inquiry_page0 *page0, u8 page)
5124{
5125 int i;
5126
5127 for (i = 0; i < min_t(u8, page0->len, IPR_INQUIRY_PAGE0_ENTRIES); i++)
5128 if (page0->page[i] == page)
5129 return 1;
5130
5131 return 0;
5132}
5133
5134/**
4615 * ipr_ioafp_page3_inquiry - Send a Page 3 Inquiry to the adapter. 5135 * ipr_ioafp_page3_inquiry - Send a Page 3 Inquiry to the adapter.
4616 * @ipr_cmd: ipr command struct 5136 * @ipr_cmd: ipr command struct
4617 * 5137 *
@@ -4624,6 +5144,36 @@ static void ipr_ioafp_inquiry(struct ipr_cmnd *ipr_cmd, u8 flags, u8 page,
4624static int ipr_ioafp_page3_inquiry(struct ipr_cmnd *ipr_cmd) 5144static int ipr_ioafp_page3_inquiry(struct ipr_cmnd *ipr_cmd)
4625{ 5145{
4626 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 5146 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
5147 struct ipr_inquiry_page0 *page0 = &ioa_cfg->vpd_cbs->page0_data;
5148
5149 ENTER;
5150
5151 if (!ipr_inquiry_page_supported(page0, 1))
5152 ioa_cfg->cache_state = CACHE_NONE;
5153
5154 ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg;
5155
5156 ipr_ioafp_inquiry(ipr_cmd, 1, 3,
5157 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, page3_data),
5158 sizeof(struct ipr_inquiry_page3));
5159
5160 LEAVE;
5161 return IPR_RC_JOB_RETURN;
5162}
5163
5164/**
5165 * ipr_ioafp_page0_inquiry - Send a Page 0 Inquiry to the adapter.
5166 * @ipr_cmd: ipr command struct
5167 *
5168 * This function sends a Page 0 inquiry to the adapter
5169 * to retrieve supported inquiry pages.
5170 *
5171 * Return value:
5172 * IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
5173 **/
5174static int ipr_ioafp_page0_inquiry(struct ipr_cmnd *ipr_cmd)
5175{
5176 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
4627 char type[5]; 5177 char type[5];
4628 5178
4629 ENTER; 5179 ENTER;
@@ -4633,11 +5183,11 @@ static int ipr_ioafp_page3_inquiry(struct ipr_cmnd *ipr_cmd)
4633 type[4] = '\0'; 5183 type[4] = '\0';
4634 ioa_cfg->type = simple_strtoul((char *)type, NULL, 16); 5184 ioa_cfg->type = simple_strtoul((char *)type, NULL, 16);
4635 5185
4636 ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; 5186 ipr_cmd->job_step = ipr_ioafp_page3_inquiry;
4637 5187
4638 ipr_ioafp_inquiry(ipr_cmd, 1, 3, 5188 ipr_ioafp_inquiry(ipr_cmd, 1, 0,
4639 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, page3_data), 5189 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, page0_data),
4640 sizeof(struct ipr_inquiry_page3)); 5190 sizeof(struct ipr_inquiry_page0));
4641 5191
4642 LEAVE; 5192 LEAVE;
4643 return IPR_RC_JOB_RETURN; 5193 return IPR_RC_JOB_RETURN;
@@ -4657,7 +5207,7 @@ static int ipr_ioafp_std_inquiry(struct ipr_cmnd *ipr_cmd)
4657 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 5207 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
4658 5208
4659 ENTER; 5209 ENTER;
4660 ipr_cmd->job_step = ipr_ioafp_page3_inquiry; 5210 ipr_cmd->job_step = ipr_ioafp_page0_inquiry;
4661 5211
4662 ipr_ioafp_inquiry(ipr_cmd, 0, 0, 5212 ipr_ioafp_inquiry(ipr_cmd, 0, 0,
4663 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, ioa_vpd), 5213 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, ioa_vpd),
@@ -4815,7 +5365,7 @@ static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd)
4815 } 5365 }
4816 5366
4817 /* Enable destructive diagnostics on IOA */ 5367 /* Enable destructive diagnostics on IOA */
4818 writel(IPR_DOORBELL, ioa_cfg->regs.set_uproc_interrupt_reg); 5368 writel(ioa_cfg->doorbell, ioa_cfg->regs.set_uproc_interrupt_reg);
4819 5369
4820 writel(IPR_PCII_OPER_INTERRUPTS, ioa_cfg->regs.clr_interrupt_mask_reg); 5370 writel(IPR_PCII_OPER_INTERRUPTS, ioa_cfg->regs.clr_interrupt_mask_reg);
4821 int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg); 5371 int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
@@ -5147,12 +5697,7 @@ static int ipr_reset_ucode_download(struct ipr_cmnd *ipr_cmd)
5147 ipr_cmd->ioarcb.cmd_pkt.cdb[7] = (sglist->buffer_len & 0x00ff00) >> 8; 5697 ipr_cmd->ioarcb.cmd_pkt.cdb[7] = (sglist->buffer_len & 0x00ff00) >> 8;
5148 ipr_cmd->ioarcb.cmd_pkt.cdb[8] = sglist->buffer_len & 0x0000ff; 5698 ipr_cmd->ioarcb.cmd_pkt.cdb[8] = sglist->buffer_len & 0x0000ff;
5149 5699
5150 if (ipr_map_ucode_buffer(ipr_cmd, sglist, sglist->buffer_len)) { 5700 ipr_build_ucode_ioadl(ipr_cmd, sglist);
5151 dev_err(&ioa_cfg->pdev->dev,
5152 "Failed to map microcode download buffer\n");
5153 return IPR_RC_JOB_CONTINUE;
5154 }
5155
5156 ipr_cmd->job_step = ipr_reset_ucode_download_done; 5701 ipr_cmd->job_step = ipr_reset_ucode_download_done;
5157 5702
5158 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, 5703 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout,
@@ -5217,7 +5762,6 @@ static int ipr_reset_shutdown_ioa(struct ipr_cmnd *ipr_cmd)
5217static void ipr_reset_ioa_job(struct ipr_cmnd *ipr_cmd) 5762static void ipr_reset_ioa_job(struct ipr_cmnd *ipr_cmd)
5218{ 5763{
5219 u32 rc, ioasc; 5764 u32 rc, ioasc;
5220 unsigned long scratch = ipr_cmd->u.scratch;
5221 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 5765 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
5222 5766
5223 do { 5767 do {
@@ -5233,17 +5777,13 @@ static void ipr_reset_ioa_job(struct ipr_cmnd *ipr_cmd)
5233 } 5777 }
5234 5778
5235 if (IPR_IOASC_SENSE_KEY(ioasc)) { 5779 if (IPR_IOASC_SENSE_KEY(ioasc)) {
5236 dev_err(&ioa_cfg->pdev->dev, 5780 rc = ipr_cmd->job_step_failed(ipr_cmd);
5237 "0x%02X failed with IOASC: 0x%08X\n", 5781 if (rc == IPR_RC_JOB_RETURN)
5238 ipr_cmd->ioarcb.cmd_pkt.cdb[0], ioasc); 5782 return;
5239
5240 ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
5241 list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
5242 return;
5243 } 5783 }
5244 5784
5245 ipr_reinit_ipr_cmnd(ipr_cmd); 5785 ipr_reinit_ipr_cmnd(ipr_cmd);
5246 ipr_cmd->u.scratch = scratch; 5786 ipr_cmd->job_step_failed = ipr_reset_cmd_failed;
5247 rc = ipr_cmd->job_step(ipr_cmd); 5787 rc = ipr_cmd->job_step(ipr_cmd);
5248 } while(rc == IPR_RC_JOB_CONTINUE); 5788 } while(rc == IPR_RC_JOB_CONTINUE);
5249} 5789}
@@ -5517,15 +6057,12 @@ static int __devinit ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
5517 int i, rc = -ENOMEM; 6057 int i, rc = -ENOMEM;
5518 6058
5519 ENTER; 6059 ENTER;
5520 ioa_cfg->res_entries = kmalloc(sizeof(struct ipr_resource_entry) * 6060 ioa_cfg->res_entries = kzalloc(sizeof(struct ipr_resource_entry) *
5521 IPR_MAX_PHYSICAL_DEVS, GFP_KERNEL); 6061 IPR_MAX_PHYSICAL_DEVS, GFP_KERNEL);
5522 6062
5523 if (!ioa_cfg->res_entries) 6063 if (!ioa_cfg->res_entries)
5524 goto out; 6064 goto out;
5525 6065
5526 memset(ioa_cfg->res_entries, 0,
5527 sizeof(struct ipr_resource_entry) * IPR_MAX_PHYSICAL_DEVS);
5528
5529 for (i = 0; i < IPR_MAX_PHYSICAL_DEVS; i++) 6066 for (i = 0; i < IPR_MAX_PHYSICAL_DEVS; i++)
5530 list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q); 6067 list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q);
5531 6068
@@ -5566,15 +6103,12 @@ static int __devinit ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
5566 list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q); 6103 list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q);
5567 } 6104 }
5568 6105
5569 ioa_cfg->trace = kmalloc(sizeof(struct ipr_trace_entry) * 6106 ioa_cfg->trace = kzalloc(sizeof(struct ipr_trace_entry) *
5570 IPR_NUM_TRACE_ENTRIES, GFP_KERNEL); 6107 IPR_NUM_TRACE_ENTRIES, GFP_KERNEL);
5571 6108
5572 if (!ioa_cfg->trace) 6109 if (!ioa_cfg->trace)
5573 goto out_free_hostrcb_dma; 6110 goto out_free_hostrcb_dma;
5574 6111
5575 memset(ioa_cfg->trace, 0,
5576 sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES);
5577
5578 rc = 0; 6112 rc = 0;
5579out: 6113out:
5580 LEAVE; 6114 LEAVE;
@@ -5642,6 +6176,9 @@ static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
5642 ioa_cfg->host = host; 6176 ioa_cfg->host = host;
5643 ioa_cfg->pdev = pdev; 6177 ioa_cfg->pdev = pdev;
5644 ioa_cfg->log_level = ipr_log_level; 6178 ioa_cfg->log_level = ipr_log_level;
6179 ioa_cfg->doorbell = IPR_DOORBELL;
6180 if (!ipr_auto_create)
6181 ioa_cfg->doorbell |= IPR_RUNTIME_RESET;
5645 sprintf(ioa_cfg->eye_catcher, IPR_EYECATCHER); 6182 sprintf(ioa_cfg->eye_catcher, IPR_EYECATCHER);
5646 sprintf(ioa_cfg->trace_start, IPR_TRACE_START_LABEL); 6183 sprintf(ioa_cfg->trace_start, IPR_TRACE_START_LABEL);
5647 sprintf(ioa_cfg->ipr_free_label, IPR_FREEQ_LABEL); 6184 sprintf(ioa_cfg->ipr_free_label, IPR_FREEQ_LABEL);
@@ -5660,6 +6197,10 @@ static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
5660 INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread, ioa_cfg); 6197 INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread, ioa_cfg);
5661 init_waitqueue_head(&ioa_cfg->reset_wait_q); 6198 init_waitqueue_head(&ioa_cfg->reset_wait_q);
5662 ioa_cfg->sdt_state = INACTIVE; 6199 ioa_cfg->sdt_state = INACTIVE;
6200 if (ipr_enable_cache)
6201 ioa_cfg->cache_state = CACHE_ENABLED;
6202 else
6203 ioa_cfg->cache_state = CACHE_DISABLED;
5663 6204
5664 ipr_initialize_bus_attr(ioa_cfg); 6205 ipr_initialize_bus_attr(ioa_cfg);
5665 6206
@@ -6008,6 +6549,7 @@ static int __devinit ipr_probe(struct pci_dev *pdev,
6008 ipr_scan_vsets(ioa_cfg); 6549 ipr_scan_vsets(ioa_cfg);
6009 scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, IPR_IOA_LUN); 6550 scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, IPR_IOA_LUN);
6010 ioa_cfg->allow_ml_add_del = 1; 6551 ioa_cfg->allow_ml_add_del = 1;
6552 ioa_cfg->host->max_channel = IPR_VSET_BUS;
6011 schedule_work(&ioa_cfg->work_q); 6553 schedule_work(&ioa_cfg->work_q);
6012 return 0; 6554 return 0;
6013} 6555}
@@ -6055,12 +6597,30 @@ static struct pci_device_id ipr_pci_table[] __devinitdata = {
6055 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, 6597 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
6056 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571A, 6598 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571A,
6057 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] }, 6599 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
6600 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
6601 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575B,
6602 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
6603 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
6604 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A,
6605 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
6606 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
6607 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B,
6608 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
6609 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
6610 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A,
6611 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
6612 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
6613 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B,
6614 0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
6058 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, 6615 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE,
6059 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780, 6616 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780,
6060 0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] }, 6617 0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
6061 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, 6618 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
6062 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571E, 6619 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571E,
6063 0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] }, 6620 0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
6621 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
6622 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571F,
6623 0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
6064 { } 6624 { }
6065}; 6625};
6066MODULE_DEVICE_TABLE(pci, ipr_pci_table); 6626MODULE_DEVICE_TABLE(pci, ipr_pci_table);
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 8cf967108500..6bec673c925c 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -36,23 +36,8 @@
36/* 36/*
37 * Literals 37 * Literals
38 */ 38 */
39#define IPR_DRIVER_VERSION "2.0.14" 39#define IPR_DRIVER_VERSION "2.1.0"
40#define IPR_DRIVER_DATE "(May 2, 2005)" 40#define IPR_DRIVER_DATE "(October 31, 2005)"
41
42/*
43 * IPR_DBG_TRACE: Setting this to 1 will turn on some general function tracing
44 * resulting in a bunch of extra debugging printks to the console
45 *
46 * IPR_DEBUG: Setting this to 1 will turn on some error path tracing.
47 * Enables the ipr_trace macro.
48 */
49#ifdef IPR_DEBUG_ALL
50#define IPR_DEBUG 1
51#define IPR_DBG_TRACE 1
52#else
53#define IPR_DEBUG 0
54#define IPR_DBG_TRACE 0
55#endif
56 41
57/* 42/*
58 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding 43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
@@ -76,6 +61,10 @@
76#define IPR_SUBS_DEV_ID_571A 0x02C0 61#define IPR_SUBS_DEV_ID_571A 0x02C0
77#define IPR_SUBS_DEV_ID_571B 0x02BE 62#define IPR_SUBS_DEV_ID_571B 0x02BE
78#define IPR_SUBS_DEV_ID_571E 0x02BF 63#define IPR_SUBS_DEV_ID_571E 0x02BF
64#define IPR_SUBS_DEV_ID_571F 0x02D5
65#define IPR_SUBS_DEV_ID_572A 0x02C1
66#define IPR_SUBS_DEV_ID_572B 0x02C2
67#define IPR_SUBS_DEV_ID_575B 0x030D
79 68
80#define IPR_NAME "ipr" 69#define IPR_NAME "ipr"
81 70
@@ -95,7 +84,10 @@
95#define IPR_IOASC_HW_DEV_BUS_STATUS 0x04448500 84#define IPR_IOASC_HW_DEV_BUS_STATUS 0x04448500
96#define IPR_IOASC_IOASC_MASK 0xFFFFFF00 85#define IPR_IOASC_IOASC_MASK 0xFFFFFF00
97#define IPR_IOASC_SCSI_STATUS_MASK 0x000000FF 86#define IPR_IOASC_SCSI_STATUS_MASK 0x000000FF
87#define IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT 0x05240000
98#define IPR_IOASC_IR_RESOURCE_HANDLE 0x05250000 88#define IPR_IOASC_IR_RESOURCE_HANDLE 0x05250000
89#define IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA 0x05258100
90#define IPR_IOASA_IR_DUAL_IOA_DISABLED 0x052C8000
99#define IPR_IOASC_BUS_WAS_RESET 0x06290000 91#define IPR_IOASC_BUS_WAS_RESET 0x06290000
100#define IPR_IOASC_BUS_WAS_RESET_BY_OTHER 0x06298000 92#define IPR_IOASC_BUS_WAS_RESET_BY_OTHER 0x06298000
101#define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST 0x0B5A0000 93#define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST 0x0B5A0000
@@ -107,14 +99,14 @@
107#define IPR_NUM_LOG_HCAMS 2 99#define IPR_NUM_LOG_HCAMS 2
108#define IPR_NUM_CFG_CHG_HCAMS 2 100#define IPR_NUM_CFG_CHG_HCAMS 2
109#define IPR_NUM_HCAMS (IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS) 101#define IPR_NUM_HCAMS (IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS)
110#define IPR_MAX_NUM_TARGETS_PER_BUS 0x10 102#define IPR_MAX_NUM_TARGETS_PER_BUS 256
111#define IPR_MAX_NUM_LUNS_PER_TARGET 256 103#define IPR_MAX_NUM_LUNS_PER_TARGET 256
112#define IPR_MAX_NUM_VSET_LUNS_PER_TARGET 8 104#define IPR_MAX_NUM_VSET_LUNS_PER_TARGET 8
113#define IPR_VSET_BUS 0xff 105#define IPR_VSET_BUS 0xff
114#define IPR_IOA_BUS 0xff 106#define IPR_IOA_BUS 0xff
115#define IPR_IOA_TARGET 0xff 107#define IPR_IOA_TARGET 0xff
116#define IPR_IOA_LUN 0xff 108#define IPR_IOA_LUN 0xff
117#define IPR_MAX_NUM_BUSES 4 109#define IPR_MAX_NUM_BUSES 8
118#define IPR_MAX_BUS_TO_SCAN IPR_MAX_NUM_BUSES 110#define IPR_MAX_BUS_TO_SCAN IPR_MAX_NUM_BUSES
119 111
120#define IPR_NUM_RESET_RELOAD_RETRIES 3 112#define IPR_NUM_RESET_RELOAD_RETRIES 3
@@ -205,6 +197,7 @@
205#define IPR_SDT_FMT2_EXP_ROM_SEL 0x8 197#define IPR_SDT_FMT2_EXP_ROM_SEL 0x8
206#define IPR_FMT2_SDT_READY_TO_USE 0xC4D4E3F2 198#define IPR_FMT2_SDT_READY_TO_USE 0xC4D4E3F2
207#define IPR_DOORBELL 0x82800000 199#define IPR_DOORBELL 0x82800000
200#define IPR_RUNTIME_RESET 0x40000000
208 201
209#define IPR_PCII_IOA_TRANS_TO_OPER (0x80000000 >> 0) 202#define IPR_PCII_IOA_TRANS_TO_OPER (0x80000000 >> 0)
210#define IPR_PCII_IOARCB_XFER_FAILED (0x80000000 >> 3) 203#define IPR_PCII_IOARCB_XFER_FAILED (0x80000000 >> 3)
@@ -261,6 +254,16 @@ struct ipr_std_inq_vpids {
261 u8 product_id[IPR_PROD_ID_LEN]; 254 u8 product_id[IPR_PROD_ID_LEN];
262}__attribute__((packed)); 255}__attribute__((packed));
263 256
257struct ipr_vpd {
258 struct ipr_std_inq_vpids vpids;
259 u8 sn[IPR_SERIAL_NUM_LEN];
260}__attribute__((packed));
261
262struct ipr_ext_vpd {
263 struct ipr_vpd vpd;
264 __be32 wwid[2];
265}__attribute__((packed));
266
264struct ipr_std_inq_data { 267struct ipr_std_inq_data {
265 u8 peri_qual_dev_type; 268 u8 peri_qual_dev_type;
266#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5) 269#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)
@@ -304,6 +307,10 @@ struct ipr_config_table_entry {
304#define IPR_SUBTYPE_GENERIC_SCSI 1 307#define IPR_SUBTYPE_GENERIC_SCSI 1
305#define IPR_SUBTYPE_VOLUME_SET 2 308#define IPR_SUBTYPE_VOLUME_SET 2
306 309
310#define IPR_QUEUEING_MODEL(res) ((((res)->cfgte.flags) & 0x70) >> 4)
311#define IPR_QUEUE_FROZEN_MODEL 0
312#define IPR_QUEUE_NACA_MODEL 1
313
307 struct ipr_res_addr res_addr; 314 struct ipr_res_addr res_addr;
308 __be32 res_handle; 315 __be32 res_handle;
309 __be32 reserved4[2]; 316 __be32 reserved4[2];
@@ -410,23 +417,26 @@ struct ipr_ioadl_desc {
410struct ipr_ioasa_vset { 417struct ipr_ioasa_vset {
411 __be32 failing_lba_hi; 418 __be32 failing_lba_hi;
412 __be32 failing_lba_lo; 419 __be32 failing_lba_lo;
413 __be32 ioa_data[22]; 420 __be32 reserved;
414}__attribute__((packed, aligned (4))); 421}__attribute__((packed, aligned (4)));
415 422
416struct ipr_ioasa_af_dasd { 423struct ipr_ioasa_af_dasd {
417 __be32 failing_lba; 424 __be32 failing_lba;
425 __be32 reserved[2];
418}__attribute__((packed, aligned (4))); 426}__attribute__((packed, aligned (4)));
419 427
420struct ipr_ioasa_gpdd { 428struct ipr_ioasa_gpdd {
421 u8 end_state; 429 u8 end_state;
422 u8 bus_phase; 430 u8 bus_phase;
423 __be16 reserved; 431 __be16 reserved;
424 __be32 ioa_data[23]; 432 __be32 ioa_data[2];
425}__attribute__((packed, aligned (4))); 433}__attribute__((packed, aligned (4)));
426 434
427struct ipr_ioasa_raw { 435struct ipr_auto_sense {
428 __be32 ioa_data[24]; 436 __be16 auto_sense_len;
429}__attribute__((packed, aligned (4))); 437 __be16 ioa_data_len;
438 __be32 data[SCSI_SENSE_BUFFERSIZE/sizeof(__be32)];
439};
430 440
431struct ipr_ioasa { 441struct ipr_ioasa {
432 __be32 ioasc; 442 __be32 ioasc;
@@ -453,6 +463,8 @@ struct ipr_ioasa {
453 __be32 fd_res_handle; 463 __be32 fd_res_handle;
454 464
455 __be32 ioasc_specific; /* status code specific field */ 465 __be32 ioasc_specific; /* status code specific field */
466#define IPR_ADDITIONAL_STATUS_FMT 0x80000000
467#define IPR_AUTOSENSE_VALID 0x40000000
456#define IPR_IOASC_SPECIFIC_MASK 0x00ffffff 468#define IPR_IOASC_SPECIFIC_MASK 0x00ffffff
457#define IPR_FIELD_POINTER_VALID (0x80000000 >> 8) 469#define IPR_FIELD_POINTER_VALID (0x80000000 >> 8)
458#define IPR_FIELD_POINTER_MASK 0x0000ffff 470#define IPR_FIELD_POINTER_MASK 0x0000ffff
@@ -461,8 +473,9 @@ struct ipr_ioasa {
461 struct ipr_ioasa_vset vset; 473 struct ipr_ioasa_vset vset;
462 struct ipr_ioasa_af_dasd dasd; 474 struct ipr_ioasa_af_dasd dasd;
463 struct ipr_ioasa_gpdd gpdd; 475 struct ipr_ioasa_gpdd gpdd;
464 struct ipr_ioasa_raw raw;
465 } u; 476 } u;
477
478 struct ipr_auto_sense auto_sense;
466}__attribute__((packed, aligned (4))); 479}__attribute__((packed, aligned (4)));
467 480
468struct ipr_mode_parm_hdr { 481struct ipr_mode_parm_hdr {
@@ -536,28 +549,49 @@ struct ipr_inquiry_page3 {
536 u8 patch_number[4]; 549 u8 patch_number[4];
537}__attribute__((packed)); 550}__attribute__((packed));
538 551
552#define IPR_INQUIRY_PAGE0_ENTRIES 20
553struct ipr_inquiry_page0 {
554 u8 peri_qual_dev_type;
555 u8 page_code;
556 u8 reserved1;
557 u8 len;
558 u8 page[IPR_INQUIRY_PAGE0_ENTRIES];
559}__attribute__((packed));
560
539struct ipr_hostrcb_device_data_entry { 561struct ipr_hostrcb_device_data_entry {
540 struct ipr_std_inq_vpids dev_vpids; 562 struct ipr_vpd vpd;
541 u8 dev_sn[IPR_SERIAL_NUM_LEN];
542 struct ipr_res_addr dev_res_addr; 563 struct ipr_res_addr dev_res_addr;
543 struct ipr_std_inq_vpids new_dev_vpids; 564 struct ipr_vpd new_vpd;
544 u8 new_dev_sn[IPR_SERIAL_NUM_LEN]; 565 struct ipr_vpd ioa_last_with_dev_vpd;
545 struct ipr_std_inq_vpids ioa_last_with_dev_vpids; 566 struct ipr_vpd cfc_last_with_dev_vpd;
546 u8 ioa_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
547 struct ipr_std_inq_vpids cfc_last_with_dev_vpids;
548 u8 cfc_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
549 __be32 ioa_data[5]; 567 __be32 ioa_data[5];
550}__attribute__((packed, aligned (4))); 568}__attribute__((packed, aligned (4)));
551 569
570struct ipr_hostrcb_device_data_entry_enhanced {
571 struct ipr_ext_vpd vpd;
572 u8 ccin[4];
573 struct ipr_res_addr dev_res_addr;
574 struct ipr_ext_vpd new_vpd;
575 u8 new_ccin[4];
576 struct ipr_ext_vpd ioa_last_with_dev_vpd;
577 struct ipr_ext_vpd cfc_last_with_dev_vpd;
578}__attribute__((packed, aligned (4)));
579
552struct ipr_hostrcb_array_data_entry { 580struct ipr_hostrcb_array_data_entry {
553 struct ipr_std_inq_vpids vpids; 581 struct ipr_vpd vpd;
554 u8 serial_num[IPR_SERIAL_NUM_LEN]; 582 struct ipr_res_addr expected_dev_res_addr;
583 struct ipr_res_addr dev_res_addr;
584}__attribute__((packed, aligned (4)));
585
586struct ipr_hostrcb_array_data_entry_enhanced {
587 struct ipr_ext_vpd vpd;
588 u8 ccin[4];
555 struct ipr_res_addr expected_dev_res_addr; 589 struct ipr_res_addr expected_dev_res_addr;
556 struct ipr_res_addr dev_res_addr; 590 struct ipr_res_addr dev_res_addr;
557}__attribute__((packed, aligned (4))); 591}__attribute__((packed, aligned (4)));
558 592
559struct ipr_hostrcb_type_ff_error { 593struct ipr_hostrcb_type_ff_error {
560 __be32 ioa_data[246]; 594 __be32 ioa_data[502];
561}__attribute__((packed, aligned (4))); 595}__attribute__((packed, aligned (4)));
562 596
563struct ipr_hostrcb_type_01_error { 597struct ipr_hostrcb_type_01_error {
@@ -568,47 +602,75 @@ struct ipr_hostrcb_type_01_error {
568}__attribute__((packed, aligned (4))); 602}__attribute__((packed, aligned (4)));
569 603
570struct ipr_hostrcb_type_02_error { 604struct ipr_hostrcb_type_02_error {
571 struct ipr_std_inq_vpids ioa_vpids; 605 struct ipr_vpd ioa_vpd;
572 u8 ioa_sn[IPR_SERIAL_NUM_LEN]; 606 struct ipr_vpd cfc_vpd;
573 struct ipr_std_inq_vpids cfc_vpids; 607 struct ipr_vpd ioa_last_attached_to_cfc_vpd;
574 u8 cfc_sn[IPR_SERIAL_NUM_LEN]; 608 struct ipr_vpd cfc_last_attached_to_ioa_vpd;
575 struct ipr_std_inq_vpids ioa_last_attached_to_cfc_vpids; 609 __be32 ioa_data[3];
576 u8 ioa_last_attached_to_cfc_sn[IPR_SERIAL_NUM_LEN]; 610}__attribute__((packed, aligned (4)));
577 struct ipr_std_inq_vpids cfc_last_attached_to_ioa_vpids; 611
578 u8 cfc_last_attached_to_ioa_sn[IPR_SERIAL_NUM_LEN]; 612struct ipr_hostrcb_type_12_error {
613 struct ipr_ext_vpd ioa_vpd;
614 struct ipr_ext_vpd cfc_vpd;
615 struct ipr_ext_vpd ioa_last_attached_to_cfc_vpd;
616 struct ipr_ext_vpd cfc_last_attached_to_ioa_vpd;
579 __be32 ioa_data[3]; 617 __be32 ioa_data[3];
580 u8 reserved[844];
581}__attribute__((packed, aligned (4))); 618}__attribute__((packed, aligned (4)));
582 619
583struct ipr_hostrcb_type_03_error { 620struct ipr_hostrcb_type_03_error {
584 struct ipr_std_inq_vpids ioa_vpids; 621 struct ipr_vpd ioa_vpd;
585 u8 ioa_sn[IPR_SERIAL_NUM_LEN]; 622 struct ipr_vpd cfc_vpd;
586 struct ipr_std_inq_vpids cfc_vpids;
587 u8 cfc_sn[IPR_SERIAL_NUM_LEN];
588 __be32 errors_detected; 623 __be32 errors_detected;
589 __be32 errors_logged; 624 __be32 errors_logged;
590 u8 ioa_data[12]; 625 u8 ioa_data[12];
591 struct ipr_hostrcb_device_data_entry dev_entry[3]; 626 struct ipr_hostrcb_device_data_entry dev[3];
592 u8 reserved[444]; 627}__attribute__((packed, aligned (4)));
628
629struct ipr_hostrcb_type_13_error {
630 struct ipr_ext_vpd ioa_vpd;
631 struct ipr_ext_vpd cfc_vpd;
632 __be32 errors_detected;
633 __be32 errors_logged;
634 struct ipr_hostrcb_device_data_entry_enhanced dev[3];
593}__attribute__((packed, aligned (4))); 635}__attribute__((packed, aligned (4)));
594 636
595struct ipr_hostrcb_type_04_error { 637struct ipr_hostrcb_type_04_error {
596 struct ipr_std_inq_vpids ioa_vpids; 638 struct ipr_vpd ioa_vpd;
597 u8 ioa_sn[IPR_SERIAL_NUM_LEN]; 639 struct ipr_vpd cfc_vpd;
598 struct ipr_std_inq_vpids cfc_vpids;
599 u8 cfc_sn[IPR_SERIAL_NUM_LEN];
600 u8 ioa_data[12]; 640 u8 ioa_data[12];
601 struct ipr_hostrcb_array_data_entry array_member[10]; 641 struct ipr_hostrcb_array_data_entry array_member[10];
602 __be32 exposed_mode_adn; 642 __be32 exposed_mode_adn;
603 __be32 array_id; 643 __be32 array_id;
604 struct ipr_std_inq_vpids incomp_dev_vpids; 644 struct ipr_vpd incomp_dev_vpd;
605 u8 incomp_dev_sn[IPR_SERIAL_NUM_LEN];
606 __be32 ioa_data2; 645 __be32 ioa_data2;
607 struct ipr_hostrcb_array_data_entry array_member2[8]; 646 struct ipr_hostrcb_array_data_entry array_member2[8];
608 struct ipr_res_addr last_func_vset_res_addr; 647 struct ipr_res_addr last_func_vset_res_addr;
609 u8 vset_serial_num[IPR_SERIAL_NUM_LEN]; 648 u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
610 u8 protection_level[8]; 649 u8 protection_level[8];
611 u8 reserved[124]; 650}__attribute__((packed, aligned (4)));
651
652struct ipr_hostrcb_type_14_error {
653 struct ipr_ext_vpd ioa_vpd;
654 struct ipr_ext_vpd cfc_vpd;
655 __be32 exposed_mode_adn;
656 __be32 array_id;
657 struct ipr_res_addr last_func_vset_res_addr;
658 u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
659 u8 protection_level[8];
660 __be32 num_entries;
661 struct ipr_hostrcb_array_data_entry_enhanced array_member[18];
662}__attribute__((packed, aligned (4)));
663
664struct ipr_hostrcb_type_07_error {
665 u8 failure_reason[64];
666 struct ipr_vpd vpd;
667 u32 data[222];
668}__attribute__((packed, aligned (4)));
669
670struct ipr_hostrcb_type_17_error {
671 u8 failure_reason[64];
672 struct ipr_ext_vpd vpd;
673 u32 data[476];
612}__attribute__((packed, aligned (4))); 674}__attribute__((packed, aligned (4)));
613 675
614struct ipr_hostrcb_error { 676struct ipr_hostrcb_error {
@@ -622,6 +684,11 @@ struct ipr_hostrcb_error {
622 struct ipr_hostrcb_type_02_error type_02_error; 684 struct ipr_hostrcb_type_02_error type_02_error;
623 struct ipr_hostrcb_type_03_error type_03_error; 685 struct ipr_hostrcb_type_03_error type_03_error;
624 struct ipr_hostrcb_type_04_error type_04_error; 686 struct ipr_hostrcb_type_04_error type_04_error;
687 struct ipr_hostrcb_type_07_error type_07_error;
688 struct ipr_hostrcb_type_12_error type_12_error;
689 struct ipr_hostrcb_type_13_error type_13_error;
690 struct ipr_hostrcb_type_14_error type_14_error;
691 struct ipr_hostrcb_type_17_error type_17_error;
625 } u; 692 } u;
626}__attribute__((packed, aligned (4))); 693}__attribute__((packed, aligned (4)));
627 694
@@ -655,6 +722,12 @@ struct ipr_hcam {
655#define IPR_HOST_RCB_OVERLAY_ID_3 0x03 722#define IPR_HOST_RCB_OVERLAY_ID_3 0x03
656#define IPR_HOST_RCB_OVERLAY_ID_4 0x04 723#define IPR_HOST_RCB_OVERLAY_ID_4 0x04
657#define IPR_HOST_RCB_OVERLAY_ID_6 0x06 724#define IPR_HOST_RCB_OVERLAY_ID_6 0x06
725#define IPR_HOST_RCB_OVERLAY_ID_7 0x07
726#define IPR_HOST_RCB_OVERLAY_ID_12 0x12
727#define IPR_HOST_RCB_OVERLAY_ID_13 0x13
728#define IPR_HOST_RCB_OVERLAY_ID_14 0x14
729#define IPR_HOST_RCB_OVERLAY_ID_16 0x16
730#define IPR_HOST_RCB_OVERLAY_ID_17 0x17
658#define IPR_HOST_RCB_OVERLAY_ID_DEFAULT 0xFF 731#define IPR_HOST_RCB_OVERLAY_ID_DEFAULT 0xFF
659 732
660 u8 reserved1[3]; 733 u8 reserved1[3];
@@ -743,6 +816,7 @@ struct ipr_resource_table {
743 816
744struct ipr_misc_cbs { 817struct ipr_misc_cbs {
745 struct ipr_ioa_vpd ioa_vpd; 818 struct ipr_ioa_vpd ioa_vpd;
819 struct ipr_inquiry_page0 page0_data;
746 struct ipr_inquiry_page3 page3_data; 820 struct ipr_inquiry_page3 page3_data;
747 struct ipr_mode_pages mode_pages; 821 struct ipr_mode_pages mode_pages;
748 struct ipr_supported_device supp_dev; 822 struct ipr_supported_device supp_dev;
@@ -813,6 +887,7 @@ struct ipr_trace_entry {
813struct ipr_sglist { 887struct ipr_sglist {
814 u32 order; 888 u32 order;
815 u32 num_sg; 889 u32 num_sg;
890 u32 num_dma_sg;
816 u32 buffer_len; 891 u32 buffer_len;
817 struct scatterlist scatterlist[1]; 892 struct scatterlist scatterlist[1];
818}; 893};
@@ -825,6 +900,13 @@ enum ipr_sdt_state {
825 DUMP_OBTAINED 900 DUMP_OBTAINED
826}; 901};
827 902
903enum ipr_cache_state {
904 CACHE_NONE,
905 CACHE_DISABLED,
906 CACHE_ENABLED,
907 CACHE_INVALID
908};
909
828/* Per-controller data */ 910/* Per-controller data */
829struct ipr_ioa_cfg { 911struct ipr_ioa_cfg {
830 char eye_catcher[8]; 912 char eye_catcher[8];
@@ -841,6 +923,7 @@ struct ipr_ioa_cfg {
841 u8 allow_cmds:1; 923 u8 allow_cmds:1;
842 u8 allow_ml_add_del:1; 924 u8 allow_ml_add_del:1;
843 925
926 enum ipr_cache_state cache_state;
844 u16 type; /* CCIN of the card */ 927 u16 type; /* CCIN of the card */
845 928
846 u8 log_level; 929 u8 log_level;
@@ -911,6 +994,7 @@ struct ipr_ioa_cfg {
911 u16 reset_retries; 994 u16 reset_retries;
912 995
913 u32 errors_logged; 996 u32 errors_logged;
997 u32 doorbell;
914 998
915 struct Scsi_Host *host; 999 struct Scsi_Host *host;
916 struct pci_dev *pdev; 1000 struct pci_dev *pdev;
@@ -948,6 +1032,7 @@ struct ipr_cmnd {
948 struct timer_list timer; 1032 struct timer_list timer;
949 void (*done) (struct ipr_cmnd *); 1033 void (*done) (struct ipr_cmnd *);
950 int (*job_step) (struct ipr_cmnd *); 1034 int (*job_step) (struct ipr_cmnd *);
1035 int (*job_step_failed) (struct ipr_cmnd *);
951 u16 cmd_index; 1036 u16 cmd_index;
952 u8 sense_buffer[SCSI_SENSE_BUFFERSIZE]; 1037 u8 sense_buffer[SCSI_SENSE_BUFFERSIZE];
953 dma_addr_t sense_buffer_dma; 1038 dma_addr_t sense_buffer_dma;
@@ -1083,11 +1168,7 @@ struct ipr_ucode_image_header {
1083/* 1168/*
1084 * Macros 1169 * Macros
1085 */ 1170 */
1086#if IPR_DEBUG 1171#define IPR_DBG_CMD(CMD) if (ipr_debug) { CMD; }
1087#define IPR_DBG_CMD(CMD) do { CMD; } while (0)
1088#else
1089#define IPR_DBG_CMD(CMD)
1090#endif
1091 1172
1092#ifdef CONFIG_SCSI_IPR_TRACE 1173#ifdef CONFIG_SCSI_IPR_TRACE
1093#define ipr_create_trace_file(kobj, attr) sysfs_create_bin_file(kobj, attr) 1174#define ipr_create_trace_file(kobj, attr) sysfs_create_bin_file(kobj, attr)
@@ -1135,16 +1216,22 @@ struct ipr_ucode_image_header {
1135#define ipr_res_dbg(ioa_cfg, res, fmt, ...) \ 1216#define ipr_res_dbg(ioa_cfg, res, fmt, ...) \
1136 IPR_DBG_CMD(ipr_res_printk(KERN_INFO, ioa_cfg, res, fmt, ##__VA_ARGS__)) 1217 IPR_DBG_CMD(ipr_res_printk(KERN_INFO, ioa_cfg, res, fmt, ##__VA_ARGS__))
1137 1218
1219#define ipr_phys_res_err(ioa_cfg, res, fmt, ...) \
1220{ \
1221 if ((res).bus >= IPR_MAX_NUM_BUSES) { \
1222 ipr_err(fmt": unknown\n", ##__VA_ARGS__); \
1223 } else { \
1224 ipr_err(fmt": %d:%d:%d:%d\n", \
1225 ##__VA_ARGS__, (ioa_cfg)->host->host_no, \
1226 (res).bus, (res).target, (res).lun); \
1227 } \
1228}
1229
1138#define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\ 1230#define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\
1139 __FILE__, __FUNCTION__, __LINE__) 1231 __FILE__, __FUNCTION__, __LINE__)
1140 1232
1141#if IPR_DBG_TRACE 1233#define ENTER IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Entering %s\n", __FUNCTION__))
1142#define ENTER printk(KERN_INFO IPR_NAME": Entering %s\n", __FUNCTION__) 1234#define LEAVE IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Leaving %s\n", __FUNCTION__))
1143#define LEAVE printk(KERN_INFO IPR_NAME": Leaving %s\n", __FUNCTION__)
1144#else
1145#define ENTER
1146#define LEAVE
1147#endif
1148 1235
1149#define ipr_err_separator \ 1236#define ipr_err_separator \
1150ipr_err("----------------------------------------------------------\n") 1237ipr_err("----------------------------------------------------------\n")
@@ -1217,6 +1304,20 @@ static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
1217} 1304}
1218 1305
1219/** 1306/**
1307 * ipr_is_naca_model - Determine if a resource is using NACA queueing model
1308 * @res: resource entry struct
1309 *
1310 * Return value:
1311 * 1 if NACA queueing model / 0 if not NACA queueing model
1312 **/
1313static inline int ipr_is_naca_model(struct ipr_resource_entry *res)
1314{
1315 if (ipr_is_gscsi(res) && IPR_QUEUEING_MODEL(res) == IPR_QUEUE_NACA_MODEL)
1316 return 1;
1317 return 0;
1318}
1319
1320/**
1220 * ipr_is_device - Determine if resource address is that of a device 1321 * ipr_is_device - Determine if resource address is that of a device
1221 * @res_addr: resource address struct 1322 * @res_addr: resource address struct
1222 * 1323 *
@@ -1226,7 +1327,7 @@ static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
1226static inline int ipr_is_device(struct ipr_res_addr *res_addr) 1327static inline int ipr_is_device(struct ipr_res_addr *res_addr)
1227{ 1328{
1228 if ((res_addr->bus < IPR_MAX_NUM_BUSES) && 1329 if ((res_addr->bus < IPR_MAX_NUM_BUSES) &&
1229 (res_addr->target < IPR_MAX_NUM_TARGETS_PER_BUS)) 1330 (res_addr->target < (IPR_MAX_NUM_TARGETS_PER_BUS - 1)))
1230 return 1; 1331 return 1;
1231 1332
1232 return 0; 1333 return 0;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index cd9b95db5a7d..3882d48a42bf 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -139,6 +139,7 @@
139/* - Remove 3 unused "inline" functions */ 139/* - Remove 3 unused "inline" functions */
140/* 7.12.xx - Use STATIC functions whereever possible */ 140/* 7.12.xx - Use STATIC functions whereever possible */
141/* - Clean up deprecated MODULE_PARM calls */ 141/* - Clean up deprecated MODULE_PARM calls */
142/* 7.12.05 - Remove Version Matching per IBM request */
142/*****************************************************************************/ 143/*****************************************************************************/
143 144
144/* 145/*
@@ -210,7 +211,7 @@ module_param(ips, charp, 0);
210 * DRIVER_VER 211 * DRIVER_VER
211 */ 212 */
212#define IPS_VERSION_HIGH "7.12" 213#define IPS_VERSION_HIGH "7.12"
213#define IPS_VERSION_LOW ".02 " 214#define IPS_VERSION_LOW ".05 "
214 215
215#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__) 216#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__)
216#warning "This driver has only been tested on the x86/ia64/x86_64 platforms" 217#warning "This driver has only been tested on the x86/ia64/x86_64 platforms"
@@ -247,7 +248,7 @@ module_param(ips, charp, 0);
247/* 248/*
248 * Function prototypes 249 * Function prototypes
249 */ 250 */
250static int ips_detect(Scsi_Host_Template *); 251static int ips_detect(struct scsi_host_template *);
251static int ips_release(struct Scsi_Host *); 252static int ips_release(struct Scsi_Host *);
252static int ips_eh_abort(Scsi_Cmnd *); 253static int ips_eh_abort(Scsi_Cmnd *);
253static int ips_eh_reset(Scsi_Cmnd *); 254static int ips_eh_reset(Scsi_Cmnd *);
@@ -347,8 +348,6 @@ static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
347static int ips_host_info(ips_ha_t *, char *, off_t, int); 348static int ips_host_info(ips_ha_t *, char *, off_t, int);
348static void copy_mem_info(IPS_INFOSTR *, char *, int); 349static void copy_mem_info(IPS_INFOSTR *, char *, int);
349static int copy_info(IPS_INFOSTR *, char *, ...); 350static int copy_info(IPS_INFOSTR *, char *, ...);
350static int ips_get_version_info(ips_ha_t * ha, dma_addr_t, int intr);
351static void ips_version_check(ips_ha_t * ha, int intr);
352static int ips_abort_init(ips_ha_t * ha, int index); 351static int ips_abort_init(ips_ha_t * ha, int index);
353static int ips_init_phase2(int index); 352static int ips_init_phase2(int index);
354 353
@@ -378,7 +377,7 @@ static char *ips_FlashData = NULL; /* CD Boot - Flash Data Buffer */
378static dma_addr_t ips_flashbusaddr; 377static dma_addr_t ips_flashbusaddr;
379static long ips_FlashDataInUse; /* CD Boot - Flash Data In Use Flag */ 378static long ips_FlashDataInUse; /* CD Boot - Flash Data In Use Flag */
380static uint32_t MaxLiteCmds = 32; /* Max Active Cmds for a Lite Adapter */ 379static uint32_t MaxLiteCmds = 32; /* Max Active Cmds for a Lite Adapter */
381static Scsi_Host_Template ips_driver_template = { 380static struct scsi_host_template ips_driver_template = {
382 .detect = ips_detect, 381 .detect = ips_detect,
383 .release = ips_release, 382 .release = ips_release,
384 .info = ips_info, 383 .info = ips_info,
@@ -406,8 +405,6 @@ static Scsi_Host_Template ips_driver_template = {
406#endif 405#endif
407}; 406};
408 407
409static IPS_DEFINE_COMPAT_TABLE( Compatable ); /* Version Compatability Table */
410
411 408
412/* This table describes all ServeRAID Adapters */ 409/* This table describes all ServeRAID Adapters */
413static struct pci_device_id ips_pci_table[] = { 410static struct pci_device_id ips_pci_table[] = {
@@ -590,7 +587,7 @@ __setup("ips=", ips_setup);
590/* */ 587/* */
591/****************************************************************************/ 588/****************************************************************************/
592static int 589static int
593ips_detect(Scsi_Host_Template * SHT) 590ips_detect(struct scsi_host_template * SHT)
594{ 591{
595 int i; 592 int i;
596 593
@@ -1265,9 +1262,9 @@ ips_proc24_info(char *buffer, char **start, off_t offset, int length,
1265/* */ 1262/* */
1266/****************************************************************************/ 1263/****************************************************************************/
1267static void 1264static void
1268ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device * scsi_devs) 1265ips_select_queue_depth(struct Scsi_Host *host, struct scsi_device * scsi_devs)
1269{ 1266{
1270 Scsi_Device *device; 1267 struct scsi_device *device;
1271 ips_ha_t *ha; 1268 ips_ha_t *ha;
1272 int count = 0; 1269 int count = 0;
1273 int min; 1270 int min;
@@ -1310,7 +1307,7 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device * scsi_devs)
1310/* */ 1307/* */
1311/****************************************************************************/ 1308/****************************************************************************/
1312static int 1309static int
1313ips_slave_configure(Scsi_Device * SDptr) 1310ips_slave_configure(struct scsi_device * SDptr)
1314{ 1311{
1315 ips_ha_t *ha; 1312 ips_ha_t *ha;
1316 int min; 1313 int min;
@@ -5930,7 +5927,7 @@ ips_write_driver_status(ips_ha_t * ha, int intr)
5930 strncpy((char *) ha->nvram->bios_high, ha->bios_version, 4); 5927 strncpy((char *) ha->nvram->bios_high, ha->bios_version, 4);
5931 strncpy((char *) ha->nvram->bios_low, ha->bios_version + 4, 4); 5928 strncpy((char *) ha->nvram->bios_low, ha->bios_version + 4, 4);
5932 5929
5933 ips_version_check(ha, intr); /* Check BIOS/FW/Driver Versions */ 5930 ha->nvram->versioning = 0; /* Indicate the Driver Does Not Support Versioning */
5934 5931
5935 /* now update the page */ 5932 /* now update the page */
5936 if (!ips_readwrite_page5(ha, TRUE, intr)) { 5933 if (!ips_readwrite_page5(ha, TRUE, intr)) {
@@ -6847,135 +6844,6 @@ ips_verify_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize,
6847 return (0); 6844 return (0);
6848} 6845}
6849 6846
6850/*---------------------------------------------------------------------------*/
6851/* Routine Name: ips_version_check */
6852/* */
6853/* Dependencies: */
6854/* Assumes that ips_read_adapter_status() is called first filling in */
6855/* the data for SubSystem Parameters. */
6856/* Called from ips_write_driver_status() so it also assumes NVRAM Page 5 */
6857/* Data is available. */
6858/* */
6859/*---------------------------------------------------------------------------*/
6860static void
6861ips_version_check(ips_ha_t * ha, int intr)
6862{
6863 IPS_VERSION_DATA *VersionInfo;
6864 uint8_t FirmwareVersion[IPS_COMPAT_ID_LENGTH + 1];
6865 uint8_t BiosVersion[IPS_COMPAT_ID_LENGTH + 1];
6866 int MatchError;
6867 int rc;
6868 char BiosString[10];
6869 char FirmwareString[10];
6870
6871 METHOD_TRACE("ips_version_check", 1);
6872
6873 VersionInfo = ( IPS_VERSION_DATA * ) ha->ioctl_data;
6874
6875 memset(FirmwareVersion, 0, IPS_COMPAT_ID_LENGTH + 1);
6876 memset(BiosVersion, 0, IPS_COMPAT_ID_LENGTH + 1);
6877
6878 /* Get the Compatible BIOS Version from NVRAM Page 5 */
6879 memcpy(BiosVersion, ha->nvram->BiosCompatibilityID,
6880 IPS_COMPAT_ID_LENGTH);
6881
6882 rc = IPS_FAILURE;
6883 if (ha->subsys->param[4] & IPS_GET_VERSION_SUPPORT) { /* If Versioning is Supported */
6884 /* Get the Version Info with a Get Version Command */
6885 memset( VersionInfo, 0, sizeof (IPS_VERSION_DATA));
6886 rc = ips_get_version_info(ha, ha->ioctl_busaddr, intr);
6887 if (rc == IPS_SUCCESS)
6888 memcpy(FirmwareVersion, VersionInfo->compatibilityId,
6889 IPS_COMPAT_ID_LENGTH);
6890 }
6891
6892 if (rc != IPS_SUCCESS) { /* If Data Not Obtainable from a GetVersion Command */
6893 /* Get the Firmware Version from Enquiry Data */
6894 memcpy(FirmwareVersion, ha->enq->CodeBlkVersion,
6895 IPS_COMPAT_ID_LENGTH);
6896 }
6897
6898 /* printk(KERN_WARNING "Adapter's BIOS Version = %s\n", BiosVersion); */
6899 /* printk(KERN_WARNING "BIOS Compatible Version = %s\n", IPS_COMPAT_BIOS); */
6900 /* printk(KERN_WARNING "Adapter's Firmware Version = %s\n", FirmwareVersion); */
6901 /* printk(KERN_WARNING "Firmware Compatible Version = %s \n", Compatable[ ha->nvram->adapter_type ]); */
6902
6903 MatchError = 0;
6904
6905 if (strncmp
6906 (FirmwareVersion, Compatable[ha->nvram->adapter_type],
6907 IPS_COMPAT_ID_LENGTH) != 0)
6908 MatchError = 1;
6909
6910 if (strncmp(BiosVersion, IPS_COMPAT_BIOS, IPS_COMPAT_ID_LENGTH) != 0)
6911 MatchError = 1;
6912
6913 ha->nvram->versioning = 1; /* Indicate the Driver Supports Versioning */
6914
6915 if (MatchError) {
6916 ha->nvram->version_mismatch = 1;
6917 if (ips_cd_boot == 0) {
6918 strncpy(&BiosString[0], ha->nvram->bios_high, 4);
6919 strncpy(&BiosString[4], ha->nvram->bios_low, 4);
6920 BiosString[8] = 0;
6921
6922 strncpy(&FirmwareString[0], ha->enq->CodeBlkVersion, 8);
6923 FirmwareString[8] = 0;
6924
6925 IPS_PRINTK(KERN_WARNING, ha->pcidev,
6926 "Warning ! ! ! ServeRAID Version Mismatch\n");
6927 IPS_PRINTK(KERN_WARNING, ha->pcidev,
6928 "Bios = %s, Firmware = %s, Device Driver = %s%s\n",
6929 BiosString, FirmwareString, IPS_VERSION_HIGH,
6930 IPS_VERSION_LOW);
6931 IPS_PRINTK(KERN_WARNING, ha->pcidev,
6932 "These levels should match to avoid possible compatibility problems.\n");
6933 }
6934 } else {
6935 ha->nvram->version_mismatch = 0;
6936 }
6937
6938 return;
6939}
6940
6941/*---------------------------------------------------------------------------*/
6942/* Routine Name: ips_get_version_info */
6943/* */
6944/* Routine Description: */
6945/* Issue an internal GETVERSION Command */
6946/* */
6947/* Return Value: */
6948/* 0 if Successful, else non-zero */
6949/*---------------------------------------------------------------------------*/
6950static int
6951ips_get_version_info(ips_ha_t * ha, dma_addr_t Buffer, int intr)
6952{
6953 ips_scb_t *scb;
6954 int rc;
6955
6956 METHOD_TRACE("ips_get_version_info", 1);
6957
6958 scb = &ha->scbs[ha->max_cmds - 1];
6959
6960 ips_init_scb(ha, scb);
6961
6962 scb->timeout = ips_cmd_timeout;
6963 scb->cdb[0] = IPS_CMD_GET_VERSION_INFO;
6964 scb->cmd.version_info.op_code = IPS_CMD_GET_VERSION_INFO;
6965 scb->cmd.version_info.command_id = IPS_COMMAND_ID(ha, scb);
6966 scb->cmd.version_info.reserved = 0;
6967 scb->cmd.version_info.count = sizeof (IPS_VERSION_DATA);
6968 scb->cmd.version_info.reserved2 = 0;
6969 scb->data_len = sizeof (IPS_VERSION_DATA);
6970 scb->data_busaddr = Buffer;
6971 scb->cmd.version_info.buffer_addr = Buffer;
6972 scb->flags = 0;
6973
6974 /* issue command */
6975 rc = ips_send_wait(ha, scb, ips_cmd_timeout, intr);
6976 return (rc);
6977}
6978
6979/****************************************************************************/ 6847/****************************************************************************/
6980/* */ 6848/* */
6981/* Routine Name: ips_abort_init */ 6849/* Routine Name: ips_abort_init */
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
index adc6eabbf610..f46c382e5599 100644
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -450,13 +450,13 @@
450 */ 450 */
451#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 451#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
452 static int ips_proc24_info(char *, char **, off_t, int, int, int); 452 static int ips_proc24_info(char *, char **, off_t, int, int, int);
453 static void ips_select_queue_depth(struct Scsi_Host *, Scsi_Device *); 453 static void ips_select_queue_depth(struct Scsi_Host *, struct scsi_device *);
454 static int ips_biosparam(Disk *disk, kdev_t dev, int geom[]); 454 static int ips_biosparam(Disk *disk, kdev_t dev, int geom[]);
455#else 455#else
456 static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); 456 static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
457 static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, 457 static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
458 sector_t capacity, int geom[]); 458 sector_t capacity, int geom[]);
459 static int ips_slave_configure(Scsi_Device *SDptr); 459 static int ips_slave_configure(struct scsi_device *SDptr);
460#endif 460#endif
461 461
462/* 462/*
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 4fea3e4edaa7..3d8009f55342 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -3368,7 +3368,7 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param,
3368 switch(param) { 3368 switch(param) {
3369 case ISCSI_PARAM_MAX_RECV_DLENGTH: { 3369 case ISCSI_PARAM_MAX_RECV_DLENGTH: {
3370 char *saveptr = conn->data; 3370 char *saveptr = conn->data;
3371 int flags = GFP_KERNEL; 3371 gfp_t flags = GFP_KERNEL;
3372 3372
3373 if (conn->data_size >= value) { 3373 if (conn->data_size >= value) {
3374 conn->max_recv_dlength = value; 3374 conn->max_recv_dlength = value;
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index a642f736cf85..23728d1c980c 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -52,7 +52,7 @@ static volatile unsigned char cmd_buffer[16];
52 * via PIO. 52 * via PIO.
53 */ 53 */
54 54
55int jazz_esp_detect(Scsi_Host_Template *tpnt); 55int jazz_esp_detect(struct scsi_host_template *tpnt);
56static int jazz_esp_release(struct Scsi_Host *shost) 56static int jazz_esp_release(struct Scsi_Host *shost)
57{ 57{
58 if (shost->irq) 58 if (shost->irq)
@@ -65,7 +65,7 @@ static int jazz_esp_release(struct Scsi_Host *shost)
65 return 0; 65 return 0;
66} 66}
67 67
68static Scsi_Host_Template driver_template = { 68static struct scsi_host_template driver_template = {
69 .proc_name = "jazz_esp", 69 .proc_name = "jazz_esp",
70 .proc_info = &esp_proc_info, 70 .proc_info = &esp_proc_info,
71 .name = "ESP 100/100a/200", 71 .name = "ESP 100/100a/200",
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index a74b4071a662..d0a0fdbd0fc4 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -532,8 +532,7 @@ void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp)
532 * @fis: Buffer from which data will be input 532 * @fis: Buffer from which data will be input
533 * @tf: Taskfile to output 533 * @tf: Taskfile to output
534 * 534 *
535 * Converts a standard ATA taskfile to a Serial ATA 535 * Converts a serial ATA FIS structure to a standard ATA taskfile.
536 * FIS structure (Register - Host to Device).
537 * 536 *
538 * LOCKING: 537 * LOCKING:
539 * Inherited from caller. 538 * Inherited from caller.
@@ -1047,6 +1046,30 @@ static unsigned int ata_pio_modes(const struct ata_device *adev)
1047 return modes; 1046 return modes;
1048} 1047}
1049 1048
1049static int ata_qc_wait_err(struct ata_queued_cmd *qc,
1050 struct completion *wait)
1051{
1052 int rc = 0;
1053
1054 if (wait_for_completion_timeout(wait, 30 * HZ) < 1) {
1055 /* timeout handling */
1056 unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap));
1057
1058 if (!err_mask) {
1059 printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n",
1060 qc->ap->id, qc->tf.command);
1061 } else {
1062 printk(KERN_WARNING "ata%u: qc timeout (cmd %x)\n",
1063 qc->ap->id, qc->tf.command);
1064 rc = -EIO;
1065 }
1066
1067 ata_qc_complete(qc, err_mask);
1068 }
1069
1070 return rc;
1071}
1072
1050/** 1073/**
1051 * ata_dev_identify - obtain IDENTIFY x DEVICE page 1074 * ata_dev_identify - obtain IDENTIFY x DEVICE page
1052 * @ap: port on which device we wish to probe resides 1075 * @ap: port on which device we wish to probe resides
@@ -1126,7 +1149,7 @@ retry:
1126 if (rc) 1149 if (rc)
1127 goto err_out; 1150 goto err_out;
1128 else 1151 else
1129 wait_for_completion(&wait); 1152 ata_qc_wait_err(qc, &wait);
1130 1153
1131 spin_lock_irqsave(&ap->host_set->lock, flags); 1154 spin_lock_irqsave(&ap->host_set->lock, flags);
1132 ap->ops->tf_read(ap, &qc->tf); 1155 ap->ops->tf_read(ap, &qc->tf);
@@ -1264,7 +1287,7 @@ retry:
1264 } 1287 }
1265 1288
1266 /* ATAPI-specific feature tests */ 1289 /* ATAPI-specific feature tests */
1267 else { 1290 else if (dev->class == ATA_DEV_ATAPI) {
1268 if (ata_id_is_ata(dev->id)) /* sanity check */ 1291 if (ata_id_is_ata(dev->id)) /* sanity check */
1269 goto err_out_nosup; 1292 goto err_out_nosup;
1270 1293
@@ -1571,11 +1594,13 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1571 1594
1572 /* 1595 /*
1573 * Find the mode. 1596 * Find the mode.
1574 */ 1597 */
1575 1598
1576 if (!(s = ata_timing_find_mode(speed))) 1599 if (!(s = ata_timing_find_mode(speed)))
1577 return -EINVAL; 1600 return -EINVAL;
1578 1601
1602 memcpy(t, s, sizeof(*s));
1603
1579 /* 1604 /*
1580 * If the drive is an EIDE drive, it can tell us it needs extended 1605 * If the drive is an EIDE drive, it can tell us it needs extended
1581 * PIO/MW_DMA cycle timing. 1606 * PIO/MW_DMA cycle timing.
@@ -1596,7 +1621,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1596 * Convert the timing to bus clock counts. 1621 * Convert the timing to bus clock counts.
1597 */ 1622 */
1598 1623
1599 ata_timing_quantize(s, t, T, UT); 1624 ata_timing_quantize(t, t, T, UT);
1600 1625
1601 /* 1626 /*
1602 * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T 1627 * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T
@@ -2268,7 +2293,7 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
2268 if (rc) 2293 if (rc)
2269 ata_port_disable(ap); 2294 ata_port_disable(ap);
2270 else 2295 else
2271 wait_for_completion(&wait); 2296 ata_qc_wait_err(qc, &wait);
2272 2297
2273 DPRINTK("EXIT\n"); 2298 DPRINTK("EXIT\n");
2274} 2299}
@@ -2316,7 +2341,7 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev)
2316 if (rc) 2341 if (rc)
2317 goto err_out; 2342 goto err_out;
2318 2343
2319 wait_for_completion(&wait); 2344 ata_qc_wait_err(qc, &wait);
2320 2345
2321 swap_buf_le16(dev->id, ATA_ID_WORDS); 2346 swap_buf_le16(dev->id, ATA_ID_WORDS);
2322 2347
@@ -2372,7 +2397,7 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev)
2372 if (rc) 2397 if (rc)
2373 ata_port_disable(ap); 2398 ata_port_disable(ap);
2374 else 2399 else
2375 wait_for_completion(&wait); 2400 ata_qc_wait_err(qc, &wait);
2376 2401
2377 DPRINTK("EXIT\n"); 2402 DPRINTK("EXIT\n");
2378} 2403}
@@ -2400,7 +2425,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
2400 if (qc->flags & ATA_QCFLAG_SINGLE) 2425 if (qc->flags & ATA_QCFLAG_SINGLE)
2401 assert(qc->n_elem == 1); 2426 assert(qc->n_elem == 1);
2402 2427
2403 DPRINTK("unmapping %u sg elements\n", qc->n_elem); 2428 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
2404 2429
2405 /* if we padded the buffer out to 32-bit bound, and data 2430 /* if we padded the buffer out to 32-bit bound, and data
2406 * xfer direction is from-device, we must copy from the 2431 * xfer direction is from-device, we must copy from the
@@ -2410,18 +2435,21 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
2410 pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); 2435 pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ);
2411 2436
2412 if (qc->flags & ATA_QCFLAG_SG) { 2437 if (qc->flags & ATA_QCFLAG_SG) {
2413 dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir); 2438 if (qc->n_elem)
2439 dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir);
2414 /* restore last sg */ 2440 /* restore last sg */
2415 sg[qc->orig_n_elem - 1].length += qc->pad_len; 2441 sg[qc->orig_n_elem - 1].length += qc->pad_len;
2416 if (pad_buf) { 2442 if (pad_buf) {
2417 struct scatterlist *psg = &qc->pad_sgent; 2443 struct scatterlist *psg = &qc->pad_sgent;
2418 void *addr = kmap_atomic(psg->page, KM_IRQ0); 2444 void *addr = kmap_atomic(psg->page, KM_IRQ0);
2419 memcpy(addr + psg->offset, pad_buf, qc->pad_len); 2445 memcpy(addr + psg->offset, pad_buf, qc->pad_len);
2420 kunmap_atomic(psg->page, KM_IRQ0); 2446 kunmap_atomic(addr, KM_IRQ0);
2421 } 2447 }
2422 } else { 2448 } else {
2423 dma_unmap_single(ap->host_set->dev, sg_dma_address(&sg[0]), 2449 if (sg_dma_len(&sg[0]) > 0)
2424 sg_dma_len(&sg[0]), dir); 2450 dma_unmap_single(ap->host_set->dev,
2451 sg_dma_address(&sg[0]), sg_dma_len(&sg[0]),
2452 dir);
2425 /* restore sg */ 2453 /* restore sg */
2426 sg->length += qc->pad_len; 2454 sg->length += qc->pad_len;
2427 if (pad_buf) 2455 if (pad_buf)
@@ -2620,6 +2648,11 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2620 sg->length, qc->pad_len); 2648 sg->length, qc->pad_len);
2621 } 2649 }
2622 2650
2651 if (!sg->length) {
2652 sg_dma_address(sg) = 0;
2653 goto skip_map;
2654 }
2655
2623 dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, 2656 dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt,
2624 sg->length, dir); 2657 sg->length, dir);
2625 if (dma_mapping_error(dma_address)) { 2658 if (dma_mapping_error(dma_address)) {
@@ -2629,6 +2662,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2629 } 2662 }
2630 2663
2631 sg_dma_address(sg) = dma_address; 2664 sg_dma_address(sg) = dma_address;
2665skip_map:
2632 sg_dma_len(sg) = sg->length; 2666 sg_dma_len(sg) = sg->length;
2633 2667
2634 DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), 2668 DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg),
@@ -2656,7 +2690,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2656 struct ata_port *ap = qc->ap; 2690 struct ata_port *ap = qc->ap;
2657 struct scatterlist *sg = qc->__sg; 2691 struct scatterlist *sg = qc->__sg;
2658 struct scatterlist *lsg = &sg[qc->n_elem - 1]; 2692 struct scatterlist *lsg = &sg[qc->n_elem - 1];
2659 int n_elem, dir; 2693 int n_elem, pre_n_elem, dir, trim_sg = 0;
2660 2694
2661 VPRINTK("ENTER, ata%u\n", ap->id); 2695 VPRINTK("ENTER, ata%u\n", ap->id);
2662 assert(qc->flags & ATA_QCFLAG_SG); 2696 assert(qc->flags & ATA_QCFLAG_SG);
@@ -2683,20 +2717,31 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2683 if (qc->tf.flags & ATA_TFLAG_WRITE) { 2717 if (qc->tf.flags & ATA_TFLAG_WRITE) {
2684 void *addr = kmap_atomic(psg->page, KM_IRQ0); 2718 void *addr = kmap_atomic(psg->page, KM_IRQ0);
2685 memcpy(pad_buf, addr + psg->offset, qc->pad_len); 2719 memcpy(pad_buf, addr + psg->offset, qc->pad_len);
2686 kunmap_atomic(psg->page, KM_IRQ0); 2720 kunmap_atomic(addr, KM_IRQ0);
2687 } 2721 }
2688 2722
2689 sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ); 2723 sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);
2690 sg_dma_len(psg) = ATA_DMA_PAD_SZ; 2724 sg_dma_len(psg) = ATA_DMA_PAD_SZ;
2691 /* trim last sg */ 2725 /* trim last sg */
2692 lsg->length -= qc->pad_len; 2726 lsg->length -= qc->pad_len;
2727 if (lsg->length == 0)
2728 trim_sg = 1;
2693 2729
2694 DPRINTK("padding done, sg[%d].length=%u pad_len=%u\n", 2730 DPRINTK("padding done, sg[%d].length=%u pad_len=%u\n",
2695 qc->n_elem - 1, lsg->length, qc->pad_len); 2731 qc->n_elem - 1, lsg->length, qc->pad_len);
2696 } 2732 }
2697 2733
2734 pre_n_elem = qc->n_elem;
2735 if (trim_sg && pre_n_elem)
2736 pre_n_elem--;
2737
2738 if (!pre_n_elem) {
2739 n_elem = 0;
2740 goto skip_map;
2741 }
2742
2698 dir = qc->dma_dir; 2743 dir = qc->dma_dir;
2699 n_elem = dma_map_sg(ap->host_set->dev, sg, qc->n_elem, dir); 2744 n_elem = dma_map_sg(ap->host_set->dev, sg, pre_n_elem, dir);
2700 if (n_elem < 1) { 2745 if (n_elem < 1) {
2701 /* restore last sg */ 2746 /* restore last sg */
2702 lsg->length += qc->pad_len; 2747 lsg->length += qc->pad_len;
@@ -2705,6 +2750,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2705 2750
2706 DPRINTK("%d sg elements mapped\n", n_elem); 2751 DPRINTK("%d sg elements mapped\n", n_elem);
2707 2752
2753skip_map:
2708 qc->n_elem = n_elem; 2754 qc->n_elem = n_elem;
2709 2755
2710 return 0; 2756 return 0;
@@ -3264,32 +3310,11 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
3264{ 3310{
3265 struct ata_port *ap = qc->ap; 3311 struct ata_port *ap = qc->ap;
3266 struct ata_host_set *host_set = ap->host_set; 3312 struct ata_host_set *host_set = ap->host_set;
3267 struct ata_device *dev = qc->dev;
3268 u8 host_stat = 0, drv_stat; 3313 u8 host_stat = 0, drv_stat;
3269 unsigned long flags; 3314 unsigned long flags;
3270 3315
3271 DPRINTK("ENTER\n"); 3316 DPRINTK("ENTER\n");
3272 3317
3273 /* FIXME: doesn't this conflict with timeout handling? */
3274 if (qc->dev->class == ATA_DEV_ATAPI && qc->scsicmd) {
3275 struct scsi_cmnd *cmd = qc->scsicmd;
3276
3277 if (!(cmd->eh_eflags & SCSI_EH_CANCEL_CMD)) {
3278
3279 /* finish completing original command */
3280 spin_lock_irqsave(&host_set->lock, flags);
3281 __ata_qc_complete(qc);
3282 spin_unlock_irqrestore(&host_set->lock, flags);
3283
3284 atapi_request_sense(ap, dev, cmd);
3285
3286 cmd->result = (CHECK_CONDITION << 1) | (DID_OK << 16);
3287 scsi_finish_command(cmd);
3288
3289 goto out;
3290 }
3291 }
3292
3293 spin_lock_irqsave(&host_set->lock, flags); 3318 spin_lock_irqsave(&host_set->lock, flags);
3294 3319
3295 /* hack alert! We cannot use the supplied completion 3320 /* hack alert! We cannot use the supplied completion
@@ -3328,7 +3353,6 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
3328 3353
3329 spin_unlock_irqrestore(&host_set->lock, flags); 3354 spin_unlock_irqrestore(&host_set->lock, flags);
3330 3355
3331out:
3332 DPRINTK("EXIT\n"); 3356 DPRINTK("EXIT\n");
3333} 3357}
3334 3358
@@ -3412,16 +3436,11 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
3412 3436
3413 qc = ata_qc_new(ap); 3437 qc = ata_qc_new(ap);
3414 if (qc) { 3438 if (qc) {
3415 qc->__sg = NULL;
3416 qc->flags = 0;
3417 qc->scsicmd = NULL; 3439 qc->scsicmd = NULL;
3418 qc->ap = ap; 3440 qc->ap = ap;
3419 qc->dev = dev; 3441 qc->dev = dev;
3420 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
3421 qc->nsect = 0;
3422 qc->nbytes = qc->curbytes = 0;
3423 3442
3424 ata_tf_init(ap, &qc->tf, dev->devno); 3443 ata_qc_reinit(qc);
3425 } 3444 }
3426 3445
3427 return qc; 3446 return qc;
@@ -4563,6 +4582,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
4563 4582
4564 probe_ent->irq = pdev->irq; 4583 probe_ent->irq = pdev->irq;
4565 probe_ent->irq_flags = SA_SHIRQ; 4584 probe_ent->irq_flags = SA_SHIRQ;
4585 probe_ent->private_data = port[0]->private_data;
4566 4586
4567 if (ports & ATA_PORT_PRIMARY) { 4587 if (ports & ATA_PORT_PRIMARY) {
4568 probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0); 4588 probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0);
@@ -4599,6 +4619,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
4599 probe_ent->legacy_mode = 1; 4619 probe_ent->legacy_mode = 1;
4600 probe_ent->n_ports = 1; 4620 probe_ent->n_ports = 1;
4601 probe_ent->hard_port_no = port_num; 4621 probe_ent->hard_port_no = port_num;
4622 probe_ent->private_data = port->private_data;
4602 4623
4603 switch(port_num) 4624 switch(port_num)
4604 { 4625 {
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index bb30fcdc9297..2282c04fee46 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -38,6 +38,7 @@
38#include <linux/spinlock.h> 38#include <linux/spinlock.h>
39#include <scsi/scsi.h> 39#include <scsi/scsi.h>
40#include <scsi/scsi_host.h> 40#include <scsi/scsi_host.h>
41#include <scsi/scsi_eh.h>
41#include <scsi/scsi_device.h> 42#include <scsi/scsi_device.h>
42#include <scsi/scsi_request.h> 43#include <scsi/scsi_request.h>
43#include <linux/libata.h> 44#include <linux/libata.h>
@@ -147,7 +148,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
147 u8 scsi_cmd[MAX_COMMAND_SIZE]; 148 u8 scsi_cmd[MAX_COMMAND_SIZE];
148 u8 args[4], *argbuf = NULL; 149 u8 args[4], *argbuf = NULL;
149 int argsize = 0; 150 int argsize = 0;
150 struct scsi_request *sreq; 151 struct scsi_sense_hdr sshdr;
152 enum dma_data_direction data_dir;
151 153
152 if (NULL == (void *)arg) 154 if (NULL == (void *)arg)
153 return -EINVAL; 155 return -EINVAL;
@@ -155,10 +157,6 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
155 if (copy_from_user(args, arg, sizeof(args))) 157 if (copy_from_user(args, arg, sizeof(args)))
156 return -EFAULT; 158 return -EFAULT;
157 159
158 sreq = scsi_allocate_request(scsidev, GFP_KERNEL);
159 if (!sreq)
160 return -EINTR;
161
162 memset(scsi_cmd, 0, sizeof(scsi_cmd)); 160 memset(scsi_cmd, 0, sizeof(scsi_cmd));
163 161
164 if (args[3]) { 162 if (args[3]) {
@@ -172,11 +170,11 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
172 scsi_cmd[1] = (4 << 1); /* PIO Data-in */ 170 scsi_cmd[1] = (4 << 1); /* PIO Data-in */
173 scsi_cmd[2] = 0x0e; /* no off.line or cc, read from dev, 171 scsi_cmd[2] = 0x0e; /* no off.line or cc, read from dev,
174 block count in sector count field */ 172 block count in sector count field */
175 sreq->sr_data_direction = DMA_FROM_DEVICE; 173 data_dir = DMA_FROM_DEVICE;
176 } else { 174 } else {
177 scsi_cmd[1] = (3 << 1); /* Non-data */ 175 scsi_cmd[1] = (3 << 1); /* Non-data */
178 /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */ 176 /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
179 sreq->sr_data_direction = DMA_NONE; 177 data_dir = DMA_NONE;
180 } 178 }
181 179
182 scsi_cmd[0] = ATA_16; 180 scsi_cmd[0] = ATA_16;
@@ -194,9 +192,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
194 192
195 /* Good values for timeout and retries? Values below 193 /* Good values for timeout and retries? Values below
196 from scsi_ioctl_send_command() for default case... */ 194 from scsi_ioctl_send_command() for default case... */
197 scsi_wait_req(sreq, scsi_cmd, argbuf, argsize, (10*HZ), 5); 195 if (scsi_execute_req(scsidev, scsi_cmd, data_dir, argbuf, argsize,
198 196 &sshdr, (10*HZ), 5)) {
199 if (sreq->sr_result) {
200 rc = -EIO; 197 rc = -EIO;
201 goto error; 198 goto error;
202 } 199 }
@@ -207,8 +204,6 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
207 && copy_to_user((void *)(arg + sizeof(args)), argbuf, argsize)) 204 && copy_to_user((void *)(arg + sizeof(args)), argbuf, argsize))
208 rc = -EFAULT; 205 rc = -EFAULT;
209error: 206error:
210 scsi_release_request(sreq);
211
212 if (argbuf) 207 if (argbuf)
213 kfree(argbuf); 208 kfree(argbuf);
214 209
@@ -231,7 +226,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
231 int rc = 0; 226 int rc = 0;
232 u8 scsi_cmd[MAX_COMMAND_SIZE]; 227 u8 scsi_cmd[MAX_COMMAND_SIZE];
233 u8 args[7]; 228 u8 args[7];
234 struct scsi_request *sreq; 229 struct scsi_sense_hdr sshdr;
235 230
236 if (NULL == (void *)arg) 231 if (NULL == (void *)arg)
237 return -EINVAL; 232 return -EINVAL;
@@ -250,26 +245,13 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
250 scsi_cmd[12] = args[5]; 245 scsi_cmd[12] = args[5];
251 scsi_cmd[14] = args[0]; 246 scsi_cmd[14] = args[0];
252 247
253 sreq = scsi_allocate_request(scsidev, GFP_KERNEL);
254 if (!sreq) {
255 rc = -EINTR;
256 goto error;
257 }
258
259 sreq->sr_data_direction = DMA_NONE;
260 /* Good values for timeout and retries? Values below 248 /* Good values for timeout and retries? Values below
261 from scsi_ioctl_send_command() for default case... */ 249 from scsi_ioctl_send_command() for default case... */
262 scsi_wait_req(sreq, scsi_cmd, NULL, 0, (10*HZ), 5); 250 if (scsi_execute_req(scsidev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr,
263 251 (10*HZ), 5))
264 if (sreq->sr_result) {
265 rc = -EIO; 252 rc = -EIO;
266 goto error;
267 }
268 253
269 /* Need code to retrieve data from check condition? */ 254 /* Need code to retrieve data from check condition? */
270
271error:
272 scsi_release_request(sreq);
273 return rc; 255 return rc;
274} 256}
275 257
@@ -1129,6 +1111,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
1129 * length 0 means transfer 0 block of data. 1111 * length 0 means transfer 0 block of data.
1130 * However, for ATA R/W commands, sector count 0 means 1112 * However, for ATA R/W commands, sector count 0 means
1131 * 256 or 65536 sectors, not 0 sectors as in SCSI. 1113 * 256 or 65536 sectors, not 0 sectors as in SCSI.
1114 *
1115 * WARNING: one or two older ATA drives treat 0 as 0...
1132 */ 1116 */
1133 goto nothing_to_do; 1117 goto nothing_to_do;
1134 1118
@@ -1971,22 +1955,44 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
1971 done(cmd); 1955 done(cmd);
1972} 1956}
1973 1957
1974void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, 1958static int atapi_sense_complete(struct ata_queued_cmd *qc,unsigned int err_mask)
1975 struct scsi_cmnd *cmd)
1976{ 1959{
1977 DECLARE_COMPLETION(wait); 1960 if (err_mask && ((err_mask & AC_ERR_DEV) == 0))
1978 struct ata_queued_cmd *qc; 1961 /* FIXME: not quite right; we don't want the
1979 unsigned long flags; 1962 * translation of taskfile registers into
1980 int rc; 1963 * a sense descriptors, since that's only
1964 * correct for ATA, not ATAPI
1965 */
1966 ata_gen_ata_desc_sense(qc);
1981 1967
1982 DPRINTK("ATAPI request sense\n"); 1968 qc->scsidone(qc->scsicmd);
1969 return 0;
1970}
1983 1971
1984 qc = ata_qc_new_init(ap, dev); 1972/* is it pointless to prefer PIO for "safety reasons"? */
1985 BUG_ON(qc == NULL); 1973static inline int ata_pio_use_silly(struct ata_port *ap)
1974{
1975 return (ap->flags & ATA_FLAG_PIO_DMA);
1976}
1977
1978static void atapi_request_sense(struct ata_queued_cmd *qc)
1979{
1980 struct ata_port *ap = qc->ap;
1981 struct scsi_cmnd *cmd = qc->scsicmd;
1982
1983 DPRINTK("ATAPI request sense\n");
1986 1984
1987 /* FIXME: is this needed? */ 1985 /* FIXME: is this needed? */
1988 memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer)); 1986 memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
1989 1987
1988 ap->ops->tf_read(ap, &qc->tf);
1989
1990 /* fill these in, for the case where they are -not- overwritten */
1991 cmd->sense_buffer[0] = 0x70;
1992 cmd->sense_buffer[2] = qc->tf.feature >> 4;
1993
1994 ata_qc_reinit(qc);
1995
1990 ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); 1996 ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer));
1991 qc->dma_dir = DMA_FROM_DEVICE; 1997 qc->dma_dir = DMA_FROM_DEVICE;
1992 1998
@@ -1997,22 +2003,20 @@ void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
1997 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 2003 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1998 qc->tf.command = ATA_CMD_PACKET; 2004 qc->tf.command = ATA_CMD_PACKET;
1999 2005
2000 qc->tf.protocol = ATA_PROT_ATAPI; 2006 if (ata_pio_use_silly(ap)) {
2001 qc->tf.lbam = (8 * 1024) & 0xff; 2007 qc->tf.protocol = ATA_PROT_ATAPI_DMA;
2002 qc->tf.lbah = (8 * 1024) >> 8; 2008 qc->tf.feature |= ATAPI_PKT_DMA;
2009 } else {
2010 qc->tf.protocol = ATA_PROT_ATAPI;
2011 qc->tf.lbam = (8 * 1024) & 0xff;
2012 qc->tf.lbah = (8 * 1024) >> 8;
2013 }
2003 qc->nbytes = SCSI_SENSE_BUFFERSIZE; 2014 qc->nbytes = SCSI_SENSE_BUFFERSIZE;
2004 2015
2005 qc->waiting = &wait; 2016 qc->complete_fn = atapi_sense_complete;
2006 qc->complete_fn = ata_qc_complete_noop;
2007
2008 spin_lock_irqsave(&ap->host_set->lock, flags);
2009 rc = ata_qc_issue(qc);
2010 spin_unlock_irqrestore(&ap->host_set->lock, flags);
2011 2017
2012 if (rc) 2018 if (ata_qc_issue(qc))
2013 ata_port_disable(ap); 2019 ata_qc_complete(qc, AC_ERR_OTHER);
2014 else
2015 wait_for_completion(&wait);
2016 2020
2017 DPRINTK("EXIT\n"); 2021 DPRINTK("EXIT\n");
2018} 2022}
@@ -2024,19 +2028,8 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
2024 VPRINTK("ENTER, err_mask 0x%X\n", err_mask); 2028 VPRINTK("ENTER, err_mask 0x%X\n", err_mask);
2025 2029
2026 if (unlikely(err_mask & AC_ERR_DEV)) { 2030 if (unlikely(err_mask & AC_ERR_DEV)) {
2027 DPRINTK("request check condition\n");
2028
2029 /* FIXME: command completion with check condition
2030 * but no sense causes the error handler to run,
2031 * which then issues REQUEST SENSE, fills in the sense
2032 * buffer, and completes the command (for the second
2033 * time). We need to issue REQUEST SENSE some other
2034 * way, to avoid completing the command twice.
2035 */
2036 cmd->result = SAM_STAT_CHECK_CONDITION; 2031 cmd->result = SAM_STAT_CHECK_CONDITION;
2037 2032 atapi_request_sense(qc);
2038 qc->scsidone(cmd);
2039
2040 return 1; 2033 return 1;
2041 } 2034 }
2042 2035
@@ -2051,7 +2044,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
2051 else { 2044 else {
2052 u8 *scsicmd = cmd->cmnd; 2045 u8 *scsicmd = cmd->cmnd;
2053 2046
2054 if (scsicmd[0] == INQUIRY) { 2047 if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
2055 u8 *buf = NULL; 2048 u8 *buf = NULL;
2056 unsigned int buflen; 2049 unsigned int buflen;
2057 2050
@@ -2065,9 +2058,6 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
2065 * device. 2) Ensure response data format / ATAPI information 2058 * device. 2) Ensure response data format / ATAPI information
2066 * are always correct. 2059 * are always correct.
2067 */ 2060 */
2068 /* FIXME: do we ever override EVPD pages and the like, with
2069 * this code?
2070 */
2071 if (buf[2] == 0) { 2061 if (buf[2] == 0) {
2072 buf[2] = 0x5; 2062 buf[2] = 0x5;
2073 buf[3] = 0x32; 2063 buf[3] = 0x32;
@@ -2180,9 +2170,12 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2180 if (unlikely(!ata_dev_present(dev))) 2170 if (unlikely(!ata_dev_present(dev)))
2181 return NULL; 2171 return NULL;
2182 2172
2183 if (!atapi_enabled) { 2173 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
2184 if (unlikely(dev->class == ATA_DEV_ATAPI)) 2174 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2175 printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n",
2176 ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled");
2185 return NULL; 2177 return NULL;
2178 }
2186 } 2179 }
2187 2180
2188 return dev; 2181 return dev;
@@ -2246,7 +2239,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2246 struct scsi_cmnd *cmd = qc->scsicmd; 2239 struct scsi_cmnd *cmd = qc->scsicmd;
2247 2240
2248 if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN) 2241 if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN)
2249 return 1; 2242 goto invalid_fld;
2250 2243
2251 /* 2244 /*
2252 * 12 and 16 byte CDBs use different offsets to 2245 * 12 and 16 byte CDBs use different offsets to
@@ -2292,6 +2285,12 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2292 tf->device = scsicmd[8]; 2285 tf->device = scsicmd[8];
2293 tf->command = scsicmd[9]; 2286 tf->command = scsicmd[9];
2294 } 2287 }
2288 /*
2289 * If slave is possible, enforce correct master/slave bit
2290 */
2291 if (qc->ap->flags & ATA_FLAG_SLAVE_POSS)
2292 tf->device = qc->dev->devno ?
2293 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
2295 2294
2296 /* 2295 /*
2297 * Filter SET_FEATURES - XFER MODE command -- otherwise, 2296 * Filter SET_FEATURES - XFER MODE command -- otherwise,
@@ -2302,7 +2301,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2302 */ 2301 */
2303 if ((tf->command == ATA_CMD_SET_FEATURES) 2302 if ((tf->command == ATA_CMD_SET_FEATURES)
2304 && (tf->feature == SETFEATURES_XFER)) 2303 && (tf->feature == SETFEATURES_XFER))
2305 return 1; 2304 goto invalid_fld;
2306 2305
2307 /* 2306 /*
2308 * Set flags so that all registers will be written, 2307 * Set flags so that all registers will be written,
@@ -2323,6 +2322,11 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2323 qc->nsect = cmd->bufflen / ATA_SECT_SIZE; 2322 qc->nsect = cmd->bufflen / ATA_SECT_SIZE;
2324 2323
2325 return 0; 2324 return 0;
2325
2326 invalid_fld:
2327 ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x24, 0x00);
2328 /* "Invalid field in cdb" */
2329 return 1;
2326} 2330}
2327 2331
2328/** 2332/**
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index fad051ca4672..8ebaa694d18e 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -29,7 +29,7 @@
29#define __LIBATA_H__ 29#define __LIBATA_H__
30 30
31#define DRV_NAME "libata" 31#define DRV_NAME "libata"
32#define DRV_VERSION "1.12" /* must be exactly four chars */ 32#define DRV_VERSION "1.20" /* must be exactly four chars */
33 33
34struct ata_scsi_args { 34struct ata_scsi_args {
35 u16 *id; 35 u16 *id;
@@ -54,8 +54,6 @@ extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
54 54
55 55
56/* libata-scsi.c */ 56/* libata-scsi.c */
57extern void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
58 struct scsi_cmnd *cmd);
59extern void ata_scsi_scan_host(struct ata_port *ap); 57extern void ata_scsi_scan_host(struct ata_port *ap);
60extern int ata_scsi_error(struct Scsi_Host *host); 58extern int ata_scsi_error(struct Scsi_Host *host);
61extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, 59extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c90723860a04..07498118359d 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1704,7 +1704,6 @@ MODULE_DEVICE_TABLE(pci, lpfc_id_table);
1704 1704
1705static struct pci_driver lpfc_driver = { 1705static struct pci_driver lpfc_driver = {
1706 .name = LPFC_DRIVER_NAME, 1706 .name = LPFC_DRIVER_NAME,
1707 .owner = THIS_MODULE,
1708 .id_table = lpfc_id_table, 1707 .id_table = lpfc_id_table,
1709 .probe = lpfc_pci_probe_one, 1708 .probe = lpfc_pci_probe_one,
1710 .remove = __devexit_p(lpfc_pci_remove_one), 1709 .remove = __devexit_p(lpfc_pci_remove_one),
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index c94c8db84651..e31fadd61904 100644
--- a/drivers/scsi/mac_esp.c
+++ b/drivers/scsi/mac_esp.c
@@ -300,7 +300,7 @@ unsigned long get_base(int chip_num)
300 * Model dependent ESP setup 300 * Model dependent ESP setup
301 */ 301 */
302 302
303int mac_esp_detect(Scsi_Host_Template * tpnt) 303int mac_esp_detect(struct scsi_host_template * tpnt)
304{ 304{
305 int quick = 0; 305 int quick = 0;
306 int chipnum, chipspresent = 0; 306 int chipnum, chipspresent = 0;
@@ -730,7 +730,7 @@ static void dma_setup_quick(struct NCR_ESP * esp, __u32 addr, int count, int wri
730#endif 730#endif
731} 731}
732 732
733static Scsi_Host_Template driver_template = { 733static struct scsi_host_template driver_template = {
734 .proc_name = "mac_esp", 734 .proc_name = "mac_esp",
735 .name = "Mac 53C9x SCSI", 735 .name = "Mac 53C9x SCSI",
736 .detect = mac_esp_detect, 736 .detect = mac_esp_detect,
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index 92d2c8379abf..777f9bcd1179 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -222,7 +222,7 @@ static struct Scsi_Host *default_instance;
222#endif 222#endif
223 223
224/* 224/*
225 * Function : int macscsi_detect(Scsi_Host_Template * tpnt) 225 * Function : int macscsi_detect(struct scsi_host_template * tpnt)
226 * 226 *
227 * Purpose : initializes mac NCR5380 driver based on the 227 * Purpose : initializes mac NCR5380 driver based on the
228 * command line / compile time port and irq definitions. 228 * command line / compile time port and irq definitions.
@@ -233,7 +233,7 @@ static struct Scsi_Host *default_instance;
233 * 233 *
234 */ 234 */
235 235
236int macscsi_detect(Scsi_Host_Template * tpnt) 236int macscsi_detect(struct scsi_host_template * tpnt)
237{ 237{
238 static int called = 0; 238 static int called = 0;
239 int flags = 0; 239 int flags = 0;
@@ -581,7 +581,7 @@ static int macscsi_pwrite (struct Scsi_Host *instance,
581 581
582#include "NCR5380.c" 582#include "NCR5380.c"
583 583
584static Scsi_Host_Template driver_template = { 584static struct scsi_host_template driver_template = {
585 .proc_name = "Mac5380", 585 .proc_name = "Mac5380",
586 .proc_info = macscsi_proc_info, 586 .proc_info = macscsi_proc_info,
587 .name = "Macintosh NCR5380 SCSI", 587 .name = "Macintosh NCR5380 SCSI",
diff --git a/drivers/scsi/mca_53c9x.c b/drivers/scsi/mca_53c9x.c
index 194c75451faf..998a8bbc1a4b 100644
--- a/drivers/scsi/mca_53c9x.c
+++ b/drivers/scsi/mca_53c9x.c
@@ -103,7 +103,7 @@ static volatile unsigned char cmd_buffer[16];
103static struct ESP_regs eregs; 103static struct ESP_regs eregs;
104 104
105/***************************************************************** Detection */ 105/***************************************************************** Detection */
106static int mca_esp_detect(Scsi_Host_Template *tpnt) 106static int mca_esp_detect(struct scsi_host_template *tpnt)
107{ 107{
108 struct NCR_ESP *esp; 108 struct NCR_ESP *esp;
109 static int io_port_by_pos[] = MCA_53C9X_IO_PORTS; 109 static int io_port_by_pos[] = MCA_53C9X_IO_PORTS;
@@ -444,7 +444,7 @@ static void dma_led_off(struct NCR_ESP *esp)
444 outb(inb(PS2_SYS_CTR) & 0x3f, PS2_SYS_CTR); 444 outb(inb(PS2_SYS_CTR) & 0x3f, PS2_SYS_CTR);
445} 445}
446 446
447static Scsi_Host_Template driver_template = { 447static struct scsi_host_template driver_template = {
448 .proc_name = "mca_53c9x", 448 .proc_name = "mca_53c9x",
449 .name = "NCR 53c9x SCSI", 449 .name = "NCR 53c9x SCSI",
450 .detect = mca_esp_detect, 450 .detect = mca_esp_detect,
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 61a6fd810bb4..578143e93a6f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -362,6 +362,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
362 adapter_t *adapter; 362 adapter_t *adapter;
363 scb_t *scb; 363 scb_t *scb;
364 int busy=0; 364 int busy=0;
365 unsigned long flags;
365 366
366 adapter = (adapter_t *)scmd->device->host->hostdata; 367 adapter = (adapter_t *)scmd->device->host->hostdata;
367 368
@@ -377,23 +378,25 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
377 * return 0 in that case. 378 * return 0 in that case.
378 */ 379 */
379 380
381 spin_lock_irqsave(&adapter->lock, flags);
380 scb = mega_build_cmd(adapter, scmd, &busy); 382 scb = mega_build_cmd(adapter, scmd, &busy);
383 if (!scb)
384 goto out;
381 385
382 if(scb) { 386 scb->state |= SCB_PENDQ;
383 scb->state |= SCB_PENDQ; 387 list_add_tail(&scb->list, &adapter->pending_list);
384 list_add_tail(&scb->list, &adapter->pending_list);
385 388
386 /* 389 /*
387 * Check if the HBA is in quiescent state, e.g., during a 390 * Check if the HBA is in quiescent state, e.g., during a
388 * delete logical drive opertion. If it is, don't run 391 * delete logical drive opertion. If it is, don't run
389 * the pending_list. 392 * the pending_list.
390 */ 393 */
391 if(atomic_read(&adapter->quiescent) == 0) { 394 if (atomic_read(&adapter->quiescent) == 0)
392 mega_runpendq(adapter); 395 mega_runpendq(adapter);
393 }
394 return 0;
395 }
396 396
397 busy = 0;
398 out:
399 spin_unlock_irqrestore(&adapter->lock, flags);
397 return busy; 400 return busy;
398} 401}
399 402
@@ -661,7 +664,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
661 sg->offset; 664 sg->offset;
662 } else 665 } else
663 buf = cmd->request_buffer; 666 buf = cmd->request_buffer;
664 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 667 memset(buf, 0, cmd->cmnd[4]);
665 if (cmd->use_sg) { 668 if (cmd->use_sg) {
666 struct scatterlist *sg; 669 struct scatterlist *sg;
667 670
@@ -1683,7 +1686,7 @@ mega_rundoneq (adapter_t *adapter)
1683 1686
1684 list_for_each(pos, &adapter->completed_list) { 1687 list_for_each(pos, &adapter->completed_list) {
1685 1688
1686 Scsi_Pointer* spos = (Scsi_Pointer *)pos; 1689 struct scsi_pointer* spos = (struct scsi_pointer *)pos;
1687 1690
1688 cmd = list_entry(spos, Scsi_Cmnd, SCp); 1691 cmd = list_entry(spos, Scsi_Cmnd, SCp);
1689 cmd->scsi_done(cmd); 1692 cmd->scsi_done(cmd);
@@ -1981,7 +1984,7 @@ megaraid_reset(struct scsi_cmnd *cmd)
1981 mc.cmd = MEGA_CLUSTER_CMD; 1984 mc.cmd = MEGA_CLUSTER_CMD;
1982 mc.opcode = MEGA_RESET_RESERVATIONS; 1985 mc.opcode = MEGA_RESET_RESERVATIONS;
1983 1986
1984 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { 1987 if( mega_internal_command(adapter, &mc, NULL) != 0 ) {
1985 printk(KERN_WARNING 1988 printk(KERN_WARNING
1986 "megaraid: reservation reset failed.\n"); 1989 "megaraid: reservation reset failed.\n");
1987 } 1990 }
@@ -3011,7 +3014,7 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
3011 mc.cmd = FC_NEW_CONFIG; 3014 mc.cmd = FC_NEW_CONFIG;
3012 mc.opcode = OP_DCMD_READ_CONFIG; 3015 mc.opcode = OP_DCMD_READ_CONFIG;
3013 3016
3014 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) { 3017 if( mega_internal_command(adapter, &mc, NULL) ) {
3015 3018
3016 len = sprintf(page, "40LD read config failed.\n"); 3019 len = sprintf(page, "40LD read config failed.\n");
3017 3020
@@ -3029,11 +3032,11 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
3029 else { 3032 else {
3030 mc.cmd = NEW_READ_CONFIG_8LD; 3033 mc.cmd = NEW_READ_CONFIG_8LD;
3031 3034
3032 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) { 3035 if( mega_internal_command(adapter, &mc, NULL) ) {
3033 3036
3034 mc.cmd = READ_CONFIG_8LD; 3037 mc.cmd = READ_CONFIG_8LD;
3035 3038
3036 if( mega_internal_command(adapter, LOCK_INT, &mc, 3039 if( mega_internal_command(adapter, &mc,
3037 NULL) ){ 3040 NULL) ){
3038 3041
3039 len = sprintf(page, 3042 len = sprintf(page,
@@ -3632,7 +3635,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
3632 /* 3635 /*
3633 * Issue the command 3636 * Issue the command
3634 */ 3637 */
3635 mega_internal_command(adapter, LOCK_INT, &mc, pthru); 3638 mega_internal_command(adapter, &mc, pthru);
3636 3639
3637 rval = mega_n_to_m((void __user *)arg, &mc); 3640 rval = mega_n_to_m((void __user *)arg, &mc);
3638 3641
@@ -3715,7 +3718,7 @@ freemem_and_return:
3715 /* 3718 /*
3716 * Issue the command 3719 * Issue the command
3717 */ 3720 */
3718 mega_internal_command(adapter, LOCK_INT, &mc, NULL); 3721 mega_internal_command(adapter, &mc, NULL);
3719 3722
3720 rval = mega_n_to_m((void __user *)arg, &mc); 3723 rval = mega_n_to_m((void __user *)arg, &mc);
3721 3724
@@ -4234,7 +4237,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
4234 mc.opcode = OP_DEL_LOGDRV; 4237 mc.opcode = OP_DEL_LOGDRV;
4235 mc.subopcode = logdrv; 4238 mc.subopcode = logdrv;
4236 4239
4237 rval = mega_internal_command(adapter, LOCK_INT, &mc, NULL); 4240 rval = mega_internal_command(adapter, &mc, NULL);
4238 4241
4239 /* log this event */ 4242 /* log this event */
4240 if(rval) { 4243 if(rval) {
@@ -4367,7 +4370,7 @@ mega_adapinq(adapter_t *adapter, dma_addr_t dma_handle)
4367 4370
4368 mc.xferaddr = (u32)dma_handle; 4371 mc.xferaddr = (u32)dma_handle;
4369 4372
4370 if ( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { 4373 if ( mega_internal_command(adapter, &mc, NULL) != 0 ) {
4371 return -1; 4374 return -1;
4372 } 4375 }
4373 4376
@@ -4435,7 +4438,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
4435 mc.cmd = MEGA_MBOXCMD_PASSTHRU; 4438 mc.cmd = MEGA_MBOXCMD_PASSTHRU;
4436 mc.xferaddr = (u32)pthru_dma_handle; 4439 mc.xferaddr = (u32)pthru_dma_handle;
4437 4440
4438 rval = mega_internal_command(adapter, LOCK_INT, &mc, pthru); 4441 rval = mega_internal_command(adapter, &mc, pthru);
4439 4442
4440 pci_free_consistent(pdev, sizeof(mega_passthru), pthru, 4443 pci_free_consistent(pdev, sizeof(mega_passthru), pthru,
4441 pthru_dma_handle); 4444 pthru_dma_handle);
@@ -4449,7 +4452,6 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
4449/** 4452/**
4450 * mega_internal_command() 4453 * mega_internal_command()
4451 * @adapter - pointer to our soft state 4454 * @adapter - pointer to our soft state
4452 * @ls - the scope of the exclusion lock.
4453 * @mc - the mailbox command 4455 * @mc - the mailbox command
4454 * @pthru - Passthru structure for DCDB commands 4456 * @pthru - Passthru structure for DCDB commands
4455 * 4457 *
@@ -4463,8 +4465,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
4463 * Note: parameter 'pthru' is null for non-passthru commands. 4465 * Note: parameter 'pthru' is null for non-passthru commands.
4464 */ 4466 */
4465static int 4467static int
4466mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, 4468mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
4467 mega_passthru *pthru )
4468{ 4469{
4469 Scsi_Cmnd *scmd; 4470 Scsi_Cmnd *scmd;
4470 struct scsi_device *sdev; 4471 struct scsi_device *sdev;
@@ -4508,15 +4509,8 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
4508 4509
4509 scb->idx = CMDID_INT_CMDS; 4510 scb->idx = CMDID_INT_CMDS;
4510 4511
4511 /*
4512 * Get the lock only if the caller has not acquired it already
4513 */
4514 if( ls == LOCK_INT ) spin_lock_irqsave(&adapter->lock, flags);
4515
4516 megaraid_queue(scmd, mega_internal_done); 4512 megaraid_queue(scmd, mega_internal_done);
4517 4513
4518 if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags);
4519
4520 wait_for_completion(&adapter->int_waitq); 4514 wait_for_completion(&adapter->int_waitq);
4521 4515
4522 rval = scmd->result; 4516 rval = scmd->result;
@@ -4683,7 +4677,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4683 4677
4684 adapter->flag = flag; 4678 adapter->flag = flag;
4685 spin_lock_init(&adapter->lock); 4679 spin_lock_init(&adapter->lock);
4686 scsi_assign_lock(host, &adapter->lock);
4687 4680
4688 host->cmd_per_lun = max_cmd_per_lun; 4681 host->cmd_per_lun = max_cmd_per_lun;
4689 host->max_sectors = max_sectors_per_io; 4682 host->max_sectors = max_sectors_per_io;
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index 4facf557cd19..6f9078025748 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -926,13 +926,6 @@ struct mega_hbas {
926#define MEGA_SGLIST 0x0002 926#define MEGA_SGLIST 0x0002
927 927
928/* 928/*
929 * lockscope definitions, callers can specify the lock scope with this data
930 * type. LOCK_INT would mean the caller has not acquired the lock before
931 * making the call and LOCK_EXT would mean otherwise.
932 */
933typedef enum { LOCK_INT, LOCK_EXT } lockscope_t;
934
935/*
936 * Parameters for the io-mapped controllers 929 * Parameters for the io-mapped controllers
937 */ 930 */
938 931
@@ -1062,8 +1055,7 @@ static int mega_support_random_del(adapter_t *);
1062static int mega_del_logdrv(adapter_t *, int); 1055static int mega_del_logdrv(adapter_t *, int);
1063static int mega_do_del_logdrv(adapter_t *, int); 1056static int mega_do_del_logdrv(adapter_t *, int);
1064static void mega_get_max_sgl(adapter_t *); 1057static void mega_get_max_sgl(adapter_t *);
1065static int mega_internal_command(adapter_t *, lockscope_t, megacmd_t *, 1058static int mega_internal_command(adapter_t *, megacmd_t *, mega_passthru *);
1066 mega_passthru *);
1067static void mega_internal_done(Scsi_Cmnd *); 1059static void mega_internal_done(Scsi_Cmnd *);
1068static int mega_support_cluster(adapter_t *); 1060static int mega_support_cluster(adapter_t *);
1069#endif 1061#endif
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 8e547130e97d..4675343228ad 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -96,7 +96,6 @@ typedef struct {
96 * @param dpc_h : tasklet handle 96 * @param dpc_h : tasklet handle
97 * @param pdev : pci configuration pointer for kernel 97 * @param pdev : pci configuration pointer for kernel
98 * @param host : pointer to host structure of mid-layer 98 * @param host : pointer to host structure of mid-layer
99 * @param host_lock : pointer to appropriate lock
100 * @param lock : synchronization lock for mid-layer and driver 99 * @param lock : synchronization lock for mid-layer and driver
101 * @param quiescent : driver is quiescent for now. 100 * @param quiescent : driver is quiescent for now.
102 * @param outstanding_cmds : number of commands pending in the driver 101 * @param outstanding_cmds : number of commands pending in the driver
@@ -151,7 +150,6 @@ typedef struct {
151 struct tasklet_struct dpc_h; 150 struct tasklet_struct dpc_h;
152 struct pci_dev *pdev; 151 struct pci_dev *pdev;
153 struct Scsi_Host *host; 152 struct Scsi_Host *host;
154 spinlock_t *host_lock;
155 spinlock_t lock; 153 spinlock_t lock;
156 uint8_t quiescent; 154 uint8_t quiescent;
157 int outstanding_cmds; 155 int outstanding_cmds;
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 1a3d195a2d36..4b5d420d2f4d 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -533,8 +533,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
533 533
534 // Initialize the synchronization lock for kernel and LLD 534 // Initialize the synchronization lock for kernel and LLD
535 spin_lock_init(&adapter->lock); 535 spin_lock_init(&adapter->lock);
536 adapter->host_lock = &adapter->lock;
537
538 536
539 // Initialize the command queues: the list of free SCBs and the list 537 // Initialize the command queues: the list of free SCBs and the list
540 // of pending SCBs. 538 // of pending SCBs.
@@ -715,9 +713,6 @@ megaraid_io_attach(adapter_t *adapter)
715 SCSIHOST2ADAP(host) = (caddr_t)adapter; 713 SCSIHOST2ADAP(host) = (caddr_t)adapter;
716 adapter->host = host; 714 adapter->host = host;
717 715
718 // export the parameters required by the mid-layer
719 scsi_assign_lock(host, adapter->host_lock);
720
721 host->irq = adapter->irq; 716 host->irq = adapter->irq;
722 host->unique_id = adapter->unique_id; 717 host->unique_id = adapter->unique_id;
723 host->can_queue = adapter->max_cmds; 718 host->can_queue = adapter->max_cmds;
@@ -1560,10 +1555,6 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
1560 scp->scsi_done = done; 1555 scp->scsi_done = done;
1561 scp->result = 0; 1556 scp->result = 0;
1562 1557
1563 assert_spin_locked(adapter->host_lock);
1564
1565 spin_unlock(adapter->host_lock);
1566
1567 /* 1558 /*
1568 * Allocate and build a SCB request 1559 * Allocate and build a SCB request
1569 * if_busy flag will be set if megaraid_mbox_build_cmd() command could 1560 * if_busy flag will be set if megaraid_mbox_build_cmd() command could
@@ -1573,23 +1564,16 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
1573 * return 0 in that case, and we would do the callback right away. 1564 * return 0 in that case, and we would do the callback right away.
1574 */ 1565 */
1575 if_busy = 0; 1566 if_busy = 0;
1576 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy); 1567 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy);
1577
1578 if (scb) {
1579 megaraid_mbox_runpendq(adapter, scb);
1580 }
1581
1582 spin_lock(adapter->host_lock);
1583
1584 if (!scb) { // command already completed 1568 if (!scb) { // command already completed
1585 done(scp); 1569 done(scp);
1586 return 0; 1570 return 0;
1587 } 1571 }
1588 1572
1573 megaraid_mbox_runpendq(adapter, scb);
1589 return if_busy; 1574 return if_busy;
1590} 1575}
1591 1576
1592
1593/** 1577/**
1594 * megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid 1578 * megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid
1595 * firmware lingua 1579 * firmware lingua
@@ -2546,9 +2530,7 @@ megaraid_mbox_dpc(unsigned long devp)
2546 megaraid_dealloc_scb(adapter, scb); 2530 megaraid_dealloc_scb(adapter, scb);
2547 2531
2548 // send the scsi packet back to kernel 2532 // send the scsi packet back to kernel
2549 spin_lock(adapter->host_lock);
2550 scp->scsi_done(scp); 2533 scp->scsi_done(scp);
2551 spin_unlock(adapter->host_lock);
2552 } 2534 }
2553 2535
2554 return; 2536 return;
@@ -2563,7 +2545,7 @@ megaraid_mbox_dpc(unsigned long devp)
2563 * aborted. All the commands issued to the F/W must complete. 2545 * aborted. All the commands issued to the F/W must complete.
2564 **/ 2546 **/
2565static int 2547static int
2566__megaraid_abort_handler(struct scsi_cmnd *scp) 2548megaraid_abort_handler(struct scsi_cmnd *scp)
2567{ 2549{
2568 adapter_t *adapter; 2550 adapter_t *adapter;
2569 mraid_device_t *raid_dev; 2551 mraid_device_t *raid_dev;
@@ -2577,8 +2559,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2577 adapter = SCP2ADAPTER(scp); 2559 adapter = SCP2ADAPTER(scp);
2578 raid_dev = ADAP2RAIDDEV(adapter); 2560 raid_dev = ADAP2RAIDDEV(adapter);
2579 2561
2580 assert_spin_locked(adapter->host_lock);
2581
2582 con_log(CL_ANN, (KERN_WARNING 2562 con_log(CL_ANN, (KERN_WARNING
2583 "megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n", 2563 "megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n",
2584 scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp), 2564 scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp),
@@ -2658,6 +2638,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2658 // traverse through the list of all SCB, since driver does not 2638 // traverse through the list of all SCB, since driver does not
2659 // maintain these SCBs on any list 2639 // maintain these SCBs on any list
2660 found = 0; 2640 found = 0;
2641 spin_lock_irq(&adapter->lock);
2661 for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) { 2642 for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
2662 scb = adapter->kscb_list + i; 2643 scb = adapter->kscb_list + i;
2663 2644
@@ -2680,6 +2661,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2680 } 2661 }
2681 } 2662 }
2682 } 2663 }
2664 spin_unlock_irq(&adapter->lock);
2683 2665
2684 if (!found) { 2666 if (!found) {
2685 con_log(CL_ANN, (KERN_WARNING 2667 con_log(CL_ANN, (KERN_WARNING
@@ -2696,22 +2678,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2696 return FAILED; 2678 return FAILED;
2697} 2679}
2698 2680
2699static int
2700megaraid_abort_handler(struct scsi_cmnd *scp)
2701{
2702 adapter_t *adapter;
2703 int rc;
2704
2705 adapter = SCP2ADAPTER(scp);
2706
2707 spin_lock_irq(adapter->host_lock);
2708 rc = __megaraid_abort_handler(scp);
2709 spin_unlock_irq(adapter->host_lock);
2710
2711 return rc;
2712}
2713
2714
2715/** 2681/**
2716 * megaraid_reset_handler - device reset hadler for mailbox based driver 2682 * megaraid_reset_handler - device reset hadler for mailbox based driver
2717 * @scp : reference command 2683 * @scp : reference command
@@ -2723,7 +2689,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
2723 * host 2689 * host
2724 **/ 2690 **/
2725static int 2691static int
2726__megaraid_reset_handler(struct scsi_cmnd *scp) 2692megaraid_reset_handler(struct scsi_cmnd *scp)
2727{ 2693{
2728 adapter_t *adapter; 2694 adapter_t *adapter;
2729 scb_t *scb; 2695 scb_t *scb;
@@ -2739,10 +2705,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2739 adapter = SCP2ADAPTER(scp); 2705 adapter = SCP2ADAPTER(scp);
2740 raid_dev = ADAP2RAIDDEV(adapter); 2706 raid_dev = ADAP2RAIDDEV(adapter);
2741 2707
2742 assert_spin_locked(adapter->host_lock);
2743
2744 con_log(CL_ANN, (KERN_WARNING "megaraid: reseting the host...\n"));
2745
2746 // return failure if adapter is not responding 2708 // return failure if adapter is not responding
2747 if (raid_dev->hw_error) { 2709 if (raid_dev->hw_error) {
2748 con_log(CL_ANN, (KERN_NOTICE 2710 con_log(CL_ANN, (KERN_NOTICE
@@ -2779,8 +2741,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2779 adapter->outstanding_cmds, MBOX_RESET_WAIT)); 2741 adapter->outstanding_cmds, MBOX_RESET_WAIT));
2780 } 2742 }
2781 2743
2782 spin_unlock(adapter->host_lock);
2783
2784 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; 2744 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
2785 2745
2786 recovering = adapter->outstanding_cmds; 2746 recovering = adapter->outstanding_cmds;
@@ -2806,7 +2766,7 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2806 msleep(1000); 2766 msleep(1000);
2807 } 2767 }
2808 2768
2809 spin_lock(adapter->host_lock); 2769 spin_lock(&adapter->lock);
2810 2770
2811 // If still outstanding commands, bail out 2771 // If still outstanding commands, bail out
2812 if (adapter->outstanding_cmds) { 2772 if (adapter->outstanding_cmds) {
@@ -2815,7 +2775,8 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2815 2775
2816 raid_dev->hw_error = 1; 2776 raid_dev->hw_error = 1;
2817 2777
2818 return FAILED; 2778 rval = FAILED;
2779 goto out;
2819 } 2780 }
2820 else { 2781 else {
2821 con_log(CL_ANN, (KERN_NOTICE 2782 con_log(CL_ANN, (KERN_NOTICE
@@ -2824,7 +2785,10 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2824 2785
2825 2786
2826 // If the controller supports clustering, reset reservations 2787 // If the controller supports clustering, reset reservations
2827 if (!adapter->ha) return SUCCESS; 2788 if (!adapter->ha) {
2789 rval = SUCCESS;
2790 goto out;
2791 }
2828 2792
2829 // clear reservations if any 2793 // clear reservations if any
2830 raw_mbox[0] = CLUSTER_CMD; 2794 raw_mbox[0] = CLUSTER_CMD;
@@ -2841,22 +2805,11 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2841 "megaraid: reservation reset failed\n")); 2805 "megaraid: reservation reset failed\n"));
2842 } 2806 }
2843 2807
2808 out:
2809 spin_unlock_irq(&adapter->lock);
2844 return rval; 2810 return rval;
2845} 2811}
2846 2812
2847static int
2848megaraid_reset_handler(struct scsi_cmnd *cmd)
2849{
2850 int rc;
2851
2852 spin_lock_irq(cmd->device->host->host_lock);
2853 rc = __megaraid_reset_handler(cmd);
2854 spin_unlock_irq(cmd->device->host->host_lock);
2855
2856 return rc;
2857}
2858
2859
2860/* 2813/*
2861 * START: internal commands library 2814 * START: internal commands library
2862 * 2815 *
@@ -3776,9 +3729,9 @@ wait_till_fw_empty(adapter_t *adapter)
3776 /* 3729 /*
3777 * Set the quiescent flag to stop issuing cmds to FW. 3730 * Set the quiescent flag to stop issuing cmds to FW.
3778 */ 3731 */
3779 spin_lock_irqsave(adapter->host_lock, flags); 3732 spin_lock_irqsave(&adapter->lock, flags);
3780 adapter->quiescent++; 3733 adapter->quiescent++;
3781 spin_unlock_irqrestore(adapter->host_lock, flags); 3734 spin_unlock_irqrestore(&adapter->lock, flags);
3782 3735
3783 /* 3736 /*
3784 * Wait till there are no more cmds outstanding at FW. Try for at most 3737 * Wait till there are no more cmds outstanding at FW. Try for at most
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 801a63bea8a5..3c32e69afcd9 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -766,17 +766,12 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd)
766 return FAILED; 766 return FAILED;
767 } 767 }
768 768
769 spin_unlock(scmd->device->host->host_lock);
770
771 ret_val = megasas_wait_for_outstanding(instance); 769 ret_val = megasas_wait_for_outstanding(instance);
772
773 if (ret_val == SUCCESS) 770 if (ret_val == SUCCESS)
774 printk(KERN_NOTICE "megasas: reset successful \n"); 771 printk(KERN_NOTICE "megasas: reset successful \n");
775 else 772 else
776 printk(KERN_ERR "megasas: failed to do reset\n"); 773 printk(KERN_ERR "megasas: failed to do reset\n");
777 774
778 spin_lock(scmd->device->host->host_lock);
779
780 return ret_val; 775 return ret_val;
781} 776}
782 777
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
index 33380cee9b77..cb367c2c5c78 100644
--- a/drivers/scsi/mvme147.c
+++ b/drivers/scsi/mvme147.c
@@ -63,7 +63,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
63 m147_pcc->dma_cntrl = 0; 63 m147_pcc->dma_cntrl = 0;
64} 64}
65 65
66int mvme147_detect(Scsi_Host_Template *tpnt) 66int mvme147_detect(struct scsi_host_template *tpnt)
67{ 67{
68 static unsigned char called = 0; 68 static unsigned char called = 0;
69 wd33c93_regs regs; 69 wd33c93_regs regs;
@@ -130,7 +130,7 @@ static int mvme147_bus_reset(Scsi_Cmnd *cmd)
130 130
131#include "mvme147.h" 131#include "mvme147.h"
132 132
133static Scsi_Host_Template driver_template = { 133static struct scsi_host_template driver_template = {
134 .proc_name = "MVME147", 134 .proc_name = "MVME147",
135 .name = "MVME147 built-in SCSI", 135 .name = "MVME147 built-in SCSI",
136 .detect = mvme147_detect, 136 .detect = mvme147_detect,
diff --git a/drivers/scsi/mvme147.h b/drivers/scsi/mvme147.h
index d8903f096182..2f56d69bd180 100644
--- a/drivers/scsi/mvme147.h
+++ b/drivers/scsi/mvme147.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13int mvme147_detect(Scsi_Host_Template *); 13int mvme147_detect(struct scsi_host_template *);
14int mvme147_release(struct Scsi_Host *); 14int mvme147_release(struct Scsi_Host *);
15const char *wd33c93_info(void); 15const char *wd33c93_info(void);
16int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 16int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
diff --git a/drivers/scsi/mvme16x.c b/drivers/scsi/mvme16x.c
index 29ec699e0e4d..890e9e232dab 100644
--- a/drivers/scsi/mvme16x.c
+++ b/drivers/scsi/mvme16x.c
@@ -21,7 +21,7 @@
21#include<linux/stat.h> 21#include<linux/stat.h>
22 22
23 23
24int mvme16x_scsi_detect(Scsi_Host_Template *tpnt) 24int mvme16x_scsi_detect(struct scsi_host_template *tpnt)
25{ 25{
26 static unsigned char called = 0; 26 static unsigned char called = 0;
27 int clock; 27 int clock;
@@ -61,7 +61,7 @@ static int mvme16x_scsi_release(struct Scsi_Host *shost)
61 return 0; 61 return 0;
62} 62}
63 63
64static Scsi_Host_Template driver_template = { 64static struct scsi_host_template driver_template = {
65 .name = "MVME16x NCR53c710 SCSI", 65 .name = "MVME16x NCR53c710 SCSI",
66 .detect = mvme16x_scsi_detect, 66 .detect = mvme16x_scsi_detect,
67 .release = mvme16x_scsi_release, 67 .release = mvme16x_scsi_release,
diff --git a/drivers/scsi/mvme16x.h b/drivers/scsi/mvme16x.h
index 25173c891d3c..c7a12533fb2c 100644
--- a/drivers/scsi/mvme16x.h
+++ b/drivers/scsi/mvme16x.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6int mvme16x_scsi_detect(Scsi_Host_Template *); 6int mvme16x_scsi_detect(struct scsi_host_template *);
7const char *NCR53c7x0_info(void); 7const char *NCR53c7x0_info(void);
8int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 8int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
9int NCR53c7xx_abort(Scsi_Cmnd *); 9int NCR53c7xx_abort(Scsi_Cmnd *);
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index e4ff4f00676d..a279ebb61447 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -198,7 +198,7 @@ static void __devexit nsp32_remove(struct pci_dev *);
198static int __init init_nsp32 (void); 198static int __init init_nsp32 (void);
199static void __exit exit_nsp32 (void); 199static void __exit exit_nsp32 (void);
200 200
201/* struct Scsi_Host_Template */ 201/* struct struct scsi_host_template */
202#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) 202#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73))
203static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); 203static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int);
204#else 204#else
@@ -208,7 +208,7 @@ static int nsp32_proc_info (char *, char **, off_t, int, int, int);
208#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) 208#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73))
209static int nsp32_detect (struct pci_dev *pdev); 209static int nsp32_detect (struct pci_dev *pdev);
210#else 210#else
211static int nsp32_detect (Scsi_Host_Template *); 211static int nsp32_detect (struct scsi_host_template *);
212#endif 212#endif
213static int nsp32_queuecommand(struct scsi_cmnd *, 213static int nsp32_queuecommand(struct scsi_cmnd *,
214 void (*done)(struct scsi_cmnd *)); 214 void (*done)(struct scsi_cmnd *));
@@ -2683,7 +2683,7 @@ static int nsp32_detect(struct pci_dev *pdev)
2683#define DETECT_OK 1 2683#define DETECT_OK 1
2684#define DETECT_NG 0 2684#define DETECT_NG 0
2685#define PCIDEV (data->Pci) 2685#define PCIDEV (data->Pci)
2686static int nsp32_detect(Scsi_Host_Template *sht) 2686static int nsp32_detect(struct scsi_host_template *sht)
2687#endif 2687#endif
2688{ 2688{
2689 struct Scsi_Host *host; /* registered host structure */ 2689 struct Scsi_Host *host; /* registered host structure */
diff --git a/drivers/scsi/oktagon_esp.c b/drivers/scsi/oktagon_esp.c
index 573d7ef93f08..5d9c9ada814f 100644
--- a/drivers/scsi/oktagon_esp.c
+++ b/drivers/scsi/oktagon_esp.c
@@ -114,7 +114,7 @@ static volatile unsigned char cmd_buffer[16];
114 */ 114 */
115 115
116/***************************************************************** Detection */ 116/***************************************************************** Detection */
117int oktagon_esp_detect(Scsi_Host_Template *tpnt) 117int oktagon_esp_detect(struct scsi_host_template *tpnt)
118{ 118{
119 struct NCR_ESP *esp; 119 struct NCR_ESP *esp;
120 struct zorro_dev *z = NULL; 120 struct zorro_dev *z = NULL;
@@ -585,7 +585,7 @@ int oktagon_esp_release(struct Scsi_Host *instance)
585} 585}
586 586
587 587
588static Scsi_Host_Template driver_template = { 588static struct scsi_host_template driver_template = {
589 .proc_name = "esp-oktagon", 589 .proc_name = "esp-oktagon",
590 .proc_info = &esp_proc_info, 590 .proc_info = &esp_proc_info,
591 .name = "BSC Oktagon SCSI", 591 .name = "BSC Oktagon SCSI",
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c
index 72bc947e45b6..f09e94af9ade 100644
--- a/drivers/scsi/pas16.c
+++ b/drivers/scsi/pas16.c
@@ -369,7 +369,7 @@ void __init pas16_setup(char *str, int *ints)
369} 369}
370 370
371/* 371/*
372 * Function : int pas16_detect(Scsi_Host_Template * tpnt) 372 * Function : int pas16_detect(struct scsi_host_template * tpnt)
373 * 373 *
374 * Purpose : detects and initializes PAS16 controllers 374 * Purpose : detects and initializes PAS16 controllers
375 * that were autoprobed, overridden on the LILO command line, 375 * that were autoprobed, overridden on the LILO command line,
@@ -381,7 +381,7 @@ void __init pas16_setup(char *str, int *ints)
381 * 381 *
382 */ 382 */
383 383
384int __init pas16_detect(Scsi_Host_Template * tpnt) 384int __init pas16_detect(struct scsi_host_template * tpnt)
385{ 385{
386 static int current_override = 0; 386 static int current_override = 0;
387 static unsigned short current_base = 0; 387 static unsigned short current_base = 0;
@@ -615,7 +615,7 @@ static int pas16_release(struct Scsi_Host *shost)
615 return 0; 615 return 0;
616} 616}
617 617
618static Scsi_Host_Template driver_template = { 618static struct scsi_host_template driver_template = {
619 .name = "Pro Audio Spectrum-16 SCSI", 619 .name = "Pro Audio Spectrum-16 SCSI",
620 .detect = pas16_detect, 620 .detect = pas16_detect,
621 .release = pas16_release, 621 .release = pas16_release,
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h
index 65ce1cc40d9a..8dc5b1a5f5da 100644
--- a/drivers/scsi/pas16.h
+++ b/drivers/scsi/pas16.h
@@ -117,7 +117,7 @@
117static int pas16_abort(Scsi_Cmnd *); 117static int pas16_abort(Scsi_Cmnd *);
118static int pas16_biosparam(struct scsi_device *, struct block_device *, 118static int pas16_biosparam(struct scsi_device *, struct block_device *,
119 sector_t, int*); 119 sector_t, int*);
120static int pas16_detect(Scsi_Host_Template *); 120static int pas16_detect(struct scsi_host_template *);
121static int pas16_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 121static int pas16_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
122static int pas16_bus_reset(Scsi_Cmnd *); 122static int pas16_bus_reset(Scsi_Cmnd *);
123 123
diff --git a/drivers/scsi/pci2000.h b/drivers/scsi/pci2000.h
index 6c962d7dca47..0ebd8ce9e1de 100644
--- a/drivers/scsi/pci2000.h
+++ b/drivers/scsi/pci2000.h
@@ -184,7 +184,7 @@ typedef struct _INQUIRYDATA
184#endif 184#endif
185 185
186// function prototypes 186// function prototypes
187int Pci2000_Detect (Scsi_Host_Template *tpnt); 187int Pci2000_Detect (struct scsi_host_template *tpnt);
188int Pci2000_Command (Scsi_Cmnd *SCpnt); 188int Pci2000_Command (Scsi_Cmnd *SCpnt);
189int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)); 189int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
190int Pci2000_Abort (Scsi_Cmnd *SCpnt); 190int Pci2000_Abort (Scsi_Cmnd *SCpnt);
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 3d2f71051fe5..050ea13ff80b 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -81,7 +81,7 @@ module_param(free_ports, bool, 0);
81MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 (=no))"); 81MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 (=no))");
82 82
83/* /usr/src/linux/drivers/scsi/hosts.h */ 83/* /usr/src/linux/drivers/scsi/hosts.h */
84static Scsi_Host_Template nsp_driver_template = { 84static struct scsi_host_template nsp_driver_template = {
85 .proc_name = "nsp_cs", 85 .proc_name = "nsp_cs",
86 .proc_info = nsp_proc_info, 86 .proc_info = nsp_proc_info,
87 .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", 87 .name = "WorkBit NinjaSCSI-3/32Bi(16bit)",
@@ -1310,7 +1310,7 @@ timer_out:
1310/*----------------------------------------------------------------*/ 1310/*----------------------------------------------------------------*/
1311/* look for ninja3 card and init if found */ 1311/* look for ninja3 card and init if found */
1312/*----------------------------------------------------------------*/ 1312/*----------------------------------------------------------------*/
1313static struct Scsi_Host *nsp_detect(Scsi_Host_Template *sht) 1313static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht)
1314{ 1314{
1315 struct Scsi_Host *host; /* registered host structure */ 1315 struct Scsi_Host *host; /* registered host structure */
1316 nsp_hw_data *data_b = &nsp_data_base, *data; 1316 nsp_hw_data *data_b = &nsp_data_base, *data;
@@ -1358,7 +1358,7 @@ static struct Scsi_Host *nsp_detect(Scsi_Host_Template *sht)
1358} 1358}
1359 1359
1360#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) 1360#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1361static int nsp_detect_old(Scsi_Host_Template *sht) 1361static int nsp_detect_old(struct scsi_host_template *sht)
1362{ 1362{
1363 if (nsp_detect(sht) == NULL) { 1363 if (nsp_detect(sht) == NULL) {
1364 return 0; 1364 return 0;
@@ -1717,7 +1717,7 @@ static void nsp_cs_config(dev_link_t *link)
1717 struct Scsi_Host *host; 1717 struct Scsi_Host *host;
1718 nsp_hw_data *data = &nsp_data_base; 1718 nsp_hw_data *data = &nsp_data_base;
1719#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) 1719#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74))
1720 Scsi_Device *dev; 1720 struct scsi_device *dev;
1721 dev_node_t **tail, *node; 1721 dev_node_t **tail, *node;
1722#endif 1722#endif
1723 1723
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index c201b52e063a..f8b943082717 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -303,9 +303,9 @@ static void nsp_cs_config (dev_link_t *link);
303static int nsp_cs_event (event_t event, int priority, event_callback_args_t *args); 303static int nsp_cs_event (event_t event, int priority, event_callback_args_t *args);
304 304
305/* Linux SCSI subsystem specific functions */ 305/* Linux SCSI subsystem specific functions */
306static struct Scsi_Host *nsp_detect (Scsi_Host_Template *sht); 306static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht);
307#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) 307#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
308static int nsp_detect_old (Scsi_Host_Template *sht); 308static int nsp_detect_old (struct scsi_host_template *sht);
309static int nsp_release_old(struct Scsi_Host *shpnt); 309static int nsp_release_old(struct Scsi_Host *shpnt);
310#endif 310#endif
311static const char *nsp_info (struct Scsi_Host *shpnt); 311static const char *nsp_info (struct Scsi_Host *shpnt);
@@ -345,7 +345,7 @@ static int nsp_expect_signal (Scsi_Cmnd *SCpnt, unsigned char current_phase,
345static int nsp_xfer (Scsi_Cmnd *SCpnt, int phase); 345static int nsp_xfer (Scsi_Cmnd *SCpnt, int phase);
346static int nsp_dataphase_bypass (Scsi_Cmnd *SCpnt); 346static int nsp_dataphase_bypass (Scsi_Cmnd *SCpnt);
347static int nsp_reselected (Scsi_Cmnd *SCpnt); 347static int nsp_reselected (Scsi_Cmnd *SCpnt);
348static struct Scsi_Host *nsp_detect(Scsi_Host_Template *sht); 348static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht);
349 349
350/* Interrupt handler */ 350/* Interrupt handler */
351//static irqreturn_t nspintr(int irq, void *dev_id, struct pt_regs *regs); 351//static irqreturn_t nspintr(int irq, void *dev_id, struct pt_regs *regs);
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 7a516f35834e..bb091a45a880 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -72,7 +72,7 @@ static char *version = "qlogic_cs.c 1.79-ac 2002/10/26 (David Hinds)";
72#define DEBUG(n, args...) 72#define DEBUG(n, args...)
73#endif 73#endif
74 74
75static Scsi_Host_Template qlogicfas_driver_template = { 75static struct scsi_host_template qlogicfas_driver_template = {
76 .module = THIS_MODULE, 76 .module = THIS_MODULE,
77 .name = qlogic_name, 77 .name = qlogic_name,
78 .proc_name = qlogic_name, 78 .proc_name = qlogic_name,
@@ -108,7 +108,7 @@ static dev_link_t *dev_list = NULL;
108 108
109static dev_info_t dev_info = "qlogic_cs"; 109static dev_info_t dev_info = "qlogic_cs";
110 110
111static struct Scsi_Host *qlogic_detect(Scsi_Host_Template *host, 111static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host,
112 dev_link_t *link, int qbase, int qlirq) 112 dev_link_t *link, int qbase, int qlirq)
113{ 113{
114 int qltyp; /* type of chip */ 114 int qltyp; /* type of chip */
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 78b4ff117af6..f557f17ca00c 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -190,7 +190,7 @@ static struct ata_port_info adma_port_info[] = {
190 }, 190 },
191}; 191};
192 192
193static struct pci_device_id adma_ata_pci_tbl[] = { 193static const struct pci_device_id adma_ata_pci_tbl[] = {
194 { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 194 { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
195 board_1841_idx }, 195 board_1841_idx },
196 196
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c
index c89da7d5b6df..46624ab9c3d2 100644
--- a/drivers/scsi/pluto.c
+++ b/drivers/scsi/pluto.c
@@ -71,7 +71,7 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt)
71 up(&fc_sem); 71 up(&fc_sem);
72} 72}
73 73
74int pluto_slave_configure(Scsi_Device *device) 74int pluto_slave_configure(struct scsi_device *device)
75{ 75{
76 int depth_to_use; 76 int depth_to_use;
77 77
@@ -90,11 +90,11 @@ int pluto_slave_configure(Scsi_Device *device)
90 90
91/* Detect all SSAs attached to the machine. 91/* Detect all SSAs attached to the machine.
92 To be fast, do it on all online FC channels at the same time. */ 92 To be fast, do it on all online FC channels at the same time. */
93int __init pluto_detect(Scsi_Host_Template *tpnt) 93int __init pluto_detect(struct scsi_host_template *tpnt)
94{ 94{
95 int i, retry, nplutos; 95 int i, retry, nplutos;
96 fc_channel *fc; 96 fc_channel *fc;
97 Scsi_Device dev; 97 struct scsi_device dev;
98 DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0); 98 DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0);
99 99
100 tpnt->proc_name = "pluto"; 100 tpnt->proc_name = "pluto";
@@ -339,7 +339,7 @@ static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cm
339 return 0; 339 return 0;
340} 340}
341 341
342static Scsi_Host_Template driver_template = { 342static struct scsi_host_template driver_template = {
343 .name = "Sparc Storage Array 100/200", 343 .name = "Sparc Storage Array 100/200",
344 .detect = pluto_detect, 344 .detect = pluto_detect,
345 .release = pluto_release, 345 .release = pluto_release,
diff --git a/drivers/scsi/pluto.h b/drivers/scsi/pluto.h
index beb844aafccd..5da20616ac36 100644
--- a/drivers/scsi/pluto.h
+++ b/drivers/scsi/pluto.h
@@ -38,10 +38,10 @@ struct pluto_inquiry {
38/* This is the max number of outstanding SCSI commands per pluto */ 38/* This is the max number of outstanding SCSI commands per pluto */
39#define PLUTO_CAN_QUEUE 254 39#define PLUTO_CAN_QUEUE 254
40 40
41int pluto_detect(Scsi_Host_Template *); 41int pluto_detect(struct scsi_host_template *);
42int pluto_release(struct Scsi_Host *); 42int pluto_release(struct Scsi_Host *);
43const char * pluto_info(struct Scsi_Host *); 43const char * pluto_info(struct Scsi_Host *);
44int pluto_slave_configure(Scsi_Device *); 44int pluto_slave_configure(struct scsi_device *);
45 45
46#endif /* !(_PLUTO_H) */ 46#endif /* !(_PLUTO_H) */
47 47
diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c
index 4322c95c995c..5c2cdf523c3b 100644
--- a/drivers/scsi/psi240i.c
+++ b/drivers/scsi/psi240i.c
@@ -538,7 +538,7 @@ static void ReadChipMemory (void *pdata, USHORT base, USHORT length, USHORT port
538 * Returns: Number of adapters found. 538 * Returns: Number of adapters found.
539 * 539 *
540 ****************************************************************/ 540 ****************************************************************/
541static int Psi240i_Detect (Scsi_Host_Template *tpnt) 541static int Psi240i_Detect (struct scsi_host_template *tpnt)
542 { 542 {
543 int board; 543 int board;
544 int count = 0; 544 int count = 0;
@@ -669,7 +669,7 @@ static int Psi240i_BiosParam (struct scsi_device *sdev, struct block_device *dev
669 669
670MODULE_LICENSE("GPL"); 670MODULE_LICENSE("GPL");
671 671
672static Scsi_Host_Template driver_template = { 672static struct scsi_host_template driver_template = {
673 .proc_name = "psi240i", 673 .proc_name = "psi240i",
674 .name = "PSI-240I EIDE Disk Controller", 674 .name = "PSI-240I EIDE Disk Controller",
675 .detect = Psi240i_Detect, 675 .detect = Psi240i_Detect,
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 637fb6565d28..0878f95b5449 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -465,7 +465,7 @@ scsi_adjust_queue_depth(struct scsi_device *device, int tag, int depth)
465 } 465 }
466 device->queue_depth = depth; 466 device->queue_depth = depth;
467} 467}
468static inline struct Scsi_Host *scsi_host_alloc(Scsi_Host_Template *t, size_t s) 468static inline struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *t, size_t s)
469{ 469{
470 return scsi_register(t, s); 470 return scsi_register(t, s);
471} 471}
@@ -639,10 +639,8 @@ struct qla_boards {
639static struct pci_device_id qla1280_pci_tbl[] = { 639static struct pci_device_id qla1280_pci_tbl[] = {
640 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP12160, 640 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP12160,
641 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 641 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
642#ifdef CONFIG_SCSI_QLOGIC_1280_1040
643 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1020, 642 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1020,
644 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 643 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
645#endif
646 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1080, 644 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1080,
647 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 645 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
648 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1240, 646 {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1240,
@@ -1177,7 +1175,7 @@ qla1280_biosparam(struct scsi_device *sdev, struct block_device *bdev,
1177 1175
1178#if LINUX_VERSION_CODE < 0x020600 1176#if LINUX_VERSION_CODE < 0x020600
1179static int 1177static int
1180qla1280_detect(Scsi_Host_Template *template) 1178qla1280_detect(struct scsi_host_template *template)
1181{ 1179{
1182 struct pci_device_id *id = &qla1280_pci_tbl[0]; 1180 struct pci_device_id *id = &qla1280_pci_tbl[0];
1183 struct pci_dev *pdev = NULL; 1181 struct pci_dev *pdev = NULL;
@@ -4507,7 +4505,7 @@ static struct scsi_host_template qla1280_driver_template = {
4507 .use_clustering = ENABLE_CLUSTERING, 4505 .use_clustering = ENABLE_CLUSTERING,
4508}; 4506};
4509#else 4507#else
4510static Scsi_Host_Template qla1280_driver_template = { 4508static struct scsi_host_template qla1280_driver_template = {
4511 .proc_name = "qla1280", 4509 .proc_name = "qla1280",
4512 .name = "Qlogic ISP 1280/12160", 4510 .name = "Qlogic ISP 1280/12160",
4513 .detect = qla1280_detect, 4511 .detect = qla1280_detect,
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 89793c1c06b1..5c5d2315cfab 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -970,7 +970,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
970 int rval; 970 int rval;
971 uint32_t cnt, timer; 971 uint32_t cnt, timer;
972 uint32_t risc_address; 972 uint32_t risc_address;
973 uint16_t mb[4]; 973 uint16_t mb[4], wd;
974 974
975 uint32_t stat; 975 uint32_t stat;
976 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 976 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
@@ -1514,10 +1514,10 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
1514 1514
1515 WRT_REG_DWORD(&reg->ctrl_status, 1515 WRT_REG_DWORD(&reg->ctrl_status,
1516 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); 1516 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
1517 RD_REG_DWORD(&reg->ctrl_status); 1517 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
1518 1518
1519 udelay(100);
1519 /* Wait for firmware to complete NVRAM accesses. */ 1520 /* Wait for firmware to complete NVRAM accesses. */
1520 udelay(5);
1521 mb[0] = (uint32_t) RD_REG_WORD(&reg->mailbox0); 1521 mb[0] = (uint32_t) RD_REG_WORD(&reg->mailbox0);
1522 for (cnt = 10000 ; cnt && mb[0]; cnt--) { 1522 for (cnt = 10000 ; cnt && mb[0]; cnt--) {
1523 udelay(5); 1523 udelay(5);
@@ -1525,7 +1525,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
1525 barrier(); 1525 barrier();
1526 } 1526 }
1527 1527
1528 udelay(20); 1528 /* Wait for soft-reset to complete. */
1529 for (cnt = 0; cnt < 30000; cnt++) { 1529 for (cnt = 0; cnt < 30000; cnt++) {
1530 if ((RD_REG_DWORD(&reg->ctrl_status) & 1530 if ((RD_REG_DWORD(&reg->ctrl_status) &
1531 CSRX_ISP_SOFT_RESET) == 0) 1531 CSRX_ISP_SOFT_RESET) == 0)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7096945ea234..7b3efd531297 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2476,17 +2476,9 @@ typedef struct scsi_qla_host {
2476 */ 2476 */
2477#define LOOP_TRANSITION(ha) \ 2477#define LOOP_TRANSITION(ha) \
2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2480
2481#define LOOP_NOT_READY(ha) \
2482 ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2483 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
2484 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2485 test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
2486 atomic_read(&ha->loop_state) == LOOP_DOWN) 2480 atomic_read(&ha->loop_state) == LOOP_DOWN)
2487 2481
2488#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
2489
2490#define TGT_Q(ha, t) (ha->otgt[t]) 2482#define TGT_Q(ha, t) (ha->otgt[t])
2491 2483
2492#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) 2484#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 72d9090df3df..c46d2469b85f 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -147,8 +147,8 @@ check_fw_ready_again:
147 * LIP to complete 147 * LIP to complete
148 */ 148 */
149 149
150 if (atomic_read(&ha->loop_state) == 150 if (atomic_read(&ha->loop_state) !=
151 LOOP_DOWN && retry--) { 151 LOOP_READY && retry--) {
152 goto check_fw_ready_again; 152 goto check_fw_ready_again;
153 } 153 }
154 wait_time--; 154 wait_time--;
@@ -567,6 +567,7 @@ qla24xx_reset_risc(scsi_qla_host_t *ha)
567 unsigned long flags = 0; 567 unsigned long flags = 0;
568 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 568 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
569 uint32_t cnt, d2; 569 uint32_t cnt, d2;
570 uint16_t wd;
570 571
571 spin_lock_irqsave(&ha->hardware_lock, flags); 572 spin_lock_irqsave(&ha->hardware_lock, flags);
572 573
@@ -581,10 +582,10 @@ qla24xx_reset_risc(scsi_qla_host_t *ha)
581 582
582 WRT_REG_DWORD(&reg->ctrl_status, 583 WRT_REG_DWORD(&reg->ctrl_status,
583 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); 584 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
584 RD_REG_DWORD(&reg->ctrl_status); 585 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
585 586
587 udelay(100);
586 /* Wait for firmware to complete NVRAM accesses. */ 588 /* Wait for firmware to complete NVRAM accesses. */
587 udelay(5);
588 d2 = (uint32_t) RD_REG_WORD(&reg->mailbox0); 589 d2 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
589 for (cnt = 10000 ; cnt && d2; cnt--) { 590 for (cnt = 10000 ; cnt && d2; cnt--) {
590 udelay(5); 591 udelay(5);
@@ -592,7 +593,7 @@ qla24xx_reset_risc(scsi_qla_host_t *ha)
592 barrier(); 593 barrier();
593 } 594 }
594 595
595 udelay(20); 596 /* Wait for soft-reset to complete. */
596 d2 = RD_REG_DWORD(&reg->ctrl_status); 597 d2 = RD_REG_DWORD(&reg->ctrl_status);
597 for (cnt = 6000000 ; cnt && (d2 & CSRX_ISP_SOFT_RESET); cnt--) { 598 for (cnt = 6000000 ; cnt && (d2 & CSRX_ISP_SOFT_RESET); cnt--) {
598 udelay(5); 599 udelay(5);
@@ -1258,9 +1259,15 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1258 rval = qla2x00_get_adapter_id(ha, 1259 rval = qla2x00_get_adapter_id(ha,
1259 &loop_id, &al_pa, &area, &domain, &topo); 1260 &loop_id, &al_pa, &area, &domain, &topo);
1260 if (rval != QLA_SUCCESS) { 1261 if (rval != QLA_SUCCESS) {
1261 qla_printk(KERN_WARNING, ha, 1262 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1262 "ERROR -- Unable to get host loop ID.\n"); 1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
1263 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); 1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
1265 __func__, ha->host_no));
1266 } else {
1267 qla_printk(KERN_WARNING, ha,
1268 "ERROR -- Unable to get host loop ID.\n");
1269 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
1270 }
1264 return (rval); 1271 return (rval);
1265 } 1272 }
1266 1273
@@ -1789,7 +1796,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1789 } 1796 }
1790 1797
1791 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { 1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
1792 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) { 1799 if (LOOP_TRANSITION(ha)) {
1793 rval = QLA_FUNCTION_FAILED; 1800 rval = QLA_FUNCTION_FAILED;
1794 } else { 1801 } else {
1795 rval = qla2x00_configure_fabric(ha); 1802 rval = qla2x00_configure_fabric(ha);
@@ -2362,8 +2369,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2362 if (qla2x00_is_reserved_id(ha, loop_id)) 2369 if (qla2x00_is_reserved_id(ha, loop_id))
2363 continue; 2370 continue;
2364 2371
2365 if (atomic_read(&ha->loop_down_timer) || 2372 if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha))
2366 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
2367 break; 2373 break;
2368 2374
2369 if (swl != NULL) { 2375 if (swl != NULL) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 09afc0f06bd4..5181d966fecb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
909 resid = resid_len; 909 resid = resid_len;
910 cp->resid = resid; 910 cp->resid = resid;
911 CMD_RESID_LEN(cp) = resid; 911 CMD_RESID_LEN(cp) = resid;
912
913 if (!lscsi_status &&
914 ((unsigned)(cp->request_bufflen - resid) <
915 cp->underflow)) {
916 qla_printk(KERN_INFO, ha,
917 "scsi(%ld:%d:%d:%d): Mid-layer underflow "
918 "detected (%x of %x bytes)...returning "
919 "error status.\n", ha->host_no,
920 cp->device->channel, cp->device->id,
921 cp->device->lun, resid,
922 cp->request_bufflen);
923
924 cp->result = DID_ERROR << 16;
925 break;
926 }
912 } 927 }
913 cp->result = DID_OK << 16 | lscsi_status; 928 cp->result = DID_OK << 16 | lscsi_status;
914 929
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index ad3cacb9192d..9746cd1e664b 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -868,10 +868,6 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp)
868 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no);) 868 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no);)
869 869
870 fcport = sp->fcport; 870 fcport = sp->fcport;
871 if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
872 atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
873 return 1;
874 }
875 871
876 spin_lock_irqsave(&ha->hardware_lock, flags); 872 spin_lock_irqsave(&ha->hardware_lock, flags);
877 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 873 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
@@ -1008,6 +1004,8 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa,
1008 mcp->tov = 30; 1004 mcp->tov = 30;
1009 mcp->flags = 0; 1005 mcp->flags = 0;
1010 rval = qla2x00_mailbox_command(ha, mcp); 1006 rval = qla2x00_mailbox_command(ha, mcp);
1007 if (mcp->mb[0] == MBS_COMMAND_ERROR)
1008 rval = QLA_COMMAND_ERROR;
1011 1009
1012 /* Return data. */ 1010 /* Return data. */
1013 *id = mcp->mb[1]; 1011 *id = mcp->mb[1];
@@ -2179,10 +2177,6 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
2179 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 2177 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
2180 2178
2181 fcport = sp->fcport; 2179 fcport = sp->fcport;
2182 if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
2183 atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
2184 return QLA_FUNCTION_FAILED;
2185 }
2186 2180
2187 spin_lock_irqsave(&ha->hardware_lock, flags); 2181 spin_lock_irqsave(&ha->hardware_lock, flags);
2188 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 2182 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 4bec0b4fb6b4..d54d2a99c3d3 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -126,6 +126,7 @@ qla2x00_write_nvram_word(scsi_qla_host_t *ha, uint32_t addr, uint16_t data)
126 126
127 /* Wait for NVRAM to become ready */ 127 /* Wait for NVRAM to become ready */
128 WRT_REG_WORD(&reg->nvram, NVR_SELECT); 128 WRT_REG_WORD(&reg->nvram, NVR_SELECT);
129 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
129 do { 130 do {
130 NVRAM_DELAY(); 131 NVRAM_DELAY();
131 word = RD_REG_WORD(&reg->nvram); 132 word = RD_REG_WORD(&reg->nvram);
@@ -178,6 +179,7 @@ qla2x00_write_nvram_word_tmo(scsi_qla_host_t *ha, uint32_t addr, uint16_t data,
178 179
179 /* Wait for NVRAM to become ready */ 180 /* Wait for NVRAM to become ready */
180 WRT_REG_WORD(&reg->nvram, NVR_SELECT); 181 WRT_REG_WORD(&reg->nvram, NVR_SELECT);
182 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
181 do { 183 do {
182 NVRAM_DELAY(); 184 NVRAM_DELAY();
183 word = RD_REG_WORD(&reg->nvram); 185 word = RD_REG_WORD(&reg->nvram);
@@ -235,6 +237,7 @@ qla2x00_nvram_request(scsi_qla_host_t *ha, uint32_t nv_cmd)
235 /* Read data from NVRAM. */ 237 /* Read data from NVRAM. */
236 for (cnt = 0; cnt < 16; cnt++) { 238 for (cnt = 0; cnt < 16; cnt++) {
237 WRT_REG_WORD(&reg->nvram, NVR_SELECT | NVR_CLOCK); 239 WRT_REG_WORD(&reg->nvram, NVR_SELECT | NVR_CLOCK);
240 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
238 NVRAM_DELAY(); 241 NVRAM_DELAY();
239 data <<= 1; 242 data <<= 1;
240 reg_data = RD_REG_WORD(&reg->nvram); 243 reg_data = RD_REG_WORD(&reg->nvram);
@@ -337,6 +340,7 @@ qla2x00_clear_nvram_protection(scsi_qla_host_t *ha)
337 340
338 /* Wait for NVRAM to become ready. */ 341 /* Wait for NVRAM to become ready. */
339 WRT_REG_WORD(&reg->nvram, NVR_SELECT); 342 WRT_REG_WORD(&reg->nvram, NVR_SELECT);
343 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
340 do { 344 do {
341 NVRAM_DELAY(); 345 NVRAM_DELAY();
342 word = RD_REG_WORD(&reg->nvram); 346 word = RD_REG_WORD(&reg->nvram);
@@ -388,6 +392,7 @@ qla2x00_set_nvram_protection(scsi_qla_host_t *ha, int stat)
388 392
389 /* Wait for NVRAM to become ready. */ 393 /* Wait for NVRAM to become ready. */
390 WRT_REG_WORD(&reg->nvram, NVR_SELECT); 394 WRT_REG_WORD(&reg->nvram, NVR_SELECT);
395 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
391 do { 396 do {
392 NVRAM_DELAY(); 397 NVRAM_DELAY();
393 word = RD_REG_WORD(&reg->nvram); 398 word = RD_REG_WORD(&reg->nvram);
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 0d5472f2f59b..f7937f7f9c68 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,9 +7,9 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.01.00-k" 10#define QLA2XXX_VERSION "8.01.03-k"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 1 13#define QLA_DRIVER_MINOR_VER 1
14#define QLA_DRIVER_PATCH_VER 0 14#define QLA_DRIVER_PATCH_VER 3
15#define QLA_DRIVER_BETA_VER 0 15#define QLA_DRIVER_BETA_VER 0
diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c
index 55e698b651d6..94baca840efe 100644
--- a/drivers/scsi/qlogicfas.c
+++ b/drivers/scsi/qlogicfas.c
@@ -47,7 +47,7 @@ static char qlogicfas_name[] = "qlogicfas";
47 * Look for qlogic card and init if found 47 * Look for qlogic card and init if found
48 */ 48 */
49 49
50static struct Scsi_Host *__qlogicfas_detect(Scsi_Host_Template *host, 50static struct Scsi_Host *__qlogicfas_detect(struct scsi_host_template *host,
51 int qbase, 51 int qbase,
52 int qlirq) 52 int qlirq)
53{ 53{
@@ -142,7 +142,7 @@ module_param_array(irq, int, NULL, 0);
142MODULE_PARM_DESC(iobase, "I/O address"); 142MODULE_PARM_DESC(iobase, "I/O address");
143MODULE_PARM_DESC(irq, "IRQ"); 143MODULE_PARM_DESC(irq, "IRQ");
144 144
145static int __devinit qlogicfas_detect(Scsi_Host_Template *sht) 145static int __devinit qlogicfas_detect(struct scsi_host_template *sht)
146{ 146{
147 struct Scsi_Host *shost; 147 struct Scsi_Host *shost;
148 struct qlogicfas408_priv *priv; 148 struct qlogicfas408_priv *priv;
@@ -183,7 +183,7 @@ static int qlogicfas_release(struct Scsi_Host *shost)
183/* 183/*
184 * The driver template is also needed for PCMCIA 184 * The driver template is also needed for PCMCIA
185 */ 185 */
186static Scsi_Host_Template qlogicfas_driver_template = { 186static struct scsi_host_template qlogicfas_driver_template = {
187 .module = THIS_MODULE, 187 .module = THIS_MODULE,
188 .name = qlogicfas_name, 188 .name = qlogicfas_name,
189 .proc_name = qlogicfas_name, 189 .proc_name = qlogicfas_name,
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
index a4b3b3fd4815..94ef3f08d378 100644
--- a/drivers/scsi/qlogicfc.c
+++ b/drivers/scsi/qlogicfc.c
@@ -711,7 +711,7 @@ static inline void isp2x00_disable_irqs(struct Scsi_Host *host)
711} 711}
712 712
713 713
714static int isp2x00_detect(Scsi_Host_Template * tmpt) 714static int isp2x00_detect(struct scsi_host_template * tmpt)
715{ 715{
716 int hosts = 0; 716 int hosts = 0;
717 unsigned long wait_time; 717 unsigned long wait_time;
@@ -2210,7 +2210,7 @@ void isp2x00_print_scsi_cmd(Scsi_Cmnd * cmd)
2210 2210
2211MODULE_LICENSE("GPL"); 2211MODULE_LICENSE("GPL");
2212 2212
2213static Scsi_Host_Template driver_template = { 2213static struct scsi_host_template driver_template = {
2214 .detect = isp2x00_detect, 2214 .detect = isp2x00_detect,
2215 .release = isp2x00_release, 2215 .release = isp2x00_release,
2216 .info = isp2x00_info, 2216 .info = isp2x00_info,
diff --git a/drivers/scsi/qlogicisp.c b/drivers/scsi/qlogicisp.c
deleted file mode 100644
index 6c9266b8ffdf..000000000000
--- a/drivers/scsi/qlogicisp.c
+++ /dev/null
@@ -1,1934 +0,0 @@
1/*
2 * QLogic ISP1020 Intelligent SCSI Processor Driver (PCI)
3 * Written by Erik H. Moe, ehm@cris.com
4 * Copyright 1995, Erik H. Moe
5 * Copyright 1996, 1997 Michael A. Griffith <grif@acm.org>
6 * Copyright 2000, Jayson C. Vantuyl <vantuyl@csc.smsu.edu>
7 * and Bryon W. Roche <bryon@csc.smsu.edu>
8 *
9 * 64-bit addressing added by Kanoj Sarcar <kanoj@sgi.com>
10 * and Leo Dagum <dagum@sgi.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2, or (at your option) any
15 * later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 */
22
23#include <linux/blkdev.h>
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/string.h>
27#include <linux/ioport.h>
28#include <linux/sched.h>
29#include <linux/types.h>
30#include <linux/pci.h>
31#include <linux/delay.h>
32#include <linux/unistd.h>
33#include <linux/spinlock.h>
34#include <linux/interrupt.h>
35#include <asm/io.h>
36#include <asm/irq.h>
37#include <asm/byteorder.h>
38#include "scsi.h"
39#include <scsi/scsi_host.h>
40
41/*
42 * With the qlogic interface, every queue slot can hold a SCSI
43 * command with up to 4 scatter/gather entries. If we need more
44 * than 4 entries, continuation entries can be used that hold
45 * another 7 entries each. Unlike for other drivers, this means
46 * that the maximum number of scatter/gather entries we can
47 * support at any given time is a function of the number of queue
48 * slots available. That is, host->can_queue and host->sg_tablesize
49 * are dynamic and _not_ independent. This all works fine because
50 * requests are queued serially and the scatter/gather limit is
51 * determined for each queue request anew.
52 */
53#define QLOGICISP_REQ_QUEUE_LEN 63 /* must be power of two - 1 */
54#define QLOGICISP_MAX_SG(ql) (4 + ((ql) > 0) ? 7*((ql) - 1) : 0)
55
56/* Configuration section *****************************************************/
57
58/* Set the following macro to 1 to reload the ISP1020's firmware. This is
59 the latest firmware provided by QLogic. This may be an earlier/later
60 revision than supplied by your board. */
61
62#define RELOAD_FIRMWARE 1
63
64/* Set the following macro to 1 to reload the ISP1020's defaults from nvram.
65 If you are not sure of your settings, leave this alone, the driver will
66 use a set of 'safe' defaults */
67
68#define USE_NVRAM_DEFAULTS 0
69
70/* Macros used for debugging */
71
72#define DEBUG_ISP1020 0
73#define DEBUG_ISP1020_INTR 0
74#define DEBUG_ISP1020_SETUP 0
75#define TRACE_ISP 0
76
77#define DEFAULT_LOOP_COUNT 1000000
78
79/* End Configuration section *************************************************/
80
81#include <linux/module.h>
82
83#if TRACE_ISP
84
85# define TRACE_BUF_LEN (32*1024)
86
87struct {
88 u_long next;
89 struct {
90 u_long time;
91 u_int index;
92 u_int addr;
93 u_char * name;
94 } buf[TRACE_BUF_LEN];
95} trace;
96
97#define TRACE(w, i, a) \
98{ \
99 unsigned long flags; \
100 \
101 trace.buf[trace.next].name = (w); \
102 trace.buf[trace.next].time = jiffies; \
103 trace.buf[trace.next].index = (i); \
104 trace.buf[trace.next].addr = (long) (a); \
105 trace.next = (trace.next + 1) & (TRACE_BUF_LEN - 1); \
106}
107
108#else
109# define TRACE(w, i, a)
110#endif
111
112#if DEBUG_ISP1020
113#define ENTER(x) printk("isp1020 : entering %s()\n", x);
114#define LEAVE(x) printk("isp1020 : leaving %s()\n", x);
115#define DEBUG(x) x
116#else
117#define ENTER(x)
118#define LEAVE(x)
119#define DEBUG(x)
120#endif /* DEBUG_ISP1020 */
121
122#if DEBUG_ISP1020_INTR
123#define ENTER_INTR(x) printk("isp1020 : entering %s()\n", x);
124#define LEAVE_INTR(x) printk("isp1020 : leaving %s()\n", x);
125#define DEBUG_INTR(x) x
126#else
127#define ENTER_INTR(x)
128#define LEAVE_INTR(x)
129#define DEBUG_INTR(x)
130#endif /* DEBUG ISP1020_INTR */
131
132#define ISP1020_REV_ID 1
133
134#define MAX_TARGETS 16
135#define MAX_LUNS 8
136
137/* host configuration and control registers */
138#define HOST_HCCR 0xc0 /* host command and control */
139
140/* pci bus interface registers */
141#define PCI_ID_LOW 0x00 /* vendor id */
142#define PCI_ID_HIGH 0x02 /* device id */
143#define ISP_CFG0 0x04 /* configuration register #0 */
144#define ISP_CFG0_HWMSK 0x000f /* Hardware revision mask */
145#define ISP_CFG0_1020 0x0001 /* ISP1020 */
146#define ISP_CFG0_1020A 0x0002 /* ISP1020A */
147#define ISP_CFG0_1040 0x0003 /* ISP1040 */
148#define ISP_CFG0_1040A 0x0004 /* ISP1040A */
149#define ISP_CFG0_1040B 0x0005 /* ISP1040B */
150#define ISP_CFG0_1040C 0x0006 /* ISP1040C */
151#define ISP_CFG1 0x06 /* configuration register #1 */
152#define ISP_CFG1_F128 0x0040 /* 128-byte FIFO threshold */
153#define ISP_CFG1_F64 0x0030 /* 128-byte FIFO threshold */
154#define ISP_CFG1_F32 0x0020 /* 128-byte FIFO threshold */
155#define ISP_CFG1_F16 0x0010 /* 128-byte FIFO threshold */
156#define ISP_CFG1_BENAB 0x0004 /* Global Bus burst enable */
157#define ISP_CFG1_SXP 0x0001 /* SXP register select */
158#define PCI_INTF_CTL 0x08 /* pci interface control */
159#define PCI_INTF_STS 0x0a /* pci interface status */
160#define PCI_SEMAPHORE 0x0c /* pci semaphore */
161#define PCI_NVRAM 0x0e /* pci nvram interface */
162#define CDMA_CONF 0x20 /* Command DMA Config */
163#define DDMA_CONF 0x40 /* Data DMA Config */
164#define DMA_CONF_SENAB 0x0008 /* SXP to DMA Data enable */
165#define DMA_CONF_RIRQ 0x0004 /* RISC interrupt enable */
166#define DMA_CONF_BENAB 0x0002 /* Bus burst enable */
167#define DMA_CONF_DIR 0x0001 /* DMA direction (0=fifo->host 1=host->fifo) */
168
169/* mailbox registers */
170#define MBOX0 0x70 /* mailbox 0 */
171#define MBOX1 0x72 /* mailbox 1 */
172#define MBOX2 0x74 /* mailbox 2 */
173#define MBOX3 0x76 /* mailbox 3 */
174#define MBOX4 0x78 /* mailbox 4 */
175#define MBOX5 0x7a /* mailbox 5 */
176#define MBOX6 0x7c /* mailbox 6 */
177#define MBOX7 0x7e /* mailbox 7 */
178
179/* mailbox command complete status codes */
180#define MBOX_COMMAND_COMPLETE 0x4000
181#define INVALID_COMMAND 0x4001
182#define HOST_INTERFACE_ERROR 0x4002
183#define TEST_FAILED 0x4003
184#define COMMAND_ERROR 0x4005
185#define COMMAND_PARAM_ERROR 0x4006
186
187/* async event status codes */
188#define ASYNC_SCSI_BUS_RESET 0x8001
189#define SYSTEM_ERROR 0x8002
190#define REQUEST_TRANSFER_ERROR 0x8003
191#define RESPONSE_TRANSFER_ERROR 0x8004
192#define REQUEST_QUEUE_WAKEUP 0x8005
193#define EXECUTION_TIMEOUT_RESET 0x8006
194
195#ifdef CONFIG_QL_ISP_A64
196#define IOCB_SEGS 2
197#define CONTINUATION_SEGS 5
198#define MAX_CONTINUATION_ENTRIES 254
199#else
200#define IOCB_SEGS 4
201#define CONTINUATION_SEGS 7
202#endif /* CONFIG_QL_ISP_A64 */
203
204struct Entry_header {
205 u_char entry_type;
206 u_char entry_cnt;
207 u_char sys_def_1;
208 u_char flags;
209};
210
211/* entry header type commands */
212#ifdef CONFIG_QL_ISP_A64
213#define ENTRY_COMMAND 9
214#define ENTRY_CONTINUATION 0xa
215#else
216#define ENTRY_COMMAND 1
217#define ENTRY_CONTINUATION 2
218#endif /* CONFIG_QL_ISP_A64 */
219
220#define ENTRY_STATUS 3
221#define ENTRY_MARKER 4
222#define ENTRY_EXTENDED_COMMAND 5
223
224/* entry header flag definitions */
225#define EFLAG_CONTINUATION 1
226#define EFLAG_BUSY 2
227#define EFLAG_BAD_HEADER 4
228#define EFLAG_BAD_PAYLOAD 8
229
230struct dataseg {
231 u_int d_base;
232#ifdef CONFIG_QL_ISP_A64
233 u_int d_base_hi;
234#endif
235 u_int d_count;
236};
237
238struct Command_Entry {
239 struct Entry_header hdr;
240 u_int handle;
241 u_char target_lun;
242 u_char target_id;
243 u_short cdb_length;
244 u_short control_flags;
245 u_short rsvd;
246 u_short time_out;
247 u_short segment_cnt;
248 u_char cdb[12];
249#ifdef CONFIG_QL_ISP_A64
250 u_int rsvd1;
251 u_int rsvd2;
252#endif
253 struct dataseg dataseg[IOCB_SEGS];
254};
255
256/* command entry control flag definitions */
257#define CFLAG_NODISC 0x01
258#define CFLAG_HEAD_TAG 0x02
259#define CFLAG_ORDERED_TAG 0x04
260#define CFLAG_SIMPLE_TAG 0x08
261#define CFLAG_TAR_RTN 0x10
262#define CFLAG_READ 0x20
263#define CFLAG_WRITE 0x40
264
265struct Ext_Command_Entry {
266 struct Entry_header hdr;
267 u_int handle;
268 u_char target_lun;
269 u_char target_id;
270 u_short cdb_length;
271 u_short control_flags;
272 u_short rsvd;
273 u_short time_out;
274 u_short segment_cnt;
275 u_char cdb[44];
276};
277
278struct Continuation_Entry {
279 struct Entry_header hdr;
280#ifndef CONFIG_QL_ISP_A64
281 u_int reserved;
282#endif
283 struct dataseg dataseg[CONTINUATION_SEGS];
284};
285
286struct Marker_Entry {
287 struct Entry_header hdr;
288 u_int reserved;
289 u_char target_lun;
290 u_char target_id;
291 u_char modifier;
292 u_char rsvd;
293 u_char rsvds[52];
294};
295
296/* marker entry modifier definitions */
297#define SYNC_DEVICE 0
298#define SYNC_TARGET 1
299#define SYNC_ALL 2
300
301struct Status_Entry {
302 struct Entry_header hdr;
303 u_int handle;
304 u_short scsi_status;
305 u_short completion_status;
306 u_short state_flags;
307 u_short status_flags;
308 u_short time;
309 u_short req_sense_len;
310 u_int residual;
311 u_char rsvd[8];
312 u_char req_sense_data[32];
313};
314
315/* status entry completion status definitions */
316#define CS_COMPLETE 0x0000
317#define CS_INCOMPLETE 0x0001
318#define CS_DMA_ERROR 0x0002
319#define CS_TRANSPORT_ERROR 0x0003
320#define CS_RESET_OCCURRED 0x0004
321#define CS_ABORTED 0x0005
322#define CS_TIMEOUT 0x0006
323#define CS_DATA_OVERRUN 0x0007
324#define CS_COMMAND_OVERRUN 0x0008
325#define CS_STATUS_OVERRUN 0x0009
326#define CS_BAD_MESSAGE 0x000a
327#define CS_NO_MESSAGE_OUT 0x000b
328#define CS_EXT_ID_FAILED 0x000c
329#define CS_IDE_MSG_FAILED 0x000d
330#define CS_ABORT_MSG_FAILED 0x000e
331#define CS_REJECT_MSG_FAILED 0x000f
332#define CS_NOP_MSG_FAILED 0x0010
333#define CS_PARITY_ERROR_MSG_FAILED 0x0011
334#define CS_DEVICE_RESET_MSG_FAILED 0x0012
335#define CS_ID_MSG_FAILED 0x0013
336#define CS_UNEXP_BUS_FREE 0x0014
337#define CS_DATA_UNDERRUN 0x0015
338
339/* status entry state flag definitions */
340#define SF_GOT_BUS 0x0100
341#define SF_GOT_TARGET 0x0200
342#define SF_SENT_CDB 0x0400
343#define SF_TRANSFERRED_DATA 0x0800
344#define SF_GOT_STATUS 0x1000
345#define SF_GOT_SENSE 0x2000
346
347/* status entry status flag definitions */
348#define STF_DISCONNECT 0x0001
349#define STF_SYNCHRONOUS 0x0002
350#define STF_PARITY_ERROR 0x0004
351#define STF_BUS_RESET 0x0008
352#define STF_DEVICE_RESET 0x0010
353#define STF_ABORTED 0x0020
354#define STF_TIMEOUT 0x0040
355#define STF_NEGOTIATION 0x0080
356
357/* interface control commands */
358#define ISP_RESET 0x0001
359#define ISP_EN_INT 0x0002
360#define ISP_EN_RISC 0x0004
361
362/* host control commands */
363#define HCCR_NOP 0x0000
364#define HCCR_RESET 0x1000
365#define HCCR_PAUSE 0x2000
366#define HCCR_RELEASE 0x3000
367#define HCCR_SINGLE_STEP 0x4000
368#define HCCR_SET_HOST_INTR 0x5000
369#define HCCR_CLEAR_HOST_INTR 0x6000
370#define HCCR_CLEAR_RISC_INTR 0x7000
371#define HCCR_BP_ENABLE 0x8000
372#define HCCR_BIOS_DISABLE 0x9000
373#define HCCR_TEST_MODE 0xf000
374
375#define RISC_BUSY 0x0004
376
377/* mailbox commands */
378#define MBOX_NO_OP 0x0000
379#define MBOX_LOAD_RAM 0x0001
380#define MBOX_EXEC_FIRMWARE 0x0002
381#define MBOX_DUMP_RAM 0x0003
382#define MBOX_WRITE_RAM_WORD 0x0004
383#define MBOX_READ_RAM_WORD 0x0005
384#define MBOX_MAILBOX_REG_TEST 0x0006
385#define MBOX_VERIFY_CHECKSUM 0x0007
386#define MBOX_ABOUT_FIRMWARE 0x0008
387#define MBOX_CHECK_FIRMWARE 0x000e
388#define MBOX_INIT_REQ_QUEUE 0x0010
389#define MBOX_INIT_RES_QUEUE 0x0011
390#define MBOX_EXECUTE_IOCB 0x0012
391#define MBOX_WAKE_UP 0x0013
392#define MBOX_STOP_FIRMWARE 0x0014
393#define MBOX_ABORT 0x0015
394#define MBOX_ABORT_DEVICE 0x0016
395#define MBOX_ABORT_TARGET 0x0017
396#define MBOX_BUS_RESET 0x0018
397#define MBOX_STOP_QUEUE 0x0019
398#define MBOX_START_QUEUE 0x001a
399#define MBOX_SINGLE_STEP_QUEUE 0x001b
400#define MBOX_ABORT_QUEUE 0x001c
401#define MBOX_GET_DEV_QUEUE_STATUS 0x001d
402#define MBOX_GET_FIRMWARE_STATUS 0x001f
403#define MBOX_GET_INIT_SCSI_ID 0x0020
404#define MBOX_GET_SELECT_TIMEOUT 0x0021
405#define MBOX_GET_RETRY_COUNT 0x0022
406#define MBOX_GET_TAG_AGE_LIMIT 0x0023
407#define MBOX_GET_CLOCK_RATE 0x0024
408#define MBOX_GET_ACT_NEG_STATE 0x0025
409#define MBOX_GET_ASYNC_DATA_SETUP_TIME 0x0026
410#define MBOX_GET_PCI_PARAMS 0x0027
411#define MBOX_GET_TARGET_PARAMS 0x0028
412#define MBOX_GET_DEV_QUEUE_PARAMS 0x0029
413#define MBOX_SET_INIT_SCSI_ID 0x0030
414#define MBOX_SET_SELECT_TIMEOUT 0x0031
415#define MBOX_SET_RETRY_COUNT 0x0032
416#define MBOX_SET_TAG_AGE_LIMIT 0x0033
417#define MBOX_SET_CLOCK_RATE 0x0034
418#define MBOX_SET_ACTIVE_NEG_STATE 0x0035
419#define MBOX_SET_ASYNC_DATA_SETUP_TIME 0x0036
420#define MBOX_SET_PCI_CONTROL_PARAMS 0x0037
421#define MBOX_SET_TARGET_PARAMS 0x0038
422#define MBOX_SET_DEV_QUEUE_PARAMS 0x0039
423#define MBOX_RETURN_BIOS_BLOCK_ADDR 0x0040
424#define MBOX_WRITE_FOUR_RAM_WORDS 0x0041
425#define MBOX_EXEC_BIOS_IOCB 0x0042
426
427#ifdef CONFIG_QL_ISP_A64
428#define MBOX_CMD_INIT_REQUEST_QUEUE_64 0x0052
429#define MBOX_CMD_INIT_RESPONSE_QUEUE_64 0x0053
430#endif /* CONFIG_QL_ISP_A64 */
431
432#include "qlogicisp_asm.c"
433
434#define PACKB(a, b) (((a)<<4)|(b))
435
436static const u_char mbox_param[] = {
437 PACKB(1, 1), /* MBOX_NO_OP */
438 PACKB(5, 5), /* MBOX_LOAD_RAM */
439 PACKB(2, 0), /* MBOX_EXEC_FIRMWARE */
440 PACKB(5, 5), /* MBOX_DUMP_RAM */
441 PACKB(3, 3), /* MBOX_WRITE_RAM_WORD */
442 PACKB(2, 3), /* MBOX_READ_RAM_WORD */
443 PACKB(6, 6), /* MBOX_MAILBOX_REG_TEST */
444 PACKB(2, 3), /* MBOX_VERIFY_CHECKSUM */
445 PACKB(1, 3), /* MBOX_ABOUT_FIRMWARE */
446 PACKB(0, 0), /* 0x0009 */
447 PACKB(0, 0), /* 0x000a */
448 PACKB(0, 0), /* 0x000b */
449 PACKB(0, 0), /* 0x000c */
450 PACKB(0, 0), /* 0x000d */
451 PACKB(1, 2), /* MBOX_CHECK_FIRMWARE */
452 PACKB(0, 0), /* 0x000f */
453 PACKB(5, 5), /* MBOX_INIT_REQ_QUEUE */
454 PACKB(6, 6), /* MBOX_INIT_RES_QUEUE */
455 PACKB(4, 4), /* MBOX_EXECUTE_IOCB */
456 PACKB(2, 2), /* MBOX_WAKE_UP */
457 PACKB(1, 6), /* MBOX_STOP_FIRMWARE */
458 PACKB(4, 4), /* MBOX_ABORT */
459 PACKB(2, 2), /* MBOX_ABORT_DEVICE */
460 PACKB(3, 3), /* MBOX_ABORT_TARGET */
461 PACKB(2, 2), /* MBOX_BUS_RESET */
462 PACKB(2, 3), /* MBOX_STOP_QUEUE */
463 PACKB(2, 3), /* MBOX_START_QUEUE */
464 PACKB(2, 3), /* MBOX_SINGLE_STEP_QUEUE */
465 PACKB(2, 3), /* MBOX_ABORT_QUEUE */
466 PACKB(2, 4), /* MBOX_GET_DEV_QUEUE_STATUS */
467 PACKB(0, 0), /* 0x001e */
468 PACKB(1, 3), /* MBOX_GET_FIRMWARE_STATUS */
469 PACKB(1, 2), /* MBOX_GET_INIT_SCSI_ID */
470 PACKB(1, 2), /* MBOX_GET_SELECT_TIMEOUT */
471 PACKB(1, 3), /* MBOX_GET_RETRY_COUNT */
472 PACKB(1, 2), /* MBOX_GET_TAG_AGE_LIMIT */
473 PACKB(1, 2), /* MBOX_GET_CLOCK_RATE */
474 PACKB(1, 2), /* MBOX_GET_ACT_NEG_STATE */
475 PACKB(1, 2), /* MBOX_GET_ASYNC_DATA_SETUP_TIME */
476 PACKB(1, 3), /* MBOX_GET_PCI_PARAMS */
477 PACKB(2, 4), /* MBOX_GET_TARGET_PARAMS */
478 PACKB(2, 4), /* MBOX_GET_DEV_QUEUE_PARAMS */
479 PACKB(0, 0), /* 0x002a */
480 PACKB(0, 0), /* 0x002b */
481 PACKB(0, 0), /* 0x002c */
482 PACKB(0, 0), /* 0x002d */
483 PACKB(0, 0), /* 0x002e */
484 PACKB(0, 0), /* 0x002f */
485 PACKB(2, 2), /* MBOX_SET_INIT_SCSI_ID */
486 PACKB(2, 2), /* MBOX_SET_SELECT_TIMEOUT */
487 PACKB(3, 3), /* MBOX_SET_RETRY_COUNT */
488 PACKB(2, 2), /* MBOX_SET_TAG_AGE_LIMIT */
489 PACKB(2, 2), /* MBOX_SET_CLOCK_RATE */
490 PACKB(2, 2), /* MBOX_SET_ACTIVE_NEG_STATE */
491 PACKB(2, 2), /* MBOX_SET_ASYNC_DATA_SETUP_TIME */
492 PACKB(3, 3), /* MBOX_SET_PCI_CONTROL_PARAMS */
493 PACKB(4, 4), /* MBOX_SET_TARGET_PARAMS */
494 PACKB(4, 4), /* MBOX_SET_DEV_QUEUE_PARAMS */
495 PACKB(0, 0), /* 0x003a */
496 PACKB(0, 0), /* 0x003b */
497 PACKB(0, 0), /* 0x003c */
498 PACKB(0, 0), /* 0x003d */
499 PACKB(0, 0), /* 0x003e */
500 PACKB(0, 0), /* 0x003f */
501 PACKB(1, 2), /* MBOX_RETURN_BIOS_BLOCK_ADDR */
502 PACKB(6, 1), /* MBOX_WRITE_FOUR_RAM_WORDS */
503 PACKB(2, 3) /* MBOX_EXEC_BIOS_IOCB */
504#ifdef CONFIG_QL_ISP_A64
505 ,PACKB(0, 0), /* 0x0043 */
506 PACKB(0, 0), /* 0x0044 */
507 PACKB(0, 0), /* 0x0045 */
508 PACKB(0, 0), /* 0x0046 */
509 PACKB(0, 0), /* 0x0047 */
510 PACKB(0, 0), /* 0x0048 */
511 PACKB(0, 0), /* 0x0049 */
512 PACKB(0, 0), /* 0x004a */
513 PACKB(0, 0), /* 0x004b */
514 PACKB(0, 0), /* 0x004c */
515 PACKB(0, 0), /* 0x004d */
516 PACKB(0, 0), /* 0x004e */
517 PACKB(0, 0), /* 0x004f */
518 PACKB(0, 0), /* 0x0050 */
519 PACKB(0, 0), /* 0x0051 */
520 PACKB(8, 8), /* MBOX_CMD_INIT_REQUEST_QUEUE_64 (0x0052) */
521 PACKB(8, 8) /* MBOX_CMD_INIT_RESPONSE_QUEUE_64 (0x0053) */
522#endif /* CONFIG_QL_ISP_A64 */
523};
524
525#define MAX_MBOX_COMMAND (sizeof(mbox_param)/sizeof(u_short))
526
527struct host_param {
528 u_short fifo_threshold;
529 u_short host_adapter_enable;
530 u_short initiator_scsi_id;
531 u_short bus_reset_delay;
532 u_short retry_count;
533 u_short retry_delay;
534 u_short async_data_setup_time;
535 u_short req_ack_active_negation;
536 u_short data_line_active_negation;
537 u_short data_dma_burst_enable;
538 u_short command_dma_burst_enable;
539 u_short tag_aging;
540 u_short selection_timeout;
541 u_short max_queue_depth;
542};
543
544/*
545 * Device Flags:
546 *
547 * Bit Name
548 * ---------
549 * 7 Disconnect Privilege
550 * 6 Parity Checking
551 * 5 Wide Data Transfers
552 * 4 Synchronous Data Transfers
553 * 3 Tagged Queuing
554 * 2 Automatic Request Sense
555 * 1 Stop Queue on Check Condition
556 * 0 Renegotiate on Error
557 */
558
559struct dev_param {
560 u_short device_flags;
561 u_short execution_throttle;
562 u_short synchronous_period;
563 u_short synchronous_offset;
564 u_short device_enable;
565 u_short reserved; /* pad */
566};
567
568/*
569 * The result queue can be quite a bit smaller since continuation entries
570 * do not show up there:
571 */
572#define RES_QUEUE_LEN ((QLOGICISP_REQ_QUEUE_LEN + 1) / 8 - 1)
573#define QUEUE_ENTRY_LEN 64
574#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
575
576struct isp_queue_entry {
577 char __opaque[QUEUE_ENTRY_LEN];
578};
579
580struct isp1020_hostdata {
581 void __iomem *memaddr;
582 u_char revision;
583 struct host_param host_param;
584 struct dev_param dev_param[MAX_TARGETS];
585 struct pci_dev *pci_dev;
586
587 struct isp_queue_entry *res_cpu; /* CPU-side address of response queue. */
588 struct isp_queue_entry *req_cpu; /* CPU-size address of request queue. */
589
590 /* result and request queues (shared with isp1020): */
591 u_int req_in_ptr; /* index of next request slot */
592 u_int res_out_ptr; /* index of next result slot */
593
594 /* this is here so the queues are nicely aligned */
595 long send_marker; /* do we need to send a marker? */
596
597 /* The cmd->handle has a fixed size, and is only 32-bits. We
598 * need to take care to handle 64-bit systems correctly thus what
599 * we actually place in cmd->handle is an index to the following
600 * table. Kudos to Matt Jacob for the technique. -DaveM
601 */
602 Scsi_Cmnd *cmd_slots[QLOGICISP_REQ_QUEUE_LEN + 1];
603
604 dma_addr_t res_dma; /* PCI side view of response queue */
605 dma_addr_t req_dma; /* PCI side view of request queue */
606};
607
608/* queue length's _must_ be power of two: */
609#define QUEUE_DEPTH(in, out, ql) ((in - out) & (ql))
610#define REQ_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, \
611 QLOGICISP_REQ_QUEUE_LEN)
612#define RES_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, RES_QUEUE_LEN)
613
614static void isp1020_enable_irqs(struct Scsi_Host *);
615static void isp1020_disable_irqs(struct Scsi_Host *);
616static int isp1020_init(struct Scsi_Host *);
617static int isp1020_reset_hardware(struct Scsi_Host *);
618static int isp1020_set_defaults(struct Scsi_Host *);
619static int isp1020_load_parameters(struct Scsi_Host *);
620static int isp1020_mbox_command(struct Scsi_Host *, u_short []);
621static int isp1020_return_status(struct Status_Entry *);
622static void isp1020_intr_handler(int, void *, struct pt_regs *);
623static irqreturn_t do_isp1020_intr_handler(int, void *, struct pt_regs *);
624
625#if USE_NVRAM_DEFAULTS
626static int isp1020_get_defaults(struct Scsi_Host *);
627static int isp1020_verify_nvram(struct Scsi_Host *);
628static u_short isp1020_read_nvram_word(struct Scsi_Host *, u_short);
629#endif
630
631#if DEBUG_ISP1020
632static void isp1020_print_scsi_cmd(Scsi_Cmnd *);
633#endif
634#if DEBUG_ISP1020_INTR
635static void isp1020_print_status_entry(struct Status_Entry *);
636#endif
637
638/* memaddr should be used to determine if memmapped port i/o is being used
639 * non-null memaddr == mmap'd
640 * JV 7-Jan-2000
641 */
642static inline u_short isp_inw(struct Scsi_Host *host, long offset)
643{
644 struct isp1020_hostdata *h = (struct isp1020_hostdata *)host->hostdata;
645 if (h->memaddr)
646 return readw(h->memaddr + offset);
647 else
648 return inw(host->io_port + offset);
649}
650
651static inline void isp_outw(u_short val, struct Scsi_Host *host, long offset)
652{
653 struct isp1020_hostdata *h = (struct isp1020_hostdata *)host->hostdata;
654 if (h->memaddr)
655 writew(val, h->memaddr + offset);
656 else
657 outw(val, host->io_port + offset);
658}
659
660static inline void isp1020_enable_irqs(struct Scsi_Host *host)
661{
662 isp_outw(ISP_EN_INT|ISP_EN_RISC, host, PCI_INTF_CTL);
663}
664
665
666static inline void isp1020_disable_irqs(struct Scsi_Host *host)
667{
668 isp_outw(0x0, host, PCI_INTF_CTL);
669}
670
671
672static int isp1020_detect(Scsi_Host_Template *tmpt)
673{
674 int hosts = 0;
675 struct Scsi_Host *host;
676 struct isp1020_hostdata *hostdata;
677 struct pci_dev *pdev = NULL;
678
679 ENTER("isp1020_detect");
680
681 tmpt->proc_name = "isp1020";
682
683 while ((pdev = pci_find_device(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1020, pdev)))
684 {
685 if (pci_enable_device(pdev))
686 continue;
687
688 host = scsi_register(tmpt, sizeof(struct isp1020_hostdata));
689 if (!host)
690 continue;
691
692 hostdata = (struct isp1020_hostdata *) host->hostdata;
693
694 memset(hostdata, 0, sizeof(struct isp1020_hostdata));
695
696 hostdata->pci_dev = pdev;
697
698 if (isp1020_init(host))
699 goto fail_and_unregister;
700
701 if (isp1020_reset_hardware(host)
702#if USE_NVRAM_DEFAULTS
703 || isp1020_get_defaults(host)
704#else
705 || isp1020_set_defaults(host)
706#endif /* USE_NVRAM_DEFAULTS */
707 || isp1020_load_parameters(host)) {
708 goto fail_uninit;
709 }
710
711 host->this_id = hostdata->host_param.initiator_scsi_id;
712 host->max_sectors = 64;
713
714 if (request_irq(host->irq, do_isp1020_intr_handler, SA_INTERRUPT | SA_SHIRQ,
715 "qlogicisp", host))
716 {
717 printk("qlogicisp : interrupt %d already in use\n",
718 host->irq);
719 goto fail_uninit;
720 }
721
722 isp_outw(0x0, host, PCI_SEMAPHORE);
723 isp_outw(HCCR_CLEAR_RISC_INTR, host, HOST_HCCR);
724 isp1020_enable_irqs(host);
725
726 hosts++;
727 continue;
728
729 fail_uninit:
730 iounmap(hostdata->memaddr);
731 release_region(host->io_port, 0xff);
732 fail_and_unregister:
733 if (hostdata->res_cpu)
734 pci_free_consistent(hostdata->pci_dev,
735 QSIZE(RES_QUEUE_LEN),
736 hostdata->res_cpu,
737 hostdata->res_dma);
738 if (hostdata->req_cpu)
739 pci_free_consistent(hostdata->pci_dev,
740 QSIZE(QLOGICISP_REQ_QUEUE_LEN),
741 hostdata->req_cpu,
742 hostdata->req_dma);
743 scsi_unregister(host);
744 }
745
746 LEAVE("isp1020_detect");
747
748 return hosts;
749}
750
751
752static int isp1020_release(struct Scsi_Host *host)
753{
754 struct isp1020_hostdata *hostdata;
755
756 ENTER("isp1020_release");
757
758 hostdata = (struct isp1020_hostdata *) host->hostdata;
759
760 isp_outw(0x0, host, PCI_INTF_CTL);
761 free_irq(host->irq, host);
762
763 iounmap(hostdata->memaddr);
764
765 release_region(host->io_port, 0xff);
766
767 LEAVE("isp1020_release");
768
769 return 0;
770}
771
772
773static const char *isp1020_info(struct Scsi_Host *host)
774{
775 static char buf[80];
776 struct isp1020_hostdata *hostdata;
777
778 ENTER("isp1020_info");
779
780 hostdata = (struct isp1020_hostdata *) host->hostdata;
781 sprintf(buf,
782 "QLogic ISP1020 SCSI on PCI bus %02x device %02x irq %d %s base 0x%lx",
783 hostdata->pci_dev->bus->number, hostdata->pci_dev->devfn, host->irq,
784 (hostdata->memaddr ? "MEM" : "I/O"),
785 (hostdata->memaddr ? (unsigned long)hostdata->memaddr : host->io_port));
786
787 LEAVE("isp1020_info");
788
789 return buf;
790}
791
792
793/*
794 * The middle SCSI layer ensures that queuecommand never gets invoked
795 * concurrently with itself or the interrupt handler (though the
796 * interrupt handler may call this routine as part of
797 * request-completion handling).
798 */
799static int isp1020_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *))
800{
801 int i, n, num_free;
802 u_int in_ptr, out_ptr;
803 struct dataseg * ds;
804 struct scatterlist *sg;
805 struct Command_Entry *cmd;
806 struct Continuation_Entry *cont;
807 struct Scsi_Host *host;
808 struct isp1020_hostdata *hostdata;
809 dma_addr_t dma_addr;
810
811 ENTER("isp1020_queuecommand");
812
813 host = Cmnd->device->host;
814 hostdata = (struct isp1020_hostdata *) host->hostdata;
815 Cmnd->scsi_done = done;
816
817 DEBUG(isp1020_print_scsi_cmd(Cmnd));
818
819 out_ptr = isp_inw(host, + MBOX4);
820 in_ptr = hostdata->req_in_ptr;
821
822 DEBUG(printk("qlogicisp : request queue depth %d\n",
823 REQ_QUEUE_DEPTH(in_ptr, out_ptr)));
824
825 cmd = (struct Command_Entry *) &hostdata->req_cpu[in_ptr];
826 in_ptr = (in_ptr + 1) & QLOGICISP_REQ_QUEUE_LEN;
827 if (in_ptr == out_ptr) {
828 printk("qlogicisp : request queue overflow\n");
829 return 1;
830 }
831
832 if (hostdata->send_marker) {
833 struct Marker_Entry *marker;
834
835 TRACE("queue marker", in_ptr, 0);
836
837 DEBUG(printk("qlogicisp : adding marker entry\n"));
838 marker = (struct Marker_Entry *) cmd;
839 memset(marker, 0, sizeof(struct Marker_Entry));
840
841 marker->hdr.entry_type = ENTRY_MARKER;
842 marker->hdr.entry_cnt = 1;
843 marker->modifier = SYNC_ALL;
844
845 hostdata->send_marker = 0;
846
847 if (((in_ptr + 1) & QLOGICISP_REQ_QUEUE_LEN) == out_ptr) {
848 isp_outw(in_ptr, host, MBOX4);
849 hostdata->req_in_ptr = in_ptr;
850 printk("qlogicisp : request queue overflow\n");
851 return 1;
852 }
853 cmd = (struct Command_Entry *) &hostdata->req_cpu[in_ptr];
854 in_ptr = (in_ptr + 1) & QLOGICISP_REQ_QUEUE_LEN;
855 }
856
857 TRACE("queue command", in_ptr, Cmnd);
858
859 memset(cmd, 0, sizeof(struct Command_Entry));
860
861 cmd->hdr.entry_type = ENTRY_COMMAND;
862 cmd->hdr.entry_cnt = 1;
863
864 cmd->target_lun = Cmnd->device->lun;
865 cmd->target_id = Cmnd->device->id;
866 cmd->cdb_length = cpu_to_le16(Cmnd->cmd_len);
867 cmd->control_flags = cpu_to_le16(CFLAG_READ | CFLAG_WRITE);
868 cmd->time_out = cpu_to_le16(30);
869
870 memcpy(cmd->cdb, Cmnd->cmnd, Cmnd->cmd_len);
871
872 if (Cmnd->use_sg) {
873 int sg_count;
874
875 sg = (struct scatterlist *) Cmnd->request_buffer;
876 ds = cmd->dataseg;
877
878 sg_count = pci_map_sg(hostdata->pci_dev, sg, Cmnd->use_sg,
879 Cmnd->sc_data_direction);
880
881 cmd->segment_cnt = cpu_to_le16(sg_count);
882
883 /* fill in first four sg entries: */
884 n = sg_count;
885 if (n > IOCB_SEGS)
886 n = IOCB_SEGS;
887 for (i = 0; i < n; i++) {
888 dma_addr = sg_dma_address(sg);
889 ds[i].d_base = cpu_to_le32((u32) dma_addr);
890#ifdef CONFIG_QL_ISP_A64
891 ds[i].d_base_hi = cpu_to_le32((u32) (dma_addr>>32));
892#endif /* CONFIG_QL_ISP_A64 */
893 ds[i].d_count = cpu_to_le32(sg_dma_len(sg));
894 ++sg;
895 }
896 sg_count -= IOCB_SEGS;
897
898 while (sg_count > 0) {
899 ++cmd->hdr.entry_cnt;
900 cont = (struct Continuation_Entry *)
901 &hostdata->req_cpu[in_ptr];
902 in_ptr = (in_ptr + 1) & QLOGICISP_REQ_QUEUE_LEN;
903 if (in_ptr == out_ptr) {
904 printk("isp1020: unexpected request queue "
905 "overflow\n");
906 return 1;
907 }
908 TRACE("queue continuation", in_ptr, 0);
909 cont->hdr.entry_type = ENTRY_CONTINUATION;
910 cont->hdr.entry_cnt = 0;
911 cont->hdr.sys_def_1 = 0;
912 cont->hdr.flags = 0;
913#ifndef CONFIG_QL_ISP_A64
914 cont->reserved = 0;
915#endif
916 ds = cont->dataseg;
917 n = sg_count;
918 if (n > CONTINUATION_SEGS)
919 n = CONTINUATION_SEGS;
920 for (i = 0; i < n; ++i) {
921 dma_addr = sg_dma_address(sg);
922 ds[i].d_base = cpu_to_le32((u32) dma_addr);
923#ifdef CONFIG_QL_ISP_A64
924 ds[i].d_base_hi = cpu_to_le32((u32)(dma_addr>>32));
925#endif /* CONFIG_QL_ISP_A64 */
926 ds[i].d_count = cpu_to_le32(sg_dma_len(sg));
927 ++sg;
928 }
929 sg_count -= n;
930 }
931 } else if (Cmnd->request_bufflen) {
932 /*Cmnd->SCp.ptr = (char *)(unsigned long)*/
933 dma_addr = pci_map_single(hostdata->pci_dev,
934 Cmnd->request_buffer,
935 Cmnd->request_bufflen,
936 Cmnd->sc_data_direction);
937 Cmnd->SCp.ptr = (char *)(unsigned long) dma_addr;
938
939 cmd->dataseg[0].d_base =
940 cpu_to_le32((u32) dma_addr);
941#ifdef CONFIG_QL_ISP_A64
942 cmd->dataseg[0].d_base_hi =
943 cpu_to_le32((u32) (dma_addr>>32));
944#endif /* CONFIG_QL_ISP_A64 */
945 cmd->dataseg[0].d_count =
946 cpu_to_le32((u32)Cmnd->request_bufflen);
947 cmd->segment_cnt = cpu_to_le16(1);
948 } else {
949 cmd->dataseg[0].d_base = 0;
950#ifdef CONFIG_QL_ISP_A64
951 cmd->dataseg[0].d_base_hi = 0;
952#endif /* CONFIG_QL_ISP_A64 */
953 cmd->dataseg[0].d_count = 0;
954 cmd->segment_cnt = cpu_to_le16(1); /* Shouldn't this be 0? */
955 }
956
957 /* Committed, record Scsi_Cmd so we can find it later. */
958 cmd->handle = in_ptr;
959 hostdata->cmd_slots[in_ptr] = Cmnd;
960
961 isp_outw(in_ptr, host, MBOX4);
962 hostdata->req_in_ptr = in_ptr;
963
964 num_free = QLOGICISP_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
965 host->can_queue = host->host_busy + num_free;
966 host->sg_tablesize = QLOGICISP_MAX_SG(num_free);
967
968 LEAVE("isp1020_queuecommand");
969
970 return 0;
971}
972
973
974#define ASYNC_EVENT_INTERRUPT 0x01
975
976irqreturn_t do_isp1020_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
977{
978 struct Scsi_Host *host = dev_id;
979 unsigned long flags;
980
981 spin_lock_irqsave(host->host_lock, flags);
982 isp1020_intr_handler(irq, dev_id, regs);
983 spin_unlock_irqrestore(host->host_lock, flags);
984
985 return IRQ_HANDLED;
986}
987
988void isp1020_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
989{
990 Scsi_Cmnd *Cmnd;
991 struct Status_Entry *sts;
992 struct Scsi_Host *host = dev_id;
993 struct isp1020_hostdata *hostdata;
994 u_int in_ptr, out_ptr;
995 u_short status;
996
997 ENTER_INTR("isp1020_intr_handler");
998
999 hostdata = (struct isp1020_hostdata *) host->hostdata;
1000
1001 DEBUG_INTR(printk("qlogicisp : interrupt on line %d\n", irq));
1002
1003 if (!(isp_inw(host, PCI_INTF_STS) & 0x04)) {
1004 /* spurious interrupts can happen legally */
1005 DEBUG_INTR(printk("qlogicisp: got spurious interrupt\n"));
1006 return;
1007 }
1008 in_ptr = isp_inw(host, MBOX5);
1009 isp_outw(HCCR_CLEAR_RISC_INTR, host, HOST_HCCR);
1010
1011 if ((isp_inw(host, PCI_SEMAPHORE) & ASYNC_EVENT_INTERRUPT)) {
1012 status = isp_inw(host, MBOX0);
1013
1014 DEBUG_INTR(printk("qlogicisp : mbox completion status: %x\n",
1015 status));
1016
1017 switch (status) {
1018 case ASYNC_SCSI_BUS_RESET:
1019 case EXECUTION_TIMEOUT_RESET:
1020 hostdata->send_marker = 1;
1021 break;
1022 case INVALID_COMMAND:
1023 case HOST_INTERFACE_ERROR:
1024 case COMMAND_ERROR:
1025 case COMMAND_PARAM_ERROR:
1026 printk("qlogicisp : bad mailbox return status\n");
1027 break;
1028 }
1029 isp_outw(0x0, host, PCI_SEMAPHORE);
1030 }
1031 out_ptr = hostdata->res_out_ptr;
1032
1033 DEBUG_INTR(printk("qlogicisp : response queue update\n"));
1034 DEBUG_INTR(printk("qlogicisp : response queue depth %d\n",
1035 QUEUE_DEPTH(in_ptr, out_ptr, RES_QUEUE_LEN)));
1036
1037 while (out_ptr != in_ptr) {
1038 u_int cmd_slot;
1039
1040 sts = (struct Status_Entry *) &hostdata->res_cpu[out_ptr];
1041 out_ptr = (out_ptr + 1) & RES_QUEUE_LEN;
1042
1043 cmd_slot = sts->handle;
1044 Cmnd = hostdata->cmd_slots[cmd_slot];
1045 hostdata->cmd_slots[cmd_slot] = NULL;
1046
1047 TRACE("done", out_ptr, Cmnd);
1048
1049 if (le16_to_cpu(sts->completion_status) == CS_RESET_OCCURRED
1050 || le16_to_cpu(sts->completion_status) == CS_ABORTED
1051 || (le16_to_cpu(sts->status_flags) & STF_BUS_RESET))
1052 hostdata->send_marker = 1;
1053
1054 if (le16_to_cpu(sts->state_flags) & SF_GOT_SENSE)
1055 memcpy(Cmnd->sense_buffer, sts->req_sense_data,
1056 sizeof(Cmnd->sense_buffer));
1057
1058 DEBUG_INTR(isp1020_print_status_entry(sts));
1059
1060 if (sts->hdr.entry_type == ENTRY_STATUS)
1061 Cmnd->result = isp1020_return_status(sts);
1062 else
1063 Cmnd->result = DID_ERROR << 16;
1064
1065 if (Cmnd->use_sg)
1066 pci_unmap_sg(hostdata->pci_dev,
1067 (struct scatterlist *)Cmnd->buffer,
1068 Cmnd->use_sg,
1069 Cmnd->sc_data_direction);
1070 else if (Cmnd->request_bufflen)
1071 pci_unmap_single(hostdata->pci_dev,
1072#ifdef CONFIG_QL_ISP_A64
1073 (dma_addr_t)((long)Cmnd->SCp.ptr),
1074#else
1075 (u32)((long)Cmnd->SCp.ptr),
1076#endif
1077 Cmnd->request_bufflen,
1078 Cmnd->sc_data_direction);
1079
1080 isp_outw(out_ptr, host, MBOX5);
1081 (*Cmnd->scsi_done)(Cmnd);
1082 }
1083 hostdata->res_out_ptr = out_ptr;
1084
1085 LEAVE_INTR("isp1020_intr_handler");
1086}
1087
1088
1089static int isp1020_return_status(struct Status_Entry *sts)
1090{
1091 int host_status = DID_ERROR;
1092#if DEBUG_ISP1020_INTR
1093 static char *reason[] = {
1094 "DID_OK",
1095 "DID_NO_CONNECT",
1096 "DID_BUS_BUSY",
1097 "DID_TIME_OUT",
1098 "DID_BAD_TARGET",
1099 "DID_ABORT",
1100 "DID_PARITY",
1101 "DID_ERROR",
1102 "DID_RESET",
1103 "DID_BAD_INTR"
1104 };
1105#endif /* DEBUG_ISP1020_INTR */
1106
1107 ENTER("isp1020_return_status");
1108
1109 DEBUG(printk("qlogicisp : completion status = 0x%04x\n",
1110 le16_to_cpu(sts->completion_status)));
1111
1112 switch(le16_to_cpu(sts->completion_status)) {
1113 case CS_COMPLETE:
1114 host_status = DID_OK;
1115 break;
1116 case CS_INCOMPLETE:
1117 if (!(le16_to_cpu(sts->state_flags) & SF_GOT_BUS))
1118 host_status = DID_NO_CONNECT;
1119 else if (!(le16_to_cpu(sts->state_flags) & SF_GOT_TARGET))
1120 host_status = DID_BAD_TARGET;
1121 else if (!(le16_to_cpu(sts->state_flags) & SF_SENT_CDB))
1122 host_status = DID_ERROR;
1123 else if (!(le16_to_cpu(sts->state_flags) & SF_TRANSFERRED_DATA))
1124 host_status = DID_ERROR;
1125 else if (!(le16_to_cpu(sts->state_flags) & SF_GOT_STATUS))
1126 host_status = DID_ERROR;
1127 else if (!(le16_to_cpu(sts->state_flags) & SF_GOT_SENSE))
1128 host_status = DID_ERROR;
1129 break;
1130 case CS_DMA_ERROR:
1131 case CS_TRANSPORT_ERROR:
1132 host_status = DID_ERROR;
1133 break;
1134 case CS_RESET_OCCURRED:
1135 host_status = DID_RESET;
1136 break;
1137 case CS_ABORTED:
1138 host_status = DID_ABORT;
1139 break;
1140 case CS_TIMEOUT:
1141 host_status = DID_TIME_OUT;
1142 break;
1143 case CS_DATA_OVERRUN:
1144 case CS_COMMAND_OVERRUN:
1145 case CS_STATUS_OVERRUN:
1146 case CS_BAD_MESSAGE:
1147 case CS_NO_MESSAGE_OUT:
1148 case CS_EXT_ID_FAILED:
1149 case CS_IDE_MSG_FAILED:
1150 case CS_ABORT_MSG_FAILED:
1151 case CS_NOP_MSG_FAILED:
1152 case CS_PARITY_ERROR_MSG_FAILED:
1153 case CS_DEVICE_RESET_MSG_FAILED:
1154 case CS_ID_MSG_FAILED:
1155 case CS_UNEXP_BUS_FREE:
1156 host_status = DID_ERROR;
1157 break;
1158 case CS_DATA_UNDERRUN:
1159 host_status = DID_OK;
1160 break;
1161 default:
1162 printk("qlogicisp : unknown completion status 0x%04x\n",
1163 le16_to_cpu(sts->completion_status));
1164 host_status = DID_ERROR;
1165 break;
1166 }
1167
1168 DEBUG_INTR(printk("qlogicisp : host status (%s) scsi status %x\n",
1169 reason[host_status], le16_to_cpu(sts->scsi_status)));
1170
1171 LEAVE("isp1020_return_status");
1172
1173 return (le16_to_cpu(sts->scsi_status) & STATUS_MASK) | (host_status << 16);
1174}
1175
1176
1177static int isp1020_biosparam(struct scsi_device *sdev, struct block_device *n,
1178 sector_t capacity, int ip[])
1179{
1180 int size = capacity;
1181
1182 ENTER("isp1020_biosparam");
1183
1184 ip[0] = 64;
1185 ip[1] = 32;
1186 ip[2] = size >> 11;
1187 if (ip[2] > 1024) {
1188 ip[0] = 255;
1189 ip[1] = 63;
1190 ip[2] = size / (ip[0] * ip[1]);
1191#if 0
1192 if (ip[2] > 1023)
1193 ip[2] = 1023;
1194#endif
1195 }
1196
1197 LEAVE("isp1020_biosparam");
1198
1199 return 0;
1200}
1201
1202
1203static int isp1020_reset_hardware(struct Scsi_Host *host)
1204{
1205 u_short param[6];
1206 int loop_count;
1207
1208 ENTER("isp1020_reset_hardware");
1209
1210 isp_outw(ISP_RESET, host, PCI_INTF_CTL);
1211 udelay(100);
1212 isp_outw(HCCR_RESET, host, HOST_HCCR);
1213 udelay(100);
1214 isp_outw(HCCR_RELEASE, host, HOST_HCCR);
1215 isp_outw(HCCR_BIOS_DISABLE, host, HOST_HCCR);
1216
1217 loop_count = DEFAULT_LOOP_COUNT;
1218 while (--loop_count && isp_inw(host, HOST_HCCR) == RISC_BUSY) {
1219 barrier();
1220 cpu_relax();
1221 }
1222 if (!loop_count)
1223 printk("qlogicisp: reset_hardware loop timeout\n");
1224
1225 isp_outw(0, host, ISP_CFG1);
1226
1227#if DEBUG_ISP1020
1228 printk("qlogicisp : mbox 0 0x%04x \n", isp_inw(host, MBOX0));
1229 printk("qlogicisp : mbox 1 0x%04x \n", isp_inw(host, MBOX1));
1230 printk("qlogicisp : mbox 2 0x%04x \n", isp_inw(host, MBOX2));
1231 printk("qlogicisp : mbox 3 0x%04x \n", isp_inw(host, MBOX3));
1232 printk("qlogicisp : mbox 4 0x%04x \n", isp_inw(host, MBOX4));
1233 printk("qlogicisp : mbox 5 0x%04x \n", isp_inw(host, MBOX5));
1234#endif /* DEBUG_ISP1020 */
1235
1236 param[0] = MBOX_NO_OP;
1237 isp1020_mbox_command(host, param);
1238 if (param[0] != MBOX_COMMAND_COMPLETE) {
1239 printk("qlogicisp : NOP test failed\n");
1240 return 1;
1241 }
1242
1243 DEBUG(printk("qlogicisp : loading risc ram\n"));
1244
1245#if RELOAD_FIRMWARE
1246 for (loop_count = 0; loop_count < risc_code_length01; loop_count++) {
1247 param[0] = MBOX_WRITE_RAM_WORD;
1248 param[1] = risc_code_addr01 + loop_count;
1249 param[2] = risc_code01[loop_count];
1250 isp1020_mbox_command(host, param);
1251 if (param[0] != MBOX_COMMAND_COMPLETE) {
1252 printk("qlogicisp : firmware load failure at %d\n",
1253 loop_count);
1254 return 1;
1255 }
1256 }
1257#endif /* RELOAD_FIRMWARE */
1258
1259 DEBUG(printk("qlogicisp : verifying checksum\n"));
1260
1261 param[0] = MBOX_VERIFY_CHECKSUM;
1262 param[1] = risc_code_addr01;
1263
1264 isp1020_mbox_command(host, param);
1265
1266 if (param[0] != MBOX_COMMAND_COMPLETE) {
1267 printk("qlogicisp : ram checksum failure\n");
1268 return 1;
1269 }
1270
1271 DEBUG(printk("qlogicisp : executing firmware\n"));
1272
1273 param[0] = MBOX_EXEC_FIRMWARE;
1274 param[1] = risc_code_addr01;
1275
1276 isp1020_mbox_command(host, param);
1277
1278 param[0] = MBOX_ABOUT_FIRMWARE;
1279
1280 isp1020_mbox_command(host, param);
1281
1282 if (param[0] != MBOX_COMMAND_COMPLETE) {
1283 printk("qlogicisp : about firmware failure\n");
1284 return 1;
1285 }
1286
1287 DEBUG(printk("qlogicisp : firmware major revision %d\n", param[1]));
1288 DEBUG(printk("qlogicisp : firmware minor revision %d\n", param[2]));
1289
1290 LEAVE("isp1020_reset_hardware");
1291
1292 return 0;
1293}
1294
1295
1296static int isp1020_init(struct Scsi_Host *sh)
1297{
1298 u_long io_base, mem_base, io_flags, mem_flags;
1299 struct isp1020_hostdata *hostdata;
1300 u_char revision;
1301 u_int irq;
1302 u_short command;
1303 struct pci_dev *pdev;
1304
1305 ENTER("isp1020_init");
1306
1307 hostdata = (struct isp1020_hostdata *) sh->hostdata;
1308 pdev = hostdata->pci_dev;
1309
1310 if (pci_read_config_word(pdev, PCI_COMMAND, &command)
1311 || pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision))
1312 {
1313 printk("qlogicisp : error reading PCI configuration\n");
1314 return 1;
1315 }
1316
1317 io_base = pci_resource_start(pdev, 0);
1318 mem_base = pci_resource_start(pdev, 1);
1319 io_flags = pci_resource_flags(pdev, 0);
1320 mem_flags = pci_resource_flags(pdev, 1);
1321 irq = pdev->irq;
1322
1323 if (pdev->vendor != PCI_VENDOR_ID_QLOGIC) {
1324 printk("qlogicisp : 0x%04x is not QLogic vendor ID\n",
1325 pdev->vendor);
1326 return 1;
1327 }
1328
1329 if (pdev->device != PCI_DEVICE_ID_QLOGIC_ISP1020) {
1330 printk("qlogicisp : 0x%04x does not match ISP1020 device id\n",
1331 pdev->device);
1332 return 1;
1333 }
1334
1335#ifdef __alpha__
1336 /* Force ALPHA to use bus I/O and not bus MEM.
1337 This is to avoid having to use HAE_MEM registers,
1338 which is broken on some platforms and with SMP. */
1339 command &= ~PCI_COMMAND_MEMORY;
1340#endif
1341
1342 sh->io_port = io_base;
1343
1344 if (!request_region(sh->io_port, 0xff, "qlogicisp")) {
1345 printk("qlogicisp : i/o region 0x%lx-0x%lx already "
1346 "in use\n",
1347 sh->io_port, sh->io_port + 0xff);
1348 return 1;
1349 }
1350
1351 if ((command & PCI_COMMAND_MEMORY) &&
1352 ((mem_flags & 1) == 0)) {
1353 hostdata->memaddr = ioremap(mem_base, PAGE_SIZE);
1354 if (!hostdata->memaddr) {
1355 printk("qlogicisp : i/o remapping failed.\n");
1356 goto out_release;
1357 }
1358 } else {
1359 if (command & PCI_COMMAND_IO && (io_flags & 3) != 1) {
1360 printk("qlogicisp : i/o mapping is disabled\n");
1361 goto out_release;
1362 }
1363 hostdata->memaddr = NULL; /* zero to signify no i/o mapping */
1364 mem_base = 0;
1365 }
1366
1367 if (revision != ISP1020_REV_ID)
1368 printk("qlogicisp : new isp1020 revision ID (%d)\n", revision);
1369
1370 if (isp_inw(sh, PCI_ID_LOW) != PCI_VENDOR_ID_QLOGIC
1371 || isp_inw(sh, PCI_ID_HIGH) != PCI_DEVICE_ID_QLOGIC_ISP1020)
1372 {
1373 printk("qlogicisp : can't decode %s address space 0x%lx\n",
1374 (io_base ? "I/O" : "MEM"),
1375 (io_base ? io_base : mem_base));
1376 goto out_unmap;
1377 }
1378
1379 hostdata->revision = revision;
1380
1381 sh->irq = irq;
1382 sh->max_id = MAX_TARGETS;
1383 sh->max_lun = MAX_LUNS;
1384
1385 hostdata->res_cpu = pci_alloc_consistent(hostdata->pci_dev,
1386 QSIZE(RES_QUEUE_LEN),
1387 &hostdata->res_dma);
1388 if (hostdata->res_cpu == NULL) {
1389 printk("qlogicisp : can't allocate response queue\n");
1390 goto out_unmap;
1391 }
1392
1393 hostdata->req_cpu = pci_alloc_consistent(hostdata->pci_dev,
1394 QSIZE(QLOGICISP_REQ_QUEUE_LEN),
1395 &hostdata->req_dma);
1396 if (hostdata->req_cpu == NULL) {
1397 pci_free_consistent(hostdata->pci_dev,
1398 QSIZE(RES_QUEUE_LEN),
1399 hostdata->res_cpu,
1400 hostdata->res_dma);
1401 printk("qlogicisp : can't allocate request queue\n");
1402 goto out_unmap;
1403 }
1404
1405 pci_set_master(pdev);
1406
1407 LEAVE("isp1020_init");
1408
1409 return 0;
1410
1411out_unmap:
1412 iounmap(hostdata->memaddr);
1413out_release:
1414 release_region(sh->io_port, 0xff);
1415 return 1;
1416}
1417
1418
1419#if USE_NVRAM_DEFAULTS
1420
1421static int isp1020_get_defaults(struct Scsi_Host *host)
1422{
1423 int i;
1424 u_short value;
1425 struct isp1020_hostdata *hostdata =
1426 (struct isp1020_hostdata *) host->hostdata;
1427
1428 ENTER("isp1020_get_defaults");
1429
1430 if (!isp1020_verify_nvram(host)) {
1431 printk("qlogicisp : nvram checksum failure\n");
1432 printk("qlogicisp : attempting to use default parameters\n");
1433 return isp1020_set_defaults(host);
1434 }
1435
1436 value = isp1020_read_nvram_word(host, 2);
1437 hostdata->host_param.fifo_threshold = (value >> 8) & 0x03;
1438 hostdata->host_param.host_adapter_enable = (value >> 11) & 0x01;
1439 hostdata->host_param.initiator_scsi_id = (value >> 12) & 0x0f;
1440
1441 value = isp1020_read_nvram_word(host, 3);
1442 hostdata->host_param.bus_reset_delay = value & 0xff;
1443 hostdata->host_param.retry_count = value >> 8;
1444
1445 value = isp1020_read_nvram_word(host, 4);
1446 hostdata->host_param.retry_delay = value & 0xff;
1447 hostdata->host_param.async_data_setup_time = (value >> 8) & 0x0f;
1448 hostdata->host_param.req_ack_active_negation = (value >> 12) & 0x01;
1449 hostdata->host_param.data_line_active_negation = (value >> 13) & 0x01;
1450 hostdata->host_param.data_dma_burst_enable = (value >> 14) & 0x01;
1451 hostdata->host_param.command_dma_burst_enable = (value >> 15);
1452
1453 value = isp1020_read_nvram_word(host, 5);
1454 hostdata->host_param.tag_aging = value & 0xff;
1455
1456 value = isp1020_read_nvram_word(host, 6);
1457 hostdata->host_param.selection_timeout = value & 0xffff;
1458
1459 value = isp1020_read_nvram_word(host, 7);
1460 hostdata->host_param.max_queue_depth = value & 0xffff;
1461
1462#if DEBUG_ISP1020_SETUP
1463 printk("qlogicisp : fifo threshold=%d\n",
1464 hostdata->host_param.fifo_threshold);
1465 printk("qlogicisp : initiator scsi id=%d\n",
1466 hostdata->host_param.initiator_scsi_id);
1467 printk("qlogicisp : bus reset delay=%d\n",
1468 hostdata->host_param.bus_reset_delay);
1469 printk("qlogicisp : retry count=%d\n",
1470 hostdata->host_param.retry_count);
1471 printk("qlogicisp : retry delay=%d\n",
1472 hostdata->host_param.retry_delay);
1473 printk("qlogicisp : async data setup time=%d\n",
1474 hostdata->host_param.async_data_setup_time);
1475 printk("qlogicisp : req/ack active negation=%d\n",
1476 hostdata->host_param.req_ack_active_negation);
1477 printk("qlogicisp : data line active negation=%d\n",
1478 hostdata->host_param.data_line_active_negation);
1479 printk("qlogicisp : data DMA burst enable=%d\n",
1480 hostdata->host_param.data_dma_burst_enable);
1481 printk("qlogicisp : command DMA burst enable=%d\n",
1482 hostdata->host_param.command_dma_burst_enable);
1483 printk("qlogicisp : tag age limit=%d\n",
1484 hostdata->host_param.tag_aging);
1485 printk("qlogicisp : selection timeout limit=%d\n",
1486 hostdata->host_param.selection_timeout);
1487 printk("qlogicisp : max queue depth=%d\n",
1488 hostdata->host_param.max_queue_depth);
1489#endif /* DEBUG_ISP1020_SETUP */
1490
1491 for (i = 0; i < MAX_TARGETS; i++) {
1492
1493 value = isp1020_read_nvram_word(host, 14 + i * 3);
1494 hostdata->dev_param[i].device_flags = value & 0xff;
1495 hostdata->dev_param[i].execution_throttle = value >> 8;
1496
1497 value = isp1020_read_nvram_word(host, 15 + i * 3);
1498 hostdata->dev_param[i].synchronous_period = value & 0xff;
1499 hostdata->dev_param[i].synchronous_offset = (value >> 8) & 0x0f;
1500 hostdata->dev_param[i].device_enable = (value >> 12) & 0x01;
1501
1502#if DEBUG_ISP1020_SETUP
1503 printk("qlogicisp : target 0x%02x\n", i);
1504 printk("qlogicisp : device flags=0x%02x\n",
1505 hostdata->dev_param[i].device_flags);
1506 printk("qlogicisp : execution throttle=%d\n",
1507 hostdata->dev_param[i].execution_throttle);
1508 printk("qlogicisp : synchronous period=%d\n",
1509 hostdata->dev_param[i].synchronous_period);
1510 printk("qlogicisp : synchronous offset=%d\n",
1511 hostdata->dev_param[i].synchronous_offset);
1512 printk("qlogicisp : device enable=%d\n",
1513 hostdata->dev_param[i].device_enable);
1514#endif /* DEBUG_ISP1020_SETUP */
1515 }
1516
1517 LEAVE("isp1020_get_defaults");
1518
1519 return 0;
1520}
1521
1522
1523#define ISP1020_NVRAM_LEN 0x40
1524#define ISP1020_NVRAM_SIG1 0x5349
1525#define ISP1020_NVRAM_SIG2 0x2050
1526
1527static int isp1020_verify_nvram(struct Scsi_Host *host)
1528{
1529 int i;
1530 u_short value;
1531 u_char checksum = 0;
1532
1533 for (i = 0; i < ISP1020_NVRAM_LEN; i++) {
1534 value = isp1020_read_nvram_word(host, i);
1535
1536 switch (i) {
1537 case 0:
1538 if (value != ISP1020_NVRAM_SIG1) return 0;
1539 break;
1540 case 1:
1541 if (value != ISP1020_NVRAM_SIG2) return 0;
1542 break;
1543 case 2:
1544 if ((value & 0xff) != 0x02) return 0;
1545 break;
1546 }
1547 checksum += value & 0xff;
1548 checksum += value >> 8;
1549 }
1550
1551 return (checksum == 0);
1552}
1553
1554#define NVRAM_DELAY() udelay(2) /* 2 microsecond delay */
1555
1556
1557u_short isp1020_read_nvram_word(struct Scsi_Host *host, u_short byte)
1558{
1559 int i;
1560 u_short value, output, input;
1561
1562 byte &= 0x3f; byte |= 0x0180;
1563
1564 for (i = 8; i >= 0; i--) {
1565 output = ((byte >> i) & 0x1) ? 0x4 : 0x0;
1566 isp_outw(output | 0x2, host, PCI_NVRAM); NVRAM_DELAY();
1567 isp_outw(output | 0x3, host, PCI_NVRAM); NVRAM_DELAY();
1568 isp_outw(output | 0x2, host, PCI_NVRAM); NVRAM_DELAY();
1569 }
1570
1571 for (i = 0xf, value = 0; i >= 0; i--) {
1572 value <<= 1;
1573 isp_outw(0x3, host, PCI_NVRAM); NVRAM_DELAY();
1574 input = isp_inw(host, PCI_NVRAM); NVRAM_DELAY();
1575 isp_outw(0x2, host, PCI_NVRAM); NVRAM_DELAY();
1576 if (input & 0x8) value |= 1;
1577 }
1578
1579 isp_outw(0x0, host, PCI_NVRAM); NVRAM_DELAY();
1580
1581 return value;
1582}
1583
1584#endif /* USE_NVRAM_DEFAULTS */
1585
1586
1587static int isp1020_set_defaults(struct Scsi_Host *host)
1588{
1589 struct isp1020_hostdata *hostdata =
1590 (struct isp1020_hostdata *) host->hostdata;
1591 int i;
1592
1593 ENTER("isp1020_set_defaults");
1594
1595 hostdata->host_param.fifo_threshold = 2;
1596 hostdata->host_param.host_adapter_enable = 1;
1597 hostdata->host_param.initiator_scsi_id = 7;
1598 hostdata->host_param.bus_reset_delay = 3;
1599 hostdata->host_param.retry_count = 0;
1600 hostdata->host_param.retry_delay = 1;
1601 hostdata->host_param.async_data_setup_time = 6;
1602 hostdata->host_param.req_ack_active_negation = 1;
1603 hostdata->host_param.data_line_active_negation = 1;
1604 hostdata->host_param.data_dma_burst_enable = 1;
1605 hostdata->host_param.command_dma_burst_enable = 1;
1606 hostdata->host_param.tag_aging = 8;
1607 hostdata->host_param.selection_timeout = 250;
1608 hostdata->host_param.max_queue_depth = 256;
1609
1610 for (i = 0; i < MAX_TARGETS; i++) {
1611 hostdata->dev_param[i].device_flags = 0xfd;
1612 hostdata->dev_param[i].execution_throttle = 16;
1613 hostdata->dev_param[i].synchronous_period = 25;
1614 hostdata->dev_param[i].synchronous_offset = 12;
1615 hostdata->dev_param[i].device_enable = 1;
1616 }
1617
1618 LEAVE("isp1020_set_defaults");
1619
1620 return 0;
1621}
1622
1623
1624static int isp1020_load_parameters(struct Scsi_Host *host)
1625{
1626 int i, k;
1627#ifdef CONFIG_QL_ISP_A64
1628 u_long queue_addr;
1629 u_short param[8];
1630#else
1631 u_int queue_addr;
1632 u_short param[6];
1633#endif
1634 u_short isp_cfg1, hwrev;
1635 struct isp1020_hostdata *hostdata =
1636 (struct isp1020_hostdata *) host->hostdata;
1637
1638 ENTER("isp1020_load_parameters");
1639
1640 hwrev = isp_inw(host, ISP_CFG0) & ISP_CFG0_HWMSK;
1641 isp_cfg1 = ISP_CFG1_F64 | ISP_CFG1_BENAB;
1642 if (hwrev == ISP_CFG0_1040A) {
1643 /* Busted fifo, says mjacob. */
1644 isp_cfg1 &= ISP_CFG1_BENAB;
1645 }
1646
1647 isp_outw(isp_inw(host, ISP_CFG1) | isp_cfg1, host, ISP_CFG1);
1648 isp_outw(isp_inw(host, CDMA_CONF) | DMA_CONF_BENAB, host, CDMA_CONF);
1649 isp_outw(isp_inw(host, DDMA_CONF) | DMA_CONF_BENAB, host, DDMA_CONF);
1650
1651 param[0] = MBOX_SET_INIT_SCSI_ID;
1652 param[1] = hostdata->host_param.initiator_scsi_id;
1653
1654 isp1020_mbox_command(host, param);
1655
1656 if (param[0] != MBOX_COMMAND_COMPLETE) {
1657 printk("qlogicisp : set initiator id failure\n");
1658 return 1;
1659 }
1660
1661 param[0] = MBOX_SET_RETRY_COUNT;
1662 param[1] = hostdata->host_param.retry_count;
1663 param[2] = hostdata->host_param.retry_delay;
1664
1665 isp1020_mbox_command(host, param);
1666
1667 if (param[0] != MBOX_COMMAND_COMPLETE) {
1668 printk("qlogicisp : set retry count failure\n");
1669 return 1;
1670 }
1671
1672 param[0] = MBOX_SET_ASYNC_DATA_SETUP_TIME;
1673 param[1] = hostdata->host_param.async_data_setup_time;
1674
1675 isp1020_mbox_command(host, param);
1676
1677 if (param[0] != MBOX_COMMAND_COMPLETE) {
1678 printk("qlogicisp : async data setup time failure\n");
1679 return 1;
1680 }
1681
1682 param[0] = MBOX_SET_ACTIVE_NEG_STATE;
1683 param[1] = (hostdata->host_param.req_ack_active_negation << 4)
1684 | (hostdata->host_param.data_line_active_negation << 5);
1685
1686 isp1020_mbox_command(host, param);
1687
1688 if (param[0] != MBOX_COMMAND_COMPLETE) {
1689 printk("qlogicisp : set active negation state failure\n");
1690 return 1;
1691 }
1692
1693 param[0] = MBOX_SET_PCI_CONTROL_PARAMS;
1694 param[1] = hostdata->host_param.data_dma_burst_enable << 1;
1695 param[2] = hostdata->host_param.command_dma_burst_enable << 1;
1696
1697 isp1020_mbox_command(host, param);
1698
1699 if (param[0] != MBOX_COMMAND_COMPLETE) {
1700 printk("qlogicisp : set pci control parameter failure\n");
1701 return 1;
1702 }
1703
1704 param[0] = MBOX_SET_TAG_AGE_LIMIT;
1705 param[1] = hostdata->host_param.tag_aging;
1706
1707 isp1020_mbox_command(host, param);
1708
1709 if (param[0] != MBOX_COMMAND_COMPLETE) {
1710 printk("qlogicisp : set tag age limit failure\n");
1711 return 1;
1712 }
1713
1714 param[0] = MBOX_SET_SELECT_TIMEOUT;
1715 param[1] = hostdata->host_param.selection_timeout;
1716
1717 isp1020_mbox_command(host, param);
1718
1719 if (param[0] != MBOX_COMMAND_COMPLETE) {
1720 printk("qlogicisp : set selection timeout failure\n");
1721 return 1;
1722 }
1723
1724 for (i = 0; i < MAX_TARGETS; i++) {
1725
1726 if (!hostdata->dev_param[i].device_enable)
1727 continue;
1728
1729 param[0] = MBOX_SET_TARGET_PARAMS;
1730 param[1] = i << 8;
1731 param[2] = hostdata->dev_param[i].device_flags << 8;
1732 param[3] = (hostdata->dev_param[i].synchronous_offset << 8)
1733 | hostdata->dev_param[i].synchronous_period;
1734
1735 isp1020_mbox_command(host, param);
1736
1737 if (param[0] != MBOX_COMMAND_COMPLETE) {
1738 printk("qlogicisp : set target parameter failure\n");
1739 return 1;
1740 }
1741
1742 for (k = 0; k < MAX_LUNS; k++) {
1743
1744 param[0] = MBOX_SET_DEV_QUEUE_PARAMS;
1745 param[1] = (i << 8) | k;
1746 param[2] = hostdata->host_param.max_queue_depth;
1747 param[3] = hostdata->dev_param[i].execution_throttle;
1748
1749 isp1020_mbox_command(host, param);
1750
1751 if (param[0] != MBOX_COMMAND_COMPLETE) {
1752 printk("qlogicisp : set device queue "
1753 "parameter failure\n");
1754 return 1;
1755 }
1756 }
1757 }
1758
1759 queue_addr = hostdata->res_dma;
1760#ifdef CONFIG_QL_ISP_A64
1761 param[0] = MBOX_CMD_INIT_RESPONSE_QUEUE_64;
1762#else
1763 param[0] = MBOX_INIT_RES_QUEUE;
1764#endif
1765 param[1] = RES_QUEUE_LEN + 1;
1766 param[2] = (u_short) (queue_addr >> 16);
1767 param[3] = (u_short) (queue_addr & 0xffff);
1768 param[4] = 0;
1769 param[5] = 0;
1770#ifdef CONFIG_QL_ISP_A64
1771 param[6] = (u_short) (queue_addr >> 48);
1772 param[7] = (u_short) (queue_addr >> 32);
1773#endif
1774
1775 isp1020_mbox_command(host, param);
1776
1777 if (param[0] != MBOX_COMMAND_COMPLETE) {
1778 printk("qlogicisp : set response queue failure\n");
1779 return 1;
1780 }
1781
1782 queue_addr = hostdata->req_dma;
1783#ifdef CONFIG_QL_ISP_A64
1784 param[0] = MBOX_CMD_INIT_REQUEST_QUEUE_64;
1785#else
1786 param[0] = MBOX_INIT_REQ_QUEUE;
1787#endif
1788 param[1] = QLOGICISP_REQ_QUEUE_LEN + 1;
1789 param[2] = (u_short) (queue_addr >> 16);
1790 param[3] = (u_short) (queue_addr & 0xffff);
1791 param[4] = 0;
1792
1793#ifdef CONFIG_QL_ISP_A64
1794 param[5] = 0;
1795 param[6] = (u_short) (queue_addr >> 48);
1796 param[7] = (u_short) (queue_addr >> 32);
1797#endif
1798
1799 isp1020_mbox_command(host, param);
1800
1801 if (param[0] != MBOX_COMMAND_COMPLETE) {
1802 printk("qlogicisp : set request queue failure\n");
1803 return 1;
1804 }
1805
1806 LEAVE("isp1020_load_parameters");
1807
1808 return 0;
1809}
1810
1811
1812/*
1813 * currently, this is only called during initialization or abort/reset,
1814 * at which times interrupts are disabled, so polling is OK, I guess...
1815 */
1816static int isp1020_mbox_command(struct Scsi_Host *host, u_short param[])
1817{
1818 int loop_count;
1819
1820 if (mbox_param[param[0]] == 0)
1821 return 1;
1822
1823 loop_count = DEFAULT_LOOP_COUNT;
1824 while (--loop_count && isp_inw(host, HOST_HCCR) & 0x0080) {
1825 barrier();
1826 cpu_relax();
1827 }
1828 if (!loop_count)
1829 printk("qlogicisp: mbox_command loop timeout #1\n");
1830
1831 switch(mbox_param[param[0]] >> 4) {
1832 case 8: isp_outw(param[7], host, MBOX7);
1833 case 7: isp_outw(param[6], host, MBOX6);
1834 case 6: isp_outw(param[5], host, MBOX5);
1835 case 5: isp_outw(param[4], host, MBOX4);
1836 case 4: isp_outw(param[3], host, MBOX3);
1837 case 3: isp_outw(param[2], host, MBOX2);
1838 case 2: isp_outw(param[1], host, MBOX1);
1839 case 1: isp_outw(param[0], host, MBOX0);
1840 }
1841
1842 isp_outw(0x0, host, PCI_SEMAPHORE);
1843 isp_outw(HCCR_CLEAR_RISC_INTR, host, HOST_HCCR);
1844 isp_outw(HCCR_SET_HOST_INTR, host, HOST_HCCR);
1845
1846 loop_count = DEFAULT_LOOP_COUNT;
1847 while (--loop_count && !(isp_inw(host, PCI_INTF_STS) & 0x04)) {
1848 barrier();
1849 cpu_relax();
1850 }
1851 if (!loop_count)
1852 printk("qlogicisp: mbox_command loop timeout #2\n");
1853
1854 loop_count = DEFAULT_LOOP_COUNT;
1855 while (--loop_count && isp_inw(host, MBOX0) == 0x04) {
1856 barrier();
1857 cpu_relax();
1858 }
1859 if (!loop_count)
1860 printk("qlogicisp: mbox_command loop timeout #3\n");
1861
1862 switch(mbox_param[param[0]] & 0xf) {
1863 case 8: param[7] = isp_inw(host, MBOX7);
1864 case 7: param[6] = isp_inw(host, MBOX6);
1865 case 6: param[5] = isp_inw(host, MBOX5);
1866 case 5: param[4] = isp_inw(host, MBOX4);
1867 case 4: param[3] = isp_inw(host, MBOX3);
1868 case 3: param[2] = isp_inw(host, MBOX2);
1869 case 2: param[1] = isp_inw(host, MBOX1);
1870 case 1: param[0] = isp_inw(host, MBOX0);
1871 }
1872
1873 isp_outw(0x0, host, PCI_SEMAPHORE);
1874 isp_outw(HCCR_CLEAR_RISC_INTR, host, HOST_HCCR);
1875
1876 return 0;
1877}
1878
1879
1880#if DEBUG_ISP1020_INTR
1881
1882void isp1020_print_status_entry(struct Status_Entry *status)
1883{
1884 int i;
1885
1886 printk("qlogicisp : entry count = 0x%02x, type = 0x%02x, flags = 0x%02x\n",
1887 status->hdr.entry_cnt, status->hdr.entry_type, status->hdr.flags);
1888 printk("qlogicisp : scsi status = 0x%04x, completion status = 0x%04x\n",
1889 le16_to_cpu(status->scsi_status), le16_to_cpu(status->completion_status));
1890 printk("qlogicisp : state flags = 0x%04x, status flags = 0x%04x\n",
1891 le16_to_cpu(status->state_flags), le16_to_cpu(status->status_flags));
1892 printk("qlogicisp : time = 0x%04x, request sense length = 0x%04x\n",
1893 le16_to_cpu(status->time), le16_to_cpu(status->req_sense_len));
1894 printk("qlogicisp : residual transfer length = 0x%08x\n",
1895 le32_to_cpu(status->residual));
1896
1897 for (i = 0; i < le16_to_cpu(status->req_sense_len); i++)
1898 printk("qlogicisp : sense data = 0x%02x\n", status->req_sense_data[i]);
1899}
1900
1901#endif /* DEBUG_ISP1020_INTR */
1902
1903
1904#if DEBUG_ISP1020
1905
1906void isp1020_print_scsi_cmd(Scsi_Cmnd *cmd)
1907{
1908 int i;
1909
1910 printk("qlogicisp : target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n",
1911 cmd->target, cmd->lun, cmd->cmd_len);
1912 printk("qlogicisp : command = ");
1913 for (i = 0; i < cmd->cmd_len; i++)
1914 printk("0x%02x ", cmd->cmnd[i]);
1915 printk("\n");
1916}
1917
1918#endif /* DEBUG_ISP1020 */
1919
1920MODULE_LICENSE("GPL");
1921
1922static Scsi_Host_Template driver_template = {
1923 .detect = isp1020_detect,
1924 .release = isp1020_release,
1925 .info = isp1020_info,
1926 .queuecommand = isp1020_queuecommand,
1927 .bios_param = isp1020_biosparam,
1928 .can_queue = QLOGICISP_REQ_QUEUE_LEN,
1929 .this_id = -1,
1930 .sg_tablesize = QLOGICISP_MAX_SG(QLOGICISP_REQ_QUEUE_LEN),
1931 .cmd_per_lun = 1,
1932 .use_clustering = DISABLE_CLUSTERING,
1933};
1934#include "scsi_module.c"
diff --git a/drivers/scsi/qlogicisp_asm.c b/drivers/scsi/qlogicisp_asm.c
deleted file mode 100644
index 9ea4beca4ac5..000000000000
--- a/drivers/scsi/qlogicisp_asm.c
+++ /dev/null
@@ -1,2034 +0,0 @@
1/*
2 * Firmware Version 7.63.00 (12:07 Jan 27, 1999)
3 */
4static const unsigned short risc_code_version = 7*1024+63;
5
6static const unsigned short risc_code_addr01 = 0x1000 ;
7
8#if RELOAD_FIRMWARE
9
10static const unsigned short risc_code01[] = {
11 0x0078, 0x103a, 0x0000, 0x3f14, 0x0000, 0x2043, 0x4f50, 0x5952,
12 0x4947, 0x4854, 0x2031, 0x3939, 0x3520, 0x514c, 0x4f47, 0x4943,
13 0x2043, 0x4f52, 0x504f, 0x5241, 0x5449, 0x4f4e, 0x2049, 0x5350,
14 0x3130, 0x3230, 0x2049, 0x2f54, 0x2046, 0x6972, 0x6d77, 0x6172,
15 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030, 0x372e, 0x3633,
16 0x2020, 0x2043, 0x7573, 0x746f, 0x6d65, 0x7220, 0x4e6f, 0x2e20,
17 0x3030, 0x2050, 0x726f, 0x6475, 0x6374, 0x204e, 0x6f2e, 0x2020,
18 0x3031, 0x2024, 0x2001, 0x04fd, 0x2004, 0xa082, 0x0005, 0x0048,
19 0x1045, 0x0038, 0x104b, 0x0078, 0x1047, 0x0028, 0x104b, 0x20b9,
20 0x1212, 0x0078, 0x104d, 0x20b9, 0x2222, 0x20c1, 0x0008, 0x2071,
21 0x0010, 0x70c3, 0x0004, 0x20c9, 0x76ff, 0x2089, 0x1186, 0x70c7,
22 0x4953, 0x70cb, 0x5020, 0x70cf, 0x2020, 0x70d3, 0x0007, 0x3f00,
23 0x70d6, 0x20c1, 0x0008, 0x2019, 0x0000, 0x2009, 0xfeff, 0x2100,
24 0x200b, 0xa5a5, 0xa1ec, 0x7fff, 0x2d64, 0x206b, 0x0a0a, 0xaddc,
25 0x3fff, 0x2b54, 0x205b, 0x5050, 0x2114, 0xa286, 0xa5a5, 0x0040,
26 0x10bf, 0xa386, 0x000f, 0x0040, 0x1085, 0x2c6a, 0x2a5a, 0x20c1,
27 0x0000, 0x2019, 0x000f, 0x0078, 0x1065, 0x2c6a, 0x2a5a, 0x20c1,
28 0x0008, 0x2009, 0x7fff, 0x2148, 0x2944, 0x204b, 0x0a0a, 0xa9bc,
29 0x3fff, 0x2734, 0x203b, 0x5050, 0x2114, 0xa286, 0x0a0a, 0x0040,
30 0x10a9, 0x284a, 0x263a, 0x20c1, 0x0004, 0x2009, 0x3fff, 0x2134,
31 0x200b, 0x5050, 0x2114, 0xa286, 0x5050, 0x0040, 0x10aa, 0x0078,
32 0x118e, 0x284a, 0x263a, 0x98c0, 0xa188, 0x1000, 0x212c, 0x200b,
33 0xa5a5, 0x2114, 0xa286, 0xa5a5, 0x0040, 0x10bc, 0x250a, 0xa18a,
34 0x1000, 0x98c1, 0x0078, 0x10c1, 0x250a, 0x0078, 0x10c1, 0x2c6a,
35 0x2a5a, 0x2130, 0xa18a, 0x0040, 0x2128, 0xa1a2, 0x5000, 0x8424,
36 0x8424, 0x8424, 0x8424, 0x8424, 0x8424, 0xa192, 0x7700, 0x2009,
37 0x0000, 0x2001, 0x0031, 0x1078, 0x1c9d, 0x2218, 0x2079, 0x5000,
38 0x2fa0, 0x2408, 0x2011, 0x0000, 0x20a9, 0x0040, 0x42a4, 0x8109,
39 0x00c0, 0x10dc, 0x7ef2, 0x8528, 0x7de6, 0x7cea, 0x7bee, 0x7883,
40 0x0000, 0x2031, 0x0030, 0x78cf, 0x0101, 0x780b, 0x0002, 0x780f,
41 0x0002, 0x784f, 0x0003, 0x2069, 0x5040, 0x2001, 0x04fd, 0x2004,
42 0xa082, 0x0005, 0x0048, 0x1104, 0x0038, 0x1100, 0x0078, 0x1108,
43 0x681b, 0x003c, 0x0078, 0x110a, 0x00a8, 0x1108, 0x681b, 0x003c,
44 0x681b, 0x0028, 0x6807, 0x0007, 0x680b, 0x00fa, 0x680f, 0x0008,
45 0x6813, 0x0005, 0x6823, 0x0000, 0x6827, 0x0006, 0x6817, 0x0008,
46 0x682b, 0x0000, 0x681f, 0x0019, 0x2069, 0x5280, 0x2011, 0x0020,
47 0x2009, 0x0010, 0x680b, 0x080c, 0x680f, 0x0019, 0x6803, 0xfd00,
48 0x6807, 0x0018, 0x6a1a, 0x2d00, 0xa0e8, 0x0008, 0xa290, 0x0004,
49 0x8109, 0x00c0, 0x1122, 0x2069, 0x5300, 0x2009, 0x0002, 0x20a9,
50 0x0100, 0x6837, 0x0000, 0x680b, 0x0040, 0x7bf0, 0xa386, 0xfeff,
51 0x00c0, 0x1148, 0x6817, 0x0100, 0x681f, 0x0064, 0x0078, 0x114c,
52 0x6817, 0x0064, 0x681f, 0x0002, 0xade8, 0x0010, 0x0070, 0x1152,
53 0x0078, 0x1139, 0x8109, 0x00c0, 0x1137, 0x1078, 0x21e9, 0x1078,
54 0x46e9, 0x1078, 0x1946, 0x1078, 0x4bdf, 0x3200, 0xa085, 0x000d,
55 0x2090, 0x70c3, 0x0000, 0x0090, 0x116c, 0x70c0, 0xa086, 0x0002,
56 0x00c0, 0x116c, 0x1078, 0x1284, 0x1078, 0x1196, 0x78cc, 0xa005,
57 0x00c0, 0x117a, 0x1078, 0x1cc6, 0x0010, 0x1180, 0x0068, 0x1180,
58 0x1078, 0x20c8, 0x0010, 0x1180, 0x0068, 0x1180, 0x1078, 0x1a2b,
59 0x00e0, 0x116c, 0x1078, 0x4a66, 0x0078, 0x116c, 0x118e, 0x1190,
60 0x23ea, 0x23ea, 0x476a, 0x476a, 0x23ea, 0x23ea, 0x0078, 0x118e,
61 0x0078, 0x1190, 0x0078, 0x1192, 0x0078, 0x1194, 0x0068, 0x1201,
62 0x2061, 0x0000, 0x6018, 0xa084, 0x0001, 0x00c0, 0x1201, 0x7814,
63 0xa005, 0x00c0, 0x11a7, 0x0010, 0x1202, 0x0078, 0x1201, 0x2009,
64 0x505b, 0x2104, 0xa005, 0x00c0, 0x1201, 0x2009, 0x5064, 0x200b,
65 0x0000, 0x7914, 0xa186, 0x0042, 0x00c0, 0x11cc, 0x7816, 0x2009,
66 0x5062, 0x2164, 0x200b, 0x0000, 0x6018, 0x70c6, 0x6014, 0x70ca,
67 0x611c, 0xa18c, 0xff00, 0x6020, 0xa084, 0x00ff, 0xa105, 0x70ce,
68 0x1078, 0x192b, 0x0078, 0x11ff, 0x7814, 0xa086, 0x0018, 0x00c0,
69 0x11d3, 0x1078, 0x165a, 0x7817, 0x0000, 0x2009, 0x5062, 0x2104,
70 0xa065, 0x0040, 0x11ef, 0x0c7e, 0x609c, 0x2060, 0x1078, 0x1996,
71 0x0c7f, 0x609f, 0x0000, 0x1078, 0x1730, 0x2009, 0x000c, 0x6007,
72 0x0103, 0x1078, 0x1907, 0x00c0, 0x11fb, 0x1078, 0x192b, 0x2009,
73 0x5062, 0x200b, 0x0000, 0x2009, 0x505c, 0x2104, 0x200b, 0x0000,
74 0xa005, 0x0040, 0x11ff, 0x2001, 0x4005, 0x0078, 0x1286, 0x0078,
75 0x1284, 0x007c, 0x70c3, 0x0000, 0x70c7, 0x0000, 0x70cb, 0x0000,
76 0x70cf, 0x0000, 0x70c0, 0xa0bc, 0xffc0, 0x00c0, 0x1252, 0x2038,
77 0x0079, 0x1212, 0x1284, 0x12e5, 0x12a9, 0x12fe, 0x130d, 0x1313,
78 0x12a0, 0x1748, 0x1317, 0x1298, 0x12ad, 0x12af, 0x12b1, 0x12b3,
79 0x174d, 0x1298, 0x1329, 0x1360, 0x1672, 0x1742, 0x12b5, 0x1591,
80 0x15ad, 0x15c9, 0x15f4, 0x154a, 0x1558, 0x156c, 0x1580, 0x13df,
81 0x1298, 0x138d, 0x1393, 0x1398, 0x139d, 0x13a3, 0x13a8, 0x13ad,
82 0x13b2, 0x13b7, 0x13bb, 0x13d0, 0x13dc, 0x1298, 0x1298, 0x1298,
83 0x1298, 0x13eb, 0x13f4, 0x1403, 0x1429, 0x1433, 0x143a, 0x1480,
84 0x148f, 0x149e, 0x14b0, 0x152a, 0x153a, 0x1298, 0x1298, 0x1298,
85 0x1298, 0x153f, 0xa0bc, 0xffa0, 0x00c0, 0x1298, 0x2038, 0xa084,
86 0x001f, 0x0079, 0x125b, 0x1786, 0x1789, 0x1799, 0x1298, 0x1298,
87 0x18d8, 0x18f5, 0x1298, 0x1298, 0x1298, 0x18f9, 0x1901, 0x1298,
88 0x1298, 0x1298, 0x1298, 0x12db, 0x12f4, 0x131f, 0x1356, 0x1668,
89 0x1764, 0x1778, 0x1298, 0x1829, 0x1298, 0x18b4, 0x18be, 0x18c2,
90 0x18d0, 0x1298, 0x1298, 0x72ca, 0x71c6, 0x2001, 0x4006, 0x0078,
91 0x1286, 0x73ce, 0x72ca, 0x71c6, 0x2001, 0x4000, 0x70c2, 0x0068,
92 0x1287, 0x2061, 0x0000, 0x601b, 0x0001, 0x2091, 0x5000, 0x00e0,
93 0x128f, 0x00e0, 0x1291, 0x0068, 0x1291, 0x2091, 0x4080, 0x007c,
94 0x70c3, 0x4001, 0x0078, 0x1287, 0x70c3, 0x4006, 0x0078, 0x1287,
95 0x2099, 0x0041, 0x20a1, 0x0041, 0x20a9, 0x0005, 0x53a3, 0x0078,
96 0x1284, 0x70c4, 0x70c3, 0x0004, 0x007a, 0x0078, 0x1284, 0x0078,
97 0x1284, 0x0078, 0x1284, 0x0078, 0x1284, 0x2091, 0x8000, 0x70c3,
98 0x0000, 0x70c7, 0x4953, 0x70cb, 0x5020, 0x70cf, 0x2020, 0x70d3,
99 0x0007, 0x3f00, 0x70d6, 0x2079, 0x0000, 0x781b, 0x0001, 0x2031,
100 0x0030, 0x2059, 0x1000, 0x2029, 0x0457, 0x2051, 0x0470, 0x2061,
101 0x0472, 0x20b9, 0xffff, 0x20c1, 0x0000, 0x2091, 0x5000, 0x2091,
102 0x4080, 0x0078, 0x0455, 0x1078, 0x1b36, 0x00c0, 0x129c, 0x75d8,
103 0x74dc, 0x75da, 0x74de, 0x0078, 0x12e8, 0x2029, 0x0000, 0x2520,
104 0x71d0, 0x73c8, 0x72cc, 0x70c4, 0x1078, 0x1a70, 0x0040, 0x1284,
105 0x70c3, 0x4002, 0x0078, 0x1284, 0x1078, 0x1b36, 0x00c0, 0x129c,
106 0x75d8, 0x74dc, 0x75da, 0x74de, 0x0078, 0x1301, 0x2029, 0x0000,
107 0x2520, 0x71d0, 0x73c8, 0x72cc, 0x70c4, 0x1078, 0x1ad0, 0x0040,
108 0x1284, 0x70c3, 0x4002, 0x0078, 0x1284, 0x71c4, 0x70c8, 0x2114,
109 0x200a, 0x0078, 0x1282, 0x71c4, 0x2114, 0x0078, 0x1282, 0x70c7,
110 0x0007, 0x70cb, 0x003f, 0x70cf, 0x0000, 0x0078, 0x1284, 0x1078,
111 0x1b36, 0x00c0, 0x129c, 0x75d8, 0x76dc, 0x75da, 0x76de, 0x0078,
112 0x132c, 0x2029, 0x0000, 0x2530, 0x70c4, 0x72c8, 0x73cc, 0x74d0,
113 0x70c6, 0x72ca, 0x73ce, 0x74d2, 0xa005, 0x0040, 0x1350, 0x8001,
114 0x7892, 0xa084, 0xfc00, 0x0040, 0x1345, 0x78cc, 0xa085, 0x0001,
115 0x78ce, 0x2001, 0x4005, 0x0078, 0x1286, 0x7a9a, 0x7b9e, 0x7da2,
116 0x7ea6, 0x7c96, 0x78cc, 0xa084, 0xfffc, 0x78ce, 0x0078, 0x1354,
117 0x78cc, 0xa085, 0x0001, 0x78ce, 0x0078, 0x1284, 0x1078, 0x1b36,
118 0x00c0, 0x129c, 0x75d8, 0x76dc, 0x75da, 0x76de, 0x0078, 0x1363,
119 0x2029, 0x0000, 0x2530, 0x70c4, 0x72c8, 0x73cc, 0x74d4, 0x70c6,
120 0x72ca, 0x73ce, 0x74d6, 0xa005, 0x0040, 0x1387, 0x8001, 0x78ae,
121 0xa084, 0xfc00, 0x0040, 0x137c, 0x78cc, 0xa085, 0x0100, 0x78ce,
122 0x2001, 0x4005, 0x0078, 0x1286, 0x7ab6, 0x7bba, 0x7dbe, 0x7ec2,
123 0x7cb2, 0x78cc, 0xa084, 0xfcff, 0x78ce, 0x0078, 0x138b, 0x78cc,
124 0xa085, 0x0100, 0x78ce, 0x0078, 0x1284, 0x2009, 0x5061, 0x210c,
125 0x7aec, 0x0078, 0x1282, 0x2009, 0x5041, 0x210c, 0x0078, 0x1283,
126 0x2009, 0x5042, 0x210c, 0x0078, 0x1283, 0x2061, 0x5040, 0x610c,
127 0x6210, 0x0078, 0x1282, 0x2009, 0x5045, 0x210c, 0x0078, 0x1283,
128 0x2009, 0x5046, 0x210c, 0x0078, 0x1283, 0x2009, 0x5048, 0x210c,
129 0x0078, 0x1283, 0x2009, 0x5049, 0x210c, 0x0078, 0x1283, 0x7908,
130 0x7a0c, 0x0078, 0x1282, 0x71c4, 0x8107, 0xa084, 0x000f, 0x8003,
131 0x8003, 0x8003, 0xa0e8, 0x5280, 0x6a00, 0x6804, 0xa084, 0x0008,
132 0x0040, 0x13cd, 0x6b08, 0x0078, 0x13ce, 0x6b0c, 0x0078, 0x1281,
133 0x77c4, 0x1078, 0x1956, 0x2091, 0x8000, 0x6b1c, 0x6a14, 0x2091,
134 0x8001, 0x2708, 0x0078, 0x1281, 0x794c, 0x0078, 0x1283, 0x77c4,
135 0x1078, 0x1956, 0x2091, 0x8000, 0x6908, 0x6a18, 0x6b10, 0x2091,
136 0x8001, 0x0078, 0x1281, 0x71c4, 0xa182, 0x0010, 0x00c8, 0x127c,
137 0x1078, 0x22c1, 0x0078, 0x1281, 0x71c4, 0xa182, 0x0010, 0x00c8,
138 0x127c, 0x2011, 0x5041, 0x2204, 0x007e, 0x2112, 0x1078, 0x227a,
139 0x017f, 0x0078, 0x1283, 0x71c4, 0x2011, 0x1421, 0x20a9, 0x0008,
140 0x2204, 0xa106, 0x0040, 0x1413, 0x8210, 0x0070, 0x1411, 0x0078,
141 0x1408, 0x0078, 0x127c, 0xa292, 0x1421, 0x027e, 0x2011, 0x5042,
142 0x2204, 0x2112, 0x017f, 0x007e, 0x1078, 0x2286, 0x017f, 0x0078,
143 0x1283, 0x03e8, 0x00fa, 0x01f4, 0x02ee, 0x0064, 0x0019, 0x0032,
144 0x004b, 0x2061, 0x5040, 0x610c, 0x6210, 0x70c4, 0x600e, 0x70c8,
145 0x6012, 0x0078, 0x1282, 0x2061, 0x5040, 0x6114, 0x70c4, 0x6016,
146 0x0078, 0x1283, 0x2061, 0x5040, 0x71c4, 0x2011, 0x0004, 0x601f,
147 0x0019, 0x2019, 0x1212, 0xa186, 0x0028, 0x0040, 0x145b, 0x2011,
148 0x0005, 0x601f, 0x0019, 0x2019, 0x1212, 0xa186, 0x0032, 0x0040,
149 0x145b, 0x2011, 0x0006, 0x601f, 0x000c, 0x2019, 0x2222, 0xa186,
150 0x003c, 0x00c0, 0x127c, 0x6018, 0x007e, 0x611a, 0x7800, 0xa084,
151 0x0001, 0x00c0, 0x1476, 0x2001, 0x04fd, 0x2004, 0xa082, 0x0005,
152 0x0048, 0x146e, 0x0038, 0x1472, 0x0078, 0x1476, 0x0028, 0x1472,
153 0x0078, 0x1476, 0x2019, 0x2222, 0x0078, 0x1478, 0x2019, 0x1212,
154 0x23b8, 0x1078, 0x2297, 0x1078, 0x4bdf, 0x017f, 0x0078, 0x1283,
155 0x71c4, 0xa184, 0xffcf, 0x00c0, 0x127c, 0x2011, 0x5048, 0x2204,
156 0x2112, 0x007e, 0x1078, 0x22b9, 0x017f, 0x0078, 0x1283, 0x71c4,
157 0xa182, 0x0010, 0x00c8, 0x127c, 0x2011, 0x5049, 0x2204, 0x007e,
158 0x2112, 0x1078, 0x22a8, 0x017f, 0x0078, 0x1283, 0x71c4, 0x72c8,
159 0xa184, 0xfffd, 0x00c0, 0x127b, 0xa284, 0xfffd, 0x00c0, 0x127b,
160 0x2100, 0x7908, 0x780a, 0x2200, 0x7a0c, 0x780e, 0x0078, 0x1282,
161 0x71c4, 0x8107, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0e8,
162 0x5280, 0x2019, 0x0000, 0x72c8, 0xa284, 0x0080, 0x0040, 0x14c6,
163 0x6c14, 0x84ff, 0x00c0, 0x14c6, 0x6817, 0x0040, 0xa284, 0x0040,
164 0x0040, 0x14d0, 0x6c10, 0x84ff, 0x00c0, 0x14d0, 0x6813, 0x0001,
165 0x6800, 0x007e, 0xa226, 0x0040, 0x14f3, 0x6a02, 0xa484, 0x2000,
166 0x0040, 0x14dc, 0xa39d, 0x0010, 0xa484, 0x1000, 0x0040, 0x14e2,
167 0xa39d, 0x0008, 0xa484, 0x4000, 0x0040, 0x14f3, 0x810f, 0xa284,
168 0x4000, 0x0040, 0x14ef, 0x1078, 0x22db, 0x0078, 0x14f3, 0x1078,
169 0x22cd, 0x0078, 0x14f3, 0x72cc, 0x6808, 0xa206, 0x0040, 0x1522,
170 0xa2a4, 0x00ff, 0x2061, 0x5040, 0x6118, 0xa186, 0x0028, 0x0040,
171 0x1509, 0xa186, 0x0032, 0x0040, 0x150f, 0xa186, 0x003c, 0x0040,
172 0x1515, 0xa482, 0x0064, 0x0048, 0x151f, 0x0078, 0x1519, 0xa482,
173 0x0050, 0x0048, 0x151f, 0x0078, 0x1519, 0xa482, 0x0043, 0x0048,
174 0x151f, 0x71c4, 0x71c6, 0x027f, 0x72ca, 0x0078, 0x127d, 0x6a0a,
175 0xa39d, 0x000a, 0x6804, 0xa305, 0x6806, 0x027f, 0x6b0c, 0x71c4,
176 0x0078, 0x1281, 0x77c4, 0x1078, 0x1956, 0x2091, 0x8000, 0x6a14,
177 0x6b1c, 0x2091, 0x8001, 0x70c8, 0x6816, 0x70cc, 0x681e, 0x2708,
178 0x0078, 0x1281, 0x70c4, 0x794c, 0x784e, 0x0078, 0x1283, 0x71c4,
179 0x72c8, 0x73cc, 0xa182, 0x0010, 0x00c8, 0x127c, 0x1078, 0x22e9,
180 0x0078, 0x1281, 0x77c4, 0x1078, 0x1956, 0x2091, 0x8000, 0x6a08,
181 0xa295, 0x0002, 0x6a0a, 0x2091, 0x8001, 0x2708, 0x0078, 0x1282,
182 0x77c4, 0x1078, 0x1956, 0x2091, 0x8000, 0x6a08, 0xa294, 0xfff9,
183 0x6a0a, 0x6804, 0xa005, 0x0040, 0x1567, 0x1078, 0x21b1, 0x2091,
184 0x8001, 0x2708, 0x0078, 0x1282, 0x77c4, 0x1078, 0x1956, 0x2091,
185 0x8000, 0x6a08, 0xa295, 0x0004, 0x6a0a, 0x6804, 0xa005, 0x0040,
186 0x157b, 0x1078, 0x21b1, 0x2091, 0x8001, 0x2708, 0x0078, 0x1282,
187 0x77c4, 0x2041, 0x0001, 0x2049, 0x0005, 0x2051, 0x0020, 0x2091,
188 0x8000, 0x1078, 0x1963, 0x2091, 0x8001, 0x2708, 0x6a08, 0x0078,
189 0x1282, 0x77c4, 0x72c8, 0x73cc, 0x77c6, 0x72ca, 0x73ce, 0x1078,
190 0x19c4, 0x00c0, 0x15a9, 0x6818, 0xa005, 0x0040, 0x15a9, 0x2708,
191 0x1078, 0x22f9, 0x00c0, 0x15a9, 0x7817, 0x0015, 0x2091, 0x8001,
192 0x007c, 0x2091, 0x8001, 0x0078, 0x1284, 0x77c4, 0x77c6, 0x2041,
193 0x0021, 0x2049, 0x0005, 0x2051, 0x0020, 0x2091, 0x8000, 0x1078,
194 0x1963, 0x2061, 0x5040, 0x606f, 0x0003, 0x6782, 0x6093, 0x000f,
195 0x6073, 0x0000, 0x7817, 0x0016, 0x1078, 0x21b1, 0x2091, 0x8001,
196 0x007c, 0x77c8, 0x77ca, 0x77c4, 0x77c6, 0xa7bc, 0xff00, 0x2091,
197 0x8000, 0x2061, 0x5040, 0x606f, 0x0002, 0x6073, 0x0000, 0x6782,
198 0x6093, 0x000f, 0x7817, 0x0017, 0x1078, 0x21b1, 0x2091, 0x8001,
199 0x2041, 0x0021, 0x2049, 0x0004, 0x2051, 0x0010, 0x2091, 0x8000,
200 0x1078, 0x1963, 0x70c8, 0x6836, 0x8738, 0xa784, 0x001f, 0x00c0,
201 0x15e8, 0x2091, 0x8001, 0x007c, 0x78cc, 0xa084, 0x0003, 0x00c0,
202 0x1618, 0x2039, 0x0000, 0x2041, 0x0021, 0x2049, 0x0004, 0x2051,
203 0x0008, 0x1078, 0x1956, 0x2091, 0x8000, 0x6808, 0xa80d, 0x690a,
204 0x2091, 0x8001, 0x8738, 0xa784, 0x001f, 0x00c0, 0x1601, 0xa7bc,
205 0xff00, 0x873f, 0x8738, 0x873f, 0xa784, 0x0f00, 0x00c0, 0x1601,
206 0x2091, 0x8000, 0x2069, 0x0100, 0x6830, 0xa084, 0x0040, 0x0040,
207 0x1641, 0x684b, 0x0004, 0x20a9, 0x0014, 0x6848, 0xa084, 0x0004,
208 0x0040, 0x162e, 0x0070, 0x162e, 0x0078, 0x1625, 0x684b, 0x0009,
209 0x20a9, 0x0014, 0x6848, 0xa084, 0x0001, 0x0040, 0x163b, 0x0070,
210 0x163b, 0x0078, 0x1632, 0x20a9, 0x00fa, 0x0070, 0x1641, 0x0078,
211 0x163d, 0x2079, 0x5000, 0x7817, 0x0018, 0x2061, 0x5040, 0x606f,
212 0x0001, 0x6073, 0x0000, 0x6093, 0x000f, 0x78cc, 0xa085, 0x0002,
213 0x78ce, 0x6808, 0xa084, 0xfffd, 0x680a, 0x681b, 0x0048, 0x2091,
214 0x8001, 0x007c, 0x78cc, 0xa084, 0xfffd, 0x78ce, 0xa084, 0x0001,
215 0x00c0, 0x1664, 0x1078, 0x1a0e, 0x71c4, 0x71c6, 0x794a, 0x007c,
216 0x1078, 0x1b36, 0x00c0, 0x129c, 0x75d8, 0x74dc, 0x75da, 0x74de,
217 0x0078, 0x1675, 0x2029, 0x0000, 0x2520, 0x71c4, 0x73c8, 0x72cc,
218 0x71c6, 0x73ca, 0x72ce, 0x2079, 0x5000, 0x2091, 0x8000, 0x1078,
219 0x1911, 0x2091, 0x8001, 0x0040, 0x172c, 0x20a9, 0x0005, 0x20a1,
220 0x5018, 0x2091, 0x8000, 0x41a1, 0x2091, 0x8001, 0x2009, 0x0020,
221 0x1078, 0x190c, 0x0040, 0x1698, 0x1078, 0x192b, 0x0078, 0x172c,
222 0x6004, 0xa084, 0xff00, 0x8007, 0x8009, 0x0040, 0x16fb, 0x0c7e,
223 0x2c68, 0x2091, 0x8000, 0x1078, 0x1911, 0x2091, 0x8001, 0x0040,
224 0x16cc, 0x2c00, 0x689e, 0x8109, 0x00c0, 0x16a0, 0x609f, 0x0000,
225 0x0c7f, 0x0c7e, 0x7218, 0x731c, 0x7420, 0x7524, 0x2c68, 0x689c,
226 0xa065, 0x0040, 0x16fa, 0x2009, 0x0020, 0x1078, 0x190c, 0x00c0,
227 0x16e3, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0002, 0x00c0, 0x16cc,
228 0x2d00, 0x6002, 0x0078, 0x16b2, 0x0c7f, 0x0c7e, 0x609c, 0x2060,
229 0x1078, 0x1996, 0x0c7f, 0x609f, 0x0000, 0x1078, 0x1730, 0x2009,
230 0x000c, 0x6008, 0xa085, 0x0200, 0x600a, 0x1078, 0x1907, 0x1078,
231 0x192b, 0x0078, 0x172c, 0x0c7f, 0x0c7e, 0x609c, 0x2060, 0x1078,
232 0x1996, 0x0c7f, 0x609f, 0x0000, 0x1078, 0x1730, 0x2009, 0x000c,
233 0x6007, 0x0103, 0x601b, 0x0003, 0x1078, 0x1907, 0x1078, 0x192b,
234 0x0078, 0x172c, 0x0c7f, 0x74c4, 0x73c8, 0x72cc, 0x6014, 0x2091,
235 0x8000, 0x7817, 0x0012, 0x0e7e, 0x2071, 0x5040, 0x706f, 0x0005,
236 0x7073, 0x0000, 0x7376, 0x727a, 0x747e, 0x7082, 0x7087, 0x0000,
237 0x2c00, 0x708a, 0x708f, 0x0000, 0xa02e, 0x2530, 0x611c, 0x61a2,
238 0xa184, 0x0060, 0x0040, 0x171e, 0x1078, 0x467f, 0x0e7f, 0x6596,
239 0x65a6, 0x669a, 0x66aa, 0x60af, 0x0000, 0x60b3, 0x0000, 0x1078,
240 0x21b1, 0x2091, 0x8001, 0x007c, 0x70c3, 0x4005, 0x0078, 0x1287,
241 0x20a9, 0x0005, 0x2099, 0x5018, 0x2091, 0x8000, 0x530a, 0x2091,
242 0x8001, 0x2100, 0xa210, 0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9,
243 0x0000, 0x007c, 0x71c4, 0x70c7, 0x0000, 0x7906, 0x0078, 0x1284,
244 0x71c4, 0x71c6, 0x2168, 0x0078, 0x174f, 0x2069, 0x1000, 0x690c,
245 0xa016, 0x2d04, 0xa210, 0x8d68, 0x8109, 0x00c0, 0x1751, 0xa285,
246 0x0000, 0x00c0, 0x175f, 0x70c3, 0x4000, 0x0078, 0x1761, 0x70c3,
247 0x4003, 0x70ca, 0x0078, 0x1287, 0x2011, 0x5067, 0x220c, 0x70c4,
248 0x8003, 0x0048, 0x1771, 0x1078, 0x3b49, 0xa184, 0x7fff, 0x0078,
249 0x1775, 0x1078, 0x3b3c, 0xa185, 0x8000, 0x2012, 0x0078, 0x1283,
250 0x71c4, 0x1078, 0x3b33, 0x6100, 0x2001, 0x5067, 0x2004, 0xa084,
251 0x8000, 0xa10d, 0x6204, 0x6308, 0x0078, 0x1281, 0x79e4, 0x0078,
252 0x1283, 0x71c4, 0x71c6, 0x2198, 0x20a1, 0x0042, 0x20a9, 0x0004,
253 0x53a3, 0x21a0, 0x2099, 0x0042, 0x20a9, 0x0004, 0x53a3, 0x0078,
254 0x1284, 0x70c4, 0x2068, 0x2079, 0x5000, 0x2091, 0x8000, 0x1078,
255 0x1911, 0x2091, 0x8001, 0x0040, 0x1825, 0x6007, 0x0001, 0x600b,
256 0x0000, 0x602b, 0x0000, 0x601b, 0x0006, 0x6a10, 0xa28c, 0x000f,
257 0xa284, 0x00f0, 0x8003, 0x8003, 0x8003, 0x8003, 0xa105, 0x6016,
258 0xa284, 0x0800, 0x0040, 0x17c0, 0x601b, 0x000a, 0x0078, 0x17c6,
259 0xa284, 0x1000, 0x0040, 0x17c6, 0x601b, 0x000c, 0xa284, 0x0300,
260 0x0040, 0x17cf, 0x602b, 0x0001, 0x8004, 0x8004, 0x8004, 0xa085,
261 0x0001, 0x601e, 0x6023, 0x0000, 0x6027, 0x0000, 0xa284, 0x0400,
262 0x0040, 0x17dc, 0x602b, 0x0000, 0x20a9, 0x0006, 0xac80, 0x000b,
263 0x20a0, 0xad80, 0x0005, 0x2098, 0x53a3, 0xa284, 0x0300, 0x00c0,
264 0x17f1, 0x6046, 0x604a, 0x604e, 0x6052, 0x6096, 0x609a, 0x0078,
265 0x17fb, 0x6800, 0x6046, 0x6804, 0x604a, 0x6e08, 0x664e, 0x6d0c,
266 0x6552, 0x6596, 0x669a, 0x6014, 0x2091, 0x8000, 0x7817, 0x0042,
267 0x2c08, 0x2061, 0x5040, 0x606f, 0x0005, 0x6073, 0x0000, 0x6077,
268 0x0000, 0x607b, 0x0000, 0x607f, 0x0000, 0x6082, 0x618a, 0xa284,
269 0x0400, 0x608e, 0x2091, 0x8001, 0x0e7e, 0x2071, 0x0020, 0x7007,
270 0x000a, 0x7007, 0x0002, 0x7003, 0x0000, 0x0e7f, 0x2091, 0x8000,
271 0x1078, 0x21b1, 0x2091, 0x8001, 0x007c, 0x70c3, 0x4005, 0x0078,
272 0x1287, 0x0c7e, 0x0d7e, 0x0e7e, 0x0f7e, 0x2091, 0x8000, 0x2071,
273 0x5040, 0x2079, 0x0100, 0x2061, 0x0010, 0x70a0, 0xa06d, 0x0040,
274 0x18aa, 0x6a04, 0xa294, 0x00ff, 0xa286, 0x0007, 0x0040, 0x1844,
275 0xa286, 0x000f, 0x00c0, 0x18aa, 0x691c, 0xa184, 0x0080, 0x00c0,
276 0x18aa, 0x6824, 0xa18c, 0xff00, 0xa085, 0x0019, 0x6826, 0x71b0,
277 0x81ff, 0x0040, 0x1865, 0x0d7e, 0x2069, 0x0020, 0x6908, 0x6808,
278 0xa106, 0x00c0, 0x1856, 0x690c, 0x680c, 0xa106, 0x00c0, 0x185b,
279 0xa184, 0x00ff, 0x00c0, 0x185b, 0x0d7f, 0x78b8, 0xa084, 0x801f,
280 0x00c0, 0x1865, 0x7848, 0xa085, 0x000c, 0x784a, 0x71b0, 0x81ff,
281 0x0040, 0x1888, 0x70b3, 0x0000, 0x0d7e, 0x2069, 0x0020, 0x6807,
282 0x0008, 0x6804, 0xa084, 0x0008, 0x00c0, 0x1879, 0x6807, 0x0008,
283 0x6804, 0xa084, 0x0008, 0x00c0, 0x1880, 0x6807, 0x0002, 0x0d7f,
284 0x61c4, 0x62c8, 0x63cc, 0x61c6, 0x62ca, 0x63ce, 0x0e7e, 0x2071,
285 0x5000, 0x7266, 0x736a, 0xae80, 0x0019, 0x0e7f, 0x1078, 0x4598,
286 0x78a3, 0x0000, 0x7858, 0xa084, 0xedff, 0x785a, 0x70b4, 0xa080,
287 0x00da, 0x781a, 0x0f7f, 0x0e7f, 0x0d7f, 0x0c7f, 0x2091, 0x8001,
288 0x0078, 0x1284, 0x0f7f, 0x0e7f, 0x0d7f, 0x0c7f, 0x2091, 0x8001,
289 0x2001, 0x4005, 0x0078, 0x1286, 0x7980, 0x71c6, 0x71c4, 0xa182,
290 0x0003, 0x00c8, 0x127c, 0x7982, 0x0078, 0x1284, 0x7980, 0x71c6,
291 0x0078, 0x1284, 0x7974, 0x71c6, 0x71c4, 0x7976, 0x7978, 0x71ca,
292 0x71c8, 0x797a, 0x797c, 0x71ce, 0x71cc, 0x797e, 0x0078, 0x1284,
293 0x7974, 0x71c6, 0x7978, 0x71ca, 0x797c, 0x71ce, 0x0078, 0x1284,
294 0x7900, 0x71c6, 0x71c4, 0x7902, 0x2001, 0x04fd, 0x2004, 0xa082,
295 0x0005, 0x0048, 0x18e7, 0x0038, 0x18e9, 0x0078, 0x18f3, 0x00a8,
296 0x18f3, 0xa18c, 0x0001, 0x00c0, 0x18f1, 0x20b9, 0x2222, 0x0078,
297 0x18f3, 0x20b9, 0x1212, 0x0078, 0x1284, 0x7900, 0x71c6, 0x0078,
298 0x1284, 0x2009, 0x5074, 0x2104, 0x70c6, 0x70c4, 0x200a, 0x0078,
299 0x1284, 0x2009, 0x5074, 0x2104, 0x70c6, 0x0078, 0x1284, 0xac80,
300 0x0001, 0x1078, 0x1af2, 0x007c, 0xac80, 0x0001, 0x1078, 0x1a92,
301 0x007c, 0x7850, 0xa065, 0x0040, 0x1919, 0x2c04, 0x7852, 0x2063,
302 0x0000, 0x007c, 0x0f7e, 0x2079, 0x5000, 0x7850, 0xa06d, 0x0040,
303 0x1929, 0x2d04, 0x7852, 0x6803, 0x0000, 0x6807, 0x0000, 0x680b,
304 0x0000, 0x0f7f, 0x007c, 0x2091, 0x8000, 0x0f7e, 0x2079, 0x5000,
305 0x7850, 0x2062, 0x2c00, 0xa005, 0x00c0, 0x1938, 0x1078, 0x23ca,
306 0x7852, 0x0f7f, 0x2091, 0x8001, 0x007c, 0x0f7e, 0x2079, 0x5000,
307 0x7850, 0x206a, 0x2d00, 0x7852, 0x0f7f, 0x007c, 0x2011, 0x7700,
308 0x7a52, 0x7bec, 0x8319, 0x0040, 0x1953, 0xa280, 0x0031, 0x2012,
309 0x2010, 0x0078, 0x194a, 0x2013, 0x0000, 0x007c, 0xa784, 0x0f00,
310 0x800b, 0xa784, 0x001f, 0x8003, 0x8003, 0x8003, 0x8003, 0xa105,
311 0xa0e8, 0x5300, 0x007c, 0x1078, 0x1956, 0x2900, 0x682a, 0x2a00,
312 0x682e, 0x6808, 0xa084, 0xffef, 0xa80d, 0x690a, 0x2009, 0x5052,
313 0x210c, 0x6804, 0xa005, 0x0040, 0x1995, 0xa116, 0x00c0, 0x1980,
314 0x2060, 0x6000, 0x6806, 0x017e, 0x200b, 0x0000, 0x0078, 0x1983,
315 0x2009, 0x0000, 0x017e, 0x6804, 0xa065, 0x0040, 0x1992, 0x6000,
316 0x6806, 0x1078, 0x19a3, 0x1078, 0x1c42, 0x6810, 0x8001, 0x6812,
317 0x00c0, 0x1983, 0x017f, 0x6902, 0x6906, 0x007c, 0xa065, 0x0040,
318 0x19a2, 0x609c, 0x609f, 0x0000, 0x2008, 0x1078, 0x192b, 0x2100,
319 0x0078, 0x1996, 0x007c, 0x6007, 0x0103, 0x608f, 0x0000, 0x20a9,
320 0x001c, 0xac80, 0x0005, 0x20a0, 0x2001, 0x0000, 0x40a4, 0x6828,
321 0x601a, 0x682c, 0x6022, 0x007c, 0x0e7e, 0x2071, 0x5040, 0x704c,
322 0xa08c, 0x0200, 0x00c0, 0x19c2, 0xa088, 0x5080, 0x2d0a, 0x8000,
323 0x704e, 0xa006, 0x0e7f, 0x007c, 0x1078, 0x1956, 0x2091, 0x8000,
324 0x6804, 0x781e, 0xa065, 0x0040, 0x1a0d, 0x0078, 0x19d5, 0x2c00,
325 0x781e, 0x6000, 0xa065, 0x0040, 0x1a0d, 0x600c, 0xa306, 0x00c0,
326 0x19cf, 0x6010, 0xa206, 0x00c0, 0x19cf, 0x2c28, 0x2001, 0x5052,
327 0x2004, 0xac06, 0x00c0, 0x19e6, 0x0078, 0x1a0b, 0x6804, 0xac06,
328 0x00c0, 0x19f3, 0x6000, 0xa065, 0x6806, 0x00c0, 0x19fd, 0x6803,
329 0x0000, 0x0078, 0x19fd, 0x6400, 0x781c, 0x2060, 0x6402, 0xa486,
330 0x0000, 0x00c0, 0x19fd, 0x2c00, 0x6802, 0x2560, 0x1078, 0x19a3,
331 0x601b, 0x0005, 0x6023, 0x0020, 0x1078, 0x1c42, 0x6810, 0x8001,
332 0x1050, 0x23ca, 0x6812, 0xa085, 0xffff, 0x007c, 0x2039, 0x0000,
333 0x2041, 0x0021, 0x2049, 0x0004, 0x2051, 0x0008, 0x2091, 0x8000,
334 0x1078, 0x1963, 0x8738, 0xa784, 0x001f, 0x00c0, 0x1a18, 0xa7bc,
335 0xff00, 0x873f, 0x8738, 0x873f, 0xa784, 0x0f00, 0x00c0, 0x1a18,
336 0x2091, 0x8001, 0x007c, 0x2061, 0x0000, 0x6018, 0xa084, 0x0001,
337 0x00c0, 0x1a3c, 0x2091, 0x8000, 0x78e0, 0x78e3, 0x0000, 0x2091,
338 0x8001, 0xa005, 0x00c0, 0x1a3d, 0x007c, 0xa08c, 0xfff0, 0x0040,
339 0x1a43, 0x1078, 0x23ca, 0x0079, 0x1a45, 0x1a55, 0x1a58, 0x1a5e,
340 0x1a62, 0x1a56, 0x1a66, 0x1a6c, 0x1a56, 0x1a56, 0x1c0c, 0x1c30,
341 0x1c34, 0x1a56, 0x1a56, 0x1a56, 0x1a56, 0x007c, 0x1078, 0x23ca,
342 0x1078, 0x1a0e, 0x2001, 0x8001, 0x0078, 0x1c3a, 0x2001, 0x8003,
343 0x0078, 0x1c3a, 0x2001, 0x8004, 0x0078, 0x1c3a, 0x1078, 0x1a0e,
344 0x2001, 0x8006, 0x0078, 0x1c3a, 0x2001, 0x8007, 0x0078, 0x1c3a,
345 0x2030, 0x2138, 0xa782, 0x0021, 0x0048, 0x1a78, 0x2009, 0x0020,
346 0x2600, 0x1078, 0x1a92, 0x00c0, 0x1a91, 0xa7ba, 0x0020, 0x0048,
347 0x1a90, 0x0040, 0x1a90, 0x2708, 0xa6b0, 0x0020, 0xa290, 0x0040,
348 0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9, 0x0000, 0x0078, 0x1a72,
349 0xa006, 0x007c, 0x81ff, 0x0040, 0x1acd, 0x2099, 0x0030, 0x20a0,
350 0x700c, 0xa084, 0x00ff, 0x0040, 0x1aa4, 0x7007, 0x0004, 0x7004,
351 0xa084, 0x0004, 0x00c0, 0x1a9f, 0x21a8, 0x7017, 0x0000, 0x810b,
352 0x7112, 0x721a, 0x731e, 0x7422, 0x7526, 0x780c, 0xa085, 0x0001,
353 0x7002, 0x7007, 0x0001, 0x2001, 0x04fd, 0x2004, 0xa082, 0x0005,
354 0x00c8, 0x1ac1, 0x2009, 0x0022, 0x2104, 0xa084, 0x4000, 0x00c0,
355 0x1ab3, 0x7008, 0x800b, 0x00c8, 0x1ab3, 0x7007, 0x0002, 0xa08c,
356 0x01e0, 0x00c0, 0x1acd, 0x53a5, 0xa006, 0x7003, 0x0000, 0x007c,
357 0x2030, 0x2138, 0xa782, 0x0021, 0x0048, 0x1ad8, 0x2009, 0x0020,
358 0x2600, 0x1078, 0x1af2, 0x00c0, 0x1af1, 0xa7ba, 0x0020, 0x0048,
359 0x1af0, 0x0040, 0x1af0, 0x2708, 0xa6b0, 0x0020, 0xa290, 0x0040,
360 0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9, 0x0000, 0x0078, 0x1ad2,
361 0xa006, 0x007c, 0x81ff, 0x0040, 0x1b33, 0x2098, 0x20a1, 0x0030,
362 0x700c, 0xa084, 0x00ff, 0x0040, 0x1b04, 0x7007, 0x0004, 0x7004,
363 0xa084, 0x0004, 0x00c0, 0x1aff, 0x21a8, 0x7017, 0x0000, 0x810b,
364 0x7112, 0x721a, 0x731e, 0x7422, 0x7526, 0x780c, 0xa085, 0x0000,
365 0x7002, 0x53a6, 0x7007, 0x0001, 0x2001, 0x04fd, 0x2004, 0xa082,
366 0x0005, 0x00c8, 0x1b22, 0x2009, 0x0022, 0x2104, 0xa084, 0x4000,
367 0x00c0, 0x1b14, 0x7010, 0xa084, 0xf000, 0x0040, 0x1b2b, 0x7007,
368 0x0008, 0x0078, 0x1b2f, 0x7108, 0x8103, 0x00c8, 0x1b14, 0x7007,
369 0x0002, 0xa184, 0x01e0, 0x7003, 0x0000, 0x007c, 0x2001, 0x04fd,
370 0x2004, 0xa082, 0x0004, 0x00c8, 0x1b3f, 0x0078, 0x1b42, 0xa006,
371 0x0078, 0x1b44, 0xa085, 0x0001, 0x007c, 0x0e7e, 0x2071, 0x5000,
372 0x2d08, 0x7058, 0x6802, 0xa005, 0x00c0, 0x1b4f, 0x715e, 0x715a,
373 0x0e7f, 0x007c, 0x2c08, 0x7858, 0x6002, 0xa005, 0x00c0, 0x1b59,
374 0x795e, 0x795a, 0x007c, 0x2091, 0x8000, 0x6003, 0x0000, 0x2c08,
375 0x785c, 0xa065, 0x00c0, 0x1b67, 0x795a, 0x0078, 0x1b68, 0x6102,
376 0x795e, 0x2091, 0x8001, 0x1078, 0x21ce, 0x007c, 0x0e7e, 0x2071,
377 0x5000, 0x7058, 0xa06d, 0x0040, 0x1b7c, 0x6800, 0x705a, 0xa005,
378 0x00c0, 0x1b7b, 0x705e, 0x8dff, 0x0e7f, 0x007c, 0x0d7e, 0x0c7e,
379 0x0f7e, 0x2079, 0x5000, 0xaf80, 0x0016, 0x2060, 0x6000, 0xa005,
380 0x0040, 0x1bac, 0x2068, 0x6814, 0xa306, 0x00c0, 0x1b95, 0x6828,
381 0xa084, 0x00ff, 0xa406, 0x0040, 0x1b98, 0x2d60, 0x0078, 0x1b86,
382 0x6800, 0xa005, 0x6002, 0x00c0, 0x1ba4, 0xaf80, 0x0016, 0xac06,
383 0x0040, 0x1ba3, 0x2c00, 0x785e, 0x0d7e, 0x689c, 0xa005, 0x0040,
384 0x1bab, 0x1078, 0x1996, 0x007f, 0x0f7f, 0x0c7f, 0x0d7f, 0xa005,
385 0x007c, 0x0d7e, 0x0c7e, 0x0f7e, 0x2079, 0x5000, 0xaf80, 0x0016,
386 0x2060, 0x6000, 0xa005, 0x0040, 0x1bdb, 0x2068, 0x6814, 0xa084,
387 0x00ff, 0xa306, 0x0040, 0x1bc7, 0x2d60, 0x0078, 0x1bb9, 0x6800,
388 0xa005, 0x6002, 0x00c0, 0x1bd3, 0xaf80, 0x0016, 0xac06, 0x0040,
389 0x1bd2, 0x2c00, 0x785e, 0x0d7e, 0x689c, 0xa005, 0x0040, 0x1bda,
390 0x1078, 0x1996, 0x007f, 0x0f7f, 0x0c7f, 0x0d7f, 0xa005, 0x007c,
391 0x0d7e, 0x0c7e, 0x0f7e, 0x2079, 0x5000, 0xaf80, 0x0016, 0x2060,
392 0x6000, 0xa06d, 0x0040, 0x1c07, 0x6814, 0xa306, 0x0040, 0x1bf3,
393 0x2d60, 0x0078, 0x1be8, 0x6800, 0xa005, 0x6002, 0x00c0, 0x1bff,
394 0xaf80, 0x0016, 0xac06, 0x0040, 0x1bfe, 0x2c00, 0x785e, 0x0d7e,
395 0x689c, 0xa005, 0x0040, 0x1c06, 0x1078, 0x1996, 0x007f, 0x0f7f,
396 0x0c7f, 0x0d7f, 0xa005, 0x007c, 0x2091, 0x8000, 0x2069, 0x5040,
397 0x6800, 0xa086, 0x0000, 0x0040, 0x1c1a, 0x2091, 0x8001, 0x78e3,
398 0x0009, 0x007c, 0x6880, 0xa0bc, 0xff00, 0x2041, 0x0021, 0x2049,
399 0x0004, 0x2051, 0x0010, 0x1078, 0x1963, 0x8738, 0xa784, 0x001f,
400 0x00c0, 0x1c23, 0x2091, 0x8001, 0x2001, 0x800a, 0x0078, 0x1c3a,
401 0x2001, 0x800c, 0x0078, 0x1c3a, 0x1078, 0x1a0e, 0x2001, 0x800d,
402 0x0078, 0x1c3a, 0x70c2, 0x2061, 0x0000, 0x601b, 0x0001, 0x2091,
403 0x4080, 0x007c, 0x6004, 0x2c08, 0x2063, 0x0000, 0x7884, 0x8000,
404 0x7886, 0x7888, 0xa005, 0x798a, 0x0040, 0x1c51, 0x2c02, 0x0078,
405 0x1c52, 0x798e, 0x007c, 0x6807, 0x0103, 0x0c7e, 0x2061, 0x5000,
406 0x2d08, 0x206b, 0x0000, 0x6084, 0x8000, 0x6086, 0x6088, 0xa005,
407 0x618a, 0x0040, 0x1c66, 0x2d02, 0x0078, 0x1c67, 0x618e, 0x0c7f,
408 0x007c, 0x1078, 0x1c7a, 0x0040, 0x1c79, 0x0c7e, 0x609c, 0xa065,
409 0x0040, 0x1c74, 0x1078, 0x1996, 0x0c7f, 0x609f, 0x0000, 0x1078,
410 0x192b, 0x007c, 0x788c, 0xa065, 0x0040, 0x1c8c, 0x2091, 0x8000,
411 0x7884, 0x8001, 0x7886, 0x2c04, 0x788e, 0xa005, 0x00c0, 0x1c8a,
412 0x788a, 0x8000, 0x2091, 0x8001, 0x007c, 0x20a9, 0x0010, 0xa006,
413 0x8004, 0x8086, 0x818e, 0x00c8, 0x1c96, 0xa200, 0x0070, 0x1c9a,
414 0x0078, 0x1c91, 0x8086, 0x818e, 0x007c, 0x157e, 0x20a9, 0x0010,
415 0xa005, 0x0040, 0x1cc0, 0xa11a, 0x00c8, 0x1cc0, 0x8213, 0x818d,
416 0x0048, 0x1cb1, 0xa11a, 0x00c8, 0x1cb2, 0x0070, 0x1cb8, 0x0078,
417 0x1ca6, 0xa11a, 0x2308, 0x8210, 0x0070, 0x1cb8, 0x0078, 0x1ca6,
418 0x007e, 0x3200, 0xa084, 0xf7ff, 0x2080, 0x007f, 0x157f, 0x007c,
419 0x007e, 0x3200, 0xa085, 0x0800, 0x0078, 0x1cbc, 0x7994, 0x70d0,
420 0xa106, 0x0040, 0x1d34, 0x2091, 0x8000, 0x2071, 0x0020, 0x7004,
421 0xa005, 0x00c0, 0x1d34, 0x7008, 0x7208, 0xa206, 0x00c0, 0x1d34,
422 0xa286, 0x0008, 0x00c0, 0x1d34, 0x2071, 0x0010, 0x1078, 0x1911,
423 0x0040, 0x1d34, 0x7a9c, 0x7b98, 0x7ca4, 0x7da0, 0xa184, 0xff00,
424 0x0040, 0x1d02, 0x2031, 0x0000, 0x810b, 0x86b5, 0x810b, 0x86b5,
425 0x810b, 0x86b5, 0x810b, 0x86b5, 0x810b, 0x86b5, 0x810b, 0x86b5,
426 0x2100, 0xa210, 0x2600, 0xa319, 0xa4a1, 0x0000, 0xa5a9, 0x0000,
427 0x0078, 0x1d0c, 0x8107, 0x8004, 0x8004, 0xa210, 0xa399, 0x0000,
428 0xa4a1, 0x0000, 0xa5a9, 0x0000, 0x2009, 0x0020, 0x1078, 0x190c,
429 0x2091, 0x8001, 0x0040, 0x1d2b, 0x1078, 0x192b, 0x78a8, 0x8000,
430 0x78aa, 0xa086, 0x0002, 0x00c0, 0x1d34, 0x2091, 0x8000, 0x78e3,
431 0x0002, 0x78ab, 0x0000, 0x78cc, 0xa085, 0x0003, 0x78ce, 0x2091,
432 0x8001, 0x0078, 0x1d34, 0x78ab, 0x0000, 0x1078, 0x208b, 0x6004,
433 0xa084, 0x000f, 0x0079, 0x1d39, 0x2071, 0x0010, 0x2091, 0x8001,
434 0x007c, 0x1d49, 0x1d6b, 0x1d91, 0x1d49, 0x1dae, 0x1d58, 0x1f0d,
435 0x1f28, 0x1d49, 0x1d65, 0x1d8b, 0x1df6, 0x1e63, 0x1eb3, 0x1ec5,
436 0x1f24, 0x2039, 0x0400, 0x78dc, 0xa705, 0x78de, 0x6008, 0xa705,
437 0x600a, 0x1078, 0x1fa6, 0x609c, 0x78da, 0x1078, 0x2073, 0x007c,
438 0x78dc, 0xa084, 0x0100, 0x0040, 0x1d5f, 0x0078, 0x1d49, 0x601c,
439 0xa085, 0x0080, 0x601e, 0x0078, 0x1d72, 0x1078, 0x1b36, 0x00c0,
440 0x1d49, 0x1078, 0x20a5, 0x78dc, 0xa084, 0x0100, 0x0040, 0x1d72,
441 0x0078, 0x1d49, 0x78df, 0x0000, 0x6004, 0x8007, 0xa084, 0x00ff,
442 0x78d2, 0x8001, 0x609f, 0x0000, 0x0040, 0x1d88, 0x1078, 0x1fa6,
443 0x0040, 0x1d88, 0x78dc, 0xa085, 0x0100, 0x78de, 0x0078, 0x1d8a,
444 0x1078, 0x1fca, 0x007c, 0x1078, 0x1b36, 0x00c0, 0x1d49, 0x1078,
445 0x20a1, 0x78dc, 0xa08c, 0x0e00, 0x00c0, 0x1d9a, 0xa084, 0x0100,
446 0x00c0, 0x1d9c, 0x0078, 0x1d49, 0x1078, 0x1fa6, 0x00c0, 0x1dad,
447 0x6104, 0xa18c, 0x00ff, 0xa186, 0x0007, 0x0040, 0x1f63, 0xa186,
448 0x000f, 0x0040, 0x1f63, 0x1078, 0x1fca, 0x007c, 0x78dc, 0xa084,
449 0x0100, 0x0040, 0x1db5, 0x0078, 0x1d49, 0x78df, 0x0000, 0x6714,
450 0x2011, 0x0001, 0x20a9, 0x0001, 0x6018, 0xa084, 0x00ff, 0xa005,
451 0x0040, 0x1dd8, 0x2011, 0x0001, 0xa7bc, 0xff00, 0x20a9, 0x0020,
452 0xa08e, 0x0001, 0x0040, 0x1dd8, 0x2039, 0x0000, 0x2011, 0x0002,
453 0x20a9, 0x0100, 0xa08e, 0x0002, 0x0040, 0x1dd8, 0x0078, 0x1df3,
454 0x1078, 0x1956, 0x2091, 0x8000, 0x682b, 0x0000, 0x682f, 0x0000,
455 0x6808, 0xa084, 0xffde, 0x680a, 0xade8, 0x0010, 0x2091, 0x8001,
456 0x0070, 0x1dec, 0x0078, 0x1dda, 0x8211, 0x0040, 0x1df3, 0x20a9,
457 0x0100, 0x0078, 0x1dda, 0x1078, 0x192b, 0x007c, 0x2001, 0x5067,
458 0x2004, 0xa084, 0x8000, 0x0040, 0x1f8b, 0x6114, 0x1078, 0x20c2,
459 0x6900, 0xa184, 0x0001, 0x0040, 0x1e17, 0x6028, 0xa084, 0x00ff,
460 0x00c0, 0x1f83, 0x6800, 0xa084, 0x0001, 0x0040, 0x1f8b, 0x6803,
461 0x0000, 0x680b, 0x0000, 0x6807, 0x0000, 0x0078, 0x1f93, 0x2011,
462 0x0001, 0x6020, 0xa084, 0x4000, 0x0040, 0x1e20, 0xa295, 0x0002,
463 0x6020, 0xa084, 0x0100, 0x0040, 0x1e27, 0xa295, 0x0008, 0x601c,
464 0xa084, 0x0002, 0x0040, 0x1e2e, 0xa295, 0x0004, 0x602c, 0xa08c,
465 0x00ff, 0xa182, 0x0002, 0x0048, 0x1f8f, 0xa182, 0x001b, 0x00c8,
466 0x1f8f, 0x0040, 0x1f8f, 0x690e, 0x602c, 0x8007, 0xa08c, 0x00ff,
467 0xa182, 0x0002, 0x0048, 0x1f8f, 0xa182, 0x001b, 0x00c8, 0x1f8f,
468 0x0040, 0x1f8f, 0x6912, 0x6030, 0xa005, 0x00c0, 0x1e51, 0x2001,
469 0x001e, 0x8000, 0x6816, 0x6028, 0xa084, 0x00ff, 0x0040, 0x1f8b,
470 0x6806, 0x6028, 0x8007, 0xa084, 0x00ff, 0x0040, 0x1f8b, 0x680a,
471 0x6a02, 0x0078, 0x1f93, 0x2001, 0x5067, 0x2004, 0xa084, 0x8000,
472 0x0040, 0x1f8b, 0x6114, 0x1078, 0x20c2, 0x2091, 0x8000, 0x6a04,
473 0x6b08, 0x6418, 0xa484, 0x0003, 0x0040, 0x1e89, 0x6128, 0xa18c,
474 0x00ff, 0x8001, 0x00c0, 0x1e82, 0x2100, 0xa210, 0x0048, 0x1eaf,
475 0x0078, 0x1e89, 0x8001, 0x00c0, 0x1eaf, 0x2100, 0xa212, 0x0048,
476 0x1eaf, 0xa484, 0x000c, 0x0040, 0x1ea3, 0x6128, 0x810f, 0xa18c,
477 0x00ff, 0xa082, 0x0004, 0x00c0, 0x1e9b, 0x2100, 0xa318, 0x0048,
478 0x1eaf, 0x0078, 0x1ea3, 0xa082, 0x0004, 0x00c0, 0x1eaf, 0x2100,
479 0xa31a, 0x0048, 0x1eaf, 0x6030, 0xa005, 0x0040, 0x1ea9, 0x8000,
480 0x6816, 0x6a06, 0x6b0a, 0x2091, 0x8001, 0x0078, 0x1f93, 0x2091,
481 0x8001, 0x0078, 0x1f8f, 0x6114, 0x1078, 0x20c2, 0x2091, 0x8000,
482 0x6b08, 0x8318, 0x0048, 0x1ec1, 0x6b0a, 0x2091, 0x8001, 0x0078,
483 0x1fa2, 0x2091, 0x8001, 0x0078, 0x1f8f, 0x6024, 0x8007, 0xa084,
484 0x00ff, 0x0040, 0x1ee3, 0xa086, 0x0080, 0x00c0, 0x1f0b, 0x20a9,
485 0x0008, 0x2069, 0x7410, 0x2091, 0x8000, 0x6800, 0xa084, 0xfcff,
486 0x6802, 0xade8, 0x0008, 0x0070, 0x1edf, 0x0078, 0x1ed5, 0x2091,
487 0x8001, 0x0078, 0x1f93, 0x6028, 0xa015, 0x0040, 0x1f0b, 0x6114,
488 0x1078, 0x20c2, 0x0d7e, 0xade8, 0x0007, 0x2091, 0x8000, 0x6800,
489 0xa00d, 0x0040, 0x1f08, 0xa206, 0x0040, 0x1ef9, 0x2168, 0x0078,
490 0x1eef, 0x0c7e, 0x2160, 0x6000, 0x6802, 0x1078, 0x192b, 0x0c7f,
491 0x0d7f, 0x6808, 0x8000, 0x680a, 0x2091, 0x8001, 0x0078, 0x1fa2,
492 0x2091, 0x8001, 0x0d7f, 0x0078, 0x1f8b, 0x6114, 0x1078, 0x20c2,
493 0x6800, 0xa084, 0x0001, 0x0040, 0x1f7b, 0x2091, 0x8000, 0x6a04,
494 0x8210, 0x0048, 0x1f20, 0x6a06, 0x2091, 0x8001, 0x0078, 0x1fa2,
495 0x2091, 0x8001, 0x0078, 0x1f8f, 0x1078, 0x1b36, 0x00c0, 0x1d49,
496 0x6114, 0x1078, 0x20c2, 0x60be, 0x6900, 0xa184, 0x0008, 0x0040,
497 0x1f35, 0x6020, 0xa085, 0x0100, 0x6022, 0xa184, 0x0001, 0x0040,
498 0x1f8b, 0xa184, 0x0100, 0x00c0, 0x1f77, 0xa184, 0x0200, 0x00c0,
499 0x1f73, 0x681c, 0xa005, 0x00c0, 0x1f7f, 0x6004, 0xa084, 0x00ff,
500 0xa086, 0x000f, 0x00c0, 0x1f4e, 0x1078, 0x20a5, 0x78df, 0x0000,
501 0x6004, 0x8007, 0xa084, 0x00ff, 0x78d2, 0x8001, 0x609f, 0x0000,
502 0x0040, 0x1f63, 0x1078, 0x1fa6, 0x0040, 0x1f63, 0x78dc, 0xa085,
503 0x0100, 0x78de, 0x007c, 0x78d7, 0x0000, 0x78db, 0x0000, 0x6024,
504 0xa084, 0xff00, 0x6026, 0x1078, 0x39aa, 0x0040, 0x1cc6, 0x1078,
505 0x1b5b, 0x0078, 0x1cc6, 0x2009, 0x0017, 0x0078, 0x1f95, 0x2009,
506 0x000e, 0x0078, 0x1f95, 0x2009, 0x0007, 0x0078, 0x1f95, 0x2009,
507 0x0035, 0x0078, 0x1f95, 0x2009, 0x003e, 0x0078, 0x1f95, 0x2009,
508 0x0004, 0x0078, 0x1f95, 0x2009, 0x0006, 0x0078, 0x1f95, 0x2009,
509 0x0016, 0x0078, 0x1f95, 0x2009, 0x0001, 0x6024, 0xa084, 0xff00,
510 0xa105, 0x6026, 0x2091, 0x8000, 0x1078, 0x1c42, 0x2091, 0x8001,
511 0x0078, 0x1cc6, 0x1078, 0x192b, 0x0078, 0x1cc6, 0x78d4, 0xa06d,
512 0x00c0, 0x1fb1, 0x2c00, 0x78d6, 0x78da, 0x609f, 0x0000, 0x0078,
513 0x1fbd, 0x2c00, 0x689e, 0x609f, 0x0000, 0x78d6, 0x2d00, 0x6002,
514 0x78d8, 0xad06, 0x00c0, 0x1fbd, 0x6002, 0x78d0, 0x8001, 0x78d2,
515 0x00c0, 0x1fc9, 0x78dc, 0xa084, 0xfeff, 0x78de, 0x78d8, 0x2060,
516 0xa006, 0x007c, 0xa02e, 0x2530, 0x611c, 0x61a2, 0xa184, 0xe1ff,
517 0x601e, 0xa184, 0x0060, 0x0040, 0x1fd9, 0x0e7e, 0x1078, 0x467f,
518 0x0e7f, 0x6596, 0x65a6, 0x669a, 0x66aa, 0x60af, 0x0000, 0x60b3,
519 0x0000, 0x6714, 0x1078, 0x1956, 0x2091, 0x8000, 0x60a0, 0xa084,
520 0x8000, 0x00c0, 0x2000, 0x6808, 0xa084, 0x0001, 0x0040, 0x2000,
521 0x2091, 0x8001, 0x1078, 0x19a3, 0x2091, 0x8000, 0x1078, 0x1c42,
522 0x2091, 0x8001, 0x78d7, 0x0000, 0x78db, 0x0000, 0x0078, 0x2072,
523 0x6024, 0xa096, 0x0001, 0x00c0, 0x2007, 0x8000, 0x6026, 0x6a10,
524 0x6814, 0x2091, 0x8001, 0xa202, 0x0048, 0x2016, 0x0040, 0x2016,
525 0x2039, 0x0200, 0x1078, 0x2073, 0x0078, 0x2072, 0x2c08, 0x2091,
526 0x8000, 0x60a0, 0xa084, 0x8000, 0x0040, 0x2043, 0x6800, 0xa065,
527 0x0040, 0x2048, 0x6a04, 0x0e7e, 0x2071, 0x5040, 0x7000, 0xa084,
528 0x0001, 0x0040, 0x203d, 0x7048, 0xa206, 0x00c0, 0x203d, 0x6b04,
529 0x231c, 0x2160, 0x6302, 0x2300, 0xa005, 0x00c0, 0x2038, 0x6902,
530 0x2260, 0x6102, 0x0e7f, 0x0078, 0x204f, 0x2160, 0x6202, 0x6906,
531 0x0e7f, 0x0078, 0x204f, 0x6800, 0xa065, 0x0040, 0x2048, 0x6102,
532 0x6902, 0x00c0, 0x204c, 0x6906, 0x2160, 0x6003, 0x0000, 0x2160,
533 0x60a0, 0xa084, 0x8000, 0x0040, 0x2059, 0x6808, 0xa084, 0xfffc,
534 0x680a, 0x6810, 0x8000, 0x6812, 0x2091, 0x8001, 0x6808, 0xa08c,
535 0x0040, 0x0040, 0x2068, 0xa086, 0x0040, 0x680a, 0x1078, 0x19b4,
536 0x2091, 0x8000, 0x1078, 0x21b1, 0x2091, 0x8001, 0x78db, 0x0000,
537 0x78d7, 0x0000, 0x007c, 0x6008, 0xa705, 0x600a, 0x2091, 0x8000,
538 0x1078, 0x1c42, 0x2091, 0x8001, 0x78d8, 0xa065, 0x0040, 0x2086,
539 0x609c, 0x78da, 0x609f, 0x0000, 0x0078, 0x2076, 0x78d7, 0x0000,
540 0x78db, 0x0000, 0x007c, 0x7990, 0x7894, 0x8000, 0xa10a, 0x00c8,
541 0x2092, 0xa006, 0x7896, 0x70d2, 0x7804, 0xa005, 0x0040, 0x20a0,
542 0x8001, 0x7806, 0x00c0, 0x20a0, 0x0068, 0x20a0, 0x2091, 0x4080,
543 0x007c, 0x2039, 0x20b9, 0x0078, 0x20a7, 0x2039, 0x20bf, 0x2704,
544 0xa005, 0x0040, 0x20b8, 0xac00, 0x2068, 0x6b08, 0x6c0c, 0x6910,
545 0x6a14, 0x690a, 0x6a0e, 0x6b12, 0x6c16, 0x8738, 0x0078, 0x20a7,
546 0x007c, 0x0003, 0x0009, 0x000f, 0x0015, 0x001b, 0x0000, 0x0015,
547 0x001b, 0x0000, 0x0c7e, 0x1078, 0x3b33, 0x2c68, 0x0c7f, 0x007c,
548 0x0010, 0x2139, 0x0068, 0x2139, 0x2029, 0x0000, 0x78cb, 0x0000,
549 0x788c, 0xa065, 0x0040, 0x2132, 0x2009, 0x5074, 0x2104, 0xa084,
550 0x0001, 0x0040, 0x2100, 0x6004, 0xa086, 0x0103, 0x00c0, 0x2100,
551 0x6018, 0xa005, 0x00c0, 0x2100, 0x6014, 0xa005, 0x00c0, 0x2100,
552 0x0d7e, 0x2069, 0x0000, 0x6818, 0xa084, 0x0001, 0x00c0, 0x20ff,
553 0x600c, 0x70c6, 0x6010, 0x70ca, 0x70c3, 0x8020, 0x681b, 0x0001,
554 0x2091, 0x4080, 0x0d7f, 0x1078, 0x1c69, 0x0078, 0x2137, 0x0d7f,
555 0x1078, 0x213a, 0x0040, 0x2132, 0x6204, 0xa294, 0x00ff, 0xa296,
556 0x0003, 0x0040, 0x2112, 0x6204, 0xa296, 0x0110, 0x00c0, 0x2120,
557 0x78cb, 0x0001, 0x6204, 0xa294, 0xff00, 0x8217, 0x8211, 0x0040,
558 0x2120, 0x85ff, 0x00c0, 0x2132, 0x8210, 0xa202, 0x00c8, 0x2132,
559 0x057e, 0x1078, 0x2149, 0x057f, 0x0040, 0x212d, 0x78e0, 0xa086,
560 0x0003, 0x0040, 0x2132, 0x0078, 0x2120, 0x8528, 0x78c8, 0xa005,
561 0x0040, 0x20d0, 0x85ff, 0x0040, 0x2139, 0x2091, 0x4080, 0x78b0,
562 0x70d6, 0x007c, 0x7bac, 0x79b0, 0x70d4, 0xa102, 0x00c0, 0x2143,
563 0x2300, 0xa005, 0x007c, 0x0048, 0x2147, 0xa302, 0x007c, 0x8002,
564 0x007c, 0x2001, 0x04fd, 0x2004, 0xa082, 0x0005, 0x00c8, 0x2163,
565 0x2091, 0x8000, 0x2071, 0x0020, 0x7004, 0xa005, 0x00c0, 0x2198,
566 0x7008, 0x7208, 0xa206, 0x00c0, 0x2198, 0xa286, 0x0008, 0x00c0,
567 0x2198, 0x2071, 0x0010, 0x1078, 0x219d, 0x2009, 0x0020, 0x6004,
568 0xa086, 0x0103, 0x00c0, 0x2172, 0x6028, 0xa005, 0x00c0, 0x2172,
569 0x2009, 0x000c, 0x1078, 0x1907, 0x0040, 0x218b, 0x78c4, 0x8000,
570 0x78c6, 0xa086, 0x0002, 0x00c0, 0x2198, 0x2091, 0x8000, 0x78e3,
571 0x0003, 0x78c7, 0x0000, 0x78cc, 0xa085, 0x0300, 0x78ce, 0x2091,
572 0x8001, 0x0078, 0x2198, 0x78c7, 0x0000, 0x1078, 0x1c69, 0x79ac,
573 0x78b0, 0x8000, 0xa10a, 0x00c8, 0x2196, 0xa006, 0x78b2, 0xa006,
574 0x2071, 0x0010, 0x2091, 0x8001, 0x007c, 0x8107, 0x8004, 0x8004,
575 0x7ab8, 0x7bb4, 0x7cc0, 0x7dbc, 0xa210, 0xa399, 0x0000, 0xa4a1,
576 0x0000, 0xa5a9, 0x0000, 0x007c, 0x2009, 0x505b, 0x2091, 0x8000,
577 0x200a, 0x0f7e, 0x0e7e, 0x2071, 0x5040, 0x7000, 0xa086, 0x0000,
578 0x00c0, 0x21cb, 0x2009, 0x5012, 0x2104, 0xa005, 0x00c0, 0x21cb,
579 0x2079, 0x0100, 0x7830, 0xa084, 0x00c0, 0x00c0, 0x21cb, 0x0018,
580 0x21cb, 0x781b, 0x004b, 0x0e7f, 0x0f7f, 0x007c, 0x0f7e, 0x0e7e,
581 0x2071, 0x5040, 0x2091, 0x8000, 0x7000, 0xa086, 0x0000, 0x00c0,
582 0x21e4, 0x2079, 0x0100, 0x7830, 0xa084, 0x00c0, 0x00c0, 0x21e4,
583 0x0018, 0x21e4, 0x781b, 0x004d, 0x2091, 0x8001, 0x0e7f, 0x0f7f,
584 0x007c, 0x127e, 0x2091, 0x2300, 0x2071, 0x5040, 0x2079, 0x0100,
585 0x784b, 0x000f, 0x0098, 0x21f7, 0x7838, 0x0078, 0x21f0, 0x20a9,
586 0x0040, 0x7800, 0xa082, 0x0004, 0x0048, 0x2200, 0x20a9, 0x0060,
587 0x789b, 0x0000, 0x78af, 0x0000, 0x78af, 0x0000, 0x0070, 0x220a,
588 0x0078, 0x2202, 0x7800, 0xa082, 0x0004, 0x0048, 0x2219, 0x70b7,
589 0x009b, 0x2019, 0x4da4, 0x1078, 0x2255, 0x702f, 0x8001, 0x0078,
590 0x2225, 0x70b7, 0x0000, 0x2019, 0x4c1c, 0x1078, 0x2255, 0x2019,
591 0x4c5b, 0x1078, 0x2255, 0x702f, 0x8000, 0x7003, 0x0000, 0x1078,
592 0x235e, 0x7004, 0xa084, 0x000f, 0x017e, 0x2009, 0x04fd, 0x210c,
593 0xa18a, 0x0005, 0x0048, 0x223a, 0x0038, 0x2240, 0xa085, 0x6280,
594 0x0078, 0x2242, 0x0028, 0x2240, 0xa085, 0x6280, 0x0078, 0x2242,
595 0xa085, 0x62c0, 0x017f, 0x7806, 0x780f, 0xb204, 0x7843, 0x00d8,
596 0x7853, 0x0080, 0x780b, 0x0008, 0x7047, 0x0008, 0x7053, 0x507f,
597 0x704f, 0x0000, 0x127f, 0x2000, 0x007c, 0x137e, 0x147e, 0x157e,
598 0x047e, 0x20a1, 0x012b, 0x2304, 0xa005, 0x789a, 0x0040, 0x2275,
599 0x8318, 0x2324, 0x8318, 0x2398, 0x24a8, 0xa484, 0xff00, 0x0040,
600 0x226d, 0xa482, 0x0100, 0x20a9, 0x0100, 0x2020, 0x53a6, 0xa005,
601 0x00c0, 0x2264, 0x3318, 0x0078, 0x225b, 0x047f, 0x157f, 0x147f,
602 0x137f, 0x007c, 0xa18c, 0x000f, 0x2011, 0x0101, 0x2204, 0xa084,
603 0xfff0, 0xa105, 0x2012, 0x1078, 0x235e, 0x007c, 0x2011, 0x0101,
604 0x20a9, 0x0009, 0x810b, 0x0070, 0x228f, 0x0078, 0x228a, 0xa18c,
605 0x0e00, 0x2204, 0xa084, 0xf1ff, 0xa105, 0x2012, 0x007c, 0x2009,
606 0x0101, 0x20a9, 0x0005, 0x8213, 0x0070, 0x22a0, 0x0078, 0x229b,
607 0xa294, 0x00e0, 0x2104, 0xa084, 0xff1f, 0xa205, 0x200a, 0x007c,
608 0x2011, 0x0101, 0x20a9, 0x000c, 0x810b, 0x0070, 0x22b1, 0x0078,
609 0x22ac, 0xa18c, 0xf000, 0x2204, 0xa084, 0x0fff, 0xa105, 0x2012,
610 0x007c, 0x2011, 0x0102, 0x2204, 0xa084, 0xffcf, 0xa105, 0x2012,
611 0x007c, 0x8103, 0x8003, 0xa080, 0x0020, 0x0c7e, 0x2061, 0x0100,
612 0x609a, 0x62ac, 0x63ac, 0x0c7f, 0x007c, 0x8103, 0x8003, 0xa080,
613 0x0022, 0x0c7e, 0x2061, 0x0100, 0x609a, 0x60a4, 0xa084, 0xffdf,
614 0x60ae, 0x0c7f, 0x007c, 0x8103, 0x8003, 0xa080, 0x0022, 0x0c7e,
615 0x2061, 0x0100, 0x609a, 0x60a4, 0xa085, 0x0020, 0x60ae, 0x0c7f,
616 0x007c, 0x8103, 0x8003, 0xa080, 0x0020, 0x0c7e, 0x2061, 0x0100,
617 0x609a, 0x60a4, 0x62ae, 0x2010, 0x60a4, 0x63ae, 0x2018, 0x0c7f,
618 0x007c, 0x2091, 0x8000, 0x0c7e, 0x0e7e, 0x6818, 0xa005, 0x0040,
619 0x233c, 0x2061, 0x7400, 0x1078, 0x2344, 0x0040, 0x2328, 0x20a9,
620 0x0000, 0x2061, 0x7300, 0x0c7e, 0x1078, 0x2344, 0x0040, 0x2318,
621 0x0c7f, 0x8c60, 0x0070, 0x2316, 0x0078, 0x230b, 0x0078, 0x233c,
622 0x007f, 0xa082, 0x7300, 0x2071, 0x5040, 0x7086, 0x7182, 0x2001,
623 0x0004, 0x706e, 0x7093, 0x000f, 0x1078, 0x21ac, 0x0078, 0x2338,
624 0x60c0, 0xa005, 0x00c0, 0x233c, 0x2071, 0x5040, 0x7182, 0x2c00,
625 0x708a, 0x2001, 0x0006, 0x706e, 0x7093, 0x000f, 0x1078, 0x21ac,
626 0x2001, 0x0000, 0x0078, 0x233e, 0x2001, 0x0001, 0x2091, 0x8001,
627 0xa005, 0x0e7f, 0x0c7f, 0x007c, 0x2c04, 0xa005, 0x0040, 0x235b,
628 0x2060, 0x600c, 0xa306, 0x00c0, 0x2358, 0x6010, 0xa206, 0x00c0,
629 0x2358, 0x6014, 0xa106, 0x00c0, 0x2358, 0xa006, 0x0078, 0x235d,
630 0x6000, 0x0078, 0x2345, 0xa085, 0x0001, 0x007c, 0x2011, 0x5041,
631 0x220c, 0xa18c, 0x000f, 0x2011, 0x013b, 0x2204, 0xa084, 0x0100,
632 0x0040, 0x2374, 0x2021, 0xff04, 0x2122, 0x810b, 0x810b, 0x810b,
633 0x810b, 0xa18d, 0x0f00, 0x2104, 0x007c, 0x0e7e, 0x68e4, 0xa08c,
634 0x0020, 0x0040, 0x23c8, 0xa084, 0x0006, 0x00c0, 0x23c8, 0x6014,
635 0x8007, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0f0, 0x5280,
636 0x7004, 0xa084, 0x000a, 0x00c0, 0x23c8, 0x7108, 0xa194, 0xff00,
637 0x0040, 0x23c8, 0xa18c, 0x00ff, 0x2001, 0x000c, 0xa106, 0x0040,
638 0x23af, 0x2001, 0x0012, 0xa106, 0x0040, 0x23b3, 0x2001, 0x0014,
639 0xa106, 0x0040, 0x23b7, 0x2001, 0x0019, 0xa106, 0x0040, 0x23bb,
640 0x2001, 0x0032, 0xa106, 0x0040, 0x23bf, 0x0078, 0x23c3, 0x2009,
641 0x0012, 0x0078, 0x23c5, 0x2009, 0x0014, 0x0078, 0x23c5, 0x2009,
642 0x0019, 0x0078, 0x23c5, 0x2009, 0x0020, 0x0078, 0x23c5, 0x2009,
643 0x003f, 0x0078, 0x23c5, 0x2011, 0x0000, 0x2100, 0xa205, 0x700a,
644 0x0e7f, 0x007c, 0x0068, 0x23ca, 0x2091, 0x8000, 0x2071, 0x0000,
645 0x007e, 0x7018, 0xa084, 0x0001, 0x00c0, 0x23d1, 0x007f, 0x2071,
646 0x0010, 0x70ca, 0x007f, 0x70c6, 0x70c3, 0x8002, 0x70db, 0x073f,
647 0x70df, 0x0000, 0x2071, 0x0000, 0x701b, 0x0001, 0x2091, 0x4080,
648 0x0078, 0x23e8, 0x107e, 0x007e, 0x127e, 0x2091, 0x2300, 0x7f3c,
649 0x7e58, 0x7c30, 0x7d38, 0x77c2, 0x74c6, 0x76ca, 0x75ce, 0xa594,
650 0x003f, 0xa49c, 0x0003, 0xa484, 0x000f, 0x0079, 0x23ff, 0x2411,
651 0x2411, 0x2411, 0x274b, 0x3907, 0x240f, 0x2440, 0x244a, 0x240f,
652 0x240f, 0x240f, 0x240f, 0x240f, 0x240f, 0x240f, 0x240f, 0x1078,
653 0x23ca, 0x8507, 0xa084, 0x001f, 0x0079, 0x2416, 0x2454, 0x274b,
654 0x2905, 0x2a02, 0x2a2a, 0x2cc3, 0x2f6e, 0x2fb1, 0x2ffc, 0x3081,
655 0x3139, 0x31e2, 0x2440, 0x2827, 0x2f43, 0x2436, 0x3c78, 0x3c98,
656 0x3e5e, 0x3e6a, 0x3f3f, 0x2436, 0x2436, 0x4012, 0x4016, 0x3c76,
657 0x2436, 0x3dc9, 0x2436, 0x3b56, 0x244a, 0x2436, 0x1078, 0x23ca,
658 0x0018, 0x23ef, 0x127f, 0x2091, 0x8001, 0x007f, 0x107f, 0x007c,
659 0x2019, 0x4cfd, 0x1078, 0x2255, 0x702f, 0x0001, 0x781b, 0x004f,
660 0x0078, 0x2438, 0x2019, 0x4c5b, 0x1078, 0x2255, 0x702f, 0x8000,
661 0x781b, 0x00d5, 0x0078, 0x2438, 0x7242, 0x2009, 0x500f, 0x200b,
662 0x0000, 0xa584, 0x0001, 0x00c0, 0x3b6a, 0x0040, 0x2471, 0x1078,
663 0x23ca, 0x7003, 0x0000, 0x704b, 0x0000, 0x7043, 0x0000, 0x7037,
664 0x0000, 0x1078, 0x38de, 0x0018, 0x23ef, 0x2009, 0x500f, 0x200b,
665 0x0000, 0x7068, 0xa005, 0x00c0, 0x253c, 0x706c, 0xa084, 0x0007,
666 0x0079, 0x247a, 0x2573, 0x2482, 0x248e, 0x24ab, 0x24cd, 0x251a,
667 0x24f3, 0x2482, 0x1078, 0x38c6, 0x2009, 0x0048, 0x1078, 0x2e0f,
668 0x00c0, 0x248c, 0x7003, 0x0004, 0x0078, 0x2438, 0x1078, 0x38c6,
669 0x00c0, 0x24a9, 0x7080, 0x8007, 0x7882, 0x789b, 0x0010, 0x78ab,
670 0x000c, 0x789b, 0x0060, 0x78ab, 0x0001, 0x785b, 0x0004, 0x2009,
671 0x00e5, 0x1078, 0x2e03, 0x00c0, 0x24a9, 0x7003, 0x0004, 0x7093,
672 0x000f, 0x0078, 0x2438, 0x1078, 0x38c6, 0x00c0, 0x24cb, 0x7180,
673 0x8107, 0x7882, 0x789b, 0x0010, 0xa18c, 0x001f, 0xa18d, 0x00c0,
674 0x79aa, 0x78ab, 0x0006, 0x789b, 0x0060, 0x78ab, 0x0002, 0x785b,
675 0x0004, 0x2009, 0x00e5, 0x1078, 0x2e03, 0x00c0, 0x24cb, 0x7003,
676 0x0004, 0x7093, 0x000f, 0x0078, 0x2438, 0x1078, 0x38c6, 0x00c0,
677 0x24f1, 0x7180, 0x8107, 0x7882, 0x789b, 0x0010, 0xa18c, 0x001f,
678 0xa18d, 0x00c0, 0x79aa, 0x78ab, 0x0020, 0x7184, 0x79aa, 0x78ab,
679 0x000d, 0x789b, 0x0060, 0x78ab, 0x0004, 0x785b, 0x0004, 0x2009,
680 0x00e5, 0x1078, 0x2e03, 0x00c0, 0x24f1, 0x7003, 0x0004, 0x7093,
681 0x000f, 0x0078, 0x2438, 0x1078, 0x38c6, 0x00c0, 0x2518, 0x7180,
682 0x8107, 0x7882, 0x789b, 0x0010, 0xa18c, 0x001f, 0xa18d, 0x00c0,
683 0x79aa, 0x78ab, 0x0006, 0x789b, 0x0060, 0x78ab, 0x0002, 0x785b,
684 0x0004, 0x2009, 0x00e5, 0x1078, 0x2e03, 0x00c0, 0x2518, 0x7088,
685 0x708b, 0x0000, 0x2068, 0x704a, 0x7003, 0x0002, 0x7093, 0x000f,
686 0x0078, 0x2438, 0x1078, 0x38c6, 0x00c0, 0x2438, 0x7088, 0x2068,
687 0x6f14, 0x1078, 0x37bd, 0x2c50, 0x1078, 0x3978, 0x789b, 0x0010,
688 0x6814, 0xa084, 0x001f, 0xa085, 0x0080, 0x78aa, 0x6e1c, 0x2041,
689 0x0001, 0x708c, 0xa084, 0x0400, 0x2001, 0x0004, 0x0040, 0x253a,
690 0x2001, 0x0006, 0x0078, 0x265b, 0x1078, 0x38c6, 0x00c0, 0x2438,
691 0x789b, 0x0010, 0x7068, 0x2068, 0x6f14, 0x1078, 0x37bd, 0x2c50,
692 0x1078, 0x3978, 0x6008, 0xa085, 0x0010, 0x600a, 0x6824, 0xa005,
693 0x0040, 0x255a, 0xa082, 0x0006, 0x0048, 0x2558, 0x0078, 0x255a,
694 0x6827, 0x0005, 0x6b14, 0xa39c, 0x001f, 0xa39d, 0x00c0, 0x7058,
695 0xa084, 0x8000, 0x0040, 0x2568, 0xa684, 0x0001, 0x0040, 0x256a,
696 0xa39c, 0xffbf, 0x7baa, 0x2031, 0x0020, 0x2041, 0x0001, 0x2001,
697 0x0003, 0x0078, 0x265b, 0x0018, 0x23ef, 0x744c, 0xa485, 0x0000,
698 0x0040, 0x258d, 0xa080, 0x5080, 0x2030, 0x7150, 0x8108, 0xa12a,
699 0x0048, 0x2584, 0x2009, 0x5080, 0x2164, 0x6504, 0x85ff, 0x00c0,
700 0x259e, 0x8421, 0x00c0, 0x257e, 0x7152, 0x7003, 0x0000, 0x704b,
701 0x0000, 0x7040, 0xa005, 0x0040, 0x3b6a, 0x0078, 0x2438, 0x764c,
702 0xa6b0, 0x5080, 0x7150, 0x2600, 0x0078, 0x2589, 0x7152, 0x2568,
703 0x2558, 0x754a, 0x2c50, 0x6034, 0xa085, 0x0000, 0x00c0, 0x259b,
704 0x6708, 0x773a, 0xa784, 0x033f, 0x0040, 0x25d4, 0xa784, 0x0021,
705 0x00c0, 0x259b, 0xa784, 0x0002, 0x0040, 0x25bd, 0xa784, 0x0004,
706 0x0040, 0x259b, 0xa7bc, 0xfffb, 0x670a, 0xa784, 0x0008, 0x00c0,
707 0x259b, 0xa784, 0x0010, 0x00c0, 0x259b, 0xa784, 0x0200, 0x00c0,
708 0x259b, 0xa784, 0x0100, 0x0040, 0x25d4, 0x6018, 0xa005, 0x00c0,
709 0x259b, 0xa7bc, 0xfeff, 0x670a, 0x6823, 0x0000, 0x6e1c, 0xa684,
710 0x000e, 0x6118, 0x0040, 0x25e4, 0x601c, 0xa102, 0x0048, 0x25e7,
711 0x0040, 0x25e7, 0x0078, 0x2597, 0x81ff, 0x00c0, 0x2597, 0x68c3,
712 0x0000, 0xa784, 0x0080, 0x00c0, 0x25ef, 0x700c, 0x6022, 0xa7bc,
713 0xff7f, 0x670a, 0x1078, 0x3978, 0x0018, 0x23ef, 0x789b, 0x0010,
714 0xa046, 0x1078, 0x38c6, 0x00c0, 0x2438, 0x6b14, 0xa39c, 0x001f,
715 0xa39d, 0x00c0, 0x7058, 0xa084, 0x8000, 0x0040, 0x260b, 0xa684,
716 0x0001, 0x0040, 0x260d, 0xa39c, 0xffbf, 0xa684, 0x0010, 0x0040,
717 0x2613, 0xa39d, 0x0020, 0x7baa, 0x8840, 0xa684, 0x000e, 0x00c0,
718 0x261e, 0xa7bd, 0x0010, 0x670a, 0x0078, 0x2659, 0x7158, 0xa18c,
719 0x0800, 0x0040, 0x33d7, 0x2011, 0x0020, 0xa684, 0x0008, 0x00c0,
720 0x262f, 0x8210, 0xa684, 0x0002, 0x00c0, 0x262f, 0x8210, 0x7aaa,
721 0x8840, 0x1078, 0x38de, 0x6a14, 0x610c, 0x8108, 0xa18c, 0x00ff,
722 0xa1e0, 0x7300, 0x2c64, 0x8cff, 0x0040, 0x2650, 0x6014, 0xa206,
723 0x00c0, 0x263a, 0x60b8, 0x8001, 0x60ba, 0x00c0, 0x2635, 0x0c7e,
724 0x2a60, 0x6008, 0xa085, 0x0100, 0x600a, 0x0c7f, 0x0078, 0x2573,
725 0x1078, 0x38c6, 0x00c0, 0x2438, 0x2a60, 0x610e, 0x79aa, 0x8840,
726 0x7132, 0x2001, 0x0001, 0x007e, 0x715c, 0xa184, 0x0018, 0x0040,
727 0x2676, 0xa184, 0x0010, 0x0040, 0x2669, 0x1078, 0x35d6, 0x00c0,
728 0x2699, 0xa184, 0x0008, 0x0040, 0x2676, 0x69a0, 0xa184, 0x0600,
729 0x00c0, 0x2676, 0x1078, 0x34c7, 0x0078, 0x2699, 0x69a0, 0xa184,
730 0x0800, 0x0040, 0x268d, 0x0c7e, 0x027e, 0x2960, 0x6000, 0xa085,
731 0x2000, 0x6002, 0x6104, 0xa18d, 0x0010, 0x6106, 0x027f, 0x0c7f,
732 0x1078, 0x35d6, 0x00c0, 0x2699, 0x69a0, 0xa184, 0x0200, 0x0040,
733 0x2695, 0x1078, 0x3516, 0x0078, 0x2699, 0xa184, 0x0400, 0x00c0,
734 0x2672, 0x69a0, 0xa184, 0x1000, 0x0040, 0x26a4, 0x6914, 0xa18c,
735 0xff00, 0x810f, 0x1078, 0x22cd, 0x007f, 0x7002, 0xa68c, 0x00e0,
736 0xa684, 0x0060, 0x0040, 0x26b2, 0xa086, 0x0060, 0x00c0, 0x26b2,
737 0xa18d, 0x4000, 0x88ff, 0x0040, 0x26b7, 0xa18d, 0x0004, 0x795a,
738 0x69b6, 0x789b, 0x0060, 0x2800, 0x78aa, 0x789b, 0x0061, 0x6818,
739 0xa08d, 0x8000, 0xa084, 0x7fff, 0x691a, 0xa68c, 0x0080, 0x0040,
740 0x26d6, 0x7097, 0x0000, 0xa08a, 0x000d, 0x0050, 0x26d4, 0xa08a,
741 0x000c, 0x7196, 0x2001, 0x000c, 0x800c, 0x719a, 0x78aa, 0x8008,
742 0x810c, 0x0040, 0x33dd, 0xa18c, 0x00f8, 0x00c0, 0x33dd, 0x157e,
743 0x137e, 0x147e, 0x20a1, 0x012b, 0x789b, 0x0000, 0x8000, 0x80ac,
744 0xad80, 0x000b, 0x2098, 0x53a6, 0x147f, 0x137f, 0x157f, 0x6814,
745 0x8007, 0x7882, 0x6d94, 0x7dd6, 0x7dde, 0x6e98, 0x7ed2, 0x7eda,
746 0x1078, 0x38c6, 0x00c0, 0x270d, 0x702c, 0x8003, 0x0048, 0x2706,
747 0x2019, 0x4c5b, 0x1078, 0x2255, 0x702f, 0x8000, 0x7830, 0xa084,
748 0x00c0, 0x00c0, 0x270d, 0x0098, 0x2715, 0x6008, 0xa084, 0xffef,
749 0x600a, 0x1078, 0x38de, 0x0078, 0x2461, 0x7200, 0xa284, 0x0007,
750 0xa086, 0x0001, 0x00c0, 0x2722, 0x781b, 0x004f, 0x1078, 0x38de,
751 0x0078, 0x2733, 0x6ab4, 0xa295, 0x2000, 0x7a5a, 0x781b, 0x004f,
752 0x1078, 0x38de, 0x7200, 0x2500, 0xa605, 0x0040, 0x2733, 0xa284,
753 0x0007, 0x1079, 0x2741, 0xad80, 0x0009, 0x7036, 0xa284, 0x0007,
754 0xa086, 0x0001, 0x00c0, 0x2438, 0x6018, 0x8000, 0x601a, 0x0078,
755 0x2438, 0x2749, 0x48f7, 0x48f7, 0x48e6, 0x48f7, 0x2749, 0x48e6,
756 0x2749, 0x1078, 0x23ca, 0x1078, 0x38c6, 0x0f7e, 0x2079, 0x5000,
757 0x78cc, 0x0f7f, 0xa084, 0x0001, 0x0040, 0x276f, 0x706c, 0xa086,
758 0x0001, 0x00c0, 0x275e, 0x706e, 0x0078, 0x2802, 0x706c, 0xa086,
759 0x0005, 0x00c0, 0x276d, 0x7088, 0x2068, 0x681b, 0x0004, 0x6817,
760 0x0000, 0x6820, 0xa085, 0x0008, 0x6822, 0x706f, 0x0000, 0x2011,
761 0x0004, 0x716c, 0xa186, 0x0001, 0x0040, 0x2790, 0xa186, 0x0007,
762 0x00c0, 0x2780, 0x2009, 0x5038, 0x200b, 0x0005, 0x0078, 0x2790,
763 0x2009, 0x5013, 0x2104, 0x2009, 0x5012, 0x200a, 0x2009, 0x5038,
764 0x200b, 0x0001, 0x706f, 0x0000, 0x7073, 0x0001, 0x0078, 0x2792,
765 0x706f, 0x0000, 0x1078, 0x4633, 0x157e, 0x20a9, 0x0010, 0x2039,
766 0x0000, 0x1078, 0x36b0, 0xa7b8, 0x0100, 0x0070, 0x27a1, 0x0078,
767 0x2799, 0x157f, 0x7000, 0x0079, 0x27a5, 0x27d3, 0x27ba, 0x27ba,
768 0x27ad, 0x27d3, 0x27d3, 0x27d3, 0x27d3, 0x2021, 0x505a, 0x2404,
769 0xa005, 0x0040, 0x27d3, 0xad06, 0x00c0, 0x27ba, 0x6800, 0x2022,
770 0x0078, 0x27ca, 0x6820, 0xa084, 0x0001, 0x00c0, 0x27c6, 0x6f14,
771 0x1078, 0x37bd, 0x1078, 0x33ae, 0x0078, 0x27ca, 0x7060, 0x2060,
772 0x6800, 0x6002, 0x6a1a, 0x6817, 0x0000, 0x6820, 0xa085, 0x0008,
773 0x6822, 0x1078, 0x1c53, 0x2021, 0x7400, 0x1078, 0x280f, 0x2021,
774 0x505a, 0x1078, 0x280f, 0x157e, 0x20a9, 0x0000, 0x2021, 0x7300,
775 0x1078, 0x280f, 0x8420, 0x0070, 0x27e7, 0x0078, 0x27e0, 0x2061,
776 0x5300, 0x2021, 0x0002, 0x20a9, 0x0100, 0x6018, 0x6110, 0x81ff,
777 0x0040, 0x27f6, 0xa102, 0x0050, 0x27f6, 0x6012, 0x601b, 0x0000,
778 0xace0, 0x0010, 0x0070, 0x27fe, 0x0078, 0x27ed, 0x8421, 0x00c0,
779 0x27eb, 0x157f, 0x709c, 0xa084, 0x8000, 0x0040, 0x2809, 0x1078,
780 0x39cc, 0x7003, 0x0000, 0x704b, 0x0000, 0x0078, 0x2438, 0x047e,
781 0x2404, 0xa005, 0x0040, 0x2823, 0x2068, 0x6800, 0x007e, 0x6a1a,
782 0x6817, 0x0000, 0x6820, 0xa085, 0x0008, 0x6822, 0x1078, 0x1c53,
783 0x007f, 0x0078, 0x2811, 0x047f, 0x2023, 0x0000, 0x007c, 0xa282,
784 0x0003, 0x0050, 0x282d, 0x1078, 0x23ca, 0x2300, 0x0079, 0x2830,
785 0x2833, 0x28a6, 0x28c3, 0xa282, 0x0002, 0x0040, 0x2839, 0x1078,
786 0x23ca, 0x706c, 0x706f, 0x0000, 0x7093, 0x0000, 0x0079, 0x2840,
787 0x2848, 0x2848, 0x284a, 0x287e, 0x33e3, 0x2848, 0x287e, 0x2848,
788 0x1078, 0x23ca, 0x7780, 0x1078, 0x36b0, 0x7780, 0xa7bc, 0x0f00,
789 0x1078, 0x37bd, 0x6018, 0xa005, 0x0040, 0x2875, 0x2021, 0x7400,
790 0x2009, 0x0004, 0x2011, 0x0010, 0x1078, 0x28de, 0x0040, 0x2875,
791 0x157e, 0x20a9, 0x0000, 0x2021, 0x7300, 0x047e, 0x2009, 0x0004,
792 0x2011, 0x0010, 0x1078, 0x28de, 0x047f, 0x0040, 0x2874, 0x8420,
793 0x0070, 0x2874, 0x0078, 0x2865, 0x157f, 0x8738, 0xa784, 0x001f,
794 0x00c0, 0x2850, 0x0078, 0x2461, 0x0078, 0x2461, 0x7780, 0x1078,
795 0x37bd, 0x6018, 0xa005, 0x0040, 0x28a4, 0x2021, 0x7400, 0x2009,
796 0x0005, 0x2011, 0x0020, 0x1078, 0x28de, 0x0040, 0x28a4, 0x157e,
797 0x20a9, 0x0000, 0x2021, 0x7300, 0x047e, 0x2009, 0x0005, 0x2011,
798 0x0020, 0x1078, 0x28de, 0x047f, 0x0040, 0x28a3, 0x8420, 0x0070,
799 0x28a3, 0x0078, 0x2894, 0x157f, 0x0078, 0x2461, 0x2200, 0x0079,
800 0x28a9, 0x28ac, 0x28ae, 0x28ae, 0x1078, 0x23ca, 0x2009, 0x0012,
801 0x706c, 0xa086, 0x0002, 0x0040, 0x28b7, 0x2009, 0x000e, 0x6818,
802 0xa084, 0x8000, 0x0040, 0x28bd, 0x691a, 0x706f, 0x0000, 0x7073,
803 0x0001, 0x0078, 0x3854, 0x2200, 0x0079, 0x28c6, 0x28cb, 0x28ae,
804 0x28c9, 0x1078, 0x23ca, 0x1078, 0x4633, 0x7000, 0xa086, 0x0001,
805 0x00c0, 0x3373, 0x1078, 0x33c4, 0x6008, 0xa084, 0xffef, 0x600a,
806 0x1078, 0x3366, 0x0040, 0x3373, 0x0078, 0x2573, 0x2404, 0xa005,
807 0x0040, 0x2901, 0x2068, 0x2d04, 0x007e, 0x6814, 0xa706, 0x0040,
808 0x28ed, 0x2d20, 0x007f, 0x0078, 0x28df, 0x007f, 0x2022, 0x691a,
809 0x6817, 0x0000, 0x6820, 0xa205, 0x6822, 0x1078, 0x1c53, 0x6010,
810 0x8001, 0x6012, 0x6008, 0xa084, 0xffef, 0x600a, 0x1078, 0x33c4,
811 0x007c, 0xa085, 0x0001, 0x0078, 0x2900, 0x2300, 0x0079, 0x2908,
812 0x290d, 0x290b, 0x29a6, 0x1078, 0x23ca, 0x78ec, 0xa084, 0x0001,
813 0x00c0, 0x2921, 0x7000, 0xa086, 0x0004, 0x00c0, 0x2919, 0x0078,
814 0x2944, 0x1078, 0x33c4, 0x6008, 0xa084, 0xffef, 0x600a, 0x0078,
815 0x3373, 0x78e4, 0xa005, 0x00d0, 0x2944, 0x0018, 0x2438, 0x2008,
816 0xa084, 0x0030, 0x00c0, 0x2930, 0x781b, 0x004f, 0x0078, 0x2438,
817 0x78ec, 0xa084, 0x0003, 0x0040, 0x292c, 0x2100, 0xa084, 0x0007,
818 0x0079, 0x293a, 0x297d, 0x2988, 0x296e, 0x2942, 0x38b9, 0x38b9,
819 0x2942, 0x2997, 0x1078, 0x23ca, 0x7000, 0xa086, 0x0004, 0x00c0,
820 0x295e, 0x706c, 0xa086, 0x0002, 0x00c0, 0x2954, 0x2011, 0x0002,
821 0x2019, 0x0000, 0x0078, 0x2827, 0x706c, 0xa086, 0x0006, 0x0040,
822 0x294e, 0x706c, 0xa086, 0x0004, 0x0040, 0x294e, 0x79e4, 0xa184,
823 0x0030, 0x0040, 0x2968, 0x78ec, 0xa084, 0x0003, 0x00c0, 0x296a,
824 0x0078, 0x2f43, 0x2001, 0x0003, 0x0078, 0x2cd7, 0x6818, 0xa084,
825 0x8000, 0x0040, 0x2975, 0x681b, 0x001d, 0x1078, 0x368f, 0x782b,
826 0x3008, 0x781b, 0x0056, 0x0078, 0x2438, 0x6818, 0xa084, 0x8000,
827 0x0040, 0x2984, 0x681b, 0x001d, 0x1078, 0x368f, 0x0078, 0x3884,
828 0x6818, 0xa084, 0x8000, 0x0040, 0x298f, 0x681b, 0x001d, 0x1078,
829 0x368f, 0x782b, 0x3008, 0x781b, 0x00d2, 0x0078, 0x2438, 0x6818,
830 0xa084, 0x8000, 0x0040, 0x299e, 0x681b, 0x001d, 0x1078, 0x368f,
831 0x782b, 0x3008, 0x781b, 0x0093, 0x0078, 0x2438, 0xa584, 0x000f,
832 0x00c0, 0x29c3, 0x7000, 0x0079, 0x29ad, 0x2461, 0x29b7, 0x29b5,
833 0x3373, 0x3373, 0x3373, 0x3373, 0x29b5, 0x1078, 0x23ca, 0x1078,
834 0x33c4, 0x6008, 0xa084, 0xffef, 0x600a, 0x1078, 0x3366, 0x0040,
835 0x3373, 0x0078, 0x2573, 0x78e4, 0xa005, 0x00d0, 0x2944, 0x0018,
836 0x2944, 0x2008, 0xa084, 0x0030, 0x00c0, 0x29d2, 0x781b, 0x004f,
837 0x0078, 0x2438, 0x78ec, 0xa084, 0x0003, 0x0040, 0x29ce, 0x2100,
838 0xa184, 0x0007, 0x0079, 0x29dc, 0x29ee, 0x29f2, 0x29e6, 0x29e4,
839 0x38b9, 0x38b9, 0x29e4, 0x38af, 0x1078, 0x23ca, 0x1078, 0x3697,
840 0x782b, 0x3008, 0x781b, 0x0056, 0x0078, 0x2438, 0x1078, 0x3697,
841 0x0078, 0x3884, 0x1078, 0x3697, 0x782b, 0x3008, 0x781b, 0x00d2,
842 0x0078, 0x2438, 0x1078, 0x3697, 0x782b, 0x3008, 0x781b, 0x0093,
843 0x0078, 0x2438, 0x2300, 0x0079, 0x2a05, 0x2a0a, 0x2a08, 0x2a0c,
844 0x1078, 0x23ca, 0x0078, 0x3081, 0x681b, 0x0008, 0x78a3, 0x0000,
845 0x79e4, 0xa184, 0x0030, 0x0040, 0x3081, 0x78ec, 0xa084, 0x0003,
846 0x0040, 0x3081, 0xa184, 0x0007, 0x0079, 0x2a1e, 0x2a26, 0x29f2,
847 0x296e, 0x3854, 0x38b9, 0x38b9, 0x2a26, 0x38af, 0x1078, 0x3868,
848 0x0078, 0x2438, 0xa282, 0x0005, 0x0050, 0x2a30, 0x1078, 0x23ca,
849 0x2300, 0x0079, 0x2a33, 0x2a36, 0x2c84, 0x2c92, 0x2200, 0x0079,
850 0x2a39, 0x2a53, 0x2a40, 0x2a53, 0x2a3e, 0x2c69, 0x1078, 0x23ca,
851 0x789b, 0x0018, 0x78a8, 0xa084, 0x00ff, 0xa082, 0x0020, 0x0048,
852 0x366b, 0xa08a, 0x0004, 0x00c8, 0x366b, 0x0079, 0x2a4f, 0x366b,
853 0x366b, 0x366b, 0x3619, 0x789b, 0x0018, 0x79a8, 0xa184, 0x0080,
854 0x0040, 0x2a64, 0x0078, 0x366b, 0x7000, 0xa005, 0x00c0, 0x2a5a,
855 0x2011, 0x0004, 0x0078, 0x31f5, 0xa184, 0x00ff, 0xa08a, 0x0010,
856 0x00c8, 0x366b, 0x0079, 0x2a6c, 0x2a7e, 0x2a7c, 0x2a96, 0x2a9a,
857 0x2b55, 0x366b, 0x366b, 0x2b57, 0x366b, 0x366b, 0x2c65, 0x2c65,
858 0x366b, 0x366b, 0x366b, 0x2c67, 0x1078, 0x23ca, 0xa684, 0x1000,
859 0x0040, 0x2a8b, 0x2001, 0x0500, 0x8000, 0x8000, 0x783a, 0x781b,
860 0x0091, 0x0078, 0x2438, 0x6818, 0xa084, 0x8000, 0x0040, 0x2a94,
861 0x681b, 0x001d, 0x0078, 0x2a82, 0x0078, 0x3854, 0x681b, 0x001d,
862 0x0078, 0x367b, 0x6920, 0x6922, 0xa684, 0x1800, 0x00c0, 0x2adb,
863 0x6820, 0xa084, 0x0001, 0x00c0, 0x2ae1, 0x6818, 0xa086, 0x0008,
864 0x00c0, 0x2aac, 0x681b, 0x0000, 0xa684, 0x0400, 0x0040, 0x2b51,
865 0xa684, 0x0080, 0x0040, 0x2ad7, 0x7097, 0x0000, 0x6818, 0xa084,
866 0x003f, 0xa08a, 0x000d, 0x0050, 0x2ad7, 0xa08a, 0x000c, 0x7196,
867 0x2001, 0x000c, 0x800c, 0x719a, 0x789b, 0x0061, 0x78aa, 0x157e,
868 0x137e, 0x147e, 0x20a1, 0x012b, 0x789b, 0x0000, 0x8000, 0x80ac,
869 0xad80, 0x000b, 0x2098, 0x53a6, 0x147f, 0x137f, 0x157f, 0x781b,
870 0x0058, 0x0078, 0x2438, 0xa684, 0x1000, 0x0040, 0x2ae1, 0x0078,
871 0x2438, 0xa684, 0x0060, 0x0040, 0x2b4d, 0xa684, 0x0800, 0x0040,
872 0x2b4d, 0xa684, 0x8000, 0x00c0, 0x2aef, 0x0078, 0x2b09, 0xa6b4,
873 0x7fff, 0x7e5a, 0x6eb6, 0x789b, 0x0076, 0x7aac, 0x79ac, 0x78ac,
874 0x801b, 0x00c8, 0x2afc, 0x8000, 0xa084, 0x003f, 0xa108, 0xa291,
875 0x0000, 0x6b98, 0x2100, 0xa302, 0x68b2, 0x6b94, 0x2200, 0xa303,
876 0x68ae, 0xa684, 0x4000, 0x0040, 0x2b11, 0xa6b4, 0xbfff, 0x7e5a,
877 0x6eb6, 0x7000, 0xa086, 0x0003, 0x00c0, 0x2b1e, 0x1078, 0x46e9,
878 0x1078, 0x48e6, 0x781b, 0x0064, 0x0078, 0x2438, 0xa006, 0x1078,
879 0x49ed, 0x6ab0, 0x69ac, 0x6c98, 0x6b94, 0x2200, 0xa105, 0x0040,
880 0x2b2d, 0x2200, 0xa422, 0x2100, 0xa31b, 0x6caa, 0x7cd2, 0x7cda,
881 0x6ba6, 0x7bd6, 0x7bde, 0x2300, 0xa405, 0x00c0, 0x2b3f, 0xa6b5,
882 0x4000, 0x7e5a, 0x6eb6, 0x781b, 0x0064, 0x0078, 0x2438, 0x781b,
883 0x0064, 0x2200, 0xa115, 0x00c0, 0x2b49, 0x1078, 0x48f7, 0x0078,
884 0x2438, 0x1078, 0x4942, 0x0078, 0x2438, 0x781b, 0x0065, 0x0078,
885 0x2438, 0x781b, 0x0058, 0x0078, 0x2438, 0x1078, 0x23ca, 0x0078,
886 0x2bb8, 0x6920, 0xa184, 0x0100, 0x0040, 0x2b6f, 0xa18c, 0xfeff,
887 0x6922, 0x0c7e, 0x7054, 0x2060, 0x6000, 0xa084, 0xefff, 0x6002,
888 0x6004, 0xa084, 0xfff5, 0x6006, 0x0c7f, 0x0078, 0x2ba7, 0xa184,
889 0x0200, 0x0040, 0x2ba7, 0xa18c, 0xfdff, 0x6922, 0x0c7e, 0x7054,
890 0x2060, 0x6000, 0xa084, 0xdfff, 0x6002, 0x6004, 0xa084, 0xffef,
891 0x6006, 0x2008, 0x2c48, 0x0c7f, 0xa184, 0x0008, 0x0040, 0x2ba7,
892 0x1078, 0x37b9, 0x1078, 0x34c7, 0x88ff, 0x0040, 0x2ba7, 0x789b,
893 0x0060, 0x2800, 0x78aa, 0x7e58, 0xa6b5, 0x0004, 0x7e5a, 0xa684,
894 0x0400, 0x00c0, 0x2ba1, 0x782b, 0x3008, 0x781b, 0x0056, 0x0078,
895 0x2438, 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x7e58,
896 0xa684, 0x0400, 0x00c0, 0x2bb0, 0x781b, 0x0058, 0x0078, 0x2438,
897 0x781b, 0x0065, 0x0078, 0x2438, 0x0078, 0x3673, 0x0078, 0x3673,
898 0x2019, 0x0000, 0x7990, 0xa18c, 0x0007, 0x0040, 0x2bb6, 0x789b,
899 0x0010, 0x78a8, 0xa094, 0x00ff, 0xa286, 0x0001, 0x00c0, 0x2bf6,
900 0x2300, 0x7ca8, 0xa400, 0x2018, 0xa102, 0x0040, 0x2bee, 0x0048,
901 0x2bd3, 0x0078, 0x2bf0, 0xa380, 0x0002, 0xa102, 0x00c8, 0x2bee,
902 0x6920, 0xa18c, 0xfcff, 0x6922, 0x0c7e, 0x7054, 0x2060, 0x6000,
903 0xa084, 0xefef, 0x6002, 0x6004, 0xa084, 0xffe5, 0x6006, 0x0c7f,
904 0x7e58, 0xa6b4, 0xfffb, 0x7e5a, 0x0078, 0x2ba8, 0x0078, 0x2b59,
905 0x24a8, 0x7aa8, 0x00f0, 0x2bf0, 0x0078, 0x2bc1, 0xa284, 0x00f0,
906 0xa086, 0x0020, 0x00c0, 0x2c56, 0x8318, 0x8318, 0x2300, 0xa102,
907 0x0040, 0x2c06, 0x0048, 0x2c06, 0x0078, 0x2c53, 0xa286, 0x0023,
908 0x0040, 0x2bb6, 0x681c, 0xa084, 0xfff1, 0x681e, 0x7e58, 0xa684,
909 0xfff1, 0xa085, 0x0010, 0x2030, 0x7e5a, 0x6008, 0xa085, 0x0010,
910 0x600a, 0x0c7e, 0x7054, 0x2060, 0x6004, 0x2008, 0x2c48, 0x0c7f,
911 0xa184, 0x0010, 0x0040, 0x2c2a, 0x1078, 0x37b9, 0x1078, 0x35d6,
912 0x0078, 0x2c39, 0x0c7e, 0x7054, 0x2060, 0x6004, 0x2008, 0x2c48,
913 0x0c7f, 0xa184, 0x0008, 0x0040, 0x2ba7, 0x1078, 0x37b9, 0x1078,
914 0x34c7, 0x88ff, 0x0040, 0x2ba7, 0x789b, 0x0060, 0x2800, 0x78aa,
915 0xa6b5, 0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x2c4d, 0x782b,
916 0x3008, 0x781b, 0x0056, 0x0078, 0x2438, 0x782b, 0x3008, 0x781b,
917 0x0065, 0x0078, 0x2438, 0x7aa8, 0x0078, 0x2bc1, 0x8318, 0x2300,
918 0xa102, 0x0040, 0x2c5f, 0x0048, 0x2c5f, 0x0078, 0x2bc1, 0xa284,
919 0x0080, 0x00c0, 0x367b, 0x0078, 0x3673, 0x0078, 0x367b, 0x0078,
920 0x366b, 0x789b, 0x0018, 0x78a8, 0xa084, 0x00ff, 0xa08e, 0x0001,
921 0x0040, 0x2c74, 0x1078, 0x23ca, 0x7aa8, 0xa294, 0x00ff, 0x78a8,
922 0xa084, 0x00ff, 0xa08a, 0x0004, 0x00c8, 0x366b, 0x0079, 0x2c80,
923 0x366b, 0x3414, 0x366b, 0x356b, 0xa282, 0x0000, 0x00c0, 0x2c8a,
924 0x1078, 0x23ca, 0x1078, 0x368f, 0x782b, 0x3008, 0x781b, 0x0065,
925 0x0078, 0x2438, 0xa282, 0x0003, 0x00c0, 0x2c98, 0x1078, 0x23ca,
926 0xa484, 0x8000, 0x00c0, 0x2cbb, 0x706c, 0xa005, 0x0040, 0x2ca2,
927 0x1078, 0x23ca, 0x6f14, 0x7782, 0xa7bc, 0x0f00, 0x1078, 0x37bd,
928 0x6008, 0xa085, 0x0021, 0x600a, 0x8738, 0xa784, 0x001f, 0x00c0,
929 0x2ca6, 0x1078, 0x3693, 0x706f, 0x0002, 0x2009, 0x5038, 0x200b,
930 0x0009, 0x0078, 0x2cbd, 0x1078, 0x369f, 0x782b, 0x3008, 0x781b,
931 0x0065, 0x0078, 0x2438, 0xa282, 0x0004, 0x0050, 0x2cc9, 0x1078,
932 0x23ca, 0x2300, 0x0079, 0x2ccc, 0x2ccf, 0x2db8, 0x2deb, 0xa286,
933 0x0003, 0x0040, 0x2cd5, 0x1078, 0x23ca, 0x2001, 0x0000, 0x007e,
934 0x68c0, 0xa005, 0x0040, 0x2cde, 0x7003, 0x0003, 0x68a0, 0xa084,
935 0x2000, 0x0040, 0x2ce7, 0x6008, 0xa085, 0x0002, 0x600a, 0x007f,
936 0x703e, 0x7000, 0xa084, 0x0007, 0x0079, 0x2cee, 0x2461, 0x2cf8,
937 0x2cf8, 0x2eed, 0x2f29, 0x2461, 0x2f29, 0x2cf6, 0x1078, 0x23ca,
938 0xa684, 0x1000, 0x00c0, 0x2d00, 0x1078, 0x4633, 0x0040, 0x2d92,
939 0x7868, 0xa08c, 0x00ff, 0x0040, 0x2d48, 0xa186, 0x0008, 0x00c0,
940 0x2d17, 0x1078, 0x33c4, 0x6008, 0xa084, 0xffef, 0x600a, 0x1078,
941 0x3366, 0x0040, 0x2d48, 0x1078, 0x4633, 0x0078, 0x2d2f, 0xa186,
942 0x0028, 0x00c0, 0x2d48, 0x1078, 0x4633, 0x6008, 0xa084, 0xffef,
943 0x600a, 0x6018, 0xa005, 0x0040, 0x2d2f, 0x8001, 0x601a, 0xa005,
944 0x0040, 0x2d2f, 0x8001, 0xa005, 0x0040, 0x2d2f, 0x601e, 0x6820,
945 0xa084, 0x0001, 0x0040, 0x2461, 0x6820, 0xa084, 0xfffe, 0x6822,
946 0x7060, 0x0c7e, 0x2060, 0x6800, 0x6002, 0x0c7f, 0x6004, 0x6802,
947 0xa005, 0x2d00, 0x00c0, 0x2d45, 0x6002, 0x6006, 0x0078, 0x2461,
948 0x017e, 0x1078, 0x2e1c, 0x017f, 0xa684, 0xdf00, 0x681e, 0x682b,
949 0x0000, 0x6f14, 0x81ff, 0x0040, 0x2d92, 0xa186, 0x0002, 0x00c0,
950 0x2d92, 0xa684, 0x0800, 0x00c0, 0x2d65, 0xa684, 0x0060, 0x0040,
951 0x2d65, 0x78d8, 0x7adc, 0x682e, 0x6a32, 0x6820, 0xa084, 0x0800,
952 0x00c0, 0x2d92, 0x8717, 0xa294, 0x000f, 0x8213, 0x8213, 0x8213,
953 0xa290, 0x5280, 0xa290, 0x0000, 0x221c, 0xa384, 0x0100, 0x00c0,
954 0x2d7b, 0x0078, 0x2d81, 0x8210, 0x2204, 0xa085, 0x0018, 0x2012,
955 0x8211, 0xa384, 0x0400, 0x0040, 0x2d8e, 0x68a0, 0xa084, 0x0100,
956 0x00c0, 0x2d8e, 0x1078, 0x2ea0, 0x0078, 0x2461, 0x6008, 0xa085,
957 0x0002, 0x600a, 0x6916, 0x6818, 0xa084, 0x8000, 0x0040, 0x2d9a,
958 0x703c, 0x681a, 0xa68c, 0xdf00, 0x691e, 0x1078, 0x33b5, 0x1078,
959 0x33c4, 0x00c0, 0x2da7, 0x6008, 0xa084, 0xffef, 0x600a, 0x6820,
960 0xa084, 0x0001, 0x00c0, 0x2db0, 0x1078, 0x33ae, 0x0078, 0x2db4,
961 0x7060, 0x2060, 0x6800, 0x6002, 0x1078, 0x1c53, 0x0078, 0x2461,
962 0xa282, 0x0004, 0x0048, 0x2dbe, 0x1078, 0x23ca, 0x2200, 0x0079,
963 0x2dc1, 0x2dbc, 0x2dc5, 0x2dd2, 0x2dc5, 0x7000, 0xa086, 0x0005,
964 0x0040, 0x2dce, 0x1078, 0x368f, 0x782b, 0x3008, 0x781b, 0x0065,
965 0x0078, 0x2438, 0x7890, 0x8007, 0x8001, 0xa084, 0x0007, 0xa080,
966 0x0018, 0x789a, 0x79a8, 0xa18c, 0x00ff, 0xa186, 0x0003, 0x0040,
967 0x2de7, 0xa186, 0x0000, 0x0040, 0x2de7, 0x0078, 0x366b, 0x781b,
968 0x0065, 0x0078, 0x2438, 0x6820, 0xa085, 0x0004, 0x6822, 0x82ff,
969 0x00c0, 0x2df6, 0x1078, 0x368f, 0x0078, 0x2dfd, 0x8211, 0x0040,
970 0x2dfb, 0x1078, 0x23ca, 0x1078, 0x369f, 0x782b, 0x3008, 0x781b,
971 0x0065, 0x0078, 0x2438, 0x702c, 0x8003, 0x0048, 0x2e0d, 0x2019,
972 0x4c5b, 0x1078, 0x2255, 0x702f, 0x8000, 0x1078, 0x38de, 0x7830,
973 0xa084, 0x00c0, 0x00c0, 0x2e19, 0x0018, 0x2e19, 0x791a, 0xa006,
974 0x007c, 0xa085, 0x0001, 0x007c, 0xa684, 0x0060, 0x00c0, 0x2e26,
975 0x682f, 0x0000, 0x6833, 0x0000, 0x0078, 0x2e9f, 0xa684, 0x0800,
976 0x00c0, 0x2e48, 0x68b4, 0xa084, 0x4800, 0xa635, 0xa684, 0x0800,
977 0x00c0, 0x2e48, 0x6998, 0x6a94, 0x692e, 0x6a32, 0x703c, 0xa005,
978 0x00c0, 0x2e40, 0x2200, 0xa105, 0x0040, 0x2e47, 0x703f, 0x0015,
979 0x7000, 0xa086, 0x0006, 0x0040, 0x2e47, 0x1078, 0x4633, 0x007c,
980 0xa684, 0x0020, 0x0040, 0x2e6a, 0xa684, 0x4000, 0x0040, 0x2e56,
981 0x682f, 0x0000, 0x6833, 0x0000, 0x0078, 0x2e40, 0x68b4, 0xa084,
982 0x4800, 0xa635, 0xa684, 0x4000, 0x00c0, 0x2e50, 0x703c, 0xa005,
983 0x00c0, 0x2e64, 0x703f, 0x0015, 0x79d8, 0x7adc, 0x692e, 0x6a32,
984 0x0078, 0x2e40, 0xa684, 0x4000, 0x0040, 0x2e74, 0x682f, 0x0000,
985 0x6833, 0x0000, 0x0078, 0x2e40, 0x68b4, 0xa084, 0x4800, 0xa635,
986 0xa684, 0x4000, 0x00c0, 0x2e6e, 0x703c, 0xa005, 0x00c0, 0x2e82,
987 0x703f, 0x0015, 0x79d8, 0x7adc, 0x78d0, 0x80fb, 0x00c8, 0x2e89,
988 0x8000, 0xa084, 0x003f, 0xa108, 0xa291, 0x0000, 0x692e, 0x6a32,
989 0x2100, 0xa205, 0x00c0, 0x2e96, 0x0078, 0x2e40, 0x7000, 0xa086,
990 0x0006, 0x0040, 0x2e9f, 0x1078, 0x49ed, 0x0078, 0x2e40, 0x007c,
991 0x6008, 0xa085, 0x0200, 0x600a, 0xa384, 0x0200, 0x0040, 0x2eac,
992 0x6008, 0xa085, 0x0002, 0x600a, 0x681b, 0x0006, 0x688f, 0x0000,
993 0x6893, 0x0000, 0x6a30, 0x692c, 0x6a3e, 0x6942, 0x682f, 0x0003,
994 0x6833, 0x0000, 0x6837, 0x0020, 0x6897, 0x0000, 0x689b, 0x0020,
995 0x68b3, 0x0000, 0x68af, 0x0000, 0x7000, 0x0079, 0x2ec7, 0x2461,
996 0x2ed1, 0x2eda, 0x2ecf, 0x2ecf, 0x2ecf, 0x2ecf, 0x2ecf, 0x1078,
997 0x23ca, 0x6820, 0xa084, 0x0001, 0x00c0, 0x2eda, 0x1078, 0x33ae,
998 0x0078, 0x2ee0, 0x7060, 0x2c50, 0x2060, 0x6800, 0x6002, 0x2a60,
999 0x2021, 0x505a, 0x2404, 0xa005, 0x0040, 0x2ee9, 0x2020, 0x0078,
1000 0x2ee2, 0x2d22, 0x206b, 0x0000, 0x007c, 0x1078, 0x33b5, 0x1078,
1001 0x33c4, 0x6008, 0xa084, 0xfdff, 0x600a, 0x682b, 0x0000, 0x789b,
1002 0x000e, 0x6f14, 0x6817, 0x0002, 0x1078, 0x4a35, 0xa684, 0x0800,
1003 0x0040, 0x2f06, 0x691c, 0xa18d, 0x2000, 0x691e, 0x6818, 0xa084,
1004 0x8000, 0x0040, 0x2f16, 0x7868, 0xa08c, 0x00ff, 0x0040, 0x2f14,
1005 0x681b, 0x001e, 0x0078, 0x2f16, 0x681b, 0x0000, 0x2021, 0x505a,
1006 0x2404, 0xad06, 0x0040, 0x2f1d, 0x7460, 0x6800, 0x2022, 0x68c3,
1007 0x0000, 0x6a3c, 0x6940, 0x6a32, 0x692e, 0x1078, 0x1c53, 0x0078,
1008 0x2461, 0x1078, 0x2e1c, 0x682b, 0x0000, 0x2001, 0x000e, 0x6f14,
1009 0x1078, 0x38e4, 0xa08c, 0x00ff, 0x6916, 0x6818, 0xa084, 0x8000,
1010 0x0040, 0x2f3c, 0x703c, 0x681a, 0xa68c, 0xdf00, 0x691e, 0x706f,
1011 0x0000, 0x0078, 0x2461, 0x7000, 0xa005, 0x00c0, 0x2f49, 0x0078,
1012 0x2461, 0xa006, 0x1078, 0x4633, 0x6817, 0x0000, 0x681b, 0x0014,
1013 0xa68c, 0xdf00, 0x691e, 0x682b, 0x0000, 0x6820, 0xa085, 0x00ff,
1014 0x6822, 0x7000, 0x0079, 0x2f5c, 0x2461, 0x2f66, 0x2f66, 0x2f68,
1015 0x2f68, 0x2f68, 0x2f68, 0x2f64, 0x1078, 0x23ca, 0x1078, 0x33c4,
1016 0x6008, 0xa084, 0xffef, 0x600a, 0x0078, 0x337e, 0x2300, 0x0079,
1017 0x2f71, 0x2f74, 0x2f76, 0x2faf, 0x1078, 0x23ca, 0x7000, 0x0079,
1018 0x2f79, 0x2461, 0x2f83, 0x2f83, 0x2f9e, 0x2f83, 0x2fab, 0x2f9e,
1019 0x2f81, 0x1078, 0x23ca, 0xa684, 0x0060, 0xa086, 0x0060, 0x00c0,
1020 0x2f9a, 0xa6b4, 0xffdf, 0xa6b4, 0xbfff, 0xa6b5, 0x2000, 0x7e5a,
1021 0x681c, 0xa084, 0xffdf, 0x681e, 0x1078, 0x4633, 0x1078, 0x48f7,
1022 0x0078, 0x3854, 0xa684, 0x2000, 0x0040, 0x2f8d, 0x6818, 0xa084,
1023 0x8000, 0x0040, 0x2fab, 0x681b, 0x0015, 0xa684, 0x4000, 0x0040,
1024 0x2fab, 0x681b, 0x0007, 0x1078, 0x3868, 0x0078, 0x2438, 0x1078,
1025 0x23ca, 0x2300, 0x0079, 0x2fb4, 0x2fb7, 0x2fb9, 0x2fec, 0x1078,
1026 0x23ca, 0x7000, 0x0079, 0x2fbc, 0x2461, 0x2fc6, 0x2fc6, 0x2fe1,
1027 0x2fc6, 0x2fe8, 0x2fe1, 0x2fc4, 0x1078, 0x23ca, 0xa684, 0x0060,
1028 0xa086, 0x0060, 0x00c0, 0x2fdd, 0xa6b4, 0xffbf, 0xa6b4, 0xbfff,
1029 0xa6b5, 0x2000, 0x7e5a, 0x681c, 0xa084, 0xffbf, 0x681e, 0x1078,
1030 0x4633, 0x1078, 0x48f7, 0x0078, 0x3854, 0xa684, 0x2000, 0x0040,
1031 0x2fd0, 0x6818, 0xa084, 0x8000, 0x0040, 0x2fe8, 0x681b, 0x0007,
1032 0x781b, 0x00d2, 0x0078, 0x2438, 0x6820, 0xa085, 0x0004, 0x6822,
1033 0x1078, 0x381f, 0xa6b5, 0x0800, 0x1078, 0x368f, 0x782b, 0x3008,
1034 0x781b, 0x0065, 0x0078, 0x2438, 0x2300, 0x0079, 0x2fff, 0x3002,
1035 0x3004, 0x3006, 0x1078, 0x23ca, 0x0078, 0x367b, 0xa684, 0x0400,
1036 0x00c0, 0x302f, 0x79e4, 0xa184, 0x0020, 0x0040, 0x3016, 0x78ec,
1037 0xa084, 0x0003, 0x0040, 0x3016, 0x782b, 0x3009, 0x789b, 0x0060,
1038 0x78ab, 0x0000, 0xa684, 0xfffb, 0x785a, 0x79e4, 0xa184, 0x0020,
1039 0x0040, 0x3027, 0x78ec, 0xa084, 0x0003, 0x00c0, 0x302b, 0x2001,
1040 0x0014, 0x0078, 0x2cd7, 0xa184, 0x0007, 0x0079, 0x3067, 0x7a90,
1041 0xa294, 0x0007, 0x789b, 0x0060, 0x79a8, 0x81ff, 0x0040, 0x3065,
1042 0x789b, 0x0010, 0x7ba8, 0xa384, 0x0001, 0x00c0, 0x3056, 0x7ba8,
1043 0x7ba8, 0xa386, 0x0001, 0x00c0, 0x3049, 0x2009, 0xfff7, 0x0078,
1044 0x304f, 0xa386, 0x0003, 0x00c0, 0x3056, 0x2009, 0xffef, 0x0c7e,
1045 0x7054, 0x2060, 0x6004, 0xa104, 0x6006, 0x0c7f, 0x789b, 0x0060,
1046 0x78ab, 0x0000, 0xa684, 0xfffb, 0x785a, 0x782b, 0x3009, 0x6920,
1047 0xa18c, 0xfdff, 0xa18c, 0xfeff, 0x6922, 0x0078, 0x3854, 0x297d,
1048 0x2988, 0x3071, 0x3079, 0x306f, 0x306f, 0x3854, 0x3854, 0x1078,
1049 0x23ca, 0x6920, 0xa18c, 0xfdff, 0xa18c, 0xfeff, 0x6922, 0x0078,
1050 0x385e, 0x6920, 0xa18c, 0xfdff, 0xa18c, 0xfeff, 0x6922, 0x0078,
1051 0x3854, 0x79e4, 0xa184, 0x0030, 0x0040, 0x308b, 0x78ec, 0xa084,
1052 0x0003, 0x00c0, 0x30b2, 0x7000, 0xa086, 0x0004, 0x00c0, 0x30a5,
1053 0x706c, 0xa086, 0x0002, 0x00c0, 0x309b, 0x2011, 0x0002, 0x2019,
1054 0x0000, 0x0078, 0x2827, 0x706c, 0xa086, 0x0006, 0x0040, 0x3095,
1055 0x706c, 0xa086, 0x0004, 0x0040, 0x3095, 0x7000, 0xa086, 0x0000,
1056 0x0040, 0x2438, 0x6818, 0xa085, 0x8000, 0x681a, 0x2001, 0x0014,
1057 0x0078, 0x2cd7, 0xa184, 0x0007, 0x0079, 0x30b6, 0x3854, 0x3854,
1058 0x30be, 0x3854, 0x38b9, 0x38b9, 0x3854, 0x3854, 0xa684, 0x0080,
1059 0x0040, 0x30ed, 0x7194, 0x81ff, 0x0040, 0x30ed, 0xa182, 0x000d,
1060 0x00d0, 0x30ce, 0x7097, 0x0000, 0x0078, 0x30d3, 0xa182, 0x000c,
1061 0x7096, 0x2009, 0x000c, 0x789b, 0x0061, 0x79aa, 0x157e, 0x137e,
1062 0x147e, 0x7098, 0x8114, 0xa210, 0x729a, 0xa080, 0x000b, 0xad00,
1063 0x2098, 0x20a1, 0x012b, 0x789b, 0x0000, 0x8108, 0x81ac, 0x53a6,
1064 0x147f, 0x137f, 0x157f, 0x0078, 0x385e, 0xa684, 0x0400, 0x00c0,
1065 0x312e, 0x6820, 0xa084, 0x0001, 0x0040, 0x385e, 0xa68c, 0x0060,
1066 0xa684, 0x0060, 0x0040, 0x3102, 0xa086, 0x0060, 0x00c0, 0x3102,
1067 0xa18d, 0x4000, 0xa18c, 0xfffb, 0x795a, 0x69b6, 0x789b, 0x0060,
1068 0x78ab, 0x0000, 0x789b, 0x0061, 0x6818, 0xa085, 0x8000, 0x681a,
1069 0x78aa, 0x8008, 0x810c, 0x0040, 0x33dd, 0xa18c, 0x00f8, 0x00c0,
1070 0x33dd, 0x157e, 0x137e, 0x147e, 0x20a1, 0x012b, 0x789b, 0x0000,
1071 0x8000, 0x80ac, 0xad80, 0x000b, 0x2098, 0x53a6, 0x147f, 0x137f,
1072 0x157f, 0x6814, 0x8007, 0x7882, 0x0078, 0x385e, 0x6818, 0xa084,
1073 0x8000, 0x0040, 0x3135, 0x681b, 0x0008, 0x781b, 0x00c8, 0x0078,
1074 0x2438, 0x2300, 0x0079, 0x313c, 0x3141, 0x31e0, 0x313f, 0x1078,
1075 0x23ca, 0x7000, 0xa084, 0x0007, 0x0079, 0x3146, 0x2461, 0x3150,
1076 0x3185, 0x315b, 0x314e, 0x2461, 0x314e, 0x314e, 0x1078, 0x23ca,
1077 0x681c, 0xa084, 0x2000, 0x0040, 0x3169, 0x6008, 0xa085, 0x0002,
1078 0x600a, 0x0078, 0x3169, 0x68c0, 0xa005, 0x00c0, 0x3185, 0x6920,
1079 0xa18d, 0x0001, 0x6922, 0x68c3, 0x0001, 0x6800, 0x706a, 0x0078,
1080 0x317f, 0x6920, 0xa18d, 0x0001, 0x6922, 0x6800, 0x6006, 0xa005,
1081 0x00c0, 0x3173, 0x6002, 0x681c, 0xa084, 0x000e, 0x0040, 0x317f,
1082 0x7014, 0x68ba, 0x7130, 0xa188, 0x7300, 0x0078, 0x3181, 0x2009,
1083 0x7400, 0x2104, 0x6802, 0x2d0a, 0x7162, 0x6eb6, 0xa684, 0x0060,
1084 0x0040, 0x31de, 0xa684, 0x0800, 0x00c0, 0x3199, 0xa684, 0x7fff,
1085 0x68b6, 0x6894, 0x68a6, 0x6898, 0x68aa, 0x1078, 0x4633, 0x0078,
1086 0x31de, 0xa684, 0x0020, 0x0040, 0x31ae, 0x68c0, 0xa005, 0x0040,
1087 0x31a5, 0x1078, 0x4a35, 0x0078, 0x31a8, 0xa006, 0x1078, 0x49ed,
1088 0x79d8, 0x7adc, 0x69aa, 0x6aa6, 0x0078, 0x31b4, 0x1078, 0x37ca,
1089 0x69aa, 0x6aa6, 0x1078, 0x49ed, 0xa684, 0x8000, 0x0040, 0x31de,
1090 0xa684, 0x7fff, 0x68b6, 0x2001, 0x0076, 0x1078, 0x38e4, 0x2010,
1091 0x2001, 0x0078, 0x1078, 0x38e4, 0x2008, 0xa684, 0x0020, 0x00c0,
1092 0x31d6, 0x2001, 0x007a, 0x1078, 0x38e4, 0x801b, 0x00c8, 0x31d1,
1093 0x8000, 0xa084, 0x003f, 0xa108, 0xa291, 0x0000, 0x6b98, 0x2100,
1094 0xa302, 0x68b2, 0x6b94, 0x2200, 0xa303, 0x68ae, 0x0078, 0x2461,
1095 0x0078, 0x367b, 0x7037, 0x0000, 0xa282, 0x0006, 0x0050, 0x31ea,
1096 0x1078, 0x23ca, 0x7000, 0xa084, 0x0007, 0x10c0, 0x398a, 0x2300,
1097 0x0079, 0x31f2, 0x31f5, 0x321e, 0x3232, 0x2200, 0x0079, 0x31f8,
1098 0x321c, 0x367b, 0x31fe, 0x321c, 0x324e, 0x3290, 0x7003, 0x0005,
1099 0x2001, 0x7510, 0x2068, 0x704a, 0x157e, 0x20a9, 0x0031, 0x2003,
1100 0x0000, 0x8000, 0x0070, 0x320e, 0x0078, 0x3207, 0x157f, 0xad80,
1101 0x0009, 0x7036, 0x6817, 0x0000, 0x68b7, 0x0700, 0x6823, 0x0800,
1102 0x6827, 0x0003, 0x0078, 0x366b, 0x1078, 0x23ca, 0x7003, 0x0005,
1103 0x2001, 0x7510, 0x2068, 0x704a, 0xad80, 0x0009, 0x7036, 0x2200,
1104 0x0079, 0x322a, 0x367b, 0x3230, 0x3230, 0x324e, 0x3230, 0x367b,
1105 0x1078, 0x23ca, 0x7003, 0x0005, 0x2001, 0x7510, 0x2068, 0x704a,
1106 0xad80, 0x0009, 0x7036, 0x2200, 0x0079, 0x323e, 0x3246, 0x3244,
1107 0x3244, 0x3246, 0x3244, 0x3246, 0x1078, 0x23ca, 0x1078, 0x369f,
1108 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x7003, 0x0002,
1109 0x7a80, 0xa294, 0x0f00, 0x789b, 0x0018, 0x7ca8, 0xa484, 0x001f,
1110 0xa215, 0x2069, 0x7400, 0x2d04, 0x2d08, 0x7162, 0x2068, 0xa005,
1111 0x0040, 0x3269, 0x6814, 0xa206, 0x0040, 0x3285, 0x6800, 0x0078,
1112 0x325c, 0x7003, 0x0005, 0x2001, 0x7510, 0x2068, 0x704a, 0x7036,
1113 0x157e, 0x20a9, 0x0031, 0x2003, 0x0000, 0x8000, 0x0070, 0x327a,
1114 0x0078, 0x3273, 0x157f, 0xad80, 0x0009, 0x7036, 0x6a16, 0x68b7,
1115 0x0700, 0x6823, 0x0800, 0x6827, 0x0003, 0x6eb4, 0x7e5a, 0x6820,
1116 0xa084, 0x0c00, 0x0040, 0x32df, 0x1078, 0x3697, 0x0078, 0x32df,
1117 0x7003, 0x0002, 0x7a80, 0xa294, 0x0f00, 0x789b, 0x0018, 0x7ca8,
1118 0xa484, 0x001f, 0xa215, 0x79a8, 0x79a8, 0xa18c, 0x00ff, 0xa1e8,
1119 0x7300, 0x2d04, 0x2d08, 0x7162, 0x2068, 0xa005, 0x0040, 0x32af,
1120 0x6814, 0xa206, 0x0040, 0x32ca, 0x6800, 0x0078, 0x32a2, 0x7003,
1121 0x0005, 0x2001, 0x7510, 0x2068, 0x704a, 0x157e, 0x20a9, 0x0031,
1122 0x2003, 0x0000, 0x8000, 0x0070, 0x32bf, 0x0078, 0x32b8, 0x157f,
1123 0xad80, 0x0009, 0x7036, 0x6a16, 0x68b7, 0x0700, 0x6823, 0x0800,
1124 0x6827, 0x0003, 0x6eb4, 0x7e5a, 0x6820, 0xa084, 0x0c00, 0x0040,
1125 0x32df, 0xa084, 0x0800, 0x0040, 0x32d9, 0x1078, 0x369b, 0x0078,
1126 0x32df, 0x1078, 0x3697, 0x708b, 0x0000, 0x0078, 0x32df, 0x027e,
1127 0x8207, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa080, 0x5280,
1128 0x2060, 0x7056, 0x6000, 0x705a, 0x6004, 0x705e, 0xa684, 0x0060,
1129 0x0040, 0x3337, 0x6b98, 0x6c94, 0x69ac, 0x68b0, 0xa105, 0x00c0,
1130 0x3319, 0x7bd2, 0x7bda, 0x7cd6, 0x7cde, 0xa6b4, 0xb7ff, 0x7e5a,
1131 0xa684, 0x0060, 0xa086, 0x0060, 0x0040, 0x3337, 0x68c0, 0xa005,
1132 0x0040, 0x3312, 0x7003, 0x0003, 0x682b, 0x0000, 0x1078, 0x48e6,
1133 0x0078, 0x3314, 0x1078, 0x48f7, 0xa6b5, 0x2000, 0x7e5a, 0x0078,
1134 0x3337, 0x68b0, 0xa31a, 0x2100, 0xa423, 0x2400, 0xa305, 0x0040,
1135 0x3337, 0x7bd2, 0x7bda, 0x7cd6, 0x7cde, 0x68b0, 0xa6b4, 0xbfff,
1136 0x7e5a, 0x007e, 0x68c0, 0xa005, 0x007f, 0x0040, 0x3335, 0x7003,
1137 0x0003, 0x1078, 0x48e6, 0x0078, 0x3337, 0x1078, 0x4942, 0x077f,
1138 0x1078, 0x37bd, 0x2009, 0x0065, 0xa684, 0x0004, 0x0040, 0x3358,
1139 0x78e4, 0xa084, 0x0030, 0x0040, 0x3350, 0x78ec, 0xa084, 0x0003,
1140 0x0040, 0x3350, 0x782b, 0x3008, 0x2009, 0x0065, 0x0078, 0x3358,
1141 0x0f7e, 0x2079, 0x5000, 0x1078, 0x4633, 0x0f7f, 0x0040, 0x2461,
1142 0x791a, 0x2d00, 0x704a, 0x8207, 0xa084, 0x000f, 0x8003, 0x8003,
1143 0x8003, 0xa080, 0x5280, 0x2048, 0x0078, 0x2438, 0x6020, 0xa005,
1144 0x0040, 0x3372, 0x8001, 0x6022, 0x6008, 0xa085, 0x0008, 0x600a,
1145 0x7010, 0x6026, 0x007c, 0xa006, 0x1078, 0x4633, 0x6817, 0x0000,
1146 0x681b, 0x0001, 0x6823, 0x0040, 0x681f, 0x0100, 0x7000, 0xa084,
1147 0x0007, 0x0079, 0x3383, 0x2461, 0x338d, 0x338d, 0x33aa, 0x3395,
1148 0x3393, 0x3395, 0x338b, 0x1078, 0x23ca, 0x1078, 0x33b5, 0x1078,
1149 0x33ae, 0x1078, 0x1c53, 0x0078, 0x2461, 0x706c, 0x706f, 0x0000,
1150 0x7093, 0x0000, 0x0079, 0x339c, 0x33a6, 0x33a6, 0x33a4, 0x33a4,
1151 0x33a4, 0x33a6, 0x33a4, 0x33a6, 0x0079, 0x2840, 0x706f, 0x0000,
1152 0x0078, 0x2461, 0x681b, 0x0000, 0x0078, 0x2eed, 0x6800, 0xa005,
1153 0x00c0, 0x33b3, 0x6002, 0x6006, 0x007c, 0x6010, 0xa005, 0x0040,
1154 0x33be, 0x8001, 0x00d0, 0x33be, 0x1078, 0x23ca, 0x6012, 0x6008,
1155 0xa084, 0xffef, 0x600a, 0x007c, 0x6018, 0xa005, 0x0040, 0x33ca,
1156 0x8001, 0x601a, 0x007c, 0x1078, 0x38de, 0x681b, 0x0018, 0x0078,
1157 0x3401, 0x1078, 0x38de, 0x681b, 0x0019, 0x0078, 0x3401, 0x1078,
1158 0x38de, 0x681b, 0x001a, 0x0078, 0x3401, 0x1078, 0x38de, 0x681b,
1159 0x0003, 0x0078, 0x3401, 0x7780, 0x1078, 0x37bd, 0x7184, 0xa18c,
1160 0x00ff, 0xa1e8, 0x7300, 0x2d04, 0x2d08, 0x2068, 0xa005, 0x00c0,
1161 0x33f3, 0x0078, 0x2461, 0x6814, 0x7280, 0xa206, 0x0040, 0x33fb,
1162 0x6800, 0x0078, 0x33ec, 0x6800, 0x200a, 0x681b, 0x0005, 0x708b,
1163 0x0000, 0x1078, 0x33b5, 0x6820, 0xa084, 0x0001, 0x00c0, 0x340a,
1164 0x1078, 0x33ae, 0x1078, 0x33c4, 0x681f, 0x0000, 0x6823, 0x0020,
1165 0x1078, 0x1c53, 0x0078, 0x2461, 0xa282, 0x0003, 0x00c0, 0x366b,
1166 0x7da8, 0xa5ac, 0x00ff, 0x7ca8, 0xa4a4, 0x00ff, 0x6920, 0xa18d,
1167 0x0080, 0x6922, 0xa184, 0x0100, 0x0040, 0x3478, 0xa18c, 0xfeff,
1168 0x6922, 0xa4a4, 0x00ff, 0x0040, 0x3462, 0xa482, 0x000c, 0x0048,
1169 0x3435, 0x0040, 0x3435, 0x2021, 0x000c, 0x852b, 0x852b, 0x1078,
1170 0x372e, 0x0040, 0x343f, 0x1078, 0x3531, 0x0078, 0x346b, 0x1078,
1171 0x36e9, 0x0c7e, 0x2960, 0x6004, 0xa084, 0xfff5, 0x6006, 0x1078,
1172 0x3558, 0x0c7f, 0x6920, 0xa18d, 0x0100, 0x6922, 0x7e58, 0xa6b5,
1173 0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x345c, 0x782b, 0x3008,
1174 0x781b, 0x0056, 0x0078, 0x2438, 0x782b, 0x3008, 0x781b, 0x0065,
1175 0x0078, 0x2438, 0x0c7e, 0x2960, 0x6004, 0xa084, 0xfff5, 0x6006,
1176 0x1078, 0x3558, 0x0c7f, 0x7e58, 0xa684, 0x0400, 0x00c0, 0x3474,
1177 0x781b, 0x0058, 0x0078, 0x2438, 0x781b, 0x0065, 0x0078, 0x2438,
1178 0x0c7e, 0x7054, 0x2060, 0x6100, 0xa18c, 0x1000, 0x0040, 0x34b8,
1179 0x6208, 0x8217, 0xa294, 0x00ff, 0xa282, 0x000c, 0x0048, 0x348c,
1180 0x0040, 0x348c, 0x2011, 0x000c, 0x2400, 0xa202, 0x00c8, 0x3491,
1181 0x2220, 0x6208, 0xa294, 0x00ff, 0x7018, 0xa086, 0x0028, 0x00c0,
1182 0x34a1, 0xa282, 0x0019, 0x00c8, 0x34a7, 0x2011, 0x0019, 0x0078,
1183 0x34a7, 0xa282, 0x000c, 0x00c8, 0x34a7, 0x2011, 0x000c, 0x2200,
1184 0xa502, 0x00c8, 0x34ac, 0x2228, 0x1078, 0x36ed, 0x852b, 0x852b,
1185 0x1078, 0x372e, 0x0040, 0x34b8, 0x1078, 0x3531, 0x0078, 0x34bc,
1186 0x1078, 0x36e9, 0x1078, 0x3558, 0x7858, 0xa085, 0x0004, 0x785a,
1187 0x0c7f, 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x0c7e,
1188 0x2960, 0x6000, 0xa084, 0x1000, 0x00c0, 0x34df, 0x6010, 0xa084,
1189 0x000f, 0x00c0, 0x34d9, 0x6104, 0xa18c, 0xfff5, 0x6106, 0x0c7f,
1190 0x007c, 0x2011, 0x0032, 0x2019, 0x0000, 0x0078, 0x3506, 0x68a0,
1191 0xa084, 0x0200, 0x00c0, 0x34d9, 0x6208, 0xa294, 0x00ff, 0x7018,
1192 0xa086, 0x0028, 0x00c0, 0x34f4, 0xa282, 0x0019, 0x00c8, 0x34fa,
1193 0x2011, 0x0019, 0x0078, 0x34fa, 0xa282, 0x000c, 0x00c8, 0x34fa,
1194 0x2011, 0x000c, 0x6308, 0x831f, 0xa39c, 0x00ff, 0xa382, 0x000c,
1195 0x0048, 0x3506, 0x0040, 0x3506, 0x2019, 0x000c, 0x78ab, 0x0001,
1196 0x78ab, 0x0003, 0x78ab, 0x0001, 0x7aaa, 0x7baa, 0xa8c0, 0x0005,
1197 0x6820, 0xa085, 0x0100, 0x6822, 0x0c7f, 0x007c, 0x0c7e, 0x2960,
1198 0xa18c, 0xfff5, 0x6106, 0x2011, 0x0032, 0x2019, 0x0000, 0x0078,
1199 0x3521, 0x78ab, 0x0001, 0x78ab, 0x0003, 0x78ab, 0x0001, 0x7aaa,
1200 0x7baa, 0xa8c0, 0x0005, 0x6820, 0xa085, 0x0100, 0x6822, 0x0c7f,
1201 0x007c, 0x0c7e, 0x7154, 0x2160, 0x1078, 0x3538, 0x0c7f, 0x007c,
1202 0x2008, 0xa084, 0xfff0, 0xa425, 0x7c86, 0x6018, 0x789a, 0x7cae,
1203 0x6412, 0x78a4, 0xa084, 0xfff8, 0xa18c, 0x0007, 0xa105, 0x78a6,
1204 0x6016, 0x788a, 0xa4a4, 0x000f, 0x8427, 0x8204, 0x8004, 0xa084,
1205 0x00ff, 0xa405, 0x600e, 0x6004, 0xa084, 0xfff5, 0x6006, 0x007c,
1206 0x0c7e, 0x7054, 0x2060, 0x1078, 0x355f, 0x0c7f, 0x007c, 0x6018,
1207 0x789a, 0x78a4, 0xa084, 0xfff0, 0x78a6, 0x6012, 0x7884, 0xa084,
1208 0xfff0, 0x7886, 0x007c, 0xa282, 0x0002, 0x00c0, 0x366b, 0x7aa8,
1209 0x6920, 0xa18d, 0x0080, 0x6922, 0xa184, 0x0200, 0x0040, 0x35b4,
1210 0xa18c, 0xfdff, 0x6922, 0xa294, 0x00ff, 0xa282, 0x0002, 0x00c8,
1211 0x366b, 0x1078, 0x35fd, 0x1078, 0x3558, 0xa980, 0x0001, 0x200c,
1212 0x1078, 0x37b9, 0x1078, 0x34c7, 0x88ff, 0x0040, 0x35a7, 0x789b,
1213 0x0060, 0x2800, 0x78aa, 0x7e58, 0xa6b5, 0x0004, 0x7e5a, 0xa684,
1214 0x0400, 0x00c0, 0x35a1, 0x782b, 0x3008, 0x781b, 0x0056, 0x0078,
1215 0x2438, 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x7e58,
1216 0xa684, 0x0400, 0x00c0, 0x35b0, 0x781b, 0x0058, 0x0078, 0x2438,
1217 0x781b, 0x0065, 0x0078, 0x2438, 0xa282, 0x0002, 0x00c8, 0x35bc,
1218 0xa284, 0x0001, 0x0040, 0x35c6, 0x7154, 0xa188, 0x0000, 0x210c,
1219 0xa18c, 0x2000, 0x00c0, 0x35c6, 0x2011, 0x0000, 0x1078, 0x36db,
1220 0x1078, 0x35fd, 0x1078, 0x3558, 0x7858, 0xa085, 0x0004, 0x785a,
1221 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x0c7e, 0x027e,
1222 0x2960, 0x6000, 0x2011, 0x0001, 0xa084, 0x2000, 0x00c0, 0x35ed,
1223 0x6014, 0xa084, 0x0040, 0x00c0, 0x35eb, 0xa18c, 0xffef, 0x6106,
1224 0xa006, 0x0078, 0x35fa, 0x2011, 0x0000, 0x78ab, 0x0001, 0x78ab,
1225 0x0002, 0x78ab, 0x0003, 0x7aaa, 0xa8c0, 0x0004, 0x6820, 0xa085,
1226 0x0200, 0x6822, 0x027f, 0x0c7f, 0x007c, 0x0c7e, 0x7054, 0x2060,
1227 0x1078, 0x3604, 0x0c7f, 0x007c, 0x82ff, 0x0040, 0x3609, 0x2011,
1228 0x0040, 0x6018, 0xa080, 0x0002, 0x789a, 0x78a4, 0xa084, 0xffbf,
1229 0xa205, 0x78a6, 0x788a, 0x6016, 0x6004, 0xa084, 0xffef, 0x6006,
1230 0x007c, 0x007e, 0x7000, 0xa086, 0x0003, 0x0040, 0x3622, 0x007f,
1231 0x0078, 0x3625, 0x007f, 0x0078, 0x3667, 0xa684, 0x0020, 0x0040,
1232 0x3667, 0x7888, 0xa084, 0x0040, 0x0040, 0x3667, 0x7bb8, 0xa384,
1233 0x003f, 0x831b, 0x00c8, 0x3635, 0x8000, 0xa005, 0x0040, 0x364b,
1234 0x831b, 0x00c8, 0x363e, 0x8001, 0x0040, 0x3663, 0xa684, 0x4000,
1235 0x0040, 0x364b, 0x78b8, 0x801b, 0x00c8, 0x3647, 0x8000, 0xa084,
1236 0x003f, 0x00c0, 0x3663, 0xa6b4, 0xbfff, 0x7e5a, 0x79d8, 0x7adc,
1237 0x2001, 0x0001, 0xa108, 0x00c8, 0x3657, 0xa291, 0x0000, 0x79d2,
1238 0x79da, 0x7ad6, 0x7ade, 0x1078, 0x49ed, 0x781b, 0x0064, 0x1078,
1239 0x4872, 0x0078, 0x2438, 0x781b, 0x0064, 0x0078, 0x2438, 0x781b,
1240 0x0065, 0x0078, 0x2438, 0x1078, 0x36a3, 0x782b, 0x3008, 0x781b,
1241 0x0065, 0x0078, 0x2438, 0x1078, 0x368f, 0x782b, 0x3008, 0x781b,
1242 0x0065, 0x0078, 0x2438, 0x6827, 0x0002, 0x1078, 0x3697, 0x78e4,
1243 0xa084, 0x0030, 0x0040, 0x2461, 0x78ec, 0xa084, 0x0003, 0x0040,
1244 0x2461, 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x2001,
1245 0x0005, 0x0078, 0x36a5, 0x2001, 0x000c, 0x0078, 0x36a5, 0x2001,
1246 0x0006, 0x0078, 0x36a5, 0x2001, 0x000d, 0x0078, 0x36a5, 0x2001,
1247 0x0009, 0x0078, 0x36a5, 0x2001, 0x0007, 0x789b, 0x0010, 0x78aa,
1248 0x789b, 0x0060, 0x78ab, 0x0001, 0xa6b5, 0x0004, 0x7e5a, 0x007c,
1249 0x077e, 0x873f, 0xa7bc, 0x000f, 0x873b, 0x873b, 0x8703, 0xa0e0,
1250 0x5280, 0xa7b8, 0x0020, 0x7f9a, 0x79a4, 0xa184, 0x000f, 0x0040,
1251 0x36c9, 0xa184, 0xfff0, 0x78a6, 0x6012, 0x6004, 0xa085, 0x0008,
1252 0x6006, 0x8738, 0x8738, 0x7f9a, 0x79a4, 0xa184, 0x0040, 0x0040,
1253 0x36d9, 0xa184, 0xffbf, 0x78a6, 0x6016, 0x6004, 0xa085, 0x0010,
1254 0x6006, 0x077f, 0x007c, 0x789b, 0x0010, 0x78ab, 0x0001, 0x78ab,
1255 0x0002, 0x78ab, 0x0003, 0x7aaa, 0x789b, 0x0060, 0x78ab, 0x0004,
1256 0x007c, 0x2021, 0x0000, 0x2029, 0x0032, 0x789b, 0x0010, 0x78ab,
1257 0x0001, 0x78ab, 0x0003, 0x78ab, 0x0001, 0x7daa, 0x7caa, 0x789b,
1258 0x0060, 0x78ab, 0x0005, 0x007c, 0x157e, 0x8007, 0xa084, 0x00ff,
1259 0x8003, 0x8003, 0xa080, 0x0020, 0x789a, 0x79a4, 0xa18c, 0xfff0,
1260 0x2001, 0x5046, 0x2004, 0xa082, 0x0028, 0x0040, 0x3717, 0x2021,
1261 0x37a0, 0x2019, 0x0014, 0x20a9, 0x000c, 0x0078, 0x371d, 0x2021,
1262 0x37ac, 0x2019, 0x0019, 0x20a9, 0x000d, 0x2011, 0x0064, 0x2404,
1263 0xa084, 0xfff0, 0xa106, 0x0040, 0x372c, 0x8420, 0x2300, 0xa210,
1264 0x0070, 0x372c, 0x0078, 0x371f, 0x157f, 0x007c, 0x157e, 0x2009,
1265 0x5046, 0x210c, 0xa182, 0x0032, 0x0048, 0x3742, 0x0040, 0x3746,
1266 0x2009, 0x3792, 0x2019, 0x0011, 0x20a9, 0x000e, 0x2011, 0x0032,
1267 0x0078, 0x3758, 0xa182, 0x0028, 0x0040, 0x3750, 0x2009, 0x37a0,
1268 0x2019, 0x0014, 0x20a9, 0x000c, 0x2011, 0x0064, 0x0078, 0x3758,
1269 0x2009, 0x37ac, 0x2019, 0x0019, 0x20a9, 0x000d, 0x2011, 0x0064,
1270 0x2200, 0xa502, 0x0040, 0x3768, 0x0048, 0x3768, 0x8108, 0x2300,
1271 0xa210, 0x0070, 0x3765, 0x0078, 0x3758, 0x157f, 0xa006, 0x007c,
1272 0x157f, 0xa582, 0x0064, 0x00c8, 0x3777, 0x7808, 0xa085, 0x0070,
1273 0x780a, 0x7044, 0xa085, 0x0070, 0x7046, 0x0078, 0x3777, 0x78ec,
1274 0xa084, 0x0300, 0x0040, 0x377f, 0x2104, 0x0078, 0x3790, 0x2104,
1275 0xa09e, 0x1102, 0x00c0, 0x3790, 0x2001, 0x04fd, 0x2004, 0xa082,
1276 0x0005, 0x0048, 0x378f, 0x2001, 0x1201, 0x0078, 0x3790, 0x2104,
1277 0xa005, 0x007c, 0x1102, 0x3002, 0x3202, 0x4203, 0x4403, 0x5404,
1278 0x5604, 0x6605, 0x6805, 0x7806, 0x7a06, 0x0c07, 0x0c07, 0x0e07,
1279 0x3202, 0x4202, 0x5202, 0x6202, 0x7202, 0x6605, 0x7605, 0x7805,
1280 0x7a05, 0x7c05, 0x7e05, 0x7f05, 0x2202, 0x3202, 0x4202, 0x5202,
1281 0x5404, 0x6404, 0x7404, 0x7604, 0x7804, 0x7a04, 0x7c04, 0x7e04,
1282 0x7f04, 0x789b, 0x0010, 0xa046, 0x007c, 0xa784, 0x0f00, 0x800b,
1283 0xa784, 0x001f, 0x8003, 0x8003, 0x8003, 0x8003, 0xa105, 0xa0e0,
1284 0x5300, 0x007c, 0x79d8, 0x7adc, 0x78d0, 0x801b, 0x00c8, 0x37d1,
1285 0x8000, 0xa084, 0x003f, 0xa108, 0xa291, 0x0000, 0x007c, 0x0f7e,
1286 0x2079, 0x0100, 0x2009, 0x5040, 0x2091, 0x8000, 0x2104, 0x0079,
1287 0x37e1, 0x3817, 0x37eb, 0x37eb, 0x37eb, 0x37eb, 0x37eb, 0x37eb,
1288 0x381b, 0x1078, 0x23ca, 0x784b, 0x0004, 0x7848, 0xa084, 0x0004,
1289 0x00c0, 0x37ed, 0x784b, 0x0008, 0x7848, 0xa084, 0x0008, 0x00c0,
1290 0x37f4, 0x68b4, 0xa085, 0x4000, 0x68b6, 0x7858, 0xa085, 0x4000,
1291 0x785a, 0x7830, 0xa084, 0x0080, 0x00c0, 0x3817, 0x0018, 0x3817,
1292 0x681c, 0xa084, 0x0020, 0x00c0, 0x3815, 0x0e7e, 0x2071, 0x5040,
1293 0x1078, 0x3868, 0x0e7f, 0x0078, 0x3817, 0x781b, 0x00d2, 0x2091,
1294 0x8001, 0x0f7f, 0x007c, 0x1078, 0x3a42, 0x0078, 0x3817, 0x0c7e,
1295 0x6814, 0x8007, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0e0,
1296 0x5280, 0x6004, 0xa084, 0x000a, 0x00c0, 0x3852, 0x6108, 0xa194,
1297 0xff00, 0x0040, 0x3852, 0xa18c, 0x00ff, 0x2001, 0x0019, 0xa106,
1298 0x0040, 0x3841, 0x2001, 0x0032, 0xa106, 0x0040, 0x3845, 0x0078,
1299 0x3849, 0x2009, 0x0020, 0x0078, 0x384b, 0x2009, 0x003f, 0x0078,
1300 0x384b, 0x2011, 0x0000, 0x2100, 0xa205, 0x600a, 0x6004, 0xa085,
1301 0x0002, 0x6006, 0x0c7f, 0x007c, 0x781b, 0x0065, 0x0078, 0x2438,
1302 0x782b, 0x3008, 0x781b, 0x0065, 0x0078, 0x2438, 0x781b, 0x0058,
1303 0x0078, 0x2438, 0x782b, 0x3008, 0x781b, 0x0056, 0x0078, 0x2438,
1304 0x2009, 0x5020, 0x210c, 0xa186, 0x0000, 0x0040, 0x387c, 0xa186,
1305 0x0001, 0x0040, 0x387f, 0x2009, 0x5038, 0x200b, 0x000b, 0x706f,
1306 0x0001, 0x781b, 0x0048, 0x007c, 0x781b, 0x00cc, 0x007c, 0x2009,
1307 0x5038, 0x200b, 0x000a, 0x007c, 0x2009, 0x5020, 0x210c, 0xa186,
1308 0x0000, 0x0040, 0x389f, 0xa186, 0x0001, 0x0040, 0x3899, 0x2009,
1309 0x5038, 0x200b, 0x000b, 0x706f, 0x0001, 0x781b, 0x0048, 0x0078,
1310 0x2438, 0x2009, 0x5038, 0x200b, 0x000a, 0x0078, 0x2438, 0x782b,
1311 0x3008, 0x781b, 0x00cc, 0x0078, 0x2438, 0x781b, 0x00d2, 0x0078,
1312 0x2438, 0x782b, 0x3008, 0x781b, 0x00d2, 0x0078, 0x2438, 0x781b,
1313 0x0093, 0x0078, 0x2438, 0x782b, 0x3008, 0x781b, 0x0093, 0x0078,
1314 0x2438, 0x6818, 0xa084, 0x8000, 0x0040, 0x38c0, 0x681b, 0x001d,
1315 0x706f, 0x0001, 0x781b, 0x0048, 0x0078, 0x2438, 0x007e, 0x7830,
1316 0xa084, 0x00c0, 0x00c0, 0x38dc, 0x7808, 0xa084, 0xfffc, 0x780a,
1317 0x0005, 0x0005, 0x0005, 0x0005, 0x78ec, 0xa084, 0x0021, 0x0040,
1318 0x38dc, 0x7044, 0x780a, 0xa005, 0x007f, 0x007c, 0x7044, 0xa085,
1319 0x0002, 0x7046, 0x780a, 0x007c, 0x007e, 0x7830, 0xa084, 0x0040,
1320 0x00c0, 0x38e5, 0x0098, 0x38f0, 0x007f, 0x789a, 0x78ac, 0x007c,
1321 0x7808, 0xa084, 0xfffd, 0x780a, 0x0005, 0x0005, 0x0005, 0x0005,
1322 0x78ec, 0xa084, 0x0021, 0x0040, 0x38ff, 0x0098, 0x38fd, 0x007f,
1323 0x789a, 0x78ac, 0x007e, 0x7044, 0x780a, 0x007f, 0x007c, 0x78ec,
1324 0xa084, 0x0002, 0x00c0, 0x461d, 0xa784, 0x007d, 0x00c0, 0x3913,
1325 0x2700, 0x1078, 0x23ca, 0xa784, 0x0001, 0x00c0, 0x2f43, 0xa784,
1326 0x0070, 0x0040, 0x3923, 0x0c7e, 0x2d60, 0x2f68, 0x1078, 0x2375,
1327 0x2d78, 0x2c68, 0x0c7f, 0xa784, 0x0008, 0x0040, 0x3930, 0x784b,
1328 0x0008, 0x78ec, 0xa084, 0x0003, 0x0040, 0x2461, 0x0078, 0x3854,
1329 0xa784, 0x0004, 0x0040, 0x3963, 0x78b8, 0xa084, 0x4001, 0x0040,
1330 0x3963, 0x784b, 0x0008, 0x78ec, 0xa084, 0x0003, 0x0040, 0x2461,
1331 0x78e4, 0xa084, 0x0007, 0xa086, 0x0001, 0x00c0, 0x3963, 0x78c0,
1332 0xa085, 0x4800, 0x2030, 0x7e5a, 0x781b, 0x00d2, 0x0078, 0x2438,
1333 0x784b, 0x0008, 0x6818, 0xa084, 0x8000, 0x0040, 0x395f, 0x681b,
1334 0x0015, 0xa684, 0x4000, 0x0040, 0x395f, 0x681b, 0x0007, 0x1078,
1335 0x3868, 0x0078, 0x2438, 0x681b, 0x0003, 0x7858, 0xa084, 0x3f00,
1336 0x681e, 0x682f, 0x0000, 0x6833, 0x0000, 0x784b, 0x0008, 0x78ec,
1337 0xa084, 0x0003, 0x0040, 0x2944, 0x0018, 0x2438, 0x0078, 0x3673,
1338 0x6b14, 0x8307, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa080,
1339 0x5280, 0x2060, 0x2048, 0x7056, 0x6000, 0x705a, 0x6004, 0x705e,
1340 0x2a60, 0x007c, 0x0079, 0x398c, 0x3994, 0x3995, 0x3994, 0x3997,
1341 0x3994, 0x3994, 0x3994, 0x399c, 0x007c, 0x1078, 0x33c4, 0x1078,
1342 0x4633, 0x7038, 0x600a, 0x007c, 0x70a0, 0xa005, 0x0040, 0x39a9,
1343 0x2068, 0x1078, 0x1b45, 0x1078, 0x45b5, 0x1078, 0x45bc, 0x70a3,
1344 0x0000, 0x007c, 0x0e7e, 0x2091, 0x8000, 0x2071, 0x5040, 0x7000,
1345 0xa086, 0x0007, 0x00c0, 0x39c0, 0x6110, 0x70bc, 0xa106, 0x00c0,
1346 0x39c0, 0x0e7f, 0x1078, 0x1b52, 0x1078, 0x39c6, 0xa006, 0x007c,
1347 0x2091, 0x8001, 0x0e7f, 0xa085, 0x0001, 0x007c, 0x0f7e, 0x0e7e,
1348 0x2071, 0x5040, 0x0078, 0x21d9, 0x785b, 0x0000, 0x70af, 0x000e,
1349 0x2009, 0x0100, 0x017e, 0x70a0, 0xa06d, 0x0040, 0x39db, 0x70a3,
1350 0x0000, 0x0078, 0x39e1, 0x70b3, 0x0000, 0x1078, 0x1b6e, 0x0040,
1351 0x39e7, 0x70ac, 0x6826, 0x1078, 0x3ac2, 0x0078, 0x39db, 0x017f,
1352 0x157e, 0x0c7e, 0x0d7e, 0x20a9, 0x0008, 0x2061, 0x7410, 0x6000,
1353 0xa105, 0x6002, 0x601c, 0xa06d, 0x0040, 0x39ff, 0x6800, 0x601e,
1354 0x1078, 0x193d, 0x6008, 0x8000, 0x600a, 0x0078, 0x39f2, 0x6018,
1355 0xa06d, 0x0040, 0x3a09, 0x6800, 0x601a, 0x1078, 0x193d, 0x0078,
1356 0x39ff, 0xace0, 0x0008, 0x0070, 0x3a0f, 0x0078, 0x39ef, 0x709c,
1357 0xa084, 0x8000, 0x0040, 0x3a16, 0x1078, 0x3b3c, 0x0d7f, 0x0c7f,
1358 0x157f, 0x007c, 0x127e, 0x2091, 0x2300, 0x6804, 0xa084, 0x000f,
1359 0x0079, 0x3a22, 0x3a32, 0x3a32, 0x3a32, 0x3a32, 0x3a32, 0x3a32,
1360 0x3a34, 0x3a3a, 0x3a32, 0x3a32, 0x3a32, 0x3a32, 0x3a32, 0x3a3c,
1361 0x3a32, 0x3a34, 0x1078, 0x23ca, 0x1078, 0x4466, 0x1078, 0x193d,
1362 0x0078, 0x3a40, 0x6827, 0x000b, 0x1078, 0x4466, 0x1078, 0x3ac2,
1363 0x127f, 0x007c, 0x127e, 0x2091, 0x2300, 0x0098, 0x3a5e, 0x7830,
1364 0xa084, 0x00c0, 0x00c0, 0x3a5e, 0x0d7e, 0x1078, 0x45c5, 0x2d00,
1365 0x682e, 0x2009, 0x0004, 0x2001, 0x0000, 0x6827, 0x0084, 0x1078,
1366 0x457e, 0x1078, 0x3ac2, 0x0d7f, 0x0078, 0x3a90, 0x7948, 0xa185,
1367 0x4000, 0x784a, 0x0098, 0x3a67, 0x794a, 0x0078, 0x3a4c, 0x7828,
1368 0xa086, 0x1834, 0x00c0, 0x3a70, 0xa185, 0x0004, 0x0078, 0x3a77,
1369 0x7828, 0xa186, 0x1814, 0x00c0, 0x3a64, 0xa185, 0x000c, 0x784a,
1370 0x789b, 0x000e, 0x78ab, 0x0002, 0x7858, 0xa084, 0x00ff, 0xa085,
1371 0x0400, 0x785a, 0x70b4, 0xa080, 0x0091, 0x781a, 0x6827, 0x0002,
1372 0x6827, 0x0084, 0x2009, 0x0004, 0x2001, 0x0000, 0x1078, 0x457e,
1373 0x127f, 0x007c, 0x0d7e, 0x6b14, 0x1078, 0x1be0, 0x0040, 0x3a9f,
1374 0x2068, 0x6827, 0x0002, 0x1078, 0x3ac2, 0x0078, 0x3a94, 0x0d7f,
1375 0x007c, 0x0d7e, 0x6b14, 0x6c28, 0xa4a4, 0x00ff, 0x1078, 0x1b7e,
1376 0x0040, 0x3aaf, 0x2068, 0x6827, 0x0002, 0x1078, 0x3ac2, 0x0d7f,
1377 0x007c, 0x0d7e, 0x6b14, 0xa39c, 0x00ff, 0x1078, 0x1bb1, 0x0040,
1378 0x3ac0, 0x2068, 0x6827, 0x0002, 0x1078, 0x3ac2, 0x0078, 0x3ab5,
1379 0x0d7f, 0x007c, 0x0c7e, 0x6914, 0x1078, 0x3b33, 0x6904, 0xa18c,
1380 0x00ff, 0xa186, 0x0006, 0x0040, 0x3add, 0xa186, 0x000d, 0x0040,
1381 0x3afc, 0xa186, 0x0017, 0x00c0, 0x3ad9, 0x1078, 0x193d, 0x0078,
1382 0x3adb, 0x1078, 0x1c55, 0x0c7f, 0x007c, 0x6004, 0x8001, 0x0048,
1383 0x3afa, 0x6006, 0x2009, 0x0000, 0xa684, 0x0001, 0x00c0, 0x3aea,
1384 0xa18d, 0x8000, 0xa684, 0x0004, 0x0040, 0x3af0, 0xa18d, 0x0002,
1385 0x691e, 0x6823, 0x0000, 0x7104, 0x810f, 0x6818, 0xa105, 0x681a,
1386 0x0078, 0x3ad9, 0x1078, 0x23ca, 0x6018, 0xa005, 0x00c0, 0x3b0b,
1387 0x6008, 0x8001, 0x0048, 0x3b0b, 0x600a, 0x601c, 0x6802, 0x2d00,
1388 0x601e, 0x0078, 0x3b21, 0xac88, 0x0006, 0x2104, 0xa005, 0x0040,
1389 0x3b14, 0x2008, 0x0078, 0x3b0d, 0x6802, 0x2d0a, 0x6008, 0x8001,
1390 0x0048, 0x3adb, 0x600a, 0x6018, 0x2068, 0x6800, 0x601a, 0x0078,
1391 0x3b05, 0x157e, 0x137e, 0x147e, 0x0c7e, 0x0d7e, 0x1078, 0x191a,
1392 0x2da0, 0x137f, 0x20a9, 0x0031, 0x53a3, 0x0c7f, 0x147f, 0x137f,
1393 0x157f, 0x0078, 0x3ad9, 0xa184, 0x001f, 0x8003, 0x8003, 0x8003,
1394 0xa080, 0x7410, 0x2060, 0x007c, 0x2019, 0x5051, 0x2304, 0xa085,
1395 0x0001, 0x201a, 0x2019, 0x0102, 0x2304, 0xa085, 0x0001, 0x201a,
1396 0x007c, 0x2019, 0x5051, 0x2304, 0xa084, 0xfffe, 0x201a, 0x2019,
1397 0x0102, 0x2304, 0xa084, 0xfffe, 0x201a, 0x007c, 0x7990, 0xa18c,
1398 0xfff8, 0x7992, 0x70b4, 0xa080, 0x00d8, 0x781a, 0x0078, 0x2438,
1399 0x70a3, 0x0000, 0x7003, 0x0000, 0x7043, 0x0001, 0x7037, 0x0000,
1400 0x0018, 0x23ef, 0x1078, 0x1b6e, 0x0040, 0x3b91, 0x2009, 0x500f,
1401 0x200b, 0x0000, 0x68bc, 0x2060, 0x6100, 0xa184, 0x0300, 0x0040,
1402 0x3b85, 0x6827, 0x000e, 0xa084, 0x0200, 0x0040, 0x3b81, 0x6827,
1403 0x0017, 0x1078, 0x3ac2, 0x0078, 0x3b60, 0x7000, 0xa086, 0x0007,
1404 0x00c0, 0x3be3, 0x2d00, 0x70a2, 0xad80, 0x000f, 0x7036, 0x0078,
1405 0x3b98, 0x7040, 0xa086, 0x0001, 0x0040, 0x2471, 0x0078, 0x2438,
1406 0x2031, 0x0000, 0x691c, 0xa184, 0x0002, 0x0040, 0x3ba1, 0xa6b5,
1407 0x0004, 0xa184, 0x00c0, 0x8003, 0x8003, 0x8007, 0xa080, 0x3c72,
1408 0x2004, 0xa635, 0x6820, 0xa084, 0x0400, 0x0040, 0x3bb9, 0x789b,
1409 0x0018, 0x78ab, 0x0003, 0x789b, 0x0081, 0x78ab, 0x0001, 0xa6b5,
1410 0x1000, 0x6820, 0xa084, 0x8000, 0x0040, 0x3bc5, 0xa6b5, 0x0400,
1411 0x789b, 0x000e, 0x6824, 0x8007, 0x78aa, 0xa684, 0x0200, 0x0040,
1412 0x3bdf, 0x682c, 0x78d2, 0x6830, 0x78d6, 0xa684, 0x0100, 0x0040,
1413 0x3bdd, 0x682c, 0xa084, 0x0001, 0x0040, 0x3bdd, 0x7888, 0xa084,
1414 0x0040, 0x0040, 0x3bdd, 0xa6b5, 0x8000, 0x1078, 0x45ad, 0x7e5a,
1415 0x6eb6, 0x0078, 0x45e4, 0x1078, 0x38c6, 0x00c0, 0x3c6c, 0x702c,
1416 0x8004, 0x0048, 0x3bf1, 0x2019, 0x4cfd, 0x1078, 0x2255, 0x702f,
1417 0x0001, 0x2011, 0x0001, 0x2031, 0x1000, 0x789b, 0x0018, 0x6814,
1418 0xa084, 0x001f, 0xa085, 0x0080, 0x78aa, 0x691c, 0xa184, 0x0002,
1419 0x0040, 0x3c0a, 0xa6b5, 0x0004, 0x78ab, 0x0020, 0x6828, 0x78aa,
1420 0xa290, 0x0002, 0x6820, 0xa084, 0x8000, 0x0040, 0x3c18, 0xa6b5,
1421 0x0400, 0x789b, 0x000e, 0x6824, 0x8007, 0x78aa, 0x0078, 0x3c26,
1422 0x681c, 0xa084, 0x8000, 0x00c0, 0x3c26, 0xa6b5, 0x0800, 0x6820,
1423 0xa084, 0x0100, 0x0040, 0x3c26, 0xa6b5, 0x4000, 0x681c, 0xa084,
1424 0x00c0, 0x8003, 0x8003, 0x8007, 0xa080, 0x3c72, 0x2004, 0xa635,
1425 0xa684, 0x0100, 0x0040, 0x3c40, 0x682c, 0xa084, 0x0001, 0x0040,
1426 0x3c40, 0x7888, 0xa084, 0x0040, 0x0040, 0x3c40, 0xa6b5, 0x8000,
1427 0x789b, 0x007e, 0x7eae, 0x6eb6, 0x6814, 0x8007, 0x78aa, 0x7882,
1428 0x7aaa, 0x7830, 0xa084, 0x00c0, 0x00c0, 0x3c6c, 0x0018, 0x3c6c,
1429 0x70b4, 0xa080, 0x00dd, 0x781a, 0x1078, 0x38de, 0xa684, 0x0200,
1430 0x0040, 0x3c60, 0x682c, 0x78d2, 0x6830, 0x78d6, 0x1078, 0x45ad,
1431 0x2d00, 0x70a2, 0x704a, 0x6810, 0x70be, 0x7003, 0x0007, 0xad80,
1432 0x000f, 0x7036, 0x0078, 0x2438, 0x1078, 0x1b45, 0x1078, 0x38de,
1433 0x0078, 0x2438, 0x0000, 0x0300, 0x0200, 0x0000, 0x1078, 0x23ca,
1434 0x2300, 0x0079, 0x3c7b, 0x3c7e, 0x3c7e, 0x3c80, 0x1078, 0x23ca,
1435 0x1078, 0x45bc, 0x6924, 0xa184, 0x00ff, 0xa086, 0x000a, 0x0040,
1436 0x3c92, 0xa184, 0xff00, 0xa085, 0x000a, 0x6826, 0x1078, 0x1b45,
1437 0x0078, 0x3b60, 0x2001, 0x000a, 0x1078, 0x454c, 0x0078, 0x3b60,
1438 0xa282, 0x0005, 0x0050, 0x3c9e, 0x1078, 0x23ca, 0x7000, 0xa084,
1439 0x0007, 0x10c0, 0x398a, 0x1078, 0x191a, 0x00c0, 0x3cbd, 0xa684,
1440 0x0004, 0x0040, 0x3caf, 0x2001, 0x2800, 0x0078, 0x3cb1, 0x2001,
1441 0x0800, 0x71b4, 0xa188, 0x0091, 0x789b, 0x000e, 0x78aa, 0x2031,
1442 0x0400, 0x7e5a, 0x791a, 0x0078, 0x2438, 0x6807, 0x0106, 0x680b,
1443 0x0000, 0x689f, 0x0000, 0x6827, 0x0000, 0xa386, 0x0002, 0x00c0,
1444 0x3cde, 0xa286, 0x0002, 0x00c0, 0x3cde, 0x78a0, 0xa005, 0x00c0,
1445 0x3cde, 0xa484, 0x8000, 0x00c0, 0x3cde, 0x78e4, 0xa084, 0x0008,
1446 0x0040, 0x3cde, 0xa6b5, 0x0008, 0x2019, 0x0000, 0x1078, 0x40d3,
1447 0x2d00, 0x70a2, 0x704a, 0x7003, 0x0007, 0x7037, 0x0000, 0x6824,
1448 0xa084, 0x0080, 0x0040, 0x3cf0, 0x1078, 0x4180, 0x0078, 0x2438,
1449 0x2300, 0x0079, 0x3cf3, 0x3cf6, 0x3d77, 0x3d96, 0x2200, 0x0079,
1450 0x3cf9, 0x3cfe, 0x3d0e, 0x3d34, 0x3d40, 0x3d63, 0x2029, 0x0001,
1451 0xa026, 0x2011, 0x0000, 0x1078, 0x428d, 0x0079, 0x3d07, 0x3d0c,
1452 0x2438, 0x3b60, 0x3d0c, 0x3d0c, 0x1078, 0x23ca, 0x7990, 0xa18c,
1453 0x0007, 0x00c0, 0x3d15, 0x2009, 0x0008, 0x2011, 0x0001, 0xa684,
1454 0x0004, 0x0040, 0x3d1d, 0x2011, 0x0003, 0x2220, 0xa12a, 0x2011,
1455 0x0001, 0x1078, 0x428d, 0x0079, 0x3d25, 0x3d2a, 0x2438, 0x3b60,
1456 0x3d32, 0x3d2c, 0x0078, 0x45ea, 0x70ab, 0x3d30, 0x0078, 0x2438,
1457 0x0078, 0x3d2a, 0x1078, 0x23ca, 0xa684, 0x0010, 0x0040, 0x3d3e,
1458 0x1078, 0x414f, 0x0040, 0x3d3e, 0x0078, 0x2438, 0x0078, 0x41bc,
1459 0x6000, 0xa084, 0x0002, 0x0040, 0x3d5d, 0x70b4, 0xa080, 0x00cd,
1460 0x781a, 0x0d7e, 0x1078, 0x45c5, 0x2d00, 0x682e, 0x6827, 0x0000,
1461 0x1078, 0x3ac2, 0x0d7f, 0x1078, 0x193d, 0x7003, 0x0000, 0x7037,
1462 0x0000, 0x704b, 0x0000, 0x0078, 0x3b60, 0xa684, 0x0004, 0x00c0,
1463 0x3d63, 0x0078, 0x45ea, 0x6000, 0xa084, 0x0004, 0x00c0, 0x3d75,
1464 0x6000, 0xa084, 0x0001, 0x0040, 0x3d75, 0x70ab, 0x3d75, 0x2001,
1465 0x0007, 0x1078, 0x4544, 0x0078, 0x45f0, 0x0078, 0x45ea, 0x2200,
1466 0x0079, 0x3d7a, 0x3d7f, 0x3d7f, 0x3d7f, 0x3d81, 0x3d7f, 0x1078,
1467 0x23ca, 0x70a7, 0x3d85, 0x0078, 0x45f6, 0x2011, 0x0018, 0x1078,
1468 0x4287, 0x0079, 0x3d8b, 0x3d90, 0x2438, 0x3b60, 0x3d92, 0x3d94,
1469 0x1078, 0x23ca, 0x1078, 0x23ca, 0x1078, 0x23ca, 0x2200, 0x0079,
1470 0x3d99, 0x3d9e, 0x3da0, 0x3da0, 0x3d9e, 0x3d9e, 0x1078, 0x23ca,
1471 0x78e4, 0xa084, 0x0008, 0x0040, 0x3db5, 0x70a7, 0x3da9, 0x0078,
1472 0x45f6, 0x2011, 0x0004, 0x1078, 0x4287, 0x0079, 0x3daf, 0x3db5,
1473 0x2438, 0x3b60, 0x3db5, 0x3dbf, 0x3dc3, 0x70ab, 0x3dbd, 0x2001,
1474 0x0003, 0x1078, 0x4544, 0x0078, 0x45f0, 0x0078, 0x45ea, 0x70ab,
1475 0x3db5, 0x0078, 0x2438, 0x70ab, 0x3dc7, 0x0078, 0x2438, 0x0078,
1476 0x3dbd, 0xa282, 0x0003, 0x0050, 0x3dcf, 0x1078, 0x23ca, 0xa386,
1477 0x0002, 0x00c0, 0x3de8, 0xa286, 0x0002, 0x00c0, 0x3dee, 0x78a0,
1478 0xa005, 0x00c0, 0x3dee, 0xa484, 0x8000, 0x00c0, 0x3dee, 0x78e4,
1479 0xa084, 0x0008, 0x0040, 0x3de8, 0xa6b5, 0x0008, 0x2019, 0x0000,
1480 0xa684, 0x0008, 0x0040, 0x3dee, 0x1078, 0x412c, 0x6810, 0x70be,
1481 0x7003, 0x0007, 0x2300, 0x0079, 0x3df5, 0x3df8, 0x3e25, 0x3e2d,
1482 0x2200, 0x0079, 0x3dfb, 0x3e00, 0x3dfe, 0x3e19, 0x1078, 0x23ca,
1483 0x7990, 0xa1ac, 0x0007, 0xa026, 0x2011, 0x0001, 0x1078, 0x428d,
1484 0x0079, 0x3e0a, 0x3e0f, 0x2438, 0x3b60, 0x3e17, 0x3e11, 0x0078,
1485 0x45ea, 0x70ab, 0x3e15, 0x0078, 0x2438, 0x0078, 0x3e0f, 0x1078,
1486 0x23ca, 0xa684, 0x0010, 0x0040, 0x3e23, 0x1078, 0x414f, 0x0040,
1487 0x3e23, 0x0078, 0x2438, 0x0078, 0x41bc, 0x2200, 0x0079, 0x3e28,
1488 0x3e2b, 0x3e2b, 0x3e2b, 0x1078, 0x23ca, 0x2200, 0x0079, 0x3e30,
1489 0x3e33, 0x3e35, 0x3e35, 0x1078, 0x23ca, 0x78e4, 0xa084, 0x0008,
1490 0x0040, 0x3e4a, 0x70a7, 0x3e3e, 0x0078, 0x45f6, 0x2011, 0x0004,
1491 0x1078, 0x4287, 0x0079, 0x3e44, 0x3e4a, 0x2438, 0x3b60, 0x3e4a,
1492 0x3e54, 0x3e58, 0x70ab, 0x3e52, 0x2001, 0x0003, 0x1078, 0x4544,
1493 0x0078, 0x45f0, 0x0078, 0x45ea, 0x70ab, 0x3e4a, 0x0078, 0x2438,
1494 0x70ab, 0x3e5c, 0x0078, 0x2438, 0x0078, 0x3e52, 0x2300, 0x0079,
1495 0x3e61, 0x3e66, 0x3e68, 0x3e64, 0x1078, 0x23ca, 0x70a4, 0x007a,
1496 0x70a4, 0x007a, 0xa282, 0x0002, 0x0050, 0x3e70, 0x1078, 0x23ca,
1497 0xa684, 0x0200, 0x0040, 0x3e7a, 0x1078, 0x45b5, 0x1078, 0x426f,
1498 0x1078, 0x45bc, 0x2300, 0x0079, 0x3e7d, 0x3e80, 0x3ea4, 0x3f0a,
1499 0xa286, 0x0001, 0x0040, 0x3e86, 0x1078, 0x23ca, 0xa684, 0x0200,
1500 0x0040, 0x3e8e, 0x1078, 0x45b5, 0x1078, 0x45bc, 0x2001, 0x0001,
1501 0x1078, 0x454c, 0x78b8, 0xa084, 0xc001, 0x0040, 0x3ea0, 0x7848,
1502 0xa085, 0x0008, 0x784a, 0x7848, 0xa084, 0x0008, 0x00c0, 0x3e9b,
1503 0x7003, 0x0000, 0x0078, 0x3b60, 0x2200, 0x0079, 0x3ea7, 0x3ea9,
1504 0x3eda, 0x70a7, 0x3ead, 0x0078, 0x45f6, 0x2011, 0x000d, 0x1078,
1505 0x4287, 0x0079, 0x3eb3, 0x3eba, 0x2438, 0x3b60, 0x3ec2, 0x3eca,
1506 0x3ed0, 0x3ed2, 0xa6b4, 0x00ff, 0xa6b5, 0x0400, 0x6eb6, 0x7e5a,
1507 0x0078, 0x45e4, 0xa6b4, 0x00ff, 0xa6b5, 0x0400, 0x6eb6, 0x7e5a,
1508 0x0078, 0x45e4, 0x70ab, 0x3ece, 0x0078, 0x2438, 0x0078, 0x3eba,
1509 0x1078, 0x23ca, 0x70ab, 0x3ed6, 0x0078, 0x2438, 0x1078, 0x45fc,
1510 0x0078, 0x2438, 0x70a7, 0x3ede, 0x0078, 0x45f6, 0x2011, 0x0012,
1511 0x1078, 0x4287, 0x0079, 0x3ee4, 0x3eea, 0x2438, 0x3b60, 0x3ef6,
1512 0x3efe, 0x3f04, 0xa6b4, 0x00ff, 0xa6b5, 0x0400, 0x6eb6, 0x7e5a,
1513 0x70b4, 0xa080, 0x00a5, 0x781a, 0x0078, 0x2438, 0xa6b4, 0x00ff,
1514 0xa6b5, 0x0400, 0x6eb6, 0x7e5a, 0x0078, 0x45e4, 0x70ab, 0x3f02,
1515 0x0078, 0x2438, 0x0078, 0x3eea, 0x70ab, 0x3f08, 0x0078, 0x2438,
1516 0x0078, 0x3ef6, 0xa286, 0x0001, 0x0040, 0x3f10, 0x1078, 0x23ca,
1517 0x70a7, 0x3f14, 0x0078, 0x45f6, 0x2011, 0x0015, 0x1078, 0x4287,
1518 0x0079, 0x3f1a, 0x3f1f, 0x2438, 0x3b60, 0x3f2d, 0x3f39, 0xa6b4,
1519 0x00ff, 0xa6b5, 0x0400, 0x6eb6, 0x7e5a, 0x783b, 0x1301, 0x70b4,
1520 0xa080, 0x00b5, 0x781a, 0x0078, 0x2438, 0xa6b4, 0x00ff, 0xa6b5,
1521 0x0400, 0x6eb6, 0x7e5a, 0x70b4, 0xa080, 0x00a5, 0x781a, 0x0078,
1522 0x2438, 0x70ab, 0x3f3d, 0x0078, 0x2438, 0x0078, 0x3f1f, 0xa282,
1523 0x0003, 0x0050, 0x3f45, 0x1078, 0x23ca, 0x2300, 0x0079, 0x3f48,
1524 0x3f4b, 0x3f82, 0x3fdd, 0xa286, 0x0001, 0x0040, 0x3f51, 0x1078,
1525 0x23ca, 0x6804, 0xa084, 0x00ff, 0xa086, 0x0006, 0x00c0, 0x3f5e,
1526 0x1078, 0x3ac2, 0x7003, 0x0000, 0x0078, 0x3b60, 0x683b, 0x0000,
1527 0x6837, 0x0000, 0xa684, 0x0200, 0x0040, 0x3f6c, 0x1078, 0x45b5,
1528 0x1078, 0x426f, 0x1078, 0x45bc, 0x2001, 0x0001, 0x1078, 0x454c,
1529 0x78b8, 0xa084, 0xc001, 0x0040, 0x3f7e, 0x7848, 0xa085, 0x0008,
1530 0x784a, 0x7848, 0xa084, 0x0008, 0x00c0, 0x3f79, 0x7003, 0x0000,
1531 0x0078, 0x3b60, 0x2200, 0x0079, 0x3f85, 0x3f87, 0x3fb8, 0x70a7,
1532 0x3f8b, 0x0078, 0x45f6, 0x2011, 0x000d, 0x1078, 0x4287, 0x0079,
1533 0x3f91, 0x3f98, 0x2438, 0x3b60, 0x3fa0, 0x3fa8, 0x3fae, 0x3fb0,
1534 0xa6b4, 0x00ff, 0xa6b5, 0x0800, 0x6eb6, 0x7e5a, 0x0078, 0x45e4,
1535 0xa6b4, 0x00ff, 0xa6b5, 0x0800, 0x6eb6, 0x7e5a, 0x0078, 0x45e4,
1536 0x70ab, 0x3fac, 0x0078, 0x2438, 0x0078, 0x3f98, 0x1078, 0x23ca,
1537 0x70ab, 0x3fb4, 0x0078, 0x2438, 0x1078, 0x45fc, 0x0078, 0x2438,
1538 0x70a7, 0x3fbc, 0x0078, 0x45f6, 0x2011, 0x0005, 0x1078, 0x4287,
1539 0x0079, 0x3fc2, 0x3fc7, 0x2438, 0x3b60, 0x3fcf, 0x3fd7, 0xa6b4,
1540 0x00ff, 0xa6b5, 0x0800, 0x6eb6, 0x7e5a, 0x0078, 0x45e4, 0xa6b4,
1541 0x00ff, 0xa6b5, 0x0800, 0x6eb6, 0x7e5a, 0x0078, 0x45e4, 0x70ab,
1542 0x3fdb, 0x0078, 0x2438, 0x0078, 0x3fc7, 0xa286, 0x0001, 0x0040,
1543 0x3fe3, 0x1078, 0x23ca, 0x70a7, 0x3fe7, 0x0078, 0x45f6, 0x2011,
1544 0x0006, 0x1078, 0x4287, 0x0079, 0x3fed, 0x3ff2, 0x2438, 0x3b60,
1545 0x3ff8, 0x4002, 0xa6b5, 0x0800, 0x6eb6, 0x7e5a, 0x0078, 0x45e4,
1546 0xa6b4, 0x00ff, 0xa6b5, 0x0800, 0x6eb6, 0xa6b5, 0x4000, 0x7e5a,
1547 0x0078, 0x45e4, 0x70ab, 0x4006, 0x0078, 0x2438, 0x0078, 0x3ff2,
1548 0x2300, 0x0079, 0x400b, 0x4010, 0x400e, 0x400e, 0x1078, 0x23ca,
1549 0x1078, 0x23ca, 0x2300, 0x71a8, 0xa005, 0x017a, 0x6810, 0x70be,
1550 0xa282, 0x0003, 0x0050, 0x401e, 0x1078, 0x23ca, 0x2300, 0x0079,
1551 0x4021, 0x4024, 0x4037, 0x4059, 0x82ff, 0x00c0, 0x4029, 0x1078,
1552 0x23ca, 0xa684, 0x0200, 0x0040, 0x4031, 0x1078, 0x45b5, 0x1078,
1553 0x45bc, 0x2001, 0x0001, 0x1078, 0x454c, 0x0078, 0x2438, 0xa296,
1554 0x0002, 0x0040, 0x4040, 0x82ff, 0x0040, 0x4040, 0x1078, 0x23ca,
1555 0x70a7, 0x4044, 0x0078, 0x45f6, 0x2011, 0x0018, 0x1078, 0x4287,
1556 0x0079, 0x404a, 0x404f, 0x2438, 0x3b60, 0x4051, 0x4053, 0x0078,
1557 0x45e4, 0x0078, 0x45e4, 0x70ab, 0x4057, 0x0078, 0x2438, 0x0078,
1558 0x404f, 0x2200, 0x0079, 0x405c, 0x405e, 0x4077, 0x70a7, 0x4062,
1559 0x0078, 0x45f6, 0x2011, 0x0017, 0x1078, 0x4287, 0x0079, 0x4068,
1560 0x406d, 0x2438, 0x3b60, 0x406f, 0x4071, 0x0078, 0x45e4, 0x0078,
1561 0x45e4, 0x70ab, 0x4075, 0x0078, 0x2438, 0x0078, 0x406d, 0xa484,
1562 0x8000, 0x00c0, 0x40c1, 0xa684, 0x0100, 0x0040, 0x408b, 0x1078,
1563 0x45b5, 0x1078, 0x426f, 0x1078, 0x45bc, 0x7848, 0xa085, 0x000c,
1564 0x784a, 0x0078, 0x408f, 0x78d8, 0x78d2, 0x78dc, 0x78d6, 0xa6b4,
1565 0xefff, 0x7e5a, 0x70a7, 0x4096, 0x0078, 0x45f6, 0x2011, 0x000d,
1566 0x1078, 0x4287, 0x0079, 0x409c, 0x40a3, 0x2438, 0x3b60, 0x40a3,
1567 0x40b1, 0x40b7, 0x40b9, 0xa684, 0x0100, 0x0040, 0x40af, 0x1078,
1568 0x4573, 0x682c, 0x78d2, 0x6830, 0x78d6, 0x1078, 0x45ad, 0x0078,
1569 0x45e4, 0x70ab, 0x40b5, 0x0078, 0x2438, 0x0078, 0x40a3, 0x1078,
1570 0x23ca, 0x70ab, 0x40bd, 0x0078, 0x2438, 0x1078, 0x45fc, 0x0078,
1571 0x2438, 0x1078, 0x45bc, 0x70ab, 0x40cb, 0x2001, 0x0003, 0x1078,
1572 0x4544, 0x0078, 0x45f0, 0x1078, 0x45ad, 0x682c, 0x78d2, 0x6830,
1573 0x78d6, 0x0078, 0x45e4, 0x70b8, 0x6812, 0x70be, 0x8000, 0x70ba,
1574 0x681b, 0x0000, 0xa684, 0x0008, 0x0040, 0x40f6, 0x157e, 0x137e,
1575 0x147e, 0x7890, 0x8004, 0x8004, 0x8004, 0x8004, 0xa084, 0x000f,
1576 0x681a, 0x80ac, 0x789b, 0x0000, 0xaf80, 0x002b, 0x2098, 0xad80,
1577 0x000b, 0x20a0, 0x53a5, 0x147f, 0x137f, 0x157f, 0xa6c4, 0x0f00,
1578 0xa684, 0x0002, 0x00c0, 0x4102, 0x692c, 0x810d, 0x810d, 0x810d,
1579 0x0078, 0x410f, 0x789b, 0x0010, 0x79ac, 0x0078, 0x410f, 0x017e,
1580 0x2009, 0x0005, 0x2001, 0x3d00, 0x1078, 0x457e, 0x017f, 0xa184,
1581 0x001f, 0xa805, 0x6816, 0x1078, 0x3b33, 0x68be, 0xa684, 0x0004,
1582 0x0040, 0x4120, 0xa18c, 0xff00, 0x78a8, 0xa084, 0x00ff, 0xa105,
1583 0x682a, 0xa6b4, 0x00ff, 0x6000, 0xa084, 0x0008, 0x0040, 0x412a,
1584 0xa6b5, 0x4000, 0x6eb6, 0x007c, 0x157e, 0x137e, 0x147e, 0x6918,
1585 0x7890, 0x8004, 0x8004, 0x8004, 0x8004, 0xa084, 0x000f, 0x007e,
1586 0xa100, 0x681a, 0x007f, 0x8000, 0x8004, 0x0040, 0x414b, 0x20a8,
1587 0x8104, 0xa080, 0x000b, 0xad00, 0x20a0, 0x789b, 0x0000, 0xaf80,
1588 0x002b, 0x2098, 0x53a5, 0x147f, 0x137f, 0x157f, 0x007c, 0x682c,
1589 0xa084, 0x0020, 0x00c0, 0x4157, 0x620c, 0x0078, 0x4158, 0x6210,
1590 0x6b18, 0x2300, 0xa202, 0x0040, 0x4178, 0x2018, 0xa382, 0x000e,
1591 0x0048, 0x4168, 0x0040, 0x4168, 0x2019, 0x000e, 0x0078, 0x416c,
1592 0x7858, 0xa084, 0xffef, 0x785a, 0x783b, 0x1b01, 0x7893, 0x0000,
1593 0x7ba2, 0x70b4, 0xa080, 0x008e, 0x781a, 0xa085, 0x0001, 0x007c,
1594 0x7858, 0xa084, 0xffef, 0x785a, 0x7893, 0x0000, 0xa006, 0x007c,
1595 0x6904, 0xa18c, 0x00ff, 0xa196, 0x0007, 0x0040, 0x418d, 0xa196,
1596 0x000f, 0x0040, 0x418d, 0x6807, 0x0117, 0x6914, 0x1078, 0x3b33,
1597 0x6100, 0x8104, 0x00c8, 0x41a8, 0x601c, 0xa005, 0x0040, 0x419c,
1598 0x2001, 0x0800, 0x0078, 0x41aa, 0x0d7e, 0x6824, 0x007e, 0x1078,
1599 0x45c5, 0x007f, 0x6826, 0x2d00, 0x682e, 0x1078, 0x3ac2, 0x0d7f,
1600 0x2001, 0x0200, 0x6826, 0x8007, 0x789b, 0x000e, 0x78aa, 0x6820,
1601 0xa085, 0x8000, 0x6822, 0x2031, 0x0400, 0x6eb6, 0x7e5a, 0x71b4,
1602 0xa188, 0x0091, 0x791a, 0x007c, 0xa6c4, 0x0f00, 0xa684, 0x0002,
1603 0x00c0, 0x41cf, 0x692c, 0x810d, 0x810d, 0x810d, 0xa184, 0x001f,
1604 0xa805, 0x6816, 0x1078, 0x3b33, 0x68be, 0x0078, 0x41d2, 0x6914,
1605 0x1078, 0x3b33, 0x6100, 0x8104, 0x00c8, 0x421c, 0xa184, 0x0300,
1606 0x0040, 0x41de, 0x6807, 0x0117, 0x0078, 0x41fc, 0x6004, 0xa005,
1607 0x00c0, 0x4205, 0x6807, 0x0117, 0x601c, 0xa005, 0x00c0, 0x41f2,
1608 0x0d7e, 0x1078, 0x45c5, 0x6827, 0x0034, 0x2d00, 0x682e, 0x1078,
1609 0x3ac2, 0x0d7f, 0xa684, 0x0004, 0x0040, 0x41fc, 0x2031, 0x0400,
1610 0x2001, 0x2800, 0x0078, 0x4200, 0x2031, 0x0400, 0x2001, 0x0800,
1611 0x71b4, 0xa188, 0x0091, 0x0078, 0x424a, 0x6018, 0xa005, 0x00c0,
1612 0x41f2, 0x601c, 0xa005, 0x00c0, 0x41f2, 0x689f, 0x0000, 0x6827,
1613 0x003d, 0xa684, 0x0001, 0x0040, 0x4258, 0xa6b5, 0x0800, 0x71b4,
1614 0xa188, 0x00ae, 0x0078, 0x4253, 0x6807, 0x0117, 0x2031, 0x0400,
1615 0x692c, 0xa18c, 0x00ff, 0xa186, 0x0012, 0x00c0, 0x422d, 0x2001,
1616 0x4265, 0x2009, 0x0001, 0x0078, 0x423e, 0xa186, 0x0003, 0x00c0,
1617 0x4237, 0x2001, 0x4266, 0x2009, 0x0012, 0x0078, 0x423e, 0x2001,
1618 0x0200, 0x71b4, 0xa188, 0x0091, 0x0078, 0x424a, 0x1078, 0x4598,
1619 0x78a3, 0x0000, 0x681c, 0xa085, 0x0040, 0x681e, 0x71b4, 0xa188,
1620 0x00da, 0xa006, 0x6826, 0x8007, 0x789b, 0x000e, 0x78aa, 0x6820,
1621 0xa085, 0x8000, 0x6822, 0x6eb6, 0x7e5a, 0x791a, 0x0078, 0x2438,
1622 0x6eb6, 0x1078, 0x3ac2, 0x6810, 0x70be, 0x7003, 0x0007, 0x70a3,
1623 0x0000, 0x704b, 0x0000, 0x0078, 0x2438, 0x0023, 0x0070, 0x0005,
1624 0x0000, 0x0a00, 0x0000, 0x0000, 0x0025, 0x0000, 0x0000, 0x683b,
1625 0x0000, 0x6837, 0x0000, 0xa684, 0x0200, 0x0040, 0x4286, 0x78b8,
1626 0xa08c, 0x001f, 0xa084, 0x8000, 0x0040, 0x427f, 0x8108, 0x78d8,
1627 0xa100, 0x6836, 0x78dc, 0xa081, 0x0000, 0x683a, 0x007c, 0x7990,
1628 0x810f, 0xa5ac, 0x0007, 0x2021, 0x0000, 0xa480, 0x0010, 0x789a,
1629 0x79a8, 0xa18c, 0x00ff, 0xa184, 0x0080, 0x00c0, 0x42b5, 0xa182,
1630 0x0020, 0x00c8, 0x42cf, 0xa182, 0x0012, 0x00c8, 0x4536, 0x2100,
1631 0x1079, 0x42a3, 0x007c, 0x4536, 0x447e, 0x4536, 0x4536, 0x42dc,
1632 0x42df, 0x4319, 0x434f, 0x4381, 0x4384, 0x4536, 0x4536, 0x433a,
1633 0x43a8, 0x43e2, 0x4536, 0x4536, 0x4409, 0xa18c, 0x001f, 0x6814,
1634 0xa084, 0x001f, 0xa106, 0x0040, 0x42cc, 0x70b4, 0xa080, 0x00cd,
1635 0x781a, 0x2001, 0x0014, 0x1078, 0x454c, 0x1078, 0x45bc, 0x7003,
1636 0x0000, 0x2001, 0x0002, 0x007c, 0x2001, 0x0000, 0x007c, 0xa182,
1637 0x0024, 0x00c8, 0x4536, 0xa184, 0x0003, 0x1079, 0x42a3, 0x007c,
1638 0x4536, 0x4536, 0x4536, 0x4536, 0x1078, 0x4536, 0x007c, 0x2200,
1639 0x0079, 0x42e2, 0x440c, 0x440c, 0x4306, 0x4306, 0x4306, 0x4306,
1640 0x4306, 0x4306, 0x4306, 0x4306, 0x4304, 0x4306, 0x42fb, 0x4306,
1641 0x4306, 0x4306, 0x4306, 0x4306, 0x430e, 0x4311, 0x440c, 0x4311,
1642 0x4306, 0x4306, 0x4306, 0x0c7e, 0x077e, 0x6f14, 0x1078, 0x36b0,
1643 0x077f, 0x0c7f, 0x0078, 0x4306, 0x1078, 0x44d1, 0x6827, 0x02b3,
1644 0x2009, 0x000b, 0x2001, 0x4800, 0x0078, 0x4440, 0x1078, 0x452b,
1645 0x007c, 0x6827, 0x0093, 0x2009, 0x000b, 0x2001, 0x4800, 0x0078,
1646 0x4428, 0x2d58, 0x6804, 0xa084, 0x00ff, 0xa086, 0x0006, 0x00c0,
1647 0x4323, 0x6807, 0x0117, 0x6827, 0x0002, 0x1078, 0x45c5, 0x6827,
1648 0x0036, 0x6932, 0x2d00, 0x682e, 0x0d7e, 0x1078, 0x3a92, 0x1078,
1649 0x4466, 0x2b68, 0x1078, 0x3ac2, 0x0d7f, 0x1078, 0x3ac2, 0x2001,
1650 0x0002, 0x007c, 0x1078, 0x4466, 0x2001, 0x0017, 0x1078, 0x454c,
1651 0x70a3, 0x0000, 0x2009, 0x5038, 0x200b, 0x0006, 0x70af, 0x0017,
1652 0x2009, 0x0200, 0x1078, 0x39d2, 0x2001, 0x0001, 0x007c, 0x2200,
1653 0x0079, 0x4352, 0x440c, 0x443d, 0x443d, 0x443d, 0x4373, 0x444d,
1654 0x4379, 0x444d, 0x444d, 0x4450, 0x4450, 0x4455, 0x4455, 0x436b,
1655 0x436b, 0x443d, 0x443d, 0x444d, 0x443d, 0x4379, 0x440c, 0x4379,
1656 0x4379, 0x4379, 0x4379, 0x6827, 0x0084, 0x2009, 0x000b, 0x2001,
1657 0x4300, 0x0078, 0x445f, 0x2009, 0x000b, 0x2001, 0x4300, 0x0078,
1658 0x4440, 0x6827, 0x0093, 0x2009, 0x000b, 0x2001, 0x4300, 0x0078,
1659 0x4428, 0x2001, 0x0000, 0x007c, 0x2200, 0x0079, 0x4387, 0x440c,
1660 0x43a0, 0x43a0, 0x43a0, 0x43a0, 0x444d, 0x444d, 0x444d, 0x444d,
1661 0x444d, 0x444d, 0x444d, 0x444d, 0x43a0, 0x43a0, 0x43a0, 0x43a0,
1662 0x444d, 0x43a0, 0x43a0, 0x444d, 0x444d, 0x444d, 0x444d, 0x440c,
1663 0x6827, 0x0093, 0x2009, 0x000b, 0x2001, 0x4300, 0x0078, 0x4428,
1664 0xa684, 0x0004, 0x00c0, 0x43bc, 0x6804, 0xa084, 0x00ff, 0xa086,
1665 0x0006, 0x00c0, 0x4536, 0x1078, 0x4466, 0x6807, 0x0117, 0x1078,
1666 0x3ac2, 0x2001, 0x0002, 0x007c, 0x6000, 0xa084, 0x0004, 0x0040,
1667 0x4536, 0x2d58, 0x6804, 0xa084, 0x00ff, 0xa086, 0x0006, 0x00c0,
1668 0x43cb, 0x6807, 0x0117, 0x6827, 0x0002, 0x1078, 0x45c5, 0x6827,
1669 0x0036, 0x6932, 0x2d00, 0x682e, 0x0d7e, 0x1078, 0x3aa1, 0x1078,
1670 0x4466, 0x2b68, 0x1078, 0x3ac2, 0x0d7f, 0x1078, 0x3ac2, 0x2001,
1671 0x0002, 0x007c, 0x6000, 0xa084, 0x0004, 0x0040, 0x4536, 0x2d58,
1672 0x6a04, 0xa294, 0x00ff, 0xa286, 0x0006, 0x00c0, 0x43f1, 0x6807,
1673 0x0117, 0x6827, 0x0002, 0x2d58, 0x1078, 0x45c5, 0x6827, 0x0036,
1674 0x6932, 0x2d00, 0x682e, 0x0d7e, 0x1078, 0x3ab1, 0x1078, 0x4466,
1675 0x2b68, 0x1078, 0x3ac2, 0x0d7f, 0x1078, 0x3ac2, 0x2001, 0x0002,
1676 0x007c, 0x1078, 0x4536, 0x007c, 0x70b4, 0xa080, 0x00cd, 0x781a,
1677 0x2001, 0x0001, 0x1078, 0x454c, 0x1078, 0x45bc, 0x7003, 0x0000,
1678 0x2001, 0x0002, 0x007c, 0x1078, 0x457e, 0x1078, 0x45b5, 0x1078,
1679 0x426f, 0x1078, 0x4180, 0x1078, 0x45bc, 0x2001, 0x0001, 0x007c,
1680 0x1078, 0x457e, 0x1078, 0x45b5, 0x1078, 0x426f, 0x70b4, 0xa080,
1681 0x00cd, 0x781a, 0x2001, 0x0013, 0x1078, 0x454c, 0x1078, 0x45bc,
1682 0x7003, 0x0000, 0x2001, 0x0002, 0x007c, 0x1078, 0x4536, 0x007c,
1683 0x1078, 0x457e, 0x1078, 0x45b5, 0x1078, 0x426f, 0x1078, 0x4180,
1684 0x1078, 0x45bc, 0x2001, 0x0001, 0x007c, 0x2001, 0x0003, 0x007c,
1685 0x1078, 0x44d1, 0x2001, 0x0000, 0x007c, 0x0c7e, 0x077e, 0x6f14,
1686 0x1078, 0x36b0, 0x077f, 0x0c7f, 0x2001, 0x0000, 0x007c, 0x1078,
1687 0x457e, 0x1078, 0x4536, 0x2001, 0x0006, 0x007c, 0x6904, 0xa18c,
1688 0x00ff, 0xa186, 0x0007, 0x0040, 0x4471, 0xa186, 0x000f, 0x00c0,
1689 0x4475, 0x1078, 0x45b5, 0x1078, 0x426f, 0x70b4, 0xa080, 0x00cd,
1690 0x781a, 0x1078, 0x45bc, 0x7003, 0x0000, 0x007c, 0x7aa8, 0xa294,
1691 0x00ff, 0x78a8, 0xa084, 0x00ff, 0xa08a, 0x0004, 0x00c8, 0x4536,
1692 0x1079, 0x448b, 0x007c, 0x4536, 0x448f, 0x4536, 0x44df, 0xa282,
1693 0x0003, 0x0040, 0x4496, 0x1078, 0x4536, 0x007c, 0x7da8, 0xa5ac,
1694 0x00ff, 0x7ca8, 0xa4a4, 0x00ff, 0xa482, 0x000c, 0x0048, 0x44a4,
1695 0x0040, 0x44a4, 0x2021, 0x000c, 0x701c, 0xa502, 0x00c8, 0x44a9,
1696 0x751c, 0x1078, 0x451c, 0x852b, 0x852b, 0x1078, 0x372e, 0x0040,
1697 0x44b5, 0x1078, 0x44c3, 0x0078, 0x44b9, 0x1078, 0x4518, 0x1078,
1698 0x44d1, 0xa6b5, 0x1000, 0x7e5a, 0x70b4, 0xa080, 0x00b9, 0x781a,
1699 0x2001, 0x0004, 0x007c, 0x0c7e, 0x6914, 0x810f, 0xa18c, 0x000f,
1700 0x810b, 0x810b, 0x810b, 0xa1e0, 0x5280, 0x1078, 0x3538, 0x0c7f,
1701 0x007c, 0x0c7e, 0x6814, 0x8007, 0xa084, 0x000f, 0x8003, 0x8003,
1702 0x8003, 0xa0e0, 0x5280, 0x1078, 0x355f, 0x0c7f, 0x007c, 0xa282,
1703 0x0002, 0x00c0, 0x4536, 0x7aa8, 0xa294, 0x00ff, 0xa284, 0xfffe,
1704 0x0040, 0x44ec, 0x2011, 0x0001, 0x1078, 0x450a, 0x1078, 0x44fc,
1705 0x1078, 0x44d1, 0xa6b5, 0x1000, 0x7e5a, 0x70b4, 0xa080, 0x00b9,
1706 0x781a, 0x2001, 0x0004, 0x007c, 0x0c7e, 0x6814, 0x8007, 0xa084,
1707 0x000f, 0x8003, 0x8003, 0x8003, 0xa0e0, 0x5280, 0x1078, 0x3604,
1708 0x0c7f, 0x007c, 0x789b, 0x0018, 0x78ab, 0x0001, 0x78ab, 0x0002,
1709 0x78ab, 0x0003, 0x7aaa, 0x789b, 0x0081, 0x78ab, 0x0004, 0x007c,
1710 0x2021, 0x0000, 0x2029, 0x0032, 0x789b, 0x0018, 0x78ab, 0x0001,
1711 0x78ab, 0x0003, 0x78ab, 0x0001, 0x7daa, 0x7caa, 0x789b, 0x0081,
1712 0x78ab, 0x0005, 0x007c, 0x2001, 0x0003, 0x1078, 0x4544, 0x70b4,
1713 0xa080, 0x00b9, 0x781a, 0x2001, 0x0005, 0x007c, 0x2001, 0x0007,
1714 0x1078, 0x4544, 0xa6b5, 0x1000, 0x7e5a, 0x70b4, 0xa080, 0x00b9,
1715 0x781a, 0x2001, 0x0004, 0x007c, 0x789b, 0x0018, 0x78aa, 0x789b,
1716 0x0081, 0x78ab, 0x0001, 0x007c, 0x6904, 0xa18c, 0x00ff, 0xa196,
1717 0x0007, 0x0040, 0x455a, 0xa196, 0x000f, 0x0040, 0x455a, 0x1078,
1718 0x193d, 0x007c, 0x6924, 0xa194, 0x003f, 0x00c0, 0x4563, 0xa18c,
1719 0xffc0, 0xa105, 0x6826, 0x1078, 0x3ac2, 0x691c, 0xa184, 0x0100,
1720 0x0040, 0x4572, 0x1078, 0x1b7e, 0x6914, 0x1078, 0x3b33, 0x6204,
1721 0x8210, 0x6206, 0x007c, 0x692c, 0x6834, 0x682e, 0xa112, 0x6930,
1722 0x6838, 0x6832, 0xa11b, 0xa200, 0xa301, 0x007c, 0x0c7e, 0xade0,
1723 0x0018, 0x6003, 0x0070, 0x6106, 0x600b, 0x0000, 0x600f, 0x0a00,
1724 0x6013, 0x0000, 0x6017, 0x0000, 0x8007, 0x601a, 0x601f, 0x0000,
1725 0x6023, 0x0000, 0x0c7f, 0x6824, 0xa085, 0x0080, 0x6826, 0x007c,
1726 0x157e, 0x137e, 0x147e, 0x2098, 0xaf80, 0x002d, 0x20a0, 0x81ac,
1727 0x0040, 0x45a3, 0x53a6, 0xa184, 0x0001, 0x0040, 0x45a9, 0x3304,
1728 0x78be, 0x147f, 0x137f, 0x157f, 0x007c, 0x70b0, 0xa005, 0x10c0,
1729 0x23ca, 0x70b3, 0x8000, 0x0078, 0x48f7, 0x71b0, 0x81ff, 0x0040,
1730 0x45bb, 0x1078, 0x49ed, 0x007c, 0x71b0, 0x81ff, 0x0040, 0x45c4,
1731 0x70b3, 0x0000, 0x1078, 0x4633, 0x007c, 0x0c7e, 0x0d7e, 0x1078,
1732 0x191a, 0x0c7f, 0x157e, 0x137e, 0x147e, 0x2da0, 0x2c98, 0x20a9,
1733 0x0031, 0x53a3, 0x147f, 0x137f, 0x157f, 0x6807, 0x010d, 0x680b,
1734 0x0000, 0x7004, 0x8007, 0x681a, 0x6823, 0x0000, 0x681f, 0x0000,
1735 0x689f, 0x0000, 0x0c7f, 0x007c, 0x70b4, 0xa080, 0x0091, 0x781a,
1736 0x0078, 0x2438, 0x70b4, 0xa080, 0x0081, 0x781a, 0x0078, 0x2438,
1737 0x70b4, 0xa080, 0x00b9, 0x781a, 0x0078, 0x2438, 0x70b4, 0xa080,
1738 0x00c3, 0x781a, 0x0078, 0x2438, 0x6904, 0xa18c, 0x00ff, 0xa196,
1739 0x0007, 0x0040, 0x4609, 0xa196, 0x000f, 0x0040, 0x4609, 0x6807,
1740 0x0117, 0x2001, 0x0200, 0x6826, 0x8007, 0x789b, 0x000e, 0x78aa,
1741 0x6820, 0xa085, 0x8000, 0x6822, 0x2031, 0x0400, 0x6eb6, 0x7e5a,
1742 0x71b4, 0xa188, 0x0091, 0x791a, 0x007c, 0x1078, 0x45bc, 0x7848,
1743 0xa085, 0x000c, 0x784a, 0x70b4, 0xa080, 0x00cd, 0x781a, 0x2009,
1744 0x000b, 0x2001, 0x4400, 0x1078, 0x457e, 0x2001, 0x0013, 0x1078,
1745 0x454c, 0x0078, 0x3b60, 0x127e, 0x2091, 0x2200, 0x2049, 0x4633,
1746 0x7000, 0x7204, 0xa205, 0x720c, 0xa215, 0x7008, 0xa084, 0xfff7,
1747 0xa205, 0x0040, 0x4645, 0x0078, 0x464a, 0x7003, 0x0000, 0x127f,
1748 0x2000, 0x007c, 0x7000, 0xa084, 0x0001, 0x00c0, 0x4678, 0x7108,
1749 0x8103, 0x00c8, 0x4657, 0x1078, 0x477a, 0x0078, 0x464f, 0x700c,
1750 0xa08c, 0x00ff, 0x0040, 0x4678, 0x7004, 0x8004, 0x00c8, 0x466f,
1751 0x7014, 0xa005, 0x00c0, 0x466b, 0x7010, 0xa005, 0x0040, 0x466f,
1752 0xa102, 0x00c8, 0x464f, 0x7007, 0x0010, 0x0078, 0x4678, 0x8aff,
1753 0x0040, 0x4678, 0x1078, 0x49c4, 0x00c0, 0x4672, 0x0040, 0x464f,
1754 0x1078, 0x4703, 0x7003, 0x0000, 0x127f, 0x2000, 0x007c, 0x017e,
1755 0x6104, 0xa18c, 0x00ff, 0xa186, 0x0007, 0x0040, 0x468b, 0xa18e,
1756 0x000f, 0x00c0, 0x468e, 0x6040, 0x0078, 0x468f, 0x6428, 0x017f,
1757 0x84ff, 0x0040, 0x46b9, 0x2c70, 0x7004, 0xa0bc, 0x000f, 0xa7b8,
1758 0x46c9, 0x273c, 0x87fb, 0x00c0, 0x46a7, 0x0048, 0x46a1, 0x1078,
1759 0x23ca, 0x609c, 0xa075, 0x0040, 0x46b9, 0x0078, 0x4694, 0x2704,
1760 0xae68, 0x6808, 0xa630, 0x680c, 0xa529, 0x8421, 0x0040, 0x46b9,
1761 0x8738, 0x2704, 0xa005, 0x00c0, 0x46a8, 0x709c, 0xa075, 0x00c0,
1762 0x4694, 0x007c, 0x0000, 0x0005, 0x0009, 0x000d, 0x0011, 0x0015,
1763 0x0019, 0x001d, 0x0000, 0x0003, 0x0009, 0x000f, 0x0015, 0x001b,
1764 0x0000, 0x0000, 0x46be, 0x46bb, 0x0000, 0x0000, 0x8000, 0x0000,
1765 0x46be, 0x0000, 0x46c6, 0x46c3, 0x0000, 0x0000, 0x0000, 0x0000,
1766 0x46c6, 0x0000, 0x46c1, 0x46c1, 0x0000, 0x0000, 0x8000, 0x0000,
1767 0x46c1, 0x0000, 0x46c7, 0x46c7, 0x0000, 0x0000, 0x0000, 0x0000,
1768 0x46c7, 0x127e, 0x2091, 0x2200, 0x2079, 0x5000, 0x2071, 0x0010,
1769 0x7007, 0x000a, 0x7007, 0x0002, 0x7003, 0x0000, 0x2071, 0x0020,
1770 0x7007, 0x000a, 0x7007, 0x0002, 0x7003, 0x0000, 0x2049, 0x0000,
1771 0x127f, 0x2000, 0x007c, 0x2049, 0x4703, 0x2019, 0x0000, 0x7004,
1772 0x8004, 0x00c8, 0x4756, 0x7007, 0x0012, 0x7108, 0x7008, 0xa106,
1773 0x00c0, 0x470d, 0xa184, 0x01e0, 0x0040, 0x4718, 0x1078, 0x23ca,
1774 0x2001, 0x04fd, 0x2004, 0xa082, 0x0005, 0x00c8, 0x4723, 0xa184,
1775 0x4000, 0x00c0, 0x470d, 0xa19c, 0x300c, 0xa386, 0x2004, 0x0040,
1776 0x4731, 0xa386, 0x0008, 0x0040, 0x473c, 0xa386, 0x200c, 0x00c0,
1777 0x470d, 0x7200, 0x8204, 0x0048, 0x473c, 0x730c, 0xa384, 0x00ff,
1778 0x0040, 0x473c, 0x1078, 0x23ca, 0x7007, 0x0012, 0x7000, 0xa084,
1779 0x0001, 0x00c0, 0x4756, 0x7008, 0xa084, 0x01e0, 0x00c0, 0x4756,
1780 0x7310, 0x7014, 0xa305, 0x0040, 0x4756, 0x710c, 0xa184, 0x0300,
1781 0x00c0, 0x4756, 0xa184, 0x00ff, 0x00c0, 0x4703, 0x7007, 0x0012,
1782 0x7007, 0x0008, 0x7004, 0xa084, 0x0008, 0x00c0, 0x475a, 0x7007,
1783 0x0012, 0x7108, 0x8103, 0x0048, 0x475f, 0x7003, 0x0000, 0x2049,
1784 0x0000, 0x007c, 0x107e, 0x007e, 0x127e, 0x157e, 0x2091, 0x2200,
1785 0x7108, 0x1078, 0x477a, 0x157f, 0x127f, 0x2091, 0x8001, 0x007f,
1786 0x107f, 0x007c, 0x7204, 0x7500, 0x730c, 0xa384, 0x0300, 0x00c0,
1787 0x47a1, 0xa184, 0x01e0, 0x00c0, 0x47c5, 0x7108, 0xa184, 0x01e0,
1788 0x00c0, 0x47c5, 0x2001, 0x04fd, 0x2004, 0xa082, 0x0005, 0x00c8,
1789 0x4795, 0xa184, 0x4000, 0x00c0, 0x4785, 0xa184, 0x0007, 0x0079,
1790 0x4799, 0x47a3, 0x47b5, 0x47a1, 0x47b5, 0x47a1, 0x4801, 0x47a1,
1791 0x47ff, 0x1078, 0x23ca, 0x7004, 0xa084, 0x0010, 0xa085, 0x0002,
1792 0x7006, 0x8aff, 0x00c0, 0x47b0, 0x2049, 0x0000, 0x0078, 0x47b4,
1793 0x1078, 0x49c4, 0x00c0, 0x47b0, 0x007c, 0x7004, 0xa084, 0x0010,
1794 0xa085, 0x0002, 0x7006, 0x8aff, 0x00c0, 0x47c0, 0x0078, 0x47c4,
1795 0x1078, 0x49c4, 0x00c0, 0x47c0, 0x007c, 0x7007, 0x0012, 0x7108,
1796 0x00e0, 0x47c8, 0x2091, 0x6000, 0x00e0, 0x47cc, 0x2091, 0x6000,
1797 0x7007, 0x0012, 0x7007, 0x0008, 0x7004, 0xa084, 0x0008, 0x00c0,
1798 0x47d4, 0x7007, 0x0012, 0x7108, 0x8103, 0x0048, 0x47d9, 0x7003,
1799 0x0000, 0x7000, 0xa005, 0x00c0, 0x47ed, 0x7004, 0xa005, 0x00c0,
1800 0x47ed, 0x700c, 0xa005, 0x0040, 0x47ef, 0x0078, 0x47d0, 0x2049,
1801 0x0000, 0x1078, 0x37d7, 0x6818, 0xa084, 0x8000, 0x0040, 0x47fa,
1802 0x681b, 0x0002, 0x007c, 0x1078, 0x23ca, 0x1078, 0x23ca, 0x1078,
1803 0x485d, 0x7210, 0x7114, 0x700c, 0xa09c, 0x00ff, 0x2800, 0xa300,
1804 0xa211, 0xa189, 0x0000, 0x1078, 0x485d, 0x2704, 0x2c58, 0xac60,
1805 0x6308, 0x2200, 0xa322, 0x630c, 0x2100, 0xa31b, 0x2400, 0xa305,
1806 0x0040, 0x4824, 0x00c8, 0x4824, 0x8412, 0x8210, 0x830a, 0xa189,
1807 0x0000, 0x2b60, 0x0078, 0x480b, 0x2b60, 0x8a07, 0x007e, 0x6004,
1808 0xa084, 0x0008, 0x0040, 0x4830, 0xa7ba, 0x46c3, 0x0078, 0x4832,
1809 0xa7ba, 0x46bb, 0x007f, 0xa73d, 0x2c00, 0x6886, 0x6f8a, 0x6c92,
1810 0x6b8e, 0x7007, 0x0012, 0x1078, 0x4703, 0x007c, 0x8738, 0x2704,
1811 0xa005, 0x00c0, 0x4851, 0x609c, 0xa005, 0x0040, 0x485a, 0x2060,
1812 0x6004, 0xa084, 0x000f, 0xa080, 0x46c9, 0x203c, 0x87fb, 0x1040,
1813 0x23ca, 0x8a51, 0x0040, 0x4859, 0x7008, 0xa084, 0x0003, 0xa086,
1814 0x0003, 0x007c, 0x2051, 0x0000, 0x007c, 0x8a50, 0x8739, 0x2704,
1815 0xa004, 0x00c0, 0x4871, 0x6000, 0xa064, 0x00c0, 0x4868, 0x2d60,
1816 0x6004, 0xa084, 0x000f, 0xa080, 0x46d9, 0x203c, 0x87fb, 0x1040,
1817 0x23ca, 0x007c, 0x127e, 0x0d7e, 0x2091, 0x2200, 0x0d7f, 0x6884,
1818 0x2060, 0x6888, 0x6b8c, 0x6c90, 0x8057, 0xaad4, 0x00ff, 0xa084,
1819 0x00ff, 0x007e, 0x6804, 0xa084, 0x0008, 0x007f, 0x0040, 0x488c,
1820 0xa0b8, 0x46c3, 0x0078, 0x488e, 0xa0b8, 0x46bb, 0x7e08, 0xa6b5,
1821 0x000c, 0x6904, 0xa18c, 0x00ff, 0xa186, 0x0007, 0x0040, 0x489c,
1822 0xa18e, 0x000f, 0x00c0, 0x48a5, 0x681c, 0xa084, 0x0040, 0x0040,
1823 0x48ac, 0xa6b5, 0x0001, 0x0078, 0x48ac, 0x681c, 0xa084, 0x0040,
1824 0x0040, 0x48ac, 0xa6b5, 0x0001, 0x7007, 0x0004, 0x7004, 0xa084,
1825 0x0004, 0x00c0, 0x48ae, 0x2400, 0xa305, 0x00c0, 0x48b9, 0x0078,
1826 0x48df, 0x2c58, 0x2704, 0x6104, 0xac60, 0x6000, 0xa400, 0x701a,
1827 0x6004, 0xa301, 0x701e, 0xa184, 0x0008, 0x0040, 0x48cf, 0x6010,
1828 0xa081, 0x0000, 0x7022, 0x6014, 0xa081, 0x0000, 0x7026, 0x6208,
1829 0x2400, 0xa202, 0x7012, 0x620c, 0x2300, 0xa203, 0x7016, 0x7602,
1830 0x7007, 0x0001, 0x2b60, 0x1078, 0x483e, 0x0078, 0x48e1, 0x1078,
1831 0x49c4, 0x00c0, 0x48df, 0x127f, 0x2000, 0x007c, 0x127e, 0x0d7e,
1832 0x2091, 0x2200, 0x0d7f, 0x7007, 0x0004, 0x7004, 0xa084, 0x0004,
1833 0x00c0, 0x48ed, 0x7003, 0x0008, 0x127f, 0x2000, 0x007c, 0x127e,
1834 0x0d7e, 0x2091, 0x2200, 0x0d7f, 0x2049, 0x48f7, 0x7007, 0x0004,
1835 0x7004, 0xa084, 0x0004, 0x00c0, 0x4900, 0x7e08, 0xa6b5, 0x000c,
1836 0x6904, 0xa18c, 0x00ff, 0xa186, 0x0007, 0x0040, 0x4913, 0xa18e,
1837 0x000f, 0x00c0, 0x491e, 0x681c, 0xa084, 0x0040, 0x0040, 0x491a,
1838 0xa6b5, 0x0001, 0x6840, 0x2050, 0x0078, 0x4927, 0x681c, 0xa084,
1839 0x0020, 0x00c0, 0x4925, 0xa6b5, 0x0001, 0x6828, 0x2050, 0x2d60,
1840 0x6004, 0xa0bc, 0x000f, 0xa7b8, 0x46c9, 0x273c, 0x87fb, 0x00c0,
1841 0x493b, 0x0048, 0x4935, 0x1078, 0x23ca, 0x689c, 0xa065, 0x0040,
1842 0x493f, 0x0078, 0x4928, 0x1078, 0x49c4, 0x00c0, 0x493b, 0x127f,
1843 0x2000, 0x007c, 0x127e, 0x007e, 0x017e, 0x0d7e, 0x2091, 0x2200,
1844 0x0d7f, 0x037f, 0x047f, 0x7e08, 0xa6b5, 0x000c, 0x6904, 0xa18c,
1845 0x00ff, 0xa186, 0x0007, 0x0040, 0x4959, 0xa18e, 0x000f, 0x00c0,
1846 0x4962, 0x681c, 0xa084, 0x0040, 0x0040, 0x4969, 0xa6b5, 0x0001,
1847 0x0078, 0x4969, 0x681c, 0xa084, 0x0040, 0x0040, 0x4969, 0xa6b5,
1848 0x0001, 0x2049, 0x4942, 0x017e, 0x6904, 0xa18c, 0x00ff, 0xa186,
1849 0x0007, 0x0040, 0x4977, 0xa18e, 0x000f, 0x00c0, 0x497a, 0x6840,
1850 0x0078, 0x497b, 0x6828, 0x017f, 0xa055, 0x0040, 0x49c1, 0x2d70,
1851 0x2e60, 0x7004, 0xa0bc, 0x000f, 0xa7b8, 0x46c9, 0x273c, 0x87fb,
1852 0x00c0, 0x4995, 0x0048, 0x498e, 0x1078, 0x23ca, 0x709c, 0xa075,
1853 0x2060, 0x0040, 0x49c1, 0x0078, 0x4981, 0x2704, 0xae68, 0x6808,
1854 0xa422, 0x680c, 0xa31b, 0x0048, 0x49ae, 0x8a51, 0x00c0, 0x49a2,
1855 0x1078, 0x23ca, 0x8738, 0x2704, 0xa005, 0x00c0, 0x4996, 0x709c,
1856 0xa075, 0x2060, 0x0040, 0x49c1, 0x0078, 0x4981, 0x8422, 0x8420,
1857 0x831a, 0xa399, 0x0000, 0x6908, 0x2400, 0xa122, 0x690c, 0x2300,
1858 0xa11b, 0x00c8, 0x49bd, 0x1078, 0x23ca, 0x2071, 0x0020, 0x0078,
1859 0x48ac, 0x127f, 0x2000, 0x007c, 0x7008, 0xa084, 0x0003, 0xa086,
1860 0x0003, 0x0040, 0x49ec, 0x2704, 0xac08, 0x2104, 0x701a, 0x8108,
1861 0x2104, 0x701e, 0x8108, 0x2104, 0x7012, 0x8108, 0x2104, 0x7016,
1862 0x6004, 0xa084, 0x0008, 0x0040, 0x49e3, 0x8108, 0x2104, 0x7022,
1863 0x8108, 0x2104, 0x7026, 0x7602, 0x7004, 0xa084, 0x0010, 0xa085,
1864 0x0001, 0x7006, 0x1078, 0x483e, 0x007c, 0x127e, 0x007e, 0x0d7e,
1865 0x2091, 0x2200, 0x2049, 0x49ed, 0x0d7f, 0x087f, 0x7108, 0xa184,
1866 0x0003, 0x00c0, 0x4a17, 0x017e, 0x6904, 0xa18c, 0x00ff, 0xa186,
1867 0x0007, 0x0040, 0x4a07, 0xa18e, 0x000f, 0x00c0, 0x4a0a, 0x6840,
1868 0x0078, 0x4a0b, 0x6828, 0x017f, 0xa005, 0x0040, 0x4a25, 0x0078,
1869 0x464a, 0x0020, 0x4a17, 0x1078, 0x4801, 0x0078, 0x4a25, 0x00a0,
1870 0x4a1e, 0x7108, 0x1078, 0x477a, 0x0078, 0x49f6, 0x7007, 0x0010,
1871 0x00a0, 0x4a20, 0x7108, 0x1078, 0x477a, 0x7008, 0xa086, 0x0008,
1872 0x00c0, 0x49f6, 0x7000, 0xa005, 0x00c0, 0x49f6, 0x7003, 0x0000,
1873 0x2049, 0x0000, 0x127f, 0x2000, 0x007c, 0x127e, 0x147e, 0x137e,
1874 0x157e, 0x0c7e, 0x0d7e, 0x2091, 0x2200, 0x0d7f, 0x2049, 0x4a35,
1875 0xad80, 0x0011, 0x20a0, 0x2099, 0x0031, 0x700c, 0xa084, 0x00ff,
1876 0x682a, 0x7007, 0x0008, 0x7007, 0x0002, 0x7003, 0x0001, 0x0040,
1877 0x4a54, 0x8000, 0x80ac, 0x53a5, 0x7007, 0x0004, 0x7004, 0xa084,
1878 0x0004, 0x00c0, 0x4a56, 0x0c7f, 0x2049, 0x0000, 0x7003, 0x0000,
1879 0x157f, 0x137f, 0x147f, 0x127f, 0x2000, 0x007c, 0x2091, 0x6000,
1880 0x2091, 0x8000, 0x78cc, 0xa005, 0x0040, 0x4a7d, 0x7994, 0x70d0,
1881 0xa106, 0x00c0, 0x4a7d, 0x7804, 0xa005, 0x0040, 0x4a7d, 0x7807,
1882 0x0000, 0x0068, 0x4a7d, 0x2091, 0x4080, 0x7820, 0x8001, 0x7822,
1883 0x00c0, 0x4ad8, 0x7824, 0x7822, 0x2069, 0x5040, 0x6800, 0xa084,
1884 0x0007, 0x0040, 0x4a9b, 0xa086, 0x0002, 0x0040, 0x4a9b, 0x6834,
1885 0xa00d, 0x0040, 0x4a9b, 0x2104, 0xa005, 0x0040, 0x4a9b, 0x8001,
1886 0x200a, 0x0040, 0x4b80, 0x7848, 0xa005, 0x0040, 0x4aa9, 0x8001,
1887 0x784a, 0x00c0, 0x4aa9, 0x2009, 0x0102, 0x6844, 0x200a, 0x1078,
1888 0x21b1, 0x6890, 0xa005, 0x0040, 0x4ab5, 0x8001, 0x6892, 0x00c0,
1889 0x4ab5, 0x686f, 0x0000, 0x6873, 0x0001, 0x2061, 0x5300, 0x20a9,
1890 0x0100, 0x2009, 0x0002, 0x6034, 0xa005, 0x0040, 0x4acb, 0x8001,
1891 0x6036, 0x00c0, 0x4acb, 0x6010, 0xa005, 0x0040, 0x4acb, 0x017e,
1892 0x1078, 0x21b1, 0x017f, 0xace0, 0x0010, 0x0070, 0x4ad1, 0x0078,
1893 0x4abb, 0x8109, 0x0040, 0x4ad8, 0x20a9, 0x0100, 0x0078, 0x4abb,
1894 0x1078, 0x4ae5, 0x1078, 0x4b0a, 0x2009, 0x5051, 0x2104, 0x2009,
1895 0x0102, 0x200a, 0x2091, 0x8001, 0x007c, 0x7834, 0x8001, 0x7836,
1896 0x00c0, 0x4b09, 0x7838, 0x7836, 0x2091, 0x8000, 0x7844, 0xa005,
1897 0x00c0, 0x4af4, 0x2001, 0x0101, 0x8001, 0x7846, 0xa080, 0x7300,
1898 0x2040, 0x2004, 0xa065, 0x0040, 0x4b09, 0x6024, 0xa005, 0x0040,
1899 0x4b05, 0x8001, 0x6026, 0x0040, 0x4b39, 0x6000, 0x2c40, 0x0078,
1900 0x4afa, 0x007c, 0x7828, 0x8001, 0x782a, 0x00c0, 0x4b38, 0x782c,
1901 0x782a, 0x7830, 0xa005, 0x00c0, 0x4b17, 0x2001, 0x0200, 0x8001,
1902 0x7832, 0x8003, 0x8003, 0x8003, 0x8003, 0xa090, 0x5300, 0xa298,
1903 0x0002, 0x2304, 0xa084, 0x0008, 0x0040, 0x4b38, 0xa290, 0x0009,
1904 0x2204, 0xa005, 0x0040, 0x4b30, 0x8001, 0x2012, 0x00c0, 0x4b38,
1905 0x2304, 0xa084, 0xfff7, 0xa085, 0x0080, 0x201a, 0x1078, 0x21b1,
1906 0x007c, 0x2069, 0x5040, 0x6800, 0xa005, 0x0040, 0x4b43, 0x6848,
1907 0xac06, 0x0040, 0x4b80, 0x601b, 0x0006, 0x60b4, 0xa084, 0x3f00,
1908 0x601e, 0x6020, 0xa084, 0x00ff, 0xa085, 0x0060, 0x6022, 0x6000,
1909 0x2042, 0x6714, 0x6f82, 0x1078, 0x1956, 0x6818, 0xa005, 0x0040,
1910 0x4b5b, 0x8001, 0x681a, 0x6808, 0xa084, 0xffef, 0x680a, 0x6810,
1911 0x8001, 0x00d0, 0x4b65, 0x1078, 0x23ca, 0x6812, 0x602f, 0x0000,
1912 0x6033, 0x0000, 0x2c68, 0x1078, 0x1c53, 0x2069, 0x5040, 0x7944,
1913 0xa184, 0x0100, 0x2001, 0x0006, 0x686e, 0x00c0, 0x4b7b, 0x6986,
1914 0x2001, 0x0004, 0x686e, 0x1078, 0x21ac, 0x2091, 0x8001, 0x007c,
1915 0x2069, 0x0100, 0x2009, 0x5040, 0x2104, 0xa084, 0x0007, 0x0040,
1916 0x4bdc, 0xa086, 0x0007, 0x00c0, 0x4b96, 0x0d7e, 0x2009, 0x5052,
1917 0x216c, 0x1078, 0x3a1a, 0x0d7f, 0x0078, 0x4bdc, 0x2009, 0x5052,
1918 0x2164, 0x1078, 0x2375, 0x601b, 0x0006, 0x6858, 0xa084, 0x3f00,
1919 0x601e, 0x6020, 0xa084, 0x00ff, 0xa085, 0x0048, 0x6022, 0x602f,
1920 0x0000, 0x6033, 0x0000, 0x6830, 0xa084, 0x0040, 0x0040, 0x4bd0,
1921 0x684b, 0x0004, 0x20a9, 0x0014, 0x6848, 0xa084, 0x0004, 0x0040,
1922 0x4bbd, 0x0070, 0x4bbd, 0x0078, 0x4bb4, 0x684b, 0x0009, 0x20a9,
1923 0x0014, 0x6848, 0xa084, 0x0001, 0x0040, 0x4bca, 0x0070, 0x4bca,
1924 0x0078, 0x4bc1, 0x20a9, 0x00fa, 0x0070, 0x4bd0, 0x0078, 0x4bcc,
1925 0x6808, 0xa084, 0xfffd, 0x680a, 0x681b, 0x0048, 0x2009, 0x505b,
1926 0x200b, 0x0007, 0x784c, 0x784a, 0x2091, 0x8001, 0x007c, 0x2079,
1927 0x5000, 0x1078, 0x4c0a, 0x1078, 0x4bee, 0x1078, 0x4bfc, 0x7833,
1928 0x0000, 0x7847, 0x0000, 0x784b, 0x0000, 0x007c, 0x2019, 0x0003,
1929 0x2011, 0x5046, 0x2204, 0xa086, 0x003c, 0x0040, 0x4bf9, 0x2019,
1930 0x0002, 0x7b2a, 0x7b2e, 0x007c, 0x2019, 0x0039, 0x2011, 0x5046,
1931 0x2204, 0xa086, 0x003c, 0x0040, 0x4c07, 0x2019, 0x0027, 0x7b36,
1932 0x7b3a, 0x007c, 0x2019, 0x3971, 0x2011, 0x5046, 0x2204, 0xa086,
1933 0x003c, 0x0040, 0x4c15, 0x2019, 0x2626, 0x7b22, 0x7b26, 0x783f,
1934 0x0000, 0x7843, 0x000a, 0x007c, 0x0020, 0x002b, 0x0000, 0x0020,
1935 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020,
1936 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020,
1937 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020,
1938 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0014,
1939 0x0014, 0x9849, 0x0014, 0x0014, 0x0014, 0x0014, 0x0014, 0x0014,
1940 0x0014, 0x0080, 0x000f, 0x0000, 0x0201, 0x0604, 0x0c08, 0x2120,
1941 0x4022, 0xf880, 0x0018, 0x300b, 0xa201, 0x0014, 0xa200, 0x0014,
1942 0xa200, 0x0214, 0x0000, 0x006c, 0x0002, 0x0014, 0x98d5, 0x009e,
1943 0x009b, 0xa202, 0x8838, 0x3806, 0x8839, 0x20c3, 0x0864, 0x9889,
1944 0x28c1, 0x9cb6, 0xa203, 0x300c, 0x2846, 0x8161, 0x846a, 0x8300,
1945 0x1856, 0x883a, 0x9865, 0x28f2, 0x9c95, 0x9858, 0x300c, 0x28e1,
1946 0x9c95, 0x2809, 0xa206, 0x64c0, 0x67a0, 0x6fc0, 0x1814, 0x883b,
1947 0x782c, 0x786d, 0x9879, 0x282b, 0xa207, 0x64a0, 0x67a0, 0x6fc0,
1948 0x1814, 0x883b, 0x7822, 0x883e, 0x987d, 0x8576, 0x8677, 0x206b,
1949 0x28c1, 0x9cb6, 0x2044, 0x2103, 0x20a2, 0x2081, 0x9865, 0xa209,
1950 0x2901, 0x9891, 0x0014, 0xa205, 0xa300, 0x1872, 0x879a, 0x883c,
1951 0x1fe2, 0xc601, 0xa20a, 0x856e, 0x0704, 0x9c95, 0x0014, 0xa204,
1952 0xa300, 0x3009, 0x19e2, 0xf868, 0x8176, 0x86eb, 0x85eb, 0x872e,
1953 0x87a9, 0x883f, 0x08e6, 0x9895, 0xf881, 0x9890, 0xc801, 0x0014,
1954 0xf8c1, 0x0016, 0x85b2, 0x80f0, 0x9532, 0xfb02, 0x1de2, 0x0014,
1955 0x8532, 0xf241, 0x0014, 0x1de2, 0x84a8, 0xd7a0, 0x1fe6, 0x0014,
1956 0xa208, 0x6043, 0x8008, 0x1dc1, 0x0016, 0x8300, 0x8160, 0x842a,
1957 0xf041, 0x3008, 0x84a8, 0x11d6, 0x7042, 0x20dd, 0x0011, 0x20d5,
1958 0x8822, 0x0016, 0x8000, 0x2847, 0x1011, 0x98c8, 0x8000, 0xa000,
1959 0x2802, 0x1011, 0x98ce, 0x9865, 0x283e, 0x1011, 0x98d2, 0xa20b,
1960 0x0017, 0x300c, 0xa300, 0x1de2, 0xdb81, 0x0014, 0x0210, 0x98df,
1961 0x0014, 0x26e0, 0x873a, 0xfb02, 0x19f2, 0x1fe2, 0x0014, 0xa20d,
1962 0x3806, 0x0210, 0x9cbb, 0x0704, 0x0000, 0x006c, 0x0002, 0x984f,
1963 0x0014, 0x009e, 0x00a0, 0x0017, 0x60ff, 0x300c, 0x8720, 0xa211,
1964 0x9cd0, 0x8772, 0x8837, 0x2101, 0x987a, 0x10d2, 0x78e2, 0x9cd3,
1965 0x9859, 0xd984, 0xf0e2, 0xf0a1, 0x98cd, 0x0014, 0x8831, 0xd166,
1966 0x8830, 0x800f, 0x9401, 0xb520, 0xc802, 0x8820, 0x987a, 0x2301,
1967 0x987a, 0x10d2, 0x78e4, 0x9cd3, 0x8821, 0x8820, 0x9859, 0xf123,
1968 0xf142, 0xf101, 0x98c6, 0x10d2, 0x70f6, 0x8832, 0x8203, 0x870c,
1969 0xd99e, 0x6001, 0x0014, 0x6845, 0x0214, 0xa21b, 0x9cd0, 0x2001,
1970 0x98c5, 0x8201, 0x1852, 0xd184, 0xd163, 0x8834, 0x8001, 0x988d,
1971 0x3027, 0x84a8, 0x1a56, 0x8833, 0x0014, 0xa218, 0x6981, 0x9cbc,
1972 0x6b2a, 0x6902, 0x1834, 0x989d, 0x1814, 0x8010, 0x8592, 0x8026,
1973 0x84b9, 0x7021, 0x0014, 0xa300, 0x69e1, 0x9ca9, 0x694b, 0xa213,
1974 0x1462, 0xa213, 0x8000, 0x16e1, 0x98b5, 0x8023, 0x16e1, 0x8001,
1975 0x10f1, 0x0016, 0x6969, 0xa214, 0x61c2, 0x8002, 0x14e1, 0x8004,
1976 0x16e1, 0x0101, 0x300a, 0x8827, 0x0014, 0xa217, 0x9cbc, 0x0014,
1977 0xa300, 0x8181, 0x842a, 0x84a8, 0x1ce6, 0x882c, 0x0016, 0xa212,
1978 0x9cd0, 0x10d2, 0x70e4, 0x0004, 0x8007, 0x9424, 0xcc1a, 0x9cd3,
1979 0x98c5, 0x8827, 0x300a, 0x0013, 0x8000, 0x84a4, 0x0016, 0x11c2,
1980 0x211e, 0x870e, 0xa21d, 0x0014, 0x878e, 0x0016, 0xa21c, 0x1035,
1981 0x9891, 0xa210, 0xa000, 0x8010, 0x8592, 0x853b, 0xd044, 0x8022,
1982 0x3807, 0x84bb, 0x98ea, 0x8021, 0x3807, 0x84b9, 0x300c, 0x817e,
1983 0x872b, 0x8772, 0x9891, 0x0000, 0x0020, 0x002b, 0x0000, 0x0020,
1984 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020,
1985 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020,
1986 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020,
1987 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0014,
1988 0x0014, 0x9849, 0x0014, 0x0014, 0x98ea, 0x98d5, 0x0014, 0x0014,
1989 0x0014, 0x0080, 0x013f, 0x0000, 0x0201, 0x0604, 0x0c08, 0x2120,
1990 0x4022, 0xf880, 0x0018, 0x300b, 0xa201, 0x0014, 0xa200, 0x0014,
1991 0xa200, 0x0214, 0xa202, 0x8838, 0x3806, 0x8839, 0x20c3, 0x0864,
1992 0xa833, 0x28c1, 0x9cb6, 0xa203, 0x300c, 0x2846, 0x8161, 0x846a,
1993 0x8300, 0x1856, 0x883a, 0xa804, 0x28f2, 0x9c95, 0xa8f4, 0x300c,
1994 0x28e1, 0x9c95, 0x2809, 0xa206, 0x64c0, 0x67a0, 0x6fc0, 0x1814,
1995 0x883b, 0x782c, 0x786d, 0xa808, 0x282b, 0xa207, 0x64a0, 0x67a0,
1996 0x6fc0, 0x1814, 0x883b, 0x7822, 0x883e, 0xa802, 0x8576, 0x8677,
1997 0x206b, 0x28c1, 0x9cb6, 0x2044, 0x2103, 0x20a2, 0x2081, 0xa8e0,
1998 0xa209, 0x2901, 0xa809, 0x0014, 0xa205, 0xa300, 0x1872, 0x879a,
1999 0x883c, 0x1fe2, 0xc601, 0xa20a, 0x856e, 0x0704, 0x9c95, 0x0014,
2000 0xa204, 0xa300, 0x3009, 0x19e2, 0xf868, 0x8176, 0x86eb, 0x85eb,
2001 0x872e, 0x87a9, 0x883f, 0x08e6, 0xa8f3, 0xf881, 0xa8ec, 0xc801,
2002 0x0014, 0xf8c1, 0x0016, 0x85b2, 0x80f0, 0x9532, 0xfb02, 0x1de2,
2003 0x0014, 0x8532, 0xf241, 0x0014, 0x1de2, 0x84a8, 0xd7a0, 0x1fe6,
2004 0x0014, 0xa208, 0x6043, 0x8008, 0x1dc1, 0x0016, 0x8300, 0x8160,
2005 0x842a, 0xf041, 0x3008, 0x84a8, 0x11d6, 0x7042, 0x20dd, 0x0011,
2006 0x20d5, 0x8822, 0x0016, 0x8000, 0x2847, 0x1011, 0xa8fc, 0x8000,
2007 0xa000, 0x2802, 0x1011, 0xa8fd, 0xa893, 0x283e, 0x1011, 0xa8fd,
2008 0xa20b, 0x0017, 0x300c, 0xa300, 0x1de2, 0xdb81, 0x0014, 0x0210,
2009 0xa801, 0x0014, 0x26e0, 0x873a, 0xfb02, 0x19f2, 0x1fe2, 0x0014,
2010 0xa20d, 0x3806, 0x0210, 0x9cbb, 0x0704, 0x0017, 0x60ff, 0x300c,
2011 0x8720, 0xa211, 0x9d6b, 0x8772, 0x8837, 0x2101, 0xa821, 0x10d2,
2012 0x78e2, 0x9d6e, 0xa8fc, 0xd984, 0xf0e2, 0xf0a1, 0xa86c, 0x0014,
2013 0x8831, 0xd166, 0x8830, 0x800f, 0x9401, 0xb520, 0xc802, 0x8820,
2014 0xa80f, 0x2301, 0xa80d, 0x10d2, 0x78e4, 0x9d6e, 0x8821, 0x8820,
2015 0xa8e6, 0xf123, 0xf142, 0xf101, 0xa84f, 0x10d2, 0x70f6, 0x8832,
2016 0x8203, 0x870c, 0xd99e, 0x6001, 0x0014, 0x6845, 0x0214, 0xa21b,
2017 0x9d6b, 0x2001, 0xa840, 0x8201, 0x1852, 0xd184, 0xd163, 0x8834,
2018 0x8001, 0xa801, 0x3027, 0x84a8, 0x1a56, 0x8833, 0x0014, 0xa218,
2019 0x6981, 0x9d57, 0x6b2a, 0x6902, 0x1834, 0xa805, 0x1814, 0x8010,
2020 0x8592, 0x8026, 0x84b9, 0x7021, 0x0014, 0xa300, 0x69e1, 0x9d44,
2021 0x694b, 0xa213, 0x1462, 0xa213, 0x8000, 0x16e1, 0xa80c, 0x8023,
2022 0x16e1, 0x8001, 0x10f1, 0x0016, 0x6969, 0xa214, 0x61c2, 0x8002,
2023 0x14e1, 0x8004, 0x16e1, 0x0101, 0x300a, 0x8827, 0x0014, 0xa217,
2024 0x9d57, 0x0014, 0xa300, 0x8181, 0x842a, 0x84a8, 0x1ce6, 0x882c,
2025 0x0016, 0xa212, 0x9d6b, 0x10d2, 0x70e4, 0x0004, 0x8007, 0x9424,
2026 0xcc1a, 0x9d6e, 0xa8f8, 0x8827, 0x300a, 0x0013, 0x8000, 0x84a4,
2027 0x0016, 0x11c2, 0x211e, 0x870e, 0xa21d, 0x0014, 0x878e, 0x0016,
2028 0xa21c, 0x1035, 0xa8b4, 0xa210, 0x3807, 0x300c, 0x817e, 0x872b,
2029 0x8772, 0xa8ad, 0x0000, 0x8ec6
2030};
2031
2032#endif /* RELOAD_FIRMWARE */
2033
2034static const unsigned short risc_code_length01 = 0x3f14;
diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c
index caa0c3629626..5b1c12041a4f 100644
--- a/drivers/scsi/raid_class.c
+++ b/drivers/scsi/raid_class.c
@@ -1,5 +1,13 @@
1/* 1/*
2 * RAID Attributes 2 * raid_class.c - implementation of a simple raid visualisation class
3 *
4 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
5 *
6 * This file is licensed under GPLv2
7 *
8 * This class is designed to allow raid attributes to be visualised and
9 * manipulated in a form independent of the underlying raid. Ultimately this
10 * should work for both hardware and software raids.
3 */ 11 */
4#include <linux/init.h> 12#include <linux/init.h>
5#include <linux/module.h> 13#include <linux/module.h>
@@ -24,7 +32,7 @@ struct raid_internal {
24 32
25struct raid_component { 33struct raid_component {
26 struct list_head node; 34 struct list_head node;
27 struct device *dev; 35 struct class_device cdev;
28 int num; 36 int num;
29}; 37};
30 38
@@ -74,11 +82,10 @@ static int raid_setup(struct transport_container *tc, struct device *dev,
74 82
75 BUG_ON(class_get_devdata(cdev)); 83 BUG_ON(class_get_devdata(cdev));
76 84
77 rd = kmalloc(sizeof(*rd), GFP_KERNEL); 85 rd = kzalloc(sizeof(*rd), GFP_KERNEL);
78 if (!rd) 86 if (!rd)
79 return -ENOMEM; 87 return -ENOMEM;
80 88
81 memset(rd, 0, sizeof(*rd));
82 INIT_LIST_HEAD(&rd->component_list); 89 INIT_LIST_HEAD(&rd->component_list);
83 class_set_devdata(cdev, rd); 90 class_set_devdata(cdev, rd);
84 91
@@ -90,15 +97,15 @@ static int raid_remove(struct transport_container *tc, struct device *dev,
90{ 97{
91 struct raid_data *rd = class_get_devdata(cdev); 98 struct raid_data *rd = class_get_devdata(cdev);
92 struct raid_component *rc, *next; 99 struct raid_component *rc, *next;
100 dev_printk(KERN_ERR, dev, "RAID REMOVE\n");
93 class_set_devdata(cdev, NULL); 101 class_set_devdata(cdev, NULL);
94 list_for_each_entry_safe(rc, next, &rd->component_list, node) { 102 list_for_each_entry_safe(rc, next, &rd->component_list, node) {
95 char buf[40];
96 snprintf(buf, sizeof(buf), "component-%d", rc->num);
97 list_del(&rc->node); 103 list_del(&rc->node);
98 sysfs_remove_link(&cdev->kobj, buf); 104 dev_printk(KERN_ERR, rc->cdev.dev, "RAID COMPONENT REMOVE\n");
99 kfree(rc); 105 class_device_unregister(&rc->cdev);
100 } 106 }
101 kfree(class_get_devdata(cdev)); 107 dev_printk(KERN_ERR, dev, "RAID REMOVE DONE\n");
108 kfree(rd);
102 return 0; 109 return 0;
103} 110}
104 111
@@ -112,10 +119,11 @@ static struct {
112 enum raid_state value; 119 enum raid_state value;
113 char *name; 120 char *name;
114} raid_states[] = { 121} raid_states[] = {
115 { RAID_ACTIVE, "active" }, 122 { RAID_STATE_UNKNOWN, "unknown" },
116 { RAID_DEGRADED, "degraded" }, 123 { RAID_STATE_ACTIVE, "active" },
117 { RAID_RESYNCING, "resyncing" }, 124 { RAID_STATE_DEGRADED, "degraded" },
118 { RAID_OFFLINE, "offline" }, 125 { RAID_STATE_RESYNCING, "resyncing" },
126 { RAID_STATE_OFFLINE, "offline" },
119}; 127};
120 128
121static const char *raid_state_name(enum raid_state state) 129static const char *raid_state_name(enum raid_state state)
@@ -132,6 +140,33 @@ static const char *raid_state_name(enum raid_state state)
132 return name; 140 return name;
133} 141}
134 142
143static struct {
144 enum raid_level value;
145 char *name;
146} raid_levels[] = {
147 { RAID_LEVEL_UNKNOWN, "unknown" },
148 { RAID_LEVEL_LINEAR, "linear" },
149 { RAID_LEVEL_0, "raid0" },
150 { RAID_LEVEL_1, "raid1" },
151 { RAID_LEVEL_3, "raid3" },
152 { RAID_LEVEL_4, "raid4" },
153 { RAID_LEVEL_5, "raid5" },
154 { RAID_LEVEL_6, "raid6" },
155};
156
157static const char *raid_level_name(enum raid_level level)
158{
159 int i;
160 char *name = NULL;
161
162 for (i = 0; i < sizeof(raid_levels)/sizeof(raid_levels[0]); i++) {
163 if (raid_levels[i].value == level) {
164 name = raid_levels[i].name;
165 break;
166 }
167 }
168 return name;
169}
135 170
136#define raid_attr_show_internal(attr, fmt, var, code) \ 171#define raid_attr_show_internal(attr, fmt, var, code) \
137static ssize_t raid_show_##attr(struct class_device *cdev, char *buf) \ 172static ssize_t raid_show_##attr(struct class_device *cdev, char *buf) \
@@ -161,11 +196,22 @@ static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL)
161 196
162#define raid_attr_ro(attr) raid_attr_ro_internal(attr, ) 197#define raid_attr_ro(attr) raid_attr_ro_internal(attr, )
163#define raid_attr_ro_fn(attr) raid_attr_ro_internal(attr, ATTR_CODE(attr)) 198#define raid_attr_ro_fn(attr) raid_attr_ro_internal(attr, ATTR_CODE(attr))
164#define raid_attr_ro_state(attr) raid_attr_ro_states(attr, attr, ATTR_CODE(attr)) 199#define raid_attr_ro_state(attr) raid_attr_ro_states(attr, attr, )
200#define raid_attr_ro_state_fn(attr) raid_attr_ro_states(attr, attr, ATTR_CODE(attr))
201
165 202
166raid_attr_ro(level); 203raid_attr_ro_state(level);
167raid_attr_ro_fn(resync); 204raid_attr_ro_fn(resync);
168raid_attr_ro_state(state); 205raid_attr_ro_state_fn(state);
206
207static void raid_component_release(struct class_device *cdev)
208{
209 struct raid_component *rc = container_of(cdev, struct raid_component,
210 cdev);
211 dev_printk(KERN_ERR, rc->cdev.dev, "COMPONENT RELEASE\n");
212 put_device(rc->cdev.dev);
213 kfree(rc);
214}
169 215
170void raid_component_add(struct raid_template *r,struct device *raid_dev, 216void raid_component_add(struct raid_template *r,struct device *raid_dev,
171 struct device *component_dev) 217 struct device *component_dev)
@@ -175,34 +221,36 @@ void raid_component_add(struct raid_template *r,struct device *raid_dev,
175 raid_dev); 221 raid_dev);
176 struct raid_component *rc; 222 struct raid_component *rc;
177 struct raid_data *rd = class_get_devdata(cdev); 223 struct raid_data *rd = class_get_devdata(cdev);
178 char buf[40];
179 224
180 rc = kmalloc(sizeof(*rc), GFP_KERNEL); 225 rc = kzalloc(sizeof(*rc), GFP_KERNEL);
181 if (!rc) 226 if (!rc)
182 return; 227 return;
183 228
184 INIT_LIST_HEAD(&rc->node); 229 INIT_LIST_HEAD(&rc->node);
185 rc->dev = component_dev; 230 class_device_initialize(&rc->cdev);
231 rc->cdev.release = raid_component_release;
232 rc->cdev.dev = get_device(component_dev);
186 rc->num = rd->component_count++; 233 rc->num = rd->component_count++;
187 234
188 snprintf(buf, sizeof(buf), "component-%d", rc->num); 235 snprintf(rc->cdev.class_id, sizeof(rc->cdev.class_id),
236 "component-%d", rc->num);
189 list_add_tail(&rc->node, &rd->component_list); 237 list_add_tail(&rc->node, &rd->component_list);
190 sysfs_create_link(&cdev->kobj, &component_dev->kobj, buf); 238 rc->cdev.parent = cdev;
239 rc->cdev.class = &raid_class.class;
240 class_device_add(&rc->cdev);
191} 241}
192EXPORT_SYMBOL(raid_component_add); 242EXPORT_SYMBOL(raid_component_add);
193 243
194struct raid_template * 244struct raid_template *
195raid_class_attach(struct raid_function_template *ft) 245raid_class_attach(struct raid_function_template *ft)
196{ 246{
197 struct raid_internal *i = kmalloc(sizeof(struct raid_internal), 247 struct raid_internal *i = kzalloc(sizeof(struct raid_internal),
198 GFP_KERNEL); 248 GFP_KERNEL);
199 int count = 0; 249 int count = 0;
200 250
201 if (unlikely(!i)) 251 if (unlikely(!i))
202 return NULL; 252 return NULL;
203 253
204 memset(i, 0, sizeof(*i));
205
206 i->f = ft; 254 i->f = ft;
207 255
208 i->r.raid_attrs.ac.class = &raid_class.class; 256 i->r.raid_attrs.ac.class = &raid_class.class;
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 93d55233af7b..9321cdf45680 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * sata_mv.c - Marvell SATA support 2 * sata_mv.c - Marvell SATA support
3 * 3 *
4 * Copyright 2005: EMC Corporation, all rights reserved. 4 * Copyright 2005: EMC Corporation, all rights reserved.
5 * Copyright 2005 Red Hat, Inc. All rights reserved.
5 * 6 *
6 * Please ALWAYS copy linux-ide@vger.kernel.org on emails. 7 * Please ALWAYS copy linux-ide@vger.kernel.org on emails.
7 * 8 *
@@ -36,7 +37,7 @@
36#include <asm/io.h> 37#include <asm/io.h>
37 38
38#define DRV_NAME "sata_mv" 39#define DRV_NAME "sata_mv"
39#define DRV_VERSION "0.25" 40#define DRV_VERSION "0.5"
40 41
41enum { 42enum {
42 /* BAR's are enumerated in terms of pci_resource_start() terms */ 43 /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -50,6 +51,9 @@ enum {
50 MV_PCI_REG_BASE = 0, 51 MV_PCI_REG_BASE = 0,
51 MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ 52 MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */
52 MV_SATAHC0_REG_BASE = 0x20000, 53 MV_SATAHC0_REG_BASE = 0x20000,
54 MV_FLASH_CTL = 0x1046c,
55 MV_GPIO_PORT_CTL = 0x104f0,
56 MV_RESET_CFG = 0x180d8,
53 57
54 MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, 58 MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ,
55 MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, 59 MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ,
@@ -72,11 +76,6 @@ enum {
72 MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), 76 MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT),
73 MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), 77 MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ),
74 78
75 /* Our DMA boundary is determined by an ePRD being unable to handle
76 * anything larger than 64KB
77 */
78 MV_DMA_BOUNDARY = 0xffffU,
79
80 MV_PORTS_PER_HC = 4, 79 MV_PORTS_PER_HC = 4,
81 /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ 80 /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */
82 MV_PORT_HC_SHIFT = 2, 81 MV_PORT_HC_SHIFT = 2,
@@ -86,16 +85,10 @@ enum {
86 /* Host Flags */ 85 /* Host Flags */
87 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ 86 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */
88 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ 87 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */
89 MV_FLAG_GLBL_SFT_RST = (1 << 28), /* Global Soft Reset support */
90 MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 88 MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
91 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), 89 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
92 MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | 90 ATA_FLAG_NO_ATAPI),
93 MV_FLAG_GLBL_SFT_RST), 91 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE,
94
95 chip_504x = 0,
96 chip_508x = 1,
97 chip_604x = 2,
98 chip_608x = 3,
99 92
100 CRQB_FLAG_READ = (1 << 0), 93 CRQB_FLAG_READ = (1 << 0),
101 CRQB_TAG_SHIFT = 1, 94 CRQB_TAG_SHIFT = 1,
@@ -116,8 +109,19 @@ enum {
116 PCI_MASTER_EMPTY = (1 << 3), 109 PCI_MASTER_EMPTY = (1 << 3),
117 GLOB_SFT_RST = (1 << 4), 110 GLOB_SFT_RST = (1 << 4),
118 111
119 PCI_IRQ_CAUSE_OFS = 0x1d58, 112 MV_PCI_MODE = 0xd00,
120 PCI_IRQ_MASK_OFS = 0x1d5c, 113 MV_PCI_EXP_ROM_BAR_CTL = 0xd2c,
114 MV_PCI_DISC_TIMER = 0xd04,
115 MV_PCI_MSI_TRIGGER = 0xc38,
116 MV_PCI_SERR_MASK = 0xc28,
117 MV_PCI_XBAR_TMOUT = 0x1d04,
118 MV_PCI_ERR_LOW_ADDRESS = 0x1d40,
119 MV_PCI_ERR_HIGH_ADDRESS = 0x1d44,
120 MV_PCI_ERR_ATTRIBUTE = 0x1d48,
121 MV_PCI_ERR_COMMAND = 0x1d50,
122
123 PCI_IRQ_CAUSE_OFS = 0x1d58,
124 PCI_IRQ_MASK_OFS = 0x1d5c,
121 PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ 125 PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */
122 126
123 HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, 127 HC_MAIN_IRQ_CAUSE_OFS = 0x1d60,
@@ -134,7 +138,7 @@ enum {
134 SELF_INT = (1 << 23), 138 SELF_INT = (1 << 23),
135 TWSI_INT = (1 << 24), 139 TWSI_INT = (1 << 24),
136 HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ 140 HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */
137 HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | 141 HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE |
138 PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | 142 PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT |
139 HC_MAIN_RSVD), 143 HC_MAIN_RSVD),
140 144
@@ -153,6 +157,15 @@ enum {
153 /* SATA registers */ 157 /* SATA registers */
154 SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ 158 SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */
155 SATA_ACTIVE_OFS = 0x350, 159 SATA_ACTIVE_OFS = 0x350,
160 PHY_MODE3 = 0x310,
161 PHY_MODE4 = 0x314,
162 PHY_MODE2 = 0x330,
163 MV5_PHY_MODE = 0x74,
164 MV5_LT_MODE = 0x30,
165 MV5_PHY_CTL = 0x0C,
166 SATA_INTERFACE_CTL = 0x050,
167
168 MV_M2_PREAMP_MASK = 0x7e0,
156 169
157 /* Port registers */ 170 /* Port registers */
158 EDMA_CFG_OFS = 0, 171 EDMA_CFG_OFS = 0,
@@ -182,17 +195,16 @@ enum {
182 EDMA_ERR_LNK_CTRL_TX = (0x1f << 21), 195 EDMA_ERR_LNK_CTRL_TX = (0x1f << 21),
183 EDMA_ERR_LNK_DATA_TX = (0x1f << 26), 196 EDMA_ERR_LNK_DATA_TX = (0x1f << 26),
184 EDMA_ERR_TRANS_PROTO = (1 << 31), 197 EDMA_ERR_TRANS_PROTO = (1 << 31),
185 EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | 198 EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR |
186 EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR | 199 EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR |
187 EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR | 200 EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR |
188 EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | 201 EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 |
189 EDMA_ERR_LNK_DATA_RX | 202 EDMA_ERR_LNK_DATA_RX |
190 EDMA_ERR_LNK_DATA_TX | 203 EDMA_ERR_LNK_DATA_TX |
191 EDMA_ERR_TRANS_PROTO), 204 EDMA_ERR_TRANS_PROTO),
192 205
193 EDMA_REQ_Q_BASE_HI_OFS = 0x10, 206 EDMA_REQ_Q_BASE_HI_OFS = 0x10,
194 EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ 207 EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */
195 EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U,
196 208
197 EDMA_REQ_Q_OUT_PTR_OFS = 0x18, 209 EDMA_REQ_Q_OUT_PTR_OFS = 0x18,
198 EDMA_REQ_Q_PTR_SHIFT = 5, 210 EDMA_REQ_Q_PTR_SHIFT = 5,
@@ -200,7 +212,6 @@ enum {
200 EDMA_RSP_Q_BASE_HI_OFS = 0x1c, 212 EDMA_RSP_Q_BASE_HI_OFS = 0x1c,
201 EDMA_RSP_Q_IN_PTR_OFS = 0x20, 213 EDMA_RSP_Q_IN_PTR_OFS = 0x20,
202 EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ 214 EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */
203 EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U,
204 EDMA_RSP_Q_PTR_SHIFT = 3, 215 EDMA_RSP_Q_PTR_SHIFT = 3,
205 216
206 EDMA_CMD_OFS = 0x28, 217 EDMA_CMD_OFS = 0x28,
@@ -208,14 +219,44 @@ enum {
208 EDMA_DS = (1 << 1), 219 EDMA_DS = (1 << 1),
209 ATA_RST = (1 << 2), 220 ATA_RST = (1 << 2),
210 221
222 EDMA_IORDY_TMOUT = 0x34,
223 EDMA_ARB_CFG = 0x38,
224
211 /* Host private flags (hp_flags) */ 225 /* Host private flags (hp_flags) */
212 MV_HP_FLAG_MSI = (1 << 0), 226 MV_HP_FLAG_MSI = (1 << 0),
227 MV_HP_ERRATA_50XXB0 = (1 << 1),
228 MV_HP_ERRATA_50XXB2 = (1 << 2),
229 MV_HP_ERRATA_60X1B2 = (1 << 3),
230 MV_HP_ERRATA_60X1C0 = (1 << 4),
231 MV_HP_50XX = (1 << 5),
213 232
214 /* Port private flags (pp_flags) */ 233 /* Port private flags (pp_flags) */
215 MV_PP_FLAG_EDMA_EN = (1 << 0), 234 MV_PP_FLAG_EDMA_EN = (1 << 0),
216 MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), 235 MV_PP_FLAG_EDMA_DS_ACT = (1 << 1),
217}; 236};
218 237
238#define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX)
239#define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0)
240
241enum {
242 /* Our DMA boundary is determined by an ePRD being unable to handle
243 * anything larger than 64KB
244 */
245 MV_DMA_BOUNDARY = 0xffffU,
246
247 EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U,
248
249 EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U,
250};
251
252enum chip_type {
253 chip_504x,
254 chip_508x,
255 chip_5080,
256 chip_604x,
257 chip_608x,
258};
259
219/* Command ReQuest Block: 32B */ 260/* Command ReQuest Block: 32B */
220struct mv_crqb { 261struct mv_crqb {
221 u32 sg_addr; 262 u32 sg_addr;
@@ -252,14 +293,37 @@ struct mv_port_priv {
252 u32 pp_flags; 293 u32 pp_flags;
253}; 294};
254 295
296struct mv_port_signal {
297 u32 amps;
298 u32 pre;
299};
300
301struct mv_host_priv;
302struct mv_hw_ops {
303 void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio,
304 unsigned int port);
305 void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio);
306 void (*read_preamp)(struct mv_host_priv *hpriv, int idx,
307 void __iomem *mmio);
308 int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio,
309 unsigned int n_hc);
310 void (*reset_flash)(struct mv_host_priv *hpriv, void __iomem *mmio);
311 void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio);
312};
313
255struct mv_host_priv { 314struct mv_host_priv {
256 u32 hp_flags; 315 u32 hp_flags;
316 struct mv_port_signal signal[8];
317 const struct mv_hw_ops *ops;
257}; 318};
258 319
259static void mv_irq_clear(struct ata_port *ap); 320static void mv_irq_clear(struct ata_port *ap);
260static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); 321static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in);
261static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 322static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
323static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in);
324static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
262static void mv_phy_reset(struct ata_port *ap); 325static void mv_phy_reset(struct ata_port *ap);
326static void __mv_phy_reset(struct ata_port *ap, int can_sleep);
263static void mv_host_stop(struct ata_host_set *host_set); 327static void mv_host_stop(struct ata_host_set *host_set);
264static int mv_port_start(struct ata_port *ap); 328static int mv_port_start(struct ata_port *ap);
265static void mv_port_stop(struct ata_port *ap); 329static void mv_port_stop(struct ata_port *ap);
@@ -270,6 +334,29 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
270static void mv_eng_timeout(struct ata_port *ap); 334static void mv_eng_timeout(struct ata_port *ap);
271static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 335static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
272 336
337static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
338 unsigned int port);
339static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio);
340static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx,
341 void __iomem *mmio);
342static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
343 unsigned int n_hc);
344static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio);
345static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio);
346
347static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
348 unsigned int port);
349static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio);
350static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
351 void __iomem *mmio);
352static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
353 unsigned int n_hc);
354static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio);
355static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio);
356static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio,
357 unsigned int port_no);
358static void mv_stop_and_reset(struct ata_port *ap);
359
273static struct scsi_host_template mv_sht = { 360static struct scsi_host_template mv_sht = {
274 .module = THIS_MODULE, 361 .module = THIS_MODULE,
275 .name = DRV_NAME, 362 .name = DRV_NAME,
@@ -278,7 +365,7 @@ static struct scsi_host_template mv_sht = {
278 .eh_strategy_handler = ata_scsi_error, 365 .eh_strategy_handler = ata_scsi_error,
279 .can_queue = MV_USE_Q_DEPTH, 366 .can_queue = MV_USE_Q_DEPTH,
280 .this_id = ATA_SHT_THIS_ID, 367 .this_id = ATA_SHT_THIS_ID,
281 .sg_tablesize = MV_MAX_SG_CT, 368 .sg_tablesize = MV_MAX_SG_CT / 2,
282 .max_sectors = ATA_MAX_SECTORS, 369 .max_sectors = ATA_MAX_SECTORS,
283 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 370 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
284 .emulated = ATA_SHT_EMULATED, 371 .emulated = ATA_SHT_EMULATED,
@@ -290,7 +377,34 @@ static struct scsi_host_template mv_sht = {
290 .ordered_flush = 1, 377 .ordered_flush = 1,
291}; 378};
292 379
293static const struct ata_port_operations mv_ops = { 380static const struct ata_port_operations mv5_ops = {
381 .port_disable = ata_port_disable,
382
383 .tf_load = ata_tf_load,
384 .tf_read = ata_tf_read,
385 .check_status = ata_check_status,
386 .exec_command = ata_exec_command,
387 .dev_select = ata_std_dev_select,
388
389 .phy_reset = mv_phy_reset,
390
391 .qc_prep = mv_qc_prep,
392 .qc_issue = mv_qc_issue,
393
394 .eng_timeout = mv_eng_timeout,
395
396 .irq_handler = mv_interrupt,
397 .irq_clear = mv_irq_clear,
398
399 .scr_read = mv5_scr_read,
400 .scr_write = mv5_scr_write,
401
402 .port_start = mv_port_start,
403 .port_stop = mv_port_stop,
404 .host_stop = mv_host_stop,
405};
406
407static const struct ata_port_operations mv6_ops = {
294 .port_disable = ata_port_disable, 408 .port_disable = ata_port_disable,
295 409
296 .tf_load = ata_tf_load, 410 .tf_load = ata_tf_load,
@@ -322,43 +436,52 @@ static struct ata_port_info mv_port_info[] = {
322 .sht = &mv_sht, 436 .sht = &mv_sht,
323 .host_flags = MV_COMMON_FLAGS, 437 .host_flags = MV_COMMON_FLAGS,
324 .pio_mask = 0x1f, /* pio0-4 */ 438 .pio_mask = 0x1f, /* pio0-4 */
325 .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ 439 .udma_mask = 0x7f, /* udma0-6 */
326 .port_ops = &mv_ops, 440 .port_ops = &mv5_ops,
327 }, 441 },
328 { /* chip_508x */ 442 { /* chip_508x */
329 .sht = &mv_sht, 443 .sht = &mv_sht,
330 .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), 444 .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC),
331 .pio_mask = 0x1f, /* pio0-4 */ 445 .pio_mask = 0x1f, /* pio0-4 */
332 .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ 446 .udma_mask = 0x7f, /* udma0-6 */
333 .port_ops = &mv_ops, 447 .port_ops = &mv5_ops,
448 },
449 { /* chip_5080 */
450 .sht = &mv_sht,
451 .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC),
452 .pio_mask = 0x1f, /* pio0-4 */
453 .udma_mask = 0x7f, /* udma0-6 */
454 .port_ops = &mv5_ops,
334 }, 455 },
335 { /* chip_604x */ 456 { /* chip_604x */
336 .sht = &mv_sht, 457 .sht = &mv_sht,
337 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), 458 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
338 .pio_mask = 0x1f, /* pio0-4 */ 459 .pio_mask = 0x1f, /* pio0-4 */
339 .udma_mask = 0x7f, /* udma0-6 */ 460 .udma_mask = 0x7f, /* udma0-6 */
340 .port_ops = &mv_ops, 461 .port_ops = &mv6_ops,
341 }, 462 },
342 { /* chip_608x */ 463 { /* chip_608x */
343 .sht = &mv_sht, 464 .sht = &mv_sht,
344 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | 465 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS |
345 MV_FLAG_DUAL_HC), 466 MV_FLAG_DUAL_HC),
346 .pio_mask = 0x1f, /* pio0-4 */ 467 .pio_mask = 0x1f, /* pio0-4 */
347 .udma_mask = 0x7f, /* udma0-6 */ 468 .udma_mask = 0x7f, /* udma0-6 */
348 .port_ops = &mv_ops, 469 .port_ops = &mv6_ops,
349 }, 470 },
350}; 471};
351 472
352static struct pci_device_id mv_pci_tbl[] = { 473static const struct pci_device_id mv_pci_tbl[] = {
353 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, 474 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x},
354 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, 475 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x},
355 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, 476 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_5080},
356 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, 477 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x},
357 478
358 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, 479 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x},
359 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, 480 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x},
360 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x}, 481 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x},
361 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x}, 482 {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x},
483
484 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x0241), 0, 0, chip_604x},
362 {} /* terminate list */ 485 {} /* terminate list */
363}; 486};
364 487
@@ -369,6 +492,24 @@ static struct pci_driver mv_pci_driver = {
369 .remove = ata_pci_remove_one, 492 .remove = ata_pci_remove_one,
370}; 493};
371 494
495static const struct mv_hw_ops mv5xxx_ops = {
496 .phy_errata = mv5_phy_errata,
497 .enable_leds = mv5_enable_leds,
498 .read_preamp = mv5_read_preamp,
499 .reset_hc = mv5_reset_hc,
500 .reset_flash = mv5_reset_flash,
501 .reset_bus = mv5_reset_bus,
502};
503
504static const struct mv_hw_ops mv6xxx_ops = {
505 .phy_errata = mv6_phy_errata,
506 .enable_leds = mv6_enable_leds,
507 .read_preamp = mv6_read_preamp,
508 .reset_hc = mv6_reset_hc,
509 .reset_flash = mv6_reset_flash,
510 .reset_bus = mv_reset_pci_bus,
511};
512
372/* 513/*
373 * Functions 514 * Functions
374 */ 515 */
@@ -384,11 +525,27 @@ static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc)
384 return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); 525 return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ));
385} 526}
386 527
528static inline unsigned int mv_hc_from_port(unsigned int port)
529{
530 return port >> MV_PORT_HC_SHIFT;
531}
532
533static inline unsigned int mv_hardport_from_port(unsigned int port)
534{
535 return port & MV_PORT_MASK;
536}
537
538static inline void __iomem *mv_hc_base_from_port(void __iomem *base,
539 unsigned int port)
540{
541 return mv_hc_base(base, mv_hc_from_port(port));
542}
543
387static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) 544static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port)
388{ 545{
389 return (mv_hc_base(base, port >> MV_PORT_HC_SHIFT) + 546 return mv_hc_base_from_port(base, port) +
390 MV_SATAHC_ARBTR_REG_SZ + 547 MV_SATAHC_ARBTR_REG_SZ +
391 ((port & MV_PORT_MASK) * MV_PORT_REG_SZ)); 548 (mv_hardport_from_port(port) * MV_PORT_REG_SZ);
392} 549}
393 550
394static inline void __iomem *mv_ap_base(struct ata_port *ap) 551static inline void __iomem *mv_ap_base(struct ata_port *ap)
@@ -396,9 +553,9 @@ static inline void __iomem *mv_ap_base(struct ata_port *ap)
396 return mv_port_base(ap->host_set->mmio_base, ap->port_no); 553 return mv_port_base(ap->host_set->mmio_base, ap->port_no);
397} 554}
398 555
399static inline int mv_get_hc_count(unsigned long hp_flags) 556static inline int mv_get_hc_count(unsigned long host_flags)
400{ 557{
401 return ((hp_flags & MV_FLAG_DUAL_HC) ? 2 : 1); 558 return ((host_flags & MV_FLAG_DUAL_HC) ? 2 : 1);
402} 559}
403 560
404static void mv_irq_clear(struct ata_port *ap) 561static void mv_irq_clear(struct ata_port *ap)
@@ -450,7 +607,7 @@ static void mv_stop_dma(struct ata_port *ap)
450 } else { 607 } else {
451 assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); 608 assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS)));
452 } 609 }
453 610
454 /* now properly wait for the eDMA to stop */ 611 /* now properly wait for the eDMA to stop */
455 for (i = 1000; i > 0; i--) { 612 for (i = 1000; i > 0; i--) {
456 reg = readl(port_mmio + EDMA_CMD_OFS); 613 reg = readl(port_mmio + EDMA_CMD_OFS);
@@ -501,7 +658,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
501 struct pci_dev *pdev) 658 struct pci_dev *pdev)
502{ 659{
503#ifdef ATA_DEBUG 660#ifdef ATA_DEBUG
504 void __iomem *hc_base = mv_hc_base(mmio_base, 661 void __iomem *hc_base = mv_hc_base(mmio_base,
505 port >> MV_PORT_HC_SHIFT); 662 port >> MV_PORT_HC_SHIFT);
506 void __iomem *port_base; 663 void __iomem *port_base;
507 int start_port, num_ports, p, start_hc, num_hcs, hc; 664 int start_port, num_ports, p, start_hc, num_hcs, hc;
@@ -515,7 +672,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
515 start_port = port; 672 start_port = port;
516 num_ports = num_hcs = 1; 673 num_ports = num_hcs = 1;
517 } 674 }
518 DPRINTK("All registers for port(s) %u-%u:\n", start_port, 675 DPRINTK("All registers for port(s) %u-%u:\n", start_port,
519 num_ports > 1 ? num_ports - 1 : start_port); 676 num_ports > 1 ? num_ports - 1 : start_port);
520 677
521 if (NULL != pdev) { 678 if (NULL != pdev) {
@@ -583,70 +740,6 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
583} 740}
584 741
585/** 742/**
586 * mv_global_soft_reset - Perform the 6xxx global soft reset
587 * @mmio_base: base address of the HBA
588 *
589 * This routine only applies to 6xxx parts.
590 *
591 * LOCKING:
592 * Inherited from caller.
593 */
594static int mv_global_soft_reset(void __iomem *mmio_base)
595{
596 void __iomem *reg = mmio_base + PCI_MAIN_CMD_STS_OFS;
597 int i, rc = 0;
598 u32 t;
599
600 /* Following procedure defined in PCI "main command and status
601 * register" table.
602 */
603 t = readl(reg);
604 writel(t | STOP_PCI_MASTER, reg);
605
606 for (i = 0; i < 1000; i++) {
607 udelay(1);
608 t = readl(reg);
609 if (PCI_MASTER_EMPTY & t) {
610 break;
611 }
612 }
613 if (!(PCI_MASTER_EMPTY & t)) {
614 printk(KERN_ERR DRV_NAME ": PCI master won't flush\n");
615 rc = 1;
616 goto done;
617 }
618
619 /* set reset */
620 i = 5;
621 do {
622 writel(t | GLOB_SFT_RST, reg);
623 t = readl(reg);
624 udelay(1);
625 } while (!(GLOB_SFT_RST & t) && (i-- > 0));
626
627 if (!(GLOB_SFT_RST & t)) {
628 printk(KERN_ERR DRV_NAME ": can't set global reset\n");
629 rc = 1;
630 goto done;
631 }
632
633 /* clear reset and *reenable the PCI master* (not mentioned in spec) */
634 i = 5;
635 do {
636 writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg);
637 t = readl(reg);
638 udelay(1);
639 } while ((GLOB_SFT_RST & t) && (i-- > 0));
640
641 if (GLOB_SFT_RST & t) {
642 printk(KERN_ERR DRV_NAME ": can't clear global reset\n");
643 rc = 1;
644 }
645done:
646 return rc;
647}
648
649/**
650 * mv_host_stop - Host specific cleanup/stop routine. 743 * mv_host_stop - Host specific cleanup/stop routine.
651 * @host_set: host data structure 744 * @host_set: host data structure
652 * 745 *
@@ -699,7 +792,7 @@ static int mv_port_start(struct ata_port *ap)
699 goto err_out; 792 goto err_out;
700 memset(pp, 0, sizeof(*pp)); 793 memset(pp, 0, sizeof(*pp));
701 794
702 mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, 795 mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma,
703 GFP_KERNEL); 796 GFP_KERNEL);
704 if (!mem) 797 if (!mem)
705 goto err_out_pp; 798 goto err_out_pp;
@@ -709,7 +802,7 @@ static int mv_port_start(struct ata_port *ap)
709 if (rc) 802 if (rc)
710 goto err_out_priv; 803 goto err_out_priv;
711 804
712 /* First item in chunk of DMA memory: 805 /* First item in chunk of DMA memory:
713 * 32-slot command request table (CRQB), 32 bytes each in size 806 * 32-slot command request table (CRQB), 32 bytes each in size
714 */ 807 */
715 pp->crqb = mem; 808 pp->crqb = mem;
@@ -717,7 +810,7 @@ static int mv_port_start(struct ata_port *ap)
717 mem += MV_CRQB_Q_SZ; 810 mem += MV_CRQB_Q_SZ;
718 mem_dma += MV_CRQB_Q_SZ; 811 mem_dma += MV_CRQB_Q_SZ;
719 812
720 /* Second item: 813 /* Second item:
721 * 32-slot command response table (CRPB), 8 bytes each in size 814 * 32-slot command response table (CRPB), 8 bytes each in size
722 */ 815 */
723 pp->crpb = mem; 816 pp->crpb = mem;
@@ -731,18 +824,18 @@ static int mv_port_start(struct ata_port *ap)
731 pp->sg_tbl = mem; 824 pp->sg_tbl = mem;
732 pp->sg_tbl_dma = mem_dma; 825 pp->sg_tbl_dma = mem_dma;
733 826
734 writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | 827 writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT |
735 EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); 828 EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS);
736 829
737 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); 830 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS);
738 writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, 831 writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK,
739 port_mmio + EDMA_REQ_Q_IN_PTR_OFS); 832 port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
740 833
741 writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); 834 writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS);
742 writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); 835 writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS);
743 836
744 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); 837 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS);
745 writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, 838 writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK,
746 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 839 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
747 840
748 pp->req_producer = pp->rsp_consumer = 0; 841 pp->req_producer = pp->rsp_consumer = 0;
@@ -803,20 +896,30 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
803 struct scatterlist *sg; 896 struct scatterlist *sg;
804 897
805 ata_for_each_sg(sg, qc) { 898 ata_for_each_sg(sg, qc) {
806 u32 sg_len;
807 dma_addr_t addr; 899 dma_addr_t addr;
900 u32 sg_len, len, offset;
808 901
809 addr = sg_dma_address(sg); 902 addr = sg_dma_address(sg);
810 sg_len = sg_dma_len(sg); 903 sg_len = sg_dma_len(sg);
811 904
812 pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); 905 while (sg_len) {
813 pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); 906 offset = addr & MV_DMA_BOUNDARY;
814 assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); 907 len = sg_len;
815 pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); 908 if ((offset + sg_len) > 0x10000)
816 if (ata_sg_is_last(sg, qc)) 909 len = 0x10000 - offset;
817 pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); 910
911 pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff);
912 pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16);
913 pp->sg_tbl[i].flags_size = cpu_to_le32(len);
914
915 sg_len -= len;
916 addr += len;
917
918 if (!sg_len && ata_sg_is_last(sg, qc))
919 pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
818 920
819 i++; 921 i++;
922 }
820 } 923 }
821} 924}
822 925
@@ -857,7 +960,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
857 } 960 }
858 961
859 /* the req producer index should be the same as we remember it */ 962 /* the req producer index should be the same as we remember it */
860 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> 963 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
861 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 964 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
862 pp->req_producer); 965 pp->req_producer);
863 966
@@ -869,9 +972,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
869 assert(MV_MAX_Q_DEPTH > qc->tag); 972 assert(MV_MAX_Q_DEPTH > qc->tag);
870 flags |= qc->tag << CRQB_TAG_SHIFT; 973 flags |= qc->tag << CRQB_TAG_SHIFT;
871 974
872 pp->crqb[pp->req_producer].sg_addr = 975 pp->crqb[pp->req_producer].sg_addr =
873 cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); 976 cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);
874 pp->crqb[pp->req_producer].sg_addr_hi = 977 pp->crqb[pp->req_producer].sg_addr_hi =
875 cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); 978 cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);
876 pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); 979 pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags);
877 980
@@ -894,7 +997,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
894#ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ 997#ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */
895 case ATA_CMD_FPDMA_READ: 998 case ATA_CMD_FPDMA_READ:
896 case ATA_CMD_FPDMA_WRITE: 999 case ATA_CMD_FPDMA_WRITE:
897 mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); 1000 mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0);
898 mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); 1001 mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0);
899 break; 1002 break;
900#endif /* FIXME: remove this line when NCQ added */ 1003#endif /* FIXME: remove this line when NCQ added */
@@ -960,7 +1063,7 @@ static int mv_qc_issue(struct ata_queued_cmd *qc)
960 pp->req_producer); 1063 pp->req_producer);
961 /* until we do queuing, the queue should be empty at this point */ 1064 /* until we do queuing, the queue should be empty at this point */
962 assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1065 assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
963 ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> 1066 ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >>
964 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); 1067 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));
965 1068
966 mv_inc_q_index(&pp->req_producer); /* now incr producer index */ 1069 mv_inc_q_index(&pp->req_producer); /* now incr producer index */
@@ -997,15 +1100,15 @@ static u8 mv_get_crpb_status(struct ata_port *ap)
997 out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 1100 out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
998 1101
999 /* the response consumer index should be the same as we remember it */ 1102 /* the response consumer index should be the same as we remember it */
1000 assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1103 assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
1001 pp->rsp_consumer); 1104 pp->rsp_consumer);
1002 1105
1003 /* increment our consumer index... */ 1106 /* increment our consumer index... */
1004 pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); 1107 pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer);
1005 1108
1006 /* and, until we do NCQ, there should only be 1 CRPB waiting */ 1109 /* and, until we do NCQ, there should only be 1 CRPB waiting */
1007 assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> 1110 assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >>
1008 EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1111 EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
1009 pp->rsp_consumer); 1112 pp->rsp_consumer);
1010 1113
1011 /* write out our inc'd consumer index so EDMA knows we're caught up */ 1114 /* write out our inc'd consumer index so EDMA knows we're caught up */
@@ -1053,7 +1156,7 @@ static void mv_err_intr(struct ata_port *ap)
1053 1156
1054 /* check for fatal here and recover if needed */ 1157 /* check for fatal here and recover if needed */
1055 if (EDMA_ERR_FATAL & edma_err_cause) { 1158 if (EDMA_ERR_FATAL & edma_err_cause) {
1056 mv_phy_reset(ap); 1159 mv_stop_and_reset(ap);
1057 } 1160 }
1058} 1161}
1059 1162
@@ -1118,6 +1221,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1118 handled++; 1221 handled++;
1119 } 1222 }
1120 1223
1224 if (ap &&
1225 (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)))
1226 continue;
1227
1121 err_mask = ac_err_mask(ata_status); 1228 err_mask = ac_err_mask(ata_status);
1122 1229
1123 shift = port << 1; /* (port * 2) */ 1230 shift = port << 1; /* (port * 2) */
@@ -1129,14 +1236,15 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1129 err_mask |= AC_ERR_OTHER; 1236 err_mask |= AC_ERR_OTHER;
1130 handled++; 1237 handled++;
1131 } 1238 }
1132 1239
1133 if (handled && ap) { 1240 if (handled && ap) {
1134 qc = ata_qc_from_tag(ap, ap->active_tag); 1241 qc = ata_qc_from_tag(ap, ap->active_tag);
1135 if (NULL != qc) { 1242 if (NULL != qc) {
1136 VPRINTK("port %u IRQ found for qc, " 1243 VPRINTK("port %u IRQ found for qc, "
1137 "ata_status 0x%x\n", port,ata_status); 1244 "ata_status 0x%x\n", port,ata_status);
1138 /* mark qc status appropriately */ 1245 /* mark qc status appropriately */
1139 ata_qc_complete(qc, err_mask); 1246 if (!(qc->tf.ctl & ATA_NIEN))
1247 ata_qc_complete(qc, err_mask);
1140 } 1248 }
1141 } 1249 }
1142 } 1250 }
@@ -1144,7 +1252,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1144} 1252}
1145 1253
1146/** 1254/**
1147 * mv_interrupt - 1255 * mv_interrupt -
1148 * @irq: unused 1256 * @irq: unused
1149 * @dev_instance: private data; in this case the host structure 1257 * @dev_instance: private data; in this case the host structure
1150 * @regs: unused 1258 * @regs: unused
@@ -1154,7 +1262,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1154 * routine to handle. Also check for PCI errors which are only 1262 * routine to handle. Also check for PCI errors which are only
1155 * reported here. 1263 * reported here.
1156 * 1264 *
1157 * LOCKING: 1265 * LOCKING:
1158 * This routine holds the host_set lock while processing pending 1266 * This routine holds the host_set lock while processing pending
1159 * interrupts. 1267 * interrupts.
1160 */ 1268 */
@@ -1200,8 +1308,422 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1200 return IRQ_RETVAL(handled); 1308 return IRQ_RETVAL(handled);
1201} 1309}
1202 1310
1311static void __iomem *mv5_phy_base(void __iomem *mmio, unsigned int port)
1312{
1313 void __iomem *hc_mmio = mv_hc_base_from_port(mmio, port);
1314 unsigned long ofs = (mv_hardport_from_port(port) + 1) * 0x100UL;
1315
1316 return hc_mmio + ofs;
1317}
1318
1319static unsigned int mv5_scr_offset(unsigned int sc_reg_in)
1320{
1321 unsigned int ofs;
1322
1323 switch (sc_reg_in) {
1324 case SCR_STATUS:
1325 case SCR_ERROR:
1326 case SCR_CONTROL:
1327 ofs = sc_reg_in * sizeof(u32);
1328 break;
1329 default:
1330 ofs = 0xffffffffU;
1331 break;
1332 }
1333 return ofs;
1334}
1335
1336static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in)
1337{
1338 void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no);
1339 unsigned int ofs = mv5_scr_offset(sc_reg_in);
1340
1341 if (ofs != 0xffffffffU)
1342 return readl(mmio + ofs);
1343 else
1344 return (u32) ofs;
1345}
1346
1347static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
1348{
1349 void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no);
1350 unsigned int ofs = mv5_scr_offset(sc_reg_in);
1351
1352 if (ofs != 0xffffffffU)
1353 writelfl(val, mmio + ofs);
1354}
1355
1356static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio)
1357{
1358 u8 rev_id;
1359 int early_5080;
1360
1361 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
1362
1363 early_5080 = (pdev->device == 0x5080) && (rev_id == 0);
1364
1365 if (!early_5080) {
1366 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL);
1367 tmp |= (1 << 0);
1368 writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL);
1369 }
1370
1371 mv_reset_pci_bus(pdev, mmio);
1372}
1373
1374static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio)
1375{
1376 writel(0x0fcfffff, mmio + MV_FLASH_CTL);
1377}
1378
1379static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx,
1380 void __iomem *mmio)
1381{
1382 void __iomem *phy_mmio = mv5_phy_base(mmio, idx);
1383 u32 tmp;
1384
1385 tmp = readl(phy_mmio + MV5_PHY_MODE);
1386
1387 hpriv->signal[idx].pre = tmp & 0x1800; /* bits 12:11 */
1388 hpriv->signal[idx].amps = tmp & 0xe0; /* bits 7:5 */
1389}
1390
1391static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio)
1392{
1393 u32 tmp;
1394
1395 writel(0, mmio + MV_GPIO_PORT_CTL);
1396
1397 /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */
1398
1399 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL);
1400 tmp |= ~(1 << 0);
1401 writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL);
1402}
1403
1404static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
1405 unsigned int port)
1406{
1407 void __iomem *phy_mmio = mv5_phy_base(mmio, port);
1408 const u32 mask = (1<<12) | (1<<11) | (1<<7) | (1<<6) | (1<<5);
1409 u32 tmp;
1410 int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0);
1411
1412 if (fix_apm_sq) {
1413 tmp = readl(phy_mmio + MV5_LT_MODE);
1414 tmp |= (1 << 19);
1415 writel(tmp, phy_mmio + MV5_LT_MODE);
1416
1417 tmp = readl(phy_mmio + MV5_PHY_CTL);
1418 tmp &= ~0x3;
1419 tmp |= 0x1;
1420 writel(tmp, phy_mmio + MV5_PHY_CTL);
1421 }
1422
1423 tmp = readl(phy_mmio + MV5_PHY_MODE);
1424 tmp &= ~mask;
1425 tmp |= hpriv->signal[port].pre;
1426 tmp |= hpriv->signal[port].amps;
1427 writel(tmp, phy_mmio + MV5_PHY_MODE);
1428}
1429
1430
1431#undef ZERO
1432#define ZERO(reg) writel(0, port_mmio + (reg))
1433static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio,
1434 unsigned int port)
1435{
1436 void __iomem *port_mmio = mv_port_base(mmio, port);
1437
1438 writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS);
1439
1440 mv_channel_reset(hpriv, mmio, port);
1441
1442 ZERO(0x028); /* command */
1443 writel(0x11f, port_mmio + EDMA_CFG_OFS);
1444 ZERO(0x004); /* timer */
1445 ZERO(0x008); /* irq err cause */
1446 ZERO(0x00c); /* irq err mask */
1447 ZERO(0x010); /* rq bah */
1448 ZERO(0x014); /* rq inp */
1449 ZERO(0x018); /* rq outp */
1450 ZERO(0x01c); /* respq bah */
1451 ZERO(0x024); /* respq outp */
1452 ZERO(0x020); /* respq inp */
1453 ZERO(0x02c); /* test control */
1454 writel(0xbc, port_mmio + EDMA_IORDY_TMOUT);
1455}
1456#undef ZERO
1457
1458#define ZERO(reg) writel(0, hc_mmio + (reg))
1459static void mv5_reset_one_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
1460 unsigned int hc)
1461{
1462 void __iomem *hc_mmio = mv_hc_base(mmio, hc);
1463 u32 tmp;
1464
1465 ZERO(0x00c);
1466 ZERO(0x010);
1467 ZERO(0x014);
1468 ZERO(0x018);
1469
1470 tmp = readl(hc_mmio + 0x20);
1471 tmp &= 0x1c1c1c1c;
1472 tmp |= 0x03030303;
1473 writel(tmp, hc_mmio + 0x20);
1474}
1475#undef ZERO
1476
1477static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
1478 unsigned int n_hc)
1479{
1480 unsigned int hc, port;
1481
1482 for (hc = 0; hc < n_hc; hc++) {
1483 for (port = 0; port < MV_PORTS_PER_HC; port++)
1484 mv5_reset_hc_port(hpriv, mmio,
1485 (hc * MV_PORTS_PER_HC) + port);
1486
1487 mv5_reset_one_hc(hpriv, mmio, hc);
1488 }
1489
1490 return 0;
1491}
1492
1493#undef ZERO
1494#define ZERO(reg) writel(0, mmio + (reg))
1495static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio)
1496{
1497 u32 tmp;
1498
1499 tmp = readl(mmio + MV_PCI_MODE);
1500 tmp &= 0xff00ffff;
1501 writel(tmp, mmio + MV_PCI_MODE);
1502
1503 ZERO(MV_PCI_DISC_TIMER);
1504 ZERO(MV_PCI_MSI_TRIGGER);
1505 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT);
1506 ZERO(HC_MAIN_IRQ_MASK_OFS);
1507 ZERO(MV_PCI_SERR_MASK);
1508 ZERO(PCI_IRQ_CAUSE_OFS);
1509 ZERO(PCI_IRQ_MASK_OFS);
1510 ZERO(MV_PCI_ERR_LOW_ADDRESS);
1511 ZERO(MV_PCI_ERR_HIGH_ADDRESS);
1512 ZERO(MV_PCI_ERR_ATTRIBUTE);
1513 ZERO(MV_PCI_ERR_COMMAND);
1514}
1515#undef ZERO
1516
1517static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio)
1518{
1519 u32 tmp;
1520
1521 mv5_reset_flash(hpriv, mmio);
1522
1523 tmp = readl(mmio + MV_GPIO_PORT_CTL);
1524 tmp &= 0x3;
1525 tmp |= (1 << 5) | (1 << 6);
1526 writel(tmp, mmio + MV_GPIO_PORT_CTL);
1527}
1528
1529/**
1530 * mv6_reset_hc - Perform the 6xxx global soft reset
1531 * @mmio: base address of the HBA
1532 *
1533 * This routine only applies to 6xxx parts.
1534 *
1535 * LOCKING:
1536 * Inherited from caller.
1537 */
1538static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
1539 unsigned int n_hc)
1540{
1541 void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS;
1542 int i, rc = 0;
1543 u32 t;
1544
1545 /* Following procedure defined in PCI "main command and status
1546 * register" table.
1547 */
1548 t = readl(reg);
1549 writel(t | STOP_PCI_MASTER, reg);
1550
1551 for (i = 0; i < 1000; i++) {
1552 udelay(1);
1553 t = readl(reg);
1554 if (PCI_MASTER_EMPTY & t) {
1555 break;
1556 }
1557 }
1558 if (!(PCI_MASTER_EMPTY & t)) {
1559 printk(KERN_ERR DRV_NAME ": PCI master won't flush\n");
1560 rc = 1;
1561 goto done;
1562 }
1563
1564 /* set reset */
1565 i = 5;
1566 do {
1567 writel(t | GLOB_SFT_RST, reg);
1568 t = readl(reg);
1569 udelay(1);
1570 } while (!(GLOB_SFT_RST & t) && (i-- > 0));
1571
1572 if (!(GLOB_SFT_RST & t)) {
1573 printk(KERN_ERR DRV_NAME ": can't set global reset\n");
1574 rc = 1;
1575 goto done;
1576 }
1577
1578 /* clear reset and *reenable the PCI master* (not mentioned in spec) */
1579 i = 5;
1580 do {
1581 writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg);
1582 t = readl(reg);
1583 udelay(1);
1584 } while ((GLOB_SFT_RST & t) && (i-- > 0));
1585
1586 if (GLOB_SFT_RST & t) {
1587 printk(KERN_ERR DRV_NAME ": can't clear global reset\n");
1588 rc = 1;
1589 }
1590done:
1591 return rc;
1592}
1593
1594static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
1595 void __iomem *mmio)
1596{
1597 void __iomem *port_mmio;
1598 u32 tmp;
1599
1600 tmp = readl(mmio + MV_RESET_CFG);
1601 if ((tmp & (1 << 0)) == 0) {
1602 hpriv->signal[idx].amps = 0x7 << 8;
1603 hpriv->signal[idx].pre = 0x1 << 5;
1604 return;
1605 }
1606
1607 port_mmio = mv_port_base(mmio, idx);
1608 tmp = readl(port_mmio + PHY_MODE2);
1609
1610 hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */
1611 hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */
1612}
1613
1614static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio)
1615{
1616 writel(0x00000060, mmio + MV_GPIO_PORT_CTL);
1617}
1618
1619static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
1620 unsigned int port)
1621{
1622 void __iomem *port_mmio = mv_port_base(mmio, port);
1623
1624 u32 hp_flags = hpriv->hp_flags;
1625 int fix_phy_mode2 =
1626 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0);
1627 int fix_phy_mode4 =
1628 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0);
1629 u32 m2, tmp;
1630
1631 if (fix_phy_mode2) {
1632 m2 = readl(port_mmio + PHY_MODE2);
1633 m2 &= ~(1 << 16);
1634 m2 |= (1 << 31);
1635 writel(m2, port_mmio + PHY_MODE2);
1636
1637 udelay(200);
1638
1639 m2 = readl(port_mmio + PHY_MODE2);
1640 m2 &= ~((1 << 16) | (1 << 31));
1641 writel(m2, port_mmio + PHY_MODE2);
1642
1643 udelay(200);
1644 }
1645
1646 /* who knows what this magic does */
1647 tmp = readl(port_mmio + PHY_MODE3);
1648 tmp &= ~0x7F800000;
1649 tmp |= 0x2A800000;
1650 writel(tmp, port_mmio + PHY_MODE3);
1651
1652 if (fix_phy_mode4) {
1653 u32 m4;
1654
1655 m4 = readl(port_mmio + PHY_MODE4);
1656
1657 if (hp_flags & MV_HP_ERRATA_60X1B2)
1658 tmp = readl(port_mmio + 0x310);
1659
1660 m4 = (m4 & ~(1 << 1)) | (1 << 0);
1661
1662 writel(m4, port_mmio + PHY_MODE4);
1663
1664 if (hp_flags & MV_HP_ERRATA_60X1B2)
1665 writel(tmp, port_mmio + 0x310);
1666 }
1667
1668 /* Revert values of pre-emphasis and signal amps to the saved ones */
1669 m2 = readl(port_mmio + PHY_MODE2);
1670
1671 m2 &= ~MV_M2_PREAMP_MASK;
1672 m2 |= hpriv->signal[port].amps;
1673 m2 |= hpriv->signal[port].pre;
1674 m2 &= ~(1 << 16);
1675
1676 writel(m2, port_mmio + PHY_MODE2);
1677}
1678
1679static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio,
1680 unsigned int port_no)
1681{
1682 void __iomem *port_mmio = mv_port_base(mmio, port_no);
1683
1684 writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS);
1685
1686 if (IS_60XX(hpriv)) {
1687 u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);
1688 ifctl |= (1 << 12) | (1 << 7);
1689 writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);
1690 }
1691
1692 udelay(25); /* allow reset propagation */
1693
1694 /* Spec never mentions clearing the bit. Marvell's driver does
1695 * clear the bit, however.
1696 */
1697 writelfl(0, port_mmio + EDMA_CMD_OFS);
1698
1699 hpriv->ops->phy_errata(hpriv, mmio, port_no);
1700
1701 if (IS_50XX(hpriv))
1702 mdelay(1);
1703}
1704
1705static void mv_stop_and_reset(struct ata_port *ap)
1706{
1707 struct mv_host_priv *hpriv = ap->host_set->private_data;
1708 void __iomem *mmio = ap->host_set->mmio_base;
1709
1710 mv_stop_dma(ap);
1711
1712 mv_channel_reset(hpriv, mmio, ap->port_no);
1713
1714 __mv_phy_reset(ap, 0);
1715}
1716
1717static inline void __msleep(unsigned int msec, int can_sleep)
1718{
1719 if (can_sleep)
1720 msleep(msec);
1721 else
1722 mdelay(msec);
1723}
1724
1203/** 1725/**
1204 * mv_phy_reset - Perform eDMA reset followed by COMRESET 1726 * __mv_phy_reset - Perform eDMA reset followed by COMRESET
1205 * @ap: ATA channel to manipulate 1727 * @ap: ATA channel to manipulate
1206 * 1728 *
1207 * Part of this is taken from __sata_phy_reset and modified to 1729 * Part of this is taken from __sata_phy_reset and modified to
@@ -1211,41 +1733,47 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1211 * Inherited from caller. This is coded to safe to call at 1733 * Inherited from caller. This is coded to safe to call at
1212 * interrupt level, i.e. it does not sleep. 1734 * interrupt level, i.e. it does not sleep.
1213 */ 1735 */
1214static void mv_phy_reset(struct ata_port *ap) 1736static void __mv_phy_reset(struct ata_port *ap, int can_sleep)
1215{ 1737{
1738 struct mv_port_priv *pp = ap->private_data;
1739 struct mv_host_priv *hpriv = ap->host_set->private_data;
1216 void __iomem *port_mmio = mv_ap_base(ap); 1740 void __iomem *port_mmio = mv_ap_base(ap);
1217 struct ata_taskfile tf; 1741 struct ata_taskfile tf;
1218 struct ata_device *dev = &ap->device[0]; 1742 struct ata_device *dev = &ap->device[0];
1219 unsigned long timeout; 1743 unsigned long timeout;
1744 int retry = 5;
1745 u32 sstatus;
1220 1746
1221 VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); 1747 VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio);
1222 1748
1223 mv_stop_dma(ap); 1749 DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x "
1224
1225 writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS);
1226 udelay(25); /* allow reset propagation */
1227
1228 /* Spec never mentions clearing the bit. Marvell's driver does
1229 * clear the bit, however.
1230 */
1231 writelfl(0, port_mmio + EDMA_CMD_OFS);
1232
1233 VPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x "
1234 "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), 1750 "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS),
1235 mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); 1751 mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL));
1236 1752
1237 /* proceed to init communications via the scr_control reg */ 1753 /* Issue COMRESET via SControl */
1754comreset_retry:
1238 scr_write_flush(ap, SCR_CONTROL, 0x301); 1755 scr_write_flush(ap, SCR_CONTROL, 0x301);
1239 mdelay(1); 1756 __msleep(1, can_sleep);
1757
1240 scr_write_flush(ap, SCR_CONTROL, 0x300); 1758 scr_write_flush(ap, SCR_CONTROL, 0x300);
1241 timeout = jiffies + (HZ * 1); 1759 __msleep(20, can_sleep);
1760
1761 timeout = jiffies + msecs_to_jiffies(200);
1242 do { 1762 do {
1243 mdelay(10); 1763 sstatus = scr_read(ap, SCR_STATUS) & 0x3;
1244 if ((scr_read(ap, SCR_STATUS) & 0xf) != 1) 1764 if ((sstatus == 3) || (sstatus == 0))
1245 break; 1765 break;
1766
1767 __msleep(1, can_sleep);
1246 } while (time_before(jiffies, timeout)); 1768 } while (time_before(jiffies, timeout));
1247 1769
1248 VPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " 1770 /* work around errata */
1771 if (IS_60XX(hpriv) &&
1772 (sstatus != 0x0) && (sstatus != 0x113) && (sstatus != 0x123) &&
1773 (retry-- > 0))
1774 goto comreset_retry;
1775
1776 DPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x "
1249 "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), 1777 "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS),
1250 mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); 1778 mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL));
1251 1779
@@ -1259,6 +1787,21 @@ static void mv_phy_reset(struct ata_port *ap)
1259 } 1787 }
1260 ap->cbl = ATA_CBL_SATA; 1788 ap->cbl = ATA_CBL_SATA;
1261 1789
1790 /* even after SStatus reflects that device is ready,
1791 * it seems to take a while for link to be fully
1792 * established (and thus Status no longer 0x80/0x7F),
1793 * so we poll a bit for that, here.
1794 */
1795 retry = 20;
1796 while (1) {
1797 u8 drv_stat = ata_check_status(ap);
1798 if ((drv_stat != 0x80) && (drv_stat != 0x7f))
1799 break;
1800 __msleep(500, can_sleep);
1801 if (retry-- <= 0)
1802 break;
1803 }
1804
1262 tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); 1805 tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr);
1263 tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); 1806 tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr);
1264 tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr); 1807 tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr);
@@ -1269,9 +1812,19 @@ static void mv_phy_reset(struct ata_port *ap)
1269 VPRINTK("Port disabled post-sig: No device present.\n"); 1812 VPRINTK("Port disabled post-sig: No device present.\n");
1270 ata_port_disable(ap); 1813 ata_port_disable(ap);
1271 } 1814 }
1815
1816 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
1817
1818 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN;
1819
1272 VPRINTK("EXIT\n"); 1820 VPRINTK("EXIT\n");
1273} 1821}
1274 1822
1823static void mv_phy_reset(struct ata_port *ap)
1824{
1825 __mv_phy_reset(ap, 1);
1826}
1827
1275/** 1828/**
1276 * mv_eng_timeout - Routine called by libata when SCSI times out I/O 1829 * mv_eng_timeout - Routine called by libata when SCSI times out I/O
1277 * @ap: ATA channel to manipulate 1830 * @ap: ATA channel to manipulate
@@ -1289,16 +1842,16 @@ static void mv_eng_timeout(struct ata_port *ap)
1289 1842
1290 printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); 1843 printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id);
1291 DPRINTK("All regs @ start of eng_timeout\n"); 1844 DPRINTK("All regs @ start of eng_timeout\n");
1292 mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, 1845 mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no,
1293 to_pci_dev(ap->host_set->dev)); 1846 to_pci_dev(ap->host_set->dev));
1294 1847
1295 qc = ata_qc_from_tag(ap, ap->active_tag); 1848 qc = ata_qc_from_tag(ap, ap->active_tag);
1296 printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", 1849 printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n",
1297 ap->host_set->mmio_base, ap, qc, qc->scsicmd, 1850 ap->host_set->mmio_base, ap, qc, qc->scsicmd,
1298 &qc->scsicmd->cmnd); 1851 &qc->scsicmd->cmnd);
1299 1852
1300 mv_err_intr(ap); 1853 mv_err_intr(ap);
1301 mv_phy_reset(ap); 1854 mv_stop_and_reset(ap);
1302 1855
1303 if (!qc) { 1856 if (!qc) {
1304 printk(KERN_ERR "ata%u: BUG: timeout without command\n", 1857 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
@@ -1334,17 +1887,17 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio)
1334 unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; 1887 unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS;
1335 unsigned serr_ofs; 1888 unsigned serr_ofs;
1336 1889
1337 /* PIO related setup 1890 /* PIO related setup
1338 */ 1891 */
1339 port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); 1892 port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA);
1340 port->error_addr = 1893 port->error_addr =
1341 port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); 1894 port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR);
1342 port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); 1895 port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT);
1343 port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); 1896 port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL);
1344 port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); 1897 port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM);
1345 port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); 1898 port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH);
1346 port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); 1899 port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE);
1347 port->status_addr = 1900 port->status_addr =
1348 port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); 1901 port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS);
1349 /* special case: control/altstatus doesn't have ATA_REG_ address */ 1902 /* special case: control/altstatus doesn't have ATA_REG_ address */
1350 port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; 1903 port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS;
@@ -1360,14 +1913,92 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio)
1360 /* unmask all EDMA error interrupts */ 1913 /* unmask all EDMA error interrupts */
1361 writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); 1914 writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS);
1362 1915
1363 VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", 1916 VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n",
1364 readl(port_mmio + EDMA_CFG_OFS), 1917 readl(port_mmio + EDMA_CFG_OFS),
1365 readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), 1918 readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS),
1366 readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); 1919 readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS));
1367} 1920}
1368 1921
1922static int mv_chip_id(struct pci_dev *pdev, struct mv_host_priv *hpriv,
1923 unsigned int board_idx)
1924{
1925 u8 rev_id;
1926 u32 hp_flags = hpriv->hp_flags;
1927
1928 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
1929
1930 switch(board_idx) {
1931 case chip_5080:
1932 hpriv->ops = &mv5xxx_ops;
1933 hp_flags |= MV_HP_50XX;
1934
1935 switch (rev_id) {
1936 case 0x1:
1937 hp_flags |= MV_HP_ERRATA_50XXB0;
1938 break;
1939 case 0x3:
1940 hp_flags |= MV_HP_ERRATA_50XXB2;
1941 break;
1942 default:
1943 dev_printk(KERN_WARNING, &pdev->dev,
1944 "Applying 50XXB2 workarounds to unknown rev\n");
1945 hp_flags |= MV_HP_ERRATA_50XXB2;
1946 break;
1947 }
1948 break;
1949
1950 case chip_504x:
1951 case chip_508x:
1952 hpriv->ops = &mv5xxx_ops;
1953 hp_flags |= MV_HP_50XX;
1954
1955 switch (rev_id) {
1956 case 0x0:
1957 hp_flags |= MV_HP_ERRATA_50XXB0;
1958 break;
1959 case 0x3:
1960 hp_flags |= MV_HP_ERRATA_50XXB2;
1961 break;
1962 default:
1963 dev_printk(KERN_WARNING, &pdev->dev,
1964 "Applying B2 workarounds to unknown rev\n");
1965 hp_flags |= MV_HP_ERRATA_50XXB2;
1966 break;
1967 }
1968 break;
1969
1970 case chip_604x:
1971 case chip_608x:
1972 hpriv->ops = &mv6xxx_ops;
1973
1974 switch (rev_id) {
1975 case 0x7:
1976 hp_flags |= MV_HP_ERRATA_60X1B2;
1977 break;
1978 case 0x9:
1979 hp_flags |= MV_HP_ERRATA_60X1C0;
1980 break;
1981 default:
1982 dev_printk(KERN_WARNING, &pdev->dev,
1983 "Applying B2 workarounds to unknown rev\n");
1984 hp_flags |= MV_HP_ERRATA_60X1B2;
1985 break;
1986 }
1987 break;
1988
1989 default:
1990 printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx);
1991 return 1;
1992 }
1993
1994 hpriv->hp_flags = hp_flags;
1995
1996 return 0;
1997}
1998
1369/** 1999/**
1370 * mv_host_init - Perform some early initialization of the host. 2000 * mv_init_host - Perform some early initialization of the host.
2001 * @pdev: host PCI device
1371 * @probe_ent: early data struct representing the host 2002 * @probe_ent: early data struct representing the host
1372 * 2003 *
1373 * If possible, do an early global reset of the host. Then do 2004 * If possible, do an early global reset of the host. Then do
@@ -1376,23 +2007,48 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio)
1376 * LOCKING: 2007 * LOCKING:
1377 * Inherited from caller. 2008 * Inherited from caller.
1378 */ 2009 */
1379static int mv_host_init(struct ata_probe_ent *probe_ent) 2010static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent,
2011 unsigned int board_idx)
1380{ 2012{
1381 int rc = 0, n_hc, port, hc; 2013 int rc = 0, n_hc, port, hc;
1382 void __iomem *mmio = probe_ent->mmio_base; 2014 void __iomem *mmio = probe_ent->mmio_base;
1383 void __iomem *port_mmio; 2015 struct mv_host_priv *hpriv = probe_ent->private_data;
1384 2016
1385 if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && 2017 /* global interrupt mask */
1386 mv_global_soft_reset(probe_ent->mmio_base)) { 2018 writel(0, mmio + HC_MAIN_IRQ_MASK_OFS);
1387 rc = 1; 2019
2020 rc = mv_chip_id(pdev, hpriv, board_idx);
2021 if (rc)
1388 goto done; 2022 goto done;
1389 }
1390 2023
1391 n_hc = mv_get_hc_count(probe_ent->host_flags); 2024 n_hc = mv_get_hc_count(probe_ent->host_flags);
1392 probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; 2025 probe_ent->n_ports = MV_PORTS_PER_HC * n_hc;
1393 2026
2027 for (port = 0; port < probe_ent->n_ports; port++)
2028 hpriv->ops->read_preamp(hpriv, port, mmio);
2029
2030 rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc);
2031 if (rc)
2032 goto done;
2033
2034 hpriv->ops->reset_flash(hpriv, mmio);
2035 hpriv->ops->reset_bus(pdev, mmio);
2036 hpriv->ops->enable_leds(hpriv, mmio);
2037
1394 for (port = 0; port < probe_ent->n_ports; port++) { 2038 for (port = 0; port < probe_ent->n_ports; port++) {
1395 port_mmio = mv_port_base(mmio, port); 2039 if (IS_60XX(hpriv)) {
2040 void __iomem *port_mmio = mv_port_base(mmio, port);
2041
2042 u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);
2043 ifctl |= (1 << 12);
2044 writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);
2045 }
2046
2047 hpriv->ops->phy_errata(hpriv, mmio, port);
2048 }
2049
2050 for (port = 0; port < probe_ent->n_ports; port++) {
2051 void __iomem *port_mmio = mv_port_base(mmio, port);
1396 mv_port_init(&probe_ent->port[port], port_mmio); 2052 mv_port_init(&probe_ent->port[port], port_mmio);
1397 } 2053 }
1398 2054
@@ -1416,11 +2072,12 @@ static int mv_host_init(struct ata_probe_ent *probe_ent)
1416 writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); 2072 writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS);
1417 2073
1418 VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " 2074 VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x "
1419 "PCI int cause/mask=0x%08x/0x%08x\n", 2075 "PCI int cause/mask=0x%08x/0x%08x\n",
1420 readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), 2076 readl(mmio + HC_MAIN_IRQ_CAUSE_OFS),
1421 readl(mmio + HC_MAIN_IRQ_MASK_OFS), 2077 readl(mmio + HC_MAIN_IRQ_MASK_OFS),
1422 readl(mmio + PCI_IRQ_CAUSE_OFS), 2078 readl(mmio + PCI_IRQ_CAUSE_OFS),
1423 readl(mmio + PCI_IRQ_MASK_OFS)); 2079 readl(mmio + PCI_IRQ_MASK_OFS));
2080
1424done: 2081done:
1425 return rc; 2082 return rc;
1426} 2083}
@@ -1456,7 +2113,7 @@ static void mv_print_info(struct ata_probe_ent *probe_ent)
1456 2113
1457 dev_printk(KERN_INFO, &pdev->dev, 2114 dev_printk(KERN_INFO, &pdev->dev,
1458 "%u slots %u ports %s mode IRQ via %s\n", 2115 "%u slots %u ports %s mode IRQ via %s\n",
1459 (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, 2116 (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports,
1460 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); 2117 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
1461} 2118}
1462 2119
@@ -1526,7 +2183,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1526 probe_ent->private_data = hpriv; 2183 probe_ent->private_data = hpriv;
1527 2184
1528 /* initialize adapter */ 2185 /* initialize adapter */
1529 rc = mv_host_init(probe_ent); 2186 rc = mv_init_host(pdev, probe_ent, board_idx);
1530 if (rc) { 2187 if (rc) {
1531 goto err_out_hpriv; 2188 goto err_out_hpriv;
1532 } 2189 }
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 37a4fae95ed4..4954896dfdb9 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -137,7 +137,7 @@ enum nv_host_type
137 CK804 137 CK804
138}; 138};
139 139
140static struct pci_device_id nv_pci_tbl[] = { 140static const struct pci_device_id nv_pci_tbl[] = {
141 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA, 141 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA,
142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, NFORCE2 }, 142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, NFORCE2 },
143 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, 143 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA,
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 9edc9d91efc3..2691625f9bce 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.02" 49#define DRV_VERSION "1.03"
50 50
51 51
52enum { 52enum {
@@ -70,6 +70,9 @@ enum {
70 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ 70 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */
71 71
72 PDC_RESET = (1 << 11), /* HDMA reset */ 72 PDC_RESET = (1 << 11), /* HDMA reset */
73
74 PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST |
75 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI,
73}; 76};
74 77
75 78
@@ -162,8 +165,7 @@ static struct ata_port_info pdc_port_info[] = {
162 /* board_2037x */ 165 /* board_2037x */
163 { 166 {
164 .sht = &pdc_ata_sht, 167 .sht = &pdc_ata_sht,
165 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 168 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
166 ATA_FLAG_SRST | ATA_FLAG_MMIO,
167 .pio_mask = 0x1f, /* pio0-4 */ 169 .pio_mask = 0x1f, /* pio0-4 */
168 .mwdma_mask = 0x07, /* mwdma0-2 */ 170 .mwdma_mask = 0x07, /* mwdma0-2 */
169 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 171 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -173,8 +175,7 @@ static struct ata_port_info pdc_port_info[] = {
173 /* board_20319 */ 175 /* board_20319 */
174 { 176 {
175 .sht = &pdc_ata_sht, 177 .sht = &pdc_ata_sht,
176 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 178 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
177 ATA_FLAG_SRST | ATA_FLAG_MMIO,
178 .pio_mask = 0x1f, /* pio0-4 */ 179 .pio_mask = 0x1f, /* pio0-4 */
179 .mwdma_mask = 0x07, /* mwdma0-2 */ 180 .mwdma_mask = 0x07, /* mwdma0-2 */
180 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 181 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -184,8 +185,7 @@ static struct ata_port_info pdc_port_info[] = {
184 /* board_20619 */ 185 /* board_20619 */
185 { 186 {
186 .sht = &pdc_ata_sht, 187 .sht = &pdc_ata_sht,
187 .host_flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | 188 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
188 ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS,
189 .pio_mask = 0x1f, /* pio0-4 */ 189 .pio_mask = 0x1f, /* pio0-4 */
190 .mwdma_mask = 0x07, /* mwdma0-2 */ 190 .mwdma_mask = 0x07, /* mwdma0-2 */
191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -193,7 +193,7 @@ static struct ata_port_info pdc_port_info[] = {
193 }, 193 },
194}; 194};
195 195
196static struct pci_device_id pdc_ata_pci_tbl[] = { 196static const struct pci_device_id pdc_ata_pci_tbl[] = {
197 { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 197 { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
198 board_2037x }, 198 board_2037x },
199 { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 199 { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index d274ab235781..a8987f5ff5cc 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -41,7 +41,7 @@
41#include <linux/libata.h> 41#include <linux/libata.h>
42 42
43#define DRV_NAME "sata_qstor" 43#define DRV_NAME "sata_qstor"
44#define DRV_VERSION "0.04" 44#define DRV_VERSION "0.05"
45 45
46enum { 46enum {
47 QS_PORTS = 4, 47 QS_PORTS = 4,
@@ -184,7 +184,7 @@ static struct ata_port_info qs_port_info[] = {
184 }, 184 },
185}; 185};
186 186
187static struct pci_device_id qs_ata_pci_tbl[] = { 187static const struct pci_device_id qs_ata_pci_tbl[] = {
188 { PCI_VENDOR_ID_PDC, 0x2068, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 188 { PCI_VENDOR_ID_PDC, 0x2068, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
189 board_2068_idx }, 189 board_2068_idx },
190 190
@@ -268,7 +268,7 @@ static void qs_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
268 writel(val, (void __iomem *)(ap->ioaddr.scr_addr + (sc_reg * 8))); 268 writel(val, (void __iomem *)(ap->ioaddr.scr_addr + (sc_reg * 8)));
269} 269}
270 270
271static void qs_fill_sg(struct ata_queued_cmd *qc) 271static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
272{ 272{
273 struct scatterlist *sg; 273 struct scatterlist *sg;
274 struct ata_port *ap = qc->ap; 274 struct ata_port *ap = qc->ap;
@@ -296,6 +296,8 @@ static void qs_fill_sg(struct ata_queued_cmd *qc)
296 (unsigned long long)addr, len); 296 (unsigned long long)addr, len);
297 nelem++; 297 nelem++;
298 } 298 }
299
300 return nelem;
299} 301}
300 302
301static void qs_qc_prep(struct ata_queued_cmd *qc) 303static void qs_qc_prep(struct ata_queued_cmd *qc)
@@ -304,6 +306,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
304 u8 dflags = QS_DF_PORD, *buf = pp->pkt; 306 u8 dflags = QS_DF_PORD, *buf = pp->pkt;
305 u8 hflags = QS_HF_DAT | QS_HF_IEN | QS_HF_VLD; 307 u8 hflags = QS_HF_DAT | QS_HF_IEN | QS_HF_VLD;
306 u64 addr; 308 u64 addr;
309 unsigned int nelem;
307 310
308 VPRINTK("ENTER\n"); 311 VPRINTK("ENTER\n");
309 312
@@ -313,7 +316,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
313 return; 316 return;
314 } 317 }
315 318
316 qs_fill_sg(qc); 319 nelem = qs_fill_sg(qc);
317 320
318 if ((qc->tf.flags & ATA_TFLAG_WRITE)) 321 if ((qc->tf.flags & ATA_TFLAG_WRITE))
319 hflags |= QS_HF_DIRO; 322 hflags |= QS_HF_DIRO;
@@ -324,7 +327,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
324 buf[ 0] = QS_HCB_HDR; 327 buf[ 0] = QS_HCB_HDR;
325 buf[ 1] = hflags; 328 buf[ 1] = hflags;
326 *(__le32 *)(&buf[ 4]) = cpu_to_le32(qc->nsect * ATA_SECT_SIZE); 329 *(__le32 *)(&buf[ 4]) = cpu_to_le32(qc->nsect * ATA_SECT_SIZE);
327 *(__le32 *)(&buf[ 8]) = cpu_to_le32(qc->n_elem); 330 *(__le32 *)(&buf[ 8]) = cpu_to_le32(nelem);
328 addr = ((u64)pp->pkt_dma) + QS_CPB_BYTES; 331 addr = ((u64)pp->pkt_dma) + QS_CPB_BYTES;
329 *(__le64 *)(&buf[16]) = cpu_to_le64(addr); 332 *(__le64 *)(&buf[16]) = cpu_to_le64(addr);
330 333
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index d0e3c3c6c25f..36091868560d 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -87,7 +87,7 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
87static void sil_post_set_mode (struct ata_port *ap); 87static void sil_post_set_mode (struct ata_port *ap);
88 88
89 89
90static struct pci_device_id sil_pci_tbl[] = { 90static const struct pci_device_id sil_pci_tbl[] = {
91 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 91 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
92 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 92 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
93 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 93 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 4682a50650b4..e0d6f194f54f 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -5,17 +5,6 @@
5 * 5 *
6 * Based on preview driver from Silicon Image. 6 * Based on preview driver from Silicon Image.
7 * 7 *
8 * NOTE: No NCQ/ATAPI support yet. The preview driver didn't support
9 * NCQ nor ATAPI, and, unfortunately, I couldn't find out how to make
10 * those work. Enabling those shouldn't be difficult. Basic
11 * structure is all there (in libata-dev tree). If you have any
12 * information about this hardware, please contact me or linux-ide.
13 * Info is needed on...
14 *
15 * - How to issue tagged commands and turn on sactive on issue accordingly.
16 * - Where to put an ATAPI command and how to tell the device to send it.
17 * - How to enable/use 64bit.
18 *
19 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
20 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
21 * Free Software Foundation; either version 2, or (at your option) any 10 * Free Software Foundation; either version 2, or (at your option) any
@@ -42,7 +31,7 @@
42#include <asm/io.h> 31#include <asm/io.h>
43 32
44#define DRV_NAME "sata_sil24" 33#define DRV_NAME "sata_sil24"
45#define DRV_VERSION "0.22" /* Silicon Image's preview driver was 0.10 */ 34#define DRV_VERSION "0.23"
46 35
47/* 36/*
48 * Port request block (PRB) 32 bytes 37 * Port request block (PRB) 32 bytes
@@ -139,6 +128,7 @@ enum {
139 PORT_CS_DEV_RST = (1 << 1), /* device reset */ 128 PORT_CS_DEV_RST = (1 << 1), /* device reset */
140 PORT_CS_INIT = (1 << 2), /* port initialize */ 129 PORT_CS_INIT = (1 << 2), /* port initialize */
141 PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ 130 PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */
131 PORT_CS_CDB16 = (1 << 5), /* 0=12b cdb, 1=16b cdb */
142 PORT_CS_RESUME = (1 << 6), /* port resume */ 132 PORT_CS_RESUME = (1 << 6), /* port resume */
143 PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ 133 PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */
144 PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ 134 PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */
@@ -188,11 +178,29 @@ enum {
188 PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ 178 PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */
189 PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ 179 PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */
190 180
181 /* bits of PRB control field */
182 PRB_CTRL_PROTOCOL = (1 << 0), /* override def. ATA protocol */
183 PRB_CTRL_PACKET_READ = (1 << 4), /* PACKET cmd read */
184 PRB_CTRL_PACKET_WRITE = (1 << 5), /* PACKET cmd write */
185 PRB_CTRL_NIEN = (1 << 6), /* Mask completion irq */
186 PRB_CTRL_SRST = (1 << 7), /* Soft reset request (ign BSY?) */
187
188 /* PRB protocol field */
189 PRB_PROT_PACKET = (1 << 0),
190 PRB_PROT_TCQ = (1 << 1),
191 PRB_PROT_NCQ = (1 << 2),
192 PRB_PROT_READ = (1 << 3),
193 PRB_PROT_WRITE = (1 << 4),
194 PRB_PROT_TRANSPARENT = (1 << 5),
195
191 /* 196 /*
192 * Other constants 197 * Other constants
193 */ 198 */
194 SGE_TRM = (1 << 31), /* Last SGE in chain */ 199 SGE_TRM = (1 << 31), /* Last SGE in chain */
195 PRB_SOFT_RST = (1 << 7), /* Soft reset request (ign BSY?) */ 200 SGE_LNK = (1 << 30), /* linked list
201 Points to SGT, not SGE */
202 SGE_DRD = (1 << 29), /* discard data read (/dev/null)
203 data address ignored */
196 204
197 /* board id */ 205 /* board id */
198 BID_SIL3124 = 0, 206 BID_SIL3124 = 0,
@@ -202,11 +210,22 @@ enum {
202 IRQ_STAT_4PORTS = 0xf, 210 IRQ_STAT_4PORTS = 0xf,
203}; 211};
204 212
205struct sil24_cmd_block { 213struct sil24_ata_block {
206 struct sil24_prb prb; 214 struct sil24_prb prb;
207 struct sil24_sge sge[LIBATA_MAX_PRD]; 215 struct sil24_sge sge[LIBATA_MAX_PRD];
208}; 216};
209 217
218struct sil24_atapi_block {
219 struct sil24_prb prb;
220 u8 cdb[16];
221 struct sil24_sge sge[LIBATA_MAX_PRD - 1];
222};
223
224union sil24_cmd_block {
225 struct sil24_ata_block ata;
226 struct sil24_atapi_block atapi;
227};
228
210/* 229/*
211 * ap->private_data 230 * ap->private_data
212 * 231 *
@@ -214,7 +233,7 @@ struct sil24_cmd_block {
214 * here from the previous interrupt. 233 * here from the previous interrupt.
215 */ 234 */
216struct sil24_port_priv { 235struct sil24_port_priv {
217 struct sil24_cmd_block *cmd_block; /* 32 cmd blocks */ 236 union sil24_cmd_block *cmd_block; /* 32 cmd blocks */
218 dma_addr_t cmd_block_dma; /* DMA base addr for them */ 237 dma_addr_t cmd_block_dma; /* DMA base addr for them */
219 struct ata_taskfile tf; /* Cached taskfile registers */ 238 struct ata_taskfile tf; /* Cached taskfile registers */
220}; 239};
@@ -225,6 +244,7 @@ struct sil24_host_priv {
225 void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */ 244 void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */
226}; 245};
227 246
247static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev);
228static u8 sil24_check_status(struct ata_port *ap); 248static u8 sil24_check_status(struct ata_port *ap);
229static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); 249static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg);
230static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); 250static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val);
@@ -240,7 +260,7 @@ static void sil24_port_stop(struct ata_port *ap);
240static void sil24_host_stop(struct ata_host_set *host_set); 260static void sil24_host_stop(struct ata_host_set *host_set);
241static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 261static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
242 262
243static struct pci_device_id sil24_pci_tbl[] = { 263static const struct pci_device_id sil24_pci_tbl[] = {
244 { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, 264 { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 },
245 { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, 265 { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 },
246 { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, 266 { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 },
@@ -278,6 +298,8 @@ static struct scsi_host_template sil24_sht = {
278static const struct ata_port_operations sil24_ops = { 298static const struct ata_port_operations sil24_ops = {
279 .port_disable = ata_port_disable, 299 .port_disable = ata_port_disable,
280 300
301 .dev_config = sil24_dev_config,
302
281 .check_status = sil24_check_status, 303 .check_status = sil24_check_status,
282 .check_altstatus = sil24_check_status, 304 .check_altstatus = sil24_check_status,
283 .dev_select = ata_noop_dev_select, 305 .dev_select = ata_noop_dev_select,
@@ -314,7 +336,7 @@ static struct ata_port_info sil24_port_info[] = {
314 { 336 {
315 .sht = &sil24_sht, 337 .sht = &sil24_sht,
316 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 338 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
317 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | 339 ATA_FLAG_SRST | ATA_FLAG_MMIO |
318 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), 340 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4),
319 .pio_mask = 0x1f, /* pio0-4 */ 341 .pio_mask = 0x1f, /* pio0-4 */
320 .mwdma_mask = 0x07, /* mwdma0-2 */ 342 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -325,7 +347,7 @@ static struct ata_port_info sil24_port_info[] = {
325 { 347 {
326 .sht = &sil24_sht, 348 .sht = &sil24_sht,
327 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 349 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
328 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | 350 ATA_FLAG_SRST | ATA_FLAG_MMIO |
329 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), 351 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2),
330 .pio_mask = 0x1f, /* pio0-4 */ 352 .pio_mask = 0x1f, /* pio0-4 */
331 .mwdma_mask = 0x07, /* mwdma0-2 */ 353 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -336,7 +358,7 @@ static struct ata_port_info sil24_port_info[] = {
336 { 358 {
337 .sht = &sil24_sht, 359 .sht = &sil24_sht,
338 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 360 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
339 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | 361 ATA_FLAG_SRST | ATA_FLAG_MMIO |
340 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), 362 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1),
341 .pio_mask = 0x1f, /* pio0-4 */ 363 .pio_mask = 0x1f, /* pio0-4 */
342 .mwdma_mask = 0x07, /* mwdma0-2 */ 364 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -345,6 +367,16 @@ static struct ata_port_info sil24_port_info[] = {
345 }, 367 },
346}; 368};
347 369
370static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev)
371{
372 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
373
374 if (ap->cdb_len == 16)
375 writel(PORT_CS_CDB16, port + PORT_CTRL_STAT);
376 else
377 writel(PORT_CS_CDB16, port + PORT_CTRL_CLR);
378}
379
348static inline void sil24_update_tf(struct ata_port *ap) 380static inline void sil24_update_tf(struct ata_port *ap)
349{ 381{
350 struct sil24_port_priv *pp = ap->private_data; 382 struct sil24_port_priv *pp = ap->private_data;
@@ -396,22 +428,73 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
396 *tf = pp->tf; 428 *tf = pp->tf;
397} 429}
398 430
399static void sil24_phy_reset(struct ata_port *ap) 431static int sil24_issue_SRST(struct ata_port *ap)
400{ 432{
401 __sata_phy_reset(ap); 433 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
434 struct sil24_port_priv *pp = ap->private_data;
435 struct sil24_prb *prb = &pp->cmd_block[0].ata.prb;
436 dma_addr_t paddr = pp->cmd_block_dma;
437 u32 irq_enable, irq_stat;
438 int cnt;
439
440 /* temporarily turn off IRQs during SRST */
441 irq_enable = readl(port + PORT_IRQ_ENABLE_SET);
442 writel(irq_enable, port + PORT_IRQ_ENABLE_CLR);
443
402 /* 444 /*
403 * No ATAPI yet. Just unconditionally indicate ATA device. 445 * XXX: Not sure whether the following sleep is needed or not.
404 * If ATAPI device is attached, it will fail ATA_CMD_ID_ATA 446 * The original driver had it. So....
405 * and libata core will ignore the device.
406 */ 447 */
407 if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) 448 msleep(10);
408 ap->device[0].class = ATA_DEV_ATA; 449
450 prb->ctrl = PRB_CTRL_SRST;
451 prb->fis[1] = 0; /* no PM yet */
452
453 writel((u32)paddr, port + PORT_CMD_ACTIVATE);
454
455 for (cnt = 0; cnt < 100; cnt++) {
456 irq_stat = readl(port + PORT_IRQ_STAT);
457 writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */
458
459 irq_stat >>= PORT_IRQ_RAW_SHIFT;
460 if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
461 break;
462
463 msleep(1);
464 }
465
466 /* restore IRQs */
467 writel(irq_enable, port + PORT_IRQ_ENABLE_SET);
468
469 if (!(irq_stat & PORT_IRQ_COMPLETE))
470 return -1;
471
472 /* update TF */
473 sil24_update_tf(ap);
474 return 0;
475}
476
477static void sil24_phy_reset(struct ata_port *ap)
478{
479 struct sil24_port_priv *pp = ap->private_data;
480
481 __sata_phy_reset(ap);
482 if (ap->flags & ATA_FLAG_PORT_DISABLED)
483 return;
484
485 if (sil24_issue_SRST(ap) < 0) {
486 printk(KERN_ERR DRV_NAME
487 " ata%u: SRST failed, disabling port\n", ap->id);
488 ap->ops->port_disable(ap);
489 return;
490 }
491
492 ap->device->class = ata_dev_classify(&pp->tf);
409} 493}
410 494
411static inline void sil24_fill_sg(struct ata_queued_cmd *qc, 495static inline void sil24_fill_sg(struct ata_queued_cmd *qc,
412 struct sil24_cmd_block *cb) 496 struct sil24_sge *sge)
413{ 497{
414 struct sil24_sge *sge = cb->sge;
415 struct scatterlist *sg; 498 struct scatterlist *sg;
416 unsigned int idx = 0; 499 unsigned int idx = 0;
417 500
@@ -432,23 +515,47 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
432{ 515{
433 struct ata_port *ap = qc->ap; 516 struct ata_port *ap = qc->ap;
434 struct sil24_port_priv *pp = ap->private_data; 517 struct sil24_port_priv *pp = ap->private_data;
435 struct sil24_cmd_block *cb = pp->cmd_block + qc->tag; 518 union sil24_cmd_block *cb = pp->cmd_block + qc->tag;
436 struct sil24_prb *prb = &cb->prb; 519 struct sil24_prb *prb;
520 struct sil24_sge *sge;
437 521
438 switch (qc->tf.protocol) { 522 switch (qc->tf.protocol) {
439 case ATA_PROT_PIO: 523 case ATA_PROT_PIO:
440 case ATA_PROT_DMA: 524 case ATA_PROT_DMA:
441 case ATA_PROT_NODATA: 525 case ATA_PROT_NODATA:
526 prb = &cb->ata.prb;
527 sge = cb->ata.sge;
528 prb->ctrl = 0;
529 break;
530
531 case ATA_PROT_ATAPI:
532 case ATA_PROT_ATAPI_DMA:
533 case ATA_PROT_ATAPI_NODATA:
534 prb = &cb->atapi.prb;
535 sge = cb->atapi.sge;
536 memset(cb->atapi.cdb, 0, 32);
537 memcpy(cb->atapi.cdb, qc->cdb, ap->cdb_len);
538
539 if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) {
540 if (qc->tf.flags & ATA_TFLAG_WRITE)
541 prb->ctrl = PRB_CTRL_PACKET_WRITE;
542 else
543 prb->ctrl = PRB_CTRL_PACKET_READ;
544 } else
545 prb->ctrl = 0;
546
442 break; 547 break;
548
443 default: 549 default:
444 /* ATAPI isn't supported yet */ 550 prb = NULL; /* shut up, gcc */
551 sge = NULL;
445 BUG(); 552 BUG();
446 } 553 }
447 554
448 ata_tf_to_fis(&qc->tf, prb->fis, 0); 555 ata_tf_to_fis(&qc->tf, prb->fis, 0);
449 556
450 if (qc->flags & ATA_QCFLAG_DMAMAP) 557 if (qc->flags & ATA_QCFLAG_DMAMAP)
451 sil24_fill_sg(qc, cb); 558 sil24_fill_sg(qc, sge);
452} 559}
453 560
454static int sil24_qc_issue(struct ata_queued_cmd *qc) 561static int sil24_qc_issue(struct ata_queued_cmd *qc)
@@ -467,6 +574,31 @@ static void sil24_irq_clear(struct ata_port *ap)
467 /* unused */ 574 /* unused */
468} 575}
469 576
577static int __sil24_restart_controller(void __iomem *port)
578{
579 u32 tmp;
580 int cnt;
581
582 writel(PORT_CS_INIT, port + PORT_CTRL_STAT);
583
584 /* Max ~10ms */
585 for (cnt = 0; cnt < 10000; cnt++) {
586 tmp = readl(port + PORT_CTRL_STAT);
587 if (tmp & PORT_CS_RDY)
588 return 0;
589 udelay(1);
590 }
591
592 return -1;
593}
594
595static void sil24_restart_controller(struct ata_port *ap)
596{
597 if (__sil24_restart_controller((void __iomem *)ap->ioaddr.cmd_addr))
598 printk(KERN_ERR DRV_NAME
599 " ata%u: failed to restart controller\n", ap->id);
600}
601
470static int __sil24_reset_controller(void __iomem *port) 602static int __sil24_reset_controller(void __iomem *port)
471{ 603{
472 int cnt; 604 int cnt;
@@ -486,7 +618,11 @@ static int __sil24_reset_controller(void __iomem *port)
486 618
487 if (tmp & PORT_CS_DEV_RST) 619 if (tmp & PORT_CS_DEV_RST)
488 return -1; 620 return -1;
489 return 0; 621
622 if (tmp & PORT_CS_RDY)
623 return 0;
624
625 return __sil24_restart_controller(port);
490} 626}
491 627
492static void sil24_reset_controller(struct ata_port *ap) 628static void sil24_reset_controller(struct ata_port *ap)
@@ -548,9 +684,15 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat)
548 if (serror) 684 if (serror)
549 writel(serror, port + PORT_SERROR); 685 writel(serror, port + PORT_SERROR);
550 686
551 printk(KERN_ERR DRV_NAME " ata%u: error interrupt on port%d\n" 687 /*
552 " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", 688 * Don't log ATAPI device errors. They're supposed to happen
553 ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); 689 * and any serious errors will be logged using sense data by
690 * the SCSI layer.
691 */
692 if (ap->device[0].class != ATA_DEV_ATAPI || cmd_err > PORT_CERR_SDB)
693 printk("ata%u: error interrupt on port%d\n"
694 " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n",
695 ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror);
554 696
555 if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) { 697 if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) {
556 /* 698 /*
@@ -558,6 +700,7 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat)
558 */ 700 */
559 sil24_update_tf(ap); 701 sil24_update_tf(ap);
560 err_mask = ac_err_mask(pp->tf.command); 702 err_mask = ac_err_mask(pp->tf.command);
703 sil24_restart_controller(ap);
561 } else { 704 } else {
562 /* 705 /*
563 * Other errors. libata currently doesn't have any 706 * Other errors. libata currently doesn't have any
@@ -565,12 +708,11 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat)
565 * ATA_ERR. 708 * ATA_ERR.
566 */ 709 */
567 err_mask = AC_ERR_OTHER; 710 err_mask = AC_ERR_OTHER;
711 sil24_reset_controller(ap);
568 } 712 }
569 713
570 if (qc) 714 if (qc)
571 ata_qc_complete(qc, err_mask); 715 ata_qc_complete(qc, err_mask);
572
573 sil24_reset_controller(ap);
574} 716}
575 717
576static inline void sil24_host_intr(struct ata_port *ap) 718static inline void sil24_host_intr(struct ata_port *ap)
@@ -646,7 +788,7 @@ static int sil24_port_start(struct ata_port *ap)
646{ 788{
647 struct device *dev = ap->host_set->dev; 789 struct device *dev = ap->host_set->dev;
648 struct sil24_port_priv *pp; 790 struct sil24_port_priv *pp;
649 struct sil24_cmd_block *cb; 791 union sil24_cmd_block *cb;
650 size_t cb_size = sizeof(*cb); 792 size_t cb_size = sizeof(*cb);
651 dma_addr_t cb_dma; 793 dma_addr_t cb_dma;
652 int rc = -ENOMEM; 794 int rc = -ENOMEM;
@@ -687,6 +829,7 @@ static void sil24_port_stop(struct ata_port *ap)
687 struct sil24_port_priv *pp = ap->private_data; 829 struct sil24_port_priv *pp = ap->private_data;
688 830
689 sil24_cblk_free(pp, dev); 831 sil24_cblk_free(pp, dev);
832 ata_pad_free(ap, dev);
690 kfree(pp); 833 kfree(pp);
691} 834}
692 835
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index 42d7c4e92501..32e12620b162 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -67,7 +67,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
67static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg); 67static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg);
68static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 68static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
69 69
70static struct pci_device_id sis_pci_tbl[] = { 70static const struct pci_device_id sis_pci_tbl[] = {
71 { PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, 71 { PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
72 { PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, 72 { PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
73 { PCI_VENDOR_ID_SI, 0x182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, 73 { PCI_VENDOR_ID_SI, 0x182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index 9895d1caefcf..6e7f7c83a75a 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -54,7 +54,7 @@
54#endif /* CONFIG_PPC_OF */ 54#endif /* CONFIG_PPC_OF */
55 55
56#define DRV_NAME "sata_svw" 56#define DRV_NAME "sata_svw"
57#define DRV_VERSION "1.06" 57#define DRV_VERSION "1.07"
58 58
59/* Taskfile registers offsets */ 59/* Taskfile registers offsets */
60#define K2_SATA_TF_CMD_OFFSET 0x00 60#define K2_SATA_TF_CMD_OFFSET 0x00
@@ -466,7 +466,7 @@ err_out:
466 * 0x24a is device ID for BCM5785 (aka HT1000) HT southbridge integrated SATA 466 * 0x24a is device ID for BCM5785 (aka HT1000) HT southbridge integrated SATA
467 * controller 467 * controller
468 * */ 468 * */
469static struct pci_device_id k2_sata_pci_tbl[] = { 469static const struct pci_device_id k2_sata_pci_tbl[] = {
470 { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, 470 { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
471 { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, 471 { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
472 { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, 472 { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index d5a38784352b..ac7b0d819ebc 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -46,7 +46,7 @@
46#include "sata_promise.h" 46#include "sata_promise.h"
47 47
48#define DRV_NAME "sata_sx4" 48#define DRV_NAME "sata_sx4"
49#define DRV_VERSION "0.7" 49#define DRV_VERSION "0.8"
50 50
51 51
52enum { 52enum {
@@ -220,7 +220,8 @@ static struct ata_port_info pdc_port_info[] = {
220 { 220 {
221 .sht = &pdc_sata_sht, 221 .sht = &pdc_sata_sht,
222 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 222 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
223 ATA_FLAG_SRST | ATA_FLAG_MMIO, 223 ATA_FLAG_SRST | ATA_FLAG_MMIO |
224 ATA_FLAG_NO_ATAPI,
224 .pio_mask = 0x1f, /* pio0-4 */ 225 .pio_mask = 0x1f, /* pio0-4 */
225 .mwdma_mask = 0x07, /* mwdma0-2 */ 226 .mwdma_mask = 0x07, /* mwdma0-2 */
226 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 227 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -229,7 +230,7 @@ static struct ata_port_info pdc_port_info[] = {
229 230
230}; 231};
231 232
232static struct pci_device_id pdc_sata_pci_tbl[] = { 233static const struct pci_device_id pdc_sata_pci_tbl[] = {
233 { PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 234 { PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
234 board_20621 }, 235 board_20621 },
235 { } /* terminate list */ 236 { } /* terminate list */
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index cf0baaa4e045..b2422a0f25c8 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -55,7 +55,7 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
55static u32 uli_scr_read (struct ata_port *ap, unsigned int sc_reg); 55static u32 uli_scr_read (struct ata_port *ap, unsigned int sc_reg);
56static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 56static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
57 57
58static struct pci_device_id uli_pci_tbl[] = { 58static const struct pci_device_id uli_pci_tbl[] = {
59 { PCI_VENDOR_ID_AL, 0x5289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5289 }, 59 { PCI_VENDOR_ID_AL, 0x5289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5289 },
60 { PCI_VENDOR_ID_AL, 0x5287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5287 }, 60 { PCI_VENDOR_ID_AL, 0x5287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5287 },
61 { PCI_VENDOR_ID_AL, 0x5281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5281 }, 61 { PCI_VENDOR_ID_AL, 0x5281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5281 },
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index ab19d2ba2a4b..c76215692da2 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -75,7 +75,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
75static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); 75static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg);
76static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 76static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
77 77
78static struct pci_device_id svia_pci_tbl[] = { 78static const struct pci_device_id svia_pci_tbl[] = {
79 { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, 79 { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 },
80 { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, 80 { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 },
81 81
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index ce8a2fd7da84..fcfa486965b4 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -47,7 +47,7 @@
47#include <linux/libata.h> 47#include <linux/libata.h>
48 48
49#define DRV_NAME "sata_vsc" 49#define DRV_NAME "sata_vsc"
50#define DRV_VERSION "1.0" 50#define DRV_VERSION "1.1"
51 51
52/* Interrupt register offsets (from chip base address) */ 52/* Interrupt register offsets (from chip base address) */
53#define VSC_SATA_INT_STAT_OFFSET 0x00 53#define VSC_SATA_INT_STAT_OFFSET 0x00
@@ -400,7 +400,7 @@ err_out:
400 * 0x8086/0x3200 is the Intel 31244, which is supposed to be identical 400 * 0x8086/0x3200 is the Intel 31244, which is supposed to be identical
401 * compatibility is untested as of yet 401 * compatibility is untested as of yet
402 */ 402 */
403static struct pci_device_id vsc_sata_pci_tbl[] = { 403static const struct pci_device_id vsc_sata_pci_tbl[] = {
404 { 0x1725, 0x7174, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, 404 { 0x1725, 0x7174, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 },
405 { 0x8086, 0x3200, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, 405 { 0x8086, 0x3200, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 },
406 { } 406 { }
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 0be60bba58d3..180676d7115a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -265,10 +265,10 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask)
265 spin_lock_irqsave(&dev->list_lock, flags); 265 spin_lock_irqsave(&dev->list_lock, flags);
266 list_add_tail(&cmd->list, &dev->cmd_list); 266 list_add_tail(&cmd->list, &dev->cmd_list);
267 spin_unlock_irqrestore(&dev->list_lock, flags); 267 spin_unlock_irqrestore(&dev->list_lock, flags);
268 cmd->jiffies_at_alloc = jiffies;
268 } else 269 } else
269 put_device(&dev->sdev_gendev); 270 put_device(&dev->sdev_gendev);
270 271
271 cmd->jiffies_at_alloc = jiffies;
272 return cmd; 272 return cmd;
273} 273}
274EXPORT_SYMBOL(scsi_get_command); 274EXPORT_SYMBOL(scsi_get_command);
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index b61fb1295b8b..3ded9daaf4a0 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -178,7 +178,7 @@ struct sdebug_queued_cmd {
178}; 178};
179static struct sdebug_queued_cmd queued_arr[SCSI_DEBUG_CANQUEUE]; 179static struct sdebug_queued_cmd queued_arr[SCSI_DEBUG_CANQUEUE];
180 180
181static Scsi_Host_Template sdebug_driver_template = { 181static struct scsi_host_template sdebug_driver_template = {
182 .proc_info = scsi_debug_proc_info, 182 .proc_info = scsi_debug_proc_info,
183 .name = "SCSI DEBUG", 183 .name = "SCSI DEBUG",
184 .info = scsi_debug_info, 184 .info = scsi_debug_info,
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 0c5b02d4c7f8..c0ae9e965f6f 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -417,43 +417,20 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
417} 417}
418 418
419/** 419/**
420 * scsi_eh_times_out - timeout function for error handling.
421 * @scmd: Cmd that is timing out.
422 *
423 * Notes:
424 * During error handling, the kernel thread will be sleeping waiting
425 * for some action to complete on the device. our only job is to
426 * record that it timed out, and to wake up the thread.
427 **/
428static void scsi_eh_times_out(struct scsi_cmnd *scmd)
429{
430 scmd->eh_eflags |= SCSI_EH_REC_TIMEOUT;
431 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd:%p\n", __FUNCTION__,
432 scmd));
433
434 up(scmd->device->host->eh_action);
435}
436
437/**
438 * scsi_eh_done - Completion function for error handling. 420 * scsi_eh_done - Completion function for error handling.
439 * @scmd: Cmd that is done. 421 * @scmd: Cmd that is done.
440 **/ 422 **/
441static void scsi_eh_done(struct scsi_cmnd *scmd) 423static void scsi_eh_done(struct scsi_cmnd *scmd)
442{ 424{
443 /* 425 struct completion *eh_action;
444 * if the timeout handler is already running, then just set the
445 * flag which says we finished late, and return. we have no
446 * way of stopping the timeout handler from running, so we must
447 * always defer to it.
448 */
449 if (del_timer(&scmd->eh_timeout)) {
450 scmd->request->rq_status = RQ_SCSI_DONE;
451 426
452 SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n", 427 SCSI_LOG_ERROR_RECOVERY(3,
453 __FUNCTION__, scmd, scmd->result)); 428 printk("%s scmd: %p result: %x\n",
429 __FUNCTION__, scmd, scmd->result));
454 430
455 up(scmd->device->host->eh_action); 431 eh_action = scmd->device->host->eh_action;
456 } 432 if (eh_action)
433 complete(eh_action);
457} 434}
458 435
459/** 436/**
@@ -461,10 +438,6 @@ static void scsi_eh_done(struct scsi_cmnd *scmd)
461 * @scmd: SCSI Cmd to send. 438 * @scmd: SCSI Cmd to send.
462 * @timeout: Timeout for cmd. 439 * @timeout: Timeout for cmd.
463 * 440 *
464 * Notes:
465 * The initialization of the structures is quite a bit different in
466 * this case, and furthermore, there is a different completion handler
467 * vs scsi_dispatch_cmd.
468 * Return value: 441 * Return value:
469 * SUCCESS or FAILED or NEEDS_RETRY 442 * SUCCESS or FAILED or NEEDS_RETRY
470 **/ 443 **/
@@ -472,24 +445,16 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
472{ 445{
473 struct scsi_device *sdev = scmd->device; 446 struct scsi_device *sdev = scmd->device;
474 struct Scsi_Host *shost = sdev->host; 447 struct Scsi_Host *shost = sdev->host;
475 DECLARE_MUTEX_LOCKED(sem); 448 DECLARE_COMPLETION(done);
449 unsigned long timeleft;
476 unsigned long flags; 450 unsigned long flags;
477 int rtn = SUCCESS; 451 int rtn;
478 452
479 /*
480 * we will use a queued command if possible, otherwise we will
481 * emulate the queuing and calling of completion function ourselves.
482 */
483 if (sdev->scsi_level <= SCSI_2) 453 if (sdev->scsi_level <= SCSI_2)
484 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | 454 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) |
485 (sdev->lun << 5 & 0xe0); 455 (sdev->lun << 5 & 0xe0);
486 456
487 scsi_add_timer(scmd, timeout, scsi_eh_times_out); 457 shost->eh_action = &done;
488
489 /*
490 * set up the semaphore so we wait for the command to complete.
491 */
492 shost->eh_action = &sem;
493 scmd->request->rq_status = RQ_SCSI_BUSY; 458 scmd->request->rq_status = RQ_SCSI_BUSY;
494 459
495 spin_lock_irqsave(shost->host_lock, flags); 460 spin_lock_irqsave(shost->host_lock, flags);
@@ -497,47 +462,29 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
497 shost->hostt->queuecommand(scmd, scsi_eh_done); 462 shost->hostt->queuecommand(scmd, scsi_eh_done);
498 spin_unlock_irqrestore(shost->host_lock, flags); 463 spin_unlock_irqrestore(shost->host_lock, flags);
499 464
500 down(&sem); 465 timeleft = wait_for_completion_timeout(&done, timeout);
501 scsi_log_completion(scmd, SUCCESS);
502 466
467 scmd->request->rq_status = RQ_SCSI_DONE;
503 shost->eh_action = NULL; 468 shost->eh_action = NULL;
504 469
505 /* 470 scsi_log_completion(scmd, SUCCESS);
506 * see if timeout. if so, tell the host to forget about it.
507 * in other words, we don't want a callback any more.
508 */
509 if (scmd->eh_eflags & SCSI_EH_REC_TIMEOUT) {
510 scmd->eh_eflags &= ~SCSI_EH_REC_TIMEOUT;
511
512 /*
513 * as far as the low level driver is
514 * concerned, this command is still active, so
515 * we must give the low level driver a chance
516 * to abort it. (db)
517 *
518 * FIXME(eric) - we are not tracking whether we could
519 * abort a timed out command or not. not sure how
520 * we should treat them differently anyways.
521 */
522 if (shost->hostt->eh_abort_handler)
523 shost->hostt->eh_abort_handler(scmd);
524
525 scmd->request->rq_status = RQ_SCSI_DONE;
526 rtn = FAILED;
527 }
528 471
529 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd: %p, rtn:%x\n", 472 SCSI_LOG_ERROR_RECOVERY(3,
530 __FUNCTION__, scmd, rtn)); 473 printk("%s: scmd: %p, timeleft: %ld\n",
474 __FUNCTION__, scmd, timeleft));
531 475
532 /* 476 /*
533 * now examine the actual status codes to see whether the command 477 * If there is time left scsi_eh_done got called, and we will
534 * actually did complete normally. 478 * examine the actual status codes to see whether the command
479 * actually did complete normally, else tell the host to forget
480 * about this command.
535 */ 481 */
536 if (rtn == SUCCESS) { 482 if (timeleft) {
537 rtn = scsi_eh_completed_normally(scmd); 483 rtn = scsi_eh_completed_normally(scmd);
538 SCSI_LOG_ERROR_RECOVERY(3, 484 SCSI_LOG_ERROR_RECOVERY(3,
539 printk("%s: scsi_eh_completed_normally %x\n", 485 printk("%s: scsi_eh_completed_normally %x\n",
540 __FUNCTION__, rtn)); 486 __FUNCTION__, rtn));
487
541 switch (rtn) { 488 switch (rtn) {
542 case SUCCESS: 489 case SUCCESS:
543 case NEEDS_RETRY: 490 case NEEDS_RETRY:
@@ -547,6 +494,15 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
547 rtn = FAILED; 494 rtn = FAILED;
548 break; 495 break;
549 } 496 }
497 } else {
498 /*
499 * FIXME(eric) - we are not tracking whether we could
500 * abort a timed out command or not. not sure how
501 * we should treat them differently anyways.
502 */
503 if (shost->hostt->eh_abort_handler)
504 shost->hostt->eh_abort_handler(scmd);
505 rtn = FAILED;
550 } 506 }
551 507
552 return rtn; 508 return rtn;
@@ -1571,50 +1527,41 @@ static void scsi_unjam_host(struct Scsi_Host *shost)
1571} 1527}
1572 1528
1573/** 1529/**
1574 * scsi_error_handler - Handle errors/timeouts of SCSI cmds. 1530 * scsi_error_handler - SCSI error handler thread
1575 * @data: Host for which we are running. 1531 * @data: Host for which we are running.
1576 * 1532 *
1577 * Notes: 1533 * Notes:
1578 * This is always run in the context of a kernel thread. The idea is 1534 * This is the main error handling loop. This is run as a kernel thread
1579 * that we start this thing up when the kernel starts up (one per host 1535 * for every SCSI host and handles all error handling activity.
1580 * that we detect), and it immediately goes to sleep and waits for some
1581 * event (i.e. failure). When this takes place, we have the job of
1582 * trying to unjam the bus and restarting things.
1583 **/ 1536 **/
1584int scsi_error_handler(void *data) 1537int scsi_error_handler(void *data)
1585{ 1538{
1586 struct Scsi_Host *shost = (struct Scsi_Host *) data; 1539 struct Scsi_Host *shost = data;
1587 int rtn;
1588 1540
1589 current->flags |= PF_NOFREEZE; 1541 current->flags |= PF_NOFREEZE;
1590 1542
1591
1592 /* 1543 /*
1593 * Note - we always use TASK_INTERRUPTIBLE even if the module 1544 * We use TASK_INTERRUPTIBLE so that the thread is not
1594 * was loaded as part of the kernel. The reason is that 1545 * counted against the load average as a running process.
1595 * UNINTERRUPTIBLE would cause this thread to be counted in 1546 * We never actually get interrupted because kthread_run
1596 * the load average as a running process, and an interruptible 1547 * disables singal delivery for the created thread.
1597 * wait doesn't.
1598 */ 1548 */
1599 set_current_state(TASK_INTERRUPTIBLE); 1549 set_current_state(TASK_INTERRUPTIBLE);
1600 while (!kthread_should_stop()) { 1550 while (!kthread_should_stop()) {
1601 if (shost->host_failed == 0 || 1551 if (shost->host_failed == 0 ||
1602 shost->host_failed != shost->host_busy) { 1552 shost->host_failed != shost->host_busy) {
1603 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler" 1553 SCSI_LOG_ERROR_RECOVERY(1,
1604 " scsi_eh_%d" 1554 printk("Error handler scsi_eh_%d sleeping\n",
1605 " sleeping\n", 1555 shost->host_no));
1606 shost->host_no));
1607 schedule(); 1556 schedule();
1608 set_current_state(TASK_INTERRUPTIBLE); 1557 set_current_state(TASK_INTERRUPTIBLE);
1609 continue; 1558 continue;
1610 } 1559 }
1611 1560
1612 __set_current_state(TASK_RUNNING); 1561 __set_current_state(TASK_RUNNING);
1613 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler" 1562 SCSI_LOG_ERROR_RECOVERY(1,
1614 " scsi_eh_%d waking" 1563 printk("Error handler scsi_eh_%d waking up\n",
1615 " up\n",shost->host_no)); 1564 shost->host_no));
1616
1617 shost->eh_active = 1;
1618 1565
1619 /* 1566 /*
1620 * We have a host that is failing for some reason. Figure out 1567 * We have a host that is failing for some reason. Figure out
@@ -1622,12 +1569,10 @@ int scsi_error_handler(void *data)
1622 * If we fail, we end up taking the thing offline. 1569 * If we fail, we end up taking the thing offline.
1623 */ 1570 */
1624 if (shost->hostt->eh_strategy_handler) 1571 if (shost->hostt->eh_strategy_handler)
1625 rtn = shost->hostt->eh_strategy_handler(shost); 1572 shost->hostt->eh_strategy_handler(shost);
1626 else 1573 else
1627 scsi_unjam_host(shost); 1574 scsi_unjam_host(shost);
1628 1575
1629 shost->eh_active = 0;
1630
1631 /* 1576 /*
1632 * Note - if the above fails completely, the action is to take 1577 * Note - if the above fails completely, the action is to take
1633 * individual devices offline and flush the queue of any 1578 * individual devices offline and flush the queue of any
@@ -1638,15 +1583,10 @@ int scsi_error_handler(void *data)
1638 scsi_restart_operations(shost); 1583 scsi_restart_operations(shost);
1639 set_current_state(TASK_INTERRUPTIBLE); 1584 set_current_state(TASK_INTERRUPTIBLE);
1640 } 1585 }
1641
1642 __set_current_state(TASK_RUNNING); 1586 __set_current_state(TASK_RUNNING);
1643 1587
1644 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d" 1588 SCSI_LOG_ERROR_RECOVERY(1,
1645 " exiting\n",shost->host_no)); 1589 printk("Error handler scsi_eh_%d exiting\n", shost->host_no));
1646
1647 /*
1648 * Make sure that nobody tries to wake us up again.
1649 */
1650 shost->ehandler = NULL; 1590 shost->ehandler = NULL;
1651 return 0; 1591 return 0;
1652} 1592}
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e40c8b66da40..dc249cb970ea 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -254,55 +254,6 @@ void scsi_do_req(struct scsi_request *sreq, const void *cmnd,
254} 254}
255EXPORT_SYMBOL(scsi_do_req); 255EXPORT_SYMBOL(scsi_do_req);
256 256
257/* This is the end routine we get to if a command was never attached
258 * to the request. Simply complete the request without changing
259 * rq_status; this will cause a DRIVER_ERROR. */
260static void scsi_wait_req_end_io(struct request *req)
261{
262 BUG_ON(!req->waiting);
263
264 complete(req->waiting);
265}
266
267void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer,
268 unsigned bufflen, int timeout, int retries)
269{
270 DECLARE_COMPLETION(wait);
271 int write = (sreq->sr_data_direction == DMA_TO_DEVICE);
272 struct request *req;
273
274 req = blk_get_request(sreq->sr_device->request_queue, write,
275 __GFP_WAIT);
276 if (bufflen && blk_rq_map_kern(sreq->sr_device->request_queue, req,
277 buffer, bufflen, __GFP_WAIT)) {
278 sreq->sr_result = DRIVER_ERROR << 24;
279 blk_put_request(req);
280 return;
281 }
282
283 req->flags |= REQ_NOMERGE;
284 req->waiting = &wait;
285 req->end_io = scsi_wait_req_end_io;
286 req->cmd_len = COMMAND_SIZE(((u8 *)cmnd)[0]);
287 req->sense = sreq->sr_sense_buffer;
288 req->sense_len = 0;
289 memcpy(req->cmd, cmnd, req->cmd_len);
290 req->timeout = timeout;
291 req->flags |= REQ_BLOCK_PC;
292 req->rq_disk = NULL;
293 blk_insert_request(sreq->sr_device->request_queue, req,
294 sreq->sr_data_direction == DMA_TO_DEVICE, NULL);
295 wait_for_completion(&wait);
296 sreq->sr_request->waiting = NULL;
297 sreq->sr_result = req->errors;
298 if (req->errors)
299 sreq->sr_result |= (DRIVER_ERROR << 24);
300
301 blk_put_request(req);
302}
303
304EXPORT_SYMBOL(scsi_wait_req);
305
306/** 257/**
307 * scsi_execute - insert request and wait for the result 258 * scsi_execute - insert request and wait for the result
308 * @sdev: scsi device 259 * @sdev: scsi device
@@ -591,10 +542,17 @@ static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
591 542
592void scsi_next_command(struct scsi_cmnd *cmd) 543void scsi_next_command(struct scsi_cmnd *cmd)
593{ 544{
594 struct request_queue *q = cmd->device->request_queue; 545 struct scsi_device *sdev = cmd->device;
546 struct request_queue *q = sdev->request_queue;
547
548 /* need to hold a reference on the device before we let go of the cmd */
549 get_device(&sdev->sdev_gendev);
595 550
596 scsi_put_command(cmd); 551 scsi_put_command(cmd);
597 scsi_run_queue(q); 552 scsi_run_queue(q);
553
554 /* ok to remove device now */
555 put_device(&sdev->sdev_gendev);
598} 556}
599 557
600void scsi_run_host_queues(struct Scsi_Host *shost) 558void scsi_run_host_queues(struct Scsi_Host *shost)
@@ -1127,6 +1085,26 @@ static void scsi_generic_done(struct scsi_cmnd *cmd)
1127 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0); 1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0);
1128} 1086}
1129 1087
1088void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries)
1089{
1090 struct request *req = cmd->request;
1091
1092 BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd));
1093 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
1094 cmd->cmd_len = req->cmd_len;
1095 if (!req->data_len)
1096 cmd->sc_data_direction = DMA_NONE;
1097 else if (rq_data_dir(req) == WRITE)
1098 cmd->sc_data_direction = DMA_TO_DEVICE;
1099 else
1100 cmd->sc_data_direction = DMA_FROM_DEVICE;
1101
1102 cmd->transfersize = req->data_len;
1103 cmd->allowed = retries;
1104 cmd->timeout_per_command = req->timeout;
1105}
1106EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd);
1107
1130static int scsi_prep_fn(struct request_queue *q, struct request *req) 1108static int scsi_prep_fn(struct request_queue *q, struct request *req)
1131{ 1109{
1132 struct scsi_device *sdev = q->queuedata; 1110 struct scsi_device *sdev = q->queuedata;
@@ -1262,18 +1240,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1262 goto kill; 1240 goto kill;
1263 } 1241 }
1264 } else { 1242 } else {
1265 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); 1243 scsi_setup_blk_pc_cmnd(cmd, 3);
1266 cmd->cmd_len = req->cmd_len;
1267 if (rq_data_dir(req) == WRITE)
1268 cmd->sc_data_direction = DMA_TO_DEVICE;
1269 else if (req->data_len)
1270 cmd->sc_data_direction = DMA_FROM_DEVICE;
1271 else
1272 cmd->sc_data_direction = DMA_NONE;
1273
1274 cmd->transfersize = req->data_len;
1275 cmd->allowed = 3;
1276 cmd->timeout_per_command = req->timeout;
1277 cmd->done = scsi_generic_done; 1244 cmd->done = scsi_generic_done;
1278 } 1245 }
1279 } 1246 }
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index d05f778d31a8..d632d9e1493c 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -22,7 +22,6 @@ struct Scsi_Host;
22 * Scsi Error Handler Flags 22 * Scsi Error Handler Flags
23 */ 23 */
24#define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */ 24#define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */
25#define SCSI_EH_REC_TIMEOUT 0x0002 /* EH retry timed out */
26 25
27#define SCSI_SENSE_VALID(scmd) \ 26#define SCSI_SENSE_VALID(scmd) \
28 (((scmd)->sense_buffer[0] & 0x70) == 0x70) 27 (((scmd)->sense_buffer[0] & 0x70) == 0x70)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 7eb3a2d40dc5..4e6709f448e1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -9,7 +9,7 @@
9 * global variable (boot or module load time) settings. 9 * global variable (boot or module load time) settings.
10 * 10 *
11 * A specific LUN is scanned via an INQUIRY command; if the LUN has a 11 * A specific LUN is scanned via an INQUIRY command; if the LUN has a
12 * device attached, a Scsi_Device is allocated and setup for it. 12 * device attached, a scsi_device is allocated and setup for it.
13 * 13 *
14 * For every id of every channel on the given host: 14 * For every id of every channel on the given host:
15 * 15 *
@@ -17,7 +17,7 @@
17 * device or storage attached to LUN 0): 17 * device or storage attached to LUN 0):
18 * 18 *
19 * If LUN 0 has a device attached, allocate and setup a 19 * If LUN 0 has a device attached, allocate and setup a
20 * Scsi_Device for it. 20 * scsi_device for it.
21 * 21 *
22 * If target is SCSI-3 or up, issue a REPORT LUN, and scan 22 * If target is SCSI-3 or up, issue a REPORT LUN, and scan
23 * all of the LUNs returned by the REPORT LUN; else, 23 * all of the LUNs returned by the REPORT LUN; else,
@@ -266,8 +266,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
266 /* 266 /*
267 * if LLDD reports slave not present, don't clutter 267 * if LLDD reports slave not present, don't clutter
268 * console with alloc failure messages 268 * console with alloc failure messages
269
270
271 */ 269 */
272 if (ret == -ENXIO) 270 if (ret == -ENXIO)
273 display_failure_msg = 0; 271 display_failure_msg = 0;
@@ -279,7 +277,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
279 277
280out_device_destroy: 278out_device_destroy:
281 transport_destroy_device(&sdev->sdev_gendev); 279 transport_destroy_device(&sdev->sdev_gendev);
282 scsi_free_queue(sdev->request_queue);
283 put_device(&sdev->sdev_gendev); 280 put_device(&sdev->sdev_gendev);
284out: 281out:
285 if (display_failure_msg) 282 if (display_failure_msg)
@@ -403,6 +400,36 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
403 return found_target; 400 return found_target;
404} 401}
405 402
403struct work_queue_wrapper {
404 struct work_struct work;
405 struct scsi_target *starget;
406};
407
408static void scsi_target_reap_work(void *data) {
409 struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
410 struct scsi_target *starget = wqw->starget;
411 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
412 unsigned long flags;
413
414 kfree(wqw);
415
416 spin_lock_irqsave(shost->host_lock, flags);
417
418 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
419 list_del_init(&starget->siblings);
420 spin_unlock_irqrestore(shost->host_lock, flags);
421 transport_remove_device(&starget->dev);
422 device_del(&starget->dev);
423 transport_destroy_device(&starget->dev);
424 put_device(&starget->dev);
425 return;
426
427 }
428 spin_unlock_irqrestore(shost->host_lock, flags);
429
430 return;
431}
432
406/** 433/**
407 * scsi_target_reap - check to see if target is in use and destroy if not 434 * scsi_target_reap - check to see if target is in use and destroy if not
408 * 435 *
@@ -414,19 +441,18 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
414 */ 441 */
415void scsi_target_reap(struct scsi_target *starget) 442void scsi_target_reap(struct scsi_target *starget)
416{ 443{
417 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 444 struct work_queue_wrapper *wqw =
418 unsigned long flags; 445 kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC);
419 spin_lock_irqsave(shost->host_lock, flags);
420 446
421 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { 447 if (!wqw) {
422 list_del_init(&starget->siblings); 448 starget_printk(KERN_ERR, starget,
423 spin_unlock_irqrestore(shost->host_lock, flags); 449 "Failed to allocate memory in scsi_reap_target()\n");
424 device_del(&starget->dev);
425 transport_unregister_device(&starget->dev);
426 put_device(&starget->dev);
427 return; 450 return;
428 } 451 }
429 spin_unlock_irqrestore(shost->host_lock, flags); 452
453 INIT_WORK(&wqw->work, scsi_target_reap_work, wqw);
454 wqw->starget = starget;
455 schedule_work(&wqw->work);
430} 456}
431 457
432/** 458/**
@@ -441,7 +467,7 @@ void scsi_target_reap(struct scsi_target *starget)
441 * 467 *
442 * If the INQUIRY is successful, zero is returned and the 468 * If the INQUIRY is successful, zero is returned and the
443 * INQUIRY data is in @inq_result; the scsi_level and INQUIRY length 469 * INQUIRY data is in @inq_result; the scsi_level and INQUIRY length
444 * are copied to the Scsi_Device any flags value is stored in *@bflags. 470 * are copied to the scsi_device any flags value is stored in *@bflags.
445 **/ 471 **/
446static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, 472static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result,
447 int result_len, int *bflags) 473 int result_len, int *bflags)
@@ -509,8 +535,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result,
509 /* 535 /*
510 * Get any flags for this device. 536 * Get any flags for this device.
511 * 537 *
512 * XXX add a bflags to Scsi_Device, and replace the 538 * XXX add a bflags to scsi_device, and replace the
513 * corresponding bit fields in Scsi_Device, so bflags 539 * corresponding bit fields in scsi_device, so bflags
514 * need not be passed as an argument. 540 * need not be passed as an argument.
515 */ 541 */
516 *bflags = scsi_get_device_flags(sdev, &inq_result[8], 542 *bflags = scsi_get_device_flags(sdev, &inq_result[8],
@@ -592,21 +618,21 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result,
592} 618}
593 619
594/** 620/**
595 * scsi_add_lun - allocate and fully initialze a Scsi_Device 621 * scsi_add_lun - allocate and fully initialze a scsi_device
596 * @sdevscan: holds information to be stored in the new Scsi_Device 622 * @sdevscan: holds information to be stored in the new scsi_device
597 * @sdevnew: store the address of the newly allocated Scsi_Device 623 * @sdevnew: store the address of the newly allocated scsi_device
598 * @inq_result: holds the result of a previous INQUIRY to the LUN 624 * @inq_result: holds the result of a previous INQUIRY to the LUN
599 * @bflags: black/white list flag 625 * @bflags: black/white list flag
600 * 626 *
601 * Description: 627 * Description:
602 * Allocate and initialize a Scsi_Device matching sdevscan. Optionally 628 * Allocate and initialize a scsi_device matching sdevscan. Optionally
603 * set fields based on values in *@bflags. If @sdevnew is not 629 * set fields based on values in *@bflags. If @sdevnew is not
604 * NULL, store the address of the new Scsi_Device in *@sdevnew (needed 630 * NULL, store the address of the new scsi_device in *@sdevnew (needed
605 * when scanning a particular LUN). 631 * when scanning a particular LUN).
606 * 632 *
607 * Return: 633 * Return:
608 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a Scsi_Device 634 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device
609 * SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized 635 * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized
610 **/ 636 **/
611static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) 637static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
612{ 638{
@@ -674,7 +700,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
674 * 700 *
675 * The above is vague, as it implies that we could treat 001 and 701 * The above is vague, as it implies that we could treat 001 and
676 * 011 the same. Stay compatible with previous code, and create a 702 * 011 the same. Stay compatible with previous code, and create a
677 * Scsi_Device for a PQ of 1 703 * scsi_device for a PQ of 1
678 * 704 *
679 * Don't set the device offline here; rather let the upper 705 * Don't set the device offline here; rather let the upper
680 * level drivers eval the PQ to decide whether they should 706 * level drivers eval the PQ to decide whether they should
@@ -784,8 +810,8 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
784 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it 810 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
785 * @starget: pointer to target device structure 811 * @starget: pointer to target device structure
786 * @lun: LUN of target device 812 * @lun: LUN of target device
787 * @sdevscan: probe the LUN corresponding to this Scsi_Device 813 * @sdevscan: probe the LUN corresponding to this scsi_device
788 * @sdevnew: store the value of any new Scsi_Device allocated 814 * @sdevnew: store the value of any new scsi_device allocated
789 * @bflagsp: store bflags here if not NULL 815 * @bflagsp: store bflags here if not NULL
790 * 816 *
791 * Description: 817 * Description:
@@ -793,10 +819,10 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
793 * allocate and set it up by calling scsi_add_lun. 819 * allocate and set it up by calling scsi_add_lun.
794 * 820 *
795 * Return: 821 * Return:
796 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a Scsi_Device 822 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device
797 * SCSI_SCAN_TARGET_PRESENT: target responded, but no device is 823 * SCSI_SCAN_TARGET_PRESENT: target responded, but no device is
798 * attached at the LUN 824 * attached at the LUN
799 * SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized 825 * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized
800 **/ 826 **/
801static int scsi_probe_and_add_lun(struct scsi_target *starget, 827static int scsi_probe_and_add_lun(struct scsi_target *starget,
802 uint lun, int *bflagsp, 828 uint lun, int *bflagsp,
@@ -1046,7 +1072,7 @@ EXPORT_SYMBOL(int_to_scsilun);
1046 1072
1047/** 1073/**
1048 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results 1074 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results
1049 * @sdevscan: scan the host, channel, and id of this Scsi_Device 1075 * @sdevscan: scan the host, channel, and id of this scsi_device
1050 * 1076 *
1051 * Description: 1077 * Description:
1052 * If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN 1078 * If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN
@@ -1074,6 +1100,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1074 struct scsi_sense_hdr sshdr; 1100 struct scsi_sense_hdr sshdr;
1075 struct scsi_device *sdev; 1101 struct scsi_device *sdev;
1076 struct Scsi_Host *shost = dev_to_shost(&starget->dev); 1102 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1103 int ret = 0;
1077 1104
1078 /* 1105 /*
1079 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. 1106 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set.
@@ -1169,8 +1196,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1169 /* 1196 /*
1170 * The device probably does not support a REPORT LUN command 1197 * The device probably does not support a REPORT LUN command
1171 */ 1198 */
1172 kfree(lun_data); 1199 ret = 1;
1173 return 1; 1200 goto out_err;
1174 } 1201 }
1175 1202
1176 /* 1203 /*
@@ -1238,6 +1265,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1238 } 1265 }
1239 } 1266 }
1240 1267
1268 out_err:
1241 kfree(lun_data); 1269 kfree(lun_data);
1242 out: 1270 out:
1243 scsi_device_put(sdev); 1271 scsi_device_put(sdev);
@@ -1246,7 +1274,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1246 * the sdev we used didn't appear in the report luns scan 1274 * the sdev we used didn't appear in the report luns scan
1247 */ 1275 */
1248 scsi_destroy_sdev(sdev); 1276 scsi_destroy_sdev(sdev);
1249 return 0; 1277 return ret;
1250} 1278}
1251 1279
1252struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, 1280struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
@@ -1472,16 +1500,16 @@ void scsi_forget_host(struct Scsi_Host *shost)
1472/* 1500/*
1473 * Function: scsi_get_host_dev() 1501 * Function: scsi_get_host_dev()
1474 * 1502 *
1475 * Purpose: Create a Scsi_Device that points to the host adapter itself. 1503 * Purpose: Create a scsi_device that points to the host adapter itself.
1476 * 1504 *
1477 * Arguments: SHpnt - Host that needs a Scsi_Device 1505 * Arguments: SHpnt - Host that needs a scsi_device
1478 * 1506 *
1479 * Lock status: None assumed. 1507 * Lock status: None assumed.
1480 * 1508 *
1481 * Returns: The Scsi_Device or NULL 1509 * Returns: The scsi_device or NULL
1482 * 1510 *
1483 * Notes: 1511 * Notes:
1484 * Attach a single Scsi_Device to the Scsi_Host - this should 1512 * Attach a single scsi_device to the Scsi_Host - this should
1485 * be made to look like a "pseudo-device" that points to the 1513 * be made to look like a "pseudo-device" that points to the
1486 * HA itself. 1514 * HA itself.
1487 * 1515 *
@@ -1518,7 +1546,7 @@ EXPORT_SYMBOL(scsi_get_host_dev);
1518 * 1546 *
1519 * Purpose: Free a scsi_device that points to the host adapter itself. 1547 * Purpose: Free a scsi_device that points to the host adapter itself.
1520 * 1548 *
1521 * Arguments: SHpnt - Host that needs a Scsi_Device 1549 * Arguments: SHpnt - Host that needs a scsi_device
1522 * 1550 *
1523 * Lock status: None assumed. 1551 * Lock status: None assumed.
1524 * 1552 *
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 72a6550a056c..46349293de08 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -691,16 +691,19 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
691 691
692void __scsi_remove_device(struct scsi_device *sdev) 692void __scsi_remove_device(struct scsi_device *sdev)
693{ 693{
694 struct device *dev = &sdev->sdev_gendev;
695
694 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) 696 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
695 return; 697 return;
696 698
697 class_device_unregister(&sdev->sdev_classdev); 699 class_device_unregister(&sdev->sdev_classdev);
698 device_del(&sdev->sdev_gendev); 700 transport_remove_device(dev);
701 device_del(dev);
699 scsi_device_set_state(sdev, SDEV_DEL); 702 scsi_device_set_state(sdev, SDEV_DEL);
700 if (sdev->host->hostt->slave_destroy) 703 if (sdev->host->hostt->slave_destroy)
701 sdev->host->hostt->slave_destroy(sdev); 704 sdev->host->hostt->slave_destroy(sdev);
702 transport_unregister_device(&sdev->sdev_gendev); 705 transport_destroy_device(dev);
703 put_device(&sdev->sdev_gendev); 706 put_device(dev);
704} 707}
705 708
706/** 709/**
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 6cd5931d9a54..2a1a99a2ef56 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -105,6 +105,7 @@ static struct {
105 { FC_PORTSTATE_LINKDOWN, "Linkdown" }, 105 { FC_PORTSTATE_LINKDOWN, "Linkdown" },
106 { FC_PORTSTATE_ERROR, "Error" }, 106 { FC_PORTSTATE_ERROR, "Error" },
107 { FC_PORTSTATE_LOOPBACK, "Loopback" }, 107 { FC_PORTSTATE_LOOPBACK, "Loopback" },
108 { FC_PORTSTATE_DELETED, "Deleted" },
108}; 109};
109fc_enum_name_search(port_state, fc_port_state, fc_port_state_names) 110fc_enum_name_search(port_state, fc_port_state, fc_port_state_names)
110#define FC_PORTSTATE_MAX_NAMELEN 20 111#define FC_PORTSTATE_MAX_NAMELEN 20
@@ -211,6 +212,7 @@ fc_bitfield_name_search(remote_port_roles, fc_remote_port_role_names)
211#define FC_MGMTSRVR_PORTID 0x00000a 212#define FC_MGMTSRVR_PORTID 0x00000a
212 213
213 214
215static void fc_shost_remove_rports(void *data);
214static void fc_timeout_deleted_rport(void *data); 216static void fc_timeout_deleted_rport(void *data);
215static void fc_scsi_scan_rport(void *data); 217static void fc_scsi_scan_rport(void *data);
216static void fc_rport_terminate(struct fc_rport *rport); 218static void fc_rport_terminate(struct fc_rport *rport);
@@ -318,6 +320,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
318 fc_host_next_rport_number(shost) = 0; 320 fc_host_next_rport_number(shost) = 0;
319 fc_host_next_target_id(shost) = 0; 321 fc_host_next_target_id(shost) = 0;
320 322
323 fc_host_flags(shost) = 0;
324 INIT_WORK(&fc_host_rport_del_work(shost), fc_shost_remove_rports, shost);
321 return 0; 325 return 0;
322} 326}
323 327
@@ -387,6 +391,7 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \
387 struct fc_internal *i = to_fc_internal(shost->transportt); \ 391 struct fc_internal *i = to_fc_internal(shost->transportt); \
388 if ((i->f->get_rport_##field) && \ 392 if ((i->f->get_rport_##field) && \
389 !((rport->port_state == FC_PORTSTATE_BLOCKED) || \ 393 !((rport->port_state == FC_PORTSTATE_BLOCKED) || \
394 (rport->port_state == FC_PORTSTATE_DELETED) || \
390 (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \ 395 (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \
391 i->f->get_rport_##field(rport); \ 396 i->f->get_rport_##field(rport); \
392 return snprintf(buf, sz, format_string, cast rport->field); \ 397 return snprintf(buf, sz, format_string, cast rport->field); \
@@ -402,6 +407,7 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \
402 struct Scsi_Host *shost = rport_to_shost(rport); \ 407 struct Scsi_Host *shost = rport_to_shost(rport); \
403 struct fc_internal *i = to_fc_internal(shost->transportt); \ 408 struct fc_internal *i = to_fc_internal(shost->transportt); \
404 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \ 409 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \
410 (rport->port_state == FC_PORTSTATE_DELETED) || \
405 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \ 411 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \
406 return -EBUSY; \ 412 return -EBUSY; \
407 val = simple_strtoul(buf, NULL, 0); \ 413 val = simple_strtoul(buf, NULL, 0); \
@@ -519,6 +525,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf,
519 struct Scsi_Host *shost = rport_to_shost(rport); 525 struct Scsi_Host *shost = rport_to_shost(rport);
520 struct fc_internal *i = to_fc_internal(shost->transportt); 526 struct fc_internal *i = to_fc_internal(shost->transportt);
521 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || 527 if ((rport->port_state == FC_PORTSTATE_BLOCKED) ||
528 (rport->port_state == FC_PORTSTATE_DELETED) ||
522 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) 529 (rport->port_state == FC_PORTSTATE_NOTPRESENT))
523 return -EBUSY; 530 return -EBUSY;
524 val = simple_strtoul(buf, NULL, 0); 531 val = simple_strtoul(buf, NULL, 0);
@@ -1769,7 +1776,7 @@ fc_timeout_deleted_rport(void *data)
1769 rport->maxframe_size = -1; 1776 rport->maxframe_size = -1;
1770 rport->supported_classes = FC_COS_UNSPECIFIED; 1777 rport->supported_classes = FC_COS_UNSPECIFIED;
1771 rport->roles = FC_RPORT_ROLE_UNKNOWN; 1778 rport->roles = FC_RPORT_ROLE_UNKNOWN;
1772 rport->port_state = FC_PORTSTATE_NOTPRESENT; 1779 rport->port_state = FC_PORTSTATE_DELETED;
1773 1780
1774 /* remove the identifiers that aren't used in the consisting binding */ 1781 /* remove the identifiers that aren't used in the consisting binding */
1775 switch (fc_host_tgtid_bind_type(shost)) { 1782 switch (fc_host_tgtid_bind_type(shost)) {
@@ -1789,14 +1796,23 @@ fc_timeout_deleted_rport(void *data)
1789 break; 1796 break;
1790 } 1797 }
1791 1798
1792 spin_unlock_irqrestore(shost->host_lock, flags);
1793
1794 /* 1799 /*
1795 * As this only occurs if the remote port (scsi target) 1800 * As this only occurs if the remote port (scsi target)
1796 * went away and didn't come back - we'll remove 1801 * went away and didn't come back - we'll remove
1797 * all attached scsi devices. 1802 * all attached scsi devices.
1803 *
1804 * We'll schedule the shost work item to perform the actual removal
1805 * to avoid recursion in the different flush calls if we perform
1806 * the removal in each target - and there are lots of targets
1807 * whose timeouts fire at the same time.
1798 */ 1808 */
1799 fc_rport_tgt_remove(rport); 1809
1810 if ( !(fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED)) {
1811 fc_host_flags(shost) |= FC_SHOST_RPORT_DEL_SCHEDULED;
1812 scsi_queue_work(shost, &fc_host_rport_del_work(shost));
1813 }
1814
1815 spin_unlock_irqrestore(shost->host_lock, flags);
1800} 1816}
1801 1817
1802/** 1818/**
@@ -1818,6 +1834,41 @@ fc_scsi_scan_rport(void *data)
1818} 1834}
1819 1835
1820 1836
1837/**
1838 * fc_shost_remove_rports - called to remove all rports that are marked
1839 * as in a deleted (not connected) state.
1840 *
1841 * @data: shost whose rports are to be looked at
1842 **/
1843static void
1844fc_shost_remove_rports(void *data)
1845{
1846 struct Scsi_Host *shost = (struct Scsi_Host *)data;
1847 struct fc_rport *rport, *next_rport;
1848 unsigned long flags;
1849
1850 spin_lock_irqsave(shost->host_lock, flags);
1851 while (fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED) {
1852
1853 fc_host_flags(shost) &= ~FC_SHOST_RPORT_DEL_SCHEDULED;
1854
1855restart_search:
1856 list_for_each_entry_safe(rport, next_rport,
1857 &fc_host_rport_bindings(shost), peers) {
1858 if (rport->port_state == FC_PORTSTATE_DELETED) {
1859 rport->port_state = FC_PORTSTATE_NOTPRESENT;
1860 spin_unlock_irqrestore(shost->host_lock, flags);
1861 fc_rport_tgt_remove(rport);
1862 spin_lock_irqsave(shost->host_lock, flags);
1863 goto restart_search;
1864 }
1865 }
1866
1867 }
1868 spin_unlock_irqrestore(shost->host_lock, flags);
1869}
1870
1871
1821MODULE_AUTHOR("Martin Hicks"); 1872MODULE_AUTHOR("Martin Hicks");
1822MODULE_DESCRIPTION("FC Transport Attributes"); 1873MODULE_DESCRIPTION("FC Transport Attributes");
1823MODULE_LICENSE("GPL"); 1874MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 49fd18c1a9c6..e08462d50c97 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -249,7 +249,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
249} 249}
250 250
251static void* 251static void*
252mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 252mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
253{ 253{
254 struct mempool_zone *zone = pool_data; 254 struct mempool_zone *zone = pool_data;
255 255
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 718a2bc4ed5e..38a53b5f9e9a 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -812,12 +812,10 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
812 if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev)) 812 if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev))
813 return; 813 return;
814 814
815 /* see if the device has an echo buffer. If it does we can 815 /* len == -1 is the signal that we need to ascertain the
816 * do the SPI pattern write tests */ 816 * presence of an echo buffer before trying to use it. len ==
817 817 * 0 means we don't have an echo buffer */
818 len = 0; 818 len = -1;
819 if (scsi_device_dt(sdev))
820 len = spi_dv_device_get_echo_buffer(sdev, buffer);
821 819
822 retry: 820 retry:
823 821
@@ -840,11 +838,23 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
840 if (spi_min_period(starget) == 8) 838 if (spi_min_period(starget) == 8)
841 DV_SET(pcomp_en, 1); 839 DV_SET(pcomp_en, 1);
842 } 840 }
841 /* Do the read only INQUIRY tests */
842 spi_dv_retrain(sdev, buffer, buffer + sdev->inquiry_len,
843 spi_dv_device_compare_inquiry);
844 /* See if we actually managed to negotiate and sustain DT */
845 if (i->f->get_dt)
846 i->f->get_dt(starget);
847
848 /* see if the device has an echo buffer. If it does we can do
849 * the SPI pattern write tests. Because of some broken
850 * devices, we *only* try this on a device that has actually
851 * negotiated DT */
852
853 if (len == -1 && spi_dt(starget))
854 len = spi_dv_device_get_echo_buffer(sdev, buffer);
843 855
844 if (len == 0) { 856 if (len <= 0) {
845 starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n"); 857 starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n");
846 spi_dv_retrain(sdev, buffer, buffer + len,
847 spi_dv_device_compare_inquiry);
848 return; 858 return;
849 } 859 }
850 860
diff --git a/drivers/scsi/scsi_typedefs.h b/drivers/scsi/scsi_typedefs.h
index 6c431323581c..29f038b42f60 100644
--- a/drivers/scsi/scsi_typedefs.h
+++ b/drivers/scsi/scsi_typedefs.h
@@ -1,6 +1,3 @@
1 1
2typedef struct scsi_host_template Scsi_Host_Template;
3typedef struct scsi_device Scsi_Device;
4typedef struct scsi_cmnd Scsi_Cmnd; 2typedef struct scsi_cmnd Scsi_Cmnd;
5typedef struct scsi_request Scsi_Request; 3typedef struct scsi_request Scsi_Request;
6typedef struct scsi_pointer Scsi_Pointer;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index bb5b242ac6b4..03fcbab30033 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -245,24 +245,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
245 * SG_IO from block layer already setup, just copy cdb basically 245 * SG_IO from block layer already setup, just copy cdb basically
246 */ 246 */
247 if (blk_pc_request(rq)) { 247 if (blk_pc_request(rq)) {
248 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 248 scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES);
249 return 0;
250
251 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
252 SCpnt->cmd_len = rq->cmd_len;
253 if (rq_data_dir(rq) == WRITE)
254 SCpnt->sc_data_direction = DMA_TO_DEVICE;
255 else if (rq->data_len)
256 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
257 else
258 SCpnt->sc_data_direction = DMA_NONE;
259
260 this_count = rq->data_len;
261 if (rq->timeout) 249 if (rq->timeout)
262 timeout = rq->timeout; 250 timeout = rq->timeout;
263 251
264 SCpnt->transfersize = rq->data_len;
265 SCpnt->allowed = SD_PASSTHROUGH_RETRIES;
266 goto queue; 252 goto queue;
267 } 253 }
268 254
@@ -769,20 +755,16 @@ static void sd_end_flush(request_queue_t *q, struct request *flush_rq)
769static int sd_prepare_flush(request_queue_t *q, struct request *rq) 755static int sd_prepare_flush(request_queue_t *q, struct request *rq)
770{ 756{
771 struct scsi_device *sdev = q->queuedata; 757 struct scsi_device *sdev = q->queuedata;
772 struct scsi_disk *sdkp = scsi_disk_get_from_dev(&sdev->sdev_gendev); 758 struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev);
773 int ret = 0;
774 759
775 if (sdkp) { 760 if (!sdkp || !sdkp->WCE)
776 if (sdkp->WCE) { 761 return 0;
777 memset(rq->cmd, 0, sizeof(rq->cmd)); 762
778 rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; 763 memset(rq->cmd, 0, sizeof(rq->cmd));
779 rq->timeout = SD_TIMEOUT; 764 rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;
780 rq->cmd[0] = SYNCHRONIZE_CACHE; 765 rq->timeout = SD_TIMEOUT;
781 ret = 1; 766 rq->cmd[0] = SYNCHRONIZE_CACHE;
782 } 767 return 1;
783 scsi_disk_put(sdkp);
784 }
785 return ret;
786} 768}
787 769
788static void sd_rescan(struct device *dev) 770static void sd_rescan(struct device *dev)
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c
index a0cace9aeb79..0ff83ddf13fe 100644
--- a/drivers/scsi/seagate.c
+++ b/drivers/scsi/seagate.c
@@ -418,7 +418,7 @@ static inline void borken_wait (void)
418#define ULOOP( i ) for (clock = i*8;;) 418#define ULOOP( i ) for (clock = i*8;;)
419#define TIMEOUT (!(clock--)) 419#define TIMEOUT (!(clock--))
420 420
421int __init seagate_st0x_detect (Scsi_Host_Template * tpnt) 421int __init seagate_st0x_detect (struct scsi_host_template * tpnt)
422{ 422{
423 struct Scsi_Host *instance; 423 struct Scsi_Host *instance;
424 int i, j; 424 int i, j;
@@ -1649,7 +1649,7 @@ static int seagate_st0x_release(struct Scsi_Host *shost)
1649 return 0; 1649 return 0;
1650} 1650}
1651 1651
1652static Scsi_Host_Template driver_template = { 1652static struct scsi_host_template driver_template = {
1653 .detect = seagate_st0x_detect, 1653 .detect = seagate_st0x_detect,
1654 .release = seagate_st0x_release, 1654 .release = seagate_st0x_release,
1655 .info = seagate_st0x_info, 1655 .info = seagate_st0x_info,
diff --git a/drivers/scsi/seagate.h b/drivers/scsi/seagate.h
index 8889ff1a6b20..fb5f380fa4b3 100644
--- a/drivers/scsi/seagate.h
+++ b/drivers/scsi/seagate.h
@@ -9,7 +9,7 @@
9#ifndef _SEAGATE_H 9#ifndef _SEAGATE_H
10#define SEAGATE_H 10#define SEAGATE_H
11 11
12static int seagate_st0x_detect(Scsi_Host_Template *); 12static int seagate_st0x_detect(struct scsi_host_template *);
13static int seagate_st0x_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 13static int seagate_st0x_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
14 14
15static int seagate_st0x_abort(Scsi_Cmnd *); 15static int seagate_st0x_abort(Scsi_Cmnd *);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 72ec59456e69..b55c2a8a547c 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1860,9 +1860,11 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
1860 unlock_page(pages[j]); */ 1860 unlock_page(pages[j]); */
1861 res = 0; 1861 res = 0;
1862 out_unmap: 1862 out_unmap:
1863 if (res > 0) 1863 if (res > 0) {
1864 for (j=0; j < res; j++) 1864 for (j=0; j < res; j++)
1865 page_cache_release(pages[j]); 1865 page_cache_release(pages[j]);
1866 res = 0;
1867 }
1866 kfree(pages); 1868 kfree(pages);
1867 return res; 1869 return res;
1868} 1870}
@@ -1878,8 +1880,6 @@ st_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages,
1878 for (i=0; i < nr_pages; i++) { 1880 for (i=0; i < nr_pages; i++) {
1879 struct page *page = sgl[i].page; 1881 struct page *page = sgl[i].page;
1880 1882
1881 /* XXX: just for debug. Remove when PageReserved is removed */
1882 BUG_ON(PageReserved(page));
1883 if (dirtied) 1883 if (dirtied)
1884 SetPageDirty(page); 1884 SetPageDirty(page);
1885 /* unlock_page(page); */ 1885 /* unlock_page(page); */
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index f37147f8f7bf..bf2ceb54354c 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -217,7 +217,7 @@ static inline void init_hpc_chain(struct hpc_data *hd)
217} 217}
218 218
219static struct Scsi_Host * __init sgiwd93_setup_scsi( 219static struct Scsi_Host * __init sgiwd93_setup_scsi(
220 Scsi_Host_Template *SGIblows, int unit, int irq, 220 struct scsi_host_template *SGIblows, int unit, int irq,
221 struct hpc3_scsiregs *hregs, unsigned char *wdregs) 221 struct hpc3_scsiregs *hregs, unsigned char *wdregs)
222{ 222{
223 struct ip22_hostdata *hdata; 223 struct ip22_hostdata *hdata;
@@ -265,7 +265,7 @@ out_unregister:
265 return NULL; 265 return NULL;
266} 266}
267 267
268int __init sgiwd93_detect(Scsi_Host_Template *SGIblows) 268int __init sgiwd93_detect(struct scsi_host_template *SGIblows)
269{ 269{
270 int found = 0; 270 int found = 0;
271 271
@@ -324,7 +324,7 @@ static int sgiwd93_bus_reset(Scsi_Cmnd *cmd)
324 * arguments not with pointers. So this is going to blow up beautyfully 324 * arguments not with pointers. So this is going to blow up beautyfully
325 * on 64-bit systems with memory outside the compat address spaces. 325 * on 64-bit systems with memory outside the compat address spaces.
326 */ 326 */
327static Scsi_Host_Template driver_template = { 327static struct scsi_host_template driver_template = {
328 .proc_name = "SGIWD93", 328 .proc_name = "SGIWD93",
329 .name = "SGI WD93", 329 .name = "SGI WD93",
330 .detect = sgiwd93_detect, 330 .detect = sgiwd93_detect,
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index d68cea753bb2..fb4012b5c188 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -320,25 +320,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
320 * these are already setup, just copy cdb basically 320 * these are already setup, just copy cdb basically
321 */ 321 */
322 if (SCpnt->request->flags & REQ_BLOCK_PC) { 322 if (SCpnt->request->flags & REQ_BLOCK_PC) {
323 struct request *rq = SCpnt->request; 323 scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES);
324 324
325 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 325 if (SCpnt->timeout_per_command)
326 return 0; 326 timeout = SCpnt->timeout_per_command;
327
328 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
329 SCpnt->cmd_len = rq->cmd_len;
330 if (!rq->data_len)
331 SCpnt->sc_data_direction = DMA_NONE;
332 else if (rq_data_dir(rq) == WRITE)
333 SCpnt->sc_data_direction = DMA_TO_DEVICE;
334 else
335 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
336
337 this_count = rq->data_len;
338 if (rq->timeout)
339 timeout = rq->timeout;
340 327
341 SCpnt->transfersize = rq->data_len;
342 goto queue; 328 goto queue;
343 } 329 }
344 330
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 770c4324f3d5..dd592f6a2529 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4194,27 +4194,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
4194 */ 4194 */
4195static int st_init_command(struct scsi_cmnd *SCpnt) 4195static int st_init_command(struct scsi_cmnd *SCpnt)
4196{ 4196{
4197 struct request *rq;
4198
4199 if (!(SCpnt->request->flags & REQ_BLOCK_PC)) 4197 if (!(SCpnt->request->flags & REQ_BLOCK_PC))
4200 return 0; 4198 return 0;
4201 4199
4202 rq = SCpnt->request; 4200 scsi_setup_blk_pc_cmnd(SCpnt, 0);
4203 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
4204 return 0;
4205
4206 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
4207 SCpnt->cmd_len = rq->cmd_len;
4208
4209 if (rq_data_dir(rq) == WRITE)
4210 SCpnt->sc_data_direction = DMA_TO_DEVICE;
4211 else if (rq->data_len)
4212 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
4213 else
4214 SCpnt->sc_data_direction = DMA_NONE;
4215
4216 SCpnt->timeout_per_command = rq->timeout;
4217 SCpnt->transfersize = rq->data_len;
4218 SCpnt->done = st_intr; 4201 SCpnt->done = st_intr;
4219 return 1; 4202 return 1;
4220} 4203}
@@ -4509,6 +4492,7 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
4509 if (res > 0) { 4492 if (res > 0) {
4510 for (j=0; j < res; j++) 4493 for (j=0; j < res; j++)
4511 page_cache_release(pages[j]); 4494 page_cache_release(pages[j]);
4495 res = 0;
4512 } 4496 }
4513 kfree(pages); 4497 kfree(pages);
4514 return res; 4498 return res;
@@ -4524,8 +4508,6 @@ static int sgl_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_p
4524 for (i=0; i < nr_pages; i++) { 4508 for (i=0; i < nr_pages; i++) {
4525 struct page *page = sgl[i].page; 4509 struct page *page = sgl[i].page;
4526 4510
4527 /* XXX: just for debug. Remove when PageReserved is removed */
4528 BUG_ON(PageReserved(page));
4529 if (dirtied) 4511 if (dirtied)
4530 SetPageDirty(page); 4512 SetPageDirty(page);
4531 /* FIXME: cache flush missing for rw==READ 4513 /* FIXME: cache flush missing for rw==READ
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 7e19589e71a0..c041bfd56e12 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -257,7 +257,7 @@
257 */ 257 */
258 258
259static struct Scsi_Host *first_instance = NULL; 259static struct Scsi_Host *first_instance = NULL;
260static Scsi_Host_Template *the_template = NULL; 260static struct scsi_host_template *the_template = NULL;
261 261
262/* Macros ease life... :-) */ 262/* Macros ease life... :-) */
263#define SETUP_HOSTDATA(in) \ 263#define SETUP_HOSTDATA(in) \
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index e3ea99f23d60..837173415d4c 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -185,7 +185,7 @@ static inline void sun3_udc_write(unsigned short val, unsigned char reg)
185static struct Scsi_Host *default_instance; 185static struct Scsi_Host *default_instance;
186 186
187/* 187/*
188 * Function : int sun3scsi_detect(Scsi_Host_Template * tpnt) 188 * Function : int sun3scsi_detect(struct scsi_host_template * tpnt)
189 * 189 *
190 * Purpose : initializes mac NCR5380 driver based on the 190 * Purpose : initializes mac NCR5380 driver based on the
191 * command line / compile time port and irq definitions. 191 * command line / compile time port and irq definitions.
@@ -196,7 +196,7 @@ static struct Scsi_Host *default_instance;
196 * 196 *
197 */ 197 */
198 198
199int sun3scsi_detect(Scsi_Host_Template * tpnt) 199int sun3scsi_detect(struct scsi_host_template * tpnt)
200{ 200{
201 unsigned long ioaddr; 201 unsigned long ioaddr;
202 static int called = 0; 202 static int called = 0;
@@ -621,7 +621,7 @@ static int sun3scsi_dma_finish(int write_flag)
621 621
622#include "sun3_NCR5380.c" 622#include "sun3_NCR5380.c"
623 623
624static Scsi_Host_Template driver_template = { 624static struct scsi_host_template driver_template = {
625 .name = SUN3_SCSI_NAME, 625 .name = SUN3_SCSI_NAME,
626 .detect = sun3scsi_detect, 626 .detect = sun3scsi_detect,
627 .release = sun3scsi_release, 627 .release = sun3scsi_release,
diff --git a/drivers/scsi/sun3_scsi.h b/drivers/scsi/sun3_scsi.h
index 155282b92a95..834dab428019 100644
--- a/drivers/scsi/sun3_scsi.h
+++ b/drivers/scsi/sun3_scsi.h
@@ -48,7 +48,7 @@
48#define IOBASE_SUN3_VMESCSI 0xff200000 48#define IOBASE_SUN3_VMESCSI 0xff200000
49 49
50static int sun3scsi_abort (Scsi_Cmnd *); 50static int sun3scsi_abort (Scsi_Cmnd *);
51static int sun3scsi_detect (Scsi_Host_Template *); 51static int sun3scsi_detect (struct scsi_host_template *);
52static const char *sun3scsi_info (struct Scsi_Host *); 52static const char *sun3scsi_info (struct Scsi_Host *);
53static int sun3scsi_bus_reset(Scsi_Cmnd *); 53static int sun3scsi_bus_reset(Scsi_Cmnd *);
54static int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 54static int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
index 9acb5ddebb07..008a82ab8521 100644
--- a/drivers/scsi/sun3_scsi_vme.c
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -127,7 +127,7 @@ static inline void sun3scsi_write(int reg, int value)
127static struct Scsi_Host *default_instance; 127static struct Scsi_Host *default_instance;
128 128
129/* 129/*
130 * Function : int sun3scsi_detect(Scsi_Host_Template * tpnt) 130 * Function : int sun3scsi_detect(struct scsi_host_template * tpnt)
131 * 131 *
132 * Purpose : initializes mac NCR5380 driver based on the 132 * Purpose : initializes mac NCR5380 driver based on the
133 * command line / compile time port and irq definitions. 133 * command line / compile time port and irq definitions.
@@ -138,7 +138,7 @@ static struct Scsi_Host *default_instance;
138 * 138 *
139 */ 139 */
140 140
141static int sun3scsi_detect(Scsi_Host_Template * tpnt) 141static int sun3scsi_detect(struct scsi_host_template * tpnt)
142{ 142{
143 unsigned long ioaddr, irq = 0; 143 unsigned long ioaddr, irq = 0;
144 static int called = 0; 144 static int called = 0;
@@ -564,7 +564,7 @@ static int sun3scsi_dma_finish(int write_flag)
564 564
565#include "sun3_NCR5380.c" 565#include "sun3_NCR5380.c"
566 566
567static Scsi_Host_Template driver_template = { 567static struct scsi_host_template driver_template = {
568 .name = SUN3_SCSI_NAME, 568 .name = SUN3_SCSI_NAME,
569 .detect = sun3scsi_detect, 569 .detect = sun3scsi_detect,
570 .release = sun3scsi_release, 570 .release = sun3scsi_release,
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 09d7639079b4..cc990bed9683 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -47,7 +47,7 @@ static void dma_advance_sg (Scsi_Cmnd *sp);
47/* Detecting ESP chips on the machine. This is the simple and easy 47/* Detecting ESP chips on the machine. This is the simple and easy
48 * version. 48 * version.
49 */ 49 */
50int sun3x_esp_detect(Scsi_Host_Template *tpnt) 50int sun3x_esp_detect(struct scsi_host_template *tpnt)
51{ 51{
52 struct NCR_ESP *esp; 52 struct NCR_ESP *esp;
53 struct ConfigDev *esp_dev; 53 struct ConfigDev *esp_dev;
@@ -367,7 +367,7 @@ static int sun3x_esp_release(struct Scsi_Host *instance)
367 367
368} 368}
369 369
370static Scsi_Host_Template driver_template = { 370static struct scsi_host_template driver_template = {
371 .proc_name = "sun3x_esp", 371 .proc_name = "sun3x_esp",
372 .proc_info = &esp_proc_info, 372 .proc_info = &esp_proc_info,
373 .name = "Sun ESP 100/100a/200", 373 .name = "Sun ESP 100/100a/200",
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index 93dc7b665ccf..8640253d6215 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -633,7 +633,7 @@ static void sym53c416_probe(void)
633 } 633 }
634} 634}
635 635
636int __init sym53c416_detect(Scsi_Host_Template *tpnt) 636int __init sym53c416_detect(struct scsi_host_template *tpnt)
637{ 637{
638 unsigned long flags; 638 unsigned long flags;
639 struct Scsi_Host * shpnt = NULL; 639 struct Scsi_Host * shpnt = NULL;
@@ -849,7 +849,7 @@ module_param_array(sym53c416_3, uint, NULL, 0);
849 849
850#endif 850#endif
851 851
852static Scsi_Host_Template driver_template = { 852static struct scsi_host_template driver_template = {
853 .proc_name = "sym53c416", 853 .proc_name = "sym53c416",
854 .name = "Symbios Logic 53c416", 854 .name = "Symbios Logic 53c416",
855 .detect = sym53c416_detect, 855 .detect = sym53c416_detect,
diff --git a/drivers/scsi/sym53c416.h b/drivers/scsi/sym53c416.h
index fd6b120d38c4..77860d0748ff 100644
--- a/drivers/scsi/sym53c416.h
+++ b/drivers/scsi/sym53c416.h
@@ -22,7 +22,7 @@
22 22
23#define SYM53C416_SCSI_ID 7 23#define SYM53C416_SCSI_ID 7
24 24
25static int sym53c416_detect(Scsi_Host_Template *); 25static int sym53c416_detect(struct scsi_host_template *);
26static const char *sym53c416_info(struct Scsi_Host *); 26static const char *sym53c416_info(struct Scsi_Host *);
27static int sym53c416_release(struct Scsi_Host *); 27static int sym53c416_release(struct Scsi_Host *);
28static int sym53c416_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 28static int sym53c416_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index d76766c3ce16..7fc0b97173e1 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -2086,6 +2086,7 @@ static void sym2_set_dt(struct scsi_target *starget, int dt)
2086 tp->tgoal.check_nego = 1; 2086 tp->tgoal.check_nego = 1;
2087} 2087}
2088 2088
2089#if 0
2089static void sym2_set_iu(struct scsi_target *starget, int iu) 2090static void sym2_set_iu(struct scsi_target *starget, int iu)
2090{ 2091{
2091 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 2092 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -2111,7 +2112,7 @@ static void sym2_set_qas(struct scsi_target *starget, int qas)
2111 tp->tgoal.qas = 0; 2112 tp->tgoal.qas = 0;
2112 tp->tgoal.check_nego = 1; 2113 tp->tgoal.check_nego = 1;
2113} 2114}
2114 2115#endif
2115 2116
2116static struct spi_function_template sym2_transport_functions = { 2117static struct spi_function_template sym2_transport_functions = {
2117 .set_offset = sym2_set_offset, 2118 .set_offset = sym2_set_offset,
@@ -2122,10 +2123,12 @@ static struct spi_function_template sym2_transport_functions = {
2122 .show_width = 1, 2123 .show_width = 1,
2123 .set_dt = sym2_set_dt, 2124 .set_dt = sym2_set_dt,
2124 .show_dt = 1, 2125 .show_dt = 1,
2126#if 0
2125 .set_iu = sym2_set_iu, 2127 .set_iu = sym2_set_iu,
2126 .show_iu = 1, 2128 .show_iu = 1,
2127 .set_qas = sym2_set_qas, 2129 .set_qas = sym2_set_qas,
2128 .show_qas = 1, 2130 .show_qas = 1,
2131#endif
2129 .get_signalling = sym2_get_signalling, 2132 .get_signalling = sym2_get_signalling,
2130}; 2133};
2131 2134
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a7420cad4547..1564ca203a3e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1405,7 +1405,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget,
1405 goal->iu = 0; 1405 goal->iu = 0;
1406 goal->dt = 0; 1406 goal->dt = 0;
1407 goal->qas = 0; 1407 goal->qas = 0;
1408 goal->period = 0;
1409 goal->offset = 0; 1408 goal->offset = 0;
1410 return; 1409 return;
1411 } 1410 }
@@ -1465,7 +1464,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1465 * Many devices implement PPR in a buggy way, so only use it if we 1464 * Many devices implement PPR in a buggy way, so only use it if we
1466 * really want to. 1465 * really want to.
1467 */ 1466 */
1468 if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { 1467 if (goal->offset &&
1468 (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {
1469 nego = NS_PPR; 1469 nego = NS_PPR;
1470 } else if (spi_width(starget) != goal->width) { 1470 } else if (spi_width(starget) != goal->width) {
1471 nego = NS_WIDE; 1471 nego = NS_WIDE;
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c
index f4b780e35cb6..21305fc91479 100644
--- a/drivers/scsi/t128.c
+++ b/drivers/scsi/t128.c
@@ -183,7 +183,7 @@ void __init t128_setup(char *str, int *ints){
183} 183}
184 184
185/* 185/*
186 * Function : int t128_detect(Scsi_Host_Template * tpnt) 186 * Function : int t128_detect(struct scsi_host_template * tpnt)
187 * 187 *
188 * Purpose : detects and initializes T128,T128F, or T228 controllers 188 * Purpose : detects and initializes T128,T128F, or T228 controllers
189 * that were autoprobed, overridden on the LILO command line, 189 * that were autoprobed, overridden on the LILO command line,
@@ -195,7 +195,7 @@ void __init t128_setup(char *str, int *ints){
195 * 195 *
196 */ 196 */
197 197
198int __init t128_detect(Scsi_Host_Template * tpnt){ 198int __init t128_detect(struct scsi_host_template * tpnt){
199 static int current_override = 0, current_base = 0; 199 static int current_override = 0, current_base = 0;
200 struct Scsi_Host *instance; 200 struct Scsi_Host *instance;
201 unsigned long base; 201 unsigned long base;
@@ -430,7 +430,7 @@ MODULE_LICENSE("GPL");
430 430
431#include "NCR5380.c" 431#include "NCR5380.c"
432 432
433static Scsi_Host_Template driver_template = { 433static struct scsi_host_template driver_template = {
434 .name = "Trantor T128/T128F/T228", 434 .name = "Trantor T128/T128F/T228",
435 .detect = t128_detect, 435 .detect = t128_detect,
436 .release = t128_release, 436 .release = t128_release,
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h
index 596f3a32a1c6..646e840266e2 100644
--- a/drivers/scsi/t128.h
+++ b/drivers/scsi/t128.h
@@ -95,7 +95,7 @@
95static int t128_abort(Scsi_Cmnd *); 95static int t128_abort(Scsi_Cmnd *);
96static int t128_biosparam(struct scsi_device *, struct block_device *, 96static int t128_biosparam(struct scsi_device *, struct block_device *,
97 sector_t, int*); 97 sector_t, int*);
98static int t128_detect(Scsi_Host_Template *); 98static int t128_detect(struct scsi_host_template *);
99static int t128_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 99static int t128_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
100static int t128_bus_reset(Scsi_Cmnd *); 100static int t128_bus_reset(Scsi_Cmnd *);
101 101
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 1ce29ba683eb..33cd90fc657b 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -282,7 +282,7 @@
282 * clustering is enabled. ENABLE_CLUSTERING provides a performance increase 282 * clustering is enabled. ENABLE_CLUSTERING provides a performance increase
283 * up to 50% on sequential access. 283 * up to 50% on sequential access.
284 * 284 *
285 * Since the Scsi_Host_Template structure is shared among all 14F and 34F, 285 * Since the struct scsi_host_template structure is shared among all 14F and 34F,
286 * the last setting of use_clustering is in effect for all of these boards. 286 * the last setting of use_clustering is in effect for all of these boards.
287 * 287 *
288 * Here a sample configuration using two U14F boards: 288 * Here a sample configuration using two U14F boards:
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 486551bd54ba..e681681ab7a2 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -343,7 +343,7 @@ static void log_ultrastor_abort(struct ultrastor_config *config,
343} 343}
344#endif 344#endif
345 345
346static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) 346static int ultrastor_14f_detect(struct scsi_host_template * tpnt)
347{ 347{
348 size_t i; 348 size_t i;
349 unsigned char in_byte, version_byte = 0; 349 unsigned char in_byte, version_byte = 0;
@@ -525,7 +525,7 @@ out_release_port:
525 return FALSE; 525 return FALSE;
526} 526}
527 527
528static int ultrastor_24f_detect(Scsi_Host_Template * tpnt) 528static int ultrastor_24f_detect(struct scsi_host_template * tpnt)
529{ 529{
530 int i; 530 int i;
531 struct Scsi_Host * shpnt = NULL; 531 struct Scsi_Host * shpnt = NULL;
@@ -637,7 +637,7 @@ static int ultrastor_24f_detect(Scsi_Host_Template * tpnt)
637 return FALSE; 637 return FALSE;
638} 638}
639 639
640static int ultrastor_detect(Scsi_Host_Template * tpnt) 640static int ultrastor_detect(struct scsi_host_template * tpnt)
641{ 641{
642 tpnt->proc_name = "ultrastor"; 642 tpnt->proc_name = "ultrastor";
643 return ultrastor_14f_detect(tpnt) || ultrastor_24f_detect(tpnt); 643 return ultrastor_14f_detect(tpnt) || ultrastor_24f_detect(tpnt);
@@ -1184,7 +1184,7 @@ static irqreturn_t do_ultrastor_interrupt(int irq, void *dev_id,
1184 1184
1185MODULE_LICENSE("GPL"); 1185MODULE_LICENSE("GPL");
1186 1186
1187static Scsi_Host_Template driver_template = { 1187static struct scsi_host_template driver_template = {
1188 .name = "UltraStor 14F/24F/34F", 1188 .name = "UltraStor 14F/24F/34F",
1189 .detect = ultrastor_detect, 1189 .detect = ultrastor_detect,
1190 .release = ultrastor_release, 1190 .release = ultrastor_release,
diff --git a/drivers/scsi/ultrastor.h b/drivers/scsi/ultrastor.h
index 0a0f8df9e871..da759a11deff 100644
--- a/drivers/scsi/ultrastor.h
+++ b/drivers/scsi/ultrastor.h
@@ -13,7 +13,7 @@
13#ifndef _ULTRASTOR_H 13#ifndef _ULTRASTOR_H
14#define _ULTRASTOR_H 14#define _ULTRASTOR_H
15 15
16static int ultrastor_detect(Scsi_Host_Template *); 16static int ultrastor_detect(struct scsi_host_template *);
17static const char *ultrastor_info(struct Scsi_Host * shpnt); 17static const char *ultrastor_info(struct Scsi_Host * shpnt);
18static int ultrastor_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 18static int ultrastor_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
19static int ultrastor_abort(Scsi_Cmnd *); 19static int ultrastor_abort(Scsi_Cmnd *);