Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 2009 05:25:36 +0500
From:      bas <bas@it-core.org>
To:        freebsd-i386@freebsd.org
Subject:   Re: i386/139743: [ichsmb] [patch] ichsmb driver doesn't detects SMB bus on Asus P4B533/P4PE motherboards
Message-ID:  <c37fcc4b0912021625o68d0513el5b898e7d166cf973@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
What about this pr? Will this patch merged?
Version for 8.0-RELEASE goes in attach.

[-- Attachment #2 --]
--- /usr/src/sys/dev/pci/pci.c.orig	2009-10-25 06:10:29.000000000 +0500
+++ /usr/src/sys/dev/pci/pci.c	2009-11-16 00:24:29.000000000 +0500
@@ -113,6 +113,9 @@
 static void		pci_resume_msi(device_t dev);
 static void		pci_resume_msix(device_t dev);
 
+static void		pci_fix_asus_smbus(device_t dev);
+
+
 static device_method_t pci_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		pci_probe),
@@ -180,16 +183,22 @@
 	int	type;
 #define	PCI_QUIRK_MAP_REG	1 /* PCI map register in weird place */
 #define	PCI_QUIRK_DISABLE_MSI	2 /* MSI/MSI-X doesn't work */
+#define PCI_QUIRK_FIXUP_ROUTINE	4 /* PCI needs a fix to continue */
 	int	arg1;
 	int	arg2;
+	void (*fixup_func)(device_t dev);
 };
 
 struct pci_quirk pci_quirks[] = {
 	/* The Intel 82371AB and 82443MX has a map register at offset 0x90. */
-	{ 0x71138086, PCI_QUIRK_MAP_REG,	0x90,	 0 },
-	{ 0x719b8086, PCI_QUIRK_MAP_REG,	0x90,	 0 },
+	{ 0x71138086, PCI_QUIRK_MAP_REG,	0x90,	 0, NULL },
+	{ 0x719b8086, PCI_QUIRK_MAP_REG,	0x90,	 0, NULL },
 	/* As does the Serverworks OSB4 (the SMBus mapping register) */
-	{ 0x02001166, PCI_QUIRK_MAP_REG,	0x90,	 0 },
+	{ 0x02001166, PCI_QUIRK_MAP_REG,	0x90,	 0, NULL },
+
+	/* The ASUS P4B-motherboards needs a hack to enable the Intel 801SMBus */
+	{ 0x24408086, PCI_QUIRK_FIXUP_ROUTINE,  0,      0, &pci_fix_asus_smbus },
+	{ 0x24C08086, PCI_QUIRK_FIXUP_ROUTINE,	0,	0, &pci_fix_asus_smbus },
 
 	/*
 	 * MSI doesn't work with the ServerWorks CNB20-HE Host Bridge
@@ -410,6 +419,26 @@
 		cfg->hdrtype = 1;
 }
 
+/* asus p4b/p4pe hack */
+static void
+pci_fix_asus_smbus(device_t dev)
+{
+        int     pmccfg;
+        
+        /* read subsystem vendor-id */
+        pmccfg = pci_read_config(dev, 0xF2, 2);
+        printf(" [-] pmccfg: %.4x\n",pmccfg);
+        if( pmccfg & 0x8 ){
+            pmccfg &= ~0x8;
+            pci_write_config(dev, 0xF2, pmccfg, 2);
+            pmccfg = pci_read_config(dev, 0xF2, 2);
+            if( pmccfg & 0x8 )
+                printf("Could not enable Intel 801SMBus!\n");
+            else
+                printf("Enabled Intel 801SMBus\n");
+        }
+}
+
 /* extract header type specific config data */
 
 static void
@@ -2594,9 +2623,12 @@
 	 * Add additional, quirked resources.
 	 */
 	for (q = &pci_quirks[0]; q->devid; q++) {
-		if (q->devid == ((cfg->device << 16) | cfg->vendor)
-		    && q->type == PCI_QUIRK_MAP_REG)
+		if (q->devid == ((cfg->device << 16) | cfg->vendor) ){
+		if( q->type == PCI_QUIRK_MAP_REG )
 			pci_add_map(bus, dev, q->arg1, rl, force, 0);
+		else if( q->type == PCI_QUIRK_FIXUP_ROUTINE )
+		    q->fixup_func(dev);
+	        }
 	}
 
 	if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) {

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c37fcc4b0912021625o68d0513el5b898e7d166cf973>