Deleted Added
sdiff udiff text old ( 13877:a4ac726b549d ) new ( 13878:40a2ec55ad89 )
full compact
1/*
2 * Copyright (c) 2018 Metempsy Technology Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

43Gicv3::Gicv3(const Params * p)
44 : BaseGic(p)
45{
46}
47
48void
49Gicv3::init()
50{
51 distRange = RangeSize(params()->dist_addr,
52 Gicv3Distributor::ADDR_RANGE_SIZE - 1);
53 redistRange = RangeSize(params()->redist_addr,
54 Gicv3Redistributor::ADDR_RANGE_SIZE * sys->numContexts() - 1);
55 addrRanges = {distRange, redistRange};
56 BaseGic::init();
57 distributor = new Gicv3Distributor(this, params()->it_lines);
58 redistributors.resize(sys->numContexts(), nullptr);
59 cpuInterfaces.resize(sys->numContexts(), nullptr);
60
61 panic_if(sys->numContexts() > params()->cpu_max,
62 "Exceeding maximum number of PEs supported by GICv3: "
63 "using %u while maximum is %u\n", sys->numContexts(),
64 params()->cpu_max);
65
66 for (int i = 0; i < sys->numContexts(); i++) {
67 redistributors[i] = new Gicv3Redistributor(this, i);
68 cpuInterfaces[i] = new Gicv3CPUInterface(this, i);
69 }
70
71 distributor->init();
72
73 for (int i = 0; i < sys->numContexts(); i++) {
74 redistributors[i]->init();
75 cpuInterfaces[i]->init();
76 }
77}
78
79void
80Gicv3::initState()
81{
82 distributor->initState();
83
84 for (int i = 0; i < sys->numContexts(); i++) {

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

102 resp = distributor->read(daddr, size, is_secure_access);
103 delay = params()->dist_pio_delay;
104 DPRINTF(GIC, "Gicv3::read(): (distributor) context_id %d register %#x "
105 "size %d is_secure_access %d (value %#x)\n",
106 pkt->req->contextId(), daddr, size, is_secure_access, resp);
107 } else if (redistRange.contains(addr)) {
108 Addr daddr = addr - redistRange.start();
109 uint32_t redistributor_id =
110 daddr / Gicv3Redistributor::ADDR_RANGE_SIZE;
111 daddr = daddr % Gicv3Redistributor::ADDR_RANGE_SIZE;
112 panic_if(redistributor_id >= redistributors.size(),
113 "Invalid redistributor_id!");
114 panic_if(!redistributors[redistributor_id], "Redistributor is null!");
115 resp = redistributors[redistributor_id]->read(daddr, size,
116 is_secure_access);
117 delay = params()->redist_pio_delay;
118 DPRINTF(GIC, "Gicv3::read(): (redistributor %d) context_id %d "
119 "register %#x size %d is_secure_access %d (value %#x)\n",

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

143 DPRINTF(GIC, "Gicv3::write(): (distributor) context_id %d "
144 "register %#x size %d is_secure_access %d value %#x\n",
145 pkt->req->contextId(), daddr, size, is_secure_access, data);
146 distributor->write(daddr, data, size, is_secure_access);
147 delay = params()->dist_pio_delay;
148 } else if (redistRange.contains(addr)) {
149 Addr daddr = addr - redistRange.start();
150 uint32_t redistributor_id =
151 daddr / Gicv3Redistributor::ADDR_RANGE_SIZE;
152 daddr = daddr % Gicv3Redistributor::ADDR_RANGE_SIZE;
153 panic_if(redistributor_id >= redistributors.size(),
154 "Invalid redistributor_id!");
155 panic_if(!redistributors[redistributor_id], "Redistributor is null!");
156 DPRINTF(GIC, "Gicv3::write(): (redistributor %d) context_id %d "
157 "register %#x size %d is_secure_access %d value %#x\n",
158 redistributor_id, pkt->req->contextId(), daddr, size,
159 is_secure_access, data);
160 redistributors[redistributor_id]->write(daddr, data, size,

--- 104 unchanged lines hidden ---