summaryrefslogtreecommitdiff
path: root/sys/arch/luna88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2017-03-20 19:37:55 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2017-03-20 19:37:55 +0000
commit6e7ca112d2b11d85212a7ca7f4acefadaa743efd (patch)
treef9836135fcdd3b7a370013c0639fb685d1d46079 /sys/arch/luna88k
parent863766d9404a266a1e8ba4713b3e76f6ab115d84 (diff)
Replace hardcoded addresses with symbolic constants from <machine/board.h>
for enhanced grepability and fewer bad surprises. ok aoyama@
Diffstat (limited to 'sys/arch/luna88k')
-rw-r--r--sys/arch/luna88k/dev/if_le.c6
-rw-r--r--sys/arch/luna88k/dev/lcd.c11
-rw-r--r--sys/arch/luna88k/dev/lunafb.c27
-rw-r--r--sys/arch/luna88k/dev/omrasops.c6
-rw-r--r--sys/arch/luna88k/dev/omrasops.h10
-rw-r--r--sys/arch/luna88k/dev/omrasops1.c13
-rw-r--r--sys/arch/luna88k/dev/siotty.c9
-rw-r--r--sys/arch/luna88k/luna88k/locore.S29
8 files changed, 56 insertions, 55 deletions
diff --git a/sys/arch/luna88k/dev/if_le.c b/sys/arch/luna88k/dev/if_le.c
index dae705b6b5d..272a027f224 100644
--- a/sys/arch/luna88k/dev/if_le.c
+++ b/sys/arch/luna88k/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.10 2016/09/01 00:02:57 aoyama Exp $ */
+/* $OpenBSD: if_le.c,v 1.11 2017/03/20 19:37:54 miod Exp $ */
/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */
/*-
@@ -128,7 +128,7 @@ le_attach(struct device *parent, struct device *self, void *aux)
lesc->sc_r1 = (struct lereg1 *)ma->ma_addr; /* LANCE */
- sc->sc_mem = (void *)0x71010000; /* SRAM */
+ sc->sc_mem = (void *)(TRI_PORT_RAM + 0x10000); /* SRAM */
sc->sc_conf3 = LE_C3_BSWP;
sc->sc_addr = (u_long)sc->sc_mem & 0xffffff;
sc->sc_memsize = 64 * 1024; /* 64KB */
@@ -191,7 +191,7 @@ myetheraddr(uint8_t *ether)
}
break;
case LUNA_88K2:
- ds1220 = (void *)0xF1000008;
+ ds1220 = (void *)(LANCE_ADDR + 8);
loc = 12;
for (i = 0; i < 6; i++) {
unsigned u, l, hex;
diff --git a/sys/arch/luna88k/dev/lcd.c b/sys/arch/luna88k/dev/lcd.c
index 086a859ff72..7ab8c84413f 100644
--- a/sys/arch/luna88k/dev/lcd.c
+++ b/sys/arch/luna88k/dev/lcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcd.c,v 1.8 2017/03/15 11:13:34 aoyama Exp $ */
+/* $OpenBSD: lcd.c,v 1.9 2017/03/20 19:37:54 miod Exp $ */
/* $NetBSD: lcd.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $ */
/*-
@@ -37,6 +37,7 @@
#include <sys/fcntl.h>
#include <machine/autoconf.h>
+#include <machine/board.h>
#include <machine/conf.h>
#include <machine/lcd.h>
@@ -82,7 +83,7 @@ struct lcd_softc {
int sc_opened;
};
-struct cfattach lcd_ca = {
+const struct cfattach lcd_ca = {
sizeof(struct lcd_softc), lcd_match, lcd_attach
};
@@ -266,7 +267,7 @@ lcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
void
lcdbusywait()
{
- struct pio *p1 = (struct pio *)0x4D000000;
+ struct pio *p1 = (struct pio *)OBIO_PIO1_BASE;
int msb, s;
s = splhigh();
@@ -287,7 +288,7 @@ lcdbusywait()
void
lcdput(int cc)
{
- struct pio *p1 = (struct pio *)0x4D000000;
+ struct pio *p1 = (struct pio *)OBIO_PIO1_BASE;
int s;
lcdbusywait();
@@ -304,7 +305,7 @@ lcdput(int cc)
void
lcdctrl(int cc)
{
- struct pio *p1 = (struct pio *)0x4D000000;
+ struct pio *p1 = (struct pio *)OBIO_PIO1_BASE;
int s;
lcdbusywait();
diff --git a/sys/arch/luna88k/dev/lunafb.c b/sys/arch/luna88k/dev/lunafb.c
index fccc7b76a70..ad42b7ac5f4 100644
--- a/sys/arch/luna88k/dev/lunafb.c
+++ b/sys/arch/luna88k/dev/lunafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lunafb.c,v 1.23 2017/01/15 20:22:33 fcambus Exp $ */
+/* $OpenBSD: lunafb.c,v 1.24 2017/03/20 19:37:54 miod Exp $ */
/* $NetBSD: lunafb.c,v 1.7.6.1 2002/08/07 01:48:34 lukem Exp $ */
/*-
@@ -48,8 +48,9 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
-#include <machine/cpu.h>
#include <machine/autoconf.h>
+#include <machine/board.h>
+#include <machine/cpu.h>
struct bt454 {
volatile u_int8_t bt_addr; /* map address register */
@@ -58,23 +59,23 @@ struct bt454 {
struct bt458 {
volatile u_int8_t bt_addr; /* map address register */
- unsigned :24;
+ unsigned :24;
volatile u_int8_t bt_cmap; /* colormap data register */
- unsigned :24;
+ unsigned :24;
volatile u_int8_t bt_ctrl; /* control register */
- unsigned :24;
+ unsigned :24;
volatile u_int8_t bt_omap; /* overlay (cursor) map register */
- unsigned :24;
+ unsigned :24;
};
-#define OMFB_RFCNT 0xB1000000 /* video h-origin/v-origin */
-#define OMFB_PLANEMASK 0xB1040000 /* planemask register */
-#define OMFB_FB_WADDR 0xB1080008 /* common plane */
-#define OMFB_FB_RADDR 0xB10C0008 /* plane #0 */
+#define OMFB_RFCNT BMAP_RFCNT /* video h-origin/v-origin */
+#define OMFB_PLANEMASK BMAP_BMSEL /* planemask register */
+#define OMFB_FB_WADDR (BMAP_BMP + 8) /* common plane */
+#define OMFB_FB_RADDR (BMAP_BMAP0 + 8)/* plane #0 */
#define OMFB_FB_PLANESIZE 0x40000 /* size of 1 plane, 2048 / 8 * 1024 */
-#define OMFB_ROPFUNC 0xB12C0000 /* ROP function code */
-#define OMFB_RAMDAC 0xC1100000 /* Bt454/Bt458 RAMDAC */
-#define OMFB_SIZE (0xB1300000 - 0xB1080000 + PAGE_SIZE)
+#define OMFB_ROPFUNC BMAP_FN /* ROP function code */
+#define OMFB_RAMDAC BMAP_PALLET2 /* Bt454/Bt458 RAMDAC */
+#define OMFB_SIZE (BMAP_FN0 - BMAP_BMP + PAGE_SIZE)
struct hwcmap {
#define CMAP_SIZE 256
diff --git a/sys/arch/luna88k/dev/omrasops.c b/sys/arch/luna88k/dev/omrasops.c
index 4d03a461a5b..5c7cb6f2b15 100644
--- a/sys/arch/luna88k/dev/omrasops.c
+++ b/sys/arch/luna88k/dev/omrasops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omrasops.c,v 1.13 2014/10/01 10:06:27 aoyama Exp $ */
+/* $OpenBSD: omrasops.c,v 1.14 2017/03/20 19:37:54 miod Exp $ */
/* $NetBSD: omrasops.c,v 1.1 2000/01/05 08:48:56 nisimura Exp $ */
/*-
@@ -49,6 +49,10 @@
#include <luna88k/dev/omrasops.h>
+#include <machine/board.h>
+#define OMFB_PLANEMASK BMAP_BMSEL /* planemask register */
+#define OMFB_ROPFUNC BMAP_FN /* ROP function code */
+
/* wscons emulator operations */
int om_copycols(void *, int, int, int, int);
int om_copyrows(void *, int, int, int num);
diff --git a/sys/arch/luna88k/dev/omrasops.h b/sys/arch/luna88k/dev/omrasops.h
index 4d6bd52dd77..064dbbc2d45 100644
--- a/sys/arch/luna88k/dev/omrasops.h
+++ b/sys/arch/luna88k/dev/omrasops.h
@@ -15,16 +15,6 @@
*/
/*
- * Base addresses of LUNA's frame buffer
- * XXX: We consider only 1bpp and 4bpp for now
- */
-
-#define OMFB_PLANEMASK 0xB1040000 /* BMSEL register */
-#define OMFB_FB_WADDR 0xB1080008 /* common plane */
-#define OMFB_FB_RADDR 0xB10C0008 /* plane #0 */
-#define OMFB_ROPFUNC 0xB12C0000 /* common ROP function */
-
-/*
* Helper macros
*/
#define W(addr) ((u_int32_t *)(addr))
diff --git a/sys/arch/luna88k/dev/omrasops1.c b/sys/arch/luna88k/dev/omrasops1.c
index 27dfbeccea4..c5135c92199 100644
--- a/sys/arch/luna88k/dev/omrasops1.c
+++ b/sys/arch/luna88k/dev/omrasops1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omrasops1.c,v 1.2 2014/01/02 15:30:34 aoyama Exp $ */
+/* $OpenBSD: omrasops1.c,v 1.3 2017/03/20 19:37:54 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
@@ -84,6 +84,9 @@
#include <luna88k/dev/maskbits.h>
#include <luna88k/dev/omrasops.h>
+#include <machine/board.h>
+#define OMFB_FB_WADDR (BMAP_BMP + 8) /* common plane */
+
/* prototypes */
int om1_windowmove(struct rasops_info *, u_int16_t, u_int16_t,
u_int16_t, u_int16_t, u_int16_t, u_int16_t, int16_t,
@@ -183,9 +186,9 @@ om1_windowmove(struct rasops_info *ri, u_int16_t sx, u_int16_t sy,
nl = nlMiddle;
while (nl--) {
if (rop == RR_CLEAR)
- W(pdst) = 0;
+ *W(pdst) = 0;
else
- W(pdst) = R(psrc);
+ *W(pdst) = *R(psrc);
psrc++;
pdst++;
}
@@ -193,7 +196,7 @@ om1_windowmove(struct rasops_info *ri, u_int16_t sx, u_int16_t sy,
nl = nlMiddle + 1;
while (--nl) {
if (rop == RR_CLEAR)
- W(pdst) = 0;
+ *W(pdst) = 0;
else
getunalignedword(R(psrc),
xoffSrc, *W(pdst));
@@ -234,7 +237,7 @@ om1_windowmove(struct rasops_info *ri, u_int16_t sx, u_int16_t sy,
--psrc;
--pdst;
if (rop == RR_CLEAR)
- W(pdst) = 0;
+ *W(pdst) = 0;
else
getunalignedword(R(psrc), xoffSrc,
*W(pdst));
diff --git a/sys/arch/luna88k/dev/siotty.c b/sys/arch/luna88k/dev/siotty.c
index ed964c2c110..9799db08da5 100644
--- a/sys/arch/luna88k/dev/siotty.c
+++ b/sys/arch/luna88k/dev/siotty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siotty.c,v 1.16 2014/06/07 11:55:35 aoyama Exp $ */
+/* $OpenBSD: siotty.c,v 1.17 2017/03/20 19:37:54 miod Exp $ */
/* $NetBSD: siotty.c,v 1.9 2002/03/17 19:40:43 atatat Exp $ */
/*-
@@ -41,6 +41,7 @@
#include <sys/fcntl.h>
#include <dev/cons.h>
+#include <machine/board.h>
#include <machine/cpu.h>
#include <luna88k/dev/sioreg.h>
@@ -539,7 +540,7 @@ syscnattach(int channel)
* boot/reset/poweron. ROM monitor emits one line message on CH.A.
*/
struct sioreg *sio;
- sio = (struct sioreg *)0x51000000 + channel;
+ sio = (struct sioreg *)OBIO_SIO + channel;
syscons.cn_dev = makedev(12, channel);
cn_tab = &syscons;
@@ -562,7 +563,7 @@ syscngetc(dev_t dev)
struct sioreg *sio;
int s, c;
- sio = (struct sioreg *)0x51000000 + ((int)dev & 0x1);
+ sio = (struct sioreg *)OBIO_SIO + ((int)dev & 0x1);
s = splhigh();
while ((getsiocsr(sio) & RR_RXRDY) == 0)
;
@@ -578,7 +579,7 @@ syscnputc(dev_t dev, int c)
struct sioreg *sio;
int s;
- sio = (struct sioreg *)0x51000000 + ((int)dev & 0x1);
+ sio = (struct sioreg *)OBIO_SIO + ((int)dev & 0x1);
s = splhigh();
while ((getsiocsr(sio) & RR_TXRDY) == 0)
;
diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S
index dc5dedc807d..152bc212d0b 100644
--- a/sys/arch/luna88k/luna88k/locore.S
+++ b/sys/arch/luna88k/luna88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.30 2015/02/25 17:41:22 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.31 2017/03/20 19:37:54 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -61,6 +61,7 @@
#include "ksyms.h"
#include <machine/asm.h>
+#include <machine/board.h>
#include <machine/m88100.h>
#include <machine/param.h>
#include <machine/psl.h>
@@ -216,13 +217,13 @@ ASLOCAL(main_init)
/* PIO stuff */
or %r10, %r0, 0xb6 /* initialize pio 0 */
- or.u %r11, %r0, %hi16(0x4900000c) /* 0x4900000c: PIO0 ctrl */
- st.b %r10, %r11, %lo16(0x4900000c)
+ or.u %r11, %r0, %hi16(OBIO_PIO0) /* PIO0 ctrl */
+ st.b %r10, %r11, %lo16(OBIO_PIO0)
/* read dispswitch setting */
- ld.bu %r10, %r11, %lo16(0x49000000) /* dipsw-1 (from portA) */
+ ld.bu %r10, %r11, %lo16(OBIO_PIO0A) /* dipsw-1 (from portA) */
mak %r10, %r10, 0<8> /* shift left 8 bit */
- ld.bu %r12, %r11, %lo16(0x49000004) /* dipsw-2 (from portB) */
+ ld.bu %r12, %r11, %lo16(OBIO_PIO0B) /* dipsw-2 (from portB) */
or %r10, %r10, %r12
or.u %r11, %r0, %hi16(_C_LABEL(dipswitch))
@@ -240,18 +241,18 @@ ASLOCAL(main_init)
st %r10, %r11, %lo16(_C_LABEL(hwplanebits))
or %r10, %r0, 0x84 /* initialize pio1 */
- or.u %r11, %r0, %hi16(0x4d00000c)
- st.b %r10, %r11, %lo16(0x4d00000c)
+ or.u %r11, %r0, %hi16(OBIO_PIO1)
+ st.b %r10, %r11, %lo16(OBIO_PIO1)
or %r10, %r0, 0x9 /* port c bit 1 on */
- st.b %r10, %r11, %lo16(0x4d00000c)
+ st.b %r10, %r11, %lo16(OBIO_PIO1)
- or.u %r10, %r0, %hi16(0xe1000010) /* clear scsi int */
- ld.b %r11, %r10, %lo16(0xe1000010)
- st.b %r11, %r10, %lo16(0xe1000010)
+ or.u %r10, %r0, %hi16(SCSI_ADDR + 4 * 0x04)/* clear scsi INTS */
+ ld.b %r11, %r10, %lo16(SCSI_ADDR + 4 * 0x04)
+ st.b %r11, %r10, %lo16(SCSI_ADDR + 4 * 0x04)
- /* write 0x41000000 to escape rom */
- or.u %r2, %r0, %hi16(0x41000000)
- st %r0, %r2, %lo16(0x41000000)
+ /* write to the PROM area to escape rom */
+ or.u %r2, %r0, %hi16(PROM_ADDR)
+ st %r0, %r2, %lo16(PROM_ADDR)
/*
* luna88k_bootstrap(), among other things, clears proc0's u area.