Re: sata_sis only recognizing primary drive in 2.6.18

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

here is the patch for slave support. No fixes for the second port handling are included.

regards
Uwe

> 
> It might be sufficient to just add ATA_FLAG_SLAVE_POSS for all 
> controllers but in general we don't want to sprinkle that flag over 
> controllers which don't actually support slave device - sometimes for 
> safety and also for documentation purpose.  So, please make a separate 
> port_info and add ATA_FLAG_SLAVE_POSS only to controllers which actually 
> support slave devices.

--- a/drivers/ata/sata_sis.c	2006-10-18 23:15:59.000000000 +0200
+++ b/drivers/ata/sata_sis.c	2006-10-23 10:16:09.000000000 +0200
@@ -126,13 +126,26 @@
 	.host_stop		= ata_host_stop,
 };
 
-static struct ata_port_info sis_port_info = {
-	.sht		= &sis_sht,
-	.flags		= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
-	.pio_mask	= 0x1f,
-	.mwdma_mask	= 0x7,
-	.udma_mask	= 0x7f,
-	.port_ops	= &sis_ops,
+static struct ata_port_info sis_port_info[] = {
+	/* 2 ports, SiS964, SiS965L, SiS966L */
+	{
+		.sht		= &sis_sht,
+		.flags		= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
+		.pio_mask	= 0x1f,
+		.mwdma_mask	= 0x7,
+		.udma_mask	= 0x7f,
+		.port_ops	= &sis_ops,
+	},
+	/* 4 ports, SiS180, SiS965, SiS966 */
+	{
+		.sht		= &sis_sht,
+		.flags		= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+				  ATA_FLAG_SLAVE_POSS,
+		.pio_mask	= 0x1f,
+		.mwdma_mask	= 0x7,
+		.udma_mask	= 0x7f,
+		.port_ops	= &sis_ops,
+	}
 };
 
 
@@ -244,6 +257,8 @@
 	int pci_dev_busy = 0;
 	u8 pmr;
 	u8 port2_start;
+	int slave_poss = 0;
+	u32 chipid;
 
 	if (!printed_version++)
 		dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
@@ -265,7 +280,38 @@
 	if (rc)
 		goto err_out_regions;
 
-	ppi[0] = ppi[1] = &sis_port_info;
+	switch (ent->device) {
+	case 0x0180:
+	case 0x0181:	/* SiS180/181/964 */
+		pci_read_config_byte(pdev, SIS_PMR, &pmr);
+		if ((pmr & SIS_PMR_COMBINED) == 0) {
+			dev_printk(KERN_INFO, &pdev->dev,
+				   "Detected SiS 180/181/964 chipset in SATA mode\n");
+			port2_start = 64;
+		}
+		else {
+			dev_printk(KERN_INFO, &pdev->dev,
+				   "Detected SiS 180/181 chipset in combined mode\n");
+			port2_start = 0;
+			slave_poss = 1;
+		}
+		break;
+	case 0x182:		/* SiS965/965L */
+		pci_read_config_dword ( pdev, 0x6C, &chipid);
+		if (chipid & (1L << 31)) {
+			dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182/965 chipset\n");
+			slave_poss = 1;
+		}
+		else {
+			dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182/965L chipset\n");
+		}
+		port2_start = 0x20;
+		break;
+	}
+	ppi[0] = ppi[1] = &sis_port_info[0];
+	if (slave_poss) {
+		ppi[0] = ppi[1] = &sis_port_info[1];
+	}
 	probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
 	if (!probe_ent) {
 		rc = -ENOMEM;
@@ -288,24 +334,6 @@
 		probe_ent->port_flags |= SIS_FLAG_CFGSCR;
 	}
 
-	pci_read_config_byte(pdev, SIS_PMR, &pmr);
-	if (ent->device != 0x182) {
-		if ((pmr & SIS_PMR_COMBINED) == 0) {
-			dev_printk(KERN_INFO, &pdev->dev,
-				   "Detected SiS 180/181 chipset in SATA mode\n");
-			port2_start = 64;
-		}
-		else {
-			dev_printk(KERN_INFO, &pdev->dev,
-				   "Detected SiS 180/181 chipset in combined mode\n");
-			port2_start=0;
-		}
-	}
-	else {
-		dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182 chipset\n");
-		port2_start = 0x20;
-	}
-
 	if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) {
 		probe_ent->port[0].scr_addr =
 			pci_resource_start(pdev, SIS_SCR_PCI_BAR);


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux