From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D6F5B208F6122 for ; Mon, 11 Feb 2019 09:15:23 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id r2so5550779wrv.10 for ; Mon, 11 Feb 2019 09:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=f1aEdDLFNjLR1SZNgqWHXZNgVB7GmgP368LCsek7+NM=; b=c74SNjhY02wGKRrrJy6Bs2mN5uchqS+eqhDhq6R805wikTghulYLF6W9zcgXZQG4Mi CydHOZPEqYiaqkje0RrELxx6F1ldGsh5AYyK8YwRHOPNSm2icJUfD6RsTqG8gYoB72w5 SOblsLRcV1jsFKdvYRmWuehZhcOlqj/MBpHmyT0/yJ3W0vcSLgdvLuZ75TcH8eIDvYsY 5wOiD0isOI1lARvMJEPr25ytglkjM4VqtuNsFydoC/Az9FtS8BhWBpqIn3Csu/jI1uZh CdSsKw4F7S4I9yFXIxlEYNkeM6r/FOikW4W0K2Hdi3P2houA0tvyslswRENYx7bphY1v nI0w== 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=f1aEdDLFNjLR1SZNgqWHXZNgVB7GmgP368LCsek7+NM=; b=jJnc2RZx862Ah3GrrnK9WypAwBuFvXsNZFtI1s29VzG71XJ0OcGaMIltE0V05ai6bp 5kZ7YIxzBdYrcA5FaZOooxx8fBAC60IsEXMZpTAUdrC9RuTScZajWhCYGRFq2/Sha9eQ WpskphnAKaQZ/d943Nfim1zTgOCeN/rvzbcy++9BGnItVk4G6Pcxw0qBwfCqgNudxgWW fhBWHaMv7V2AQENgxIOOWkQYg00WHCm5t9VuBosLXJP2z1u2O26cZjCE3moBjxXakt8P MEkFHh66Yye3cxXBMtgzlFa9eLH6yiLoMDNlTA5QZkYai0nPJOGMCgbKZ5TfpmLM5Uwq Z3yQ== X-Gm-Message-State: AHQUAuYxDgS9u3lTxFrR1Jd2X4iseE99a72oOTwSGtgEkO6erkqcomiQ +jxpsm6ky0UMco92kRketvAq7A== X-Google-Smtp-Source: AHgI3IZjoCvpfKbEUITU2iwg4w944lqaW5HDDWF7XSdi2HrOb64FrokYppVMYhikOiVGsWtHui6nOQ== X-Received: by 2002:adf:ffca:: with SMTP id x10mr29769814wrs.289.1549905322203; Mon, 11 Feb 2019 09:15:22 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id t5sm9988757wmg.43.2019.02.11.09.15.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 09:15:20 -0800 (PST) Date: Mon, 11 Feb 2019 17:15:18 +0000 From: Leif Lindholm To: Ming Huang Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, lersek@redhat.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org, zhangfeng56@huawei.com, xingjiang tang Message-ID: <20190211171518.b5rfubmx6t4q3y7r@bivouac.eciton.net> References: <20190201133436.10500-1-ming.huang@linaro.org> <20190201133436.10500-7-ming.huang@linaro.org> MIME-Version: 1.0 In-Reply-To: <20190201133436.10500-7-ming.huang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms v1 06/16] Hisilicon/D06: Add OemGetCpuFreq to encapsulate difference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2019 17:15:24 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 01, 2019 at 09:34:26PM +0800, Ming Huang wrote: > From: xingjiang tang > > Implementation OemGetCpuFreq() to get cpu frequency from cpld to > encapsulate project difference, for some projects don't support > get cpu frequency by this way. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ming Huang > --- > Platform/Hisilicon/D06/Include/Library/CpldD06.h | 4 ++++ > Silicon/Hisilicon/Include/Library/OemMiscLib.h | 2 ++ > Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c | 16 ++++++++++++++++ > 3 files changed, 22 insertions(+) > > diff --git a/Platform/Hisilicon/D06/Include/Library/CpldD06.h b/Platform/Hisilicon/D06/Include/Library/CpldD06.h > index ec9b49f4e70d..4d07a8ab3741 100644 > --- a/Platform/Hisilicon/D06/Include/Library/CpldD06.h > +++ b/Platform/Hisilicon/D06/Include/Library/CpldD06.h > @@ -36,4 +36,8 @@ > #define CPLD_X8_X8_X8_BOARD_ID 0x92 > #define CPLD_X16_X8_BOARD_ID 0x93 > > +#define CPLD_CLOCK_FLAG 0xFD > +#define CPLD_BOM_VER_FLAG 0x0B > +#define BRD_VER_4TH 0x4 What is BRD_VER_4TH? Please write out full words. Also, this macro needs a CPLD_ prefix. > + > #endif /* __CPLDD06_H__ */ > diff --git a/Silicon/Hisilicon/Include/Library/OemMiscLib.h b/Silicon/Hisilicon/Include/Library/OemMiscLib.h > index 86ea6a1b3deb..dfac87d635d9 100644 > --- a/Silicon/Hisilicon/Include/Library/OemMiscLib.h > +++ b/Silicon/Hisilicon/Include/Library/OemMiscLib.h > @@ -53,4 +53,6 @@ BOOLEAN OemIsNeedDisableExpanderBuffer(VOID); > > extern EFI_STRING_ID gDimmToDevLocator[MAX_SOCKET][MAX_CHANNEL][MAX_DIMM]; > EFI_HII_HANDLE EFIAPI OemGetPackages (); > +UINTN OemGetCpuFreq (UINT8 Socket); > + > #endif > diff --git a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c > index 2a9db46d1ff9..8f2ac308c7b9 100644 > --- a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c > +++ b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c > @@ -207,3 +207,19 @@ OemIsNeedDisableExpanderBuffer ( > { > return TRUE; > } > + > +UINTN OemGetCpuFreq (UINT8 Socket) > +{ > + UINT8 BrdVerData; Write out full words. > + > + BrdVerData = MmioRead8(CPLD_BASE_ADDRESS + CPLD_BOM_VER_FLAG); Space before (. > + > + if (BrdVerData >= BRD_VER_4TH){ //2.5G What is the comment saying? The number below? The number below is also saying the number below. A useful comment would be "// Board revision 4 and higher run at 2.5GHz // Earlier revisions run at 2GHz" At that point you don't even need the #define. And not really the temporary variable either. > + return 2500000000; > + } > + else > + { } else { / Leif > + return 2000000000; > + } > +} > + > -- > 2.9.5 >