smbios.c (0f56e145e1bddbb7bdc804efe2d5fcbe21d5aec2) | smbios.c (d53cdfab6d4896af92b7a3df87a26060caf179ae) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 466 unchanged lines hidden (view full) --- 475 } 476 } 477} 478 479static void 480print_chassis(smbios_hdl_t *shp, id_t id, FILE *fp) 481{ 482 smbios_chassis_t c; | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 466 unchanged lines hidden (view full) --- 475 } 476 } 477} 478 479static void 480print_chassis(smbios_hdl_t *shp, id_t id, FILE *fp) 481{ 482 smbios_chassis_t c; |
483 int elem_cnt; | 483 smbios_chassis_entry_t *elts; 484 uint_t nelts, i; |
484 485 (void) smbios_info_chassis(shp, id, &c); 486 487 oprintf(fp, " OEM Data: 0x%x\n", c.smbc_oemdata); 488 str_print(fp, " SKU Number", 489 c.smbc_sku[0] == '\0' ? "<unknown>" : c.smbc_sku); 490 oprintf(fp, " Lock Present: %s\n", c.smbc_lock ? "Y" : "N"); 491 --- 7 unchanged lines hidden (view full) --- 499 fp, " Power Supply State: 0x%x", c.smbc_psstate); 500 501 desc_printf(smbios_chassis_state_desc(c.smbc_thstate), 502 fp, " Thermal State: 0x%x", c.smbc_thstate); 503 504 oprintf(fp, " Chassis Height: %uu\n", c.smbc_uheight); 505 oprintf(fp, " Power Cords: %u\n", c.smbc_cords); 506 | 485 486 (void) smbios_info_chassis(shp, id, &c); 487 488 oprintf(fp, " OEM Data: 0x%x\n", c.smbc_oemdata); 489 str_print(fp, " SKU Number", 490 c.smbc_sku[0] == '\0' ? "<unknown>" : c.smbc_sku); 491 oprintf(fp, " Lock Present: %s\n", c.smbc_lock ? "Y" : "N"); 492 --- 7 unchanged lines hidden (view full) --- 500 fp, " Power Supply State: 0x%x", c.smbc_psstate); 501 502 desc_printf(smbios_chassis_state_desc(c.smbc_thstate), 503 fp, " Thermal State: 0x%x", c.smbc_thstate); 504 505 oprintf(fp, " Chassis Height: %uu\n", c.smbc_uheight); 506 oprintf(fp, " Power Cords: %u\n", c.smbc_cords); 507 |
507 elem_cnt = c.smbc_elems; 508 oprintf(fp, " Element Records: %u\n", elem_cnt); | 508 oprintf(fp, " Element Records: %u\n", c.smbc_elems); |
509 | 509 |
510 if (elem_cnt > 0) { 511 id_t *elems; 512 uint8_t type; 513 int i, n, cnt; | 510 if (c.smbc_elems == 0) { 511 return; 512 } |
514 | 513 |
515 elems = alloca(c.smbc_elems * sizeof (id_t)); 516 cnt = smbios_info_contains(shp, id, elem_cnt, elems); 517 if (cnt > SMB_CONT_MAX) 518 return; 519 n = MIN(elem_cnt, cnt); | 514 if (smbios_info_chassis_elts(shp, id, &nelts, &elts) != 0) { 515 smbios_warn(shp, "failed to read chassis elements"); 516 return; 517 } |
520 | 518 |
521 oprintf(fp, "\n"); 522 for (i = 0; i < n; i++) { 523 type = (uint8_t)elems[i]; 524 if (type & 0x80) { 525 /* SMBIOS structrure Type */ 526 desc_printf(smbios_type_name(type & 0x7f), fp, 527 " Contained SMBIOS structure Type: %u", 528 type & 0x80); 529 } else { 530 /* SMBIOS Base Board Type */ 531 desc_printf(smbios_bboard_type_desc(type), fp, 532 " Contained SMBIOS Base Board Type: 0x%x", 533 type); 534 } | 519 oprintf(fp, "\n"); 520 521 for (i = 0; i < nelts; i++) { 522 switch (elts[i].smbce_type) { 523 case SMB_CELT_BBOARD: 524 desc_printf(smbios_bboard_type_desc(elts[i].smbce_elt), 525 fp, " Contained SMBIOS Base Board Type: 0x%x", 526 elts[i].smbce_elt); 527 break; 528 case SMB_CELT_SMBIOS: 529 desc_printf(smbios_type_name(elts[i].smbce_elt), fp, 530 " Contained SMBIOS structure Type: %u", 531 elts[i].smbce_elt); 532 break; 533 default: 534 oprintf(fp, " Unknown contained Type: %u/%u\n", 535 elts[i].smbce_type, elts[i].smbce_elt); 536 break; |
535 } | 537 } |
538 oprintf(fp, " Minimum number: %u\n", elts[i].smbce_min); 539 oprintf(fp, " Maximum number: %u\n", elts[i].smbce_max); |
|
536 } 537} 538 539static void 540print_processor(smbios_hdl_t *shp, id_t id, FILE *fp) 541{ 542 smbios_processor_t p; 543 uint_t status; --- 233 unchanged lines hidden (view full) --- 777 desc_printf(smbios_slot_width_desc(s.smbl_pwidth), 778 fp, " Physical Width: 0x%x", s.smbl_pwidth); 779 } 780 781 if (s.smbl_pitch != 0) { 782 oprintf(fp, " Slot Pitch: %u.%u mm\n", s.smbl_pitch / 100, 783 s.smbl_pitch % 100); 784 } | 540 } 541} 542 543static void 544print_processor(smbios_hdl_t *shp, id_t id, FILE *fp) 545{ 546 smbios_processor_t p; 547 uint_t status; --- 233 unchanged lines hidden (view full) --- 781 desc_printf(smbios_slot_width_desc(s.smbl_pwidth), 782 fp, " Physical Width: 0x%x", s.smbl_pwidth); 783 } 784 785 if (s.smbl_pitch != 0) { 786 oprintf(fp, " Slot Pitch: %u.%u mm\n", s.smbl_pitch / 100, 787 s.smbl_pitch % 100); 788 } |
789 790 /* 791 * The slot height was introduced in SMBIOS 3.5. However, a value of 792 * zero here does not mean that it is unknown, but rather that the 793 * concept is not applicable. Therefore we cannot use a standard check 794 * against zero for this and instead use the version. 795 */ 796 if (smbios_vergteq(&v, 3, 5)) { 797 desc_printf(smbios_slot_height_desc(s.smbl_height), fp, 798 " Height: 0x%x", s.smbl_height); 799 } else { 800 oprintf(fp, " Height: unknown\n"); 801 } |
|
785} 786 787static void 788print_obdevs_ext(smbios_hdl_t *shp, id_t id, FILE *fp) 789{ 790 boolean_t enabled; 791 smbios_obdev_ext_t oe; 792 const char *type; 793 794 (void) smbios_info_obdevs_ext(shp, id, &oe); 795 796 /* 797 * Bit 7 is always whether or not the device is enabled while bits 0:6 798 * are the actual device type. 799 */ 800 enabled = oe.smboe_dtype >> 7; | 802} 803 804static void 805print_obdevs_ext(smbios_hdl_t *shp, id_t id, FILE *fp) 806{ 807 boolean_t enabled; 808 smbios_obdev_ext_t oe; 809 const char *type; 810 811 (void) smbios_info_obdevs_ext(shp, id, &oe); 812 813 /* 814 * Bit 7 is always whether or not the device is enabled while bits 0:6 815 * are the actual device type. 816 */ 817 enabled = oe.smboe_dtype >> 7; |
801 type = smbios_onboard_type_desc(oe.smboe_dtype & 0x7f); | 818 type = smbios_onboard_ext_type_desc(oe.smboe_dtype & 0x7f); |
802 803 str_print(fp, " Reference Designator", oe.smboe_name); 804 oprintf(fp, " Device Enabled: %s\n", enabled == B_TRUE ? "true" : 805 "false"); 806 oprintf(fp, " Device Type: %s\n", type); 807 oprintf(fp, " Device Type Instance: %u\n", oe.smboe_dti); 808 oprintf(fp, " Segment Group Number: %u\n", oe.smboe_sg); 809 oprintf(fp, " Bus Number: %u\n", oe.smboe_bus); --- 870 unchanged lines hidden (view full) --- 1680 oprintf(fp, " DRAM Channel: %u\n", emd.smbmdeve_drch); 1681 oprintf(fp, " Number of Chip Selects: %u\n", emd.smbmdeve_ncs); 1682 1683 for (i = 0; i < emd.smbmdeve_ncs; i++) { 1684 oprintf(fp, " Chip Select: %u\n", emd.smbmdeve_cs[i]); 1685 } 1686} 1687 | 819 820 str_print(fp, " Reference Designator", oe.smboe_name); 821 oprintf(fp, " Device Enabled: %s\n", enabled == B_TRUE ? "true" : 822 "false"); 823 oprintf(fp, " Device Type: %s\n", type); 824 oprintf(fp, " Device Type Instance: %u\n", oe.smboe_dti); 825 oprintf(fp, " Segment Group Number: %u\n", oe.smboe_sg); 826 oprintf(fp, " Bus Number: %u\n", oe.smboe_bus); --- 870 unchanged lines hidden (view full) --- 1697 oprintf(fp, " DRAM Channel: %u\n", emd.smbmdeve_drch); 1698 oprintf(fp, " Number of Chip Selects: %u\n", emd.smbmdeve_ncs); 1699 1700 for (i = 0; i < emd.smbmdeve_ncs; i++) { 1701 oprintf(fp, " Chip Select: %u\n", emd.smbmdeve_cs[i]); 1702 } 1703} 1704 |
1705static void 1706print_strprop_info(smbios_hdl_t *shp, id_t id, FILE *fp) 1707{ 1708 smbios_strprop_t prop; 1709 1710 if (smbios_info_strprop(shp, id, &prop) != 0) { 1711 smbios_warn(shp, "failed to read string property information"); 1712 return; 1713 } 1714 1715 desc_printf(smbios_strprop_id_desc(prop.smbsp_prop_id), fp, 1716 " Property ID: %u", prop.smbsp_prop_id); 1717 if (prop.smbsp_prop_val != NULL) { 1718 str_print(fp, " Property Value", prop.smbsp_prop_val); 1719 } 1720 id_printf(fp, " Parent Handle: ", prop.smbsp_parent); 1721} 1722 1723static void 1724print_fwinfo(smbios_hdl_t *shp, id_t id, FILE *fp) 1725{ 1726 smbios_fwinfo_t fw; 1727 smbios_fwinfo_comp_t *comps; 1728 uint_t ncomps, i; 1729 1730 if (smbios_info_fwinfo(shp, id, &fw) != 0) { 1731 smbios_warn(shp, "failed to read firmware inventory"); 1732 return; 1733 } 1734 1735 str_print(fp, " Component Name", fw.smbfw_name); 1736 str_print(fp, " ID", fw.smbfw_id); 1737 str_print(fp, " Release Date", fw.smbfw_reldate); 1738 str_print(fp, " Lowest Supported Version", fw.smbfw_lsv); 1739 desc_printf(smbios_fwinfo_vers_desc(fw.smbfw_vers_fmt), fp, 1740 " Version Format: %u", fw.smbfw_vers_fmt); 1741 desc_printf(smbios_fwinfo_id_desc(fw.smbfw_id_fmt), fp, 1742 " ID Format: %u", fw.smbfw_id_fmt); 1743 if (fw.smbfw_imgsz != UINT64_MAX) { 1744 oprintf(fp, " Image Size: %" PRIu64 "\n", fw.smbfw_imgsz); 1745 } else { 1746 oprintf(fp, " Image Size: unknown\n"); 1747 } 1748 1749 flag_printf(fp, "Characteristics", fw.smbfw_chars, 1750 sizeof (fw.smbfw_chars) * NBBY, smbios_fwinfo_ch_name, 1751 smbios_fwinfo_ch_desc); 1752 1753 desc_printf(smbios_fwinfo_state_desc(fw.smbfw_state), fp, " State: %u", 1754 fw.smbfw_state); 1755 oprintf(fp, " Number of Associated Components: %u\n", 1756 fw.smbfw_ncomps); 1757 1758 if (fw.smbfw_ncomps == 0) 1759 return; 1760 1761 if (smbios_info_fwinfo_comps(shp, id, &ncomps, &comps) == -1) { 1762 smbios_warn(shp, "failed to read firmware inventory " 1763 "components"); 1764 return; 1765 } 1766 1767 oprintf(fp, "\n Component Handles:\n"); 1768 for (i = 0; i < ncomps; i++) { 1769 oprintf(fp, " %ld\n", comps[i]); 1770 } 1771} 1772 |
|
1688static int 1689print_struct(smbios_hdl_t *shp, const smbios_struct_t *sp, void *fp) 1690{ 1691 smbios_info_t info; 1692 int hex = opt_x; 1693 const char *s; 1694 1695 if (opt_t != -1 && opt_t != sp->smbstr_type) --- 140 unchanged lines hidden (view full) --- 1836 case SMB_TYPE_OBDEVEXT: 1837 oprintf(fp, "\n"); 1838 print_obdevs_ext(shp, sp->smbstr_id, fp); 1839 break; 1840 case SMB_TYPE_PROCESSOR_INFO: 1841 oprintf(fp, "\n"); 1842 print_processor_info(shp, sp->smbstr_id, fp); 1843 break; | 1773static int 1774print_struct(smbios_hdl_t *shp, const smbios_struct_t *sp, void *fp) 1775{ 1776 smbios_info_t info; 1777 int hex = opt_x; 1778 const char *s; 1779 1780 if (opt_t != -1 && opt_t != sp->smbstr_type) --- 140 unchanged lines hidden (view full) --- 1921 case SMB_TYPE_OBDEVEXT: 1922 oprintf(fp, "\n"); 1923 print_obdevs_ext(shp, sp->smbstr_id, fp); 1924 break; 1925 case SMB_TYPE_PROCESSOR_INFO: 1926 oprintf(fp, "\n"); 1927 print_processor_info(shp, sp->smbstr_id, fp); 1928 break; |
1929 case SMB_TYPE_STRPROP: 1930 oprintf(fp, "\n"); 1931 print_strprop_info(shp, sp->smbstr_id, fp); 1932 break; 1933 case SMB_TYPE_FWINFO: 1934 oprintf(fp, "\n"); 1935 print_fwinfo(shp, sp->smbstr_id, fp); 1936 break; |
|
1844 case SUN_OEM_EXT_PROCESSOR: 1845 oprintf(fp, "\n"); 1846 print_extprocessor(shp, sp->smbstr_id, fp); 1847 break; 1848 case SUN_OEM_EXT_PORT: 1849 oprintf(fp, "\n"); 1850 print_extport(shp, sp->smbstr_id, fp); 1851 break; --- 196 unchanged lines hidden --- | 1937 case SUN_OEM_EXT_PROCESSOR: 1938 oprintf(fp, "\n"); 1939 print_extprocessor(shp, sp->smbstr_id, fp); 1940 break; 1941 case SUN_OEM_EXT_PORT: 1942 oprintf(fp, "\n"); 1943 print_extport(shp, sp->smbstr_id, fp); 1944 break; --- 196 unchanged lines hidden --- |