45 #define SMBIOS_RAW_TAG( _type, _structure, _field ) \ 46 ( ( (_type) << 16 ) | \ 47 ( offsetof ( _structure, _field ) << 8 ) | \ 48 ( sizeof ( ( ( _structure * ) 0 )->_field ) ) ) 58 #define SMBIOS_STRING_TAG( _type, _structure, _field ) \ 59 ( ( (_type) << 16 ) | \ 60 ( offsetof ( _structure, _field ) << 8 ) ) 88 unsigned int tag_instance;
89 unsigned int tag_type;
90 unsigned int tag_offset;
95 tag_instance = ( (
setting->
tag >> 24 ) & 0xff );
102 &structure ) ) != 0 )
113 sizeof ( buf ) ) ) != 0 )
127 if ( ( tag_len == 0 ) && ( tag_offset == 0 ) ) {
128 tag_len =
sizeof ( buf );
129 }
else if ( ( tag_len == 0 ) || ( tag_offset == 0 ) ) {
130 index = ( ( tag_offset == 0 ) ?
131 tag_len : buf[tag_offset] );
142 if ( tag_offset >
sizeof ( buf ) ) {
144 }
else if ( ( tag_offset + tag_len ) >
sizeof ( buf ) ) {
145 tag_len = (
sizeof ( buf ) - tag_offset );
157 raw = &buf[tag_offset];
160 ( tag_len ==
sizeof (
uuid ) ) &&
162 DBG (
"SMBIOS detected mangled UUID\n" );
198 "smbios" ) ) != 0 ) {
199 DBG (
"SMBIOS could not register settings: %s\n",
213 .description =
"UUID",
216 .type = &setting_type_uuid,
223 .
name =
"manufacturer",
224 .description =
"Manufacturer",
228 .type = &setting_type_string,
235 .description =
"Product name",
239 .type = &setting_type_string,
246 .description =
"Serial number",
250 .type = &setting_type_string,
257 .description =
"Asset tag",
261 .type = &setting_type_string,
268 .
name =
"board-serial",
269 .description =
"Base board serial",
273 .type = &setting_type_string,
struct arbelprm_rc_send_wqe rc
static int smbios_fetch(struct settings *settings __unused, struct setting *setting, void *data, size_t len)
Fetch value of SMBIOS setting.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int read_smbios_structure(struct smbios_structure *structure, void *data, size_t len)
Copy SMBIOS structure.
#define SMBIOS_TYPE_BASE_BOARD_INFORMATION
SMBIOS base board information structure type.
#define SETTING_HOST_EXTRA
Host identity additional settings.
struct smbios_header header
Copy of SMBIOS structure header.
static void uuid_mangle(union uuid *uuid)
Change UUID endianness.
uint64_t tag
Setting tag, if applicable.
#define INIT_NORMAL
Normal initialisation.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define __unused
Declare a variable or data structure as unused.
int find_smbios_structure(unsigned int type, unsigned int instance, struct smbios_structure *structure)
Find specific structure type within SMBIOS.
An initialisation function.
#define SMBIOS_STRING_TAG(_type, _structure, _field)
Construct SMBIOS string tag.
#define SMBIOS_TYPE_ENCLOSURE_INFORMATION
SMBIOS enclosure information structure type.
static void smbios_init(void)
Initialise SMBIOS settings.
int smbios_version(void)
Get SMBIOS version.
int read_smbios_string(struct smbios_structure *structure, unsigned int index, void *data, size_t len)
Find indexed string within SMBIOS structure.
const struct setting_type * type
Setting type.
uint8_t asset_tag
Asset tag.
static struct settings smbios_settings
SMBIOS settings.
static int smbios_applies(struct settings *settings __unused, const struct setting *setting)
Check applicability of SMBIOS setting.
#define SMBIOS_VERSION(major, minor)
Calculate SMBIOS version.
char * strerror(int errno)
Retrieve string representation of error number.
uint64_t serial
Serial number.
Settings block operations.
const struct setting uuid_setting __setting(SETTING_HOST, uuid)
UUID setting obtained via SMBIOS.
struct list_head siblings
Sibling settings blocks.
uint8_t manufacturer
Manufacturer string.
uint8_t data[48]
Additional event data.
#define SMBIOS_RAW_TAG(_type, _structure, _field)
Construct SMBIOS raw-data tag.
uint8_t product
Product string.
int(* applies)(struct settings *settings, const struct setting *setting)
Check applicability of setting.
struct list_head children
Child settings blocks.
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
static struct settings_operations smbios_settings_operations
SMBIOS settings operations.
static const struct settings_scope smbios_settings_scope
SMBIOS settings scope.
struct init_fn smbios_init_fn __init_fn(INIT_NORMAL)
SMBIOS settings initialiser.
#define DBG(...)
Print a debugging message.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
const struct settings_scope * scope
Setting scope (or NULL)
SMBIOS structure descriptor.
#define SMBIOS_TYPE_SYSTEM_INFORMATION
SMBIOS system information structure type.
#define NULL
NULL pointer (VOID *)
struct refcnt * refcnt
Reference counter.
#define SETTING_HOST
Host identity settings.