From nobody Mon Feb 6 18:21:06 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P9ZMR15yvz3n20G; Mon, 6 Feb 2023 18:21:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P9ZMR0kzdz3JhD; Mon, 6 Feb 2023 18:21:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675707667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TWY85JcseY00TAeqnek0J3bpi4J3PdX5NnnqHhQ75RA=; b=MYqfZs9qmopx1YEfpdILzIYZzacSEeYQQpnM5jmcJmr04ds4pf0PXxZt1TxdkOIkSLSeW/ 6a185yxmJks9UMTPNCVIaqg+GMeTH4y5OqE9nlCS+Ohp3OaByw8kj3GVRvZhCJuZTq1/0x tAviCghaa2e4GZrf2S1ouRTBBUTWdpXNbq8MXcK/orrGmGeiGFuww5NkvNxLMS7rsDBM2L Kvis7gEq3P52YhHyvqXZnljyWFXXc4rpnOltQiWXB1eYt9JC+FHVdOUhgcwPLpakKvGi9r WBYqc2dxs/K9MzC75WvONJ6nDCHCZprkxa9ypVKHZSx3LPPLvVku54AFumnPXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675707667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TWY85JcseY00TAeqnek0J3bpi4J3PdX5NnnqHhQ75RA=; b=sVoZVYi6ekLq7SLCiaEHYXbcWKYL19Yq5JWNJul5Wjd870Jk6zdsKxXQWbmoa27VGP0pKo jztLmKMpxsT1Oo4YI/vbV+g8sn/g9qdBPPrh3CI5zSva2pKNblh9q+sd7sa6Q8o/U9TQxB +vPwRtgX/soRxhu13Vz5JjY8HzyMIP5vMwSIPyLZpV+4jfWpCZwm/eqnrK/s5PhE3rb2nP 3CK6p1YPgimKzGp/WbDqcc3Uhv14EUV6SmBQUmrzdUJa8AkHFT3xgOsj6Mi7EquXGZcAwd RVVGB7ZPyCkveHBksyE/gA+v9Ym1NhN9EqFlqOOgdK4/kKkX/Uu4p0eXKRMhdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675707667; a=rsa-sha256; cv=none; b=iTgV+h9ruiZhkVtkRyf0/wRlKQyUWZ2KKk5czhlDSBN73bfWD1NegyNXuedlqG/Hslao7K VYDdP0m0P1o59BCo7BrbHFrmlFUL5U/u9uR7+I7+GJL4u2LSG3t5l1Qqogs+CQzL/SezyV jNFVJw/8WV5xqaom2Q2f8nj2zVU0cymYpGkE7gAgT8ZTl2sNyG1G4IDOu220KHzJuih8k/ Nz9hqLBd09Fe27EHCTWqfutG0CwtfoOFJRe1cxwEzbLYaUnJ7xINbdB0yfyI2x3Ua5CLoO 8oIh96IZdWdk/nVj1IEzOBSmFVocVx0yDcmYnN9Y3w7rot7B2Yg310D7JD6zHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P9ZMQ6vmVzl9m; Mon, 6 Feb 2023 18:21:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 316IL6Nw013945; Mon, 6 Feb 2023 18:21:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316IL6gk013944; Mon, 6 Feb 2023 18:21:06 GMT (envelope-from git) Date: Mon, 6 Feb 2023 18:21:06 GMT Message-Id: <202302061821.316IL6gk013944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 655d043b496e - main - Remove gxemul drivers. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 655d043b496e19e4e1463a12278a895d0d40b33d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=655d043b496e19e4e1463a12278a895d0d40b33d commit 655d043b496e19e4e1463a12278a895d0d40b33d Author: Justin Hibbits AuthorDate: 2023-02-06 18:06:25 +0000 Commit: Justin Hibbits CommitDate: 2023-02-06 18:06:25 +0000 Remove gxemul drivers. These were MIPS-only. --- sys/dev/gxemul/cons/gxemul_cons.c | 335 ------------------------ sys/dev/gxemul/disk/gxemul_disk.c | 331 ------------------------ sys/dev/gxemul/disk/gxemul_diskreg.h | 71 ----- sys/dev/gxemul/ether/gxreg.h | 65 ----- sys/dev/gxemul/ether/if_gx.c | 398 ----------------------------- tools/kerneldoc/subsys/Doxyfile-dev_gxemul | 21 -- 6 files changed, 1221 deletions(-) diff --git a/sys/dev/gxemul/cons/gxemul_cons.c b/sys/dev/gxemul/cons/gxemul_cons.c deleted file mode 100644 index 01c1d5d569de..000000000000 --- a/sys/dev/gxemul/cons/gxemul_cons.c +++ /dev/null @@ -1,335 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2011-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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#define GC_LOCK_INIT() mtx_init(&gc_lock, "gc_lock", NULL, MTX_SPIN) - -#define GC_LOCK() do { \ - if (!kdb_active) \ - mtx_lock_spin(&gc_lock); \ -} while (0) - -#define GC_LOCK_ASSERT() do { \ - if (!kdb_active) \ - mtx_assert(&gc_lock, MA_OWNED); \ -} while (0) - -#define GC_UNLOCK() do { \ - if (!kdb_active) \ - mtx_unlock_spin(&gc_lock); \ -} while (0) - - -static struct mtx gc_lock; - -/* - * Low-level console driver functions. - */ -static cn_probe_t gxemul_cons_cnprobe; -static cn_init_t gxemul_cons_cninit; -static cn_term_t gxemul_cons_cnterm; -static cn_getc_t gxemul_cons_cngetc; -static cn_putc_t gxemul_cons_cnputc; -static cn_grab_t gxemul_cons_cngrab; -static cn_ungrab_t gxemul_cons_cnungrab; - -/* - * TTY-level fields. - */ -static tsw_outwakeup_t gxemul_cons_outwakeup; - -static struct ttydevsw gxemul_cons_ttydevsw = { - .tsw_flags = TF_NOPREFIX, - .tsw_outwakeup = gxemul_cons_outwakeup, -}; - -static struct callout gxemul_cons_callout; -static u_int gxemul_cons_polltime = 10; -#ifdef KDB -static int gxemul_cons_alt_break_state; -#endif - -static void gxemul_cons_timeout(void *); - -/* - * I/O routines lifted from Deimos. - * - * XXXRW: Should be using FreeBSD's bus routines here, but they are not - * available until later in the boot. - */ - -static inline vm_offset_t -mips_phys_to_uncached(vm_paddr_t phys) -{ - - return (MIPS_PHYS_TO_DIRECT_UNCACHED(phys)); -} - -static inline uint8_t -mips_ioread_uint8(vm_offset_t vaddr) -{ - uint8_t v; - - __asm__ __volatile__ ("lbu %0, 0(%1)" : "=r" (v) : "r" (vaddr)); - return (v); -} - -static inline void -mips_iowrite_uint8(vm_offset_t vaddr, uint8_t v) -{ - - __asm__ __volatile__ ("sb %0, 0(%1)" : : "r" (v), "r" (vaddr)); -} - -/* - * gxemul-specific constants. - */ -#define GXEMUL_CONS_BASE 0x10000000 /* gxemul console device. */ - -/* - * Routines for interacting with the gxemul test console. Programming details - * are a result of manually inspecting the source code for gxemul's - * dev_cons.cc and dev_cons.h. - * - * Offsets of I/O channels relative to the base. - */ -#define GXEMUL_PUTGETCHAR_OFF 0x00000000 -#define GXEMUL_CONS_HALT 0x00000010 - -/* - * One-byte buffer as we can't check whether the console is readable without - * actually reading from it. - */ -static char buffer_data; -static int buffer_valid; - -/* - * Low-level read and write routines. - */ -static inline uint8_t -gxemul_cons_data_read(void) -{ - - return (mips_ioread_uint8(mips_phys_to_uncached(GXEMUL_CONS_BASE + - GXEMUL_PUTGETCHAR_OFF))); -} - -static inline void -gxemul_cons_data_write(uint8_t v) -{ - - mips_iowrite_uint8(mips_phys_to_uncached(GXEMUL_CONS_BASE + - GXEMUL_PUTGETCHAR_OFF), v); -} - -static int -gxemul_cons_writable(void) -{ - - return (1); -} - -static int -gxemul_cons_readable(void) -{ - uint32_t v; - - GC_LOCK_ASSERT(); - - if (buffer_valid) - return (1); - v = gxemul_cons_data_read(); - if (v != 0) { - buffer_valid = 1; - buffer_data = v; - return (1); - } - return (0); -} - -static void -gxemul_cons_write(char ch) -{ - - GC_LOCK_ASSERT(); - - while (!gxemul_cons_writable()); - gxemul_cons_data_write(ch); -} - -static char -gxemul_cons_read(void) -{ - - GC_LOCK_ASSERT(); - - while (!gxemul_cons_readable()); - buffer_valid = 0; - return (buffer_data); -} - -/* - * Implementation of a FreeBSD low-level, polled console driver. - */ -static void -gxemul_cons_cnprobe(struct consdev *cp) -{ - - sprintf(cp->cn_name, "ttyu0"); - cp->cn_pri = (boothowto & RB_SERIAL) ? CN_REMOTE : CN_NORMAL; -} - -static void -gxemul_cons_cninit(struct consdev *cp) -{ - - GC_LOCK_INIT(); -} - -static void -gxemul_cons_cnterm(struct consdev *cp) -{ - -} - -static int -gxemul_cons_cngetc(struct consdev *cp) -{ - int ret; - - GC_LOCK(); - ret = gxemul_cons_read(); - GC_UNLOCK(); - return (ret); -} - -static void -gxemul_cons_cnputc(struct consdev *cp, int c) -{ - - GC_LOCK(); - gxemul_cons_write(c); - GC_UNLOCK(); -} - -static void -gxemul_cons_cngrab(struct consdev *cp) -{ - -} - -static void -gxemul_cons_cnungrab(struct consdev *cp) -{ - -} - -CONSOLE_DRIVER(gxemul_cons); - -/* - * TTY-level functions for gxemul_cons. - */ -static void -gxemul_cons_ttyinit(void *unused) -{ - struct tty *tp; - - tp = tty_alloc(&gxemul_cons_ttydevsw, NULL); - tty_init_console(tp, 0); - tty_makedev(tp, NULL, "%s", "ttyu0"); - callout_init(&gxemul_cons_callout, 1); - callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, - gxemul_cons_timeout, tp); - -} -SYSINIT(gxemul_cons_ttyinit, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, - gxemul_cons_ttyinit, NULL); - -static void -gxemul_cons_outwakeup(struct tty *tp) -{ - int len; - u_char ch; - - /* - * XXXRW: Would be nice not to do blocking writes to the console here, - * rescheduling on our timer tick if work remains to be done.. - */ - for (;;) { - len = ttydisc_getc(tp, &ch, sizeof(ch)); - if (len == 0) - break; - GC_LOCK(); - gxemul_cons_write(ch); - GC_UNLOCK(); - } -} - -static void -gxemul_cons_timeout(void *v) -{ - struct tty *tp; - int c; - - tp = v; - tty_lock(tp); - GC_LOCK(); - while (gxemul_cons_readable()) { - c = gxemul_cons_read(); - GC_UNLOCK(); -#ifdef KDB - kdb_alt_break(c, &gxemul_cons_alt_break_state); -#endif - ttydisc_rint(tp, c, 0); - GC_LOCK(); - } - GC_UNLOCK(); - ttydisc_rint_done(tp); - tty_unlock(tp); - callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, - gxemul_cons_timeout, tp); -} diff --git a/sys/dev/gxemul/disk/gxemul_disk.c b/sys/dev/gxemul/disk/gxemul_disk.c deleted file mode 100644 index b53beb6492d1..000000000000 --- a/sys/dev/gxemul/disk/gxemul_disk.c +++ /dev/null @@ -1,331 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008-2012 Juli Mallett - * All rights reserved. - * - * 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$ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include - -struct gxemul_disk_softc { - device_t sc_dev; - uint64_t sc_size; - struct g_geom *sc_geom; - struct g_provider *sc_provider; -}; - -static struct mtx gxemul_disk_controller_mutex; - -static g_start_t gxemul_disk_start; -static g_access_t gxemul_disk_access; - -struct g_class g_gxemul_disk_class = { - .name = "GXemul", - .version = G_VERSION, - .start = gxemul_disk_start, - .access = gxemul_disk_access, -}; - -DECLARE_GEOM_CLASS(g_gxemul_disk_class, g_gxemul_disk); - -static void gxemul_disk_identify(driver_t *, device_t); -static int gxemul_disk_probe(device_t); -static int gxemul_disk_attach(device_t); -static void gxemul_disk_attach_geom(void *, int); - -static int gxemul_disk_read(unsigned, void *, off_t); -static int gxemul_disk_size(unsigned, uint64_t *); -static int gxemul_disk_write(unsigned, const void *, off_t); - -static void -gxemul_disk_start(struct bio *bp) -{ - struct gxemul_disk_softc *sc; - unsigned diskid; - off_t offset; - uint8_t *buf; - int error; - - sc = bp->bio_to->geom->softc; - diskid = device_get_unit(sc->sc_dev); - - if ((bp->bio_length % GXEMUL_DISK_DEV_BLOCKSIZE) != 0) { - g_io_deliver(bp, EINVAL); - return; - } - - buf = bp->bio_data; - offset = bp->bio_offset; - bp->bio_resid = bp->bio_length; - while (bp->bio_resid != 0) { - switch (bp->bio_cmd) { - case BIO_READ: - mtx_lock(&gxemul_disk_controller_mutex); - error = gxemul_disk_read(diskid, buf, offset); - mtx_unlock(&gxemul_disk_controller_mutex); - break; - case BIO_WRITE: - mtx_lock(&gxemul_disk_controller_mutex); - error = gxemul_disk_write(diskid, buf, offset); - mtx_unlock(&gxemul_disk_controller_mutex); - break; - default: - g_io_deliver(bp, EOPNOTSUPP); - return; - } - if (error != 0) { - g_io_deliver(bp, error); - return; - } - - buf += GXEMUL_DISK_DEV_BLOCKSIZE; - offset += GXEMUL_DISK_DEV_BLOCKSIZE; - bp->bio_completed += GXEMUL_DISK_DEV_BLOCKSIZE; - bp->bio_resid -= GXEMUL_DISK_DEV_BLOCKSIZE; - } - - g_io_deliver(bp, 0); -} - -static int -gxemul_disk_access(struct g_provider *pp, int r, int w, int e) -{ - return (0); -} - -static void -gxemul_disk_identify(driver_t *drv, device_t parent) -{ - unsigned diskid; - - mtx_init(&gxemul_disk_controller_mutex, "GXemul disk controller", NULL, MTX_DEF); - - mtx_lock(&gxemul_disk_controller_mutex); - for (diskid = 0; diskid < 0x100; diskid++) { - /* - * If we can read at offset 0, this disk id must be - * present enough. If we get an error, stop looking. - * Disks in GXemul are allocated linearly from 0. - */ - if (gxemul_disk_read(diskid, NULL, 0) != 0) - break; - BUS_ADD_CHILD(parent, 0, "gxemul_disk", diskid); - } - mtx_unlock(&gxemul_disk_controller_mutex); -} - -static int -gxemul_disk_probe(device_t dev) -{ - device_set_desc(dev, "GXemul test disk"); - - return (BUS_PROBE_NOWILDCARD); -} - -static void -gxemul_disk_attach_geom(void *arg, int flag) -{ - struct gxemul_disk_softc *sc; - - sc = arg; - - sc->sc_geom = g_new_geomf(&g_gxemul_disk_class, "%s", device_get_nameunit(sc->sc_dev)); - sc->sc_geom->softc = sc; - - sc->sc_provider = g_new_providerf(sc->sc_geom, "%s", sc->sc_geom->name); - sc->sc_provider->sectorsize = GXEMUL_DISK_DEV_BLOCKSIZE; - sc->sc_provider->mediasize = sc->sc_size; - g_error_provider(sc->sc_provider, 0); -} - -static int -gxemul_disk_attach(device_t dev) -{ - struct gxemul_disk_softc *sc; - unsigned diskid; - int error; - - diskid = device_get_unit(dev); - - sc = device_get_softc(dev); - sc->sc_dev = dev; - sc->sc_geom = NULL; - sc->sc_provider = NULL; - - mtx_lock(&gxemul_disk_controller_mutex); - error = gxemul_disk_size(diskid, &sc->sc_size); - if (error != 0) { - mtx_unlock(&gxemul_disk_controller_mutex); - return (error); - } - mtx_unlock(&gxemul_disk_controller_mutex); - - g_post_event(gxemul_disk_attach_geom, sc, M_WAITOK, NULL); - - return (0); -} - -static int -gxemul_disk_read(unsigned diskid, void *buf, off_t off) -{ - const volatile void *src; - - mtx_assert(&gxemul_disk_controller_mutex, MA_OWNED); - - if (off < 0 || off % GXEMUL_DISK_DEV_BLOCKSIZE != 0) - return (EINVAL); - -#ifdef _LP64 - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_OFFSET, (uint64_t)off); -#else - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_OFFSET_LO, - (uint32_t)(off & 0xffffffff)); - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_OFFSET_HI, - (uint32_t)((off >> 32) & 0xffffffff)); -#endif - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_DISKID, diskid); - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_START, GXEMUL_DISK_DEV_START_READ); - switch (GXEMUL_DISK_DEV_READ(GXEMUL_DISK_DEV_STATUS)) { - case GXEMUL_DISK_DEV_STATUS_FAILURE: - return (EIO); - default: - break; - } - - if (buf != NULL) { - src = GXEMUL_DISK_DEV_FUNCTION(GXEMUL_DISK_DEV_BLOCK); - memcpy(buf, (const void *)(uintptr_t)src, - GXEMUL_DISK_DEV_BLOCKSIZE); - } - - return (0); -} - -static int -gxemul_disk_size(unsigned diskid, uint64_t *sizep) -{ - uint64_t offset, ogood; - uint64_t m, s; - int error; - - m = 1; - s = 3; - ogood = 0; - - for (;;) { - offset = (ogood * s) + (m * GXEMUL_DISK_DEV_BLOCKSIZE); - - error = gxemul_disk_read(diskid, NULL, offset); - if (error != 0) { - if (m == 1 && s == 1) { - *sizep = ogood + GXEMUL_DISK_DEV_BLOCKSIZE; - return (0); - } - if (m > 1) - m /= 2; - if (s > 1) - s--; - continue; - } - if (ogood == offset) { - m = 1; - continue; - } - ogood = offset; - m++; - } - - return (EDOOFUS); -} - -static int -gxemul_disk_write(unsigned diskid, const void *buf, off_t off) -{ - volatile void *dst; - - mtx_assert(&gxemul_disk_controller_mutex, MA_OWNED); - - if (off < 0 || off % GXEMUL_DISK_DEV_BLOCKSIZE != 0) - return (EINVAL); - -#ifdef _LP64 - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_OFFSET, (uint64_t)off); -#else - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_OFFSET_LO, - (uint32_t)(off & 0xffffffff)); - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_OFFSET_HI, - (uint32_t)((off >> 32) & 0xffffffff)); -#endif - - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_DISKID, diskid); - - dst = GXEMUL_DISK_DEV_FUNCTION(GXEMUL_DISK_DEV_BLOCK); - memcpy((void *)(uintptr_t)dst, buf, GXEMUL_DISK_DEV_BLOCKSIZE); - - GXEMUL_DISK_DEV_WRITE(GXEMUL_DISK_DEV_START, GXEMUL_DISK_DEV_START_WRITE); - switch (GXEMUL_DISK_DEV_READ(GXEMUL_DISK_DEV_STATUS)) { - case GXEMUL_DISK_DEV_STATUS_FAILURE: - return (EIO); - default: - break; - } - - return (0); -} - -static device_method_t gxemul_disk_methods[] = { - DEVMETHOD(device_probe, gxemul_disk_probe), - DEVMETHOD(device_identify, gxemul_disk_identify), - DEVMETHOD(device_attach, gxemul_disk_attach), - - { 0, 0 } -}; - -static driver_t gxemul_disk_driver = { - "gxemul_disk", - gxemul_disk_methods, - sizeof (struct gxemul_disk_softc) -}; - -DRIVER_MODULE(gxemul_disk, nexus, gxemul_disk_driver, 0, 0); diff --git a/sys/dev/gxemul/disk/gxemul_diskreg.h b/sys/dev/gxemul/disk/gxemul_diskreg.h deleted file mode 100644 index 8db71f1593f9..000000000000 --- a/sys/dev/gxemul/disk/gxemul_diskreg.h +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008-2012 Juli Mallett - * All rights reserved. - * - * 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$ - */ - -#ifndef _DEV_GXEMUL_DISK_GXEMUL_DISK_H_ -#define _DEV_GXEMUL_DISK_GXEMUL_DISK_H_ - -#define GXEMUL_DISK_DEV_BASE (0x13000000) - -#define GXEMUL_DISK_DEV_BLOCKSIZE (0x0200) - -#define GXEMUL_DISK_DEV_ID_START (0x0000) -#define GXEMUL_DISK_DEV_ID_END (0x0100) - -#ifdef _LP64 -#define GXEMUL_DISK_DEV_OFFSET (0x0000) -#else -#define GXEMUL_DISK_DEV_OFFSET_LO (0x0000) -#define GXEMUL_DISK_DEV_OFFSET_HI (0x0008) -#endif -#define GXEMUL_DISK_DEV_DISKID (0x0010) -#define GXEMUL_DISK_DEV_START (0x0020) -#define GXEMUL_DISK_DEV_STATUS (0x0030) -#define GXEMUL_DISK_DEV_BLOCK (0x4000) - -#ifdef _LP64 -#define GXEMUL_DISK_DEV_FUNCTION(f) \ - (volatile uint64_t *)MIPS_PHYS_TO_DIRECT_UNCACHED(GXEMUL_DISK_DEV_BASE + (f)) -#define GXEMUL_DISK_DEV_READ(f) \ - (volatile uint64_t)*GXEMUL_DISK_DEV_FUNCTION(f) -#else -#define GXEMUL_DISK_DEV_FUNCTION(f) \ - (volatile uint32_t *)MIPS_PHYS_TO_DIRECT_UNCACHED(GXEMUL_DISK_DEV_BASE + (f)) -#define GXEMUL_DISK_DEV_READ(f) \ - (volatile uint32_t)*GXEMUL_DISK_DEV_FUNCTION(f) -#endif -#define GXEMUL_DISK_DEV_WRITE(f, v) \ - *GXEMUL_DISK_DEV_FUNCTION(f) = (v) - -#define GXEMUL_DISK_DEV_START_READ (0x00) -#define GXEMUL_DISK_DEV_START_WRITE (0x01) - -#define GXEMUL_DISK_DEV_STATUS_FAILURE (0x00) - -#endif /* !_DEV_GXEMUL_DISK_GXEMUL_DISK_H_ */ diff --git a/sys/dev/gxemul/ether/gxreg.h b/sys/dev/gxemul/ether/gxreg.h deleted file mode 100644 index 557c902befef..000000000000 --- a/sys/dev/gxemul/ether/gxreg.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008-2012 Juli Mallett - * All rights reserved. - * - * 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$ - */ - -#ifndef _DEV_GXEMUL_ETHER_GXREG_H_ -#define _DEV_GXEMUL_ETHER_GXREG_H_ - -#define GXEMUL_ETHER_DEV_BASE (0x14000000) -#define GXEMUL_ETHER_DEV_IRQ (3) - -#define GXEMUL_ETHER_DEV_MTU (0x4000) - -#define GXEMUL_ETHER_DEV_BUFFER (0x0000) -#define GXEMUL_ETHER_DEV_STATUS (0x4000) -#define GXEMUL_ETHER_DEV_LENGTH (0x4010) -#define GXEMUL_ETHER_DEV_COMMAND (0x4020) -#define GXEMUL_ETHER_DEV_MAC (0x4040) - -#ifdef _LP64 -#define GXEMUL_ETHER_DEV_FUNCTION(f) \ - (volatile uint64_t *)MIPS_PHYS_TO_DIRECT_UNCACHED(GXEMUL_ETHER_DEV_BASE + (f)) -#define GXEMUL_ETHER_DEV_READ(f) \ - (volatile uint64_t)*GXEMUL_ETHER_DEV_FUNCTION(f) -#else -#define GXEMUL_ETHER_DEV_FUNCTION(f) \ - (volatile uint32_t *)MIPS_PHYS_TO_DIRECT_UNCACHED(GXEMUL_ETHER_DEV_BASE + (f)) -#define GXEMUL_ETHER_DEV_READ(f) \ - (volatile uint32_t)*GXEMUL_ETHER_DEV_FUNCTION(f) -#endif -#define GXEMUL_ETHER_DEV_WRITE(f, v) \ - *GXEMUL_ETHER_DEV_FUNCTION(f) = (v) - -#define GXEMUL_ETHER_DEV_STATUS_RX_OK (0x01) -#define GXEMUL_ETHER_DEV_STATUS_RX_MORE (0x02) - -#define GXEMUL_ETHER_DEV_COMMAND_RX (0x00) -#define GXEMUL_ETHER_DEV_COMMAND_TX (0x01) - -#endif /* !_DEV_GXEMUL_ETHER_GXREG_H_ */ diff --git a/sys/dev/gxemul/ether/if_gx.c b/sys/dev/gxemul/ether/if_gx.c deleted file mode 100644 index e7bb927fd674..000000000000 --- a/sys/dev/gxemul/ether/if_gx.c +++ /dev/null @@ -1,398 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008-2012 Juli Mallett - * All rights reserved. - * - * 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$ - */ - -#include "opt_inet.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef INET -#include -#include -#endif - -#include - -#include - -struct gx_softc { - struct ifnet *sc_ifp; - device_t sc_dev; - unsigned sc_port; - int sc_flags; - struct ifmedia sc_ifmedia; - struct resource *sc_intr; - void *sc_intr_cookie; - struct mtx sc_mtx; -}; - -#define GXEMUL_ETHER_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define GXEMUL_ETHER_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) - -static void gx_identify(driver_t *, device_t); -static int gx_probe(device_t); -static int gx_attach(device_t); -static int gx_detach(device_t); -static int gx_shutdown(device_t); - -static void gx_init(void *); -static int gx_transmit(struct ifnet *, struct mbuf *); - -static int gx_medchange(struct ifnet *); -static void gx_medstat(struct ifnet *, struct ifmediareq *); - -static int gx_ioctl(struct ifnet *, u_long, caddr_t); - -static void gx_rx_intr(void *); - -static device_method_t gx_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, gx_identify), - DEVMETHOD(device_probe, gx_probe), - DEVMETHOD(device_attach, gx_attach), - DEVMETHOD(device_detach, gx_detach), - DEVMETHOD(device_shutdown, gx_shutdown), - - { 0, 0 } -}; - -static driver_t gx_driver = { - "gx", - gx_methods, - sizeof (struct gx_softc), -}; - -DRIVER_MODULE(gx, nexus, gx_driver, 0, 0); - -static void -gx_identify(driver_t *drv, device_t parent) -{ - BUS_ADD_CHILD(parent, 0, "gx", 0); -} - -static int -gx_probe(device_t dev) -{ - if (device_get_unit(dev) != 0) - return (ENXIO); - - device_set_desc(dev, "GXemul test Ethernet"); - - return (BUS_PROBE_NOWILDCARD); -} - -static int -gx_attach(device_t dev) -{ *** 292 LINES SKIPPED ***