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