Wed Dec 7 15:40:15 2011 UTC ()
merge. (forgot in previous)


(cegger)
diff -r1.1.1.2 -r1.2 src/sys/arch/xen/include/xen-public/io/ring.h

cvs diff -r1.1.1.2 -r1.2 src/sys/arch/xen/include/xen-public/io/Attic/ring.h (expand / switch to unified diff)

--- src/sys/arch/xen/include/xen-public/io/Attic/ring.h 2011/12/07 14:41:16 1.1.1.2
+++ src/sys/arch/xen/include/xen-public/io/Attic/ring.h 2011/12/07 15:40:15 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ring.h,v 1.1.1.2 2011/12/07 14:41:16 cegger Exp $ */ 1/* $NetBSD: ring.h,v 1.2 2011/12/07 15:40:15 cegger Exp $ */
2/****************************************************************************** 2/******************************************************************************
3 * ring.h 3 * ring.h
4 *  4 *
5 * Shared producer-consumer ring macros. 5 * Shared producer-consumer ring macros.
6 * 6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to 8 * of this software and associated documentation files (the "Software"), to
9 * deal in the Software without restriction, including without limitation the 9 * deal in the Software without restriction, including without limitation the
10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom the Software is 11 * sell copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions: 12 * furnished to do so, subject to the following conditions:
13 * 13 *
14 * The above copyright notice and this permission notice shall be included in 14 * The above copyright notice and this permission notice shall be included in
@@ -21,30 +21,38 @@ @@ -21,30 +21,38 @@
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE. 23 * DEALINGS IN THE SOFTWARE.
24 * 24 *
25 * Tim Deegan and Andrew Warfield November 2004. 25 * Tim Deegan and Andrew Warfield November 2004.
26 */ 26 */
27 27
28#ifndef __XEN_PUBLIC_IO_RING_H__ 28#ifndef __XEN_PUBLIC_IO_RING_H__
29#define __XEN_PUBLIC_IO_RING_H__ 29#define __XEN_PUBLIC_IO_RING_H__
30 30
31#include "../xen-compat.h" 31#include "../xen-compat.h"
32 32
33#if __XEN_INTERFACE_VERSION__ < 0x00030208 33#if __XEN_INTERFACE_VERSION__ < 0x00030208
 34#if defined(__Linux__)
34#define xen_mb() mb() 35#define xen_mb() mb()
35#define xen_rmb() rmb() 36#define xen_rmb() rmb()
36#define xen_wmb() wmb() 37#define xen_wmb() wmb()
37#endif 38#endif
 39#endif
 40
 41#if defined(__NetBSD__)
 42#define xen_mb() x86_mfence()
 43#define xen_rmb() x86_lfence()
 44#define xen_wmb() x86_sfence()
 45#endif
38 46
39typedef unsigned int RING_IDX; 47typedef unsigned int RING_IDX;
40 48
41/* Round a 32-bit unsigned constant down to the nearest power of two. */ 49/* Round a 32-bit unsigned constant down to the nearest power of two. */
42#define __RD2(_x) (((_x) & 0x00000002) ? 0x2 : ((_x) & 0x1)) 50#define __RD2(_x) (((_x) & 0x00000002) ? 0x2 : ((_x) & 0x1))
43#define __RD4(_x) (((_x) & 0x0000000c) ? __RD2((_x)>>2)<<2 : __RD2(_x)) 51#define __RD4(_x) (((_x) & 0x0000000c) ? __RD2((_x)>>2)<<2 : __RD2(_x))
44#define __RD8(_x) (((_x) & 0x000000f0) ? __RD4((_x)>>4)<<4 : __RD4(_x)) 52#define __RD8(_x) (((_x) & 0x000000f0) ? __RD4((_x)>>4)<<4 : __RD4(_x))
45#define __RD16(_x) (((_x) & 0x0000ff00) ? __RD8((_x)>>8)<<8 : __RD8(_x)) 53#define __RD16(_x) (((_x) & 0x0000ff00) ? __RD8((_x)>>8)<<8 : __RD8(_x))
46#define __RD32(_x) (((_x) & 0xffff0000) ? __RD16((_x)>>16)<<16 : __RD16(_x)) 54#define __RD32(_x) (((_x) & 0xffff0000) ? __RD16((_x)>>16)<<16 : __RD16(_x))
47 55
48/* 56/*
49 * Calculate size of a shared ring, given the total available space for the 57 * Calculate size of a shared ring, given the total available space for the
50 * ring and indexes (_sz), and the name tag of the request/response structure. 58 * ring and indexes (_sz), and the name tag of the request/response structure.