{
Addr ptbr = xc->regs.ipr[AlphaISA::IPR_PALtemp20];
Addr paddr = 0;
- if (PC_PAL(vaddr)) {
- paddr = vaddr & ~ULL(1);
- } else {
+// if (PC_PAL(vaddr)) {
+// paddr = vaddr & ~ULL(1);
+// } else {
if (vaddr >= ALPHA_K0SEG_BASE && vaddr <= ALPHA_K0SEG_END) {
paddr = ALPHA_K0SEG_TO_PHYS(vaddr);
} else if (!ptbr) {
if (pte && entry_valid(entry))
paddr = PMAP_PTE_PA(entry) | (vaddr & PGOFSET);
}
- }
+// }
DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);
return true;
}
+bool
+SymbolTable::findNearestSymbol(Addr address, string &symbol) const
+{
+ ATable::const_iterator i = addrTable.lower_bound(address);
+
+ // check for PALCode
+ if (address & 0x1)
+ return false;
+
+ // first check for the end
+ if (i == addrTable.end())
+ i--;
+ else if (i == addrTable.begin() && (*i).first != address)
+ return false;
+ else if ((*i).first != address)
+ i--;
+
+ symbol = (*i).second;
+
+ if (address != (*i).first)
+ symbol += csprintf("+%d", address - (*i).first);
+
+ return true;
+}
+
bool
SymbolTable::findSymbol(Addr address, string &symbol) const
{
#ifndef __SYMTAB_HH__
#define __SYMTAB_HH__
-#include "base/hashmap.hh"
+#include <map>
#include "targetarch/isa_traits.hh" // for Addr
class SymbolTable
{
private:
- typedef m5::hash_map<Addr, std::string> ATable;
- typedef m5::hash_map<std::string, Addr> STable;
+ typedef std::map<Addr, std::string> ATable;
+ typedef std::map<std::string, Addr> STable;
ATable addrTable;
STable symbolTable;
bool insert(Addr address, std::string symbol);
bool load(const std::string &file);
+ bool findNearestSymbol(Addr address, std::string &symbol) const;
bool findSymbol(Addr address, std::string &symbol) const;
bool findAddress(const std::string &symbol, Addr &address) const;
std::string str;
- if(debugSymbolTable->findSymbol(PC, str))
+ if (debugSymbolTable->findNearestSymbol(PC, str))
outs << "@" << setw(17) << str << " : ";
- else if(debugSymbolTable->findSymbol(PC - 4, str))
- outs << "@" << setw(15) << str << "+4 : ";
- else if(debugSymbolTable->findSymbol(PC - 8, str))
- outs << "@" << setw(15) << str << "+8 : ";
else
outs << "0x" << hex << PC << " : ";
IdeDisk::IdeDisk(const string &name, DiskImage *img, PhysicalMemory *phys,
int id, int delay)
- : SimObject(name), ctrl(NULL), image(img), physmem(phys), dmaTransferEvent(this),
- dmaReadWaitEvent(this), dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
+ : SimObject(name), ctrl(NULL), image(img), physmem(phys),
+ dmaTransferEvent(this), dmaReadWaitEvent(this),
+ dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
dmaReadEvent(this), dmaWriteEvent(this)
{
diskDelay = (delay * ticksPerSecond / 1000) / image->size();
}
// copy the data to memory
- Addr dmaAddr =
- ctrl->tsunami->pchip->translatePciToDma(curPrd.getBaseAddr());
+ Addr dmaAddr = ctrl->tsunami->pchip->
+ translatePciToDma(curPrd.getBaseAddr());
+
memcpy(physmem->dma_addr(dmaAddr, curPrd.getByteCount()),
(void *)dataBuffer, curPrd.getByteCount());
cmdReg.status |= STATUS_DRQ_BIT;
// put the first two bytes into the data register
- memcpy((void *)&cmdReg.data0, (void *)dataBuffer, sizeof(uint16_t));
+ memcpy((void *)&cmdReg.data0, (void *)dataBuffer,
+ sizeof(uint16_t));
+
// copy the data into the data buffer
if (curCommand == WIN_IDENTIFY)
memcpy((void *)dataBuffer, (void *)&driveID,
break;
case Transfer_Data_Out:
- if (action == ACT_DATA_WRITE_BYTE || action == ACT_DATA_WRITE_SHORT) {
+ if (action == ACT_DATA_WRITE_BYTE ||
+ action == ACT_DATA_WRITE_SHORT) {
+
if (action == ACT_DATA_READ_BYTE) {
panic("DEBUG: WRITING DATA ONE BYTE AT A TIME!\n");
} else {
CREATE_SIM_OBJECT(IdeDisk)
{
- return new IdeDisk(getInstanceName(), image, physmem, driveID, disk_delay);
+ return new IdeDisk(getInstanceName(), image, physmem, driveID,
+ disk_delay);
}
REGISTER_SIM_OBJECT("IdeDisk", IdeDisk)
#define DMA_BACKOFF_PERIOD 200
-#define MAX_DMA_SIZE (16384)
-#define MAX_MULTSECT (32)
+#define MAX_DMA_SIZE (131072) // 256 * SectorSize (512)
+#define MAX_MULTSECT (128)
#define PRD_BASE_MASK 0xfffffffe
#define PRD_COUNT_MASK 0xfffe
#include "dev/tsunamireg.h"
#include "dev/tsunami.hh"
#include "mem/functional_mem/memory_control.hh"
+#include "mem/functional_mem/physical_memory.hh"
#include "sim/builder.hh"
#include "sim/system.hh"
return No_Fault;
}
+#define DMA_ADDR_MASK ULL(0x3ffffffff)
+
Addr
TsunamiPChip::translatePciToDma(Addr busAddr)
{
// compare the address to the window base registers
+ uint64_t tbaMask = 0;
+ uint64_t baMask = 0;
+
uint64_t windowMask = 0;
uint64_t windowBase = 0;
+
+ uint64_t pteEntry = 0;
+
+ Addr pteAddr;
Addr dmaAddr;
for (int i = 0; i < 4; i++) {
windowMask = ~wsm[i] & (0x7ff << 20);
if ((busAddr & windowMask) == (windowBase & windowMask)) {
- windowMask = (wsm[i] & (0x7ff << 20)) | 0xfffff;
- if (wsba[i] & 0x1) { // see if enabled
- if (wsba[i] & 0x2) // see if SG bit is set
- panic("PCI to system SG mapping not currently implemented!\n");
- else
- dmaAddr = (tba[i] & ~windowMask) | (busAddr & windowMask);
- return dmaAddr;
+ if (wsba[i] & 0x1) { // see if enabled
+ if (wsba[i] & 0x2) { // see if SG bit is set
+ /** @todo
+ This currently is faked by just doing a direct
+ read from memory, however, to be realistic, this
+ needs to actually do a bus transaction. The process
+ is explained in the tsunami documentation on page
+ 10-12 and basically munges the address to look up a
+ PTE from a table in memory and then uses that mapping
+ to create an address for the SG page
+ */
+
+ tbaMask = ~(((wsm[i] & (0x7ff << 20)) >> 10) | 0x3ff);
+ baMask = (wsm[i] & (0x7ff << 20)) | (0x7f << 13);
+ pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10);
+
+ memcpy((void *)&pteEntry,
+ tsunami->system->
+ physmem->dma_addr(pteAddr, sizeof(uint64_t)),
+ sizeof(uint64_t));
+
+ dmaAddr = ((pteEntry & ~0x1) << 12) | (busAddr & 0xfff);
+
+ } else {
+ baMask = (wsm[i] & (0x7ff << 20)) | 0xfffff;
+ tbaMask = ~baMask;
+ dmaAddr = (tba[i] & tbaMask) | (busAddr & baMask);
+ }
+
+ return (dmaAddr & DMA_ADDR_MASK);
}
}
}
RemoteGDB *rgdb = new RemoteGDB(this, xc);
GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex);
gdbl->listen();
+ gdbl->accept();
if (remoteGDB.size() <= xcIndex) {
remoteGDB.resize(xcIndex+1);