diff -Nru ppc64-diag-2.7.1/debian/changelog ppc64-diag-2.7.1/debian/changelog --- ppc64-diag-2.7.1/debian/changelog 2016-07-05 10:30:27.000000000 -0500 +++ ppc64-diag-2.7.1/debian/changelog 2016-12-13 08:03:01.000000000 -0600 @@ -1,3 +1,18 @@ +ppc64-diag (2.7.1-5marvell1) UNRELEASED; urgency=medium + + * Add upstream patches to support Marvell HDD LEDs on S822LC for HPC (LP: #) + * debian/patches/marvell-leds-0001-add-support.patch + * debian/patches/marvell-leds-0002-handle-non-unique-loc.patch + * debian/patches/marvell-leds-0003-do-not-exit-early-sys-class-led.patch + * debian/patches/marvell-leds-0004-opal-call-all-get_indices-in-opal_get_indicator.patch + * debian/patches/marvell-leds-0005-validate-get-indicator-for-loc.patch + * debian/patches/marvell-leds-0006-remove-warning.patch + * debian/patches/marvell-leds-0007-check-for-dt-property.patch + * debian/patches/marvell-leds-0008-fix-test-case.patch + * debian/patches/marvell-leds-0009-volatile.patch + + -- Mauricio Faria de Oliveira Mon, 12 Dec 2016 18:51:12 -0200 + ppc64-diag (2.7.1-5) unstable; urgency=medium * Fixes for CVE-2014-4038 and CVE-2014-4039 diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0001-add-support.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0001-add-support.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0001-add-support.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0001-add-support.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,683 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/efb9a4df3f8860093eba61e823430f30fe5168e7/ +From: Mauricio Faria de Oliveira +Date: Wed, 9 Nov 2016 10:44:09 -0200 +Subject: [PATCH 1/8] lpd: Add support for Marvell HDD LEDs on S822LC for HPC + +This patch introduces support for the identification/fault LEDs of the +Marvell SATA HDD controller present in the IBM Power System S822LC for +HPC (a.k.a. Garrison/Minsky). + + indicator.h: add the indicator type 'TYPE_MARVELL'. + indicator_marvell.{h,c}: + implement the 'indicator' interface (get indices, + get/set indicator), and required hardware logic. + indicator_opal.c: call such interface on 'TYPE_MARVELL' devices. + Makefile.c: build and reference the indicator_marvell.o file. + +The code for the hardware logic is based on a sample code written by +Douglas Miller , acknowledged in indicator_marvell.c. + +Signed-off-by: Mauricio Faria de Oliveira +Signed-off-by: Vasant Hegde +--- + lpd/Makefile | 2 +- + lpd/indicator.h | 3 +- + lpd/indicator_marvell.c | 543 ++++++++++++++++++++++++++++++++++++++++++++++++ + lpd/indicator_marvell.h | 27 +++ + lpd/indicator_opal.c | 8 + + 5 files changed, 581 insertions(+), 2 deletions(-) + create mode 100644 lpd/indicator_marvell.c + create mode 100644 lpd/indicator_marvell.h + +diff --git a/lpd/Makefile b/lpd/Makefile +index 9390fd3da8ce..d6336fc9eee7 100644 +--- a/lpd/Makefile ++++ b/lpd/Makefile +@@ -9,7 +9,7 @@ CMDS = lp_diag usysident usysattn + COMMON_UTILS_OBJ = $(COMMON_DIR)/utils.o $(COMMON_DIR)/platform.o + + LPD_COMMON_OBJS = files.o lp_util.o indicator_ses.o indicator_rtas.o \ +- indicator_opal.o indicator.o ++ indicator_opal.o indicator_marvell.o indicator.o + COMMON_OBJS = $(COMMON_UTILS_OBJ) $(LPD_COMMON_OBJS) + + LP_DIAG_OBJS = servicelog.o lp_diag.o +diff --git a/lpd/indicator.h b/lpd/indicator.h +index 81ae98ce415b..b8b9208992d3 100644 +--- a/lpd/indicator.h ++++ b/lpd/indicator.h +@@ -43,7 +43,8 @@ + #define TYPE_SES 2 + #define TYPE_OS 3 + #define TYPE_OPAL 4 +-#define TYPE_EOL 5 ++#define TYPE_MARVELL 5 ++#define TYPE_EOL 6 + + /* Indicator state */ + #define LED_STATE_SAME -1 +diff --git a/lpd/indicator_marvell.c b/lpd/indicator_marvell.c +new file mode 100644 +index 000000000000..9903926d4cc9 +--- /dev/null ++++ b/lpd/indicator_marvell.c +@@ -0,0 +1,543 @@ ++/** ++ * @file indicator_marvell.c ++ * @brief Marvell HDD LEDs (indicators) manipulation routines ++ * ++ * Copyright (C) 2016 IBM Corporation ++ * ++ * 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. ++ * ++ * @author Mauricio Faria de Oliveira ++ * @author Douglas Miller ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "indicator.h" ++#include "lp_util.h" ++#include "utils.h" ++ ++/* ++ * Path to block devices in sysfs ++ */ ++#define SYS_BLOCK_PATH "/sys/block" ++ ++/* ++ * PCI IDs of the Marvell 9235 SATA controller in ++ * IBM Power System S822LC for HPC (Garrison/Minsky). ++ */ ++#define MV_PCI_VID "0x1b4b" ++#define MV_PCI_DID "0x9235" ++#define MV_PCI_SVID "0x1014" ++#define MV_PCI_SSID "0x0612" ++#define MV_PCI_ID_BUF_LEN 7 /* "0x3456" and '\0' */ ++ ++/* ++ * Vendor-Specific Registers (VSR) are accessed indirectly ++ * through a pair of registers in PCI BAR5. ++ * ++ * First, set the VSR address in VSR_ADDR; ++ * Then, read/write data from/to VSR_DATA. ++ */ ++static const uint32_t mv_pci_bar5_vsr_addr = 0xa8; ++static const uint32_t mv_pci_bar5_vsr_data = 0xac; ++static const uint32_t mv_pci_bar5_length = 2048; ++ ++/* ++ * The LEDs are controlled via GPIO pins or SATA link/activity status (default). ++ * ++ * This involves 3 VSRs: ++ * - The LED mode of a SATA port is set in the PORT_ACTIVE_SEL register. ++ * (either GPIO pin state or SATA link/activity status for all/one SATA port) ++ * - The GPIO pin state is set in the DATA_OUT register. ++ * - The GPIO pin state output is enabled in the DATA_OUT_ENABLE register. ++ * ++ * On Garrison/Minsky the identification LED of the SATA port 'N' is wired ++ * to the GPIO pin of the SATA port 'N + 2' (the max. number of disks is 2). ++ * The PORT_ACTIVE_SEL and DATA_OUT_ENABLE registers are set by default so ++ * that SATA ports 3 and 4 (that is, the identification LEDs of SATA ports ++ * 1 and 2) are GPIO-pin based, and only the DATA_OUT register needs to be ++ * modified to (un)light the identification LEDs (a.k.a. fault LEDs). ++ * ++ * Register information: ++ * ++ * GPIO Data Out: ++ * - 1 bit per GPIO pin (31-0) ++ * - default: 0x00000018 (all low, except for pins 3 and 4) ++ * - The LEDs are ON on low and OFF on high. ++ * ++ * GPIO Data Out Enable: ++ * - 1 bit per GPIO bin (31-0) ++ * - default: 0xffffffe7 (all high, except for pins 3 and 4) ++ * - active low (data output enabled on bit value 0) ++ * ++ * Port Active Enable (or Port GPIOx Active Select) ++ * - bits 31-30: reserved (zero) ++ * - bits 29-00: 10x 3-bit mode (SATA ports 9-0) ++ * - default: 0x2db6da8d ++ */ ++static const uint32_t mv_gpio_data_out = 0x07071020; ++static const uint32_t mv_gpio_data_out_enable = 0x07071024; ++static const uint32_t mv_gpio_port_active_sel = 0x07071058; ++ ++static const uint32_t mv_port_number_offset = 2; ++static const uint32_t mv_port_number_max = 9; ++ ++static const uint32_t mv_port_mode_gpio = 0x5; ++static const uint32_t mv_port_mode_max = 0x7; ++ ++static char *mv_port_mode[] = { ++ "All SATAx LINK and ACT", // 0x0 ++ "SATA0 LINK and ACT", // 0x1 ++ "SATA1 LINK and ACT", // 0x2 ++ "SATA2 LINK and ACT", // 0x3 ++ "SATA3 LINK and ACT", // 0x4 ++ "GPIO_DATA_OUT[n]", // 0x5 ++ "Invalid (6)", // 0x6 ++ "Invalid (7)" // 0x7 ++}; ++ ++/** ++ * mv_mmap_bar5 - open() and mmap() a PCI BAR5 (resource5) file. ++ * the caller should unmap/close (see mv_munmap_bar5()). ++ * ++ * @path path to the 'resource5' file ++ * @fd pointer to a file descriptor ++ * ++ * Return: ++ * - success: pointer to the mmap()'ed PCI BAR5 ++ * - failure: NULL ++ */ ++static void * ++mv_mmap_bar5(const char* path, int *fd) ++{ ++ void *bar5; ++ ++ /* open and mmap PCI BAR5 */ ++ *fd = open(path, O_RDWR); ++ if (*fd < 0) { ++ log_msg("Unable to open file '%s'", path); ++ return NULL; ++ } ++ ++ bar5 = mmap(NULL, mv_pci_bar5_length, PROT_READ | PROT_WRITE, ++ MAP_SHARED, *fd, 0); ++ if (bar5 == MAP_FAILED) { ++ log_msg("Unable to mmap file '%s'", path); ++ close(*fd); ++ return NULL; ++ } ++ ++ return bar5; ++} ++ ++/** ++ * mv_munmap_bar5 - munmap() and close() a PCI BAR5 (resource5) file. ++ * (release resources from mv_mmap_bar5()). ++ * ++ * @bar5 pointer to the mmap()'ed PCI BAR5 ++ * @fd file descriptor of the open()'ed/mmap()'ed PCI BAR5 ++ * ++ * Return: ++ * - nothing ++ */ ++static void ++mv_munmap_bar5(void *bar5, int fd) ++{ ++ /* munmap() and close PCI BAR5 */ ++ if (munmap(bar5, mv_pci_bar5_length)) ++ log_msg("Unable to munmap file"); ++ ++ if (close(fd)) ++ log_msg("Unable to close file"); ++} ++ ++/** ++ * mv_vsr_read - read a VSR ++ * ++ * @bar5 pointer to mmap()'ed PCI BAR5 (see mv_mmap_bar5()) ++ * @vsr_addr VSR address to read from ++ * ++ * Return: ++ * - VSR data read ++ */ ++static uint32_t ++mv_vsr_read(void* bar5, uint32_t vsr_addr) ++{ ++ uint32_t *addr = (uint32_t *)(bar5 + mv_pci_bar5_vsr_addr); ++ uint32_t *data = (uint32_t *)(bar5 + mv_pci_bar5_vsr_data); ++ ++ /* set address and read data */ ++ *addr = vsr_addr; ++ return *data; ++} ++ ++/** ++ * mv_vsr_write - write a VSR ++ * ++ * @bar5 pointer to mmap()'ed PCI BAR5 (see mv_mmap_bar5()) ++ * @vsr_addr VSR address to write to ++ * @vsr_data VSR data to write ++ * ++ * Return: ++ * - nothing ++ */ ++static void ++mv_vsr_write(void* bar5, uint32_t vsr_addr, uint32_t vsr_data) ++{ ++ uint32_t *addr = (uint32_t *)(bar5 + mv_pci_bar5_vsr_addr); ++ uint32_t *data = (uint32_t *)(bar5 + mv_pci_bar5_vsr_data); ++ ++ /* set address and write data */ ++ *addr = vsr_addr; ++ *data = vsr_data; ++} ++ ++/** ++ * mv_get_port_mode - get the LED mode of a SATA port (from register copy) ++ * ++ * @port_number number of the SATA port (0-9) ++ * @port_mode pointer to the LED mode (result) (see mv_port_mode[]) ++ * @port_active_sel copy of the PORT_ACTIVE_SEL register ++ * ++ * Return: ++ * - -1 on failure ++ * - 0 on success ++ */ ++static int ++mv_get_port_mode(uint32_t port_number, uint32_t *port_mode, ++ uint32_t port_active_sel) ++{ ++ uint32_t shift, mask; ++ ++ if (port_number > mv_port_number_max) { ++ log_msg("Invalid port number: '%u'", port_number); ++ return -1; ++ } ++ ++ /* get the 3-bit mode of SATA port N */ ++ shift = 3 * port_number; ++ mask = 0x7 << shift; ++ ++ *port_mode = (port_active_sel & mask) >> shift; ++ ++ return 0; ++} ++ ++/** ++ * check_pci_id() - checks the value of a PCI ID file. ++ * ++ * Return: ++ * - 0 on success (open/read file, and match value) ++ * - -1 on failure ++ * - +1 on different values ++ */ ++static int ++check_pci_id(char *path, char *pci_id) ++{ ++ FILE *f; ++ char *pci_id_rc, pci_id_buf[MV_PCI_ID_BUF_LEN]; ++ ++ f = fopen(path, "r"); ++ if (!f) { ++ log_msg("Unable to open file '%s'", path); ++ return -1; ++ } ++ ++ pci_id_rc = fgets(pci_id_buf, MV_PCI_ID_BUF_LEN, f); ++ if (!pci_id_rc) { ++ log_msg("Unable to read file '%s'", path); ++ fclose(f); ++ return -1; ++ } ++ ++ fclose(f); ++ return !!strncmp(pci_id, pci_id_buf, MV_PCI_ID_BUF_LEN); ++} ++ ++/** ++ * mv_indicator_list - Build Marvell HDD LED (indicator) list for the given disk vpd ++ * ++ * @list loc_code structure ++ * @vpd dev_vpd structure ++ * ++ * Return: ++ * - 0 on success or skip vpd (not a Marvell SATA disk) ++ * - -1 on failure ++ */ ++static int ++mv_indicator_list(struct loc_code **list, struct dev_vpd *vpd) ++{ ++ struct loc_code *list_curr, *list_new; ++ char path[PATH_MAX], symlink[PATH_MAX]; ++ char *ata_device, *host; ++ ssize_t len; ++ ++ /* check for an 'sdX' device name */ ++ if (strncmp(vpd->dev, "sd", 2)) ++ return 0; ++ ++ /* read the '/sys/block/sdX' symlink to '../device/pci.../sdX' */ ++ snprintf(path, PATH_MAX, "%s/%s", SYS_BLOCK_PATH, vpd->dev); ++ ++ len = readlink(path, symlink, PATH_MAX); ++ if (len < 0) { ++ log_msg("Unable to read the contents of symbolic link '%s'", path); ++ return -1; ++ } ++ symlink[len] = '\0'; ++ ++ /* ++ * check for an 'ataX' subdir (w/ trailing 'X' digit); for example 'ata1' in ++ * '../devices/pci<...>/0001:08:00.0/ata1/host3/target3:0:0/3:0:0:0/block/sdj' ++ */ ++ ++ ata_device = strstr(symlink, "/ata"); ++ if (!ata_device || !isdigit(ata_device[4])) ++ return 0; ++ ++ host = strstr(symlink, "/host"); ++ if (!host || !isdigit(host[5])) ++ return 0; ++ ++ /* split symlink into relative path for PCI device dir and ataX device */ ++ ata_device[0] = '\0'; /* end symlink on leading '/' of '/ataX/' */ ++ ata_device++; /* skip the leading '/' of '/ataX/' */ ++ host[0] = '\0'; /* end ata_device on trailing '/' of '/ataX/', ++ * which is the leading '/' of '/hostY/' */ ++ ++ /* ++ * get the absolute path for the PCI device dir from symlink, ++ * which is relative to /sys/block (e.g., '../devices/pci...'), ++ * so skip the leading '../' (3 chars) ++ */ ++ len = snprintf(path, PATH_MAX, "%s/%s", "/sys", &symlink[3]); ++ if (len < 0) { ++ log_msg("Unable to format absolute pathname of '%s'", symlink); ++ return -1; ++ } ++ ++ /* ++ * check for the PCI IDs of the Marvell 9235 SATA controller. ++ * ++ * concatenate the PCI ID files' basename after the dirname ++ * with strncpy() (string length + 1 for '\0'). ++ */ ++ strncpy(&path[len], "/vendor", 8); ++ if (check_pci_id(path, MV_PCI_VID)) ++ return 0; ++ ++ strncpy(&path[len], "/device", 8); ++ if (check_pci_id(path, MV_PCI_DID)) ++ return 0; ++ ++ strncpy(&path[len], "/subsystem_vendor", 18); ++ if (check_pci_id(path, MV_PCI_SVID)) ++ return 0; ++ ++ strncpy(&path[len], "/subsystem_device", 18); ++ if (check_pci_id(path, MV_PCI_SSID)) ++ return 0; ++ ++ path[len] = '\0'; /* restore path as dirname of PCI device dir */ ++ ++ /* Allocate one loc_code element, and insert/append it to the list */ ++ list_new = calloc(1, sizeof(struct loc_code)); ++ if (!list_new) { ++ log_msg("Out of memory"); ++ return 1; ++ } ++ ++ if (*list) { ++ /* position list_curr in the last element of the list */ ++ list_curr = *list; ++ while (list_curr->next) ++ list_curr = list_curr->next; ++ ++ /* append the new element to the list */ ++ list_curr->next = list_new; ++ } else { ++ /* null list; insert the new element at the list head */ ++ *list = list_new; ++ } ++ ++ /* set the new element's properties */ ++ list_new->type = TYPE_MARVELL; ++ strncpy(list_new->code, vpd->location, LOCATION_LENGTH); /* loc. code */ ++ strncpy(list_new->devname, vpd->dev, DEV_LENGTH); /* sdX device name */ ++ snprintf(list_new->dev, DEV_LENGTH, "%s/resource5", path); /* PCI BAR5 */ ++ list_new->index = (uint32_t)atoi(&ata_device[3]); /* use for ATA index */ ++ ++ dbg("Marvell HDD LED:"); ++ dbg("- location code: '%s'", list_new->code); ++ dbg("- device name (disk): '%s'", list_new->devname); ++ dbg("- device name (pci bar5): '%s'", list_new->dev); ++ dbg("- ata index: '%u'", list_new->index); ++ ++ return 0; ++} ++ ++/** ++ * get_mv_indices - Get Marvell HDD LEDs (indicators) list ++ * ++ * @indicator led type ++ * @loc_list loc_code structure ++ * ++ * Return: ++ * - nothing ++ */ ++void ++get_mv_indices(int indicator, struct loc_code **loc_list) ++{ ++ struct dev_vpd *vpd_list, *vpd_curr; ++ ++ /* support for identification LEDs only */ ++ if (indicator != LED_TYPE_IDENT) ++ return; ++ ++ /* get block devices' vpd information */ ++ vpd_list = read_device_vpd(SYS_BLOCK_PATH); ++ if (!vpd_list) ++ return; ++ ++ /* search for Marvell HDDs, and append to the list */ ++ for (vpd_curr = vpd_list; vpd_curr; vpd_curr = vpd_curr->next) ++ if (vpd_curr->location[0] != '\0') ++ if (mv_indicator_list(loc_list, vpd_curr)) ++ break; ++ ++ free_device_vpd(vpd_list); ++} ++ ++/** ++ * get_mv_indicator - get Marvell HDD LED/indicator state ++ * ++ * @loc loc_code structure ++ * @state return indicator state of given loc ++ * ++ * Return: ++ * - 0 on success ++ * - -1 on failure ++ */ ++int ++get_mv_indicator(int indicator, struct loc_code *loc, int *state) ++{ ++ int fd; ++ void *bar5; ++ uint32_t data_out, data_out_enable, active_sel; ++ uint32_t port_number, port_mode; ++ ++ /* support for identification LEDs only */ ++ if (indicator != LED_TYPE_IDENT) ++ return -1; ++ ++ /* read registers from PCI BAR5 */ ++ bar5 = mv_mmap_bar5(loc->dev, &fd); ++ if (!bar5) ++ return -1; /* log_msg() done */ ++ ++ /* for debugging, read the 3 VSRs; only DATA_OUT is required */ ++ data_out = mv_vsr_read(bar5, mv_gpio_data_out); ++ data_out_enable = mv_vsr_read(bar5, mv_gpio_data_out_enable); ++ active_sel = mv_vsr_read(bar5, mv_gpio_port_active_sel); ++ ++ /* for debugging, get the LED mode of the SATA port 'N + offset' */ ++ port_number = loc->index + mv_port_number_offset; ++ ++ if (mv_get_port_mode(port_number, &port_mode, active_sel)) ++ return -1; /* log_msg() done */ ++ ++ dbg("SATA disk '%s'", (loc->devname) ? loc->devname : "(null)"); ++ dbg("Data Out: '0x%08x'", data_out); ++ dbg("Data Out Enable: '0x%08x'", data_out_enable); ++ dbg("Port Active Select: '0x%08x'", active_sel); ++ dbg("ATA Index: '%u', Port Number: '%u', Port Mode: '%u' ('%s')", ++ loc->index, port_number, port_mode, mv_port_mode[port_mode]); ++ ++ /* LED state: ON on low (bit 0) and OFF on high (bit 1) */ ++ *state = (data_out & (1 << port_number)) ? LED_STATE_OFF : LED_STATE_ON; ++ ++ mv_munmap_bar5(bar5, fd); ++ return 0; ++} ++ ++/** ++ * set_mv_indicator - set Marvell HDD LED/indicator state ++ * ++ * @loc loc_code structure ++ * @state value to update indicator to ++ * ++ * Return: ++ * - 0 on success ++ * - -1 on failure ++ */ ++int ++set_mv_indicator(int indicator, struct loc_code *loc, int new_value) ++{ ++ int fd; ++ void *bar5; ++ uint32_t data_out, port_number; ++ ++ /* support for identification LEDs only */ ++ if (indicator != LED_TYPE_IDENT) ++ return -1; ++ ++ /* sanity check */ ++ if (new_value != LED_STATE_ON && new_value != LED_STATE_OFF) ++ return -1; ++ ++ /* read/write registers from/to PCI BAR5 */ ++ bar5 = mv_mmap_bar5(loc->dev, &fd); ++ if (!bar5) ++ return -1; /* log_msg() done */ ++ ++ /* ++ * only changes to the DATA_OUT register are required with the default ++ * values for the DATA_OUT_ENABLE and PORT_ACTIVE_SEL registers on the ++ * Garrison/Minsky system (see header comments). ++ */ ++ data_out = mv_vsr_read(bar5, mv_gpio_data_out); ++ ++ /* set the LED state of the SATA port 'N + offset' */ ++ port_number = loc->index + mv_port_number_offset; ++ ++ /* set/clear the bit in the DATA_OUT register; ++ * LED state: ON on low (bit 0) and OFF on high (bit 1) */ ++ if (new_value == LED_STATE_ON) ++ data_out &= ~(1 << port_number); ++ else ++ data_out |= 1 << port_number; ++ ++ /* update the register */ ++ mv_vsr_write(bar5, mv_gpio_data_out, data_out); ++ ++ /* for debugging, read the register again after writing */ ++ dbg("Data Out (written to): '0x%08x'", data_out); ++ data_out = mv_vsr_read(bar5, mv_gpio_data_out); ++ dbg("Data Out (read again): '0x%08x'", data_out); ++ ++ mv_munmap_bar5(bar5, fd); ++ return 0; ++} +diff --git a/lpd/indicator_marvell.h b/lpd/indicator_marvell.h +new file mode 100644 +index 000000000000..9175e7bb4d8b +--- /dev/null ++++ b/lpd/indicator_marvell.h +@@ -0,0 +1,27 @@ ++/** ++ * Copyright (C) 2016 IBM Corporation ++ * ++ * 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. ++ */ ++ ++#ifndef INDICATOR_MARVELL_H ++#define INDICATOR_MARVELL_H ++ ++/* Marvell HDD LEDs (indicators) support */ ++extern void get_mv_indices(int, struct loc_code **); ++extern int get_mv_indicator(int, struct loc_code *, int *); ++extern int set_mv_indicator(int, struct loc_code *, int); ++ ++#endif /* INDICATOR_MARVELL_H */ +diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c +index 707bed0d86f5..123a1b292ba0 100644 +--- a/lpd/indicator_opal.c ++++ b/lpd/indicator_opal.c +@@ -33,6 +33,7 @@ + + #include "indicator.h" + #include "indicator_ses.h" ++#include "indicator_marvell.h" + + /* LED directory */ + #define OPAL_LED_SYSFS_PATH "/sys/class/leds" +@@ -400,6 +401,9 @@ opal_get_indicator_list(int indicator, struct loc_code **list) + /* SES indicators */ + get_ses_indices(indicator, list); + ++ /* Marvell HDD LEDs (indicators) */ ++ get_mv_indices(indicator, list); ++ + return rc; + } + +@@ -421,6 +425,8 @@ opal_get_indicator_state(int indicator, struct loc_code *loc, int *state) + return opal_get_indicator(loc, state); + case TYPE_SES: + return get_ses_indicator(indicator, loc, state); ++ case TYPE_MARVELL: ++ return get_mv_indicator(indicator, loc, state); + default: + break; + } +@@ -449,6 +455,8 @@ opal_set_indicator_state(int indicator, struct loc_code *loc, int new_value) + return opal_set_indicator(loc, new_value); + case TYPE_SES: + return set_ses_indicator(indicator, loc, new_value); ++ case TYPE_MARVELL: ++ return set_mv_indicator(indicator, loc, new_value); + default: + break; + } +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0002-handle-non-unique-loc.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0002-handle-non-unique-loc.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0002-handle-non-unique-loc.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0002-handle-non-unique-loc.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,126 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/627287130fabacd185e10d7fbfad5113dba34d44/ +From: Mauricio Faria de Oliveira +Date: Wed, 9 Nov 2016 10:44:10 -0200 +Subject: [PATCH 2/8] lpd: marvell: handle non-unique/duplicate location codes + +On some systems, it's been observed that different disks of the Marvell +SATA HDD controller might be listed with the very same location code. + +This could cause an user to specify a device by location code, and have +the wrong device identified; if the service operation is a hotplug/pull +the disk, that error would cause serious problems. + +Even though this might be a problem that requires a fix elsewhere, it's +still possible to support such scenario, with the usysident option that +specify the element by device name (e.g., '-d sda') instead of location +code (e.g., '-l -B0-T0-L0'). + +This patch adds a simple check and workaround for that -- restricted to +the Marvell devices (TYPE_MARVELL); once a device match is found: + +- if the device is specified by device name, + then proceed normally. + +- if the device is specified by location code, + then check for other devices with this location code. + + - if not found, + then proceed normally. + + - else, + stop, and ask the user to specify the device name with '-d'. + +Signed-off-by: Mauricio Faria de Oliveira +Signed-off-by: Vasant Hegde +--- + lpd/usysident.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 47 insertions(+), 1 deletion(-) + +diff --git a/lpd/usysident.c b/lpd/usysident.c +index 9eed94636650..e3dcad0250c1 100644 +--- a/lpd/usysident.c ++++ b/lpd/usysident.c +@@ -113,6 +113,7 @@ main(int argc, char **argv) + char *othervalue = NULL; + struct loc_code *current; + struct loc_code *list = NULL; ++ struct loc_code *list_start = NULL; + + program_name = argv[0]; + if (probe_indicator() != 0) +@@ -345,12 +346,14 @@ main(int argc, char **argv) + strncpy(temp, lvalue, LOCATION_LENGTH); + temp[LOCATION_LENGTH - 1] = '\0'; + ++ list_start = list; + retry: +- current = get_indicator_for_loc_code(list, lvalue); ++ current = get_indicator_for_loc_code(list_start, lvalue); + if (!current) { + if (trunc) { + if (truncate_loc_code(lvalue)) { + truncated = 1; ++ list_start = list; /* start again */ + goto retry; + } + } +@@ -363,6 +366,48 @@ retry: + fprintf(stdout, "Truncated location code : " + "%s\n", lvalue); + ++ if (current->type == TYPE_MARVELL) { ++ ++ /* ++ * On some systems... ++ * The Marvell SATA HDD controller may have one location code ++ * for all disks. So, in order to uniquely identify a disk in ++ * the list, the -d (dvalue) option must be used. ++ * ++ * eg, if the -l (lvalue) option is used then the ++ * first disk in that location code will match, and it might ++ * be the wrong disk! ++ * ++ * So, check if there is another list entry in this system ++ * with the same location code as the current entry; if so, ++ * only handle Marvell devices if '-d ' is used. ++ */ ++ if (!dvalue && ++ get_indicator_for_loc_code(current->next, lvalue)) { ++ fprintf(stdout, "The Marvell HDD LEDs must be " ++ "specified by device name (-d option);" ++ " non-unique location codes found.\n"); ++ rc = 1; ++ goto no_retry; ++ } ++ ++ /* ++ * At this point, after the check for "if (dvalue && lvalue)", ++ * if dvalue is non-NULL then lvalue is from get_loc_code_dev() ++ * (based on device name: dvalue), and dvalue is from cmdline. ++ * ++ * So, if dvalue is non-NULL and doesn't match the device name ++ * specified in 'current' (found location code), let's try the ++ * next elements in the list (which may match the device name); ++ * for this we need to retry, re-starting on the next element. ++ */ ++ if (dvalue && current->devname && ++ strncmp(dvalue, current->devname, DEV_LENGTH)) { ++ list_start = current->next; ++ goto retry; ++ } ++ } ++ + if (svalue) { + rc = get_indicator_state(indicator, current, + &state); +@@ -388,6 +433,7 @@ retry: + } + } /* if-else end */ + } /* lvalue end */ ++no_retry: + + /* Turn on/off all indicators */ + if (othervalue) { +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0003-do-not-exit-early-sys-class-led.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0003-do-not-exit-early-sys-class-led.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0003-do-not-exit-early-sys-class-led.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0003-do-not-exit-early-sys-class-led.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,108 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/d56f7f1367bd6634605fd65997170252696178fa/ +From: Mauricio Faria de Oliveira +Date: Wed, 9 Nov 2016 10:44:11 -0200 +Subject: [PATCH 3/8] lpd: marvell: do not exit early on empty /sys/class/leds + dir (OPAL) + +Some systems/conditions have no kernel LEDs present (thus nothing in +the /sys/class/leds directory), which would cause usysident to early +exit in the OPAL platform, and not give a chance for other LED types +(e.g., Marvell HDD LEDs) to be used. + +This patch adds a check for that in the OPAL platform probe function, +and in case Marvell HDD devices are found, prevent usysident to exit +early, so they can be used. + +Signed-off-by: Mauricio Faria de Oliveira +Signed-off-by: Vasant Hegde +--- + lpd/indicator_opal.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 51 insertions(+), 4 deletions(-) + +diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c +index 123a1b292ba0..712f57fea4e4 100644 +--- a/lpd/indicator_opal.c ++++ b/lpd/indicator_opal.c +@@ -280,15 +280,15 @@ opal_set_indicator(struct loc_code *loc, int new_value) + return 0; + } + +- + /* +- * opal_indicator_probe - Probe indicator support on OPAL based platform ++ * opal_indicator_probe_led_class - Probe LED class (/sys/class/leds) ++ * indicator support on OPAL based platform + * + * Returns: + * 0 if indicator is supported, else -1 + */ + static int +-opal_indicator_probe(void) ++opal_indicator_probe_led_class(void) + { + int rc = -1; + DIR *led_dir; +@@ -314,12 +314,59 @@ opal_indicator_probe(void) + return 0; + } + +- fprintf(stderr, "Service indicators are not supported on this system." ++ fprintf(stderr, "Some service indicators are not supported on this system." + "\nMake sure 'leds_powernv' kernel module is loaded.\n"); + close_sysfs_led_dir(led_dir); + return rc; + } + ++/* ++ * opal_indicator_probe_marvell - Probe Marvell indicator support on ++ * OPAL based platform ++ * ++ * Returns: ++ * 0 if indicator is supported, else -1 ++ */ ++static int ++opal_indicator_probe_marvell(void) ++{ ++ struct loc_code *list = NULL; ++ ++ get_mv_indices(LED_TYPE_IDENT, &list); ++ if (list) { ++ free_indicator_list(list); ++ return 0; ++ } ++ ++ return -1; ++} ++ ++/* ++ * opal_indicator_probe - Probe indicator support on OPAL based platform ++ * ++ * Returns: ++ * 0 if indicator is supported, else -1 ++ */ ++static int ++opal_indicator_probe(void) ++{ ++ int rc = -1; ++ ++ if (!opal_indicator_probe_led_class()) ++ rc = 0; ++ ++ /* ++ * Marvell HDD LEDs are not presented/controlled via kernel LEDs ++ * (i.e., /sys/class/leds), and some OPAL systems might not have ++ * any kernel LEDs (e.g., modules not loaded) but still have the ++ * Marvell SATA controller with LEDs available, and able to work. ++ */ ++ if (!opal_indicator_probe_marvell()) ++ rc = 0; ++ ++ return rc; ++} ++ + /** + * opal_get_indicator_mode - Gets the service indicator operating mode + * +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0004-opal-call-all-get_indices-in-opal_get_indicator.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0004-opal-call-all-get_indices-in-opal_get_indicator.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0004-opal-call-all-get_indices-in-opal_get_indicator.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0004-opal-call-all-get_indices-in-opal_get_indicator.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,74 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/53f12274da2c239017d6c4180caab155f2b7f72c/ +From: Mauricio Faria de Oliveira +Date: Thu, 17 Nov 2016 21:06:42 -0200 +Subject: [PATCH 4/8] lpd: opal: call all get_indices() in + opal_get_indicator_list() + +Dont return early in opal_get_indicator_list() in case any of +the get_indices() call happens to fail. Let's go through all +the calls to ensure any other pending/possible indicator that +can work still goes into the list. + +Signed-off-by: Mauricio Faria de Oliveira +[ We do not support FRU fault indicator in Guiding Light Mode. All current + OPAL systems supports Light Path Mode. Just to be safe I've reintroduced + LED mode check - Vasant] +Signed-off-by: Vasant Hegde +--- + lpd/indicator_opal.c | 25 +++++++++++-------------- + 1 file changed, 11 insertions(+), 14 deletions(-) + +diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c +index 712f57fea4e4..e683f830ed24 100644 +--- a/lpd/indicator_opal.c ++++ b/lpd/indicator_opal.c +@@ -423,27 +423,20 @@ opal_get_indicator_mode(void) + static int + opal_get_indicator_list(int indicator, struct loc_code **list) + { +- int rc; +- + /* + * We treat first indicator in fault indicator list as + * check log indicator. Hence parse attention indicator. + */ +- if (indicator == LED_TYPE_FAULT) { +- rc = opal_get_indices(LED_TYPE_ATTN, list); +- if (rc) +- return rc; +- } +- +- /* Get OPAL indicator list */ +- rc = opal_get_indices(indicator, list); +- if (rc) +- return rc; ++ if (indicator == LED_TYPE_FAULT) ++ opal_get_indices(LED_TYPE_ATTN, list); + + /* FRU fault indicators are not supported in Guiding Light mode */ + if (indicator == LED_TYPE_FAULT && + operating_mode == LED_MODE_GUIDING_LIGHT) +- return rc; ++ return 0; ++ ++ /* Get OPAL indicator list */ ++ opal_get_indices(indicator, list); + + /* SES indicators */ + get_ses_indices(indicator, list); +@@ -451,7 +444,11 @@ opal_get_indicator_list(int indicator, struct loc_code **list) + /* Marvell HDD LEDs (indicators) */ + get_mv_indices(indicator, list); + +- return rc; ++ /* ++ * The list pointer (*list) is initially NULL. ++ * If it's not-NULL here, we found indicators. ++ */ ++ return !(*list); + } + + /** +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0005-validate-get-indicator-for-loc.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0005-validate-get-indicator-for-loc.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0005-validate-get-indicator-for-loc.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0005-validate-get-indicator-for-loc.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,35 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/82a6a8c966b9ea31bdf6bc2997fa3f530bda1300/ +From: Vasant Hegde +Date: Thu, 17 Nov 2016 21:01:57 +0530 +Subject: [PATCH 5/8] lpd: Validate get_indicator_for_loc_code() return value + +Just to be on safer side, validate get_indicator_for_loc_code() return +value. + +Signed-off-by: Vasant Hegde +--- + lpd/lp_diag.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lpd/lp_diag.c b/lpd/lp_diag.c +index cce8e8705c80..c80f3029a2ff 100644 +--- a/lpd/lp_diag.c ++++ b/lpd/lp_diag.c +@@ -758,6 +758,14 @@ UI_commit(WINDOW *my_menu_win, MENU *my_menu, + if (!strcmp(desc, "loc")) { + name = (char *)item_name(items[i]); + loc = get_indicator_for_loc_code(ident_list, name); ++ if (!loc) { ++ if (cur_state[i] == '+') { ++ cur_state[i] = prev_state[i]; ++ err = 1; ++ } ++ continue; ++ } ++ + rc = get_indicator_state(LED_TYPE_IDENT, loc, &ident); + if (rc) { + if (cur_state[i] == '+') { +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0006-remove-warning.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0006-remove-warning.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0006-remove-warning.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0006-remove-warning.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,34 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/d88b88735bd724bddc4d31bfb4806bdac267aa22/ +From: Vasant Hegde +Date: Mon, 21 Nov 2016 13:47:28 +0530 +Subject: [PATCH 6/8] lpd: Remove redundant warning message + +We will be able to support indicators from other sources (like HDD) +even though OPAL platform indicators are not present. + +Also leds_powernv driver is loaded automatically if we have platform +support. + +Hence remove this message. + +Signed-off-by: Vasant Hegde +--- + lpd/indicator_opal.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c +index e683f830ed24..77d7260ef518 100644 +--- a/lpd/indicator_opal.c ++++ b/lpd/indicator_opal.c +@@ -314,8 +314,6 @@ opal_indicator_probe_led_class(void) + return 0; + } + +- fprintf(stderr, "Some service indicators are not supported on this system." +- "\nMake sure 'leds_powernv' kernel module is loaded.\n"); + close_sysfs_led_dir(led_dir); + return rc; + } +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0007-check-for-dt-property.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0007-check-for-dt-property.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0007-check-for-dt-property.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0007-check-for-dt-property.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,35 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/22e8e4edd4c253c6e31fca78c5b2e32108af6755/ +From: Vasant Hegde +Date: Mon, 21 Nov 2016 13:54:20 +0530 +Subject: [PATCH 7/8] lpd: Check for device tree property + +Not all OPAL system supports OPAL leds. Check the existence of DT +property before using. Also if DT property doesn't exists, then +assume its in Light Path mode. + +Signed-off-by: Vasant Hegde +--- + lpd/indicator_opal.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c +index 77d7260ef518..8eabb0bfad80 100644 +--- a/lpd/indicator_opal.c ++++ b/lpd/indicator_opal.c +@@ -378,6 +378,13 @@ opal_get_indicator_mode(void) + int rc = 0; + int fd; + int readsz; ++ struct stat sbuf; ++ ++ rc = stat(OPAL_LED_MODE_PROPERTY, &sbuf); ++ if (rc) { ++ operating_mode = LED_MODE_LIGHT_PATH; ++ return 0; ++ } + + fd = open(OPAL_LED_MODE_PROPERTY, O_RDONLY); + if (fd == -1) { +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0008-fix-test-case.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0008-fix-test-case.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0008-fix-test-case.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0008-fix-test-case.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,34 @@ +Origin: upstream, https://sourceforge.net/p/linux-diag/ppc64-diag/ci/727c17f75033790f8f4c98fe45edc829c84b3833/ +From: Vasant Hegde +Date: Mon, 21 Nov 2016 16:49:55 +0530 +Subject: [PATCH 8/8] lpd/test: Fix test case + +Commit 4c7400ba added Marvell HDD LED code, but forgot to update test +dir Makefile. Though we don't support fault LED on Marvell HDD, we +need to update test/Makefile, else compilation will fail. + +I think we have to rewrite part of test code. But that's for some other day. + +Fixes: 4c7400ba (lpd: Add support for Marvell HDD LEDs on S822LC for HPC) +CC: Mauricio Faria de Oliveira +Signed-off-by: Vasant Hegde +--- + lpd/test/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lpd/test/Makefile b/lpd/test/Makefile +index c855426cf7af..5c599fb0ecae 100644 +--- a/lpd/test/Makefile ++++ b/lpd/test/Makefile +@@ -16,7 +16,7 @@ LPD_DIR = $(ROOT_DIR)/lpd + COMMON_OBJS = $(COMMON_DIR)/utils.o $(COMMON_DIR)/platform.o + LPD_OBJS = $(COMMON_OBJS) ../files.o ../lp_util.o ../indicator_ses.o \ + ../indicator_rtas.o ../indicator_opal.o ../indicator.o \ +- ../servicelog.o ++ ../servicelog.o ../indicator_marvell.o + + LED_TOOL_OBJS = ledtool.o + SES_TOOL_OBJS = sesdevices.o +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/marvell-leds-0009-volatile.patch ppc64-diag-2.7.1/debian/patches/marvell-leds-0009-volatile.patch --- ppc64-diag-2.7.1/debian/patches/marvell-leds-0009-volatile.patch 1969-12-31 18:00:00.000000000 -0600 +++ ppc64-diag-2.7.1/debian/patches/marvell-leds-0009-volatile.patch 2016-12-13 08:03:01.000000000 -0600 @@ -0,0 +1,80 @@ +origin: upstream, https://sourceforge.net/p/linux-diag/mailman/linux-diag-devel/thread/1481635687-6436-1-git-send-email-mauricfo%40linux.vnet.ibm.com/#msg35548869 +From: Mauricio Faria de Oliveira +Date: Tue, 13 Dec 2016 11:05:16 -0200 +Subject: [PATCH] lpd: marvell: mark the indirect-access registers as volatile + +In optimization level -O3, a sequence of VSR read/write operations +can be incorrectly optimized away as the compiler doesn't know the +underlying memory locations can change and react to read/writes. + +So, mark the pointers used to read/write to the indirect-access +registers which access the VSRs with the 'volatile' keyword. + +Test-cases: +---------- + +CFLAGS=-O2 (default) + + # make + # LPD_DEBUG=1 ./lpd/usysident + ... + DEBUG: get_mv_indicator(): Data Out: '0x00000018' + DEBUG: get_mv_indicator(): Data Out Enable: '0xffffffe7' + DEBUG: get_mv_indicator(): Port Active Select: '0x2db6da8d' + ... + +CFLAGS=-O3 + + # rm lpd/indicator_marvell.o + # CFLAGS='-O3' make + # LPD_DEBUG=1 ./lpd/usysident + ... + DEBUG: get_mv_indicator(): Data Out: '0x2db6da8d' + DEBUG: get_mv_indicator(): Data Out Enable: '0x2db6da8d' + DEBUG: get_mv_indicator(): Port Active Select: '0x2db6da8d' + ... + +CFLAGS=-O3 (patched) + + # rm lpd/indicator_marvell.o + # CFLAGS='-O3' make + # LPD_DEBUG=1 ./lpd/usysident + ... + DEBUG: get_mv_indicator(): Data Out: '0x00000018' + DEBUG: get_mv_indicator(): Data Out Enable: '0xffffffe7' + DEBUG: get_mv_indicator(): Port Active Select: '0x2db6da8d' + +Signed-off-by: Mauricio Faria de Oliveira +--- + lpd/indicator_marvell.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lpd/indicator_marvell.c b/lpd/indicator_marvell.c +index ec2580a73f03..ace808dde53f 100644 +--- a/lpd/indicator_marvell.c ++++ b/lpd/indicator_marvell.c +@@ -183,8 +183,8 @@ mv_munmap_bar5(void *bar5, int fd) + static uint32_t + mv_vsr_read(void* bar5, uint32_t vsr_addr) + { +- uint32_t *addr = (uint32_t *)(bar5 + mv_pci_bar5_vsr_addr); +- uint32_t *data = (uint32_t *)(bar5 + mv_pci_bar5_vsr_data); ++ volatile uint32_t *addr = (uint32_t *)(bar5 + mv_pci_bar5_vsr_addr); ++ volatile uint32_t *data = (uint32_t *)(bar5 + mv_pci_bar5_vsr_data); + + /* set address and read data */ + *addr = vsr_addr; +@@ -204,8 +204,8 @@ mv_vsr_read(void* bar5, uint32_t vsr_addr) + static void + mv_vsr_write(void* bar5, uint32_t vsr_addr, uint32_t vsr_data) + { +- uint32_t *addr = (uint32_t *)(bar5 + mv_pci_bar5_vsr_addr); +- uint32_t *data = (uint32_t *)(bar5 + mv_pci_bar5_vsr_data); ++ volatile uint32_t *addr = (uint32_t *)(bar5 + mv_pci_bar5_vsr_addr); ++ volatile uint32_t *data = (uint32_t *)(bar5 + mv_pci_bar5_vsr_data); + + /* set address and write data */ + *addr = vsr_addr; +-- +1.8.3.1 + diff -Nru ppc64-diag-2.7.1/debian/patches/series ppc64-diag-2.7.1/debian/patches/series --- ppc64-diag-2.7.1/debian/patches/series 2016-07-05 10:24:13.000000000 -0500 +++ ppc64-diag-2.7.1/debian/patches/series 2016-12-13 08:03:01.000000000 -0600 @@ -6,3 +6,12 @@ manpage-space-character-is-not-allowed-in-an-escape-name.patch CVE-2014-4038.patch CVE-2014-4039.patch +marvell-leds-0001-add-support.patch +marvell-leds-0002-handle-non-unique-loc.patch +marvell-leds-0003-do-not-exit-early-sys-class-led.patch +marvell-leds-0004-opal-call-all-get_indices-in-opal_get_indicator.patch +marvell-leds-0005-validate-get-indicator-for-loc.patch +marvell-leds-0006-remove-warning.patch +marvell-leds-0007-check-for-dt-property.patch +marvell-leds-0008-fix-test-case.patch +marvell-leds-0009-volatile.patch