From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mx.groups.io with SMTP id smtpd.web12.29047.1612745595384381626 for ; Sun, 07 Feb 2021 16:53:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=rswzWrUB; spf=pass (domain: nuviainc.com, ip: 209.85.210.177, mailfrom: rebecca@nuviainc.com) Received: by mail-pf1-f177.google.com with SMTP id k13so2173942pfh.13 for ; Sun, 07 Feb 2021 16:53:15 -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=rswzWrUBzjwDqnzbPH4qCvvnrRYfiDKAmxAhqgrjkrjzf5GHcXRkqRAJai4dqWZel0 usqCnODG2Un3HK7VSVFPzp1V5Hv+qwJ31kBrVgRac8eLhIYT0ku/bM9LHAdWrBIMPptO 02wZkcOx2a9KgZPHzys9jc//oqgUZ8izcDC29NL0PGmh6kRdidWRkHHUNVg/TF22ePbI 7XCH+RFiPlbQnNSsxPed6Oejt2Vu7ZTzsDerPNxR3cyc47bZbFp3nSCkyhyTWGQ7t2Gb rDq4GCgWJWzHvq/+eaQ2pDFk87cw5Okwi21y55WGRl92+t4GEcg+UAgTj33jF80EE0SJ 8rrA== 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=ZqQ+NIf5zVYw+ZYg06gtv/h4s6Na0YVjqMudf7WoRmqX3KHtkIJROFp90SxPulUg8g 7KyUOq9tZVXC2q/QmpTW7NojFSsMJ4s2mFhKOVDPbY3Qb/vUzCi7ofExsaM3Kq2Jzb0n omidMCYz/1EXP6eEkrVZa92Z8534OW2H+ljJUHdBHYYA9CFmYAyJ4pJ24yOOYt7RHPRn FnQVHIrt3tU+X9aR86b51tttxXynkavrMvcwa3q5dv+4hOWmcyXk+j8OSxEzmORF51bB LKbZaE1JEEkOBYux6zKTawX8Pb/1WJSOgbMyHxst74gPNCAIiwTd7y8X008YKibXbyzO HL2g== X-Gm-Message-State: AOAM532YNZpoQ0RO8/B8q5BflbP5aNqnjv7DhyWzGUP76oTFXu2nyccR 3jHbZRCIqnOrsZijUjzNIboUH52DwkibH/DmaemlGeZmc1yl5A7Z+O30mQvr3SgGvRGyPEC0IRw U5sMAuBV8w/BFVJuX/xe52haPlHlNKcD8CDMqwFFgSzJC35vzxHoA6hYpTdtlsPGu4+sZYA== X-Google-Smtp-Source: ABdhPJzuMVEt8NKVzn4JUuiT6HuWPLxvl0u3Gs34VY5aFdorTLtgp2jxsgbTmxaDLtn7+zt1Md7qJA== X-Received: by 2002:a62:ae0b:0:b029:1d9:eb3f:8900 with SMTP id q11-20020a62ae0b0000b02901d9eb3f8900mr8688880pff.53.1612745594420; Sun, 07 Feb 2021 16:53:14 -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 c6sm11095883pjd.21.2021.02.07.16.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 16:53:13 -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 v8 06/21] ArmPkg: Fix the return type of the ReadCCSIDR function Date: Sun, 7 Feb 2021 17:52:39 -0700 Message-Id: <20210208005254.12176-7-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210208005254.12176-1-rebecca@nuviainc.com> References: <20210208005254.12176-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