<html><body><p>Hi Ivan,<br><br>I think I'm going to need some assistance on this one, the same conditional build infrastructure was done for this patch as was done for the dt_base and dt_sysinfo tests (these tests used the HAVE_LIBFDT) check, but same<br>conditional type object code inclusion, so not sure how that passed (if you did not have LIBFDT installed either).<br><br>FAIL: fwts-test/arg-show-progress-dialog-0001/test-0001.sh<br>FAIL: fwts-test/arg-show-progress-dialog-0001/test-0002.s<br>FAIL: fwts-test/arg-show-tests-0001/test-0001.sh<br>FAIL: fwts-test/arg-show-tests-0001/test-0002.sh<br>FAIL: fwts-test/arg-show-tests-full-0001/test-0001.sh<br><br>fwts/src/Makefile.am<br><br>if HAVE_LIBFDT<br>dt_tests = \<br>        devicetree/dt_base/dt_base.c            \<br>        devicetree/dt_sysinfo/dt_sysinfo.c<br>endif<br><br>if HAVE_ASM_OPAL_PRD_H<br>opal_tests = \<br>        opal/prd_info.c<br>endif<br><br>=====================================<br>Deb McLemore<br>IBM OpenPower - IBM Systems<br>(512) 286 9980<br><br>debmc@us.ibm.com<br>debmc@linux.vnet.ibm.com - (plain text)<br>=====================================<br><br><img width="16" height="16" src="cid:1__=09BBF549DFD362768f9e8a93df938690918c09B@" border="0" alt="Inactive hide details for ivanhu ---06/22/2016 04:01:30 AM---Hi Deb, This patch failed the regression test "make check" on thos"><font color="#424282">ivanhu ---06/22/2016 04:01:30 AM---Hi Deb, This patch failed the regression test "make check" on those machines</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">ivanhu <ivan.hu@canonical.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Deb McLemore <debmc@linux.vnet.ibm.com></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">fwts-devel@lists.ubuntu.com</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">06/22/2016 04:01 AM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: [PATCH] V2 opal/prd_info: Add OPAL Processor Recovery Diagnostics</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">fwts-devel-bounces@lists.ubuntu.com</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt>Hi Deb,<br><br>This patch failed the regression test "make check" on those machines <br>which don't have the header, asm/opal-prd.h, could you help to check that?<br><br>Cheers,<br>Ivan<br><br>On 2016年06月21日 21:58, Deb McLemore wrote:<br>> We added a new capability to perform PRD integrity checks.<br>> The OPAL PRD firmware feature will be set when the device tree<br>> has the proper node configured.  Runtime checks will use the<br>> opal-prd service to query the version of the opal-prd service to<br>> confirm operational state.<br>><br>> Signed-off-by: Deb McLemore <debmc@linux.vnet.ibm.com><br>> ---<br>>   configure.ac                                       |   2 +<br>>   .../arg-show-tests-full-0001.log                   |   2 +<br>>   src/Makefile.am                                    |   8 +-<br>>   src/lib/include/fwts_firmware.h                    |  22 ++-<br>>   src/lib/include/fwts_pipeio.h                      |   1 +<br>>   src/lib/src/Makefile.am                            |   3 +-<br>>   src/lib/src/fwts_devicetree.c                      |  12 +-<br>>   src/lib/src/fwts_firmware.c                        |  25 ++-<br>>   src/lib/src/fwts_framework.c                       |   5 +-<br>>   src/lib/src/fwts_pipeio.c                          |  29 ++++<br>>   src/opal/prd_info.c                                | 188 +++++++++++++++++++++<br>>   11 files changed, 277 insertions(+), 20 deletions(-)<br>>   create mode 100644 src/opal/prd_info.c<br>><br>> diff --git a/configure.ac b/configure.ac<br>> index 6ada384..e3e7512 100644<br>> --- a/configure.ac<br>> +++ b/configure.ac<br>> @@ -63,6 +63,8 @@<br>>                      AC_CHECK_HEADERS([json/json.h])<br>>                      AC_CHECK_HEADERS([glib.h])<br>>                      AC_CHECK_HEADERS([gio/gio.h])<br>> +                   AC_CHECK_HEADERS([asm/opal-prd.h])<br>> +                   AM_CONDITIONAL([HAVE_ASM_OPAL_PRD_H], [test "x$ac_cv_header_asm_opal_prd_h" = "xyes"])<br>>                      #AC_CHECK_LIB(pcre, pcre_compile)<br>>                      AC_SEARCH_LIBS([fdt_check_header], [fdt], [<br>>                                     AC_DEFINE([HAVE_LIBFDT], [1], [Define if we have libfdt])<br>> diff --git a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log<br>> index 6784ed3..695c5d6 100644<br>> --- a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log<br>> +++ b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log<br>> @@ -663,6 +663,8 @@ Batch tests:<br>>     PCI IRQ Routing Table test.<br>>    pnp             (1 test):<br>>     PnP BIOS Support Installation structure test.<br>> + prd_info        (1 test):<br>> +  OPAL Processor Recovery Diagnostics Info<br>>    rsdp            (1 test):<br>>     RSDP Root System Description Pointer test.<br>>    rsdt            (1 test):<br>> diff --git a/src/Makefile.am b/src/Makefile.am<br>> index 00cde32..b86fe52 100644<br>> --- a/src/Makefile.am<br>> +++ b/src/Makefile.am<br>> @@ -26,6 +26,11 @@ dt_tests = \<br>>                    devicetree/dt_sysinfo/dt_sysinfo.c<br>>   endif<br>><br>> +if HAVE_ASM_OPAL_PRD_H<br>> +opal_tests = \<br>> +                 opal/prd_info.c<br>> +endif<br>> +<br>>   #<br>>   #  fwts main + tests<br>>   #<br>> @@ -142,7 +147,8 @@ fwts_SOURCES = main.c                                                                     \<br>>                    uefi/uefirtauthvar/uefirtauthvar.c                 \<br>>                    uefi/esrtdump/esrtdump.c                                  \<br>>                    uefi/esrt/esrt.c                                                   \<br>> -                 $(dt_tests)<br>> +                 $(dt_tests)                                                                    \<br>> +                 $(opal_tests)<br>><br>>   fwts_LDFLAGS = -lm `pkg-config --libs glib-2.0 gio-2.0`<br>><br>> diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h<br>> index 9221afc..fa8f621 100644<br>> --- a/src/lib/include/fwts_firmware.h<br>> +++ b/src/lib/include/fwts_firmware.h<br>> @@ -1,5 +1,6 @@<br>>   /*<br>>    * Copyright (C) 2010-2016 Canonical<br>> + * Some of this work - Copyright (C) 2016 IBM<br>>    *<br>>    * This program is free software; you can redistribute it and/or<br>>    * modify it under the terms of the GNU General Public License<br>> @@ -30,21 +31,24 @@ enum firmware_type {<br>>   };<br>><br>>   enum firmware_feature {<br>> -                 FWTS_FW_FEATURE_ACPI                                  = 0x1,<br>> -                 FWTS_FW_FEATURE_DEVICETREE                 = 0x2,<br>> -                 FWTS_FW_FEATURE_IPMI                                  = 0x4,<br>> -                 FWTS_FW_FEATURE_ALL                                  = FWTS_FW_FEATURE_ACPI |<br>> -                                                                                       FWTS_FW_FEATURE_DEVICETREE |<br>> -                                                                                       FWTS_FW_FEATURE_IPMI<br>> +                 FWTS_FW_FEATURE_ACPI                                  =                 0x1,<br>> +                 FWTS_FW_FEATURE_DEVICETREE                 =                 0x2,<br>> +                 FWTS_FW_FEATURE_IPMI                                  =                 0x4,<br>> +                 FWTS_FW_FEATURE_OPAL_PRD                 =                 0x8,<br>> +                 FWTS_FW_FEATURE_ALL                                  =                 FWTS_FW_FEATURE_ACPI |<br>> +                                                                                                      FWTS_FW_FEATURE_DEVICETREE |<br>> +                                                                                                      FWTS_FW_FEATURE_IPMI |<br>> +                                                                                                      FWTS_FW_FEATURE_OPAL_PRD<br>>   };<br>><br>>   int fwts_firmware_detect(void);<br>> -int fwts_firmware_features(void);<br>> +int fwts_firmware_features(fwts_framework *fw);<br>>   const char *fwts_firmware_feature_string(const int features);<br>><br>> -static inline bool fwts_firmware_has_features(const int features)<br>> +static inline bool fwts_firmware_has_features(fwts_framework *fw,<br>> +                                                   const int features)<br>>   {<br>> -                 return (fwts_firmware_features() & features) == features;<br>> +                 return (fwts_firmware_features(fw) & features) == features;<br>>   }<br>><br>>   #endif<br>> diff --git a/src/lib/include/fwts_pipeio.h b/src/lib/include/fwts_pipeio.h<br>> index 9a874dd..8c1b664 100644<br>> --- a/src/lib/include/fwts_pipeio.h<br>> +++ b/src/lib/include/fwts_pipeio.h<br>> @@ -41,6 +41,7 @@ int   fwts_pipe_close(const int fd, const pid_t pid);<br>>   int   fwts_pipe_close2(const int in_fd, const int out_fd, const pid_t pid);<br>>   int   fwts_pipe_exec(const char *command, fwts_list **list, int *status);<br>>   int   fwts_exec(const char *command, int *status);<br>> +int   fwts_exec2(const char *command, char **output);<br>>   int   fwts_write_string_to_file(const fwts_framework *fw, FILE *file, const char *str);<br>>   int   fwts_write_string_file(const fwts_framework *fw, const char *file_name, const char *str);<br>>   int   fwts_read_file_first_line(const fwts_framework *fw, const char *file_name, char **line);<br>> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am<br>> index e96b75f..1b8fd74 100644<br>> --- a/src/lib/src/Makefile.am<br>> +++ b/src/lib/src/Makefile.am<br>> @@ -19,7 +19,8 @@ libfwts_la_LDFLAGS =                                                    \<br>>   libfwts_la_CPPFLAGS = $(AM_CPPFLAGS) -DACPI_DEBUG_OUTPUT<br>><br>>   if HAVE_LIBFDT<br>> -dt_sources = fwts_devicetree.c<br>> +dt_sources = \<br>> +                 fwts_devicetree.c<br>>   endif<br>><br>>   #<br>> diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c<br>> index 5978ab9..0c62953 100644<br>> --- a/src/lib/src/fwts_devicetree.c<br>> +++ b/src/lib/src/fwts_devicetree.c<br>> @@ -20,7 +20,7 @@<br>>   #define _GNU_SOURCE<br>><br>>   #include <stdio.h><br>> -<br>> +#include <libfdt.h><br>>   #include "fwts.h"<br>><br>>   static const char *devicetree_fs_path = "/sys/firmware/devicetree/base";<br>> @@ -32,10 +32,12 @@ int fwts_devicetree_read(fwts_framework *fwts)<br>>                    ssize_t len;<br>>                    pid_t pid;<br>><br>> -                 if (!fwts_firmware_has_features(FWTS_FW_FEATURE_DEVICETREE))<br>> +                 if (!fwts_firmware_has_features(fwts,<br>> +                                  FWTS_FW_FEATURE_DEVICETREE))<br>>                                     return FWTS_OK;<br>><br>> -                 rc = asprintf(&command, "dtc -I fs -O dtb %s", devicetree_fs_path);<br>> +                 rc = asprintf(&command, "dtc -I fs -O dtb %s",<br>> +                                  devicetree_fs_path);<br>>                    if (rc < 0)<br>>                                     return FWTS_ERROR;<br>><br>> @@ -55,7 +57,8 @@ int fwts_devicetree_read(fwts_framework *fwts)<br>>                    status = fwts_pipe_close(fd, pid);<br>><br>>                    if (!WIFEXITED(status) || WEXITSTATUS(status) != 0 || len == 0) {<br>> -                                  fprintf(stderr, "Cannot read devicetree data: dtc failed\n");<br>> +                                  fprintf(stderr,<br>> +                                                   "Cannot read devicetree data: dtc failed\n");<br>>                                     free(data);<br>>                                     return FWTS_ERROR;<br>>                    }<br>> @@ -64,4 +67,3 @@ int fwts_devicetree_read(fwts_framework *fwts)<br>><br>>                    return FWTS_OK;<br>>   }<br>> -<br>> diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c<br>> index 972303a..f0bde63 100644<br>> --- a/src/lib/src/fwts_firmware.c<br>> +++ b/src/lib/src/fwts_firmware.c<br>> @@ -1,5 +1,6 @@<br>>   /*<br>>    * Copyright (C) 2010-2016 Canonical<br>> + * Some of this work - Copyright (C) 2016 IBM<br>>    *<br>>    * This program is free software; you can redistribute it and/or<br>>    * modify it under the terms of the GNU General Public License<br>> @@ -23,6 +24,10 @@<br>><br>>   #include "fwts.h"<br>><br>> +#if defined HAVE_LIBFDT<br>> +#include <libfdt.h><br>> +#endif<br>> +<br>>   static enum firmware_type firmware_type;<br>>   static bool firmware_type_valid;<br>><br>> @@ -33,6 +38,7 @@ static struct {<br>>                    { FWTS_FW_FEATURE_ACPI,                                  "ACPI" },<br>>                    { FWTS_FW_FEATURE_DEVICETREE,                 "devicetree" },<br>>                    { FWTS_FW_FEATURE_IPMI,                                  "IPMI" },<br>> +                 { FWTS_FW_FEATURE_OPAL_PRD,                 "OPAL PRD" },<br>>   };<br>><br>>   /*<br>> @@ -60,7 +66,7 @@ int fwts_firmware_detect(void)<br>>                    return firmware_type;<br>>   }<br>><br>> -int fwts_firmware_features(void)<br>> +int fwts_firmware_features(fwts_framework *fw)<br>>   {<br>>                    int features = 0;<br>><br>> @@ -83,6 +89,21 @@ int fwts_firmware_features(void)<br>>                    if (!stat("/dev/ipmi0", &ipmi_statbuf))<br>>                                     features |= FWTS_FW_FEATURE_IPMI;<br>><br>> +                 if (fw->fdt) { /* condition suppresses compile to use fw parm */<br>> +#if defined HAVE_LIBFDT<br>> +                 /* conditionally check to make sure the timing has fdt set */<br>> +                                  int node;<br>> +                                  node = fdt_path_offset(fw->fdt,<br>> +                                                   "/ibm,opal/diagnostics");<br>> +                                  if (node >= 0) {<br>> +                                                   if (!fdt_node_check_compatible(fw->fdt, node,<br>> +                                                                    "ibm,opal-prd")) {<br>> +                                                                    features |= FWTS_FW_FEATURE_OPAL_PRD;<br>> +                                                   }<br>> +                                  }<br>> +#endif<br>> +                 }<br>> +<br>>                    return features;<br>>   }<br>><br>> @@ -90,7 +111,7 @@ const char *fwts_firmware_feature_string(const int features)<br>>   {<br>>                    const int n = FWTS_ARRAY_LEN(feature_names);<br>>                    const char sep[] = ", ";<br>> -                 static char str[60];<br>> +                 static char str[70];<br>>                    size_t len;<br>>                    char *p;<br>>                    int i;<br>> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c<br>> index c53306a..1e75085 100644<br>> --- a/src/lib/src/fwts_framework.c<br>> +++ b/src/lib/src/fwts_framework.c<br>> @@ -605,8 +605,9 @@ static int fwts_framework_run_test(fwts_framework *fw, fwts_framework_test *test<br>>                                     goto done;<br>>                    }<br>><br>> -                 if (!fwts_firmware_has_features(test->fw_features)) {<br>> -                                  int missing = test->fw_features & ~fwts_firmware_features();<br>> +                 if (!fwts_firmware_has_features(fw, test->fw_features)) {<br>> +                                  int missing = test->fw_features &<br>> +                                                   ~fwts_firmware_features(fw);<br>>                                     fwts_log_info(fw, "Test skipped, missing features: %s",<br>>                                                      fwts_firmware_feature_string(missing));<br>>                                     fw->current_major_test->results.skipped +=<br>> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c<br>> index b501f7b..f62621a 100644<br>> --- a/src/lib/src/fwts_pipeio.c<br>> +++ b/src/lib/src/fwts_pipeio.c<br>> @@ -321,6 +321,35 @@ int fwts_exec(const char *command, int *status)<br>>   }<br>><br>>   /*<br>> + *                 fwts_exec2()<br>> + *                 execute a command<br>> + *                 Return to the parent/caller the exit status from the command<br>> + *                 status is -1 if errors.<br>> + */<br>> +<br>> +int fwts_exec2(const char *command, char **output)<br>> +{<br>> +                 pid_t   pid;<br>> +                 int     status = -1, in_fd, out_fd;<br>> +                 ssize_t out_len;<br>> +<br>> +                 if (fwts_pipe_open_rw(command, &pid,<br>> +                                  &in_fd, &out_fd) < 0) {<br>> +                                  return -1;<br>> +                 }<br>> +<br>> +                 if (fwts_pipe_readwrite(in_fd,<br>> +                                  command, sizeof(command),<br>> +                                  out_fd, output, &out_len)) {<br>> +                                  return -1;<br>> +                 }<br>> +<br>> +                 status = fwts_pipe_close2(in_fd, out_fd, pid);<br>> +<br>> +                 return status;<br>> +}<br>> +<br>> +/*<br>>    *  fwts_write_string_to_file()<br>>    *                 write a string to a file pointer<br>>    *                 Return FWTS_OK if writing worked, FWTS_ERROR if it failed.<br>> diff --git a/src/opal/prd_info.c b/src/opal/prd_info.c<br>> new file mode 100644<br>> index 0000000..2f12625<br>> --- /dev/null<br>> +++ b/src/opal/prd_info.c<br>> @@ -0,0 +1,188 @@<br>> +/*<br>> + * Copyright (C) 2010-2016 Canonical<br>> + * Some of this work - Copyright (C) 2016 IBM<br>> + *<br>> + * This program is free software; you can redistribute it and/or<br>> + * modify it under the terms of the GNU General Public License<br>> + * as published by the Free Software Foundation; either version 2<br>> + * of the License, or (at your option) any later version.<br>> + *<br>> + * This program is distributed in the hope that it will be useful,<br>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>> + * GNU General Public License for more details.<br>> + *<br>> + * You should have received a copy of the GNU General Public License<br>> + * along with this program; if not, write to the Free Software<br>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.<br>> + *<br>> + */<br>> +<br>> +#include <fcntl.h><br>> +#include <sys/ioctl.h><br>> +<br>> +#include <asm/opal-prd.h><br>> +<br>> +#include "fwts.h"<br>> +<br>> +static const char *prd_devnode = "/dev/opal-prd";<br>> +<br>> +bool prd_present(int fwts_prd_flags) {<br>> +                 return !access(prd_devnode, fwts_prd_flags);<br>> +}<br>> +<br>> +int prd_dev_query(fwts_framework *fw)<br>> +{<br>> +<br>> +                 int fd = 0;<br>> +                 struct opal_prd_info info;<br>> +<br>> +                 if ((fd = open(prd_devnode, O_RDWR)) < 0) {<br>> +                                  fwts_failed(fw, LOG_LEVEL_CRITICAL, "OPAL PRD Info",<br>> +                                                   "Cannot get data from the OPAL PRD "<br>> +                                                   " device interface,"<br>> +                                                   " check if opal-prd daemon may be in use "<br>> +                                                   "or check your user privileges.");<br>> +                                  return FWTS_ERROR;<br>> +                 }<br>> +<br>> +                 memset(&info, 0, sizeof(info));<br>> +<br>> +                 if (ioctl(fd, OPAL_PRD_GET_INFO, &info)) {<br>> +                                  close(fd);<br>> +                                  fwts_failed(fw, LOG_LEVEL_CRITICAL, "OPAL PRD Info",<br>> +                                                   "Cannot get data from the"<br>> +                                                   " OPAL PRD device interface.");<br>> +                                  return FWTS_ERROR;<br>> +                 } else {<br>> +                                  fwts_log_info(fw, "OPAL PRD Version is %lu",<br>> +                                                   info.version);<br>> +                                  close(fd);<br>> +                                  return FWTS_OK;<br>> +                 }<br>> +}<br>> +<br>> +static int prd_service_check(fwts_framework *fw, int *restart)<br>> +{<br>> +                 int rc = FWTS_OK, status = 0, stop_status = 0;<br>> +                 char *command = NULL;<br>> +                 char *output = NULL;<br>> +<br>> +                 command = "systemctl status opal-prd.service 2>&1";<br>> +                 status = fwts_exec2(command, &output);<br>> +<br>> +                 if (output)<br>> +                                  free(output);<br>> +<br>> +                 switch (status) {<br>> +                 case -1: /* status when nothing was successful */<br>> +                                  fwts_failed(fw, LOG_LEVEL_HIGH, "OPAL PRD Info",<br>> +                                                   "Attempt was made to stop the "<br>> +                                                   "opal-prd.service but was not "<br>> +                                                   "successful. Try to "<br>> +                                                   "\"sudo systemctl stop "<br>> +                                                   "opal-prd.service\" and retry.");<br>> +                                  rc = FWTS_ERROR;<br>> +                                  goto out;<br>> +                 case 0: /* "running" */<br>> +                                  command = "systemctl stop opal-prd.service 2>&1";<br>> +                                  stop_status = fwts_exec2(command, &output);<br>> +<br>> +                                  if (output)<br>> +                                                   free(output);<br>> +<br>> +                                  switch (stop_status) {<br>> +                                  case 0:<br>> +                        *restart = 1;<br>> +                        break;<br>> +                                  default:<br>> +                        fwts_failed(fw, LOG_LEVEL_HIGH, "OPAL PRD Info",<br>> +                                "Attempt was made to stop the "<br>> +                                "opal-prd.service but was not "<br>> +                                "successful. Try to "<br>> +                                "\"sudo systemctl stop "<br>> +                                "opal-prd.service\" and retry.");<br>> +                        rc = FWTS_ERROR;<br>> +                        goto out;<br>> +                                  }<br>> +                 default:<br>> +                                  break;<br>> +                 }<br>> +<br>> +out:<br>> +                 return rc;<br>> +}<br>> +<br>> +static int prd_restart(fwts_framework *fw)<br>> +{<br>> +                 int status = 0;<br>> +                 char *command = NULL;<br>> +                 char *output = NULL;<br>> +<br>> +                 command = "systemctl start opal-prd.service 2>&1";<br>> +                 status = fwts_exec2(command, &output);<br>> +<br>> +                 if (output)<br>> +                                  free(output);<br>> +<br>> +                 if (status) {<br>> +                                  fwts_log_info(fw, "OPAL PRD service (opal-prd.service)"<br>> +                                                   " was restarted after stopping it to allow "<br>> +                                                   "checks.  Please re-check since processing "<br>> +                                                   "was not able to be confirmed, "<br>> +                                                   "\"sudo systemctl status opal-prd.service\"");<br>> +                 } else {<br>> +                                  fwts_log_info(fw, "OPAL PRD service (opal-prd.service)"<br>> +                                                   " was restarted after stopping it to allow "<br>> +                                                   "checks.  This is informational only, "<br>> +                                                   "no action needed.");<br>> +                 }<br>> +<br>> +                 return status; /* ignored by caller */<br>> +}<br>> +<br>> +static int prd_info_test1(fwts_framework *fw)<br>> +{<br>> +<br>> +                 int restart = 0;<br>> +<br>> +                 if (prd_service_check(fw, &restart)) {<br>> +                                  /* failures logged in subroutine */<br>> +                                  return FWTS_ERROR;<br>> +                 }<br>> +<br>> +                 if (!prd_present(R_OK | W_OK)) {<br>> +                                  fwts_failed(fw, LOG_LEVEL_CRITICAL, "OPAL PRD Info",<br>> +                                                   "Cannot read and write to the OPAL PRD"<br>> +                                                   " device interface,"<br>> +                                                   " check your user privileges.");<br>> +                                  return FWTS_ERROR;<br>> +                 }<br>> +<br>> +                 if (prd_dev_query(fw)) {<br>> +                                  /* failures logged in subroutine */<br>> +                                  return FWTS_ERROR;<br>> +                 }<br>> +<br>> +                 if (restart) {<br>> +                                  prd_restart(fw); /* ignore rc */<br>> +                 }<br>> +<br>> +                 fwts_passed(fw, "OPAL PRD info passed.");<br>> +<br>> +                 return FWTS_OK;<br>> +}<br>> +<br>> +static fwts_framework_minor_test prd_info_tests[] = {<br>> +                 { prd_info_test1, "OPAL Processor Recovery Diagnostics Info" },<br>> +                 { NULL, NULL }<br>> +};<br>> +<br>> +static fwts_framework_ops prd_info_ops = {<br>> +                 .description = "OPAL Processor Recovery Diagnostics Info",<br>> +                 .minor_tests = prd_info_tests<br>> +};<br>> +<br>> +FWTS_REGISTER_FEATURES("prd_info", &prd_info_ops, FWTS_TEST_EARLY,<br>> +                                  FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV,<br>> +                                  FWTS_FW_FEATURE_OPAL_PRD)<br>><br><br>-- <br>fwts-devel mailing list<br>fwts-devel@lists.ubuntu.com<br>Modify settings or unsubscribe at: </tt><tt><a href="https://lists.ubuntu.com/mailman/listinfo/fwts-devel">https://lists.ubuntu.com/mailman/listinfo/fwts-devel</a></tt><tt><br></tt><br><br><BR>
</body></html>