Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios Kernel

Management Engine Interface

Single-page view · as markdown

Intel(R) Management Engine Interface (Intel(R) MEI)

Peios Kernel / Hardware and drivers / Driver development / Management Engine Interface

Copyright © 2019 Intel Corporation

Table of Contents

  • Introduction
  • Intel(R) Management Engine (ME) Client bus API
  • Intel(R) Active Management Technology (Intel AMT)

HDCP:

Peios Kernel / Hardware and drivers / Driver development / Management Engine Interface

ME FW as a security engine provides the capability for setting up HDCP2.2 protocol negotiation between the Intel graphics device and an HDC2.2 sink.

ME FW prepares HDCP2.2 negotiation parameters, signs and encrypts them according the HDCP 2.2 spec. The Intel graphics sends the created blob to the HDCP2.2 sink.

Similarly, the HDCP2.2 sink's response is transferred to ME FW for decryption and verification.

Once all the steps of HDCP2.2 negotiation are completed, upon request ME FW will configure the port as authenticated and supply the HDCP encryption keys to Intel graphics hardware.

mei_hdcp driver #

The mei_hdcp driver acts as a translation layer between HDCP 2.2 protocol implementer (I915) and ME FW by translating HDCP2.2 negotiation messages to ME FW command payloads and vice versa.

mei_hdcp api #

mei_hdcp_initiate_session() #

int mei_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_init *ake_data)

Initiate a Wired HDCP2.2 Tx Session in ME FW

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_ake_init *ake_data: AKE_Init msg output.

Return

0 on Success, <0 on Failure.

mei_hdcp_verify_receiver_cert_prepare_km() #

int mei_hdcp_verify_receiver_cert_prepare_km(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_send_cert *rx_cert, bool *km_stored, struct hdcp2_ake_no_stored_km *ek_pub_km, size_t *msg_sz)

Verify the Receiver Certificate AKE_Send_Cert and prepare AKE_Stored_Km/AKE_No_Stored_Km

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_ake_send_cert *rx_cert: AKE_Send_Cert for verification
  • bool *km_stored: Pairing status flag output
  • struct hdcp2_ake_no_stored_km *ek_pub_km: AKE_Stored_Km/AKE_No_Stored_Km output msg
  • size_t *msg_sz: size of AKE_XXXXX_Km output msg

Return

0 on Success, <0 on Failure

mei_hdcp_verify_hprime() #

int mei_hdcp_verify_hprime(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_send_hprime *rx_hprime)

Verify AKE_Send_H_prime at ME FW.

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_ake_send_hprime *rx_hprime: AKE_Send_H_prime msg for ME FW verification

Return

0 on Success, <0 on Failure

mei_hdcp_store_pairing_info() #

int mei_hdcp_store_pairing_info(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_send_pairing_info *pairing_info)

Store pairing info received at ME FW

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_ake_send_pairing_info *pairing_info: AKE_Send_Pairing_Info msg input to ME FW

Return

0 on Success, <0 on Failure

mei_hdcp_initiate_locality_check() #

int mei_hdcp_initiate_locality_check(struct device *dev, struct hdcp_port_data *data, struct hdcp2_lc_init *lc_init_data)

Prepare LC_Init

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_lc_init *lc_init_data: LC_Init msg output

Return

0 on Success, <0 on Failure

mei_hdcp_verify_lprime() #

int mei_hdcp_verify_lprime(struct device *dev, struct hdcp_port_data *data, struct hdcp2_lc_send_lprime *rx_lprime)

Verify lprime.

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_lc_send_lprime *rx_lprime: LC_Send_L_prime msg for ME FW verification

Return

0 on Success, <0 on Failure

mei_hdcp_get_session_key() #

int mei_hdcp_get_session_key(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ske_send_eks *ske_data)

Prepare SKE_Send_Eks.

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_ske_send_eks *ske_data: SKE_Send_Eks msg output from ME FW.

Return

0 on Success, <0 on Failure

mei_hdcp_repeater_check_flow_prepare_ack() #

int mei_hdcp_repeater_check_flow_prepare_ack(struct device *dev, struct hdcp_port_data *data, struct hdcp2_rep_send_receiverid_list *rep_topology, struct hdcp2_rep_send_ack *rep_send_ack)

Validate the Downstream topology and prepare rep_ack.

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_rep_send_receiverid_list *rep_topology: Receiver ID List to be validated
  • struct hdcp2_rep_send_ack *rep_send_ack: repeater ack from ME FW.

Return

0 on Success, <0 on Failure

mei_hdcp_verify_mprime() #

int mei_hdcp_verify_mprime(struct device *dev, struct hdcp_port_data *data, struct hdcp2_rep_stream_ready *stream_ready)

Verify mprime.

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data
  • struct hdcp2_rep_stream_ready *stream_ready: RepeaterAuth_Stream_Ready msg for ME FW verification.

Return

0 on Success, <0 on Failure

mei_hdcp_enable_authentication() #

int mei_hdcp_enable_authentication(struct device *dev, struct hdcp_port_data *data)

Mark a port as authenticated through ME FW

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data

Return

0 on Success, <0 on Failure

mei_hdcp_close_session() #

int mei_hdcp_close_session(struct device *dev, struct hdcp_port_data *data)

Close the Wired HDCP Tx session of ME FW per port. This also disables the authenticated state of the port.

Parameters

  • struct device *dev: device corresponding to the mei_cl_device
  • struct hdcp_port_data *data: Intel HW specific hdcp data

Return

0 on Success, <0 on Failure

mei_hdcp_component_match() #

int mei_hdcp_component_match(struct device *dev, int subcomponent, void *data)

compare function for matching mei hdcp.

Parameters

  • struct device *dev: master device
  • int subcomponent: subcomponent to match (I915_COMPONENT_HDCP)
  • void *data: compare data (mei hdcp device)

Description

The function checks if the driver is i915, the subcomponent is HDCP and the grand parent of hdcp and the parent of i915 are the same PCH device.

Return

  • 1 - if components match
  • 0 - otherwise

Intel(R) Active Management Technology (Intel AMT)

Peios Kernel / Hardware and drivers / Driver development / Management Engine Interface

Prominent usage of the Intel ME Interface is to communicate with Intel(R) Active Management Technology (Intel AMT) implemented in firmware running on the Intel ME.

Intel AMT provides the ability to manage a host remotely out-of-band (OOB) even when the operating system running on the host processor has crashed or is in a sleep state.

  • Some examples of Intel AMT usage are:

    • Monitoring hardware state and platform components

    • Remote power off/on (useful for green computing or overnight IT maintenance)

    • OS updates

    • Storage of useful platform information such as software assets

    • Built-in hardware KVM

    • Selective network isolation of Ethernet and IP protocol flows based on policies set by a remote management console

    • IDE device redirection from remote management console

Intel AMT (OOB) communication is based on SOAP (deprecated starting with Release 6.0) over HTTP/S or WS-Management protocol over HTTP/S that are received from a remote management console application.

For more information about Intel AMT: https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm

Intel AMT Applications #

  1. Intel Local Management Service (Intel LMS)

    Applications running locally on the platform communicate with Intel AMT Release 2.0 and later releases in the same way that network applications do via SOAP over HTTP (deprecated starting with Release 6.0) or with WS-Management over SOAP over HTTP. This means that some Intel AMT features can be accessed from a local application using the same network interface as a remote application communicating with Intel AMT over the network.

    When a local application sends a message addressed to the local Intel AMT host name, the Intel LMS, which listens for traffic directed to the host name, intercepts the message and routes it to the Intel MEI. For more information: https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm Under "About Intel AMT" => "Local Access"

    For downloading Intel LMS: https://github.com/intel/lms

    The Intel LMS opens a connection using the Intel MEI driver to the Intel LMS firmware feature using a defined GUID and then communicates with the feature using a protocol called Intel AMT Port Forwarding Protocol (Intel APF protocol). The protocol is used to maintain multiple sessions with Intel AMT from a single application.

    See the protocol specification in the Intel AMT Software Development Kit (SDK) https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm Under "SDK Resources" => "Intel(R) vPro(TM) Gateway (MPS)" => "Information for Intel(R) vPro(TM) Gateway Developers" => "Description of the Intel AMT Port Forwarding (APF) Protocol"

  2. Intel AMT Remote configuration using a Local Agent

    A Local Agent enables IT personnel to configure Intel AMT out-of-the-box without requiring installing additional data to enable setup. The remote configuration process may involve an ISV-developed remote configuration agent that runs on the host. For more information: https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm Under "Setup and Configuration of Intel AMT" => "SDK Tools Supporting Setup and Configuration" => "Using the Local Agent Sample"

Intel AMT OS Health Watchdog #

The Intel AMT Watchdog is an OS Health (Hang/Crash) watchdog. Whenever the OS hangs or crashes, Intel AMT will send an event to any subscriber to this event. This mechanism means that IT knows when a platform crashes even when there is a hard failure on the host.

  • The Intel AMT Watchdog is composed of two parts:

    1. Firmware feature - receives the heartbeats and sends an event when the heartbeats stop.

    2. Intel MEI iAMT watchdog driver - connects to the watchdog feature, configures the watchdog and sends the heartbeats.

The Intel iAMT watchdog MEI driver uses the kernel watchdog API to configure the Intel AMT Watchdog and to send heartbeats to it. The default timeout of the watchdog is 120 seconds.

If the Intel AMT is not enabled in the firmware then the watchdog client won't enumerate on the me client bus and watchdog devices won't be exposed.

--- linux-mei@linux.intel.com

Intel(R) Management Engine (ME) Client bus API

Peios Kernel / Hardware and drivers / Driver development / Management Engine Interface

Rationale #

The MEI character device is useful for dedicated applications to send and receive data to the many FW appliance found in Intel's ME from the user space. However, for some of the ME functionalities it makes sense to leverage existing software stack and expose them through existing kernel subsystems.

In order to plug seamlessly into the kernel device driver model we add kernel virtual bus abstraction on top of the MEI driver. This allows implementing Linux kernel drivers for the various MEI features as a stand alone entities found in their respective subsystem. Existing device drivers can even potentially be re-used by adding an MEI CL bus layer to the existing code.

MEI CL bus API #

A driver implementation for an MEI Client is very similar to any other existing bus based device drivers. The driver registers itself as an MEI CL bus driver through the struct mei_cl_driver structure defined in include/linux/mei_cl_bus.c

struct mei_cl_driver {
        struct device_driver driver;
        const char *name;

        const struct mei_cl_device_id *id_table;

        int (*probe)(struct mei_cl_device *dev, const struct mei_cl_id *id);
        int (*remove)(struct mei_cl_device *dev);
};

The mei_cl_device_id structure defined in include/linux/mod_devicetable.h allows a driver to bind itself against a device name.

struct mei_cl_device_id {
        char name[MEI_CL_NAME_SIZE];
        uuid_le uuid;
        __u8    version;
        kernel_ulong_t driver_info;
};

To actually register a driver on the ME Client bus one must call the mei_cl_add_driver() API. This is typically called at module initialization time.

Once the driver is registered and bound to the device, a driver will typically try to do some I/O on this bus and this should be done through the mei_cl_send() and mei_cl_recv() functions. More detailed information is in API: section.

In order for a driver to be notified about pending traffic or event, the driver should register a callback via mei_cl_devev_register_rx_cb() and mei_cldev_register_notify_cb() function respectively.

API: #

mei_cldev_send_vtag() #

ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, const u8 *buf, size_t length, u8 vtag)

me device send with vtag (write)

Parameters

  • struct mei_cl_device *cldev: me client device
  • const u8 *buf: buffer to send
  • size_t length: buffer length
  • u8 vtag: virtual tag

Return

  • written size in bytes
  • < 0 on error

mei_cldev_send_vtag_timeout() #

ssize_t mei_cldev_send_vtag_timeout(struct mei_cl_device *cldev, const u8 *buf, size_t length, u8 vtag, unsigned long timeout)

me device send with vtag and timeout (write)

Parameters

  • struct mei_cl_device *cldev: me client device
  • const u8 *buf: buffer to send
  • size_t length: buffer length
  • u8 vtag: virtual tag
  • unsigned long timeout: send timeout in milliseconds, 0 for infinite timeout

Return

  • written size in bytes
  • < 0 on error

mei_cldev_recv_vtag() #

ssize_t mei_cldev_recv_vtag(struct mei_cl_device *cldev, u8 *buf, size_t length, u8 *vtag)

client receive with vtag (read)

Parameters

  • struct mei_cl_device *cldev: me client device
  • u8 *buf: buffer to receive
  • size_t length: buffer length
  • u8 *vtag: virtual tag

Return

  • read size in bytes
  • < 0 on error

mei_cldev_recv_timeout() #

ssize_t mei_cldev_recv_timeout(struct mei_cl_device *cldev, u8 *buf, size_t length, unsigned long timeout)

client receive with timeout (read)

Parameters

  • struct mei_cl_device *cldev: me client device
  • u8 *buf: buffer to receive
  • size_t length: buffer length
  • unsigned long timeout: send timeout in milliseconds, 0 for infinite timeout

Return

  • read size in bytes
  • < 0 on error

mei_cldev_recv_vtag_timeout() #

ssize_t mei_cldev_recv_vtag_timeout(struct mei_cl_device *cldev, u8 *buf, size_t length, u8 *vtag, unsigned long timeout)

client receive with vtag (read)

Parameters

  • struct mei_cl_device *cldev: me client device
  • u8 *buf: buffer to receive
  • size_t length: buffer length
  • u8 *vtag: virtual tag
  • unsigned long timeout: recv timeout in milliseconds, 0 for infinite timeout

Return

  • read size in bytes
  • < 0 on error

mei_cldev_send() #

ssize_t mei_cldev_send(struct mei_cl_device *cldev, const u8 *buf, size_t length)

me device send (write)

Parameters

  • struct mei_cl_device *cldev: me client device
  • const u8 *buf: buffer to send
  • size_t length: buffer length

Return

  • written size in bytes
  • < 0 on error

mei_cldev_send_timeout() #

ssize_t mei_cldev_send_timeout(struct mei_cl_device *cldev, const u8 *buf, size_t length, unsigned long timeout)

me device send with timeout (write)

Parameters

  • struct mei_cl_device *cldev: me client device
  • const u8 *buf: buffer to send
  • size_t length: buffer length
  • unsigned long timeout: send timeout in milliseconds, 0 for infinite timeout

Return

  • written size in bytes
  • < 0 on error

mei_cldev_recv() #

ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length)

client receive (read)

Parameters

  • struct mei_cl_device *cldev: me client device
  • u8 *buf: buffer to receive
  • size_t length: buffer length

Return

read size in bytes of < 0 on error

mei_cldev_register_rx_cb() #

int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb)

register Rx event callback

Parameters

  • struct mei_cl_device *cldev: me client devices
  • mei_cldev_cb_t rx_cb: callback function

Return

0 on success -EALREADY if an callback is already registered <0 on other errors

mei_cldev_register_notif_cb() #

int mei_cldev_register_notif_cb(struct mei_cl_device *cldev, mei_cldev_cb_t notif_cb)

register FW notification event callback

Parameters

  • struct mei_cl_device *cldev: me client devices
  • mei_cldev_cb_t notif_cb: callback function

Return

0 on success -EALREADY if an callback is already registered <0 on other errors

mei_cldev_get_drvdata() #

void * mei_cldev_get_drvdata(const struct mei_cl_device *cldev)

driver data getter

Parameters

  • const struct mei_cl_device *cldev: mei client device

Return

driver private data

mei_cldev_set_drvdata() #

void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data)

driver data setter

Parameters

  • struct mei_cl_device *cldev: mei client device
  • void *data: data to store

mei_cldev_ver() #

u8 mei_cldev_ver(const struct mei_cl_device *cldev)

return protocol version of the underlying me client

Parameters

  • const struct mei_cl_device *cldev: mei client device

Return

me client protocol version

mei_cldev_mtu() #

size_t mei_cldev_mtu(const struct mei_cl_device *cldev)

max message that client can send and receive

Parameters

  • const struct mei_cl_device *cldev: mei client device

Return

mtu or 0 if client is not connected

mei_cldev_enabled() #

bool mei_cldev_enabled(const struct mei_cl_device *cldev)

check whether the device is enabled

Parameters

  • const struct mei_cl_device *cldev: mei client device

Return

true if me client is initialized and connected

mei_cldev_enable() #

int mei_cldev_enable(struct mei_cl_device *cldev)

enable me client device create connection with me client

Parameters

  • struct mei_cl_device *cldev: me client device

Return

0 on success and < 0 on error

mei_cldev_disable() #

int mei_cldev_disable(struct mei_cl_device *cldev)

disable me client device disconnect form the me client

Parameters

  • struct mei_cl_device *cldev: me client device

Return

0 on success and < 0 on error

mei_cldev_send_gsc_command() #

ssize_t mei_cldev_send_gsc_command(struct mei_cl_device *cldev, u8 client_id, u32 fence_id, struct scatterlist *sg_in, size_t total_in_len, struct scatterlist *sg_out)

sends a gsc command, by sending a gsl mei message to gsc and receiving reply from gsc

Parameters

  • struct mei_cl_device *cldev: me client device
  • u8 client_id: client id to send the command to
  • u32 fence_id: fence id to send the command to
  • struct scatterlist *sg_in: scatter gather list containing addresses for rx message buffer
  • size_t total_in_len: total length of data in 'in' sg, can be less than the sum of buffers sizes
  • struct scatterlist *sg_out: scatter gather list containing addresses for tx message buffer

Return

  • written size in bytes
  • < 0 on error

Example #

As a theoretical example let's pretend the ME comes with a "contact" NFC IP. The driver init and exit routines for this device would look like:

#define CONTACT_DRIVER_NAME "contact"

static struct mei_cl_device_id contact_mei_cl_tbl[] = {
        { CONTACT_DRIVER_NAME, },

        /* required last entry */
        { }
};
MODULE_DEVICE_TABLE(mei_cl, contact_mei_cl_tbl);

static struct mei_cl_driver contact_driver = {
        .id_table = contact_mei_tbl,
        .name = CONTACT_DRIVER_NAME,

        .probe = contact_probe,
        .remove = contact_remove,
};

static int contact_init(void)
{
        int r;

        r = mei_cl_driver_register(&contact_driver);
        if (r) {
                pr_err(CONTACT_DRIVER_NAME ": driver registration failed\n");
                return r;
        }

        return 0;
}

static void __exit contact_exit(void)
{
        mei_cl_driver_unregister(&contact_driver);
}

module_init(contact_init);
module_exit(contact_exit);

And the driver's simplified probe routine would look like that:

int contact_probe(struct mei_cl_device *dev, struct mei_cl_device_id *id)
{
        [...]
        mei_cldev_enable(dev);

        mei_cldev_register_rx_cb(dev, contact_rx_cb);

        return 0;
}

In the probe routine the driver first enable the MEI device and then registers an rx handler which is as close as it can get to registering a threaded IRQ handler. The handler implementation will typically call mei_cldev_recv() and then process received data.

#define MAX_PAYLOAD 128
#define HDR_SIZE 4
static void conntact_rx_cb(struct mei_cl_device *cldev)
{
        struct contact *c = mei_cldev_get_drvdata(cldev);
        unsigned char payload[MAX_PAYLOAD];
        ssize_t payload_sz;

        payload_sz = mei_cldev_recv(cldev, payload,  MAX_PAYLOAD)
        if (reply_size < HDR_SIZE) {
                return;
        }

        c->process_rx(payload);

}

MEI Client Bus Drivers #

  • HDCP:
  • MEI NFC

Introduction

Peios Kernel / Hardware and drivers / Driver development / Management Engine Interface

Peios: Interface availability and resource limits do not grant native access. Peios applies descriptor/handle checks, its sysfs write gate and mapped privilege checks where applicable. Read inherited privileged/unprivileged terminology with Peios kernel behaviour.

Introduction #

The Intel Management Engine (Intel ME) is an isolated and protected computing resource (Co-processor) residing inside certain Intel chipsets. The Intel ME provides support for computer/IT management and security features. The actual feature set depends on the Intel chipset SKU.

The Intel Management Engine Interface (Intel MEI, previously known as HECI) is the interface between the Host and Intel ME. This interface is exposed to the host as a PCI device, actually multiple PCI devices might be exposed. The Intel MEI Driver is in charge of the communication channel between a host application and the Intel ME features.

Each Intel ME feature, or Intel ME Client is addressed by a unique GUID and each client has its own protocol. The protocol is message-based with a header and payload up to maximal number of bytes advertised by the client, upon connection.

Intel MEI Driver #

The driver exposes a character device with device nodes /dev/meiX.

An application maintains communication with an Intel ME feature while /dev/meiX is open. The binding to a specific feature is performed by calling MEI_CONNECT_CLIENT_IOCTL, which passes the desired GUID. The number of instances of an Intel ME feature that can be opened at the same time depends on the Intel ME feature, but most of the features allow only a single instance.

The driver is transparent to data that are passed between firmware feature and host application.

Because some of the Intel ME features can change the system configuration, the driver by default allows only a privileged user to access it.

The session is terminated calling close(fd).

A code snippet for an application communicating with Intel AMTHI client:

In order to support virtualization or sandboxing a trusted supervisor can use MEI_CONNECT_CLIENT_IOCTL_VTAG to create virtual channels with an Intel ME feature. Not all features support virtual channels such client with answer EOPNOTSUPP.

struct mei_connect_client_data data;
fd = open(MEI_DEVICE);

data.d.in_client_uuid = AMTHI_GUID;

ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data);

printf("Ver=%d, MaxLen=%ld\n",
       data.d.in_client_uuid.protocol_version,
       data.d.in_client_uuid.max_msg_length);

[...]

write(fd, amthi_req_data, amthi_req_data_len);

[...]

read(fd, &amthi_res_data, amthi_res_data_len);

[...]
close(fd);

User space API

IOCTLs: #

The Intel MEI Driver supports the following IOCTL commands:

IOCTL_MEI_CONNECT_CLIENT #

Connect to firmware Feature/Client.

Usage:

struct mei_connect_client_data client_data;

ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &client_data);

Inputs:

struct mei_connect_client_data - contain the following
Input field:

        in_client_uuid -        GUID of the FW Feature that needs
                                to connect to.
 Outputs:
        out_client_properties - Client Properties: MTU and Protocol Version.

 Error returns:

        ENOTTY  No such client (i.e. wrong GUID) or connection is not allowed.
        EINVAL  Wrong IOCTL Number
        ENODEV  Device or Connection is not initialized or ready.
        ENOMEM  Unable to allocate memory to client internal data.
        EFAULT  Fatal Error (e.g. Unable to access user input data)
        EBUSY   Connection Already Open

Note: max_msg_length (MTU) in client properties describes the maximum data that can be sent or received. (e.g. if MTU=2K, can send requests up to bytes 2k and received responses up to 2k bytes).

IOCTL_MEI_CONNECT_CLIENT_VTAG: #

Usage:

struct mei_connect_client_data_vtag client_data_vtag;

ioctl(fd, IOCTL_MEI_CONNECT_CLIENT_VTAG, &client_data_vtag);

Inputs:

struct mei_connect_client_data_vtag - contain the following
Input field:

        in_client_uuid -  GUID of the FW Feature that needs
                          to connect to.
        vtag - virtual tag [1, 255]

 Outputs:
        out_client_properties - Client Properties: MTU and Protocol Version.

 Error returns:

        ENOTTY No such client (i.e. wrong GUID) or connection is not allowed.
        EINVAL Wrong IOCTL Number or tag == 0
        ENODEV Device or Connection is not initialized or ready.
        ENOMEM Unable to allocate memory to client internal data.
        EFAULT Fatal Error (e.g. Unable to access user input data)
        EBUSY  Connection Already Open
        EOPNOTSUPP Vtag is not supported

IOCTL_MEI_NOTIFY_SET #

Enable or disable event notifications.

Usage:

        uint32_t enable;

        ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable);


        uint32_t enable = 1;
        or
        uint32_t enable[disable] = 0;

Error returns:


        EINVAL  Wrong IOCTL Number
        ENODEV  Device  is not initialized or the client not connected
        ENOMEM  Unable to allocate memory to client internal data.
        EFAULT  Fatal Error (e.g. Unable to access user input data)
        EOPNOTSUPP if the device doesn't support the feature

Note: The client must be connected in order to enable notification events

IOCTL_MEI_NOTIFY_GET #

Retrieve event

Usage:
        uint32_t event;
        ioctl(fd, IOCTL_MEI_NOTIFY_GET, &event);

Outputs:
        1 - if an event is pending
        0 - if there is no even pending

Error returns:
        EINVAL  Wrong IOCTL Number
        ENODEV  Device is not initialized or the client not connected
        ENOMEM  Unable to allocate memory to client internal data.
        EFAULT  Fatal Error (e.g. Unable to access user input data)
        EOPNOTSUPP if the device doesn't support the feature

Note: The client must be connected and event notification has to be enabled in order to receive an event

Supported Chipsets #

82X38/X48 Express and newer

linux-mei@linux.intel.com

MEI NFC

Peios Kernel / Hardware and drivers / Driver development / Management Engine Interface

Some Intel 8 and 9 Series chipsets support NFC devices connected behind the Intel Management Engine controller. MEI client bus exposes the NFC chips as NFC phy devices and enables binding with Microread and NXP PN544 NFC device driver from the Linux NFC subsystem.

flowchart TB
  n0(["mei/bus(nfc)"])
  n1(["me fw (nfc)"])
  n2(["drivers/nfc/mei_phy"])
  n3(["drivers/nfc/microread/mei"])
  n4(["drivers/nfc/pn544/mei"])
  n5(["net/nfc"])
  n6(["neard"])
  n0 --> n1
  n2 --> n0
  n3 --> n0
  n3 --> n2
  n4 --> n0
  n4 --> n2
  n5 --> n3
  n5 --> n4
  n6 --> n5

MEI NFC Stack

Peios Learn — documentation for Peios software.

Built with Trail.