Sync with sys/i386/isa/lpt.c revision 1.167.
This commit is contained in:
parent
20bea78d8c
commit
116e73ba18
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33674
@ -46,7 +46,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: unknown origin, 386BSD 0.1
|
||||
* $Id: lpt.c,v 1.16 1998/01/08 23:42:13 eivind Exp $
|
||||
* $Id: lpt.c,v 1.17 1998/01/24 02:54:38 eivind Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -389,8 +389,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;
|
||||
|
||||
/*
|
||||
@ -413,27 +419,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:
|
||||
|
Loading…
Reference in New Issue
Block a user