1) ahci: Fix typo that caused erronenous error handling.

Thought:  I wonder if sparse could have caught this, somehow.
 
 2) ahci: support a slightly odd Enmotus variant
 
 3) core: fix a drive detection problem by correcting the logic
    by which the DevSlp timing variables are obtained and used.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIVAwUAUP2a/CWzCDIBeCsvAQJBhA/+JowfM2CKII3+k4Kq2UbaR+uJHALABtxh
 rRWBana8ESxoXuY6Usylkdms5fQamp3r/YB29ZzUw3nsHP4u9Y4L2+NIYryXPYll
 xNeg9tI/y2ypC8wNnXQIrbvYGH303BqyBpUTQ7qfQ+zrKq9qSg9vTBC9rbGE6YdM
 sR8gcz1wuY3eFeEw2FXHyWWnXTmB4/UmgISjJL13c9rJoQpK4k1svhUnPAqSM8RZ
 IB4z4NUne1REvpDdhyIIi5hGeOFtULMtEdjIxNuHNmQXgi6Q225qDNS4afhEQLVu
 lf6VLMYmMziNYNhyQDl1Vw82/zics01u9HOnCpfs/De+6DE4DeH9z0wG9Hz35YHZ
 6ZcSQPLVk8/Jfp2jSsovc3h51o6W3DavuJxvs9EC1gyhDpPnYPPBOgiVPkb/km1n
 hoBBIKqwFrV8MzpbUgSqlrWRlQ4Mco95l/Nwnr9mWe1CV81dYRXQ0cH2WYjveigy
 tpbKgpDiEMpmUHT9rUX5AXMdv6JczMY6mP+FGmOeBio8hG0uozaZYCczbQAX9PD4
 UFkqms0C9C/SH1k3LJWkSZaxwupCZpvEyXu1RezcJsv0qObfrbnGxtSG4lBdv0x/
 SlSMLQRG7cE9la9amEwzqhUQXbS/rPcpZ8GK+2Qjhb36qO5GJpgUUEp+izfHcy4v
 ATS8puL+GhQ=
 =7WDW
 -----END PGP SIGNATURE-----

Merge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

Pull libata fixes from Jeff Garzik:

 1) ahci: Fix typo that caused erronenous error handling.

    Thought: I wonder if sparse could have caught this, somehow.

 2) ahci: support a slightly odd Enmotus variant

 3) core: fix a drive detection problem by correcting the logic by which
    the DevSlp timing variables are obtained and used.

* tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  [libata] replace sata_settings with devslp_timing
  [libata] ahci: Add support for Enmotus Bobcat device.
  [libata] ahci: Fix lack of command retry after a success error handler.
This commit is contained in:
Linus Torvalds 2013-01-22 10:10:34 -08:00
Родитель a7ed6c4320 803739d25c
Коммит 0944c0a034
6 изменённых файлов: 31 добавлений и 19 удалений

Просмотреть файл

@ -53,6 +53,7 @@
enum {
AHCI_PCI_BAR_STA2X11 = 0,
AHCI_PCI_BAR_ENMOTUS = 2,
AHCI_PCI_BAR_STANDARD = 5,
};
@ -410,6 +411,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
{ PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */
{ PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */
/* Enmotus */
{ PCI_DEVICE(0x1c44, 0x8000), board_ahci },
/* Generic, PCI class code for AHCI */
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@ -1098,9 +1102,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_info(&pdev->dev,
"PDC42819 can only drive SATA devices with this driver\n");
/* The Connext uses non-standard BAR */
/* Both Connext and Enmotus devices use non-standard BARs */
if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06)
ahci_pci_bar = AHCI_PCI_BAR_STA2X11;
else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
/* acquire resources */
rc = pcim_enable_device(pdev);

Просмотреть файл

@ -1951,13 +1951,13 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
/* Use the nominal value 10 ms if the read MDAT is zero,
* the nominal value of DETO is 20 ms.
*/
if (dev->sata_settings[ATA_LOG_DEVSLP_VALID] &
if (dev->devslp_timing[ATA_LOG_DEVSLP_VALID] &
ATA_LOG_DEVSLP_VALID_MASK) {
mdat = dev->sata_settings[ATA_LOG_DEVSLP_MDAT] &
mdat = dev->devslp_timing[ATA_LOG_DEVSLP_MDAT] &
ATA_LOG_DEVSLP_MDAT_MASK;
if (!mdat)
mdat = 10;
deto = dev->sata_settings[ATA_LOG_DEVSLP_DETO];
deto = dev->devslp_timing[ATA_LOG_DEVSLP_DETO];
if (!deto)
deto = 20;
} else {

Просмотреть файл

@ -2325,24 +2325,28 @@ int ata_dev_configure(struct ata_device *dev)
}
}
/* check and mark DevSlp capability */
if (ata_id_has_devslp(dev->id))
dev->flags |= ATA_DFLAG_DEVSLP;
/* Obtain SATA Settings page from Identify Device Data Log,
* which contains DevSlp timing variables etc.
* Exclude old devices with ata_id_has_ncq()
/* Check and mark DevSlp capability. Get DevSlp timing variables
* from SATA Settings page of Identify Device Data Log.
*/
if (ata_id_has_ncq(dev->id)) {
if (ata_id_has_devslp(dev->id)) {
u8 sata_setting[ATA_SECT_SIZE];
int i, j;
dev->flags |= ATA_DFLAG_DEVSLP;
err_mask = ata_read_log_page(dev,
ATA_LOG_SATA_ID_DEV_DATA,
ATA_LOG_SATA_SETTINGS,
dev->sata_settings,
sata_setting,
1);
if (err_mask)
ata_dev_dbg(dev,
"failed to get Identify Device Data, Emask 0x%x\n",
err_mask);
else
for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) {
j = ATA_LOG_DEVSLP_OFFSET + i;
dev->devslp_timing[i] = sata_setting[j];
}
}
dev->cdb_len = 16;

Просмотреть файл

@ -2094,7 +2094,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
*/
static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc)
{
if (qc->flags & AC_ERR_MEDIA)
if (qc->err_mask & AC_ERR_MEDIA)
return 0; /* don't retry media errors */
if (qc->flags & ATA_QCFLAG_IO)
return 1; /* otherwise retry anything from fs stack */

Просмотреть файл

@ -297,10 +297,12 @@ enum {
ATA_LOG_SATA_NCQ = 0x10,
ATA_LOG_SATA_ID_DEV_DATA = 0x30,
ATA_LOG_SATA_SETTINGS = 0x08,
ATA_LOG_DEVSLP_MDAT = 0x30,
ATA_LOG_DEVSLP_OFFSET = 0x30,
ATA_LOG_DEVSLP_SIZE = 0x08,
ATA_LOG_DEVSLP_MDAT = 0x00,
ATA_LOG_DEVSLP_MDAT_MASK = 0x1F,
ATA_LOG_DEVSLP_DETO = 0x31,
ATA_LOG_DEVSLP_VALID = 0x37,
ATA_LOG_DEVSLP_DETO = 0x01,
ATA_LOG_DEVSLP_VALID = 0x07,
ATA_LOG_DEVSLP_VALID_MASK = 0x80,
/* READ/WRITE LONG (obsolete) */

Просмотреть файл

@ -652,8 +652,8 @@ struct ata_device {
u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
};
/* Identify Device Data Log (30h), SATA Settings (page 08h) */
u8 sata_settings[ATA_SECT_SIZE];
/* DEVSLP Timing Variables from Identify Device Data Log */
u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];
/* error history */
int spdn_cnt;