git: 655d043b496e - main - Remove gxemul drivers.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Feb 2023 18:21:06 UTC
The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=655d043b496e19e4e1463a12278a895d0d40b33d commit 655d043b496e19e4e1463a12278a895d0d40b33d Author: Justin Hibbits <jhibbits@FreeBSD.org> AuthorDate: 2023-02-06 18:06:25 +0000 Commit: Justin Hibbits <jhibbits@FreeBSD.org> 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 <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/cons.h> -#include <sys/endian.h> -#include <sys/kdb.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/reboot.h> -#include <sys/tty.h> - -#include <ddb/ddb.h> - -#include <machine/cpuregs.h> - -#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 <jmallett@FreeBSD.org> - * 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 <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/bio.h> -#include <sys/systm.h> -#include <sys/bus.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 <geom/geom.h> - -#include <machine/cpuregs.h> - -#include <dev/gxemul/disk/gxemul_diskreg.h> - -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 <jmallett@FreeBSD.org> - * 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 <jmallett@FreeBSD.org> - * 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 <jmallett@FreeBSD.org> - * 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 <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/endian.h> -#include <sys/kernel.h> -#include <sys/mbuf.h> -#include <sys/lock.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/rman.h> -#include <sys/socket.h> -#include <sys/sockio.h> -#include <sys/sysctl.h> - -#include <net/bpf.h> -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_media.h> -#include <net/if_types.h> -#include <net/if_var.h> -#include <net/if_vlan_var.h> - -#ifdef INET -#include <netinet/in.h> -#include <netinet/if_ether.h> -#endif - -#include <machine/cpuregs.h> - -#include <dev/gxemul/ether/gxreg.h> - -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 ***