coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mpidr.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __ARCH_MPIDR_H__
4 #define __ARCH_MPIDR_H__
5 
6 #include <stdint.h>
7 #include <arch/lib_helpers.h>
8 
9 enum {
13 
19 };
20 
21 static inline uint64_t mpidr_mask(uint8_t aff3, uint8_t aff2,
22  uint8_t aff1, uint8_t aff0)
23 {
24  uint64_t mpidr = 0;
25 
26  mpidr |= (uint64_t)aff3 << MPIDR_AFFINITY_3_SHIFT;
27  mpidr |= (uint64_t)aff2 << MPIDR_AFFINITY_2_SHIFT;
28  mpidr |= (uint64_t)aff1 << MPIDR_AFFINITY_1_SHIFT;
29  mpidr |= (uint64_t)aff0 << MPIDR_AFFINITY_0_SHIFT;
30 
31  return mpidr;
32 }
33 
34 static inline uint64_t read_mpidr(void)
35 {
36  return raw_read_mpidr_el1();
37 }
38 
39 static inline uint64_t read_affinity_mpidr(void)
40 {
41  uint64_t affinity_mask;
44  return read_mpidr() & affinity_mask;
45 }
46 
47 #endif /* __ARCH_MPIDR_H__ */
static uint64_t read_affinity_mpidr(void)
Definition: mpidr.h:39
@ MPIDR_AFFINITY_2_SHIFT
Definition: mpidr.h:16
@ MPIDR_AFFINITY_0_SHIFT
Definition: mpidr.h:14
@ MPIDR_AFFINITY_MASK
Definition: mpidr.h:18
@ MPIDR_U_SHIFT
Definition: mpidr.h:11
@ MPIDR_RES1_SHIFT
Definition: mpidr.h:10
@ MPIDR_AFFINITY_3_SHIFT
Definition: mpidr.h:17
@ MPIDR_AFFINITY_1_SHIFT
Definition: mpidr.h:15
@ MPIDR_MT_SHIFT
Definition: mpidr.h:12
static uint64_t read_mpidr(void)
Definition: mpidr.h:34
static uint64_t mpidr_mask(uint8_t aff3, uint8_t aff2, uint8_t aff1, uint8_t aff0)
Definition: mpidr.h:21
unsigned long long uint64_t
Definition: stdint.h:17
unsigned char uint8_t
Definition: stdint.h:8