1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-19 15:33:56 +00:00

Do a APM BIOS dis-connect before attempting to do a 32-bit connection

just in case a connection already existed.

Also, a minor optimization in the code which determins if a APM BIOS exists.

Reviewed by:	phk

This is based on the APM-0.5 patch for Linux, but written entirely by me.
This commit is contained in:
Nate Williams 1996-03-11 21:55:18 +00:00
parent ed9e3473d0
commit 5be175963d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14571
4 changed files with 104 additions and 82 deletions

View File

@ -12,7 +12,7 @@
*
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm_init.S,v 1.3 1994/10/01 21:29:49 phk Exp $
* $Id: apm_init.S,v 1.4 1995/02/17 02:22:31 phk Exp $
*/
/*
@ -109,17 +109,14 @@ ENTRY(apm_init)
/* save the value of %ax */
data32
call EXT(real_to_prot) /* come back again to protected mode */
cmpb $0x50, %bh /* %bh == 'P'? */
jnz 1f
cmpb $0x4d, %bl /* %bl == 'M'? */
jz 2f
cmpw $0x504d, %bx /* "PM" signature? */
jz 1f
1:
movl $(APMINI_CANTFIND), apm_version
/* can't find APM BIOS */
jmp finish
2:
1:
testl $(APM_32BIT_SUPPORT), %ecx
/* supports 32bit connection? */
jnz 1f
@ -138,6 +135,16 @@ ENTRY(apm_init)
*/
call EXT(prot_to_real) /* return to real mode */
/* Disconnect, just in case */
movb $(APM_BIOS), %ah
movb $(APM_DISCONNECT), %al
data32
movl $(PMDV_APMBIOS), %ebx
sti
int $(SYSTEM_BIOS)
cli
/* Ignore return code, but we can now connect safely */
movb $(APM_BIOS), %ah
movb $(APM_PROT32CONNECT), %al
data32

View File

@ -3,50 +3,54 @@
.byte 0xfa, 0x55, 0x66, 0x8c, 0xd8, 0x66, 0x8e, 0xe0
.byte 0x66, 0xb8, 0xe8, 0x00, 0x66, 0x8e, 0xd8, 0x66
.byte 0x8e, 0xc0, 0x66, 0x8e, 0xd0, 0x89, 0x25, 0x74
.byte 0x8e, 0xc0, 0x66, 0x8e, 0xd0, 0x89, 0x25, 0x94
.byte 0x01, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x01, 0x00
.byte 0x0f, 0x01, 0x0d, 0x90, 0x01, 0x00, 0x00, 0xe8
.byte 0x14, 0x01, 0x00, 0x00, 0xb4, 0x53, 0xb0, 0x00
.byte 0x0f, 0x01, 0x0d, 0xb0, 0x01, 0x00, 0x00, 0xe8
.byte 0x24, 0x01, 0x00, 0x00, 0xb4, 0x53, 0xb0, 0x00
.byte 0x66, 0xbb, 0x00, 0x00, 0x00, 0x00, 0xfb, 0xcd
.byte 0x15, 0xfa, 0x73, 0x15, 0x66, 0xe8, 0xde, 0x00
.byte 0x00, 0x00, 0xc7, 0x05, 0x78, 0x01, 0x00, 0x00
.byte 0xff, 0xff, 0xff, 0xff, 0xe9, 0x92, 0x00, 0x00
.byte 0x00, 0x00, 0xc7, 0x05, 0x98, 0x01, 0x00, 0x00
.byte 0xff, 0xff, 0xff, 0xff, 0xe9, 0xa0, 0x00, 0x00
.byte 0x00, 0x89, 0xc2, 0x66, 0xe8, 0xc7, 0x00, 0x00
.byte 0x00, 0x80, 0xff, 0x50, 0x75, 0x05, 0x80, 0xfb
.byte 0x4d, 0x74, 0x0c, 0xc7, 0x05, 0x78, 0x01, 0x00
.byte 0x00, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x74, 0xf7
.byte 0x00, 0x66, 0x81, 0xfb, 0x4d, 0x50, 0x74, 0x0f
.byte 0xc7, 0x05, 0x98, 0x01, 0x00, 0x00, 0xff, 0xff
.byte 0xff, 0xff, 0xe9, 0x82, 0x00, 0x00, 0x00, 0xf7
.byte 0xc1, 0x02, 0x00, 0x00, 0x00, 0x75, 0x0c, 0xc7
.byte 0x05, 0x78, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff
.byte 0xff, 0xeb, 0x60, 0x81, 0xe2, 0xff, 0xff, 0x00
.byte 0x00, 0x89, 0x15, 0x78, 0x01, 0x00, 0x00, 0x81
.byte 0xe1, 0xff, 0xff, 0x00, 0x00, 0x89, 0x0d, 0x7c
.byte 0x01, 0x00, 0x00, 0xe8, 0xa0, 0x00, 0x00, 0x00
.byte 0xb4, 0x53, 0xb0, 0x03, 0x66, 0xbb, 0x00, 0x00
.byte 0x00, 0x00, 0xfb, 0xcd, 0x15, 0xfa, 0x73, 0x12
.byte 0x66, 0xe8, 0x6a, 0x00, 0x00, 0x00, 0xc7, 0x05
.byte 0x78, 0x01, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff
.byte 0xeb, 0x21, 0x89, 0xc5, 0x66, 0xe8, 0x56, 0x00
.byte 0x00, 0x00, 0xb8, 0xff, 0xff, 0x00, 0x00, 0x21
.byte 0xc5, 0x21, 0xc1, 0x21, 0xc2, 0x21, 0xc6, 0x21
.byte 0xc7, 0xc1, 0xe5, 0x10, 0x09, 0xe9, 0xc1, 0xe7
.byte 0x10, 0x09, 0xfe, 0xfa, 0x0f, 0x01, 0x1d, 0x90
.byte 0x01, 0x00, 0x00, 0x8b, 0x25, 0x74, 0x01, 0x00
.byte 0x00, 0x8b, 0x2d, 0x78, 0x01, 0x00, 0x00, 0x8b
.byte 0x3d, 0x7c, 0x01, 0x00, 0x00, 0x66, 0x8c, 0xe0
.byte 0x66, 0x8e, 0xd0, 0x66, 0x8e, 0xc0, 0x66, 0x8e
.byte 0xd8, 0x31, 0xc0, 0x66, 0x8e, 0xe0, 0x89, 0xe8
.byte 0x5d, 0xcb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x05, 0x98, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff
.byte 0xff, 0xeb, 0x6e, 0x81, 0xe2, 0xff, 0xff, 0x00
.byte 0x00, 0x89, 0x15, 0x98, 0x01, 0x00, 0x00, 0x81
.byte 0xe1, 0xff, 0xff, 0x00, 0x00, 0x89, 0x0d, 0x9c
.byte 0x01, 0x00, 0x00, 0xe8, 0xb0, 0x00, 0x00, 0x00
.byte 0xb4, 0x53, 0xb0, 0x04, 0x66, 0xbb, 0x00, 0x00
.byte 0x00, 0x00, 0xfb, 0xcd, 0x15, 0xfa, 0xb4, 0x53
.byte 0xb0, 0x03, 0x66, 0xbb, 0x00, 0x00, 0x00, 0x00
.byte 0xfb, 0xcd, 0x15, 0xfa, 0x73, 0x12, 0x66, 0xe8
.byte 0x5c, 0x00, 0x00, 0x00, 0xc7, 0x05, 0x98, 0x01
.byte 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xeb, 0x21
.byte 0x89, 0xc5, 0x66, 0xe8, 0x48, 0x00, 0x00, 0x00
.byte 0xb8, 0xff, 0xff, 0x00, 0x00, 0x21, 0xc5, 0x21
.byte 0xc1, 0x21, 0xc2, 0x21, 0xc6, 0x21, 0xc7, 0xc1
.byte 0xe5, 0x10, 0x09, 0xe9, 0xc1, 0xe7, 0x10, 0x09
.byte 0xfe, 0xfa, 0x0f, 0x01, 0x1d, 0xb0, 0x01, 0x00
.byte 0x00, 0x8b, 0x25, 0x94, 0x01, 0x00, 0x00, 0x8b
.byte 0x2d, 0x98, 0x01, 0x00, 0x00, 0x8b, 0x3d, 0x9c
.byte 0x01, 0x00, 0x00, 0x66, 0x8c, 0xe0, 0x66, 0x8e
.byte 0xd0, 0x66, 0x8e, 0xc0, 0x66, 0x8e, 0xd8, 0x31
.byte 0xc0, 0x66, 0x8e, 0xe0, 0x89, 0xe8, 0x5d, 0xcb
.byte 0xfa, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xc8, 0x01
.byte 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x33, 0x01, 0x00
.byte 0x00, 0xe0, 0x00, 0x66, 0xb8, 0xe8, 0x00, 0x8e
.byte 0xd8, 0x8e, 0xd0, 0x8e, 0xc0, 0xc3, 0x00, 0x00
.byte 0x66, 0xb8, 0xf8, 0x00, 0xea, 0x4b, 0x01, 0x00
.byte 0xd8, 0x8e, 0xd0, 0x8e, 0xc0, 0x0f, 0x01, 0x1d
.byte 0xb0, 0x01, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x66, 0xb8, 0xf8, 0x00, 0xea, 0x5b, 0x01, 0x00
.byte 0x00, 0xf0, 0x00, 0x8e, 0xd8, 0x8e, 0xd0, 0x8e
.byte 0xc0, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xe0, 0xfe
.byte 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x63, 0x01, 0x00
.byte 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x73, 0x01, 0x00
.byte 0x00, 0x00, 0x80, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e
.byte 0xd0, 0x8e, 0xc0, 0x66, 0xc3, 0x00, 0x00, 0x00
.byte 0xd0, 0x8e, 0xc0, 0x67, 0x66, 0x0f, 0x01, 0x1d
.byte 0xb6, 0x01, 0x00, 0x00, 0x66, 0xc3, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -54,4 +58,4 @@
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Total size = 0x01a0 */
/* Total size = 0x01c0 */

View File

@ -12,7 +12,7 @@
*
* Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm_init.S,v 1.3 1994/10/01 21:29:49 phk Exp $
* $Id: apm_init.S,v 1.4 1995/02/17 02:22:31 phk Exp $
*/
/*
@ -109,17 +109,14 @@ ENTRY(apm_init)
/* save the value of %ax */
data32
call EXT(real_to_prot) /* come back again to protected mode */
cmpb $0x50, %bh /* %bh == 'P'? */
jnz 1f
cmpb $0x4d, %bl /* %bl == 'M'? */
jz 2f
cmpw $0x504d, %bx /* "PM" signature? */
jz 1f
1:
movl $(APMINI_CANTFIND), apm_version
/* can't find APM BIOS */
jmp finish
2:
1:
testl $(APM_32BIT_SUPPORT), %ecx
/* supports 32bit connection? */
jnz 1f
@ -138,6 +135,16 @@ ENTRY(apm_init)
*/
call EXT(prot_to_real) /* return to real mode */
/* Disconnect, just in case */
movb $(APM_BIOS), %ah
movb $(APM_DISCONNECT), %al
data32
movl $(PMDV_APMBIOS), %ebx
sti
int $(SYSTEM_BIOS)
cli
/* Ignore return code, but we can now connect safely */
movb $(APM_BIOS), %ah
movb $(APM_PROT32CONNECT), %al
data32

View File

@ -3,50 +3,54 @@
.byte 0xfa, 0x55, 0x66, 0x8c, 0xd8, 0x66, 0x8e, 0xe0
.byte 0x66, 0xb8, 0xe8, 0x00, 0x66, 0x8e, 0xd8, 0x66
.byte 0x8e, 0xc0, 0x66, 0x8e, 0xd0, 0x89, 0x25, 0x74
.byte 0x8e, 0xc0, 0x66, 0x8e, 0xd0, 0x89, 0x25, 0x94
.byte 0x01, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x01, 0x00
.byte 0x0f, 0x01, 0x0d, 0x90, 0x01, 0x00, 0x00, 0xe8
.byte 0x14, 0x01, 0x00, 0x00, 0xb4, 0x53, 0xb0, 0x00
.byte 0x0f, 0x01, 0x0d, 0xb0, 0x01, 0x00, 0x00, 0xe8
.byte 0x24, 0x01, 0x00, 0x00, 0xb4, 0x53, 0xb0, 0x00
.byte 0x66, 0xbb, 0x00, 0x00, 0x00, 0x00, 0xfb, 0xcd
.byte 0x15, 0xfa, 0x73, 0x15, 0x66, 0xe8, 0xde, 0x00
.byte 0x00, 0x00, 0xc7, 0x05, 0x78, 0x01, 0x00, 0x00
.byte 0xff, 0xff, 0xff, 0xff, 0xe9, 0x92, 0x00, 0x00
.byte 0x00, 0x00, 0xc7, 0x05, 0x98, 0x01, 0x00, 0x00
.byte 0xff, 0xff, 0xff, 0xff, 0xe9, 0xa0, 0x00, 0x00
.byte 0x00, 0x89, 0xc2, 0x66, 0xe8, 0xc7, 0x00, 0x00
.byte 0x00, 0x80, 0xff, 0x50, 0x75, 0x05, 0x80, 0xfb
.byte 0x4d, 0x74, 0x0c, 0xc7, 0x05, 0x78, 0x01, 0x00
.byte 0x00, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x74, 0xf7
.byte 0x00, 0x66, 0x81, 0xfb, 0x4d, 0x50, 0x74, 0x0f
.byte 0xc7, 0x05, 0x98, 0x01, 0x00, 0x00, 0xff, 0xff
.byte 0xff, 0xff, 0xe9, 0x82, 0x00, 0x00, 0x00, 0xf7
.byte 0xc1, 0x02, 0x00, 0x00, 0x00, 0x75, 0x0c, 0xc7
.byte 0x05, 0x78, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff
.byte 0xff, 0xeb, 0x60, 0x81, 0xe2, 0xff, 0xff, 0x00
.byte 0x00, 0x89, 0x15, 0x78, 0x01, 0x00, 0x00, 0x81
.byte 0xe1, 0xff, 0xff, 0x00, 0x00, 0x89, 0x0d, 0x7c
.byte 0x01, 0x00, 0x00, 0xe8, 0xa0, 0x00, 0x00, 0x00
.byte 0xb4, 0x53, 0xb0, 0x03, 0x66, 0xbb, 0x00, 0x00
.byte 0x00, 0x00, 0xfb, 0xcd, 0x15, 0xfa, 0x73, 0x12
.byte 0x66, 0xe8, 0x6a, 0x00, 0x00, 0x00, 0xc7, 0x05
.byte 0x78, 0x01, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff
.byte 0xeb, 0x21, 0x89, 0xc5, 0x66, 0xe8, 0x56, 0x00
.byte 0x00, 0x00, 0xb8, 0xff, 0xff, 0x00, 0x00, 0x21
.byte 0xc5, 0x21, 0xc1, 0x21, 0xc2, 0x21, 0xc6, 0x21
.byte 0xc7, 0xc1, 0xe5, 0x10, 0x09, 0xe9, 0xc1, 0xe7
.byte 0x10, 0x09, 0xfe, 0xfa, 0x0f, 0x01, 0x1d, 0x90
.byte 0x01, 0x00, 0x00, 0x8b, 0x25, 0x74, 0x01, 0x00
.byte 0x00, 0x8b, 0x2d, 0x78, 0x01, 0x00, 0x00, 0x8b
.byte 0x3d, 0x7c, 0x01, 0x00, 0x00, 0x66, 0x8c, 0xe0
.byte 0x66, 0x8e, 0xd0, 0x66, 0x8e, 0xc0, 0x66, 0x8e
.byte 0xd8, 0x31, 0xc0, 0x66, 0x8e, 0xe0, 0x89, 0xe8
.byte 0x5d, 0xcb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x05, 0x98, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff
.byte 0xff, 0xeb, 0x6e, 0x81, 0xe2, 0xff, 0xff, 0x00
.byte 0x00, 0x89, 0x15, 0x98, 0x01, 0x00, 0x00, 0x81
.byte 0xe1, 0xff, 0xff, 0x00, 0x00, 0x89, 0x0d, 0x9c
.byte 0x01, 0x00, 0x00, 0xe8, 0xb0, 0x00, 0x00, 0x00
.byte 0xb4, 0x53, 0xb0, 0x04, 0x66, 0xbb, 0x00, 0x00
.byte 0x00, 0x00, 0xfb, 0xcd, 0x15, 0xfa, 0xb4, 0x53
.byte 0xb0, 0x03, 0x66, 0xbb, 0x00, 0x00, 0x00, 0x00
.byte 0xfb, 0xcd, 0x15, 0xfa, 0x73, 0x12, 0x66, 0xe8
.byte 0x5c, 0x00, 0x00, 0x00, 0xc7, 0x05, 0x98, 0x01
.byte 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xeb, 0x21
.byte 0x89, 0xc5, 0x66, 0xe8, 0x48, 0x00, 0x00, 0x00
.byte 0xb8, 0xff, 0xff, 0x00, 0x00, 0x21, 0xc5, 0x21
.byte 0xc1, 0x21, 0xc2, 0x21, 0xc6, 0x21, 0xc7, 0xc1
.byte 0xe5, 0x10, 0x09, 0xe9, 0xc1, 0xe7, 0x10, 0x09
.byte 0xfe, 0xfa, 0x0f, 0x01, 0x1d, 0xb0, 0x01, 0x00
.byte 0x00, 0x8b, 0x25, 0x94, 0x01, 0x00, 0x00, 0x8b
.byte 0x2d, 0x98, 0x01, 0x00, 0x00, 0x8b, 0x3d, 0x9c
.byte 0x01, 0x00, 0x00, 0x66, 0x8c, 0xe0, 0x66, 0x8e
.byte 0xd0, 0x66, 0x8e, 0xc0, 0x66, 0x8e, 0xd8, 0x31
.byte 0xc0, 0x66, 0x8e, 0xe0, 0x89, 0xe8, 0x5d, 0xcb
.byte 0xfa, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xc8, 0x01
.byte 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x33, 0x01, 0x00
.byte 0x00, 0xe0, 0x00, 0x66, 0xb8, 0xe8, 0x00, 0x8e
.byte 0xd8, 0x8e, 0xd0, 0x8e, 0xc0, 0xc3, 0x00, 0x00
.byte 0x66, 0xb8, 0xf8, 0x00, 0xea, 0x4b, 0x01, 0x00
.byte 0xd8, 0x8e, 0xd0, 0x8e, 0xc0, 0x0f, 0x01, 0x1d
.byte 0xb0, 0x01, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x66, 0xb8, 0xf8, 0x00, 0xea, 0x5b, 0x01, 0x00
.byte 0x00, 0xf0, 0x00, 0x8e, 0xd8, 0x8e, 0xd0, 0x8e
.byte 0xc0, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xe0, 0xfe
.byte 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x63, 0x01, 0x00
.byte 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x73, 0x01, 0x00
.byte 0x00, 0x00, 0x80, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e
.byte 0xd0, 0x8e, 0xc0, 0x66, 0xc3, 0x00, 0x00, 0x00
.byte 0xd0, 0x8e, 0xc0, 0x67, 0x66, 0x0f, 0x01, 0x1d
.byte 0xb6, 0x01, 0x00, 0x00, 0x66, 0xc3, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -54,4 +58,4 @@
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Total size = 0x01a0 */
/* Total size = 0x01c0 */