base_gic.hh (11943:0a924b294735) base_gic.hh (12739:55a86872ff90)
1/*
1/*
2 * Copyright (c) 2012-2013, 2017 ARM Limited
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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

42 */
43
44#ifndef __DEV_ARM_BASE_GIC_H__
45#define __DEV_ARM_BASE_GIC_H__
46
47#include "dev/io_device.hh"
48
49class Platform;
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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

42 */
43
44#ifndef __DEV_ARM_BASE_GIC_H__
45#define __DEV_ARM_BASE_GIC_H__
46
47#include "dev/io_device.hh"
48
49class Platform;
50class RealView;
51class ThreadContext;
50
52
53struct ArmInterruptPinParams;
54struct ArmPPIParams;
55struct ArmSPIParams;
56struct BaseGicParams;
57
51class BaseGic : public PioDevice
52{
53 public:
58class BaseGic : public PioDevice
59{
60 public:
54 typedef struct BaseGicParams Params;
61 typedef BaseGicParams Params;
55
56 BaseGic(const Params *p);
57 virtual ~BaseGic();
58
59 const Params * params() const;
60
61 /**
62 * Post an interrupt from a device that is connected to the GIC.

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

98 virtual uint32_t readDistributor(ContextID ctx, Addr daddr) = 0;
99 virtual uint32_t readCpu(ContextID ctx, Addr daddr) = 0;
100
101 virtual void writeDistributor(ContextID ctx, Addr daddr,
102 uint32_t data) = 0;
103 virtual void writeCpu(ContextID ctx, Addr daddr, uint32_t data) = 0;
104};
105
62
63 BaseGic(const Params *p);
64 virtual ~BaseGic();
65
66 const Params * params() const;
67
68 /**
69 * Post an interrupt from a device that is connected to the GIC.

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

105 virtual uint32_t readDistributor(ContextID ctx, Addr daddr) = 0;
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/**
114 * Generic representation of an Arm interrupt pin.
115 */
116class ArmInterruptPin : public SimObject
117{
118 public:
119 ArmInterruptPin(const ArmInterruptPinParams *p);
120
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 */
129 void setThreadContext(ThreadContext *tc);
130
131 /** Signal an interrupt */
132 virtual void raise() = 0;
133 /** Clear a signalled interrupt */
134 virtual void clear() = 0;
135
136 protected:
137 /**
138 * Get the target context ID of this interrupt.
139 *
140 * @pre setThreadContext() must have been called prior to calling
141 * this method.
142 */
143 ContextID targetContext() const;
144
145 /**
146 * Pointer to the thread context that owns this interrupt in case
147 * it is a thread-/CPU-private interrupt
148 */
149 const ThreadContext *threadContext;
150
151 /** Arm platform to use for interrupt generation */
152 RealView *const platform;
153 /** Interrupt number to generate */
154 const uint32_t intNum;
155};
156
157class ArmSPI : public ArmInterruptPin
158{
159 public:
160 ArmSPI(const ArmSPIParams *p);
161
162 void raise() override;
163 void clear() override;
164};
165
166class ArmPPI : public ArmInterruptPin
167{
168 public:
169 ArmPPI(const ArmPPIParams *p);
170
171 void raise() override;
172 void clear() override;
173};
174
175
106#endif
176#endif