2016-06-10 09:15:42 +00:00
|
|
|
/*
|
|
|
|
* IPMI ACPI firmware handling
|
|
|
|
*
|
|
|
|
* Copyright (c) 2015,2016 Corey Minyard, MontaVista Software, LLC
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#include "hw/ipmi/ipmi.h"
|
|
|
|
#include "hw/acpi/aml-build.h"
|
|
|
|
#include "hw/acpi/acpi.h"
|
|
|
|
#include "hw/acpi/ipmi.h"
|
|
|
|
|
ipmi: acpi: use relative path to resource source
smbus-ipmi AML description needs to specify a path to its parent
node in _CRS. The rest of IPMI inplementations (ISA based)
do not need path at all. Instead of passing through a full path
use relative path to point to smbus-ipmi's parent node, it will
let follow up patches to create IPMI device AML in a generic
way instead of current ad-hoc way. (i.e. AML will be generated
the same way it's done for other ISA device, and smbus will be
converted to generate AML for its slave devices the same way
as ISA)
expected AML change:
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
I2cSerialBusV2 (0x0000, ControllerInitiated, 0x000186A0,
- AddressingMode7Bit, "\\_SB.PCI0.SMB0",
+ AddressingMode7Bit, "^",
0x00, ResourceProducer, , Exclusive,
)
})
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20220608135340.3304695-14-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2022-06-08 13:53:18 +00:00
|
|
|
static Aml *aml_ipmi_crs(IPMIFwInfo *info)
|
2016-06-10 09:15:42 +00:00
|
|
|
{
|
|
|
|
Aml *crs = aml_resource_template();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The base address is fixed and cannot change. That may be different
|
|
|
|
* if someone does PCI, but we aren't there yet.
|
|
|
|
*/
|
|
|
|
switch (info->memspace) {
|
|
|
|
case IPMI_MEMSPACE_IO:
|
|
|
|
aml_append(crs, aml_io(AML_DECODE16, info->base_address,
|
|
|
|
info->base_address + info->register_length - 1,
|
|
|
|
info->register_spacing, info->register_length));
|
|
|
|
break;
|
|
|
|
case IPMI_MEMSPACE_MEM32:
|
|
|
|
aml_append(crs,
|
|
|
|
aml_dword_memory(AML_POS_DECODE,
|
|
|
|
AML_MIN_FIXED, AML_MAX_FIXED,
|
|
|
|
AML_NON_CACHEABLE, AML_READ_WRITE,
|
|
|
|
0xffffffff,
|
|
|
|
info->base_address,
|
|
|
|
info->base_address + info->register_length - 1,
|
|
|
|
info->register_spacing, info->register_length));
|
|
|
|
break;
|
|
|
|
case IPMI_MEMSPACE_MEM64:
|
|
|
|
aml_append(crs,
|
|
|
|
aml_qword_memory(AML_POS_DECODE,
|
|
|
|
AML_MIN_FIXED, AML_MAX_FIXED,
|
|
|
|
AML_NON_CACHEABLE, AML_READ_WRITE,
|
|
|
|
0xffffffffffffffffULL,
|
|
|
|
info->base_address,
|
|
|
|
info->base_address + info->register_length - 1,
|
|
|
|
info->register_spacing, info->register_length));
|
|
|
|
break;
|
|
|
|
case IPMI_MEMSPACE_SMBUS:
|
2015-06-09 20:13:29 +00:00
|
|
|
aml_append(crs, aml_i2c_serial_bus_device(info->base_address,
|
ipmi: acpi: use relative path to resource source
smbus-ipmi AML description needs to specify a path to its parent
node in _CRS. The rest of IPMI inplementations (ISA based)
do not need path at all. Instead of passing through a full path
use relative path to point to smbus-ipmi's parent node, it will
let follow up patches to create IPMI device AML in a generic
way instead of current ad-hoc way. (i.e. AML will be generated
the same way it's done for other ISA device, and smbus will be
converted to generate AML for its slave devices the same way
as ISA)
expected AML change:
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
I2cSerialBusV2 (0x0000, ControllerInitiated, 0x000186A0,
- AddressingMode7Bit, "\\_SB.PCI0.SMB0",
+ AddressingMode7Bit, "^",
0x00, ResourceProducer, , Exclusive,
)
})
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20220608135340.3304695-14-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2022-06-08 13:53:18 +00:00
|
|
|
"^"));
|
2016-06-10 09:15:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->interrupt_number) {
|
|
|
|
aml_append(crs, aml_irq_no_flags(info->interrupt_number));
|
|
|
|
}
|
|
|
|
|
|
|
|
return crs;
|
|
|
|
}
|
|
|
|
|
2022-06-08 13:53:21 +00:00
|
|
|
void build_ipmi_dev_aml(AcpiDevAmlIf *adev, Aml *scope)
|
2016-06-10 09:15:42 +00:00
|
|
|
{
|
|
|
|
Aml *dev;
|
2022-06-08 13:53:21 +00:00
|
|
|
IPMIFwInfo info = {};
|
|
|
|
IPMIInterface *ii = IPMI_INTERFACE(adev);
|
|
|
|
IPMIInterfaceClass *iic = IPMI_INTERFACE_GET_CLASS(ii);
|
|
|
|
uint16_t version;
|
2016-06-10 09:15:42 +00:00
|
|
|
|
2022-06-08 13:53:21 +00:00
|
|
|
iic->get_fwinfo(ii, &info);
|
|
|
|
assert(info.ipmi_spec_minor_revision <= 15);
|
|
|
|
version = ((info.ipmi_spec_major_revision << 8)
|
|
|
|
| (info.ipmi_spec_minor_revision << 4));
|
2016-06-10 09:15:42 +00:00
|
|
|
|
2022-06-08 13:53:21 +00:00
|
|
|
dev = aml_device("MI%d", info.uuid);
|
2016-06-10 09:15:42 +00:00
|
|
|
aml_append(dev, aml_name_decl("_HID", aml_eisaid("IPI0001")));
|
|
|
|
aml_append(dev, aml_name_decl("_STR", aml_string("ipmi_%s",
|
2022-06-08 13:53:21 +00:00
|
|
|
info.interface_name)));
|
|
|
|
aml_append(dev, aml_name_decl("_UID", aml_int(info.uuid)));
|
|
|
|
aml_append(dev, aml_name_decl("_CRS", aml_ipmi_crs(&info)));
|
|
|
|
aml_append(dev, aml_name_decl("_IFT", aml_int(info.interface_type)));
|
2016-06-10 09:15:42 +00:00
|
|
|
aml_append(dev, aml_name_decl("_SRV", aml_int(version)));
|
|
|
|
|
2022-06-08 13:53:21 +00:00
|
|
|
aml_append(scope, dev);
|
2016-06-10 09:15:42 +00:00
|
|
|
}
|