patch-2.4.19 linux-2.4.19/drivers/ide/ide-features.c
Next file: linux-2.4.19/drivers/ide/ide-floppy.c
Previous file: linux-2.4.19/drivers/ide/ide-dma.c
Back to the patch index
Back to the overall index
- Lines: 104
- Date:
Fri Aug 2 17:39:44 2002
- Orig file:
linux-2.4.18/drivers/ide/ide-features.c
- Orig date:
Fri Feb 9 11:40:02 2001
diff -urN linux-2.4.18/drivers/ide/ide-features.c linux-2.4.19/drivers/ide/ide-features.c
@@ -127,30 +127,14 @@
case XFER_UDMA_3: return XFER_UDMA_2;
case XFER_UDMA_2: return XFER_UDMA_1;
case XFER_UDMA_1: return XFER_UDMA_0;
+ /*
+ * OOPS we do not goto non Ultra DMA modes
+ * without iCRC's available we force
+ * the system to PIO and make the user
+ * invoke the ATA-1 ATA-2 DMA modes.
+ */
case XFER_UDMA_0:
- if (drive->id->dma_mword & 0x0004) return XFER_MW_DMA_2;
- else if (drive->id->dma_mword & 0x0002) return XFER_MW_DMA_1;
- else if (drive->id->dma_mword & 0x0001) return XFER_MW_DMA_0;
- else return XFER_PIO_4;
- case XFER_MW_DMA_2: return XFER_MW_DMA_1;
- case XFER_MW_DMA_1: return XFER_MW_DMA_0;
- case XFER_MW_DMA_0:
- if (drive->id->dma_1word & 0x0004) return XFER_SW_DMA_2;
- else if (drive->id->dma_1word & 0x0002) return XFER_SW_DMA_1;
- else if (drive->id->dma_1word & 0x0001) return XFER_SW_DMA_0;
- else return XFER_PIO_4;
- case XFER_SW_DMA_2: return XFER_SW_DMA_1;
- case XFER_SW_DMA_1: return XFER_SW_DMA_0;
- case XFER_SW_DMA_0:
- {
- return XFER_PIO_4;
- }
- case XFER_PIO_4: return XFER_PIO_3;
- case XFER_PIO_3: return XFER_PIO_2;
- case XFER_PIO_2: return XFER_PIO_1;
- case XFER_PIO_1: return XFER_PIO_0;
- case XFER_PIO_0:
- default: return XFER_PIO_SLOW;
+ default: return XFER_PIO_4;
}
}
@@ -216,11 +200,11 @@
* in combination with the device (usually a disk) properly detect
* and acknowledge each end of the ribbon.
*/
-int ide_ata66_check (ide_drive_t *drive, byte cmd, byte nsect, byte feature)
+int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
{
- if ((cmd == WIN_SETFEATURES) &&
- (nsect > XFER_UDMA_2) &&
- (feature == SETFEATURES_XFER)) {
+ if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
+ (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) &&
+ (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
if (!HWIF(drive)->udma_four) {
printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", HWIF(drive)->name);
return 1;
@@ -243,11 +227,11 @@
* 1 : Safe to update drive->id DMA registers.
* 0 : OOPs not allowed.
*/
-int set_transfer (ide_drive_t *drive, byte cmd, byte nsect, byte feature)
+int set_transfer (ide_drive_t *drive, ide_task_t *args)
{
- if ((cmd == WIN_SETFEATURES) &&
- (nsect >= XFER_SW_DMA_0) &&
- (feature == SETFEATURES_XFER) &&
+ if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
+ (args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) &&
+ (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
(drive->id->dma_ultra ||
drive->id->dma_mword ||
drive->id->dma_1word))
@@ -256,17 +240,24 @@
return 0;
}
+#ifdef CONFIG_BLK_DEV_IDEDMA
/*
* All hosts that use the 80c ribbon mus use!
*/
byte eighty_ninty_three (ide_drive_t *drive)
{
+#ifdef CONFIG_BLK_DEV_IDEPCI
+ if (HWIF(drive)->pci_devid.vid==0x105a)
+ return(HWIF(drive)->udma_four);
+#endif
+ /* PDC202XX: that's because some HDD will return wrong info */
return ((byte) ((HWIF(drive)->udma_four) &&
#ifndef CONFIG_IDEDMA_IVB
(drive->id->hw_config & 0x4000) &&
#endif /* CONFIG_IDEDMA_IVB */
(drive->id->hw_config & 0x6000)) ? 1 : 0);
}
+#endif // CONFIG_BLK_DEV_IDEDMA
/*
* Similar to ide_wait_stat(), except it never calls ide_error internally.
@@ -387,5 +378,8 @@
EXPORT_SYMBOL(ide_driveid_update);
EXPORT_SYMBOL(ide_ata66_check);
EXPORT_SYMBOL(set_transfer);
+#ifdef CONFIG_BLK_DEV_IDEDMA
EXPORT_SYMBOL(eighty_ninty_three);
+#endif // CONFIG_BLK_DEV_IDEDMA
EXPORT_SYMBOL(ide_config_drive_speed);
+
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)