From owner-freebsd-i386@FreeBSD.ORG Tue Nov 22 02:50:09 2011 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 C0750106564A for ; Tue, 22 Nov 2011 02:50:09 +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 AFA018FC0C for ; Tue, 22 Nov 2011 02:50:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id pAM2o9K2025916 for ; Tue, 22 Nov 2011 02:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id pAM2o9sc025915; Tue, 22 Nov 2011 02:50:09 GMT (envelope-from gnats) Date: Tue, 22 Nov 2011 02:50:09 GMT Message-Id: <201111220250.pAM2o9sc025915@freefall.freebsd.org> To: freebsd-i386@FreeBSD.org From: Takefu Cc: Subject: Re: 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 Reply-To: Takefu List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2011 02:50:09 -0000 The following reply was made to PR i386/139743; it has been noted by GNATS. From: Takefu To: bug-followup@FreeBSD.org Cc: Subject: Re: i386/139743: [ichsmb] [patch] ichsmb driver doesn't detects SMB bus on Asus P4B533/P4PE motherboards Date: Tue, 22 Nov 2011 11:44:08 +0900 Corresponds to RELENG_9 :-) --- pci.c.patch begins here --- --- sys/dev/pci/pci.c.orig 2011-11-17 18:19:12.000000000 +0900 +++ sys/dev/pci/pci.c 2011-11-17 18:28:57.000000000 +0900 @@ -112,6 +112,7 @@ uint16_t data); static void pci_enable_msix(device_t dev, u_int index, uint64_t address, uint32_t data); +static void pci_fix_asus_smbus(device_t dev); static void pci_mask_msix(device_t dev, u_int index); static void pci_unmask_msix(device_t dev, u_int index); static int pci_msi_blacklisted(void); @@ -190,47 +191,52 @@ #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_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ +#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 * or the CMIC-SL (AKA ServerWorks GC_LE). */ - { 0x00141166, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x00171166, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x00141166, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x00171166, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, /* * MSI doesn't work on earlier Intel chipsets including * E7500, E7501, E7505, 845, 865, 875/E7210, and 855. */ - { 0x25408086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x25508086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x25608086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x25708086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x25788086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, - { 0x35808086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x25408086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x25508086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x25608086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x25708086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x25788086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, + { 0x35808086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, /* * MSI doesn't work with devices behind the AMD 8131 HT-PCIX * bridge. */ - { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, /* * Some virtualization environments emulate an older chipset * but support MSI just fine. QEMU uses the Intel 82440. */ - { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0, NULL }, { 0 } }; @@ -485,6 +491,26 @@ if (cfg->baseclass == PCIC_BRIDGE && cfg->subclass == PCIS_BRIDGE_PCI) cfg->hdrtype = PCIM_HDRTYPE_BRIDGE; } +/* 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 */ @@ -3044,9 +3070,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)) { --- pci.c.patch ends here ---