coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
me.c File Reference
#include <acpi/acpi.h>
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_def.h>
#include <string.h>
#include <delay.h>
#include <elog.h>
#include <stdlib.h>
#include "chip.h"
#include "me.h"
#include "pch.h"
#include <vendorcode/google/chromeos/chromeos.h>
Include dependency graph for me.c:

Go to the source code of this file.

Data Structures

struct  mbp_payload
 

Macros

#define ASSIGN_FIELD_PTR(field_, val_)
 

Functions

static void mei_dump (u32 dword, int offset, const char *type)
 
static union mei_csr read_host_csr (void)
 
static void write_host_csr (union mei_csr csr)
 
static union mei_csr read_me_csr (void)
 
static void write_cb (u32 dword)
 
static u32 read_cb (void)
 
static int mei_wait_for_me_ready (void)
 
static void mei_reset (void)
 
static int mei_send_packet (union mei_header *mei, void *req_data)
 
static int mei_send_data (u8 me_address, u8 host_address, void *req_data, int req_bytes)
 
static int mei_send_header (u8 me_address, u8 host_address, void *header, int header_len, int complete)
 
static int mei_recv_msg (void *header, int header_bytes, void *rsp_data, int rsp_bytes)
 
static int mei_sendrecv_mkhi (struct mkhi_header *mkhi, void *req_data, int req_bytes, void *rsp_data, int rsp_bytes)
 
static int mei_sendrecv_icc (struct icc_header *icc, void *req_data, int req_bytes, void *rsp_data, int rsp_bytes)
 
static void intel_me_mbp_give_up (struct device *dev)
 
static void intel_me_mbp_clear (struct device *dev)
 
static void me_print_fw_version (struct mbp_fw_version_name *vers_name)
 
static void print_cap (const char *name, int state)
 
static int mkhi_get_fwcaps (struct mbp_mefwcaps *cap)
 
static void me_print_fwcaps (struct mbp_mefwcaps *cap)
 
static int mkhi_end_of_post (void)
 
void intel_me_finalize (struct device *dev)
 
static int me_icc_set_clock_enables (u32 mask)
 
static enum me_bios_path intel_me_path (struct device *dev)
 
static int intel_mei_setup (struct device *dev)
 
static int intel_me_extend_valid (struct device *dev)
 
static u32 me_to_host_words_pending (void)
 
static int intel_me_read_mbp (struct me_bios_payload *mbp_data, struct device *dev)
 
static void intel_me_init (struct device *dev)
 
static void intel_me_enable (struct device *dev)
 

Variables

static const char *const me_bios_path_values []
 
static u8mei_base_address
 
static struct device_operations device_ops
 
static const unsigned short pci_device_ids []
 
static const struct pci_driver intel_me __pci_driver
 

Macro Definition Documentation

◆ ASSIGN_FIELD_PTR

#define ASSIGN_FIELD_PTR (   field_,
  val_ 
)
Value:
{ \
mbp_data->field_ = (typeof(mbp_data->field_))(void *)val_; \
break; \
}

Function Documentation

◆ intel_me_enable()

static void intel_me_enable ( struct device dev)
static

Definition at line 903 of file me.c.

◆ intel_me_extend_valid()

static int intel_me_extend_valid ( struct device dev)
static

Definition at line 669 of file me.c.

References BIOS_DEBUG, BIOS_ERR, CONFIG, count, me_heres::extend_feature_present, me_heres::extend_reg_algorithm, me_heres::extend_reg_valid, PCI_ME_EXT_SHA1, PCI_ME_EXT_SHA256, PCI_ME_HER, PCI_ME_HERES, pci_read_config32(), printk, and me_heres::raw.

Referenced by intel_me_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intel_me_finalize()

◆ intel_me_init()

◆ intel_me_mbp_clear()

static void intel_me_mbp_clear ( struct device dev)
static

Definition at line 413 of file me.c.

References BIOS_INFO, BIOS_WARNING, count, intel_me_mbp_give_up(), me_hfs2::mbp_cleared, ME_DELAY, ME_RETRY, PCI_ME_HFS2, pci_read_config32(), printk, me_hfs2::raw, and udelay().

Referenced by intel_me_finalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intel_me_mbp_give_up()

static void intel_me_mbp_give_up ( struct device dev)
static

Definition at line 397 of file me.c.

References mei_csr::interrupt_generate, PCI_ME_H_GS2, PCI_ME_MBP_GIVE_UP, pci_write_config32(), read_host_csr(), mei_csr::reset, and write_host_csr().

Referenced by intel_me_mbp_clear(), and intel_me_read_mbp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intel_me_path()

static enum me_bios_path intel_me_path ( struct device dev)
static

Definition at line 554 of file me.c.

References icc_header::api_version, BIOS_ERR, BIOS_INFO, icc_clock_enables_msg::clock_enables, ICC_API_VERSION_LYNXPOINT, ICC_SET_CLOCK_ENABLES, mask, mei_sendrecv_icc(), NULL, and printk.

Referenced by intel_me_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intel_me_read_mbp()

◆ intel_mei_setup()

static int intel_mei_setup ( struct device dev)
static

◆ me_icc_set_clock_enables()

static int me_icc_set_clock_enables ( u32  mask)
static

Definition at line 554 of file me.c.

Referenced by intel_me_init().

Here is the caller graph for this function:

◆ me_print_fw_version()

static void me_print_fw_version ( struct mbp_fw_version_name vers_name)
static

◆ me_print_fwcaps()

◆ me_to_host_words_pending()

static u32 me_to_host_words_pending ( void  )
static

Definition at line 713 of file me.c.

References mei_csr::buffer_depth, mei_csr::buffer_read_ptr, mei_csr::buffer_write_ptr, read_me_csr(), and mei_csr::ready.

Referenced by intel_me_read_mbp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_dump()

static void mei_dump ( u32  dword,
int  offset,
const char *  type 
)
static

◆ mei_recv_msg()

static int mei_recv_msg ( void header,
int  header_bytes,
void rsp_data,
int  rsp_bytes 
)
static

◆ mei_reset()

static void mei_reset ( void  )
static

Definition at line 126 of file me.c.

References mei_csr::interrupt_generate, mei_wait_for_me_ready(), read_host_csr(), mei_csr::ready, mei_csr::reset, and write_host_csr().

Referenced by mei_send_packet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_send_data()

static int mei_send_data ( u8  me_address,
u8  host_address,
void req_data,
int  req_bytes 
)
static

Definition at line 204 of file me.c.

References mei_csr::buffer_depth, mei_csr::buffer_write_ptr, header, mei_header::host_address, mei_send_packet(), and read_host_csr().

Referenced by mei_sendrecv_icc(), and mei_sendrecv_mkhi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_send_header()

static int mei_send_header ( u8  me_address,
u8  host_address,
void header,
int  header_len,
int  complete 
)
static

Definition at line 240 of file me.c.

References mei_header::client_address, header, mei_header::host_address, and mei_send_packet().

Referenced by mei_sendrecv_icc(), and mei_sendrecv_mkhi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_send_packet()

static int mei_send_packet ( union mei_header mei,
void req_data 
)
static

Definition at line 150 of file me.c.

References BIOS_DEBUG, BIOS_ERR, mei_csr::buffer_depth, mei_csr::buffer_write_ptr, mei_csr::interrupt_generate, mei_header::length, mei_reset(), mei_wait_for_me_ready(), printk, mei_header::raw, read_host_csr(), write_cb(), and write_host_csr().

Referenced by mei_send_data(), and mei_send_header().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_sendrecv_icc()

static int mei_sendrecv_icc ( struct icc_header icc,
void req_data,
int  req_bytes,
void rsp_data,
int  rsp_bytes 
)
inlinestatic

Definition at line 369 of file me.c.

References MEI_ADDRESS_ICC, MEI_HOST_ADDRESS, mei_recv_msg(), mei_send_data(), and mei_send_header().

Referenced by intel_me_path().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_sendrecv_mkhi()

static int mei_sendrecv_mkhi ( struct mkhi_header mkhi,
void req_data,
int  req_bytes,
void rsp_data,
int  rsp_bytes 
)
inlinestatic

Definition at line 331 of file me.c.

References BIOS_ERR, mkhi_header::command, mkhi_header::group_id, mkhi_header::is_response, MEI_ADDRESS_MKHI, MEI_HOST_ADDRESS, mei_recv_msg(), mei_send_data(), mei_send_header(), and printk.

Referenced by mkhi_end_of_post(), and mkhi_get_fwcaps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mei_wait_for_me_ready()

static int mei_wait_for_me_ready ( void  )
static

Definition at line 110 of file me.c.

References BIOS_ERR, ME_DELAY, ME_RETRY, printk, read_me_csr(), mei_csr::ready, and udelay().

Referenced by mei_recv_msg(), mei_reset(), and mei_send_packet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkhi_end_of_post()

static int mkhi_end_of_post ( void  )
static

Definition at line 500 of file me.c.

References BIOS_ERR, BIOS_INFO, BIOS_NOTICE, mkhi_header::group_id, mei_sendrecv_mkhi(), MKHI_END_OF_POST, MKHI_GROUP_ID_GEN, NULL, and printk.

Referenced by intel_me_finalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkhi_get_fwcaps()

static int mkhi_get_fwcaps ( struct mbp_mefwcaps cap)
static

Definition at line 453 of file me.c.

References BIOS_ERR, me_fwcaps::caps_sku, mkhi_header::group_id, mei_sendrecv_mkhi(), MKHI_FWCAPS_GET_RULE, MKHI_GROUP_ID_FWCAPS, and printk.

Referenced by me_print_fwcaps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_cap()

static void print_cap ( const char *  name,
int  state 
)
inlinestatic

Definition at line 446 of file me.c.

References BIOS_DEBUG, name, and printk.

Referenced by me_print_fwcaps().

Here is the caller graph for this function:

◆ read_cb()

static u32 read_cb ( void  )
inlinestatic

Definition at line 102 of file me.c.

References mei_base_address, mei_dump(), MEI_ME_CB_RW, and read32().

Referenced by intel_me_read_mbp(), and mei_recv_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_host_csr()

static union mei_csr read_host_csr ( void  )
static

Definition at line 43 of file me.c.

Referenced by intel_me_mbp_give_up(), intel_me_read_mbp(), intel_mei_setup(), mei_recv_msg(), mei_reset(), mei_send_data(), and mei_send_packet().

Here is the caller graph for this function:

◆ read_me_csr()

static union mei_csr read_me_csr ( void  )
static

Definition at line 83 of file me.c.

References mei_base_address, mei_dump(), MEI_H_CSR, mei_csr::raw, and write32().

Referenced by me_to_host_words_pending(), mei_recv_msg(), and mei_wait_for_me_ready().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_cb()

static void write_cb ( u32  dword)
inlinestatic

Definition at line 96 of file me.c.

References mei_base_address, mei_dump(), MEI_H_CB_WW, and write32().

Referenced by mei_send_packet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_host_csr()

static void write_host_csr ( union mei_csr  csr)
inlinestatic

Definition at line 83 of file me.c.

Referenced by intel_me_mbp_give_up(), intel_me_read_mbp(), intel_mei_setup(), mei_recv_msg(), mei_reset(), and mei_send_packet().

Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver intel_me __pci_driver
static
Initial value:
= {
.ops = &device_ops,
.vendor = PCI_VID_INTEL,
.devices = pci_device_ids,
}
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
static struct device_operations device_ops
Definition: me.c:912
static const unsigned short pci_device_ids[]
Definition: me.c:922

Definition at line 922 of file me.c.

◆ device_ops

struct device_operations device_ops
static
Initial value:
= {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.enable = intel_me_enable,
.init = intel_me_init,
.ops_pci = &pci_dev_ops_pci,
}
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
static void intel_me_init(struct device *dev)
Definition: me.c:850
static void intel_me_enable(struct device *dev)
Definition: me.c:903
void intel_me_finalize(struct device *dev)
Definition: me.c:519

Definition at line 903 of file me.c.

◆ me_bios_path_values

const char* const me_bios_path_values[]
static
Initial value:
= {
[ME_NORMAL_BIOS_PATH] = "Normal",
[ME_S3WAKE_BIOS_PATH] = "S3 Wake",
[ME_ERROR_BIOS_PATH] = "Error",
[ME_RECOVERY_BIOS_PATH] = "Recovery",
[ME_DISABLE_BIOS_PATH] = "Disable",
[ME_FIRMWARE_UPDATE_BIOS_PATH] = "Firmware Update",
}
@ ME_ERROR_BIOS_PATH
Definition: me.h:313
@ ME_RECOVERY_BIOS_PATH
Definition: me.h:314
@ ME_DISABLE_BIOS_PATH
Definition: me.h:315
@ ME_FIRMWARE_UPDATE_BIOS_PATH
Definition: me.h:316
@ ME_S3WAKE_BIOS_PATH
Definition: me.h:312
@ ME_NORMAL_BIOS_PATH
Definition: me.h:311

Definition at line 31 of file me.c.

Referenced by intel_me_init().

◆ mei_base_address

u8* mei_base_address
static

Definition at line 41 of file me.c.

Referenced by intel_me_finalize(), intel_mei_setup(), read_cb(), read_me_csr(), and write_cb().

◆ pci_device_ids

const unsigned short pci_device_ids[]
static
Initial value:
= {
0
}
#define PCI_DID_INTEL_LPT_LP_MEI
Definition: pci_ids.h:4229
#define PCI_DID_INTEL_LPT_H_MEI
Definition: pci_ids.h:4228

Definition at line 922 of file me.c.