aae381cb168ed199a782e3ec96d3061df3a4904a
[dragonfly.git] / sys / dev / misc / ecc / ecc_e5_reg.h
1 #ifndef _ECC_E5_REG_H_
2 #define _ECC_E5_REG_H_
3
4 #ifndef _SYS_BITOPS_H_
5 #include <sys/bitops.h>
6 #endif
7
8 #define PCI_E5_VID_ID                           0x8086
9 #define PCI_E5_IMC_CHN_MAX                      4
10 #define PCI_E5_IMC_DIMM_MAX                     3
11 #define PCI_E5_IMC_ERROR_RANK_MAX               8
12
13 #define PCISLOT_E5_UBOX0                        11
14 #define PCIFUNC_E5_UBOX0                        0
15 #define PCI_E5_UBOX0_DID_ID                     0x0e1e
16 #define PCI_E5_UBOX0_CPUNODEID                  0x40
17 #define PCI_E5_UBOX0_CPUNODEID_LCLNODEID        __BITS(0, 2) /* local socket */
18
19 #define PCISLOT_E5_IMC_CPGC                     15
20 #define PCIFUNC_E5_IMC_CPGC                     0
21 #define PCI_E5_IMC_CPGC_DID_ID                  0x0ea8
22 #define PCI_E5_IMC_CPGC_MCMTR                   0x7c
23 #define PCI_E5_IMC_CPGC_MCMTR_CHN_DISABLE(c)    __BIT(16 + (c))
24 #define PCI_E5_IMC_CPGC_MCMTR_IMC_MODE          __BITS(12, 13)
25 #define PCI_E5_IMC_CPGC_MCMTR_IMC_MODE_DDR3     0
26 #define PCI_E5_IMC_CPGC_MCMTR_ECC_EN            __BIT(2)
27
28 /* Channel Target Address Decoder, per-channel */
29 #define PCISLOT_E5_IMC_CTAD                     15
30 #define PCIFUNC_E5_IMC_CTAD(c)                  (2 + (c))
31 #define PCI_E5_IMC_CTAD_DID_ID(c)               (0x0eaa + (c))
32 #define PCI_E5_IMC_CTAD_DIMMMTR(dimm)           (0x80 + ((dimm) * 4))
33 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_DISABLE(r) __BIT(16 + (r))
34 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_DISABLE_ALL __BITS(16, 19)
35 #define PCI_E5_IMC_CTAD_DIMMMTR_DIMM_POP        __BIT(14)
36 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_CNT        __BITS(12, 13)
37 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_CNT_SR     0
38 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_CNT_DR     1
39 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_CNT_QR     2
40 #define PCI_E5_IMC_CTAD_DIMMMTR_RANK_CNT_RSVD   3
41 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_WIDTH      __BITS(7, 8)
42 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_WIDTH_4    0
43 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_WIDTH_8    1
44 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_WIDTH_16   2
45 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_WIDTH_RSVD 3
46 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_DNSTY      __BITS(5, 6)
47 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_DNSTY_1G   0
48 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_DNSTY_2G   1
49 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_DNSTY_4G   2
50 #define PCI_E5_IMC_CTAD_DIMMMTR_DDR3_DNSTY_8G   3
51
52 /* ERROR, per-channel */
53 #define PCISLOT_E5_IMC_ERROR                    16
54 #define PCIFUNC_E5_IMC_ERROR_CHN0               2
55 #define PCIFUNC_E5_IMC_ERROR_CHN1               3
56 #define PCIFUNC_E5_IMC_ERROR_CHN2               6
57 #define PCIFUNC_E5_IMC_ERROR_CHN3               7
58 #define PCI_E5_IMC_ERROR_CHN0_DID_ID            0x0eb2
59 #define PCI_E5_IMC_ERROR_CHN1_DID_ID            0x0eb3
60 #define PCI_E5_IMC_ERROR_CHN2_DID_ID            0x0eb6
61 #define PCI_E5_IMC_ERROR_CHN3_DID_ID            0x0eb7
62 #define PCI_E5_IMC_ERROR_COR_ERR_CNT(i)         (0x104 + ((i) * 4))
63 #define PCI_E5_IMC_ERROR_COR_ERR_CNT_HI_OVFL    __BIT(31)
64 #define PCI_E5_IMC_ERROR_COR_ERR_CNT_HI         __BITS(16, 30)
65 #define PCI_E5_IMC_ERROR_COR_ERR_CNT_LO_OVFL    __BIT(15)
66 #define PCI_E5_IMC_ERROR_COR_ERR_CNT_LO         __BITS(0, 14)
67 #define PCI_E5_IMC_ERROR_COR_ERR_TH(i)          (0x11c + ((i) * 4))
68 #define PCI_E5_IMC_ERROR_COR_ERR_TH_HI          __BITS(16, 30)
69 #define PCI_E5_IMC_ERROR_COR_ERR_TH_LO          __BITS(0, 14)
70 #define PCI_E5_IMC_ERROR_COR_ERR_STAT           0x134
71 #define PCI_E5_IMC_ERROR_COR_ERR_STAT_RANKS     __BITS(0, 7)
72
73 /* Thermal, per-channel */
74 #define PCISLOT_E5_IMC_THERMAL                  16
75 #define PCIFUNC_E5_IMC_THERMAL_CHN0             0
76 #define PCIFUNC_E5_IMC_THERMAL_CHN1             1
77 #define PCIFUNC_E5_IMC_THERMAL_CHN2             4
78 #define PCIFUNC_E5_IMC_THERMAL_CHN3             5
79 #define PCI_E5_IMC_THERMAL_CHN0_DID_ID          0x0eb0
80 #define PCI_E5_IMC_THERMAL_CHN1_DID_ID          0x0eb1
81 #define PCI_E5_IMC_THERMAL_CHN2_DID_ID          0x0eb4
82 #define PCI_E5_IMC_THERMAL_CHN3_DID_ID          0x0eb5
83 #define PCI_E5_IMC_THERMAL_DIMMTEMPSTAT(dimm)   (0x150 + ((dimm) * 4))
84 #define PCI_E5_IMC_THERMAL_DIMMTEMPSTAT_TEMP    __BITS(0, 7)
85
86 #endif  /* !_ECC_E5_REG_H_ */