From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web12.12997.1610242141988502023 for ; Sat, 09 Jan 2021 17:29:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=mWgs3WKa; spf=pass (domain: nuviainc.com, ip: 209.85.221.43, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f43.google.com with SMTP id r7so12646919wrc.5 for ; Sat, 09 Jan 2021 17:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cidvmjwrHBInRtpr8IstRBRULwKcG94cRWAwsJvlc5E=; b=mWgs3WKaXl+nh9ZpHN5D/PjRbZytCmdf5W38+8dK1u7qF4KVD4M7gU6X8VVMHfMTJF OlLFuvz/kuoEX0rsRdvTk7KmJMlDzUlBvY0l+SWeDovaddUDULudlVi46P2ryIT0wa8x g9T2m6J9iWn2dKeDum79HbsVBlYFd08r6KnuUKC2LYBmsDWUn7CbknhLvRU1vtoeF92u hnyF4XWPgFO1976bhAjq3sh8JlavRtDRomi8rVOdqWyLPJC6H3/NYajofYrOk9vuaDkR HJCFZ7Oxnr9VoadWwvX5clkBWRarxF4THTZe5gQKLW/BfXJ2tmZLo4eI475xnSt3gDIl dg/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cidvmjwrHBInRtpr8IstRBRULwKcG94cRWAwsJvlc5E=; b=CZRJtTM8smA0diJUFEqGK/bIq6Hh8Ctymk61bLmGJ2sq3xzOro5HTdB2tJRBpcOEaF tENw1p140BWM6WZllydu0kmmHWbqUmMQcEFjrrkUY3BRVoILwzfMhyoOMFkb8WSj0mCw 8M2qhENME+7UdA9zL9zmmi6joCygNMraQrCfSNLZkqeHkNfuiQSYFeZMQgwNngPcbzy0 jUe8POyiUYLfgv8S85vhkb0v4AWSGlwvBKaOwHRq5IGMb3vxizgHmasuDHdc+nb+HLg5 PNeLZl5mfG8nWE/yZo3qnU/N7ULE5We5lpm972dnUoAphFhLlVLxgS0J7Gm4f9IypR5n QbyA== X-Gm-Message-State: AOAM533exhUa/o9ZuALlVqBz4PcbnYSDsgAW31mnDDUDjvf8rEGHyaON dN45reWjzJNr5iLOQeiauAlfKw== X-Google-Smtp-Source: ABdhPJzQQYwNAx4E0Er34TIUhmKfcxwJ67sMdX9rZbC+AYFWeHXeBuPF/RLVuWbjBsfNOq/RSnEwtg== X-Received: by 2002:a5d:4c4d:: with SMTP id n13mr10139901wrt.356.1610242140656; Sat, 09 Jan 2021 17:29:00 -0800 (PST) Return-Path: Received: from vanye (cpc1-cmbg19-2-0-cust915.5-4.cable.virginm.net. [82.27.183.148]) by smtp.gmail.com with ESMTPSA id z13sm24364986wmz.3.2021.01.09.17.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Jan 2021 17:29:00 -0800 (PST) Date: Sun, 10 Jan 2021 01:28:58 +0000 From: "Leif Lindholm" To: Rebecca Cran Cc: devel@edk2.groups.io, Ard Biesheuvel , "nd @ arm . com . Sami Mujawar" , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: Re: [PATCH v5 09/23] ArmPkg: Add helper to read CCIDX status Message-ID: <20210110012858.GB1664@vanye> References: <20210104225830.12606-1-rebecca@nuviainc.com> <20210104225830.12606-10-rebecca@nuviainc.com> MIME-Version: 1.0 In-Reply-To: <20210104225830.12606-10-rebecca@nuviainc.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 04, 2021 at 15:58:16 -0700, Rebecca Cran wrote: > Add a helper function to determine CCIDX support. > > Signed-off-by: Rebecca Cran > Reviewed-by: Sami Mujawar Reviewed-by: Leif Lindholm > --- > 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 >