2011-10-21 13:38:55 +00:00
|
|
|
From 88ea1d878356897c04ea06008e82a8e10daf6a03 Mon Sep 17 00:00:00 2001
|
2010-10-26 08:31:54 +00:00
|
|
|
From: Peter Lemenkov <lemenkov@gmail.com>
|
|
|
|
Date: Sun, 26 Sep 2010 21:05:50 +0400
|
2011-10-21 13:38:55 +00:00
|
|
|
Subject: [PATCH 07/10] Use HAVE_*_H macro for detecting includes
|
2010-10-26 08:31:54 +00:00
|
|
|
|
|
|
|
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
|
|
|
---
|
2011-10-21 13:38:55 +00:00
|
|
|
hwaccess.h | 72 +++++++++++++++++++++++++++++++++++++++++++----------------
|
|
|
|
1 files changed, 52 insertions(+), 20 deletions(-)
|
2010-10-26 08:31:54 +00:00
|
|
|
|
|
|
|
diff --git a/hwaccess.h b/hwaccess.h
|
2011-10-21 13:38:55 +00:00
|
|
|
index 5188a98..85c556d 100644
|
2010-10-26 08:31:54 +00:00
|
|
|
--- a/hwaccess.h
|
|
|
|
+++ b/hwaccess.h
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -24,11 +24,11 @@
|
|
|
|
#ifndef __HWACCESS_H__
|
|
|
|
#define __HWACCESS_H__ 1
|
2010-10-26 08:31:54 +00:00
|
|
|
|
|
|
|
-#if defined (__i386__) || defined (__x86_64__)
|
|
|
|
-#if defined(__GLIBC__)
|
2011-10-21 13:38:55 +00:00
|
|
|
+#include "config.h"
|
|
|
|
+
|
2010-10-26 08:31:54 +00:00
|
|
|
+#if defined (HAVE_SYS_IO_H)
|
|
|
|
#include <sys/io.h>
|
|
|
|
-#endif
|
|
|
|
-#endif
|
|
|
|
+#endif /* defined (HAVE_SYS_IO_H) */
|
|
|
|
|
2011-10-21 13:38:55 +00:00
|
|
|
#if NEED_PCI == 1
|
2010-10-26 08:31:54 +00:00
|
|
|
/*
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -39,7 +39,47 @@
|
2010-10-26 08:31:54 +00:00
|
|
|
#define index shadow_workaround_index
|
|
|
|
#include <pci/pci.h>
|
|
|
|
#undef index
|
|
|
|
-#endif
|
|
|
|
+
|
|
|
|
+#if defined (HAVE_STRINGS_H)
|
|
|
|
+#include <strings.h>
|
|
|
|
+#endif /* defined (HAVE_STRINGS_H) */
|
|
|
|
+
|
|
|
|
+#if defined (HAVE_STDINT_H)
|
|
|
|
+#include <stdint.h>
|
|
|
|
+#endif /* defined (HAVE_STDINT_H) */
|
|
|
|
+
|
|
|
|
+#if defined (HAVE_SYS_TYPES_H)
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#endif /* defined (HAVE_SYS_TYPES_H) */
|
|
|
|
+
|
|
|
|
+#if defined (HAVE_MACHINE_SYSARCH_H)
|
|
|
|
+#include <machine/sysarch.h>
|
|
|
|
+#endif /* defined (HAVE_MACHINE_SYSARCH_H) */
|
|
|
|
+
|
|
|
|
+#if defined (HAVE_MACHINE_CPUFUNC_H)
|
|
|
|
+#include <machine/cpufunc.h>
|
|
|
|
+#endif /* defined (HAVE_MACHINE_CPUFUNC_H) */
|
|
|
|
+
|
|
|
|
+/* for iopl and outb under Solaris */
|
|
|
|
+#if defined HAVE_ASM_SUNDDI_H
|
|
|
|
+#include <asm/sunddi.h>
|
|
|
|
+#endif /* defined HAVE_ASM_SUNDDI_H */
|
|
|
|
+#if defined HAVE_SYS_SYSI86_H
|
|
|
|
+#include <sys/sysi86.h>
|
|
|
|
+#endif /* defined HAVE_SYS_SYSI86_H */
|
|
|
|
+#if defined HAVE_SYS_PSW_H
|
|
|
|
+#include <sys/psw.h>
|
|
|
|
+#endif /* defined HAVE_SYS_PSW_H */
|
|
|
|
+
|
|
|
|
+#ifdef __DJGPP__
|
|
|
|
+#include <pc.h>
|
|
|
|
+#endif /* __DJGPP__ */
|
|
|
|
+
|
|
|
|
+#if defined HAVE_DIRECTIO_DARWINIO_H
|
|
|
|
+#include <DirectIO/darwinio.h>
|
|
|
|
+#endif /* defined HAVE_DIRECTIO_DARWINIO_H */
|
|
|
|
+
|
|
|
|
+#endif /* defined (HAVE_LIBPCI) */
|
|
|
|
|
|
|
|
#define ___constant_swab8(x) ((uint8_t) ( \
|
|
|
|
(((uint8_t)(x) & (uint8_t)0xffU))))
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -112,18 +152,13 @@ cpu_to_be(64)
|
2011-03-09 11:11:12 +00:00
|
|
|
#define le_to_cpu64 cpu_to_le64
|
|
|
|
|
2011-10-21 13:38:55 +00:00
|
|
|
#if NEED_PCI == 1
|
2011-03-09 11:11:12 +00:00
|
|
|
+
|
|
|
|
+/* PCI port I/O is not yet implemented on PowerPC. */
|
|
|
|
+/* PCI port I/O is not yet implemented on MIPS. */
|
2010-10-26 08:31:54 +00:00
|
|
|
#if defined (__i386__) || defined (__x86_64__)
|
|
|
|
|
2011-03-09 11:11:12 +00:00
|
|
|
#define __FLASHROM_HAVE_OUTB__ 1
|
|
|
|
|
2010-10-26 08:31:54 +00:00
|
|
|
-/* for iopl and outb under Solaris */
|
|
|
|
-#if defined (__sun) && (defined(__i386) || defined(__amd64))
|
|
|
|
-#include <strings.h>
|
|
|
|
-#include <sys/sysi86.h>
|
|
|
|
-#include <sys/psw.h>
|
|
|
|
-#include <asm/sunddi.h>
|
|
|
|
-#endif
|
2011-03-09 11:11:12 +00:00
|
|
|
-
|
2010-10-26 08:31:54 +00:00
|
|
|
#if (defined(__MACH__) && defined(__APPLE__))
|
|
|
|
#define __DARWIN__
|
2011-03-09 11:11:12 +00:00
|
|
|
#endif
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -133,7 +168,6 @@ cpu_to_be(64)
|
2010-10-26 08:31:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
- #include <machine/cpufunc.h>
|
|
|
|
#define off64_t off_t
|
|
|
|
#define lseek64 lseek
|
|
|
|
#define OUTB(x, y) do { u_int outb_tmp = (y); outb(outb_tmp, (x)); } while (0)
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -161,8 +195,6 @@ cpu_to_be(64)
|
2010-10-26 08:31:54 +00:00
|
|
|
|
|
|
|
#ifdef __DJGPP__
|
|
|
|
|
|
|
|
-#include <pc.h>
|
|
|
|
-
|
|
|
|
#define OUTB(x,y) outportb(y, x)
|
|
|
|
#define OUTW(x,y) outportw(y, x)
|
|
|
|
#define OUTL(x,y) outportl(y, x)
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -189,8 +221,6 @@ cpu_to_be(64)
|
2010-10-26 08:31:54 +00:00
|
|
|
#define off64_t off_t
|
|
|
|
#define lseek64 lseek
|
|
|
|
#if defined(__i386__) || defined(__x86_64__)
|
|
|
|
- #include <sys/types.h>
|
|
|
|
- #include <machine/sysarch.h>
|
|
|
|
#if defined(__NetBSD__)
|
|
|
|
#if defined(__i386__)
|
|
|
|
#define iopl i386_iopl
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -247,7 +277,8 @@ static inline uint32_t inl(uint16_t port)
|
2011-03-09 11:11:12 +00:00
|
|
|
typedef struct { uint32_t hi, lo; } msr_t;
|
|
|
|
msr_t rdmsr(int addr);
|
|
|
|
int wrmsr(int addr, msr_t msr);
|
|
|
|
-#endif
|
|
|
|
+#endif /* !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(__DragonFly__) */
|
|
|
|
+
|
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
/* FreeBSD already has conflicting definitions for wrmsr/rdmsr. */
|
|
|
|
#undef rdmsr
|
2011-10-21 13:38:55 +00:00
|
|
|
@@ -257,7 +288,8 @@ int wrmsr(int addr, msr_t msr);
|
2011-03-09 11:11:12 +00:00
|
|
|
typedef struct { uint32_t hi, lo; } msr_t;
|
|
|
|
msr_t freebsd_rdmsr(int addr);
|
|
|
|
int freebsd_wrmsr(int addr, msr_t msr);
|
|
|
|
-#endif
|
|
|
|
+#endif /* defined(__FreeBSD__) || defined(__DragonFly__) */
|
|
|
|
+
|
|
|
|
#if defined(__LIBPAYLOAD__)
|
|
|
|
#include <arch/io.h>
|
|
|
|
#include <arch/msr.h>
|
2010-10-26 08:31:54 +00:00
|
|
|
--
|
2011-10-21 13:38:55 +00:00
|
|
|
1.7.6.4
|
2010-10-26 08:31:54 +00:00
|
|
|
|