From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mx.groups.io with SMTP id smtpd.web08.4184.1634103423172721437 for ; Tue, 12 Oct 2021 22:37:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=TkQJGDht; spf=pass (domain: linaro.org, ip: 209.85.216.54, mailfrom: masami.hiramatsu@linaro.org) Received: by mail-pj1-f54.google.com with SMTP id d13-20020a17090ad3cd00b0019e746f7bd4so3581848pjw.0 for ; Tue, 12 Oct 2021 22:37:03 -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=514lYleBxiFBUyRczCW36VLo1ng2Y26DaHGXB9tKJuc=; b=TkQJGDhtaU70xJGSFW4PgS3uxU0RhTWOu0u6/LI94EjMk1l3NifN6wVs1wDZ+fMfE9 CFvKfU1yx68y/TG1VZTU5IUR5gSyQnjHrxZDGKkKjnXWHtRtT8RDSXO+69e+NtxXsmmZ J51vnzYMPoQrWvR1Ic3XVKr4To6YYzABCH62c6gAsxPd4vSWs9XQmCHyUIror+96eJ14 jzjhoNxNlEBLVA8QmmnpR+tLoJNTR3ELRt8q40WMJeQz6vty6TIEk73kHWf4kcHZxpGG VFZHErQiV4Luv1oVj70suiGI4I3OEI47B9OFXgr0FJ28LOtw1bUSLC/qxicSSGR0z6/G oIaA== 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=514lYleBxiFBUyRczCW36VLo1ng2Y26DaHGXB9tKJuc=; b=2jZz/c5Qj5qBOsMeHSZ/pB+wxLGHiyEVc5HlKWBf8FErGtOHV4rCRrCfQLeLR9JglZ +6kDytvbPx0vFMy6Beww1jDmOVFCXLimCd8mGrEuQ9HjwLUD06fvOTZmRB4B5Y7KD1zu 4O/+xtUeRqZUc8DHVOyw+ajKAtyR4Uy3wcb2uXdAGlVgLHghWfMvsglud6UvgGxdbeNY mP/BxnlaJ9HMDa8XMvdfMlUXPDQN3mmAMtVdTLalqW/JIyfJTx6v7IcEEMZdQ+pFic2b Unl4kxSeldGWNlTn+iSRq1q7RrAFPVZjnJtMaqj4zFWqT5i9u0oT7fVHn/T4nwu138Sm Zz/Q== X-Gm-Message-State: AOAM5302VZhlIqy+0iXaR1tjaCAOSH+KG0p9E0L/QKLW/IsW4ZI9g8+L M3E7hxgidgfxQZse2FazPhTh6w== X-Google-Smtp-Source: ABdhPJw2XXU77teRxaFgQMi29jFQePv03Ov0CVUd/glGiYhwxyibD1zboC6blvBxIesacwii8d/cfA== X-Received: by 2002:a17:90b:4d84:: with SMTP id oj4mr11286401pjb.58.1634103422806; Tue, 12 Oct 2021 22:37:02 -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 on17sm4803301pjb.47.2021.10.12.22.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 22:37:02 -0700 (PDT) From: "Masami Hiramatsu" To: Ard Biesheuvel , Leif Lindholm Cc: devel@edk2.groups.io, Kazuhiko Sakamoto Subject: [PATCH 2/4] Silicon/SynQuacerI2cDxe: Test the ControllerHandle is managed by this driver Date: Wed, 13 Oct 2021 14:36:59 +0900 Message-Id: <163410341947.323609.17810050212681648650.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 --- .../Drivers/SynQuacerI2cDxe/ComponentName.c | 13 +++++++++++++ .../Drivers/SynQuacerI2cDxe/DriverBinding.c | 2 +- .../Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/ComponentName.c b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/ComponentName.c index 9e7f189c13..ed5f11f107 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/ComponentName.c +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/ComponentName.c @@ -158,6 +158,19 @@ SynQuacerI2cGetControllerName ( OUT CHAR16 **ControllerName ) { + EFI_STATUS Status; + + if (!ControllerHandle) { + return EFI_INVALID_PARAMETER; + } + + Status = EfiTestManagedDevice (ControllerHandle, + gSynQuacerI2cDriverBinding.DriverBindingHandle, + &gEdkiiNonDiscoverableDeviceProtocolGuid); + if (EFI_ERROR (Status)) { + return Status; + } + if (ChildHandle != NULL) { return EFI_UNSUPPORTED; } diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c index 4e265aacf1..912ae79d14 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c @@ -129,7 +129,7 @@ SynQuacerI2cDriverBindingStop ( } -STATIC EFI_DRIVER_BINDING_PROTOCOL gSynQuacerI2cDriverBinding = { +EFI_DRIVER_BINDING_PROTOCOL gSynQuacerI2cDriverBinding = { SynQuacerI2cDriverBindingSupported, SynQuacerI2cDriverBindingStart, SynQuacerI2cDriverBindingStop, diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h index f891e4bf2f..c6534e6972 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h @@ -25,6 +25,7 @@ #include extern EFI_COMPONENT_NAME2_PROTOCOL gSynQuacerI2cDriverComponentName2; +extern EFI_DRIVER_BINDING_PROTOCOL gSynQuacerI2cDriverBinding; #define SYNQUACER_I2C_SIGNATURE SIGNATURE_32 ('S', 'I', '2', 'C') #define SYNQUACER_I2C_FROM_THIS(a) CR ((a), SYNQUACER_I2C_MASTER, \