Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 243114 | Differences between
and this patch

Collapse All | Expand All

(-)lcd4linux-0.10.0.orig/configure.in (-1 lines)
Lines 87-93 Link Here
87
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/statfs.h sys/vfs.h sys/time.h syslog.h termios.h unistd.h])
87
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/statfs.h sys/vfs.h sys/time.h syslog.h termios.h unistd.h])
88
AC_CHECK_HEADERS(sys/io.h asm/io.h)
88
AC_CHECK_HEADERS(sys/io.h asm/io.h)
89
AC_CHECK_HEADERS(linux/parport.h linux/ppdev.h)
89
AC_CHECK_HEADERS(linux/parport.h linux/ppdev.h)
90
AC_CHECK_HEADERS(asm/msr.h)
91
90
92
# Checks for typedefs, structures, and compiler characteristics.
91
# Checks for typedefs, structures, and compiler characteristics.
93
AC_C_CONST
92
AC_C_CONST
(-)lcd4linux-0.10.0.orig/udelay.c (-94 lines)
Lines 147-156 Link Here
147
#include <string.h>
147
#include <string.h>
148
#include <sys/time.h>
148
#include <sys/time.h>
149
149
150
#ifdef HAVE_ASM_MSR_H
151
#include <asm/msr.h>
152
#endif
153
154
#endif
150
#endif
155
151
156
152
Lines 201-304 Link Here
201
197
202
#else
198
#else
203
199
204
static unsigned int ticks_per_usec = 0;
205
206
static void getCPUinfo(int *hasTSC, double *MHz)
207
{
208
    int fd;
209
    char buffer[4096], *p;
210
211
    *hasTSC = 0;
212
    *MHz = -1;
213
214
    fd = open("/proc/cpuinfo", O_RDONLY);
215
    if (fd == -1) {
216
	error("udelay: open(/proc/cpuinfo) failed: %s", strerror(errno));
217
	return;
218
    }
219
    if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
220
	error("udelay: read(/proc/cpuinfo) failed: %s", strerror(errno));
221
	close(fd);
222
	return;
223
    }
224
    close(fd);
225
226
    p = strstr(buffer, "flags");
227
    if (p == NULL) {
228
	info("udelay: /proc/cpuinfo has no 'flags' line");
229
    } else {
230
	p = strstr(p, "tsc");
231
	if (p == NULL) {
232
	    info("udelay: CPU does not support Time Stamp Counter");
233
	} else {
234
	    info("udelay: CPU supports Time Stamp Counter");
235
	    *hasTSC = 1;
236
	}
237
    }
238
239
    p = strstr(buffer, "cpu MHz");
240
    if (p == NULL) {
241
	info("udelay: /proc/cpuinfo has no 'cpu MHz' line");
242
    } else {
243
	if (sscanf(p + 7, " : %lf", MHz) != 1) {
244
	    error("udelay: parse(/proc/cpuinfo) failed: unknown 'cpu MHz' format");
245
	    *MHz = -1;
246
	} else {
247
	    info("udelay: CPU runs at %f MHz", *MHz);
248
	}
249
    }
250
251
}
252
253
200
254
void udelay_init(void)
201
void udelay_init(void)
255
{
202
{
256
#ifdef HAVE_ASM_MSR_H
257
258
    int tsc;
259
    double mhz;
260
261
    getCPUinfo(&tsc, &mhz);
262
263
    if (tsc && mhz > 0.0) {
264
	ticks_per_usec = ceil(mhz);
265
	info("udelay: using TSC delay loop, %u ticks per microsecond", ticks_per_usec);
266
    } else
267
#else
268
    error("udelay: The file 'include/asm/msr.h' was missing at compile time.");
269
    error("udelay: Even if your CPU supports TSC, it will not be used!");
270
    error("udelay: You *really* should install msr.h and recompile LCD4linux!");
271
#endif
272
273
    {
274
	ticks_per_usec = 0;
275
	info("udelay: using gettimeofday() delay loop");
203
	info("udelay: using gettimeofday() delay loop");
276
    }
277
}
204
}
278
205
279
206
280
void ndelay(const unsigned long nsec)
207
void ndelay(const unsigned long nsec)
281
{
208
{
282
283
#ifdef HAVE_ASM_MSR_H
284
285
    if (ticks_per_usec) {
286
287
	unsigned int t1, t2;
288
	unsigned long tsc;
289
290
	tsc = (nsec * ticks_per_usec + 999) / 1000;
291
292
	rdtscl(t1);
293
	do {
294
	    rep_nop();
295
	    rdtscl(t2);
296
	} while ((t2 - t1) < tsc);
297
298
    } else
299
#endif
300
301
    {
302
	struct timeval now, end;
209
	struct timeval now, end;
303
210
304
	gettimeofday(&end, NULL);
211
	gettimeofday(&end, NULL);
Lines 312-318 Link Here
312
	    rep_nop();
219
	    rep_nop();
313
	    gettimeofday(&now, NULL);
220
	    gettimeofday(&now, NULL);
314
	} while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
221
	} while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
315
    }
316
}
222
}
317
223
318
#endif
224
#endif
(-)lcd4linux-0.10.0.orig/config.h.in (-3 lines)
Lines 12-20 Link Here
12
/* Define to 1 if you have the <asm/io.h> header file. */
12
/* Define to 1 if you have the <asm/io.h> header file. */
13
#undef HAVE_ASM_IO_H
13
#undef HAVE_ASM_IO_H
14
14
15
/* Define to 1 if you have the <asm/msr.h> header file. */
16
#undef HAVE_ASM_MSR_H
17
18
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
15
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
19
   */
16
   */
20
#undef HAVE_DIRENT_H
17
#undef HAVE_DIRENT_H
(-)lcd4linux-0.10.0.orig/configure (-150 lines)
Lines 8303-8458 Link Here
8303
8303
8304
done
8304
done
8305
8305
8306
8307
for ac_header in asm/msr.h
8308
do
8309
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
8310
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8311
  echo "$as_me:$LINENO: checking for $ac_header" >&5
8312
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8313
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8314
  echo $ECHO_N "(cached) $ECHO_C" >&6
8315
fi
8316
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8317
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8318
else
8319
  # Is the header compilable?
8320
echo "$as_me:$LINENO: checking $ac_header usability" >&5
8321
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
8322
cat >conftest.$ac_ext <<_ACEOF
8323
/* confdefs.h.  */
8324
_ACEOF
8325
cat confdefs.h >>conftest.$ac_ext
8326
cat >>conftest.$ac_ext <<_ACEOF
8327
/* end confdefs.h.  */
8328
$ac_includes_default
8329
#include <$ac_header>
8330
_ACEOF
8331
rm -f conftest.$ac_objext
8332
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8333
  (eval $ac_compile) 2>conftest.er1
8334
  ac_status=$?
8335
  grep -v '^ *+' conftest.er1 >conftest.err
8336
  rm -f conftest.er1
8337
  cat conftest.err >&5
8338
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8339
  (exit $ac_status); } &&
8340
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
8341
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8342
  (eval $ac_try) 2>&5
8343
  ac_status=$?
8344
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8345
  (exit $ac_status); }; } &&
8346
	 { ac_try='test -s conftest.$ac_objext'
8347
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8348
  (eval $ac_try) 2>&5
8349
  ac_status=$?
8350
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8351
  (exit $ac_status); }; }; then
8352
  ac_header_compiler=yes
8353
else
8354
  echo "$as_me: failed program was:" >&5
8355
sed 's/^/| /' conftest.$ac_ext >&5
8356
8357
ac_header_compiler=no
8358
fi
8359
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
8360
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
8361
echo "${ECHO_T}$ac_header_compiler" >&6
8362
8363
# Is the header present?
8364
echo "$as_me:$LINENO: checking $ac_header presence" >&5
8365
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
8366
cat >conftest.$ac_ext <<_ACEOF
8367
/* confdefs.h.  */
8368
_ACEOF
8369
cat confdefs.h >>conftest.$ac_ext
8370
cat >>conftest.$ac_ext <<_ACEOF
8371
/* end confdefs.h.  */
8372
#include <$ac_header>
8373
_ACEOF
8374
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
8375
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
8376
  ac_status=$?
8377
  grep -v '^ *+' conftest.er1 >conftest.err
8378
  rm -f conftest.er1
8379
  cat conftest.err >&5
8380
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8381
  (exit $ac_status); } >/dev/null; then
8382
  if test -s conftest.err; then
8383
    ac_cpp_err=$ac_c_preproc_warn_flag
8384
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
8385
  else
8386
    ac_cpp_err=
8387
  fi
8388
else
8389
  ac_cpp_err=yes
8390
fi
8391
if test -z "$ac_cpp_err"; then
8392
  ac_header_preproc=yes
8393
else
8394
  echo "$as_me: failed program was:" >&5
8395
sed 's/^/| /' conftest.$ac_ext >&5
8396
8397
  ac_header_preproc=no
8398
fi
8399
rm -f conftest.err conftest.$ac_ext
8400
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
8401
echo "${ECHO_T}$ac_header_preproc" >&6
8402
8403
# So?  What about this header?
8404
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
8405
  yes:no: )
8406
    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
8407
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
8408
    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
8409
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
8410
    ac_header_preproc=yes
8411
    ;;
8412
  no:yes:* )
8413
    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
8414
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
8415
    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
8416
echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
8417
    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
8418
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
8419
    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
8420
echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
8421
    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
8422
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
8423
    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
8424
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
8425
    (
8426
      cat <<\_ASBOX
8427
## ---------------------------------------------------- ##
8428
## Report this to lcd4linux-users@lists.sourceforge.net ##
8429
## ---------------------------------------------------- ##
8430
_ASBOX
8431
    ) |
8432
      sed "s/^/$as_me: WARNING:     /" >&2
8433
    ;;
8434
esac
8435
echo "$as_me:$LINENO: checking for $ac_header" >&5
8436
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8437
if eval "test \"\${$as_ac_Header+set}\" = set"; then
8438
  echo $ECHO_N "(cached) $ECHO_C" >&6
8439
else
8440
  eval "$as_ac_Header=\$ac_header_preproc"
8441
fi
8442
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8443
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8444
8445
fi
8446
if test `eval echo '${'$as_ac_Header'}'` = yes; then
8447
  cat >>confdefs.h <<_ACEOF
8448
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8449
_ACEOF
8450
8451
fi
8452
8453
done
8454
8455
8456
# Checks for typedefs, structures, and compiler characteristics.
8306
# Checks for typedefs, structures, and compiler characteristics.
8457
echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
8307
echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
8458
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
8308
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6

Return to bug 243114