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
The ATP850U/UF is an UltraDMA 33 chipset base.
The ATP860 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>.
If you say Y here, then say Y to "Use DMA by default when available"
......@@ -313,6 +314,12 @@ CONFIG_AEC62XX_TUNING
Please read the comments at the top of <file:drivers/ide/aec62xx.c>.
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
This driver ensures (U)DMA support for ALI 1533, 1543 and 1543C
onboard chipsets. It also tests for Simplex mode and enables
......
......@@ -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 ' 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 ' 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_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
......
......@@ -10,7 +10,7 @@
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-m :=
......
This diff is collapsed.
......@@ -106,11 +106,11 @@ static void outReg (byte data, byte reg)
* This function computes timing parameters
* 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 time1, time2;
byte param1, param2, param3, param4;
u8 param1, param2, param3, param4;
unsigned long flags;
struct ata_timing *t;
......
......@@ -304,14 +304,49 @@ static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
__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)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
struct pci_dev *dev = drive->channel->pci_dev;
byte unit = (drive->select.b.unit & 0x01);
byte tmpbyte = 0x00;
int m5229_udma = hwif->unit ? 0x57 : 0x56;
int err = 0;
int m5229_udma = drive->channel->unit ? 0x57 : 0x56;
if (speed < XFER_UDMA_0) {
byte ultra_enable = (unit) ? 0x7f : 0xf7;
......@@ -323,16 +358,10 @@ static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
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
if (speed >= XFER_SW_DMA_0) {
unsigned long dma_base = hwif->dma_base;
outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2);
}
if (speed >= XFER_UDMA_0) {
else if (speed >= XFER_UDMA_0) {
pci_read_config_byte(dev, m5229_udma, &tmpbyte);
tmpbyte &= (0x0f << ((1-unit) << 2));
/*
......@@ -348,9 +377,11 @@ static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (!drive->init_speed)
drive->init_speed = speed;
drive->current_speed = speed;
return (err);
return ide_config_drive_speed(drive, speed);
}
static void config_chipset_for_pio(struct ata_device *drive)
......@@ -359,75 +390,21 @@ static void config_chipset_for_pio(struct ata_device *drive)
}
#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;
byte speed = 0x00;
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)
drive->init_speed = speed;
rval = (int)( ((id->dma_ultra >> 11) & 3) ? 1:
((id->dma_ultra >> 8) & 7) ? 1:
((id->dma_mword >> 8) & 7) ? 1:
((id->dma_1word >> 8) & 7) ? 1:
0);
return rval;
}
int map;
u8 mode;
static byte ali15x3_can_ultra(struct ata_device *drive)
{
#ifndef CONFIG_WDC_ALI15X3
struct hd_driveid *id = drive->id;
#endif /* CONFIG_WDC_ALI15X3 */
if (udma)
map = ali15x3_ratemask(drive);
else
map = XFER_SWDMA | XFER_MWDMA;
if (m5229_revision <= 0x20) {
mode = ata_timing_mode(drive, map);
if (mode < XFER_SW_DMA_0)
return 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;
} else {
return 1;
}
return !ali15x3_tune_chipset(drive, mode);
}
static int ali15x3_config_drive_for_dma(struct ata_device *drive)
......
This diff is collapsed.
......@@ -111,7 +111,6 @@ static void hpt34x_clear_chipset (ide_drive_t *drive)
static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
{
int err;
byte hi_speed, lo_speed;
unsigned int reg1 = 0, tmp1 = 0;
unsigned int reg2 = 0, tmp2 = 0;
......@@ -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);
tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn))));
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, 0x48, tmp2);
if (!drive->init_speed)
drive->init_speed = speed;
#if HPT343_DEBUG_DRIVE_INFO
printk("%s: %s drive%d (0x%04x 0x%04x) (0x%04x 0x%04x)" \
" (0x%02x 0x%02x) 0x%04x\n",
......@@ -144,8 +139,10 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
hi_speed, lo_speed, err);
#endif /* HPT343_DEBUG_DRIVE_INFO */
if (!drive->init_speed)
drive->init_speed = speed;
drive->current_speed = speed;
return(err);
return ide_config_drive_speed(drive, speed);
}
static void config_chipset_for_pio(ide_drive_t *drive)
......@@ -201,55 +198,25 @@ static void hpt34x_tune_drive (ide_drive_t *drive, byte pio)
}
#ifdef CONFIG_BLK_DEV_IDEDMA
/*
* 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)
static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
{
struct hd_driveid *id = drive->id;
byte speed = 0x00;
int map;
u8 mode;
if (drive->type != ATA_DISK)
return 0;
hpt34x_clear_chipset(drive);
if (udma)
map = XFER_UDMA;
else
map = XFER_SWDMA | XFER_MWDMA;
if ((id->dma_ultra & 0x0010) && ultra) {
speed = XFER_UDMA_2;
} 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 {
mode = ata_timing_mode(drive, map);
if (mode < XFER_SW_DMA_0)
return 0;
}
(void) hpt34x_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);
hpt34x_clear_chipset(drive);
return !hpt34x_tune_chipset(drive, mode);
}
static int config_drive_xfer_rate(struct ata_device *drive)
......
This diff is collapsed.
......@@ -764,7 +764,7 @@ static struct ata_pci_device chipsets[] __initdata = {
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371MX,
enablebits: {{0x6D,0x80,0x80}, {0x00,0x00,0x00}},
bootable: ON_BOARD, 0,
bootable: ON_BOARD,
flags: ATA_F_NODMA
},
{
......@@ -790,6 +790,19 @@ static struct ata_pci_device chipsets[] __initdata = {
device: PCI_DEVICE_ID_VIA_82C561,
bootable: ON_BOARD,
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)
int i;
spinlock_t *lock;
spinlock_t *new_lock;
unsigned long *active;
unsigned long *new_active;
struct ata_channel *match = NULL;
/* Spare allocation before sleep. */
new_lock = kmalloc(sizeof(*lock), GFP_KERNEL);
new_active = kmalloc(sizeof(*active), GFP_KERNEL);
*new_active = 0L;
spin_lock_irqsave(&ide_lock, flags);
ch->lock = NULL;
......@@ -619,6 +623,7 @@ static int init_irq(struct ata_channel *ch)
*/
if (!match) {
lock = new_lock;
active = new_active;
if (!lock) {
spin_unlock_irqrestore(&ide_lock, flags);
......@@ -627,6 +632,7 @@ static int init_irq(struct ata_channel *ch)
spin_lock_init(lock);
} else {
lock = match->lock;
active = match->active;
if(new_lock)
kfree(new_lock);
}
......@@ -645,8 +651,10 @@ static int init_irq(struct ata_channel *ch)
OUT_BYTE(0x08, ch->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */
if (request_irq(ch->irq, &ata_irq_request, sa, ch->name, ch)) {
if (!match)
if (!match) {
kfree(lock);
kfree(active);
}
spin_unlock_irqrestore(&ide_lock, flags);
......@@ -658,6 +666,7 @@ static int init_irq(struct ata_channel *ch)
* Everything is okay. Tag us as member of this lock group.
*/
ch->lock = lock;
ch->active = active;
init_timer(&ch->timer);
ch->timer.function = &ide_timer_expiry;
......
This diff is collapsed.
......@@ -284,7 +284,7 @@ int drive_is_flashcard(struct ata_device *drive)
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;
int ret = 1;
......@@ -1199,14 +1199,14 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel)
if (timer_pending(&channel->timer))
printk(KERN_ERR "ide_set_handler: timer already active\n");
#endif
set_bit(IDE_SLEEP, &channel->active);
set_bit(IDE_SLEEP, channel->active);
mod_timer(&channel->timer, sleep);
/* we purposely leave hwgroup busy while sleeping */
} else {
/* Ugly, but how can we sleep for the lock otherwise? perhaps
* from tq_disk? */
ide_release_lock(&irq_lock);/* for atari only */
clear_bit(IDE_BUSY, &channel->active);
clear_bit(IDE_BUSY, channel->active);
}
return NULL;
......@@ -1225,7 +1225,7 @@ static void queue_commands(struct ata_device *drive)
for (;;) {
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);
/* Abort early if we can't queue another command. for non
......@@ -1234,13 +1234,13 @@ static void queue_commands(struct ata_device *drive)
*/
if (!ata_can_queue(drive)) {
if (!ata_pending_commands(drive))
clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_BUSY, ch->active);
break;
}
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);
break;
}
......@@ -1258,7 +1258,7 @@ static void queue_commands(struct ata_device *drive)
if (!(rq = elv_next_request(&drive->queue))) {
if (!ata_pending_commands(drive))
clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_BUSY, ch->active);
drive->rq = NULL;
break;
}
......@@ -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(?) */
// __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_device *drive;
......@@ -1408,8 +1408,8 @@ void ide_timer_expiry(unsigned long data)
* complain about anything.
*/
if (test_and_clear_bit(IDE_SLEEP, &ch->active))
clear_bit(IDE_BUSY, &ch->active);
if (test_and_clear_bit(IDE_SLEEP, ch->active))
clear_bit(IDE_BUSY, ch->active);
} else {
struct ata_device *drive = ch->drive;
if (!drive) {
......@@ -1419,7 +1419,7 @@ void ide_timer_expiry(unsigned long data)
ide_startstop_t startstop;
/* 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);
if ((expiry = ch->expiry) != NULL) {
/* continue */
......@@ -1470,7 +1470,7 @@ void ide_timer_expiry(unsigned long data)
spin_lock_irq(ch->lock);
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)
goto out_lock;
}
/* 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__);
ch->handler = NULL;
del_timer(&ch->timer);
......@@ -1617,7 +1617,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
set_recovery_timer(drive->channel);
if (startstop == ide_stopped) {
if (!ch->handler) { /* paranoia */
clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_BUSY, ch->active);
do_request(ch);
} else {
printk("%s: %s: huh? expected NULL handler on exit\n", drive->name, __FUNCTION__);
......@@ -1951,7 +1951,9 @@ void ide_unregister(struct ata_channel *ch)
free_irq(ch->irq, ch);
if (n_ch == 1) {
kfree(ch->lock);
kfree(ch->active);
ch->lock = NULL;
ch->active = NULL;
}
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
......@@ -2133,7 +2135,7 @@ int ide_spin_wait_hwgroup(struct ata_device *drive)
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);
......
......@@ -324,9 +324,9 @@ static void piix_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_tim
* 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;
int err, T, UT, umul = 1;
......@@ -364,7 +364,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
* 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))
return;
......
......@@ -409,18 +409,43 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
byte sis_proc = 0;
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
*/
/* 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 pci_dev *dev = hwif->pci_dev;
struct pci_dev *dev = hwif->pci_dev;
byte reg4bh = 0;
byte rw_prefetch = (0x11 << drive->dn);
u8 reg4bh = 0;
u8 rw_prefetch = (0x11 << drive->dn);
#ifdef DEBUG
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)
/* 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 pci_dev *dev = hwif->pci_dev;
......@@ -523,9 +548,9 @@ static void config_art_rwp_pio (ide_drive_t *drive, byte pio)
#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) {
case 4: speed = XFER_PIO_4; break;
......@@ -540,7 +565,7 @@ static int config_chipset_for_pio (ide_drive_t *drive, byte pio)
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 pci_dev *dev = hwif->pci_dev;
......@@ -615,69 +640,35 @@ static int sis5513_tune_chipset (ide_drive_t *drive, byte 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);
}
#ifdef CONFIG_BLK_DEV_IDEDMA
/*
* ((id->hw_config & 0x4000|0x2000) && (drive->channel->udma_four))
*/
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
byte speed = 0;
byte unit = (drive->select.b.unit & 0x01);
byte udma_66 = eighty_ninty_three(drive);
int map;
u8 mode;
#ifdef DEBUG
printk("SIS5513: config_chipset_for_dma, drive %d, ultra %d\n",
drive->dn, ultra);
printk("SIS5513: config_chipset_for_dma, drive %d, udma %d\n",
drive->dn, udma);
#endif
if ((id->dma_ultra & 0x0020) && ultra && udma_66 && (chipset_family >= ATA_100a))
speed = XFER_UDMA_5;
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;
if (udma)
map = sis5513_ratemask(drive);
else
return 0;
outb(inb(hwif->dma_base+2)|(1<<(5+unit)), hwif->dma_base+2);
map = XFER_SWDMA | XFER_MWDMA;
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 :
((id->dma_ultra >> 8) & 7) ? 1 :
((id->dma_mword >> 8) & 7) ? 1 :
((id->dma_1word >> 8) & 7) ? 1 :
0);
return !sis5513_tune_chipset(drive, mode);
}
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;
int on = 0;
......
......@@ -20,6 +20,7 @@
* use tagged command queueing.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
......@@ -94,15 +95,15 @@ static void tcq_invalidate_queue(struct ata_device *drive)
del_timer(&ch->timer);
if (test_bit(IDE_DMA, &ch->active))
if (test_bit(IDE_DMA, ch->active))
udma_stop(drive);
blk_queue_invalidate_tags(q);
drive->using_tcq = 0;
drive->queue_depth = 1;
clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_DMA, &ch->active);
clear_bit(IDE_BUSY, ch->active);
clear_bit(IDE_DMA, ch->active);
ch->handler = NULL;
/*
......@@ -158,7 +159,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
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__);
if (!ch->handler)
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)
* Could be called with IDE_DMA in-progress from invalidate
* handler, refuse to do anything.
*/
if (test_bit(IDE_DMA, &drive->channel->active))
if (test_bit(IDE_DMA, drive->channel->active))
return ide_stopped;
/*
......@@ -527,7 +528,7 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request *
struct ata_channel *ch = drive->channel;
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");
if (tcq_wait_dataphase(drive))
......@@ -639,3 +640,6 @@ int udma_tcq_enable(struct ata_device *drive, int on)
drive->using_tcq = 1;
return 0;
}
/* FIXME: This should go away! */
EXPORT_SYMBOL(udma_tcq_enable);
......@@ -142,7 +142,7 @@
#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;
unsigned int reg;
......@@ -170,7 +170,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
__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);
}
......
......@@ -303,9 +303,9 @@ static void via_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timi
* 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;
unsigned int T, UT;
......@@ -345,7 +345,7 @@ static int via_set_drive(ide_drive_t *drive, unsigned char speed)
* 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))
return;
......@@ -493,23 +493,9 @@ static unsigned int __init via82cxxx_init_chipset(struct pci_dev *dev)
*/
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);
/*
* 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;
}
......
......@@ -447,6 +447,7 @@ struct ata_channel {
* between differen queues sharing the same irq line.
*/
spinlock_t *lock;
unsigned long *active; /* active processing request */
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
struct timer_list timer; /* failsafe timer */
......@@ -454,7 +455,6 @@ struct ata_channel {
unsigned long poll_timeout; /* timeout value during polled operations */
struct ata_device *drive; /* last serviced drive */
unsigned long active; /* active processing request */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* hardware info */
......@@ -642,7 +642,7 @@ extern int noautodma;
#define LOCAL_END_REQUEST /* Don't generate end_request in 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);
/*
......@@ -784,11 +784,9 @@ void ide_init_subdrivers (void);
extern struct block_device_operations ide_fops[];
#ifdef CONFIG_BLK_DEV_IDE
/* Probe for devices attached to the systems host controllers.
*/
extern int ideprobe_init (void);
#endif
extern int ideprobe_init(void);
#ifdef CONFIG_BLK_DEV_IDEDISK
extern int idedisk_init (void);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment