1d03114eaSBibo Mao /* SPDX-License-Identifier: GPL-2.0-or-later */ 2d03114eaSBibo Mao /* 3d03114eaSBibo Mao * Copyright (c) 2025 Loongson Technology Corporation Limited 4d03114eaSBibo Mao */ 5d03114eaSBibo Mao 6d03114eaSBibo Mao #ifndef TARGET_LOONGARCH_CSR_H 7d03114eaSBibo Mao #define TARGET_LOONGARCH_CSR_H 8d03114eaSBibo Mao 9d03114eaSBibo Mao #include "cpu-csr.h" 10d03114eaSBibo Mao 11d03114eaSBibo Mao typedef void (*GenCSRFunc)(void); 12d03114eaSBibo Mao enum { 13d03114eaSBibo Mao CSRFL_READONLY = (1 << 0), 14d03114eaSBibo Mao CSRFL_EXITTB = (1 << 1), 15d03114eaSBibo Mao CSRFL_IO = (1 << 2), 16b5b13eb7SBibo Mao CSRFL_UNUSED = (1 << 3), 17d03114eaSBibo Mao }; 18d03114eaSBibo Mao 19d03114eaSBibo Mao typedef struct { 20*3215fe85SBibo Mao const char *name; 21d03114eaSBibo Mao int offset; 22d03114eaSBibo Mao int flags; 23d03114eaSBibo Mao GenCSRFunc readfn; 24d03114eaSBibo Mao GenCSRFunc writefn; 25d03114eaSBibo Mao } CSRInfo; 26d03114eaSBibo Mao 27cb6fa414SBibo Mao CSRInfo *get_csr(unsigned int csr_num); 28b5b13eb7SBibo Mao bool set_csr_flag(unsigned int csr_num, int flag); 29d03114eaSBibo Mao #endif /* TARGET_LOONGARCH_CSR_H */ 30