28 #include <vendorcode/google/chromeos/chromeos.h>
47 if (!
CONFIG(DEBUG_INTEL_ME))
153 unsigned int ndata, n;
192 for (n = 0; n < ndata; ++n)
205 void *req_data,
int req_bytes)
208 .client_address = me_address,
213 u8 *req_ptr = req_data;
215 while (!
header.is_complete) {
216 int remain = req_bytes - current;
222 if (buf_len > remain) {
224 header.length = req_bytes - current;
241 void *
header,
int header_len,
int complete)
246 .length = header_len,
247 .is_complete = complete,
253 void *rsp_data,
int rsp_bytes)
257 unsigned int ndata, n;
258 unsigned int expected;
262 expected = (rsp_bytes +
sizeof(mei_rsp) + header_bytes) >> 2;
282 "%u, available %u\n", expected,
295 ndata = mei_rsp.
length >> 2;
298 if (ndata != (expected - 1)) {
300 ndata, (expected - 1));
306 for (n = 0; n < (header_bytes >> 2); ++n)
308 ndata -= header_bytes >> 2;
311 if (ndata != (rsp_bytes >> 2)) {
313 "%u != %u\n", ndata, rsp_bytes >> 2);
319 for (n = 0; n < ndata; ++n)
332 void *req_data,
int req_bytes,
333 void *rsp_data,
int rsp_bytes)
339 mkhi,
sizeof(*mkhi), req_bytes ? 0 : 1) < 0)
344 req_data, req_bytes) < 0)
353 rsp_data, rsp_bytes) < 0)
360 "command %u ?= %u, is_response %u\n", mkhi->
group_id,
370 void *req_data,
int req_bytes,
371 void *rsp_data,
int rsp_bytes)
377 icc,
sizeof(*icc), req_bytes ? 0 : 1) < 0)
382 req_data, req_bytes) < 0)
386 if (rsp_bytes &&
mei_recv_msg(&icc_rsp,
sizeof(icc_rsp),
387 rsp_data, rsp_bytes) < 0)
464 &cap_msg,
sizeof(cap_msg)) < 0) {
493 print_cap(
"Outbreak Containment Heuristic (OCH)", cap->
och);
515 printk(
BIOS_INFO,
"ME: END OF POST message successful (%d)\n", eop_ack);
564 .length =
sizeof(clk),
635 &data,
sizeof(data));
649 if (!res || res->
base == 0 || res->
size == 0) {
700 for (i = 0; i <
count; ++i) {
708 chromeos_set_me_hash(extend,
count);
748 if (!me2host_pending) {
756 if ((mbp_hdr.num_entries > (mbp_hdr.mbp_size / 2)) ||
757 (me2host_pending < mbp_hdr.mbp_size)) {
759 " buffer contains %d words\n",
760 mbp_hdr.num_entries, mbp_hdr.mbp_size,
764 mbp =
malloc(mbp_hdr.mbp_size *
sizeof(
u32));
772 while (i != me2host_pending) {
783 if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >=
BIOS_DEBUG) {
786 if (
CONFIG(DEBUG_INTEL_ME)) {
787 for (i = 0; i < mbp->
header.mbp_size - 1; i++) {
793 #define ASSIGN_FIELD_PTR(field_,val_) \
795 mbp_data->field_ = (typeof(mbp_data->field_))(void *)val_; \
799 for (i = 0; i < mbp->
header.mbp_size - 1;) {
835 "dw offset 0x%x\n", mbp->
data[i], i);
840 #undef ASSIGN_FIELD_PTR
864 memset(&mbp_data, 0,
sizeof(mbp_data));
878 if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >=
BIOS_DEBUG) {
881 if (
CONFIG(DEBUG_INTEL_ME))
928 static const struct pci_driver intel_me
__pci_driver = {
struct arm64_kernel_header header
static int acpi_is_wakeup_s3(void)
static void write32(void *addr, uint32_t val)
static uint32_t read32(const void *addr)
void * memset(void *dstpp, int c, size_t len)
#define ELOG_TYPE_MANAGEMENT_ENGINE
#define ELOG_TYPE_MANAGEMENT_ENGINE_EXT
#define printk(level,...)
struct resource * probe_resource(const struct device *dev, unsigned int index)
See if a resource structure already exists for a given index.
int elog_add_event_raw(u8 event_type, void *data, u8 data_size)
int elog_add_event_byte(u8 event_type, u8 data)
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
static __always_inline void pci_and_config16(const struct device *dev, u16 reg, u16 andmask)
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
void * malloc(size_t size)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_CRIT
BIOS_CRIT - Recovery unlikely.
#define BIOS_NOTICE
BIOS_NOTICE - Unexpected but relatively insignificant.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
#define PCI_BASE_ADDRESS_MEM_ATTR_MASK
#define PCI_COMMAND_MASTER
#define PCI_COMMAND_MEMORY
#define PCI_BASE_ADDRESS_0
void pci_dev_enable_resources(struct device *dev)
void pci_dev_read_resources(struct device *dev)
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
void pci_dev_set_resources(struct device *dev)
#define PCI_DID_INTEL_LPT_LP_MEI
#define PCI_DID_INTEL_LPT_H_MEI
static void * res2mmio(const struct resource *res, unsigned long offset, unsigned long mask)
#define ICC_API_VERSION_LYNXPOINT
#define ME_HFS_MODE_NORMAL
#define MKHI_GROUP_ID_FWCAPS
#define ME_HFS_MODE_OVER_MEI
#define ME_HFS_CWS_NORMAL
#define MBP_IDENT(appid, item)
#define PCI_ME_EXT_SHA256
#define PCI_ME_MBP_GIVE_UP
#define ME_HFS_MODE_OVER_JMPR
#define MKHI_GROUP_ID_GEN
@ ME_FIRMWARE_UPDATE_BIOS_PATH
#define MKHI_FWCAPS_GET_RULE
#define ME_HFS_MODE_DEBUG
#define ICC_SET_CLOCK_ENABLES
#define MBP_MAKE_IDENT(appid, item)
void pch_disable_devfn(struct device *dev)
void intel_me_status(void)
static u32 me_to_host_words_pending(void)
static struct device_operations device_ops
static int me_icc_set_clock_enables(u32 mask)
static const struct pci_driver intel_me __pci_driver
#define ASSIGN_FIELD_PTR(field_, val_)
static int intel_me_read_mbp(struct me_bios_payload *mbp_data, struct device *dev)
static enum me_bios_path intel_me_path(struct device *dev)
static int mei_wait_for_me_ready(void)
static void print_cap(const char *name, int state)
static void write_cb(u32 dword)
static void intel_me_init(struct device *dev)
static int intel_mei_setup(struct device *dev)
static void mei_dump(u32 dword, int offset, const char *type)
static int mei_sendrecv_icc(struct icc_header *icc, void *req_data, int req_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 union mei_csr read_me_csr(void)
static u8 * mei_base_address
static void write_host_csr(union mei_csr csr)
static int intel_me_extend_valid(struct device *dev)
static void me_print_fw_version(struct mbp_fw_version_name *vers_name)
static const unsigned short pci_device_ids[]
static void intel_me_enable(struct device *dev)
static void mei_reset(void)
void intel_me_finalize(struct device *dev)
static int mei_send_packet(union mei_header *mei, void *req_data)
static union mei_csr read_host_csr(void)
static int mkhi_end_of_post(void)
static void me_print_fwcaps(struct mbp_mefwcaps *cap)
static const char *const me_bios_path_values[]
static int mei_recv_msg(void *header, int header_bytes, void *rsp_data, int rsp_bytes)
static int mkhi_get_fwcaps(struct mbp_mefwcaps *cap)
static int mei_send_data(u8 me_address, u8 host_address, void *req_data, int req_bytes)
static void intel_me_mbp_clear(struct device *dev)
static int mei_send_header(u8 me_address, u8 host_address, void *header, int header_len, int complete)
static void intel_me_mbp_give_up(struct device *dev)
void(* read_resources)(struct device *dev)
DEVTREE_CONST void * chip_info
uint8_t current_working_state
u32 pltrst_cpurst_time_ms
u32 wake_event_mrst_time_ms
mbp_mefwcaps * fw_capabilities
mbp_plat_time * plat_time
mbp_fw_version_name * fw_version_name
u32 extend_feature_present
typedef void(X86APIP X86EMU_intrFuncs)(int num)