* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: ioram.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
// SAM IOMem module. Built as a wrapper around Sparse Memory class.
#include "cpu_interface.h"
class IOMem
:public Module
{
// configurable parameters for the module
// physical address space to be mapped by IOMem
int iomemWrite(uint64_t addr
, uint64_t buf
, int size
);
int iomemRead(uint64_t addr
, uint64_t * buf
, int size
);
enum accessType
{ RW
, RO
, WO
};
enum fileType
{ BIN
, IMG
, ELF
, NONE
};
enum memType
{ SPARSE
, FLAT
};
enum cmdType
{ READ
, WRITE
, DIS
, SAVE
, DUMP
, UNKNWN
};
bool addrInvalid(uint64_t addr
);
bool getNum(const char * s
, uint64_t * val
);
bool numArgsOK(int argc
, char * args
[]);
void ui_write(char * args
[]);
void ui_read(char * args
[]);
void ui_dump(char * args
[]);
void ui_dis(char * args
[]);
void ui_save(char * args
[]);
void handle_ui(int argc
, char * argv
[]);
// handle load/stores from SAM for this module
int iomemHandler(uint32_t cpuid
,uint64_t paddr
, mmi_bool_t wr
, uint32_t size
, uint64_t* buf
, uint8_t bytemask
);
IOMem(const char *_modname
, const char *_instance_name
);
bool parse_arg(const char *);
void module_added(mmi_instance_t
, const char*){return; }
void module_deleted(mmi_instance_t
, const char*){return;}
void *get_interface(const char*){return 0;}
// callback function to steer load/stores to this module
int iomemLdSt(uint32_t cpuid
, void* obj
, uint64_t paddr
, mmi_bool_t wr
, uint32_t size
, uint64_t* buf
, uint8_t bytemask
);
int iomem_ui_cmd(void*, int argc
, char * argv
[]);
#endif // __SAM_IOMEM_H__