Other Firmware Interfaces

DMI Interfaces

int dmi_check_system(const struct dmi_system_id * list)

check system DMI data

Parameters

const struct dmi_system_id * list
array of dmi_system_id structures to match against All non-null elements of the list must match their slot’s (field index’s) data (i.e., each list string must be a substring of the specified DMI slot’s string data) to be considered a successful match.

Description

Walk the blacklist table running matching functions until someone returns non zero or we hit the end. Callback function is called for each successful match. Returns the number of matches.

dmi_scan_machine must be called before this function is called.

const struct dmi_system_id * dmi_first_match(const struct dmi_system_id * list)

find dmi_system_id structure matching system DMI data

Parameters

const struct dmi_system_id * list
array of dmi_system_id structures to match against All non-null elements of the list must match their slot’s (field index’s) data (i.e., each list string must be a substring of the specified DMI slot’s string data) to be considered a successful match.

Description

Walk the blacklist table until the first match is found. Return the pointer to the matching entry or NULL if there’s no match.

dmi_scan_machine must be called before this function is called.

const char * dmi_get_system_info(int field)

return DMI data value

Parameters

int field
data index (see enum dmi_field)

Description

Returns one DMI data value, can be used to perform complex DMI data checks.
int dmi_name_in_vendors(const char * str)

Check if string is in the DMI system or board vendor name

Parameters

const char * str
Case sensitive Name
const struct dmi_device * dmi_find_device(int type, const char * name, const struct dmi_device * from)

find onboard device by type/name

Parameters

int type
device type or DMI_DEV_TYPE_ANY to match all device types
const char * name
device name string or NULL to match all
const struct dmi_device * from
previous device found in search, or NULL for new search.

Description

Iterates through the list of known onboard devices. If a device is found with a matching type and name, a pointer to its device structure is returned. Otherwise, NULL is returned. A new search is initiated by passing NULL as the from argument. If from is not NULL, searches continue from next device.
bool dmi_get_date(int field, int * yearp, int * monthp, int * dayp)

parse a DMI date

Parameters

int field
data index (see enum dmi_field)
int * yearp
optional out parameter for the year
int * monthp
optional out parameter for the month
int * dayp
optional out parameter for the day

Description

The date field is assumed to be in the form resembling [mm[/dd]]/yy[yy] and the result is stored in the out parameters any or all of which can be omitted.

If the field doesn’t exist, all out parameters are set to zero and false is returned. Otherwise, true is returned with any invalid part of date set to zero.

On return, year, month and day are guaranteed to be in the range of [0,9999], [0,12] and [0,31] respectively.

int dmi_get_bios_year(void)

get a year out of DMI_BIOS_DATE field

Parameters

void
no arguments

Description

Returns year on success, -ENXIO if DMI is not selected, or a different negative error code if DMI field is not present or not parseable.
int dmi_walk(void (*decode) (const struct dmi_header *, void *, void * private_data)

Walk the DMI table and get called back for every record

Parameters

void (*)(const struct dmi_header *, void *) decode
Callback function
void * private_data
Private data to be passed to the callback function

Description

Returns 0 on success, -ENXIO if DMI is not selected or not present, or a different negative error code if DMI walking fails.
bool dmi_match(enum dmi_field f, const char * str)

compare a string to the dmi field (if exists)

Parameters

enum dmi_field f
DMI field identifier
const char * str
string to compare the DMI field to

Description

Returns true if the requested field equals to the str (including NULL).

EDD Interfaces

ssize_t edd_show_raw_data(struct edd_device * edev, char * buf)

copies raw data to buffer for userspace to parse

Parameters

struct edd_device * edev
target edd_device
char * buf
output buffer

Return

number of bytes written, or -EINVAL on failure

void edd_release(struct kobject * kobj)

free edd structure

Parameters

struct kobject * kobj
kobject of edd structure

Description

This is called when the refcount of the edd structure reaches 0. This should happen right after we unregister, but just in case, we use the release callback anyway.
int edd_dev_is_type(struct edd_device * edev, const char * type)

is this EDD device a ‘type’ device?

Parameters

struct edd_device * edev
target edd_device
const char * type
a host bus or interface identifier string per the EDD spec

Description

Returns 1 (TRUE) if it is a ‘type’ device, 0 otherwise.

struct pci_dev * edd_get_pci_dev(struct edd_device * edev)

finds pci_dev that matches edev

Parameters

struct edd_device * edev
edd_device

Description

Returns pci_dev if found, or NULL

int edd_init(void)

creates sysfs tree of EDD data

Parameters

void
no arguments