From patchwork Fri Nov 15 08:21:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1195459 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rsUQBss4"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47Drsw4k5Wz9sP3 for ; Fri, 15 Nov 2019 19:21:38 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 29292C21DD4; Fri, 15 Nov 2019 08:21:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 51CC6C21C4A; Fri, 15 Nov 2019 08:21:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E586EC21C4A; Fri, 15 Nov 2019 08:21:28 +0000 (UTC) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by lists.denx.de (Postfix) with ESMTPS id 1F43EC21C3F for ; Fri, 15 Nov 2019 08:21:28 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id x28so6143737pfo.6 for ; Fri, 15 Nov 2019 00:21:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YeaeP+/3xhCoRi9Mn6fbGDBmcx2nMBvMUGSuQIP2i4s=; b=rsUQBss4JEt5MLDFdqZ7Oh7jwCe4Xx0TPCm+47rSW4ybQ9z9V+t5kDsQDaVfzIdGTt uC9mvxYqpHg2n3q7r5Xw4zi56DbILneVOp9VcgMR/fZl9hzj8PybuUlS8HjIL2Kz5Qpj am1piw8C1YptIUz3BfTuKC+6r5057KVG50EKaKDsr/+dVtISGUG6IsR3CYoRAjpIACsD fuzHoBuJQWubQ71WrffmsCtBysOOs1w52UB5DBqg13UcCZWjra4vkDLiIu0jz8yYL+Sy /a2rzxSwYAhLZBqa6ZFOkevYvZ0Ip6+JIXtkVET+dKOBuC5WY6bI/2FkWaInojCGAhKl 3koQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YeaeP+/3xhCoRi9Mn6fbGDBmcx2nMBvMUGSuQIP2i4s=; b=P2+Q5WHGy2K/vM1346esL9dfwGWAYaRhPsRt1VdXv2PMmjPq0Dg0hSKfVpeoZGrCaZ J7rUw85fJCOXBahYqLIPJe6hp3rVO/Hwtaj+acrOLP3tX3FWgVNs9y5Is6yM6MWl466t Lhfnvb2AXSq7P66dfTcmSfxcy1LxoRjP11pfskRV0JzC2+Cm8UfOpJHJ0BNu1mCRRWrv pTKC/sIqAlTdz5xZatO3TmiDWiI37wx0eKS+aKJxI7sXLD8wMYQcqH9093Mr70AzTcz/ Hgn9gkEBGTcS6+HvbV65psQIA5LTAFidpo7s3lAOV038Bx10gjsNpmZpgxi/uU8bU4C2 CwLw== X-Gm-Message-State: APjAAAUjo/jR9SP7t2/N3yoMndiM8xUMSTYo8tYkgk94k9Q3pmWPxNZ8 WwuJ++8sofcp9KCgIiJEwmo= X-Google-Smtp-Source: APXvYqzEroP+sPO+Io8/bLeBzNcdjOdidTzzzDrAOdIK2Xi4KC+wp9/w1I10ZufYjvl13gF/ow/P4Q== X-Received: by 2002:a63:4553:: with SMTP id u19mr14845736pgk.436.1573806086282; Fri, 15 Nov 2019 00:21:26 -0800 (PST) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id a28sm10334252pfg.51.2019.11.15.00.21.25 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 15 Nov 2019 00:21:25 -0800 (PST) From: Bin Meng To: Tom Rini , U-Boot Mailing List Date: Fri, 15 Nov 2019 00:21:17 -0800 Message-Id: <1573806077-1456-1-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 Cc: Lihua Zhao Subject: [U-Boot] [PATCH] bootm: vxworks: Support Linux compatible standard DTB for ARM and PPC X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Lihua Zhao Enhance do_bootm_vxworks() to support Linux compatible standard DTB for ARM and PPC, when the least significant bit of flags in VxWorks bootargs is set. Otherwise it falls back to the existing bootm flow which is now legacy. Signed-off-by: Lihua Zhao Signed-off-by: Bin Meng Reviewed-by: Bin Meng --- common/bootm_os.c | 39 +++++++++++++++++++++++++++++++++++++-- doc/README.vxworks | 13 +++++++++++++ include/vxworks.h | 3 +++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/common/bootm_os.c b/common/bootm_os.c index 6fb7d65..6c2d4e2 100644 --- a/common/bootm_os.c +++ b/common/bootm_os.c @@ -318,8 +318,8 @@ static void do_bootvx_fdt(bootm_headers_t *images) puts("## vxWorks terminated\n"); } -int do_bootm_vxworks(int flag, int argc, char * const argv[], - bootm_headers_t *images) +static int do_bootm_vxworks_legacy(int flag, int argc, char * const argv[], + bootm_headers_t *images) { if (flag != BOOTM_STATE_OS_GO) return 0; @@ -335,6 +335,41 @@ int do_bootm_vxworks(int flag, int argc, char * const argv[], return 1; } + +int do_bootm_vxworks(int flag, int argc, char * const argv[], + bootm_headers_t *images) +{ + char *bootargs; + int pos; + unsigned long vxflags; + bool std_dtb = false; + + /* get bootargs env */ + bootargs = env_get("bootargs"); + + if (bootargs != NULL) { + for (pos = 0; pos < strlen(bootargs); pos++) { + /* find f=0xnumber flag */ + if ((bootargs[pos] == '=') && (pos >= 1) && + (bootargs[pos - 1] == 'f')) { + vxflags = simple_strtoul(&bootargs[pos + 1], + NULL, 16); + if (vxflags & VXWORKS_SYSFLG_STD_DTB) + std_dtb = true; + } + } + } + + if (std_dtb) { + if (flag & BOOTM_STATE_OS_PREP) + printf(" Using standard DTB\n"); + return do_bootm_linux(flag, argc, argv, images); + } else { + if (flag & BOOTM_STATE_OS_PREP) + printf(" !!! WARNING !!! Using legacy DTB\n"); + return do_bootm_vxworks_legacy(flag, argc, argv, images); + } +} #endif #if defined(CONFIG_CMD_ELF) diff --git a/doc/README.vxworks b/doc/README.vxworks index 3e08711..12a0d74 100644 --- a/doc/README.vxworks +++ b/doc/README.vxworks @@ -2,6 +2,7 @@ # # Copyright (C) 2013, Miao Yan # Copyright (C) 2015-2018, Bin Meng +# Copyright (C) 2019, Lihua Zhao VxWorks Support =============== @@ -24,6 +25,15 @@ From VxWorks 7, VxWorks starts adopting device tree as its hardware description mechanism (for PowerPC and ARM), thus requiring boot interface changes. This section will describe the new interface. +Since VxWorks 7 SR0640 release, VxWorks starts using Linux compatible standard +DTB for some boards. With that, the exact same bootm flow as used by Linux is +used, which includes board-specific DTB fix up. To keep backward compatibility, +only when the least significant bit of flags in bootargs is set, the standard +DTB will be used. Otherwise it falls back to the legacy bootm flow. + +For legacy bootm flow, make sure the least significant bit of flags in bootargs +is cleared. The calling convention is described below: + For PowerPC, the calling convention of the new VxWorks entry point conforms to the ePAPR standard, which is shown below (see ePAPR for more details): @@ -33,6 +43,9 @@ For ARM, the calling convention is shown below: void (*kernel_entry)(void *fdt_addr) +When using the Linux compatible standard DTB, the calling convention of VxWorks +entry point is exactly the same as the Linux kernel. + When booting a VxWorks 7 kernel (uImage format), the parameters passed to bootm is like below: diff --git a/include/vxworks.h b/include/vxworks.h index 1a29509..d90d862 100644 --- a/include/vxworks.h +++ b/include/vxworks.h @@ -9,6 +9,9 @@ #include +/* Use Linux compatible standard DTB */ +#define VXWORKS_SYSFLG_STD_DTB 0x1 + /* * Physical address of memory base for VxWorks x86 * This is LOCAL_MEM_LOCAL_ADRS in the VxWorks kernel configuration.