svn commit: r342759 - in head/sys/dev/rtwn: rtl8188e rtl8188e/pci rtl8192c
Author: avos Date: Fri Jan 4 04:26:39 2019 New Revision: 342759 URL: https://svnweb.freebsd.org/changeset/base/342759 Log: rtwn_pci(4): sync r88ee_power_on() with OpenBSD Tested with RTL8188EE, STA mode Submitted by: Farhan Khan MFC after:3 days Differential Revision:https://reviews.freebsd.org/D18727 Modified: head/sys/dev/rtwn/rtl8188e/pci/r88ee_init.c head/sys/dev/rtwn/rtl8188e/r88e_reg.h head/sys/dev/rtwn/rtl8192c/r92c_reg.h Modified: head/sys/dev/rtwn/rtl8188e/pci/r88ee_init.c == --- head/sys/dev/rtwn/rtl8188e/pci/r88ee_init.c Fri Jan 4 04:15:17 2019 (r342758) +++ head/sys/dev/rtwn/rtl8188e/pci/r88ee_init.c Fri Jan 4 04:26:39 2019 (r342759) @@ -84,8 +84,15 @@ r88ee_power_on(struct rtwn_softc *sc) { int ntries; - /* Wait for power ready bit. */ - for (ntries = 0; ntries < 5000; ntries++) { + /* Disable XTAL output for power saving. */ + rtwn_setbits_1(sc, R88E_XCK_OUT_CTRL, R88E_XCK_OUT_CTRL_EN, 0); + + /* Unlock ISO/CLK/Power control register. */ + rtwn_setbits_2(sc, R92C_APS_FSMCO, R92C_APS_FSMCO_APDM_HPDN, 0); + rtwn_write_1(sc, R92C_RSV_CTRL, 0); + + /* Wait for power ready bit */ + for(ntries = 0; ntries < 5000; ntries++) { if (rtwn_read_4(sc, R92C_APS_FSMCO) & R92C_APS_FSMCO_SUS_HOST) break; rtwn_delay(sc, 10); @@ -96,9 +103,6 @@ r88ee_power_on(struct rtwn_softc *sc) return (ETIMEDOUT); } - /* Unlock ISO/CLK/Power control register. */ - rtwn_write_1(sc, R92C_RSV_CTRL, 0); - /* Reset BB. */ rtwn_setbits_1(sc, R92C_SYS_FUNC_EN, R92C_SYS_FUNC_EN_BBRSTB | R92C_SYS_FUNC_EN_BB_GLB_RST, 0); @@ -114,6 +118,7 @@ r88ee_power_on(struct rtwn_softc *sc) rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, R92C_APS_FSMCO_AFSM_HSUS | R92C_APS_FSMCO_AFSM_PCIE, 0, 1); + /* Auto-enable WLAN */ rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0, R92C_APS_FSMCO_APFM_ONMAC, 1); for (ntries = 0; ntries < 5000; ntries++) { @@ -129,6 +134,12 @@ r88ee_power_on(struct rtwn_softc *sc) /* Enable LDO normal mode. */ rtwn_setbits_1(sc, R92C_LPLDO_CTRL, R92C_LPLDO_CTRL_SLEEP, 0); + + rtwn_setbits_1(sc, R92C_APS_FSMCO, 0, R92C_APS_FSMCO_PDN_EN); + rtwn_setbits_1(sc, R92C_PCIE_CTRL_REG + 2, 0, 0x04); + rtwn_setbits_1(sc, R92C_AFE_XTAL_CTRL_EXT + 1, 0, 0x02); + rtwn_setbits_1(sc, R92C_SYS_CLKR, 0, 0x08); + rtwn_setbits_2(sc, R92C_GPIO_MUXCFG, R92C_GPIO_MUXCFG_ENSIC, 0); /* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */ rtwn_write_2(sc, R92C_CR, 0); Modified: head/sys/dev/rtwn/rtl8188e/r88e_reg.h == --- head/sys/dev/rtwn/rtl8188e/r88e_reg.h Fri Jan 4 04:15:17 2019 (r342758) +++ head/sys/dev/rtwn/rtl8188e/r88e_reg.h Fri Jan 4 04:26:39 2019 (r342759) @@ -32,6 +32,7 @@ #define R88E_HISR 0x0b4 #define R88E_HIMRE 0x0b8 #define R88E_HISRE 0x0bc +#define R88E_XCK_OUT_CTRL 0x07c /* MAC General Configuration. */ #define R88E_32K_CTRL 0x194 #define R88E_HMEBOX_EXT(idx) (0x1f0 + (idx) * 4) @@ -121,5 +122,8 @@ #define R88E_RF_T_METER_VAL_M 0x0fc00 #define R88E_RF_T_METER_VAL_S 10 #define R88E_RF_T_METER_START 0x3 + +/* Bits for R88E_XCK_OUT_CTRL. */ +#define R88E_XCK_OUT_CTRL_EN 1 #endif /* R88E_REG_H */ Modified: head/sys/dev/rtwn/rtl8192c/r92c_reg.h == --- head/sys/dev/rtwn/rtl8192c/r92c_reg.h Fri Jan 4 04:15:17 2019 (r342758) +++ head/sys/dev/rtwn/rtl8192c/r92c_reg.h Fri Jan 4 04:26:39 2019 (r342759) @@ -66,6 +66,7 @@ #define R92C_HSIMR 0x058 #define R92C_HSISR 0x05c #define R92C_MULTI_FUNC_CTRL 0x068 +#define R92C_AFE_XTAL_CTRL_EXT 0x078 #define R92C_LDO_SWR_CTRL 0x07c #define R92C_MCUFWDL 0x080 #define R92C_HMEBOX_EXT(idx) (0x088 + (idx) * 2) @@ -347,6 +348,7 @@ /* Bits for R92C_GPIO_MUXCFG. */ #define R92C_GPIO_MUXCFG_ENBT 0x0020 +#define R92C_GPIO_MUXCFG_ENSIC 0x1000 /* Bits for R92C_LEDCFG0. */ #define R92C_LEDCFG0_DIS 0x08 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342758 - head/sys/dev/cxgbe/common
Author: np Date: Fri Jan 4 04:15:17 2019 New Revision: 342758 URL: https://svnweb.freebsd.org/changeset/base/342758 Log: cxgbe(4): Clear FW_OK if the firmware reports an error. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Fri Jan 4 03:13:24 2019 (r342757) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Jan 4 04:15:17 2019 (r342758) @@ -211,9 +211,11 @@ static void t4_report_fw_error(struct adapter *adap) u32 pcie_fw; pcie_fw = t4_read_reg(adap, A_PCIE_FW); - if (pcie_fw & F_PCIE_FW_ERR) + if (pcie_fw & F_PCIE_FW_ERR) { CH_ERR(adap, "Firmware reports adapter error: %s\n", reason[G_PCIE_FW_EVAL(pcie_fw)]); + adap->flags &= ~FW_OK; + } } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342757 - head/lib/libc/stdlib
Author: kevans Date: Fri Jan 4 03:13:24 2019 New Revision: 342757 URL: https://svnweb.freebsd.org/changeset/base/342757 Log: getopt_long(3): fix case of malformed long opt When presented with an arg string like '-l-', getopt_long will successfully parse out the 'l' short option, then proceed to match '--' against the first longopts entry as it later does a strncmp with len=0. This latter bit is arguably another bug in itself, but presumably not a practical issue as all callers of parse_long_options are already doing the right thing (except this one pointed out). An opt string like '-l-' should be considered malformed and throw a bad argument rather than behaving as if '--' were passed. It cannot possibly do what the invoker expects, and it's probably the result of a typo (ls -l- a) rather than any intent. Reported by: Tony Overfield Reviewed by: imp MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D18616 Modified: head/lib/libc/stdlib/getopt_long.c Modified: head/lib/libc/stdlib/getopt_long.c == --- head/lib/libc/stdlib/getopt_long.c Fri Jan 4 02:50:55 2019 (r342756) +++ head/lib/libc/stdlib/getopt_long.c Fri Jan 4 03:13:24 2019 (r342757) @@ -481,6 +481,8 @@ start: #endif if (*place == '-') { place++;/* --foo long option */ + if (*place == '\0') + return (BADARG);/* malformed option */ #ifdef GNU_COMPATIBLE dash_prefix = DD_PREFIX; #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342754 - head/usr.bin/lam
Author: allanjude Date: Fri Jan 4 02:48:43 2019 New Revision: 342754 URL: https://svnweb.freebsd.org/changeset/base/342754 Log: The lam(1) man page is unclear about the uppercase versions of the flags PR: 229571 Submitted by: Tim Chase Modified: head/usr.bin/lam/lam.1 Modified: head/usr.bin/lam/lam.1 == --- head/usr.bin/lam/lam.1 Fri Jan 4 02:21:00 2019(r342753) +++ head/usr.bin/lam/lam.1 Fri Jan 4 02:48:43 2019(r342754) @@ -58,14 +58,8 @@ are considered fragments of the single long output line into which they are assembled. The name `\fB\-\fP' means the standard input, and may be repeated. .Pp -Normally, each option affects only the -.Ar file -after it. -If the option letter is capitalized it affects all subsequent files -until it appears again uncapitalized. -The options are described below: .Bl -tag -width indent -.It Fl f Ar min . Ns Ar max +.It Fl f Ar min . Ns Ar max , Fl F Ar min . Ns Ar max Print line fragments according to the format string .Ar min . Ns Ar max , where @@ -78,21 +72,41 @@ If begins with a zero, zeros will be added to make up the field width, and if it begins with a `\-', the fragment will be left-adjusted within the field. -.It Fl p Ar min . Ns Ar max +Using +.Fl f +applies only to the next file while +.Fl F +applies to all subsequent files until it appears again uncapitalized. +.It Fl p Ar min . Ns Ar max , Fl P Ar min . Ns Ar max Like .Fl f , but pad this file's field when end-of-file is reached and other files are still active. -.It Fl s Ar sepstring +Using +.Fl p +applies only to the next file while +.Fl P +applies to all subsequent files until it appears again uncapitalized. +.It Fl s Ar sepstring , Fl S Ar sepstring Print .Ar sepstring before printing line fragments from the next file. This option may appear after the last file. -.It Fl t Ar c +Using +.Fl s +applies only to the next file while +.Fl S +applies to all subsequent files until it appears again uncapitalized. +.It Fl t Ar c , Fl T Ar c The input line terminator is .Ar c instead of a newline. The newline normally appended to each output line is omitted. +Using +.Fl t +applies only to the next file while +.Fl T +applies to all subsequent files until it appears again uncapitalized. .El .Pp To print files simultaneously for easy viewing use ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342749 - head/sys/net
Author: mmacy Date: Thu Jan 3 23:06:05 2019 New Revision: 342749 URL: https://svnweb.freebsd.org/changeset/base/342749 Log: mp_ring: avoid items offset difference between iflib and mp_ring on architectures without 64-bit atomics Reported by: Augustin Cavalier Modified: head/sys/net/mp_ring.c head/sys/net/mp_ring.h Modified: head/sys/net/mp_ring.c == --- head/sys/net/mp_ring.c Thu Jan 3 22:51:14 2019(r342748) +++ head/sys/net/mp_ring.c Thu Jan 3 23:06:05 2019(r342749) @@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__powerpc__) || defined(__mips__) || defined(__i386__) -#define NO_64BIT_ATOMICS -#endif - #if defined(__i386__) #define atomic_cmpset_acq_64 atomic_cmpset_64 #define atomic_cmpset_rel_64 atomic_cmpset_64 @@ -101,7 +97,7 @@ state_to_flags(union ring_state s, int abdicate) return (BUSY); } -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS static void drain_ring_locked(struct ifmp_ring *r, union ring_state os, uint16_t prev, int budget) { @@ -291,7 +287,7 @@ ifmp_ring_alloc(struct ifmp_ring **pr, int size, void } *pr = r; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS mtx_init(>lock, "mp_ring lock", NULL, MTX_DEF); #endif return (0); @@ -325,7 +321,7 @@ ifmp_ring_free(struct ifmp_ring *r) * * Returns an errno. */ -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS int ifmp_ring_enqueue(struct ifmp_ring *r, void **items, int n, int budget, int abdicate) { @@ -503,7 +499,7 @@ ifmp_ring_check_drainage(struct ifmp_ring *r, int budg ns.flags = BUSY; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS mtx_lock(>lock); if (r->state != os.state) { mtx_unlock(>lock); Modified: head/sys/net/mp_ring.h == --- head/sys/net/mp_ring.h Thu Jan 3 22:51:14 2019(r342748) +++ head/sys/net/mp_ring.h Thu Jan 3 23:06:05 2019(r342749) @@ -40,6 +40,10 @@ typedef u_int (*mp_ring_drain_t)(struct ifmp_ring *, u typedef u_int (*mp_ring_can_drain_t)(struct ifmp_ring *); typedef void (*mp_ring_serial_t)(struct ifmp_ring *); +#if defined(__powerpc__) || defined(__mips__) || defined(__i386__) +#define MP_RING_NO_64BIT_ATOMICS +#endif + struct ifmp_ring { volatile uint64_t state __aligned(CACHE_LINE_SIZE); @@ -54,7 +58,7 @@ struct ifmp_ring { counter_u64_t stalls; counter_u64_t restarts; /* recovered after stalling */ counter_u64_t abdications; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS struct mtx lock; #endif void * volatile items[] __aligned(CACHE_LINE_SIZE); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342747 - head/sys/cddl/boot/zfs
Author: mmacy Date: Thu Jan 3 22:49:11 2019 New Revision: 342747 URL: https://svnweb.freebsd.org/changeset/base/342747 Log: zfsboot: support newer ZFS versions declare v3 objset size/layout to fix userboot and possibly other loader issues - fix for userboot assertion failure in zfs_dev_close in free due to out of bounds write - fix for zfs_alloc / zfs_free mismatch assertion failure when booting GPT on BIOS Modified: head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/sys/cddl/boot/zfs/zfsimpl.h == --- head/sys/cddl/boot/zfs/zfsimpl.hThu Jan 3 22:48:59 2019 (r342746) +++ head/sys/cddl/boot/zfs/zfsimpl.hThu Jan 3 22:49:11 2019 (r342747) @@ -1121,6 +1121,8 @@ typedef struct sa_hdr_phys { #defineSA_PARENT_OFFSET40 #defineSA_SYMLINK_OFFSET 160 +#defineZIO_OBJSET_MAC_LEN 32 + /* * Intent log header - this on disk structure holds fields to manage * the log. All fields are 64 bit to easily handle cross architectures. @@ -1133,17 +1135,24 @@ typedef struct zil_header { uint64_t zh_pad[5]; } zil_header_t; -#defineOBJSET_PHYS_SIZE 2048 +#defineOBJSET_PHYS_SIZE_V2 2048 +#defineOBJSET_PHYS_SIZE_V3 4096 typedef struct objset_phys { dnode_phys_t os_meta_dnode; zil_header_t os_zil_header; uint64_t os_type; uint64_t os_flags; - char os_pad[OBJSET_PHYS_SIZE - sizeof (dnode_phys_t)*3 - - sizeof (zil_header_t) - sizeof (uint64_t)*2]; + uint8_t os_portable_mac[ZIO_OBJSET_MAC_LEN]; + uint8_t os_local_mac[ZIO_OBJSET_MAC_LEN]; + char os_pad0[OBJSET_PHYS_SIZE_V2 - sizeof (dnode_phys_t)*3 - + sizeof (zil_header_t) - sizeof (uint64_t)*2 - + 2*ZIO_OBJSET_MAC_LEN]; dnode_phys_t os_userused_dnode; dnode_phys_t os_groupused_dnode; + dnode_phys_t os_projectused_dnode; + char os_pad1[OBJSET_PHYS_SIZE_V3 - OBJSET_PHYS_SIZE_V2 - + sizeof (dnode_phys_t)]; } objset_phys_t; typedef struct dsl_dir_phys { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342743 - head/lib/libc/gen
Author: romain (ports committer) Date: Thu Jan 3 21:31:17 2019 New Revision: 342743 URL: https://svnweb.freebsd.org/changeset/base/342743 Log: Add man page for dlvsym(3) Add a short description of the function to the appropriate man page and add reference to it where it makes sense. Reviewed by: bcr, markj, 0mp Approved by: markj Differential Revision:https://reviews.freebsd.org/D18725 Modified: head/lib/libc/gen/Makefile.inc head/lib/libc/gen/dlopen.3 Modified: head/lib/libc/gen/Makefile.inc == --- head/lib/libc/gen/Makefile.inc Thu Jan 3 20:27:50 2019 (r342742) +++ head/lib/libc/gen/Makefile.inc Thu Jan 3 21:31:17 2019 (r342743) @@ -339,7 +339,8 @@ MLINKS+=dlopen.3 fdlopen.3 \ dlopen.3 dlclose.3 \ dlopen.3 dlerror.3 \ dlopen.3 dlfunc.3 \ - dlopen.3 dlsym.3 + dlopen.3 dlsym.3 \ + dlopen.3 dlvsym.3 MLINKS+=err.3 err_set_exit.3 \ err.3 err_set_file.3 \ err.3 errc.3 \ Modified: head/lib/libc/gen/dlopen.3 == --- head/lib/libc/gen/dlopen.3 Thu Jan 3 20:27:50 2019(r342742) +++ head/lib/libc/gen/dlopen.3 Thu Jan 3 21:31:17 2019(r342743) @@ -32,13 +32,14 @@ .\" @(#) dlopen.3 1.6 90/01/31 SMI .\" $FreeBSD$ .\" -.Dd July 7, 2017 +.Dd January 2, 2019 .Dt DLOPEN 3 .Os .Sh NAME .Nm dlopen , .Nm fdlopen , .Nm dlsym , +.Nm dlvsym , .Nm dlfunc , .Nm dlerror , .Nm dlclose @@ -53,6 +54,8 @@ .Fn fdlopen "int fd" "int mode" .Ft void * .Fn dlsym "void * restrict handle" "const char * restrict symbol" +.Ft void * +.Fn dlvsym "void * restrict handle" "const char * restrict symbol" "const char * restrict version" .Ft dlfunc_t .Fn dlfunc "void * restrict handle" "const char * restrict symbol" .Ft char * @@ -74,7 +77,8 @@ provides access to the shared object in .Fa path , returning a descriptor that can be used for later references to the object in calls to -.Fn dlsym +.Fn dlsym , +.Fn dlvsym and .Fn dlclose . If @@ -300,6 +304,16 @@ condition which may be queried with .Fn dlerror . .Pp The +.Fn dlvsym +function behaves like +.Fn dlsym , +but takes an extra argument +.Fa version : +a null-terminated character string which is used to request a specific version +of +.Fa symbol . +.Pp +The .Fn dlfunc function implements all of the behavior of @@ -328,6 +342,7 @@ occurred during a call to .Fn dladdr , .Fn dlinfo , .Fn dlsym , +.Fn dlvsym , .Fn dlfunc , or .Fn dlclose . @@ -375,7 +390,10 @@ using the option to .Xr ld 1 for symbols defined in the executable to become visible to -.Fn dlsym . +.Fn dlsym , +.Fn dlvsym +or +.Fn dlfunc .Pp Other ELF platforms require linking with .Lb libdl @@ -397,6 +415,7 @@ The .Fn dlopen , .Fn fdlopen , .Fn dlsym , +.Fn dlvsym , and .Fn dlfunc functions ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342742 - in head/stand/efi: include include/Guid include/Protocol libefi loader
Author: tsoome Date: Thu Jan 3 20:27:50 2019 New Revision: 342742 URL: https://svnweb.freebsd.org/changeset/base/342742 Log: loader.efi: efi variable rework and lsefi command added This update does add diag and debug capabilities to interpret the efi variables, configuration and protocols (lsefi). The side effect is that we add/update bunch of related headers. Added: head/stand/efi/include/Guid/ head/stand/efi/include/Guid/MemoryTypeInformation.h (contents, props changed) head/stand/efi/include/Guid/MtcVendor.h (contents, props changed) head/stand/efi/include/Guid/ZeroGuid.h (contents, props changed) head/stand/efi/include/Protocol/ head/stand/efi/include/Protocol/EdidActive.h (contents, props changed) head/stand/efi/include/Protocol/EdidDiscovered.h (contents, props changed) head/stand/efi/include/Protocol/EdidOverride.h (contents, props changed) head/stand/efi/include/efigpt.h (contents, props changed) head/stand/efi/include/efiip.h (contents, props changed) head/stand/efi/include/efipoint.h (contents, props changed) head/stand/efi/include/efitcp.h (contents, props changed) head/stand/efi/include/efiudp.h (contents, props changed) Modified: head/stand/efi/include/efi.h head/stand/efi/include/efiapi.h head/stand/efi/include/eficon.h head/stand/efi/include/efidef.h head/stand/efi/include/efilib.h head/stand/efi/include/efipciio.h head/stand/efi/libefi/env.c head/stand/efi/loader/main.c Added: head/stand/efi/include/Guid/MemoryTypeInformation.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/Guid/MemoryTypeInformation.h Thu Jan 3 20:27:50 2019(r342742) @@ -0,0 +1,37 @@ +/* $FreeBSD$ */ +/** @file + This file defines: + * Memory Type Information GUID for HOB and Variable. + * Memory Type Information Variable Name. + * Memory Type Information GUID HOB data structure. + + The memory type information HOB and variable can + be used to store the information for each memory type in Variable or HOB. + +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__ +#define __MEMORY_TYPE_INFORMATION_GUID_H__ + +#define EFI_MEMORY_TYPE_INFORMATION_GUID \ + { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } } + +#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME "MemoryTypeInformation" + +extern EFI_GUID gEfiMemoryTypeInformationGuid; + +typedef struct { + UINT32 Type; ///< EFI memory type defined in UEFI specification. + UINT32 NumberOfPages;///< The pages of this type memory. +} EFI_MEMORY_TYPE_INFORMATION; + +#endif Added: head/stand/efi/include/Guid/MtcVendor.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/Guid/MtcVendor.h Thu Jan 3 20:27:50 2019 (r342742) @@ -0,0 +1,32 @@ +/* $FreeBSD$ */ +/** @file + GUID is for MTC variable. + +Copyright (c) 2011, Intel Corporation. All rights reserved. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __MTC_VENDOR_GUID_H__ +#define __MTC_VENDOR_GUID_H__ + +// +// Vendor GUID of the variable for the high part of monotonic counter (UINT32). +// +#define MTC_VENDOR_GUID \ + { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } } + +// +// Name of the variable for the high part of monotonic counter +// +#define MTC_VARIABLE_NAME "MTC" + +extern EFI_GUID gMtcVendorGuid; + +#endif Added: head/stand/efi/include/Guid/ZeroGuid.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/Guid/ZeroGuid.h Thu Jan 3 20:27:50 2019 (r342742) @@ -0,0 +1,26 @@ +/* $FreeBSD$ */ +/** @file + GUID has all zero values. + +Copyright (c) 2011, Intel Corporation. All rights reserved. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD
svn commit: r342740 - head/bin/sh
Author: jilles Date: Thu Jan 3 20:22:35 2019 New Revision: 342740 URL: https://svnweb.freebsd.org/changeset/base/342740 Log: sh: Do not place exported but unset variables into the environment PR: 233545 Submitted by: Jan Beich Obtained from:NetBSD Modified: head/bin/sh/var.c Modified: head/bin/sh/var.c == --- head/bin/sh/var.c Thu Jan 3 19:35:07 2019(r342739) +++ head/bin/sh/var.c Thu Jan 3 20:22:35 2019(r342740) @@ -558,13 +558,13 @@ environment(void) nenv = 0; for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { for (vp = *vpp ; vp ; vp = vp->next) - if (vp->flags & VEXPORT) + if ((vp->flags & (VEXPORT|VUNSET)) == VEXPORT) nenv++; } ep = env = stalloc((nenv + 1) * sizeof *env); for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { for (vp = *vpp ; vp ; vp = vp->next) - if (vp->flags & VEXPORT) + if ((vp->flags & (VEXPORT|VUNSET)) == VEXPORT) *ep++ = vp->text; } *ep = NULL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342741 - head/bin/sh/tests/execution
Author: jilles Date: Thu Jan 3 20:23:12 2019 New Revision: 342741 URL: https://svnweb.freebsd.org/changeset/base/342741 Log: sh: Add test for exported but unset variables PR: 233545 Added: head/bin/sh/tests/execution/env1.0 (contents, props changed) Modified: head/bin/sh/tests/execution/Makefile Modified: head/bin/sh/tests/execution/Makefile == --- head/bin/sh/tests/execution/MakefileThu Jan 3 20:22:35 2019 (r342740) +++ head/bin/sh/tests/execution/MakefileThu Jan 3 20:23:12 2019 (r342741) @@ -17,6 +17,7 @@ ${PACKAGE}FILES+= bg7.0 ${PACKAGE}FILES+= bg8.0 ${PACKAGE}FILES+= bg9.0 ${PACKAGE}FILES+= bg10.0 bg10.0.stdout +${PACKAGE}FILES+= env1.0 ${PACKAGE}FILES+= fork1.0 ${PACKAGE}FILES+= fork2.0 ${PACKAGE}FILES+= fork3.0 Added: head/bin/sh/tests/execution/env1.0 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/execution/env1.0 Thu Jan 3 20:23:12 2019 (r342741) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +unset somestrangevar +export somestrangevar +[ "`$SH -c 'echo ${somestrangevar-unset}'`" = unset ] ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342739 - head/sys/i386/i386
Author: kib Date: Thu Jan 3 19:35:07 2019 New Revision: 342739 URL: https://svnweb.freebsd.org/changeset/base/342739 Log: Fix typo in r342710. Noted by: lidl MFC after:3 days Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Thu Jan 3 18:30:36 2019(r342738) +++ head/sys/i386/i386/pmap.c Thu Jan 3 19:35:07 2019(r342739) @@ -569,7 +569,7 @@ pmap_cold(void) /* * Bootstrap the system enough to run with virtual memory. * - * On the i386 this is called after pmap_cold() created intial + * On the i386 this is called after pmap_cold() created initial * kernel page table and enabled paging, and just syncs the pmap * module with what has already been done. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342737 - head/tests/sys/netmap
Author: vmaffione Date: Thu Jan 3 16:47:05 2019 New Revision: 342737 URL: https://svnweb.freebsd.org/changeset/base/342737 Log: netmap: unit tests: fix issues found by coverity scan Reported by: asomers MFC after:1 week Sponsored by: Sunny Valley Networks Modified: head/tests/sys/netmap/ctrl-api-test.c Modified: head/tests/sys/netmap/ctrl-api-test.c == --- head/tests/sys/netmap/ctrl-api-test.c Thu Jan 3 16:26:52 2019 (r342736) +++ head/tests/sys/netmap/ctrl-api-test.c Thu Jan 3 16:47:05 2019 (r342737) @@ -83,16 +83,19 @@ exec_command(int argc, const char *const argv[]) child_pid = fork(); if (child_pid == 0) { char **av; + int fds[3]; /* Child process. Redirect stdin, stdout * and stderr. */ - close(0); - close(1); - close(2); - if (open("/dev/null", O_RDONLY) < 0 || - open("/dev/null", O_RDONLY) < 0 || - open("/dev/null", O_RDONLY) < 0) { - return -1; + for (i = 0; i < 3; i++) { + close(i); + fds[i] = open("/dev/null", O_RDONLY); + if (fds[i] < 0) { + for (i--; i >= 0; i--) { + close(fds[i]); + } + return -1; + } } /* Make a copy of the arguments, passing them to execvp. */ @@ -128,7 +131,8 @@ exec_command(int argc, const char *const argv[]) #define THRET_FAILURE ((void *)0) struct TestContext { - char ifname[128]; + char ifname[64]; + char ifname_ext[128]; char bdgname[64]; uint32_t nr_tx_slots; /* slots in tx rings */ uint32_t nr_rx_slots; /* slots in rx rings */ @@ -171,9 +175,9 @@ port_info_get(struct TestContext *ctx) int success; int ret; - printf("Testing NETMAP_REQ_PORT_INFO_GET on '%s'\n", ctx->ifname); + printf("Testing NETMAP_REQ_PORT_INFO_GET on '%s'\n", ctx->ifname_ext); - nmreq_hdr_init(, ctx->ifname); + nmreq_hdr_init(, ctx->ifname_ext); hdr.nr_reqtype = NETMAP_REQ_PORT_INFO_GET; hdr.nr_body= (uintptr_t) memset(, 0, sizeof(req)); @@ -218,9 +222,9 @@ port_register(struct TestContext *ctx) printf("Testing NETMAP_REQ_REGISTER(mode=%d,ringid=%d," "flags=0x%llx) on '%s'\n", ctx->nr_mode, ctx->nr_ringid, (unsigned long long)ctx->nr_flags, - ctx->ifname); + ctx->ifname_ext); - nmreq_hdr_init(, ctx->ifname); + nmreq_hdr_init(, ctx->ifname_ext); hdr.nr_reqtype = NETMAP_REQ_REGISTER; hdr.nr_body= (uintptr_t) hdr.nr_options = (uintptr_t)ctx->nr_opt; @@ -284,10 +288,10 @@ niocregif(struct TestContext *ctx, int netmap_api) int success; int ret; - printf("Testing legacy NIOCREGIF on '%s'\n", ctx->ifname); + printf("Testing legacy NIOCREGIF on '%s'\n", ctx->ifname_ext); memset(, 0, sizeof(req)); - memcpy(req.nr_name, ctx->ifname, sizeof(req.nr_name)); + memcpy(req.nr_name, ctx->ifname_ext, sizeof(req.nr_name)); req.nr_name[sizeof(req.nr_name) - 1] = '\0'; req.nr_version = netmap_api; req.nr_ringid = ctx->nr_ringid; @@ -399,7 +403,7 @@ legacy_regif_extra_bufs(struct TestContext *ctx) static int legacy_regif_extra_bufs_pipe(struct TestContext *ctx) { - strncat(ctx->ifname, "{pipeexbuf", sizeof(ctx->ifname)); + strncat(ctx->ifname_ext, "{pipeexbuf", sizeof(ctx->ifname_ext)); ctx->nr_mode = NR_REG_ALL_NIC; ctx->nr_extra_bufs = 58;/* arbitrary number of extra bufs */ @@ -409,7 +413,7 @@ legacy_regif_extra_bufs_pipe(struct TestContext *ctx) static int legacy_regif_extra_bufs_pipe_vale(struct TestContext *ctx) { - strncpy(ctx->ifname, "valeX1:Y4", sizeof(ctx->ifname)); + strncpy(ctx->ifname_ext, "valeX1:Y4", sizeof(ctx->ifname_ext)); return legacy_regif_extra_bufs_pipe(ctx); } @@ -478,10 +482,10 @@ vale_attach(struct TestContext *ctx) { struct nmreq_vale_attach req; struct nmreq_header hdr; - char vpname[sizeof(ctx->bdgname) + 1 + sizeof(ctx->ifname)]; + char vpname[sizeof(ctx->bdgname) + 1 + sizeof(ctx->ifname_ext)]; int ret; - snprintf(vpname, sizeof(vpname), "%s:%s", ctx->bdgname, ctx->ifname); + snprintf(vpname, sizeof(vpname), "%s:%s", ctx->bdgname, ctx->ifname_ext); printf("Testing NETMAP_REQ_VALE_ATTACH on '%s'\n", vpname); nmreq_hdr_init(, vpname); @@ -516,7 +520,7 @@ vale_detach(struct TestContext *ctx) char vpname[256]; int ret; - snprintf(vpname,
svn commit: r342736 - head/sys/riscv/riscv
Author: markj Date: Thu Jan 3 16:26:52 2019 New Revision: 342736 URL: https://svnweb.freebsd.org/changeset/base/342736 Log: Fix a use-after-free in the riscv pmap_release() implementation. Don't bother zeroing the top-level page before freeing it. Previously, the page was freed before being zeroed. Reviewed by: jhb, kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18720 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Thu Jan 3 16:24:03 2019(r342735) +++ head/sys/riscv/riscv/pmap.c Thu Jan 3 16:26:52 2019(r342736) @@ -1297,17 +1297,13 @@ pmap_release(pmap_t pmap) ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l1)); - vm_page_unwire_noq(m); - vm_page_free_zero(m); - - /* Remove pmap from the allpmaps list */ mtx_lock(_lock); LIST_REMOVE(pmap, pm_list); mtx_unlock(_lock); - /* Remove kernel pagetables */ - bzero(pmap->pm_l1, PAGE_SIZE); + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l1)); + vm_page_unwire_noq(m); + vm_page_free(m); } #if 0 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342735 - head/sys/riscv/riscv
Author: markj Date: Thu Jan 3 16:24:03 2019 New Revision: 342735 URL: https://svnweb.freebsd.org/changeset/base/342735 Log: Synchronize access to the allpmaps list. The list will be removed with some future work. Reviewed by: jhb MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18721 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Thu Jan 3 16:21:44 2019(r342734) +++ head/sys/riscv/riscv/pmap.c Thu Jan 3 16:24:03 2019(r342735) @@ -228,6 +228,7 @@ CTASSERT((DMAP_MIN_ADDRESS & ~L1_OFFSET) == DMAP_MIN_ CTASSERT((DMAP_MAX_ADDRESS & ~L1_OFFSET) == DMAP_MAX_ADDRESS); static struct rwlock_padalign pvh_global_lock; +static struct mtx_padalign allpmaps_lock; /* * Data for the pv entry allocation mechanism @@ -380,10 +381,12 @@ pmap_distribute_l1(struct pmap *pmap, vm_pindex_t l1in if (pmap != kernel_pmap) return; + mtx_lock(_lock); LIST_FOREACH(user_pmap, , pm_list) { l1 = _pmap->pm_l1[l1index]; pmap_store(l1, entry); } + mtx_unlock(_lock); } static pt_entry_t * @@ -636,9 +639,10 @@ pmap_init(void) int i; /* -* Initialize the pv chunk list mutex. +* Initialize the pv chunk and pmap list mutexes. */ mtx_init(_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF); + mtx_init(_lock, "allpmaps", NULL, MTX_DEF); /* * Initialize the pool of pv list locks. @@ -1132,7 +1136,9 @@ pmap_pinit(pmap_t pmap) memcpy(pmap->pm_l1, kernel_pmap->pm_l1, PAGE_SIZE); /* Add to the list of all user pmaps */ + mtx_lock(_lock); LIST_INSERT_HEAD(, pmap, pm_list); + mtx_unlock(_lock); return (1); } @@ -1296,7 +1302,9 @@ pmap_release(pmap_t pmap) vm_page_free_zero(m); /* Remove pmap from the allpmaps list */ + mtx_lock(_lock); LIST_REMOVE(pmap, pm_list); + mtx_unlock(_lock); /* Remove kernel pagetables */ bzero(pmap->pm_l1, PAGE_SIZE); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342734 - head/sys/riscv/riscv
Author: markj Date: Thu Jan 3 16:21:44 2019 New Revision: 342734 URL: https://svnweb.freebsd.org/changeset/base/342734 Log: Fix some issues with the riscv pmap_protect() implementation. - Handle VM_PROT_EXECUTE. - Clear PTE_D and mark the page dirty when removing write access from a mapping. - Atomically clear PTE_W to avoid clobbering a hardware PTE update. Reviewed by: jhb, kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18719 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Thu Jan 3 16:19:32 2019(r342733) +++ head/sys/riscv/riscv/pmap.c Thu Jan 3 16:21:44 2019(r342734) @@ -1853,22 +1853,28 @@ pmap_remove_all(vm_page_t m) void pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) { - vm_offset_t va_next; pd_entry_t *l1, *l2; - pt_entry_t *l3p, l3; - pt_entry_t entry; + pt_entry_t *l3, l3e, mask; + vm_page_t m; + vm_offset_t va_next; if ((prot & VM_PROT_READ) == VM_PROT_NONE) { pmap_remove(pmap, sva, eva); return; } - if ((prot & VM_PROT_WRITE) == VM_PROT_WRITE) + if ((prot & (VM_PROT_WRITE | VM_PROT_EXECUTE)) == + (VM_PROT_WRITE | VM_PROT_EXECUTE)) return; + mask = 0; + if ((prot & VM_PROT_WRITE) == 0) + mask |= PTE_W | PTE_D; + if ((prot & VM_PROT_EXECUTE) == 0) + mask |= PTE_X; + PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { - l1 = pmap_l1(pmap, sva); if (pmap_load(l1) == 0) { va_next = (sva + L1_SIZE) & ~L1_OFFSET; @@ -1882,26 +1888,30 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL) + if (l2 == NULL || pmap_load(l2) == 0) continue; - if (pmap_load(l2) == 0) - continue; if ((pmap_load(l2) & PTE_RX) != 0) continue; if (va_next > eva) va_next = eva; - for (l3p = pmap_l2_to_l3(l2, sva); sva != va_next; l3p++, + for (l3 = pmap_l2_to_l3(l2, sva); sva != va_next; l3++, sva += L3_SIZE) { - l3 = pmap_load(l3p); - if ((l3 & PTE_V) != 0) { - entry = pmap_load(l3p); - entry &= ~PTE_W; - pmap_store(l3p, entry); - /* XXX: Use pmap_invalidate_range */ - pmap_invalidate_page(pmap, sva); + l3e = pmap_load(l3); +retry: + if ((l3e & PTE_V) == 0) + continue; + if ((prot & VM_PROT_WRITE) == 0 && + (l3e & (PTE_SW_MANAGED | PTE_D)) == + (PTE_SW_MANAGED | PTE_D)) { + m = PHYS_TO_VM_PAGE(PTE_TO_PHYS(l3e)); + vm_page_dirty(m); } + if (!atomic_fcmpset_long(l3, , l3e & ~mask)) + goto retry; + /* XXX: Use pmap_invalidate_range */ + pmap_invalidate_page(pmap, sva); } } PMAP_UNLOCK(pmap); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342733 - head/sys/riscv/riscv
Author: markj Date: Thu Jan 3 16:19:32 2019 New Revision: 342733 URL: https://svnweb.freebsd.org/changeset/base/342733 Log: Set PTE_U on PTEs created by pmap_enter_quick(). Otherwise prefaulted entries are not accessible from user mode and end up triggering a fault upon access, so prefaulting has no effect. Reviewed by: jhb, kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18718 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Thu Jan 3 16:15:28 2019(r342732) +++ head/sys/riscv/riscv/pmap.c Thu Jan 3 16:19:32 2019(r342733) @@ -2365,19 +2365,14 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v */ pmap_resident_count_inc(pmap, 1); - pa = VM_PAGE_TO_PHYS(m); - pn = (pa / PAGE_SIZE); - - entry = PTE_V | PTE_R; - if (prot & VM_PROT_EXECUTE) - entry |= PTE_X; - entry |= (pn << PTE_PPN0_S); - - /* -* Now validate mapping with RO protection -*/ + newl3 = ((VM_PAGE_TO_PHYS(m) / PAGE_SIZE) << PTE_PPN0_S) | + PTE_V | PTE_R; + if ((prot & VM_PROT_EXECUTE) != 0) + newl3 |= PTE_X; if ((m->oflags & VPO_UNMANAGED) == 0) - entry |= PTE_SW_MANAGED; + newl3 |= PTE_SW_MANAGED; + if (va < VM_MAX_USER_ADDRESS) + newl3 |= PTE_U; /* * Sync the i-cache on all harts before updating the PTE @@ -2386,7 +2381,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v if (prot & VM_PROT_EXECUTE) pmap_sync_icache(pmap, va, PAGE_SIZE); - pmap_store(l3, entry); + pmap_store(l3, newl3); pmap_invalidate_page(pmap, va); return (mpte); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342732 - head/sys/riscv/riscv
Author: markj Date: Thu Jan 3 16:15:28 2019 New Revision: 342732 URL: https://svnweb.freebsd.org/changeset/base/342732 Log: Use regular stores to update PTEs in the riscv pmap layer. There's no need to use atomics when the previous value isn't needed. No functional change intended. Reviewed by: kib Discussed with: jhb MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18717 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Thu Jan 3 16:11:21 2019(r342731) +++ head/sys/riscv/riscv/pmap.c Thu Jan 3 16:15:28 2019(r342732) @@ -257,15 +257,13 @@ static void _pmap_unwire_l3(pmap_t pmap, vm_offset_t v struct spglist *free); static int pmap_unuse_l3(pmap_t, vm_offset_t, pd_entry_t, struct spglist *); -/* - * These load the old table data and store the new value. - * They need to be atomic as the System MMU may write to the table at - * the same time as the CPU. - */ -#definepmap_load_store(table, entry) atomic_swap_64(table, entry) -#definepmap_set(table, mask) atomic_set_64(table, mask) -#definepmap_load_clear(table) atomic_swap_64(table, 0) -#definepmap_load(table) (*table) +#definepmap_clear(pte) pmap_store(pte, 0) +#definepmap_clear_bits(pte, bits) atomic_clear_64(pte, bits) +#definepmap_load_store(pte, entry) atomic_swap_64(pte, entry) +#definepmap_load_clear(pte)pmap_load_store(pte, 0) +#definepmap_load(pte) atomic_load_64(pte) +#definepmap_store(pte, entry) atomic_store_64(pte, entry) +#definepmap_store_bits(pte, bits) atomic_set_64(pte, bits) // /* Inline functions */ @@ -384,10 +382,7 @@ pmap_distribute_l1(struct pmap *pmap, vm_pindex_t l1in LIST_FOREACH(user_pmap, , pm_list) { l1 = _pmap->pm_l1[l1index]; - if (entry) - pmap_load_store(l1, entry); - else - pmap_load_clear(l1); + pmap_store(l1, entry); } } @@ -455,7 +450,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi pn = (pa / PAGE_SIZE); entry = PTE_KERN; entry |= (pn << PTE_PPN0_S); - pmap_load_store([l1_slot], entry); + pmap_store([l1_slot], entry); } /* Set the upper limit of the DMAP region */ @@ -489,7 +484,7 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm pn = (pa / PAGE_SIZE); entry = (PTE_V); entry |= (pn << PTE_PPN0_S); - pmap_load_store([l2_slot], entry); + pmap_store([l2_slot], entry); l3pt += PAGE_SIZE; } @@ -875,7 +870,7 @@ pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm pn = (pa / PAGE_SIZE); entry = PTE_KERN; entry |= (pn << PTE_PPN0_S); - pmap_load_store(l3, entry); + pmap_store(l3, entry); va += PAGE_SIZE; pa += PAGE_SIZE; @@ -896,8 +891,7 @@ pmap_kremove(vm_offset_t va) l3 = pmap_l3(kernel_pmap, va); KASSERT(l3 != NULL, ("pmap_kremove: Invalid address")); - pmap_load_clear(l3); - + pmap_clear(l3); sfence_vma(); } @@ -916,7 +910,7 @@ pmap_kremove_device(vm_offset_t sva, vm_size_t size) while (size != 0) { l3 = pmap_l3(kernel_pmap, va); KASSERT(l3 != NULL, ("Invalid page table, va: 0x%lx", va)); - pmap_load_clear(l3); + pmap_clear(l3); va += PAGE_SIZE; size -= PAGE_SIZE; @@ -973,7 +967,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) entry = PTE_KERN; entry |= (pn << PTE_PPN0_S); - pmap_load_store(l3, entry); + pmap_store(l3, entry); va += L3_SIZE; } @@ -993,14 +987,10 @@ pmap_qremove(vm_offset_t sva, int count) KASSERT(sva >= VM_MIN_KERNEL_ADDRESS, ("usermode va %lx", sva)); - va = sva; - while (count-- > 0) { + for (va = sva; count-- > 0; va += PAGE_SIZE) { l3 = pmap_l3(kernel_pmap, va); KASSERT(l3 != NULL, ("pmap_kremove: Invalid address")); - - pmap_load_clear(l3); - - va += PAGE_SIZE; + pmap_clear(l3); } pmap_invalidate_range(kernel_pmap, sva, va); } @@ -1057,13 +1047,13 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t /* PD page */ pd_entry_t *l1; l1 = pmap_l1(pmap, va); - pmap_load_clear(l1); +
svn commit: r342731 - head/sys/riscv/conf
Author: markj Date: Thu Jan 3 16:11:21 2019 New Revision: 342731 URL: https://svnweb.freebsd.org/changeset/base/342731 Log: Configure hz=100 in the QEMU target. We currently don't have a good way to dynamically detect whether the kernel is running as a guest. Reviewed by: jhb MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18715 Modified: head/sys/riscv/conf/QEMU Modified: head/sys/riscv/conf/QEMU == --- head/sys/riscv/conf/QEMUThu Jan 3 14:27:51 2019(r342730) +++ head/sys/riscv/conf/QEMUThu Jan 3 16:11:21 2019(r342731) @@ -6,4 +6,5 @@ include "GENERIC" ident QEMU +optionsHZ=100 optionsROOTDEVNAME=\"ufs:/dev/vtbd0\" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342730 - head/sys/dev/usb
Author: hselasky Date: Thu Jan 3 14:27:51 2019 New Revision: 342730 URL: https://svnweb.freebsd.org/changeset/base/342730 Log: Improve USB generic debug messages. Print process ID and name when opening and closing usb/ugenX.Y character device nodes. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_generic.c Modified: head/sys/dev/usb/usb_generic.c == --- head/sys/dev/usb/usb_generic.c Thu Jan 3 09:30:10 2019 (r342729) +++ head/sys/dev/usb/usb_generic.c Thu Jan 3 14:27:51 2019 (r342730) @@ -183,7 +183,8 @@ ugen_open(struct usb_fifo *f, int fflags) struct usb_endpoint_descriptor *ed = ep->edesc; uint8_t type; - DPRINTFN(6, "flag=0x%x\n", fflags); + DPRINTFN(1, "flag=0x%x pid=%d name=%s\n", fflags, + curthread->td_proc->p_pid, curthread->td_proc->p_comm); mtx_lock(f->priv_mtx); switch (usbd_get_speed(f->udev)) { @@ -213,7 +214,9 @@ ugen_open(struct usb_fifo *f, int fflags) static void ugen_close(struct usb_fifo *f, int fflags) { - DPRINTFN(6, "flag=0x%x\n", fflags); + + DPRINTFN(1, "flag=0x%x pid=%d name=%s\n", fflags, + curthread->td_proc->p_pid, curthread->td_proc->p_comm); /* cleanup */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342721 - in head/stand/efi: include libefi loader
Author: tsoome Date: Thu Jan 3 09:03:58 2019 New Revision: 342721 URL: https://svnweb.freebsd.org/changeset/base/342721 Log: loader.efi: update memmap command to recognize new attributes Also move memory type to string translation to libefi for later use. MFC after:2 weeks Modified: head/stand/efi/include/efidef.h head/stand/efi/include/efilib.h head/stand/efi/libefi/env.c head/stand/efi/loader/main.c Modified: head/stand/efi/include/efidef.h == --- head/stand/efi/include/efidef.h Thu Jan 3 08:04:14 2019 (r342720) +++ head/stand/efi/include/efidef.h Thu Jan 3 09:03:58 2019 (r342721) @@ -157,23 +157,27 @@ typedef enum { EfiMemoryMappedIO, EfiMemoryMappedIOPortSpace, EfiPalCode, +EfiPersistentMemory, EfiMaxMemoryType } EFI_MEMORY_TYPE; // possible caching types for the memory range -#define EFI_MEMORY_UC 0x0001 -#define EFI_MEMORY_WC 0x0002 -#define EFI_MEMORY_WT 0x0004 -#define EFI_MEMORY_WB 0x0008 -#define EFI_MEMORY_UCE 0x0010 +#define EFI_MEMORY_UC 0x0001 +#define EFI_MEMORY_WC 0x0002 +#define EFI_MEMORY_WT 0x0004 +#define EFI_MEMORY_WB 0x0008 +#define EFI_MEMORY_UCE 0x0010 // physical memory protection on range -#define EFI_MEMORY_WP 0x1000 -#define EFI_MEMORY_RP 0x2000 -#define EFI_MEMORY_XP 0x4000 +#define EFI_MEMORY_WP 0x1000 +#define EFI_MEMORY_RP 0x2000 +#define EFI_MEMORY_XP 0x4000 +#defineEFI_MEMORY_NV 0x8000 +#defineEFI_MEMORY_MORE_RELIABLE0x0001 +#defineEFI_MEMORY_RO 0x0002 // range requires a runtime mapping -#define EFI_MEMORY_RUNTIME 0x8000 +#define EFI_MEMORY_RUNTIME 0x8000 #define EFI_MEMORY_DESCRIPTOR_VERSION 1 typedef struct { Modified: head/stand/efi/include/efilib.h == --- head/stand/efi/include/efilib.h Thu Jan 3 08:04:14 2019 (r342720) +++ head/stand/efi/include/efilib.h Thu Jan 3 09:03:58 2019 (r342721) @@ -108,6 +108,9 @@ void delay(int usecs); /* EFI environment initialization. */ void efi_init_environment(void); +/* EFI Memory type strings. */ +const char *efi_memory_type(EFI_MEMORY_TYPE); + /* CHAR16 utility functions. */ int wcscmp(CHAR16 *, CHAR16 *); void cpy8to16(const char *, CHAR16 *, size_t); Modified: head/stand/efi/libefi/env.c == --- head/stand/efi/libefi/env.c Thu Jan 3 08:04:14 2019(r342720) +++ head/stand/efi/libefi/env.c Thu Jan 3 09:03:58 2019(r342721) @@ -47,6 +47,49 @@ efi_init_environment(void) COMMAND_SET(efishow, "efi-show", "print some or all EFI variables", command_efi_show); +const char * +efi_memory_type(EFI_MEMORY_TYPE type) +{ + const char *types[] = { + "Reserved", + "LoaderCode", + "LoaderData", + "BootServicesCode", + "BootServicesData", + "RuntimeServicesCode", + "RuntimeServicesData", + "ConventionalMemory", + "UnusableMemory", + "ACPIReclaimMemory", + "ACPIMemoryNVS", + "MemoryMappedIO", + "MemoryMappedIOPortSpace", + "PalCode", + "PersistentMemory" + }; + + switch (type) { + case EfiReservedMemoryType: + case EfiLoaderCode: + case EfiLoaderData: + case EfiBootServicesCode: + case EfiBootServicesData: + case EfiRuntimeServicesCode: + case EfiRuntimeServicesData: + case EfiConventionalMemory: + case EfiUnusableMemory: + case EfiACPIReclaimMemory: + case EfiACPIMemoryNVS: + case EfiMemoryMappedIO: + case EfiMemoryMappedIOPortSpace: + case EfiPalCode: + case EfiPersistentMemory: + return (types[type]); + default: + return ("Unknown"); + } +} + static int efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag) { Modified: head/stand/efi/loader/main.c == --- head/stand/efi/loader/main.cThu Jan 3 08:04:14 2019 (r342720) +++ head/stand/efi/loader/main.cThu Jan 3 09:03:58 2019 (r342721) @@ -1041,7 +1041,7 @@ command_quit(int argc, char *argv[]) COMMAND_SET(memmap, "memmap", "print memory map", command_memmap); static