1 /* ----------------------------------------------------------------------- * 2 * 3 * Portions of this file taken from the dmidecode project 4 * 5 * Copyright (C) 2000-2002 Alan Cox <alan (at) redhat.com> 6 * Copyright (C) 2002-2008 Jean Delvare <khali (at) linux-fr.org> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * 22 * For the avoidance of doubt the "preferred form" of this code is one which 23 * is in an open unpatent encumbered format. Where cryptographic key signing 24 * forms part of the process of creating an executable the information 25 * including keys needed to generate an equivalently functional executable 26 * are deemed to be part of the source code. 27 */ 28 29 #include <dmi/dmi.h> 30 #include <stdio.h> 31 32 const char *dmi_ipmi_interface_type(uint8_t code) 33 { 34 /* 3.3.39.1 and IPMI 2.0, appendix C1, table C1-2 */ 35 static const char *type[] = { 36 "Unknown", /* 0x00 */ 37 "KCS (Keyboard Control Style)", 38 "SMIC (Server Management Interface Chip)", 39 "BT (Block Transfer)", 40 "SSIF (SMBus System Interface)" /* 0x04 */ 41 }; 42 43 if (code <= 0x04) 44 return type[code]; 45 return out_of_spec; 46 } 47 48 void dmi_ipmi_base_address(uint8_t type, const uint8_t * p, s_ipmi * ipmi) 49 { 50 if (type == 0x04) { /* SSIF */ 51 ipmi->base_address = (*p) >> 1; 52 } else { 53 ipmi->base_address = QWORD(p); 54 } 55 } 56