From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web10.533.1588096254872963506 for ; Tue, 28 Apr 2020 10:50:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=bguHWpBV; spf=pass (domain: nuviainc.com, ip: 209.85.128.67, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f67.google.com with SMTP id z6so3881166wml.2 for ; Tue, 28 Apr 2020 10:50:54 -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=iMqyxSg0CMJEe6l9EUYaHHopCPnj7++zeoGuqYck5EA=; b=bguHWpBVwcGkTaruinZxv4cWVZGXPg+g2WCRLfs/OGnEWo9PNgLBwqC/dWSWZ5GSnA kpTDGqlE8xy6y21JDtxYATjqvxEfGTChd/01vdSrtAvjftlTt/2oJ0S5pP3hflwAs1CI Mu0c4yLdcE12WfqKSU7HtnhAoxeaUL0WZARh97dQUzXYQHi7kFlT+Cg/PMDy6EqV93S6 VdwEdU8jUMIvTyKaxg5Yb0xPUATgPf7s7+GSfnrHg3mvKMTAsUjJUcw5HdG+8bUJswwX /uHDHYgXrYj6/uPHDY6N8/3lzac5XnIuYSNaH94lJ0acIJ1j7YHOXhS7L9Umb29WlEY7 lkTQ== 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=iMqyxSg0CMJEe6l9EUYaHHopCPnj7++zeoGuqYck5EA=; b=aIEXkyLNzlfo8Wz5JjhEVTGa+7YgzbUhVN6QueW4TCJ4fmDxBVHNyh1Qnw5/MS7EMH FMJsrZ+0xrU5QyiCxQF9VT9NZSTOdR45gTJoP6iv2xFDGP/YBn/MNzeYJ5SKbX4NAIXT 3Yf9AOLFWhyDw3mhCypo8UP1YY8SRZyupEIR/a8TOHvBJ0nGeTAC46IJbOIL4/fNFuCl KCFKM1qFhmF3i/d+UHvq2lg0sQZF0c6Scsjs2DcCvg4e4pyXZmwZD/ltMRazK8D04NMR qeSsgdX0JrjQNtFCVaXwvBWDHUdaYcgx8EakN0p/GB+lrbxygP1HNvbg1VmEPeWdGnHk Y1fQ== X-Gm-Message-State: AGi0PubzGKfann5uC6uPDWhmJIXNC7r7R+6QlvLlpy3oGMTvYfUYWLZJ QJYDqjFIG+3GSy4DNMzspoSK7zRvYanW3Um3xENLGqVLtZRfnJhtrndzH/3RUPUIqY6FRG3prXt JtuizLG5Y9vwOFK/TBnCBRjpim/vxX217MjqymmgHlahJCYVXVy9O3Eiffl+5vKM= X-Google-Smtp-Source: APiQypLYiqk2UDpsuYSvBvze1wSoxNIEcwATdlacCfVGDkP4q43p0xQt2EguU83hn5WScW5nSciEqQ== X-Received: by 2002:a1c:bd08:: with SMTP id n8mr5690651wmf.23.1588096252427; Tue, 28 Apr 2020 10:50:52 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id n2sm12460170wrt.33.2020.04.28.10.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 10:50:51 -0700 (PDT) Date: Tue, 28 Apr 2020 18:50:49 +0100 From: "Leif Lindholm" To: devel@edk2.groups.io, ard.biesheuvel@arm.com Cc: "Pankaj Bansal (OSS)" , Meenakshi Aggarwal , Michael D Kinney , Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: Re: [edk2-devel] [PATCH edk2-platforms v3 16/24] Silicon/NXP: Add Chassis2 Package Message-ID: <20200428175049.GE21486@vanye> References: <20200423115707.GB14075@vanye> <20200423120537.GC14075@vanye> <20200423141842.GF14075@vanye> <20200423152616.GG14075@vanye> <20200424155105.GN14075@vanye> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 28, 2020 at 19:46:36 +0200, Ard Biesheuvel wrote: > On 4/24/20 5:51 PM, Leif Lindholm via groups.io wrote: > > On Fri, Apr 24, 2020 at 02:42:13 +0000, Pankaj Bansal (OSS) wrote: > > > > > > Why would multiple modules need to initialize the serial port? > > > > > > > > > > That's how the DebugLib has been designed. > > > > > DebugLib is used by all modules to print info on console. > > > > > BaseDebugLibSerialPortConstructor calls SerialPortInitialize. > > > > > So SerialPortInitialize is called by all the modules. > > > > > > > > Sure, but the bit where ChassisLib returns the active clock > > > > configuration does not need to happen for each initialization. > > > > That value can be cached. > > > > > > The only mechanism I know for passing a cached value between different modules > > > is either use PCDs or use HOBs. > > > We have already explored both in https://edk2.groups.io/g/devel/message/57254 > > > and https://edk2.groups.io/g/devel/message/56530 > > > > That was discussing what to do with regards to the generic 16550 > > driver. If we go with Laszlo's suggestion[1] for a separate > > SerialUartClockLib instead of adding a vendor GUID HOB *into the > > generic driver*, that does not preclude your using a HOB to cache the > > value in your platform code for later use in your own > > SerialUartClockLib implementation. > > > > [1] https://edk2.groups.io/g/devel/message/56767 > > > > Caching using a HOB is a bit problematic, given that SerialPortInitialize() > does not honour constructor ordering (it may be called before any of the > constructors), and so whether we implement Laszlo's suggestion or not, using > a HOB to cache anything that is required to set the correct baud rate is not > going to work (given that HobLib may rely on its constructor to be able to > access the HOB list) > > Unfortunately, that leaves us with little else, given that we cannot use > global variables either, since BASE libraries may be incorporated into PEIMs > that run execute-in-place from ROM. > > So the bottom line is that we don't have that many options that are actually > feasible, and so converging on one of the non-optimal ones is all that we > can really hope for at this point. Argh, OK. I hadn't tweaked this - so thanks for pointing it out. OK, given that: Reviewed-by: Leif Lindholm for this patch in its current state. Just, please use a single call to set up the struct pointer for future components where that is possible. / Leif