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 <stdlib.h>
#include <string.h>
#include <delay.h>
#include <elog.h>
#include <soc/me.h>
#include <soc/lpc.h>
#include <soc/pch.h>
#include <soc/pci_devs.h>
#include <soc/rcba.h>
#include <soc/intel/broadwell/pch/chip.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 (void *ptr, int dword, int offset, const char *type)
 
static void mei_read_dword_ptr (void *ptr, int offset)
 
static void mei_write_dword_ptr (void *ptr, int offset)
 
static void pci_read_dword_ptr (struct device *dev, void *ptr, int offset)
 
static void read_host_csr (struct mei_csr *csr)
 
static void write_host_csr (struct mei_csr *csr)
 
static void read_me_csr (struct mei_csr *csr)
 
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 (struct 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 (mbp_fw_version_name *vers_name)
 
static void print_cap (const char *name, int state)
 
static int mkhi_get_fwcaps (mbp_mefwcaps *cap)
 
static void me_print_fwcaps (mbp_mefwcaps *cap)
 
static int mkhi_end_of_post (void)
 
static int mkhi_end_of_post_noack (void)
 
static int mkhi_hmrfpo_lock (void)
 
static int mkhi_hmrfpo_lock_noack (void)
 
static void intel_me_finalize (struct device *dev)
 
static int me_icc_set_clock_enables (u32 mask)
 
static 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 void intel_me_print_mbp (me_bios_payload *mbp_data)
 
static u32 me_to_host_words_pending (void)
 
static int intel_me_read_mbp (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 * 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 1023 of file me.c.

◆ intel_me_extend_valid()

static int intel_me_extend_valid ( struct device dev)
static

Definition at line 733 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(), pci_read_dword_ptr(), 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_finalize()

static void intel_me_finalize ( struct device dev)
static

Definition at line 596 of file me.c.

References FD2, mei_base_address, PCH_DISABLE_MEI1, PCI_COMMAND, PCI_COMMAND_IO, PCI_COMMAND_MASTER, PCI_COMMAND_MEMORY, pci_read_config16(), pci_write_config16(), RCBA32, and RCBA32_OR.

Here is the call graph for this function:

◆ intel_me_init()

◆ intel_me_mbp_clear()

static void intel_me_mbp_clear ( struct device dev)
static

Definition at line 436 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_dword_ptr(), printk, and udelay().

Referenced by intel_me_read_mbp().

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 420 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()

◆ intel_me_print_mbp()

static void intel_me_print_mbp ( me_bios_payload mbp_data)
static

◆ 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 615 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:

◆ me_print_fw_version()

static void me_print_fw_version ( 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 795 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 ( void ptr,
int  dword,
int  offset,
const char *  type 
)
static

◆ mei_read_dword_ptr()

static void mei_read_dword_ptr ( void ptr,
int  offset 
)
inlinestatic

Definition at line 82 of file me.c.

References mei_base_address, mei_dump(), memcpy(), offset, and read32().

Referenced by intel_me_read_mbp(), mei_recv_msg(), read_host_csr(), and read_me_csr().

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

◆ 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 149 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 227 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 263 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 ( struct mei_header mei,
void req_data 
)
static

Definition at line 173 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_H_CB_WW, mei_reset(), mei_wait_for_me_ready(), mei_write_dword_ptr(), printk, 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 392 of file me.c.

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

Referenced by me_icc_set_clock_enables().

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 354 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(), mkhi_end_of_post_noack(), mkhi_get_fwcaps(), mkhi_hmrfpo_lock(), and mkhi_hmrfpo_lock_noack().

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 133 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:

◆ mei_write_dword_ptr()

static void mei_write_dword_ptr ( void ptr,
int  offset 
)
inlinestatic

Definition at line 89 of file me.c.

References mei_base_address, mei_dump(), memcpy(), offset, and write32().

Referenced by mei_send_packet(), and write_host_csr().

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 523 of file me.c.

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

Referenced by intel_me_init().

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

◆ mkhi_end_of_post_noack()

static int mkhi_end_of_post_noack ( void  )
static

Definition at line 542 of file me.c.

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

Referenced by intel_me_init().

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

◆ mkhi_get_fwcaps()

static int mkhi_get_fwcaps ( mbp_mefwcaps cap)
static

Definition at line 476 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:

◆ mkhi_hmrfpo_lock()

static int mkhi_hmrfpo_lock ( void  )
static

Definition at line 560 of file me.c.

References BIOS_ERR, BIOS_INFO, mkhi_header::group_id, mei_sendrecv_mkhi(), MKHI_GROUP_ID_HMRFPO, MKHI_HMRFPO_LOCK, NULL, and printk.

Referenced by intel_me_init().

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

◆ mkhi_hmrfpo_lock_noack()

static int mkhi_hmrfpo_lock_noack ( void  )
static

Definition at line 579 of file me.c.

References BIOS_ERR, BIOS_INFO, mkhi_header::group_id, mei_sendrecv_mkhi(), MKHI_GROUP_ID_HMRFPO, MKHI_HMRFPO_LOCK_NOACK, NULL, and printk.

Referenced by intel_me_init().

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

◆ pci_read_dword_ptr()

static void pci_read_dword_ptr ( struct device dev,
void ptr,
int  offset 
)
inlinestatic

Definition at line 97 of file me.c.

References mei_dump(), memcpy(), offset, and pci_read_config32().

Referenced by intel_me_extend_valid(), intel_me_init(), intel_me_mbp_clear(), intel_me_path(), and intel_me_read_mbp().

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 469 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 125 of file me.c.

References mei_base_address, mei_dump(), MEI_ME_CB_RW, NULL, 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 void read_host_csr ( struct mei_csr csr)
inlinestatic

Definition at line 104 of file me.c.

References MEI_H_CSR, and mei_read_dword_ptr().

Referenced by intel_me_init(), 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 call graph for this function:
Here is the caller graph for this function:

◆ read_me_csr()

static void read_me_csr ( struct mei_csr csr)
inlinestatic

Definition at line 114 of file me.c.

References MEI_ME_CSR_HA, and mei_read_dword_ptr().

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 119 of file me.c.

References mei_base_address, mei_dump(), MEI_H_CB_WW, NULL, 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 ( struct mei_csr csr)
inlinestatic

Definition at line 109 of file me.c.

References MEI_H_CSR, and mei_write_dword_ptr().

Referenced by intel_me_init(), intel_me_mbp_give_up(), intel_me_read_mbp(), intel_mei_setup(), 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:

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:1032
static const unsigned short pci_device_ids[]
Definition: me.c:1042

Definition at line 1042 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,
.final = &intel_me_finalize,
.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:946
static void intel_me_enable(struct device *dev)
Definition: me.c:1023
static void intel_me_finalize(struct device *dev)
Definition: me.c:596

Definition at line 1023 of file me.c.

◆ me_bios_path_values

const char* 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 33 of file me.c.

Referenced by intel_me_init().

◆ mei_base_address

u8* mei_base_address
static

◆ pci_device_ids

const unsigned short pci_device_ids[]
static
Initial value:
= {
0x9c3a,
0x9cba,
0
}

Definition at line 1042 of file me.c.