Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-08 Thread Alan
> IMO creating a new check_atapi_dma function for first-gen chips would be 
> the preferred way to add this check.

A mode filter would be even better, that will mean the list of modes on
the device is correct and ATAPI devices are shown as PIO on such a
controller.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-08 Thread Mikael Pettersson
On Sun, 07 Jan 2007 20:47:35 -0500, Jeff Garzik wrote:
> Mikael Pettersson wrote:
> > @@ -789,8 +789,14 @@ static void pdc_exec_command_mmio(struct
> >  static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
> >  {
> > u8 *scsicmd = qc->scsicmd->cmnd;
> > +   struct ata_port *ap = qc->ap;
> > +   struct pdc_host_priv *hp = ap->host->private_data;
> > int pio = 1; /* atapi dma off by default */
> >  
> > +   /* First generation chips cannot use ATAPI DMA on SATA ports */
> > +   if (!(hp->flags & PDC_FLAG_GEN_II) && sata_scr_valid(ap))
> > +   return 1;
> > +
> > /* Whitelist commands that may use DMA. */
> > switch (scsicmd[0]) {
> > case WRITE_12:
> 
> 
> IMO creating a new check_atapi_dma function for first-gen chips would be 
> the preferred way to add this check.

Agreed. Will do.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-08 Thread Mikael Pettersson
On Sun, 07 Jan 2007 20:47:35 -0500, Jeff Garzik wrote:
 Mikael Pettersson wrote:
  @@ -789,8 +789,14 @@ static void pdc_exec_command_mmio(struct
   static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
   {
  u8 *scsicmd = qc-scsicmd-cmnd;
  +   struct ata_port *ap = qc-ap;
  +   struct pdc_host_priv *hp = ap-host-private_data;
  int pio = 1; /* atapi dma off by default */
   
  +   /* First generation chips cannot use ATAPI DMA on SATA ports */
  +   if (!(hp-flags  PDC_FLAG_GEN_II)  sata_scr_valid(ap))
  +   return 1;
  +
  /* Whitelist commands that may use DMA. */
  switch (scsicmd[0]) {
  case WRITE_12:
 
 
 IMO creating a new check_atapi_dma function for first-gen chips would be 
 the preferred way to add this check.

Agreed. Will do.

/Mikael
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-08 Thread Alan
 IMO creating a new check_atapi_dma function for first-gen chips would be 
 the preferred way to add this check.

A mode filter would be even better, that will mean the list of modes on
the device is correct and ATAPI devices are shown as PIO on such a
controller.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-07 Thread Jeff Garzik

Mikael Pettersson wrote:

@@ -789,8 +789,14 @@ static void pdc_exec_command_mmio(struct
 static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
 {
u8 *scsicmd = qc->scsicmd->cmnd;
+   struct ata_port *ap = qc->ap;
+   struct pdc_host_priv *hp = ap->host->private_data;
int pio = 1; /* atapi dma off by default */
 
+	/* First generation chips cannot use ATAPI DMA on SATA ports */

+   if (!(hp->flags & PDC_FLAG_GEN_II) && sata_scr_valid(ap))
+   return 1;
+
/* Whitelist commands that may use DMA. */
switch (scsicmd[0]) {
case WRITE_12:



IMO creating a new check_atapi_dma function for first-gen chips would be 
the preferred way to add this check.


Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-07 Thread Mikael Pettersson
On Sat, 6 Jan 2007 21:32:03 +0100 (MET), Mikael Pettersson wrote:
>This patch adds ATAPI support for the PATA port on Promise 2037x chips.
>It depends on the common sata_promise ATAPI support patch.
>
>First-generation chips don't support ATAPI on their SATA ports, so
>the patch removes ATA_FLAG_NO_ATAPI from the 2037x common host flags,
>and adds it back via the _port_flags[] entries for the SATA ports.

Update: SATAPI works on first-generation chips, but only in PIO mode.

To verify that DMA doesn't work I also tried Promise's pdc-ultra
driver for their first-generation chips. It doesn't want to support
ATAPI without an explicit option. Enabling that option makes it
recognise ATAPI devices, but even a simple "eject" command triggers
command timeouts and eventually a kernel oops due to the NMI watchdog.
So I'm fairly sure that DMA simply doesn't work.

This patch enables ATAPI on 20319 and 2037x chips, but forces SATA
ports to always use PIO. As a side-effect, ATAPI support is now free
of any dependencies on the #promise-sata-pata branch.

Signed-off-by: Mikael Pettersson <[EMAIL PROTECTED]>

--- linux-2.6.20-rc4/drivers/ata/sata_promise.c.~1~ 2007-01-07 
22:58:01.0 +0100
+++ linux-2.6.20-rc4/drivers/ata/sata_promise.c 2007-01-07 23:06:22.0 
+0100
@@ -197,7 +197,7 @@ static const struct ata_port_info pdc_po
/* board_20319 */
{
.sht= _ata_sht,
-   .flags  = PDC_COMMON_FLAGS | ATA_FLAG_NO_ATAPI | 
ATA_FLAG_SATA,
+   .flags  = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
.pio_mask   = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
.udma_mask  = 0x7f, /* udma0-6 ; FIXME */
@@ -789,8 +789,14 @@ static void pdc_exec_command_mmio(struct
 static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
 {
u8 *scsicmd = qc->scsicmd->cmnd;
+   struct ata_port *ap = qc->ap;
+   struct pdc_host_priv *hp = ap->host->private_data;
int pio = 1; /* atapi dma off by default */
 
+   /* First generation chips cannot use ATAPI DMA on SATA ports */
+   if (!(hp->flags & PDC_FLAG_GEN_II) && sata_scr_valid(ap))
+   return 1;
+
/* Whitelist commands that may use DMA. */
switch (scsicmd[0]) {
case WRITE_12:
@@ -996,10 +1002,6 @@ static int pdc_ata_init_one (struct pci_
probe_ent->n_ports = 2;
probe_ent->_port_flags[0] = ATA_FLAG_SATA;
probe_ent->_port_flags[1] = ATA_FLAG_SATA;
-   if (board_idx == board_2037x) {
-   probe_ent->_port_flags[0] |= ATA_FLAG_NO_ATAPI;
-   probe_ent->_port_flags[1] |= ATA_FLAG_NO_ATAPI;
-   }
break;
case board_20619:
probe_ent->n_ports = 4;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-07 Thread Mikael Pettersson
On Sat, 6 Jan 2007 21:32:03 +0100 (MET), Mikael Pettersson wrote:
This patch adds ATAPI support for the PATA port on Promise 2037x chips.
It depends on the common sata_promise ATAPI support patch.

First-generation chips don't support ATAPI on their SATA ports, so
the patch removes ATA_FLAG_NO_ATAPI from the 2037x common host flags,
and adds it back via the _port_flags[] entries for the SATA ports.

Update: SATAPI works on first-generation chips, but only in PIO mode.

To verify that DMA doesn't work I also tried Promise's pdc-ultra
driver for their first-generation chips. It doesn't want to support
ATAPI without an explicit option. Enabling that option makes it
recognise ATAPI devices, but even a simple eject command triggers
command timeouts and eventually a kernel oops due to the NMI watchdog.
So I'm fairly sure that DMA simply doesn't work.

This patch enables ATAPI on 20319 and 2037x chips, but forces SATA
ports to always use PIO. As a side-effect, ATAPI support is now free
of any dependencies on the #promise-sata-pata branch.

Signed-off-by: Mikael Pettersson [EMAIL PROTECTED]

--- linux-2.6.20-rc4/drivers/ata/sata_promise.c.~1~ 2007-01-07 
22:58:01.0 +0100
+++ linux-2.6.20-rc4/drivers/ata/sata_promise.c 2007-01-07 23:06:22.0 
+0100
@@ -197,7 +197,7 @@ static const struct ata_port_info pdc_po
/* board_20319 */
{
.sht= pdc_ata_sht,
-   .flags  = PDC_COMMON_FLAGS | ATA_FLAG_NO_ATAPI | 
ATA_FLAG_SATA,
+   .flags  = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
.pio_mask   = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
.udma_mask  = 0x7f, /* udma0-6 ; FIXME */
@@ -789,8 +789,14 @@ static void pdc_exec_command_mmio(struct
 static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
 {
u8 *scsicmd = qc-scsicmd-cmnd;
+   struct ata_port *ap = qc-ap;
+   struct pdc_host_priv *hp = ap-host-private_data;
int pio = 1; /* atapi dma off by default */
 
+   /* First generation chips cannot use ATAPI DMA on SATA ports */
+   if (!(hp-flags  PDC_FLAG_GEN_II)  sata_scr_valid(ap))
+   return 1;
+
/* Whitelist commands that may use DMA. */
switch (scsicmd[0]) {
case WRITE_12:
@@ -996,10 +1002,6 @@ static int pdc_ata_init_one (struct pci_
probe_ent-n_ports = 2;
probe_ent-_port_flags[0] = ATA_FLAG_SATA;
probe_ent-_port_flags[1] = ATA_FLAG_SATA;
-   if (board_idx == board_2037x) {
-   probe_ent-_port_flags[0] |= ATA_FLAG_NO_ATAPI;
-   probe_ent-_port_flags[1] |= ATA_FLAG_NO_ATAPI;
-   }
break;
case board_20619:
probe_ent-n_ports = 4;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-07 Thread Jeff Garzik

Mikael Pettersson wrote:

@@ -789,8 +789,14 @@ static void pdc_exec_command_mmio(struct
 static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
 {
u8 *scsicmd = qc-scsicmd-cmnd;
+   struct ata_port *ap = qc-ap;
+   struct pdc_host_priv *hp = ap-host-private_data;
int pio = 1; /* atapi dma off by default */
 
+	/* First generation chips cannot use ATAPI DMA on SATA ports */

+   if (!(hp-flags  PDC_FLAG_GEN_II)  sata_scr_valid(ap))
+   return 1;
+
/* Whitelist commands that may use DMA. */
switch (scsicmd[0]) {
case WRITE_12:



IMO creating a new check_atapi_dma function for first-gen chips would be 
the preferred way to add this check.


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-06 Thread Mikael Pettersson
This patch adds ATAPI support for the PATA port on Promise 2037x chips.
It depends on the common sata_promise ATAPI support patch.

First-generation chips don't support ATAPI on their SATA ports, so
the patch removes ATA_FLAG_NO_ATAPI from the 2037x common host flags,
and adds it back via the _port_flags[] entries for the SATA ports.

Signed-off-by: Mikael Pettersson <[EMAIL PROTECTED]>

--- linux-2.6.20-rc3/drivers/ata/sata_promise.c.~1~ 2007-01-06 
17:10:56.0 +0100
+++ linux-2.6.20-rc3/drivers/ata/sata_promise.c 2007-01-06 17:14:23.0 
+0100
@@ -187,7 +187,7 @@ static const struct ata_port_info pdc_po
/* board_2037x */
{
.sht= _ata_sht,
-   .flags  = PDC_COMMON_FLAGS | ATA_FLAG_NO_ATAPI /* | 
ATA_FLAG_SATA */,
+   .flags  = PDC_COMMON_FLAGS /* | ATA_FLAG_NO_ATAPI | 
ATA_FLAG_SATA */,
.pio_mask   = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
.udma_mask  = 0x7f, /* udma0-6 ; FIXME */
@@ -996,6 +996,10 @@ static int pdc_ata_init_one (struct pci_
probe_ent->n_ports = 2;
probe_ent->_port_flags[0] = ATA_FLAG_SATA;
probe_ent->_port_flags[1] = ATA_FLAG_SATA;
+   if (board_idx == board_2037x) {
+   probe_ent->_port_flags[0] |= ATA_FLAG_NO_ATAPI;
+   probe_ent->_port_flags[1] |= ATA_FLAG_NO_ATAPI;
+   }
break;
case board_20619:
probe_ent->n_ports = 4;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH libata #promise-sata-pata] sata_promise: 2037x PATAPI support

2007-01-06 Thread Mikael Pettersson
This patch adds ATAPI support for the PATA port on Promise 2037x chips.
It depends on the common sata_promise ATAPI support patch.

First-generation chips don't support ATAPI on their SATA ports, so
the patch removes ATA_FLAG_NO_ATAPI from the 2037x common host flags,
and adds it back via the _port_flags[] entries for the SATA ports.

Signed-off-by: Mikael Pettersson [EMAIL PROTECTED]

--- linux-2.6.20-rc3/drivers/ata/sata_promise.c.~1~ 2007-01-06 
17:10:56.0 +0100
+++ linux-2.6.20-rc3/drivers/ata/sata_promise.c 2007-01-06 17:14:23.0 
+0100
@@ -187,7 +187,7 @@ static const struct ata_port_info pdc_po
/* board_2037x */
{
.sht= pdc_ata_sht,
-   .flags  = PDC_COMMON_FLAGS | ATA_FLAG_NO_ATAPI /* | 
ATA_FLAG_SATA */,
+   .flags  = PDC_COMMON_FLAGS /* | ATA_FLAG_NO_ATAPI | 
ATA_FLAG_SATA */,
.pio_mask   = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
.udma_mask  = 0x7f, /* udma0-6 ; FIXME */
@@ -996,6 +996,10 @@ static int pdc_ata_init_one (struct pci_
probe_ent-n_ports = 2;
probe_ent-_port_flags[0] = ATA_FLAG_SATA;
probe_ent-_port_flags[1] = ATA_FLAG_SATA;
+   if (board_idx == board_2037x) {
+   probe_ent-_port_flags[0] |= ATA_FLAG_NO_ATAPI;
+   probe_ent-_port_flags[1] |= ATA_FLAG_NO_ATAPI;
+   }
break;
case board_20619:
probe_ent-n_ports = 4;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/