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:
  ide: fix PIO setup on resume for ATAPI devices
  ide: legacy PCI bus order probing fixes
  ide: add ide_proc_register_port()
  ide: add "initializing" argument to ide_register_hw()
  ide: cable detection fixes (take 2)
  ide: move IDE settings handling to ide-proc.c
  ide: split off ioctl handling from IDE settings (v2)
  ide: make /proc/ide/ optional
  ide: add ide_tune_dma() helper
  ide: rework the code for selecting the best DMA transfer mode (v3)
  ide: fix UDMA/MWDMA/SWDMA masks (v3)
  • Loading branch information
Linus Torvalds committed May 9, 2007
2 parents d0b6e0e + 317a46a commit 3cb7396
Show file tree
Hide file tree
Showing 63 changed files with 1,107 additions and 1,464 deletions.
14 changes: 14 additions & 0 deletions drivers/ide/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ config IDE_TASK_IOCTL

If you are unsure, say N here.

config IDE_PROC_FS
bool "legacy /proc/ide/ support"
depends on IDE && PROC_FS
default y
help
This option enables support for the various files in
/proc/ide. In Linux 2.6 this has been superseded by
files in sysfs but many legacy applications rely on this.

If unsure say Y.

comment "IDE chipset support/bugfixes"

config IDE_GENERIC
Expand Down Expand Up @@ -360,6 +371,9 @@ config IDEPCI_SHARE_IRQ
It is safe to say Y to this question, in most cases.
If unsure, say N.

config IDEPCI_PCIBUS_ORDER
def_bool PCI && BLK_DEV_IDE=y && BLK_DEV_IDEPCI

config BLK_DEV_OFFBOARD
bool "Boot off-board chipsets first support"
depends on PCI && BLK_DEV_IDEPCI
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o
# Core IDE code - must come before legacy
ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o
ide-core-$(CONFIG_PROC_FS) += ide-proc.o
ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o
ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o

Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/arm/bast-ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq,
hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
hw.irq = irq;

ide_register_hw(&hw, hwif);
ide_register_hw(&hw, 0, hwif);

return 0;
}
Expand Down
9 changes: 6 additions & 3 deletions drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static int icside_dma_check(ide_drive_t *drive)
* Enable DMA on any drive that has multiword DMA
*/
if (id->field_valid & 2) {
xfer_mode = ide_dma_speed(drive, 0);
xfer_mode = ide_max_dma_mode(drive);
goto out;
}

Expand Down Expand Up @@ -591,7 +591,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
state->hwif[0] = hwif;

probe_hwif_init(hwif);
create_proc_ide_interfaces();

ide_proc_register_port(hwif);

return 0;
}
Expand Down Expand Up @@ -679,7 +680,9 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)

probe_hwif_init(hwif);
probe_hwif_init(mate);
create_proc_ide_interfaces();

ide_proc_register_port(hwif);
ide_proc_register_port(mate);

return 0;

Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/arm/ide_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ void __init ide_arm_init(void)
memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
hw.irq = IDE_ARM_IRQ;
ide_register_hw(&hw, NULL);
ide_register_hw(&hw, 1, NULL);
}
}
2 changes: 1 addition & 1 deletion drivers/ide/arm/rapide.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
hwif->gendev.parent = &ec->dev;
hwif->noprobe = 0;
probe_hwif_init(hwif);
create_proc_ide_interfaces();
ide_proc_register_port(hwif);
ecard_set_drvdata(ec, hwif);
goto out;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ init_e100_ide (void)
ide_offsets,
0, 0, cris_ide_ack_intr,
ide_default_irq(0));
ide_register_hw(&hw, &hwif);
ide_register_hw(&hw, 1, &hwif);
hwif->mmio = 1;
hwif->chipset = ide_etrax100;
hwif->tuneproc = &tune_cris_ide;
Expand Down Expand Up @@ -1004,7 +1004,7 @@ static int cris_ide_build_dmatable (ide_drive_t *drive)

static int cris_config_drive_for_dma (ide_drive_t *drive)
{
u8 speed = ide_dma_speed(drive, 1);
u8 speed = ide_max_dma_mode(drive);

if (!speed)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/h8300/ide-h8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void __init h8300_ide_init(void)
hw_setup(&hw);

/* register if */
idx = ide_register_hw(&hw, &hwif);
idx = ide_register_hw(&hw, 1, &hwif);
if (idx == -1) {
printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
return;
Expand Down
20 changes: 12 additions & 8 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3059,10 +3059,14 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
return nslots;
}

#ifdef CONFIG_IDE_PROC_FS
static void ide_cdrom_add_settings(ide_drive_t *drive)
{
ide_add_setting(drive, "dsc_overlap", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL);
ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL);
}
#else
static inline void ide_cdrom_add_settings(ide_drive_t *drive) { ; }
#endif

/*
* standard prep_rq_fn that builds 10 byte cmds
Expand Down Expand Up @@ -3274,7 +3278,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
return 0;
}

#ifdef CONFIG_PROC_FS
#ifdef CONFIG_IDE_PROC_FS
static
sector_t ide_cdrom_capacity (ide_drive_t *drive)
{
Expand All @@ -3291,7 +3295,7 @@ static void ide_cd_remove(ide_drive_t *drive)
{
struct cdrom_info *info = drive->driver_data;

ide_unregister_subdriver(drive, info->driver);
ide_proc_unregister_driver(drive, info->driver);

del_gendisk(info->disk);

Expand Down Expand Up @@ -3321,7 +3325,7 @@ static void ide_cd_release(struct kref *kref)

static int ide_cd_probe(ide_drive_t *);

#ifdef CONFIG_PROC_FS
#ifdef CONFIG_IDE_PROC_FS
static int proc_idecd_read_capacity
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
Expand All @@ -3336,8 +3340,6 @@ static ide_proc_entry_t idecd_proc[] = {
{ "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL },
{ NULL, 0, NULL, NULL }
};
#else
# define idecd_proc NULL
#endif

static ide_driver_t ide_cdrom_driver = {
Expand All @@ -3355,7 +3357,9 @@ static ide_driver_t ide_cdrom_driver = {
.end_request = ide_end_request,
.error = __ide_error,
.abort = __ide_abort,
#ifdef CONFIG_IDE_PROC_FS
.proc = idecd_proc,
#endif
};

static int idecd_open(struct inode * inode, struct file * file)
Expand Down Expand Up @@ -3517,7 +3521,7 @@ static int ide_cd_probe(ide_drive_t *drive)

ide_init_disk(g, drive);

ide_register_subdriver(drive, &ide_cdrom_driver);
ide_proc_register_driver(drive, &ide_cdrom_driver);

kref_init(&info->kref);

Expand All @@ -3534,7 +3538,7 @@ static int ide_cd_probe(ide_drive_t *drive)
g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
if (ide_cdrom_setup(drive)) {
struct cdrom_device_info *devinfo = &info->devinfo;
ide_unregister_subdriver(drive, &ide_cdrom_driver);
ide_proc_unregister_driver(drive, &ide_cdrom_driver);
kfree(info->buffer);
kfree(info->toc);
kfree(info->changer_info);
Expand Down
101 changes: 78 additions & 23 deletions drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,7 @@ static sector_t idedisk_capacity (ide_drive_t *drive)
return drive->capacity64 - drive->sect0;
}

#ifdef CONFIG_PROC_FS

#ifdef CONFIG_IDE_PROC_FS
static int smart_enable(ide_drive_t *drive)
{
ide_task_t args;
Expand Down Expand Up @@ -678,12 +677,7 @@ static ide_proc_entry_t idedisk_proc[] = {
{ "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_smart_thresholds, NULL },
{ NULL, 0, NULL, NULL }
};

#else

#define idedisk_proc NULL

#endif /* CONFIG_PROC_FS */
#endif /* CONFIG_IDE_PROC_FS */

static void idedisk_prepare_flush(request_queue_t *q, struct request *rq)
{
Expand Down Expand Up @@ -737,6 +731,9 @@ static int set_multcount(ide_drive_t *drive, int arg)
{
struct request rq;

if (arg < 0 || arg > drive->id->max_multsect)
return -EINVAL;

if (drive->special.b.set_multmode)
return -EBUSY;
ide_init_drive_cmd (&rq);
Expand All @@ -749,6 +746,9 @@ static int set_multcount(ide_drive_t *drive, int arg)

static int set_nowerr(ide_drive_t *drive, int arg)
{
if (arg < 0 || arg > 1)
return -EINVAL;

if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
drive->nowerr = arg;
Expand Down Expand Up @@ -800,6 +800,9 @@ static int write_cache(ide_drive_t *drive, int arg)
ide_task_t args;
int err = 1;

if (arg < 0 || arg > 1)
return -EINVAL;

if (ide_id_has_flush_cache(drive->id)) {
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ?
Expand Down Expand Up @@ -835,6 +838,9 @@ static int set_acoustic (ide_drive_t *drive, int arg)
{
ide_task_t args;

if (arg < 0 || arg > 254)
return -EINVAL;

memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? SETFEATURES_EN_AAM :
SETFEATURES_DIS_AAM;
Expand All @@ -855,6 +861,9 @@ static int set_acoustic (ide_drive_t *drive, int arg)
*/
static int set_lba_addressing(ide_drive_t *drive, int arg)
{
if (arg < 0 || arg > 2)
return -EINVAL;

drive->addressing = 0;

if (HWIF(drive)->no_lba48)
Expand All @@ -866,23 +875,27 @@ static int set_lba_addressing(ide_drive_t *drive, int arg)
return 0;
}

#ifdef CONFIG_IDE_PROC_FS
static void idedisk_add_settings(ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;

ide_add_setting(drive, "bios_cyl", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->bios_cyl, NULL);
ide_add_setting(drive, "bios_head", SETTING_RW, -1, -1, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL);
ide_add_setting(drive, "bios_sect", SETTING_RW, -1, -1, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL);
ide_add_setting(drive, "address", SETTING_RW, HDIO_GET_ADDRESS, HDIO_SET_ADDRESS, TYPE_INTA, 0, 2, 1, 1, &drive->addressing, set_lba_addressing);
ide_add_setting(drive, "bswap", SETTING_READ, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->bswap, NULL);
ide_add_setting(drive, "multcount", id ? SETTING_RW : SETTING_READ, HDIO_GET_MULTCOUNT, HDIO_SET_MULTCOUNT, TYPE_BYTE, 0, id ? id->max_multsect : 0, 1, 1, &drive->mult_count, set_multcount);
ide_add_setting(drive, "nowerr", SETTING_RW, HDIO_GET_NOWERR, HDIO_SET_NOWERR, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr);
ide_add_setting(drive, "lun", SETTING_RW, -1, -1, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL);
ide_add_setting(drive, "wcache", SETTING_RW, HDIO_GET_WCACHE, HDIO_SET_WCACHE, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache);
ide_add_setting(drive, "acoustic", SETTING_RW, HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic);
ide_add_setting(drive, "failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL);
ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->bios_cyl, NULL);
ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL);
ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL);
ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing);
ide_add_setting(drive, "bswap", SETTING_READ, TYPE_BYTE, 0, 1, 1, 1, &drive->bswap, NULL);
ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, id->max_multsect, 1, 1, &drive->mult_count, set_multcount);
ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr);
ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL);
ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache);
ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic);
ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL);
ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
}
#else
static inline void idedisk_add_settings(ide_drive_t *drive) { ; }
#endif

static void idedisk_setup (ide_drive_t *drive)
{
Expand Down Expand Up @@ -1001,7 +1014,7 @@ static void ide_disk_remove(ide_drive_t *drive)
struct ide_disk_obj *idkp = drive->driver_data;
struct gendisk *g = idkp->disk;

ide_unregister_subdriver(drive, idkp->driver);
ide_proc_unregister_driver(drive, idkp->driver);

del_gendisk(g);

Expand Down Expand Up @@ -1066,7 +1079,9 @@ static ide_driver_t idedisk_driver = {
.end_request = ide_end_request,
.error = __ide_error,
.abort = __ide_abort,
#ifdef CONFIG_IDE_PROC_FS
.proc = idedisk_proc,
#endif
};

static int idedisk_open(struct inode *inode, struct file *filp)
Expand Down Expand Up @@ -1140,9 +1155,49 @@ static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
static int idedisk_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
unsigned long flags;
struct block_device *bdev = inode->i_bdev;
struct ide_disk_obj *idkp = ide_disk_g(bdev->bd_disk);
return generic_ide_ioctl(idkp->drive, file, bdev, cmd, arg);
ide_drive_t *drive = idkp->drive;
int err, (*setfunc)(ide_drive_t *, int);
u8 *val;

switch (cmd) {
case HDIO_GET_ADDRESS: val = &drive->addressing; goto read_val;
case HDIO_GET_MULTCOUNT: val = &drive->mult_count; goto read_val;
case HDIO_GET_NOWERR: val = &drive->nowerr; goto read_val;
case HDIO_GET_WCACHE: val = &drive->wcache; goto read_val;
case HDIO_GET_ACOUSTIC: val = &drive->acoustic; goto read_val;
case HDIO_SET_ADDRESS: setfunc = set_lba_addressing; goto set_val;
case HDIO_SET_MULTCOUNT: setfunc = set_multcount; goto set_val;
case HDIO_SET_NOWERR: setfunc = set_nowerr; goto set_val;
case HDIO_SET_WCACHE: setfunc = write_cache; goto set_val;
case HDIO_SET_ACOUSTIC: setfunc = set_acoustic; goto set_val;
}

return generic_ide_ioctl(drive, file, bdev, cmd, arg);

read_val:
down(&ide_setting_sem);
spin_lock_irqsave(&ide_lock, flags);
err = *val;
spin_unlock_irqrestore(&ide_lock, flags);
up(&ide_setting_sem);
return err >= 0 ? put_user(err, (long __user *)arg) : err;

set_val:
if (bdev != bdev->bd_contains)
err = -EINVAL;
else {
if (!capable(CAP_SYS_ADMIN))
err = -EACCES;
else {
down(&ide_setting_sem);
err = setfunc(drive, arg);
up(&ide_setting_sem);
}
}
return err;
}

static int idedisk_media_changed(struct gendisk *disk)
Expand Down Expand Up @@ -1202,7 +1257,7 @@ static int ide_disk_probe(ide_drive_t *drive)

ide_init_disk(g, drive);

ide_register_subdriver(drive, &idedisk_driver);
ide_proc_register_driver(drive, &idedisk_driver);

kref_init(&idkp->kref);

Expand Down
Loading

0 comments on commit 3cb7396

Please sign in to comment.