summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1998-02-20 02:44:48 +0000
committersteve <steve@FreeBSD.org>1998-02-20 02:44:48 +0000
commit24943ac55da6be43f0909a89a9fc5cf9c7c54209 (patch)
tree7e516802ac12a13dd154c7f25b766ea676758586
parentb1c3203602a8cf288b2ec26a28dba2125607b7fa (diff)
downloadFreeBSD-src-24943ac55da6be43f0909a89a9fc5cf9c7c54209.zip
FreeBSD-src-24943ac55da6be43f0909a89a9fc5cf9c7c54209.tar.gz
Cleanup the lpt for probe code.
PR: 5773 Submitted by: Dag-Erling Coidan Smorgrav <dag-erli@ifi.uio.no>
-rw-r--r--sys/i386/isa/lpt.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c
index b2df606..396e75d 100644
--- a/sys/i386/isa/lpt.c
+++ b/sys/i386/isa/lpt.c
@@ -46,7 +46,7 @@
* SUCH DAMAGE.
*
* from: unknown origin, 386BSD 0.1
- * $Id: lpt.c,v 1.64 1998/01/08 23:41:10 eivind Exp $
+ * $Id: lpt.c,v 1.65 1998/01/24 02:54:21 eivind Exp $
*/
/*
@@ -104,6 +104,7 @@
#include "lpt.h"
#include "opt_devfs.h"
#include "opt_inet.h"
+#include "opt_lpt.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -188,7 +189,7 @@
#define BIOS_MAX_LPT 4
-#ifndef DEBUG
+#ifndef LPT_DEBUG
#define lprintf (void)
#else
#define lprintf if (lptflag) printf
@@ -369,8 +370,14 @@ lptprobe(struct isa_device *dvp)
int port;
static short next_bios_lpt = 0;
int status;
- u_char data;
- u_char mask;
+ static u_char testbyte[18] = {
+ 0x55, /* alternating zeros */
+ 0xaa, /* alternating ones */
+ 0xfe, 0xfd, 0xfb, 0xf7,
+ 0xef, 0xdf, 0xbf, 0x7f, /* walking zero */
+ 0x01, 0x02, 0x04, 0x08,
+ 0x10, 0x20, 0x40, 0x80 /* walking one */
+ };
int i;
/*
@@ -393,27 +400,12 @@ lptprobe(struct isa_device *dvp)
/* Port was explicitly specified */
/* This allows probing of ports unknown to the BIOS */
-
port = dvp->id_iobase + lpt_data;
- mask = 0xff;
- data = 0x55; /* Alternating zeros */
- if (!lpt_port_test(port, data, mask))
- { status = 0 ; goto end_probe ; }
-
- data = 0xaa; /* Alternating ones */
- if (!lpt_port_test(port, data, mask))
- { status = 0 ; goto end_probe ; }
-
- for (i = 0; i < 8; i++) { /* Walking zero */
- data = ~(1 << i);
- if (!lpt_port_test(port, data, mask))
- { status = 0 ; goto end_probe ; }
- }
-
- for (i = 0; i < 8; i++) { /* Walking one */
- data = (1 << i);
- if (!lpt_port_test(port, data, mask))
- { status = 0 ; goto end_probe ; }
+ for (i = 0; i < 18; i++) {
+ if (!lpt_port_test(port, testbyte[i], 0xff)) {
+ status = 0;
+ goto end_probe;
+ }
}
end_probe:
OpenPOWER on IntegriCloud