changeset d3e613312953 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=d3e613312953
description:
ARM: Implement a CLCD Frame buffer
diffstat:
src/dev/arm/RealView.py | 21 +-
src/dev/arm/SConscript | 2 +
src/dev/arm/amba_device.cc | 9 +-
src/dev/arm/amba_device.hh | 14 +-
src/dev/arm/pl111.cc | 653 +++++++++++++++++++++++++++++++++++++++++++++
src/dev/arm/pl111.hh | 368 +++++++++++++++++++++++++
6 files changed, 1056 insertions(+), 11 deletions(-)
diffs (truncated from 1212 to 300 lines):
diff -r 08e1e28a062a -r d3e613312953 src/dev/arm/RealView.py
--- a/src/dev/arm/RealView.py Mon Nov 15 14:04:03 2010 -0600
+++ b/src/dev/arm/RealView.py Mon Nov 15 14:04:03 2010 -0600
@@ -54,6 +54,10 @@
class AmbaDmaDevice(DmaDevice):
type = 'AmbaDmaDevice'
abstract = True
+ pio_addr = Param.Addr("Address for AMBA slave interface")
+ pio_latency = Param.Latency("10ns", "Time between action and write/read
result by AMBA DMA Device")
+ gic = Param.Gic(Parent.any, "Gic to use for interrupting")
+ int_num = Param.UInt32("Interrupt number that connects to GIC")
amba_id = Param.UInt32("ID of AMBA device for kernel detection")
class RealViewCtrl(BasicPioDevice):
@@ -89,16 +93,25 @@
clock1 = Param.Clock('1MHz', "Clock speed of the input")
amba_id = 0x00141804
+class Pl111(AmbaDmaDevice):
+ type = 'Pl111'
+ clock = Param.Clock('24MHz', "Clock speed of the input")
+ amba_id = 0x00141111
+
class RealView(Platform):
type = 'RealView'
system = Param.System(Parent.any, "system")
+# Reference for memory map and interrupt number
+# RealView Platform Baseboard Explore for Cortex-A9 User Guide(ARM DUI 0440A)
+# Chapter 4: Programmer's Reference
class RealViewPBX(RealView):
uart = Pl011(pio_addr=0x10009000, int_num=44)
realview_io = RealViewCtrl(pio_addr=0x10000000)
gic = Gic()
timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000)
timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000)
+ clcd = Pl111(pio_addr=0x10020000, int_num=55)
l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff)
flash_fake = IsaFake(pio_addr=0x40000000, pio_size=0x4000000)
@@ -107,7 +120,6 @@
uart2_fake = AmbaFake(pio_addr=0x1000b000)
uart3_fake = AmbaFake(pio_addr=0x1000c000)
smc_fake = AmbaFake(pio_addr=0x100e1000)
- clcd_fake = AmbaFake(pio_addr=0x10020000)
sp810_fake = AmbaFake(pio_addr=0x10001000, ignore_access=True)
watchdog_fake = AmbaFake(pio_addr=0x10010000)
gpio0_fake = AmbaFake(pio_addr=0x10013000)
@@ -136,12 +148,12 @@
self.realview_io.pio = bus.port
self.timer0.pio = bus.port
self.timer1.pio = bus.port
+ self.clcd.pio = bus.port
self.dmac_fake.pio = bus.port
self.uart1_fake.pio = bus.port
self.uart2_fake.pio = bus.port
self.uart3_fake.pio = bus.port
self.smc_fake.pio = bus.port
- self.clcd_fake.pio = bus.port
self.sp810_fake.pio = bus.port
self.watchdog_fake.pio = bus.port
self.gpio0_fake.pio = bus.port
@@ -156,12 +168,14 @@
self.rtc_fake.pio = bus.port
self.flash_fake.pio = bus.port
+# Interrupt numbers are wrong here
class RealViewEB(RealView):
uart = Pl011(pio_addr=0x10009000, int_num=44)
realview_io = RealViewCtrl(pio_addr=0x10000000)
gic = Gic(dist_addr=0x10041000, cpu_addr=0x10040000)
timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000)
timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000)
+ clcd = Pl111(pio_addr=0x10020000, int_num=55)
l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff,
warn_access="1")
dmac_fake = AmbaFake(pio_addr=0x10030000)
@@ -169,7 +183,6 @@
uart2_fake = AmbaFake(pio_addr=0x1000b000)
uart3_fake = AmbaFake(pio_addr=0x1000c000)
smc_fake = AmbaFake(pio_addr=0x100e1000)
- clcd_fake = AmbaFake(pio_addr=0x10020000)
sp810_fake = AmbaFake(pio_addr=0x10001000, ignore_access=True)
watchdog_fake = AmbaFake(pio_addr=0x10010000)
gpio0_fake = AmbaFake(pio_addr=0x10013000)
@@ -198,12 +211,12 @@
self.realview_io.pio = bus.port
self.timer0.pio = bus.port
self.timer1.pio = bus.port
+ self.clcd.pio = bus.port
self.dmac_fake.pio = bus.port
self.uart1_fake.pio = bus.port
self.uart2_fake.pio = bus.port
self.uart3_fake.pio = bus.port
self.smc_fake.pio = bus.port
- self.clcd_fake.pio = bus.port
self.sp810_fake.pio = bus.port
self.watchdog_fake.pio = bus.port
self.gpio0_fake.pio = bus.port
diff -r 08e1e28a062a -r d3e613312953 src/dev/arm/SConscript
--- a/src/dev/arm/SConscript Mon Nov 15 14:04:03 2010 -0600
+++ b/src/dev/arm/SConscript Mon Nov 15 14:04:03 2010 -0600
@@ -46,9 +46,11 @@
Source('amba_fake.cc')
Source('gic.cc')
Source('pl011.cc')
+ Source('pl111.cc')
Source('timer_sp804.cc')
Source('rv_ctrl.cc')
Source('realview.cc')
TraceFlag('AMBA')
+ TraceFlag('PL111')
TraceFlag('GIC')
diff -r 08e1e28a062a -r d3e613312953 src/dev/arm/amba_device.cc
--- a/src/dev/arm/amba_device.cc Mon Nov 15 14:04:03 2010 -0600
+++ b/src/dev/arm/amba_device.cc Mon Nov 15 14:04:03 2010 -0600
@@ -42,20 +42,23 @@
#include "base/trace.hh"
#include "dev/arm/amba_fake.hh"
+#include "dev/arm/amba_device.hh"
#include "mem/packet.hh"
#include "mem/packet_access.hh"
+const uint64_t AmbaVendor = ULL(0xb105f00d00000000);
AmbaDevice::AmbaDevice(const Params *p)
- : BasicPioDevice(p), ambaId(ULL(0xb105f00d00000000) | p->amba_id)
+ : BasicPioDevice(p), ambaId(AmbaVendor | p->amba_id)
{
}
AmbaDmaDevice::AmbaDmaDevice(const Params *p)
- : DmaDevice(p), ambaId(ULL(0xb105f00d00000000) | p->amba_id)
+ : DmaDevice(p), ambaId(AmbaVendor | p->amba_id),
+ pioAddr(p->pio_addr), pioSize(0),
+ pioDelay(p->pio_latency),intNum(p->int_num), gic(p->gic)
{
}
-
namespace AmbaDev {
bool
readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
diff -r 08e1e28a062a -r d3e613312953 src/dev/arm/amba_device.hh
--- a/src/dev/arm/amba_device.hh Mon Nov 15 14:04:03 2010 -0600
+++ b/src/dev/arm/amba_device.hh Mon Nov 15 14:04:03 2010 -0600
@@ -46,13 +46,14 @@
* Implementer ID calls.
*/
-#ifndef __DEV_ARM_AMBA_DEVICE_H__
-#define __DEV_ARM_AMBA_DEVICE_H__
+#ifndef __DEV_ARM_AMBA_DEVICE_HH__
+#define __DEV_ARM_AMBA_DEVICE_HH__
#include "base/range.hh"
+#include "dev/io_device.hh"
+#include "dev/arm/gic.hh"
#include "mem/packet.hh"
#include "mem/packet_access.hh"
-#include "dev/io_device.hh"
#include "params/AmbaDevice.hh"
#include "params/AmbaDmaDevice.hh"
@@ -84,6 +85,11 @@
{
protected:
uint64_t ambaId;
+ Addr pioAddr;
+ Addr pioSize;
+ Tick pioDelay;
+ int intNum;
+ Gic *gic;
public:
typedef AmbaDmaDeviceParams Params;
@@ -91,4 +97,4 @@
};
-#endif //__DEV_ARM_AMBA_DEVICE_H__
+#endif //__DEV_ARM_AMBA_DEVICE_HH__
diff -r 08e1e28a062a -r d3e613312953 src/dev/arm/pl111.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dev/arm/pl111.cc Mon Nov 15 14:04:03 2010 -0600
@@ -0,0 +1,653 @@
+/*
+ * Copyright (c) 2010 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: William Wang
+ */
+
+#include "base/trace.hh"
+#include "dev/arm/amba_device.hh"
+#include "dev/arm/gic.hh"
+#include "dev/arm/pl111.hh"
+#include "mem/packet.hh"
+#include "mem/packet_access.hh"
+
+using namespace AmbaDev;
+
+// initialize clcd registers
+Pl111::Pl111(const Params *p)
+ : AmbaDmaDevice(p), lcdTiming0(0), lcdTiming1(0), lcdTiming2(0),
+ lcdTiming3(0), lcdUpbase(0), lcdLpbase(0), lcdControl(0), lcdImsc(0),
+ lcdRis(0), lcdMis(0), lcdIcr(0), lcdUpcurr(0), lcdLpcurr(0),
+ clcdCrsrCtrl(0), clcdCrsrConfig(0), clcdCrsrPalette0(0),
+ clcdCrsrPalette1(0), clcdCrsrXY(0), clcdCrsrClip(0), clcdCrsrImsc(0),
+ clcdCrsrIcr(0), clcdCrsrRis(0), clcdCrsrMis(0), clock(p->clock),
+ height(0), width(0), startTime(0), startAddr(0), maxAddr(0), curAddr(0),
+ waterMark(0), dmaPendingNum(0), readEvent(this), fillFifoEvent(this),
+ dmaDoneEvent(maxOutstandingDma, this), intEvent(this)
+{
+ pioSize = 0xFFFF;
+
+ memset(lcdPalette, 0, sizeof(lcdPalette));
+ memset(cursorImage, 0, sizeof(cursorImage));
+ memset(dmaBuffer, 0, sizeof(dmaBuffer));
+ memset(frameBuffer, 0, sizeof(frameBuffer));
+}
+
+// read registers and frame buffer
+Tick
+Pl111::read(PacketPtr pkt)
+{
+ // use a temporary data since the LCD registers are read/written with
+ // different size operations
+
+ uint32_t data = 0;
+
+ if ((pkt->getAddr()& 0xffff0000) == pioAddr) {
+
+ assert(pkt->getAddr() >= pioAddr &&
+ pkt->getAddr() < pioAddr + pioSize);
+
+ Addr daddr = pkt->getAddr()&0xFFFF;
+ pkt->allocate();
+
+ DPRINTF(PL111, " read register %#x size=%d\n", daddr, pkt->getSize());
+
+ switch (daddr) {
+ case LcdTiming0:
+ data = lcdTiming0;
+ break;
+ case LcdTiming1:
+ data = lcdTiming1;
+ break;
+ case LcdTiming2:
+ data = lcdTiming2;
+ break;
+ case LcdTiming3:
+ data = lcdTiming3;
+ break;
+ case LcdUpBase:
+ data = lcdUpbase;
+ break;
+ case LcdLpBase:
+ data = lcdLpbase;
+ break;
+ case LcdControl:
+ data = lcdControl;
+ break;
+ case LcdImsc:
+ warn("LCD interrupt set/clear function not supported\n");
+ data = lcdImsc;
+ break;
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev