2007-09-05 Daniel Hellstrom <daniel@gaisler.com>

* include/bsp.h, startup/bspstart.c: LEON2 and LEON3 Data cache
	snooping detection on startup, for drivers. (LEON2,3 are configurable
	processors, they can be with or without DCache snooping. Caches
	without snooping needs the drivers to flush cache or use the sparc
	instruction lda to force cache miss...)
This commit is contained in:
Joel Sherrill
2007-09-06 00:03:16 +00:00
parent 5982921836
commit 4cb04f2250
3 changed files with 37 additions and 0 deletions

View File

@@ -1,3 +1,11 @@
2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
* include/bsp.h, startup/bspstart.c: LEON2 and LEON3 Data cache
snooping detection on startup, for drivers. (LEON2,3 are configurable
processors, they can be with or without DCache snooping. Caches
without snooping needs the drivers to flush cache or use the sparc
instruction lda to force cache miss...)
2007-09-05 Daniel Hellstrom <daniel@gaisler.com> 2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
* Makefile.am, preinstall.am, amba/amba.c, include/amba.h, * Makefile.am, preinstall.am, amba/amba.c, include/amba.h,

View File

@@ -83,6 +83,8 @@ extern int rtems_leon_greth_driver_attach(
extern void Clock_delay(uint32_t microseconds); extern void Clock_delay(uint32_t microseconds);
#define delay( microseconds ) Clock_delay(microseconds) #define delay( microseconds ) Clock_delay(microseconds)
extern int CPU_SPARC_HAS_SNOOPING;
/* Constants */ /* Constants */

View File

@@ -42,10 +42,35 @@ rtems_cpu_table Cpu_table;
extern uint32_t rdb_start; extern uint32_t rdb_start;
/*
* Tells us if data cache snooping is available
*/
int CPU_SPARC_HAS_SNOOPING;
void bsp_postdriver_hook(void); void bsp_postdriver_hook(void);
void bsp_libc_init( void *, uint32_t, int ); void bsp_libc_init( void *, uint32_t, int );
extern void bsp_spurious_initialize(); extern void bsp_spurious_initialize();
/*
* set_snooping
*
* Read the data cache configuration register to determine if
* bus snooping is available. This is needed for some drivers so
* that they can select the most efficient copy routines.
*
*/
static inline int set_snooping(void)
{
int tmp;
asm(" lda [%1] 2, %0 "
: "=r"(tmp)
: "r"(0xC)
);
return (tmp >> 27) & 1;
}
/* /*
* bsp_pretasking_hook * bsp_pretasking_hook
* *
@@ -112,4 +137,6 @@ void bsp_start( void )
} }
BSP_Configuration.work_space_start = work_space_start; BSP_Configuration.work_space_start = work_space_start;
CPU_SPARC_HAS_SNOOPING = set_snooping();
} }