coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ec.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <acpi/acpi.h>
4 #include <console/console.h>
6 #include <amdblocks/lpc.h>
7 #include <soc/southbridge.h>
8 #include <variant/ec.h>
9 
10 static void ramstage_ec_init(void)
11 {
12  const struct google_chromeec_event_info info = {
13  .log_events = MAINBOARD_EC_LOG_EVENTS,
14  .sci_events = MAINBOARD_EC_SCI_EVENTS,
15  .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS,
16  .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS,
17  };
18 
19  printk(BIOS_DEBUG, "mainboard: EC init\n");
20 
22 }
23 
24 static void early_ec_init(void)
25 {
26  uint16_t ec_ioport_base;
27  size_t ec_ioport_size;
28  int status;
29 
30  /*
31  * Set up LPC decoding for the ChromeEC I/O port ranges:
32  * - Ports 62/66, 60/64, and 200->208
33  * -- set by hudson_lpc_decode() in pre
34  * - ChromeEC specific communication I/O ports.
35  */
36  google_chromeec_ioport_range(&ec_ioport_base, &ec_ioport_size);
38  "LPC Setup google_chromeec_ioport_range: %04x, %08zx\n",
39  ec_ioport_base, ec_ioport_size);
40  status = lpc_set_wideio_range(ec_ioport_base, ec_ioport_size);
41  if (status == WIDEIO_RANGE_ERROR)
42  printk(BIOS_ERR, "Failed to assign a range\n");
43  else
44  printk(BIOS_DEBUG, "Range assigned to wide IO %d\n", status);
45 }
46 
48 {
49  if (ENV_RAMSTAGE)
51  else
52  early_ec_init();
53 }
static int acpi_is_wakeup_s3(void)
Definition: acpi.h:9
#define printk(level,...)
Definition: stdlib.h:16
static struct smmstore_params_info info
Definition: ramstage.c:12
void google_chromeec_events_init(const struct google_chromeec_event_info *info, bool is_s3_wakeup)
Definition: ec.c:410
void google_chromeec_ioport_range(uint16_t *base, size_t *size)
Definition: ec_lpc.c:364
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
void mainboard_ec_init(void)
Definition: ec.c:8
#define MAINBOARD_EC_S5_WAKE_EVENTS
Definition: ec.h:32
#define MAINBOARD_EC_SCI_EVENTS
Definition: ec.h:12
#define MAINBOARD_EC_LOG_EVENTS
Definition: ec.h:42
#define MAINBOARD_EC_S3_WAKE_EVENTS
Definition: ec.h:37
static void ramstage_ec_init(void)
Definition: ec.c:10
static void early_ec_init(void)
Definition: ec.c:24
#define ENV_RAMSTAGE
Definition: rules.h:150
#define WIDEIO_RANGE_ERROR
Definition: lpc.h:70
int lpc_set_wideio_range(uint16_t start, uint16_t size)
Program a LPC wide IO to support an IO range.
Definition: lpc_util.c:109
unsigned short uint16_t
Definition: stdint.h:11