Home | History | Annotate | Line # | Download | only in arch
aarch64.c revision 1.24
      1 /*	$NetBSD: aarch64.c,v 1.24 2024/09/27 15:13:41 jakllsch Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2018 Ryo Shimizu
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     25  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  * POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #include <sys/cdefs.h>
     30 
     31 #ifndef lint
     32 __RCSID("$NetBSD: aarch64.c,v 1.24 2024/09/27 15:13:41 jakllsch Exp $");
     33 #endif /* no lint */
     34 
     35 #include <sys/types.h>
     36 #include <sys/cpuio.h>
     37 #include <sys/sysctl.h>
     38 #include <stdio.h>
     39 #include <stdbool.h>
     40 #include <stdlib.h>
     41 #include <string.h>
     42 #include <inttypes.h>
     43 #include <err.h>
     44 
     45 #include <arm/cputypes.h>
     46 #include <aarch64/armreg.h>
     47 
     48 #include "../cpuctl.h"
     49 
     50 struct cpuidtab {
     51 	uint32_t cpu_partnum;
     52 	const char *cpu_name;
     53 	const char *cpu_class;
     54 	const char *cpu_architecture;
     55 };
     56 
     57 struct impltab {
     58 	uint32_t impl_id;
     59 	const char *impl_name;
     60 };
     61 
     62 struct fieldinfo {
     63 	unsigned int flags;
     64 #define FIELDINFO_FLAGS_DEC	0x0001
     65 #define FIELDINFO_FLAGS_4LOG2	0x0002
     66 	unsigned char bitpos;
     67 	unsigned char bitwidth;
     68 	const char *name;
     69 	const char * const *info;
     70 };
     71 
     72 
     73 #define CPU_PARTMASK	(CPU_ID_IMPLEMENTOR_MASK | CPU_ID_PARTNO_MASK)
     74 const struct cpuidtab cpuids[] = {
     75 	{ CPU_ID_CORTEXA35R0 & CPU_PARTMASK, "Cortex-A35", "Arm", "v8-A" },
     76 	{ CPU_ID_CORTEXA53R0 & CPU_PARTMASK, "Cortex-A53", "Arm", "v8-A" },
     77 	{ CPU_ID_CORTEXA57R0 & CPU_PARTMASK, "Cortex-A57", "Arm", "v8-A" },
     78 	{ CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Arm", "v8.2-A+" },
     79 	{ CPU_ID_CORTEXA65R0 & CPU_PARTMASK, "Cortex-A65", "Arm", "v8.2-A+" },
     80 	{ CPU_ID_CORTEXA72R0 & CPU_PARTMASK, "Cortex-A72", "Arm", "v8-A" },
     81 	{ CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Arm", "v8-A" },
     82 	{ CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Arm", "v8.2-A+" },
     83 	{ CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Arm", "v8.2-A+" },
     84 	{ CPU_ID_CORTEXA76AER1 & CPU_PARTMASK, "Cortex-A76AE", "Arm", "v8.2-A+" },
     85 	{ CPU_ID_CORTEXA77R0 & CPU_PARTMASK, "Cortex-A77", "Arm", "v8.2-A+" },
     86 	{ CPU_ID_NVIDIADENVER2 & CPU_PARTMASK, "Denver2", "NVIDIA", "v8-A" },
     87 	{ CPU_ID_EMAG8180 & CPU_PARTMASK, "eMAG", "Ampere", "v8-A" },
     88 	{ CPU_ID_NEOVERSEE1R1 & CPU_PARTMASK, "Neoverse E1", "Arm", "v8.2-A+" },
     89 	{ CPU_ID_NEOVERSEN1R3 & CPU_PARTMASK, "Neoverse N1", "Arm", "v8.2-A+" },
     90 	{ CPU_ID_THUNDERXRX, "ThunderX", "Cavium", "v8-A" },
     91 	{ CPU_ID_THUNDERX81XXRX, "ThunderX CN81XX", "Cavium", "v8-A" },
     92 	{ CPU_ID_THUNDERX83XXRX, "ThunderX CN83XX", "Cavium", "v8-A" },
     93 	{ CPU_ID_THUNDERX2RX, "ThunderX2", "Marvell", "v8.1-A" },
     94 	{ CPU_ID_APPLE_M1_ICESTORM & CPU_PARTMASK, "M1 Icestorm", "Apple", "Apple Silicon" },
     95 	{ CPU_ID_APPLE_M1_FIRESTORM & CPU_PARTMASK, "M1 Firestorm", "Apple", "Apple Silicon" },
     96 	{ CPU_ID_AMPERE1 & CPU_PARTMASK, "Ampere-1", "Ampere", "v8.6-A+" },
     97 	{ CPU_ID_AMPERE1A & CPU_PARTMASK, "Ampere-1A", "Ampere", "v8.6-A+" },
     98 };
     99 
    100 const struct impltab implids[] = {
    101 	{ CPU_ID_ARM_LTD,	"ARM Limited"				},
    102 	{ CPU_ID_BROADCOM,	"Broadcom Corporation"			},
    103 	{ CPU_ID_CAVIUM,	"Cavium Inc."				},
    104 	{ CPU_ID_DEC,		"Digital Equipment Corporation"		},
    105 	{ CPU_ID_INFINEON,	"Infineon Technologies AG"		},
    106 	{ CPU_ID_MOTOROLA,	"Motorola or Freescale Semiconductor Inc." },
    107 	{ CPU_ID_NVIDIA,	"NVIDIA Corporation"			},
    108 	{ CPU_ID_APM,		"Applied Micro Circuits Corporation"	},
    109 	{ CPU_ID_QUALCOMM,	"Qualcomm Inc."				},
    110 	{ CPU_ID_SAMSUNG,	"SAMSUNG"				},
    111 	{ CPU_ID_TI,		"Texas Instruments"			},
    112 	{ CPU_ID_MARVELL,	"Marvell International Ltd."		},
    113 	{ CPU_ID_APPLE,		"Apple Inc."				},
    114 	{ CPU_ID_FARADAY,	"Faraday Technology Corporation"	},
    115 	{ CPU_ID_INTEL,		"Intel Corporation"			},
    116 	{ CPU_ID_AMPERE,	"Ampere"				},
    117 };
    118 
    119 #define FIELDNAME(_bitpos, _bitwidth, _name)	\
    120 	.bitpos = _bitpos,			\
    121 	.bitwidth = _bitwidth,			\
    122 	.name = _name
    123 
    124 #define FIELDINFO(_bitpos, _bitwidth, _name)	\
    125 	FIELDNAME(_bitpos, _bitwidth, _name),	\
    126 	.info = (const char *[1 << _bitwidth])
    127 
    128 
    129 /* ID_AA64PFR0_EL1 - AArch64 Processor Feature Register 0 */
    130 struct fieldinfo id_aa64pfr0_fieldinfo[] = {
    131 	{
    132 		FIELDINFO(0, 4, "EL0") {
    133 			[0] = "No EL0",
    134 			[1] = "AArch64",
    135 			[2] = "AArch64/AArch32"
    136 		}
    137 	},
    138 	{
    139 		FIELDINFO(4, 4, "EL1") {
    140 			[0] = "No EL1",
    141 			[1] = "AArch64",
    142 			[2] = "AArch64/AArch32"
    143 		}
    144 	},
    145 	{
    146 		FIELDINFO(8, 4, "EL2") {
    147 			[0] = "No EL2",
    148 			[1] = "AArch64",
    149 			[2] = "AArch64/AArch32"
    150 		}
    151 	},
    152 	{
    153 		FIELDINFO(12, 4, "EL3") {
    154 			[0] = "No EL3",
    155 			[1] = "AArch64",
    156 			[2] = "AArch64/AArch32"
    157 		}
    158 	},
    159 	{
    160 		FIELDINFO(16, 4, "FP") {
    161 			[0] = "Floating Point",
    162 			[1] = "Floating Point including half-precision support",
    163 			[15] = "No Floating Point"
    164 		}
    165 	},
    166 	{
    167 		FIELDINFO(20, 4, "AdvSIMD") {
    168 			[0] = "Advanced SIMD",
    169 			[1] = "Advanced SIMD including half-precision support",
    170 			[15] = "No Advanced SIMD"
    171 		}
    172 	},
    173 	{
    174 		FIELDINFO(24, 4, "GIC") {
    175 			[0] = "GIC CPU interface sysregs not implemented",
    176 			[1] = "GIC CPU interface sysregs v3.0/4.0 supported",
    177 			[3] = "GIC CPU interface sysregs v4.1 supported"
    178 		}
    179 	},
    180 	{
    181 		FIELDINFO(28, 4, "RAS") {
    182 			[0] = "Reliability/Availability/Serviceability not supported",
    183 			[1] = "Reliability/Availability/Serviceability supported",
    184 			[2] = "Reliability/Availability/Serviceability ARMv8.4 supported",
    185 		},
    186 	},
    187 	{
    188 		FIELDINFO(32, 4, "SVE") {
    189 			[0] = "Scalable Vector Extensions not implemented",
    190 			[1] = "Scalable Vector Extensions implemented",
    191 		},
    192 	},
    193 	{
    194 		FIELDINFO(36, 4, "SEL2") {
    195 			[0] = "Secure EL2 not implemented",
    196 			[1] = "Secure EL2 implemented",
    197 		},
    198 	},
    199 	{
    200 		FIELDINFO(40, 4, "MPAM") {
    201 			[0] = "Memory Partitioning and Monitoring not implemented",
    202 			[1] = "Memory Partitioning and Monitoring implemented",
    203 		},
    204 	},
    205 	{
    206 		FIELDINFO(44, 4, "AMU") {
    207 			[0] = "Activity Monitors Extension not implemented",
    208 			[1] = "Activity Monitors Extension v1 ARMv8.4",
    209 			[2] = "Activity Monitors Extension v1 ARMv8.6",
    210 		},
    211 	},
    212 	{
    213 		FIELDINFO(48, 4, "DIT") {
    214 			[0] = "No Data-Independent Timing guarantees",
    215 			[1] = "Data-Independent Timing guaranteed by PSTATE.DIT",
    216 		},
    217 	},
    218 	{
    219 		FIELDINFO(56, 4, "CSV2") {
    220 			[0] = "Branch prediction might be Spectred",
    221 			[1] = "Branch prediction maybe not Spectred",
    222 			[2] = "Branch prediction probably not Spectred",
    223 		},
    224 	},
    225 	{
    226 		FIELDINFO(60, 4, "CSV3") {
    227 			[0] = "Faults might be Spectred",
    228 			[1] = "Faults maybe not Spectred",
    229 			[2] = "Faults probably not Spectred",
    230 		},
    231 	},
    232 	{ .bitwidth = 0 }	/* end of table */
    233 };
    234 
    235 /* ID_AA64PFR1_EL1 - AArch64 Processor Feature Register 1 */
    236 struct fieldinfo id_aa64pfr1_fieldinfo[] = {
    237 	{
    238 		FIELDINFO(0, 4, "BT") {
    239 			[0] = "Branch Target Identification not implemented",
    240 			[1] = "Branch Target Identification implemented",
    241 		}
    242 	},
    243 	{
    244 		FIELDINFO(4, 4, "SSBS") {
    245 			[0] = "Speculative Store Bypassing control not implemented",
    246 			[1] = "Speculative Store Bypassing control implemented",
    247 			[2] = "Speculative Store Bypassing control implemented, plus MSR/MRS"
    248 		}
    249 	},
    250 	{
    251 		FIELDINFO(8, 4, "MTE") {
    252 			[0] = "Memory Tagging Extension not implemented",
    253 			[1] = "Instruction-only Memory Taggined Extension"
    254 			    " implemented",
    255 			[2] = "Full Memory Tagging Extension implemented",
    256 			[3] = "Memory Tagging Extension implemented"
    257 			    " with Tag Check Fault handling"
    258 		}
    259 	},
    260 	{
    261 		FIELDINFO(12, 4, "RAS_frac") {
    262 			[0] = "Regular RAS",
    263 			[1] = "RAS plus registers"
    264 		}
    265 	},
    266 	{
    267 		FIELDINFO(16, 4, "MPAM_frac") {
    268 			[0] = "MPAM not implemented, or v1.0",
    269 			[1] = "MPAM v0.1 or v1.1"
    270 		}
    271 	},
    272 	{
    273 		FIELDINFO(32, 4, "CSV2_frac") {
    274 			[0] = "not disclosed",
    275 			[1] = "SCXTNUM_ELx registers not supported",
    276 			[2] = "SCXTNUM_ELx registers supported"
    277 		}
    278 	},
    279 	{ .bitwidth = 0 }	/* end of table */
    280 };
    281 
    282 /* ID_AA64ISAR0_EL1 - AArch64 Instruction Set Attribute Register 0 */
    283 struct fieldinfo id_aa64isar0_fieldinfo[] = {
    284 	{
    285 		FIELDINFO(4, 4, "AES") {
    286 			[0] = "No AES",
    287 			[1] = "AESE/AESD/AESMC/AESIMC",
    288 			[2] = "AESE/AESD/AESMC/AESIMC+PMULL/PMULL2"
    289 		}
    290 	},
    291 	{
    292 		FIELDINFO(8, 4, "SHA1") {
    293 			[0] = "No SHA1",
    294 			[1] = "SHA1C/SHA1P/SHA1M/SHA1H/SHA1SU0/SHA1SU1"
    295 		}
    296 	},
    297 	{
    298 		FIELDINFO(12, 4, "SHA2") {
    299 			[0] = "No SHA2",
    300 			[1] = "SHA256H/SHA256H2/SHA256SU0/SHA256SU1",
    301 			[2] = "SHA256H/SHA256H2/SHA256SU0/SHA256SU1"
    302 			     "/SHA512H/SHA512H2/SHA512SU0/SHA512SU1"
    303 		}
    304 	},
    305 	{
    306 		FIELDINFO(16, 4, "CRC32") {
    307 			[0] = "No CRC32",
    308 			[1] = "CRC32B/CRC32H/CRC32W/CRC32X"
    309 			    "/CRC32CB/CRC32CH/CRC32CW/CRC32CX"
    310 		}
    311 	},
    312 	{
    313 		FIELDINFO(20, 4, "Atomic") {
    314 			[0] = "No Atomic",
    315 			[2] = "LDADD/LDCLR/LDEOR/LDSET/LDSMAX/LDSMIN"
    316 			    "/LDUMAX/LDUMIN/CAS/CASP/SWP",
    317 		}
    318 	},
    319 	{
    320 		FIELDINFO(28, 4, "RDM") {
    321 			[0] = "No RDMA",
    322 			[1] = "SQRDMLAH/SQRDMLSH",
    323 		}
    324 	},
    325 	{
    326 		FIELDINFO(32, 4, "SHA3") {
    327 			[0] = "No SHA3",
    328 			[1] = "EOR3/RAX1/XAR/BCAX",
    329 		}
    330 	},
    331 	{
    332 		FIELDINFO(36, 4, "SM3") {
    333 			[0] = "No SM3",
    334 			[1] = "SM3SS1/SM3TT1A/SM3TT1B/SM3TT2A/SM3TT2B"
    335 			    "/SM3PARTW1/SM3PARTW2",
    336 		}
    337 	},
    338 	{
    339 		FIELDINFO(40, 4, "SM4") {
    340 			[0] = "No SM4",
    341 			[1] = "SM4E/SM4EKEY",
    342 		}
    343 	},
    344 	{
    345 		FIELDINFO(44, 4, "DP") {
    346 			[0] = "No Dot Product",
    347 			[1] = "UDOT/SDOT",
    348 		}
    349 	},
    350 	{
    351 		FIELDINFO(48, 4, "FHM") {
    352 			[0] = "No FHM",
    353 			[1] = "FMLAL/FMLSL",
    354 		}
    355 	},
    356 	{
    357 		FIELDINFO(52, 4, "TS") {
    358 			[0] = "No TS",
    359 			[1] = "CFINV/RMIF/SETF16/SETF8",
    360 			[2] = "CFINV/RMIF/SETF16/SETF8/AXFLAG/XAFLAG",
    361 		}
    362 	},
    363 	{
    364 		FIELDINFO(56, 4, "TLBI") {
    365 			[0] = "No outer shareable and TLB range maintenance"
    366 			    " instructions",
    367 			[1] = "Outer shareable TLB maintenance instructions",
    368 			[2] = "Outer shareable and TLB range maintenance"
    369 			    " instructions",
    370 		}
    371 	},
    372 	{
    373 		FIELDINFO(60, 4, "RNDR") {
    374 			[0] = "No RNDR/RNDRRS",
    375 			[1] = "RNDR/RNDRRS",
    376 		},
    377 	},
    378 	{ .bitwidth = 0 }	/* end of table */
    379 };
    380 
    381 /* ID_AA64ISAR0_EL1 - AArch64 Instruction Set Attribute Register 0 */
    382 struct fieldinfo id_aa64isar1_fieldinfo[] = {
    383 	{
    384 		FIELDINFO(0, 4, "DPB") {
    385 			[0] = "No DC CVAP",
    386 			[1] = "DC CVAP",
    387 			[2] = "DC CVAP/DC CVADP"
    388 		}
    389 	},
    390 	{
    391 		FIELDINFO(4, 4, "APA") {
    392 			[0] = "No Architected Address Authentication algorithm",
    393 			[1] = "QARMA with PAC",
    394 			[2] = "QARMA with EnhancedPAC",
    395 			[3] = "QARMA with EnhancedPAC2",
    396 			[4] = "QARMA with EnhancedPAC/PAC2",
    397 			[5] = "QARMA with EnhancedPAC/PAC2/FPACCombined"
    398 		}
    399 	},
    400 	{
    401 		FIELDINFO(8, 4, "API") {
    402 			[0] = "No Address Authentication algorithm",
    403 			[1] = "Address Authentication algorithm implemented",
    404 			[2] = "EnhancedPAC",
    405 			[3] = "EnhancedPAC2",
    406 			[4] = "EnhancedPAC2/FPAC",
    407 			[5] = "EnhancedPAC2/FPAC/FPACCombined"
    408 		}
    409 	},
    410 	{
    411 		FIELDINFO(12, 4, "JSCVT") {
    412 			[0] = "No FJCVTZS",
    413 			[1] = "FJCVTZS"
    414 		}
    415 	},
    416 	{
    417 		FIELDINFO(16, 4, "FCMA") {
    418 			[0] = "No FCMA",
    419 			[1] = "FCMLA/FCADD"
    420 		}
    421 	},
    422 	{
    423 		FIELDINFO(20, 4, "LRCPC") {
    424 			[0] = "no LRCPC",
    425 			[1] = "LDAPR",
    426 			[2] = "LDAPR/LDAPUR/STLUR"
    427 		}
    428 	},
    429 	{
    430 		FIELDINFO(24, 4, "GPA") {
    431 			[0] = "No Architected Generic Authentication algorithm",
    432 			[1] = "QARMA with PACGA"
    433 		}
    434 	},
    435 	{
    436 		FIELDINFO(28, 4, "GPI") {
    437 			[0] = "No Generic Authentication algorithm",
    438 			[1] = "Generic Authentication algorithm implemented"
    439 		}
    440 	},
    441 	{
    442 		FIELDINFO(32, 4, "FRINTTS") {
    443 			[0] = "No FRINTTS",
    444 			[1] = "FRINT32Z/FRINT32X/FRINT64Z/FRINT64X"
    445 		}
    446 	},
    447 	{
    448 		FIELDINFO(36, 4, "SB") {
    449 			[0] = "No SB",
    450 			[1] = "SB"
    451 		}
    452 	},
    453 	{
    454 		FIELDINFO(40, 4, "SPECRES") {
    455 			[0] = "No SPECRES",
    456 			[1] = "CFP RCTX/DVP RCTX/CPP RCTX"
    457 		}
    458 	},
    459 	{
    460 		FIELDINFO(44, 4, "BF16") {
    461 			[0] = "No BFloat16",
    462 			[1] = "BFCVT/BFCVTN/BFCVTN2/BFDOT"
    463 			    "/BFMLALB/BFMLALT/BFMMLA"
    464 		}
    465 	},
    466 	{
    467 		FIELDINFO(48, 4, "DGH") {
    468 			[0] = "Data Gathering Hint not implemented",
    469 			[1] = "Data Gathering Hint implemented"
    470 		}
    471 	},
    472 	{
    473 		FIELDINFO(52, 4, "I8MM") {
    474 			[0] = "No Int8 matrix",
    475 			[1] = "SMMLA/SUDOT/UMMLA/USMMLA/USDOT"
    476 		}
    477 	},
    478 	{
    479 		FIELDINFO(56, 4, "XS") {
    480 			[0] = "No XS/nXS qualifier",
    481 			[1] = "XS attribute, TLBI and DSB"
    482 			    " with nXS qualifier supported"
    483 		}
    484 	},
    485 	{
    486 		FIELDINFO(60, 4, "LS64") {
    487 			[0] = "No LS64",
    488 			[1] = "LD64B/ST64B",
    489 			[2] = "LD64B/ST64B/ST64BV",
    490 			[3] = "LD64B/ST64B/ST64BV/ST64BV0/ACCDATA_EL1",
    491 		}
    492 	},
    493 	{ .bitwidth = 0 }	/* end of table */
    494 };
    495 
    496 /* ID_AA64MMFR0_EL1 - AArch64 Memory Model Feature Register 0 */
    497 struct fieldinfo id_aa64mmfr0_fieldinfo[] = {
    498 	{
    499 		FIELDINFO(0, 4, "PARange") {
    500 			[0] = "32bits/4GB",
    501 			[1] = "36bits/64GB",
    502 			[2] = "40bits/1TB",
    503 			[3] = "42bits/4TB",
    504 			[4] = "44bits/16TB",
    505 			[5] = "48bits/256TB",
    506 			[6] = "52bits/4PB"
    507 		}
    508 	},
    509 	{
    510 		FIELDINFO(4, 4, "ASIDBit") {
    511 			[0] = "8bits",
    512 			[2] = "16bits"
    513 		}
    514 	},
    515 	{
    516 		FIELDINFO(8, 4, "BigEnd") {
    517 			[0] = "No mixed-endian",
    518 			[1] = "Mixed-endian"
    519 		}
    520 	},
    521 	{
    522 		FIELDINFO(12, 4, "SNSMem") {
    523 			[0] = "No distinction B/W Secure and Non-secure Memory",
    524 			[1] = "Distinction B/W Secure and Non-secure Memory"
    525 		}
    526 	},
    527 	{
    528 		FIELDINFO(16, 4, "BigEndEL0") {
    529 			[0] = "No mixed-endian at EL0",
    530 			[1] = "Mixed-endian at EL0"
    531 		}
    532 	},
    533 	{
    534 		FIELDINFO(20, 4, "TGran16") {
    535 			[0] = "No 16KB granule",
    536 			[1] = "16KB granule"
    537 		}
    538 	},
    539 	{
    540 		FIELDINFO(24, 4, "TGran64") {
    541 			[0] = "64KB granule",
    542 			[15] = "No 64KB granule"
    543 		}
    544 	},
    545 	{
    546 		FIELDINFO(28, 4, "TGran4") {
    547 			[0] = "4KB granule",
    548 			[15] = "No 4KB granule"
    549 		}
    550 	},
    551 	{
    552 		FIELDINFO(32, 4, "TGran16_2") {
    553 			[0] = "same as TGran16",
    554 			[1] = "No 16KB granule at stage2",
    555 			[2] = "16KB granule at stage2",
    556 			[3] = "16KB granule at stage2/52bit"
    557 		}
    558 	},
    559 	{
    560 		FIELDINFO(36, 4, "TGran64_2") {
    561 			[0] = "same as TGran64",
    562 			[1] = "No 64KB granule at stage2",
    563 			[2] = "64KB granule at stage2"
    564 		}
    565 	},
    566 	{
    567 		FIELDINFO(40, 4, "TGran4_2") {
    568 			[0] = "same as TGran4",
    569 			[1] = "No 4KB granule at stage2",
    570 			[2] = "4KB granule at stage2"
    571 		}
    572 	},
    573 	{
    574 		FIELDINFO(44, 4, "ExS") {
    575 			[0] = "All Exception entries and exits are context"
    576 			    " synchronization events",
    577 			[1] = "Non-context synchronizing exception entry and"
    578 			    " exit are supported"
    579 		}
    580 	},
    581 	{
    582 		FIELDINFO(56, 4, "FGT") {
    583 			[0] = "fine-grained trap controls not implemented",
    584 			[1] = "fine-grained trap controls implemented"
    585 		}
    586 	},
    587 	{
    588 		FIELDINFO(60, 4, "ECV") {
    589 			[0] = "Enhanced Counter Virtualization not implemented",
    590 			[1] = "Enhanced Counter Virtualization implemented",
    591 			[2] = "Enhanced Counter Virtualization"
    592 			    " + CNTHCTL_EL2.ECV/CNTPOFF_EL2 implemented"
    593 		}
    594 	},
    595 
    596 	{ .bitwidth = 0 }	/* end of table */
    597 };
    598 
    599 /* ID_AA64MMFR1_EL1 - AArch64 Memory Model Feature Register 1 */
    600 struct fieldinfo id_aa64mmfr1_fieldinfo[] = {
    601 	{
    602 		FIELDINFO(0, 4, "HAFDBS") {
    603 			[0] = "Access and Dirty flags not supported",
    604 			[1] = "Access flag supported",
    605 			[2] = "Access and Dirty flags supported",
    606 		}
    607 	},
    608 	{
    609 		FIELDINFO(4, 4, "VMIDBits") {
    610 			[0] = "8bits",
    611 			[2] = "16bits"
    612 		}
    613 	},
    614 	{
    615 		FIELDINFO(8, 4, "VH") {
    616 			[0] = "Virtualization Host Extensions not supported",
    617 			[1] = "Virtualization Host Extensions supported",
    618 		}
    619 	},
    620 	{
    621 		FIELDINFO(12, 4, "HPDS") {
    622 			[0] = "Disabling of hierarchical controls not supported",
    623 			[1] = "Disabling of hierarchical controls supported",
    624 			[2] = "Disabling of hierarchical controls supported, plus PTD"
    625 		}
    626 	},
    627 	{
    628 		FIELDINFO(16, 4, "LO") {
    629 			[0] = "LORegions not supported",
    630 			[1] = "LORegions supported"
    631 		}
    632 	},
    633 	{
    634 		FIELDINFO(20, 4, "PAN") {
    635 			[0] = "PAN not supported",
    636 			[1] = "PAN supported",
    637 			[2] = "PAN supported, and instructions supported",
    638 			[3] = "PAN supported, instructions supported"
    639 			    ", and SCTLR_EL[12].EPAN bits supported"
    640 		}
    641 	},
    642 	{
    643 		FIELDINFO(24, 4, "SpecSEI") {
    644 			[0] = "SError interrupt not supported",
    645 			[1] = "SError interrupt supported"
    646 		}
    647 	},
    648 	{
    649 		FIELDINFO(28, 4, "XNX") {
    650 			[0] = "Distinction between EL0 and EL1 XN control"
    651 			    " at stage2 not supported",
    652 			[1] = "Distinction between EL0 and EL1 XN control"
    653 			    " at stage2 supported"
    654 		}
    655 	},
    656 	{
    657 		FIELDINFO(32, 4, "TWED") {
    658 			[0] = "Configurable delayed trapping of WFE is not"
    659 			    " supported",
    660 			[1] = "Configurable delayed trapping of WFE supported"
    661 		}
    662 	},
    663 	{
    664 		FIELDINFO(36, 4, "ETS") {
    665 			[0] = "Enhanced Translation Synchronization not"
    666 			    " supported",
    667 			[1] = "Enhanced Translation Synchronization supported"
    668 		}
    669 	},
    670 	{
    671 		FIELDINFO(40, 4, "HCX") {
    672 			[0] = "HCRX_EL2 not supported",
    673 			[1] = "HCRX_EL2 supported"
    674 		}
    675 	},
    676 	{
    677 		FIELDINFO(44, 4, "AFP") {
    678 			[0] = "FPCR.{AH,FIZ,NEP} fields not supported",
    679 			[1] = "FPCR.{AH,FIZ,NEP} fields supported"
    680 		}
    681 	},
    682 	{
    683 		FIELDINFO(48, 4, "nTLBPA") {
    684 			[0] = "might include non-coherent caches",
    685 			[1] = "does not include non-coherent caches"
    686 		}
    687 	},
    688 	{ .bitwidth = 0 }	/* end of table */
    689 };
    690 
    691 /* ID_AA64DFR0_EL1 - AArch64 Debug Feature Register 0 */
    692 struct fieldinfo id_aa64dfr0_fieldinfo[] = {
    693 	{
    694 		FIELDINFO(0, 4, "DebugVer") {
    695 			[6] = "ARMv8 debug architecture",
    696 			[7] = "ARMv8 debug architecture"
    697 			    " with Virtualization Host Extensions",
    698 			[8] = "ARMv8.2 debug architecture",
    699 			[9] = "ARMv8.4 debug architecture"
    700 		}
    701 	},
    702 	{
    703 		FIELDINFO(4, 4, "TraceVer") {
    704 			[0] = "Trace supported",
    705 			[1] = "Trace not supported"
    706 		}
    707 	},
    708 	{
    709 		FIELDINFO(8, 4, "PMUVer") {
    710 			[0] = "No Performance monitor",
    711 			[1] = "Performance monitor unit v3",
    712 			[4] = "Performance monitor unit v3 for ARMv8.1",
    713 			[5] = "Performance monitor unit v3 for ARMv8.4",
    714 			[6] = "Performance monitor unit v3 for ARMv8.5",
    715 			[7] = "Performance monitor unit v3 for ARMv8.7",
    716 			[15] = "implementation defined"
    717 		}
    718 	},
    719 	{
    720 		FIELDINFO(32, 4, "PMSVer") {
    721 			[0] = "Statistical Profiling Extension not implemented",
    722 			[1] = "Statistical Profiling Extension implemented",
    723 			[2] = "Statistical Profiling Extension and "
    724 			    "Event packet alignment flag implemented",
    725 			[3] = "Statistical Profiling Extension, "
    726 			    "Event packet alignment flag, and "
    727 			    "Branch target address packet, etc."
    728 		}
    729 	},
    730 	{
    731 		FIELDINFO(36, 4, "DoubleLock") {
    732 			[0] = "OS Double Lock implemented",
    733 			[1] = "OS Double Lock not implemented"
    734 		}
    735 	},
    736 	{
    737 		FIELDINFO(40, 4, "TraceFilt") {
    738 			[0] = "ARMv8.4 Self-hosted Trace Extension not "
    739 			    "implemented",
    740 			[1] = "ARMv8.4 Self-hosted Trace Extension implemented"
    741 		}
    742 	},
    743 	{
    744 		FIELDINFO(48, 4, "MTPMU") {
    745 			[0] = "Multi-threaded PMU extension not implemented,"
    746 			    " or implementation defined",
    747 			[1] = "Multi-threaded PMU extension implemented",
    748 			[15] = "Multi-threaded PMU extension not implemented"
    749 		}
    750 	},
    751 	{ .bitwidth = 0 }	/* end of table */
    752 };
    753 
    754 
    755 /* MVFR0_EL1 - Media and VFP Feature Register 0 */
    756 struct fieldinfo mvfr0_fieldinfo[] = {
    757 	{
    758 		FIELDINFO(0, 4, "SIMDreg") {
    759 			[0] = "No SIMD",
    760 			[1] = "16x64-bit SIMD",
    761 			[2] = "32x64-bit SIMD"
    762 		}
    763 	},
    764 	{
    765 		FIELDINFO(4, 4, "FPSP") {
    766 			[0] = "No VFP support single precision",
    767 			[1] = "VFPv2 support single precision",
    768 			[2] = "VFPv2/VFPv3/VFPv4 support single precision"
    769 		}
    770 	},
    771 	{
    772 		FIELDINFO(8, 4, "FPDP") {
    773 			[0] = "No VFP support double precision",
    774 			[1] = "VFPv2 support double precision",
    775 			[2] = "VFPv2/VFPv3/VFPv4 support double precision"
    776 		}
    777 	},
    778 	{
    779 		FIELDINFO(12, 4, "FPTrap") {
    780 			[0] = "No floating point exception trapping support",
    781 			[1] = "VFPv2/VFPv3/VFPv4 support exception trapping"
    782 		}
    783 	},
    784 	{
    785 		FIELDINFO(16, 4, "FPDivide") {
    786 			[0] = "VDIV not supported",
    787 			[1] = "VDIV supported"
    788 		}
    789 	},
    790 	{
    791 		FIELDINFO(20, 4, "FPSqrt") {
    792 			[0] = "VSQRT not supported",
    793 			[1] = "VSQRT supported"
    794 		}
    795 	},
    796 	{
    797 		FIELDINFO(24, 4, "FPShVec") {
    798 			[0] = "Short Vectors not supported",
    799 			[1] = "Short Vectors supported"
    800 		}
    801 	},
    802 	{
    803 		FIELDINFO(28, 4, "FPRound") {
    804 			[0] = "Only Round to Nearest mode",
    805 			[1] = "All rounding modes"
    806 		}
    807 	},
    808 	{ .bitwidth = 0 }	/* end of table */
    809 };
    810 
    811 /* MVFR1_EL1 - Media and VFP Feature Register 1 */
    812 struct fieldinfo mvfr1_fieldinfo[] = {
    813 	{
    814 		FIELDINFO(0, 4, "FPFtZ") {
    815 			[0] = "only the Flush-to-Zero",
    816 			[1] = "full Denormalized number arithmetic"
    817 		}
    818 	},
    819 	{
    820 		FIELDINFO(4, 4, "FPDNan") {
    821 			[0] = "Default NaN",
    822 			[1] = "Propagation of NaN"
    823 		}
    824 	},
    825 	{
    826 		FIELDINFO(8, 4, "SIMDLS") {
    827 			[0] = "No Advanced SIMD Load/Store",
    828 			[1] = "Advanced SIMD Load/Store"
    829 		}
    830 	},
    831 	{
    832 		FIELDINFO(12, 4, "SIMDInt") {
    833 			[0] = "No Advanced SIMD Integer",
    834 			[1] = "Advanced SIMD Integer"
    835 		}
    836 	},
    837 	{
    838 		FIELDINFO(16, 4, "SIMDSP") {
    839 			[0] = "No Advanced SIMD single precision",
    840 			[1] = "Advanced SIMD single precision"
    841 		}
    842 	},
    843 	{
    844 		FIELDINFO(20, 4, "SIMDHP") {
    845 			[0] = "No Advanced SIMD half precision",
    846 			[1] = "Advanced SIMD half precision conversion",
    847 			[2] = "Advanced SIMD half precision conversion"
    848 			    " and arithmetic"
    849 		}
    850 	},
    851 	{
    852 		FIELDINFO(24, 4, "FPHP") {
    853 			[0] = "No half precision conversion",
    854 			[1] = "half/single precision conversion",
    855 			[2] = "half/single/double precision conversion",
    856 			[3] = "half/single/double precision conversion, and "
    857 			    "half precision arithmetic"
    858 		}
    859 	},
    860 	{
    861 		FIELDINFO(28, 4, "SIMDFMAC") {
    862 			[0] = "No Fused Multiply-Accumulate",
    863 			[1] = "Fused Multiply-Accumulate"
    864 		}
    865 	},
    866 	{ .bitwidth = 0 }	/* end of table */
    867 };
    868 
    869 /* MVFR2_EL1 - Media and VFP Feature Register 2 */
    870 struct fieldinfo mvfr2_fieldinfo[] = {
    871 	{
    872 		FIELDINFO(0, 4, "SIMDMisc") {
    873 			[0] = "No miscellaneous features",
    874 			[1] = "Conversion to Integer w/Directed Rounding modes",
    875 			[2] = "Conversion to Integer w/Directed Rounding modes"
    876 			    ", Round to Integral floating point",
    877 			[3] = "Conversion to Integer w/Directed Rounding modes"
    878 			    ", Round to Integral floating point"
    879 			    ", MaxNum and MinNum"
    880 		}
    881 	},
    882 	{
    883 		FIELDINFO(4, 4, "FPMisc") {
    884 			[0] = "No miscellaneous features",
    885 			[1] = "Floating point selection",
    886 			[2] = "Floating point selection"
    887 			    ", Conversion to Integer w/Directed Rounding modes",
    888 			[3] = "Floating point selection"
    889 			    ", Conversion to Integer w/Directed Rounding modes"
    890 			    ", Round to Integral floating point",
    891 			[4] = "Floating point selection"
    892 			    ", Conversion to Integer w/Directed Rounding modes"
    893 			    ", Round to Integral floating point"
    894 			    ", MaxNum and MinNum"
    895 		}
    896 	},
    897 	{ .bitwidth = 0 }	/* end of table */
    898 };
    899 
    900 /* CLIDR_EL1 - Cache Level ID Register */
    901 const char * const clidr_cachetype[8] = { /* 8=3bit */
    902 	[0] = "None",
    903 	[1] = "Instruction cache",
    904 	[2] = "Data cache",
    905 	[3] = "Instruction and Data cache",
    906 	[4] = "Unified cache"
    907 };
    908 
    909 struct fieldinfo clidr_fieldinfo[] = {
    910 	{
    911 		FIELDNAME(0, 3, "L1"),
    912 		.info = clidr_cachetype
    913 	},
    914 	{
    915 		FIELDNAME(3, 3, "L2"),
    916 		.info = clidr_cachetype
    917 	},
    918 	{
    919 		FIELDNAME(6, 3, "L3"),
    920 		.info = clidr_cachetype
    921 	},
    922 	{
    923 		FIELDNAME(9, 3, "L4"),
    924 		.info = clidr_cachetype
    925 	},
    926 	{
    927 		FIELDNAME(12, 3, "L5"),
    928 		.info = clidr_cachetype
    929 	},
    930 	{
    931 		FIELDNAME(15, 3, "L6"),
    932 		.info = clidr_cachetype
    933 	},
    934 	{
    935 		FIELDNAME(18, 3, "L7"),
    936 		.info = clidr_cachetype
    937 	},
    938 	{
    939 		FIELDNAME(21, 3, "LoUU"),
    940 		.flags = FIELDINFO_FLAGS_DEC
    941 	},
    942 	{
    943 		FIELDNAME(24, 3, "LoC"),
    944 		.flags = FIELDINFO_FLAGS_DEC
    945 	},
    946 	{
    947 		FIELDNAME(27, 3, "LoUIS"),
    948 		.flags = FIELDINFO_FLAGS_DEC
    949 	},
    950 	{
    951 		FIELDNAME(30, 3, "ICB"),
    952 		.flags = FIELDINFO_FLAGS_DEC
    953 	},
    954 	{ .bitwidth = 0 }	/* end of table */
    955 };
    956 
    957 struct fieldinfo ctr_fieldinfo[] = {
    958 	{
    959 		FIELDNAME(0, 4, "IminLine"),
    960 		.flags = FIELDINFO_FLAGS_DEC | FIELDINFO_FLAGS_4LOG2
    961 	},
    962 	{
    963 		FIELDNAME(16, 4, "DminLine"),
    964 		.flags = FIELDINFO_FLAGS_DEC | FIELDINFO_FLAGS_4LOG2
    965 	},
    966 	{
    967 		FIELDINFO(14, 2, "L1 Icache policy") {
    968 			[0] = "VMID aware PIPT (VPIPT)",
    969 			[1] = "ASID-tagged VIVT (AIVIVT)",
    970 			[2] = "VIPT",
    971 			[3] = "PIPT"
    972 		},
    973 	},
    974 	{
    975 		FIELDNAME(20, 4, "ERG"),
    976 		.flags = FIELDINFO_FLAGS_DEC | FIELDINFO_FLAGS_4LOG2
    977 	},
    978 	{
    979 		FIELDNAME(24, 4, "CWG"),
    980 		.flags = FIELDINFO_FLAGS_DEC | FIELDINFO_FLAGS_4LOG2
    981 	},
    982 	{
    983 		FIELDNAME(28, 1, "DIC"),
    984 		.flags = FIELDINFO_FLAGS_DEC
    985 	},
    986 	{
    987 		FIELDNAME(29, 1, "IDC"),
    988 		.flags = FIELDINFO_FLAGS_DEC
    989 	},
    990 	{ .bitwidth = 0 }	/* end of table */
    991 };
    992 
    993 
    994 static void
    995 print_fieldinfo(const char *cpuname, const char *setname,
    996     struct fieldinfo *fieldinfo, uint64_t data)
    997 {
    998 	uint64_t v;
    999 	const char *info;
   1000 	int i, flags;
   1001 
   1002 #define WIDTHMASK(w)	(0xffffffffffffffffULL >> (64 - (w)))
   1003 
   1004 	for (i = 0; fieldinfo[i].bitwidth != 0; i++) {
   1005 		v = (data >> fieldinfo[i].bitpos) &
   1006 		    WIDTHMASK(fieldinfo[i].bitwidth);
   1007 
   1008 		flags = fieldinfo[i].flags;
   1009 		info = NULL;
   1010 		if (fieldinfo[i].info != NULL)
   1011 			info = fieldinfo[i].info[v];
   1012 
   1013 		printf("%s: %s: %s: ",
   1014 		    cpuname, setname, fieldinfo[i].name);
   1015 
   1016 		if (verbose)
   1017 			printf("0x%"PRIx64": ", v);
   1018 
   1019 		if (info == NULL) {
   1020 			if (flags & FIELDINFO_FLAGS_4LOG2)
   1021 				v = 4 * (1 << v);
   1022 			if (flags & FIELDINFO_FLAGS_DEC)
   1023 				printf("%"PRIu64"\n", v);
   1024 			else
   1025 				printf("0x%"PRIx64"\n", v);
   1026 		} else {
   1027 			printf("%s\n", info);
   1028 		}
   1029 	}
   1030 }
   1031 
   1032 /* MIDR_EL1 - Main ID Register */
   1033 static void
   1034 identify_midr(const char *cpuname, uint32_t cpuid)
   1035 {
   1036 	unsigned int i;
   1037 	uint32_t implid, cpupart, variant, revision;
   1038 	const char *implementer = NULL;
   1039 	static char implbuf[128];
   1040 
   1041 	implid = cpuid & CPU_ID_IMPLEMENTOR_MASK;
   1042 	cpupart = cpuid & CPU_PARTMASK;
   1043 	variant = __SHIFTOUT(cpuid, CPU_ID_VARIANT_MASK);
   1044 	revision = __SHIFTOUT(cpuid, CPU_ID_REVISION_MASK);
   1045 
   1046 	for (i = 0; i < __arraycount(implids); i++) {
   1047 		if (implid == implids[i].impl_id) {
   1048 			implementer = implids[i].impl_name;
   1049 		}
   1050 	}
   1051 	if (implementer == NULL) {
   1052 		snprintf(implbuf, sizeof(implbuf), "unknown implementer: 0x%02x",
   1053 		    implid >> 24);
   1054 		implementer = implbuf;
   1055 	}
   1056 
   1057 	for (i = 0; i < __arraycount(cpuids); i++) {
   1058 		if (cpupart == cpuids[i].cpu_partnum) {
   1059 			printf("%s: %s, %s r%dp%d (%s %s core)\n",
   1060 			    cpuname, implementer,
   1061 			    cpuids[i].cpu_name, variant, revision,
   1062 			    cpuids[i].cpu_class,
   1063 			    cpuids[i].cpu_architecture);
   1064 			return;
   1065 		}
   1066 	}
   1067 	printf("%s: unknown CPU ID: 0x%08x\n", cpuname, cpuid);
   1068 }
   1069 
   1070 /* REVIDR_EL1 - Revision ID Register */
   1071 static void
   1072 identify_revidr(const char *cpuname, uint32_t revidr)
   1073 {
   1074 	printf("%s: revision: 0x%08x\n", cpuname, revidr);
   1075 }
   1076 
   1077 /* MPIDR_EL1 - Multiprocessor Affinity Register */
   1078 static void
   1079 identify_mpidr(const char *cpuname, uint64_t mpidr)
   1080 {
   1081 	const char *setname = "multiprocessor affinity";
   1082 
   1083 	printf("%s: %s: Affinity-Level: %"PRIu64"-%"PRIu64"-%"PRIu64"-%"PRIu64"\n",
   1084 	    cpuname, setname,
   1085 	    __SHIFTOUT(mpidr, MPIDR_AFF3),
   1086 	    __SHIFTOUT(mpidr, MPIDR_AFF2),
   1087 	    __SHIFTOUT(mpidr, MPIDR_AFF1),
   1088 	    __SHIFTOUT(mpidr, MPIDR_AFF0));
   1089 
   1090 	if ((mpidr & MPIDR_U) == 0)
   1091 		printf("%s: %s: Multiprocessor system\n", cpuname, setname);
   1092 	else
   1093 		printf("%s: %s: Uniprocessor system\n", cpuname, setname);
   1094 
   1095 	if ((mpidr & MPIDR_MT) == 0)
   1096 		printf("%s: %s: Core Independent\n", cpuname, setname);
   1097 	else
   1098 		printf("%s: %s: Multi-Threading\n", cpuname, setname);
   1099 
   1100 }
   1101 
   1102 /* AA64DFR0 - Debug feature register 0 */
   1103 static void
   1104 identify_dfr0(const char *cpuname, uint64_t dfr0)
   1105 {
   1106 	const char *setname = "debug feature 0";
   1107 
   1108 	printf("%s: %s: CTX_CMPs: %lu context-aware breakpoints\n",
   1109 	    cpuname, setname, __SHIFTOUT(dfr0, ID_AA64DFR0_EL1_CTX_CMPS) + 1);
   1110 	printf("%s: %s: WRPs: %lu watchpoints\n",
   1111 	    cpuname, setname, __SHIFTOUT(dfr0, ID_AA64DFR0_EL1_WRPS) + 1);
   1112 	printf("%s: %s: BRPs: %lu breakpoints\n",
   1113 	    cpuname, setname, __SHIFTOUT(dfr0, ID_AA64DFR0_EL1_BRPS) + 1);
   1114 	print_fieldinfo(cpuname, setname,
   1115 	    id_aa64dfr0_fieldinfo, dfr0);
   1116 }
   1117 
   1118 void
   1119 identifycpu(int fd, const char *cpuname)
   1120 {
   1121 	char path[128];
   1122 	size_t len;
   1123 #define SYSCTL_CPU_ID_MAXSIZE	64
   1124 	uint64_t sysctlbuf[SYSCTL_CPU_ID_MAXSIZE];
   1125 	struct aarch64_sysctl_cpu_id *id =
   1126 	    (struct aarch64_sysctl_cpu_id *)sysctlbuf;
   1127 
   1128 	snprintf(path, sizeof path, "machdep.%s.cpu_id", cpuname);
   1129 	len = sizeof(sysctlbuf);
   1130 	memset(sysctlbuf, 0, len);
   1131 	if (sysctlbyname(path, id, &len, 0, 0) == -1)
   1132 		err(1, "couldn't get %s", path);
   1133 	if (len != sizeof(struct aarch64_sysctl_cpu_id))
   1134 		fprintf(stderr, "Warning: kernel version bumped?\n");
   1135 
   1136 	if (verbose) {
   1137 		printf("%s: MIDR_EL1: 0x%08"PRIx64"\n",
   1138 		    cpuname, id->ac_midr);
   1139 		printf("%s: MPIDR_EL1: 0x%016"PRIx64"\n",
   1140 		    cpuname, id->ac_mpidr);
   1141 		printf("%s: ID_AA64DFR0_EL1: 0x%016"PRIx64"\n",
   1142 		    cpuname, id->ac_aa64dfr0);
   1143 		printf("%s: ID_AA64DFR1_EL1: 0x%016"PRIx64"\n",
   1144 		    cpuname, id->ac_aa64dfr1);
   1145 		printf("%s: ID_AA64ISAR0_EL1: 0x%016"PRIx64"\n",
   1146 		    cpuname, id->ac_aa64isar0);
   1147 		printf("%s: ID_AA64ISAR1_EL1: 0x%016"PRIx64"\n",
   1148 		    cpuname, id->ac_aa64isar1);
   1149 		printf("%s: ID_AA64MMFR0_EL1: 0x%016"PRIx64"\n",
   1150 		    cpuname, id->ac_aa64mmfr0);
   1151 		printf("%s: ID_AA64MMFR1_EL1: 0x%016"PRIx64"\n",
   1152 		    cpuname, id->ac_aa64mmfr1);
   1153 		printf("%s: ID_AA64MMFR2_EL1: 0x%016"PRIx64"\n",
   1154 		    cpuname, id->ac_aa64mmfr2);
   1155 		printf("%s: ID_AA64PFR0_EL1: 0x%08"PRIx64"\n",
   1156 		    cpuname, id->ac_aa64pfr0);
   1157 		printf("%s: ID_AA64PFR1_EL1: 0x%08"PRIx64"\n",
   1158 		    cpuname, id->ac_aa64pfr1);
   1159 		printf("%s: ID_AA64ZFR0_EL1: 0x%016"PRIx64"\n",
   1160 		    cpuname, id->ac_aa64zfr0);
   1161 		printf("%s: MVFR0_EL1: 0x%08"PRIx32"\n",
   1162 		    cpuname, id->ac_mvfr0);
   1163 		printf("%s: MVFR1_EL1: 0x%08"PRIx32"\n",
   1164 		    cpuname, id->ac_mvfr1);
   1165 		printf("%s: MVFR2_EL1: 0x%08"PRIx32"\n",
   1166 		    cpuname, id->ac_mvfr2);
   1167 		printf("%s: CLIDR_EL1: 0x%016"PRIx64"\n",
   1168 		    cpuname, id->ac_clidr);
   1169 		printf("%s: CTR_EL0: 0x%016"PRIx64"\n",
   1170 		    cpuname, id->ac_ctr);
   1171 	}
   1172 
   1173 	identify_midr(cpuname, id->ac_midr);
   1174 	identify_revidr(cpuname, id->ac_revidr);
   1175 	identify_mpidr(cpuname, id->ac_mpidr);
   1176 	print_fieldinfo(cpuname, "isa features 0",
   1177 	    id_aa64isar0_fieldinfo, id->ac_aa64isar0);
   1178 	print_fieldinfo(cpuname, "isa features 1",
   1179 	    id_aa64isar1_fieldinfo, id->ac_aa64isar1);
   1180 	print_fieldinfo(cpuname, "memory model 0",
   1181 	    id_aa64mmfr0_fieldinfo, id->ac_aa64mmfr0);
   1182 	print_fieldinfo(cpuname, "memory model 1",
   1183 	    id_aa64mmfr1_fieldinfo, id->ac_aa64mmfr1);
   1184 	print_fieldinfo(cpuname, "processor feature 0",
   1185 	    id_aa64pfr0_fieldinfo, id->ac_aa64pfr0);
   1186 	print_fieldinfo(cpuname, "processor feature 1",
   1187 	    id_aa64pfr1_fieldinfo, id->ac_aa64pfr1);
   1188 	identify_dfr0(cpuname, id->ac_aa64dfr0);
   1189 
   1190 	print_fieldinfo(cpuname, "media and VFP features 0",
   1191 	    mvfr0_fieldinfo, id->ac_mvfr0);
   1192 	print_fieldinfo(cpuname, "media and VFP features 1",
   1193 	    mvfr1_fieldinfo, id->ac_mvfr1);
   1194 	print_fieldinfo(cpuname, "media and VFP features 2",
   1195 	    mvfr2_fieldinfo, id->ac_mvfr2);
   1196 
   1197 	if (len <= offsetof(struct aarch64_sysctl_cpu_id, ac_clidr))
   1198 		return;
   1199 	print_fieldinfo(cpuname, "cache level",
   1200 	    clidr_fieldinfo, id->ac_clidr);
   1201 	print_fieldinfo(cpuname, "cache type",
   1202 	    ctr_fieldinfo, id->ac_ctr);
   1203 }
   1204 
   1205 bool
   1206 identifycpu_bind(void)
   1207 {
   1208 	return false;
   1209 }
   1210 
   1211 int
   1212 ucodeupdate_check(int fd, struct cpu_ucode *uc)
   1213 {
   1214 	return 0;
   1215 }
   1216