Subject: Read/write to ICSR via SRM palcode
To: NetBSD-Alpha port <port-alpha@netbsd.org>
From: Andreas Johansson <ajo@wopr.campus.luth.se>
List: port-alpha
Date: 05/05/2000 18:03:06
Hi!

Due to incomplete free documentation of the SRM palcode I'm asking here
if anyone can solve my problem.

I want to write to the ICSR register in my 21164PC via the SRM palcode,
but I don't have the complete definition of the palcode functions. The
only thing I've found is the MILO (linux boot loader/palcode), that says I
can do something like this:

ICSR read:

	clr	 a0		; cserve parameter 1 (not used)
	clr	 a1		; cserve parameter 2 (not used)
	mov	 0x11,a2	; CSERVE_K_RD_ICSR
	call_pal 0x9		; PAL_cserve
				; ICSR is copied into v0

ICSR write:

	mov	v0, a0		; New ICSR value in cserve parameter 1
	clr	a1		; cserve parameter 2 (not used)
	mov	0x10, a2	; CSERVE_K_WR_ICSR
	call_pal 0x9		; PAL_cserve

This works in linux using the milo palcode, I can read and write ICSR
using the above code in kernel. As far as I know, the MILO palcode derives
from an old version of the SRM palcode.

However, when I try this in NetBSD using the SRM palcode, I get 0x0 when
I read and God knows what else happens when I do this - the machine
behaves strangely. Can anyone that has access to the SRM palcode source
and/or documentation look this up and tell me what's wrong?

The reason I want to access this register is that there is a bug in the
SRM palcode for the 21164PC that I want to fix. The MVI instruction set
extention is not enabled, and this is controlled by one of the bits in
ICSR.

I've found a hardware specific instruction that accesses the ICSR
register, but this instruction should only be used in the palcode :/

/Andreas