CVS commit: [matt-nb8-mediatek] src/sys/external/gpl2/dts/dist/arch/arm/boot/dts

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:33:19 UTC 2017

Added Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts [matt-nb8-mediatek]:
mtkatlas.dts mtkmercury.dtsi

Log Message:
DTS files for the Mediatek ATLAS board


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkatlas.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkmercury.dtsi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/external/gpl2/dts/dist/arch/arm/boot/dts

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:33:19 UTC 2017

Added Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts [matt-nb8-mediatek]:
mtkatlas.dts mtkmercury.dtsi

Log Message:
DTS files for the Mediatek ATLAS board


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkatlas.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkmercury.dtsi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkatlas.dts
diff -u /dev/null src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkatlas.dts:1.1.2.1
--- /dev/null	Wed Dec 13 01:33:19 2017
+++ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mtkatlas.dts	Wed Dec 13 01:33:19 2017
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2014-2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+#include "mtkmercury.dtsi"
+
+/ {
+	memory@ {
+		device_type = "memory";
+		reg = <0 0x4000 0 0x1800>;
+	};
+
+	aliases {
+		serial0 = 
+	};
+
+	/* chosen */
+	chosen {
+		stdout-path = "serial0:921600n8";
+	};
+};
+
+
+/* reg = <0 0x4000 0 0x2000>; */
+/* bootargs = "console=ttyS0,921600n1 root=/dev/ram initrd=0x44000200,0x20"; */
+
+ {
+	status = "okay";
+
+	pmic: mt6392 {
+		compatible = "mediatek,mt6392";
+
+		mediatek,system-power-controller;
+
+		mt6392keys: mt6392keys {
+			compatible = "mediatek,mt6392-keys";
+			mediatek,pwrkey-code = <116>;
+			mediatek,homekey-code = <114>;
+			mediatek,long-press-mode = <0>;
+			mediatek,long-press-duration = <0>;
+		};
+
+		mt6392pmic: mt6392pmic {
+			compatible = "mediatek,mt6392-pmic";
+		};
+
+		mt6392regulator: mt6392regulator {
+			compatible = "mediatek,mt6392-regulator";
+
+			mt6392_vproc_reg: buck_vproc {
+regulator-name = "vproc";
+regulator-min-microvolt = < 70>;
+regulator-max-microvolt = <135>;
+regulator-ramp-delay = <12500>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vsys_reg: buck_vsys {
+regulator-name = "vsys";
+regulator-min-microvolt = <140>;
+regulator-max-microvolt = <2987500>;
+regulator-ramp-delay = <25000>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vcore_reg: buck_vcore {
+regulator-name = "vcore";
+regulator-min-microvolt = < 70>;
+regulator-max-microvolt = <135>;
+regulator-ramp-delay = <12500>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vxo22_reg: ldo_vxo22 {
+regulator-name = "vxo22";
+regulator-min-microvolt = <220>;
+regulator-max-microvolt = <220>;
+regulator-enable-ramp-delay = <110>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vaud22_reg: ldo_vaud22 {
+regulator-name = "vaud22";
+regulator-min-microvolt = <180>;
+regulator-max-microvolt = <220>;
+regulator-enable-ramp-delay = <264>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vcama_reg: ldo_vcama {
+regulator-name = "vcama";
+regulator-min-microvolt = <280>;
+regulator-max-microvolt = <280>;
+regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vaud28_reg: ldo_vaud28 {
+regulator-name = "vaud28";
+regulator-min-microvolt = <280>;
+regulator-max-microvolt = <280>;
+regulator-enable-ramp-delay = <264>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vadc18_reg: ldo_vadc18 {
+regulator-name = "vadc18";
+regulator-min-microvolt = <180>;
+regulator-max-microvolt = <180>;
+regulator-enable-ramp-delay = <264>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vcn35_reg: ldo_vcn35 {
+regulator-name = "vcn35";
+regulator-min-microvolt = <330>;
+regulator-max-microvolt = <360>;
+regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vio28_reg: ldo_vio28 {
+regulator-name = "vio28";
+regulator-min-microvolt = <280>;
+regulator-max-microvolt = <280>;
+regulator-enable-ramp-delay = <264>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vusb_reg: ldo_vusb {
+regulator-name = "vusb";
+regulator-min-microvolt = <330>;
+regulator-max-microvolt = <330>;
+regulator-enable-ramp-delay = <264>;
+regulator-always-on;
+regulator-boot-on;
+			};
+
+			mt6392_vmc_reg: ldo_vmc {
+regulator-name = "vmc";
+regulator-min-microvolt = <180>;
+regulator-max-microvolt = 

CVS commit: [matt-nb8-mediatek] src/etc/etc.evbarm

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:25:47 UTC 2017

Modified Files:
src/etc/etc.evbarm [matt-nb8-mediatek]: Makefile.inc

Log Message:
Build MTKATLAS


To generate a diff of this commit:
cvs rdiff -u -r1.81.6.3 -r1.81.6.3.2.1 src/etc/etc.evbarm/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.81.6.3 src/etc/etc.evbarm/Makefile.inc:1.81.6.3.2.1
--- src/etc/etc.evbarm/Makefile.inc:1.81.6.3	Fri Aug 25 14:38:31 2017
+++ src/etc/etc.evbarm/Makefile.inc	Wed Dec 13 01:25:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.81.6.3 2017/08/25 14:38:31 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.81.6.3.2.1 2017/12/13 01:25:47 matt Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -109,6 +109,8 @@ EVBARM_BOARDS.armv7+=		KOBO
 EVBARM_BOARDS.armv7hf+= 	KOBO
 EVBARM_BOARDS.armv7+=		MIRABOX
 EVBARM_BOARDS.armv7hf+=		MIRABOX
+EVBARM_BOARDS.armv7+=		MTKATLAS
+EVBARM_BOARDS.armv7hf+=		MTKATLAS
 #EVBARM_BOARDS.armv7+=		N900
 EVBARM_BOARDS.armv7+=		NETWALKER
 EVBARM_BOARDS.armv7hf+=		NETWALKER



CVS commit: [matt-nb8-mediatek] src/etc/etc.evbarm

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:25:47 UTC 2017

Modified Files:
src/etc/etc.evbarm [matt-nb8-mediatek]: Makefile.inc

Log Message:
Build MTKATLAS


To generate a diff of this commit:
cvs rdiff -u -r1.81.6.3 -r1.81.6.3.2.1 src/etc/etc.evbarm/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/evbarm/conf

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:24:08 UTC 2017

Added Files:
src/sys/arch/evbarm/conf [matt-nb8-mediatek]: MTKATLAS MTKATLAS_INSTALL
files.mtkatlas mk.mtkatlas std.mtkatlas

Log Message:
Add Mediatek ATLAS configury


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/evbarm/conf/MTKATLAS \
src/sys/arch/evbarm/conf/MTKATLAS_INSTALL \
src/sys/arch/evbarm/conf/files.mtkatlas \
src/sys/arch/evbarm/conf/mk.mtkatlas \
src/sys/arch/evbarm/conf/std.mtkatlas

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/evbarm/conf

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:24:08 UTC 2017

Added Files:
src/sys/arch/evbarm/conf [matt-nb8-mediatek]: MTKATLAS MTKATLAS_INSTALL
files.mtkatlas mk.mtkatlas std.mtkatlas

Log Message:
Add Mediatek ATLAS configury


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/evbarm/conf/MTKATLAS \
src/sys/arch/evbarm/conf/MTKATLAS_INSTALL \
src/sys/arch/evbarm/conf/files.mtkatlas \
src/sys/arch/evbarm/conf/mk.mtkatlas \
src/sys/arch/evbarm/conf/std.mtkatlas

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/evbarm/conf/MTKATLAS
diff -u /dev/null src/sys/arch/evbarm/conf/MTKATLAS:1.1.2.1
--- /dev/null	Wed Dec 13 01:24:08 2017
+++ src/sys/arch/evbarm/conf/MTKATLAS	Wed Dec 13 01:24:08 2017
@@ -0,0 +1,159 @@
+# $NetBSD: MTKATLAS,v 1.1.2.1 2017/12/13 01:24:08 matt Exp $
+#
+#	MTK ATLAS board
+#
+
+include	"arch/evbarm/conf/std.mtkatlas"
+include	"arch/evbarm/conf/GENERIC.common"
+
+makeoptions	DTS="
+	mtkatlas.dts
+"
+
+no makeoptions	CPUFLAGS
+makeoptions	CPUFLAGS="-mcpu=cortex-a7 -mfpu=neon"
+#no makeoptions	BOARDTYPE
+#makeoptions	BOARDTYPE="mtkatlas"
+#no makeoptions	KERNEL_BASE_PHYS
+#no makeoptions	KERNEL_BASE_VIRT
+#makeoptions 	KERNEL_BASE_PHYS="0x4010"
+#makeoptions 	KERNEL_BASE_VIRT="0x8010"
+#options 	PMAP_NEED_ALLOC_POOLPAGE
+options 	CPU_CORTEXA7
+options 	CPU_CORTEXA35
+
+options 	MULTIPROCESSOR
+options 	MEMSIZE=384
+options 	MTK_CONSOLE_EARLY
+options 	MTK_MERCURY	# MTK chipname
+
+pseudo-device 	openfirm	# /dev/openfirm
+
+#options 	DEBUG
+options 	VERBOSE_INIT_ARM # verbose bootstraping messages
+makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	COPY_SYMTAB=1
+
+## USB Debugging options
+options USB_DEBUG
+options MOTG_DEBUG
+options UMASS_DEBUG
+options UHUB_DEBUG
+options KERNHIST_PRINT
+
+config		netbsd		root on ? type ?
+
+# Device tree support
+armfdt0		at root
+fdt*		at fdtbus?
+
+# PMIC Pwrap
+mtkpwrap*	at fdt?
+pwrap0		at mtkpwrap?
+mt6392pmic*	at pwrap0
+mt6392reg*	at mt6392pmic?
+
+# CPUs
+cpus*		at fdt? pass 0
+cpu*		at cpus?
+
+# Power state coordination interface
+psci*		at fdt?
+
+# Timer
+gtmr*		at fdt? pass 1		# ARM Generic Timer
+armgtmr0	at gtmr?
+
+# Interrupt controller
+gic*		at fdt? pass 1		# GIC
+armgic0		at gic?
+
+# UART
+com*		at fdt?			# UART
+options 	CONADDR=0x11005000, CONSPEED=921600
+
+# SPI controller
+mtkspi0		at fdt?
+spi* 		at spibus?
+
+#spidev0 at spi? slave 0 flags 0
+
+# PWM
+mtkpwm*at fdt?
+
+# MMC/SD controllers
+mtkmmc0		at fdt? 
+sdmmc0		at mtkmmc0
+ld0			at sdmmc0
+
+# GPIO controller
+mtkgpio*	at fdt?
+
+# External interrupt controller
+eint*		at fdt?
+
+# On-board I2C busses
+mtki2c0		at fdt? 			# I2C0
+iic0		at mtki2c0
+seeprom0	at iic0 addr 0x50
+
+mtki2c1		at fdt? 			# I2C1
+iic1		at mtki2c1
+seeprom1	at iic1 addr 0x50
+
+mtki2c2		at fdt? 			# I2C2
+iic2		at mtki2c2
+seeprom2	at iic2 addr 0x50
+
+# SCSI bus support
+scsibus* at scsi?
+
+# SCSI devices
+sd*	at scsibus? target ? lun ?	# SCSI disk drives
+st*	at scsibus? target ? lun ?	# SCSI tape drives
+cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
+ch*	at scsibus? target ? lun ?	# SCSI autochangers
+ses*	at scsibus? target ? lun ?	# SCSI Enclosure Services devices
+ss*	at scsibus? target ? lun ?	# SCSI scanners
+uk*	at scsibus? target ? lun ?	# SCSI unknown
+
+# On-board MUSB 2.0 phy Port0
+usbphy*		at fdt?
+
+# On-board MUSB 2.0 Port0
+motg*		at fdt?
+
+usb*	at motg?
+
+# USB Hubs
+uhub*	at usb?
+uhub*	at uhub? port ?
+
+# USB HID device
+uhidev*	at uhub? port ? configuration ? interface ?
+# USB Mice
+ums*	at uhidev? reportid ?
+wsmouse* at ums? mux 0
+
+# USB Keyboards
+ukbd*	at uhidev? reportid ?
+wskbd*	at ukbd? console ? mux 1
+
+# USB serial adapter
+ucycom*	at uhidev? reportid ?
+
+# USB Generic HID devices
+uhid*	at uhidev? reportid ?
+
+# USB Mass Storage
+umass*	at uhub? port ? configuration ? interface ?
+wd* at umass?
+
+# Prolific PL2301/PL2302 host-to-host adapter
+upl*	at uhub? port ?
+
+# USB Generic driver
+ugen*	at uhub? port ?
+
+pseudo-device 	wsmux
+pseudo-device 	wsfont
Index: src/sys/arch/evbarm/conf/MTKATLAS_INSTALL
diff -u /dev/null src/sys/arch/evbarm/conf/MTKATLAS_INSTALL:1.1.2.1
--- /dev/null	Wed Dec 13 01:24:08 2017
+++ src/sys/arch/evbarm/conf/MTKATLAS_INSTALL	Wed Dec 13 01:24:08 2017
@@ -0,0 +1,10 @@
+# $NetBSD: MTKATLAS_INSTALL,v 1.1.2.1 2017/12/13 01:24:08 matt Exp $
+#
+#	installation-sized ramdisk
+#
+
+include "arch/evbarm/conf/MTKATLAS"
+include "arch/evbarm/conf/INSTALL"
+
+options 	BOOTHOWTO=RB_SINGLE
+#makeoption 	DEBUG
Index: src/sys/arch/evbarm/conf/files.mtkatlas
diff -u /dev/null src/sys/arch/evbarm/conf/files.mtkatlas:1.1.2.1
--- /dev/null	Wed Dec 13 01:24:08 2017
+++ src/sys/arch/evbarm/conf/files.mtkatlas	Wed Dec 13 01:24:08 2017
@@ -0,0 +1,9 @@
+# $NetBSD: files.mtkatlas,v 1.1.2.1 2017/12/13 01:24:08 matt Exp $
+#
+# Mediatek 

CVS commit: [matt-nb8-mediatek] src/sys/arch/evbarm/mediatek

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:22:35 UTC 2017

Added Files:
src/sys/arch/evbarm/mediatek [matt-nb8-mediatek]: genassym.cf
mtk_start.S platform.h

Log Message:
Add Mediatek ATLAS support


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/evbarm/mediatek/genassym.cf \
src/sys/arch/evbarm/mediatek/mtk_start.S \
src/sys/arch/evbarm/mediatek/platform.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/evbarm/mediatek

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:22:35 UTC 2017

Added Files:
src/sys/arch/evbarm/mediatek [matt-nb8-mediatek]: genassym.cf
mtk_start.S platform.h

Log Message:
Add Mediatek ATLAS support


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/evbarm/mediatek/genassym.cf \
src/sys/arch/evbarm/mediatek/mtk_start.S \
src/sys/arch/evbarm/mediatek/platform.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/evbarm/mediatek/genassym.cf
diff -u /dev/null src/sys/arch/evbarm/mediatek/genassym.cf:1.1.2.1
--- /dev/null	Wed Dec 13 01:22:35 2017
+++ src/sys/arch/evbarm/mediatek/genassym.cf	Wed Dec 13 01:22:35 2017
@@ -0,0 +1,38 @@
+# $NetBSD: genassym.cf,v 1.1.2.1 2017/12/13 01:22:35 matt Exp $
+
+#-
+# Copyright (c) 2013 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Matt Thomas of 3am Software Foundry.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+include 
+include 
+
+define	LSR_TXRDY		LSR_TXRDY
+define	LSR_TSRE		LSR_TSRE
+define	COM_DATA		com_data
+define	COM_LSR			com_lsr
Index: src/sys/arch/evbarm/mediatek/mtk_start.S
diff -u /dev/null src/sys/arch/evbarm/mediatek/mtk_start.S:1.1.2.1
--- /dev/null	Wed Dec 13 01:22:35 2017
+++ src/sys/arch/evbarm/mediatek/mtk_start.S	Wed Dec 13 01:22:35 2017
@@ -0,0 +1,188 @@
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "opt_mtk.h"
+#include "opt_com.h"
+#include "opt_cpuoptions.h"
+#include "opt_cputypes.h"
+#include "opt_multiprocessor.h"
+#include "opt_arm_debug.h"
+#include "opt_fdt_arm.h"
+
+#include 
+#include 
+#include "assym.h"
+
+#include 
+#include 
+
+RCSID("$NetBSD: mtk_start.S,v 1.1.2.1 2017/12/13 01:22:35 matt Exp $")
+
+#if defined(VERBOSE_INIT_ARM)
+#define	XPUTC(n)	mov r0, n; bl xputc
+#if KERNEL_BASE_VOFFSET == 0
+#define	XPUTC2(n)	mov r0, n; bl xputc
+#else
+#define XPUTC2(n)	mov r0, n; blx r11
+#endif
+#ifdef __ARMEB__
+#define COM_BSWAP
+#endif
+#define COM_MULT	4
+#define X

CVS commit: [matt-nb8-mediatek] src/sys/arch/evbarm/conf

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:07:43 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf [matt-nb8-mediatek]: mk.sunxi

Log Message:
Deal with compiler options in the source itself


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.2 -r1.1.4.2.2.1 src/sys/arch/evbarm/conf/mk.sunxi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/evbarm/conf

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:07:43 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf [matt-nb8-mediatek]: mk.sunxi

Log Message:
Deal with compiler options in the source itself


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.2 -r1.1.4.2.2.1 src/sys/arch/evbarm/conf/mk.sunxi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/mk.sunxi
diff -u src/sys/arch/evbarm/conf/mk.sunxi:1.1.4.2 src/sys/arch/evbarm/conf/mk.sunxi:1.1.4.2.2.1
--- src/sys/arch/evbarm/conf/mk.sunxi:1.1.4.2	Tue Jul 18 19:13:09 2017
+++ src/sys/arch/evbarm/conf/mk.sunxi	Wed Dec 13 01:07:43 2017
@@ -1,11 +1,8 @@
-#	$NetBSD: mk.sunxi,v 1.1.4.2 2017/07/18 19:13:09 snj Exp $
+#	$NetBSD: mk.sunxi,v 1.1.4.2.2.1 2017/12/13 01:07:43 matt Exp $
 
 SYSTEM_FIRST_OBJ=	sunxi_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/sunxi/sunxi_start.S
 
-AFLAGS.sunxi_start.S+=	-Wa,-march=armv7-a+virt
-AFLAGS.psci_arm.S+=	-Wa,-march=armv7-a+sec+virt
-
 GENASSYM_EXTRAS+=	${THISARM}/sunxi/genassym.cf
 
 _OSRELEASE!=		${HOST_SH} $S/conf/osrelease.sh



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/mediatek

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:06:02 UTC 2017

Added Files:
src/sys/arch/arm/mediatek [matt-nb8-mediatek]: files.mtk
mercury_ethreg.h mercury_intr.h mercury_reg.h mtk_com.c mtk_eint.c
mtk_eint.h mtk_gpio.c mtk_gpio.h mtk_i2c.c mtk_mmc.c mtk_musb.c
mtk_musb.h mtk_platform.c mtk_pwm.c mtk_pwm.h mtk_pwrap.c
mtk_pwrap.h mtk_spi.c mtk_usbphy.c

Log Message:
Initial import of Mediatek written drivers and board support for Atlas board.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/arm/mediatek/files.mtk \
src/sys/arch/arm/mediatek/mercury_ethreg.h \
src/sys/arch/arm/mediatek/mercury_intr.h \
src/sys/arch/arm/mediatek/mercury_reg.h \
src/sys/arch/arm/mediatek/mtk_com.c src/sys/arch/arm/mediatek/mtk_eint.c \
src/sys/arch/arm/mediatek/mtk_eint.h src/sys/arch/arm/mediatek/mtk_gpio.c \
src/sys/arch/arm/mediatek/mtk_gpio.h src/sys/arch/arm/mediatek/mtk_i2c.c \
src/sys/arch/arm/mediatek/mtk_mmc.c src/sys/arch/arm/mediatek/mtk_musb.c \
src/sys/arch/arm/mediatek/mtk_musb.h \
src/sys/arch/arm/mediatek/mtk_platform.c \
src/sys/arch/arm/mediatek/mtk_pwm.c src/sys/arch/arm/mediatek/mtk_pwm.h \
src/sys/arch/arm/mediatek/mtk_pwrap.c \
src/sys/arch/arm/mediatek/mtk_pwrap.h src/sys/arch/arm/mediatek/mtk_spi.c \
src/sys/arch/arm/mediatek/mtk_usbphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/cortex

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:04:52 UTC 2017

Modified Files:
src/sys/arch/arm/cortex [matt-nb8-mediatek]: a9_mpsubr.S

Log Message:
Add Cortex-A35 and make VIRT support simplier


To generate a diff of this commit:
cvs rdiff -u -r1.47.8.1 -r1.47.8.1.2.1 src/sys/arch/arm/cortex/a9_mpsubr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.47.8.1 src/sys/arch/arm/cortex/a9_mpsubr.S:1.47.8.1.2.1
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.47.8.1	Thu Jul  6 05:28:43 2017
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Wed Dec 13 01:04:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.47.8.1 2017/07/06 05:28:43 martin Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.47.8.1.2.1 2017/12/13 01:04:52 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,7 +39,7 @@
 
 //#define MPDEBUG
 
-// Marco to call routines in .text
+// Macro to call routines in .text
 #if defined(KERNEL_BASES_EQUAL)
 #define CALL(f)		bl	_C_LABEL(f)
 #else
@@ -50,6 +50,12 @@
 	blx	ip
 #endif
 
+#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17) \
+|| defined(CPU_CORTEXA35)
+	.arch		armv7a
+	.arch_extension	virt
+#define CPU_CORTEXVIRT
+#endif
 
 // We'll modify va and pa at run time so we can use relocatable addresses.
 #define MMU_INIT(va,pa,n_sec,attr) \
@@ -162,7 +168,8 @@ arm_boot_l1pt_init:
 // bits to clear in the Control Register
 //
 #define CPU_CONTROL_CLR \
-	(CPU_CONTROL_AFLT_ENABLE_CLR)
+	(CPU_CONTROL_AFLT_ENABLE_CLR	|	\
+	 CPU_CONTROL_TR_ENABLE)
 
 arm_cpuinit:
 	// Because the MMU may already be on do a typical sequence to set
@@ -249,9 +256,7 @@ arm_cpuinit:
 	movt	r3, #:upper16:CPU_CONTROL_SET
 #endif
 	orr	r0, r1, r3
-#if defined(CPU_CONTROL_CLR) && (CPU_CONTROL_CLR != 0)
 	bic	r0, r0, #CPU_CONTROL_CLR
-#endif
 	//cmp	r0, r1			// any changes to SCTLR?
 	//bxeq	ip			//no, then return.
 
@@ -347,17 +352,19 @@ xputc:
 cortex_init:
 	mov	r10, lr// save lr
 
-#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17)
+#if defined(CPU_CORTEXVIRT)
 	/* Leave HYP mode and move into supervisor mode with IRQs/FIQs disabled. */
 	mrs	r0, cpsr
-	and	r0, r0, #(PSR_MODE)	/* Mode is in the low 5 bits of CPSR */
-	teq	r0, #(PSR_HYP32_MODE)	/* Hyp Mode? */
+	and	r1, r0, #(PSR_MODE)	/* Mode is in the low 5 bits of CPSR */
+	teq	r1, #(PSR_HYP32_MODE)	/* Hyp Mode? */
 	bne	1f
 
+	/* Set CNTVOFF to 0 */
+	mov	r1, #0
+	mcrr	p15, 4, r1, r1, c14
+
 	/* Ensure that IRQ, and FIQ will be disabled after eret */
-	mrs	r0, cpsr
-	bic	r0, r0, #(PSR_MODE)
-	orr	r0, r0, #(PSR_SVC32_MODE)
+	eor	r0, r0, #(PSR_SVC32_MODE^PSR_HYP32_MODE)
 	orr	r0, r0, #(I32_bit | F32_bit)
 	msr	spsr_cxsf, r0
 	/* Exit hypervisor mode */



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/cortex

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:04:52 UTC 2017

Modified Files:
src/sys/arch/arm/cortex [matt-nb8-mediatek]: a9_mpsubr.S

Log Message:
Add Cortex-A35 and make VIRT support simplier


To generate a diff of this commit:
cvs rdiff -u -r1.47.8.1 -r1.47.8.1.2.1 src/sys/arch/arm/cortex/a9_mpsubr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/cortex

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:03:41 UTC 2017

Modified Files:
src/sys/arch/arm/cortex [matt-nb8-mediatek]: armperiph.c

Log Message:
Add Cortex-A35 devices


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.6.1 src/sys/arch/arm/cortex/armperiph.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/armperiph.c
diff -u src/sys/arch/arm/cortex/armperiph.c:1.11 src/sys/arch/arm/cortex/armperiph.c:1.11.6.1
--- src/sys/arch/arm/cortex/armperiph.c:1.11	Fri May 26 21:17:46 2017
+++ src/sys/arch/arm/cortex/armperiph.c	Wed Dec 13 01:03:41 2017
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: armperiph.c,v 1.11 2017/05/26 21:17:46 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: armperiph.c,v 1.11.6.1 2017/12/13 01:03:41 matt Exp $");
 
 #include 
 #include 
@@ -106,6 +106,14 @@ static const struct armperiph_info a17_d
 };
 #endif
 
+#ifdef CPU_CORTEXA35
+static const struct armperiph_info a35_devices[] = {
+	{ "armgic",  0, 0x4000 },
+	{ "armgtmr", 0, 0 },
+	{ "", 0, 0 },
+};
+#endif
+
 #ifdef CPU_CORTEXA57
 static const struct armperiph_info a57_devices[] = {
 	{ "armgic",  0x1000, 0x2000 },
@@ -135,6 +143,9 @@ static const struct mpcore_config {
 #ifdef CPU_CORTEXA17
 	{ a17_devices, 0x410fc0e0, 8*4096 },
 #endif
+#ifdef CPU_CORTEXA35
+	{ a35_devices, 0x410fd040, 8*4096 },
+#endif
 #ifdef CPU_CORTEXA57
 	{ a57_devices, 0x410fd070, 8*4096 },
 #endif



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/cortex

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:03:41 UTC 2017

Modified Files:
src/sys/arch/arm/cortex [matt-nb8-mediatek]: armperiph.c

Log Message:
Add Cortex-A35 devices


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.6.1 src/sys/arch/arm/cortex/armperiph.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/conf

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:01:07 UTC 2017

Modified Files:
src/sys/arch/arm/conf [matt-nb8-mediatek]: files.arm

Log Message:
Add a few more Cortex (A35, etc.)


To generate a diff of this commit:
cvs rdiff -u -r1.132.2.1 -r1.132.2.1.2.1 src/sys/arch/arm/conf/files.arm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/conf/files.arm
diff -u src/sys/arch/arm/conf/files.arm:1.132.2.1 src/sys/arch/arm/conf/files.arm:1.132.2.1.2.1
--- src/sys/arch/arm/conf/files.arm:1.132.2.1	Tue Jul 18 19:13:08 2017
+++ src/sys/arch/arm/conf/files.arm	Wed Dec 13 01:01:07 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arm,v 1.132.2.1 2017/07/18 19:13:08 snj Exp $
+#	$NetBSD: files.arm,v 1.132.2.1.2.1 2017/12/13 01:01:07 matt Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflagARM32
@@ -50,7 +50,9 @@ defflag	opt_cputypes.h		CPU_CORTEXA8: CP
 defflag	opt_cputypes.h		CPU_CORTEXA9: CPU_CORTEX
 defflag	opt_cputypes.h		CPU_CORTEXA15: CPU_CORTEX
 defflag	opt_cputypes.h		CPU_CORTEXA17: CPU_CORTEX
-defflag opt_cputypes.h		CPU_CORTEXA57: CPU_CORTEX
+defflag	opt_cputypes.h		CPU_CORTEXA35: CPU_CORTEX
+defflag	opt_cputypes.h		CPU_CORTEXA53: CPU_CORTEX
+defflag	opt_cputypes.h		CPU_CORTEXA57: CPU_CORTEX
 defflag	opt_cputypes.h		FPU_VFP
 
 defparam opt_cpuoptions.h	XSCALE_CCLKCFG



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/conf

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:01:07 UTC 2017

Modified Files:
src/sys/arch/arm/conf [matt-nb8-mediatek]: files.arm

Log Message:
Add a few more Cortex (A35, etc.)


To generate a diff of this commit:
cvs rdiff -u -r1.132.2.1 -r1.132.2.1.2.1 src/sys/arch/arm/conf/files.arm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/include

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:00:18 UTC 2017

Modified Files:
src/sys/arch/arm/include [matt-nb8-mediatek]: armreg.h

Log Message:
Add Cortex-A35 definitions


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.111.14.1 src/sys/arch/arm/include/armreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.111 src/sys/arch/arm/include/armreg.h:1.111.14.1
--- src/sys/arch/arm/include/armreg.h:1.111	Tue May 17 08:27:24 2016
+++ src/sys/arch/arm/include/armreg.h	Wed Dec 13 01:00:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.111 2016/05/17 08:27:24 msaitoh Exp $	*/
+/*	$NetBSD: armreg.h,v 1.111.14.1 2017/12/13 01:00:18 matt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -227,6 +227,7 @@
 #define CPU_ID_CORTEXA15R2	0x412fc0f0
 #define CPU_ID_CORTEXA15R3	0x413fc0f0
 #define CPU_ID_CORTEXA17R1	0x411fc0e0
+#define CPU_ID_CORTEXA35R0	0x410fd040
 #define CPU_ID_CORTEXA53R0	0x410fd030
 #define CPU_ID_CORTEXA57R0	0x410fd070
 #define CPU_ID_CORTEXA57R1	0x411fd070
@@ -238,6 +239,7 @@
 #define CPU_ID_CORTEX_A8_P(n)	((n & 0xff0ff0f0) == 0x410fc080)
 #define CPU_ID_CORTEX_A9_P(n)	((n & 0xff0ff0f0) == 0x410fc090)
 #define CPU_ID_CORTEX_A15_P(n)	((n & 0xff0ff0f0) == 0x410fc0f0)
+#define CPU_ID_CORTEX_A35_P(n)	((n & 0xff0ff0f0) == 0x410fd040)
 #define CPU_ID_CORTEX_A53_P(n)	((n & 0xff0ff0f0) == 0x410fd030)
 #define CPU_ID_CORTEX_A57_P(n)	((n & 0xff0ff0f0) == 0x410fd070)
 #define CPU_ID_CORTEX_A72_P(n)	((n & 0xff0ff0f0) == 0x410fd080)



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/include

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 01:00:18 UTC 2017

Modified Files:
src/sys/arch/arm/include [matt-nb8-mediatek]: armreg.h

Log Message:
Add Cortex-A35 definitions


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.111.14.1 src/sys/arch/arm/include/armreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/arm32

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 00:59:12 UTC 2017

Modified Files:
src/sys/arch/arm/arm32 [matt-nb8-mediatek]: cpu.c

Log Message:
Add Cortex A35


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.115.6.1 src/sys/arch/arm/arm32/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/arm32

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 00:59:12 UTC 2017

Modified Files:
src/sys/arch/arm/arm32 [matt-nb8-mediatek]: cpu.c

Log Message:
Add Cortex A35


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.115.6.1 src/sys/arch/arm/arm32/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.115 src/sys/arch/arm/arm32/cpu.c:1.115.6.1
--- src/sys/arch/arm/arm32/cpu.c:1.115	Thu Jun  1 02:45:05 2017
+++ src/sys/arch/arm/arm32/cpu.c	Wed Dec 13 00:59:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.115 2017/06/01 02:45:05 chs Exp $	*/
+/*	$NetBSD: cpu.c,v 1.115.6.1 2017/12/13 00:59:11 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.115 2017/06/01 02:45:05 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.115.6.1 2017/12/13 00:59:11 matt Exp $");
 
 #include 
 #include 
@@ -514,6 +514,8 @@ const struct cpuidtab cpuids[] = {
 	  pN_steppings, "7A" },
 	{ CPU_ID_CORTEXA17R1,	CPU_CLASS_CORTEX,	"Cortex-A17 r1",
 	  pN_steppings, "7A" },
+	{ CPU_ID_CORTEXA35R0,	CPU_CLASS_CORTEX,	"Cortex-A35 r0",
+	  pN_steppings, "8A" },
 	{ CPU_ID_CORTEXA53R0,	CPU_CLASS_CORTEX,	"Cortex-A53 r0",
 	  pN_steppings, "8A" },
 	{ CPU_ID_CORTEXA57R0,	CPU_CLASS_CORTEX,	"Cortex-A57 r0",



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/vfp

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 00:57:58 UTC 2017

Modified Files:
src/sys/arch/arm/vfp [matt-nb8-mediatek]: vfp_init.c

Log Message:
Make the VFP is disabled after disabling it.


To generate a diff of this commit:
cvs rdiff -u -r1.53.2.1 -r1.53.2.1.2.1 src/sys/arch/arm/vfp/vfp_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.53.2.1 src/sys/arch/arm/vfp/vfp_init.c:1.53.2.1.2.1
--- src/sys/arch/arm/vfp/vfp_init.c:1.53.2.1	Tue Oct 24 09:14:59 2017
+++ src/sys/arch/arm/vfp/vfp_init.c	Wed Dec 13 00:57:58 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfp_init.c,v 1.53.2.1 2017/10/24 09:14:59 snj Exp $ */
+/*  $NetBSD: vfp_init.c,v 1.53.2.1.2.1 2017/12/13 00:57:58 matt Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -642,6 +642,7 @@ vfp_setcontext(struct lwp *l, const mcon
 	struct pcb * const pcb = lwp_getpcb(l);
 
 	pcu_discard(_vfp_ops, l, true);
+	KASSERT((pcb->pcb_vfp.vfp_fpexc & VFP_FPEXC_EN) == 0);
 	pcb->pcb_vfp.vfp_fpscr = mcp->__fpu.__vfpregs.__vfp_fpscr;
 	memcpy(pcb->pcb_vfp.vfp_regs, mcp->__fpu.__vfpregs.__vfp_fstmx,
 	sizeof(mcp->__fpu.__vfpregs.__vfp_fstmx));



CVS commit: [matt-nb8-mediatek] src/sys/arch/arm/vfp

2017-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 13 00:57:58 UTC 2017

Modified Files:
src/sys/arch/arm/vfp [matt-nb8-mediatek]: vfp_init.c

Log Message:
Make the VFP is disabled after disabling it.


To generate a diff of this commit:
cvs rdiff -u -r1.53.2.1 -r1.53.2.1.2.1 src/sys/arch/arm/vfp/vfp_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/cortex

2017-11-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Nov 10 22:54:20 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S

Log Message:
Add #define CPU_CORTEDVIRT to reduce copied complex ifdef.
Shrink HYP test


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/arm/cortex/a9_mpsubr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/cortex

2017-11-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Nov 10 22:54:20 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S

Log Message:
Add #define CPU_CORTEDVIRT to reduce copied complex ifdef.
Shrink HYP test


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/arm/cortex/a9_mpsubr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.52 src/sys/arch/arm/cortex/a9_mpsubr.S:1.53
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.52	Sat Nov  4 17:09:55 2017
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Fri Nov 10 22:54:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.52 2017/11/04 17:09:55 skrll Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.53 2017/11/10 22:54:20 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -50,9 +50,11 @@
 	blx	ip
 #endif
 
-#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17)
+#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17) \
+|| defined(CPU_CORTEXA35)
 	.arch		armv7a
-	.arch_extension virt
+	.arch_extension	virt
+#define CPU_CORTEXVIRT
 #endif
 
 // We'll modify va and pa at run time so we can use relocatable addresses.
@@ -350,21 +352,19 @@ xputc:
 cortex_init:
 	mov	r10, lr// save lr
 
-#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17)
+#if defined(CPU_CORTEXVIRT)
 	/* Leave HYP mode and move into supervisor mode with IRQs/FIQs disabled. */
 	mrs	r0, cpsr
-	and	r0, r0, #(PSR_MODE)	/* Mode is in the low 5 bits of CPSR */
-	teq	r0, #(PSR_HYP32_MODE)	/* Hyp Mode? */
+	and	r1, r0, #(PSR_MODE)	/* Mode is in the low 5 bits of CPSR */
+	teq	r1, #(PSR_HYP32_MODE)	/* Hyp Mode? */
 	bne	1f
 
 	/* Set CNTVOFF to 0 */
-	mov	r0, #0
-	mcrr	p15, 4, r0, r0, c14
+	mov	r1, #0
+	mcrr	p15, 4, r1, r1, c14
 
 	/* Ensure that IRQ, and FIQ will be disabled after eret */
-	mrs	r0, cpsr
-	bic	r0, r0, #(PSR_MODE)
-	orr	r0, r0, #(PSR_SVC32_MODE)
+	eor	r0, r0, #(PSR_SVC32_MODE^PSR_HYP32_MODE)
 	orr	r0, r0, #(I32_bit | F32_bit)
 	msr	spsr_cxsf, r0
 	/* Exit hypervisor mode */



CVS commit: src/sys/arch/arm/conf

2017-11-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Nov 10 22:07:30 UTC 2017

Modified Files:
src/sys/arch/arm/conf: files.arm

Log Message:
Add CPU_CORTEXA35


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/arm/conf/files.arm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/conf/files.arm
diff -u src/sys/arch/arm/conf/files.arm:1.135 src/sys/arch/arm/conf/files.arm:1.136
--- src/sys/arch/arm/conf/files.arm:1.135	Sun Oct  8 15:29:33 2017
+++ src/sys/arch/arm/conf/files.arm	Fri Nov 10 22:07:30 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arm,v 1.135 2017/10/08 15:29:33 jmcneill Exp $
+#	$NetBSD: files.arm,v 1.136 2017/11/10 22:07:30 matt Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflagARM32
@@ -50,6 +50,7 @@ defflag	opt_cputypes.h		CPU_CORTEXA8: CP
 defflag	opt_cputypes.h		CPU_CORTEXA9: CPU_CORTEX
 defflag	opt_cputypes.h		CPU_CORTEXA15: CPU_CORTEX
 defflag	opt_cputypes.h		CPU_CORTEXA17: CPU_CORTEX
+defflag	opt_cputypes.h		CPU_CORTEXA35: CPU_CORTEX
 defflag	opt_cputypes.h		CPU_CORTEXA53: CPU_CORTEX
 defflag	opt_cputypes.h		CPU_CORTEXA57: CPU_CORTEX
 defflag	opt_cputypes.h		FPU_VFP



CVS commit: src/sys/arch/arm/conf

2017-11-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Nov 10 22:07:30 UTC 2017

Modified Files:
src/sys/arch/arm/conf: files.arm

Log Message:
Add CPU_CORTEXA35


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/arm/conf/files.arm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2017-11-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov  8 20:24:53 UTC 2017

Modified Files:
src/doc: BRANCHES

Log Message:
Add matt-nb8-mediatek branch


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 src/doc/BRANCHES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm

2017-09-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep 16 00:47:16 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/include: armreg.h

Log Message:
Add Cortex-A35 CPU ID.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/arm/include/armreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm

2017-09-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep 16 00:47:16 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/include: armreg.h

Log Message:
Add Cortex-A35 CPU ID.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/arm/include/armreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.115 src/sys/arch/arm/arm32/cpu.c:1.116
--- src/sys/arch/arm/arm32/cpu.c:1.115	Thu Jun  1 02:45:05 2017
+++ src/sys/arch/arm/arm32/cpu.c	Sat Sep 16 00:47:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.115 2017/06/01 02:45:05 chs Exp $	*/
+/*	$NetBSD: cpu.c,v 1.116 2017/09/16 00:47:16 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.115 2017/06/01 02:45:05 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.116 2017/09/16 00:47:16 matt Exp $");
 
 #include 
 #include 
@@ -514,6 +514,8 @@ const struct cpuidtab cpuids[] = {
 	  pN_steppings, "7A" },
 	{ CPU_ID_CORTEXA17R1,	CPU_CLASS_CORTEX,	"Cortex-A17 r1",
 	  pN_steppings, "7A" },
+	{ CPU_ID_CORTEXA35R0,	CPU_CLASS_CORTEX,	"Cortex-A35 r0",
+	  pN_steppings, "8A" },
 	{ CPU_ID_CORTEXA53R0,	CPU_CLASS_CORTEX,	"Cortex-A53 r0",
 	  pN_steppings, "8A" },
 	{ CPU_ID_CORTEXA57R0,	CPU_CLASS_CORTEX,	"Cortex-A57 r0",

Index: src/sys/arch/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.111 src/sys/arch/arm/include/armreg.h:1.112
--- src/sys/arch/arm/include/armreg.h:1.111	Tue May 17 08:27:24 2016
+++ src/sys/arch/arm/include/armreg.h	Sat Sep 16 00:47:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.111 2016/05/17 08:27:24 msaitoh Exp $	*/
+/*	$NetBSD: armreg.h,v 1.112 2017/09/16 00:47:16 matt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -227,6 +227,7 @@
 #define CPU_ID_CORTEXA15R2	0x412fc0f0
 #define CPU_ID_CORTEXA15R3	0x413fc0f0
 #define CPU_ID_CORTEXA17R1	0x411fc0e0
+#define CPU_ID_CORTEXA35R0	0x410fd040
 #define CPU_ID_CORTEXA53R0	0x410fd030
 #define CPU_ID_CORTEXA57R0	0x410fd070
 #define CPU_ID_CORTEXA57R1	0x411fd070
@@ -238,6 +239,7 @@
 #define CPU_ID_CORTEX_A8_P(n)	((n & 0xff0ff0f0) == 0x410fc080)
 #define CPU_ID_CORTEX_A9_P(n)	((n & 0xff0ff0f0) == 0x410fc090)
 #define CPU_ID_CORTEX_A15_P(n)	((n & 0xff0ff0f0) == 0x410fc0f0)
+#define CPU_ID_CORTEX_A35_P(n)	((n & 0xff0ff0f0) == 0x410fd040)
 #define CPU_ID_CORTEX_A53_P(n)	((n & 0xff0ff0f0) == 0x410fd030)
 #define CPU_ID_CORTEX_A57_P(n)	((n & 0xff0ff0f0) == 0x410fd070)
 #define CPU_ID_CORTEX_A72_P(n)	((n & 0xff0ff0f0) == 0x410fd080)



CVS commit: src/share/mk

2017-01-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 18 02:33:25 UTC 2017

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Resort _MKVARS.no


To generate a diff of this commit:
cvs rdiff -u -r1.1002 -r1.1003 src/share/mk/bsd.own.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1002 src/share/mk/bsd.own.mk:1.1003
--- src/share/mk/bsd.own.mk:1.1002	Tue Jan 10 13:47:18 2017
+++ src/share/mk/bsd.own.mk	Wed Jan 18 02:33:25 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1002 2017/01/10 13:47:18 skrll Exp $
+#	$NetBSD: bsd.own.mk,v 1.1003 2017/01/18 02:33:25 matt Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1094,23 +1094,28 @@ MKARZERO ?= ${MKREPRO}
 
 #
 # MK* options which default to "no".  Note that MKZFS has a different
-# default for some platforms, see above.
+# default for some platforms, see above.  Please keep alphabetically
+# sorted with at most one letter per line.
 #
 _MKVARS.no= \
 	MKARZERO \
 	MKBSDGREP MKBSDTAR \
-	MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \
-	MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \
-	MKKYUA MKLLD MKLLDB MKLINT \
-	MKMANZ MKMCLINKER MKOBJDIRS \
-	MKSLJIT \
-	MKLIBCXX MKLLVM MKNSD MKPCC \
-	MKPIGZGZIP \
-	MKRADEONFIRMWARE \
-	MKREPRO \
-	MKSOFTFLOAT MKSTRIPIDENT MKTPM \
-	MKXORG_SERVER \
-	MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS
+	MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF \
+	MKDEBUG MKDEBUGLIB MKDTRACE \
+	MKEXTSRC \
+	MKGROFFHTMLDOC \
+	MKKYUA \
+	MKLIBCXX MKLLD MKLLDB MKLLVM MKLINT \
+	MKMANZ MKMCLINKER \
+	MKNSD \
+	MKOBJDIRS \
+	MKPCC MKPIGZGZIP \
+	MKRADEONFIRMWARE MKREPRO \
+	MKSLJIT MKSOFTFLOAT MKSTRIPIDENT \
+	MKTPM \
+	MKUNPRIVED MKUPDATE \
+	MKX11 MKX11MOTIF MKXORG_SERVER \
+	MKZFS
 .for var in ${_MKVARS.no}
 ${var}?=	${${var}.${MACHINE_ARCH}:Uno}
 .endfor



CVS commit: src/share/mk

2017-01-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 18 02:33:25 UTC 2017

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Resort _MKVARS.no


To generate a diff of this commit:
cvs rdiff -u -r1.1002 -r1.1003 src/share/mk/bsd.own.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/etc/mtree

2016-11-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 15 22:31:07 UTC 2016

Modified Files:
src/etc/mtree: Makefile

Log Message:
An awk file is not a directory.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/etc/mtree/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/mtree/Makefile
diff -u src/etc/mtree/Makefile:1.35 src/etc/mtree/Makefile:1.36
--- src/etc/mtree/Makefile:1.35	Thu Jun  9 04:26:07 2016
+++ src/etc/mtree/Makefile	Tue Nov 15 22:31:07 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2016/06/09 04:26:07 christos Exp $
+#	$NetBSD: Makefile,v 1.36 2016/11/15 22:31:07 matt Exp $
 
 .include 
 
@@ -58,7 +58,7 @@ NetBSD.dist.xcompat: NetBSD.dist.xcompat
 
 NetBSD.dist.tests.compat: NetBSD.dist.tests mkcompattree.awk 
 	${MKCREATE}
-	${TOOL_AWK} -f ${.ALLSRC:M*.awk}/mkcompattree.awk \
+	${TOOL_AWK} -f ${.ALLSRC:M*.awk} \
 	-v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
 		${.ALLSRC:M*.tests} > ${.TARGET}
 



CVS commit: src/etc/mtree

2016-11-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 15 22:31:07 UTC 2016

Modified Files:
src/etc/mtree: Makefile

Log Message:
An awk file is not a directory.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/etc/mtree/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2016-09-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Sep 16 17:27:10 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
When removing a page, make sure to clear its execness regardless of whether
the page is clean or dirty.  This fixes the problem of execpages leaking
into the freepage lists.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.21 src/sys/uvm/pmap/pmap.c:1.22
--- src/sys/uvm/pmap/pmap.c:1.21	Sat Aug 20 20:09:47 2016
+++ src/sys/uvm/pmap/pmap.c	Fri Sep 16 17:27:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.21 2016/08/20 20:09:47 mrg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.22 2016/09/16 17:27:09 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.21 2016/08/20 20:09:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.22 2016/09/16 17:27:09 matt Exp $");
 
 /*
  *	Manages physical address maps.
@@ -713,6 +713,15 @@ pmap_page_remove(struct vm_page *pg)
 
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
 
+	UVMHIST_LOG(pmapexechist, "pg %p (pa %#"PRIxPADDR")%s: %s",
+	pg, VM_PAGE_TO_PHYS(pg), " [page removed]", "execpage cleared");
+#ifdef PMAP_VIRTUAL_CACHE_ALIASES
+	pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE|VM_PAGEMD_UNCACHED);
+#else
+	pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE);
+#endif
+	PMAP_COUNT(exec_uncached_remove);
+
 	pv_entry_t pv = >mdpg_first;
 	if (pv->pv_pmap == NULL) {
 		VM_PAGEMD_PVLIST_UNLOCK(mdpg);
@@ -800,9 +809,6 @@ pmap_page_remove(struct vm_page *pg)
 		}
 	}
 
-#ifdef PMAP_VIRTUAL_CACHE_ALIASES
-	pmap_page_clear_attributes(mdpg, VM_PAGEMD_UNCACHED);
-#endif
 	pmap_pvlist_check(mdpg);
 	VM_PAGEMD_PVLIST_UNLOCK(mdpg);
 	kpreempt_enable();



CVS commit: src/sys/uvm/pmap

2016-08-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 18 21:42:27 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Don't track kenter_pa/kremove PVs unless we are worrying about cache aliasing.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2016-08-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 18 21:42:27 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
Don't track kenter_pa/kremove PVs unless we are worrying about cache aliasing.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/pmap/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.19 src/sys/uvm/pmap/pmap.c:1.20
--- src/sys/uvm/pmap/pmap.c:1.19	Fri Aug  5 20:54:28 2016
+++ src/sys/uvm/pmap/pmap.c	Thu Aug 18 21:42:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.19 2016/08/05 20:54:28 jakllsch Exp $	*/
+/*	$NetBSD: pmap.c,v 1.20 2016/08/18 21:42:27 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.19 2016/08/05 20:54:28 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.20 2016/08/18 21:42:27 matt Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1358,7 +1358,8 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	 * No need to track non-managed pages or PMAP_KMPAGEs pages for aliases
 	 */
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
-	if (pg != NULL && (flags & PMAP_KMPAGE) == 0) {
+	if (pg != NULL && (flags & PMAP_KMPAGE) == 0
+	&& pmap_md_virtual_cache_aliasing_p()) {
 		pmap_enter_pv(pmap, va, pg, , PV_KENTER);
 	}
 #endif
@@ -1411,9 +1412,11 @@ pmap_pte_kremove(pmap_t pmap, vaddr_t sv
 
 		PMAP_COUNT(kremove_pages);
 		struct vm_page * const pg = PHYS_TO_VM_PAGE(pte_to_paddr(pte));
-		if (pg != NULL) {
+#ifdef PMAP_VIRTUAL_CACHE_ALIASES
+		if (pg != NULL && pmap_md_virtual_cache_aliasing_p()) {
 			pmap_remove_pv(pmap, sva, pg, !pte_readonly_p(pte));
 		}
+#endif
 
 		pmap_md_tlb_miss_lock_enter();
 		*ptep = new_pte;



CVS commit: src/sys/arch/mips/mips

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:29:28 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
Supply lastvaddr to load_buffer.  Fix printf formats.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mips/mips/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.36 src/sys/arch/mips/mips/bus_dma.c:1.37
--- src/sys/arch/mips/mips/bus_dma.c:1.36	Fri Jul 22 19:50:44 2016
+++ src/sys/arch/mips/mips/bus_dma.c	Sat Jul 30 06:29:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.36 2016/07/22 19:50:44 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.37 2016/07/30 06:29:28 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2016/07/22 19:50:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.37 2016/07/30 06:29:28 matt Exp $");
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -104,10 +104,10 @@ paddr_t kvtophys(vaddr_t);	/* XXX */
 static int
 _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map,
 void *buf, bus_size_t buflen, struct vmspace *vm, int flags,
-int *segp, bool first)
+int *segp, vaddr_t lastvaddr, bool first)
 {
 	paddr_t baddr, curaddr, lastaddr;
-	vaddr_t vaddr = (vaddr_t)buf, lastvaddr;
+	vaddr_t vaddr = (vaddr_t)buf;
 	bus_dma_segment_t *ds = >dm_segs[*segp];
 	bus_dma_segment_t * const eds = >dm_segs[map->_dm_segcnt];
 	const bus_addr_t bmask = ~(map->_dm_boundary - 1);
@@ -115,7 +115,6 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 	(mips_options.mips_cpu_flags & CPU_MIPS_D_CACHE_COHERENT) != 0;
 
 	lastaddr = ds->ds_addr + ds->ds_len;
-	lastvaddr = ds->_ds_vaddr + ds->ds_len;
 
 	while (buflen > 0) {
 		/*
@@ -166,12 +165,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 		 * Insert chunk into a segment, coalescing with
 		 * the previous segment if possible.
 		 */
-		if (first) {
-			ds->ds_addr = curaddr;
-			ds->ds_len = sgsize;
-			ds->_ds_vaddr = vaddr;
-			first = false;
-		} else if (curaddr == lastaddr
+		if (!first
+		&& curaddr == lastaddr
 		&& (d_cache_coherent
 #ifndef __mips_o32
 			|| !MIPS_CACHE_VIRTUAL_ALIAS
@@ -182,11 +177,12 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 			|| ((ds->ds_addr ^ curaddr) & bmask) == 0)) {
 			ds->ds_len += sgsize;
 		} else {
-			if (++ds >= eds)
+			if (!first && ++ds >= eds)
 break;
 			ds->ds_addr = curaddr;
 			ds->ds_len = sgsize;
-			ds->_ds_vaddr = vaddr;
+			ds->_ds_vaddr = (intptr_t)vaddr;
+			first = false;
 			/*
 			 * If this segment uses the correct color, try to see
 			 * if we can use a direct-mapped VA for the segment.
@@ -206,6 +202,9 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 MIPS_PHYS_TO_XKPHYS_CACHED(curaddr);
 #endif
 			}
+			/* Make sure this is a valid kernel address */
+			KASSERTMSG(ds->_ds_vaddr < 0,
+			"_ds_vaddr %#"PRIxREGISTER, ds->_ds_vaddr);
 		}
 
 		lastaddr = curaddr + sgsize;
@@ -266,7 +265,7 @@ _bus_dma_load_bouncebuf(bus_dma_tag_t t,
 	cookie->id_buftype = buftype;
 	seg = 0;
 	error = _bus_dmamap_load_buffer(t, map, cookie->id_bouncebuf,
-	buflen, vm, flags, , true);
+	buflen, vm, flags, , 0, true);
 	if (error)
 		return (error);
 
@@ -457,7 +456,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 
 	seg = 0;
 	error = _bus_dmamap_load_buffer(t, map, buf, buflen,
-	vm, flags, , true);
+	vm, flags, , 0, true);
 	if (error == 0) {
 		map->dm_mapsize = buflen;
 		map->dm_nsegs = seg + 1;
@@ -502,7 +501,6 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	int seg, error;
 	struct mbuf *m;
 	struct vmspace * vm = vmspace_kernel();
-	bool first;
 
 	if (map->dm_nsegs > 0) {
 #ifdef _MIPS_NEED_BUS_DMA_BOUNCE
@@ -533,15 +531,17 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	if (m0->m_pkthdr.len > map->_dm_size)
 		return (EINVAL);
 
-	first = true;
+	vaddr_t lastvaddr = 0;
+	bool first = true;
 	seg = 0;
 	error = 0;
 	for (m = m0; m != NULL && error == 0; m = m->m_next) {
 		if (m->m_len == 0)
 			continue;
 		error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
-		vm, flags, , first);
+		vm, flags, , lastvaddr, first);
 		first = false;
+		lastvaddr = (vaddr_t)m->m_data + m->m_len;
 	}
 	if (error == 0) {
 		map->dm_mapsize = m0->m_pkthdr.len;
@@ -572,7 +572,6 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 struct uio *uio, int flags)
 {
 	int seg, i, error;
-	bool first;
 	bus_size_t minlen, resid;
 	struct iovec *iov;
 	void *addr;
@@ -600,7 +599,8 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	resid = uio->uio_resid;
 	iov = uio->uio_iov;
 
-	first = true;
+	vaddr_t lastvaddr = 0;
+	bool first = true;
 	seg = 0;
 	error = 0;
 	for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
@@ -612,8 +612,9 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu

CVS commit: src/sys/arch/mips/mips

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:29:28 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
Supply lastvaddr to load_buffer.  Fix printf formats.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mips/mips/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/include

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:27:45 UTC 2016

Modified Files:
src/sys/arch/mips/include: psl.h

Log Message:
KX needs to set on !O32 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/include/psl.h
diff -u src/sys/arch/mips/include/psl.h:1.18 src/sys/arch/mips/include/psl.h:1.19
--- src/sys/arch/mips/include/psl.h:1.18	Mon Dec 14 00:46:05 2009
+++ src/sys/arch/mips/include/psl.h	Sat Jul 30 06:27:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.18 2009/12/14 00:46:05 matt Exp $	*/
+/*	$NetBSD: psl.h,v 1.19 2016/07/30 06:27:45 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -48,11 +48,7 @@
 #define	MIPS3_PSL_LOWIPL	(MIPS3_INT_MASK | MIPS_SR_INT_IE)
 
 #if !defined(__mips_o32)
-# ifdef _LP64
-#  define MIPS3_PSL_XFLAGS	(MIPS3_SR_XX | MIPS_SR_KX)
-# else
-#  define MIPS3_PSL_XFLAGS	(MIPS3_SR_XX)
-# endif
+# define MIPS3_PSL_XFLAGS	(MIPS3_SR_XX | MIPS_SR_KX)
 #else
 # define MIPS3_PSL_XFLAGS	(0)
 #endif



CVS commit: src/sys/arch/mips/include

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:28:05 UTC 2016

Modified Files:
src/sys/arch/mips/include: bus_dma_defs.h

Log Message:
Use register_t for _ds_vaddr


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/include/bus_dma_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/include/bus_dma_defs.h
diff -u src/sys/arch/mips/include/bus_dma_defs.h:1.2 src/sys/arch/mips/include/bus_dma_defs.h:1.3
--- src/sys/arch/mips/include/bus_dma_defs.h:1.2	Thu Jun 11 08:22:09 2015
+++ src/sys/arch/mips/include/bus_dma_defs.h	Sat Jul 30 06:28:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma_defs.h,v 1.2 2015/06/11 08:22:09 matt Exp $ */
+/* $NetBSD: bus_dma_defs.h,v 1.3 2016/07/30 06:28:05 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -112,7 +112,7 @@ typedef struct mips_bus_dmamap	*bus_dmam
 struct mips_bus_dma_segment {
 	bus_addr_t	ds_addr;	/* DMA address */
 	bus_size_t	ds_len;		/* length of transfer */
-	bus_addr_t	_ds_vaddr;	/* virtual address, 0 if invalid */
+	register_t	_ds_vaddr;	/* virtual address, 0 if invalid */
 };
 typedef struct mips_bus_dma_segment	bus_dma_segment_t;
 



CVS commit: src/sys/arch/mips/include

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:28:05 UTC 2016

Modified Files:
src/sys/arch/mips/include: bus_dma_defs.h

Log Message:
Use register_t for _ds_vaddr


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/include/bus_dma_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/include

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:27:45 UTC 2016

Modified Files:
src/sys/arch/mips/include: psl.h

Log Message:
KX needs to set on !O32 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:20:54 UTC 2016

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
For LP64 and N32 make sure KX is set in the trapframe as well.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/mips/mips/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.148 src/sys/arch/mips/mips/vm_machdep.c:1.149
--- src/sys/arch/mips/mips/vm_machdep.c:1.148	Sat Jul 30 05:58:15 2016
+++ src/sys/arch/mips/mips/vm_machdep.c	Sat Jul 30 06:20:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.148 2016/07/30 05:58:15 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.149 2016/07/30 06:20:54 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.148 2016/07/30 05:58:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.149 2016/07/30 06:20:54 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -144,6 +144,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	pcb2->pcb_context.val[_L_RA] =
 	   mips_locore_jumpvec.ljv_lwp_trampoline;			/* RA */
 #if defined(_LP64) || defined(__mips_n32)
+	KASSERT(tf->tf_regs[_R_SR] & MIPS_SR_KX);
 	KASSERT(pcb2->pcb_context.val[_L_SR] & MIPS_SR_KX);
 #endif
 	KASSERTMSG(pcb2->pcb_context.val[_L_SR] & MIPS_SR_INT_IE,



CVS commit: src/sys/arch/mips/mips

2016-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 06:20:54 UTC 2016

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
For LP64 and N32 make sure KX is set in the trapframe as well.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/mips/mips/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 05:55:34 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Fix typo.  N32 doesn't want UX on.


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/sys/arch/mips/mips/mips_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.273 src/sys/arch/mips/mips/mips_machdep.c:1.274
--- src/sys/arch/mips/mips/mips_machdep.c:1.273	Mon Jul 25 22:10:03 2016
+++ src/sys/arch/mips/mips/mips_machdep.c	Sat Jul 30 05:55:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.273 2016/07/25 22:10:03 macallan Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.274 2016/07/30 05:55:34 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.273 2016/07/25 22:10:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.274 2016/07/30 05:55:34 matt Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -2069,9 +2069,9 @@ mips_init_lwp0_uarea(void)
 
 	pcb->pcb_context.val[_L_SR] = MIPS_SR_INT_IE
 	| (ipl_sr_map.sr_bits[IPL_SCHED] ^ MIPS_INT_MASK);
-#ifdef _mips_n32
-	pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX | MIPS_SR_UX;
-	l->l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX | MIPS_SR_UX;
+#ifdef __mips_n32
+	pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX;
+	l->l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX;
 #endif
 #ifdef _LP64
 	pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX | MIPS_SR_UX;



CVS commit: src/sys/arch/mips/mips

2016-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 30 05:55:34 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Fix typo.  N32 doesn't want UX on.


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/sys/arch/mips/mips/mips_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2016-07-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 23 20:06:25 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Lock the tlbinfo if it wasn't when doing a pmap_tlb_pai_check


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2016-07-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 23 20:06:25 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Lock the tlbinfo if it wasn't when doing a pmap_tlb_pai_check


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.17 src/sys/uvm/pmap/pmap_tlb.c:1.18
--- src/sys/uvm/pmap/pmap_tlb.c:1.17	Thu Jul 14 15:50:31 2016
+++ src/sys/uvm/pmap/pmap_tlb.c	Sat Jul 23 20:06:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.17 2016/07/14 15:50:31 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.18 2016/07/23 20:06:25 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.17 2016/07/14 15:50:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.18 2016/07/23 20:06:25 matt Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -204,10 +204,12 @@ pmap_tlb_intersecting_onproc_p(pmap_t pm
 #endif
 
 static void
-pmap_tlb_pai_check(struct pmap_tlb_info *ti)
+pmap_tlb_pai_check(struct pmap_tlb_info *ti, bool locked_p)
 {
 #ifdef DIAGNOSTIC
 	struct pmap_asid_info *pai;
+	if (!locked_p)
+		TLBINFO_LOCK(ti);
 	LIST_FOREACH(pai, >ti_pais, pai_link) {
 		KASSERT(pai != NULL);
 		KASSERT(PAI_PMAP(pai, ti) != pmap_kernel());
@@ -220,6 +222,8 @@ pmap_tlb_pai_check(struct pmap_tlb_info 
 		KASSERT(pmap_tlb_intersecting_active_p(PAI_PMAP(pai, ti), ti));
 #endif
 	}
+	if (!locked_p)
+		TLBINFO_UNLOCK(ti);
 #endif
 }
 
@@ -412,7 +416,7 @@ pmap_tlb_asid_reinitialize(struct pmap_t
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 	UVMHIST_LOG(maphist, "(ti=%p, op=%u)", ti, op, 0, 0);
 
-	pmap_tlb_pai_check(ti);
+	pmap_tlb_pai_check(ti, true);
 
 	ti->ti_evcnt_asid_reinits.ev_count++;
 
@@ -907,7 +911,7 @@ pmap_tlb_asid_acquire(pmap_t pm, struct 
 	TLBINFO_LOCK(ti);
 	KASSERT(pai->pai_asid <= KERNEL_PID || pai->pai_link.le_prev != NULL);
 	KASSERT(pai->pai_asid > KERNEL_PID || pai->pai_link.le_prev == NULL);
-	pmap_tlb_pai_check(ti);
+	pmap_tlb_pai_check(ti, true);
 	if (__predict_false(!PMAP_PAI_ASIDVALID_P(pai, ti))) {
 		/*
 		 * If we've run out ASIDs, reinitialize the ASID space.
@@ -925,7 +929,7 @@ pmap_tlb_asid_acquire(pmap_t pm, struct 
 		pmap_tlb_asid_alloc(ti, pm, pai);
 		UVMHIST_LOG(maphist, "allocated asid %#x", pai->pai_asid, 0, 0, 0);
 	}
-	pmap_tlb_pai_check(ti);
+	pmap_tlb_pai_check(ti, true);
 #if defined(MULTIPROCESSOR)
 	KASSERT(kcpuset_isset(pm->pm_active, cpu_index(ci)));
 #endif
@@ -981,7 +985,7 @@ pmap_tlb_asid_deactivate(pmap_t pm)
 	curcpu()->ci_pmap_asid_cur = KERNEL_PID;
 	UVMHIST_LOG(maphist, " <-- done (pm=%p)", pm, 0, 0, 0);
 	tlb_set_asid(KERNEL_PID);
-	pmap_tlb_pai_check(cpu_tlb_info(curcpu()));
+	pmap_tlb_pai_check(cpu_tlb_info(curcpu()), false);
 #if defined(DEBUG)
 	pmap_tlb_asid_check();
 #endif



CVS commit: src/sys/arch/mips/mips

2016-07-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul 22 19:50:45 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
When mapping a dmamem page, make sure to trunc_pae the starting address


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/mips/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.35 src/sys/arch/mips/mips/bus_dma.c:1.36
--- src/sys/arch/mips/mips/bus_dma.c:1.35	Sat Jul 16 21:33:46 2016
+++ src/sys/arch/mips/mips/bus_dma.c	Fri Jul 22 19:50:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.35 2016/07/16 21:33:46 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.36 2016/07/22 19:50:44 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2016/07/16 21:33:46 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2016/07/22 19:50:44 matt Exp $");
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -1115,7 +1115,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 	*kvap = (void *)va;
 
 	for (curseg = 0; curseg < nsegs; curseg++) {
-		for (addr = segs[curseg].ds_addr;
+		for (addr = trunc_page(segs[curseg].ds_addr);
 		addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
 		addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
 			if (size == 0)



CVS commit: src/sys/arch/mips/mips

2016-07-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul 22 19:50:45 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
When mapping a dmamem page, make sure to trunc_pae the starting address


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/mips/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 16 21:33:46 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
When doing dmamap syncs, try to use KSEG0/XKPHYS address if possible.
XXX once hard page coloring is supported XKPHYS could be used all the time.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/mips/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 16 21:33:46 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
When doing dmamap syncs, try to use KSEG0/XKPHYS address if possible.
XXX once hard page coloring is supported XKPHYS could be used all the time.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/mips/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.34 src/sys/arch/mips/mips/bus_dma.c:1.35
--- src/sys/arch/mips/mips/bus_dma.c:1.34	Tue Feb 17 09:58:33 2015
+++ src/sys/arch/mips/mips/bus_dma.c	Sat Jul 16 21:33:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.34 2015/02/17 09:58:33 macallan Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.35 2016/07/16 21:33:46 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.34 2015/02/17 09:58:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2016/07/16 21:33:46 matt Exp $");
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -106,18 +106,16 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 void *buf, bus_size_t buflen, struct vmspace *vm, int flags,
 int *segp, bool first)
 {
-	bus_size_t sgsize;
 	paddr_t baddr, curaddr, lastaddr;
 	vaddr_t vaddr = (vaddr_t)buf, lastvaddr;
-	int seg = *segp;
-	bus_dma_segment_t *ds = >dm_segs[seg];
+	bus_dma_segment_t *ds = >dm_segs[*segp];
 	bus_dma_segment_t * const eds = >dm_segs[map->_dm_segcnt];
+	const bus_addr_t bmask = ~(map->_dm_boundary - 1);
 	const bool d_cache_coherent =
 	(mips_options.mips_cpu_flags & CPU_MIPS_D_CACHE_COHERENT) != 0;
 
 	lastaddr = ds->ds_addr + ds->ds_len;
 	lastvaddr = ds->_ds_vaddr + ds->ds_len;
-	const bus_size_t bmask = ~(map->_dm_boundary - 1);
 
 	while (buflen > 0) {
 		/*
@@ -146,7 +144,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 		/*
 		 * Compute the segment size, and adjust counts.
 		 */
-		sgsize = PAGE_SIZE - ((uintptr_t)vaddr & PGOFSET);
+		bus_size_t sgsize = PAGE_SIZE - ((uintptr_t)vaddr & PGOFSET);
 		if (sgsize > buflen) {
 			sgsize = buflen;
 		}
@@ -174,8 +172,12 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 			ds->_ds_vaddr = vaddr;
 			first = false;
 		} else if (curaddr == lastaddr
-		&& (d_cache_coherent || lastvaddr == vaddr)
-		&& ds->ds_len + sgsize <= map->dm_maxsegsz
+		&& (d_cache_coherent
+#ifndef __mips_o32
+			|| !MIPS_CACHE_VIRTUAL_ALIAS
+#endif
+			|| vaddr == lastvaddr)
+		&& (ds->ds_len + sgsize) <= map->dm_maxsegsz
 		&& (map->_dm_boundary == 0
 			|| ((ds->ds_addr ^ curaddr) & bmask) == 0)) {
 			ds->ds_len += sgsize;
@@ -185,6 +187,25 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 			ds->ds_addr = curaddr;
 			ds->ds_len = sgsize;
 			ds->_ds_vaddr = vaddr;
+			/*
+			 * If this segment uses the correct color, try to see
+			 * if we can use a direct-mapped VA for the segment.
+			 */
+			if (!mips_cache_badalias(curaddr, vaddr)) {
+#ifdef __mips_o32
+if (MIPS_KSEG0_P(curaddr + sgsize - 1)) {
+	ds->_ds_vaddr =
+	MIPS_PHYS_TO_KSEG0(curaddr);
+}
+#else
+/*
+ * All physical addresses can be accessed
+ * via XKPHYS.
+ */
+				ds->_ds_vaddr =
+MIPS_PHYS_TO_XKPHYS_CACHED(curaddr);
+#endif
+			}
 		}
 
 		lastaddr = curaddr + sgsize;
@@ -496,6 +517,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 #endif
 		STAT_INCR(unloads);
 	}
+
 	/*
 	 * Make sure that on error condition we return "no valid mappings."
 	 */
@@ -803,6 +825,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	|| (ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) == 0)
 		goto bounce_it;
 
+#ifdef _mips_o32
 	/*
 	 * If the mapping belongs to the kernel, or it belongs
 	 * to the currently-running process (XXX actually, vmspace),
@@ -812,6 +835,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	 */
 	const bool useindex = (!VMSPACE_IS_KERNEL_P(map->_dm_vmspace)
 	&& map->_dm_vmspace != curproc->p_vmspace);
+#endif
 
 	bus_dma_segment_t *seg = map->dm_segs;
 	bus_dma_segment_t * const lastseg = seg + map->dm_nsegs;
@@ -827,7 +851,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		 * Now at the first segment to sync; nail each segment until we
 		 * have exhausted the length.
 		 */
-		vaddr_t vaddr = seg->_ds_vaddr + offset;
+		register_t vaddr = (intptr_t)seg->_ds_vaddr + offset;
 		minlen = ulmin(len, seg->ds_len - offset);
 
 #ifdef BUS_DMA_DEBUG
@@ -843,13 +867,15 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		 * If we are forced to use Index ops, it's always a
 		 * Write-back,Invalidate, so just do one test.
 		 */
-		if (__predict_false(useindex)) {
+#ifdef mips_o32
+		if (__predict_false(useindex || vaddr == 0)) {
 			mips_dcache_wbinv_range_index(vaddr, minlen);
 #ifdef BUS_DMA_DEBUG
 			printf("\n");
 #endif
 			continue;
 		

Re: CVS commit: src/lib/libc_fp

2016-07-15 Thread Matt Thomas

> On Jul 14, 2016, at 11:39 PM, David Holland 
>  wrote:
> 
> Can you call this MTC1_HAZARD like the MFC0_HAZARD that got added
> recently elsewhere? It's a pipeline hazard and not a synchronization
> (which to me at least indicates some form of handshake) and it's also
> specific to mtc1/dmtc1.

That's reasonable.

> (also while this code appears to currently be 64-bit only, in the long
> run the condition is wrong...)

Well, O32 handles FP emulation.

So this is really for N32/N64 since they default to softfloat.  They use
64-bit registers so I don't see the point.

CVS commit: src/lib/libc_fp

2016-07-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 14 01:59:19 UTC 2016

Added Files:
src/lib/libc_fp: Makefile gcc-softfloat.c
src/lib/libc_fp/arch/mips: Makefile.inc fpdf.S fpsf.S shlib_version

Log Message:
Library which implements the softfloat primitives using FP instructions
Currently contains only untested MIPS routines.
XXX move arm libc_vfp to here.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc_fp/Makefile \
src/lib/libc_fp/gcc-softfloat.c
cvs rdiff -u -r0 -r1.1 src/lib/libc_fp/arch/mips/Makefile.inc \
src/lib/libc_fp/arch/mips/fpdf.S src/lib/libc_fp/arch/mips/fpsf.S \
src/lib/libc_fp/arch/mips/shlib_version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc_fp

2016-07-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 14 01:59:19 UTC 2016

Added Files:
src/lib/libc_fp: Makefile gcc-softfloat.c
src/lib/libc_fp/arch/mips: Makefile.inc fpdf.S fpsf.S shlib_version

Log Message:
Library which implements the softfloat primitives using FP instructions
Currently contains only untested MIPS routines.
XXX move arm libc_vfp to here.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc_fp/Makefile \
src/lib/libc_fp/gcc-softfloat.c
cvs rdiff -u -r0 -r1.1 src/lib/libc_fp/arch/mips/Makefile.inc \
src/lib/libc_fp/arch/mips/fpdf.S src/lib/libc_fp/arch/mips/fpsf.S \
src/lib/libc_fp/arch/mips/shlib_version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/lib/libc_fp/Makefile
diff -u /dev/null src/lib/libc_fp/Makefile:1.1
--- /dev/null	Thu Jul 14 01:59:19 2016
+++ src/lib/libc_fp/Makefile	Thu Jul 14 01:59:18 2016
@@ -0,0 +1,26 @@
+#	$NetBSD: Makefile,v 1.1 2016/07/14 01:59:18 matt Exp $
+#
+
+USE_SHLIBDIR=	yes
+
+.include 
+
+LIBC_MACHINE_CPU?= ${MACHINE_CPU}
+
+.if exists(arch/${LIBC_MACHINE_CPU})
+.include "arch/${LIBC_MACHINE_CPU}/Makefile.inc"
+.PATH: ${.CURDIR}/arch/${LIBC_MACHINE_CPU}
+.elif exists(arch/${MACHINE_ARCH})
+.include "arch/${MACHINE_ARCH}/Makefile.inc"
+.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}
+.elif exists(arch/${MACHINE}
+.include "arch/${MACHINE}/Makefile.inc"
+.PATH: ${.CURDIR}/arch/${MACHINE}
+.endif
+
+.if !empty(SRCS)
+
+LIB?=		c_fp
+
+.include 
+.endif
Index: src/lib/libc_fp/gcc-softfloat.c
diff -u /dev/null src/lib/libc_fp/gcc-softfloat.c:1.1
--- /dev/null	Thu Jul 14 01:59:19 2016
+++ src/lib/libc_fp/gcc-softfloat.c	Thu Jul 14 01:59:18 2016
@@ -0,0 +1,217 @@
+/* $NetBSD: gcc-softfloat.c,v 1.1 2016/07/14 01:59:18 matt Exp $ */
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This contain the softfloat primitives used by GCC.
+ * It can be used to verify the functions invoked by tGCC to do softfloat.
+ * It can also be used to what FP instructions GCC generates to implement the
+ * various primitives.  Your arch-dependent code should provide all of these
+ * that are easy to implement.  
+ */
+
+long long
+xfixdfdi(double a)
+{
+	return (long long)a;
+}
+
+int
+xfixdfsi(double a)
+{
+	return (int)a;
+}
+
+unsigned long long
+xfixunsdfdi(double a)
+{
+	return (unsigned long long)a;
+}
+
+unsigned int
+xfixunsdfsi(double a)
+{
+	return (unsigned int)a;
+}
+
+double
+xfloatundidf(unsigned long long a)
+{
+	return (double) a;
+}
+
+double
+xfloatunsidf(unsigned int a)
+{
+	return (double) a;
+}
+
+double
+xfloatdidf(long long a)
+{
+	return (double) a;
+}
+
+double
+xfloatsidf(int a)
+{
+	return (double) a;
+}
+
+double
+xextendsfdf2(float a)
+{
+	return (double) a;
+}
+
+int
+xeqdf2(double a, double b)
+{
+	return a == b;
+}
+
+int
+xnedf2(double a, double b)
+{
+	return a != b;
+}
+
+int
+xledf2(double a, double b)
+{
+	return a <= b;
+}
+
+int
+xgtdf2(double a, double b)
+{
+	return a > b;
+}
+
+int
+xltdf2(double a, double b)
+{
+	return a < b;
+}
+
+int
+xgedf2(double a, double b)
+{
+	return a >= b;
+}
+
+long long
+xfixsfdi(float a)
+{
+	return (long long)a;
+}
+
+int
+xfixsfsi(float a)
+{
+	return (int)a;
+}
+
+unsigned long long
+xfixunssfdi(float a)
+{
+	return (unsigned long long)a;
+}
+
+unsigned int
+xfixunssfsi(float a)
+{
+	return (unsigned int)a;
+}
+
+float
+xfloatundisf(unsigned long 

CVS commit: src/distrib/sets/lists/tests

2016-07-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 13 15:58:37 UTC 2016

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Fix libproc compat setting


To generate a diff of this commit:
cvs rdiff -u -r1.677 -r1.678 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/sets/lists/tests

2016-07-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 13 15:58:37 UTC 2016

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Fix libproc compat setting


To generate a diff of this commit:
cvs rdiff -u -r1.677 -r1.678 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.677 src/distrib/sets/lists/tests/mi:1.678
--- src/distrib/sets/lists/tests/mi:1.677	Fri Jul  1 22:46:20 2016
+++ src/distrib/sets/lists/tests/mi	Wed Jul 13 15:58:37 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.677 2016/07/01 22:46:20 christos Exp $
+# $NetBSD: mi,v 1.678 2016/07/13 15:58:37 matt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2938,10 +2938,10 @@
 ./usr/tests/lib/libppath/Atffile		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libppath/Kyuafile		tests-lib-tests		compattestfile,atf,kyua
 ./usr/tests/lib/libppath/t_ppath		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libproc		tests-lib-debug	compattestdir
-./usr/tests/lib/libproc/Atffile	tests-lib-debug	compattestfile,atf,dtrace
-./usr/tests/lib/libproc/proc_testtests-lib-debug	compattestfile,atf,dtrace
-./usr/tests/lib/libproc/target_progtests-lib-debug	compattestfile,atf,dtrace
+./usr/tests/lib/libproctests-lib-debug		compattestfile,atf
+./usr/tests/lib/libproc/Atffile			tests-lib-debug		compattestfile,atf,dtrace
+./usr/tests/lib/libproc/proc_test		tests-lib-debug		compattestfile,atf,dtrace
+./usr/tests/lib/libproc/target_prog		tests-lib-debug		compattestfile,atf,dtrace
 ./usr/tests/lib/libproptests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libprop/Atffile			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libprop/Kyuafile		tests-lib-tests		compattestfile,atf,kyua



CVS commit: src/sys/arch/arc/arc

2016-07-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 23:53:18 UTC 2016

Modified Files:
src/sys/arch/arc/arc: bus_space_sparse.c

Log Message:
Put back cacheable


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arc/arc/bus_space_sparse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arc/arc/bus_space_sparse.c
diff -u src/sys/arch/arc/arc/bus_space_sparse.c:1.19 src/sys/arch/arc/arc/bus_space_sparse.c:1.20
--- src/sys/arch/arc/arc/bus_space_sparse.c:1.19	Mon Jul 11 16:18:55 2016
+++ src/sys/arch/arc/arc/bus_space_sparse.c	Tue Jul 12 23:53:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_sparse.c,v 1.19 2016/07/11 16:18:55 matt Exp $	*/
+/*	$NetBSD: bus_space_sparse.c,v 1.20 2016/07/12 23:53:18 matt Exp $	*/
 /*	NetBSD: bus_machdep.c,v 1.1 2000/01/26 18:48:00 drochner Exp 	*/
 
 /*-
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.19 2016/07/11 16:18:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.20 2016/07/12 23:53:18 matt Exp $");
 
 #include 
 #include 
@@ -75,9 +75,8 @@ arc_sparse_bus_space_compose_handle(bus_
 	 * Since all buses can be linearly mappable, we don't have to check
 	 * BUS_SPACE_MAP_LINEAR and BUS_SPACE_MAP_PREFETCHABLE.
 	 */
-	const u_int pmap_flags = (flags & BUS_SPACE_MAP_CACHEABLE)
-	? PMAP_WRITE_BACK
-	: 0;
+	const bool cacheable = (flags & BUS_SPACE_MAP_CACHEABLE) != 0;
+	const u_int pmap_flags = cacheable ? PMAP_WRITE_BACK : 0;
 
 	/*
 	 * XXX - `bst->bs_pbase' must be page aligned,



CVS commit: src/sys/arch/arc/arc

2016-07-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 23:53:18 UTC 2016

Modified Files:
src/sys/arch/arc/arc: bus_space_sparse.c

Log Message:
Put back cacheable


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arc/arc/bus_space_sparse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 06:03:11 UTC 2016

Removed Files:
src/sys/arch/mips/mips: pmap_segtab.c pmap_tlb.c

Log Message:
We use the common uvm pmap now.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r0 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.11 -r0 src/sys/arch/mips/mips/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 06:03:11 UTC 2016

Removed Files:
src/sys/arch/mips/mips: pmap_segtab.c pmap_tlb.c

Log Message:
We use the common uvm pmap now.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r0 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.11 -r0 src/sys/arch/mips/mips/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 03:49:32 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_space_alignstride_chipdep.c

Log Message:
Use mips3_ld


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c
diff -u src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c:1.26 src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c:1.27
--- src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c:1.26	Mon Jul 11 19:05:02 2016
+++ src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c	Tue Jul 12 03:49:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space_alignstride_chipdep.c,v 1.26 2016/07/11 19:05:02 skrll Exp $ */
+/* $NetBSD: bus_space_alignstride_chipdep.c,v 1.27 2016/07/12 03:49:32 matt Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.26 2016/07/11 19:05:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.27 2016/07/12 03:49:32 matt Exp $");
 
 #ifdef CHIP_EXTENT
 #include 
@@ -727,7 +727,7 @@ __BS(read_2)(void *v, bus_space_handle_t
 	const int shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
 	h &= ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1));
 #if CHIP_ACCESS_SIZE == 8
-	const CHIP_TYPE val = mips_ld(h);
+	const CHIP_TYPE val = mips3_ld(h);
 #elif CHIP_ACCESS_SIZE == 4
 	const CHIP_TYPE val = mips_lwu(h);
 #else



CVS commit: src/sys/arch/mips/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 03:49:32 UTC 2016

Modified Files:
src/sys/arch/mips/mips: bus_space_alignstride_chipdep.c

Log Message:
Use mips3_ld


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 03:34:50 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
Fix busted #if/endif


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mips/mips/mipsX_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.70 src/sys/arch/mips/mips/mipsX_subr.S:1.71
--- src/sys/arch/mips/mips/mipsX_subr.S:1.70	Mon Jul 11 19:00:04 2016
+++ src/sys/arch/mips/mips/mipsX_subr.S	Tue Jul 12 03:34:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.70 2016/07/11 19:00:04 skrll Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.71 2016/07/12 03:34:50 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -1874,7 +1874,7 @@ LEAF_NOPROFILE(MIPSX(kern_tlb_invalid_ex
 	PTR_L	k1, (k1)			# load segtab address
 	beqz	k1, _C_LABEL(MIPSX(kern_gen_exception))
 	 nop
-#endif
+#endif /* _LP64 */
 #ifdef MIPSNNR2
 	_EXT	k0, k0, SEGSHIFT, SEGLENGTH
 	_INS	k1, k0, PTR_SCALESHIFT, SEGLENGTH
@@ -1900,7 +1900,6 @@ LEAF_NOPROFILE(MIPSX(kern_tlb_invalid_ex
 
 	mfc0	k0, MIPS_COP_0_TLB_INDEX
 	MFC0_HAZARD
-#endif
 	bltz	k0, _C_LABEL(MIPSX(kern_gen_exception)) # ASSERT(TLB entry exists)
 	 nop	# - delay slot -
 
@@ -2000,6 +1999,7 @@ MIPSX(kern_tlbi_odd):
 #endif
 	eret
 END(MIPSX(kern_tlb_invalid_exception))
+#endif /* (PGSHIFT & 1) == 0 */
 
 /*
  * Mark where code entered from exception hander jumptable



CVS commit: src/sys/arch/mips/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 03:34:50 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
Fix busted #if/endif


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mips/mips/mipsX_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/cavium/dev

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 03:34:25 UTC 2016

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_dwctwo.c

Log Message:
Use mips_lwu


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/cavium/dev

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 12 03:34:25 UTC 2016

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_dwctwo.c

Log Message:
Use mips_lwu


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c
diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.8 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.9
--- src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.8	Mon Jul 11 16:15:35 2016
+++ src/sys/arch/mips/cavium/dev/octeon_dwctwo.c	Tue Jul 12 03:34:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_dwctwo.c,v 1.8 2016/07/11 16:15:35 matt Exp $	*/
+/*	$NetBSD: octeon_dwctwo.c,v 1.9 2016/07/12 03:34:25 matt Exp $	*/
 
 /*
  * Copyright (c) 2015 Masao Uebayashi 
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.8 2016/07/11 16:15:35 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.9 2016/07/12 03:34:25 matt Exp $");
 
 #include "opt_octeon.h"
 #include "opt_usb.h"
@@ -321,7 +321,7 @@ octeon_dwc2_rd_4(void *v, bus_space_hand
 {
 
 	/* dwc2 uses little-endian addressing */
-	return mips_lw((h + off) ^ 4);
+	return mips_lwu((h + off) ^ 4);
 }
 
 static void



CVS commit: src/sys/arch/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 23:06:54 UTC 2016

Modified Files:
src/sys/arch/mips/conf: files.mips
src/sys/arch/mips/include: cache_r4k.h
src/sys/arch/mips/mips: cache.c cache_r4k.c

Log Message:
Use sdcache routines.
Remove old cache support.
Switch to new cache routines.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/mips/conf/files.mips
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/include/cache_r4k.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/mips/mips/cache.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/cache_r4k.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 23:06:54 UTC 2016

Modified Files:
src/sys/arch/mips/conf: files.mips
src/sys/arch/mips/include: cache_r4k.h
src/sys/arch/mips/mips: cache.c cache_r4k.c

Log Message:
Use sdcache routines.
Remove old cache support.
Switch to new cache routines.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/mips/conf/files.mips
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/include/cache_r4k.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/mips/mips/cache.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/cache_r4k.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/conf/files.mips
diff -u src/sys/arch/mips/conf/files.mips:1.74 src/sys/arch/mips/conf/files.mips:1.75
--- src/sys/arch/mips/conf/files.mips:1.74	Mon Jul 11 16:15:35 2016
+++ src/sys/arch/mips/conf/files.mips	Mon Jul 11 23:06:53 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mips,v 1.74 2016/07/11 16:15:35 matt Exp $
+#	$NetBSD: files.mips,v 1.75 2016/07/11 23:06:53 matt Exp $
 #
 
 defflag	opt_cputype.h		NOFPU FPEMUL
@@ -77,12 +77,12 @@ file	arch/mips/mips/cache_octeon.c		mips
 file	arch/mips/mips/cache_mipsNN.c		mips32|mips32r2|mips64|mips64r2
 file	arch/mips/mips/cache_r4k_pcache16.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
 file	arch/mips/mips/cache_r4k_pcache32.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
-file	arch/mips/mips/cache_r4k_pcache64.S	mips32|mips32r2|mips64|mips64r2
-file	arch/mips/mips/cache_r4k_pcache128.S	mips32|mips32r2|mips64|mips64r2
-#file	arch/mips/mips/cache_r4k_scache16.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
-#file	arch/mips/mips/cache_r4k_scache32.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
-#file	arch/mips/mips/cache_r4k_scache64.S	mips32|mips32r2|mips64|mips64r2
-#file	arch/mips/mips/cache_r4k_scache128.S	mips32|mips32r2|mips64|mips64r2
+file	arch/mips/mips/cache_r4k_pcache64.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
+file	arch/mips/mips/cache_r4k_pcache128.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
+file	arch/mips/mips/cache_r4k_scache16.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
+file	arch/mips/mips/cache_r4k_scache32.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
+file	arch/mips/mips/cache_r4k_scache64.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
+file	arch/mips/mips/cache_r4k_scache128.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2
 
 file	arch/mips/mips/mips_fputrap.c		!nofpu | fpemul
 file	arch/mips/mips/mips_emul.c

Index: src/sys/arch/mips/include/cache_r4k.h
diff -u src/sys/arch/mips/include/cache_r4k.h:1.13 src/sys/arch/mips/include/cache_r4k.h:1.14
--- src/sys/arch/mips/include/cache_r4k.h:1.13	Mon Jul 11 19:06:33 2016
+++ src/sys/arch/mips/include/cache_r4k.h	Mon Jul 11 23:06:54 2016
@@ -57,6 +57,7 @@
 
 #if !defined(_LOCORE)
 
+#if 1
 /*
  * cache_r4k_op_line:
  *
@@ -306,49 +307,15 @@ cache_r4k_op_8lines_NN_4way(size_t n, re
 	cache_r4k_op_8lines_NN_4way(64, (va1), (va2), (va3), (va4), (op))
 #define	cache_r4k_op_8lines_128_4way(va1, va2, va3, va4, op) \
 	cache_r4k_op_8lines_NN_4way(128, (va1), (va2), (va3), (va4), (op))
+#endif
 
-void	r4k_icache_sync_all_16(void);
-void	r4k_icache_sync_range_16(register_t, vsize_t);
-void	r4k_icache_sync_range_index_16(vaddr_t, vsize_t);
-
-void	r4k_icache_sync_all_32(void);
-void	r4k_icache_sync_range_32(register_t, vsize_t);
-void	r4k_icache_sync_range_index_32(vaddr_t, vsize_t);
-
-void	r4k_pdcache_wbinv_all_16(void);
-void	r4k_pdcache_wbinv_range_16(register_t, vsize_t);
-void	r4k_pdcache_wbinv_range_index_16(vaddr_t, vsize_t);
-
-void	r4k_pdcache_inv_range_16(register_t, vsize_t);
-void	r4k_pdcache_wb_range_16(register_t, vsize_t);
-
-void	r4k_pdcache_wbinv_all_32(void);
-void	r4k_pdcache_wbinv_range_32(register_t, vsize_t);
-void	r4k_pdcache_wbinv_range_index_32(vaddr_t, vsize_t);
-
-void	r4k_pdcache_inv_range_32(register_t, vsize_t);
-void	r4k_pdcache_wb_range_32(register_t, vsize_t);
-
-void	r4k_sdcache_wbinv_all_32(void);
-void	r4k_sdcache_wbinv_range_32(register_t, vsize_t);
-void	r4k_sdcache_wbinv_range_index_32(vaddr_t, vsize_t);
-
-void	r4k_sdcache_inv_range_32(register_t, vsize_t);
-void	r4k_sdcache_wb_range_32(register_t, vsize_t);
-
-void	r4k_sdcache_wbinv_all_128(void);
-void	r4k_sdcache_wbinv_range_128(register_t, vsize_t);
-void	r4k_sdcache_wbinv_range_index_128(vaddr_t, vsize_t);
-
-void	r4k_sdcache_inv_range_128(register_t, vsize_t);
-void	r4k_sdcache_wb_range_128(register_t, vsize_t);
+/* cache_r4k.c */
 
+void	r4k_icache_sync_all_generic(void);
+void	r4k_icache_sync_range_generic(register_t, vsize_t);
+void	r4k_icache_sync_range_index_generic(vaddr_t, vsize_t);
+void	r4k_pdcache_wbinv_all_generic(void);
 void	r4k_sdcache_wbinv_all_generic(void);
-void	r4k_sdcache_wbinv_range_generic(register_t, vsize_t);
-void	r4k_sdcache_wbinv_range_index_generic(vaddr_t, vsize_t);
-
-void	r4k_sdcache_inv_range_generic(register_t, 

CVS commit: src/sys/arch/mips/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 18:07:33 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
Remove extra #endif


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/mips/mipsX_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 18:07:33 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
Remove extra #endif


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/mips/mipsX_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.68 src/sys/arch/mips/mips/mipsX_subr.S:1.69
--- src/sys/arch/mips/mips/mipsX_subr.S:1.68	Mon Jul 11 16:15:36 2016
+++ src/sys/arch/mips/mips/mipsX_subr.S	Mon Jul 11 18:07:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.68 2016/07/11 16:15:36 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.69 2016/07/11 18:07:33 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -2008,7 +2008,6 @@ END(MIPSX(kern_tlb_invalid_exception))
 
 	.globl	_C_LABEL(MIPSX(exceptionentry_end))
 _C_LABEL(MIPSX(exceptionentry_end)):
-#endif /* (PGSHIFT & 1) == 0 */
 
 	.set	at
 



CVS commit: src/sys/arch

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:18:56 UTC 2016

Modified Files:
src/sys/arch/arc/arc: bus_space_sparse.c c_nec_eisa.c
src/sys/arch/emips/emips: interrupt.c xilinx_ml40x.c xs_bee3.c
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/evbmips/gdium: machdep.c
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/hpcmips/hpcmips: bus_space.c
src/sys/arch/hpcmips/tx: tx3912video.c

Log Message:
Use pmap_kenter flags to create cached/uncached entries.
#include  when appropriate


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arc/arc/bus_space_sparse.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arc/arc/c_nec_eisa.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/emips/emips/interrupt.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/emips/emips/xilinx_ml40x.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/emips/emips/xs_bee3.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbmips/gdium/machdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/hpcmips/hpcmips/bus_space.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hpcmips/tx/tx3912video.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arc/arc/bus_space_sparse.c
diff -u src/sys/arch/arc/arc/bus_space_sparse.c:1.18 src/sys/arch/arc/arc/bus_space_sparse.c:1.19
--- src/sys/arch/arc/arc/bus_space_sparse.c:1.18	Fri Jul  1 19:28:00 2011
+++ src/sys/arch/arc/arc/bus_space_sparse.c	Mon Jul 11 16:18:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_sparse.c,v 1.18 2011/07/01 19:28:00 dyoung Exp $	*/
+/*	$NetBSD: bus_space_sparse.c,v 1.19 2016/07/11 16:18:55 matt Exp $	*/
 /*	NetBSD: bus_machdep.c,v 1.1 2000/01/26 18:48:00 drochner Exp 	*/
 
 /*-
@@ -39,42 +39,21 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.18 2011/07/01 19:28:00 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.19 2016/07/11 16:18:55 matt Exp $");
 
 #include 
-#include 
-#include 
+#include 
 #include 
+#include 
+#include 
 
 #include 
 
-#include 
+#include 
 #include 
 
-#include 
-
 extern paddr_t kvtophys(vaddr_t);	/* XXX */
 
-static void arc_kseg2_make_cacheable(vaddr_t vaddr, vsize_t size);
-
-static void
-arc_kseg2_make_cacheable(vaddr_t vaddr, vsize_t size)
-{
-	vaddr_t start, end;
-	pt_entry_t *pte;
-	uint32_t entry, mask;
-
-	start = mips_trunc_page(vaddr);
-	end = mips_round_page(vaddr + size);
-	mask = ~(CPUISMIPS3 ? MIPS3_PG_UNCACHED : MIPS1_PG_N);
-	for (; start < end; start += PAGE_SIZE) {
-		pte = kvtopte(start);
-		entry = pte->pt_entry & mask;
-		pte->pt_entry &= entry;
-		tlb_update(start, entry);
-	}
-}
-
 void
 arc_sparse_bus_space_init(bus_space_tag_t bst, const char *name, paddr_t paddr,
 bus_addr_t start, bus_size_t size)
@@ -96,7 +75,9 @@ arc_sparse_bus_space_compose_handle(bus_
 	 * Since all buses can be linearly mappable, we don't have to check
 	 * BUS_SPACE_MAP_LINEAR and BUS_SPACE_MAP_PREFETCHABLE.
 	 */
-	int cacheable = (flags & BUS_SPACE_MAP_CACHEABLE);
+	const u_int pmap_flags = (flags & BUS_SPACE_MAP_CACHEABLE)
+	? PMAP_WRITE_BACK
+	: 0;
 
 	/*
 	 * XXX - `bst->bs_pbase' must be page aligned,
@@ -111,22 +92,20 @@ arc_sparse_bus_space_compose_handle(bus_
 		MIPS_PHYS_TO_KSEG0(start) :
 		MIPS_PHYS_TO_KSEG1(start));
 	} else {
-		vaddr_t va,
-		vaddr = uvm_km_alloc(kernel_map, (vsize_t)(end - start), 0,
-		UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
+		vaddr_t vaddr = uvm_km_alloc(kernel_map, (vsize_t)(end - start),
+		0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
 
 		if (vaddr == 0)
 			panic("arc_sparse_bus_space_compose_handle: "
 			  "cannot allocate KVA 0x%llx..0x%llx",
 			  start, end);
-		for (va = vaddr; start < end;
-		 start += PAGE_SIZE, va += PAGE_SIZE)
-			pmap_kenter_pa(va, start,
-			VM_PROT_READ|VM_PROT_WRITE, 0);
+		for (vaddr_t va = vaddr; start < end;
+		 start += PAGE_SIZE, va += PAGE_SIZE) {
+			pmap_kenter_pa(va, start, VM_PROT_READ|VM_PROT_WRITE,
+			pmap_flags);
+		}
 		pmap_update(pmap_kernel());
 		vaddr += (offset & PGOFSET);
-		if (cacheable)
-			arc_kseg2_make_cacheable(vaddr, size);
 		*bshp = vaddr;
 	}
 	return 0;

Index: src/sys/arch/arc/arc/c_nec_eisa.c
diff -u src/sys/arch/arc/arc/c_nec_eisa.c:1.16 src/sys/arch/arc/arc/c_nec_eisa.c:1.17
--- src/sys/arch/arc/arc/c_nec_eisa.c:1.16	Sun Feb 20 07:52:42 2011
+++ src/sys/arch/arc/arc/c_nec_eisa.c	Mon Jul 11 16:18:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_nec_eisa.c,v 1.16 2011/02/20 07:52:42 matt Exp $	*/
+/*	$NetBSD: c_nec_eisa.c,v 1.17 2016/07/11 16:18:55 matt Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.16 2011/02/20 07:52:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.17 2016/07/11 

CVS commit: src/sys/arch

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:18:56 UTC 2016

Modified Files:
src/sys/arch/arc/arc: bus_space_sparse.c c_nec_eisa.c
src/sys/arch/emips/emips: interrupt.c xilinx_ml40x.c xs_bee3.c
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/evbmips/gdium: machdep.c
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/hpcmips/hpcmips: bus_space.c
src/sys/arch/hpcmips/tx: tx3912video.c

Log Message:
Use pmap_kenter flags to create cached/uncached entries.
#include  when appropriate


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arc/arc/bus_space_sparse.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arc/arc/c_nec_eisa.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/emips/emips/interrupt.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/emips/emips/xilinx_ml40x.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/emips/emips/xs_bee3.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbmips/gdium/machdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/hpcmips/hpcmips/bus_space.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hpcmips/tx/tx3912video.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:15:36 UTC 2016

Modified Files:
src/sys/arch/mips/cavium: octeon_cpunode.c octeon_dma.c octeon_intr.c
octeonvar.h
src/sys/arch/mips/cavium/dev: if_cnmac.c octeon_dwctwo.c
octeon_powvar.h
src/sys/arch/mips/conf: files.mips
src/sys/arch/mips/include: asm.h bus_space_defs.h cache.h cache_ls2.h
cache_mipsNN.h cache_octeon.h cache_r10k.h cache_r3k.h cache_r4k.h
cache_r5900.h cache_r5k.h cache_tx39.h cpu.h cpu_counter.h
cpuregs.h ecoff_machdep.h locore.h mips3_pte.h mipsNN.h
mips_param.h pmap.h pte.h types.h vmparam.h
src/sys/arch/mips/mips: bus_space_alignstride_chipdep.c cache.c
cache_ls2.c cache_mipsNN.c cache_octeon.c cache_r10k.c cache_r3k.c
cache_r4k.c cache_r5k.c cache_tx39.c cpu_subr.c db_interface.c
genassym.cf kgdb_machdep.c lock_stubs_llsc.S lock_stubs_ras.S
locore.S locore_mips1.S locore_mips3.S locore_octeon.S mipsX_subr.S
mips_fixup.c mips_machdep.c pmap_tlb.c trap.c vm_machdep.c
wired_map.c
Added Files:
src/sys/arch/mips/mips: cache_r4k_pcache128.S cache_r4k_pcache16.S
cache_r4k_pcache32.S cache_r4k_pcache64.S cache_r4k_scache128.S
cache_r4k_scache16.S cache_r4k_scache32.S cache_r4k_scache64.S
cache_r4k_subr.S pmap_machdep.c
Removed Files:
src/sys/arch/mips/mips: pmap.c

Log Message:
Change MIPS to use the common pmap code.
Switch to 8KB pages on CPUs with a R4K MMU.
Simplify cache code.
Merge in most of changes from matt-mips64 branch


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/octeon_cpunode.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/octeon_dma.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/octeon_intr.c \
src/sys/arch/mips/cavium/octeonvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/if_cnmac.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_powvar.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/mips/conf/files.mips
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/include/bus_space_defs.h \
src/sys/arch/mips/include/cache_octeon.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/include/cache.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/include/cache_ls2.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/cache_mipsNN.h \
src/sys/arch/mips/include/cpu_counter.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/include/cache_r10k.h \
src/sys/arch/mips/include/cache_r3k.h \
src/sys/arch/mips/include/cache_r5k.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/include/cache_r4k.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/include/cache_r5900.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/include/cache_tx39.h
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/mips/include/ecoff_machdep.h
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/include/mips3_pte.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/include/mipsNN.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mips/include/pte.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/mips/include/types.h
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.24 -r1.25 \
src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mips/mips/cache.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/mips/cache_ls2.c \
src/sys/arch/mips/mips/lock_stubs_llsc.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/mips/cache_mipsNN.c \
src/sys/arch/mips/mips/cache_r5k.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/mips/cache_octeon.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/mips/cache_r10k.c \
src/sys/arch/mips/mips/cache_r3k.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/mips/cache_r4k.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/mips/cache_r4k_pcache128.S \
src/sys/arch/mips/mips/cache_r4k_pcache64.S \
src/sys/arch/mips/mips/cache_r4k_scache128.S \
src/sys/arch/mips/mips/cache_r4k_scache16.S \
src/sys/arch/mips/mips/cache_r4k_scache32.S \
src/sys/arch/mips/mips/cache_r4k_scache64.S \
src/sys/arch/mips/mips/pmap_machdep.c
cvs rdiff -u -r0 -r1.2 src/sys/arch/mips/mips/cache_r4k_pcache16.S \
src/sys/arch/mips/mips/cache_r4k_pcache32.S \
src/sys/arch/mips/mips/cache_r4k_subr.S
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/mips/cache_tx39.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.66 -r1.67 

CVS commit: src/sys/dev

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:13:28 UTC 2016

Modified Files:
src/sys/dev: mm.c mm.h

Log Message:
Add mm_md_page_color hook and use to support better page coloring.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/mm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mm.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mm.c
diff -u src/sys/dev/mm.c:1.20 src/sys/dev/mm.c:1.21
--- src/sys/dev/mm.c:1.20	Sun Jan 17 23:17:04 2016
+++ src/sys/dev/mm.c	Mon Jul 11 16:13:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.20 2016/01/17 23:17:04 christos Exp $	*/
+/*	$NetBSD: mm.c,v 1.21 2016/07/11 16:13:28 matt Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2008, 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mm.c,v 1.20 2016/01/17 23:17:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mm.c,v 1.21 2016/07/11 16:13:28 matt Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -128,11 +128,11 @@ mm_init(void)
  * constant, general mapping address otherwise.
  */
 static inline vaddr_t
-dev_mem_getva(paddr_t pa)
+dev_mem_getva(paddr_t pa, int color)
 {
 #ifdef __HAVE_MM_MD_CACHE_ALIASING
 	return uvm_km_alloc(kernel_map, PAGE_SIZE,
-	atop(pa) & uvmexp.colormask,
+	color & uvmexp.colormask,
 	UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_COLORMATCH);
 #else
 	return dev_mem_addr;
@@ -161,6 +161,7 @@ dev_mem_readwrite(struct uio *uio, struc
 	size_t len, offset;
 	bool have_direct;
 	int error;
+	int color = 0;
 
 	/* Check for wrap around. */
 	if ((intptr_t)uio->uio_offset != uio->uio_offset) {
@@ -175,16 +176,24 @@ dev_mem_readwrite(struct uio *uio, struc
 	offset = uio->uio_offset & PAGE_MASK;
 	len = MIN(uio->uio_resid, PAGE_SIZE - offset);
 
+#ifdef __HAVE_MM_MD_CACHE_ALIASING
+	have_direct = mm_md_page_color(paddr, );
+#else
+	have_direct = true;
+	color = 0;
+#endif
+
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 	/* Is physical address directly mapped?  Return VA. */
-	have_direct = mm_md_direct_mapped_phys(paddr, );
+	if (have_direct)
+		have_direct = mm_md_direct_mapped_phys(paddr, );
 #else
 	vaddr = 0;
 	have_direct = false;
 #endif
 	if (!have_direct) {
 		/* Get a special virtual address. */
-		const vaddr_t va = dev_mem_getva(paddr);
+		const vaddr_t va = dev_mem_getva(paddr, color);
 
 		/* Map selected KVA to physical address. */
 		mutex_enter(_mem_lock);

Index: src/sys/dev/mm.h
diff -u src/sys/dev/mm.h:1.2 src/sys/dev/mm.h:1.3
--- src/sys/dev/mm.h:1.2	Sun Jun 12 03:35:51 2011
+++ src/sys/dev/mm.h	Mon Jul 11 16:13:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.h,v 1.2 2011/06/12 03:35:51 rmind Exp $	*/
+/*	$NetBSD: mm.h,v 1.3 2016/07/11 16:13:28 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger .
@@ -88,8 +88,10 @@ bool	mm_md_direct_mapped_io(void *, padd
 
 /*
  * Some architectures may need to deal with cache aliasing issues.
- *
- * machine/types.h must define __HAVE_MM_MD_CACHE_ALIASING to note that.
+ * Optional hook to fetch a page's current color and returns whether
+ * that page can be direct mapped.
+ * machine/types.h must define __HAVE_MM_MD_CACHE_ALIASING to use this.
  */
+bool	mm_md_page_color(paddr_t, int *);
 
 #endif /* _SYS_DEV_MM_H_ */



CVS commit: src/sys/dev

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:13:28 UTC 2016

Modified Files:
src/sys/dev: mm.c mm.h

Log Message:
Add mm_md_page_color hook and use to support better page coloring.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/mm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mm.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/sys

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:10:10 UTC 2016

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome 7.99.34


To generate a diff of this commit:
cvs rdiff -u -r1.499 -r1.500 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:06:52 UTC 2016

Modified Files:
src/sys/arch/powerpc/booke: booke_machdep.c booke_pmap.c booke_stubs.c
e500_tlb.c
src/sys/arch/powerpc/include/booke: pmap.h pte.h

Log Message:
Adapt to common pmap changes.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/booke/booke_machdep.c \
src/sys/arch/powerpc/booke/booke_pmap.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/booke/booke_stubs.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/booke/e500_tlb.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/include/booke/pmap.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/include/booke/pte.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/arm32

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:09:27 UTC 2016

Modified Files:
src/sys/arch/arm/arm32: arm32_tlb.c

Log Message:
Adapt to common pmap changes.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm32/arm32_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_tlb.c
diff -u src/sys/arch/arm/arm32/arm32_tlb.c:1.9 src/sys/arch/arm/arm32/arm32_tlb.c:1.10
--- src/sys/arch/arm/arm32/arm32_tlb.c:1.9	Thu Mar 26 08:45:05 2015
+++ src/sys/arch/arm/arm32/arm32_tlb.c	Mon Jul 11 16:09:27 2016
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: arm32_tlb.c,v 1.9 2015/03/26 08:45:05 hsuenaga Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_tlb.c,v 1.10 2016/07/11 16:09:27 matt Exp $");
 
 #include 
 #include 
@@ -77,6 +77,7 @@ tlb_invalidate_all(void)
 			armreg_iciallu_write(0);
 		}
 	}
+	arm_dsb();
 	arm_isb();
 }
 
@@ -99,6 +100,7 @@ tlb_invalidate_asids(tlb_asid_t lo, tlb_
 			armreg_tlbiasid_write(lo);
 #endif
 		}
+		arm_dsb();
 		arm_isb();
 		if (__predict_false(vivt_icache_p)) {
 #ifdef MULTIPROCESSOR
@@ -130,7 +132,6 @@ tlb_invalidate_addr(vaddr_t va, tlb_asid
 #endif
 		//armreg_tlbiall_write(asid);
 	}
-	arm_dsb();
 	arm_isb();
 }
 
@@ -143,7 +144,7 @@ tlb_update_addr(vaddr_t va, tlb_asid_t a
 
 #if !defined(MULTIPROCESSOR) && defined(CPU_CORTEXA5)
 static u_int
-tlb_cortex_a5_record_asids(u_long *mapp)
+tlb_cortex_a5_record_asids(u_long *mapp, tlb_asid_t asid_max)
 {
 	u_int nasids = 0;
 	for (size_t va_index = 0; va_index < 63; va_index++) {
@@ -175,7 +176,7 @@ tlb_cortex_a5_record_asids(u_long *mapp)
 
 #if !defined(MULTIPROCESSOR) && defined(CPU_CORTEXA7)
 static u_int
-tlb_cortex_a7_record_asids(u_long *mapp)
+tlb_cortex_a7_record_asids(u_long *mapp, tlb_asid_t asid_max)
 {
 	u_int nasids = 0;
 	for (size_t va_index = 0; va_index < 128; va_index++) {
@@ -207,16 +208,16 @@ tlb_cortex_a7_record_asids(u_long *mapp)
 #endif
 
 u_int
-tlb_record_asids(u_long *mapp)
+tlb_record_asids(u_long *mapp, tlb_asid_t asid_max)
 {
 #ifndef MULTIPROCESSOR
 #ifdef CPU_CORTEXA5
 	if (CPU_ID_CORTEX_A5_P(curcpu()->ci_arm_cpuid))
-		return tlb_cortex_a5_record_asids(mapp);
+		return tlb_cortex_a5_record_asids(mapp, asid_max);
 #endif
 #ifdef CPU_CORTEXA7
 	if (CPU_ID_CORTEX_A7_P(curcpu()->ci_arm_cpuid))
-		return tlb_cortex_a7_record_asids(mapp);
+		return tlb_cortex_a7_record_asids(mapp, asid_max);
 #endif
 #endif /* MULTIPROCESSOR */
 #ifdef DIAGNOSTIC



CVS commit: src/sys/sys

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:10:10 UTC 2016

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome 7.99.34


To generate a diff of this commit:
cvs rdiff -u -r1.499 -r1.500 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.499 src/sys/sys/param.h:1.500
--- src/sys/sys/param.h:1.499	Mon Jul  4 07:44:08 2016
+++ src/sys/sys/param.h	Mon Jul 11 16:10:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.499 2016/07/04 07:44:08 pgoyette Exp $	*/
+/*	$NetBSD: param.h,v 1.500 2016/07/11 16:10:10 matt Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799003300	/* NetBSD 7.99.33 */
+#define	__NetBSD_Version__	799003400	/* NetBSD 7.99.34 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/arch/powerpc

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:06:52 UTC 2016

Modified Files:
src/sys/arch/powerpc/booke: booke_machdep.c booke_pmap.c booke_stubs.c
e500_tlb.c
src/sys/arch/powerpc/include/booke: pmap.h pte.h

Log Message:
Adapt to common pmap changes.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/booke/booke_machdep.c \
src/sys/arch/powerpc/booke/booke_pmap.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/booke/booke_stubs.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/booke/e500_tlb.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/include/booke/pmap.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/include/booke/pte.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/booke/booke_machdep.c
diff -u src/sys/arch/powerpc/booke/booke_machdep.c:1.23 src/sys/arch/powerpc/booke/booke_machdep.c:1.24
--- src/sys/arch/powerpc/booke/booke_machdep.c:1.23	Fri Jan 23 07:27:05 2015
+++ src/sys/arch/powerpc/booke/booke_machdep.c	Mon Jul 11 16:06:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: booke_machdep.c,v 1.23 2015/01/23 07:27:05 nonaka Exp $	*/
+/*	$NetBSD: booke_machdep.c,v 1.24 2016/07/11 16:06:52 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 #define	_POWERPC_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.23 2015/01/23 07:27:05 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.24 2016/07/11 16:06:52 matt Exp $");
 
 #include "opt_modular.h"
 
@@ -130,6 +130,7 @@ struct cpu_info cpu_info[] = {
 		.ci_softc = _softc[0],
 		.ci_cpl = IPL_HIGH,
 		.ci_idepth = -1,
+		.ci_pmap_kern_segtab = _kern_segtab,
 	},
 #ifdef MULTIPROCESSOR
 	[CPU_MAXNUM-1] = {
@@ -138,6 +139,7 @@ struct cpu_info cpu_info[] = {
 		.ci_softc = _softc[CPU_MAXNUM-1],
 		.ci_cpl = IPL_HIGH,
 		.ci_idepth = -1,
+		.ci_pmap_kern_segtab = _kern_segtab,
 	},
 #endif
 };
Index: src/sys/arch/powerpc/booke/booke_pmap.c
diff -u src/sys/arch/powerpc/booke/booke_pmap.c:1.23 src/sys/arch/powerpc/booke/booke_pmap.c:1.24
--- src/sys/arch/powerpc/booke/booke_pmap.c:1.23	Thu Nov  5 06:26:15 2015
+++ src/sys/arch/powerpc/booke/booke_pmap.c	Mon Jul 11 16:06:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: booke_pmap.c,v 1.23 2015/11/05 06:26:15 pgoyette Exp $	*/
+/*	$NetBSD: booke_pmap.c,v 1.24 2016/07/11 16:06:52 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.23 2015/11/05 06:26:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.24 2016/07/11 16:06:52 matt Exp $");
 
 #include 
 #include 
@@ -53,19 +53,11 @@ __KERNEL_RCSID(0, "$NetBSD: booke_pmap.c
 kmutex_t pmap_tlb_miss_lock;
 #endif
 
-/*
- * Initialize the kernel pmap.
- */
-#ifdef MULTIPROCESSOR
-#define	PMAP_SIZE	offsetof(struct pmap, pm_pai[PMAP_TLB_MAX])
-#else
-#define	PMAP_SIZE	sizeof(struct pmap)
-#endif
+PMAP_COUNTER(zeroed_pages, "pages zeroed");
+PMAP_COUNTER(copied_pages, "pages copied");
 
 CTASSERT(sizeof(pmap_segtab_t) == NBPG);
 
-pmap_segtab_t pmap_kernel_segtab;
-
 void
 pmap_procwr(struct proc *p, vaddr_t va, size_t len)
 {
@@ -140,7 +132,7 @@ kvtopte(const pmap_segtab_t *stp, vaddr_
 vaddr_t
 pmap_kvptefill(vaddr_t sva, vaddr_t eva, pt_entry_t pt_entry)
 {
-	const pmap_segtab_t * const stp = pmap_kernel()->pm_segtab;
+	pmap_segtab_t * const stp = _kern_segtab;
 	KASSERT(sva == trunc_page(sva));
 	pt_entry_t *ptep = kvtopte(stp, sva);
 	for (; sva < eva; sva += NBPG) {
@@ -158,13 +150,7 @@ vaddr_t
 pmap_bootstrap(vaddr_t startkernel, vaddr_t endkernel,
 	phys_ram_seg_t *avail, size_t cnt)
 {
-	pmap_segtab_t * const stp = _kernel_segtab;
-
-	/*
-	 * Initialize the kernel segment table.
-	 */
-	pmap_kernel()->pm_segtab = stp;
-	curcpu()->ci_pmap_kern_segtab = stp;
+	pmap_segtab_t * const stp = _kern_segtab;
 
 	KASSERT(endkernel == trunc_page(endkernel));
 
@@ -350,6 +336,7 @@ pmap_md_unmap_poolpage(vaddr_t va, vsize
 void
 pmap_zero_page(paddr_t pa)
 {
+	PMAP_COUNT(zeroed_pages);
 	vaddr_t va = pmap_md_map_poolpage(pa, NBPG);
 	dcache_zero_page(va);
 
@@ -365,6 +352,8 @@ pmap_copy_page(paddr_t src, paddr_t dst)
 	vaddr_t dst_va = pmap_md_map_poolpage(dst, NBPG);
 	const vaddr_t end = src_va + PAGE_SIZE;
 
+	PMAP_COUNT(copied_pages);
+
 	while (src_va < end) {
 		__asm __volatile(
 			"dcbt	%2,%0"	"\n\t"	/* touch next src cacheline */

Index: src/sys/arch/powerpc/booke/booke_stubs.c
diff -u src/sys/arch/powerpc/booke/booke_stubs.c:1.9 src/sys/arch/powerpc/booke/booke_stubs.c:1.10
--- src/sys/arch/powerpc/booke/booke_stubs.c:1.9	Thu Jun 30 00:52:58 2011
+++ src/sys/arch/powerpc/booke/booke_stubs.c	Mon Jul 11 16:06:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: booke_stubs.c,v 1.9 2011/06/30 00:52:58 matt Exp $	*/
+/*	$NetBSD: booke_stubs.c,v 1.10 2016/07/11 

CVS commit: src/sys/arch/arm/arm32

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:09:27 UTC 2016

Modified Files:
src/sys/arch/arm/arm32: arm32_tlb.c

Log Message:
Adapt to common pmap changes.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm32/arm32_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:06:09 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h pmap_segtab.c pmap_synci.c pmap_tlb.c
pmap_tlb.h tlb.h vmpagemd.h
Added Files:
src/sys/uvm/pmap: pmap_synci.h

Log Message:
Changes so that MIPS can use the common pmap.
Change/augment the virtual cache alias callbacks.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.6 -r1.7 src/sys/uvm/pmap/pmap.h
cvs rdiff -u -r1.2 -r1.3 src/sys/uvm/pmap/pmap_segtab.c \
src/sys/uvm/pmap/pmap_synci.c src/sys/uvm/pmap/tlb.h \
src/sys/uvm/pmap/vmpagemd.h
cvs rdiff -u -r0 -r1.1 src/sys/uvm/pmap/pmap_synci.h
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/pmap_tlb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/pmap/pmap_tlb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.14 src/sys/uvm/pmap/pmap.c:1.15
--- src/sys/uvm/pmap/pmap.c:1.14	Thu Jul  7 06:55:44 2016
+++ src/sys/uvm/pmap/pmap.c	Mon Jul 11 16:06:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.14 2016/07/07 06:55:44 msaitoh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.15 2016/07/11 16:06:09 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.14 2016/07/07 06:55:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.15 2016/07/11 16:06:09 matt Exp $");
 
 /*
  *	Manages physical address maps.
@@ -102,22 +102,22 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1
 #define __PMAP_PRIVATE
 
 #include 
-#include 
-#include 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 	/* XXX: for sock_loan_thresh */
 
 #include 
 
-#define	PMAP_COUNT(name)	(pmap_evcnt_##name.ev_count++ + 0)
-#define PMAP_COUNTER(name, desc) \
-static struct evcnt pmap_evcnt_##name = \
-	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "pmap", desc); \
-EVCNT_ATTACH_STATIC(pmap_evcnt_##name)
+#if defined(MULTIPROCESSOR) && defined(PMAP_VIRTUAL_CACHE_ALIASES) \
+&& !defined(PMAP_NO_PV_UNCACHED)
+#error PMAP_VIRTUAL_CACHE_ALIASES with MULTIPROCESSOR requires \
+ PMAP_NO_PV_UNCACHED to be defined
+#endif
 
 PMAP_COUNTER(remove_kernel_calls, "remove kernel calls");
 PMAP_COUNTER(remove_kernel_pages, "kernel pages unmapped");
@@ -132,8 +132,6 @@ PMAP_COUNTER(prefer_requests, "prefer re
 PMAP_COUNTER(prefer_adjustments, "prefer adjustments");
 
 PMAP_COUNTER(idlezeroed_pages, "pages idle zeroed");
-PMAP_COUNTER(zeroed_pages, "pages zeroed");
-PMAP_COUNTER(copied_pages, "pages copied");
 
 PMAP_COUNTER(kenter_pa, "kernel fast mapped pages");
 PMAP_COUNTER(kenter_pa_bad, "kernel fast mapped pages (bad color)");
@@ -190,20 +188,22 @@ PMAP_COUNTER(page_protect, "page_protect
 #define PMAP_ASID_RESERVED 0
 CTASSERT(PMAP_ASID_RESERVED == 0);
 
-/*
- * Initialize the kernel pmap.
- */
-#ifdef MULTIPROCESSOR
-#define	PMAP_SIZE	offsetof(struct pmap, pm_pai[PMAP_TLB_MAX])
-#else
-#define	PMAP_SIZE	sizeof(struct pmap)
-kmutex_t pmap_pvlist_mutex __aligned(COHERENCY_UNIT);
+#ifndef PMAP_SEGTAB_ALIGN
+#define PMAP_SEGTAB_ALIGN	/* nothing */
+#endif
+#ifdef _LP64
+pmap_segtab_t	pmap_kstart_segtab PMAP_SEGTAB_ALIGN; /* first mid-level segtab for kernel */
+#endif
+pmap_segtab_t	pmap_kern_segtab PMAP_SEGTAB_ALIGN = { /* top level segtab for kernel */
+#ifdef _LP64
+	.seg_seg[(VM_MIN_KERNEL_ADDRESS & XSEGOFSET) >> SEGSHIFT] = _kstart_segtab,
 #endif
+};
 
 struct pmap_kernel kernel_pmap_store = {
 	.kernel_pmap = {
 		.pm_count = 1,
-		.pm_segtab = PMAP_INVALID_SEGTAB_ADDRESS,
+		.pm_segtab = _kern_segtab,
 		.pm_minaddr = VM_MIN_KERNEL_ADDRESS,
 		.pm_maxaddr = VM_MAX_KERNEL_ADDRESS,
 	},
@@ -211,7 +211,7 @@ struct pmap_kernel kernel_pmap_store = {
 
 struct pmap * const kernel_pmap_ptr = _pmap_store.kernel_pmap;
 
-struct pmap_limits pmap_limits = {
+struct pmap_limits pmap_limits = {	/* VA and PA limits */
 	.virtual_start = VM_MIN_KERNEL_ADDRESS,
 };
 
@@ -231,23 +231,24 @@ struct pool pmap_pv_pool;
 #ifndef PMAP_PV_LOWAT
 #define	PMAP_PV_LOWAT	16
 #endif
-int		pmap_pv_lowat = PMAP_PV_LOWAT;
+int	pmap_pv_lowat = PMAP_PV_LOWAT;
 
-bool		pmap_initialized = false;
+bool	pmap_initialized = false;
 #define	PMAP_PAGE_COLOROK_P(a, b) \
 		int)(a) ^ (int)(b)) & pmap_page_colormask) == 0)
-u_int		pmap_page_colormask;
+u_int	pmap_page_colormask;
 
-#define PAGE_IS_MANAGED(pa)	\
-	(pmap_initialized == true && vm_physseg_find(atop(pa), NULL) != -1)
+#define PAGE_IS_MANAGED(pa)	(pmap_initialized && uvm_pageismanaged(pa))
 
 #define PMAP_IS_ACTIVE(pm)		\
 	((pm) == pmap_kernel() || 	\
 	 (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap)
 
 /* Forward function declarations */
+void pmap_page_remove(struct vm_page *);
+static void pmap_pvlist_check(struct vm_page_md *);
 void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool);
-void 

CVS commit: src/sys/uvm/pmap

2016-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 16:06:09 UTC 2016

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h pmap_segtab.c pmap_synci.c pmap_tlb.c
pmap_tlb.h tlb.h vmpagemd.h
Added Files:
src/sys/uvm/pmap: pmap_synci.h

Log Message:
Changes so that MIPS can use the common pmap.
Change/augment the virtual cache alias callbacks.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.6 -r1.7 src/sys/uvm/pmap/pmap.h
cvs rdiff -u -r1.2 -r1.3 src/sys/uvm/pmap/pmap_segtab.c \
src/sys/uvm/pmap/pmap_synci.c src/sys/uvm/pmap/tlb.h \
src/sys/uvm/pmap/vmpagemd.h
cvs rdiff -u -r0 -r1.1 src/sys/uvm/pmap/pmap_synci.h
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/pmap_tlb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/pmap/pmap_tlb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbmips/conf

2016-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 03:45:59 UTC 2016

Modified Files:
src/sys/arch/evbmips/conf: INSTALL_MALTA32

Log Message:
Add makeoptionsNEED_MDSETIMAGE="yes"


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/conf/INSTALL_MALTA32

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbmips/conf/INSTALL_MALTA32
diff -u src/sys/arch/evbmips/conf/INSTALL_MALTA32:1.2 src/sys/arch/evbmips/conf/INSTALL_MALTA32:1.3
--- src/sys/arch/evbmips/conf/INSTALL_MALTA32:1.2	Mon Dec 14 00:46:01 2009
+++ src/sys/arch/evbmips/conf/INSTALL_MALTA32	Mon Jul 11 03:45:59 2016
@@ -1,8 +1,8 @@
-# $NetBSD: INSTALL_MALTA32,v 1.2 2009/12/14 00:46:01 matt Exp $
+# $NetBSD: INSTALL_MALTA32,v 1.3 2016/07/11 03:45:59 matt Exp $
 
 include		"arch/evbmips/conf/MALTA32"
 
-#ident 		"INSTALL_MALTA32-$Revision: 1.2 $"
+#ident 		"INSTALL_MALTA32-$Revision: 1.3 $"
 
 # Enable the hooks used for initializing the root memory-disk.
 # The ramdisk size must be kept in sync manually with the size of
@@ -12,3 +12,7 @@ options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# force root on memory disk
 options 	MEMORY_DISK_SERVER=0		# no userspace memory disk
 options 	MEMORY_DISK_ROOT_SIZE=12288	# size of memory disk, in blocks
+
+#options 	UVMHIST
+#options 	UVMHIST_PRINT
+makeoptions	NEED_MDSETIMAGE="yes"



CVS commit: src/sys/arch/evbmips/conf

2016-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 03:45:59 UTC 2016

Modified Files:
src/sys/arch/evbmips/conf: INSTALL_MALTA32

Log Message:
Add makeoptionsNEED_MDSETIMAGE="yes"


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/conf/INSTALL_MALTA32

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2016-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 01:50:17 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Add machdep.fpu_present sysctl node


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/sys/arch/mips/mips/mips_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.269 src/sys/arch/mips/mips/mips_machdep.c:1.270
--- src/sys/arch/mips/mips/mips_machdep.c:1.269	Thu Jun 11 15:48:57 2015
+++ src/sys/arch/mips/mips/mips_machdep.c	Mon Jul 11 01:50:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.269 2015/06/11 15:48:57 matt Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.270 2016/07/11 01:50:17 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.269 2015/06/11 15:48:57 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.270 2016/07/11 01:50:17 matt Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -1719,6 +1719,16 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		   NULL, MIPS_HAS_LMMI, NULL, 0,
 		   CTL_MACHDEP, CPU_LMMI, CTL_EOL);
 #endif
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+   CTLTYPE_INT, "fpu_present", NULL,
+   NULL,
+#ifdef NOFPU
+		   0,
+#else
+		   1,
+#endif
+		   NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 }
 
 /*



CVS commit: src/sys/arch/mips/mips

2016-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 11 01:50:17 UTC 2016

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Add machdep.fpu_present sysctl node


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/sys/arch/mips/mips/mips_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/rump

2016-07-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul  9 05:52:22 UTC 2016

Modified Files:
src/sys/rump: Makefile.rump

Log Message:
Pass down ${CPUFLAGS}


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/rump/Makefile.rump

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/rump

2016-07-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul  9 05:52:22 UTC 2016

Modified Files:
src/sys/rump: Makefile.rump

Log Message:
Pass down ${CPUFLAGS}


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/rump/Makefile.rump

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/Makefile.rump
diff -u src/sys/rump/Makefile.rump:1.120 src/sys/rump/Makefile.rump:1.121
--- src/sys/rump/Makefile.rump:1.120	Sun Nov 15 13:50:10 2015
+++ src/sys/rump/Makefile.rump	Sat Jul  9 05:52:22 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rump,v 1.120 2015/11/15 13:50:10 pooka Exp $
+#	$NetBSD: Makefile.rump,v 1.121 2016/07/09 05:52:22 matt Exp $
 #
 
 .if !defined(_RUMP_MK)
@@ -149,19 +149,19 @@ RUMPCOMP_USER_WERROR = ${${_NOWERROR} ==
 .for rcusrc in ${RUMPCOMP_USER_SRCS:R}
 ${rcusrc}.d: ${rcusrc}.c
 	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c}
+	${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${CPUFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c}
 
 ${rcusrc}.o: ${rcusrc}.c
 	${_MKTARGET_COMPILE}
-	${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
+	${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
 
 ${rcusrc}.pico: ${rcusrc}.c
 	${_MKTARGET_COMPILE}
-	${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
+	${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
 
 ${rcusrc}.po: ${rcusrc}.c
 	${_MKTARGET_COMPILE}
-	${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
+	${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
 
 RUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po
 SRCS+=${rcusrc}.c



CVS commit: src/share/mk

2016-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  7 20:52:53 UTC 2016

Modified Files:
src/share/mk: bsd.sys.mk

Log Message:
Add placeholder for compiing earmv7* with -mthumb.
Preserve $d/$a/$t for all ARM binaries regardless of endian.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/share/mk/bsd.sys.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/mk

2016-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  7 20:52:53 UTC 2016

Modified Files:
src/share/mk: bsd.sys.mk

Log Message:
Add placeholder for compiing earmv7* with -mthumb.
Preserve $d/$a/$t for all ARM binaries regardless of endian.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/share/mk/bsd.sys.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.259 src/share/mk/bsd.sys.mk:1.260
--- src/share/mk/bsd.sys.mk:1.259	Tue Jun 14 13:26:45 2016
+++ src/share/mk/bsd.sys.mk	Thu Jul  7 20:52:53 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.259 2016/06/14 13:26:45 christos Exp $
+#	$NetBSD: bsd.sys.mk,v 1.260 2016/07/07 20:52:53 matt Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -159,6 +159,11 @@ COPTS+=		-mhard-float
 FOPTS+=		-mhard-float
 .endif
 
+#.if !empty(MACHINE_ARCH:Mearmv7*)
+#COPTS+=		-mthumb
+#FOPTS+=		-mthumb
+#.endif
+
 .if ${MKIEEEFP:Uno} != "no"
 .if ${MACHINE_ARCH} == "alpha"
 CFLAGS+=	-mieee
@@ -289,7 +294,7 @@ YFLAGS+=	${YPREFIX:D-p${YPREFIX}} ${YHEA
 .if ${MACHINE_ARCH} == aarch64eb
 # AARCH64 big endian needs to preserve $x/$d symbols for the linker.
 OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -K '[$$][dx]\.*'
-.elif !empty(MACHINE_ARCH:M*arm*eb)
+.elif ${MACHINE_CPU} == "arm"
 # ARM big endian needs to preserve $a/$d/$t symbols for the linker.
 OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*'
 .endif



CVS commit: src/distrib/evbppc/ramdisk

2016-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  7 06:28:57 UTC 2016

Modified Files:
src/distrib/evbppc/ramdisk: list

Log Message:
Add sbin/sysctl


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/evbppc/ramdisk/list

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/evbppc/ramdisk/list
diff -u src/distrib/evbppc/ramdisk/list:1.20 src/distrib/evbppc/ramdisk/list:1.21
--- src/distrib/evbppc/ramdisk/list:1.20	Tue Jul 24 20:50:14 2012
+++ src/distrib/evbppc/ramdisk/list	Thu Jul  7 06:28:57 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.20 2012/07/24 20:50:14 matt Exp $
+#	$NetBSD: list,v 1.21 2016/07/07 06:28:57 matt Exp $
 
 SRCDIRS	bin sbin usr.bin usr.sbin
 
@@ -54,6 +54,7 @@ PROG	sbin/restore	sbin/rrestore
 PROG	sbin/route
 PROG	sbin/shutdown
 PROG	sbin/swapctl
+PROG	sbin/sysctl
 PROG	sbin/umount
 
 PROG	usr/bin/cksum	usr/bin/md5	usr/bin/sha1	usr/bin/sum



CVS commit: src/distrib/evbppc/ramdisk

2016-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  7 06:28:57 UTC 2016

Modified Files:
src/distrib/evbppc/ramdisk: list

Log Message:
Add sbin/sysctl


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/evbppc/ramdisk/list

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/evbarm/instkernel/ramdisk

2016-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  7 06:28:20 UTC 2016

Modified Files:
src/distrib/evbarm/instkernel/ramdisk: Makefile

Log Message:
When building earmv7 ramdisks, compile with -mthumb -mthumb-interwork
to save space.  Think of it as -Os on steriods.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/distrib/evbarm/instkernel/ramdisk/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/evbarm/instkernel/ramdisk/Makefile
diff -u src/distrib/evbarm/instkernel/ramdisk/Makefile:1.13 src/distrib/evbarm/instkernel/ramdisk/Makefile:1.14
--- src/distrib/evbarm/instkernel/ramdisk/Makefile:1.13	Thu Jan  9 22:48:16 2014
+++ src/distrib/evbarm/instkernel/ramdisk/Makefile	Thu Jul  7 06:28:20 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2014/01/09 22:48:16 matt Exp $
+#	$NetBSD: Makefile,v 1.14 2016/07/07 06:28:20 matt Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -9,6 +9,9 @@ MAKEFS_FLAGS=	-f 15
 
 WARNS=		1
 DBG=		-Os
+.if !empty(MACHINE_ARCH:Mearmv7*)
+DBG+=		-mthumb -mthumb-interwork
+.endif
 
 CRUNCHBIN=	ramdiskbin
 LISTS=		${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst



CVS commit: src/distrib/evbarm/instkernel/ramdisk

2016-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  7 06:28:20 UTC 2016

Modified Files:
src/distrib/evbarm/instkernel/ramdisk: Makefile

Log Message:
When building earmv7 ramdisks, compile with -mthumb -mthumb-interwork
to save space.  Think of it as -Os on steriods.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/distrib/evbarm/instkernel/ramdisk/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2015-09-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep 21 15:50:19 UTC 2015

Modified Files:
src/sys/uvm/pmap: tlb.h

Log Message:
Update multiple inclusion macro


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/uvm/pmap/tlb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/arm32

2015-08-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 24 04:51:18 UTC 2015

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Fix mbuf dmasyncing for extended MMU kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/arm/arm32/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/arm32

2015-08-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 24 04:51:18 UTC 2015

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Fix mbuf dmasyncing for extended MMU kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/arm/arm32/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.92 src/sys/arch/arm/arm32/bus_dma.c:1.93
--- src/sys/arch/arm/arm32/bus_dma.c:1.92	Fri Aug 21 20:52:47 2015
+++ src/sys/arch/arm/arm32/bus_dma.c	Mon Aug 24 04:51:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.92 2015/08/21 20:52:47 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.93 2015/08/24 04:51:18 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include opt_arm_bus_space.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.92 2015/08/21 20:52:47 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.93 2015/08/24 04:51:18 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -775,13 +775,19 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 
 	switch (ops) {
 	case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE:
+#ifdef ARM_MMU_EXTENDED
+		(void)readonly_p;
+#else
 		if (!readonly_p) {
+#endif
 			STAT_INCR(sync_prereadwrite);
 			cpu_dcache_wbinv_range(va, len);
 			cpu_sdcache_wbinv_range(va, pa, len);
 			break;
+#ifndef ARM_MMU_EXTENDED
 		}
 		/* FALLTHROUGH */
+#endif
 
 	case BUS_DMASYNC_PREREAD: {
 		const size_t line_size = arm_dcache_align;
@@ -909,7 +915,8 @@ _bus_dmamap_sync_mbuf(bus_dma_tag_t t, b
 
 		/*
 		 * We can save a lot of work here if we know the mapping
-		 * is read-only at the MMU:
+		 * is read-only at the MMU and we aren't using the armv6+
+		 * MMU:
 		 *
 		 * If a mapping is read-only, no dirty cache blocks will
 		 * exist for it.  If a writable mapping was made read-only,



  1   2   3   4   5   6   7   8   9   10   >