diff options
author | Tobias Weingartner <weingart@cvs.openbsd.org> | 1997-10-17 18:47:01 +0000 |
---|---|---|
committer | Tobias Weingartner <weingart@cvs.openbsd.org> | 1997-10-17 18:47:01 +0000 |
commit | 743e0a15d53ec40dc90929a6aa44dad3b0793308 (patch) | |
tree | 36fabd9bdea3eef8a5232eaf76abe32e2c4d2e1b /sys/arch/i386/stand/libsa/machdep.c | |
parent | 41093f286d691912ac4dbf211375b21dbff49e4e (diff) |
Cleanup, make it all compile.
Move APM stuff to apmprobe.c
Diffstat (limited to 'sys/arch/i386/stand/libsa/machdep.c')
-rw-r--r-- | sys/arch/i386/stand/libsa/machdep.c | 108 |
1 files changed, 2 insertions, 106 deletions
diff --git a/sys/arch/i386/stand/libsa/machdep.c b/sys/arch/i386/stand/libsa/machdep.c index 14ee4567561..61dc35f4371 100644 --- a/sys/arch/i386/stand/libsa/machdep.c +++ b/sys/arch/i386/stand/libsa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.18 1997/10/17 15:03:27 weingart Exp $ */ +/* $OpenBSD: machdep.c,v 1.19 1997/10/17 18:46:58 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -31,30 +31,6 @@ * SUCH DAMAGE. * */ -/* - * APM derived from: apm_init.S, LP (Laptop Package) - * wich contained this: - * Copyright (C) 1994 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp> - * - */ -/* - * If you want to know the specification of APM BIOS, see the following - * documentations, - * - * [1] Intel Corporation and Microsoft Corporation, "Advanced Power - * Management, The Next Generation, Version 1.0", Feb.,1992. - * - * [2] Intel Corporation and Microsoft Corporation, "Advanced Power - * Management (APM) BIOS Interface Specification Revision 1.1", - * Sep.,1993, Intel Order Number: 241704-001, Microsoft Part - * Number: 781-110-X01 - * - * or contact - * - * APM Support Desk (Intel Corporation, US) - * TEL: (800)628-8686 - * FAX: (916)356-6100. - */ #include "libsa.h" #include <machine/apmvar.h> @@ -71,67 +47,6 @@ int bootdev; #define CKPT(c) /* c */ #endif -static __inline u_int -apm_check() -{ - register u_int detail; - register u_int8_t f; - __asm __volatile(DOINT(0x15) "\n\t" - "setc %b1\n\t" - "movzwl %%ax, %0\n\t" - "shll $16, %%ecx\n\t" - "orl %%ecx, %0" - : "=a" (detail), "=b" (f) - : "0" (APM_INSTCHECK), "1" (APM_DEV_APM_BIOS) - : "%ecx", "cc"); - if (f || BIOS_regs.biosr_bx != 0x504d /* "PM" */ ) { -#ifdef DEBUG - printf("apm_check: %x, %x, %x\n", - f, BIOS_regs.biosr_bx, detail); -#endif - return 0; - } else - return detail; -} - -static __inline int -apm_disconnect() -{ - register u_int16_t rv; - __asm __volatile(DOINT(0x15) "\n\t" - "setc %b0" - : "=a" (rv) - : "0" (APM_DISCONNECT), "b" (APM_DEV_APM_BIOS) - : "%ecx", "%edx", "cc"); - return (rv & 0xff)? rv >> 8 : 0; -} - -static __inline int -apm_connect() -{ - register u_int16_t f; - __asm __volatile (DOINT(0x15) "\n\t" - "setc %b1\n\t" - "movb %%ah, %h1\n\t" - "movzwl %%ax, %%eax\n\tshll $4, %0\n\t" - "movzwl %%cx, %%ecx\n\tshll $4, %2\n\t" - "movzwl %%dx, %%edx\n\tshll $4, %3\n\t" - : "=a" (BIOS_vars.bios_apm_code32_base), - "=b" (f), - "=c" (BIOS_vars.bios_apm_code16_base), - "=d" (BIOS_vars.bios_apm_data_base) - : "0" (APM_PROT32_CONNECT), "1" (APM_DEV_APM_BIOS) - : "cc"); - BIOS_vars.bios_apm_entry = BIOS_regs.biosr_bx; -#if 0 - BIOS_vars.bios_apm_code_len = BIOS_regs.biosr_si & 0xffff; - BIOS_vars.bios_apm_data_len = BIOS_regs.biosr_di & 0xffff; -#else - BIOS_vars.bios_apm_code_len = 0x10000; - BIOS_vars.bios_apm_data_len = 0x10000; -#endif - return (f & 0xff)? f >> 8 : 0; -} void machdep() @@ -146,26 +61,7 @@ machdep() diskprobe(); CKPT('6'); #endif - if ((BIOS_vars.bios_apm_detail = apm_check())) { - - printf("apm0"); - apm_disconnect(); - if (apm_connect() != 0) - printf(": connect error\n"); -#ifdef DEBUG - printf(": %x text=%x/%x[%x] data=%x[%x] @ %x", - BIOS_vars.bios_apm_detail, - BIOS_vars.bios_apm_code32_base, - BIOS_vars.bios_apm_code16_base, - BIOS_vars.bios_apm_code_len, - BIOS_vars.bios_apm_data_base, - BIOS_vars.bios_apm_data_len, - BIOS_vars.bios_apm_entry); -#else - printf(" detected"); -#endif - putchar('\n'); - } + apmprobe(); CKPT('7'); CKPT('9'); } |