Deleted Added
sdiff udiff text old ( 10570:dcb908e40547 ) new ( 10723:b1d90d88420e )
full compact
1/*
2 * Copyright (c) 2011-2015 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

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

202
203 // offset of functional request into supplied value (could be
204 // negative if partial overlap)
205 int offset = func_start - val_start;
206
207 if (isRead()) {
208 if (func_start >= val_start && func_end <= val_end) {
209 memcpy(getPtr<uint8_t>(), _data + offset, getSize());
210 if (bytesValid.empty())
211 bytesValid.resize(getSize(), true);
212 // complete overlap, and as the current packet is a read
213 // we are done
214 return true;
215 } else {
216 // Offsets and sizes to copy in case of partial overlap
217 int func_offset;
218 int val_offset;
219 int overlap_size;
220
221 // calculate offsets and copy sizes for the two byte arrays
222 if (val_start < func_start && val_end <= func_end) {
223 // the one we are checking against starts before and
224 // ends before or the same
225 val_offset = func_start - val_start;
226 func_offset = 0;
227 overlap_size = val_end - func_start;
228 } else if (val_start >= func_start && val_end > func_end) {
229 // the one we are checking against starts after or the
230 // same, and ends after
231 val_offset = 0;
232 func_offset = val_start - func_start;
233 overlap_size = func_end - val_start;
234 } else if (val_start >= func_start && val_end <= func_end) {
235 // the one we are checking against is completely
236 // subsumed in the current packet, possibly starting
237 // and ending at the same address
238 val_offset = 0;
239 func_offset = val_start - func_start;
240 overlap_size = size;
241 } else if (val_start < func_start && val_end > func_end) {
242 // the current packet is completely subsumed in the
243 // one we are checking against
244 val_offset = func_start - val_start;
245 func_offset = 0;
246 overlap_size = func_end - func_start;
247 } else {
248 panic("Missed a case for checkFunctional with "
249 " %s 0x%x size %d, against 0x%x size %d\n",
250 cmdString(), getAddr(), getSize(), addr, size);
251 }
252
253 // copy partial data into the packet's data array
254 uint8_t *dest = getPtr<uint8_t>() + func_offset;
255 uint8_t *src = _data + val_offset;
256 memcpy(dest, src, overlap_size);
257
258 // initialise the tracking of valid bytes if we have not
259 // used it already
260 if (bytesValid.empty())
261 bytesValid.resize(getSize(), false);
262
263 // track if we are done filling the functional access
264 bool all_bytes_valid = true;
265
266 int i = 0;
267
268 // check up to func_offset
269 for (; all_bytes_valid && i < func_offset; ++i)
270 all_bytes_valid &= bytesValid[i];
271
272 // update the valid bytes
273 for (i = func_offset; i < func_offset + overlap_size; ++i)
274 bytesValid[i] = true;
275
276 // check the bit after the update we just made
277 for (; all_bytes_valid && i < getSize(); ++i)
278 all_bytes_valid &= bytesValid[i];
279
280 return all_bytes_valid;
281 }
282 } else if (isWrite()) {
283 if (offset >= 0) {
284 memcpy(_data + offset, getConstPtr<uint8_t>(),
285 (min(func_end, val_end) - func_start) + 1);
286 } else {
287 // val_start > func_start
288 memcpy(_data, getConstPtr<uint8_t>() - offset,

--- 101 unchanged lines hidden ---