awge0 and 100mb?
Hi, Anyone had, er, fun trying to get awge0 to connect at 100mb? I foolishly changed the hub that my working odroid c1 was connected to and after that packets refused to flow (other end didn't see them). Switching it back restored connectivity. After some thrashing about I noticed that while the good hub does 1gb the bad one does only 100mb (confirmed by ifconfig). It could be the hubs, but given that when they are connected packets flow, I'd suspect not. Currently working up a kernel more recent than NetBSD 8.0_BETA (ODROID-C1) #1: Wed Mar 7 09:03:51 UTC 2018 Andrew
Re: awge0 and 100mb?
Hi, how about you tried this patch? Among quite a few other changes, I need to remove AWIN_GMAC_MAC_INT_RGSMII from the default mask to make the awge0 on my DE0 nano-soc work (at Gbps speed, and because the PHY there is connected via RGMII). It looks like the media changing code is present but we mask media changing interrupts, so you might lose at 100Mbps and be lucky at 1Gbps. My analysis could be wrong though, I'm interested in your feedback. Regards, Aymeric diff --git a/sys/dev/ic/dwc_gmac.c b/sys/dev/ic/dwc_gmac.c index ce5635db0d3f..41c92003e9fb 100644 --- a/sys/dev/ic/dwc_gmac.c +++ b/sys/dev/ic/dwc_gmac.c @@ -120,9 +120,7 @@ static uint32_t bitrev32(uint32_t x); GMAC_DMA_INT_UNE|GMAC_DMA_INT_OVE| \ GMAC_DMA_INT_TJE) -#defineAWIN_DEF_MAC_INTRMASK \ - (AWIN_GMAC_MAC_INT_TSI | AWIN_GMAC_MAC_INT_ANEG | \ - AWIN_GMAC_MAC_INT_LINKCHG | AWIN_GMAC_MAC_INT_RGSMII) +#defineAWIN_DEF_MAC_INTRMASK AWIN_GMAC_MAC_INT_TSI #ifdef DWC_GMAC_DEBUG
rtsx(4) adding RTS525A
This is in a Dell XPS 15 9550. it seems to work. it detects card inserted and ejected, I can mount stuff, write stuff, remount, read the same contents again. I don't see a LED light for it on my machine. (Needs a pcidevs entry too.) I don't really know what I'm doing, mostly adapted to have the same code as RTSX_IS_RTS5227... etc. In openbsd, that is handled with an 'else' case. they don't seem to have the RT84xxx stuff we have. I can also do this with 'else' if that's better. Shuffled the flags definitions to maintain order. Thoughts? OKs? >From 935f6a2f88b99fda00e499b3aa0c751c72f9814b Mon Sep 17 00:00:00 2001 From: coypu Date: Tue, 24 Apr 2018 19:54:27 +0300 Subject: [PATCH 1/1] add RTS525A support. From openbsd. --- sys/dev/ic/rtsx.c | 26 --- sys/dev/ic/rtsxreg.h | 8 ++ sys/dev/ic/rtsxvar.h | 10 --- sys/dev/pci/rtsx_pci.c | 59 +++--- 4 files changed, 69 insertions(+), 34 deletions(-) diff --git a/sys/dev/ic/rtsx.c b/sys/dev/ic/rtsx.c index 380ff8c78..d10b04404 100644 --- a/sys/dev/ic/rtsx.c +++ b/sys/dev/ic/rtsx.c @@ -560,7 +560,9 @@ rtsx_bus_power_off(struct rtsx_softc *sc) disable3 = RTSX_PULL_CTL_DISABLE3; if (RTSX_IS_RTS5209(sc)) RTSX_SET(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_OFF); - else if (RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) { + else if (RTSX_IS_RTS5227(sc) + || RTSX_IS_RTS5229(sc) + || RTSX_IS_RTS525A(sc)) { RTSX_CLR(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_VCC1 | RTSX_LDO3318_VCC2); if (RTSX_IS_RTS5229_TYPE_C(sc)) @@ -578,7 +580,10 @@ rtsx_bus_power_off(struct rtsx_softc *sc) RTSX_CLR(sc, RTSX_CARD_PWR_CTL, RTSX_PMOS_STRG_800mA); /* Disable pull control. */ - if (RTSX_IS_RTS5209(sc) || RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) { + if (RTSX_IS_RTS5209(sc) + || RTSX_IS_RTS5227(sc) + || RTSX_IS_RTS5229(sc) + || RTSX_IS_RTS525A(sc)) { RTSX_WRITE(sc, RTSX_CARD_PULL_CTL1, RTSX_PULL_CTL_DISABLE12); RTSX_WRITE(sc, RTSX_CARD_PULL_CTL2, RTSX_PULL_CTL_DISABLE12); RTSX_WRITE(sc, RTSX_CARD_PULL_CTL3, disable3); @@ -612,13 +617,23 @@ rtsx_bus_power_on(struct rtsx_softc *sc) { uint8_t enable3; + if (RTSX_IS_RTS525A(sc)) { + int err = rtsx_write(sc, RTSX_LDO_VCC_CFG1, RTSX_LDO_VCC_TUNE_MASK, + RTSX_LDO_VCC_3V3); + if (err) + return err; + } + /* Select SD card. */ RTSX_WRITE(sc, RTSX_CARD_SELECT, RTSX_SD_MOD_SEL); RTSX_WRITE(sc, RTSX_CARD_SHARE_MODE, RTSX_CARD_SHARE_48_SD); RTSX_SET(sc, RTSX_CARD_CLK_EN, RTSX_SD_CLK_EN); /* Enable pull control. */ - if (RTSX_IS_RTS5209(sc) || RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) { + if (RTSX_IS_RTS5209(sc) + || RTSX_IS_RTS5227(sc) + || RTSX_IS_RTS5229(sc) + || RTSX_IS_RTS525A(sc)) { RTSX_WRITE(sc, RTSX_CARD_PULL_CTL1, RTSX_PULL_CTL_ENABLE12); RTSX_WRITE(sc, RTSX_CARD_PULL_CTL2, RTSX_PULL_CTL_ENABLE12); if (RTSX_IS_RTS5229_TYPE_C(sc)) @@ -653,7 +668,10 @@ rtsx_bus_power_on(struct rtsx_softc *sc) * delay in between. */ - if (RTSX_IS_RTS5209(sc) || RTSX_IS_RTS5227(sc) || RTSX_IS_RTS5229(sc)) { + if (RTSX_IS_RTS5209(sc) + || RTSX_IS_RTS5227(sc) + || RTSX_IS_RTS5229(sc) + || RTSX_IS_RTS525A(sc)) { /* Partial power. */ RTSX_SET(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PARTIAL_PWR_ON); if (RTSX_IS_RTS5209(sc)) diff --git a/sys/dev/ic/rtsxreg.h b/sys/dev/ic/rtsxreg.h index 3f00da885..90489b09a 100644 --- a/sys/dev/ic/rtsxreg.h +++ b/sys/dev/ic/rtsxreg.h @@ -544,6 +544,14 @@ #defineRTSX_DUMMY_REG 0xFE90 +#defineRTSX_LDO_VCC_CFG1 0xFF73 +#defineRTSX_LDO_VCC_REF_TUNE_MASK 0x30 +#defineRTSX_LDO_VCC_REF_1V20x20 +#defineRTSX_LDO_VCC_TUNE_MASK 0x07 +#defineRTSX_LDO_VCC_1V80x04 +#defineRTSX_LDO_VCC_3V30x07 +#defineRTSX_LDO_VCC_LMT_EN 0x08 + #defineRTSX_SG_INT 0x04 #defineRTSX_SG_END 0x02 #defineRTSX_SG_VALID 0x01 diff --git a/sys/dev/ic/rtsxvar.h b/sys/dev/ic/rtsxvar.h index 13f0d5242..98ea4236f 100644 --- a/sys/dev/ic/rtsxvar.h +++ b/sys/dev/ic/rtsxvar.h @@ -57,10 +57,11 @@ struct rtsx_softc { #defineRTSX_F_5227 __BIT(3) #defineRTSX_F_5229 __BIT(4) #defineRTSX_F_5229_TYPE_C __BIT(5) -#defineRTSX_F_8402 __BIT(6) -#defineRTSX_F_8411 __BIT(7) -#defineRTSX_F_8411B__BIT(8) -#defineRTSX_F_8411B_QFN48 __BIT(9) +#define
Re: secmodel_securelevel(9) and machdep.svs.enabled
Alexander Nasonov wrote: > When securelevel is set, should be lock 1->0 change for > machdep.svs.enabled (and possibly for other sysctls related > to recent security mitigations)? Can I commit the attached patch? (doc update will follow) -- Alex Index: src/sys/sys/kauth.h === RCS file: /cvsroot/src/sys/sys/kauth.h,v retrieving revision 1.75 diff -p -u -u -r1.75 kauth.h --- src/sys/sys/kauth.h 28 Aug 2017 00:46:07 - 1.75 +++ src/sys/sys/kauth.h 24 Apr 2018 17:59:13 - @@ -320,7 +320,8 @@ enum { KAUTH_MACHDEP_NVRAM, KAUTH_MACHDEP_UNMANAGEDMEM, KAUTH_MACHDEP_PXG, - KAUTH_MACHDEP_X86PMC + KAUTH_MACHDEP_X86PMC, + KAUTH_MACHDEP_SVS_DISABLE }; /* Index: src/sys/secmodel/suser/secmodel_suser.c === RCS file: /cvsroot/src/sys/secmodel/suser/secmodel_suser.c,v retrieving revision 1.43 diff -p -u -u -r1.43 secmodel_suser.c --- src/sys/secmodel/suser/secmodel_suser.c 14 Jun 2017 17:48:41 - 1.43 +++ src/sys/secmodel/suser/secmodel_suser.c 24 Apr 2018 17:59:13 - @@ -854,6 +854,7 @@ secmodel_suser_machdep_cb(kauth_cred_t c case KAUTH_MACHDEP_UNMANAGEDMEM: case KAUTH_MACHDEP_PXG: case KAUTH_MACHDEP_X86PMC: + case KAUTH_MACHDEP_SVS_DISABLE: if (isroot) result = KAUTH_RESULT_ALLOW; break; Index: src/sys/secmodel/securelevel/secmodel_securelevel.c === RCS file: /cvsroot/src/sys/secmodel/securelevel/secmodel_securelevel.c,v retrieving revision 1.30 diff -p -u -u -r1.30 secmodel_securelevel.c --- src/sys/secmodel/securelevel/secmodel_securelevel.c 25 Feb 2014 18:30:13 - 1.30 +++ src/sys/secmodel/securelevel/secmodel_securelevel.c 24 Apr 2018 17:59:13 - @@ -494,6 +494,11 @@ secmodel_securelevel_machdep_cb(kauth_cr result = KAUTH_RESULT_DENY; break; + case KAUTH_MACHDEP_SVS_DISABLE: + if (securelevel > 0) + result = KAUTH_RESULT_DENY; + break; + case KAUTH_MACHDEP_CPU_UCODE_APPLY: if (securelevel > 1) result = KAUTH_RESULT_DENY; Index: src/sys/arch/x86/x86/svs.c === RCS file: /cvsroot/src/sys/arch/x86/x86/svs.c,v retrieving revision 1.17 diff -p -u -u -r1.17 svs.c --- src/sys/arch/x86/x86/svs.c 30 Mar 2018 19:58:05 - 1.17 +++ src/sys/arch/x86/x86/svs.c 24 Apr 2018 17:59:11 - @@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.17 #include #include #include +#include #include #include @@ -737,11 +738,13 @@ sysctl_machdep_svs_enabled(SYSCTLFN_ARGS error = 0; else error = EOPNOTSUPP; - } else { - if (svs_enabled) + } else if (svs_enabled) { + error = kauth_authorize_machdep(kauth_cred_get(), + KAUTH_MACHDEP_SVS_DISABLE, NULL, NULL, NULL, NULL); + if (!error) error = svs_disable(); - else - error = 0; + } else { + error = 0; } return error;
Re: rtsx(4) adding RTS525A
I committed it, but feel free to object and suggest changes.
Re: awge0 and 100mb?
On Tue, Apr 24, 2018 at 06:54:16PM +0200, Aymeric Vincent wrote: > > Hi, > > how about you tried this patch? Among quite a few other changes, I need > to remove AWIN_GMAC_MAC_INT_RGSMII from the default mask to make the > awge0 on my DE0 nano-soc work (at Gbps speed, and because the PHY there > is connected via RGMII). It looks like the media changing code is > present but we mask media changing interrupts, so you might lose at > 100Mbps and be lucky at 1Gbps. My analysis could be wrong though, I'm > interested in your feedback. Heh, good catch. I can not easily test media changes (due to the way my cubietruck is wired/mounted), but the patch at least does not break it (nor cause noticable differences in interrupt counts). Martin