simos_interface.c 2.29 KB
/*
 * Copyright (C) 1996-1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */

/*
    SimOS cache <-> Chal2 bus-interface definitions
       by Stephen Gold, 6 May 1997
*/

#include "sim.h"
#include "machine_params.h"
#include "chal2/simos_interface.h"

#define DUMMY
static int linesize = 64;

#ifdef DUMMY
void Chal2CycleAdvance (void)
{
}

Result
Chal2Request (int cpu_id, int request_type, PA requested_paddr,
   int request_id, PA replaced_paddr, int writeback_flag,
   byte *replaced_data_ptr)
{
  return SUCCESS;
}
#endif /* DUMMY */

void
Chal2Completion (unsigned cpu_id, int request_id, int new_cache_state,
   void *returned_data_ptr)
{
  CacheCmdDone((int)cpu_id, request_id, new_cache_state,
    MEMSYS_STATUS_SUCCESS, 0x0, (byte *)returned_data_ptr);
}

bool
Chal2Flush (unsigned cpu_id, PA paddr, void *flushback_data_ptr)
{
  return CacheWriteback ((int)cpu_id, paddr, linesize,
    (byte *)flushback_data_ptr);
}

bool
Chal2Invalidate (unsigned cpu_id, PA paddr, bool *flushback_indicator,
  void *flushback_data_ptr)
{
  return CacheExtract ((int)cpu_id, paddr, linesize,
   (int *)flushback_indicator, (byte *)flushback_data_ptr);
}

void
Chal2Unimplemented (void)
{
  Sim_Error ("unimplemented chal2 function");
}

void
Chal2SetRemap (int cpunum, PA mask)
{
  Sim_Error ("unimplemented chal2 function: SetRemap");
}

void
Chal2ControlRemap (int cpunum, int isEnabled)
{
  Sim_Error ("unimplemented chal2 function: ControlRemap");
}

PA
Chal2GetNodeAddress (int cpu_id)
{
  return (cpu_id * MEM_SIZE(0))/NUM_CPUS(0);
}

/*****************************************************************
 * MemsysInit for Chal2
 *****************************************************************/
void
Chal2MemInit (void)
{
  memsysVec.type = CHAL2;
  memsysVec.NoMemoryDelay = FALSE;
  memsysVec.InMagicCR = FALSE;

  memsysVec.MemsysCmd = Chal2Request;
  memsysVec.MemsysDumpStats = Chal2Unimplemented;
  memsysVec.MemsysDone = Chal2Unimplemented;
  memsysVec.MemsysStatus = Chal2Unimplemented;
  memsysVec.MemsysDrain = Chal2Unimplemented;
  memsysVec.MemsysSetRemap = Chal2SetRemap;
  memsysVec.MemsysControlRemap = Chal2ControlRemap;
  memsysVec.MemsysGetNodeAddress = Chal2GetNodeAddress;
} /* Chal2MemInit () */