get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1600610,
    "url": "http://patchwork.ozlabs.org/api/patches/1600610/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20220303204400.2787389-11-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-11-sean.anderson@seco.com>",
    "list_archive_url": null,
    "date": "2022-03-03T20:43:53",
    "name": "[10/17] spl: Add semihosting boot method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "22cfd2af7378395650ad4ea93b107b950d1686d4",
    "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-11-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/1600610/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1600610/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=DdnoFE3E;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=\"DdnoFE3E\";\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\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\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 4K8jhF4PD5z9sGC\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  4 Mar 2022 07:46:37 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id B1D7283D43;\n\tThu,  3 Mar 2022 21:45:09 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 2F64F811D8; Thu,  3 Mar 2022 21:44:45 +0100 (CET)",
            "from EUR02-AM5-obe.outbound.protection.outlook.com\n (mail-am5eur02on060b.outbound.protection.outlook.com\n [IPv6:2a01:111:f400:fe07::60b])\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 72A7D83CAF\n for <u-boot@lists.denx.de>; Thu,  3 Mar 2022 21:44:31 +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:30 +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:29 +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=mvRwlTEuZloGj0qBGyWPiVcu4Py+DZGYZqIgnYaRtMO0YxQqSU6FMypvsorqz/gkkOQQmgRWIT8rikhtqhQI/h5nTiI5CkjPqdy2Xbz1py2AdET58v905lBCtv+P42T0S11cHobhXkLMiOCKgfdHvk63B100pAwcV19BOvyJ4fvisXmKpelPj0GwDSY3sJzh/h0anlCY9XDGKQ0imW3cFcgctbsjemjJ731Snrycn2+1xdxhNZiVqzFsn4V+WGojIVRjoDcJQdF03lhBC8QbrhocHfYZCVtiiFZcZV3pO1g05UanmjxhXX0CRhnrzkBvsFuXDJs1R5xw6smYyxBNwQ==",
        "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=R4t8XHypC7XtVqJy5CBfZZBZOodaxmSJmQf4VPidM5Q=;\n b=GtsajEsfJ9OjakWt7niasXxBmP0X8rB2T0NF6dlkvURUKpatJ8/VnH9m1AahtRZM8uga6J1/d7Qe+30Jtb08iCTBpWuU0K1ix1LV3BRfY4oIhH36kOConXDQcVJRD7yW2Gy5AX84lle5CfCyzm4NED2nUw2dpxUhpkPjVu+hopfrH+Nn4TsYQJbPwQY1V12HfLe2F6yybKiXNDVWDqshpYGbN21MQERkPJhsOgvPhhEt0k4xDx2VuZ9ROomyFJXEMDnYNhHqnufJcdJmOjvIbJNWHwkzxY6p4eOX89I8z+RPeMrvrR0KkNMVQAnF/wgp/F4oFjmHReqpwLhfoOjM0w==",
        "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=R4t8XHypC7XtVqJy5CBfZZBZOodaxmSJmQf4VPidM5Q=;\n b=DdnoFE3ENekQ/GDkPpz7n5JXeWTIV9vJrrQjGOOBd58Go+tMZalmaj5nouPrLeqCF/M8sOlYKfgMS44dB78kTIOMhyKuOK/E4ztUuhtz80DZzZQpjQnk4c1WP/4zJ5eHenMqkPK3wr/Xh0x40KPnaJ+GXKlgHlwCPIcrZ0jxIeEP9P8EEu7y+413wOanhcazJBqJyqC2p+1ZEKhZMQl49zqFLSL4f3kOXL3Wvnw8nv1HCek0O97orVP34/fMdSsJ9cHISkQ1ldIDHMptCXpRU1hKwZ8a62RjXiZ+K18Jfwa3GbjSZpqIfJOZr0TlyVuld9HEjpxPxN7ogRjjpR2R7Q==",
        "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 10/17] spl: Add semihosting boot method",
        "Date": "Thu,  3 Mar 2022 15:43:53 -0500",
        "Message-Id": "<20220303204400.2787389-11-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": "6accd380-1cac-4aa4-fd1c-08d9fd569d47",
        "X-MS-TrafficTypeDiagnostic": "AM6PR03MB3573:EE_",
        "X-Microsoft-Antispam-PRVS": "\n <AM6PR03MB3573DED1FD980F405341B22996049@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 Hfh/pr/+mGyk4i+8ld2epA+7oocb+K0gRtjoeghDuoJLtki8BXYuilaGw1wDjQAdnF/AFwDyCS1kI6pZZNKwyv5MWjDp8Drpg+NMpVDaN02HvOmTdQoe1oaPtj+OkLAjf8HHvLbj0biL3k4jkYk6YblIhNho5kOcmJtwj2aaObzJVGRjMoSyXK9oB4E9xXlQDP1jaU9fENWjeOau7lW7z7frcpamx2vFCMQ8nGRXq0I8Ol7BXAjX3SgcBDHZdFgj2ocSPdikxnrkZB1pns4k+touJLesSfaD1Yv18SeUZN8s+4Y9fbEk9WBtSe8qx0I/YwcjqZqOgRNSARyd35jJ59x3O6E/THjbpALpsiyQASFgTo8YJWU3JUDLJ5MeWAbbDAr3g3U9UWMS89TRHLXxsWFTpHdDMlj01kA9j9LvunP/n+V5E2PLmRbd2orYDwvP4AMvlJd2n08mUkSaP59eEkQGq8/KM5XpJBfxpEwvkBzUK1SOwCNzrQ8paCjEaMBwopNl/e7hY2Bmx1bsz94hmKM4wffxUE9eXY1MM600gcHc3Ikg9BaIDrCG48ObP8DqaBE1E1rwnlUIiUYfZ519BTTXee8qDlbXYxqdEqjKzy4yduxSyl1TBxRTPYwa9I+jIDB/lMLSMoogbgidoOQrHpNlptnlCBcBIjRLTO1g+aDlzFz+LO7sRj1KDYD0ubW6xWCqbWO604Q9X0TDzk/6kQ==",
        "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 11+Z+vdY5NckANp/AGuaDUHT4tcxthTuxUChYjKDx52cKkLB5q/u6+aZaHjbJaFrG8731TpL7fnfhSX9hjpY1r0SzRZGw6iK4TcgMm+usmXaUuvGtGF/Ld4v14dlM1W8MHOegQPH243Phn7g5J5Q6/zxzk3omGB9jVQtaGyW5hjuIyfvic6qQgi7sQeAUXeolqEPaZsxnIdxfYKi5+STQZDcHQrS1vAD+nOtyZh5z6+Ft9eM4/GWsXODGtbTetx4+Nd7pd8t24XoRYWPAKl6FIHytS8TEBU3NZucQUZFwKYsH9cPNTKRvLsHFUeFXfiGDcz6Yy44PvVPQ3Mc74eb6C6HJ0M6HyqC6Vr9vIqtjLHZdFGSLkkFrfnZP21aVsdbrmdyI+kKfMb+Piz/w1CM7lfkQRpzBvLLgPV6xHtaE//kfhRpcwvkYTjt6WjH7F89SI9Wj1lP71iR1KLrKccZ08L0FZ3ZLk6XY/xEBqZuk6LudeE93p2Xc5RyUDkYWmQnketq6Ja6A9oeHqF0hgWCa+OUrNaob2jzA8fD05AfPnVa5zJ1xRNV5WwGp6zzCS3m4VlD4cdWGTj3jCO664ZGF4EfpyTIQCIxINGcjpsi9I9MABW1J9yHvoCxUzkMvfZZiZqNssdUsmK0s1eiV71I+8v7LRzI0nQzllNjsPDLeLc1Y48CPvFMTqhR3Pqi5QjgJuacviC0Qbd1RFNDhrNbT+N/z+NqFCEl67DFKGi6MZCxf2S+fqOuTWcsQrTkNfu6cz/rNEaD17bg790L0SjNmLKb4TtdZTFwEVURFTab1flQhle3JZoAQfDIi2gRriUmlfTonHMeWAU9r5Vz8H6YSqnaU4nsR5cIkQ10x3uRTyUwimWarzHumwAWacVs2P5NWd/7pNoBE/cz7f1SN6ceLERispu0MXhN5XePNCOSBh1j0hRzH4haYPr0LacJlk3RtAswPVdbJHUUTlv3EeRKCCjlVq81ytV5Zg0SJ1i+l0KpbndqQUc8B/7tWVMDc+1XaVMeDsxXP204R2vcjd4IdNIIA8kVCxu9PT7YGLlxutVELsJu45VECRheOeOpSOjItgqfzMOSXX4bBOt8AAmkdvxn/4vTfV8SLJRqiRj8sB5ipJgjSfVtCA9qOd4RqYzVIMny4haq4cvjEV0DMPRRvaScZjfsDt8pYeKiPiEbdKsHvHSE9bRbzEERx+K9FZrJU/y5h4UjaWgE/XbUpLoRw72YSQyp4WAi9abD5eLIr/9J18TXUNDeLa3Cb9IIh2MGeEqs23btWkQ7Z80/YiaZt6D2DXL+CQQOdzlU1+zt/gfykxnvcs13OUL5MK20UUx0JtGJK71rUzc+Ck3caCyiQ80R57J7/KsdVODxlPABIyNHVeLPcwwyopA5jah5YacSaDP0GMW+SJ7NWhXNep88gUHUW+wcONEwb3did/l6BJyQHCHc9xAiLIilTOa2W5OjkFv6aQjsaR3ihhGd7COLioDMP6KvsS+xFWWXRVmVWE2Ln0FASkYJzVpBA5K7iOSDRaZMe+cF/F9UEtAXCtaJNXbIUeiWMbGCXQ9aWb9bEbgCzhKMyRy+y9utNsIF3Lls0V7SAjdGd6TAObBVZQVmOiodilpa/DbBrCOKy17C30U=",
        "X-OriginatorOrg": "seco.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 6accd380-1cac-4aa4-fd1c-08d9fd569d47",
        "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:29.8641 (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 asoYiUV2/6NjptIlqP/ctXjm83TlQg6fIPZmy6/HDVgiXTadb0IoF0kyBLLEYJQHY6Gletk5sQyf1EWum/LQJw==",
        "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": "This adds a boot method for loading the next stage from the host. It is\nmostly modeled off of spl_load_image_ext. I am not really sure why/how\nspl_load_image_fat uses three different methods to load the image, but\nthe simple case seems to work OK for now.\n\nTo control the presence of this boot method, we add a config symbol.\nWhile we're at it, we update the original semihosting config symbol.\n\nI think semihosting has some advantages of other forms of JTAG boot.\nCommon other ways to boot from JTAG include:\n\n- Implementing DDR initialization through JTAG (typically with dozens of\n  lines of TCL) and then loading U-Boot. The DDR initialization\n  typically uses hard-coded register writes, and is not easily adapted\n  to different boards. BOOT_DEVICE_SMH allows booting with SPL,\n  leveraging U-Boot's existing DDR initialization code. This is the\n  method used by NXP's CodeWarrior IDE on Layerscape processors (see\n  AN12270).\n- Loading a bootloader into SDRAM, waiting for it to initialize DDR, and\n  then loading U-Boot. This is tricky, because the debugger must stop the\n  boot after the bootloader has completed its work. Trying to load\n  U-Boot too early can cause failure to boot. This is the method used by\n  Xilinx with its Zynq(MP) processors.\n- Loading SPL with BOOT_DEVICE_RAM and breaking before SPL loads the\n  image to load U-Boot at the appropriate place. This can be a bit\n  tricky, because the load address is dependent on the header size. An\n  elf with symbols must also be used in order to stop at the appropriate\n  point. BOOT_DEVICE_SMH can be viewed as an extension of this process,\n  where SPL automatically stops and tells the host where to place the\n  image.\n\nSigned-off-by: Sean Anderson <sean.anderson@seco.com>\n---\n\n arch/arm/Kconfig             | 25 +++++++++++--\n arch/arm/include/asm/spl.h   |  1 +\n common/spl/Makefile          |  1 +\n common/spl/spl_semihosting.c | 71 ++++++++++++++++++++++++++++++++++++\n 4 files changed, 94 insertions(+), 4 deletions(-)\n create mode 100644 common/spl/spl_semihosting.c",
    "diff": "diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig\nindex 391a77c2b4..5cacb292b5 100644\n--- a/arch/arm/Kconfig\n+++ b/arch/arm/Kconfig\n@@ -403,11 +403,28 @@ config ARM_SMCCC\n \t  firmware (for example, PSCI) according to SMCCC.\n \n config SEMIHOSTING\n-\tbool \"support boot from semihosting\"\n+\tbool \"Support ARM semihosting\"\n \thelp\n-\t  In emulated environments, semihosting is a way for\n-\t  the hosted environment to call out to the emulator to\n-\t  retrieve files from the host machine.\n+\t  Semihosting is a method for a target to communicate with a host\n+\t  debugger. It uses special instructions which the debugger will trap\n+\t  on and interpret. This allows U-Boot to read/write files, print to\n+\t  the console, and execute arbitrary commands on the host system.\n+\n+\t  Enabling this option will add support for reading and writing files\n+\t  on the host system. If you don't have a debugger attached then trying\n+\t  to do this will likely cause U-Boot to hang. Say 'n' if you are unsure.\n+\n+config SPL_SEMIHOSTING\n+\tbool \"Support ARM semihosting in SPL\"\n+\thelp\n+\t  Semihosting is a method for a target to communicate with a host\n+\t  debugger. It uses special instructions which the debugger will trap\n+\t  on and interpret. This allows U-Boot to read/write files, print to\n+\t  the console, and execute arbitrary commands on the host system.\n+\n+\t  Enabling this option will add support for reading and writing files\n+\t  on the host system. If you don't have a debugger attached then trying\n+\t  to do this will likely cause U-Boot to hang. Say 'n' if you are unsure.\n \n config SYS_THUMB_BUILD\n \tbool \"Build U-Boot using the Thumb instruction set\"\ndiff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h\nindex e568af2561..b5790bd0bc 100644\n--- a/arch/arm/include/asm/spl.h\n+++ b/arch/arm/include/asm/spl.h\n@@ -30,6 +30,7 @@ enum {\n \tBOOT_DEVICE_DFU,\n \tBOOT_DEVICE_XIP,\n \tBOOT_DEVICE_BOOTROM,\n+\tBOOT_DEVICE_SMH,\n \tBOOT_DEVICE_NONE\n };\n #endif\ndiff --git a/common/spl/Makefile b/common/spl/Makefile\nindex db8fd36a26..e71e7bee66 100644\n--- a/common/spl/Makefile\n+++ b/common/spl/Makefile\n@@ -28,6 +28,7 @@ obj-$(CONFIG_$(SPL_TPL_)USB_STORAGE) += spl_usb.o\n obj-$(CONFIG_$(SPL_TPL_)FS_FAT) += spl_fat.o\n obj-$(CONFIG_$(SPL_TPL_)FS_EXT4) += spl_ext.o\n obj-$(CONFIG_$(SPL_TPL_)SATA) += spl_sata.o\n+obj-$(CONFIG_$(SPL_TPL_)SEMIHOSTING) += spl_semihosting.o\n obj-$(CONFIG_$(SPL_TPL_)DFU) += spl_dfu.o\n obj-$(CONFIG_$(SPL_TPL_)SPI_LOAD) += spl_spi.o\n obj-$(CONFIG_$(SPL_TPL_)RAM_SUPPORT) += spl_ram.o\ndiff --git a/common/spl/spl_semihosting.c b/common/spl/spl_semihosting.c\nnew file mode 100644\nindex 0000000000..df6aeb2951\n--- /dev/null\n+++ b/common/spl/spl_semihosting.c\n@@ -0,0 +1,71 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Copyright (C) 2022 Sean Anderson <sean.anderson@seco.com>\n+ */\n+\n+#include <common.h>\n+#include <image.h>\n+#include <log.h>\n+#include <semihosting.h>\n+#include <spl.h>\n+\n+static int smh_read_full(long fd, void *memp, size_t len)\n+{\n+\tlong read;\n+\n+\tread = smh_read(fd, memp, len);\n+\tif (read < 0)\n+\t\treturn read;\n+\tif (read != len)\n+\t\treturn -EIO;\n+\treturn 0;\n+}\n+\n+static int spl_smh_load_image(struct spl_image_info *spl_image,\n+\t\t\t      struct spl_boot_device *bootdev)\n+{\n+\tconst char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;\n+\tint ret;\n+\tlong fd, len;\n+\tstruct image_header *header =\n+\t\tspl_get_load_buffer(-sizeof(*header), sizeof(*header));\n+\n+\tfd = smh_open(filename, MODE_READ | MODE_BINARY);\n+\tif (fd < 0) {\n+\t\tlog_debug(\"could not open %s: %ld\\n\", filename, fd);\n+\t\treturn fd;\n+\t}\n+\n+\tret = smh_flen(fd);\n+\tif (ret < 0) {\n+\t\tlog_debug(\"could not get length of image: %d\\n\", ret);\n+\t\tgoto out;\n+\t}\n+\tlen = ret;\n+\n+\tret = smh_read_full(fd, header, sizeof(struct image_header));\n+\tif (ret) {\n+\t\tlog_debug(\"could not read image header: %d\\n\", ret);\n+\t\tgoto out;\n+\t}\n+\n+\tret = spl_parse_image_header(spl_image, bootdev, header);\n+\tif (ret) {\n+\t\tlog_debug(\"failed to parse image header: %d\\n\", ret);\n+\t\tgoto out;\n+\t}\n+\n+\tret = smh_seek(fd, 0);\n+\tif (ret) {\n+\t\tlog_debug(\"could not seek to start of image: %d\\n\", ret);\n+\t\tgoto out;\n+\t}\n+\n+\tret = smh_read_full(fd, (void *)spl_image->load_addr, len);\n+\tif (ret)\n+\t\tlog_debug(\"could not read %s: %d\\n\", filename, ret);\n+out:\n+\tsmh_close(fd);\n+\treturn ret;\n+}\n+SPL_LOAD_IMAGE_METHOD(\"SEMIHOSTING\", 0, BOOT_DEVICE_SMH, spl_smh_load_image);\n",
    "prefixes": [
        "10/17"
    ]
}