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

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

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
[libata] pata_legacy: for VLB 32bit PIO don't try tricks with slop
[libata] pata_amd: program FIFO
sata_mv: fix SoC interrupt breakage
pata_it821x: resume from hibernation fails with RAID volume

+75 -31
+59 -17
drivers/ata/pata_amd.c
··· 24 24 #include <linux/libata.h> 25 25 26 26 #define DRV_NAME "pata_amd" 27 - #define DRV_VERSION "0.3.11" 27 + #define DRV_VERSION "0.4.1" 28 28 29 29 /** 30 30 * timing_setup - shared timing computation and load ··· 145 145 return ata_sff_prereset(link, deadline); 146 146 } 147 147 148 + /** 149 + * amd_cable_detect - report cable type 150 + * @ap: port 151 + * 152 + * AMD controller/BIOS setups record the cable type in word 0x42 153 + */ 154 + 148 155 static int amd_cable_detect(struct ata_port *ap) 149 156 { 150 157 static const u32 bitmask[2] = {0x03, 0x0C}; ··· 165 158 } 166 159 167 160 /** 161 + * amd_fifo_setup - set the PIO FIFO for ATA/ATAPI 162 + * @ap: ATA interface 163 + * @adev: ATA device 164 + * 165 + * Set the PCI fifo for this device according to the devices present 166 + * on the bus at this point in time. We need to turn the post write buffer 167 + * off for ATAPI devices as we may need to issue a word sized write to the 168 + * device as the final I/O 169 + */ 170 + 171 + static void amd_fifo_setup(struct ata_port *ap) 172 + { 173 + struct ata_device *adev; 174 + struct pci_dev *pdev = to_pci_dev(ap->host->dev); 175 + static const u8 fifobit[2] = { 0xC0, 0x30}; 176 + u8 fifo = fifobit[ap->port_no]; 177 + u8 r; 178 + 179 + 180 + ata_for_each_dev(adev, &ap->link, ENABLED) { 181 + if (adev->class == ATA_DEV_ATAPI) 182 + fifo = 0; 183 + } 184 + if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) /* FIFO is broken */ 185 + fifo = 0; 186 + 187 + /* On the later chips the read prefetch bits become no-op bits */ 188 + pci_read_config_byte(pdev, 0x41, &r); 189 + r &= ~fifobit[ap->port_no]; 190 + r |= fifo; 191 + pci_write_config_byte(pdev, 0x41, r); 192 + } 193 + 194 + /** 168 195 * amd33_set_piomode - set initial PIO mode data 169 196 * @ap: ATA interface 170 197 * @adev: ATA device ··· 208 167 209 168 static void amd33_set_piomode(struct ata_port *ap, struct ata_device *adev) 210 169 { 170 + amd_fifo_setup(ap); 211 171 timing_setup(ap, adev, 0x40, adev->pio_mode, 1); 212 172 } 213 173 214 174 static void amd66_set_piomode(struct ata_port *ap, struct ata_device *adev) 215 175 { 176 + amd_fifo_setup(ap); 216 177 timing_setup(ap, adev, 0x40, adev->pio_mode, 2); 217 178 } 218 179 219 180 static void amd100_set_piomode(struct ata_port *ap, struct ata_device *adev) 220 181 { 182 + amd_fifo_setup(ap); 221 183 timing_setup(ap, adev, 0x40, adev->pio_mode, 3); 222 184 } 223 185 224 186 static void amd133_set_piomode(struct ata_port *ap, struct ata_device *adev) 225 187 { 188 + amd_fifo_setup(ap); 226 189 timing_setup(ap, adev, 0x40, adev->pio_mode, 4); 227 190 } 228 191 ··· 442 397 .set_dmamode = nv133_set_dmamode, 443 398 }; 444 399 400 + static void amd_clear_fifo(struct pci_dev *pdev) 401 + { 402 + u8 fifo; 403 + /* Disable the FIFO, the FIFO logic will re-enable it as 404 + appropriate */ 405 + pci_read_config_byte(pdev, 0x41, &fifo); 406 + fifo &= 0x0F; 407 + pci_write_config_byte(pdev, 0x41, fifo); 408 + } 409 + 445 410 static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 446 411 { 447 412 static const struct ata_port_info info[10] = { ··· 558 503 559 504 if (type < 3) 560 505 ata_pci_bmdma_clear_simplex(pdev); 561 - 562 - /* Check for AMD7411 */ 563 - if (type == 3) 564 - /* FIFO is broken */ 565 - pci_write_config_byte(pdev, 0x41, fifo & 0x0F); 566 - else 567 - pci_write_config_byte(pdev, 0x41, fifo | 0xF0); 568 - 506 + if (pdev->vendor == PCI_VENDOR_ID_AMD) 507 + amd_clear_fifo(pdev); 569 508 /* Cable detection on Nvidia chips doesn't work too well, 570 509 * cache BIOS programmed UDMA mode. 571 510 */ ··· 585 536 return rc; 586 537 587 538 if (pdev->vendor == PCI_VENDOR_ID_AMD) { 588 - u8 fifo; 589 - pci_read_config_byte(pdev, 0x41, &fifo); 590 - if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) 591 - /* FIFO is broken */ 592 - pci_write_config_byte(pdev, 0x41, fifo & 0x0F); 593 - else 594 - pci_write_config_byte(pdev, 0x41, fifo | 0xF0); 539 + amd_clear_fifo(pdev); 595 540 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7409 || 596 541 pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401) 597 542 ata_pci_bmdma_clear_simplex(pdev); 598 543 } 599 - 600 544 ata_host_resume(host); 601 545 return 0; 602 546 }
+3
drivers/ata/pata_it821x.c
··· 557 557 id[83] |= 0x4400; /* Word 83 is valid and LBA48 */ 558 558 id[86] |= 0x0400; /* LBA48 on */ 559 559 id[ATA_ID_MAJOR_VER] |= 0x1F; 560 + /* Clear the serial number because it's different each boot 561 + which breaks validation on resume */ 562 + memset(&id[ATA_ID_SERNO], 0x20, ATA_ID_SERNO_LEN); 560 563 } 561 564 return err_mask; 562 565 }
+4 -3
drivers/ata/pata_legacy.c
··· 283 283 static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, 284 284 unsigned char *buf, unsigned int buflen, int rw) 285 285 { 286 - if (ata_id_has_dword_io(dev->id)) { 286 + int slop = buflen & 3; 287 + /* 32bit I/O capable *and* we need to write a whole number of dwords */ 288 + if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3)) { 287 289 struct ata_port *ap = dev->link->ap; 288 - int slop = buflen & 3; 289 290 unsigned long flags; 290 291 291 292 local_irq_save(flags); ··· 736 735 struct ata_port *ap = adev->link->ap; 737 736 int slop = buflen & 3; 738 737 739 - if (ata_id_has_dword_io(adev->id)) { 738 + if (ata_id_has_dword_io(adev->id) && (slop == 0 || slop == 3)) { 740 739 if (rw == WRITE) 741 740 iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 742 741 else
+9 -11
drivers/ata/sata_mv.c
··· 3114 3114 writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); 3115 3115 } 3116 3116 3117 - if (!IS_SOC(hpriv)) { 3118 - /* Clear any currently outstanding host interrupt conditions */ 3119 - writelfl(0, mmio + hpriv->irq_cause_ofs); 3117 + /* Clear any currently outstanding host interrupt conditions */ 3118 + writelfl(0, mmio + hpriv->irq_cause_ofs); 3120 3119 3121 - /* and unmask interrupt generation for host regs */ 3122 - writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); 3120 + /* and unmask interrupt generation for host regs */ 3121 + writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); 3123 3122 3124 - /* 3125 - * enable only global host interrupts for now. 3126 - * The per-port interrupts get done later as ports are set up. 3127 - */ 3128 - mv_set_main_irq_mask(host, 0, PCI_ERR); 3129 - } 3123 + /* 3124 + * enable only global host interrupts for now. 3125 + * The per-port interrupts get done later as ports are set up. 3126 + */ 3127 + mv_set_main_irq_mask(host, 0, PCI_ERR); 3130 3128 done: 3131 3129 return rc; 3132 3130 }