Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309523
b: refs/heads/master
c: 7b372d6
h: refs/heads/master
i:
  309521: a8f7695
  309519: 9ac25dc
v: v3
  • Loading branch information
Sam Ravnborg authored and David S. Miller committed May 28, 2012
1 parent e4883c6 commit cf7e856
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec24158eac0ae2786ebf1e0afa8f3664891319ba
refs/heads/master: 7b372d6582ca3bf41a1af9f168f3a852f3d7b21d
6 changes: 6 additions & 0 deletions trunk/arch/sparc/include/asm/psr.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
#define PSR_VERS 0x0f000000 /* cpu-version field */
#define PSR_IMPL 0xf0000000 /* cpu-implementation field */

#define PSR_IMPL_SHIFT 28
#define PSR_IMPL_SHIFTED_MASK 0xf

#define PSR_IMPL_TI 0x4
#define PSR_IMPL_LEON 0xf

#ifdef __KERNEL__

#ifndef __ASSEMBLY__
Expand Down
58 changes: 47 additions & 11 deletions trunk/arch/sparc/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ copy_prom_done:
bne not_a_sun4
nop

halt_sun4_or_sun4c:
halt_notsup:
ld [%g7 + 0x68], %o1
set notsup, %o0
sub %o0, %l6, %o0
Expand All @@ -202,18 +202,31 @@ halt_sun4_or_sun4c:
nop

not_a_sun4:
/* It looks like this is a machine we support.
* Now find out what MMU we are dealing with
* LEON - identified by the psr.impl field
* Viking - identified by the psr.impl field
* In all other cases a sun4m srmmu.
* We check that the MMU is enabled in all cases.
*/

/* Check if this is a LEON CPU */
rd %psr, %g3
srl %g3, PSR_IMPL_SHIFT, %g3
and %g3, PSR_IMPL_SHIFTED_MASK, %g3
cmp %g3, PSR_IMPL_LEON
be leon_remap /* It is a LEON - jump */
nop

/* Sanity-check, is MMU enabled */
lda [%g0] ASI_M_MMUREGS, %g1
andcc %g1, 1, %g0
be halt_sun4_or_sun4c
be halt_notsup
nop

srmmu_remap:
/* First, check for a viking (TI) module. */
set 0x40000000, %g2
rd %psr, %g3
and %g2, %g3, %g3
subcc %g3, 0x0, %g0
bz srmmu_nviking
/* Check for a viking (TI) module. */
cmp %g3, PSR_IMPL_TI
bne srmmu_not_viking
nop

/* Figure out what kind of viking we are on.
Expand All @@ -228,7 +241,7 @@ srmmu_remap:
lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg
and %g2, %g3, %g3
subcc %g3, 0x0, %g0
bnz srmmu_nviking ! is in mbus mode
bnz srmmu_not_viking ! is in mbus mode
nop

rd %psr, %g3 ! DO NOT TOUCH %g3
Expand Down Expand Up @@ -293,12 +306,12 @@ srmmu_remap:
b go_to_highmem
nop

srmmu_not_viking:
/* This works on viking's in Mbus mode and all
* other MBUS modules. It is virtually the same as
* the above madness sans turning traps off and flipping
* the AC bit.
*/
srmmu_nviking:
set AC_M_CTPR, %g1
lda [%g1] ASI_M_MMUREGS, %g1 ! get ctx table ptr
sll %g1, 0x4, %g1 ! make physical addr
Expand All @@ -313,6 +326,29 @@ srmmu_nviking:
nop ! wheee....


leon_remap:
/* Sanity-check, is MMU enabled */
lda [%g0] ASI_LEON_MMUREGS, %g1
andcc %g1, 1, %g0
be halt_notsup
nop

/* Same code as in the srmmu_not_viking case,
* with the LEON ASI for mmuregs
*/
set AC_M_CTPR, %g1
lda [%g1] ASI_LEON_MMUREGS, %g1 ! get ctx table ptr
sll %g1, 0x4, %g1 ! make physical addr
lda [%g1] ASI_M_BYPASS, %g1 ! ptr to level 1 pg_table
srl %g1, 0x4, %g1
sll %g1, 0x8, %g1 ! make phys addr for l1 tbl

lda [%g1] ASI_M_BYPASS, %g2 ! get level1 entry for 0x0
add %g1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %g3
sta %g2, [%g3] ASI_M_BYPASS ! place at KERNBASE entry
b go_to_highmem
nop ! wheee....

/* Now do a non-relative jump so that PC is in high-memory */
go_to_highmem:
set execute_in_high_mem, %g1
Expand Down

0 comments on commit cf7e856

Please sign in to comment.