18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_ALTERNATIVE_H 38c2ecf20Sopenharmony_ci#define __ASM_ALTERNATIVE_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/alternative-macros.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci#include <linux/stddef.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct alt_instr { 148c2ecf20Sopenharmony_ci s32 orig_offset; /* offset to original instruction */ 158c2ecf20Sopenharmony_ci s32 alt_offset; /* offset to replacement instruction */ 168c2ecf20Sopenharmony_ci u16 cpufeature; /* cpufeature bit set for replacement */ 178c2ecf20Sopenharmony_ci u8 orig_len; /* size of original instruction(s) */ 188c2ecf20Sopenharmony_ci u8 alt_len; /* size of new instruction(s), <= orig_len */ 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_citypedef void (*alternative_cb_t)(struct alt_instr *alt, 228c2ecf20Sopenharmony_ci __le32 *origptr, __le32 *updptr, int nr_inst); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_civoid __init apply_boot_alternatives(void); 258c2ecf20Sopenharmony_civoid __init apply_alternatives_all(void); 268c2ecf20Sopenharmony_cibool alternative_is_applied(u16 cpufeature); 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#ifdef CONFIG_MODULES 298c2ecf20Sopenharmony_civoid apply_alternatives_module(void *start, size_t length); 308c2ecf20Sopenharmony_ci#else 318c2ecf20Sopenharmony_cistatic inline void apply_alternatives_module(void *start, size_t length) { } 328c2ecf20Sopenharmony_ci#endif 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 358c2ecf20Sopenharmony_ci#endif /* __ASM_ALTERNATIVE_H */ 36