from SimpleMemory import SimpleMemory
from Gic import *
-class AmbaDevice(BasicPioDevice):
- type = 'AmbaDevice'
+class AmbaPioDevice(BasicPioDevice):
+ type = 'AmbaPioDevice'
abstract = True
cxx_header = "dev/arm/amba_device.hh"
amba_id = Param.UInt32("ID of AMBA device for kernel detection")
-class AmbaIntDevice(AmbaDevice):
+class AmbaIntDevice(AmbaPioDevice):
type = 'AmbaIntDevice'
abstract = True
cxx_header = "dev/arm/amba_device.hh"
proc_id1 = Param.UInt32(0x0C000222, "Processor ID, SYS_PROCID1")
idreg = Param.UInt32(0x00000000, "ID Register, SYS_ID")
-class AmbaFake(AmbaDevice):
+class AmbaFake(AmbaPioDevice):
type = 'AmbaFake'
cxx_header = "dev/arm/amba_fake.hh"
ignore_access = Param.Bool(False, "Ignore reads/writes to this device, (e.g. IsaFake + AMBA)")
end_on_eot = Param.Bool(False, "End the simulation when a EOT is received on the UART")
int_delay = Param.Latency("100ns", "Time between action and interrupt generation by UART")
-class Sp804(AmbaDevice):
+class Sp804(AmbaPioDevice):
type = 'Sp804'
cxx_header = "dev/arm/timer_sp804.hh"
gic = Param.BaseGic(Parent.any, "Gic to use for interrupting")
const uint64_t AmbaVendor = ULL(0xb105f00d00000000);
-AmbaDevice::AmbaDevice(const Params *p)
+AmbaPioDevice::AmbaPioDevice(const Params *p)
: BasicPioDevice(p), ambaId(AmbaVendor | p->amba_id)
{
}
AmbaIntDevice::AmbaIntDevice(const Params *p)
- : AmbaDevice(p), intNum(p->int_num), gic(p->gic), intDelay(p->int_delay)
+ : AmbaPioDevice(p), intNum(p->int_num), gic(p->gic), intDelay(p->int_delay)
{
}
{
}
-namespace AmbaDev {
bool
-readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
+AmbaDevice::readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
{
Addr daddr = pkt->getAddr() - pio_addr;
if (daddr < AMBA_PER_ID0 || daddr > AMBA_CEL_ID3)
int byte = (daddr - AMBA_PER_ID0) << 1;
// Too noisy right now
- DPRINTF(AMBA, "Returning %#x for offset %#x(%d)\n", (amba_id >> byte) & 0xFF,
+ DPRINTF(AMBA, "Returning %#x for offset %#x(%d)\n",
+ (amba_id >> byte) & 0xFF,
pkt->getAddr() - pio_addr, byte);
assert(pkt->getSize() == 4);
pkt->set<uint32_t>((amba_id >> byte) & 0xFF);
return true;
}
-
-} // namespace AmbaDev
#include "dev/io_device.hh"
#include "mem/packet.hh"
#include "mem/packet_access.hh"
-#include "params/AmbaDevice.hh"
+#include "params/AmbaPioDevice.hh"
#include "params/AmbaDmaDevice.hh"
#include "params/AmbaIntDevice.hh"
-namespace AmbaDev {
-const int AMBA_PER_ID0 = 0xFE0;
-const int AMBA_PER_ID1 = 0xFE4;
-const int AMBA_PER_ID2 = 0xFE8;
-const int AMBA_PER_ID3 = 0xFEC;
-const int AMBA_CEL_ID0 = 0xFF0;
-const int AMBA_CEL_ID1 = 0xFF4;
-const int AMBA_CEL_ID2 = 0xFF8;
-const int AMBA_CEL_ID3 = 0xFFC;
+class AmbaDevice
+{
+ protected:
+ static const int AMBA_PER_ID0 = 0xFE0;
+ static const int AMBA_PER_ID1 = 0xFE4;
+ static const int AMBA_PER_ID2 = 0xFE8;
+ static const int AMBA_PER_ID3 = 0xFEC;
+ static const int AMBA_CEL_ID0 = 0xFF0;
+ static const int AMBA_CEL_ID1 = 0xFF4;
+ static const int AMBA_CEL_ID2 = 0xFF8;
+ static const int AMBA_CEL_ID3 = 0xFFC;
+
+ bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr);
+};
-bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr);
-}
-class AmbaDevice : public BasicPioDevice
+class AmbaPioDevice : public BasicPioDevice, public AmbaDevice
{
protected:
uint64_t ambaId;
public:
- typedef AmbaDeviceParams Params;
- AmbaDevice(const Params *p);
+ typedef AmbaPioDeviceParams Params;
+ AmbaPioDevice(const Params *p);
};
-class AmbaIntDevice : public AmbaDevice
+class AmbaIntDevice : public AmbaPioDevice
{
protected:
int intNum;
AmbaIntDevice(const Params *p);
};
-class AmbaDmaDevice : public DmaDevice
+class AmbaDmaDevice : public DmaDevice, public AmbaDevice
{
protected:
uint64_t ambaId;
#include "mem/packet.hh"
#include "mem/packet_access.hh"
-using namespace AmbaDev;
-
AmbaFake::AmbaFake(const Params *p)
- : AmbaDevice(p)
+ : AmbaPioDevice(p)
{
pioSize = 0xfff;
}
#include "dev/arm/amba_device.hh"
#include "params/AmbaFake.hh"
-class AmbaFake : public AmbaDevice
+class AmbaFake : public AmbaPioDevice
{
public:
typedef AmbaFakeParams Params;
DPRINTF(Pl050, "Read Interrupts: %#x\n", (uint32_t)interrupts);
break;
default:
- if (AmbaDev::readId(pkt, ambaId, pioAddr)) {
+ if (readId(pkt, ambaId, pioAddr)) {
// Hack for variable size accesses
data = pkt->get<uint32_t>();
break;
data = maskInt;
break;
default:
- if (AmbaDev::readId(pkt, AMBA_ID, pioAddr)) {
+ if (readId(pkt, AMBA_ID, pioAddr)) {
// Hack for variable size accesses
data = pkt->get<uint32_t>();
break;
#include "base/bitfield.hh"
#include "base/bitunion.hh"
+#include "dev/arm/amba_device.hh"
#include "dev/io_device.hh"
#include "dev/uart.hh"
#include "params/Pl011.hh"
class BaseGic;
-class Pl011 : public Uart
+class Pl011 : public Uart, public AmbaDevice
{
protected:
static const uint64_t AMBA_ID = ULL(0xb105f00d00341011);
// we open up the entire namespace std
using std::vector;
-using namespace AmbaDev;
-
// initialize clcd registers
Pl111::Pl111(const Params *p)
: AmbaDmaDevice(p), lcdTiming0(0), lcdTiming1(0), lcdTiming2(0),
data = clcdCrsrMis;
break;
default:
- if (AmbaDev::readId(pkt, AMBA_ID, pioAddr)) {
+ if (readId(pkt, AMBA_ID, pioAddr)) {
// Hack for variable size accesses
data = pkt->get<uint32_t>();
break;
#include "mem/packet.hh"
#include "mem/packet_access.hh"
-using namespace AmbaDev;
-
PL031::PL031(Params *p)
: AmbaIntDevice(p), timeVal(mkutctime(&p->time)), lastWrittenTick(0),
loadVal(0), matchVal(0), rawInt(false), maskInt(false),
data = pendingInt;
break;
default:
- if (AmbaDev::readId(pkt, ambaId, pioAddr)) {
+ if (readId(pkt, ambaId, pioAddr)) {
// Hack for variable sized access
data = pkt->get<uint32_t>();
break;
}
break;
default:
- if (AmbaDev::readId(pkt, ambaId, pioAddr))
+ if (readId(pkt, ambaId, pioAddr))
break;
panic("Tried to read PL031 at offset %#x that doesn't exist\n", daddr);
break;
#include "mem/packet.hh"
#include "mem/packet_access.hh"
-using namespace AmbaDev;
-
Sp804::Sp804(Params *p)
- : AmbaDevice(p), gic(p->gic), timer0(name() + ".timer0", this, p->int_num0, p->clock0),
+ : AmbaPioDevice(p), gic(p->gic), timer0(name() + ".timer0", this, p->int_num0, p->clock0),
timer1(name() + ".timer1", this, p->int_num1, p->clock1)
{
pioSize = 0xfff;
class BaseGic;
-class Sp804 : public AmbaDevice
+class Sp804 : public AmbaPioDevice
{
protected:
class Timer