Skip to content

Commit 64fb98f

Browse files
author
Linus Torvalds
committed
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. ...
2 parents 5f47c7e + 89636af commit 64fb98f

53 files changed

Lines changed: 473 additions & 599 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/ata/pata_pcmcia.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
382382
PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178),
383383
PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
384384
PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
385+
PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e),
385386
PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b),
386387
PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
387388
PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),

‎drivers/ide/cris/ide-cris.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,6 @@ cris_ide_reset(unsigned val)
414414
#ifdef CONFIG_ETRAX_IDE_G27_RESET
415415
REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val);
416416
#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
423417
#ifdef CONFIG_ETRAX_IDE_PB7_RESET
424418
port_pb_dir_shadow = port_pb_dir_shadow |
425419
IO_STATE(R_PORT_PB_DIR, dir7, output);
@@ -690,6 +684,8 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio)
690684
{
691685
int setup, strobe, hold;
692686

687+
pio = ide_get_best_pio_mode(drive, pio, 4);
688+
693689
switch(pio)
694690
{
695691
case 0:
@@ -820,6 +816,7 @@ init_e100_ide (void)
820816
hwif->dma_host_on = &cris_dma_on;
821817
hwif->dma_off_quietly = &cris_dma_off;
822818
hwif->cbl = ATA_CBL_PATA40;
819+
hwif->pio_mask = ATA_PIO4,
823820
hwif->ultra_mask = cris_ultra_mask;
824821
hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
825822
hwif->autodma = 1;

‎drivers/ide/ide-floppy.c‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
#include <linux/bitops.h>
100100
#include <linux/mutex.h>
101101

102+
#include <scsi/scsi_ioctl.h>
103+
102104
#include <asm/byteorder.h>
103105
#include <asm/irq.h>
104106
#include <asm/uaccess.h>
@@ -2099,7 +2101,21 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file,
20992101
case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
21002102
return idefloppy_get_format_progress(drive, argp);
21012103
}
2102-
return generic_ide_ioctl(drive, file, bdev, cmd, arg);
2104+
2105+
/*
2106+
* skip SCSI_IOCTL_SEND_COMMAND (deprecated)
2107+
* and CDROM_SEND_PACKET (legacy) ioctls
2108+
*/
2109+
if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
2110+
err = scsi_cmd_ioctl(file, bdev->bd_disk->queue,
2111+
bdev->bd_disk, cmd, argp);
2112+
else
2113+
err = -ENOTTY;
2114+
2115+
if (err == -ENOTTY)
2116+
err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
2117+
2118+
return err;
21032119
}
21042120

21052121
static int idefloppy_media_changed(struct gendisk *disk)

‎drivers/ide/ide-io.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,12 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
224224
* we could be smarter and check for current xfer_speed
225225
* in struct drive etc...
226226
*/
227-
if ((drive->id->capability & 1) == 0)
228-
break;
229227
if (drive->hwif->ide_dma_check == NULL)
230228
break;
231229
drive->hwif->dma_off_quietly(drive);
230+
/*
231+
* TODO: respect ->using_dma setting
232+
*/
232233
ide_set_dma(drive);
233234
break;
234235
}

‎drivers/ide/ide-lib.c‎

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,34 @@ static int ide_scan_pio_blacklist (char *model)
249249
return -1;
250250
}
251251

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+
252275
/**
253276
* ide_get_best_pio_mode - get PIO mode from drive
254277
* @drive: drive to consider
255278
* @mode_wanted: preferred mode
256279
* @max_mode: highest allowed mode
257-
* @d: PIO data
258280
*
259281
* This routine returns the recommended PIO settings for a given drive,
260282
* based on the drive->id information and the ide_pio_blacklist[].
@@ -263,32 +285,26 @@ static int ide_scan_pio_blacklist (char *model)
263285
* This is used by most chipset support modules when "auto-tuning".
264286
*/
265287

266-
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d)
288+
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
267289
{
268290
int pio_mode;
269-
int cycle_time = 0;
270-
int use_iordy = 0;
271291
struct hd_driveid* id = drive->id;
272292
int overridden = 0;
273293

274-
if (mode_wanted != 255) {
275-
pio_mode = mode_wanted;
276-
use_iordy = (pio_mode > 2);
277-
} else if (!drive->id) {
278-
pio_mode = 0;
279-
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
280-
overridden = 1;
281-
use_iordy = (pio_mode > 2);
294+
if (mode_wanted != 255)
295+
return min_t(u8, mode_wanted, max_mode);
296+
297+
if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 &&
298+
(pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
299+
printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name);
282300
} else {
283301
pio_mode = id->tPIO;
284302
if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */
285303
pio_mode = 2;
286304
overridden = 1;
287305
}
288306
if (id->field_valid & 2) { /* drive implements ATA2? */
289-
if (id->capability & 8) { /* drive supports use_iordy? */
290-
use_iordy = 1;
291-
cycle_time = id->eide_pio_iordy;
307+
if (id->capability & 8) { /* IORDY supported? */
292308
if (id->eide_pio_modes & 7) {
293309
overridden = 0;
294310
if (id->eide_pio_modes & 4)
@@ -298,31 +314,27 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
298314
else
299315
pio_mode = 3;
300316
}
301-
} else {
302-
cycle_time = id->eide_pio;
303317
}
304318
}
305319

320+
if (overridden)
321+
printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n",
322+
drive->name);
323+
306324
/*
307325
* Conservative "downgrade" for all pre-ATA2 drives
308326
*/
309-
if (pio_mode && pio_mode < 4) {
327+
if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 &&
328+
pio_mode && pio_mode < 4) {
310329
pio_mode--;
311-
overridden = 1;
312-
if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
313-
cycle_time = 0; /* use standard timing */
330+
printk(KERN_INFO "%s: applying conservative "
331+
"PIO \"downgrade\"\n", drive->name);
314332
}
315333
}
316-
if (pio_mode > max_mode) {
334+
335+
if (pio_mode > max_mode)
317336
pio_mode = max_mode;
318-
cycle_time = 0;
319-
}
320-
if (d) {
321-
d->pio_mode = pio_mode;
322-
d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time;
323-
d->use_iordy = use_iordy;
324-
d->overridden = overridden;
325-
}
337+
326338
return pio_mode;
327339
}
328340

‎drivers/ide/ide-timing.h‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,6 @@ static struct ide_timing ide_timing[] = {
106106
#define XFER_EPIO 0x01
107107
#define XFER_PIO 0x00
108108

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-
126109
static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
127110
{
128111
q->setup = EZ(t->setup * 1000, T);
@@ -212,7 +195,8 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing
212195
*/
213196

214197
if ((speed & XFER_MODE) != XFER_PIO) {
215-
ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT);
198+
u8 pio = ide_get_best_pio_mode(drive, 255, 5);
199+
ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT);
216200
ide_timing_merge(&p, t, t, IDE_TIMING_ALL);
217201
}
218202

‎drivers/ide/ide.c‎

Lines changed: 4 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
* (usually 14 & 15).
1717
* There can be up to two drives per interface, as per the ATA-2 spec.
1818
*
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
2319
* ...
2420
*
2521
* From hd.c:
@@ -47,80 +43,6 @@
4743
* This was a rewrite of just about everything from hd.c, though some original
4844
* code is still sprinkled about. Think of it as a major evolution, with
4945
* inspiration from lots of linux users, esp. hamish@zot.apana.org.au
50-
*
51-
* Version 1.0 ALPHA initial code, primary i/f working okay
52-
* Version 1.3 BETA dual i/f on shared irq tested & working!
53-
* Version 1.4 BETA added auto probing for irq(s)
54-
* Version 1.5 BETA added ALPHA (untested) support for IDE cd-roms,
55-
* ...
56-
* Version 5.50 allow values as small as 20 for idebus=
57-
* Version 5.51 force non io_32bit in drive_cmd_intr()
58-
* change delay_10ms() to delay_50ms() to fix problems
59-
* Version 5.52 fix incorrect invalidation of removable devices
60-
* add "hdx=slow" command line option
61-
* Version 5.60 start to modularize the driver; the disk and ATAPI
62-
* drivers can be compiled as loadable modules.
63-
* move IDE probe code to ide-probe.c
64-
* move IDE disk code to ide-disk.c
65-
* add support for generic IDE device subdrivers
66-
* add m68k code from Geert Uytterhoeven
67-
* probe all interfaces by default
68-
* add ioctl to (re)probe an interface
69-
* Version 6.00 use per device request queues
70-
* attempt to optimize shared hwgroup performance
71-
* add ioctl to manually adjust bandwidth algorithms
72-
* add kerneld support for the probe module
73-
* fix bug in ide_error()
74-
* fix bug in the first ide_get_lock() call for Atari
75-
* don't flush leftover data for ATAPI devices
76-
* Version 6.01 clear hwgroup->active while the hwgroup sleeps
77-
* support HDIO_GETGEO for floppies
78-
* Version 6.02 fix ide_ack_intr() call
79-
* check partition table on floppies
80-
* Version 6.03 handle bad status bit sequencing in ide_wait_stat()
81-
* Version 6.10 deleted old entries from this list of updates
82-
* replaced triton.c with ide-dma.c generic PCI DMA
83-
* added support for BIOS-enabled UltraDMA
84-
* rename all "promise" things to "pdc4030"
85-
* fix EZ-DRIVE handling on small disks
86-
* Version 6.11 fix probe error in ide_scan_devices()
87-
* fix ancient "jiffies" polling bugs
88-
* mask all hwgroup interrupts on each irq entry
89-
* Version 6.12 integrate ioctl and proc interfaces
90-
* fix parsing of "idex=" command line parameter
91-
* Version 6.13 add support for ide4/ide5 courtesy rjones@orchestream.com
92-
* Version 6.14 fixed IRQ sharing among PCI devices
93-
* Version 6.15 added SMP awareness to IDE drivers
94-
* Version 6.16 fixed various bugs; even more SMP friendly
95-
* Version 6.17 fix for newest EZ-Drive problem
96-
* Version 6.18 default unpartitioned-disk translation now "BIOS LBA"
97-
* Version 6.19 Re-design for a UNIFORM driver for all platforms,
98-
* model based on suggestions from Russell King and
99-
* Geert Uytterhoeven
100-
* Promise DC4030VL now supported.
101-
* add support for ide6/ide7
102-
* delay_50ms() changed to ide_delay_50ms() and exported.
103-
* Version 6.20 Added/Fixed Generic ATA-66 support and hwif detection.
104-
* Added hdx=flash to allow for second flash disk
105-
* detection w/o the hang loop.
106-
* Added support for ide8/ide9
107-
* Added idex=ata66 for the quirky chipsets that are
108-
* ATA-66 compliant, but have yet to determine a method
109-
* of verification of the 80c cable presence.
110-
* Specifically Promise's PDC20262 chipset.
111-
* Version 6.21 Fixing/Fixed SMP spinlock issue with insight from an old
112-
* hat that clarified original low level driver design.
113-
* Version 6.30 Added SMP support; fixed multmode issues. -ml
114-
* Version 6.31 Debug Share INTR's and request queue streaming
115-
* Native ATA-100 support
116-
* Prep for Cascades Project
117-
* Version 7.00alpha First named revision of ide rearrange
118-
*
119-
* Some additional driver compile-time options are in ./include/linux/ide.h
120-
*
121-
* To do, in likely order of completion:
122-
* - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f
123-
*
12446
*/
12547

12648
#define REVISION "Revision: 7.00alpha2"
@@ -455,6 +377,10 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
455377
hwif->straight8 = tmp_hwif->straight8;
456378
hwif->bus_state = tmp_hwif->bus_state;
457379

380+
hwif->host_flags = tmp_hwif->host_flags;
381+
382+
hwif->pio_mask = tmp_hwif->pio_mask;
383+
458384
hwif->atapi_dma = tmp_hwif->atapi_dma;
459385
hwif->ultra_mask = tmp_hwif->ultra_mask;
460386
hwif->mwdma_mask = tmp_hwif->mwdma_mask;
@@ -1171,10 +1097,6 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
11711097
return 0;
11721098
}
11731099

1174-
case CDROMEJECT:
1175-
case CDROMCLOSETRAY:
1176-
return scsi_cmd_ioctl(file, bdev->bd_disk->queue, bdev->bd_disk, cmd, p);
1177-
11781100
case HDIO_GET_BUSSTATE:
11791101
if (!capable(CAP_SYS_ADMIN))
11801102
return -EACCES;

‎drivers/ide/legacy/ali14xx.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,12 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)
115115
int time1, time2;
116116
u8 param1, param2, param3, param4;
117117
unsigned long flags;
118-
ide_pio_data_t d;
119118
int bus_speed = system_bus_clock();
120119

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);
122121

123122
/* calculate timing, according to PIO mode */
124-
time1 = d.cycle_time;
123+
time1 = ide_pio_cycle_time(drive, pio);
125124
time2 = ide_pio_timings[pio].active_time;
126125
param3 = param1 = (time2 * bus_speed + 999) / 1000;
127126
param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1;
@@ -212,10 +211,12 @@ static int __init ali14xx_probe(void)
212211
mate = &ide_hwifs[1];
213212

214213
hwif->chipset = ide_ali14xx;
214+
hwif->pio_mask = ATA_PIO4;
215215
hwif->tuneproc = &ali14xx_tune_drive;
216216
hwif->mate = mate;
217217

218218
mate->chipset = ide_ali14xx;
219+
mate->pio_mask = ATA_PIO4;
219220
mate->tuneproc = &ali14xx_tune_drive;
220221
mate->mate = hwif;
221222
mate->channel = 1;

‎drivers/ide/legacy/dtc2278.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void tune_dtc2278 (ide_drive_t *drive, u8 pio)
7171
{
7272
unsigned long flags;
7373

74-
pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
74+
pio = ide_get_best_pio_mode(drive, pio, 4);
7575

7676
if (pio >= 3) {
7777
spin_lock_irqsave(&ide_lock, flags);
@@ -123,6 +123,7 @@ static int __init dtc2278_probe(void)
123123

124124
hwif->serialized = 1;
125125
hwif->chipset = ide_dtc2278;
126+
hwif->pio_mask = ATA_PIO4;
126127
hwif->tuneproc = &tune_dtc2278;
127128
hwif->drives[0].no_unmask = 1;
128129
hwif->drives[1].no_unmask = 1;

0 commit comments

Comments
 (0)