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 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-sff: Fix oops reported in kerneloops.org for pnp devices with no ctl
libata: kill unused constants
sata_mv: PHY_MODE4 cleanups
[libata] ata_piix: more acer short cable quirks
[libata] ACPI: Properly handle bay devices in dock stations

+238 -96
+2
drivers/ata/ata_piix.c
··· 574 574 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 575 575 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ 576 576 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ 577 + { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */ 578 + { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */ 577 579 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ 578 580 /* end marker */ 579 581 { 0, }
+113 -50
drivers/ata/libata-acpi.c
··· 118 118 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; 119 119 } 120 120 121 - static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device 122 - *dev, u32 event) 121 + static void ata_acpi_eject_device(acpi_handle handle) 122 + { 123 + struct acpi_object_list arg_list; 124 + union acpi_object arg; 125 + 126 + arg_list.count = 1; 127 + arg_list.pointer = &arg; 128 + arg.type = ACPI_TYPE_INTEGER; 129 + arg.integer.value = 1; 130 + 131 + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_EJ0", 132 + &arg_list, NULL))) 133 + printk(KERN_ERR "Failed to evaluate _EJ0!\n"); 134 + } 135 + 136 + /* @ap and @dev are the same as ata_acpi_handle_hotplug() */ 137 + static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev) 138 + { 139 + if (dev) 140 + dev->flags |= ATA_DFLAG_DETACH; 141 + else { 142 + struct ata_link *tlink; 143 + struct ata_device *tdev; 144 + 145 + ata_port_for_each_link(tlink, ap) 146 + ata_link_for_each_dev(tdev, tlink) 147 + tdev->flags |= ATA_DFLAG_DETACH; 148 + } 149 + 150 + ata_port_schedule_eh(ap); 151 + } 152 + 153 + /** 154 + * ata_acpi_handle_hotplug - ACPI event handler backend 155 + * @ap: ATA port ACPI event occurred 156 + * @dev: ATA device ACPI event occurred (can be NULL) 157 + * @event: ACPI event which occurred 158 + * @is_dock_event: boolean indicating whether the event was a dock one 159 + * 160 + * All ACPI bay / device realted events end up in this function. If 161 + * the event is port-wide @dev is NULL. If the event is specific to a 162 + * device, @dev points to it. 163 + * 164 + * Hotplug (as opposed to unplug) notification is always handled as 165 + * port-wide while unplug only kills the target device on device-wide 166 + * event. 167 + * 168 + * LOCKING: 169 + * ACPI notify handler context. May sleep. 170 + */ 171 + static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, 172 + u32 event, int is_dock_event) 123 173 { 124 174 char event_string[12]; 125 175 char *envp[] = { event_string, NULL }; 126 - struct ata_eh_info *ehi; 176 + struct ata_eh_info *ehi = &ap->link.eh_info; 127 177 struct kobject *kobj = NULL; 128 178 int wait = 0; 129 179 unsigned long flags; ··· 181 131 unsigned long sta; 182 132 acpi_status status; 183 133 184 - if (!ap) 185 - ap = dev->link->ap; 186 - ehi = &ap->link.eh_info; 187 - 188 - spin_lock_irqsave(ap->lock, flags); 189 - 190 - if (dev) 134 + if (dev) { 135 + if (dev->sdev) 136 + kobj = &dev->sdev->sdev_gendev.kobj; 191 137 handle = dev->acpi_handle; 192 - else 138 + } else { 139 + kobj = &ap->dev->kobj; 193 140 handle = ap->acpi_handle; 141 + } 194 142 195 143 status = acpi_get_handle(handle, "_EJ0", &tmphandle); 196 - if (ACPI_FAILURE(status)) { 197 - /* This device is not ejectable */ 198 - spin_unlock_irqrestore(ap->lock, flags); 144 + if (ACPI_FAILURE(status)) 145 + /* This device does not support hotplug */ 199 146 return; 200 - } 201 147 202 - status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 203 - if (ACPI_FAILURE(status)) { 204 - printk ("Unable to determine bay status\n"); 205 - spin_unlock_irqrestore(ap->lock, flags); 206 - return; 207 - } 148 + spin_lock_irqsave(ap->lock, flags); 208 149 209 150 switch (event) { 210 151 case ACPI_NOTIFY_BUS_CHECK: 211 152 case ACPI_NOTIFY_DEVICE_CHECK: 212 153 ata_ehi_push_desc(ehi, "ACPI event"); 213 - if (!sta) { 214 - /* Device has been unplugged */ 215 - if (dev) 216 - dev->flags |= ATA_DFLAG_DETACH; 217 - else { 218 - struct ata_link *tlink; 219 - struct ata_device *tdev; 220 154 221 - ata_port_for_each_link(tlink, ap) { 222 - ata_link_for_each_dev(tdev, tlink) { 223 - tdev->flags |= 224 - ATA_DFLAG_DETACH; 225 - } 226 - } 227 - } 228 - ata_port_schedule_eh(ap); 229 - wait = 1; 230 - } else { 155 + status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 156 + if (ACPI_FAILURE(status)) { 157 + ata_port_printk(ap, KERN_ERR, 158 + "acpi: failed to determine bay status (0x%x)\n", 159 + status); 160 + break; 161 + } 162 + 163 + if (sta) { 231 164 ata_ehi_hotplugged(ehi); 232 165 ata_port_freeze(ap); 166 + } else { 167 + /* The device has gone - unplug it */ 168 + ata_acpi_detach_device(ap, dev); 169 + wait = 1; 233 170 } 171 + break; 172 + case ACPI_NOTIFY_EJECT_REQUEST: 173 + ata_ehi_push_desc(ehi, "ACPI event"); 174 + 175 + if (!is_dock_event) 176 + break; 177 + 178 + /* undock event - immediate unplug */ 179 + ata_acpi_detach_device(ap, dev); 180 + wait = 1; 181 + break; 234 182 } 183 + 184 + /* make sure kobj doesn't go away while ap->lock is released */ 185 + kobject_get(kobj); 235 186 236 187 spin_unlock_irqrestore(ap->lock, flags); 237 188 238 - if (wait) 189 + if (wait) { 239 190 ata_port_wait_eh(ap); 191 + ata_acpi_eject_device(handle); 192 + } 240 193 241 - if (dev) { 242 - if (dev->sdev) 243 - kobj = &dev->sdev->sdev_gendev.kobj; 244 - } else 245 - kobj = &ap->dev->kobj; 246 - 247 - if (kobj) { 194 + if (kobj && !is_dock_event) { 248 195 sprintf(event_string, "BAY_EVENT=%d", event); 249 196 kobject_uevent_env(kobj, KOBJ_CHANGE, envp); 250 197 } 198 + 199 + kobject_put(kobj); 200 + } 201 + 202 + static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data) 203 + { 204 + struct ata_device *dev = data; 205 + 206 + ata_acpi_handle_hotplug(dev->link->ap, dev, event, 1); 207 + } 208 + 209 + static void ata_acpi_ap_notify_dock(acpi_handle handle, u32 event, void *data) 210 + { 211 + struct ata_port *ap = data; 212 + 213 + ata_acpi_handle_hotplug(ap, NULL, event, 1); 251 214 } 252 215 253 216 static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) 254 217 { 255 218 struct ata_device *dev = data; 256 219 257 - ata_acpi_handle_hotplug(NULL, dev, event); 220 + ata_acpi_handle_hotplug(dev->link->ap, dev, event, 0); 258 221 } 259 222 260 223 static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) 261 224 { 262 225 struct ata_port *ap = data; 263 226 264 - ata_acpi_handle_hotplug(ap, NULL, event); 227 + ata_acpi_handle_hotplug(ap, NULL, event, 0); 265 228 } 266 229 267 230 /** ··· 315 252 ata_acpi_ap_notify, ap); 316 253 /* we might be on a docking station */ 317 254 register_hotplug_dock_device(ap->acpi_handle, 318 - ata_acpi_ap_notify, ap); 255 + ata_acpi_ap_notify_dock, ap); 319 256 } 320 257 321 258 for (j = 0; j < ata_link_max_devices(&ap->link); j++) { ··· 327 264 ata_acpi_dev_notify, dev); 328 265 /* we might be on a docking station */ 329 266 register_hotplug_dock_device(dev->acpi_handle, 330 - ata_acpi_dev_notify, dev); 267 + ata_acpi_dev_notify_dock, dev); 331 268 } 332 269 } 333 270 }
+100 -15
drivers/ata/libata-sff.c
··· 247 247 * LOCKING: 248 248 * Inherited from caller. 249 249 */ 250 - u8 ata_sff_altstatus(struct ata_port *ap) 250 + static u8 ata_sff_altstatus(struct ata_port *ap) 251 251 { 252 252 if (ap->ops->sff_check_altstatus) 253 253 return ap->ops->sff_check_altstatus(ap); 254 254 255 255 return ioread8(ap->ioaddr.altstatus_addr); 256 + } 257 + 258 + /** 259 + * ata_sff_irq_status - Check if the device is busy 260 + * @ap: port where the device is 261 + * 262 + * Determine if the port is currently busy. Uses altstatus 263 + * if available in order to avoid clearing shared IRQ status 264 + * when finding an IRQ source. Non ctl capable devices don't 265 + * share interrupt lines fortunately for us. 266 + * 267 + * LOCKING: 268 + * Inherited from caller. 269 + */ 270 + static u8 ata_sff_irq_status(struct ata_port *ap) 271 + { 272 + u8 status; 273 + 274 + if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { 275 + status = ata_sff_altstatus(ap); 276 + /* Not us: We are busy */ 277 + if (status & ATA_BUSY) 278 + return status; 279 + } 280 + /* Clear INTRQ latch */ 281 + status = ata_sff_check_status(ap); 282 + return status; 283 + } 284 + 285 + /** 286 + * ata_sff_sync - Flush writes 287 + * @ap: Port to wait for. 288 + * 289 + * CAUTION: 290 + * If we have an mmio device with no ctl and no altstatus 291 + * method this will fail. No such devices are known to exist. 292 + * 293 + * LOCKING: 294 + * Inherited from caller. 295 + */ 296 + 297 + static void ata_sff_sync(struct ata_port *ap) 298 + { 299 + if (ap->ops->sff_check_altstatus) 300 + ap->ops->sff_check_altstatus(ap); 301 + else if (ap->ioaddr.altstatus_addr) 302 + ioread8(ap->ioaddr.altstatus_addr); 303 + } 304 + 305 + /** 306 + * ata_sff_pause - Flush writes and wait 400nS 307 + * @ap: Port to pause for. 308 + * 309 + * CAUTION: 310 + * If we have an mmio device with no ctl and no altstatus 311 + * method this will fail. No such devices are known to exist. 312 + * 313 + * LOCKING: 314 + * Inherited from caller. 315 + */ 316 + 317 + void ata_sff_pause(struct ata_port *ap) 318 + { 319 + ata_sff_sync(ap); 320 + ndelay(400); 321 + } 322 + 323 + /** 324 + * ata_sff_dma_pause - Pause before commencing DMA 325 + * @ap: Port to pause for. 326 + * 327 + * Perform I/O fencing and ensure sufficient cycle delays occur 328 + * for the HDMA1:0 transition 329 + */ 330 + 331 + void ata_sff_dma_pause(struct ata_port *ap) 332 + { 333 + if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { 334 + /* An altstatus read will cause the needed delay without 335 + messing up the IRQ status */ 336 + ata_sff_altstatus(ap); 337 + return; 338 + } 339 + /* There are no DMA controllers without ctl. BUG here to ensure 340 + we never violate the HDMA1:0 transition timing and risk 341 + corruption. */ 342 + BUG(); 256 343 } 257 344 258 345 /** ··· 829 742 } else 830 743 ata_pio_sector(qc); 831 744 832 - ata_sff_altstatus(qc->ap); /* flush */ 745 + ata_sff_sync(qc->ap); /* flush */ 833 746 } 834 747 835 748 /** ··· 850 763 WARN_ON(qc->dev->cdb_len < 12); 851 764 852 765 ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); 853 - ata_sff_altstatus(ap); /* flush */ 854 - 766 + ata_sff_sync(ap); 767 + /* FIXME: If the CDB is for DMA do we need to do the transition delay 768 + or is bmdma_start guaranteed to do it ? */ 855 769 switch (qc->tf.protocol) { 856 770 case ATAPI_PROT_PIO: 857 771 ap->hsm_task_state = HSM_ST; ··· 993 905 994 906 if (unlikely(__atapi_pio_bytes(qc, bytes))) 995 907 goto err_out; 996 - ata_sff_altstatus(ap); /* flush */ 908 + ata_sff_sync(ap); /* flush */ 997 909 998 910 return; 999 911 ··· 1577 1489 goto idle_irq; 1578 1490 } 1579 1491 1580 - /* check altstatus */ 1581 - status = ata_sff_altstatus(ap); 1582 - if (status & ATA_BUSY) 1583 - goto idle_irq; 1584 1492 1585 - /* check main status, clearing INTRQ */ 1586 - status = ap->ops->sff_check_status(ap); 1587 - if (unlikely(status & ATA_BUSY)) 1493 + /* check main status, clearing INTRQ if needed */ 1494 + status = ata_sff_irq_status(ap); 1495 + if (status & ATA_BUSY) 1588 1496 goto idle_irq; 1589 1497 1590 1498 /* ack bmdma irq events */ ··· 2114 2030 ap->ops->bmdma_stop(qc); 2115 2031 } 2116 2032 2117 - ata_sff_altstatus(ap); 2033 + ata_sff_sync(ap); /* FIXME: We don't need this */ 2118 2034 ap->ops->sff_check_status(ap); 2119 2035 ap->ops->sff_irq_clear(ap); 2120 2036 ··· 2287 2203 mmio + ATA_DMA_CMD); 2288 2204 2289 2205 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 2290 - ata_sff_altstatus(ap); /* dummy read */ 2206 + ata_sff_dma_pause(ap); 2291 2207 } 2292 2208 2293 2209 /** ··· 2806 2722 EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep); 2807 2723 EXPORT_SYMBOL_GPL(ata_sff_dev_select); 2808 2724 EXPORT_SYMBOL_GPL(ata_sff_check_status); 2809 - EXPORT_SYMBOL_GPL(ata_sff_altstatus); 2725 + EXPORT_SYMBOL_GPL(ata_sff_dma_pause); 2726 + EXPORT_SYMBOL_GPL(ata_sff_pause); 2810 2727 EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); 2811 2728 EXPORT_SYMBOL_GPL(ata_sff_wait_ready); 2812 2729 EXPORT_SYMBOL_GPL(ata_sff_tf_load);
+1 -1
drivers/ata/pata_icside.c
··· 270 270 disable_dma(state->dma); 271 271 272 272 /* see ata_bmdma_stop */ 273 - ata_sff_altstatus(ap); 273 + ata_sff_dma_pause(ap); 274 274 } 275 275 276 276 static u8 pata_icside_bmdma_status(struct ata_port *ap)
+3 -1
drivers/ata/pata_rb532_cf.c
··· 57 57 struct ata_host *ah = ap->host; 58 58 struct rb532_cf_info *info = ah->private_data; 59 59 60 - ata_sff_altstatus(ap); 60 + /* FIXME: Keep previous delay. If this is merely a fence then 61 + ata_sff_sync might be sufficient. */ 62 + ata_sff_dma_pause(ap); 61 63 ndelay(RB500_CF_IO_DELAY); 62 64 63 65 set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
+3 -2
drivers/ata/pata_scc.c
··· 726 726 in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START); 727 727 728 728 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 729 - ata_sff_altstatus(ap); /* dummy read */ 729 + ata_sff_dma_pause(ap); /* dummy read */ 730 730 } 731 731 732 732 /** ··· 747 747 return host_stat; 748 748 749 749 /* errata A252,A308 workaround: Step4 */ 750 - if ((ata_sff_altstatus(ap) & ATA_ERR) && (int_status & INTSTS_INTRQ)) 750 + if ((scc_check_altstatus(ap) & ATA_ERR) 751 + && (int_status & INTSTS_INTRQ)) 751 752 return (host_stat | ATA_DMA_INTR); 752 753 753 754 /* errata A308 workaround Step5 */
+14 -10
drivers/ata/sata_mv.c
··· 224 224 225 225 PHY_MODE3 = 0x310, 226 226 PHY_MODE4 = 0x314, 227 + PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */ 228 + PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */ 229 + PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */ 230 + PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */ 231 + 227 232 PHY_MODE2 = 0x330, 228 233 SATA_IFCTL_OFS = 0x344, 229 234 SATA_TESTCTL_OFS = 0x348, ··· 2568 2563 m3 &= ~0x1c; 2569 2564 2570 2565 if (fix_phy_mode4) { 2571 - u32 m4; 2572 - 2573 - m4 = readl(port_mmio + PHY_MODE4); 2574 - 2575 - /* workaround for errata FEr SATA#10 (part 1) */ 2576 - m4 = (m4 & ~(1 << 1)) | (1 << 0); 2577 - 2578 - /* enforce bit restrictions on GenIIe devices */ 2566 + u32 m4 = readl(port_mmio + PHY_MODE4); 2567 + /* 2568 + * Enforce reserved-bit restrictions on GenIIe devices only. 2569 + * For earlier chipsets, force only the internal config field 2570 + * (workaround for errata FEr SATA#10 part 1). 2571 + */ 2579 2572 if (IS_GEN_IIE(hpriv)) 2580 - m4 = (m4 & ~0x5DE3FFFC) | (1 << 2); 2581 - 2573 + m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES; 2574 + else 2575 + m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE; 2582 2576 writel(m4, port_mmio + PHY_MODE4); 2583 2577 } 2584 2578 /*
+2 -17
include/linux/libata.h
··· 111 111 /* various global constants */ 112 112 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 113 113 LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ 114 - ATA_MAX_PORTS = 8, 115 114 ATA_DEF_QUEUE = 1, 116 115 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 117 116 ATA_MAX_QUEUE = 32, 118 117 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 119 - ATA_MAX_BUS = 2, 120 - ATA_DEF_BUSY_WAIT = 10000, 121 118 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 122 119 123 120 ATAPI_MAX_DRAIN = 16 << 10, ··· 1432 1435 extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); 1433 1436 extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); 1434 1437 extern u8 ata_sff_check_status(struct ata_port *ap); 1435 - extern u8 ata_sff_altstatus(struct ata_port *ap); 1438 + extern void ata_sff_pause(struct ata_port *ap); 1439 + extern void ata_sff_dma_pause(struct ata_port *ap); 1436 1440 extern int ata_sff_busy_sleep(struct ata_port *ap, 1437 1441 unsigned long timeout_pat, unsigned long timeout); 1438 1442 extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); ··· 1492 1494 const struct ata_port_info * const * ppi, 1493 1495 struct scsi_host_template *sht, void *host_priv); 1494 1496 #endif /* CONFIG_PCI */ 1495 - 1496 - /** 1497 - * ata_sff_pause - Flush writes and pause 400 nanoseconds. 1498 - * @ap: Port to wait for. 1499 - * 1500 - * LOCKING: 1501 - * Inherited from caller. 1502 - */ 1503 - static inline void ata_sff_pause(struct ata_port *ap) 1504 - { 1505 - ata_sff_altstatus(ap); 1506 - ndelay(400); 1507 - } 1508 1497 1509 1498 /** 1510 1499 * ata_sff_busy_wait - Wait for a port status register