提交 f6ef65e6 编写于 作者: J Jeff Garzik

Merge branch 'upstream-2.6.17'

......@@ -66,6 +66,8 @@ enum {
AHCI_IRQ_ON_SG = (1 << 31),
AHCI_CMD_ATAPI = (1 << 5),
AHCI_CMD_WRITE = (1 << 6),
AHCI_CMD_RESET = (1 << 8),
AHCI_CMD_CLR_BUSY = (1 << 10),
RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */
......@@ -85,6 +87,7 @@ enum {
/* HOST_CAP bits */
HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */
HOST_CAP_CLO = (1 << 24), /* Command List Override support */
/* registers for each SATA port */
PORT_LST_ADDR = 0x00, /* command list DMA addr */
......@@ -138,6 +141,7 @@ enum {
PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */
PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */
PORT_CMD_CLO = (1 << 3), /* Command list override */
PORT_CMD_POWER_ON = (1 << 2), /* Power up device */
PORT_CMD_SPIN_UP = (1 << 1), /* Spin up device */
PORT_CMD_START = (1 << 0), /* Enable port DMA engine */
......@@ -504,7 +508,9 @@ static void ahci_phy_reset(struct ata_port *ap)
struct ata_device *dev = &ap->device[0];
u32 new_tmp, tmp;
ahci_stop_engine(ap);
__sata_phy_reset(ap);
ahci_start_engine(ap);
if (ap->flags & ATA_FLAG_PORT_DISABLED)
return;
......
......@@ -61,9 +61,6 @@
#include "libata.h"
static unsigned int ata_busy_sleep (struct ata_port *ap,
unsigned long tmout_pat,
unsigned long tmout);
static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev);
static void ata_set_mode(struct ata_port *ap);
......@@ -834,6 +831,7 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
* ata_dev_try_classify - Parse returned ATA device signature
* @ap: ATA channel to examine
* @device: Device to examine (starting at zero)
* @r_err: Value of error register on completion
*
* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
* 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)
*
* LOCKING:
* caller.
*
* RETURNS:
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
*/
static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
static unsigned int
ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
{
struct ata_device *dev = &ap->device[device];
struct ata_taskfile tf;
unsigned int class;
u8 err;
......@@ -861,8 +862,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
ap->ops->tf_read(ap, &tf);
err = tf.feature;
dev->class = ATA_DEV_NONE;
if (r_err)
*r_err = err;
/* see if device passed diags */
if (err == 1)
......@@ -870,18 +871,16 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
else if ((device == 0) && (err == 0x81))
/* do nothing */ ;
else
return err;
return ATA_DEV_NONE;
/* determine if device if ATA or ATAPI */
/* determine if device is ATA or ATAPI */
class = ata_dev_classify(&tf);
if (class == ATA_DEV_UNKNOWN)
return err;
return ATA_DEV_NONE;
if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
return err;
dev->class = class;
return err;
return ATA_DEV_NONE;
return class;
}
/**
......@@ -1073,6 +1072,24 @@ static unsigned int ata_pio_modes(const struct ata_device *adev)
timing API will get this right anyway */
}
static inline void
ata_queue_packet_task(struct ata_port *ap)
{
queue_work(ata_wq, &ap->packet_task);
}
static inline void
ata_queue_pio_task(struct ata_port *ap)
{
queue_work(ata_wq, &ap->pio_task);
}
static inline void
ata_queue_delayed_pio_task(struct ata_port *ap, unsigned long delay)
{
queue_delayed_work(ata_wq, &ap->pio_task, delay);
}
void ata_qc_complete_internal(struct ata_queued_cmd *qc)
{
struct completion *waiting = qc->private_data;
......@@ -1478,7 +1495,24 @@ static int ata_bus_probe(struct ata_port *ap)
{
unsigned int i, found = 0;
ap->ops->phy_reset(ap);
if (ap->ops->probe_reset) {
unsigned int classes[ATA_MAX_DEVICES];
int rc;
ata_port_probe(ap);
rc = ap->ops->probe_reset(ap, classes);
if (rc == 0) {
for (i = 0; i < ATA_MAX_DEVICES; i++)
ap->device[i].class = classes[i];
} else {
printk(KERN_ERR "ata%u: probe reset failed, "
"disabling port\n", ap->id);
ata_port_disable(ap);
}
} else
ap->ops->phy_reset(ap);
if (ap->flags & ATA_FLAG_PORT_DISABLED)
goto err_out;
......@@ -1952,9 +1986,8 @@ static void ata_set_mode(struct ata_port *ap)
*
*/
static unsigned int ata_busy_sleep (struct ata_port *ap,
unsigned long tmout_pat,
unsigned long tmout)
unsigned int ata_busy_sleep (struct ata_port *ap,
unsigned long tmout_pat, unsigned long tmout)
{
unsigned long timer_start, timeout;
u8 status;
......@@ -2173,9 +2206,9 @@ void ata_bus_reset(struct ata_port *ap)
/*
* determine by signature whether we have ATA or ATAPI devices
*/
err = ata_dev_try_classify(ap, 0);
ap->device[0].class = ata_dev_try_classify(ap, 0, &err);
if ((slave_possible) && (err != 0x81))
ata_dev_try_classify(ap, 1);
ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
/* re-enable interrupts */
if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */
......@@ -3598,7 +3631,7 @@ static void ata_pio_task(void *_data)
}
if (timeout)
queue_delayed_work(ata_wq, &ap->pio_task, timeout);
ata_queue_delayed_pio_task(ap, timeout);
else if (has_next)
goto fsm_start;
}
......@@ -3960,7 +3993,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
if (qc->tf.flags & ATA_TFLAG_WRITE) {
/* PIO data out protocol */
ap->hsm_task_state = HSM_ST_FIRST;
queue_work(ata_wq, &ap->pio_task);
ata_queue_pio_task(ap);
/* always send first data block using
* the ata_pio_task() codepath.
......@@ -3970,7 +4003,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
ap->hsm_task_state = HSM_ST;
if (qc->tf.flags & ATA_TFLAG_POLLING)
queue_work(ata_wq, &ap->pio_task);
ata_queue_pio_task(ap);
/* if polling, ata_pio_task() handles the rest.
* otherwise, interrupt handler takes over from here.
......@@ -3985,12 +4018,13 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
ata_qc_set_polling(qc);
ata_tf_to_host(ap, &qc->tf);
ap->hsm_task_state = HSM_ST_FIRST;
/* send cdb by polling if no cdb interrupt */
if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) ||
(qc->tf.flags & ATA_TFLAG_POLLING))
queue_work(ata_wq, &ap->pio_task);
ata_queue_packet_task(ap);
break;
case ATA_PROT_ATAPI_DMA:
......@@ -4002,7 +4036,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
/* send cdb by polling if no cdb interrupt */
if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
queue_work(ata_wq, &ap->pio_task);
ata_queue_packet_task(ap);
break;
default:
......@@ -5433,6 +5467,7 @@ EXPORT_SYMBOL_GPL(__sata_phy_reset);
EXPORT_SYMBOL_GPL(ata_bus_reset);
EXPORT_SYMBOL_GPL(ata_port_disable);
EXPORT_SYMBOL_GPL(ata_ratelimit);
EXPORT_SYMBOL_GPL(ata_busy_sleep);
EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
EXPORT_SYMBOL_GPL(ata_scsi_error);
......
......@@ -149,9 +149,9 @@ enum {
ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */
ATA_FLAG_SATA = (1 << 3),
ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */
ATA_FLAG_SRST = (1 << 5), /* use ATA SRST, not E.D.D. */
ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */
ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */
ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */
ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */
ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */
ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD
* doesn't handle PIO interrupts */
......@@ -422,7 +422,9 @@ struct ata_port_operations {
u8 (*check_altstatus)(struct ata_port *ap);
void (*dev_select)(struct ata_port *ap, unsigned int device);
void (*phy_reset) (struct ata_port *ap);
void (*phy_reset) (struct ata_port *ap); /* obsolete */
int (*probe_reset) (struct ata_port *ap, unsigned int *classes);
void (*post_set_mode) (struct ata_port *ap);
int (*check_atapi_dma) (struct ata_queued_cmd *qc);
......@@ -503,6 +505,9 @@ extern int ata_scsi_device_suspend(struct scsi_device *);
extern int ata_device_resume(struct ata_port *, struct ata_device *);
extern int ata_device_suspend(struct ata_port *, struct ata_device *);
extern int ata_ratelimit(void);
extern unsigned int ata_busy_sleep(struct ata_port *ap,
unsigned long timeout_pat,
unsigned long timeout);
/*
* Default driver ops implementations
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册