Module Name:    src
Committed By:   tsutsui
Date:           Sun Jun 30 05:04:49 UTC 2019

Modified Files:
        src/sys/arch/luna68k/dev: if_le.c lcd.c lunafb.c omrasopsvar.h xp.c
        src/sys/arch/luna68k/luna68k: locore.s machdep.c
        src/sys/arch/luna68k/stand/boot: autoconf.c bmd.c getsecs.c if_le.c
            sio.c
Added Files:
        src/sys/arch/luna68k/include: board.h

Log Message:
Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/dev/if_le.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/dev/lcd.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/luna68k/dev/omrasopsvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/dev/xp.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/board.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/luna68k/luna68k/machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/stand/boot/autoconf.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/bmd.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/getsecs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/if_le.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/sio.c

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/luna68k/dev/if_le.c
diff -u src/sys/arch/luna68k/dev/if_le.c:1.8 src/sys/arch/luna68k/dev/if_le.c:1.9
--- src/sys/arch/luna68k/dev/if_le.c:1.8	Sun Jun 30 02:11:56 2019
+++ src/sys/arch/luna68k/dev/if_le.c	Sun Jun 30 05:04:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le.c,v 1.8 2019/06/30 02:11:56 tsutsui Exp $ */
+/* $NetBSD: if_le.c,v 1.9 2019/06/30 05:04:48 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -73,7 +73,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.8 2019/06/30 02:11:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.9 2019/06/30 05:04:48 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -94,6 +94,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.
 
 #include <machine/cpu.h>
 #include <machine/autoconf.h>
+#include <machine/board.h>
 
 #include <luna68k/luna68k/isr.h>
 
@@ -104,6 +105,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.
 
 #include "ioconf.h"
 
+#define TRI_PORT_RAM_LANCE_OFFSET	0x10000 /* first 64KB is used by XP */
+#define TRI_PORT_RAM_LANCE_SIZE		0x10000	/* 64KB */
+
 /*
  * LANCE registers.
  */
@@ -178,10 +182,10 @@ le_attach(device_t parent, device_t self
 	/* Map control registers. */
 	lesc->sc_r1 = (struct lereg1 *)ma->ma_addr;	/* LANCE */
 
-	sc->sc_mem = (void *)0x71010000;		/* SRAM */
+	sc->sc_mem = (void *)(TRI_PORT_RAM + TRI_PORT_RAM_LANCE_OFFSET);
 	sc->sc_conf3 = LE_C3_BSWP;
 	sc->sc_addr = (u_long)sc->sc_mem & 0xffffff;
-	sc->sc_memsize = 64 * 1024;			/* 64KB */
+	sc->sc_memsize = TRI_PORT_RAM_LANCE_SIZE;
 
 	myetheraddr(sc->sc_enaddr);
 

Index: src/sys/arch/luna68k/dev/lcd.c
diff -u src/sys/arch/luna68k/dev/lcd.c:1.10 src/sys/arch/luna68k/dev/lcd.c:1.11
--- src/sys/arch/luna68k/dev/lcd.c:1.10	Sun Jun 30 02:11:56 2019
+++ src/sys/arch/luna68k/dev/lcd.c	Sun Jun 30 05:04:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: lcd.c,v 1.10 2019/06/30 02:11:56 tsutsui Exp $ */
+/* $NetBSD: lcd.c,v 1.11 2019/06/30 05:04:48 tsutsui Exp $ */
 /* $OpenBSD: lcd.c,v 1.7 2015/02/10 22:42:35 miod Exp $ */
 
 /*-
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>		/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.10 2019/06/30 02:11:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.11 2019/06/30 05:04:48 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.10
 #include <sys/errno.h>
 
 #include <machine/autoconf.h>
+#include <machine/board.h>
 #include <machine/cpu.h>
 #include <machine/lcd.h>
 
@@ -280,7 +281,7 @@ lcdioctl(dev_t dev, u_long cmd, void *ad
 void
 lcdbusywait(void)
 {
-	struct pio *p1 = (struct pio *)0x4D000000;
+	struct pio *p1 = (struct pio *)OBIO_PIO1_BASE;
 	int msb, s;
 
 	s = splhigh();
@@ -301,7 +302,7 @@ lcdbusywait(void)
 void
 lcdput(int cc)
 {
-	struct pio *p1 = (struct pio *)0x4D000000;
+	struct pio *p1 = (struct pio *)OBIO_PIO1_BASE;
 	int s;
 
 	lcdbusywait();
@@ -318,7 +319,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();

Index: src/sys/arch/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.38 src/sys/arch/luna68k/dev/lunafb.c:1.39
--- src/sys/arch/luna68k/dev/lunafb.c:1.38	Sun Jun 30 02:11:56 2019
+++ src/sys/arch/luna68k/dev/lunafb.c	Sun Jun 30 05:04:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.38 2019/06/30 02:11:56 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.39 2019/06/30 05:04:48 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.38 2019/06/30 02:11:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.39 2019/06/30 05:04:48 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,10 +74,10 @@ struct bt458 {
 	uint8_t          pad3[3];
 };
 
-#define	OMFB_RFCNT	0xB1000000	/* video h-origin/v-origin */
-#define	OMFB_RAMDAC	0xC1100000	/* Bt454/Bt458 RAMDAC */
+#define	OMFB_RFCNT	BMAP_RFCNT	/* video h-origin/v-origin */
+#define	OMFB_RAMDAC	BMAP_PALLET2	/* Bt454/Bt458 RAMDAC */
 
-#define	OMFB_SIZE	(0xB1300000 - 0xB1080000 + PAGE_SIZE)
+#define	OMFB_SIZE	(BMAP_FN0 - BMAP_BMP + PAGE_SIZE)
 
 struct hwcmap {
 #define CMAP_SIZE 256

Index: src/sys/arch/luna68k/dev/omrasopsvar.h
diff -u src/sys/arch/luna68k/dev/omrasopsvar.h:1.3 src/sys/arch/luna68k/dev/omrasopsvar.h:1.4
--- src/sys/arch/luna68k/dev/omrasopsvar.h:1.3	Sat Oct  4 16:58:17 2014
+++ src/sys/arch/luna68k/dev/omrasopsvar.h	Sun Jun 30 05:04:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasopsvar.h,v 1.3 2014/10/04 16:58:17 tsutsui Exp $ */
+/* $NetBSD: omrasopsvar.h,v 1.4 2019/06/30 05:04:48 tsutsui Exp $ */
 /*
  * Copyright (c) 2013 Kenji Aoyama
  *
@@ -20,10 +20,12 @@
  * 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 */
+#include <machine/board.h>
+
+#define OMFB_PLANEMASK	BMAP_BMSEL	/* BMSEL register */
+#define OMFB_FB_WADDR	(BMAP_BMP + 8)	/* common plane */
+#define OMFB_FB_RADDR	(BMAP_BMAP0 + 8)/* plane #0 */
+#define OMFB_ROPFUNC	BMAP_FN		/* common ROP function */
 
 /*
  * Helper macros

Index: src/sys/arch/luna68k/dev/xp.c
diff -u src/sys/arch/luna68k/dev/xp.c:1.4 src/sys/arch/luna68k/dev/xp.c:1.5
--- src/sys/arch/luna68k/dev/xp.c:1.4	Thu Jun  1 02:45:06 2017
+++ src/sys/arch/luna68k/dev/xp.c	Sun Jun 30 05:04:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: xp.c,v 1.4 2017/06/01 02:45:06 chs Exp $ */
+/* $NetBSD: xp.c,v 1.5 2019/06/30 05:04:48 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2016 Izumi Tsutsui.  All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xp.c,v 1.4 2017/06/01 02:45:06 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xp.c,v 1.5 2019/06/30 05:04:48 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -42,13 +42,16 @@ __KERNEL_RCSID(0, "$NetBSD: xp.c,v 1.4 2
 #include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
+#include <machine/board.h>
 #include <machine/xpio.h>
 
 #include "ioconf.h"
 
-#define XP_SHM_BASE	0x71000000
+#define TRI_PORT_RAM_XP_OFFSET	0x00000
+
+#define XP_SHM_BASE	(TRI_PORT_RAM + TRI_PORT_RAM_XP_OFFSET)
 #define XP_SHM_SIZE	0x00010000	/* 64KB for XP; rest 64KB for lance */
-#define XP_TAS_ADDR	0x61000000
+#define XP_TAS_ADDR	OBIO_TAS
 
 struct xp_softc {
 	device_t	sc_dev;
@@ -105,7 +108,7 @@ static bool xp_matched;
  *
  * XXX: PIO port functions should be shared with machdep.c for DIP SWs
  */
-#define PIO_ADDR	0x49000000
+#define PIO_ADDR	OBIO_PIO0_BASE
 #define PORT_A		0
 #define PORT_B		1
 #define PORT_C		2

Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.63 src/sys/arch/luna68k/luna68k/locore.s:1.64
--- src/sys/arch/luna68k/luna68k/locore.s:1.63	Wed Dec 19 13:57:47 2018
+++ src/sys/arch/luna68k/luna68k/locore.s	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.63 2018/12/19 13:57:47 maxv Exp $ */
+/* $NetBSD: locore.s,v 1.64 2019/06/30 05:04:49 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,6 +50,7 @@
 #include "assym.h"
 #include <machine/asm.h>
 #include <machine/trap.h>
+#include <machine/board.h>
 
 #include "ksyms.h"
 
@@ -116,13 +117,13 @@ ASENTRY_NOPROFILE(start)
 	RELOC(lowram,%a0)
 	movl	%a5,%a0@		| store start of physical memory
 
-	movl	#0x41000000,%a0		| available memory in bytes
+	movl	#PROM_ADDR,%a0		| available memory in bytes
 	movl	%a0@(12),%a0		| (int *)base[3])
 	movl	%a0@,%d5
 	RELOC(memavail,%a0)
 	movl	%d5,%a0@		| save memavail
 
-	movl	#0x41000000,%a0		| planemask; 0x0f or 0xff
+	movl	#PROM_ADDR,%a0		| planemask; 0x0f or 0xff
 	movl	%a0@(184),%a0		| (int *)base[46]
 	movl	%a0@,%d5
 	RELOC(hwplanemask,%a0)
@@ -157,7 +158,7 @@ Lstart0:
 	 * save argument of 'x' command on boot per machine type
 	 * XXX: assume CPU_68040 is LUNA-II
 	 */
-	movl	#0x41000000,%a0
+	movl	#PROM_ADDR,%a0
 	cmpl	#CPU_68040,%d0		| 68040?
 	jne	1f			| no, assume 68030 LUNA
 	movl	%a0@(8),%a0		| arg at (char *)base[2] on LUNA-II
@@ -644,9 +645,9 @@ ENTRY_NOPROFILE(intrhand_vectored)
 #if 1	/* XXX wild timer -- how can I disable/enable the interrupt? */
 ENTRY_NOPROFILE(lev5intr)
 	addql	#1,_C_LABEL(idepth)
-	btst	#7,0x63000000		| check whether system clock
+	btst	#7,OBIO_CLOCK		| check whether system clock
 	beq	1f
-	movb	#1,0x63000000		| clear the interrupt
+	movb	#1,OBIO_CLOCK		| clear the interrupt
 	tstl	_C_LABEL(clock_enable)	| is hardclock() available?
 	jeq	1f
 	INTERRUPT_SAVEREG
@@ -887,7 +888,7 @@ Lbootcommon:
 	movl	#0,%d3
 	movc	%d3,%vbr		| monitor %vbr
 
-	movl	#0x41000000,%a0		| base = (int **)0x4100.0000
+	movl	#PROM_ADDR,%a0		| base = (int **)0x4100.0000
 	movl	%a0@,%d0		| *((int *)base[0])
 	movc	%d0,%isp		| set initial stack pointer
 	movc	%d0,%msp		| set initial stack pointer

Index: src/sys/arch/luna68k/luna68k/machdep.c
diff -u src/sys/arch/luna68k/luna68k/machdep.c:1.102 src/sys/arch/luna68k/luna68k/machdep.c:1.103
--- src/sys/arch/luna68k/luna68k/machdep.c:1.102	Mon Sep  3 16:29:25 2018
+++ src/sys/arch/luna68k/luna68k/machdep.c	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.102 2018/09/03 16:29:25 riastradh Exp $ */
+/* $NetBSD: machdep.c,v 1.103 2019/06/30 05:04:49 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102 2018/09/03 16:29:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.103 2019/06/30 05:04:49 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include <sys/sysctl.h>
 
 #include <machine/bootinfo.h>
+#include <machine/board.h>
 #include <machine/cpu.h>
 #include <machine/reg.h>
 #include <machine/pcb.h>
@@ -156,7 +157,7 @@ int	delay_divisor = 30;	/* for delay() l
 void
 luna68k_init(void)
 {
-	volatile uint8_t *pio0 = (void *)0x49000000;
+	volatile uint8_t *pio0 = (void *)OBIO_PIO0_BASE;
 	int sw1, i;
 	char *cp;
 	extern char bootarg[64];
@@ -460,7 +461,7 @@ haltsys:
 
 	/* Finally, halt/reboot the system. */
 	if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
-		volatile uint8_t *pio = (void *)0x4d000000;
+		volatile uint8_t *pio = (void *)OBIO_PIO1_BASE;
 
 		printf("power is going down.\n");
 		DELAY(100000);
@@ -856,7 +857,7 @@ struct consdev romcons = {
 	CN_DEAD,
 };
 
-#define __		((int **)0x41000000)
+#define __		((int **)PROM_ADDR)
 #define GETC()		(*(int (*)())__[6])()
 #define PUTC(x)		(*(void (*)())__[7])(x)
 

Index: src/sys/arch/luna68k/stand/boot/autoconf.c
diff -u src/sys/arch/luna68k/stand/boot/autoconf.c:1.10 src/sys/arch/luna68k/stand/boot/autoconf.c:1.11
--- src/sys/arch/luna68k/stand/boot/autoconf.c:1.10	Fri Jan 10 11:12:03 2014
+++ src/sys/arch/luna68k/stand/boot/autoconf.c	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.10 2014/01/10 11:12:03 tsutsui Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.11 2019/06/30 05:04:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2013 Izumi Tsutsui.  All rights reserved.
@@ -24,6 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <machine/board.h>
 #include <machine/cpu.h>
 #include <luna68k/stand/boot/samachdep.h>
 
@@ -32,11 +33,11 @@ find_devs(void)
 {
 
 	/* find and init devices */
-	scinit(0, (uint8_t *)0xe1000000);
+	scinit(0, (uint8_t *)SCSI_ADDR);
 	if (machtype == LUNA_II) {
-		scinit(1, (uint8_t *)0xe1000040);
+		scinit(1, (uint8_t *)SCSI_2_ADDR);
 	}
-	if (!badaddr((void *)0xf1000000)) {
-		leinit(0, (uint8_t *)0xf1000000);
+	if (!badaddr((void *)LANCE_ADDR)) {
+		leinit(0, (uint8_t *)LANCE_ADDR);
 	}
 }

Index: src/sys/arch/luna68k/stand/boot/bmd.c
diff -u src/sys/arch/luna68k/stand/boot/bmd.c:1.7 src/sys/arch/luna68k/stand/boot/bmd.c:1.8
--- src/sys/arch/luna68k/stand/boot/bmd.c:1.7	Sat Feb 14 06:31:31 2015
+++ src/sys/arch/luna68k/stand/boot/bmd.c	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bmd.c,v 1.7 2015/02/14 06:31:31 tsutsui Exp $	*/
+/*	$NetBSD: bmd.c,v 1.8 2019/06/30 05:04:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -79,6 +79,7 @@
 
 #include <sys/param.h>
 #include <luna68k/stand/boot/samachdep.h>
+#include <machine/board.h>
 
 /*
  *  RFCNT register
@@ -98,6 +99,8 @@ union bmd_rfcnt {
  *  Width & Height
  */
 
+#define BMAP_OFFSET	8
+
 #define PB_WIDTH	2048			/* Plane Width   (Bit) */
 #define PB_HEIGHT	1024			/* Plane Hight   (Bit) */
 #define PL_WIDTH	64			/* Plane Width  (long) */
@@ -282,8 +285,8 @@ bmd_escape_1(int c)
 void
 bmdinit(void)
 {
-	volatile uint32_t *bmd_rfcnt = (uint32_t *)0xB1000000;
-	volatile uint32_t *bmd_bmsel = (uint32_t *)0xB1040000;
+	volatile uint32_t *bmd_rfcnt = (uint32_t *)BMAP_RFCNT;
+	volatile uint32_t *bmd_bmsel = (uint32_t *)BMAP_BMSEL;
 	struct bmd_softc *bp = &bmd_softc;
 	struct bmd_linec *bq;
 	int i;
@@ -294,9 +297,9 @@ bmdinit(void)
 	 */
 
 	/* plane-0 hardware address */
-	bp->bc_raddr = (uint8_t *)0xB10C0008;
+	bp->bc_raddr = (uint8_t *)(BMAP_BMAP0 + BMAP_OFFSET);
 	/* common bitmap hardware address */
-	bp->bc_waddr = (uint8_t *)0xB1080008;
+	bp->bc_waddr = (uint8_t *)(BMAP_BMP   + BMAP_OFFSET);
 
 	rfcnt.p.rfc_hcnt = 7;			/* shift left   16 dot */
 	rfcnt.p.rfc_vcnt = -27;			/* shift down    1 dot */
@@ -339,7 +342,7 @@ bmdinit(void)
 void
 bmdadjust(int16_t hcnt, int16_t vcnt)
 {
-	volatile uint32_t *bmd_rfcnt = (uint32_t *)0xB1000000;
+	volatile uint32_t *bmd_rfcnt = (uint32_t *)BMAP_RFCNT;
 	union bmd_rfcnt rfcnt;
 
 	printf("bmdadjust: hcnt = %d, vcnt = %d\n", hcnt, vcnt);

Index: src/sys/arch/luna68k/stand/boot/getsecs.c
diff -u src/sys/arch/luna68k/stand/boot/getsecs.c:1.2 src/sys/arch/luna68k/stand/boot/getsecs.c:1.3
--- src/sys/arch/luna68k/stand/boot/getsecs.c:1.2	Fri Nov 21 01:16:04 2014
+++ src/sys/arch/luna68k/stand/boot/getsecs.c	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: getsecs.c,v 1.2 2014/11/21 01:16:04 christos Exp $	*/
+/*	$NetBSD: getsecs.c,v 1.3 2019/06/30 05:04:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,6 +30,7 @@
  */
 
 #include <machine/cpu.h>
+#include <machine/board.h>
 
 #include <lib/libkern/libkern.h>
 #include <lib/libsa/stand.h>
@@ -46,7 +47,7 @@ getsecs(void)
 	volatile uint8_t *mclock;
 	u_int t;
 
-	mclock = (volatile uint8_t *)0x45000000;
+	mclock = (volatile uint8_t *)OBIO_CLOCK_BASE;
 
 	if (machtype == LUNA_I) {
 		mclock += 2040;

Index: src/sys/arch/luna68k/stand/boot/if_le.c
diff -u src/sys/arch/luna68k/stand/boot/if_le.c:1.6 src/sys/arch/luna68k/stand/boot/if_le.c:1.7
--- src/sys/arch/luna68k/stand/boot/if_le.c:1.6	Sat Jan 11 15:51:02 2014
+++ src/sys/arch/luna68k/stand/boot/if_le.c	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le.c,v 1.6 2014/01/11 15:51:02 tsutsui Exp $ */
+/* $NetBSD: if_le.c,v 1.7 2019/06/30 05:04:49 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2013 Izumi Tsutsui.  All rights reserved.
@@ -60,6 +60,7 @@
 
 #include <sys/param.h>
 
+#include <machine/board.h>
 #include <machine/cpu.h>
 
 #include <net/if.h>
@@ -73,6 +74,8 @@
 
 #include <luna68k/stand/boot/samachdep.h>
 
+#define TRI_PORT_RAM_LANCE_OFFSET	0x10000
+
 /* libsa netif_driver glue functions */
 static int  le_match(struct netif *, void *);
 static int  le_probe(struct netif *, void *);
@@ -113,7 +116,7 @@ leinit(int unit, void *addr)
 	uint8_t eaddr[6];
 
 	reg = addr;
-	mem = (void *)0x71010000;	/* XXX */
+	mem = (void *)(TRI_PORT_RAM + TRI_PORT_RAM_LANCE_OFFSET);
 
 	myetheraddr(eaddr);
 

Index: src/sys/arch/luna68k/stand/boot/sio.c
diff -u src/sys/arch/luna68k/stand/boot/sio.c:1.4 src/sys/arch/luna68k/stand/boot/sio.c:1.5
--- src/sys/arch/luna68k/stand/boot/sio.c:1.4	Fri Jan  3 02:03:12 2014
+++ src/sys/arch/luna68k/stand/boot/sio.c	Sun Jun 30 05:04:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sio.c,v 1.4 2014/01/03 02:03:12 tsutsui Exp $	*/
+/*	$NetBSD: sio.c,v 1.5 2019/06/30 05:04:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -75,6 +75,7 @@
 #define NSIO 2
 
 #include <sys/param.h>
+#include <machine/board.h>
 #include <luna68k/stand/boot/samachdep.h>
 #include <luna68k/stand/boot/sioreg.h>
 #include <luna68k/stand/boot/rcvbuf.h>
@@ -135,8 +136,8 @@ siointr(int unit)
 void
 siocnprobe(struct consdev *cp)
 {
-	sio_addr[0] = (struct siodevice *)0x51000000;
-	sio_addr[1] = (struct siodevice *)0x51000004;
+	sio_addr[0] = (struct siodevice *)(OBIO_SIO + 0);
+	sio_addr[1] = (struct siodevice *)(OBIO_SIO + 4);
 
 	/* make sure hardware exists */
 	if (badaddr((short *)sio_addr[0])) {

Added files:

Index: src/sys/arch/luna68k/include/board.h
diff -u /dev/null src/sys/arch/luna68k/include/board.h:1.1
--- /dev/null	Sun Jun 30 05:04:49 2019
+++ src/sys/arch/luna68k/include/board.h	Sun Jun 30 05:04:48 2019
@@ -0,0 +1,117 @@
+/*	$NetBSD: board.h,v 1.1 2019/06/30 05:04:48 tsutsui Exp $	*/
+/*	$OpenBSD: board.h,v 1.15 2017/11/03 06:55:08 aoyama Exp $	*/
+/*
+ * Mach Operating System
+ * Copyright (c) 1993-1991 Carnegie Mellon University
+ * Copyright (c) 1991 OMRON Corporation
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  software.distribut...@cs.cmu.edu
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _MACHINE_BOARD_H_
+#define _MACHINE_BOARD_H_
+
+/*
+ *      OMRON SX9100DT CPU board constants
+ */
+
+/*
+ * Something to put append a 'U' to a long constant if it's C so that
+ * it'll be unsigned in both ANSI and traditional.
+ */
+#if defined(_LOCORE)
+#define U(num)  num
+#elif defined(__STDC__)
+#define U(num)  num ## U
+#else
+#define U(num)  num/**/U
+#endif
+
+#define PROM_ADDR	U(0x41000000) 	/* PROM */
+#define PROM_SPACE	U(0x00040000) 
+#define NVRAM_ADDR	U(0x45000000) 	/* Non Volatile */
+#define NVRAM_SPACE	U(0x00001FDC) 
+#define	FUSE_ROM_ADDR	U(0x43000000) 	/* FUSE_ROM */
+#define	FUSE_ROM_SPACE	        1024
+#define	OBIO_CLOCK_BASE	U(0x45000000) 	/* Mostek or Dallas TimeKeeper */
+#define OBIO_PIO0_BASE	U(0x49000000) 	/* PIO-0 */
+#define OBIO_PIO0_SPACE	U(0x00000004) 
+#define OBIO_PIO0A	U(0x49000000) 	/* PIO-0 port A */
+#define OBIO_PIO0B	U(0x49000001) 	/* PIO-0 port B */
+#define OBIO_PIO0C	U(0x49000002) 	/* PIO-0 port C*/
+#define OBIO_PIO0	U(0x49000003) 	/* PIO-0 control */
+#define OBIO_PIO1_BASE	U(0x4D000000) 	/* PIO-1 */
+#define OBIO_PIO1_SPACE U(0x00000004) 
+#define OBIO_PIO1A	U(0x4D000000) 	/* PIO-1 port A */
+#define OBIO_PIO1B	U(0x4D000001) 	/* PIO-1 port B */
+#define OBIO_PIO1C	U(0x4D000002) 	/* PIO-1 port C*/
+#define OBIO_PIO1	U(0x4D000003) 	/* PIO-1 control */
+#define OBIO_SIO	U(0x51000000) 	/* SIO */
+#define	OBIO_TAS	U(0x61000000) 	/* TAS register */
+#define	OBIO_CLOCK	U(0x63000000) 	/* system clock */
+
+#define TRI_PORT_RAM	U(0x71000000) 	/* 3 port RAM */
+#define TRI_PORT_RAM_SPACE	0x20000
+#define EXT_A_ADDR	U(0x81000000) 	/* extension board A */
+#define EXT_A_SPACE	U(0x02000000) 
+#define EXT_B_ADDR	U(0x83000000) 	/* extension board B */
+#define EXT_B_SPACE	U(0x01000000) 
+#define	PC_BASE		U(0x90000000) 	/* pc-98 extension board */
+#define	PC_SPACE	U(0x02000000) 
+
+#define MROM_ADDR	U(0xA1000000) 	/* Mask ROM address */
+#define MROM_SPACE		0x400000
+#define	BMAP_START	U(0xB1000000) 	/* Bitmap start address */
+#define	BMAP_SPACE	(BMAP_END - BMAP_START)
+#define BMAP_RFCNT	U(0xB1000000) 	/* RFCNT register */
+#define BMAP_BMSEL	U(0xB1040000) 	/* BMSEL register */
+#define BMAP_BMP	U(0xB1080000) 	/* common bitmap plane */
+#define BMAP_BMAP0	U(0xB10C0000) 	/* bitmap plane 0 */
+#define BMAP_BMAP1	U(0xB1100000) 	/* bitmap plane 1 */
+#define BMAP_BMAP2	U(0xB1140000) 	/* bitmap plane 2 */
+#define BMAP_BMAP3	U(0xB1180000) 	/* bitmap plane 3 */
+#define BMAP_BMAP4	U(0xB11C0000) 	/* bitmap plane 4 */
+#define BMAP_BMAP5	U(0xB1200000) 	/* bitmap plane 5 */
+#define BMAP_BMAP6	U(0xB1240000) 	/* bitmap plane 6 */
+#define BMAP_BMAP7	U(0xB1280000) 	/* bitmap plane 7 */
+#define BMAP_FN		U(0xB12C0000) 	/* common bitmap function */
+#define BMAP_FN0	U(0xB1300000) 	/* bitmap function 0 */
+#define BMAP_FN1	U(0xB1340000) 	/* bitmap function 1 */
+#define BMAP_FN2	U(0xB1380000) 	/* bitmap function 2 */
+#define BMAP_FN3	U(0xB13C0000) 	/* bitmap function 3 */
+#define BMAP_FN4	U(0xB1400000) 	/* bitmap function 4 */
+#define BMAP_FN5	U(0xB1440000) 	/* bitmap function 5 */
+#define BMAP_FN6	U(0xB1480000) 	/* bitmap function 6 */
+#define BMAP_FN7	U(0xB14C0000) 	/* bitmap function 7 */
+#define BMAP_END	U(0xB1500000) 
+#define BMAP_END24P	U(0xB1800000)	/* end of 24p framemem */
+#define BMAP_PALLET0	U(0xC0000000) 	/* color pallet */
+#define BMAP_PALLET1	U(0xC1000000) 	/* color pallet */
+#define BMAP_PALLET2	U(0xC1100000) 	/* color pallet */
+#define BOARD_CHECK_REG	U(0xD0000000) 	/* board check register */
+#define BMAP_CRTC	U(0xD1000000) 	/* CRTC-II */
+#define BMAP_IDENTROM	U(0xD1800000)	/* bitmap-board identify ROM */
+#define SCSI_ADDR	U(0xE1000000) 	/* SCSI address */
+#define SCSI_2_ADDR	U(0xE1000040) 	/* 2nd SCSI address */
+#define LANCE_ADDR	U(0xF1000000) 	/* LANCE */
+
+#endif /* _MACHINE_BOARD_H_ */

Reply via email to