#define PAGE_SIZE 4096
-/*typedef struct {
- uint32_t l;
- uint32_t h;
-} uint64_t;*/
-
extern const char *out_of_spec;
extern const char *bad_index;
#include "dmi_processor.h"
#include "dmi_memory.h"
#include "dmi_battery.h"
+#include "dmi_ipmi.h"
extern char display_line;
#define moreprintf(...) do { display_line++; if (display_line == 24) { char tempbuf[10]; display_line=0; printf("Press enter to continue"); fgets(tempbuf, sizeof tempbuf, stdin);} printf ( __VA_ARGS__); } while (0);
s_processor processor;
s_battery battery;
s_memory memory[MAX_DMI_MEMORY_ITEMS];
+ s_ipmi ipmi;
int memory_count;
dmi_table dmitable;
} s_dmi;
--- /dev/null
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006-2009 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_IPMI_H
+#define DMI_IPMI_H
+
+#define IPMI_INTERFACE_TYPE_SIZE 32
+#define IPMI_MEMORY_MODEL_SIZE 16
+
+typedef struct {
+char interface_type[IPMI_INTERFACE_TYPE_SIZE];
+uint8_t major_specification_version;
+uint8_t minor_specification_version;
+uint8_t I2C_slave_address;
+uint16_t nv_address;
+uint64_t base_address;
+
+uint8_t irq;
+bool filled;
+} s_ipmi;
+
+void dmi_ipmi_base_address(uint8_t type, const uint8_t *p, s_ipmi *ipmi);
+const char *dmi_ipmi_interface_type(uint8_t code);
+#endif
LIBOBJS = dmi/dmi_battery.o dmi/dmi_chassis.o dmi/dmi_memory.o \
dmi/dmi_processor.o dmi/dmi.o dmi/dmi_bios.o dmi/dmi_base_board.o \
- cpuid.o
+ dmi/dmi_ipmi.o cpuid.o
BINDIR = /usr/bin
LIBDIR = /usr/lib
// sprintf(dmi->battery.oem_info,"0x%08X",DWORD(h, data+0x16));
break;
-
-
+ case 38: /* 3.3.39 IPMI Device Information */
+ if (h->length < 0x10) break;
+ dmi->ipmi.filled=true;
+ snprintf(dmi->ipmi.interface_type,sizeof(dmi->ipmi.interface_type),
+ "%s", dmi_ipmi_interface_type(data[0x04]));
+ dmi->ipmi.major_specification_version=data[0x05] >> 4;
+ dmi->ipmi.minor_specification_version=data[0x05] & 0x0F;
+ dmi->ipmi.I2C_slave_address=data[0x06] >> 1;
+ if (data[0x07] != 0xFF)
+ dmi->ipmi.nv_address=data[0x07];
+ else
+ dmi->ipmi.nv_address=0; /* Not Present */
+ dmi_ipmi_base_address(data[0x04], data + 0x08,
+ &dmi->ipmi);
+ if (h->length < 0x12) break;
+ if (data[0x11] != 0x00)
+ {
+ dmi->ipmi.irq=data[0x11];
+ }
+ break;
}
}
--- /dev/null
+/* ----------------------------------------------------------------------- *
+ *
+ * Portions of this file taken from the dmidecode project
+ *
+ * Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
+ * Copyright (C) 2002-2008 Jean Delvare <khali@linux-fr.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For the avoidance of doubt the "preferred form" of this code is one which
+ * is in an open unpatent encumbered format. Where cryptographic key signing
+ * forms part of the process of creating an executable the information
+ * including keys needed to generate an equivalently functional executable
+ * are deemed to be part of the source code.
+*/
+
+#include <dmi/dmi.h>
+#include <stdio.h>
+
+const char *dmi_ipmi_interface_type(uint8_t code)
+{
+ /* 3.3.39.1 and IPMI 2.0, appendix C1, table C1-2 */
+ static const char *type[] = {
+ "Unknown", /* 0x00 */
+ "KCS (Keyboard Control Style)",
+ "SMIC (Server Management Interface Chip)",
+ "BT (Block Transfer)",
+ "SSIF (SMBus System Interface)" /* 0x04 */
+ };
+
+ if (code <= 0x04)
+ return type[code];
+ return out_of_spec;
+}
+
+void dmi_ipmi_base_address(uint8_t type, const uint8_t *p, s_ipmi *ipmi)
+{
+ if (type == 0x04) /* SSIF */
+ {
+ ipmi->base_address= (*p) >> 1;
+ }
+ else
+ {
+ ipmi->base_address = QWORD(p);
+ }
+}
+