From patchwork Tue Oct 31 10:51:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 117537 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp3793473edm; Tue, 31 Oct 2017 03:52:50 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TEaIqlgqecZCDc+f7maTz0id4NeckrtKimPADSJY/ErnLVcZrbPubkhYXeqgwWxQFxzumy X-Received: by 10.84.212.16 with SMTP id d16mr1496818pli.374.1509447169998; Tue, 31 Oct 2017 03:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509447169; cv=none; d=google.com; s=arc-20160816; b=yF7CCbJfpQIJqOAdjHpYgxSJjGKPPfLxa2iuBn9JQKEUFdFVbglIMDCD5vc6Qtz/HE 6Qk/6rm7t486Jtu5Wfmxvvh5HQzFDy7g8AHNadrgMLWpD3cHMqMPU/C3G8dKNYu47bF7 HwPfsg1oKfuzHOzhOi3pw/TUn8/zz5nevjnUvHy6IfQZmb3181QX1Yr+5ZcY7GWm2UqH 2WqvDR4qfEVVbreLyV461qn+Mhz/4Dfdo7PVNcS57BZtymvmkQOLDyG8BbjUkpl+APjw J5T29F961pDuQ6ytkX+UkmKuzJy+Hf8VsugSS13vbX0XLzaSLg/rSxCifsU5S0vXG1cg 1RHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=UCqd3ZeOJE4WU58EXYYcSCfGF6nYHOZYelAbtwq5vZo=; b=dWm1+Gwbln1mGjdzguNk+u8FdWgA0VgDL0KB1kLataU9GAWx3Bg1pKv9P51C4g/QBC 2sMj5XuDit4SqsJ8gdtWpsjqnXBJC3ZJ+rS4mNBKbZFywxqJwXw78X4ottmhonbqtcVT lf4w9qKSN/pQqD2cB3skm1tWOSfQk8eXFS4sKdhMYXkaj6oQK/ix5+bTCxY4dBHnOBn0 93RWs/SAoV6mJ3vYqH1pR+d4+ypkUvVzpL9Q0uDo/1JFl7z8Uj/twKW3v8k5TwQPcaO0 Sns7+qrQet+kyUhujjxYcjeARvCzDVq9d1FyrsZ9/ulVL/+TTQEtDqOpFwpAJpWGUtRG jVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hxcGfhtt; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id j129si1408508pfc.436.2017.10.31.03.52.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 03:52:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hxcGfhtt; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A1EDC20352610; Tue, 31 Oct 2017 03:48:50 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 98DBA2034AB1B for ; Tue, 31 Oct 2017 03:48:48 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id u40so15474911wrf.10 for ; Tue, 31 Oct 2017 03:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mJdOEHtA5o8/LIuv59D+3FBOOSMHXgLxvv25xZH/g6c=; b=hxcGfhttBoZ5iBgjZkkDGQsvCBrFyusAyzJt6l/VEL6jx7m9uur48ot0OvrHf9sB8I rdo5phxWu6bRttICLx4qa6IqiwhKUx2Nu4ZZQdmicXvPIzyZXyxn/D/yffRUFSkIafM3 qETs62Bez/kEvRRnsJbnPLwJq9T4SQM3s95sY= 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:in-reply-to :references; bh=mJdOEHtA5o8/LIuv59D+3FBOOSMHXgLxvv25xZH/g6c=; b=oee86wYszchvBi4no3e/4QECsSpyJ61j6uUb5zevb5P7cjdJR3MyTkbZ46Mn87oq9w g7B9GoYexs/hF2q+mZXly8mpuNIzUZ7GQhXFCn7emf4giNUvfFSGwVO1LwET10Uk4gjy B5TvoEuJedHezC8cBK7Vz5Ws4ADjkoE8xFDasRQsXRdphelqlWHhlxisxGZduISTu2K3 M6CYWM1Q+gGATpa09KcLbsn/BNQnwwnfohxaIjWZJxNM55i/HxPLkDGGt1nK+82rtxfU 4lxzauy630/SvTf1wxNVaJ3IpfG7PKNCPmac2DrIoKDb1+HUzs/FLmvV1/PGF9RpcKgf D7Ug== X-Gm-Message-State: AMCzsaUyvv8yvbxshUMrVMWsLqF9qQAkSMvaLQmeZzb9m1RWh+8KJ/A9 urAJXuJRTG3FIiIRd2/Zm+9RFgvaXoc= X-Received: by 10.223.142.51 with SMTP id n48mr1341891wrb.279.1509447158417; Tue, 31 Oct 2017 03:52:38 -0700 (PDT) Received: from localhost.localdomain ([105.129.222.2]) by smtp.gmail.com with ESMTPSA id o14sm460985wra.54.2017.10.31.03.52.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 03:52:37 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Tue, 31 Oct 2017 10:51:55 +0000 Message-Id: <20171031105218.30208-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171031105218.30208-1-ard.biesheuvel@linaro.org> References: <20171031105218.30208-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v3 04/27] Silicon/SynQuacer: implement a platform DXE driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: daniel.thompson@linaro.org, masami.hiramatsu@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This implements a driver that will take care of platform specific initialization, such as declaring non-discoverable devices. For the moment, this is limited to declaring the presence of the NETSEC controller. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 106 ++++++++++++++++++++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 52 ++++++++++ Silicon/Socionext/SynQuacer/SynQuacer.dec | 3 + 3 files changed, 161 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c new file mode 100644 index 000000000000..86e81bc3593c --- /dev/null +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c @@ -0,0 +1,106 @@ +/** @file + SynQuacer DXE platform driver. + + Copyright (c) 2017, 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. +**/ + +#include +#include +#include +#include +#include +#include +#include + +STATIC EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR mNetsecDesc[] = { + { + ACPI_ADDRESS_SPACE_DESCRIPTOR, // Desc + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3, // Len + ACPI_ADDRESS_SPACE_TYPE_MEM, // ResType + 0, // GenFlag + 0, // SpecificFlag + 32, // AddrSpaceGranularity + SYNQUACER_NETSEC_BASE, // AddrRangeMin + SYNQUACER_NETSEC_BASE + + SYNQUACER_NETSEC_BASE_SZ - 1, // AddrRangeMax + 0, // AddrTranslationOffset + SYNQUACER_NETSEC_BASE_SZ, // AddrLen + }, { + ACPI_ADDRESS_SPACE_DESCRIPTOR, // Desc + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3, // Len + ACPI_ADDRESS_SPACE_TYPE_MEM, // ResType + 0, // GenFlag + 0, // SpecificFlag + 32, // AddrSpaceGranularity + FixedPcdGet32 (PcdNetsecEepromBase), // AddrRangeMin + FixedPcdGet32 (PcdNetsecEepromBase) + + SYNQUACER_EEPROM_BASE_SZ - 1, // AddrRangeMax + 0, // AddrTranslationOffset + SYNQUACER_EEPROM_BASE_SZ, // AddrLen + }, { + ACPI_ADDRESS_SPACE_DESCRIPTOR, // Desc + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3, // Len + ACPI_ADDRESS_SPACE_TYPE_MEM, // ResType + 0, // GenFlag + 0, // SpecificFlag + 32, // AddrSpaceGranularity + FixedPcdGet32 (PcdNetsecPhyAddress), // AddrRangeMin + FixedPcdGet32 (PcdNetsecPhyAddress), // AddrRangeMax + 0, // AddrTranslationOffset + 1, // AddrLen + }, { + ACPI_END_TAG_DESCRIPTOR // Desc + } +}; + +STATIC +EFI_STATUS +RegisterNetsec ( + VOID + ) +{ + NON_DISCOVERABLE_DEVICE *Device; + EFI_STATUS Status; + EFI_HANDLE Handle; + + Device = (NON_DISCOVERABLE_DEVICE *)AllocateZeroPool (sizeof (*Device)); + if (Device == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Device->Type = &gNetsecNonDiscoverableDeviceGuid; + Device->DmaType = NonDiscoverableDeviceDmaTypeNonCoherent; + Device->Resources = mNetsecDesc; + + Handle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces (&Handle, + &gEdkiiNonDiscoverableDeviceProtocolGuid, Device, + NULL); + if (EFI_ERROR (Status)) { + goto FreeDevice; + } + return EFI_SUCCESS; + +FreeDevice: + FreePool (Device); + + return Status; +} + +EFI_STATUS +EFIAPI +PlatformDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return RegisterNetsec (); +} diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf new file mode 100644 index 000000000000..59a3d1fb47f4 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -0,0 +1,52 @@ +## @file +# +# Component description file for the SynQuacer DXE platform driver. +# +# Copyright (c) 2017, 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 = 0x0001001A + BASE_NAME = PlatformDxe + FILE_GUID = ac422cc1-d916-489a-b165-536fdfc633c2 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = PlatformDxeEntryPoint + +[Sources] + PlatformDxe.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.dec + Silicon/Socionext/SynQuacer/SynQuacer.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gNetsecNonDiscoverableDeviceGuid + +[Protocols] + gEdkiiNonDiscoverableDeviceProtocolGuid ## PRODUCES + +[FixedPcd] + gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase + gSynQuacerTokenSpaceGuid.PcdNetsecPhyAddress + +[Depex] + TRUE diff --git a/Silicon/Socionext/SynQuacer/SynQuacer.dec b/Silicon/Socionext/SynQuacer/SynQuacer.dec index 446be69473fb..80c53b1a7a2d 100644 --- a/Silicon/Socionext/SynQuacer/SynQuacer.dec +++ b/Silicon/Socionext/SynQuacer/SynQuacer.dec @@ -30,3 +30,6 @@ [PcdsFixedAtBuild] gSynQuacerTokenSpaceGuid.PcdSecondaryFvBase|0|UINT64|0x00000002 gSynQuacerTokenSpaceGuid.PcdSecondaryFvSize|0|UINT64|0x00000003 + + gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase|0|UINT32|0x00000004 + gSynQuacerTokenSpaceGuid.PcdNetsecPhyAddress|0|UINT8|0x00000005