Commit 69479390 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.17 IDE 65

 - Apply cleanup of host chip drivers by Bartomiej Zonierkiewicz:

     affected drivers - aec62xx.c, alim15x3.c, cmd64x.c, hpt34x.c, sis5513.c

     new tuning scheme (wip) part 1:
	- introduce ratemask()
	- use ata_timing_mode()
	- use ide_config_drive_speed() return value

     forward port from convert.10:
	- support for AEC6280, AEC6280R
	- misc cleanups

     I had to fix a small typo in sis5513 code...

 - Add a new entry for an old VIA cell hiding as something new.
   (Pointed out by Kees Bakker.)

 - Make the synchronization token active resident on the same level as the
   spin lock. They interact with each other.

 - Synchronize with linux-2.5.17.

 - HPT366 driver typo fix by Andries Brouwer.

 - Export udma_tcq_enable() symbol right now. The blk_get_request() is undefined
   as well.
parent d8479cd9
...@@ -304,6 +304,7 @@ CONFIG_BLK_DEV_AEC62XX ...@@ -304,6 +304,7 @@ CONFIG_BLK_DEV_AEC62XX
The ATP850U/UF is an UltraDMA 33 chipset base. The ATP850U/UF is an UltraDMA 33 chipset base.
The ATP860 is an UltraDMA 66 chipset base. The ATP860 is an UltraDMA 66 chipset base.
The ATP860M(acintosh) version is an UltraDMA 66 chipset base. The ATP860M(acintosh) version is an UltraDMA 66 chipset base.
The ATP865 is an ATA100/133 chipset.
Please read the comments at the top of <file:drivers/ide/aec62xx.c>. Please read the comments at the top of <file:drivers/ide/aec62xx.c>.
If you say Y here, then say Y to "Use DMA by default when available" If you say Y here, then say Y to "Use DMA by default when available"
...@@ -313,6 +314,12 @@ CONFIG_AEC62XX_TUNING ...@@ -313,6 +314,12 @@ CONFIG_AEC62XX_TUNING
Please read the comments at the top of <file:drivers/ide/aec62xx.c>. Please read the comments at the top of <file:drivers/ide/aec62xx.c>.
If unsure, say N. If unsure, say N.
CONFIG_AEC6280_BURST
Use burst mode for DMA transfers. Higher speed, but causes more load
on the bus.
If unsure, say N.
CONFIG_BLK_DEV_ALI15X3 CONFIG_BLK_DEV_ALI15X3
This driver ensures (U)DMA support for ALI 1533, 1543 and 1543C This driver ensures (U)DMA support for ALI 1533, 1543 and 1543C
onboard chipsets. It also tests for Simplex mode and enables onboard chipsets. It also tests for Simplex mode and enables
......
...@@ -54,6 +54,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then ...@@ -54,6 +54,7 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_bool ' Good-Bad DMA Model-Firmware (EXPERIMENTAL)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_EXPERIMENTAL dep_bool ' Good-Bad DMA Model-Firmware (EXPERIMENTAL)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_EXPERIMENTAL
dep_bool ' AEC62XX chip set support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' AEC62XX chip set support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI
dep_mbool ' AEC62XX Tuning support' CONFIG_AEC62XX_TUNING $CONFIG_BLK_DEV_AEC62XX dep_mbool ' AEC62XX Tuning support' CONFIG_AEC62XX_TUNING $CONFIG_BLK_DEV_AEC62XX
dep_mbool ' AEC6280 Burst mode' CONFIG_AEC6280_BURST $CONFIG_BLK_DEV_AEC62XX
dep_bool ' ALI M15x3 chipset support' CONFIG_BLK_DEV_ALI15X3 $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' ALI M15x3 chipset support' CONFIG_BLK_DEV_ALI15X3 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_mbool ' ALI M15x3 WDC support (DANGEROUS)' CONFIG_WDC_ALI15X3 $CONFIG_BLK_DEV_ALI15X3 $CONFIG_EXPERIMENTAL dep_mbool ' ALI M15x3 WDC support (DANGEROUS)' CONFIG_WDC_ALI15X3 $CONFIG_BLK_DEV_ALI15X3 $CONFIG_EXPERIMENTAL
dep_bool ' AMD and nVidia chipset support' CONFIG_BLK_DEV_AMD74XX $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' AMD and nVidia chipset support' CONFIG_BLK_DEV_AMD74XX $CONFIG_BLK_DEV_IDEDMA_PCI
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
O_TARGET := idedriver.o O_TARGET := idedriver.o
export-objs := ide-taskfile.o ide.o ide-features.o ide-probe.o quirks.o pcidma.o ataraid.o export-objs := ide-taskfile.o ide.o ide-features.o ide-probe.o quirks.o pcidma.o tcq.o ataraid.o
obj-y := obj-y :=
obj-m := obj-m :=
......
/**** vi:set ts=8 sts=8 sw=8:************************************************ /**** vi:set ts=8 sts=8 sw=8:************************************************
* *
* Version 0.09 June. 9, 2000 * Version 0.11 March 27, 2002
* *
* Copyright (C) 1999-2000 Andre Hedrick (andre@linux-ide.org) * Copyright (C) 1999-2000 Andre Hedrick (andre@linux-ide.org)
* May be copied or modified under the terms of the GNU General Public License
* *
*/ */
...@@ -52,6 +51,21 @@ static int aec62xx_get_info(char *, char **, off_t, int); ...@@ -52,6 +51,21 @@ static int aec62xx_get_info(char *, char **, off_t, int);
extern int (*aec62xx_display_info)(char *, char **, off_t, int); /* ide-proc.c */ extern int (*aec62xx_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static struct pci_dev *bmide_dev; static struct pci_dev *bmide_dev;
static const char *aec6280_get_speed(u8 speed)
{
switch(speed) {
case 7: return "6";
case 6: return "5";
case 5: return "4";
case 4: return "3";
case 3: return "2";
case 2: return "1";
case 1: return "0";
case 0: return "?";
}
return "?";
}
static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count) static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
...@@ -70,6 +84,12 @@ static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -70,6 +84,12 @@ static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count)
case PCI_DEVICE_ID_ARTOP_ATP860R: case PCI_DEVICE_ID_ARTOP_ATP860R:
p += sprintf(p, "\n AEC6260 Chipset.\n"); p += sprintf(p, "\n AEC6260 Chipset.\n");
break; break;
case PCI_DEVICE_ID_ARTOP_ATP865:
p += sprintf(p, "\n AEC6280 Chipset without ROM.\n");
break;
case PCI_DEVICE_ID_ARTOP_ATP865R:
p += sprintf(p, "\n AEC6280 Chipset with ROM.\n");
break;
default: default:
p += sprintf(p, "\n AEC62?? Chipset.\n"); p += sprintf(p, "\n AEC62?? Chipset.\n");
break; break;
...@@ -154,6 +174,41 @@ static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -154,6 +174,41 @@ static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count)
(void) pci_read_config_byte(bmide_dev, 0x4a, &uart); (void) pci_read_config_byte(bmide_dev, 0x4a, &uart);
p += sprintf(p, "reg4ah = 0x%02x\n", uart); p += sprintf(p, "reg4ah = 0x%02x\n", uart);
break; break;
case PCI_DEVICE_ID_ARTOP_ATP865:
case PCI_DEVICE_ID_ARTOP_ATP865R:
(void) pci_read_config_byte(bmide_dev, 0x44, &art);
p += sprintf(p, "DMA Mode: %s(%s) %s(%s)",
(c0&0x20)?((art&0x0f)?"UDMA":" DMA"):" PIO",
aec6280_get_speed(art&0x0f),
(c0&0x40)?((art&0xf0)?"UDMA":" DMA"):" PIO",
aec6280_get_speed(art>>4));
(void) pci_read_config_byte(bmide_dev, 0x45, &art);
p += sprintf(p, " %s(%s) %s(%s)\n",
(c0&0x20)?((art&0x0f)?"UDMA":" DMA"):" PIO",
aec6280_get_speed(art&0x0f),
(c0&0x40)?((art&0xf0)?"UDMA":" DMA"):" PIO",
aec6280_get_speed(art>>4));
(void) pci_read_config_byte(bmide_dev, 0x40, &art);
p += sprintf(p, "Active: 0x%02x", HIGH_4(art));
(void) pci_read_config_byte(bmide_dev, 0x41, &art);
p += sprintf(p, " 0x%02x", HIGH_4(art));
(void) pci_read_config_byte(bmide_dev, 0x42, &art);
p += sprintf(p, " 0x%02x", HIGH_4(art));
(void) pci_read_config_byte(bmide_dev, 0x43, &art);
p += sprintf(p, " 0x%02x\n", HIGH_4(art));
(void) pci_read_config_byte(bmide_dev, 0x40, &art);
p += sprintf(p, "Recovery: 0x%02x", LOW_4(art));
(void) pci_read_config_byte(bmide_dev, 0x41, &art);
p += sprintf(p, " 0x%02x", LOW_4(art));
(void) pci_read_config_byte(bmide_dev, 0x42, &art);
p += sprintf(p, " 0x%02x", LOW_4(art));
(void) pci_read_config_byte(bmide_dev, 0x43, &art);
p += sprintf(p, " 0x%02x\n", LOW_4(art));
(void) pci_read_config_byte(bmide_dev, 0x49, &uart);
p += sprintf(p, "reg49h = 0x%02x ", uart);
(void) pci_read_config_byte(bmide_dev, 0x4a, &uart);
p += sprintf(p, "reg4ah = 0x%02x\n", uart);
break;
default: default:
break; break;
} }
...@@ -164,8 +219,6 @@ static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -164,8 +219,6 @@ static int aec62xx_get_info (char *buffer, char **addr, off_t offset, int count)
byte aec62xx_proc = 0; byte aec62xx_proc = 0;
#ifdef CONFIG_AEC62XX_TUNING
struct chipset_bus_clock_list_entry { struct chipset_bus_clock_list_entry {
byte xfer_speed; byte xfer_speed;
...@@ -178,6 +231,8 @@ struct chipset_bus_clock_list_entry { ...@@ -178,6 +231,8 @@ struct chipset_bus_clock_list_entry {
struct chipset_bus_clock_list_entry aec62xx_base [] = { struct chipset_bus_clock_list_entry aec62xx_base [] = {
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
{ XFER_UDMA_6, 0x41, 0x06, 0x31, 0x07 },
{ XFER_UDMA_5, 0x41, 0x05, 0x31, 0x06 },
{ XFER_UDMA_4, 0x41, 0x04, 0x31, 0x05 }, { XFER_UDMA_4, 0x41, 0x04, 0x31, 0x05 },
{ XFER_UDMA_3, 0x41, 0x03, 0x31, 0x04 }, { XFER_UDMA_3, 0x41, 0x03, 0x31, 0x04 },
{ XFER_UDMA_2, 0x41, 0x02, 0x31, 0x03 }, { XFER_UDMA_2, 0x41, 0x02, 0x31, 0x03 },
...@@ -196,8 +251,6 @@ struct chipset_bus_clock_list_entry aec62xx_base [] = { ...@@ -196,8 +251,6 @@ struct chipset_bus_clock_list_entry aec62xx_base [] = {
{ 0, 0x00, 0x00, 0x00, 0x00 } { 0, 0x00, 0x00, 0x00, 0x00 }
}; };
extern char *ide_xfer_verbose (byte xfer_rate);
/* /*
* TO DO: active tuning and correction of cards without a bios. * TO DO: active tuning and correction of cards without a bios.
*/ */
...@@ -220,11 +273,34 @@ static byte pci_bus_clock_list_ultra (byte speed, struct chipset_bus_clock_list_ ...@@ -220,11 +273,34 @@ static byte pci_bus_clock_list_ultra (byte speed, struct chipset_bus_clock_list_
return 0x00; return 0x00;
} }
static int aec62xx_ratemask(struct ata_device *drive)
{
struct pci_dev *dev = drive->channel->pci_dev;
u32 bmide = pci_resource_start(dev, 4);
int map = 0;
if (!eighty_ninty_three(drive))
return XFER_UDMA;
switch(dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP865R:
case PCI_DEVICE_ID_ARTOP_ATP865:
if (IN_BYTE(bmide+2) & 0x10)
map |= XFER_UDMA_133;
else
map |= XFER_UDMA_100;
case PCI_DEVICE_ID_ARTOP_ATP860R:
case PCI_DEVICE_ID_ARTOP_ATP860:
map |= XFER_UDMA_66;
case PCI_DEVICE_ID_ARTOP_ATP850UF:
map |= XFER_UDMA;
}
return map;
}
static int aec6210_tune_chipset(struct ata_device *drive, byte speed) static int aec6210_tune_chipset(struct ata_device *drive, byte speed)
{ {
struct ata_channel *hwif = drive->channel; struct pci_dev *dev = drive->channel->pci_dev;
struct pci_dev *dev = hwif->pci_dev;
int err = 0;
unsigned short d_conf = 0x0000; unsigned short d_conf = 0x0000;
byte ultra = 0x00; byte ultra = 0x00;
byte ultra_conf = 0x00; byte ultra_conf = 0x00;
...@@ -252,17 +328,14 @@ static int aec6210_tune_chipset(struct ata_device *drive, byte speed) ...@@ -252,17 +328,14 @@ static int aec6210_tune_chipset(struct ata_device *drive, byte speed)
__restore_flags(flags); /* local CPU only */ __restore_flags(flags); /* local CPU only */
err = ide_config_drive_speed(drive, speed); return ide_config_drive_speed(drive, speed);
return(err);
} }
static int aec6260_tune_chipset(struct ata_device *drive, byte speed) static int aec6260_tune_chipset(struct ata_device *drive, byte speed)
{ {
struct ata_channel *hwif = drive->channel; struct pci_dev *dev = drive->channel->pci_dev;
struct pci_dev *dev = hwif->pci_dev;
byte unit = (drive->select.b.unit & 0x01); byte unit = (drive->select.b.unit & 0x01);
byte ultra_pci = hwif->unit ? 0x45 : 0x44; u8 ultra_pci = drive->channel->unit ? 0x45 : 0x44;
int err = 0;
byte drive_conf = 0x00; byte drive_conf = 0x00;
byte ultra_conf = 0x00; byte ultra_conf = 0x00;
byte ultra = 0x00; byte ultra = 0x00;
...@@ -287,128 +360,47 @@ static int aec6260_tune_chipset(struct ata_device *drive, byte speed) ...@@ -287,128 +360,47 @@ static int aec6260_tune_chipset(struct ata_device *drive, byte speed)
if (!drive->init_speed) if (!drive->init_speed)
drive->init_speed = speed; drive->init_speed = speed;
err = ide_config_drive_speed(drive, speed);
drive->current_speed = speed; drive->current_speed = speed;
return(err); return ide_config_drive_speed(drive, speed);
} }
static int aec62xx_tune_chipset(struct ata_device *drive, byte speed) static int aec62xx_tune_chipset(struct ata_device *drive, byte speed)
{ {
if (drive->channel->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { switch (drive->channel->pci_dev->device) {
return ((int) aec6210_tune_chipset(drive, speed)); case PCI_DEVICE_ID_ARTOP_ATP865:
} else { case PCI_DEVICE_ID_ARTOP_ATP865R:
return ((int) aec6260_tune_chipset(drive, speed)); case PCI_DEVICE_ID_ARTOP_ATP860:
case PCI_DEVICE_ID_ARTOP_ATP860R:
return aec6260_tune_chipset(drive, speed);
case PCI_DEVICE_ID_ARTOP_ATP850UF:
return aec6210_tune_chipset(drive, speed);
default:
return -1;
} }
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
static int config_aec6210_chipset_for_dma(struct ata_device *drive, byte ultra) static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
{ {
struct hd_driveid *id = drive->id; int map;
struct ata_channel *hwif = drive->channel; u8 mode;
byte unit = (drive->select.b.unit & 0x01);
unsigned long dma_base = hwif->dma_base;
byte speed = -1;
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; return 0;
if (((id->dma_ultra & 0x0010) || if (udma)
(id->dma_ultra & 0x0008) || map = aec62xx_ratemask(drive);
(id->dma_ultra & 0x0004)) && (ultra)) { else
speed = XFER_UDMA_2; map = XFER_SWDMA | XFER_MWDMA;
} else if ((id->dma_ultra & 0x0002) && (ultra)) {
speed = XFER_UDMA_1;
} else if ((id->dma_ultra & 0x0001) && (ultra)) {
speed = XFER_UDMA_0;
} else if (id->dma_mword & 0x0004) {
speed = XFER_MW_DMA_2;
} else if (id->dma_mword & 0x0002) {
speed = XFER_MW_DMA_1;
} else if (id->dma_mword & 0x0001) {
speed = XFER_MW_DMA_0;
} else if (id->dma_1word & 0x0004) {
speed = XFER_SW_DMA_2;
} else if (id->dma_1word & 0x0002) {
speed = XFER_SW_DMA_1;
} else if (id->dma_1word & 0x0001) {
speed = XFER_SW_DMA_0;
} else {
return 0;
}
outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
(void) aec6210_tune_chipset(drive, speed);
return ((int) ((id->dma_ultra >> 11) & 3) ? 0 :
((id->dma_ultra >> 8) & 7) ? 1 :
((id->dma_mword >> 8) & 7) ? 1 :
((id->dma_1word >> 8) & 7) ? 1 :
0);
}
static int config_aec6260_chipset_for_dma(struct ata_device *drive, byte ultra)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
byte unit = (drive->select.b.unit & 0x01);
unsigned long dma_base = hwif->dma_base;
byte speed = -1;
byte ultra66 = eighty_ninty_three(drive);
if (drive->type != ATA_DISK) mode = ata_timing_mode(drive, map);
return 0;
if ((id->dma_ultra & 0x0010) && (ultra) && (ultra66)) { if (mode < XFER_SW_DMA_0)
speed = XFER_UDMA_4;
} else if ((id->dma_ultra & 0x0008) && (ultra) && (ultra66)) {
speed = XFER_UDMA_3;
} else if ((id->dma_ultra & 0x0004) && (ultra)) {
speed = XFER_UDMA_2;
} else if ((id->dma_ultra & 0x0002) && (ultra)) {
speed = XFER_UDMA_1;
} else if ((id->dma_ultra & 0x0001) && (ultra)) {
speed = XFER_UDMA_0;
} else if (id->dma_mword & 0x0004) {
speed = XFER_MW_DMA_2;
} else if (id->dma_mword & 0x0002) {
speed = XFER_MW_DMA_1;
} else if (id->dma_mword & 0x0001) {
speed = XFER_MW_DMA_0;
} else if (id->dma_1word & 0x0004) {
speed = XFER_SW_DMA_2;
} else if (id->dma_1word & 0x0002) {
speed = XFER_SW_DMA_1;
} else if (id->dma_1word & 0x0001) {
speed = XFER_SW_DMA_0;
} else {
return 0; return 0;
}
outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
(void) aec6260_tune_chipset(drive, speed);
return ((int) ((id->dma_ultra >> 11) & 3) ? 1 : return !aec62xx_tune_chipset(drive, mode);
((id->dma_ultra >> 8) & 7) ? 1 :
((id->dma_mword >> 8) & 7) ? 1 :
((id->dma_1word >> 8) & 7) ? 1 :
0);
} }
static int config_chipset_for_dma(struct ata_device *drive, byte ultra)
{
switch(drive->channel->pci_dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP850UF:
return config_aec6210_chipset_for_dma(drive, ultra);
case PCI_DEVICE_ID_ARTOP_ATP860:
case PCI_DEVICE_ID_ARTOP_ATP860R:
return config_aec6260_chipset_for_dma(drive, ultra);
default:
return 0;
}
}
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
static void aec62xx_tune_drive(struct ata_device *drive, byte pio) static void aec62xx_tune_drive(struct ata_device *drive, byte pio)
...@@ -420,15 +412,7 @@ static void aec62xx_tune_drive(struct ata_device *drive, byte pio) ...@@ -420,15 +412,7 @@ static void aec62xx_tune_drive(struct ata_device *drive, byte pio)
else else
speed = XFER_PIO_0 + min_t(byte, pio, 4); speed = XFER_PIO_0 + min_t(byte, pio, 4);
switch(drive->channel->pci_dev->device) { (void) aec62xx_tune_chipset(drive, speed);
case PCI_DEVICE_ID_ARTOP_ATP850UF:
(void) aec6210_tune_chipset(drive, speed);
case PCI_DEVICE_ID_ARTOP_ATP860:
case PCI_DEVICE_ID_ARTOP_ATP860R:
(void) aec6260_tune_chipset(drive, speed);
default:
break;
}
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
...@@ -447,7 +431,7 @@ static int config_drive_xfer_rate(struct ata_device *drive) ...@@ -447,7 +431,7 @@ static int config_drive_xfer_rate(struct ata_device *drive)
on = 0; on = 0;
verbose = 0; verbose = 0;
if (id->field_valid & 4) { if (id->field_valid & 4) {
if (id->dma_ultra & 0x001F) { if (id->dma_ultra & 0x007F) {
/* Force if Capable UltraDMA */ /* Force if Capable UltraDMA */
on = config_chipset_for_dma(drive, 1); on = config_chipset_for_dma(drive, 1);
if ((id->field_valid & 2) && if ((id->field_valid & 2) &&
...@@ -490,10 +474,33 @@ int aec62xx_dmaproc(struct ata_device *drive) ...@@ -490,10 +474,33 @@ int aec62xx_dmaproc(struct ata_device *drive)
return config_drive_xfer_rate(drive); return config_drive_xfer_rate(drive);
} }
#endif #endif
#endif
static unsigned int __init aec62xx_init_chipset(struct pci_dev *dev) static unsigned int __init aec62xx_init_chipset(struct pci_dev *dev)
{ {
u8 reg49h = 0;
u8 reg4ah = 0;
switch(dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP865:
case PCI_DEVICE_ID_ARTOP_ATP865R:
/* Clear reset and test bits. */
pci_read_config_byte(dev, 0x49, &reg49h);
pci_write_config_byte(dev, 0x49, reg49h & ~0x30);
/* Enable chip interrupt output. */
pci_read_config_byte(dev, 0x4a, &reg4ah);
pci_write_config_byte(dev, 0x4a, reg4ah & ~0x01);
#ifdef CONFIG_AEC6280_BURST
/* Must be greater than 0x80 for burst mode. */
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x90);
/* Enable burst mode. */
pci_read_config_byte(dev, 0x4a, &reg4ah);
pci_write_config_byte(dev, 0x4a, reg4ah | 0x80);
#endif
break;
default:
break;
}
if (dev->resource[PCI_ROM_RESOURCE].start) { if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk("%s: ROM enabled at 0x%08lx\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start); printk("%s: ROM enabled at 0x%08lx\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start);
...@@ -522,28 +529,30 @@ static unsigned int __init aec62xx_ata66_check(struct ata_channel *ch) ...@@ -522,28 +529,30 @@ static unsigned int __init aec62xx_ata66_check(struct ata_channel *ch)
static void __init aec62xx_init_channel(struct ata_channel *hwif) static void __init aec62xx_init_channel(struct ata_channel *hwif)
{ {
#ifdef CONFIG_AEC62XX_TUNING
hwif->tuneproc = aec62xx_tune_drive; hwif->tuneproc = aec62xx_tune_drive;
hwif->speedproc = aec62xx_tune_chipset; hwif->speedproc = aec62xx_tune_chipset;
# ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base)
hwif->XXX_udma = aec62xx_dmaproc;
hwif->highmem = 1;
# else
hwif->drives[0].autotune = 1; hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1; hwif->drives[1].autotune = 1;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->XXX_udma = aec62xx_dmaproc;
hwif->highmem = 1;
# ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
# endif # endif
}
#endif #endif
} }
static void __init aec62xx_init_dma(struct ata_channel *hwif, unsigned long dmabase) static void __init aec62xx_init_dma(struct ata_channel *hwif, unsigned long dmabase)
{ {
#ifdef CONFIG_AEC62XX_TUNING
u8 reg54h = 0; u8 reg54h = 0;
/* FIXME: we need some locking here */
pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h); pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h);
pci_write_config_byte(hwif->pci_dev, 0x54, reg54h & ~(hwif->unit ? 0xF0 : 0x0F)); pci_write_config_byte(hwif->pci_dev, 0x54, reg54h & ~(hwif->unit ? 0xF0 : 0x0F));
#endif
ata_init_dma(hwif, dmabase); ata_init_dma(hwif, dmabase);
} }
...@@ -579,6 +588,46 @@ static struct ata_pci_device chipsets[] __initdata = { ...@@ -579,6 +588,46 @@ static struct ata_pci_device chipsets[] __initdata = {
bootable: OFF_BOARD, bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA 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_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: { {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) int __init init_aec62xx(void)
......
...@@ -106,11 +106,11 @@ static void outReg (byte data, byte reg) ...@@ -106,11 +106,11 @@ static void outReg (byte data, byte reg)
* This function computes timing parameters * This function computes timing parameters
* and sets controller registers accordingly. * and sets controller registers accordingly.
*/ */
static void ali14xx_tune_drive (ide_drive_t *drive, byte pio) static void ali14xx_tune_drive(struct ata_device *drive, u8 pio)
{ {
int driveNum; int driveNum;
int time1, time2; int time1, time2;
byte param1, param2, param3, param4; u8 param1, param2, param3, param4;
unsigned long flags; unsigned long flags;
struct ata_timing *t; struct ata_timing *t;
......
...@@ -304,14 +304,49 @@ static void ali15x3_tune_drive(struct ata_device *drive, byte pio) ...@@ -304,14 +304,49 @@ static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
__restore_flags(flags); __restore_flags(flags);
} }
static byte ali15x3_can_ultra(struct ata_device *drive)
{
if (m5229_revision <= 0x20) {
return 0;
} else if ((m5229_revision < 0xC2) &&
#ifndef CONFIG_WDC_ALI15X3
((chip_is_1543c_e && strstr(drive->id->model, "WDC ")) ||
(drive->type != ATA_DISK))) {
#else
(drive->type != ATA_DISK)) {
#endif
return 0;
} else {
return 1;
}
}
static int ali15x3_ratemask(struct ata_device *drive)
{
int map = 0;
if (!ali15x3_can_ultra(drive))
return 0;
map |= XFER_UDMA;
if (!eighty_ninty_three(drive))
return map;
if (m5229_revision >= 0xC4)
map |= XFER_UDMA_100;
if (m5229_revision >= 0xC2)
map |= XFER_UDMA_66;
return map;
}
static int ali15x3_tune_chipset(struct ata_device *drive, byte speed) static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
{ {
struct ata_channel *hwif = drive->channel; struct pci_dev *dev = drive->channel->pci_dev;
struct pci_dev *dev = hwif->pci_dev;
byte unit = (drive->select.b.unit & 0x01); byte unit = (drive->select.b.unit & 0x01);
byte tmpbyte = 0x00; byte tmpbyte = 0x00;
int m5229_udma = hwif->unit ? 0x57 : 0x56; int m5229_udma = drive->channel->unit ? 0x57 : 0x56;
int err = 0;
if (speed < XFER_UDMA_0) { if (speed < XFER_UDMA_0) {
byte ultra_enable = (unit) ? 0x7f : 0xf7; byte ultra_enable = (unit) ? 0x7f : 0xf7;
...@@ -323,16 +358,10 @@ static int ali15x3_tune_chipset(struct ata_device *drive, byte speed) ...@@ -323,16 +358,10 @@ static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
pci_write_config_byte(dev, m5229_udma, tmpbyte); pci_write_config_byte(dev, m5229_udma, tmpbyte);
} }
err = ide_config_drive_speed(drive, speed); if (speed < XFER_SW_DMA_0)
ali15x3_tune_drive(drive, speed);
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (speed >= XFER_SW_DMA_0) { else if (speed >= XFER_UDMA_0) {
unsigned long dma_base = hwif->dma_base;
outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2);
}
if (speed >= XFER_UDMA_0) {
pci_read_config_byte(dev, m5229_udma, &tmpbyte); pci_read_config_byte(dev, m5229_udma, &tmpbyte);
tmpbyte &= (0x0f << ((1-unit) << 2)); tmpbyte &= (0x0f << ((1-unit) << 2));
/* /*
...@@ -348,9 +377,11 @@ static int ali15x3_tune_chipset(struct ata_device *drive, byte speed) ...@@ -348,9 +377,11 @@ static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
} }
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
if (!drive->init_speed)
drive->init_speed = speed;
drive->current_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) static void config_chipset_for_pio(struct ata_device *drive)
...@@ -359,75 +390,21 @@ static void config_chipset_for_pio(struct ata_device *drive) ...@@ -359,75 +390,21 @@ static void config_chipset_for_pio(struct ata_device *drive)
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
static int config_chipset_for_dma(struct ata_device *drive, byte ultra33) static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
{ {
struct hd_driveid *id = drive->id; int map;
byte speed = 0x00; u8 mode;
byte ultra66 = eighty_ninty_three(drive);
byte ultra100 = (m5229_revision>=0xc4) ? 1 : 0;
int rval;
if ((id->dma_ultra & 0x0020) && (ultra100) && (ultra66) && (ultra33)) {
speed = XFER_UDMA_5;
} else if ((id->dma_ultra & 0x0010) && (ultra66) && (ultra33)) {
speed = XFER_UDMA_4;
} else if ((id->dma_ultra & 0x0008) && (ultra66) && (ultra33)) {
speed = XFER_UDMA_3;
} else if ((id->dma_ultra & 0x0004) && (ultra33)) {
speed = XFER_UDMA_2;
} else if ((id->dma_ultra & 0x0002) && (ultra33)) {
speed = XFER_UDMA_1;
} else if ((id->dma_ultra & 0x0001) && (ultra33)) {
speed = XFER_UDMA_0;
} else if (id->dma_mword & 0x0004) {
speed = XFER_MW_DMA_2;
} else if (id->dma_mword & 0x0002) {
speed = XFER_MW_DMA_1;
} else if (id->dma_mword & 0x0001) {
speed = XFER_MW_DMA_0;
} else if (id->dma_1word & 0x0004) {
speed = XFER_SW_DMA_2;
} else if (id->dma_1word & 0x0002) {
speed = XFER_SW_DMA_1;
} else if (id->dma_1word & 0x0001) {
speed = XFER_SW_DMA_0;
} else {
return 0;
}
(void) ali15x3_tune_chipset(drive, speed);
if (!drive->init_speed) if (udma)
drive->init_speed = speed; map = ali15x3_ratemask(drive);
else
rval = (int)( ((id->dma_ultra >> 11) & 3) ? 1: map = XFER_SWDMA | XFER_MWDMA;
((id->dma_ultra >> 8) & 7) ? 1:
((id->dma_mword >> 8) & 7) ? 1:
((id->dma_1word >> 8) & 7) ? 1:
0);
return rval;
}
static byte ali15x3_can_ultra(struct ata_device *drive)
{
#ifndef CONFIG_WDC_ALI15X3
struct hd_driveid *id = drive->id;
#endif /* CONFIG_WDC_ALI15X3 */
if (m5229_revision <= 0x20) { mode = ata_timing_mode(drive, map);
return 0; if (mode < XFER_SW_DMA_0)
} else if ((m5229_revision < 0xC2) &&
#ifndef CONFIG_WDC_ALI15X3
((chip_is_1543c_e && strstr(id->model, "WDC ")) ||
(drive->type != ATA_DISK))) {
#else /* CONFIG_WDC_ALI15X3 */
(drive->type != ATA_DISK)) {
#endif /* CONFIG_WDC_ALI15X3 */
return 0; return 0;
} else {
return 1; return !ali15x3_tune_chipset(drive, mode);
}
} }
static int ali15x3_config_drive_for_dma(struct ata_device *drive) static int ali15x3_config_drive_for_dma(struct ata_device *drive)
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
* Due to massive hardware bugs, UltraDMA is only supported * Due to massive hardware bugs, UltraDMA is only supported
* on the 646U2 and not on the 646U. * on the 646U2 and not on the 646U.
* *
* Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) * Copyright (C) 1998 Eddie C. Dost <ecd@skynet.be>
* Copyright (C) 1998 David S. Miller (davem@redhat.com) * Copyright (C) 1998 David S. Miller <davem@redhat.com>
* Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -336,6 +336,59 @@ static void cmd64x_tuneproc(struct ata_device *drive, byte mode_wanted) ...@@ -336,6 +336,59 @@ static void cmd64x_tuneproc(struct ata_device *drive, byte mode_wanted)
setup_count, active_count, recovery_count); setup_count, active_count, recovery_count);
} }
static int cmd64x_ratemask(struct ata_device *drive)
{
struct pci_dev *dev = drive->channel->pci_dev;
int map = 0;
switch(dev->device) {
case PCI_DEVICE_ID_CMD_680:
map |= XFER_UDMA_133;
case PCI_DEVICE_ID_CMD_649:
map |= XFER_UDMA_100;
case PCI_DEVICE_ID_CMD_648:
map |= XFER_UDMA_66;
case PCI_DEVICE_ID_CMD_643:
map |= XFER_UDMA;
break;
case PCI_DEVICE_ID_CMD_646:
{
unsigned int class_rev = 0;
pci_read_config_dword(dev,
PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
/*
* UltraDMA only supported on PCI646U and PCI646U2, which
* correspond to revisions 0x03, 0x05 and 0x07 respectively.
* Actually, although the CMD tech support people won't
* tell me the details, the 0x03 revision cannot support
* UDMA correctly without hardware modifications, and even
* then it only works with Quantum disks due to some
* hold time assumptions in the 646U part which are fixed
* in the 646U2.
*
* So we only do UltraDMA on revision 0x05 and 0x07 chipsets.
*/
switch(class_rev) {
case 0x07:
case 0x05:
map |= XFER_UDMA;
case 0x03:
case 0x01:
default:
break;
}
}
}
if (!eighty_ninty_three(drive)) {
if (map & XFER_UDMA)
return XFER_UDMA;
return 0;
}
return map;
}
static byte cmd680_taskfile_timing(struct ata_channel *hwif) static byte cmd680_taskfile_timing(struct ata_channel *hwif)
{ {
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
...@@ -435,7 +488,6 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed) ...@@ -435,7 +488,6 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed)
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
int err = 0;
u8 unit = (drive->select.b.unit & 0x01); u8 unit = (drive->select.b.unit & 0x01);
u8 pciU = (hwif->unit) ? UDIDETCR1 : UDIDETCR0; u8 pciU = (hwif->unit) ? UDIDETCR1 : UDIDETCR0;
...@@ -469,8 +521,6 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed) ...@@ -469,8 +521,6 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed)
case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break;
case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break;
#else #else
int err = 0;
switch(speed) { switch(speed) {
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
case XFER_PIO_4: cmd64x_tuneproc(drive, 4); break; case XFER_PIO_4: cmd64x_tuneproc(drive, 4); break;
...@@ -487,8 +537,8 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed) ...@@ -487,8 +537,8 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed)
(void) pci_write_config_byte(dev, pciU, regU); (void) pci_write_config_byte(dev, pciU, regU);
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
err = ide_config_drive_speed(drive, speed); if (!drive->init_speed)
drive->init_speed = speed;
drive->current_speed = speed; drive->current_speed = speed;
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
...@@ -496,7 +546,7 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed) ...@@ -496,7 +546,7 @@ static int cmd64x_tune_chipset(struct ata_device *drive, byte speed)
(void) pci_write_config_byte(dev, pciD, regD); (void) pci_write_config_byte(dev, pciD, regD);
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
return err; return ide_config_drive_speed(drive, speed);
} }
static int cmd680_tune_chipset(struct ata_device *drive, byte speed) static int cmd680_tune_chipset(struct ata_device *drive, byte speed)
...@@ -511,7 +561,6 @@ static int cmd680_tune_chipset(struct ata_device *drive, byte speed) ...@@ -511,7 +561,6 @@ static int cmd680_tune_chipset(struct ata_device *drive, byte speed)
u8 scsc = 0; u8 scsc = 0;
u16 ultra = 0; u16 ultra = 0;
u16 multi = 0; u16 multi = 0;
int err = 0;
pci_read_config_byte(dev, addr_mask, &mode_pci); pci_read_config_byte(dev, addr_mask, &mode_pci);
pci_read_config_byte(dev, 0x8A, &scsc); pci_read_config_byte(dev, 0x8A, &scsc);
...@@ -594,7 +643,6 @@ speed_break : ...@@ -594,7 +643,6 @@ speed_break :
return 1; return 1;
} }
if (speed >= XFER_MW_DMA_0) if (speed >= XFER_MW_DMA_0)
config_cmd680_chipset_for_pio(drive, 0); config_cmd680_chipset_for_pio(drive, 0);
...@@ -609,183 +657,47 @@ speed_break : ...@@ -609,183 +657,47 @@ speed_break :
pci_write_config_word(dev, dma_pci, multi); pci_write_config_word(dev, dma_pci, multi);
pci_write_config_word(dev, udma_pci, ultra); pci_write_config_word(dev, udma_pci, ultra);
err = ide_config_drive_speed(drive, speed); if (!drive->init_speed)
drive->init_speed = speed;
drive->current_speed = speed; drive->current_speed = speed;
return err;
return ide_config_drive_speed(drive, speed);
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
static int config_cmd64x_chipset_for_dma(struct ata_device *drive, unsigned int rev, byte ultra_66) static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
{ {
struct hd_driveid *id = drive->id; int map;
struct ata_channel *hwif = drive->channel; u8 mode;
struct pci_dev *dev = hwif->pci_dev;
byte speed = 0x00;
byte set_pio = 0x00;
byte udma_33 = ((rev >= 0x05) || (ultra_66)) ? 1 : 0;
byte udma_66 = eighty_ninty_three(drive);
byte udma_100 = 0;
int rval;
switch(dev->device) {
case PCI_DEVICE_ID_CMD_649: udma_100 = 1; break;
case PCI_DEVICE_ID_CMD_648:
case PCI_DEVICE_ID_CMD_646:
case PCI_DEVICE_ID_CMD_643:
default:
break;
}
if (drive->type != ATA_DISK) { if (drive->type != ATA_DISK) {
cmdprintk("CMD64X: drive is not a disk at double check, inital check failed!!\n"); cmdprintk("CMD64X: drive is not a disk at double check, inital check failed!!\n");
return 0; return 0;
} }
/* UltraDMA only supported on PCI646U and PCI646U2, if (udma)
* which correspond to revisions 0x03, 0x05 and 0x07 respectively. map = cmd64x_ratemask(drive);
* Actually, although the CMD tech support people won't else
* tell me the details, the 0x03 revision cannot support map = XFER_SWDMA | XFER_MWDMA;
* UDMA correctly without hardware modifications, and even
* then it only works with Quantum disks due to some
* hold time assumptions in the 646U part which are fixed
* in the 646U2.
* So we only do UltraDMA on revision 0x05 and 0x07 chipsets.
*/
if ((id->dma_ultra & 0x0020) && (udma_100) && (udma_66) && (udma_33)) {
speed = XFER_UDMA_5;
} else if ((id->dma_ultra & 0x0010) && (udma_66) && (udma_33)) {
speed = XFER_UDMA_4;
} else if ((id->dma_ultra & 0x0008) && (udma_66) && (udma_33)) {
speed = XFER_UDMA_3;
} else if ((id->dma_ultra & 0x0004) && (udma_33)) {
speed = XFER_UDMA_2;
} else if ((id->dma_ultra & 0x0002) && (udma_33)) {
speed = XFER_UDMA_1;
} else if ((id->dma_ultra & 0x0001) && (udma_33)) {
speed = XFER_UDMA_0;
} else if (id->dma_mword & 0x0004) {
speed = XFER_MW_DMA_2;
} else if (id->dma_mword & 0x0002) {
speed = XFER_MW_DMA_1;
} else if (id->dma_mword & 0x0001) {
speed = XFER_MW_DMA_0;
} else if (id->dma_1word & 0x0004) {
speed = XFER_SW_DMA_2;
} else if (id->dma_1word & 0x0002) {
speed = XFER_SW_DMA_1;
} else if (id->dma_1word & 0x0001) {
speed = XFER_SW_DMA_0;
} else {
set_pio = 1;
}
if (!drive->init_speed)
drive->init_speed = speed;
config_chipset_for_pio(drive, set_pio);
if (set_pio) mode = ata_timing_mode(drive, map);
return 0;
if (cmd64x_tune_chipset(drive, speed)) if (mode < XFER_SW_DMA_0) {
config_chipset_for_pio(drive, 1);
return 0; return 0;
rval = (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 rval;
}
static int config_cmd680_chipset_for_dma(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
byte udma_66 = eighty_ninty_three(drive);
byte speed = 0x00;
byte set_pio = 0x00;
int rval;
if ((id->dma_ultra & 0x0040) && (udma_66)) speed = XFER_UDMA_6;
else if ((id->dma_ultra & 0x0020) && (udma_66)) speed = XFER_UDMA_5;
else if ((id->dma_ultra & 0x0010) && (udma_66)) speed = XFER_UDMA_4;
else if ((id->dma_ultra & 0x0008) && (udma_66)) speed = XFER_UDMA_3;
else if (id->dma_ultra & 0x0004) speed = XFER_UDMA_2;
else if (id->dma_ultra & 0x0002) speed = XFER_UDMA_1;
else if (id->dma_ultra & 0x0001) speed = XFER_UDMA_0;
else if (id->dma_mword & 0x0004) speed = XFER_MW_DMA_2;
else if (id->dma_mword & 0x0002) speed = XFER_MW_DMA_1;
else if (id->dma_mword & 0x0001) speed = XFER_MW_DMA_0;
else {
set_pio = 1;
} }
if (!drive->init_speed) config_chipset_for_pio(drive, 0);
drive->init_speed = speed; return !drive->channel->speedproc(drive, mode);
config_chipset_for_pio(drive, set_pio);
if (set_pio)
return 0;
if (cmd680_tune_chipset(drive, speed))
return 0;
rval = (int)( ((id->dma_ultra >> 14) & 3) ? 1 :
((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 rval;
}
static int config_chipset_for_dma(struct ata_device *drive, unsigned int rev, byte ultra_66)
{
if (drive->channel->pci_dev->device == PCI_DEVICE_ID_CMD_680)
return (config_cmd680_chipset_for_dma(drive));
return (config_cmd64x_chipset_for_dma(drive, rev, ultra_66));
} }
static int cmd64x_config_drive_for_dma(struct ata_device *drive) static int cmd64x_config_drive_for_dma(struct ata_device *drive)
{ {
struct hd_driveid *id = drive->id; struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
unsigned int class_rev = 0;
byte can_ultra_33 = 0;
byte can_ultra_66 = 0;
byte can_ultra_100 = 0;
byte can_ultra_133 = 0;
int on = 1; int on = 1;
int verbose = 1; int verbose = 1;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
switch(dev->device) {
case PCI_DEVICE_ID_CMD_680:
can_ultra_133 = 1;
case PCI_DEVICE_ID_CMD_649:
can_ultra_100 = 1;
case PCI_DEVICE_ID_CMD_648:
can_ultra_66 = 1;
case PCI_DEVICE_ID_CMD_643:
can_ultra_33 = 1;
break;
case PCI_DEVICE_ID_CMD_646:
can_ultra_33 = (class_rev >= 0x05) ? 1 : 0;
can_ultra_66 = 0;
can_ultra_100 = 0;
break;
default:
udma_enable(drive, 0, 1);
return 0;
}
if ((id != NULL) && ((id->capability & 1) != 0) && if ((id != NULL) && ((id->capability & 1) != 0) &&
hwif->autodma && (drive->type == ATA_DISK)) { hwif->autodma && (drive->type == ATA_DISK)) {
/* Consult the list of known "bad" drives */ /* Consult the list of known "bad" drives */
...@@ -795,10 +707,10 @@ static int cmd64x_config_drive_for_dma(struct ata_device *drive) ...@@ -795,10 +707,10 @@ static int cmd64x_config_drive_for_dma(struct ata_device *drive)
} }
on = 0; on = 0;
verbose = 0; verbose = 0;
if ((id->field_valid & 4) && (can_ultra_33)) { if ((id->field_valid & 4)) {
if (id->dma_ultra & 0x007F) { if (id->dma_ultra & 0x007F) {
/* Force if Capable UltraDMA */ /* Force if Capable UltraDMA */
on = config_chipset_for_dma(drive, class_rev, can_ultra_66); on = config_chipset_for_dma(drive, 1);
if ((id->field_valid & 2) && if ((id->field_valid & 2) &&
(!on)) (!on))
goto try_dma_modes; goto try_dma_modes;
...@@ -808,7 +720,7 @@ static int cmd64x_config_drive_for_dma(struct ata_device *drive) ...@@ -808,7 +720,7 @@ static int cmd64x_config_drive_for_dma(struct ata_device *drive)
if ((id->dma_mword & 0x0007) || if ((id->dma_mword & 0x0007) ||
(id->dma_1word & 0x0007)) { (id->dma_1word & 0x0007)) {
/* Force if Capable regular DMA modes */ /* Force if Capable regular DMA modes */
on = config_chipset_for_dma(drive, class_rev, 0); on = config_chipset_for_dma(drive, 0);
if (!on) if (!on)
goto no_dma_set; goto no_dma_set;
} }
...@@ -817,7 +729,7 @@ static int cmd64x_config_drive_for_dma(struct ata_device *drive) ...@@ -817,7 +729,7 @@ static int cmd64x_config_drive_for_dma(struct ata_device *drive)
goto no_dma_set; goto no_dma_set;
} }
/* Consult the list of known "good" drives */ /* Consult the list of known "good" drives */
on = config_chipset_for_dma(drive, class_rev, 0); on = config_chipset_for_dma(drive, 0);
if (!on) if (!on)
goto no_dma_set; goto no_dma_set;
} else { } else {
...@@ -1122,14 +1034,13 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif) ...@@ -1122,14 +1034,13 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif)
hwif->drives[0].autotune = 1; hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1; hwif->drives[1].autotune = 1;
if (!hwif->dma_base)
return;
#ifdef CONFIG_BLK_DEV_IDEDMA
switch(dev->device) { switch(dev->device) {
case PCI_DEVICE_ID_CMD_680: case PCI_DEVICE_ID_CMD_680:
hwif->busproc = cmd680_busproc; hwif->busproc = cmd680_busproc;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base)
hwif->XXX_udma = cmd680_dmaproc; hwif->XXX_udma = cmd680_dmaproc;
#endif
hwif->resetproc = cmd680_reset; hwif->resetproc = cmd680_reset;
hwif->speedproc = cmd680_tune_chipset; hwif->speedproc = cmd680_tune_chipset;
hwif->tuneproc = cmd680_tuneproc; hwif->tuneproc = cmd680_tuneproc;
...@@ -1137,22 +1048,30 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif) ...@@ -1137,22 +1048,30 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif)
case PCI_DEVICE_ID_CMD_649: case PCI_DEVICE_ID_CMD_649:
case PCI_DEVICE_ID_CMD_648: case PCI_DEVICE_ID_CMD_648:
case PCI_DEVICE_ID_CMD_643: case PCI_DEVICE_ID_CMD_643:
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->XXX_udma = cmd64x_dmaproc;
hwif->udma_stop = cmd64x_udma_stop; hwif->udma_stop = cmd64x_udma_stop;
hwif->udma_irq_status = cmd64x_udma_irq_status; hwif->udma_irq_status = cmd64x_udma_irq_status;
hwif->XXX_udma = cmd64x_dmaproc; }
#endif
hwif->tuneproc = cmd64x_tuneproc; hwif->tuneproc = cmd64x_tuneproc;
hwif->speedproc = cmd64x_tune_chipset; hwif->speedproc = cmd64x_tune_chipset;
break; break;
case PCI_DEVICE_ID_CMD_646: case PCI_DEVICE_ID_CMD_646:
hwif->chipset = ide_cmd646; hwif->chipset = ide_cmd646;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
if (class_rev == 0x01) { if (class_rev == 0x01) {
hwif->udma_stop = cmd646_1_udma_stop;
hwif->XXX_udma = cmd646_1_dmaproc; hwif->XXX_udma = cmd646_1_dmaproc;
hwif->udma_stop = cmd646_1_udma_stop;
} else { } else {
hwif->XXX_udma = cmd64x_dmaproc;
hwif->udma_stop = cmd64x_udma_stop; hwif->udma_stop = cmd64x_udma_stop;
hwif->udma_irq_status = cmd64x_udma_irq_status; hwif->udma_irq_status = cmd64x_udma_irq_status;
hwif->XXX_udma = cmd64x_dmaproc;
} }
}
#endif
hwif->tuneproc = cmd64x_tuneproc; hwif->tuneproc = cmd64x_tuneproc;
hwif->speedproc = cmd64x_tune_chipset; hwif->speedproc = cmd64x_tune_chipset;
break; break;
...@@ -1160,7 +1079,14 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif) ...@@ -1160,7 +1079,14 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif)
break; break;
} }
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1; hwif->highmem = 1;
# ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
# endif
}
#endif #endif
} }
......
...@@ -111,7 +111,6 @@ static void hpt34x_clear_chipset (ide_drive_t *drive) ...@@ -111,7 +111,6 @@ static void hpt34x_clear_chipset (ide_drive_t *drive)
static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed) static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
{ {
int err;
byte hi_speed, lo_speed; byte hi_speed, lo_speed;
unsigned int reg1 = 0, tmp1 = 0; unsigned int reg1 = 0, tmp1 = 0;
unsigned int reg2 = 0, tmp2 = 0; unsigned int reg2 = 0, tmp2 = 0;
...@@ -129,13 +128,9 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed) ...@@ -129,13 +128,9 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
pci_read_config_dword(drive->channel->pci_dev, 0x48, &reg2); pci_read_config_dword(drive->channel->pci_dev, 0x48, &reg2);
tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn)))); tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn))));
tmp2 = ((hi_speed << drive->dn) | reg2); tmp2 = ((hi_speed << drive->dn) | reg2);
err = ide_config_drive_speed(drive, speed);
pci_write_config_dword(drive->channel->pci_dev, 0x44, tmp1); pci_write_config_dword(drive->channel->pci_dev, 0x44, tmp1);
pci_write_config_dword(drive->channel->pci_dev, 0x48, tmp2); pci_write_config_dword(drive->channel->pci_dev, 0x48, tmp2);
if (!drive->init_speed)
drive->init_speed = speed;
#if HPT343_DEBUG_DRIVE_INFO #if HPT343_DEBUG_DRIVE_INFO
printk("%s: %s drive%d (0x%04x 0x%04x) (0x%04x 0x%04x)" \ printk("%s: %s drive%d (0x%04x 0x%04x) (0x%04x 0x%04x)" \
" (0x%02x 0x%02x) 0x%04x\n", " (0x%02x 0x%02x) 0x%04x\n",
...@@ -144,8 +139,10 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed) ...@@ -144,8 +139,10 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
hi_speed, lo_speed, err); hi_speed, lo_speed, err);
#endif /* HPT343_DEBUG_DRIVE_INFO */ #endif /* HPT343_DEBUG_DRIVE_INFO */
if (!drive->init_speed)
drive->init_speed = speed;
drive->current_speed = speed; drive->current_speed = speed;
return(err); return ide_config_drive_speed(drive, speed);
} }
static void config_chipset_for_pio(ide_drive_t *drive) static void config_chipset_for_pio(ide_drive_t *drive)
...@@ -201,55 +198,25 @@ static void hpt34x_tune_drive (ide_drive_t *drive, byte pio) ...@@ -201,55 +198,25 @@ static void hpt34x_tune_drive (ide_drive_t *drive, byte pio)
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
/* static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
* This allows the configuration of ide_pci chipset registers
* for cards that learn about the drive's UDMA, DMA, PIO capabilities
* after the drive is reported by the OS. Initally for designed for
* HPT343 UDMA chipset by HighPoint|Triones Technologies, Inc.
*/
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
{ {
struct hd_driveid *id = drive->id; int map;
byte speed = 0x00; u8 mode;
if (drive->type != ATA_DISK) if (drive->type != ATA_DISK)
return 0; return 0;
hpt34x_clear_chipset(drive); if (udma)
map = XFER_UDMA;
else
map = XFER_SWDMA | XFER_MWDMA;
if ((id->dma_ultra & 0x0010) && ultra) { mode = ata_timing_mode(drive, map);
speed = XFER_UDMA_2; if (mode < XFER_SW_DMA_0)
} else if ((id->dma_ultra & 0x0008) && ultra) {
speed = XFER_UDMA_2;
} else if ((id->dma_ultra & 0x0004) && ultra) {
speed = XFER_UDMA_2;
} else if ((id->dma_ultra & 0x0002) && ultra) {
speed = XFER_UDMA_1;
} else if ((id->dma_ultra & 0x0001) && ultra) {
speed = XFER_UDMA_0;
} else if (id->dma_mword & 0x0004) {
speed = XFER_MW_DMA_2;
} else if (id->dma_mword & 0x0002) {
speed = XFER_MW_DMA_1;
} else if (id->dma_mword & 0x0001) {
speed = XFER_MW_DMA_0;
} else if (id->dma_1word & 0x0004) {
speed = XFER_SW_DMA_2;
} else if (id->dma_1word & 0x0002) {
speed = XFER_SW_DMA_1;
} else if (id->dma_1word & 0x0001) {
speed = XFER_SW_DMA_0;
} else {
return 0; return 0;
}
(void) hpt34x_tune_chipset(drive, speed); hpt34x_clear_chipset(drive);
return !hpt34x_tune_chipset(drive, mode);
return ((int) ((id->dma_ultra >> 11) & 3) ? 0 :
((id->dma_ultra >> 8) & 7) ? 1 :
((id->dma_mword >> 8) & 7) ? 1 :
((id->dma_1word >> 8) & 7) ? 1 :
0);
} }
static int config_drive_xfer_rate(struct ata_device *drive) static int config_drive_xfer_rate(struct ata_device *drive)
......
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
/* Mark that we've seen a media change, and invalidate our internal /* Mark that we've seen a media change, and invalidate our internal
buffers. */ buffers. */
static void cdrom_saw_media_change (ide_drive_t *drive) static void cdrom_saw_media_change(struct ata_device *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
...@@ -331,8 +331,7 @@ static void cdrom_saw_media_change (ide_drive_t *drive) ...@@ -331,8 +331,7 @@ static void cdrom_saw_media_change (ide_drive_t *drive)
info->nsectors_buffered = 0; info->nsectors_buffered = 0;
} }
static static void cdrom_analyze_sense_data(struct ata_device *drive, struct request *rq)
void cdrom_analyze_sense_data(ide_drive_t *drive, struct request *rq)
{ {
int log = 0; int log = 0;
/* FIXME --mdcki */ /* FIXME --mdcki */
...@@ -516,7 +515,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, struct request *rq) ...@@ -516,7 +515,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, struct request *rq)
#endif #endif
} }
static void cdrom_queue_request_sense(ide_drive_t *drive, static void cdrom_queue_request_sense(struct ata_device *drive,
struct completion *wait, struct completion *wait,
struct request_sense *sense, struct request_sense *sense,
struct packet_command *failed_command) struct packet_command *failed_command)
...@@ -813,7 +812,7 @@ static ide_startstop_t cdrom_transfer_packet_command(struct ata_device *drive, ...@@ -813,7 +812,7 @@ static ide_startstop_t cdrom_transfer_packet_command(struct ata_device *drive,
* sector added, SECTOR is its sector number. (SECTOR is then ignored until * sector added, SECTOR is its sector number. (SECTOR is then ignored until
* the buffer is cleared.) * the buffer is cleared.)
*/ */
static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector, static void cdrom_buffer_sectors(struct ata_device *drive, unsigned long sector,
int sectors_to_transfer) int sectors_to_transfer)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
...@@ -1381,7 +1380,7 @@ void cdrom_sleep (int time) ...@@ -1381,7 +1380,7 @@ void cdrom_sleep (int time)
} }
static static
int cdrom_queue_packet_command(ide_drive_t *drive, unsigned char *cmd, int cdrom_queue_packet_command(struct ata_device *drive, unsigned char *cmd,
struct request_sense *sense, struct packet_command *pc) struct request_sense *sense, struct packet_command *pc)
{ {
struct request rq; struct request rq;
...@@ -1728,7 +1727,7 @@ int msf_to_lba (byte m, byte s, byte f) ...@@ -1728,7 +1727,7 @@ int msf_to_lba (byte m, byte s, byte f)
return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
} }
static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) static int cdrom_check_status(struct ata_device *drive, struct request_sense *sense)
{ {
unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char cmd[CDROM_PACKET_SIZE];
struct packet_command pc; struct packet_command pc;
...@@ -1753,7 +1752,7 @@ static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) ...@@ -1753,7 +1752,7 @@ static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
/* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */ /* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */
static int static int
cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense) cdrom_lockdoor(struct ata_device *drive, int lockflag, struct request_sense *sense)
{ {
struct packet_command pc; struct packet_command pc;
int stat; int stat;
...@@ -1795,7 +1794,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense) ...@@ -1795,7 +1794,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
/* Eject the disk if EJECTFLAG is 0. /* Eject the disk if EJECTFLAG is 0.
If EJECTFLAG is 1, try to reload the disk. */ If EJECTFLAG is 1, try to reload the disk. */
static int cdrom_eject(ide_drive_t *drive, int ejectflag, static int cdrom_eject(struct ata_device *drive, int ejectflag,
struct request_sense *sense) struct request_sense *sense)
{ {
struct packet_command pc; struct packet_command pc;
...@@ -1816,7 +1815,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag, ...@@ -1816,7 +1815,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
return cdrom_queue_packet_command(drive, cmd, sense, &pc); return cdrom_queue_packet_command(drive, cmd, sense, &pc);
} }
static int cdrom_read_capacity(ide_drive_t *drive, u32 *capacity, static int cdrom_read_capacity(struct ata_device *drive, u32 *capacity,
struct request_sense *sense) struct request_sense *sense)
{ {
struct { struct {
...@@ -1841,7 +1840,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, u32 *capacity, ...@@ -1841,7 +1840,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, u32 *capacity,
return stat; return stat;
} }
static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag, static int cdrom_read_tocentry(struct ata_device *drive, int trackno, int msf_flag,
int format, char *buf, int buflen, int format, char *buf, int buflen,
struct request_sense *sense) struct request_sense *sense)
{ {
...@@ -1868,7 +1867,7 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag, ...@@ -1868,7 +1867,7 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag,
/* Try to read the entire TOC for the disk into our internal buffer. */ /* Try to read the entire TOC for the disk into our internal buffer. */
static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense) static int cdrom_read_toc(struct ata_device *drive, struct request_sense *sense)
{ {
int minor, stat, ntracks, i; int minor, stat, ntracks, i;
kdev_t dev; kdev_t dev;
...@@ -2023,7 +2022,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense) ...@@ -2023,7 +2022,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
} }
static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf, static int cdrom_read_subchannel(struct ata_device *drive, int format, char *buf,
int buflen, struct request_sense *sense) int buflen, struct request_sense *sense)
{ {
unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char cmd[CDROM_PACKET_SIZE];
...@@ -2046,7 +2045,7 @@ static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf, ...@@ -2046,7 +2045,7 @@ static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf,
/* ATAPI cdrom drives are free to select the speed you request or any slower /* ATAPI cdrom drives are free to select the speed you request or any slower
rate :-( Requesting too fast a speed will _not_ produce an error. */ rate :-( Requesting too fast a speed will _not_ produce an error. */
static int cdrom_select_speed(ide_drive_t *drive, int speed, static int cdrom_select_speed(struct ata_device *drive, int speed,
struct request_sense *sense) struct request_sense *sense)
{ {
unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char cmd[CDROM_PACKET_SIZE];
...@@ -2076,7 +2075,7 @@ static int cdrom_select_speed(ide_drive_t *drive, int speed, ...@@ -2076,7 +2075,7 @@ static int cdrom_select_speed(ide_drive_t *drive, int speed,
return cdrom_queue_packet_command(drive, cmd, sense, &pc); return cdrom_queue_packet_command(drive, cmd, sense, &pc);
} }
static int cdrom_play_audio(ide_drive_t *drive, int lba_start, int lba_end) static int cdrom_play_audio(struct ata_device *drive, int lba_start, int lba_end)
{ {
struct request_sense sense; struct request_sense sense;
unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char cmd[CDROM_PACKET_SIZE];
...@@ -2092,7 +2091,7 @@ static int cdrom_play_audio(ide_drive_t *drive, int lba_start, int lba_end) ...@@ -2092,7 +2091,7 @@ static int cdrom_play_audio(ide_drive_t *drive, int lba_start, int lba_end)
return cdrom_queue_packet_command(drive, cmd, &sense, &pc); return cdrom_queue_packet_command(drive, cmd, &sense, &pc);
} }
static int cdrom_get_toc_entry(ide_drive_t *drive, int track, static int cdrom_get_toc_entry(struct ata_device *drive, int track,
struct atapi_toc_entry **ent) struct atapi_toc_entry **ent)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
...@@ -2124,7 +2123,7 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi, ...@@ -2124,7 +2123,7 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc) struct cdrom_generic_command *cgc)
{ {
struct packet_command pc; struct packet_command pc;
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
if (cgc->timeout <= 0) if (cgc->timeout <= 0)
cgc->timeout = WAIT_CMD; cgc->timeout = WAIT_CMD;
...@@ -2196,7 +2195,7 @@ static ...@@ -2196,7 +2195,7 @@ static
int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
int stat; int stat;
...@@ -2272,7 +2271,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, ...@@ -2272,7 +2271,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
static static
int ide_cdrom_reset (struct cdrom_device_info *cdi) int ide_cdrom_reset (struct cdrom_device_info *cdi)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
struct request_sense sense; struct request_sense sense;
struct request req; struct request req;
int ret; int ret;
...@@ -2295,7 +2294,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi) ...@@ -2295,7 +2294,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
static static
int ide_cdrom_tray_move(struct cdrom_device_info *cdi, int position) int ide_cdrom_tray_move(struct cdrom_device_info *cdi, int position)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
struct request_sense sense; struct request_sense sense;
if (position) { if (position) {
...@@ -2310,7 +2309,7 @@ int ide_cdrom_tray_move(struct cdrom_device_info *cdi, int position) ...@@ -2310,7 +2309,7 @@ int ide_cdrom_tray_move(struct cdrom_device_info *cdi, int position)
static static
int ide_cdrom_lock_door(struct cdrom_device_info *cdi, int lock) int ide_cdrom_lock_door(struct cdrom_device_info *cdi, int lock)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
struct request_sense sense; struct request_sense sense;
return cdrom_lockdoor(drive, lock, &sense); return cdrom_lockdoor(drive, lock, &sense);
...@@ -2319,7 +2318,7 @@ int ide_cdrom_lock_door(struct cdrom_device_info *cdi, int lock) ...@@ -2319,7 +2318,7 @@ int ide_cdrom_lock_door(struct cdrom_device_info *cdi, int lock)
static static
int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
struct request_sense sense; struct request_sense sense;
int stat; int stat;
...@@ -2333,7 +2332,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) ...@@ -2333,7 +2332,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
static static
int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr) int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
if (slot_nr == CDSL_CURRENT) { if (slot_nr == CDSL_CURRENT) {
struct request_sense sense; struct request_sense sense;
...@@ -2368,7 +2367,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi, ...@@ -2368,7 +2367,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi,
struct cdrom_multisession *ms_info) struct cdrom_multisession *ms_info)
{ {
struct atapi_toc *toc; struct atapi_toc *toc;
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct request_sense sense; struct request_sense sense;
int ret; int ret;
...@@ -2390,7 +2389,7 @@ int ide_cdrom_get_mcn (struct cdrom_device_info *cdi, ...@@ -2390,7 +2389,7 @@ int ide_cdrom_get_mcn (struct cdrom_device_info *cdi,
{ {
int stat; int stat;
char mcnbuf[24]; char mcnbuf[24];
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
/* get MCN */ /* get MCN */
if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), NULL))) if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), NULL)))
...@@ -2414,7 +2413,7 @@ static ...@@ -2414,7 +2413,7 @@ static
int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi, int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi,
int slot_nr) int slot_nr)
{ {
ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct ata_device *drive = (struct ata_device *) cdi->handle;
int retval; int retval;
if (slot_nr == CDSL_CURRENT) { if (slot_nr == CDSL_CURRENT) {
...@@ -2472,7 +2471,7 @@ static struct cdrom_device_ops ide_cdrom_dops = { ...@@ -2472,7 +2471,7 @@ static struct cdrom_device_ops ide_cdrom_dops = {
generic_packet: ide_cdrom_packet, generic_packet: ide_cdrom_packet,
}; };
static int ide_cdrom_register (ide_drive_t *drive, int nslots) static int ide_cdrom_register(struct ata_device *drive, int nslots)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *devinfo = &info->devinfo; struct cdrom_device_info *devinfo = &info->devinfo;
...@@ -2518,7 +2517,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) ...@@ -2518,7 +2517,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
} }
static static
int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_page *cap) int ide_cdrom_get_capabilities(struct ata_device *drive, struct atapi_capabilities_page *cap)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo; struct cdrom_device_info *cdi = &info->devinfo;
...@@ -2541,7 +2540,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag ...@@ -2541,7 +2540,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag
* registered with the Uniform layer yet, it can't do this. * registered with the Uniform layer yet, it can't do this.
* Same goes for cdi->ops. * Same goes for cdi->ops.
*/ */
cdi->handle = (ide_drive_t *) drive; cdi->handle = (struct ata_device *) drive;
cdi->ops = &ide_cdrom_dops; cdi->ops = &ide_cdrom_dops;
init_cdrom_command(&cgc, cap, size, CGC_DATA_UNKNOWN); init_cdrom_command(&cgc, cap, size, CGC_DATA_UNKNOWN);
do { /* we seem to get stat=0x01,err=0x00 the first time (??) */ do { /* we seem to get stat=0x01,err=0x00 the first time (??) */
...@@ -2553,7 +2552,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag ...@@ -2553,7 +2552,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag
} }
static static
int ide_cdrom_probe_capabilities (ide_drive_t *drive) int ide_cdrom_probe_capabilities(struct ata_device *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo; struct cdrom_device_info *cdi = &info->devinfo;
...@@ -2659,8 +2658,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) ...@@ -2659,8 +2658,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
return nslots; return nslots;
} }
static static int ide_cdrom_setup(struct ata_device *drive)
int ide_cdrom_setup(ide_drive_t *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo; struct cdrom_device_info *cdi = &info->devinfo;
...@@ -2797,16 +2795,14 @@ int ide_cdrom_setup(ide_drive_t *drive) ...@@ -2797,16 +2795,14 @@ int ide_cdrom_setup(ide_drive_t *drive)
} }
/* Forwarding functions to generic routines. */ /* Forwarding functions to generic routines. */
static static int ide_cdrom_ioctl (struct ata_device *drive,
int ide_cdrom_ioctl (ide_drive_t *drive,
struct inode *inode, struct file *file, struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return cdrom_ioctl (inode, file, cmd, arg); return cdrom_ioctl (inode, file, cmd, arg);
} }
static static int ide_cdrom_open (struct inode *ip, struct file *fp, struct ata_device *drive)
int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
int rc = -ENOMEM; int rc = -ENOMEM;
...@@ -2823,21 +2819,21 @@ int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive) ...@@ -2823,21 +2819,21 @@ int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive)
static static
void ide_cdrom_release (struct inode *inode, struct file *file, void ide_cdrom_release (struct inode *inode, struct file *file,
ide_drive_t *drive) struct ata_device *drive)
{ {
cdrom_release (inode, file); cdrom_release (inode, file);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
static static
int ide_cdrom_check_media_change (ide_drive_t *drive) int ide_cdrom_check_media_change(struct ata_device *drive)
{ {
return cdrom_media_changed(mk_kdev (drive->channel->major, return cdrom_media_changed(mk_kdev (drive->channel->major,
(drive->select.b.unit) << PARTN_BITS)); (drive->select.b.unit) << PARTN_BITS));
} }
static static
void ide_cdrom_revalidate (ide_drive_t *drive) void ide_cdrom_revalidate(struct ata_device *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct atapi_toc *toc; struct atapi_toc *toc;
...@@ -2868,7 +2864,7 @@ static sector_t ide_cdrom_capacity(struct ata_device *drive) ...@@ -2868,7 +2864,7 @@ static sector_t ide_cdrom_capacity(struct ata_device *drive)
} }
static static
int ide_cdrom_cleanup(ide_drive_t *drive) int ide_cdrom_cleanup(struct ata_device *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *devinfo = &info->devinfo; struct cdrom_device_info *devinfo = &info->devinfo;
...@@ -2910,7 +2906,7 @@ MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); ...@@ -2910,7 +2906,7 @@ MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
static void __exit ide_cdrom_exit(void) static void __exit ide_cdrom_exit(void)
{ {
ide_drive_t *drive; struct ata_device *drive;
int failed = 0; int failed = 0;
while ((drive = ide_scan_devices(ATA_ROM, "ide-cdrom", &ide_cdrom_driver, failed)) != NULL) while ((drive = ide_scan_devices(ATA_ROM, "ide-cdrom", &ide_cdrom_driver, failed)) != NULL)
...@@ -2922,7 +2918,7 @@ static void __exit ide_cdrom_exit(void) ...@@ -2922,7 +2918,7 @@ static void __exit ide_cdrom_exit(void)
int ide_cdrom_init(void) int ide_cdrom_init(void)
{ {
ide_drive_t *drive; struct ata_device *drive;
struct cdrom_info *info; struct cdrom_info *info;
int failed = 0; int failed = 0;
......
...@@ -764,7 +764,7 @@ static struct ata_pci_device chipsets[] __initdata = { ...@@ -764,7 +764,7 @@ static struct ata_pci_device chipsets[] __initdata = {
vendor: PCI_VENDOR_ID_INTEL, vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371MX, device: PCI_DEVICE_ID_INTEL_82371MX,
enablebits: {{0x6D,0x80,0x80}, {0x00,0x00,0x00}}, enablebits: {{0x6D,0x80,0x80}, {0x00,0x00,0x00}},
bootable: ON_BOARD, 0, bootable: ON_BOARD,
flags: ATA_F_NODMA flags: ATA_F_NODMA
}, },
{ {
...@@ -790,6 +790,19 @@ static struct ata_pci_device chipsets[] __initdata = { ...@@ -790,6 +790,19 @@ static struct ata_pci_device chipsets[] __initdata = {
device: PCI_DEVICE_ID_VIA_82C561, device: PCI_DEVICE_ID_VIA_82C561,
bootable: ON_BOARD, bootable: ON_BOARD,
flags: ATA_F_NOADMA flags: ATA_F_NOADMA
},
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C586_1,
bootable: ON_BOARD,
flags: ATA_F_NOADMA
},
{
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT366,
bootable: OFF_BOARD,
extra: 240,
flags: ATA_F_IRQ | ATA_F_HPTHACK
} }
}; };
......
...@@ -580,10 +580,14 @@ static int init_irq(struct ata_channel *ch) ...@@ -580,10 +580,14 @@ static int init_irq(struct ata_channel *ch)
int i; int i;
spinlock_t *lock; spinlock_t *lock;
spinlock_t *new_lock; spinlock_t *new_lock;
unsigned long *active;
unsigned long *new_active;
struct ata_channel *match = NULL; struct ata_channel *match = NULL;
/* Spare allocation before sleep. */ /* Spare allocation before sleep. */
new_lock = kmalloc(sizeof(*lock), GFP_KERNEL); new_lock = kmalloc(sizeof(*lock), GFP_KERNEL);
new_active = kmalloc(sizeof(*active), GFP_KERNEL);
*new_active = 0L;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
ch->lock = NULL; ch->lock = NULL;
...@@ -619,6 +623,7 @@ static int init_irq(struct ata_channel *ch) ...@@ -619,6 +623,7 @@ static int init_irq(struct ata_channel *ch)
*/ */
if (!match) { if (!match) {
lock = new_lock; lock = new_lock;
active = new_active;
if (!lock) { if (!lock) {
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
...@@ -627,6 +632,7 @@ static int init_irq(struct ata_channel *ch) ...@@ -627,6 +632,7 @@ static int init_irq(struct ata_channel *ch)
spin_lock_init(lock); spin_lock_init(lock);
} else { } else {
lock = match->lock; lock = match->lock;
active = match->active;
if(new_lock) if(new_lock)
kfree(new_lock); kfree(new_lock);
} }
...@@ -645,8 +651,10 @@ static int init_irq(struct ata_channel *ch) ...@@ -645,8 +651,10 @@ static int init_irq(struct ata_channel *ch)
OUT_BYTE(0x08, ch->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */ OUT_BYTE(0x08, ch->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */
if (request_irq(ch->irq, &ata_irq_request, sa, ch->name, ch)) { if (request_irq(ch->irq, &ata_irq_request, sa, ch->name, ch)) {
if (!match) if (!match) {
kfree(lock); kfree(lock);
kfree(active);
}
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
...@@ -658,6 +666,7 @@ static int init_irq(struct ata_channel *ch) ...@@ -658,6 +666,7 @@ static int init_irq(struct ata_channel *ch)
* Everything is okay. Tag us as member of this lock group. * Everything is okay. Tag us as member of this lock group.
*/ */
ch->lock = lock; ch->lock = lock;
ch->active = active;
init_timer(&ch->timer); init_timer(&ch->timer);
ch->timer.function = &ide_timer_expiry; ch->timer.function = &ide_timer_expiry;
......
...@@ -843,7 +843,7 @@ typedef struct { ...@@ -843,7 +843,7 @@ typedef struct {
* of type idetape_tape_t, defined below. * of type idetape_tape_t, defined below.
*/ */
typedef struct { typedef struct {
ide_drive_t *drive; struct ata_device *drive;
devfs_handle_t de_r, de_n; devfs_handle_t de_r, de_n;
/* /*
...@@ -1262,10 +1262,10 @@ typedef union { ...@@ -1262,10 +1262,10 @@ typedef union {
/* /*
* idetape_chrdev_t provides the link between out character device * idetape_chrdev_t provides the link between out character device
* interface and our block device interface and the corresponding * interface and our block device interface and the corresponding
* ide_drive_t structure. * ata_device structure.
*/ */
typedef struct { typedef struct {
ide_drive_t *drive; struct ata_device *drive;
} idetape_chrdev_t; } idetape_chrdev_t;
/* /*
...@@ -1422,7 +1422,7 @@ typedef struct { ...@@ -1422,7 +1422,7 @@ typedef struct {
/* /*
* The variables below are used for the character device interface. * The variables below are used for the character device interface.
* Additional state variables are defined in our ide_drive_t structure. * Additional state variables are defined in our ata_device structure.
*/ */
static idetape_chrdev_t idetape_chrdevs[MAX_HWIFS * MAX_DRIVES]; static idetape_chrdev_t idetape_chrdevs[MAX_HWIFS * MAX_DRIVES];
static int idetape_chrdev_present = 0; static int idetape_chrdev_present = 0;
...@@ -1478,7 +1478,7 @@ char *idetape_command_key_verbose (byte idetape_command_key) ...@@ -1478,7 +1478,7 @@ char *idetape_command_key_verbose (byte idetape_command_key)
* Function declarations * Function declarations
* *
*/ */
static void idetape_onstream_mode_sense_tape_parameter_page(ide_drive_t *drive, int debug); static void idetape_onstream_mode_sense_tape_parameter_page(struct ata_device *drive, int debug);
static int idetape_chrdev_release (struct inode *inode, struct file *filp); static int idetape_chrdev_release (struct inode *inode, struct file *filp);
static void idetape_write_release (struct inode *inode); static void idetape_write_release (struct inode *inode);
...@@ -1486,13 +1486,13 @@ static void idetape_write_release (struct inode *inode); ...@@ -1486,13 +1486,13 @@ static void idetape_write_release (struct inode *inode);
* Too bad. The drive wants to send us data which we are not ready to accept. * Too bad. The drive wants to send us data which we are not ready to accept.
* Just throw it away. * Just throw it away.
*/ */
static void idetape_discard_data (ide_drive_t *drive, unsigned int bcount) static void idetape_discard_data(struct ata_device *drive, unsigned int bcount)
{ {
while (bcount--) while (bcount--)
IN_BYTE (IDE_DATA_REG); IN_BYTE (IDE_DATA_REG);
} }
static void idetape_input_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigned int bcount) static void idetape_input_buffers(struct ata_device *drive, idetape_pc_t *pc, unsigned int bcount)
{ {
struct bio *bio = pc->bio; struct bio *bio = pc->bio;
int count; int count;
...@@ -1518,7 +1518,7 @@ static void idetape_input_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigne ...@@ -1518,7 +1518,7 @@ static void idetape_input_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigne
pc->bio = bio; pc->bio = bio;
} }
static void idetape_output_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigned int bcount) static void idetape_output_buffers(struct ata_device *drive, idetape_pc_t *pc, unsigned int bcount)
{ {
struct bio *bio = pc->bio; struct bio *bio = pc->bio;
int count; int count;
...@@ -1576,7 +1576,7 @@ static void idetape_update_buffers (idetape_pc_t *pc) ...@@ -1576,7 +1576,7 @@ static void idetape_update_buffers (idetape_pc_t *pc)
* driver. A storage space for a maximum of IDETAPE_PC_STACK packet * driver. A storage space for a maximum of IDETAPE_PC_STACK packet
* commands is allocated at initialization time. * commands is allocated at initialization time.
*/ */
static idetape_pc_t *idetape_next_pc_storage (ide_drive_t *drive) static idetape_pc_t *idetape_next_pc_storage(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -1602,7 +1602,7 @@ static idetape_pc_t *idetape_next_pc_storage (ide_drive_t *drive) ...@@ -1602,7 +1602,7 @@ static idetape_pc_t *idetape_next_pc_storage (ide_drive_t *drive)
* * * *
**************************************************************/ **************************************************************/
static struct request *idetape_next_rq_storage (ide_drive_t *drive) static struct request *idetape_next_rq_storage(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -1635,7 +1635,7 @@ static void idetape_init_pc (idetape_pc_t *pc) ...@@ -1635,7 +1635,7 @@ static void idetape_init_pc (idetape_pc_t *pc)
* to analyze the request sense. We currently do not utilize this * to analyze the request sense. We currently do not utilize this
* information. * information.
*/ */
static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_result_t *result) static void idetape_analyze_error(struct ata_device *drive, idetape_request_sense_result_t *result)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->failed_pc; idetape_pc_t *pc = tape->failed_pc;
...@@ -1697,7 +1697,7 @@ static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_res ...@@ -1697,7 +1697,7 @@ static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_res
} }
} }
static void idetape_abort_pipeline (ide_drive_t *drive) static void idetape_abort_pipeline(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage = tape->next_stage; idetape_stage_t *stage = tape->next_stage;
...@@ -1718,7 +1718,7 @@ static void idetape_abort_pipeline (ide_drive_t *drive) ...@@ -1718,7 +1718,7 @@ static void idetape_abort_pipeline (ide_drive_t *drive)
/* /*
* idetape_active_next_stage will declare the next stage as "active". * idetape_active_next_stage will declare the next stage as "active".
*/ */
static void idetape_active_next_stage (ide_drive_t *drive) static void idetape_active_next_stage(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage = tape->next_stage; idetape_stage_t *stage = tape->next_stage;
...@@ -1749,7 +1749,7 @@ static void idetape_active_next_stage (ide_drive_t *drive) ...@@ -1749,7 +1749,7 @@ static void idetape_active_next_stage (ide_drive_t *drive)
* stages, and if we sense that the pipeline is empty, we try to * stages, and if we sense that the pipeline is empty, we try to
* increase it, until we reach the user compile time memory limit. * increase it, until we reach the user compile time memory limit.
*/ */
static void idetape_increase_max_pipeline_stages (ide_drive_t *drive) static void idetape_increase_max_pipeline_stages(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int increase = (tape->max_pipeline - tape->min_pipeline) / 10; int increase = (tape->max_pipeline - tape->min_pipeline) / 10;
...@@ -1757,7 +1757,7 @@ static void idetape_increase_max_pipeline_stages (ide_drive_t *drive) ...@@ -1757,7 +1757,7 @@ static void idetape_increase_max_pipeline_stages (ide_drive_t *drive)
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_increase_max_pipeline_stages\n"); printk (KERN_INFO "ide-tape: Reached idetape_increase_max_pipeline_stages\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif
tape->max_stages += increase; tape->max_stages += increase;
tape->max_stages = max(tape->max_stages, tape->min_pipeline); tape->max_stages = max(tape->max_stages, tape->min_pipeline);
...@@ -1798,7 +1798,7 @@ static void idetape_kfree_stage (idetape_tape_t *tape, idetape_stage_t *stage) ...@@ -1798,7 +1798,7 @@ static void idetape_kfree_stage (idetape_tape_t *tape, idetape_stage_t *stage)
* idetape_remove_stage_head removes tape->first_stage from the pipeline. * idetape_remove_stage_head removes tape->first_stage from the pipeline.
* The caller should avoid race conditions. * The caller should avoid race conditions.
*/ */
static void idetape_remove_stage_head (ide_drive_t *drive) static void idetape_remove_stage_head(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage; idetape_stage_t *stage;
...@@ -1806,7 +1806,7 @@ static void idetape_remove_stage_head (ide_drive_t *drive) ...@@ -1806,7 +1806,7 @@ static void idetape_remove_stage_head (ide_drive_t *drive)
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n"); printk (KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif
#if IDETAPE_DEBUG_BUGS #if IDETAPE_DEBUG_BUGS
if (tape->first_stage == NULL) { if (tape->first_stage == NULL) {
printk (KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n"); printk (KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n");
...@@ -1981,7 +1981,7 @@ static void idetape_create_request_sense_cmd (idetape_pc_t *pc) ...@@ -1981,7 +1981,7 @@ static void idetape_create_request_sense_cmd (idetape_pc_t *pc)
* and wait for their completion using idetape_queue_pc_tail or * and wait for their completion using idetape_queue_pc_tail or
* idetape_queue_rw_tail. * idetape_queue_rw_tail.
*/ */
static void idetape_queue_pc_head (ide_drive_t *drive,idetape_pc_t *pc,struct request *rq) static void idetape_queue_pc_head(struct ata_device *drive, idetape_pc_t *pc, struct request *rq)
{ {
ide_init_drive_cmd (rq); ide_init_drive_cmd (rq);
rq->buffer = (char *) pc; rq->buffer = (char *) pc;
...@@ -1994,7 +1994,7 @@ static void idetape_queue_pc_head (ide_drive_t *drive,idetape_pc_t *pc,struct re ...@@ -1994,7 +1994,7 @@ static void idetape_queue_pc_head (ide_drive_t *drive,idetape_pc_t *pc,struct re
* last packet command. We queue a request sense packet command in * last packet command. We queue a request sense packet command in
* the head of the request list. * the head of the request list.
*/ */
static ide_startstop_t idetape_retry_pc (ide_drive_t *drive) static ide_startstop_t idetape_retry_pc(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc; idetape_pc_t *pc;
...@@ -2407,7 +2407,7 @@ static ide_startstop_t idetape_onstream_buffer_fill_callback (struct ata_device ...@@ -2407,7 +2407,7 @@ static ide_startstop_t idetape_onstream_buffer_fill_callback (struct ata_device
return ide_stopped; return ide_stopped;
} }
static void idetape_queue_onstream_buffer_fill (ide_drive_t *drive) static void idetape_queue_onstream_buffer_fill(struct ata_device *drive)
{ {
idetape_pc_t *pc; idetape_pc_t *pc;
struct request *rq; struct request *rq;
...@@ -2419,7 +2419,7 @@ static void idetape_queue_onstream_buffer_fill (ide_drive_t *drive) ...@@ -2419,7 +2419,7 @@ static void idetape_queue_onstream_buffer_fill (ide_drive_t *drive)
idetape_queue_pc_head (drive, pc, rq); idetape_queue_pc_head (drive, pc, rq);
} }
static void calculate_speeds(ide_drive_t *drive) static void calculate_speeds(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int full = 125, empty = 75; int full = 125, empty = 75;
...@@ -2993,7 +2993,7 @@ static void idetape_switch_buffers (idetape_tape_t *tape, idetape_stage_t *stage ...@@ -2993,7 +2993,7 @@ static void idetape_switch_buffers (idetape_tape_t *tape, idetape_stage_t *stage
/* /*
* idetape_add_stage_tail adds a new stage at the end of the pipeline. * idetape_add_stage_tail adds a new stage at the end of the pipeline.
*/ */
static void idetape_add_stage_tail (ide_drive_t *drive,idetape_stage_t *stage) static void idetape_add_stage_tail(struct ata_device *drive, idetape_stage_t *stage)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
...@@ -3001,7 +3001,7 @@ static void idetape_add_stage_tail (ide_drive_t *drive,idetape_stage_t *stage) ...@@ -3001,7 +3001,7 @@ static void idetape_add_stage_tail (ide_drive_t *drive,idetape_stage_t *stage)
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_add_stage_tail\n"); printk (KERN_INFO "ide-tape: Reached idetape_add_stage_tail\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif
spin_lock_irqsave(&tape->spinlock, flags); spin_lock_irqsave(&tape->spinlock, flags);
stage->next=NULL; stage->next=NULL;
if (tape->last_stage != NULL) if (tape->last_stage != NULL)
...@@ -3019,7 +3019,7 @@ static void idetape_add_stage_tail (ide_drive_t *drive,idetape_stage_t *stage) ...@@ -3019,7 +3019,7 @@ static void idetape_add_stage_tail (ide_drive_t *drive,idetape_stage_t *stage)
/* /*
* Initialize the OnStream AUX * Initialize the OnStream AUX
*/ */
static void idetape_init_stage (ide_drive_t *drive, idetape_stage_t *stage, int frame_type, int logical_blk_num) static void idetape_init_stage(struct ata_device *drive, idetape_stage_t *stage, int frame_type, int logical_blk_num)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
os_aux_t *aux = stage->aux; os_aux_t *aux = stage->aux;
...@@ -3082,7 +3082,7 @@ static void idetape_init_stage (ide_drive_t *drive, idetape_stage_t *stage, int ...@@ -3082,7 +3082,7 @@ static void idetape_init_stage (ide_drive_t *drive, idetape_stage_t *stage, int
* The caller should ensure that the request will not be serviced * The caller should ensure that the request will not be serviced
* before we install the completion (usually by disabling interrupts). * before we install the completion (usually by disabling interrupts).
*/ */
static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq) static void idetape_wait_for_request(struct ata_device *drive, struct request *rq)
{ {
DECLARE_COMPLETION(wait); DECLARE_COMPLETION(wait);
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3150,7 +3150,7 @@ static ide_startstop_t idetape_read_position_callback(struct ata_device *drive, ...@@ -3150,7 +3150,7 @@ static ide_startstop_t idetape_read_position_callback(struct ata_device *drive,
* if write_filemark=0. * if write_filemark=0.
* *
*/ */
static void idetape_create_write_filemark_cmd (ide_drive_t *drive, idetape_pc_t *pc,int write_filemark) static void idetape_create_write_filemark_cmd(struct ata_device *drive, idetape_pc_t *pc,int write_filemark)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3190,7 +3190,7 @@ static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc) ...@@ -3190,7 +3190,7 @@ static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc)
* the request to the request list without waiting for it to be serviced ! * the request to the request list without waiting for it to be serviced !
* In that case, we usually use idetape_queue_pc_head. * In that case, we usually use idetape_queue_pc_head.
*/ */
static int __idetape_queue_pc_tail (ide_drive_t *drive, idetape_pc_t *pc) static int __idetape_queue_pc_tail(struct ata_device *drive, idetape_pc_t *pc)
{ {
struct request rq; struct request rq;
...@@ -3200,7 +3200,7 @@ static int __idetape_queue_pc_tail (ide_drive_t *drive, idetape_pc_t *pc) ...@@ -3200,7 +3200,7 @@ static int __idetape_queue_pc_tail (ide_drive_t *drive, idetape_pc_t *pc)
return ide_do_drive_cmd(drive, &rq, ide_wait); return ide_do_drive_cmd(drive, &rq, ide_wait);
} }
static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc,int cmd) static void idetape_create_load_unload_cmd(struct ata_device *drive, idetape_pc_t *pc,int cmd)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3216,7 +3216,7 @@ static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc ...@@ -3216,7 +3216,7 @@ static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc
pc->callback = idetape_pc_callback; pc->callback = idetape_pc_callback;
} }
static int idetape_wait_ready (ide_drive_t *drive, unsigned long long timeout) static int idetape_wait_ready(struct ata_device *drive, unsigned long long timeout)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -3244,7 +3244,7 @@ static int idetape_wait_ready (ide_drive_t *drive, unsigned long long timeout) ...@@ -3244,7 +3244,7 @@ static int idetape_wait_ready (ide_drive_t *drive, unsigned long long timeout)
return -EIO; return -EIO;
} }
static int idetape_queue_pc_tail (ide_drive_t *drive,idetape_pc_t *pc) static int idetape_queue_pc_tail(struct ata_device *drive, idetape_pc_t *pc)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int rc; int rc;
...@@ -3258,7 +3258,7 @@ static int idetape_queue_pc_tail (ide_drive_t *drive,idetape_pc_t *pc) ...@@ -3258,7 +3258,7 @@ static int idetape_queue_pc_tail (ide_drive_t *drive,idetape_pc_t *pc)
return rc; return rc;
} }
static int idetape_flush_tape_buffers (ide_drive_t *drive) static int idetape_flush_tape_buffers(struct ata_device *drive)
{ {
idetape_pc_t pc; idetape_pc_t pc;
int rc; int rc;
...@@ -3278,7 +3278,7 @@ static void idetape_create_read_position_cmd (idetape_pc_t *pc) ...@@ -3278,7 +3278,7 @@ static void idetape_create_read_position_cmd (idetape_pc_t *pc)
pc->callback = idetape_read_position_callback; pc->callback = idetape_read_position_callback;
} }
static int idetape_read_position (ide_drive_t *drive) static int idetape_read_position(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -3311,7 +3311,7 @@ static int idetape_read_position (ide_drive_t *drive) ...@@ -3311,7 +3311,7 @@ static int idetape_read_position (ide_drive_t *drive)
return position; return position;
} }
static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, unsigned int block, byte partition, int skip) static void idetape_create_locate_cmd(struct ata_device *drive, idetape_pc_t *pc, unsigned int block, byte partition, int skip)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3334,7 +3334,7 @@ static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, uns ...@@ -3334,7 +3334,7 @@ static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, uns
pc->callback = idetape_pc_callback; pc->callback = idetape_pc_callback;
} }
static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int prevent) static int idetape_create_prevent_cmd(struct ata_device *drive, idetape_pc_t *pc, int prevent)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3348,7 +3348,7 @@ static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int ...@@ -3348,7 +3348,7 @@ static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int
return 1; return 1;
} }
static int __idetape_discard_read_pipeline (ide_drive_t *drive) static int __idetape_discard_read_pipeline(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
...@@ -3389,7 +3389,7 @@ static int __idetape_discard_read_pipeline (ide_drive_t *drive) ...@@ -3389,7 +3389,7 @@ static int __idetape_discard_read_pipeline (ide_drive_t *drive)
* of the request queue and wait for their completion. * of the request queue and wait for their completion.
* *
*/ */
static int idetape_position_tape (ide_drive_t *drive, unsigned int block, byte partition, int skip) static int idetape_position_tape(struct ata_device *drive, unsigned int block, byte partition, int skip)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int retval; int retval;
...@@ -3407,7 +3407,7 @@ static int idetape_position_tape (ide_drive_t *drive, unsigned int block, byte p ...@@ -3407,7 +3407,7 @@ static int idetape_position_tape (ide_drive_t *drive, unsigned int block, byte p
return (idetape_queue_pc_tail (drive, &pc)); return (idetape_queue_pc_tail (drive, &pc));
} }
static void idetape_discard_read_pipeline (ide_drive_t *drive, int restore_position) static void idetape_discard_read_pipeline(struct ata_device *drive, int restore_position)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int cnt; int cnt;
...@@ -3428,7 +3428,7 @@ static void idetape_discard_read_pipeline (ide_drive_t *drive, int restore_posit ...@@ -3428,7 +3428,7 @@ static void idetape_discard_read_pipeline (ide_drive_t *drive, int restore_posit
} }
} }
static void idetape_update_stats (ide_drive_t *drive) static void idetape_update_stats(struct ata_device *drive)
{ {
idetape_pc_t pc; idetape_pc_t pc;
...@@ -3441,7 +3441,7 @@ static void idetape_update_stats (ide_drive_t *drive) ...@@ -3441,7 +3441,7 @@ static void idetape_update_stats (ide_drive_t *drive)
* idetape_queue_rw_tail generates a read/write request for the block * idetape_queue_rw_tail generates a read/write request for the block
* device interface and wait for it to be serviced. * device interface and wait for it to be serviced.
*/ */
static int idetape_queue_rw_tail (ide_drive_t *drive, int cmd, int blocks, struct bio *bio) static int idetape_queue_rw_tail(struct ata_device *drive, int cmd, int blocks, struct bio *bio)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
struct request rq; struct request rq;
...@@ -3481,7 +3481,7 @@ static int idetape_queue_rw_tail (ide_drive_t *drive, int cmd, int blocks, struc ...@@ -3481,7 +3481,7 @@ static int idetape_queue_rw_tail (ide_drive_t *drive, int cmd, int blocks, struc
* of the write error recovery mechanism for old OnStream * of the write error recovery mechanism for old OnStream
* firmware revisions. * firmware revisions.
*/ */
static void idetape_onstream_read_back_buffer (ide_drive_t *drive) static void idetape_onstream_read_back_buffer(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int frames, i, logical_blk_num; int frames, i, logical_blk_num;
...@@ -3535,7 +3535,7 @@ static void idetape_onstream_read_back_buffer (ide_drive_t *drive) ...@@ -3535,7 +3535,7 @@ static void idetape_onstream_read_back_buffer (ide_drive_t *drive)
/* /*
* Error recovery algorithm for the OnStream tape. * Error recovery algorithm for the OnStream tape.
*/ */
static void idetape_onstream_write_error_recovery (ide_drive_t *drive) static void idetape_onstream_write_error_recovery(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned int block; unsigned int block;
...@@ -3583,7 +3583,7 @@ static void idetape_onstream_write_error_recovery (ide_drive_t *drive) ...@@ -3583,7 +3583,7 @@ static void idetape_onstream_write_error_recovery (ide_drive_t *drive)
* idetape_insert_pipeline_into_queue is used to start servicing the * idetape_insert_pipeline_into_queue is used to start servicing the
* pipeline stages, starting from tape->next_stage. * pipeline stages, starting from tape->next_stage.
*/ */
static void idetape_insert_pipeline_into_queue (ide_drive_t *drive) static void idetape_insert_pipeline_into_queue(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3606,7 +3606,7 @@ static void idetape_create_inquiry_cmd (idetape_pc_t *pc) ...@@ -3606,7 +3606,7 @@ static void idetape_create_inquiry_cmd (idetape_pc_t *pc)
pc->callback = idetape_pc_callback; pc->callback = idetape_pc_callback;
} }
static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc) static void idetape_create_rewind_cmd(struct ata_device *drive, idetape_pc_t *pc)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3651,7 +3651,7 @@ static void idetape_create_space_cmd (idetape_pc_t *pc,int count,byte cmd) ...@@ -3651,7 +3651,7 @@ static void idetape_create_space_cmd (idetape_pc_t *pc,int count,byte cmd)
/* /*
* Verify that we have the correct tape frame * Verify that we have the correct tape frame
*/ */
static int idetape_verify_stage (ide_drive_t *drive, idetape_stage_t *stage, int logical_blk_num, int quiet) static int idetape_verify_stage(struct ata_device *drive, idetape_stage_t *stage, int logical_blk_num, int quiet)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
os_aux_t *aux = stage->aux; os_aux_t *aux = stage->aux;
...@@ -3724,7 +3724,7 @@ static int idetape_verify_stage (ide_drive_t *drive, idetape_stage_t *stage, int ...@@ -3724,7 +3724,7 @@ static int idetape_verify_stage (ide_drive_t *drive, idetape_stage_t *stage, int
return 1; return 1;
} }
static void idetape_wait_first_stage (ide_drive_t *drive) static void idetape_wait_first_stage(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
...@@ -3748,7 +3748,7 @@ static void idetape_wait_first_stage (ide_drive_t *drive) ...@@ -3748,7 +3748,7 @@ static void idetape_wait_first_stage (ide_drive_t *drive)
* 3. If we still can't allocate a stage, fallback to * 3. If we still can't allocate a stage, fallback to
* non-pipelined operation mode for this request. * non-pipelined operation mode for this request.
*/ */
static int idetape_add_chrdev_write_request (ide_drive_t *drive, int blocks) static int idetape_add_chrdev_write_request(struct ata_device *drive, int blocks)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *new_stage; idetape_stage_t *new_stage;
...@@ -3836,7 +3836,7 @@ static int idetape_add_chrdev_write_request (ide_drive_t *drive, int blocks) ...@@ -3836,7 +3836,7 @@ static int idetape_add_chrdev_write_request (ide_drive_t *drive, int blocks)
* idetape_wait_for_pipeline will wait until all pending pipeline * idetape_wait_for_pipeline will wait until all pending pipeline
* requests are serviced. Typically called on device close. * requests are serviced. Typically called on device close.
*/ */
static void idetape_wait_for_pipeline (ide_drive_t *drive) static void idetape_wait_for_pipeline(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
...@@ -3850,7 +3850,7 @@ static void idetape_wait_for_pipeline (ide_drive_t *drive) ...@@ -3850,7 +3850,7 @@ static void idetape_wait_for_pipeline (ide_drive_t *drive)
} }
} }
static void idetape_empty_write_pipeline (ide_drive_t *drive) static void idetape_empty_write_pipeline(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int blocks, i, min; int blocks, i, min;
...@@ -3916,7 +3916,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) ...@@ -3916,7 +3916,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
#endif /* IDETAPE_DEBUG_BUGS */ #endif /* IDETAPE_DEBUG_BUGS */
} }
static void idetape_restart_speed_control (ide_drive_t *drive) static void idetape_restart_speed_control(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -3931,7 +3931,7 @@ static void idetape_restart_speed_control (ide_drive_t *drive) ...@@ -3931,7 +3931,7 @@ static void idetape_restart_speed_control (ide_drive_t *drive)
tape->controlled_previous_head_time = tape->uncontrolled_previous_head_time = jiffies; tape->controlled_previous_head_time = tape->uncontrolled_previous_head_time = jiffies;
} }
static int idetape_initiate_read (ide_drive_t *drive, int max_stages) static int idetape_initiate_read(struct ata_device *drive, int max_stages)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *new_stage; idetape_stage_t *new_stage;
...@@ -4000,7 +4000,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages) ...@@ -4000,7 +4000,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
return 0; return 0;
} }
static int idetape_get_logical_blk (ide_drive_t *drive, int logical_blk_num, int max_stages, int quiet) static int idetape_get_logical_blk(struct ata_device *drive, int logical_blk_num, int max_stages, int quiet)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
...@@ -4071,7 +4071,7 @@ static int idetape_get_logical_blk (ide_drive_t *drive, int logical_blk_num, int ...@@ -4071,7 +4071,7 @@ static int idetape_get_logical_blk (ide_drive_t *drive, int logical_blk_num, int
* to service a character device read request and add read-ahead * to service a character device read request and add read-ahead
* requests to our pipeline. * requests to our pipeline.
*/ */
static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks) static int idetape_add_chrdev_read_request(struct ata_device *drive,int blocks)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
...@@ -4145,7 +4145,7 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks) ...@@ -4145,7 +4145,7 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks)
return (bytes_read); return (bytes_read);
} }
static void idetape_pad_zeros (ide_drive_t *drive, int bcount) static void idetape_pad_zeros(struct ata_device *drive, int bcount)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
struct bio *bio; struct bio *bio;
...@@ -4166,7 +4166,7 @@ static void idetape_pad_zeros (ide_drive_t *drive, int bcount) ...@@ -4166,7 +4166,7 @@ static void idetape_pad_zeros (ide_drive_t *drive, int bcount)
} }
} }
static int idetape_pipeline_size (ide_drive_t *drive) static int idetape_pipeline_size(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage; idetape_stage_t *stage;
...@@ -4191,7 +4191,7 @@ static int idetape_pipeline_size (ide_drive_t *drive) ...@@ -4191,7 +4191,7 @@ static int idetape_pipeline_size (ide_drive_t *drive)
* *
* We currently support only one partition. * We currently support only one partition.
*/ */
static int idetape_rewind_tape (ide_drive_t *drive) static int idetape_rewind_tape(struct ata_device *drive)
{ {
int retval; int retval;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -4199,7 +4199,7 @@ static int idetape_rewind_tape (ide_drive_t *drive) ...@@ -4199,7 +4199,7 @@ static int idetape_rewind_tape (ide_drive_t *drive)
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2) if (tape->debug_level >= 2)
printk (KERN_INFO "ide-tape: Reached idetape_rewind_tape\n"); printk (KERN_INFO "ide-tape: Reached idetape_rewind_tape\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif
idetape_create_rewind_cmd (drive, &pc); idetape_create_rewind_cmd (drive, &pc);
retval = idetape_queue_pc_tail (drive, &pc); retval = idetape_queue_pc_tail (drive, &pc);
...@@ -4221,7 +4221,7 @@ static int idetape_rewind_tape (ide_drive_t *drive) ...@@ -4221,7 +4221,7 @@ static int idetape_rewind_tape (ide_drive_t *drive)
* mtio.h compatible commands should be issued to the character device * mtio.h compatible commands should be issued to the character device
* interface. * interface.
*/ */
static int idetape_blkdev_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, static int idetape_blkdev_ioctl(struct ata_device *drive, struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -4230,7 +4230,7 @@ static int idetape_blkdev_ioctl (ide_drive_t *drive, struct inode *inode, struct ...@@ -4230,7 +4230,7 @@ static int idetape_blkdev_ioctl (ide_drive_t *drive, struct inode *inode, struct
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_blkdev_ioctl\n"); printk (KERN_INFO "ide-tape: Reached idetape_blkdev_ioctl\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif
switch (cmd) { switch (cmd) {
case 0x0340: case 0x0340:
if (copy_from_user ((char *) &config, (char *) arg, sizeof (idetape_config_t))) if (copy_from_user ((char *) &config, (char *) arg, sizeof (idetape_config_t)))
...@@ -4255,7 +4255,7 @@ static int idetape_blkdev_ioctl (ide_drive_t *drive, struct inode *inode, struct ...@@ -4255,7 +4255,7 @@ static int idetape_blkdev_ioctl (ide_drive_t *drive, struct inode *inode, struct
* However, we still allow opening it so that we can issue general * However, we still allow opening it so that we can issue general
* ide driver configuration ioctl's, such as the interrupt unmask feature. * ide driver configuration ioctl's, such as the interrupt unmask feature.
*/ */
static int idetape_blkdev_open (struct inode *inode, struct file *filp, ide_drive_t *drive) static int idetape_blkdev_open(struct inode *inode, struct file *filp, struct ata_device *drive)
{ {
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
#if ONSTREAM_DEBUG #if ONSTREAM_DEBUG
...@@ -4264,7 +4264,7 @@ static int idetape_blkdev_open (struct inode *inode, struct file *filp, ide_driv ...@@ -4264,7 +4264,7 @@ static int idetape_blkdev_open (struct inode *inode, struct file *filp, ide_driv
return 0; return 0;
} }
static void idetape_blkdev_release (struct inode *inode, struct file *filp, ide_drive_t *drive) static void idetape_blkdev_release(struct inode *inode, struct file *filp, struct ata_device *drive)
{ {
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG #if ONSTREAM_DEBUG
...@@ -4275,7 +4275,7 @@ static void idetape_blkdev_release (struct inode *inode, struct file *filp, ide_ ...@@ -4275,7 +4275,7 @@ static void idetape_blkdev_release (struct inode *inode, struct file *filp, ide_
/* /*
* Character device interface functions * Character device interface functions
*/ */
static ide_drive_t *get_drive_ptr (kdev_t i_rdev) static struct ata_device *get_drive_ptr (kdev_t i_rdev)
{ {
unsigned int i = minor(i_rdev) & ~0xc0; unsigned int i = minor(i_rdev) & ~0xc0;
...@@ -4284,7 +4284,7 @@ static ide_drive_t *get_drive_ptr (kdev_t i_rdev) ...@@ -4284,7 +4284,7 @@ static ide_drive_t *get_drive_ptr (kdev_t i_rdev)
return (idetape_chrdevs[i].drive); return (idetape_chrdevs[i].drive);
} }
static int idetape_onstream_space_over_filemarks_backward (ide_drive_t *drive,short mt_op,int mt_count) static int idetape_onstream_space_over_filemarks_backward(struct ata_device *drive,short mt_op,int mt_count)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int cnt = 0; int cnt = 0;
...@@ -4328,7 +4328,7 @@ static int idetape_onstream_space_over_filemarks_backward (ide_drive_t *drive,sh ...@@ -4328,7 +4328,7 @@ static int idetape_onstream_space_over_filemarks_backward (ide_drive_t *drive,sh
* *
* Just scans for the filemark sequentially. * Just scans for the filemark sequentially.
*/ */
static int idetape_onstream_space_over_filemarks_forward_slow (ide_drive_t *drive,short mt_op,int mt_count) static int idetape_onstream_space_over_filemarks_forward_slow(struct ata_device *drive,short mt_op,int mt_count)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int cnt = 0; int cnt = 0;
...@@ -4371,7 +4371,7 @@ static int idetape_onstream_space_over_filemarks_forward_slow (ide_drive_t *driv ...@@ -4371,7 +4371,7 @@ static int idetape_onstream_space_over_filemarks_forward_slow (ide_drive_t *driv
/* /*
* Fast linux specific version of OnStream FSF * Fast linux specific version of OnStream FSF
*/ */
static int idetape_onstream_space_over_filemarks_forward_fast (ide_drive_t *drive,short mt_op,int mt_count) static int idetape_onstream_space_over_filemarks_forward_fast(struct ata_device *drive,short mt_op,int mt_count)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int cnt = 0, next_mark_addr; int cnt = 0, next_mark_addr;
...@@ -4455,7 +4455,7 @@ static int idetape_onstream_space_over_filemarks_forward_fast (ide_drive_t *driv ...@@ -4455,7 +4455,7 @@ static int idetape_onstream_space_over_filemarks_forward_fast (ide_drive_t *driv
* the filemark is in our internal pipeline even if the tape doesn't * the filemark is in our internal pipeline even if the tape doesn't
* support spacing over filemarks in the reverse direction. * support spacing over filemarks in the reverse direction.
*/ */
static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_count) static int idetape_space_over_filemarks(struct ata_device *drive,short mt_op,int mt_count)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -4563,7 +4563,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char *buf, ...@@ -4563,7 +4563,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
ide_drive_t *drive = get_drive_ptr (inode->i_rdev); struct ata_device *drive = get_drive_ptr (inode->i_rdev);
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
ssize_t bytes_read,temp, actually_read = 0, rc; ssize_t bytes_read,temp, actually_read = 0, rc;
...@@ -4632,7 +4632,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char *buf, ...@@ -4632,7 +4632,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char *buf,
return actually_read; return actually_read;
} }
static void idetape_update_last_marker (ide_drive_t *drive, int last_mark_addr, int next_mark_addr) static void idetape_update_last_marker(struct ata_device *drive, int last_mark_addr, int next_mark_addr)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage; idetape_stage_t *stage;
...@@ -4686,7 +4686,7 @@ static void idetape_update_last_marker (ide_drive_t *drive, int last_mark_addr, ...@@ -4686,7 +4686,7 @@ static void idetape_update_last_marker (ide_drive_t *drive, int last_mark_addr,
return; return;
} }
static void idetape_write_filler (ide_drive_t *drive, int block, int cnt) static void idetape_write_filler(struct ata_device *drive, int block, int cnt)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage; idetape_stage_t *stage;
...@@ -4717,7 +4717,7 @@ static void idetape_write_filler (ide_drive_t *drive, int block, int cnt) ...@@ -4717,7 +4717,7 @@ static void idetape_write_filler (ide_drive_t *drive, int block, int cnt)
__idetape_kfree_stage (stage); __idetape_kfree_stage (stage);
} }
static void __idetape_write_header (ide_drive_t *drive, int block, int cnt) static void __idetape_write_header(struct ata_device *drive, int block, int cnt)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage; idetape_stage_t *stage;
...@@ -4752,7 +4752,7 @@ static void __idetape_write_header (ide_drive_t *drive, int block, int cnt) ...@@ -4752,7 +4752,7 @@ static void __idetape_write_header (ide_drive_t *drive, int block, int cnt)
idetape_flush_tape_buffers (drive); idetape_flush_tape_buffers (drive);
} }
static void idetape_write_header (ide_drive_t *drive, int locate_eod) static void idetape_write_header(struct ata_device *drive, int locate_eod)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -4778,7 +4778,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char *buf, ...@@ -4778,7 +4778,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
ide_drive_t *drive = get_drive_ptr (inode->i_rdev); struct ata_device *drive = get_drive_ptr (inode->i_rdev);
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
ssize_t retval, actually_written = 0; ssize_t retval, actually_written = 0;
int position; int position;
...@@ -4914,7 +4914,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char *buf, ...@@ -4914,7 +4914,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char *buf,
return (actually_written); return (actually_written);
} }
static int idetape_write_filemark (ide_drive_t *drive) static int idetape_write_filemark(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int last_mark_addr; int last_mark_addr;
...@@ -4945,7 +4945,7 @@ static int idetape_write_filemark (ide_drive_t *drive) ...@@ -4945,7 +4945,7 @@ static int idetape_write_filemark (ide_drive_t *drive)
return 0; return 0;
} }
static void idetape_write_eod (ide_drive_t *drive) static void idetape_write_eod(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -4962,7 +4962,7 @@ static void idetape_write_eod (ide_drive_t *drive) ...@@ -4962,7 +4962,7 @@ static void idetape_write_eod (ide_drive_t *drive)
return; return;
} }
int idetape_seek_logical_blk (ide_drive_t *drive, int logical_blk_num) int idetape_seek_logical_blk(struct ata_device *drive, int logical_blk_num)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int estimated_address = logical_blk_num + 20; int estimated_address = logical_blk_num + 20;
...@@ -5061,7 +5061,7 @@ int idetape_seek_logical_blk (ide_drive_t *drive, int logical_blk_num) ...@@ -5061,7 +5061,7 @@ int idetape_seek_logical_blk (ide_drive_t *drive, int logical_blk_num)
* MTFSS, MTBSS, MTWSM, MTSETDENSITY, * MTFSS, MTBSS, MTWSM, MTSETDENSITY,
* MTSETDRVBUFFER, MT_ST_BOOLEANS, MT_ST_WRITE_THRESHOLD. * MTSETDRVBUFFER, MT_ST_BOOLEANS, MT_ST_WRITE_THRESHOLD.
*/ */
static int idetape_mtioctop (ide_drive_t *drive,short mt_op,int mt_count) static int idetape_mtioctop(struct ata_device *drive,short mt_op,int mt_count)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -5237,7 +5237,7 @@ static int idetape_mtioctop (ide_drive_t *drive,short mt_op,int mt_count) ...@@ -5237,7 +5237,7 @@ static int idetape_mtioctop (ide_drive_t *drive,short mt_op,int mt_count)
*/ */
static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
ide_drive_t *drive = get_drive_ptr (inode->i_rdev); struct ata_device *drive = get_drive_ptr (inode->i_rdev);
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
struct mtop mtop; struct mtop mtop;
struct mtget mtget; struct mtget mtget;
...@@ -5303,7 +5303,7 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne ...@@ -5303,7 +5303,7 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne
} }
} }
static int __idetape_analyze_headers (ide_drive_t *drive, int block) static int __idetape_analyze_headers(struct ata_device *drive, int block)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_stage_t *stage; idetape_stage_t *stage;
...@@ -5369,7 +5369,7 @@ static int __idetape_analyze_headers (ide_drive_t *drive, int block) ...@@ -5369,7 +5369,7 @@ static int __idetape_analyze_headers (ide_drive_t *drive, int block)
return 1; return 1;
} }
static int idetape_analyze_headers (ide_drive_t *drive) static int idetape_analyze_headers(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int position, block; int position, block;
...@@ -5401,14 +5401,14 @@ static int idetape_analyze_headers (ide_drive_t *drive) ...@@ -5401,14 +5401,14 @@ static int idetape_analyze_headers (ide_drive_t *drive)
*/ */
static int idetape_chrdev_open (struct inode *inode, struct file *filp) static int idetape_chrdev_open (struct inode *inode, struct file *filp)
{ {
ide_drive_t *drive; struct ata_device *drive;
idetape_tape_t *tape; idetape_tape_t *tape;
idetape_pc_t pc; idetape_pc_t pc;
unsigned int minor=minor(inode->i_rdev); unsigned int minor=minor(inode->i_rdev);
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
printk (KERN_INFO "ide-tape: Reached idetape_chrdev_open\n"); printk (KERN_INFO "ide-tape: Reached idetape_chrdev_open\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif
if ((drive = get_drive_ptr (inode->i_rdev)) == NULL) if ((drive = get_drive_ptr (inode->i_rdev)) == NULL)
return -ENXIO; return -ENXIO;
...@@ -5459,7 +5459,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp) ...@@ -5459,7 +5459,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
static void idetape_write_release (struct inode *inode) static void idetape_write_release (struct inode *inode)
{ {
ide_drive_t *drive = get_drive_ptr (inode->i_rdev); struct ata_device *drive = get_drive_ptr (inode->i_rdev);
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned int minor=minor(inode->i_rdev); unsigned int minor=minor(inode->i_rdev);
...@@ -5484,7 +5484,7 @@ static void idetape_write_release (struct inode *inode) ...@@ -5484,7 +5484,7 @@ static void idetape_write_release (struct inode *inode)
*/ */
static int idetape_chrdev_release (struct inode *inode, struct file *filp) static int idetape_chrdev_release (struct inode *inode, struct file *filp)
{ {
ide_drive_t *drive = get_drive_ptr (inode->i_rdev); struct ata_device *drive = get_drive_ptr (inode->i_rdev);
idetape_tape_t *tape; idetape_tape_t *tape;
idetape_pc_t pc; idetape_pc_t pc;
unsigned int minor=minor(inode->i_rdev); unsigned int minor=minor(inode->i_rdev);
...@@ -5531,7 +5531,7 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp) ...@@ -5531,7 +5531,7 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp)
* *
* 0 If this tape driver is not currently supported by us. * 0 If this tape driver is not currently supported by us.
*/ */
static int idetape_identify_device (ide_drive_t *drive,struct hd_driveid *id) static int idetape_identify_device(struct ata_device *drive,struct hd_driveid *id)
{ {
struct idetape_id_gcw gcw; struct idetape_id_gcw gcw;
#if IDETAPE_DEBUG_INFO #if IDETAPE_DEBUG_INFO
...@@ -5653,7 +5653,7 @@ static int idetape_identify_device (ide_drive_t *drive,struct hd_driveid *id) ...@@ -5653,7 +5653,7 @@ static int idetape_identify_device (ide_drive_t *drive,struct hd_driveid *id)
/* /*
* Notify vendor ID to the OnStream tape drive * Notify vendor ID to the OnStream tape drive
*/ */
static void idetape_onstream_set_vendor (ide_drive_t *drive, char *vendor) static void idetape_onstream_set_vendor(struct ata_device *drive, char *vendor)
{ {
idetape_pc_t pc; idetape_pc_t pc;
idetape_mode_parameter_header_t *header; idetape_mode_parameter_header_t *header;
...@@ -5680,7 +5680,7 @@ static void idetape_onstream_set_vendor (ide_drive_t *drive, char *vendor) ...@@ -5680,7 +5680,7 @@ static void idetape_onstream_set_vendor (ide_drive_t *drive, char *vendor)
* Various unused OnStream commands * Various unused OnStream commands
*/ */
#if ONSTREAM_DEBUG #if ONSTREAM_DEBUG
static void idetape_onstream_set_retries (ide_drive_t *drive, int retries) static void idetape_onstream_set_retries(struct ata_device *drive, int retries)
{ {
idetape_pc_t pc; idetape_pc_t pc;
...@@ -5701,7 +5701,7 @@ static void idetape_onstream_set_retries (ide_drive_t *drive, int retries) ...@@ -5701,7 +5701,7 @@ static void idetape_onstream_set_retries (ide_drive_t *drive, int retries)
/* /*
* Configure 32.5KB block size. * Configure 32.5KB block size.
*/ */
static void idetape_onstream_configure_block_size (ide_drive_t *drive) static void idetape_onstream_configure_block_size(struct ata_device *drive)
{ {
idetape_pc_t pc; idetape_pc_t pc;
idetape_mode_parameter_header_t *header; idetape_mode_parameter_header_t *header;
...@@ -5747,7 +5747,7 @@ static void idetape_onstream_configure_block_size (ide_drive_t *drive) ...@@ -5747,7 +5747,7 @@ static void idetape_onstream_configure_block_size (ide_drive_t *drive)
/* /*
* Use INQUIRY to get the firmware revision * Use INQUIRY to get the firmware revision
*/ */
static void idetape_get_inquiry_results (ide_drive_t *drive) static void idetape_get_inquiry_results(struct ata_device *drive)
{ {
char *r; char *r;
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -5777,7 +5777,7 @@ static void idetape_get_inquiry_results (ide_drive_t *drive) ...@@ -5777,7 +5777,7 @@ static void idetape_get_inquiry_results (ide_drive_t *drive)
/* /*
* Configure the OnStream ATAPI tape drive for default operation * Configure the OnStream ATAPI tape drive for default operation
*/ */
static void idetape_configure_onstream (ide_drive_t *drive) static void idetape_configure_onstream(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -5801,7 +5801,7 @@ static void idetape_configure_onstream (ide_drive_t *drive) ...@@ -5801,7 +5801,7 @@ static void idetape_configure_onstream (ide_drive_t *drive)
* idetape_get_mode_sense_parameters asks the tape about its various * idetape_get_mode_sense_parameters asks the tape about its various
* parameters. This may work for other drives to??? * parameters. This may work for other drives to???
*/ */
static void idetape_onstream_mode_sense_tape_parameter_page(ide_drive_t *drive, int debug) static void idetape_onstream_mode_sense_tape_parameter_page(struct ata_device *drive, int debug)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -5830,7 +5830,7 @@ static void idetape_onstream_mode_sense_tape_parameter_page(ide_drive_t *drive, ...@@ -5830,7 +5830,7 @@ static void idetape_onstream_mode_sense_tape_parameter_page(ide_drive_t *drive,
* parameters. In particular, we will adjust our data transfer buffer * parameters. In particular, we will adjust our data transfer buffer
* size to the recommended value as returned by the tape. * size to the recommended value as returned by the tape.
*/ */
static void idetape_get_mode_sense_results (ide_drive_t *drive) static void idetape_get_mode_sense_results(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_pc_t pc; idetape_pc_t pc;
...@@ -5904,7 +5904,7 @@ static void idetape_get_mode_sense_results (ide_drive_t *drive) ...@@ -5904,7 +5904,7 @@ static void idetape_get_mode_sense_results (ide_drive_t *drive)
* ide_get_blocksize_from_block_descriptor does a mode sense page 0 with block descriptor * ide_get_blocksize_from_block_descriptor does a mode sense page 0 with block descriptor
* and if it succeeds sets the tape block size with the reported value * and if it succeeds sets the tape block size with the reported value
*/ */
static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive) static void idetape_get_blocksize_from_block_descriptor(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
...@@ -5941,7 +5941,7 @@ static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive) ...@@ -5941,7 +5941,7 @@ static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive)
* Note that at this point ide.c already assigned us an irq, so that * Note that at this point ide.c already assigned us an irq, so that
* we can queue requests here and wait for their completion. * we can queue requests here and wait for their completion.
*/ */
static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) static void idetape_setup(struct ata_device *drive, idetape_tape_t *tape, int minor)
{ {
unsigned long t1, tmid, tn, t; unsigned long t1, tmid, tn, t;
int speed; int speed;
...@@ -6042,7 +6042,7 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) ...@@ -6042,7 +6042,7 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
tape->best_dsc_rw_frequency * 1000 / HZ, drive->using_dma ? ", DMA":""); tape->best_dsc_rw_frequency * 1000 / HZ, drive->using_dma ? ", DMA":"");
} }
static int idetape_cleanup (ide_drive_t *drive) static int idetape_cleanup(struct ata_device *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
int minor = tape->minor; int minor = tape->minor;
...@@ -6072,7 +6072,7 @@ static int idetape_cleanup (ide_drive_t *drive) ...@@ -6072,7 +6072,7 @@ static int idetape_cleanup (ide_drive_t *drive)
return 0; return 0;
} }
static void idetape_revalidate(ide_drive_t *_dummy) static void idetape_revalidate(struct ata_device *_dummy)
{ {
/* We don't have to handle any partition information here, which is the /* We don't have to handle any partition information here, which is the
* default behaviour of this method. * default behaviour of this method.
...@@ -6110,9 +6110,9 @@ static struct file_operations idetape_fops = { ...@@ -6110,9 +6110,9 @@ static struct file_operations idetape_fops = {
MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static void __exit idetape_exit (void) static void __exit idetape_exit(void)
{ {
ide_drive_t *drive; struct ata_device *drive;
int minor; int minor;
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) { for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
...@@ -6125,9 +6125,9 @@ static void __exit idetape_exit (void) ...@@ -6125,9 +6125,9 @@ static void __exit idetape_exit (void)
/* /*
* idetape_init will register the driver for each tape. * idetape_init will register the driver for each tape.
*/ */
int idetape_init (void) int idetape_init(void)
{ {
ide_drive_t *drive; struct ata_device *drive;
idetape_tape_t *tape; idetape_tape_t *tape;
int minor, failed = 0, supported = 0; int minor, failed = 0, supported = 0;
/* DRIVER(drive)->busy++; */ /* DRIVER(drive)->busy++; */
......
...@@ -284,7 +284,7 @@ int drive_is_flashcard(struct ata_device *drive) ...@@ -284,7 +284,7 @@ int drive_is_flashcard(struct ata_device *drive)
return 0; return 0;
} }
int __ide_end_request(struct ata_device *drive, struct request *rq, int uptodate, int nr_secs) int __ide_end_request(struct ata_device *drive, struct request *rq, int uptodate, unsigned int nr_secs)
{ {
unsigned long flags; unsigned long flags;
int ret = 1; int ret = 1;
...@@ -1199,14 +1199,14 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel) ...@@ -1199,14 +1199,14 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel)
if (timer_pending(&channel->timer)) if (timer_pending(&channel->timer))
printk(KERN_ERR "ide_set_handler: timer already active\n"); printk(KERN_ERR "ide_set_handler: timer already active\n");
#endif #endif
set_bit(IDE_SLEEP, &channel->active); set_bit(IDE_SLEEP, channel->active);
mod_timer(&channel->timer, sleep); mod_timer(&channel->timer, sleep);
/* we purposely leave hwgroup busy while sleeping */ /* we purposely leave hwgroup busy while sleeping */
} else { } else {
/* Ugly, but how can we sleep for the lock otherwise? perhaps /* Ugly, but how can we sleep for the lock otherwise? perhaps
* from tq_disk? */ * from tq_disk? */
ide_release_lock(&irq_lock);/* for atari only */ ide_release_lock(&irq_lock);/* for atari only */
clear_bit(IDE_BUSY, &channel->active); clear_bit(IDE_BUSY, channel->active);
} }
return NULL; return NULL;
...@@ -1225,7 +1225,7 @@ static void queue_commands(struct ata_device *drive) ...@@ -1225,7 +1225,7 @@ static void queue_commands(struct ata_device *drive)
for (;;) { for (;;) {
struct request *rq = NULL; struct request *rq = NULL;
if (!test_bit(IDE_BUSY, &ch->active)) if (!test_bit(IDE_BUSY, ch->active))
printk(KERN_ERR "%s: error: not busy while queueing!\n", drive->name); printk(KERN_ERR "%s: error: not busy while queueing!\n", drive->name);
/* Abort early if we can't queue another command. for non /* Abort early if we can't queue another command. for non
...@@ -1234,13 +1234,13 @@ static void queue_commands(struct ata_device *drive) ...@@ -1234,13 +1234,13 @@ static void queue_commands(struct ata_device *drive)
*/ */
if (!ata_can_queue(drive)) { if (!ata_can_queue(drive)) {
if (!ata_pending_commands(drive)) if (!ata_pending_commands(drive))
clear_bit(IDE_BUSY, &ch->active); clear_bit(IDE_BUSY, ch->active);
break; break;
} }
drive->sleep = 0; drive->sleep = 0;
if (test_bit(IDE_DMA, &ch->active)) { if (test_bit(IDE_DMA, ch->active)) {
printk(KERN_ERR "%s: error: DMA in progress...\n", drive->name); printk(KERN_ERR "%s: error: DMA in progress...\n", drive->name);
break; break;
} }
...@@ -1258,7 +1258,7 @@ static void queue_commands(struct ata_device *drive) ...@@ -1258,7 +1258,7 @@ static void queue_commands(struct ata_device *drive)
if (!(rq = elv_next_request(&drive->queue))) { if (!(rq = elv_next_request(&drive->queue))) {
if (!ata_pending_commands(drive)) if (!ata_pending_commands(drive))
clear_bit(IDE_BUSY, &ch->active); clear_bit(IDE_BUSY, ch->active);
drive->rq = NULL; drive->rq = NULL;
break; break;
} }
...@@ -1305,7 +1305,7 @@ static void do_request(struct ata_channel *channel) ...@@ -1305,7 +1305,7 @@ static void do_request(struct ata_channel *channel)
ide_get_lock(&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */ ide_get_lock(&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */
// __cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */ // __cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */
while (!test_and_set_bit(IDE_BUSY, &channel->active)) { while (!test_and_set_bit(IDE_BUSY, channel->active)) {
struct ata_channel *ch; struct ata_channel *ch;
struct ata_device *drive; struct ata_device *drive;
...@@ -1408,8 +1408,8 @@ void ide_timer_expiry(unsigned long data) ...@@ -1408,8 +1408,8 @@ void ide_timer_expiry(unsigned long data)
* complain about anything. * complain about anything.
*/ */
if (test_and_clear_bit(IDE_SLEEP, &ch->active)) if (test_and_clear_bit(IDE_SLEEP, ch->active))
clear_bit(IDE_BUSY, &ch->active); clear_bit(IDE_BUSY, ch->active);
} else { } else {
struct ata_device *drive = ch->drive; struct ata_device *drive = ch->drive;
if (!drive) { if (!drive) {
...@@ -1419,7 +1419,7 @@ void ide_timer_expiry(unsigned long data) ...@@ -1419,7 +1419,7 @@ void ide_timer_expiry(unsigned long data)
ide_startstop_t startstop; ide_startstop_t startstop;
/* paranoia */ /* paranoia */
if (!test_and_set_bit(IDE_BUSY, &ch->active)) if (!test_and_set_bit(IDE_BUSY, ch->active))
printk(KERN_ERR "%s: ide_timer_expiry: IRQ handler was not busy??\n", drive->name); printk(KERN_ERR "%s: ide_timer_expiry: IRQ handler was not busy??\n", drive->name);
if ((expiry = ch->expiry) != NULL) { if ((expiry = ch->expiry) != NULL) {
/* continue */ /* continue */
...@@ -1470,7 +1470,7 @@ void ide_timer_expiry(unsigned long data) ...@@ -1470,7 +1470,7 @@ void ide_timer_expiry(unsigned long data)
spin_lock_irq(ch->lock); spin_lock_irq(ch->lock);
if (startstop == ide_stopped) if (startstop == ide_stopped)
clear_bit(IDE_BUSY, &ch->active); clear_bit(IDE_BUSY, ch->active);
} }
} }
...@@ -1593,7 +1593,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1593,7 +1593,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
goto out_lock; goto out_lock;
} }
/* paranoia */ /* paranoia */
if (!test_and_set_bit(IDE_BUSY, &ch->active)) if (!test_and_set_bit(IDE_BUSY, ch->active))
printk(KERN_ERR "%s: %s: hwgroup was not busy!?\n", drive->name, __FUNCTION__); printk(KERN_ERR "%s: %s: hwgroup was not busy!?\n", drive->name, __FUNCTION__);
ch->handler = NULL; ch->handler = NULL;
del_timer(&ch->timer); del_timer(&ch->timer);
...@@ -1617,7 +1617,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1617,7 +1617,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
set_recovery_timer(drive->channel); set_recovery_timer(drive->channel);
if (startstop == ide_stopped) { if (startstop == ide_stopped) {
if (!ch->handler) { /* paranoia */ if (!ch->handler) { /* paranoia */
clear_bit(IDE_BUSY, &ch->active); clear_bit(IDE_BUSY, ch->active);
do_request(ch); do_request(ch);
} else { } else {
printk("%s: %s: huh? expected NULL handler on exit\n", drive->name, __FUNCTION__); printk("%s: %s: huh? expected NULL handler on exit\n", drive->name, __FUNCTION__);
...@@ -1951,7 +1951,9 @@ void ide_unregister(struct ata_channel *ch) ...@@ -1951,7 +1951,9 @@ void ide_unregister(struct ata_channel *ch)
free_irq(ch->irq, ch); free_irq(ch->irq, ch);
if (n_ch == 1) { if (n_ch == 1) {
kfree(ch->lock); kfree(ch->lock);
kfree(ch->active);
ch->lock = NULL; ch->lock = NULL;
ch->active = NULL;
} }
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI) #if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
...@@ -2133,7 +2135,7 @@ int ide_spin_wait_hwgroup(struct ata_device *drive) ...@@ -2133,7 +2135,7 @@ int ide_spin_wait_hwgroup(struct ata_device *drive)
spin_lock_irq(drive->channel->lock); spin_lock_irq(drive->channel->lock);
while (test_bit(IDE_BUSY, &drive->channel->active)) { while (test_bit(IDE_BUSY, drive->channel->active)) {
spin_unlock_irq(drive->channel->lock); spin_unlock_irq(drive->channel->lock);
......
...@@ -324,9 +324,9 @@ static void piix_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_tim ...@@ -324,9 +324,9 @@ static void piix_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_tim
* by upper layers. * by upper layers.
*/ */
static int piix_set_drive(ide_drive_t *drive, unsigned char speed) static int piix_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; struct ata_timing t, p;
int err, T, UT, umul = 1; int err, T, UT, umul = 1;
...@@ -364,7 +364,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed) ...@@ -364,7 +364,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
* PIO-only tuning. * PIO-only tuning.
*/ */
static void piix_tune_drive(ide_drive_t *drive, unsigned char pio) static void piix_tune_drive(struct ata_device *drive, unsigned char pio)
{ {
if (!((piix_enabled >> drive->channel->unit) & 1)) if (!((piix_enabled >> drive->channel->unit) & 1))
return; return;
......
...@@ -409,18 +409,43 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -409,18 +409,43 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
byte sis_proc = 0; byte sis_proc = 0;
extern char *ide_xfer_verbose (byte xfer_rate); extern char *ide_xfer_verbose (byte xfer_rate);
static int sis5513_ratemask(struct ata_device *drive)
{
int map = 0;
switch(chipset_family) {
case ATA_133: /* map |= XFER_UDMA_133; */
case ATA_100:
case ATA_100a:
map |= XFER_UDMA_100;
case ATA_66:
map |= XFER_UDMA_66;
case ATA_33:
map |= XFER_UDMA;
break;
case ATA_16:
case ATA_00:
default:
return 0;
}
if (!eighty_ninty_three(drive))
return XFER_UDMA;
return map;
}
/* /*
* Configuration functions * Configuration functions
*/ */
/* Enables per-drive prefetch and postwrite */ /* Enables per-drive prefetch and postwrite */
static void config_drive_art_rwp (ide_drive_t *drive) static void config_drive_art_rwp(struct ata_device *drive)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
byte reg4bh = 0; u8 reg4bh = 0;
byte rw_prefetch = (0x11 << drive->dn); u8 rw_prefetch = (0x11 << drive->dn);
#ifdef DEBUG #ifdef DEBUG
printk("SIS5513: config_drive_art_rwp, drive %d\n", drive->dn); printk("SIS5513: config_drive_art_rwp, drive %d\n", drive->dn);
...@@ -440,7 +465,7 @@ static void config_drive_art_rwp (ide_drive_t *drive) ...@@ -440,7 +465,7 @@ static void config_drive_art_rwp (ide_drive_t *drive)
/* Set per-drive active and recovery time */ /* Set per-drive active and recovery time */
static void config_art_rwp_pio (ide_drive_t *drive, byte pio) static void config_art_rwp_pio(struct ata_device *drive, u8 pio)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
...@@ -523,9 +548,9 @@ static void config_art_rwp_pio (ide_drive_t *drive, byte pio) ...@@ -523,9 +548,9 @@ static void config_art_rwp_pio (ide_drive_t *drive, byte pio)
#endif #endif
} }
static int config_chipset_for_pio (ide_drive_t *drive, byte pio) static int config_chipset_for_pio(struct ata_device *drive, u8 pio)
{ {
byte speed; u8 speed;
switch(pio) { switch(pio) {
case 4: speed = XFER_PIO_4; break; case 4: speed = XFER_PIO_4; break;
...@@ -540,7 +565,7 @@ static int config_chipset_for_pio (ide_drive_t *drive, byte pio) ...@@ -540,7 +565,7 @@ static int config_chipset_for_pio (ide_drive_t *drive, byte pio)
return ide_config_drive_speed(drive, speed); return ide_config_drive_speed(drive, speed);
} }
static int sis5513_tune_chipset (ide_drive_t *drive, byte speed) static int sis5513_tune_chipset(struct ata_device *drive, u8 speed)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
...@@ -615,69 +640,35 @@ static int sis5513_tune_chipset (ide_drive_t *drive, byte speed) ...@@ -615,69 +640,35 @@ static int sis5513_tune_chipset (ide_drive_t *drive, byte speed)
return ((int) ide_config_drive_speed(drive, speed)); return ((int) ide_config_drive_speed(drive, speed));
} }
static void sis5513_tune_drive (ide_drive_t *drive, byte pio) static void sis5513_tune_drive(struct ata_device *drive, u8 pio)
{ {
(void) config_chipset_for_pio(drive, pio); (void) config_chipset_for_pio(drive, pio);
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
/* static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
* ((id->hw_config & 0x4000|0x2000) && (drive->channel->udma_four))
*/
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
{ {
struct hd_driveid *id = drive->id; int map;
struct ata_channel *hwif = drive->channel; u8 mode;
byte speed = 0;
byte unit = (drive->select.b.unit & 0x01);
byte udma_66 = eighty_ninty_three(drive);
#ifdef DEBUG #ifdef DEBUG
printk("SIS5513: config_chipset_for_dma, drive %d, ultra %d\n", printk("SIS5513: config_chipset_for_dma, drive %d, udma %d\n",
drive->dn, ultra); drive->dn, udma);
#endif #endif
if ((id->dma_ultra & 0x0020) && ultra && udma_66 && (chipset_family >= ATA_100a)) if (udma)
speed = XFER_UDMA_5; map = sis5513_ratemask(drive);
else if ((id->dma_ultra & 0x0010) && ultra && udma_66 && (chipset_family >= ATA_66))
speed = XFER_UDMA_4;
else if ((id->dma_ultra & 0x0008) && ultra && udma_66 && (chipset_family >= ATA_66))
speed = XFER_UDMA_3;
else if ((id->dma_ultra & 0x0004) && ultra && (chipset_family >= ATA_33))
speed = XFER_UDMA_2;
else if ((id->dma_ultra & 0x0002) && ultra && (chipset_family >= ATA_33))
speed = XFER_UDMA_1;
else if ((id->dma_ultra & 0x0001) && ultra && (chipset_family >= ATA_33))
speed = XFER_UDMA_0;
else if (id->dma_mword & 0x0004)
speed = XFER_MW_DMA_2;
else if (id->dma_mword & 0x0002)
speed = XFER_MW_DMA_1;
else if (id->dma_mword & 0x0001)
speed = XFER_MW_DMA_0;
else if (id->dma_1word & 0x0004)
speed = XFER_SW_DMA_2;
else if (id->dma_1word & 0x0002)
speed = XFER_SW_DMA_1;
else if (id->dma_1word & 0x0001)
speed = XFER_SW_DMA_0;
else else
return 0; map = XFER_SWDMA | XFER_MWDMA;
outb(inb(hwif->dma_base+2)|(1<<(5+unit)), hwif->dma_base+2);
sis5513_tune_chipset(drive, speed); mode = ata_timing_mode(drive, map);
if (mode < XFER_SW_DMA_0)
return 0;
return ((int) ((id->dma_ultra >> 11) & 7) ? 1 : return !sis5513_tune_chipset(drive, mode);
((id->dma_ultra >> 8) & 7) ? 1 :
((id->dma_mword >> 8) & 7) ? 1 :
((id->dma_1word >> 8) & 7) ? 1 :
0);
} }
static int config_drive_xfer_rate (ide_drive_t *drive) static int config_drive_xfer_rate(struct ata_device *drive)
{ {
struct hd_driveid *id = drive->id; struct hd_driveid *id = drive->id;
int on = 0; int on = 0;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* use tagged command queueing. * use tagged command queueing.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -94,15 +95,15 @@ static void tcq_invalidate_queue(struct ata_device *drive) ...@@ -94,15 +95,15 @@ static void tcq_invalidate_queue(struct ata_device *drive)
del_timer(&ch->timer); del_timer(&ch->timer);
if (test_bit(IDE_DMA, &ch->active)) if (test_bit(IDE_DMA, ch->active))
udma_stop(drive); udma_stop(drive);
blk_queue_invalidate_tags(q); blk_queue_invalidate_tags(q);
drive->using_tcq = 0; drive->using_tcq = 0;
drive->queue_depth = 1; drive->queue_depth = 1;
clear_bit(IDE_BUSY, &ch->active); clear_bit(IDE_BUSY, ch->active);
clear_bit(IDE_DMA, &ch->active); clear_bit(IDE_DMA, ch->active);
ch->handler = NULL; ch->handler = NULL;
/* /*
...@@ -158,7 +159,7 @@ static void ata_tcq_irq_timeout(unsigned long data) ...@@ -158,7 +159,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
spin_lock_irqsave(ch->lock, flags); spin_lock_irqsave(ch->lock, flags);
if (test_and_set_bit(IDE_BUSY, &ch->active)) if (test_and_set_bit(IDE_BUSY, ch->active))
printk(KERN_ERR "ATA: %s: IRQ handler not busy\n", __FUNCTION__); printk(KERN_ERR "ATA: %s: IRQ handler not busy\n", __FUNCTION__);
if (!ch->handler) if (!ch->handler)
printk(KERN_ERR "ATA: %s: missing ISR!\n", __FUNCTION__); printk(KERN_ERR "ATA: %s: missing ISR!\n", __FUNCTION__);
...@@ -239,7 +240,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq) ...@@ -239,7 +240,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
* Could be called with IDE_DMA in-progress from invalidate * Could be called with IDE_DMA in-progress from invalidate
* handler, refuse to do anything. * handler, refuse to do anything.
*/ */
if (test_bit(IDE_DMA, &drive->channel->active)) if (test_bit(IDE_DMA, drive->channel->active))
return ide_stopped; return ide_stopped;
/* /*
...@@ -527,7 +528,7 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request * ...@@ -527,7 +528,7 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request *
struct ata_channel *ch = drive->channel; struct ata_channel *ch = drive->channel;
TCQ_PRINTK("%s: setting up queued %d\n", __FUNCTION__, rq->tag); TCQ_PRINTK("%s: setting up queued %d\n", __FUNCTION__, rq->tag);
if (!test_bit(IDE_BUSY, &ch->active)) if (!test_bit(IDE_BUSY, ch->active))
printk("queued_rw: IDE_BUSY not set\n"); printk("queued_rw: IDE_BUSY not set\n");
if (tcq_wait_dataphase(drive)) if (tcq_wait_dataphase(drive))
...@@ -639,3 +640,6 @@ int udma_tcq_enable(struct ata_device *drive, int on) ...@@ -639,3 +640,6 @@ int udma_tcq_enable(struct ata_device *drive, int on)
drive->using_tcq = 1; drive->using_tcq = 1;
return 0; return 0;
} }
/* FIXME: This should go away! */
EXPORT_SYMBOL(udma_tcq_enable);
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
#include "pcihost.h" #include "pcihost.h"
static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) static void trm290_prepare_drive(struct ata_device *drive, unsigned int use_dma)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
unsigned int reg; unsigned int reg;
...@@ -170,7 +170,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) ...@@ -170,7 +170,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
__restore_flags(flags); /* local CPU only */ __restore_flags(flags); /* local CPU only */
} }
static void trm290_selectproc (ide_drive_t *drive) static void trm290_selectproc(struct ata_device *drive)
{ {
trm290_prepare_drive(drive, drive->using_dma); trm290_prepare_drive(drive, drive->using_dma);
} }
......
...@@ -303,9 +303,9 @@ static void via_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timi ...@@ -303,9 +303,9 @@ static void via_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timi
* by upper layers. * by upper layers.
*/ */
static int via_set_drive(ide_drive_t *drive, unsigned char speed) static int via_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; struct ata_timing t, p;
unsigned int T, UT; unsigned int T, UT;
...@@ -345,7 +345,7 @@ static int via_set_drive(ide_drive_t *drive, unsigned char speed) ...@@ -345,7 +345,7 @@ static int via_set_drive(ide_drive_t *drive, unsigned char speed)
* PIO-only tuning. * PIO-only tuning.
*/ */
static void via82cxxx_tune_drive(ide_drive_t *drive, unsigned char pio) static void via82cxxx_tune_drive(struct ata_device *drive, unsigned char pio)
{ {
if (!((via_enabled >> drive->channel->unit) & 1)) if (!((via_enabled >> drive->channel->unit) & 1))
return; return;
...@@ -493,23 +493,9 @@ static unsigned int __init via82cxxx_init_chipset(struct pci_dev *dev) ...@@ -493,23 +493,9 @@ static unsigned int __init via82cxxx_init_chipset(struct pci_dev *dev)
*/ */
pci_read_config_byte(isa, PCI_REVISION_ID, &t); pci_read_config_byte(isa, PCI_REVISION_ID, &t);
printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %s controller on pci%s\n", printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) ATA %s controller on PCI %s\n",
via_config->name, t, via_dma[via_config->flags & VIA_UDMA], dev->slot_name); via_config->name, t, via_dma[via_config->flags & VIA_UDMA], dev->slot_name);
/*
* Setup /proc/ide/via entry.
*/
#if 0 && defined(CONFIG_PROC_FS)
if (!via_proc) {
via_base = pci_resource_start(dev, 4);
bmide_dev = dev;
isa_dev = isa;
via_display_info = &via_get_info;
via_proc = 1;
}
#endif
return 0; return 0;
} }
......
...@@ -447,6 +447,7 @@ struct ata_channel { ...@@ -447,6 +447,7 @@ struct ata_channel {
* between differen queues sharing the same irq line. * between differen queues sharing the same irq line.
*/ */
spinlock_t *lock; spinlock_t *lock;
unsigned long *active; /* active processing request */
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */ ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
struct timer_list timer; /* failsafe timer */ struct timer_list timer; /* failsafe timer */
...@@ -454,7 +455,6 @@ struct ata_channel { ...@@ -454,7 +455,6 @@ struct ata_channel {
unsigned long poll_timeout; /* timeout value during polled operations */ unsigned long poll_timeout; /* timeout value during polled operations */
struct ata_device *drive; /* last serviced drive */ struct ata_device *drive; /* last serviced drive */
unsigned long active; /* active processing request */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* hardware info */ hw_regs_t hw; /* hardware info */
...@@ -642,7 +642,7 @@ extern int noautodma; ...@@ -642,7 +642,7 @@ extern int noautodma;
#define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */ #define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */
#include <linux/blk.h> #include <linux/blk.h>
extern int __ide_end_request(struct ata_device *, struct request *, int, int); extern int __ide_end_request(struct ata_device *, struct request *, int, unsigned int);
extern int ide_end_request(struct ata_device *drive, struct request *, int); extern int ide_end_request(struct ata_device *drive, struct request *, int);
/* /*
...@@ -784,11 +784,9 @@ void ide_init_subdrivers (void); ...@@ -784,11 +784,9 @@ void ide_init_subdrivers (void);
extern struct block_device_operations ide_fops[]; extern struct block_device_operations ide_fops[];
#ifdef CONFIG_BLK_DEV_IDE
/* Probe for devices attached to the systems host controllers. /* Probe for devices attached to the systems host controllers.
*/ */
extern int ideprobe_init (void); extern int ideprobe_init(void);
#endif
#ifdef CONFIG_BLK_DEV_IDEDISK #ifdef CONFIG_BLK_DEV_IDEDISK
extern int idedisk_init (void); extern int idedisk_init (void);
#endif #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