From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mx.groups.io with SMTP id smtpd.web08.61.1609801134791984650 for ; Mon, 04 Jan 2021 14:58:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=IZPGdPfX; spf=pass (domain: nuviainc.com, ip: 209.85.210.173, mailfrom: rebecca@nuviainc.com) Received: by mail-pf1-f173.google.com with SMTP id w6so17301320pfu.1 for ; Mon, 04 Jan 2021 14:58:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9F072htMU7pxi62EpvM2OGeEQNuhYjFgpg765+TG6Hs=; b=IZPGdPfXaHy7vDDhmrsyrxNYiKykwt3bM9dlvGCpvRBaggnsekOdFAUy9j+oNWeib/ e7kF652xXsJPVxPOfNZ9b4MZ5Sf8znPS9SmxFCgPO6dHTargbB9g4DyWu0Tow81sCp0g OVBhWyLESS1Wb5yEgTXMPk7DOxSu2ovVwccuBJqijZNoX4zyAee0KjWezp/5pIM3knWM SSibvQ/89K/x8gIyKseFuEiXuqJINz/bIAOIGl9j73DDfHLkSHAsX1u69aZa3HRNS+o1 +1uRLCLC+KVcYrE5ZMHE0yMixlnJk7z/BaeLGTdeevs/9TbuuL7NZEBN6mQs+4/Zu+Fv oR+A== 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:mime-version:content-transfer-encoding; bh=9F072htMU7pxi62EpvM2OGeEQNuhYjFgpg765+TG6Hs=; b=gry7agU6ba093UCYLHldC8/l1+7iEShSKILuAjTU9HVqqZJ4kd9gfiZGAzmbAxHUCi DQY6PtV2s3Y6RCE0T/H4Wrzxe4JfP0yCNuKSwchqmHDCdgtuv5mUIoNqGGBkrKotrdbd pOGvSda5WH5MvjhOJrXT+yI/TugM8Yz53r9WDoy5VfPKgZOS9IRHq5i2ZtqpcIfLib9Y pVC2G/TE6hY4k17614Ji0Ypdc072y0l+kV+XybQRzVBrtqGt2JHfXKicwKLpIRyn0xB9 xiNnSEhYW4tWpvZkmf1YbgIRaxww3jPWTaYgG5vwXjcUiDj3zHQfnJhYkmLQGanIdgI1 swJg== X-Gm-Message-State: AOAM5301rdEfXJVA5E6fqQ0lfCQSY7WtI+a0ZCUfASv3qtI953HyPIfZ 7KNteWucR1bzowZQZIzOWA5oLAqnLqUgho5UOZdvkhbsNss2QSZX0FUz7+wM5ds0X1FTI3tCVbk duhpyMU6LD0wNGYHzx/G8OjHcPTyaV6Kq6HahIb9fAJKQEfAjWjVvt6SuRHCMa2mDv97wGo6D X-Google-Smtp-Source: ABdhPJwvir1rZYZFPHStGpO7H021e0x41UFEO6PDE1wQ0MNQNAkYHJ8lKFtJ5fs+3webxLGTRtAQ5g== X-Received: by 2002:a63:48b:: with SMTP id 133mr72503457pge.139.1609801133864; Mon, 04 Jan 2021 14:58:53 -0800 (PST) Return-Path: Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id x143sm64185289pgx.66.2021.01.04.14.58.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 14:58:53 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , "nd @ arm . com . Sami Mujawar" , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [PATCH v5 09/23] ArmPkg: Add helper to read CCIDX status Date: Mon, 4 Jan 2021 15:58:16 -0700 Message-Id: <20210104225830.12606-10-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210104225830.12606-1-rebecca@nuviainc.com> References: <20210104225830.12606-1-rebecca@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a helper function to determine CCIDX support. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar --- ArmPkg/Include/Library/ArmLib.h | 11 +++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 17 +++++++++++++++++ ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c | 17 +++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index fd4f06d24274..70b9d816b74c 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -725,6 +725,17 @@ ArmHasGicSystemRegisters ( VOID ); +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ); + #ifdef MDE_CPU_ARM /// /// AArch32-only ID Register Helper functions diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c index 53e593bc994b..f0bf897da2a6 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -87,3 +87,20 @@ ArmHasGicSystemRegisters ( { return ((ArmReadIdAA64Pfr0 () & AARCH64_PFR0_GIC) != 0); } + +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ) +{ + UINTN Mmfr2; + + Mmfr2 = ArmReadIdAA64Mmfr2 (); + return (((Mmfr2 >> 20) & 0xF) == 1) ? TRUE : FALSE; +} diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c index 9f81a7223732..f5f1939c8fa4 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c @@ -102,3 +102,20 @@ ArmHasSecurityExtensions ( { return ((ArmReadIdPfr1 () & ARM_PFR1_SEC) != 0); } + +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ) +{ + UINTN Mmfr4; + + Mmfr4 = ArmReadIdMmfr4 (); + return (((Mmfr4 >> 24) & 0xF) == 1) ? TRUE : FALSE; +} -- 2.26.2