[PATCH] acpi: dppt: add ACPI DPPT test (mantis 1795)

Alex Hung alex.hung at canonical.com
Wed Aug 23 07:57:32 UTC 2017


On Wed, Aug 23, 2017 at 12:48 AM, ivanhu <ivan.hu at canonical.com> wrote:
> Hi Alex,
>
> On 08/23/2017 08:38 AM, Alex Hung wrote:
>>
>> This is a dummy test because DPPT is reserved in ACPI 6.2 but the
>> actual spec is not defined. Tests and fwts-test sync up will be
>> updated after DPPT spec is released.
>>
>
> Why don't we just wait for the release of actual spec. released, instead of
> adding a dummy test? Any reasons?

As this change in listed in ACPI 6.2, it is easier to keep track what
is done for ACPI 6.2.

>
> Cheers,
> Ivan
>
>
>> Signed-off-by: Alex Hung <alex.hung at canonical.com>
>> ---
>>   src/Makefile.am             |  1 +
>>   src/acpi/dppt/dppt.c        | 73
>> +++++++++++++++++++++++++++++++++++++++++++++
>>   src/lib/include/fwts_acpi.h |  7 +++++
>>   3 files changed, 81 insertions(+)
>>   create mode 100644 src/acpi/dppt/dppt.c
>>
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index c752682..2b08858 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -67,6 +67,7 @@ fwts_SOURCES = main.c                                 \
>>         acpi/dbgp/dbgp.c                        \
>>         acpi/dbg2/dbg2.c                        \
>>         acpi/dmar/dmar.c                        \
>> +       acpi/dppt/dppt.c                        \
>>         acpi/drtm/drtm.c                        \
>>         acpi/ecdt/ecdt.c                        \
>>         acpi/einj/einj.c                        \
>> diff --git a/src/acpi/dppt/dppt.c b/src/acpi/dppt/dppt.c
>> new file mode 100644
>> index 0000000..5980ba9
>> --- /dev/null
>> +++ b/src/acpi/dppt/dppt.c
>> @@ -0,0 +1,73 @@
>> +/*
>> + * Copyright (C) 2017 Canonical
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>> 02110-1301, USA.
>> + *
>> + */
>> +#include "fwts.h"
>> +
>> +#if defined(FWTS_HAS_ACPI)
>> +
>> +#include <stdlib.h>
>> +#include <stdio.h>
>> +#include <unistd.h>
>> +#include <inttypes.h>
>> +#include <string.h>
>> +
>> +static fwts_acpi_table_info *table;
>> +
>> +static int dppt_init(fwts_framework *fw)
>> +{
>> +       if (fwts_acpi_find_table(fw, "DPPT", 0, &table) != FWTS_OK) {
>> +               fwts_log_error(fw, "Cannot read ACPI tables");
>> +               return FWTS_ERROR;
>> +       }
>> +       if (table == NULL || (table && table->length == 0)) {
>> +               fwts_log_error(fw, "ACPI DPPT table does not exist,
>> skipping test");
>> +               return FWTS_SKIP;
>> +       }
>> +
>> +       return FWTS_OK;
>> +}
>> +
>> +static int dppt_test1(fwts_framework *fw)
>> +{
>> +       fwts_acpi_table_dppt *dppt = (fwts_acpi_table_dppt *) table->data;
>> +       bool passed = true;
>> +
>> +       FWTS_UNUSED(dppt);
>> +
>> +       fwts_log_info_verbatim(fw, "DPPT DMA Protection Policy Table
>> test:");
>> +
>> +       if (passed)
>> +               fwts_passed(fw, "No issues found in DPPT table.");
>> +
>> +       return FWTS_OK;
>> +}
>> +
>> +static fwts_framework_minor_test dppt_tests[] = {
>> +       { dppt_test1, "Validate DPPT table." },
>> +       { NULL, NULL }
>> +};
>> +
>> +static fwts_framework_ops dppt_ops = {
>> +       .description = "DPPT DMA Protection Policy Table test",
>> +       .init        = dppt_init,
>> +       .minor_tests = dppt_tests
>> +};
>> +
>> +FWTS_REGISTER("dppt", &dppt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH |
>> FWTS_FLAG_TEST_ACPI)
>> +
>> +#endif
>> diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
>> index 4387efd..d919aa8 100644
>> --- a/src/lib/include/fwts_acpi.h
>> +++ b/src/lib/include/fwts_acpi.h
>> @@ -879,6 +879,13 @@ typedef struct {
>>   } __attribute__ ((packed)) fwts_acpi_table_dmar_device_scope;
>>     /*
>> + * ACPI DPPT (DMA Protection Policy Table)
>> +  */
>> +typedef struct {
>> +       fwts_acpi_table_header header;
>> +} __attribute__ ((packed)) fwts_acpi_table_dppt;
>> +
>> +/*
>>    * ACPI SLIC (Microsoft Software Licensing Table)
>>    *  see "OEM Activation 2.0 for Windows Vista Operating Systems"
>>    */
>>
>
> --
> fwts-devel mailing list
> fwts-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/fwts-devel



-- 
Cheers,
Alex Hung



More information about the fwts-devel mailing list