2 * include/asm-i386/mach-pc9800/apm.h
4 * Machine specific APM BIOS functions for NEC PC9800.
5 * Split out from apm.c by Osamu Tomita <tomita@cinet.co.jp>
11 #include <linux/apm_bios.h>
14 # define APM_DO_ZERO_SEGS \
17 "xorl %%edx, %%edx\n\t" \
18 "mov %%dx, %%ds\n\t" \
19 "mov %%dx, %%es\n\t" \
20 "mov %%dx, %%fs\n\t" \
22 # define APM_DO_POP_SEGS \
26 # define APM_DO_ZERO_SEGS
27 # define APM_DO_POP_SEGS
30 static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
31 u32 *eax, u32 *ebx, u32 *ecx,
35 * N.B. We do NOT need a cld after the BIOS call
36 * because we always save and restore the flags.
38 __asm__ __volatile__(APM_DO_ZERO_SEGS
42 "lcall *%%cs:apm_bios_entry\n\t"
47 : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx),
49 : "a" (func), "b" (ebx_in), "c" (ecx_in)
53 static inline u8 apm_bios_call_simple_asm(u32 func, u32 ebx_in,
60 * N.B. We do NOT need a cld after the BIOS call
61 * because we always save and restore the flags.
63 __asm__ __volatile__(APM_DO_ZERO_SEGS
67 "lcall *%%cs:apm_bios_entry\n\t"
72 : "=a" (*eax), "=b" (error), "=c" (cx), "=d" (dx),
74 : "a" (func), "b" (ebx_in), "c" (ecx_in)
76 if (func == APM_FUNC_VERSION)
77 *eax = (*eax & 0xff00) | ((*eax & 0x00f0) >> 4);
82 #endif /* _ASM_APM_H */