get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1600609,
    "url": "http://patchwork.ozlabs.org/api/patches/1600609/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20220303204400.2787389-10-sean.anderson@seco.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20220303204400.2787389-10-sean.anderson@seco.com>",
    "list_archive_url": null,
    "date": "2022-03-03T20:43:52",
    "name": "[09/17] arm: smh: Add some file manipulation commands",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5b7134d96ca854245da6872a6ee0e297d8898468",
    "submitter": {
        "id": 80860,
        "url": "http://patchwork.ozlabs.org/api/people/80860/?format=api",
        "name": "Sean Anderson",
        "email": "sean.anderson@seco.com"
    },
    "delegate": {
        "id": 3651,
        "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api",
        "username": "trini",
        "first_name": "Tom",
        "last_name": "Rini",
        "email": "trini@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20220303204400.2787389-10-sean.anderson@seco.com/mbox/",
    "series": [
        {
            "id": 288836,
            "url": "http://patchwork.ozlabs.org/api/series/288836/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=288836",
            "date": "2022-03-03T20:43:44",
            "name": "arm: semihosting: Cleanups and new features",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/288836/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1600609/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1600609/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "bilbo.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=seco.com header.i=@seco.com header.a=rsa-sha256\n header.s=selector1 header.b=shmEvfDM;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)",
            "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=seco.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=seco.com header.i=@seco.com header.b=\"shmEvfDM\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=seco.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=sean.anderson@seco.com",
            "dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=seco.com;"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4K8jh21M2Wz9sG1\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  4 Mar 2022 07:46:26 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 9E81983CB4;\n\tThu,  3 Mar 2022 21:45:00 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id E6BA483CBF; Thu,  3 Mar 2022 21:44:41 +0100 (CET)",
            "from EUR02-AM5-obe.outbound.protection.outlook.com\n (mail-am5eur02on060a.outbound.protection.outlook.com\n [IPv6:2a01:111:f400:fe07::60a])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id D94DF838FC\n for <u-boot@lists.denx.de>; Thu,  3 Mar 2022 21:44:29 +0100 (CET)",
            "from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27)\n by AM6PR03MB3573.eurprd03.prod.outlook.com (2603:10a6:209:2f::10) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar\n 2022 20:44:28 +0000",
            "from DB7PR03MB4523.eurprd03.prod.outlook.com\n ([fe80::9130:93ae:6e27:e9a]) by DB7PR03MB4523.eurprd03.prod.outlook.com\n ([fe80::9130:93ae:6e27:e9a%4]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022\n 20:44:28 +0000"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,\n T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2",
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=k+0QL9z3vx63LG/NEUW/8eAdPC74NG2XQ/stn1gjGTIkG55nl0TdEEByC7Gxln9QJ3Ooi4FJRCqisQzRXut7OWeS4//FOsaZoWVJsRXLlPrkilcPbQ5Ovg21IlWLRyTzGG02Pf5dQwGnxQVaTTMlZ+wbzeLprv7g3IT7hJkm5r4OUjntBLk0WjlVj2LUA1r3lmbT52Q75vFi4BXzSRRkcqJ8Nxd038x1uAHgXBF110TObHmV4XAaQJaVOv0p5LyviGFfYa9hes9kO4GtdCrbYp09U9+w0o0ETgXudgp0wUldOQY30E7AE39TuIgGHadJLDZi+xIy/wm18Tx9jGYAcA==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=cw2YYdPY2te+vtKnQtt0KN9oDzng/7i8BKfAfFGeTuU=;\n b=LcsxutDHinc5FdCxk4XD2uqElkcqA0aZo/FQildmadVs3lqKKfrx2aFdx73+wE11Z/oSXyyudcsUmFgMCXBtzN5dFWaHph8f83C+sdxxNtNOPBIE6krolkz2q/SsWX+cr9ohVoOVFSg5OWH0TVzK1qtfi5ngSIGkekxIvilXWTF3ep9KfmQLRLJjH2+cL3AD7tIld3beKYtZsmwavrvvBaSbpqhOCyohcsy3tALm3e1qxWFJ3v0M//9Jje1V7Mp3dQAFeGe74Wa1Co8CoqS2QcsXJCfiAUX+HOMezs0RgaMHaV/5A3Q+eqDlAyYg1Zcb9K0EoUaEf5flmxLzzgeKQA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com;\n dkim=pass header.d=seco.com; arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=cw2YYdPY2te+vtKnQtt0KN9oDzng/7i8BKfAfFGeTuU=;\n b=shmEvfDMKm0CmIdQbijmWqCSi0N2V6sRzmIDc7dPkx8H2jeO1frSNBrgmExt6S0KefaVYXGaH7KKVFW+0pYHGZFTDLXIwCYE5uxr4CFQf99YG3zvWIbMux+tDpRXx6t17/Lzaz5zjZpuPniIEPMBbZp5GZiHKCRd4D2OXdh342pPr8bDVmHjShDhZzkR1Sx+/vCpp6xcQ8hRBVlnm/EHN1EnBH2lJ0YU8FAQ/4FXjML+b8Ftp9TMP1vwI4DOEmLM+o4qIW6kDjUiFmj7BTOrqtCXkSdGxNoHC72aWK7R7G2nxVW0S2XAyDvzuJGsS0VnZ/3SaSJAF7PBQn5Sz3xglw==",
        "From": "Sean Anderson <sean.anderson@seco.com>",
        "To": "Simon Glass <sjg@chromium.org>",
        "Cc": "Linus Walleij <linus.walleij@linaro.org>, Tom Rini <trini@konsulko.com>,\n u-boot@lists.denx.de, Sean Anderson <sean.anderson@seco.com>",
        "Subject": "[PATCH 09/17] arm: smh: Add some file manipulation commands",
        "Date": "Thu,  3 Mar 2022 15:43:52 -0500",
        "Message-Id": "<20220303204400.2787389-10-sean.anderson@seco.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220303204400.2787389-1-sean.anderson@seco.com>",
        "References": "<20220303204400.2787389-1-sean.anderson@seco.com>",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-ClientProxiedBy": "MN2PR16CA0013.namprd16.prod.outlook.com\n (2603:10b6:208:134::26) To DB7PR03MB4523.eurprd03.prod.outlook.com\n (2603:10a6:10:19::27)",
        "MIME-Version": "1.0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "c74c2de4-0e6e-46a7-a678-08d9fd569c8b",
        "X-MS-TrafficTypeDiagnostic": "AM6PR03MB3573:EE_",
        "X-Microsoft-Antispam-PRVS": "\n <AM6PR03MB357312C019A04C83D7FC6B7496049@AM6PR03MB3573.eurprd03.prod.outlook.com>",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n j04DVhUJpzt9ENo58HIaVvy5mcGfN1UuuhkvJAdwED85YCLUi8gK4xujrQvl5he0ci2GfJJXqSCVSaSkaDS8cx9PNrwGAoOizmIKwNPM2HSDtN4c9XhKwOlZGJvOBhODckGhGYbWXxHa4HAgeY+wEWkIGKF28ZB092G0A9YqovkyrA9JsHVbY+JQtFAsZ/QuNXYEfq+HUaNL0uwVS4hEMOV4glAe6WfMGv2WJLv8dwJMVj9M7SxonA1avd3w3rbeVZtga7q8/GhIcbCie3D/hnnHFM0mG2Fdk/2dQeG+iAzRlieTGvmP6orSCVb9Snok8Arr8QxDUBuoBRpABOQ5FUAp7FVmeaITmy2RhVKtxEHJMBhcH95/F0y5XDlQ6NfokKHNNrSxi7NZLAObVjRmDACTT15JByWJuXuSq2kWswlApkY5uQKcImrQ7f6c0hfjBVOHFO4kLh+gpSj7jhRssWA7CH6SidqmswyNY+bJkwptpWpGo9/opmi1Ui+g+AEfyj9f/Z4T/UhN50qOIc/oaR+RJmbTb2CuYIlLntayKKP9/jbpQ6Pw9n/GLpYOyORpna3xi3wV0E8z1OYT3OcnkuiLICFfmPJLSBHhjuIsoorng4T3/JGC993TWs8cYXi2Po/iE2NwYqn2X+yXoyuBrE1Xug3YJr/+2vSK4wQTgMXnNFSeXeo8Afjcb9+C9iiVPkgos8t4849T92bzERfkPA==",
        "X-Forefront-Antispam-Report": "CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE;\n SFS:(13230001)(366004)(6916009)(36756003)(54906003)(1076003)(2616005)(83380400001)(316002)(38100700002)(38350700002)(186003)(26005)(107886003)(4326008)(6506007)(6666004)(508600001)(6512007)(2906002)(52116002)(86362001)(5660300002)(6486002)(8676002)(44832011)(66476007)(66946007)(66556008)(8936002);\n DIR:OUT; SFP:1101;",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1",
        "X-MS-Exchange-AntiSpam-MessageData-0": "\n 3UV8UjumsfN28BmYjNNVy7odFQSBkZrR27/KM1BIuhS+mlsyniqvQQCiqIVVncXW1WrD97zqQnNuYSbaKmjhiYyyssTvi7YOWi3FrZHKg4s5SVK0x1rFYkGbBmILOb77t1v5Dx44k4RmJvpcwo4bcklJAcItxBWmQS/IRkmub5j50q6hMDl+Iz0zmd/DDTcSmpwLFF0Xi9F93ui6SlEqVfLOBXS0ZroKtz72lSPbOcjck4O0lTYTABuRkxesgAeeQN3YKY6NgddmnU8RDo4rmuXDygb+3/V1R8I3JaZgaStpQaX70/OVKwZCyr6JRXAomklkKsUXyvK1JYC07iQHG6o/MNLxK6zXk+Ni0GxXpr4qdESBPpTSCWTExnZrzMwoJTOc7vSOtTVtnEjWW/6Av5AxRop90RdtTFWjR/SVoGYSOxQV+D4yf/NEJD7xQt4zRz/1OxmW0lQM7ahxPYU0X7Y88MUwpFufpumDc6Qh/xCecFyl73m+MmKPtgosSOvAt/uxbisjlXCx9/69s3VVp/pffgSg85VGuitQe0HK9YuBzUS1DPbTcxDKJkc8CFJBLAlpwFTj9OJmRHgWhHaWWv0LSzMfAvh2Xn7tBHZmBl7ljVxbomGWSCRw4vGejGdCBlkntw54xAiUr2MIp395/O9E+dViROe4idxnZe7BDud3Q8nWQlwHJmlpS809VTWeY4Lild2blJJrtmVUKDMwCqPg8H1bW88xM0vH/L2gU3T3jwHEIpF1/5XW3NNJFxBLaIn+BP7dx1MAoTzhYAEVgPaBbIjNO9zWgKEBT8Ti5LhHUHI0v+AAeDORwxNAs6PODzV+K4y/4wxPz96v08xyh5G7Uhu0ZGzN0KpcAVmE8xCZk9lBnUQbBPtPfXMK1ZV3Q/m8/+pY1WUlgI4dhXBNoHxbdrTdsvkgd33Zout3booedwdN6x1TMtKN4uwL+8FKHkAKKW1HsFpE/qdH8e4a9V7SGyyDWNcYl7B5NZ+KDKGfAbIlvH98v0mMXE0NiUe4GnX5xH65siXqNCuuPX/D9aYEfT/Rt8LsGdoITOHO0atGn6QIFbfgHt01IZ5nxOJd3VCQ/DTDG7HpZujbjP0ZDdoFm2g3VthvTshGNSTJxqU2kGe8gAtonM2VidrlISSemffPj281dNFggf0iR8N0TTcqrOkILFThzYNqhPPWU/PgajclErKZNRJQxNJMsVEVlb5i3iDqEL8SDyMeP93mI7cAH+K6dom1P27ELdFUJqAMT2gKyYgvNu0EaSep84YA8UCeXGuB/WYJJG5LBws1VhvPdJiwFe64YoWbN9AiO5fGlr7xyG3Y1F+TbrODQ0ugfJtnyGEnE98+BA3AeGhCoZYSFVzB4EqFWFTPx6btpcxaa8WJ9EKsMz9Xg3bcIPL6SqIXG/asI3UtiV7GUD6WVuU/C3V7It6v3NF+gZcz4zljpbQYH8ezrdIzeZMW2d8C2xcadFBUZanjW/0WTw+Vp3HXIncp3kZvpSr6zBuino+BpJCdpoiv5HC5f0o/748NtN7K3AG4KsV1qrMJJPDDhygw3vOQzmFLFpREHlOjp8Aefq8U+SdyHao3bCAG9EPA4b7krGEKfspWk1n5A5Dxhpomc0P5t8j7OM20ZZKsrMc=",
        "X-OriginatorOrg": "seco.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n c74c2de4-0e6e-46a7-a678-08d9fd569c8b",
        "X-MS-Exchange-CrossTenant-AuthSource": "DB7PR03MB4523.eurprd03.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Internal",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "03 Mar 2022 20:44:28.6767 (UTC)",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted",
        "X-MS-Exchange-CrossTenant-Id": "bebe97c3-6438-442e-ade3-ff17aa50e733",
        "X-MS-Exchange-CrossTenant-MailboxType": "HOSTED",
        "X-MS-Exchange-CrossTenant-UserPrincipalName": "\n IlNjYKETtC8yvnRmh8rzG3Z586502c8h9azQZWedbggzrWZP7u5+pn/MU8upal0Jg9oH9JuDG0wfWLF3tjQz5g==",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "AM6PR03MB3573",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.5 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "In order to add filesystem support, we will need to be able to seek and\nwrite files. Add the appropriate helper functions.\n\nSigned-off-by: Sean Anderson <sean.anderson@seco.com>\n---\n\n arch/arm/lib/semihosting.c | 67 +++++++++++++++++++++++++++++++-------\n include/semihosting.h      | 20 ++++++++++++\n 2 files changed, 76 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c\nindex 2943f7b82f..d08003cef1 100644\n--- a/arch/arm/lib/semihosting.c\n+++ b/arch/arm/lib/semihosting.c\n@@ -1,15 +1,13 @@\n // SPDX-License-Identifier: GPL-2.0+\n /*\n+ * Copyright (C) 2022 Sean Anderson <sean.anderson@seco.com>\n  * Copyright 2014 Broadcom Corporation\n  */\n \n /*\n- * Minimal semihosting implementation for reading files into memory. If more\n- * features like writing files or console output are required they can be\n- * added later. This code has been tested on arm64/aarch64 fastmodel only.\n- * An untested placeholder exists for armv7 architectures, but since they\n- * are commonly available in silicon now, fastmodel usage makes less sense\n- * for them.\n+ * This code has been tested on arm64/aarch64 fastmodel only.  An untested\n+ * placeholder exists for armv7 architectures, but since they are commonly\n+ * available in silicon now, fastmodel usage makes less sense for them.\n  */\n #include <common.h>\n #include <command.h>\n@@ -19,7 +17,9 @@\n \n #define SYSOPEN\t\t0x01\n #define SYSCLOSE\t0x02\n+#define SYSWRITE\t0x05\n #define SYSREAD\t\t0x06\n+#define SYSSEEK\t\t0x0A\n #define SYSFLEN\t\t0x0C\n #define SYSERRNO\t0x13\n \n@@ -80,14 +80,22 @@ long smh_open(const char *fname, enum smh_open_mode mode)\n \treturn fd;\n }\n \n+/**\n+ * struct smg_rdwr_s - Arguments for read and write\n+ * @fd: A file descriptor returned from smh_open()\n+ * @memp: Pointer to a buffer of memory of at least @len bytes\n+ * @len: The number of bytes to read or write\n+ */\n+struct smh_rdwr_s {\n+\tlong fd;\n+\tvoid *memp;\n+\tsize_t len;\n+};\n+\n long smh_read(long fd, void *memp, size_t len)\n {\n \tlong ret;\n-\tstruct smh_read_s {\n-\t\tlong fd;\n-\t\tvoid *memp;\n-\t\tsize_t len;\n-\t} read;\n+\tstruct smh_rdwr_s read;\n \n \tdebug(\"%s: fd %ld, memp %p, len %zu\\n\", __func__, fd, memp, len);\n \n@@ -101,6 +109,24 @@ long smh_read(long fd, void *memp, size_t len)\n \treturn len - ret;\n }\n \n+long smh_write(long fd, const void *memp, size_t len, ulong *written)\n+{\n+\tlong ret;\n+\tstruct smh_rdwr_s write;\n+\n+\tdebug(\"%s: fd %ld, memp %p, len %zu\\n\", __func__, fd, memp, len);\n+\n+\twrite.fd = fd;\n+\twrite.memp = (void *)memp;\n+\twrite.len = len;\n+\n+\tret = smh_trap(SYSWRITE, &write);\n+\t*written = len - ret;\n+\tif (ret)\n+\t\treturn smh_errno();\n+\treturn 0;\n+}\n+\n long smh_close(long fd)\n {\n \tlong ret;\n@@ -125,6 +151,25 @@ long smh_flen(long fd)\n \treturn ret;\n }\n \n+long smh_seek(long fd, long pos)\n+{\n+\tlong ret;\n+\tstruct smh_seek_s {\n+\t\tlong fd;\n+\t\tlong pos;\n+\t} seek;\n+\n+\tdebug(\"%s: fd %ld pos %ld\\n\", __func__, fd, pos);\n+\n+\tseek.fd = fd;\n+\tseek.pos = pos;\n+\n+\tret = smh_trap(SYSSEEK, &seek);\n+\tif (ret)\n+\t\treturn smh_errno();\n+\treturn 0;\n+}\n+\n static int smh_load_file(const char * const name, ulong load_addr,\n \t\t\t ulong *end_addr)\n {\ndiff --git a/include/semihosting.h b/include/semihosting.h\nindex d8337b6269..b53c650444 100644\n--- a/include/semihosting.h\n+++ b/include/semihosting.h\n@@ -50,6 +50,17 @@ long smh_open(const char *fname, enum smh_open_mode mode);\n  */\n long smh_read(long fd, void *memp, size_t len);\n \n+/**\n+ * smh_write() - Write data to a file\n+ * @fd: A file descriptor returned from smh_open()\n+ * @memp: Pointer to a buffer of memory of at least @len bytes\n+ * @len: The number of bytes to read\n+ * @written: Pointer which will be updated with the actual bytes written\n+ *\n+ * Return: 0 on success or negative error on failure\n+ */\n+long smh_write(long fd, const void *memp, size_t len, ulong *written);\n+\n /**\n  * smh_close() - Close an open file\n  * @fd: A file descriptor returned from smh_open()\n@@ -66,4 +77,13 @@ long smh_close(long fd);\n  */\n long smh_flen(long fd);\n \n+/**\n+ * smh_seek() - Seek to a position in a file\n+ * @fd: A file descriptor returned from smh_open()\n+ * @pos: The offset (in bytes) to seek to\n+ *\n+ * Return: 0 on success or negative error on failure\n+ */\n+long smh_seek(long fd, long pos);\n+\n #endif /* _SEMIHOSTING_H */\n",
    "prefixes": [
        "09/17"
    ]
}