Merge branch 'upstream'
This commit is contained in:
@@ -131,8 +131,8 @@ enum {
|
|||||||
static int piix_init_one (struct pci_dev *pdev,
|
static int piix_init_one (struct pci_dev *pdev,
|
||||||
const struct pci_device_id *ent);
|
const struct pci_device_id *ent);
|
||||||
|
|
||||||
static void piix_pata_phy_reset(struct ata_port *ap);
|
static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes);
|
||||||
static void piix_sata_phy_reset(struct ata_port *ap);
|
static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes);
|
||||||
static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
|
static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
|
||||||
static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
|
static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ static const struct ata_port_operations piix_pata_ops = {
|
|||||||
.exec_command = ata_exec_command,
|
.exec_command = ata_exec_command,
|
||||||
.dev_select = ata_std_dev_select,
|
.dev_select = ata_std_dev_select,
|
||||||
|
|
||||||
.phy_reset = piix_pata_phy_reset,
|
.probe_reset = piix_pata_probe_reset,
|
||||||
|
|
||||||
.bmdma_setup = ata_bmdma_setup,
|
.bmdma_setup = ata_bmdma_setup,
|
||||||
.bmdma_start = ata_bmdma_start,
|
.bmdma_start = ata_bmdma_start,
|
||||||
@@ -235,7 +235,7 @@ static const struct ata_port_operations piix_sata_ops = {
|
|||||||
.exec_command = ata_exec_command,
|
.exec_command = ata_exec_command,
|
||||||
.dev_select = ata_std_dev_select,
|
.dev_select = ata_std_dev_select,
|
||||||
|
|
||||||
.phy_reset = piix_sata_phy_reset,
|
.probe_reset = piix_sata_probe_reset,
|
||||||
|
|
||||||
.bmdma_setup = ata_bmdma_setup,
|
.bmdma_setup = ata_bmdma_setup,
|
||||||
.bmdma_start = ata_bmdma_start,
|
.bmdma_start = ata_bmdma_start,
|
||||||
@@ -258,8 +258,7 @@ static struct ata_port_info piix_port_info[] = {
|
|||||||
/* ich5_pata */
|
/* ich5_pata */
|
||||||
{
|
{
|
||||||
.sht = &piix_sht,
|
.sht = &piix_sht,
|
||||||
.host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST |
|
.host_flags = ATA_FLAG_SLAVE_POSS | PIIX_FLAG_CHECKINTR,
|
||||||
PIIX_FLAG_CHECKINTR,
|
|
||||||
.pio_mask = 0x1f, /* pio0-4 */
|
.pio_mask = 0x1f, /* pio0-4 */
|
||||||
#if 0
|
#if 0
|
||||||
.mwdma_mask = 0x06, /* mwdma1-2 */
|
.mwdma_mask = 0x06, /* mwdma1-2 */
|
||||||
@@ -273,8 +272,8 @@ static struct ata_port_info piix_port_info[] = {
|
|||||||
/* ich5_sata */
|
/* ich5_sata */
|
||||||
{
|
{
|
||||||
.sht = &piix_sht,
|
.sht = &piix_sht,
|
||||||
.host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
|
.host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED |
|
||||||
PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR,
|
PIIX_FLAG_CHECKINTR,
|
||||||
.pio_mask = 0x1f, /* pio0-4 */
|
.pio_mask = 0x1f, /* pio0-4 */
|
||||||
.mwdma_mask = 0x07, /* mwdma0-2 */
|
.mwdma_mask = 0x07, /* mwdma0-2 */
|
||||||
.udma_mask = 0x7f, /* udma0-6 */
|
.udma_mask = 0x7f, /* udma0-6 */
|
||||||
@@ -284,7 +283,7 @@ static struct ata_port_info piix_port_info[] = {
|
|||||||
/* piix4_pata */
|
/* piix4_pata */
|
||||||
{
|
{
|
||||||
.sht = &piix_sht,
|
.sht = &piix_sht,
|
||||||
.host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
|
.host_flags = ATA_FLAG_SLAVE_POSS,
|
||||||
.pio_mask = 0x1f, /* pio0-4 */
|
.pio_mask = 0x1f, /* pio0-4 */
|
||||||
#if 0
|
#if 0
|
||||||
.mwdma_mask = 0x06, /* mwdma1-2 */
|
.mwdma_mask = 0x06, /* mwdma1-2 */
|
||||||
@@ -298,8 +297,7 @@ static struct ata_port_info piix_port_info[] = {
|
|||||||
/* ich6_sata */
|
/* ich6_sata */
|
||||||
{
|
{
|
||||||
.sht = &piix_sht,
|
.sht = &piix_sht,
|
||||||
.host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
|
.host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED_ICH6 |
|
||||||
PIIX_FLAG_COMBINED_ICH6 |
|
|
||||||
PIIX_FLAG_CHECKINTR | ATA_FLAG_SLAVE_POSS,
|
PIIX_FLAG_CHECKINTR | ATA_FLAG_SLAVE_POSS,
|
||||||
.pio_mask = 0x1f, /* pio0-4 */
|
.pio_mask = 0x1f, /* pio0-4 */
|
||||||
.mwdma_mask = 0x07, /* mwdma0-2 */
|
.mwdma_mask = 0x07, /* mwdma0-2 */
|
||||||
@@ -310,8 +308,7 @@ static struct ata_port_info piix_port_info[] = {
|
|||||||
/* ich6_sata_ahci */
|
/* ich6_sata_ahci */
|
||||||
{
|
{
|
||||||
.sht = &piix_sht,
|
.sht = &piix_sht,
|
||||||
.host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
|
.host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED_ICH6 |
|
||||||
PIIX_FLAG_COMBINED_ICH6 |
|
|
||||||
PIIX_FLAG_CHECKINTR | ATA_FLAG_SLAVE_POSS |
|
PIIX_FLAG_CHECKINTR | ATA_FLAG_SLAVE_POSS |
|
||||||
PIIX_FLAG_AHCI,
|
PIIX_FLAG_AHCI,
|
||||||
.pio_mask = 0x1f, /* pio0-4 */
|
.pio_mask = 0x1f, /* pio0-4 */
|
||||||
@@ -366,30 +363,42 @@ cbl40:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* piix_pata_phy_reset - Probe specified port on PATA host controller
|
* piix_pata_probeinit - probeinit for PATA host controller
|
||||||
* @ap: Port to probe
|
* @ap: Target port
|
||||||
*
|
*
|
||||||
* Probe PATA phy.
|
* Probeinit including cable detection.
|
||||||
*
|
*
|
||||||
* LOCKING:
|
* LOCKING:
|
||||||
* None (inherited from caller).
|
* None (inherited from caller).
|
||||||
*/
|
*/
|
||||||
|
static void piix_pata_probeinit(struct ata_port *ap)
|
||||||
|
{
|
||||||
|
piix_pata_cbl_detect(ap);
|
||||||
|
ata_std_probeinit(ap);
|
||||||
|
}
|
||||||
|
|
||||||
static void piix_pata_phy_reset(struct ata_port *ap)
|
/**
|
||||||
|
* piix_pata_probe_reset - Perform reset on PATA port and classify
|
||||||
|
* @ap: Port to reset
|
||||||
|
* @classes: Resulting classes of attached devices
|
||||||
|
*
|
||||||
|
* Reset PATA phy and classify attached devices.
|
||||||
|
*
|
||||||
|
* LOCKING:
|
||||||
|
* None (inherited from caller).
|
||||||
|
*/
|
||||||
|
static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
|
struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
|
||||||
|
|
||||||
if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) {
|
if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) {
|
||||||
ata_port_disable(ap);
|
|
||||||
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
|
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
piix_pata_cbl_detect(ap);
|
return ata_drive_probe_reset(ap, piix_pata_probeinit,
|
||||||
|
ata_std_softreset, NULL,
|
||||||
ata_port_probe(ap);
|
ata_std_postreset, classes);
|
||||||
|
|
||||||
ata_bus_reset(ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -437,28 +446,25 @@ static int piix_sata_probe (struct ata_port *ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* piix_sata_phy_reset - Probe specified port on SATA host controller
|
* piix_sata_probe_reset - Perform reset on SATA port and classify
|
||||||
* @ap: Port to probe
|
* @ap: Port to reset
|
||||||
|
* @classes: Resulting classes of attached devices
|
||||||
*
|
*
|
||||||
* Probe SATA phy.
|
* Reset SATA phy and classify attached devices.
|
||||||
*
|
*
|
||||||
* LOCKING:
|
* LOCKING:
|
||||||
* None (inherited from caller).
|
* None (inherited from caller).
|
||||||
*/
|
*/
|
||||||
|
static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes)
|
||||||
static void piix_sata_phy_reset(struct ata_port *ap)
|
|
||||||
{
|
{
|
||||||
if (!piix_sata_probe(ap)) {
|
if (!piix_sata_probe(ap)) {
|
||||||
ata_port_disable(ap);
|
|
||||||
printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id);
|
printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap->cbl = ATA_CBL_SATA;
|
return ata_drive_probe_reset(ap, ata_std_probeinit,
|
||||||
|
ata_std_softreset, NULL,
|
||||||
ata_port_probe(ap);
|
ata_std_postreset, classes);
|
||||||
|
|
||||||
ata_bus_reset(ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2113,7 +2113,6 @@ int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
|
|||||||
* This function is invoked after a successful reset. Note that
|
* This function is invoked after a successful reset. Note that
|
||||||
* the device might have been reset more than once using
|
* the device might have been reset more than once using
|
||||||
* different reset methods before postreset is invoked.
|
* different reset methods before postreset is invoked.
|
||||||
* postreset is also reponsible for setting cable type.
|
|
||||||
*
|
*
|
||||||
* This function is to be used as standard callback for
|
* This function is to be used as standard callback for
|
||||||
* ata_drive_*_reset().
|
* ata_drive_*_reset().
|
||||||
@@ -2125,7 +2124,7 @@ void ata_std_postreset(struct ata_port *ap, unsigned int *classes)
|
|||||||
{
|
{
|
||||||
DPRINTK("ENTER\n");
|
DPRINTK("ENTER\n");
|
||||||
|
|
||||||
/* set cable type */
|
/* set cable type if it isn't already set */
|
||||||
if (ap->cbl == ATA_CBL_NONE && ap->flags & ATA_FLAG_SATA)
|
if (ap->cbl == ATA_CBL_NONE && ap->flags & ATA_FLAG_SATA)
|
||||||
ap->cbl = ATA_CBL_SATA;
|
ap->cbl = ATA_CBL_SATA;
|
||||||
|
|
||||||
@@ -2592,7 +2591,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
|
|||||||
WARN_ON(sg == NULL);
|
WARN_ON(sg == NULL);
|
||||||
|
|
||||||
if (qc->flags & ATA_QCFLAG_SINGLE)
|
if (qc->flags & ATA_QCFLAG_SINGLE)
|
||||||
WARN_ON(qc->n_elem != 1);
|
WARN_ON(qc->n_elem > 1);
|
||||||
|
|
||||||
VPRINTK("unmapping %u sg elements\n", qc->n_elem);
|
VPRINTK("unmapping %u sg elements\n", qc->n_elem);
|
||||||
|
|
||||||
@@ -2615,7 +2614,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
|
|||||||
kunmap_atomic(addr, KM_IRQ0);
|
kunmap_atomic(addr, KM_IRQ0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (sg_dma_len(&sg[0]) > 0)
|
if (qc->n_elem)
|
||||||
dma_unmap_single(ap->host_set->dev,
|
dma_unmap_single(ap->host_set->dev,
|
||||||
sg_dma_address(&sg[0]), sg_dma_len(&sg[0]),
|
sg_dma_address(&sg[0]), sg_dma_len(&sg[0]),
|
||||||
dir);
|
dir);
|
||||||
@@ -2648,7 +2647,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
|
|||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
|
||||||
WARN_ON(qc->__sg == NULL);
|
WARN_ON(qc->__sg == NULL);
|
||||||
WARN_ON(qc->n_elem == 0);
|
WARN_ON(qc->n_elem == 0 && qc->pad_len == 0);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
ata_for_each_sg(sg, qc) {
|
ata_for_each_sg(sg, qc) {
|
||||||
@@ -2793,6 +2792,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
|
|||||||
int dir = qc->dma_dir;
|
int dir = qc->dma_dir;
|
||||||
struct scatterlist *sg = qc->__sg;
|
struct scatterlist *sg = qc->__sg;
|
||||||
dma_addr_t dma_address;
|
dma_addr_t dma_address;
|
||||||
|
int trim_sg = 0;
|
||||||
|
|
||||||
/* we must lengthen transfers to end on a 32-bit boundary */
|
/* we must lengthen transfers to end on a 32-bit boundary */
|
||||||
qc->pad_len = sg->length & 3;
|
qc->pad_len = sg->length & 3;
|
||||||
@@ -2812,13 +2812,15 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
|
|||||||
sg_dma_len(psg) = ATA_DMA_PAD_SZ;
|
sg_dma_len(psg) = ATA_DMA_PAD_SZ;
|
||||||
/* trim sg */
|
/* trim sg */
|
||||||
sg->length -= qc->pad_len;
|
sg->length -= qc->pad_len;
|
||||||
|
if (sg->length == 0)
|
||||||
|
trim_sg = 1;
|
||||||
|
|
||||||
DPRINTK("padding done, sg->length=%u pad_len=%u\n",
|
DPRINTK("padding done, sg->length=%u pad_len=%u\n",
|
||||||
sg->length, qc->pad_len);
|
sg->length, qc->pad_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sg->length) {
|
if (trim_sg) {
|
||||||
sg_dma_address(sg) = 0;
|
qc->n_elem--;
|
||||||
goto skip_map;
|
goto skip_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2831,9 +2833,9 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sg_dma_address(sg) = dma_address;
|
sg_dma_address(sg) = dma_address;
|
||||||
skip_map:
|
|
||||||
sg_dma_len(sg) = sg->length;
|
sg_dma_len(sg) = sg->length;
|
||||||
|
|
||||||
|
skip_map:
|
||||||
DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg),
|
DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg),
|
||||||
qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
|
qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
|
||||||
|
|
||||||
|
@@ -277,7 +277,7 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
|
|||||||
u8 *prd = pp->pkt + QS_CPB_BYTES;
|
u8 *prd = pp->pkt + QS_CPB_BYTES;
|
||||||
|
|
||||||
WARN_ON(qc->__sg == NULL);
|
WARN_ON(qc->__sg == NULL);
|
||||||
WARN_ON(qc->n_elem == 0);
|
WARN_ON(qc->n_elem == 0 && qc->pad_len == 0);
|
||||||
|
|
||||||
nelem = 0;
|
nelem = 0;
|
||||||
ata_for_each_sg(sg, qc) {
|
ata_for_each_sg(sg, qc) {
|
||||||
|
@@ -618,6 +618,16 @@ ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct scatterlist *
|
||||||
|
ata_qc_first_sg(struct ata_queued_cmd *qc)
|
||||||
|
{
|
||||||
|
if (qc->n_elem)
|
||||||
|
return qc->__sg;
|
||||||
|
if (qc->pad_len)
|
||||||
|
return &qc->pad_sgent;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct scatterlist *
|
static inline struct scatterlist *
|
||||||
ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
|
ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
|
||||||
{
|
{
|
||||||
@@ -625,11 +635,13 @@ ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (++sg - qc->__sg < qc->n_elem)
|
if (++sg - qc->__sg < qc->n_elem)
|
||||||
return sg;
|
return sg;
|
||||||
return qc->pad_len ? &qc->pad_sgent : NULL;
|
if (qc->pad_len)
|
||||||
|
return &qc->pad_sgent;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ata_for_each_sg(sg, qc) \
|
#define ata_for_each_sg(sg, qc) \
|
||||||
for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc))
|
for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
|
||||||
|
|
||||||
static inline unsigned int ata_tag_valid(unsigned int tag)
|
static inline unsigned int ata_tag_valid(unsigned int tag)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user