From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by mx.groups.io with SMTP id smtpd.web10.4173.1634103439638195677 for ; Tue, 12 Oct 2021 22:37:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=VVl4/5XG; spf=pass (domain: linaro.org, ip: 209.85.215.175, mailfrom: masami.hiramatsu@linaro.org) Received: by mail-pg1-f175.google.com with SMTP id d23so1218616pgh.8 for ; Tue, 12 Oct 2021 22:37:19 -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 :user-agent:mime-version:content-transfer-encoding; bh=okBDti0OS3Q4tjLWlOx4ITVxdwgOPMwP37GvA49Ru/c=; b=VVl4/5XGFQAa8wOvpasBWKeAo8BgK2XlLCm87+PlJTTCIfGxz17UbaEH6k0+f5tqzC AonyemJq+hni6RyuWGRc6qxdjTshvXoR1DbYnlxjNx1piPOVyGD7igryjEEuxE3I2tzO tajzdSawFndzhUqA7s4IZ8JigOYm0JXEDnRZm4KvV/JDwMpGeI+xQaMrXL5cNTYlNlzD od9CxNSeqXUhZ2i24NRE5b1FLiFn5YEigZoqDYYLXsZPmy3Sn+UCsAjntBlL5dfpKypj MIVqAyhA7XOGyedzl9uxlvX0ChajkDasubXAXW9ePiE7qWYpPBvoRrUlOAcaIJ6bEIGs ZdKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=okBDti0OS3Q4tjLWlOx4ITVxdwgOPMwP37GvA49Ru/c=; b=kcL64nF5kn2AVUJ306hWoXXq6tXIKbvMjgTwHA6onQ2S17eD6SI3ve8YNdrPBTJwze l3Ba6lKihZtNaYYBr1PkmdeEIIqs45zWaF7QE0mFsa4DVcsv0vLPnMra/Fi6Sz862uyX Q0aashbo1A2JtRlIn0cuK2jiYeaIf7oj6ijzZZ11W5tXLllyedngAKi1mi3ZOWmy48mY Trh55vdWX65ffh+czSh6FhyOtPQJNqF10l+Yf+jDocCicXw1/GQNBzYO9tNGFTavww1M ryLpQPTYa57nzCBNptE+oiFMdnIblZvKiCYrxz48POJ+BOb1HJiOJa3EP9SIjcgvHWdj pTxg== X-Gm-Message-State: AOAM533B8AQd4+P735nZuGHPtkQlcODiAKBucGPpgLUheVsHD1tm1QZa OaleU8Q5JByOWXWIKji1imDqmA== X-Google-Smtp-Source: ABdhPJxHbi74Mh6zAnjc5n3LZ5dV3SHdUYhUXZXMCMpQQxoWINmvCafA7MYfIzmB/5QsfjZcuoqSyA== X-Received: by 2002:a63:2b03:: with SMTP id r3mr26482646pgr.188.1634103439252; Tue, 12 Oct 2021 22:37:19 -0700 (PDT) Return-Path: Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id mu7sm5215406pjb.12.2021.10.12.22.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 22:37:19 -0700 (PDT) From: "Masami Hiramatsu" To: Ard Biesheuvel , Leif Lindholm Cc: devel@edk2.groups.io, Kazuhiko Sakamoto Subject: [PATCH 4/4] Silicon/ChaosKeyDxe: Test the ControllerHandle is managed by this driver Date: Wed, 13 Oct 2021 14:37:16 +0900 Message-Id: <163410343613.323609.5589920422459869029.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163410340292.323609.10978291802739074305.stgit@localhost> References: <163410340292.323609.10978291802739074305.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit From: Kazuhiko Sakamoto Test the @ControllerHandle is not NULL and is actually managed by this driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Kazuhiko Sakamoto Signed-off-by: Masami Hiramatsu --- Silicon/Openmoko/ChaosKeyDxe/ChaosKeyDriver.h | 1 + Silicon/Openmoko/ChaosKeyDxe/ComponentName.c | 13 +++++++++++++ Silicon/Openmoko/ChaosKeyDxe/DriverBinding.c | 1 - 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Silicon/Openmoko/ChaosKeyDxe/ChaosKeyDriver.h b/Silicon/Openmoko/ChaosKeyDxe/ChaosKeyDriver.h index 97cfbbb755..59582b3bf9 100644 --- a/Silicon/Openmoko/ChaosKeyDxe/ChaosKeyDriver.h +++ b/Silicon/Openmoko/ChaosKeyDxe/ChaosKeyDriver.h @@ -38,6 +38,7 @@ typedef struct { CR(a, CHAOSKEY_DEV, Rng, CHAOSKEY_DEV_SIGNATURE) extern EFI_COMPONENT_NAME2_PROTOCOL gChaosKeyDriverComponentName2; +extern EFI_DRIVER_BINDING_PROTOCOL gUsbDriverBinding; EFI_STATUS ChaosKeyInit ( diff --git a/Silicon/Openmoko/ChaosKeyDxe/ComponentName.c b/Silicon/Openmoko/ChaosKeyDxe/ComponentName.c index 25117e2500..5b0f42cb67 100644 --- a/Silicon/Openmoko/ChaosKeyDxe/ComponentName.c +++ b/Silicon/Openmoko/ChaosKeyDxe/ComponentName.c @@ -159,6 +159,19 @@ ChaosKeyGetControllerName ( OUT CHAR16 **ControllerName ) { + EFI_STATUS Status; + + if (!ControllerHandle) { + return EFI_INVALID_PARAMETER; + } + + Status = EfiTestManagedDevice (ControllerHandle, + gUsbDriverBinding.DriverBindingHandle, + &gEfiUsbIoProtocolGuid); + if (EFI_ERROR (Status)) { + return Status; + } + if (ChildHandle != NULL) { return EFI_UNSUPPORTED; } diff --git a/Silicon/Openmoko/ChaosKeyDxe/DriverBinding.c b/Silicon/Openmoko/ChaosKeyDxe/DriverBinding.c index e7d0d3fe56..4cbd23ad36 100644 --- a/Silicon/Openmoko/ChaosKeyDxe/DriverBinding.c +++ b/Silicon/Openmoko/ChaosKeyDxe/DriverBinding.c @@ -146,7 +146,6 @@ UsbHwrngDriverBindingStop ( } -STATIC EFI_DRIVER_BINDING_PROTOCOL gUsbDriverBinding = { UsbHwrngDriverBindingSupported, UsbHwrngDriverBindingStart,