From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by mx.groups.io with SMTP id smtpd.web12.75.1609801129341924637 for ; Mon, 04 Jan 2021 14:58:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=rJHlSfQj; spf=pass (domain: nuviainc.com, ip: 209.85.215.170, mailfrom: rebecca@nuviainc.com) Received: by mail-pg1-f170.google.com with SMTP id 15so20036677pgx.7 for ; Mon, 04 Jan 2021 14:58:49 -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=Zmg0N16Z3MtNegghLaUxv+ztbYAERT54e6vesG74x9w=; b=rJHlSfQjiCcxCHdFMdnaoP2kalNfyoXYF6Ze7jO4noHRlHxne3kAQQzBEHP8cHRZFz 1aAEEQRdTb/Txmb3ZvZL4O47WMjP2puqN8ORp3ZSpq5mBA573wcQk8RQ8uxhbJ4O5Okk Jv8UQzMBzkol+Vdjurlg2taqkpC3wfy90K0hW0JAntLBTAeuzQucDQrNfKdCHb295dhs eS1KE24Oh66UBc7WCwbzt5QJm8lQyadYtqIw2ueqf64F5bHG/ltYUqU1CVzVby949+oW RJgGf0AMy0rNlmIzgYkvcGIvjWGI5v75n3PzWcS5HyVUccEuHcphrg/4VEeU/Ty2zT0x Ecwg== 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=Zmg0N16Z3MtNegghLaUxv+ztbYAERT54e6vesG74x9w=; b=UXF9r4is14Bux0qJzGySwMt3evtkmhPF+suwPHKCRRKai3xiGCqy1rsG3gW2A1qrxE JBLYFAez2sXJEn3e3YUn123CCMqZRP+FsUEP2EESh0Icu6nLP83C0FRreWbqm77gE51H gFBRsXVZXF7ASRw2bbVklKaShbQqzRCuXpeZzXE4UjN5s7kF1gK26Uwz670DWfFv2Uob ZmcQfEm3AzQPR68iNCjkW+BrVOY7vxljFCIB+e9pqkwr1r3/g/tAGXQcYT//soJb6TQI QYj8BXoIqzBPIz5yRPCsDs/y/WWahj570h8dI9cUBu0lOy7WxPW+zlJ2pLxKT0MK27Ba 1R1A== X-Gm-Message-State: AOAM532Ac/xiHEsJGFte0VIcbYCvqE9oQmCPi/1BR366fiwYcWRZoD7Z 2pu8fnifOGg1e+PNnp9F4C4VfI2e1qPF42nTyfOgvFv/v1FY5WcsyjOA5tn2aF3W0iB/iuqiV74 LkWvK4B6hJqPgIQG/HJPwSTE0oDK1a/rl/fZ+8CVwKOlLybx73AuBka0tWyw02pHh+9zIhK+A X-Google-Smtp-Source: ABdhPJx6+L563EkURFZuZ6HLnsHhGB27Qm31RYosifd4hLY5pbz18QmpQid54jRhB941c1ego/YgZQ== X-Received: by 2002:a62:3:0:b029:160:d92:2680 with SMTP id 3-20020a6200030000b02901600d922680mr67215401pfa.44.1609801128426; Mon, 04 Jan 2021 14:58:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 14:58:47 -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 06/23] ArmPkg: Fix the return type of the ReadCCSIDR function Date: Mon, 4 Jan 2021 15:58:13 -0700 Message-Id: <20210104225830.12606-7-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 When CCIDX is supported, the Current Cache Size ID Register contains data above 32 bits: namely the number of sets. Avoid truncating this by returning a UINTN instead of UINT32. On AARCH32, the expanded number of sets data can be read via the CCSIDR2 register. Also, add Doxygen comments for the function. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar Reviewed-by: Leif Lindholm --- ArmPkg/Library/ArmLib/ArmLibPrivate.h | 9 ++++++++- ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S | 2 +- ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S | 2 +- ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ArmPkg/Library/ArmLib/ArmLibPrivate.h b/ArmPkg/Library/ArmLib/ArmLibPrivate.h index 2e90739eb858..8959bdd9d73c 100644 --- a/ArmPkg/Library/ArmLib/ArmLibPrivate.h +++ b/ArmPkg/Library/ArmLib/ArmLibPrivate.h @@ -61,7 +61,14 @@ CPSRRead ( VOID ); -UINT32 +/** Reads the CCSIDR register for the specified cache. + + @param CSSELR The CSSELR cache selection register value. + + @return The contents of the CCSIDR_EL1 register for the specified cache, when in AARCH64 mode. + Returns the contents of the CCSIDR register in AARCH32 mode. +**/ +UINTN ReadCCSIDR ( IN UINT32 CSSELR ); diff --git a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S index 0e8d21e2264f..0ae75e4cb9f9 100644 --- a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S +++ b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S @@ -84,7 +84,7 @@ ASM_FUNC(ArmDisableAllExceptions) ret -// UINT32 +// UINTN // ReadCCSIDR ( // IN UINT32 CSSELR // ) diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S index a60a2f634132..af61dbee5261 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S @@ -64,7 +64,7 @@ ASM_FUNC(ArmReadIdMmfr4) mrc p15,0,r0,c0,c2,6 @ Read ID_MMFR4 Register bx lr -// UINT32 +// UINTN // ReadCCSIDR ( // IN UINT32 CSSELR // ) diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm index 1679b09b797a..81f3cb79994c 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm @@ -68,7 +68,7 @@ mrc p15,0,r0,c0,c2,6 ; Read ID_MMFR4 Register bx LR -// UINT32 +// UINTN // ReadCCSIDR ( // IN UINT32 CSSELR // ) -- 2.26.2