diff options
author | Robert Mustacchi <rm@joyent.com> | 2016-11-29 22:32:42 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2016-12-02 21:52:13 +0000 |
commit | c180fecb1d3e6f21a8453964dd4f3b5e4acce56c (patch) | |
tree | e688f18b78c6bcd49e7aff386684e938da49f760 | |
parent | db312d1a324a6063747891aa2872f2903e28ab9a (diff) | |
download | illumos-joyent-c180fecb1d3e6f21a8453964dd4f3b5e4acce56c.tar.gz |
OS-5818 Want SMBIOS 3.1 support
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r-- | usr/src/cmd/smbios/smbios.c | 19 | ||||
-rw-r--r-- | usr/src/common/smbios/smb_info.c | 84 | ||||
-rw-r--r-- | usr/src/common/smbios/smb_open.c | 11 | ||||
-rw-r--r-- | usr/src/uts/common/sys/smbios.h | 52 | ||||
-rw-r--r-- | usr/src/uts/common/sys/smbios_impl.h | 47 |
5 files changed, 187 insertions, 26 deletions
diff --git a/usr/src/cmd/smbios/smbios.c b/usr/src/cmd/smbios/smbios.c index 68455016ab..a61db53331 100644 --- a/usr/src/cmd/smbios/smbios.c +++ b/usr/src/cmd/smbios/smbios.c @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -239,7 +239,7 @@ print_bios(smbios_hdl_t *shp, FILE *fp) oprintf(fp, " Version String: %s\n", b.smbb_version); oprintf(fp, " Release Date: %s\n", b.smbb_reldate); oprintf(fp, " Address Segment: 0x%x\n", b.smbb_segment); - oprintf(fp, " ROM Size: %u bytes\n", b.smbb_romsize); + oprintf(fp, " ROM Size: %" PRIu64 " bytes\n", b.smbb_extromsize); oprintf(fp, " Image Size: %u bytes\n", b.smbb_runsize); flag64_printf(fp, "Characteristics", @@ -508,12 +508,15 @@ print_cache(smbios_hdl_t *shp, id_t id, FILE *fp) (void) smbios_info_cache(shp, id, &c); oprintf(fp, " Level: %u\n", c.smba_level); - oprintf(fp, " Maximum Installed Size: %u bytes\n", c.smba_maxsize); + oprintf(fp, " Maximum Installed Size: %" PRIu64 " bytes\n", + c.smba_maxsize2); - if (c.smba_size != 0) - oprintf(fp, " Installed Size: %u bytes\n", c.smba_size); - else + if (c.smba_size2 != 0) { + oprintf(fp, " Installed Size: %" PRIu64 " bytes\n", + c.smba_size2); + } else { oprintf(fp, " Installed Size: Not Installed\n"); + } if (c.smba_speed != 0) oprintf(fp, " Speed: %uns\n", c.smba_speed); @@ -841,12 +844,12 @@ print_memdevice(smbios_hdl_t *shp, id_t id, FILE *fp) smbios_memdevice_flag_name, smbios_memdevice_flag_desc); if (md.smbmd_speed != 0) - oprintf(fp, " Speed: %u MHz\n", md.smbmd_speed); + oprintf(fp, " Speed: %u MT/s\n", md.smbmd_speed); else oprintf(fp, " Speed: Unknown\n"); if (md.smbmd_clkspeed != 0) - oprintf(fp, " Configured Speed: %u MHz\n", md.smbmd_clkspeed); + oprintf(fp, " Configured Speed: %u MT/s\n", md.smbmd_clkspeed); else oprintf(fp, " Configured Speed: Unknown\n"); diff --git a/usr/src/common/smbios/smb_info.c b/usr/src/common/smbios/smb_info.c index 2eb9d8351b..ea8caaed97 100644 --- a/usr/src/common/smbios/smb_info.c +++ b/usr/src/common/smbios/smb_info.c @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -66,6 +66,7 @@ */ #include <sys/smbios_impl.h> +#include <sys/byteorder.h> #ifdef _KERNEL #include <sys/sunddi.h> @@ -347,7 +348,10 @@ smbios_info_bios(smbios_hdl_t *shp, smbios_bios_t *bp) return (smb_set_errno(shp, ESMB_CORRUPT)); bip = (smb_bios_t *)(uintptr_t)stp->smbst_hdr; - bzero(bp, sizeof (smbios_bios_t)); + bzero(bp, sizeof (smb_base_bios_t)); + if (smb_libgteq(shp, SMB_VERSION_31)) { + bp->smbb_extromsize = 0; + } bp->smbb_vendor = smb_strptr(stp, bip->smbbi_vendor); bp->smbb_version = smb_strptr(stp, bip->smbbi_version); @@ -377,6 +381,50 @@ smbios_info_bios(smbios_hdl_t *shp, smbios_bios_t *bp) bp->smbb_ecfwv.smbv_minor = bip->smbbi_xcflags[SMB_BIOSXB_ECFW_MIN]; } + + if (bp->smbb_nxcflags > SMB_BIOSXB_EXTROM + 1 && + smb_gteq(shp, SMB_VERSION_31)) { + uint16_t val; + uint64_t rs; + + /* + * Because of the fact that the extended size is a + * uint16_t and we'd need to define an explicit + * endian-aware way to access it, we don't include it in + * the number of extended flags below and thus subtract + * its size. + */ + bp->smbb_nxcflags -= sizeof (uint16_t); + bcopy(&bip->smbbi_xcflags[SMB_BIOSXB_EXTROM], &val, + sizeof (val)); + val = LE_16(val); + + /* + * The upper two bits of the extended rom size are used + * to indicate whether the other 14 bits are in MB or + * GB. + */ + rs = SMB_BIOS_EXTROM_VALUE_MASK(val); + switch (SMB_BIOS_EXTROM_SHIFT_MASK(val)) { + case 0: + rs *= 1024ULL * 1024ULL; + break; + case 1: + rs *= 1024ULL * 1024ULL * 1024ULL; + break; + default: + rs = 0; + break; + } + + if (smb_libgteq(shp, SMB_VERSION_31)) { + bp->smbb_extromsize = rs; + } + } + } + + if (smb_libgteq(shp, SMB_VERSION_31) && bp->smbb_extromsize == 0) { + bp->smbb_extromsize = bp->smbb_romsize; } return (stp->smbst_hdr->smbh_hdl); @@ -442,7 +490,7 @@ smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp) smb_info_bcopy(stp->smbst_hdr, ch, sizeof (buf)); bzero(chp, sizeof (smb_base_chassis_t)); - if (shp->sh_libvers >= SMB_VERSION_27) { + if (smb_libgteq(shp, SMB_VERSION_27)) { bzero(chp->smbc_sku, sizeof (chp->smbc_sku)); } @@ -458,7 +506,7 @@ smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp) chp->smbc_elems = ch->smbch_cn; chp->smbc_elemlen = ch->smbch_cm; - if (shp->sh_libvers >= SMB_VERSION_27) { + if (smb_libgteq(shp, SMB_VERSION_27)) { (void) strlcpy(chp->smbc_sku, SMB_CH_SKU(ch), sizeof (chp->smbc_sku)); } @@ -493,17 +541,18 @@ smbios_info_processor(smbios_hdl_t *shp, id_t id, smbios_processor_t *pp) pp->smbp_l2cache = p.smbpr_l2cache; pp->smbp_l3cache = p.smbpr_l3cache; - if (shp->sh_libvers >= SMB_VERSION_25) { + if (smb_libgteq(shp, SMB_VERSION_25)) { pp->smbp_corecount = p.smbpr_corecount; pp->smbp_coresenabled = p.smbpr_coresenabled; pp->smbp_threadcount = p.smbpr_threadcount; pp->smbp_cflags = p.smbpr_cflags; } - if (shp->sh_libvers >= SMB_VERSION_26) + if (smb_libgteq(shp, SMB_VERSION_26)) { pp->smbp_family2 = p.smbpr_family2; + } - if (shp->sh_libvers >= SMB_VERSION_30) { + if (smb_libgteq(shp, SMB_VERSION_30)) { pp->smbp_corecount2 = p.smbpr_corecount2; pp->smbp_coresenabled2 = p.smbpr_coresenabled2; pp->smbp_threadcount2 = p.smbpr_threadcount2; @@ -525,7 +574,7 @@ smbios_info_cache(smbios_hdl_t *shp, id_t id, smbios_cache_t *cap) return (smb_set_errno(shp, ESMB_TYPE)); smb_info_bcopy(stp->smbst_hdr, &c, sizeof (c)); - bzero(cap, sizeof (smbios_cache_t)); + bzero(cap, sizeof (smb_base_cache_t)); cap->smba_maxsize = SMB_CACHE_SIZE(c.smbca_maxsize); cap->smba_size = SMB_CACHE_SIZE(c.smbca_size); @@ -545,6 +594,17 @@ smbios_info_cache(smbios_hdl_t *shp, id_t id, smbios_cache_t *cap) if (SMB_CACHE_CFG_SOCKETED(c.smbca_config)) cap->smba_flags |= SMB_CAF_SOCKETED; + if (smb_libgteq(shp, SMB_VERSION_31)) { + if (smb_gteq(shp, SMB_VERSION_31)) { + cap->smba_maxsize2 = + SMB_CACHE_EXT_SIZE(c.smbca_maxsize2); + cap->smba_size2 = SMB_CACHE_EXT_SIZE(c.smbca_size2); + } else { + cap->smba_maxsize2 = cap->smba_maxsize; + cap->smba_size2 = cap->smba_size; + } + } + return (0); } @@ -841,13 +901,15 @@ smbios_info_memdevice(smbios_hdl_t *shp, id_t id, smbios_memdevice_t *mdp) mdp->smbmd_dloc = smb_strptr(stp, m.smbmdev_dloc); mdp->smbmd_bloc = smb_strptr(stp, m.smbmdev_bloc); - if (shp->sh_libvers >= SMB_VERSION_26) + if (smb_libgteq(shp, SMB_VERSION_26)) { mdp->smbmd_rank = m.smbmdev_attrs & 0x0F; + } - if (shp->sh_libvers >= SMB_VERSION_27) + if (smb_libgteq(shp, SMB_VERSION_27)) { mdp->smbmd_clkspeed = m.smbmdev_clkspeed; + } - if (shp->sh_libvers >= SMB_VERSION_28) { + if (smb_libgteq(shp, SMB_VERSION_28)) { mdp->smbmd_minvolt = m.smbmdev_minvolt; mdp->smbmd_maxvolt = m.smbmdev_maxvolt; mdp->smbmd_confvolt = m.smbmdev_confvolt; diff --git a/usr/src/common/smbios/smb_open.c b/usr/src/common/smbios/smb_open.c index c5417e0c0f..23d4a0aaca 100644 --- a/usr/src/common/smbios/smb_open.c +++ b/usr/src/common/smbios/smb_open.c @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -89,6 +89,7 @@ smbios_bufopen(const smbios_entry_t *ep, const void *buf, size_t len, case SMB_VERSION_27: case SMB_VERSION_28: case SMB_VERSION_30: + case SMB_VERSION_31: break; default: return (smb_open_error(shp, errp, ESMB_VERSION)); @@ -398,6 +399,14 @@ smb_strptr(const smb_struct_t *stp, uint_t i) } int +smb_libgteq(smbios_hdl_t *shp, int version) +{ + return (SMB_MAJOR(shp->sh_libvers) > SMB_MAJOR(version) || ( + SMB_MAJOR(shp->sh_libvers) == SMB_MAJOR(version) && + SMB_MINOR(shp->sh_libvers) >= SMB_MINOR(version))); +} + +int smb_gteq(smbios_hdl_t *shp, int version) { return (SMB_MAJOR(shp->sh_smbvers) > SMB_MAJOR(version) || ( diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h index 6f0f795af5..86780e68dd 100644 --- a/usr/src/uts/common/sys/smbios.h +++ b/usr/src/uts/common/sys/smbios.h @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -125,6 +125,7 @@ typedef struct smbios_entry { #define SMB_TYPE_ADDINFO 40 /* additional information */ #define SMB_TYPE_OBDEVEXT 41 /* on-board device extended info */ #define SMB_TYPE_MCHI 42 /* mgmt controller host interface */ +#define SMB_TYPE_TPM 43 /* TPM device */ #define SMB_TYPE_INACTIVE 126 /* inactive table entry */ #define SMB_TYPE_EOT 127 /* end of table */ @@ -174,7 +175,9 @@ typedef struct smbios_version { /* * SMBIOS Bios Information. See DSP0134 Section 7.1 for more information. - * smbb_romsize is converted from the implementation format into bytes. + * smbb_romsize is converted from the implementation format into bytes. Note, if + * we do not have an extended BIOS ROM size, it is filled in with the default + * BIOS ROM size. */ typedef struct smbios_bios { const char *smbb_vendor; /* bios vendor string */ @@ -188,6 +191,7 @@ typedef struct smbios_bios { size_t smbb_nxcflags; /* number of smbb_xcflags[] bytes */ smbios_version_t smbb_biosv; /* bios version */ smbios_version_t smbb_ecfwv; /* bios embedded ctrl f/w version */ + uint64_t smbb_extromsize; /* Extended bios ROM Size */ } smbios_bios_t; #define SMB_BIOSFL_RSV0 0x00000001 /* reserved bit zero */ @@ -223,6 +227,11 @@ typedef struct smbios_bios { #define SMB_BIOSFL_I10_CGA 0x40000000 /* int 0x10 CGA svcs */ #define SMB_BIOSFL_NEC_PC98 0x80000000 /* NEC PC-98 */ +/* + * These values are used to allow consumers to have raw access to the extended + * characteristic flags. We explicitly don't include the extended BIOS + * information from section 3.1 as part of this as it has its own member. + */ #define SMB_BIOSXB_1 0 /* bios extension byte 1 (7.1.2.1) */ #define SMB_BIOSXB_2 1 /* bios extension byte 2 (7.1.2.2) */ #define SMB_BIOSXB_BIOS_MAJ 2 /* bios major version */ @@ -349,6 +358,10 @@ typedef struct smbios_chassis { #define SMB_CHT_TABLET 0x1E /* tablet */ #define SMB_CHT_CONVERTIBLE 0x1F /* convertible */ #define SMB_CHT_DETACHABLE 0x20 /* detachable */ +#define SMB_CHT_IOTGW 0x21 /* IoT Gateway */ +#define SMB_CHT_EMBEDPC 0x22 /* Embedded PC */ +#define SMB_CHT_MINIPC 0x23 /* Mini PC */ +#define SMB_CHT_STICKPC 0x24 /* Stick PC */ #define SMB_CHST_OTHER 0x01 /* other */ #define SMB_CHST_UNKNOWN 0x02 /* unknown */ @@ -474,6 +487,13 @@ typedef struct smbios_processor { #define SMB_PRU_BGA1168 0x2E /* BGA1168 */ #define SMB_PRU_BGA1234 0x2F /* BGA1234 */ #define SMB_PRU_BGA1364 0x30 /* BGA1364 */ +#define SMB_PRU_AM4 0x31 /* socket AM4 */ +#define SMB_PRU_LGA1151 0x32 /* LGA1151 */ +#define SMB_PRU_BGA1356 0x33 /* BGA1356 */ +#define SMB_PRU_BGA1440 0x34 /* BGA1440 */ +#define SMB_PRU_BGA1515 0x35 /* BGA1515 */ +#define SMB_PRU_LGA36471 0x36 /* LGA3647-1 */ +#define SMB_PRU_SP3 0x37 /* socket SP3 */ #define SMB_PRC_RESERVED 0x0001 /* reserved */ #define SMB_PRC_UNKNOWN 0x0002 /* unknown */ @@ -526,6 +546,9 @@ typedef struct smbios_processor { #define SMB_PRF_CORE_SOLO_M 0x2A /* Core Solo mobile */ #define SMB_PRF_ATOM 0x2B /* Intel Atom */ #define SMB_PRF_CORE_M 0x2C /* Intel Core M */ +#define SMB_PRF_CORE_M3 0x2D /* Intel Core m3 */ +#define SMB_PRF_CORE_M5 0x2E /* Intel Core m5 */ +#define SMB_PRF_CORE_M7 0x2F /* Intel Core m7 */ #define SMB_PRF_ALPHA 0x30 /* Alpha */ #define SMB_PRF_ALPHA_21064 0x31 /* Alpha 21064 */ #define SMB_PRF_ALPHA_21066 0x32 /* Alpha 21066 */ @@ -577,6 +600,8 @@ typedef struct smbios_processor { #define SMB_PRF_ATHLON_X4 0x66 /* AMD Athlon X4 Quad-Core */ #define SMB_PRF_OPTERON_X1K 0x67 /* AMD Opteron X1000 */ #define SMB_PRF_OPTERON_X2K 0x68 /* AMD Opteron X2000 APU */ +#define SMB_PRF_OPTERON_A 0x69 /* AMD Opteron A Series */ +#define SMB_PRF_OPERTON_X3K 0x6A /* AMD Opteron X3000 APU */ #define SMB_PRF_HOBBIT 0x70 /* Hobbit */ #define SMB_PRF_TM5000 0x78 /* Crusoe TM5000 */ #define SMB_PRF_TM3000 0x79 /* Crusoe TM3000 */ @@ -677,6 +702,8 @@ typedef struct smbios_processor { #define SMB_PRF_SEMPRON_M 0xEF /* AMD Sempron M */ #define SMB_PRF_I860 0xFA /* i860 */ #define SMB_PRF_I960 0xFB /* i960 */ +#define SMB_PRF_ARMv7 0x100 /* ARMv7 */ +#define SMB_PRF_ARMv8 0x101 /* ARMv8 */ #define SMB_PRF_SH3 0x104 /* SH-3 */ #define SMB_PRF_SH4 0x105 /* SH-4 */ #define SMB_PRF_ARM 0x118 /* ARM */ @@ -691,6 +718,12 @@ typedef struct smbios_processor { /* * SMBIOS Cache Information. See DSP0134 Section 7.8 for more information. * If smba_size is zero, this indicates the specified cache is not present. + * + * SMBIOS 3.1 added extended cache sizes. Unfortunately, we had already baked in + * the uint32_t sizes, so we added extended uint64_t's that correspond to the + * new fields. To make life easier for consumers, we always make sure that the + * _maxsize2 and _size2 members are filled in with the old value if no other + * value is present. */ typedef struct smbios_cache { uint32_t smba_maxsize; /* maximum installed size in bytes */ @@ -705,6 +738,8 @@ typedef struct smbios_cache { uint8_t smba_mode; /* cache mode (SMB_CAM_*) */ uint8_t smba_location; /* cache location (SMB_CAL_*) */ uint8_t smba_flags; /* cache flags (SMB_CAF_*) */ + uint64_t smba_maxsize2; /* maximum installed size in bytes */ + uint64_t smba_size2; /* installed size in bytes */ } smbios_cache_t; #define SMB_CAT_OTHER 0x0001 /* other */ @@ -899,6 +934,14 @@ typedef struct smbios_slot { #define SMB_SLT_MXM3_B 0x1E /* MXM 3.0 Type B */ #define SMB_SLT_PCIEG2_SFF 0x1F /* PCI Express Gen 2 SFF-8639 */ #define SMB_SLT_PCIEG3_SFF 0x20 /* PCI Express Gen 3 SFF-8639 */ +/* + * These lines must be on one line for the string generating code. + */ +/* BEGIN CSTYLED */ +#define SMB_SLT_PCIE_M52_WBSKO 0x21 /* PCI Express Mini 52-pin with bottom-side keep-outs */ +#define SMB_SLT_PCIE_M52_WOBSKO 0x22 /* PCI Express Mini 52-pin without bottom-side keep-outs */ +/* END CSTYLED */ +#define SMB_SLT_PCIE_M76 0x23 /* PCI Express Mini 72-pin */ #define SMB_SLT_PC98_C20 0xA0 /* PC-98/C20 */ #define SMB_SLT_PC98_C24 0xA1 /* PC-98/C24 */ #define SMB_SLT_PC98_E 0xA2 /* PC-98/E */ @@ -1105,7 +1148,7 @@ typedef struct smbios_memdevice { uint8_t smbmd_type; /* memory type */ uint8_t smbmd_pad; /* padding */ uint32_t smbmd_flags; /* flags (see below) */ - uint32_t smbmd_speed; /* speed in MHz */ + uint32_t smbmd_speed; /* speed in MT/s */ const char *smbmd_dloc; /* physical device locator string */ const char *smbmd_bloc; /* physical bank locator string */ uint8_t smbmd_rank; /* rank */ @@ -1355,7 +1398,8 @@ typedef struct smbios_memdevice_ext { #define SMB_VERSION_27 0x0207 /* SMBIOS encoding for DMTF spec 2.7 */ #define SMB_VERSION_28 0x0208 /* SMBIOS encoding for DMTF spec 2.8 */ #define SMB_VERSION_30 0x0300 /* SMBIOS encoding for DMTF spec 3.0 */ -#define SMB_VERSION SMB_VERSION_30 /* SMBIOS latest version definitions */ +#define SMB_VERSION_31 0x0301 /* SMBIOS encoding for DMTF spec 3.1 */ +#define SMB_VERSION SMB_VERSION_31 /* SMBIOS latest version definitions */ #define SMB_O_NOCKSUM 0x1 /* do not verify header checksums */ #define SMB_O_NOVERS 0x2 /* do not verify header versions */ diff --git a/usr/src/uts/common/sys/smbios_impl.h b/usr/src/uts/common/sys/smbios_impl.h index 94c107bb63..24ba461620 100644 --- a/usr/src/uts/common/sys/smbios_impl.h +++ b/usr/src/uts/common/sys/smbios_impl.h @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -51,6 +51,14 @@ extern "C" { #endif +/* + * Definitions required to interpret the BIOS type information. + */ +#define SMB_BIOSXB_EXTROM 6 + +#define SMB_BIOS_EXTROM_VALUE_MASK(x) ((x) & 0x3fff) +#define SMB_BIOS_EXTROM_SHIFT_MASK(x) (((x) & 0xc000) >> 14) + #pragma pack(1) typedef struct smb_header { @@ -163,6 +171,8 @@ typedef struct smb_cache { uint8_t smbca_etype; /* error correction type */ uint8_t smbca_ltype; /* logical cache type */ uint8_t smbca_assoc; /* associativity */ + uint32_t smbca_maxsize2; /* maximum installed size 2 */ + uint32_t smbca_size2; /* installed size 2 */ } smb_cache_t; /* @@ -173,6 +183,10 @@ typedef struct smb_cache { #define SMB_CACHE_SIZE(s) (((s) & 0x8000) ? \ ((uint32_t)((s) & 0x7FFF) * 64 * 1024) : ((uint32_t)(s) * 1024)) +#define SMB_CACHE_EXT_SIZE(s) (((s) & 0x80000000U) ? \ + ((uint64_t)((s) & 0x7FFFFFFFULL) * 64ULL * 1024ULL) : \ + ((uint64_t)(s) * 1024ULL)) + #define SMB_CACHE_CFG_MODE(c) (((c) >> 8) & 3) #define SMB_CACHE_CFG_ENABLED(c) (((c) >> 7) & 1) #define SMB_CACHE_CFG_LOCATION(c) (((c) >> 5) & 3) @@ -272,7 +286,7 @@ typedef struct smb_memdevice { uint8_t smbmdev_bloc; /* bank locator */ uint8_t smbmdev_type; /* memory type */ uint16_t smbmdev_flags; /* detail flags */ - uint16_t smbmdev_speed; /* speed in MHz */ + uint16_t smbmdev_speed; /* speed in MT/s */ uint8_t smbmdev_manufacturer; /* manufacturer */ uint8_t smbmdev_serial; /* serial number */ uint8_t smbmdev_asset; /* asset tag */ @@ -498,6 +512,7 @@ extern const smb_struct_t *smb_lookup_type(smbios_hdl_t *, uint_t); extern const smb_struct_t *smb_lookup_id(smbios_hdl_t *, uint_t); extern const char *smb_strptr(const smb_struct_t *, uint_t); extern int smb_gteq(smbios_hdl_t *, int); +extern int smb_libgteq(smbios_hdl_t *, int); extern int smb_set_errno(smbios_hdl_t *, int); extern smbios_hdl_t *smb_open_error(smbios_hdl_t *, int *, int); @@ -566,6 +581,34 @@ typedef struct smb_base_memdevice { uint8_t smbbmd_rank; /* rank */ } smb_base_memdevice_t; +typedef struct smb_base_bios { + const char *smbbb_vendor; /* bios vendor string */ + const char *smbbb_version; /* bios version string */ + const char *smbbb_reldate; /* bios release date */ + uint32_t smbbb_segment; /* bios address segment location */ + uint32_t smbbb_romsize; /* bios rom size in bytes */ + uint32_t smbbb_runsize; /* bios image size in bytes */ + uint64_t smbbb_cflags; /* bios characteristics */ + const uint8_t *smbbb_xcflags; /* bios characteristics extensions */ + size_t smbbb_nxcflags; /* number of smbb_xcflags[] bytes */ + smbios_version_t smbbb_biosv; /* bios version */ + smbios_version_t smbbb_ecfwv; /* bios embedded ctrl f/w version */ +} smb_base_bios_t; + +typedef struct smb_base_cache { + uint32_t smbba_maxsize; /* maximum installed size in bytes */ + uint32_t smbba_size; /* installed size in bytes */ + uint16_t smbba_stype; /* supported SRAM types (SMB_CAT_*) */ + uint16_t smbba_ctype; /* current SRAM type (SMB_CAT_*) */ + uint8_t smbba_speed; /* speed in nanoseconds */ + uint8_t smbba_etype; /* error correction type (SMB_CAE_*) */ + uint8_t smbba_ltype; /* logical cache type (SMB_CAG_*) */ + uint8_t smbba_assoc; /* associativity (SMB_CAA_*) */ + uint8_t smbba_level; /* cache level */ + uint8_t smbba_mode; /* cache mode (SMB_CAM_*) */ + uint8_t smbba_location; /* cache location (SMB_CAL_*) */ + uint8_t smbba_flags; /* cache flags (SMB_CAF_*) */ +} smb_base_cache_t; #ifdef __cplusplus } |