drivers/ipmi: add code to set BMC/IPMI enablement from jumper
Some boards, like the Supermicro X11SSM-F, have a jumper for enabling or disabling the BMC and IPMI. Add a new devicetree driver option to set the GPIO used for the jumper and enable or disable IPMI according to its value. This gets used in a follow-up change by Supermicro X11SSM-F. Test: Boot with jumper set to each enabled and disabled and check debug log if IPMI gets enabled/disabled accordingly. Successfully tested on Supermicro X11SSM-F with CB:48095. Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Tested-by: Michael Niewöhner <foss@mniewoehner.de> Change-Id: Icde3232843a7138797a4b106560f170972edeb9c Reviewed-on: https://review.coreboot.org/c/coreboot/+/48094 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
8913b783b9
commit
31830d3c2c
|
@ -1,8 +1,12 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <device/device.h>
|
||||||
|
|
||||||
#ifndef _IMPI_CHIP_H_
|
#ifndef _IMPI_CHIP_H_
|
||||||
#define _IPMI_CHIP_H_
|
#define _IPMI_CHIP_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
struct drivers_ipmi_config {
|
struct drivers_ipmi_config {
|
||||||
u8 bmc_i2c_address;
|
u8 bmc_i2c_address;
|
||||||
u8 have_nv_storage;
|
u8 have_nv_storage;
|
||||||
|
@ -11,6 +15,13 @@ struct drivers_ipmi_config {
|
||||||
u8 gpe_interrupt;
|
u8 gpe_interrupt;
|
||||||
u8 have_apic;
|
u8 have_apic;
|
||||||
u32 apic_interrupt;
|
u32 apic_interrupt;
|
||||||
|
/* Device to use for GPIO operations */
|
||||||
|
DEVTREE_CONST struct device *gpio_dev;
|
||||||
|
/*
|
||||||
|
* Jumper GPIO for enabling / disabling BMC/IPMI
|
||||||
|
* If present, the jumper overrides the devicetree.
|
||||||
|
*/
|
||||||
|
u32 bmc_jumper_gpio;
|
||||||
/*
|
/*
|
||||||
* Wait for BMC to boot.
|
* Wait for BMC to boot.
|
||||||
* This can be used if the BMC takes a long time to boot after PoR:
|
* This can be used if the BMC takes a long time to boot after PoR:
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
|
#include <device/gpio.h>
|
||||||
#include <device/pnp.h>
|
#include <device/pnp.h>
|
||||||
#if CONFIG(HAVE_ACPI_TABLES)
|
#if CONFIG(HAVE_ACPI_TABLES)
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
@ -78,19 +79,32 @@ static void ipmi_kcs_init(struct device *dev)
|
||||||
struct ipmi_devid_rsp rsp;
|
struct ipmi_devid_rsp rsp;
|
||||||
uint32_t man_id = 0, prod_id = 0;
|
uint32_t man_id = 0, prod_id = 0;
|
||||||
struct drivers_ipmi_config *conf = dev->chip_info;
|
struct drivers_ipmi_config *conf = dev->chip_info;
|
||||||
|
const struct gpio_operations *gpio_ops;
|
||||||
struct ipmi_selftest_rsp selftestrsp = {0};
|
struct ipmi_selftest_rsp selftestrsp = {0};
|
||||||
uint8_t retry_count;
|
uint8_t retry_count;
|
||||||
|
|
||||||
if (!dev->enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "IPMI: PNP KCS 0x%x\n", dev->path.pnp.port);
|
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
printk(BIOS_WARNING, "IPMI: chip_info is missing! Skip init.\n");
|
printk(BIOS_WARNING, "IPMI: chip_info is missing! Skip init.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conf->bmc_jumper_gpio) {
|
||||||
|
gpio_ops = dev_get_gpio_ops(conf->gpio_dev);
|
||||||
|
if (!gpio_ops) {
|
||||||
|
printk(BIOS_WARNING, "IPMI: gpio device is missing gpio ops!\n");
|
||||||
|
} else {
|
||||||
|
/* Get jumper value and set device state accordingly */
|
||||||
|
dev->enabled = gpio_ops->get(conf->bmc_jumper_gpio);
|
||||||
|
if (!dev->enabled)
|
||||||
|
printk(BIOS_INFO, "IPMI: Disabled by jumper\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dev->enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printk(BIOS_DEBUG, "IPMI: PNP KCS 0x%x\n", dev->path.pnp.port);
|
||||||
|
|
||||||
/* Get IPMI version for ACPI and SMBIOS */
|
/* Get IPMI version for ACPI and SMBIOS */
|
||||||
if (conf->wait_for_bmc && conf->bmc_boot_timeout) {
|
if (conf->wait_for_bmc && conf->bmc_boot_timeout) {
|
||||||
struct stopwatch sw;
|
struct stopwatch sw;
|
||||||
|
|
Loading…
Reference in New Issue