From owner-svn-src-projects@freebsd.org Mon Jul 11 04:21:40 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C444B90EF5 for ; Mon, 11 Jul 2016 04:21:40 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 578AB15DC; Mon, 11 Jul 2016 04:21:40 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B4LdGt099308; Mon, 11 Jul 2016 04:21:39 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B4LdvP099302; Mon, 11 Jul 2016 04:21:39 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607110421.u6B4LdvP099302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 04:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302538 - in projects/powernv: dev/ofw kern net powerpc/aim powerpc/powerpc X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 04:21:40 -0000 Author: nwhitehorn Date: Mon Jul 11 04:21:38 2016 New Revision: 302538 URL: https://svnweb.freebsd.org/changeset/base/302538 Log: Mop up a few more bits of the kernel that don't like the BSP having a non-zero ID. Modified: projects/powernv/dev/ofw/ofw_cpu.c projects/powernv/kern/init_main.c projects/powernv/net/netisr.c projects/powernv/powerpc/aim/mmu_oea64.c projects/powernv/powerpc/powerpc/machdep.c Modified: projects/powernv/dev/ofw/ofw_cpu.c ============================================================================== --- projects/powernv/dev/ofw/ofw_cpu.c Mon Jul 11 04:12:15 2016 (r302537) +++ projects/powernv/dev/ofw/ofw_cpu.c Mon Jul 11 04:21:38 2016 (r302538) @@ -191,6 +191,10 @@ ofw_cpu_probe(device_t dev) if (type == NULL || strcmp(type, "cpu") != 0) return (ENXIO); + /* Skip SMT CPUs, which we can't reasonably represent with this code */ + if (OF_hasprop(ofw_bus_get_node(dev), "ibm,ppc-interrupt-server#s")) + return (ENXIO); + device_set_desc(dev, "Open Firmware CPU"); return (0); } Modified: projects/powernv/kern/init_main.c ============================================================================== --- projects/powernv/kern/init_main.c Mon Jul 11 04:12:15 2016 (r302537) +++ projects/powernv/kern/init_main.c Mon Jul 11 04:21:38 2016 (r302538) @@ -495,7 +495,7 @@ proc0_init(void *dummy __unused) td->td_lend_user_pri = PRI_MAX; td->td_priority = PVM; td->td_base_pri = PVM; - td->td_oncpu = 0; + td->td_oncpu = curcpu; td->td_flags = TDF_INMEM; td->td_pflags = TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); Modified: projects/powernv/net/netisr.c ============================================================================== --- projects/powernv/net/netisr.c Mon Jul 11 04:12:15 2016 (r302537) +++ projects/powernv/net/netisr.c Mon Jul 11 04:21:38 2016 (r302538) @@ -1273,8 +1273,6 @@ netisr_init(void *arg) struct pcpu *pc; #endif - KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__)); - NETISR_LOCK_INIT(); if (netisr_maxthreads == 0 || netisr_maxthreads < -1 ) netisr_maxthreads = 1; /* default behavior */ Modified: projects/powernv/powerpc/aim/mmu_oea64.c ============================================================================== --- projects/powernv/powerpc/aim/mmu_oea64.c Mon Jul 11 04:12:15 2016 (r302537) +++ projects/powernv/powerpc/aim/mmu_oea64.c Mon Jul 11 04:21:38 2016 (r302538) @@ -853,7 +853,6 @@ moea64_late_bootstrap(mmu_t mmup, vm_off int i; vm_offset_t pa, va; void *dpcpu; - struct cpuref bsp; /* * Set up the Open Firmware pmap and add its mappings if not in real @@ -952,8 +951,6 @@ moea64_late_bootstrap(mmu_t mmup, vm_off */ pa = moea64_bootstrap_alloc(DPCPU_SIZE, PAGE_SIZE); dpcpu = (void *)virtual_avail; - if (platform_smp_get_bsp(&bsp) != 0) - bsp.cr_cpuid = 0; va = virtual_avail; virtual_avail += DPCPU_SIZE; while (va < virtual_avail) { @@ -961,7 +958,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_off pa += PAGE_SIZE; va += PAGE_SIZE; } - dpcpu_init(dpcpu, bsp.cr_cpuid); + dpcpu_init(dpcpu, curcpu); /* * Allocate some things for page zeroing. We put this directly Modified: projects/powernv/powerpc/powerpc/machdep.c ============================================================================== --- projects/powernv/powerpc/powerpc/machdep.c Mon Jul 11 04:12:15 2016 (r302537) +++ projects/powernv/powerpc/powerpc/machdep.c Mon Jul 11 04:21:38 2016 (r302538) @@ -365,6 +365,7 @@ powerpc_init(vm_offset_t fdt, vm_offset_ bsp.cr_cpuid = 0; pcpu_init(pc, bsp.cr_cpuid, sizeof(struct pcpu)); pc->pc_curthread = &thread0; + thread0.td_oncpu = bsp.cr_cpuid; pc->pc_cpuid = bsp.cr_cpuid; __asm __volatile("mtsprg 0, %0" :: "r"(pc)); From owner-svn-src-projects@freebsd.org Mon Jul 11 15:32:38 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E83B0B9238A for ; Mon, 11 Jul 2016 15:32:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7B2012F2; Mon, 11 Jul 2016 15:32:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BFWbKk051877; Mon, 11 Jul 2016 15:32:37 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BFWbuN051875; Mon, 11 Jul 2016 15:32:37 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607111532.u6BFWbuN051875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 15:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302569 - in projects/powernv/powerpc: include powerpc X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 15:32:39 -0000 Author: nwhitehorn Date: Mon Jul 11 15:32:37 2016 New Revision: 302569 URL: https://svnweb.freebsd.org/changeset/base/302569 Log: Add a new trap definition that we do not yet handle. Modified: projects/powernv/powerpc/include/trap.h projects/powernv/powerpc/powerpc/trap.c Modified: projects/powernv/powerpc/include/trap.h ============================================================================== --- projects/powernv/powerpc/include/trap.h Mon Jul 11 14:24:50 2016 (r302568) +++ projects/powernv/powerpc/include/trap.h Mon Jul 11 15:32:37 2016 (r302569) @@ -75,6 +75,7 @@ #define EXC_DSMISS 0x1200 /* Data store translation miss */ /* Power ISA 2.06+: */ +#define EXC_HEA 0x0e40 /* Hypervisor Emulation Assistance */ #define EXC_VSX 0x0f40 /* VSX Unavailable */ /* The following are available on 4xx and 85xx */ Modified: projects/powernv/powerpc/powerpc/trap.c ============================================================================== --- projects/powernv/powerpc/powerpc/trap.c Mon Jul 11 14:24:50 2016 (r302568) +++ projects/powernv/powerpc/powerpc/trap.c Mon Jul 11 15:32:37 2016 (r302569) @@ -116,6 +116,7 @@ static struct powerpc_exception powerpc_ { EXC_EXI, "external interrupt" }, { EXC_ALI, "alignment" }, { EXC_PGM, "program" }, + { EXC_HEA, "hypervisor emulation assistance" }, { EXC_FPU, "floating-point unavailable" }, { EXC_APU, "auxiliary proc unavailable" }, { EXC_DECR, "decrementer" }, From owner-svn-src-projects@freebsd.org Mon Jul 11 15:33:50 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DC7AB923B2 for ; Mon, 11 Jul 2016 15:33:50 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55AA1143E; Mon, 11 Jul 2016 15:33:50 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BFXnc6051992; Mon, 11 Jul 2016 15:33:49 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BFXnRK051989; Mon, 11 Jul 2016 15:33:49 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607111533.u6BFXnRK051989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 15:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302570 - projects/powernv/powerpc/powernv X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 15:33:50 -0000 Author: nwhitehorn Date: Mon Jul 11 15:33:49 2016 New Revision: 302570 URL: https://svnweb.freebsd.org/changeset/base/302570 Log: Miscellaneous robustness improvements. Modified: projects/powernv/powerpc/powernv/opal_console.c projects/powernv/powerpc/powernv/platform_powernv.c Modified: projects/powernv/powerpc/powernv/opal_console.c ============================================================================== --- projects/powernv/powerpc/powernv/opal_console.c Mon Jul 11 15:32:37 2016 (r302569) +++ projects/powernv/powerpc/powernv/opal_console.c Mon Jul 11 15:33:49 2016 (r302570) @@ -131,43 +131,39 @@ static struct { char tmpbuf[16]; uint64_t size; struct mtx mtx; -} escapehatch; +} opalcons_buffer; static void uart_opal_real_map_outbuffer(uint64_t *bufferp, uint64_t *lenp) { - if (!mtx_initialized(&escapehatch.mtx)) - mtx_init(&escapehatch.mtx, "uart_opal", NULL, + if (!mtx_initialized(&opalcons_buffer.mtx)) + mtx_init(&opalcons_buffer.mtx, "uart_opal", NULL, MTX_SPIN | MTX_QUIET | MTX_NOWITNESS); if (!pmap_bootstrapped) return; - if (TD_IS_IDLETHREAD(curthread)) { - escapehatch.size = *(uint64_t *)(*lenp) = - min(sizeof(escapehatch.tmpbuf), *(uint64_t *)(*lenp)); - mtx_lock_spin(&escapehatch.mtx); - memcpy(escapehatch.tmpbuf, (void *)(*bufferp), - *(uint64_t *)(*lenp)); - *bufferp = (uint64_t)escapehatch.tmpbuf; - *lenp = (uint64_t)&escapehatch.size; - } + mtx_lock_spin(&opalcons_buffer.mtx); - *bufferp = vtophys(*bufferp); - *lenp = vtophys(*lenp); + opalcons_buffer.size = *(uint64_t *)(*lenp) = + min(sizeof(opalcons_buffer.tmpbuf), *(uint64_t *)(*lenp)); + memcpy(opalcons_buffer.tmpbuf, (void *)(*bufferp), + *(uint64_t *)(*lenp)); + *bufferp = (uint64_t)opalcons_buffer.tmpbuf; + *lenp = (uint64_t)&opalcons_buffer.size; } static void -uart_opal_real_unmap_outbuffer(uint64_t lenp, uint64_t *origlen) +uart_opal_real_unmap_outbuffer(uint64_t *len) { - if (!pmap_bootstrapped || !TD_IS_IDLETHREAD(curthread)) + if (!pmap_bootstrapped) return; - mtx_assert(&escapehatch.mtx, MA_OWNED); - *origlen = escapehatch.size; - mtx_unlock_spin(&escapehatch.mtx); + mtx_assert(&opalcons_buffer.mtx, MA_OWNED); + *len = opalcons_buffer.size; + mtx_unlock_spin(&opalcons_buffer.mtx); } static int @@ -388,7 +384,7 @@ uart_opal_put(struct uart_opal_softc *sc uart_opal_real_map_outbuffer(&obuf, &olen); err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); - uart_opal_real_unmap_outbuffer(olen, &len); + uart_opal_real_unmap_outbuffer(&len); } else { uart_lock(&sc->sc_mtx); if (bufsize > 12) @@ -403,7 +399,7 @@ uart_opal_put(struct uart_opal_softc *sc uart_opal_real_map_outbuffer(&obuf, &olen); err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); - uart_opal_real_unmap_outbuffer(olen, &len); + uart_opal_real_unmap_outbuffer(&len); uart_unlock(&sc->sc_mtx); @@ -437,7 +433,11 @@ uart_opal_cngetc(struct consdev *cp) static void uart_opal_cnputc(struct consdev *cp, int c) { + static uint64_t events; unsigned char ch = c; + + if (cold) + opal_call(OPAL_POLL_EVENTS, &events); /* Clear FIFO if needed */ uart_opal_put(console_sc, &ch, 1); } Modified: projects/powernv/powerpc/powernv/platform_powernv.c ============================================================================== --- projects/powernv/powerpc/powernv/platform_powernv.c Mon Jul 11 15:32:37 2016 (r302569) +++ projects/powernv/powerpc/powernv/platform_powernv.c Mon Jul 11 15:33:49 2016 (r302570) @@ -129,8 +129,8 @@ powernv_attach(platform_t plat) cpu_idle_hook = powernv_cpu_idle; powernv_boot_pir = mfspr(SPR_PIR); - /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ - mtspr(SPR_LPCR, LPCR_LPES); + /* Init CPU bits */ + powernv_smp_ap_init(plat); /* Set SLB count from device tree */ cpu = OF_peer(0); @@ -425,6 +425,9 @@ powernv_reset(platform_t platform) static void powernv_smp_ap_init(platform_t platform) { + + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + mtspr(SPR_LPCR, LPCR_LPES); } static void From owner-svn-src-projects@freebsd.org Mon Jul 11 17:03:39 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FC8FB9264F for ; Mon, 11 Jul 2016 17:03:39 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 012B014C4; Mon, 11 Jul 2016 17:03:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BH3cMB085901; Mon, 11 Jul 2016 17:03:38 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BH3ZxM085875; Mon, 11 Jul 2016 17:03:35 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607111703.u6BH3ZxM085875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 17:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302579 - in projects/powernv: amd64/cloudabi64 amd64/linux amd64/linux32 arm/allwinner arm/allwinner/a13 arm/allwinner/clk arm/conf arm/lpc arm/nvidia arm/nvidia/tegra124 arm/samsung/e... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 17:03:39 -0000 Author: nwhitehorn Date: Mon Jul 11 17:03:35 2016 New Revision: 302579 URL: https://svnweb.freebsd.org/changeset/base/302579 Log: IFC @ r302578 Added: projects/powernv/arm/allwinner/a13/ - copied from r302576, head/sys/arm/allwinner/a13/ projects/powernv/compat/linux/linux_mmap.c - copied unchanged from r302576, head/sys/compat/linux/linux_mmap.c projects/powernv/compat/linux/linux_mmap.h - copied unchanged from r302576, head/sys/compat/linux/linux_mmap.h projects/powernv/compat/linux/linux_persona.h - copied unchanged from r302576, head/sys/compat/linux/linux_persona.h projects/powernv/dev/ntb/ntb.c - copied unchanged from r302576, head/sys/dev/ntb/ntb.c projects/powernv/dev/ntb/ntb.h - copied unchanged from r302576, head/sys/dev/ntb/ntb.h projects/powernv/dev/ntb/ntb_if.m - copied unchanged from r302576, head/sys/dev/ntb/ntb_if.m projects/powernv/dev/ntb/ntb_transport.c - copied unchanged from r302576, head/sys/dev/ntb/ntb_transport.c projects/powernv/dev/ntb/ntb_transport.h - copied unchanged from r302576, head/sys/dev/ntb/ntb_transport.h projects/powernv/modules/ntb/ntb/ - copied from r302576, head/sys/modules/ntb/ntb/ projects/powernv/modules/ntb/ntb_transport/ - copied from r302576, head/sys/modules/ntb/ntb_transport/ Deleted: projects/powernv/dev/ntb/ntb_hw/ntb_hw.h Modified: projects/powernv/amd64/cloudabi64/cloudabi64_sysvec.c projects/powernv/amd64/linux/linux.h projects/powernv/amd64/linux/linux_machdep.c projects/powernv/amd64/linux/linux_proto.h projects/powernv/amd64/linux/linux_syscall.h projects/powernv/amd64/linux/linux_syscalls.c projects/powernv/amd64/linux/linux_sysent.c projects/powernv/amd64/linux/linux_systrace_args.c projects/powernv/amd64/linux/syscalls.master projects/powernv/amd64/linux32/linux.h projects/powernv/amd64/linux32/linux32_machdep.c projects/powernv/amd64/linux32/linux32_proto.h projects/powernv/amd64/linux32/linux32_syscall.h projects/powernv/amd64/linux32/linux32_syscalls.c projects/powernv/amd64/linux32/linux32_sysent.c projects/powernv/amd64/linux32/linux32_systrace_args.c projects/powernv/amd64/linux32/syscalls.master projects/powernv/arm/allwinner/a10_ahci.c projects/powernv/arm/allwinner/a10_codec.c projects/powernv/arm/allwinner/a10_dmac.c projects/powernv/arm/allwinner/a10_ehci.c projects/powernv/arm/allwinner/a10_fb.c projects/powernv/arm/allwinner/a10_gpio.c projects/powernv/arm/allwinner/a10_hdmi.c projects/powernv/arm/allwinner/a10_mmc.c projects/powernv/arm/allwinner/a10_mmc.h projects/powernv/arm/allwinner/allwinner_machdep.c projects/powernv/arm/allwinner/aw_ccu.c projects/powernv/arm/allwinner/aw_if_dwc.c projects/powernv/arm/allwinner/aw_rsb.c projects/powernv/arm/allwinner/aw_usbphy.c projects/powernv/arm/allwinner/clk/aw_ahbclk.c projects/powernv/arm/allwinner/clk/aw_apbclk.c projects/powernv/arm/allwinner/clk/aw_axiclk.c projects/powernv/arm/allwinner/clk/aw_codecclk.c projects/powernv/arm/allwinner/clk/aw_cpuclk.c projects/powernv/arm/allwinner/clk/aw_cpusclk.c projects/powernv/arm/allwinner/clk/aw_debeclk.c projects/powernv/arm/allwinner/clk/aw_gate.c projects/powernv/arm/allwinner/clk/aw_gmacclk.c projects/powernv/arm/allwinner/clk/aw_hdmiclk.c projects/powernv/arm/allwinner/clk/aw_lcdclk.c projects/powernv/arm/allwinner/clk/aw_mmcclk.c projects/powernv/arm/allwinner/clk/aw_modclk.c projects/powernv/arm/allwinner/clk/aw_pll.c projects/powernv/arm/allwinner/clk/aw_usbclk.c projects/powernv/arm/allwinner/if_awg.c projects/powernv/arm/allwinner/if_emac.c projects/powernv/arm/allwinner/std.a10 projects/powernv/arm/conf/A10 projects/powernv/arm/conf/ALLWINNER projects/powernv/arm/conf/ALPINE projects/powernv/arm/conf/AML8726 projects/powernv/arm/conf/ARMADA38X projects/powernv/arm/conf/ARMADAXP projects/powernv/arm/conf/ATMEL projects/powernv/arm/conf/AVILA projects/powernv/arm/conf/BEAGLEBONE projects/powernv/arm/conf/BWCT projects/powernv/arm/conf/CAMBRIA projects/powernv/arm/conf/CNS11XXNAS projects/powernv/arm/conf/CRB projects/powernv/arm/conf/DB-78XXX projects/powernv/arm/conf/DB-88F5XXX projects/powernv/arm/conf/DB-88F6XXX projects/powernv/arm/conf/DOCKSTAR projects/powernv/arm/conf/DREAMPLUG-1001 projects/powernv/arm/conf/EA3250 projects/powernv/arm/conf/EB9200 projects/powernv/arm/conf/EFIKA_MX projects/powernv/arm/conf/ETHERNUT5 projects/powernv/arm/conf/EXYNOS5.common projects/powernv/arm/conf/GUMSTIX projects/powernv/arm/conf/HL200 projects/powernv/arm/conf/HL201 projects/powernv/arm/conf/IMX53 projects/powernv/arm/conf/IMX53-QSB projects/powernv/arm/conf/IMX6 projects/powernv/arm/conf/KB920X projects/powernv/arm/conf/NSLU projects/powernv/arm/conf/PANDABOARD projects/powernv/arm/conf/QILA9G20 projects/powernv/arm/conf/RK3188 projects/powernv/arm/conf/RPI-B projects/powernv/arm/conf/RPI2 projects/powernv/arm/conf/SAM9260EK projects/powernv/arm/conf/SAM9G20EK projects/powernv/arm/conf/SAM9X25EK projects/powernv/arm/conf/SHEEVAPLUG projects/powernv/arm/conf/SN9G45 projects/powernv/arm/conf/SOCKIT.common projects/powernv/arm/conf/TEGRA124 projects/powernv/arm/conf/TS7800 projects/powernv/arm/conf/VERSATILEPB projects/powernv/arm/conf/VIRT projects/powernv/arm/conf/VYBRID projects/powernv/arm/conf/ZEDBOARD projects/powernv/arm/conf/std.arm projects/powernv/arm/conf/std.armv6 projects/powernv/arm/lpc/if_lpe.c projects/powernv/arm/nvidia/tegra124/tegra124_cpufreq.c projects/powernv/arm/nvidia/tegra124/tegra124_pmc.c projects/powernv/arm/nvidia/tegra124/tegra124_xusbpadctl.c projects/powernv/arm/nvidia/tegra_ahci.c projects/powernv/arm/nvidia/tegra_efuse.c projects/powernv/arm/nvidia/tegra_ehci.c projects/powernv/arm/nvidia/tegra_i2c.c projects/powernv/arm/nvidia/tegra_pcie.c projects/powernv/arm/nvidia/tegra_rtc.c projects/powernv/arm/nvidia/tegra_sdhci.c projects/powernv/arm/nvidia/tegra_soctherm.c projects/powernv/arm/nvidia/tegra_uart.c projects/powernv/arm/nvidia/tegra_usbphy.c projects/powernv/arm/samsung/exynos/chrome_kb.c projects/powernv/arm64/cloudabi64/cloudabi64_sysvec.c projects/powernv/boot/fdt/fdt_loader_cmd.c projects/powernv/boot/uboot/lib/elf_freebsd.c projects/powernv/boot/uboot/lib/glue.c projects/powernv/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c projects/powernv/compat/linux/linux_emul.c projects/powernv/compat/linux/linux_emul.h projects/powernv/compat/linux/linux_misc.c projects/powernv/conf/files.amd64 projects/powernv/conf/files.i386 projects/powernv/conf/newvers.sh projects/powernv/conf/options.arm projects/powernv/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c projects/powernv/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c projects/powernv/contrib/dev/ath/ath_hal/ar9300/ar9300_recv_ds.c projects/powernv/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c projects/powernv/dev/ahci/ahci.c projects/powernv/dev/ahci/ahci.h projects/powernv/dev/ath/ath_hal/ah.c projects/powernv/dev/ath/ath_hal/ah.h projects/powernv/dev/ath/ath_hal/ah_desc.h projects/powernv/dev/ath/ath_hal/ah_internal.h projects/powernv/dev/ath/ath_hal/ar5210/ar5210_attach.c projects/powernv/dev/ath/ath_hal/ar5211/ar5211_attach.c projects/powernv/dev/ath/ath_hal/ar5212/ar5212_attach.c projects/powernv/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/powernv/dev/ath/if_ath.c projects/powernv/dev/ath/if_athvar.h projects/powernv/dev/bhnd/nvram/bhnd_sprom_subr.c projects/powernv/dev/cxgb/ulp/tom/cxgb_listen.c projects/powernv/dev/cxgbe/t4_main.c projects/powernv/dev/drm2/drm_os_freebsd.h projects/powernv/dev/drm2/i915/i915_drv.h projects/powernv/dev/drm2/radeon/radeon_acpi.c projects/powernv/dev/dwc/if_dwc.c projects/powernv/dev/extres/clk/clk.c projects/powernv/dev/extres/clk/clk.h projects/powernv/dev/extres/clk/clk_fixed.c projects/powernv/dev/extres/hwreset/hwreset.c projects/powernv/dev/extres/hwreset/hwreset.h projects/powernv/dev/extres/phy/phy.c projects/powernv/dev/extres/phy/phy.h projects/powernv/dev/extres/regulator/regulator.c projects/powernv/dev/extres/regulator/regulator.h projects/powernv/dev/hyperv/include/hyperv.h projects/powernv/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c projects/powernv/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c projects/powernv/dev/hyperv/vmbus/hv_channel.c projects/powernv/dev/hyperv/vmbus/hv_channel_mgmt.c projects/powernv/dev/hyperv/vmbus/hv_connection.c projects/powernv/dev/hyperv/vmbus/hv_vmbus_priv.h projects/powernv/dev/hyperv/vmbus/hyperv.c projects/powernv/dev/hyperv/vmbus/hyperv_reg.h projects/powernv/dev/hyperv/vmbus/hyperv_var.h projects/powernv/dev/hyperv/vmbus/vmbus.c projects/powernv/dev/hyperv/vmbus/vmbus_reg.h projects/powernv/dev/hyperv/vmbus/vmbus_var.h projects/powernv/dev/iicbus/twsi/a10_twsi.c projects/powernv/dev/ntb/if_ntb/if_ntb.c projects/powernv/dev/ntb/ntb_hw/ntb_hw.c projects/powernv/dev/ntb/ntb_hw/ntb_regs.h projects/powernv/dev/ofw/ofwpci.c projects/powernv/dev/uart/uart_dev_snps.c projects/powernv/dev/usb/controller/generic_ohci.c projects/powernv/i386/i386/exception.s projects/powernv/i386/linux/linux.h projects/powernv/i386/linux/linux_machdep.c projects/powernv/i386/linux/linux_proto.h projects/powernv/i386/linux/linux_syscall.h projects/powernv/i386/linux/linux_syscalls.c projects/powernv/i386/linux/linux_sysent.c projects/powernv/i386/linux/linux_systrace_args.c projects/powernv/i386/linux/syscalls.master projects/powernv/kern/init_sysent.c projects/powernv/kern/kern_descrip.c projects/powernv/kern/sys_generic.c projects/powernv/kern/sys_procdesc.c projects/powernv/kern/syscalls.master projects/powernv/kern/vfs_subr.c projects/powernv/kern/vfs_syscalls.c projects/powernv/modules/linux/Makefile projects/powernv/modules/linux_common/Makefile projects/powernv/modules/ntb/Makefile projects/powernv/modules/ntb/ntb_hw/Makefile projects/powernv/net/iflib.c projects/powernv/net/mppcc.c projects/powernv/net/mppcd.c projects/powernv/netpfil/pf/pf_ioctl.c projects/powernv/rpc/clnt_dg.c projects/powernv/rpc/clnt_vc.c projects/powernv/rpc/svc.c projects/powernv/rpc/svc_dg.c projects/powernv/security/audit/audit_bsm.c projects/powernv/sys/param.h projects/powernv/sys/sysproto.h projects/powernv/vm/vm_fault.c projects/powernv/vm/vm_map.c projects/powernv/vm/vm_map.h projects/powernv/vm/vm_mmap.c projects/powernv/vm/vm_object.c Directory Properties: projects/powernv/ (props changed) projects/powernv/cddl/contrib/opensolaris/ (props changed) Modified: projects/powernv/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- projects/powernv/amd64/cloudabi64/cloudabi64_sysvec.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/cloudabi64/cloudabi64_sysvec.c Mon Jul 11 17:03:35 2016 (r302579) @@ -96,6 +96,7 @@ cloudabi64_fetch_syscall_args(struct thr if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; + sa->narg = sa->callp->sy_narg; /* Fetch system call arguments. */ sa->args[0] = frame->tf_rdi; Modified: projects/powernv/amd64/linux/linux.h ============================================================================== --- projects/powernv/amd64/linux/linux.h Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux.h Mon Jul 11 17:03:35 2016 (r302579) @@ -139,13 +139,6 @@ struct l_rlimit { l_ulong rlim_max; }; -/* mmap options */ -#define LINUX_MAP_SHARED 0x0001 -#define LINUX_MAP_PRIVATE 0x0002 -#define LINUX_MAP_FIXED 0x0010 -#define LINUX_MAP_ANON 0x0020 -#define LINUX_MAP_GROWSDOWN 0x0100 - /* * stat family of syscalls */ Modified: projects/powernv/amd64/linux/linux_machdep.c ============================================================================== --- projects/powernv/amd64/linux/linux_machdep.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux_machdep.c Mon Jul 11 17:03:35 2016 (r302579) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -122,181 +123,19 @@ linux_set_upcall_kse(struct thread *td, return (0); } -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { - struct proc *p = td->td_proc; - struct mmap_args /* { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; - } */ bsd_args; - int error; - struct file *fp; - cap_rights_t rights; - - LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx", - args->addr, args->len, args->prot, - args->flags, args->fd, args->pgoff); - - error = 0; - bsd_args.flags = 0; - fp = NULL; - - /* - * Linux mmap(2): - * You must specify exactly one of MAP_SHARED and MAP_PRIVATE - */ - if (! ((args->flags & LINUX_MAP_SHARED) ^ - (args->flags & LINUX_MAP_PRIVATE))) - return (EINVAL); - - if (args->flags & LINUX_MAP_SHARED) - bsd_args.flags |= MAP_SHARED; - if (args->flags & LINUX_MAP_PRIVATE) - bsd_args.flags |= MAP_PRIVATE; - if (args->flags & LINUX_MAP_FIXED) - bsd_args.flags |= MAP_FIXED; - if (args->flags & LINUX_MAP_ANON) - bsd_args.flags |= MAP_ANON; - else - bsd_args.flags |= MAP_NOSYNC; - if (args->flags & LINUX_MAP_GROWSDOWN) - bsd_args.flags |= MAP_STACK; - - /* - * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC - * on Linux/i386. We do this to ensure maximum compatibility. - * Linux/ia64 does the same in i386 emulation mode. - */ - bsd_args.prot = args->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - - /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ - bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : args->fd; - if (bsd_args.fd != -1) { - /* - * Linux follows Solaris mmap(2) description: - * The file descriptor fildes is opened with - * read permission, regardless of the - * protection options specified. - */ - - error = fget(td, bsd_args.fd, - cap_rights_init(&rights, CAP_MMAP), &fp); - if (error != 0 ) - return (error); - if (fp->f_type != DTYPE_VNODE) { - fdrop(fp, td); - return (EINVAL); - } - - /* Linux mmap() just fails for O_WRONLY files */ - if (!(fp->f_flag & FREAD)) { - fdrop(fp, td); - return (EACCES); - } - - fdrop(fp, td); - } - if (args->flags & LINUX_MAP_GROWSDOWN) { - /* - * The Linux MAP_GROWSDOWN option does not limit auto - * growth of the region. Linux mmap with this option - * takes as addr the initial BOS, and as len, the initial - * region size. It can then grow down from addr without - * limit. However, Linux threads has an implicit internal - * limit to stack size of STACK_SIZE. Its just not - * enforced explicitly in Linux. But, here we impose - * a limit of (STACK_SIZE - GUARD_SIZE) on the stack - * region, since we can do this with our mmap. - * - * Our mmap with MAP_STACK takes addr as the maximum - * downsize limit on BOS, and as len the max size of - * the region. It then maps the top SGROWSIZ bytes, - * and auto grows the region down, up to the limit - * in addr. - * - * If we don't use the MAP_STACK option, the effect - * of this code is to allocate a stack region of a - * fixed size of (STACK_SIZE - GUARD_SIZE). - */ - - if ((caddr_t)PTRIN(args->addr) + args->len > - p->p_vmspace->vm_maxsaddr) { - /* - * Some Linux apps will attempt to mmap - * thread stacks near the top of their - * address space. If their TOS is greater - * than vm_maxsaddr, vm_map_growstack() - * will confuse the thread stack with the - * process stack and deliver a SEGV if they - * attempt to grow the thread stack past their - * current stacksize rlimit. To avoid this, - * adjust vm_maxsaddr upwards to reflect - * the current stacksize rlimit rather - * than the maximum possible stacksize. - * It would be better to adjust the - * mmap'ed region, but some apps do not check - * mmap's return value. - */ - PROC_LOCK(p); - p->p_vmspace->vm_maxsaddr = (char *)USRSTACK - - lim_cur_proc(p, RLIMIT_STACK); - PROC_UNLOCK(p); - } - - /* - * This gives us our maximum stack size and a new BOS. - * If we're using VM_STACK, then mmap will just map - * the top SGROWSIZ bytes, and let the stack grow down - * to the limit at BOS. If we're not using VM_STACK - * we map the full stack, since we don't have a way - * to autogrow it. - */ - if (args->len > STACK_SIZE - GUARD_SIZE) { - bsd_args.addr = (caddr_t)PTRIN(args->addr); - bsd_args.len = args->len; - } else { - bsd_args.addr = (caddr_t)PTRIN(args->addr) - - (STACK_SIZE - GUARD_SIZE - args->len); - bsd_args.len = STACK_SIZE - GUARD_SIZE; - } - } else { - bsd_args.addr = (caddr_t)PTRIN(args->addr); - bsd_args.len = args->len; - } - bsd_args.pos = (off_t)args->pgoff; - - error = sys_mmap(td, &bsd_args); - - LINUX_CTR2(mmap2, "return: %d (%p)", - error, td->td_retval[0]); - return (error); + return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot, + args->flags, args->fd, args->pgoff)); } int linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) { - struct mprotect_args bsd_args; - - LINUX_CTR(mprotect); - bsd_args.addr = uap->addr; - bsd_args.len = uap->len; - bsd_args.prot = uap->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - return (sys_mprotect(td, &bsd_args)); + return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); } int Modified: projects/powernv/amd64/linux/linux_proto.h ============================================================================== --- projects/powernv/amd64/linux/linux_proto.h Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux_proto.h Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -499,7 +499,7 @@ struct linux_mknod_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; }; struct linux_personality_args { - char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)]; + char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)]; }; struct linux_ustat_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; @@ -1397,6 +1397,13 @@ int linux_finit_module(struct thread *, #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#define nosys linux_nosys + +#endif /* COMPAT_FREEBSD10 */ + #define LINUX_SYS_AUE_linux_open AUE_OPEN_RWTC #define LINUX_SYS_AUE_linux_newstat AUE_STAT #define LINUX_SYS_AUE_linux_newfstat AUE_FSTAT Modified: projects/powernv/amd64/linux/linux_syscall.h ============================================================================== --- projects/powernv/amd64/linux/linux_syscall.h Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux_syscall.h Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #define LINUX_SYS_read 0 Modified: projects/powernv/amd64/linux/linux_syscalls.c ============================================================================== --- projects/powernv/amd64/linux/linux_syscalls.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux_syscalls.c Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ const char *linux_syscallnames[] = { Modified: projects/powernv/amd64/linux/linux_sysent.c ============================================================================== --- projects/powernv/amd64/linux/linux_sysent.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux_sysent.c Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #include Modified: projects/powernv/amd64/linux/linux_systrace_args.c ============================================================================== --- projects/powernv/amd64/linux/linux_systrace_args.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/linux_systrace_args.c Mon Jul 11 17:03:35 2016 (r302579) @@ -1120,7 +1120,7 @@ systrace_args(int sysnum, void *params, /* linux_personality */ case 135: { struct linux_personality_args *p = params; - iarg[0] = p->per; /* l_ulong */ + iarg[0] = p->per; /* l_uint */ *n_args = 1; break; } @@ -4112,7 +4112,7 @@ systrace_entry_setargdesc(int sysnum, in case 135: switch(ndx) { case 0: - p = "l_ulong"; + p = "l_uint"; break; default: break; Modified: projects/powernv/amd64/linux/syscalls.master ============================================================================== --- projects/powernv/amd64/linux/syscalls.master Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux/syscalls.master Mon Jul 11 17:03:35 2016 (r302579) @@ -270,7 +270,7 @@ 133 AUE_MKNOD STD { int linux_mknod(char *path, l_int mode, \ l_dev_t dev); } 134 AUE_USELIB UNIMPL uselib -135 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +135 AUE_PERSONALITY STD { int linux_personality(l_uint per); } 136 AUE_NULL STD { int linux_ustat(l_dev_t dev, \ struct l_ustat *ubuf); } 137 AUE_STATFS STD { int linux_statfs(char *path, \ Modified: projects/powernv/amd64/linux32/linux.h ============================================================================== --- projects/powernv/amd64/linux32/linux.h Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux.h Mon Jul 11 17:03:35 2016 (r302579) @@ -165,13 +165,6 @@ struct l_rusage { l_long ru_nivcsw; } __packed; -/* mmap options */ -#define LINUX_MAP_SHARED 0x0001 -#define LINUX_MAP_PRIVATE 0x0002 -#define LINUX_MAP_FIXED 0x0010 -#define LINUX_MAP_ANON 0x0020 -#define LINUX_MAP_GROWSDOWN 0x0100 - struct l_mmap_argv { l_uintptr_t addr; l_size_t len; Modified: projects/powernv/amd64/linux32/linux32_machdep.c ============================================================================== --- projects/powernv/amd64/linux32/linux32_machdep.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux32_machdep.c Mon Jul 11 17:03:35 2016 (r302579) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -84,9 +85,6 @@ struct l_old_select_argv { l_uintptr_t timeout; } __packed; -static int linux_mmap_common(struct thread *td, l_uintptr_t addr, - l_size_t len, l_int prot, l_int flags, l_int fd, - l_loff_t pos); static void bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru) @@ -448,9 +446,6 @@ linux_set_upcall_kse(struct thread *td, return (0); } -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { @@ -489,184 +484,11 @@ linux_mmap(struct thread *td, struct lin (uint32_t)linux_args.pgoff)); } -static int -linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot, - l_int flags, l_int fd, l_loff_t pos) -{ - struct proc *p = td->td_proc; - struct mmap_args /* { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; - } */ bsd_args; - int error; - struct file *fp; - cap_rights_t rights; - - error = 0; - bsd_args.flags = 0; - fp = NULL; - - /* - * Linux mmap(2): - * You must specify exactly one of MAP_SHARED and MAP_PRIVATE - */ - if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE))) - return (EINVAL); - - if (flags & LINUX_MAP_SHARED) - bsd_args.flags |= MAP_SHARED; - if (flags & LINUX_MAP_PRIVATE) - bsd_args.flags |= MAP_PRIVATE; - if (flags & LINUX_MAP_FIXED) - bsd_args.flags |= MAP_FIXED; - if (flags & LINUX_MAP_ANON) { - /* Enforce pos to be on page boundary, then ignore. */ - if ((pos & PAGE_MASK) != 0) - return (EINVAL); - pos = 0; - bsd_args.flags |= MAP_ANON; - } else - bsd_args.flags |= MAP_NOSYNC; - if (flags & LINUX_MAP_GROWSDOWN) - bsd_args.flags |= MAP_STACK; - - /* - * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC - * on Linux/i386. We do this to ensure maximum compatibility. - * Linux/ia64 does the same in i386 emulation mode. - */ - bsd_args.prot = prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - - /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ - bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd; - if (bsd_args.fd != -1) { - /* - * Linux follows Solaris mmap(2) description: - * The file descriptor fildes is opened with - * read permission, regardless of the - * protection options specified. - */ - - error = fget(td, bsd_args.fd, - cap_rights_init(&rights, CAP_MMAP), &fp); - if (error != 0) - return (error); - if (fp->f_type != DTYPE_VNODE) { - fdrop(fp, td); - return (EINVAL); - } - - /* Linux mmap() just fails for O_WRONLY files */ - if (!(fp->f_flag & FREAD)) { - fdrop(fp, td); - return (EACCES); - } - - fdrop(fp, td); - } - - if (flags & LINUX_MAP_GROWSDOWN) { - /* - * The Linux MAP_GROWSDOWN option does not limit auto - * growth of the region. Linux mmap with this option - * takes as addr the initial BOS, and as len, the initial - * region size. It can then grow down from addr without - * limit. However, Linux threads has an implicit internal - * limit to stack size of STACK_SIZE. Its just not - * enforced explicitly in Linux. But, here we impose - * a limit of (STACK_SIZE - GUARD_SIZE) on the stack - * region, since we can do this with our mmap. - * - * Our mmap with MAP_STACK takes addr as the maximum - * downsize limit on BOS, and as len the max size of - * the region. It then maps the top SGROWSIZ bytes, - * and auto grows the region down, up to the limit - * in addr. - * - * If we don't use the MAP_STACK option, the effect - * of this code is to allocate a stack region of a - * fixed size of (STACK_SIZE - GUARD_SIZE). - */ - - if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) { - /* - * Some Linux apps will attempt to mmap - * thread stacks near the top of their - * address space. If their TOS is greater - * than vm_maxsaddr, vm_map_growstack() - * will confuse the thread stack with the - * process stack and deliver a SEGV if they - * attempt to grow the thread stack past their - * current stacksize rlimit. To avoid this, - * adjust vm_maxsaddr upwards to reflect - * the current stacksize rlimit rather - * than the maximum possible stacksize. - * It would be better to adjust the - * mmap'ed region, but some apps do not check - * mmap's return value. - */ - PROC_LOCK(p); - p->p_vmspace->vm_maxsaddr = (char *)LINUX32_USRSTACK - - lim_cur_proc(p, RLIMIT_STACK); - PROC_UNLOCK(p); - } - - /* - * This gives us our maximum stack size and a new BOS. - * If we're using VM_STACK, then mmap will just map - * the top SGROWSIZ bytes, and let the stack grow down - * to the limit at BOS. If we're not using VM_STACK - * we map the full stack, since we don't have a way - * to autogrow it. - */ - if (len > STACK_SIZE - GUARD_SIZE) { - bsd_args.addr = (caddr_t)PTRIN(addr); - bsd_args.len = len; - } else { - bsd_args.addr = (caddr_t)PTRIN(addr) - - (STACK_SIZE - GUARD_SIZE - len); - bsd_args.len = STACK_SIZE - GUARD_SIZE; - } - } else { - bsd_args.addr = (caddr_t)PTRIN(addr); - bsd_args.len = len; - } - bsd_args.pos = pos; - -#ifdef DEBUG - if (ldebug(mmap)) - printf("-> %s(%p, %d, %d, 0x%08x, %d, 0x%x)\n", - __func__, - (void *)bsd_args.addr, (int)bsd_args.len, bsd_args.prot, - bsd_args.flags, bsd_args.fd, (int)bsd_args.pos); -#endif - error = sys_mmap(td, &bsd_args); -#ifdef DEBUG - if (ldebug(mmap)) - printf("-> %s() return: 0x%x (0x%08x)\n", - __func__, error, (u_int)td->td_retval[0]); -#endif - return (error); -} - int linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) { - struct mprotect_args bsd_args; - bsd_args.addr = uap->addr; - bsd_args.len = uap->len; - bsd_args.prot = uap->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - return (sys_mprotect(td, &bsd_args)); + return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); } int Modified: projects/powernv/amd64/linux32/linux32_proto.h ============================================================================== --- projects/powernv/amd64/linux32/linux32_proto.h Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux32_proto.h Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #ifndef _LINUX32_SYSPROTO_H_ @@ -427,7 +427,7 @@ struct linux_sysfs_args { char arg2_l_[PADL_(l_ulong)]; l_ulong arg2; char arg2_r_[PADR_(l_ulong)]; }; struct linux_personality_args { - char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)]; + char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)]; }; struct linux_setfsuid16_args { char uid_l_[PADL_(l_uid16_t)]; l_uid16_t uid; char uid_r_[PADR_(l_uid16_t)]; @@ -1466,6 +1466,13 @@ int linux_process_vm_writev(struct threa #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#define nosys linux_nosys + +#endif /* COMPAT_FREEBSD10 */ + #define LINUX32_SYS_AUE_linux_exit AUE_EXIT #define LINUX32_SYS_AUE_linux_fork AUE_FORK #define LINUX32_SYS_AUE_linux_open AUE_OPEN_RWTC Modified: projects/powernv/amd64/linux32/linux32_syscall.h ============================================================================== --- projects/powernv/amd64/linux32/linux32_syscall.h Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux32_syscall.h Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #define LINUX32_SYS_linux_exit 1 Modified: projects/powernv/amd64/linux32/linux32_syscalls.c ============================================================================== --- projects/powernv/amd64/linux32/linux32_syscalls.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux32_syscalls.c Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ const char *linux32_syscallnames[] = { Modified: projects/powernv/amd64/linux32/linux32_sysent.c ============================================================================== --- projects/powernv/amd64/linux32/linux32_sysent.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux32_sysent.c Mon Jul 11 17:03:35 2016 (r302579) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #include "opt_compat.h" Modified: projects/powernv/amd64/linux32/linux32_systrace_args.c ============================================================================== --- projects/powernv/amd64/linux32/linux32_systrace_args.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/linux32_systrace_args.c Mon Jul 11 17:03:35 2016 (r302579) @@ -910,7 +910,7 @@ systrace_args(int sysnum, void *params, /* linux_personality */ case 136: { struct linux_personality_args *p = params; - iarg[0] = p->per; /* l_ulong */ + iarg[0] = p->per; /* l_uint */ *n_args = 1; break; } @@ -3715,7 +3715,7 @@ systrace_entry_setargdesc(int sysnum, in case 136: switch(ndx) { case 0: - p = "l_ulong"; + p = "l_uint"; break; default: break; Modified: projects/powernv/amd64/linux32/syscalls.master ============================================================================== --- projects/powernv/amd64/linux32/syscalls.master Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/amd64/linux32/syscalls.master Mon Jul 11 17:03:35 2016 (r302579) @@ -238,7 +238,7 @@ 134 AUE_BDFLUSH STD { int linux_bdflush(void); } 135 AUE_NULL STD { int linux_sysfs(l_int option, \ l_ulong arg1, l_ulong arg2); } -136 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +136 AUE_PERSONALITY STD { int linux_personality(l_uint per); } 137 AUE_NULL UNIMPL afs_syscall 138 AUE_SETFSUID STD { int linux_setfsuid16(l_uid16_t uid); } 139 AUE_SETFSGID STD { int linux_setfsgid16(l_gid16_t gid); } Modified: projects/powernv/arm/allwinner/a10_ahci.c ============================================================================== --- projects/powernv/arm/allwinner/a10_ahci.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_ahci.c Mon Jul 11 17:03:35 2016 (r302579) @@ -313,12 +313,12 @@ ahci_a10_attach(device_t dev) return (ENXIO); /* Enable clocks */ - error = clk_get_by_ofw_index(dev, 0, &clk_pll); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_pll); if (error != 0) { device_printf(dev, "Cannot get PLL clock\n"); goto fail; } - error = clk_get_by_ofw_index(dev, 1, &clk_gate); + error = clk_get_by_ofw_index(dev, 0, 1, &clk_gate); if (error != 0) { device_printf(dev, "Cannot get gate clock\n"); goto fail; Modified: projects/powernv/arm/allwinner/a10_codec.c ============================================================================== --- projects/powernv/arm/allwinner/a10_codec.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_codec.c Mon Jul 11 17:03:35 2016 (r302579) @@ -720,13 +720,19 @@ CHANNEL_DECLARE(a10codec_chan); * Device interface */ +static struct ofw_compat_data compat_data[] = { + {"allwinner,sun4i-a10-codec", 1}, + {"allwinner,sun7i-a20-codec", 1}, + {NULL, 0}, +}; + static int a10codec_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "allwinner,sun7i-a20-codec")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "Allwinner Audio Codec"); @@ -780,12 +786,12 @@ a10codec_attach(device_t dev) } /* Get clocks */ - error = clk_get_by_ofw_name(dev, "apb", &clk_apb); + error = clk_get_by_ofw_name(dev, 0, "apb", &clk_apb); if (error != 0) { device_printf(dev, "cannot find apb clock\n"); goto fail; } - error = clk_get_by_ofw_name(dev, "codec", &clk_codec); + error = clk_get_by_ofw_name(dev, 0, "codec", &clk_codec); if (error != 0) { device_printf(dev, "cannot find codec clock\n"); goto fail; Modified: projects/powernv/arm/allwinner/a10_dmac.c ============================================================================== --- projects/powernv/arm/allwinner/a10_dmac.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_dmac.c Mon Jul 11 17:03:35 2016 (r302579) @@ -124,7 +124,7 @@ a10dmac_attach(device_t dev) mtx_init(&sc->sc_mtx, "a10 dmac", NULL, MTX_SPIN); /* Activate DMA controller clock */ - error = clk_get_by_ofw_index(dev, 0, &clk); + error = clk_get_by_ofw_index(dev, 0, 0, &clk); if (error != 0) { device_printf(dev, "cannot get clock\n"); return (error); Modified: projects/powernv/arm/allwinner/a10_ehci.c ============================================================================== --- projects/powernv/arm/allwinner/a10_ehci.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_ehci.c Mon Jul 11 17:03:35 2016 (r302579) @@ -112,6 +112,7 @@ static const struct aw_ehci_conf a31_ehc static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-ehci", (uintptr_t)&a10_ehci_conf }, + { "allwinner,sun5i-a13-ehci", (uintptr_t)&a10_ehci_conf }, { "allwinner,sun6i-a31-ehci", (uintptr_t)&a31_ehci_conf }, { "allwinner,sun7i-a20-ehci", (uintptr_t)&a10_ehci_conf }, { "allwinner,sun8i-a83t-ehci", (uintptr_t)&a31_ehci_conf }, @@ -207,7 +208,7 @@ a10_ehci_attach(device_t self) sc->sc_flags |= EHCI_SCFLG_DONTRESET; /* De-assert reset */ - if (hwreset_get_by_ofw_idx(self, 0, &aw_sc->rst) == 0) { + if (hwreset_get_by_ofw_idx(self, 0, 0, &aw_sc->rst) == 0) { err = hwreset_deassert(aw_sc->rst); if (err != 0) { device_printf(self, "Could not de-assert reset\n"); @@ -216,7 +217,7 @@ a10_ehci_attach(device_t self) } /* Enable clock for USB */ - err = clk_get_by_ofw_index(self, 0, &aw_sc->clk); + err = clk_get_by_ofw_index(self, 0, 0, &aw_sc->clk); if (err != 0) { device_printf(self, "Could not get clock\n"); goto error; @@ -228,7 +229,7 @@ a10_ehci_attach(device_t self) } /* Enable USB PHY */ - err = phy_get_by_ofw_name(self, "usb", &aw_sc->phy); + err = phy_get_by_ofw_name(self, 0, "usb", &aw_sc->phy); if (err != 0) { device_printf(self, "Could not get phy\n"); goto error; Modified: projects/powernv/arm/allwinner/a10_fb.c ============================================================================== --- projects/powernv/arm/allwinner/a10_fb.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_fb.c Mon Jul 11 17:03:35 2016 (r302579) @@ -209,7 +209,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, height = mode->vdisplay << interlace; /* Leave reset */ - error = hwreset_get_by_ofw_name(sc->dev, "de_be", &rst); + error = hwreset_get_by_ofw_name(sc->dev, 0, "de_be", &rst); if (error != 0) { device_printf(sc->dev, "cannot find reset 'de_be'\n"); return (error); @@ -220,7 +220,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, return (error); } /* Gating AHB clock for BE */ - error = clk_get_by_ofw_name(sc->dev, "ahb_de_be", &clk_ahb); + error = clk_get_by_ofw_name(sc->dev, 0, "ahb_de_be", &clk_ahb); if (error != 0) { device_printf(sc->dev, "cannot find clk 'ahb_de_be'\n"); return (error); @@ -231,7 +231,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, return (error); } /* Enable DRAM clock to BE */ - error = clk_get_by_ofw_name(sc->dev, "dram_de_be", &clk_dram); + error = clk_get_by_ofw_name(sc->dev, 0, "dram_de_be", &clk_dram); if (error != 0) { device_printf(sc->dev, "cannot find clk 'dram_de_be'\n"); return (error); @@ -242,7 +242,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, return (error); } /* Set BE clock to 300MHz and enable */ - error = clk_get_by_ofw_name(sc->dev, "de_be", &clk_debe); + error = clk_get_by_ofw_name(sc->dev, 0, "de_be", &clk_debe); if (error != 0) { device_printf(sc->dev, "cannot find clk 'de_be'\n"); return (error); @@ -309,12 +309,12 @@ a10fb_setup_pll(struct a10fb_softc *sc, clk_t clk_sclk1, clk_sclk2; int error; - error = clk_get_by_ofw_name(sc->dev, "lcd_ch1_sclk1", &clk_sclk1); + error = clk_get_by_ofw_name(sc->dev, 0, "lcd_ch1_sclk1", &clk_sclk1); if (error != 0) { device_printf(sc->dev, "cannot find clk 'lcd_ch1_sclk1'\n"); return (error); } - error = clk_get_by_ofw_name(sc->dev, "lcd_ch1_sclk2", &clk_sclk2); + error = clk_get_by_ofw_name(sc->dev, 0, "lcd_ch1_sclk2", &clk_sclk2); if (error != 0) { device_printf(sc->dev, "cannot find clk 'lcd_ch1_sclk2'\n"); return (error); @@ -360,7 +360,7 @@ a10fb_setup_tcon(struct a10fb_softc *sc, start_delay = START_DELAY(vbl); /* Leave reset */ - error = hwreset_get_by_ofw_name(sc->dev, "lcd", &rst); + error = hwreset_get_by_ofw_name(sc->dev, 0, "lcd", &rst); if (error != 0) { device_printf(sc->dev, "cannot find reset 'lcd'\n"); return (error); @@ -371,7 +371,7 @@ a10fb_setup_tcon(struct a10fb_softc *sc, return (error); } /* Gating AHB clock for LCD */ - error = clk_get_by_ofw_name(sc->dev, "ahb_lcd", &clk_ahb); + error = clk_get_by_ofw_name(sc->dev, 0, "ahb_lcd", &clk_ahb); if (error != 0) { device_printf(sc->dev, "cannot find clk 'ahb_lcd'\n"); return (error); Modified: projects/powernv/arm/allwinner/a10_gpio.c ============================================================================== --- projects/powernv/arm/allwinner/a10_gpio.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_gpio.c Mon Jul 11 17:03:35 2016 (r302579) @@ -80,6 +80,11 @@ __FBSDID("$FreeBSD$"); extern const struct allwinner_padconf a10_padconf; #endif +/* Defined in a13_padconf.c */ +#ifdef SOC_ALLWINNER_A13 +extern const struct allwinner_padconf a13_padconf; +#endif + /* Defined in a20_padconf.c */ #ifdef SOC_ALLWINNER_A20 extern const struct allwinner_padconf a20_padconf; @@ -115,6 +120,9 @@ static struct ofw_compat_data compat_dat #ifdef SOC_ALLWINNER_A10 {"allwinner,sun4i-a10-pinctrl", (uintptr_t)&a10_padconf}, #endif +#ifdef SOC_ALLWINNER_A13 + {"allwinner,sun5i-a13-pinctrl", (uintptr_t)&a13_padconf}, +#endif #ifdef SOC_ALLWINNER_A20 {"allwinner,sun7i-a20-pinctrl", (uintptr_t)&a20_padconf}, #endif @@ -198,11 +206,15 @@ a10_gpio_get_function(struct a10_gpio_so return (0); } -static void +static int a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f) { uint32_t bank, data, offset; + /* Check if the function exists in the padconf data */ + if (sc->padconf->pins[pin].functions[f] == NULL) + return (EINVAL); + /* Must be called with lock held. */ A10_GPIO_LOCK_ASSERT(sc); @@ -214,6 +226,8 @@ a10_gpio_set_function(struct a10_gpio_so data &= ~(7 << offset); data |= (f << offset); A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, pin >> 3), data); + + return (0); } static uint32_t @@ -275,9 +289,10 @@ a10_gpio_set_drv(struct a10_gpio_softc * A10_GPIO_WRITE(sc, A10_GPIO_GP_DRV(bank, pin >> 4), val); } -static void +static int a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags) { + int err = 0; /* Must be called with lock held. */ A10_GPIO_LOCK_ASSERT(sc); @@ -285,11 +300,14 @@ a10_gpio_pin_configure(struct a10_gpio_s /* Manage input/output. */ if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { if (flags & GPIO_PIN_OUTPUT) - a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT); + err = a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT); else - a10_gpio_set_function(sc, pin, A10_GPIO_INPUT); + err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT); } + if (err) + return (err); + /* Manage Pull-up/pull-down. */ if (flags & (GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)) { if (flags & GPIO_PIN_PULLUP) @@ -298,6 +316,8 @@ a10_gpio_pin_configure(struct a10_gpio_s a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN); } else a10_gpio_set_pud(sc, pin, A10_GPIO_NONE); + + return (0); } static device_t @@ -372,16 +392,17 @@ static int a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) { struct a10_gpio_softc *sc; + int err; sc = device_get_softc(dev); if (pin > sc->padconf->npins) return (EINVAL); A10_GPIO_LOCK(sc); - a10_gpio_pin_configure(sc, pin, flags); + err = a10_gpio_pin_configure(sc, pin, flags); A10_GPIO_UNLOCK(sc); - return (0); + return (err); } static int @@ -598,7 +619,7 @@ a10_gpio_attach(device_t dev) sc->padconf = (struct allwinner_padconf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; - if (hwreset_get_by_ofw_idx(dev, 0, &rst) == 0) { + if (hwreset_get_by_ofw_idx(dev, 0, 0, &rst) == 0) { error = hwreset_deassert(rst); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); @@ -606,7 +627,7 @@ a10_gpio_attach(device_t dev) } } - if (clk_get_by_ofw_index(dev, 0, &clk) == 0) { + if (clk_get_by_ofw_index(dev, 0, 0, &clk) == 0) { error = clk_enable(clk); if (error != 0) { device_printf(dev, "could not enable clock\n"); Modified: projects/powernv/arm/allwinner/a10_hdmi.c ============================================================================== --- projects/powernv/arm/allwinner/a10_hdmi.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_hdmi.c Mon Jul 11 17:03:35 2016 (r302579) @@ -293,17 +293,17 @@ a10hdmi_attach(device_t dev) } /* Setup clocks */ - error = clk_get_by_ofw_name(dev, "ahb", &sc->clk_ahb); + error = clk_get_by_ofw_name(dev, 0, "ahb", &sc->clk_ahb); if (error != 0) { device_printf(dev, "cannot find ahb clock\n"); return (error); } - error = clk_get_by_ofw_name(dev, "hdmi", &sc->clk_hdmi); + error = clk_get_by_ofw_name(dev, 0, "hdmi", &sc->clk_hdmi); if (error != 0) { device_printf(dev, "cannot find hdmi clock\n"); return (error); } - error = clk_get_by_ofw_name(dev, "lcd", &sc->clk_lcd); + error = clk_get_by_ofw_name(dev, 0, "lcd", &sc->clk_lcd); if (error != 0) { device_printf(dev, "cannot find lcd clock\n"); } Modified: projects/powernv/arm/allwinner/a10_mmc.c ============================================================================== --- projects/powernv/arm/allwinner/a10_mmc.c Mon Jul 11 17:02:17 2016 (r302578) +++ projects/powernv/arm/allwinner/a10_mmc.c Mon Jul 11 17:03:35 2016 (r302579) @@ -198,7 +198,7 @@ a10_mmc_attach(device_t dev) } /* De-assert reset */ - if (hwreset_get_by_ofw_name(dev, "ahb", &sc->a10_rst_ahb) == 0) { + if (hwreset_get_by_ofw_name(dev, 0, "ahb", &sc->a10_rst_ahb) == 0) { error = hwreset_deassert(sc->a10_rst_ahb); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); @@ -207,7 +207,7 @@ a10_mmc_attach(device_t dev) } /* Activate the module clock. */ - error = clk_get_by_ofw_name(dev, "ahb", &sc->a10_clk_ahb); + error = clk_get_by_ofw_name(dev, 0, "ahb", &sc->a10_clk_ahb); if (error != 0) { device_printf(dev, "cannot get ahb clock\n"); goto fail; @@ -217,7 +217,7 @@ a10_mmc_attach(device_t dev) device_printf(dev, "cannot enable ahb clock\n"); goto fail; } - error = clk_get_by_ofw_name(dev, "mmc", &sc->a10_clk_mmc); + error = clk_get_by_ofw_name(dev, 0, "mmc", &sc->a10_clk_mmc); if (error != 0) { device_printf(dev, "cannot get mmc clock\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@freebsd.org Mon Jul 11 22:53:24 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C20DB9235A for ; Mon, 11 Jul 2016 22:53:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2A921C98; Mon, 11 Jul 2016 22:53:23 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BMrNfj017463; Mon, 11 Jul 2016 22:53:23 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BMrNvr017462; Mon, 11 Jul 2016 22:53:23 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607112253.u6BMrNvr017462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 22:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302597 - projects/powernv/powerpc/pseries X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 22:53:24 -0000 Author: nwhitehorn Date: Mon Jul 11 22:53:22 2016 New Revision: 302597 URL: https://svnweb.freebsd.org/changeset/base/302597 Log: Fix OPAL XICS CPU assignment: CPU IDs need to be shifted left 2 bits. Modified: projects/powernv/powerpc/pseries/xics.c Modified: projects/powernv/powerpc/pseries/xics.c ============================================================================== --- projects/powernv/powerpc/pseries/xics.c Mon Jul 11 21:55:56 2016 (r302596) +++ projects/powernv/powerpc/pseries/xics.c Mon Jul 11 22:53:22 2016 (r302597) @@ -281,7 +281,7 @@ xicp_bind(device_t dev, u_int irq, cpuse error = rtas_call_method(sc->ibm_set_xive, 3, 1, irq, cpu, XICP_PRIORITY, &status); else - error = opal_call(OPAL_SET_XIVE, irq, cpu, XICP_PRIORITY); + error = opal_call(OPAL_SET_XIVE, irq, cpu << 2, XICP_PRIORITY); if (error < 0) panic("Cannot bind interrupt %d to CPU %d", irq, cpu); @@ -371,8 +371,12 @@ xicp_enable(device_t dev, u_int irq, u_i XICP_PRIORITY, &status); xicp_unmask(dev, irq); } else { - opal_call(OPAL_SET_XIVE, irq, cpu, XICP_PRIORITY); + status = opal_call(OPAL_SET_XIVE, irq, cpu << 2, XICP_PRIORITY); /* Unmask implicit for OPAL */ + + if (status != 0) + panic("OPAL_SET_XIVE IRQ %d -> cpu %d failed: %d", irq, + cpu, status); } } @@ -420,7 +424,7 @@ xicp_mask(device_t dev, u_int irq) } } KASSERT(i < sc->nintvecs, ("Masking unconfigured interrupt")); - opal_call(OPAL_SET_XIVE, irq, sc->intvecs[i].cpu, 0xff); + opal_call(OPAL_SET_XIVE, irq, sc->intvecs[i].cpu << 2, 0xff); } } @@ -443,7 +447,7 @@ xicp_unmask(device_t dev, u_int irq) } } KASSERT(i < sc->nintvecs, ("Unmasking unconfigured interrupt")); - opal_call(OPAL_SET_XIVE, irq, sc->intvecs[i].cpu, + opal_call(OPAL_SET_XIVE, irq, sc->intvecs[i].cpu << 2, XICP_PRIORITY); } } From owner-svn-src-projects@freebsd.org Mon Jul 11 23:01:59 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D97DAB92571 for ; Mon, 11 Jul 2016 23:01:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9797C1155; Mon, 11 Jul 2016 23:01:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BN1waP018494; Mon, 11 Jul 2016 23:01:58 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BN1wYD018493; Mon, 11 Jul 2016 23:01:58 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607112301.u6BN1wYD018493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 23:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302598 - projects/powernv/powerpc/powernv X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 23:01:59 -0000 Author: nwhitehorn Date: Mon Jul 11 23:01:58 2016 New Revision: 302598 URL: https://svnweb.freebsd.org/changeset/base/302598 Log: Forward interrupts on OPAL-owned devices to OPAL. Modified: projects/powernv/powerpc/powernv/opal_dev.c Modified: projects/powernv/powerpc/powernv/opal_dev.c ============================================================================== --- projects/powernv/powerpc/powernv/opal_dev.c Mon Jul 11 22:53:22 2016 (r302597) +++ projects/powernv/powerpc/powernv/opal_dev.c Mon Jul 11 23:01:58 2016 (r302598) @@ -59,6 +59,7 @@ static const struct ofw_bus_devinfo *opa device_t child); static void opal_shutdown(void *arg, int howto); +static void opal_intr(void *); static device_method_t opaldev_methods[] = { /* Device interface */ @@ -93,6 +94,8 @@ DRIVER_MODULE(opaldev, ofwbus, opaldev_d static int opaldev_probe(device_t dev) { + pcell_t *irqs; + int i, n_irqs; if (!ofw_bus_is_compatible(dev, "ibm,opal-v3")) return (ENXIO); @@ -100,6 +103,20 @@ opaldev_probe(device_t dev) return (ENXIO); device_set_desc(dev, "OPAL Abstraction Firmware"); + + /* Manually add IRQs before attaching */ + if (OF_hasprop(ofw_bus_get_node(dev), "opal-interrupts")) { + n_irqs = OF_getproplen(ofw_bus_get_node(dev), + "opal-interrupts") / sizeof(*irqs); + irqs = malloc(n_irqs * sizeof(*irqs), M_DEVBUF, M_WAITOK); + OF_getencprop(ofw_bus_get_node(dev), "opal-interrupts", irqs, + n_irqs * sizeof(*irqs)); + for (i = 0; i < n_irqs; i++) + bus_set_resource(dev, SYS_RES_IRQ, i, irqs[i], 1); + free(irqs, M_DEVBUF); + } + + return (BUS_PROBE_SPECIFIC); } @@ -109,8 +126,9 @@ opaldev_attach(device_t dev) phandle_t child; device_t cdev; uint64_t junk; - int rv; + int i, rv; struct ofw_bus_devinfo *dinfo; + struct resource *irq; /* Test for RTC support and register clock if it works */ rv = opal_call(OPAL_RTC_READ, vtophys(&junk), vtophys(&junk)); @@ -126,6 +144,13 @@ opaldev_attach(device_t dev) EVENTHANDLER_REGISTER(shutdown_final, opal_shutdown, NULL, SHUTDOWN_PRI_LAST); + /* Bind to interrupts */ + for (i = 0; (irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, + RF_ACTIVE)) != NULL; i++) + bus_setup_intr(dev, irq, INTR_TYPE_TTY | INTR_MPSAFE | + INTR_ENTROPY, NULL, opal_intr, (void *)rman_get_start(irq), + NULL); + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; child = OF_peer(child)) { dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); @@ -217,3 +242,14 @@ opal_shutdown(void *arg, int howto) opal_call(OPAL_CEC_REBOOT); } +static void +opal_intr(void *xintr) +{ + uint64_t events = 0; + + opal_call(OPAL_HANDLE_INTERRUPT, (uint32_t)(uint64_t)xintr, + vtophys(&events)); + /* XXX: do something useful with this information */ + +} + From owner-svn-src-projects@freebsd.org Wed Jul 13 10:03:15 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADD9EB93120 for ; Wed, 13 Jul 2016 10:03:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 620CC11BD; Wed, 13 Jul 2016 10:03:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DA3Ead003841; Wed, 13 Jul 2016 10:03:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DA3EHB003839; Wed, 13 Jul 2016 10:03:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201607131003.u6DA3EHB003839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Jul 2016 10:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302744 - in projects/hps_head: share/man/man9 sys/kern X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 10:03:15 -0000 Author: hselasky Date: Wed Jul 13 10:03:14 2016 New Revision: 302744 URL: https://svnweb.freebsd.org/changeset/base/302744 Log: Revert the callout_stop() return value changes made by r302350 and r302426. They are wrong and break existing code. Differential Revision: https://reviews.freebsd.org/D7042 Modified: projects/hps_head/share/man/man9/timeout.9 projects/hps_head/sys/kern/kern_timeout.c Modified: projects/hps_head/share/man/man9/timeout.9 ============================================================================== --- projects/hps_head/share/man/man9/timeout.9 Wed Jul 13 10:02:39 2016 (r302743) +++ projects/hps_head/share/man/man9/timeout.9 Wed Jul 13 10:03:14 2016 (r302744) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2015 +.Dd July 13, 2015 .Dt TIMEOUT 9 .Os .Sh NAME @@ -563,15 +563,15 @@ This function returns either .Dv CALLOUT_RET_CANCELLED or .Dv CALLOUT_RET_DRAINING . -If the callout is being serviced regardless of being scheduled or not, +If the callout was scheduled regardless of being serviced or not, +.Dv CALLOUT_RET_CANCELLED +is returned. +If the callout was stopped and is still being serviced .Dv CALLOUT_RET_DRAINING is returned. -If the callout is not being serviced and was already stopped +If the callout was stopped and is no longer being serviced .Dv CALLOUT_RET_STOPPED is returned. -If the callout is not being serviced and was scheduled -.Dv CALLOUT_RET_CANCELLED -is returned. If a lock is associated with the callout given by the .Fa c argument and it is exclusivly locked when this function is called, the Modified: projects/hps_head/sys/kern/kern_timeout.c ============================================================================== --- projects/hps_head/sys/kern/kern_timeout.c Wed Jul 13 10:02:39 2016 (r302743) +++ projects/hps_head/sys/kern/kern_timeout.c Wed Jul 13 10:03:14 2016 (r302744) @@ -1042,10 +1042,7 @@ callout_restart_async(struct callout *c, } else if (cc_exec_cancel(cc, direct) == false || cc_exec_restart(cc, direct) == true) { cc_exec_cancel(cc, direct) = true; - if (coa != NULL || c->c_lock != NULL) - retval = CALLOUT_RET_CANCELLED; - else - retval = CALLOUT_RET_DRAINING; + retval = CALLOUT_RET_CANCELLED; } else { retval = CALLOUT_RET_DRAINING; } From owner-svn-src-projects@freebsd.org Wed Jul 13 12:26:37 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D616EB9325D for ; Wed, 13 Jul 2016 12:26:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F9FD14D0; Wed, 13 Jul 2016 12:26:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DCQa3O057025; Wed, 13 Jul 2016 12:26:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DCQa7D057020; Wed, 13 Jul 2016 12:26:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201607131226.u6DCQa7D057020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Jul 2016 12:26:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302768 - in projects/hps_head: share/man/man9 sys/kern sys/sys X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 12:26:37 -0000 Author: hselasky Date: Wed Jul 13 12:26:36 2016 New Revision: 302768 URL: https://svnweb.freebsd.org/changeset/base/302768 Log: Implement new callout_init_lock_function() callout API function to support locking constructions. The purpose of this function is to allow a function callback to do locking before the callback is called, in order to solve race conditions. The function callback, callout_lock_func_t, is passed two arguments. The first is the callout's callback argument, and the second is an integer, if set, indicates a lock operation, and if cleared, indicates an unlock operation. Some clients of the callout API like the TCP stack use locking constructions, that means one more more locks locked in series. By using callout_init_lock_function() these clients can lock all the locks required in order to atomically to complete their operations, instead of using lock-unlock-lock sequences which open up for races. Modified: projects/hps_head/share/man/man9/Makefile projects/hps_head/share/man/man9/timeout.9 projects/hps_head/sys/kern/kern_timeout.c projects/hps_head/sys/sys/_callout.h projects/hps_head/sys/sys/callout.h Modified: projects/hps_head/share/man/man9/Makefile ============================================================================== --- projects/hps_head/share/man/man9/Makefile Wed Jul 13 11:58:21 2016 (r302767) +++ projects/hps_head/share/man/man9/Makefile Wed Jul 13 12:26:36 2016 (r302768) @@ -1751,6 +1751,7 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_init_mtx.9 \ timeout.9 callout_init_rm.9 \ timeout.9 callout_init_rw.9 \ + timeout.9 callout_init_lock_function.9 \ timeout.9 callout_pending.9 \ timeout.9 callout_reset.9 \ timeout.9 callout_reset_curcpu.9 \ Modified: projects/hps_head/share/man/man9/timeout.9 ============================================================================== --- projects/hps_head/share/man/man9/timeout.9 Wed Jul 13 11:58:21 2016 (r302767) +++ projects/hps_head/share/man/man9/timeout.9 Wed Jul 13 12:26:36 2016 (r302768) @@ -42,6 +42,7 @@ .Nm callout_init_mtx , .Nm callout_init_rm , .Nm callout_init_rw , +.Nm callout_init_lock_function , .Nm callout_pending , .Nm callout_reset , .Nm callout_reset_curcpu , @@ -65,6 +66,7 @@ .Bd -literal typedef void timeout_t (void *); typedef void callout_func_t (void *); +typedef void callout_lock_func_t (void *, int do_lock); .Ed .Ft int .Fn callout_active "struct callout *c" @@ -87,6 +89,8 @@ struct callout_handle handle = CALLOUT_H .Fn callout_init_rm "struct callout *c" "struct rmlock *rm" "int flags" .Ft void .Fn callout_init_rw "struct callout *c" "struct rwlock *rw" "int flags" +.Ft void +.Fn callout_init_lock_function "struct callout *c" "callout_lock_func_t *func" "int flags" .Ft int .Fn callout_pending "struct callout *c" .Ft int @@ -247,6 +251,13 @@ flag. This function is similar to .Fn callout_init_mtx , but it accepts a read/write type of lock. +.Pp +.Ft void +.Fn callout_init_lock_function "struct callout *c" "callout_lock_func_t *func" "int flags" +This function is similar to +.Fn callout_init_mtx , +but it accepts a callback function which does locking and unlocking. +This is useful when more than one lock is involved protecting a structure. .Sh SCHEDULING CALLOUTS .Ft struct callout_handle .Fn timeout "timeout_t *func" "void *arg" "int ticks" Modified: projects/hps_head/sys/kern/kern_timeout.c ============================================================================== --- projects/hps_head/sys/kern/kern_timeout.c Wed Jul 13 11:58:21 2016 (r302767) +++ projects/hps_head/sys/kern/kern_timeout.c Wed Jul 13 12:26:36 2016 (r302768) @@ -136,7 +136,7 @@ struct callout_args { int cpu; /* CPU we're scheduled on */ }; -typedef void callout_mutex_op_t(struct lock_object *); +typedef void callout_mutex_op_t(void *, struct lock_object *); struct callout_mutex_ops { callout_mutex_op_t *lock; @@ -147,7 +147,7 @@ enum { CALLOUT_LC_UNUSED_0, CALLOUT_LC_UNUSED_1, CALLOUT_LC_UNUSED_2, - CALLOUT_LC_UNUSED_3, + CALLOUT_LC_FUNCTION, CALLOUT_LC_SPIN, CALLOUT_LC_MUTEX, CALLOUT_LC_RW, @@ -155,61 +155,75 @@ enum { }; static void -callout_mutex_op_none(struct lock_object *lock) +callout_mutex_op_none(void *arg, struct lock_object *lock) { } static void -callout_mutex_lock(struct lock_object *lock) +callout_function_lock(void *arg, struct lock_object *lock) +{ + + ((callout_lock_func_t *)lock)(arg, 1); +} + +static void +callout_function_unlock(void *arg, struct lock_object *lock) +{ + + ((callout_lock_func_t *)lock)(arg, 0); +} + +static void +callout_mutex_lock(void *arg, struct lock_object *lock) { mtx_lock((struct mtx *)lock); } static void -callout_mutex_unlock(struct lock_object *lock) +callout_mutex_unlock(void *arg, struct lock_object *lock) { mtx_unlock((struct mtx *)lock); } static void -callout_mutex_lock_spin(struct lock_object *lock) +callout_mutex_lock_spin(void *arg, struct lock_object *lock) { mtx_lock_spin((struct mtx *)lock); } static void -callout_mutex_unlock_spin(struct lock_object *lock) +callout_mutex_unlock_spin(void *arg, struct lock_object *lock) { mtx_unlock_spin((struct mtx *)lock); } static void -callout_rm_wlock(struct lock_object *lock) +callout_rm_wlock(void *arg, struct lock_object *lock) { rm_wlock((struct rmlock *)lock); } static void -callout_rm_wunlock(struct lock_object *lock) +callout_rm_wunlock(void *arg, struct lock_object *lock) { rm_wunlock((struct rmlock *)lock); } static void -callout_rw_wlock(struct lock_object *lock) +callout_rw_wlock(void *arg, struct lock_object *lock) { rw_wlock((struct rwlock *)lock); } static void -callout_rw_wunlock(struct lock_object *lock) +callout_rw_wunlock(void *arg, struct lock_object *lock) { rw_wunlock((struct rwlock *)lock); @@ -228,9 +242,9 @@ static const struct callout_mutex_ops ca .lock = callout_mutex_op_none, .unlock = callout_mutex_op_none, }, - [CALLOUT_LC_UNUSED_3] = { - .lock = callout_mutex_op_none, - .unlock = callout_mutex_op_none, + [CALLOUT_LC_FUNCTION] = { + .lock = callout_function_lock, + .unlock = callout_function_unlock, }, [CALLOUT_LC_SPIN] = { .lock = callout_mutex_lock_spin, @@ -251,17 +265,17 @@ static const struct callout_mutex_ops ca }; static inline void -callout_lock_client(int c_flags, struct lock_object *c_lock) +callout_lock_client(int c_flags, void *c_arg, struct lock_object *c_lock) { - callout_mutex_ops[CALLOUT_GET_LC(c_flags)].lock(c_lock); + callout_mutex_ops[CALLOUT_GET_LC(c_flags)].lock(c_arg, c_lock); } static inline void -callout_unlock_client(int c_flags, struct lock_object *c_lock) +callout_unlock_client(int c_flags, void *c_arg, struct lock_object *c_lock) { - callout_mutex_ops[CALLOUT_GET_LC(c_flags)].unlock(c_lock); + callout_mutex_ops[CALLOUT_GET_LC(c_flags)].unlock(c_arg, c_lock); } /* @@ -788,7 +802,7 @@ softclock_call_cc(struct callout *c, str /* unlocked region for switching locks */ - callout_lock_client(c_flags, c_lock); + callout_lock_client(c_flags, c_arg, c_lock); /* * Check if the callout may have been cancelled while @@ -798,7 +812,7 @@ softclock_call_cc(struct callout *c, str */ CC_LOCK(cc); if (cc_exec_cancel(cc, direct)) { - callout_unlock_client(c_flags, c_lock); + callout_unlock_client(c_flags, c_arg, c_lock); goto skip_cc_locked; } if (c_lock == &Giant.lock_object) { @@ -859,7 +873,7 @@ softclock_call_cc(struct callout *c, str * "c->c_flags": */ if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) - callout_unlock_client(c_flags, c_lock); + callout_unlock_client(c_flags, c_arg, c_lock); CC_LOCK(cc); @@ -1203,13 +1217,13 @@ callout_reset_sbt_on(struct callout *c, int callout_schedule_on(struct callout *c, int to_ticks, int cpu) { - return callout_reset_on(c, to_ticks, c->c_func, c->c_arg, cpu); + return (callout_reset_on(c, to_ticks, c->c_func, c->c_arg, cpu)); } int callout_schedule(struct callout *c, int to_ticks) { - return callout_reset_on(c, to_ticks, c->c_func, c->c_arg, c->c_cpu); + return (callout_reset_on(c, to_ticks, c->c_func, c->c_arg, c->c_cpu)); } int @@ -1240,8 +1254,6 @@ callout_drain(struct callout *c) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "Draining callout"); - callout_lock_client(c->c_flags, c->c_lock); - /* at this point the "c->c_cpu" field is not changing */ retval = callout_async_drain(c, &callout_drain_function); @@ -1256,12 +1268,6 @@ callout_drain(struct callout *c) cc = callout_lock(c); direct = ((c->c_flags & CALLOUT_DIRECT) != 0); - /* - * We've gotten our callout CPU lock, it is safe to - * drop the initial lock: - */ - callout_unlock_client(c->c_flags, c->c_lock); - /* Wait for drain to complete */ while (cc_exec_curr(cc, direct) == c) { msleep_spin(&callout_drain_function, @@ -1269,8 +1275,6 @@ callout_drain(struct callout *c) } CC_UNLOCK(cc); - } else { - callout_unlock_client(c->c_flags, c->c_lock); } CTR4(KTR_CALLOUT, "%s: %p func %p arg %p", @@ -1284,18 +1288,34 @@ void callout_init(struct callout *c, int mpsafe) { if (mpsafe) { - _callout_init_lock(c, NULL, CALLOUT_RETURNUNLOCKED); + callout_init_lock_object(c, NULL, CALLOUT_RETURNUNLOCKED); } else { - _callout_init_lock(c, &Giant.lock_object, 0); + callout_init_lock_object(c, &Giant.lock_object, 0); } } void -_callout_init_lock(struct callout *c, struct lock_object *lock, int flags) +callout_init_lock_function(struct callout *c, callout_lock_func_t *lock_fn, int flags) +{ + bzero(c, sizeof *c); + + KASSERT((flags & ~CALLOUT_RETURNUNLOCKED) == 0, + ("callout_init_lock_function: bad flags 0x%08x", flags)); + KASSERT(lock_fn != NULL, + ("callout_init_lock_function: lock function is NULL")); + flags &= CALLOUT_RETURNUNLOCKED; + flags |= CALLOUT_SET_LC(CALLOUT_LC_FUNCTION); + c->c_lock = (struct lock_object *)lock_fn; + c->c_flags = flags; + c->c_cpu = timeout_cpu; +} + +void +callout_init_lock_object(struct callout *c, struct lock_object *lock, int flags) { bzero(c, sizeof *c); KASSERT((flags & ~CALLOUT_RETURNUNLOCKED) == 0, - ("callout_init_lock: bad flags 0x%08x", flags)); + ("callout_init_lock_object: bad flags 0x%08x", flags)); flags &= CALLOUT_RETURNUNLOCKED; if (lock != NULL) { struct lock_class *class = LOCK_CLASS(lock); @@ -1308,7 +1328,8 @@ _callout_init_lock(struct callout *c, st else if (class == &lock_class_rw) flags |= CALLOUT_SET_LC(CALLOUT_LC_RW); else - panic("callout_init_lock: Unsupported lock class '%s'\n", class->lc_name); + panic("callout_init_lock_object: Unsupported lock class '%s'\n", + class->lc_name); } else { flags |= CALLOUT_SET_LC(CALLOUT_LC_UNUSED_0); } Modified: projects/hps_head/sys/sys/_callout.h ============================================================================== --- projects/hps_head/sys/sys/_callout.h Wed Jul 13 11:58:21 2016 (r302767) +++ projects/hps_head/sys/sys/_callout.h Wed Jul 13 12:26:36 2016 (r302768) @@ -47,6 +47,7 @@ SLIST_HEAD(callout_slist, callout); TAILQ_HEAD(callout_tailq, callout); typedef void callout_func_t(void *); +typedef void callout_lock_func_t(void *, int); struct callout { union { @@ -58,7 +59,7 @@ struct callout { sbintime_t c_precision; /* delta allowed wrt opt */ void *c_arg; /* function argument */ callout_func_t *c_func; /* function to call */ - struct lock_object *c_lock; /* lock to handle */ + struct lock_object *c_lock; /* pointer to lock handle */ int c_flags; /* state of this entry */ volatile int c_cpu; /* CPU we're scheduled on */ }; Modified: projects/hps_head/sys/sys/callout.h ============================================================================== --- projects/hps_head/sys/sys/callout.h Wed Jul 13 11:58:21 2016 (r302767) +++ projects/hps_head/sys/sys/callout.h Wed Jul 13 12:26:36 2016 (r302768) @@ -75,15 +75,16 @@ struct callout_handle { int callout_drain(struct callout *); int callout_async_drain(struct callout *, callout_func_t *); void callout_init(struct callout *, int); -void _callout_init_lock(struct callout *, struct lock_object *, int); -#define callout_init_mtx(c, mtx, flags) \ - _callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object : \ +void callout_init_lock_function(struct callout *, callout_lock_func_t *, int); +void callout_init_lock_object(struct callout *, struct lock_object *, int); +#define callout_init_mtx(c, mtx, flags) \ + callout_init_lock_object((c), ((mtx) != NULL) ? &(mtx)->lock_object : \ NULL, (flags)) -#define callout_init_rm(c, rm, flags) \ - _callout_init_lock((c), ((rm) != NULL) ? &(rm)->lock_object : \ +#define callout_init_rm(c, rm, flags) \ + callout_init_lock_object((c), ((rm) != NULL) ? &(rm)->lock_object : \ NULL, (flags)) -#define callout_init_rw(c, rw, flags) \ - _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \ +#define callout_init_rw(c, rw, flags) \ + callout_init_lock_object((c), ((rw) != NULL) ? &(rw)->lock_object : \ NULL, (flags)) #define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING) int callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t, From owner-svn-src-projects@freebsd.org Wed Jul 13 12:40:46 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7E52B93656 for ; Wed, 13 Jul 2016 12:40:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63AD31D12; Wed, 13 Jul 2016 12:40:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DCejs7061082; Wed, 13 Jul 2016 12:40:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DCei8m061067; Wed, 13 Jul 2016 12:40:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201607131240.u6DCei8m061067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Jul 2016 12:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302769 - in projects/hps_head: . bin/dd bin/sh bin/sh/tests/builtins cddl/lib/libdtrace contrib/llvm/projects/libunwind/include contrib/llvm/projects/libunwind/src contrib/one-true-awk... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 12:40:46 -0000 Author: hselasky Date: Wed Jul 13 12:40:43 2016 New Revision: 302769 URL: https://svnweb.freebsd.org/changeset/base/302769 Log: Merge ^/head r302427 through r302768. Added: projects/hps_head/share/man/man4/if_ntb.4 - copied unchanged from r302768, head/share/man/man4/if_ntb.4 projects/hps_head/share/man/man4/ntb_hw.4 - copied unchanged from r302768, head/share/man/man4/ntb_hw.4 projects/hps_head/share/man/man4/ntb_transport.4 - copied unchanged from r302768, head/share/man/man4/ntb_transport.4 projects/hps_head/sys/arm/allwinner/a13/ - copied from r302768, head/sys/arm/allwinner/a13/ projects/hps_head/sys/arm/allwinner/a64/ - copied from r302768, head/sys/arm/allwinner/a64/ projects/hps_head/sys/compat/linux/linux_mmap.c - copied unchanged from r302768, head/sys/compat/linux/linux_mmap.c projects/hps_head/sys/compat/linux/linux_mmap.h - copied unchanged from r302768, head/sys/compat/linux/linux_mmap.h projects/hps_head/sys/compat/linux/linux_persona.h - copied unchanged from r302768, head/sys/compat/linux/linux_persona.h projects/hps_head/sys/dev/hyperv/vmbus/vmbus_if.m - copied unchanged from r302768, head/sys/dev/hyperv/vmbus/vmbus_if.m projects/hps_head/sys/dev/ntb/ntb.c - copied unchanged from r302768, head/sys/dev/ntb/ntb.c projects/hps_head/sys/dev/ntb/ntb.h - copied unchanged from r302768, head/sys/dev/ntb/ntb.h projects/hps_head/sys/dev/ntb/ntb_if.m - copied unchanged from r302768, head/sys/dev/ntb/ntb_if.m projects/hps_head/sys/dev/ntb/ntb_transport.c - copied unchanged from r302768, head/sys/dev/ntb/ntb_transport.c projects/hps_head/sys/dev/ntb/ntb_transport.h - copied unchanged from r302768, head/sys/dev/ntb/ntb_transport.h projects/hps_head/sys/modules/ntb/ntb/ - copied from r302768, head/sys/modules/ntb/ntb/ projects/hps_head/sys/modules/ntb/ntb_transport/ - copied from r302768, head/sys/modules/ntb/ntb_transport/ projects/hps_head/tests/sys/netinet/tcp_user_cookie.c - copied unchanged from r302768, head/tests/sys/netinet/tcp_user_cookie.c projects/hps_head/usr.sbin/bhyve/pci_e82545.c - copied unchanged from r302768, head/usr.sbin/bhyve/pci_e82545.c Deleted: projects/hps_head/share/man/man4/ntb.4 projects/hps_head/sys/dev/hyperv/vmbus/hv_connection.c projects/hps_head/sys/dev/ntb/ntb_hw/ntb_hw.h projects/hps_head/sys/powerpc/ofw/ofw_pci.c projects/hps_head/sys/powerpc/ofw/ofw_pci.h Modified: projects/hps_head/Makefile.inc1 projects/hps_head/ObsoleteFiles.inc projects/hps_head/bin/dd/args.c projects/hps_head/bin/dd/position.c projects/hps_head/bin/sh/expand.c projects/hps_head/bin/sh/tests/builtins/case7.0 projects/hps_head/cddl/lib/libdtrace/tcp.d projects/hps_head/contrib/llvm/projects/libunwind/include/__libunwind_config.h projects/hps_head/contrib/llvm/projects/libunwind/include/libunwind.h projects/hps_head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp projects/hps_head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp projects/hps_head/contrib/llvm/projects/libunwind/src/DwarfParser.hpp projects/hps_head/contrib/llvm/projects/libunwind/src/Registers.hpp projects/hps_head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp projects/hps_head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp projects/hps_head/contrib/llvm/projects/libunwind/src/UnwindLevel1.c projects/hps_head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S projects/hps_head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S projects/hps_head/contrib/llvm/projects/libunwind/src/config.h projects/hps_head/contrib/llvm/projects/libunwind/src/libunwind.cpp projects/hps_head/contrib/one-true-awk/b.c projects/hps_head/gnu/lib/libgcc/Makefile projects/hps_head/lib/libc/gen/fnmatch.c projects/hps_head/lib/libc/gen/glob.c projects/hps_head/lib/libc/locale/collate.h projects/hps_head/lib/libc/locale/collcmp.c projects/hps_head/lib/libc/regex/regcomp.c projects/hps_head/lib/libc/stdio/vfscanf.c projects/hps_head/lib/libc/sys/getloginclass.2 projects/hps_head/release/Makefile projects/hps_head/release/doc/en_US.ISO8859-1/relnotes/article.xml projects/hps_head/release/doc/share/xml/release.ent projects/hps_head/sbin/ipfw/dummynet.c projects/hps_head/sbin/ipfw/ipfw2.h projects/hps_head/share/man/man4/Makefile projects/hps_head/share/man/man4/mpr.4 projects/hps_head/share/man/man4/mps.4 projects/hps_head/share/man/man9/ifnet.9 projects/hps_head/share/misc/committers-ports.dot projects/hps_head/sys/amd64/cloudabi64/cloudabi64_sysvec.c projects/hps_head/sys/amd64/include/intr_machdep.h projects/hps_head/sys/amd64/linux/linux.h projects/hps_head/sys/amd64/linux/linux_machdep.c projects/hps_head/sys/amd64/linux/linux_proto.h projects/hps_head/sys/amd64/linux/linux_syscall.h projects/hps_head/sys/amd64/linux/linux_syscalls.c projects/hps_head/sys/amd64/linux/linux_sysent.c projects/hps_head/sys/amd64/linux/linux_systrace_args.c projects/hps_head/sys/amd64/linux/syscalls.master projects/hps_head/sys/amd64/linux32/linux.h projects/hps_head/sys/amd64/linux32/linux32_machdep.c projects/hps_head/sys/amd64/linux32/linux32_proto.h projects/hps_head/sys/amd64/linux32/linux32_syscall.h projects/hps_head/sys/amd64/linux32/linux32_syscalls.c projects/hps_head/sys/amd64/linux32/linux32_sysent.c projects/hps_head/sys/amd64/linux32/linux32_systrace_args.c projects/hps_head/sys/amd64/linux32/syscalls.master projects/hps_head/sys/arm/allwinner/a10_ahci.c projects/hps_head/sys/arm/allwinner/a10_codec.c projects/hps_head/sys/arm/allwinner/a10_dmac.c projects/hps_head/sys/arm/allwinner/a10_ehci.c projects/hps_head/sys/arm/allwinner/a10_fb.c projects/hps_head/sys/arm/allwinner/a10_gpio.c projects/hps_head/sys/arm/allwinner/a10_hdmi.c projects/hps_head/sys/arm/allwinner/a10_mmc.c projects/hps_head/sys/arm/allwinner/a10_mmc.h projects/hps_head/sys/arm/allwinner/allwinner_machdep.c projects/hps_head/sys/arm/allwinner/aw_ccu.c projects/hps_head/sys/arm/allwinner/aw_if_dwc.c projects/hps_head/sys/arm/allwinner/aw_nmi.c projects/hps_head/sys/arm/allwinner/aw_rsb.c projects/hps_head/sys/arm/allwinner/aw_usbphy.c projects/hps_head/sys/arm/allwinner/clk/aw_ahbclk.c projects/hps_head/sys/arm/allwinner/clk/aw_apbclk.c projects/hps_head/sys/arm/allwinner/clk/aw_axiclk.c projects/hps_head/sys/arm/allwinner/clk/aw_codecclk.c projects/hps_head/sys/arm/allwinner/clk/aw_cpuclk.c projects/hps_head/sys/arm/allwinner/clk/aw_cpusclk.c projects/hps_head/sys/arm/allwinner/clk/aw_debeclk.c projects/hps_head/sys/arm/allwinner/clk/aw_gate.c projects/hps_head/sys/arm/allwinner/clk/aw_gmacclk.c projects/hps_head/sys/arm/allwinner/clk/aw_hdmiclk.c projects/hps_head/sys/arm/allwinner/clk/aw_lcdclk.c projects/hps_head/sys/arm/allwinner/clk/aw_mmcclk.c projects/hps_head/sys/arm/allwinner/clk/aw_modclk.c projects/hps_head/sys/arm/allwinner/clk/aw_pll.c projects/hps_head/sys/arm/allwinner/clk/aw_usbclk.c projects/hps_head/sys/arm/allwinner/if_awg.c projects/hps_head/sys/arm/allwinner/if_emac.c projects/hps_head/sys/arm/allwinner/std.a10 projects/hps_head/sys/arm/conf/A10 projects/hps_head/sys/arm/conf/ALLWINNER projects/hps_head/sys/arm/conf/ALPINE projects/hps_head/sys/arm/conf/AML8726 projects/hps_head/sys/arm/conf/ARMADA38X projects/hps_head/sys/arm/conf/ARMADAXP projects/hps_head/sys/arm/conf/ATMEL projects/hps_head/sys/arm/conf/AVILA projects/hps_head/sys/arm/conf/BEAGLEBONE projects/hps_head/sys/arm/conf/BWCT projects/hps_head/sys/arm/conf/CAMBRIA projects/hps_head/sys/arm/conf/CNS11XXNAS projects/hps_head/sys/arm/conf/CRB projects/hps_head/sys/arm/conf/DB-78XXX projects/hps_head/sys/arm/conf/DB-88F5XXX projects/hps_head/sys/arm/conf/DB-88F6XXX projects/hps_head/sys/arm/conf/DOCKSTAR projects/hps_head/sys/arm/conf/DREAMPLUG-1001 projects/hps_head/sys/arm/conf/EA3250 projects/hps_head/sys/arm/conf/EB9200 projects/hps_head/sys/arm/conf/EFIKA_MX projects/hps_head/sys/arm/conf/ETHERNUT5 projects/hps_head/sys/arm/conf/EXYNOS5.common projects/hps_head/sys/arm/conf/GUMSTIX projects/hps_head/sys/arm/conf/HL200 projects/hps_head/sys/arm/conf/HL201 projects/hps_head/sys/arm/conf/IMX53 projects/hps_head/sys/arm/conf/IMX53-QSB projects/hps_head/sys/arm/conf/IMX6 projects/hps_head/sys/arm/conf/KB920X projects/hps_head/sys/arm/conf/NSLU projects/hps_head/sys/arm/conf/PANDABOARD projects/hps_head/sys/arm/conf/QILA9G20 projects/hps_head/sys/arm/conf/RK3188 projects/hps_head/sys/arm/conf/RPI-B projects/hps_head/sys/arm/conf/RPI2 projects/hps_head/sys/arm/conf/SAM9260EK projects/hps_head/sys/arm/conf/SAM9G20EK projects/hps_head/sys/arm/conf/SAM9X25EK projects/hps_head/sys/arm/conf/SHEEVAPLUG projects/hps_head/sys/arm/conf/SN9G45 projects/hps_head/sys/arm/conf/SOCKIT.common projects/hps_head/sys/arm/conf/TEGRA124 projects/hps_head/sys/arm/conf/TS7800 projects/hps_head/sys/arm/conf/VERSATILEPB projects/hps_head/sys/arm/conf/VIRT projects/hps_head/sys/arm/conf/VYBRID projects/hps_head/sys/arm/conf/ZEDBOARD projects/hps_head/sys/arm/conf/std.arm projects/hps_head/sys/arm/conf/std.armv6 projects/hps_head/sys/arm/lpc/if_lpe.c projects/hps_head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c projects/hps_head/sys/arm/nvidia/tegra124/tegra124_pmc.c projects/hps_head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c projects/hps_head/sys/arm/nvidia/tegra_ahci.c projects/hps_head/sys/arm/nvidia/tegra_efuse.c projects/hps_head/sys/arm/nvidia/tegra_ehci.c projects/hps_head/sys/arm/nvidia/tegra_i2c.c projects/hps_head/sys/arm/nvidia/tegra_pcie.c projects/hps_head/sys/arm/nvidia/tegra_rtc.c projects/hps_head/sys/arm/nvidia/tegra_sdhci.c projects/hps_head/sys/arm/nvidia/tegra_soctherm.c projects/hps_head/sys/arm/nvidia/tegra_uart.c projects/hps_head/sys/arm/nvidia/tegra_usbphy.c projects/hps_head/sys/arm/samsung/exynos/chrome_kb.c projects/hps_head/sys/arm64/cloudabi64/cloudabi64_sysvec.c projects/hps_head/sys/boot/fdt/fdt_loader_cmd.c projects/hps_head/sys/boot/uboot/lib/elf_freebsd.c projects/hps_head/sys/boot/uboot/lib/glue.c projects/hps_head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c projects/hps_head/sys/compat/linux/linux_emul.c projects/hps_head/sys/compat/linux/linux_emul.h projects/hps_head/sys/compat/linux/linux_misc.c projects/hps_head/sys/conf/files.amd64 projects/hps_head/sys/conf/files.i386 projects/hps_head/sys/conf/files.pc98 projects/hps_head/sys/conf/kern.mk projects/hps_head/sys/conf/options.arm projects/hps_head/sys/conf/options.arm64 projects/hps_head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c projects/hps_head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c projects/hps_head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_recv_ds.c projects/hps_head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c projects/hps_head/sys/dev/ath/ath_hal/ah.c projects/hps_head/sys/dev/ath/ath_hal/ah.h projects/hps_head/sys/dev/ath/ath_hal/ah_desc.h projects/hps_head/sys/dev/ath/ath_hal/ah_internal.h projects/hps_head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c projects/hps_head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c projects/hps_head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c projects/hps_head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/hps_head/sys/dev/ath/if_ath.c projects/hps_head/sys/dev/ath/if_athvar.h projects/hps_head/sys/dev/bhnd/bhnd.c projects/hps_head/sys/dev/bhnd/bhnd.h projects/hps_head/sys/dev/bhnd/bhnd_subr.c projects/hps_head/sys/dev/bhnd/bhndb/bhndb.c projects/hps_head/sys/dev/bhnd/bhndvar.h projects/hps_head/sys/dev/bhnd/cores/chipc/chipc_spi.c projects/hps_head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c projects/hps_head/sys/dev/cxgb/ulp/tom/cxgb_listen.c projects/hps_head/sys/dev/cxgbe/t4_main.c projects/hps_head/sys/dev/cxgbe/tom/t4_listen.c projects/hps_head/sys/dev/drm2/drm_os_freebsd.h projects/hps_head/sys/dev/drm2/i915/i915_drv.h projects/hps_head/sys/dev/drm2/radeon/radeon_acpi.c projects/hps_head/sys/dev/dwc/if_dwc.c projects/hps_head/sys/dev/extres/clk/clk.c projects/hps_head/sys/dev/extres/clk/clk.h projects/hps_head/sys/dev/extres/clk/clk_fixed.c projects/hps_head/sys/dev/extres/hwreset/hwreset.c projects/hps_head/sys/dev/extres/hwreset/hwreset.h projects/hps_head/sys/dev/extres/phy/phy.c projects/hps_head/sys/dev/extres/phy/phy.h projects/hps_head/sys/dev/extres/regulator/regulator.c projects/hps_head/sys/dev/extres/regulator/regulator.h projects/hps_head/sys/dev/hyperv/include/hyperv.h projects/hps_head/sys/dev/hyperv/include/hyperv_busdma.h projects/hps_head/sys/dev/hyperv/netvsc/hv_net_vsc.c projects/hps_head/sys/dev/hyperv/netvsc/hv_net_vsc.h projects/hps_head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c projects/hps_head/sys/dev/hyperv/netvsc/hv_rndis_filter.c projects/hps_head/sys/dev/hyperv/netvsc/hv_rndis_filter.h projects/hps_head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c projects/hps_head/sys/dev/hyperv/utilities/hv_heartbeat.c projects/hps_head/sys/dev/hyperv/utilities/hv_kvp.c projects/hps_head/sys/dev/hyperv/utilities/hv_shutdown.c projects/hps_head/sys/dev/hyperv/utilities/hv_timesync.c projects/hps_head/sys/dev/hyperv/utilities/hv_util.c projects/hps_head/sys/dev/hyperv/utilities/hv_util.h projects/hps_head/sys/dev/hyperv/vmbus/hv_channel.c projects/hps_head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c projects/hps_head/sys/dev/hyperv/vmbus/hv_ring_buffer.c projects/hps_head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h projects/hps_head/sys/dev/hyperv/vmbus/hyperv.c projects/hps_head/sys/dev/hyperv/vmbus/hyperv_reg.h projects/hps_head/sys/dev/hyperv/vmbus/hyperv_var.h projects/hps_head/sys/dev/hyperv/vmbus/vmbus.c projects/hps_head/sys/dev/hyperv/vmbus/vmbus_reg.h projects/hps_head/sys/dev/hyperv/vmbus/vmbus_var.h projects/hps_head/sys/dev/iicbus/twsi/a10_twsi.c projects/hps_head/sys/dev/ioat/ioat.c projects/hps_head/sys/dev/ioat/ioat.h projects/hps_head/sys/dev/ioat/ioat_hw.h projects/hps_head/sys/dev/ioat/ioat_internal.h projects/hps_head/sys/dev/mpr/mpr.c projects/hps_head/sys/dev/mpr/mpr_sas.c projects/hps_head/sys/dev/mpr/mprvar.h projects/hps_head/sys/dev/mps/mps.c projects/hps_head/sys/dev/mps/mps_sas.c projects/hps_head/sys/dev/mps/mpsvar.h projects/hps_head/sys/dev/ntb/if_ntb/if_ntb.c projects/hps_head/sys/dev/ntb/ntb_hw/ntb_hw.c projects/hps_head/sys/dev/ntb/ntb_hw/ntb_regs.h projects/hps_head/sys/dev/ofw/ofwpci.c projects/hps_head/sys/dev/uart/uart_dev_snps.c projects/hps_head/sys/dev/usb/controller/generic_ohci.c projects/hps_head/sys/i386/i386/exception.s projects/hps_head/sys/i386/include/intr_machdep.h projects/hps_head/sys/i386/linux/linux.h projects/hps_head/sys/i386/linux/linux_machdep.c projects/hps_head/sys/i386/linux/linux_proto.h projects/hps_head/sys/i386/linux/linux_syscall.h projects/hps_head/sys/i386/linux/linux_syscalls.c projects/hps_head/sys/i386/linux/linux_sysent.c projects/hps_head/sys/i386/linux/linux_systrace_args.c projects/hps_head/sys/i386/linux/syscalls.master projects/hps_head/sys/kern/init_main.c projects/hps_head/sys/kern/init_sysent.c projects/hps_head/sys/kern/kern_descrip.c projects/hps_head/sys/kern/subr_trap.c projects/hps_head/sys/kern/sys_generic.c projects/hps_head/sys/kern/sys_procdesc.c projects/hps_head/sys/kern/syscalls.master projects/hps_head/sys/kern/vfs_subr.c projects/hps_head/sys/kern/vfs_syscalls.c projects/hps_head/sys/mips/mips/db_trace.c projects/hps_head/sys/modules/hyperv/netvsc/Makefile projects/hps_head/sys/modules/hyperv/storvsc/Makefile projects/hps_head/sys/modules/hyperv/utilities/Makefile projects/hps_head/sys/modules/hyperv/vmbus/Makefile projects/hps_head/sys/modules/linux/Makefile projects/hps_head/sys/modules/linux_common/Makefile projects/hps_head/sys/modules/ntb/Makefile projects/hps_head/sys/modules/ntb/ntb_hw/Makefile projects/hps_head/sys/net/iflib.c projects/hps_head/sys/net/mppcc.c projects/hps_head/sys/net/mppcd.c projects/hps_head/sys/net/netisr.c projects/hps_head/sys/netpfil/ipfw/dn_sched_fq_pie.c projects/hps_head/sys/netpfil/pf/pf_ioctl.c projects/hps_head/sys/rpc/clnt_dg.c projects/hps_head/sys/rpc/clnt_vc.c projects/hps_head/sys/rpc/svc.c projects/hps_head/sys/rpc/svc_dg.c projects/hps_head/sys/security/audit/audit_bsm.c projects/hps_head/sys/sys/param.h projects/hps_head/sys/sys/sysproto.h projects/hps_head/sys/vm/vm_mmap.c projects/hps_head/sys/vm/vm_object.c projects/hps_head/sys/x86/x86/msi.c projects/hps_head/sys/x86/xen/hvm.c projects/hps_head/tests/sys/netinet/Makefile projects/hps_head/tools/tools/locale/Makefile projects/hps_head/tools/tools/sysbuild/sysbuild.sh projects/hps_head/usr.bin/mail/cmd3.c projects/hps_head/usr.bin/mail/collect.c projects/hps_head/usr.bin/mail/vars.c projects/hps_head/usr.bin/mkcsmapper/mkcsmapper.1 projects/hps_head/usr.bin/mkcsmapper/yacc.y projects/hps_head/usr.bin/mkimg/vmdk.c projects/hps_head/usr.bin/pathchk/pathchk.c projects/hps_head/usr.bin/tr/str.c projects/hps_head/usr.bin/tr/tr.1 projects/hps_head/usr.bin/tr/tr.c projects/hps_head/usr.bin/ul/ul.c projects/hps_head/usr.sbin/bhyve/Makefile projects/hps_head/usr.sbin/bhyve/bhyve.8 projects/hps_head/usr.sbin/bhyve/pci_ahci.c projects/hps_head/usr.sbin/bhyve/pci_emul.h projects/hps_head/usr.sbin/bhyve/ps2kbd.c (contents, props changed) projects/hps_head/usr.sbin/ctld/ctld.c projects/hps_head/usr.sbin/etcupdate/etcupdate.sh projects/hps_head/usr.sbin/freebsd-update/freebsd-update.sh projects/hps_head/usr.sbin/mergemaster/mergemaster.sh projects/hps_head/usr.sbin/ypldap/parse.y Directory Properties: projects/hps_head/ (props changed) projects/hps_head/cddl/ (props changed) projects/hps_head/contrib/llvm/ (props changed) projects/hps_head/contrib/llvm/projects/libunwind/ (props changed) projects/hps_head/contrib/one-true-awk/ (props changed) projects/hps_head/gnu/lib/ (props changed) projects/hps_head/sys/cddl/contrib/opensolaris/ (props changed) Modified: projects/hps_head/Makefile.inc1 ============================================================================== --- projects/hps_head/Makefile.inc1 Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/Makefile.inc1 Wed Jul 13 12:40:43 2016 (r302769) @@ -555,7 +555,7 @@ XCXXFLAGS+= -isystem ${WORLDTMP}/usr/inc .endif .else TARGET_ABI?= unknown -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 +TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0 XCFLAGS+= -target ${TARGET_TRIPLE} .endif XCFLAGS+= --sysroot=${WORLDTMP} Modified: projects/hps_head/ObsoleteFiles.inc ============================================================================== --- projects/hps_head/ObsoleteFiles.inc Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/ObsoleteFiles.inc Wed Jul 13 12:40:43 2016 (r302769) @@ -203,7 +203,7 @@ OLD_FILES+=usr/share/man/man9/rman_await # 20160517: ReiserFS removed OLD_FILES+=usr/share/man/man5/reiserfs.5.gz # 20160430: kvm_getfiles(3) removed from kvm(3) -OLD_LIBS+=usr/lib/libkvm.so.6 +OLD_LIBS+=lib/libkvm.so.6 OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz # 20160423: remove mroute6d OLD_FILES+=etc/rc.d/mroute6d @@ -8014,7 +8014,7 @@ OLD_FILES+=usr/share/man/man5/usbd.conf. .if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64" OLD_FILES+=usr/share/man/man8/boot_i386.8.gz .endif -.if ${TARGET_ARCH} != "aarch64" && ${TARGET_CPUARCH} != "arm" && \ +.if ${TARGET_ARCH} != "aarch64" && ${TARGET} != "arm" && \ ${TARGET_ARCH} != "powerpc" && ${TARGET_ARCH} != "powerpc64" && \ ${TARGET_ARCH} != "sparc64" OLD_FILES+=usr/share/man/man8/ofwdump.8.gz Modified: projects/hps_head/bin/dd/args.c ============================================================================== --- projects/hps_head/bin/dd/args.c Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/bin/dd/args.c Wed Jul 13 12:40:43 2016 (r302769) @@ -167,14 +167,6 @@ jcl(char **argv) errx(1, "cbs meaningless if not doing record operations"); } else cfunc = def; - - /* - * Bail out if the calculation of a file offset would overflow. - */ - if (in.offset > OFF_MAX / (ssize_t)in.dbsz || - out.offset > OFF_MAX / (ssize_t)out.dbsz) - errx(1, "seek offsets cannot be larger than %jd", - (intmax_t)OFF_MAX); } static int Modified: projects/hps_head/bin/dd/position.c ============================================================================== --- projects/hps_head/bin/dd/position.c Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/bin/dd/position.c Wed Jul 13 12:40:43 2016 (r302769) @@ -45,12 +45,41 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include "dd.h" #include "extern.h" +static off_t +seek_offset(IO *io) +{ + off_t n; + size_t sz; + + n = io->offset; + sz = io->dbsz; + + _Static_assert(sizeof(io->offset) == sizeof(int64_t), "64-bit off_t"); + + /* + * If the lseek offset will be negative, verify that this is a special + * device file. Some such files (e.g. /dev/kmem) permit "negative" + * offsets. + * + * Bail out if the calculation of a file offset would overflow. + */ + if ((io->flags & ISCHR) == 0 && n > OFF_MAX / (ssize_t)sz) + errx(1, "seek offsets cannot be larger than %jd", + (intmax_t)OFF_MAX); + else if ((io->flags & ISCHR) != 0 && (uint64_t)n > UINT64_MAX / sz) + errx(1, "seek offsets cannot be larger than %ju", + (uintmax_t)UINT64_MAX); + + return ((off_t)( (uint64_t)n * sz )); +} + /* * Position input/output data streams before starting the copy. Device type * dependent. Seekable devices use lseek, and the rest position by reading. @@ -68,7 +97,7 @@ pos_in(void) /* If known to be seekable, try to seek on it. */ if (in.flags & ISSEEK) { errno = 0; - if (lseek(in.fd, in.offset * in.dbsz, SEEK_CUR) == -1 && + if (lseek(in.fd, seek_offset(&in), SEEK_CUR) == -1 && errno != 0) err(1, "%s", in.name); return; @@ -136,7 +165,7 @@ pos_out(void) */ if (out.flags & (ISSEEK | ISPIPE)) { errno = 0; - if (lseek(out.fd, out.offset * out.dbsz, SEEK_CUR) == -1 && + if (lseek(out.fd, seek_offset(&out), SEEK_CUR) == -1 && errno != 0) err(1, "%s", out.name); return; Modified: projects/hps_head/bin/sh/expand.c ============================================================================== --- projects/hps_head/bin/sh/expand.c Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/bin/sh/expand.c Wed Jul 13 12:40:43 2016 (r302769) @@ -107,7 +107,6 @@ static void expmeta(char *, char *, stru static int expsortcmp(const void *, const void *); static int patmatch(const char *, const char *); static void cvtnum(int, char *); -static int collate_range_cmp(wchar_t, wchar_t); void emptyarglist(struct arglist *list) @@ -138,16 +137,6 @@ appendarglist(struct arglist *list, char list->args[list->count++] = str; } -static int -collate_range_cmp(wchar_t c1, wchar_t c2) -{ - static wchar_t s1[2], s2[2]; - - s1[0] = c1; - s2[0] = c2; - return (wcscoll(s1, s2)); -} - static char * stputs_quotes(const char *data, const char *syntax, char *p) { @@ -1359,9 +1348,7 @@ patmatch(const char *pattern, const char return 0; } else wc2 = (unsigned char)*p++; - if ( collate_range_cmp(chr, wc) >= 0 - && collate_range_cmp(chr, wc2) <= 0 - ) + if (wc <= chr && chr <= wc2) found = 1; } else { if (chr == wc) Modified: projects/hps_head/bin/sh/tests/builtins/case7.0 ============================================================================== --- projects/hps_head/bin/sh/tests/builtins/case7.0 Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/bin/sh/tests/builtins/case7.0 Wed Jul 13 12:40:43 2016 (r302769) @@ -14,11 +14,6 @@ c1=e c2=$(printf '\366') case $c1$c2 in -[a-z][a-z]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2 in -[a-f][n-p]) ;; +[a-z][!a-z]) ;; *) echo wrong at $LINENO ;; esac Modified: projects/hps_head/cddl/lib/libdtrace/tcp.d ============================================================================== --- projects/hps_head/cddl/lib/libdtrace/tcp.d Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/cddl/lib/libdtrace/tcp.d Wed Jul 13 12:40:43 2016 (r302769) @@ -126,6 +126,7 @@ typedef struct tcpsinfo { int tcps_retransmit; /* retransmit send event, boolean */ int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ int tcps_debug; /* socket has SO_DEBUG set */ + int tcps_cookie; /* expose the socket's SO_USER_COOKIE */ int32_t tcps_dupacks; /* consecutive dup acks received */ uint32_t tcps_rtttime; /* RTT measurement start time */ uint32_t tcps_rtseq; /* sequence # being timed */ @@ -224,6 +225,8 @@ translator tcpsinfo_t < struct tcpcb *p tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ tcps_debug = p == NULL ? 0 : p->t_inpcb->inp_socket->so_options & 1; + tcps_cookie = p == NULL ? -1 : + p->t_inpcb->inp_socket->so_user_cookie; tcps_dupacks = p == NULL ? -1 : p->t_dupacks; tcps_rtttime = p == NULL ? -1 : p->t_rtttime; tcps_rtseq = p == NULL ? -1 : p->t_rtseq; Modified: projects/hps_head/contrib/llvm/projects/libunwind/include/__libunwind_config.h ============================================================================== --- projects/hps_head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Wed Jul 13 12:40:43 2016 (r302769) @@ -17,4 +17,55 @@ #define _LIBUNWIND_ARM_EHABI 0 #endif +#if defined(_LIBUNWIND_IS_NATIVE_ONLY) +# if defined(__i386__) +# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_CONTEXT_SIZE 8 +# define _LIBUNWIND_CURSOR_SIZE 19 +# define _LIBUNWIND_MAX_REGISTER 9 +# elif defined(__x86_64__) +# define _LIBUNWIND_TARGET_X86_64 1 +# define _LIBUNWIND_CONTEXT_SIZE 21 +# define _LIBUNWIND_CURSOR_SIZE 33 +# define _LIBUNWIND_MAX_REGISTER 17 +# elif defined(__ppc__) +# define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_CONTEXT_SIZE 117 +# define _LIBUNWIND_CURSOR_SIZE 128 +# define _LIBUNWIND_MAX_REGISTER 113 +# elif defined(__aarch64__) +# define _LIBUNWIND_TARGET_AARCH64 1 +# define _LIBUNWIND_CONTEXT_SIZE 66 +# define _LIBUNWIND_CURSOR_SIZE 78 +# define _LIBUNWIND_MAX_REGISTER 96 +# elif defined(__arm__) +# define _LIBUNWIND_TARGET_ARM 1 +# define _LIBUNWIND_CONTEXT_SIZE 60 +# define _LIBUNWIND_CURSOR_SIZE 67 +# define _LIBUNWIND_MAX_REGISTER 96 +# elif defined(__or1k__) +# define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_CONTEXT_SIZE 16 +# define _LIBUNWIND_CURSOR_SIZE 28 +# define _LIBUNWIND_MAX_REGISTER 32 +# elif defined(__riscv__) +# define _LIBUNWIND_TARGET_RISCV 1 +# define _LIBUNWIND_CONTEXT_SIZE 128 /* XXX */ +# define _LIBUNWIND_CURSOR_SIZE 140 /* XXX */ +# define _LIBUNWIND_MAX_REGISTER 96 +# else +# error "Unsupported architecture." +# endif +#else // !_LIBUNWIND_IS_NATIVE_ONLY +# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_TARGET_X86_64 1 +# define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_TARGET_AARCH64 1 +# define _LIBUNWIND_TARGET_ARM 1 +# define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_CONTEXT_SIZE 128 +# define _LIBUNWIND_CURSOR_SIZE 140 +# define _LIBUNWIND_MAX_REGISTER 120 +#endif // _LIBUNWIND_IS_NATIVE_ONLY + #endif // ____LIBUNWIND_CONFIG_H__ Modified: projects/hps_head/contrib/llvm/projects/libunwind/include/libunwind.h ============================================================================== --- projects/hps_head/contrib/llvm/projects/libunwind/include/libunwind.h Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/contrib/llvm/projects/libunwind/include/libunwind.h Wed Jul 13 12:40:43 2016 (r302769) @@ -46,12 +46,12 @@ enum { }; struct unw_context_t { - uint64_t data[128]; + uint64_t data[_LIBUNWIND_CONTEXT_SIZE]; }; typedef struct unw_context_t unw_context_t; struct unw_cursor_t { - uint64_t data[140]; + uint64_t data[_LIBUNWIND_CURSOR_SIZE]; }; typedef struct unw_cursor_t unw_cursor_t; @@ -295,77 +295,6 @@ enum { UNW_PPC_SPEFSCR = 112 }; -// 64-bit RISC-V registers -enum { - UNW_RISCV_X0 = 0, - UNW_RISCV_X1 = 1, - UNW_RISCV_RA = 1, - UNW_RISCV_X2 = 2, - UNW_RISCV_SP = 2, - UNW_RISCV_X3 = 3, - UNW_RISCV_X4 = 4, - UNW_RISCV_X5 = 5, - UNW_RISCV_X6 = 6, - UNW_RISCV_X7 = 7, - UNW_RISCV_X8 = 8, - UNW_RISCV_X9 = 9, - UNW_RISCV_X10 = 10, - UNW_RISCV_X11 = 11, - UNW_RISCV_X12 = 12, - UNW_RISCV_X13 = 13, - UNW_RISCV_X14 = 14, - UNW_RISCV_X15 = 15, - UNW_RISCV_X16 = 16, - UNW_RISCV_X17 = 17, - UNW_RISCV_X18 = 18, - UNW_RISCV_X19 = 19, - UNW_RISCV_X20 = 20, - UNW_RISCV_X21 = 21, - UNW_RISCV_X22 = 22, - UNW_RISCV_X23 = 23, - UNW_RISCV_X24 = 24, - UNW_RISCV_X25 = 25, - UNW_RISCV_X26 = 26, - UNW_RISCV_X27 = 27, - UNW_RISCV_X28 = 28, - UNW_RISCV_X29 = 29, - UNW_RISCV_X30 = 30, - UNW_RISCV_X31 = 31, - // reserved block - UNW_RISCV_D0 = 64, - UNW_RISCV_D1 = 65, - UNW_RISCV_D2 = 66, - UNW_RISCV_D3 = 67, - UNW_RISCV_D4 = 68, - UNW_RISCV_D5 = 69, - UNW_RISCV_D6 = 70, - UNW_RISCV_D7 = 71, - UNW_RISCV_D8 = 72, - UNW_RISCV_D9 = 73, - UNW_RISCV_D10 = 74, - UNW_RISCV_D11 = 75, - UNW_RISCV_D12 = 76, - UNW_RISCV_D13 = 77, - UNW_RISCV_D14 = 78, - UNW_RISCV_D15 = 79, - UNW_RISCV_D16 = 80, - UNW_RISCV_D17 = 81, - UNW_RISCV_D18 = 82, - UNW_RISCV_D19 = 83, - UNW_RISCV_D20 = 84, - UNW_RISCV_D21 = 85, - UNW_RISCV_D22 = 86, - UNW_RISCV_D23 = 87, - UNW_RISCV_D24 = 88, - UNW_RISCV_D25 = 89, - UNW_RISCV_D26 = 90, - UNW_RISCV_D27 = 91, - UNW_RISCV_D28 = 92, - UNW_RISCV_D29 = 93, - UNW_RISCV_D30 = 94, - UNW_RISCV_D31 = 95, -}; - // 64-bit ARM64 registers enum { UNW_ARM64_X0 = 0, @@ -604,4 +533,75 @@ enum { UNW_OR1K_R31 = 31, }; +// 64-bit RISC-V registers +enum { + UNW_RISCV_X0 = 0, + UNW_RISCV_X1 = 1, + UNW_RISCV_RA = 1, + UNW_RISCV_X2 = 2, + UNW_RISCV_SP = 2, + UNW_RISCV_X3 = 3, + UNW_RISCV_X4 = 4, + UNW_RISCV_X5 = 5, + UNW_RISCV_X6 = 6, + UNW_RISCV_X7 = 7, + UNW_RISCV_X8 = 8, + UNW_RISCV_X9 = 9, + UNW_RISCV_X10 = 10, + UNW_RISCV_X11 = 11, + UNW_RISCV_X12 = 12, + UNW_RISCV_X13 = 13, + UNW_RISCV_X14 = 14, + UNW_RISCV_X15 = 15, + UNW_RISCV_X16 = 16, + UNW_RISCV_X17 = 17, + UNW_RISCV_X18 = 18, + UNW_RISCV_X19 = 19, + UNW_RISCV_X20 = 20, + UNW_RISCV_X21 = 21, + UNW_RISCV_X22 = 22, + UNW_RISCV_X23 = 23, + UNW_RISCV_X24 = 24, + UNW_RISCV_X25 = 25, + UNW_RISCV_X26 = 26, + UNW_RISCV_X27 = 27, + UNW_RISCV_X28 = 28, + UNW_RISCV_X29 = 29, + UNW_RISCV_X30 = 30, + UNW_RISCV_X31 = 31, + // reserved block + UNW_RISCV_D0 = 64, + UNW_RISCV_D1 = 65, + UNW_RISCV_D2 = 66, + UNW_RISCV_D3 = 67, + UNW_RISCV_D4 = 68, + UNW_RISCV_D5 = 69, + UNW_RISCV_D6 = 70, + UNW_RISCV_D7 = 71, + UNW_RISCV_D8 = 72, + UNW_RISCV_D9 = 73, + UNW_RISCV_D10 = 74, + UNW_RISCV_D11 = 75, + UNW_RISCV_D12 = 76, + UNW_RISCV_D13 = 77, + UNW_RISCV_D14 = 78, + UNW_RISCV_D15 = 79, + UNW_RISCV_D16 = 80, + UNW_RISCV_D17 = 81, + UNW_RISCV_D18 = 82, + UNW_RISCV_D19 = 83, + UNW_RISCV_D20 = 84, + UNW_RISCV_D21 = 85, + UNW_RISCV_D22 = 86, + UNW_RISCV_D23 = 87, + UNW_RISCV_D24 = 88, + UNW_RISCV_D25 = 89, + UNW_RISCV_D26 = 90, + UNW_RISCV_D27 = 91, + UNW_RISCV_D28 = 92, + UNW_RISCV_D29 = 93, + UNW_RISCV_D30 = 94, + UNW_RISCV_D31 = 95, +}; + #endif Modified: projects/hps_head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp ============================================================================== --- projects/hps_head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Wed Jul 13 12:40:43 2016 (r302769) @@ -35,7 +35,7 @@ namespace libunwind { #include "Registers.hpp" #if _LIBUNWIND_ARM_EHABI -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #include typedef void *_Unwind_Ptr; @@ -62,7 +62,8 @@ extern EHTEntry __exidx_end; #endif // !defined(_LIBUNWIND_IS_BAREMETAL) #endif // _LIBUNWIND_ARM_EHABI -#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__) +#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__) || \ + defined(__NetBSD__) #if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX #include // Macro for machine-independent access to the ELF program headers. This Modified: projects/hps_head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp ============================================================================== --- projects/hps_head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp Wed Jul 13 12:40:43 2016 (r302769) @@ -27,6 +27,7 @@ namespace libunwind { +#if defined(_LIBUNWIND_TARGET_I386) /// CompactUnwinder_x86 uses a compact unwind info to virtually "step" (aka /// unwind) by modifying a Registers_x86 register set template @@ -255,8 +256,10 @@ void CompactUnwinder_x86::framelessUn // old esp is before return address registers.setSP((uint32_t)returnAddressLocation + 4); } +#endif // _LIBUNWIND_TARGET_I386 +#if defined(_LIBUNWIND_TARGET_X86_64) /// CompactUnwinder_x86_64 uses a compact unwind info to virtually "step" (aka /// unwind) by modifying a Registers_x86_64 register set template @@ -484,9 +487,11 @@ void CompactUnwinder_x86_64::frameles // old esp is before return address registers.setSP(returnAddressLocation + 8); } +#endif // _LIBUNWIND_TARGET_X86_64 +#if defined(_LIBUNWIND_TARGET_AARCH64) /// CompactUnwinder_arm64 uses a compact unwind info to virtually "step" (aka /// unwind) by modifying a Registers_arm64 register set template @@ -686,6 +691,7 @@ int CompactUnwinder_arm64::stepWithCo return UNW_STEP_SUCCESS; } +#endif // _LIBUNWIND_TARGET_AARCH64 } // namespace libunwind Modified: projects/hps_head/contrib/llvm/projects/libunwind/src/DwarfParser.hpp ============================================================================== --- projects/hps_head/contrib/llvm/projects/libunwind/src/DwarfParser.hpp Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/contrib/llvm/projects/libunwind/src/DwarfParser.hpp Wed Jul 13 12:40:43 2016 (r302769) @@ -62,7 +62,7 @@ public: }; enum { - kMaxRegisterNumber = 120 + kMaxRegisterNumber = _LIBUNWIND_MAX_REGISTER }; enum RegisterSavedWhere { kRegisterUnused, Modified: projects/hps_head/contrib/llvm/projects/libunwind/src/Registers.hpp ============================================================================== --- projects/hps_head/contrib/llvm/projects/libunwind/src/Registers.hpp Wed Jul 13 12:26:36 2016 (r302768) +++ projects/hps_head/contrib/llvm/projects/libunwind/src/Registers.hpp Wed Jul 13 12:40:43 2016 (r302769) @@ -25,6 +25,7 @@ namespace libunwind { struct v128 { uint32_t vec[4]; }; +#if defined(_LIBUNWIND_TARGET_I386) /// Registers_x86 holds the register state of a thread in a 32-bit intel /// process. class _LIBUNWIND_HIDDEN Registers_x86 { @@ -86,8 +87,8 @@ private: }; inline Registers_x86::Registers_x86(const void *registers) { - static_assert(sizeof(Registers_x86) < sizeof(unw_context_t), - "x86 registers do not fit into unw_context_t"); + static_assert((check_fit::does_fit), + "x86 registers do not fit into unw_context_t"); memcpy(&_registers, registers, sizeof(_registers)); } @@ -211,8 +212,10 @@ inline v128 Registers_x86::getVectorRegi inline void Registers_x86::setVectorRegister(int, v128) { _LIBUNWIND_ABORT("no x86 vector registers"); } +#endif // _LIBUNWIND_TARGET_I386 +#if defined(_LIBUNWIND_TARGET_X86_64) /// Registers_x86_64 holds the register state of a thread in a 64-bit intel /// process. class _LIBUNWIND_HIDDEN Registers_x86_64 { @@ -278,8 +281,8 @@ private: }; inline Registers_x86_64::Registers_x86_64(const void *registers) { - static_assert(sizeof(Registers_x86_64) < sizeof(unw_context_t), - "x86_64 registers do not fit into unw_context_t"); + static_assert((check_fit::does_fit), + "x86_64 registers do not fit into unw_context_t"); memcpy(&_registers, registers, sizeof(_registers)); } @@ -459,8 +462,10 @@ inline v128 Registers_x86_64::getVectorR inline void Registers_x86_64::setVectorRegister(int, v128) { _LIBUNWIND_ABORT("no x86_64 vector registers"); } +#endif // _LIBUNWIND_TARGET_X86_64 +#if defined(_LIBUNWIND_TARGET_PPC) /// Registers_ppc holds the register state of a thread in a 32-bit PowerPC /// process. class _LIBUNWIND_HIDDEN Registers_ppc { @@ -543,8 +548,8 @@ private: }; inline Registers_ppc::Registers_ppc(const void *registers) { - static_assert(sizeof(Registers_ppc) < sizeof(unw_context_t), - "ppc registers do not fit into unw_context_t"); + static_assert((check_fit::does_fit), + "ppc registers do not fit into unw_context_t"); memcpy(&_registers, static_cast(registers), sizeof(_registers)); static_assert(sizeof(ppc_thread_state_t) == 160, @@ -1023,266 +1028,10 @@ inline const char *Registers_ppc::getReg } } - -/// Registers_riscv holds the register state of a thread in a 64-bit RISC-V -/// process. -class _LIBUNWIND_HIDDEN Registers_riscv { -public: - Registers_riscv(); - Registers_riscv(const void *registers); - - bool validRegister(int num) const; - uint64_t getRegister(int num) const; - void setRegister(int num, uint64_t value); - bool validFloatRegister(int num) const; - double getFloatRegister(int num) const; - void setFloatRegister(int num, double value); - bool validVectorRegister(int num) const; - v128 getVectorRegister(int num) const; - void setVectorRegister(int num, v128 value); - const char *getRegisterName(int num); - void jumpto(); - static int lastDwarfRegNum() { return 95; } - - uint64_t getSP() const { return _registers.__x[2]; } - void setSP(uint64_t value) { _registers.__x[2] = value; } - uint64_t getIP() const { return _registers.__x[1]; } - void setIP(uint64_t value) { _registers.__x[1] = value; } - -private: - struct GPRs { - uint64_t __x[32]; // x0-x31 - }; - - GPRs _registers; - double _vectorHalfRegisters[32]; - // Currently only the lower double in 128-bit vectore registers - // is perserved during unwinding. We could define new register - // numbers (> 96) which mean whole vector registers, then this - // struct would need to change to contain whole vector registers. -}; - -inline Registers_riscv::Registers_riscv(const void *registers) { - static_assert(sizeof(Registers_riscv) < sizeof(unw_context_t), - "riscv registers do not fit into unw_context_t"); - memcpy(&_registers, registers, sizeof(_registers)); - static_assert(sizeof(GPRs) == 0x100, - "expected VFP registers to be at offset 256"); - memcpy(_vectorHalfRegisters, - static_cast(registers) + sizeof(GPRs), - sizeof(_vectorHalfRegisters)); -} - -inline Registers_riscv::Registers_riscv() { - memset(&_registers, 0, sizeof(_registers)); - memset(&_vectorHalfRegisters, 0, sizeof(_vectorHalfRegisters)); -} - -inline bool Registers_riscv::validRegister(int regNum) const { - if (regNum == UNW_REG_IP) - return true; - if (regNum == UNW_REG_SP) - return true; - if (regNum < 0) - return false; - if (regNum > 95) - return false; - if ((regNum > 31) && (regNum < 64)) - return false; - return true; -} - -inline uint64_t Registers_riscv::getRegister(int regNum) const { - if (regNum == UNW_REG_IP) - return _registers.__x[1]; - if (regNum == UNW_REG_SP) - return _registers.__x[2]; - if ((regNum >= 0) && (regNum < 32)) - return _registers.__x[regNum]; - _LIBUNWIND_ABORT("unsupported riscv register"); -} - -inline void Registers_riscv::setRegister(int regNum, uint64_t value) { - if (regNum == UNW_REG_IP) - _registers.__x[1] = value; - else if (regNum == UNW_REG_SP) - _registers.__x[2] = value; - else if ((regNum >= 0) && (regNum < 32)) - _registers.__x[regNum] = value; - else - _LIBUNWIND_ABORT("unsupported riscv register"); -} - -inline const char *Registers_riscv::getRegisterName(int regNum) { - switch (regNum) { - case UNW_REG_IP: - return "ra"; - case UNW_REG_SP: - return "sp"; - case UNW_RISCV_X0: - return "x0"; - case UNW_RISCV_X1: - return "ra"; - case UNW_RISCV_X2: - return "sp"; - case UNW_RISCV_X3: - return "x3"; - case UNW_RISCV_X4: - return "x4"; - case UNW_RISCV_X5: - return "x5"; - case UNW_RISCV_X6: - return "x6"; - case UNW_RISCV_X7: - return "x7"; - case UNW_RISCV_X8: - return "x8"; - case UNW_RISCV_X9: - return "x9"; - case UNW_RISCV_X10: - return "x10"; - case UNW_RISCV_X11: - return "x11"; - case UNW_RISCV_X12: - return "x12"; - case UNW_RISCV_X13: - return "x13"; - case UNW_RISCV_X14: - return "x14"; - case UNW_RISCV_X15: - return "x15"; - case UNW_RISCV_X16: - return "x16"; - case UNW_RISCV_X17: - return "x17"; - case UNW_RISCV_X18: - return "x18"; - case UNW_RISCV_X19: - return "x19"; - case UNW_RISCV_X20: - return "x20"; - case UNW_RISCV_X21: - return "x21"; - case UNW_RISCV_X22: - return "x22"; - case UNW_RISCV_X23: - return "x23"; - case UNW_RISCV_X24: - return "x24"; - case UNW_RISCV_X25: - return "x25"; - case UNW_RISCV_X26: - return "x26"; - case UNW_RISCV_X27: - return "x27"; - case UNW_RISCV_X28: - return "x28"; - case UNW_RISCV_X29: - return "x29"; - case UNW_RISCV_X30: - return "x30"; - case UNW_RISCV_X31: - return "x31"; - case UNW_RISCV_D0: - return "d0"; - case UNW_RISCV_D1: - return "d1"; - case UNW_RISCV_D2: - return "d2"; - case UNW_RISCV_D3: - return "d3"; - case UNW_RISCV_D4: - return "d4"; - case UNW_RISCV_D5: - return "d5"; - case UNW_RISCV_D6: - return "d6"; - case UNW_RISCV_D7: - return "d7"; - case UNW_RISCV_D8: - return "d8"; - case UNW_RISCV_D9: - return "d9"; - case UNW_RISCV_D10: - return "d10"; - case UNW_RISCV_D11: - return "d11"; - case UNW_RISCV_D12: - return "d12"; - case UNW_RISCV_D13: - return "d13"; - case UNW_RISCV_D14: - return "d14"; - case UNW_RISCV_D15: - return "d15"; - case UNW_RISCV_D16: - return "d16"; - case UNW_RISCV_D17: - return "d17"; - case UNW_RISCV_D18: - return "d18"; - case UNW_RISCV_D19: - return "d19"; - case UNW_RISCV_D20: - return "d20"; - case UNW_RISCV_D21: - return "d21"; - case UNW_RISCV_D22: - return "d22"; - case UNW_RISCV_D23: - return "d23"; - case UNW_RISCV_D24: - return "d24"; - case UNW_RISCV_D25: - return "d25"; - case UNW_RISCV_D26: - return "d26"; - case UNW_RISCV_D27: - return "d27"; - case UNW_RISCV_D28: - return "d28"; - case UNW_RISCV_D29: - return "d29"; - case UNW_RISCV_D30: - return "d30"; - case UNW_RISCV_D31: - return "d31"; - default: - return "unknown register"; - } -} - -inline bool Registers_riscv::validFloatRegister(int regNum) const { - if (regNum < UNW_RISCV_D0) - return false; - if (regNum > UNW_RISCV_D31) - return false; - return true; -} - -inline double Registers_riscv::getFloatRegister(int regNum) const { - assert(validFloatRegister(regNum)); - return _vectorHalfRegisters[regNum - UNW_RISCV_D0]; -} - -inline void Registers_riscv::setFloatRegister(int regNum, double value) { - assert(validFloatRegister(regNum)); - _vectorHalfRegisters[regNum - UNW_RISCV_D0] = value; -} - -inline bool Registers_riscv::validVectorRegister(int) const { - return false; -} - -inline v128 Registers_riscv::getVectorRegister(int) const { - _LIBUNWIND_ABORT("no riscv vector register support yet"); -} - -inline void Registers_riscv::setVectorRegister(int, v128) { - _LIBUNWIND_ABORT("no riscv vector register support yet"); -} +#endif // _LIBUNWIND_TARGET_PPC +#if defined(_LIBUNWIND_TARGET_AARCH64) /// Registers_arm64 holds the register state of a thread in a 64-bit arm /// process. class _LIBUNWIND_HIDDEN Registers_arm64 { @@ -1329,8 +1078,8 @@ private: }; inline Registers_arm64::Registers_arm64(const void *registers) { - static_assert(sizeof(Registers_arm64) < sizeof(unw_context_t), - "arm64 registers do not fit into unw_context_t"); + static_assert((check_fit::does_fit), + "arm64 registers do not fit into unw_context_t"); memcpy(&_registers, registers, sizeof(_registers)); static_assert(sizeof(GPRs) == 0x110, "expected VFP registers to be at offset 272"); @@ -1547,7 +1296,9 @@ inline v128 Registers_arm64::getVectorRe inline void Registers_arm64::setVectorRegister(int, v128) { _LIBUNWIND_ABORT("no arm64 vector register support yet"); } +#endif // _LIBUNWIND_TARGET_AARCH64 +#if defined(_LIBUNWIND_TARGET_ARM) /// Registers_arm holds the register state of a thread in a 32-bit arm /// process. /// @@ -1653,8 +1404,8 @@ inline Registers_arm::Registers_arm(cons _saved_vfp_d16_d31(false), _saved_iwmmx(false), _saved_iwmmx_control(false) { - static_assert(sizeof(Registers_arm) < sizeof(unw_context_t), - "arm registers do not fit into unw_context_t"); + static_assert((check_fit::does_fit), + "arm registers do not fit into unw_context_t"); // See unw_getcontext() note about data. memcpy(&_registers, registers, sizeof(_registers)); memset(&_vfp_d0_d15_pad, 0, sizeof(_vfp_d0_d15_pad)); @@ -1969,6 +1720,10 @@ inline v128 Registers_arm::getVectorRegi inline void Registers_arm::setVectorRegister(int, v128) { _LIBUNWIND_ABORT("ARM vector support not implemented"); } +#endif // _LIBUNWIND_TARGET_ARM + + +#if defined(_LIBUNWIND_TARGET_OR1K) /// Registers_or1k holds the register state of a thread in an OpenRISC1000 /// process. class _LIBUNWIND_HIDDEN Registers_or1k { @@ -2003,8 +1758,8 @@ private: }; inline Registers_or1k::Registers_or1k(const void *registers) { - static_assert(sizeof(Registers_or1k) < sizeof(unw_context_t), - "or1k registers do not fit into unw_context_t"); + static_assert((check_fit::does_fit), + "or1k registers do not fit into unw_context_t"); memcpy(&_registers, static_cast(registers), sizeof(_registers)); } @@ -2151,6 +1906,268 @@ inline const char *Registers_or1k::getRe } } +#endif // _LIBUNWIND_TARGET_OR1K + + +#if defined(_LIBUNWIND_TARGET_RISCV) +/// Registers_riscv holds the register state of a thread in a 64-bit RISC-V +/// process. +class _LIBUNWIND_HIDDEN Registers_riscv { +public: + Registers_riscv(); + Registers_riscv(const void *registers); + + bool validRegister(int num) const; + uint64_t getRegister(int num) const; + void setRegister(int num, uint64_t value); + bool validFloatRegister(int num) const; + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); + bool validVectorRegister(int num) const; + v128 getVectorRegister(int num) const; + void setVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + void jumpto(); + static int lastDwarfRegNum() { return 95; } + + uint64_t getSP() const { return _registers.__x[2]; } + void setSP(uint64_t value) { _registers.__x[2] = value; } + uint64_t getIP() const { return _registers.__x[1]; } + void setIP(uint64_t value) { _registers.__x[1] = value; } + +private: + struct GPRs { + uint64_t __x[32]; // x0-x31 + }; + + GPRs _registers; + double _vectorHalfRegisters[32]; + // Currently only the lower double in 128-bit vectore registers + // is perserved during unwinding. We could define new register + // numbers (> 96) which mean whole vector registers, then this + // struct would need to change to contain whole vector registers. +}; + +inline Registers_riscv::Registers_riscv(const void *registers) { + static_assert((check_fit::does_fit), + "riscv registers do not fit into unw_context_t"); + memcpy(&_registers, registers, sizeof(_registers)); + static_assert(sizeof(GPRs) == 0x100, + "expected VFP registers to be at offset 256"); + memcpy(_vectorHalfRegisters, + static_cast(registers) + sizeof(GPRs), + sizeof(_vectorHalfRegisters)); +} + +inline Registers_riscv::Registers_riscv() { + memset(&_registers, 0, sizeof(_registers)); + memset(&_vectorHalfRegisters, 0, sizeof(_vectorHalfRegisters)); +} + +inline bool Registers_riscv::validRegister(int regNum) const { + if (regNum == UNW_REG_IP) + return true; + if (regNum == UNW_REG_SP) + return true; + if (regNum < 0) + return false; + if (regNum > 95) + return false; + if ((regNum > 31) && (regNum < 64)) + return false; + return true; +} + +inline uint64_t Registers_riscv::getRegister(int regNum) const { + if (regNum == UNW_REG_IP) + return _registers.__x[1]; + if (regNum == UNW_REG_SP) + return _registers.__x[2]; + if ((regNum >= 0) && (regNum < 32)) + return _registers.__x[regNum]; + _LIBUNWIND_ABORT("unsupported riscv register"); +} + +inline void Registers_riscv::setRegister(int regNum, uint64_t value) { + if (regNum == UNW_REG_IP) + _registers.__x[1] = value; + else if (regNum == UNW_REG_SP) + _registers.__x[2] = value; + else if ((regNum >= 0) && (regNum < 32)) + _registers.__x[regNum] = value; + else + _LIBUNWIND_ABORT("unsupported riscv register"); +} + +inline const char *Registers_riscv::getRegisterName(int regNum) { + switch (regNum) { + case UNW_REG_IP: + return "ra"; + case UNW_REG_SP: + return "sp"; + case UNW_RISCV_X0: + return "x0"; + case UNW_RISCV_X1: + return "ra"; + case UNW_RISCV_X2: + return "sp"; + case UNW_RISCV_X3: + return "x3"; + case UNW_RISCV_X4: + return "x4"; + case UNW_RISCV_X5: + return "x5"; + case UNW_RISCV_X6: + return "x6"; + case UNW_RISCV_X7: + return "x7"; + case UNW_RISCV_X8: + return "x8"; + case UNW_RISCV_X9: + return "x9"; + case UNW_RISCV_X10: + return "x10"; + case UNW_RISCV_X11: + return "x11"; + case UNW_RISCV_X12: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@freebsd.org Fri Jul 15 16:37:37 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0BF3B990C2 for ; Fri, 15 Jul 2016 16:37:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90FA31CE7; Fri, 15 Jul 2016 16:37:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FGbaRk024172; Fri, 15 Jul 2016 16:37:36 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FGbaNu024171; Fri, 15 Jul 2016 16:37:36 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201607151637.u6FGbaNu024171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 15 Jul 2016 16:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r302905 - projects/mips64-clang/sys/boot/mips X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 16:37:37 -0000 Author: sbruno Date: Fri Jul 15 16:37:36 2016 New Revision: 302905 URL: https://svnweb.freebsd.org/changeset/base/302905 Log: beri boot loader doesn't build with clang external toolchain. Disable it for the "if gcc && mips64" case. Modified: projects/mips64-clang/sys/boot/mips/Makefile Modified: projects/mips64-clang/sys/boot/mips/Makefile ============================================================================== --- projects/mips64-clang/sys/boot/mips/Makefile Fri Jul 15 15:55:36 2016 (r302904) +++ projects/mips64-clang/sys/boot/mips/Makefile Fri Jul 15 16:37:36 2016 (r302905) @@ -2,6 +2,10 @@ .include # +# clang is unable to compile this uboot code at this time +.if ${COMPILER_TYPE} == "gcc" +SUBDIR+= uboot +# # The BERI boot loader port works only on 64-bit MIPS; not a hard port to # 32-bit if someone is interested. Build on all 64-bit MIPS platforms to # ensure it gets adequate build-test coverage. @@ -9,11 +13,6 @@ .if ${MACHINE_ARCH} == "mips64" SUBDIR+= beri .endif - -# -# clang is unable to compile this uboot code at this time -.if ${COMPILER_TYPE} == "gcc" -SUBDIR+= uboot .endif .include