1/* 2 * (C) Copyright 2011, Julius Baxter <julius@opencores.org> 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7#ifndef __ASM_OPENRISC_SYSTEM_H 8#define __ASM_OPENRISC_SYSTEM_H 9 10#include <asm/spr-defs.h> 11 12static inline unsigned long mfspr(unsigned long add) 13{ 14 unsigned long ret; 15 16 __asm__ __volatile__ ("l.mfspr %0,r0,%1" : "=r" (ret) : "K" (add)); 17 18 return ret; 19} 20 21static inline void mtspr(unsigned long add, unsigned long val) 22{ 23 __asm__ __volatile__ ("l.mtspr r0,%1,%0" : : "K" (add), "r" (val)); 24} 25 26#endif /* __ASM_OPENRISC_SYSTEM_H */ 27