Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/nico/orion...
[pandora-kernel.git] / arch / x86 / boot / mca.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  * Get the MCA system description table
13  */
14
15 #include "boot.h"
16
17 int query_mca(void)
18 {
19         u8 err;
20         u16 es, bx, len;
21
22         asm("pushw %%es ; "
23             "int $0x15 ; "
24             "setc %0 ; "
25             "movw %%es, %1 ; "
26             "popw %%es"
27             : "=acd" (err), "=acdSD" (es), "=b" (bx)
28             : "a" (0xc000));
29
30         if (err)
31                 return -1;      /* No MCA present */
32
33         set_fs(es);
34         len = rdfs16(bx);
35
36         if (len > sizeof(boot_params.sys_desc_table))
37                 len = sizeof(boot_params.sys_desc_table);
38
39         copy_from_fs(&boot_params.sys_desc_table, bx, len);
40         return 0;
41 }