Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/next68k Handle NeXT Turbo VRAM regions properly.
details: https://anonhg.NetBSD.org/src/rev/3b0d06210a23
branches: trunk
changeset: 373441:3b0d06210a23
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Feb 11 02:31:34 2023 +0000
description:
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).
diffstat:
sys/arch/next68k/dev/intio.c | 29 +++++++++++++++++++++-
sys/arch/next68k/dev/intiovar.h | 10 +++---
sys/arch/next68k/dev/nextdisplay.c | 39 +++++++-----------------------
sys/arch/next68k/include/bus_space.h | 27 +++-----------------
sys/arch/next68k/include/cpu.h | 14 ++++------
sys/arch/next68k/next68k/locore.s | 18 +++++++-------
sys/arch/next68k/next68k/nextrom.c | 35 ++++++++++++++++++++++++---
sys/arch/next68k/next68k/pmap_bootstrap.c | 35 +++++++++++----------------
8 files changed, 106 insertions(+), 101 deletions(-)
diffs (truncated from 438 to 300 lines):
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/dev/intio.c
--- a/sys/arch/next68k/dev/intio.c Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/dev/intio.c Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intio.c,v 1.18 2023/02/04 14:38:09 tsutsui Exp $ */
+/* $NetBSD: intio.c,v 1.19 2023/02/11 02:31:34 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.18 2023/02/04 14:38:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.19 2023/02/11 02:31:34 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -42,6 +42,7 @@
#include <sys/reboot.h>
#include <machine/autoconf.h>
+#include <machine/cpu.h>
#include <next68k/dev/intiovar.h>
@@ -107,3 +108,27 @@
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;
+}
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/dev/intiovar.h
--- a/sys/arch/next68k/dev/intiovar.h Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/dev/intiovar.h Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intiovar.h,v 1.7 2011/01/02 08:19:03 tsutsui Exp $ */
+/* $NetBSD: intiovar.h,v 1.8 2023/02/11 02:31:34 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
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;
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/dev/nextdisplay.c
--- a/sys/arch/next68k/dev/nextdisplay.c Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/dev/nextdisplay.c Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $ */
/*
* Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $");
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
@@ -162,15 +162,9 @@
/* 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;
@@ -182,8 +176,8 @@
#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);
@@ -231,19 +225,11 @@
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);
@@ -400,13 +386,6 @@
{
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);
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/include/bus_space.h
--- a/sys/arch/next68k/include/bus_space.h Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/include/bus_space.h Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.h,v 1.22 2023/02/03 23:21:18 tsutsui Exp $ */
+/* $NetBSD: bus_space.h,v 1.23 2023/02/11 02:31:34 tsutsui Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -82,22 +82,11 @@
#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)
@@ -122,13 +111,7 @@
* 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);
/*
* uintN_t bus_space_read_N(bus_space_tag_t tag,
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/include/cpu.h
--- a/sys/arch/next68k/include/cpu.h Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/include/cpu.h Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.51 2023/01/27 15:21:52 tsutsui Exp $ */
+/* $NetBSD: cpu.h,v 1.52 2023/02/11 02:31:34 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -120,6 +120,7 @@
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 @@
#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 @@
#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_ */
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/next68k/locore.s
--- a/sys/arch/next68k/next68k/locore.s Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/next68k/locore.s Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.71 2023/02/04 08:42:45 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.72 2023/02/11 02:31:34 tsutsui Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
@@ -1076,17 +1076,17 @@
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
diff -r 72a5864f09c9 -r 3b0d06210a23 sys/arch/next68k/next68k/nextrom.c
--- a/sys/arch/next68k/next68k/nextrom.c Fri Feb 10 18:51:32 2023 +0000
+++ b/sys/arch/next68k/next68k/nextrom.c Sat Feb 11 02:31:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nextrom.c,v 1.27 2018/07/18 23:10:27 sevan Exp $ */
+/* $NetBSD: nextrom.c,v 1.28 2023/02/11 02:31:34 tsutsui 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.28 2023/02/11 02:31:34 tsutsui Exp $");
Home |
Main Index |
Thread Index |
Old Index