get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 633504,
    "url": "http://patchwork.ozlabs.org/api/patches/633504/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/skiboot/patch/1465535032-26749-8-git-send-email-gwshan@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": "<1465535032-26749-8-git-send-email-gwshan@linux.vnet.ibm.com>",
    "list_archive_url": null,
    "date": "2016-06-10T05:03:36",
    "name": "[v12,07/23] core/fdt: Introduce opal_get_device_tree()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ee6a2cc4c4e15d8803191cfb5b4d488fe568703e",
    "submitter": {
        "id": 63923,
        "url": "http://patchwork.ozlabs.org/api/people/63923/?format=api",
        "name": "Gavin Shan",
        "email": "gwshan@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/skiboot/patch/1465535032-26749-8-git-send-email-gwshan@linux.vnet.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/633504/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/633504/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 [103.22.144.68])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rQqr81Z3Nz9sD3\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 10 Jun 2016 15:05:44 +1000 (AEST)",
            "from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3rQqr80mb3zDqHH\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 10 Jun 2016 15:05:44 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\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 3rQqqM63sXzDqPP\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:05:03 +1000 (AEST)",
            "from pps.filterd (m0098404.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id\n\tu5A53qPf052375\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 01:05:02 -0400",
            "from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 23fm5xu0um-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 01:05:01 -0400",
            "from localhost\n\tby e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <skiboot@lists.ozlabs.org> from <gwshan@linux.vnet.ibm.com>;\n\tFri, 10 Jun 2016 15:04:59 +1000",
            "from d23dlp01.au.ibm.com (202.81.31.203)\n\tby e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tFri, 10 Jun 2016 15:04:56 +1000",
            "from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33])\n\tby d23dlp01.au.ibm.com (Postfix) with ESMTP id 283E22CE805C\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:04:51 +1000 (EST)",
            "from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])\n\tby d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tu5A54jdg7602516\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:04:45 +1000",
            "from d23av02.au.ibm.com (localhost [127.0.0.1])\n\tby d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tu5A54e1H024888\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:04:40 +1000",
            "from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14])\n\tby d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tu5A54bQm024687; Fri, 10 Jun 2016 15:04:40 +1000",
            "from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114])\n\tby ozlabs.au.ibm.com (Postfix) with ESMTP id C8D6CA0192;\n\tFri, 10 Jun 2016 15:03:56 +1000 (AEST)",
            "from gwshan (shangw.ozlabs.ibm.com [10.61.2.199])\n\tby bran.ozlabs.ibm.com (Postfix) with ESMTP id C68AFE3B1A;\n\tFri, 10 Jun 2016 15:03:56 +1000 (AEST)",
            "by gwshan (Postfix, from userid 1000)\n\tid AC3EE942CA3; Fri, 10 Jun 2016 15:03:56 +1000 (AEST)"
        ],
        "X-IBM-Helo": "d23dlp01.au.ibm.com",
        "X-IBM-MailFrom": "gwshan@linux.vnet.ibm.com",
        "X-IBM-RcptTo": "skiboot@lists.ozlabs.org",
        "From": "Gavin Shan <gwshan@linux.vnet.ibm.com>",
        "To": "skiboot@lists.ozlabs.org",
        "Date": "Fri, 10 Jun 2016 15:03:36 +1000",
        "X-Mailer": "git-send-email 2.1.0",
        "In-Reply-To": "<1465535032-26749-1-git-send-email-gwshan@linux.vnet.ibm.com>",
        "References": "<1465535032-26749-1-git-send-email-gwshan@linux.vnet.ibm.com>",
        "X-TM-AS-MML": "disable",
        "X-Content-Scanned": "Fidelis XPS MAILER",
        "x-cbid": "16061005-0040-0000-0000-000001B049DE",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "16061005-0041-0000-0000-000009D76CCF",
        "Message-Id": "<1465535032-26749-8-git-send-email-gwshan@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2016-06-10_04:, , 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-1604210000\n\tdefinitions=main-1606100058",
        "Subject": "[Skiboot] [PATCH v12 07/23] core/fdt: Introduce\n\topal_get_device_tree()",
        "X-BeenThere": "skiboot@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.22",
        "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": "alistair@popple.id.au",
        "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": "This introduces OPAL API opal_get_device_tree() to get the device\nsub-tree. It's going to be used in PCI hot add path.\n\nSigned-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>\nReviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>\n---\n core/fdt.c                                | 40 +++++++++++++++++++++++++++++++\n doc/opal-api/opal-get-device-tree-118.txt | 24 +++++++++++++++++++\n include/opal-api.h                        |  3 ++-\n 3 files changed, 66 insertions(+), 1 deletion(-)\n create mode 100644 doc/opal-api/opal-get-device-tree-118.txt",
    "diff": "diff --git a/core/fdt.c b/core/fdt.c\nindex 71149fe..a22a840 100644\n--- a/core/fdt.c\n+++ b/core/fdt.c\n@@ -216,3 +216,43 @@ void *create_dtb(const struct dt_node *root, bool exclusive)\n \n \treturn fdt;\n }\n+\n+static int64_t opal_get_device_tree(uint32_t phandle,\n+\t\t\t\t    uint64_t buf, uint64_t len)\n+{\n+\tstruct dt_node *root;\n+\tvoid *fdt = (void *)buf;\n+\tuint32_t old_last_phandle;\n+\tint64_t totalsize;\n+\tint ret;\n+\n+\troot = dt_find_by_phandle(dt_root, phandle);\n+\tif (!root)\n+\t\treturn OPAL_PARAMETER;\n+\n+\tif (!fdt) {\n+\t\tfdt = create_dtb(root, true);\n+\t\tif (!fdt)\n+\t\t\treturn OPAL_INTERNAL_ERROR;\n+\t\ttotalsize = fdt_totalsize(fdt);\n+\t\tfree(fdt);\n+\t\treturn totalsize;\n+\t}\n+\n+\tif (!len)\n+\t\treturn OPAL_PARAMETER;\n+\n+\tfdt_error = 0;\n+\told_last_phandle = last_phandle;\n+\tret = __create_dtb(fdt, len, root, true);\n+\tif (ret) {\n+\t\tlast_phandle = old_last_phandle;\n+\t\tif (ret == -FDT_ERR_NOSPACE)\n+\t\t\treturn OPAL_NO_MEM;\n+\n+\t\treturn OPAL_EMPTY;\n+\t}\n+\n+\treturn OPAL_SUCCESS;\n+}\n+opal_call(OPAL_GET_DEVICE_TREE, opal_get_device_tree, 3);\ndiff --git a/doc/opal-api/opal-get-device-tree-118.txt b/doc/opal-api/opal-get-device-tree-118.txt\nnew file mode 100644\nindex 0000000..235a321\n--- /dev/null\n+++ b/doc/opal-api/opal-get-device-tree-118.txt\n@@ -0,0 +1,24 @@\n+OPAL_GET_DEVICE_TREE\n+--------------------\n+\n+Get device sub-tree\n+\n+Parameters:\n+\tuint32_t phandle: root device node phandle of the device sub-tree\n+\tuint64_t buf: FDT blob buffer or NULL\n+\tuint64_t len: length of the FDT blob buffer\n+\n+Calling:\n+\n+Retrieve device sub-tree. The root node's phandle is identified by @phandle.\n+The typical use is for the kernel to update its device tree following a change\n+in hardware (e.g. PCI hotplug).\n+\n+Return Codes:\n+\n+FDT blob size - returned FDT blob buffer size when @buf is NULL\n+OPAL_SUCCESS - FDT blob is created successfully\n+OPAL_PARAMETER - invalid argument @phandle or @len\n+OPAL_INTERNAL_ERROR - failure creating FDT blob when calculating its size\n+OPAL_NO_MEM - not enough room in buffer for device sub-tree\n+OPAL_EMPTY - failure creating FDT blob\ndiff --git a/include/opal-api.h b/include/opal-api.h\nindex 0b7b0bb..41af0e5 100644\n--- a/include/opal-api.h\n+++ b/include/opal-api.h\n@@ -163,7 +163,8 @@\n #define OPAL_LEDS_SET_INDICATOR\t\t\t115\n #define OPAL_CEC_REBOOT2\t\t\t116\n #define OPAL_CONSOLE_FLUSH\t\t\t117\n-#define OPAL_LAST\t\t\t\t117\n+#define OPAL_GET_DEVICE_TREE\t\t\t118\n+#define OPAL_LAST\t\t\t\t118\n \n /* Device tree flags */\n \n",
    "prefixes": [
        "v12",
        "07/23"
    ]
}