Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[linux-2.6-block.git] / arch / x86 / boot / voyager.c
1 /* -*- linux-c -*- ------------------------------------------------------- *
2  *
3  *   Copyright (C) 1991, 1992 Linus Torvalds
4  *   Copyright 2007 rPath, Inc. - All Rights Reserved
5  *
6  *   This file is part of the Linux kernel, and is made available under
7  *   the terms of the GNU General Public License version 2.
8  *
9  * ----------------------------------------------------------------------- */
10
11 /*
12  * arch/i386/boot/voyager.c
13  *
14  * Get the Voyager config information
15  */
16
17 #include "boot.h"
18
19 int query_voyager(void)
20 {
21         u8 err;
22         u16 es, di;
23         /* Abuse the apm_bios_info area for this */
24         u8 *data_ptr = (u8 *)&boot_params.apm_bios_info;
25
26         data_ptr[0] = 0xff;     /* Flag on config not found(?) */
27
28         asm("pushw %%es ; "
29             "int $0x15 ; "
30             "setc %0 ; "
31             "movw %%es, %1 ; "
32             "popw %%es"
33             : "=q" (err), "=r" (es), "=D" (di)
34             : "a" (0xffc0));
35
36         if (err)
37                 return -1;      /* Not Voyager */
38
39         set_fs(es);
40         copy_from_fs(data_ptr, di, 7);  /* Table is 7 bytes apparently */
41         return 0;
42 }