smbios.c (03f9f63d24f0494b7d47b927090ad9045e396402) smbios.c (4e901881a1e657e1cbf12d7ef9b476ec373e7939)
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

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
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

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#include <sys/sysmacros.h>
28#include <sys/param.h>
29
30#include <smbios.h>

--- 301 unchanged lines hidden (view full) ---

332print_chassis(smbios_hdl_t *shp, id_t id, FILE *fp)
333{
334 smbios_chassis_t c;
335 int elem_cnt;
336
337 (void) smbios_info_chassis(shp, id, &c);
338
339 oprintf(fp, " OEM Data: 0x%x\n", c.smbc_oemdata);
24 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28#include <sys/sysmacros.h>
29#include <sys/param.h>
30
31#include <smbios.h>

--- 301 unchanged lines hidden (view full) ---

333print_chassis(smbios_hdl_t *shp, id_t id, FILE *fp)
334{
335 smbios_chassis_t c;
336 int elem_cnt;
337
338 (void) smbios_info_chassis(shp, id, &c);
339
340 oprintf(fp, " OEM Data: 0x%x\n", c.smbc_oemdata);
341 oprintf(fp, " SKU number: %s\n",
342 c.smbc_sku == NULL ? "<unknown>" : c.smbc_sku);
340 oprintf(fp, " Lock Present: %s\n", c.smbc_lock ? "Y" : "N");
341
342 desc_printf(smbios_chassis_type_desc(c.smbc_type),
343 fp, " Chassis Type: 0x%x", c.smbc_type);
344
345 desc_printf(smbios_chassis_state_desc(c.smbc_bustate),
346 fp, " Boot-Up State: 0x%x", c.smbc_bustate);
347

--- 45 unchanged lines hidden (view full) ---

393 uint_t status;
394
395 (void) smbios_info_processor(shp, id, &p);
396 status = SMB_PRSTATUS_STATUS(p.smbp_status);
397
398 desc_printf(smbios_processor_family_desc(p.smbp_family),
399 fp, " Family: %u", p.smbp_family);
400
343 oprintf(fp, " Lock Present: %s\n", c.smbc_lock ? "Y" : "N");
344
345 desc_printf(smbios_chassis_type_desc(c.smbc_type),
346 fp, " Chassis Type: 0x%x", c.smbc_type);
347
348 desc_printf(smbios_chassis_state_desc(c.smbc_bustate),
349 fp, " Boot-Up State: 0x%x", c.smbc_bustate);
350

--- 45 unchanged lines hidden (view full) ---

396 uint_t status;
397
398 (void) smbios_info_processor(shp, id, &p);
399 status = SMB_PRSTATUS_STATUS(p.smbp_status);
400
401 desc_printf(smbios_processor_family_desc(p.smbp_family),
402 fp, " Family: %u", p.smbp_family);
403
404 if (p.smbp_family2 != 0)
405 desc_printf(smbios_processor_family_desc(p.smbp_family2),
406 fp, " Family Ext: %u", p.smbp_family2);
407
401 oprintf(fp, " CPUID: 0x%llx\n", (u_longlong_t)p.smbp_cpuid);
402
403 desc_printf(smbios_processor_type_desc(p.smbp_type),
404 fp, " Type: %u", p.smbp_type);
405
406 desc_printf(smbios_processor_upgrade_desc(p.smbp_upgrade),
407 fp, " Socket Upgrade: %u", p.smbp_upgrade);
408

--- 18 unchanged lines hidden (view full) ---

427 break;
428 }
429 oprintf(fp, "\n");
430 } else {
431 oprintf(fp, " Supported Voltages: %.1fV\n",
432 (float)SMB_PRV_VOLTAGE(p.smbp_voltage) / 10);
433 }
434
408 oprintf(fp, " CPUID: 0x%llx\n", (u_longlong_t)p.smbp_cpuid);
409
410 desc_printf(smbios_processor_type_desc(p.smbp_type),
411 fp, " Type: %u", p.smbp_type);
412
413 desc_printf(smbios_processor_upgrade_desc(p.smbp_upgrade),
414 fp, " Socket Upgrade: %u", p.smbp_upgrade);
415

--- 18 unchanged lines hidden (view full) ---

434 break;
435 }
436 oprintf(fp, "\n");
437 } else {
438 oprintf(fp, " Supported Voltages: %.1fV\n",
439 (float)SMB_PRV_VOLTAGE(p.smbp_voltage) / 10);
440 }
441
442 if (p.smbp_corecount != 0)
443 oprintf(fp, " Core Count: %u\n", p.smbp_corecount);
444 else
445 oprintf(fp, " Core Count: Unknown\n");
446
447 if (p.smbp_coresenabled != 0)
448 oprintf(fp, " Cores Enabled: %u\n", p.smbp_coresenabled);
449 else
450 oprintf(fp, " Cores Enabled: Unknown\n");
451
452 if (p.smbp_threadcount != 0)
453 oprintf(fp, " Thread Count: %u\n", p.smbp_threadcount);
454 else
455 oprintf(fp, " Thread Count: Unknown\n");
456
457 if (p.smbp_cflags) {
458 flag_printf(fp, "Processor Characteristics",
459 p.smbp_cflags, sizeof (p.smbp_cflags) * NBBY,
460 smbios_processor_core_flag_name,
461 smbios_processor_core_flag_desc);
462 }
463
435 if (p.smbp_clkspeed != 0)
436 oprintf(fp, " External Clock Speed: %uMHz\n", p.smbp_clkspeed);
437 else
438 oprintf(fp, " External Clock Speed: Unknown\n");
439
440 if (p.smbp_maxspeed != 0)
441 oprintf(fp, " Maximum Speed: %uMHz\n", p.smbp_maxspeed);
442 else
443 oprintf(fp, " Maximum Speed: Unknown\n");
444
445 if (p.smbp_curspeed != 0)
446 oprintf(fp, " Current Speed: %uMHz\n", p.smbp_curspeed);
447 else
448 oprintf(fp, " Current Speed: Unknown\n");
449
464 if (p.smbp_clkspeed != 0)
465 oprintf(fp, " External Clock Speed: %uMHz\n", p.smbp_clkspeed);
466 else
467 oprintf(fp, " External Clock Speed: Unknown\n");
468
469 if (p.smbp_maxspeed != 0)
470 oprintf(fp, " Maximum Speed: %uMHz\n", p.smbp_maxspeed);
471 else
472 oprintf(fp, " Maximum Speed: Unknown\n");
473
474 if (p.smbp_curspeed != 0)
475 oprintf(fp, " Current Speed: %uMHz\n", p.smbp_curspeed);
476 else
477 oprintf(fp, " Current Speed: Unknown\n");
478
450 id_printf(fp, " L1 Cache: ", p.smbp_l1cache);
451 id_printf(fp, " L2 Cache: ", p.smbp_l2cache);
452 id_printf(fp, " L3 Cache: ", p.smbp_l3cache);
479 id_printf(fp, " L1 Cache: ", p.smbp_l1cache);
480 id_printf(fp, " L2 Cache: ", p.smbp_l2cache);
481 id_printf(fp, " L3 Cache: ", p.smbp_l3cache);
453}
454
455static void
456print_cache(smbios_hdl_t *shp, id_t id, FILE *fp)
457{
458 smbios_cache_t c;
459
460 (void) smbios_info_cache(shp, id, &c);

--- 209 unchanged lines hidden (view full) ---

670print_bytes(const uint8_t *data, size_t size, FILE *fp)
671{
672 size_t row, rows = P2ROUNDUP(size, 16) / 16;
673 size_t col, cols;
674
675 char buf[17];
676 uint8_t x;
677
482}
483
484static void
485print_cache(smbios_hdl_t *shp, id_t id, FILE *fp)
486{
487 smbios_cache_t c;
488
489 (void) smbios_info_cache(shp, id, &c);

--- 209 unchanged lines hidden (view full) ---

699print_bytes(const uint8_t *data, size_t size, FILE *fp)
700{
701 size_t row, rows = P2ROUNDUP(size, 16) / 16;
702 size_t col, cols;
703
704 char buf[17];
705 uint8_t x;
706
678 oprintf(fp, "\n offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f "
707 oprintf(fp, "\n offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f "
679 "0123456789abcdef\n");
680
681 for (row = 0; row < rows; row++) {
708 "0123456789abcdef\n");
709
710 for (row = 0; row < rows; row++) {
682 oprintf(fp, " %#4lx: ", (ulong_t)row * 16);
711 oprintf(fp, " %#4lx: ", (ulong_t)row * 16);
683 cols = MIN(size - row * 16, 16);
684
685 for (col = 0; col < cols; col++) {
686 if (col % 4 == 0)
687 oprintf(fp, " ");
688 x = *data++;
689 oprintf(fp, "%02x", x);
690 buf[col] = x <= ' ' || x > '~' ? '.' : x;

--- 25 unchanged lines hidden (view full) ---

716
717 desc_printf(smbios_memarray_use_desc(ma.smbma_use),
718 fp, " Use: %u", ma.smbma_use);
719
720 desc_printf(smbios_memarray_ecc_desc(ma.smbma_ecc),
721 fp, " ECC: %u", ma.smbma_ecc);
722
723 oprintf(fp, " Number of Slots/Sockets: %u\n", ma.smbma_ndevs);
712 cols = MIN(size - row * 16, 16);
713
714 for (col = 0; col < cols; col++) {
715 if (col % 4 == 0)
716 oprintf(fp, " ");
717 x = *data++;
718 oprintf(fp, "%02x", x);
719 buf[col] = x <= ' ' || x > '~' ? '.' : x;

--- 25 unchanged lines hidden (view full) ---

745
746 desc_printf(smbios_memarray_use_desc(ma.smbma_use),
747 fp, " Use: %u", ma.smbma_use);
748
749 desc_printf(smbios_memarray_ecc_desc(ma.smbma_ecc),
750 fp, " ECC: %u", ma.smbma_ecc);
751
752 oprintf(fp, " Number of Slots/Sockets: %u\n", ma.smbma_ndevs);
724 id_printf(fp, " Memory Error Data: ", ma.smbma_err);
753 id_printf(fp, " Memory Error Data: ", ma.smbma_err);
725 oprintf(fp, " Max Capacity: %llu bytes\n",
726 (u_longlong_t)ma.smbma_size);
727}
728
729static void
730print_memdevice(smbios_hdl_t *shp, id_t id, FILE *fp)
731{
732 smbios_memdevice_t md;
733
734 (void) smbios_info_memdevice(shp, id, &md);
735
754 oprintf(fp, " Max Capacity: %llu bytes\n",
755 (u_longlong_t)ma.smbma_size);
756}
757
758static void
759print_memdevice(smbios_hdl_t *shp, id_t id, FILE *fp)
760{
761 smbios_memdevice_t md;
762
763 (void) smbios_info_memdevice(shp, id, &md);
764
736 id_printf(fp, " Physical Memory Array: ", md.smbmd_array);
737 id_printf(fp, " Memory Error Data: ", md.smbmd_error);
765 id_printf(fp, " Physical Memory Array: ", md.smbmd_array);
766 id_printf(fp, " Memory Error Data: ", md.smbmd_error);
738
739 if (md.smbmd_twidth != -1u)
740 oprintf(fp, " Total Width: %u bits\n", md.smbmd_twidth);
741 else
742 oprintf(fp, " Total Width: Unknown\n");
743
744 if (md.smbmd_dwidth != -1u)
745 oprintf(fp, " Data Width: %u bits\n", md.smbmd_dwidth);

--- 17 unchanged lines hidden (view full) ---

763
764 if (md.smbmd_set == 0)
765 oprintf(fp, " Set: None\n");
766 else if (md.smbmd_set == (uint8_t)-1u)
767 oprintf(fp, " Set: Unknown\n");
768 else
769 oprintf(fp, " Set: %u\n", md.smbmd_set);
770
767
768 if (md.smbmd_twidth != -1u)
769 oprintf(fp, " Total Width: %u bits\n", md.smbmd_twidth);
770 else
771 oprintf(fp, " Total Width: Unknown\n");
772
773 if (md.smbmd_dwidth != -1u)
774 oprintf(fp, " Data Width: %u bits\n", md.smbmd_dwidth);

--- 17 unchanged lines hidden (view full) ---

792
793 if (md.smbmd_set == 0)
794 oprintf(fp, " Set: None\n");
795 else if (md.smbmd_set == (uint8_t)-1u)
796 oprintf(fp, " Set: Unknown\n");
797 else
798 oprintf(fp, " Set: %u\n", md.smbmd_set);
799
800 if (md.smbmd_rank != 0) {
801 desc_printf(smbios_memdevice_rank_desc(md.smbmd_rank),
802 fp, " Rank: %u", md.smbmd_rank);
803 } else {
804 oprintf(fp, " Rank: Unknown\n");
805 }
806
771 desc_printf(smbios_memdevice_type_desc(md.smbmd_type),
772 fp, " Memory Type: %u", md.smbmd_type);
773
774 flag_printf(fp, "Flags", md.smbmd_flags, sizeof (md.smbmd_flags) * NBBY,
775 smbios_memdevice_flag_name, smbios_memdevice_flag_desc);
776
777 if (md.smbmd_speed != 0)
807 desc_printf(smbios_memdevice_type_desc(md.smbmd_type),
808 fp, " Memory Type: %u", md.smbmd_type);
809
810 flag_printf(fp, "Flags", md.smbmd_flags, sizeof (md.smbmd_flags) * NBBY,
811 smbios_memdevice_flag_name, smbios_memdevice_flag_desc);
812
813 if (md.smbmd_speed != 0)
778 oprintf(fp, " Speed: %uns\n", md.smbmd_speed);
814 oprintf(fp, " Speed: %u MHz\n", md.smbmd_speed);
779 else
780 oprintf(fp, " Speed: Unknown\n");
781
815 else
816 oprintf(fp, " Speed: Unknown\n");
817
818 if (md.smbmd_clkspeed != 0)
819 oprintf(fp, " Configured Speed: %u MHz\n", md.smbmd_clkspeed);
820 else
821 oprintf(fp, " Configured Speed: Unknown\n");
822
782 oprintf(fp, " Device Locator: %s\n", md.smbmd_dloc);
783 oprintf(fp, " Bank Locator: %s\n", md.smbmd_bloc);
823 oprintf(fp, " Device Locator: %s\n", md.smbmd_dloc);
824 oprintf(fp, " Bank Locator: %s\n", md.smbmd_bloc);
825
826 if (md.smbmd_minvolt != 0) {
827 oprintf(fp, " Minimum Voltage: %.2fV\n",
828 md.smbmd_minvolt / 1000.0);
829 } else {
830 oprintf(fp, " Minimum Voltage: Unknown\n");
831 }
832
833 if (md.smbmd_maxvolt != 0) {
834 oprintf(fp, " Maximum Voltage: %.2fV\n",
835 md.smbmd_maxvolt / 1000.0);
836 } else {
837 oprintf(fp, " Maximum Voltage: Unknown\n");
838 }
839
840 if (md.smbmd_confvolt != 0) {
841 oprintf(fp, " Configured Voltage: %.2fV\n",
842 md.smbmd_confvolt / 1000.0);
843 } else {
844 oprintf(fp, " Configured Voltage: Unknown\n");
845 }
784}
785
786static void
787print_memarrmap(smbios_hdl_t *shp, id_t id, FILE *fp)
788{
789 smbios_memarrmap_t ma;
790
791 (void) smbios_info_memarrmap(shp, id, &ma);
792
846}
847
848static void
849print_memarrmap(smbios_hdl_t *shp, id_t id, FILE *fp)
850{
851 smbios_memarrmap_t ma;
852
853 (void) smbios_info_memarrmap(shp, id, &ma);
854
793 id_printf(fp, " Physical Memory Array: ", ma.smbmam_array);
855 id_printf(fp, " Physical Memory Array: ", ma.smbmam_array);
794 oprintf(fp, " Devices per Row: %u\n", ma.smbmam_width);
795
796 oprintf(fp, " Physical Address: 0x%llx\n Size: %llu bytes\n",
797 (u_longlong_t)ma.smbmam_addr, (u_longlong_t)ma.smbmam_size);
798}
799
800static void
801print_memdevmap(smbios_hdl_t *shp, id_t id, FILE *fp)
802{
803 smbios_memdevmap_t md;
804
805 (void) smbios_info_memdevmap(shp, id, &md);
806
856 oprintf(fp, " Devices per Row: %u\n", ma.smbmam_width);
857
858 oprintf(fp, " Physical Address: 0x%llx\n Size: %llu bytes\n",
859 (u_longlong_t)ma.smbmam_addr, (u_longlong_t)ma.smbmam_size);
860}
861
862static void
863print_memdevmap(smbios_hdl_t *shp, id_t id, FILE *fp)
864{
865 smbios_memdevmap_t md;
866
867 (void) smbios_info_memdevmap(shp, id, &md);
868
807 id_printf(fp, " Memory Device: ", md.smbmdm_device);
808 id_printf(fp, " Memory Array Mapped Address: ", md.smbmdm_arrmap);
869 id_printf(fp, " Memory Device: ", md.smbmdm_device);
870 id_printf(fp, " Memory Array Mapped Address: ", md.smbmdm_arrmap);
809
810 oprintf(fp, " Physical Address: 0x%llx\n Size: %llu bytes\n",
811 (u_longlong_t)md.smbmdm_addr, (u_longlong_t)md.smbmdm_size);
812
813 oprintf(fp, " Partition Row Position: %u\n", md.smbmdm_rpos);
814 oprintf(fp, " Interleave Position: %u\n", md.smbmdm_ipos);
815 oprintf(fp, " Interleave Data Depth: %u\n", md.smbmdm_idepth);
816}

--- 157 unchanged lines hidden (view full) ---

974
975 if (g_hdr++ == 0 || !opt_s)
976 oprintf(fp, "%-5s %-4s %s\n", "ID", "SIZE", "TYPE");
977
978 oprintf(fp, "%-5u %-4lu",
979 (uint_t)sp->smbstr_id, (ulong_t)sp->smbstr_size);
980
981 if ((s = smbios_type_name(sp->smbstr_type)) != NULL)
871
872 oprintf(fp, " Physical Address: 0x%llx\n Size: %llu bytes\n",
873 (u_longlong_t)md.smbmdm_addr, (u_longlong_t)md.smbmdm_size);
874
875 oprintf(fp, " Partition Row Position: %u\n", md.smbmdm_rpos);
876 oprintf(fp, " Interleave Position: %u\n", md.smbmdm_ipos);
877 oprintf(fp, " Interleave Data Depth: %u\n", md.smbmdm_idepth);
878}

--- 157 unchanged lines hidden (view full) ---

1036
1037 if (g_hdr++ == 0 || !opt_s)
1038 oprintf(fp, "%-5s %-4s %s\n", "ID", "SIZE", "TYPE");
1039
1040 oprintf(fp, "%-5u %-4lu",
1041 (uint_t)sp->smbstr_id, (ulong_t)sp->smbstr_size);
1042
1043 if ((s = smbios_type_name(sp->smbstr_type)) != NULL)
982 oprintf(fp, " %s", s);
1044 oprintf(fp, " (%u) %s", sp->smbstr_type, s);
983 else if (sp->smbstr_type > SMB_TYPE_OEM_LO &&
984 sp->smbstr_type < SMB_TYPE_OEM_HI)
1045 else if (sp->smbstr_type > SMB_TYPE_OEM_LO &&
1046 sp->smbstr_type < SMB_TYPE_OEM_HI)
985 oprintf(fp, " %s+%u", "SMB_TYPE_OEM_LO",
1047 oprintf(fp, " (%u) %s+%u", sp->smbstr_type, "SMB_TYPE_OEM_LO",
986 sp->smbstr_type - SMB_TYPE_OEM_LO);
987 else
988 oprintf(fp, " %u", sp->smbstr_type);
989
990 if ((s = smbios_type_desc(sp->smbstr_type)) != NULL)
991 oprintf(fp, " (%s)\n", s);
992 else
993 oprintf(fp, "\n");

--- 290 unchanged lines hidden ---
1048 sp->smbstr_type - SMB_TYPE_OEM_LO);
1049 else
1050 oprintf(fp, " %u", sp->smbstr_type);
1051
1052 if ((s = smbios_type_desc(sp->smbstr_type)) != NULL)
1053 oprintf(fp, " (%s)\n", s);
1054 else
1055 oprintf(fp, "\n");

--- 290 unchanged lines hidden ---