From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.1987.1575282373019277919 for ; Mon, 02 Dec 2019 02:26:13 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ipzhIeao; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575282371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23GKYOhddPz/yMX05VtgUJbF78qnYtbAeJDdjdxWSCE=; b=ipzhIeaogJKKZBYGSJY/Zsl3ND4JaJbuKJ3VjSdyYUhR4morQWBKNJvWiJoz8WdtQcHcje mTU+tYAJCuNTOYx+6WnBiR7Fawq0lOaGLEuchl9STmnipvU8nzjT+8R4sDuJSCkR9jjhsK pi0trJM6CwD3o3VunZ7HaSarJG03DLs= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-400-XXU3xcKFMBuuzeH6ExOIpQ-1; Mon, 02 Dec 2019 05:26:10 -0500 Received: by mail-wr1-f70.google.com with SMTP id f17so5450132wrt.19 for ; Mon, 02 Dec 2019 02:26:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=23GKYOhddPz/yMX05VtgUJbF78qnYtbAeJDdjdxWSCE=; b=A/5oyZ35tM4TKopXulJ5QD2KZx3xizO2GudAtj+KFXT81/LYTFC1Op/AUDvuQXoyVi Sn+nn2sJeTobW18qZwth3dXyGlmOctmY+kyEBlYpkXq3Mk1of1N5RuyJ0GS58fTSyO4m 8hEubCS6hSGeDKvwrqSJu+62TzfBezRg/pn/zgLePZy3nYg/dM+eq405FkCWE6OIrObg Lwy+DXzKRzMgdCcst5Yie/DcWldSfrsH1xUTbUG4o/ziy9MVLFpBes53xh0T6Jhu4+US SRQG5gqlXZoM16Tw54YMq8z02kHRL1KIsCSmo0U4D1wpcJflunXyYjze2lcoOXjy8qjt Bmzg== X-Gm-Message-State: APjAAAV3SHtIfk0qmxFIuUUMmBSOy66OZiOPRd4A7Q3/ibU5d52vzrNJ /9WMWqyFa14YadGLghZ8lUZ+lHSjmnQz4myFYmCkow1910jDgWDynz1iI8652sq+n4NwsP9n/44 +fIb70r4Ux/32+A== X-Received: by 2002:a05:600c:507:: with SMTP id i7mr2088164wmc.135.1575282368825; Mon, 02 Dec 2019 02:26:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwpShiZXw6W/t1PZdhwDaF8dZ/xYyVtulMF7bMUwyGUl6pneTCS0VQXCewov7sAC8ds7rBkXA== X-Received: by 2002:a05:600c:507:: with SMTP id i7mr2088144wmc.135.1575282368577; Mon, 02 Dec 2019 02:26:08 -0800 (PST) Return-Path: Received: from [192.168.1.35] (182.red-88-21-103.staticip.rima-tde.net. [88.21.103.182]) by smtp.gmail.com with ESMTPSA id f1sm5197327wro.85.2019.12.02.02.26.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Dec 2019 02:26:08 -0800 (PST) Subject: Re: [edk2-devel] [PATCH edk2-platforms 1/2] Silicon/SynQuacer/PlatformDxe: move EMMC SSDT handling to core routine To: devel@edk2.groups.io, ard.biesheuvel@linaro.org Cc: leif.lindholm@linaro.org References: <20191129104716.819-1-ard.biesheuvel@linaro.org> <20191129104716.819-2-ard.biesheuvel@linaro.org> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <83f215c8-1608-7f40-48bf-6f1f12610c5b@redhat.com> Date: Mon, 2 Dec 2019 11:26:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191129104716.819-2-ard.biesheuvel@linaro.org> X-MC-Unique: XXU3xcKFMBuuzeH6ExOIpQ-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 11/29/19 11:47 AM, Ard Biesheuvel via Groups.Io wrote: > In preparation of adding support for describing the presence of OP-TEE > via a SSDT ACPI table, refactor the existing code so we will be able to > reuse it more easily. > > Signed-off-by: Ard Biesheuvel > --- > Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 55 ----------------- > Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 65 ++++++++++++++++++++ > 2 files changed, 65 insertions(+), 55 deletions(-) > > diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c > index 0d0e5edad901..90b67152c768 100644 > --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c > +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c > @@ -53,10 +53,6 @@ > > STATIC EFI_HANDLE mSdMmcControllerHandle; > > -STATIC EFI_ACPI_DESCRIPTION_HEADER *mSsdt; > -STATIC UINTN mSsdtSize; > -STATIC VOID *mEventRegistration; > - > /** > > Override function for SDHCI capability bits > @@ -185,31 +181,6 @@ STATIC EDKII_SD_MMC_OVERRIDE mSdMmcOverride = { > SynQuacerSdMmcNotifyPhase, > }; > > -STATIC > -VOID > -EFIAPI > -InstallAcpiTable ( > - IN EFI_EVENT Event, > - IN VOID* Context > - ) > -{ > - UINTN TableKey; > - EFI_STATUS Status; > - EFI_ACPI_TABLE_PROTOCOL *AcpiTable; > - > - Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, > - (VOID **)&AcpiTable); > - if (EFI_ERROR (Status)) { > - return; > - } > - > - Status = AcpiTable->InstallAcpiTable (AcpiTable, mSsdt, mSsdtSize, &TableKey); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table for eMMC - %r\n", > - __FUNCTION__, Status)); > - } > -} > - > EFI_STATUS > EFIAPI > RegisterEmmc ( > @@ -218,32 +189,6 @@ RegisterEmmc ( > { > EFI_STATUS Status; > EFI_HANDLE Handle; > - UINTN Index; > - > - if (mHiiSettings->AcpiPref == ACPIPREF_ACPI) { > - // > - // Load the SSDT table from a raw section in this FFS file. > - // > - for (Index = 0;; Index++) { > - Status = GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index, > - (VOID **)&mSsdt, &mSsdtSize); > - if (EFI_ERROR (Status)) { > - break; > - } > - > - if (mSsdt->OemTableId != EMMC_TABLE_ID) { > - continue; > - } > - > - // > - // Register for the ACPI table protocol > - // > - EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, > - InstallAcpiTable, NULL, &mEventRegistration); > - > - break; > - } > - } > > Status = RegisterNonDiscoverableMmioDevice ( > NonDiscoverableDeviceTypeSdhci, > diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c > index 73cc560fa8d8..c9cc37dd2478 100644 > --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c > +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c > @@ -113,6 +113,11 @@ STATIC EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR mI2c1Desc[] = { > } > }; > > +STATIC EFI_ACPI_DESCRIPTION_HEADER *mEmmcSsdt; > +STATIC UINTN mEmmcSsdtSize; > + > +STATIC VOID *mAcpiTableEventRegistration; > + > STATIC > EFI_STATUS > RegisterDevice ( > @@ -256,6 +261,32 @@ EnableSettingsForm ( > return InstallHiiPages (); > } > > +STATIC > +VOID > +EFIAPI > +InstallAcpiTables ( Maybe rename as InstallEmmcSsdtAcpiTables? Regardless the name chosen: Reviewed-by: Philippe Mathieu-Daude > + IN EFI_EVENT Event, > + IN VOID* Context > + ) > +{ > + UINTN TableKey; > + EFI_STATUS Status; > + EFI_ACPI_TABLE_PROTOCOL *AcpiTable; > + > + Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, > + (VOID **)&AcpiTable); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + Status = AcpiTable->InstallAcpiTable (AcpiTable, mEmmcSsdt, mEmmcSsdtSize, > + &TableKey); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table for eMMC - %r\n", > + __FUNCTION__, Status)); > + } > +} > + > EFI_STATUS > EFIAPI > PlatformDxeEntryPoint ( > @@ -267,6 +298,9 @@ PlatformDxeEntryPoint ( > VOID *Dtb; > UINTN DtbSize; > EFI_HANDLE Handle; > + EFI_ACPI_DESCRIPTION_HEADER *Ssdt; > + UINTN SsdtSize; > + UINTN Index; > > mHiiSettingsVal = PcdGet64 (PcdPlatformSettings); > mHiiSettings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&mHiiSettingsVal; > @@ -344,5 +378,36 @@ PlatformDxeEntryPoint ( > ASSERT_EFI_ERROR (Status); > } > > + if (mHiiSettings->AcpiPref == ACPIPREF_ACPI) { > + // > + // Load the SSDT tables from a raw section in this FFS file. > + // > + for (Index = 0;; Index++) { > + Status = GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index, > + (VOID **)&Ssdt, &SsdtSize); > + if (EFI_ERROR (Status)) { > + break; > + } > + > + switch (Ssdt->OemTableId) { > + case EMMC_TABLE_ID: > + if (mHiiSettings->EnableEmmc != EMMC_ENABLED) { > + break; > + } > + mEmmcSsdt = Ssdt; > + mEmmcSsdtSize = SsdtSize; > + break; > + } > + } > + > + if (mEmmcSsdtSize > 0) { > + // > + // Register for the ACPI table protocol if we found any SSDTs to install > + // > + EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, > + InstallAcpiTables, NULL, &mAcpiTableEventRegistration); > + } > + } > + > return EFI_SUCCESS; > } >