[Midnightbsd-cvs] src [10058] trunk/sys/dev: sync with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun May 27 18:54:45 EDT 2018
Revision: 10058
http://svnweb.midnightbsd.org/src/?rev=10058
Author: laffer1
Date: 2018-05-27 18:54:44 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync with freebsd
Modified Paths:
--------------
trunk/sys/dev/tdfx/tdfx_io.h
trunk/sys/dev/tdfx/tdfx_linux.c
trunk/sys/dev/tdfx/tdfx_linux.h
trunk/sys/dev/tdfx/tdfx_pci.c
trunk/sys/dev/tdfx/tdfx_pci.h
trunk/sys/dev/tdfx/tdfx_vars.h
trunk/sys/dev/tpm/tpm.c
trunk/sys/dev/tpm/tpm_acpi.c
trunk/sys/dev/tpm/tpm_isa.c
trunk/sys/dev/tpm/tpmvar.h
trunk/sys/dev/trm/trm.c
trunk/sys/dev/trm/trm.h
trunk/sys/dev/tsec/if_tsec.c
trunk/sys/dev/tsec/if_tsec.h
trunk/sys/dev/tsec/if_tsec_fdt.c
trunk/sys/dev/tsec/if_tsecreg.h
trunk/sys/dev/twa/tw_cl.h
trunk/sys/dev/twa/tw_cl_externs.h
trunk/sys/dev/twa/tw_cl_fwif.h
trunk/sys/dev/twa/tw_cl_init.c
trunk/sys/dev/twa/tw_cl_intr.c
trunk/sys/dev/twa/tw_cl_io.c
trunk/sys/dev/twa/tw_cl_ioctl.h
trunk/sys/dev/twa/tw_cl_misc.c
trunk/sys/dev/twa/tw_cl_share.h
trunk/sys/dev/twa/tw_osl.h
trunk/sys/dev/twa/tw_osl_cam.c
trunk/sys/dev/twa/tw_osl_externs.h
trunk/sys/dev/twa/tw_osl_freebsd.c
trunk/sys/dev/twa/tw_osl_includes.h
trunk/sys/dev/twa/tw_osl_inline.h
trunk/sys/dev/twa/tw_osl_ioctl.h
trunk/sys/dev/twa/tw_osl_share.h
trunk/sys/dev/twa/tw_osl_types.h
trunk/sys/dev/tws/tws.c
trunk/sys/dev/tws/tws.h
trunk/sys/dev/tws/tws_cam.c
trunk/sys/dev/tws/tws_hdm.c
trunk/sys/dev/tws/tws_hdm.h
trunk/sys/dev/tws/tws_services.c
trunk/sys/dev/tws/tws_services.h
trunk/sys/dev/tws/tws_user.c
trunk/sys/dev/tws/tws_user.h
trunk/sys/dev/tx/if_tx.c
trunk/sys/dev/tx/if_txreg.h
trunk/sys/dev/tx/if_txvar.h
trunk/sys/dev/txp/3c990img.h
trunk/sys/dev/txp/if_txp.c
trunk/sys/dev/txp/if_txpreg.h
Added Paths:
-----------
trunk/sys/dev/terasic/
trunk/sys/dev/terasic/de4led/
trunk/sys/dev/terasic/de4led/terasic_de4led.c
trunk/sys/dev/terasic/de4led/terasic_de4led.h
trunk/sys/dev/terasic/de4led/terasic_de4led_fdt.c
trunk/sys/dev/terasic/de4led/terasic_de4led_nexus.c
trunk/sys/dev/terasic/mtl/
trunk/sys/dev/terasic/mtl/terasic_mtl.c
trunk/sys/dev/terasic/mtl/terasic_mtl.h
trunk/sys/dev/terasic/mtl/terasic_mtl_fdt.c
trunk/sys/dev/terasic/mtl/terasic_mtl_nexus.c
trunk/sys/dev/terasic/mtl/terasic_mtl_pixel.c
trunk/sys/dev/terasic/mtl/terasic_mtl_reg.c
trunk/sys/dev/terasic/mtl/terasic_mtl_syscons.c
trunk/sys/dev/terasic/mtl/terasic_mtl_text.c
Modified: trunk/sys/dev/tdfx/tdfx_io.h
===================================================================
--- trunk/sys/dev/tdfx/tdfx_io.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tdfx/tdfx_io.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2001 by Coleman Kane <cokane at FreeBSD.org>
* All rights reserved.
@@ -28,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tdfx/tdfx_io.h 139749 2005-01-06 01:43:34Z imp $
*/
/* This code originally came from <shocking at prth.pgs.com>
Modified: trunk/sys/dev/tdfx/tdfx_linux.c
===================================================================
--- trunk/sys/dev/tdfx/tdfx_linux.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tdfx/tdfx_linux.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 The FreeBSD Project
* All rights reserved.
@@ -25,10 +26,10 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tdfx/tdfx_linux.c 280258 2015-03-19 13:37:36Z rwatson $");
#include <sys/param.h>
-#include <sys/capability.h>
+#include <sys/capsicum.h>
#include <sys/file.h>
#include <sys/kernel.h>
#include <sys/module.h>
@@ -45,6 +46,7 @@
static int
linux_ioctl_tdfx(struct thread *td, struct linux_ioctl_args* args)
{
+ cap_rights_t rights;
int error = 0;
u_long cmd = args->cmd & 0xffff;
@@ -54,7 +56,8 @@
struct file *fp;
- if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0)
+ error = fget(td, args->fd, cap_rights_init(&rights, CAP_IOCTL), &fp);
+ if (error != 0)
return (error);
/* We simply copy the data and send it right to ioctl */
copyin((caddr_t)args->arg, &d_pio, sizeof(d_pio));
Modified: trunk/sys/dev/tdfx/tdfx_linux.h
===================================================================
--- trunk/sys/dev/tdfx/tdfx_linux.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tdfx/tdfx_linux.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2001 by Coleman Kane <cokane at FreeBSD.org>
* All rights reserved.
@@ -28,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tdfx/tdfx_linux.h 139749 2005-01-06 01:43:34Z imp $
*/
Modified: trunk/sys/dev/tdfx/tdfx_pci.c
===================================================================
--- trunk/sys/dev/tdfx/tdfx_pci.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tdfx/tdfx_pci.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2001 by Coleman Kane <cokane at FreeBSD.org>
* All rights reserved.
@@ -30,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tdfx/tdfx_pci.c 254263 2013-08-12 23:30:01Z scottl $");
/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET
*
@@ -145,7 +146,6 @@
* small, whole number.
*/
struct tdfx_softc *tdfx_info;
- u_long val;
/* rid value tells bus_alloc_resource where to find the addresses of ports or
* of memory ranges in the PCI config space*/
int rid = PCIR_BAR(0);
@@ -153,12 +153,6 @@
/* Increment the card counter (for the ioctl code) */
tdfx_count++;
- /* Enable MemMap on Voodoo */
- val = pci_read_config(dev, PCIR_COMMAND, 2);
- val |= (PCIM_CMD_MEMEN);
- pci_write_config(dev, PCIR_COMMAND, val, 2);
- val = pci_read_config(dev, PCIR_COMMAND, 2);
-
/* Fill the soft config struct with info about this device*/
tdfx_info = device_get_softc(dev);
tdfx_info->dev = dev;
Modified: trunk/sys/dev/tdfx/tdfx_pci.h
===================================================================
--- trunk/sys/dev/tdfx/tdfx_pci.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tdfx/tdfx_pci.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2001 by Coleman Kane <cokane at FreeBSD.org>
* All rights reserved.
@@ -28,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tdfx/tdfx_pci.h 139749 2005-01-06 01:43:34Z imp $
*/
/* tdfx_pci.h -- Prototypes for tdfx device methods */
Modified: trunk/sys/dev/tdfx/tdfx_vars.h
===================================================================
--- trunk/sys/dev/tdfx/tdfx_vars.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tdfx/tdfx_vars.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2001 by Coleman Kane <cokane at FreeBSD.org>
* All rights reserved.
@@ -28,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tdfx/tdfx_vars.h 139749 2005-01-06 01:43:34Z imp $
*/
/* tdfx_vars.h -- constants and structs used in the tdfx driver
Added: trunk/sys/dev/terasic/de4led/terasic_de4led.c
===================================================================
--- trunk/sys/dev/terasic/de4led/terasic_de4led.c (rev 0)
+++ trunk/sys/dev/terasic/de4led/terasic_de4led.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,191 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/de4led/terasic_de4led.c 245380 2013-01-13 16:57:11Z rwatson $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/led/led.h>
+#include <dev/terasic/de4led/terasic_de4led.h>
+
+devclass_t terasic_de4led_devclass;
+
+static void
+terasic_de4led_update(struct terasic_de4led_softc *sc)
+{
+
+ TERASIC_DE4LED_LOCK_ASSERT(sc);
+
+ bus_write_1(sc->tdl_res, TERASIC_DE4LED_OFF_LED, sc->tdl_bits);
+}
+
+static void
+led_update(struct terasic_de4led_softc *sc, int bit, int onoff)
+{
+
+ TERASIC_DE4LED_LOCK(sc);
+ TERASIC_DE4LED_SETLED(sc, bit, onoff);
+ terasic_de4led_update(sc);
+ TERASIC_DE4LED_UNLOCK(sc);
+}
+
+static void
+led_0(void *arg, int onoff)
+{
+
+ led_update(arg, 0, onoff);
+}
+
+static void
+led_1(void *arg, int onoff)
+{
+
+ led_update(arg, 1, onoff);
+}
+
+static void
+led_2(void *arg, int onoff)
+{
+
+ led_update(arg, 2, onoff);
+}
+
+static void
+led_3(void *arg, int onoff)
+{
+
+ led_update(arg, 3, onoff);
+}
+
+static void
+led_4(void *arg, int onoff)
+{
+
+ led_update(arg, 4, onoff);
+}
+
+static void
+led_5(void *arg, int onoff)
+{
+
+ led_update(arg, 5, onoff);
+}
+
+static void
+led_6(void *arg, int onoff)
+{
+
+ led_update(arg, 6, onoff);
+}
+
+static void
+led_7(void *arg, int onoff)
+{
+
+ led_update(arg, 7, onoff);
+}
+
+void
+terasic_de4led_attach(struct terasic_de4led_softc *sc)
+{
+ const char *cmd;
+
+ TERASIC_DE4LED_LOCK_INIT(sc);
+
+ /*
+ * Clear the LED array before we start.
+ */
+ TERASIC_DE4LED_LOCK(sc);
+ TERASIC_DE4LED_CLEARBAR(sc);
+ terasic_de4led_update(sc);
+ TERASIC_DE4LED_UNLOCK(sc);
+
+ /*
+ * Register the LED array with led(4).
+ */
+ sc->tdl_leds[0] = led_create(led_0, sc, "de4led_0");
+ sc->tdl_leds[1] = led_create(led_1, sc, "de4led_1");
+ sc->tdl_leds[2] = led_create(led_2, sc, "de4led_2");
+ sc->tdl_leds[3] = led_create(led_3, sc, "de4led_3");
+ sc->tdl_leds[4] = led_create(led_4, sc, "de4led_4");
+ sc->tdl_leds[5] = led_create(led_5, sc, "de4led_5");
+ sc->tdl_leds[6] = led_create(led_6, sc, "de4led_6");
+ sc->tdl_leds[7] = led_create(led_7, sc, "de4led_7");
+
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_0_cmd", &cmd) == 0)
+ led_set("de4led_0", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_1_cmd", &cmd) == 0)
+ led_set("de4led_1", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_2_cmd", &cmd) == 0)
+ led_set("de4led_2", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_3_cmd", &cmd) == 0)
+ led_set("de4led_3", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_4_cmd", &cmd) == 0)
+ led_set("de4led_4", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_5_cmd", &cmd) == 0)
+ led_set("de4led_5", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_6_cmd", &cmd) == 0)
+ led_set("de4led_6", cmd);
+ if (resource_string_value(device_get_name(sc->tdl_dev),
+ sc->tdl_unit, "de4led_7_cmd", &cmd) == 0)
+ led_set("de4led_7", cmd);
+}
+
+void
+terasic_de4led_detach(struct terasic_de4led_softc *sc)
+{
+ int i;
+
+ for (i = 0; i < 8; i++) {
+ led_destroy(sc->tdl_leds[i]);
+ sc->tdl_leds[i] = NULL;
+ }
+ TERASIC_DE4LED_LOCK(sc);
+ TERASIC_DE4LED_CLEARBAR(sc);
+ terasic_de4led_update(sc);
+ TERASIC_DE4LED_UNLOCK(sc);
+ TERASIC_DE4LED_LOCK_DESTROY(sc);
+}
Property changes on: trunk/sys/dev/terasic/de4led/terasic_de4led.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/de4led/terasic_de4led.h
===================================================================
--- trunk/sys/dev/terasic/de4led/terasic_de4led.h (rev 0)
+++ trunk/sys/dev/terasic/de4led/terasic_de4led.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,78 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/dev/terasic/de4led/terasic_de4led.h 245380 2013-01-13 16:57:11Z rwatson $
+ */
+
+#ifndef _DEV_TERASIC_DE4LED_H_
+#define _DEV_TERASIC_DE4LED_H_
+
+#define TERASIC_DE4LED_NUMLEDS 8
+struct terasic_de4led_softc {
+ device_t tdl_dev;
+ int tdl_unit;
+ struct resource *tdl_res;
+ int tdl_rid;
+ struct mtx tdl_lock;
+ uint8_t tdl_bits;
+ struct cdev *tdl_leds[TERASIC_DE4LED_NUMLEDS];
+};
+
+#define TERASIC_DE4LED_LOCK(sc) mtx_lock(&(sc)->tdl_lock)
+#define TERASIC_DE4LED_LOCK_ASSERT(sc) mtx_assert(&(sc)->tdl_lock, MA_OWNED)
+#define TERASIC_DE4LED_LOCK_DESTROY(sc) mtx_destroy(&(sc)->tdl_lock)
+#define TERASIC_DE4LED_LOCK_INIT(sc) mtx_init(&(sc)->tdl_lock, \
+ "terasic_de4led", NULL, MTX_DEF)
+#define TERASIC_DE4LED_UNLOCK(sc) mtx_unlock(&(sc)->tdl_lock)
+
+/*
+ * Setting and clearing LEDs. tdl_bits is in the bit order preferred for I/O.
+ * The LED elements are labelled 1..8 on the DE-4, so bit 0 is LED 1, and so
+ * on.
+ */
+#define TERASIC_DE4LED_CLEARBAR(sc) do { \
+ (sc)->tdl_bits = 0; \
+} while (0)
+#define TERASIC_DE4LED_SETLED(sc, led, onoff) do { \
+ (sc)->tdl_bits &= ~(1 << (led)); \
+ (sc)->tdl_bits |= ((onoff != 0) ? 1 : 0) << (led); \
+} while (0)
+
+/*
+ * Only one offset matters for this device -- 0.
+ */
+#define TERASIC_DE4LED_OFF_LED 0
+
+void terasic_de4led_attach(struct terasic_de4led_softc *sc);
+void terasic_de4led_detach(struct terasic_de4led_softc *sc);
+
+extern devclass_t terasic_de4led_devclass;
+
+#endif /* _DEV_TERASIC_DE4LED_H_ */
Property changes on: trunk/sys/dev/terasic/de4led/terasic_de4led.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/de4led/terasic_de4led_fdt.c
===================================================================
--- trunk/sys/dev/terasic/de4led/terasic_de4led_fdt.c (rev 0)
+++ trunk/sys/dev/terasic/de4led/terasic_de4led_fdt.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,122 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/de4led/terasic_de4led_fdt.c 266152 2014-05-15 16:11:06Z ian $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/bio.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <dev/terasic/de4led/terasic_de4led.h>
+
+/*
+ * Nexus bus attachment for the 8-element LED on the Terasic DE-4 FPGA board,
+ * which is hooked up to the processor via a memory-mapped Avalon bus.
+ */
+static int
+terasic_de4led_fdt_probe(device_t dev)
+{
+
+ if (!ofw_bus_status_okay(dev))
+ return (ENXIO);
+
+ if (ofw_bus_is_compatible(dev, "sri-cambridge,de4led")) {
+ device_set_desc(dev, "Terasic DE4 8-element LED");
+ return (BUS_PROBE_DEFAULT);
+ }
+ return (ENXIO);
+}
+
+static int
+terasic_de4led_fdt_attach(device_t dev)
+{
+ struct terasic_de4led_softc *sc;
+
+ sc = device_get_softc(dev);
+ sc->tdl_dev = dev;
+ sc->tdl_unit = device_get_unit(dev);
+ sc->tdl_rid = 0;
+ sc->tdl_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &sc->tdl_rid, RF_ACTIVE);
+ if (sc->tdl_res == NULL) {
+ device_printf(dev, "couldn't map memory\n");
+ return (ENXIO);
+ }
+ terasic_de4led_attach(sc);
+ return (0);
+}
+
+static int
+terasic_de4led_fdt_detach(device_t dev)
+{
+ struct terasic_de4led_softc *sc;
+
+ sc = device_get_softc(dev);
+ KASSERT(sc->tdl_res != NULL, ("%s: resources not allocated",
+ __func__));
+ terasic_de4led_detach(sc);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->tdl_rid, sc->tdl_res);
+ return (0);
+}
+
+static device_method_t terasic_de4led_fdt_methods[] = {
+ DEVMETHOD(device_probe, terasic_de4led_fdt_probe),
+ DEVMETHOD(device_attach, terasic_de4led_fdt_attach),
+ DEVMETHOD(device_detach, terasic_de4led_fdt_detach),
+ { 0, 0 }
+};
+
+static driver_t terasic_de4led_fdt_driver = {
+ "terasic_de4led",
+ terasic_de4led_fdt_methods,
+ sizeof(struct terasic_de4led_softc),
+};
+
+DRIVER_MODULE(terasic_de4led, simplebus, terasic_de4led_fdt_driver,
+ terasic_de4led_devclass, 0, 0);
Property changes on: trunk/sys/dev/terasic/de4led/terasic_de4led_fdt.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/de4led/terasic_de4led_nexus.c
===================================================================
--- trunk/sys/dev/terasic/de4led/terasic_de4led_nexus.c (rev 0)
+++ trunk/sys/dev/terasic/de4led/terasic_de4led_nexus.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,111 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/de4led/terasic_de4led_nexus.c 265999 2014-05-14 01:35:43Z ian $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/bio.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/terasic/de4led/terasic_de4led.h>
+
+/*
+ * Nexus bus attachment for the 8-element LED on the Terasic DE-4 FPGA board,
+ * which is hooked up to the processor via a memory-mapped Avalon bus.
+ */
+static int
+terasic_de4led_nexus_probe(device_t dev)
+{
+
+ device_set_desc(dev, "Terasic DE4 8-element LED");
+ return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+terasic_de4led_nexus_attach(device_t dev)
+{
+ struct terasic_de4led_softc *sc;
+
+ sc = device_get_softc(dev);
+ sc->tdl_dev = dev;
+ sc->tdl_unit = device_get_unit(dev);
+ sc->tdl_rid = 0;
+ sc->tdl_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &sc->tdl_rid, RF_ACTIVE);
+ if (sc->tdl_res == NULL) {
+ device_printf(dev, "couldn't map memory\n");
+ return (ENXIO);
+ }
+ terasic_de4led_attach(sc);
+ return (0);
+}
+
+static int
+terasic_de4led_nexus_detach(device_t dev)
+{
+ struct terasic_de4led_softc *sc;
+
+ sc = device_get_softc(dev);
+ KASSERT(sc->tdl_res != NULL, ("%s: resources not allocated",
+ __func__));
+ terasic_de4led_detach(sc);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->tdl_rid, sc->tdl_res);
+ return (0);
+}
+
+static device_method_t terasic_de4led_nexus_methods[] = {
+ DEVMETHOD(device_probe, terasic_de4led_nexus_probe),
+ DEVMETHOD(device_attach, terasic_de4led_nexus_attach),
+ DEVMETHOD(device_detach, terasic_de4led_nexus_detach),
+ { 0, 0 }
+};
+
+static driver_t terasic_de4led_nexus_driver = {
+ "terasic_de4led",
+ terasic_de4led_nexus_methods,
+ sizeof(struct terasic_de4led_softc),
+};
+
+DRIVER_MODULE(terasic_de4led, nexus, terasic_de4led_nexus_driver,
+ terasic_de4led_devclass, 0, 0);
Property changes on: trunk/sys/dev/terasic/de4led/terasic_de4led_nexus.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,114 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl.c 245380 2013-01-13 16:57:11Z rwatson $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/consio.h> /* struct vt_mode */
+#include <sys/fbio.h> /* video_adapter_t */
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+/*
+ * Device driver for the Terasic Multitouch LCD (MTL). Three separate
+ * sub-drivers that support, respectively, access to device control registers,
+ * the pixel frame buffer, and the text frame buffer. The last of these is
+ * also hooked up to syscons.
+ *
+ * Eventually, the frame buffer control registers and touch screen input FIFO
+ * will end up being separate sub-drivers as well.
+ *
+ * Note: sub-driver detach routines must check whether or not they have
+ * attached as they may be called even if the attach routine hasn't been, on
+ * an error.
+ */
+
+devclass_t terasic_mtl_devclass;
+
+int
+terasic_mtl_attach(struct terasic_mtl_softc *sc)
+{
+ int error;
+
+ error = terasic_mtl_reg_attach(sc);
+ if (error)
+ goto error;
+ error = terasic_mtl_pixel_attach(sc);
+ if (error)
+ goto error;
+ error = terasic_mtl_text_attach(sc);
+ if (error)
+ goto error;
+ /*
+ * XXXRW: Once we've attached syscons, we can't detach it, so do it
+ * last.
+ */
+ error = terasic_mtl_syscons_attach(sc);
+ if (error)
+ goto error;
+ terasic_mtl_blend_default_set(sc, TERASIC_MTL_COLOR_BLACK);
+ terasic_mtl_blend_pixel_set(sc, TERASIC_MTL_ALPHA_TRANSPARENT);
+ terasic_mtl_blend_textfg_set(sc, TERASIC_MTL_ALPHA_OPAQUE);
+ terasic_mtl_blend_textbg_set(sc, TERASIC_MTL_ALPHA_OPAQUE);
+ return (0);
+error:
+ terasic_mtl_text_detach(sc);
+ terasic_mtl_pixel_detach(sc);
+ terasic_mtl_reg_detach(sc);
+ return (error);
+}
+
+void
+terasic_mtl_detach(struct terasic_mtl_softc *sc)
+{
+
+ /* XXXRW: syscons can't detach, but we try anyway, only to panic. */
+ terasic_mtl_syscons_detach(sc);
+
+ /* All other aspects of the driver can detach just fine. */
+ terasic_mtl_text_detach(sc);
+ terasic_mtl_pixel_detach(sc);
+ terasic_mtl_reg_detach(sc);
+}
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl.h
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl.h (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,213 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl.h 245380 2013-01-13 16:57:11Z rwatson $
+ */
+
+#ifndef _DEV_TERASIC_MTL_H_
+#define _DEV_TERASIC_MTL_H_
+
+struct terasic_mtl_softc {
+ /*
+ * syscons requires that its video_adapter_t be at the front of the
+ * softc, so place syscons fields first, which we otherwise would
+ * probably not do.
+ */
+ video_adapter_t mtl_va;
+
+ /*
+ * Bus-related fields.
+ */
+ device_t mtl_dev;
+ int mtl_unit;
+
+ /*
+ * The MTL driver doesn't require a lot of synchronisation; however,
+ * the lock is used to protect read-modify-write operations on MTL
+ * registers.
+ */
+ struct mtx mtl_lock;
+
+ /*
+ * Control register device -- mappable from userspace.
+ */
+ struct cdev *mtl_reg_cdev;
+ struct resource *mtl_reg_res;
+ int mtl_reg_rid;
+
+ /*
+ * Graphics frame buffer device -- mappable form userspace.
+ */
+ struct cdev *mtl_pixel_cdev;
+ struct resource *mtl_pixel_res;
+ int mtl_pixel_rid;
+
+ /*
+ * Text frame buffer device -- mappable from userspace, and syscons
+ * hookup.
+ */
+ struct cdev *mtl_text_cdev;
+ struct resource *mtl_text_res;
+ int mtl_text_rid;
+ uint16_t *mtl_text_soft;
+};
+
+#define TERASIC_MTL_LOCK(sc) mtx_lock(&(sc)->mtl_lock)
+#define TERASIC_MTL_LOCK_ASSERT(sc) mtx_assert(&(sc)->mtl_lock, MA_OWNED)
+#define TERASIC_MTL_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtl_lock)
+#define TERASIC_MTL_LOCK_INIT(sc) mtx_init(&(sc)->mtl_lock, \
+ "terasic_mtl", NULL, MTX_DEF)
+#define TERASIC_MTL_UNLOCK(sc) mtx_unlock(&(sc)->mtl_lock)
+
+/*
+ * Constant properties of the MTL text frame buffer.
+ */
+#define TERASIC_MTL_COLS 100
+#define TERASIC_MTL_ROWS 40
+
+/*
+ * MTL control register offsets.
+ */
+#define TERASIC_MTL_OFF_BLEND 0
+#define TERASIC_MTL_OFF_TEXTCURSOR 4
+#define TERASIC_MTL_OFF_TEXTFRAMEBUFADDR 8
+#define TERASIC_MTL_OFF_TOUCHPOINT_X1 12
+#define TERASIC_MTL_OFF_TOUCHPOINT_Y1 16
+#define TERASIC_MTL_OFF_TOUCHPOINT_X2 20
+#define TERASIC_MTL_OFF_TOUCHPOINT_Y2 24
+#define TERASIC_MTL_OFF_TOUCHGESTURE 28
+
+/*
+ * Constants to help interpret various control registers.
+ */
+#define TERASIC_MTL_BLEND_DEFAULT_MASK 0x0f000000
+#define TERASIC_MTL_BLEND_DEFAULT_SHIFT 24
+#define TERASIC_MTL_BLEND_PIXEL_MASK 0x00ff0000
+#define TERASIC_MTL_BLEND_PIXEL_SHIFT 16
+#define TERASIC_MTL_BLEND_TEXTFG_MASK 0x0000ff00
+#define TERASIC_MTL_BLEND_TEXTFG_SHIFT 8
+#define TERASIC_MTL_BLEND_TEXTBG_MASK 0x000000ff
+#define TERASIC_MTL_BLEND_TEXTBG_SHIFT 0
+#define TERASIC_MTL_TEXTCURSOR_COL_MASK 0xff00
+#define TERASIC_MTL_TEXTCURSOR_COL_SHIFT 8
+#define TERASIC_MTL_TEXTCURSOR_ROW_MASK 0xff
+
+/*
+ * Colours used both by VGA-like text rendering, and for the default display
+ * colour.
+ */
+#define TERASIC_MTL_COLOR_BLACK 0
+#define TERASIC_MTL_COLOR_DARKBLUE 1
+#define TERASIC_MTL_COLOR_DARKGREEN 2
+#define TERASIC_MTL_COLOR_DARKCYAN 3
+#define TERASIC_MTL_COLOR_DARKRED 4
+#define TERASIC_MTL_COLOR_DARKMAGENTA 5
+#define TERASIC_MTL_COLOR_BROWN 6
+#define TERASIC_MTL_COLOR_LIGHTGREY 7
+#define TERASIC_MTL_COLOR_DARKGREY 8
+#define TERASIC_MTL_COLOR_LIGHTBLUE 9
+#define TERASIC_MTL_COLOR_LIGHTGREEN 10
+#define TERASIC_MTL_COLOR_LIGHTCYAN 11
+#define TERASIC_MTL_COLOR_LIGHTRED 12
+#define TERASIC_MTL_COLOR_LIGHTMAGENTA 13
+#define TERASIC_MTL_COLOR_LIGHTYELLOW 14
+#define TERASIC_MTL_COLOR_WHITE 15
+#define TERASIC_MTL_COLORMASK_BLINK 0x80
+
+/*
+ * Constants to help interpret the text frame buffer.
+ */
+#define TERASIC_MTL_TEXTFRAMEBUF_EXPECTED_ADDR 0x0177000
+#define TERASIC_MTL_TEXTFRAMEBUF_CHAR_SHIFT 0
+#define TERASIC_MTL_TEXTFRAMEBUF_ATTR_SHIFT 8
+
+/*
+ * Alpha-blending constants.
+ */
+#define TERASIC_MTL_ALPHA_TRANSPARENT 0
+#define TERASIC_MTL_ALPHA_OPAQUE 255
+
+/*
+ * Driver setup routines from the bus attachment/teardown.
+ */
+int terasic_mtl_attach(struct terasic_mtl_softc *sc);
+void terasic_mtl_detach(struct terasic_mtl_softc *sc);
+
+extern devclass_t terasic_mtl_devclass;
+
+/*
+ * Sub-driver setup routines.
+ */
+int terasic_mtl_pixel_attach(struct terasic_mtl_softc *sc);
+void terasic_mtl_pixel_detach(struct terasic_mtl_softc *sc);
+int terasic_mtl_reg_attach(struct terasic_mtl_softc *sc);
+void terasic_mtl_reg_detach(struct terasic_mtl_softc *sc);
+int terasic_mtl_syscons_attach(struct terasic_mtl_softc *sc);
+void terasic_mtl_syscons_detach(struct terasic_mtl_softc *sc);
+int terasic_mtl_text_attach(struct terasic_mtl_softc *sc);
+void terasic_mtl_text_detach(struct terasic_mtl_softc *sc);
+
+/*
+ * Control register I/O routines.
+ */
+void terasic_mtl_reg_blank(struct terasic_mtl_softc *sc);
+
+void terasic_mtl_reg_blend_get(struct terasic_mtl_softc *sc,
+ uint32_t *blendp);
+void terasic_mtl_reg_blend_set(struct terasic_mtl_softc *sc,
+ uint32_t blend);
+void terasic_mtl_reg_textcursor_get(struct terasic_mtl_softc *sc,
+ uint8_t *colp, uint8_t *rowp);
+void terasic_mtl_reg_textcursor_set(struct terasic_mtl_softc *sc,
+ uint8_t col, uint8_t row);
+void terasic_mtl_reg_textframebufaddr_get(struct terasic_mtl_softc *sc,
+ uint32_t *addrp);
+void terasic_mtl_reg_textframebufaddr_set(struct terasic_mtl_softc *sc,
+ uint32_t addr);
+
+/*
+ * Read-modify-write updates of sub-bytes of the blend register.
+ */
+void terasic_mtl_blend_default_set(struct terasic_mtl_softc *sc,
+ uint8_t colour);
+void terasic_mtl_blend_pixel_set(struct terasic_mtl_softc *sc,
+ uint8_t alpha);
+void terasic_mtl_blend_textfg_set(struct terasic_mtl_softc *sc,
+ uint8_t alpha);
+void terasic_mtl_blend_textbg_set(struct terasic_mtl_softc *sc,
+ uint8_t alpha);
+
+/*
+ * Text frame buffer I/O routines.
+ */
+void terasic_mtl_text_putc(struct terasic_mtl_softc *sc, u_int x, u_int y,
+ uint8_t c, uint8_t a);
+
+#endif /* _DEV_TERASIC_MTL_H_ */
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl_fdt.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl_fdt.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl_fdt.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,204 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012-2013 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl_fdt.c 266152 2014-05-15 16:11:06Z ian $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/consio.h> /* struct vt_mode */
+#include <sys/fbio.h> /* video_adapter_t */
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+static int
+terasic_mtl_fdt_probe(device_t dev)
+{
+
+ if (!ofw_bus_status_okay(dev))
+ return (ENXIO);
+
+ if (ofw_bus_is_compatible(dev, "sri-cambridge,mtl")) {
+ device_set_desc(dev, "Terasic Multi-touch LCD (MTL)");
+ return (BUS_PROBE_DEFAULT);
+ }
+ return (ENXIO);
+}
+
+static int
+terasic_mtl_fdt_attach(device_t dev)
+{
+ struct terasic_mtl_softc *sc;
+ int error;
+
+ sc = device_get_softc(dev);
+ sc->mtl_dev = dev;
+ sc->mtl_unit = device_get_unit(dev);
+
+ /*
+ * FDT allows multiple memory resources to be defined for a device;
+ * query them in the order registers, pixel buffer, text buffer.
+ * However, we need to sanity-check that they are page-aligned and
+ * page-sized, so we may still abort.
+ */
+ sc->mtl_reg_rid = 0;
+ sc->mtl_reg_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &sc->mtl_reg_rid, RF_ACTIVE);
+ if (sc->mtl_reg_res == NULL) {
+ device_printf(dev, "couldn't map register memory\n");
+ error = ENXIO;
+ goto error;
+ }
+ if (rman_get_start(sc->mtl_reg_res) % PAGE_SIZE != 0) {
+ device_printf(dev, "improper register address");
+ error = ENXIO;
+ goto error;
+ }
+ if (rman_get_size(sc->mtl_reg_res) % PAGE_SIZE != 0) {
+ device_printf(dev, "improper register size");
+ error = ENXIO;
+ goto error;
+ }
+ device_printf(sc->mtl_dev, "registers at mem %p-%p\n",
+ (void *)rman_get_start(sc->mtl_reg_res),
+ (void *)(rman_get_start(sc->mtl_reg_res) +
+ rman_get_size(sc->mtl_reg_res)));
+
+ sc->mtl_pixel_rid = 1;
+ sc->mtl_pixel_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &sc->mtl_pixel_rid, RF_ACTIVE);
+ if (sc->mtl_pixel_res == NULL) {
+ device_printf(dev, "couldn't map pixel memory\n");
+ error = ENXIO;
+ goto error;
+ }
+ if (rman_get_start(sc->mtl_pixel_res) % PAGE_SIZE != 0) {
+ device_printf(dev, "improper pixel address");
+ error = ENXIO;
+ goto error;
+ }
+ if (rman_get_size(sc->mtl_pixel_res) % PAGE_SIZE != 0) {
+ device_printf(dev, "improper pixel size");
+ error = ENXIO;
+ goto error;
+ }
+ device_printf(sc->mtl_dev, "pixel frame buffer at mem %p-%p\n",
+ (void *)rman_get_start(sc->mtl_pixel_res),
+ (void *)(rman_get_start(sc->mtl_pixel_res) +
+ rman_get_size(sc->mtl_pixel_res)));
+
+ sc->mtl_text_rid = 2;
+ sc->mtl_text_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &sc->mtl_text_rid, RF_ACTIVE);
+ if (sc->mtl_text_res == NULL) {
+ device_printf(dev, "couldn't map text memory\n");
+ error = ENXIO;
+ goto error;
+ }
+ if (rman_get_start(sc->mtl_text_res) % PAGE_SIZE != 0) {
+ device_printf(dev, "improper text address");
+ error = ENXIO;
+ goto error;
+ }
+ if (rman_get_size(sc->mtl_text_res) % PAGE_SIZE != 0) {
+ device_printf(dev, "improper text size");
+ error = ENXIO;
+ goto error;
+ }
+ device_printf(sc->mtl_dev, "text frame buffer at mem %p-%p\n",
+ (void *)rman_get_start(sc->mtl_text_res),
+ (void *)(rman_get_start(sc->mtl_text_res) +
+ rman_get_size(sc->mtl_text_res)));
+
+ error = terasic_mtl_attach(sc);
+ if (error == 0)
+ return (0);
+error:
+ if (sc->mtl_text_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_text_rid,
+ sc->mtl_text_res);
+ if (sc->mtl_pixel_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_pixel_rid,
+ sc->mtl_pixel_res);
+ if (sc->mtl_reg_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_reg_rid,
+ sc->mtl_reg_res);
+ return (error);
+}
+
+static int
+terasic_mtl_fdt_detach(device_t dev)
+{
+ struct terasic_mtl_softc *sc;
+
+ sc = device_get_softc(dev);
+ terasic_mtl_detach(sc);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_text_rid,
+ sc->mtl_text_res);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_pixel_rid,
+ sc->mtl_pixel_res);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_reg_rid,
+ sc->mtl_reg_res);
+ return (0);
+}
+
+static device_method_t terasic_mtl_fdt_methods[] = {
+ DEVMETHOD(device_probe, terasic_mtl_fdt_probe),
+ DEVMETHOD(device_attach, terasic_mtl_fdt_attach),
+ DEVMETHOD(device_detach, terasic_mtl_fdt_detach),
+ { 0, 0 }
+};
+
+static driver_t terasic_mtl_fdt_driver = {
+ "terasic_mtl",
+ terasic_mtl_fdt_methods,
+ sizeof(struct terasic_mtl_softc),
+};
+
+DRIVER_MODULE(mtl, simplebus, terasic_mtl_fdt_driver, terasic_mtl_devclass, 0,
+ 0);
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl_fdt.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl_nexus.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl_nexus.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl_nexus.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,195 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl_nexus.c 265999 2014-05-14 01:35:43Z ian $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/consio.h> /* struct vt_mode */
+#include <sys/fbio.h> /* video_adapter_t */
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+static int
+terasic_mtl_nexus_probe(device_t dev)
+{
+
+ device_set_desc(dev, "Terasic Multi-touch LCD (MTL)");
+ return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+terasic_mtl_nexus_attach(device_t dev)
+{
+ struct terasic_mtl_softc *sc;
+ u_long pixel_maddr, text_maddr, reg_maddr;
+ u_long pixel_msize, text_msize, reg_msize;
+ int error;
+
+ sc = device_get_softc(dev);
+ sc->mtl_dev = dev;
+ sc->mtl_unit = device_get_unit(dev);
+
+ /*
+ * Query non-standard hints to find the locations of our two memory
+ * regions. Enforce certain alignment and size requirements.
+ */
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "reg_maddr", ®_maddr) != 0 || (reg_maddr % PAGE_SIZE != 0)) {
+ device_printf(dev, "improper register address");
+ return (ENXIO);
+ }
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "reg_msize", ®_msize) != 0 || (reg_msize % PAGE_SIZE != 0)) {
+ device_printf(dev, "improper register size");
+ return (ENXIO);
+ }
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "pixel_maddr", &pixel_maddr) != 0 ||
+ (pixel_maddr % PAGE_SIZE != 0)) {
+ device_printf(dev, "improper pixel frame buffer address");
+ return (ENXIO);
+ }
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "pixel_msize", &pixel_msize) != 0 ||
+ (pixel_msize % PAGE_SIZE != 0)) {
+ device_printf(dev, "improper pixel frame buffer size");
+ return (ENXIO);
+ }
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "text_maddr", &text_maddr) != 0 ||
+ (text_maddr % PAGE_SIZE != 0)) {
+ device_printf(dev, "improper text frame buffer address");
+ return (ENXIO);
+ }
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "text_msize", &text_msize) != 0 ||
+ (text_msize % PAGE_SIZE != 0)) {
+ device_printf(dev, "improper text frame buffer size");
+ return (ENXIO);
+ }
+
+ /*
+ * Allocate resources.
+ */
+ sc->mtl_reg_rid = 0;
+ sc->mtl_reg_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
+ &sc->mtl_reg_rid, reg_maddr, reg_maddr + reg_msize - 1,
+ reg_msize, RF_ACTIVE);
+ if (sc->mtl_reg_res == NULL) {
+ device_printf(dev, "couldn't map register memory\n");
+ error = ENXIO;
+ goto error;
+ }
+ device_printf(sc->mtl_dev, "registers at mem %p-%p\n",
+ (void *)reg_maddr, (void *)(reg_maddr + reg_msize));
+ sc->mtl_pixel_rid = 0;
+ sc->mtl_pixel_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
+ &sc->mtl_pixel_rid, pixel_maddr, pixel_maddr + pixel_msize - 1,
+ pixel_msize, RF_ACTIVE);
+ if (sc->mtl_pixel_res == NULL) {
+ device_printf(dev, "couldn't map pixel memory\n");
+ error = ENXIO;
+ goto error;
+ }
+ device_printf(sc->mtl_dev, "pixel frame buffer at mem %p-%p\n",
+ (void *)pixel_maddr, (void *)(pixel_maddr + pixel_msize));
+ sc->mtl_text_rid = 0;
+ sc->mtl_text_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
+ &sc->mtl_text_rid, text_maddr, text_maddr + text_msize - 1,
+ text_msize, RF_ACTIVE);
+ if (sc->mtl_text_res == NULL) {
+ device_printf(dev, "couldn't map text memory\n");
+ error = ENXIO;
+ goto error;
+ }
+ device_printf(sc->mtl_dev, "text frame buffer at mem %p-%p\n",
+ (void *)text_maddr, (void *)(text_maddr + text_msize));
+ error = terasic_mtl_attach(sc);
+ if (error == 0)
+ return (0);
+error:
+ if (sc->mtl_text_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_text_rid,
+ sc->mtl_text_res);
+ if (sc->mtl_pixel_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_pixel_rid,
+ sc->mtl_pixel_res);
+ if (sc->mtl_reg_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_reg_rid,
+ sc->mtl_reg_res);
+ return (error);
+}
+
+static int
+terasic_mtl_nexus_detach(device_t dev)
+{
+ struct terasic_mtl_softc *sc;
+
+ sc = device_get_softc(dev);
+ terasic_mtl_detach(sc);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_text_rid,
+ sc->mtl_text_res);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_pixel_rid,
+ sc->mtl_pixel_res);
+ bus_release_resource(dev, SYS_RES_MEMORY, sc->mtl_reg_rid,
+ sc->mtl_reg_res);
+ return (0);
+}
+
+static device_method_t terasic_mtl_nexus_methods[] = {
+ DEVMETHOD(device_probe, terasic_mtl_nexus_probe),
+ DEVMETHOD(device_attach, terasic_mtl_nexus_attach),
+ DEVMETHOD(device_detach, terasic_mtl_nexus_detach),
+ { 0, 0 }
+};
+
+static driver_t terasic_mtl_nexus_driver = {
+ "terasic_mtl",
+ terasic_mtl_nexus_methods,
+ sizeof(struct terasic_mtl_softc),
+};
+
+DRIVER_MODULE(mtl, nexus, terasic_mtl_nexus_driver, terasic_mtl_devclass, 0,
+ 0);
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl_nexus.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl_pixel.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl_pixel.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl_pixel.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,160 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl_pixel.c 239691 2012-08-25 22:35:29Z rwatson $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/consio.h> /* struct vt_mode */
+#include <sys/fbio.h> /* video_adapter_t */
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/uio.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <machine/vm.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+static d_mmap_t terasic_mtl_pixel_mmap;
+static d_read_t terasic_mtl_pixel_read;
+static d_write_t terasic_mtl_pixel_write;
+
+static struct cdevsw mtl_pixel_cdevsw = {
+ .d_version = D_VERSION,
+ .d_mmap = terasic_mtl_pixel_mmap,
+ .d_read = terasic_mtl_pixel_read,
+ .d_write = terasic_mtl_pixel_write,
+ .d_name = "terasic_mtl_pixel",
+};
+
+/*
+ * All I/O to/from the MTL pixel device must be 32-bit, and aligned to 32-bit.
+ */
+static int
+terasic_mtl_pixel_read(struct cdev *dev, struct uio *uio, int flag)
+{
+ struct terasic_mtl_softc *sc;
+ u_long offset, size;
+ uint32_t v;
+ int error;
+
+ if (uio->uio_offset < 0 || uio->uio_offset % 4 != 0 ||
+ uio->uio_resid % 4 != 0)
+ return (ENODEV);
+ sc = dev->si_drv1;
+ size = rman_get_size(sc->mtl_pixel_res);
+ error = 0;
+ if ((uio->uio_offset + uio->uio_resid < 0) ||
+ (uio->uio_offset + uio->uio_resid > size))
+ return (ENODEV);
+ while (uio->uio_resid > 0) {
+ offset = uio->uio_offset;
+ if (offset + sizeof(v) > size)
+ return (ENODEV);
+ v = bus_read_4(sc->mtl_pixel_res, offset);
+ error = uiomove(&v, sizeof(v), uio);
+ if (error)
+ return (error);
+ }
+ return (error);
+}
+
+static int
+terasic_mtl_pixel_write(struct cdev *dev, struct uio *uio, int flag)
+{
+ struct terasic_mtl_softc *sc;
+ u_long offset, size;
+ uint32_t v;
+ int error;
+
+ if (uio->uio_offset < 0 || uio->uio_offset % 4 != 0 ||
+ uio->uio_resid % 4 != 0)
+ return (ENODEV);
+ sc = dev->si_drv1;
+ size = rman_get_size(sc->mtl_pixel_res);
+ error = 0;
+ while (uio->uio_resid > 0) {
+ offset = uio->uio_offset;
+ if (offset + sizeof(v) > size)
+ return (ENODEV);
+ error = uiomove(&v, sizeof(v), uio);
+ if (error)
+ return (error);
+ bus_write_4(sc->mtl_pixel_res, offset, v);
+ }
+ return (error);
+}
+
+static int
+terasic_mtl_pixel_mmap(struct cdev *dev, vm_ooffset_t offset,
+ vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
+{
+ struct terasic_mtl_softc *sc;
+ int error;
+
+ sc = dev->si_drv1;
+ error = 0;
+ if (trunc_page(offset) == offset &&
+ rman_get_size(sc->mtl_pixel_res) >= offset + PAGE_SIZE) {
+ *paddr = rman_get_start(sc->mtl_pixel_res) + offset;
+ *memattr = VM_MEMATTR_UNCACHEABLE;
+ } else
+ error = ENODEV;
+ return (error);
+}
+
+int
+terasic_mtl_pixel_attach(struct terasic_mtl_softc *sc)
+{
+
+ sc->mtl_pixel_cdev = make_dev(&mtl_pixel_cdevsw, sc->mtl_unit,
+ UID_ROOT, GID_WHEEL, 0400, "mtl_pixel%d", sc->mtl_unit);
+ if (sc->mtl_pixel_cdev == NULL) {
+ device_printf(sc->mtl_dev, "%s: make_dev failed\n", __func__);
+ return (ENXIO);
+ }
+ /* XXXRW: Slight race between make_dev(9) and here. */
+ sc->mtl_pixel_cdev->si_drv1 = sc;
+ return (0);
+}
+
+void
+terasic_mtl_pixel_detach(struct terasic_mtl_softc *sc)
+{
+
+ if (sc->mtl_pixel_cdev != NULL)
+ destroy_dev(sc->mtl_pixel_cdev);
+}
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl_pixel.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl_reg.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl_reg.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl_reg.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,279 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl_reg.c 239691 2012-08-25 22:35:29Z rwatson $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/consio.h> /* struct vt_mode */
+#include <sys/endian.h>
+#include <sys/fbio.h> /* video_adapter_t */
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <machine/vm.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+static d_mmap_t terasic_mtl_reg_mmap;
+static d_read_t terasic_mtl_reg_read;
+static d_write_t terasic_mtl_reg_write;
+
+static struct cdevsw terasic_mtl_reg_cdevsw = {
+ .d_version = D_VERSION,
+ .d_mmap = terasic_mtl_reg_mmap,
+ .d_read = terasic_mtl_reg_read,
+ .d_write = terasic_mtl_reg_write,
+ .d_name = "terasic_mtl_reg",
+};
+
+/*
+ * All I/O to/from the MTL register device must be 32-bit, and aligned to
+ * 32-bit.
+ */
+static int
+terasic_mtl_reg_read(struct cdev *dev, struct uio *uio, int flag)
+{
+ struct terasic_mtl_softc *sc;
+ u_long offset, size;
+ uint32_t v;
+ int error;
+
+ if (uio->uio_offset < 0 || uio->uio_offset % 4 != 0 ||
+ uio->uio_resid % 4 != 0)
+ return (ENODEV);
+ sc = dev->si_drv1;
+ size = rman_get_size(sc->mtl_reg_res);
+ error = 0;
+ if ((uio->uio_offset + uio->uio_resid < 0) ||
+ (uio->uio_offset + uio->uio_resid > size))
+ return (ENODEV);
+ while (uio->uio_resid > 0) {
+ offset = uio->uio_offset;
+ if (offset + sizeof(v) > size)
+ return (ENODEV);
+ v = bus_read_4(sc->mtl_reg_res, offset);
+ error = uiomove(&v, sizeof(v), uio);
+ if (error)
+ return (error);
+ }
+ return (error);
+}
+
+static int
+terasic_mtl_reg_write(struct cdev *dev, struct uio *uio, int flag)
+{
+ struct terasic_mtl_softc *sc;
+ u_long offset, size;
+ uint32_t v;
+ int error;
+
+ if (uio->uio_offset < 0 || uio->uio_offset % 4 != 0 ||
+ uio->uio_resid % 4 != 0)
+ return (ENODEV);
+ sc = dev->si_drv1;
+ size = rman_get_size(sc->mtl_reg_res);
+ error = 0;
+ while (uio->uio_resid > 0) {
+ offset = uio->uio_offset;
+ if (offset + sizeof(v) > size)
+ return (ENODEV);
+ error = uiomove(&v, sizeof(v), uio);
+ if (error)
+ return (error);
+ bus_write_4(sc->mtl_reg_res, offset, v);
+ }
+ return (error);
+}
+
+static int
+terasic_mtl_reg_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
+ int nprot, vm_memattr_t *memattr)
+{
+ struct terasic_mtl_softc *sc;
+ int error;
+
+ sc = dev->si_drv1;
+ error = 0;
+ if (trunc_page(offset) == offset &&
+ rman_get_size(sc->mtl_reg_res) >= offset + PAGE_SIZE) {
+ *paddr = rman_get_start(sc->mtl_reg_res) + offset;
+ *memattr = VM_MEMATTR_UNCACHEABLE;
+ } else
+ error = ENODEV;
+ return (error);
+}
+
+void
+terasic_mtl_reg_blend_get(struct terasic_mtl_softc *sc, uint32_t *blendp)
+{
+
+ *blendp = le32toh(bus_read_4(sc->mtl_reg_res, TERASIC_MTL_OFF_BLEND));
+}
+
+void
+terasic_mtl_reg_blend_set(struct terasic_mtl_softc *sc, uint32_t blend)
+{
+
+ bus_write_4(sc->mtl_reg_res, TERASIC_MTL_OFF_BLEND, htole32(blend));
+}
+
+void
+terasic_mtl_blend_default_set(struct terasic_mtl_softc *sc, uint8_t colour)
+{
+ uint32_t v;
+
+ TERASIC_MTL_LOCK(sc);
+ terasic_mtl_reg_blend_get(sc, &v);
+ v &= ~TERASIC_MTL_BLEND_DEFAULT_MASK;
+ v |= colour << TERASIC_MTL_BLEND_DEFAULT_SHIFT;
+ terasic_mtl_reg_blend_set(sc, v);
+ TERASIC_MTL_UNLOCK(sc);
+}
+
+void
+terasic_mtl_blend_pixel_set(struct terasic_mtl_softc *sc, uint8_t alpha)
+{
+ uint32_t v;
+
+ TERASIC_MTL_LOCK(sc);
+ terasic_mtl_reg_blend_get(sc, &v);
+ v &= ~TERASIC_MTL_BLEND_PIXEL_MASK;
+ v |= alpha << TERASIC_MTL_BLEND_PIXEL_SHIFT;
+ terasic_mtl_reg_blend_set(sc, v);
+ TERASIC_MTL_UNLOCK(sc);
+}
+
+void
+terasic_mtl_blend_textfg_set(struct terasic_mtl_softc *sc, uint8_t alpha)
+{
+ uint32_t v;
+
+ TERASIC_MTL_LOCK(sc);
+ terasic_mtl_reg_blend_get(sc, &v);
+ v &= ~TERASIC_MTL_BLEND_TEXTFG_MASK;
+ v |= alpha << TERASIC_MTL_BLEND_TEXTFG_SHIFT;
+ terasic_mtl_reg_blend_set(sc, v);
+ TERASIC_MTL_UNLOCK(sc);
+}
+
+void
+terasic_mtl_blend_textbg_set(struct terasic_mtl_softc *sc, uint8_t alpha)
+{
+ uint32_t v;
+
+ TERASIC_MTL_LOCK(sc);
+ terasic_mtl_reg_blend_get(sc, &v);
+ v &= ~TERASIC_MTL_BLEND_TEXTBG_MASK;
+ v |= alpha << TERASIC_MTL_BLEND_TEXTBG_SHIFT;
+ terasic_mtl_reg_blend_set(sc, v);
+ TERASIC_MTL_UNLOCK(sc);
+}
+
+void
+terasic_mtl_reg_textcursor_get(struct terasic_mtl_softc *sc, uint8_t *colp,
+ uint8_t *rowp)
+{
+ uint32_t v;
+
+ v = bus_read_4(sc->mtl_reg_res, TERASIC_MTL_OFF_TEXTCURSOR);
+ v = le32toh(v);
+ *colp = (v & TERASIC_MTL_TEXTCURSOR_COL_MASK) >>
+ TERASIC_MTL_TEXTCURSOR_COL_SHIFT;
+ *rowp = (v & TERASIC_MTL_TEXTCURSOR_ROW_MASK);
+}
+
+void
+terasic_mtl_reg_textcursor_set(struct terasic_mtl_softc *sc, uint8_t col,
+ uint8_t row)
+{
+ uint32_t v;
+
+ v = (col << TERASIC_MTL_TEXTCURSOR_COL_SHIFT) | row;
+ v = htole32(v);
+ bus_write_4(sc->mtl_reg_res, TERASIC_MTL_OFF_TEXTCURSOR, v);
+}
+
+void
+terasic_mtl_reg_blank(struct terasic_mtl_softc *sc)
+{
+
+ device_printf(sc->mtl_dev, "%s: not yet", __func__);
+}
+
+void
+terasic_mtl_reg_textframebufaddr_get(struct terasic_mtl_softc *sc,
+ uint32_t *addrp)
+{
+ uint32_t addr;
+
+ addr = bus_read_4(sc->mtl_reg_res, TERASIC_MTL_OFF_TEXTFRAMEBUFADDR);
+ *addrp = le32toh(addr);
+}
+
+void
+terasic_mtl_reg_textframebufaddr_set(struct terasic_mtl_softc *sc,
+ uint32_t addr)
+{
+
+ addr = htole32(addr);
+ bus_write_4(sc->mtl_reg_res, TERASIC_MTL_OFF_TEXTFRAMEBUFADDR, addr);
+}
+
+int
+terasic_mtl_reg_attach(struct terasic_mtl_softc *sc)
+{
+
+ sc->mtl_reg_cdev = make_dev(&terasic_mtl_reg_cdevsw, sc->mtl_unit,
+ UID_ROOT, GID_WHEEL, 0400, "mtl_reg%d", sc->mtl_unit);
+ if (sc->mtl_reg_cdev == NULL) {
+ device_printf(sc->mtl_dev, "%s: make_dev failed\n", __func__);
+ return (ENXIO);
+ }
+ /* XXXRW: Slight race between make_dev(9) and here. */
+ sc->mtl_reg_cdev->si_drv1 = sc;
+ return (0);
+}
+
+void
+terasic_mtl_reg_detach(struct terasic_mtl_softc *sc)
+{
+
+ if (sc->mtl_reg_cdev != NULL)
+ destroy_dev(sc->mtl_reg_cdev);
+}
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl_reg.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl_syscons.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl_syscons.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl_syscons.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,491 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl_syscons.c 239691 2012-08-25 22:35:29Z rwatson $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
+#include <sys/kbio.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <machine/vm.h>
+
+#include <dev/fb/fbreg.h>
+
+#include <dev/kbd/kbdreg.h>
+
+#include <dev/syscons/syscons.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+/*
+ * Terasic Multitouch LCD (MTL) syscons driver. Implement syscons(4)'s
+ * video_switch_t KPI using MTL's text frame buffer. In principle, we could
+ * actually implement sc_rndr_sw_t, since the MTL text frame buffer implements
+ * a VGA-like memory mapping. However, this requires a lot more book-keeping
+ * with only minor performance improvements (avoiding indirection), as well as
+ * introducing potential endianness issues. Instead we accept one additional
+ * memory copy between a software frame buffer and the hardware frame buffer
+ * and the generic frame buffer (gfb) framework.
+ */
+
+MALLOC_DEFINE(M_TERASIC_MTL, "mtl_syscons", "MTL syscons frame buffer");
+
+/*
+ * Run early so that boot-time console support can be initialised before
+ * newbus gets around to configuring syscons.
+ *
+ * XXXRW: We may need to do more here in order to see earlier boot messages.
+ */
+static int
+terasic_mtl_syscons_configure(int flags)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_probe(int unit, video_adapter_t **adp, void *args,
+ int flags)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_init(int unit, video_adapter_t *adp, int flags)
+{
+ struct terasic_mtl_softc *sc;
+ video_info_t *vi;
+
+ sc = (struct terasic_mtl_softc *)adp;
+
+ vi = &adp->va_info;
+ vid_init_struct(adp, "terasic_mtl_syscons", -1, unit);
+
+ vi->vi_width = TERASIC_MTL_COLS;
+ if (vi->vi_width > COL)
+ vi->vi_width = COL;
+ vi->vi_height = TERASIC_MTL_ROWS;
+ if (vi->vi_height > ROW)
+ vi->vi_height = ROW;
+
+ /*
+ * XXXRW: It's not quite clear how these should be initialised.
+ */
+ vi->vi_cwidth = 0;
+ vi->vi_cheight = 0;
+ vi->vi_flags = V_INFO_COLOR;
+ vi->vi_mem_model = V_INFO_MM_OTHER;
+
+ /*
+ * Software text frame buffer from which we update the actual MTL
+ * frame buffer when asked to.
+ */
+ adp->va_window = (vm_offset_t)sc->mtl_text_soft;
+
+ /*
+ * Declare video adapter capabilities -- at this point, simply color
+ * support, as MTL doesn't support screen borders, font loading, or
+ * mode changes.
+ *
+ * XXXRW: It's unclear if V_ADP_INITIALIZED is needed here; other
+ * syscons(4) drivers are inconsistent about this and
+ * V_ADP_REGISTERED.
+ */
+ adp->va_flags |= V_ADP_COLOR | V_ADP_INITIALIZED;
+ if (vid_register(adp) < 0) {
+ device_printf(sc->mtl_dev, "%s: vid_register failed\n",
+ __func__);
+ return (ENXIO);
+ }
+ adp->va_flags |= V_ADP_REGISTERED;
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_get_info(video_adapter_t *adp, int mode, video_info_t *info)
+{
+
+ bcopy(&adp->va_info, info, sizeof(*info));
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_query_mode(video_adapter_t *adp, video_info_t *info)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_set_mode(video_adapter_t *adp, int mode)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_save_font(video_adapter_t *adp, int page, int size,
+ int width, u_char *data, int c, int count)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_load_font(video_adapter_t *adp, int page, int size,
+ int width, u_char *data, int c, int count)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_show_font(video_adapter_t *adp, int page)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_save_palette(video_adapter_t *adp, u_char *palette)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_load_palette(video_adapter_t *adp, u_char *palette)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_set_border(video_adapter_t *adp, int border)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_save_state(video_adapter_t *adp, void *p, size_t size)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_load_state(video_adapter_t *adp, void *p)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_set_win_org(video_adapter_t *adp, off_t offset)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_read_hw_cursor(video_adapter_t *adp, int *colp, int *rowp)
+{
+ struct terasic_mtl_softc *sc;
+ uint8_t col, row;
+
+ sc = (struct terasic_mtl_softc *)adp;
+ terasic_mtl_reg_textcursor_get(sc, &col, &row);
+ *colp = col;
+ *rowp = row;
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_set_hw_cursor(video_adapter_t *adp, int col, int row)
+{
+ struct terasic_mtl_softc *sc;
+
+ sc = (struct terasic_mtl_softc *)adp;
+ terasic_mtl_reg_textcursor_set(sc, col, row);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_set_hw_cursor_shape(video_adapter_t *adp, int base,
+ int height, int celsize, int blink)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_blank_display(video_adapter_t *adp, int mode)
+{
+ struct terasic_mtl_softc *sc;
+
+ sc = (struct terasic_mtl_softc *)adp;
+ terasic_mtl_reg_blank(sc);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_mmap(video_adapter_t *adp, vm_ooffset_t offset,
+ vm_paddr_t *paddr, int prot, vm_memattr_t *memattr)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data)
+{
+
+ return (fb_commonioctl(adp, cmd, data));
+}
+
+static int
+terasic_mtl_vidsw_clear(video_adapter_t *adp)
+{
+ struct terasic_mtl_softc *sc;
+
+ sc = (struct terasic_mtl_softc *)adp;
+ printf("%s: not yet terasic_mtl_io_clear(sc);\n", __func__);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_fill_rect(video_adapter_t *adp, int val, int x, int y,
+ int cx, int cy)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_bitblt(video_adapter_t *adp, ...)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_diag(video_adapter_t *adp, int level)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_save_cursor_palette(video_adapter_t *adp, u_char *palette)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_load_cursor_palette(video_adapter_t *adp, u_char *palette)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst,
+ int n)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_putp(video_adapter_t *adp, vm_offset_t off, uint32_t p,
+ uint32_t a, int size, int bpp, int bit_ltor, int byte_ltor)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+static int
+terasic_mtl_vidsw_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c,
+ uint8_t a)
+{
+ struct terasic_mtl_softc *sc;
+ u_int col, row;
+
+ sc = (struct terasic_mtl_softc *)adp;
+ col = (off % adp->va_info.vi_width);
+ row = (off / adp->va_info.vi_width);
+ terasic_mtl_text_putc(sc, col, row, c, a);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s,
+ int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ vidd_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8);
+ return (0);
+}
+
+static int
+terasic_mtl_vidsw_putm(video_adapter_t *adp, int x, int y,
+ uint8_t *pixel_image, uint32_t pixel_mask, int size, int width)
+{
+
+ printf("%s: not yet\n", __func__);
+ return (ENODEV);
+}
+
+/*
+ * XXXRW: For historical reasons, syscons can't register video consoles
+ * without a keyboard implementation. Provide a dummy.
+ */
+static keyboard_switch_t terasic_mtl_keyboard_switch;
+
+static int
+terasic_mtl_kbd_configure(int flags)
+{
+
+ return (0);
+}
+
+KEYBOARD_DRIVER(mtl_kbd, terasic_mtl_keyboard_switch,
+ terasic_mtl_kbd_configure);
+
+int
+terasic_mtl_syscons_attach(struct terasic_mtl_softc *sc)
+{
+ int error;
+
+ sc->mtl_text_soft =
+ malloc(sizeof(uint16_t) * TERASIC_MTL_ROWS * TERASIC_MTL_COLS,
+ M_TERASIC_MTL, M_WAITOK | M_ZERO);
+ error = terasic_mtl_vidsw_init(0, &sc->mtl_va, 0);
+ if (error)
+ goto out;
+ error = sc_attach_unit(sc->mtl_unit, device_get_flags(sc->mtl_dev) |
+ SC_AUTODETECT_KBD);
+ if (error)
+ device_printf(sc->mtl_dev, "%s: sc_attach_unit failed (%d)\n",
+ __func__, error);
+out:
+ if (error)
+ free(sc->mtl_text_soft, M_TERASIC_MTL);
+ return (error);
+}
+
+void
+terasic_mtl_syscons_detach(struct terasic_mtl_softc *sc)
+{
+
+ free(sc->mtl_text_soft, M_TERASIC_MTL);
+ panic("%s: not supported by syscons", __func__);
+}
+
+static video_switch_t terasic_mtl_vidsw = {
+ .probe = terasic_mtl_vidsw_probe,
+ .init = terasic_mtl_vidsw_init,
+ .get_info = terasic_mtl_vidsw_get_info,
+ .query_mode = terasic_mtl_vidsw_query_mode,
+ .set_mode = terasic_mtl_vidsw_set_mode,
+ .save_font = terasic_mtl_vidsw_save_font,
+ .load_font = terasic_mtl_vidsw_load_font,
+ .show_font = terasic_mtl_vidsw_show_font,
+ .save_palette = terasic_mtl_vidsw_save_palette,
+ .load_palette = terasic_mtl_vidsw_load_palette,
+ .set_border = terasic_mtl_vidsw_set_border,
+ .save_state = terasic_mtl_vidsw_save_state,
+ .load_state = terasic_mtl_vidsw_load_state,
+ .set_win_org = terasic_mtl_vidsw_set_win_org,
+ .read_hw_cursor = terasic_mtl_vidsw_read_hw_cursor,
+ .set_hw_cursor = terasic_mtl_vidsw_set_hw_cursor,
+ .set_hw_cursor_shape = terasic_mtl_vidsw_set_hw_cursor_shape,
+ .blank_display = terasic_mtl_vidsw_blank_display,
+ .mmap = terasic_mtl_vidsw_mmap,
+ .ioctl = terasic_mtl_vidsw_ioctl,
+ .clear = terasic_mtl_vidsw_clear,
+ .fill_rect = terasic_mtl_vidsw_fill_rect,
+ .bitblt = terasic_mtl_vidsw_bitblt,
+ .diag = terasic_mtl_vidsw_diag,
+ .save_cursor_palette = terasic_mtl_vidsw_save_cursor_palette,
+ .load_cursor_palette = terasic_mtl_vidsw_load_cursor_palette,
+ .copy = terasic_mtl_vidsw_copy,
+ .putp = terasic_mtl_vidsw_putp,
+ .putc = terasic_mtl_vidsw_putc,
+ .puts = terasic_mtl_vidsw_puts,
+ .putm = terasic_mtl_vidsw_putm,
+};
+VIDEO_DRIVER(terasic_mtl_syscons, terasic_mtl_vidsw,
+ terasic_mtl_syscons_configure);
+extern sc_rndr_sw_t txtrndrsw;
+RENDERER(terasic_mtl_syscons, 0, txtrndrsw, gfb_set);
+RENDERER_MODULE(terasic_mtl_syscons, gfb_set);
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl_syscons.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/dev/terasic/mtl/terasic_mtl_text.c
===================================================================
--- trunk/sys/dev/terasic/mtl/terasic_mtl_text.c (rev 0)
+++ trunk/sys/dev/terasic/mtl/terasic_mtl_text.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -0,0 +1,190 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/terasic/mtl/terasic_mtl_text.c 239691 2012-08-25 22:35:29Z rwatson $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/consio.h> /* struct vt_mode */
+#include <sys/endian.h>
+#include <sys/fbio.h> /* video_adapter_t */
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <machine/vm.h>
+
+#include <dev/terasic/mtl/terasic_mtl.h>
+
+static d_mmap_t terasic_mtl_text_mmap;
+static d_read_t terasic_mtl_text_read;
+static d_write_t terasic_mtl_text_write;
+
+static struct cdevsw terasic_mtl_text_cdevsw = {
+ .d_version = D_VERSION,
+ .d_mmap = terasic_mtl_text_mmap,
+ .d_read = terasic_mtl_text_read,
+ .d_write = terasic_mtl_text_write,
+ .d_name = "terasic_mtl_text",
+};
+
+/*
+ * All I/O to/from the mtl device must be 16-bit, and aligned to 16-bit.
+ */
+static int
+terasic_mtl_text_read(struct cdev *dev, struct uio *uio, int flag)
+{
+ struct terasic_mtl_softc *sc;
+ u_long offset, size;
+ uint16_t v;
+ int error;
+
+ if (uio->uio_offset < 0 || uio->uio_offset % 2 != 0 ||
+ uio->uio_resid % 2 != 0)
+ return (ENODEV);
+ sc = dev->si_drv1;
+ size = rman_get_size(sc->mtl_text_res);
+ error = 0;
+ if ((uio->uio_offset + uio->uio_resid < 0) ||
+ (uio->uio_offset + uio->uio_resid > size))
+ return (ENODEV);
+ while (uio->uio_resid > 0) {
+ offset = uio->uio_offset;
+ if (offset + sizeof(v) > size)
+ return (ENODEV);
+ v = bus_read_2(sc->mtl_text_res, offset);
+ error = uiomove(&v, sizeof(v), uio);
+ if (error)
+ return (error);
+ }
+ return (error);
+}
+
+static int
+terasic_mtl_text_write(struct cdev *dev, struct uio *uio, int flag)
+{
+ struct terasic_mtl_softc *sc;
+ u_long offset, size;
+ uint16_t v;
+ int error;
+
+ if (uio->uio_offset < 0 || uio->uio_offset % 2 != 0 ||
+ uio->uio_resid % 2 != 0)
+ return (ENODEV);
+ sc = dev->si_drv1;
+ size = rman_get_size(sc->mtl_text_res);
+ error = 0;
+ while (uio->uio_resid > 0) {
+ offset = uio->uio_offset;
+ if (offset + sizeof(v) > size)
+ return (ENODEV);
+ error = uiomove(&v, sizeof(v), uio);
+ if (error)
+ return (error);
+ bus_write_2(sc->mtl_text_res, offset, v);
+ }
+ return (error);
+}
+
+static int
+terasic_mtl_text_mmap(struct cdev *dev, vm_ooffset_t offset,
+ vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
+{
+ struct terasic_mtl_softc *sc;
+ int error;
+
+ sc = dev->si_drv1;
+ error = 0;
+ if (trunc_page(offset) == offset &&
+ rman_get_size(sc->mtl_text_res) >= offset + PAGE_SIZE) {
+ *paddr = rman_get_start(sc->mtl_text_res) + offset;
+ *memattr = VM_MEMATTR_UNCACHEABLE;
+ } else
+ error = ENODEV;
+ return (error);
+}
+
+void
+terasic_mtl_text_putc(struct terasic_mtl_softc *sc, u_int x, u_int y,
+ uint8_t c, uint8_t a)
+{
+ u_int offset;
+ uint16_t v;
+
+ KASSERT(x < TERASIC_MTL_COLS, ("%s: TERASIC_MTL_COLS", __func__));
+ KASSERT(y < TERASIC_MTL_ROWS, ("%s: TERASIC_MTL_ROWS", __func__));
+
+ offset = sizeof(uint16_t) * (x + y * TERASIC_MTL_COLS);
+ v = (c << TERASIC_MTL_TEXTFRAMEBUF_CHAR_SHIFT) |
+ (a << TERASIC_MTL_TEXTFRAMEBUF_ATTR_SHIFT);
+ v = htole16(v);
+ bus_write_2(sc->mtl_text_res, offset, v);
+}
+
+int
+terasic_mtl_text_attach(struct terasic_mtl_softc *sc)
+{
+ uint32_t v;
+
+ terasic_mtl_reg_textframebufaddr_get(sc, &v);
+ if (v != TERASIC_MTL_TEXTFRAMEBUF_EXPECTED_ADDR) {
+ device_printf(sc->mtl_dev, "%s: unexpected text frame buffer "
+ "address (%08x); cannot attach\n", __func__, v);
+ return (ENXIO);
+ }
+
+ sc->mtl_text_cdev = make_dev(&terasic_mtl_text_cdevsw, sc->mtl_unit,
+ UID_ROOT, GID_WHEEL, 0400, "mtl_text%d", sc->mtl_unit);
+ if (sc->mtl_text_cdev == NULL) {
+ device_printf(sc->mtl_dev, "%s: make_dev failed\n", __func__);
+ return (ENXIO);
+ }
+ /* XXXRW: Slight race between make_dev(9) and here. */
+ TERASIC_MTL_LOCK_INIT(sc);
+ sc->mtl_text_cdev->si_drv1 = sc;
+ return (0);
+}
+
+void
+terasic_mtl_text_detach(struct terasic_mtl_softc *sc)
+{
+
+ if (sc->mtl_text_cdev != NULL) {
+ destroy_dev(sc->mtl_text_cdev);
+ TERASIC_MTL_LOCK_DESTROY(sc);
+ }
+}
Property changes on: trunk/sys/dev/terasic/mtl/terasic_mtl_text.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/dev/tpm/tpm.c
===================================================================
--- trunk/sys/dev/tpm/tpm.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tpm/tpm.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2008, 2009 Michael Shalayeff
* Copyright (c) 2009, 2010 Hans-Joerg Hoexer
@@ -19,7 +20,7 @@
/* #define TPM_DEBUG */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tpm/tpm.c 260279 2014-01-04 19:13:25Z dim $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1138,6 +1139,7 @@
return bus_space_read_1(iot, ioh, 1);
}
+#if 0
/* Write single byte using legacy interface. */
static inline void
tpm_legacy_out(bus_space_tag_t iot, bus_space_handle_t ioh, int reg, u_int8_t v)
@@ -1145,6 +1147,7 @@
bus_space_write_1(iot, ioh, 0, reg);
bus_space_write_1(iot, ioh, 1, v);
}
+#endif
/* Probe for TPM using legacy interface. */
int
Modified: trunk/sys/dev/tpm/tpm_acpi.c
===================================================================
--- trunk/sys/dev/tpm/tpm_acpi.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tpm/tpm_acpi.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2008, 2009 Michael Shalayeff
* Copyright (c) 2009, 2010 Hans-Joerg Hoexer
@@ -16,7 +17,7 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tpm/tpm_acpi.c 211201 2010-08-12 00:16:18Z takawata $");
#include <sys/param.h>
#include <sys/systm.h>
Modified: trunk/sys/dev/tpm/tpm_isa.c
===================================================================
--- trunk/sys/dev/tpm/tpm_isa.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tpm/tpm_isa.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2008, 2009 Michael Shalayeff
* Copyright (c) 2009, 2010 Hans-Joerg Hoexer
@@ -17,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tpm/tpm_isa.c 211201 2010-08-12 00:16:18Z takawata $");
#include <sys/param.h>
#include <sys/systm.h>
Modified: trunk/sys/dev/tpm/tpmvar.h
===================================================================
--- trunk/sys/dev/tpm/tpmvar.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tpm/tpmvar.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2008, 2009 Michael Shalayeff
* Copyright (c) 2009, 2010 Hans-Joerg Hoexer
@@ -15,7 +16,7 @@
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tpm/tpmvar.h 211201 2010-08-12 00:16:18Z takawata $
*/
#ifndef _TPMVAR_H
Modified: trunk/sys/dev/trm/trm.c
===================================================================
--- trunk/sys/dev/trm/trm.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/trm/trm.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* O.S : FreeBSD CAM
* FILE NAME : trm.c
@@ -11,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/trm/trm.c 315813 2017-03-23 06:41:13Z mav $");
/*
* HISTORY:
@@ -68,7 +69,9 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/queue.h>
+#if __FreeBSD_version >= 500000
#include <sys/bio.h>
+#endif
#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
@@ -471,10 +474,6 @@
return;
}
ccb->ccb_h.status |= CAM_SIM_QUEUED;
-#if 0
- /* XXX Need a timeout handler */
- ccb->ccb_h.timeout_ch = timeout(trmtimeout, (caddr_t)srb, (ccb->ccb_h.timeout * hz) / 1000);
-#endif
trm_SendSRB(pACB, pSRB);
splx(flags);
return;
@@ -557,6 +556,7 @@
PDCB pDCB = NULL;
PSRB pSRB;
struct ccb_scsiio *pcsio;
+ int error;
pcsio = &pccb->csio;
TRM_DPRINTF(" XPT_SCSI_IO \n");
@@ -612,71 +612,18 @@
} else
bcopy(pcsio->cdb_io.cdb_bytes,
pSRB->CmdBlock, pcsio->cdb_len);
- if ((pccb->ccb_h.flags & CAM_DIR_MASK)
- != CAM_DIR_NONE) {
- if ((pccb->ccb_h.flags &
- CAM_SCATTER_VALID) == 0) {
- if ((pccb->ccb_h.flags
- & CAM_DATA_PHYS) == 0) {
- int vmflags;
- int error;
-
- vmflags = splsoftvm();
- error = bus_dmamap_load(
- pACB->buffer_dmat,
+ error = bus_dmamap_load_ccb(pACB->buffer_dmat,
pSRB->dmamap,
- pcsio->data_ptr,
- pcsio->dxfer_len,
+ pccb,
trm_ExecuteSRB,
pSRB,
0);
- if (error == EINPROGRESS) {
- xpt_freeze_simq(
- pACB->psim,
- 1);
- pccb->ccb_h.status |=
- CAM_RELEASE_SIMQ;
- }
- splx(vmflags);
- } else {
- struct bus_dma_segment seg;
-
- /* Pointer to physical buffer */
- seg.ds_addr =
- (bus_addr_t)pcsio->data_ptr;
- seg.ds_len = pcsio->dxfer_len;
- trm_ExecuteSRB(pSRB, &seg, 1,
- 0);
- }
- } else {
- /* CAM_SCATTER_VALID */
- struct bus_dma_segment *segs;
-
- if ((pccb->ccb_h.flags &
- CAM_SG_LIST_PHYS) == 0 ||
- (pccb->ccb_h.flags
- & CAM_DATA_PHYS) != 0) {
- pSRB->pNextSRB = pACB->pFreeSRB;
- pACB->pFreeSRB = pSRB;
- pccb->ccb_h.status =
- CAM_PROVIDE_FAIL;
- xpt_done(pccb);
- splx(actionflags);
- return;
- }
-
- /* cam SG list is physical,
- * cam data is virtual
- */
- segs = (struct bus_dma_segment *)
- pcsio->data_ptr;
- trm_ExecuteSRB(pSRB, segs,
- pcsio->sglist_cnt, 1);
- } /* CAM_SCATTER_VALID */
- } else
- trm_ExecuteSRB(pSRB, NULL, 0, 0);
- }
+ if (error == EINPROGRESS) {
+ xpt_freeze_simq(pACB->psim, 1);
+ pccb->ccb_h.status |= CAM_RELEASE_SIMQ;
+ }
break;
+ }
case XPT_GDEV_TYPE:
TRM_DPRINTF(" XPT_GDEV_TYPE \n");
pccb->ccb_h.status = CAM_REQ_INVALID;
@@ -705,9 +652,9 @@
cpi->initiator_id = pACB->AdaptSCSIID;
cpi->bus_id = cam_sim_bus(psim);
cpi->base_transfer_speed = 3300;
- strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
- strncpy(cpi->hba_vid, "Tekram_TRM", HBA_IDLEN);
- strncpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
+ strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+ strlcpy(cpi->hba_vid, "Tekram_TRM", HBA_IDLEN);
+ strlcpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
cpi->unit_number = cam_sim_unit(psim);
cpi->transport = XPORT_SPI;
cpi->transport_version = 2;
@@ -3436,7 +3383,7 @@
/*highaddr*/ BUS_SPACE_MAXADDR,
/*filter*/ NULL,
/*filterarg*/ NULL,
- /*maxsize*/ MAXBSIZE,
+ /*maxsize*/ TRM_MAXPHYS,
/*nsegments*/ TRM_NSEG,
/*maxsegsz*/ TRM_MAXTRANSFER_SIZE,
/*flags*/ BUS_DMA_ALLOCNOW,
Modified: trunk/sys/dev/trm/trm.h
===================================================================
--- trunk/sys/dev/trm/trm.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/trm/trm.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* File Name : trm.h
*
@@ -29,7 +30,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/dev/trm/trm.h 195534 2009-07-10 08:18:08Z scottl $
*/
#ifndef trm_H
Modified: trunk/sys/dev/tsec/if_tsec.c
===================================================================
--- trunk/sys/dev/tsec/if_tsec.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tsec/if_tsec.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski
* Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
@@ -28,7 +29,7 @@
* Freescale integrated Three-Speed Ethernet Controller (TSEC) driver.
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tsec/if_tsec.c 259235 2013-12-11 22:36:20Z andreast $");
#ifdef HAVE_KERNEL_OPTION_HEADERS
#include "opt_device_polling.h"
@@ -111,6 +112,8 @@
MODULE_DEPEND(tsec, ether, 1, 1, 1);
MODULE_DEPEND(tsec, miibus, 1, 1, 1);
+struct mtx tsec_phy_mtx;
+
int
tsec_attach(struct tsec_softc *sc)
{
@@ -121,6 +124,10 @@
int error = 0;
int i;
+ /* Initialize global (because potentially shared) MII lock */
+ if (!mtx_initialized(&tsec_phy_mtx))
+ mtx_init(&tsec_phy_mtx, "tsec mii", NULL, MTX_DEF);
+
/* Reset all TSEC counters */
TSEC_TX_RX_COUNTERS_INIT(sc);
@@ -245,7 +252,6 @@
ifp->if_softc = sc;
if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
- ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_SIMPLEX | IFF_MULTICAST | IFF_BROADCAST;
ifp->if_init = tsec_init;
ifp->if_start = tsec_start;
@@ -407,15 +413,17 @@
*/
TSEC_WRITE(sc, TSEC_REG_TBIPA, 5);
+ TSEC_PHY_LOCK(sc);
+
/* Step 6: Reset the management interface */
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_RESETMGMT);
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_RESETMGMT);
/* Step 7: Setup the MII Mgmt clock speed */
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_CLKDIV28);
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_CLKDIV28);
/* Step 8: Read MII Mgmt indicator register and check for Busy = 0 */
timeout = TSEC_READ_RETRY;
- while (--timeout && (TSEC_READ(sc->phy_sc, TSEC_REG_MIIMIND) &
+ while (--timeout && (TSEC_PHY_READ(sc, TSEC_REG_MIIMIND) &
TSEC_MIIMIND_BUSY))
DELAY(TSEC_READ_DELAY);
if (timeout == 0) {
@@ -422,6 +430,7 @@
if_printf(ifp, "tsec_init_locked(): Mgmt busy timeout\n");
return;
}
+ TSEC_PHY_UNLOCK(sc);
/* Step 9: Setup the MII Mgmt */
mii_mediachg(sc->tsec_mii);
@@ -1562,15 +1571,17 @@
{
struct tsec_softc *sc;
uint32_t timeout;
+ int rv;
sc = device_get_softc(dev);
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMADD, (phy << 8) | reg);
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCOM, 0);
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE);
+ TSEC_PHY_LOCK();
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg);
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCOM, 0);
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE);
timeout = TSEC_READ_RETRY;
- while (--timeout && TSEC_READ(sc->phy_sc, TSEC_REG_MIIMIND) &
+ while (--timeout && TSEC_PHY_READ(sc, TSEC_REG_MIIMIND) &
(TSEC_MIIMIND_NOTVALID | TSEC_MIIMIND_BUSY))
DELAY(TSEC_READ_DELAY);
@@ -1577,7 +1588,10 @@
if (timeout == 0)
device_printf(dev, "Timeout while reading from PHY!\n");
- return (TSEC_READ(sc->phy_sc, TSEC_REG_MIIMSTAT));
+ rv = TSEC_PHY_READ(sc, TSEC_REG_MIIMSTAT);
+ TSEC_PHY_UNLOCK();
+
+ return (rv);
}
int
@@ -1588,13 +1602,15 @@
sc = device_get_softc(dev);
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMADD, (phy << 8) | reg);
- TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCON, value);
+ TSEC_PHY_LOCK();
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg);
+ TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCON, value);
timeout = TSEC_READ_RETRY;
- while (--timeout && (TSEC_READ(sc->phy_sc, TSEC_REG_MIIMIND) &
+ while (--timeout && (TSEC_READ(sc, TSEC_REG_MIIMIND) &
TSEC_MIIMIND_BUSY))
DELAY(TSEC_READ_DELAY);
+ TSEC_PHY_UNLOCK();
if (timeout == 0)
device_printf(dev, "Timeout while writing to PHY!\n");
Modified: trunk/sys/dev/tsec/if_tsec.h
===================================================================
--- trunk/sys/dev/tsec/if_tsec.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tsec/if_tsec.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
* All rights reserved.
@@ -22,7 +23,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tsec/if_tsec.h 259235 2013-12-11 22:36:20Z andreast $
*/
#ifndef _IF_TSEC_H
@@ -133,7 +134,8 @@
struct mbuf *frame;
int phyaddr;
- struct tsec_softc *phy_sc;
+ bus_space_tag_t phy_bst;
+ bus_space_handle_t phy_bsh;
};
/* interface to get/put generic objects */
@@ -253,6 +255,14 @@
#define TSEC_WRITE(sc, reg, val) \
bus_space_write_4((sc)->sc_bas.bst, (sc)->sc_bas.bsh, (reg), (val))
+extern struct mtx tsec_phy_mtx;
+#define TSEC_PHY_LOCK(sc) mtx_lock(&tsec_phy_mtx)
+#define TSEC_PHY_UNLOCK(sc) mtx_unlock(&tsec_phy_mtx)
+#define TSEC_PHY_READ(sc, reg) \
+ bus_space_read_4((sc)->phy_bst, (sc)->phy_bsh, (reg))
+#define TSEC_PHY_WRITE(sc, reg, val) \
+ bus_space_write_4((sc)->phy_bst, (sc)->phy_bsh, (reg), (val))
+
/* Lock for transmitter */
#define TSEC_TRANSMIT_LOCK(sc) do { \
mtx_assert(&(sc)->receive_lock, MA_NOTOWNED); \
Modified: trunk/sys/dev/tsec/if_tsec_fdt.c
===================================================================
--- trunk/sys/dev/tsec/if_tsec_fdt.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tsec/if_tsec_fdt.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski
* Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
@@ -30,7 +31,7 @@
* FDT 'simple-bus' attachment for Freescale TSEC controller.
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tsec/if_tsec_fdt.c 273652 2014-10-26 01:30:46Z ian $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -110,6 +111,13 @@
struct tsec_softc *sc;
uint32_t id;
+ if (!ofw_bus_status_okay(dev))
+ return (ENXIO);
+
+ if (ofw_bus_get_type(dev) == NULL ||
+ strcmp(ofw_bus_get_type(dev), "network") != 0)
+ return (ENXIO);
+
if (!ofw_bus_is_compatible(dev, "gianfar"))
return (ENXIO);
@@ -148,6 +156,7 @@
tsec_fdt_attach(device_t dev)
{
struct tsec_softc *sc;
+ phandle_t phy;
int error = 0;
sc = device_get_softc(dev);
@@ -155,10 +164,15 @@
sc->node = ofw_bus_get_node(dev);
/* Get phy address from fdt */
- if (fdt_get_phyaddr(sc->node, sc->dev, &sc->phyaddr,
- (void **)&sc->phy_sc) != 0)
+ if (OF_getencprop(sc->node, "phy-handle", &phy, sizeof(phy)) <= 0) {
+ device_printf(dev, "PHY not found in device tree");
return (ENXIO);
+ }
+ phy = OF_node_from_xref(phy);
+ OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh);
+ OF_getencprop(phy, "reg", &sc->phyaddr, sizeof(sc->phyaddr));
+
/* Init timer */
callout_init(&sc->tsec_callout, 1);
@@ -324,6 +338,13 @@
return;
}
+ /* Also try the mac-address property, which is second-best */
+ i = OF_getprop(sc->node, "mac-address", (void *)hw.addr, 6);
+ if (i == 6 && (hw.reg[0] != 0 || hw.reg[1] != 0)) {
+ bcopy(hw.addr, addr, 6);
+ return;
+ }
+
/*
* Fall back -- use the currently programmed address in the hope that
* it was set be firmware...
Modified: trunk/sys/dev/tsec/if_tsecreg.h
===================================================================
--- trunk/sys/dev/tsec/if_tsecreg.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tsec/if_tsecreg.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (C) 2008-2009 Semihalf, Piotr Ziecik
* Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
@@ -23,7 +24,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tsec/if_tsecreg.h 259235 2013-12-11 22:36:20Z andreast $
*/
#define TSEC_REG_ID 0x000 /* Controller ID register #1. */
@@ -77,12 +78,13 @@
* register */
#define TSEC_REG_HAFDUP 0x50c /* Half-duplex register */
#define TSEC_REG_MAXFRM 0x510 /* Maximum frame length register */
-#define TSEC_REG_MIIMCFG 0x520 /* MII Management configuration register */
-#define TSEC_REG_MIIMCOM 0x524 /* MII Management command register */
-#define TSEC_REG_MIIMADD 0x528 /* MII Management address register */
-#define TSEC_REG_MIIMCON 0x52c /* MII Management control register */
-#define TSEC_REG_MIIMSTAT 0x530 /* MII Management status register */
-#define TSEC_REG_MIIMIND 0x534 /* MII Management indicator register */
+#define TSEC_REG_MIIBASE 0x520 /* MII Management base, rest offsets */
+#define TSEC_REG_MIIMCFG 0x0 /* MII Management configuration register */
+#define TSEC_REG_MIIMCOM 0x4 /* MII Management command register */
+#define TSEC_REG_MIIMADD 0x8 /* MII Management address register */
+#define TSEC_REG_MIIMCON 0xc /* MII Management control register */
+#define TSEC_REG_MIIMSTAT 0x10 /* MII Management status register */
+#define TSEC_REG_MIIMIND 0x14 /* MII Management indicator register */
#define TSEC_REG_IFSTAT 0x53c /* Interface status register */
#define TSEC_REG_MACSTNADDR1 0x540 /* Station address register, part 1 */
#define TSEC_REG_MACSTNADDR2 0x544 /* Station address register, part 2 */
Modified: trunk/sys/dev/twa/tw_cl.h
===================================================================
--- trunk/sys/dev/twa/tw_cl.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl.h 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_externs.h
===================================================================
--- trunk/sys/dev/twa/tw_cl_externs.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_externs.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_externs.h 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_fwif.h
===================================================================
--- trunk/sys/dev/twa/tw_cl_fwif.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_fwif.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_fwif.h 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_init.c
===================================================================
--- trunk/sys/dev/twa/tw_cl_init.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_init.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_init.c 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_intr.c
===================================================================
--- trunk/sys/dev/twa/tw_cl_intr.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_intr.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_intr.c 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_io.c
===================================================================
--- trunk/sys/dev/twa/tw_cl_io.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_io.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_io.c 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_ioctl.h
===================================================================
--- trunk/sys/dev/twa/tw_cl_ioctl.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_ioctl.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_ioctl.h 169400 2007-05-09 04:16:32Z scottl $
*/
/*
Modified: trunk/sys/dev/twa/tw_cl_misc.c
===================================================================
--- trunk/sys/dev/twa/tw_cl_misc.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_misc.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_misc.c 242827 2012-11-09 15:29:52Z rdivacky $
*/
/*
@@ -641,7 +642,7 @@
va_end(ap);
tw_osl_strcpy(print_str + tw_osl_strlen(print_str), "\n");
- tw_osl_dbg_printf(ctlr_handle, print_str);
+ tw_osl_dbg_printf(ctlr_handle, "%s", print_str);
}
#endif /* TW_OSL_DEBUG */
}
Modified: trunk/sys/dev/twa/tw_cl_share.h
===================================================================
--- trunk/sys/dev/twa/tw_cl_share.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_cl_share.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_cl_share.h 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_osl.h
===================================================================
--- trunk/sys/dev/twa/tw_osl.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl.h 246713 2013-02-12 16:57:20Z kib $
*/
/*
@@ -72,6 +73,7 @@
#define TW_OSLI_REQ_FLAGS_PASSTHRU (1<<5) /* pass through request */
#define TW_OSLI_REQ_FLAGS_SLEEPING (1<<6) /* owner sleeping on this cmd */
#define TW_OSLI_REQ_FLAGS_FAILED (1<<7) /* bus_dmamap_load() failed */
+#define TW_OSLI_REQ_FLAGS_CCB (1<<8) /* req is ccb. */
#ifdef TW_OSL_DEBUG
@@ -147,7 +149,7 @@
struct mtx sim_lock_handle;/* sim lock shared with cam */
struct mtx *sim_lock;/* ptr to sim lock */
- struct callout watchdog_callout[2]; /* For command timout */
+ struct callout watchdog_callout[2]; /* For command timeout */
TW_UINT32 watchdog_index;
#ifdef TW_OSL_DEBUG
Modified: trunk/sys/dev/twa/tw_osl_cam.c
===================================================================
--- trunk/sys/dev/twa/tw_osl_cam.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_cam.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_cam.c 315813 2017-03-23 06:41:13Z mav $
*/
/*
@@ -261,55 +262,27 @@
scsi_req->cdb = csio->cdb_io.cdb_bytes;
scsi_req->cdb_len = csio->cdb_len;
- if (!(ccb_h->flags & CAM_DATA_PHYS)) {
- /* Virtual data addresses. Need to convert them... */
- tw_osli_dbg_dprintf(3, sc,
- "XPT_SCSI_IO: Single virtual address!");
- if (!(ccb_h->flags & CAM_SCATTER_VALID)) {
- if (csio->dxfer_len > TW_CL_MAX_IO_SIZE) {
- tw_osli_printf(sc, "size = %d",
- TW_CL_SEVERITY_ERROR_STRING,
- TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
- 0x2106,
- "I/O size too big",
- csio->dxfer_len);
- ccb_h->status = CAM_REQ_TOO_BIG;
- ccb_h->status &= ~CAM_SIM_QUEUED;
- xpt_done(ccb);
- return(1);
- }
-
- if ((req->length = csio->dxfer_len)) {
- req->data = csio->data_ptr;
- scsi_req->sgl_entries = 1;
- }
- } else {
- tw_osli_printf(sc, "",
- TW_CL_SEVERITY_ERROR_STRING,
- TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
- 0x2107,
- "XPT_SCSI_IO: Got SGList");
- ccb_h->status = CAM_REQ_INVALID;
- ccb_h->status &= ~CAM_SIM_QUEUED;
- xpt_done(ccb);
- return(1);
- }
- } else {
- /* Data addresses are physical. */
- tw_osli_printf(sc, "",
+ if (csio->dxfer_len > TW_CL_MAX_IO_SIZE) {
+ tw_osli_printf(sc, "size = %d",
TW_CL_SEVERITY_ERROR_STRING,
TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
- 0x2108,
- "XPT_SCSI_IO: Physical data addresses");
- ccb_h->status = CAM_REQ_INVALID;
+ 0x2106,
+ "I/O size too big",
+ csio->dxfer_len);
+ ccb_h->status = CAM_REQ_TOO_BIG;
ccb_h->status &= ~CAM_SIM_QUEUED;
xpt_done(ccb);
return(1);
}
-
+ if ((ccb_h->flags & CAM_DATA_MASK) == CAM_DATA_VADDR) {
+ if ((req->length = csio->dxfer_len) != 0) {
+ req->data = csio->data_ptr;
+ scsi_req->sgl_entries = 1;
+ }
+ } else
+ req->flags |= TW_OSLI_REQ_FLAGS_CCB;
req->deadline = tw_osl_get_local_time() + (ccb_h->timeout / 1000);
-
/*
* twa_map_load_data_callback will fill in the SGL,
* and submit the I/O.
@@ -450,9 +423,9 @@
path_inq->bus_id = cam_sim_bus(sim);
path_inq->initiator_id = TW_CL_MAX_NUM_UNITS;
path_inq->base_transfer_speed = 100000;
- strncpy(path_inq->sim_vid, "FreeBSD", SIM_IDLEN);
- strncpy(path_inq->hba_vid, "3ware", HBA_IDLEN);
- strncpy(path_inq->dev_name, cam_sim_name(sim), DEV_IDLEN);
+ strlcpy(path_inq->sim_vid, "FreeBSD", SIM_IDLEN);
+ strlcpy(path_inq->hba_vid, "3ware", HBA_IDLEN);
+ strlcpy(path_inq->dev_name, cam_sim_name(sim), DEV_IDLEN);
path_inq->transport = XPORT_SPI;
path_inq->transport_version = 2;
path_inq->protocol = PROTO_SCSI;
@@ -516,7 +489,7 @@
if ((ccb = xpt_alloc_ccb()) == NULL)
return(ENOMEM);
mtx_lock(sc->sim_lock);
- if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
+ if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
xpt_free_ccb(ccb);
mtx_unlock(sc->sim_lock);
Modified: trunk/sys/dev/twa/tw_osl_externs.h
===================================================================
--- trunk/sys/dev/twa/tw_osl_externs.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_externs.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_externs.h 208969 2010-06-09 21:40:38Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_osl_freebsd.c
===================================================================
--- trunk/sys/dev/twa/tw_osl_freebsd.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_freebsd.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -28,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/twa/tw_osl_freebsd.c 314667 2017-03-04 13:03:31Z avg $");
/*
* AMCC'S 3ware driver for 9000 series storage controllers.
@@ -284,7 +285,6 @@
twa_attach(device_t dev)
{
struct twa_softc *sc = device_get_softc(dev);
- TW_UINT32 command;
TW_INT32 bar_num;
TW_INT32 bar0_offset;
TW_INT32 bar_size;
@@ -323,22 +323,8 @@
OID_AUTO, "driver_version", CTLFLAG_RD,
TW_OSL_DRIVER_VERSION_STRING, 0, "TWA driver version");
- /* Make sure we are going to be able to talk to this board. */
- command = pci_read_config(dev, PCIR_COMMAND, 2);
- if ((command & PCIM_CMD_PORTEN) == 0) {
- tw_osli_printf(sc, "error = %d",
- TW_CL_SEVERITY_ERROR_STRING,
- TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
- 0x2001,
- "Register window not available",
- ENXIO);
- tw_osli_free_resources(sc);
- return(ENXIO);
- }
-
/* Force the busmaster enable bit on, in case the BIOS forgot. */
- command |= PCIM_CMD_BUSMASTEREN;
- pci_write_config(dev, PCIR_COMMAND, command, 2);
+ pci_enable_busmaster(dev);
/* Allocate the PCI register window. */
if ((error = tw_cl_get_pci_bar_info(sc->device_id, TW_CL_BAR_TYPE_MEM,
@@ -438,8 +424,8 @@
}
sc->watchdog_index = 0;
- callout_init(&(sc->watchdog_callout[0]), CALLOUT_MPSAFE);
- callout_init(&(sc->watchdog_callout[1]), CALLOUT_MPSAFE);
+ callout_init(&(sc->watchdog_callout[0]), 1);
+ callout_init(&(sc->watchdog_callout[1]), 1);
callout_reset(&(sc->watchdog_callout[0]), 5*hz, twa_watchdog, &sc->ctlr_handle);
return(0);
@@ -1473,6 +1459,10 @@
twa_map_load_data_callback, req,
BUS_DMA_WAITOK);
mtx_unlock_spin(sc->io_lock);
+ } else if (req->flags & TW_OSLI_REQ_FLAGS_CCB) {
+ error = bus_dmamap_load_ccb(sc->dma_tag, req->dma_map,
+ req->orig_req, twa_map_load_data_callback, req,
+ BUS_DMA_WAITOK);
} else {
/*
* There's only one CAM I/O thread running at a time.
Modified: trunk/sys/dev/twa/tw_osl_includes.h
===================================================================
--- trunk/sys/dev/twa/tw_osl_includes.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_includes.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_includes.h 169400 2007-05-09 04:16:32Z scottl $
*/
/*
Modified: trunk/sys/dev/twa/tw_osl_inline.h
===================================================================
--- trunk/sys/dev/twa/tw_osl_inline.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_inline.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_inline.h 208969 2010-06-09 21:40:38Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_osl_ioctl.h
===================================================================
--- trunk/sys/dev/twa/tw_osl_ioctl.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_ioctl.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_ioctl.h 169400 2007-05-09 04:16:32Z scottl $
*/
/*
Modified: trunk/sys/dev/twa/tw_osl_share.h
===================================================================
--- trunk/sys/dev/twa/tw_osl_share.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_share.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_share.h 212008 2010-08-30 19:15:04Z delphij $
*/
/*
Modified: trunk/sys/dev/twa/tw_osl_types.h
===================================================================
--- trunk/sys/dev/twa/tw_osl_types.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/twa/tw_osl_types.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2004-07 Applied Micro Circuits Corporation.
* Copyright (c) 2004-05 Vinod Kashyap.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/twa/tw_osl_types.h 169400 2007-05-09 04:16:32Z scottl $
*/
/*
Modified: trunk/sys/dev/tws/tws.c
===================================================================
--- trunk/sys/dev/tws/tws.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -33,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tws/tws.c 314667 2017-03-04 13:03:31Z avg $");
#include <dev/tws/tws.h>
#include <dev/tws/tws_services.h>
@@ -183,7 +184,7 @@
tws_attach(device_t dev)
{
struct tws_softc *sc = device_get_softc(dev);
- u_int32_t cmd, bar;
+ u_int32_t bar;
int error=0,i;
/* no tracing yet */
@@ -198,6 +199,7 @@
mtx_init( &sc->sim_lock, "tws_sim_lock", NULL, MTX_DEF);
mtx_init( &sc->gen_lock, "tws_gen_lock", NULL, MTX_DEF);
mtx_init( &sc->io_lock, "tws_io_lock", NULL, MTX_DEF | MTX_RECURSE);
+ callout_init(&sc->stats_timer, 1);
if ( tws_init_trace_q(sc) == FAILURE )
printf("trace init failure\n");
@@ -224,14 +226,7 @@
OID_AUTO, "driver_version", CTLFLAG_RD,
TWS_DRIVER_VERSION_STRING, 0, "TWS driver version");
- cmd = pci_read_config(dev, PCIR_COMMAND, 2);
- if ( (cmd & PCIM_CMD_PORTEN) == 0) {
- tws_log(sc, PCI_COMMAND_READ);
- goto attach_fail_1;
- }
- /* Force the busmaster enable bit on. */
- cmd |= PCIM_CMD_BUSMASTEREN;
- pci_write_config(dev, PCIR_COMMAND, cmd, 2);
+ pci_enable_busmaster(dev);
bar = pci_read_config(dev, TWS_PCI_BAR0, 4);
TWS_TRACE_DEBUG(sc, "bar0 ", bar, 0);
@@ -263,8 +258,8 @@
#ifndef TWS_PULL_MODE_ENABLE
/* Allocate bus space for inbound mfa */
sc->mfa_res_id = TWS_PCI_BAR2; /* BAR2 offset */
- if ((sc->mfa_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
- &(sc->mfa_res_id), 0, ~0, 0x100000, RF_ACTIVE))
+ if ((sc->mfa_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &(sc->mfa_res_id), RF_ACTIVE))
== NULL) {
tws_log(sc, ALLOC_MEMORY_RES);
goto attach_fail_2;
@@ -402,11 +397,20 @@
TWS_TRACE(sc, "bus release mem resource", 0, sc->reg_res_id);
}
+ for ( i=0; i< tws_queue_depth; i++) {
+ if (sc->reqs[i].dma_map)
+ bus_dmamap_destroy(sc->data_tag, sc->reqs[i].dma_map);
+ callout_drain(&sc->reqs[i].timeout);
+ }
+
+ callout_drain(&sc->stats_timer);
free(sc->reqs, M_TWS);
free(sc->sense_bufs, M_TWS);
free(sc->scan_ccb, M_TWS);
if (sc->ioctl_data_mem)
bus_dmamem_free(sc->data_tag, sc->ioctl_data_mem, sc->ioctl_data_map);
+ if (sc->data_tag)
+ bus_dma_tag_destroy(sc->data_tag);
free(sc->aen_q.q, M_TWS);
free(sc->trace_q.q, M_TWS);
mtx_destroy(&sc->q_lock);
@@ -461,13 +465,9 @@
tws_setup_irq(struct tws_softc *sc)
{
int messages;
- u_int16_t cmd;
- cmd = pci_read_config(sc->tws_dev, PCIR_COMMAND, 2);
switch(sc->intr_type) {
case TWS_INTx :
- cmd = cmd & ~0x0400;
- pci_write_config(sc->tws_dev, PCIR_COMMAND, cmd, 2);
sc->irqs = 1;
sc->irq_res_id[0] = 0;
sc->irq_res[0] = bus_alloc_resource_any(sc->tws_dev, SYS_RES_IRQ,
@@ -479,8 +479,6 @@
device_printf(sc->tws_dev, "Using legacy INTx\n");
break;
case TWS_MSI :
- cmd = cmd | 0x0400;
- pci_write_config(sc->tws_dev, PCIR_COMMAND, cmd, 2);
sc->irqs = 1;
sc->irq_res_id[0] = 1;
messages = 1;
@@ -709,6 +707,7 @@
sc->reqs[i].cmd_pkt->hdr.header_desc.size_header = 128;
+ callout_init(&sc->reqs[i].timeout, 1);
sc->reqs[i].state = TWS_REQ_STATE_FREE;
if ( i >= TWS_RESERVED_REQS )
tws_q_insert_tail(sc, &sc->reqs[i], TWS_FREE_Q);
@@ -858,7 +857,7 @@
r->error_code = TWS_REQ_RET_INVALID;
r->cb = NULL;
r->ccb_ptr = NULL;
- r->thandle.callout = NULL;
+ callout_stop(&r->timeout);
r->next = r->prev = NULL;
r->state = ((type == TWS_REQ_TYPE_SCSI_IO) ? TWS_REQ_STATE_TRAN : TWS_REQ_STATE_BUSY);
Modified: trunk/sys/dev/tws/tws.h
===================================================================
--- trunk/sys/dev/tws/tws.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws.h 318806 2017-05-24 20:13:49Z jpaetzel $
*/
#include <sys/param.h> /* defines used in kernel.h */
@@ -67,7 +68,7 @@
#define TWS_DRIVER_VERSION_STRING "10.80.00.005"
#define TWS_MAX_NUM_UNITS 65
-#define TWS_MAX_NUM_LUNS 16
+#define TWS_MAX_NUM_LUNS 32
#define TWS_MAX_IRQS 2
#define TWS_SCSI_INITIATOR_ID 66
#define TWS_MAX_IO_SIZE 0x20000 /* 128kB */
@@ -137,6 +138,7 @@
TWS_DIR_IN = 0x2,
TWS_DIR_OUT = 0x4,
TWS_DIR_NONE = 0x8,
+ TWS_DATA_CCB = 0x10,
};
enum tws_intrs {
@@ -247,7 +249,6 @@
struct mtx io_lock; /* IO lock */
struct tws_ioctl_lock ioctl_lock; /* ioctl lock */
u_int32_t seq_id; /* Sequence id */
- void *chan; /* IOCTL req wait channel */
struct tws_circular_q aen_q; /* aen q */
struct tws_circular_q trace_q; /* trace q */
struct tws_stats stats; /* I/O stats */
@@ -268,4 +269,5 @@
union ccb *scan_ccb; /* pointer to a ccb */
struct tws_request *q_head[TWS_MAX_QS]; /* head pointers to q's */
struct tws_request *q_tail[TWS_MAX_QS]; /* tail pointers to q's */
+ struct callout stats_timer;
};
Modified: trunk/sys/dev/tws/tws_cam.c
===================================================================
--- trunk/sys/dev/tws/tws_cam.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_cam.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010 LSI Corp.
* All rights reserved.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_cam.c 315813 2017-03-23 06:41:13Z mav $
*/
#include <dev/tws/tws.h>
@@ -217,17 +218,16 @@
TWS_TRACE_DEBUG(sc, "entry", sc, 0);
if (!(sc->sim))
return(ENXIO);
- mtx_assert(&sc->sim_lock, MA_OWNED);
- if ((ccb = xpt_alloc_ccb()) == NULL)
- return(ENOMEM);
-
- if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
+ ccb = xpt_alloc_ccb();
+ mtx_lock(&sc->sim_lock);
+ if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ mtx_unlock(&sc->sim_lock);
xpt_free_ccb(ccb);
return(EIO);
}
xpt_rescan(ccb);
-
+ mtx_unlock(&sc->sim_lock);
return(0);
}
@@ -310,9 +310,9 @@
ccb->cpi.bus_id = cam_sim_bus(sim);
ccb->cpi.initiator_id = TWS_SCSI_INITIATOR_ID;
ccb->cpi.base_transfer_speed = 6000000;
- strncpy(ccb->cpi.sim_vid, "FreeBSD", SIM_IDLEN);
- strncpy(ccb->cpi.hba_vid, "3ware", HBA_IDLEN);
- strncpy(ccb->cpi.dev_name, cam_sim_name(sim), DEV_IDLEN);
+ strlcpy(ccb->cpi.sim_vid, "FreeBSD", SIM_IDLEN);
+ strlcpy(ccb->cpi.hba_vid, "3ware", HBA_IDLEN);
+ strlcpy(ccb->cpi.dev_name, cam_sim_name(sim), DEV_IDLEN);
#if (__FreeBSD_version >= 700000 )
ccb->cpi.transport = XPORT_SPI;
ccb->cpi.transport_version = 2;
@@ -342,7 +342,7 @@
tws_q_remove_request(sc, req, TWS_BUSY_Q);
mtx_unlock(&sc->q_lock);
- untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch);
+ callout_stop(&req->timeout);
tws_unmap_request(req->sc, req);
@@ -363,7 +363,7 @@
TWS_TRACE_DEBUG(sc, "getset complete", req, req->request_id);
- untimeout(tws_timeout, req, req->thandle);
+ callout_stop(&req->timeout);
tws_unmap_request(sc, req);
free(req->data, M_TWS);
@@ -381,7 +381,7 @@
TWS_TRACE_DEBUG(sc, "aen complete", 0, req->request_id);
- untimeout(tws_timeout, req, req->thandle);
+ callout_stop(&req->timeout);
tws_unmap_request(sc, req);
sense = (struct tws_command_header *)req->data;
@@ -455,7 +455,7 @@
{
struct tws_softc *sc = req->sc;
- untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch);
+ callout_stop(&req->timeout);
tws_unmap_request(sc, req);
}
@@ -562,7 +562,7 @@
xpt_done(ccb);
mtx_unlock(&sc->sim_lock);
- untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch);
+ callout_stop(&req->timeout);
tws_unmap_request(req->sc, req);
mtx_lock(&sc->q_lock);
tws_q_remove_request(sc, req, TWS_BUSY_Q);
@@ -592,7 +592,7 @@
mtx_unlock(&sc->q_lock);
while ( req ) {
TWS_TRACE_DEBUG(sc, "moved to TWS_COMPLETE_Q", 0, req->request_id);
- untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch);
+ callout_stop(&req->timeout);
req->error_code = TWS_REQ_RET_RESET;
ccb = (union ccb *)(req->ccb_ptr);
@@ -623,7 +623,7 @@
r = &sc->reqs[TWS_REQ_TYPE_AEN_FETCH];
if ( r->state != TWS_REQ_STATE_FREE ) {
TWS_TRACE_DEBUG(sc, "reset aen req", 0, 0);
- untimeout(tws_timeout, r, r->thandle);
+ callout_stop(&r->timeout);
tws_unmap_request(sc, r);
free(r->data, M_TWS);
r->state = TWS_REQ_STATE_FREE;
@@ -639,7 +639,7 @@
r = &sc->reqs[TWS_REQ_TYPE_GETSET_PARAM];
if ( r->state != TWS_REQ_STATE_FREE ) {
TWS_TRACE_DEBUG(sc, "reset setparam req", 0, 0);
- untimeout(tws_timeout, r, r->thandle);
+ callout_stop(&r->timeout);
tws_unmap_request(sc, r);
free(r->data, M_TWS);
r->state = TWS_REQ_STATE_FREE;
@@ -739,39 +739,8 @@
else
bcopy(csio->cdb_io.cdb_bytes, cmd_pkt->cmd.pkt_a.cdb, csio->cdb_len);
- if (!(ccb_h->flags & CAM_DATA_PHYS)) {
- /* Virtual data addresses. Need to convert them... */
- if (!(ccb_h->flags & CAM_SCATTER_VALID)) {
- if (csio->dxfer_len > TWS_MAX_IO_SIZE) {
- TWS_TRACE(sc, "I/O is big", csio->dxfer_len, 0);
- tws_release_request(req);
- ccb_h->status = CAM_REQ_TOO_BIG;
- xpt_done(ccb);
- return(0);
- }
-
- req->length = csio->dxfer_len;
- if (req->length) {
- req->data = csio->data_ptr;
- /* there is 1 sgl_entrie */
- /* cmd_pkt->cmd.pkt_a.lun_h4__sgl_entries |= 1; */
- }
- } else {
- TWS_TRACE_DEBUG(sc, "got sglist", ccb_h->target_id, ccb_h->target_lun);
- tws_release_request(req);
- ccb_h->status = CAM_REQ_INVALID;
- xpt_done(ccb);
- return(0);
- }
- } else {
- /* Data addresses are physical. */
- TWS_TRACE_DEBUG(sc, "Phy data addr", ccb_h->target_id, ccb_h->target_lun);
- tws_release_request(req);
- ccb_h->status = CAM_REQ_INVALID;
- ccb_h->status &= ~CAM_SIM_QUEUED;
- xpt_done(ccb);
- return(0);
- }
+ req->data = ccb;
+ req->flags |= TWS_DATA_CCB;
/* save ccb ptr */
req->ccb_ptr = ccb;
/*
@@ -779,7 +748,8 @@
* and submit the I/O.
*/
sc->stats.scsi_ios++;
- ccb_h->timeout_ch = timeout(tws_timeout, req, (ccb_h->timeout * hz)/1000);
+ callout_reset_sbt(&req->timeout, SBT_1MS * ccb->ccb_h.timeout, 0,
+ tws_timeout, req, 0);
error = tws_map_request(sc, req);
return(error);
}
@@ -817,7 +787,7 @@
bzero(req->data, TWS_SECTOR_SIZE);
req->flags = TWS_DIR_IN;
- req->thandle = timeout(tws_timeout, req, (TWS_IO_TIMEOUT * hz));
+ callout_reset(&req->timeout, (TWS_IO_TIMEOUT * hz), tws_timeout, req);
error = tws_map_request(sc, req);
return(error);
@@ -864,7 +834,7 @@
param->parameter_size_bytes = (u_int16_t)param_size;
memcpy(param->data, data, param_size);
- req->thandle = timeout(tws_timeout, req, (TWS_IOCTL_TIMEOUT * hz));
+ callout_reset(&req->timeout, (TWS_IOCTL_TIMEOUT * hz), tws_timeout, req);
error = tws_map_request(sc, req);
return(error);
@@ -961,10 +931,16 @@
* Map the data buffer into bus space and build the SG list.
*/
mtx_lock(&sc->io_lock);
- error = bus_dmamap_load(sc->data_tag, req->dma_map,
- req->data, req->length,
- tws_dmamap_data_load_cbfn, req,
- my_flags);
+ if (req->flags & TWS_DATA_CCB)
+ error = bus_dmamap_load_ccb(sc->data_tag, req->dma_map,
+ req->data,
+ tws_dmamap_data_load_cbfn, req,
+ my_flags);
+ else
+ error = bus_dmamap_load(sc->data_tag, req->dma_map,
+ req->data, req->length,
+ tws_dmamap_data_load_cbfn, req,
+ my_flags);
mtx_unlock(&sc->io_lock);
if (error == EINPROGRESS) {
@@ -1194,7 +1170,6 @@
return;
}
- tws_teardown_intr(sc);
xpt_freeze_simq(sc->sim, 1);
tws_send_event(sc, TWS_RESET_START);
@@ -1217,7 +1192,6 @@
mtx_unlock(&sc->gen_lock);
xpt_release_simq(sc->sim, 1);
- tws_setup_intr(sc, sc->irqs);
}
void
@@ -1231,7 +1205,6 @@
return;
}
- tws_teardown_intr(sc);
xpt_freeze_simq(sc->sim, 1);
tws_send_event(sc, TWS_RESET_START);
@@ -1248,7 +1221,6 @@
mtx_unlock(&sc->gen_lock);
xpt_release_simq(sc->sim, 1);
- tws_setup_intr(sc, sc->irqs);
}
static void
@@ -1323,7 +1295,7 @@
tws_turn_on_interrupts(sc);
- wakeup_one(sc->chan);
+ wakeup_one(sc);
}
Modified: trunk/sys/dev/tws/tws_hdm.c
===================================================================
--- trunk/sys/dev/tws/tws_hdm.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_hdm.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_hdm.c 275977 2014-12-21 02:39:10Z smh $
*/
@@ -99,7 +100,7 @@
regh = tws_read_reg(sc, TWS_I2O0_IOPOBQPH, 4);
regl = tws_read_reg(sc, TWS_I2O0_IOPOBQPL, 4);
reg = (((u_int64_t)regh) << 32) | regl;
- TWS_TRACE_DEBUG(sc, "host outbound clenup",reg, regl);
+ TWS_TRACE_DEBUG(sc, "host outbound cleanup",reg, regl);
if ( regh == TWS_FIFO_EMPTY32 )
break;
}
@@ -161,7 +162,7 @@
req->error_code = TWS_REQ_RET_INVALID;
req->cb = NULL;
req->ccb_ptr = NULL;
- req->thandle.callout = NULL;
+ callout_stop(&req->timeout);
req->next = req->prev = NULL;
req->state = TWS_REQ_STATE_BUSY;
#endif // 0
Modified: trunk/sys/dev/tws/tws_hdm.h
===================================================================
--- trunk/sys/dev/tws/tws_hdm.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_hdm.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_hdm.h 275977 2014-12-21 02:39:10Z smh $
*/
@@ -410,7 +411,7 @@
void (*cb)(struct tws_request *); /* callback func */
bus_dmamap_t dma_map; /* dma map */
union ccb *ccb_ptr; /* pointer to ccb */
- struct callout_handle thandle; /* handle to req timeout */
+ struct callout timeout; /* request timeout timer */
struct tws_softc *sc; /* pointer back to ctlr softc */
struct tws_request *next; /* pointer to next request */
Modified: trunk/sys/dev/tws/tws_services.c
===================================================================
--- trunk/sys/dev/tws/tws_services.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_services.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_services.c 275977 2014-12-21 02:39:10Z smh $
*/
#include <dev/tws/tws.h>
@@ -395,7 +396,6 @@
, sc->stats.num_intrs);
TWS_TRACE(sc, "reqs(ioctls, scsi)", sc->stats.ioctls
, sc->stats.scsi_ios);
- timeout(tws_print_stats, sc, 300*hz);
-
+ callout_reset(&sc->stats_timer, 300 * hz, tws_print_stats, sc);
}
/* --------------------- misc service end --------------------- */
Modified: trunk/sys/dev/tws/tws_services.h
===================================================================
--- trunk/sys/dev/tws/tws_services.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_services.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_services.h 226887 2011-10-28 17:53:34Z delphij $
*/
Modified: trunk/sys/dev/tws/tws_user.c
===================================================================
--- trunk/sys/dev/tws/tws_user.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_user.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_user.c 263125 2014-03-14 00:57:32Z delphij $
*/
#include <dev/tws/tws.h>
@@ -73,9 +74,7 @@
break;
case TWS_IOCTL_SCAN_BUS :
TWS_TRACE_DEBUG(sc, "scan-bus", 0, 0);
- mtx_lock(&sc->sim_lock);
error = tws_bus_scan(sc);
- mtx_unlock(&sc->sim_lock);
break;
default :
TWS_TRACE_DEBUG(sc, "ioctl-aen", cmd, buf);
@@ -105,8 +104,7 @@
do {
req = tws_get_request(sc, TWS_REQ_TYPE_PASSTHRU);
if ( !req ) {
- sc->chan = (void *)sc;
- error = tsleep(sc->chan, 0, "tws_sleep", TWS_IOCTL_TIMEOUT*hz);
+ error = tsleep(sc, 0, "tws_sleep", TWS_IOCTL_TIMEOUT*hz);
if ( error == EWOULDBLOCK ) {
return(ETIMEDOUT);
}
@@ -205,7 +203,7 @@
//
req->state = TWS_REQ_STATE_FREE;
- wakeup_one(sc->chan);
+ wakeup_one(sc);
return(error);
}
Modified: trunk/sys/dev/tws/tws_user.h
===================================================================
--- trunk/sys/dev/tws/tws_user.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tws/tws_user.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 2010, LSI Corp.
* All rights reserved.
@@ -31,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/tws/tws_user.h 226026 2011-10-04 21:40:25Z delphij $
*/
#define TWS_AEN_NOT_RETRIEVED 0x1
Modified: trunk/sys/dev/tx/if_tx.c
===================================================================
--- trunk/sys/dev/tx/if_tx.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tx/if_tx.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/tx/if_tx.c 266921 2014-05-31 11:08:22Z brueffer $");
/*
* EtherPower II 10/100 Fast Ethernet (SMC 9432 serie)
@@ -1151,12 +1151,10 @@
{
epic_softc_t *sc;
struct mii_data *mii;
- struct ifmedia *ifm;
sc = ifp->if_softc;
mii = device_get_softc(sc->miibus);
EPIC_LOCK(sc);
- ifm = &mii->mii_media;
/* Nothing should be selected if interface is down. */
if ((ifp->if_flags & IFF_UP) == 0) {
Modified: trunk/sys/dev/tx/if_txreg.h
===================================================================
--- trunk/sys/dev/tx/if_txreg.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tx/if_txreg.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/dev/tx/if_txreg.h,v 1.2 2009/11/28 22:44:33 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Semen Ustimenko
* All rights reserved.
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/dev/tx/if_txreg.h 119690 2003-09-02 17:30:40Z jhb $
*/
#define EPIC_MAX_MTU 1600 /* This is experiment-derived value */
Modified: trunk/sys/dev/tx/if_txvar.h
===================================================================
--- trunk/sys/dev/tx/if_txvar.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/tx/if_txvar.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/dev/tx/if_txvar.h,v 1.2 2009/11/28 22:44:33 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Semen Ustimenko
* All rights reserved.
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/dev/tx/if_txvar.h 179706 2008-06-10 17:59:43Z jhb $
*/
/*
Modified: trunk/sys/dev/txp/3c990img.h
===================================================================
--- trunk/sys/dev/txp/3c990img.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/txp/3c990img.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/txp/3c990img.h 189022 2009-02-25 01:12:56Z yongari $ */
/*-
* Copyright 1999-2003 3Com Corporation. All Rights Reserved.
Modified: trunk/sys/dev/txp/if_txp.c
===================================================================
--- trunk/sys/dev/txp/if_txp.c 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/txp/if_txp.c 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */
/*-
@@ -35,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/txp/if_txp.c 327590 2018-01-05 17:23:17Z pfg $");
/*
* Driver for 3c990 (Typhoon) Ethernet ASIC
@@ -369,7 +370,7 @@
* diagnose sleep image specific issues.
*/
rsp = NULL;
- if (txp_ext_command(sc, TXP_CMD_READ_VERSION, 0, 0, 0, NULL, 0,
+ if (txp_ext_command(sc, TXP_CMD_VERSIONS_READ, 0, 0, 0, NULL, 0,
&rsp, TXP_CMD_WAIT)) {
device_printf(dev, "can not read sleep image version\n");
error = ENXIO;
Modified: trunk/sys/dev/txp/if_txpreg.h
===================================================================
--- trunk/sys/dev/txp/if_txpreg.h 2018-05-27 22:53:06 UTC (rev 10057)
+++ trunk/sys/dev/txp/if_txpreg.h 2018-05-27 22:54:44 UTC (rev 10058)
@@ -1,5 +1,6 @@
-/* $OpenBSD: if_txpreg.h,v 1.30 2001/06/23 04:18:02 jason Exp $ */
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $OpenBSD: if_txpreg.h,v 1.34 2001/11/05 17:25:58 art Exp $ */
+/* $FreeBSD: stable/10/sys/dev/txp/if_txpreg.h 327590 2018-01-05 17:23:17Z pfg $ */
/*-
* Copyright (c) 2001 Aaron Campbell <aaron at monkey.org>.
@@ -164,7 +165,7 @@
#define TXP_CMD_FILTER_TABLE_MODE_WRITE 0x3d
#define TXP_CMD_FILTER_TCL_WRITE 0x3e
#define TXP_CMD_FILTER_TBL_READ 0x3f
-#define TXP_CMD_READ_VERSION 0x43
+#define TXP_CMD_VERSIONS_READ 0x43
#define TXP_CMD_FILTER_DEFINE 0x45
#define TXP_CMD_ADD_WAKEUP_PKT 0x46
#define TXP_CMD_ADD_SLEEP_PKT 0x47
@@ -382,6 +383,7 @@
#define FRAG_FLAGS_TYPE_OPT 0x03 /* type: options */
#define FRAG_FLAGS_TYPE_RX 0x04 /* type: command */
#define FRAG_FLAGS_TYPE_RESP 0x05 /* type: response */
+#define FRAG_FLAGS_VALID 0x80 /* valid descriptor */
struct txp_opt_desc {
uint8_t opt_desctype:3,
More information about the Midnightbsd-cvs
mailing list