From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::643; helo=mail-pl1-x643.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (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 7A4AD202E53A3 for ; Tue, 12 Feb 2019 18:29:53 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id bj4so418319plb.7 for ; Tue, 12 Feb 2019 18:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PSQgbxZwtmg5gYBGoUV40cclzrso79x0kuWhymkA8Ac=; b=V+u8DDL1rlxVeit0zJNbc2v8zo9KWqL38UejvPRlpP++08SOktJM4r4zV6+Vrv9NHn egbiim3wFpknNulC0LKRInrSTrQfaOIlazxckVVnHDrc7IuAJCmaIQ48BtwG4gxzePxS vviSDQdUA3ylqxnzu9d94MARdtJV5IIW6CzKRDRwAz09pwvsib3S3Ur+/ZudEMgaJvBU HV1kEcxGKeaRaUTlcBWmpnD6uNJ1PRIaF6yDTkKt9GGsSeW9bupk2+b+UFz8DsAQOmAq v3xulfyooh0jGtepn7W4q2/kQ+ccpxWrY0u57wPKUZ+nwhW4HhPMP5A5nBESkwTWPYm3 9Kqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PSQgbxZwtmg5gYBGoUV40cclzrso79x0kuWhymkA8Ac=; b=cd+ryOrIlS1tlwA/LwBGU/XXI3DTK6RKGBqqP4asemE+WXMOEVUISnqDFVCQLjU1oo hyZTaoD8P/adfFCM4mPWPPIn6xO8g5ZaNW4DmuTGRoOMNNCNRRhmINUnYHmJpG6cvlYh AZIGZwtCstkibFgu70yWYLNBt4m5akI//3LxjwZG+b8Jqk9c1y2eOySM4YMKXcy3YsC/ cgimZ2Aip6wms9mh9hTghRK1OswNm/5ouU5ETYgyGgYXns57fKY0EqaA1Bq16MguLY6i Esbx8yd6nIvnBnKlNyj35bmKgcGV4bgwiPRjWnAwLLMCngkRMOfohFl8uUUTRMALY/ob jaJw== X-Gm-Message-State: AHQUAuY64QzmZsDQitok7Ps9hySsoKVy8zhm1AZQtjLK8aiDXhOzGGGE 5C3EFvuf38sIXmhkXtNXOcN0BRiZ1tc= X-Google-Smtp-Source: AHgI3IaQPuOGcDx98KRFgXwT34RaEZtk1K5idA7uYxG2yiVefUCTzpgIfBvAKsi1jTb9FzRJNLZZjg== X-Received: by 2002:a17:902:8bc6:: with SMTP id r6mr7195955plo.67.1550024992926; Tue, 12 Feb 2019 18:29:52 -0800 (PST) Received: from [10.58.0.74] ([64.64.108.254]) by smtp.gmail.com with ESMTPSA id w12sm14896630pgp.38.2019.02.12.18.29.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 18:29:52 -0800 (PST) To: Leif Lindholm 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 References: <20190201133436.10500-1-ming.huang@linaro.org> <20190201133436.10500-7-ming.huang@linaro.org> <20190211171518.b5rfubmx6t4q3y7r@bivouac.eciton.net> From: Ming Huang Message-ID: Date: Wed, 13 Feb 2019 10:29:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20190211171518.b5rfubmx6t4q3y7r@bivouac.eciton.net> 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: Wed, 13 Feb 2019 02:29:53 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 2/12/2019 1:15 AM, Leif Lindholm wrote: > 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. BRD_VER_4TH: BOARD_REVISION_4TH Modify in v2. > >> + >> #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 { Modify in v2. Thanks > > / > Leif > >> + return 2000000000; >> + } >> +} >> + >> -- >> 2.9.5 >>