/*
 * Copyright (C) 2016-2017 Synopsys, Inc. (www.synopsys.com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

#ifndef __SOC_ARC_AUX_H__
#define __SOC_ARC_AUX_H__

#ifdef CONFIG_ARC

#define read_aux_reg(r)		__builtin_arc_lr(r)

/* gcc builtin sr needs reg param to be long immediate */
#define write_aux_reg(r, v)	__builtin_arc_sr((unsigned int)(v), r)

#else	/* !CONFIG_ARC */

static inline int read_aux_reg(u32 r)
{
	return 0;
}

/*
 * function helps elide unused variable warning
 * see: http://lists.infradead.org/pipermail/linux-snps-arc/2016-November/001748.html
 */
static inline void write_aux_reg(u32 r, u32 v)
{
	;
}

#endif

#define READ_BCR(reg, into)				\
{							\
	unsigned int tmp;				\
	tmp = read_aux_reg(reg);			\
	if (sizeof(tmp) == sizeof(into)) {		\
		into = *((typeof(into) *)&tmp);		\
	} else {					\
		extern void bogus_undefined(void);	\
		bogus_undefined();			\
	}						\
}

#define WRITE_AUX(reg, into)				\
{							\
	unsigned int tmp;				\
	if (sizeof(tmp) == sizeof(into)) {		\
		tmp = (*(unsigned int *)&(into));	\
		write_aux_reg(reg, tmp);		\
	} else  {					\
		extern void bogus_undefined(void);	\
		bogus_undefined();			\
	}						\
}


#endif
> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/net/can/af_can.c?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/net/can/af_can.c?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/net/can/af_can.c?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/net/can/af_can.c?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/net/can/af_can.c'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='d120649d86852f00d2c8afc943d1f480d6ed2703'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/net?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>net</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/can?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>can</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/can/af_can.c?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703'>af_can.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/net/can/af_can.c?h=nds-private-remove&amp;id=d120649d86852f00d2c8afc943d1f480d6ed2703&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>