coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spr.h
Go to the documentation of this file.
1 #ifndef CPU_PPC64_SPR_H
2 #define CPU_PPC64_SPR_H
3 
4 #include <arch/byteorder.h> // PPC_BIT()
5 
6 #define SPR_TB 0x10C
7 
8 #define SPR_PVR 0x11F
9 #define SPR_PVR_REV_MASK (PPC_BITMASK(52, 55) | PPC_BITMASK(60, 63))
10 #define SPR_PVR_REV(maj, min) (PPC_SHIFT((maj), 55) | PPC_SHIFT((min), 63))
11 
12 #define SPR_HSPRG0 0x130
13 #define SPR_HSPRG1 0x131
14 
15 #define SPR_HRMOR 0x139
16 
17 #define SPR_HMER 0x150
18 /* Bits in HMER/HMEER */
19 #define SPR_HMER_MALFUNCTION_ALERT PPC_BIT(0)
20 #define SPR_HMER_PROC_RECV_DONE PPC_BIT(2)
21 #define SPR_HMER_PROC_RECV_ERROR_MASKED PPC_BIT(3)
22 #define SPR_HMER_TFAC_ERROR PPC_BIT(4)
23 #define SPR_HMER_TFMR_PARITY_ERROR PPC_BIT(5)
24 #define SPR_HMER_XSCOM_FAIL PPC_BIT(8)
25 #define SPR_HMER_XSCOM_DONE PPC_BIT(9)
26 #define SPR_HMER_PROC_RECV_AGAIN PPC_BIT(11)
27 #define SPR_HMER_WARN_RISE PPC_BIT(14)
28 #define SPR_HMER_WARN_FALL PPC_BIT(15)
29 #define SPR_HMER_SCOM_FIR_HMI PPC_BIT(16)
30 #define SPR_HMER_TRIG_FIR_HMI PPC_BIT(17)
31 #define SPR_HMER_HYP_RESOURCE_ERR PPC_BIT(20)
32 #define SPR_HMER_XSCOM_STATUS PPC_BITMASK(21, 23)
33 #define SPR_HMER_XSCOM_OCCUPIED PPC_BIT(23)
34 
35 #ifndef __ASSEMBLER__
36 #include <types.h>
37 
38 static inline uint64_t read_spr(int spr)
39 {
40  uint64_t val;
41  asm volatile("mfspr %0,%1" : "=r"(val) : "i"(spr) : "memory");
42  return val;
43 }
44 
45 static inline void write_spr(int spr, uint64_t val)
46 {
47  asm volatile("mtspr %0, %1" :: "i"(spr), "r"(val) : "memory");
48 }
49 
50 static inline uint64_t read_hmer(void)
51 {
52  return read_spr(SPR_HMER);
53 }
54 
55 static inline void clear_hmer(void)
56 {
57  write_spr(SPR_HMER, 0);
58 }
59 
60 static inline uint64_t read_msr(void)
61 {
62  uint64_t val;
63  asm volatile("mfmsr %0" : "=r"(val) :: "memory");
64  return val;
65 }
66 
67 static inline uint64_t pvr_revision(void)
68 {
70 }
71 
72 #endif /* __ASSEMBLER__ */
73 #endif /* CPU_PPC64_SPR_H */
static uint64_t pvr_revision(void)
Definition: spr.h:67
static void write_spr(int spr, uint64_t val)
Definition: spr.h:45
#define SPR_PVR_REV_MASK
Definition: spr.h:9
static uint64_t read_hmer(void)
Definition: spr.h:50
#define SPR_PVR
Definition: spr.h:8
static uint64_t read_spr(int spr)
Definition: spr.h:38
#define SPR_HMER
Definition: spr.h:17
static void clear_hmer(void)
Definition: spr.h:55
static uint64_t read_msr(void)
Definition: spr.h:60
unsigned long long uint64_t
Definition: stdint.h:17
u8 val
Definition: sys.c:300