alternative.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_PARISC_ALTERNATIVE_H
  3. #define __ASM_PARISC_ALTERNATIVE_H
  4. #define ALT_COND_NO_SMP 0x01 /* when running UP instead of SMP */
  5. #define ALT_COND_NO_DCACHE 0x02 /* if system has no d-cache */
  6. #define ALT_COND_NO_ICACHE 0x04 /* if system has no i-cache */
  7. #define ALT_COND_NO_SPLIT_TLB 0x08 /* if split_tlb == 0 */
  8. #define ALT_COND_NO_IOC_FDC 0x10 /* if I/O cache does not need flushes */
  9. #define INSN_PxTLB 0x02 /* modify pdtlb, pitlb */
  10. #define INSN_NOP 0x08000240 /* nop */
  11. #ifndef __ASSEMBLY__
  12. #include <linux/init.h>
  13. #include <linux/types.h>
  14. #include <linux/stddef.h>
  15. #include <linux/stringify.h>
  16. struct alt_instr {
  17. s32 orig_offset; /* offset to original instructions */
  18. u32 len; /* end of original instructions */
  19. u32 cond; /* see ALT_COND_XXX */
  20. u32 replacement; /* replacement instruction or code */
  21. };
  22. void set_kernel_text_rw(int enable_read_write);
  23. /* Alternative SMP implementation. */
  24. #define ALTERNATIVE(cond, replacement) "!0:" \
  25. ".section .altinstructions, \"aw\" !" \
  26. ".word (0b-4-.), 1, " __stringify(cond) "," \
  27. __stringify(replacement) " !" \
  28. ".previous"
  29. #else
  30. #define ALTERNATIVE(from, to, cond, replacement)\
  31. .section .altinstructions, "aw" ! \
  32. .word (from - .), (to - from)/4 ! \
  33. .word cond, replacement ! \
  34. .previous
  35. #endif /* __ASSEMBLY__ */
  36. #endif /* __ASM_PARISC_ALTERNATIVE_H */