diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-02-27 11:51:52 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-02-27 11:51:52 -0500 |
commit | 1ed82ae3df3882bfcb5bfe5e9f97e4e8e23af299 (patch) | |
tree | 7f30dbdccd6c28aa4e8f2c9edb7813a7ae78097b /drivers/scsi | |
parent | 11fff8287fdaeb700df79aa8253650b60c7b21e2 (diff) | |
parent | cccc65a3b60edaf721cdee5a14f68ba009341822 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/esp.c | 4 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 252 | ||||
-rw-r--r-- | drivers/scsi/sata_sil.c | 52 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 20 |
4 files changed, 189 insertions, 139 deletions
diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index f6900538be90..87a8c3d2072c 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c | |||
@@ -2068,14 +2068,12 @@ static int esp_reset(struct scsi_cmnd *SCptr) | |||
2068 | { | 2068 | { |
2069 | struct esp *esp = (struct esp *) SCptr->device->host->hostdata; | 2069 | struct esp *esp = (struct esp *) SCptr->device->host->hostdata; |
2070 | 2070 | ||
2071 | spin_lock_irq(esp->ehost->host_lock); | ||
2071 | (void) esp_do_resetbus(esp); | 2072 | (void) esp_do_resetbus(esp); |
2072 | |||
2073 | spin_unlock_irq(esp->ehost->host_lock); | 2073 | spin_unlock_irq(esp->ehost->host_lock); |
2074 | 2074 | ||
2075 | wait_event(esp->reset_queue, (esp->resetting_bus == 0)); | 2075 | wait_event(esp->reset_queue, (esp->resetting_bus == 0)); |
2076 | 2076 | ||
2077 | spin_lock_irq(esp->ehost->host_lock); | ||
2078 | |||
2079 | return SUCCESS; | 2077 | return SUCCESS; |
2080 | } | 2078 | } |
2081 | 2079 | ||
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 8b83c4e45208..9de1e285e0b2 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -61,7 +61,6 @@ | |||
61 | 61 | ||
62 | #include "libata.h" | 62 | #include "libata.h" |
63 | 63 | ||
64 | static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); | ||
65 | static unsigned int ata_dev_init_params(struct ata_port *ap, | 64 | static unsigned int ata_dev_init_params(struct ata_port *ap, |
66 | struct ata_device *dev); | 65 | struct ata_device *dev); |
67 | static void ata_set_mode(struct ata_port *ap); | 66 | static void ata_set_mode(struct ata_port *ap); |
@@ -896,42 +895,36 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
896 | } | 895 | } |
897 | 896 | ||
898 | /** | 897 | /** |
899 | * ata_dev_identify - obtain IDENTIFY x DEVICE page | 898 | * ata_dev_read_id - Read ID data from the specified device |
900 | * @ap: port on which device we wish to probe resides | 899 | * @ap: port on which target device resides |
901 | * @device: device bus address, starting at zero | 900 | * @dev: target device |
902 | * | 901 | * @p_class: pointer to class of the target device (may be changed) |
903 | * Following bus reset, we issue the IDENTIFY [PACKET] DEVICE | 902 | * @post_reset: is this read ID post-reset? |
904 | * command, and read back the 512-byte device information page. | 903 | * @id: buffer to fill IDENTIFY page into |
905 | * The device information page is fed to us via the standard | 904 | * |
906 | * PIO-IN protocol, but we hand-code it here. (TODO: investigate | 905 | * Read ID data from the specified device. ATA_CMD_ID_ATA is |
907 | * using standard PIO-IN paths) | 906 | * performed on ATA devices and ATA_CMD_ID_ATAPI on ATAPI |
908 | * | 907 | * devices. This function also takes care of EDD signature |
909 | * After reading the device information page, we use several | 908 | * misreporting (to be removed once EDD support is gone) and |
910 | * bits of information from it to initialize data structures | 909 | * issues ATA_CMD_INIT_DEV_PARAMS for pre-ATA4 drives. |
911 | * that will be used during the lifetime of the ata_device. | ||
912 | * Other data from the info page is used to disqualify certain | ||
913 | * older ATA devices we do not wish to support. | ||
914 | * | 910 | * |
915 | * LOCKING: | 911 | * LOCKING: |
916 | * Inherited from caller. Some functions called by this function | 912 | * Kernel thread context (may sleep) |
917 | * obtain the host_set lock. | 913 | * |
914 | * RETURNS: | ||
915 | * 0 on success, -errno otherwise. | ||
918 | */ | 916 | */ |
919 | 917 | static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |
920 | static void ata_dev_identify(struct ata_port *ap, unsigned int device) | 918 | unsigned int *p_class, int post_reset, u16 *id) |
921 | { | 919 | { |
922 | struct ata_device *dev = &ap->device[device]; | 920 | unsigned int class = *p_class; |
923 | unsigned int major_version; | ||
924 | unsigned long xfer_modes; | ||
925 | unsigned int using_edd; | 921 | unsigned int using_edd; |
926 | struct ata_taskfile tf; | 922 | struct ata_taskfile tf; |
927 | unsigned int err_mask; | 923 | unsigned int err_mask = 0; |
928 | int i, rc; | 924 | const char *reason; |
925 | int rc; | ||
929 | 926 | ||
930 | if (!ata_dev_present(dev)) { | 927 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, dev->devno); |
931 | DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n", | ||
932 | ap->id, device); | ||
933 | return; | ||
934 | } | ||
935 | 928 | ||
936 | if (ap->ops->probe_reset || | 929 | if (ap->ops->probe_reset || |
937 | ap->flags & (ATA_FLAG_SRST | ATA_FLAG_SATA_RESET)) | 930 | ap->flags & (ATA_FLAG_SRST | ATA_FLAG_SATA_RESET)) |
@@ -939,30 +932,33 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) | |||
939 | else | 932 | else |
940 | using_edd = 1; | 933 | using_edd = 1; |
941 | 934 | ||
942 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, device); | 935 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ |
943 | |||
944 | WARN_ON(dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ATAPI && | ||
945 | dev->class != ATA_DEV_NONE); | ||
946 | |||
947 | ata_dev_select(ap, device, 1, 1); /* select device 0/1 */ | ||
948 | 936 | ||
949 | retry: | 937 | retry: |
950 | ata_tf_init(ap, &tf, device); | 938 | ata_tf_init(ap, &tf, dev->devno); |
951 | 939 | ||
952 | if (dev->class == ATA_DEV_ATA) { | 940 | switch (class) { |
941 | case ATA_DEV_ATA: | ||
953 | tf.command = ATA_CMD_ID_ATA; | 942 | tf.command = ATA_CMD_ID_ATA; |
954 | DPRINTK("do ATA identify\n"); | 943 | break; |
955 | } else { | 944 | case ATA_DEV_ATAPI: |
956 | tf.command = ATA_CMD_ID_ATAPI; | 945 | tf.command = ATA_CMD_ID_ATAPI; |
957 | DPRINTK("do ATAPI identify\n"); | 946 | break; |
947 | default: | ||
948 | rc = -ENODEV; | ||
949 | reason = "unsupported class"; | ||
950 | goto err_out; | ||
958 | } | 951 | } |
959 | 952 | ||
960 | tf.protocol = ATA_PROT_PIO; | 953 | tf.protocol = ATA_PROT_PIO; |
961 | 954 | ||
962 | err_mask = ata_exec_internal(ap, dev, &tf, DMA_FROM_DEVICE, | 955 | err_mask = ata_exec_internal(ap, dev, &tf, DMA_FROM_DEVICE, |
963 | dev->id, sizeof(dev->id)); | 956 | id, sizeof(id[0]) * ATA_ID_WORDS); |
964 | 957 | ||
965 | if (err_mask) { | 958 | if (err_mask) { |
959 | rc = -EIO; | ||
960 | reason = "I/O error"; | ||
961 | |||
966 | if (err_mask & ~AC_ERR_DEV) | 962 | if (err_mask & ~AC_ERR_DEV) |
967 | goto err_out; | 963 | goto err_out; |
968 | 964 | ||
@@ -977,25 +973,105 @@ retry: | |||
977 | * ATA software reset (SRST, the default) does not appear | 973 | * ATA software reset (SRST, the default) does not appear |
978 | * to have this problem. | 974 | * to have this problem. |
979 | */ | 975 | */ |
980 | if ((using_edd) && (dev->class == ATA_DEV_ATA)) { | 976 | if ((using_edd) && (class == ATA_DEV_ATA)) { |
981 | u8 err = tf.feature; | 977 | u8 err = tf.feature; |
982 | if (err & ATA_ABORTED) { | 978 | if (err & ATA_ABORTED) { |
983 | dev->class = ATA_DEV_ATAPI; | 979 | class = ATA_DEV_ATAPI; |
984 | goto retry; | 980 | goto retry; |
985 | } | 981 | } |
986 | } | 982 | } |
987 | goto err_out; | 983 | goto err_out; |
988 | } | 984 | } |
989 | 985 | ||
990 | swap_buf_le16(dev->id, ATA_ID_WORDS); | 986 | swap_buf_le16(id, ATA_ID_WORDS); |
991 | 987 | ||
992 | /* print device capabilities */ | 988 | /* print device capabilities */ |
993 | printk(KERN_DEBUG "ata%u: dev %u cfg " | 989 | printk(KERN_DEBUG "ata%u: dev %u cfg " |
994 | "49:%04x 82:%04x 83:%04x 84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n", | 990 | "49:%04x 82:%04x 83:%04x 84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n", |
995 | ap->id, device, dev->id[49], | 991 | ap->id, dev->devno, |
996 | dev->id[82], dev->id[83], dev->id[84], | 992 | id[49], id[82], id[83], id[84], id[85], id[86], id[87], id[88]); |
997 | dev->id[85], dev->id[86], dev->id[87], | 993 | |
998 | dev->id[88]); | 994 | /* sanity check */ |
995 | if ((class == ATA_DEV_ATA) != ata_id_is_ata(id)) { | ||
996 | rc = -EINVAL; | ||
997 | reason = "device reports illegal type"; | ||
998 | goto err_out; | ||
999 | } | ||
1000 | |||
1001 | if (post_reset && class == ATA_DEV_ATA) { | ||
1002 | /* | ||
1003 | * The exact sequence expected by certain pre-ATA4 drives is: | ||
1004 | * SRST RESET | ||
1005 | * IDENTIFY | ||
1006 | * INITIALIZE DEVICE PARAMETERS | ||
1007 | * anything else.. | ||
1008 | * Some drives were very specific about that exact sequence. | ||
1009 | */ | ||
1010 | if (ata_id_major_version(id) < 4 || !ata_id_has_lba(id)) { | ||
1011 | err_mask = ata_dev_init_params(ap, dev); | ||
1012 | if (err_mask) { | ||
1013 | rc = -EIO; | ||
1014 | reason = "INIT_DEV_PARAMS failed"; | ||
1015 | goto err_out; | ||
1016 | } | ||
1017 | |||
1018 | /* current CHS translation info (id[53-58]) might be | ||
1019 | * changed. reread the identify device info. | ||
1020 | */ | ||
1021 | post_reset = 0; | ||
1022 | goto retry; | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | *p_class = class; | ||
1027 | return 0; | ||
1028 | |||
1029 | err_out: | ||
1030 | printk(KERN_WARNING "ata%u: dev %u failed to IDENTIFY (%s)\n", | ||
1031 | ap->id, dev->devno, reason); | ||
1032 | kfree(id); | ||
1033 | return rc; | ||
1034 | } | ||
1035 | |||
1036 | /** | ||
1037 | * ata_dev_identify - obtain IDENTIFY x DEVICE page | ||
1038 | * @ap: port on which device we wish to probe resides | ||
1039 | * @device: device bus address, starting at zero | ||
1040 | * | ||
1041 | * Following bus reset, we issue the IDENTIFY [PACKET] DEVICE | ||
1042 | * command, and read back the 512-byte device information page. | ||
1043 | * The device information page is fed to us via the standard | ||
1044 | * PIO-IN protocol, but we hand-code it here. (TODO: investigate | ||
1045 | * using standard PIO-IN paths) | ||
1046 | * | ||
1047 | * After reading the device information page, we use several | ||
1048 | * bits of information from it to initialize data structures | ||
1049 | * that will be used during the lifetime of the ata_device. | ||
1050 | * Other data from the info page is used to disqualify certain | ||
1051 | * older ATA devices we do not wish to support. | ||
1052 | * | ||
1053 | * LOCKING: | ||
1054 | * Inherited from caller. Some functions called by this function | ||
1055 | * obtain the host_set lock. | ||
1056 | */ | ||
1057 | |||
1058 | static void ata_dev_identify(struct ata_port *ap, unsigned int device) | ||
1059 | { | ||
1060 | struct ata_device *dev = &ap->device[device]; | ||
1061 | unsigned long xfer_modes; | ||
1062 | int i, rc; | ||
1063 | |||
1064 | if (!ata_dev_present(dev)) { | ||
1065 | DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n", | ||
1066 | ap->id, device); | ||
1067 | return; | ||
1068 | } | ||
1069 | |||
1070 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, device); | ||
1071 | |||
1072 | rc = ata_dev_read_id(ap, dev, &dev->class, 1, dev->id); | ||
1073 | if (rc) | ||
1074 | goto err_out; | ||
999 | 1075 | ||
1000 | /* | 1076 | /* |
1001 | * common ATA, ATAPI feature tests | 1077 | * common ATA, ATAPI feature tests |
@@ -1020,34 +1096,6 @@ retry: | |||
1020 | if (dev->class == ATA_DEV_ATA) { | 1096 | if (dev->class == ATA_DEV_ATA) { |
1021 | dev->n_sectors = ata_id_n_sectors(dev->id); | 1097 | dev->n_sectors = ata_id_n_sectors(dev->id); |
1022 | 1098 | ||
1023 | if (!ata_id_is_ata(dev->id)) /* sanity check */ | ||
1024 | goto err_out_nosup; | ||
1025 | |||
1026 | /* get major version */ | ||
1027 | major_version = ata_id_major_version(dev->id); | ||
1028 | |||
1029 | /* | ||
1030 | * The exact sequence expected by certain pre-ATA4 drives is: | ||
1031 | * SRST RESET | ||
1032 | * IDENTIFY | ||
1033 | * INITIALIZE DEVICE PARAMETERS | ||
1034 | * anything else.. | ||
1035 | * Some drives were very specific about that exact sequence. | ||
1036 | */ | ||
1037 | if (major_version < 4 || (!ata_id_has_lba(dev->id))) { | ||
1038 | err_mask = ata_dev_init_params(ap, dev); | ||
1039 | if (err_mask) { | ||
1040 | printk(KERN_ERR "ata%u: failed to init " | ||
1041 | "parameters, disabled\n", ap->id); | ||
1042 | goto err_out; | ||
1043 | } | ||
1044 | |||
1045 | /* current CHS translation info (id[53-58]) might be | ||
1046 | * changed. reread the identify device info. | ||
1047 | */ | ||
1048 | ata_dev_reread_id(ap, dev); | ||
1049 | } | ||
1050 | |||
1051 | if (ata_id_has_lba(dev->id)) { | 1099 | if (ata_id_has_lba(dev->id)) { |
1052 | dev->flags |= ATA_DFLAG_LBA; | 1100 | dev->flags |= ATA_DFLAG_LBA; |
1053 | 1101 | ||
@@ -1057,7 +1105,7 @@ retry: | |||
1057 | /* print device info to dmesg */ | 1105 | /* print device info to dmesg */ |
1058 | printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n", | 1106 | printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n", |
1059 | ap->id, device, | 1107 | ap->id, device, |
1060 | major_version, | 1108 | ata_id_major_version(dev->id), |
1061 | ata_mode_string(xfer_modes), | 1109 | ata_mode_string(xfer_modes), |
1062 | (unsigned long long)dev->n_sectors, | 1110 | (unsigned long long)dev->n_sectors, |
1063 | dev->flags & ATA_DFLAG_LBA48 ? " LBA48" : " LBA"); | 1111 | dev->flags & ATA_DFLAG_LBA48 ? " LBA48" : " LBA"); |
@@ -1079,7 +1127,7 @@ retry: | |||
1079 | /* print device info to dmesg */ | 1127 | /* print device info to dmesg */ |
1080 | printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors: CHS %d/%d/%d\n", | 1128 | printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors: CHS %d/%d/%d\n", |
1081 | ap->id, device, | 1129 | ap->id, device, |
1082 | major_version, | 1130 | ata_id_major_version(dev->id), |
1083 | ata_mode_string(xfer_modes), | 1131 | ata_mode_string(xfer_modes), |
1084 | (unsigned long long)dev->n_sectors, | 1132 | (unsigned long long)dev->n_sectors, |
1085 | (int)dev->cylinders, (int)dev->heads, (int)dev->sectors); | 1133 | (int)dev->cylinders, (int)dev->heads, (int)dev->sectors); |
@@ -1096,9 +1144,6 @@ retry: | |||
1096 | 1144 | ||
1097 | /* ATAPI-specific feature tests */ | 1145 | /* ATAPI-specific feature tests */ |
1098 | else if (dev->class == ATA_DEV_ATAPI) { | 1146 | else if (dev->class == ATA_DEV_ATAPI) { |
1099 | if (ata_id_is_ata(dev->id)) /* sanity check */ | ||
1100 | goto err_out_nosup; | ||
1101 | |||
1102 | rc = atapi_cdb_len(dev->id); | 1147 | rc = atapi_cdb_len(dev->id); |
1103 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { | 1148 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { |
1104 | printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id); | 1149 | printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id); |
@@ -2490,47 +2535,6 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) | |||
2490 | } | 2535 | } |
2491 | 2536 | ||
2492 | /** | 2537 | /** |
2493 | * ata_dev_reread_id - Reread the device identify device info | ||
2494 | * @ap: port where the device is | ||
2495 | * @dev: device to reread the identify device info | ||
2496 | * | ||
2497 | * LOCKING: | ||
2498 | */ | ||
2499 | |||
2500 | static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev) | ||
2501 | { | ||
2502 | struct ata_taskfile tf; | ||
2503 | |||
2504 | ata_tf_init(ap, &tf, dev->devno); | ||
2505 | |||
2506 | if (dev->class == ATA_DEV_ATA) { | ||
2507 | tf.command = ATA_CMD_ID_ATA; | ||
2508 | DPRINTK("do ATA identify\n"); | ||
2509 | } else { | ||
2510 | tf.command = ATA_CMD_ID_ATAPI; | ||
2511 | DPRINTK("do ATAPI identify\n"); | ||
2512 | } | ||
2513 | |||
2514 | tf.flags |= ATA_TFLAG_DEVICE; | ||
2515 | tf.protocol = ATA_PROT_PIO; | ||
2516 | |||
2517 | if (ata_exec_internal(ap, dev, &tf, DMA_FROM_DEVICE, | ||
2518 | dev->id, sizeof(dev->id))) | ||
2519 | goto err_out; | ||
2520 | |||
2521 | swap_buf_le16(dev->id, ATA_ID_WORDS); | ||
2522 | |||
2523 | ata_dump_id(dev->id); | ||
2524 | |||
2525 | DPRINTK("EXIT\n"); | ||
2526 | |||
2527 | return; | ||
2528 | err_out: | ||
2529 | printk(KERN_ERR "ata%u: failed to reread ID, disabled\n", ap->id); | ||
2530 | ata_port_disable(ap); | ||
2531 | } | ||
2532 | |||
2533 | /** | ||
2534 | * ata_dev_init_params - Issue INIT DEV PARAMS command | 2538 | * ata_dev_init_params - Issue INIT DEV PARAMS command |
2535 | * @ap: Port associated with device @dev | 2539 | * @ap: Port associated with device @dev |
2536 | * @dev: Device to which command will be sent | 2540 | * @dev: Device to which command will be sent |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index e14ed4ebbeed..91ecf527bb8a 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -49,11 +49,13 @@ | |||
49 | #define DRV_VERSION "0.9" | 49 | #define DRV_VERSION "0.9" |
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), | ||
52 | SIL_FLAG_MOD15WRITE = (1 << 30), | 53 | SIL_FLAG_MOD15WRITE = (1 << 30), |
53 | 54 | ||
54 | sil_3112 = 0, | 55 | sil_3112 = 0, |
55 | sil_3112_m15w = 1, | 56 | sil_3112_m15w = 1, |
56 | sil_3114 = 2, | 57 | sil_3512 = 2, |
58 | sil_3114 = 3, | ||
57 | 59 | ||
58 | SIL_FIFO_R0 = 0x40, | 60 | SIL_FIFO_R0 = 0x40, |
59 | SIL_FIFO_W0 = 0x41, | 61 | SIL_FIFO_W0 = 0x41, |
@@ -90,7 +92,7 @@ static void sil_post_set_mode (struct ata_port *ap); | |||
90 | static const struct pci_device_id sil_pci_tbl[] = { | 92 | static const struct pci_device_id sil_pci_tbl[] = { |
91 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 93 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
92 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 94 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
93 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, | 95 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 }, |
94 | { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, | 96 | { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, |
95 | { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 97 | { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
96 | { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 98 | { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
@@ -185,7 +187,8 @@ static const struct ata_port_info sil_port_info[] = { | |||
185 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 187 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
186 | .udma_mask = 0x3f, /* udma0-5 */ | 188 | .udma_mask = 0x3f, /* udma0-5 */ |
187 | .port_ops = &sil_ops, | 189 | .port_ops = &sil_ops, |
188 | }, /* sil_3112_15w - keep it sync'd w/ sil_3112 */ | 190 | }, |
191 | /* sil_3112_15w - keep it sync'd w/ sil_3112 */ | ||
189 | { | 192 | { |
190 | .sht = &sil_sht, | 193 | .sht = &sil_sht, |
191 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 194 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
@@ -194,11 +197,24 @@ static const struct ata_port_info sil_port_info[] = { | |||
194 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 197 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
195 | .udma_mask = 0x3f, /* udma0-5 */ | 198 | .udma_mask = 0x3f, /* udma0-5 */ |
196 | .port_ops = &sil_ops, | 199 | .port_ops = &sil_ops, |
197 | }, /* sil_3114 */ | 200 | }, |
201 | /* sil_3512 */ | ||
198 | { | 202 | { |
199 | .sht = &sil_sht, | 203 | .sht = &sil_sht, |
200 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 204 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
201 | ATA_FLAG_MMIO, | 205 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
206 | SIL_FLAG_RERR_ON_DMA_ACT, | ||
207 | .pio_mask = 0x1f, /* pio0-4 */ | ||
208 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
209 | .udma_mask = 0x3f, /* udma0-5 */ | ||
210 | .port_ops = &sil_ops, | ||
211 | }, | ||
212 | /* sil_3114 */ | ||
213 | { | ||
214 | .sht = &sil_sht, | ||
215 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
216 | ATA_FLAG_MMIO | | ||
217 | SIL_FLAG_RERR_ON_DMA_ACT, | ||
202 | .pio_mask = 0x1f, /* pio0-4 */ | 218 | .pio_mask = 0x1f, /* pio0-4 */ |
203 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 219 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
204 | .udma_mask = 0x3f, /* udma0-5 */ | 220 | .udma_mask = 0x3f, /* udma0-5 */ |
@@ -215,12 +231,13 @@ static const struct { | |||
215 | unsigned long scr; /* SATA control register block */ | 231 | unsigned long scr; /* SATA control register block */ |
216 | unsigned long sien; /* SATA Interrupt Enable register */ | 232 | unsigned long sien; /* SATA Interrupt Enable register */ |
217 | unsigned long xfer_mode;/* data transfer mode register */ | 233 | unsigned long xfer_mode;/* data transfer mode register */ |
234 | unsigned long sfis_cfg; /* SATA FIS reception config register */ | ||
218 | } sil_port[] = { | 235 | } sil_port[] = { |
219 | /* port 0 ... */ | 236 | /* port 0 ... */ |
220 | { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4 }, | 237 | { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4, 0x14c }, |
221 | { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4 }, | 238 | { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4, 0x1cc }, |
222 | { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4 }, | 239 | { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4, 0x34c }, |
223 | { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4 }, | 240 | { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4, 0x3cc }, |
224 | /* ... port 3 */ | 241 | /* ... port 3 */ |
225 | }; | 242 | }; |
226 | 243 | ||
@@ -458,6 +475,23 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
458 | dev_printk(KERN_WARNING, &pdev->dev, | 475 | dev_printk(KERN_WARNING, &pdev->dev, |
459 | "cache line size not set. Driver may not function\n"); | 476 | "cache line size not set. Driver may not function\n"); |
460 | 477 | ||
478 | /* Apply R_ERR on DMA activate FIS errata workaround */ | ||
479 | if (probe_ent->host_flags & SIL_FLAG_RERR_ON_DMA_ACT) { | ||
480 | int cnt; | ||
481 | |||
482 | for (i = 0, cnt = 0; i < probe_ent->n_ports; i++) { | ||
483 | tmp = readl(mmio_base + sil_port[i].sfis_cfg); | ||
484 | if ((tmp & 0x3) != 0x01) | ||
485 | continue; | ||
486 | if (!cnt) | ||
487 | dev_printk(KERN_INFO, &pdev->dev, | ||
488 | "Applying R_ERR on DMA activate " | ||
489 | "FIS errata fix\n"); | ||
490 | writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg); | ||
491 | cnt++; | ||
492 | } | ||
493 | } | ||
494 | |||
461 | if (ent->driver_data == sil_3114) { | 495 | if (ent->driver_data == sil_3114) { |
462 | irq_mask = SIL_MASK_4PORT; | 496 | irq_mask = SIL_MASK_4PORT; |
463 | 497 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 930db398d107..9d9872347f56 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -89,6 +89,11 @@ | |||
89 | #define SD_MAX_RETRIES 5 | 89 | #define SD_MAX_RETRIES 5 |
90 | #define SD_PASSTHROUGH_RETRIES 1 | 90 | #define SD_PASSTHROUGH_RETRIES 1 |
91 | 91 | ||
92 | /* | ||
93 | * Size of the initial data buffer for mode and read capacity data | ||
94 | */ | ||
95 | #define SD_BUF_SIZE 512 | ||
96 | |||
92 | static void scsi_disk_release(struct kref *kref); | 97 | static void scsi_disk_release(struct kref *kref); |
93 | 98 | ||
94 | struct scsi_disk { | 99 | struct scsi_disk { |
@@ -1239,7 +1244,7 @@ sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage, | |||
1239 | 1244 | ||
1240 | /* | 1245 | /* |
1241 | * read write protect setting, if possible - called only in sd_revalidate_disk() | 1246 | * read write protect setting, if possible - called only in sd_revalidate_disk() |
1242 | * called with buffer of length 512 | 1247 | * called with buffer of length SD_BUF_SIZE |
1243 | */ | 1248 | */ |
1244 | static void | 1249 | static void |
1245 | sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, | 1250 | sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, |
@@ -1297,7 +1302,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, | |||
1297 | 1302 | ||
1298 | /* | 1303 | /* |
1299 | * sd_read_cache_type - called only from sd_revalidate_disk() | 1304 | * sd_read_cache_type - called only from sd_revalidate_disk() |
1300 | * called with buffer of length 512 | 1305 | * called with buffer of length SD_BUF_SIZE |
1301 | */ | 1306 | */ |
1302 | static void | 1307 | static void |
1303 | sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | 1308 | sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, |
@@ -1342,6 +1347,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1342 | 1347 | ||
1343 | /* Take headers and block descriptors into account */ | 1348 | /* Take headers and block descriptors into account */ |
1344 | len += data.header_length + data.block_descriptor_length; | 1349 | len += data.header_length + data.block_descriptor_length; |
1350 | if (len > SD_BUF_SIZE) | ||
1351 | goto bad_sense; | ||
1345 | 1352 | ||
1346 | /* Get the data */ | 1353 | /* Get the data */ |
1347 | res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); | 1354 | res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); |
@@ -1354,6 +1361,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1354 | int ct = 0; | 1361 | int ct = 0; |
1355 | int offset = data.header_length + data.block_descriptor_length; | 1362 | int offset = data.header_length + data.block_descriptor_length; |
1356 | 1363 | ||
1364 | if (offset >= SD_BUF_SIZE - 2) { | ||
1365 | printk(KERN_ERR "%s: malformed MODE SENSE response", | ||
1366 | diskname); | ||
1367 | goto defaults; | ||
1368 | } | ||
1369 | |||
1357 | if ((buffer[offset] & 0x3f) != modepage) { | 1370 | if ((buffer[offset] & 0x3f) != modepage) { |
1358 | printk(KERN_ERR "%s: got wrong page\n", diskname); | 1371 | printk(KERN_ERR "%s: got wrong page\n", diskname); |
1359 | goto defaults; | 1372 | goto defaults; |
@@ -1398,6 +1411,7 @@ defaults: | |||
1398 | diskname); | 1411 | diskname); |
1399 | sdkp->WCE = 0; | 1412 | sdkp->WCE = 0; |
1400 | sdkp->RCD = 0; | 1413 | sdkp->RCD = 0; |
1414 | sdkp->DPOFUA = 0; | ||
1401 | } | 1415 | } |
1402 | 1416 | ||
1403 | /** | 1417 | /** |
@@ -1421,7 +1435,7 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1421 | if (!scsi_device_online(sdp)) | 1435 | if (!scsi_device_online(sdp)) |
1422 | goto out; | 1436 | goto out; |
1423 | 1437 | ||
1424 | buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA); | 1438 | buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA); |
1425 | if (!buffer) { | 1439 | if (!buffer) { |
1426 | printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " | 1440 | printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " |
1427 | "failure.\n"); | 1441 | "failure.\n"); |