blob: 8aaeef545a76bee1f012a9fe4f02d65150b187ce [file] [log] [blame]
Tobias Klauserfead7902019-03-11 09:36:29 +01001// Copyright 2019 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
Russ Cox9a761022021-02-19 22:57:36 -05005//go:build aix
Clément Chigot1151b9d2020-05-13 10:39:30 +02006// +build aix
Tobias Klauserfead7902019-03-11 09:36:29 +01007
8package cpu
9
Tobias Klauserfead7902019-03-11 09:36:29 +010010const (
11 // getsystemcfg constants
12 _SC_IMPL = 2
13 _IMPL_POWER8 = 0x10000
14 _IMPL_POWER9 = 0x20000
15)
16
Polina Osadcha0cf76232020-07-09 09:47:37 +030017func archInit() {
Brad Fitzpatrick36263982019-05-28 09:09:44 -070018 impl := getsystemcfg(_SC_IMPL)
Tobias Klauserfead7902019-03-11 09:36:29 +010019 if impl&_IMPL_POWER8 != 0 {
20 PPC64.IsPOWER8 = true
21 }
22 if impl&_IMPL_POWER9 != 0 {
Tobias Klauserb0526f32021-05-10 22:48:28 +020023 PPC64.IsPOWER8 = true
Tobias Klauserfead7902019-03-11 09:36:29 +010024 PPC64.IsPOWER9 = true
25 }
26
27 Initialized = true
28}
Brad Fitzpatrick36263982019-05-28 09:09:44 -070029
30func getsystemcfg(label int) (n uint64) {
31 r0, _ := callgetsystemcfg(label)
32 n = uint64(r0)
33 return
34}