diff mbox

[v5,15/16] bios: Add tests for the IPMI ACPI and SMBIOS entries

Message ID 1450378219-25799-16-git-send-email-minyard@acm.org
State New
Headers show

Commit Message

Corey Minyard Dec. 17, 2015, 6:50 p.m. UTC
From: Corey Minyard <cminyard@mvista.com>


Signed-off-by: Corey Minyard <cminyard@mvista.com>

---
 tests/acpi-test-data/pc/SSDT.ipmikcs | Bin 0 -> 2582 bytes
 tests/acpi-test-data/q35/SSDT.ipmibt | Bin 0 -> 790 bytes
 tests/bios-tables-test.c             |  58 ++++++++++++++++++++++++++++++++---
 3 files changed, 54 insertions(+), 4 deletions(-)
 create mode 100644 tests/acpi-test-data/pc/SSDT.ipmikcs
 create mode 100644 tests/acpi-test-data/q35/SSDT.ipmibt

-- 
2.5.0
diff mbox

Patch

diff --git a/tests/acpi-test-data/pc/SSDT.ipmikcs b/tests/acpi-test-data/pc/SSDT.ipmikcs
new file mode 100644
index 0000000000000000000000000000000000000000..f1107c37c8fa3523546b1759e488a624ebbd896d
GIT binary patch
literal 2582
zcma);%Wm676o$`Gv`vqwm{RCV;yC82K(a{WICj#VD2leEm@>hUj1)4!MG#a*FE)~9
zVR&P^sM~#CAZWdg9-)1NK0@B1K<ic2b4VT8i%d~1sQLMS{AY%9qf(9Tf&>sR>bpTx
zdG(iZpzxjm04meJ6PEWMrK+CBL91$|L88j_8Tsu`B`|EX0Y-EY+v3W;vW12Bg<YUq
zf1`b6PjqQS;GaJ(0^~k`gwd!-DE<t{9IBCi)@bzGKY8)@zmB1Q9+=y4i1jyHjZ)l+
ztA2G8th9%U?t5=uzdd~S=GE)BcvE$KS<G8nl5$&o9DW=MlS0~N+>Db?g<$8r=HYio
zU%&hEKeONid=Tz2I1l!zruDQkZ3=8OmY=2-%an#RGPOYtb-?j|*r(UmKYw99qIVc4
zp~{+I`+vykybnR#`+wCBVJJN8%4wXat|-D#di^sy6L?8$PXGJ$Ag)&PSLfPk<agmR
zh$A0R;F}?#y5N@5uw4}>!Zr-ta;LlXh4EhgJb(*&{J;w0-A<(-gcDi&j|)8hQ8R8>
zQKOS!hiN8c?-$2W!V)#A8Ak~=O3J1F*(!-bl+<@TyfpE$L!})o#V=EA^$Gz#)MON@
zR79<g5>XQEi70HRqJK7@Kd(Z3YB$`&iwZn<I--U;(P1_l>*(UJ7FD&HTB+YiP&`y?
zV}bL}02fDQtpS%=;RzSksn9=vpw^z_gR0k&h3t8JqyTOudpB_qwy6TL34KDbgqn<+
zT9i|#7@g9g>zs-+0Xu*VnAW14I>YFU4t>h07NeFH<<wb5XLaZXr%Fbp7Ufi2h<Ue)
zI&_m$ZANV^%BdwrOFHx!r`}@pmKNpIIY#Gn=yOhW7<IHLr<NHl>(I|RwZdpci*o91
zMsMp-pHp!O<U`<UQBIv_bY6$nIdy^21ue>{i;OPn(125y7+un$oO*}RJ36$%sdpK@
zt3^3=nbBn(8glAAM(=4+PF-PiMTc&2>U~D<Yf(;JWpwpZsM}m_>~*@vd;4S{Ex4e)
z?jREm3f#?d;gMjch5~n_+&LvdPU&P&1c3^-m9a8NO*|77ZVqFQ>e`riR2eSuu}8IS
zPCTj(7wXuf`ks+DcQU|z5Kq+$g$s@~o~x*@eLP(+6fPb1txRA04ryEj?0cEM_G_eZ
zI<tS8>1#jhF-}bO@i4hi!402!jZ<vmQ@<NGeCjz)mWl6?zTwwU<FHTsQ_|?Wt8vij
z!V%Ovy@-Yo&$^x%7aFqQ>`vV{l3U8hZ;Kr>YS9eB&m;S@SrB+qb(7M;(KiR_SFh-!
i2)~r@=H$%&#s1Y6#xb3Wtu6dQ5UxyBvImz%F#ZLb|5+aZ

literal 0
HcmV?d00001

diff --git a/tests/acpi-test-data/q35/SSDT.ipmibt b/tests/acpi-test-data/q35/SSDT.ipmibt
new file mode 100644
index 0000000000000000000000000000000000000000..5c2078ce396decb418b4f1416fd541a7c9aaf902
GIT binary patch
literal 790
zcmaJ<y^hmB5S~pU<J+tyUu57Y5Ecaz6o(;zsL(l%lQ?9PmDd*?a-@|&CoU3jr~4_=
zkstv*4**5p10I1g4}f?93Q`ef91c<8V*GtGyF2sEjMmNUQW=1KYz(4~_8WUD(&%FV
zK$!k+B1YRrH;jssz&25;HyaoDtM?9+1cm`tWLTRm#ZoXE{Y>DK06#Ij6o0w1qJux)
zT?Sak0XVEyRXU1a35p11r0>gW_4(Hy_-F$8EUL6sjQKlB(@}jDguw%_%`P(X`^Wny
zhiAvn_D|5MvyfNUl{%canQ!?Pb0^^598t7xYF33|BE<Jh&93kgFBR-QMJTD;y)q)n
z`Rs9Jn{=x*)<td+e&yCWZ=`np&f)3Ni?iqdO}`Ke!F<&4TBSN;)rH`GJ{1K)V|Lv9
zO+8XUu$JoyBf|{lk&+=GK{Z5l2A*T$ZorVlT{!SI`&sKr=@b8O0B`B~*pAeoUn?`_
zN_%v>d_FVTQB7Mm`zZ>h=@mV}-gDTZqB=^ZtO}fO<<o0K$}(;Ad^8<2JwiQ1YR_QR
zSLr|qJ6y)vFq!l<lc^js8FvlKrx(}vb&R(L@eqxUe9w|psN1SgC-YfV2Z6Co*i3P(
zw{-AuO>kQncsP?gO_&$p?m4Izz*12^1Gi!Qqb<=P4rx%42|bCsA#Q8{qZLS<@zKk%
pd3uVfaZAug+FkCn**EwOtbE;v33wYOX<@T@+2cm1Lzq{g^c#SctpNZ4

literal 0
HcmV?d00001

diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 6d37332..4b4c4e0 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -51,6 +51,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 LOW(x) ((x) & 0xff)
@@ -372,7 +374,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);
@@ -675,7 +677,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++) {
@@ -715,8 +716,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));
     }
 }
 
@@ -777,6 +778,9 @@  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;
@@ -786,6 +790,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);
 }
@@ -797,6 +803,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);
 }
@@ -807,6 +815,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);
 }
@@ -818,11 +828,49 @@  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();
@@ -843,6 +891,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();
     unlink(disk);