Make acpi/ec.c usable in romstage

On X201 to enable EHCI debug you need to go through EC if USB power is
disabled so we need to inclue ec.c.

Change-Id: I8f8b7de639ecaebceaa53cd338136befaeec8214
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/3405
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Vladimir Serbinenko 2013-06-07 01:55:57 +02:00 committed by Ronald G. Minnich
parent 7d1ebbff5a
commit fe50d0bcfe
2 changed files with 14 additions and 0 deletions

View File

@ -1,2 +1,3 @@
ramstage-y += ec.c
smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
romstage-$(CONFIG_BOARD_LENOVO_X201) += ec.c

View File

@ -25,9 +25,18 @@
#include <delay.h>
#include "ec.h"
#ifdef __PRE_RAM__
static const int ec_cmd_reg = EC_SC;
static const int ec_data_reg = EC_DATA;
#else
static int ec_cmd_reg = EC_SC;
static int ec_data_reg = EC_DATA;
#endif
int send_ec_command(u8 command)
{
int timeout;
@ -132,12 +141,16 @@ void ec_clr_bit(u8 addr, u8 bit)
ec_write(addr, ec_read(addr) & ~(1 << bit));
}
#ifndef __PRE_RAM__
void ec_set_ports(u16 cmd_reg, u16 data_reg)
{
ec_cmd_reg = cmd_reg;
ec_data_reg = data_reg;
}
#endif
#if !defined(__SMM__) && !defined(__PRE_RAM__)
struct chip_operations ec_acpi_ops = {
CHIP_NAME("ACPI Embedded Controller")