#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/machdep.h>
#include <dev/fdt/fdt_common.h>
#include <powerpc/mpc85xx/mpc85xx.h>
extern void dcache_enable(void);
extern void dcache_inval(void);
extern void icache_enable(void);
extern void icache_inval(void);
extern void l2cache_enable(void);
extern void l2cache_inval(void);
extern void bpred_enable(void);
void
booke_enable_l1_cache(void)
{
uint32_t csr;
csr = mfspr(SPR_L1CSR0);
if ((csr & L1CSR0_DCE) == 0) {
dcache_inval();
dcache_enable();
}
csr = mfspr(SPR_L1CSR0);
if ((boothowto & RB_VERBOSE) != 0 || (csr & L1CSR0_DCE) == 0)
printf("L1 D-cache %sabled\n",
(csr & L1CSR0_DCE) ? "en" : "dis");
csr = mfspr(SPR_L1CSR1);
if ((csr & L1CSR1_ICE) == 0) {
icache_inval();
icache_enable();
}
csr = mfspr(SPR_L1CSR1);
if ((boothowto & RB_VERBOSE) != 0 || (csr & L1CSR1_ICE) == 0)
printf("L1 I-cache %sabled\n",
(csr & L1CSR1_ICE) ? "en" : "dis");
}
void
booke_enable_l2_cache(void)
{
uint32_t csr;
if ((((mfpvr() >> 16) & 0xFFFF) == FSL_E500mc) ||
(((mfpvr() >> 16) & 0xFFFF) == FSL_E5500)) {
csr = mfspr(SPR_L2CSR0);
if (mfspr(SPR_L2CFG0) != 0 && (csr & L2CSR0_L2E) == 0) {
l2cache_inval();
l2cache_enable();
}
csr = mfspr(SPR_L2CSR0);
if ((boothowto & RB_VERBOSE) != 0 || (csr & L2CSR0_L2E) == 0)
printf("L2 cache %sabled\n",
(csr & L2CSR0_L2E) ? "en" : "dis");
}
}
void
booke_enable_bpred(void)
{
uint32_t csr;
bpred_enable();
csr = mfspr(SPR_BUCSR);
if ((boothowto & RB_VERBOSE) != 0 || (csr & BUCSR_BPEN) == 0)
printf("Branch Predictor %sabled\n",
(csr & BUCSR_BPEN) ? "en" : "dis");
}
void
booke_disable_l2_cache(void)
{
}
int
cpu_machine_check(struct thread *td, struct trapframe *frame, int *ucode)
{
*ucode = BUS_OBJERR;
return (SIGBUS);
}