Subject: Support for MIPS32 and MIPS64 CPUs.
To: None <port-mips@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: port-mips
Date: 02/26/2002 09:23:30
Folks,

I've together some changes for NetBSD/mips based on both my own work
and the work of the folks at Broadcom/Sibyte to support the MIPS32 and
MIPS64 architectures.  This code is currently running on the Broadcom
SB1250 CPU (MIPS64) on a Swarm evaluation board and the MIPS 4Kc CPU
(MIPS32) on a Malta evaluation board.  It's also been tested on R3000A,
R4000, R4400 and RM5200 CPUs.

A list of the major changes are:

  - include/cpu.h
	- Clean up mips1 vs. mips3+greater configuration.  I'm trying
	  to move away from the "CPUISMIPS3" test being a catchall for
	  everything - the new table in mips_machdep.c is used to set
	  up a lot of feature tests now.
  - include/cpuregs.h
	- Make CP0 register definitions available to C as well as asm
	- More CPU IDs
  - mips/cache.c
	- Add support for MIPS32 and MIPS64 cache setup (from Broadcom)
  - mips/cache_mipsNN.c
	- Cache-ops for MIPS32 and MIPS64 CPUs
  - mips/locore_mips3.S
	- Remove all mmu/cp0-related code that may use 32bit cp0 registers
	  on mips32-style implementations and move to mipsX_subr.S.
	- Remove local cache instruction flags
	- Add badaddr64 (from Broadcom)
  - mips/mips32_subr.S
	- Code from locore_mips3.S included from new stub files
	  mips{3,32,64,5900}_subr.S with support for various
	  architectures.
  - mips/mips_machdep.c
	- Table-driven cpu name/feature detection
	- MIPS32/64 feature detection (from Broadcom)
  - mips/syscall.c
	- Fix syscall handling of _MIPS_BSD_API_LP32_64CLEAN.

Some things that still to be cleaned up/improved/checked are:

  - R5900 support is probably broken
  - conditional compilation (MIPS3_PLUS, etc)
  - fix/remove MIPS3_L2CACHE_ABSENT and MIPS3_NO_PV_UNCACHED
  - testing on HPCMIPS style machines

The diffs for this are at
ftp://ftp.netbsd.org/pub/NetBSD/misc/simonb/mipsNN.diffs.1.gz

Once I've got this added to the NetBSD source tree I'll bring in ports
for the swarm and malta.

I'd welcome any comments of this code, and I'll plan to start adding
it to our source tree soon if there's no uproar about what I've done
so far...

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/