From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by mx.groups.io with SMTP id smtpd.web10.4046.1610642204701234235 for ; Thu, 14 Jan 2021 08:36:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=NOdsXlsG; spf=pass (domain: nuviainc.com, ip: 209.85.166.41, mailfrom: rebecca@nuviainc.com) Received: by mail-io1-f41.google.com with SMTP id b19so9848572ioa.9 for ; Thu, 14 Jan 2021 08:36:44 -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=NOdsXlsG3/FSn6HhPn19QXx71j9/YzAPIyWoQn8mLA4nR5VpT/L3E8BIvsl1KwCYXd iKI5WAa13j1efc6lFw8optMm0rPT47k/0gllX0LUVAZr1z73sEw6B7KUbagFZFwZZVeY 8WorIu9SwDOTQ+xJ/T4unNU1qUUlfFFoX9JbMNRVzU5axx0I9Z39b9MwveDaH30FGkhs sCTwVACgVJTSeFd84d98vkV4XRnhMhykGWXkxuX+GCF1f7Rajqkshz0aXvZSBrPHvesh vI/exAdr47qlsNDXA8bzYdWIpM2+qjrqjIEdDgOcMjLpohGyluhIae83w7W5Kf19gbJ0 RpOw== 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=NfLsQeMCtkxK+Ibydvx5WyhD9X2dkPBBlHgxUMAnpqDZXZQKQeV5dUJekWXGeJNdH3 G/LqQg22NeMG9HUxVFiEeXheOAS0QKYw3UzggDua5DIyKiZUNTJtiJCz433zDW1azcEK hAaAvv5uiwFThZASdCnBlK9tieCFSpAoHGNLVc1zUPE4sXn0pWldqfzaYIelGSU9xV4x C9kkyxVvVyd2ml8RY83d06aMqMDlbt1C5RAo61YEig1OjhaXtjetlurV+gNpe4A3KRXd S3lD8JZIWR49jAKFYsnNMkzcZGbsWaN9WgkKLpnAWylPHV5mQT/7L152Z3lUAtBpa1Vq aKkg== X-Gm-Message-State: AOAM5336eRfjT6kWST7Ig/4/Fu8GKUCUwUaZEO1j2Yr0yo9Op+DOw4op 3Bad22/YEj3nm7pnJHaT+4QvaL1CHrslBoBCKHhQjB2EZJu8KqHsHj+mh9ZyC0eaIMGx/AheS+b JYZ05zUhEYUufFFGia261OTVOsUI8k3lJVpGOiSJp66wu/0sia3fJtK1Tcsh2vXBzN8vfUeO0 X-Google-Smtp-Source: ABdhPJxDk3D5gJf4tauDsA542GhmKtBNSKPWOp48uA8qg7XOLlvUY9p0HSUsuR55QTzYYfNkZkdz6g== X-Received: by 2002:a92:cb44:: with SMTP id f4mr7210242ilq.131.1610642203897; Thu, 14 Jan 2021 08:36:43 -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 y5sm3711920ilj.35.2021.01.14.08.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:43 -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 v6 07/22] ArmPkg: Fix the return type of the ReadCCSIDR function Date: Thu, 14 Jan 2021 09:36:13 -0700 Message-Id: <20210114163628.31952-8-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-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