git: db5176875809 - stable/13 - arm64: Add TCR register masks

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 19 Feb 2024 16:44:48 UTC
The branch stable/13 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=db51768758097c64d5a99b5efd210f57ea22c122

commit db51768758097c64d5a99b5efd210f57ea22c122
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-09-08 13:29:19 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-19 12:38:31 +0000

    arm64: Add TCR register masks
    
    These will be used by bhyve to implement page table walking.
    
    Sponsored by:   Arm Ltd
    
    (cherry picked from commit a35e47369f88e8c2e14b7371a1a5e1152680551f)
---
 sys/arm64/include/armreg.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h
index be070a451691..e2395951f524 100644
--- a/sys/arm64/include/armreg.h
+++ b/sys/arm64/include/armreg.h
@@ -2100,6 +2100,7 @@
 #define	TCR_IPS_44BIT		(4UL << TCR_IPS_SHIFT)
 #define	TCR_IPS_48BIT		(5UL << TCR_IPS_SHIFT)
 #define	TCR_TG1_SHIFT		30
+#define	TCR_TG1_MASK		(3UL << TCR_TG1_SHIFT)
 #define	TCR_TG1_16K		(1UL << TCR_TG1_SHIFT)
 #define	TCR_TG1_4K		(2UL << TCR_TG1_SHIFT)
 #define	TCR_TG1_64K		(3UL << TCR_TG1_SHIFT)
@@ -2114,8 +2115,10 @@
 #define	TCR_A1_SHIFT		22
 #define	TCR_A1			(0x1UL << TCR_A1_SHIFT)
 #define	TCR_T1SZ_SHIFT		16
+#define	TCR_T1SZ_MASK		(0x3fUL << TCR_T1SZ_SHIFT)
 #define	TCR_T1SZ(x)		((x) << TCR_T1SZ_SHIFT)
 #define	TCR_TG0_SHIFT		14
+#define	TCR_TG0_MASK		(3UL << TCR_TG0_SHIFT)
 #define	TCR_TG0_4K		(0UL << TCR_TG0_SHIFT)
 #define	TCR_TG0_64K		(1UL << TCR_TG0_SHIFT)
 #define	TCR_TG0_16K		(2UL << TCR_TG0_SHIFT)
@@ -2129,7 +2132,7 @@
 #define	TCR_EPD0		(1UL << TCR_EPD0_SHIFT)
 /* Bit 6 is reserved */
 #define	TCR_T0SZ_SHIFT		0
-#define	TCR_T0SZ_MASK		0x3f
+#define	TCR_T0SZ_MASK		(0x3fUL << TCR_T0SZ_SHIFT)
 #define	TCR_T0SZ(x)		((x) << TCR_T0SZ_SHIFT)
 #define	TCR_TxSZ(x)		(TCR_T1SZ(x) | TCR_T0SZ(x))