1a439fe51SSam Ravnborg #ifndef _SPARC64_HEAD_H 2a439fe51SSam Ravnborg #define _SPARC64_HEAD_H 3a439fe51SSam Ravnborg 4a439fe51SSam Ravnborg #include <asm/pstate.h> 5a439fe51SSam Ravnborg 6a439fe51SSam Ravnborg /* wrpr %g0, val, %gl */ 7a439fe51SSam Ravnborg #define SET_GL(val) \ 8a439fe51SSam Ravnborg .word 0xa1902000 | val 9a439fe51SSam Ravnborg 10a439fe51SSam Ravnborg /* rdpr %gl, %gN */ 11a439fe51SSam Ravnborg #define GET_GL_GLOBAL(N) \ 12a439fe51SSam Ravnborg .word 0x81540000 | (N << 25) 13a439fe51SSam Ravnborg 14a439fe51SSam Ravnborg #define KERNBASE 0x400000 15a439fe51SSam Ravnborg 16a439fe51SSam Ravnborg #define PTREGS_OFF (STACK_BIAS + STACKFRAME_SZ) 17a439fe51SSam Ravnborg 18*7cafc0b8SDavid S. Miller #define RTRAP_PSTATE (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE) 19*7cafc0b8SDavid S. Miller #define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV) 20*7cafc0b8SDavid S. Miller #define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) 21*7cafc0b8SDavid S. Miller 22a439fe51SSam Ravnborg #define __CHEETAH_ID 0x003e0014 23a439fe51SSam Ravnborg #define __JALAPENO_ID 0x003e0016 24a439fe51SSam Ravnborg #define __SERRANO_ID 0x003e0022 25a439fe51SSam Ravnborg 26a439fe51SSam Ravnborg #define CHEETAH_MANUF 0x003e 27a439fe51SSam Ravnborg #define CHEETAH_IMPL 0x0014 /* Ultra-III */ 28a439fe51SSam Ravnborg #define CHEETAH_PLUS_IMPL 0x0015 /* Ultra-III+ */ 29a439fe51SSam Ravnborg #define JALAPENO_IMPL 0x0016 /* Ultra-IIIi */ 30a439fe51SSam Ravnborg #define JAGUAR_IMPL 0x0018 /* Ultra-IV */ 31a439fe51SSam Ravnborg #define PANTHER_IMPL 0x0019 /* Ultra-IV+ */ 32a439fe51SSam Ravnborg #define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */ 33a439fe51SSam Ravnborg 34a439fe51SSam Ravnborg #define BRANCH_IF_SUN4V(tmp1,label) \ 35a439fe51SSam Ravnborg sethi %hi(is_sun4v), %tmp1; \ 36a439fe51SSam Ravnborg lduw [%tmp1 + %lo(is_sun4v)], %tmp1; \ 37a439fe51SSam Ravnborg brnz,pn %tmp1, label; \ 38a439fe51SSam Ravnborg nop 39a439fe51SSam Ravnborg 40a439fe51SSam Ravnborg #define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \ 41a439fe51SSam Ravnborg rdpr %ver, %tmp1; \ 42a439fe51SSam Ravnborg sethi %hi(__CHEETAH_ID), %tmp2; \ 43a439fe51SSam Ravnborg srlx %tmp1, 32, %tmp1; \ 44a439fe51SSam Ravnborg or %tmp2, %lo(__CHEETAH_ID), %tmp2;\ 45a439fe51SSam Ravnborg cmp %tmp1, %tmp2; \ 46a439fe51SSam Ravnborg be,pn %icc, label; \ 47a439fe51SSam Ravnborg nop; 48a439fe51SSam Ravnborg 49a439fe51SSam Ravnborg #define BRANCH_IF_JALAPENO(tmp1,tmp2,label) \ 50a439fe51SSam Ravnborg rdpr %ver, %tmp1; \ 51a439fe51SSam Ravnborg sethi %hi(__JALAPENO_ID), %tmp2; \ 52a439fe51SSam Ravnborg srlx %tmp1, 32, %tmp1; \ 53a439fe51SSam Ravnborg or %tmp2, %lo(__JALAPENO_ID), %tmp2;\ 54a439fe51SSam Ravnborg cmp %tmp1, %tmp2; \ 55a439fe51SSam Ravnborg be,pn %icc, label; \ 56a439fe51SSam Ravnborg nop; 57a439fe51SSam Ravnborg 58a439fe51SSam Ravnborg #define BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(tmp1,tmp2,label) \ 59a439fe51SSam Ravnborg rdpr %ver, %tmp1; \ 60a439fe51SSam Ravnborg srlx %tmp1, (32 + 16), %tmp2; \ 61a439fe51SSam Ravnborg cmp %tmp2, CHEETAH_MANUF; \ 62a439fe51SSam Ravnborg bne,pt %xcc, 99f; \ 63a439fe51SSam Ravnborg sllx %tmp1, 16, %tmp1; \ 64a439fe51SSam Ravnborg srlx %tmp1, (32 + 16), %tmp2; \ 65a439fe51SSam Ravnborg cmp %tmp2, CHEETAH_PLUS_IMPL; \ 66a439fe51SSam Ravnborg bgeu,pt %xcc, label; \ 67a439fe51SSam Ravnborg 99: nop; 68a439fe51SSam Ravnborg 69a439fe51SSam Ravnborg #define BRANCH_IF_ANY_CHEETAH(tmp1,tmp2,label) \ 70a439fe51SSam Ravnborg rdpr %ver, %tmp1; \ 71a439fe51SSam Ravnborg srlx %tmp1, (32 + 16), %tmp2; \ 72a439fe51SSam Ravnborg cmp %tmp2, CHEETAH_MANUF; \ 73a439fe51SSam Ravnborg bne,pt %xcc, 99f; \ 74a439fe51SSam Ravnborg sllx %tmp1, 16, %tmp1; \ 75a439fe51SSam Ravnborg srlx %tmp1, (32 + 16), %tmp2; \ 76a439fe51SSam Ravnborg cmp %tmp2, CHEETAH_IMPL; \ 77a439fe51SSam Ravnborg bgeu,pt %xcc, label; \ 78a439fe51SSam Ravnborg 99: nop; 79a439fe51SSam Ravnborg 80a439fe51SSam Ravnborg #endif /* !(_SPARC64_HEAD_H) */ 81