Expose get_lid_switch() in romstage

The function was used locally and in ramstage to set some
coreboot tables. It's also needed in romstage to deal with
"lid closed" behaviour.

BRANCH=none
BUG=chromium:446945
TEST=none

Change-Id: I8ad7061328c45803699321aa9f5edb0ed2288a8d
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 78281a104fb9d79696a6ceb2a9a89a391146a424
Original-Change-Id: I56314b9dc9062dd61671982e7ec0ff15d7eb1bae
Original-Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/273609
Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Original-Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/10691
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2015-05-28 11:59:33 +02:00
parent f7a5b56297
commit 08b8785aeb
9 changed files with 78 additions and 77 deletions

View File

@ -27,6 +27,7 @@ int get_developer_mode_switch(void);
int get_recovery_mode_switch(void); int get_recovery_mode_switch(void);
int clear_recovery_mode_switch(void); int clear_recovery_mode_switch(void);
int get_wipeout_mode_switch(void); int get_wipeout_mode_switch(void);
int get_lid_switch(void);
int gfx_get_init_done(void); int gfx_get_init_done(void);

View File

@ -35,13 +35,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
}
/*static void fill_lb_gpio(struct lb_gpio *gpio, int num, /*static void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int force) int polarity, const char *name, int force)
{ {
@ -75,6 +68,13 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
}
/* The dev-switch is virtual */ /* The dev-switch is virtual */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {

View File

@ -37,17 +37,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;
@ -68,6 +57,17 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
/* The dev-switch is virtual */ /* The dev-switch is virtual */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {

View File

@ -34,17 +34,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;
@ -65,6 +54,17 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
/* The dev-switch is virtual */ /* The dev-switch is virtual */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {

View File

@ -31,13 +31,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
device_t dev = dev_find_slot(0, PCI_DEVFN(0x1f,0)); device_t dev = dev_find_slot(0, PCI_DEVFN(0x1f,0));
@ -91,6 +84,13 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
}
/* The dev-switch is virtual on Link (and so handled elsewhere). */ /* The dev-switch is virtual on Link (and so handled elsewhere). */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {

View File

@ -34,17 +34,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;
@ -65,6 +54,17 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
/* The dev-switch is virtual */ /* The dev-switch is virtual */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {

View File

@ -37,18 +37,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
/* Default to force open. */
return 1;
#endif
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;
@ -69,6 +57,18 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
/* Default to force open. */
return 1;
#endif
}
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {
return 0; return 0;

View File

@ -37,13 +37,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;
@ -64,6 +57,13 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
}
/* The dev-switch is virtual */ /* The dev-switch is virtual */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {

View File

@ -34,17 +34,6 @@
#define GPIO_COUNT 6 #define GPIO_COUNT 6
static int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;
@ -65,6 +54,17 @@ void fill_lb_gpios(struct lb_gpios *gpios)
} }
#endif #endif
int get_lid_switch(void)
{
#if CONFIG_EC_GOOGLE_CHROMEEC
u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
return !!(ec_switches & EC_SWITCH_LID_OPEN);
#else
return 0;
#endif
}
/* The dev-switch is virtual */ /* The dev-switch is virtual */
int get_developer_mode_switch(void) int get_developer_mode_switch(void)
{ {