From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web10.1717.1589822788578740314 for ; Mon, 18 May 2020 10:26:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=KBEgdurW; spf=pass (domain: nuviainc.com, ip: 209.85.221.68, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f68.google.com with SMTP id l18so12821347wrn.6 for ; Mon, 18 May 2020 10:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=f0rkyvwWx8pEwz4guxWLNoGR4HYEh9xBOCv/HMnNQhE=; b=KBEgdurW6uZepBIPhDvwlMnWH7T63W45I+cnFbbl6QAtiYonPJeOyO2zb+8I7KL4vG hyLs9adfs0gT6332q0u9Wy/iVbBZWoK2WPQ9eQhr+Ln2HbeUl9BBjl+pbcldrSRxY69Y Xwle8KCkjxmsuApd7CNdTEa5Qpt800GwUmWrpQs1MQ5/ESkHTN7dvoW4sdpFTRemC33T rnV7Hb/sdaMZe8ueLui2GuvrLOSAwECebvG7wZw10XOOzco/1zdsJ9ysQhiPWk4LeuDg 69rqIKOKRESTFwDSl7UHpX4sr1KaCiX43Oa1zJSyxO4qgltJr9BsaROyJfQQ3L0ceQP+ eXVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=f0rkyvwWx8pEwz4guxWLNoGR4HYEh9xBOCv/HMnNQhE=; b=ArFVI6Vz03IC2JqQpVmv6wxBr5YG6IsBkwF73Q2+ISTcmWFkkHDdMJRHhh87bjZ4j8 CqegOseW6kDKAQT/4obenZKzhUbsZkfs/vs1vS/HtugUAiB7UR3yC9L3OmJ07nlloD2+ YZnWhU15kl5efoFKio7z8S1lG2KuyTBVMuuDzqB9xd5OAFh9BRPULzYUGkcsXBcfpSfY i4TsvNhsEjQZUo+9CmNE3T9eyFewELTbCYJtXKps+Q5FZyul87GAykdpxbmuwxYIEaT2 jM5KwXCpw0oVlEziTNeOaeDUYNrogee9Ga2lT0vcxE4adumbrN73B5I81EHSMheDZR/n EFMw== X-Gm-Message-State: AOAM532q4uhhE0v7zcjA+V+pH1naJ3cAOCrD56LcDrW2o5pfKNekNqYp cef5xlz4OLwRpgKUJ1vKG2XnVw== X-Google-Smtp-Source: ABdhPJzL4aMMTJsfOBtu/d20DVGHlQf/RTlXOuWjNqvO4HaOhY6hZgVOtZcjhaC8Wh3BbGZ40EVlYQ== X-Received: by 2002:adf:fdd0:: with SMTP id i16mr20965530wrs.389.1589822787164; Mon, 18 May 2020 10:26:27 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id c19sm18259389wrb.89.2020.05.18.10.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 10:26:26 -0700 (PDT) Date: Mon, 18 May 2020 18:26:24 +0100 From: "Leif Lindholm" To: Ard Biesheuvel Cc: devel@edk2.groups.io Subject: Re: [PATCH edk2-platforms 1/3] Platform/96Boards/96BoardsI2cDxe: connect I2C controllers at EndOfDxe Message-ID: <20200518172624.GF10467@vanye> References: <20200516175934.31148-1-ard.biesheuvel@arm.com> <20200516175934.31148-2-ard.biesheuvel@arm.com> MIME-Version: 1.0 In-Reply-To: <20200516175934.31148-2-ard.biesheuvel@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 16, 2020 at 19:59:32 +0200, Ard Biesheuvel wrote: > The 96boards I2C driver currently relies on the platform to connect > all controllers, or I2C peripherals will not be exposed if they are > not the active boot target. Since I2C peripherals are not boot targets > in the first place, but are used to expose things like random number > generators, let's connect the I2C controllers specifically at EndOfDxe > so that the devices living on it will be available regardless of the > boot policy. > > Signed-off-by: Ard Biesheuvel > --- > Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.inf | 5 ++++- > Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.c | 18 ++++++++++++++++++ > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.inf b/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.inf > index ae69f0933e93..3d9ca559e60b 100644 > --- a/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.inf > +++ b/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.inf > @@ -36,10 +36,13 @@ [Protocols] > [Guids] > g96BoardsI2c0MasterGuid > g96BoardsI2c1MasterGuid > + gEfiEndOfDxeEventGroupGuid > > [FixedPcd] > g96BoardsTokenSpaceGuid.PcdI2c0BusFrequencyHz > g96BoardsTokenSpaceGuid.PcdI2c1BusFrequencyHz > > [Depex] > - g96BoardsMezzanineProtocolGuid AND g96BoardsI2c0MasterGuid OR g96BoardsI2c1MasterGuid > + g96BoardsMezzanineProtocolGuid AND ( > + g96BoardsI2c0MasterGuid OR g96BoardsI2c1MasterGuid > + ) Is this change actually a bugfix? It appears unrelated to the patch description as such, although clearly an improvement. / Leif > diff --git a/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.c b/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.c > index e4ecbca62c0c..a751769cf691 100644 > --- a/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.c > +++ b/Platform/96Boards/96BoardsI2cDxe/96BoardsI2cDxe.c > @@ -179,6 +179,19 @@ RegisterI2cBus ( > ASSERT_EFI_ERROR (Status); > } > > +STATIC > +VOID > +EFIAPI > +OnEndOfDxe ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + gBS->CloseEvent (Event); > + gBS->ConnectController (mI2cBus0.I2cMasterHandle, NULL, NULL, TRUE); > + gBS->ConnectController (mI2cBus1.I2cMasterHandle, NULL, NULL, TRUE); > +} > + > EFI_STATUS > EFIAPI > EntryPoint ( > @@ -187,6 +200,7 @@ EntryPoint ( > ) > { > EFI_STATUS Status; > + EFI_EVENT EndOfDxeEvent; > > Status = gBS->LocateProtocol (&g96BoardsMezzanineProtocolGuid, NULL, > (VOID **)&mMezzanine); > @@ -197,5 +211,9 @@ EntryPoint ( > RegisterI2cBus (&g96BoardsI2c1MasterGuid, &mI2cBus1, > mMezzanine->I2c1NumDevices, mMezzanine->I2c1DeviceArray); > > + Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnEndOfDxe, > + NULL, &gEfiEndOfDxeEventGroupGuid, &EndOfDxeEvent); > + ASSERT_EFI_ERROR (Status); > + > return EFI_SUCCESS; > } > -- > 2.17.1 >