base.cc (10905:a6ca6831e775) base.cc (11321:02e930db812d)
1/*
2 * Copyright (c) 2014 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

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

88}
89
90void
91VirtDescriptor::updateChain()
92{
93 VirtDescriptor *desc(this);
94 do {
95 desc->update();
1/*
2 * Copyright (c) 2014 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

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

88}
89
90void
91VirtDescriptor::updateChain()
92{
93 VirtDescriptor *desc(this);
94 do {
95 desc->update();
96 } while((desc = desc->next()) != NULL && desc != this);
96 } while ((desc = desc->next()) != NULL && desc != this);
97
98 if (desc == this)
99 panic("Loop in descriptor chain!\n");
100}
101
102void
103VirtDescriptor::dump() const
104{

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

120VirtDescriptor::dumpChain() const
121{
122 if (!DTRACE(VIO))
123 return;
124
125 const VirtDescriptor *desc(this);
126 do {
127 desc->dump();
97
98 if (desc == this)
99 panic("Loop in descriptor chain!\n");
100}
101
102void
103VirtDescriptor::dump() const
104{

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

120VirtDescriptor::dumpChain() const
121{
122 if (!DTRACE(VIO))
123 return;
124
125 const VirtDescriptor *desc(this);
126 do {
127 desc->dump();
128 } while((desc = desc->next()) != NULL);
128 } while ((desc = desc->next()) != NULL);
129}
130
131VirtDescriptor *
132VirtDescriptor::next() const
133{
134 if (hasNext()) {
135 return queue->getDescriptor(desc.next);
136 } else {

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

172 const size_t chunk_size(std::min(desc->size() - offset, size));
173 desc->read(offset, dst, chunk_size);
174 dst += chunk_size;
175 size -= chunk_size;
176 offset = 0;
177 } else {
178 offset -= desc->size();
179 }
129}
130
131VirtDescriptor *
132VirtDescriptor::next() const
133{
134 if (hasNext()) {
135 return queue->getDescriptor(desc.next);
136 } else {

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

172 const size_t chunk_size(std::min(desc->size() - offset, size));
173 desc->read(offset, dst, chunk_size);
174 dst += chunk_size;
175 size -= chunk_size;
176 offset = 0;
177 } else {
178 offset -= desc->size();
179 }
180 } while((desc = desc->next()) != NULL && desc->isIncoming() && size > 0);
180 } while ((desc = desc->next()) != NULL && desc->isIncoming() && size > 0);
181
182 if (size != 0) {
183 panic("Failed to read %i bytes from chain of %i bytes @ offset %i\n",
184 full_size, chainSize(), offset);
185 }
186}
187
188void

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

195 const size_t chunk_size(std::min(desc->size() - offset, size));
196 desc->write(offset, src, chunk_size);
197 src += chunk_size;
198 size -= chunk_size;
199 offset = 0;
200 } else {
201 offset -= desc->size();
202 }
181
182 if (size != 0) {
183 panic("Failed to read %i bytes from chain of %i bytes @ offset %i\n",
184 full_size, chainSize(), offset);
185 }
186}
187
188void

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

195 const size_t chunk_size(std::min(desc->size() - offset, size));
196 desc->write(offset, src, chunk_size);
197 src += chunk_size;
198 size -= chunk_size;
199 offset = 0;
200 } else {
201 offset -= desc->size();
202 }
203 } while((desc = desc->next()) != NULL && size > 0);
203 } while ((desc = desc->next()) != NULL && size > 0);
204
205 if (size != 0) {
206 panic("Failed to write %i bytes into chain of %i bytes @ offset %i\n",
207 full_size, chainSize(), offset);
208 }
209}
210
211size_t
212VirtDescriptor::chainSize() const
213{
214 size_t size(0);
215 const VirtDescriptor *desc(this);
216 do {
217 size += desc->size();
204
205 if (size != 0) {
206 panic("Failed to write %i bytes into chain of %i bytes @ offset %i\n",
207 full_size, chainSize(), offset);
208 }
209}
210
211size_t
212VirtDescriptor::chainSize() const
213{
214 size_t size(0);
215 const VirtDescriptor *desc(this);
216 do {
217 size += desc->size();
218 } while((desc = desc->next()) != NULL);
218 } while ((desc = desc->next()) != NULL);
219
220 return size;
221}
222
223
224
225VirtQueue::VirtQueue(PortProxy &proxy, uint16_t size)
226 : _size(size), _address(0), memProxy(proxy),

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

310
311void
312VirtQueue::onNotify()
313{
314 DPRINTF(VIO, "onNotify\n");
315
316 // Consume all pending descriptors from the input queue.
317 VirtDescriptor *d;
219
220 return size;
221}
222
223
224
225VirtQueue::VirtQueue(PortProxy &proxy, uint16_t size)
226 : _size(size), _address(0), memProxy(proxy),

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

310
311void
312VirtQueue::onNotify()
313{
314 DPRINTF(VIO, "onNotify\n");
315
316 // Consume all pending descriptors from the input queue.
317 VirtDescriptor *d;
318 while((d = consumeDescriptor()) != NULL)
318 while ((d = consumeDescriptor()) != NULL)
319 onNotifyDescriptor(d);
320}
321
322
323VirtIODeviceBase::VirtIODeviceBase(Params *params, DeviceId id,
324 size_t config_size, FeatureBits features)
325 : SimObject(params),
326 guestFeatures(0),

--- 152 unchanged lines hidden ---
319 onNotifyDescriptor(d);
320}
321
322
323VirtIODeviceBase::VirtIODeviceBase(Params *params, DeviceId id,
324 size_t config_size, FeatureBits features)
325 : SimObject(params),
326 guestFeatures(0),

--- 152 unchanged lines hidden ---