1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build ppc64 ppc64le
6
7package cpu
8
9const cacheLineSize = 128
10
11// HWCAP/HWCAP2 bits. These are exposed by the kernel.
12const (
13	// ISA Level
14	_PPC_FEATURE2_ARCH_2_07 = 0x80000000
15	_PPC_FEATURE2_ARCH_3_00 = 0x00800000
16
17	// CPU features
18	_PPC_FEATURE2_DARN = 0x00200000
19	_PPC_FEATURE2_SCV  = 0x00100000
20)
21
22func doinit() {
23	// HWCAP2 feature bits
24	PPC64.IsPOWER8 = isSet(HWCap2, _PPC_FEATURE2_ARCH_2_07)
25	PPC64.IsPOWER9 = isSet(HWCap2, _PPC_FEATURE2_ARCH_3_00)
26	PPC64.HasDARN = isSet(HWCap2, _PPC_FEATURE2_DARN)
27	PPC64.HasSCV = isSet(HWCap2, _PPC_FEATURE2_SCV)
28}
29
30func isSet(hwc uint, value uint) bool {
31	return hwc&value != 0
32}
33