gic_v3_its.cc (14180:7eb1f31127b4) gic_v3_its.cc (14181:8dcab501009c)
1/*
2 * Copyright (c) 2019 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 38 unchanged lines hidden (view full) ---

47#include "dev/arm/gic_v3_distributor.hh"
48#include "dev/arm/gic_v3_redistributor.hh"
49#include "mem/packet_access.hh"
50
51#define COMMAND(x, method) { x, DispatchEntry(#x, method) }
52
53const AddrRange Gicv3Its::GITS_BASER(0x0100, 0x0138);
54
1/*
2 * Copyright (c) 2019 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 38 unchanged lines hidden (view full) ---

47#include "dev/arm/gic_v3_distributor.hh"
48#include "dev/arm/gic_v3_redistributor.hh"
49#include "mem/packet_access.hh"
50
51#define COMMAND(x, method) { x, DispatchEntry(#x, method) }
52
53const AddrRange Gicv3Its::GITS_BASER(0x0100, 0x0138);
54
55const uint32_t Gicv3Its::CTLR_QUIESCENT = 0x80000000;
56
55ItsProcess::ItsProcess(Gicv3Its &_its)
56 : its(_its), coroutine(nullptr)
57{
58}
59
60ItsProcess::~ItsProcess()
61{
62}

--- 150 unchanged lines hidden (view full) ---

213 return cte;
214}
215
216ItsTranslation::ItsTranslation(Gicv3Its &_its)
217 : ItsProcess(_its)
218{
219 reinit();
220 its.pendingTranslations++;
57ItsProcess::ItsProcess(Gicv3Its &_its)
58 : its(_its), coroutine(nullptr)
59{
60}
61
62ItsProcess::~ItsProcess()
63{
64}

--- 150 unchanged lines hidden (view full) ---

215 return cte;
216}
217
218ItsTranslation::ItsTranslation(Gicv3Its &_its)
219 : ItsProcess(_its)
220{
221 reinit();
222 its.pendingTranslations++;
223 its.gitsControl.quiescent = 0;
221}
222
223ItsTranslation::~ItsTranslation()
224{
225 assert(its.pendingTranslations >= 1);
226 its.pendingTranslations--;
224}
225
226ItsTranslation::~ItsTranslation()
227{
228 assert(its.pendingTranslations >= 1);
229 its.pendingTranslations--;
230 if (!its.pendingTranslations && !its.pendingCommands)
231 its.gitsControl.quiescent = 1;
227}
228
229void
230ItsTranslation::main(Yield &yield)
231{
232 PacketPtr pkt = yield.get();
233
234 const uint32_t device_id = pkt->req->streamId();

--- 69 unchanged lines hidden (view full) ---

304 COMMAND(VSYNC, &ItsCommand::vsync),
305};
306
307ItsCommand::ItsCommand(Gicv3Its &_its)
308 : ItsProcess(_its)
309{
310 reinit();
311 its.pendingCommands = true;
232}
233
234void
235ItsTranslation::main(Yield &yield)
236{
237 PacketPtr pkt = yield.get();
238
239 const uint32_t device_id = pkt->req->streamId();

--- 69 unchanged lines hidden (view full) ---

309 COMMAND(VSYNC, &ItsCommand::vsync),
310};
311
312ItsCommand::ItsCommand(Gicv3Its &_its)
313 : ItsProcess(_its)
314{
315 reinit();
316 its.pendingCommands = true;
317
318 its.gitsControl.quiescent = 0;
312}
313
314ItsCommand::~ItsCommand()
315{
316 its.pendingCommands = false;
319}
320
321ItsCommand::~ItsCommand()
322{
323 its.pendingCommands = false;
324
325 if (!its.pendingTranslations)
326 its.gitsControl.quiescent = 1;
317}
318
319std::string
320ItsCommand::commandName(uint32_t cmd)
321{
322 const auto entry = cmdDispatcher.find(cmd);
323 return entry != cmdDispatcher.end() ? entry->second.name : "INVALID";
324}

--- 436 unchanged lines hidden (view full) ---

761ItsCommand::vsync(Yield &yield, CommandEntry &command)
762{
763 panic("ITS %s command unimplemented", __func__);
764}
765
766Gicv3Its::Gicv3Its(const Gicv3ItsParams *params)
767 : BasicPioDevice(params, params->pio_size),
768 dmaPort(name() + ".dma", *this),
327}
328
329std::string
330ItsCommand::commandName(uint32_t cmd)
331{
332 const auto entry = cmdDispatcher.find(cmd);
333 return entry != cmdDispatcher.end() ? entry->second.name : "INVALID";
334}

--- 436 unchanged lines hidden (view full) ---

771ItsCommand::vsync(Yield &yield, CommandEntry &command)
772{
773 panic("ITS %s command unimplemented", __func__);
774}
775
776Gicv3Its::Gicv3Its(const Gicv3ItsParams *params)
777 : BasicPioDevice(params, params->pio_size),
778 dmaPort(name() + ".dma", *this),
769 gitsControl(0x1),
779 gitsControl(CTLR_QUIESCENT),
770 gitsTyper(params->gits_typer),
771 gitsCbaser(0), gitsCreadr(0),
772 gitsCwriter(0), gitsIidr(0),
773 masterId(params->system->getMasterId(this)),
774 gic(nullptr),
775 commandEvent([this] { checkCommandQueue(); }, name()),
776 pendingCommands(false),
777 pendingTranslations(0)

--- 98 unchanged lines hidden (view full) ---

876{
877 Addr addr = pkt->getAddr() - pioAddr;
878
879 DPRINTF(GIC, "%s register at addr: %#x\n", __func__, addr);
880
881 switch (addr) {
882 case GITS_CTLR:
883 assert(pkt->getSize() == sizeof(uint32_t));
780 gitsTyper(params->gits_typer),
781 gitsCbaser(0), gitsCreadr(0),
782 gitsCwriter(0), gitsIidr(0),
783 masterId(params->system->getMasterId(this)),
784 gic(nullptr),
785 commandEvent([this] { checkCommandQueue(); }, name()),
786 pendingCommands(false),
787 pendingTranslations(0)

--- 98 unchanged lines hidden (view full) ---

886{
887 Addr addr = pkt->getAddr() - pioAddr;
888
889 DPRINTF(GIC, "%s register at addr: %#x\n", __func__, addr);
890
891 switch (addr) {
892 case GITS_CTLR:
893 assert(pkt->getSize() == sizeof(uint32_t));
884 gitsControl = pkt->getLE<uint32_t>();
894 gitsControl = (pkt->getLE<uint32_t>() & ~CTLR_QUIESCENT);
895 // We should check here if the ITS has been disabled, and if
896 // that's the case, flush GICv3 caches to external memory.
897 // This is not happening now, since LPI caching is not
898 // currently implemented in gem5.
885 break;
886
887 case GITS_IIDR:
888 panic("GITS_IIDR is Read Only\n");
889
890 case GITS_TYPER:
891 panic("GITS_TYPER is Read Only\n");
892

--- 362 unchanged lines hidden ---
899 break;
900
901 case GITS_IIDR:
902 panic("GITS_IIDR is Read Only\n");
903
904 case GITS_TYPER:
905 panic("GITS_TYPER is Read Only\n");
906

--- 362 unchanged lines hidden ---