Commit 13413379 authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents 6177c8bb ac5bdbb7
......@@ -37,9 +37,27 @@
***
*** Use of the "serialize" option is no longer necessary.
This is the multiple IDE interface driver, as evolved from hd.c. It supports
up to 9 IDE interfaces per default, on one or more IRQs (usually 14 & 15).
There can be up to two drives per interface, as per the ATA-6 spec.
================================================================================
Common pitfalls:
- 40-conductor IDE cables are capable of transfering data in DMA modes up to
udma2, but no faster.
- If possible devices should be attached to separate channels if they are
available. Typically the disk on the first and CD-ROM on the second.
- If you mix devices on the same cable, please consider using similar devices
in respect of the data transfer mode they support.
- Even better tru to stick to the same vendor and device type on the same
cable.
================================================================================
This is the multiple IDE interface driver, as evolved from hd.c.
It supports up to 9 IDE interfaces per default, on one or more IRQs (usually
14 & 15). There can be up to two drives per interface, as per the ATA-6 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
......
......@@ -192,7 +192,7 @@ unsigned char IN_BYTE(ide_ioreg_t reg) {
#define ATA_PIO0_HOLD 4
static int e100_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq);
static void e100_ideproc (ide_ide_action_t func, ide_drive_t *drive,
static void e100_ideproc (ide_ide_action_t func, struct ata_device *drive,
void *buffer, unsigned int length);
/*
......@@ -206,7 +206,7 @@ const char *good_dma_drives[] = {"Micropolis 2112A",
"CONNER CTT8000-A",
NULL};
static void tune_e100_ide(ide_drive_t *drive, byte pio)
static void tune_e100_ide(struct ata_device *drive, byte pio)
{
unsigned long flags;
......@@ -380,7 +380,7 @@ static etrax_dma_descr mydescr;
* extra byte allocated for the buffer.
*/
static void
e100_atapi_read(ide_drive_t *drive, void *buffer, unsigned int bytecount)
e100_atapi_read(struct ata_device *drive, void *buffer, unsigned int bytecount)
{
ide_ioreg_t data_reg = IDE_DATA_REG;
......@@ -459,7 +459,7 @@ e100_atapi_read(ide_drive_t *drive, void *buffer, unsigned int bytecount)
}
static void
e100_atapi_write(ide_drive_t *drive, void *buffer, unsigned int bytecount)
e100_atapi_write(struct ata_device *drive, void *buffer, unsigned int bytecount)
{
ide_ioreg_t data_reg = IDE_DATA_REG;
......@@ -546,7 +546,7 @@ e100_atapi_write(ide_drive_t *drive, void *buffer, unsigned int bytecount)
* This is used for most PIO data transfers *from* the IDE interface
*/
static void
e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
e100_ide_input_data (struct ata_device *drive, void *buffer, unsigned int wcount)
{
e100_atapi_read(drive, buffer, wcount << 2);
}
......@@ -555,7 +555,7 @@ e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
* This is used for most PIO data transfers *to* the IDE interface
*/
static void
e100_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
e100_ide_output_data (struct ata_device *drive, void *buffer, unsigned int wcount)
{
e100_atapi_write(drive, buffer, wcount << 2);
}
......@@ -661,7 +661,7 @@ static int e100_udma_new_table(struct ata_channel *ch, struct request *rq)
return 1; /* let the PIO routines handle this weirdness */
}
static int config_drive_for_dma (ide_drive_t *drive)
static int config_drive_for_dma (struct ata_device *drive)
{
const char **list;
struct hd_driveid *id = drive->id;
......
......@@ -131,12 +131,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
bool ' IGNORE word93 Validation BITS' CONFIG_IDEDMA_IVB
fi
if [ "$CONFIG_BLK_DEV_IDECD" != "n" -o \
"$CONFIG_BLK_DEV_IDETAPE" != "n" -o \
"$CONFIG_BLK_DEV_IDEFLOPPY" != "n" -o \
"$CONFIG_BLK_DEV_IDESCSI" != "n" ]; then
define_bool CONFIG_ATAPI y
fi
else
bool 'Old hard disk (MFM/RLL/IDE) driver' CONFIG_BLK_DEV_HD_ONLY
define_bool CONFIG_BLK_DEV_HD $CONFIG_BLK_DEV_HD_ONLY
......
......@@ -21,7 +21,7 @@ obj-$(CONFIG_BLK_DEV_HD) += hd.o
obj-$(CONFIG_BLK_DEV_IDE) += ide-mod.o
obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o
obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o
obj-$(CONFIG_ATAPI) += atapi.o
# obj-$(CONFIG_ATAPI) += atapi.o
obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o
obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o
obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o
......@@ -74,6 +74,6 @@ obj-$(CONFIG_BLK_DEV_ATARAID) += ataraid.o
obj-$(CONFIG_BLK_DEV_ATARAID_PDC) += pdcraid.o
obj-$(CONFIG_BLK_DEV_ATARAID_HPT) += hptraid.o
ide-mod-objs := ide-taskfile.o ide.o ide-probe.o ide-geometry.o ide-features.o ata-timing.o $(ide-obj-y)
ide-mod-objs := ide-taskfile.o ide.o ide-probe.o ide-geometry.o ide-features.o ata-timing.o atapi.o $(ide-obj-y)
include $(TOPDIR)/Rules.make
......@@ -607,27 +607,7 @@ static struct ata_pci_device chipsets[] __initdata = {
enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP865,
init_chipset: aec62xx_init_chipset,
ata66_check: aec62xx_ata66_check,
init_channel: aec62xx_init_channel,
enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
bootable: NEVER_BOARD,
flags: ATA_F_IRQ | ATA_F_NOADMA | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP865R,
init_chipset: aec62xx_init_chipset,
ata66_check: aec62xx_ata66_check,
init_channel: aec62xx_init_channel,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
}
};
int __init init_aec62xx(void)
......
......@@ -226,9 +226,9 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timi
* by upper layers.
*/
static int amd_set_drive(ide_drive_t *drive, unsigned char speed)
static int amd_set_drive(struct ata_device *drive, unsigned char speed)
{
ide_drive_t *peer = drive->channel->drives + (~drive->dn & 1);
struct ata_device *peer = drive->channel->drives + (~drive->dn & 1);
struct ata_timing t, p;
int T, UT;
......@@ -263,7 +263,7 @@ static int amd_set_drive(ide_drive_t *drive, unsigned char speed)
* PIO-only tuning.
*/
static void amd74xx_tune_drive(ide_drive_t *drive, unsigned char pio)
static void amd74xx_tune_drive(struct ata_device *drive, u8 pio)
{
if (!((amd_enabled >> drive->channel->unit) & 1))
return;
......
......@@ -81,7 +81,7 @@ extern char *ide_xfer_verbose (byte xfer_rate);
/*
* Set a new transfer mode at the drive
*/
int cs5530_set_xfer_mode (ide_drive_t *drive, byte mode)
int cs5530_set_xfer_mode(struct ata_device *drive, byte mode)
{
int error = 0;
......@@ -113,7 +113,7 @@ static unsigned int cs5530_pio_timings[2][5] =
* The ide_init_cs5530() routine guarantees that all drives
* will have valid default PIO timings set up before we get here.
*/
static void cs5530_tuneproc (ide_drive_t *drive, byte pio) /* pio=255 means "autotune" */
static void cs5530_tuneproc(struct ata_device *drive, byte pio) /* pio=255 means "autotune" */
{
struct ata_channel *hwif = drive->channel;
unsigned int format, basereg = CS5530_BASEREG(hwif);
......@@ -134,12 +134,12 @@ static void cs5530_tuneproc (ide_drive_t *drive, byte pio) /* pio=255 means "aut
* cs5530_config_dma() handles selection/setting of DMA/UDMA modes
* for both the chipset and drive.
*/
static int cs5530_config_dma (ide_drive_t *drive)
static int cs5530_config_dma(struct ata_device *drive)
{
int udma_ok = 1, mode = 0;
struct ata_channel *hwif = drive->channel;
int unit = drive->select.b.unit;
ide_drive_t *mate = &hwif->drives[unit^1];
struct ata_device *mate = &hwif->drives[unit^1];
struct hd_driveid *id = drive->id;
unsigned int basereg, reg, timings;
......
......@@ -183,7 +183,7 @@ static void compute_clocks (byte pio, pio_clocks_t *p_pclk)
/*
* set DMA mode a specific channel for CY82C693
*/
static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
static void cy82c693_dma_enable(struct ata_device *drive, int mode, int single)
{
byte index;
byte data;
......@@ -270,7 +270,7 @@ static int cy82c693_dmaproc(struct ata_device *drive)
/*
* tune ide drive - set PIO mode
*/
static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
static void cy82c693_tune_drive(struct ata_device *drive, byte pio)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......
......@@ -66,7 +66,7 @@ static void sub22 (char b, char c)
}
}
static void tune_dtc2278 (ide_drive_t *drive, byte pio)
static void tune_dtc2278(struct ata_device *drive, byte pio)
{
unsigned long flags;
......
......@@ -94,9 +94,9 @@ static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count)
byte hpt34x_proc = 0;
extern char *ide_xfer_verbose (byte xfer_rate);
extern char *ide_xfer_verbose(byte xfer_rate);
static void hpt34x_clear_chipset (ide_drive_t *drive)
static void hpt34x_clear_chipset(struct ata_device *drive)
{
unsigned int reg1 = 0, tmp1 = 0;
unsigned int reg2 = 0, tmp2 = 0;
......@@ -109,7 +109,7 @@ static void hpt34x_clear_chipset (ide_drive_t *drive)
pci_write_config_dword(drive->channel->pci_dev, 0x48, tmp2);
}
static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
static int hpt34x_tune_chipset(struct ata_device *drive, byte speed)
{
byte hi_speed, lo_speed;
unsigned int reg1 = 0, tmp1 = 0;
......@@ -145,7 +145,7 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
return ide_config_drive_speed(drive, speed);
}
static void config_chipset_for_pio(ide_drive_t *drive)
static void config_chipset_for_pio(struct ata_device *drive)
{
unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
unsigned short xfer_pio = drive->id->eide_pio_modes;
......@@ -182,7 +182,7 @@ static void config_chipset_for_pio(ide_drive_t *drive)
(void) hpt34x_tune_chipset(drive, speed);
}
static void hpt34x_tune_drive (ide_drive_t *drive, byte pio)
static void hpt34x_tune_drive(struct ata_device *drive, byte pio)
{
byte speed;
......
This diff is collapsed.
......@@ -230,7 +230,7 @@ static unsigned long maxsectors (int major,int minor)
{
unsigned long lba = 0;
kdev_t dev;
ide_drive_t *ideinfo;
struct ata_device *ideinfo;
dev = mk_kdev(major,minor);
ideinfo = get_info_ptr (dev);
......
......@@ -120,7 +120,7 @@
/*
* This routine is invoked from ide.c to prepare for access to a given drive.
*/
static void ht6560b_selectproc (ide_drive_t *drive)
static void ht6560b_selectproc(struct ata_device *drive)
{
unsigned long flags;
static byte current_select = 0;
......@@ -195,7 +195,7 @@ static int __init try_to_init_ht6560b(void)
return 1;
}
static byte ht_pio2timings(ide_drive_t *drive, byte pio)
static byte ht_pio2timings(struct ata_device *drive, byte pio)
{
int active_time, recovery_time;
int active_cycles, recovery_cycles;
......@@ -248,7 +248,7 @@ static byte ht_pio2timings(ide_drive_t *drive, byte pio)
/*
* Enable/Disable so called prefetch mode
*/
static void ht_set_prefetch(ide_drive_t *drive, byte state)
static void ht_set_prefetch(struct ata_device *drive, byte state)
{
unsigned long flags;
int t = HT_PREFETCH_MODE << 8;
......@@ -275,7 +275,7 @@ static void ht_set_prefetch(ide_drive_t *drive, byte state)
#endif
}
static void tune_ht6560b (ide_drive_t *drive, byte pio)
static void tune_ht6560b(struct ata_device *drive, byte pio)
{
unsigned long flags;
byte timing;
......
......@@ -2925,8 +2925,11 @@ int ide_cdrom_cleanup(struct ata_device *drive)
return 0;
}
static void ide_cdrom_attach(struct ata_device *drive);
static struct ata_operations ide_cdrom_driver = {
owner: THIS_MODULE,
attach: ide_cdrom_attach,
cleanup: ide_cdrom_cleanup,
standby: NULL,
do_request: ide_cdrom_do_request,
......@@ -2942,67 +2945,63 @@ static struct ata_operations ide_cdrom_driver = {
/* options */
static char *ignore = NULL;
MODULE_PARM(ignore, "s");
MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
static void __exit ide_cdrom_exit(void)
static void ide_cdrom_attach(struct ata_device *drive)
{
struct ata_device *drive;
int failed = 0;
struct cdrom_info *info;
char *req;
struct ata_channel *channel;
int unit;
while ((drive = ide_scan_devices(ATA_ROM, "ide-cdrom", &ide_cdrom_driver, failed)) != NULL)
if (ide_cdrom_cleanup (drive)) {
printk ("%s: cleanup_module() called while still busy\n", drive->name);
failed++;
}
}
if (drive->type != ATA_ROM)
return;
int ide_cdrom_init(void)
{
struct ata_device *drive;
struct cdrom_info *info;
int failed = 0;
req = drive->driver_req;
if (req[0] != '\0' && strcmp(req, "ide-cdrom"))
return;
MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices (ATA_ROM, "ide-cdrom", NULL, failed++)) != NULL) {
/* skip drives that we were told to ignore */
if (ignore != NULL) {
if (strstr(ignore, drive->name)) {
printk("ide-cd: ignoring drive %s\n", drive->name);
continue;
}
}
if (drive->scsi) {
printk("ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
if (ignore && !strcmp(ignore, drive->name)) {
printk(KERN_INFO "%s: ignored\n", drive->name);
return;
}
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);
continue;
if (!info) {
printk(KERN_ERR "%s: Can't allocate a cdrom structure\n", drive->name);
return;
}
if (ide_register_subdriver (drive, &ide_cdrom_driver)) {
printk ("%s: Failed to register the driver with ide.c\n", drive->name);
printk(KERN_ERR "%s: Failed to register the driver with ide.c\n", drive->name);
kfree (info);
continue;
return;
}
memset(info, 0, sizeof (struct cdrom_info));
drive->driver_data = info;
MOD_INC_USE_COUNT;
if (ide_cdrom_setup (drive)) {
MOD_DEC_USE_COUNT;
if (ide_cdrom_cleanup (drive))
printk ("%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name);
continue;
printk (KERN_ERR "%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name);
return;
}
MOD_DEC_USE_COUNT;
failed--;
}
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
channel = drive->channel;
unit = drive - channel->drives;
ide_revalidate_disk(mk_kdev(channel->major, unit << PARTN_BITS));
}
MODULE_PARM(ignore, "s");
MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
static void __exit ide_cdrom_exit(void)
{
unregister_ata_driver(&ide_cdrom_driver);
}
int ide_cdrom_init(void)
{
return ata_driver_module(&ide_cdrom_driver);
}
module_init(ide_cdrom_init);
......
......@@ -913,7 +913,7 @@ static void idedisk_setup(struct ata_device *drive)
if ((capacity >= (drive->bios_cyl * drive->bios_sect * drive->bios_head)) &&
(!drive->forced_geom) && drive->bios_sect && drive->bios_head)
drive->bios_cyl = (capacity / drive->bios_sect) / drive->bios_head;
printk(KERN_INFO "%s: %ld sectors", drive->name, capacity);
printk(KERN_INFO " %s: %ld sectors", drive->name, capacity);
#if 0
......@@ -1149,12 +1149,14 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
}
}
static void idedisk_attach(struct ata_device *drive);
/*
* Subdriver functions.
*/
static struct ata_operations idedisk_driver = {
owner: THIS_MODULE,
attach: idedisk_attach,
cleanup: idedisk_cleanup,
standby: idedisk_standby,
do_request: idedisk_do_request,
......@@ -1167,46 +1169,49 @@ static struct ata_operations idedisk_driver = {
capacity: idedisk_capacity,
};
MODULE_DESCRIPTION("ATA DISK Driver");
static void __exit idedisk_exit (void)
static void idedisk_attach(struct ata_device *drive)
{
struct ata_device *drive;
int failed = 0;
char *req;
struct ata_channel *channel;
int unit;
while ((drive = ide_scan_devices(ATA_DISK, "ide-disk", &idedisk_driver, failed)) != NULL) {
if (idedisk_cleanup (drive)) {
printk(KERN_ERR "%s: cleanup_module() called while still busy\n", drive->name);
++failed;
}
}
}
if (drive->type != ATA_DISK)
return;
int idedisk_init(void)
{
struct ata_device *drive;
int failed = 0;
req = drive->driver_req;
if (req[0] != '\0' && strcmp(req, "ide-disk"))
return;
MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices(ATA_DISK, "ide-disk", NULL, failed++)) != NULL) {
if (ide_register_subdriver (drive, &idedisk_driver)) {
if (ide_register_subdriver(drive, &idedisk_driver)) {
printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name);
continue;
return;
}
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);
continue;
}
--failed;
return;
}
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
channel = drive->channel;
unit = drive - channel->drives;
ide_revalidate_disk(mk_kdev(channel->major, unit << PARTN_BITS));
}
static void __exit idedisk_exit(void)
{
unregister_ata_driver(&idedisk_driver);
}
int __init idedisk_init(void)
{
return ata_driver_module(&idedisk_driver);
}
module_init(idedisk_init);
module_exit(idedisk_exit);
MODULE_DESCRIPTION("ATA DISK Driver");
MODULE_LICENSE("GPL");
/*
* linux/drivers/ide/ide-floppy.c Version 0.99 Feb 24 2002
*
* Copyright (C) 1996 - 1999 Gadi Oxman <gadio@netvision.net.il>
* Copyright (C) 2000 - 2002 Paul Bristow <paul@paulbristow.net>
*/
......@@ -1977,11 +1975,14 @@ static int idefloppy_cleanup(struct ata_device *drive)
return 0;
}
static void idefloppy_attach(struct ata_device *drive);
/*
* IDE subdriver functions, registered with ide.c
*/
static struct ata_operations idefloppy_driver = {
owner: THIS_MODULE,
attach: idefloppy_attach,
cleanup: idefloppy_cleanup,
standby: NULL,
do_request: idefloppy_do_request,
......@@ -1994,59 +1995,60 @@ static struct ata_operations idefloppy_driver = {
capacity: idefloppy_capacity,
};
MODULE_DESCRIPTION("ATAPI FLOPPY Driver");
static void __exit idefloppy_exit(void)
static void idefloppy_attach(struct ata_device *drive)
{
struct ata_device *drive;
int failed = 0;
idefloppy_floppy_t *floppy;
char *req;
struct ata_channel *channel;
int unit;
while ((drive = ide_scan_devices(ATA_FLOPPY, "ide-floppy", &idefloppy_driver, failed)) != NULL) {
if (idefloppy_cleanup(drive)) {
printk ("%s: cleanup_module() called while still busy\n", drive->name);
failed++;
}
}
}
if (drive->type != ATA_FLOPPY)
return;
/*
* idefloppy_init will register the driver for each floppy.
*/
int idefloppy_init(void)
{
struct ata_device *drive;
idefloppy_floppy_t *floppy;
int failed = 0;
req = drive->driver_req;
if (req[0] != '\0' && strcmp(req, "ide-floppy"))
return;
printk("ide-floppy driver " IDEFLOPPY_VERSION "\n");
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;
printk (KERN_ERR "ide-floppy: %s: not supported by this version of driver\n",
drive->name);
return;
}
if (drive->scsi) {
printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
printk(KERN_INFO "ide-floppy: passing drive %s to ide-scsi emulation.\n",
drive->name);
return;
}
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 (!(floppy = (idefloppy_floppy_t *) kmalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL))) {
printk(KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n",
drive->name);
return;
}
if (ide_register_subdriver (drive, &idefloppy_driver)) {
printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
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;
return;
}
MOD_INC_USE_COUNT;
idefloppy_setup (drive, floppy);
MOD_DEC_USE_COUNT;
failed--;
}
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
idefloppy_setup(drive, floppy);
channel = drive->channel;
unit = drive - channel->drives;
ide_revalidate_disk(mk_kdev(channel->major, unit << PARTN_BITS));
}
MODULE_DESCRIPTION("ATAPI FLOPPY Driver");
static void __exit idefloppy_exit(void)
{
unregister_ata_driver(&idefloppy_driver);
}
int __init idefloppy_init(void)
{
return ata_driver_module(&idefloppy_driver);
}
module_init(idefloppy_init);
......
......@@ -51,7 +51,7 @@ static void print_funcid (int func);
static int check_ide_device (unsigned long base);
static void ide_interrupt_ack (void *dev);
static void m8xx_ide_tuneproc(ide_drive_t *drive, byte pio);
static void m8xx_ide_tuneproc(struct ata_device *drive, byte pio);
typedef struct ide_ioport_desc {
unsigned long base_off; /* Offset to PCMCIA memory */
......@@ -437,7 +437,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
/* Calculate PIO timings */
static void
m8xx_ide_tuneproc(ide_drive_t *drive, byte pio)
m8xx_ide_tuneproc(struct ata_device *drive, byte pio)
{
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
volatile pcmconf8xx_t *pcmp;
......
......@@ -207,7 +207,8 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
if ((dev->vendor == PCI_VENDOR_ID_AL && dev->device == PCI_DEVICE_ID_AL_M5219) ||
(dev->vendor == PCI_VENDOR_ID_AMD && dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) ||
(dev->vendor == PCI_VENDOR_ID_CMD && dev->device == PCI_DEVICE_ID_CMD_643)) {
(dev->vendor == PCI_VENDOR_ID_CMD && dev->device == PCI_DEVICE_ID_CMD_643) ||
(dev->vendor == PCI_VENDOR_ID_SERVERWORKS && dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)) {
outb(inb(dma_base + 2) & 0x60, dma_base+2);
if (inb(dma_base + 2) & 0x80)
printk(KERN_INFO "%s: simplex device: DMA forced\n", name);
......@@ -553,14 +554,14 @@ static void __init pdc20270_device_order_fixup (struct pci_dev *dev, struct ata_
}
}
}
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev->name, dev->slot_name, dev->devfn);
printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev->name, dev->slot_name);
setup_pci_device(dev, d);
if (!dev2)
return;
d2 = d;
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev2->name, dev2->slot_name, dev2->devfn);
printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev2->name, dev2->slot_name);
setup_pci_device(dev2, d2);
}
......@@ -583,8 +584,8 @@ static void __init hpt374_device_order_fixup (struct pci_dev *dev, struct ata_pc
}
}
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev->name, dev->slot_name, dev->devfn);
printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev->name, dev->slot_name);
setup_pci_device(dev, d);
if (!dev2) {
return;
......@@ -600,8 +601,8 @@ static void __init hpt374_device_order_fixup (struct pci_dev *dev, struct ata_pc
}
}
d2 = d;
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev2->name, dev2->slot_name, dev2->devfn);
printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev2->name, dev2->slot_name);
setup_pci_device(dev2, d2);
}
......@@ -622,7 +623,8 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, struct ata_pc
switch(class_rev) {
case 5:
case 4:
case 3: printk(KERN_INFO "ATA: %s: controller on PCI slot %s\n", dev->name, dev->slot_name);
case 3: printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev->name, dev->slot_name);
setup_pci_device(dev, d);
return;
default: break;
......@@ -643,12 +645,14 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, struct ata_pc
break;
}
}
printk(KERN_INFO "ATA: %s: controller on PCI slot %s\n", dev->name, dev->slot_name);
printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev->name, dev->slot_name);
setup_pci_device(dev, d);
if (!dev2)
return;
d2 = d;
printk(KERN_INFO "ATA: %s: controller on PCI slot %s\n", dev2->name, dev2->slot_name);
printk(KERN_INFO "ATA: %s: controller, PCI slot %s\n",
dev2->name, dev2->slot_name);
setup_pci_device(dev2, d2);
}
......@@ -683,7 +687,7 @@ static void __init scan_pcidev(struct pci_dev *dev)
* beeing grabbed by generic drivers.
*/
if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
printk(KERN_INFO "ATA: unknown interface: %s, on PCI slot %s\n",
printk(KERN_INFO "ATA: unknown interface: %s, PCI slot %s\n",
dev->name, dev->slot_name);
}
return;
......@@ -707,8 +711,8 @@ static void __init scan_pcidev(struct pci_dev *dev)
} else if (d->vendor == PCI_VENDOR_ID_PROMISE && d->device == PCI_DEVICE_ID_PROMISE_20268R)
pdc20270_device_order_fixup(dev, d);
else {
printk(KERN_INFO "ATA: %s (%04x:%04x) on PCI slot %s\n",
dev->name, vendor, device, dev->slot_name);
printk(KERN_INFO "ATA: %s, PCI slot %s\n",
dev->name, dev->slot_name);
setup_pci_device(dev, d);
}
}
......
/*
* linux/drivers/ide/ide-tape.c Version 1.17a Jan, 2001
*
* Copyright (C) 1995 - 1999 Gadi Oxman <gadio@netvision.net.il>
*
* $Header$
*
* This driver was constructed as a student project in the software laboratory
* of the faculty of electrical engineering in the Technion - Israel's
* Institute Of Technology, with the guide of Avner Lottem and Dr. Ilana David.
......@@ -6054,11 +6050,11 @@ static void idetape_revalidate(struct ata_device *_dummy)
*/
}
/*
* IDE subdriver functions, registered with ide.c
*/
static void idetape_attach(struct ata_device *);
static struct ata_operations idetape_driver = {
owner: THIS_MODULE,
attach: idetape_attach,
cleanup: idetape_cleanup,
standby: NULL,
do_request: idetape_do_request,
......@@ -6070,6 +6066,8 @@ static struct ata_operations idetape_driver = {
revalidate: idetape_revalidate,
};
/*
* Our character device supporting functions, passed to register_chrdev.
*/
......@@ -6082,77 +6080,52 @@ static struct file_operations idetape_fops = {
release: idetape_chrdev_release,
};
MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver");
MODULE_LICENSE("GPL");
static void __exit idetape_exit(void)
static void idetape_attach(struct ata_device *drive)
{
struct ata_device *drive;
int minor;
idetape_tape_t *tape;
int minor, supported = 0;
char *req;
struct ata_channel *channel;
int unit;
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
drive = idetape_chrdevs[minor].drive;
if (drive != NULL && idetape_cleanup (drive))
printk (KERN_ERR "ide-tape: %s: cleanup_module() called while still busy\n", drive->name);
}
}
if (drive->type != ATA_TAPE)
return;
req = drive->driver_req;
if (req[0] != '\0' && strcmp(req, "ide-tape"))
return;
/*
* idetape_init will register the driver for each tape.
*/
int idetape_init(void)
{
struct ata_device *drive;
idetape_tape_t *tape;
int minor, failed = 0, supported = 0;
/* DRIVER(drive)->busy++; */
MOD_INC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_INC_USE_COUNT in idetape_init\n");
#endif
if (!idetape_chrdev_present)
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++ )
idetape_chrdevs[minor].drive = NULL;
if ((drive = ide_scan_devices(ATA_TAPE, "ide-tape", NULL, failed++)) == NULL) {
revalidate_drives();
MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return 0;
}
if (!idetape_chrdev_present &&
devfs_register_chrdev (IDETAPE_MAJOR, "ht", &idetape_fops)) {
printk (KERN_ERR "ide-tape: Failed to register character device interface\n");
MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return -EBUSY;
printk(KERN_ERR "ide-tape: Failed to register character device interface\n");
return;
}
do {
if (!idetape_identify_device (drive, drive->id)) {
printk (KERN_ERR "ide-tape: %s: not supported by this version of ide-tape\n", drive->name);
continue;
printk(KERN_ERR "ide-tape: %s: not supported by this version of ide-tape\n", drive->name);
return;
}
if (drive->scsi) {
if (strstr(drive->id->model, "OnStream DI-")) {
printk("ide-tape: ide-scsi emulation is not supported for %s.\n", drive->id->model);
printk(KERN_INFO "ide-tape: ide-scsi emulation is not supported for %s.\n", drive->id->model);
} else {
printk("ide-tape: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
printk(KERN_INFO "ide-tape: passing drive %s to ide-scsi emulation.\n", drive->name);
return;
}
}
tape = (idetape_tape_t *) kmalloc (sizeof (idetape_tape_t), GFP_KERNEL);
if (tape == NULL) {
if (!tape) {
printk (KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name);
continue;
return;
}
if (ide_register_subdriver (drive, &idetape_driver)) {
printk (KERN_ERR "ide-tape: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (tape);
continue;
return;
}
for (minor = 0; idetape_chrdevs[minor].drive != NULL; minor++);
idetape_setup (drive, tape, minor);
......@@ -6168,18 +6141,32 @@ int idetape_init(void)
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
devfs_register_tape (tape->de_r);
supported++; failed--;
} while ((drive = ide_scan_devices(ATA_TAPE, "ide-tape", NULL, failed++)) != NULL);
supported++;
if (!idetape_chrdev_present && !supported) {
devfs_unregister_chrdev (IDETAPE_MAJOR, "ht");
} else
idetape_chrdev_present = 1;
revalidate_drives();
MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return 0;
/* Feel free to use partitions even on tapes... */
channel = drive->channel;
unit = drive - channel->drives;
ide_revalidate_disk(mk_kdev(channel->major, unit << PARTN_BITS));
}
MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver");
MODULE_LICENSE("GPL");
static void __exit idetape_exit(void)
{
unregister_ata_driver(&idetape_driver);
}
int __init idetape_init(void)
{
return ata_driver_module(&idetape_driver);
}
module_init(idetape_init);
......
This diff is collapsed.
......@@ -48,17 +48,17 @@
/*
* Prototypes
*/
static void it8172_tune_drive (ide_drive_t *drive, byte pio);
static void it8172_tune_drive (struct ata_device *drive, byte pio);
#if defined(CONFIG_BLK_DEV_IDEDMA) && defined(CONFIG_IT8172_TUNING)
static byte it8172_dma_2_pio (byte xfer_rate);
static int it8172_tune_chipset (ide_drive_t *drive, byte speed);
static int it8172_config_chipset_for_dma (ide_drive_t *drive);
static int it8172_dmaproc(ide_dma_action_t func, ide_drive_t *drive);
static int it8172_tune_chipset (struct ata_device *drive, byte speed);
static int it8172_config_chipset_for_dma (struct ata_device *drive);
static int it8172_dmaproc(ide_dma_action_t func, struct ata_device *drive);
#endif
void __init ide_init_it8172(struct ata_channel *channel);
static void it8172_tune_drive (ide_drive_t *drive, byte pio)
static void it8172_tune_drive (struct ata_device *drive, byte pio)
{
unsigned long flags;
u16 drive_enables;
......@@ -139,7 +139,7 @@ static byte it8172_dma_2_pio (byte xfer_rate)
}
}
static int it8172_tune_chipset (ide_drive_t *drive, byte speed)
static int it8172_tune_chipset (struct ata_device *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -194,7 +194,7 @@ static int it8172_tune_chipset (ide_drive_t *drive, byte speed)
return err;
}
static int it8172_config_chipset_for_dma(ide_drive_t *drive)
static int it8172_config_chipset_for_dma(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
byte speed;
......@@ -210,7 +210,7 @@ static int it8172_config_chipset_for_dma(ide_drive_t *drive)
ide_dma_off_quietly);
}
static int it8172_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
static int it8172_dmaproc(ide_dma_action_t func, struct ata_device *drive)
{
switch (func) {
case ide_dma_check:
......
......@@ -119,7 +119,7 @@ void macide_init(void)
/* hardware ID, and we cna't get that without */
/* probing the drive which freezes a 190. */
ide_drive_t *drive = &ide_hwifs[index].drives[0];
struct ata_device *drive = &ide_hwifs[index].drives[0];
drive->capacity = drive->cyl*drive->head*drive->sect;
#ifdef CONFIG_BLK_DEV_MAC_MEDIABAY
......
......@@ -33,7 +33,7 @@ static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
* the IRQ associated with the port (drive->channel),
* and selects either PIO or DMA handshaking for the next I/O operation.
*/
static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
static void ns87415_prepare_drive(struct ata_device *drive, unsigned int use_dma)
{
struct ata_channel *hwif = drive->channel;
unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data;
......@@ -78,7 +78,7 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
__restore_flags(flags); /* local CPU only */
}
static void ns87415_selectproc (ide_drive_t *drive)
static void ns87415_selectproc(struct ata_device *drive)
{
ns87415_prepare_drive (drive, drive->using_dma);
}
......
......@@ -137,7 +137,7 @@ int reg_base;
/* there are stored pio numbers from other calls of opti621_tune_drive */
static void compute_pios(ide_drive_t *drive, byte pio)
static void compute_pios(struct ata_device *drive, byte pio)
/* Store values into drive->drive_data
* second_contr - 0 for primary controller, 1 for secondary
* slave_drive - 0 -> pio is for master, 1 -> pio is for slave
......@@ -245,7 +245,7 @@ static void compute_clocks(int pio, pio_clocks_t *clks)
}
/* Main tune procedure, called from tuneproc. */
static void opti621_tune_drive (ide_drive_t *drive, byte pio)
static void opti621_tune_drive(struct ata_device *drive, byte pio)
{
/* primary and secondary drives share some registers,
* so we have to program both drives
......
This diff is collapsed.
......@@ -377,7 +377,7 @@ static int pdcraid1_make_request (request_queue_t *q, int rw, struct buffer_head
static unsigned long calc_pdcblock_offset(struct block_device *bdev)
{
unsigned long lba = 0;
ide_drive_t *ideinfo = get_info_ptr(to_kdev_t(bdev->bd_dev));
struct ata_device *ideinfo = get_info_ptr(to_kdev_t(bdev->bd_dev));
if (ideinfo==NULL)
return 0;
......
......@@ -112,7 +112,7 @@ byte __init qd_read_reg (byte reg)
* This routine is invoked from ide.c to prepare for access to a given drive.
*/
static void qd_select (ide_drive_t *drive)
static void qd_select(struct ata_device *drive)
{
byte index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) |
(QD_TIMREG(drive) & 0x02);
......@@ -164,7 +164,7 @@ static byte qd6580_compute_timing (int active_time, int recovery_time)
* tries to find timing from dos driver's table
*/
static int qd_find_disk_type (ide_drive_t *drive,
static int qd_find_disk_type(struct ata_device *drive,
int *active_time, int *recovery_time)
{
struct qd65xx_timing_s *p;
......@@ -192,7 +192,7 @@ static int qd_find_disk_type (ide_drive_t *drive,
* check whether timings don't conflict
*/
static int qd_timing_ok (ide_drive_t drives[])
static int qd_timing_ok(struct ata_device drives[])
{
return (IDE_IMPLY(drives[0].present && drives[1].present,
IDE_IMPLY(QD_TIMREG(drives) == QD_TIMREG(drives+1),
......@@ -206,7 +206,7 @@ static int qd_timing_ok (ide_drive_t drives[])
* records the timing, and enables selectproc as needed
*/
static void qd_set_timing (ide_drive_t *drive, byte timing)
static void qd_set_timing(struct ata_device *drive, byte timing)
{
struct ata_channel *hwif = drive->channel;
......@@ -225,7 +225,7 @@ static void qd_set_timing (ide_drive_t *drive, byte timing)
* qd6500_tune_drive
*/
static void qd6500_tune_drive (ide_drive_t *drive, byte pio)
static void qd6500_tune_drive(struct ata_device *drive, byte pio)
{
int active_time = 175;
int recovery_time = 415; /* worst case values from the dos driver */
......@@ -247,7 +247,7 @@ static void qd6500_tune_drive (ide_drive_t *drive, byte pio)
* qd6580_tune_drive
*/
static void qd6580_tune_drive (ide_drive_t *drive, byte pio)
static void qd6580_tune_drive(struct ata_device *drive, byte pio)
{
struct ata_timing *t;
int base = drive->channel->select_data;
......
......@@ -240,6 +240,26 @@ extern char *ide_xfer_verbose (byte xfer_rate);
static struct pci_dev *isa_dev;
static int svwks_ratemask(struct ata_device *drive)
{
struct pci_dev *dev = drive->channel->pci_dev;
int map = 0;
if (!eighty_ninty_three(drive))
return XFER_UDMA;
switch(dev->device) {
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
if (svwks_revision >= SVWKS_CSB5_REVISION_NEW)
map |= XFER_UDMA_100;
map |= XFER_UDMA_66;
case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE:
map |= XFER_UDMA;
break;
}
return map;
}
static int svwks_tune_chipset(struct ata_device *drive, byte speed)
{
static u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
......@@ -251,11 +271,6 @@ static int svwks_tune_chipset(struct ata_device *drive, byte speed)
byte unit = (drive->select.b.unit & 0x01);
byte csb5 = (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ? 1 : 0;
#ifdef CONFIG_BLK_DEV_IDEDMA
unsigned long dma_base = hwif->dma_base;
#endif
int err;
byte drive_pci = 0x00;
byte drive_pci2 = 0x00;
byte drive_pci3 = hwif->unit ? 0x57 : 0x56;
......@@ -338,9 +353,6 @@ static int svwks_tune_chipset(struct ata_device *drive, byte speed)
printk("%s: %s drive%d\n", drive->name, ide_xfer_verbose(speed), drive->dn);
#endif /* SVWKS_DEBUG_DRIVE_INFO */
if (!drive->init_speed)
drive->init_speed = speed;
pci_write_config_byte(dev, drive_pci, pio_timing);
if (csb5)
pci_write_config_word(dev, 0x4A, csb5_pio);
......@@ -349,16 +361,12 @@ static int svwks_tune_chipset(struct ata_device *drive, byte speed)
pci_write_config_byte(dev, drive_pci2, dma_timing);
pci_write_config_byte(dev, drive_pci3, ultra_timing);
pci_write_config_byte(dev, 0x54, ultra_enable);
if (speed > XFER_PIO_4)
outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2);
else
outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
#endif /* CONFIG_BLK_DEV_IDEDMA */
err = ide_config_drive_speed(drive, speed);
#endif
if (!drive->init_speed)
drive->init_speed = speed;
drive->current_speed = speed;
return err;
return ide_config_drive_speed(drive, speed);
}
static void config_chipset_for_pio(struct ata_device *drive)
......@@ -415,23 +423,14 @@ static void svwks_tune_drive(struct ata_device *drive, byte pio)
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_chipset_for_dma(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
struct pci_dev *dev = drive->channel->pci_dev;
byte udma_66 = eighty_ninty_three(drive);
int ultra66 = (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ? 1 : 0;
int ultra100 = (ultra66 && svwks_revision >= SVWKS_CSB5_REVISION_NEW) ? 1 : 0;
byte speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA
| ((udma_66 && ultra66) ? XFER_UDMA_66 : 0)
| ((udma_66 && ultra100) ? XFER_UDMA_100 : 0));
int map;
byte mode;
(void) svwks_tune_chipset(drive, speed);
/* FIXME: check SWDMA modes --bkz */
map = XFER_MWDMA | svwks_ratemask(drive);
mode = ata_timing_mode(drive, map);
return ((int) ((id->dma_ultra >> 11) & 7) ? 1 :
((id->dma_ultra >> 8) & 7) ? 1 :
((id->dma_mword >> 8) & 7) ? 1 :
((id->dma_1word >> 8) & 7) ? 1 :
0);
return !svwks_tune_chipset(drive, mode);
}
static int config_drive_xfer_rate(struct ata_device *drive)
......
......@@ -71,7 +71,7 @@ static unsigned int get_timing_sl82c105(struct ata_timing *t)
/*
* Configure the drive and chipset for PIO
*/
static void config_for_pio(ide_drive_t *drive, int pio, int report)
static void config_for_pio(struct ata_device *drive, int pio, int report)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -109,7 +109,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report)
/*
* Configure the drive and the chipset for DMA
*/
static int config_for_dma(ide_drive_t *drive)
static int config_for_dma(struct ata_device *drive)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -131,7 +131,7 @@ static int config_for_dma(ide_drive_t *drive)
* Check to see if the drive and
* chipset is capable of DMA mode
*/
static int sl82c105_check_drive(ide_drive_t *drive)
static int sl82c105_check_drive(struct ata_device *drive)
{
int on = 0;
......@@ -240,7 +240,7 @@ static void sl82c105_timeout(struct ata_device *drive)
* This function is called when the IDE timer expires, the drive
* indicates that it is READY, and we were waiting for DMA to complete.
*/
static void sl82c105_lostirq(ide_drive_t *drive)
static void sl82c105_lostirq(struct ata_device *drive)
{
struct ata_channel *ch = drive->channel;
struct pci_dev *dev = ch->pci_dev;
......@@ -273,7 +273,7 @@ static void sl82c105_lostirq(ide_drive_t *drive)
* We only deal with PIO mode here - DMA mode 'using_dma' is not
* initialised at the point that this function is called.
*/
static void tune_sl82c105(ide_drive_t *drive, byte pio)
static void tune_sl82c105(struct ata_device *drive, byte pio)
{
config_for_pio(drive, pio, 1);
......
......@@ -502,11 +502,14 @@ static void idescsi_revalidate(struct ata_device *_dummy)
*/
}
static void idescsi_attach(struct ata_device *drive);
/*
* IDE subdriver functions, registered with ide.c
*/
static struct ata_operations idescsi_driver = {
owner: THIS_MODULE,
attach: idescsi_attach,
cleanup: idescsi_cleanup,
standby: NULL,
do_request: idescsi_do_request,
......@@ -519,45 +522,40 @@ static struct ata_operations idescsi_driver = {
capacity: NULL,
};
/*
* idescsi_init will register the driver for each scsi.
*/
int idescsi_init(void)
static void idescsi_attach(struct ata_device *drive)
{
struct ata_device *drive;
idescsi_scsi_t *scsi;
/* FIXME: The following is just plain wrong, since those are definitely *not* the
* media types supported by the ATA layer */
byte media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255};
int i, failed, id;
int i, id;
char *req;
struct ata_channel *channel;
int unit;
if (idescsi_initialized)
return 0;
return;
idescsi_initialized = 1;
for (i = 0; i < MAX_HWIFS * MAX_DRIVES; i++)
idescsi_drives[i] = NULL;
MOD_INC_USE_COUNT;
for (i = 0; media[i] != 255; i++) {
failed = 0;
while ((drive = ide_scan_devices (media[i], "ide-scsi", NULL, failed++)) != NULL) {
req = drive->driver_req;
if (req[0] != '\0' && strcmp(req, "ide-scsi"))
return;
if ((scsi = (idescsi_scsi_t *) kmalloc (sizeof (idescsi_scsi_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-scsi: %s: Can't allocate a scsi structure\n", drive->name);
continue;
printk(KERN_ERR "ide-scsi: %s: Can't allocate a scsi structure\n", drive->name);
return;
}
if (ide_register_subdriver (drive, &idescsi_driver)) {
printk (KERN_ERR "ide-scsi: %s: Failed to register the driver with ide.c\n", drive->name);
printk(KERN_ERR "ide-scsi: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (scsi);
continue;
return;
}
for (id = 0; id < MAX_HWIFS * MAX_DRIVES && idescsi_drives[id]; id++);
idescsi_setup (drive, scsi, id);
failed--;
}
}
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
channel = drive->channel;
unit = drive - channel->drives;
ide_revalidate_disk(mk_kdev(channel->major, unit << PARTN_BITS));
}
int idescsi_detect (Scsi_Host_Template *host_template)
......@@ -805,38 +803,31 @@ static Scsi_Host_Template idescsi_template = {
emulated: 1,
};
static int __init init_idescsi_module(void)
static int __init idescsi_init(void)
{
idescsi_init();
int ret;
ret = ata_driver_module(&idescsi_driver);
scsi_register_host(&idescsi_template);
return 0;
}
static void __exit exit_idescsi_module(void)
{
struct ata_device *drive;
byte media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255};
int i, failed;
scsi_unregister_host(&idescsi_template);
/* FIXME: The media types scanned here have literally nothing to do
* with the media types used by the overall ATA code!
*
* This is basically showing us, that there is something wrong with the
* ide_scan_devices function.
*/
#if 0
/* FIXME: what about this cleanup stuff here? This all should be done
* on close time perhaps? */
for (i = 0; media[i] != 255; i++) {
failed = 0;
while ((drive = ide_scan_devices (media[i], "ide-scsi", &idescsi_driver, failed)) != NULL)
if (idescsi_cleanup (drive)) {
printk ("%s: exit_idescsi_module() called while still busy\n", drive->name);
failed++;
}
}
#endif
unregister_ata_driver(&idescsi_driver);
}
module_init(init_idescsi_module);
module_init(idescsi_init);
module_exit(exit_idescsi_module);
MODULE_LICENSE("GPL");
......@@ -317,7 +317,6 @@ typedef union {
/*
* ATA/ATAPI device structure :
*/
typedef
struct ata_device {
struct ata_channel * channel;
char name[6]; /* device name */
......@@ -409,7 +408,7 @@ struct ata_device {
unsigned long immed_comp;
int max_last_depth;
int max_depth;
} ide_drive_t;
};
/*
* Status returned by various functions.
......@@ -590,6 +589,7 @@ static inline int ata_can_queue(struct ata_device *drive)
struct ata_operations {
struct module *owner;
void (*attach) (struct ata_device *);
int (*cleanup)(struct ata_device *);
int (*standby)(struct ata_device *);
ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t);
......@@ -602,6 +602,9 @@ struct ata_operations {
void (*revalidate)(struct ata_device *);
sector_t (*capacity)(struct ata_device *);
/* linked list of rgistered device type drivers */
struct ata_operations *next;
};
/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
......@@ -618,11 +621,20 @@ do { \
extern sector_t ata_capacity(struct ata_device *drive);
/* FIXME: Actually implement and use them as soon as possible! to make the
* ide_scan_devices() go away! */
extern int unregister_ata_driver(unsigned int type, struct ata_operations *driver);
extern int register_ata_driver(unsigned int type, struct ata_operations *driver);
extern void unregister_ata_driver(struct ata_operations *driver);
extern int register_ata_driver(struct ata_operations *driver);
static inline int ata_driver_module(struct ata_operations *driver)
{
#ifdef MODULE
if (register_ata_driver(driver) <= 0) {
unregister_ata_driver(driver);
return -ENODEV;
}
#else
register_ata_driver(driver);
#endif
return 0;
}
#define ata_ops(drive) ((drive)->driver)
......@@ -797,9 +809,9 @@ extern int idefloppy_init (void);
extern int idescsi_init (void);
#endif
extern struct ata_device *ide_scan_devices(byte, const char *, struct ata_operations *, int);
extern int ide_register_subdriver(struct ata_device *, struct ata_operations *);
extern int ide_unregister_subdriver(struct ata_device *drive);
extern int ide_revalidate_disk(kdev_t i_rdev);
#ifdef CONFIG_PCI
# define ON_BOARD 0
......@@ -890,6 +902,5 @@ extern spinlock_t ide_lock;
#define DRIVE_LOCK(drive) ((drive)->queue.queue_lock)
extern int drive_is_ready(struct ata_device *drive);
extern void revalidate_drives(void);
#endif
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