From patchwork Wed Feb 20 07:28:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 158788 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4604407jaa; Tue, 19 Feb 2019 23:31:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IYleY+54xJhQx/x4OwGvR/6IKQTJEbfFEd2vJrzkeQssF/yumrGeyV2EEmox/W9CR70E4J0 X-Received: by 2002:ac8:fef:: with SMTP id f44mr26376735qtk.262.1550647891234; Tue, 19 Feb 2019 23:31:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550647891; cv=none; d=google.com; s=arc-20160816; b=p/WYmCTed6FKgEaASbMzMxPOadXP//GvGEdloChz8OCYLS+oe/CunE4K1p59bBMY+l cyOt8v5kcEE0hHwfvudEbVSvIWcVgltyRqBf1M8wRpv2xgFDSDu3IeoRdb682au5029s zr3eOjkvfHBF8PshZDCnCzOwhgIll4TdWxHFa0f/2ta9mweyqk+d1EYIcJJsrnds4rr1 hXkCI8o2CLWofN1afNzODtiA+wFfvh6CsEcMFBoUk3qT2JzndoMW/vOMM7KsDXHsG7RP 3tUZBOW984ZW4COQ9V5+ragD4jNSvna90zBbO5qdzO1X6ZLrzYpX/T84eHsONF/ZFtI+ PF5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:delivered-to; bh=kMmw6EQHMJYTAQJXsbljEr+v5JbDus3MkhGaYRc6fH4=; b=l2DPyPst7XlhQlvtemVC9yaYKZe85L6RrEQVzNt2qwHMLUoUzrT0Jp4kVkVoOsn8U/ JSBIUG0MBZt4k6AJ/JbwMu/bYO0wA5B4AIVyc4+eOxrZTHSxXWKo2gpzU68vTXUZznGy VdpviyPXmldJYzuDaHFxx3wuJV2VXp9KBPbFkIGJTrBsTB23jnNf2qQ4fGGgPGAi5cSy RNlrHng4k8m+1intDsfjTVDgLJDcxCcW/wO5euaxb8RryYVYV3EzfkemKoA4kKwlndQj osoS1Iiyw6i6EKO2yOAt8dxiO/3aI4o7/EHZewjPp2PxrS7pQmuEvS8zE5nH6H0EXwLn Lmzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.158.76.221 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (ec2-54-158-76-221.compute-1.amazonaws.com. [54.158.76.221]) by mx.google.com with ESMTPS id 33si2257725qtq.391.2019.02.19.23.31.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 23:31:31 -0800 (PST) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.158.76.221 as permitted sender) client-ip=54.158.76.221; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.158.76.221 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C6C5D619C5; Wed, 20 Feb 2019 07:31:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ip-10-150-125-211.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.2 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B5ED361950; Wed, 20 Feb 2019 07:30:09 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9EDCC619C9; Wed, 20 Feb 2019 07:30:05 +0000 (UTC) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by lists.linaro.org (Postfix) with ESMTPS id 0D8816195E for ; Wed, 20 Feb 2019 07:29:05 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id s1so11756952plp.9 for ; Tue, 19 Feb 2019 23:29:05 -0800 (PST) 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=Ur5zn7REmq046LXBleoPLLtnsQfwfughbzQep8BDAJw=; b=grPrZDoAJAeJz5O0j1EpoRgkAs1C+BAXGWwM1e9gRiIeFjlaDAxh15hVQr7s/vz5W8 AdCjMK1JFoKkY/v7WoKrSKM+hwJN1mh9csIkaGXIA53vgUOkfpzeocsZt1l+azSM8AEG ClUitnlHNSpcrXMk3d3s+7YrMXS+rngAz79HRx+5lMHLrDSYcW3X3hDZzb1+pkrUsS3p nslf7aXRSl0sBXoYfshBQYGH7DCsBLkcLtVS24IkKO7rfNGVI5j9n005nYviR9QlMQWB /MYsc3E+0jmxmPGbry7gYW9nZpo0fxU19y7hNoyyypw/79cOmrRznlM0G4MQoRUCAjnb Wftw== X-Gm-Message-State: AHQUAubHV7DqhxkqeddB1jjx++81JlubHSZMSqJchCZMLC6GoXwfTOHt BYz8KDGK3GPEsbebyukCEyt9XUyH X-Received: by 2002:a17:902:8b8b:: with SMTP id ay11mr4849081plb.162.1550647744363; Tue, 19 Feb 2019 23:29:04 -0800 (PST) Received: from localhost.localdomain ([203.160.91.226]) by smtp.gmail.com with ESMTPSA id 23sm19152969pft.187.2019.02.19.23.29.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Feb 2019 23:29:03 -0800 (PST) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Date: Wed, 20 Feb 2019 15:28:25 +0800 Message-Id: <20190220072837.35058-7-ming.huang@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190220072837.35058-1-ming.huang@linaro.org> References: <20190220072837.35058-1-ming.huang@linaro.org> Cc: huangming23@huawei.com, john.garry@huawei.com, xiaojun2@hisilicon.com, zhangjinsong2@huawei.com, xingjiang tang , huangdaode@hisilicon.com, zhangfeng56@huawei.com, michael.d.kinney@intel.com, lersek@redhat.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [PATCH edk2-platforms v2 06/18] Hisilicon/D06: Add OemGetCpuFreq to encapsulate difference X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "For discussions about Linaro-related UEFI development. Not a substitute for edk2-devel." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" 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..8eb333de529c 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 CPLD_BOARD_REVISION_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..624fa33d2e14 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 BoardRevision; + + BoardRevision = MmioRead8 (CPLD_BASE_ADDRESS + CPLD_BOM_VER_FLAG); + + // Board revision 4 and higher run at 2.5GHz + // Earlier revisions run at 2GHz + if (BoardRevision >= CPLD_BOARD_REVISION_4TH) { + return 2500000000; + } else { + return 2000000000; + } +} +