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=enforcerequires PeiosTcb trust for that path. This does not cover the separateFW_UPLOADinterface. See Peios kernel behaviour.
DMI Interfaces #
dmi_check_system() #
int 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 * 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 * 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 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 * find onboard device by type/name
Parameters
int type: device type orDMI_DEV_TYPE_ANYto match all device typesconst char *name: device name string orNULLto match allconst struct dmi_device *from: previous device found in search, orNULLfor 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 parse a DMI date
Parameters
int field: data index (see enum dmi_field)int *yearp: optional out parameter for the yearint *monthp: optional out parameter for the monthint *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 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 Walk the DMI table and get called back for every record
Parameters
void (*decode)(const struct dmi_header *, void *): Callback functionvoid *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 compare a string to the dmi field (if exists)
Parameters
enum dmi_field f: DMI field identifierconst 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 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 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 copies raw data to buffer for userspace to parse
Parameters
struct edd_device *edev: target edd_devicechar *buf: output buffer
Return
number of bytes written, or -EINVAL on failure
edd_release() #
void 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 is this EDD device a 'type' device?
Parameters
struct edd_device *edev: target edd_deviceconst 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 * finds pci_dev that matches edev
Parameters
struct edd_device *edev: edd_device
Description
Returns pci_dev if found, or NULL
edd_init() #
int creates sysfs tree of EDD data
Parameters
void: no arguments
Generic System Framebuffers Interface #
sysfb_disable() #
void 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 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-shootingCOMMAND_RECONFIG: ask for FPGA configuration preparation, return status is SVC_STATUS_OKCOMMAND_RECONFIG_DATA_SUBMIT: submit buffer(s) of bit-stream data for the FPGA configuration, return status is SVC_STATUS_SUBMITTED or SVC_STATUS_ERRORCOMMAND_RECONFIG_DATA_CLAIM: check the status of the configuration, return status is SVC_STATUS_COMPLETED, or SVC_STATUS_BUSY, or SVC_STATUS_ERRORCOMMAND_RECONFIG_STATUS: check the status of the configuration, return status is SVC_STATUS_COMPLETED, or SVC_STATUS_BUSY, or SVC_STATUS_ERRORCOMMAND_RSU_STATUS: request remote system update boot log, return status is log data or SVC_STATUS_RSU_ERRORCOMMAND_RSU_UPDATE: set the offset of the bitstream to boot after reboot, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_RSU_NOTIFY: report the status of hard processor system software to firmware, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_RSU_RETRY: query firmware for the current image's retry counter, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_RSU_MAX_RETRY: query firmware for the max retry value, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_RSU_DCMF_VERSION: query firmware for the DCMF version, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_RSU_DCMF_STATUS: query firmware for the DCMF status return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_FIRMWARE_VERSION: query running firmware version, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_RSU_GET_SPT_TABLE: query firmware for SPT table return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_FCS_REQUEST_SERVICE: request validation of image from firmware, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAMCOMMAND_FCS_SEND_CERTIFICATE: send a certificate, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERRORCOMMAND_FCS_GET_PROVISION_DATA: read the provisioning data, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERRORCOMMAND_FCS_DATA_ENCRYPTION: encrypt the data, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERRORCOMMAND_FCS_DATA_DECRYPTION: decrypt the data, return status is SVC_STATUS_OK, SVC_STATUS_INVALID_PARAM, SVC_STATUS_ERRORCOMMAND_FCS_RANDOM_NUMBER_GEN: generate a random number, return status is SVC_STATUS_OK, SVC_STATUS_ERRORCOMMAND_POLL_SERVICE_STATUS: poll if the service request is complete, return statis is SVC_STATUS_OK, SVC_STATUS_ERROR or SVC_STATUS_BUSYCOMMAND_MBOX_SEND_CMD: send generic mailbox command, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_SMC_SVC_VERSION: Non-mailbox SMC SVC API Version, return status is SVC_STATUS_OKCOMMAND_HWMON_READTEMP: query the temperature from the hardware monitor, return status is SVC_STATUS_OK or SVC_STATUS_ERRORCOMMAND_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
;
Members
payload: starting address of data need be processedpayload_length: to be processed data size in bytespayload_output: starting address of processed datapayload_length_output: processed data size in bytescommand: service commandarg: args to be passed via registers and not physically mapped buffers
struct stratix10_svc_command_config_type #
config type
Definition
;
Members
flags: flag bit for the type of FPGA configuration
struct stratix10_svc_cb_data #
callback data structure from service layer
Definition
;
Members
status: the status of sent commandkaddr1: address of 1st completed data blockkaddr2: address of 2nd completed data blockkaddr3: address of 3rd completed data block
struct stratix10_svc_client #
service client structure
Definition
;
Members
dev: the client devicereceive_cb: callback to provide service client the received datapriv: client private data
stratix10_svc_request_channel_byname() #
struct stratix10_svc_chan * request a service channel
Parameters
struct stratix10_svc_client *client: pointer to service clientconst 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 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 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 Send an asynchronous message to the Stratix10 service
Parameters
struct stratix10_svc_chan *chan: Pointer to the service channel structurevoid *msg: Pointer to the message to be sentvoid **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 completionvoid *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 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 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 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 send a message data to the remote
Parameters
struct stratix10_svc_chan *chan: service channel assigned to the clientvoid *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 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 * allocate memory
Parameters
struct stratix10_svc_chan *chan: service channel assigned to the clientsize_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 free allocated memory
Parameters
struct stratix10_svc_chan *chan: service channel assigned to the clientvoid *kaddr: memory to be freed
Description
This function is used by service client to free allocated buffers.