bios: Add tests for the IPMI ACPI and SMBIOS entries
Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
86e91dd713
commit
f4eda2d429
BIN
tests/acpi-test-data/pc/DSDT.ipmikcs
Normal file
BIN
tests/acpi-test-data/pc/DSDT.ipmikcs
Normal file
Binary file not shown.
BIN
tests/acpi-test-data/q35/DSDT.ipmibt
Normal file
BIN
tests/acpi-test-data/q35/DSDT.ipmibt
Normal file
Binary file not shown.
@ -49,6 +49,8 @@ typedef struct {
|
||||
GArray *tables;
|
||||
uint32_t smbios_ep_addr;
|
||||
struct smbios_21_entry_point smbios_ep_table;
|
||||
uint8_t *required_struct_types;
|
||||
int required_struct_types_len;
|
||||
} test_data;
|
||||
|
||||
#define ACPI_READ_FIELD(field, addr) \
|
||||
@ -334,7 +336,7 @@ static void test_acpi_tables(test_data *data)
|
||||
for (i = 0; i < tables_nr; i++) {
|
||||
AcpiSdtTable ssdt_table;
|
||||
|
||||
memset(&ssdt_table, 0 , sizeof(ssdt_table));
|
||||
memset(&ssdt_table, 0, sizeof(ssdt_table));
|
||||
uint32_t addr = data->rsdt_tables_addr[i + 1]; /* fadt is first */
|
||||
test_dst_table(&ssdt_table, addr);
|
||||
g_array_append_val(data->tables, ssdt_table);
|
||||
@ -661,7 +663,6 @@ static void test_smbios_structs(test_data *data)
|
||||
uint32_t addr = ep_table->structure_table_address;
|
||||
int i, len, max_len = 0;
|
||||
uint8_t type, prv, crt;
|
||||
uint8_t required_struct_types[] = {0, 1, 3, 4, 16, 17, 19, 32, 127};
|
||||
|
||||
/* walk the smbios tables */
|
||||
for (i = 0; i < ep_table->number_of_structures; i++) {
|
||||
@ -701,8 +702,8 @@ static void test_smbios_structs(test_data *data)
|
||||
g_assert_cmpuint(ep_table->max_structure_size, ==, max_len);
|
||||
|
||||
/* required struct types must all be present */
|
||||
for (i = 0; i < ARRAY_SIZE(required_struct_types); i++) {
|
||||
g_assert(test_bit(required_struct_types[i], struct_bitmap));
|
||||
for (i = 0; i < data->required_struct_types_len; i++) {
|
||||
g_assert(test_bit(data->required_struct_types[i], struct_bitmap));
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,6 +743,10 @@ static void test_acpi_one(const char *params, test_data *data)
|
||||
g_free(args);
|
||||
}
|
||||
|
||||
static uint8_t base_required_struct_types[] = {
|
||||
0, 1, 3, 4, 16, 17, 19, 32, 127
|
||||
};
|
||||
|
||||
static void test_acpi_piix4_tcg(void)
|
||||
{
|
||||
test_data data;
|
||||
@ -751,6 +756,8 @@ static void test_acpi_piix4_tcg(void)
|
||||
*/
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.machine = MACHINE_PC;
|
||||
data.required_struct_types = base_required_struct_types;
|
||||
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
|
||||
test_acpi_one("-machine accel=tcg", &data);
|
||||
free_test_data(&data);
|
||||
}
|
||||
@ -762,6 +769,8 @@ static void test_acpi_piix4_tcg_bridge(void)
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.machine = MACHINE_PC;
|
||||
data.variant = ".bridge";
|
||||
data.required_struct_types = base_required_struct_types;
|
||||
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
|
||||
test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
|
||||
free_test_data(&data);
|
||||
}
|
||||
@ -772,6 +781,8 @@ static void test_acpi_q35_tcg(void)
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.machine = MACHINE_Q35;
|
||||
data.required_struct_types = base_required_struct_types;
|
||||
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
|
||||
test_acpi_one("-machine q35,accel=tcg", &data);
|
||||
free_test_data(&data);
|
||||
}
|
||||
@ -783,11 +794,50 @@ static void test_acpi_q35_tcg_bridge(void)
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.machine = MACHINE_Q35;
|
||||
data.variant = ".bridge";
|
||||
data.required_struct_types = base_required_struct_types;
|
||||
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
|
||||
test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
|
||||
&data);
|
||||
free_test_data(&data);
|
||||
}
|
||||
|
||||
static uint8_t ipmi_required_struct_types[] = {
|
||||
0, 1, 3, 4, 16, 17, 19, 32, 38, 127
|
||||
};
|
||||
|
||||
static void test_acpi_q35_tcg_ipmi(void)
|
||||
{
|
||||
test_data data;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.machine = MACHINE_Q35;
|
||||
data.variant = ".ipmibt";
|
||||
data.required_struct_types = ipmi_required_struct_types;
|
||||
data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
|
||||
test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
|
||||
" -device isa-ipmi-bt,bmc=bmc0",
|
||||
&data);
|
||||
free_test_data(&data);
|
||||
}
|
||||
|
||||
static void test_acpi_piix4_tcg_ipmi(void)
|
||||
{
|
||||
test_data data;
|
||||
|
||||
/* Supplying -machine accel argument overrides the default (qtest).
|
||||
* This is to make guest actually run.
|
||||
*/
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.machine = MACHINE_PC;
|
||||
data.variant = ".ipmikcs";
|
||||
data.required_struct_types = ipmi_required_struct_types;
|
||||
data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
|
||||
test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
|
||||
" -device isa-ipmi-kcs,irq=0,bmc=bmc0",
|
||||
&data);
|
||||
free_test_data(&data);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *arch = qtest_get_arch();
|
||||
@ -804,6 +854,8 @@ int main(int argc, char *argv[])
|
||||
qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
|
||||
qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
|
||||
qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
|
||||
qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
|
||||
qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
|
||||
}
|
||||
ret = g_test_run();
|
||||
boot_sector_cleanup(disk);
|
||||
|
Loading…
Reference in New Issue
Block a user