aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/io.h')
-rw-r--r--include/asm-mips/io.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 8c011aa61af..ba1d7bbc15d 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994, 1995 Waldorf GmbH 6 * Copyright (C) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000 Ralf Baechle 7 * Copyright (C) 1994 - 2000, 06 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
10 * Author: Maciej W. Rozycki <macro@mips.com> 10 * Author: Maciej W. Rozycki <macro@mips.com>
@@ -103,8 +103,20 @@
103 */ 103 */
104extern const unsigned long mips_io_port_base; 104extern const unsigned long mips_io_port_base;
105 105
106#define set_io_port_base(base) \ 106/*
107 do { * (unsigned long *) &mips_io_port_base = (base); } while (0) 107 * Gcc will generate code to load the value of mips_io_port_base after each
108 * function call which may be fairly wasteful in some cases. So we don't
109 * play quite by the book. We tell gcc mips_io_port_base is a long variable
110 * which solves the code generation issue. Now we need to violate the
111 * aliasing rules a little to make initialization possible and finally we
112 * will need the barrier() to fight side effects of the aliasing chat.
113 * This trickery will eventually collapse under gcc's optimizer. Oh well.
114 */
115static inline void set_io_port_base(unsigned long base)
116{
117 * (unsigned long *) &mips_io_port_base = base;
118 barrier();
119}
108 120
109/* 121/*
110 * Thanks to James van Artsdalen for a better timing-fix than 122 * Thanks to James van Artsdalen for a better timing-fix than