xref: /openbmc/linux/arch/powerpc/sysdev/dcr-low.S (revision 4c75a6f4)
14c75a6f4SBenjamin Herrenschmidt/*
24c75a6f4SBenjamin Herrenschmidt * "Indirect" DCR access
34c75a6f4SBenjamin Herrenschmidt *
44c75a6f4SBenjamin Herrenschmidt * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net>
54c75a6f4SBenjamin Herrenschmidt *
64c75a6f4SBenjamin Herrenschmidt * This program is free software; you can redistribute it and/or modify it
74c75a6f4SBenjamin Herrenschmidt * under  the terms of  the GNU General Public License as published by the
84c75a6f4SBenjamin Herrenschmidt * Free Software Foundation;  either version 2 of the License, or (at your
94c75a6f4SBenjamin Herrenschmidt * option) any later version.
104c75a6f4SBenjamin Herrenschmidt */
114c75a6f4SBenjamin Herrenschmidt
124c75a6f4SBenjamin Herrenschmidt#include <asm/ppc_asm.h>
134c75a6f4SBenjamin Herrenschmidt#include <asm/processor.h>
144c75a6f4SBenjamin Herrenschmidt
154c75a6f4SBenjamin Herrenschmidt#define DCR_ACCESS_PROLOG(table) \
164c75a6f4SBenjamin Herrenschmidt	rlwinm  r3,r3,4,18,27;   \
174c75a6f4SBenjamin Herrenschmidt	lis     r5,table@h;      \
184c75a6f4SBenjamin Herrenschmidt	ori     r5,r5,table@l;   \
194c75a6f4SBenjamin Herrenschmidt	add     r3,r3,r5;        \
204c75a6f4SBenjamin Herrenschmidt	mtctr   r3;              \
214c75a6f4SBenjamin Herrenschmidt	bctr
224c75a6f4SBenjamin Herrenschmidt
234c75a6f4SBenjamin Herrenschmidt_GLOBAL(__mfdcr)
244c75a6f4SBenjamin Herrenschmidt	DCR_ACCESS_PROLOG(__mfdcr_table)
254c75a6f4SBenjamin Herrenschmidt
264c75a6f4SBenjamin Herrenschmidt_GLOBAL(__mtdcr)
274c75a6f4SBenjamin Herrenschmidt	DCR_ACCESS_PROLOG(__mtdcr_table)
284c75a6f4SBenjamin Herrenschmidt
294c75a6f4SBenjamin Herrenschmidt__mfdcr_table:
304c75a6f4SBenjamin Herrenschmidt	mfdcr  r3,0; blr
314c75a6f4SBenjamin Herrenschmidt__mtdcr_table:
324c75a6f4SBenjamin Herrenschmidt	mtdcr  0,r4; blr
334c75a6f4SBenjamin Herrenschmidt
344c75a6f4SBenjamin Herrenschmidtdcr     = 1
354c75a6f4SBenjamin Herrenschmidt        .rept   1023
364c75a6f4SBenjamin Herrenschmidt	mfdcr   r3,dcr; blr
374c75a6f4SBenjamin Herrenschmidt	mtdcr   dcr,r4; blr
384c75a6f4SBenjamin Herrenschmidt	dcr     = dcr + 1
394c75a6f4SBenjamin Herrenschmidt	.endr
40