Documentation
¶
Overview ¶
Package smbios implements parsing of SMBIOS data structures. SMBIOS data is commonly populated by platform firmware to convey various metadata (including name, vendor, slots and serial numbers) about the platform to the operating system. The SMBIOS standard is maintained by DMTF and available at https://www.dmtf.org/sites/default/files/standards/documents/ DSP0134_3.6.0.pdf. The rest of this package just refers to it as "the standard".
Index ¶
Constants ¶
const UEFISpecificationSupported = 1 << 3
UEFISpecificationSupported is a bitmask for accessing the third bit, which displays the support of UEFI in the smbios structure. For more information check the SMBIOS documentation at Table 7.1.2.2 Bit 3.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalStructureRaw ¶
UnmarshalStructureRaw unmarshals a SMBIOS structure into a Go struct which has some constraints. The first two fields need to be a `uint16 handle` and a `StructureVersion Version` field. After that any number of fields may follow as long as they are either of type `string` (which will be looked up in the string table) or readable by binary.Read. To determine the structure version, the smbios_min_vers struct tag needs to be put on the first field of a newer structure version. The version implicitly starts with 2.0. The version determined is written to the second target struct field. Fields which do not have a fixed size need to be typed as a slice and tagged with smbios_repeat set to the name of the field containing the count. The count field itself needs to be some width of uint.
Types ¶
type BIOSInformationRaw ¶
type BIOSInformationRaw struct {
Handle uint16
StructureVersion Version
Vendor string
BIOSVersion string
BIOSStartingAddressSegment uint16
BIOSReleaseDate string
BIOSROMSize uint8
BIOSCharacteristics uint64
BIOSCharacteristicsExtensionByte1 uint8 `smbios_min_ver:"2.1"`
BIOSCharacteristicsExtensionByte2 uint8 `smbios_min_ver:"2.2"`
SystemBIOSMajorRelease uint8 `smbios_min_ver:"2.4"`
SystemBIOSMinorRelease uint8
EmbeddedControllerFirmwareMajorRelease uint8
EmbeddedControllerFirmwareMinorRelease uint8
ExtendedBIOSROMSize uint16 `smbios_min_ver:"3.1"`
}
BIOSInformationRaw contains decoded data from the BIOS Information structure (SMBIOS Type 0). See Table 6 in the specification for detailed documentation about the individual fields. Note that structure versions 2.1 and 2.2 are "invented" here as both characteristics extensions bytes were optional between 2.0 and 2.4.
func (*BIOSInformationRaw) ROMSizeBytes ¶
func (rb *BIOSInformationRaw) ROMSizeBytes() uint64
ROMSizeBytes returns the ROM size in bytes
func (*BIOSInformationRaw) ReleaseDate ¶
func (rb *BIOSInformationRaw) ReleaseDate() (time.Time, error)
ReleaseDate returns the release date of the BIOS as a time.Time value.
type BaseboardInformationRaw ¶
type BaseboardInformationRaw struct {
Handle uint16
StructureVersion Version
Manufacturer string
Product string
Version string
SerialNumber string
AssetTag string `smbios_min_ver:"2.1"`
FeatureFlags uint8
LocationInChassis string
ChassisHandle uint16
BoardType uint8
NumberOfContainedObjectHandles uint8
ContainedObjectHandles []uint16 `smbios_repeat:"NumberOfContainedObjectHandles"`
}
BaseboardInformationRaw contains decoded data from the BIOS Information structure (SMBIOS Type 3). See Table 13 in the specification for detailed documentation about the individual fields.
type MemoryDeviceRaw ¶
type MemoryDeviceRaw struct {
Handle uint16
StructureVersion Version
PhysicalMemoryArrayHandle uint16 `smbios_min_ver:"2.1"`
MemoryErrorInformationHandle uint16
TotalWidth uint16
DataWidth uint16
Size uint16
FormFactor uint8
DeviceSet uint8
DeviceLocator string
BankLocator string
MemoryType uint8
TypeDetail uint16
Speed uint16 `smbios_min_ver:"2.3"`
Manufacturer string
SerialNumber string
AssetTag string
PartNumber string
Attributes uint8 `smbios_min_ver:"2.6"`
ExtendedSize uint32 `smbios_min_ver:"2.7"`
ConfiguredMemorySpeed uint16
MinimumVoltage uint16 `smbios_min_ver:"2.8"`
MaximumVoltage uint16
ConfiguredVoltage uint16
MemoryTechnology uint8 `smbios_min_ver:"3.2"`
MemoryOperatingModeCapability uint16
FirmwareVersion uint8
ModuleManufacturerID uint16
ModuleProductID uint16
MemorySubsystemControllerManufacturerID uint16
MemorySubsystemControllerProductID uint16
NonVolatileSize uint64
VolatileSize uint64
CacheSize uint64
LogicalSize uint64
ExtendedSpeed uint32 `smbios_min_ver:"3.3"`
ExtendedConfiguredMemorySpeed uint32
}
MemoryDeviceRaw contains decoded data from the BIOS Information structure (SMBIOS Type 17). See Table 76 in the specification for detailed documentation about the individual fields.
func (*MemoryDeviceRaw) SizeBytes ¶
func (md *MemoryDeviceRaw) SizeBytes() (uint64, bool)
type SystemInformationRaw ¶
type SystemInformationRaw struct {
Handle uint16
StructureVersion Version
Manufacturer string
ProductName string
Version string
SerialNumber string
UUID [16]byte `smbios_min_ver:"2.1"`
WakeupType uint8
SKUNumber string `smbios_min_ver:"2.4"`
Family string
}
SystemInformationRaw contains decoded data from the System Information structure (SMBIOS Type 1). See Table 10 in the specification for detailed documentation about the individual fields.
type SystemSlotPeerRaw ¶
type SystemSlotRaw ¶
type SystemSlotRaw struct {
Handle uint16
StructureVersion Version
SlotDesignation string
SlotType uint8
SlotDataBusWidth uint8
CurrentUsage uint8
SlotLength uint8
SlotID uint16
SlotCharacteristics1 uint8
SlotCharacteristics2 uint8 `smbios_min_ver:"2.1"`
SegmentGroupNumber uint16 `smbios_min_ver:"2.6"`
BusNumber uint8
DeviceFunctionNumber uint8
DataBusWidth uint8 `smbios_min_ver:"3.2"`
PeerGroupingCount uint8
PeerGroups []SystemSlotPeerRaw `smbios_repeat:"PeerGroupingCount"`
SlotInformation uint8 `smbios_min_ver:"3.4"`
SlotPhysicalWidth uint8
SlotPitch uint16
SlotHeight uint8 `smbios_min_ver:"3.5"`
}
SystemSlotRaw contains decoded data from the System Slot structure (SMBIOS Type 9). See Table 44 in the specification for detailed documentation about the individual fields.
type Table ¶
type Table struct {
BIOSInformationRaw *BIOSInformationRaw
SystemInformationRaw *SystemInformationRaw
BaseboardsInformationRaw []*BaseboardInformationRaw
SystemSlotsRaw []*SystemSlotRaw
MemoryDevicesRaw []*MemoryDeviceRaw
Structures []Structure
}
Table represents a decoded SMBIOS table consisting of its structures. A few known structures are parsed if present, the rest is put into Structures unparsed.