 /* Part of  memory initialization adapted from ATI's code
  * Separate into a differen object (so that callers to this
  * function don't end up linking memory initialization code.
  */
/***
 *
 *  Trade secret of ATI Technologies Inc.
 *  Unpublished work, Copyright 2005 ATI Technologies Inc.
 *
 *  All rights reserved.  This notice is intended as a precaution against
 *  inadvertent publication and does not imply publication or any waiver
 *  of confidentiality.  The year included in the foregoing notice is the
 *  year of creation of the work.
 *
 ***/
#include <iostypes.h>
#include <iostypes.h>
#include <ios.h>
#include <iop.h>
#include <ioslibc.h>

#include <ahb_fdl_defs.h>
#include <mem_reg.h>
#include "sys_int.h"
#include <io_reg.h>
#include <sys.h>
/*
 * DIStraps
 *
 * Return the value of the DI straps register
 * should only be called in normal non-DEBUG mode
 * because of potential race condition with PPC and accessing DI registers
 */
u32
DIStraps()
{
    u32 aipprot_reg;
    u32 val;

    aipprot_reg = *((u32 *)(ACR_PROT_REGS_BASE + AIPPROT_OFFSET));
    val = aipprot_reg;

    AIPPROT_SET_ENAHBIOPI(val, 1);
    *((u32 *)(ACR_PROT_REGS_BASE + AIPPROT_OFFSET)) = val;
    val = *((u32 *)(ACR_PROT_REGS_BASE + AIPPROT_OFFSET));
 
    val = *((u32 *)(PHYS_TO_PROTECTED(AIP_DI_BASE + (DI_CONFIG_IDX<<2))));

    *((u32 *)(ACR_PROT_REGS_BASE + AIPPROT_OFFSET)) = aipprot_reg;

    return val;
}
