#ifndef PPCOPS_H
#define PPCOPS_H

/*
 * Special instructions we need to use.
 *
 * Copyright (c) 1999 TiVo Inc. All Rights Reserved.
 */

#define SPRN_EVPR	"982"
#define SPRN_EXIER	"66"
#define SPRN_EXISR	"64"
#define SPRN_TBHI	"0x3dc"
#define SPRN_TBLO	"0x3dd"
#define SPRN_PIT	"0x3db"
#define SPRN_TCR	"0x3da"
#define SPRN_TSR	"0x3d8"
#define SPRN_DBCR	"0x3f2"
#define SPRN_DBSR	"0x3f0"
#define SPRN_PID	"0x3b1"
#define SPRN_DEAR	"0x3d5"
#define SPRN_ESR	"0x3d4"
#define SPRN_ZPR	"0x3b0"
#define SPRN_DCWR	"0x3ba"
#define SPRN_IOCR	"0xa0"
#define SPRN_BEAR	"0x90"
#define SPRN_BESR	"0x91"
#define SPRN_DAC1	"0x3f6"
#define SPRN_IAC1	"0x3f4"
#define SPRN_CDBCR	"0x3d7"
#define SPRN_ICDBDR	"0x3d3"
#define SPRN_SPRG3	"0x113"

#ifdef CONFIG_4xx
#define SPRN_BR0	"0x80"
#define SPRN_BR1	"0x81"
#define SPRN_BR2	"0x82"
#define SPRN_BR3	"0x83"
#define SPRN_BR4	"0x84"
#define SPRN_BR5	"0x85"
#define SPRN_BR6	"0x86"
#define SPRN_BR7	"0x87"
#define SPRN_DCCR	"0x3fa"
#define SPRN_ICCR	"0x3fb"
#define SPRN_IAC2	"0x3f5"
#define SPRN_DAC2	"0x3f7"
#endif

#define mfspr(spr)	({unsigned int rval; asm volatile("mfspr %0," spr : "=r" (rval)); rval;})
#define mfdcr(spr)	({unsigned int rval; asm volatile("mfdcr %0," spr : "=r" (rval)); rval;})
#define mtspr(spr,v)	asm volatile("mtspr " spr ",%0" : : "r" (v))
#define mtdcr(spr,v)	asm volatile("mtdcr " spr ",%0" : : "r" (v))
#define mfmsr()		({unsigned int rval; asm volatile("mfmsr %0" : "=r" (rval)); rval;})
#define mtmsr(v)	asm volatile("mtmsr %0" : : "r" (v))

#endif
