H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 1 | /* -*- linux-c -*- ------------------------------------------------------- * |
| 2 | * |
| 3 | * Copyright (C) 1991, 1992 Linus Torvalds |
| 4 | * Copyright 2007 rPath, Inc. - All Rights Reserved |
H. Peter Anvin | 0a706db | 2009-04-01 18:19:00 -0700 | [diff] [blame] | 5 | * Copyright 2009 Intel Corporation; author H. Peter Anvin |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 6 | * |
| 7 | * This file is part of the Linux kernel, and is made available under |
| 8 | * the terms of the GNU General Public License version 2. |
| 9 | * |
| 10 | * ----------------------------------------------------------------------- */ |
| 11 | |
| 12 | /* |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 13 | * Get the MCA system description table |
| 14 | */ |
| 15 | |
| 16 | #include "boot.h" |
| 17 | |
| 18 | int query_mca(void) |
| 19 | { |
H. Peter Anvin | 0a706db | 2009-04-01 18:19:00 -0700 | [diff] [blame] | 20 | struct biosregs ireg, oreg; |
| 21 | u16 len; |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 22 | |
H. Peter Anvin | 0a706db | 2009-04-01 18:19:00 -0700 | [diff] [blame] | 23 | initregs(&ireg); |
| 24 | ireg.ah = 0xc0; |
| 25 | intcall(0x15, &ireg, &oreg); |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 26 | |
H. Peter Anvin | 0a706db | 2009-04-01 18:19:00 -0700 | [diff] [blame] | 27 | if (oreg.eflags & X86_EFLAGS_CF) |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 28 | return -1; /* No MCA present */ |
| 29 | |
H. Peter Anvin | 0a706db | 2009-04-01 18:19:00 -0700 | [diff] [blame] | 30 | set_fs(oreg.es); |
| 31 | len = rdfs16(oreg.bx); |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 32 | |
| 33 | if (len > sizeof(boot_params.sys_desc_table)) |
| 34 | len = sizeof(boot_params.sys_desc_table); |
| 35 | |
H. Peter Anvin | 0a706db | 2009-04-01 18:19:00 -0700 | [diff] [blame] | 36 | copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len); |
H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 37 | return 0; |
| 38 | } |