MCPcopy Create free account
hub / github.com/F-Stack/f-stack / decode_win_xor_valid

Function decode_win_xor_valid

freebsd/arm/mv/mv_common.c:2258–2319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2256}
2257
2258int
2259decode_win_xor_valid(void)
2260{
2261 const struct decode_win *wintab;
2262 int c, i, j, rv;
2263 uint32_t b, e, s;
2264
2265 if (xor_wins_no > MV_WIN_XOR_MAX) {
2266 printf("XOR windows: too many entries: %d\n", xor_wins_no);
2267 return (0);
2268 }
2269 for (i = 0, c = 0; i < MV_WIN_DDR_MAX; i++)
2270 if (ddr_is_active(i))
2271 c++;
2272
2273 if (xor_wins_no > (MV_WIN_XOR_MAX - c)) {
2274 printf("XOR windows: too many entries: %d, available: %d\n",
2275 xor_wins_no, MV_WIN_IDMA_MAX - c);
2276 return (0);
2277 }
2278
2279 wintab = xor_wins;
2280 rv = 1;
2281 for (i = 0; i < xor_wins_no; i++, wintab++) {
2282 if (wintab->target == 0) {
2283 printf("XOR window#%d: DDR target window is not "
2284 "supposed to be reprogrammed!\n", i);
2285 rv = 0;
2286 }
2287
2288 if (wintab->remap >= 0 && win_cpu_can_remap(i) != 1) {
2289 printf("XOR window#%d: not capable of remapping, but "
2290 "val 0x%08x defined\n", i, wintab->remap);
2291 rv = 0;
2292 }
2293
2294 s = wintab->size;
2295 b = wintab->base;
2296 e = b + s - 1;
2297 if (s > (0xFFFFFFFF - b + 1)) {
2298 /*
2299 * XXX this boundary check should account for 64bit
2300 * and remapping..
2301 */
2302 printf("XOR window#%d: no space for size 0x%08x at "
2303 "0x%08x\n", i, s, b);
2304 rv = 0;
2305 continue;
2306 }
2307
2308 j = decode_win_overlap(i, xor_wins_no, &xor_wins[0]);
2309 if (j >= 0) {
2310 printf("XOR window#%d: (0x%08x - 0x%08x) overlaps "
2311 "with #%d (0x%08x - 0x%08x)\n", i, b, e, j,
2312 xor_wins[j].base,
2313 xor_wins[j].base + xor_wins[j].size - 1);
2314 rv = 0;
2315 }

Callers

nothing calls this directly

Calls 4

ddr_is_activeFunction · 0.85
win_cpu_can_remapFunction · 0.85
decode_win_overlapFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected