1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2021 Sifive.
6 #ifndef __ASM_ALTERNATIVE_H
7 #define __ASM_ALTERNATIVE_H
9 #define ERRATA_STRING_LENGTH_MAX 32
11 #include <asm/alternative-macros.h>
15 #include <linux/init.h>
16 #include <linux/types.h>
17 #include <linux/stddef.h>
18 #include <asm/hwcap.h>
20 void __init apply_boot_alternatives(void);
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 */
30 struct errata_checkfunc_id {
31 unsigned long vendor_id;
32 bool (*func)(struct alt_entry *alt);
35 void sifive_errata_patch_func(struct alt_entry *begin, struct alt_entry *end,
36 unsigned long archid, unsigned long impid);