![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <arch/io.h>
#include <console/console.h>
#include <delay.h>
#include <ec/google/common/mec.h>
#include <string.h>
#include <timer.h>
#include <types.h>
#include "ec.h"
Go to the source code of this file.
Data Structures | |
struct | wilco_ec_request |
struct | wilco_ec_response |
struct | wilco_ec_message |
Macros | |
#define | EC_MAILBOX_ID 0x00f0 |
#define | EC_MAILBOX_VERSION 0 |
#define | EC_MAILBOX_START_COMMAND 0xda |
#define | EC_MAILBOX_PROTO_VERSION 3 |
#define | EC_MAILBOX_DATA_SIZE 32 |
#define | EC_MAILBOX_DATA_EXTRA 2 |
#define | EC_MAILBOX_TIMEOUT_MS MSECS_PER_SEC |
#define | EC_CMDR_DATA BIT(0) /* Data ready for host to read */ |
#define | EC_CMDR_PENDING BIT(1) /* Write pending to EC */ |
#define | EC_CMDR_BUSY BIT(2) /* EC is busy processing a command */ |
#define | EC_CMDR_CMD BIT(3) /* Last host write was a command */ |
Functions | |
static bool | wilco_ec_response_timed_out (void) |
static uint8_t | wilco_ec_checksum (void *data, size_t size) |
static void | wilco_ec_prepare (struct wilco_ec_message *msg, struct wilco_ec_request *rq) |
static int | wilco_ec_transfer (struct wilco_ec_message *msg) |
int | wilco_ec_mailbox (enum wilco_ec_msg_type type, uint8_t command, const void *request_data, size_t request_size, void *response_data, size_t response_size) |
wilco_ec_mailbox More... | |
Variables | |
struct wilco_ec_request | __packed |
#define EC_CMDR_BUSY BIT(2) /* EC is busy processing a command */ |
#define EC_CMDR_CMD BIT(3) /* Last host write was a command */ |
#define EC_CMDR_DATA BIT(0) /* Data ready for host to read */ |
#define EC_MAILBOX_TIMEOUT_MS MSECS_PER_SEC |
Definition at line 93 of file mailbox.c.
References checksum().
Referenced by wilco_ec_prepare().
int wilco_ec_mailbox | ( | enum wilco_ec_msg_type | type, |
uint8_t | command, | ||
const void * | request_data, | ||
size_t | request_size, | ||
void * | response_data, | ||
size_t | response_size | ||
) |
wilco_ec_mailbox
Send a command request to the EC mailbox and receive the response.
@type: Mailbox message type, see enum above @command: Command to execute @request_data: Request data buffer @request_size: Number of bytes in request data buffer (max 32) @response_data: Response data buffer @response_size: Number of bytes in response data buffer (max 32)
Definition at line 195 of file mailbox.c.
References BIOS_ERR, wilco_ec_message::command, wilco_ec_message::data, EC_MAILBOX_DATA_SIZE, memcpy(), printk, wilco_ec_message::request_size, wilco_ec_message::response_size, wilco_ec_message::result, type, and wilco_ec_transfer().
Referenced by die_notify(), wilco_ec_change_wake(), wilco_ec_get_board_id(), wilco_ec_power_off(), wilco_ec_radio_control(), wilco_ec_send(), wilco_ec_send_noargs(), wilco_ec_sendrecv(), wilco_ec_sendrecv_noargs(), wilco_ec_set_cpuid(), and wilco_ec_slp_en().
|
static |
Definition at line 105 of file mailbox.c.
References wilco_ec_request::checksum, wilco_ec_request::command, wilco_ec_message::command, wilco_ec_message::data, wilco_ec_request::data_size, EC_MAILBOX_DATA_EXTRA, EC_MAILBOX_ID, EC_MAILBOX_PROTO_VERSION, EC_MAILBOX_VERSION, wilco_ec_request::mailbox_id, wilco_ec_request::mailbox_version, memset(), wilco_ec_message::request_size, wilco_ec_request::struct_version, and wilco_ec_checksum().
Referenced by wilco_ec_transfer().
Definition at line 75 of file mailbox.c.
References BIOS_ERR, EC_CMDR_BUSY, EC_CMDR_PENDING, EC_MAILBOX_TIMEOUT_MS, inb(), mask, mdelay(), printk, stopwatch_expired(), and stopwatch_init_msecs_expire().
Referenced by wilco_ec_transfer().
|
static |
Definition at line 123 of file mailbox.c.
References BIOS_DEBUG, BIOS_ERR, checksum(), wilco_ec_response::data, wilco_ec_message::data, wilco_ec_response::data_size, EC_MAILBOX_DATA_SIZE, EC_MAILBOX_START_COMMAND, inb(), mec_io_bytes(), MEC_IO_READ, MEC_IO_WRITE, memcpy(), outb(), printk, wilco_ec_message::request_size, wilco_ec_message::response_size, wilco_ec_response::result, wilco_ec_message::result, wilco_ec_message::type, WILCO_EC_MSG_DEFAULT, WILCO_EC_MSG_NO_RESPONSE, wilco_ec_prepare(), and wilco_ec_response_timed_out().
Referenced by wilco_ec_mailbox().
struct wilco_ec_response __packed |