Tristan Hsieh has uploaded this change for review. ( https://review.coreboot.org/28250
Change subject: google/kukui: Setup GPIOs for ChromeOS.
......................................................................
google/kukui: Setup GPIOs for ChromeOS.
Setup LID GPIO to boot depthchrage. Without this patch,
flag_fetch(FLAG_LIDSW) in depthcharge will fail
BUG=b:80501386
BRANCH=none
TEST=Boots correctly on Kukui
Change-Id: I0ec2c70c189a059219954e0384aaf98995285728
Signed-off-by: Tristan Shieh <tristan.shieh(a)mediatek.com>
---
M src/mainboard/google/kukui/Makefile.inc
M src/mainboard/google/kukui/bootblock.c
M src/mainboard/google/kukui/chromeos.c
A src/mainboard/google/kukui/gpio.h
4 files changed, 42 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/28250/1
diff --git a/src/mainboard/google/kukui/Makefile.inc b/src/mainboard/google/kukui/Makefile.inc
index 290be4c..aa6bf11 100644
--- a/src/mainboard/google/kukui/Makefile.inc
+++ b/src/mainboard/google/kukui/Makefile.inc
@@ -1,4 +1,5 @@
bootblock-y += bootblock.c
+bootblock-y += chromeos.c
bootblock-y += memlayout.ld
decompressor-y += memlayout.ld
diff --git a/src/mainboard/google/kukui/bootblock.c b/src/mainboard/google/kukui/bootblock.c
index d8b5c5a..fa51488 100644
--- a/src/mainboard/google/kukui/bootblock.c
+++ b/src/mainboard/google/kukui/bootblock.c
@@ -18,10 +18,14 @@
#include <soc/gpio.h>
#include <soc/spi.h>
+#include "gpio.h"
+
#define BOOTBLOCK_EN_L (GPIO(KPROW0))
void bootblock_mainboard_init(void)
{
+ setup_chromeos_gpios();
+
/* Turn on real eMMC. */
gpio_output(BOOTBLOCK_EN_L, 1);
diff --git a/src/mainboard/google/kukui/chromeos.c b/src/mainboard/google/kukui/chromeos.c
index 7f9946a..3ed5c1c 100644
--- a/src/mainboard/google/kukui/chromeos.c
+++ b/src/mainboard/google/kukui/chromeos.c
@@ -15,9 +15,21 @@
#include <bootmode.h>
#include <boot/coreboot_tables.h>
+#include <gpio.h>
+
+#include "gpio.h"
+
+void setup_chromeos_gpios(void)
+{
+ gpio_input(LID);
+}
void fill_lb_gpios(struct lb_gpios *gpios)
{
+ struct lb_gpio chromeos_gpios[] = {
+ {LID.id, ACTIVE_HIGH, -1, "lid"},
+ };
+ lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
}
int get_recovery_mode_switch(void)
diff --git a/src/mainboard/google/kukui/gpio.h b/src/mainboard/google/kukui/gpio.h
new file mode 100644
index 0000000..44610f4
--- /dev/null
+++ b/src/mainboard/google/kukui/gpio.h
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MAINBOARD_GOOGLE_KUKUI_GPIO_H__
+#define __MAINBOARD_GOOGLE_KUKUI_GPIO_H__
+
+#include <soc/gpio.h>
+
+#define LID GPIO(CAM_CLK2)
+
+void setup_chromeos_gpios(void);
+
+#endif
--
To view, visit https://review.coreboot.org/28250
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ec2c70c189a059219954e0384aaf98995285728
Gerrit-Change-Number: 28250
Gerrit-PatchSet: 1
Gerrit-Owner: Tristan Hsieh <tristan.shieh(a)mediatek.com>
Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/28249
Change subject: lib/gpio.c: Validate num_gpio
......................................................................
lib/gpio.c: Validate num_gpio
In function _gpio_base3_value(), if num_gpio is 0 it'll cause the return
of an undefined value, as no for loop will be executed. Assert that it's
not 0.
BUG=b:112253891
TEST=Build and boot grunt.
Change-Id: I2b6537900fa41ebbee0171959f3ce236d360bc80
Signed-off-by: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
---
M src/lib/gpio.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/28249/1
diff --git a/src/lib/gpio.c b/src/lib/gpio.c
index 0656dfb..482f62d 100644
--- a/src/lib/gpio.c
+++ b/src/lib/gpio.c
@@ -82,7 +82,7 @@
int index;
int temp;
char value[32];
- assert(num_gpio <= 32);
+ assert((num_gpio <= 32) && (num_gpio > 0));
/* Enable internal pull up */
for (index = 0; index < num_gpio; ++index)
--
To view, visit https://review.coreboot.org/28249
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b6537900fa41ebbee0171959f3ce236d360bc80
Gerrit-Change-Number: 28249
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
Hello build bot (Jenkins), Hannah Williams,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/28235
to look at the new patch set (#3).
Change subject: src/mainboard: Add null pointer check
......................................................................
src/mainboard: Add null pointer check
src/mainboard/google/octopus/mainboard.c
Found-by: klockwork
Function dev_find_slot may return NULL,
check before its usage.
BRANCH=None
TEST=Built & booted Yorp board.
Change-Id: I160adbe3b0a5a2b0f11fd1567513860664d4bee3
Signed-off-by: John Zhao <john.zhao(a)intel.com>
---
M src/mainboard/google/octopus/mainboard.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/28235/3
--
To view, visit https://review.coreboot.org/28235
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I160adbe3b0a5a2b0f11fd1567513860664d4bee3
Gerrit-Change-Number: 28235
Gerrit-PatchSet: 3
Gerrit-Owner: John Zhao <john.zhao(a)intel.com>
Gerrit-Reviewer: Hannah Williams <hannah.williams(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/28247
Change subject: soc/amd/stoneyridge/smihandler.c: Report pending wake event
......................................................................
soc/amd/stoneyridge/smihandler.c: Report pending wake event
There's a small window of opportunity when CPU is already in SMM but has
not yet entered S3 for a wake event to happen, which would cause a failed
S3 entry. Check for pending events at the very last moment possible, and
if there are pending wake events report them.
BUG=b:111100312
TEST=build and boot grunt.
Change-Id: I9472fdf481897fcf9f4c669f6b1514ef479fce7a
Signed-off-by: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
---
M src/soc/amd/stoneyridge/smihandler.c
1 file changed, 29 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/28247/1
diff --git a/src/soc/amd/stoneyridge/smihandler.c b/src/soc/amd/stoneyridge/smihandler.c
index ef24baa..f00ead6 100644
--- a/src/soc/amd/stoneyridge/smihandler.c
+++ b/src/soc/amd/stoneyridge/smihandler.c
@@ -122,7 +122,8 @@
static void sb_slp_typ_handler(void)
{
- uint32_t pm1cnt, pci_ctrl;
+ uint32_t pm1cnt, pci_ctrl, reg32;
+ uint16_t reg16;
uint8_t slp_typ, rst_ctrl;
/* Figure out SLP_TYP */
@@ -171,6 +172,33 @@
rst_ctrl |= SLPTYPE_CONTROL_EN;
pm_write8(PM_RST_CTRL1, rst_ctrl);
+ /*
+ * Before the final command, check if there's pending wake
+ * event. Read enable first, so that reading the actual status
+ * is as close as possible to entering S3. The idea is to
+ * minimize the opportunity for a wake event to happen before
+ * actually entering S3. If there's a pending wake event, log
+ * it and continue normal path. S3 will fail and the wake event
+ * becomes a SCI.
+ */
+ reg16 = inw(ACPI_PM1_EN);
+ reg32 = inl(ACPI_GPE0_EN);
+ if (IS_ENABLED(CONFIG_ELOG_GSMI)) {
+ if ((reg16 & inw(ACPI_PM1_STS)) ||
+ (reg32 & inl(ACPI_GPE0_STS))) {
+ reg16 &= inw(ACPI_PM1_STS);
+ if (reg16)
+ elog_add_error(
+ ELOG_SLEEP_PENDING_PM1_WAKE,
+ (u32)reg16);
+ reg32 &= inl(ACPI_GPE0_STS);
+ if (reg32)
+ elog_add_error(
+ ELOG_SLEEP_PENDING_GPE0_WAKE,
+ reg32);
+ }
+ } /* if (IS_ENABLED(CONFIG_ELOG_GSMI)) */
+
/* Reissue Pm1 write */
outl(pm1cnt | SLP_EN, pm_acpi_pm_cnt_blk());
hlt();
--
To view, visit https://review.coreboot.org/28247
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9472fdf481897fcf9f4c669f6b1514ef479fce7a
Gerrit-Change-Number: 28247
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
Hello Hannah Williams, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/28235
to look at the new patch set (#2).
Change subject: src/mainboard: Fix issues found by klockwork
......................................................................
src/mainboard: Fix issues found by klockwork
src/mainboard/google/octopus/mainboard.c
Function wifi_device_update: Check for NULL
before using pointer.
BRANCH=None
TEST=Built & booted Yorp board.
Change-Id: I160adbe3b0a5a2b0f11fd1567513860664d4bee3
Signed-off-by: John Zhao <john.zhao(a)intel.com>
---
M src/mainboard/google/octopus/mainboard.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/28235/2
--
To view, visit https://review.coreboot.org/28235
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I160adbe3b0a5a2b0f11fd1567513860664d4bee3
Gerrit-Change-Number: 28235
Gerrit-PatchSet: 2
Gerrit-Owner: John Zhao <john.zhao(a)intel.com>
Gerrit-Reviewer: Hannah Williams <hannah.williams(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
John Zhao has uploaded this change for review. ( https://review.coreboot.org/28235
Change subject: src/mainboard: Fix issues found by klockwork
......................................................................
src/mainboard: Fix issues found by klockwork
src/mainboard/google/octopus/mainboard.c
Function wifi_device_update: Pointer dev returned from
call dev_find_slot may be NULL and will be dereferenced.
BRANCH=None
TEST=Built & booted Yorp board.
Change-Id: I160adbe3b0a5a2b0f11fd1567513860664d4bee3
Signed-off-by: John Zhao <john.zhao(a)intel.com>
---
M src/mainboard/google/octopus/mainboard.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/28235/1
diff --git a/src/mainboard/google/octopus/mainboard.c b/src/mainboard/google/octopus/mainboard.c
index 61d254e..6effa7c 100644
--- a/src/mainboard/google/octopus/mainboard.c
+++ b/src/mainboard/google/octopus/mainboard.c
@@ -169,7 +169,8 @@
devfn = PCH_DEVFN_PCIE1;
dev = dev_find_slot(0, devfn);
- dev->enabled = 0;
+ if (dev)
+ dev->enabled = 0;
}
void mainboard_devtree_update(struct device *dev)
--
To view, visit https://review.coreboot.org/28235
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I160adbe3b0a5a2b0f11fd1567513860664d4bee3
Gerrit-Change-Number: 28235
Gerrit-PatchSet: 1
Gerrit-Owner: John Zhao <john.zhao(a)intel.com>