diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-01-27 02:45:00 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-27 02:45:00 -0500 |
commit | f6ef65e6d004b77d516037424c7ccc209d0d3509 (patch) | |
tree | 394bac3559237abb94be5051828b3e45315d6489 | |
parent | 7103c7bc863c10dd2a26c19c8cf4d7d2846da947 (diff) | |
parent | c19ba8af4f104cca28d548cac55c128b28dd31fb (diff) |
Merge branch 'upstream-2.6.17'
-rw-r--r-- | drivers/scsi/ahci.c | 6 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 87 | ||||
-rw-r--r-- | include/linux/libata.h | 11 |
3 files changed, 75 insertions, 29 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 5a6b23009897..5caf6dec1d40 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -66,6 +66,8 @@ enum { | |||
66 | AHCI_IRQ_ON_SG = (1 << 31), | 66 | AHCI_IRQ_ON_SG = (1 << 31), |
67 | AHCI_CMD_ATAPI = (1 << 5), | 67 | AHCI_CMD_ATAPI = (1 << 5), |
68 | AHCI_CMD_WRITE = (1 << 6), | 68 | AHCI_CMD_WRITE = (1 << 6), |
69 | AHCI_CMD_RESET = (1 << 8), | ||
70 | AHCI_CMD_CLR_BUSY = (1 << 10), | ||
69 | 71 | ||
70 | RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ | 72 | RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ |
71 | 73 | ||
@@ -85,6 +87,7 @@ enum { | |||
85 | 87 | ||
86 | /* HOST_CAP bits */ | 88 | /* HOST_CAP bits */ |
87 | HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ | 89 | HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ |
90 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ | ||
88 | 91 | ||
89 | /* registers for each SATA port */ | 92 | /* registers for each SATA port */ |
90 | PORT_LST_ADDR = 0x00, /* command list DMA addr */ | 93 | PORT_LST_ADDR = 0x00, /* command list DMA addr */ |
@@ -138,6 +141,7 @@ enum { | |||
138 | PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ | 141 | PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ |
139 | PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ | 142 | PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ |
140 | PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ | 143 | PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ |
144 | PORT_CMD_CLO = (1 << 3), /* Command list override */ | ||
141 | PORT_CMD_POWER_ON = (1 << 2), /* Power up device */ | 145 | PORT_CMD_POWER_ON = (1 << 2), /* Power up device */ |
142 | PORT_CMD_SPIN_UP = (1 << 1), /* Spin up device */ | 146 | PORT_CMD_SPIN_UP = (1 << 1), /* Spin up device */ |
143 | PORT_CMD_START = (1 << 0), /* Enable port DMA engine */ | 147 | PORT_CMD_START = (1 << 0), /* Enable port DMA engine */ |
@@ -504,7 +508,9 @@ static void ahci_phy_reset(struct ata_port *ap) | |||
504 | struct ata_device *dev = &ap->device[0]; | 508 | struct ata_device *dev = &ap->device[0]; |
505 | u32 new_tmp, tmp; | 509 | u32 new_tmp, tmp; |
506 | 510 | ||
511 | ahci_stop_engine(ap); | ||
507 | __sata_phy_reset(ap); | 512 | __sata_phy_reset(ap); |
513 | ahci_start_engine(ap); | ||
508 | 514 | ||
509 | if (ap->flags & ATA_FLAG_PORT_DISABLED) | 515 | if (ap->flags & ATA_FLAG_PORT_DISABLED) |
510 | return; | 516 | return; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index c67c7a49c8ba..6daba4e2c3fd 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -61,9 +61,6 @@ | |||
61 | 61 | ||
62 | #include "libata.h" | 62 | #include "libata.h" |
63 | 63 | ||
64 | static unsigned int ata_busy_sleep (struct ata_port *ap, | ||
65 | unsigned long tmout_pat, | ||
66 | unsigned long tmout); | ||
67 | static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); | 64 | static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); |
68 | static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); | 65 | static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); |
69 | static void ata_set_mode(struct ata_port *ap); | 66 | static void ata_set_mode(struct ata_port *ap); |
@@ -834,6 +831,7 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf) | |||
834 | * ata_dev_try_classify - Parse returned ATA device signature | 831 | * ata_dev_try_classify - Parse returned ATA device signature |
835 | * @ap: ATA channel to examine | 832 | * @ap: ATA channel to examine |
836 | * @device: Device to examine (starting at zero) | 833 | * @device: Device to examine (starting at zero) |
834 | * @r_err: Value of error register on completion | ||
837 | * | 835 | * |
838 | * After an event -- SRST, E.D.D., or SATA COMRESET -- occurs, | 836 | * After an event -- SRST, E.D.D., or SATA COMRESET -- occurs, |
839 | * an ATA/ATAPI-defined set of values is placed in the ATA | 837 | * an ATA/ATAPI-defined set of values is placed in the ATA |
@@ -846,11 +844,14 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf) | |||
846 | * | 844 | * |
847 | * LOCKING: | 845 | * LOCKING: |
848 | * caller. | 846 | * caller. |
847 | * | ||
848 | * RETURNS: | ||
849 | * Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE. | ||
849 | */ | 850 | */ |
850 | 851 | ||
851 | static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | 852 | static unsigned int |
853 | ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err) | ||
852 | { | 854 | { |
853 | struct ata_device *dev = &ap->device[device]; | ||
854 | struct ata_taskfile tf; | 855 | struct ata_taskfile tf; |
855 | unsigned int class; | 856 | unsigned int class; |
856 | u8 err; | 857 | u8 err; |
@@ -861,8 +862,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | |||
861 | 862 | ||
862 | ap->ops->tf_read(ap, &tf); | 863 | ap->ops->tf_read(ap, &tf); |
863 | err = tf.feature; | 864 | err = tf.feature; |
864 | 865 | if (r_err) | |
865 | dev->class = ATA_DEV_NONE; | 866 | *r_err = err; |
866 | 867 | ||
867 | /* see if device passed diags */ | 868 | /* see if device passed diags */ |
868 | if (err == 1) | 869 | if (err == 1) |
@@ -870,18 +871,16 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | |||
870 | else if ((device == 0) && (err == 0x81)) | 871 | else if ((device == 0) && (err == 0x81)) |
871 | /* do nothing */ ; | 872 | /* do nothing */ ; |
872 | else | 873 | else |
873 | return err; | 874 | return ATA_DEV_NONE; |
874 | 875 | ||
875 | /* determine if device if ATA or ATAPI */ | 876 | /* determine if device is ATA or ATAPI */ |
876 | class = ata_dev_classify(&tf); | 877 | class = ata_dev_classify(&tf); |
878 | |||
877 | if (class == ATA_DEV_UNKNOWN) | 879 | if (class == ATA_DEV_UNKNOWN) |
878 | return err; | 880 | return ATA_DEV_NONE; |
879 | if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0)) | 881 | if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0)) |
880 | return err; | 882 | return ATA_DEV_NONE; |
881 | 883 | return class; | |
882 | dev->class = class; | ||
883 | |||
884 | return err; | ||
885 | } | 884 | } |
886 | 885 | ||
887 | /** | 886 | /** |
@@ -1073,6 +1072,24 @@ static unsigned int ata_pio_modes(const struct ata_device *adev) | |||
1073 | timing API will get this right anyway */ | 1072 | timing API will get this right anyway */ |
1074 | } | 1073 | } |
1075 | 1074 | ||
1075 | static inline void | ||
1076 | ata_queue_packet_task(struct ata_port *ap) | ||
1077 | { | ||
1078 | queue_work(ata_wq, &ap->packet_task); | ||
1079 | } | ||
1080 | |||
1081 | static inline void | ||
1082 | ata_queue_pio_task(struct ata_port *ap) | ||
1083 | { | ||
1084 | queue_work(ata_wq, &ap->pio_task); | ||
1085 | } | ||
1086 | |||
1087 | static inline void | ||
1088 | ata_queue_delayed_pio_task(struct ata_port *ap, unsigned long delay) | ||
1089 | { | ||
1090 | queue_delayed_work(ata_wq, &ap->pio_task, delay); | ||
1091 | } | ||
1092 | |||
1076 | void ata_qc_complete_internal(struct ata_queued_cmd *qc) | 1093 | void ata_qc_complete_internal(struct ata_queued_cmd *qc) |
1077 | { | 1094 | { |
1078 | struct completion *waiting = qc->private_data; | 1095 | struct completion *waiting = qc->private_data; |
@@ -1478,7 +1495,24 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1478 | { | 1495 | { |
1479 | unsigned int i, found = 0; | 1496 | unsigned int i, found = 0; |
1480 | 1497 | ||
1481 | ap->ops->phy_reset(ap); | 1498 | if (ap->ops->probe_reset) { |
1499 | unsigned int classes[ATA_MAX_DEVICES]; | ||
1500 | int rc; | ||
1501 | |||
1502 | ata_port_probe(ap); | ||
1503 | |||
1504 | rc = ap->ops->probe_reset(ap, classes); | ||
1505 | if (rc == 0) { | ||
1506 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
1507 | ap->device[i].class = classes[i]; | ||
1508 | } else { | ||
1509 | printk(KERN_ERR "ata%u: probe reset failed, " | ||
1510 | "disabling port\n", ap->id); | ||
1511 | ata_port_disable(ap); | ||
1512 | } | ||
1513 | } else | ||
1514 | ap->ops->phy_reset(ap); | ||
1515 | |||
1482 | if (ap->flags & ATA_FLAG_PORT_DISABLED) | 1516 | if (ap->flags & ATA_FLAG_PORT_DISABLED) |
1483 | goto err_out; | 1517 | goto err_out; |
1484 | 1518 | ||
@@ -1952,9 +1986,8 @@ err_out: | |||
1952 | * | 1986 | * |
1953 | */ | 1987 | */ |
1954 | 1988 | ||
1955 | static unsigned int ata_busy_sleep (struct ata_port *ap, | 1989 | unsigned int ata_busy_sleep (struct ata_port *ap, |
1956 | unsigned long tmout_pat, | 1990 | unsigned long tmout_pat, unsigned long tmout) |
1957 | unsigned long tmout) | ||
1958 | { | 1991 | { |
1959 | unsigned long timer_start, timeout; | 1992 | unsigned long timer_start, timeout; |
1960 | u8 status; | 1993 | u8 status; |
@@ -2173,9 +2206,9 @@ void ata_bus_reset(struct ata_port *ap) | |||
2173 | /* | 2206 | /* |
2174 | * determine by signature whether we have ATA or ATAPI devices | 2207 | * determine by signature whether we have ATA or ATAPI devices |
2175 | */ | 2208 | */ |
2176 | err = ata_dev_try_classify(ap, 0); | 2209 | ap->device[0].class = ata_dev_try_classify(ap, 0, &err); |
2177 | if ((slave_possible) && (err != 0x81)) | 2210 | if ((slave_possible) && (err != 0x81)) |
2178 | ata_dev_try_classify(ap, 1); | 2211 | ap->device[1].class = ata_dev_try_classify(ap, 1, &err); |
2179 | 2212 | ||
2180 | /* re-enable interrupts */ | 2213 | /* re-enable interrupts */ |
2181 | if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */ | 2214 | if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */ |
@@ -3598,7 +3631,7 @@ fsm_start: | |||
3598 | } | 3631 | } |
3599 | 3632 | ||
3600 | if (timeout) | 3633 | if (timeout) |
3601 | queue_delayed_work(ata_wq, &ap->pio_task, timeout); | 3634 | ata_queue_delayed_pio_task(ap, timeout); |
3602 | else if (has_next) | 3635 | else if (has_next) |
3603 | goto fsm_start; | 3636 | goto fsm_start; |
3604 | } | 3637 | } |
@@ -3960,7 +3993,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3960 | if (qc->tf.flags & ATA_TFLAG_WRITE) { | 3993 | if (qc->tf.flags & ATA_TFLAG_WRITE) { |
3961 | /* PIO data out protocol */ | 3994 | /* PIO data out protocol */ |
3962 | ap->hsm_task_state = HSM_ST_FIRST; | 3995 | ap->hsm_task_state = HSM_ST_FIRST; |
3963 | queue_work(ata_wq, &ap->pio_task); | 3996 | ata_queue_pio_task(ap); |
3964 | 3997 | ||
3965 | /* always send first data block using | 3998 | /* always send first data block using |
3966 | * the ata_pio_task() codepath. | 3999 | * the ata_pio_task() codepath. |
@@ -3970,7 +4003,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3970 | ap->hsm_task_state = HSM_ST; | 4003 | ap->hsm_task_state = HSM_ST; |
3971 | 4004 | ||
3972 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 4005 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
3973 | queue_work(ata_wq, &ap->pio_task); | 4006 | ata_queue_pio_task(ap); |
3974 | 4007 | ||
3975 | /* if polling, ata_pio_task() handles the rest. | 4008 | /* if polling, ata_pio_task() handles the rest. |
3976 | * otherwise, interrupt handler takes over from here. | 4009 | * otherwise, interrupt handler takes over from here. |
@@ -3985,12 +4018,13 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3985 | ata_qc_set_polling(qc); | 4018 | ata_qc_set_polling(qc); |
3986 | 4019 | ||
3987 | ata_tf_to_host(ap, &qc->tf); | 4020 | ata_tf_to_host(ap, &qc->tf); |
4021 | |||
3988 | ap->hsm_task_state = HSM_ST_FIRST; | 4022 | ap->hsm_task_state = HSM_ST_FIRST; |
3989 | 4023 | ||
3990 | /* send cdb by polling if no cdb interrupt */ | 4024 | /* send cdb by polling if no cdb interrupt */ |
3991 | if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) || | 4025 | if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) || |
3992 | (qc->tf.flags & ATA_TFLAG_POLLING)) | 4026 | (qc->tf.flags & ATA_TFLAG_POLLING)) |
3993 | queue_work(ata_wq, &ap->pio_task); | 4027 | ata_queue_packet_task(ap); |
3994 | break; | 4028 | break; |
3995 | 4029 | ||
3996 | case ATA_PROT_ATAPI_DMA: | 4030 | case ATA_PROT_ATAPI_DMA: |
@@ -4002,7 +4036,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
4002 | 4036 | ||
4003 | /* send cdb by polling if no cdb interrupt */ | 4037 | /* send cdb by polling if no cdb interrupt */ |
4004 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | 4038 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
4005 | queue_work(ata_wq, &ap->pio_task); | 4039 | ata_queue_packet_task(ap); |
4006 | break; | 4040 | break; |
4007 | 4041 | ||
4008 | default: | 4042 | default: |
@@ -5433,6 +5467,7 @@ EXPORT_SYMBOL_GPL(__sata_phy_reset); | |||
5433 | EXPORT_SYMBOL_GPL(ata_bus_reset); | 5467 | EXPORT_SYMBOL_GPL(ata_bus_reset); |
5434 | EXPORT_SYMBOL_GPL(ata_port_disable); | 5468 | EXPORT_SYMBOL_GPL(ata_port_disable); |
5435 | EXPORT_SYMBOL_GPL(ata_ratelimit); | 5469 | EXPORT_SYMBOL_GPL(ata_ratelimit); |
5470 | EXPORT_SYMBOL_GPL(ata_busy_sleep); | ||
5436 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | 5471 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); |
5437 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); | 5472 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); |
5438 | EXPORT_SYMBOL_GPL(ata_scsi_error); | 5473 | EXPORT_SYMBOL_GPL(ata_scsi_error); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 88f0a27cc7c3..f8a04ef5c7c3 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -149,9 +149,9 @@ enum { | |||
149 | ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ | 149 | ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ |
150 | ATA_FLAG_SATA = (1 << 3), | 150 | ATA_FLAG_SATA = (1 << 3), |
151 | ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ | 151 | ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ |
152 | ATA_FLAG_SRST = (1 << 5), /* use ATA SRST, not E.D.D. */ | 152 | ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */ |
153 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ | 153 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ |
154 | ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ | 154 | ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */ |
155 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ | 155 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ |
156 | ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD | 156 | ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD |
157 | * doesn't handle PIO interrupts */ | 157 | * doesn't handle PIO interrupts */ |
@@ -422,7 +422,9 @@ struct ata_port_operations { | |||
422 | u8 (*check_altstatus)(struct ata_port *ap); | 422 | u8 (*check_altstatus)(struct ata_port *ap); |
423 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 423 | void (*dev_select)(struct ata_port *ap, unsigned int device); |
424 | 424 | ||
425 | void (*phy_reset) (struct ata_port *ap); | 425 | void (*phy_reset) (struct ata_port *ap); /* obsolete */ |
426 | int (*probe_reset) (struct ata_port *ap, unsigned int *classes); | ||
427 | |||
426 | void (*post_set_mode) (struct ata_port *ap); | 428 | void (*post_set_mode) (struct ata_port *ap); |
427 | 429 | ||
428 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); | 430 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); |
@@ -503,6 +505,9 @@ extern int ata_scsi_device_suspend(struct scsi_device *); | |||
503 | extern int ata_device_resume(struct ata_port *, struct ata_device *); | 505 | extern int ata_device_resume(struct ata_port *, struct ata_device *); |
504 | extern int ata_device_suspend(struct ata_port *, struct ata_device *); | 506 | extern int ata_device_suspend(struct ata_port *, struct ata_device *); |
505 | extern int ata_ratelimit(void); | 507 | extern int ata_ratelimit(void); |
508 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | ||
509 | unsigned long timeout_pat, | ||
510 | unsigned long timeout); | ||
506 | 511 | ||
507 | /* | 512 | /* |
508 | * Default driver ops implementations | 513 | * Default driver ops implementations |