Subject: port-i386/30795: Adding IDE and SATA support for ICH7 (Intel 82801G) chipset
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <marcello.balduccini@ttu.edu>
List: netbsd-bugs
Date: 07/20/2005 20:22:01
>Number:         30795
>Category:       port-i386
>Synopsis:       Patch adds IDE/SATA support for ICH7 (Intel 82801G) chipset
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 20 20:22:00 +0000 2005
>Originator:     Marcello Balduccini
>Release:        NetBSD 3.99.7 as of 2005-07-20
>Organization:
Computer Science Department
                Texas Tech University
>Environment:
System: NetBSD krlab.cs.ttu.edu 3.99.7 NetBSD 3.99.7 (KRLAB-XEN0) #0: Tue Jul 19 21:05:23 CDT 2005 marcy@tino.xen:/usr/obj/sys/arch/i386/compile/KRLAB-XEN0 i386
Architecture: i386
Machine: i386
>Description:
As of today, the IDE and SATA controllers of the ICH7 (Intel 82801G)
chipset are not supported by NetBSD/i386. However, because of the
compatibility of ICH7 with ICH6 & predecessors, all is needed to
support them is adding the proper entries to src/sys/dev/pci/piixide.c.

>How-To-Repeat:
Run NetBSD/i386 on a motherboard with ICH7 and check the dmesg output.

>Fix:
The following patch has been prepared from NetBSD -current 3.99.7 as of
2005-07-20. Just patch piixide.c with:

--- piixide.c.orig	2005-07-19 19:11:45.000000000 -0500
+++ piixide.c	2005-07-19 19:17:42.000000000 -0500
@@ -169,6 +169,16 @@
 	  "Intel 82801FBM Serial ATA Controller (ICH6)",
 	  piixsata_chip_map,
 	},
+	{ PCI_PRODUCT_INTEL_82801G_IDE,
+	  0,
+	  "Intel 82801GB/GR IDE Controller (ICH7)",
+	  piix_chip_map,
+	},
+	{ PCI_PRODUCT_INTEL_82801G_SATA,
+	  0,
+	  "Intel 82801GB/GR Serial ATA/Raid Controller (ICH7)",
+	  piixsata_chip_map,
+	},
 	{ 0,
 	  0,
 	  NULL,
@@ -262,6 +272,7 @@
 		case PCI_PRODUCT_INTEL_82801EB_IDE:
 		case PCI_PRODUCT_INTEL_6300ESB_IDE:
 		case PCI_PRODUCT_INTEL_82801FB_IDE:
+		case PCI_PRODUCT_INTEL_82801G_IDE:
 			sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA;
 		}
 	}
@@ -280,6 +291,7 @@
 	case PCI_PRODUCT_INTEL_82801EB_IDE:
 	case PCI_PRODUCT_INTEL_6300ESB_IDE:
 	case PCI_PRODUCT_INTEL_82801FB_IDE:
+	case PCI_PRODUCT_INTEL_82801G_IDE:
 		sc->sc_wdcdev.sc_atac.atac_udma_cap = 5;
 		break;
 	default:
@@ -314,7 +326,8 @@
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801DBM_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801EB_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801FB_IDE ||
-		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE) {
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE ||
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801G_IDE) {
 			ATADEBUG_PRINT((", IDE_CONTROL 0x%x",
 			    pci_conf_read(sc->sc_pc, sc->sc_tag, PIIX_CONFIG)),
 			    DEBUG_PROBE);
@@ -378,7 +391,8 @@
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801DBM_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801EB_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801FB_IDE ||
-		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE) {
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE ||
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801G_IDE) {
 			ATADEBUG_PRINT((", IDE_CONTROL 0x%x",
 			    pci_conf_read(sc->sc_pc, sc->sc_tag, PIIX_CONFIG)),
 			    DEBUG_PROBE);
@@ -540,7 +554,8 @@
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801DBM_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801EB_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801FB_IDE ||
-		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE) {
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE ||
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801G_IDE) {
 			ideconf |= PIIX_CONFIG_PINGPONG;
 		}
 		if (sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801BA_IDE ||
@@ -551,7 +566,8 @@
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801DBM_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801EB_IDE ||
 		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801FB_IDE ||
-		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE) {
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_6300ESB_IDE ||
+		    sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_82801G_IDE) {
 			/* setup Ultra/100 */
 			if (drvp->UDMA_mode > 2 &&
 			    (ideconf & PIIX_CONFIG_CR(channel, drive)) == 0)