From owner-freebsd-i386@FreeBSD.ORG Mon Oct 19 05:00:17 2009 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51F811065670 for ; Mon, 19 Oct 2009 05:00:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id ED4028FC17 for ; Mon, 19 Oct 2009 05:00:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9J50ATo007810 for ; Mon, 19 Oct 2009 05:00:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9J50AIH007804; Mon, 19 Oct 2009 05:00:10 GMT (envelope-from gnats) Resent-Date: Mon, 19 Oct 2009 05:00:10 GMT Resent-Message-Id: <200910190500.n9J50AIH007804@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE53F1065672 for ; Mon, 19 Oct 2009 04:56:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id DC6038FC17 for ; Mon, 19 Oct 2009 04:56:45 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9J4ujvW078520 for ; Mon, 19 Oct 2009 04:56:45 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n9J4ujqt078519; Mon, 19 Oct 2009 04:56:45 GMT (envelope-from nobody) Message-Id: <200910190456.n9J4ujqt078519@www.freebsd.org> Date: Mon, 19 Oct 2009 04:56:45 GMT From: Alexander To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: i386/139743: [ichsmb] [patch] ichsmb driver doesn't detects SMB bus on Asus P4B533/P4PE motherboards X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2009 05:00:17 -0000 >Number: 139743 >Category: i386 >Synopsis: [ichsmb] [patch] ichsmb driver doesn't detects SMB bus on Asus P4B533/P4PE motherboards >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Oct 19 05:00:10 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Alexander >Release: 7.2-STABLE >Organization: >Environment: FreeBSD freebsd.local 7.2-RELEASE-p4 FreeBSD 7.2-RELEASE-p4 #2: Tue Oct 13 09:08:02 YEKST 2009 bas@freebsd.local:/usr/obj/usr/src/sys/MYROUTER i386 >Description: Asus hides the SMBus PCI bridge within the ICH2 or ICH4 southbridge on Asus P4B533/P4PE mainboards. So ichsmb driver doesn't detects SMB bus. Bug has been known as http://www.freebsd.org/cgi/query-pr.cgi?pr=60226 , but was closed by "feedback timeout". >How-To-Repeat: Include device smbus device ichsmb device smb to the kernel config file, recompile kernel and reboot. New kernel will not detects SMB bus. pciconf -lv will not list it too. >Fix: I ported patch, given in http://www.freebsd.org/cgi/query-pr.cgi?pr=60226 to 7.2-STABLE. Ported patch goes in attach. On my machine (Asus P4PE motherboard) SMBus works after patching. Patch attached with submission follows: diff -ur /usr/src/sys/dev/pci.old/pci.c /usr/src/sys/dev/pci/pci.c --- /usr/src/sys/dev/pci.old/pci.c 2009-04-15 09:14:26.000000000 +0600 +++ /usr/src/sys/dev/pci/pci.c 2009-10-13 08:41:43.000000000 +0600 @@ -112,6 +112,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), @@ -179,16 +182,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 @@ -395,6 +404,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 @@ -2555,10 +2584,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) - pci_add_map(pcib, bus, dev, b, s, f, q->arg1, rl, - force, 0); + if (q->devid == ((cfg->device << 16) | cfg->vendor) ){ + if( q->type == PCI_QUIRK_MAP_REG ) + pci_add_map(pcib, bus, dev, b, s, f, 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)) { >Release-Note: >Audit-Trail: >Unformatted: