get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/806403/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 806403,
    "url": "http://patchwork.ozlabs.org/api/patches/806403/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/skiboot/patch/20170828064949.19791-1-hegdevasant@linux.vnet.ibm.com/",
    "project": {
        "id": 44,
        "url": "http://patchwork.ozlabs.org/api/projects/44/?format=api",
        "name": "skiboot firmware development",
        "link_name": "skiboot",
        "list_id": "skiboot.lists.ozlabs.org",
        "list_email": "skiboot@lists.ozlabs.org",
        "web_url": "http://github.com/open-power/skiboot",
        "scm_url": "http://github.com/open-power/skiboot",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170828064949.19791-1-hegdevasant@linux.vnet.ibm.com>",
    "list_archive_url": null,
    "date": "2017-08-28T06:49:49",
    "name": "[v2] DT: Add ibm,firmware-versions node",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "eccccf4256b43c4a713e6b05c69fd36b01106aa8",
    "submitter": {
        "id": 22361,
        "url": "http://patchwork.ozlabs.org/api/people/22361/?format=api",
        "name": "Vasant Hegde",
        "email": "hegdevasant@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/skiboot/patch/20170828064949.19791-1-hegdevasant@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 88,
            "url": "http://patchwork.ozlabs.org/api/series/88/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/skiboot/list/?series=88",
            "date": "2017-08-28T06:49:49",
            "name": "[v2] DT: Add ibm,firmware-versions node",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/88/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806403/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806403/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "skiboot@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "skiboot@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgj9D2c7Cz9sN7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 16:51:28 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xgj9D1Q8DzDqM1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 16:51:28 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xgj8s191HzDq7q\n\tfor <skiboot@lists.ozlabs.org>; Mon, 28 Aug 2017 16:51:08 +1000 (AEST)",
            "from pps.filterd (m0098417.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7S6ooJx113950\n\tfor <skiboot@lists.ozlabs.org>; Mon, 28 Aug 2017 02:51:06 -0400",
            "from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cmcr1kjgx-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <skiboot@lists.ozlabs.org>; Mon, 28 Aug 2017 02:51:03 -0400",
            "from localhost\n\tby e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <skiboot@lists.ozlabs.org> from <hegdevasant@linux.vnet.ibm.com>; \n\tMon, 28 Aug 2017 16:50:04 +1000",
            "from d23relay06.au.ibm.com (202.81.31.225)\n\tby e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tMon, 28 Aug 2017 16:50:02 +1000",
            "from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97])\n\tby d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tv7S6o1Qd36241446\n\tfor <skiboot@lists.ozlabs.org>; Mon, 28 Aug 2017 16:50:01 +1000",
            "from d23av03.au.ibm.com (localhost [127.0.0.1])\n\tby d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tv7S6nrY8016139\n\tfor <skiboot@lists.ozlabs.org>; Mon, 28 Aug 2017 16:49:53 +1000",
            "from hegdevasant.in.ibm.com ([9.109.222.253])\n\tby d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tv7S6npGj016096; Mon, 28 Aug 2017 16:49:52 +1000"
        ],
        "From": "Vasant Hegde <hegdevasant@linux.vnet.ibm.com>",
        "To": "skiboot@lists.ozlabs.org",
        "Date": "Mon, 28 Aug 2017 12:19:49 +0530",
        "X-Mailer": "git-send-email 2.9.3",
        "X-TM-AS-MML": "disable",
        "x-cbid": "17082806-0004-0000-0000-0000022B8B11",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17082806-0005-0000-0000-00005E128802",
        "Message-Id": "<20170828064949.19791-1-hegdevasant@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-28_03:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=3\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708280110",
        "Subject": "[Skiboot] [PATCH v2] DT: Add ibm,firmware-versions node",
        "X-BeenThere": "skiboot@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "Mailing list for skiboot development <skiboot.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/skiboot/>",
        "List-Post": "<mailto:skiboot@lists.ozlabs.org>",
        "List-Help": "<mailto:skiboot-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "sam@mendozajonas.com, Mukesh Ojha <mukesh02@linux.vnet.ibm.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"
    },
    "content": "In P8, hostboot provides mini device tree. It contains /ibm,firmware-versions\nnode which has various firmware component version details.\n\nIn P9, OPAL is building device tree. This patch adds support to parse VERSION\nsection of PNOR and create \"/ibm,firmware-versions\" device tree node.\n\nSample output:\n\t/sys/firmware/devicetree/base/ibm,firmware-versions # lsprop .\n\tocc              \"6a00709\"\n\tskiboot          \"v5.7-rc1-p344fb62\"\n\tbuildroot        \"2017.02.2-7-g23118ce\"\n\tcapp-ucode       \"9c73e9f\"\n\tpetitboot        \"v1.4.3-p98b6d83\"\n\tsbe              \"02021c6\"\n\topen-power       \"witherspoon-v1.17-128-gf1b53c7-dirty\"\n\t....\n\t....\n\nSigned-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>\nSigned-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>\n---\nChanges in v2:\n  - Used load_resource functions to load VERSION section from PNOR - Thanks Stewart.\n\n-Vasant\n\n core/flash.c              | 108 ++++++++++++++++++++++++++++++++++++++++++++++\n include/platform.h        |   1 +\n include/skiboot.h         |   3 ++\n platforms/astbmc/common.c |   6 +++\n 4 files changed, 118 insertions(+)",
    "diff": "diff --git a/core/flash.c b/core/flash.c\nindex 53e6eba..7b34000 100644\n--- a/core/flash.c\n+++ b/core/flash.c\n@@ -19,6 +19,7 @@\n #include <lock.h>\n #include <opal.h>\n #include <opal-msg.h>\n+#include <platform.h>\n #include <device.h>\n #include <libflash/libflash.h>\n #include <libflash/libffs.h>\n@@ -47,6 +48,10 @@ static struct lock flash_lock;\n static struct flash *nvram_flash;\n static u32 nvram_offset, nvram_size;\n \n+/* ibm,firmware-versions support */\n+static char *version_buf;\n+static size_t version_buf_size = 0x1000;\n+\n bool flash_reserve(void)\n {\n \tbool rc = false;\n@@ -148,6 +153,108 @@ out:\n \treturn rc;\n }\n \n+static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data)\n+{\n+\tchar *prop;\n+\tint version_len, i;\n+\tint len = strlen(data);\n+\tconst char * version_str[] = {\"open-power\", \"buildroot\", \"skiboot\",\n+\t\t\t\t      \"hostboot-binaries\", \"hostboot\", \"linux\",\n+\t\t\t\t      \"petitboot\", \"occ\", \"capp-ucode\", \"sbe\"};\n+\n+\t/*\n+\t * PNOR version strings are not easily consumable. Split them into\n+\t * property, value.\n+\t *\n+\t * Example input from PNOR :\n+\t *   \"open-power-firestone-v1.8\"\n+\t *   \"linux-4.4.6-openpower1-8420e0f\"\n+\t *\n+\t * Desired output in device tree:\n+\t *   open-power = \"firestone-v1.8\";\n+\t *   linux = \"4.4.6-openpower1-8420e0f\";\n+\t */\n+\tfor(i = 0; i < ARRAY_SIZE(version_str); i++)\n+\t{\n+\t\tversion_len = strlen(version_str[i]);\n+\t\tif (len < version_len)\n+\t\t\tcontinue;\n+\n+\t\tif (memcmp(data, version_str[i], version_len) != 0)\n+\t\t\tcontinue;\n+\n+\t\t/* Found a match, add property */\n+\t\tif (dt_find_property(fw_version, version_str[i]))\n+\t\t\tcontinue;\n+\n+\t\t/* Increment past \"key-\" */\n+\t\tprop = data + version_len + 1;\n+\t\tdt_add_property_string(fw_version, version_str[i], prop);\n+\t}\n+}\n+\n+void flash_dt_add_fw_version(void)\n+{\n+\tuint8_t version_data[80];\n+\tint rc;\n+\tint numbytes = 0, i = 0;\n+\tstruct dt_node *fw_version;\n+\n+\tif (version_buf == NULL)\n+\t\treturn;\n+\n+\trc = wait_for_resource_loaded(RESOURCE_ID_VERSION, RESOURCE_SUBID_NONE);\n+\tif (rc != OPAL_SUCCESS) {\n+\t\tprlog(PR_WARNING, \"FLASH: Failed to load VERSION data\\n\");\n+\t\tfree(version_buf);\n+\t\treturn;\n+\t}\n+\n+\tfw_version = dt_new(dt_root, \"ibm,firmware-versions\");\n+\tassert(fw_version);\n+\n+\tfor ( ; (numbytes < version_buf_size) && version_buf[numbytes]; numbytes++) {\n+\t\tif (version_buf[numbytes] == '\\n') {\n+\t\t\tversion_data[i] = '\\0';\n+\t\t\t__flash_dt_add_fw_version(fw_version, version_data);\n+\t\t\tmemset(version_data, 0, sizeof(version_data));\n+\t\t\ti = 0;\n+\t\t\tcontinue;\n+\t\t} else if (version_buf[numbytes] == '\\t') {\n+\t\t\tcontinue; /* skip tabs */\n+\t\t}\n+\n+\t\tversion_data[i++] = version_buf[numbytes];\n+\t}\n+\n+\tfree(version_buf);\n+}\n+\n+void flash_fw_version_preload(void)\n+{\n+\tint rc;\n+\n+\tif (proc_gen < proc_gen_p9)\n+\t\treturn;\n+\n+\tprlog(PR_INFO, \"FLASH: Loading VERSION section\\n\");\n+\n+\tversion_buf = malloc(version_buf_size);\n+\tif (!version_buf) {\n+\t\tprlog(PR_WARNING, \"FLASH: Failed to allocate memory\\n\");\n+\t\treturn;\n+\t}\n+\n+\trc = start_preload_resource(RESOURCE_ID_VERSION, RESOURCE_SUBID_NONE,\n+\t\t\t\t    version_buf, &version_buf_size);\n+\tif (rc != OPAL_SUCCESS) {\n+\t\tprlog(PR_WARNING,\n+\t\t      \"FLASH: Failed to start loading VERSION data\\n\");\n+\t\tfree(version_buf);\n+\t\tversion_buf = NULL;\n+\t}\n+}\n+\n static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs)\n {\n \tuint32_t start, size, part;\n@@ -422,6 +529,7 @@ static struct {\n \t{ RESOURCE_ID_INITRAMFS,RESOURCE_SUBID_NONE,\t\t\"ROOTFS\" },\n \t{ RESOURCE_ID_CAPP,\tRESOURCE_SUBID_SUPPORTED,\t\"CAPP\" },\n \t{ RESOURCE_ID_IMA_CATALOG,  RESOURCE_SUBID_SUPPORTED,\t\"IMA_CATALOG\" },\n+\t{ RESOURCE_ID_VERSION,\tRESOURCE_SUBID_NONE,\t\t\"VERSION\" },\n };\n \n \ndiff --git a/include/platform.h b/include/platform.h\nindex e6ebb13..f3af390 100644\n--- a/include/platform.h\n+++ b/include/platform.h\n@@ -28,6 +28,7 @@ enum resource_id {\n \tRESOURCE_ID_INITRAMFS,\n \tRESOURCE_ID_CAPP,\n \tRESOURCE_ID_IMA_CATALOG,\n+\tRESOURCE_ID_VERSION,\n };\n #define RESOURCE_SUBID_NONE 0\n #define RESOURCE_SUBID_SUPPORTED 1\ndiff --git a/include/skiboot.h b/include/skiboot.h\nindex 4b7d519..0ab9f38 100644\n--- a/include/skiboot.h\n+++ b/include/skiboot.h\n@@ -243,6 +243,9 @@ extern int flash_subpart_info(void *part_header, uint32_t header_len,\n \t\t\t      uint32_t part_size, uint32_t *part_actual,\n \t\t\t      uint32_t subid, uint32_t *offset,\n \t\t\t      uint32_t *size);\n+extern void flash_fw_version_preload(void);\n+extern void flash_dt_add_fw_version(void);\n+\n /* NVRAM support */\n extern void nvram_init(void);\n extern void nvram_read_complete(bool success);\ndiff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c\nindex ed725ce..456908f 100644\n--- a/platforms/astbmc/common.c\n+++ b/platforms/astbmc/common.c\n@@ -134,6 +134,9 @@ void astbmc_init(void)\n \tastbmc_fru_init();\n \tipmi_sensor_init();\n \n+\t/* Prelaod PNOR VERSION section */\n+\tflash_fw_version_preload();\n+\n \t/* As soon as IPMI is up, inform BMC we are in \"S0\" */\n \tipmi_set_power_state(IPMI_PWR_SYS_S0_WORKING, IPMI_PWR_NOCHANGE);\n \n@@ -144,6 +147,9 @@ void astbmc_init(void)\n \n \t/* Setup UART console for use by Linux via OPAL API */\n \tset_opal_console(&uart_opal_con);\n+\n+\t/* Add ibm,firmware-versions node */\n+\tflash_dt_add_fw_version();\n }\n \n int64_t astbmc_ipmi_power_down(uint64_t request)\n",
    "prefixes": [
        "v2"
    ]
}