aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2008-01-10 09:45:05 +0100
committerReinhard Tartler <siretart@tauware.de>2008-01-10 09:45:05 +0100
commitc724649a69607b3c76ad554d0700b2e9f53d63b8 (patch)
tree39ace7d2f02a0989a66ec7ccf36a81f450f77069
parent3e23b791eeb822bb2d7d6b9a5376675c0cf4bfe8 (diff)
downloadlcd4linux-c724649a69607b3c76ad554d0700b2e9f53d63b8.tar.gz
import commit 809 from trunk to fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=436332
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure145
-rw-r--r--configure.in1
-rw-r--r--udelay.c118
4 files changed, 12 insertions, 255 deletions
diff --git a/config.h.in b/config.h.in
index ed264ef..76abc47 100644
--- a/config.h.in
+++ b/config.h.in
@@ -12,9 +12,6 @@
/* Define to 1 if you have the <asm/io.h> header file. */
#undef HAVE_ASM_IO_H
-/* Define to 1 if you have the <asm/msr.h> header file. */
-#undef HAVE_ASM_MSR_H
-
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
diff --git a/configure b/configure
index c0599d5..554961e 100755
--- a/configure
+++ b/configure
@@ -10993,151 +10993,6 @@ fi
done
-for ac_header in asm/msr.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ---------------------------------------------------- ##
-## Report this to lcd4linux-users@lists.sourceforge.net ##
-## ---------------------------------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
# Checks for typedefs, structures, and compiler characteristics.
{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
diff --git a/configure.in b/configure.in
index ab86cf3..4e35860 100644
--- a/configure.in
+++ b/configure.in
@@ -99,7 +99,6 @@ AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/vfs.h syslog.h termios.h unistd.h])
AC_CHECK_HEADERS(sys/io.h asm/io.h)
AC_CHECK_HEADERS(linux/parport.h linux/ppdev.h)
-AC_CHECK_HEADERS(asm/msr.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff --git a/udelay.c b/udelay.c
index 3dafaac..8cdee92 100644
--- a/udelay.c
+++ b/udelay.c
@@ -55,11 +55,6 @@
#include <string.h>
#include <sys/time.h>
-#ifdef HAVE_ASM_MSR_H
-#define u32 unsigned int
-#include <asm/msr.h>
-#endif
-
#include "debug.h"
#include "cfg.h"
@@ -67,79 +62,10 @@
#include "udelay.h"
-static unsigned int ticks_per_usec = 0;
-
-
-static void getCPUinfo(int *hasTSC, double *MHz)
-{
- int fd;
- char buffer[4096], *p;
-
- *hasTSC = 0;
- *MHz = -1;
-
- fd = open("/proc/cpuinfo", O_RDONLY);
- if (fd == -1) {
- error("udelay: open(/proc/cpuinfo) failed: %s", strerror(errno));
- return;
- }
- if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
- error("udelay: read(/proc/cpuinfo) failed: %s", strerror(errno));
- close(fd);
- return;
- }
- close(fd);
-
- p = strstr(buffer, "flags");
- if (p == NULL) {
- info("udelay: /proc/cpuinfo has no 'flags' line");
- } else {
- p = strstr(p, "tsc");
- if (p == NULL) {
- info("udelay: CPU does not support Time Stamp Counter");
- } else {
- info("udelay: CPU supports Time Stamp Counter");
- *hasTSC = 1;
- }
- }
-
- p = strstr(buffer, "cpu MHz");
- if (p == NULL) {
- info("udelay: /proc/cpuinfo has no 'cpu MHz' line");
- } else {
- if (sscanf(p + 7, " : %lf", MHz) != 1) {
- error("udelay: parse(/proc/cpuinfo) failed: unknown 'cpu MHz' format");
- *MHz = -1;
- } else {
- info("udelay: CPU runs at %f MHz", *MHz);
- }
- }
-
-}
-
void udelay_init(void)
{
-#ifdef HAVE_ASM_MSR_H
-
- int tsc;
- double mhz;
-
- getCPUinfo(&tsc, &mhz);
-
- if (tsc && mhz > 0.0) {
- ticks_per_usec = ceil(mhz);
- info("udelay: using TSC delay loop, %u ticks per microsecond", ticks_per_usec);
- } else
-#else
- error("udelay: The file 'include/asm/msr.h' was missing at compile time.");
- error("udelay: Even if your CPU supports TSC, it will not be used!");
- error("udelay: You *really* should install msr.h and recompile LCD4linux!");
-#endif
- {
- ticks_per_usec = 0;
- info("udelay: using gettimeofday() delay loop");
- }
+ info("udelay: using gettimeofday() delay loop");
}
@@ -172,37 +98,17 @@ unsigned long timing(const char *driver, const char *section, const char *name,
void ndelay(const unsigned long nsec)
{
-#ifdef HAVE_ASM_MSR_H
-
- if (ticks_per_usec) {
-
- unsigned int t1, t2;
- unsigned long tsc;
+ struct timeval now, end;
- tsc = (nsec * ticks_per_usec + 999) / 1000;
-
- rdtscl(t1);
- do {
- rep_nop();
- rdtscl(t2);
- } while ((t2 - t1) < tsc);
-
- } else
-#endif
-
- {
- struct timeval now, end;
-
- gettimeofday(&end, NULL);
- end.tv_usec += (nsec + 999) / 1000;
- while (end.tv_usec > 1000000) {
- end.tv_usec -= 1000000;
- end.tv_sec++;
- }
-
- do {
- rep_nop();
- gettimeofday(&now, NULL);
- } while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
+ gettimeofday(&end, NULL);
+ end.tv_usec += (nsec + 999) / 1000;
+ while (end.tv_usec > 1000000) {
+ end.tv_usec -= 1000000;
+ end.tv_sec++;
}
+
+ do {
+ rep_nop();
+ gettimeofday(&now, NULL);
+ } while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
}