summaryrefslogtreecommitdiffstats
path: root/purgatory
diff options
context:
space:
mode:
authorBernhard Walle <bwalle@suse.de>2008-06-03 09:33:57 +0200
committerSimon Horman <horms@verge.net.au>2008-06-12 12:08:15 +1000
commit0f0a2228f79106e8d003147cec71a7dd608d4f49 (patch)
tree7da8c6567344d61c6fcafa3ad6c387e8c98111cc /purgatory
parent1bcd04baaa3091410bf33758d1422ff172254da1 (diff)
downloadkexec-tools-0f0a2228f79106e8d003147cec71a7dd608d4f49.tar.gz
Fix implicit declaration of inb/outb
This patch fixes following compiler warning: purgatory/arch/i386/console-x86.c:84: \ warning: implicit declaration of function `outb' purgatory/arch/i386/console-x86.c:89: \ warning: implicit declaration of function `inb' Found on x86_64. The problem did not happen with i386. Fix tested on x86_64-suse-linux and i586-suse-linux. I also added __always_inline__ to make sure that the function gets always inlined, regardless of optimisation compiler flags. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'purgatory')
-rw-r--r--purgatory/arch/i386/include/arch/io.h42
-rw-r--r--purgatory/arch/x86_64/include/arch/io.h40
2 files changed, 31 insertions, 51 deletions
diff --git a/purgatory/arch/i386/include/arch/io.h b/purgatory/arch/i386/include/arch/io.h
index 13ad8871..0a9430a5 100644
--- a/purgatory/arch/i386/include/arch/io.h
+++ b/purgatory/arch/i386/include/arch/io.h
@@ -1,10 +1,11 @@
-#ifndef ARCH_IO_H
-#define ARCH_IO_H
+#ifndef ARCH_I386_IO_H
+#define ARCH_I386_IO_H
#include <stdint.h>
/* Helper functions for directly doing I/O */
-extern inline uint8_t inb(uint16_t port)
+static inline __attribute__((__always_inline__))
+uint8_t inb(uint16_t port)
{
uint8_t result;
@@ -15,7 +16,8 @@ extern inline uint8_t inb(uint16_t port)
return result;
}
-extern inline uint16_t inw(uint16_t port)
+static inline __attribute__((__always_inline__))
+uint16_t inw(uint16_t port)
{
uint16_t result;
@@ -26,7 +28,8 @@ extern inline uint16_t inw(uint16_t port)
return result;
}
-extern inline uint32_t inl(uint32_t port)
+static inline __attribute__((__always_inline__))
+uint32_t inl(uint32_t port)
{
uint32_t result;
@@ -37,7 +40,8 @@ extern inline uint32_t inl(uint32_t port)
return result;
}
-extern inline void outb (uint8_t value, uint16_t port)
+static inline __attribute__((__always_inline__))
+void outb (uint8_t value, uint16_t port)
{
__asm__ __volatile__ (
"outb %b0,%w1"
@@ -45,7 +49,8 @@ extern inline void outb (uint8_t value, uint16_t port)
:"a" (value), "Nd" (port));
}
-extern inline void outw (uint16_t value, uint16_t port)
+static inline __attribute__((__always_inline__))
+void outw (uint16_t value, uint16_t port)
{
__asm__ __volatile__ (
"outw %w0,%w1"
@@ -53,7 +58,8 @@ extern inline void outw (uint16_t value, uint16_t port)
:"a" (value), "Nd" (port));
}
-extern inline void outl (uint32_t value, uint16_t port)
+static inline __attribute__((__always_inline__))
+void outl (uint32_t value, uint16_t port)
{
__asm__ __volatile__ (
"outl %0,%w1"
@@ -69,30 +75,36 @@ extern inline void outl (uint32_t value, uint16_t port)
* memory location directly.
*/
-static inline unsigned char readb(const volatile void *addr)
+static inline __attribute__((__always_inline__))
+unsigned char readb(const volatile void *addr)
{
return *(volatile unsigned char *) addr;
}
-static inline unsigned short readw(const volatile void *addr)
+static inline __attribute__((__always_inline__))
+unsigned short readw(const volatile void *addr)
{
return *(volatile unsigned short *) addr;
}
-static inline unsigned int readl(const volatile void *addr)
+static inline __attribute__((__always_inline__))
+unsigned int readl(const volatile void *addr)
{
return *(volatile unsigned int *) addr;
}
-static inline void writeb(unsigned char b, volatile void *addr)
+static inline __attribute__((__always_inline__))
+void writeb(unsigned char b, volatile void *addr)
{
*(volatile unsigned char *) addr = b;
}
-static inline void writew(unsigned short b, volatile void *addr)
+static inline __attribute__((__always_inline__))
+void writew(unsigned short b, volatile void *addr)
{
*(volatile unsigned short *) addr = b;
}
-static inline void writel(unsigned int b, volatile void *addr)
+static inline __attribute__((__always_inline__))
+void writel(unsigned int b, volatile void *addr)
{
*(volatile unsigned int *) addr = b;
}
-#endif /* ARCH_IO_H */
+#endif /* ARCH_I386_IO_H */
diff --git a/purgatory/arch/x86_64/include/arch/io.h b/purgatory/arch/x86_64/include/arch/io.h
index dcd01bf5..464cd146 100644
--- a/purgatory/arch/x86_64/include/arch/io.h
+++ b/purgatory/arch/x86_64/include/arch/io.h
@@ -1,39 +1,7 @@
-#ifndef ARCH_IO_H
-#define ARCH_IO_H
+#ifndef ARCH_X86_64_IO_H
+#define ARCH_X86_64_IO_H
#include <stdint.h>
+#include "../../../i386/include/arch/io.h"
-/*
- * readX/writeX() are used to access memory mapped devices. On some
- * architectures the memory mapped IO stuff needs to be accessed
- * differently. On the x86 architecture, we just read/write the
- * memory location directly.
- */
-
-static inline unsigned char readb(const volatile void *addr)
-{
- return *(volatile unsigned char *) addr;
-}
-static inline unsigned short readw(const volatile void *addr)
-{
- return *(volatile unsigned short *) addr;
-}
-static inline unsigned int readl(const volatile void *addr)
-{
- return *(volatile unsigned int *) addr;
-}
-
-static inline void writeb(unsigned char b, volatile void *addr)
-{
- *(volatile unsigned char *) addr = b;
-}
-static inline void writew(unsigned short b, volatile void *addr)
-{
- *(volatile unsigned short *) addr = b;
-}
-static inline void writel(unsigned int b, volatile void *addr)
-{
- *(volatile unsigned int *) addr = b;
-}
-
-#endif /* ARCH_IO_H */
+#endif /* ARCH_X86_64_IO_H */