Date: Fri, 12 Sep 2014 08:16:27 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r271453 - in user/ae/inet6: contrib/llvm/patches contrib/llvm/tools/clang/lib/CodeGen etc share/examples/bhyve share/man/man4 share/man/man9 share/vt/keymaps sys/amd64/include sys/amd64... Message-ID: <201409120816.s8C8GRZ1072357@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Fri Sep 12 08:16:26 2014 New Revision: 271453 URL: http://svnweb.freebsd.org/changeset/base/271453 Log: Merge from head/. Added: user/ae/inet6/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff - copied unchanged from r271452, head/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff user/ae/inet6/sys/arm/altera/socfpga/socfpga_l3regs.h - copied unchanged from r271452, head/sys/arm/altera/socfpga/socfpga_l3regs.h user/ae/inet6/sys/arm/altera/socfpga/socfpga_rstmgr.c - copied unchanged from r271452, head/sys/arm/altera/socfpga/socfpga_rstmgr.c user/ae/inet6/sys/arm/altera/socfpga/socfpga_rstmgr.h - copied unchanged from r271452, head/sys/arm/altera/socfpga/socfpga_rstmgr.h Modified: user/ae/inet6/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp user/ae/inet6/etc/motd user/ae/inet6/share/examples/bhyve/vmrun.sh user/ae/inet6/share/man/man4/cxgbe.4 user/ae/inet6/share/man/man9/ifnet.9 user/ae/inet6/share/vt/keymaps/Makefile user/ae/inet6/sys/amd64/include/vmm.h (contents, props changed) user/ae/inet6/sys/amd64/vmm/intel/vmx.c user/ae/inet6/sys/amd64/vmm/vmm.c user/ae/inet6/sys/arm/altera/socfpga/files.socfpga user/ae/inet6/sys/arm/altera/socfpga/socfpga_common.c user/ae/inet6/sys/boot/fdt/dts/arm/socfpga.dtsi user/ae/inet6/sys/cam/ctl/ctl.c user/ae/inet6/sys/cam/scsi/scsi_all.h user/ae/inet6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c user/ae/inet6/sys/dev/cxgbe/t4_main.c user/ae/inet6/sys/geom/geom_map.c user/ae/inet6/sys/net/if.c user/ae/inet6/sys/net/if_var.h user/ae/inet6/sys/net/route.c user/ae/inet6/sys/net/rtsock.c user/ae/inet6/sys/netinet/in_pcb.c user/ae/inet6/sys/netinet/ip_options.c user/ae/inet6/sys/netinet/ip_output.c user/ae/inet6/sys/sys/param.h user/ae/inet6/usr.bin/mkimg/bsd.c user/ae/inet6/usr.bin/rctl/rctl.8 user/ae/inet6/usr.sbin/bhyve/block_if.c user/ae/inet6/usr.sbin/ctld/ctl.conf.5 user/ae/inet6/usr.sbin/iscsid/login.c Directory Properties: user/ae/inet6/ (props changed) user/ae/inet6/contrib/llvm/ (props changed) user/ae/inet6/contrib/llvm/tools/clang/ (props changed) user/ae/inet6/etc/ (props changed) user/ae/inet6/share/ (props changed) user/ae/inet6/share/man/man4/ (props changed) user/ae/inet6/sys/ (props changed) user/ae/inet6/sys/amd64/vmm/ (props changed) user/ae/inet6/sys/boot/ (props changed) user/ae/inet6/sys/cddl/contrib/opensolaris/ (props changed) user/ae/inet6/usr.bin/mkimg/ (props changed) user/ae/inet6/usr.sbin/bhyve/ (props changed) Copied: user/ae/inet6/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff (from r271452, head/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/inet6/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff Fri Sep 12 08:16:26 2014 (r271453, copy of r271452, head/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff) @@ -0,0 +1,46 @@ +commit 96365aef99ec463375dfdaf6eb260823e0477b6a +Author: Adrian Prantl <aprantl@apple.com> +Date: Tue Apr 1 17:52:06 2014 +0000 + + Debug info: fix a crash when emitting IndirectFieldDecls, which were + previously not handled at all. + rdar://problem/16348575 + + git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205331 91177308-0d34-0410-b5e6-96231b3b80d8 + +diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp +index 82db942..2556cf9 100644 +--- tools/clang/lib/CodeGen/CGDebugInfo.cpp ++++ tools/clangb/lib/CodeGen/CGDebugInfo.cpp +@@ -1252,7 +1252,7 @@ CollectTemplateParams(const TemplateParameterList *TPList, + V = CGM.GetAddrOfFunction(FD); + // Member data pointers have special handling too to compute the fixed + // offset within the object. +- if (isa<FieldDecl>(D)) { ++ if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) { + // These five lines (& possibly the above member function pointer + // handling) might be able to be refactored to use similar code in + // CodeGenModule::getMemberPointerConstant +diff --git a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp +new file mode 100644 +index 0000000..131ceba +--- /dev/null ++++ tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp +@@ -0,0 +1,17 @@ ++// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s ++// ++// Test that indirect field decls are handled gracefully. ++// rdar://problem/16348575 ++// ++template <class T, int T::*ptr> class Foo { }; ++ ++struct Bar { ++ int i1; ++ // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E] ++ union { ++ // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int] ++ int i2; ++ }; ++}; ++ ++Foo<Bar, &Bar::i2> the_foo; Modified: user/ae/inet6/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- user/ae/inet6/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Fri Sep 12 08:16:26 2014 (r271453) @@ -1241,7 +1241,7 @@ CollectTemplateParams(const TemplatePara V = CGM.GetAddrOfFunction(FD); // Member data pointers have special handling too to compute the fixed // offset within the object. - if (isa<FieldDecl>(D)) { + if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) { // These five lines (& possibly the above member function pointer // handling) might be able to be refactored to use similar code in // CodeGenModule::getMemberPointerConstant Modified: user/ae/inet6/etc/motd ============================================================================== --- user/ae/inet6/etc/motd Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/etc/motd Fri Sep 12 08:16:26 2014 (r271453) @@ -1,25 +1,21 @@ FreeBSD ?.?.? (UNKNOWN) -Welcome to FreeBSD! +Welcome to FreeBSD! Handy technical support resources: -Before seeking technical support, please use the following resources: +Security advisories and errata: https://www.FreeBSD.org/releases/ +Handbook: https://www.FreeBSD.org/handbook/ +FAQ: https://www.FreeBSD.org/faq/ +Mailing list: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/ +Forums: https://forums.FreeBSD.org/ + +Documents installed with the system are in the /usr/local/share/doc/freebsd/ +directory, or can be installed later with: pkg install en-freebsd-doc +For other languages, replace "en" with a language code like de or fr. -o Security advisories and updated errata information for all releases are - at http://www.FreeBSD.org/releases/ - always consult the ERRATA section - for your release first as it's updated frequently. - -o The Handbook and FAQ documents are at http://www.FreeBSD.org/ and, - along with the mailing lists, can be searched by going to - http://www.FreeBSD.org/search/. If the doc package has been installed - (or fetched via pkg install lang-freebsd-doc, where lang is the - 2-letter language code, e.g. en), they are also available formatted - in /usr/local/share/doc/freebsd. - -If you still have a question or problem, please take the output of -`uname -a', along with any relevant error messages, and email it -as a question to the questions@FreeBSD.org mailing list. If you are -unfamiliar with FreeBSD's directory layout, please refer to the hier(7) -manual page. If you are not familiar with manual pages, type `man man'. +Show the version of FreeBSD installed: uname -a +Please include that output and any error messages when posting questions. -Edit /etc/motd to change this login announcement. +Introduction to manual pages: man man +FreeBSD directory layout: man hier +Edit /etc/motd to change this login announcement. Modified: user/ae/inet6/share/examples/bhyve/vmrun.sh ============================================================================== --- user/ae/inet6/share/examples/bhyve/vmrun.sh Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/share/examples/bhyve/vmrun.sh Fri Sep 12 08:16:26 2014 (r271453) @@ -196,7 +196,7 @@ while [ 1 ]; do exit 1 fi BOOTDISK=${isofile} - installer_opt="-s 31:0,virtio-blk,${BOOTDISK}" + installer_opt="-s 31:0,ahci-cd,${BOOTDISK}" else BOOTDISK=${virtio_diskdev} installer_opt="" Modified: user/ae/inet6/share/man/man4/cxgbe.4 ============================================================================== --- user/ae/inet6/share/man/man4/cxgbe.4 Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/share/man/man4/cxgbe.4 Fri Sep 12 08:16:26 2014 (r271453) @@ -240,8 +240,19 @@ The default is -1 which lets the driver Controls the hardware response to congestion. -1 disables congestion feedback and is not recommended. 0 instructs the hardware to backpressure its pipeline on congestion. -This usually results in the port emitting pause frames. +This usually results in the port emitting PAUSE frames. 1 instructs the hardware to drop frames destined for congested queues. +.It Va hw.cxgbe.pause_settings +PAUSE frame settings. +Bit 0 is rx_pause, bit 1 is tx_pause. +rx_pause = 1 instructs the hardware to heed incoming PAUSE frames, 0 instructs +it to ignore them. +tx_pause = 1 allows the hardware to emit PAUSE frames when its receive FIFO +reaches a high threshold, 0 prohibits the hardware from emitting PAUSE frames. +The default is 3 (both rx_pause and tx_pause = 1). +This tunable establishes the default PAUSE settings for all ports. +Settings can be displayed and controlled on a per-port basis via the +dev.cxgbe.X.pause_settings (dev.cxl.X.pause_settings for T5 cards) sysctl. .It Va hw.cxgbe.buffer_packing Allow the hardware to deliver multiple frames in the same receive buffer opportunistically. Modified: user/ae/inet6/share/man/man9/ifnet.9 ============================================================================== --- user/ae/inet6/share/man/man9/ifnet.9 Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/share/man/man9/ifnet.9 Fri Sep 12 08:16:26 2014 (r271453) @@ -77,9 +77,9 @@ .Ft "struct ifaddr *" .Fn ifa_ifwithaddr "struct sockaddr *addr" .Ft "struct ifaddr *" -.Fn ifa_ifwithdstaddr "struct sockaddr *addr" +.Fn ifa_ifwithdstaddr "struct sockaddr *addr" "int fib" .Ft "struct ifaddr *" -.Fn ifa_ifwithnet "struct sockaddr *addr" "int ignore_ptp" +.Fn ifa_ifwithnet "struct sockaddr *addr" "int ignore_ptp" "int fib" .Ft "struct ifaddr *" .Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp" .Ft void @@ -1389,7 +1389,16 @@ returns an interface address for a point remote .Pq Dq destination address is -.Fa addr . +.Fa addr +and a fib is +.Fa fib . +If +.Fa fib +is +.Dv RT_ALL_FIBS , +then the first interface address matching +.Fa addr +will be returned. .Pp .Fn ifa_ifwithnet returns the most specific interface address which matches the @@ -1401,7 +1410,10 @@ address whose remote address is if one is found. If .Fa ignore_ptp -is true, skip point-to-point interface addresses. +is true, skip point-to-point interface addresses. The +.Fa fib +parameter is handled the same way as by +.Fn ifa_ifwithdstaddr . .Pp .Fn ifaof_ifpforaddr returns the most specific address configured on interface Modified: user/ae/inet6/share/vt/keymaps/Makefile ============================================================================== --- user/ae/inet6/share/vt/keymaps/Makefile Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/share/vt/keymaps/Makefile Fri Sep 12 08:16:26 2014 (r271453) @@ -31,8 +31,10 @@ FILES= INDEX.keymaps \ es.dvorak.kbd \ es.kbd \ fi.kbd \ + fr.acc.kbd \ fr.dvorak.acc.kbd \ fr.dvorak.kbd \ + fr.kbd \ fr.macbook.kbd \ gr.101.acc.kbd \ gr.elot.acc.kbd \ Modified: user/ae/inet6/sys/amd64/include/vmm.h ============================================================================== --- user/ae/inet6/sys/amd64/include/vmm.h Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/amd64/include/vmm.h Fri Sep 12 08:16:26 2014 (r271453) @@ -82,6 +82,7 @@ enum vm_reg_name { VM_REG_GUEST_PDPTE1, VM_REG_GUEST_PDPTE2, VM_REG_GUEST_PDPTE3, + VM_REG_GUEST_INTR_SHADOW, VM_REG_LAST }; Modified: user/ae/inet6/sys/amd64/vmm/intel/vmx.c ============================================================================== --- user/ae/inet6/sys/amd64/vmm/intel/vmx.c Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/amd64/vmm/intel/vmx.c Fri Sep 12 08:16:26 2014 (r271453) @@ -2712,6 +2712,46 @@ vmxctx_setreg(struct vmxctx *vmxctx, int } static int +vmx_get_intr_shadow(struct vmx *vmx, int vcpu, int running, uint64_t *retval) +{ + uint64_t gi; + int error; + + error = vmcs_getreg(&vmx->vmcs[vcpu], running, + VMCS_IDENT(VMCS_GUEST_INTERRUPTIBILITY), &gi); + *retval = (gi & HWINTR_BLOCKING) ? 1 : 0; + return (error); +} + +static int +vmx_modify_intr_shadow(struct vmx *vmx, int vcpu, int running, uint64_t val) +{ + struct vmcs *vmcs; + uint64_t gi; + int error, ident; + + /* + * Forcing the vcpu into an interrupt shadow is not supported. + */ + if (val) { + error = EINVAL; + goto done; + } + + vmcs = &vmx->vmcs[vcpu]; + ident = VMCS_IDENT(VMCS_GUEST_INTERRUPTIBILITY); + error = vmcs_getreg(vmcs, running, ident, &gi); + if (error == 0) { + gi &= ~HWINTR_BLOCKING; + error = vmcs_setreg(vmcs, running, ident, gi); + } +done: + VCPU_CTR2(vmx->vm, vcpu, "Setting intr_shadow to %#lx %s", val, + error ? "failed" : "succeeded"); + return (error); +} + +static int vmx_shadow_reg(int reg) { int shreg; @@ -2742,6 +2782,9 @@ vmx_getreg(void *arg, int vcpu, int reg, if (running && hostcpu != curcpu) panic("vmx_getreg: %s%d is running", vm_name(vmx->vm), vcpu); + if (reg == VM_REG_GUEST_INTR_SHADOW) + return (vmx_get_intr_shadow(vmx, vcpu, running, retval)); + if (vmxctx_getreg(&vmx->ctx[vcpu], reg, retval) == 0) return (0); @@ -2760,6 +2803,9 @@ vmx_setreg(void *arg, int vcpu, int reg, if (running && hostcpu != curcpu) panic("vmx_setreg: %s%d is running", vm_name(vmx->vm), vcpu); + if (reg == VM_REG_GUEST_INTR_SHADOW) + return (vmx_modify_intr_shadow(vmx, vcpu, running, val)); + if (vmxctx_setreg(&vmx->ctx[vcpu], reg, val) == 0) return (0); Modified: user/ae/inet6/sys/amd64/vmm/vmm.c ============================================================================== --- user/ae/inet6/sys/amd64/vmm/vmm.c Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/amd64/vmm/vmm.c Fri Sep 12 08:16:26 2014 (r271453) @@ -1090,7 +1090,7 @@ vm_handle_hlt(struct vm *vm, int vcpuid, { struct vcpu *vcpu; const char *wmesg; - int t, vcpu_halted, vm_halted; + int error, t, vcpu_halted, vm_halted; KASSERT(!CPU_ISSET(vcpuid, &vm->halted_cpus), ("vcpu already halted")); @@ -1098,6 +1098,22 @@ vm_handle_hlt(struct vm *vm, int vcpuid, vcpu_halted = 0; vm_halted = 0; + /* + * The typical way to halt a cpu is to execute: "sti; hlt" + * + * STI sets RFLAGS.IF to enable interrupts. However, the processor + * remains in an "interrupt shadow" for an additional instruction + * following the STI. This guarantees that "sti; hlt" sequence is + * atomic and a pending interrupt will be recognized after the HLT. + * + * After the HLT emulation is done the vcpu is no longer in an + * interrupt shadow and a pending interrupt can be injected on + * the next entry into the guest. + */ + error = vm_set_register(vm, vcpuid, VM_REG_GUEST_INTR_SHADOW, 0); + KASSERT(error == 0, ("%s: error %d clearing interrupt shadow", + __func__, error)); + vcpu_lock(vcpu); while (1) { /* Modified: user/ae/inet6/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- user/ae/inet6/sys/arm/altera/socfpga/files.socfpga Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/arm/altera/socfpga/files.socfpga Fri Sep 12 08:16:26 2014 (r271453) @@ -16,3 +16,4 @@ arm/arm/mpcore_timer.c standard arm/altera/socfpga/socfpga_common.c standard arm/altera/socfpga/socfpga_machdep.c standard arm/altera/socfpga/socfpga_manager.c standard +arm/altera/socfpga/socfpga_rstmgr.c standard Modified: user/ae/inet6/sys/arm/altera/socfpga/socfpga_common.c ============================================================================== --- user/ae/inet6/sys/arm/altera/socfpga/socfpga_common.c Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/arm/altera/socfpga/socfpga_common.c Fri Sep 12 08:16:26 2014 (r271453) @@ -42,20 +42,31 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/fdt.h> -#define RESMAN_BASE 0xFFD05000 -#define RESMAN_CTRL 0x4 -#define SWWARMRSTREQ (1 << 1) +#include <arm/altera/socfpga/socfpga_rstmgr.h> void cpu_reset(void) { + uint32_t addr, paddr; bus_addr_t vaddr; + phandle_t node; - if (bus_space_map(fdtbus_bs_tag, RESMAN_BASE, 0x10, 0, &vaddr) == 0) { - bus_space_write_4(fdtbus_bs_tag, vaddr, - RESMAN_CTRL, SWWARMRSTREQ); + if (rstmgr_warmreset() == 0) + goto end; + + node = OF_finddevice("rstmgr"); + if (node == -1) + goto end; + + if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) { + addr = fdt32_to_cpu(paddr); + if (bus_space_map(fdtbus_bs_tag, addr, 0x8, 0, &vaddr) == 0) { + bus_space_write_4(fdtbus_bs_tag, vaddr, + RSTMGR_CTRL, CTRL_SWWARMRSTREQ); + } } +end: while (1); } Copied: user/ae/inet6/sys/arm/altera/socfpga/socfpga_l3regs.h (from r271452, head/sys/arm/altera/socfpga/socfpga_l3regs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/inet6/sys/arm/altera/socfpga/socfpga_l3regs.h Fri Sep 12 08:16:26 2014 (r271453, copy of r271452, head/sys/arm/altera/socfpga/socfpga_l3regs.h) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#define L3REGS_REMAP 0x0 /* Remap */ +#define REMAP_LWHPS2FPGA (1 << 4) +#define REMAP_HPS2FPGA (1 << 3) +#define REMAP_MPUZERO (1 << 0) +#define L3REGS_L4MAIN 0x8 /* L4 main peripherals security */ +#define L3REGS_L4SP 0xC /* L4 SP Peripherals Security */ +#define L3REGS_L4MP 0x10 /* L4 MP Peripherals Security */ +#define L3REGS_L4OSC1 0x14 /* L4 OSC1 Peripherals Security */ +#define L3REGS_L4SPIM 0x18 /* L4 SPIM Peripherals Security */ +#define L3REGS_STM 0x1C /* STM Peripheral Security */ +#define L3REGS_LWHPS2FPGAREGS 0x20 /* LWHPS2FPGA AXI Bridge Security */ +#define L3REGS_USB1 0x28 /* USB1 Peripheral Security */ +#define L3REGS_NANDDATA 0x2C /* NAND Flash Controller Data Sec */ +#define L3REGS_USB0 0x80 /* USB0 Peripheral Security */ +#define L3REGS_NANDREGS 0x84 /* NAND Flash Controller Security */ +#define L3REGS_QSPIDATA 0x88 /* QSPI Flash Controller Data Sec */ +#define L3REGS_FPGAMGRDATA 0x8C /* FPGA Manager Data Peripheral Sec */ +#define L3REGS_HPS2FPGAREGS 0x90 /* HPS2FPGA AXI Bridge Perip. Sec */ +#define L3REGS_ACP 0x94 /* MPU ACP Peripheral Security */ +#define L3REGS_ROM 0x98 /* ROM Peripheral Security */ +#define L3REGS_OCRAM 0x9C /* On-chip RAM Peripheral Security */ +#define L3REGS_SDRDATA 0xA0 /* SDRAM Data Peripheral Security */ Copied: user/ae/inet6/sys/arm/altera/socfpga/socfpga_rstmgr.c (from r271452, head/sys/arm/altera/socfpga/socfpga_rstmgr.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/inet6/sys/arm/altera/socfpga/socfpga_rstmgr.c Fri Sep 12 08:16:26 2014 (r271453, copy of r271452, head/sys/arm/altera/socfpga/socfpga_rstmgr.c) @@ -0,0 +1,259 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * SOCFPGA Reset Manager. + * Chapter 3, Cyclone V Device Handbook (CV-5V2 2014.07.22) + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> +#include <sys/module.h> +#include <sys/malloc.h> +#include <sys/rman.h> +#include <sys/timeet.h> +#include <sys/timetc.h> +#include <sys/sysctl.h> + +#include <dev/fdt/fdt_common.h> +#include <dev/ofw/openfirm.h> +#include <dev/ofw/ofw_bus.h> +#include <dev/ofw/ofw_bus_subr.h> + +#include <machine/bus.h> +#include <machine/fdt.h> +#include <machine/cpu.h> +#include <machine/intr.h> + +#include <arm/altera/socfpga/socfpga_common.h> +#include <arm/altera/socfpga/socfpga_rstmgr.h> +#include <arm/altera/socfpga/socfpga_l3regs.h> + +struct rstmgr_softc { + struct resource *res[1]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + device_t dev; +}; + +struct rstmgr_softc *rstmgr_sc; + +static struct resource_spec rstmgr_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +enum { + RSTMGR_SYSCTL_FPGA2HPS, + RSTMGR_SYSCTL_LWHPS2FPGA, + RSTMGR_SYSCTL_HPS2FPGA +}; + +static int +l3remap(struct rstmgr_softc *sc, int remap, int enable) +{ + uint32_t addr, paddr; + bus_addr_t vaddr; + phandle_t node; + int reg; + + /* + * Control whether bridge is visible to L3 masters or not. + * Register is write-only. + */ + + reg = REMAP_MPUZERO; + if (enable) + reg |= (remap); + else + reg &= ~(remap); + + node = OF_finddevice("l3regs"); + if (node == -1) { + device_printf(sc->dev, "Can't find l3regs node\n"); + return (1); + } + + if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) { + addr = fdt32_to_cpu(paddr); + if (bus_space_map(fdtbus_bs_tag, addr, 0x4, 0, &vaddr) == 0) { + bus_space_write_4(fdtbus_bs_tag, vaddr, + L3REGS_REMAP, reg); + return (0); + } + } + + return (1); +} + +static int +rstmgr_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rstmgr_softc *sc; + int enable; + int remap; + int err; + int reg; + int bit; + + sc = arg1; + + switch (arg2) { + case RSTMGR_SYSCTL_FPGA2HPS: + bit = BRGMODRST_FPGA2HPS; + remap = 0; + break; + case RSTMGR_SYSCTL_LWHPS2FPGA: + bit = BRGMODRST_LWHPS2FPGA; + remap = REMAP_LWHPS2FPGA; + break; + case RSTMGR_SYSCTL_HPS2FPGA: + bit = BRGMODRST_HPS2FPGA; + remap = REMAP_HPS2FPGA; + break; + default: + return (1); + }; + + reg = READ4(sc, RSTMGR_BRGMODRST); + enable = reg & bit ? 0 : 1; + + err = sysctl_handle_int(oidp, &enable, 0, req); + if (err || !req->newptr) + return (err); + + if (enable == 1) + reg &= ~(bit); + else if (enable == 0) + reg |= (bit); + else + return (EINVAL); + + WRITE4(sc, RSTMGR_BRGMODRST, reg); + l3remap(sc, remap, enable); + + return (0); +} + +int +rstmgr_warmreset(void) +{ + struct rstmgr_softc *sc; + + sc = rstmgr_sc; + if (sc == NULL) + return (1); + + /* Request warm reset */ + WRITE4(sc, RSTMGR_CTRL, + CTRL_SWWARMRSTREQ); + + return (0); +} + +static int +rstmgr_add_sysctl(struct rstmgr_softc *sc) +{ + struct sysctl_oid_list *children; + struct sysctl_ctx_list *ctx; + + ctx = device_get_sysctl_ctx(sc->dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "fpga2hps", + CTLTYPE_UINT | CTLFLAG_RW, sc, RSTMGR_SYSCTL_FPGA2HPS, + rstmgr_sysctl, "I", "Enable fpga2hps bridge"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "lwhps2fpga", + CTLTYPE_UINT | CTLFLAG_RW, sc, RSTMGR_SYSCTL_LWHPS2FPGA, + rstmgr_sysctl, "I", "Enable lwhps2fpga bridge"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "hps2fpga", + CTLTYPE_UINT | CTLFLAG_RW, sc, RSTMGR_SYSCTL_HPS2FPGA, + rstmgr_sysctl, "I", "Enable hps2fpga bridge"); + + return (0); +} + +static int +rstmgr_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "altr,rst-mgr")) + return (ENXIO); + + device_set_desc(dev, "Reset Manager"); + return (BUS_PROBE_DEFAULT); +} + +static int +rstmgr_attach(device_t dev) +{ + struct rstmgr_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, rstmgr_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + rstmgr_sc = sc; + rstmgr_add_sysctl(sc); + + return (0); +} + +static device_method_t rstmgr_methods[] = { + DEVMETHOD(device_probe, rstmgr_probe), + DEVMETHOD(device_attach, rstmgr_attach), + { 0, 0 } +}; + +static driver_t rstmgr_driver = { + "rstmgr", + rstmgr_methods, + sizeof(struct rstmgr_softc), +}; + +static devclass_t rstmgr_devclass; + +DRIVER_MODULE(rstmgr, simplebus, rstmgr_driver, rstmgr_devclass, 0, 0); Copied: user/ae/inet6/sys/arm/altera/socfpga/socfpga_rstmgr.h (from r271452, head/sys/arm/altera/socfpga/socfpga_rstmgr.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/inet6/sys/arm/altera/socfpga/socfpga_rstmgr.h Fri Sep 12 08:16:26 2014 (r271453, copy of r271452, head/sys/arm/altera/socfpga/socfpga_rstmgr.h) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#define RSTMGR_STAT 0x0 /* Status */ +#define RSTMGR_CTRL 0x4 /* Control */ +#define CTRL_SWWARMRSTREQ (1 << 1) /* Trigger warm reset */ +#define RSTMGR_COUNTS 0x8 /* Reset Cycles Count */ +#define RSTMGR_MPUMODRST 0x10 /* MPU Module Reset */ +#define RSTMGR_PERMODRST 0x14 /* Peripheral Module Reset */ +#define RSTMGR_PER2MODRST 0x18 /* Peripheral 2 Module Reset */ +#define RSTMGR_BRGMODRST 0x1C /* Bridge Module Reset */ +#define BRGMODRST_FPGA2HPS (1 << 2) +#define BRGMODRST_LWHPS2FPGA (1 << 1) +#define BRGMODRST_HPS2FPGA (1 << 0) +#define RSTMGR_MISCMODRST 0x20 /* Miscellaneous Module Reset */ + +int rstmgr_warmreset(void); Modified: user/ae/inet6/sys/boot/fdt/dts/arm/socfpga.dtsi ============================================================================== --- user/ae/inet6/sys/boot/fdt/dts/arm/socfpga.dtsi Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/boot/fdt/dts/arm/socfpga.dtsi Fri Sep 12 08:16:26 2014 (r271453) @@ -39,6 +39,8 @@ aliases { soc = &SOC; + rstmgr = &rstmgr; + l3regs = &l3regs; serial0 = &serial0; serial1 = &serial1; }; @@ -69,6 +71,16 @@ interrupt-parent = < &GIC >; }; + rstmgr: rstmgr@ffd05000 { + compatible = "altr,rst-mgr"; + reg = <0xffd05000 0x1000>; + }; + + l3regs: l3regs@ff800000 { + compatible = "altr,l3regs"; + reg = <0xff800000 0x1000>; + }; + fpgamgr: fpgamgr@ff706000 { compatible = "altr,fpga-mgr"; reg = <0xff706000 0x1000>, /* FPGAMGRREGS */ Modified: user/ae/inet6/sys/cam/ctl/ctl.c ============================================================================== --- user/ae/inet6/sys/cam/ctl/ctl.c Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/cam/ctl/ctl.c Fri Sep 12 08:16:26 2014 (r271453) @@ -320,11 +320,11 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verb /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), - * Mode Page Policy (0x87), + * Extended INQUIRY Data (0x86), Mode Page Policy (0x87), * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0), * Block Device Characteristics (0xB1) and Logical Block Provisioning (0xB2) */ -#define SCSI_EVPD_NUM_SUPPORTED_PAGES 9 +#define SCSI_EVPD_NUM_SUPPORTED_PAGES 10 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event, int param); @@ -380,6 +380,7 @@ static void ctl_hndl_per_res_out_on_othe static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); +static int ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len); @@ -9838,18 +9839,20 @@ ctl_inquiry_evpd_supported(struct ctl_sc pages->page_list[1] = SVPD_UNIT_SERIAL_NUMBER; /* Device Identification */ pages->page_list[2] = SVPD_DEVICE_ID; + /* Extended INQUIRY Data */ + pages->page_list[3] = SVPD_EXTENDED_INQUIRY_DATA; /* Mode Page Policy */ - pages->page_list[3] = SVPD_MODE_PAGE_POLICY; + pages->page_list[4] = SVPD_MODE_PAGE_POLICY; /* SCSI Ports */ - pages->page_list[4] = SVPD_SCSI_PORTS; + pages->page_list[5] = SVPD_SCSI_PORTS; /* Third-party Copy */ - pages->page_list[5] = SVPD_SCSI_TPC; + pages->page_list[6] = SVPD_SCSI_TPC; /* Block limits */ - pages->page_list[6] = SVPD_BLOCK_LIMITS; + pages->page_list[7] = SVPD_BLOCK_LIMITS; /* Block Device Characteristics */ - pages->page_list[7] = SVPD_BDC; + pages->page_list[8] = SVPD_BDC; /* Logical Block Provisioning */ - pages->page_list[8] = SVPD_LBP; + pages->page_list[9] = SVPD_LBP; ctsio->scsi_status = SCSI_STATUS_OK; @@ -9918,6 +9921,57 @@ ctl_inquiry_evpd_serial(struct ctl_scsii static int +ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) +{ + struct scsi_vpd_extended_inquiry_data *eid_ptr; + struct ctl_lun *lun; + int data_len; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + data_len = sizeof(struct scsi_vpd_mode_page_policy) + + sizeof(struct scsi_vpd_mode_page_policy_descr); + + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; + ctsio->kern_sg_entries = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + /* + * The control device is always connected. The disk device, on the + * other hand, may not be online all the time. + */ + if (lun != NULL) + eid_ptr->device = (SID_QUAL_LU_CONNECTED << 5) | + lun->be_lun->lun_type; + else + eid_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; + eid_ptr->page_code = SVPD_EXTENDED_INQUIRY_DATA; + eid_ptr->page_length = data_len - 4; + eid_ptr->flags2 = SVPD_EID_HEADSUP | SVPD_EID_ORDSUP | SVPD_EID_SIMPSUP; + eid_ptr->flags3 = SVPD_EID_V_SUP; + + ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); +} + +static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) { struct scsi_vpd_mode_page_policy *mpp_ptr; @@ -10399,6 +10453,9 @@ ctl_inquiry_evpd(struct ctl_scsiio *ctsi case SVPD_DEVICE_ID: retval = ctl_inquiry_evpd_devid(ctsio, alloc_len); break; + case SVPD_EXTENDED_INQUIRY_DATA: + retval = ctl_inquiry_evpd_eid(ctsio, alloc_len); + break; case SVPD_MODE_PAGE_POLICY: retval = ctl_inquiry_evpd_mpp(ctsio, alloc_len); break; Modified: user/ae/inet6/sys/cam/scsi/scsi_all.h ============================================================================== --- user/ae/inet6/sys/cam/scsi/scsi_all.h Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/cam/scsi/scsi_all.h Fri Sep 12 08:16:26 2014 (r271453) @@ -2110,6 +2110,55 @@ struct scsi_service_action_in uint8_t control; }; +struct scsi_vpd_extended_inquiry_data +{ + uint8_t device; + uint8_t page_code; +#define SVPD_EXTENDED_INQUIRY_DATA 0x86 + uint8_t reserved; + uint8_t page_length; + uint8_t flags1; +#define SVPD_EID_AM 0xC0 +#define SVPD_EID_SPT 0x38 +#define SVPD_EID_SPT_1 0x00 +#define SVPD_EID_SPT_12 0x08 +#define SVPD_EID_SPT_2 0x10 +#define SVPD_EID_SPT_13 0x18 +#define SVPD_EID_SPT_3 0x20 +#define SVPD_EID_SPT_23 0x28 +#define SVPD_EID_SPT_123 0x38 +#define SVPD_EID_GRD_CHK 0x04 +#define SVPD_EID_APP_CHK 0x02 +#define SVPD_EID_REF_CHK 0x01 + uint8_t flags2; +#define SVPD_EID_UASK_SUP 0x20 +#define SVPD_EID_GROUP_SUP 0x10 +#define SVPD_EID_PRIOR_SUP 0x08 +#define SVPD_EID_HEADSUP 0x04 +#define SVPD_EID_ORDSUP 0x02 +#define SVPD_EID_SIMPSUP 0x01 + uint8_t flags3; +#define SVPD_EID_WU_SUP 0x08 +#define SVPD_EID_CRD_SUP 0x04 +#define SVPD_EID_NV_SUP 0x02 +#define SVPD_EID_V_SUP 0x01 + uint8_t flags4; +#define SVPD_EID_P_I_I_SUP 0x10 +#define SVPD_EID_LUICLT 0x01 + uint8_t flags5; +#define SVPD_EID_R_SUP 0x10 +#define SVPD_EID_CBCS 0x01 + uint8_t flags6; +#define SVPD_EID_MULTI_I_T_FW 0x0F + uint8_t est[2]; + uint8_t flags7; +#define SVPD_EID_POA_SUP 0x80 +#define SVPD_EID_HRA_SUP 0x80 +#define SVPD_EID_VSA_SUP 0x80 + uint8_t max_sense_length; + uint8_t reserved2[50]; +}; + struct scsi_vpd_mode_page_policy_descr { uint8_t page_code; Modified: user/ae/inet6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- user/ae/inet6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Sep 12 08:16:26 2014 (r271453) @@ -1951,12 +1951,15 @@ vdev_dtl_reassess(vdev_t *vd, uint64_t t /* * If the vdev was resilvering and no longer has any - * DTLs then reset its resilvering flag. + * DTLs then reset its resilvering flag and dirty + * the top level so that we persist the change. */ if (vd->vdev_resilver_txg != 0 && range_tree_space(vd->vdev_dtl[DTL_MISSING]) == 0 && - range_tree_space(vd->vdev_dtl[DTL_OUTAGE]) == 0) + range_tree_space(vd->vdev_dtl[DTL_OUTAGE]) == 0) { vd->vdev_resilver_txg = 0; + vdev_config_dirty(vd->vdev_top); + } mutex_exit(&vd->vdev_dtl_lock); Modified: user/ae/inet6/sys/dev/cxgbe/t4_main.c ============================================================================== --- user/ae/inet6/sys/dev/cxgbe/t4_main.c Fri Sep 12 06:23:57 2014 (r271452) +++ user/ae/inet6/sys/dev/cxgbe/t4_main.c Fri Sep 12 08:16:26 2014 (r271453) @@ -281,6 +281,15 @@ static char t4_cfg_file[32] = DEFAULT_CF TUNABLE_STR("hw.cxgbe.config_file", t4_cfg_file, sizeof(t4_cfg_file)); /* + * PAUSE settings (bit 0, 1 = rx_pause, tx_pause respectively). + * rx_pause = 1 to heed incoming PAUSE frames, 0 to ignore them. + * tx_pause = 1 to emit PAUSE frames when the rx FIFO reaches its high water + * mark or when signalled to do so, 0 to never emit PAUSE. + */ +static int t4_pause_settings = PAUSE_TX | PAUSE_RX; +TUNABLE_INT("hw.cxgbe.pause_settings", &t4_pause_settings); + +/* * Firmware auto-install by driver during attach (0, 1, 2 = prohibited, allowed, * encouraged respectively). */ @@ -393,6 +402,7 @@ static int sysctl_holdoff_tmr_idx(SYSCTL static int sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS); +static int sysctl_pause_settings(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); #ifdef SBUF_DRAIN @@ -697,6 +707,12 @@ t4_attach(device_t dev) sc->port[i] = NULL; goto done; } + + pi->link_cfg.requested_fc &= ~(PAUSE_TX | PAUSE_RX); + pi->link_cfg.requested_fc |= t4_pause_settings; + pi->link_cfg.fc &= ~(PAUSE_TX | PAUSE_RX); + pi->link_cfg.fc |= t4_pause_settings; + rc = -t4_link_start(sc, sc->mbox, pi->tx_chan, &pi->link_cfg); if (rc != 0) { device_printf(dev, "port %d l1cfg failed: %d\n", i, rc); @@ -4771,6 +4787,10 @@ cxgbe_sysctls(struct port_info *pi) CTLTYPE_INT | CTLFLAG_RW, pi, 0, sysctl_qsize_txq, "I", "tx queue size"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "pause_settings", + CTLTYPE_STRING | CTLFLAG_RW, pi, PAUSE_TX, sysctl_pause_settings, + "A", "PAUSE settings (bit 0 = rx_pause, bit 1 = tx_pause)"); + /* * dev.cxgbe.X.stats. */ @@ -5152,6 +5172,65 @@ sysctl_qsize_txq(SYSCTL_HANDLER_ARGS) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409120816.s8C8GRZ1072357>