drivers/ipmi/ipmi_kcs_ops: Advertise correct register spacing

Advertise the register spacing used by the BMC as set by the Kconfig.

Tested on OCP Monolake.

Change-Id: Ib926d30f6a0e78fbf613a6f71f765c5f51eee77d
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35152
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
Patrick Rudolph 2019-08-29 19:44:32 +02:00 committed by Patrick Rudolph
parent 5fffb5e30d
commit a96c4a1340
1 changed files with 37 additions and 2 deletions

View File

@ -128,8 +128,24 @@ ipmi_write_acpi_tables(struct device *dev, unsigned long current,
.space_id = ACPI_ADDRESS_SPACE_IO,
.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS,
.addrl = dev->path.pnp.port,
.bit_width = 8,
};
switch (CONFIG_IPMI_KCS_REGISTER_SPACING) {
case 4:
addr.bit_offset = 32;
break;
case 16:
addr.bit_offset = 128;
break;
default:
printk(BIOS_ERR, "IPMI: Unsupported register spacing for SPMI\n");
/* fall through */
case 1:
addr.bit_offset = 8;
break;
}
current = ALIGN_UP(current, 8);
printk(BIOS_DEBUG, "ACPI: * SPMI at %lx\n", current);
spmi = (struct acpi_spmi *)current;
@ -183,7 +199,9 @@ static void ipmi_ssdt(struct device *dev)
acpigen_write_STA(0xf);
acpigen_write_name("_CRS");
acpigen_write_resourcetemplate_header();
acpigen_write_io16(dev->path.pnp.port, dev->path.pnp.port, 1, 2, 1);
acpigen_write_io16(dev->path.pnp.port, dev->path.pnp.port, 1, 1, 1);
acpigen_write_io16(dev->path.pnp.port + CONFIG_IPMI_KCS_REGISTER_SPACING,
dev->path.pnp.port + CONFIG_IPMI_KCS_REGISTER_SPACING, 1, 1, 1);
if (conf) {
// FIXME: is that correct?
@ -214,6 +232,8 @@ static int ipmi_smbios_data(struct device *dev, int *handle,
struct drivers_ipmi_config *conf = NULL;
u8 nv_storage = 0xff;
u8 i2c_address = 0;
u8 register_spacing;
int len = 0;
if (dev->chip_info)
@ -225,6 +245,21 @@ static int ipmi_smbios_data(struct device *dev, int *handle,
i2c_address = conf->bmc_i2c_address;
}
switch (CONFIG_IPMI_KCS_REGISTER_SPACING) {
case 4:
register_spacing = 1 << 6;
break;
case 16:
register_spacing = 2 << 6;
break;
default:
printk(BIOS_ERR, "IPMI: Unsupported register spacing for SMBIOS\n");
/* fall through */
case 1:
register_spacing = 0 << 6;
break;
}
// add IPMI Device Information
len += smbios_write_type38(
current, handle,
@ -233,7 +268,7 @@ static int ipmi_smbios_data(struct device *dev, int *handle,
i2c_address, // I2C address
nv_storage, // NV storage
dev->path.pnp.port | 1, // IO interface
0,
register_spacing,
0); // no IRQ
return len;