summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dev/arm/RealView.py7
-rw-r--r--src/dev/arm/amba_device.cc21
-rw-r--r--src/dev/arm/amba_device.hh46
-rw-r--r--src/dev/arm/amba_fake.cc4
-rw-r--r--src/dev/arm/pl011.cc12
-rw-r--r--src/dev/arm/pl011.hh9
-rw-r--r--src/dev/arm/timer_sp804.cc6
7 files changed, 62 insertions, 43 deletions
diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py
index 27d1e6b45..0efaa73bb 100644
--- a/src/dev/arm/RealView.py
+++ b/src/dev/arm/RealView.py
@@ -41,7 +41,7 @@
from m5.params import *
from m5.proxy import *
-from Device import BasicPioDevice, PioDevice, IsaFake, BadAddr
+from Device import BasicPioDevice, PioDevice, IsaFake, BadAddr, DmaDevice
from Platform import Platform
from Terminal import Terminal
from Uart import Uart
@@ -51,6 +51,11 @@ class AmbaDevice(BasicPioDevice):
abstract = True
amba_id = Param.UInt32("ID of AMBA device for kernel detection")
+class AmbaDmaDevice(DmaDevice):
+ type = 'AmbaDmaDevice'
+ abstract = True
+ amba_id = Param.UInt32("ID of AMBA device for kernel detection")
+
class RealViewCtrl(BasicPioDevice):
type = 'RealViewCtrl'
proc_id = Param.UInt32(0x0C000000, "Platform ID")
diff --git a/src/dev/arm/amba_device.cc b/src/dev/arm/amba_device.cc
index 81c740aec..0acd7208a 100644
--- a/src/dev/arm/amba_device.cc
+++ b/src/dev/arm/amba_device.cc
@@ -50,22 +50,29 @@ AmbaDevice::AmbaDevice(const Params *p)
{
}
+AmbaDmaDevice::AmbaDmaDevice(const Params *p)
+ : DmaDevice(p), ambaId(ULL(0xb105f00d00000000) | p->amba_id)
+{
+}
+
+
+namespace AmbaDev {
bool
-AmbaDevice::readId(PacketPtr pkt)
+readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
{
- Addr daddr = pkt->getAddr() - pioAddr;
+ Addr daddr = pkt->getAddr() - pio_addr;
if (daddr < AMBA_PER_ID0 || daddr > AMBA_CEL_ID3)
return false;
pkt->allocate();
- daddr -= AMBA_PER_ID0;
- daddr <<= 1;
+ int byte = (daddr - AMBA_PER_ID0) << 1;
// Too noisy right now
- //DPRINTF(AMBA, "Returning %#x for offset %#x(%d)\n", (ambaId >> daddr) & 0xFF,
- // pkt->getAddr() - pioAddr, daddr);
+ 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>((ambaId >> daddr) & 0xFF);
+ pkt->set<uint32_t>((amba_id >> byte) & 0xFF);
return true;
}
+} // namespace AmbaDev
diff --git a/src/dev/arm/amba_device.hh b/src/dev/arm/amba_device.hh
index b2d7af043..679202c84 100644
--- a/src/dev/arm/amba_device.hh
+++ b/src/dev/arm/amba_device.hh
@@ -50,33 +50,45 @@
#define __DEV_ARM_AMBA_DEVICE_H__
#include "base/range.hh"
+#include "mem/packet.hh"
+#include "mem/packet_access.hh"
#include "dev/io_device.hh"
#include "params/AmbaDevice.hh"
+#include "params/AmbaDmaDevice.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;
+
+bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr);
+}
class AmbaDevice : public BasicPioDevice
{
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;
-
uint64_t ambaId;
public:
- typedef AmbaDeviceParams Params;
- const Params *
- params() const
- {
- return dynamic_cast<const Params *>(_params);
- }
+ typedef AmbaDeviceParams Params;
AmbaDevice(const Params *p);
+};
- bool readId(PacketPtr pkt);
+class AmbaDmaDevice : public DmaDevice
+{
+ protected:
+ uint64_t ambaId;
+
+ public:
+ typedef AmbaDmaDeviceParams Params;
+ AmbaDmaDevice(const Params *p);
};
-#endif //__DEV_ARM_AMBA_FAKE_H__
+
+#endif //__DEV_ARM_AMBA_DEVICE_H__
diff --git a/src/dev/arm/amba_fake.cc b/src/dev/arm/amba_fake.cc
index 25206c674..f2115048b 100644
--- a/src/dev/arm/amba_fake.cc
+++ b/src/dev/arm/amba_fake.cc
@@ -45,6 +45,8 @@
#include "mem/packet.hh"
#include "mem/packet_access.hh"
+using namespace AmbaDev;
+
AmbaFake::AmbaFake(const Params *p)
: AmbaDevice(p)
{
@@ -62,7 +64,7 @@ AmbaFake::read(PacketPtr pkt)
DPRINTF(AMBA, " read register %#x\n", daddr);
pkt->set<uint32_t>(0);
- if (!readId(pkt) && !params()->ignore_access)
+ if (!readId(pkt, ambaId, pioAddr) && !params()->ignore_access)
panic("Tried to read AmbaFake at offset %#x that doesn't exist\n", daddr);
pkt->makeAtomicResponse();
diff --git a/src/dev/arm/pl011.cc b/src/dev/arm/pl011.cc
index 2afc9977d..555636f04 100644
--- a/src/dev/arm/pl011.cc
+++ b/src/dev/arm/pl011.cc
@@ -41,6 +41,7 @@
*/
#include "base/trace.hh"
+#include "dev/arm/amba_device.hh"
#include "dev/arm/gic.hh"
#include "dev/arm/pl011.hh"
#include "dev/terminal.hh"
@@ -113,15 +114,12 @@ Pl011::read(PacketPtr pkt)
data = maskInt;
break;
default:
- if (daddr >= UART_PER_ID0 && daddr <= UART_CEL_ID3) {
- // AMBA ID information
- int byte;
- byte = (daddr - UART_PER_ID0) << 1;
- DPRINTF(AMBA, "--daddr=%#x shift=%d val=%#x\n", daddr, byte,
- (ULL(0xb105f00d00341011) >> byte) & 0xFF);
- data = (ULL(0xb105f00d00341011) >> byte) & 0xFF;
+ if (AmbaDev::readId(pkt, AMBA_ID, pioAddr)) {
+ // Hack for variable size accesses
+ data = pkt->get<uint32_t>();
break;
}
+
panic("Tried to read PL011 at offset %#x that doesn't exist\n", daddr);
break;
}
diff --git a/src/dev/arm/pl011.hh b/src/dev/arm/pl011.hh
index 63289fc38..ddfd8305b 100644
--- a/src/dev/arm/pl011.hh
+++ b/src/dev/arm/pl011.hh
@@ -58,6 +58,7 @@ class Gic;
class Pl011 : public Uart
{
protected:
+ static const uint64_t AMBA_ID = ULL(0xb105f00d00341011);
static const int UART_DR = 0x000;
static const int UART_FR = 0x018;
static const int UART_FR_CTS = 0x001;
@@ -72,14 +73,6 @@ class Pl011 : public Uart
static const int UART_RIS = 0x03C;
static const int UART_MIS = 0x040;
static const int UART_ICR = 0x044;
- static const int UART_PER_ID0 = 0xFE0;
- static const int UART_PER_ID1 = 0xFE4;
- static const int UART_PER_ID2 = 0xFE8;
- static const int UART_PER_ID3 = 0xFEC;
- static const int UART_CEL_ID0 = 0xFF0;
- static const int UART_CEL_ID1 = 0xFF4;
- static const int UART_CEL_ID2 = 0xFF8;
- static const int UART_CEL_ID3 = 0xFFC;
uint16_t control;
diff --git a/src/dev/arm/timer_sp804.cc b/src/dev/arm/timer_sp804.cc
index 6a6792f60..c662d35bb 100644
--- a/src/dev/arm/timer_sp804.cc
+++ b/src/dev/arm/timer_sp804.cc
@@ -44,6 +44,8 @@
#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),
timer1(name() + ".timer1", this, p->int_num1, p->clock1)
@@ -71,7 +73,7 @@ Sp804::read(PacketPtr pkt)
timer0.read(pkt, daddr);
else if ((daddr - Timer::Size) < Timer::Size)
timer1.read(pkt, daddr - Timer::Size);
- else if (!readId(pkt))
+ else if (!readId(pkt, ambaId, pioAddr))
panic("Tried to read SP804 at offset %#x that doesn't exist\n", daddr);
pkt->makeAtomicResponse();
return pioDelay;
@@ -127,7 +129,7 @@ Sp804::write(PacketPtr pkt)
timer0.write(pkt, daddr);
else if ((daddr - Timer::Size) < Timer::Size)
timer1.write(pkt, daddr - Timer::Size);
- else if (!readId(pkt))
+ else if (!readId(pkt, ambaId, pioAddr))
panic("Tried to write SP804 at offset %#x that doesn't exist\n", daddr);
pkt->makeAtomicResponse();
return pioDelay;