diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-09-06 00:03:18 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-09-06 00:03:18 +0000 |
commit | 3d0d969b7a9adc7b957d90d94ff9f0528142ec4d (patch) | |
tree | 705fc874ffb4b40c321fd646b639dfc9e958eb9a /c | |
parent | 2007-09-05 Daniel Hellstrom <daniel@gaisler.com> (diff) | |
download | rtems-3d0d969b7a9adc7b957d90d94ff9f0528142ec4d.tar.bz2 |
2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
* shared/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...)
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libbsp/sparc/ChangeLog | 8 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/bspstart.c | 29 |
2 files changed, 37 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/ChangeLog b/c/src/lib/libbsp/sparc/ChangeLog index 32348679c5..76ac229f1d 100644 --- a/c/src/lib/libbsp/sparc/ChangeLog +++ b/c/src/lib/libbsp/sparc/ChangeLog @@ -1,5 +1,13 @@ 2007-09-05 Daniel Hellstrom <daniel@gaisler.com> + * shared/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> + * shared/amba/ambapp.c, shared/include/ambapp.h: New files. 2007-09-05 Daniel Hellstrom <daniel@gaisler.com> diff --git a/c/src/lib/libbsp/sparc/shared/bspstart.c b/c/src/lib/libbsp/sparc/shared/bspstart.c index 17b3cfe74c..2ccd3a750f 100644 --- a/c/src/lib/libbsp/sparc/shared/bspstart.c +++ b/c/src/lib/libbsp/sparc/shared/bspstart.c @@ -47,6 +47,14 @@ rtems_cpu_table Cpu_table; extern uint32_t rdb_start; +#ifdef LEON2 +/* + * Tells us if data cache snooping is available + */ + +int CPU_SPARC_HAS_SNOOPING; +#endif + /* * Use the shared implementations of the following routines */ @@ -55,6 +63,23 @@ void bsp_postdriver_hook(void); void bsp_libc_init( void *, uint32_t, int ); extern void bsp_spurious_initialize(); +#ifdef LEON2 +/* + * 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) +{ + unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */ + return ((tmp>>23) & 1); /* Data cache snooping enabled */ +} +#endif + /* * bsp_pretasking_hook * @@ -118,4 +143,8 @@ void bsp_start( void ) } BSP_Configuration.work_space_start = work_space_start; + + #ifdef LEON2 + CPU_SPARC_HAS_SNOOPING = set_snooping(); + #endif } |