aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi/ipmi_bt.c
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2017-12-06 13:18:07 -0600
committerCorey Minyard <cminyard@mvista.com>2019-09-20 14:08:10 -0500
commit79d29a9d065d25f7f9da0dfca8ac9b6f1989978c (patch)
tree475f024301e35d9c3b4d1ab77fe6d00d62669de5 /hw/ipmi/ipmi_bt.c
parent1739d54c8bea120897e6170a3807ab8633c6d460 (diff)
ipmi: Allow a size value to be passed for I/O space
PCI device I/O must be >= 8 bytes in length or they don't work. Allow the size to be passed in, the default size of 2 or 3 won't work. Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'hw/ipmi/ipmi_bt.c')
-rw-r--r--hw/ipmi/ipmi_bt.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/hw/ipmi/ipmi_bt.c b/hw/ipmi/ipmi_bt.c
index e6765ca4f8..22f94fb98d 100644
--- a/hw/ipmi/ipmi_bt.c
+++ b/hw/ipmi/ipmi_bt.c
@@ -189,7 +189,7 @@ static uint64_t ipmi_bt_ioport_read(void *opaque, hwaddr addr, unsigned size)
IPMIBT *ib = iic->get_backend_data(ii);
uint32_t ret = 0xff;
- switch (addr & 3) {
+ switch (addr & ib->size_mask) {
case 0:
ret = ib->control_reg;
break;
@@ -208,6 +208,9 @@ static uint64_t ipmi_bt_ioport_read(void *opaque, hwaddr addr, unsigned size)
case 2:
ret = ib->mask_reg;
break;
+ default:
+ ret = 0xff;
+ break;
}
return ret;
}
@@ -230,7 +233,7 @@ static void ipmi_bt_ioport_write(void *opaque, hwaddr addr, uint64_t val,
IPMIInterfaceClass *iic = IPMI_INTERFACE_GET_CLASS(ii);
IPMIBT *ib = iic->get_backend_data(ii);
- switch (addr & 3) {
+ switch (addr & ib->size_mask) {
case 0:
if (IPMI_BT_GET_CLR_WR(val)) {
ib->inlen = 0;
@@ -285,6 +288,9 @@ static void ipmi_bt_ioport_write(void *opaque, hwaddr addr, uint64_t val,
ipmi_bt_lower_irq(ib);
}
break;
+ default:
+ /* Ignore. */
+ break;
}
}
@@ -346,14 +352,19 @@ static void ipmi_bt_set_irq_enable(IPMIInterface *ii, int val)
ib->irqs_enabled = val;
}
-static void ipmi_bt_init(IPMIInterface *ii, Error **errp)
+static void ipmi_bt_init(IPMIInterface *ii, unsigned int min_size, Error **errp)
{
IPMIInterfaceClass *iic = IPMI_INTERFACE_GET_CLASS(ii);
IPMIBT *ib = iic->get_backend_data(ii);
+ if (min_size == 0) {
+ min_size = 4;
+ }
+ ib->size_mask = min_size - 1;
ib->io_length = 3;
- memory_region_init_io(&ib->io, NULL, &ipmi_bt_io_ops, ii, "ipmi-bt", 3);
+ memory_region_init_io(&ib->io, NULL, &ipmi_bt_io_ops, ii, "ipmi-bt",
+ min_size);
}
int ipmi_bt_vmstate_post_load(void *opaque, int version)