From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 1BB332034AB19 for ; Tue, 31 Oct 2017 21:42:53 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id j15so911777wre.8 for ; Tue, 31 Oct 2017 21:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZCEG5x4h4fQ2Pgsy8LG96J/e2abw4731janpYLb80Xc=; b=aPjSejQHbToC9YAK6n79MhpoujTg8JjdU+lHPfE5QhRX6egKBiBdTnUTBNfwUrsiiT EVxcpKseLOa07RzVPt8k3FCEr8cWbJ5HeiZdRdzNEJXaxRZoi+ARyzuptChop3s1eBOi YDrsYNLzuH0eoQ99nBxDrec8pv6Tq9nW55tGo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZCEG5x4h4fQ2Pgsy8LG96J/e2abw4731janpYLb80Xc=; b=q1AIzXekv7A4fIxk6fGoltDoRuqLGeAfT8watEAy18Lh6/KjTEBBo/g5Q8Z5slbKAt 4pWewe4rfKO3qtR8181kPcaiWD+Olhy4ibhHUznFaXB+qtBu03UPp7mCuKXsa68Zorn5 /k+1fYsHdxk8ZH+Q5S7wkXSGIiD/MVAAIeS5W4ZZEt/zMnN7S3/OZUgcSfBbePXHB1pb pIJIEXBDe+ni0x4XLkNozzurKgtC4A5X4sQJSd/gAZLKtbivoPzhUZq1iTcT1vktgyUS 3X2A/uxhAgXc42cq2yjaiAX2Mc0FC/tzPTQAmWyH9fQ2rZd40H1yMBHq2HjuoMjwUZEy pWlw== X-Gm-Message-State: AMCzsaUjA1yT7Ly1OMxW2QRoA3rdtME1wqu7deaKZYQsO9WIJM4pkf2w uDqOuDHOppR6DfZTREEIkqgViQ== X-Google-Smtp-Source: ABhQp+Qbpjb8pbfC3Zw56dbcgWKsOhE8LRIlzR3JBK1CirofHkxTRhw5DDIbT9LeZfbLrkS3nQzr0A== X-Received: by 10.223.163.208 with SMTP id m16mr4125838wrb.63.1509511604984; Tue, 31 Oct 2017 21:46:44 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id p77sm3048800wmd.28.2017.10.31.21.46.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Oct 2017 21:46:43 -0700 (PDT) Date: Wed, 1 Nov 2017 04:46:42 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, graeme.gregory@linaro.org, daniel.thompson@linaro.org, masami.hiramatsu@linaro.org, methavanitpong.pipat@socionext.com Message-ID: <20171101044642.rwiwsoapw24yy3fc@bivouac.eciton.net> References: <20171031105218.30208-1-ard.biesheuvel@linaro.org> <20171031105218.30208-5-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20171031105218.30208-5-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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: , X-List-Received-Date: Wed, 01 Nov 2017 04:42:54 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 31, 2017 at 10:51:55AM +0000, Ard Biesheuvel wrote: > 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 Reviewed-by: Leif Lindholm > --- > 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(+) > > 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 > -- > 2.11.0 >