| 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 | 
 | 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 | /* | 
| H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 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" | 
| H. Peter Anvin | 5593eaa | 2007-07-14 16:47:13 -0700 | [diff] [blame] | 27 | 	    : "=acd" (err), "=acdSD" (es), "=b" (bx) | 
| H. Peter Anvin | 3b53d30 | 2007-07-11 12:18:49 -0700 | [diff] [blame] | 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 | } |