13e00884fSGautham R. Shenoy /* 2136fbf65Szhaolichang * PowerPC internal definitions for qemu. 33e00884fSGautham R. Shenoy * 43e00884fSGautham R. Shenoy * This library is free software; you can redistribute it and/or 53e00884fSGautham R. Shenoy * modify it under the terms of the GNU Lesser General Public 63e00884fSGautham R. Shenoy * License as published by the Free Software Foundation; either 76bd039cdSChetan Pant * version 2.1 of the License, or (at your option) any later version. 83e00884fSGautham R. Shenoy * 93e00884fSGautham R. Shenoy * This library is distributed in the hope that it will be useful, 103e00884fSGautham R. Shenoy * but WITHOUT ANY WARRANTY; without even the implied warranty of 113e00884fSGautham R. Shenoy * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 123e00884fSGautham R. Shenoy * Lesser General Public License for more details. 133e00884fSGautham R. Shenoy * 143e00884fSGautham R. Shenoy * You should have received a copy of the GNU Lesser General Public 153e00884fSGautham R. Shenoy * License along with this library; if not, see <http://www.gnu.org/licenses/>. 163e00884fSGautham R. Shenoy */ 173e00884fSGautham R. Shenoy 183e00884fSGautham R. Shenoy #ifndef PPC_INTERNAL_H 193e00884fSGautham R. Shenoy #define PPC_INTERNAL_H 203e00884fSGautham R. Shenoy 21*6ce1c9d0SPhilippe Mathieu-Daudé #include "exec/breakpoint.h" 2234553153SLucas Mateus Castro (alqotel) #include "hw/registerfields.h" 2334553153SLucas Mateus Castro (alqotel) 241978a41bSPhilippe Mathieu-Daudé /* PM instructions */ 251978a41bSPhilippe Mathieu-Daudé typedef enum { 261978a41bSPhilippe Mathieu-Daudé PPC_PM_DOZE, 271978a41bSPhilippe Mathieu-Daudé PPC_PM_NAP, 281978a41bSPhilippe Mathieu-Daudé PPC_PM_SLEEP, 291978a41bSPhilippe Mathieu-Daudé PPC_PM_RVWINKLE, 301978a41bSPhilippe Mathieu-Daudé PPC_PM_STOP, 311978a41bSPhilippe Mathieu-Daudé } powerpc_pm_insn_t; 321978a41bSPhilippe Mathieu-Daudé 333e00884fSGautham R. Shenoy #define FUNC_MASK(name, ret_type, size, max_val) \ 343e00884fSGautham R. Shenoy static inline ret_type name(uint##size##_t start, \ 353e00884fSGautham R. Shenoy uint##size##_t end) \ 363e00884fSGautham R. Shenoy { \ 373e00884fSGautham R. Shenoy ret_type ret, max_bit = size - 1; \ 383e00884fSGautham R. Shenoy \ 393e00884fSGautham R. Shenoy if (likely(start == 0)) { \ 403e00884fSGautham R. Shenoy ret = max_val << (max_bit - end); \ 413e00884fSGautham R. Shenoy } else if (likely(end == max_bit)) { \ 423e00884fSGautham R. Shenoy ret = max_val >> start; \ 433e00884fSGautham R. Shenoy } else { \ 443e00884fSGautham R. Shenoy ret = (((uint##size##_t)(-1ULL)) >> (start)) ^ \ 453e00884fSGautham R. Shenoy (((uint##size##_t)(-1ULL) >> (end)) >> 1); \ 463e00884fSGautham R. Shenoy if (unlikely(start > end)) { \ 473e00884fSGautham R. Shenoy return ~ret; \ 483e00884fSGautham R. Shenoy } \ 493e00884fSGautham R. Shenoy } \ 503e00884fSGautham R. Shenoy \ 513e00884fSGautham R. Shenoy return ret; \ 523e00884fSGautham R. Shenoy } 533e00884fSGautham R. Shenoy 543e00884fSGautham R. Shenoy #if defined(TARGET_PPC64) 553e00884fSGautham R. Shenoy FUNC_MASK(MASK, target_ulong, 64, UINT64_MAX); 563e00884fSGautham R. Shenoy #else 573e00884fSGautham R. Shenoy FUNC_MASK(MASK, target_ulong, 32, UINT32_MAX); 583e00884fSGautham R. Shenoy #endif 593e00884fSGautham R. Shenoy FUNC_MASK(mask_u32, uint32_t, 32, UINT32_MAX); 603e00884fSGautham R. Shenoy FUNC_MASK(mask_u64, uint64_t, 64, UINT64_MAX); 613e00884fSGautham R. Shenoy 62985e3023SBharata B Rao /*****************************************************************************/ 63985e3023SBharata B Rao /*** Instruction decoding ***/ 64985e3023SBharata B Rao #define EXTRACT_HELPER(name, shift, nb) \ 65985e3023SBharata B Rao static inline uint32_t name(uint32_t opcode) \ 66985e3023SBharata B Rao { \ 674c23c2a5SMark Cave-Ayland return extract32(opcode, shift, nb); \ 68985e3023SBharata B Rao } 69985e3023SBharata B Rao 70985e3023SBharata B Rao #define EXTRACT_SHELPER(name, shift, nb) \ 71985e3023SBharata B Rao static inline int32_t name(uint32_t opcode) \ 72985e3023SBharata B Rao { \ 734c23c2a5SMark Cave-Ayland return sextract32(opcode, shift, nb); \ 74985e3023SBharata B Rao } 75985e3023SBharata B Rao 76985e3023SBharata B Rao #define EXTRACT_HELPER_SPLIT(name, shift1, nb1, shift2, nb2) \ 77985e3023SBharata B Rao static inline uint32_t name(uint32_t opcode) \ 78985e3023SBharata B Rao { \ 794c23c2a5SMark Cave-Ayland return extract32(opcode, shift1, nb1) << nb2 | \ 804c23c2a5SMark Cave-Ayland extract32(opcode, shift2, nb2); \ 81985e3023SBharata B Rao } 82985e3023SBharata B Rao 83403a884aSNikunj A Dadhania #define EXTRACT_HELPER_SPLIT_3(name, \ 84985e3023SBharata B Rao d0_bits, shift_op_d0, shift_d0, \ 85985e3023SBharata B Rao d1_bits, shift_op_d1, shift_d1, \ 86985e3023SBharata B Rao d2_bits, shift_op_d2, shift_d2) \ 87985e3023SBharata B Rao static inline int16_t name(uint32_t opcode) \ 88985e3023SBharata B Rao { \ 89985e3023SBharata B Rao return \ 90985e3023SBharata B Rao (((opcode >> (shift_op_d0)) & ((1 << (d0_bits)) - 1)) << (shift_d0)) | \ 91985e3023SBharata B Rao (((opcode >> (shift_op_d1)) & ((1 << (d1_bits)) - 1)) << (shift_d1)) | \ 92985e3023SBharata B Rao (((opcode >> (shift_op_d2)) & ((1 << (d2_bits)) - 1)) << (shift_d2)); \ 93985e3023SBharata B Rao } 94985e3023SBharata B Rao 95985e3023SBharata B Rao 96985e3023SBharata B Rao /* Opcode part 1 */ 97985e3023SBharata B Rao EXTRACT_HELPER(opc1, 26, 6); 98985e3023SBharata B Rao /* Opcode part 2 */ 99985e3023SBharata B Rao EXTRACT_HELPER(opc2, 1, 5); 100985e3023SBharata B Rao /* Opcode part 3 */ 101985e3023SBharata B Rao EXTRACT_HELPER(opc3, 6, 5); 102985e3023SBharata B Rao /* Opcode part 4 */ 103985e3023SBharata B Rao EXTRACT_HELPER(opc4, 16, 5); 104985e3023SBharata B Rao /* Update Cr0 flags */ 105985e3023SBharata B Rao EXTRACT_HELPER(Rc, 0, 1); 106985e3023SBharata B Rao /* Update Cr6 flags (Altivec) */ 107985e3023SBharata B Rao EXTRACT_HELPER(Rc21, 10, 1); 108985e3023SBharata B Rao /* Destination */ 109985e3023SBharata B Rao EXTRACT_HELPER(rD, 21, 5); 110985e3023SBharata B Rao /* Source */ 111985e3023SBharata B Rao EXTRACT_HELPER(rS, 21, 5); 112985e3023SBharata B Rao /* First operand */ 113985e3023SBharata B Rao EXTRACT_HELPER(rA, 16, 5); 114985e3023SBharata B Rao /* Second operand */ 115985e3023SBharata B Rao EXTRACT_HELPER(rB, 11, 5); 116985e3023SBharata B Rao /* Third operand */ 117985e3023SBharata B Rao EXTRACT_HELPER(rC, 6, 5); 118985e3023SBharata B Rao /*** Get CRn ***/ 119985e3023SBharata B Rao EXTRACT_HELPER(crfD, 23, 3); 120985e3023SBharata B Rao EXTRACT_HELPER(BF, 23, 3); 121985e3023SBharata B Rao EXTRACT_HELPER(crfS, 18, 3); 122985e3023SBharata B Rao EXTRACT_HELPER(crbD, 21, 5); 123985e3023SBharata B Rao EXTRACT_HELPER(crbA, 16, 5); 124985e3023SBharata B Rao EXTRACT_HELPER(crbB, 11, 5); 125985e3023SBharata B Rao /* SPR / TBL */ 126985e3023SBharata B Rao EXTRACT_HELPER(_SPR, 11, 10); 127985e3023SBharata B Rao static inline uint32_t SPR(uint32_t opcode) 128985e3023SBharata B Rao { 129985e3023SBharata B Rao uint32_t sprn = _SPR(opcode); 130985e3023SBharata B Rao 131985e3023SBharata B Rao return ((sprn >> 5) & 0x1F) | ((sprn & 0x1F) << 5); 132985e3023SBharata B Rao } 133985e3023SBharata B Rao /*** Get constants ***/ 134985e3023SBharata B Rao /* 16 bits signed immediate value */ 135985e3023SBharata B Rao EXTRACT_SHELPER(SIMM, 0, 16); 136985e3023SBharata B Rao /* 16 bits unsigned immediate value */ 137985e3023SBharata B Rao EXTRACT_HELPER(UIMM, 0, 16); 138985e3023SBharata B Rao /* 5 bits signed immediate value */ 139ffcd21acSMark Cave-Ayland EXTRACT_SHELPER(SIMM5, 16, 5); 140985e3023SBharata B Rao /* 5 bits signed immediate value */ 141985e3023SBharata B Rao EXTRACT_HELPER(UIMM5, 16, 5); 142985e3023SBharata B Rao /* 4 bits unsigned immediate value */ 143985e3023SBharata B Rao EXTRACT_HELPER(UIMM4, 16, 4); 144985e3023SBharata B Rao /* Bit count */ 145985e3023SBharata B Rao EXTRACT_HELPER(NB, 11, 5); 146985e3023SBharata B Rao /* Shift count */ 147985e3023SBharata B Rao EXTRACT_HELPER(SH, 11, 5); 148a68a6146SBalamuruhan S /* lwat/stwat/ldat/lwat */ 149a68a6146SBalamuruhan S EXTRACT_HELPER(FC, 11, 5); 150985e3023SBharata B Rao /* Vector shift count */ 151985e3023SBharata B Rao EXTRACT_HELPER(VSH, 6, 4); 152985e3023SBharata B Rao /* Mask start */ 153985e3023SBharata B Rao EXTRACT_HELPER(MB, 6, 5); 154985e3023SBharata B Rao /* Mask end */ 155985e3023SBharata B Rao EXTRACT_HELPER(ME, 1, 5); 156985e3023SBharata B Rao /* Trap operand */ 157985e3023SBharata B Rao EXTRACT_HELPER(TO, 21, 5); 158985e3023SBharata B Rao 159985e3023SBharata B Rao EXTRACT_HELPER(CRM, 12, 8); 160985e3023SBharata B Rao 161985e3023SBharata B Rao #ifndef CONFIG_USER_ONLY 162985e3023SBharata B Rao EXTRACT_HELPER(SR, 16, 4); 163985e3023SBharata B Rao #endif 164985e3023SBharata B Rao 165985e3023SBharata B Rao /* mtfsf/mtfsfi */ 166985e3023SBharata B Rao EXTRACT_HELPER(FPBF, 23, 3); 167985e3023SBharata B Rao EXTRACT_HELPER(FPIMM, 12, 4); 168985e3023SBharata B Rao EXTRACT_HELPER(FPL, 25, 1); 169985e3023SBharata B Rao EXTRACT_HELPER(FPFLM, 17, 8); 170985e3023SBharata B Rao EXTRACT_HELPER(FPW, 16, 1); 171985e3023SBharata B Rao 172985e3023SBharata B Rao /* addpcis */ 173403a884aSNikunj A Dadhania EXTRACT_HELPER_SPLIT_3(DX, 10, 6, 6, 5, 16, 1, 1, 0, 0) 174985e3023SBharata B Rao #if defined(TARGET_PPC64) 175985e3023SBharata B Rao /* darn */ 176985e3023SBharata B Rao EXTRACT_HELPER(L, 16, 2); 177985e3023SBharata B Rao #endif 1780c9717ffSNicholas Piggin /* wait */ 1790c9717ffSNicholas Piggin EXTRACT_HELPER(WC, 21, 2); 1800c9717ffSNicholas Piggin EXTRACT_HELPER(PL, 16, 2); 181985e3023SBharata B Rao 182985e3023SBharata B Rao /*** Jump target decoding ***/ 183985e3023SBharata B Rao /* Immediate address */ 184985e3023SBharata B Rao static inline target_ulong LI(uint32_t opcode) 185985e3023SBharata B Rao { 186985e3023SBharata B Rao return (opcode >> 0) & 0x03FFFFFC; 187985e3023SBharata B Rao } 188985e3023SBharata B Rao 189985e3023SBharata B Rao static inline uint32_t BD(uint32_t opcode) 190985e3023SBharata B Rao { 191985e3023SBharata B Rao return (opcode >> 0) & 0xFFFC; 192985e3023SBharata B Rao } 193985e3023SBharata B Rao 194985e3023SBharata B Rao EXTRACT_HELPER(BO, 21, 5); 195985e3023SBharata B Rao EXTRACT_HELPER(BI, 16, 5); 196985e3023SBharata B Rao /* Absolute/relative address */ 197985e3023SBharata B Rao EXTRACT_HELPER(AA, 1, 1); 198985e3023SBharata B Rao /* Link */ 199985e3023SBharata B Rao EXTRACT_HELPER(LK, 0, 1); 200985e3023SBharata B Rao 201985e3023SBharata B Rao /* DFP Z22-form */ 202985e3023SBharata B Rao EXTRACT_HELPER(DCM, 10, 6) 203985e3023SBharata B Rao 204985e3023SBharata B Rao /* DFP Z23-form */ 205985e3023SBharata B Rao EXTRACT_HELPER(RMC, 9, 2) 206be07ad58SJose Ricardo Ziviani EXTRACT_HELPER(Rrm, 16, 1) 207985e3023SBharata B Rao 208d59ba583SNikunj A Dadhania EXTRACT_HELPER_SPLIT(DQxT, 3, 1, 21, 5); 209985e3023SBharata B Rao EXTRACT_HELPER_SPLIT(xT, 0, 1, 21, 5); 210985e3023SBharata B Rao EXTRACT_HELPER_SPLIT(xS, 0, 1, 21, 5); 211985e3023SBharata B Rao EXTRACT_HELPER_SPLIT(xA, 2, 1, 16, 5); 212985e3023SBharata B Rao EXTRACT_HELPER_SPLIT(xB, 1, 1, 11, 5); 213985e3023SBharata B Rao EXTRACT_HELPER_SPLIT(xC, 3, 1, 6, 5); 214985e3023SBharata B Rao EXTRACT_HELPER(DM, 8, 2); 215985e3023SBharata B Rao EXTRACT_HELPER(UIM, 16, 2); 216985e3023SBharata B Rao EXTRACT_HELPER(SHW, 8, 2); 217985e3023SBharata B Rao EXTRACT_HELPER(SP, 19, 2); 218985e3023SBharata B Rao EXTRACT_HELPER(IMM8, 11, 8); 21978241762SNikunj A Dadhania EXTRACT_HELPER(DCMX, 16, 7); 220403a884aSNikunj A Dadhania EXTRACT_HELPER_SPLIT_3(DCMX_XV, 5, 16, 0, 1, 2, 5, 1, 6, 6); 221985e3023SBharata B Rao 222f566c047SBharata B Rao void helper_compute_fprf_float16(CPUPPCState *env, float16 arg); 2239aeae8e1SBharata B Rao void helper_compute_fprf_float32(CPUPPCState *env, float32 arg); 22407bdd247SBharata B Rao void helper_compute_fprf_float128(CPUPPCState *env, float128 arg); 2250f3110faSRichard Henderson 2267468e2c8SBruno Larsen (billionai) /* translate.c */ 2277468e2c8SBruno Larsen (billionai) 2287468e2c8SBruno Larsen (billionai) int ppc_fixup_cpu(PowerPCCPU *cpu); 2297468e2c8SBruno Larsen (billionai) void create_ppc_opcodes(PowerPCCPU *cpu, Error **errp); 2307468e2c8SBruno Larsen (billionai) void destroy_ppc_opcodes(PowerPCCPU *cpu); 2317468e2c8SBruno Larsen (billionai) 23235a5d74eSBruno Larsen (billionai) /* gdbstub.c */ 23335a5d74eSBruno Larsen (billionai) void ppc_gdb_init(CPUState *cs, PowerPCCPUClass *ppc); 234a6506838SAkihiko Odaki const gchar *ppc_gdb_arch_name(CPUState *cs); 23535a5d74eSBruno Larsen (billionai) 236182357dbSRichard Henderson /** 237182357dbSRichard Henderson * prot_for_access_type: 238182357dbSRichard Henderson * @access_type: Access type 239182357dbSRichard Henderson * 240182357dbSRichard Henderson * Return the protection bit required for the given access type. 241182357dbSRichard Henderson */ 242182357dbSRichard Henderson static inline int prot_for_access_type(MMUAccessType access_type) 243182357dbSRichard Henderson { 244182357dbSRichard Henderson switch (access_type) { 245182357dbSRichard Henderson case MMU_INST_FETCH: 246182357dbSRichard Henderson return PAGE_EXEC; 247182357dbSRichard Henderson case MMU_DATA_LOAD: 248182357dbSRichard Henderson return PAGE_READ; 249182357dbSRichard Henderson case MMU_DATA_STORE: 250182357dbSRichard Henderson return PAGE_WRITE; 251182357dbSRichard Henderson } 252182357dbSRichard Henderson g_assert_not_reached(); 253182357dbSRichard Henderson } 254182357dbSRichard Henderson 255414fa2aaSPhilippe Mathieu-Daudé #ifndef CONFIG_USER_ONLY 256414fa2aaSPhilippe Mathieu-Daudé 2575118ebe8SLucas Mateus Castro (alqotel) /* PowerPC MMU emulation */ 2585118ebe8SLucas Mateus Castro (alqotel) 2595118ebe8SLucas Mateus Castro (alqotel) typedef struct mmu_ctx_t mmu_ctx_t; 260414fa2aaSPhilippe Mathieu-Daudé 2615118ebe8SLucas Mateus Castro (alqotel) bool ppc_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type, 2625118ebe8SLucas Mateus Castro (alqotel) hwaddr *raddrp, int *psizep, int *protp, 2635118ebe8SLucas Mateus Castro (alqotel) int mmu_idx, bool guest_visible); 2645118ebe8SLucas Mateus Castro (alqotel) int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx, 2655118ebe8SLucas Mateus Castro (alqotel) target_ulong eaddr, 2665118ebe8SLucas Mateus Castro (alqotel) MMUAccessType access_type, int type, 2675118ebe8SLucas Mateus Castro (alqotel) int mmu_idx); 2685118ebe8SLucas Mateus Castro (alqotel) /* Software driven TLB helpers */ 2695118ebe8SLucas Mateus Castro (alqotel) int ppc6xx_tlb_getnum(CPUPPCState *env, target_ulong eaddr, 2705118ebe8SLucas Mateus Castro (alqotel) int way, int is_code); 2715118ebe8SLucas Mateus Castro (alqotel) /* Context used internally during MMU translations */ 2725118ebe8SLucas Mateus Castro (alqotel) struct mmu_ctx_t { 2735118ebe8SLucas Mateus Castro (alqotel) hwaddr raddr; /* Real address */ 2745118ebe8SLucas Mateus Castro (alqotel) hwaddr eaddr; /* Effective address */ 2755118ebe8SLucas Mateus Castro (alqotel) int prot; /* Protection bits */ 2765118ebe8SLucas Mateus Castro (alqotel) hwaddr hash[2]; /* Pagetable hash values */ 2775118ebe8SLucas Mateus Castro (alqotel) target_ulong ptem; /* Virtual segment ID | API */ 2785118ebe8SLucas Mateus Castro (alqotel) int key; /* Access key */ 2795118ebe8SLucas Mateus Castro (alqotel) int nx; /* Non-execute area */ 2805118ebe8SLucas Mateus Castro (alqotel) }; 2815118ebe8SLucas Mateus Castro (alqotel) 282414fa2aaSPhilippe Mathieu-Daudé #endif /* !CONFIG_USER_ONLY */ 283414fa2aaSPhilippe Mathieu-Daudé 2845118ebe8SLucas Mateus Castro (alqotel) /* Common routines used by software and hardware TLBs emulation */ 2855118ebe8SLucas Mateus Castro (alqotel) static inline int pte_is_valid(target_ulong pte0) 2865118ebe8SLucas Mateus Castro (alqotel) { 2875118ebe8SLucas Mateus Castro (alqotel) return pte0 & 0x80000000 ? 1 : 0; 2885118ebe8SLucas Mateus Castro (alqotel) } 2895118ebe8SLucas Mateus Castro (alqotel) 2905118ebe8SLucas Mateus Castro (alqotel) static inline void pte_invalidate(target_ulong *pte0) 2915118ebe8SLucas Mateus Castro (alqotel) { 2925118ebe8SLucas Mateus Castro (alqotel) *pte0 &= ~0x80000000; 2935118ebe8SLucas Mateus Castro (alqotel) } 2945118ebe8SLucas Mateus Castro (alqotel) 2955118ebe8SLucas Mateus Castro (alqotel) #define PTE_PTEM_MASK 0x7FFFFFBF 2965118ebe8SLucas Mateus Castro (alqotel) #define PTE_CHECK_MASK (TARGET_PAGE_MASK | 0x7B) 2975118ebe8SLucas Mateus Castro (alqotel) 2981db8af5cSRichard Henderson #ifdef CONFIG_USER_ONLY 2991db8af5cSRichard Henderson void ppc_cpu_record_sigsegv(CPUState *cs, vaddr addr, 3001db8af5cSRichard Henderson MMUAccessType access_type, 3011db8af5cSRichard Henderson bool maperr, uintptr_t ra); 3021db8af5cSRichard Henderson #else 3031db8af5cSRichard Henderson bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size, 3041db8af5cSRichard Henderson MMUAccessType access_type, int mmu_idx, 3051db8af5cSRichard Henderson bool probe, uintptr_t retaddr); 3068905770bSMarc-André Lureau G_NORETURN void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, 307996473e4SRichard Henderson MMUAccessType access_type, int mmu_idx, 3088905770bSMarc-André Lureau uintptr_t retaddr); 30955a7fa34SNicholas Piggin void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, 31055a7fa34SNicholas Piggin vaddr addr, unsigned size, 31155a7fa34SNicholas Piggin MMUAccessType access_type, 31255a7fa34SNicholas Piggin int mmu_idx, MemTxAttrs attrs, 31355a7fa34SNicholas Piggin MemTxResult response, uintptr_t retaddr); 31414192307SNicholas Piggin void ppc_cpu_debug_excp_handler(CPUState *cs); 31514192307SNicholas Piggin bool ppc_cpu_debug_check_breakpoint(CPUState *cs); 316d5ee641cSNicholas Piggin bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); 3171db8af5cSRichard Henderson #endif 3185118ebe8SLucas Mateus Castro (alqotel) 31934553153SLucas Mateus Castro (alqotel) FIELD(GER_MSK, XMSK, 0, 4) 32034553153SLucas Mateus Castro (alqotel) FIELD(GER_MSK, YMSK, 4, 4) 32134553153SLucas Mateus Castro (alqotel) FIELD(GER_MSK, PMSK, 8, 8) 32234553153SLucas Mateus Castro (alqotel) 32334553153SLucas Mateus Castro (alqotel) static inline int ger_pack_masks(int pmsk, int ymsk, int xmsk) 32434553153SLucas Mateus Castro (alqotel) { 32534553153SLucas Mateus Castro (alqotel) int msk = 0; 32634553153SLucas Mateus Castro (alqotel) msk = FIELD_DP32(msk, GER_MSK, XMSK, xmsk); 32734553153SLucas Mateus Castro (alqotel) msk = FIELD_DP32(msk, GER_MSK, YMSK, ymsk); 32834553153SLucas Mateus Castro (alqotel) msk = FIELD_DP32(msk, GER_MSK, PMSK, pmsk); 32934553153SLucas Mateus Castro (alqotel) return msk; 33034553153SLucas Mateus Castro (alqotel) } 33134553153SLucas Mateus Castro (alqotel) 3323e00884fSGautham R. Shenoy #endif /* PPC_INTERNAL_H */ 333