aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic94xx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:19:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:19:08 -0500
commit9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch)
tree4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /drivers/scsi/aic94xx
parent50d9a126240f9961cfdd063336bbeb91f77a7dce (diff)
parent23c3e290fb9ce38cabc2822b47583fc8702411bf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits) [SCSI] usbstorage: use last_sector_bug flag universally [SCSI] libsas: abstract STP task status into a function [SCSI] ultrastor: clean up inline asm warnings [SCSI] aic7xxx: fix firmware build [SCSI] aacraid: fib context lock for management ioctls [SCSI] ch: remove forward declarations [SCSI] ch: fix device minor number management bug [SCSI] ch: handle class_device_create failure properly [SCSI] NCR5380: fix section mismatch [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices [SCSI] IB/iSER: add logical unit reset support [SCSI] don't use __GFP_DMA for sense buffers if not required [SCSI] use dynamically allocated sense buffer [SCSI] scsi.h: add macro for enclosure bit of inquiry data [SCSI] sd: add fix for devices with last sector access problems [SCSI] fix pcmcia compile problem [SCSI] aacraid: add Voodoo Lite class of cards. [SCSI] aacraid: add new driver features flags [SCSI] qla2xxx: Update version number to 8.02.00-k7. [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command. ...
Diffstat (limited to 'drivers/scsi/aic94xx')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_dev.c6
-rw-r--r--drivers/scsi/aic94xx/aic94xx_dump.c4
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.c2
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.h3
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c190
-rw-r--r--drivers/scsi/aic94xx/aic94xx_scb.c6
-rw-r--r--drivers/scsi/aic94xx/aic94xx_sds.c389
-rw-r--r--drivers/scsi/aic94xx/aic94xx_sds.h121
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c50
-rw-r--r--drivers/scsi/aic94xx/aic94xx_tmf.c12
10 files changed, 732 insertions, 51 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_dev.c b/drivers/scsi/aic94xx/aic94xx_dev.c
index 3dce618bf414..72042cae7768 100644
--- a/drivers/scsi/aic94xx/aic94xx_dev.c
+++ b/drivers/scsi/aic94xx/aic94xx_dev.c
@@ -165,7 +165,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
165 if (dev->port->oob_mode != SATA_OOB_MODE) { 165 if (dev->port->oob_mode != SATA_OOB_MODE) {
166 flags |= OPEN_REQUIRED; 166 flags |= OPEN_REQUIRED;
167 if ((dev->dev_type == SATA_DEV) || 167 if ((dev->dev_type == SATA_DEV) ||
168 (dev->tproto & SAS_PROTO_STP)) { 168 (dev->tproto & SAS_PROTOCOL_STP)) {
169 struct smp_resp *rps_resp = &dev->sata_dev.rps_resp; 169 struct smp_resp *rps_resp = &dev->sata_dev.rps_resp;
170 if (rps_resp->frame_type == SMP_RESPONSE && 170 if (rps_resp->frame_type == SMP_RESPONSE &&
171 rps_resp->function == SMP_REPORT_PHY_SATA && 171 rps_resp->function == SMP_REPORT_PHY_SATA &&
@@ -193,7 +193,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
193 asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS, flags); 193 asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS, flags);
194 194
195 flags = 0; 195 flags = 0;
196 if (dev->tproto & SAS_PROTO_STP) 196 if (dev->tproto & SAS_PROTOCOL_STP)
197 flags |= STP_CL_POL_NO_TX; 197 flags |= STP_CL_POL_NO_TX;
198 asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS2, flags); 198 asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS2, flags);
199 199
@@ -201,7 +201,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
201 asd_ddbsite_write_word(asd_ha, ddb, SEND_QUEUE_TAIL, 0xFFFF); 201 asd_ddbsite_write_word(asd_ha, ddb, SEND_QUEUE_TAIL, 0xFFFF);
202 asd_ddbsite_write_word(asd_ha, ddb, SISTER_DDB, 0xFFFF); 202 asd_ddbsite_write_word(asd_ha, ddb, SISTER_DDB, 0xFFFF);
203 203
204 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTO_STP)) { 204 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
205 i = asd_init_sata(dev); 205 i = asd_init_sata(dev);
206 if (i < 0) { 206 if (i < 0) {
207 asd_free_ddb(asd_ha, ddb); 207 asd_free_ddb(asd_ha, ddb);
diff --git a/drivers/scsi/aic94xx/aic94xx_dump.c b/drivers/scsi/aic94xx/aic94xx_dump.c
index 6bd8e3059d27..3d8c4ff1f2ef 100644
--- a/drivers/scsi/aic94xx/aic94xx_dump.c
+++ b/drivers/scsi/aic94xx/aic94xx_dump.c
@@ -903,11 +903,11 @@ void asd_dump_frame_rcvd(struct asd_phy *phy,
903 int i; 903 int i;
904 904
905 switch ((dl->status_block[1] & 0x70) >> 3) { 905 switch ((dl->status_block[1] & 0x70) >> 3) {
906 case SAS_PROTO_STP: 906 case SAS_PROTOCOL_STP:
907 ASD_DPRINTK("STP proto device-to-host FIS:\n"); 907 ASD_DPRINTK("STP proto device-to-host FIS:\n");
908 break; 908 break;
909 default: 909 default:
910 case SAS_PROTO_SSP: 910 case SAS_PROTOCOL_SSP:
911 ASD_DPRINTK("SAS proto IDENTIFY:\n"); 911 ASD_DPRINTK("SAS proto IDENTIFY:\n");
912 break; 912 break;
913 } 913 }
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 0cd7eed9196c..098b5f39cd31 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -91,7 +91,7 @@ static int asd_init_phy(struct asd_phy *phy)
91 91
92 sas_phy->enabled = 1; 92 sas_phy->enabled = 1;
93 sas_phy->class = SAS; 93 sas_phy->class = SAS;
94 sas_phy->iproto = SAS_PROTO_ALL; 94 sas_phy->iproto = SAS_PROTOCOL_ALL;
95 sas_phy->tproto = 0; 95 sas_phy->tproto = 0;
96 sas_phy->type = PHY_TYPE_PHYSICAL; 96 sas_phy->type = PHY_TYPE_PHYSICAL;
97 sas_phy->role = PHY_ROLE_INITIATOR; 97 sas_phy->role = PHY_ROLE_INITIATOR;
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.h b/drivers/scsi/aic94xx/aic94xx_hwi.h
index 491e5d8a98bc..150f6706d23f 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.h
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.h
@@ -72,6 +72,7 @@ struct flash_struct {
72 u8 manuf; 72 u8 manuf;
73 u8 dev_id; 73 u8 dev_id;
74 u8 sec_prot; 74 u8 sec_prot;
75 u8 method;
75 76
76 u32 dir_offs; 77 u32 dir_offs;
77}; 78};
@@ -216,6 +217,8 @@ struct asd_ha_struct {
216 struct dma_pool *scb_pool; 217 struct dma_pool *scb_pool;
217 218
218 struct asd_seq_data seq; /* sequencer related */ 219 struct asd_seq_data seq; /* sequencer related */
220 u32 bios_status;
221 const struct firmware *bios_image;
219}; 222};
220 223
221/* ---------- Common macros ---------- */ 224/* ---------- Common macros ---------- */
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index b70d6e7f96e9..5d761eb67442 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -29,6 +29,7 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/firmware.h>
32 33
33#include <scsi/scsi_host.h> 34#include <scsi/scsi_host.h>
34 35
@@ -36,6 +37,7 @@
36#include "aic94xx_reg.h" 37#include "aic94xx_reg.h"
37#include "aic94xx_hwi.h" 38#include "aic94xx_hwi.h"
38#include "aic94xx_seq.h" 39#include "aic94xx_seq.h"
40#include "aic94xx_sds.h"
39 41
40/* The format is "version.release.patchlevel" */ 42/* The format is "version.release.patchlevel" */
41#define ASD_DRIVER_VERSION "1.0.3" 43#define ASD_DRIVER_VERSION "1.0.3"
@@ -134,7 +136,7 @@ Err:
134 return err; 136 return err;
135} 137}
136 138
137static void __devexit asd_unmap_memio(struct asd_ha_struct *asd_ha) 139static void asd_unmap_memio(struct asd_ha_struct *asd_ha)
138{ 140{
139 struct asd_ha_addrspace *io_handle; 141 struct asd_ha_addrspace *io_handle;
140 142
@@ -171,7 +173,7 @@ static int __devinit asd_map_ioport(struct asd_ha_struct *asd_ha)
171 return err; 173 return err;
172} 174}
173 175
174static void __devexit asd_unmap_ioport(struct asd_ha_struct *asd_ha) 176static void asd_unmap_ioport(struct asd_ha_struct *asd_ha)
175{ 177{
176 pci_release_region(asd_ha->pcidev, PCI_IOBAR_OFFSET); 178 pci_release_region(asd_ha->pcidev, PCI_IOBAR_OFFSET);
177} 179}
@@ -208,7 +210,7 @@ Err:
208 return err; 210 return err;
209} 211}
210 212
211static void __devexit asd_unmap_ha(struct asd_ha_struct *asd_ha) 213static void asd_unmap_ha(struct asd_ha_struct *asd_ha)
212{ 214{
213 if (asd_ha->iospace) 215 if (asd_ha->iospace)
214 asd_unmap_ioport(asd_ha); 216 asd_unmap_ioport(asd_ha);
@@ -313,6 +315,181 @@ static ssize_t asd_show_dev_pcba_sn(struct device *dev,
313} 315}
314static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL); 316static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL);
315 317
318#define FLASH_CMD_NONE 0x00
319#define FLASH_CMD_UPDATE 0x01
320#define FLASH_CMD_VERIFY 0x02
321
322struct flash_command {
323 u8 command[8];
324 int code;
325};
326
327static struct flash_command flash_command_table[] =
328{
329 {"verify", FLASH_CMD_VERIFY},
330 {"update", FLASH_CMD_UPDATE},
331 {"", FLASH_CMD_NONE} /* Last entry should be NULL. */
332};
333
334struct error_bios {
335 char *reason;
336 int err_code;
337};
338
339static struct error_bios flash_error_table[] =
340{
341 {"Failed to open bios image file", FAIL_OPEN_BIOS_FILE},
342 {"PCI ID mismatch", FAIL_CHECK_PCI_ID},
343 {"Checksum mismatch", FAIL_CHECK_SUM},
344 {"Unknown Error", FAIL_UNKNOWN},
345 {"Failed to verify.", FAIL_VERIFY},
346 {"Failed to reset flash chip.", FAIL_RESET_FLASH},
347 {"Failed to find flash chip type.", FAIL_FIND_FLASH_ID},
348 {"Failed to erash flash chip.", FAIL_ERASE_FLASH},
349 {"Failed to program flash chip.", FAIL_WRITE_FLASH},
350 {"Flash in progress", FLASH_IN_PROGRESS},
351 {"Image file size Error", FAIL_FILE_SIZE},
352 {"Input parameter error", FAIL_PARAMETERS},
353 {"Out of memory", FAIL_OUT_MEMORY},
354 {"OK", 0} /* Last entry err_code = 0. */
355};
356
357static ssize_t asd_store_update_bios(struct device *dev,
358 struct device_attribute *attr,
359 const char *buf, size_t count)
360{
361 struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev);
362 char *cmd_ptr, *filename_ptr;
363 struct bios_file_header header, *hdr_ptr;
364 int res, i;
365 u32 csum = 0;
366 int flash_command = FLASH_CMD_NONE;
367 int err = 0;
368
369 cmd_ptr = kzalloc(count*2, GFP_KERNEL);
370
371 if (!cmd_ptr) {
372 err = FAIL_OUT_MEMORY;
373 goto out;
374 }
375
376 filename_ptr = cmd_ptr + count;
377 res = sscanf(buf, "%s %s", cmd_ptr, filename_ptr);
378 if (res != 2) {
379 err = FAIL_PARAMETERS;
380 goto out1;
381 }
382
383 for (i = 0; flash_command_table[i].code != FLASH_CMD_NONE; i++) {
384 if (!memcmp(flash_command_table[i].command,
385 cmd_ptr, strlen(cmd_ptr))) {
386 flash_command = flash_command_table[i].code;
387 break;
388 }
389 }
390 if (flash_command == FLASH_CMD_NONE) {
391 err = FAIL_PARAMETERS;
392 goto out1;
393 }
394
395 if (asd_ha->bios_status == FLASH_IN_PROGRESS) {
396 err = FLASH_IN_PROGRESS;
397 goto out1;
398 }
399 err = request_firmware(&asd_ha->bios_image,
400 filename_ptr,
401 &asd_ha->pcidev->dev);
402 if (err) {
403 asd_printk("Failed to load bios image file %s, error %d\n",
404 filename_ptr, err);
405 err = FAIL_OPEN_BIOS_FILE;
406 goto out1;
407 }
408
409 hdr_ptr = (struct bios_file_header *)asd_ha->bios_image->data;
410
411 if ((hdr_ptr->contrl_id.vendor != asd_ha->pcidev->vendor ||
412 hdr_ptr->contrl_id.device != asd_ha->pcidev->device) &&
413 (hdr_ptr->contrl_id.sub_vendor != asd_ha->pcidev->vendor ||
414 hdr_ptr->contrl_id.sub_device != asd_ha->pcidev->device)) {
415
416 ASD_DPRINTK("The PCI vendor or device id does not match\n");
417 ASD_DPRINTK("vendor=%x dev=%x sub_vendor=%x sub_dev=%x"
418 " pci vendor=%x pci dev=%x\n",
419 hdr_ptr->contrl_id.vendor,
420 hdr_ptr->contrl_id.device,
421 hdr_ptr->contrl_id.sub_vendor,
422 hdr_ptr->contrl_id.sub_device,
423 asd_ha->pcidev->vendor,
424 asd_ha->pcidev->device);
425 err = FAIL_CHECK_PCI_ID;
426 goto out2;
427 }
428
429 if (hdr_ptr->filelen != asd_ha->bios_image->size) {
430 err = FAIL_FILE_SIZE;
431 goto out2;
432 }
433
434 /* calculate checksum */
435 for (i = 0; i < hdr_ptr->filelen; i++)
436 csum += asd_ha->bios_image->data[i];
437
438 if ((csum & 0x0000ffff) != hdr_ptr->checksum) {
439 ASD_DPRINTK("BIOS file checksum mismatch\n");
440 err = FAIL_CHECK_SUM;
441 goto out2;
442 }
443 if (flash_command == FLASH_CMD_UPDATE) {
444 asd_ha->bios_status = FLASH_IN_PROGRESS;
445 err = asd_write_flash_seg(asd_ha,
446 &asd_ha->bios_image->data[sizeof(*hdr_ptr)],
447 0, hdr_ptr->filelen-sizeof(*hdr_ptr));
448 if (!err)
449 err = asd_verify_flash_seg(asd_ha,
450 &asd_ha->bios_image->data[sizeof(*hdr_ptr)],
451 0, hdr_ptr->filelen-sizeof(*hdr_ptr));
452 } else {
453 asd_ha->bios_status = FLASH_IN_PROGRESS;
454 err = asd_verify_flash_seg(asd_ha,
455 &asd_ha->bios_image->data[sizeof(header)],
456 0, hdr_ptr->filelen-sizeof(header));
457 }
458
459out2:
460 release_firmware(asd_ha->bios_image);
461out1:
462 kfree(cmd_ptr);
463out:
464 asd_ha->bios_status = err;
465
466 if (!err)
467 return count;
468 else
469 return -err;
470}
471
472static ssize_t asd_show_update_bios(struct device *dev,
473 struct device_attribute *attr, char *buf)
474{
475 int i;
476 struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev);
477
478 for (i = 0; flash_error_table[i].err_code != 0; i++) {
479 if (flash_error_table[i].err_code == asd_ha->bios_status)
480 break;
481 }
482 if (asd_ha->bios_status != FLASH_IN_PROGRESS)
483 asd_ha->bios_status = FLASH_OK;
484
485 return snprintf(buf, PAGE_SIZE, "status=%x %s\n",
486 flash_error_table[i].err_code,
487 flash_error_table[i].reason);
488}
489
490static DEVICE_ATTR(update_bios, S_IRUGO|S_IWUGO,
491 asd_show_update_bios, asd_store_update_bios);
492
316static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha) 493static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
317{ 494{
318 int err; 495 int err;
@@ -328,9 +505,14 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
328 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); 505 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
329 if (err) 506 if (err)
330 goto err_biosb; 507 goto err_biosb;
508 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_update_bios);
509 if (err)
510 goto err_update_bios;
331 511
332 return 0; 512 return 0;
333 513
514err_update_bios:
515 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
334err_biosb: 516err_biosb:
335 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); 517 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
336err_rev: 518err_rev:
@@ -343,6 +525,7 @@ static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
343 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); 525 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
344 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); 526 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
345 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); 527 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
528 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios);
346} 529}
347 530
348/* The first entry, 0, is used for dynamic ids, the rest for devices 531/* The first entry, 0, is used for dynamic ids, the rest for devices
@@ -589,6 +772,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
589 asd_ha->sas_ha.dev = &asd_ha->pcidev->dev; 772 asd_ha->sas_ha.dev = &asd_ha->pcidev->dev;
590 asd_ha->sas_ha.lldd_ha = asd_ha; 773 asd_ha->sas_ha.lldd_ha = asd_ha;
591 774
775 asd_ha->bios_status = FLASH_OK;
592 asd_ha->name = asd_dev->name; 776 asd_ha->name = asd_dev->name;
593 asd_printk("found %s, device %s\n", asd_ha->name, pci_name(dev)); 777 asd_printk("found %s, device %s\n", asd_ha->name, pci_name(dev));
594 778
diff --git a/drivers/scsi/aic94xx/aic94xx_scb.c b/drivers/scsi/aic94xx/aic94xx_scb.c
index db6ab1a3b81e..0febad4dd75f 100644
--- a/drivers/scsi/aic94xx/aic94xx_scb.c
+++ b/drivers/scsi/aic94xx/aic94xx_scb.c
@@ -788,12 +788,12 @@ void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc)
788 788
789 /* initiator port settings are in the hi nibble */ 789 /* initiator port settings are in the hi nibble */
790 if (phy->sas_phy.role == PHY_ROLE_INITIATOR) 790 if (phy->sas_phy.role == PHY_ROLE_INITIATOR)
791 control_phy->port_type = SAS_PROTO_ALL << 4; 791 control_phy->port_type = SAS_PROTOCOL_ALL << 4;
792 else if (phy->sas_phy.role == PHY_ROLE_TARGET) 792 else if (phy->sas_phy.role == PHY_ROLE_TARGET)
793 control_phy->port_type = SAS_PROTO_ALL; 793 control_phy->port_type = SAS_PROTOCOL_ALL;
794 else 794 else
795 control_phy->port_type = 795 control_phy->port_type =
796 (SAS_PROTO_ALL << 4) | SAS_PROTO_ALL; 796 (SAS_PROTOCOL_ALL << 4) | SAS_PROTOCOL_ALL;
797 797
798 /* link reset retries, this should be nominal */ 798 /* link reset retries, this should be nominal */
799 control_phy->link_reset_retries = 10; 799 control_phy->link_reset_retries = 10;
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c
index 06509bff71f7..2a4c933eb89c 100644
--- a/drivers/scsi/aic94xx/aic94xx_sds.c
+++ b/drivers/scsi/aic94xx/aic94xx_sds.c
@@ -30,6 +30,7 @@
30 30
31#include "aic94xx.h" 31#include "aic94xx.h"
32#include "aic94xx_reg.h" 32#include "aic94xx_reg.h"
33#include "aic94xx_sds.h"
33 34
34/* ---------- OCM stuff ---------- */ 35/* ---------- OCM stuff ---------- */
35 36
@@ -1083,3 +1084,391 @@ out:
1083 kfree(flash_dir); 1084 kfree(flash_dir);
1084 return err; 1085 return err;
1085} 1086}
1087
1088/**
1089 * asd_verify_flash_seg - verify data with flash memory
1090 * @asd_ha: pointer to the host adapter structure
1091 * @src: pointer to the source data to be verified
1092 * @dest_offset: offset from flash memory
1093 * @bytes_to_verify: total bytes to verify
1094 */
1095int asd_verify_flash_seg(struct asd_ha_struct *asd_ha,
1096 void *src, u32 dest_offset, u32 bytes_to_verify)
1097{
1098 u8 *src_buf;
1099 u8 flash_char;
1100 int err;
1101 u32 nv_offset, reg, i;
1102
1103 reg = asd_ha->hw_prof.flash.bar;
1104 src_buf = NULL;
1105
1106 err = FLASH_OK;
1107 nv_offset = dest_offset;
1108 src_buf = (u8 *)src;
1109 for (i = 0; i < bytes_to_verify; i++) {
1110 flash_char = asd_read_reg_byte(asd_ha, reg + nv_offset + i);
1111 if (flash_char != src_buf[i]) {
1112 err = FAIL_VERIFY;
1113 break;
1114 }
1115 }
1116 return err;
1117}
1118
1119/**
1120 * asd_write_flash_seg - write data into flash memory
1121 * @asd_ha: pointer to the host adapter structure
1122 * @src: pointer to the source data to be written
1123 * @dest_offset: offset from flash memory
1124 * @bytes_to_write: total bytes to write
1125 */
1126int asd_write_flash_seg(struct asd_ha_struct *asd_ha,
1127 void *src, u32 dest_offset, u32 bytes_to_write)
1128{
1129 u8 *src_buf;
1130 u32 nv_offset, reg, i;
1131 int err;
1132
1133 reg = asd_ha->hw_prof.flash.bar;
1134 src_buf = NULL;
1135
1136 err = asd_check_flash_type(asd_ha);
1137 if (err) {
1138 ASD_DPRINTK("couldn't find the type of flash. err=%d\n", err);
1139 return err;
1140 }
1141
1142 nv_offset = dest_offset;
1143 err = asd_erase_nv_sector(asd_ha, nv_offset, bytes_to_write);
1144 if (err) {
1145 ASD_DPRINTK("Erase failed at offset:0x%x\n",
1146 nv_offset);
1147 return err;
1148 }
1149
1150 err = asd_reset_flash(asd_ha);
1151 if (err) {
1152 ASD_DPRINTK("couldn't reset flash. err=%d\n", err);
1153 return err;
1154 }
1155
1156 src_buf = (u8 *)src;
1157 for (i = 0; i < bytes_to_write; i++) {
1158 /* Setup program command sequence */
1159 switch (asd_ha->hw_prof.flash.method) {
1160 case FLASH_METHOD_A:
1161 {
1162 asd_write_reg_byte(asd_ha,
1163 (reg + 0xAAA), 0xAA);
1164 asd_write_reg_byte(asd_ha,
1165 (reg + 0x555), 0x55);
1166 asd_write_reg_byte(asd_ha,
1167 (reg + 0xAAA), 0xA0);
1168 asd_write_reg_byte(asd_ha,
1169 (reg + nv_offset + i),
1170 (*(src_buf + i)));
1171 break;
1172 }
1173 case FLASH_METHOD_B:
1174 {
1175 asd_write_reg_byte(asd_ha,
1176 (reg + 0x555), 0xAA);
1177 asd_write_reg_byte(asd_ha,
1178 (reg + 0x2AA), 0x55);
1179 asd_write_reg_byte(asd_ha,
1180 (reg + 0x555), 0xA0);
1181 asd_write_reg_byte(asd_ha,
1182 (reg + nv_offset + i),
1183 (*(src_buf + i)));
1184 break;
1185 }
1186 default:
1187 break;
1188 }
1189 if (asd_chk_write_status(asd_ha,
1190 (nv_offset + i), 0) != 0) {
1191 ASD_DPRINTK("aicx: Write failed at offset:0x%x\n",
1192 reg + nv_offset + i);
1193 return FAIL_WRITE_FLASH;
1194 }
1195 }
1196
1197 err = asd_reset_flash(asd_ha);
1198 if (err) {
1199 ASD_DPRINTK("couldn't reset flash. err=%d\n", err);
1200 return err;
1201 }
1202 return 0;
1203}
1204
1205int asd_chk_write_status(struct asd_ha_struct *asd_ha,
1206 u32 sector_addr, u8 erase_flag)
1207{
1208 u32 reg;
1209 u32 loop_cnt;
1210 u8 nv_data1, nv_data2;
1211 u8 toggle_bit1;
1212
1213 /*
1214 * Read from DQ2 requires sector address
1215 * while it's dont care for DQ6
1216 */
1217 reg = asd_ha->hw_prof.flash.bar;
1218
1219 for (loop_cnt = 0; loop_cnt < 50000; loop_cnt++) {
1220 nv_data1 = asd_read_reg_byte(asd_ha, reg);
1221 nv_data2 = asd_read_reg_byte(asd_ha, reg);
1222
1223 toggle_bit1 = ((nv_data1 & FLASH_STATUS_BIT_MASK_DQ6)
1224 ^ (nv_data2 & FLASH_STATUS_BIT_MASK_DQ6));
1225
1226 if (toggle_bit1 == 0) {
1227 return 0;
1228 } else {
1229 if (nv_data2 & FLASH_STATUS_BIT_MASK_DQ5) {
1230 nv_data1 = asd_read_reg_byte(asd_ha,
1231 reg);
1232 nv_data2 = asd_read_reg_byte(asd_ha,
1233 reg);
1234 toggle_bit1 =
1235 ((nv_data1 & FLASH_STATUS_BIT_MASK_DQ6)
1236 ^ (nv_data2 & FLASH_STATUS_BIT_MASK_DQ6));
1237
1238 if (toggle_bit1 == 0)
1239 return 0;
1240 }
1241 }
1242
1243 /*
1244 * ERASE is a sector-by-sector operation and requires
1245 * more time to finish while WRITE is byte-byte-byte
1246 * operation and takes lesser time to finish.
1247 *
1248 * For some strange reason a reduced ERASE delay gives different
1249 * behaviour across different spirit boards. Hence we set
1250 * a optimum balance of 50mus for ERASE which works well
1251 * across all boards.
1252 */
1253 if (erase_flag) {
1254 udelay(FLASH_STATUS_ERASE_DELAY_COUNT);
1255 } else {
1256 udelay(FLASH_STATUS_WRITE_DELAY_COUNT);
1257 }
1258 }
1259 return -1;
1260}
1261
1262/**
1263 * asd_hwi_erase_nv_sector - Erase the flash memory sectors.
1264 * @asd_ha: pointer to the host adapter structure
1265 * @flash_addr: pointer to offset from flash memory
1266 * @size: total bytes to erase.
1267 */
1268int asd_erase_nv_sector(struct asd_ha_struct *asd_ha, u32 flash_addr, u32 size)
1269{
1270 u32 reg;
1271 u32 sector_addr;
1272
1273 reg = asd_ha->hw_prof.flash.bar;
1274
1275 /* sector staring address */
1276 sector_addr = flash_addr & FLASH_SECTOR_SIZE_MASK;
1277
1278 /*
1279 * Erasing an flash sector needs to be done in six consecutive
1280 * write cyles.
1281 */
1282 while (sector_addr < flash_addr+size) {
1283 switch (asd_ha->hw_prof.flash.method) {
1284 case FLASH_METHOD_A:
1285 asd_write_reg_byte(asd_ha, (reg + 0xAAA), 0xAA);
1286 asd_write_reg_byte(asd_ha, (reg + 0x555), 0x55);
1287 asd_write_reg_byte(asd_ha, (reg + 0xAAA), 0x80);
1288 asd_write_reg_byte(asd_ha, (reg + 0xAAA), 0xAA);
1289 asd_write_reg_byte(asd_ha, (reg + 0x555), 0x55);
1290 asd_write_reg_byte(asd_ha, (reg + sector_addr), 0x30);
1291 break;
1292 case FLASH_METHOD_B:
1293 asd_write_reg_byte(asd_ha, (reg + 0x555), 0xAA);
1294 asd_write_reg_byte(asd_ha, (reg + 0x2AA), 0x55);
1295 asd_write_reg_byte(asd_ha, (reg + 0x555), 0x80);
1296 asd_write_reg_byte(asd_ha, (reg + 0x555), 0xAA);
1297 asd_write_reg_byte(asd_ha, (reg + 0x2AA), 0x55);
1298 asd_write_reg_byte(asd_ha, (reg + sector_addr), 0x30);
1299 break;
1300 default:
1301 break;
1302 }
1303
1304 if (asd_chk_write_status(asd_ha, sector_addr, 1) != 0)
1305 return FAIL_ERASE_FLASH;
1306
1307 sector_addr += FLASH_SECTOR_SIZE;
1308 }
1309
1310 return 0;
1311}
1312
1313int asd_check_flash_type(struct asd_ha_struct *asd_ha)
1314{
1315 u8 manuf_id;
1316 u8 dev_id;
1317 u8 sec_prot;
1318 u32 inc;
1319 u32 reg;
1320 int err;
1321
1322 /* get Flash memory base address */
1323 reg = asd_ha->hw_prof.flash.bar;
1324
1325 /* Determine flash info */
1326 err = asd_reset_flash(asd_ha);
1327 if (err) {
1328 ASD_DPRINTK("couldn't reset flash. err=%d\n", err);
1329 return err;
1330 }
1331
1332 asd_ha->hw_prof.flash.method = FLASH_METHOD_UNKNOWN;
1333 asd_ha->hw_prof.flash.manuf = FLASH_MANUF_ID_UNKNOWN;
1334 asd_ha->hw_prof.flash.dev_id = FLASH_DEV_ID_UNKNOWN;
1335
1336 /* Get flash info. This would most likely be AMD Am29LV family flash.
1337 * First try the sequence for word mode. It is the same as for
1338 * 008B (byte mode only), 160B (word mode) and 800D (word mode).
1339 */
1340 inc = asd_ha->hw_prof.flash.wide ? 2 : 1;
1341 asd_write_reg_byte(asd_ha, reg + 0xAAA, 0xAA);
1342 asd_write_reg_byte(asd_ha, reg + 0x555, 0x55);
1343 asd_write_reg_byte(asd_ha, reg + 0xAAA, 0x90);
1344 manuf_id = asd_read_reg_byte(asd_ha, reg);
1345 dev_id = asd_read_reg_byte(asd_ha, reg + inc);
1346 sec_prot = asd_read_reg_byte(asd_ha, reg + inc + inc);
1347 /* Get out of autoselect mode. */
1348 err = asd_reset_flash(asd_ha);
1349 if (err) {
1350 ASD_DPRINTK("couldn't reset flash. err=%d\n", err);
1351 return err;
1352 }
1353 ASD_DPRINTK("Flash MethodA manuf_id(0x%x) dev_id(0x%x) "
1354 "sec_prot(0x%x)\n", manuf_id, dev_id, sec_prot);
1355 err = asd_reset_flash(asd_ha);
1356 if (err != 0)
1357 return err;
1358
1359 switch (manuf_id) {
1360 case FLASH_MANUF_ID_AMD:
1361 switch (sec_prot) {
1362 case FLASH_DEV_ID_AM29LV800DT:
1363 case FLASH_DEV_ID_AM29LV640MT:
1364 case FLASH_DEV_ID_AM29F800B:
1365 asd_ha->hw_prof.flash.method = FLASH_METHOD_A;
1366 break;
1367 default:
1368 break;
1369 }
1370 break;
1371 case FLASH_MANUF_ID_ST:
1372 switch (sec_prot) {
1373 case FLASH_DEV_ID_STM29W800DT:
1374 case FLASH_DEV_ID_STM29LV640:
1375 asd_ha->hw_prof.flash.method = FLASH_METHOD_A;
1376 break;
1377 default:
1378 break;
1379 }
1380 break;
1381 case FLASH_MANUF_ID_FUJITSU:
1382 switch (sec_prot) {
1383 case FLASH_DEV_ID_MBM29LV800TE:
1384 case FLASH_DEV_ID_MBM29DL800TA:
1385 asd_ha->hw_prof.flash.method = FLASH_METHOD_A;
1386 break;
1387 }
1388 break;
1389 case FLASH_MANUF_ID_MACRONIX:
1390 switch (sec_prot) {
1391 case FLASH_DEV_ID_MX29LV800BT:
1392 asd_ha->hw_prof.flash.method = FLASH_METHOD_A;
1393 break;
1394 }
1395 break;
1396 }
1397
1398 if (asd_ha->hw_prof.flash.method == FLASH_METHOD_UNKNOWN) {
1399 err = asd_reset_flash(asd_ha);
1400 if (err) {
1401 ASD_DPRINTK("couldn't reset flash. err=%d\n", err);
1402 return err;
1403 }
1404
1405 /* Issue Unlock sequence for AM29LV008BT */
1406 asd_write_reg_byte(asd_ha, (reg + 0x555), 0xAA);
1407 asd_write_reg_byte(asd_ha, (reg + 0x2AA), 0x55);
1408 asd_write_reg_byte(asd_ha, (reg + 0x555), 0x90);
1409 manuf_id = asd_read_reg_byte(asd_ha, reg);
1410 dev_id = asd_read_reg_byte(asd_ha, reg + inc);
1411 sec_prot = asd_read_reg_byte(asd_ha, reg + inc + inc);
1412
1413 ASD_DPRINTK("Flash MethodB manuf_id(0x%x) dev_id(0x%x) sec_prot"
1414 "(0x%x)\n", manuf_id, dev_id, sec_prot);
1415
1416 err = asd_reset_flash(asd_ha);
1417 if (err != 0) {
1418 ASD_DPRINTK("couldn't reset flash. err=%d\n", err);
1419 return err;
1420 }
1421
1422 switch (manuf_id) {
1423 case FLASH_MANUF_ID_AMD:
1424 switch (dev_id) {
1425 case FLASH_DEV_ID_AM29LV008BT:
1426 asd_ha->hw_prof.flash.method = FLASH_METHOD_B;
1427 break;
1428 default:
1429 break;
1430 }
1431 break;
1432 case FLASH_MANUF_ID_ST:
1433 switch (dev_id) {
1434 case FLASH_DEV_ID_STM29008:
1435 asd_ha->hw_prof.flash.method = FLASH_METHOD_B;
1436 break;
1437 default:
1438 break;
1439 }
1440 break;
1441 case FLASH_MANUF_ID_FUJITSU:
1442 switch (dev_id) {
1443 case FLASH_DEV_ID_MBM29LV008TA:
1444 asd_ha->hw_prof.flash.method = FLASH_METHOD_B;
1445 break;
1446 }
1447 break;
1448 case FLASH_MANUF_ID_INTEL:
1449 switch (dev_id) {
1450 case FLASH_DEV_ID_I28LV00TAT:
1451 asd_ha->hw_prof.flash.method = FLASH_METHOD_B;
1452 break;
1453 }
1454 break;
1455 case FLASH_MANUF_ID_MACRONIX:
1456 switch (dev_id) {
1457 case FLASH_DEV_ID_I28LV00TAT:
1458 asd_ha->hw_prof.flash.method = FLASH_METHOD_B;
1459 break;
1460 }
1461 break;
1462 default:
1463 return FAIL_FIND_FLASH_ID;
1464 }
1465 }
1466
1467 if (asd_ha->hw_prof.flash.method == FLASH_METHOD_UNKNOWN)
1468 return FAIL_FIND_FLASH_ID;
1469
1470 asd_ha->hw_prof.flash.manuf = manuf_id;
1471 asd_ha->hw_prof.flash.dev_id = dev_id;
1472 asd_ha->hw_prof.flash.sec_prot = sec_prot;
1473 return 0;
1474}
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.h b/drivers/scsi/aic94xx/aic94xx_sds.h
new file mode 100644
index 000000000000..bb9795a04dc3
--- /dev/null
+++ b/drivers/scsi/aic94xx/aic94xx_sds.h
@@ -0,0 +1,121 @@
1/*
2 * Aic94xx SAS/SATA driver hardware interface header file.
3 *
4 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
5 * Copyright (C) 2005 Gilbert Wu <gilbert_wu@adaptec.com>
6 *
7 * This file is licensed under GPLv2.
8 *
9 * This file is part of the aic94xx driver.
10 *
11 * The aic94xx driver is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; version 2 of the
14 * License.
15 *
16 * The aic94xx driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with the aic94xx driver; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 *
25 */
26#ifndef _AIC94XX_SDS_H_
27#define _AIC94XX_SDS_H_
28
29enum {
30 FLASH_METHOD_UNKNOWN,
31 FLASH_METHOD_A,
32 FLASH_METHOD_B
33};
34
35#define FLASH_MANUF_ID_AMD 0x01
36#define FLASH_MANUF_ID_ST 0x20
37#define FLASH_MANUF_ID_FUJITSU 0x04
38#define FLASH_MANUF_ID_MACRONIX 0xC2
39#define FLASH_MANUF_ID_INTEL 0x89
40#define FLASH_MANUF_ID_UNKNOWN 0xFF
41
42#define FLASH_DEV_ID_AM29LV008BT 0x3E
43#define FLASH_DEV_ID_AM29LV800DT 0xDA
44#define FLASH_DEV_ID_STM29W800DT 0xD7
45#define FLASH_DEV_ID_STM29LV640 0xDE
46#define FLASH_DEV_ID_STM29008 0xEA
47#define FLASH_DEV_ID_MBM29LV800TE 0xDA
48#define FLASH_DEV_ID_MBM29DL800TA 0x4A
49#define FLASH_DEV_ID_MBM29LV008TA 0x3E
50#define FLASH_DEV_ID_AM29LV640MT 0x7E
51#define FLASH_DEV_ID_AM29F800B 0xD6
52#define FLASH_DEV_ID_MX29LV800BT 0xDA
53#define FLASH_DEV_ID_MX29LV008CT 0xDA
54#define FLASH_DEV_ID_I28LV00TAT 0x3E
55#define FLASH_DEV_ID_UNKNOWN 0xFF
56
57/* status bit mask values */
58#define FLASH_STATUS_BIT_MASK_DQ6 0x40
59#define FLASH_STATUS_BIT_MASK_DQ5 0x20
60#define FLASH_STATUS_BIT_MASK_DQ2 0x04
61
62/* minimum value in micro seconds needed for checking status */
63#define FLASH_STATUS_ERASE_DELAY_COUNT 50
64#define FLASH_STATUS_WRITE_DELAY_COUNT 25
65
66#define FLASH_SECTOR_SIZE 0x010000
67#define FLASH_SECTOR_SIZE_MASK 0xffff0000
68
69#define FLASH_OK 0x000000
70#define FAIL_OPEN_BIOS_FILE 0x000100
71#define FAIL_CHECK_PCI_ID 0x000200
72#define FAIL_CHECK_SUM 0x000300
73#define FAIL_UNKNOWN 0x000400
74#define FAIL_VERIFY 0x000500
75#define FAIL_RESET_FLASH 0x000600
76#define FAIL_FIND_FLASH_ID 0x000700
77#define FAIL_ERASE_FLASH 0x000800
78#define FAIL_WRITE_FLASH 0x000900
79#define FAIL_FILE_SIZE 0x000a00
80#define FAIL_PARAMETERS 0x000b00
81#define FAIL_OUT_MEMORY 0x000c00
82#define FLASH_IN_PROGRESS 0x001000
83
84struct controller_id {
85 u32 vendor; /* PCI Vendor ID */
86 u32 device; /* PCI Device ID */
87 u32 sub_vendor; /* PCI Subvendor ID */
88 u32 sub_device; /* PCI Subdevice ID */
89};
90
91struct image_info {
92 u32 ImageId; /* Identifies the image */
93 u32 ImageOffset; /* Offset the beginning of the file */
94 u32 ImageLength; /* length of the image */
95 u32 ImageChecksum; /* Image checksum */
96 u32 ImageVersion; /* Version of the image, could be build number */
97};
98
99struct bios_file_header {
100 u8 signature[32]; /* Signature/Cookie to identify the file */
101 u32 checksum; /*Entire file checksum with this field zero */
102 u32 antidote; /* Entire file checksum with this field 0xFFFFFFFF */
103 struct controller_id contrl_id; /*PCI id to identify the controller */
104 u32 filelen; /*Length of the entire file*/
105 u32 chunk_num; /*The chunk/part number for multiple Image files */
106 u32 total_chunks; /*Total number of chunks/parts in the image file */
107 u32 num_images; /* Number of images in the file */
108 u32 build_num; /* Build number of this image */
109 struct image_info image_header;
110};
111
112int asd_verify_flash_seg(struct asd_ha_struct *asd_ha,
113 void *src, u32 dest_offset, u32 bytes_to_verify);
114int asd_write_flash_seg(struct asd_ha_struct *asd_ha,
115 void *src, u32 dest_offset, u32 bytes_to_write);
116int asd_chk_write_status(struct asd_ha_struct *asd_ha,
117 u32 sector_addr, u8 erase_flag);
118int asd_check_flash_type(struct asd_ha_struct *asd_ha);
119int asd_erase_nv_sector(struct asd_ha_struct *asd_ha,
120 u32 flash_addr, u32 size);
121#endif
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index ee0a98bffcd4..965d4bb999d9 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -187,29 +187,13 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb,
187 ts->buf_valid_size = 0; 187 ts->buf_valid_size = 0;
188 edb = asd_ha->seq.edb_arr[edb_id + escb->edb_index]; 188 edb = asd_ha->seq.edb_arr[edb_id + escb->edb_index];
189 r = edb->vaddr; 189 r = edb->vaddr;
190 if (task->task_proto == SAS_PROTO_SSP) { 190 if (task->task_proto == SAS_PROTOCOL_SSP) {
191 struct ssp_response_iu *iu = 191 struct ssp_response_iu *iu =
192 r + 16 + sizeof(struct ssp_frame_hdr); 192 r + 16 + sizeof(struct ssp_frame_hdr);
193 193
194 ts->residual = le32_to_cpu(*(__le32 *)r); 194 ts->residual = le32_to_cpu(*(__le32 *)r);
195 ts->resp = SAS_TASK_COMPLETE; 195
196 if (iu->datapres == 0) 196 sas_ssp_task_response(&asd_ha->pcidev->dev, task, iu);
197 ts->stat = iu->status;
198 else if (iu->datapres == 1)
199 ts->stat = iu->resp_data[3];
200 else if (iu->datapres == 2) {
201 ts->stat = SAM_CHECK_COND;
202 ts->buf_valid_size = min((u32) SAS_STATUS_BUF_SIZE,
203 be32_to_cpu(iu->sense_data_len));
204 memcpy(ts->buf, iu->sense_data, ts->buf_valid_size);
205 if (iu->status != SAM_CHECK_COND) {
206 ASD_DPRINTK("device %llx sent sense data, but "
207 "stat(0x%x) is not CHECK_CONDITION"
208 "\n",
209 SAS_ADDR(task->dev->sas_addr),
210 iu->status);
211 }
212 }
213 } else { 197 } else {
214 struct ata_task_resp *resp = (void *) &ts->buf[0]; 198 struct ata_task_resp *resp = (void *) &ts->buf[0];
215 199
@@ -341,14 +325,14 @@ Again:
341 } 325 }
342 326
343 switch (task->task_proto) { 327 switch (task->task_proto) {
344 case SATA_PROTO: 328 case SAS_PROTOCOL_SATA:
345 case SAS_PROTO_STP: 329 case SAS_PROTOCOL_STP:
346 asd_unbuild_ata_ascb(ascb); 330 asd_unbuild_ata_ascb(ascb);
347 break; 331 break;
348 case SAS_PROTO_SMP: 332 case SAS_PROTOCOL_SMP:
349 asd_unbuild_smp_ascb(ascb); 333 asd_unbuild_smp_ascb(ascb);
350 break; 334 break;
351 case SAS_PROTO_SSP: 335 case SAS_PROTOCOL_SSP:
352 asd_unbuild_ssp_ascb(ascb); 336 asd_unbuild_ssp_ascb(ascb);
353 default: 337 default:
354 break; 338 break;
@@ -586,17 +570,17 @@ int asd_execute_task(struct sas_task *task, const int num,
586 list_for_each_entry(a, &alist, list) { 570 list_for_each_entry(a, &alist, list) {
587 t = a->uldd_task; 571 t = a->uldd_task;
588 a->uldd_timer = 1; 572 a->uldd_timer = 1;
589 if (t->task_proto & SAS_PROTO_STP) 573 if (t->task_proto & SAS_PROTOCOL_STP)
590 t->task_proto = SAS_PROTO_STP; 574 t->task_proto = SAS_PROTOCOL_STP;
591 switch (t->task_proto) { 575 switch (t->task_proto) {
592 case SATA_PROTO: 576 case SAS_PROTOCOL_SATA:
593 case SAS_PROTO_STP: 577 case SAS_PROTOCOL_STP:
594 res = asd_build_ata_ascb(a, t, gfp_flags); 578 res = asd_build_ata_ascb(a, t, gfp_flags);
595 break; 579 break;
596 case SAS_PROTO_SMP: 580 case SAS_PROTOCOL_SMP:
597 res = asd_build_smp_ascb(a, t, gfp_flags); 581 res = asd_build_smp_ascb(a, t, gfp_flags);
598 break; 582 break;
599 case SAS_PROTO_SSP: 583 case SAS_PROTOCOL_SSP:
600 res = asd_build_ssp_ascb(a, t, gfp_flags); 584 res = asd_build_ssp_ascb(a, t, gfp_flags);
601 break; 585 break;
602 default: 586 default:
@@ -633,14 +617,14 @@ out_err_unmap:
633 t->task_state_flags &= ~SAS_TASK_AT_INITIATOR; 617 t->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
634 spin_unlock_irqrestore(&t->task_state_lock, flags); 618 spin_unlock_irqrestore(&t->task_state_lock, flags);
635 switch (t->task_proto) { 619 switch (t->task_proto) {
636 case SATA_PROTO: 620 case SAS_PROTOCOL_SATA:
637 case SAS_PROTO_STP: 621 case SAS_PROTOCOL_STP:
638 asd_unbuild_ata_ascb(a); 622 asd_unbuild_ata_ascb(a);
639 break; 623 break;
640 case SAS_PROTO_SMP: 624 case SAS_PROTOCOL_SMP:
641 asd_unbuild_smp_ascb(a); 625 asd_unbuild_smp_ascb(a);
642 break; 626 break;
643 case SAS_PROTO_SSP: 627 case SAS_PROTOCOL_SSP:
644 asd_unbuild_ssp_ascb(a); 628 asd_unbuild_ssp_ascb(a);
645 default: 629 default:
646 break; 630 break;
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c
index c0d0b7d7a8ce..87b2f6e6adfe 100644
--- a/drivers/scsi/aic94xx/aic94xx_tmf.c
+++ b/drivers/scsi/aic94xx/aic94xx_tmf.c
@@ -372,21 +372,21 @@ int asd_abort_task(struct sas_task *task)
372 scb->header.opcode = ABORT_TASK; 372 scb->header.opcode = ABORT_TASK;
373 373
374 switch (task->task_proto) { 374 switch (task->task_proto) {
375 case SATA_PROTO: 375 case SAS_PROTOCOL_SATA:
376 case SAS_PROTO_STP: 376 case SAS_PROTOCOL_STP:
377 scb->abort_task.proto_conn_rate = (1 << 5); /* STP */ 377 scb->abort_task.proto_conn_rate = (1 << 5); /* STP */
378 break; 378 break;
379 case SAS_PROTO_SSP: 379 case SAS_PROTOCOL_SSP:
380 scb->abort_task.proto_conn_rate = (1 << 4); /* SSP */ 380 scb->abort_task.proto_conn_rate = (1 << 4); /* SSP */
381 scb->abort_task.proto_conn_rate |= task->dev->linkrate; 381 scb->abort_task.proto_conn_rate |= task->dev->linkrate;
382 break; 382 break;
383 case SAS_PROTO_SMP: 383 case SAS_PROTOCOL_SMP:
384 break; 384 break;
385 default: 385 default:
386 break; 386 break;
387 } 387 }
388 388
389 if (task->task_proto == SAS_PROTO_SSP) { 389 if (task->task_proto == SAS_PROTOCOL_SSP) {
390 scb->abort_task.ssp_frame.frame_type = SSP_TASK; 390 scb->abort_task.ssp_frame.frame_type = SSP_TASK;
391 memcpy(scb->abort_task.ssp_frame.hashed_dest_addr, 391 memcpy(scb->abort_task.ssp_frame.hashed_dest_addr,
392 task->dev->hashed_sas_addr, HASHED_SAS_ADDR_SIZE); 392 task->dev->hashed_sas_addr, HASHED_SAS_ADDR_SIZE);
@@ -512,7 +512,7 @@ static int asd_initiate_ssp_tmf(struct domain_device *dev, u8 *lun,
512 int res = 1; 512 int res = 1;
513 struct scb *scb; 513 struct scb *scb;
514 514
515 if (!(dev->tproto & SAS_PROTO_SSP)) 515 if (!(dev->tproto & SAS_PROTOCOL_SSP))
516 return TMF_RESP_FUNC_ESUPP; 516 return TMF_RESP_FUNC_ESUPP;
517 517
518 ascb = asd_ascb_alloc_list(asd_ha, &res, GFP_KERNEL); 518 ascb = asd_ascb_alloc_list(asd_ha, &res, GFP_KERNEL);