Module Name: src Committed By: martin Date: Wed Feb 15 19:35:14 UTC 2023
Modified Files: src/sys/arch/next68k/dev [netbsd-10]: intio.c intiovar.h nextcons.c nextdisplay.c nextdisplayvar.h src/sys/arch/next68k/include [netbsd-10]: bus_space.h cpu.h src/sys/arch/next68k/next68k [netbsd-10]: locore.s nextrom.c nextrom.h pmap_bootstrap.c src/sys/arch/next68k/stand/boot [netbsd-10]: boot.c version Log Message: Pull up following revision(s) (requested by tsutsui in ticket #88): sys/arch/next68k/next68k/nextrom.h: revision 1.13 sys/arch/next68k/dev/nextdisplayvar.h: revision 1.6 sys/arch/next68k/dev/intiovar.h: revision 1.8 sys/arch/next68k/dev/nextcons.c: revision 1.12 sys/arch/next68k/next68k/locore.s: revision 1.69 sys/arch/next68k/dev/nextcons.c: revision 1.13 sys/arch/next68k/dev/nextcons.c: revision 1.14 sys/arch/next68k/dev/nextdisplay.c: revision 1.30 sys/arch/next68k/stand/boot/boot.c: revision 1.13 sys/arch/next68k/next68k/nextrom.c: revision 1.28 sys/arch/next68k/next68k/nextrom.c: revision 1.29 sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.46 sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.47 sys/arch/next68k/include/cpu.h: revision 1.52 sys/arch/next68k/dev/intio.c: revision 1.17 sys/arch/next68k/dev/intio.c: revision 1.18 sys/arch/next68k/dev/intio.c: revision 1.19 sys/arch/next68k/next68k/locore.s: revision 1.72 sys/arch/next68k/stand/boot/version: revision 1.6 sys/arch/next68k/include/bus_space.h: revision 1.21 sys/arch/next68k/include/bus_space.h: revision 1.22 sys/arch/next68k/dev/nextdisplay.c: revision 1.26 sys/arch/next68k/include/bus_space.h: revision 1.23 sys/arch/next68k/dev/nextdisplay.c: revision 1.27 sys/arch/next68k/dev/nextdisplay.c: revision 1.28 sys/arch/next68k/dev/nextdisplay.c: revision 1.29 Misc KNF and cosmetics. Use proper C99 int types. Remove trailing spaces and TABs. Handle NeXT Turbo VRAM regions properly. Info from Andreas Grabher on port-next68k@: https://mail-index.netbsd.org/port-next68k/2023/02/06/msg000052.html Also refactor bus_space_map(9) and fix (unused) bus_space_mmap(9). Add and check machine type NeXT_CUBE_TURBO (type 8). Info from Andreas Grabher on port-next68k@. NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG. Info from Andreas Grabher on port-next68k@. Bump version again to denote NeXT_CUBE_TURBO support. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.16.6.1 src/sys/arch/next68k/dev/intio.c cvs rdiff -u -r1.7 -r1.7.90.1 src/sys/arch/next68k/dev/intiovar.h cvs rdiff -u -r1.11 -r1.11.90.1 src/sys/arch/next68k/dev/nextcons.c cvs rdiff -u -r1.25 -r1.25.6.1 src/sys/arch/next68k/dev/nextdisplay.c cvs rdiff -u -r1.5 -r1.5.68.1 src/sys/arch/next68k/dev/nextdisplayvar.h cvs rdiff -u -r1.19.18.1 -r1.19.18.2 src/sys/arch/next68k/include/bus_space.h cvs rdiff -u -r1.50.26.1 -r1.50.26.2 src/sys/arch/next68k/include/cpu.h cvs rdiff -u -r1.68.4.1 -r1.68.4.2 src/sys/arch/next68k/next68k/locore.s cvs rdiff -u -r1.27 -r1.27.30.1 src/sys/arch/next68k/next68k/nextrom.c cvs rdiff -u -r1.12 -r1.12.4.1 src/sys/arch/next68k/next68k/nextrom.h cvs rdiff -u -r1.44.46.1 -r1.44.46.2 \ src/sys/arch/next68k/next68k/pmap_bootstrap.c cvs rdiff -u -r1.12 -r1.12.48.1 src/sys/arch/next68k/stand/boot/boot.c cvs rdiff -u -r1.4.238.1 -r1.4.238.2 src/sys/arch/next68k/stand/boot/version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/next68k/dev/intio.c diff -u src/sys/arch/next68k/dev/intio.c:1.16 src/sys/arch/next68k/dev/intio.c:1.16.6.1 --- src/sys/arch/next68k/dev/intio.c:1.16 Sat Aug 7 16:19:01 2021 +++ src/sys/arch/next68k/dev/intio.c Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: intio.c,v 1.16 2021/08/07 16:19:01 thorpej Exp $ */ +/* $NetBSD: intio.c,v 1.16.6.1 2023/02/15 19:35:14 martin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -34,14 +34,15 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.16 2021/08/07 16:19:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.16.6.1 2023/02/15 19:35:14 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> -#include <sys/device.h> +#include <sys/device.h> #include <sys/reboot.h> #include <machine/autoconf.h> +#include <machine/cpu.h> #include <next68k/dev/intiovar.h> @@ -53,12 +54,6 @@ int intiosearch(device_t, cfdata_t, cons CFATTACH_DECL_NEW(intio, 0, intiomatch, intioattach, NULL, NULL); -#if 0 -struct cfdriver intio_cd = { - NULL, "intio", DV_DULL -}; -#endif - static bool intio_attached; int @@ -66,9 +61,9 @@ intiomatch(device_t parent, cfdata_t mat { /* Allow only one instance. */ if (intio_attached) - return (0); + return 0; - return (1); + return 1; } void @@ -92,24 +87,48 @@ intioprint(void *aux, const char *pnp) if (ia->ia_addr) aprint_normal(" addr %p", ia->ia_addr); - return (UNCONF); + return UNCONF; } int intiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) { - struct mainbus_attach_args *mba = (struct mainbus_attach_args *) aux; + struct mainbus_attach_args *mba = aux; struct intio_attach_args ia; do { ia.ia_addr = NULL; ia.ia_bst = NEXT68K_INTIO_BUS_SPACE; ia.ia_dmat = mba->mba_dmat; - + if (!config_probe(parent, cf, &ia)) break; config_attach(parent, cf, &ia, intioprint, CFARGS_NONE); } while (cf->cf_fstate == FSTATE_STAR); - return (0); + return 0; +} + +int +bus_space_map(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size, + int flags, bus_space_handle_t *bsh) +{ + + if (addr >= INTIOBASE && (addr + size) < INTIOTOP) { + *bsh = IIOV(addr); + return 0; + } + + return EINVAL; +} + +paddr_t +bus_space_mmap(bus_space_tag_t bst, bus_addr_t addr, off_t offset, int prot, + int flags) +{ + + if (addr >= INTIOBASE && (addr + offset) < INTIOTOP) + return m68k_btop(addr + offset); + + return -1; } Index: src/sys/arch/next68k/dev/intiovar.h diff -u src/sys/arch/next68k/dev/intiovar.h:1.7 src/sys/arch/next68k/dev/intiovar.h:1.7.90.1 --- src/sys/arch/next68k/dev/intiovar.h:1.7 Sun Jan 2 08:19:03 2011 +++ src/sys/arch/next68k/dev/intiovar.h Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: intiovar.h,v 1.7 2011/01/02 08:19:03 tsutsui Exp $ */ +/* $NetBSD: intiovar.h,v 1.7.90.1 2023/02/15 19:35:14 martin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -47,7 +47,7 @@ struct intio_attach_args { extern vaddr_t intiobase; extern vaddr_t intiolimit; -extern vaddr_t monobase; -extern vaddr_t monolimit; -extern vaddr_t colorbase; -extern vaddr_t colorlimit; +extern vaddr_t fbbase; +extern vaddr_t fblimit; +extern paddr_t fbbasepa; +extern paddr_t fblimitpa; Index: src/sys/arch/next68k/dev/nextcons.c diff -u src/sys/arch/next68k/dev/nextcons.c:1.11 src/sys/arch/next68k/dev/nextcons.c:1.11.90.1 --- src/sys/arch/next68k/dev/nextcons.c:1.11 Sat Apr 24 19:58:13 2010 +++ src/sys/arch/next68k/dev/nextcons.c Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextcons.c,v 1.11 2010/04/24 19:58:13 dbj Exp $ */ +/* $NetBSD: nextcons.c,v 1.11.90.1 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1999 Darrin B. Jewell @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.11 2010/04/24 19:58:13 dbj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.11.90.1 2023/02/15 19:35:14 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -63,13 +63,14 @@ void nextcnprobe(struct consdev *cp) { - if ((rom_machine_type == NeXT_WARP9) - || (rom_machine_type == NeXT_X15) - || (rom_machine_type == NeXT_WARP9C) - || (rom_machine_type == NeXT_TURBO_MONO) - || (rom_machine_type == NeXT_TURBO_COLOR)) + if (rom_machine_type == NeXT_WARP9 || + rom_machine_type == NeXT_X15 || + rom_machine_type == NeXT_WARP9C || + rom_machine_type == NeXT_TURBO_MONO || + rom_machine_type == NeXT_TURBO_COLOR || + rom_machine_type == NeXT_CUBE_TURBO) cp->cn_pri = CN_INTERNAL; - else + else cp->cn_pri = CN_DEAD; cp->cn_dev = NODEV; @@ -78,6 +79,7 @@ nextcnprobe(struct consdev *cp) void nextcninit(struct consdev *cp) { + nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE); nextdisplay_cnattach(); } @@ -85,17 +87,20 @@ nextcninit(struct consdev *cp) int nextcngetc (dev_t dev) { + return wskbd_cngetc(dev); } void nextcnputc(dev_t dev, int c) { - wsdisplay_cnputc(dev,c); + + wsdisplay_cnputc(dev,c); } void nextcnpollc(dev_t dev, int on) { + wskbd_cnpollc(dev,on); } Index: src/sys/arch/next68k/dev/nextdisplay.c diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.25 src/sys/arch/next68k/dev/nextdisplay.c:1.25.6.1 --- src/sys/arch/next68k/dev/nextdisplay.c:1.25 Sat Aug 7 16:19:01 2021 +++ src/sys/arch/next68k/dev/nextdisplay.c Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplay.c,v 1.25 2021/08/07 16:19:01 thorpej Exp $ */ +/* $NetBSD: nextdisplay.c,v 1.25.6.1 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.25 2021/08/07 16:19:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.25.6.1 2023/02/15 19:35:14 martin Exp $"); #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ @@ -136,8 +136,8 @@ static struct nextdisplay_config nextdis static int nextdisplay_is_console(vaddr_t addr) { - return (nextdisplay_console_dc.isconsole - && (addr == nextdisplay_consaddr)); + return nextdisplay_console_dc.isconsole && + addr == nextdisplay_consaddr; } int @@ -147,10 +147,11 @@ nextdisplay_match(device_t parent, cfdat rom_machine_type == NeXT_X15 || rom_machine_type == NeXT_WARP9C || rom_machine_type == NeXT_TURBO_MONO || - rom_machine_type == NeXT_TURBO_COLOR) - return (1); - else - return (0); + rom_machine_type == NeXT_TURBO_COLOR || + rom_machine_type == NeXT_CUBE_TURBO) + return 1; + else + return 0; } void @@ -162,19 +163,13 @@ nextdisplay_init(struct nextdisplay_conf /* printf("in nextdisplay_init\n"); */ - if (color) { - dc->dc_vaddr = colorbase; - dc->dc_paddr = COLORBASE; - dc->dc_size = NEXT_P_C16_VIDEOSIZE; - } else { - dc->dc_vaddr = monobase; - dc->dc_paddr = MONOBASE; - dc->dc_size = NEXT_P_VIDEOSIZE; - } + dc->dc_vaddr = fbbase; + dc->dc_paddr = fbbasepa; + dc->dc_size = color ? NEXT_P_C16_VIDEOSIZE : NEXT_P_VIDEOSIZE; dc->dc_wid = 1120; dc->dc_ht = 832; - dc->dc_depth = color ? 16 : 2; + dc->dc_depth = color ? 16 : 2; dc->dc_rowbytes = (turbo ? 1120 : 1152) * dc->dc_depth / 8; dc->dc_videobase = dc->dc_vaddr; @@ -182,8 +177,8 @@ nextdisplay_init(struct nextdisplay_conf #if 0 printf("intiobase at: %08x\n", intiobase); printf("intiolimit at: %08x\n", intiolimit); - printf("videobase at: %08x\n", color ? colorbase : monobase); - printf("videolimit at: %08x\n", color ? colorlimit : monolimit); + printf("videobase at: %08x\n", fbbase); + printf("videolimit at: %08x\n", fblimit); printf("virtual fb at: %08x\n", dc->dc_vaddr); printf("physical fb at: %08x\n", dc->dc_paddr); @@ -197,16 +192,16 @@ nextdisplay_init(struct nextdisplay_conf #endif /* clear the screen */ - for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t)) - *(u_int32_t *)(dc->dc_videobase + i) = - (color ? 0x0 : 0xffffffff); + for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(uint32_t)) + *(uint32_t *)(dc->dc_videobase + i) = + color ? 0x0 : 0xffffffff; rap = &dc->dc_raster; rap->width = dc->dc_wid; rap->height = dc->dc_ht; rap->depth = color ? 16 : 2; - rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t); - rap->pixels = (u_int32_t *)dc->dc_videobase; + rap->linelongs = dc->dc_rowbytes / sizeof(uint32_t); + rap->pixels = (uint32_t *)dc->dc_videobase; /* initialize the raster console blitter */ rcp = &dc->dc_rcons; @@ -217,11 +212,11 @@ nextdisplay_init(struct nextdisplay_conf rcons_init(rcp, 34, 80); if (color) { - nextdisplay_color.nrows = dc->dc_rcons.rc_maxrow; - nextdisplay_color.ncols = dc->dc_rcons.rc_maxcol; + nextdisplay_color.nrows = dc->dc_rcons.rc_maxrow; + nextdisplay_color.ncols = dc->dc_rcons.rc_maxcol; } else { - nextdisplay_mono.nrows = dc->dc_rcons.rc_maxrow; - nextdisplay_mono.ncols = dc->dc_rcons.rc_maxcol; + nextdisplay_mono.nrows = dc->dc_rcons.rc_maxrow; + nextdisplay_mono.ncols = dc->dc_rcons.rc_maxcol; } } @@ -231,22 +226,14 @@ nextdisplay_attach(device_t parent, devi struct nextdisplay_softc *sc = device_private(self); struct wsemuldisplaydev_attach_args waa; int isconsole; - int iscolor; - paddr_t addr; + vaddr_t addr; sc->sc_dev = self; - if (rom_machine_type == NeXT_WARP9C || - rom_machine_type == NeXT_TURBO_COLOR) { - iscolor = 1; - addr = colorbase; - } else { - iscolor = 0; - addr = monobase; - } + addr = fbbase; isconsole = nextdisplay_is_console(addr); - + if (isconsole) { sc->sc_dc = &nextdisplay_console_dc; sc->nscreens = 1; @@ -257,9 +244,9 @@ nextdisplay_attach(device_t parent, devi } printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht, - sc->sc_dc->dc_depth); + sc->sc_dc->dc_depth); - if (iscolor) { + if (iscolor && !turbo) { #if 0 uint8_t x; @@ -267,13 +254,15 @@ nextdisplay_attach(device_t parent, devi aprint_debug_dev(sc->sc_dev, "cmd=%02x\n", x); #endif *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG) = 0x05; - isrlink_autovec(nextdisplay_intr, sc, NEXT_I_IPL(NEXT_I_C16_VIDEO), 1, NULL); + isrlink_autovec(nextdisplay_intr, sc, + NEXT_I_IPL(NEXT_I_C16_VIDEO), 1, NULL); INTR_ENABLE(NEXT_I_C16_VIDEO); } /* initialize the raster */ waa.console = isconsole; - waa.scrdata = iscolor ? &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono; + waa.scrdata = iscolor ? + &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono; waa.accessops = &nextdisplay_accessops; waa.accesscookie = sc; #if 0 @@ -290,18 +279,18 @@ nextdisplay_intr(void *arg) #endif if (!INTR_OCCURRED(NEXT_I_C16_VIDEO)) - return (0); + return 0; #if 0 x = *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG); printf("I%02x", x); #endif *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG) = 0x05; - return (1); + return 1; } int nextdisplay_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, - struct lwp *l) + struct lwp *l) { struct nextdisplay_softc *sc = v; struct nextdisplay_config *dc = sc->sc_dc; @@ -352,21 +341,19 @@ nextdisplay_alloc_screen(void *v, const /* only allow one screen */ if (sc->nscreens > 0) - return (ENOMEM); + return ENOMEM; *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */ *curxp = 0; *curyp = 0; - rcons_allocattr(&sc->sc_dc->dc_rcons, 0, 0, - (strcmp(type->name, "color") == 0) - ? 0 - : WSATTR_REVERSE, &defattr); + rcons_allocattr(&sc->sc_dc->dc_rcons, 0, 0, + (strcmp(type->name, "color") == 0) ? 0 : WSATTR_REVERSE, &defattr); *defattrp = defattr; sc->nscreens++; #if 0 printf("nextdisplay: allocating screen\n"); #endif - return (0); + return 0; } void @@ -385,13 +372,14 @@ nextdisplay_show_screen(void *v, void *c void (*cb)(void *, int, int), void *cbarg) { - return (0); + return 0; } static int nextdisplay_load_font(void *v, void *cookie, struct wsdisplay_font *font) { - return (EPASSTHROUGH); + + return EPASSTHROUGH; } int @@ -399,24 +387,17 @@ nextdisplay_cnattach(void) { struct nextdisplay_config *dc = &nextdisplay_console_dc; long defattr; - int iscolor; - - if (rom_machine_type == NeXT_WARP9C || - rom_machine_type == NeXT_TURBO_COLOR) - iscolor = 1; - else - iscolor = 0; /* set up the display */ nextdisplay_init(&nextdisplay_console_dc, iscolor); nextdisplay_consaddr = nextdisplay_console_dc.dc_vaddr; - rcons_allocattr(&dc->dc_rcons, 0, 0, - iscolor ? 0 : WSATTR_REVERSE, &defattr); + rcons_allocattr(&dc->dc_rcons, 0, 0, + iscolor ? 0 : WSATTR_REVERSE, &defattr); wsdisplay_cnattach(iscolor ? &nextdisplay_color : &nextdisplay_mono, - &dc->dc_rcons, 0, 0, defattr); + &dc->dc_rcons, 0, 0, defattr); dc->isconsole = 1; - return (0); + return 0; } Index: src/sys/arch/next68k/dev/nextdisplayvar.h diff -u src/sys/arch/next68k/dev/nextdisplayvar.h:1.5 src/sys/arch/next68k/dev/nextdisplayvar.h:1.5.68.1 --- src/sys/arch/next68k/dev/nextdisplayvar.h:1.5 Sat Oct 27 17:18:05 2012 +++ src/sys/arch/next68k/dev/nextdisplayvar.h Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplayvar.h,v 1.5 2012/10/27 17:18:05 chs Exp $ */ +/* $NetBSD: nextdisplayvar.h,v 1.5.68.1 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis * All rights reserved. @@ -34,7 +34,7 @@ #include <machine/bus.h> -extern int nextdisplay_cnattach(void); +int nextdisplay_cnattach(void); struct nextdisplay_config; struct fbcmap; @@ -48,17 +48,17 @@ struct nextdisplay_config { paddr_t dc_paddr; /* memory space physical base address */ psize_t dc_size; /* size of slot memory */ - vaddr_t dc_videobase; /* base of flat frame buffer */ + vaddr_t dc_videobase; /* base of flat frame buffer */ - int dc_wid; /* width of frame buffer */ - int dc_ht; /* height of frame buffer */ - int dc_depth; /* depth of frame buffer */ - int dc_rowbytes; /* bytes in fb scan line */ + int dc_wid; /* width of frame buffer */ + int dc_ht; /* height of frame buffer */ + int dc_depth; /* depth of frame buffer */ + int dc_rowbytes; /* bytes in fb scan line */ - struct raster dc_raster; /* raster description */ - struct rcons dc_rcons; /* raster blitter control info */ + struct raster dc_raster; /* raster description */ + struct rcons dc_rcons; /* raster blitter control info */ - int dc_blanked; /* currently has video disabled */ + int dc_blanked; /* currently has video disabled */ int isconsole; }; @@ -67,6 +67,6 @@ struct nextdisplay_softc { device_t sc_dev; struct nextdisplay_config *sc_dc; - + int nscreens; }; Index: src/sys/arch/next68k/include/bus_space.h diff -u src/sys/arch/next68k/include/bus_space.h:1.19.18.1 src/sys/arch/next68k/include/bus_space.h:1.19.18.2 --- src/sys/arch/next68k/include/bus_space.h:1.19.18.1 Wed Feb 1 18:55:11 2023 +++ src/sys/arch/next68k/include/bus_space.h Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_space.h,v 1.19.18.1 2023/02/01 18:55:11 martin Exp $ */ +/* $NetBSD: bus_space.h,v 1.19.18.2 2023/02/15 19:35:14 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -82,25 +82,14 @@ typedef u_long bus_space_handle_t; #define NEXT68K_INTIO_BUS_SPACE ((bus_space_tag_t)intiobase) /* - * Values for the next68k video bus space tags, not to be used directly - * by MI code. - */ -#define NEXT68K_MONO_VIDEO_BUS_SPACE ((bus_space_tag_t)monobase) -#define NEXT68K_COLOR_VIDEO_BUS_SPACE ((bus_space_tag_t)colorbase) - -/* * Mapping and unmapping operations. */ -#define bus_space_map(t, a, s, f, hp) \ - ((((a)>=INTIOBASE)&&((a)+(s)<INTIOTOP)) ? \ - ((*(hp)=(bus_space_handle_t)((t)+((a)-INTIOBASE))),0) : \ - ((((a)>=MONOBASE)&&((a)+(s)<MONOTOP)) ? \ - ((*(hp)=(bus_space_handle_t)((t)+((a)-MONOBASE))),0) : \ - ((((a)>=COLORBASE)&&((a)+(s)<COLORTOP)) ? \ - ((*(hp)=(bus_space_handle_t)((t)+((a)-COLORBASE))),0) : (-1)))) + +int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, + bus_space_handle_t *); #define bus_space_unmap(t, h, s) - + #define bus_space_subregion(t, h, o, s, hp) \ (*(hp)=(h)+(o)) @@ -122,16 +111,10 @@ typedef u_long bus_space_handle_t; * Mmap an area of bus space. */ -#define bus_space_mmap(t, a, s, prot, flags) \ - ((((a)>=INTIOBASE)&&((a)+(s)<INTIOTOP)) ? \ - m68k_btop((t)+((a)-INTIOBASE)) : \ - ((((a)>=MONOBASE)&&((a)+(s)<MONOTOP)) ? \ - m68k_btop((t)+((a)-MONOBASE)) : \ - ((((a)>=COLORBASE)&&((a)+(s)<COLORTOP)) ? \ - m68k_btop((t)+((a)-COLORBASE)) : (-1)))) +paddr_t bus_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); /* - * u_intN_t bus_space_read_N(bus_space_tag_t tag, + * uintN_t bus_space_read_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset); * * Read a 1, 2, 4, or 8 byte quantity from bus space @@ -139,18 +122,18 @@ typedef u_long bus_space_handle_t; */ #define bus_space_read_1(t, h, o) \ - ((void) t, (*(volatile u_int8_t *)((h) + (o)))) + ((void) t, (*(volatile uint8_t *)((h) + (o)))) #define bus_space_read_2(t, h, o) \ - ((void) t, (*(volatile u_int16_t *)((h) + (o)))) + ((void) t, (*(volatile uint16_t *)((h) + (o)))) #define bus_space_read_4(t, h, o) \ - ((void) t, (*(volatile u_int32_t *)((h) + (o)))) + ((void) t, (*(volatile uint32_t *)((h) + (o)))) /* * void bus_space_read_multi_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, - * u_intN_t *addr, size_t count); + * uintN_t *addr, size_t count); * * Read `count' 1, 2, 4, or 8 byte quantities from bus space * described by tag/handle/offset and copy into buffer provided. @@ -201,7 +184,7 @@ typedef u_long bus_space_handle_t; /* * void bus_space_read_region_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, - * u_intN_t *addr, size_t count); + * uintN_t *addr, size_t count); * * Read `count' 1, 2, 4, or 8 byte quantities from bus space * described by tag/handle and starting at `offset' and copy into @@ -253,25 +236,25 @@ typedef u_long bus_space_handle_t; /* * void bus_space_write_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, - * u_intN_t value); + * uintN_t value); * * Write the 1, 2, 4, or 8 byte value `value' to bus space * described by tag/handle/offset. */ #define bus_space_write_1(t, h, o, v) \ - ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v)))) + ((void) t, ((void)(*(volatile uint8_t *)((h) + (o)) = (v)))) #define bus_space_write_2(t, h, o, v) \ - ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v)))) + ((void) t, ((void)(*(volatile uint16_t *)((h) + (o)) = (v)))) #define bus_space_write_4(t, h, o, v) \ - ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v)))) + ((void) t, ((void)(*(volatile uint32_t *)((h) + (o)) = (v)))) /* * void bus_space_write_multi_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, - * const u_intN_t *addr, size_t count); + * const uintN_t *addr, size_t count); * * Write `count' 1, 2, 4, or 8 byte quantities from the buffer * provided to bus space described by tag/handle/offset. @@ -322,7 +305,7 @@ typedef u_long bus_space_handle_t; /* * void bus_space_write_region_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, - * const u_intN_t *addr, size_t count); + * const uintN_t *addr, size_t count); * * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided * to bus space described by tag/handle starting at `offset'. @@ -372,7 +355,7 @@ typedef u_long bus_space_handle_t; /* * void bus_space_set_multi_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, + * bus_space_handle_t bsh, bus_size_t offset, uintN_t val, * size_t count); * * Write the 1, 2, 4, or 8 byte value `val' to bus space described @@ -423,7 +406,7 @@ typedef u_long bus_space_handle_t; /* * void bus_space_set_region_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, + * bus_space_handle_t bsh, bus_size_t offset, uintN_t val, * size_t count); * * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described Index: src/sys/arch/next68k/include/cpu.h diff -u src/sys/arch/next68k/include/cpu.h:1.50.26.1 src/sys/arch/next68k/include/cpu.h:1.50.26.2 --- src/sys/arch/next68k/include/cpu.h:1.50.26.1 Wed Feb 1 18:55:11 2023 +++ src/sys/arch/next68k/include/cpu.h Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.50.26.1 2023/02/01 18:55:11 martin Exp $ */ +/* $NetBSD: cpu.h,v 1.50.26.2 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -120,6 +120,7 @@ void loadustp(int); void doboot(void) __attribute__((__noreturn__)); int nmihand(void *); +extern int iscolor; #endif /* _KERNEL */ #define NEXT_RAMBASE (0x4000000) /* really depends on slot, but... */ @@ -315,7 +316,10 @@ int nmihand(void *); #define MONOBASE (0x0b000000) #define MONOTOP (0x0b03a800) #define COLORBASE (0x2c000000) -#define COLORTOP (0x2c1D4000) +#define COLORTOP (0x2c1d4000) +#define TURBOFBBASE (0x0c000000) +#define TURBOMONOTOP (0x0c03a800) +#define TURBOCOLORTOP (0x0c1d4000) #define NEXT_INTR_BITS \ "\20\40NMI\37PFAIL\36TIMER\35ENETX_DMA\34ENETR_DMA\33SCSI_DMA\32DISK_DMA\31PRINTER_DMA\30SOUND_OUT_DMA\27SOUND_IN_DMA\26SCC_DMA\25DSP_DMA\24M2R_DMA\23R2M_DMA\22SCC\21REMOTE\20BUS\17DSP_4\16DISK|C16_VIDEO\15SCSI\14PRINTER\13ENETX\12ENETR\11SOUND_OVRUN\10PHONE\07DSP_3\06VIDEO\05MONITOR\04KYBD_MOUSE\03POWER\02SOFTINT1\01SOFTINT0" @@ -333,10 +337,4 @@ int nmihand(void *); #define IIOP(va) ((int)(va)-intiobase+INTIOBASE) #define IIOMAPSIZE btoc(INTIOTOP-INTIOBASE) /* 2mb */ -/* mono fb space */ -#define MONOMAPSIZE btoc(MONOTOP-MONOBASE) /* who cares */ - -/* color fb space */ -#define COLORMAPSIZE btoc(COLORTOP-COLORBASE) /* who cares */ - #endif /* _MACHINE_CPU_H_ */ Index: src/sys/arch/next68k/next68k/locore.s diff -u src/sys/arch/next68k/next68k/locore.s:1.68.4.1 src/sys/arch/next68k/next68k/locore.s:1.68.4.2 --- src/sys/arch/next68k/next68k/locore.s:1.68.4.1 Sun Feb 12 11:48:56 2023 +++ src/sys/arch/next68k/next68k/locore.s Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.68.4.1 2023/02/12 11:48:56 martin Exp $ */ +/* $NetBSD: locore.s,v 1.68.4.2 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell @@ -113,7 +113,7 @@ GLOBAL(kernel_text) /* * Leave page zero empty so it can be unmapped - */ + */ .space PAGE_SIZE /* @@ -402,7 +402,7 @@ Lpushpc: jbsr _C_LABEL(pmap_bootstrap_finalize) /* set kernel stack, user SP */ movl _C_LABEL(lwp0uarea),%a1 | get lwp0 uarea - lea %a1@(USPACE-4),%sp | set kernel stack to end of area + lea %a1@(USPACE-4),%sp | set kernel stack to end of area movl #USRSTACK-4,%a2 movl %a2,%usp | init user SP @@ -445,7 +445,7 @@ Lenab3: /* * Trap/interrupt vector routines - */ + */ #include <m68k/m68k/trap_subr.s> /* @@ -556,7 +556,7 @@ ENTRY_NOPROFILE(trap0) movw #SPL1,%sr tstb _C_LABEL(ssir) jne Lsir1 -Ltrap1: +Ltrap1: movl %sp@(FR_SP),%a0 | grab and restore movl %a0,%usp | user SP moveml %sp@+,#0x7FFF | restore most registers @@ -814,7 +814,7 @@ Lgotsir: moveml #0xFFFF,%sp@- | save all registers movl %usp,%a1 | including movl %a1,%sp@(FR_SP) | the users SP -Lsir1: +Lsir1: clrl %sp@- | VA == none clrl %sp@- | code == none movl #T_SSIR,%sp@- | type == software interrupt @@ -841,7 +841,7 @@ Ldorte: /* * Primitives - */ + */ /* * Use common m68k support routines. @@ -1043,7 +1043,7 @@ Ldoboot1: movel %a0,%d0 | "-h" halts instead of reboot. trap #13 -hloop: +hloop: bra hloop | This shouldn't be reached. /* * Misc. global variables. @@ -1076,17 +1076,17 @@ GLOBAL(intiobase) GLOBAL(intiolimit) .long INTIOTOP | KVA of end of internal IO space -GLOBAL(monobase) - .long MONOBASE | KVA of base of mono FB +GLOBAL(fbbase) + .long 0 | KVA of base of framebuffer -GLOBAL(monolimit) - .long MONOTOP | KVA of end of mono FB +GLOBAL(fblimit) + .long 0 | KVA of end of framebuffer -GLOBAL(colorbase) - .long COLORBASE | KVA of base of color FB +GLOBAL(fbbasepa) + .long MONOBASE | PA of base of framebuffer -GLOBAL(colorlimit) - .long COLORTOP | KVA of end of color FB +GLOBAL(fblimitpa) + .long MONOTOP | PA of end of framebuffer ASLOCAL(save_vbr) | VBR from ROM .long 0xdeadbeef Index: src/sys/arch/next68k/next68k/nextrom.c diff -u src/sys/arch/next68k/next68k/nextrom.c:1.27 src/sys/arch/next68k/next68k/nextrom.c:1.27.30.1 --- src/sys/arch/next68k/next68k/nextrom.c:1.27 Wed Jul 18 23:10:27 2018 +++ src/sys/arch/next68k/next68k/nextrom.c Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextrom.c,v 1.27 2018/07/18 23:10:27 sevan Exp $ */ +/* $NetBSD: nextrom.c,v 1.27.30.1 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.27 2018/07/18 23:10:27 sevan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.27.30.1 2023/02/15 19:35:14 martin Exp $"); #include "opt_ddb.h" #include "opt_serial.h" @@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: nextrom.c,v #include <next68k/next68k/seglist.h> #include <next68k/next68k/nextrom.h> +#include <next68k/dev/intiovar.h> #ifdef DDB #include <sys/param.h> @@ -130,6 +131,7 @@ u_int rom_intrstat; paddr_t rom_reboot_vect; int turbo; +int iscolor; void next68k_bootargs(unsigned char **args) @@ -230,6 +232,8 @@ next68k_bootargs(unsigned char **args) int ix; int j = 0; char mach; + int turbo_l, iscolor_l; + paddr_t fbbasepa_l, fblimitpa_l; if (MONRELOC(char, MG_machine_type) == NeXT_X15) { msize16 = 0x1000000; @@ -257,6 +261,11 @@ next68k_bootargs(unsigned char **args) msize4 = 0x800000; msize1 = 0x200000; ROM_PUTS("Looks like a NeXT_TURBO_MONO\r\n"); + } else if (MONRELOC(char, MG_machine_type) == NeXT_CUBE_TURBO) { + msize16 = 0x2000000; + msize4 = 0x800000; + msize1 = 0x200000; + ROM_PUTS("Looks like a NeXT_CUBE_TURBO\r\n"); } else { msize16 = 0x100000; msize4 = 0x100000; @@ -266,10 +275,35 @@ next68k_bootargs(unsigned char **args) mach = MONRELOC(char, MG_machine_type); RELOC(rom_machine_type, char) = mach; - if (mach == NeXT_TURBO_MONO || mach == NeXT_TURBO_COLOR) - RELOC(turbo, int) = 1; + if (mach == NeXT_TURBO_MONO || + mach == NeXT_TURBO_COLOR || + mach == NeXT_CUBE_TURBO) + turbo_l = 1; + else + turbo_l = 0; + RELOC(turbo, int) = turbo_l; + + /* save framebuffer addresses for pmap_bootstrap() */ + if (mach == NeXT_WARP9C || mach == NeXT_TURBO_COLOR) + iscolor_l = 1; else - RELOC(turbo, int) = 0; + iscolor_l = 0; + if (turbo_l == 1) { + fbbasepa_l = TURBOFBBASE; + fblimitpa_l = (iscolor_l == 1) ? + TURBOCOLORTOP : TURBOMONOTOP; + } else { + if (iscolor_l == 1) { + fbbasepa_l = COLORBASE; + fblimitpa_l = COLORTOP; + } else { + fbbasepa_l = MONOBASE; + fblimitpa_l = MONOTOP; + } + } + RELOC(iscolor, int) = iscolor_l; + RELOC(fbbasepa, paddr_t) = fbbasepa_l; + RELOC(fblimitpa, paddr_t) = fblimitpa_l; for (ix = 0; ix < N_SIMM; ix++) { Index: src/sys/arch/next68k/next68k/nextrom.h diff -u src/sys/arch/next68k/next68k/nextrom.h:1.12 src/sys/arch/next68k/next68k/nextrom.h:1.12.4.1 --- src/sys/arch/next68k/next68k/nextrom.h:1.12 Wed May 18 13:56:32 2022 +++ src/sys/arch/next68k/next68k/nextrom.h Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nextrom.h,v 1.12 2022/05/18 13:56:32 andvar Exp $ */ +/* $NetBSD: nextrom.h,v 1.12.4.1 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -233,6 +233,7 @@ void *mon_alloc(); #define NeXT_WARP9C 3 #define NeXT_TURBO_MONO 4 #define NeXT_TURBO_COLOR 5 /* probed witnessed */ +#define NeXT_CUBE_TURBO 8 #define ROM_STACK_SIZE (8192 - 2048) Index: src/sys/arch/next68k/next68k/pmap_bootstrap.c diff -u src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.44.46.1 src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.44.46.2 --- src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.44.46.1 Sun Feb 12 11:48:56 2023 +++ src/sys/arch/next68k/next68k/pmap_bootstrap.c Wed Feb 15 19:35:14 2023 @@ -1,15 +1,15 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.44.46.1 2023/02/12 11:48:56 martin Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.44.46.2 2023/02/15 19:35:14 martin Exp $ */ /* * This file was taken from mvme68k/mvme68k/pmap_bootstrap.c * should probably be re-synced when needed. * cvs id of source for the most recent syncing: - * NetBSD: pmap_bootstrap.c,v 1.15 2000/11/20 19:35:30 scw Exp + * NetBSD: pmap_bootstrap.c,v 1.15 2000/11/20 19:35:30 scw Exp * NetBSD: pmap_bootstrap.c,v 1.17 2001/11/08 21:53:44 scw Exp */ -/* +/* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.44.46.1 2023/02/12 11:48:56 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.44.46.2 2023/02/15 19:35:14 martin Exp $"); #include "opt_m68k_arch.h" @@ -108,6 +108,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f #if defined(M68040) || defined(M68060) u_int stfree = 0; /* XXX: gcc -Wuninitialized */ #endif + u_int fbmapsize; /* * Initialize the mem_clusters[] array for the crash dump @@ -178,8 +179,9 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f kptmpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + howmany(RELOC(physmem, int), NPTEPG) + - (IIOMAPSIZE + MONOMAPSIZE + COLORMAPSIZE + NPTEPG - 1) / NPTEPG; + fbmapsize = btoc(RELOC(fblimitpa, paddr_t) - RELOC(fbbasepa, paddr_t)); + nptpages = RELOC(Sysptsize, int) + howmany(RELOC(physmem, int), NPTEPG) + + (IIOMAPSIZE + fbmapsize + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE; /* @@ -416,29 +418,20 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f protopte = INTIOBASE | PG_RW | PG_CI | PG_U | PG_M | PG_V; epte = &pte[IIOMAPSIZE]; - RELOC(intiobase, uint8_t *) = (uint8_t *)PTE2VA(pte); - RELOC(intiolimit, uint8_t *) = (uint8_t *)PTE2VA(epte); + RELOC(intiobase, vaddr_t) = PTE2VA(pte); + RELOC(intiolimit, vaddr_t) = PTE2VA(epte); while (pte < epte) { *pte++ = protopte; protopte += PAGE_SIZE; } - /* validate the mono fb space PTEs */ - - protopte = MONOBASE | PG_RW | PG_CWT | PG_U | PG_M | PG_V; - epte = &pte[MONOMAPSIZE]; - RELOC(monobase, uint8_t *) = (uint8_t *)PTE2VA(pte); - RELOC(monolimit, uint8_t *) = (uint8_t *)PTE2VA(epte); - while (pte < epte) { - *pte++ = protopte; - protopte += PAGE_SIZE; - } + /* validate the framebuffer space PTEs */ - /* validate the color fb space PTEs */ - protopte = COLORBASE | PG_RW | PG_CWT | PG_U | PG_M | PG_V; - epte = &pte[COLORMAPSIZE]; - RELOC(colorbase, uint8_t *) = (uint8_t *)PTE2VA(pte); - RELOC(colorlimit, uint8_t *) = (uint8_t *)PTE2VA(epte); + protopte = RELOC(fbbasepa, paddr_t) | + PG_RW | PG_CWT | PG_U | PG_M | PG_V; + epte = &pte[fbmapsize]; + RELOC(fbbase, vaddr_t) = PTE2VA(pte); + RELOC(fblimit, vaddr_t) = PTE2VA(epte); while (pte < epte) { *pte++ = protopte; protopte += PAGE_SIZE; Index: src/sys/arch/next68k/stand/boot/boot.c diff -u src/sys/arch/next68k/stand/boot/boot.c:1.12 src/sys/arch/next68k/stand/boot/boot.c:1.12.48.1 --- src/sys/arch/next68k/stand/boot/boot.c:1.12 Sat Jun 11 06:35:00 2016 +++ src/sys/arch/next68k/stand/boot/boot.c Wed Feb 15 19:35:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.12 2016/06/11 06:35:00 dholland Exp $ */ +/* $NetBSD: boot.c,v 1.12.48.1 2023/02/15 19:35:14 martin Exp $ */ /* * Copyright (c) 1994 Rolf Grossmann * All rights reserved. @@ -84,7 +84,9 @@ main(char *boot_arg) #endif machine = MON(char, MG_machine_type); - if (machine == NeXT_TURBO_MONO || machine == NeXT_TURBO_COLOR) + if (machine == NeXT_TURBO_MONO || + machine == NeXT_TURBO_COLOR || + machine == NeXT_CUBE_TURBO) turbo = 1; else turbo = 0; Index: src/sys/arch/next68k/stand/boot/version diff -u src/sys/arch/next68k/stand/boot/version:1.4.238.1 src/sys/arch/next68k/stand/boot/version:1.4.238.2 --- src/sys/arch/next68k/stand/boot/version:1.4.238.1 Sun Feb 12 12:18:24 2023 +++ src/sys/arch/next68k/stand/boot/version Wed Feb 15 19:35:14 2023 @@ -1,7 +1,8 @@ -$NetBSD: version,v 1.4.238.1 2023/02/12 12:18:24 martin Exp $ +$NetBSD: version,v 1.4.238.2 2023/02/15 19:35:14 martin Exp $ 1.1: initial import 1.3: Add ELF support 1.4: loadfile() update: ELF symbols no longer need backward seeks. 1.5: loadfile() update to avoid backwards seeks for ELF Program Headers. 1.6: Fix a bug on DMA reg accesses and a problem on detecting old drives +1.7: Add support of NeXT_CUBE_TURBO