diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2015-07-27 23:18:15 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-07-29 19:25:43 +0200 |
commit | 556538af85fc1d6387e8af86fae67e26b0524d63 (patch) | |
tree | 7f95ca320e11a798f074a8c368215f649d3fc652 /src/mainboard | |
parent | c3f72751f8c692f9c763aadf22409937c938f426 (diff) |
google/stout: Implement functions required by CHROMEOS
BRANCH=none
BUG=chromium:513990
TEST=google/stout builds
Change-Id: I00de7524297e4471a9f7d6afd0d2b991d29020e9
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: b85c54af7d4def45f014ee1d9b79df0b649f90f7
Original-Change-Id: I0870dd11c97cecc932a135f73be8234a88c0622b
Original-Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/288860
Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Original-Commit-Queue: Stefan Reinauer <reinauer@chromium.org>
Reviewed-on: http://review.coreboot.org/11064
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/google/stout/chromeos.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/mainboard/google/stout/chromeos.c b/src/mainboard/google/stout/chromeos.c index 824cb8f8a8..b2ca6a7673 100644 --- a/src/mainboard/google/stout/chromeos.c +++ b/src/mainboard/google/stout/chromeos.c @@ -35,21 +35,13 @@ void fill_lb_gpios(struct lb_gpios *gpios) { - device_t dev = dev_find_slot(0, PCI_DEVFN(0x1f,0)); - u16 gpio_base = pci_read_config32(dev, GPIOBASE) & 0xfffe; - - if (!gpio_base) - return; - - u32 gp_lvl = inl(gpio_base + GP_LVL); - gpios->size = sizeof(*gpios) + (GPIO_COUNT * sizeof(struct lb_gpio)); gpios->count = GPIO_COUNT; /* Write Protect: GPIO7 */ gpios->gpios[0].port = 7; gpios->gpios[0].polarity = ACTIVE_LOW; - gpios->gpios[0].value = (gp_lvl >> 7) & 1; + gpios->gpios[0].value = !get_write_protect_state(); strncpy((char *)gpios->gpios[0].name,"write protect", GPIO_MAX_NAME_LENGTH); @@ -68,7 +60,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Lid Switch: Virtual switch */ gpios->gpios[3].port = -1; gpios->gpios[3].polarity = ACTIVE_HIGH; - gpios->gpios[3].value = 1; /* Hard-code to open */ + gpios->gpios[3].value = get_lid_switch(); strncpy((char *)gpios->gpios[3].name,"lid", GPIO_MAX_NAME_LENGTH); /* Power Button: Virtual switch */ @@ -91,6 +83,30 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif +int get_write_protect_state(void) +{ + device_t dev; +#ifdef __PRE_RAM__ + dev = PCI_DEV(0, 0x1f, 0); +#else + dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0)); +#endif + u16 gpio_base = pci_read_config32(dev, GPIOBASE) & 0xfffe; + + if (!gpio_base) + return 0; + + u32 gp_lvl = inl(gpio_base + GP_LVL); + + return !((gp_lvl >> 7) & 1); +} + +int get_lid_switch(void) +{ + /* hard-code to open */ + return 1; +} + /* The dev-switch is virtual on Stout (and so handled elsewhere). */ int get_developer_mode_switch(void) { |