From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by mx.groups.io with SMTP id smtpd.web12.26141.1612135529836886334 for ; Sun, 31 Jan 2021 15:25:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=D5Z+a6B9; spf=pass (domain: nuviainc.com, ip: 209.85.222.174, mailfrom: rebecca@nuviainc.com) Received: by mail-qk1-f174.google.com with SMTP id a19so14645430qka.2 for ; Sun, 31 Jan 2021 15:25:29 -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=D5Z+a6B9rYz8Va3y5/ClDJSl8E7OJf7qOtMzaOxHxZi3/z8nYM9C7vLlQnr86Crr05 DSxXaU1K1K8sUYfYClpbut1RqSplmpo5Wwaj+qR3n7WEswo7CuzHo47RxJ2t6fN6L/Hx CfWCLKXjlwVOy3AHiSHjlSONNtd5RU3Tff4jc83jGegeK7hY/JRI1TmvscAkJ1JUMWQ9 zbVJHLb2BqbkZyZ8jhtVYFzvGF7Cu4N9xJ0fnkXtg1+sI0Qxwm/ma8MDYNg/DuoEjj/0 KQ2oPQgwDLcj+HuQIfpVPhSydV7q9KAa/coVLBkJKHGh+YvW+OnSZ5uloP1IoYDC9+d9 tRsg== 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=EFdkeKIdus3AV82/L1sXVmjMG5Z84krv0rYwDNmVJcVfj+QrHqXU2oIpKW9tQRHllQ mcbUR5TG0yLw/4jnPsQJmOvmDV59SWcX5pShxWozSnYKkIkoSRWdktFL7g9hhT4EJafd eu12oh5isifQjto/vVZMXrEWa7AK5uZ3qmY52QBgFOO/EHvOEhAgSxauh//ZnqJIFEAK Qtb6N361WeeDyUGnEL/hWW/x9Pwkkuz0MPk3roBOp0KOdGUNGnTJnLm0sz1SRn4BUOIq RXsw1uWwXS+O3UUU3fC38oaRzE+DpOOwR/c+kHhH9+E8gDnj0smQQ3+MWQ+qX0U2G1OB 4TxA== X-Gm-Message-State: AOAM531MU3/tsOJpBbYVnVRR2HEXiIqKQ5ivQ3DBxrXBhMmC30t140kA MmZ5xUXSzZtpJnpA3wAM/f7bzMgEDLmXpD2bmkaR6UDdrKOfBEL8XSPEB+1m61/ZvudxTczGhbL zjnKRKWFAj/DBB7TIH/RVV9pKpJ1CCfYLD4xQLnmMNSWAhnqiReDEfFnnuELsX4sBYu038g== X-Google-Smtp-Source: ABdhPJyMayRYtOfymHRNdwpXKbm0PsF5NA/cNJiO1F2lEEPf2+Jj9imkF0zSPao38bombB7pa/wk/Q== X-Received: by 2002:a37:bd84:: with SMTP id n126mr13519664qkf.54.1612135528744; Sun, 31 Jan 2021 15:25:28 -0800 (PST) Return-Path: Received: from cube.int.bluestop.org (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id 12sm11809361qkg.39.2021.01.31.15.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 15:25:28 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , leif@nuviainc.com, Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Samer El-Haj-Mahmoud , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Sami Mujawar Subject: [PATCH v7 06/21] ArmPkg: Fix the return type of the ReadCCSIDR function Date: Sun, 31 Jan 2021 16:24:56 -0700 Message-Id: <20210131232511.18340-7-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210131232511.18340-1-rebecca@nuviainc.com> References: <20210131232511.18340-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