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::544; helo=mail-pg1-x544.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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 315ED211C5729 for ; Fri, 1 Feb 2019 05:35:37 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id r11so2964471pgp.6 for ; Fri, 01 Feb 2019 05:35:37 -0800 (PST) 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; bh=7/46UVcRGojHSW9xzs/IJggzaof8BpRjrzIKbO67x0c=; b=NQx7JFSVz8TKemMrDflrR1ls+I0tdYvLy1ENptMlmpYoZR+wh9eviZafcWghKslIZ/ ZuHm42BgTkl8YuL8yGinAVUeX3vV2w3RZqA61c7HYs9Sk5hetN2gExULYB9v3oB6m7TA bK+RnqmIXtC+jyObthBrRXX87ZA+AKxNdtqAI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7/46UVcRGojHSW9xzs/IJggzaof8BpRjrzIKbO67x0c=; b=XsHIjJ01SqyLgLrGaWHeY1VhlWc803mI0gU6IyFZO4c93wGzF/yczskCNwXc3uATnB XZl098n5uSKI5tRReZU/aYQWld2INahzb3+3qm4IJHzg8RgEHG476KfqdZXXRUyX2YYK +oEAiDE7H+sq8PPdYAXNSgyxTQyMURdL9XjNHsgVKquNOTwo6ReChIaMC6AoS437ee7+ AQPQFvY0DAg/K1wwdhilcUU2gjGl/R3PtLG/YtZldEZchSYp053q1J7N95KG95j5dl4V /O8HoUxmdfUEc4gIOb5gOVqc70QQLbkknZee/W/Yd4Ifx0S/yAKpYrNvhD91kW8fAYro ctIQ== X-Gm-Message-State: AJcUukcHASz9kroY+98uLEB+Rq4AFAM4z+TH2yDAM5+/pGTC0IsZRMA8 7GhMnFvxeCAkaTs26waCXgUPog== X-Google-Smtp-Source: ALg8bN7HEKklqmGVQYkr40Rko+cbijZOo1Gu7o6c4bC0nN7jFZaqTUSYEx9nD+VEZ5QFlxxbms3+Kg== X-Received: by 2002:a62:5797:: with SMTP id i23mr26583870pfj.162.1549028136687; Fri, 01 Feb 2019 05:35:36 -0800 (PST) Received: from localhost.localdomain ([114.119.4.74]) by smtp.gmail.com with ESMTPSA id s21sm11134073pfk.133.2019.02.01.05.35.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Feb 2019 05:35:36 -0800 (PST) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Cc: 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 , Ming Huang Date: Fri, 1 Feb 2019 21:34:26 +0800 Message-Id: <20190201133436.10500-7-ming.huang@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190201133436.10500-1-ming.huang@linaro.org> References: <20190201133436.10500-1-ming.huang@linaro.org> Subject: [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: Fri, 01 Feb 2019 13:35:37 -0000 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 + #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; + + BrdVerData = MmioRead8(CPLD_BASE_ADDRESS + CPLD_BOM_VER_FLAG); + + if (BrdVerData >= BRD_VER_4TH){ //2.5G + return 2500000000; + } + else + { + return 2000000000; + } +} + -- 2.9.5