libata: upstream version of the 40pin short cable patch
PATCH 1/1 libata: upstream version of the 40pin short cable patch
Signed-off-by Alan Cox <[email protected]>
(Sorry its -R, git doesn't appear to have the ability to generate reverse diffs to fix this)
drivers/ata/ata_piix.c +1 -29
@@ -93,7 +93,7 @@#include <linux/libata.h> #define DRV_NAME "ata_piix" -#define DRV_VERSION "2.00-u1ac40" +#define DRV_VERSION "2.00"enum {PIIX_IOCFG =0x54 ,/* IDE I/O configuration register */
@@ -473,24 +473,6 @@ module_param(force_pcs, int, 0444);MODULE_PARM_DESC (force_pcs,"force honoring or ignoring PCS to work around " "device mis-detection (0=default, 1=ignore PCS, 2=honor PCS)" ); - -struct ich_laptop { -u16 device; -u16 subvendor; -u16 subdevice; -}; - -/* -* List of laptops that use short cables rather than 80 wire -*/ - -static const struct ich_laptop ich_laptop[] = { -/* devid, subvendor, subdev */ - {0x27DF ,0x0005 ,0x0280 },/* ICH7 on Acer 5602WLMi */ -/* end marker */ - {0 , } -}; -/** * piix_pata_cbl_detect - Probe host controller cable detect info * @ap: Port for which cable detect info is desired
@@ -504,21 +486,12 @@ static const struct ich_laptop ich_laptostatic void piix_pata_cbl_detect (struct ata_port *ap) {struct pci_dev *pdev =to_pci_dev (ap->host->dev); -const struct ich_laptop *lap = &ich_laptop[0 ];u8 tmp, mask;/* no 80c support in host controller? */ if ((ap->udma_mask & ~ATA_UDMA_MASK_40C ) ==0 ) goto cbl40; -/* Check for specials - Acer Aspire 5602WLMi */ -while (lap->device) { -if (lap->device == pdev->device && - lap->subvendor == pdev->subsystem_vendor && - lap->subdevice == pdev->subsystem_device) -return ATA_CBL_PATA40_SHORT ; - lap++; - }/* check BIOS cable detect results */ mask = ap->port_no ==0 ?PIIX_80C_PRI :PIIX_80C_SEC ;pci_read_config_byte (pdev,PIIX_IOCFG , &tmp);
@@ -604,7 +577,6 @@ static unsigned int piix_sata_present_mareturn present_mask; } -/** * piix_sata_softreset - reset SATA host port via ATA SRST * @ap: port to reset
drivers/ata/libata-core.c +0 -7
@@ -3093,13 +3093,6 @@ static void ata_dev_xfermask(struct ata_*/ if (ap->cbl ==ATA_CBL_PATA40 ) xfer_mask &= ~(0xF8 <<ATA_SHIFT_UDMA ); -/* Apply drive side cable rule. Unknown or 80 pin cables reported -* host side are checked drive side as well. Cases where we know a -* 40wire cable is used safely for 80 are not checked here. -*/ -if (ata_drive_40wire (dev->id) && (ap->cbl ==ATA_CBL_PATA_UNK || ap->cbl ==ATA_CBL_PATA80 )) - xfer_mask &= ~(0xF8 <<ATA_SHIFT_UDMA ); - xfer_mask &=ata_pack_xfermask (dev->pio_mask, dev->mwdma_mask, dev->udma_mask);
include/linux/ata.h +2 -12
@@ -200,9 +200,8 @@ enum {ATA_CBL_NONE =0 ,ATA_CBL_PATA40 =1 ,ATA_CBL_PATA80 =2 , -ATA_CBL_PATA40_SHORT =3 ,/* 40 wire cable to high UDMA spec */ -ATA_CBL_PATA_UNK =4 , -ATA_CBL_SATA =5 , +ATA_CBL_PATA_UNK =3 , +ATA_CBL_SATA =4 ,/* SATA Status and Control Registers */ SCR_STATUS = 0,
@@ -343,15 +342,6 @@ static inline int ata_id_is_cfa(const u1return 0 ; } -static inline int ata_drive_40wire (const u16 *dev_id) -{ -if (ata_id_major_version (dev_id) >=5 &&ata_id_is_sata (dev_id)) -return 0 ;/* SATA */ -if (dev_id[93 ] &0x4000 ) -return 0 ;/* 80 wire */ -return 1 ; -} -static inline int atapi_cdb_len (const u16 *dev_id) {u16 tmp = dev_id[0 ] &0x3 ;
Ar Iau, 2006-08-24 am 18:09 +0100, ysgrifennodd Alan Cox:
Quoted 2 lines
---
a/drivers/ata/ata_piix.c
Please ignore that diff I'm an idiot and if you don't have git-diff aliased wrongly then git-diff -R works rather well 8)
Use this instead
Signed-off-by Alan Cox <[email protected]>
drivers/ata/ata_piix.c +29 -1
@@ -93,7 +93,7 @@#include <linux/libata.h> #define DRV_NAME "ata_piix" -#define DRV_VERSION "2.00" +#define DRV_VERSION "2.00-u1ac40"enum {PIIX_IOCFG =0x54 ,/* IDE I/O configuration register */
@@ -473,6 +473,24 @@ module_param(force_pcs, int, 0444);MODULE_PARM_DESC (force_pcs,"force honoring or ignoring PCS to work around " "device mis-detection (0=default, 1=ignore PCS, 2=honor PCS)" ); + +struct ich_laptop { +u16 device; +u16 subvendor; +u16 subdevice; +}; + +/* +* List of laptops that use short cables rather than 80 wire +*/ + +static const struct ich_laptop ich_laptop[] = { +/* devid, subvendor, subdev */ + {0x27DF ,0x0005 ,0x0280 },/* ICH7 on Acer 5602WLMi */ +/* end marker */ + {0 , } +}; +/** * piix_pata_cbl_detect - Probe host controller cable detect info * @ap: Port for which cable detect info is desired
@@ -486,12 +504,21 @@ MODULE_PARM_DESC(force_pcs, "force honorstatic void piix_pata_cbl_detect (struct ata_port *ap) {struct pci_dev *pdev =to_pci_dev (ap->host->dev); +const struct ich_laptop *lap = &ich_laptop[0 ];u8 tmp, mask;/* no 80c support in host controller? */ if ((ap->udma_mask & ~ATA_UDMA_MASK_40C ) ==0 ) goto cbl40; +/* Check for specials - Acer Aspire 5602WLMi */ +while (lap->device) { +if (lap->device == pdev->device && + lap->subvendor == pdev->subsystem_vendor && + lap->subdevice == pdev->subsystem_device) +return ATA_CBL_PATA40_SHORT ; + lap++; + }/* check BIOS cable detect results */ mask = ap->port_no ==0 ?PIIX_80C_PRI :PIIX_80C_SEC ;pci_read_config_byte (pdev,PIIX_IOCFG , &tmp);
@@ -577,6 +604,7 @@ static unsigned int piix_sata_present_mareturn present_mask; } +/** * piix_sata_softreset - reset SATA host port via ATA SRST * @ap: port to reset
drivers/ata/libata-core.c +7 -0
@@ -3093,6 +3093,13 @@ static void ata_dev_xfermask(struct ata_*/ if (ap->cbl ==ATA_CBL_PATA40 ) xfer_mask &= ~(0xF8 <<ATA_SHIFT_UDMA ); +/* Apply drive side cable rule. Unknown or 80 pin cables reported +* host side are checked drive side as well. Cases where we know a +* 40wire cable is used safely for 80 are not checked here. +*/ +if (ata_drive_40wire (dev->id) && (ap->cbl ==ATA_CBL_PATA_UNK || ap->cbl ==ATA_CBL_PATA80 )) + xfer_mask &= ~(0xF8 <<ATA_SHIFT_UDMA ); + xfer_mask &=ata_pack_xfermask (dev->pio_mask, dev->mwdma_mask, dev->udma_mask);
include/linux/ata.h +12 -2
@@ -200,8 +200,9 @@ enum {ATA_CBL_NONE =0 ,ATA_CBL_PATA40 =1 ,ATA_CBL_PATA80 =2 , -ATA_CBL_PATA_UNK =3 , -ATA_CBL_SATA =4 , +ATA_CBL_PATA40_SHORT =3 ,/* 40 wire cable to high UDMA spec */ +ATA_CBL_PATA_UNK =4 , +ATA_CBL_SATA =5 ,/* SATA Status and Control Registers */ SCR_STATUS = 0,
@@ -342,6 +343,15 @@ static inline int ata_id_is_cfa(const u1return 0 ; } +static inline int ata_drive_40wire (const u16 *dev_id) +{ +if (ata_id_major_version (dev_id) >=5 &&ata_id_is_sata (dev_id)) +return 0 ;/* SATA */ +if (dev_id[93 ] &0x4000 ) +return 0 ;/* 80 wire */ +return 1 ; +} +static inline int atapi_cdb_len (const u16 *dev_id) {u16 tmp = dev_id[0 ] &0x3 ;