Whole mess'o'changes.. see individual files

arch/alpha/vtophys.cc:
    Removed buggy code that tries to fix PAL addresses (may cause problems
    while trying to debug in PAL code, but that should do this fix outside
    of vtophys)
base/loader/symtab.cc:
base/loader/symtab.hh:
cpu/exetrace.cc:
    Changed InstExec traces to always print a symbol name
dev/ide_ctrl.cc:
dev/ide_disk.cc:
    Tabs
dev/ide_disk.hh:
    Change buffer size
dev/tsunami_pchip.cc:
    Fix translatePciToDma to support scatter gather mapping
kern/linux/linux_system.cc:
    Force simulator to wait until remote debugger attaches (should be removed
    or turned on/off with a flag)

--HG--
extra : convert_revision : 1d08aebe3f448c87a963dd613de3e2e0cff0d48d
This commit is contained in:
Andrew Schultz 2004-05-06 15:21:07 -04:00
parent 8538ffdb36
commit 4a5dcc37bf
8 changed files with 90 additions and 27 deletions

View file

@ -96,9 +96,9 @@ vtophys(ExecContext *xc, Addr vaddr)
{
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) {
@ -109,7 +109,7 @@ vtophys(ExecContext *xc, Addr vaddr)
if (pte && entry_valid(entry))
paddr = PMAP_PTE_PA(entry) | (vaddr & PGOFSET);
}
}
// }
DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);

View file

@ -94,6 +94,31 @@ SymbolTable::load(const string &filename)
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
{

View file

@ -29,14 +29,14 @@
#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;
@ -49,6 +49,7 @@ class 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;

View file

@ -67,12 +67,8 @@ Trace::InstRecord::dump(ostream &outs)
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 << " : ";

View file

@ -55,8 +55,9 @@ using namespace std;
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();
@ -379,8 +380,9 @@ IdeDisk::dmaWriteDone()
}
// 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());
@ -665,7 +667,9 @@ IdeDisk::updateState(DevAction_t action)
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,
@ -753,7 +757,9 @@ IdeDisk::updateState(DevAction_t action)
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 {
@ -863,7 +869,8 @@ END_INIT_SIM_OBJECT_PARAMS(IdeDisk)
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)

View file

@ -40,8 +40,8 @@
#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

View file

@ -18,6 +18,7 @@
#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"
@ -217,12 +218,21 @@ TsunamiPChip::write(MemReqPtr &req, const uint8_t *data)
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++) {
@ -230,15 +240,38 @@ TsunamiPChip::translatePciToDma(Addr busAddr)
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);
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
*/
return dmaAddr;
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);
}
}
}

View file

@ -653,6 +653,7 @@ LinuxSystem::registerExecContext(ExecContext *xc)
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);