From patchwork Tue May 7 12:52:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 1096336 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="UQ+ZEZFi"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44z02w4NQRz9sB8 for ; Tue, 7 May 2019 22:55:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4C355C21D74; Tue, 7 May 2019 12:53:44 +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=SPF_HELO_PASS, 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 7F0F1C21E70; Tue, 7 May 2019 12:53:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CDC8DC21C4A; Tue, 7 May 2019 12:52:50 +0000 (UTC) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140057.outbound.protection.outlook.com [40.107.14.57]) by lists.denx.de (Postfix) with ESMTPS id 97F42C21E88 for ; Tue, 7 May 2019 12:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A03z9V15hxvB3Bw4petQjcBgFlLelqq/MR48QcQZtqA=; b=UQ+ZEZFi8YgP+64Es2fyMEP9V10InuKLK5Mhz8I0zYXsVR9wXKntaXcoamjF5mciIFvDd9L6vimyrRCJ6x0H5Vp71FGoi7meBmRhG4gKzhPE/ZoUA2Q8DUSF5sXN7cRZwVReNp52YqATVeuwQeV+OlhVG2ARPylcWWqZbPWpSdQ= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB6627.eurprd04.prod.outlook.com (20.179.255.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.11; Tue, 7 May 2019 12:52:44 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::3173:24:d401:2378]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::3173:24:d401:2378%6]) with mapi id 15.20.1856.012; Tue, 7 May 2019 12:52:44 +0000 From: Peng Fan To: "sbabic@denx.de" , "festevam@gmail.com" Thread-Topic: [PATCH 4/6] spl: mmc: support loading i.MX container format file Thread-Index: AQHVBNPD1i8f74t68kmU/NmBgO2wCQ== Date: Tue, 7 May 2019 12:52:44 +0000 Message-ID: <20190507130554.4598-5-peng.fan@nxp.com> References: <20190507130554.4598-1-peng.fan@nxp.com> In-Reply-To: <20190507130554.4598-1-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.16.4 x-clientproxiedby: HK0P153CA0047.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::35) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9c370a37-5506-4a51-4f26-08d6d2eae5f9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR04MB6627; x-ms-traffictypediagnostic: AM0PR04MB6627: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 0030839EEE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(366004)(396003)(346002)(189003)(199004)(6486002)(486006)(64756008)(66476007)(54906003)(110136005)(2501003)(73956011)(99286004)(1076003)(7416002)(14454004)(256004)(71190400001)(71200400001)(478600001)(7736002)(66066001)(8676002)(2906002)(186003)(36756003)(81166006)(86362001)(11346002)(2616005)(446003)(6116002)(66446008)(3846002)(8936002)(305945005)(44832011)(50226002)(66946007)(53936002)(476003)(66556008)(68736007)(6436002)(316002)(52116002)(6506007)(386003)(76176011)(6512007)(5660300002)(26005)(81156014)(102836004)(4326008)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB6627; H:AM0PR04MB4481.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /jKuqsMmW8cyz5kNnt68KCN3n5zAmQSbNOVrf3CgR/34o09sovlCjLs5loAZOQPbdOUTRd+asntPqU8r/8bOA2xShb0Co8f4JRR7XcwJOWyun9MD4h+4s8tuhsxWXJjpEsY6yw7gauNUaqJeUHfthcHQKUCDD9fu6RB5O774R/JjbFX8W0AqCNFdURcvL/uFmTbC3c3tV489dRske9x4q/2uf+qUfu+ZQb4R7d4dlVC77oZxLrKVMq+0etHJIZwOyNAnr/+preOKzSEEiupvpvRUDeEJHY8QlIJXzRYpmk6eGX8PfF/dKL9QdBSfVaatRlf4cUQKoQ2Zwl5Uo2e4EFXM5ccPzaP+Lgaz4VHC0qCXs/huKxGxZa9z4KWKgwe75DuLOZSAP+Ltii82UFMU0OMR8m85bhCcPvZ+WO27N5w= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c370a37-5506-4a51-4f26-08d6d2eae5f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 May 2019 12:52:44.4433 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6627 Cc: Marek Vasut , Tien Fong Chee , "u-boot@lists.denx.de" , dl-uboot-imx , York Sun Subject: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container support to let SPL could load container images. Cc: Simon Goldschmidt Cc: Tien Fong Chee Cc: York Sun Cc: Marek Vasut Cc: Alex Kiernan Cc: Simon Glass Cc: Philipp Tomsich Cc: Kever Yang Cc: Heiko Schocher Signed-off-by: Peng Fan --- common/spl/spl_mmc.c | 10 ++++++++++ include/spl.h | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index bf53a1dadf..6320af055b 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, load.bl_len = mmc->read_bl_len; load.read = h_spl_load_read; ret = spl_load_simple_fit(spl_image, &load, sector, header); + } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { + struct spl_load_info load; + + load.dev = mmc; + load.priv = NULL; + load.filename = NULL; + load.bl_len = mmc->read_bl_len; + load.read = h_spl_load_read; + + ret = spl_load_imx_container(spl_image, &load, sector); } else { ret = mmc_load_legacy(spl_image, mmc, sector, header); } diff --git a/include/spl.h b/include/spl.h index f09909e189..b7c8a972dd 100644 --- a/include/spl.h +++ b/include/spl.h @@ -125,6 +125,18 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, #define SPL_COPY_PAYLOAD_ONLY 1 #define SPL_FIT_FOUND 2 +/** + * spl_load_imx_container() - Loads a imx container image from a device. + * @spl_image: Image description to set up + * @info: Structure containing the information required to load data. + * @sector: Sector number where container image is located in the device + * + * Reads the container image @sector in the device. Loads u-boot image to + * specified load address. + */ +int spl_load_imx_container(struct spl_image_info *spl_image, + struct spl_load_info *info, ulong sector); + /* SPL common functions */ void preloader_console_init(void); u32 spl_boot_device(void);