From patchwork Wed Mar 20 08:08:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 160640 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp518989jad; Wed, 20 Mar 2019 01:09:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDGv2iOcQiEXFU5+n53MukQ+nby3kzBoFp1gg/qO1vb2pqNBgd4Q1lTRwdxGmRX7M5ZZMu X-Received: by 2002:aa7:9289:: with SMTP id j9mr6327698pfa.130.1553069371004; Wed, 20 Mar 2019 01:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553069370; cv=none; d=google.com; s=arc-20160816; b=rJ86hj2NkCVBj5Eu9cEuVrg8/Mav+EpKAslNX0jJfJ1VO4SFSKs4pO/ofdQisbk4+a IN8pKTK5o406QSCVIXS9frjsXwsypjGEywN138BkBOrd5mBc+et23YjSsUy0Ekja9ymo LG+IqHkgg451k9Qjn/cqYaQ0NE+x6kZztC/JWD0FNqtedAi7SAklcz0c+UdDqQEarvSC bzoQdE4BWeJJpCX9pzgjj+IayK1z0b9jP9+8MavORA6amcsfmPRHQemiUu4lqJWbaqUn ioKoRbIwmz1TYAhPX2FpsAycBDS2jhQ3r1ywUEK7Bwwx91nUcsTnWz5SyhzeHwh/6WdF cCPw== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=lW9mzf/srktmWf9oXeezfj2HYAhqVqIAF+e+sVLRUn8=; b=VoJw8kv9xMArBuQM/cTYJmOPA5XIy064wDoDlHTtBnXhf74B1+dkpFf7852Vn0Y4WC 3T3mqz7PzTODhYzHXiHPj9hfAbSqy3Pu72I1yp4gC0eKbiWrVPepWivzxt1aKW591F2F zMgP7x3cQ7N7CPNIrSZxDjAVN+z/SIp9Lke36ZAAxk6anzCgPqVMudSO9T5C5eNJg8Dw zsbeg4SJBmLCvcy+uW833Gd1ivI0jR981lxwG/VlE+RPnS/HSDil1u6kB1qSKO7Xbp0f WEUKO/lee5yDbyPufuDojPbAEfBhW22mLDDrJFA2jSFYnyp+wHHpSADSktsy+JEMiZeF 9uxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aUidOURU; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id t26si1095999pgu.504.2019.03.20.01.09.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 01:09:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aUidOURU; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 44132211E092C; Wed, 20 Mar 2019 01:09:30 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0: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 270EF211E010C for ; Wed, 20 Mar 2019 01:09:29 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id v64so1365220pfb.1 for ; Wed, 20 Mar 2019 01:09:29 -0700 (PDT) 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=k1V6hzpPybG54f/e6nZ95Pi12w1ONqa2XY+DvcTgtak=; b=aUidOURU2rXtEJqYyAX62Fb/v8fiXDOEzoDaP+HD52vZXIywAsTuMglkgC32ObsS1t 8Wbpbkew9azUGLK+x9ONTtu9lng0PcuprjvzQ95cSn4nWZwRaWilsblOcK3iQ/npX54C ePhoXK5vFgGnEF/yWCaIkPYh8i5AgIi8jhX7O/5ggVZt3Q0J1zJMQAyjJm/KblJaqkZ1 56haaAvBKsDoeC4H99IwDGFToKC525Lk0EVFqzlVKMoEd4U4fLYU4W5cMBwCj2d2eiTr 7efdU1TuzebEzF0WXhcgojHkWSHTETvqUkKHJl1o7TbwQKFLAPN04ohHgBKfRKYIrWn1 IfDA== 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=k1V6hzpPybG54f/e6nZ95Pi12w1ONqa2XY+DvcTgtak=; b=O+eL6O0IqN6dlKyPFiItj4dXiRpP9eGvYw2W6FhGJY/oltjMsd5JtCDnDwsZYJr5+I G2Syl1rHMoYMtoUjNZ58Jyhz32dLgXwAq0u6kfc4vCAsfAbQPJjdTXcXY6QMMErgMAss AhZ2SIJ8UGCMxMW+00WiuvlcGCl3tSpsdKzKCM5B+fljLVE6F4cmde10S2TMfFu+HWoJ wKWQNwDghoveDgsVEgBaXCfHh4JfUY/DN8lSnrl3k4xMxumVnoCG87KacBR28+LQ5leO dEd9jpFU+vtffeso5CHMvI8IFJGTpJN55RrE1hqehAeLQ3/cAClSyew4Fq4q8nRRaVnh 1o8g== X-Gm-Message-State: APjAAAWvglZXrcICWKnjMJOTyrWmBVJu09QnQLT/d99P6LZZAPsGhkwU kEkd0ksJIaHPBvmlpARSWihUVw== X-Received: by 2002:a65:4203:: with SMTP id c3mr6620166pgq.271.1553069368724; Wed, 20 Mar 2019 01:09:28 -0700 (PDT) Received: from localhost.localdomain ([203.160.91.226]) by smtp.gmail.com with ESMTPSA id f9sm1602796pfd.10.2019.03.20.01.09.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Mar 2019 01:09:28 -0700 (PDT) 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 Mar 2019 16:08:19 +0800 Message-Id: <20190320080829.52003-9-ming.huang@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190320080829.52003-1-ming.huang@linaro.org> References: <20190320080829.52003-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v3 08/18] 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: , 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 MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 ++++ Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) -- 2.9.5 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c index c5cb77696031..c8f71ecf890a 100644 --- a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c +++ b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c @@ -206,3 +206,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; + } +} +