Home | History | Annotate | Download | only in dmi
      1 /* ----------------------------------------------------------------------- *
      2  *
      3  *   Pportions 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_chassis_type(uint8_t code)
     33 {
     34     /* 3.3.4.1 */
     35     static const char *type[] = {
     36 	"Other",		/* 0x01 */
     37 	"Unknown",
     38 	"Desktop",
     39 	"Low Profile Desktop",
     40 	"Pizza Box",
     41 	"Mini Tower",
     42 	"Tower",
     43 	"Portable",
     44 	"Laptop",
     45 	"Notebook",
     46 	"Hand Held",
     47 	"Docking Station",
     48 	"All In One",
     49 	"Sub Notebook",
     50 	"Space-saving",
     51 	"Lunch Box",
     52 	"Main Server Chassis",	/* master.mif says System */
     53 	"Expansion Chassis",
     54 	"Sub Chassis",
     55 	"Bus Expansion Chassis",
     56 	"Peripheral Chassis",
     57 	"RAID Chassis",
     58 	"Rack Mount Chassis",
     59 	"Sealed-case PC",
     60 	"Multi-system",		/* 0x19 */
     61 	"CompactPCI",
     62 	"AdvancedTCA",
     63 	"Blade",
     64 	"Blade Enclosing" /* 0x1D */
     65     };
     66 
     67     if (code >= 0x01 && code <= 0x1D)
     68 	return type[code - 0x01];
     69     return out_of_spec;
     70 }
     71 
     72 const char *dmi_chassis_lock(uint8_t code)
     73 {
     74     static const char *lock[] = {
     75 	"Not Present",		/* 0x00 */
     76 	"Present"		/* 0x01 */
     77     };
     78 
     79     return lock[code];
     80 }
     81 
     82 const char *dmi_chassis_state(uint8_t code)
     83 {
     84     /* 3.3.4.2 */
     85     static const char *state[] = {
     86 	"Other",		/* 0x01 */
     87 	"Unknown",
     88 	"Safe",			/* master.mif says OK */
     89 	"Warning",
     90 	"Critical",
     91 	"Non-recoverable"	/* 0x06 */
     92     };
     93 
     94     if (code >= 0x01 && code <= 0x06)
     95 	return (state[code - 0x01]);
     96     return out_of_spec;
     97 }
     98 
     99 const char *dmi_chassis_security_status(uint8_t code)
    100 {
    101     /* 3.3.4.3 */
    102     static const char *status[] = {
    103 	"Other",		/* 0x01 */
    104 	"Unknown",
    105 	"None",
    106 	"External Interface Locked Out",
    107 	"External Interface Enabled"	/* 0x05 */
    108     };
    109 
    110     if (code >= 0x01 && code <= 0x05)
    111 	return (status[code - 0x01]);
    112     return out_of_spec;
    113 }
    114