1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2021 Sifive. 4 */ 5 6 #ifndef __ASM_ALTERNATIVE_H 7 #define __ASM_ALTERNATIVE_H 8 9 #define ERRATA_STRING_LENGTH_MAX 32 10 11 #include <asm/alternative-macros.h> 12 13 #ifndef __ASSEMBLY__ 14 15 #include <linux/init.h> 16 #include <linux/types.h> 17 #include <linux/stddef.h> 18 #include <asm/hwcap.h> 19 20 void __init apply_boot_alternatives(void); 21 22 struct alt_entry { 23 void *old_ptr; /* address of original instruciton or data */ 24 void *alt_ptr; /* address of replacement instruction or data */ 25 unsigned long vendor_id; /* cpu vendor id */ 26 unsigned long alt_len; /* The replacement size */ 27 unsigned int errata_id; /* The errata id */ 28 } __packed; 29 30 struct errata_checkfunc_id { 31 unsigned long vendor_id; 32 bool (*func)(struct alt_entry *alt); 33 }; 34 35 void sifive_errata_patch_func(struct alt_entry *begin, struct alt_entry *end, 36 unsigned long archid, unsigned long impid); 37 38 #endif 39 #endif 40