Fix window handling on 7 window Sparcs

git-svn-id: svn://coreboot.org/openbios/openbios-devel@241 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-09-29 17:11:00 +00:00
parent b5bb226eed
commit 87ad09c235
3 changed files with 47 additions and 4 deletions

View File

@@ -364,6 +364,49 @@ highmem:
mov %y, %g2
st %g2, [%g1]
/* Compute NWINDOWS and stash it away. Now uses %wim trick explained
* in the V8 manual. Ok, this method seems to work, Sparc is cool...
* No, it doesn't work, have to play the save/readCWP/restore trick.
*/
wr %g0, 0x0, %wim ! so we do not get a trap
WRITE_PAUSE
save
rd %psr, %g3
restore
and %g3, 0x1f, %g3
add %g3, 0x1, %g3
mov 2, %g1
wr %g1, 0x0, %wim ! make window 1 invalid
WRITE_PAUSE
cmp %g3, 0x7
bne 1f
nop
/* Adjust our window handling routines to
* do things correctly on 7 window Sparcs.
*/
#define PATCH_INSN(src, dest) \
set src, %g5; \
set dest, %g2; \
ld [%g5], %g4; \
st %g4, [%g2];
/* Patch for window spills... */
PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
/* Patch for window fills... */
PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
1:
/* Finally, turn on traps so that we can call c-code. */
rd %psr, %g3
wr %g3, 0x0, %psr

View File

@@ -77,7 +77,7 @@
.text
.align 4
#if 0
/* BEGINNING OF PATCH INSTRUCTIONS */
/* On a 7-window Sparc the boot code patches spnwin_*
* instructions with the following ones.
@@ -87,7 +87,7 @@ spnwin_patch1_7win: sll %t_wim, 6, %glob_tmp
spnwin_patch2_7win: and %glob_tmp, 0x7f, %glob_tmp
spnwin_patch3_7win: and %twin_tmp, 0x7f, %twin_tmp
/* END OF PATCH INSTRUCTIONS */
#endif
/* The trap entry point has done the following:
*
* rd %psr, %l0

View File

@@ -96,7 +96,7 @@
* I == this window will be the invalid one when we
* are done and return from trap if successful
*/
#if 0
/* BEGINNING OF PATCH INSTRUCTIONS */
/* On 7-window Sparc the boot code patches fnwin_patch1
@@ -106,7 +106,7 @@
fnwin_patch1_7win: srl %t_wim, 6, %twin_tmp2
fnwin_patch2_7win: and %twin_tmp1, 0x7f, %twin_tmp1
/* END OF PATCH INSTRUCTIONS */
#endif
.globl fill_window_entry, fnwin_patch1, fnwin_patch2
fill_window_entry: