Changeset 1481

Show
Ignore:
Timestamp:
08/03/02 22:18:35 (11 years ago)
Author:
mds
Message:

Additional sensor fields decoded

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/detect/dmidecode.c

    r1480 r1481  
    77 *      Additional structures displayed per SMBIOS 2.3.1 spec 
    88 * 
     9 *      8/3/02 Enhanced and incorporated in lm_sensors 2.6.5 
     10 * 
    911 *      Licensed under the GNU Public license. If you want to use it in with 
    1012 *      another license just ask. 
     
    3032        const unsigned char maxcolumn = 16; 
    3133        while (length_printed < length) { 
     34                printf("\t"); 
    3235                b1 = buffer1; 
    3336                b2 = buffer2; 
     
    426429                return ""; 
    427430        return onboard_type[code]; 
     431} 
     432 
     433static char *dmi_mgmt_dev_type(u8 code) 
     434{ 
     435        static char *type[]={ 
     436                "", 
     437                "Other", 
     438                "Unknown", 
     439                "LM75", 
     440                "LM78", 
     441                "LM79", 
     442                "LM80", 
     443                "LM81", 
     444                "ADM9240", 
     445                "DS1780", 
     446                "MAX1617", 
     447                "GL518SM", 
     448                "W83781D", 
     449                "HT82H791", 
     450        }; 
     451        code &= 0x80; 
     452        if (code > 0x0d) 
     453                return ""; 
     454        return type[code]; 
     455} 
     456 
     457static char *dmi_mgmt_addr_type(u8 code) 
     458{ 
     459        static char *type[]={ 
     460                "", 
     461                "Other", 
     462                "Unknown", 
     463                "I/O", 
     464                "Memory", 
     465                "SMBus", 
     466        }; 
     467        code &= 0x80; 
     468        if (code > 5) 
     469                return ""; 
     470        return type[code]; 
     471} 
     472 
     473static char *dmi_fan_type(u8 code) 
     474{ 
     475        static char *type[]={ 
     476                "", 
     477                "Other", 
     478                "Unknown", 
     479                "Fan", 
     480                "Centrifugal Blower", 
     481                "Chip Fan", 
     482                "Cabinet Fan", 
     483                "Power Supply Fan", 
     484                "Heat Pipe", 
     485                "Integrated Refrigeration", 
     486                "", 
     487                "", 
     488                "", 
     489                "", 
     490                "", 
     491                "", 
     492                "Active Cooling", 
     493                "Passive Cooling", 
     494        }; 
     495        code &= 0x80; 
     496        if (code > 0x11) 
     497                return ""; 
     498        return type[code]; 
     499} 
     500 
     501static char *dmi_volt_loc(u8 code) 
     502{ 
     503        static char *type[]={ 
     504                "", 
     505                "Other", 
     506                "Unknown", 
     507                "Processor", 
     508                "Disk", 
     509                "Peripheral Bay", 
     510                "System Management Module", 
     511                "Motherboard", 
     512                "Memory Module", 
     513                "Processor Module", 
     514                "Power Unit", 
     515                "Add-in Card", 
     516        }; 
     517        code &= 0x80; 
     518        if (code > 0x0b) 
     519                return ""; 
     520        return type[code]; 
     521} 
     522 
     523static char *dmi_temp_loc(u8 code) 
     524{ 
     525        static char *type[]={ 
     526                "Front Panel Board", 
     527                "Back Panel Board", 
     528                "Power System Board", 
     529                "Drive Back Plane", 
     530        }; 
     531        code &= 0x80; 
     532        if (code <= 0x0b) 
     533                return dmi_volt_loc(code); 
     534        return type[code - 0x0c]; 
     535} 
     536 
     537static char *dmi_status(u8 code) 
     538{ 
     539        static char *type[]={ 
     540                "", 
     541                "Other", 
     542                "Unknown", 
     543                "OK", 
     544                "Non-critical", 
     545                "Critical", 
     546                "Non-recoverable", 
     547        }; 
     548        code &= 0x80; 
     549        if (code > 6) 
     550                return ""; 
     551        return type[code]; 
     552} 
     553 
     554/* 3 dec. places */ 
     555static char *dmi_millivolt(u8 *data, int index) 
     556{ 
     557        static char buffer[20]; 
     558        short int d; 
     559 
     560        if (data[index+1] == 0x80 && data[index] == 0) 
     561                return "Unknown"; 
     562        d = data[index+1] << 8 | data[index]; 
     563        sprintf(buffer, "%0.3f", d / 1000.0); 
     564        return buffer; 
     565} 
     566 
     567/* 2 dec. places */ 
     568static char *dmi_accuracy(u8 *data, int index) 
     569{ 
     570        static char buffer[20]; 
     571        short int d; 
     572 
     573        if (data[index+1] == 0x80 && data[index] == 0) 
     574                return "Unknown"; 
     575        d = data[index+1] << 8 | data[index]; 
     576        sprintf(buffer, "%0.2f", d / 100.0); 
     577        return buffer; 
     578} 
     579 
     580/* 1 dec. place */ 
     581static char *dmi_temp(u8 *data, int index) 
     582{ 
     583        static char buffer[20]; 
     584        short int d; 
     585 
     586        if (data[index+1] == 0x80 && data[index] == 0) 
     587                return "Unknown"; 
     588        d = data[index+1] << 8 | data[index]; 
     589        sprintf(buffer, "%0.1f", d / 10.0); 
     590        return buffer; 
     591} 
     592 
     593/* 0 dec. place */ 
     594static char *dmi_speed(u8 *data, int index) 
     595{ 
     596        static char buffer[20]; 
     597        short int d; 
     598 
     599        if (data[index+1] == 0x80 && data[index] == 0) 
     600                return "Unknown"; 
     601        d = data[index+1] << 8 | data[index]; 
     602        sprintf(buffer, "%d", d); 
     603        return buffer; 
    428604} 
    429605 
     
    707883                         
    708884                         
    709                         case 15: 
    710                                 printf("\tEvent Log\n"); 
    711                                 printf("\t\tLog Area: %d bytes.\n", 
    712                                         data[5]<<8|data[4]); 
    713                                 printf("\t\tLog Header At: %d.\n", 
    714                                         data[7]<<8|data[6]); 
    715                                 printf("\t\tLog Data At: %d.\n", 
    716                                         data[9]<<8|data[8]); 
    717                                 printf("\t\tLog Type: %d.\n", 
    718                                         data[10]); 
    719                                 if(data[11]&(1<<0)) 
    720                                         printf("\t\tLog Valid: Yes.\n"); 
    721                                 if(data[11]&(1<<1)) 
    722                                         printf("\t\t**Log Is Full**.\n"); 
    723                                 break; 
     885                case 15: 
     886                        printf("\tEvent Log\n"); 
     887                        printf("\t\tLog Area: %d bytes.\n", 
     888                                data[5]<<8|data[4]); 
     889                        printf("\t\tLog Header At: %d.\n", 
     890                                data[7]<<8|data[6]); 
     891                        printf("\t\tLog Data At: %d.\n", 
     892                                data[9]<<8|data[8]); 
     893                        printf("\t\tLog Type: %d.\n", 
     894                                data[10]); 
     895                        if(data[11]&(1<<0)) 
     896                                printf("\t\tLog Valid: Yes.\n"); 
     897                        if(data[11]&(1<<1)) 
     898                                printf("\t\t**Log Is Full**.\n"); 
     899                        break; 
    724900                         
    725901                case 16: 
     
    738914                        printf("\tMemory Device Mapped Address\n"); 
    739915                        break; 
     916                case 21: 
     917                        printf("\tBuilt-In Pointing Device\n"); 
     918                        break; 
     919                case 22: 
     920                        printf("\tPortable Battery\n"); 
     921                        printf("\t\tLocation: %s\n", 
     922                                        dmi_string(dm, data[4])); 
     923                        printf("\t\tManufacturer: %s\n", 
     924                                        dmi_string(dm, data[5])); 
     925                        printf("\t\tManufacture Date: %s\n", 
     926                                        dmi_string(dm, data[6])); 
     927                        printf("\t\tSerial Number: %s\n", 
     928                                        dmi_string(dm, data[7])); 
     929                        printf("\t\tName: %s\n", 
     930                                        dmi_string(dm, data[8])); 
     931                                break; 
     932 
     933                case 23: 
     934                        printf("\tSystem Reset\n"); 
     935                        break; 
    740936                case 24: 
    741937                        printf("\tHardware Security\n"); 
     
    744940                        printf("\tSystem Power Controls\n"); 
    745941                        break; 
     942                case 26: 
     943                        printf("\tVoltage Sensor\n"); 
     944                        printf("\t\tDescription: %s\n", 
     945                                        dmi_string(dm, data[4])); 
     946                        printf("\t\tDevice Location: %s\n", 
     947                               dmi_volt_loc(data[5] & 0x1f)); 
     948                        printf("\t\tDevice Status: %s\n", 
     949                               dmi_status(data[5] >> 5)); 
     950                        printf("\t\tMaximum Value: %s\n", 
     951                                dmi_millivolt(data, 6)); 
     952                        printf("\t\tMinimum Value: %s\n", 
     953                                dmi_millivolt(data, 8)); 
     954                        printf("\t\tResolution:    %s\n", 
     955                                dmi_millivolt(data, 10)); 
     956                        printf("\t\tTolerance:     %s\n", 
     957                                dmi_millivolt(data, 12)); 
     958                        printf("\t\tAccuracy:      %s\n", 
     959                                dmi_accuracy(data, 14)); 
     960                        if(dm->length > 0x14) 
     961                                printf("\t\tNominal Value: %s\n", 
     962                                        dmi_millivolt(data, 0x14)); 
     963                        break; 
     964                case 27: 
     965                        printf("\tCooling Device\n"); 
     966                        printf("\t\tDevice Type: %s\n", 
     967                               dmi_fan_type(data[5] & 0x1f)); 
     968                        printf("\t\tDevice Status: %s\n", 
     969                               dmi_status(data[5] >> 5)); 
     970                        if(dm->length > 0x0c) 
     971                                printf("\t\tNominal Speed: %s\n", 
     972                                        dmi_speed(data, 0x0c)); 
     973                        break; 
     974                case 28: 
     975                        printf("\tTemperature Sensor\n"); 
     976                        printf("\t\tDescription: %s\n", 
     977                                        dmi_string(dm, data[4])); 
     978                        printf("\t\tDevice Location: %s\n", 
     979                               dmi_temp_loc(data[5] & 0x1f)); 
     980                        printf("\t\tDevice Status: %s\n", 
     981                               dmi_status(data[5] >> 5)); 
     982                        printf("\t\tMaximum Value: %s\n", 
     983                                dmi_temp(data, 6)); 
     984                        printf("\t\tMinimum Value: %s\n", 
     985                                dmi_temp(data, 8)); 
     986                        printf("\t\tResolution:    %s\n", 
     987                                dmi_temp(data, 10)); 
     988                        printf("\t\tTolerance:     %s\n", 
     989                                dmi_temp(data, 12)); 
     990                        printf("\t\tAccuracy:      %s\n", 
     991                                dmi_accuracy(data, 14)); 
     992                        if(dm->length > 0x14) 
     993                                printf("\t\tNominal Value: %s\n", 
     994                                        dmi_temp(data, 0x14)); 
     995                        break; 
     996                case 29: 
     997                        printf("\tCurrent Sensor\n"); 
     998                        printf("\t\tDescription: %s\n", 
     999                                        dmi_string(dm, data[4])); 
     1000                        printf("\t\tDevice Location: %s\n", 
     1001                               dmi_volt_loc(data[5] & 0x1f)); 
     1002                        printf("\t\tDevice Status: %s\n", 
     1003                               dmi_status(data[5] >> 5)); 
     1004                        printf("\t\tMaximum Value: %s\n", 
     1005                                dmi_millivolt(data, 6)); 
     1006                        printf("\t\tMinimum Value: %s\n", 
     1007                                dmi_millivolt(data, 8)); 
     1008                        printf("\t\tResolution:    %s\n", 
     1009                                dmi_millivolt(data, 10)); 
     1010                        printf("\t\tTolerance:     %s\n", 
     1011                                dmi_millivolt(data, 12)); 
     1012                        printf("\t\tAccuracy:      %s\n", 
     1013                                dmi_accuracy(data, 14)); 
     1014                        if(dm->length > 0x14) 
     1015                                printf("\t\tNominal Value: %s\n", 
     1016                                        dmi_millivolt(data, 0x14)); 
     1017                        break; 
     1018                case 30: 
     1019                        printf("\tOut-of-Band Remote Access\n"); 
     1020                        break; 
     1021                case 31: 
     1022                        printf("\tBoot Integrity Services Entry Point\n"); 
     1023                        break; 
    7461024                case 32: 
    7471025                        printf("\tSystem Boot Information\n"); 
     1026                        break; 
     1027                case 33: 
     1028                        printf("\t64-bit Memory Error Information\n"); 
     1029                        break; 
     1030                case 34: 
     1031                        printf("\tManagement Device\n"); 
     1032                        printf("\t\tDescription: %s\n", 
     1033                                        dmi_string(dm, data[4])); 
     1034                        printf("\t\tDevice Type: %s\n", 
     1035                               dmi_mgmt_dev_type(data[5])); 
     1036                        printf("\t\tAddress Type: %s\n", 
     1037                               dmi_mgmt_addr_type(data[6])); 
     1038                        break; 
     1039                case 35: 
     1040                        printf("\tManagement Device Component\n"); 
     1041                        printf("\t\tDescription: %s\n", 
     1042                                        dmi_string(dm, data[4])); 
     1043                        printf("\t\tDevice Handle   : 0x%02x%02x\n", 
     1044                               data[6], data[5]); 
     1045                        printf("\t\tComponent Handle: 0x%02x%02x\n", 
     1046                               data[8], data[7]); 
     1047                        printf("\t\tThreshold Handle: 0x%02x%02x\n", 
     1048                               data[10], data[9]); 
     1049                        break; 
     1050                case 36: 
     1051                        printf("\tManagement Device Threshold Data\n"); 
     1052                        if (dm->length > 4)  
     1053                                dump_raw_data(data+4, dm->length-4); 
     1054                        break; 
     1055                case 37: 
     1056                        printf("\tMemory Channeln"); 
     1057                        break; 
     1058                case 38: 
     1059                        printf("\tIPMI Device\n"); 
     1060                        if (dm->length > 4)  
     1061                                dump_raw_data(data+4, dm->length-4); 
     1062                        break; 
     1063                case 39: 
     1064                        printf("\tPower Supply\n"); 
     1065                        if (dm->length > 4)  
     1066                                dump_raw_data(data+4, dm->length-4); 
    7481067                        break; 
    7491068                case 126: