Commit 24ae9cff authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.6-pre2 IDE cleanup 16

There is no such a thing like a ide-clean-15. Never was.  But here comes
what has been done in ide-clean-16:

- Apply a patch for the initialization of the second PIIX channel.
   Found by Daniel Quinlan <quinlan@transmeta.com>

- Apply a patch for the DMA initialization of the serverworks chip.
   Ken Brownfield <brownfld@irridia.com>

- Make the ata_operations methods immune against device type drivers,
   which donot provide them by separating the access to them out. Audit
   them all.

- Resynchronize with 2.5.6-pre1.

- Remove unused IDE_DRIVE_CMD, IDE_DRIVE_TASK, IDE_DRIVE_TASK_MASK,
   IDE_DRIVE_TASKFILE macros.

- Disable configuration of the task file stuff. It is going to go away
   and will be replaced by a truly abstract interface based on
   functionality and *not* direct mess-up of hardware.

- Resync with 2.5.6-pre2.

- Add HPT entries to the fall-back list, since otherwise the driver
   won'trecognize the drives. We will have to make this the default
   behavior for allnot recognized host chip types.

- Fix compilation with no PCI host chip support enabled.

- Apply the overflow fixes for HPT366 by Vojtech Pavlik.

- Kill the one-shoot functions ide_wait_cmd_taks() ide_wait_cmd() by
   moving them to the places where they are actually used. Fix a
   potential buffer overflow on the way.

- Fix usage of ide.c as module. Thanks to Adam J. Richter for figuring
   out what was wrong.

- Various cleanups all along as well as removal of TONS of
   unfinished/dead code.

I think it's sometimes better to remove stuff, which isn't there,
instead of hoping for a "magical day" where it will be finished.
parent 3d7af078
...@@ -237,7 +237,6 @@ CONFIG_BLK_DEV_IDECD=y ...@@ -237,7 +237,6 @@ CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
......
...@@ -378,7 +378,6 @@ CONFIG_BLK_DEV_IDE=m ...@@ -378,7 +378,6 @@ CONFIG_BLK_DEV_IDE=m
# CONFIG_BLK_DEV_IDECD is not set # CONFIG_BLK_DEV_IDECD is not set
# CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_IDE_TASK_IOCTL is not set
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
......
...@@ -239,7 +239,6 @@ CONFIG_BLK_DEV_IDECD=y ...@@ -239,7 +239,6 @@ CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_BLK_DEV_IDESCSI is not set
CONFIG_IDE_TASK_IOCTL=y
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
......
...@@ -273,7 +273,6 @@ CONFIG_BLK_DEV_IDECD=y ...@@ -273,7 +273,6 @@ CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
......
...@@ -188,7 +188,6 @@ CONFIG_BLK_DEV_IDEDISK=y ...@@ -188,7 +188,6 @@ CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
......
...@@ -807,14 +807,6 @@ CONFIG_IDEDISK_STROKE ...@@ -807,14 +807,6 @@ CONFIG_IDEDISK_STROKE
If you are unsure, say N here. If you are unsure, say N here.
CONFIG_IDE_TASK_IOCTL
This is a direct raw access to the media. It is a complex but
elegant solution to test and validate the domain of the hardware and
perform below the driver data recovery if needed. This is the most
basic form of media-forensics.
If you are unsure, say N here.
CONFIG_BLK_DEV_IDEDMA_FORCED CONFIG_BLK_DEV_IDEDMA_FORCED
This is an old piece of lost code from Linux 2.0 Kernels. This is an old piece of lost code from Linux 2.0 Kernels.
......
...@@ -33,9 +33,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then ...@@ -33,9 +33,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_tristate ' Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE dep_tristate ' Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
dep_tristate ' SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE $CONFIG_SCSI dep_tristate ' SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE $CONFIG_SCSI
bool ' IDE Taskfile Access' CONFIG_IDE_TASK_IOCTL comment 'IDE chipset support'
comment 'IDE chipset support/bugfixes'
if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_bool ' CMD640 chipset bugfix/support' CONFIG_BLK_DEV_CMD640 $CONFIG_X86 dep_bool ' CMD640 chipset bugfix/support' CONFIG_BLK_DEV_CMD640 $CONFIG_X86
dep_bool ' CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED $CONFIG_BLK_DEV_CMD640 dep_bool ' CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED $CONFIG_BLK_DEV_CMD640
......
...@@ -374,7 +374,8 @@ static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -374,7 +374,8 @@ static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count)
class_rev &= 0xff; class_rev &= 0xff;
p += sprintf(p, "\nController: %d\n", i); p += sprintf(p, "\nController: %d\n", i);
p += sprintf(p, "Chipset: HPT%s\n", chipset_nums[class_rev]); p += sprintf(p, "Chipset: HPT%s\n",
class_rev < sizeof(chipset_nums) / sizeof(char *) ? chipset_nums[class_rev] : "???");
p += sprintf(p, "--------------- Primary Channel " p += sprintf(p, "--------------- Primary Channel "
"--------------- Secondary Channel " "--------------- Secondary Channel "
"--------------\n"); "--------------\n");
...@@ -1119,12 +1120,11 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev) ...@@ -1119,12 +1120,11 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev)
if (test != 0x08) if (test != 0x08)
pci_write_config_byte(dev, PCI_MAX_LAT, 0x08); pci_write_config_byte(dev, PCI_MAX_LAT, 0x08);
if (pci_rev_check_hpt3xx(dev)) { if (pci_rev_check_hpt3xx(dev))
init_hpt370(dev); init_hpt370(dev);
if (n_hpt_devs < HPT366_MAX_DEVS)
hpt_devs[n_hpt_devs++] = dev; hpt_devs[n_hpt_devs++] = dev;
} else {
hpt_devs[n_hpt_devs++] = dev;
}
#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) #if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
if (!hpt366_proc) { if (!hpt366_proc) {
......
...@@ -2906,69 +2906,29 @@ int ide_cdrom_cleanup(ide_drive_t *drive) ...@@ -2906,69 +2906,29 @@ int ide_cdrom_cleanup(ide_drive_t *drive)
return 0; return 0;
} }
static int ide_cdrom_reinit (ide_drive_t *drive);
static struct ata_operations ide_cdrom_driver = { static struct ata_operations ide_cdrom_driver = {
owner: THIS_MODULE, owner: THIS_MODULE,
cleanup: ide_cdrom_cleanup, cleanup: ide_cdrom_cleanup,
standby: NULL, standby: NULL,
flushcache: NULL,
do_request: ide_do_rw_cdrom, do_request: ide_do_rw_cdrom,
end_request: NULL, end_request: NULL,
ioctl: ide_cdrom_ioctl, ioctl: ide_cdrom_ioctl,
open: ide_cdrom_open, open: ide_cdrom_open,
release: ide_cdrom_release, release: ide_cdrom_release,
media_change: ide_cdrom_check_media_change, check_media_change: ide_cdrom_check_media_change,
revalidate: ide_cdrom_revalidate, revalidate: ide_cdrom_revalidate,
pre_reset: NULL, pre_reset: NULL,
capacity: ide_cdrom_capacity, capacity: ide_cdrom_capacity,
special: NULL, special: NULL,
proc: NULL, proc: NULL
driver_reinit: ide_cdrom_reinit,
}; };
/* options */ /* options */
char *ignore = NULL; static char *ignore = NULL;
MODULE_PARM(ignore, "s"); MODULE_PARM(ignore, "s");
MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
static int ide_cdrom_reinit (ide_drive_t *drive)
{
struct cdrom_info *info;
int failed = 0;
MOD_INC_USE_COUNT;
info = (struct cdrom_info *) kmalloc (sizeof (struct cdrom_info), GFP_KERNEL);
if (info == NULL) {
printk ("%s: Can't allocate a cdrom structure\n", drive->name);
return 1;
}
if (ide_register_subdriver (drive, &ide_cdrom_driver)) {
printk ("%s: Failed to register the driver with ide.c\n", drive->name);
kfree (info);
return 1;
}
memset (info, 0, sizeof (struct cdrom_info));
drive->driver_data = info;
/* ATA-PATTERN */
ata_ops(drive)->busy++;
if (ide_cdrom_setup (drive)) {
ata_ops(drive)->busy--;
if (ide_cdrom_cleanup (drive))
printk ("%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name);
return 1;
}
ata_ops(drive)->busy--;
failed--;
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
}
static void __exit ide_cdrom_exit(void) static void __exit ide_cdrom_exit(void)
{ {
ide_drive_t *drive; ide_drive_t *drive;
......
...@@ -351,7 +351,19 @@ static int idedisk_open (struct inode *inode, struct file *filp, ide_drive_t *dr ...@@ -351,7 +351,19 @@ static int idedisk_open (struct inode *inode, struct file *filp, ide_drive_t *dr
return 0; return 0;
} }
static int do_idedisk_flushcache(ide_drive_t *drive); static int idedisk_flushcache(ide_drive_t *drive)
{
struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile;
memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
if (drive->id->cfs_enable_2 & 0x2400) {
taskfile.command = WIN_FLUSH_CACHE_EXT;
} else {
taskfile.command = WIN_FLUSH_CACHE;
}
return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
}
static void idedisk_release (struct inode *inode, struct file *filp, ide_drive_t *drive) static void idedisk_release (struct inode *inode, struct file *filp, ide_drive_t *drive)
{ {
...@@ -367,15 +379,16 @@ static void idedisk_release (struct inode *inode, struct file *filp, ide_drive_t ...@@ -367,15 +379,16 @@ static void idedisk_release (struct inode *inode, struct file *filp, ide_drive_t
drive->doorlocking = 0; drive->doorlocking = 0;
} }
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache) if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
if (do_idedisk_flushcache(drive)) if (idedisk_flushcache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n", printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
drive->name); drive->name);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
static int idedisk_media_change (ide_drive_t *drive) static int idedisk_check_media_change (ide_drive_t *drive)
{ {
return drive->removable; /* if removable, always assume it was changed */ /* if removable, always assume it was changed */
return drive->removable;
} }
/* /*
...@@ -836,7 +849,7 @@ static int write_cache (ide_drive_t *drive, int arg) ...@@ -836,7 +849,7 @@ static int write_cache (ide_drive_t *drive, int arg)
return 0; return 0;
} }
static int do_idedisk_standby (ide_drive_t *drive) static int idedisk_standby (ide_drive_t *drive)
{ {
struct hd_drive_task_hdr taskfile; struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile; struct hd_drive_hob_hdr hobfile;
...@@ -846,20 +859,6 @@ static int do_idedisk_standby (ide_drive_t *drive) ...@@ -846,20 +859,6 @@ static int do_idedisk_standby (ide_drive_t *drive)
return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL); return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
} }
static int do_idedisk_flushcache (ide_drive_t *drive)
{
struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile;
memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
if (drive->id->cfs_enable_2 & 0x2400) {
taskfile.command = WIN_FLUSH_CACHE_EXT;
} else {
taskfile.command = WIN_FLUSH_CACHE;
}
return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
}
static int set_acoustic (ide_drive_t *drive, int arg) static int set_acoustic (ide_drive_t *drive, int arg)
{ {
struct hd_drive_task_hdr taskfile; struct hd_drive_task_hdr taskfile;
...@@ -1040,72 +1039,36 @@ static void idedisk_setup(ide_drive_t *drive) ...@@ -1040,72 +1039,36 @@ static void idedisk_setup(ide_drive_t *drive)
static int idedisk_cleanup (ide_drive_t *drive) static int idedisk_cleanup (ide_drive_t *drive)
{ {
/* FIXME: we will have to think twice whatever this is the proper place
* to do it.
*/
put_device(&drive->device); put_device(&drive->device);
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache) if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
if (do_idedisk_flushcache(drive)) if (idedisk_flushcache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n", printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
drive->name); drive->name);
return ide_unregister_subdriver(drive); return ide_unregister_subdriver(drive);
} }
static int idedisk_reinit(ide_drive_t *drive);
/* /*
* IDE subdriver functions, registered with ide.c * IDE subdriver functions, registered with ide.c
*/ */
static struct ata_operations idedisk_driver = { static struct ata_operations idedisk_driver = {
owner: THIS_MODULE, owner: THIS_MODULE,
cleanup: idedisk_cleanup, cleanup: idedisk_cleanup,
standby: do_idedisk_standby, standby: idedisk_standby,
flushcache: do_idedisk_flushcache,
do_request: do_rw_disk, do_request: do_rw_disk,
end_request: NULL, end_request: NULL,
ioctl: NULL, ioctl: NULL,
open: idedisk_open, open: idedisk_open,
release: idedisk_release, release: idedisk_release,
media_change: idedisk_media_change, check_media_change: idedisk_check_media_change,
revalidate: ide_revalidate_drive, revalidate: NULL, /* use default method */
pre_reset: idedisk_pre_reset, pre_reset: idedisk_pre_reset,
capacity: idedisk_capacity, capacity: idedisk_capacity,
special: idedisk_special, special: idedisk_special,
proc: idedisk_proc, proc: idedisk_proc
driver_reinit: idedisk_reinit,
}; };
MODULE_DESCRIPTION("ATA DISK Driver"); MODULE_DESCRIPTION("ATA DISK Driver");
static int idedisk_reinit(ide_drive_t *drive)
{
int failed = 0;
MOD_INC_USE_COUNT;
if (ide_register_subdriver (drive, &idedisk_driver)) {
printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name);
return 1;
}
ata_ops(drive)->busy++;
idedisk_setup(drive);
if ((!drive->head || drive->head > 16) && !drive->select.b.lba) {
printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n", drive->name, drive->head);
idedisk_cleanup(drive);
ata_ops(drive)->busy--;
return 1;
}
ata_ops(drive)->busy--;
failed--;
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
}
static void __exit idedisk_exit (void) static void __exit idedisk_exit (void)
{ {
ide_drive_t *drive; ide_drive_t *drive;
...@@ -1136,15 +1099,12 @@ int idedisk_init (void) ...@@ -1136,15 +1099,12 @@ int idedisk_init (void)
printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name); printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name);
continue; continue;
} }
ata_ops(drive)->busy++;
idedisk_setup(drive); idedisk_setup(drive);
if ((!drive->head || drive->head > 16) && !drive->select.b.lba) { if ((!drive->head || drive->head > 16) && !drive->select.b.lba) {
printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n", drive->name, drive->head); printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n", drive->name, drive->head);
idedisk_cleanup(drive); idedisk_cleanup(drive);
ata_ops(drive)->busy--;
continue; continue;
} }
ata_ops(drive)->busy--;
failed--; failed--;
} }
revalidate_drives(); revalidate_drives();
......
...@@ -1819,7 +1819,7 @@ static void idefloppy_release (struct inode *inode, struct file *filp, ide_drive ...@@ -1819,7 +1819,7 @@ static void idefloppy_release (struct inode *inode, struct file *filp, ide_drive
/* /*
* Check media change. Use a simple algorithm for now. * Check media change. Use a simple algorithm for now.
*/ */
static int idefloppy_media_change (ide_drive_t *drive) static int idefloppy_check_media_change (ide_drive_t *drive)
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
...@@ -2038,8 +2038,6 @@ static ide_proc_entry_t idefloppy_proc[] = { ...@@ -2038,8 +2038,6 @@ static ide_proc_entry_t idefloppy_proc[] = {
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
static int idefloppy_reinit(ide_drive_t *drive);
/* /*
* IDE subdriver functions, registered with ide.c * IDE subdriver functions, registered with ide.c
*/ */
...@@ -2047,58 +2045,19 @@ static struct ata_operations idefloppy_driver = { ...@@ -2047,58 +2045,19 @@ static struct ata_operations idefloppy_driver = {
owner: THIS_MODULE, owner: THIS_MODULE,
cleanup: idefloppy_cleanup, cleanup: idefloppy_cleanup,
standby: NULL, standby: NULL,
flushcache: NULL,
do_request: idefloppy_do_request, do_request: idefloppy_do_request,
end_request: idefloppy_end_request, end_request: idefloppy_end_request,
ioctl: idefloppy_ioctl, ioctl: idefloppy_ioctl,
open: idefloppy_open, open: idefloppy_open,
release: idefloppy_release, release: idefloppy_release,
media_change: idefloppy_media_change, check_media_change: idefloppy_check_media_change,
revalidate: ide_revalidate_drive, revalidate: NULL, /* use default method */
pre_reset: NULL, pre_reset: NULL,
capacity: idefloppy_capacity, capacity: idefloppy_capacity,
special: NULL, special: NULL,
proc: idefloppy_proc, proc: idefloppy_proc
driver_reinit: idefloppy_reinit,
}; };
static int idefloppy_reinit (ide_drive_t *drive)
{
idefloppy_floppy_t *floppy;
int failed = 0;
MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices(ATA_FLOPPY, "ide-floppy", NULL, failed++)) != NULL) {
if (!idefloppy_identify_device (drive, drive->id)) {
printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name);
continue;
}
if (drive->scsi) {
printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
}
if ((floppy = (idefloppy_floppy_t *) kmalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
continue;
}
if (ide_register_subdriver (drive, &idefloppy_driver)) {
printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (floppy);
continue;
}
/* ATA-PATTERN */
ata_ops(drive)->busy++;
idefloppy_setup (drive, floppy);
ata_ops(drive)->busy--;
failed--;
}
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
}
MODULE_DESCRIPTION("ATAPI FLOPPY Driver"); MODULE_DESCRIPTION("ATAPI FLOPPY Driver");
static void __exit idefloppy_exit (void) static void __exit idefloppy_exit (void)
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
extern ide_drive_t * get_info_ptr(kdev_t); extern ide_drive_t * get_info_ptr(kdev_t);
extern unsigned long current_capacity (ide_drive_t *);
/* /*
* If heads is nonzero: find a translation with this many heads and S=63. * If heads is nonzero: find a translation with this many heads and S=63.
* Otherwise: find out how OnTrack Disk Manager would translate the disk. * Otherwise: find out how OnTrack Disk Manager would translate the disk.
*/ */
static void static void
ontrack(ide_drive_t *drive, int heads, unsigned int *c, int *h, int *s) { ontrack(ide_drive_t *drive, int heads, unsigned int *c, int *h, int *s)
{
static const byte dm_head_vals[] = {4, 8, 16, 32, 64, 128, 255, 0}; static const byte dm_head_vals[] = {4, 8, 16, 32, 64, 128, 255, 0};
const byte *headp = dm_head_vals; const byte *headp = dm_head_vals;
unsigned long total; unsigned long total;
...@@ -34,7 +34,7 @@ ontrack(ide_drive_t *drive, int heads, unsigned int *c, int *h, int *s) { ...@@ -34,7 +34,7 @@ ontrack(ide_drive_t *drive, int heads, unsigned int *c, int *h, int *s) {
* computes a geometry different from what OnTrack uses.] * computes a geometry different from what OnTrack uses.]
*/ */
total = ata_ops(drive)->capacity(drive); total = ata_capacity(drive);
*s = 63; *s = 63;
...@@ -136,7 +136,7 @@ int ide_xlate_1024 (kdev_t i_rdev, int xparm, int ptheads, const char *msg) ...@@ -136,7 +136,7 @@ int ide_xlate_1024 (kdev_t i_rdev, int xparm, int ptheads, const char *msg)
ret = 1; ret = 1;
} }
drive->part[0].nr_sects = current_capacity(drive); drive->part[0].nr_sects = ata_capacity(drive);
if (ret) if (ret)
printk("%s%s [%d/%d/%d]", msg, msg1, printk("%s%s [%d/%d/%d]", msg, msg1,
......
...@@ -303,7 +303,9 @@ static ide_pci_device_t pci_chipsets[] __initdata = { ...@@ -303,7 +303,9 @@ static ide_pci_device_t pci_chipsets[] __initdata = {
#ifdef CONFIG_BLK_DEV_IT8172 #ifdef CONFIG_BLK_DEV_IT8172
{PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_IT8172G, pci_init_it8172, NULL, ide_init_it8172, NULL, {{0x00,0x00,0x00}, {0x40,0x00,0x01}}, ON_BOARD, 0, 0 }, {PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_IT8172G, pci_init_it8172, NULL, ide_init_it8172, NULL, {{0x00,0x00,0x00}, {0x40,0x00,0x01}}, ON_BOARD, 0, 0 },
#endif #endif
/* Those are id's of chips we don't deal currently with. */ /* Those are id's of chips we don't deal currently with,
* but which still need some generic quirk handling.
*/
{PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 }, {PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_CMD_640, NULL, NULL, IDE_IGNORE, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 }, {PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_CMD_640, NULL, NULL, IDE_IGNORE, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, NULL, NULL, NULL, NULL, {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, ON_BOARD, 0, 0 }, {PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, NULL, NULL, NULL, NULL, {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, ON_BOARD, 0, 0 },
...@@ -313,6 +315,7 @@ static ide_pci_device_t pci_chipsets[] __initdata = { ...@@ -313,6 +315,7 @@ static ide_pci_device_t pci_chipsets[] __initdata = {
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ }, {PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ }, {PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
{PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_NOADMA }, {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_NOADMA },
{PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT366, NULL, NULL, IDE_NO_DRIVER, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, OFF_BOARD, 240, ATA_F_IRQ | ATA_F_HPTHACK },
{0, 0, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }}; {0, 0, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }};
/* /*
......
...@@ -471,9 +471,11 @@ static void hwif_register (ide_hwif_t *hwif) ...@@ -471,9 +471,11 @@ static void hwif_register (ide_hwif_t *hwif)
sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]); sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
sprintf(hwif->device.name, "ide"); sprintf(hwif->device.name, "ide");
hwif->device.driver_data = hwif; hwif->device.driver_data = hwif;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev) if (hwif->pci_dev)
hwif->device.parent = &hwif->pci_dev->dev; hwif->device.parent = &hwif->pci_dev->dev;
else else
#endif
hwif->device.parent = NULL; /* Would like to do = &device_legacy */ hwif->device.parent = NULL; /* Would like to do = &device_legacy */
device_register(&hwif->device); device_register(&hwif->device);
......
...@@ -353,7 +353,7 @@ int proc_ide_read_capacity ...@@ -353,7 +353,7 @@ int proc_ide_read_capacity
if (!driver) if (!driver)
len = sprintf(page, "(none)\n"); len = sprintf(page, "(none)\n");
else else
len = sprintf(page,"%llu\n", (unsigned long long) drive->driver->capacity(drive)); len = sprintf(page,"%llu\n", (unsigned long long) ata_capacity(drive));
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
} }
......
...@@ -6140,7 +6140,12 @@ static ide_proc_entry_t idetape_proc[] = { ...@@ -6140,7 +6140,12 @@ static ide_proc_entry_t idetape_proc[] = {
#endif #endif
static int idetape_reinit(ide_drive_t *drive); static void idetape_revalidate(ide_drive_t *_dummy)
{
/* We don't have to handle any partition information here, which is the
* default behaviour of this method.
*/
}
/* /*
* IDE subdriver functions, registered with ide.c * IDE subdriver functions, registered with ide.c
...@@ -6149,18 +6154,16 @@ static struct ata_operations idetape_driver = { ...@@ -6149,18 +6154,16 @@ static struct ata_operations idetape_driver = {
owner: THIS_MODULE, owner: THIS_MODULE,
cleanup: idetape_cleanup, cleanup: idetape_cleanup,
standby: NULL, standby: NULL,
flushcache: NULL,
do_request: idetape_do_request, do_request: idetape_do_request,
end_request: idetape_end_request, end_request: idetape_end_request,
ioctl: idetape_blkdev_ioctl, ioctl: idetape_blkdev_ioctl,
open: idetape_blkdev_open, open: idetape_blkdev_open,
release: idetape_blkdev_release, release: idetape_blkdev_release,
media_change: NULL, check_media_change: NULL,
revalidate: NULL, revalidate: idetape_revalidate,
pre_reset: idetape_pre_reset, pre_reset: idetape_pre_reset,
capacity: NULL, capacity: NULL,
proc: idetape_proc, proc: idetape_proc
driver_reinit: idetape_reinit,
}; };
/* /*
...@@ -6175,12 +6178,6 @@ static struct file_operations idetape_fops = { ...@@ -6175,12 +6178,6 @@ static struct file_operations idetape_fops = {
release: idetape_chrdev_release, release: idetape_chrdev_release,
}; };
/* This will propably just go entierly away... */
static int idetape_reinit (ide_drive_t *drive)
{
return 1;
}
MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -1750,6 +1750,29 @@ int ide_taskfile_ioctl (ide_drive_t *drive, struct inode *inode, struct file *fi ...@@ -1750,6 +1750,29 @@ int ide_taskfile_ioctl (ide_drive_t *drive, struct inode *inode, struct file *fi
return err; return err;
} }
/*
* Issue ATA command and wait for completion. use for implementing commands in
* kernel.
*
* The caller has to make sure buf is never NULL!
*/
static int ide_wait_cmd(ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *argbuf)
{
struct request rq;
/* FIXME: Do we really have to zero out the buffer?
*/
memset(argbuf, 0, 4 + SECTOR_WORDS * 4 * sectors);
ide_init_drive_cmd(&rq);
rq.buffer = argbuf;
*argbuf++ = cmd;
*argbuf++ = nsect;
*argbuf++ = feature;
*argbuf++ = sectors;
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
int err = 0; int err = 0;
...@@ -1806,12 +1829,20 @@ int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, u ...@@ -1806,12 +1829,20 @@ int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, u
int ide_task_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) int ide_task_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
int err = 0; int err = 0;
byte args[7], *argbuf = args; u8 args[7];
u8 *argbuf;
int argsize = 7; int argsize = 7;
struct request rq;
argbuf = args;
if (copy_from_user(args, (void *)arg, 7)) if (copy_from_user(args, (void *)arg, 7))
return -EFAULT; return -EFAULT;
err = ide_wait_cmd_task(drive, argbuf);
ide_init_drive_cmd(&rq);
rq.flags = REQ_DRIVE_TASK;
rq.buffer = argbuf;
err = ide_do_drive_cmd(drive, &rq, ide_wait);
if (copy_to_user((void *)arg, argbuf, argsize)) if (copy_to_user((void *)arg, argbuf, argsize))
err = -EFAULT; err = -EFAULT;
return err; return err;
......
...@@ -581,15 +581,76 @@ void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, ...@@ -581,15 +581,76 @@ void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
} }
static void ata_pre_reset (ide_drive_t *drive)
{
if (ata_ops(drive) && ata_ops(drive)->pre_reset)
ata_ops(drive)->pre_reset(drive);
if (!drive->keep_settings && !drive->using_dma) {
drive->unmask = 0;
drive->io_32bit = 0;
}
if (drive->using_dma) {
/* check the DMA crc count */
if (drive->crc_count) {
HWIF(drive)->dmaproc(ide_dma_off_quietly, drive);
if ((HWIF(drive)->speedproc) != NULL)
HWIF(drive)->speedproc(drive, ide_auto_reduce_xfer(drive));
if (drive->current_speed >= XFER_SW_DMA_0)
HWIF(drive)->dmaproc(ide_dma_on, drive);
} else
HWIF(drive)->dmaproc(ide_dma_off, drive);
}
}
/* /*
* The capacity of a drive according to its current geometry/LBA settings in * The capacity of a drive according to its current geometry/LBA settings in
* sectors. * sectors.
*/ */
unsigned long current_capacity (ide_drive_t *drive) unsigned long ata_capacity(ide_drive_t *drive)
{ {
if (!drive->present || !drive->driver) if (!drive->present || !drive->driver)
return 0; return 0;
if (ata_ops(drive) && ata_ops(drive)->capacity)
return ata_ops(drive)->capacity(drive); return ata_ops(drive)->capacity(drive);
/* FIXME: This magic number seems to be bogous. */
return 0x7fffffff;
}
/*
* This is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT commands to
* a drive. It used to do much more, but has been scaled back.
*/
static ide_startstop_t ata_special (ide_drive_t *drive)
{
special_t *s = &drive->special;
#ifdef DEBUG
printk("%s: ata_special: 0x%02x\n", drive->name, s->all);
#endif
if (s->b.set_tune) {
ide_tuneproc_t *tuneproc = HWIF(drive)->tuneproc;
s->b.set_tune = 0;
if (tuneproc != NULL)
tuneproc(drive, drive->tune_req);
} else if (drive->driver != NULL) {
if (ata_ops(drive)->special)
return ata_ops(drive)->special(drive);
else {
drive->special.all = 0;
drive->mult_req = 0;
return ide_stopped;
}
} else if (s->all) {
printk("%s: bad special flag: 0x%02x\n", drive->name, s->all);
s->all = 0;
}
return ide_stopped;
} }
extern struct block_device_operations ide_fops[]; extern struct block_device_operations ide_fops[];
...@@ -612,9 +673,8 @@ void ide_geninit (ide_hwif_t *hwif) ...@@ -612,9 +673,8 @@ void ide_geninit (ide_hwif_t *hwif)
register_disk(gd,mk_kdev(hwif->major,unit<<PARTN_BITS), register_disk(gd,mk_kdev(hwif->major,unit<<PARTN_BITS),
#ifdef CONFIG_BLK_DEV_ISAPNP #ifdef CONFIG_BLK_DEV_ISAPNP
(drive->forced_geom && drive->noprobe) ? 1 : (drive->forced_geom && drive->noprobe) ? 1 :
#endif /* CONFIG_BLK_DEV_ISAPNP */ #endif
1<<PARTN_BITS, ide_fops, 1 << PARTN_BITS, ide_fops, ata_capacity(drive));
current_capacity(drive));
} }
} }
...@@ -702,37 +762,6 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) ...@@ -702,37 +762,6 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
return ide_stopped; return ide_stopped;
} }
static void check_dma_crc (ide_drive_t *drive)
{
if (drive->crc_count) {
(void) HWIF(drive)->dmaproc(ide_dma_off_quietly, drive);
if ((HWIF(drive)->speedproc) != NULL)
HWIF(drive)->speedproc(drive, ide_auto_reduce_xfer(drive));
if (drive->current_speed >= XFER_SW_DMA_0)
(void) HWIF(drive)->dmaproc(ide_dma_on, drive);
} else {
(void) HWIF(drive)->dmaproc(ide_dma_off, drive);
}
}
static void pre_reset (ide_drive_t *drive)
{
if (drive->driver != NULL)
ata_ops(drive)->pre_reset(drive);
if (!drive->keep_settings) {
if (drive->using_dma) {
check_dma_crc(drive);
} else {
drive->unmask = 0;
drive->io_32bit = 0;
}
return;
}
if (drive->using_dma)
check_dma_crc(drive);
}
/* /*
* do_reset1() attempts to recover a confused drive by resetting it. * do_reset1() attempts to recover a confused drive by resetting it.
* Unfortunately, resetting a disk drive actually resets all devices on * Unfortunately, resetting a disk drive actually resets all devices on
...@@ -760,7 +789,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -760,7 +789,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
/* For an ATAPI device, first try an ATAPI SRST. */ /* For an ATAPI device, first try an ATAPI SRST. */
if (drive->type != ATA_DISK && !do_not_try_atapi) { if (drive->type != ATA_DISK && !do_not_try_atapi) {
pre_reset(drive); ata_pre_reset(drive);
SELECT_DRIVE(hwif,drive); SELECT_DRIVE(hwif,drive);
udelay (20); udelay (20);
OUT_BYTE (WIN_SRST, IDE_COMMAND_REG); OUT_BYTE (WIN_SRST, IDE_COMMAND_REG);
...@@ -775,7 +804,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -775,7 +804,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
* for any of the drives on this interface. * for any of the drives on this interface.
*/ */
for (unit = 0; unit < MAX_DRIVES; ++unit) for (unit = 0; unit < MAX_DRIVES; ++unit)
pre_reset(&hwif->drives[unit]); ata_pre_reset(&hwif->drives[unit]);
#if OK_TO_RESET_CONTROLLER #if OK_TO_RESET_CONTROLLER
if (!IDE_CONTROL_REG) { if (!IDE_CONTROL_REG) {
...@@ -1044,7 +1073,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat) ...@@ -1044,7 +1073,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat)
if (rq->errors >= ERROR_MAX) { if (rq->errors >= ERROR_MAX) {
/* ATA-PATTERN */ /* ATA-PATTERN */
if (drive->driver != NULL) if (ata_ops(drive) && ata_ops(drive)->end_request)
ata_ops(drive)->end_request(drive, 0); ata_ops(drive)->end_request(drive, 0);
else else
ide_end_request(drive, 0); ide_end_request(drive, 0);
...@@ -1100,31 +1129,6 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) ...@@ -1100,31 +1129,6 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
return ide_stopped; return ide_stopped;
} }
/*
* do_special() is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT
* commands to a drive. It used to do much more, but has been scaled back.
*/
static ide_startstop_t do_special (ide_drive_t *drive)
{
special_t *s = &drive->special;
#ifdef DEBUG
printk("%s: do_special: 0x%02x\n", drive->name, s->all);
#endif
if (s->b.set_tune) {
ide_tuneproc_t *tuneproc = HWIF(drive)->tuneproc;
s->b.set_tune = 0;
if (tuneproc != NULL)
tuneproc(drive, drive->tune_req);
} else if (drive->driver != NULL) {
return ata_ops(drive)->special(drive);
} else if (s->all) {
printk("%s: bad special flag: 0x%02x\n", drive->name, s->all);
s->all = 0;
}
return ide_stopped;
}
/* /*
* This routine busy-waits for the drive status to be not "busy". * This routine busy-waits for the drive status to be not "busy".
* It then checks the status for all of the "good" bits and none * It then checks the status for all of the "good" bits and none
...@@ -1338,16 +1342,21 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) ...@@ -1338,16 +1342,21 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE))
return execute_drive_cmd(drive, rq); return execute_drive_cmd(drive, rq);
if (drive->driver != NULL) { if (ata_ops(drive)) {
if (ata_ops(drive)->do_request)
return ata_ops(drive)->do_request(drive, rq, block); return ata_ops(drive)->do_request(drive, rq, block);
else {
ide_end_request(drive, 0);
return ide_stopped;
}
} }
printk(KERN_WARNING "%s: device type %d not supported\n", printk(KERN_WARNING "%s: device type %d not supported\n",
drive->name, drive->type); drive->name, drive->type);
goto kill_rq; goto kill_rq;
} }
return do_special(drive); return ata_special(drive);
kill_rq: kill_rq:
if (drive->driver != NULL) if (ata_ops(drive) && ata_ops(drive)->end_request)
ata_ops(drive)->end_request(drive, 0); ata_ops(drive)->end_request(drive, 0);
else else
ide_end_request(drive, 0); ide_end_request(drive, 0);
...@@ -1569,13 +1578,13 @@ void ide_dma_timeout_retry(ide_drive_t *drive) ...@@ -1569,13 +1578,13 @@ void ide_dma_timeout_retry(ide_drive_t *drive)
/* /*
* end current dma transaction * end current dma transaction
*/ */
(void) hwif->dmaproc(ide_dma_end, drive); hwif->dmaproc(ide_dma_end, drive);
/* /*
* complain a little, later we might remove some of this verbosity * complain a little, later we might remove some of this verbosity
*/ */
printk("%s: timeout waiting for DMA\n", drive->name); printk("%s: timeout waiting for DMA\n", drive->name);
(void) hwif->dmaproc(ide_dma_timeout, drive); hwif->dmaproc(ide_dma_timeout, drive);
/* /*
* disable dma for now, but remember that we did so because of * disable dma for now, but remember that we did so because of
...@@ -1584,7 +1593,7 @@ void ide_dma_timeout_retry(ide_drive_t *drive) ...@@ -1584,7 +1593,7 @@ void ide_dma_timeout_retry(ide_drive_t *drive)
*/ */
drive->retry_pio++; drive->retry_pio++;
drive->state = DMA_PIO_RETRY; drive->state = DMA_PIO_RETRY;
(void) hwif->dmaproc(ide_dma_off_quietly, drive); hwif->dmaproc(ide_dma_off_quietly, drive);
/* /*
* un-busy drive etc (hwgroup->busy is cleared on return) and * un-busy drive etc (hwgroup->busy is cleared on return) and
...@@ -1937,16 +1946,6 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio ...@@ -1937,16 +1946,6 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
} }
/* Common for ide-floppy.c and ide-disk.c */
void ide_revalidate_drive (ide_drive_t *drive)
{
struct gendisk *g = HWIF(drive)->gd;
int minor = (drive->select.b.unit << g->minor_shift);
kdev_t dev = mk_kdev(g->major, minor);
grok_partitions(dev, current_capacity(drive));
}
/* /*
* This routine is called to flush all partitions and partition tables * This routine is called to flush all partitions and partition tables
* for a changed disk, and then re-read the new partition table. * for a changed disk, and then re-read the new partition table.
...@@ -1975,13 +1974,16 @@ int ide_revalidate_disk (kdev_t i_rdev) ...@@ -1975,13 +1974,16 @@ int ide_revalidate_disk (kdev_t i_rdev)
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
res = wipe_partitions(i_rdev); res = wipe_partitions(i_rdev);
if (res) if (!res) {
goto leave; if (ata_ops(drive) && ata_ops(drive)->revalidate) {
ata_get(ata_ops(drive));
if (ata_ops(drive)->revalidate) /* this is a no-op for tapes and SCSI based access */
ata_ops(drive)->revalidate(drive); ata_ops(drive)->revalidate(drive);
ata_put(ata_ops(drive));
} else
grok_partitions(i_rdev, ata_capacity(drive));
}
leave:
drive->busy = 0; drive->busy = 0;
wake_up(&drive->wqueue); wake_up(&drive->wqueue);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
...@@ -2073,9 +2075,14 @@ static int ide_open (struct inode * inode, struct file * filp) ...@@ -2073,9 +2075,14 @@ static int ide_open (struct inode * inode, struct file * filp)
#endif /* CONFIG_KMOD */ #endif /* CONFIG_KMOD */
while (drive->busy) while (drive->busy)
sleep_on(&drive->wqueue); sleep_on(&drive->wqueue);
drive->usage++; ++drive->usage;
if (drive->driver != NULL) if (ata_ops(drive) && ata_ops(drive)->open)
return ata_ops(drive)->open(inode, filp, drive); return ata_ops(drive)->open(inode, filp, drive);
else {
--drive->usage;
return -ENODEV;
}
printk ("%s: driver not present\n", drive->name); printk ("%s: driver not present\n", drive->name);
drive->usage--; drive->usage--;
return -ENXIO; return -ENXIO;
...@@ -2085,15 +2092,16 @@ static int ide_open (struct inode * inode, struct file * filp) ...@@ -2085,15 +2092,16 @@ static int ide_open (struct inode * inode, struct file * filp)
* Releasing a block device means we sync() it, so that it can safely * Releasing a block device means we sync() it, so that it can safely
* be forgotten about... * be forgotten about...
*/ */
static int ide_release (struct inode * inode, struct file * file) static int ide_release(struct inode * inode, struct file * file)
{ {
ide_drive_t *drive; ide_drive_t *drive;
if ((drive = get_info_ptr(inode->i_rdev)) != NULL) { if (!(drive = get_info_ptr(inode->i_rdev)))
return 0;
drive->usage--; drive->usage--;
if (drive->driver != NULL) if (ata_ops(drive) && ata_ops(drive)->release)
ata_ops(drive)->release(inode, file, drive); ata_ops(drive)->release(inode, file, drive);
}
return 0; return 0;
} }
...@@ -2164,8 +2172,14 @@ void ide_unregister (unsigned int index) ...@@ -2164,8 +2172,14 @@ void ide_unregister (unsigned int index)
continue; continue;
if (drive->busy || drive->usage) if (drive->busy || drive->usage)
goto abort; goto abort;
if (drive->driver != NULL && ata_ops(drive)->cleanup(drive)) if (ata_ops(drive)) {
if (ata_ops(drive)->cleanup) {
if (ata_ops(drive)->cleanup(drive))
goto abort; goto abort;
} else {
ide_unregister_subdriver(drive);
}
}
} }
hwif->present = 0; hwif->present = 0;
...@@ -2595,33 +2609,6 @@ void ide_add_generic_settings (ide_drive_t *drive) ...@@ -2595,33 +2609,6 @@ void ide_add_generic_settings (ide_drive_t *drive)
ide_add_setting(drive, "number", SETTING_RW, -1, -1, TYPE_BYTE, 0, 3, 1, 1, &drive->dn, NULL); ide_add_setting(drive, "number", SETTING_RW, -1, -1, TYPE_BYTE, 0, 3, 1, 1, &drive->dn, NULL);
} }
int ide_wait_cmd (ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *buf)
{
struct request rq;
byte buffer[4];
if (!buf)
buf = buffer;
memset(buf, 0, 4 + SECTOR_WORDS * 4 * sectors);
ide_init_drive_cmd(&rq);
rq.buffer = buf;
*buf++ = cmd;
*buf++ = nsect;
*buf++ = feature;
*buf++ = sectors;
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
int ide_wait_cmd_task (ide_drive_t *drive, byte *buf)
{
struct request rq;
ide_init_drive_cmd(&rq);
rq.flags = REQ_DRIVE_TASK;
rq.buffer = buf;
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
/* /*
* Delay for *at least* 50ms. As we don't know how much time is left * Delay for *at least* 50ms. As we don't know how much time is left
* until the next tick occurs, we wait an extra tick to be safe. * until the next tick occurs, we wait an extra tick to be safe.
...@@ -2721,7 +2708,8 @@ static int ide_ioctl (struct inode *inode, struct file *file, ...@@ -2721,7 +2708,8 @@ static int ide_ioctl (struct inode *inode, struct file *file,
} }
case BLKRRPART: /* Re-read partition tables */ case BLKRRPART: /* Re-read partition tables */
if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return ide_revalidate_disk(inode->i_rdev); return ide_revalidate_disk(inode->i_rdev);
case HDIO_OBSOLETE_IDENTITY: case HDIO_OBSOLETE_IDENTITY:
...@@ -2866,9 +2854,9 @@ static int ide_ioctl (struct inode *inode, struct file *file, ...@@ -2866,9 +2854,9 @@ static int ide_ioctl (struct inode *inode, struct file *file,
return 0; return 0;
default: default:
if (drive->driver != NULL) if (ata_ops(drive) && ata_ops(drive)->ioctl)
return ata_ops(drive)->ioctl(drive, inode, file, cmd, arg); return ata_ops(drive)->ioctl(drive, inode, file, cmd, arg);
return -EPERM; return -EINVAL;
} }
} }
...@@ -2878,8 +2866,14 @@ static int ide_check_media_change (kdev_t i_rdev) ...@@ -2878,8 +2866,14 @@ static int ide_check_media_change (kdev_t i_rdev)
if ((drive = get_info_ptr(i_rdev)) == NULL) if ((drive = get_info_ptr(i_rdev)) == NULL)
return -ENODEV; return -ENODEV;
if (drive->driver != NULL) if (ata_ops(drive)) {
return ata_ops(drive)->media_change(drive); ata_get(ata_ops(drive));
if (ata_ops(drive)->check_media_change)
return ata_ops(drive)->check_media_change(drive);
else
return 1; /* assume it was changed */
ata_put(ata_ops(drive));
}
return 0; return 0;
} }
...@@ -3470,24 +3464,24 @@ void __init ide_init_builtin_drivers (void) ...@@ -3470,24 +3464,24 @@ void __init ide_init_builtin_drivers (void)
*/ */
probe_for_hwifs (); probe_for_hwifs ();
#ifdef CONFIG_BLK_DEV_IDE #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULES)
#if defined(__mc68000__) || defined(CONFIG_APUS) # if defined(__mc68000__) || defined(CONFIG_APUS)
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) { if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) {
ide_get_lock(&ide_intr_lock, NULL, NULL);/* for atari only */ ide_get_lock(&ide_intr_lock, NULL, NULL);/* for atari only */
disable_irq(ide_hwifs[0].irq); /* disable_irq_nosync ?? */ disable_irq(ide_hwifs[0].irq); /* disable_irq_nosync ?? */
// disable_irq_nosync(ide_hwifs[0].irq); // disable_irq_nosync(ide_hwifs[0].irq);
} }
#endif /* __mc68000__ || CONFIG_APUS */ # endif
ideprobe_init(); ideprobe_init();
#if defined(__mc68000__) || defined(CONFIG_APUS) # if defined(__mc68000__) || defined(CONFIG_APUS)
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) { if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) {
enable_irq(ide_hwifs[0].irq); enable_irq(ide_hwifs[0].irq);
ide_release_lock(&ide_intr_lock);/* for atari only */ ide_release_lock(&ide_intr_lock);/* for atari only */
} }
#endif /* __mc68000__ || CONFIG_APUS */ # endif
#endif /* CONFIG_BLK_DEV_IDE */ #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_ide_create(); proc_ide_create();
...@@ -3517,79 +3511,12 @@ void __init ide_init_builtin_drivers (void) ...@@ -3517,79 +3511,12 @@ void __init ide_init_builtin_drivers (void)
#endif #endif
} }
static int default_cleanup (ide_drive_t *drive)
{
return ide_unregister_subdriver(drive);
}
static int default_standby (ide_drive_t *drive)
{
return 0;
}
static int default_flushcache (ide_drive_t *drive)
{
return 0;
}
static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, unsigned long block)
{
ide_end_request(drive, 0);
return ide_stopped;
}
/* This is the default end request function as well */ /* This is the default end request function as well */
int ide_end_request(ide_drive_t *drive, int uptodate) int ide_end_request(ide_drive_t *drive, int uptodate)
{ {
return __ide_end_request(drive, uptodate, 0); return __ide_end_request(drive, uptodate, 0);
} }
static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
return -EIO;
}
static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
{
drive->usage--;
return -EIO;
}
static void default_release (struct inode *inode, struct file *filp, ide_drive_t *drive)
{
}
static int default_check_media_change (ide_drive_t *drive)
{
return 1;
}
static void default_pre_reset (ide_drive_t *drive)
{
}
static unsigned long default_capacity (ide_drive_t *drive)
{
return 0x7fffffff;
}
static ide_startstop_t default_special (ide_drive_t *drive)
{
special_t *s = &drive->special;
s->all = 0;
drive->mult_req = 0;
return ide_stopped;
}
static int default_driver_reinit (ide_drive_t *drive)
{
printk(KERN_ERR "%s: does not support hotswap of device class !\n", drive->name);
return 0;
}
/* /*
* Lookup IDE devices, which requested a particular deriver * Lookup IDE devices, which requested a particular deriver
*/ */
...@@ -3627,37 +3554,11 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver) ...@@ -3627,37 +3554,11 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver)
return 1; return 1;
} }
drive->driver = driver; /* FIXME: This will be pushed to the drivers! Thus allowing us to
* save one parameter here eparate this out.
*/
/* Fill in the default handlers drive->driver = driver;
*/
if (driver->cleanup == NULL)
driver->cleanup = default_cleanup;
if (driver->standby == NULL)
driver->standby = default_standby;
if (driver->flushcache == NULL)
driver->flushcache = default_flushcache;
if (driver->do_request == NULL)
driver->do_request = default_do_request;
if (driver->end_request == NULL)
driver->end_request = ide_end_request;
if (driver->ioctl == NULL)
driver->ioctl = default_ioctl;
if (driver->open == NULL)
driver->open = default_open;
if (driver->release == NULL)
driver->release = default_release;
if (driver->media_change == NULL)
driver->media_change = default_check_media_change;
if (driver->pre_reset == NULL)
driver->pre_reset = default_pre_reset;
if (driver->capacity == NULL)
driver->capacity = default_capacity;
if (driver->special == NULL)
driver->special = default_special;
if (driver->driver_reinit == NULL)
driver->driver_reinit = default_driver_reinit;
restore_flags(flags); /* all CPUs */ restore_flags(flags); /* all CPUs */
/* FIXME: Check what this magic number is supposed to be about? */ /* FIXME: Check what this magic number is supposed to be about? */
...@@ -3684,25 +3585,32 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver) ...@@ -3684,25 +3585,32 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver)
drive->suspend_reset = 0; drive->suspend_reset = 0;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
ide_add_proc_entries(drive->proc, generic_subdriver_entries, drive); ide_add_proc_entries(drive->proc, generic_subdriver_entries, drive);
ide_add_proc_entries(drive->proc, driver->proc, drive); if (ata_ops(drive))
ide_add_proc_entries(drive->proc, ata_ops(drive)->proc, drive);
#endif #endif
return 0; return 0;
} }
/*
* This is in fact the default cleanup routine.
*
* FIXME: Check whatever we maybe don't call it twice!.
*/
int ide_unregister_subdriver(ide_drive_t *drive) int ide_unregister_subdriver(ide_drive_t *drive)
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); /* all CPUs */ save_flags(flags); /* all CPUs */
cli(); /* all CPUs */ cli(); /* all CPUs */
if (drive->usage || drive->busy || drive->driver == NULL || ata_ops(drive)->busy) { if (drive->usage || drive->busy || !ata_ops(drive) || ata_ops(drive)->busy) {
restore_flags(flags); /* all CPUs */ restore_flags(flags); /* all CPUs */
return 1; return 1;
} }
#if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP) && defined(MODULE) #if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP) && defined(MODULE)
pnpide_init(0); pnpide_init(0);
#endif /* CONFIG_BLK_DEV_ISAPNP */ #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (ata_ops(drive))
ide_remove_proc_entries(drive->proc, ata_ops(drive)->proc); ide_remove_proc_entries(drive->proc, ata_ops(drive)->proc);
ide_remove_proc_entries(drive->proc, generic_subdriver_entries); ide_remove_proc_entries(drive->proc, generic_subdriver_entries);
#endif #endif
...@@ -3778,11 +3686,8 @@ EXPORT_SYMBOL(ide_do_drive_cmd); ...@@ -3778,11 +3686,8 @@ EXPORT_SYMBOL(ide_do_drive_cmd);
EXPORT_SYMBOL(ide_end_drive_cmd); EXPORT_SYMBOL(ide_end_drive_cmd);
EXPORT_SYMBOL(__ide_end_request); EXPORT_SYMBOL(__ide_end_request);
EXPORT_SYMBOL(ide_end_request); EXPORT_SYMBOL(ide_end_request);
EXPORT_SYMBOL(ide_revalidate_drive);
EXPORT_SYMBOL(ide_revalidate_disk); EXPORT_SYMBOL(ide_revalidate_disk);
EXPORT_SYMBOL(ide_cmd); EXPORT_SYMBOL(ide_cmd);
EXPORT_SYMBOL(ide_wait_cmd);
EXPORT_SYMBOL(ide_wait_cmd_task);
EXPORT_SYMBOL(ide_delay_50ms); EXPORT_SYMBOL(ide_delay_50ms);
EXPORT_SYMBOL(ide_stall_queue); EXPORT_SYMBOL(ide_stall_queue);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -3798,7 +3703,6 @@ EXPORT_SYMBOL(ide_register); ...@@ -3798,7 +3703,6 @@ EXPORT_SYMBOL(ide_register);
EXPORT_SYMBOL(ide_unregister); EXPORT_SYMBOL(ide_unregister);
EXPORT_SYMBOL(ide_setup_ports); EXPORT_SYMBOL(ide_setup_ports);
EXPORT_SYMBOL(get_info_ptr); EXPORT_SYMBOL(get_info_ptr);
EXPORT_SYMBOL(current_capacity);
static int ide_notify_reboot (struct notifier_block *this, unsigned long event, void *x) static int ide_notify_reboot (struct notifier_block *this, unsigned long event, void *x)
{ {
...@@ -3828,12 +3732,14 @@ static int ide_notify_reboot (struct notifier_block *this, unsigned long event, ...@@ -3828,12 +3732,14 @@ static int ide_notify_reboot (struct notifier_block *this, unsigned long event,
/* set the drive to standby */ /* set the drive to standby */
printk("%s ", drive->name); printk("%s ", drive->name);
if (ata_ops(drive)) {
if (event != SYS_RESTART) if (event != SYS_RESTART)
if (drive->driver != NULL && ata_ops(drive)->standby(drive)) if (ata_ops(drive)->standby && ata_ops(drive)->standby(drive))
continue; continue;
if (drive->driver != NULL && ata_ops(drive)->cleanup(drive)) if (ata_ops(drive)->cleanup)
continue; ata_ops(drive)->cleanup(drive);
}
} }
} }
printk("\n"); printk("\n");
...@@ -3928,7 +3834,7 @@ static void __exit cleanup_ata (void) ...@@ -3928,7 +3834,7 @@ static void __exit cleanup_ata (void)
ide_unregister(index); ide_unregister(index);
# if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI) # if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
if (ide_hwifs[index].dma_base) if (ide_hwifs[index].dma_base)
(void) ide_release_dma(&ide_hwifs[index]); ide_release_dma(&ide_hwifs[index]);
# endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */ # endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */
} }
......
...@@ -214,7 +214,7 @@ static void piix_tune_drive (ide_drive_t *drive, byte pio) ...@@ -214,7 +214,7 @@ static void piix_tune_drive (ide_drive_t *drive, byte pio)
{ {
unsigned long flags; unsigned long flags;
u16 master_data; u16 master_data;
byte slave_data; u8 slave_data;
int is_slave = (&HWIF(drive)->drives[1] == drive); int is_slave = (&HWIF(drive)->drives[1] == drive);
int master_port = HWIF(drive)->index ? 0x42 : 0x40; int master_port = HWIF(drive)->index ? 0x42 : 0x40;
int slave_port = 0x44; int slave_port = 0x44;
......
...@@ -660,8 +660,10 @@ void __init ide_init_svwks (ide_hwif_t *hwif) ...@@ -660,8 +660,10 @@ void __init ide_init_svwks (ide_hwif_t *hwif)
hwif->autodma = 0; hwif->autodma = 0;
#else /* CONFIG_BLK_DEV_IDEDMA */ #else /* CONFIG_BLK_DEV_IDEDMA */
if (hwif->dma_base) { if (hwif->dma_base) {
#ifdef CONFIG_IDEDMA_AUTO
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
#endif
hwif->dmaproc = &svwks_dmaproc; hwif->dmaproc = &svwks_dmaproc;
hwif->highmem = 1; hwif->highmem = 1;
} else { } else {
......
...@@ -536,7 +536,11 @@ static int idescsi_cleanup (ide_drive_t *drive) ...@@ -536,7 +536,11 @@ static int idescsi_cleanup (ide_drive_t *drive)
return 0; return 0;
} }
static int idescsi_reinit(ide_drive_t *drive); static void idescsi_revalidate(ide_drive_t *_dummy)
{
/* The partition information will be handled by the SCSI layer.
*/
}
/* /*
* IDE subdriver functions, registered with ide.c * IDE subdriver functions, registered with ide.c
...@@ -545,26 +549,19 @@ static struct ata_operations idescsi_driver = { ...@@ -545,26 +549,19 @@ static struct ata_operations idescsi_driver = {
owner: THIS_MODULE, owner: THIS_MODULE,
cleanup: idescsi_cleanup, cleanup: idescsi_cleanup,
standby: NULL, standby: NULL,
flushcache: NULL,
do_request: idescsi_do_request, do_request: idescsi_do_request,
end_request: idescsi_end_request, end_request: idescsi_end_request,
ioctl: NULL, ioctl: NULL,
open: idescsi_open, open: idescsi_open,
release: idescsi_ide_release, release: idescsi_ide_release,
media_change: NULL, check_media_change: NULL,
revalidate: NULL, revalidate: idescsi_revalidate,
pre_reset: NULL, pre_reset: NULL,
capacity: NULL, capacity: NULL,
special: NULL, special: NULL,
proc: NULL, proc: NULL
driver_reinit: idescsi_reinit,
}; };
static int idescsi_reinit (ide_drive_t *drive)
{
return 0;
}
/* /*
* idescsi_init will register the driver for each scsi. * idescsi_init will register the driver for each scsi.
*/ */
......
...@@ -51,28 +51,16 @@ ...@@ -51,28 +51,16 @@
#endif #endif
#ifdef CONFIG_BLK_DEV_CMD640 #ifdef CONFIG_BLK_DEV_CMD640
#if 0 /* change to 1 when debugging cmd640 problems */ # if 0 /* change to 1 when debugging cmd640 problems */
void cmd640_dump_regs (void); void cmd640_dump_regs (void);
#define CMD640_DUMP_REGS cmd640_dump_regs() /* for debugging cmd640 chipset */ # define CMD640_DUMP_REGS cmd640_dump_regs() /* for debugging cmd640 chipset */
# endif
#endif #endif
#endif /* CONFIG_BLK_DEV_CMD640 */
#ifndef DISABLE_IRQ_NOSYNC #ifndef DISABLE_IRQ_NOSYNC
#define DISABLE_IRQ_NOSYNC 0 # define DISABLE_IRQ_NOSYNC 0
#endif #endif
/*
* IDE_DRIVE_CMD is used to implement many features of the hdparm utility
*/
#define IDE_DRIVE_CMD 99 /* (magic) undef to reduce kernel size*/
#define IDE_DRIVE_TASK 98
/*
* IDE_DRIVE_TASKFILE is used to implement many features needed for raw tasks
*/
#define IDE_DRIVE_TASKFILE 97
/* /*
* "No user-serviceable parts" beyond this point :) * "No user-serviceable parts" beyond this point :)
*****************************************************************************/ *****************************************************************************/
...@@ -95,7 +83,7 @@ typedef unsigned char byte; /* used everywhere */ ...@@ -95,7 +83,7 @@ typedef unsigned char byte; /* used everywhere */
* Ensure that various configuration flags have compatible settings * Ensure that various configuration flags have compatible settings
*/ */
#ifdef REALLY_SLOW_IO #ifdef REALLY_SLOW_IO
#undef REALLY_FAST_IO # undef REALLY_FAST_IO
#endif #endif
#define HWIF(drive) ((drive)->hwif) #define HWIF(drive) ((drive)->hwif)
...@@ -705,21 +693,19 @@ struct ata_operations { ...@@ -705,21 +693,19 @@ struct ata_operations {
unsigned busy: 1; /* FIXME: this will go soon away... */ unsigned busy: 1; /* FIXME: this will go soon away... */
int (*cleanup)(ide_drive_t *); int (*cleanup)(ide_drive_t *);
int (*standby)(ide_drive_t *); int (*standby)(ide_drive_t *);
int (*flushcache)(ide_drive_t *);
ide_startstop_t (*do_request)(ide_drive_t *, struct request *, unsigned long); ide_startstop_t (*do_request)(ide_drive_t *, struct request *, unsigned long);
int (*end_request)(ide_drive_t *drive, int uptodate); int (*end_request)(ide_drive_t *drive, int uptodate);
int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
int (*open)(struct inode *, struct file *, ide_drive_t *); int (*open)(struct inode *, struct file *, ide_drive_t *);
void (*release)(struct inode *, struct file *, ide_drive_t *); void (*release)(struct inode *, struct file *, ide_drive_t *);
int (*media_change)(ide_drive_t *); int (*check_media_change)(ide_drive_t *);
void (*revalidate)(ide_drive_t *); void (*revalidate)(ide_drive_t *);
void (*pre_reset)(ide_drive_t *); void (*pre_reset)(ide_drive_t *);
unsigned long (*capacity)(ide_drive_t *); unsigned long (*capacity)(ide_drive_t *);
ide_startstop_t (*special)(ide_drive_t *); ide_startstop_t (*special)(ide_drive_t *);
ide_proc_entry_t *proc; ide_proc_entry_t *proc;
int (*driver_reinit)(ide_drive_t *);
}; };
/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ /* Alas, no aliases. Too much hassle with bringing module.h everywhere */
...@@ -734,6 +720,7 @@ do { \ ...@@ -734,6 +720,7 @@ do { \
__MOD_DEC_USE_COUNT((ata)->owner); \ __MOD_DEC_USE_COUNT((ata)->owner); \
} while(0) } while(0)
extern unsigned long ata_capacity(ide_drive_t *drive);
/* FIXME: Actually implement and use them as soon as possible! to make the /* FIXME: Actually implement and use them as soon as possible! to make the
* ide_scan_devices() go away! */ * ide_scan_devices() go away! */
...@@ -818,16 +805,6 @@ int ide_xlate_1024 (kdev_t, int, int, const char *); ...@@ -818,16 +805,6 @@ int ide_xlate_1024 (kdev_t, int, int, const char *);
*/ */
ide_drive_t *get_info_ptr (kdev_t i_rdev); ide_drive_t *get_info_ptr (kdev_t i_rdev);
/*
* Return the current idea about the total capacity of this drive.
*/
unsigned long current_capacity (ide_drive_t *drive);
/*
* Revalidate (read partition tables)
*/
extern void ide_revalidate_drive (ide_drive_t *drive);
/* /*
* Start a reset operation for an IDE interface. * Start a reset operation for an IDE interface.
* The caller should return immediately after invoking this. * The caller should return immediately after invoking this.
...@@ -892,18 +869,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio ...@@ -892,18 +869,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
/* /*
* Clean up after success/failure of an explicit drive cmd. * Clean up after success/failure of an explicit drive cmd.
* stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD).
* stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK).
*/ */
void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err); void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err);
/*
* Issue ATA command and wait for completion. use for implementing commands in kernel
*/
int ide_wait_cmd (ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *buf);
int ide_wait_cmd_task (ide_drive_t *drive, byte *buf);
typedef struct ide_task_s { typedef struct ide_task_s {
task_ioreg_t tfRegister[8]; task_ioreg_t tfRegister[8];
task_ioreg_t hobRegister[8]; task_ioreg_t hobRegister[8];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment