diff options
author | Tim Chu <Tim.Chu@quantatw.com> | 2020-07-28 04:27:35 -0700 |
---|---|---|
committer | Angel Pons <th3fanbus@gmail.com> | 2020-07-31 09:31:16 +0000 |
commit | 1343bc394bb265157b2ea2d02c69cf136139a4b5 (patch) | |
tree | 8831cda608a2a8d444264c19b0f585d778154f70 /src | |
parent | 92bcc4f792ede73b55c95dc461491a126d215e23 (diff) |
drivers/ipmi/ocp: Add function to support OCP specific ipmi command
Add driver for OCP specific ipmi commands. With this driver, OCP
specific ipmi command can be used after implementing functions here.
TEST=Build with CB:42242 on Delta Lake, select Kconfig option:
IPMI_OCP and add device in devicetree to open this function.
Use ipmi-util in OpenBMC to dump raw data and check if this
function work.
Signed-off-by: Tim Chu <Tim.Chu@quantatw.com>
Change-Id: I2efa85978ec4ad3d75f2bd93b4139ef8059127ed
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43996
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/ipmi/ocp/Kconfig | 5 | ||||
-rw-r--r-- | src/drivers/ipmi/ocp/Makefile.inc | 1 | ||||
-rw-r--r-- | src/drivers/ipmi/ocp/ipmi_ocp.c | 70 | ||||
-rw-r--r-- | src/drivers/ipmi/ocp/ipmi_ocp.h | 6 | ||||
-rw-r--r-- | src/mainboard/ocp/deltalake/Kconfig | 1 | ||||
-rw-r--r-- | src/mainboard/ocp/deltalake/devicetree.cb | 3 |
6 files changed, 86 insertions, 0 deletions
diff --git a/src/drivers/ipmi/ocp/Kconfig b/src/drivers/ipmi/ocp/Kconfig new file mode 100644 index 0000000000..7899e69588 --- /dev/null +++ b/src/drivers/ipmi/ocp/Kconfig @@ -0,0 +1,5 @@ +config IPMI_OCP + bool + default n + help + This implements OCP specific IPMI command diff --git a/src/drivers/ipmi/ocp/Makefile.inc b/src/drivers/ipmi/ocp/Makefile.inc new file mode 100644 index 0000000000..8291f82677 --- /dev/null +++ b/src/drivers/ipmi/ocp/Makefile.inc @@ -0,0 +1 @@ +ramstage-$(CONFIG_IPMI_OCP) += ipmi_ocp.c diff --git a/src/drivers/ipmi/ocp/ipmi_ocp.c b/src/drivers/ipmi/ocp/ipmi_ocp.c new file mode 100644 index 0000000000..1866708f10 --- /dev/null +++ b/src/drivers/ipmi/ocp/ipmi_ocp.c @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Place in devicetree.cb: + * + * chip drivers/ipmi/ocp # OCP specific IPMI porting + device pnp ca2.1 on end + * end + */ + +#include <console/console.h> +#include <device/device.h> +#include <device/pnp.h> +#include "chip.h" +#include "drivers/ipmi/ipmi_kcs.h" +#include "ipmi_ocp.h" + +static void ipmi_ocp_init(struct device *dev) +{ + /* Add OCP specific IPMI command */ +} + +static void ipmi_ocp_final(struct device *dev) +{ + /* Add OCP specific IPMI command */ +} + +static void ipmi_set_resources(struct device *dev) +{ + struct resource *res; + + for (res = dev->resource_list; res; res = res->next) { + if (!(res->flags & IORESOURCE_ASSIGNED)) + continue; + + res->flags |= IORESOURCE_STORED; + report_resource_stored(dev, res, ""); + } +} + +static void ipmi_read_resources(struct device *dev) +{ + struct resource *res = new_resource(dev, 0); + res->base = dev->path.pnp.port; + res->size = 2; + res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; +} + +static struct device_operations ops = { + .read_resources = ipmi_read_resources, + .set_resources = ipmi_set_resources, + .init = ipmi_ocp_init, + .final = ipmi_ocp_final, +}; + +static void enable_dev(struct device *dev) +{ + if (dev->path.type != DEVICE_PATH_PNP) + printk(BIOS_ERR, "%s: Unsupported device type\n", + dev_path(dev)); + else if (dev->path.pnp.port & 1) + printk(BIOS_ERR, "%s: Base address needs to be aligned to 2\n", + dev_path(dev)); + else + dev->ops = &ops; +} + +struct chip_operations drivers_ipmi_ocp_ops = { + CHIP_NAME("IPMI OCP") + .enable_dev = enable_dev, +}; diff --git a/src/drivers/ipmi/ocp/ipmi_ocp.h b/src/drivers/ipmi/ocp/ipmi_ocp.h new file mode 100644 index 0000000000..9aebbe9f5a --- /dev/null +++ b/src/drivers/ipmi/ocp/ipmi_ocp.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __IPMI_OCP_H +#define __IPMI_OCP_H + +#endif diff --git a/src/mainboard/ocp/deltalake/Kconfig b/src/mainboard/ocp/deltalake/Kconfig index 17f81bd3d7..d5df902102 100644 --- a/src/mainboard/ocp/deltalake/Kconfig +++ b/src/mainboard/ocp/deltalake/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS select OCP_DMI select VPD select VPD_SMBIOS_VERSION + select IPMI_OCP config POWER_STATE_DEFAULT_ON_AFTER_FAILURE default n diff --git a/src/mainboard/ocp/deltalake/devicetree.cb b/src/mainboard/ocp/deltalake/devicetree.cb index cc17e06f6c..f77a2149bd 100644 --- a/src/mainboard/ocp/deltalake/devicetree.cb +++ b/src/mainboard/ocp/deltalake/devicetree.cb @@ -85,6 +85,9 @@ chip soc/intel/xeon_sp/cpx register "bmc_i2c_address" = "0x20" register "bmc_boot_timeout" = "60" end + chip drivers/ipmi/ocp # OCP specific IPMI porting + device pnp ca2.1 on end + end end # ISA bridge: Intel Device a245 device pci 1f.1 on end # p2sb device pci 1f.2 on end # Memory controller: Intel Device a221 |