Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: (23 commits)
ide: add support for SCSI ioctls to ide-floppy
ide: remove stale changelog from setup-pci.c
ide: remove stale changelog/comments/TODO from ide.c
ide-cris: handle PIO auto-tuning in tune_cris_ide()
ide: add PIO masks
ide: remove ide_find_best_pio_mode()
ide: drop "PIO data" argument from ide_get_best_pio_mode()
ide: ide_find_best_pio_mode() fixes (take 2)
ide: add ide_pio_cycle_time() helper (take 2)
sc1200: remove stale Power Management code
ide: ide_start_power_step() fix WRT disabling DMA
serverworks: fix DMA
serverworks: always tune PIO
ide: add ide_pci_device_t.host_flags (take 2)
ide: add ide_dev_has_iordy() helper (take 4)
ide: make ide_get_best_pio_mode() print info if overriding PIO mode
siimage: PIO mode setup fixes (take 2)
atiixp: PIO mode setup fixes
ide: Stop mapping ROMs
IDE: Remove references to dead ETRAX-related variables.
...

+473 -599
+1
drivers/ata/pata_pcmcia.c
··· 382 382 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 383 383 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 384 384 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 385 + PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 385 386 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 386 387 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 387 388 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
+3 -6
drivers/ide/cris/ide-cris.c
··· 414 414 #ifdef CONFIG_ETRAX_IDE_G27_RESET 415 415 REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val); 416 416 #endif 417 - #ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET 418 - REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, val); 419 - #endif 420 - #ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET 421 - REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, val); 422 - #endif 423 417 #ifdef CONFIG_ETRAX_IDE_PB7_RESET 424 418 port_pb_dir_shadow = port_pb_dir_shadow | 425 419 IO_STATE(R_PORT_PB_DIR, dir7, output); ··· 684 690 { 685 691 int setup, strobe, hold; 686 692 693 + pio = ide_get_best_pio_mode(drive, pio, 4); 694 + 687 695 switch(pio) 688 696 { 689 697 case 0: ··· 816 820 hwif->dma_host_on = &cris_dma_on; 817 821 hwif->dma_off_quietly = &cris_dma_off; 818 822 hwif->cbl = ATA_CBL_PATA40; 823 + hwif->pio_mask = ATA_PIO4, 819 824 hwif->ultra_mask = cris_ultra_mask; 820 825 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ 821 826 hwif->autodma = 1;
+17 -1
drivers/ide/ide-floppy.c
··· 99 99 #include <linux/bitops.h> 100 100 #include <linux/mutex.h> 101 101 102 + #include <scsi/scsi_ioctl.h> 103 + 102 104 #include <asm/byteorder.h> 103 105 #include <asm/irq.h> 104 106 #include <asm/uaccess.h> ··· 2101 2099 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: 2102 2100 return idefloppy_get_format_progress(drive, argp); 2103 2101 } 2104 - return generic_ide_ioctl(drive, file, bdev, cmd, arg); 2102 + 2103 + /* 2104 + * skip SCSI_IOCTL_SEND_COMMAND (deprecated) 2105 + * and CDROM_SEND_PACKET (legacy) ioctls 2106 + */ 2107 + if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) 2108 + err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, 2109 + bdev->bd_disk, cmd, argp); 2110 + else 2111 + err = -ENOTTY; 2112 + 2113 + if (err == -ENOTTY) 2114 + err = generic_ide_ioctl(drive, file, bdev, cmd, arg); 2115 + 2116 + return err; 2105 2117 } 2106 2118 2107 2119 static int idefloppy_media_changed(struct gendisk *disk)
+3 -2
drivers/ide/ide-io.c
··· 224 224 * we could be smarter and check for current xfer_speed 225 225 * in struct drive etc... 226 226 */ 227 - if ((drive->id->capability & 1) == 0) 228 - break; 229 227 if (drive->hwif->ide_dma_check == NULL) 230 228 break; 231 229 drive->hwif->dma_off_quietly(drive); 230 + /* 231 + * TODO: respect ->using_dma setting 232 + */ 232 233 ide_set_dma(drive); 233 234 break; 234 235 }
+42 -30
drivers/ide/ide-lib.c
··· 249 249 return -1; 250 250 } 251 251 252 + unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio) 253 + { 254 + struct hd_driveid *id = drive->id; 255 + int cycle_time = 0; 256 + 257 + if (id->field_valid & 2) { 258 + if (id->capability & 8) 259 + cycle_time = id->eide_pio_iordy; 260 + else 261 + cycle_time = id->eide_pio; 262 + } 263 + 264 + /* conservative "downgrade" for all pre-ATA2 drives */ 265 + if (pio < 3) { 266 + if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time) 267 + cycle_time = 0; /* use standard timing */ 268 + } 269 + 270 + return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time; 271 + } 272 + 273 + EXPORT_SYMBOL_GPL(ide_pio_cycle_time); 274 + 252 275 /** 253 276 * ide_get_best_pio_mode - get PIO mode from drive 254 277 * @drive: drive to consider 255 278 * @mode_wanted: preferred mode 256 279 * @max_mode: highest allowed mode 257 - * @d: PIO data 258 280 * 259 281 * This routine returns the recommended PIO settings for a given drive, 260 282 * based on the drive->id information and the ide_pio_blacklist[]. ··· 285 263 * This is used by most chipset support modules when "auto-tuning". 286 264 */ 287 265 288 - u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) 266 + u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) 289 267 { 290 268 int pio_mode; 291 - int cycle_time = 0; 292 - int use_iordy = 0; 293 269 struct hd_driveid* id = drive->id; 294 270 int overridden = 0; 295 271 296 - if (mode_wanted != 255) { 297 - pio_mode = mode_wanted; 298 - use_iordy = (pio_mode > 2); 299 - } else if (!drive->id) { 300 - pio_mode = 0; 301 - } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 302 - overridden = 1; 303 - use_iordy = (pio_mode > 2); 272 + if (mode_wanted != 255) 273 + return min_t(u8, mode_wanted, max_mode); 274 + 275 + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && 276 + (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 277 + printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); 304 278 } else { 305 279 pio_mode = id->tPIO; 306 280 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ ··· 304 286 overridden = 1; 305 287 } 306 288 if (id->field_valid & 2) { /* drive implements ATA2? */ 307 - if (id->capability & 8) { /* drive supports use_iordy? */ 308 - use_iordy = 1; 309 - cycle_time = id->eide_pio_iordy; 289 + if (id->capability & 8) { /* IORDY supported? */ 310 290 if (id->eide_pio_modes & 7) { 311 291 overridden = 0; 312 292 if (id->eide_pio_modes & 4) ··· 314 298 else 315 299 pio_mode = 3; 316 300 } 317 - } else { 318 - cycle_time = id->eide_pio; 319 301 } 320 302 } 303 + 304 + if (overridden) 305 + printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n", 306 + drive->name); 321 307 322 308 /* 323 309 * Conservative "downgrade" for all pre-ATA2 drives 324 310 */ 325 - if (pio_mode && pio_mode < 4) { 311 + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 && 312 + pio_mode && pio_mode < 4) { 326 313 pio_mode--; 327 - overridden = 1; 328 - if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time) 329 - cycle_time = 0; /* use standard timing */ 314 + printk(KERN_INFO "%s: applying conservative " 315 + "PIO \"downgrade\"\n", drive->name); 330 316 } 331 317 } 332 - if (pio_mode > max_mode) { 318 + 319 + if (pio_mode > max_mode) 333 320 pio_mode = max_mode; 334 - cycle_time = 0; 335 - } 336 - if (d) { 337 - d->pio_mode = pio_mode; 338 - d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; 339 - d->use_iordy = use_iordy; 340 - d->overridden = overridden; 341 - } 321 + 342 322 return pio_mode; 343 323 } 344 324
+2 -18
drivers/ide/ide-timing.h
··· 106 106 #define XFER_EPIO 0x01 107 107 #define XFER_PIO 0x00 108 108 109 - static short ide_find_best_pio_mode(ide_drive_t *drive) 110 - { 111 - struct hd_driveid *id = drive->id; 112 - short best = 0; 113 - 114 - if (id->field_valid & 2) { /* EIDE PIO modes */ 115 - 116 - if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : 117 - (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : 118 - (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best; 119 - } 120 - 121 - return (drive->id->tPIO == 2) ? XFER_PIO_2 : 122 - (drive->id->tPIO == 1) ? XFER_PIO_1 : 123 - (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW; 124 - } 125 - 126 109 static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) 127 110 { 128 111 q->setup = EZ(t->setup * 1000, T); ··· 195 212 */ 196 213 197 214 if ((speed & XFER_MODE) != XFER_PIO) { 198 - ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT); 215 + u8 pio = ide_get_best_pio_mode(drive, 255, 5); 216 + ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT); 199 217 ide_timing_merge(&p, t, t, IDE_TIMING_ALL); 200 218 } 201 219
+4 -82
drivers/ide/ide.c
··· 16 16 * (usually 14 & 15). 17 17 * There can be up to two drives per interface, as per the ATA-2 spec. 18 18 * 19 - * Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64 20 - * Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64 21 - * Tertiary: ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64 22 - * Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64 23 19 * ... 24 20 * 25 21 * From hd.c: ··· 43 47 * This was a rewrite of just about everything from hd.c, though some original 44 48 * code is still sprinkled about. Think of it as a major evolution, with 45 49 * inspiration from lots of linux users, esp. hamish@zot.apana.org.au 46 - * 47 - * Version 1.0 ALPHA initial code, primary i/f working okay 48 - * Version 1.3 BETA dual i/f on shared irq tested & working! 49 - * Version 1.4 BETA added auto probing for irq(s) 50 - * Version 1.5 BETA added ALPHA (untested) support for IDE cd-roms, 51 - * ... 52 - * Version 5.50 allow values as small as 20 for idebus= 53 - * Version 5.51 force non io_32bit in drive_cmd_intr() 54 - * change delay_10ms() to delay_50ms() to fix problems 55 - * Version 5.52 fix incorrect invalidation of removable devices 56 - * add "hdx=slow" command line option 57 - * Version 5.60 start to modularize the driver; the disk and ATAPI 58 - * drivers can be compiled as loadable modules. 59 - * move IDE probe code to ide-probe.c 60 - * move IDE disk code to ide-disk.c 61 - * add support for generic IDE device subdrivers 62 - * add m68k code from Geert Uytterhoeven 63 - * probe all interfaces by default 64 - * add ioctl to (re)probe an interface 65 - * Version 6.00 use per device request queues 66 - * attempt to optimize shared hwgroup performance 67 - * add ioctl to manually adjust bandwidth algorithms 68 - * add kerneld support for the probe module 69 - * fix bug in ide_error() 70 - * fix bug in the first ide_get_lock() call for Atari 71 - * don't flush leftover data for ATAPI devices 72 - * Version 6.01 clear hwgroup->active while the hwgroup sleeps 73 - * support HDIO_GETGEO for floppies 74 - * Version 6.02 fix ide_ack_intr() call 75 - * check partition table on floppies 76 - * Version 6.03 handle bad status bit sequencing in ide_wait_stat() 77 - * Version 6.10 deleted old entries from this list of updates 78 - * replaced triton.c with ide-dma.c generic PCI DMA 79 - * added support for BIOS-enabled UltraDMA 80 - * rename all "promise" things to "pdc4030" 81 - * fix EZ-DRIVE handling on small disks 82 - * Version 6.11 fix probe error in ide_scan_devices() 83 - * fix ancient "jiffies" polling bugs 84 - * mask all hwgroup interrupts on each irq entry 85 - * Version 6.12 integrate ioctl and proc interfaces 86 - * fix parsing of "idex=" command line parameter 87 - * Version 6.13 add support for ide4/ide5 courtesy rjones@orchestream.com 88 - * Version 6.14 fixed IRQ sharing among PCI devices 89 - * Version 6.15 added SMP awareness to IDE drivers 90 - * Version 6.16 fixed various bugs; even more SMP friendly 91 - * Version 6.17 fix for newest EZ-Drive problem 92 - * Version 6.18 default unpartitioned-disk translation now "BIOS LBA" 93 - * Version 6.19 Re-design for a UNIFORM driver for all platforms, 94 - * model based on suggestions from Russell King and 95 - * Geert Uytterhoeven 96 - * Promise DC4030VL now supported. 97 - * add support for ide6/ide7 98 - * delay_50ms() changed to ide_delay_50ms() and exported. 99 - * Version 6.20 Added/Fixed Generic ATA-66 support and hwif detection. 100 - * Added hdx=flash to allow for second flash disk 101 - * detection w/o the hang loop. 102 - * Added support for ide8/ide9 103 - * Added idex=ata66 for the quirky chipsets that are 104 - * ATA-66 compliant, but have yet to determine a method 105 - * of verification of the 80c cable presence. 106 - * Specifically Promise's PDC20262 chipset. 107 - * Version 6.21 Fixing/Fixed SMP spinlock issue with insight from an old 108 - * hat that clarified original low level driver design. 109 - * Version 6.30 Added SMP support; fixed multmode issues. -ml 110 - * Version 6.31 Debug Share INTR's and request queue streaming 111 - * Native ATA-100 support 112 - * Prep for Cascades Project 113 - * Version 7.00alpha First named revision of ide rearrange 114 - * 115 - * Some additional driver compile-time options are in ./include/linux/ide.h 116 - * 117 - * To do, in likely order of completion: 118 - * - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f 119 - * 120 50 */ 121 51 122 52 #define REVISION "Revision: 7.00alpha2" ··· 376 454 hwif->major = tmp_hwif->major; 377 455 hwif->straight8 = tmp_hwif->straight8; 378 456 hwif->bus_state = tmp_hwif->bus_state; 457 + 458 + hwif->host_flags = tmp_hwif->host_flags; 459 + 460 + hwif->pio_mask = tmp_hwif->pio_mask; 379 461 380 462 hwif->atapi_dma = tmp_hwif->atapi_dma; 381 463 hwif->ultra_mask = tmp_hwif->ultra_mask; ··· 1096 1170 1097 1171 return 0; 1098 1172 } 1099 - 1100 - case CDROMEJECT: 1101 - case CDROMCLOSETRAY: 1102 - return scsi_cmd_ioctl(file, bdev->bd_disk->queue, bdev->bd_disk, cmd, p); 1103 1173 1104 1174 case HDIO_GET_BUSSTATE: 1105 1175 if (!capable(CAP_SYS_ADMIN))
+4 -3
drivers/ide/legacy/ali14xx.c
··· 115 115 int time1, time2; 116 116 u8 param1, param2, param3, param4; 117 117 unsigned long flags; 118 - ide_pio_data_t d; 119 118 int bus_speed = system_bus_clock(); 120 119 121 - pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, &d); 120 + pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO); 122 121 123 122 /* calculate timing, according to PIO mode */ 124 - time1 = d.cycle_time; 123 + time1 = ide_pio_cycle_time(drive, pio); 125 124 time2 = ide_pio_timings[pio].active_time; 126 125 param3 = param1 = (time2 * bus_speed + 999) / 1000; 127 126 param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1; ··· 211 212 mate = &ide_hwifs[1]; 212 213 213 214 hwif->chipset = ide_ali14xx; 215 + hwif->pio_mask = ATA_PIO4; 214 216 hwif->tuneproc = &ali14xx_tune_drive; 215 217 hwif->mate = mate; 216 218 217 219 mate->chipset = ide_ali14xx; 220 + mate->pio_mask = ATA_PIO4; 218 221 mate->tuneproc = &ali14xx_tune_drive; 219 222 mate->mate = hwif; 220 223 mate->channel = 1;
+2 -1
drivers/ide/legacy/dtc2278.c
··· 71 71 { 72 72 unsigned long flags; 73 73 74 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 74 + pio = ide_get_best_pio_mode(drive, pio, 4); 75 75 76 76 if (pio >= 3) { 77 77 spin_lock_irqsave(&ide_lock, flags); ··· 123 123 124 124 hwif->serialized = 1; 125 125 hwif->chipset = ide_dtc2278; 126 + hwif->pio_mask = ATA_PIO4; 126 127 hwif->tuneproc = &tune_dtc2278; 127 128 hwif->drives[0].no_unmask = 1; 128 129 hwif->drives[1].no_unmask = 1;
+8 -4
drivers/ide/legacy/ht6560b.c
··· 203 203 { 204 204 int active_time, recovery_time; 205 205 int active_cycles, recovery_cycles; 206 - ide_pio_data_t d; 207 206 int bus_speed = system_bus_clock(); 208 207 209 208 if (pio) { 210 - pio = ide_get_best_pio_mode(drive, pio, 5, &d); 211 - 209 + unsigned int cycle_time; 210 + 211 + pio = ide_get_best_pio_mode(drive, pio, 5); 212 + cycle_time = ide_pio_cycle_time(drive, pio); 213 + 212 214 /* 213 215 * Just like opti621.c we try to calculate the 214 216 * actual cycle time for recovery and activity 215 217 * according system bus speed. 216 218 */ 217 219 active_time = ide_pio_timings[pio].active_time; 218 - recovery_time = d.cycle_time 220 + recovery_time = cycle_time 219 221 - active_time 220 222 - ide_pio_timings[pio].setup_time; 221 223 /* ··· 333 331 334 332 hwif->chipset = ide_ht6560b; 335 333 hwif->selectproc = &ht6560b_selectproc; 334 + hwif->pio_mask = ATA_PIO5; 336 335 hwif->tuneproc = &tune_ht6560b; 337 336 hwif->serialized = 1; /* is this needed? */ 338 337 hwif->mate = mate; 339 338 340 339 mate->chipset = ide_ht6560b; 341 340 mate->selectproc = &ht6560b_selectproc; 341 + mate->pio_mask = ATA_PIO5; 342 342 mate->tuneproc = &tune_ht6560b; 343 343 mate->serialized = 1; /* is this needed? */ 344 344 mate->mate = hwif;
+1
drivers/ide/legacy/ide-cs.c
··· 386 386 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 387 387 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 388 388 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 389 + PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 389 390 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 390 391 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 391 392 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
+11 -10
drivers/ide/legacy/qd65xx.c
··· 252 252 253 253 static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) 254 254 { 255 - ide_pio_data_t d; 256 255 int base = HWIF(drive)->select_data; 256 + unsigned int cycle_time; 257 257 int active_time = 175; 258 258 int recovery_time = 415; /* worst case values from the dos driver */ 259 259 260 260 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { 261 - pio = ide_get_best_pio_mode(drive, pio, 4, &d); 261 + pio = ide_get_best_pio_mode(drive, pio, 4); 262 + cycle_time = ide_pio_cycle_time(drive, pio); 262 263 263 264 switch (pio) { 264 265 case 0: break; 265 266 case 3: 266 - if (d.cycle_time >= 110) { 267 + if (cycle_time >= 110) { 267 268 active_time = 86; 268 - recovery_time = d.cycle_time - 102; 269 + recovery_time = cycle_time - 102; 269 270 } else 270 271 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); 271 272 break; 272 273 case 4: 273 - if (d.cycle_time >= 69) { 274 + if (cycle_time >= 69) { 274 275 active_time = 70; 275 - recovery_time = d.cycle_time - 61; 276 + recovery_time = cycle_time - 61; 276 277 } else 277 278 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); 278 279 break; 279 280 default: 280 - if (d.cycle_time >= 180) { 281 + if (cycle_time >= 180) { 281 282 active_time = 110; 282 - recovery_time = d.cycle_time - 120; 283 + recovery_time = cycle_time - 120; 283 284 } else { 284 285 active_time = ide_pio_timings[pio].active_time; 285 - recovery_time = d.cycle_time 286 - -active_time; 286 + recovery_time = cycle_time - active_time; 287 287 } 288 288 } 289 289 printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); ··· 346 346 hwif->drives[1].drive_data = data1; 347 347 hwif->drives[0].io_32bit = 348 348 hwif->drives[1].io_32bit = 1; 349 + hwif->pio_mask = ATA_PIO4; 349 350 hwif->tuneproc = tuneproc; 350 351 probe_hwif_init(hwif); 351 352 }
+3 -1
drivers/ide/legacy/umc8672.c
··· 110 110 unsigned long flags; 111 111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup; 112 112 113 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 113 + pio = ide_get_best_pio_mode(drive, pio, 4); 114 114 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", 115 115 drive->name, pio, pio_to_umc[pio]); 116 116 spin_lock_irqsave(&ide_lock, flags); ··· 149 149 mate = &ide_hwifs[1]; 150 150 151 151 hwif->chipset = ide_umc8672; 152 + hwif->pio_mask = ATA_PIO4; 152 153 hwif->tuneproc = &tune_umc; 153 154 hwif->mate = mate; 154 155 155 156 mate->chipset = ide_umc8672; 157 + mate->pio_mask = ATA_PIO4; 156 158 mate->tuneproc = &tune_umc; 157 159 mate->mate = hwif; 158 160 mate->channel = 1;
+3 -1
drivers/ide/mips/au1xxx-ide.c
··· 106 106 u8 speed; 107 107 108 108 /* get the best pio mode for the drive */ 109 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 109 + pio = ide_get_best_pio_mode(drive, pio, 4); 110 110 111 111 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n", 112 112 drive->name, pio); ··· 691 691 hwif->mwdma_mask = 0x0; 692 692 hwif->swdma_mask = 0x0; 693 693 #endif 694 + 695 + hwif->pio_mask = ATA_PIO4; 694 696 695 697 hwif->noprobe = 0; 696 698 hwif->drives[0].unmask = 1;
+6 -12
drivers/ide/pci/aec62xx.c
··· 142 142 143 143 static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) 144 144 { 145 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 145 + pio = ide_get_best_pio_mode(drive, pio, 4); 146 146 (void) HWIF(drive)->speedproc(drive, pio + XFER_PIO_0); 147 147 } 148 148 ··· 173 173 static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 174 174 { 175 175 int bus_speed = system_bus_clock(); 176 - 177 - if (dev->resource[PCI_ROM_RESOURCE].start) { 178 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 179 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, 180 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 181 - } 182 176 183 177 if (bus_speed <= 33) 184 178 pci_set_drvdata(dev, (void *) aec6xxx_33_base); ··· 265 271 .init_setup = init_setup_aec62xx, 266 272 .init_chipset = init_chipset_aec62xx, 267 273 .init_hwif = init_hwif_aec62xx, 268 - .channels = 2, 269 274 .autodma = AUTODMA, 270 275 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 271 276 .bootable = OFF_BOARD, 277 + .pio_mask = ATA_PIO4, 272 278 .udma_mask = 0x07, /* udma0-2 */ 273 279 },{ /* 1 */ 274 280 .name = "AEC6260", 275 281 .init_setup = init_setup_aec62xx, 276 282 .init_chipset = init_chipset_aec62xx, 277 283 .init_hwif = init_hwif_aec62xx, 278 - .channels = 2, 279 284 .autodma = NOAUTODMA, 280 285 .bootable = OFF_BOARD, 286 + .pio_mask = ATA_PIO4, 281 287 .udma_mask = 0x1f, /* udma0-4 */ 282 288 },{ /* 2 */ 283 289 .name = "AEC6260R", 284 290 .init_setup = init_setup_aec62xx, 285 291 .init_chipset = init_chipset_aec62xx, 286 292 .init_hwif = init_hwif_aec62xx, 287 - .channels = 2, 288 293 .autodma = AUTODMA, 289 294 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 290 295 .bootable = NEVER_BOARD, 296 + .pio_mask = ATA_PIO4, 291 297 .udma_mask = 0x1f, /* udma0-4 */ 292 298 },{ /* 3 */ 293 299 .name = "AEC6280", 294 300 .init_setup = init_setup_aec6x80, 295 301 .init_chipset = init_chipset_aec62xx, 296 302 .init_hwif = init_hwif_aec62xx, 297 - .channels = 2, 298 303 .autodma = AUTODMA, 299 304 .bootable = OFF_BOARD, 305 + .pio_mask = ATA_PIO4, 300 306 .udma_mask = 0x3f, /* udma0-5 */ 301 307 },{ /* 4 */ 302 308 .name = "AEC6280R", 303 309 .init_setup = init_setup_aec6x80, 304 310 .init_chipset = init_chipset_aec62xx, 305 311 .init_hwif = init_hwif_aec62xx, 306 - .channels = 2, 307 312 .autodma = AUTODMA, 308 313 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 309 314 .bootable = OFF_BOARD, 315 + .pio_mask = ATA_PIO4, 310 316 .udma_mask = 0x3f, /* udma0-5 */ 311 317 } 312 318 };
+2 -3
drivers/ide/pci/alim15x3.c
··· 295 295 296 296 static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) 297 297 { 298 - ide_pio_data_t d; 299 298 ide_hwif_t *hwif = HWIF(drive); 300 299 struct pci_dev *dev = hwif->pci_dev; 301 300 int s_time, a_time, c_time; ··· 306 307 u8 cd_dma_fifo = 0; 307 308 int unit = drive->select.b.unit & 1; 308 309 309 - pio = ide_get_best_pio_mode(drive, pio, 5, &d); 310 + pio = ide_get_best_pio_mode(drive, pio, 5); 310 311 s_time = ide_pio_timings[pio].setup_time; 311 312 a_time = ide_pio_timings[pio].active_time; 312 313 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) ··· 816 817 .init_chipset = init_chipset_ali15x3, 817 818 .init_hwif = init_hwif_ali15x3, 818 819 .init_dma = init_dma_ali15x3, 819 - .channels = 2, 820 820 .autodma = AUTODMA, 821 821 .bootable = ON_BOARD, 822 + .pio_mask = ATA_PIO5, 822 823 }; 823 824 824 825 /**
+14 -10
drivers/ide/pci/amd74xx.c
··· 1 1 /* 2 - * Version 2.20 2 + * Version 2.21 3 3 * 4 4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 5 5 * IDE driver for Linux. ··· 272 272 273 273 static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) 274 274 { 275 - if (pio == 255) { 276 - amd_set_drive(drive, ide_find_best_pio_mode(drive)); 277 - return; 278 - } 275 + if (pio == 255) 276 + pio = ide_get_best_pio_mode(drive, 255, 5); 279 277 280 278 amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5)); 281 279 } ··· 282 284 { 283 285 u8 speed = ide_max_dma_mode(drive); 284 286 285 - if (speed == 0) 286 - speed = ide_find_best_pio_mode(drive); 287 + if (speed == 0) { 288 + amd74xx_tune_drive(drive, 255); 289 + return -1; 290 + } 287 291 288 292 amd_set_drive(drive, speed); 289 293 290 - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 294 + if (drive->autodma) 291 295 return 0; 292 296 293 297 return -1; ··· 448 448 .name = name_str, \ 449 449 .init_chipset = init_chipset_amd74xx, \ 450 450 .init_hwif = init_hwif_amd74xx, \ 451 - .channels = 2, \ 452 451 .autodma = AUTODMA, \ 453 452 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 454 453 .bootable = ON_BOARD, \ 454 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ 455 + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ 456 + .pio_mask = ATA_PIO5, \ 455 457 } 456 458 457 459 #define DECLARE_NV_DEV(name_str) \ ··· 461 459 .name = name_str, \ 462 460 .init_chipset = init_chipset_amd74xx, \ 463 461 .init_hwif = init_hwif_amd74xx, \ 464 - .channels = 2, \ 465 462 .autodma = AUTODMA, \ 466 463 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 467 464 .bootable = ON_BOARD, \ 465 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ 466 + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ 467 + .pio_mask = ATA_PIO5, \ 468 468 } 469 469 470 470 static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
+22 -15
drivers/ide/pci/atiixp.c
··· 1 1 /* 2 - * linux/drivers/ide/pci/atiixp.c Version 0.01-bart2 Feb. 26, 2004 2 + * linux/drivers/ide/pci/atiixp.c Version 0.02 Jun 16 2007 3 3 * 4 4 * Copyright (C) 2003 ATI Inc. <hyu@ati.com> 5 - * Copyright (C) 2004 Bartlomiej Zolnierkiewicz 6 - * 5 + * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz 7 6 */ 8 7 9 8 #include <linux/types.h> ··· 122 123 } 123 124 124 125 /** 125 - * atiixp_tune_drive - tune a drive attached to a ATIIXP 126 + * atiixp_tune_pio - tune a drive attached to a ATIIXP 126 127 * @drive: drive to tune 127 128 * @pio: desired PIO mode 128 129 * 129 130 * Set the interface PIO mode. 130 131 */ 131 132 132 - static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) 133 + static void atiixp_tune_pio(ide_drive_t *drive, u8 pio) 133 134 { 134 135 struct pci_dev *dev = drive->hwif->pci_dev; 135 136 unsigned long flags; ··· 153 154 spin_unlock_irqrestore(&atiixp_lock, flags); 154 155 } 155 156 157 + static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) 158 + { 159 + pio = ide_get_best_pio_mode(drive, pio, 4); 160 + atiixp_tune_pio(drive, pio); 161 + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 162 + } 163 + 156 164 /** 157 165 * atiixp_tune_chipset - tune a ATIIXP interface 158 166 * @drive: IDE drive to tune ··· 180 174 u8 speed, pio; 181 175 182 176 speed = ide_rate_filter(drive, xferspeed); 177 + 178 + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { 179 + atiixp_tune_pio(drive, speed - XFER_PIO_0); 180 + return ide_config_drive_speed(drive, speed); 181 + } 183 182 184 183 spin_lock_irqsave(&atiixp_lock, flags); 185 184 ··· 212 201 else 213 202 pio = speed - XFER_PIO_0; 214 203 215 - atiixp_tuneproc(drive, pio); 204 + atiixp_tune_pio(drive, pio); 216 205 217 206 return ide_config_drive_speed(drive, speed); 218 207 } ··· 227 216 228 217 static int atiixp_dma_check(ide_drive_t *drive) 229 218 { 230 - u8 tspeed, speed; 231 - 232 219 drive->init_speed = 0; 233 220 234 221 if (ide_tune_dma(drive)) 235 222 return 0; 236 223 237 - if (ide_use_fast_pio(drive)) { 238 - tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); 239 - speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; 240 - atiixp_speedproc(drive, speed); 241 - } 224 + if (ide_use_fast_pio(drive)) 225 + atiixp_tuneproc(drive, 255); 242 226 243 227 return -1; 244 228 } ··· 291 285 { /* 0 */ 292 286 .name = "ATIIXP", 293 287 .init_hwif = init_hwif_atiixp, 294 - .channels = 2, 295 288 .autodma = AUTODMA, 296 289 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 297 290 .bootable = ON_BOARD, 291 + .pio_mask = ATA_PIO4, 298 292 },{ /* 1 */ 299 293 .name = "SB600_PATA", 300 294 .init_hwif = init_hwif_atiixp, 301 - .channels = 1, 302 295 .autodma = AUTODMA, 303 296 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, 304 297 .bootable = ON_BOARD, 298 + .host_flags = IDE_HFLAG_SINGLE, 299 + .pio_mask = ATA_PIO4, 305 300 }, 306 301 }; 307 302
+9 -10
drivers/ide/pci/cmd640.c
··· 633 633 */ 634 634 static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) 635 635 { 636 + unsigned int index = 0, cycle_time; 636 637 u8 b; 637 - ide_pio_data_t d; 638 - unsigned int index = 0; 639 638 640 639 while (drive != cmd_drives[index]) { 641 640 if (++index > 3) { ··· 661 662 return; 662 663 } 663 664 664 - (void) ide_get_best_pio_mode (drive, mode_wanted, 5, &d); 665 - cmd640_set_mode (index, d.pio_mode, d.cycle_time); 665 + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5); 666 + cycle_time = ide_pio_cycle_time(drive, mode_wanted); 667 + cmd640_set_mode(index, mode_wanted, cycle_time); 666 668 667 - printk ("%s: selected cmd640 PIO mode%d (%dns)%s", 668 - drive->name, 669 - d.pio_mode, 670 - d.cycle_time, 671 - d.overridden ? " (overriding vendor mode)" : ""); 669 + printk("%s: selected cmd640 PIO mode%d (%dns)", 670 + drive->name, mode_wanted, cycle_time); 671 + 672 672 display_clocks(index); 673 - return; 674 673 } 675 674 676 675 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ ··· 766 769 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); 767 770 cmd_hwif0->chipset = ide_cmd640; 768 771 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 772 + cmd_hwif0->pio_mask = ATA_PIO5; 769 773 cmd_hwif0->tuneproc = &cmd640_tune_drive; 770 774 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 771 775 ··· 822 824 cmd_hwif1->mate = cmd_hwif0; 823 825 cmd_hwif1->channel = 1; 824 826 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 827 + cmd_hwif1->pio_mask = ATA_PIO5; 825 828 cmd_hwif1->tuneproc = &cmd640_tune_drive; 826 829 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 827 830 }
+11 -10
drivers/ide/pci/cmd64x.c
··· 221 221 { 222 222 ide_hwif_t *hwif = HWIF(drive); 223 223 struct pci_dev *dev = hwif->pci_dev; 224 - ide_pio_data_t pio; 224 + unsigned int cycle_time; 225 225 u8 pio_mode, setup_count, arttim = 0; 226 226 static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; 227 227 static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; 228 - pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); 229 228 230 - cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)%s\n", 231 - drive->name, mode_wanted, pio_mode, pio.cycle_time, 232 - pio.overridden ? " (overriding vendor mode)" : ""); 229 + pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5); 230 + cycle_time = ide_pio_cycle_time(drive, pio_mode); 233 231 234 - program_cycle_times(drive, pio.cycle_time, 232 + cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", 233 + drive->name, mode_wanted, pio_mode, cycle_time); 234 + 235 + program_cycle_times(drive, cycle_time, 235 236 ide_pio_timings[pio_mode].active_time); 236 237 237 238 setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time, ··· 619 618 .init_setup = init_setup_cmd64x, 620 619 .init_chipset = init_chipset_cmd64x, 621 620 .init_hwif = init_hwif_cmd64x, 622 - .channels = 2, 623 621 .autodma = AUTODMA, 624 622 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 625 623 .bootable = ON_BOARD, 624 + .pio_mask = ATA_PIO5, 626 625 .udma_mask = 0x00, /* no udma */ 627 626 },{ /* 1 */ 628 627 .name = "CMD646", 629 628 .init_setup = init_setup_cmd646, 630 629 .init_chipset = init_chipset_cmd64x, 631 630 .init_hwif = init_hwif_cmd64x, 632 - .channels = 2, 633 631 .autodma = AUTODMA, 634 632 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 635 633 .bootable = ON_BOARD, 634 + .pio_mask = ATA_PIO5, 636 635 .udma_mask = 0x07, /* udma0-2 */ 637 636 },{ /* 2 */ 638 637 .name = "CMD648", 639 638 .init_setup = init_setup_cmd64x, 640 639 .init_chipset = init_chipset_cmd64x, 641 640 .init_hwif = init_hwif_cmd64x, 642 - .channels = 2, 643 641 .autodma = AUTODMA, 644 642 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 645 643 .bootable = ON_BOARD, 644 + .pio_mask = ATA_PIO5, 646 645 .udma_mask = 0x1f, /* udma0-4 */ 647 646 },{ /* 3 */ 648 647 .name = "CMD649", 649 648 .init_setup = init_setup_cmd64x, 650 649 .init_chipset = init_chipset_cmd64x, 651 650 .init_hwif = init_hwif_cmd64x, 652 - .channels = 2, 653 651 .autodma = AUTODMA, 654 652 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 655 653 .bootable = ON_BOARD, 654 + .pio_mask = ATA_PIO5, 656 655 .udma_mask = 0x3f, /* udma0-5 */ 657 656 } 658 657 };
+3 -3
drivers/ide/pci/cs5520.c
··· 126 126 127 127 static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) 128 128 { 129 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 129 + pio = ide_get_best_pio_mode(drive, pio, 4); 130 130 cs5520_tune_chipset(drive, (XFER_PIO_0 + pio)); 131 131 } 132 132 ··· 194 194 .name = name_str, \ 195 195 .init_setup_dma = cs5520_init_setup_dma, \ 196 196 .init_hwif = init_hwif_cs5520, \ 197 - .channels = 2, \ 198 197 .autodma = AUTODMA, \ 199 198 .bootable = ON_BOARD, \ 200 - .flags = IDEPCI_FLAG_ISA_PORTS, \ 199 + .host_flags = IDE_HFLAG_ISA_PORTS, \ 200 + .pio_mask = ATA_PIO4, \ 201 201 } 202 202 203 203 static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
+2 -2
drivers/ide/pci/cs5530.c
··· 82 82 83 83 static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */ 84 84 { 85 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 85 + pio = ide_get_best_pio_mode(drive, pio, 4); 86 86 87 87 if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) 88 88 cs5530_tunepio(drive, pio); ··· 341 341 .name = "CS5530", 342 342 .init_chipset = init_chipset_cs5530, 343 343 .init_hwif = init_hwif_cs5530, 344 - .channels = 2, 345 344 .autodma = AUTODMA, 346 345 .bootable = ON_BOARD, 346 + .pio_mask = ATA_PIO4, 347 347 }; 348 348 349 349 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+5 -4
drivers/ide/pci/cs5535.c
··· 89 89 90 90 pioa = speed - XFER_PIO_0; 91 91 piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), 92 - 255, 4, NULL); 92 + 255, 4); 93 93 cmd = pioa < piob ? pioa : piob; 94 94 95 95 /* Write the speed of the current drive */ ··· 159 159 /* cs5535 max pio is pio 4, best_pio will check the blacklist. 160 160 i think we don't need to rate_filter the incoming xferspeed 161 161 since we know we're only going to choose pio */ 162 - xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4, NULL); 162 + xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4); 163 163 ide_config_drive_speed(drive, modes[xferspeed]); 164 164 cs5535_set_speed(drive, xferspeed); 165 165 } ··· 174 174 return 0; 175 175 176 176 if (ide_use_fast_pio(drive)) { 177 - speed = ide_get_best_pio_mode(drive, 255, 4, NULL); 177 + speed = ide_get_best_pio_mode(drive, 255, 4); 178 178 cs5535_set_drive(drive, speed); 179 179 } 180 180 ··· 228 228 static ide_pci_device_t cs5535_chipset __devinitdata = { 229 229 .name = "CS5535", 230 230 .init_hwif = init_hwif_cs5535, 231 - .channels = 1, 232 231 .autodma = AUTODMA, 233 232 .bootable = ON_BOARD, 233 + .host_flags = IDE_HFLAG_SINGLE, 234 + .pio_mask = ATA_PIO4, 234 235 }; 235 236 236 237 static int __devinit cs5535_init_one(struct pci_dev *dev,
+3 -2
drivers/ide/pci/cy82c693.c
··· 330 330 #endif /* CY82C693_DEBUG_LOGS */ 331 331 332 332 /* first let's calc the pio modes */ 333 - pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO, NULL); 333 + pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO); 334 334 335 335 #if CY82C693_DEBUG_INFO 336 336 printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio); ··· 483 483 .init_chipset = init_chipset_cy82c693, 484 484 .init_iops = init_iops_cy82c693, 485 485 .init_hwif = init_hwif_cy82c693, 486 - .channels = 1, 487 486 .autodma = AUTODMA, 488 487 .bootable = ON_BOARD, 488 + .host_flags = IDE_HFLAG_SINGLE, 489 + .pio_mask = ATA_PIO4, 489 490 }; 490 491 491 492 static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
-15
drivers/ide/pci/generic.c
··· 95 95 { /* 0 */ 96 96 .name = "Unknown", 97 97 .init_hwif = init_hwif_generic, 98 - .channels = 2, 99 98 .autodma = AUTODMA, 100 99 .bootable = ON_BOARD, 101 100 },{ /* 1 */ 102 101 .name = "NS87410", 103 102 .init_hwif = init_hwif_generic, 104 - .channels = 2, 105 103 .autodma = AUTODMA, 106 104 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 107 105 .bootable = ON_BOARD, 108 106 },{ /* 2 */ 109 107 .name = "SAMURAI", 110 108 .init_hwif = init_hwif_generic, 111 - .channels = 2, 112 109 .autodma = AUTODMA, 113 110 .bootable = ON_BOARD, 114 111 },{ /* 3 */ 115 112 .name = "HT6565", 116 113 .init_hwif = init_hwif_generic, 117 - .channels = 2, 118 114 .autodma = AUTODMA, 119 115 .bootable = ON_BOARD, 120 116 },{ /* 4 */ 121 117 .name = "UM8673F", 122 118 .init_hwif = init_hwif_generic, 123 - .channels = 2, 124 119 .autodma = NODMA, 125 120 .bootable = ON_BOARD, 126 121 },{ /* 5 */ 127 122 .name = "UM8886A", 128 123 .init_hwif = init_hwif_generic, 129 - .channels = 2, 130 124 .autodma = NODMA, 131 125 .bootable = ON_BOARD, 132 126 },{ /* 6 */ 133 127 .name = "UM8886BF", 134 128 .init_hwif = init_hwif_generic, 135 - .channels = 2, 136 129 .autodma = NODMA, 137 130 .bootable = ON_BOARD, 138 131 },{ /* 7 */ 139 132 .name = "HINT_IDE", 140 133 .init_hwif = init_hwif_generic, 141 - .channels = 2, 142 134 .autodma = AUTODMA, 143 135 .bootable = ON_BOARD, 144 136 },{ /* 8 */ 145 137 .name = "VIA_IDE", 146 138 .init_hwif = init_hwif_generic, 147 - .channels = 2, 148 139 .autodma = NOAUTODMA, 149 140 .bootable = ON_BOARD, 150 141 },{ /* 9 */ 151 142 .name = "OPTI621V", 152 143 .init_hwif = init_hwif_generic, 153 - .channels = 2, 154 144 .autodma = NOAUTODMA, 155 145 .bootable = ON_BOARD, 156 146 },{ /* 10 */ 157 147 .name = "VIA8237SATA", 158 148 .init_hwif = init_hwif_generic, 159 - .channels = 2, 160 149 .autodma = AUTODMA, 161 150 .bootable = OFF_BOARD, 162 151 },{ /* 11 */ 163 152 .name = "Piccolo0102", 164 153 .init_hwif = init_hwif_generic, 165 - .channels = 2, 166 154 .autodma = NOAUTODMA, 167 155 .bootable = ON_BOARD, 168 156 },{ /* 12 */ 169 157 .name = "Piccolo0103", 170 158 .init_hwif = init_hwif_generic, 171 - .channels = 2, 172 159 .autodma = NOAUTODMA, 173 160 .bootable = ON_BOARD, 174 161 },{ /* 13 */ 175 162 .name = "Piccolo0105", 176 163 .init_hwif = init_hwif_generic, 177 - .channels = 2, 178 164 .autodma = NOAUTODMA, 179 165 .bootable = ON_BOARD, 180 166 },{ /* 14 */ 181 167 .name = "Revolution", 182 168 .init_hwif = init_hwif_generic, 183 - .channels = 2, 184 169 .autodma = AUTODMA, 185 170 .bootable = OFF_BOARD, 186 171 }
+5 -12
drivers/ide/pci/hpt34x.c
··· 80 80 81 81 static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) 82 82 { 83 - pio = ide_get_best_pio_mode(drive, pio, 5, NULL); 83 + pio = ide_get_best_pio_mode(drive, pio, 5); 84 84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); 85 85 } 86 86 ··· 120 120 pci_write_config_byte(dev, HPT34X_PCI_INIT_REG, 0x00); 121 121 pci_read_config_word(dev, PCI_COMMAND, &cmd); 122 122 123 - if (cmd & PCI_COMMAND_MEMORY) { 124 - if (pci_resource_start(dev, PCI_ROM_RESOURCE)) { 125 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 126 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 127 - printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n", 128 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 129 - } 123 + if (cmd & PCI_COMMAND_MEMORY) 130 124 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0); 131 - } else { 125 + else 132 126 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 133 - } 134 127 135 128 /* 136 129 * Since 20-23 can be assigned and are R/W, we correct them. ··· 175 182 .name = "HPT34X", 176 183 .init_chipset = init_chipset_hpt34x, 177 184 .init_hwif = init_hwif_hpt34x, 178 - .channels = 2, 179 185 .autodma = NOAUTODMA, 180 186 .bootable = NEVER_BOARD, 181 - .extra = 16 187 + .extra = 16, 188 + .pio_mask = ATA_PIO5, 182 189 }; 183 190 184 191 static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+14 -22
drivers/ide/pci/hpt366.c
··· 652 652 653 653 static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio) 654 654 { 655 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 655 + pio = ide_get_best_pio_mode(drive, pio, 4); 656 656 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); 657 657 } 658 658 ··· 993 993 * to just allocated per-chip hpt_info structure. 994 994 */ 995 995 *info = *(struct hpt_info *)pci_get_drvdata(dev); 996 - 997 - /* 998 - * FIXME: Not portable. Also, why do we enable the ROM in the first place? 999 - * We don't seem to be using it. 1000 - */ 1001 - if (dev->resource[PCI_ROM_RESOURCE].start) 1002 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 1003 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 1004 996 1005 997 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); 1006 998 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); ··· 1483 1491 * to both functions -- really stupid design decision... :-( 1484 1492 * Bit 4 is for the primary channel, bit 5 for the secondary. 1485 1493 */ 1486 - d->channels = 1; 1494 + d->host_flags |= IDE_HFLAG_SINGLE; 1487 1495 d->enablebits[0].mask = d->enablebits[0].val = 0x10; 1488 1496 1489 1497 d->udma_mask = HPT366_ALLOW_ATA66_3 ? ··· 1546 1554 .init_chipset = init_chipset_hpt366, 1547 1555 .init_hwif = init_hwif_hpt366, 1548 1556 .init_dma = init_dma_hpt366, 1549 - .channels = 2, 1550 1557 .autodma = AUTODMA, 1551 1558 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1552 1559 .bootable = OFF_BOARD, 1553 - .extra = 240 1560 + .extra = 240, 1561 + .pio_mask = ATA_PIO4, 1554 1562 },{ /* 1 */ 1555 1563 .name = "HPT372A", 1556 1564 .init_setup = init_setup_hpt372a, 1557 1565 .init_chipset = init_chipset_hpt366, 1558 1566 .init_hwif = init_hwif_hpt366, 1559 1567 .init_dma = init_dma_hpt366, 1560 - .channels = 2, 1561 1568 .autodma = AUTODMA, 1562 1569 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1563 1570 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1564 1571 .bootable = OFF_BOARD, 1565 - .extra = 240 1572 + .extra = 240, 1573 + .pio_mask = ATA_PIO4, 1566 1574 },{ /* 2 */ 1567 1575 .name = "HPT302", 1568 1576 .init_setup = init_setup_hpt302, 1569 1577 .init_chipset = init_chipset_hpt366, 1570 1578 .init_hwif = init_hwif_hpt366, 1571 1579 .init_dma = init_dma_hpt366, 1572 - .channels = 2, 1573 1580 .autodma = AUTODMA, 1574 1581 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1575 1582 .udma_mask = HPT302_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1576 1583 .bootable = OFF_BOARD, 1577 - .extra = 240 1584 + .extra = 240, 1585 + .pio_mask = ATA_PIO4, 1578 1586 },{ /* 3 */ 1579 1587 .name = "HPT371", 1580 1588 .init_setup = init_setup_hpt371, 1581 1589 .init_chipset = init_chipset_hpt366, 1582 1590 .init_hwif = init_hwif_hpt366, 1583 1591 .init_dma = init_dma_hpt366, 1584 - .channels = 2, 1585 1592 .autodma = AUTODMA, 1586 1593 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1587 1594 .udma_mask = HPT371_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1588 1595 .bootable = OFF_BOARD, 1589 - .extra = 240 1596 + .extra = 240, 1597 + .pio_mask = ATA_PIO4, 1590 1598 },{ /* 4 */ 1591 1599 .name = "HPT374", 1592 1600 .init_setup = init_setup_hpt374, 1593 1601 .init_chipset = init_chipset_hpt366, 1594 1602 .init_hwif = init_hwif_hpt366, 1595 1603 .init_dma = init_dma_hpt366, 1596 - .channels = 2, /* 4 */ 1597 1604 .autodma = AUTODMA, 1598 1605 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1599 1606 .udma_mask = 0x3f, 1600 1607 .bootable = OFF_BOARD, 1601 - .extra = 240 1608 + .extra = 240, 1609 + .pio_mask = ATA_PIO4, 1602 1610 },{ /* 5 */ 1603 1611 .name = "HPT372N", 1604 1612 .init_setup = init_setup_hpt372n, 1605 1613 .init_chipset = init_chipset_hpt366, 1606 1614 .init_hwif = init_hwif_hpt366, 1607 1615 .init_dma = init_dma_hpt366, 1608 - .channels = 2, /* 4 */ 1609 1616 .autodma = AUTODMA, 1610 1617 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1611 1618 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1612 1619 .bootable = OFF_BOARD, 1613 - .extra = 240 1620 + .extra = 240, 1621 + .pio_mask = ATA_PIO4, 1614 1622 } 1615 1623 }; 1616 1624
+4 -3
drivers/ide/pci/it8213.c
··· 82 82 { 2, 1 }, 83 83 { 2, 3 }, }; 84 84 85 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 85 + pio = ide_get_best_pio_mode(drive, pio, 4); 86 86 87 87 spin_lock_irqsave(&tune_lock, flags); 88 88 pci_read_config_word(dev, master_port, &master_data); ··· 214 214 if (ide_tune_dma(drive)) 215 215 return 0; 216 216 217 - pio = ide_get_best_pio_mode(drive, 255, 4, NULL); 217 + pio = ide_get_best_pio_mode(drive, 255, 4); 218 218 it8213_tune_chipset(drive, XFER_PIO_0 + pio); 219 219 220 220 return -1; ··· 272 272 { \ 273 273 .name = name_str, \ 274 274 .init_hwif = init_hwif_it8213, \ 275 - .channels = 1, \ 276 275 .autodma = AUTODMA, \ 277 276 .enablebits = {{0x41,0x80,0x80}}, \ 278 277 .bootable = ON_BOARD, \ 278 + .host_flags = IDE_HFLAG_SINGLE, \ 279 + .pio_mask = ATA_PIO4, \ 279 280 } 280 281 281 282 static ide_pci_device_t it8213_chipsets[] __devinitdata = {
+4 -4
drivers/ide/pci/it821x.c
··· 255 255 * on the cable. 256 256 */ 257 257 if (pair) { 258 - u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); 258 + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); 259 259 /* trim PIO to the slowest of the master/slave */ 260 260 if (pair_pio < set_pio) 261 261 set_pio = pair_pio; ··· 276 276 277 277 static void it821x_tuneproc(ide_drive_t *drive, u8 pio) 278 278 { 279 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 279 + pio = ide_get_best_pio_mode(drive, pio, 4); 280 280 (void)it821x_tunepio(drive, pio); 281 281 } 282 282 ··· 718 718 .name = name_str, \ 719 719 .init_chipset = init_chipset_it821x, \ 720 720 .init_hwif = init_hwif_it821x, \ 721 - .channels = 2, \ 722 721 .autodma = AUTODMA, \ 723 722 .bootable = ON_BOARD, \ 724 - .fixup = it821x_fixups \ 723 + .fixup = it821x_fixups, \ 724 + .pio_mask = ATA_PIO4, \ 725 725 } 726 726 727 727 static ide_pci_device_t it821x_chipsets[] __devinitdata = {
+2 -2
drivers/ide/pci/jmicron.c
··· 97 97 98 98 static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) 99 99 { 100 - u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL); 100 + u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5); 101 101 if (set_speed) 102 102 (void) ide_config_drive_speed(drive, speed); 103 103 } ··· 177 177 { \ 178 178 .name = name_str, \ 179 179 .init_hwif = init_hwif_jmicron, \ 180 - .channels = 2, \ 181 180 .autodma = AUTODMA, \ 182 181 .bootable = ON_BOARD, \ 183 182 .enablebits = { {0x40, 1, 1}, {0x40, 0x10, 0x10} }, \ 183 + .pio_mask = ATA_PIO5, \ 184 184 } 185 185 186 186 static ide_pci_device_t jmicron_chipsets[] __devinitdata = {
-1
drivers/ide/pci/ns87415.c
··· 281 281 .init_iops = init_iops_ns87415, 282 282 #endif 283 283 .init_hwif = init_hwif_ns87415, 284 - .channels = 2, 285 284 .autodma = AUTODMA, 286 285 .bootable = ON_BOARD, 287 286 };
+4 -4
drivers/ide/pci/opti621.c
··· 147 147 int d; 148 148 ide_hwif_t *hwif = HWIF(drive); 149 149 150 - drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO, NULL); 150 + drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO); 151 151 for (d = 0; d < 2; ++d) { 152 152 drive = &hwif->drives[d]; 153 153 if (drive->present) { 154 154 if (drive->drive_data == PIO_DONT_KNOW) 155 - drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO, NULL); 155 + drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO); 156 156 #ifdef OPTI621_DEBUG 157 157 printk("%s: Selected PIO mode %d\n", 158 158 drive->name, drive->drive_data); ··· 350 350 { /* 0 */ 351 351 .name = "OPTI621", 352 352 .init_hwif = init_hwif_opti621, 353 - .channels = 2, 354 353 .autodma = AUTODMA, 355 354 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 356 355 .bootable = ON_BOARD, 356 + .pio_mask = ATA_PIO3, 357 357 },{ /* 1 */ 358 358 .name = "OPTI621X", 359 359 .init_hwif = init_hwif_opti621, 360 - .channels = 2, 361 360 .autodma = AUTODMA, 362 361 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 363 362 .bootable = ON_BOARD, 363 + .pio_mask = ATA_PIO3, 364 364 } 365 365 }; 366 366
+8 -15
drivers/ide/pci/pdc202xx_new.c
··· 219 219 220 220 static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio) 221 221 { 222 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 222 + pio = ide_get_best_pio_mode(drive, pio, 4); 223 223 (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio); 224 224 } 225 225 ··· 377 377 long pll_input, pll_output, ratio; 378 378 int f, r; 379 379 u8 pll_ctl0, pll_ctl1; 380 - 381 - if (dev->resource[PCI_ROM_RESOURCE].start) { 382 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 383 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 384 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, 385 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 386 - } 387 380 388 381 #ifdef CONFIG_PPC_PMAC 389 382 apple_kiwi_init(dev); ··· 566 573 .init_setup = init_setup_pdcnew, 567 574 .init_chipset = init_chipset_pdcnew, 568 575 .init_hwif = init_hwif_pdc202new, 569 - .channels = 2, 570 576 .autodma = AUTODMA, 571 577 .bootable = OFF_BOARD, 578 + .pio_mask = ATA_PIO4, 572 579 .udma_mask = 0x3f, /* udma0-5 */ 573 580 },{ /* 1 */ 574 581 .name = "PDC20269", 575 582 .init_setup = init_setup_pdcnew, 576 583 .init_chipset = init_chipset_pdcnew, 577 584 .init_hwif = init_hwif_pdc202new, 578 - .channels = 2, 579 585 .autodma = AUTODMA, 580 586 .bootable = OFF_BOARD, 587 + .pio_mask = ATA_PIO4, 581 588 .udma_mask = 0x7f, /* udma0-6*/ 582 589 },{ /* 2 */ 583 590 .name = "PDC20270", 584 591 .init_setup = init_setup_pdc20270, 585 592 .init_chipset = init_chipset_pdcnew, 586 593 .init_hwif = init_hwif_pdc202new, 587 - .channels = 2, 588 594 .autodma = AUTODMA, 589 595 .bootable = OFF_BOARD, 596 + .pio_mask = ATA_PIO4, 590 597 .udma_mask = 0x3f, /* udma0-5 */ 591 598 },{ /* 3 */ 592 599 .name = "PDC20271", 593 600 .init_setup = init_setup_pdcnew, 594 601 .init_chipset = init_chipset_pdcnew, 595 602 .init_hwif = init_hwif_pdc202new, 596 - .channels = 2, 597 603 .autodma = AUTODMA, 598 604 .bootable = OFF_BOARD, 605 + .pio_mask = ATA_PIO4, 599 606 .udma_mask = 0x7f, /* udma0-6*/ 600 607 },{ /* 4 */ 601 608 .name = "PDC20275", 602 609 .init_setup = init_setup_pdcnew, 603 610 .init_chipset = init_chipset_pdcnew, 604 611 .init_hwif = init_hwif_pdc202new, 605 - .channels = 2, 606 612 .autodma = AUTODMA, 607 613 .bootable = OFF_BOARD, 614 + .pio_mask = ATA_PIO4, 608 615 .udma_mask = 0x7f, /* udma0-6*/ 609 616 },{ /* 5 */ 610 617 .name = "PDC20276", 611 618 .init_setup = init_setup_pdc20276, 612 619 .init_chipset = init_chipset_pdcnew, 613 620 .init_hwif = init_hwif_pdc202new, 614 - .channels = 2, 615 621 .autodma = AUTODMA, 616 622 .bootable = OFF_BOARD, 623 + .pio_mask = ATA_PIO4, 617 624 .udma_mask = 0x7f, /* udma0-6*/ 618 625 },{ /* 6 */ 619 626 .name = "PDC20277", 620 627 .init_setup = init_setup_pdcnew, 621 628 .init_chipset = init_chipset_pdcnew, 622 629 .init_hwif = init_hwif_pdc202new, 623 - .channels = 2, 624 630 .autodma = AUTODMA, 625 631 .bootable = OFF_BOARD, 632 + .pio_mask = ATA_PIO4, 626 633 .udma_mask = 0x7f, /* udma0-6*/ 627 634 } 628 635 };
+6 -14
drivers/ide/pci/pdc202xx_old.c
··· 145 145 146 146 static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio) 147 147 { 148 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 148 + pio = ide_get_best_pio_mode(drive, pio, 4); 149 149 pdc202xx_tune_chipset(drive, XFER_PIO_0 + pio); 150 150 } 151 151 ··· 316 316 static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 317 317 const char *name) 318 318 { 319 - /* This doesn't appear needed */ 320 - if (dev->resource[PCI_ROM_RESOURCE].start) { 321 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 322 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 323 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, 324 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 325 - } 326 - 327 319 return dev->irq; 328 320 } 329 321 ··· 441 449 .init_chipset = init_chipset_pdc202xx, 442 450 .init_hwif = init_hwif_pdc202xx, 443 451 .init_dma = init_dma_pdc202xx, 444 - .channels = 2, 445 452 .autodma = AUTODMA, 446 453 .bootable = OFF_BOARD, 447 454 .extra = 16, 455 + .pio_mask = ATA_PIO4, 448 456 .udma_mask = 0x07, /* udma0-2 */ 449 457 },{ /* 1 */ 450 458 .name = "PDC20262", ··· 452 460 .init_chipset = init_chipset_pdc202xx, 453 461 .init_hwif = init_hwif_pdc202xx, 454 462 .init_dma = init_dma_pdc202xx, 455 - .channels = 2, 456 463 .autodma = AUTODMA, 457 464 .bootable = OFF_BOARD, 458 465 .extra = 48, 466 + .pio_mask = ATA_PIO4, 459 467 .udma_mask = 0x1f, /* udma0-4 */ 460 468 },{ /* 2 */ 461 469 .name = "PDC20263", ··· 463 471 .init_chipset = init_chipset_pdc202xx, 464 472 .init_hwif = init_hwif_pdc202xx, 465 473 .init_dma = init_dma_pdc202xx, 466 - .channels = 2, 467 474 .autodma = AUTODMA, 468 475 .bootable = OFF_BOARD, 469 476 .extra = 48, 477 + .pio_mask = ATA_PIO4, 470 478 .udma_mask = 0x1f, /* udma0-4 */ 471 479 },{ /* 3 */ 472 480 .name = "PDC20265", ··· 474 482 .init_chipset = init_chipset_pdc202xx, 475 483 .init_hwif = init_hwif_pdc202xx, 476 484 .init_dma = init_dma_pdc202xx, 477 - .channels = 2, 478 485 .autodma = AUTODMA, 479 486 .bootable = OFF_BOARD, 480 487 .extra = 48, 488 + .pio_mask = ATA_PIO4, 481 489 .udma_mask = 0x3f, /* udma0-5 */ 482 490 },{ /* 4 */ 483 491 .name = "PDC20267", ··· 485 493 .init_chipset = init_chipset_pdc202xx, 486 494 .init_hwif = init_hwif_pdc202xx, 487 495 .init_dma = init_dma_pdc202xx, 488 - .channels = 2, 489 496 .autodma = AUTODMA, 490 497 .bootable = OFF_BOARD, 491 498 .extra = 48, 499 + .pio_mask = ATA_PIO4, 492 500 .udma_mask = 0x3f, /* udma0-5 */ 493 501 } 494 502 };
+4 -4
drivers/ide/pci/piix.c
··· 219 219 */ 220 220 static void piix_tune_drive (ide_drive_t *drive, u8 pio) 221 221 { 222 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 222 + pio = ide_get_best_pio_mode(drive, pio, 4); 223 223 piix_tune_pio(drive, pio); 224 224 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 225 225 } ··· 495 495 .name = name_str, \ 496 496 .init_chipset = init_chipset_piix, \ 497 497 .init_hwif = init_hwif_piix, \ 498 - .channels = 2, \ 499 498 .autodma = AUTODMA, \ 500 499 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 501 500 .bootable = ON_BOARD, \ 501 + .pio_mask = ATA_PIO4, \ 502 502 .udma_mask = udma, \ 503 503 } 504 504 ··· 514 514 */ 515 515 .name = "MPIIX", 516 516 .init_hwif = init_hwif_piix, 517 - .channels = 2, 518 517 .autodma = NODMA, 519 518 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, 520 519 .bootable = ON_BOARD, 521 - .flags = IDEPCI_FLAG_ISA_PORTS 520 + .host_flags = IDE_HFLAG_ISA_PORTS, 521 + .pio_mask = ATA_PIO4, 522 522 }, 523 523 524 524 /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */
-1
drivers/ide/pci/rz1000.c
··· 52 52 static ide_pci_device_t rz1000_chipset __devinitdata = { 53 53 .name = "RZ100x", 54 54 .init_hwif = init_hwif_rz1000, 55 - .channels = 2, 56 55 .autodma = NODMA, 57 56 .bootable = ON_BOARD, 58 57 };
+4 -39
drivers/ide/pci/sc1200.c
··· 1 1 /* 2 - * linux/drivers/ide/pci/sc1200.c Version 0.94 Mar 10 2007 2 + * linux/drivers/ide/pci/sc1200.c Version 0.95 Jun 16 2007 3 3 * 4 4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> 5 5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz ··· 304 304 return; 305 305 } 306 306 307 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 307 + pio = ide_get_best_pio_mode(drive, pio, 4); 308 308 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio); 309 309 310 310 if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) ··· 390 390 // loop over all interfaces that are part of this pci device: 391 391 // 392 392 while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { 393 - unsigned int basereg, r, d, format; 393 + unsigned int basereg, r; 394 394 sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; 395 395 396 396 // ··· 400 400 if (ss != NULL) { 401 401 for (r = 0; r < 4; ++r) { 402 402 pci_write_config_dword(hwif->pci_dev, basereg + (r<<2), ss->regs[r]); 403 - } 404 - } 405 - // 406 - // Re-program drive PIO modes 407 - // 408 - pci_read_config_dword(hwif->pci_dev, basereg+4, &format); 409 - format = (format >> 31) & 1; 410 - if (format) 411 - format += sc1200_get_pci_clock(); 412 - for (d = 0; d < 2; ++d) { 413 - ide_drive_t *drive = &(hwif->drives[d]); 414 - if (drive->present) { 415 - unsigned int pio, timings; 416 - pci_read_config_dword(hwif->pci_dev, basereg+(drive->select.b.unit << 3), &timings); 417 - for (pio = 0; pio <= 4; ++pio) { 418 - if (sc1200_pio_timings[format][pio] == timings) 419 - break; 420 - } 421 - if (pio > 4) 422 - pio = 255; /* autotune */ 423 - (void)sc1200_tuneproc(drive, pio); 424 - } 425 - } 426 - // 427 - // Re-program drive DMA modes 428 - // 429 - for (d = 0; d < MAX_DRIVES; ++d) { 430 - ide_drive_t *drive = &(hwif->drives[d]); 431 - if (drive->present && !__ide_dma_bad_drive(drive)) { 432 - int enable_dma = drive->using_dma; 433 - hwif->dma_off_quietly(drive); 434 - if (sc1200_config_dma(drive)) 435 - enable_dma = 0; 436 - if (enable_dma) 437 - hwif->dma_host_on(drive); 438 403 } 439 404 } 440 405 } ··· 436 471 static ide_pci_device_t sc1200_chipset __devinitdata = { 437 472 .name = "SC1200", 438 473 .init_hwif = init_hwif_sc1200, 439 - .channels = 2, 440 474 .autodma = AUTODMA, 441 475 .bootable = ON_BOARD, 476 + .pio_mask = ATA_PIO4, 442 477 }; 443 478 444 479 static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+59 -17
drivers/ide/pci/scc_pata.c
··· 165 165 ide_hwif_t *hwif = HWIF(drive); 166 166 167 167 out_be32((void*)port, addr); 168 - __asm__ __volatile__("eieio":::"memory"); 168 + eieio(); 169 169 in_be32((void*)(hwif->dma_base + 0x01c)); 170 - __asm__ __volatile__("eieio":::"memory"); 170 + eieio(); 171 171 } 172 172 173 173 static void ··· 210 210 unsigned char speed = XFER_PIO_0; 211 211 int offset; 212 212 213 - mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4, NULL); 213 + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4); 214 214 switch (mode_wanted) { 215 215 case 4: 216 216 speed = XFER_PIO_4; ··· 401 401 ide_hwif_t *hwif = HWIF(drive); 402 402 unsigned long intsts_port = hwif->dma_base + 0x014; 403 403 u32 reg; 404 + int dma_stat, data_loss = 0; 405 + static int retry = 0; 406 + 407 + /* errata A308 workaround: Step5 (check data loss) */ 408 + /* We don't check non ide_disk because it is limited to UDMA4 */ 409 + if (!(in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && 410 + drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) { 411 + reg = in_be32((void __iomem *)intsts_port); 412 + if (!(reg & INTSTS_ACTEINT)) { 413 + printk(KERN_WARNING "%s: operation failed (transfer data loss)\n", 414 + drive->name); 415 + data_loss = 1; 416 + if (retry++) { 417 + struct request *rq = HWGROUP(drive)->rq; 418 + int unit; 419 + /* ERROR_RESET and drive->crc_count are needed 420 + * to reduce DMA transfer mode in retry process. 421 + */ 422 + if (rq) 423 + rq->errors |= ERROR_RESET; 424 + for (unit = 0; unit < MAX_DRIVES; unit++) { 425 + ide_drive_t *drive = &hwif->drives[unit]; 426 + drive->crc_count++; 427 + } 428 + } 429 + } 430 + } 404 431 405 432 while (1) { 406 433 reg = in_be32((void __iomem *)intsts_port); ··· 496 469 break; 497 470 } 498 471 499 - return __ide_dma_end(drive); 472 + dma_stat = __ide_dma_end(drive); 473 + if (data_loss) 474 + dma_stat |= 2; /* emulate DMA error (to retry command) */ 475 + return dma_stat; 500 476 } 501 477 502 478 /* returns 1 if dma irq issued, 0 otherwise */ 503 479 static int scc_dma_test_irq(ide_drive_t *drive) 504 480 { 505 - ide_hwif_t *hwif = HWIF(drive); 506 - u8 dma_stat = hwif->INB(hwif->dma_status); 481 + ide_hwif_t *hwif = HWIF(drive); 482 + u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014); 507 483 508 - /* return 1 if INTR asserted */ 509 - if ((dma_stat & 4) == 4) 484 + /* SCC errata A252,A308 workaround: Step4 */ 485 + if ((in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && 486 + (int_stat & INTSTS_INTRQ)) 510 487 return 1; 511 488 512 - /* Workaround for PTERADD: emulate DMA_INTR when 513 - * - IDE_STATUS[ERR] = 1 514 - * - INT_STATUS[INTRQ] = 1 515 - * - DMA_STATUS[IORACTA] = 1 516 - */ 517 - if (in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT && 518 - in_be32((void __iomem *)(hwif->dma_base + 0x014)) & INTSTS_INTRQ && 519 - dma_stat & 1) 489 + /* SCC errata A308 workaround: Step5 (polling IOIRQS) */ 490 + if (int_stat & INTSTS_IOIRQS) 520 491 return 1; 521 492 522 493 if (!drive->waiting_for_dma) 523 494 printk(KERN_WARNING "%s: (%s) called while not waiting\n", 524 495 drive->name, __FUNCTION__); 525 496 return 0; 497 + } 498 + 499 + static u8 scc_udma_filter(ide_drive_t *drive) 500 + { 501 + ide_hwif_t *hwif = drive->hwif; 502 + u8 mask = hwif->ultra_mask; 503 + 504 + /* errata A308 workaround: limit non ide_disk drive to UDMA4 */ 505 + if ((drive->media != ide_disk) && (mask & 0xE0)) { 506 + printk(KERN_INFO "%s: limit %s to UDMA4\n", 507 + SCC_PATA_NAME, drive->name); 508 + mask = 0x1F; 509 + } 510 + 511 + return mask; 526 512 } 527 513 528 514 /** ··· 742 702 hwif->tuneproc = scc_tuneproc; 743 703 hwif->ide_dma_check = scc_config_drive_for_dma; 744 704 hwif->ide_dma_test_irq = scc_dma_test_irq; 705 + hwif->udma_filter = scc_udma_filter; 745 706 746 707 hwif->drives[0].autotune = IDE_TUNE_AUTO; 747 708 hwif->drives[1].autotune = IDE_TUNE_AUTO; ··· 772 731 .init_setup = init_setup_scc, \ 773 732 .init_iops = init_iops_scc, \ 774 733 .init_hwif = init_hwif_scc, \ 775 - .channels = 1, \ 776 734 .autodma = AUTODMA, \ 777 735 .bootable = ON_BOARD, \ 736 + .host_flags = IDE_HFLAG_SINGLE, \ 737 + .pio_mask = ATA_PIO4, \ 778 738 } 779 739 780 740 static ide_pci_device_t scc_chipsets[] __devinitdata = {
+51 -54
drivers/ide/pci/serverworks.c
··· 1 1 /* 2 - * linux/drivers/ide/pci/serverworks.c Version 0.20 Jun 3 2007 2 + * linux/drivers/ide/pci/serverworks.c Version 0.22 Jun 27 2007 3 3 * 4 4 * Copyright (C) 1998-2000 Michel Aubry 5 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz ··· 123 123 } 124 124 return 0; 125 125 } 126 + 127 + static void svwks_tune_pio(ide_drive_t *drive, const u8 pio) 128 + { 129 + static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 130 + static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 131 + 132 + struct pci_dev *dev = drive->hwif->pci_dev; 133 + 134 + pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); 135 + 136 + if (svwks_csb_check(dev)) { 137 + u16 csb_pio = 0; 138 + 139 + pci_read_config_word(dev, 0x4a, &csb_pio); 140 + 141 + csb_pio &= ~(0x0f << (4 * drive->dn)); 142 + csb_pio |= (pio << (4 * drive->dn)); 143 + 144 + pci_write_config_word(dev, 0x4a, csb_pio); 145 + } 146 + } 147 + 126 148 static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) 127 149 { 128 150 static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 129 151 static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 130 - static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 131 - static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 132 152 static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 133 153 134 154 ide_hwif_t *hwif = HWIF(drive); 135 155 struct pci_dev *dev = hwif->pci_dev; 136 156 u8 speed = ide_rate_filter(drive, xferspeed); 137 - u8 pio = ide_get_best_pio_mode(drive, 255, 4, NULL); 138 157 u8 unit = (drive->select.b.unit & 0x01); 139 - u8 csb5 = svwks_csb_check(dev); 140 - u8 ultra_enable = 0, ultra_timing = 0; 141 - u8 dma_timing = 0, pio_timing = 0; 142 - u16 csb5_pio = 0; 158 + 159 + u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; 160 + 161 + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { 162 + svwks_tune_pio(drive, speed - XFER_PIO_0); 163 + return ide_config_drive_speed(drive, speed); 164 + } 143 165 144 166 /* If we are about to put a disk into UDMA mode we screwed up. 145 167 Our code assumes we never _ever_ do this on an OSB4 */ ··· 171 149 BUG(); 172 150 173 151 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); 174 - pci_read_config_word(dev, 0x4A, &csb5_pio); 175 152 pci_read_config_byte(dev, 0x54, &ultra_enable); 176 153 177 154 ultra_timing &= ~(0x0F << (4*unit)); 178 155 ultra_enable &= ~(0x01 << drive->dn); 179 - csb5_pio &= ~(0x0F << (4*drive->dn)); 180 156 181 157 switch(speed) { 182 - case XFER_PIO_4: 183 - case XFER_PIO_3: 184 - case XFER_PIO_2: 185 - case XFER_PIO_1: 186 - case XFER_PIO_0: 187 - pio_timing |= pio_modes[speed - XFER_PIO_0]; 188 - csb5_pio |= ((speed - XFER_PIO_0) << (4*drive->dn)); 189 - break; 190 - 191 158 case XFER_MW_DMA_2: 192 159 case XFER_MW_DMA_1: 193 160 case XFER_MW_DMA_0: 194 - /* 195 - * TODO: always setup PIO mode so this won't be needed 196 - */ 197 - pio_timing |= pio_modes[pio]; 198 - csb5_pio |= (pio << (4*drive->dn)); 199 161 dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; 200 162 break; 201 163 ··· 189 183 case XFER_UDMA_2: 190 184 case XFER_UDMA_1: 191 185 case XFER_UDMA_0: 192 - /* 193 - * TODO: always setup PIO mode so this won't be needed 194 - */ 195 - pio_timing |= pio_modes[pio]; 196 - csb5_pio |= (pio << (4*drive->dn)); 197 186 dma_timing |= dma_modes[2]; 198 187 ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit)); 199 188 ultra_enable |= (0x01 << drive->dn); 200 189 default: 201 190 break; 202 191 } 203 - 204 - pci_write_config_byte(dev, drive_pci[drive->dn], pio_timing); 205 - if (csb5) 206 - pci_write_config_word(dev, 0x4A, csb5_pio); 207 192 208 193 pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing); 209 194 pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing); ··· 205 208 206 209 static void svwks_tune_drive (ide_drive_t *drive, u8 pio) 207 210 { 208 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 209 - (void)svwks_tune_chipset(drive, XFER_PIO_0 + pio); 211 + pio = ide_get_best_pio_mode(drive, pio, 4); 212 + svwks_tune_pio(drive, pio); 213 + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 210 214 } 211 215 212 216 static int svwks_config_drive_xfer_rate (ide_drive_t *drive) ··· 387 389 388 390 static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 389 391 { 390 - u8 dma_stat = 0; 391 - 392 392 if (!hwif->irq) 393 393 hwif->irq = hwif->channel ? 15 : 14; 394 394 ··· 403 407 404 408 hwif->autodma = 0; 405 409 406 - if (!hwif->dma_base) { 407 - hwif->drives[0].autotune = 1; 408 - hwif->drives[1].autotune = 1; 410 + hwif->drives[0].autotune = 1; 411 + hwif->drives[1].autotune = 1; 412 + 413 + if (!hwif->dma_base) 409 414 return; 410 - } 411 415 412 416 hwif->ide_dma_check = &svwks_config_drive_xfer_rate; 413 417 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { ··· 417 421 if (!noautodma) 418 422 hwif->autodma = 1; 419 423 420 - dma_stat = inb(hwif->dma_status); 421 - hwif->drives[0].autodma = (dma_stat & 0x20); 422 - hwif->drives[1].autodma = (dma_stat & 0x40); 423 - hwif->drives[0].autotune = (!(dma_stat & 0x20)); 424 - hwif->drives[1].autotune = (!(dma_stat & 0x40)); 424 + hwif->drives[0].autodma = hwif->drives[1].autodma = 1; 425 425 } 426 426 427 427 static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) ··· 433 441 d->bootable = ON_BOARD; 434 442 } 435 443 436 - d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 437 - dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && 438 - (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2; 444 + if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 445 + dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && 446 + (!(PCI_FUNC(dev->devfn) & 1))) 447 + d->host_flags |= IDE_HFLAG_SINGLE; 448 + else 449 + d->host_flags &= ~IDE_HFLAG_SINGLE; 439 450 440 451 return ide_setup_pci_device(dev, d); 441 452 } ··· 449 454 .init_setup = init_setup_svwks, 450 455 .init_chipset = init_chipset_svwks, 451 456 .init_hwif = init_hwif_svwks, 452 - .channels = 2, 453 457 .autodma = AUTODMA, 454 458 .bootable = ON_BOARD, 459 + .pio_mask = ATA_PIO4, 455 460 },{ /* 1 */ 456 461 .name = "SvrWks CSB5", 457 462 .init_setup = init_setup_svwks, 458 463 .init_chipset = init_chipset_svwks, 459 464 .init_hwif = init_hwif_svwks, 460 - .channels = 2, 461 465 .autodma = AUTODMA, 462 466 .bootable = ON_BOARD, 467 + .pio_mask = ATA_PIO4, 463 468 },{ /* 2 */ 464 469 .name = "SvrWks CSB6", 465 470 .init_setup = init_setup_csb6, 466 471 .init_chipset = init_chipset_svwks, 467 472 .init_hwif = init_hwif_svwks, 468 - .channels = 2, 469 473 .autodma = AUTODMA, 470 474 .bootable = ON_BOARD, 475 + .pio_mask = ATA_PIO4, 471 476 },{ /* 3 */ 472 477 .name = "SvrWks CSB6", 473 478 .init_setup = init_setup_csb6, 474 479 .init_chipset = init_chipset_svwks, 475 480 .init_hwif = init_hwif_svwks, 476 - .channels = 1, /* 2 */ 477 481 .autodma = AUTODMA, 478 482 .bootable = ON_BOARD, 483 + .host_flags = IDE_HFLAG_SINGLE, 484 + .pio_mask = ATA_PIO4, 479 485 },{ /* 4 */ 480 486 .name = "SvrWks HT1000", 481 487 .init_setup = init_setup_svwks, 482 488 .init_chipset = init_chipset_svwks, 483 489 .init_hwif = init_hwif_svwks, 484 - .channels = 1, /* 2 */ 485 490 .autodma = AUTODMA, 486 491 .bootable = ON_BOARD, 492 + .host_flags = IDE_HFLAG_SINGLE, 493 + .pio_mask = ATA_PIO4, 487 494 } 488 495 }; 489 496
+2 -1
drivers/ide/pci/sgiioc4.c
··· 586 586 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ 587 587 hwif->mwdma_mask = 0x2; /* Multimode-2 DMA */ 588 588 hwif->swdma_mask = 0x2; 589 + hwif->pio_mask = 0x00; 589 590 hwif->tuneproc = NULL; /* Sets timing for PIO mode */ 590 591 hwif->speedproc = NULL; /* Sets timing for DMA &/or PIO modes */ 591 592 hwif->selectproc = NULL;/* Use the default routine to select drive */ ··· 725 724 .name = "SGIIOC4", 726 725 .init_hwif = ide_init_sgiioc4, 727 726 .init_dma = ide_dma_sgiioc4, 728 - .channels = 1, 729 727 .autodma = AUTODMA, 730 728 /* SGI IOC4 doesn't have enablebits. */ 731 729 .bootable = ON_BOARD, 730 + .host_flags = IDE_HFLAG_SINGLE, 732 731 }; 733 732 734 733 int
+40 -99
drivers/ide/pci/siimage.c
··· 1 1 /* 2 - * linux/drivers/ide/pci/siimage.c Version 1.12 Mar 10 2007 2 + * linux/drivers/ide/pci/siimage.c Version 1.15 Jun 29 2007 3 3 * 4 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 5 5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 6 6 * Copyright (C) 2007 MontaVista Software, Inc. 7 + * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 7 8 * 8 9 * May be copied or modified under the terms of the GNU General Public License 9 10 * ··· 32 31 * unplugging/replugging the virtual CD interface when the DRAC is reset. 33 32 * This often causes drivers/ide/siimage to panic but is ok with the rather 34 33 * smarter code in libata. 34 + * 35 + * TODO: 36 + * - IORDY fixes 37 + * - VDMA support 35 38 */ 36 39 37 40 #include <linux/types.h> ··· 165 160 } 166 161 167 162 /** 168 - * siimage_taskfile_timing - turn timing data to a mode 169 - * @hwif: interface to query 170 - * 171 - * Read the timing data for the interface and return the 172 - * mode that is being used. 173 - */ 174 - 175 - static byte siimage_taskfile_timing (ide_hwif_t *hwif) 176 - { 177 - u16 timing = 0x328a; 178 - unsigned long addr = siimage_selreg(hwif, 2); 179 - 180 - if (hwif->mmio) 181 - timing = hwif->INW(addr); 182 - else 183 - pci_read_config_word(hwif->pci_dev, addr, &timing); 184 - 185 - switch (timing) { 186 - case 0x10c1: return 4; 187 - case 0x10c3: return 3; 188 - case 0x1104: 189 - case 0x1281: return 2; 190 - case 0x2283: return 1; 191 - case 0x328a: 192 - default: return 0; 193 - } 194 - } 195 - 196 - /** 197 - * simmage_tuneproc - tune a drive 163 + * sil_tune_pio - tune a drive 198 164 * @drive: drive to tune 199 - * @mode_wanted: the target operating mode 165 + * @pio: the desired PIO mode 200 166 * 201 167 * Load the timing settings for this device mode into the 202 168 * controller. If we are in PIO mode 3 or 4 turn on IORDY 203 169 * monitoring (bit 9). The TF timing is bits 31:16 204 170 */ 205 - 206 - static void siimage_tuneproc (ide_drive_t *drive, byte mode_wanted) 171 + 172 + static void sil_tune_pio(ide_drive_t *drive, u8 pio) 207 173 { 174 + const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 }; 175 + const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 176 + 208 177 ide_hwif_t *hwif = HWIF(drive); 178 + ide_drive_t *pair = &hwif->drives[drive->dn ^ 1]; 209 179 u32 speedt = 0; 210 180 u16 speedp = 0; 211 181 unsigned long addr = siimage_seldev(drive, 0x04); 212 182 unsigned long tfaddr = siimage_selreg(hwif, 0x02); 213 - 214 - /* cheat for now and use the docs */ 215 - switch (mode_wanted) { 216 - case 4: 217 - speedp = 0x10c1; 218 - speedt = 0x10c1; 219 - break; 220 - case 3: 221 - speedp = 0x10c3; 222 - speedt = 0x10c3; 223 - break; 224 - case 2: 225 - speedp = 0x1104; 226 - speedt = 0x1281; 227 - break; 228 - case 1: 229 - speedp = 0x2283; 230 - speedt = 0x2283; 231 - break; 232 - case 0: 233 - default: 234 - speedp = 0x328a; 235 - speedt = 0x328a; 236 - break; 183 + u8 tf_pio = pio; 184 + 185 + /* trim *taskfile* PIO to the slowest of the master/slave */ 186 + if (pair->present) { 187 + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); 188 + 189 + if (pair_pio < tf_pio) 190 + tf_pio = pair_pio; 237 191 } 192 + 193 + /* cheat for now and use the docs */ 194 + speedp = data_speed[pio]; 195 + speedt = tf_speed[tf_pio]; 238 196 239 197 if (hwif->mmio) { 240 198 hwif->OUTW(speedp, addr); 241 199 hwif->OUTW(speedt, tfaddr); 242 200 /* Now set up IORDY */ 243 - if(mode_wanted == 3 || mode_wanted == 4) 201 + if (pio > 2) 244 202 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2); 245 203 else 246 204 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2); ··· 213 245 pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); 214 246 speedp &= ~0x200; 215 247 /* Set IORDY for mode 3 or 4 */ 216 - if(mode_wanted == 3 || mode_wanted == 4) 248 + if (pio > 2) 217 249 speedp |= 0x200; 218 250 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); 219 251 } 220 252 } 221 253 222 - /** 223 - * config_siimage_chipset_for_pio - set drive timings 224 - * @drive: drive to tune 225 - * @speed we want 226 - * 227 - * Compute the best pio mode we can for a given device. Also honour 228 - * the timings for the driver when dealing with mixed devices. Some 229 - * of this is ugly but its all wrapped up here 230 - * 231 - * The SI680 can also do VDMA - we need to start using that 232 - * 233 - * FIXME: we use the BIOS channel timings to avoid driving the task 234 - * files too fast at the disk. We need to compute the master/slave 235 - * drive PIO mode properly so that we can up the speed on a hotplug 236 - * system. 237 - */ 238 - 239 - static void config_siimage_chipset_for_pio (ide_drive_t *drive, byte set_speed) 254 + static void sil_tuneproc(ide_drive_t *drive, u8 pio) 240 255 { 241 - u8 channel_timings = siimage_taskfile_timing(HWIF(drive)); 242 - u8 speed = 0, set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL); 243 - 244 - /* WARNING PIO timing mess is going to happen b/w devices, argh */ 245 - if ((channel_timings != set_pio) && (set_pio > channel_timings)) 246 - set_pio = channel_timings; 247 - 248 - siimage_tuneproc(drive, set_pio); 249 - speed = XFER_PIO_0 + set_pio; 250 - if (set_speed) 251 - (void) ide_config_drive_speed(drive, speed); 256 + pio = ide_get_best_pio_mode(drive, pio, 4); 257 + sil_tune_pio(drive, pio); 258 + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 252 259 } 253 260 254 261 /** ··· 278 335 case XFER_PIO_2: 279 336 case XFER_PIO_1: 280 337 case XFER_PIO_0: 281 - siimage_tuneproc(drive, (speed - XFER_PIO_0)); 338 + sil_tune_pio(drive, speed - XFER_PIO_0); 282 339 mode |= ((unit) ? 0x10 : 0x01); 283 340 break; 284 341 case XFER_MW_DMA_2: ··· 286 343 case XFER_MW_DMA_0: 287 344 multi = dma[speed - XFER_MW_DMA_0]; 288 345 mode |= ((unit) ? 0x20 : 0x02); 289 - config_siimage_chipset_for_pio(drive, 0); 290 346 break; 291 347 case XFER_UDMA_6: 292 348 case XFER_UDMA_5: ··· 298 356 ultra |= ((scsc) ? (ultra6[speed - XFER_UDMA_0]) : 299 357 (ultra5[speed - XFER_UDMA_0])); 300 358 mode |= ((unit) ? 0x30 : 0x03); 301 - config_siimage_chipset_for_pio(drive, 0); 302 359 break; 303 360 default: 304 361 return 1; ··· 331 390 return 0; 332 391 333 392 if (ide_use_fast_pio(drive)) 334 - config_siimage_chipset_for_pio(drive, 1); 393 + sil_tuneproc(drive, 255); 335 394 336 395 return -1; 337 396 } ··· 902 961 903 962 hwif->resetproc = &siimage_reset; 904 963 hwif->speedproc = &siimage_tune_chipset; 905 - hwif->tuneproc = &siimage_tuneproc; 964 + hwif->tuneproc = &sil_tuneproc; 906 965 hwif->reset_poll = &siimage_reset_poll; 907 966 hwif->pre_reset = &siimage_pre_reset; 908 967 hwif->udma_filter = &sil_udma_filter; ··· 917 976 first = 0; 918 977 } 919 978 } 920 - if (!hwif->dma_base) { 921 - hwif->drives[0].autotune = 1; 922 - hwif->drives[1].autotune = 1; 979 + 980 + hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 981 + 982 + if (hwif->dma_base == 0) 923 983 return; 924 - } 925 984 926 985 hwif->ultra_mask = 0x7f; 927 986 hwif->mwdma_mask = 0x07; ··· 957 1016 .init_iops = init_iops_siimage, \ 958 1017 .init_hwif = init_hwif_siimage, \ 959 1018 .fixup = siimage_fixup, \ 960 - .channels = 2, \ 961 1019 .autodma = AUTODMA, \ 962 1020 .bootable = ON_BOARD, \ 1021 + .pio_mask = ATA_PIO4, \ 963 1022 } 964 1023 965 1024 static ide_pci_device_t siimage_chipsets[] __devinitdata = {
+2 -2
drivers/ide/pci/sis5513.c
··· 521 521 522 522 static int sis5513_tune_drive(ide_drive_t *drive, u8 pio) 523 523 { 524 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 524 + pio = ide_get_best_pio_mode(drive, pio, 4); 525 525 config_art_rwp_pio(drive, pio); 526 526 return ide_config_drive_speed(drive, XFER_PIO_0 + pio); 527 527 } ··· 878 878 .name = "SIS5513", 879 879 .init_chipset = init_chipset_sis5513, 880 880 .init_hwif = init_hwif_sis5513, 881 - .channels = 2, 882 881 .autodma = NOAUTODMA, 883 882 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 884 883 .bootable = ON_BOARD, 884 + .pio_mask = ATA_PIO4, 885 885 }; 886 886 887 887 static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+13 -9
drivers/ide/pci/sl82c105.c
··· 52 52 * Convert a PIO mode and cycle time to the required on/off times 53 53 * for the interface. This has protection against runaway timings. 54 54 */ 55 - static unsigned int get_pio_timings(ide_pio_data_t *p) 55 + static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) 56 56 { 57 57 unsigned int cmd_on, cmd_off; 58 + u8 iordy = 0; 58 59 59 - cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; 60 - cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; 60 + cmd_on = (ide_pio_timings[pio].active_time + 29) / 30; 61 + cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30; 61 62 62 63 if (cmd_on == 0) 63 64 cmd_on = 1; ··· 66 65 if (cmd_off == 0) 67 66 cmd_off = 1; 68 67 69 - return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); 68 + if (pio > 2 || ide_dev_has_iordy(drive->id)) 69 + iordy = 0x40; 70 + 71 + return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; 70 72 } 71 73 72 74 /* ··· 79 75 { 80 76 struct pci_dev *dev = HWIF(drive)->pci_dev; 81 77 int reg = 0x44 + drive->dn * 4; 82 - ide_pio_data_t p; 83 78 u16 drv_ctrl; 84 79 85 80 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); 86 81 87 - pio = ide_get_best_pio_mode(drive, pio, 5, &p); 82 + pio = ide_get_best_pio_mode(drive, pio, 5); 88 83 89 - drv_ctrl = get_pio_timings(&p); 84 + drv_ctrl = get_pio_timings(drive, pio); 90 85 91 86 /* 92 87 * Store the PIO timings so that we can restore them ··· 104 101 } 105 102 106 103 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, 107 - ide_xfer_verbose(pio + XFER_PIO_0), p.cycle_time, drv_ctrl); 104 + ide_xfer_verbose(pio + XFER_PIO_0), 105 + ide_pio_cycle_time(drive, pio), drv_ctrl); 108 106 109 107 return pio; 110 108 } ··· 453 449 .name = "W82C105", 454 450 .init_chipset = init_chipset_sl82c105, 455 451 .init_hwif = init_hwif_sl82c105, 456 - .channels = 2, 457 452 .autodma = NOAUTODMA, 458 453 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 459 454 .bootable = ON_BOARD, 455 + .pio_mask = ATA_PIO5, 460 456 }; 461 457 462 458 static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+2 -2
drivers/ide/pci/slc90e66.c
··· 103 103 104 104 static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) 105 105 { 106 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 106 + pio = ide_get_best_pio_mode(drive, pio, 4); 107 107 slc90e66_tune_pio(drive, pio); 108 108 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 109 109 } ··· 214 214 static ide_pci_device_t slc90e66_chipset __devinitdata = { 215 215 .name = "SLC90E66", 216 216 .init_hwif = init_hwif_slc90e66, 217 - .channels = 2, 218 217 .autodma = AUTODMA, 219 218 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 220 219 .bootable = ON_BOARD, 220 + .pio_mask = ATA_PIO4, 221 221 }; 222 222 223 223 static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+4 -3
drivers/ide/pci/tc86c001.c
··· 47 47 48 48 static void tc86c001_tune_drive(ide_drive_t *drive, u8 pio) 49 49 { 50 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 50 + pio = ide_get_best_pio_mode(drive, pio, 4); 51 51 (void) tc86c001_tune_chipset(drive, XFER_PIO_0 + pio); 52 52 } 53 53 ··· 248 248 .name = "TC86C001", 249 249 .init_chipset = init_chipset_tc86c001, 250 250 .init_hwif = init_hwif_tc86c001, 251 - .channels = 1, 252 251 .autodma = AUTODMA, 253 - .bootable = OFF_BOARD 252 + .bootable = OFF_BOARD, 253 + .host_flags = IDE_HFLAG_SINGLE, 254 + .pio_mask = ATA_PIO4, 254 255 }; 255 256 256 257 static int __devinit tc86c001_init_one(struct pci_dev *dev,
+2 -2
drivers/ide/pci/triflex.c
··· 96 96 97 97 static void triflex_tune_drive(ide_drive_t *drive, u8 pio) 98 98 { 99 - int use_pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 99 + int use_pio = ide_get_best_pio_mode(drive, pio, 4); 100 100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio)); 101 101 } 102 102 ··· 129 129 static ide_pci_device_t triflex_device __devinitdata = { 130 130 .name = "TRIFLEX", 131 131 .init_hwif = init_hwif_triflex, 132 - .channels = 2, 133 132 .autodma = AUTODMA, 134 133 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 135 134 .bootable = ON_BOARD, 135 + .pio_mask = ATA_PIO4, 136 136 }; 137 137 138 138 static int __devinit triflex_init_one(struct pci_dev *dev,
-1
drivers/ide/pci/trm290.c
··· 327 327 static ide_pci_device_t trm290_chipset __devinitdata = { 328 328 .name = "TRM290", 329 329 .init_hwif = init_hwif_trm290, 330 - .channels = 2, 331 330 .autodma = NOAUTODMA, 332 331 .bootable = ON_BOARD, 333 332 };
+15 -11
drivers/ide/pci/via82cxxx.c
··· 1 1 /* 2 2 * 3 - * Version 3.45 3 + * Version 3.46 4 4 * 5 5 * VIA IDE driver for Linux. Supported southbridges: 6 6 * ··· 203 203 204 204 static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) 205 205 { 206 - if (pio == 255) { 207 - via_set_drive(drive, ide_find_best_pio_mode(drive)); 208 - return; 209 - } 206 + if (pio == 255) 207 + pio = ide_get_best_pio_mode(drive, 255, 5); 210 208 211 209 via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5)); 212 210 } ··· 221 223 { 222 224 u8 speed = ide_max_dma_mode(drive); 223 225 224 - if (speed == 0) 225 - speed = ide_find_best_pio_mode(drive); 226 + if (speed == 0) { 227 + via82cxxx_tune_drive(drive, 255); 228 + return -1; 229 + } 226 230 227 231 via_set_drive(drive, speed); 228 232 229 - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 233 + if (drive->autodma) 230 234 return 0; 231 235 232 236 return -1; ··· 498 498 .name = "VP_IDE", 499 499 .init_chipset = init_chipset_via82cxxx, 500 500 .init_hwif = init_hwif_via82cxxx, 501 - .channels = 2, 502 501 .autodma = NOAUTODMA, 503 502 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 504 - .bootable = ON_BOARD 503 + .bootable = ON_BOARD, 504 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 505 + | IDE_HFLAG_PIO_NO_DOWNGRADE, 506 + .pio_mask = ATA_PIO5, 505 507 },{ /* 1 */ 506 508 .name = "VP_IDE", 507 509 .init_chipset = init_chipset_via82cxxx, 508 510 .init_hwif = init_hwif_via82cxxx, 509 - .channels = 2, 510 511 .autodma = AUTODMA, 511 512 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 512 513 .bootable = ON_BOARD, 514 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 515 + | IDE_HFLAG_PIO_NO_DOWNGRADE, 516 + .pio_mask = ATA_PIO5, 513 517 } 514 518 }; 515 519
+3 -2
drivers/ide/ppc/mpc8xx.c
··· 316 316 } 317 317 318 318 /* register routine to tune PIO mode */ 319 + ide_hwifs[data_port].pio_mask = ATA_PIO4; 319 320 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 320 321 321 322 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; ··· 403 402 } 404 403 405 404 /* register routine to tune PIO mode */ 405 + ide_hwifs[data_port].pio_mask = ATA_PIO4; 406 406 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 407 407 408 408 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; ··· 433 431 static void 434 432 m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio) 435 433 { 436 - ide_pio_data_t d; 437 434 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 438 435 volatile pcmconf8xx_t *pcmp; 439 436 ulong timing, mask, reg; 440 437 #endif 441 438 442 - pio = ide_get_best_pio_mode(drive, pio, 4, &d); 439 + pio = ide_get_best_pio_mode(drive, pio, 4); 443 440 444 441 #if 1 445 442 printk("%s[%d] %s: best PIO mode: %d\n",
+9 -7
drivers/ide/ppc/pmac.c
··· 615 615 static void 616 616 pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) 617 617 { 618 - ide_pio_data_t d; 619 618 u32 *timings; 620 619 unsigned accessTicks, recTicks; 621 620 unsigned accessTime, recTime; 622 621 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 623 - 622 + unsigned int cycle_time; 623 + 624 624 if (pmif == NULL) 625 625 return; 626 626 627 627 /* which drive is it ? */ 628 628 timings = &pmif->timings[drive->select.b.unit & 0x01]; 629 629 630 - pio = ide_get_best_pio_mode(drive, pio, 4, &d); 630 + pio = ide_get_best_pio_mode(drive, pio, 4); 631 + cycle_time = ide_pio_cycle_time(drive, pio); 631 632 632 633 switch (pmif->kind) { 633 634 case controller_sh_ata6: { 634 635 /* 133Mhz cell */ 635 - u32 tr = kauai_lookup_timing(shasta_pio_timings, d.cycle_time); 636 + u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); 636 637 if (tr == 0) 637 638 return; 638 639 *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; ··· 642 641 case controller_un_ata6: 643 642 case controller_k2_ata6: { 644 643 /* 100Mhz cell */ 645 - u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time); 644 + u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); 646 645 if (tr == 0) 647 646 return; 648 647 *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; ··· 650 649 } 651 650 case controller_kl_ata4: 652 651 /* 66Mhz cell */ 653 - recTime = d.cycle_time - ide_pio_timings[pio].active_time 652 + recTime = cycle_time - ide_pio_timings[pio].active_time 654 653 - ide_pio_timings[pio].setup_time; 655 654 recTime = max(recTime, 150U); 656 655 accessTime = ide_pio_timings[pio].active_time; ··· 666 665 default: { 667 666 /* 33Mhz cell */ 668 667 int ebit = 0; 669 - recTime = d.cycle_time - ide_pio_timings[pio].active_time 668 + recTime = cycle_time - ide_pio_timings[pio].active_time 670 669 - ide_pio_timings[pio].setup_time; 671 670 recTime = max(recTime, 150U); 672 671 accessTime = ide_pio_timings[pio].active_time; ··· 1248 1247 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1249 1248 hwif->drives[0].unmask = 1; 1250 1249 hwif->drives[1].unmask = 1; 1250 + hwif->pio_mask = ATA_PIO4; 1251 1251 hwif->tuneproc = pmac_ide_tuneproc; 1252 1252 if (pmif->kind == controller_un_ata6 1253 1253 || pmif->kind == controller_k2_ata6
+6 -12
drivers/ide/setup-pci.c
··· 5 5 * 6 6 * Copyright (c) 1995-1998 Mark Lord 7 7 * May be copied or modified under the terms of the GNU General Public License 8 - * 9 - * Recent Changes 10 - * Split the set up function into multiple functions 11 - * Use pci_set_master 12 - * Fix misreporting of I/O v MMIO problems 13 - * Initial fixups for simplex devices 14 8 */ 15 9 16 10 /* ··· 401 407 unsigned long ctl = 0, base = 0; 402 408 ide_hwif_t *hwif; 403 409 404 - if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { 410 + if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { 405 411 /* Possibly we should fail if these checks report true */ 406 412 ide_pci_check_iomem(dev, d, 2*port); 407 413 ide_pci_check_iomem(dev, d, 2*port+1); ··· 565 571 566 572 void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 567 573 { 568 - int port; 574 + int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 569 575 int at_least_one_hwif_enabled = 0; 570 576 ide_hwif_t *hwif, *mate = NULL; 571 577 u8 tmp; ··· 576 582 * Set up the IDE ports 577 583 */ 578 584 579 - for (port = 0; port <= 1; ++port) { 585 + for (port = 0; port < channels; ++port) { 580 586 ide_pci_enablebit_t *e = &(d->enablebits[port]); 581 587 582 588 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 583 589 (tmp & e->mask) != e->val)) 584 590 continue; /* port not enabled */ 585 591 586 - if (d->channels <= port) 587 - break; 588 - 589 592 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 590 593 continue; 591 594 ··· 607 616 else 608 617 ide_hwif_setup_dma(dev, d, hwif); 609 618 bypass_legacy_dma: 619 + hwif->host_flags = d->host_flags; 620 + hwif->pio_mask = d->pio_mask; 621 + 610 622 if (d->init_hwif) 611 623 /* Call chipset-specific routine 612 624 * for each enabled hwif
+9
include/linux/ata.h
··· 64 64 ATA_ID_PROD_LEN = 40, 65 65 66 66 ATA_PCI_CTL_OFS = 2, 67 + 68 + ATA_PIO0 = (1 << 0), 69 + ATA_PIO1 = ATA_PIO0 | (1 << 1), 70 + ATA_PIO2 = ATA_PIO1 | (1 << 2), 71 + ATA_PIO3 = ATA_PIO2 | (1 << 3), 72 + ATA_PIO4 = ATA_PIO3 | (1 << 4), 73 + ATA_PIO5 = ATA_PIO4 | (1 << 5), 74 + ATA_PIO6 = ATA_PIO5 | (1 << 6), 75 + 67 76 ATA_UDMA0 = (1 << 0), 68 77 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 69 78 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
+20 -11
include/linux/ide.h
··· 681 681 u8 straight8; /* Alan's straight 8 check */ 682 682 u8 bus_state; /* power state of the IDE bus */ 683 683 684 + u8 host_flags; 685 + 686 + u8 pio_mask; 687 + 684 688 u8 atapi_dma; /* host supports atapi_dma */ 685 689 u8 ultra_mask; 686 690 u8 mwdma_mask; ··· 1248 1244 1249 1245 enum { 1250 1246 /* Uses ISA control ports not PCI ones. */ 1251 - IDEPCI_FLAG_ISA_PORTS = (1 << 0), 1247 + IDE_HFLAG_ISA_PORTS = (1 << 0), 1248 + /* single port device */ 1249 + IDE_HFLAG_SINGLE = (1 << 1), 1250 + /* don't use legacy PIO blacklist */ 1251 + IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), 1252 + /* don't use conservative PIO "downgrade" */ 1253 + IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), 1252 1254 }; 1253 1255 1254 1256 typedef struct ide_pci_device_s { ··· 1266 1256 void (*init_hwif)(ide_hwif_t *); 1267 1257 void (*init_dma)(ide_hwif_t *, unsigned long); 1268 1258 void (*fixup)(ide_hwif_t *); 1269 - u8 channels; 1270 1259 u8 autodma; 1271 1260 ide_pci_enablebit_t enablebits[2]; 1272 1261 u8 bootable; 1273 1262 unsigned int extra; 1274 1263 struct ide_pci_device_s *next; 1275 - u8 flags; 1264 + u8 host_flags; 1265 + u8 pio_mask; 1276 1266 u8 udma_mask; 1277 1267 } ide_pci_device_t; 1278 1268 ··· 1373 1363 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1374 1364 int ide_use_fast_pio(ide_drive_t *); 1375 1365 1366 + static inline int ide_dev_has_iordy(struct hd_driveid *id) 1367 + { 1368 + return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; 1369 + } 1370 + 1376 1371 u8 ide_dump_status(ide_drive_t *, const char *, u8); 1377 1372 1378 1373 typedef struct ide_pio_timings_s { ··· 1387 1372 /* active + recovery (+ setup for some chips) */ 1388 1373 } ide_pio_timings_t; 1389 1374 1390 - typedef struct ide_pio_data_s { 1391 - u8 pio_mode; 1392 - u8 use_iordy; 1393 - u8 overridden; 1394 - unsigned int cycle_time; 1395 - } ide_pio_data_t; 1396 - 1397 - extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); 1375 + unsigned int ide_pio_cycle_time(ide_drive_t *, u8); 1376 + u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1398 1377 extern const ide_pio_timings_t ide_pio_timings[6]; 1399 1378 1400 1379