summaryrefslogtreecommitdiff
path: root/src/drivers/ipmi
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/ipmi')
-rw-r--r--src/drivers/ipmi/chip.h3
-rw-r--r--src/drivers/ipmi/ipmi_kcs_ops.c30
2 files changed, 33 insertions, 0 deletions
diff --git a/src/drivers/ipmi/chip.h b/src/drivers/ipmi/chip.h
index 11bef9b02f..fb5d4d921f 100644
--- a/src/drivers/ipmi/chip.h
+++ b/src/drivers/ipmi/chip.h
@@ -22,6 +22,9 @@ struct drivers_ipmi_config {
* If present, the jumper overrides the devicetree.
*/
u32 bmc_jumper_gpio;
+ /* "POST complete" GPIO and polarity */
+ u32 post_complete_gpio;
+ bool post_complete_invert;
/*
* Wait for BMC to boot.
* This can be used if the BMC takes a long time to boot after PoR:
diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c
index f261934c96..9d1cac8715 100644
--- a/src/drivers/ipmi/ipmi_kcs_ops.c
+++ b/src/drivers/ipmi/ipmi_kcs_ops.c
@@ -9,6 +9,7 @@
*/
#include <arch/io.h>
+#include <bootstate.h>
#include <console/console.h>
#include <device/device.h>
#include <device/gpio.h>
@@ -34,6 +35,8 @@ static u8 ipmi_revision_minor = 0x0;
static u8 bmc_revision_major = 0x0;
static u8 bmc_revision_minor = 0x0;
+static struct boot_state_callback bscb_post_complete;
+
static int ipmi_get_device_id(struct device *dev, struct ipmi_devid_rsp *rsp)
{
int ret;
@@ -74,6 +77,26 @@ static int ipmi_get_bmc_self_test_result(struct device *dev, struct ipmi_selftes
return 0;
}
+static void bmc_set_post_complete_gpio_callback(void *arg)
+{
+ struct drivers_ipmi_config *conf = arg;
+ const struct gpio_operations *gpio_ops;
+
+ if (!conf || !conf->post_complete_gpio)
+ return;
+
+ gpio_ops = dev_get_gpio_ops(conf->gpio_dev);
+ if (!gpio_ops) {
+ printk(BIOS_WARNING, "IPMI: specified gpio device is missing gpio ops!\n");
+ return;
+ }
+
+ /* Set POST Complete pin. The `invert` field controls the polarity. */
+ gpio_ops->output(conf->post_complete_gpio, conf->post_complete_invert ^ 1);
+
+ printk(BIOS_DEBUG, "BMC: POST complete gpio set\n");
+}
+
static void ipmi_kcs_init(struct device *dev)
{
struct ipmi_devid_rsp rsp;
@@ -105,6 +128,13 @@ static void ipmi_kcs_init(struct device *dev)
printk(BIOS_DEBUG, "IPMI: PNP KCS 0x%x\n", dev->path.pnp.port);
+ /* Set up boot state callback for POST_COMPLETE# */
+ if (conf->post_complete_gpio) {
+ bscb_post_complete.callback = bmc_set_post_complete_gpio_callback;
+ bscb_post_complete.arg = conf;
+ boot_state_sched_on_entry(&bscb_post_complete, BS_PAYLOAD_BOOT);
+ }
+
/* Get IPMI version for ACPI and SMBIOS */
if (conf->wait_for_bmc && conf->bmc_boot_timeout) {
struct stopwatch sw;