diff options
Diffstat (limited to 'firmware/export/system.h')
-rw-r--r-- | firmware/export/system.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index 505b167af9..fee188802b 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -312,6 +312,16 @@ static inline void cpucache_flush(void) | |||
312 | /* Aligns a buffer pointer and size to proper boundaries */ | 312 | /* Aligns a buffer pointer and size to proper boundaries */ |
313 | #define CACHEALIGN_BUFFER(start, size) \ | 313 | #define CACHEALIGN_BUFFER(start, size) \ |
314 | ALIGN_BUFFER((start), (size), CACHEALIGN_SIZE) | 314 | ALIGN_BUFFER((start), (size), CACHEALIGN_SIZE) |
315 | /* Pad a size so the buffer can be aligned later */ | ||
316 | #define CACHE_PAD(x) ((x) + CACHEALIGN_SIZE - 1) | ||
317 | /* Number of bytes in the last cacheline assuming buffer of size x is aligned */ | ||
318 | #define CACHE_OVERLAP(x) (x & (CACHEALIGN_SIZE - 1)) | ||
319 | |||
320 | #ifdef NEEDS_STORAGE_ALIGN | ||
321 | #define STORAGE_ALIGN_DOWN(x) CACHEALIGN_DOWN(x) | ||
322 | #define STORAGE_PAD(x) CACHE_PAD(x) | ||
323 | #define STORAGE_OVERLAP(x) CACHE_OVERLAP(x) | ||
324 | #endif | ||
315 | 325 | ||
316 | #else /* ndef PROC_NEEDS_CACHEALIGN */ | 326 | #else /* ndef PROC_NEEDS_CACHEALIGN */ |
317 | 327 | ||
@@ -323,9 +333,17 @@ static inline void cpucache_flush(void) | |||
323 | #define CACHEALIGN_DOWN(x) (x) | 333 | #define CACHEALIGN_DOWN(x) (x) |
324 | /* Make no adjustments */ | 334 | /* Make no adjustments */ |
325 | #define CACHEALIGN_BUFFER(start, size) | 335 | #define CACHEALIGN_BUFFER(start, size) |
336 | #define CACHE_PAD(x) (x) | ||
337 | #define CACHE_OVERLAP(x) 0 | ||
326 | 338 | ||
327 | #endif /* PROC_NEEDS_CACHEALIGN */ | 339 | #endif /* PROC_NEEDS_CACHEALIGN */ |
328 | 340 | ||
341 | #if !defined(PROC_NEEDS_CACHEALIGN) || !defined(NEEDS_STORAGE_ALIGN) | ||
342 | #define STORAGE_ALIGN_DOWN(x) (x) | ||
343 | #define STORAGE_PAD(x) (x) | ||
344 | #define STORAGE_OVERLAP(x) 0 | ||
345 | #endif | ||
346 | |||
329 | /* Double-cast to avoid 'dereferencing type-punned pointer will | 347 | /* Double-cast to avoid 'dereferencing type-punned pointer will |
330 | * break strict aliasing rules' B.S. */ | 348 | * break strict aliasing rules' B.S. */ |
331 | #define PUN_PTR(type, p) ((type)(intptr_t)(p)) | 349 | #define PUN_PTR(type, p) ((type)(intptr_t)(p)) |