Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
Browse files Browse the repository at this point in the history
* 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.
  ...
  • Loading branch information
Linus Torvalds committed Jul 19, 2007
2 parents 5f47c7e + 89636af commit 64fb98f
Show file tree
Hide file tree
Showing 53 changed files with 473 additions and 599 deletions.
1 change: 1 addition & 0 deletions drivers/ata/pata_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178),
PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e),
PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b),
PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
Expand Down
9 changes: 3 additions & 6 deletions drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,6 @@ cris_ide_reset(unsigned val)
#ifdef CONFIG_ETRAX_IDE_G27_RESET
REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val);
#endif
#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, val);
#endif
#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, val);
#endif
#ifdef CONFIG_ETRAX_IDE_PB7_RESET
port_pb_dir_shadow = port_pb_dir_shadow |
IO_STATE(R_PORT_PB_DIR, dir7, output);
Expand Down Expand Up @@ -690,6 +684,8 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio)
{
int setup, strobe, hold;

pio = ide_get_best_pio_mode(drive, pio, 4);

switch(pio)
{
case 0:
Expand Down Expand Up @@ -820,6 +816,7 @@ init_e100_ide (void)
hwif->dma_host_on = &cris_dma_on;
hwif->dma_off_quietly = &cris_dma_off;
hwif->cbl = ATA_CBL_PATA40;
hwif->pio_mask = ATA_PIO4,
hwif->ultra_mask = cris_ultra_mask;
hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
hwif->autodma = 1;
Expand Down
18 changes: 17 additions & 1 deletion drivers/ide/ide-floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
#include <linux/bitops.h>
#include <linux/mutex.h>

#include <scsi/scsi_ioctl.h>

#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -2099,7 +2101,21 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file,
case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
return idefloppy_get_format_progress(drive, argp);
}
return generic_ide_ioctl(drive, file, bdev, cmd, arg);

/*
* skip SCSI_IOCTL_SEND_COMMAND (deprecated)
* and CDROM_SEND_PACKET (legacy) ioctls
*/
if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
err = scsi_cmd_ioctl(file, bdev->bd_disk->queue,
bdev->bd_disk, cmd, argp);
else
err = -ENOTTY;

if (err == -ENOTTY)
err = generic_ide_ioctl(drive, file, bdev, cmd, arg);

return err;
}

static int idefloppy_media_changed(struct gendisk *disk)
Expand Down
5 changes: 3 additions & 2 deletions drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
* we could be smarter and check for current xfer_speed
* in struct drive etc...
*/
if ((drive->id->capability & 1) == 0)
break;
if (drive->hwif->ide_dma_check == NULL)
break;
drive->hwif->dma_off_quietly(drive);
/*
* TODO: respect ->using_dma setting
*/
ide_set_dma(drive);
break;
}
Expand Down
72 changes: 42 additions & 30 deletions drivers/ide/ide-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,34 @@ static int ide_scan_pio_blacklist (char *model)
return -1;
}

unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
{
struct hd_driveid *id = drive->id;
int cycle_time = 0;

if (id->field_valid & 2) {
if (id->capability & 8)
cycle_time = id->eide_pio_iordy;
else
cycle_time = id->eide_pio;
}

/* conservative "downgrade" for all pre-ATA2 drives */
if (pio < 3) {
if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time)
cycle_time = 0; /* use standard timing */
}

return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time;
}

EXPORT_SYMBOL_GPL(ide_pio_cycle_time);

/**
* ide_get_best_pio_mode - get PIO mode from drive
* @drive: drive to consider
* @mode_wanted: preferred mode
* @max_mode: highest allowed mode
* @d: PIO data
*
* This routine returns the recommended PIO settings for a given drive,
* based on the drive->id information and the ide_pio_blacklist[].
Expand All @@ -263,32 +285,26 @@ static int ide_scan_pio_blacklist (char *model)
* This is used by most chipset support modules when "auto-tuning".
*/

u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d)
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
{
int pio_mode;
int cycle_time = 0;
int use_iordy = 0;
struct hd_driveid* id = drive->id;
int overridden = 0;

if (mode_wanted != 255) {
pio_mode = mode_wanted;
use_iordy = (pio_mode > 2);
} else if (!drive->id) {
pio_mode = 0;
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
overridden = 1;
use_iordy = (pio_mode > 2);
if (mode_wanted != 255)
return min_t(u8, mode_wanted, max_mode);

if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 &&
(pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name);
} else {
pio_mode = id->tPIO;
if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */
pio_mode = 2;
overridden = 1;
}
if (id->field_valid & 2) { /* drive implements ATA2? */
if (id->capability & 8) { /* drive supports use_iordy? */
use_iordy = 1;
cycle_time = id->eide_pio_iordy;
if (id->capability & 8) { /* IORDY supported? */
if (id->eide_pio_modes & 7) {
overridden = 0;
if (id->eide_pio_modes & 4)
Expand All @@ -298,31 +314,27 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
else
pio_mode = 3;
}
} else {
cycle_time = id->eide_pio;
}
}

if (overridden)
printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n",
drive->name);

/*
* Conservative "downgrade" for all pre-ATA2 drives
*/
if (pio_mode && pio_mode < 4) {
if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 &&
pio_mode && pio_mode < 4) {
pio_mode--;
overridden = 1;
if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
cycle_time = 0; /* use standard timing */
printk(KERN_INFO "%s: applying conservative "
"PIO \"downgrade\"\n", drive->name);
}
}
if (pio_mode > max_mode) {

if (pio_mode > max_mode)
pio_mode = max_mode;
cycle_time = 0;
}
if (d) {
d->pio_mode = pio_mode;
d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time;
d->use_iordy = use_iordy;
d->overridden = overridden;
}

return pio_mode;
}

Expand Down
20 changes: 2 additions & 18 deletions drivers/ide/ide-timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,6 @@ static struct ide_timing ide_timing[] = {
#define XFER_EPIO 0x01
#define XFER_PIO 0x00

static short ide_find_best_pio_mode(ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
short best = 0;

if (id->field_valid & 2) { /* EIDE PIO modes */

if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
(drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
(drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
}

return (drive->id->tPIO == 2) ? XFER_PIO_2 :
(drive->id->tPIO == 1) ? XFER_PIO_1 :
(drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW;
}

static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
{
q->setup = EZ(t->setup * 1000, T);
Expand Down Expand Up @@ -212,7 +195,8 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing
*/

if ((speed & XFER_MODE) != XFER_PIO) {
ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT);
u8 pio = ide_get_best_pio_mode(drive, 255, 5);
ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT);
ide_timing_merge(&p, t, t, IDE_TIMING_ALL);
}

Expand Down
86 changes: 4 additions & 82 deletions drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
* (usually 14 & 15).
* There can be up to two drives per interface, as per the ATA-2 spec.
*
* Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64
* Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64
* Tertiary: ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64
* Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64
* ...
*
* From hd.c:
Expand Down Expand Up @@ -47,80 +43,6 @@
* This was a rewrite of just about everything from hd.c, though some original
* code is still sprinkled about. Think of it as a major evolution, with
* inspiration from lots of linux users, esp. [email protected]
*
* Version 1.0 ALPHA initial code, primary i/f working okay
* Version 1.3 BETA dual i/f on shared irq tested & working!
* Version 1.4 BETA added auto probing for irq(s)
* Version 1.5 BETA added ALPHA (untested) support for IDE cd-roms,
* ...
* Version 5.50 allow values as small as 20 for idebus=
* Version 5.51 force non io_32bit in drive_cmd_intr()
* change delay_10ms() to delay_50ms() to fix problems
* Version 5.52 fix incorrect invalidation of removable devices
* add "hdx=slow" command line option
* Version 5.60 start to modularize the driver; the disk and ATAPI
* drivers can be compiled as loadable modules.
* move IDE probe code to ide-probe.c
* move IDE disk code to ide-disk.c
* add support for generic IDE device subdrivers
* add m68k code from Geert Uytterhoeven
* probe all interfaces by default
* add ioctl to (re)probe an interface
* Version 6.00 use per device request queues
* attempt to optimize shared hwgroup performance
* add ioctl to manually adjust bandwidth algorithms
* add kerneld support for the probe module
* fix bug in ide_error()
* fix bug in the first ide_get_lock() call for Atari
* don't flush leftover data for ATAPI devices
* Version 6.01 clear hwgroup->active while the hwgroup sleeps
* support HDIO_GETGEO for floppies
* Version 6.02 fix ide_ack_intr() call
* check partition table on floppies
* Version 6.03 handle bad status bit sequencing in ide_wait_stat()
* Version 6.10 deleted old entries from this list of updates
* replaced triton.c with ide-dma.c generic PCI DMA
* added support for BIOS-enabled UltraDMA
* rename all "promise" things to "pdc4030"
* fix EZ-DRIVE handling on small disks
* Version 6.11 fix probe error in ide_scan_devices()
* fix ancient "jiffies" polling bugs
* mask all hwgroup interrupts on each irq entry
* Version 6.12 integrate ioctl and proc interfaces
* fix parsing of "idex=" command line parameter
* Version 6.13 add support for ide4/ide5 courtesy [email protected]
* Version 6.14 fixed IRQ sharing among PCI devices
* Version 6.15 added SMP awareness to IDE drivers
* Version 6.16 fixed various bugs; even more SMP friendly
* Version 6.17 fix for newest EZ-Drive problem
* Version 6.18 default unpartitioned-disk translation now "BIOS LBA"
* Version 6.19 Re-design for a UNIFORM driver for all platforms,
* model based on suggestions from Russell King and
* Geert Uytterhoeven
* Promise DC4030VL now supported.
* add support for ide6/ide7
* delay_50ms() changed to ide_delay_50ms() and exported.
* Version 6.20 Added/Fixed Generic ATA-66 support and hwif detection.
* Added hdx=flash to allow for second flash disk
* detection w/o the hang loop.
* Added support for ide8/ide9
* Added idex=ata66 for the quirky chipsets that are
* ATA-66 compliant, but have yet to determine a method
* of verification of the 80c cable presence.
* Specifically Promise's PDC20262 chipset.
* Version 6.21 Fixing/Fixed SMP spinlock issue with insight from an old
* hat that clarified original low level driver design.
* Version 6.30 Added SMP support; fixed multmode issues. -ml
* Version 6.31 Debug Share INTR's and request queue streaming
* Native ATA-100 support
* Prep for Cascades Project
* Version 7.00alpha First named revision of ide rearrange
*
* Some additional driver compile-time options are in ./include/linux/ide.h
*
* To do, in likely order of completion:
* - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f
*
*/

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

hwif->host_flags = tmp_hwif->host_flags;

hwif->pio_mask = tmp_hwif->pio_mask;

hwif->atapi_dma = tmp_hwif->atapi_dma;
hwif->ultra_mask = tmp_hwif->ultra_mask;
hwif->mwdma_mask = tmp_hwif->mwdma_mask;
Expand Down Expand Up @@ -1171,10 +1097,6 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
return 0;
}

case CDROMEJECT:
case CDROMCLOSETRAY:
return scsi_cmd_ioctl(file, bdev->bd_disk->queue, bdev->bd_disk, cmd, p);

case HDIO_GET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
Expand Down
7 changes: 4 additions & 3 deletions drivers/ide/legacy/ali14xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,12 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)
int time1, time2;
u8 param1, param2, param3, param4;
unsigned long flags;
ide_pio_data_t d;
int bus_speed = system_bus_clock();

pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, &d);
pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO);

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

hwif->chipset = ide_ali14xx;
hwif->pio_mask = ATA_PIO4;
hwif->tuneproc = &ali14xx_tune_drive;
hwif->mate = mate;

mate->chipset = ide_ali14xx;
mate->pio_mask = ATA_PIO4;
mate->tuneproc = &ali14xx_tune_drive;
mate->mate = hwif;
mate->channel = 1;
Expand Down
3 changes: 2 additions & 1 deletion drivers/ide/legacy/dtc2278.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void tune_dtc2278 (ide_drive_t *drive, u8 pio)
{
unsigned long flags;

pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
pio = ide_get_best_pio_mode(drive, pio, 4);

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

hwif->serialized = 1;
hwif->chipset = ide_dtc2278;
hwif->pio_mask = ATA_PIO4;
hwif->tuneproc = &tune_dtc2278;
hwif->drives[0].no_unmask = 1;
hwif->drives[1].no_unmask = 1;
Expand Down
Loading

0 comments on commit 64fb98f

Please sign in to comment.