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 ***