簡介

英特爾管理引擎 (Intel ME) 是一種位於某些英特爾晶片組內部的獨立受保護計算資源(協處理器)。英特爾 ME 提供對計算機/IT 管理和安全功能的支援。實際的功能集取決於英特爾晶片組 SKU。

英特爾管理引擎介面 (Intel MEI,以前稱為 HECI) 是主機和英特爾 ME 之間的介面。此介面作為 PCI 裝置暴露給主機,實際上可能會暴露多個 PCI 裝置。英特爾 MEI 驅動程式負責主機應用程式和英特爾 ME 功能之間的通訊通道。

每個英特爾 ME 功能或英特爾 ME 客戶端都由唯一的 GUID 定址,每個客戶端都有自己的協議。該協議是基於訊息的,包含一個訊息頭和一個有效載荷,其最大位元組數由客戶端在連線時通告。

英特爾 MEI 驅動程式

該驅動程式暴露一個字元裝置,其裝置節點為 /dev/meiX。

應用程式在 /dev/meiX 開啟時與英特爾 ME 功能保持通訊。透過呼叫 MEI_CONNECT_CLIENT_IOCTL 並傳入所需的 GUID 來執行與特定功能的繫結。一個英特爾 ME 功能可以同時開啟的例項數量取決於該英特爾 ME 功能,但大多數功能只允許單個例項。

驅動程式對在韌體功能和主機應用程式之間傳遞的資料是透明的。

由於某些英特爾 ME 功能可以更改系統配置,因此驅動程式預設只允許特權使用者訪問它。

會話透過呼叫 close(fd) 來終止。

與英特爾 AMTHI 客戶端通訊的應用程式程式碼片段

為了支援虛擬化或沙盒,可信的監督者可以使用 MEI_CONNECT_CLIENT_IOCTL_VTAG 與英特爾 ME 功能建立虛擬通道。並非所有功能都支援虛擬通道,此類客戶端會返回 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);

使用者空間 API

IOCTLs:

英特爾 MEI 驅動程式支援以下 IOCTL 命令

IOCTL_MEI_CONNECT_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
注意:

客戶端屬性中的 max_msg_length (MTU) 描述了可以傳送或接收的最大資料。(例如,如果 MTU=2K,則可以傳送高達 2k 位元組的請求,並接收高達 2k 位元組的響應)。

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

啟用或停用事件通知。

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
注意:

客戶端必須處於連線狀態才能啟用通知事件

IOCTL_MEI_NOTIFY_GET

檢索事件

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
注意:

客戶端必須處於連線狀態,並且已啟用事件通知才能接收事件

支援的晶片組

82X38/X48 Express 及更新版本

linux-mei@linux.intel.com