Skip to content

Commit e56e03b

Browse files
committed
Blackfin: unify memory region checks between kgdb and traps
The kgdb (in multiple places) and traps code developed pretty much identical checks for how to access different regions of the Blackfin memory map, but each wasn't 100%, so unify them to avoid duplication, bitrot, and bugs with edge cases. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
1 parent ac1b7c3 commit e56e03b

4 files changed

Lines changed: 256 additions & 274 deletions

File tree

‎arch/blackfin/include/asm/uaccess.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,26 @@ __clear_user(void *to, unsigned long n)
265265

266266
#define clear_user(to, n) __clear_user(to, n)
267267

268+
/* How to interpret these return values:
269+
* CORE: can be accessed by core load or dma memcpy
270+
* CORE_ONLY: can only be accessed by core load
271+
* DMA: can only be accessed by dma memcpy
272+
* IDMA: can only be accessed by interprocessor dma memcpy (BF561)
273+
* ITEST: can be accessed by isram memcpy or dma memcpy
274+
*/
275+
enum {
276+
BFIN_MEM_ACCESS_CORE = 0,
277+
BFIN_MEM_ACCESS_CORE_ONLY,
278+
BFIN_MEM_ACCESS_DMA,
279+
BFIN_MEM_ACCESS_IDMA,
280+
BFIN_MEM_ACCESS_ITEST,
281+
};
282+
/**
283+
* bfin_mem_access_type() - what kind of memory access is required
284+
* @addr: the address to check
285+
* @size: number of bytes needed
286+
* @return: <0 is error, >=0 is BFIN_MEM_ACCESS_xxx enum (see above)
287+
*/
288+
int bfin_mem_access_type(unsigned long addr, unsigned long size);
289+
268290
#endif /* _BLACKFIN_UACCESS_H */

0 commit comments

Comments
 (0)