base_gic.hh (12970:6ddc393b8431) base_gic.hh (12974:b840a646cfbd)
1/*
2 * Copyright (c) 2012-2013, 2017-2018 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

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

39
40/** @file
41 * Base class for ARM GIC implementations
42 */
43
44#ifndef __DEV_ARM_BASE_GIC_H__
45#define __DEV_ARM_BASE_GIC_H__
46
1/*
2 * Copyright (c) 2012-2013, 2017-2018 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

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

39
40/** @file
41 * Base class for ARM GIC implementations
42 */
43
44#ifndef __DEV_ARM_BASE_GIC_H__
45#define __DEV_ARM_BASE_GIC_H__
46
47#include <unordered_map>
48
47#include "dev/io_device.hh"
48
49class Platform;
50class RealView;
51class ThreadContext;
49#include "dev/io_device.hh"
50
51class Platform;
52class RealView;
53class ThreadContext;
54class ArmInterruptPin;
55class ArmSPI;
56class ArmPPI;
52
53struct ArmInterruptPinParams;
54struct ArmPPIParams;
55struct ArmSPIParams;
56struct BaseGicParams;
57
58class BaseGic : public PioDevice
59{

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

106 virtual uint32_t readCpu(ContextID ctx, Addr daddr) = 0;
107
108 virtual void writeDistributor(ContextID ctx, Addr daddr,
109 uint32_t data) = 0;
110 virtual void writeCpu(ContextID ctx, Addr daddr, uint32_t data) = 0;
111};
112
113/**
57
58struct ArmInterruptPinParams;
59struct ArmPPIParams;
60struct ArmSPIParams;
61struct BaseGicParams;
62
63class BaseGic : public PioDevice
64{

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

111 virtual uint32_t readCpu(ContextID ctx, Addr daddr) = 0;
112
113 virtual void writeDistributor(ContextID ctx, Addr daddr,
114 uint32_t data) = 0;
115 virtual void writeCpu(ContextID ctx, Addr daddr, uint32_t data) = 0;
116};
117
118/**
114 * Generic representation of an Arm interrupt pin.
119 * This SimObject is instantiated in the python world and
120 * serves as an ArmInterruptPin generator. In this way it
121 * is possible to instantiate a single generator per component
122 * during configuration, and to dynamically spawn ArmInterruptPins.
123 * See ArmPPIGen for more info on how this is used.
115 */
124 */
116class ArmInterruptPin : public SimObject
125class ArmInterruptPinGen : public SimObject
117{
118 public:
126{
127 public:
119 ArmInterruptPin(const ArmInterruptPinParams *p);
128 ArmInterruptPinGen(const ArmInterruptPinParams *p);
120
129
130 virtual ArmInterruptPin* get(ThreadContext *tc = nullptr) = 0;
131};
132
133/**
134 * Shared Peripheral Interrupt Generator
135 * It is capable of generating one interrupt only: it maintains a pointer
136 * to it and returns it every time it is asked for it (via the get metod)
137 */
138class ArmSPIGen : public ArmInterruptPinGen
139{
140 public:
141 ArmSPIGen(const ArmSPIParams *p);
142
143 ArmInterruptPin* get(ThreadContext *tc = nullptr) override;
144 protected:
145 ArmSPI* pin;
146};
147
148/**
149 * Private Peripheral Interrupt Generator
150 * Since PPIs are banked in the GIC, this class is capable of generating
151 * more than one interrupt (one per ContextID).
152 */
153class ArmPPIGen : public ArmInterruptPinGen
154{
155 public:
156 ArmPPIGen(const ArmPPIParams *p);
157
158 ArmInterruptPin* get(ThreadContext* tc = nullptr) override;
159 protected:
160 std::unordered_map<ContextID, ArmPPI*> pins;
161};
162
163/**
164 * Generic representation of an Arm interrupt pin.
165 */
166class ArmInterruptPin
167{
168 friend class ArmInterruptPinGen;
169 protected:
170 ArmInterruptPin(Platform *platform, ThreadContext *tc,
171 uint32_t int_num);
172
121 public: /* Public interface */
122 /**
123 * Set the thread context owning this interrupt.
124 *
125 * This method is used to set the thread context for interrupts
126 * that are thread/CPU-specific. Only devices that are used in
127 * such a context are expected to call this method.
128 */

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

148 /**
149 * Pointer to the thread context that owns this interrupt in case
150 * it is a thread-/CPU-private interrupt
151 */
152 const ThreadContext *threadContext;
153
154 /** Arm platform to use for interrupt generation */
155 RealView *const platform;
173 public: /* Public interface */
174 /**
175 * Set the thread context owning this interrupt.
176 *
177 * This method is used to set the thread context for interrupts
178 * that are thread/CPU-specific. Only devices that are used in
179 * such a context are expected to call this method.
180 */

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

200 /**
201 * Pointer to the thread context that owns this interrupt in case
202 * it is a thread-/CPU-private interrupt
203 */
204 const ThreadContext *threadContext;
205
206 /** Arm platform to use for interrupt generation */
207 RealView *const platform;
208
156 /** Interrupt number to generate */
157 const uint32_t intNum;
158};
159
160class ArmSPI : public ArmInterruptPin
161{
209 /** Interrupt number to generate */
210 const uint32_t intNum;
211};
212
213class ArmSPI : public ArmInterruptPin
214{
162 public:
163 ArmSPI(const ArmSPIParams *p);
215 friend class ArmSPIGen;
216 private:
217 ArmSPI(Platform *platform, uint32_t int_num);
164
218
219 public:
165 void raise() override;
166 void clear() override;
167};
168
169class ArmPPI : public ArmInterruptPin
170{
220 void raise() override;
221 void clear() override;
222};
223
224class ArmPPI : public ArmInterruptPin
225{
171 public:
172 ArmPPI(const ArmPPIParams *p);
226 friend class ArmPPIGen;
227 private:
228 ArmPPI(Platform *platform, ThreadContext *tc, uint32_t int_num);
173
229
230 public:
174 void raise() override;
175 void clear() override;
176};
177
231 void raise() override;
232 void clear() override;
233};
234
178
179#endif
235#endif