Subject: mapping memory on sun3
To: Alex Barclay <alex@vsys.com>
From: Gordon W. Ross <gwr@netbsd.org>
List: port-sun3
Date: 03/20/1999 08:49:03
Alex Barclay writes:
 > Hi all,
 > 
 > I'm sending this to tech-kern as well as port-sun3 because I'm hoping
 > that the memory mapping mechanism is MI code.
 >
 > I'm trying to enable the cache on a sun 3x. I know the cache tags
 > physical address but am having trouble in mapping this into memory.
 > 
 > I'm looking to enable the cache from machdep.c (the same place that
 > it's done on the sun 3 arch)
 > 
 > How do I do this?

Not quite.  The sun3 still uses an older interface for mapping (from
before the bus.h interface was developed).  It's not hard.  See:

	sys/arch/sun3/include/autoconf.h  bus_mapin()
	sys/arch/sun3/sun3x/iommu.c  iommu_attach()

 > Do I need to protect things with splhigh in machdep? The sun3 port
 > doesn't seem to so I'm not sure.

Depends on what you are doing and when.  During autoconfig, there are
no interrupts so no need to do any spl calls.  Later, VM-related work
only needs to spl if manipulating things also touched by interrupts.
On the sun3, the cache management code code (cache.c) is always called
with interrupts already blocked as needed (usually by pmap.c).

I suggest looking a the sun3 pmap to see where cache_XXX calls are.

Gordon