--- kernel/drivers/ide/ide-dma.c 2006-08-20 11:31:53.000000000 +0200 +++ kernel/drivers/ide/ide-dma.c 2006-08-20 11:40:43.000000000 +0200 @@ -89,6 +89,57 @@ #include #include + +/* Some VIA boards show strange slowdown when HLT is eanbled */ +/* So we disable the HLT during a IDE-DMA transfer. */ +/* You need to pass disableviahlt at boottime to enable this */ +/* workaround. */ +#if defined(HAVE_DISABLE_HLT) + +static DEFINE_SPINLOCK(ide_hlt_lock); +static int hlt_disabled; +static int disableviahlt; +static void ide_disable_hlt(void) +{ + unsigned long flags; + + spin_lock_irqsave(&ide_hlt_lock, flags); + if(disableviahlt) { + hlt_disabled++ ; + disable_hlt(); + } + spin_unlock_irqrestore(&ide_hlt_lock, flags); +} + +static void ide_enable_hlt(void) +{ + unsigned long flags; + + spin_lock_irqsave(&ide_hlt_lock, flags); + if(hlt_disabled && disableviahlt){ + hlt_disabled--; + enable_hlt(); + } + spin_unlock_irqrestore(&ide_hlt_lock, flags); +} + +static int __init disable_via_hlt(char *str) +{ + printk(KERN_WARNING "DISABLE VIA HLT activated\n"); + disableviahlt = 1; + return 1; +} + +__setup("disableviahlt", disable_via_hlt); + + +#else /* HAVE_DISABLE_HLT */ +inline static void ide_disable_hlt(void) +{} +inline static void ide_enable_hlt(void) +{} +#endif /* HAVE_DISABLE_HLT */ + static const struct drive_list_entry drive_whitelist [] = { { "Micropolis 2112A" , "ALL" }, @@ -301,6 +352,7 @@ if (count) { if (!is_trm290) *--table |= cpu_to_le32(0x80000000); + ide_disable_hlt(); return count; } printk(KERN_ERR "%s: empty DMA table?\n", drive->name); @@ -332,6 +384,7 @@ int nents = HWIF(drive)->sg_nents; pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction); + ide_enable_hlt(); } EXPORT_SYMBOL_GPL(ide_destroy_dmatable);