IT8212 driver seems to be broken - no DMA or functionality in general

8 messages, 3 authors, 2008-08-18 · open the first message on its own page

IT8212 driver seems to be broken - no DMA or functionality in general

From: Peter Wells <hidden>
Date: 2008-08-12 11:49:12

Hello there,

I have been having a lot of trouble with my ITE 8212 RAID controller
after upgrading from kernel 2.6.18 to 2.6.26.  I have posed to kernel
trap and was advised to mail a copy to this mailing list.  If anyone
has any ideas on how to solve this problem i'd be extremely grateful.

The post is located at http://kerneltrap.org/node/16482 and looks like this:

IT8212 driver seems to be broken - no DMA or functionality in general

August 10, 2008 - 3:20pm
Submitted by Anonymous on August 10, 2008 - 3:20pm.

Hi there,

I am having some problems with my ITE 8212 raid controller. It was
working (more or less OK) in version 2.6.18 but now appears to be
broken in 2.6.25 and 2.6.26.2.

My main issue is that I cannot turn on DMA with the drive. When the
controller was working under 2.6.18, I had to enable DMA before
mounting or even checking the drive as strange disk errors would occur
which resulted in needing to reboot.

First I tried the driver (it8212) in Device Drivers->ATA/ATAPI and
friends->IT821X

After booting, hdparm gives me the following error when I try to set
DMA on the drive:

HDIO_SET_DMA failed: Input/output error

Dmesg also says the following during the boot:

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
...
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
IT8212: IDE controller (0x1283:0x8212 rev 0x11) at PCI slot 0000:00:09.0
...it821x: controller in smart mode.
IT8212: 100% native mode on irq 10
ide2: BM-DMA at 0xe400-0xe407
ide3: BM-DMA at 0xe408-0xe40f
Probing IDE interface ide2...
hde: Integrated Technology Express Inc, ATA DISK drive
hde: IT8212 RAID 1 volume.
hde: no DMA mode selected
Probing IDE interface ide3...
...
hde: max request size: 128KiB
hde: 117231406 sectors (60022 MB), CHS=7297/255/63
hde: cache flushes not supported
hde: hde1
Driver 'sd' needs updating - please use bus_type methods

I managed to find this thread, which seemed relevant, but it seems the
problem still exists :<

I have also tried using the driver (IT8211/2 PATA Support) in Serial
ATA (prod) and Parallel ATA (experimental) drivers

Dmesg then gives me the following (see below).

Any help with this would be greatly appreciated, as I've been banging
my head against my monitor for almost the whole weekend :>

Kind regards,

Pete

pete dot wells at gmail dot com

Driver 'sd' needs updating - please use bus_type methods
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10
PCI: setting IRQ 10 as level-triggered
ACPI: PCI Interrupt 0000:00:09.0[A] -> Link [LNKB] -> GSI 10 (level,
low) -> IRQ 10
pata_it821x: controller in smart mode.
PCI: Setting latency timer of device 0000:00:09.0 to 64
scsi0 : pata_it821x
scsi1 : pata_it821x
ata1: PATA max MWDMA2 cmd 0xd400 ctl 0xd800 bmdma 0xe400 irq 10
ata2: PATA max MWDMA2 cmd 0xdc00 ctl 0xe000 bmdma 0xe408 irq 10
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1.00: failed to IDENTIFY (INIT_DEV_PARAMS failed, err_mask=0x80)
ata1: failed to recover some devices, retrying in 5 secs
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1.00: failed to IDENTIFY (INIT_DEV_PARAMS failed, err_mask=0x80)
ata1: failed to recover some devices, retrying in 5 secs
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1.00: failed to IDENTIFY (INIT_DEV_PARAMS failed, err_mask=0x80)
ata1: failed to recover some devices, retrying in 5 secs
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: Alan Cox <hidden>
Date: 2008-08-12 12:15:04

The post is located at http://kerneltrap.org/node/16482 and looks like this:

IT8212 driver seems to be broken - no DMA or functionality in general
I sent Jeff a set of fixes for this for the libata driver. Some changes
in libata broke some tricks the pata_it821x driver did. I've rewritten
those bits and parts of the core libata to sort that out and my IT821x
RAID card is back to health with libata. Hopefully .27 will behave
somewhat better therefore.

No idea about the old IDE driver. I don't think anyone maintains that one
any more but it certainly used to work.

Alan

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: Peter Wells <hidden>
Date: 2008-08-12 12:22:56

Hi Alan,

Thanks for your quick response.

Is there an existing patch that can be applied to some recent-ish
vanilla kernel source in order to fix libata and pata_it821x or would
it be best to wait until .27 ?

Kind regards,

Pete

2008/8/12 Alan Cox [off-list ref]:
quoted
The post is located at http://kerneltrap.org/node/16482 and looks like this:

IT8212 driver seems to be broken - no DMA or functionality in general
I sent Jeff a set of fixes for this for the libata driver. Some changes
in libata broke some tricks the pata_it821x driver did. I've rewritten
those bits and parts of the core libata to sort that out and my IT821x
RAID card is back to health with libata. Hopefully .27 will behave
somewhat better therefore.

No idea about the old IDE driver. I don't think anyone maintains that one
any more but it certainly used to work.

Alan

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: "Bartlomiej Zolnierkiewicz" <bzolnier@gmail.com>
Date: 2008-08-12 12:47:10

On Tue, Aug 12, 2008 at 1:57 PM, Alan Cox [off-list ref] wrote:
quoted
The post is located at http://kerneltrap.org/node/16482 and looks like this:

IT8212 driver seems to be broken - no DMA or functionality in general
I sent Jeff a set of fixes for this for the libata driver. Some changes
in libata broke some tricks the pata_it821x driver did. I've rewritten
those bits and parts of the core libata to sort that out and my IT821x
RAID card is back to health with libata. Hopefully .27 will behave
somewhat better therefore.

No idea about the old IDE driver. I don't think anyone maintains that one
any more but it certainly used to work.
It should still work.  Peter, please try with 2.6.27-rc2 (2.6.26 needs
a fix which is queued for the next -stable release).

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: Alan Cox <hidden>
Date: 2008-08-12 12:48:46

On Tue, 12 Aug 2008 13:22:55 +0100
"Peter Wells" [off-list ref] wrote:
Hi Alan,

Thanks for your quick response.

Is there an existing patch that can be applied to some recent-ish
vanilla kernel source in order to fix libata and pata_it821x or would
it be best to wait until .27 ?
The patches touch the core libata code so are not entirely self
contained but they are attached below and should do the trick
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9bef1a8..b4297ea 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1131,6 +1131,8 @@ void ata_id_string(const u16 *id, unsigned char *s,
 		   unsigned int ofs, unsigned int len)
 {
 	unsigned int c;
+	
+	BUG_ON(len & 1);
 
 	while (len > 0) {
 		c = id[ofs] >> 8;
@@ -1165,8 +1167,6 @@ void ata_id_c_string(const u16 *id, unsigned char *s,
 {
 	unsigned char *p;
 
-	WARN_ON(!(len & 1));
-
 	ata_id_string(id, s, ofs, len - 1);
 
 	p = s + strnlen(s, len - 1);
@@ -1886,6 +1886,23 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
 }
 
 /**
+ *	ata_do_dev_read_id		-	default ID read method
+ *	@dev: device
+ *	@tf: proposed taskfile
+ *	@id: data buffer
+ *
+ *	Issue the identify taskfile and hand back the buffer containing
+ *	identify data. For some RAID controllers and for pre ATA devices
+ *	this function is wrapped or replaced by the driver
+ */
+unsigned int ata_do_dev_read_id(struct ata_device *dev,
+					struct ata_taskfile *tf, u16 *id)
+{
+	return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
+				     id, sizeof(id[0]) * ATA_ID_WORDS, 0);
+}
+
+/**
  *	ata_dev_read_id - Read ID data from the specified device
  *	@dev: target device
  *	@p_class: pointer to class of the target device (may be changed)
@@ -1920,7 +1937,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 	if (ata_msg_ctl(ap))
 		ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
 
- retry:
+retry:
 	ata_tf_init(dev, &tf);
 
 	switch (class) {
@@ -1947,9 +1964,12 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 	 * controllers.  Always poll IDENTIFY if available.
 	 */
 	tf.flags |= ATA_TFLAG_POLLING;
+	
+	if (ap->ops->read_id)
+		err_mask = ap->ops->read_id(dev, &tf, id);
+	else
+		err_mask = ata_do_dev_read_id(dev, &tf, id);
 
-	err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
-				     id, sizeof(id[0]) * ATA_ID_WORDS, 0);
 	if (err_mask) {
 		if (err_mask & AC_ERR_NODEV_HINT) {
 			ata_dev_printk(dev, KERN_DEBUG,
@@ -6269,6 +6289,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume);
 #endif /* CONFIG_PM */
 EXPORT_SYMBOL_GPL(ata_id_string);
 EXPORT_SYMBOL_GPL(ata_id_c_string);
+EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
 EXPORT_SYMBOL_GPL(ata_scsi_simulate);
 
 EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index e108169..deb5cd8 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -80,7 +80,7 @@
 
 
 #define DRV_NAME "pata_it821x"
-#define DRV_VERSION "0.3.8"
+#define DRV_VERSION "0.4.0"
 
 struct it821x_dev
 {
@@ -425,6 +425,8 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)
 		case ATA_CMD_WRITE_MULTI:
 		case ATA_CMD_WRITE_MULTI_EXT:
 		case ATA_CMD_ID_ATA:
+		case ATA_CMD_INIT_DEV_PARAMS:
+		case 0xFC:	/* Internal 'report rebuild state' */
 		/* Arguably should just no-op this one */
 		case ATA_CMD_SET_FEATURES:
 			return ata_sff_qc_issue(qc);
@@ -509,7 +511,7 @@ static void it821x_dev_config(struct ata_device *adev)
 
 	if (strstr(model_num, "Integrated Technology Express")) {
 		/* RAID mode */
-		printk(KERN_INFO "IT821x %sRAID%d volume",
+		ata_dev_printk(adev, KERN_INFO, "%sRAID%d volume",
 			adev->id[147]?"Bootable ":"",
 			adev->id[129]);
 		if (adev->id[129] != 1)
@@ -519,37 +521,51 @@ static void it821x_dev_config(struct ata_device *adev)
 	/* This is a controller firmware triggered funny, don't
 	   report the drive faulty! */
 	adev->horkage &= ~ATA_HORKAGE_DIAGNOSTIC;
+	/* No HPA in 'smart' mode */
+	adev->horkage |= ATA_HORKAGE_BROKEN_HPA;
 }
 
 /**
- *	it821x_ident_hack	-	Hack identify data up
- *	@ap: Port
+ *	it821x_read_id	-	Hack identify data up
+ *	@adev: device to read
+ *	@tf: proposed taskfile
+ *	@id: buffer for returned ident data
  *
- *	Walk the devices on this firmware driven port and slightly
+ *	Query the devices on this firmware driven port and slightly
  *	mash the identify data to stop us and common tools trying to
  *	use features not firmware supported. The firmware itself does
  *	some masking (eg SMART) but not enough.
- *
- *	This is a bit of an abuse of the cable method, but it is the
- *	only method called at the right time. We could modify the libata
- *	core specifically for ident hacking but while we have one offender
- *	it seems better to keep the fallout localised.
  */
 
-static int it821x_ident_hack(struct ata_port *ap)
+static unsigned int it821x_read_id(struct ata_device *adev,
+					struct ata_taskfile *tf, u16 *id)
 {
-	struct ata_device *adev;
-	ata_link_for_each_dev(adev, &ap->link) {
-		if (ata_dev_enabled(adev)) {
-			adev->id[84] &= ~(1 << 6);	/* No FUA */
-			adev->id[85] &= ~(1 << 10);	/* No HPA */
-			adev->id[76] = 0;		/* No NCQ/AN etc */
-		}
+	unsigned int err_mask;
+	unsigned char model_num[ATA_ID_PROD_LEN + 1];
+	
+	err_mask = ata_do_dev_read_id(adev, tf, id);
+	if (err_mask)
+		return err_mask;
+	ata_id_c_string(id, model_num, ATA_ID_PROD, sizeof(model_num));
+
+	id[83] &= ~(1 << 12);	/* Cache flush is firmware handled */
+	id[83] &= ~(1 << 13);	/* Ditto for LBA48 flushes */
+	id[84] &= ~(1 << 6);	/* No FUA */
+	id[85] &= ~(1 << 10);	/* No HPA */
+	id[76] = 0;		/* No NCQ/AN etc */
+
+	if (strstr(model_num, "Integrated Technology Express")) {
+		/* Set feature bits the firmware neglects */
+		id[49] |= 0x0300;	/* LBA, DMA */
+		id[82] |= 0x0400;	/* LBA48 */
+		id[83] &= 0x7FFF;
+		id[83] |= 0x4000;	/* Word 83 is valid */
+		id[86] |= 0x0400;	/* LBA48 on */
+		id[ATA_ID_MAJOR_VER] |= 0x1F;
 	}
-	return ata_cable_unknown(ap);
+	return err_mask;
 }
 
-
 /**
  *	it821x_check_atapi_dma	-	ATAPI DMA handler
  *	@qc: Command we are about to issue
@@ -577,6 +593,136 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
 	return 0;
 }
 
+/**
+ *	it821x_display_disk	-	display disk setup
+ *	@n: Device number
+ *	@buf: Buffer block from firmware
+ *
+ *	Produce a nice informative display of the device setup as provided
+ *	by the firmware.
+ */
+
+static void it821x_display_disk(int n, u8 *buf)
+{
+	unsigned char id[41];
+	int mode = 0;
+	char *mtype;
+	char mbuf[8];
+	char *cbl = "(40 wire cable)";
+
+	static const char *types[5] = {
+		"RAID0", "RAID1" "RAID 0+1", "JBOD", "DISK"
+	};
+
+	if (buf[52] > 4)	/* No Disk */
+		return;
+
+	ata_id_c_string((u16 *)buf, id, 0, 41); 
+
+	if (buf[51]) {
+		mode = ffs(buf[51]);
+		mtype = "UDMA";
+	} else if (buf[49]) {
+		mode = ffs(buf[49]);
+		mtype = "MWDMA";
+	}
+
+	if (buf[76])
+		cbl = "";
+
+	if (mode)
+		snprintf(mbuf, 8, "%5s%d", mtype, mode - 1);
+	else
+		strcpy(mbuf, "PIO");
+	if (buf[52] == 4)
+		printk(KERN_INFO "%d: %-6s %-8s          %s %s\n",
+				n, mbuf, types[buf[52]], id, cbl);
+	else
+		printk(KERN_INFO "%d: %-6s %-8s Volume: %1d %s %s\n",
+				n, mbuf, types[buf[52]], buf[53], id, cbl);
+	if (buf[125] < 100)
+		printk(KERN_INFO "%d: Rebuilding: %d%%\n", n, buf[125]);
+}
+
+/**
+ *	it821x_firmware_command		-	issue firmware command
+ *	@ap: IT821x port to interrogate
+ *	@cmd: command
+ *	@len: length
+ *
+ *	Issue firmware commands expecting data back from the controller. We
+ *	use this to issue commands that do not go via the normal paths. Other
+ *	commands such as 0xFC can be issued normally.
+ */
+
+static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
+{
+	u8 status;
+	int n = 0;
+	u16 *buf = kmalloc(len, GFP_KERNEL);
+	if (buf == NULL) {
+		printk(KERN_ERR "it821x_firmware_command: Out of memory\n");
+		return NULL;
+	}
+	/* This isn't quite a normal ATA command as we are talking to the
+	   firmware not the drives */
+	ap->ctl |= ATA_NIEN;
+	iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
+	ata_wait_idle(ap);
+	iowrite8(ATA_DEVICE_OBS, ap->ioaddr.device_addr);
+	iowrite8(0xFA, ap->ioaddr.command_addr);
+	udelay(1);
+	/* This should be almost immediate but a little paranoia goes a long
+	   way. */
+	while(n++ < 10) {
+		status = ioread8(ap->ioaddr.status_addr);
+		if (status & ATA_ERR) {
+			kfree(buf);
+			printk(KERN_ERR "it821x_firmware_command: rejected\n");
+			return NULL;
+		}
+		if (status & ATA_DRQ) {
+			ioread16_rep(ap->ioaddr.data_addr, buf, len/2);
+			return (u8 *)buf;
+		}
+		mdelay(1);
+	}
+	kfree(buf);
+	printk(KERN_ERR "it821x_firmware_command: timeout\n");
+	return NULL;
+}
+
+/**
+ *	it821x_probe_firmware	-	firmware reporting/setup
+ *	@ap: IT821x port being probed
+ *
+ *	Probe the firmware of the controller by issuing firmware command
+ *	0xFA and analysing the returned data.
+ */
+
+static void it821x_probe_firmware(struct ata_port *ap)
+{
+	u8 *buf;
+	int i;
+
+	/* This is a bit ugly as we can't just issue a task file to a device
+	   as this is controller magic */
+
+	buf = it821x_firmware_command(ap, 0xFA, 512);
+	
+	if (buf != NULL) {
+		printk(KERN_INFO "pata_it821x: Firmware %02X/%02X/%02X%02X\n",
+				buf[505],
+				buf[506],
+				buf[507],
+				buf[508]);
+		for (i = 0; i < 4; i++)
+ 			it821x_display_disk(i, buf + 128 * i);
+		kfree(buf);
+	}
+}
+
+
 
 /**
  *	it821x_port_start	-	port setup
@@ -610,6 +756,8 @@ static int it821x_port_start(struct ata_port *ap)
 		/* Long I/O's although allowed in LBA48 space cause the
 		   onboard firmware to enter the twighlight zone */
 		/* No ATAPI DMA in this mode either */
+		if (ap->port_no == 0)
+			it821x_probe_firmware(ap);
 	}
 	/* Pull the current clocks from 0x50 */
 	if (conf & (1 << (1 + ap->port_no)))
@@ -631,6 +779,25 @@ static int it821x_port_start(struct ata_port *ap)
 	return 0;
 }
 
+/**
+ *	it821x_rdc_cable	-	Cable detect for RDC1010
+ *	@ap: port we are checking
+ *
+ *	Return the RDC1010 cable type. Unlike the IT821x we know how to do
+ *	this and can do host side cable detect
+ */
+
+static int it821x_rdc_cable(struct ata_port *ap)
+{
+	u16 r40;
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+
+	pci_read_config_word(pdev, 0x40, &r40);
+	if (r40 & (1 << (2 + ap->port_no)))
+		return ATA_CBL_PATA40;
+	return ATA_CBL_PATA80;
+}
+
 static struct scsi_host_template it821x_sht = {
 	ATA_BMDMA_SHT(DRV_NAME),
 };
@@ -641,9 +808,10 @@ static struct ata_port_operations it821x_smart_port_ops = {
 	.check_atapi_dma= it821x_check_atapi_dma,
 	.qc_issue	= it821x_smart_qc_issue,
 
-	.cable_detect	= it821x_ident_hack,
+	.cable_detect	= ata_cable_80wire,
 	.set_mode	= it821x_smart_set_mode,
 	.dev_config	= it821x_dev_config,
+	.read_id	= it821x_read_id,
 
 	.port_start	= it821x_port_start,
 };
@@ -664,8 +832,29 @@ static struct ata_port_operations it821x_passthru_port_ops = {
 	.port_start	= it821x_port_start,
 };
 
+static struct ata_port_operations it821x_rdc_port_ops = {
+	.inherits	= &ata_bmdma_port_ops,
+
+	.check_atapi_dma= it821x_check_atapi_dma,
+	.sff_dev_select	= it821x_passthru_dev_select,
+	.bmdma_start 	= it821x_passthru_bmdma_start,
+	.bmdma_stop	= it821x_passthru_bmdma_stop,
+	.qc_issue	= it821x_passthru_qc_issue,
+
+	.cable_detect	= it821x_rdc_cable,
+	.set_piomode	= it821x_passthru_set_piomode,
+	.set_dmamode	= it821x_passthru_set_dmamode,
+
+	.port_start	= it821x_port_start,
+};
+
 static void it821x_disable_raid(struct pci_dev *pdev)
 {
+	/* Neither the RDC nor the IT8211 */
+	if (pdev->vendor != PCI_VENDOR_ID_ITE ||
+			pdev->device != PCI_DEVICE_ID_ITE_8212)
+			return;
+
 	/* Reset local CPU, and set BIOS not ready */
 	pci_write_config_byte(pdev, 0x5E, 0x01);
 
@@ -690,6 +879,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		.flags = ATA_FLAG_SLAVE_POSS,
 		.pio_mask = 0x1f,
 		.mwdma_mask = 0x07,
+		.udma_mask = ATA_UDMA6,
 		.port_ops = &it821x_smart_port_ops
 	};
 	static const struct ata_port_info info_passthru = {
@@ -699,6 +889,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		.udma_mask = ATA_UDMA6,
 		.port_ops = &it821x_passthru_port_ops
 	};
+	static const struct ata_port_info info_rdc = {
+		.flags = ATA_FLAG_SLAVE_POSS,
+		.pio_mask = 0x1f,
+		.mwdma_mask = 0x07,
+		/* No UDMA */
+		.port_ops = &it821x_rdc_port_ops
+	};
 
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	static char *mode[2] = { "pass through", "smart" };
@@ -707,21 +904,25 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	rc = pcim_enable_device(pdev);
 	if (rc)
 		return rc;
+		
+	if (pdev->vendor == PCI_VENDOR_ID_RDC) {
+		ppi[0] = &info_rdc;
+	} else {
+		/* Force the card into bypass mode if so requested */
+		if (it8212_noraid) {
+			printk(KERN_INFO DRV_NAME ": forcing bypass mode.\n");
+			it821x_disable_raid(pdev);
+		}
+		pci_read_config_byte(pdev, 0x50, &conf);
+		conf &= 1;
 
-	/* Force the card into bypass mode if so requested */
-	if (it8212_noraid) {
-		printk(KERN_INFO DRV_NAME ": forcing bypass mode.\n");
-		it821x_disable_raid(pdev);
+		printk(KERN_INFO DRV_NAME": controller in %s mode.\n",
+								mode[conf]);
+		if (conf == 0)
+			ppi[0] = &info_passthru;
+		else
+			ppi[0] = &info_smart;
 	}
-	pci_read_config_byte(pdev, 0x50, &conf);
-	conf &= 1;
-
-	printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]);
-	if (conf == 0)
-		ppi[0] = &info_passthru;
-	else
-		ppi[0] = &info_smart;
-
 	return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL);
 }
 
@@ -745,6 +946,7 @@ static int it821x_reinit_one(struct pci_dev *pdev)
 static const struct pci_device_id it821x[] = {
 	{ PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), },
 	{ PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), },
+	{ PCI_VDEVICE(RDC, 0x1010), },
 
 	{ },
 };
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5b247b8..6820d6b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -750,6 +750,7 @@ struct ata_port_operations {
 	void (*set_piomode)(struct ata_port *ap, struct ata_device *dev);
 	void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev);
 	int  (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev);
+	unsigned int (*read_id)(struct ata_device *dev, struct ata_taskfile *tf, u16 *id);
 
 	void (*dev_config)(struct ata_device *dev);
 
@@ -951,6 +952,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
 			  unsigned int ofs, unsigned int len);
 extern void ata_id_c_string(const u16 *id, unsigned char *s,
 			    unsigned int ofs, unsigned int len);
+extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
+					struct ata_taskfile *tf, u16 *id);
 extern void ata_qc_complete(struct ata_queued_cmd *qc);
 extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
 extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: Peter Wells <hidden>
Date: 2008-08-12 13:09:46

Hi Guys,

Thanks for your help,

I shall try 2.6.27-rc2 tonight.

Kind regards,

Pete

2008/8/12 Bartlomiej Zolnierkiewicz [off-list ref]:
On Tue, Aug 12, 2008 at 1:57 PM, Alan Cox [off-list ref] wrote:
quoted
quoted
The post is located at http://kerneltrap.org/node/16482 and looks like this:

IT8212 driver seems to be broken - no DMA or functionality in general
I sent Jeff a set of fixes for this for the libata driver. Some changes
in libata broke some tricks the pata_it821x driver did. I've rewritten
those bits and parts of the core libata to sort that out and my IT821x
RAID card is back to health with libata. Hopefully .27 will behave
somewhat better therefore.

No idea about the old IDE driver. I don't think anyone maintains that one
any more but it certainly used to work.
It should still work.  Peter, please try with 2.6.27-rc2 (2.6.26 needs
a fix which is queued for the next -stable release).

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: Peter Wells <hidden>
Date: 2008-08-18 17:51:19

Hi Guys,

Thanks for your help,

The RAID array is back up and running now.  The device seems to take a
little while to be recognised and there are still; some error messages
in dmesg but it's working none the less.

I've included the output of dmesg below in case it's useful.
Hopefully it's the relevant chunk.

Thanks again,

Kind regards,

Pete


Uniform Multi-Platform E-IDE driver
alim15x3 0000:00:0f.0: IDE controller (0x10b9:0x5229 rev 0xc2)
ALI15x3_IDE 0000:00:0f.0: can't derive routing for PCI INT A
alim15x3 0000:00:0f.0: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0xf000-0xf007
    ide1: BM-DMA at 0xf008-0xf00f
Probing IDE interface ide0...
hda: ST320410A, ATA DISK drive
hda: host max PIO5 wanted PIO255(auto-tune) selected PIO4
hda: host side 80-wire cable detection failed, limiting max speed to UDMA33
hda: UDMA/33 mode selected
Probing IDE interface ide1...
hdc: SAMSUNG SP1604N, ATA DISK drive
hdd: WDC WD1200BB-00CAA1, ATA DISK drive
hdc: host max PIO5 wanted PIO255(auto-tune) selected PIO4
hdc: UDMA/66 mode selected
hdd: host max PIO5 wanted PIO255(auto-tune) selected PIO4
hdd: UDMA/66 mode selected
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 128KiB
hda: 39102336 sectors (20020 MB) w/2048KiB Cache, CHS=38792/16/63
hda: cache flushes not supported
 hda: hda1 hda2 hda3
hdc: max request size: 128KiB
hdc: cannot use LBA48 DMA - PIO mode will be used for accessing sectors > 26843
456
hdc: 312581808 sectors (160041 MB) w/2048KiB Cache, CHS=19457/255/63
hdc: cache flushes supported
 hdc: hdc1
hdd: max request size: 128KiB
hdd: 234441648 sectors (120034 MB) w/2048KiB Cache, CHS=65535/16/63
hdd: cache flushes not supported
 hdd: hdd1
Driver 'sd' needs updating - please use bus_type methods
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10
PCI: setting IRQ 10 as level-triggered
pata_it821x 0000:00:09.0: PCI INT A -> Link[LNKB] -> GSI 10 (level, low) -> IRQ
10
pata_it821x: controller in smart mode.
pata_it821x 0000:00:09.0: setting latency timer to 64
pata_it821x: Firmware 02/09/3030
0: MWDMA2 RAID1RAID 0+1 Volume: 0 WDC WD600BB-00CAA1
1: MWDMA2 RAID1RAID 0+1 Volume: 0 WDC WD600AB-60BVA0
scsi0 : pata_it821x
scsi1 : pata_it821x
ata1: PATA max UDMA/133 cmd 0xd400 ctl 0xd800 bmdma 0xe400 irq 10
ata2: PATA max UDMA/133 cmd 0xdc00 ctl 0xe000 bmdma 0xe408 irq 10
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1: SRST failed (errno=-16)
ata1: link is slow to respond, please be patient (ready=0)
ata1.00: ATA-4: Integrated Technology Express Inc, , max MWDMA2
ata1.00: 117231406 sectors, multi 0: LBA
ata1.00: RAID1 volume.
ata1.00: configured for DMA
scsi 0:0:0:0: Direct-Access     ATA      Integrated Techn n/a  PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 117231406 512-byte hardware sectors (60022 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support D
O or FUA
sd 0:0:0:0: [sda] 117231406 512-byte hardware sectors (60022 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support D
O or FUA
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI disk



2008/8/12 Peter Wells [off-list ref]:
Hi Guys,

Thanks for your help,

I shall try 2.6.27-rc2 tonight.

Kind regards,

Pete

2008/8/12 Bartlomiej Zolnierkiewicz [off-list ref]:
quoted
On Tue, Aug 12, 2008 at 1:57 PM, Alan Cox [off-list ref] wrote:
quoted
quoted
The post is located at http://kerneltrap.org/node/16482 and looks like this:

IT8212 driver seems to be broken - no DMA or functionality in general
I sent Jeff a set of fixes for this for the libata driver. Some changes
in libata broke some tricks the pata_it821x driver did. I've rewritten
those bits and parts of the core libata to sort that out and my IT821x
RAID card is back to health with libata. Hopefully .27 will behave
somewhat better therefore.

No idea about the old IDE driver. I don't think anyone maintains that one
any more but it certainly used to work.
It should still work.  Peter, please try with 2.6.27-rc2 (2.6.26 needs
a fix which is queued for the next -stable release).

Re: IT8212 driver seems to be broken - no DMA or functionality in general

From: Alan Cox <hidden>
Date: 2008-08-18 18:29:23

On Mon, 18 Aug 2008 18:51:18 +0100
"Peter Wells" [off-list ref] wrote:
Hi Guys,

Thanks for your help,

The RAID array is back up and running now.  The device seems to take a
little while to be recognised and there are still; some error messages
in dmesg but it's working none the less.
Yeah the raid mode doesn't quite properly emulate ATA so causes the odd
diagnostic during probe. I need to look into that more as we now pull the
list of really present devices from the firmware.
I've included the output of dmesg below in case it's useful.
Hopefully it's the relevant chunk.
Thanks.

Alan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help