From 342ebce798fe98ede64939a49bbc3770d8214649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 May 2016 22:59:02 +0200 Subject: Imported Upstream version 1.8.17 --- src/plugins/imb/Makefile.am | 2 +- src/plugins/imb/Makefile.in | 2 +- src/plugins/imb/imb.c | 1 + src/plugins/imb/imbapi.c | 41 +++++++++++++++++++++++++++++++++-------- src/plugins/imb/imbapi.h | 5 +---- 5 files changed, 37 insertions(+), 14 deletions(-) (limited to 'src/plugins/imb') diff --git a/src/plugins/imb/Makefile.am b/src/plugins/imb/Makefile.am index 91d5966..6f1b68c 100644 --- a/src/plugins/imb/Makefile.am +++ b/src/plugins/imb/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_imb.la noinst_LTLIBRARIES = @INTF_IMB_LIB@ diff --git a/src/plugins/imb/Makefile.in b/src/plugins/imb/Makefile.in index d1ded78..1e40e15 100644 --- a/src/plugins/imb/Makefile.in +++ b/src/plugins/imb/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_imb.la noinst_LTLIBRARIES = @INTF_IMB_LIB@ libintf_imb_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/imb/imb.c b/src/plugins/imb/imb.c index 0044159..1514fa7 100644 --- a/src/plugins/imb/imb.c +++ b/src/plugins/imb/imb.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "imbapi.h" diff --git a/src/plugins/imb/imbapi.c b/src/plugins/imb/imbapi.c index 899c47a..84eec2e 100644 --- a/src/plugins/imb/imbapi.c +++ b/src/plugins/imb/imbapi.c @@ -97,7 +97,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #endif #include "imbapi.h" -#include +#include #ifdef SCO_UW #define NO_MACRO_ARGS 1 @@ -105,9 +105,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define IMB_DEVICE "/dev/instru/mismic" #else #define IMB_DEVICE "/dev/imb" -#ifndef PAGESIZE -# define PAGESIZE EXEC_PAGESIZE #endif + +#if !defined(PAGESIZE) && defined(PAGE_SIZE) +# define PAGESIZE PAGE_SIZE +#endif + +#if !defined(_SC_PAGESIZE) && defined(_SC_PAGE_SIZE) +# define _SC_PAGESIZE _SC_PAGE_SIZE #endif /*Just to make the DEBUG code cleaner.*/ @@ -545,7 +550,7 @@ SendTimedI2cRequest ( if( status != TRUE ) { DWORD error; error = GetLastError(); - return ACCESN_ERROR; + return error; } if( respLength == 0 ) { return ACCESN_ERROR; @@ -1134,7 +1139,7 @@ SendTimedImbpRequest ( if( status != TRUE ) { DWORD error; error = GetLastError(); - return ACCESN_ERROR; + return error; } if( respLength == 0 ) { return ACCESN_ERROR; @@ -1211,7 +1216,7 @@ SendAsyncImbpRequest ( if( status != TRUE ) { DWORD error; error = GetLastError(); - return ACCESN_ERROR; + return error; } if( respLength != 2 ) { return ACCESN_ERROR; @@ -1985,6 +1990,16 @@ MapPhysicalMemory(int startAddress,int addressLength, int *virtualAddress ) off_t startpAddress = (off_t)startAddress; unsigned int diff; char *startvAddress; +#if defined(PAGESIZE) + long int pagesize = PAGESIZE; +#elif defined(_SC_PAGESIZE) + long int pagesize = sysconf(_SC_PAGESIZE); + if (pagesize < 1) { + perror("Invalid pagesize"); + } +#else +# error PAGESIZE unsupported +#endif if ((startAddress == 0) || (addressLength <= 0)) return ACCESN_ERROR; @@ -1999,7 +2014,7 @@ MapPhysicalMemory(int startAddress,int addressLength, int *virtualAddress ) } /* aliging the offset to a page boundary and adjusting the length */ - diff = (int)startpAddress % PAGESIZE; + diff = (int)startpAddress % pagesize; startpAddress -= diff; length += diff; @@ -2043,9 +2058,19 @@ ACCESN_STATUS UnmapPhysicalMemory( int virtualAddress, int Length ) { unsigned int diff = 0; +#if defined(PAGESIZE) + long int pagesize = PAGESIZE; +#elif defined(_SC_PAGESIZE) + long int pagesize = sysconf(_SC_PAGESIZE); + if (pagesize < 1) { + perror("Invalid pagesize"); + } +#else +# error PAGESIZE unsupported +#endif /* page align the virtual address and adjust length accordingly */ - diff = ((unsigned int) virtualAddress) % PAGESIZE; + diff = ((unsigned int) virtualAddress) % pagesize; virtualAddress -= diff; Length += diff; #ifndef NO_MACRO_ARGS diff --git a/src/plugins/imb/imbapi.h b/src/plugins/imb/imbapi.h index 74975c6..6ba4121 100644 --- a/src/plugins/imb/imbapi.h +++ b/src/plugins/imb/imbapi.h @@ -46,10 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #ifndef WIN32 /* WIN32 defines this in stdio.h */ -#ifndef _WCHAR_T -#define _WCHAR_T -typedef long wchar_t; -#endif +#include #endif #define far #define near -- cgit v1.2.3