Some small cleanup -- make the base,limit values vaddr_t, not char*.

Also add some code that attempts to deal with C16_VIDEO interrupts, though it
does not seem to make my color slabs work again.
This commit is contained in:
mycroft 2003-10-01 01:25:06 +00:00
parent 5f4d907d3f
commit e0933f24da
5 changed files with 95 additions and 85 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intiovar.h,v 1.2 2002/09/11 01:46:31 mycroft Exp $ */
/* $NetBSD: intiovar.h,v 1.3 2003/10/01 01:25:06 mycroft Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -50,9 +50,9 @@ struct intio_attach_args {
bus_dma_tag_t ia_dmat; /* bus dma tag */
};
extern volatile char *intiobase;
extern volatile char *intiolimit;
extern volatile char *monobase;
extern volatile char *monolimit;
extern volatile char *colorbase;
extern volatile char *colorlimit;
extern vaddr_t intiobase;
extern vaddr_t intiolimit;
extern vaddr_t monobase;
extern vaddr_t monolimit;
extern vaddr_t colorbase;
extern vaddr_t colorlimit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nextdisplay.c,v 1.13 2003/07/15 02:59:32 lukem Exp $ */
/* $NetBSD: nextdisplay.c,v 1.14 2003/10/01 01:25:06 mycroft Exp $ */
/*
* Copyright (c) 1998 Matt DeBergalis
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.13 2003/07/15 02:59:32 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.14 2003/10/01 01:25:06 mycroft Exp $");
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.13 2003/07/15 02:59:32 lukem Exp $
#include <machine/cpu.h>
#include <next68k/next68k/nextrom.h>
#include <next68k/next68k/isr.h>
#include <next68k/dev/intiovar.h>
#include <next68k/dev/nextdisplayvar.h>
@ -124,14 +125,15 @@ const struct wsdisplay_accessops nextdisplay_accessops = {
};
void nextdisplay_init(struct nextdisplay_config *, int);
int nextdisplay_intr __P((void *));
paddr_t nextdisplay_consaddr;
static int nextdisplay_is_console __P((paddr_t addr));
vaddr_t nextdisplay_consaddr;
static int nextdisplay_is_console __P((vaddr_t addr));
static struct nextdisplay_config nextdisplay_console_dc;
static int
nextdisplay_is_console(paddr_t addr)
nextdisplay_is_console(vaddr_t addr)
{
return (nextdisplay_console_dc.isconsole
&& (addr == nextdisplay_consaddr));
@ -143,11 +145,11 @@ nextdisplay_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
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)
return (1);
else
return (0);
@ -160,19 +162,19 @@ nextdisplay_init(dc, color)
{
struct raster *rap;
struct rcons *rcp;
paddr_t addr;
int i;
/* printf("in nextdisplay_init\n"); */
if (color)
addr = (paddr_t)colorbase;
else
addr = (paddr_t)monobase;
dc->dc_vaddr = addr;
dc->dc_paddr = color ? COLORP(addr) : MONOP(addr);
dc->dc_size = color ? NEXT_P_C16_VIDEOSIZE : NEXT_P_VIDEOSIZE;
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_wid = 1120;
dc->dc_ht = 832;
@ -235,21 +237,19 @@ nextdisplay_attach(parent, self, aux)
struct device *self;
void *aux;
{
struct nextdisplay_softc *sc;
struct nextdisplay_softc *sc = (void *)self;
struct wsemuldisplaydev_attach_args waa;
int isconsole;
int iscolor;
paddr_t addr;
sc = (struct nextdisplay_softc *)self;
if ((rom_machine_type == NeXT_WARP9C)
|| (rom_machine_type == NeXT_TURBO_COLOR)) {
if (rom_machine_type == NeXT_WARP9C ||
rom_machine_type == NeXT_TURBO_COLOR) {
iscolor = 1;
addr = (paddr_t)colorbase;
addr = colorbase;
} else {
iscolor = 0;
addr = (paddr_t)monobase;
addr = monobase;
}
isconsole = nextdisplay_is_console(addr);
@ -266,6 +266,18 @@ nextdisplay_attach(parent, self, aux)
printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
sc->sc_dc->dc_depth);
if (iscolor) {
#if 0
uint8_t x;
x = *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG);
printf("%s: cmd=%02x\n", sc->sc_dev.dv_xname, 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);
INTR_ENABLE(NEXT_I_C16_VIDEO);
}
/* initialize the raster */
waa.console = isconsole;
waa.scrdata = iscolor ? &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono;
@ -277,6 +289,23 @@ nextdisplay_attach(parent, self, aux)
config_found(self, &waa, wsemuldisplaydevprint);
}
int
nextdisplay_intr(arg)
void *arg;
{
#if 0
uint8_t x;
#endif
if (!INTR_OCCURRED(NEXT_I_C16_VIDEO))
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) |= 0x01;
return (1);
}
int
nextdisplay_ioctl(v, cmd, data, flag, p)
@ -400,17 +429,15 @@ nextdisplay_cnattach(void)
long defattr;
int iscolor;
if ((rom_machine_type == NeXT_WARP9C)
|| (rom_machine_type == NeXT_TURBO_COLOR)) {
if (rom_machine_type == NeXT_WARP9C ||
rom_machine_type == NeXT_TURBO_COLOR)
iscolor = 1;
nextdisplay_consaddr = (paddr_t)colorbase;
} else {
else
iscolor = 0;
nextdisplay_consaddr = (paddr_t)monobase;
}
/* 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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_space.h,v 1.9 2002/09/11 01:46:33 mycroft Exp $ */
/* $NetBSD: bus_space.h,v 1.10 2003/10/01 01:25:06 mycroft Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -80,14 +80,14 @@ typedef u_long bus_space_handle_t;
/*
* Value for the next68k bus space tag, not to be used directly by MI code.
*/
#define NEXT68K_INTIO_BUS_SPACE intiobase
#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 monobase
#define NEXT68K_COLOR_VIDEO_BUS_SPACE colorbase
#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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.23 2003/08/07 16:28:55 agc Exp $ */
/* $NetBSD: cpu.h,v 1.24 2003/10/01 01:25:06 mycroft Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -278,11 +278,11 @@ void next68k_calibrate_delay __P((void));
#define NEXT_P_EVENTC (NEXT_SLOT_ID_BMAP+0x0201a000)
#define NEXT_P_BMAP (NEXT_SLOT_ID+0x020c0000)
/* All COLOR_FB registers are 1 byte wide */
#define NEXT_P_C16_DAC_0 (NEXT_SLOT_ID_BMAP+0x02018100) /* COLOR_FB - RAMDAC */
#define NEXT_P_C16_DAC_1 (NEXT_SLOT_ID_BMAP+0x02018101)
#define NEXT_P_C16_DAC_2 (NEXT_SLOT_ID_BMAP+0x02018102)
#define NEXT_P_C16_DAC_3 (NEXT_SLOT_ID_BMAP+0x02018103)
#define NEXT_P_C16_CMD_REG (NEXT_SLOT_ID_BMAP+0x02018180) /* COLOR_FB - CSR */
#define NEXT_P_C16_DAC_0 (NEXT_SLOT_ID+0x02018100) /* COLOR_FB - RAMDAC */
#define NEXT_P_C16_DAC_1 (NEXT_SLOT_ID+0x02018101)
#define NEXT_P_C16_DAC_2 (NEXT_SLOT_ID+0x02018102)
#define NEXT_P_C16_DAC_3 (NEXT_SLOT_ID+0x02018103)
#define NEXT_P_C16_CMD_REG (NEXT_SLOT_ID+0x02018180) /* COLOR_FB - CSR */
/* system control registers */
#define NEXT_P_MEMTIMING (NEXT_SLOT_ID_BMAP+0x02006010)
@ -416,27 +416,14 @@ void next68k_calibrate_delay __P((void));
* ``intiolimit'' (defined in locore.s). Since it is always mapped,
* conversion between physical and kernel virtual addresses is easy.
*/
#define ISIIOVA(va) \
((char *)(va) >= intiobase && (char *)(va) < intiolimit)
#define IIOV(pa) ((int)(pa)-INTIOBASE+(int)intiobase)
#define IIOP(va) ((int)(va)-(int)intiobase+INTIOBASE)
#define IIOPOFF(pa) ((int)(pa)-INTIOBASE)
#define IIOV(pa) ((int)(pa)-INTIOBASE+intiobase)
#define IIOP(va) ((int)(va)-intiobase+INTIOBASE)
#define IIOMAPSIZE btoc(INTIOTOP-INTIOBASE) /* 2mb */
/* mono fb space */
#define ISMONOVA(va) \
((char *)(va) >= monobase && (char *)(va) < monolimit)
#define MONOV(pa) ((int)(pa)-MONOBASE+(int)monobase)
#define MONOP(va) ((int)(va)-(int)monobase+MONOBASE)
#define MONOPOFF(pa) ((int)(pa)-MONOBASE)
#define MONOMAPSIZE btoc(MONOTOP-MONOBASE) /* who cares */
/* color fb space */
#define ISCOLORVA(va) \
((char *)(va) >= colorbase && (char *)(va) < colorlimit)
#define COLORV(pa) ((int)(pa)-COLORBASE+(int)colorbase)
#define COLORP(va) ((int)(va)-(int)colorbase+COLORBASE)
#define COLORPOFF(pa) ((int)(pa)-COLORBASE)
#define COLORMAPSIZE btoc(COLORTOP-COLORBASE) /* who cares */
#endif /* _MACHINE_CPU_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_bootstrap.c,v 1.14 2003/08/07 16:28:56 agc Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.15 2003/10/01 01:25:06 mycroft Exp $ */
/*
* This file was taken from mvme68k/mvme68k/pmap_bootstrap.c
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.14 2003/08/07 16:28:56 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.15 2003/10/01 01:25:06 mycroft Exp $");
#include <sys/param.h>
#include <sys/kcore.h>
@ -455,30 +455,30 @@ pmap_bootstrap(nextpa, firstpa)
* COLORMAPSIZE pages prior to external IO space at end of static
* kernel page table.
*/
RELOC(colorbase, char *) =
(char *)m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE - MONOMAPSIZE - COLORMAPSIZE);
RELOC(colorlimit, char *) =
(char *)m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE - MONOMAPSIZE);
RELOC(colorbase, vaddr_t) =
m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE - MONOMAPSIZE - COLORMAPSIZE);
RELOC(colorlimit, vaddr_t) =
m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE - MONOMAPSIZE);
/*
* monobase, monolimit: base and end of mono fb space.
* MONOMAPSIZE pages prior to external IO space at end of static
* kernel page table.
*/
RELOC(monobase, char *) =
(char *)m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE - MONOMAPSIZE);
RELOC(monolimit, char *) =
(char *)m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE);
RELOC(monobase, vaddr_t) =
m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE - MONOMAPSIZE);
RELOC(monolimit, vaddr_t) =
m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE);
/*
* intiobase, intiolimit: base and end of internal IO space.
* IIOMAPSIZE pages prior to external IO space at end of static
* kernel page table.
*/
RELOC(intiobase, char *) =
(char *)m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE);
RELOC(intiolimit, char *) =
(char *)m68k_ptob(nptpages*NPTEPG);
RELOC(intiobase, vaddr_t) =
m68k_ptob(nptpages*NPTEPG - IIOMAPSIZE);
RELOC(intiolimit, vaddr_t) =
m68k_ptob(nptpages*NPTEPG);
/*
* Setup u-area for process 0.
@ -652,24 +652,20 @@ pmap_bootstrap(nextpa, firstpa)
void
pmap_init_md(void)
{
vaddr_t addr;
addr = (vaddr_t) intiobase;
if (uvm_map(kernel_map, &addr, m68k_ptob(IIOMAPSIZE),
if (uvm_map(kernel_map, &intiobase, m68k_ptob(IIOMAPSIZE),
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
UVM_INH_NONE, UVM_ADV_RANDOM,
UVM_FLAG_FIXED)) != 0)
goto failed;
addr = (vaddr_t) monobase;
if (uvm_map(kernel_map, &addr, m68k_ptob(MONOMAPSIZE),
if (uvm_map(kernel_map, &monobase, m68k_ptob(MONOMAPSIZE),
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
UVM_INH_NONE, UVM_ADV_RANDOM,
UVM_FLAG_FIXED)) != 0)
goto failed;
addr = (vaddr_t) colorbase;
if (uvm_map(kernel_map, &addr, m68k_ptob(COLORMAPSIZE),
if (uvm_map(kernel_map, &colorbase, m68k_ptob(COLORMAPSIZE),
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
UVM_INH_NONE, UVM_ADV_RANDOM,