[BK PATCHES] 2.6.x libata fixes

2005-03-29 Thread Jeff Garzik
 Please do a

bk pull bk://gkernel.bkbits.net/libata-2.6

This will update the following files:

 drivers/scsi/ahci.c|2 --
 drivers/scsi/libata-scsi.c |7 ++-
 drivers/scsi/sata_sil.c|   32 +++-
 3 files changed, 37 insertions(+), 4 deletions(-)

through these ChangeSets:

carlos.pardo:siliconimage.com:
  o sata_sil: Fix FIFO PCI Bus Arbitration

Brett Russ:
  o libata: support descriptor sense in ctrl page

Jason Gaston:
  o SATA AHCI correction Intel ICH7R

Jeff Garzik:
  o [libata sata_sil] Don't presume PCI cache-line-size reg is  0

diff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
--- a/drivers/scsi/ahci.c   2005-03-29 15:45:18 -05:00
+++ b/drivers/scsi/ahci.c   2005-03-29 15:45:18 -05:00
@@ -253,8 +253,6 @@
  board_ahci }, /* ICH7 */
{ PCI_VENDOR_ID_INTEL, 0x27c5, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  board_ahci }, /* ICH7M */
-   { PCI_VENDOR_ID_INTEL, 0x27c2, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
- board_ahci }, /* ICH7R */
{ PCI_VENDOR_ID_INTEL, 0x27c3, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  board_ahci }, /* ICH7R */
{ PCI_VENDOR_ID_AL, 0x5288, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
--- a/drivers/scsi/libata-scsi.c2005-03-29 15:45:18 -05:00
+++ b/drivers/scsi/libata-scsi.c2005-03-29 15:45:18 -05:00
@@ -1038,7 +1038,12 @@
 
 static unsigned int ata_msense_ctl_mode(u8 **ptr_io, const u8 *last)
 {
-   const u8 page[] = {0xa, 0xa, 2, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 30};
+   const u8 page[] = {0xa, 0xa, 6, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 30};
+
+   /* byte 2: set the descriptor format sense data bit (bit 2)
+* since we need to support returning this format for SAT
+* commands and any SCSI commands against a 48b LBA device.
+*/
 
ata_msense_push(ptr_io, last, page, sizeof(page));
return sizeof(page);
diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
--- a/drivers/scsi/sata_sil.c   2005-03-29 15:45:18 -05:00
+++ b/drivers/scsi/sata_sil.c   2005-03-29 15:45:18 -05:00
@@ -38,12 +38,21 @@
 #include linux/libata.h
 
 #define DRV_NAME   sata_sil
-#define DRV_VERSION0.8
+#define DRV_VERSION0.9
 
 enum {
sil_3112= 0,
sil_3114= 1,
 
+   SIL_FIFO_R0 = 0x40,
+   SIL_FIFO_W0 = 0x41,
+   SIL_FIFO_R1 = 0x44,
+   SIL_FIFO_W1 = 0x45,
+   SIL_FIFO_R2 = 0x240,
+   SIL_FIFO_W2 = 0x241,
+   SIL_FIFO_R3 = 0x244,
+   SIL_FIFO_W3 = 0x245,
+
SIL_SYSCFG  = 0x48,
SIL_MASK_IDE0_INT   = (1  22),
SIL_MASK_IDE1_INT   = (1  23),
@@ -199,6 +208,13 @@
 MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
+static unsigned char sil_get_device_cache_line(struct pci_dev *pdev)
+{
+   u8 cache_line = 0;
+   pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, cache_line);
+   return cache_line;
+}
+
 static void sil_post_set_mode (struct ata_port *ap)
 {
struct ata_host_set *host_set = ap-host_set;
@@ -341,6 +357,7 @@
unsigned int i;
int pci_dev_busy = 0;
u32 tmp, irq_mask;
+   u8 cls;
 
if (!printed_version++)
printk(KERN_DEBUG DRV_NAME  version  DRV_VERSION \n);
@@ -404,6 +421,19 @@
probe_ent-port[i].scr_addr = base + sil_port[i].scr;
ata_std_ports(probe_ent-port[i]);
}
+
+   /* Initialize FIFO PCI bus arbitration */
+   cls = sil_get_device_cache_line(pdev);
+   if (cls) {
+   cls = 3;
+   cls++;  /* cls = (line_size/8)+1 */
+   writeb(cls, mmio_base + SIL_FIFO_R0);
+   writeb(cls, mmio_base + SIL_FIFO_W0);
+   writeb(cls, mmio_base + SIL_FIFO_R1);
+   writeb(cls, mmio_base + SIL_FIFO_W2);
+   } else
+   printk(KERN_WARNING DRV_NAME (%s): cache line size not set.  
Driver may not function\n,
+   pci_name(pdev));
 
if (ent-driver_data == sil_3114) {
irq_mask = SIL_MASK_4PORT;


[BK PATCHES] 2.6.x libata fixes

2005-03-11 Thread Jeff Garzik
 Please do a

bk pull bk://gkernel.bkbits.net/libata-2.6

This will update the following files:

 drivers/scsi/ahci.c |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)

through these ChangeSets:

Brett Russ:
  o AHCI: fix fatal error int handling

Jeff Garzik:
  o [libata ahci] support -tf_read hook

diff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
--- a/drivers/scsi/ahci.c	2005-03-11 23:30:59 -05:00
+++ b/drivers/scsi/ahci.c	2005-03-11 23:30:59 -05:00
@@ -177,6 +177,7 @@
 static int ahci_port_start(struct ata_port *ap);
 static void ahci_port_stop(struct ata_port *ap);
 static void ahci_host_stop(struct ata_host_set *host_set);
+static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void ahci_qc_prep(struct ata_queued_cmd *qc);
 static u8 ahci_check_status(struct ata_port *ap);
 static u8 ahci_check_err(struct ata_port *ap);
@@ -210,6 +211,8 @@
 	.check_err		= ahci_check_err,
 	.dev_select		= ata_noop_dev_select,
 
+	.tf_read		= ahci_tf_read,
+
 	.phy_reset		= ahci_phy_reset,
 
 	.qc_prep		= ahci_qc_prep,
@@ -463,6 +466,14 @@
 	return (readl(mmio + PORT_TFDATA)  8)  0xFF;
 }
 
+static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
+{
+	struct ahci_port_priv *pp = ap-private_data;
+	u8 *d2h_fis = pp-rx_fis + RX_FIS_D2H_REG;
+
+	ata_tf_from_fis(d2h_fis, tf);
+}
+
 static void ahci_fill_sg(struct ata_queued_cmd *qc)
 {
 	struct ahci_port_priv *pp = qc-ap-private_data;
@@ -539,7 +550,7 @@
 
 	/* stop DMA */
 	tmp = readl(port_mmio + PORT_CMD);
-	tmp = PORT_CMD_START | PORT_CMD_FIS_RX;
+	tmp = ~PORT_CMD_START;
 	writel(tmp, port_mmio + PORT_CMD);
 
 	/* wait for engine to stop.  TODO: this could be
@@ -571,7 +582,7 @@
 
 	/* re-start DMA */
 	tmp = readl(port_mmio + PORT_CMD);
-	tmp |= PORT_CMD_START | PORT_CMD_FIS_RX;
+	tmp |= PORT_CMD_START;
 	writel(tmp, port_mmio + PORT_CMD);
 	readl(port_mmio + PORT_CMD); /* flush */
 


[BK PATCHES] 2.6.x libata fixes (mostly)

2005-02-23 Thread Jeff Garzik
This BK push includes additional hardware support, but that's only 
because it's (a) obviously low impact and (b) it was in the queue.

Far more important are:
1) API additions, to fix a severe bug:  advanced drivers such as AHCI 
were directly bitbanging --non-existent-- PCI IDE registers, causing an 
oops, because of function calls buried deep within libata.

Solution:  add the necessary hooks that should have existed all along, 
for this functionality.

2) Fix stomping on active devices, if pci_request_regions() fails.  It 
is rather more urgent for libata than other situations, since we must 
deal with PCI devices that secretly export ISA device regions (legacy 
IDE 0x1f0, 0x170).

3) Fix command queue leak, if SCSI-ATA translation fails.

Please do a

bk pull bk://gkernel.bkbits.net/libata-2.6

This will update the following files:

 drivers/scsi/Kconfig|8 
 drivers/scsi/Makefile   |1 
 drivers/scsi/ahci.c |   18 +
 drivers/scsi/ata_piix.c |4 
 drivers/scsi/libata-core.c  |  115 ++-
 drivers/scsi/libata-scsi.c  |1 
 drivers/scsi/libata.h   |1 
 drivers/scsi/sata_nv.c  |   10 
 drivers/scsi/sata_promise.c |8 
 drivers/scsi/sata_qstor.c   |  700 
 drivers/scsi/sata_sil.c |   10 
 drivers/scsi/sata_sis.c |   10 
 drivers/scsi/sata_svw.c |   10 
 drivers/scsi/sata_sx4.c |8 
 drivers/scsi/sata_uli.c |   10 
 drivers/scsi/sata_via.c |  213 +
 drivers/scsi/sata_vsc.c |   10 
 include/linux/libata.h  |   64 
 18 files changed, 1058 insertions(+), 143 deletions(-)

through these ChangeSets:

[EMAIL PROTECTED] (05/02/23 1.2043)
   [libata] Add missing hooks, to avoid oops in advanced SATA drivers
   
   Advanced SATA drivers should not (and cannot) use the basic
   PCI IDE hooks for checking the Status and Error registers, as these
   registers are either in non-standard locations, or simply don't
   exist.
   
   In the error handling path, libata was unconditionally calling some
   PCI IDE hardware bitbanging functions, which would cause an oops
   in the AHCI driver and any other advanced libata driver.

[EMAIL PROTECTED] (05/02/18 1.2040)
   [PATCH] libata: fix command queue leak when xlat_func fails
   
   ata_scsi_translate allocates from the libata command queue by calling
   ata_scsi_qc_new.  If xlat_func returns non-zero, control jumps to
   err_out which fails to free the allocated command.  Fix is to add a
   new API to free unused commands.
   
   Signed-off-by: John W. Linville [EMAIL PROTECTED]
   Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

[EMAIL PROTECTED] (05/02/17 1.2035.16.1)
   [libata] add -bmdma_{stop,status} hooks
   
   The timeout/error handling path was assuming that the hardware in
   question was PCI IDE BMDMA-like, which is incorrect in a few cases.
   
   Turn direct function calls into two new hooks.

[EMAIL PROTECTED] (05/02/17 1.2038)
   [PATCH] sata_qstor: new basic driver for Pacific Digital
   
   This is a new basic libata SATA driver
   for the Pacific Digital QStor SATA/RAID card.
   
   It features ordinary per-drive SATA with single-request DMA
   for R/W commands, and PIO for everything else.
   
   It currently does not implement any of the hardware RAID support,
   nor hot-plug, nor the tagged/native command-queuing features.
   
   On the other hand, it is small and simple as a result.
   
   Signed-off-by: Mark Lord [EMAIL PROTECTED]
   Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

[EMAIL PROTECTED] (05/02/13 1.2037)
   [libata] do not call pci_disable_device() for certain errors
   
   If PCI request regions fails, then someone else is using the
   hardware we wish to use.  For that one case, calling pci_disable_device()
   is rather rude.

[EMAIL PROTECTED] (04/11/16 1.1938.367.2)
   [libata sata_via] add support for VT6421 SATA

[EMAIL PROTECTED] (04/11/16 1.1938.367.1)
   [libata sata_via] minor cleanups
   
   Preparation for addition of VT6421 support.  Mostly moving bits
   of code into discrete functions.

diff -Nru a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig  2005-02-23 14:50:15 -05:00
+++ b/drivers/scsi/Kconfig  2005-02-23 14:50:15 -05:00
@@ -457,6 +457,14 @@
 
  If unsure, say N.
 
+config SCSI_SATA_QSTOR
+   tristate Pacific Digital SATA QStor support
+   depends on SCSI_SATA  PCI
+   help
+ This option enables support for Pacific Digital Serial ATA QStor.
+
+ If unsure, say N.
+
 config SCSI_SATA_SX4
tristate Promise SATA SX4 support
depends on SCSI_SATA  PCI  EXPERIMENTAL
diff -Nru a/drivers/scsi/Makefile b/drivers/scsi/Makefile
--- a/drivers/scsi/Makefile 2005-02-23 14:50:15 -05:00
+++ b/drivers/scsi/Makefile 2005-02-23 14:50:15 -05:00
@@ -125,6 +125,7 @@
 obj-$(CONFIG_SCSI_SATA_SVW)+= libata.o sata_svw.o
 obj-$(CONFIG_SCSI_ATA_PIIX)+= libata.o ata_piix.o
 

Re: [BK PATCHES] 2.6.x libata fixes (mostly)

2005-02-23 Thread Alexey Dobriyan
On Wednesday 23 February 2005 23:45, Alexey Dobriyan wrote:
  +static void qs_ata_setup_port(struct ata_ioports *port, unsigned long base)
  +{
  +   port-cmd_addr  =
 
  +   port-error_addr=
 
  +   port-status_addr   =
 
  +   port-altstatus_addr=
 
 Oo-oops...

Too much snipping and time to sleep for me, sorry. :-(

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


Re: [BK PATCHES] 2.6.x libata fixes (mostly)

2005-02-23 Thread Jeff Garzik
Thanks.  All this stuff was minor, so I'll wait until 2.6.11 release to 
update.

I forwarded the qstor stuff to maintainer Mark Lord.
Jeff
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BK PATCHES] 2.6.x libata fixes (mostly)

2005-02-23 Thread Prakash Punnoor
Alexey Dobriyan schrieb:
 On Wednesday 23 February 2005 21:57, Jeff Garzik wrote:

+ addr = sg_dma_address(sg);
+ *(u64 *)prd = cpu_to_le64(addr);


 *(__le64 *) prd


+ prd += sizeof(u64);


+ len = sg_dma_len(sg);
+ *(u32 *)prd = cpu_to_le32(len);


 *(__le32 *) prd

If I am not totally mistaken this is not gcc4 friendly code. (lvalue thing...)
Wouldn't it be better to prevent double patching?

--
Prakash Punnoor

formerly known as Prakash K. Cheemplavam


signature.asc
Description: OpenPGP digital signature


Re: [BK PATCHES] 2.6.x libata fixes (mostly)

2005-02-23 Thread Roland Dreier
Prakash If I am not totally mistaken this is not gcc4 friendly
Prakash code. (lvalue thing...)

Actually you misread the code slightly.  It's a little subtle, but
code like

*(__le32 *)prd = cpu_to_le32(len);

is not using a cast as an lvalue.  It's dereferencing a cast and as
such is totally correct, idiomatic and clean C.

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


Re: [BK PATCHES] 2.6.x libata fixes (mostly)

2005-02-23 Thread Prakash Punnoor
Roland Dreier schrieb:
 Prakash If I am not totally mistaken this is not gcc4 friendly
 Prakash code. (lvalue thing...)

 Actually you misread the code slightly.  It's a little subtle, but
 code like

   *(__le32 *)prd = cpu_to_le32(len);

 is not using a cast as an lvalue.  It's dereferencing a cast and as
 such is totally correct, idiomatic and clean C.

OK, thanks for clearing that up. Obviously my C knowledge needs to be 
improved...

--
Prakash Punnoor

formerly known as Prakash K. Cheemplavam


signature.asc
Description: OpenPGP digital signature