Documentation ¶
Index ¶
- Variables
- func EntryBase() (int64, int64, error)
- func EntryBaseFromEFI() (base int64, size int64, err error)
- func EntryBaseFromLegacy() (int64, int64, error)
- type Entry32
- type Entry64
- type EntryPoint
- type Header
- type Table
- func (t *Table) GetByteAt(offset int) (uint8, error)
- func (t *Table) GetBytesAt(offset, length int) ([]byte, error)
- func (t *Table) GetDWordAt(offset int) (res uint32, err error)
- func (t *Table) GetQWordAt(offset int) (res uint64, err error)
- func (t *Table) GetStringAt(offset int) (string, error)
- func (t *Table) GetWordAt(offset int) (res uint16, err error)
- func (t *Table) Len() int
- func (t *Table) ReadAt(p []byte, off int64) (int, error)
- func (t *Table) String() string
- type TableType
- type Tables
Constants ¶
This section is empty.
Variables ¶
var (
ErrAnchorNotFound = errors.New("SMBIOS anchor _SM_ or _SM3_ not found")
)
Errors for entry points.
var (
ErrInvalidAnchor = errors.New("invalid anchor string")
)
Entry point errors.
var (
ErrTableNotFound = errors.New("table not found")
)
Table parsing errors.
Functions ¶
func EntryBaseFromEFI ¶
EntryBaseFromEFI finds the SMBIOS entry point address in the EFI System Table.
func EntryBaseFromLegacy ¶
EntryBaseFromLegacy searches in SMBIOS entry point address in F0000 segment.
NOTE: Legacy BIOS will store their SMBIOS in this region.
Types ¶
type Entry32 ¶
type Entry32 struct { Anchor [4]uint8 Checksum uint8 Length uint8 MajorVersion uint8 MinorVersion uint8 StructMaxSize uint16 Revision uint8 Reserved [5]uint8 IntAnchor [5]uint8 IntChecksum uint8 StructTableLength uint16 StructTableAddr uint32 NumberOfStructs uint16 BCDRevision uint8 }
Entry32 is the SMBIOS 32-Bit entry point structure, described in DSP0134 5.2.1.
func (*Entry32) MarshalBinary ¶
MarshalBinary marshals the SMBIOS 32-Bit entry point structure to binary data.
func (*Entry32) UnmarshalBinary ¶
UnmarshalBinary unmarshals the SMBIOS 32-Bit entry point structure from binary data.
type Entry64 ¶
type Entry64 struct { Anchor [5]uint8 Checksum uint8 Length uint8 MajorVersion uint8 MinorVersion uint8 DocRev uint8 Revision uint8 Reserved uint8 StructMaxSize uint32 StructTableAddr uint64 }
Entry64 is the SMBIOS 64-Bit entry point structure, described in DSP0134 5.2.2.
func (*Entry64) MarshalBinary ¶
MarshalBinary marshals the SMBIOS 64-Bit entry point structure to binary data.
func (*Entry64) UnmarshalBinary ¶
UnmarshalBinary unmarshals the SMBIOS 64-Bit entry point structure from binary data.
type EntryPoint ¶
type EntryPoint interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler fmt.Stringer // Table returns the physical address of the table, and its size. Table() (address, size int) // Version returns the version associated with the table structure. Version() (major, minor, rev int) }
EntryPoint is an SMBIOS entry point.
To access detailed information, use a type assertion to *Entry32 or *Entry64.
func ParseEntry ¶
func ParseEntry(r io.Reader) (EntryPoint, error)
ParseEntry parses SMBIOS 32 or 64-bit entrypoint structure.
type Header ¶
Header is the header common to all table types.
type Table ¶
type Table struct { Header `smbios:"-"` Data []byte `smbios:"-"` // Structured part of the table. Strings []string `smbios:"-"` // Strings section. }
Table is a generic type of table that does not parsed fields, it only allows access to its contents by offset.
func ParseTable ¶
ParseTable parses a table from byte stream.
func (*Table) GetByteAt ¶
GetByteAt returns a byte from the structured part at the specified offset.
func (*Table) GetBytesAt ¶
GetBytesAt returns a number of bytes from the structured part at the specified offset.
func (*Table) GetDWordAt ¶
GetDWordAt returns a 32-bit word from the structured part at the specified offset.
func (*Table) GetQWordAt ¶
GetQWordAt returns a 64-bit word from the structured part at the specified offset.
func (*Table) GetStringAt ¶
GetStringAt returns a string pointed to by the byte at the specified offset in the structured part. NB: offset is not the string index.
func (*Table) GetWordAt ¶
GetWordAt returns a 16-bit word from the structured part at the specified offset.
type TableType ¶
type TableType uint8
TableType specifies the DMI type of the table. Types are defined in DMTF DSP0134.
const ( TableTypeBIOSInfo TableType = 0 TableTypeSystemInfo TableType = 1 TableTypeBaseboardInfo TableType = 2 TableTypeChassisInfo TableType = 3 TableTypeProcessorInfo TableType = 4 TableTypeCacheInfo TableType = 7 TableTypeSystemSlots TableType = 9 TableTypeMemoryDevice TableType = 17 TableTypeIPMIDeviceInfo TableType = 38 TableTypeTPMDevice TableType = 43 TableTypeInactive TableType = 126 TableTypeEndOfTable TableType = 127 )
Supported table types.
type Tables ¶
type Tables []*Table
Tables is a collection of SMBIOS tables.
func ParseTables ¶
ParseTables parses all tables from a byte stream.
func (Tables) TableByType ¶
TableByType returns the first table of the specified type.
TablesByType is nil-safe.
func (Tables) TablesByType ¶
TablesByType returns tables of the specified type.
TablesByType is nil-safe.