From patchwork Mon Aug 25 19:19:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 35931 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f72.google.com (mail-oi0-f72.google.com [209.85.218.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 79CC120565 for ; Mon, 25 Aug 2014 19:20:34 +0000 (UTC) Received: by mail-oi0-f72.google.com with SMTP id a141sf71586047oig.7 for ; Mon, 25 Aug 2014 12:20:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=5R2G+DPwJdAloEUrtJX19XzNTGqrHHdKuG7g6C2O5zc=; b=SjI9GrQQc+kPdyoEEt1u932u6/Wbm+ErRug0qA+6F/3TSPA/3AIWIzwVM6N70NPyYS V8Lz6FFM1UsSVhoMfDcOexiVeLQHcRzUnvQzoxFPnFhDYy4YYUstYOE0Qg11MId64vtF d2l3QZsP3mNXkrYF34rRpgwGM9HakHv3na9E1u25WR9MbxoAnNNpgGcTqQfJC4UNWapc hsa5ZHKEK2/8yYCOdi5qMyUv5eQw7HyAbqh623FdZUlcaJRZOQhPBpJ6GjCyj+J2gbSk yJ6LSDFSetM6eUWjqQE3CZCiCekLKABJ56Eqy6qYOnz0EGyl6n9ZIuERTxzwVsEg6shn 9AdQ== X-Gm-Message-State: ALoCoQnW716HBhRiMuVA8heO8lRxtwG5rBtdz55aRT/hsNVG9jZxRUOX4WYqIcZgqpQ1W+zia+uZ X-Received: by 10.50.118.100 with SMTP id kl4mr11323229igb.8.1408994434054; Mon, 25 Aug 2014 12:20:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.176 with SMTP id l45ls2297445qgd.81.gmail; Mon, 25 Aug 2014 12:20:33 -0700 (PDT) X-Received: by 10.220.96.137 with SMTP id h9mr7174642vcn.46.1408994433940; Mon, 25 Aug 2014 12:20:33 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ci16si452417vdb.93.2014.08.25.12.20.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 12:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hy4so15812572vcb.13 for ; Mon, 25 Aug 2014 12:20:33 -0700 (PDT) X-Received: by 10.53.3.169 with SMTP id bx9mr252765vdd.80.1408994433843; Mon, 25 Aug 2014 12:20:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp141520vcb; Mon, 25 Aug 2014 12:20:33 -0700 (PDT) X-Received: by 10.42.212.146 with SMTP id gs18mr83589icb.96.1408994403166; Mon, 25 Aug 2014 12:20:03 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id c16si667440ico.95.2014.08.25.12.20.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Aug 2014 12:20:03 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XLzo1-0004CS-Fx; Mon, 25 Aug 2014 19:19:53 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XLznz-0004CI-Bk for edk2-devel@lists.sourceforge.net; Mon, 25 Aug 2014 19:19:51 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.49 as permitted sender) client-ip=74.125.82.49; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f49.google.com; Received: from mail-wg0-f49.google.com ([74.125.82.49]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XLznx-0006hg-8E for edk2-devel@lists.sourceforge.net; Mon, 25 Aug 2014 19:19:51 +0000 Received: by mail-wg0-f49.google.com with SMTP id k14so13532260wgh.20 for ; Mon, 25 Aug 2014 12:19:43 -0700 (PDT) X-Received: by 10.180.103.168 with SMTP id fx8mr17578299wib.63.1408994382925; Mon, 25 Aug 2014 12:19:42 -0700 (PDT) Received: from ards-macbook-pro.local ([193.77.13.198]) by mx.google.com with ESMTPSA id b3sm3476891wiw.22.2014.08.25.12.19.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 12:19:42 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, edk2-devel@lists.sourceforge.net, peter.maydell@linaro.org, christoffer.dall@linaro.org, drjones@redhat.com, ilias.biris@linaro.org, leif.lindholm@linaro.org Date: Mon, 25 Aug 2014 21:19:18 +0200 Message-Id: <1408994367-11143-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1408994367-11143-1-git-send-email-ard.biesheuvel@linaro.org> References: <1408994367-11143-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1XLznx-0006hg-8E Subject: [edk2] [PATCH 01/10] Add minimal support for passing a device tree image X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This adds the possibility to include a DTB blob into the firmware image, and have it installed as a configuration under the correct GUID at UEFI init time. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/MdeModulePkg.dec | 2 + MdeModulePkg/MdeModulePkg.dsc | 2 + .../Universal/Fdt/FdtTableDxe/FdtTableDxe.c | 33 +++++++++++++++ .../Universal/Fdt/FdtTableDxe/FdtTableDxe.inf | 48 ++++++++++++++++++++++ MdePkg/Include/Guid/FdtTable.h | 26 ++++++++++++ MdePkg/MdePkg.dec | 3 ++ 6 files changed, 114 insertions(+) create mode 100644 MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.c create mode 100644 MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.inf create mode 100644 MdePkg/Include/Guid/FdtTable.h diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index e04246a2f419..d4d2a423256c 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -692,6 +692,8 @@ ## Default Creator Revision for ACPI table creation. gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision|0x01000013|UINT32|0x30001038 + gEfiMdeModulePkgTokenSpaceGuid.PcdFdtImage|{ 0x66,0x0f,0xe1,0x96,0xa5,0x0f,0x43,0x8c,0xa9,0x50,0xbe,0x6a,0x58,0xb9,0x12,0x1b }|VOID*|0x30001041 + [PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] ## This PCD defines the Console output column and the default value is 25 according to UEFI spec. # This PCD could be set to 0 then console output could be at max column and max row. diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index f4733253442b..616387a746c1 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -322,6 +322,8 @@ MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf + MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.inf + [Components.IA32, Components.X64, Components.IPF] MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf diff --git a/MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.c b/MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.c new file mode 100644 index 000000000000..c9b8b4c42464 --- /dev/null +++ b/MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.c @@ -0,0 +1,33 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +EFI_STATUS +EFIAPI +InitializeFdtTableDxe ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *FdtImageData; + UINTN FdtImageSize; + + Status = GetSectionFromAnyFv(PcdGetPtr(PcdFdtImage), EFI_SECTION_RAW, 0, + &FdtImageData, &FdtImageSize); + if (EFI_ERROR(Status)) + return Status; + + DEBUG((EFI_D_ERROR, "InitializeFdtTableDxe: DTB @ 0x%08x\n", FdtImageData)); + + return gBS->InstallConfigurationTable(&gEfiFdtTableGuid, FdtImageData); +} diff --git a/MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.inf b/MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.inf new file mode 100644 index 000000000000..993b778b8f66 --- /dev/null +++ b/MdeModulePkg/Universal/Fdt/FdtTableDxe/FdtTableDxe.inf @@ -0,0 +1,48 @@ +## @file +# FDT Table Protocol Driver +# +# Copyright (c) 2014, Linaro Ltd. All rights reserved.
+# This program and the accompanying materials are +# licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = FdtTableDxe + FILE_GUID = 261F9737-CDF6-46CE-A9E2-5DD16B957413 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = InitializeFdtTableDxe + +[Sources] + FdtTableDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + PcdLib + UefiDriverEntryPoint + DxeServicesLib + +[Guids] + gEfiFdtTableGuid + +[FeaturePcd] + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFdtImage + +[Protocols] + +[Depex] + TRUE diff --git a/MdePkg/Include/Guid/FdtTable.h b/MdePkg/Include/Guid/FdtTable.h new file mode 100644 index 000000000000..ab2e0bc43940 --- /dev/null +++ b/MdePkg/Include/Guid/FdtTable.h @@ -0,0 +1,26 @@ +/** @file + GUIDs used to locate the FDT image in the UEFI 2.x system table. + + Copyright (c) 2014 Linaro Ltd. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __FDT_TABLE_GUID_H__ +#define __FDT_TABLE_GUID_H__ + +#define FDT_TABLE_GUID \ + { \ + 0xb1b621d5, 0xf19c, 0x41a5, { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \ + } + +extern EFI_GUID gEfiFdtTableGuid; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 4daf3e6a75ea..574561b9f675 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -615,6 +615,9 @@ ## Include/Guid/VectorHandoffTable.h gEfiVectorHandoffTableGuid = { 0x996ec11c, 0x5397, 0x4e73, { 0xb5, 0x8f, 0x82, 0x7e, 0x52, 0x90, 0x6d, 0xef }} + ## Include/Guid/FdtTable.h + gEfiFdtTableGuid = { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 }} + [Guids.IA32, Guids.X64] ## Include/Guid/Cper.h gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de, { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}