PERFORCE change 158580 for review
Ulf Lilleengen
lulf at FreeBSD.org
Mon Mar 2 01:36:59 PST 2009
http://perforce.freebsd.org/chv.cgi?CH=158580
Change 158580 by lulf at lulf_carrot on 2009/03/02 09:36:20
- Add macro for flushing write buffer.
- Flush writebuffer after cleaning cache.
Affected files ...
.. //depot/projects/avr32/src/sys/avr32/avr32/cache.c#3 edit
.. //depot/projects/avr32/src/sys/avr32/include/cache.h#2 edit
Differences ...
==== //depot/projects/avr32/src/sys/avr32/avr32/cache.c#3 (text+ko) ====
@@ -122,6 +122,10 @@
avr32_dcache_line_size = pow(2, bit_value(SYS, CONFIG1, DLSZ, config) +
1);
avr32_dcache_ways = pow(2, bit_value(SYS, CONFIG1, DASS, config));
+ printf("ICACHE: sz %d lsz %d assoc %d\n", avr32_icache_size,
+ avr32_icache_line_size, avr32_icache_ways);
+ printf("DCACHE: sz %d lsz %d assoc %d\n", avr32_dcache_size,
+ avr32_dcache_line_size, avr32_dcache_ways);
/* log2(1) = 0, meaning no cache present. */
if (avr32_icache_line_size == 1) {
@@ -207,7 +211,6 @@
/* Put address at a cache line boundary. */
va = trunc_line(from, avr32_dcache_line_size);
va_end = round_line(from + size, avr32_dcache_line_size);
-
while (va < va_end) {
cache_line_op(va, DCACHE_WRITEBACK_INVALIDATE);
va += avr32_dcache_line_size;
@@ -223,7 +226,6 @@
/* Put address at a cache line boundary. */
va = trunc_line(from, avr32_dcache_line_size);
va_end = round_line(from + size, avr32_dcache_line_size);
-
while (va < va_end) {
cache_line_op(va, DCACHE_INVALIDATE);
va += avr32_dcache_line_size;
@@ -243,4 +245,5 @@
cache_line_op(va, DCACHE_WRITEBACK);
va += avr32_dcache_line_size;
}
+ avr32_wbflush();
}
==== //depot/projects/avr32/src/sys/avr32/include/cache.h#2 (text+ko) ====
@@ -152,5 +152,8 @@
#define avr32_dcache_wb_range(v, s) \
__mco_2args(, dcache_wb_range, (v), (s))
+/* For flushing the write buffer. */
+#define avr32_wbflush() __asm__ __volatile("sync 0" : : : "memory")
+
void avr32_config_cache(void);
void avr32_dcache_compute_align(void);
More information about the p4-projects
mailing list