CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: gutteridge Date: Tue Nov 21 23:22:23 UTC 2023 Modified Files: src/sys/arch/x86/pci: pci_machdep.c pci_msi_machdep.c Log Message: pci_machdep.c & pci_msi_machdep.c: comment fixes Correct spelling and grammar in some comments. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/pci/pci_machdep.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pci_msi_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.97 src/sys/arch/x86/pci/pci_machdep.c:1.98 --- src/sys/arch/x86/pci/pci_machdep.c:1.97 Tue Oct 17 12:07:42 2023 +++ src/sys/arch/x86/pci/pci_machdep.c Tue Nov 21 23:22:23 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.97 2023/10/17 12:07:42 bouyer Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.98 2023/11/21 23:22:23 gutteridge Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.97 2023/10/17 12:07:42 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.98 2023/11/21 23:22:23 gutteridge Exp $"); #include #include @@ -228,7 +228,7 @@ const struct { /* arch/xen does not support MSI/MSI-X yet. */ #ifdef __HAVE_PCI_MSI_MSIX -#define PCI_QUIRK_DISABLE_MSI 1 /* Neigher MSI nor MSI-X work */ +#define PCI_QUIRK_DISABLE_MSI 1 /* Neither MSI nor MSI-X work */ #define PCI_QUIRK_DISABLE_MSIX 2 /* MSI-X does not work */ #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI and MSI-X works */ @@ -507,7 +507,7 @@ pci_attach_hook(device_t parent, device_ * support it than the other way around, so be conservative * here. So we don't enable MSI if we don't find a host * bridge there. We also deliberately don't enable MSI on - * chipsets from low-end manifacturers like VIA and SiS. + * chipsets from low-end manufacturers like VIA and SiS. */ for (i = 0; i <= 7; i++) { tag = pci_make_tag(pc, 0, 0, i); Index: src/sys/arch/x86/pci/pci_msi_machdep.c diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.18 src/sys/arch/x86/pci/pci_msi_machdep.c:1.19 --- src/sys/arch/x86/pci/pci_msi_machdep.c:1.18 Sat May 13 11:27:10 2023 +++ src/sys/arch/x86/pci/pci_msi_machdep.c Tue Nov 21 23:22:23 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_msi_machdep.c,v 1.18 2023/05/13 11:27:10 andvar Exp $ */ +/* $NetBSD: pci_msi_machdep.c,v 1.19 2023/11/21 23:22:23 gutteridge Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.18 2023/05/13 11:27:10 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.19 2023/11/21 23:22:23 gutteridge Exp $"); #include "opt_intrdebug.h" #include "ioapic.h" @@ -397,7 +397,7 @@ x86_pci_msix_release_internal(pci_intr_h */ /* - * Return intrid for a MSI/MSI-X device. + * Return intrid for an MSI/MSI-X device. * "buf" must be allocated by caller. */ const char * @@ -432,9 +432,9 @@ x86_pci_msi_release(pci_chipset_tag_t pc } /* - * Establish a MSI handle. - * If multiple MSI handle is required to establish, device driver must call - * this function for each handle. + * Establish an MSI handle. + * If multiple MSI handles are required to be established, a device driver + * must call this function for each handle. */ void * x86_pci_msi_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, @@ -452,9 +452,9 @@ x86_pci_msi_establish(pci_chipset_tag_t } /* - * Disestablish a MSI handle. - * If multiple MSI handle is required to disestablish, device driver must call - * this function for each handle. + * Disestablish an MSI handle. + * If multiple MSI handles are required to be disestablished, a device driver + * must call this function for each handle. */ void x86_pci_msi_disestablish(pci_chipset_tag_t pc, void *cookie) @@ -477,9 +477,9 @@ x86_pci_msix_release(pci_chipset_tag_t p } /* - * Establish a MSI-X handle. - * If multiple MSI-X handle is required to establish, device driver must call - * this function for each handle. + * Establish an MSI-X handle. + * If multiple MSI-X handles are required to be established, a device driver + * must call this function for each handle. */ void * x86_pci_msix_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, @@ -497,9 +497,9 @@ x86_pci_msix_establish(pci_chipset_tag_t } /* - * Disestablish a MSI-X handle. - * If multiple MSI-X handle is required to disestablish, device driver must call - * this function for each handle. + * Disestablish an MSI-X handle. + * If multiple MSI-X handles are required to be disestablished, a device driver + * must call this function for each handle. */ void x86_pci_msix_disestablish(pci_chipset_tag_t pc, void *cookie) @@ -577,7 +577,7 @@ pci_msi_alloc_exact(const struct pci_att /* * This function is
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: gutteridge Date: Tue Nov 21 23:22:23 UTC 2023 Modified Files: src/sys/arch/x86/pci: pci_machdep.c pci_msi_machdep.c Log Message: pci_machdep.c & pci_msi_machdep.c: comment fixes Correct spelling and grammar in some comments. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/pci/pci_machdep.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pci_msi_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Mon Aug 7 06:23:40 UTC 2023 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Fix detection of availability of MSI/MSI-X on some systems. Try to find all functions on bus 0, device 0 to find a PCI host bridge. Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Mon Aug 7 06:23:40 UTC 2023 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Fix detection of availability of MSI/MSI-X on some systems. Try to find all functions on bus 0, device 0 to find a PCI host bridge. Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.93 src/sys/arch/x86/pci/pci_machdep.c:1.94 --- src/sys/arch/x86/pci/pci_machdep.c:1.93 Tue Sep 6 01:44:24 2022 +++ src/sys/arch/x86/pci/pci_machdep.c Mon Aug 7 06:23:39 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.93 2022/09/06 01:44:24 msaitoh Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.94 2023/08/07 06:23:39 msaitoh Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.93 2022/09/06 01:44:24 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.94 2023/08/07 06:23:39 msaitoh Exp $"); #include #include @@ -485,6 +485,8 @@ pci_attach_hook(device_t parent, device_ pci_chipset_tag_t pc = pba->pba_pc; pcitag_t tag; pcireg_t id, class; + int i; + bool havehb = false; #endif if (pba->pba_bus == 0) @@ -502,19 +504,25 @@ pci_attach_hook(device_t parent, device_ #ifdef __HAVE_PCI_MSI_MSIX /* * In order to decide whether the system supports MSI we look - * at the host bridge, which should be device 0 function 0 on - * bus 0. It is better to not enable MSI on systems that + * at the host bridge, which should be device 0 on bus 0. + * It is better to not enable MSI on systems that * support it than the other way around, so be conservative * here. So we don't enable MSI if we don't find a host * bridge there. We also deliberately don't enable MSI on * chipsets from low-end manifacturers like VIA and SiS. */ - tag = pci_make_tag(pc, 0, 0, 0); - id = pci_conf_read(pc, tag, PCI_ID_REG); - class = pci_conf_read(pc, tag, PCI_CLASS_REG); - - if (PCI_CLASS(class) != PCI_CLASS_BRIDGE || - PCI_SUBCLASS(class) != PCI_SUBCLASS_BRIDGE_HOST) + for (i = 0; i <= 7; i++) { + tag = pci_make_tag(pc, 0, 0, i); + id = pci_conf_read(pc, tag, PCI_ID_REG); + class = pci_conf_read(pc, tag, PCI_CLASS_REG); + + if (PCI_CLASS(class) == PCI_CLASS_BRIDGE && + PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) { + havehb = true; + break; + } + } + if (havehb == false) return; /* VMware and KVM use old chipset, but they can use MSI/MSI-X */
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Fri Jul 28 02:28:33 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Add Zen4 Phoenix support. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.16 src/sys/arch/x86/pci/amdsmn.c:1.17 --- src/sys/arch/x86/pci/amdsmn.c:1.16 Sat Jan 28 12:36:52 2023 +++ src/sys/arch/x86/pci/amdsmn.c Fri Jul 28 02:28:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.16 2023/01/28 12:36:52 msaitoh Exp $ */ +/* $NetBSD: amdsmn.c,v 1.17 2023/07/28 02:28:33 msaitoh Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.16 2023/01/28 12:36:52 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.17 2023/07/28 02:28:33 msaitoh Exp $ "); /* * Driver for the AMD Family 15h (model 60+) and 17h CPU @@ -112,6 +112,11 @@ static const struct pciid { .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F19_7X_RC, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, }; static int amdsmn_match(device_t, cfdata_t, void *);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Fri Jul 28 02:28:33 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Add Zen4 Phoenix support. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Fri Jul 28 02:05:26 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: Add Zen2 Mendocino APU support. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.19 src/sys/arch/x86/pci/amdzentemp.c:1.20 --- src/sys/arch/x86/pci/amdzentemp.c:1.19 Fri Jul 28 00:11:15 2023 +++ src/sys/arch/x86/pci/amdzentemp.c Fri Jul 28 02:05:26 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.19 2023/07/28 00:11:15 msaitoh Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.20 2023/07/28 02:05:26 msaitoh Exp $ */ /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.19 2023/07/28 00:11:15 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.20 2023/07/28 02:05:26 msaitoh Exp $ "); #include #include @@ -370,15 +370,19 @@ amdzentemp_probe_ccd_sensors17h(struct a { int maxreg; - sc->sc_ccd_offset = 0x154; - switch (model) { case 0x00 ... 0x2f: /* Zen1, Zen+ */ + sc->sc_ccd_offset = 0x154; maxreg = 4; break; case 0x30 ... 0x3f: /* Zen2 TR (Castle Peak)/EPYC (Rome) */ case 0x60 ... 0x7f: /* Zen2 Ryzen (Renoir APU, Matisse) */ case 0x90 ... 0x9f: /* Zen2 Ryzen (Van Gogh APU) */ + sc->sc_ccd_offset = 0x154; + maxreg = 8; + break; + case 0xa0 ... 0xaf: /* Zen2 Ryzen (Mendocino APU) */ + sc->sc_ccd_offset = 0x300; maxreg = 8; break; default:
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Fri Jul 28 02:05:26 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: Add Zen2 Mendocino APU support. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Fri Jul 28 00:11:15 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: Add Zen4 Ryzen "Phoenix" support. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.18 src/sys/arch/x86/pci/amdzentemp.c:1.19 --- src/sys/arch/x86/pci/amdzentemp.c:1.18 Sat Jan 28 12:36:52 2023 +++ src/sys/arch/x86/pci/amdzentemp.c Fri Jul 28 00:11:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.18 2023/01/28 12:36:52 msaitoh Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.19 2023/07/28 00:11:15 msaitoh Exp $ */ /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.18 2023/01/28 12:36:52 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.19 2023/07/28 00:11:15 msaitoh Exp $ "); #include #include @@ -403,6 +403,7 @@ amdzentemp_probe_ccd_sensors19h(struct a maxreg = 8; break; case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */ + case 0x70 ... 0x7f: /* Zen4 Ryzen "Phoenix" */ sc->sc_ccd_offset = 0x308; maxreg = 8; break;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Fri Jul 28 00:11:15 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: Add Zen4 Ryzen "Phoenix" support. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: andvar Date: Sat May 13 11:27:10 UTC 2023 Modified Files: src/sys/arch/x86/pci: pci_msi_machdep.c Log Message: s/requied/required/ in comments (likely grammar should be also improved in the future). To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/pci_msi_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: andvar Date: Sat May 13 11:27:10 UTC 2023 Modified Files: src/sys/arch/x86/pci: pci_msi_machdep.c Log Message: s/requied/required/ in comments (likely grammar should be also improved in the future). To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/pci_msi_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_msi_machdep.c diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.17 src/sys/arch/x86/pci/pci_msi_machdep.c:1.18 --- src/sys/arch/x86/pci/pci_msi_machdep.c:1.17 Mon May 23 15:03:05 2022 +++ src/sys/arch/x86/pci/pci_msi_machdep.c Sat May 13 11:27:10 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_msi_machdep.c,v 1.17 2022/05/23 15:03:05 bouyer Exp $ */ +/* $NetBSD: pci_msi_machdep.c,v 1.18 2023/05/13 11:27:10 andvar Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.17 2022/05/23 15:03:05 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.18 2023/05/13 11:27:10 andvar Exp $"); #include "opt_intrdebug.h" #include "ioapic.h" @@ -433,7 +433,7 @@ x86_pci_msi_release(pci_chipset_tag_t pc /* * Establish a MSI handle. - * If multiple MSI handle is requied to establish, device driver must call + * If multiple MSI handle is required to establish, device driver must call * this function for each handle. */ void * @@ -453,7 +453,7 @@ x86_pci_msi_establish(pci_chipset_tag_t /* * Disestablish a MSI handle. - * If multiple MSI handle is requied to disestablish, device driver must call + * If multiple MSI handle is required to disestablish, device driver must call * this function for each handle. */ void @@ -478,7 +478,7 @@ x86_pci_msix_release(pci_chipset_tag_t p /* * Establish a MSI-X handle. - * If multiple MSI-X handle is requied to establish, device driver must call + * If multiple MSI-X handle is required to establish, device driver must call * this function for each handle. */ void * @@ -498,7 +498,7 @@ x86_pci_msix_establish(pci_chipset_tag_t /* * Disestablish a MSI-X handle. - * If multiple MSI-X handle is requied to disestablish, device driver must call + * If multiple MSI-X handle is required to disestablish, device driver must call * this function for each handle. */ void
CVS commit: src/sys/arch/x86/pci/imcsmb
Module Name:src Committed By: riastradh Date: Wed May 10 00:07:49 UTC 2023 Modified Files: src/sys/arch/x86/pci/imcsmb: imc.c imcsmb.c Log Message: x86/imc(4): Use config_detach_children. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/imcsmb/imc.c \ src/sys/arch/x86/pci/imcsmb/imcsmb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/imcsmb/imc.c diff -u src/sys/arch/x86/pci/imcsmb/imc.c:1.5 src/sys/arch/x86/pci/imcsmb/imc.c:1.6 --- src/sys/arch/x86/pci/imcsmb/imc.c:1.5 Wed Sep 28 10:09:48 2022 +++ src/sys/arch/x86/pci/imcsmb/imc.c Wed May 10 00:07:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: imc.c,v 1.5 2022/09/28 10:09:48 msaitoh Exp $ */ +/* $NetBSD: imc.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.5 2022/09/28 10:09:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $"); #include #include @@ -259,16 +259,11 @@ imc_rescan(device_t self, const char *if static int imc_detach(device_t self, int flags) { - struct imc_softc *sc = device_private(self); - int i, error; + int error; - for (i = 0; i < 2; i++) { - if (sc->sc_smbchild[i] != NULL) { - error = config_detach(sc->sc_smbchild[i], flags); - if (error) -return error; - } - } + error = config_detach_children(self, flags); + if (error) + return error; pmf_device_deregister(self); return 0; Index: src/sys/arch/x86/pci/imcsmb/imcsmb.c diff -u src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.5 src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.6 --- src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.5 Sat Aug 7 16:19:08 2021 +++ src/sys/arch/x86/pci/imcsmb/imcsmb.c Wed May 10 00:07:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: imcsmb.c,v 1.5 2021/08/07 16:19:08 thorpej Exp $ */ +/* $NetBSD: imcsmb.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.5 2021/08/07 16:19:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $"); #include #include @@ -182,14 +182,12 @@ imcsmb_chdet(device_t self, device_t chi static int imcsmb_detach(device_t self, int flags) { - int error; struct imcsmb_softc *sc = device_private(self); + int error; - if (sc->sc_smbus != NULL) { - error = config_detach(sc->sc_smbus, flags); - if (error) - return error; - } + error = config_detach_children(self, flags); + if (error) + return error; pmf_device_deregister(self); iic_tag_fini(>sc_i2c_tag);
CVS commit: src/sys/arch/x86/pci/imcsmb
Module Name:src Committed By: riastradh Date: Wed May 10 00:07:49 UTC 2023 Modified Files: src/sys/arch/x86/pci/imcsmb: imc.c imcsmb.c Log Message: x86/imc(4): Use config_detach_children. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/imcsmb/imc.c \ src/sys/arch/x86/pci/imcsmb/imcsmb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Tue May 9 23:11:09 UTC 2023 Modified Files: src/sys/arch/x86/pci: ichlpcib.c Log Message: ichlpcib(4): Use config_detach_children. Delete a lot of unnecessary code with broken error branches involving config_detach which have probably seldom if ever been exercised. No substantive functional change intended. Low risk because ichlpcib(4) is not a removable device, so you have to go out of your way to exercise detach. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/pci/ichlpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/ichlpcib.c diff -u src/sys/arch/x86/pci/ichlpcib.c:1.60 src/sys/arch/x86/pci/ichlpcib.c:1.61 --- src/sys/arch/x86/pci/ichlpcib.c:1.60 Tue May 9 23:10:11 2023 +++ src/sys/arch/x86/pci/ichlpcib.c Tue May 9 23:11:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ichlpcib.c,v 1.60 2023/05/09 23:10:11 riastradh Exp $ */ +/* $NetBSD: ichlpcib.c,v 1.61 2023/05/09 23:11:09 riastradh Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.60 2023/05/09 23:10:11 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.61 2023/05/09 23:11:09 riastradh Exp $"); #include #include @@ -138,21 +138,19 @@ static bool lpcib_resume(device_t, const static bool lpcib_shutdown(device_t, int); static void pmtimer_configure(device_t); -static int pmtimer_unconfigure(device_t, int); +static void pmtimer_unconfigure(device_t, int); static void tcotimer_configure(device_t); -static int tcotimer_unconfigure(device_t, int); static void speedstep_configure(device_t); static void speedstep_unconfigure(device_t); static int speedstep_sysctl_helper(SYSCTLFN_ARGS); static void lpcib_hpet_configure(device_t); -static int lpcib_hpet_unconfigure(device_t, int); #if NGPIO > 0 static void lpcib_gpio_configure(device_t); -static int lpcib_gpio_unconfigure(device_t, int); +static void lpcib_gpio_unconfigure(device_t); static int lpcib_gpio_pin_read(void *, int); static void lpcib_gpio_pin_write(void *, int, int); static void lpcib_gpio_pin_ctl(void *, int, int); @@ -160,7 +158,6 @@ static void lpcib_gpio_pin_ctl(void *, i #if NFWHRNG > 0 static void lpcib_fwh_configure(device_t); -static int lpcib_fwh_unconfigure(device_t, int); #endif struct lpcib_softc *speedstep_cookie; /* XXX */ @@ -500,38 +497,32 @@ static int lpcibdetach(device_t self, int flags) { struct lpcib_softc *sc = device_private(self); - int rc; + int error; - pmf_device_deregister(self); - -#if NFWHRNG > 0 - if ((rc = lpcib_fwh_unconfigure(self, flags)) != 0) - return rc; -#endif + error = config_detach_children(self, flags); + if (error) + return error; - if ((rc = lpcib_hpet_unconfigure(self, flags)) != 0) - return rc; + pmf_device_deregister(self); #if NGPIO > 0 - if ((rc = lpcib_gpio_unconfigure(self, flags)) != 0) - return rc; + lpcib_gpio_unconfigure(self); #endif /* Set up SpeedStep. */ speedstep_unconfigure(self); - if ((rc = tcotimer_unconfigure(self, flags)) != 0) - return rc; - - if ((rc = pmtimer_unconfigure(self, flags)) != 0) - return rc; + pmtimer_unconfigure(self, flags); if (sc->sc_has_rcba) bus_space_unmap(sc->sc_rcbat, sc->sc_rcbah, LPCIB_RCBA_SIZE); bus_space_unmap(sc->sc_pmt, sc->sc_pmh, sc->sc_iosize); - return pcibdetach(self, flags); + error = pcibdetach(self, flags); + KASSERTMSG(error == 0, "error=%d", error); + + return 0; } static bool @@ -622,20 +613,19 @@ pmtimer_configure(device_t self) PMC_PM1_TMR, 0); } -static int +static void pmtimer_unconfigure(device_t self, int flags) { struct lpcib_softc *sc = device_private(self); - int rc; + int error __diagused; - if (sc->sc_pmtimer != NULL && - (rc = acpipmtimer_detach(sc->sc_pmtimer, flags)) != 0) - return rc; + if (sc->sc_pmtimer != NULL) { + error = acpipmtimer_detach(sc->sc_pmtimer, flags); + KASSERTMSG(error == 0, "error=%d", error); + } pci_conf_write(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag, LPCIB_PCI_ACPI_CNTL, sc->sc_acpi_cntl); - - return 0; } /* @@ -663,19 +653,6 @@ tcotimer_configure(device_t self) CFARGS(.iattr = "tcoichbus")); } -static int -tcotimer_unconfigure(device_t self, int flags) -{ - struct lpcib_softc *sc = device_private(self); - int rc; - - if (sc->sc_tco != NULL && - (rc = config_detach(sc->sc_tco, flags)) != 0) - return rc; - - return 0; -} - /* * Intel ICH SpeedStep support. @@ -891,19 +868,6 @@ lpcib_hpet_configure(device_t self) CFARGS(.iattr = "hpetichbus")); } -static int -lpcib_hpet_unconfigure(device_t self, int flags) -{ - struct lpcib_softc *sc = device_private(self); - int rc; - - if (sc->sc_hpetbus != NULL && - (rc = config_detach(sc->sc_hpetbus, flags)) != 0) - return rc; - - return 0; -} - #if NGPIO >
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Tue May 9 23:11:09 UTC 2023 Modified Files: src/sys/arch/x86/pci: ichlpcib.c Log Message: ichlpcib(4): Use config_detach_children. Delete a lot of unnecessary code with broken error branches involving config_detach which have probably seldom if ever been exercised. No substantive functional change intended. Low risk because ichlpcib(4) is not a removable device, so you have to go out of your way to exercise detach. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/pci/ichlpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Tue May 9 23:10:11 UTC 2023 Modified Files: src/sys/arch/x86/pci: ichlpcib.c Log Message: ichlpcib(4): KNF. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/pci/ichlpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/ichlpcib.c diff -u src/sys/arch/x86/pci/ichlpcib.c:1.59 src/sys/arch/x86/pci/ichlpcib.c:1.60 --- src/sys/arch/x86/pci/ichlpcib.c:1.59 Wed Apr 12 06:39:15 2023 +++ src/sys/arch/x86/pci/ichlpcib.c Tue May 9 23:10:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ichlpcib.c,v 1.59 2023/04/12 06:39:15 riastradh Exp $ */ +/* $NetBSD: ichlpcib.c,v 1.60 2023/05/09 23:10:11 riastradh Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.59 2023/04/12 06:39:15 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.60 2023/05/09 23:10:11 riastradh Exp $"); #include #include @@ -347,9 +347,9 @@ lpcibattach(device_t parent, device_t se sc->sc_pmt = pa->pa_iot; pmbase = pci_conf_read(pa->pa_pc, pa->pa_tag, LPCIB_PCI_PMBASE); if (bus_space_map(sc->sc_pmt, PCI_MAPREG_IO_ADDR(pmbase), - LPCIB_PCI_PM_SIZE, 0, >sc_pmh) != 0) { + LPCIB_PCI_PM_SIZE, 0, >sc_pmh) != 0) { aprint_error_dev(self, - "can't map power management i/o space\n"); + "can't map power management i/o space\n"); return; } @@ -370,7 +370,7 @@ lpcibattach(device_t parent, device_t se sc->sc_rcbat = sc->sc_pa.pa_memt; rcba = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag, - LPCIB_RCBA); + LPCIB_RCBA); if ((rcba & LPCIB_RCBA_EN) == 0) { aprint_error_dev(self, "RCBA is not enabled\n"); return; @@ -378,7 +378,7 @@ lpcibattach(device_t parent, device_t se rcba &= ~LPCIB_RCBA_EN; if (bus_space_map(sc->sc_rcbat, rcba, LPCIB_RCBA_SIZE, 0, - >sc_rcbah)) { + >sc_rcbah)) { aprint_error_dev(self, "RCBA could not be mapped\n"); return; } @@ -407,7 +407,7 @@ lpcibattach(device_t parent, device_t se /* Install power handler */ if (!pmf_device_register1(self, lpcib_suspend, lpcib_resume, - lpcib_shutdown)) + lpcib_shutdown)) aprint_error_dev(self, "couldn't establish power handler\n"); } @@ -477,7 +477,7 @@ lpcibrescan(device_t self, const char *i { struct lpcib_softc *sc = device_private(self); - if(ifattr_match(ifattr, "tcoichbus") && sc->sc_tco == NULL) + if (ifattr_match(ifattr, "tcoichbus") && sc->sc_tco == NULL) tcotimer_configure(self); #if NFWHRNG > 0 @@ -604,7 +604,7 @@ pmtimer_configure(device_t self) struct lpcib_softc *sc = device_private(self); pcireg_t control; - /* + /* * Check if power management I/O space is enabled and enable the ACPI_EN * bit if it's disabled. */ @@ -716,16 +716,16 @@ speedstep_configure(device_t self) if (PCI_PRODUCT(sc->sc_pa.pa_id) == PCI_PRODUCT_INTEL_82801DBM_LPC || PCI_PRODUCT(sc->sc_pa.pa_id) == PCI_PRODUCT_INTEL_82801CAM_LPC || (PCI_PRODUCT(sc->sc_pa.pa_id) == PCI_PRODUCT_INTEL_82801BAM_LPC && - pci_find_device(>sc_pa, speedstep_bad_hb_check) == 0)) { + pci_find_device(>sc_pa, speedstep_bad_hb_check) == 0)) { pcireg_t pmcon; /* Enable SpeedStep if it isn't already enabled. */ pmcon = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag, - LPCIB_PCI_GEN_PMCON_1); + LPCIB_PCI_GEN_PMCON_1); if ((pmcon & LPCIB_PCI_GEN_PMCON_1_SS_EN) == 0) pci_conf_write(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag, - LPCIB_PCI_GEN_PMCON_1, - pmcon | LPCIB_PCI_GEN_PMCON_1_SS_EN); + LPCIB_PCI_GEN_PMCON_1, + pmcon | LPCIB_PCI_GEN_PMCON_1_SS_EN); /* Put in machdep.speedstep_state (0 for low, 1 for high). */ if ((rv = sysctl_createv(>sc_log, 0, NULL, , @@ -928,7 +928,7 @@ lpcib_gpio_configure(device_t self) } gpio_cntl = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag, - cntl_reg); + cntl_reg); /* Is GPIO enabled? */ if ((gpio_cntl & LPCIB_PCI_GPIO_CNTL_EN) == 0) @@ -1023,14 +1023,14 @@ lpcib_gpio_pin_read(void *arg, int pin) struct lpcib_softc *sc = arg; uint32_t data; int reg, shift; - + reg = (pin < 32) ? LPCIB_GPIO_GP_LVL : LPCIB_GPIO_GP_LVL2; shift = pin % 32; mutex_enter(>sc_gpio_mtx); data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, reg); mutex_exit(>sc_gpio_mtx); - + return (__SHIFTOUT(data, __BIT(shift)) ? GPIO_PIN_HIGH : GPIO_PIN_LOW); } @@ -1048,7 +1048,7 @@ lpcib_gpio_pin_write(void *arg, int pin, data = bus_space_read_4(sc->sc_gpio_iot, sc->sc_gpio_ioh, reg); - if(value) + if (value) data |= __BIT(shift); else data &= ~__BIT(shift); @@ -1067,11 +1067,11 @@ lpcib_gpio_pin_ctl(void *arg, int pin, i shift = pin % 32; reg = (pin < 32) ? LPCIB_GPIO_GP_IO_SEL : LPCIB_GPIO_GP_IO_SEL2; - +
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Tue May 9 23:10:11 UTC 2023 Modified Files: src/sys/arch/x86/pci: ichlpcib.c Log Message: ichlpcib(4): KNF. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/pci/ichlpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Sat Jan 28 12:36:52 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdsmn.c amdzentemp.c Log Message: amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.15 src/sys/arch/x86/pci/amdsmn.c:1.16 --- src/sys/arch/x86/pci/amdsmn.c:1.15 Sun Dec 18 15:50:32 2022 +++ src/sys/arch/x86/pci/amdsmn.c Sat Jan 28 12:36:52 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.15 2022/12/18 15:50:32 reinoud Exp $ */ +/* $NetBSD: amdsmn.c,v 1.16 2023/01/28 12:36:52 msaitoh Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.15 2022/12/18 15:50:32 reinoud Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.16 2023/01/28 12:36:52 msaitoh Exp $ "); /* * Driver for the AMD Family 15h (model 60+) and 17h CPU @@ -93,7 +93,17 @@ static const struct pciid { .amdsmn_data_reg = F17H_SMN_DATA_REG, }, { - .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC, + .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC, /* or F19_0X */ + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_AX_RC, /* or F19_4X */ + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F19_1X_RC, .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.17 src/sys/arch/x86/pci/amdzentemp.c:1.18 --- src/sys/arch/x86/pci/amdzentemp.c:1.17 Sat Jan 28 07:45:21 2023 +++ src/sys/arch/x86/pci/amdzentemp.c Sat Jan 28 12:36:52 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.17 2023/01/28 07:45:21 msaitoh Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.18 2023/01/28 12:36:52 msaitoh Exp $ */ /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.17 2023/01/28 07:45:21 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.18 2023/01/28 12:36:52 msaitoh Exp $ "); #include #include @@ -121,6 +121,10 @@ enum { CCD5, CCD6, CCD7, + CCD8, + CCD9, + CCD10, + CCD11, CCD_MAX, NUM_CCDS = CCD_MAX - CCD_BASE }; @@ -402,6 +406,14 @@ amdzentemp_probe_ccd_sensors19h(struct a sc->sc_ccd_offset = 0x308; maxreg = 8; break; + case 0x40 ... 0x4f: /* Zen3+ "Rembrandt" */ + sc->sc_ccd_offset = 0x300; + maxreg = 8; + break; + case 0x10 ... 0x1f: /* Zen4 "Genoa" */ + sc->sc_ccd_offset = 0x300; + maxreg = 12; + break; default: aprint_error_dev(sc->sc_dev, "Unrecognized Family 19h Model: %02xh\n", model);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Sat Jan 28 12:36:52 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdsmn.c amdzentemp.c Log Message: amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Sat Jan 28 07:45:21 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: Reduce diff against DragonFly. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.16 src/sys/arch/x86/pci/amdzentemp.c:1.17 --- src/sys/arch/x86/pci/amdzentemp.c:1.16 Thu Nov 24 21:03:38 2022 +++ src/sys/arch/x86/pci/amdzentemp.c Sat Jan 28 07:45:21 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.16 2022/11/24 21:03:38 mrg Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.17 2023/01/28 07:45:21 msaitoh Exp $ */ /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.16 2022/11/24 21:03:38 mrg Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.17 2023/01/28 07:45:21 msaitoh Exp $ "); #include #include @@ -74,7 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c #include "amdsmn.h" #define AMD_CURTMP_RANGE_ADJUST 4900 /* in microKelvins (ie, 49C) */ -#define AMD_CURTMP_RANGE_CHECK __BIT(19) #define F10_TEMP_CURTMP __BITS(31,21) /* XXX same as amdtemp.c */ #define F10_TEMP_CURTMP_MASK 0x7ff #define F15M60_CURTMP_TJSEL __BITS(17,16) @@ -96,14 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c * to -49..206C. */ #define AMD_17H_CUR_TMP 0x59800 - -/* - * The following register set was discovered experimentally by Ondrej Čerman - * and collaborators, but is not (yet) documented in a PPR/OSRR (other than - * the M70H PPR SMN memory map showing [0x59800, +0x314] as allocated to - * SMU::THM). It seems plausible and the Linux sensor folks have adopted it. - */ -#define AMD_17H_CCD_TMP_BASE 0x59954 +#define AMD_17H_CUR_TMP_RANGE_SEL __BIT(19) #define AMD_17H_CCD_TMP_VALID __BIT(11) struct amdzentemp_softc { @@ -114,7 +106,7 @@ struct amdzentemp_softc { size_t sc_sensor_len; size_t sc_numsensors; int32_t sc_offset; - uint32_t sc_ccd_tmp_base; + int32_t sc_ccd_offset; }; enum { @@ -339,14 +331,16 @@ amdzentemp_family17_refresh(struct sysmo edata->state = ENVSYS_SINVALID; return; } - minus49 = (temp & AMD_CURTMP_RANGE_CHECK) ? true : false; + minus49 = (temp & AMD_17H_CUR_TMP_RANGE_SEL) ? + true : false; temp = __SHIFTOUT(temp, F10_TEMP_CURTMP); break; case CCD_BASE ... (CCD_MAX - 1): /* Tccd */ i = edata->private - CCD_BASE; error = amdsmn_read(sc->sc_smn, - sc->sc_ccd_tmp_base + (i * sizeof(temp)), ); + AMD_17H_CUR_TMP + sc->sc_ccd_offset + (i * sizeof(temp)), + ); if (error || !ISSET(temp, AMD_17H_CCD_TMP_VALID)) { edata->state = ENVSYS_SINVALID; return; @@ -372,6 +366,8 @@ amdzentemp_probe_ccd_sensors17h(struct a { int maxreg; + sc->sc_ccd_offset = 0x154; + switch (model) { case 0x00 ... 0x2f: /* Zen1, Zen+ */ maxreg = 4; @@ -399,10 +395,11 @@ amdzentemp_probe_ccd_sensors19h(struct a case 0x00 ... 0x0f: /* Zen3 EPYC "Milan" */ case 0x20 ... 0x2f: /* Zen3 Ryzen "Vermeer" */ case 0x50 ... 0x5f: /* Zen3 Ryzen "Cezanne" */ + sc->sc_ccd_offset = 0x154; maxreg = 8; break; case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */ - sc->sc_ccd_tmp_base = 0x59b08; + sc->sc_ccd_offset = 0x308; maxreg = 8; break; default: @@ -419,9 +416,6 @@ amdzentemp_probe_ccd_sensors(struct amdz { int nccd; - /* Set default CCD temp sensor base address. */ - sc->sc_ccd_tmp_base = 0x59954; - switch (family) { case 0x17: nccd = amdzentemp_probe_ccd_sensors17h(sc, model); @@ -446,7 +440,8 @@ amdzentemp_setup_ccd_sensors(struct amdz for (i = 0; i < sc->sc_numsensors - 1; i++) { error = amdsmn_read(sc->sc_smn, - sc->sc_ccd_tmp_base + (i * sizeof(temp)), ); + AMD_17H_CUR_TMP + sc->sc_ccd_offset + (i * sizeof(temp)), + ); if (error || !ISSET(temp, AMD_17H_CCD_TMP_VALID)) continue;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Sat Jan 28 07:45:21 UTC 2023 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: Reduce diff against DragonFly. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: mrg Date: Thu Nov 24 21:03:38 UTC 2022 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: match zen3 "cezanne" (ryzen 5000-series APU.) To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.15 src/sys/arch/x86/pci/amdzentemp.c:1.16 --- src/sys/arch/x86/pci/amdzentemp.c:1.15 Sat Oct 1 15:50:05 2022 +++ src/sys/arch/x86/pci/amdzentemp.c Thu Nov 24 21:03:38 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.15 2022/10/01 15:50:05 msaitoh Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.16 2022/11/24 21:03:38 mrg Exp $ */ /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.15 2022/10/01 15:50:05 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.16 2022/11/24 21:03:38 mrg Exp $ "); #include #include @@ -398,6 +398,7 @@ amdzentemp_probe_ccd_sensors19h(struct a switch (model) { case 0x00 ... 0x0f: /* Zen3 EPYC "Milan" */ case 0x20 ... 0x2f: /* Zen3 Ryzen "Vermeer" */ + case 0x50 ... 0x5f: /* Zen3 Ryzen "Cezanne" */ maxreg = 8; break; case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: mrg Date: Thu Nov 24 21:03:38 UTC 2022 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: match zen3 "cezanne" (ryzen 5000-series APU.) To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Sat Oct 1 15:50:05 UTC 2022 Modified Files: src/sys/arch/x86/pci: amdsmn.c amdzentemp.c Log Message: amdsmn(4),amdzentemp(4): Add support for 17h/6xh and 19h/6xh. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.13 src/sys/arch/x86/pci/amdsmn.c:1.14 --- src/sys/arch/x86/pci/amdsmn.c:1.13 Wed Apr 27 06:59:25 2022 +++ src/sys/arch/x86/pci/amdsmn.c Sat Oct 1 15:50:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.13 2022/04/27 06:59:25 msaitoh Exp $ */ +/* $NetBSD: amdsmn.c,v 1.14 2022/10/01 15:50:05 msaitoh Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.13 2022/04/27 06:59:25 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.14 2022/10/01 15:50:05 msaitoh Exp $ "); /* * Driver for the AMD Family 15h (model 60+) and 17h CPU @@ -88,10 +88,20 @@ static const struct pciid { .amdsmn_data_reg = F17H_SMN_DATA_REG, }, { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_6X_RC, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC, .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F19_6X_RC, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, }; static int amdsmn_match(device_t, cfdata_t, void *); Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.14 src/sys/arch/x86/pci/amdzentemp.c:1.15 --- src/sys/arch/x86/pci/amdzentemp.c:1.14 Sun Jun 6 11:35:22 2021 +++ src/sys/arch/x86/pci/amdzentemp.c Sat Oct 1 15:50:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.14 2021/06/06 11:35:22 nonaka Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.15 2022/10/01 15:50:05 msaitoh Exp $ */ /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.14 2021/06/06 11:35:22 nonaka Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.15 2022/10/01 15:50:05 msaitoh Exp $ "); #include #include @@ -114,6 +114,7 @@ struct amdzentemp_softc { size_t sc_sensor_len; size_t sc_numsensors; int32_t sc_offset; + uint32_t sc_ccd_tmp_base; }; enum { @@ -345,7 +346,7 @@ amdzentemp_family17_refresh(struct sysmo /* Tccd */ i = edata->private - CCD_BASE; error = amdsmn_read(sc->sc_smn, - AMD_17H_CCD_TMP_BASE + (i * sizeof(temp)), ); + sc->sc_ccd_tmp_base + (i * sizeof(temp)), ); if (error || !ISSET(temp, AMD_17H_CCD_TMP_VALID)) { edata->state = ENVSYS_SINVALID; return; @@ -399,6 +400,10 @@ amdzentemp_probe_ccd_sensors19h(struct a case 0x20 ... 0x2f: /* Zen3 Ryzen "Vermeer" */ maxreg = 8; break; + case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */ + sc->sc_ccd_tmp_base = 0x59b08; + maxreg = 8; + break; default: aprint_error_dev(sc->sc_dev, "Unrecognized Family 19h Model: %02xh\n", model); @@ -413,6 +418,9 @@ amdzentemp_probe_ccd_sensors(struct amdz { int nccd; + /* Set default CCD temp sensor base address. */ + sc->sc_ccd_tmp_base = 0x59954; + switch (family) { case 0x17: nccd = amdzentemp_probe_ccd_sensors17h(sc, model); @@ -437,7 +445,7 @@ amdzentemp_setup_ccd_sensors(struct amdz for (i = 0; i < sc->sc_numsensors - 1; i++) { error = amdsmn_read(sc->sc_smn, - AMD_17H_CCD_TMP_BASE + (i * sizeof(temp)), ); + sc->sc_ccd_tmp_base + (i * sizeof(temp)), ); if (error || !ISSET(temp, AMD_17H_CCD_TMP_VALID)) continue;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Sat Oct 1 15:50:05 UTC 2022 Modified Files: src/sys/arch/x86/pci: amdsmn.c amdzentemp.c Log Message: amdsmn(4),amdzentemp(4): Add support for 17h/6xh and 19h/6xh. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci/imcsmb
Module Name:src Committed By: msaitoh Date: Wed Sep 28 10:09:48 UTC 2022 Modified Files: src/sys/arch/x86/pci/imcsmb: imc.c Log Message: Fix compile error. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/imcsmb/imc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/imcsmb/imc.c diff -u src/sys/arch/x86/pci/imcsmb/imc.c:1.4 src/sys/arch/x86/pci/imcsmb/imc.c:1.5 --- src/sys/arch/x86/pci/imcsmb/imc.c:1.4 Sat Aug 7 16:19:08 2021 +++ src/sys/arch/x86/pci/imcsmb/imc.c Wed Sep 28 10:09:48 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: imc.c,v 1.4 2021/08/07 16:19:08 thorpej Exp $ */ +/* $NetBSD: imc.c,v 1.5 2022/09/28 10:09:48 msaitoh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.4 2021/08/07 16:19:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.5 2022/09/28 10:09:48 msaitoh Exp $"); #include #include @@ -137,12 +137,12 @@ __KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.4 #define IMCSMB_PCI_DEV_ID_IMC0_SBX 0x3ca8 #define IMCSMB_PCI_DEV_ID_IMC0_IBX 0x0ea8 -#define IMCSMB_PCI_DEV_ID_IMC0_HSX PCI_PRODUCT_INTEL_XE5_V3_IMC0_MAIN +#define IMCSMB_PCI_DEV_ID_IMC0_HSX PCI_PRODUCT_INTEL_XE5_V3_IMC0_TATRR #define IMCSMB_PCI_DEV_ID_IMC0_BDX PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1 /* (Sandy,Ivy)bridge-Xeon only have a single memory controller per socket */ -#define IMCSMB_PCI_DEV_ID_IMC1_HSX PCI_PRODUCT_INTEL_XE5_V3_IMC1_MAIN +#define IMCSMB_PCI_DEV_ID_IMC1_HSX PCI_PRODUCT_INTEL_XE5_V3_IMC1_TATRR #define IMCSMB_PCI_DEV_ID_IMC1_BDX PCI_PRODUCT_INTEL_COREI76K_IMC_0 /* There are two SMBus controllers in each device. These define the registers @@ -291,8 +291,8 @@ imc_probe(device_t dev, cfdata_t cf, voi switch(PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_INTEL_COREI76K_IMC_0: case PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1: - case PCI_PRODUCT_INTEL_XE5_V3_IMC0_MAIN: - case PCI_PRODUCT_INTEL_XE5_V3_IMC1_MAIN: + case PCI_PRODUCT_INTEL_XE5_V3_IMC0_TATRR: + case PCI_PRODUCT_INTEL_XE5_V3_IMC1_TATRR: case PCI_PRODUCT_INTEL_E5_IMC_TA: case PCI_PRODUCT_INTEL_E5V2_IMC_TA: return 1;
CVS commit: src/sys/arch/x86/pci/imcsmb
Module Name:src Committed By: msaitoh Date: Wed Sep 28 10:09:48 UTC 2022 Modified Files: src/sys/arch/x86/pci/imcsmb: imc.c Log Message: Fix compile error. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/imcsmb/imc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Thu Sep 22 14:42:29 UTC 2022 Modified Files: src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h Log Message: ichlpcib(4), tco(4): Rename iot -> pmt, ioh -> pmh. Makes it clearer that this is specifically about the power management controller (PMC) registers relative to PMBASE. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/pci/ichlpcib.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/tco.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Thu Sep 22 14:42:29 UTC 2022 Modified Files: src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h Log Message: ichlpcib(4), tco(4): Rename iot -> pmt, ioh -> pmh. Makes it clearer that this is specifically about the power management controller (PMC) registers relative to PMBASE. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/pci/ichlpcib.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/tco.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/ichlpcib.c diff -u src/sys/arch/x86/pci/ichlpcib.c:1.57 src/sys/arch/x86/pci/ichlpcib.c:1.58 --- src/sys/arch/x86/pci/ichlpcib.c:1.57 Thu Sep 22 14:42:09 2022 +++ src/sys/arch/x86/pci/ichlpcib.c Thu Sep 22 14:42:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $ */ +/* $NetBSD: ichlpcib.c,v 1.58 2022/09/22 14:42:29 riastradh Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.58 2022/09/22 14:42:29 riastradh Exp $"); #include #include @@ -85,8 +85,8 @@ struct lpcib_softc { pcireg_t sc_rcba_reg; /* Power management variables. */ - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; + bus_space_tag_t sc_pmt; + bus_space_handle_t sc_pmh; bus_size_t sc_iosize; /* HPET variables. */ @@ -339,10 +339,10 @@ lpcibattach(device_t parent, device_t se * than LPCIB_PCI_PM_SIZE. It makes impossible to use * pci_mapreg_submap() because the function does range check. */ - sc->sc_iot = pa->pa_iot; + sc->sc_pmt = pa->pa_iot; pmbase = pci_conf_read(pa->pa_pc, pa->pa_tag, LPCIB_PCI_PMBASE); - if (bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(pmbase), - LPCIB_PCI_PM_SIZE, 0, >sc_ioh) != 0) { + if (bus_space_map(sc->sc_pmt, PCI_MAPREG_IO_ADDR(pmbase), + LPCIB_PCI_PM_SIZE, 0, >sc_pmh) != 0) { aprint_error_dev(self, "can't map power management i/o space\n"); return; @@ -517,7 +517,7 @@ lpcibdetach(device_t self, int flags) if (sc->sc_has_rcba) bus_space_unmap(sc->sc_rcbat, sc->sc_rcbah, LPCIB_RCBA_SIZE); - bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_iosize); + bus_space_unmap(sc->sc_pmt, sc->sc_pmh, sc->sc_iosize); return pcibdetach(self, flags); } @@ -606,7 +606,7 @@ pmtimer_configure(device_t self) } /* Attach our PM timer with the generic acpipmtimer function */ - sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_iot, sc->sc_ioh, + sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_pmt, sc->sc_pmh, PMC_PM1_TMR, 0); } @@ -639,8 +639,8 @@ tcotimer_configure(device_t self) arg.ta_version = TCO_VERSION_RCBA; else arg.ta_version = TCO_VERSION_PCIB; - arg.ta_iot = sc->sc_iot; - arg.ta_ioh = sc->sc_ioh; + arg.ta_pmt = sc->sc_pmt; + arg.ta_pmh = sc->sc_pmh; arg.ta_rcbat = sc->sc_rcbat; arg.ta_rcbah = sc->sc_rcbah; arg.ta_pcib = >sc_pcib; @@ -667,9 +667,9 @@ tcotimer_unconfigure(device_t self, int * Intel ICH SpeedStep support. */ #define SS_READ(sc, reg) \ - bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (reg)) + bus_space_read_1((sc)->sc_pmt, (sc)->sc_pmh, (reg)) #define SS_WRITE(sc, reg, val) \ - bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val)) + bus_space_write_1((sc)->sc_pmt, (sc)->sc_pmh, (reg), (val)) /* * Linux driver says that SpeedStep on older chipsets cause Index: src/sys/arch/x86/pci/tco.c diff -u src/sys/arch/x86/pci/tco.c:1.6 src/sys/arch/x86/pci/tco.c:1.7 --- src/sys/arch/x86/pci/tco.c:1.6 Thu Sep 22 14:42:09 2022 +++ src/sys/arch/x86/pci/tco.c Thu Sep 22 14:42:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $ */ +/* $NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $"); #include #include @@ -55,8 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 struct tco_softc { struct sysmon_wdog sc_smw; - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; + bus_space_tag_t sc_pmt; + bus_space_handle_t sc_pmh; bus_space_tag_t sc_rcbat; bus_space_handle_t sc_rcbah; struct pcib_softc * sc_pcib; @@ -90,7 +90,7 @@ tco_match(device_t parent, cfdata_t matc { struct tco_attach_args *ta = aux; - if (ta->ta_iot == 0) + if (ta->ta_pmt == 0) return 0; switch (ta->ta_version) { @@ -113,8 +113,8 @@ tco_attach(device_t parent, device_t sel /* Retrieve bus info shared with parent/siblings */ sc->sc_version = ta->ta_version; - sc->sc_iot = ta->ta_iot; - sc->sc_ioh = ta->ta_ioh; + sc->sc_pmt =
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Thu Sep 22 14:41:49 UTC 2022 Modified Files: src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h Log Message: tco(4): Rename lpcib_tco_attach_args -> tco_attach_args. No longer hangs off LPC bus, newer devices hang it off SMBus. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/pci/ichlpcib.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/tco.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/tco.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Thu Sep 22 14:41:49 UTC 2022 Modified Files: src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h Log Message: tco(4): Rename lpcib_tco_attach_args -> tco_attach_args. No longer hangs off LPC bus, newer devices hang it off SMBus. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/pci/ichlpcib.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/tco.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/tco.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/ichlpcib.c diff -u src/sys/arch/x86/pci/ichlpcib.c:1.55 src/sys/arch/x86/pci/ichlpcib.c:1.56 --- src/sys/arch/x86/pci/ichlpcib.c:1.55 Thu Sep 22 14:41:26 2022 +++ src/sys/arch/x86/pci/ichlpcib.c Thu Sep 22 14:41:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $ */ +/* $NetBSD: ichlpcib.c,v 1.56 2022/09/22 14:41:49 riastradh Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.56 2022/09/22 14:41:49 riastradh Exp $"); #include #include @@ -633,7 +633,7 @@ static void tcotimer_configure(device_t self) { struct lpcib_softc *sc = device_private(self); - struct lpcib_tco_attach_args arg; + struct tco_attach_args arg; if (sc->sc_has_rcba) arg.ta_version = TCO_VERSION_RCBA; Index: src/sys/arch/x86/pci/tco.c diff -u src/sys/arch/x86/pci/tco.c:1.4 src/sys/arch/x86/pci/tco.c:1.5 --- src/sys/arch/x86/pci/tco.c:1.4 Thu Sep 22 14:41:26 2022 +++ src/sys/arch/x86/pci/tco.c Thu Sep 22 14:41:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $ */ +/* $NetBSD: tco.c,v 1.5 2022/09/22 14:41:49 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.5 2022/09/22 14:41:49 riastradh Exp $"); #include #include @@ -88,7 +88,7 @@ CFATTACH_DECL3_NEW(tco, sizeof(struct tc static int tco_match(device_t parent, cfdata_t match, void *aux) { - struct lpcib_tco_attach_args *ta = aux; + struct tco_attach_args *ta = aux; if (ta->ta_iot == 0) return 0; @@ -108,7 +108,7 @@ static void tco_attach(device_t parent, device_t self, void *aux) { struct tco_softc *sc = device_private(self); - struct lpcib_tco_attach_args *ta = aux; + struct tco_attach_args *ta = aux; uint32_t ioreg; /* Retrieve bus info shared with parent/siblings */ Index: src/sys/arch/x86/pci/tco.h diff -u src/sys/arch/x86/pci/tco.h:1.2 src/sys/arch/x86/pci/tco.h:1.3 --- src/sys/arch/x86/pci/tco.h:1.2 Thu Sep 22 14:41:26 2022 +++ src/sys/arch/x86/pci/tco.h Thu Sep 22 14:41:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tco.h,v 1.2 2022/09/22 14:41:26 riastradh Exp $ */ +/* $NetBSD: tco.h,v 1.3 2022/09/22 14:41:49 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #ifndef _X86_PCI_TCO_H_ #define _X86_PCI_TCO_H_ -struct lpcib_tco_attach_args { +struct tco_attach_args { enum { TCO_VERSION_PCIB = 0, TCO_VERSION_RCBA = 1,
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Thu Sep 22 14:41:26 UTC 2022 Modified Files: src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h Log Message: tco(4): Change has_rcba bit into version number. Will be useful for newer Intel platform controller hubs. No functional change intended. Module ABI is unchanged, although older modules will do something nonseneical when confronted with versions above 1 -- that will require a revbump (but with any luck, it will make life easier for versions above 2 easier once we do that). To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/pci/ichlpcib.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/tco.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/ichlpcib.c diff -u src/sys/arch/x86/pci/ichlpcib.c:1.54 src/sys/arch/x86/pci/ichlpcib.c:1.55 --- src/sys/arch/x86/pci/ichlpcib.c:1.54 Sat Aug 7 16:19:07 2021 +++ src/sys/arch/x86/pci/ichlpcib.c Thu Sep 22 14:41:26 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ichlpcib.c,v 1.54 2021/08/07 16:19:07 thorpej Exp $ */ +/* $NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.54 2021/08/07 16:19:07 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $"); #include #include @@ -635,12 +635,15 @@ tcotimer_configure(device_t self) struct lpcib_softc *sc = device_private(self); struct lpcib_tco_attach_args arg; + if (sc->sc_has_rcba) + arg.ta_version = TCO_VERSION_RCBA; + else + arg.ta_version = TCO_VERSION_PCIB; arg.ta_iot = sc->sc_iot; arg.ta_ioh = sc->sc_ioh; arg.ta_rcbat = sc->sc_rcbat; arg.ta_rcbah = sc->sc_rcbah; - arg.ta_has_rcba = sc->sc_has_rcba; - arg.ta_pcib = &(sc->sc_pcib); + arg.ta_pcib = >sc_pcib; sc->sc_tco = config_found(self, , NULL, CFARGS(.iattr = "tcoichbus")); Index: src/sys/arch/x86/pci/tco.c diff -u src/sys/arch/x86/pci/tco.c:1.3 src/sys/arch/x86/pci/tco.c:1.4 --- src/sys/arch/x86/pci/tco.c:1.3 Wed Sep 21 10:36:14 2022 +++ src/sys/arch/x86/pci/tco.c Thu Sep 22 14:41:26 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tco.c,v 1.3 2022/09/21 10:36:14 riastradh Exp $ */ +/* $NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.3 2022/09/21 10:36:14 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $"); #include #include @@ -63,7 +63,7 @@ struct tco_softc { int sc_armed; unsigned int sc_min_t; unsigned int sc_max_t; - int sc_has_rcba; + int sc_version; }; static int tco_match(device_t, cfdata_t, void *); @@ -90,10 +90,18 @@ tco_match(device_t parent, cfdata_t matc { struct lpcib_tco_attach_args *ta = aux; - if (ta->ta_iot != 0) - return 1; + if (ta->ta_iot == 0) + return 0; - return 0; + switch (ta->ta_version) { + case TCO_VERSION_RCBA: + case TCO_VERSION_PCIB: + break; + default: + return 0; + } + + return 1; } static void @@ -104,13 +112,12 @@ tco_attach(device_t parent, device_t sel uint32_t ioreg; /* Retrieve bus info shared with parent/siblings */ - + sc->sc_version = ta->ta_version; sc->sc_iot = ta->ta_iot; sc->sc_ioh = ta->ta_ioh; sc->sc_rcbat = ta->ta_rcbat; sc->sc_rcbah = ta->ta_rcbah; sc->sc_pcib = ta->ta_pcib; - sc->sc_has_rcba = ta->ta_has_rcba; aprint_normal(": TCO (watchdog) timer configured.\n"); aprint_naive("\n"); @@ -154,12 +161,15 @@ tco_attach(device_t parent, device_t sel * ICH5 or older are limited to 4ticks min and 39ticks max. * 2secs 23secs */ - if (sc->sc_has_rcba) { + switch (sc->sc_version) { + case TCO_VERSION_RCBA: sc->sc_max_t = LPCIB_TCOTIMER2_MAX_TICK; sc->sc_min_t = LPCIB_TCOTIMER2_MIN_TICK; - } else { + break; + case TCO_VERSION_PCIB: sc->sc_max_t = LPCIB_TCOTIMER_MAX_TICK; sc->sc_min_t = LPCIB_TCOTIMER_MIN_TICK; + break; } sc->sc_smw.smw_period = lpcib_tcotimer_tick_to_second(sc->sc_max_t); @@ -230,20 +240,23 @@ tcotimer_setmode(struct sysmon_wdog *smw tcotimer_stop(sc); /* set the timeout, */ - if (sc->sc_has_rcba) { + switch (sc->sc_version) { + case TCO_VERSION_RCBA: /* ICH6 or newer */ ich6period = bus_space_read_2(sc->sc_iot, sc->sc_ioh, LPCIB_TCO_TMR2); ich6period &= 0xfc00; bus_space_write_2(sc->sc_iot, sc->sc_ioh, LPCIB_TCO_TMR2, ich6period | period); - } else { + break; + case TCO_VERSION_PCIB: /* ICH5 or older */ ich5period = bus_space_read_1(sc->sc_iot, sc->sc_ioh, LPCIB_TCO_TMR); ich5period &= 0xc0; bus_space_write_1(sc->sc_iot, sc->sc_ioh, LPCIB_TCO_TMR, ich5period |
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Thu Sep 22 14:41:26 UTC 2022 Modified Files: src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h Log Message: tco(4): Change has_rcba bit into version number. Will be useful for newer Intel platform controller hubs. No functional change intended. Module ABI is unchanged, although older modules will do something nonseneical when confronted with versions above 1 -- that will require a revbump (but with any luck, it will make life easier for versions above 2 easier once we do that). To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/pci/ichlpcib.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/tco.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Wed Sep 21 10:36:14 UTC 2022 Modified Files: src/sys/arch/x86/pci: tco.c Log Message: tco(4): Fix whitespace. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/tco.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/tco.c diff -u src/sys/arch/x86/pci/tco.c:1.2 src/sys/arch/x86/pci/tco.c:1.3 --- src/sys/arch/x86/pci/tco.c:1.2 Sun Aug 30 07:50:34 2015 +++ src/sys/arch/x86/pci/tco.c Wed Sep 21 10:36:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tco.c,v 1.2 2015/08/30 07:50:34 christos Exp $ */ +/* $NetBSD: tco.c,v 1.3 2022/09/21 10:36:14 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.2 2015/08/30 07:50:34 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.3 2022/09/21 10:36:14 riastradh Exp $"); #include #include @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.2 #include "pcibvar.h" -struct tco_softc{ +struct tco_softc { struct sysmon_wdog sc_smw; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -125,7 +125,7 @@ tco_attach(device_t parent, device_t sel ioreg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, LPCIB_SMI_EN); ioreg &= ~LPCIB_SMI_EN_TCO_EN; - /* + /* * Clear the No Reboot (NR) bit. If this fails, enabling the TCO_EN bit * in the SMI_EN register is the last chance. */ @@ -139,7 +139,7 @@ tco_attach(device_t parent, device_t sel /* Reset the watchdog status registers. */ tcotimer_status_reset(sc); - /* + /* * Register the driver with the sysmon watchdog framework. */ sc->sc_smw.smw_name = device_xname(self); @@ -147,7 +147,7 @@ tco_attach(device_t parent, device_t sel sc->sc_smw.smw_setmode = tcotimer_setmode; sc->sc_smw.smw_tickle = tcotimer_tickle; - /* + /* * ICH6 or newer are limited to 2ticks min and 613ticks max. * 1sec 367secs * @@ -225,7 +225,7 @@ tcotimer_setmode(struct sysmon_wdog *smw period = lpcib_tcotimer_second_to_tick(smw->smw_period); if (period < sc->sc_min_t || period > sc->sc_max_t) return EINVAL; - + /* Stop the TCO timer, */ tcotimer_stop(sc); @@ -233,17 +233,17 @@ tcotimer_setmode(struct sysmon_wdog *smw if (sc->sc_has_rcba) { /* ICH6 or newer */ ich6period = bus_space_read_2(sc->sc_iot, sc->sc_ioh, - LPCIB_TCO_TMR2); + LPCIB_TCO_TMR2); ich6period &= 0xfc00; bus_space_write_2(sc->sc_iot, sc->sc_ioh, - LPCIB_TCO_TMR2, ich6period | period); + LPCIB_TCO_TMR2, ich6period | period); } else { /* ICH5 or older */ ich5period = bus_space_read_1(sc->sc_iot, sc->sc_ioh, - LPCIB_TCO_TMR); + LPCIB_TCO_TMR); ich5period &= 0xc0; bus_space_write_1(sc->sc_iot, sc->sc_ioh, - LPCIB_TCO_TMR, ich5period | period); + LPCIB_TCO_TMR, ich5period | period); } /* and start/reload the timer. */ @@ -292,11 +292,11 @@ static void tcotimer_status_reset(struct tco_softc *sc) { bus_space_write_2(sc->sc_iot, sc->sc_ioh, LPCIB_TCO1_STS, - LPCIB_TCO1_STS_TIMEOUT); + LPCIB_TCO1_STS_TIMEOUT); bus_space_write_2(sc->sc_iot, sc->sc_ioh, LPCIB_TCO2_STS, - LPCIB_TCO2_STS_BOOT_STS); + LPCIB_TCO2_STS_BOOT_STS); bus_space_write_2(sc->sc_iot, sc->sc_ioh, LPCIB_TCO2_STS, - LPCIB_TCO2_STS_SECONDS_TO_STS); + LPCIB_TCO2_STS_SECONDS_TO_STS); } /* @@ -324,12 +324,12 @@ tcotimer_disable_noreboot(device_t self) pcireg_t pcireg; pcireg = pci_conf_read(sc->sc_pcib->sc_pc, sc->sc_pcib->sc_tag, - LPCIB_PCI_GEN_STA); + LPCIB_PCI_GEN_STA); if (pcireg & LPCIB_PCI_GEN_STA_NO_REBOOT) { /* TCO timeout reset is disabled; try to enable it */ pcireg &= ~LPCIB_PCI_GEN_STA_NO_REBOOT; pci_conf_write(sc->sc_pcib->sc_pc, sc->sc_pcib->sc_tag, - LPCIB_PCI_GEN_STA, pcireg); + LPCIB_PCI_GEN_STA, pcireg); if (pcireg & LPCIB_PCI_GEN_STA_NO_REBOOT) goto error; } @@ -345,7 +345,7 @@ error: MODULE(MODULE_CLASS_DRIVER, tco, "sysmon_wdog"); #ifdef _MODULE -#include "ioconf.c" +#include "ioconf.c" #endif static int @@ -357,15 +357,15 @@ tco_modcmd(modcmd_t cmd, void *arg) case MODULE_CMD_INIT: #ifdef _MODULE ret = config_init_component(cfdriver_ioconf_tco, - cfattach_ioconf_tco, - cfdata_ioconf_tco); + cfattach_ioconf_tco, + cfdata_ioconf_tco); #endif break; case MODULE_CMD_FINI: #ifdef _MODULE ret = config_fini_component(cfdriver_ioconf_tco, - cfattach_ioconf_tco, - cfdata_ioconf_tco); + cfattach_ioconf_tco, + cfdata_ioconf_tco); #endif break; default:
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: riastradh Date: Wed Sep 21 10:36:14 UTC 2022 Modified Files: src/sys/arch/x86/pci: tco.c Log Message: tco(4): Fix whitespace. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/tco.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Tue Sep 6 01:44:24 UTC 2022 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Fix compile error. Compile test only. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.92 src/sys/arch/x86/pci/pci_machdep.c:1.93 --- src/sys/arch/x86/pci/pci_machdep.c:1.92 Mon Sep 5 14:18:51 2022 +++ src/sys/arch/x86/pci/pci_machdep.c Tue Sep 6 01:44:24 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.92 2022/09/05 14:18:51 riastradh Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.93 2022/09/06 01:44:24 msaitoh Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.92 2022/09/05 14:18:51 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.93 2022/09/06 01:44:24 msaitoh Exp $"); #include #include @@ -1249,8 +1249,13 @@ device_pci_register(device_t dev, void * * framebuffer address? Tough...but this has * probably never worked. */ +#if NGENFB > 0 prop_dictionary_set_bool(dict, "is_console", genfb_is_console()); +#else + prop_dictionary_set_bool(dict, "is_console", + true); +#endif prop_dictionary_set_bool(dict, "clear-screen", false); #if NWSDISPLAY > 0 && NGENFB > 0
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Tue Sep 6 01:44:24 UTC 2022 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Fix compile error. Compile test only. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Wed Apr 27 06:59:26 UTC 2022 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Rename for AMD F15/6X device. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.12 src/sys/arch/x86/pci/amdsmn.c:1.13 --- src/sys/arch/x86/pci/amdsmn.c:1.12 Sat Aug 7 16:19:07 2021 +++ src/sys/arch/x86/pci/amdsmn.c Wed Apr 27 06:59:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.12 2021/08/07 16:19:07 thorpej Exp $ */ +/* $NetBSD: amdsmn.c,v 1.13 2022/04/27 06:59:25 msaitoh Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.12 2021/08/07 16:19:07 thorpej Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.13 2022/04/27 06:59:25 msaitoh Exp $ "); /* * Driver for the AMD Family 15h (model 60+) and 17h CPU @@ -73,7 +73,7 @@ static const struct pciid { uint8_t amdsmn_data_reg; } amdsmn_ids[] = { { - .amdsmn_deviceid = PCI_PRODUCT_AMD_F15_60_RC, + .amdsmn_deviceid = PCI_PRODUCT_AMD_F15_6X_RC, .amdsmn_addr_reg = F15H_SMN_ADDR_REG, .amdsmn_data_reg = F15H_SMN_DATA_REG, },
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Wed Apr 27 06:59:26 UTC 2022 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Rename for AMD F15/6X device. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Wed Oct 27 19:04:04 UTC 2021 Modified Files: src/sys/arch/x86/pci: dwiic_pci.c Log Message: Add more Jasper Lake and Elkhart Lake devices. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/dwiic_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Wed Oct 27 19:04:04 UTC 2021 Modified Files: src/sys/arch/x86/pci: dwiic_pci.c Log Message: Add more Jasper Lake and Elkhart Lake devices. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/dwiic_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/dwiic_pci.c diff -u src/sys/arch/x86/pci/dwiic_pci.c:1.7 src/sys/arch/x86/pci/dwiic_pci.c:1.8 --- src/sys/arch/x86/pci/dwiic_pci.c:1.7 Wed Oct 27 14:53:12 2021 +++ src/sys/arch/x86/pci/dwiic_pci.c Wed Oct 27 19:04:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwiic_pci.c,v 1.7 2021/10/27 14:53:12 msaitoh Exp $ */ +/* $NetBSD: dwiic_pci.c,v 1.8 2021/10/27 19:04:03 msaitoh Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.7 2021/10/27 14:53:12 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.8 2021/10/27 19:04:03 msaitoh Exp $"); #include #include @@ -157,10 +157,20 @@ static const struct device_compatible_en { .id = VIDDID(INTEL, GLK_I2C_5) }, { .id = VIDDID(INTEL, GLK_I2C_6) }, { .id = VIDDID(INTEL, GLK_I2C_7) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_0) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_1) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_2) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_3) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_4) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_5) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_6) }, + { .id = VIDDID(INTEL, EHL_SIO_I2C_7) }, { .id = VIDDID(INTEL, JSL_LPSS_I2C_0) }, { .id = VIDDID(INTEL, JSL_LPSS_I2C_1) }, { .id = VIDDID(INTEL, JSL_LPSS_I2C_2) }, { .id = VIDDID(INTEL, JSL_LPSS_I2C_3) }, + { .id = VIDDID(INTEL, JSL_LPSS_I2C_4) }, + { .id = VIDDID(INTEL, JSL_LPSS_I2C_5) }, PCI_COMPAT_EOL };
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Wed Oct 27 14:53:12 UTC 2021 Modified Files: src/sys/arch/x86/pci: dwiic_pci.c Log Message: Add many Intel I2C devices. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/dwiic_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/dwiic_pci.c diff -u src/sys/arch/x86/pci/dwiic_pci.c:1.6 src/sys/arch/x86/pci/dwiic_pci.c:1.7 --- src/sys/arch/x86/pci/dwiic_pci.c:1.6 Sat Aug 7 16:19:07 2021 +++ src/sys/arch/x86/pci/dwiic_pci.c Wed Oct 27 14:53:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwiic_pci.c,v 1.6 2021/08/07 16:19:07 thorpej Exp $ */ +/* $NetBSD: dwiic_pci.c,v 1.7 2021/10/27 14:53:12 msaitoh Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.6 2021/08/07 16:19:07 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.7 2021/10/27 14:53:12 msaitoh Exp $"); #include #include @@ -65,6 +65,106 @@ struct pci_dwiic_softc { struct acpi_devnode *sc_acpinode; }; +#define VIDDID(a, b) PCI_ID_CODE(PCI_VENDOR_ ## a, PCI_PRODUCT_ ## a ## _ ## b) + +static const struct device_compatible_entry compat_data[] = { + { .id = VIDDID(INTEL, CORE4G_M_S_I2C_0) }, + { .id = VIDDID(INTEL, CORE4G_M_S_I2C_1) }, + { .id = VIDDID(INTEL, 100SERIES_I2C_0) }, + { .id = VIDDID(INTEL, 100SERIES_I2C_1) }, + { .id = VIDDID(INTEL, 100SERIES_I2C_2) }, + { .id = VIDDID(INTEL, 100SERIES_I2C_3) }, + { .id = VIDDID(INTEL, 100SERIES_LP_I2C_0) }, + { .id = VIDDID(INTEL, 100SERIES_LP_I2C_1) }, + { .id = VIDDID(INTEL, 100SERIES_LP_I2C_2) }, + { .id = VIDDID(INTEL, 100SERIES_LP_I2C_3) }, + { .id = VIDDID(INTEL, 100SERIES_LP_I2C_4) }, + { .id = VIDDID(INTEL, 100SERIES_LP_I2C_5) }, + { .id = VIDDID(INTEL, 2HS_I2C_0) }, + { .id = VIDDID(INTEL, 2HS_I2C_1) }, + { .id = VIDDID(INTEL, 2HS_I2C_2) }, + { .id = VIDDID(INTEL, 2HS_I2C_3) }, + { .id = VIDDID(INTEL, 3HS_I2C_0) }, + { .id = VIDDID(INTEL, 3HS_I2C_1) }, + { .id = VIDDID(INTEL, 3HS_I2C_2) }, + { .id = VIDDID(INTEL, 3HS_I2C_3) }, + { .id = VIDDID(INTEL, 3HS_U_I2C_0) }, + { .id = VIDDID(INTEL, 3HS_U_I2C_1) }, + { .id = VIDDID(INTEL, 3HS_U_I2C_2) }, + { .id = VIDDID(INTEL, 3HS_U_I2C_3) }, + { .id = VIDDID(INTEL, 3HS_U_I2C_4) }, + { .id = VIDDID(INTEL, 3HS_U_I2C_5) }, + { .id = VIDDID(INTEL, 4HS_H_I2C_0) }, + { .id = VIDDID(INTEL, 4HS_H_I2C_1) }, + { .id = VIDDID(INTEL, 4HS_H_I2C_2) }, + { .id = VIDDID(INTEL, 4HS_H_I2C_3) }, + { .id = VIDDID(INTEL, 4HS_V_I2C_0) }, + { .id = VIDDID(INTEL, 4HS_V_I2C_1) }, + { .id = VIDDID(INTEL, 4HS_V_I2C_2) }, + { .id = VIDDID(INTEL, 4HS_V_I2C_3) }, + { .id = VIDDID(INTEL, CMTLK_I2C_0) }, /* 4HS LP */ + { .id = VIDDID(INTEL, CMTLK_I2C_1) }, + { .id = VIDDID(INTEL, CMTLK_I2C_2) }, + { .id = VIDDID(INTEL, CMTLK_I2C_3) }, + { .id = VIDDID(INTEL, CMTLK_I2C_4) }, + { .id = VIDDID(INTEL, CMTLK_I2C_5) }, + { .id = VIDDID(INTEL, 495_YU_I2C_0) }, + { .id = VIDDID(INTEL, 495_YU_I2C_1) }, + { .id = VIDDID(INTEL, 495_YU_I2C_2) }, + { .id = VIDDID(INTEL, 495_YU_I2C_3) }, + { .id = VIDDID(INTEL, 495_YU_I2C_4) }, + { .id = VIDDID(INTEL, 495_YU_I2C_5) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_0) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_1) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_2) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_3) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_4) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_5) }, + { .id = VIDDID(INTEL, 5HS_H_I2C_6) }, + { .id = VIDDID(INTEL, 5HS_LP_I2C_0) }, + { .id = VIDDID(INTEL, 5HS_LP_I2C_1) }, + { .id = VIDDID(INTEL, 5HS_LP_I2C_2) }, + { .id = VIDDID(INTEL, 5HS_LP_I2C_3) }, + { .id = VIDDID(INTEL, 5HS_LP_I2C_4) }, + { .id = VIDDID(INTEL, 5HS_LP_I2C_5) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C1) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C2) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C3) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C4) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C5) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C6) }, + { .id = VIDDID(INTEL, BAYTRAIL_SIO_I2C7) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_1) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_2) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_3) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_4) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_5) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_6) }, + { .id = VIDDID(INTEL, BSW_SIO_I2C_7) }, + { .id = VIDDID(INTEL, APL_I2C_0) }, + { .id = VIDDID(INTEL, APL_I2C_1) }, + { .id = VIDDID(INTEL, APL_I2C_2) }, + { .id = VIDDID(INTEL, APL_I2C_3) }, + { .id = VIDDID(INTEL, APL_I2C_4) }, + { .id = VIDDID(INTEL, APL_I2C_5) }, + { .id = VIDDID(INTEL, APL_I2C_6) }, + { .id = VIDDID(INTEL, APL_I2C_7) }, + { .id = VIDDID(INTEL, GLK_I2C_0) }, + { .id = VIDDID(INTEL, GLK_I2C_1) }, + { .id = VIDDID(INTEL, GLK_I2C_2) }, + { .id = VIDDID(INTEL, GLK_I2C_3) }, + { .id = VIDDID(INTEL, GLK_I2C_4) }, + { .id = VIDDID(INTEL, GLK_I2C_5) }, + { .id = VIDDID(INTEL, GLK_I2C_6) }, + { .id = VIDDID(INTEL, GLK_I2C_7) }, +
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Wed Oct 27 14:53:12 UTC 2021 Modified Files: src/sys/arch/x86/pci: dwiic_pci.c Log Message: Add many Intel I2C devices. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/dwiic_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: jmcneill Date: Fri Oct 15 18:51:39 UTC 2021 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Disable MSI and MSI-X support if IAPC_BOOT_ARCH reports that MSI is not supported. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.88 src/sys/arch/x86/pci/pci_machdep.c:1.89 --- src/sys/arch/x86/pci/pci_machdep.c:1.88 Thu Jan 28 01:57:31 2021 +++ src/sys/arch/x86/pci/pci_machdep.c Fri Oct 15 18:51:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.88 2021/01/28 01:57:31 jmcneill Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.89 2021/10/15 18:51:38 jmcneill Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.88 2021/01/28 01:57:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.89 2021/10/15 18:51:38 jmcneill Exp $"); #include #include @@ -534,6 +534,16 @@ pci_attach_hook(device_t parent, device_ aprint_verbose("\n"); aprint_verbose_dev(self, "This pci host does not support MSI-X."); +#if NACPICA > 0 + } else if (acpi_active && + AcpiGbl_FADT.Header.Revision >= 4 && + (AcpiGbl_FADT.BootFlags & ACPI_FADT_NO_MSI) != 0) { + pba->pba_flags &= ~PCI_FLAGS_MSI_OKAY; + pba->pba_flags &= ~PCI_FLAGS_MSIX_OKAY; + aprint_verbose("\n"); + aprint_verbose_dev(self, + "MSI support disabled via ACPI IAPC_BOOT_ARCH flag.\n"); +#endif } else { pba->pba_flags |= PCI_FLAGS_MSI_OKAY; pba->pba_flags |= PCI_FLAGS_MSIX_OKAY;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: jmcneill Date: Fri Oct 15 18:51:39 UTC 2021 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Disable MSI and MSI-X support if IAPC_BOOT_ARCH reports that MSI is not supported. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: hikaru Date: Wed Nov 13 02:55:00 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Disable MSI-X before writing the MSI-X table. That fixes MSI-X interrupt lost on VMware ESXi 6.7 PCI passthrough devices. ok knakahara@ To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: hikaru Date: Wed Nov 13 02:55:00 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Disable MSI-X before writing the MSI-X table. That fixes MSI-X interrupt lost on VMware ESXi 6.7 PCI passthrough devices. ok knakahara@ To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.18 src/sys/arch/x86/pci/msipic.c:1.19 --- src/sys/arch/x86/pci/msipic.c:1.18 Thu Oct 3 18:53:08 2019 +++ src/sys/arch/x86/pci/msipic.c Wed Nov 13 02:54:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $ */ +/* $NetBSD: msipic.c,v 1.19 2019/11/13 02:54:59 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.19 2019/11/13 02:54:59 hikaru Exp $"); #include "opt_intrdebug.h" @@ -548,6 +548,11 @@ msix_addroute(struct pic *pic, struct cp err = pci_get_capability(pc, tag, PCI_CAP_MSIX, , NULL); KASSERT(err != 0); + /* Disable MSI-X before writing MSI-X table */ + ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL); + ctl &= ~PCI_MSIX_CTL_ENABLE; + pci_conf_write(pc, tag, off + PCI_MSIX_CTL, ctl); + entry_base = PCI_MSIX_TABLE_ENTRY_SIZE * msix_vec; /*
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Thu Oct 10 08:55:08 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix kassert failure in vmxnet3_transmit(). Pointed out by ryo@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Thu Oct 10 08:55:08 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix kassert failure in vmxnet3_transmit(). Pointed out by ryo@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.50 src/sys/arch/x86/pci/if_vmx.c:1.51 --- src/sys/arch/x86/pci/if_vmx.c:1.50 Mon Sep 30 07:13:54 2019 +++ src/sys/arch/x86/pci/if_vmx.c Thu Oct 10 08:55:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.50 2019/09/30 07:13:54 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.51 2019/10/10 08:55:08 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.50 2019/09/30 07:13:54 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.51 2019/10/10 08:55:08 knakahara Exp $"); #include #include @@ -3276,7 +3276,9 @@ vmxnet3_transmit(struct ifnet *ifp, stru vmxnet3_transmit_locked(ifp, txq); VMXNET3_TXQ_UNLOCK(txq); } else { + kpreempt_disable(); softint_schedule(txq->vxtxq_si); + kpreempt_enable(); } return 0;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: mrg Date: Fri Oct 4 12:23:37 UTC 2019 Modified Files: src/sys/arch/x86/pci: pcib.c Log Message: add missing break. surely it is not intended to treat viatech devices with non VT82C686A's device id as maybe cyrix pci bridges. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: mrg Date: Fri Oct 4 12:23:37 UTC 2019 Modified Files: src/sys/arch/x86/pci: pcib.c Log Message: add missing break. surely it is not intended to treat viatech devices with non VT82C686A's device id as maybe cyrix pci bridges. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pcib.c diff -u src/sys/arch/x86/pci/pcib.c:1.18 src/sys/arch/x86/pci/pcib.c:1.19 --- src/sys/arch/x86/pci/pcib.c:1.18 Mon Jun 17 06:38:29 2019 +++ src/sys/arch/x86/pci/pcib.c Fri Oct 4 12:23:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pcib.c,v 1.18 2019/06/17 06:38:29 msaitoh Exp $ */ +/* $NetBSD: pcib.c,v 1.19 2019/10/04 12:23:37 mrg Exp $ */ /*- * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.18 2019/06/17 06:38:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19 2019/10/04 12:23:37 mrg Exp $"); #include #include @@ -150,6 +150,7 @@ pcibmatch(device_t parent, cfdata_t matc */ return (0); } + break; /* * The Cyrix cs5530 PCI host bridge does not have a broken * latch on the i8254 clock core, unlike its predecessors
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: tnn Date: Thu Oct 3 18:53:08 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: change bus_space_map to _x86_memio_map Resolves bus space reservation conflict between MI and MD code. Discussion: http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.17 src/sys/arch/x86/pci/msipic.c:1.18 --- src/sys/arch/x86/pci/msipic.c:1.17 Wed Jun 26 10:20:06 2019 +++ src/sys/arch/x86/pci/msipic.c Thu Oct 3 18:53:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $ */ +/* $NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $"); #include "opt_intrdebug.h" @@ -711,7 +711,7 @@ msipic_construct_msix_pic(const struct p flags &= ~BUS_SPACE_MAP_PREFETCHABLE; } bssize = roundup(table_size, PAGE_SIZE); - err = bus_space_map(pa->pa_memt, memaddr + table_offset, bssize, flags, + err = _x86_memio_map(pa->pa_memt, memaddr + table_offset, bssize, flags, ); bstag = pa->pa_memt; #endif @@ -739,8 +739,8 @@ msipic_destruct_msix_pic(struct pic *msi KASSERT(msix_pic->pic_type == PIC_MSIX); msipic = msix_pic->pic_msipic; - bus_space_unmap(msipic->mp_bstag, msipic->mp_bshandle, - msipic->mp_bssize); + _x86_memio_unmap(msipic->mp_bstag, msipic->mp_bshandle, + msipic->mp_bssize, NULL); msipic_destruct_common_msi_pic(msix_pic); }
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: tnn Date: Thu Oct 3 18:53:08 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: change bus_space_map to _x86_memio_map Resolves bus space reservation conflict between MI and MD code. Discussion: http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Sep 30 07:13:54 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix typo in vmxnet3_legacy_intr(). That causes sysctl hw.vmx*.{rx,tx} effect inversely when vmx(4) uses INTx or MSI. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.49 src/sys/arch/x86/pci/if_vmx.c:1.50 --- src/sys/arch/x86/pci/if_vmx.c:1.49 Fri Aug 30 05:03:32 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Sep 30 07:13:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.49 2019/08/30 05:03:32 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.50 2019/09/30 07:13:54 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.49 2019/08/30 05:03:32 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.50 2019/09/30 07:13:54 knakahara Exp $"); #include #include @@ -2513,11 +2513,11 @@ vmxnet3_legacy_intr(void *xsc) vmxnet3_evintr(sc); VMXNET3_RXQ_LOCK(rxq); - rxmore = vmxnet3_rxq_eof(rxq, txlimit); + rxmore = vmxnet3_rxq_eof(rxq, rxlimit); VMXNET3_RXQ_UNLOCK(rxq); VMXNET3_TXQ_LOCK(txq); - txmore = vmxnet3_txq_eof(txq, rxlimit); + txmore = vmxnet3_txq_eof(txq, txlimit); VMXNET3_TXQ_UNLOCK(txq); if (txmore || rxmore) {
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Sep 30 07:13:54 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix typo in vmxnet3_legacy_intr(). That causes sysctl hw.vmx*.{rx,tx} effect inversely when vmx(4) uses INTx or MSI. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Aug 30 05:03:32 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmxnet3_softc.vmx_stats should not count globally. pointed out by hikaru@n.o divide vmxnet3_softc.vmx_stats to each vmxnet3_txqueue and vmxnet3_rxqueue, furthermore make them evcnt. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.48 src/sys/arch/x86/pci/if_vmx.c:1.49 --- src/sys/arch/x86/pci/if_vmx.c:1.48 Mon Aug 19 05:25:38 2019 +++ src/sys/arch/x86/pci/if_vmx.c Fri Aug 30 05:03:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.48 2019/08/19 05:25:38 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.49 2019/08/30 05:03:32 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.48 2019/08/19 05:25:38 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.49 2019/08/30 05:03:32 knakahara Exp $"); #include #include @@ -207,6 +207,8 @@ struct vmxnet3_txqueue { struct evcnt vxtxq_pcqdrop; struct evcnt vxtxq_transmitdef; struct evcnt vxtxq_watchdogto; + struct evcnt vxtxq_defragged; + struct evcnt vxtxq_defrag_failed; }; struct vmxnet3_rxq_stats { @@ -230,6 +232,8 @@ struct vmxnet3_rxqueue { struct evcnt vxrxq_intr; struct evcnt vxrxq_defer; struct evcnt vxrxq_deferreq; + struct evcnt vxrxq_mgetcl_failed; + struct evcnt vxrxq_mbuf_load_failed; }; struct vmxnet3_queue { @@ -244,13 +248,6 @@ struct vmxnet3_queue { struct work vxq_wq_cookie; }; -struct vmxnet3_statistics { - uint32_t vmst_defragged; - uint32_t vmst_defrag_failed; - uint32_t vmst_mgetcl_failed; - uint32_t vmst_mbuf_load_failed; -}; - struct vmxnet3_softc { device_t vmx_dev; struct ethercom vmx_ethercom; @@ -281,7 +278,6 @@ struct vmxnet3_softc { int vmx_nrxdescs; int vmx_max_rxsegs; - struct vmxnet3_statistics vmx_stats; struct evcnt vmx_event_intr; struct evcnt vmx_event_link; struct evcnt vmx_event_txqerror; @@ -395,7 +391,8 @@ int vmxnet3_setup_interface(struct vmxne void vmxnet3_evintr(struct vmxnet3_softc *); bool vmxnet3_txq_eof(struct vmxnet3_txqueue *, u_int); -int vmxnet3_newbuf(struct vmxnet3_softc *, struct vmxnet3_rxring *); +int vmxnet3_newbuf(struct vmxnet3_softc *, struct vmxnet3_rxqueue *, +struct vmxnet3_rxring *); void vmxnet3_rxq_eof_discard(struct vmxnet3_rxqueue *, struct vmxnet3_rxring *, int); void vmxnet3_rxq_discard_chain(struct vmxnet3_rxqueue *); @@ -1971,6 +1968,10 @@ vmxnet3_setup_stats(struct vmxnet3_softc NULL, txq->vxtxq_name, "Deferred transmit"); evcnt_attach_dynamic(>vxtxq_watchdogto, EVCNT_TYPE_MISC, NULL, txq->vxtxq_name, "Watchdog timeount"); + evcnt_attach_dynamic(>vxtxq_defragged, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "m_defrag sucessed"); + evcnt_attach_dynamic(>vxtxq_defrag_failed, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "m_defrag failed"); } for (i = 0; i < sc->vmx_nrxqueues; i++) { @@ -1982,6 +1983,10 @@ vmxnet3_setup_stats(struct vmxnet3_softc NULL, rxq->vxrxq_name, "Handled queue in softint/workqueue"); evcnt_attach_dynamic(>vxrxq_deferreq, EVCNT_TYPE_MISC, NULL, rxq->vxrxq_name, "Requested in softint/workqueue"); + evcnt_attach_dynamic(>vxrxq_mgetcl_failed, EVCNT_TYPE_MISC, + NULL, rxq->vxrxq_name, "MCLGET failed"); + evcnt_attach_dynamic(>vxrxq_mbuf_load_failed, EVCNT_TYPE_MISC, + NULL, rxq->vxrxq_name, "bus_dmamap_load_mbuf failed"); } evcnt_attach_dynamic(>vmx_event_intr, EVCNT_TYPE_INTR, @@ -2017,6 +2022,8 @@ vmxnet3_teardown_stats(struct vmxnet3_so evcnt_detach(>vxtxq_pcqdrop); evcnt_detach(>vxtxq_transmitdef); evcnt_detach(>vxtxq_watchdogto); + evcnt_detach(>vxtxq_defragged); + evcnt_detach(>vxtxq_defrag_failed); } for (i = 0; i < sc->vmx_nrxqueues; i++) { @@ -2025,6 +2032,8 @@ vmxnet3_teardown_stats(struct vmxnet3_so evcnt_detach(>vxrxq_intr); evcnt_detach(>vxrxq_defer); evcnt_detach(>vxrxq_deferreq); + evcnt_detach(>vxrxq_mgetcl_failed); + evcnt_detach(>vxrxq_mbuf_load_failed); } evcnt_detach(>vmx_event_intr); @@ -2154,7 +2163,8 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue * } int -vmxnet3_newbuf(struct vmxnet3_softc *sc, struct vmxnet3_rxring *rxr) +vmxnet3_newbuf(struct vmxnet3_softc *sc, struct vmxnet3_rxqueue *rxq, +struct vmxnet3_rxring *rxr) { struct mbuf *m; struct vmxnet3_rxdesc *rxd; @@ -2180,7 +2190,7 @@ vmxnet3_newbuf(struct vmxnet3_softc *sc, MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - sc->vmx_stats.vmst_mgetcl_failed++; + rxq->vxrxq_mgetcl_failed.ev_count++; m_freem(m); return (ENOBUFS); } @@ -2191,7 +2201,7 @@ vmxnet3_newbuf(struct vmxnet3_softc *sc,
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Aug 30 05:03:32 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmxnet3_softc.vmx_stats should not count globally. pointed out by hikaru@n.o divide vmxnet3_softc.vmx_stats to each vmxnet3_txqueue and vmxnet3_rxqueue, furthermore make them evcnt. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/x86/pci
Hi, On 2019/08/19 14:25, Kengo NAKAHARA wrote: Module Name:src Committed By: knakahara Date: Mon Aug 19 05:25:38 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: add vmx(4) basic statistics counters. Sorry, I have forgotten this TODO in r1.40 commit message. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. I have finished my task for vmx(4), so I think if_vmx.c can be moved to sys/dev/pci/ directory as pointed out by mrg@n.o. However, it would require some htole* codes to become MI correctly. cf. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/vmxnet3/vmxnet3_drv.c?h=v5.3-rc5=115924b6bdc7cc6bf7da5b933b09281e1f4e17a9 It would be required to test on big endian architectures before moving to sys/dev/pci directory. Thanks, -- // Internet Initiative Japan Inc. Device Engineering Section, Product Development Department, Product Division, Technology Unit Kengo NAKAHARA
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Aug 19 05:25:38 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: add vmx(4) basic statistics counters. Sorry, I have forgotten this TODO in r1.40 commit message. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.47 src/sys/arch/x86/pci/if_vmx.c:1.48 --- src/sys/arch/x86/pci/if_vmx.c:1.47 Mon Aug 19 05:23:50 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Aug 19 05:25:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.47 2019/08/19 05:23:50 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.48 2019/08/19 05:25:38 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.47 2019/08/19 05:23:50 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.48 2019/08/19 05:25:38 knakahara Exp $"); #include #include @@ -200,6 +200,13 @@ struct vmxnet3_txqueue { char vxtxq_name[16]; void *vxtxq_si; + + struct evcnt vxtxq_intr; + struct evcnt vxtxq_defer; + struct evcnt vxtxq_deferreq; + struct evcnt vxtxq_pcqdrop; + struct evcnt vxtxq_transmitdef; + struct evcnt vxtxq_watchdogto; }; struct vmxnet3_rxq_stats { @@ -219,6 +226,10 @@ struct vmxnet3_rxqueue { struct vmxnet3_rxq_stats vxrxq_stats; struct vmxnet3_rxq_shared *vxrxq_rs; char vxrxq_name[16]; + + struct evcnt vxrxq_intr; + struct evcnt vxrxq_defer; + struct evcnt vxrxq_deferreq; }; struct vmxnet3_queue { @@ -271,6 +282,12 @@ struct vmxnet3_softc { int vmx_max_rxsegs; struct vmxnet3_statistics vmx_stats; + struct evcnt vmx_event_intr; + struct evcnt vmx_event_link; + struct evcnt vmx_event_txqerror; + struct evcnt vmx_event_rxqerror; + struct evcnt vmx_event_dic; + struct evcnt vmx_event_debug; int vmx_intr_type; int vmx_intr_mask_mode; @@ -349,6 +366,9 @@ void vmxnet3_set_interrupt_idx(struct vm int vmxnet3_setup_interrupts(struct vmxnet3_softc *); int vmxnet3_setup_sysctl(struct vmxnet3_softc *); +int vmxnet3_setup_stats(struct vmxnet3_softc *); +void vmxnet3_teardown_stats(struct vmxnet3_softc *); + int vmxnet3_init_rxq(struct vmxnet3_softc *, int); int vmxnet3_init_txq(struct vmxnet3_softc *, int); int vmxnet3_alloc_rxtx_queues(struct vmxnet3_softc *); @@ -631,6 +651,10 @@ vmxnet3_attach(device_t parent, device_t if (error) return; + error = vmxnet3_setup_stats(sc); + if (error) + return; + sc->vmx_flags |= VMXNET3_FLAG_ATTACHED; } @@ -655,6 +679,7 @@ vmxnet3_detach(device_t self, int flags) if_detach(ifp); } + vmxnet3_teardown_stats(sc); sysctl_teardown(>vmx_sysctllog); vmxnet3_free_interrupts(sc); @@ -1923,6 +1948,93 @@ out: return error; } +int +vmxnet3_setup_stats(struct vmxnet3_softc *sc) +{ + struct vmxnet3_queue *vmxq; + struct vmxnet3_txqueue *txq; + struct vmxnet3_rxqueue *rxq; + int i; + + for (i = 0; i < sc->vmx_ntxqueues; i++) { + vmxq = >vmx_queue[i]; + txq = >vxq_txqueue; + evcnt_attach_dynamic(>vxtxq_intr, EVCNT_TYPE_INTR, + NULL, txq->vxtxq_name, "Interrupt on queue"); + evcnt_attach_dynamic(>vxtxq_defer, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "Handled queue in softint/workqueue"); + evcnt_attach_dynamic(>vxtxq_deferreq, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "Requested in softint/workqueue"); + evcnt_attach_dynamic(>vxtxq_pcqdrop, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "Dropped in pcq"); + evcnt_attach_dynamic(>vxtxq_transmitdef, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "Deferred transmit"); + evcnt_attach_dynamic(>vxtxq_watchdogto, EVCNT_TYPE_MISC, + NULL, txq->vxtxq_name, "Watchdog timeount"); + } + + for (i = 0; i < sc->vmx_nrxqueues; i++) { + vmxq = >vmx_queue[i]; + rxq = >vxq_rxqueue; + evcnt_attach_dynamic(>vxrxq_intr, EVCNT_TYPE_INTR, + NULL, rxq->vxrxq_name, "Interrupt on queue"); + evcnt_attach_dynamic(>vxrxq_defer, EVCNT_TYPE_MISC, + NULL, rxq->vxrxq_name, "Handled queue in softint/workqueue"); + evcnt_attach_dynamic(>vxrxq_deferreq, EVCNT_TYPE_MISC, + NULL, rxq->vxrxq_name, "Requested in softint/workqueue"); + } + + evcnt_attach_dynamic(>vmx_event_intr, EVCNT_TYPE_INTR, + NULL, device_xname(sc->vmx_dev), "Interrupt for other events"); + evcnt_attach_dynamic(>vmx_event_link, EVCNT_TYPE_MISC, + NULL, device_xname(sc->vmx_dev), "Link status event"); + evcnt_attach_dynamic(>vmx_event_txqerror, EVCNT_TYPE_MISC, + NULL, device_xname(sc->vmx_dev), "Tx queue error event"); + evcnt_attach_dynamic(>vmx_event_rxqerror, EVCNT_TYPE_MISC, + NULL, device_xname(sc->vmx_dev), "Rx queue error event"); + evcnt_attach_dynamic(>vmx_event_dic, EVCNT_TYPE_MISC, + NULL, device_xname(sc->vmx_dev), "Device impl change event"); +
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Aug 19 05:25:38 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: add vmx(4) basic statistics counters. Sorry, I have forgotten this TODO in r1.40 commit message. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Aug 19 05:23:50 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: fix panic when vmx(4) is detached. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.46 src/sys/arch/x86/pci/if_vmx.c:1.47 --- src/sys/arch/x86/pci/if_vmx.c:1.46 Thu Aug 1 09:37:34 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Aug 19 05:23:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.46 2019/08/01 09:37:34 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.47 2019/08/19 05:23:50 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.46 2019/08/01 09:37:34 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.47 2019/08/19 05:23:50 knakahara Exp $"); #include #include @@ -859,11 +859,13 @@ vmxnet3_free_interrupts(struct vmxnet3_s int i; workqueue_destroy(sc->vmx_queue_wq); - for (i = 0; i < sc->vmx_nintrs; i++) { + for (i = 0; i < sc->vmx_ntxqueues; i++) { struct vmxnet3_queue *vmxq = >vmx_queue[i]; softint_disestablish(vmxq->vxq_si); vmxq->vxq_si = NULL; + } + for (i = 0; i < sc->vmx_nintrs; i++) { pci_intr_disestablish(pc, sc->vmx_ihs[i]); } pci_intr_release(pc, sc->vmx_intrs, sc->vmx_nintrs);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Aug 19 05:23:50 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: fix panic when vmx(4) is detached. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Tue Aug 6 05:32:44 UTC 2019 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Whitespace fix. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 30 11:16:15 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) can select workqueue for packet processing like ixg(4). To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 30 11:16:15 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) can select workqueue for packet processing like ixg(4). To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.44 src/sys/arch/x86/pci/if_vmx.c:1.45 --- src/sys/arch/x86/pci/if_vmx.c:1.44 Mon Jul 29 10:28:57 2019 +++ src/sys/arch/x86/pci/if_vmx.c Tue Jul 30 11:16:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.45 2019/07/30 11:16:15 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45 2019/07/30 11:16:15 knakahara Exp $"); #include #include @@ -30,6 +30,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1 #include #include #include +#include #include #include @@ -96,6 +97,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1 #define VMXNET3_RX_PROCESS_LIMIT 256 #define VMXNET3_TX_PROCESS_LIMIT 256 +#define VMXNET3_WORKQUEUE_PRI PRI_SOFTNET + /* * IP protocols that we can perform Tx checksum offloading of. */ @@ -225,6 +228,8 @@ struct vmxnet3_queue { struct vmxnet3_rxqueue vxq_rxqueue; void *vxq_si; + bool vxq_workqueue; + struct work vxq_wq_cookie; }; struct vmxnet3_statistics { @@ -291,8 +296,10 @@ struct vmxnet3_softc { u_int vmx_tx_intr_process_limit; u_int vmx_rx_process_limit; u_int vmx_tx_process_limit; - struct sysctllog *vmx_sysctllog; + + bool vmx_txrx_workqueue; + struct workqueue *vmx_queue_wq; }; #define VMXNET3_STAT @@ -378,6 +385,7 @@ bool vmxnet3_rxq_eof(struct vmxnet3_rxqu int vmxnet3_legacy_intr(void *); int vmxnet3_txrxq_intr(void *); void vmxnet3_handle_queue(void *); +void vmxnet3_handle_queue_work(struct work *, void *); int vmxnet3_event_intr(void *); void vmxnet3_txstop(struct vmxnet3_softc *, struct vmxnet3_txqueue *); @@ -849,6 +857,7 @@ vmxnet3_free_interrupts(struct vmxnet3_s pci_chipset_tag_t pc = sc->vmx_pc; int i; + workqueue_destroy(sc->vmx_queue_wq); for (i = 0; i < sc->vmx_nintrs; i++) { struct vmxnet3_queue *vmxq = >vmx_queue[i]; @@ -866,7 +875,7 @@ vmxnet3_setup_msix_interrupts(struct vmx struct vmxnet3_queue *vmxq; pci_intr_handle_t *intr; void **ihs; - int intr_idx, i, use_queues; + int intr_idx, i, use_queues, error; const char *intrstr; char intrbuf[PCI_INTRSTR_LEN]; char xnamebuf[32]; @@ -904,6 +913,15 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxq->vxq_intr_idx = intr_idx; } + snprintf(xnamebuf, MAXCOMLEN, "%s_tx_rx", device_xname(sc->vmx_dev)); + error = workqueue_create(>vmx_queue_wq, xnamebuf, + vmxnet3_handle_queue_work, sc, VMXNET3_WORKQUEUE_PRI, IPL_NET, + WQ_PERCPU | WQ_MPSAFE); + if (error) { + aprint_error_dev(sc->vmx_dev, "workqueue_create failed\n"); + return (-1); + } + sc->vmx_txrx_workqueue = false; intrstr = pci_intr_string(pc, *intr, intrbuf, sizeof(intrbuf)); @@ -1839,6 +1857,12 @@ vmxnet3_setup_sysctl(struct vmxnet3_soft NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL); if (error) goto out; + error = sysctl_createv(log, 0, , NULL, + CTLFLAG_READWRITE, CTLTYPE_BOOL, "txrx_workqueue", + SYSCTL_DESCR("Use workqueue for packet processing"), + NULL, 0, >vmx_txrx_workqueue, 0, CTL_CREATE, CTL_EOL); + if (error) + goto out; error = sysctl_createv(log, 0, , , 0, CTLTYPE_NODE, "rx", @@ -2305,6 +2329,18 @@ nextp: return more; } +static inline void +vmxnet3_sched_handle_queue(struct vmxnet3_softc *sc, struct vmxnet3_queue *vmxq) +{ + + if (vmxq->vxq_workqueue) { + workqueue_enqueue(sc->vmx_queue_wq, >vxq_wq_cookie, + curcpu()); + } else { + softint_schedule(vmxq->vxq_si); + } +} + int vmxnet3_legacy_intr(void *xsc) { @@ -2339,7 +2375,7 @@ vmxnet3_legacy_intr(void *xsc) VMXNET3_TXQ_UNLOCK(txq); if (txmore || rxmore) { - softint_schedule(sc->vmx_queue[0].vxq_si); + vmxnet3_sched_handle_queue(sc, >vmx_queue[0]); } else { if_schedule_deferred_start(>vmx_ethercom.ec_if); vmxnet3_enable_all_intrs(sc); @@ -2363,6 +2399,7 @@ vmxnet3_txrxq_intr(void *xvmxq) sc = txq->vxtxq_sc; txlimit = sc->vmx_tx_intr_process_limit; rxlimit = sc->vmx_rx_intr_process_limit; + vmxq->vxq_workqueue = sc->vmx_txrx_workqueue; if (sc->vmx_intr_mask_mode == VMXNET3_IMM_ACTIVE) vmxnet3_disable_intr(sc, vmxq->vxq_intr_idx); @@ -2376,7 +2413,7 @@ vmxnet3_txrxq_intr(void *xvmxq) VMXNET3_RXQ_UNLOCK(rxq); if (txmore || rxmore) { - softint_schedule(vmxq->vxq_si); + vmxnet3_sched_handle_queue(sc, vmxq); } else { /* for ALTQ */ if (vmxq->vxq_id
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 10:28:58 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: make vmx(4)'s *_process_limit tunable. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 10:28:58 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: make vmx(4)'s *_process_limit tunable. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.43 src/sys/arch/x86/pci/if_vmx.c:1.44 --- src/sys/arch/x86/pci/if_vmx.c:1.43 Mon Jul 29 10:24:18 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Jul 29 10:28:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $"); #include #include @@ -291,6 +291,8 @@ struct vmxnet3_softc { u_int vmx_tx_intr_process_limit; u_int vmx_rx_process_limit; u_int vmx_tx_process_limit; + + struct sysctllog *vmx_sysctllog; }; #define VMXNET3_STAT @@ -337,6 +339,7 @@ int vmxnet3_setup_msi_interrupt(struct v int vmxnet3_setup_legacy_interrupt(struct vmxnet3_softc *); void vmxnet3_set_interrupt_idx(struct vmxnet3_softc *); int vmxnet3_setup_interrupts(struct vmxnet3_softc *); +int vmxnet3_setup_sysctl(struct vmxnet3_softc *); int vmxnet3_init_rxq(struct vmxnet3_softc *, int); int vmxnet3_init_txq(struct vmxnet3_softc *, int); @@ -615,6 +618,10 @@ vmxnet3_attach(device_t parent, device_t if (error) return; + error = vmxnet3_setup_sysctl(sc); + if (error) + return; + sc->vmx_flags |= VMXNET3_FLAG_ATTACHED; } @@ -639,6 +646,8 @@ vmxnet3_detach(device_t self, int flags) if_detach(ifp); } + sysctl_teardown(>vmx_sysctllog); + vmxnet3_free_interrupts(sc); vmxnet3_free_data(sc); @@ -1813,6 +1822,69 @@ vmxnet3_setup_interface(struct vmxnet3_s return (0); } +int +vmxnet3_setup_sysctl(struct vmxnet3_softc *sc) +{ + const char *devname; + struct sysctllog **log; + const struct sysctlnode *rnode, *rxnode, *txnode; + int error; + + log = >vmx_sysctllog; + devname = device_xname(sc->vmx_dev); + + error = sysctl_createv(log, 0, NULL, , + 0, CTLTYPE_NODE, devname, + SYSCTL_DESCR("vmxnet3 information and settings"), + NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL); + if (error) + goto out; + + error = sysctl_createv(log, 0, , , + 0, CTLTYPE_NODE, "rx", + SYSCTL_DESCR("vmxnet3 information and settings for Rx"), + NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL); + if (error) + goto out; + error = sysctl_createv(log, 0, , NULL, + CTLFLAG_READWRITE, CTLTYPE_INT, "intr_process_limit", + SYSCTL_DESCR("max number of Rx packets to process for interrupt processing"), + NULL, 0, >vmx_rx_intr_process_limit, 0, CTL_CREATE, CTL_EOL); + if (error) + goto out; + error = sysctl_createv(log, 0, , NULL, + CTLFLAG_READWRITE, CTLTYPE_INT, "process_limit", + SYSCTL_DESCR("max number of Rx packets to process for deferred processing"), + NULL, 0, >vmx_rx_process_limit, 0, CTL_CREATE, CTL_EOL); + if (error) + goto out; + + error = sysctl_createv(log, 0, , , + 0, CTLTYPE_NODE, "tx", + SYSCTL_DESCR("vmxnet3 information and settings for Tx"), + NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL); + if (error) + goto out; + error = sysctl_createv(log, 0, , NULL, + CTLFLAG_READWRITE, CTLTYPE_INT, "intr_process_limit", + SYSCTL_DESCR("max number of Tx packets to process for interrupt processing"), + NULL, 0, >vmx_tx_intr_process_limit, 0, CTL_CREATE, CTL_EOL); + if (error) + goto out; + error = sysctl_createv(log, 0, , NULL, + CTLFLAG_READWRITE, CTLTYPE_INT, "process_limit", + SYSCTL_DESCR("max number of Tx packets to process for deferred processing"), + NULL, 0, >vmx_tx_process_limit, 0, CTL_CREATE, CTL_EOL); + +out: + if (error) { + aprint_error_dev(sc->vmx_dev, + "unable to create sysctl node\n"); + sysctl_teardown(log); + } + return error; +} + void vmxnet3_evintr(struct vmxnet3_softc *sc) {
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 10:24:18 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) uses deferred interrupt handlering like ixg(4). To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.42 src/sys/arch/x86/pci/if_vmx.c:1.43 --- src/sys/arch/x86/pci/if_vmx.c:1.42 Mon Jul 29 09:45:16 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Jul 29 10:24:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $"); #include #include @@ -83,6 +83,20 @@ __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1 #define VMXNET3_WATCHDOG_TIMEOUT 5 /* + * Default value for vmx_intr_{rx,tx}_process_limit which is used for + * max number of packets to process for interrupt handler + */ +#define VMXNET3_RX_INTR_PROCESS_LIMIT 0U +#define VMXNET3_TX_INTR_PROCESS_LIMIT 256 + +/* + * Default value for vmx_{rx,tx}_process_limit which is used for + * max number of packets to process for deferred processing + */ +#define VMXNET3_RX_PROCESS_LIMIT 256 +#define VMXNET3_TX_PROCESS_LIMIT 256 + +/* * IP protocols that we can perform Tx checksum offloading of. */ #define VMXNET3_CSUM_OFFLOAD \ @@ -209,6 +223,8 @@ struct vmxnet3_queue { struct vmxnet3_txqueue vxq_txqueue; struct vmxnet3_rxqueue vxq_rxqueue; + + void *vxq_si; }; struct vmxnet3_statistics { @@ -270,6 +286,11 @@ struct vmxnet3_softc { int vmx_max_ntxqueues; int vmx_max_nrxqueues; uint8_t vmx_lladdr[ETHER_ADDR_LEN]; + + u_int vmx_rx_intr_process_limit; + u_int vmx_tx_intr_process_limit; + u_int vmx_rx_process_limit; + u_int vmx_tx_process_limit; }; #define VMXNET3_STAT @@ -342,7 +363,7 @@ void vmxnet3_free_data(struct vmxnet3_so int vmxnet3_setup_interface(struct vmxnet3_softc *); void vmxnet3_evintr(struct vmxnet3_softc *); -void vmxnet3_txq_eof(struct vmxnet3_txqueue *); +bool vmxnet3_txq_eof(struct vmxnet3_txqueue *, u_int); int vmxnet3_newbuf(struct vmxnet3_softc *, struct vmxnet3_rxring *); void vmxnet3_rxq_eof_discard(struct vmxnet3_rxqueue *, struct vmxnet3_rxring *, int); @@ -350,9 +371,10 @@ void vmxnet3_rxq_discard_chain(struct vm void vmxnet3_rx_csum(struct vmxnet3_rxcompdesc *, struct mbuf *); void vmxnet3_rxq_input(struct vmxnet3_rxqueue *, struct vmxnet3_rxcompdesc *, struct mbuf *); -void vmxnet3_rxq_eof(struct vmxnet3_rxqueue *); +bool vmxnet3_rxq_eof(struct vmxnet3_rxqueue *, u_int); int vmxnet3_legacy_intr(void *); int vmxnet3_txrxq_intr(void *); +void vmxnet3_handle_queue(void *); int vmxnet3_event_intr(void *); void vmxnet3_txstop(struct vmxnet3_softc *, struct vmxnet3_txqueue *); @@ -819,6 +841,10 @@ vmxnet3_free_interrupts(struct vmxnet3_s int i; for (i = 0; i < sc->vmx_nintrs; i++) { + struct vmxnet3_queue *vmxq = >vmx_queue[i]; + + softint_disestablish(vmxq->vxq_si); + vmxq->vxq_si = NULL; pci_intr_disestablish(pc, sc->vmx_ihs[i]); } pci_intr_release(pc, sc->vmx_intrs, sc->vmx_nintrs); @@ -859,6 +885,14 @@ vmxnet3_setup_msix_interrupts(struct vmx } aprint_normal_dev(sc->vmx_dev, "txrx interrupting at %s\n", intrstr); + vmxq->vxq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE, + vmxnet3_handle_queue, vmxq); + if (vmxq->vxq_si == NULL) { + aprint_error_dev(sc->vmx_dev, + "softint_establish for vxq_si failed\n"); + return (-1); + } + vmxq->vxq_intr_idx = intr_idx; } @@ -886,6 +920,7 @@ vmxnet3_setup_msi_interrupt(struct vmxne pci_chipset_tag_t pc = sc->vmx_pa->pa_pc; pci_intr_handle_t *intr; void **ihs; + struct vmxnet3_queue *vmxq; int i; const char *intrstr; char intrbuf[PCI_INTRSTR_LEN]; @@ -893,6 +928,7 @@ vmxnet3_setup_msi_interrupt(struct vmxne intr = >vmx_intrs[0]; ihs = sc->vmx_ihs; + vmxq = >vmx_queue[0]; intrstr = pci_intr_string(pc, *intr, intrbuf, sizeof(intrbuf)); @@ -907,6 +943,14 @@ vmxnet3_setup_msi_interrupt(struct vmxne } aprint_normal_dev(sc->vmx_dev, "interrupting at %s\n", intrstr); + vmxq->vxq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE, + vmxnet3_handle_queue, vmxq); + if (vmxq->vxq_si == NULL) { + aprint_error_dev(sc->vmx_dev, + "softint_establish for vxq_si failed\n"); + return (-1); + } + for (i = 0; i < MIN(sc->vmx_nrxqueues, sc->vmx_nrxqueues); i++) sc->vmx_queue[i].vxq_intr_idx = 0; sc->vmx_event_intr_idx = 0; @@ -920,6 +964,7 @@ vmxnet3_setup_legacy_interrupt(struct vm pci_chipset_tag_t pc =
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 10:24:18 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) uses deferred interrupt handlering like ixg(4). To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 09:45:16 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix missing NULL check after softint_establish(). To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 09:45:16 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix missing NULL check after softint_establish(). To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.41 src/sys/arch/x86/pci/if_vmx.c:1.42 --- src/sys/arch/x86/pci/if_vmx.c:1.41 Mon Jul 29 02:20:59 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Jul 29 09:45:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.41 2019/07/29 02:20:59 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.41 2019/07/29 02:20:59 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $"); #include #include @@ -1046,6 +1046,12 @@ vmxnet3_init_txq(struct vmxnet3_softc *s txq->vxtxq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE, vmxnet3_deferred_transmit, txq); + if (txq->vxtxq_si == NULL) { + mutex_obj_free(txq->vxtxq_mtx); + aprint_error_dev(sc->vmx_dev, + "softint_establish for vxtxq_si failed\n"); + return ENOMEM; + } txr->vxtxr_ndesc = sc->vmx_ntxdescs; txr->vxtxr_txbuf = kmem_zalloc(txr->vxtxr_ndesc *
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 02:20:59 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Join Tx interrupt handler and Rx interrupt handler of vmx(4). That can reduce interrupt resources. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.40 src/sys/arch/x86/pci/if_vmx.c:1.41 --- src/sys/arch/x86/pci/if_vmx.c:1.40 Wed Jul 24 10:17:52 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Jul 29 02:20:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.40 2019/07/24 10:17:52 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.41 2019/07/29 02:20:59 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.40 2019/07/24 10:17:52 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.41 2019/07/29 02:20:59 knakahara Exp $"); #include #include @@ -173,8 +173,6 @@ struct vmxnet3_txq_stats { struct vmxnet3_txqueue { kmutex_t *vxtxq_mtx; struct vmxnet3_softc *vxtxq_sc; - int vxtxq_id; - int vxtxq_intr_idx; int vxtxq_watchdog; pcq_t *vxtxq_interq; struct vmxnet3_txring vxtxq_cmd_ring; @@ -196,8 +194,6 @@ struct vmxnet3_rxq_stats { struct vmxnet3_rxqueue { kmutex_t *vxrxq_mtx; struct vmxnet3_softc *vxrxq_sc; - int vxrxq_id; - int vxrxq_intr_idx; struct mbuf *vxrxq_mhead; struct mbuf *vxrxq_mtail; struct vmxnet3_rxring vxrxq_cmd_ring[VMXNET3_RXRINGS_PERQ]; @@ -207,6 +203,14 @@ struct vmxnet3_rxqueue { char vxrxq_name[16]; }; +struct vmxnet3_queue { + int vxq_id; + int vxq_intr_idx; + + struct vmxnet3_txqueue vxq_txqueue; + struct vmxnet3_rxqueue vxq_rxqueue; +}; + struct vmxnet3_statistics { uint32_t vmst_defragged; uint32_t vmst_defrag_failed; @@ -224,8 +228,7 @@ struct vmxnet3_softc { #define VMXNET3_FLAG_RSS (1 << 1) #define VMXNET3_FLAG_ATTACHED (1 << 2) - struct vmxnet3_txqueue *vmx_txq; - struct vmxnet3_rxqueue *vmx_rxq; + struct vmxnet3_queue *vmx_queue; struct pci_attach_args *vmx_pa; pci_chipset_tag_t vmx_pc; @@ -349,8 +352,7 @@ void vmxnet3_rxq_input(struct vmxnet3_rx struct vmxnet3_rxcompdesc *, struct mbuf *); void vmxnet3_rxq_eof(struct vmxnet3_rxqueue *); int vmxnet3_legacy_intr(void *); -int vmxnet3_txq_intr(void *); -int vmxnet3_rxq_intr(void *); +int vmxnet3_txrxq_intr(void *); int vmxnet3_event_intr(void *); void vmxnet3_txstop(struct vmxnet3_softc *, struct vmxnet3_txqueue *); @@ -534,6 +536,7 @@ vmxnet3_attach(device_t parent, device_t struct pci_attach_args *pa = aux; pcireg_t preg; int error; + int candidate; sc->vmx_dev = self; sc->vmx_pa = pa; @@ -552,10 +555,10 @@ vmxnet3_attach(device_t parent, device_t sc->vmx_mtx = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET); callout_init(>vmx_tick, CALLOUT_MPSAFE); - sc->vmx_max_ntxqueues = - vmxnet3_calc_queue_size(MIN(VMXNET3_MAX_TX_QUEUES, ncpu)); - sc->vmx_max_nrxqueues = - vmxnet3_calc_queue_size(MIN(VMXNET3_MAX_RX_QUEUES, ncpu)); + candidate = MIN(MIN(VMXNET3_MAX_TX_QUEUES, VMXNET3_MAX_RX_QUEUES), + ncpu); + sc->vmx_max_ntxqueues = sc->vmx_max_nrxqueues = + vmxnet3_calc_queue_size(candidate); sc->vmx_ntxdescs = 512; sc->vmx_nrxdescs = 256; sc->vmx_max_rxsegs = VMXNET3_MAX_RX_SEGS; @@ -723,7 +726,7 @@ vmxnet3_alloc_msix_interrupts(struct vmx return (1); /* Allocate an additional vector for the events interrupt. */ - required = sc->vmx_max_nrxqueues + sc->vmx_max_ntxqueues + 1; + required = MIN(sc->vmx_max_ntxqueues, sc->vmx_max_nrxqueues) + 1; if (pci_msix_count(pa->pa_pc, pa->pa_tag) < required) return (1); @@ -825,11 +828,10 @@ int vmxnet3_setup_msix_interrupts(struct vmxnet3_softc *sc) { pci_chipset_tag_t pc = sc->vmx_pa->pa_pc; - struct vmxnet3_txqueue *txq; - struct vmxnet3_rxqueue *rxq; + struct vmxnet3_queue *vmxq; pci_intr_handle_t *intr; void **ihs; - int intr_idx, i; + int intr_idx, i, use_queues; const char *intrstr; char intrbuf[PCI_INTRSTR_LEN]; char xnamebuf[32]; @@ -838,44 +840,26 @@ vmxnet3_setup_msix_interrupts(struct vmx intr_idx = 0; ihs = sc->vmx_ihs; - for (i = 0; i < sc->vmx_ntxqueues; i++, intr++, ihs++, intr_idx++) { - snprintf(xnamebuf, 32, "%s: tx %d", device_xname(sc->vmx_dev), i); + /* See vmxnet3_alloc_msix_interrupts() */ + use_queues = MIN(sc->vmx_max_ntxqueues, sc->vmx_max_nrxqueues); + for (i = 0; i < use_queues; i++, intr++, ihs++, intr_idx++) { + snprintf(xnamebuf, 32, "%s: txrx %d", device_xname(sc->vmx_dev), i); - txq = >vmx_txq[i]; + vmxq = >vmx_queue[i]; intrstr = pci_intr_string(pc, *intr, intrbuf, sizeof(intrbuf)); pci_intr_setattr(pc, intr, PCI_INTR_MPSAFE, true); *ihs = pci_intr_establish_xname(pc, *intr, IPL_NET, - vmxnet3_txq_intr, txq,
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 29 02:20:59 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Join Tx interrupt handler and Rx interrupt handler of vmx(4). That can reduce interrupt resources. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Wed Jul 24 10:17:52 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) support if_transmit and Tx multiqueue (2/2). Fix Tx interrupt handler. I tested on ESXi 5.5. TODO: add statistics counters To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Wed Jul 24 10:13:14 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) support if_transmit and Tx multiqueue (1/2) Implemented Tx processing only. Fix Tx interrupt handler later. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 23 04:50:05 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) can be detached now. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 23 04:50:05 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) can be detached now. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.36 src/sys/arch/x86/pci/if_vmx.c:1.37 --- src/sys/arch/x86/pci/if_vmx.c:1.36 Mon Jul 22 06:52:06 2019 +++ src/sys/arch/x86/pci/if_vmx.c Tue Jul 23 04:50:05 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.36 2019/07/22 06:52:06 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.37 2019/07/23 04:50:05 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.36 2019/07/22 06:52:06 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.37 2019/07/23 04:50:05 knakahara Exp $"); #include #include @@ -223,6 +223,7 @@ struct vmxnet3_softc { struct vmxnet3_rxqueue *vmx_rxq; struct pci_attach_args *vmx_pa; + pci_chipset_tag_t vmx_pc; bus_space_tag_t vmx_iot0; bus_space_tag_t vmx_iot1; @@ -528,6 +529,7 @@ vmxnet3_attach(device_t parent, device_t sc->vmx_dev = self; sc->vmx_pa = pa; + sc->vmx_pc = pa->pa_pc; if (pci_dma64_available(pa)) sc->vmx_dmat = pa->pa_dmat64; else @@ -802,7 +804,7 @@ vmxnet3_alloc_interrupts(struct vmxnet3_ void vmxnet3_free_interrupts(struct vmxnet3_softc *sc) { - pci_chipset_tag_t pc = sc->vmx_pa->pa_pc; + pci_chipset_tag_t pc = sc->vmx_pc; int i; for (i = 0; i < sc->vmx_nintrs; i++) {
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Mon Jul 22 06:52:06 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: remove unnecessary NULL check after kmem_zalloc(KM_SLEEP) To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Jul 19 08:49:44 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) can be set IFEF_MPSAFE now. I tested bidirectional forwarding with some ioctls. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.34 src/sys/arch/x86/pci/if_vmx.c:1.35 --- src/sys/arch/x86/pci/if_vmx.c:1.34 Fri Jul 19 08:46:32 2019 +++ src/sys/arch/x86/pci/if_vmx.c Fri Jul 19 08:49:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.34 2019/07/19 08:46:32 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.35 2019/07/19 08:49:44 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.34 2019/07/19 08:46:32 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.35 2019/07/19 08:49:44 knakahara Exp $"); #include #include @@ -1705,6 +1705,7 @@ vmxnet3_setup_interface(struct vmxnet3_s strlcpy(ifp->if_xname, device_xname(sc->vmx_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; + ifp->if_extflags = IFEF_MPSAFE; ifp->if_ioctl = vmxnet3_ioctl; ifp->if_start = vmxnet3_start; ifp->if_watchdog = NULL;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Jul 19 08:49:44 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) can be set IFEF_MPSAFE now. I tested bidirectional forwarding with some ioctls. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Jul 19 08:46:32 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Store IFF_ALLMULTI in ec->ec_flags instead of ifp->if_flags. See such as if_wm.c:1.636. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.33 src/sys/arch/x86/pci/if_vmx.c:1.34 --- src/sys/arch/x86/pci/if_vmx.c:1.33 Fri Jul 19 08:31:41 2019 +++ src/sys/arch/x86/pci/if_vmx.c Fri Jul 19 08:46:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.33 2019/07/19 08:31:41 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.34 2019/07/19 08:46:32 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.33 2019/07/19 08:31:41 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.34 2019/07/19 08:46:32 knakahara Exp $"); #include #include @@ -2820,7 +2820,9 @@ vmxnet3_set_rxfilter(struct vmxnet3_soft uint8_t *p; ds->mcast_tablelen = 0; - CLR(ifp->if_flags, IFF_ALLMULTI); + ETHER_LOCK(ec); + CLR(ec->ec_flags, ETHER_F_ALLMULTI); + ETHER_UNLOCK(ec); /* * Always accept broadcast frames. @@ -2864,7 +2866,9 @@ vmxnet3_set_rxfilter(struct vmxnet3_soft goto setit; allmulti: - SET(ifp->if_flags, IFF_ALLMULTI); + ETHER_LOCK(ec); + SET(ec->ec_flags, ETHER_F_ALLMULTI); + ETHER_UNLOCK(ec); SET(mode, (VMXNET3_RXMODE_ALLMULTI | VMXNET3_RXMODE_MCAST)); if (ifp->if_flags & IFF_PROMISC) SET(mode, VMXNET3_RXMODE_PROMISC);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Jul 19 08:46:32 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Store IFF_ALLMULTI in ec->ec_flags instead of ifp->if_flags. See such as if_wm.c:1.636. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Jul 19 08:31:41 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) enable jumbo frame. I tested 1600 mtu to/from Linux vmxnet3. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.32 src/sys/arch/x86/pci/if_vmx.c:1.33 --- src/sys/arch/x86/pci/if_vmx.c:1.32 Tue Jul 16 10:12:10 2019 +++ src/sys/arch/x86/pci/if_vmx.c Fri Jul 19 08:31:41 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.32 2019/07/16 10:12:10 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.33 2019/07/19 08:31:41 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.32 2019/07/16 10:12:10 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.33 2019/07/19 08:31:41 knakahara Exp $"); #include #include @@ -1721,7 +1721,7 @@ vmxnet3_setup_interface(struct vmxnet3_s sc->vmx_ethercom.ec_if.if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6; sc->vmx_ethercom.ec_capabilities |= - ETHERCAP_VLAN_MTU | ETHERCAP_VLAN_HWTAGGING; + ETHERCAP_VLAN_MTU | ETHERCAP_VLAN_HWTAGGING | ETHERCAP_JUMBO_MTU; sc->vmx_ethercom.ec_capenable |= ETHERCAP_VLAN_HWTAGGING; IFQ_SET_MAXLEN(>if_snd, sc->vmx_ntxdescs);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Jul 19 08:31:41 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: vmx(4) enable jumbo frame. I tested 1600 mtu to/from Linux vmxnet3. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Thu Jul 18 12:04:16 UTC 2019 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Use unsigned to fix compile error on i386. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.4 src/sys/arch/x86/pci/amdsmn.c:1.5 --- src/sys/arch/x86/pci/amdsmn.c:1.4 Thu Jul 18 08:53:41 2019 +++ src/sys/arch/x86/pci/amdsmn.c Thu Jul 18 12:04:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.4 2019/07/18 08:53:41 msaitoh Exp $ */ +/* $NetBSD: amdsmn.c,v 1.5 2019/07/18 12:04:16 msaitoh Exp $ */ /*- * Copyright (c) 2017 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.4 2019/07/18 08:53:41 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5 2019/07/18 12:04:16 msaitoh Exp $ "); /* * Driver for the AMD Family 17h CPU System Management Network. @@ -83,12 +83,12 @@ static int amdsmn_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; - int i; + unsigned int i; if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD) return 0; - for (i = 0; i < __arraycount(amdsmn_ids); i++) + for (i = 0; i < __arraycount(amdsmn_ids); i++) if (PCI_PRODUCT(pa->pa_id) == amdsmn_ids[i].amdsmn_deviceid) return 2;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Thu Jul 18 12:04:16 UTC 2019 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Use unsigned to fix compile error on i386. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Thu Jul 18 08:53:41 UTC 2019 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Add support for Ryzen 2xxx and 3xxx. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.3 src/sys/arch/x86/pci/amdsmn.c:1.4 --- src/sys/arch/x86/pci/amdsmn.c:1.3 Sat Jan 27 21:24:30 2018 +++ src/sys/arch/x86/pci/amdsmn.c Thu Jul 18 08:53:41 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.3 2018/01/27 21:24:30 kardel Exp $ */ +/* $NetBSD: amdsmn.c,v 1.4 2019/07/18 08:53:41 msaitoh Exp $ */ /*- * Copyright (c) 2017 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3 2018/01/27 21:24:30 kardel Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.4 2019/07/18 08:53:41 msaitoh Exp $ "); /* * Driver for the AMD Family 17h CPU System Management Network. @@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1 #define SMN_ADDR_REG 0x60 #define SMN_DATA_REG 0x64 -#define AMD_17H_MANAGEMENT_NETWORK_PCI_ID 0x14501022 struct amdsmn_softc { kmutex_t smn_lock; @@ -63,6 +62,14 @@ struct amdsmn_softc { pcitag_t pcitag; }; +static const struct pciid { + uint16_t amdsmn_deviceid; +} amdsmn_ids[] = { + { PCI_PRODUCT_AMD_F17_RC }, + { PCI_PRODUCT_AMD_F17_1X_RC }, + { PCI_PRODUCT_AMD_F17_7X_RC }, +}; + static int amdsmn_match(device_t, cfdata_t, void *); static void amdsmn_attach(device_t, device_t, void *); static int amdsmn_rescan(device_t, const char *, const int *); @@ -76,8 +83,16 @@ static int amdsmn_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; - - return pa->pa_id == AMD_17H_MANAGEMENT_NETWORK_PCI_ID ? 2 : 0; + int i; + + if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD) + return 0; + + for (i = 0; i < __arraycount(amdsmn_ids); i++) + if (PCI_PRODUCT(pa->pa_id) == amdsmn_ids[i].amdsmn_deviceid) + return 2; + + return 0; } static int
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Thu Jul 18 08:53:41 UTC 2019 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Add support for Ryzen 2xxx and 3xxx. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/amdsmn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 16 10:12:10 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix vmx(4) MTU setting. Advised by hikaru@n.o and msaitoh@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 16 10:12:10 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Fix vmx(4) MTU setting. Advised by hikaru@n.o and msaitoh@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.31 src/sys/arch/x86/pci/if_vmx.c:1.32 --- src/sys/arch/x86/pci/if_vmx.c:1.31 Tue Jul 16 10:01:23 2019 +++ src/sys/arch/x86/pci/if_vmx.c Tue Jul 16 10:12:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.31 2019/07/16 10:01:23 knakahara Exp $ */ +/* $NetBSD: if_vmx.c,v 1.32 2019/07/16 10:12:10 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.31 2019/07/16 10:01:23 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.32 2019/07/16 10:12:10 knakahara Exp $"); #include #include @@ -372,7 +372,6 @@ void vmxnet3_start_locked(struct ifnet * void vmxnet3_start(struct ifnet *); void vmxnet3_set_rxfilter(struct vmxnet3_softc *); -int vmxnet3_change_mtu(struct vmxnet3_softc *, int); int vmxnet3_ioctl(struct ifnet *, u_long, void *); int vmxnet3_ifflags_cb(struct ethercom *); @@ -2877,18 +2876,6 @@ setit: } int -vmxnet3_change_mtu(struct vmxnet3_softc *sc, int mtu) -{ - - if (mtu < VMXNET3_MIN_MTU || mtu > VMXNET3_MAX_MTU) - return EINVAL; - - vmxnet3_init_locked(sc); - - return 0; -} - -int vmxnet3_ioctl(struct ifnet *ifp, u_long cmd, void *data) { struct vmxnet3_softc *sc = ifp->if_softc; @@ -2896,13 +2883,20 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long int s, error = 0; switch (cmd) { - case SIOCSIFMTU: - if (ifp->if_mtu != ifr->ifr_mtu) { - VMXNET3_CORE_LOCK(sc); - error = vmxnet3_change_mtu(sc, ifr->ifr_mtu); - VMXNET3_CORE_UNLOCK(sc); + case SIOCSIFMTU: { + int nmtu = ifr->ifr_mtu; + + if (nmtu < VMXNET3_MIN_MTU || nmtu > VMXNET3_MAX_MTU) { + error = EINVAL; + break; + } + if (ifp->if_mtu != nmtu) { + error = ether_ioctl(ifp, cmd, data); + if (error == ENETRESET) +error = vmxnet3_init(ifp); } break; + } case SIOCGIFDATA: case SIOCZIFDATA: ifp->if_ipackets = 0;
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 16 10:01:24 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Eliminate IFF_RUNNING checking code from vmxnet3_init_locked(). Advised by hikaru@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/if_vmx.c diff -u src/sys/arch/x86/pci/if_vmx.c:1.30 src/sys/arch/x86/pci/if_vmx.c:1.31 --- src/sys/arch/x86/pci/if_vmx.c:1.30 Tue Jul 9 08:46:58 2019 +++ src/sys/arch/x86/pci/if_vmx.c Tue Jul 16 10:01:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.30 2019/07/09 08:46:58 msaitoh Exp $ */ +/* $NetBSD: if_vmx.c,v 1.31 2019/07/16 10:01:23 knakahara Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.30 2019/07/09 08:46:58 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.31 2019/07/16 10:01:23 knakahara Exp $"); #include #include @@ -1752,14 +1752,12 @@ void vmxnet3_evintr(struct vmxnet3_softc *sc) { device_t dev; - struct ifnet *ifp; struct vmxnet3_txq_shared *ts; struct vmxnet3_rxq_shared *rs; uint32_t event; int reset; dev = sc->vmx_dev; - ifp = >vmx_ethercom.ec_if; reset = 0; VMXNET3_CORE_LOCK(sc); @@ -1791,10 +1789,8 @@ vmxnet3_evintr(struct vmxnet3_softc *sc) if (event & VMXNET3_EVENT_DEBUG) device_printf(dev, "debug event\n"); - if (reset != 0) { - ifp->if_flags &= ~IFF_RUNNING; + if (reset != 0) vmxnet3_init_locked(sc); - } VMXNET3_CORE_UNLOCK(sc); } @@ -2504,9 +2500,6 @@ vmxnet3_init_locked(struct vmxnet3_softc struct ifnet *ifp = >vmx_ethercom.ec_if; int error; - if (ifp->if_flags & IFF_RUNNING) - return 0; - vmxnet3_stop_locked(sc); error = vmxnet3_reinit(sc); @@ -2886,15 +2879,11 @@ setit: int vmxnet3_change_mtu(struct vmxnet3_softc *sc, int mtu) { - struct ifnet *ifp = >vmx_ethercom.ec_if; if (mtu < VMXNET3_MIN_MTU || mtu > VMXNET3_MAX_MTU) return EINVAL; - if (ifp->if_flags & IFF_RUNNING) { - ifp->if_flags &= ~IFF_RUNNING; - vmxnet3_init_locked(sc); - } + vmxnet3_init_locked(sc); return 0; } @@ -3012,11 +3001,9 @@ void vmxnet3_tick(void *xsc) { struct vmxnet3_softc *sc; - struct ifnet *ifp; int i, timedout; sc = xsc; - ifp = >vmx_ethercom.ec_if; timedout = 0; VMXNET3_CORE_LOCK(sc); @@ -3026,10 +3013,9 @@ vmxnet3_tick(void *xsc) for (i = 0; i < sc->vmx_ntxqueues; i++) timedout |= vmxnet3_watchdog(>vmx_txq[i]); - if (timedout != 0) { - ifp->if_flags &= ~IFF_RUNNING; + if (timedout != 0) vmxnet3_init_locked(sc); - } else + else callout_reset(>vmx_tick, hz, vmxnet3_tick, sc); VMXNET3_CORE_UNLOCK(sc);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Tue Jul 16 10:01:24 UTC 2019 Modified Files: src/sys/arch/x86/pci: if_vmx.c Log Message: Eliminate IFF_RUNNING checking code from vmxnet3_init_locked(). Advised by hikaru@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Wed Jun 26 10:20:06 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Fix updating "Multiple Message Enable" field for MSI multiple vectors. Pointed out by jmcneill@n.o, thanks. I tested ahcisata for MSI single vector regression. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Wed Jun 26 10:20:06 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Fix updating "Multiple Message Enable" field for MSI multiple vectors. Pointed out by jmcneill@n.o, thanks. I tested ahcisata for MSI single vector regression. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.16 src/sys/arch/x86/pci/msipic.c:1.17 --- src/sys/arch/x86/pci/msipic.c:1.16 Tue Jun 18 10:06:49 2019 +++ src/sys/arch/x86/pci/msipic.c Wed Jun 26 10:20:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.16 2019/06/18 10:06:49 msaitoh Exp $ */ +/* $NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.16 2019/06/18 10:06:49 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $"); #include "opt_intrdebug.h" @@ -37,6 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1 #include #include #include +#include #include @@ -754,6 +755,25 @@ msipic_set_msi_vectors(struct pic *msi_p KASSERT(msipic_is_msi_pic(msi_pic)); + if (msi_pic->pic_type == PIC_MSI) { + pci_chipset_tag_t pc; + struct pci_attach_args *pa; + pcitag_t tag; + int off, err __diagused; + pcireg_t ctl; + + pc = NULL; + pa = _pic->pic_msipic->mp_pa; + tag = pa->pa_tag; + err = pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL); + KASSERT(err != 0); + + ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL); + ctl &= ~PCI_MSI_CTL_MME_MASK; + ctl |= __SHIFTIN(ilog2(count), PCI_MSI_CTL_MME_MASK); + pci_conf_write(pc, tag, off + PCI_MSI_CTL, ctl); + } + msi_pic->pic_msipic->mp_veccnt = count; return 0; }
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Tue Jun 18 10:06:49 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Add note about the case of PCI_MSI_MDATA[64] is 16bit. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.15 src/sys/arch/x86/pci/msipic.c:1.16 --- src/sys/arch/x86/pci/msipic.c:1.15 Mon Jun 17 06:38:29 2019 +++ src/sys/arch/x86/pci/msipic.c Tue Jun 18 10:06:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.15 2019/06/17 06:38:29 msaitoh Exp $ */ +/* $NetBSD: msipic.c,v 1.16 2019/06/18 10:06:49 msaitoh Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.15 2019/06/17 06:38:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.16 2019/06/18 10:06:49 msaitoh Exp $"); #include "opt_intrdebug.h" @@ -388,6 +388,15 @@ msi_addroute(struct pic *pic, struct cpu data = __SHIFTIN(idt_vec, LAPIC_VECTOR_MASK) | LAPIC_TRIGMODE_EDGE | LAPIC_DLMODE_FIXED; + /* + * The size of the message data register is 16bit if the extended + * message data is not implemented. If it's 16bit and the per-vector + * masking is not capable, the location of the upper 16bit is out of + * the MSI capability structure's range. The PCI spec says the upper + * 16bit is driven to 0 if the message data register is 16bit. It's the + * spec, so it's OK just to write it regardless of the value of the + * upper 16bit. + */ ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL); if (ctl & PCI_MSI_CTL_64BIT_ADDR) { pci_conf_write(pc, tag, off + PCI_MSI_MADDR64_LO, addr);
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Tue Jun 18 10:06:49 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Add note about the case of PCI_MSI_MDATA[64] is 16bit. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Mon Jun 17 05:45:47 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Fix comma with semicolon. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: msaitoh Date: Mon Jun 17 05:45:47 UTC 2019 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Fix comma with semicolon. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.13 src/sys/arch/x86/pci/msipic.c:1.14 --- src/sys/arch/x86/pci/msipic.c:1.13 Fri Jun 14 05:59:40 2019 +++ src/sys/arch/x86/pci/msipic.c Mon Jun 17 05:45:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.13 2019/06/14 05:59:40 msaitoh Exp $ */ +/* $NetBSD: msipic.c,v 1.14 2019/06/17 05:45:46 msaitoh Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.13 2019/06/14 05:59:40 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.14 2019/06/17 05:45:46 msaitoh Exp $"); #include "opt_intrdebug.h" @@ -250,7 +250,8 @@ msipic_construct_common_msi_pic(const st } memcpy(pic, pic_tmpl, sizeof(*pic)); - pic->pic_edge_stubs = x2apic_mode ? x2apic_edge_stubs : ioapic_edge_stubs, + pic->pic_edge_stubs + = x2apic_mode ? x2apic_edge_stubs : ioapic_edge_stubs; pic->pic_msipic = msipic; msipic->mp_pic = pic; pci_decompose_tag(pa->pa_pc, pa->pa_tag,
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: mlelstv Date: Sun Jun 16 09:12:51 UTC 2019 Modified Files: src/sys/arch/x86/pci: amdzentemp.c Log Message: correct for known temperature bias values. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/pci/amdzentemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.