add L2x0/PL310 cache controller device
PATCH 7/9 add L2x0/PL310 cache controller device
From: Rob Herring <[email protected]>
This is just a dummy device for ARM L2 cache controllers.
--- Makefile.target | 2 +- hw/arm_l2x0.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletions(-) create mode 100644 hw/arm_l2x0.c
Makefile.target +0 -0
@@ -335,7 +335,7 @@ endif obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o
pl181.o pl190.o
obj-arm-y += versatile_pci.o
-obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o +obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o arm_l2x0.o
obj-arm-y += arm_mptimer.o
obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o
hw/arm_l2x0.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Quoted 6 lines · Mark Langsdorf
From: Rob Herring <[email protected]>
This is just a dummy device for ARM L2 cache controllers.
Signed-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
This is missing save/load support.
Quoted 15 lines
---
Makefile.target | 2 +-
hw/arm_l2x0.c | 109
+++++++++++++++++++++++++++++++++++++++++++++++++++++++2 files changed, 110 insertions(+), 1 deletions(-)create mode 100644
hw/arm_l2x0.cMakefile.target +0
-0@@ -335,7 +335,7 @@ endifobj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o obj-arm-y += versatile_pci.o
Makefile.target
Quoted 2 lines
Makefile.target +1
-1-obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o +obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o arm_l2x0.o
This puts this line beyond 80 chars, put the new .o on a different line (on the next one after arm_mptimer.o is fine).
Quoted 9 lines
obj-arm-y += arm_mptimer.o
obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.ohw/arm_l2x0.c new file +0
-0
hw/arm_l2x0.c line 8
Quoted 8 lines
hw/arm_l2x0.c new file +8
-0@@ -0,0 +1,109 @@ +/* +* ARM dummy L210, L220, PL310 cache controller. +* +* Copyright (c) 2006-2007 CodeSourcery. +* Copyright (c) 2010-2012 Calxeda +* Written by Rob Herring +* +* This code is licenced under the GPL.
If this file contains code which is Copyright CodeSourcery there should probably be a Signed-off-by: from somebody at CodeSourcery.
I think it's nicer to explicitly say which GPL versions you mean ("v2 or later" being the usual).
Quoted 16 lines
hw/arm_l2x0.c new file +16
-0+*/ + +#include "sysbus.h" + +typedef struct l2x0_state { + SysBusDevice busdev; + MemoryRegion iomem; + uint32_t ctrl; + uint32_t aux_ctrl; + uint32_t data_ctrl; + uint32_t tag_ctrl; + uint32_t filter_start; + uint32_t filter_end; +}l2x0_state ; + +static uint64_t l2x0_priv_read(void *opaque, target_phys_addr_t offset,
Quoted 1 line
unsigned size)
This is an overly long line, and you've sent the email through something that wraps long lines, which means the patch doesn't apply.
Quoted 4 lines
+{
+ l2x0_state *s = (l2x0_state*)opaque;
+ offset &=0xfff;
+ if (offset == 0)
scripts/checkpatch.pl would have warned you about all the missing braces here. switch() statements are the more usual style in qemu for register read/write functions, incidentally.
Quoted 1 line
+ return
0x410000c6;
So this is an L2C-310 r3p1. Any particular reason for picking that? (r3p2 is the most recent one with a manual on infocenter).
(Also it would be nice to say this rather than requiring the reader to go digging in manuals.)
Quoted 16 lines
+ else if (offset ==
0x4)
+ return0x19080800;
+ else if (offset ==0x100)
+ returns->ctrl;
+ else if (offset ==0x104)
+ returns->aux_ctrl;
+ else if (offset ==0x108)
+ returns->tag_ctrl;
+ else if (offset ==0x10C)
+ returns->data_ctrl;
+ else if (offset >=0x730&& offset <0x800)
+ return 0; /* cache ops complete */
+ else if (offset ==0xC00)
+ returns->filter_start;
+ else if (offset ==0xC04)
+ returns->filter_end;
Quoted 8 lines
+ else if (offset ==
0xF40)
+ return 0;
+ else if (offset ==0xF60)
+ return 0;
+ else if (offset ==0xF80)
+ return 0;
+
+ hw_error("l2x0_priv_read: Bad offset %x\n", (int)offset);
Don't hw_error() on things a guest can provoke.
Quoted 34 lines
+ return 0;
hw/arm_l2x0.c new file +3
-0+} + +static void l2x0_priv_write(void *opaque, target_phys_addr_t offset,
uint64_tvalue, unsigned size)hw/arm_l2x0.c new file +29
-0+{ + l2x0_state *s = (l2x0_state *)opaque; + offset &= 0xfff; + if (offset == 0x100) + s->ctrl = value & 1; + else if (offset == 0x104) + s->aux_ctrl = value; + else if (offset == 0x108) + s->tag_ctrl = value; + else if (offset == 0x10C) + s->data_ctrl = value; + else if (offset >= 0x730 && offset < 0x800) + /* ignore */ + return; + else if (offset == 0xC00) + s->filter_start = value; + else if (offset == 0xC04) + s->filter_end = value; + else if (offset == 0xF40) + return; + else if (offset == 0xF60) + return; + else if (offset == 0xF80) + return; + else + hw_error("l2x0_priv_write: Bad offset %x\n", (int)offset); +} + +static const MemoryRegionOps l2x0_mem_ops = {
hw/arm_l2x0.c line 96
Quoted 10 lines
hw/arm_l2x0.c new file +10
-0+ .read = l2x0_priv_read, + .write = l2x0_priv_write, + .endianness = DEVICE_NATIVE_ENDIAN, + }; + +static int l2x0_priv_init (SysBusDevice *dev) +{ + l2x0_state *s = FROM_SYSBUS(l2x0_state, dev); + + s->aux_ctrl = 0x00020000;
This initialisation should be in a reset function.
Quoted 14 lines
hw/arm_l2x0.c new file +13
-1+ + memory_region_init_io(&s->iomem, &l2x0_mem_ops, s, "l2x0_cc", 0x1000); + sysbus_init_mmio(dev, &s->iomem); + return 0; +} + +static void l2x0_register_device (void ) +{ + sysbus_register_dev("l2x0_cc", sizeof(l2x0_state), l2x0_priv_init); +} + +device_init (l2x0_register_device) + --
Quoted 1 line
1.7.5.4
-- PMM