From nobody Fri May 10 11:44:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39549+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39549+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1556195581; cv=none; d=zoho.com; s=zohoarc; b=f/g/cXX0QxlTbf0dS8GDkUwAxIkRTlD9MmY3A57Et5PkeGUrPPFgZXxZ8lmpvKqFyROnyZjNpFj8Dw/J3+NpvAMlKjFoZ6cckeYS/4ryBIknKY1W7Po2YKqRWY19vpxyw3/FXOITw8dZ5LWw7IyyLJ7BK/Orq6KOShzm+tCwenw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556195581; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=4NEUUzYL9XjpqaOvpsCX/PGgV18Z1cxV86O8LbK9M1c=; b=YG1FYM4SYfscGk36AtS0XvlKojEZK6ChkXdaGCSGRz80JIRi3LvFbVhTbXWJwxun2jg8gBQz/hzNgdresv1jwoUMB+XzpQpyU89eVFGt7HfMzzsStqR6PxjSB6wq10fzWBwxEy3zu3t9/U6nrJ+0k3Qrg3r3jHJY6b6HVDxfx88= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39549+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556195581279531.5506391823138; Thu, 25 Apr 2019 05:33:01 -0700 (PDT) Return-Path: X-Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by groups.io with SMTP; Thu, 25 Apr 2019 05:33:00 -0700 X-Received: by mail-wr1-f66.google.com with SMTP id b1so18757334wru.3 for ; Thu, 25 Apr 2019 05:33:00 -0700 (PDT) X-Gm-Message-State: APjAAAVtYdAJgSZKj+vRu1st+BCYhxXQ9y434j8MS0cZc8EXjGDhyNxx 44oDWGaipICJXUqQaBfxiSW4ttr7seM9HA== X-Google-Smtp-Source: APXvYqwgiuBFjG9DYsT9jqpfmTAxuI+413I4Eqm3CsFHOAiy32WhrTH0ucCp+vCCcE5P+Tv3mHmVhg== X-Received: by 2002:a5d:4483:: with SMTP id j3mr14985117wrq.145.1556195578606; Thu, 25 Apr 2019 05:32:58 -0700 (PDT) X-Received: from sudo.home ([2a01:cb1d:112:6f00:95f:9014:5be9:5288]) by smtp.gmail.com with ESMTPSA id o6sm43753488wre.60.2019.04.25.05.32.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 05:32:57 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, graeme.gregory@linaro.org, masahisa.kojima@linaro.org, Ard Biesheuvel Subject: [edk2-devel] [PATCH edk2-platforms 1/3] Silicon/SynQuacer: describe 96boards LS connector GPIOs via ACPI Date: Thu, 25 Apr 2019 14:32:52 +0200 Message-Id: <20190425123254.16396-2-ard.biesheuvel@linaro.org> In-Reply-To: <20190425123254.16396-1-ard.biesheuvel@linaro.org> References: <20190425123254.16396-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556195580; bh=ihIiVwCv74eBVEQXvkNRR+r28MApq7JIT4M4xqgrt0g=; h=Cc:Date:From:Reply-To:Subject:To; b=ll38uACXa9g/jw6Xd6VW2SvArkyKCG1XSdXiWwn9kTPHgsXJXKDTIYZbgZZB2FS4eH9 dMNS0+hOfR9Euv2B9QE7CbOz77libjrhcQ83p3u8pIDtm6HHdYbaTNkM7uRiJhX0ZAMD8 Sa1/yQS/BSLDgSCmZ+sSY49eceBTkSXbV6Y= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Describe the 96boards LS connector GPIO resources via a new LS96 device object. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf | 14 ++++++++++++++ Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl | 20 +++++++++++++++= +++++ 2 files changed, 34 insertions(+) diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf b/Silico= n/Socionext/SynQuacer/AcpiTables/AcpiTables.inf index 6fbdf4d67a88..0fef8b9ca05b 100644 --- a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf @@ -40,6 +40,7 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + Platform/96Boards/96Boards.dec Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.dec Silicon/Socionext/SynQuacer/SynQuacer.dec =20 @@ -63,3 +64,16 @@ [FixedPcd] gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase gSynQuacerTokenSpaceGuid.PcdNetsecPhyAddress gSynQuacerTokenSpaceGuid.PcdPcie0PresenceDetectGpioPin + + g96BoardsTokenSpaceGuid.PcdGpioPinA + g96BoardsTokenSpaceGuid.PcdGpioPinB + g96BoardsTokenSpaceGuid.PcdGpioPinC + g96BoardsTokenSpaceGuid.PcdGpioPinD + g96BoardsTokenSpaceGuid.PcdGpioPinE + g96BoardsTokenSpaceGuid.PcdGpioPinF + g96BoardsTokenSpaceGuid.PcdGpioPinG + g96BoardsTokenSpaceGuid.PcdGpioPinH + g96BoardsTokenSpaceGuid.PcdGpioPinI + g96BoardsTokenSpaceGuid.PcdGpioPinJ + g96BoardsTokenSpaceGuid.PcdGpioPinK + g96BoardsTokenSpaceGuid.PcdGpioPinL diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl b/Silicon/Soci= onext/SynQuacer/AcpiTables/Dsdt.asl index acb77739ded6..0702edc06f74 100644 --- a/Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl @@ -253,5 +253,25 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "SNI", "S= YNQUACR", Return (0xF) } } + + Device (LS96) { + Name (GPIO, ResourceTemplate () { + GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionNone, "\\_SB.GP= IO") + { + FixedPcdGet32 (PcdGpioPinA), + FixedPcdGet32 (PcdGpioPinB), + FixedPcdGet32 (PcdGpioPinC), + FixedPcdGet32 (PcdGpioPinD), + FixedPcdGet32 (PcdGpioPinE), + FixedPcdGet32 (PcdGpioPinF), + FixedPcdGet32 (PcdGpioPinG), + FixedPcdGet32 (PcdGpioPinH), + FixedPcdGet32 (PcdGpioPinI), + FixedPcdGet32 (PcdGpioPinJ), + FixedPcdGet32 (PcdGpioPinK), + FixedPcdGet32 (PcdGpioPinL), + } + }) + } } // Scope (_SB) } --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39549): https://edk2.groups.io/g/devel/message/39549 Mute This Topic: https://groups.io/mt/31341742/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 11:44:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39550+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39550+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1556195582; cv=none; d=zoho.com; s=zohoarc; b=IqMETAIbXYWb87qxdY7OdByHi4rE3rQKGF0UVcvwxmm0cWsqV76XHnow9PY6jqwuNf/+VMYKa3qS6aJxvz2ilPVrVLsDH5XV8KG1VZ9hYFaPvubuXdDdPHzzjj0jRM8g1wx2O6aBV7rFMwQc+8S/TkTI9WeK4wA3SYC7leEds1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556195582; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=xyBQ7BPFoFfxzy8h3s1+uC5tJf+9ShvberwvyF9IYIw=; b=T/BGqifgaAEwu/aBsbooeNPIVGq/VgkSIlnjsfGWXAlkBFZak9WmqBDBTZIy/w7RlbsKpQvL6P20PmvQL3iFd68rEOs9LfMSxSisR7OEc4apZFUCDiRZlWixpkz0cMG6YD51OnnBK8ROoQXS5TaxXL74jOQKE3ia/bW2x3pLlak= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39550+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556195582736914.6932323010504; Thu, 25 Apr 2019 05:33:02 -0700 (PDT) Return-Path: X-Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by groups.io with SMTP; Thu, 25 Apr 2019 05:33:02 -0700 X-Received: by mail-wm1-f65.google.com with SMTP id o25so9039691wmf.5 for ; Thu, 25 Apr 2019 05:33:01 -0700 (PDT) X-Gm-Message-State: APjAAAU6SkOg6S9ZCZ0a36fpOD9V5rvcqaOJm3l10WgIAbDJEKhQFUH3 nbjfbDkFMwhulGIhP/4hOk8bcaQIYQ3BMw== X-Google-Smtp-Source: APXvYqwRFVMt49bMG4rDTduOh6Qlw15uMtfdggQewb25qD97xkBeg378GiRpQC2YWa+gztuMiDLitw== X-Received: by 2002:a1c:2087:: with SMTP id g129mr3606176wmg.114.1556195579767; Thu, 25 Apr 2019 05:32:59 -0700 (PDT) X-Received: from sudo.home ([2a01:cb1d:112:6f00:95f:9014:5be9:5288]) by smtp.gmail.com with ESMTPSA id o6sm43753488wre.60.2019.04.25.05.32.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 05:32:58 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, graeme.gregory@linaro.org, masahisa.kojima@linaro.org, Ard Biesheuvel Subject: [edk2-devel] [PATCH edk2-platforms 2/3] Platform/96Boards: add ACPI support to mezzanine/LS connector driver Date: Thu, 25 Apr 2019 14:32:53 +0200 Message-Id: <20190425123254.16396-3-ard.biesheuvel@linaro.org> In-Reply-To: <20190425123254.16396-1-ard.biesheuvel@linaro.org> References: <20190425123254.16396-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556195582; bh=zmdqanEofhlGPNq9YZ5RahbZ+EzY2N1LRp+MZ+inMpc=; h=Cc:Date:From:Reply-To:Subject:To; b=QuPvi6tV9xMoUnLtTJVYOSH+9tCrbhfLmIglbDEu/D+GIJTZfOeK9NEosLI9o4cA/9Q X4gWFcoHDxXJoZdJ1yeE/QT8ueVE+4ZWcyXMnrDXl3ejw8azu3HPoqD9yHRQGfRpf5xjM L1h7XwRRkREJldEx7d4a2tAFHqw1XCoPzKU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Make the LS connector mezzanine support code ACPI aware, and invoke the appropriate hook in the driver code to install a SSDT instead of a DT overlay when running on a system that is booting in ACPI mode. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Platform/96Boards/Include/Protocol/Mezzanine.h | 21 ++++++++++++ Platform/96Boards/LsConnectorDxe/LsConnectorDxe.c | 35 ++++++++++++++---= --- Platform/96Boards/LsConnectorDxe/LsConnectorDxe.inf | 1 + 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/Platform/96Boards/Include/Protocol/Mezzanine.h b/Platform/96Bo= ards/Include/Protocol/Mezzanine.h index 9847649d2ac3..97f43e9a920f 100644 --- a/Platform/96Boards/Include/Protocol/Mezzanine.h +++ b/Platform/96Boards/Include/Protocol/Mezzanine.h @@ -16,6 +16,7 @@ #define _96BOARDS_MEZZANINE_H_ =20 #include +#include #include =20 #define MEZZANINE_PROTOCOL_GUID \ @@ -39,12 +40,32 @@ EFI_STATUS IN OUT VOID *Dtb ); =20 +/** + Install the mezzanine's SSDT table + + @param[in] This Pointer to the MEZZANINE_PROTOCOL instance. + @param[in] Dtb Pointer to the device tree blob + + @return EFI_SUCCESS Operation succeeded. + @return other An error has occurred. +**/ +typedef +EFI_STATUS +(EFIAPI *INSTALL_SSDT_TABLE) ( + IN MEZZANINE_PROTOCOL *This, + IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol + ); + struct _MEZZANINE_PROTOCOL { // // Get the device tree overlay for this mezzanine board // APPLY_DEVICE_TREE_OVERLAY ApplyDeviceTreeOverlay; // + // Install the mezzanine's SSDT table + // + INSTALL_SSDT_TABLE InstallSsdtTable; + // // The number of devices on LS connector I2C bus #0 // UINT32 I2c0NumDevices; diff --git a/Platform/96Boards/LsConnectorDxe/LsConnectorDxe.c b/Platform/9= 6Boards/LsConnectorDxe/LsConnectorDxe.c index f19d95635056..27044c5da699 100644 --- a/Platform/96Boards/LsConnectorDxe/LsConnectorDxe.c +++ b/Platform/96Boards/LsConnectorDxe/LsConnectorDxe.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include =20 @@ -97,7 +98,7 @@ InstallHiiPages ( STATIC VOID EFIAPI -ApplyDeviceTreeOverlay ( +PublishOsDescription ( EFI_EVENT Event, VOID *Context ) @@ -105,11 +106,30 @@ ApplyDeviceTreeOverlay ( VOID *Dtb; MEZZANINE_PROTOCOL *Mezzanine; EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol; + + Status =3D gBS->LocateProtocol (&g96BoardsMezzanineProtocolGuid, NULL, + (VOID **)&Mezzanine); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a: no mezzanine driver active\n", __FUNCTION__)); + return; + } + + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, + (VOID **)&AcpiProtocol); + if (!EFI_ERROR (Status)) { + Status =3D Mezzanine->InstallSsdtTable (Mezzanine, AcpiProtocol); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table - %r\n", + __FUNCTION__, Status)); + } + return; + } =20 // // Find the DTB in the configuration table array. If it isn't there, just - // bail without an error: we may be running on an ACPI platform even if - // this driver does not support it [yet]. + // bail without an error: the system may be able to proceed even without + // ACPI or DT description, so it isn't up to us to complain about this. // Status =3D EfiGetSystemConfigurationTable (&gFdtTableGuid, &Dtb); if (Status =3D=3D EFI_NOT_FOUND) { @@ -117,13 +137,6 @@ ApplyDeviceTreeOverlay ( } ASSERT_EFI_ERROR (Status); =20 - Status =3D gBS->LocateProtocol (&g96BoardsMezzanineProtocolGuid, NULL, - (VOID **)&Mezzanine); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "%a: no mezzanine driver active\n", __FUNCTION__)); - return; - } - Status =3D Mezzanine->ApplyDeviceTreeOverlay (Mezzanine, Dtb); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "%a: failed to apply DT overlay - %r\n", __FUNCTIO= N__, @@ -211,7 +224,7 @@ EntryPoint ( Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - ApplyDeviceTreeOverlay, + PublishOsDescription, NULL, &gEfiEndOfDxeEventGroupGuid, &EndOfDxeEvent); diff --git a/Platform/96Boards/LsConnectorDxe/LsConnectorDxe.inf b/Platform= /96Boards/LsConnectorDxe/LsConnectorDxe.inf index 1bf528ceaa84..20b9637c1923 100644 --- a/Platform/96Boards/LsConnectorDxe/LsConnectorDxe.inf +++ b/Platform/96Boards/LsConnectorDxe/LsConnectorDxe.inf @@ -46,6 +46,7 @@ [LibraryClasses] [Protocols] g96BoardsLsConnectorProtocolGuid ## PRODUCES g96BoardsMezzanineProtocolGuid ## CONSUMES + gEfiAcpiTableProtocolGuid ## SOMETIMES_CONSUMES =20 [Guids] gEfiEndOfDxeEventGroupGuid --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39550): https://edk2.groups.io/g/devel/message/39550 Mute This Topic: https://groups.io/mt/31341743/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 11:44:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39551+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39551+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1556195585; cv=none; d=zoho.com; s=zohoarc; b=l6SqkehonZmetTiTb8zIPGCeXRb1j0EUusdlJ4ptk0ry8vot5CzGrVg/4rzPCx39i5Qd3ycRmLixI17NTYST9YYAF5mN+ilrth1xpuONzBBYY8Pwod16JfxampjDe7waUtFx+P3Lhz40/ggzCIC5PpkLTQ3k0Q/QKyUxviBSG6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556195585; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=9B6FCF/hjiE7wz/CFSElE9vNJ+Ew9TxzMBkpAqsZoDM=; b=C2EOQSyNpU3Bt3wGIHGNwQlskbXdqxCt+71hFBtsAmQ24lZ6EoE2TNhmWJbZT3gIvzEkjWZF26rFnLoLmMvxsDGpNSllWqPcSBiGsZSL5osO7M2MfTOnG3P7Z9JKKSjBg3Q54wIDmySYBxPKLCfM6CDECXEwbIkIUdNnJt83O2Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39551+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556195585103117.37188436412009; Thu, 25 Apr 2019 05:33:05 -0700 (PDT) Return-Path: X-Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by groups.io with SMTP; Thu, 25 Apr 2019 05:33:03 -0700 X-Received: by mail-wr1-f47.google.com with SMTP id a12so6834412wrq.10 for ; Thu, 25 Apr 2019 05:33:02 -0700 (PDT) X-Gm-Message-State: APjAAAX1oSmE+RsoRVBevBiKyot1wsb2ereYjeR0T0VuriHl2KE2u68c N8Y82SK0SR4tni4eykGmdXPVdwZver1K3A== X-Google-Smtp-Source: APXvYqw+fAF0VFMh1U9o5LUKangvmuNMMMNhqXBsWwp6IlWytV3dIxJ1QAbhaQBLN3lZQcy85JDAIQ== X-Received: by 2002:a05:6000:104:: with SMTP id o4mr5361405wrx.106.1556195581096; Thu, 25 Apr 2019 05:33:01 -0700 (PDT) X-Received: from sudo.home ([2a01:cb1d:112:6f00:95f:9014:5be9:5288]) by smtp.gmail.com with ESMTPSA id o6sm43753488wre.60.2019.04.25.05.32.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 05:33:00 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, graeme.gregory@linaro.org, masahisa.kojima@linaro.org, Ard Biesheuvel Subject: [edk2-devel] [PATCH edk2-platforms 3/3] Platform/Secure96Dxe: add ACPI description of the GPIO LEDs Date: Thu, 25 Apr 2019 14:32:54 +0200 Message-Id: <20190425123254.16396-4-ard.biesheuvel@linaro.org> In-Reply-To: <20190425123254.16396-1-ard.biesheuvel@linaro.org> References: <20190425123254.16396-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556195583; bh=3O47OsHTSt8PiwD+S2ki2t0FB0/RCm6E+uvOqQlYIC4=; h=Cc:Date:From:Reply-To:Subject:To; b=mZdp1eWdEXLNgzKQwjofK+YS3t6Y47IqYznYuWj7lQ9byg+9nQNiskP8itq2KUd+sSQ 5UaxyihOVZd1hF/YMmhkt80SYciQDKebkxwRaXxdtaGZ3umBdTeZQAVUytnpnAa4SYRbP ShY0em+a5uBvsnkmVHHu5Z9s3gXzP5FgBHo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Wire up the new 96boards mezzanine SSDT loading support, and use it to describe the four GPIO LEDs on the Secure96 mezzanine board. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Platform/96Boards/Secure96Dxe/Secure96.asl | 103 ++++++++++++++++++++ Platform/96Boards/Secure96Dxe/Secure96Dxe.c | 59 ++++++++++- Platform/96Boards/Secure96Dxe/Secure96Dxe.inf | 1 + 3 files changed, 158 insertions(+), 5 deletions(-) diff --git a/Platform/96Boards/Secure96Dxe/Secure96.asl b/Platform/96Boards= /Secure96Dxe/Secure96.asl new file mode 100644 index 000000000000..bb9dac462a33 --- /dev/null +++ b/Platform/96Boards/Secure96Dxe/Secure96.asl @@ -0,0 +1,103 @@ +/** @file + * Copyright (c) 2019, Linaro Limited. 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 "Secure96.h" + +DefinitionBlock ("Secure96.aml", "SSDT", 2, "LINARO", "SECURE96", 1) +{ + External (\_SB.LS96.GPIO) + + Scope (_SB) + { + Device (LD96) + { + Name (_HID, "PRP0001") // _HID: Hardware ID + Name (_UID, 0x00) // _UID: Unique ID + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "compatible", "gpio-leds" }, + } + }) + + Method (_CRS) + { + Return (\_SB.LS96.GPIO) + } + + Device (LDU1) + { + Name (_ADR, 0x1) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "label", "secure96-u1" }, + Package () { "gpios", + Package () { + ^^LD96, 0, 6, FixedPcdGet32 (PcdGpioPolari= ty) + }, + }, + } + }) + } + + Device (LDU2) + { + Name (_ADR, 0x2) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "label", "secure96-u2" }, + Package () { "gpios", + Package () { + ^^LD96, 0, 5, FixedPcdGet32 (PcdGpioPolari= ty) + }, + }, + } + }) + } + + Device (LDU3) + { + Name (_ADR, 0x3) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "label", "secure96-u3" }, + Package () { "gpios", + Package () { + ^^LD96, 0, 8, FixedPcdGet32 (PcdGpioPolari= ty) + }, + }, + } + }) + } + + Device (LDU4) + { + Name (_ADR, 0x4) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "label", "secure96-u4" }, + Package () { "gpios", + Package () { + ^^LD96, 0, 7, FixedPcdGet32 (PcdGpioPolari= ty) + }, + }, + } + }) + } + } + } +} diff --git a/Platform/96Boards/Secure96Dxe/Secure96Dxe.c b/Platform/96Board= s/Secure96Dxe/Secure96Dxe.c index 6c48d7c0b024..68f8ec812b52 100644 --- a/Platform/96Boards/Secure96Dxe/Secure96Dxe.c +++ b/Platform/96Boards/Secure96Dxe/Secure96Dxe.c @@ -24,6 +24,8 @@ =20 #include "Secure96.h" =20 +#define SECURE96_SSDT_OEM_TABLE_ID SIGNATURE_64('S','E','C','U','R','E','9= ','6') + STATIC CONST UINT32 mI2cAtmelSha204aSlaveAddress[] =3D { ATSHA204A_SLAVE_ADDRESS, =20 @@ -148,15 +150,20 @@ ApplyDeviceTreeOverlay ( UINTN OverlaySize; EFI_STATUS Status; INT32 Err; + UINTN Index; =20 // // Load the raw overlay DTB image from the raw section of this FFS file. // - Status =3D GetSectionFromFv (&gEfiCallerIdGuid, - EFI_SECTION_RAW, 0, &Overlay, &OverlaySize); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return EFI_NOT_FOUND; + for (Index =3D 0;; Index++) { + Status =3D GetSectionFromFv (&gEfiCallerIdGuid, + EFI_SECTION_RAW, Index, &Overlay, &OverlaySize); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + if (!fdt_check_header (Overlay)) { + break; + } } =20 // @@ -177,8 +184,50 @@ ApplyDeviceTreeOverlay ( return EFI_SUCCESS; } =20 +/** + Install the mezzanine's SSDT table + + @param[in] This Pointer to the MEZZANINE_PROTOCOL instance. + @param[in] Dtb Pointer to the device tree blob + + @return EFI_SUCCESS Operation succeeded. + @return other An error has occurred. +**/ +STATIC +EFI_STATUS +EFIAPI +InstallSsdtTable ( + IN MEZZANINE_PROTOCOL *This, + IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol + ) +{ + EFI_ACPI_DESCRIPTION_HEADER *Ssdt; + UINTN SsdtSize; + EFI_STATUS Status; + UINTN Index; + UINTN TableKey; + + // + // Load SSDT table from the raw section of this FFS file. + // + for (Index =3D 0;; Index++) { + Status =3D GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index, + (VOID **)&Ssdt, &SsdtSize); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + if (SsdtSize >=3D sizeof (EFI_ACPI_DESCRIPTION_HEADER) && + Ssdt->OemTableId =3D=3D SECURE96_SSDT_OEM_TABLE_ID) { + break; + } + } + return AcpiProtocol->InstallAcpiTable (AcpiProtocol, Ssdt, SsdtSize, + &TableKey); +} + STATIC MEZZANINE_PROTOCOL mMezzanine =3D { ApplyDeviceTreeOverlay, + InstallSsdtTable, ARRAY_SIZE (mI2c0Devices), 0, mI2c0Devices, diff --git a/Platform/96Boards/Secure96Dxe/Secure96Dxe.inf b/Platform/96Boa= rds/Secure96Dxe/Secure96Dxe.inf index 72dbf1314c15..ce4c8b5f8fa5 100644 --- a/Platform/96Boards/Secure96Dxe/Secure96Dxe.inf +++ b/Platform/96Boards/Secure96Dxe/Secure96Dxe.inf @@ -21,6 +21,7 @@ [Defines] ENTRY_POINT =3D Secure96DxeEntryPoint =20 [Sources] + Secure96.asl Secure96.dts Secure96.h Secure96Dxe.c --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39551): https://edk2.groups.io/g/devel/message/39551 Mute This Topic: https://groups.io/mt/31341744/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-