enable-cdrom-dma-access-with-pdc20265_old.patch

From: Tobias Oed
Date: Sat Sep 23 2006 - 10:44:21 EST


If it makes things easier my patch labeled
enable-cdrom-dma-access-with-pdc20265_old.patch in -mm
could be dropped in favour of what follows (against 2.6.18),
making the feature an EXPERIMENTAL config option.
Tobias
ps: I also attach the patch since I fear mail mangling (anyone care to send
me a gmail invite?)

--- linux-2.6.18-orig/drivers/ide/Kconfig 2006-09-23 16:20:16.000000000 +0200
+++ linux-2.6.18/drivers/ide/Kconfig 2006-09-23 16:21:29.000000000 +0200
@@ -670,6 +670,15 @@

If unsure, say N.

+config PDC202XX_ATAPI
+ bool "UDMA for cdroms (EXPERIMENTAL)"
+ depends on BLK_DEV_PDC202XX_OLD && EXPERIMENTAL
+ help
+ This option allows UDMA with cdrom drives attached to
+ a pdc202xx controller
+
+ If unsure, say N.
+
config BLK_DEV_PDC202XX_NEW
tristate "PROMISE PDC202{68|69|70|71|75|76|77} support"

--- linux-2.6.18-orig/drivers/ide/pci/pdc202xx_old.c 2006-09-23 16:17:35.000000000 +0200
+++ linux-2.6.18/drivers/ide/pci/pdc202xx_old.c 2006-09-23 15:52:56.000000000 +0200
@@ -48,6 +48,12 @@
#define PDC202_DEBUG_CABLE 0
#define PDC202XX_DEBUG_DRIVE_INFO 0

+#ifndef CONFIG_PDC202XX_ATAPI
+#define PDC202XX_CDROM_UDMA(drive) 0
+#else
+#define PDC202XX_CDROM_UDMA(drive) ((drive)->media == ide_cdrom)
+#endif
+
static const char *pdc_quirk_drives[] = {
"QUANTUM FIREBALLlct08 08",
"QUANTUM FIREBALLP KA6.4",
@@ -154,7 +160,8 @@
u8 AP, BP, CP, DP;
u8 TA = 0, TB = 0, TC = 0;

- if ((drive->media != ide_disk) && (speed < XFER_SW_DMA_0))
+ if (drive->media != ide_disk && !PDC202XX_CDROM_UDMA(drive) &&
+ speed < XFER_SW_DMA_0)
return -1;

pci_read_config_dword(dev, drive_pci, &drive_conf);
@@ -329,8 +336,7 @@
}

chipset_is_set:
-
- if (drive->media == ide_disk) {
+ if (drive->media == ide_disk || PDC202XX_CDROM_UDMA(drive)) {
pci_read_config_byte(dev, (drive_pci), &AP);
if (id->capability & 4) /* IORDY_EN */
pci_write_config_byte(dev, (drive_pci), AP|IORDY_EN);
@@ -385,7 +391,7 @@
{
if (drive->current_speed > XFER_UDMA_2)
pdc_old_enable_66MHz_clock(drive->hwif);
- if (drive->addressing == 1) {
+ if (drive->addressing == 1 || PDC202XX_CDROM_UDMA(drive)) {
struct request *rq = HWGROUP(drive)->rq;
ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master;
@@ -405,7 +411,7 @@

static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
{
- if (drive->addressing == 1) {
+ if (drive->addressing == 1 || PDC202XX_CDROM_UDMA(drive)) {
ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master;
unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
@@ -519,6 +525,9 @@
hwif->ultra_mask = 0x3f;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
+#ifdef CONFIG_PDC202XX_ATAPI
+ hwif->atapi_dma = 1;
+#endif

hwif->err_stops_fifo = 1;

_________________________________________________________________
Search?Your way, your world, right now! http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FORM=WLMTAG --- linux-2.6.18-orig/drivers/ide/Kconfig 2006-09-23 16:20:16.000000000 +0200
+++ linux-2.6.18/drivers/ide/Kconfig 2006-09-23 16:21:29.000000000 +0200
@@ -670,6 +670,15 @@

If unsure, say N.

+config PDC202XX_ATAPI
+ bool "UDMA for cdroms (EXPERIMENTAL)"
+ depends on BLK_DEV_PDC202XX_OLD && EXPERIMENTAL
+ help
+ This option allows UDMA with cdrom drives attached to
+ a pdc202xx controller
+
+ If unsure, say N.
+
config BLK_DEV_PDC202XX_NEW
tristate "PROMISE PDC202{68|69|70|71|75|76|77} support"

--- linux-2.6.18-orig/drivers/ide/pci/pdc202xx_old.c 2006-09-23 16:17:35.000000000 +0200
+++ linux-2.6.18/drivers/ide/pci/pdc202xx_old.c 2006-09-23 15:52:56.000000000 +0200
@@ -48,6 +48,12 @@
#define PDC202_DEBUG_CABLE 0
#define PDC202XX_DEBUG_DRIVE_INFO 0

+#ifndef CONFIG_PDC202XX_ATAPI
+#define PDC202XX_CDROM_UDMA(drive) 0
+#else
+#define PDC202XX_CDROM_UDMA(drive) ((drive)->media == ide_cdrom)
+#endif
+
static const char *pdc_quirk_drives[] = {
"QUANTUM FIREBALLlct08 08",
"QUANTUM FIREBALLP KA6.4",
@@ -154,7 +160,8 @@
u8 AP, BP, CP, DP;
u8 TA = 0, TB = 0, TC = 0;

- if ((drive->media != ide_disk) && (speed < XFER_SW_DMA_0))
+ if (drive->media != ide_disk && !PDC202XX_CDROM_UDMA(drive) &&
+ speed < XFER_SW_DMA_0)
return -1;

pci_read_config_dword(dev, drive_pci, &drive_conf);
@@ -329,8 +336,7 @@
}

chipset_is_set:
-
- if (drive->media == ide_disk) {
+ if (drive->media == ide_disk || PDC202XX_CDROM_UDMA(drive)) {
pci_read_config_byte(dev, (drive_pci), &AP);
if (id->capability & 4) /* IORDY_EN */
pci_write_config_byte(dev, (drive_pci), AP|IORDY_EN);
@@ -385,7 +391,7 @@
{
if (drive->current_speed > XFER_UDMA_2)
pdc_old_enable_66MHz_clock(drive->hwif);
- if (drive->addressing == 1) {
+ if (drive->addressing == 1 || PDC202XX_CDROM_UDMA(drive)) {
struct request *rq = HWGROUP(drive)->rq;
ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master;
@@ -405,7 +411,7 @@

static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
{
- if (drive->addressing == 1) {
+ if (drive->addressing == 1 || PDC202XX_CDROM_UDMA(drive)) {
ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master;
unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
@@ -519,6 +525,9 @@
hwif->ultra_mask = 0x3f;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
+#ifdef CONFIG_PDC202XX_ATAPI
+ hwif->atapi_dma = 1;
+#endif

hwif->err_stops_fifo = 1;