2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
5 Desc: ReadGayle() - get the Gayle ID
8 /*****************************************************************************
11 #include <proto/exec.h>
13 AROS_LH0(ULONG, ReadGayle,
16 struct ExecBase *, SysBase, 136, Exec)
36 ******************************************************************************/
37 #include "aros/m68k/asm.h"
41 .globl AROS_SLIB_ENTRY(ReadGayle,Exec,136)
42 AROS_SLIB_ENTRY(ReadGayle,Exec,136):
44 /* A3000 Fat Gary/RAMSEY registers are supposed to be supervisor-only
45 * Common chip revisions don't care but later (rare) revisions might do it */
47 /* If A6 is 0, this is the initial ROM call, and
48 * we are already in supervisor mode.
60 move.l #0xde1000,%a0 /* Gayle ID register */
62 /* NOTE: We must check for custom chip mirroring. */
63 /* Can we turn off interrupts? */
64 move.w 0x1c(%a1),%sp@- /* INTENAR */
65 move.w #0x7fff,0x9a(%a1) /* INTENA */
67 bne.s 4f /* If non-zero, not INTENAR */
68 move.w #0xc000,0x9a(%a1)
70 move.w #0x7fff,0x9a(%a1) /* INTENA */
72 beq.s 3f /* If 0x4000, was INTENAR */
74 /* Now, finally, we can check for a Gayle */
75 clr.l %d0 /* ID we will return */
76 moveq #8-1,%d1 /* Gayle bit index */
78 move.b %a0@,%sp@- /* It could be Gary timeout register, not Gayle ID. */
80 move.b %d0,%a0@ /* Reset ID register */
82 0: move.b %a0@,%d0 /* Put reg into lower byte of %d0 */
83 lsl.w #1,%d0 /* Shift lower 16 bits of %d0 left by 1 */
85 lsr.w #8,%d0 /* Move ID to lower 8 bits of %d0 */
87 move.b %sp@+,%a0@ /* Restore possible Gary timeout register */
95 /* Restore interrupts. */
98 move.w %d1,0x9a(%a1) /* INTENA */