root/arch/mips/include/asm/octeon/cvmx-coremask.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. cvmx_coremask_is_core_set
  2. cvmx_coremask_copy
  3. cvmx_coremask_set64
  4. cvmx_coremask_clear_core

   1 /*
   2  * This file is subject to the terms and conditions of the GNU General Public
   3  * License.  See the file "COPYING" in the main directory of this archive
   4  * for more details.
   5  *
   6  * Copyright (c) 2016  Cavium Inc. (support@cavium.com).
   7  *
   8  */
   9 
  10 /*
  11  * Module to support operations on bitmap of cores. Coremask can be used to
  12  * select a specific core, a group of cores, or all available cores, for
  13  * initialization and differentiation of roles within a single shared binary
  14  * executable image.
  15  *
  16  * The core numbers used in this file are the same value as what is found in
  17  * the COP0_EBASE register and the rdhwr 0 instruction.
  18  *
  19  * For the CN78XX and other multi-node environments the core numbers are not
  20  * contiguous.  The core numbers for the CN78XX are as follows:
  21  *
  22  * Node 0:      Cores 0 - 47
  23  * Node 1:      Cores 128 - 175
  24  * Node 2:      Cores 256 - 303
  25  * Node 3:      Cores 384 - 431
  26  *
  27  */
  28 
  29 #ifndef __CVMX_COREMASK_H__
  30 #define __CVMX_COREMASK_H__
  31 
  32 #define CVMX_MIPS_MAX_CORES 1024
  33 /* bits per holder */
  34 #define CVMX_COREMASK_ELTSZ 64
  35 
  36 /* cvmx_coremask_t's size in u64 */
  37 #define CVMX_COREMASK_BMPSZ (CVMX_MIPS_MAX_CORES / CVMX_COREMASK_ELTSZ)
  38 
  39 
  40 /* cvmx_coremask_t */
  41 struct cvmx_coremask {
  42         u64 coremask_bitmap[CVMX_COREMASK_BMPSZ];
  43 };
  44 
  45 /*
  46  * Is ``core'' set in the coremask?
  47  */
  48 static inline bool cvmx_coremask_is_core_set(const struct cvmx_coremask *pcm,
  49                                             int core)
  50 {
  51         int n, i;
  52 
  53         n = core % CVMX_COREMASK_ELTSZ;
  54         i = core / CVMX_COREMASK_ELTSZ;
  55 
  56         return (pcm->coremask_bitmap[i] & ((u64)1 << n)) != 0;
  57 }
  58 
  59 /*
  60  * Make a copy of a coremask
  61  */
  62 static inline void cvmx_coremask_copy(struct cvmx_coremask *dest,
  63                                       const struct cvmx_coremask *src)
  64 {
  65         memcpy(dest, src, sizeof(*dest));
  66 }
  67 
  68 /*
  69  * Set the lower 64-bit of the coremask.
  70  */
  71 static inline void cvmx_coremask_set64(struct cvmx_coremask *pcm,
  72                                        uint64_t coremask_64)
  73 {
  74         pcm->coremask_bitmap[0] = coremask_64;
  75 }
  76 
  77 /*
  78  * Clear ``core'' from the coremask.
  79  */
  80 static inline void cvmx_coremask_clear_core(struct cvmx_coremask *pcm, int core)
  81 {
  82         int n, i;
  83 
  84         n = core % CVMX_COREMASK_ELTSZ;
  85         i = core / CVMX_COREMASK_ELTSZ;
  86         pcm->coremask_bitmap[i] &= ~(1ull << n);
  87 }
  88 
  89 #endif /* __CVMX_COREMASK_H__ */

/* [<][>][^][v][top][bottom][index][help] */