1*c0ded849SHemant Agrawal /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) 2*c0ded849SHemant Agrawal * 3*c0ded849SHemant Agrawal * Copyright 2008-2016 Freescale Semiconductor Inc. 4*c0ded849SHemant Agrawal * Copyright 2016 NXP 5*c0ded849SHemant Agrawal * 6*c0ded849SHemant Agrawal */ 7*c0ded849SHemant Agrawal 8*c0ded849SHemant Agrawal #ifndef __RTA_SIGNATURE_CMD_H__ 9*c0ded849SHemant Agrawal #define __RTA_SIGNATURE_CMD_H__ 10*c0ded849SHemant Agrawal 11*c0ded849SHemant Agrawal static inline int rta_signature(struct program * program,uint32_t sign_type)12*c0ded849SHemant Agrawalrta_signature(struct program *program, uint32_t sign_type) 13*c0ded849SHemant Agrawal { 14*c0ded849SHemant Agrawal uint32_t opcode = CMD_SIGNATURE; 15*c0ded849SHemant Agrawal unsigned int start_pc = program->current_pc; 16*c0ded849SHemant Agrawal 17*c0ded849SHemant Agrawal switch (sign_type) { 18*c0ded849SHemant Agrawal case (SIGN_TYPE_FINAL): 19*c0ded849SHemant Agrawal case (SIGN_TYPE_FINAL_RESTORE): 20*c0ded849SHemant Agrawal case (SIGN_TYPE_FINAL_NONZERO): 21*c0ded849SHemant Agrawal case (SIGN_TYPE_IMM_2): 22*c0ded849SHemant Agrawal case (SIGN_TYPE_IMM_3): 23*c0ded849SHemant Agrawal case (SIGN_TYPE_IMM_4): 24*c0ded849SHemant Agrawal opcode |= sign_type; 25*c0ded849SHemant Agrawal break; 26*c0ded849SHemant Agrawal default: 27*c0ded849SHemant Agrawal pr_err("SIGNATURE Command: Invalid type selection\n"); 28*c0ded849SHemant Agrawal goto err; 29*c0ded849SHemant Agrawal } 30*c0ded849SHemant Agrawal 31*c0ded849SHemant Agrawal __rta_out32(program, opcode); 32*c0ded849SHemant Agrawal program->current_instruction++; 33*c0ded849SHemant Agrawal 34*c0ded849SHemant Agrawal return (int)start_pc; 35*c0ded849SHemant Agrawal 36*c0ded849SHemant Agrawal err: 37*c0ded849SHemant Agrawal program->first_error_pc = start_pc; 38*c0ded849SHemant Agrawal program->current_instruction++; 39*c0ded849SHemant Agrawal return -EINVAL; 40*c0ded849SHemant Agrawal } 41*c0ded849SHemant Agrawal 42*c0ded849SHemant Agrawal #endif /* __RTA_SIGNATURE_CMD_H__ */ 43