Posts: 54
SaminBare
Joined: 30 May 2010
#1
Hoping to use SATA hard drives in old PCs, I purchased a couple VIA VT6492 RAID bus controllers
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://www.monoprice.com/products/product.asp?c_id=104&cp_id=10407&cs_id=1040702&p_id=2664&seq=1&format=1#largeimage"
linktext was:"http://www.monoprice.com/products/produ ... largeimage"
====================================
(see below) to use with identical Seagate 80 gigers I get from a source that upgrades PCs for those that can afford to pay for labor. The card fits into a PCI slot and contains two SATA and one IDE data outputs.

I was unable to get RAID up and running after putting an old AcerPower SP with Dell 250W PU machine together today. The separate BIOS of the"bootable add-in card" seems to raise havoc with config files and is not recognizable in the system BIOS, although SystemRescueCD recognizes the two connected SATA drives as /dev/sdb and /dev/sdc. Once, I got a"4941 Segmentation Fault error In Line 370 of etc/init.d/(some config file) from sysresccd
I need help getting this RAID setup going, if it is feasible to begin with, that is.
If not, is LVM possible with antiX?Image
Last edited by SaminBare on 08 Aug 2010, 16:28, edited 2 times in total.
Posts: 1,520
eriefisher
Joined: 07 Oct 2007
#2
I don't think antiX will stop you from using either raid or lvm but your hardware may. If the card is not seen by the bios on powerup then the OS may not see it either. Software raid may be another option although I have never tried to set up any of them. It is something I want to do for my server so I will watch this thread.
Posts: 54
SaminBare
Joined: 30 May 2010
#3
I did some googling and came to the conclusion that I got what I paid for with the mentioned PCI RAID controller -- a cheap card with problems, as witnessed in the following:
---------------------------------------------------------------------------
1)
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://linux.yyz.us/why-software-raid.html"
linktext was:"http://linux.yyz.us/why-software-raid.html"
====================================


* Some cards export hardware RAID capabilities, such as XOR or RAID1 offload, but allow full OS control of the operations in lieu of a firmware. Linux does not support this programming model well.
--------------------------------------------------------------------------
2)
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://bugzilla.kernel.org/show_bug.cgi?id=15173"
linktext was:"https://bugzilla.kernel.org/show_bug.cgi?id=15173"
====================================


Comment #9 From Tejun Heo 2010-02-17 00:20:07 -------

Thanks for testing it.

The failures you're seeing is between the host controller (the via chip) and
the hard drive. Both the controller and the hard drive are reporting that they
can't hear each other very well. Host side issues (between the controller and
the components on the mainboard) usually don't manifest as ATA bus issues.

I'm afraid there isn't much the driver can do with these failures. There could
be some PHY level knobs in the controller but given that this is the first
report of this type of issues with the controller, I'm much more inclined
toward faulty add-in board (ie. signal trace lengths not matched properly,
faulty connector kind of things). Can you try it on a different operating
system?

Thanks.
---------------------------------------------------------------------------
3)
---------------------------------------------------------------------------
###
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://bugzilla.kernel.org/attachment.cgi?id=26589&action=edit"
linktext was:"https://bugzilla.kernel.org/attachment. ... ction=edit"
====================================
###

drivers/ata/sata_via.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 101d8c2..0ecd0f6 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -575,6 +575,19 @@ static void svia_configure(struct pci_dev *pdev)
tmp8 |= NATIVE_MODE_ALL;
pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
}
+
+ /*
+ * vt6421 has problems talking to some drives. The following
+ * is the magic fix from Joseph Chan <JosephChan@via.com.tw>.
+ * Please add proper documentation if possible.
+ *
+ *
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://bugzilla.kernel.org/show_bug.cgi?id=15173"
linktext was:"https://bugzilla.kernel.org/show_bug.cgi?id=15173"
====================================

+ */
+ if (pdev->device == 0x3249) {
+ pci_read_config_byte(pdev, 0x52, &tmp8);
+ tmp8 |= 1 << 2;
+ pci_write_config_byte(pdev, 0x52, tmp8);
+ }
}

static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
---------------------------------------------------------------------------
---------------------------------------------------------------------------
4) Comment #20 From Jorrit Tijben 2010-06-04 06:49:05 -------

Hello,

Excuse me for the late response, but I can confirm the fix by Joseph Chan
works. hdparm -tT now gives around 50MB/s for buffered disk reads now and the
error messages are gone.

The performance is still a bit meager compared to the SB700 on-board
controller, but I don't know what the possible bottlenecks are.

A very big thanks to all for investigating and fixing this, it's *really*
appreaciated!

Jorrit Tijben
---------------------------------------------------------------------------
5)
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://www.dslreports.com/forum/r20174361-satavia-module-problem-multiple-distros"
linktext was:"http://www.dslreports.com/forum/r201743 ... le-distros"
====================================


evilghost
Premium
join:2003-11-22
Springville, AL

all_generic_ide at boot? CONFIG_BLK_DEV_IDEDISK disabled in the kernel also appears to work.
---------------------------------------------------------------------------
6) Search on"sata_via fix" =>


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://www.mail-archive.com/linux-ide@vger.kernel.org/msg03945.html"
linktext was:"http://www.mail-archive.com/linux-ide@v ... 03945.html"
====================================



========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://www.spinics.net/lists/stable-commits/msg07178.html"
linktext was:"http://www.spinics.net/lists/stable-com ... 07178.html"
====================================


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://www.spinics.net/lists/linux-ide/msg04388.html"
linktext was:"http://www.spinics.net/lists/linux-ide/msg04388.html"
====================================



========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://software.itags.org/linux-unix/132015/"
linktext was:"http://software.itags.org/linux-unix/132015/"
====================================



========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://old.nabble.com/-patch-0-2--sata_via:-bugfixes-for-vt6420-and-vt6421-td2719 4988.html"
linktext was:"http://old.nabble.com/-patch-0-2--sata_ ... 94988.html"
====================================

===========================================================================
7)
The following code was gleaned,too. However, I do not know what to do with it

Code: Select all

###http://www.linuxhq.com/kernel/v2.4/30/drivers/scsi/sata_via.c

diff -urN linux-2.4.29/drivers/scsi/sata_via.c linux-2.4.30/drivers/scsi/sata_via.c
--- linux-2.4.29/drivers/scsi/sata_via.c   2005-01-19 06:10:03.000000000 -0800
+++ linux-2.4.30/drivers/scsi/sata_via.c   2005-04-03 18:42:19.960155532 -0700
@@ -24,6 +24,11 @@
    If you do not delete the provisions above, a recipient may use your
    version of this file under either the OSL or the GPL.
 
+   ----------------------------------------------------------------------
+
+   To-do list:
+   * VT6421 PATA support
+
  */
 
 #include <linux/kernel.h>
@@ -38,11 +43,14 @@
 #include <asm/io.h>
 
 #define DRV_NAME  "sata_via"
-#define DRV_VERSION  "1.0"
+#define DRV_VERSION  "1.1"
 
-enum {
-   via_sata      = 0,
+enum board_ids_enum {
+   vt6420,
+   vt6421,
+};
 
+enum {
    SATA_CHAN_ENAB      = 0x40, /* SATA channel enable */
    SATA_INT_GATE      = 0x41, /* SATA interrupt gating */
    SATA_NATIVE_MODE   = 0x42, /* Native mode enable */
@@ -50,10 +58,8 @@
 
    PORT0         = (1 << 1),
    PORT1         = (1 << 0),
-
-   ENAB_ALL      = PORT0 | PORT1,
-
-   INT_GATE_ALL      = PORT0 | PORT1,
+   ALL_PORTS      = PORT0 | PORT1,
+   N_PORTS         = 2,
 
    NATIVE_MODE_ALL      = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4),
 
@@ -66,7 +72,8 @@
 static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 
 static struct pci_device_id svia_pci_tbl[] = {
-   { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, via_sata },
+   { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 },
+   { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 },
 
    { }   /* terminate list */
 };
@@ -111,6 +118,9 @@
 
    .bmdma_setup            = ata_bmdma_setup,
    .bmdma_start            = ata_bmdma_start,
+   .bmdma_stop      = ata_bmdma_stop,
+   .bmdma_status      = ata_bmdma_status,
+
    .qc_prep      = ata_qc_prep,
    .qc_issue      = ata_qc_issue_prot,
 
@@ -159,18 +169,132 @@
    8, 4, 8, 4, 16, 256
 };
 
+static const unsigned int vt6421_bar_sizes[] = {
+   16, 16, 16, 16, 32, 128
+};
+
 static unsigned long svia_scr_addr(unsigned long addr, unsigned int port)
 {
    return addr + (port * 128);
 }
 
+static unsigned long vt6421_scr_addr(unsigned long addr, unsigned int port)
+{
+   return addr + (port * 64);
+}
+
+static void vt6421_init_addrs(struct ata_probe_ent *probe_ent,
+               struct pci_dev *pdev,
+               unsigned int port)
+{
+   unsigned long reg_addr = pci_resource_start(pdev, port);
+   unsigned long bmdma_addr = pci_resource_start(pdev, 4) + (port * 8);
+   unsigned long scr_addr;
+
+   probe_ent->port[port].cmd_addr = reg_addr;
+   probe_ent->port[port].altstatus_addr =
+   probe_ent->port[port].ctl_addr = (reg_addr + 8) | ATA_PCI_CTL_OFS;
+   probe_ent->port[port].bmdma_addr = bmdma_addr;
+
+   scr_addr = vt6421_scr_addr(pci_resource_start(pdev, 5), port);
+   probe_ent->port[port].scr_addr = scr_addr;
+
+   ata_std_ports(&probe_ent->port[port]);
+}
+
+static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev)
+{
+   struct ata_probe_ent *probe_ent;
+   struct ata_port_info *ppi = &svia_port_info;
+
+   probe_ent = ata_pci_init_native_mode(pdev, &ppi);
+   if (!probe_ent)
+      return NULL;
+
+   probe_ent->port[0].scr_addr =
+      svia_scr_addr(pci_resource_start(pdev, 5), 0);
+   probe_ent->port[1].scr_addr =
+      svia_scr_addr(pci_resource_start(pdev, 5), 1);
+
+   return probe_ent;
+}
+
+static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev)
+{
+   struct ata_probe_ent *probe_ent;
+   unsigned int i;
+
+   probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL);
+   if (!probe_ent)
+      return NULL;
+
+   memset(probe_ent, 0, sizeof(*probe_ent));
+   probe_ent->dev = pci_dev_to_dev(pdev);
+   INIT_LIST_HEAD(&probe_ent->node);
+
+   probe_ent->sht      = &svia_sht;
+   probe_ent->host_flags   = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET |
+              ATA_FLAG_NO_LEGACY;
+   probe_ent->port_ops   = &svia_sata_ops;
+   probe_ent->n_ports   = N_PORTS;
+   probe_ent->irq      = pdev->irq;
+   probe_ent->irq_flags   = SA_SHIRQ;
+   probe_ent->pio_mask   = 0x1f;
+   probe_ent->mwdma_mask   = 0x07;
+   probe_ent->udma_mask   = 0x7f;
+
+   for (i = 0; i < N_PORTS; i++)
+      vt6421_init_addrs(probe_ent, pdev, i);
+
+   return probe_ent;
+}
+
+static void svia_configure(struct pci_dev *pdev)
+{
+   u8 tmp8;
+
+   pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8);
+   printk(KERN_INFO DRV_NAME"(%s): routed to hard irq line %d\n",
+          pci_name(pdev),
+          (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f);
+
+   /* make sure SATA channels are enabled */
+   pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8);
+   if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
+      printk(KERN_DEBUG DRV_NAME"(%s): enabling SATA channels (0x%x)\n",
+             pci_name(pdev), (int) tmp8);
+      tmp8 |= ALL_PORTS;
+      pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
+   }
+
+   /* make sure interrupts for each channel sent to us */
+   pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8);
+   if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
+      printk(KERN_DEBUG DRV_NAME"(%s): enabling SATA channel interrupts (0x%x)\n",
+             pci_name(pdev), (int) tmp8);
+      tmp8 |= ALL_PORTS;
+      pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
+   }
+
+   /* make sure native mode is enabled */
+   pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8);
+   if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
+      printk(KERN_DEBUG DRV_NAME"(%s): enabling SATA channel native mode (0x%x)\n",
+             pci_name(pdev), (int) tmp8);
+      tmp8 |= NATIVE_MODE_ALL;
+      pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
+   }
+}
+
 static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
    static int printed_version;
    unsigned int i;
    int rc;
-   struct ata_port_info *ppi;
    struct ata_probe_ent *probe_ent;
+   int board_id = (int) ent->driver_data;
+   const int *bar_sizes;
+   int pci_dev_busy = 0;
    u8 tmp8;
 
    if (!printed_version++)
@@ -181,20 +305,28 @@
       return rc;
 
    rc = pci_request_regions(pdev, DRV_NAME);
-   if (rc)
+   if (rc) {
+      pci_dev_busy = 1;
       goto err_out;
+   }
 
-   pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8);
-   if (tmp8 & SATA_2DEV) {
-      printk(KERN_ERR DRV_NAME"(%s): SATA master/slave not supported (0x%x)\n",
-             pci_name(pdev), (int) tmp8);
-      rc = -EIO;
-      goto err_out_regions;
+   if (board_id == vt6420) {
+      pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8);
+      if (tmp8 & SATA_2DEV) {
+         printk(KERN_ERR DRV_NAME"(%s): SATA master/slave not supported (0x%x)\n",
+                pci_name(pdev), (int) tmp8);
+         rc = -EIO;
+         goto err_out_regions;
+      }
+
+      bar_sizes = &svia_bar_sizes[0];
+   } else {
+      bar_sizes = &vt6421_bar_sizes[0];
    }
 
    for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++)
       if ((pci_resource_start(pdev, i) == 0) ||
-          (pci_resource_len(pdev, i) < svia_bar_sizes[i])) {
+          (pci_resource_len(pdev, i) < bar_sizes[i])) {
          printk(KERN_ERR DRV_NAME"(%s): invalid PCI BAR %u (sz 0x%lx, val 0x%lx)\n",
                 pci_name(pdev), i,
                 pci_resource_start(pdev, i),
@@ -207,8 +339,11 @@
    if (rc)
       goto err_out_regions;
 
-   ppi = &svia_port_info;
-   probe_ent = ata_pci_init_native_mode(pdev, &ppi);
+   if (board_id == vt6420)
+      probe_ent = vt6420_init_probe_ent(pdev);
+   else
+      probe_ent = vt6421_init_probe_ent(pdev);
+   
    if (!probe_ent) {
       printk(KERN_ERR DRV_NAME"(%s): out of memory\n",
              pci_name(pdev));
@@ -216,42 +351,7 @@
       goto err_out_regions;
    }
 
-   probe_ent->port[0].scr_addr =
-      svia_scr_addr(pci_resource_start(pdev, 5), 0);
-   probe_ent->port[1].scr_addr =
-      svia_scr_addr(pci_resource_start(pdev, 5), 1);
-
-   pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8);
-   printk(KERN_INFO DRV_NAME"(%s): routed to hard irq line %d\n",
-          pci_name(pdev),
-          (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f);
-
-   /* make sure SATA channels are enabled */
-   pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8);
-   if ((tmp8 & ENAB_ALL) != ENAB_ALL) {
-      printk(KERN_DEBUG DRV_NAME"(%s): enabling SATA channels (0x%x)\n",
-             pci_name(pdev), (int) tmp8);
-      tmp8 |= ENAB_ALL;
-      pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
-   }
-
-   /* make sure interrupts for each channel sent to us */
-   pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8);
-   if ((tmp8 & INT_GATE_ALL) != INT_GATE_ALL) {
-      printk(KERN_DEBUG DRV_NAME"(%s): enabling SATA channel interrupts (0x%x)\n",
-             pci_name(pdev), (int) tmp8);
-      tmp8 |= INT_GATE_ALL;
-      pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
-   }
-
-   /* make sure native mode is enabled */
-   pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8);
-   if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
-      printk(KERN_DEBUG DRV_NAME"(%s): enabling SATA channel native mode (0x%x)\n",
-             pci_name(pdev), (int) tmp8);
-      tmp8 |= NATIVE_MODE_ALL;
-      pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
-   }
+   svia_configure(pdev);
 
    pci_set_master(pdev);
 
@@ -262,7 +362,8 @@
 err_out_regions:
    pci_release_regions(pdev);
 err_out:
-   pci_disable_device(pdev);
+   if (!pci_dev_busy)
+      pci_disable_device(pdev);
    return rc;
 }
Posts: 54
SaminBare
Joined: 30 May 2010
#4
FYI eriefisher and iother interested parties --

From what I gather, preferred RAID drivers over the sata_via in the PCI card in question are:

Driver
Manufacturer Model

sata_sil24
Sicicon Image Sil 3124, Sil 3132, Sil 3531

ahci
Intel ICH6-10, ESB2, Tolopai
VIA VT8251
Marvel 6121, 6145
SiS 966,968
AMD SB600/700/800
JMicron 360, 361, 363, 365, 366
ULi M 5288
nVidea MCP65, 67, 73, 77, 79, 7B