github.com/primecitizens/pcz/std@v0.2.1/core/cpu/cpu_ppc64x.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2017 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build ppc64 || ppc64le
     9  
    10  package cpu
    11  
    12  const CacheLinePadSize = 128
    13  
    14  // For ppc64(le), it is safe to check only for ISA level starting on ISA v3.00,
    15  // since there are no optional categories. There are some exceptions that also
    16  // require kernel support to work (darn, scv), so there are feature bits for
    17  // those as well. The minimum processor requirement is POWER8 (ISA 2.07).
    18  // The struct is padded to avoid false sharing.
    19  var (
    20  	options = []option{
    21  		{Name: "darn", Feature: &PPC64.HasDARN},
    22  		{Name: "scv", Feature: &PPC64.HasSCV},
    23  		{Name: "power9", Feature: &PPC64.IsPOWER9},
    24  	}
    25  )
    26  
    27  func doinit() {
    28  	osinit()
    29  }
    30  
    31  func isSet(hwc uint, value uint) bool {
    32  	return hwc&value != 0
    33  }
    34  
    35  func Name() string {
    36  	switch {
    37  	case PPC64.IsPOWER10:
    38  		return "POWER10"
    39  	case PPC64.IsPOWER9:
    40  		return "POWER9"
    41  	case PPC64.IsPOWER8:
    42  		return "POWER8"
    43  	}
    44  	return ""
    45  }