Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/include - make X68K_BUS_PERFORMANCE_HACK part ...
details: https://anonhg.NetBSD.org/src/rev/39499207c562
branches: trunk
changeset: 763546:39499207c562
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Thu Mar 24 14:58:33 2011 +0000
description:
- make X68K_BUS_PERFORMANCE_HACK part default
- use volatile rather than dummy __asm() statements to avoid optimization
Tested on X68030.
diffstat:
sys/arch/x68k/include/bus.h | 250 ++++++++++---------------------------------
1 files changed, 61 insertions(+), 189 deletions(-)
diffs (truncated from 386 to 300 lines):
diff -r aacf2402ada9 -r 39499207c562 sys/arch/x68k/include/bus.h
--- a/sys/arch/x68k/include/bus.h Thu Mar 24 13:52:04 2011 +0000
+++ b/sys/arch/x68k/include/bus.h Thu Mar 24 14:58:33 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.22 2010/03/19 14:20:56 tsutsui Exp $ */
+/* $NetBSD: bus.h,v 1.23 2011/03/24 14:58:33 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -37,14 +37,6 @@
#ifndef _X68K_BUS_H_
#define _X68K_BUS_H_
-#ifndef X68K_BUS_PERFORMANCE_HACK
-#if defined(__GNUC__) && defined(__STDC__)
-#define X68K_BUS_PERFORMANCE_HACK 1
-#else
-#define X68K_BUS_PERFORMANCE_HACK 0
-#endif
-#endif
-
/*
* Bus address and size types
*/
@@ -293,120 +285,72 @@
_bus_space_read_multi_1(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, uint8_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint8_t *regadr = (uint8_t *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint8_t *regadr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_read_multi_1" : : : "memory");
+ regadr = (volatile uint8_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*datap++ = *regadr;
- }
-#else
-
- while (count-- > 0) {
- *datap++ = *(volatile uint8_t *)
- __X68K_BUS_ADDR(t, bsh, offset);
- }
-#endif
}
static __inline void
_bus_space_read_multi_2(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, uint16_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint16_t *regadr = (uint16_t *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint16_t *regadr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_read_multi_2" : : : "memory");
+ regadr = (volatile uint16_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*datap++ = *regadr;
- }
-#else
-
- while (count-- > 0) {
- *datap++ = *(volatile uint16_t *)
- __X68K_BUS_ADDR(t, bsh, offset);
- }
-#endif
}
static __inline void
_bus_space_read_multi_4(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, uint32_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint32_t *regadr = (uint32_t *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint32_t *regadr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_read_multi_4" : : : "memory");
+ regadr = (volatile uint32_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*datap++ = *regadr;
- }
-#else
-
- while (count-- > 0) {
- *datap++ = *(volatile uint32_t *)
- __X68K_BUS_ADDR(t, bsh, offset);
- }
-#endif
}
static __inline void
_bus_space_read_region_1(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, uint8_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint8_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint8_t *addr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_read_region_1" : : : "memory");
+ addr = (volatile uint8_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*datap++ = *addr++;
- }
-#else
- volatile uint8_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
-
- while (count-- > 0) {
- *datap++ = *addr++;
- }
-#endif
}
static __inline void
_bus_space_read_region_2(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, uint16_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint16_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint16_t *addr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_read_region_2" : : : "memory");
+ addr = (volatile uint16_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*datap++ = *addr++;
- }
-#else
- volatile uint16_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
-
- while (count-- > 0) {
- *datap++ = *addr++;
- }
-#endif
}
static __inline void
_bus_space_read_region_4(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, uint32_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint32_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint32_t *addr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_read_region_4" : : : "memory");
+ addr = (volatile uint32_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*datap++ = *addr++;
- }
-#else
- volatile uint32_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
-
- while (count-- > 0) {
- *datap++ = *addr++;
- }
-#endif
}
static __inline void
@@ -437,180 +381,108 @@
_bus_space_write_multi_1(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, const uint8_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint8_t *regadr = (uint8_t *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint8_t *regadr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_write_multi_1" : : : "memory");
+ regadr = (volatile uint8_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*regadr = *datap++;
- }
-#else
-
- while (count-- > 0) {
- *(volatile uint8_t *) __X68K_BUS_ADDR(t, bsh, offset)
- = *datap++;
- }
-#endif
}
static __inline void
_bus_space_write_multi_2(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, const uint16_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint16_t *regadr = (uint16_t *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint16_t *regadr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_write_multi_2" : : : "memory");
+ regadr = (volatile uint16_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*regadr = *datap++;
- }
-#else
-
- while (count-- > 0) {
- *(volatile uint16_t *) __X68K_BUS_ADDR(t, bsh, offset)
- = *datap++;
- }
-#endif
}
static __inline void
_bus_space_write_multi_4(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, const uint32_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint32_t *regadr = (uint32_t *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint32_t *regadr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_write_multi_4" : : : "memory");
+ regadr = (volatile uint32_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*regadr = *datap++;
- }
-#else
-
- while (count-- > 0) {
- *(volatile uint32_t *) __X68K_BUS_ADDR(t, bsh, offset)
- = *datap++;
- }
-#endif
}
static __inline void
_bus_space_write_region_1(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, const uint8_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint8_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint8_t *addr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_write_region_1": : : "memory");
+ addr = (volatile uint8_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*addr++ = *datap++;
- }
-#else
- volatile uint8_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
-
- while (count-- > 0) {
- *addr++ = *datap++;
- }
-#endif
}
static __inline void
_bus_space_write_region_2(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, const uint16_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint16_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint16_t *addr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_write_region_2": : : "memory");
+ addr = (volatile uint16_t *)__X68K_BUS_ADDR(t, bsh, offset);
+
+ for (; count; count--)
*addr++ = *datap++;
- }
-#else
- volatile uint16_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
-
- while (count-- > 0) {
- *addr++ = *datap++;
- }
-#endif
}
static __inline void
_bus_space_write_region_4(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t offset, const uint32_t *datap, bus_size_t count)
{
-#if X68K_BUS_PERFORMANCE_HACK
- uint32_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
+ volatile uint32_t *addr;
- for (; count; count--) {
- __asm("| avoid optim. _bus_space_write_region_4": : : "memory");
+ addr = (volatile uint32_t *)__X68K_BUS_ADDR(t, bsh, offset);
Home |
Main Index |
Thread Index |
Old Index