Subject: current diffs
To: None <port-arc@netbsd.org, port-mips@netbsd.org>
From: Mark Abene <phiber@radicalmedia.com>
List: port-mips
Date: 02/07/2001 18:45:38
--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii

As promised, here are my current working diffs against the 1.5R kernel.
I'm hoping someone can help me figure out why init forks, then nothing
happens.  It just spins round and round...

Cheers,
-Mark


--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=arc_diffs

--- sys/arch/arc/arc/arc_trap.c.orig	Sat Feb  3 00:39:27 2001
+++ sys/arch/arc/arc/arc_trap.c	Sun Feb  4 05:47:04 2001
@@ -128,8 +128,13 @@
 	switch(cputype) {
 	case ACER_PICA_61:
 	case MAGNUM:
+#if defined(MIPS_MAGNUM)
+		out32(R4030_SYS_EXT_IMASK,
+		    cpu_int_mask & (~MIPS_INT_MASK_5 >> 10));
+#else
 		out32(R4030_SYS_EXT_IMASK,
 		    cpu_int_mask & (~MIPS_INT_MASK_4 >> 10));
+#endif
 		break;
 	case NEC_R94:
 	case NEC_RAx94:
@@ -159,7 +164,7 @@
 	u_int32_t pc;
 	u_int32_t ipending;		/* pending interrupts & enable mask */
 {
-#if defined(MIPS3) && defined(MIPS_INT_MASK_CLOCK)
+#if defined(MIPS3) && defined(MIPS_INT_MASK_CLOCK) && !defined(MIPS_MAGNUM)
 	if ((ipending & MIPS_INT_MASK_CLOCK) && CPUISMIPS3) {
 		/*
 		 *  Writing a value to the Compare register,
--- sys/arch/arc/arc/clock_mc.c.orig	Fri Feb  2 19:24:48 2001
+++ sys/arch/arc/arc/clock_mc.c	Wed Feb  7 04:09:22 2001
@@ -174,7 +174,12 @@
 	struct clock_softc *csc;
 {
 /* XXX Does not really belong here but for the moment we don't care */
+#if defined(MIPS_MAGNUM)
+	mips3_cp0_count_write(0); /* clear counter */
+	mips3_cp0_compare_write(225000); /* 10ms - 1 */
+#else
 	out32(R4030_SYS_IT_VALUE, 9); /* 10ms - 1 */
+#endif
 	/* Enable periodic clock interrupt */
 	out32(R4030_SYS_EXT_IMASK, cpu_int_mask);
 }
--- sys/arch/arc/arc/machdep.c.orig	Fri Feb  2 18:43:57 2001
+++ sys/arch/arc/arc/machdep.c	Tue Feb  6 12:50:04 2001
@@ -640,7 +640,7 @@
 	/*
 	 * Initialize machine-dependent DDB commands, in case of early panic.
 	 */
-	db_machine_init();
+	/* db_machine_init(); */
 #if 0 /* XXX */
 	/* init symbols if present */
 	if (esym)
@@ -742,6 +742,11 @@
 machine_ConfigCache()
 {
 	switch (cputype) {
+	case MAGNUM:
+		mips_L2CachePresent = 1;
+		mips_L2CacheSize = 1024 * 1024;
+		vm_page_zero_enable = FALSE;
+		break;
 	case ACER_PICA_61:
 #if 0	/* doesn't work */
 		mips_L2CachePresent = 1;
--- sys/arch/arc/jazz/asc.c.orig	Fri Feb  2 18:48:23 2001
+++ sys/arch/arc/jazz/asc.c	Sat Feb  3 16:19:12 2001
@@ -588,7 +588,8 @@
 	wbflush(); DELAY(25);
 	regs->asc_cmd = ASC_CMD_DMA | ASC_CMD_NOP;
 	wbflush(); DELAY(25);
-	asc->is24bit = regs->asc_id == ASC_ID_53CF94;
+	asc->is24bit = (regs->asc_id == ASC_ID_53CF94 ||
+			regs->asc_id == ASC_ID_FAS216);
 
 	asc_reset(asc, regs);
 
@@ -2067,9 +2068,9 @@
 	asc_softc_t asc;
 	int status, ss, ir;
 {
+#ifdef DIAGNOSTIC
 	State *state = &asc->st[asc->target];
 
-#ifdef DIAGNOSTIC
 	if (!(state->flags & DISCONN)) {
 		printf("asc_disconnect: device %d: DISCONN not set!\n",
 			asc->target);
--- sys/arch/arc/jazz/ascreg.h.orig	Fri Feb  2 18:47:52 2001
+++ sys/arch/arc/jazz/ascreg.h	Fri Feb  2 18:48:18 2001
@@ -334,5 +334,6 @@
  * chip identifier
  */
 #define ASC_ID_53CF94		0xa2	/* 53CF94-2 or 53CF96-2 */
+#define ASC_ID_FAS216		0x12
 
 #define	ST_MASK	0x3e
--- sys/arch/arc/jazz/jazzio.c.orig	Fri Feb  2 19:23:16 2001
+++ sys/arch/arc/jazz/jazzio.c	Wed Feb  7 04:10:08 2001
@@ -307,7 +307,11 @@
 		switch (cputype) {
 		case ACER_PICA_61:
 		case MAGNUM:
+#if defined(MIPS_MAGNUM)
+			set_intr(MIPS_INT_MASK_5, pica_clkintr, 1);
+#else	
 			set_intr(MIPS_INT_MASK_4, pica_clkintr, 1);
+#endif
 			break;
 		case NEC_R94:
 		case NEC_RAx94:
@@ -390,15 +394,28 @@
 	unsigned mask;
 	struct clockframe *cf;
 {
-	int temp;
+	u_int32_t temp;
 
+#if defined(MIPS_MAGNUM)
+	temp = mips3_cp0_count_read();
+	temp += 225000;
+	mips3_cp0_compare_write(temp);
+#else
 	temp = inw(R4030_SYS_IT_STAT);
+#endif
 	(*pica_clock_handler)(cf);
 
+#if defined(MIPS_MAGNUM)
+	/* Re-enable clock interrupts */
+	splx(MIPS_INT_MASK_5 | MIPS_SR_INT_IE);
+
+	return(~MIPS_INT_MASK_5); /* Keep clock interrupts enabled */
+#else
 	/* Re-enable clock interrupts */
 	splx(MIPS_INT_MASK_4 | MIPS_SR_INT_IE);
 
 	return(~MIPS_INT_MASK_4); /* Keep clock interrupts enabled */
+#endif
 }
 
 /*
--- sys/arch/mips/include/cpuregs.h.orig	Tue Feb  6 12:44:32 2001
+++ sys/arch/mips/include/cpuregs.h	Tue Feb  6 12:49:18 2001
@@ -234,7 +234,11 @@
  * The interrupt masks.
  * If a bit in the mask is 1 then the interrupt is enabled (or pending).
  */
+#if defined(MIPS_MAGNUM)
+#define MIPS_INT_MASK		(0xff00 & ~0x4000)
+#else
 #define MIPS_INT_MASK		0xff00
+#endif
 #define MIPS_INT_MASK_5		0x8000
 #define MIPS_INT_MASK_4		0x4000
 #define MIPS_INT_MASK_3		0x2000
--- sys/arch/mips/mips/locore_mips3.S.orig	Fri Feb  2 19:13:44 2001
+++ sys/arch/mips/mips/locore_mips3.S	Sun Feb  4 07:27:27 2001
@@ -1540,10 +1540,21 @@
 	addu	t1, t0, t2
 	subu	t1, t1, 128
 1:
+#if defined(MIPS_MAGNUM)
 	cache	C_IWBINV_SD, 0(t0)
+	cache	C_IWBINV_SD, 16(t0)
 	cache	C_IWBINV_SD, 32(t0)
+	cache	C_IWBINV_SD, 48(t0)
 	cache	C_IWBINV_SD, 64(t0)
+	cache	C_IWBINV_SD, 80(t0)
 	cache	C_IWBINV_SD, 96(t0)
+	cache	C_IWBINV_SD, 112(t0)
+#else
+	cache	C_IWBINV_SD, 0(t0)
+	cache	C_IWBINV_SD, 32(t0)
+	cache	C_IWBINV_SD, 64(t0)
+	cache	C_IWBINV_SD, 96(t0)
+#endif
 	bne	t0, t1, 1b
 	addu	t0, t0, 128
 2:
@@ -1648,10 +1659,21 @@
 	li	a0, MIPS_KSEG0_START
 	addu	a0, a0, t0	# reduce to kseg0 address
 1:
+#if defined(MIPS_MAGNUM)
 	cache	C_IWBINV_SD, 0(a0)
+	cache	C_IWBINV_SD, 16(a0)
 	cache	C_IWBINV_SD, 32(a0)
+	cache	C_IWBINV_SD, 48(a0)
 	cache	C_IWBINV_SD, 64(a0)
+	cache	C_IWBINV_SD, 80(a0)
 	cache	C_IWBINV_SD, 96(a0)
+	cache	C_IWBINV_SD, 112(a0)
+#else
+	cache	C_IWBINV_SD, 0(a0)
+	cache	C_IWBINV_SD, 32(a0)
+	cache	C_IWBINV_SD, 64(a0)
+	cache	C_IWBINV_SD, 96(a0)
+#endif
 	addu	t1, -1
 	bne	t1, zero, 1b
 	addu	a0, 128
@@ -1699,10 +1721,21 @@
 	cache	C_HWBINV_D, 96(a0)
 	cache	C_HWBINV_D, 112(a0)
 #if 1
+#if defined(MIPS_MAGNUM)
 	cache	C_HWBINV_SD, 0(a0)
+	cache	C_HWBINV_SD, 16(a0)
 	cache	C_HWBINV_SD, 32(a0)
+	cache	C_HWBINV_SD, 48(a0)
 	cache	C_HWBINV_SD, 64(a0)
+	cache	C_HWBINV_SD, 80(a0)
 	cache	C_HWBINV_SD, 96(a0)
+	cache	C_HWBINV_SD, 112(a0)
+#else
+	cache	C_HWBINV_SD, 0(a0)
+	cache	C_HWBINV_SD, 32(a0)
+	cache	C_HWBINV_SD, 64(a0)
+	cache	C_HWBINV_SD, 96(a0)
+#endif
 #endif
 	addu	a1, -1
 	bne	a1, zero, 1b
@@ -1808,10 +1841,21 @@
         addu    t1, t0, t2
         subu    t1, t1, 128
 1:
+#if defined(MIPS_MAGNUM)
         cache   C_IWBINV_SD, 0(t0)
+        cache   C_IWBINV_SD, 16(t0)
         cache   C_IWBINV_SD, 32(t0)
+        cache   C_IWBINV_SD, 48(t0)
         cache   C_IWBINV_SD, 64(t0)
+        cache   C_IWBINV_SD, 80(t0)
         cache   C_IWBINV_SD, 96(t0)
+        cache   C_IWBINV_SD, 112(t0)
+#else
+        cache   C_IWBINV_SD, 0(t0)
+        cache   C_IWBINV_SD, 32(t0)
+        cache   C_IWBINV_SD, 64(t0)
+        cache   C_IWBINV_SD, 96(t0)
+#endif
         bne     t0, t1, 1b
         addu    t0, t0, 128
 2:      
--- sys/arch/mips/mips/mips_machdep.c.orig	Fri Feb  2 18:51:03 2001
+++ sys/arch/mips/mips/mips_machdep.c	Fri Feb  2 19:00:33 2001
@@ -679,7 +679,7 @@
 		printf("Please fix implementation of mips3_*Flush*Cache\n");
 		cpu_reboot(RB_HALT, NULL);
 	}
-	if (mips_L2CachePresent && mips_L2CacheLSize < 32) {
+	if (mips_L2CachePresent && mips_L2CacheLSize < 16) {
 		/*
 		 * current implementation of mips3_FlushCache(),
 		 * mips3_FlushDCache() and mips3_HitFlushDCache() assume
--- /dev/null	Wed Feb  7 16:53:13 2001
+++ sys/arch/arc/conf/MAGNUM	Wed Feb  7 01:22:08 2001
@@ -0,0 +1,209 @@
+#
+#	configuration file for MIPS Magnum 4000 system
+#
+
+include		"arch/arc/conf/std.arc"
+
+maxusers	4		# estimated number of users
+
+makeoptions	COPTS="-Os"
+
+options		COMCONSOLE
+options		MIPS_MAGNUM
+options		MIPS3_ENABLE_CLOCK_INTR
+
+# Standard system options
+
+options 	RTC_OFFSET=-300	# hardware clock is this many mins. (Japan)
+options 	NTP		# NTP phase/frequency locked loop
+
+#options 	KTRACE		# system call tracing via ktrace(1)
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+#options 	SHMMAXPGS=1024	# 1024 pages is the default
+
+#options 	LKM		# loadable kernel modules
+
+# Diagnostic/debugging support options
+options 	DIAGNOSTIC	# cheap kernel consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+#options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
+options 	DDB		# in-kernel debugger
+#options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
+#options 	KGDB		# remote gdb
+#options 	KGDBRATE=19200	# kernel gdb port rate (default 9600)
+#options 	KGDBDEV="17*256+0"	# device for kernel gdb
+#makeoptions	DEBUG="-g"	# compile full symbol table
+
+# Compatibility options
+#options 	COMPAT_10	# NetBSD 1.0,
+#options 	COMPAT_11	# NetBSD 1.1,
+#options 	COMPAT_12	# NetBSD 1.2,
+options 	COMPAT_13	# NetBSD 1.3,
+options 	COMPAT_14	# NetBSD 1.4,
+options 	COMPAT_43	# and 4.3BSD
+options 	COMPAT_386BSD_MBRPART # recognize old partition ID
+
+# mipsel specific
+#options 	COMPAT_ULTRIX	# Ultrix binary compatibility
+#options 	EXEC_ECOFF	# Ultrix RISC binaries are ECOFF format
+
+# File systems
+file-system 	FFS		# fast filesystem
+#file-system 	EXT2FS		# second extended file system (linux)
+#file-system 	LFS		# log-structured file system
+#file-system 	MFS		# memory file system
+#file-system 	NTFS		# Windows/NT file system (experimental)
+#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
+file-system 	NFS		# Network File System client
+file-system 	FDESC		# /dev/fd
+file-system 	KERNFS		# /kern
+#file-system 	NULLFS		# loopback file system
+#file-system 	OVERLAY		# overlay file system
+#file-system 	PORTAL		# portal filesystem (still experimental)
+file-system 	PROCFS		# /proc
+#file-system 	UMAPFS		# NULLFS + uid and gid remapping
+#file-system 	UNION		# union file system
+#file-system	CODA		# Coda File System; also needs vcoda (below)
+
+# File system options
+#options 	QUOTA		# FFS quotas
+#options 	FFS_EI		# FFS Endian Independent support
+#options 	SOFTDEP		# FFS soft updates support.
+#options 	NFSSERVER	# Network File System server
+#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+				# immutable) behave as system flags.
+
+# Networking options
+#options 	GATEWAY		# IP packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+#options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	NS		# XNS
+#options 	NSIP		# XNS tunneling over IP
+#options 	ISO,TPIP	# OSI networking
+#options 	EON		# OSI tunneling over IP
+#options 	CCITT,LLC,HDLC	# X.25
+#options 	NETATALK	# AppleTalk networking protocols
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	PFIL_HOOKS	# pfil(9) packet filter hooks
+#options 	IPFILTER_LOG	# ipmon(8) log support
+
+# Compatibility with 4.2BSD implementation of TCP/IP.  Not recommended.
+#options 	TCP_COMPAT_42
+
+# These options enable verbose messages for several subsystems.
+# Warning, these may compile large string tables into the kernel!
+#options 	EISAVERBOSE	# verbose EISA device autoconfig messages
+#options 	PCIVERBOSE	# verbose PCI device autoconfig messages
+#options 	PCI_CONFIG_DUMP	# verbosely dump PCI config space
+#options 	SCSIVERBOSE	# human readable SCSI error messages
+
+# wscons terminal emulation
+#options 	WSEMUL_VT100	# VT100 emulation
+
+# Kernel root file system and dump configuration.
+options 	NFS_BOOT_BOOTPARAM
+config		netbsd	root on ? type nfs
+
+#
+# Device configuration
+#
+
+mainbus0	at root
+cpu*		at mainbus0
+
+#### Jazz-Internal bus devices
+
+jazzio*		at mainbus0	# Jazz-Internal bus.
+aclock0 	at jazzio?
+#pc0		at jazzio?
+#opms0		at jazzio?
+#vga0		at jazzio?	# Jazz localbus VGA
+#pckbc0		at jazzio?	# PC keyboard controller
+options		COM_FREQ_MAGNUM=8000000	# 8 MHz - Magnum PC/SC
+com0		at jazzio?
+com1		at jazzio?
+#lpt0		at jazzio?
+sn0		at jazzio?
+
+fdc0		at jazzio?
+fd*		at fdc? drive ?
+
+asc0		at jazzio?
+scsibus* 	at asc?
+
+#siop0		at jazzio?
+#scsibus* 	at siop?
+
+#### ISA bus devices
+
+#isabr*		at mainbus0	# ISA Bus bridge (std ISA bus).
+#isa*		at isabr?
+
+#com2		at isa? port 0x3f8 irq 4
+#com3		at isa? port 0x2f8 irq 3
+
+#### SCSI bus devices
+
+sd*		at scsibus? target ? lun ?
+#st*		at scsibus? target ? lun ?
+#cd*		at scsibus? target ? lun ?
+#ch*		at scsibus? target ? lun ?
+#ss*		at scsibus? target ? lun ?
+#uk*		at scsibus? target ? lun ?
+
+#### Workstation Console attachments
+
+#wsdisplay*	at vga?
+#wsdisplay*	at tga?
+#pckbd*		at pckbc?	# PC keyboard (kbd port)
+#wskbd*		at pckbd?
+#pms*		at pckbc?	# PS/2-style mouse (aux port)
+#wsmouse*	at pms?
+#pmsi*		at pckbc?	# PS/2 "Intelli"mouse (aux port)
+#wsmouse*	at pmsi?
+
+#### Pseudo devices
+
+# disk/mass storage pseudo-devices
+#pseudo-device	ccd		4	# concatenated/striped disk devices
+#pseudo-device	raid		4	# RAIDframe disk driver
+#pseudo-device	md		1	# memory disk device (ramdisk)
+pseudo-device	vnd		4	# disk-like interface to files
+
+# network pseudo-devices
+#pseudo-device	bpfilter	8	# Berkeley packet filter
+#pseudo-device	ipfilter		# IP filter (firewall) and NAT
+pseudo-device	loop		1	# network loopback
+#pseudo-device	ppp		2	# Point-to-Point Protocol
+#pseudo-device	sl		2	# Serial Line IP
+#pseudo-device	strip		2	# Starmode Radio IP (Metricom)
+#pseudo-device	tun		2	# network tunneling over tty
+#pseudo-device	gre		2	# generic L3 over IP tunnel
+#pseudo-device	ipip		2	# IP Encapsulation within IP (RFC 2003)
+#pseudo-device	gif		4	# IPv[46] over IPv[46] tunnel (RFC1933)
+#pseudo-device	faith		1	# IPv[46] tcp relay translation i/f
+#pseudo-device	stf		1	# 6to4 IPv6 over IPv4 encapsulation
+
+# miscellaneous pseudo-devices
+pseudo-device	pty			# pseudo-terminals
+#pseudo-device	tb		1	# tablet line discipline
+#pseudo-device	sequencer	1	# MIDI sequencer
+# rnd works; RND_COM does not on port arc yet.
+#pseudo-device	rnd			# /dev/random and in-kernel generator
+#options 	RND_COM			# use "com" randomness as well (BROKEN)
+
+# a pseudo device needed for Coda	# also needs CODA (above)
+#pseudo-device	vcoda		4	# coda minicache <-> venus comm.
+
+# mouse & keyboard multiplexor pseudo-devices
+#pseudo-device	wsmux		2

--LQksG6bCIzRHxTLp--