From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mx.groups.io with SMTP id smtpd.web10.4172.1634103431292409812 for ; Tue, 12 Oct 2021 22:37:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=eJ02oDjd; spf=pass (domain: linaro.org, ip: 209.85.216.52, mailfrom: masami.hiramatsu@linaro.org) Received: by mail-pj1-f52.google.com with SMTP id q10-20020a17090a1b0a00b001a076a59640so3048538pjq.0 for ; Tue, 12 Oct 2021 22:37:11 -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=P8OdkLjVw+wPoN8+2h9S1VBk8uPu0mleYmeXRcI3jzU=; b=eJ02oDjdfolCod5UokkqA14rK6v66or2YepQF9yU81p3h/IHrCNCR9mEIo12GPcu/0 W4oMqiEEX2qUOJFQLU5tgszO1BRGOeQCBOg2/sgm7MPHDg1U4Y5SOckl+J0EDdj4osBo 2pj3ugL0IQqZc5w9M6Lx8gk4pyHyY8hrIIX4BIk22GNUeWXCUNESNX/l3Yg9OxjigVi5 b8xQfdEgZ13/JZYixyFB4cIPS5c7AJENjyNzYtUeM7u1KgPMXvyemkN8CgmJlAZiKqxI cJq5O+qv8xqezQSYBYPnGWi3WMxboPFJYaAtg/RRtJ/a6igDXdRL2AvdXrqeYC4AvKG0 WkIA== 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=P8OdkLjVw+wPoN8+2h9S1VBk8uPu0mleYmeXRcI3jzU=; b=HcJh/SBToevZIuxH7iUXD8OYuDV5uN5FfQefpstD4vxPbbejoVcIG69Djj89bTjDQu gCeBj4ID5+BAt4D5CgPVTc/rdYCYEbZgThPas8WZY0D2Yle0l7N0cSL7KgMVxsq/yiRk ZE1vd1diR1jF9hiYC00fX26WPW/Jm2sgM8HVJQcXuVyJYlSHGzIZrraU/y9X2pdBQe2J vfnxuFS17kYCCDqqc3qZyRTNMoQQ7UY1OR5jxTvly/XPF/8SspH4gZgAcfOKuRjy3DhR SovHoVLw3GZ9LsuLhNt2NJnUZ2Fd0YqREy6JB9COuInybBWg0WFVzpTgVwbGlQl4I5ga vmpA== X-Gm-Message-State: AOAM532cbse/nPukiqnEyJLnlGW08z+7Gab1rx2cGYL8Mp6YjJXRHWIS d2DrSaSQKTB3NZWDIMumlUaNKg== X-Google-Smtp-Source: ABdhPJwcpYM7qb1EQKhX9YwxwaRCI579NJixNKQL2uX4JqHE2S2cwy1IJMPhCP0iXTTacefxrieMCw== X-Received: by 2002:a17:90a:7e82:: with SMTP id j2mr11129539pjl.165.1634103430790; Tue, 12 Oct 2021 22:37:10 -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 q14sm4441139pjm.17.2021.10.12.22.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 22:37:10 -0700 (PDT) From: "Masami Hiramatsu" To: Ard Biesheuvel , Leif Lindholm Cc: devel@edk2.groups.io, Kazuhiko Sakamoto Subject: [PATCH 3/4] Silicon/AtSha204a: Test the ControllerHandle is managed by this driver Date: Wed, 13 Oct 2021 14:37:08 +0900 Message-Id: <163410342814.323609.6646089068979201893.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/Atmel/AtSha204a/AtSha204aDriver.h | 1 + Silicon/Atmel/AtSha204a/ComponentName.c | 13 +++++++++++++ Silicon/Atmel/AtSha204a/DriverBinding.c | 1 - 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Silicon/Atmel/AtSha204a/AtSha204aDriver.h b/Silicon/Atmel/AtSha204a/AtSha204aDriver.h index 615959baf4..11be15b25b 100644 --- a/Silicon/Atmel/AtSha204a/AtSha204aDriver.h +++ b/Silicon/Atmel/AtSha204a/AtSha204aDriver.h @@ -59,6 +59,7 @@ typedef struct { #define ATSHA204A_OPCODE_RANDOM 0x1b extern EFI_COMPONENT_NAME2_PROTOCOL gAtSha204aDriverComponentName2; +extern EFI_DRIVER_BINDING_PROTOCOL gI2cHwrngDriverBinding; EFI_STATUS AtSha204aInit ( diff --git a/Silicon/Atmel/AtSha204a/ComponentName.c b/Silicon/Atmel/AtSha204a/ComponentName.c index eec7b9120b..cc1d970bcf 100644 --- a/Silicon/Atmel/AtSha204a/ComponentName.c +++ b/Silicon/Atmel/AtSha204a/ComponentName.c @@ -159,6 +159,19 @@ AtSha204aGetControllerName ( OUT CHAR16 **ControllerName ) { + EFI_STATUS Status; + + if (!ControllerHandle) { + return EFI_INVALID_PARAMETER; + } + + Status = EfiTestManagedDevice (ControllerHandle, + gI2cHwrngDriverBinding.DriverBindingHandle, + &gEfiI2cIoProtocolGuid); + if (EFI_ERROR (Status)) { + return Status; + } + if (ChildHandle != NULL) { return EFI_UNSUPPORTED; } diff --git a/Silicon/Atmel/AtSha204a/DriverBinding.c b/Silicon/Atmel/AtSha204a/DriverBinding.c index 38ffd80df9..e278ab0554 100644 --- a/Silicon/Atmel/AtSha204a/DriverBinding.c +++ b/Silicon/Atmel/AtSha204a/DriverBinding.c @@ -132,7 +132,6 @@ I2cHwrngDriverBindingStop ( } -STATIC EFI_DRIVER_BINDING_PROTOCOL gI2cHwrngDriverBinding = { I2cHwrngDriverBindingSupported, I2cHwrngDriverBindingStart,