/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */
#include <iostypes.h>
#include <iop.h>
#include <ios.h>
#include <ioslibc.h>
#include <apputils.h>
#include <elf.h>
#include <sys.h>
#include "minimon0.h"
#ifdef ENABLE_PPCBOOT_COMMANDS
#include <hw.h>
#include <ahb_fdl_defs.h>

/* By default, PPC has access to everything on boot. This just
 * verifies some regs, we are particular about.
 */
static void
enablePPCAccessCtrls(void)
{
    u32 reg;
    busWrt32(ACR_PROT_REGS_BASE + ACRBUSPROT_OFFSET, 0x80000dff);
    busWrt32(ACR_PROT_REGS_BASE + AIPPROT_OFFSET, 0x1e);
    busWrt32(ACR_PROT_REGS_BASE + AIPIOCTRL_OFFSET, 0x1c);
    reg = busRd32(ACR_PROT_REGS_BASE + ACRSRNPROT_OFFSET);
    busWrt32(ACR_PROT_REGS_BASE + ACRSRNPROT_OFFSET, reg|0x1f);
}

static void
__initBootPPC(enum sysMode_e mode)
{
    enablePPCAccessCtrls();
    setupEXIRegBoot(mode);
}

int 
initBootPPC(char *args, char *d)
{
    __initBootPPC(enhancedmode);
    return 0;
}

int 
initCompatBootPPC(char *args, char *d)
{
    __initBootPPC(compatmode);
    return 0;
}

int
m_bootPPC(char *argc, char *d)
{
    bootPPC();
    return 0;
}
#endif /* ENABLE_PPCBOOT_COMMANDS */
