blob: 6499e3239b4132213907ab9ff54d00be9219dd1b [file] [log] [blame]
H. Peter Anvin337496e2007-07-11 12:18:51 -07001/* -*- 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
H. Peter Anvin337496e2007-07-11 12:18:51 -070019int 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"
H. Peter Anvin5593eaa2007-07-14 16:47:13 -070033 : "=q" (err), "=r" (es), "=D" (di)
H. Peter Anvin337496e2007-07-11 12:18:51 -070034 : "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}