Other Firmware Interfaces

Peios: File-based firmware loading has an additional Peios signature check. The development profile defaults to logging (kacs_fwsig=log); kacs_fwsig=enforce requires PeiosTcb trust for that path. This does not cover the separate FW_UPLOAD interface. See Peios kernel behaviour.

DMI Interfaces #

dmi_check_system() #

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_setup must be called before this function is called.

dmi_first_match() #

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_setup must be called before this function is called.

dmi_get_system_info() #

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.

dmi_name_in_vendors() #

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

dmi_find_device() #

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.

dmi_get_date() #

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.

dmi_get_bios_year() #

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.

dmi_walk() #

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 (*decode)(const struct dmi_header *, void *): 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.

dmi_match() #

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).

dmi_memdev_type() #

u8 dmi_memdev_type(u16 handle)

get the memory type

Parameters

  • u16 handle: DMI structure handle

Description

Return the DMI memory type of the module in the slot associated with the given DMI handle, or 0x0 if no such DMI handle exists.

dmi_memdev_handle() #

u16 dmi_memdev_handle(int slot)

get the DMI handle of a memory slot

Parameters

  • int slot: slot number

Description

Return the DMI handle associated with a given memory slot, or 0xFFFF if there is no such slot.

EDD Interfaces #

edd_show_raw_data() #

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

edd_release() #

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.

edd_dev_is_type() #

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.

edd_get_pci_dev() #

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

edd_init() #

int edd_init(void)

creates sysfs tree of EDD data

Parameters

  • void: no arguments

Generic System Framebuffers Interface #

sysfb_disable() #

void sysfb_disable(struct device *dev)

disable the Generic System Framebuffers support

Parameters

  • struct device *dev: the device to check if non-NULL

Description

This disables the registration of system framebuffer devices that match the generic drivers that make use of the system framebuffer set up by firmware.

It also unregisters a device if this was already registered by sysfb_init().

Context

The function can sleep. A disable_lock mutex is acquired to serialize against sysfb_init(), that registers a system framebuffer device.

sysfb_handles_screen_info() #

bool sysfb_handles_screen_info(void)

reports if sysfb handles the global screen_info

Parameters

  • void: no arguments

Description

Callers can use sysfb_handles_screen_info() to determine whether the Generic System Framebuffers (sysfb) can handle the global screen_info data structure or not. Drivers might need this information to know if they have to setup the system framebuffer, or if they have to delegate this action to sysfb instead.

Return

True if sysfb handles the global screen_info data structure.

Intel Stratix10 SoC Service Layer #

Some features of the Intel Stratix10 SoC require a level of privilege higher than the kernel is granted. Such secure features include FPGA programming. In terms of the ARMv8 architecture, the kernel runs at Exception Level 1 (EL1), access to the features requires Exception Level 3 (EL3).

The Intel Stratix10 SoC service layer provides an in kernel API for drivers to request access to the secure features. The requests are queued and processed one by one. ARM’s SMCCC is used to pass the execution of the requests on to a secure monitor (EL3).

enum stratix10_svc_command_code #

supported service commands

Constants

  • COMMAND_NOOP: do 'dummy' request for integration/debug/trouble-shooting
  • COMMAND_RECONFIG: ask for FPGA configuration preparation, return status is SVC_STATUS_OK
  • COMMAND_RECONFIG_DATA_SUBMIT: submit buffer(s) of bit-stream data for the FPGA configuration, return status is SVC_STATUS_SUBMITTED or SVC_STATUS_ERROR
  • COMMAND_RECONFIG_DATA_CLAIM: check the status of the configuration, return status is SVC_STATUS_COMPLETED, or SVC_STATUS_BUSY, or SVC_STATUS_ERROR
  • COMMAND_RECONFIG_STATUS: check the status of the configuration, return status is SVC_STATUS_COMPLETED, or SVC_STATUS_BUSY, or SVC_STATUS_ERROR
  • COMMAND_RSU_STATUS: request remote system update boot log, return status is log data or SVC_STATUS_RSU_ERROR
  • COMMAND_RSU_UPDATE: set the offset of the bitstream to boot after reboot, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_RSU_NOTIFY: report the status of hard processor system software to firmware, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_RSU_RETRY: query firmware for the current image's retry counter, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_RSU_MAX_RETRY: query firmware for the max retry value, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_RSU_DCMF_VERSION: query firmware for the DCMF version, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_RSU_DCMF_STATUS: query firmware for the DCMF status return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_FIRMWARE_VERSION: query running firmware version, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_RSU_GET_SPT_TABLE: query firmware for SPT table return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_FCS_REQUEST_SERVICE: request validation of image from firmware, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM
  • COMMAND_FCS_SEND_CERTIFICATE: send a certificate, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERROR
  • COMMAND_FCS_GET_PROVISION_DATA: read the provisioning data, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERROR
  • COMMAND_FCS_DATA_ENCRYPTION: encrypt the data, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERROR
  • COMMAND_FCS_DATA_DECRYPTION: decrypt the data, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERROR
  • COMMAND_FCS_RANDOM_NUMBER_GEN: generate a random number, return status is SVC_STATUS_OK, SVC_STATUS_ERROR
  • COMMAND_POLL_SERVICE_STATUS: poll if the service request is complete, return statis is SVC_STATUS_OK, SVC_STATUS_ERROR or SVC_STATUS_BUSY
  • COMMAND_MBOX_SEND_CMD: send generic mailbox command, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_SMC_SVC_VERSION: Non-mailbox SMC SVC API Version, return status is SVC_STATUS_OK
  • COMMAND_HWMON_READTEMP: query the temperature from the hardware monitor, return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  • COMMAND_HWMON_READVOLT: query the voltage from the hardware monitor, return status is SVC_STATUS_OK or SVC_STATUS_ERROR

struct stratix10_svc_client_msg #

message sent by client to service

Definition

struct stratix10_svc_client_msg {
    void *payload;
    size_t payload_length;
    void *payload_output;
    size_t payload_length_output;
    enum stratix10_svc_command_code command;
    u64 arg[3];
};

Members

  • payload: starting address of data need be processed
  • payload_length: to be processed data size in bytes
  • payload_output: starting address of processed data
  • payload_length_output: processed data size in bytes
  • command: service command
  • arg: args to be passed via registers and not physically mapped buffers

struct stratix10_svc_command_config_type #

config type

Definition

struct stratix10_svc_command_config_type {
    u32 flags;
};

Members

  • flags: flag bit for the type of FPGA configuration

struct stratix10_svc_cb_data #

callback data structure from service layer

Definition

struct stratix10_svc_cb_data {
    u32 status;
    void *kaddr1;
    void *kaddr2;
    void *kaddr3;
};

Members

  • status: the status of sent command
  • kaddr1: address of 1st completed data block
  • kaddr2: address of 2nd completed data block
  • kaddr3: address of 3rd completed data block

struct stratix10_svc_client #

service client structure

Definition

struct stratix10_svc_client {
    struct device *dev;
    void (*receive_cb)(struct stratix10_svc_client *client, struct stratix10_svc_cb_data *cb_data);
    void *priv;
};

Members

  • dev: the client device
  • receive_cb: callback to provide service client the received data
  • priv: client private data

stratix10_svc_request_channel_byname() #

struct stratix10_svc_chan * stratix10_svc_request_channel_byname(struct stratix10_svc_client *client, const char *name)

request a service channel

Parameters

  • struct stratix10_svc_client *client: pointer to service client
  • const char *name: service client name

Description

This function is used by service client to request a service channel.

Return

a pointer to channel assigned to the client on success, or ERR_PTR() on error.

stratix10_svc_add_async_client() #

int stratix10_svc_add_async_client(struct stratix10_svc_chan *chan, bool use_unique_clientid)

Add an asynchronous client to the Stratix10 service channel.

Parameters

  • struct stratix10_svc_chan *chan: Pointer to the Stratix10 service channel structure.
  • bool use_unique_clientid: Boolean flag indicating whether to use a unique client ID.

Description

This function adds an asynchronous client to the specified Stratix10 service channel. If the use_unique_clientid flag is set to true, a unique client ID is allocated for the asynchronous channel. Otherwise, a common asynchronous channel is used.

Return

0 on success, or a negative error code on failure: -EINVAL if the channel is NULL or the async controller is not initialized. -EALREADY if the async channel is already allocated. -ENOMEM if memory allocation fails. Other negative values if ID allocation fails.

stratix10_svc_remove_async_client() #

int stratix10_svc_remove_async_client(struct stratix10_svc_chan *chan)

Remove an asynchronous client from the Stratix10 service channel.

Parameters

  • struct stratix10_svc_chan *chan: Pointer to the Stratix10 service channel structure.

Description

This function removes an asynchronous client associated with the given service channel. It checks if the channel and the asynchronous channel are valid, and then proceeds to decrement the reference count for the common asynchronous channel if applicable. If the reference count reaches zero, it destroys the job ID pool and deallocates the asynchronous client ID. For non-common asynchronous channels, it directly destroys the job ID pool, deallocates the asynchronous client ID, and frees the memory allocated for the asynchronous channel.

Return

0 on success, -EINVAL if the channel or asynchronous channel is invalid.

stratix10_svc_async_send() #

int stratix10_svc_async_send(struct stratix10_svc_chan *chan, void *msg, void **handler, async_callback_t cb, void *cb_arg)

Send an asynchronous message to the Stratix10 service

Parameters

  • struct stratix10_svc_chan *chan: Pointer to the service channel structure
  • void *msg: Pointer to the message to be sent
  • void **handler: Pointer to the handler for the asynchronous message used by caller for later reference.
  • async_callback_t cb: Callback function to be called upon completion
  • void *cb_arg: Argument to be passed to the callback function

Description

This function sends an asynchronous message to the SDM mailbox in EL3 secure firmware. It performs various checks and setups, including allocating a job ID, setting up the transaction ID and packaging it to El3 firmware. The function handles different commands by setting up the appropriate arguments for the SMC call. If the SMC call is successful, the handler is set up and the function returns 0. If the SMC call fails, appropriate error handling is performed along with cleanup of resources.

Return

0 on success, -EINVAL for invalid argument, -ENOMEM if memory is not available, -EAGAIN if EL3 firmware is busy, -EBADF if the message is rejected by EL3 firmware and -EIO on other errors from EL3 firmware.

stratix10_svc_async_poll() #

int stratix10_svc_async_poll(struct stratix10_svc_chan *chan, void *tx_handle, struct stratix10_svc_cb_data *data)

Polls the status of an asynchronous transaction.

Parameters

  • struct stratix10_svc_chan *chan: Pointer to the service channel structure.
  • void *tx_handle: Handle to the transaction being polled.
  • struct stratix10_svc_cb_data *data: Pointer to the callback data structure.

Description

This function polls the status of an asynchronous transaction identified by the given transaction handle. It ensures that the necessary structures are initialized and valid before proceeding with the poll operation. The function sets up the necessary arguments for the SMC call, invokes the call, and prepares the response data if the call is successful. If the call fails, the function returns the error mapped to the SVC status error.

Return

0 on success, -EINVAL if any input parameter is invalid, -EAGAIN if the transaction is still in progress, -EPERM if the command is invalid, or other negative error codes on failure.

stratix10_svc_async_done() #

int stratix10_svc_async_done(struct stratix10_svc_chan *chan, void *tx_handle)

Completes an asynchronous transaction.

Parameters

  • struct stratix10_svc_chan *chan: Pointer to the service channel structure.
  • void *tx_handle: Handle to the transaction being completed.

Description

This function completes an asynchronous transaction identified by the given transaction handle. It ensures that the necessary structures are initialized and valid before proceeding with the completion operation. The function deallocates the transaction ID, frees the memory allocated for the handler, and removes the handler from the transaction list.

Return

0 on success, -EINVAL if any input parameter is invalid, or other negative error codes on failure.

stratix10_svc_free_channel() #

void stratix10_svc_free_channel(struct stratix10_svc_chan *chan)

free service channel

Parameters

  • struct stratix10_svc_chan *chan: service channel to be freed

Description

This function is used by service client to free a service channel.

stratix10_svc_send() #

int stratix10_svc_send(struct stratix10_svc_chan *chan, void *msg)

send a message data to the remote

Parameters

  • struct stratix10_svc_chan *chan: service channel assigned to the client
  • void *msg: message data to be sent, in the format of "struct stratix10_svc_client_msg"

Description

This function is used by service client to add a message to the service layer driver's queue for being sent to the secure world.

Return

0 for success, -ENOMEM or -ENOBUFS on error.

stratix10_svc_done() #

void stratix10_svc_done(struct stratix10_svc_chan *chan)

complete service request transactions

Parameters

  • struct stratix10_svc_chan *chan: service channel assigned to the client

Description

This function should be called when client has finished its request or there is an error in the request process. It allows the service layer to stop the running thread to have maximize savings in kernel resources.

stratix10_svc_allocate_memory() #

void * stratix10_svc_allocate_memory(struct stratix10_svc_chan *chan, size_t size)

allocate memory

Parameters

  • struct stratix10_svc_chan *chan: service channel assigned to the client
  • size_t size: memory size requested by a specific service client

Description

Service layer allocates the requested number of bytes buffer from the memory pool, service client uses this function to get allocated buffers.

Return

address of allocated memory on success, or ERR_PTR() on error.

stratix10_svc_free_memory() #

void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr)

free allocated memory

Parameters

  • struct stratix10_svc_chan *chan: service channel assigned to the client
  • void *kaddr: memory to be freed

Description

This function is used by service client to free allocated buffers.

Edit this page