Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata: handle broken cable reporting
pata_hpt37x: Fix outstanding bug reports on the HPT374 and 37x cable detect
ata_piix: Add additional PCI identifier for 40 wire short cable
pata_serverworks: Fix problem with some drive combinations
libata: Don't disable dipm with SET FEATURES
libata and bogus LBA48 drives

+83 -28
+30 -9
drivers/ata/libata-core.c
··· 676 676 if (rc) 677 677 return rc; 678 678 679 - /* disable DIPM */ 680 - if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM)) 681 - err_mask = ata_dev_set_feature(dev, 682 - SETFEATURES_SATA_DISABLE, SATA_DIPM); 679 + /* 680 + * we don't have to disable DIPM since IPM flags 681 + * disallow transitions to SLUMBER, which effectively 682 + * disable DIPM if it does not support PARTIAL 683 + */ 683 684 break; 684 685 case NOT_AVAILABLE: 685 686 case MAX_PERFORMANCE: ··· 690 689 if (rc) 691 690 return rc; 692 691 693 - /* disable DIPM */ 694 - if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM)) 695 - err_mask = ata_dev_set_feature(dev, 696 - SETFEATURES_SATA_DISABLE, SATA_DIPM); 692 + /* 693 + * we don't have to disable DIPM since IPM flags 694 + * disallow all transitions which effectively 695 + * disable DIPM anyway. 696 + */ 697 697 break; 698 698 } 699 699 ··· 4241 4239 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4242 4240 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4243 4241 4242 + /* Devices which get the IVB wrong */ 4243 + { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, }, 4244 + { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, }, 4245 + 4244 4246 /* End Marker */ 4245 4247 { } 4246 4248 }; ··· 4303 4297 (dev->flags & ATA_DFLAG_CDB_INTR)) 4304 4298 return 1; 4305 4299 return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0; 4300 + } 4301 + 4302 + /** 4303 + * ata_is_40wire - check drive side detection 4304 + * @dev: device 4305 + * 4306 + * Perform drive side detection decoding, allowing for device vendors 4307 + * who can't follow the documentation. 4308 + */ 4309 + 4310 + static int ata_is_40wire(struct ata_device *dev) 4311 + { 4312 + if (dev->horkage & ATA_HORKAGE_IVB) 4313 + return ata_drive_40wire_relaxed(dev->id); 4314 + return ata_drive_40wire(dev->id); 4306 4315 } 4307 4316 4308 4317 /** ··· 4389 4368 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) 4390 4369 /* UDMA/44 or higher would be available */ 4391 4370 if ((ap->cbl == ATA_CBL_PATA40) || 4392 - (ata_drive_40wire(dev->id) && 4371 + (ata_is_40wire(dev) && 4393 4372 (ap->cbl == ATA_CBL_PATA_UNK || 4394 4373 ap->cbl == ATA_CBL_PATA80))) { 4395 4374 ata_dev_printk(dev, KERN_WARNING,
+36 -13
drivers/ata/pata_hpt37x.c
··· 295 295 296 296 static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) 297 297 { 298 - if (adev->class != ATA_DEV_ATA) { 298 + if (adev->class == ATA_DEV_ATA) { 299 299 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) 300 300 mask &= ~ (0x1F << ATA_SHIFT_UDMA); 301 301 } ··· 359 359 { 0x50, 1, 0x04, 0x04 }, 360 360 { 0x54, 1, 0x04, 0x04 } 361 361 }; 362 - u16 mcr3, mcr6; 362 + u16 mcr3; 363 363 u8 ata66; 364 364 struct ata_port *ap = link->ap; 365 365 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 366 + unsigned int mcrbase = 0x50 + 4 * ap->port_no; 366 367 367 368 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) 368 369 return -ENOENT; 369 370 370 371 /* Do the extra channel work */ 371 - pci_read_config_word(pdev, 0x52, &mcr3); 372 - pci_read_config_word(pdev, 0x56, &mcr6); 372 + pci_read_config_word(pdev, mcrbase + 2, &mcr3); 373 373 /* Set bit 15 of 0x52 to enable TCBLID as input 374 - Set bit 15 of 0x56 to enable FCBLID as input 375 374 */ 376 - pci_write_config_word(pdev, 0x52, mcr3 | 0x8000); 377 - pci_write_config_word(pdev, 0x56, mcr6 | 0x8000); 375 + pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000); 378 376 pci_read_config_byte(pdev, 0x5A, &ata66); 379 377 /* Reset TCBLID/FCBLID to output */ 380 378 pci_write_config_word(pdev, 0x52, mcr3); 381 - pci_write_config_word(pdev, 0x56, mcr6); 382 379 383 - if (ata66 & (1 << ap->port_no)) 380 + if (ata66 & (2 >> ap->port_no)) 384 381 ap->cbl = ATA_CBL_PATA40; 385 382 else 386 383 ap->cbl = ATA_CBL_PATA80; ··· 841 844 /* Never went stable */ 842 845 return 0; 843 846 } 847 + 848 + static u32 hpt374_read_freq(struct pci_dev *pdev) 849 + { 850 + u32 freq; 851 + unsigned long io_base = pci_resource_start(pdev, 4); 852 + if (PCI_FUNC(pdev->devfn) & 1) { 853 + struct pci_dev *pdev_0 = pci_get_slot(pdev->bus, pdev->devfn - 1); 854 + /* Someone hot plugged the controller on us ? */ 855 + if (pdev_0 == NULL) 856 + return 0; 857 + io_base = pci_resource_start(pdev_0, 4); 858 + freq = inl(io_base + 0x90); 859 + pci_dev_put(pdev_0); 860 + } 861 + else 862 + freq = inl(io_base + 0x90); 863 + return freq; 864 + } 865 + 844 866 /** 845 867 * hpt37x_init_one - Initialise an HPT37X/302 846 868 * @dev: PCI device ··· 918 902 .flags = ATA_FLAG_SLAVE_POSS, 919 903 .pio_mask = 0x1f, 920 904 .mwdma_mask = 0x07, 921 - .udma_mask = 0x0f, 905 + .udma_mask = ATA_UDMA5, 922 906 .port_ops = &hpt370_port_ops 923 907 }; 924 908 /* HPT370A - UDMA100 */ ··· 927 911 .flags = ATA_FLAG_SLAVE_POSS, 928 912 .pio_mask = 0x1f, 929 913 .mwdma_mask = 0x07, 930 - .udma_mask = 0x0f, 914 + .udma_mask = ATA_UDMA5, 931 915 .port_ops = &hpt370a_port_ops 932 916 }; 933 917 /* HPT371, 372 and friends - UDMA133 */ ··· 1063 1047 outb(0x0e, iobase + 0x9c); 1064 1048 1065 1049 /* Some devices do not let this value be accessed via PCI space 1066 - according to the old driver */ 1050 + according to the old driver. In addition we must use the value 1051 + from FN 0 on the HPT374 */ 1067 1052 1068 - freq = inl(iobase + 0x90); 1053 + if (chip_table == &hpt374) { 1054 + freq = hpt374_read_freq(dev); 1055 + if (freq == 0) 1056 + return -ENODEV; 1057 + } else 1058 + freq = inl(iobase + 0x90); 1059 + 1069 1060 if ((freq >> 12) != 0xABCDE) { 1070 1061 int i; 1071 1062 u8 sr;
+5 -6
drivers/ata/pata_serverworks.c
··· 274 274 { 275 275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 }; 276 276 int offset = 1 + 2 * ap->port_no - adev->devno; 277 - int devbits = (2 * ap->port_no + adev->devno); 277 + int devbits = 2 * ap->port_no + adev->devno; 278 278 u8 ultra; 279 279 u8 ultra_cfg; 280 280 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 281 281 282 282 pci_read_config_byte(pdev, 0x54, &ultra_cfg); 283 + pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra); 284 + ultra &= ~(0x0F << (adev->devno * 4)); 283 285 284 286 if (adev->dma_mode >= XFER_UDMA_0) { 285 287 pci_write_config_byte(pdev, 0x44 + offset, 0x20); 286 288 287 - pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra); 288 - ultra &= ~(0x0F << (ap->port_no * 4)); 289 289 ultra |= (adev->dma_mode - XFER_UDMA_0) 290 - << (ap->port_no * 4); 291 - pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra); 292 - 290 + << (adev->devno * 4); 293 291 ultra_cfg |= (1 << devbits); 294 292 } else { 295 293 pci_write_config_byte(pdev, 0x44 + offset, 296 294 dma_mode[adev->dma_mode - XFER_MW_DMA_0]); 297 295 ultra_cfg &= ~(1 << devbits); 298 296 } 297 + pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra); 299 298 pci_write_config_byte(pdev, 0x54, ultra_cfg); 300 299 } 301 300
+11
include/linux/ata.h
··· 425 425 { 426 426 if ((id[83] & 0xC000) != 0x4000) 427 427 return 0; 428 + if (!ata_id_u64(id, 100)) 429 + return 0; 428 430 return id[83] & (1 << 10); 429 431 } 430 432 ··· 533 531 if (ata_id_is_sata(dev_id)) 534 532 return 0; /* SATA */ 535 533 if ((dev_id[93] & 0xE000) == 0x6000) 534 + return 0; /* 80 wire */ 535 + return 1; 536 + } 537 + 538 + static inline int ata_drive_40wire_relaxed(const u16 *dev_id) 539 + { 540 + if (ata_id_is_sata(dev_id)) 541 + return 0; /* SATA */ 542 + if ((dev_id[93] & 0x2000) == 0x2000) 536 543 return 0; /* 80 wire */ 537 544 return 1; 538 545 }
+1
include/linux/libata.h
··· 339 339 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */ 340 340 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */ 341 341 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */ 342 + ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ 342 343 343 344 /* DMA mask for user DMA control: User visible values; DO NOT 344 345 renumber */