CVS commit: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Wed Aug 23 17:10:58 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: pci_machdep.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1890): sys/arch/x86/pci/pci_machdep.c: revision 1.94 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.79.2.2 -r1.79.2.3 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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Wed Aug 23 17:10:58 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: pci_machdep.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1890): sys/arch/x86/pci/pci_machdep.c: revision 1.94 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.79.2.2 -r1.79.2.3 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.79.2.2 src/sys/arch/x86/pci/pci_machdep.c:1.79.2.3 --- src/sys/arch/x86/pci/pci_machdep.c:1.79.2.2 Wed Jun 12 10:17:33 2019 +++ src/sys/arch/x86/pci/pci_machdep.c Wed Aug 23 17:10:57 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.79.2.2 2019/06/12 10:17:33 martin Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.79.2.3 2023/08/23 17:10:57 martin Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.79.2.2 2019/06/12 10:17:33 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.79.2.3 2023/08/23 17:10:57 martin Exp $"); #include #include @@ -456,6 +456,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) @@ -473,19 +475,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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Tue Aug 22 16:12:55 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1888): sys/arch/x86/pci/amdzentemp.c: revision 1.20 sys/arch/x86/pci/amdsmn.c: revision 1.17 sys/arch/x86/pci/amdzentemp.c: revision 1.19 Add Zen4 Ryzen "Phoenix" support. Add Zen2 Mendocino APU support. Add Zen4 Phoenix support. To generate a diff of this commit: cvs rdiff -u -r1.3.2.6 -r1.3.2.7 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.7.2.5 -r1.7.2.6 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.3.2.6 src/sys/arch/x86/pci/amdsmn.c:1.3.2.7 --- src/sys/arch/x86/pci/amdsmn.c:1.3.2.6 Wed Jun 21 18:58:22 2023 +++ src/sys/arch/x86/pci/amdsmn.c Tue Aug 22 16:12:54 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.3.2.6 2023/06/21 18:58:22 martin Exp $ */ +/* $NetBSD: amdsmn.c,v 1.3.2.7 2023/08/22 16:12:54 martin Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.6 2023/06/21 18:58:22 martin Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.7 2023/08/22 16:12:54 martin 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 *); Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.7.2.5 src/sys/arch/x86/pci/amdzentemp.c:1.7.2.6 --- src/sys/arch/x86/pci/amdzentemp.c:1.7.2.5 Wed Jun 21 18:58:22 2023 +++ src/sys/arch/x86/pci/amdzentemp.c Tue Aug 22 16:12:54 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.7.2.5 2023/06/21 18:58:22 martin Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.7.2.6 2023/08/22 16:12:54 martin 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.7.2.5 2023/06/21 18:58:22 martin Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.7.2.6 2023/08/22 16:12:54 martin 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: @@ -403,6 +407,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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Tue Aug 22 16:12:55 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1888): sys/arch/x86/pci/amdzentemp.c: revision 1.20 sys/arch/x86/pci/amdsmn.c: revision 1.17 sys/arch/x86/pci/amdzentemp.c: revision 1.19 Add Zen4 Ryzen "Phoenix" support. Add Zen2 Mendocino APU support. Add Zen4 Phoenix support. To generate a diff of this commit: cvs rdiff -u -r1.3.2.6 -r1.3.2.7 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.7.2.5 -r1.7.2.6 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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Wed Jun 21 18:58:22 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1825): sys/arch/x86/pci/amdsmn.c: revision 1.16 sys/arch/x86/pci/amdzentemp.c: revision 1.17 sys/arch/x86/pci/amdzentemp.c: revision 1.18 Reduce diff against DragonFly. No functional change. amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh). To generate a diff of this commit: cvs rdiff -u -r1.3.2.5 -r1.3.2.6 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.7.2.4 -r1.7.2.5 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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Wed Jun 21 18:58:22 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1825): sys/arch/x86/pci/amdsmn.c: revision 1.16 sys/arch/x86/pci/amdzentemp.c: revision 1.17 sys/arch/x86/pci/amdzentemp.c: revision 1.18 Reduce diff against DragonFly. No functional change. amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh). To generate a diff of this commit: cvs rdiff -u -r1.3.2.5 -r1.3.2.6 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.7.2.4 -r1.7.2.5 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.3.2.5 src/sys/arch/x86/pci/amdsmn.c:1.3.2.6 --- src/sys/arch/x86/pci/amdsmn.c:1.3.2.5 Tue Oct 11 18:22:44 2022 +++ src/sys/arch/x86/pci/amdsmn.c Wed Jun 21 18:58:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.3.2.5 2022/10/11 18:22:44 martin Exp $ */ +/* $NetBSD: amdsmn.c,v 1.3.2.6 2023/06/21 18:58:22 martin Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.5 2022/10/11 18:22:44 martin Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.6 2023/06/21 18:58:22 martin 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.7.2.4 src/sys/arch/x86/pci/amdzentemp.c:1.7.2.5 --- src/sys/arch/x86/pci/amdzentemp.c:1.7.2.4 Mon Jan 23 12:28:51 2023 +++ src/sys/arch/x86/pci/amdzentemp.c Wed Jun 21 18:58:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.7.2.4 2023/01/23 12:28:51 martin Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.7.2.5 2023/06/21 18:58:22 martin 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.7.2.4 2023/01/23 12:28:51 martin Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.7.2.5 2023/06/21 18:58:22 martin 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 { @@ -129,6 +121,10 @@ enum { CCD5, CCD6, CCD7, + CCD8, + CCD9, + CCD10, + CCD11, CCD_MAX, NUM_CCDS = CCD_MAX - CCD_BASE }; @@ -339,14 +335,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 +370,8 @@ amdzentemp_probe_ccd_sensors17h(struct a { int maxreg; + sc->sc_ccd_offset = 0x154; + switch (model) { case 0x00 ... 0x2f: /* Zen1, Zen+ */ maxreg = 4; @@ -399,12
CVS commit: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Mon Jan 23 12:28:51 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdzentemp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1789): sys/arch/x86/pci/amdzentemp.c: revision 1.16 match zen3 "cezanne" (ryzen 5000-series APU.) To generate a diff of this commit: cvs rdiff -u -r1.7.2.3 -r1.7.2.4 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.7.2.3 src/sys/arch/x86/pci/amdzentemp.c:1.7.2.4 --- src/sys/arch/x86/pci/amdzentemp.c:1.7.2.3 Tue Oct 11 18:22:44 2022 +++ src/sys/arch/x86/pci/amdzentemp.c Mon Jan 23 12:28:51 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: amdzentemp.c,v 1.7.2.3 2022/10/11 18:22:44 martin Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.7.2.4 2023/01/23 12:28:51 martin 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.7.2.3 2022/10/11 18:22:44 martin Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.7.2.4 2023/01/23 12:28:51 martin 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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Mon Jan 23 12:28:51 UTC 2023 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdzentemp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1789): sys/arch/x86/pci/amdzentemp.c: revision 1.16 match zen3 "cezanne" (ryzen 5000-series APU.) To generate a diff of this commit: cvs rdiff -u -r1.7.2.3 -r1.7.2.4 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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Wed Nov 20 16:36:47 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-8]: msipic.c Log Message: Pull up following revision(s) (requested by hikaru in ticket #1453): sys/arch/x86/pci/msipic.c: revision 1.19 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.10 -r1.10.2.1 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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Wed Nov 20 16:36:47 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-8]: msipic.c Log Message: Pull up following revision(s) (requested by hikaru in ticket #1453): sys/arch/x86/pci/msipic.c: revision 1.19 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.10 -r1.10.2.1 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.10 src/sys/arch/x86/pci/msipic.c:1.10.2.1 --- src/sys/arch/x86/pci/msipic.c:1.10 Thu Jun 1 02:45:08 2017 +++ src/sys/arch/x86/pci/msipic.c Wed Nov 20 16:36:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.10 2017/06/01 02:45:08 chs Exp $ */ +/* $NetBSD: msipic.c,v 1.10.2.1 2019/11/20 16:36:47 martin Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.10 2017/06/01 02:45:08 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.10.2.1 2019/11/20 16:36:47 martin Exp $"); #include "opt_intrdebug.h" @@ -538,6 +538,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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Tue Aug 6 16:05:11 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdsmn.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1328): sys/arch/x86/pci/amdsmn.c: revision 1.4 sys/arch/x86/pci/amdsmn.c: revision 1.5 sys/arch/x86/pci/amdsmn.c: revision 1.6 Add support for Ryzen 2xxx and 3xxx. Use unsigned to fix compile error on i386. Whitespace fix. To generate a diff of this commit: cvs rdiff -u -r1.3.2.3 -r1.3.2.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.2.3 src/sys/arch/x86/pci/amdsmn.c:1.3.2.4 --- src/sys/arch/x86/pci/amdsmn.c:1.3.2.3 Tue Feb 6 09:05:27 2018 +++ src/sys/arch/x86/pci/amdsmn.c Tue Aug 6 16:05:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.3.2.3 2018/02/06 09:05:27 martin Exp $ */ +/* $NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin Exp $ */ /*- * Copyright (c) 2017 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.3 2018/02/06 09:05:27 martin Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin 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 *); @@ -71,17 +78,25 @@ static int amdsmn_misc_search(device_t, CFATTACH_DECL3_NEW(amdsmn, sizeof(struct amdsmn_softc), amdsmn_match, amdsmn_attach, amdsmn_detach, NULL, amdsmn_rescan, NULL, 0); - + static int -amdsmn_match(device_t parent, cfdata_t match, void *aux) +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; + unsigned 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 -amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux) +static int +amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux) { if (config_match(parent, cf, aux)) config_attach_loc(parent, cf, locs, aux, NULL); @@ -89,8 +104,8 @@ amdsmn_misc_search(device_t parent, cfda return 0; } -static void -amdsmn_attach(device_t parent, device_t self, void *aux) +static void +amdsmn_attach(device_t parent, device_t self, void *aux) { struct amdsmn_softc *sc = device_private(self); struct pci_attach_args *pa = aux; @@ -115,7 +130,7 @@ amdsmn_rescan(device_t self, const char } static int -amdsmn_detach(device_t self, int flags) +amdsmn_detach(device_t self, int flags) { struct amdsmn_softc *sc = device_private(self);
CVS commit: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Tue Aug 6 16:05:11 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-8]: amdsmn.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1328): sys/arch/x86/pci/amdsmn.c: revision 1.4 sys/arch/x86/pci/amdsmn.c: revision 1.5 sys/arch/x86/pci/amdsmn.c: revision 1.6 Add support for Ryzen 2xxx and 3xxx. Use unsigned to fix compile error on i386. Whitespace fix. To generate a diff of this commit: cvs rdiff -u -r1.3.2.3 -r1.3.2.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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Mon Jul 22 17:47:16 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-8]: if_vmx.c Log Message: Pull up following revision(s) (requested by knakahara in ticket #1300): sys/arch/x86/pci/if_vmx.c: revision 1.31 sys/arch/x86/pci/if_vmx.c: revision 1.32 (via patch) Eliminate IFF_RUNNING checking code from vmxnet3_init_locked(). Advised by hikaru@n.o, thanks. - 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.19.6.5 -r1.19.6.6 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.19.6.5 src/sys/arch/x86/pci/if_vmx.c:1.19.6.6 --- src/sys/arch/x86/pci/if_vmx.c:1.19.6.5 Thu Mar 21 14:27:02 2019 +++ src/sys/arch/x86/pci/if_vmx.c Mon Jul 22 17:47:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.19.6.5 2019/03/21 14:27:02 martin Exp $ */ +/* $NetBSD: if_vmx.c,v 1.19.6.6 2019/07/22 17:47:16 martin 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.19.6.5 2019/03/21 14:27:02 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.6 2019/07/22 17:47:16 martin 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 *); @@ -1748,14 +1747,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); @@ -1787,10 +1784,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); } @@ -2500,9 +2495,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); @@ -2880,22 +2872,6 @@ 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); - } - - return 0; -} - -int vmxnet3_ioctl(struct ifnet *ifp, u_long cmd, void *data) { struct vmxnet3_softc *sc = ifp->if_softc; @@ -2903,13 +2879,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 SIOCSIFMEDIA: case SIOCGIFMEDIA: s = splnet(); @@ -3014,11 +2997,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); @@ -3028,10 +3009,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: [netbsd-8] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Mon Jul 22 17:47:16 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-8]: if_vmx.c Log Message: Pull up following revision(s) (requested by knakahara in ticket #1300): sys/arch/x86/pci/if_vmx.c: revision 1.31 sys/arch/x86/pci/if_vmx.c: revision 1.32 (via patch) Eliminate IFF_RUNNING checking code from vmxnet3_init_locked(). Advised by hikaru@n.o, thanks. - 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.19.6.5 -r1.19.6.6 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.