Sprinkle volatile to bus_space(9) access functions.

This commit is contained in:
tsutsui 2008-12-27 16:14:12 +00:00
parent d88429017d
commit d79dc17147
4 changed files with 84 additions and 84 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: be_bus.c,v 1.9 2008/04/28 20:23:14 martin Exp $ */
/* $NetBSD: be_bus.c,v 1.10 2008/12/27 16:14:12 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.9 2008/04/28 20:23:14 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.10 2008/12/27 16:14:12 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -161,15 +161,15 @@ static void beb_bus_space_set_region_8 __P((bus_space_tag_t,
/*
* Don't force a function call overhead on these primitives...
*/
#define __read_1(h, o) *((u_int8_t *)((h) + (o)))
#define __read_2(h, o) *((u_int16_t *)((h) + (o)))
#define __read_4(h, o) *((u_int32_t *)((h) + (o)))
#define __read_8(h, o) *((u_int64_t *)((h) + (o)))
#define __read_1(h, o) *((volatile u_int8_t *)((h) + (o)))
#define __read_2(h, o) *((volatile u_int16_t *)((h) + (o)))
#define __read_4(h, o) *((volatile u_int32_t *)((h) + (o)))
#define __read_8(h, o) *((volatile u_int64_t *)((h) + (o)))
#define __write_1(h, o, v) *((u_int8_t *)((h) + (o))) = (v)
#define __write_2(h, o, v) *((u_int16_t *)((h) + (o))) = (v)
#define __write_4(h, o, v) *((u_int32_t *)((h) + (o))) = (v)
#define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = (v)
#define __write_1(h, o, v) *((volatile u_int8_t *)((h) + (o))) = (v)
#define __write_2(h, o, v) *((volatile u_int16_t *)((h) + (o))) = (v)
#define __write_4(h, o, v) *((volatile u_int32_t *)((h) + (o))) = (v)
#define __write_8(h, o, v) *((volatile u_int64_t *)((h) + (o))) = (v)
bus_space_tag_t
beb_alloc_bus_space_tag(storage)

View File

@ -1,4 +1,4 @@
/* $NetBSD: le_bus.c,v 1.13 2008/04/28 20:23:14 martin Exp $ */
/* $NetBSD: le_bus.c,v 1.14 2008/12/27 16:14:12 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.13 2008/04/28 20:23:14 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.14 2008/12/27 16:14:12 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -243,15 +243,15 @@ static inline u_int32_t swap32(u_int32_t v)
/*
* Don't force a function call overhead on these primitives...
*/
#define __read_1(h, o) *((u_int8_t *)((h) + (o)))
#define __read_2(h, o) swap16(*((u_int16_t *)((h) + (o))))
#define __read_4(h, o) swap32(*((u_int32_t *)((h) + (o))))
#define __read_8(h, o) bswap64(*((u_int64_t *)((h) + (o))))
#define __read_1(h, o) *((volatile u_int8_t *)((h) + (o)))
#define __read_2(h, o) swap16(*((volatile u_int16_t *)((h) + (o))))
#define __read_4(h, o) swap32(*((volatile u_int32_t *)((h) + (o))))
#define __read_8(h, o) bswap64(*((volatile u_int64_t *)((h) + (o))))
#define __write_1(h, o, v) *((u_int8_t *)((h) + (o))) = (v)
#define __write_2(h, o, v) *((u_int16_t *)((h) + (o))) = swap16(v)
#define __write_4(h, o, v) *((u_int32_t *)((h) + (o))) = swap32(v)
#define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = bswap64(v)
#define __write_1(h, o, v) *((volatile u_int8_t *)((h) + (o))) = (v)
#define __write_2(h, o, v) *((volatile u_int16_t *)((h) + (o))) = swap16(v)
#define __write_4(h, o, v) *((volatile u_int32_t *)((h) + (o))) = swap32(v)
#define __write_8(h, o, v) *((volatile u_int64_t *)((h) + (o))) = bswap64(v)
bus_space_tag_t
leb_alloc_bus_space_tag(storage)
@ -486,7 +486,7 @@ leb_bus_space_read_stream_2(t, h, o)
bus_space_handle_t h;
bus_size_t o;
{
return(*((u_int16_t *)(h + o)));
return(*((volatile u_int16_t *)(h + o)));
}
static u_int32_t
@ -495,7 +495,7 @@ leb_bus_space_read_stream_4(t, h, o)
bus_space_handle_t h;
bus_size_t o;
{
return(*((u_int32_t *)(h + o)));
return(*((volatile u_int32_t *)(h + o)));
}
static u_int64_t
@ -504,7 +504,7 @@ leb_bus_space_read_stream_8(t, h, o)
bus_space_handle_t h;
bus_size_t o;
{
return(*((u_int64_t *)(h + o)));
return(*((volatile u_int64_t *)(h + o)));
}
/*
@ -521,7 +521,7 @@ leb_bus_space_write_stream_2(t, h, o, v)
bus_size_t o;
u_int16_t v;
{
*((u_int16_t *)(h + o)) = v;
*((volatile u_int16_t *)(h + o)) = v;
}
static void
@ -531,7 +531,7 @@ leb_bus_space_write_stream_4(t, h, o, v)
bus_size_t o;
u_int32_t v;
{
*((u_int32_t *)(h + o)) = v;
*((volatile u_int32_t *)(h + o)) = v;
}
static void
@ -541,7 +541,7 @@ leb_bus_space_write_stream_8(t, h, o, v)
bus_size_t o;
u_int64_t v;
{
*((u_int64_t *)(h + o)) = v;
*((volatile u_int64_t *)(h + o)) = v;
}
/*
@ -668,7 +668,7 @@ leb_bus_space_read_multi_stream_2(t, h, o, a, c)
u_int16_t *a;
{
for (; c; a++, c--)
*a = *((u_int16_t *)(h + o));
*a = *((volatile u_int16_t *)(h + o));
}
static void
@ -679,7 +679,7 @@ leb_bus_space_read_multi_stream_4(t, h, o, a, c)
u_int32_t *a;
{
for (; c; a++, c--)
*a = *((u_int32_t *)(h + o));
*a = *((volatile u_int32_t *)(h + o));
}
static void
@ -690,7 +690,7 @@ leb_bus_space_read_multi_stream_8(t, h, o, a, c)
u_int64_t *a;
{
for (; c; a++, c--)
*a = *((u_int64_t *)(h + o));
*a = *((volatile u_int64_t *)(h + o));
}
/*
@ -710,7 +710,7 @@ leb_bus_space_write_multi_stream_2(t, h, o, a, c)
const u_int16_t *a;
{
for (; c; a++, c--)
*((u_int16_t *)(h + o)) = *a;
*((volatile u_int16_t *)(h + o)) = *a;
}
static void
@ -721,7 +721,7 @@ leb_bus_space_write_multi_stream_4(t, h, o, a, c)
const u_int32_t *a;
{
for (; c; a++, c--)
*((u_int32_t *)(h + o)) = *a;
*((volatile u_int32_t *)(h + o)) = *a;
}
static void
@ -732,7 +732,7 @@ leb_bus_space_write_multi_stream_8(t, h, o, a, c)
const u_int64_t *a;
{
for (; c; a++, c--)
*((u_int64_t *)(h + o)) = *a;
*((volatile u_int64_t *)(h + o)) = *a;
}
/*
@ -858,7 +858,7 @@ leb_bus_space_read_region_stream_2(t, h, o, a, c)
u_int16_t *a;
{
for (; c; a++, o += 2, c--)
*a = *(u_int16_t *)(h + o);
*a = *(volatile u_int16_t *)(h + o);
}
static void
@ -869,7 +869,7 @@ leb_bus_space_read_region_stream_4(t, h, o, a, c)
u_int32_t *a;
{
for (; c; a++, o += 4, c--)
*a = *(u_int32_t *)(h + o);
*a = *(volatile u_int32_t *)(h + o);
}
static void
@ -880,7 +880,7 @@ leb_bus_space_read_region_stream_8(t, h, o, a, c)
u_int64_t *a;
{
for (; c; a++, o += 8, c--)
*a = *(u_int64_t *)(h + o);
*a = *(volatile u_int64_t *)(h + o);
}
/*
@ -900,7 +900,7 @@ leb_bus_space_write_region_stream_2(t, h, o, a, c)
const u_int16_t *a;
{
for (; c; a++, o += 2, c--)
*((u_int16_t *)(h + o)) = *a;
*((volatile u_int16_t *)(h + o)) = *a;
}
static void
@ -911,7 +911,7 @@ leb_bus_space_write_region_stream_4(t, h, o, a, c)
const u_int32_t *a;
{
for (; c; a++, o += 4, c--)
*((u_int32_t *)(h + o)) = *a;
*((volatile u_int32_t *)(h + o)) = *a;
}
static void
@ -922,7 +922,7 @@ leb_bus_space_write_region_stream_8(t, h, o, a, c)
const u_int64_t *a;
{
for (; c; a++, o += 8, c--)
*((u_int64_t *)(h + o)) = *a;
*((volatile u_int64_t *)(h + o)) = *a;
}
/*
@ -954,7 +954,7 @@ leb_bus_space_set_multi_2(t, h, o, v, c)
{
v = swap16(v);
for (; c; c--)
*((u_int16_t *)(h + o)) = v;
*((volatile u_int16_t *)(h + o)) = v;
}
static void
@ -966,7 +966,7 @@ leb_bus_space_set_multi_4(t, h, o, v, c)
{
v = swap32(v);
for (; c; c--)
*((u_int32_t *)(h + o)) = v;
*((volatile u_int32_t *)(h + o)) = v;
}
static void
@ -978,7 +978,7 @@ leb_bus_space_set_multi_8(t, h, o, v, c)
{
v = bswap64(v);
for (; c; c--)
*((u_int64_t *)(h + o)) = v;
*((volatile u_int64_t *)(h + o)) = v;
}
/*
@ -1009,7 +1009,7 @@ leb_bus_space_set_region_2(t, h, o, v, c)
{
v = swap16(v);
for (; c; o += 2, c--)
*((u_int16_t *)(h + o)) = v;
*((volatile u_int16_t *)(h + o)) = v;
}
static void
@ -1021,7 +1021,7 @@ leb_bus_space_set_region_4(t, h, o, v, c)
{
v = swap32(v);
for (; c; o += 4, c--)
*((u_int32_t *)(h + o)) = v;
*((volatile u_int32_t *)(h + o)) = v;
}
static void
@ -1033,5 +1033,5 @@ leb_bus_space_set_region_8(t, h, o, v, c)
{
v = bswap64(v);
for (; c; o += 8, c--)
*((u_int64_t *)(h + o)) = v;
*((volatile u_int64_t *)(h + o)) = v;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.7 2008/12/19 18:49:38 cegger Exp $ */
/* $NetBSD: mainbus.c,v 1.8 2008/12/27 16:14:12 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2008/12/19 18:49:38 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2008/12/27 16:14:12 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -142,25 +142,25 @@ static void mb_bus_space_set_region_8 __P((bus_space_tag_t,
((u_long)(base) + ((off) << (stride)) + (wm))
#define __read_1(t, h, o) \
(*((u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))))
(*((volatile u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))))
#define __read_2(t, h, o) \
(*((u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))))
(*((volatile u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))))
#define __read_4(t, h, o) \
(*((u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))))
(*((volatile u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))))
#define __read_8(t, h, o) \
(*((u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))))
(*((volatile u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))))
#define __write_1(t, h, o, v) \
*((u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))) = v
*((volatile u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))) = v
#define __write_2(t, h, o, v) \
*((u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v
*((volatile u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v
#define __write_4(t, h, o, v) \
*((u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v
*((volatile u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v
#define __write_8(t, h, o, v) \
*((u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v
*((volatile u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v
bus_space_tag_t
mb_alloc_bus_space_tag()
@ -364,9 +364,9 @@ mb_bus_space_read_multi_1(t, h, o, a, c)
bus_size_t o, c;
u_int8_t *a;
{
u_int8_t *ba;
volatile u_int8_t *ba;
ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
for (; c; a++, c--)
*a = *ba;
}
@ -378,9 +378,9 @@ mb_bus_space_read_multi_2(t, h, o, a, c)
bus_size_t o, c;
u_int16_t *a;
{
u_int16_t *ba;
volatile u_int16_t *ba;
ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
for (; c; a++, c--)
*a = *ba;
}
@ -392,9 +392,9 @@ mb_bus_space_read_multi_4(t, h, o, a, c)
bus_size_t o, c;
u_int32_t *a;
{
u_int32_t *ba;
volatile u_int32_t *ba;
ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
for (; c; a++, c--)
*a = *ba;
}
@ -406,9 +406,9 @@ mb_bus_space_read_multi_8(t, h, o, a, c)
bus_size_t o, c;
u_int64_t *a;
{
u_int64_t *ba;
volatile u_int64_t *ba;
ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
for (; c; a++, c--)
*a = *ba;
}
@ -420,9 +420,9 @@ mb_bus_space_write_multi_1(t, h, o, a, c)
bus_size_t o, c;
const u_int8_t *a;
{
u_int8_t *ba;
volatile u_int8_t *ba;
ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
for (; c; a++, c--)
*ba = *a;
}
@ -434,9 +434,9 @@ mb_bus_space_write_multi_2(t, h, o, a, c)
bus_size_t o, c;
const u_int16_t *a;
{
u_int16_t *ba;
volatile u_int16_t *ba;
ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
for (; c; a++, c--)
*ba = *a;
}
@ -448,9 +448,9 @@ mb_bus_space_write_multi_4(t, h, o, a, c)
bus_size_t o, c;
const u_int32_t *a;
{
u_int32_t *ba;
volatile u_int32_t *ba;
ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
for (; c; a++, c--)
*ba = *a;
}
@ -462,9 +462,9 @@ mb_bus_space_write_multi_8(t, h, o, a, c)
bus_size_t o, c;
const u_int64_t *a;
{
u_int64_t *ba;
volatile u_int64_t *ba;
ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
for (; c; a++, c--)
*ba = *a;
}
@ -590,9 +590,9 @@ mb_bus_space_set_multi_1(t, h, o, v, c)
bus_size_t o, c;
u_int8_t v;
{
u_int8_t *ba;
volatile u_int8_t *ba;
ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
for (; c; c--)
*ba = v;
}
@ -604,9 +604,9 @@ mb_bus_space_set_multi_2(t, h, o, v, c)
bus_size_t o, c;
u_int16_t v;
{
u_int16_t *ba;
volatile u_int16_t *ba;
ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
for (; c; c--)
*ba = v;
}
@ -618,9 +618,9 @@ mb_bus_space_set_multi_4(t, h, o, v, c)
bus_size_t o, c;
u_int32_t v;
{
u_int32_t *ba;
volatile u_int32_t *ba;
ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
for (; c; c--)
*ba = v;
}
@ -632,9 +632,9 @@ mb_bus_space_set_multi_8(t, h, o, v, c)
bus_size_t o, c;
u_int64_t v;
{
u_int64_t *ba;
volatile u_int64_t *ba;
ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
for (; c; c--)
*ba = v;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc_mb.c,v 1.32 2008/04/28 20:23:15 martin Exp $ */
/* $NetBSD: wdc_mb.c,v 1.33 2008/12/27 16:14:13 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.32 2008/04/28 20:23:15 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.33 2008/12/27 16:14:13 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -277,9 +277,9 @@ read_multi_2_swap(t, h, o, a, c)
bus_size_t o, c;
u_int16_t *a;
{
u_int16_t *ba;
volatile u_int16_t *ba;
ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
for (; c; a++, c--)
*a = bswap16(*ba);
}
@ -291,9 +291,9 @@ write_multi_2_swap(t, h, o, a, c)
bus_size_t o, c;
const u_int16_t *a;
{
u_int16_t *ba;
volatile u_int16_t *ba;
ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
for (; c; a++, c--)
*ba = bswap16(*a);
}